Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions .docdrift.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# doc-drift-checker: reports README sections whose linked code changed while the
# section did not. Runs on pull requests in CI (job `drift`), warn-only for now.
docs:
- "README.md"

# A present `ignore` key replaces the built-in list, so the defaults are repeated.
ignore:
# tests
- "**/*_test.go"
- "**/*.test.*"
- "**/*.spec.*"
- "**/test/**"
- "**/tests/**"
- "**/__tests__/**"
- "**/testdata/**"
# generated code
- "**/*.pb.go"
- "**/*_gen.go"
- "**/*.generated.*"
- "**/generated/**"
- "**/*.min.js"
# lockfiles
- "**/go.sum"
- "**/package-lock.json"
- "**/yarn.lock"
- "**/pnpm-lock.yaml"
- "**/composer.lock"
- "**/Cargo.lock"
- "**/Gemfile.lock"
- "**/poetry.lock"
- "**/uv.lock"
# vendored code
- "**/vendor/**"
- "**/node_modules/**"
- "**/third_party/**"
# not described by README sections
- "CHANGELOG.md"
- "LICENSE"
- ".github/**"

# A key is the full heading text including the emoji, or "#" plus the anchor
# ("#-flags"). A key that matches no heading is ignored silently.
# "🔢 Exit codes" is deliberately not mapped: the exit codes come out of
# internal/cli/run.go, which changes with almost every feature, so a mapping
# would report drift on changes that leave the exit codes untouched.
mappings:
"🚩 Flags":
- "internal/cli/root.go"
"🛡️ Stopping safely":
- "internal/kill/**"
21 changes: 21 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,24 @@ jobs:
- uses: golangci/golangci-lint-action@v8
with:
version: latest

drift:
# Warn-only: reports README sections whose linked code changed (see .docdrift.yaml).
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-go@v5
with:
# The checker is built independently of this project's Go version.
go-version: stable
- name: Install doc-drift-checker
run: go install github.com/JtheGunner/doc-drift-checker/cmd/doc-drift-checker@v0.2.2
- name: Check README drift
env:
BASE_REF: ${{ github.base_ref }}
run: |
git fetch --no-tags origin "+refs/heads/${BASE_REF}:refs/remotes/origin/${BASE_REF}"
"$(go env GOPATH)/bin/doc-drift-checker" check --base "origin/${BASE_REF}" --format github --warn-only
4 changes: 4 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ go test -tags e2e ./e2e
go run ./cmd/portwhy 3000
```

## README drift check

CI job `drift` (pull requests only, warn-only) runs doc-drift-checker, pinned to a version in `ci.yaml`, with `.docdrift.yaml`. A `mappings` key is the full heading text including the emoji (or `#` plus the anchor, e.g. `#-flags`); a key that matches no heading is ignored silently, so verify with `doc-drift-checker links`. `🔢 Exit codes` is deliberately unmapped (`internal/cli/run.go` changes with almost every feature). A present `ignore` key replaces the built-in list, so the defaults are repeated there; keep them in sync when upgrading the tool. Moving to `--min-severity high` is a separate decision after a few weeks of warnings.

## Decisions on record

- macOS socket data comes from an own `lsof`/`netstat` parser (`internal/socket`); `gopsutil` is not adopted. Spike outcome: it was not added or run (no network access), but from memory its macOS connection listing also shells out to `lsof` (unverified), so it would add a dependency without removing the external tool, and without root `lsof` sees only own processes either way, which the `netstat` merge (PID 0 for invisible owners) covers. Revisit only if the parser proves fragile. Process data (`ps`) follows in the process-reader ticket.
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ go test -tags e2e ./e2e # end-to-end tests against real local listeners
go run ./cmd/portwhy --version
```

Pull requests are also checked by [doc-drift-checker](https://github.com/JtheGunner/doc-drift-checker), which warns when code linked to a README section changed but the section did not. The links live in [`.docdrift.yaml`](.docdrift.yaml); the check only warns and never fails the build.

---

## 📝 Changelog
Expand Down
Loading