From ea20944f4217090d57a75591ab69932e9de300c7 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Sun, 29 Nov 2026 02:27:15 +0100 Subject: [PATCH 1/6] (docs): tie each doc to the code it covers and require it in PRs that change that code (#1353) Docs declare covers: globs in front matter; check-docs requires a PR that changes a covered file to change a doc that covers it, or to carry no-docs with a reason, and reports app files no doc covers. --- .ai/agent-practices.md | 4 + .ai/contexts/README.md | 4 + .ai/contexts/_issues.md | 13 ++ .ai/contexts/activitywatch.md | 10 ++ .ai/contexts/app-dialogs.md | 16 +++ .ai/contexts/bg-agents.md | 40 ++++++ .ai/contexts/build-release.md | 48 +++++-- .ai/contexts/changes-view.md | 27 ++++ .ai/contexts/cli-harnesses.md | 28 ++++ .ai/contexts/cli-session-state.md | 19 +++ .ai/contexts/fast-check.md | 15 ++- .ai/contexts/ipc-bridge.md | 76 +++++++++++ .ai/contexts/managed-browser.md | 13 ++ .ai/contexts/module-moves.md | 6 + .ai/contexts/panel-terminal.md | 17 +++ .ai/contexts/plain-terminal.md | 8 ++ .ai/contexts/project-delete.md | 25 ++++ .ai/contexts/project-operation-gate.md | 7 + .ai/contexts/schedule-runner.md | 27 ++++ .ai/contexts/session-cache.md | 78 +++++++++++ .ai/contexts/session-index-writer.md | 20 +++ .ai/contexts/session-state.md | 41 ++++++ .ai/contexts/subagent-observability.md | 34 +++++ .ai/contexts/terminal-path-links.md | 11 ++ .ai/contexts/terminal-refresh.md | 11 ++ .ai/contexts/terminal-right-click.md | 10 ++ .ai/contexts/theme.md | 10 ++ .ai/contexts/tool-bar.md | 6 + .ai/contexts/touched-files.md | 16 +++ .ai/contexts/trigger-watcher.md | 37 ++++++ .ai/contexts/updater-relaunch.md | 8 ++ .ai/contexts/viewer-panel.md | 28 ++++ .ai/contexts/window-frame.md | 21 +++ .github/workflows/test.yml | 8 ++ README.md | 7 + docs/activity-stats.md | 7 + docs/activity-trace.md | 10 ++ docs/activitywatch.md | 6 + docs/automation.md | 7 + docs/background-agents.md | 8 ++ docs/branching.md | 8 ++ docs/changelog.md | 85 +++++++++--- docs/changes-view.md | 6 + docs/customizing-colors.md | 8 ++ docs/decisions/0001-no-full-go-rewrite.md | 5 + .../0002-discrete-steps-sidebar-animations.md | 5 + .../0003-trigger-delivery-per-tab.md | 14 ++ .../0004-session-index-single-writer.md | 20 +++ docs/decisions/0004-session-index-study.md | 34 +++++ .../0005-main-process-context-layout.md | 5 + docs/decisions/0006-search-refs.md | 8 ++ docs/development.md | 11 ++ docs/e2e.md | 7 + docs/evidence/session-capabilities/README.md | 5 + docs/grid-overview.md | 6 + docs/ide-emulation.md | 6 + docs/keyboard-shortcuts.md | 9 ++ docs/launching-sessions.md | 10 ++ docs/live-testing.md | 7 + docs/memory-workfiles.md | 10 ++ docs/module-moves.md | 8 ++ docs/notifications.md | 10 ++ docs/product/BUILDING-BLOCKS.md | 25 ++++ docs/product/CONCEPT-MAP.md | 27 ++++ docs/product/GLOSSARY.md | 41 ++++++ docs/product/UI-PATTERNS.md | 31 +++++ docs/releasing.md | 12 ++ docs/remote-hosts.md | 8 ++ docs/sandbox.md | 5 + docs/schedules.md | 6 + docs/session-browser.md | 11 ++ docs/session-restore.md | 7 + docs/settings.md | 6 + docs/subagents.md | 12 ++ docs/terminal.md | 11 ++ docs/testing-a-pr.md | 6 + docs/touched-files.md | 8 ++ docs/window.md | 10 ++ docs/worktrees.md | 8 ++ scripts/check-doc-refs.js | 3 +- scripts/check-docs.js | 110 +++++++++++++--- test/check-doc-refs.test.js | 9 ++ test/check-docs.test.js | 124 ++++++++++++++++-- 83 files changed, 1488 insertions(+), 66 deletions(-) diff --git a/.ai/agent-practices.md b/.ai/agent-practices.md index 123c16496..0859273b0 100644 --- a/.ai/agent-practices.md +++ b/.ai/agent-practices.md @@ -52,6 +52,10 @@ verifies claims with **executed evidence** — actually running the command, the `git log`/`git show`/`wc -l` check — rather than re-reading the diff and trusting the prose. Findings get fixed, then re-reviewed, until the loop is clean. +Review checklist: + +- the docs touched describe what this PR changes + ## 4. Shell pitfalls in an agent harness Commands that read fine to a human can silently misbehave or get blocked in an agent diff --git a/.ai/contexts/README.md b/.ai/contexts/README.md index e02e5b719..a9061da52 100644 --- a/.ai/contexts/README.md +++ b/.ai/contexts/README.md @@ -1,3 +1,7 @@ +--- +covers: [] +--- + # Context engineering — Switchboard Thirty sub-system docs, written for AI agents who need to make a focused diff --git a/.ai/contexts/_issues.md b/.ai/contexts/_issues.md index bc3bdd789..84804a29d 100644 --- a/.ai/contexts/_issues.md +++ b/.ai/contexts/_issues.md @@ -1,3 +1,16 @@ +--- +covers: + - "main.js" + - "preload.js" + - "public/jsonl-viewer.js" + - "public/sidebar.js" + - "public/viewer-panel.js" + - "session-cache.js" + - "session-index-store.js" + - "src/main/integrations/mcp/mcp-bridge.js" + - "src/main/schedules/schedule-runner.js" +--- + # Observations from writing the context docs Captured 2026-05-30 while writing the .ai/contexts/*.md files; pruned 2026-11-24 against main 4d468532 (resolved items removed). None are blockers; they're follow-ups worth picking up when adjacent work happens. diff --git a/.ai/contexts/activitywatch.md b/.ai/contexts/activitywatch.md index 8bd9f1586..df685212e 100644 --- a/.ai/contexts/activitywatch.md +++ b/.ai/contexts/activitywatch.md @@ -1,3 +1,13 @@ +--- +covers: + - "main.js" + - "public/activity-reporting-panel.js" + - "public/app.js" + - "session-transitions.js" + - "src/main/integrations/activitywatch/activitywatch-client.js" + - "src/main/integrations/activitywatch/activitywatch-reporter.js" +--- + # Context: activitywatch Switchboard reports session activity to a local [ActivityWatch](https://activitywatch.net) diff --git a/.ai/contexts/app-dialogs.md b/.ai/contexts/app-dialogs.md index 9e655bdd4..50bb6ef24 100644 --- a/.ai/contexts/app-dialogs.md +++ b/.ai/contexts/app-dialogs.md @@ -1,3 +1,19 @@ +--- +covers: + - "public/activity-trace-panel.js" + - "public/app-dialogs.js" + - "public/app-notices.js" + - "public/app.js" + - "public/dialogs.js" + - "public/file-panel.js" + - "public/modal-stack.js" + - "public/setting-defaults.js" + - "public/settings-panel.js" + - "public/viewer-panel.js" + - "src/main/app/ui-notice-log.js" + - "src/main/shared/redact-log-text.js" +--- + # Renderer modal stack and questions ## Runtime launch form (#1201) diff --git a/.ai/contexts/bg-agents.md b/.ai/contexts/bg-agents.md index 092d64928..f48571f3a 100644 --- a/.ai/contexts/bg-agents.md +++ b/.ai/contexts/bg-agents.md @@ -1,3 +1,43 @@ +--- +covers: + - "bridge-session-id.js" + - "claude-binary.js" + - "cli-session-state.js" + - "delete-session-guard.js" + - "derive-project-path.js" + - "main.js" + - "preload.js" + - "project-root.js" + - "public/agents-view.js" + - "public/app-notices.js" + - "public/app.js" + - "public/dialogs.js" + - "public/index.html" + - "public/resume-guard.js" + - "public/session-activity-dom.js" + - "public/shortcuts.js" + - "public/sidebar.js" + - "public/stop-session-ui.js" + - "public/style.css" + - "session-continuations.js" + - "session-transitions.js" + - "sidebar-bg-sessions.js" + - "src/main/app/session-exit.js" + - "src/main/bg-agents/bg-agents-ipc.js" + - "src/main/bg-agents/bg-agents-roster.js" + - "src/main/bg-agents/bg-agents.js" + - "src/main/bg-agents/bg-handoff.js" + - "src/main/bg-agents/bg-worker-liveness.js" + - "src/main/projects/project-delete-main.js" + - "src/main/projects/project-delete-stop.js" + - "src/main/terminals/pty-ops.js" + - "src/main/terminals/shell-profiles.js" + - "src/main/terminals/tab-input-lock.js" + - "src/main/terminals/terminal-input.js" + - "task-records.js" + - "workers/task-records.js" +--- + # Context: bg-agents ## Scheduled background jobs (#611, CLI 2.1.302 Windows measurements) diff --git a/.ai/contexts/build-release.md b/.ai/contexts/build-release.md index 4e6f5baf8..81cd8dd1c 100644 --- a/.ai/contexts/build-release.md +++ b/.ai/contexts/build-release.md @@ -1,3 +1,23 @@ +--- +covers: + - ".github/workflows/build.yml" + - ".github/workflows/pr-title.yml" + - ".github/workflows/release-provenance.yml" + - ".github/workflows/test.yml" + - "package-lock.json" + - "package.json" + - "scripts/after-pack.js" + - "scripts/check-changelog.js" + - "scripts/check-docs.js" + - "scripts/check-release-provenance.js" + - "scripts/check-release-tag.js" + - "scripts/lint-pr-title.js" + - "scripts/platform-tests.js" + - "scripts/postinstall.js" + - "scripts/publish-release.sh" + - "src/main/app/changelog.js" +--- + # Build and release workflow ## Advisory PR title check @@ -314,19 +334,21 @@ no dependency) and is blocking; its rules are in [changelog.md](../../docs/changelog.md#doc-references). The `docs` job invokes `scripts/check-docs.js` with the PR base/head SHAs and -repository/PR number, full checkout history and `GH_TOKEN`. It reuses -`check-changelog.js`'s app-path classification and label validation, reads a -NUL-delimited `git diff --name-only --no-renames ...`, and fetches -current labels via `gh api`. App changes need a changed `docs/`, `.ai/contexts/` -or `README.md` path, or the exact `no-docs` label; non-app changes pass. -Errors reading inputs fail closed with exit 2; missing docs exits 1. -`test/check-docs.test.js` loads the real script with plain require and a VM -with a filename, substituting only command execution for the CLI checks. -The rule and PR-body requirements are in [changelog.md](../../docs/changelog.md#documentation-in-the-same-pr). -The gate does not assess relevance, require both doc categories, or parse the -PR body. Adding the label requires a job rerun, as for `no-changelog`. -Creating the label and making `docs` a required check are separate repository -administration actions; this workflow does neither. +repository/PR number, full checkout history and `GH_TOKEN`. Node 22 installs +locked dependencies with lifecycle scripts disabled for the existing js-yaml +parser. The gate reuses the changelog app-path classification, reads a +NUL-delimited diff with renames disabled and fetches live labels and PR body. +Each covered app change needs a changed doc whose `covers` matches it; uncovered +app files retain the any-doc fallback and are printed as an advisory inventory. +The exact `no-docs` label requires a nonempty `no docs: ` body line. +Unknown metadata keys, malformed covers or globs without a tracked match fail +even a docs-only PR. Metadata is validated here so the gate cannot rely on +invalid declarations. Operational failures exit 2; missing docs or invalid +coverage exit 1. Unit tests load the real script with plain require and a VM +with a filename; only CLI command/filesystem boundaries are substituted. +The rule is in [changelog.md](../../docs/changelog.md#documentation-in-the-same-pr). +Review still assesses the prose. Adding the label or editing the reason needs +a rerun. Required-check settings and label creation remain separate actions. Linux runs the full Node suite with coverage. Every non-Linux runner runs `node scripts/run-tests.js --platform-only` without c8; its matrix and job diff --git a/.ai/contexts/changes-view.md b/.ai/contexts/changes-view.md index 2c2e01f31..ec2260a95 100644 --- a/.ai/contexts/changes-view.md +++ b/.ai/contexts/changes-view.md @@ -1,3 +1,30 @@ +--- +covers: + - "delete-session-target.js" + - "derive-project-path.js" + - "main.js" + - "public/app.js" + - "public/file-panel.js" + - "public/index.html" + - "public/session-activity-dom.js" + - "public/session-activity.js" + - "public/splitter.js" + - "public/style.css" + - "read-session-file.js" + - "src/main/changes/git-changes-file.js" + - "src/main/changes/git-changes-runner.js" + - "src/main/changes/git-changes-target.js" + - "src/main/changes/git-changes-watch.js" + - "src/main/changes/git-changes.js" + - "src/main/remote/remote-attach.js" + - "src/main/remote/remote-hosts.js" + - "src/main/remote/remote-index.js" + - "src/main/remote/remote-stop.js" + - "src/main/schedules/run-schedule-now-target.js" + - "src/main/shared/ipc-path-validator.js" + - "src/main/shared/run-to-exit.js" +--- + # Context: changes-view ## Local file toolbar actions (#1203) diff --git a/.ai/contexts/cli-harnesses.md b/.ai/contexts/cli-harnesses.md index 8c4148397..0de4288b6 100644 --- a/.ai/contexts/cli-harnesses.md +++ b/.ai/contexts/cli-harnesses.md @@ -1,3 +1,31 @@ +--- +covers: + - "classify-title-activity.js" + - "delete-session-guard.js" + - "delete-session-target.js" + - "harnesses/claude.js" + - "harnesses/codex.js" + - "harnesses/contract.js" + - "harnesses/index.js" + - "jsonl-scan.js" + - "main.js" + - "preload.js" + - "public/app.js" + - "public/grid-view.js" + - "public/setting-defaults.js" + - "public/sidebar.js" + - "read-session-file.js" + - "scripts/launcher-env.js" + - "scripts/test-pr.js" + - "session-cache.js" + - "session-index-commands.js" + - "session-index-store.js" + - "session-transitions.js" + - "src/main/terminals/plain-terminal-shell.js" + - "src/main/usage/codex-usage.js" + - "workers/session-index-writer.js" +--- + # CLI harness port ## Isolated developer launchers (#1314) diff --git a/.ai/contexts/cli-session-state.md b/.ai/contexts/cli-session-state.md index 7c1e88ee8..7b156c3c7 100644 --- a/.ai/contexts/cli-session-state.md +++ b/.ai/contexts/cli-session-state.md @@ -1,3 +1,22 @@ +--- +covers: + - "bridge-session-id.js" + - "cli-session-state.js" + - "main.js" + - "public/app-notices.js" + - "public/resume-guard.js" + - "public/sidebar.js" + - "session-transitions.js" + - "src/main/bg-agents/bg-worker-liveness.js" + - "src/main/cli/proc-start.js" + - "src/main/cli/session-state-v1.js" + - "src/main/projects/project-delete-main.js" + - "src/main/terminals/windows-job-helper.ps1" + - "src/main/triggers/session-status.js" + - "src/main/triggers/trigger-context.js" + - "workers/task-records.js" +--- + # Context: cli-session-state The process-table timeout is an `execFile` child-kill budget, not a hard diff --git a/.ai/contexts/fast-check.md b/.ai/contexts/fast-check.md index 702f1a3b6..1af82848e 100644 --- a/.ai/contexts/fast-check.md +++ b/.ai/contexts/fast-check.md @@ -1,3 +1,13 @@ +--- +covers: + - ".husky/pre-commit" + - "Taskfile.yaml" + - "scripts/check-doc-refs.js" + - "scripts/check-docs.js" + - "scripts/check-fast.js" + - "scripts/run-tests.js" +--- + # Fast pre-commit check `scripts/check-fast.js` is the common entry point for `task check:fast` and @@ -5,7 +15,10 @@ the hook's fallback when Task is absent. `SKIP_TESTS` with any nonempty value skips tests, retaining staged-JS lint in both routes. When any staged path ends in `.md`, it first spawns `scripts/check-doc-refs.js --root ` (the whole tree, about a second) and returns its status if nonzero; `SKIP_TESTS` does not -skip it. A rename in JavaScript that breaks a doc is caught by `task check` and +skip it. Reference scanning skips initial YAML front matter, retaining body +line numbers. Coverage declarations are validated by the separate PR docs gate +(`scripts/check-docs.js`), which requires a changed matching doc for covered app +files and prints uncovered files. A rename in JavaScript that breaks a doc is caught by `task check` and the `docs-refs` CI job, not here. Rules are in [changelog.md](../../docs/changelog.md#doc-references). `task check` and the full suite runner remain unchanged and are the required gate before a PR. diff --git a/.ai/contexts/ipc-bridge.md b/.ai/contexts/ipc-bridge.md index e940af85a..051278e99 100644 --- a/.ai/contexts/ipc-bridge.md +++ b/.ai/contexts/ipc-bridge.md @@ -1,3 +1,79 @@ +--- +covers: + - "classify-title-activity.js" + - "claude-auth.js" + - "db.js" + - "delete-session-target.js" + - "eslint.config.js" + - "fts-match.js" + - "local-transcript-activity.js" + - "main.js" + - "preload.js" + - "public/activity-trace-panel.js" + - "public/activity-trace.js" + - "public/app-dialogs.js" + - "public/app-notices.js" + - "public/app.js" + - "public/archived-manager.js" + - "public/index.html" + - "public/local-transcript-adapter.js" + - "public/memory-workfiles-view.js" + - "public/session-activity-dom.js" + - "public/session-activity.js" + - "public/session-state.js" + - "public/setting-defaults.js" + - "public/settings-panel.js" + - "public/sidebar.js" + - "public/style.css" + - "public/terminal-manager.js" + - "public/terminal-replay-queries.js" + - "public/utils.js" + - "public/worktree-nesting.js" + - "scan-md-files.js" + - "scripts/postinstall.js" + - "scripts/test-pr.js" + - "session-cache.js" + - "session-transitions.js" + - "src/main/app/main-error-handlers.js" + - "src/main/app/power-log.js" + - "src/main/app/ui-notice-log.js" + - "src/main/app/unsaved-guard.js" + - "src/main/app/window-theme.js" + - "src/main/bg-agents/bg-agents-ipc.js" + - "src/main/bg-agents/bg-handoff.js" + - "src/main/changes/git-changes-file.js" + - "src/main/changes/git-changes-runner.js" + - "src/main/changes/git-changes-watch.js" + - "src/main/changes/git-changes.js" + - "src/main/integrations/mcp/mcp-bridge.js" + - "src/main/projects/last-known-projects.js" + - "src/main/projects/project-delete-ipc.js" + - "src/main/remote/remote-attach.js" + - "src/main/remote/remote-hosts.js" + - "src/main/remote/remote-stop.js" + - "src/main/schedules/run-schedule-now-target.js" + - "src/main/schedules/schedule-delete-file.js" + - "src/main/schedules/schedule-ipc.js" + - "src/main/schedules/schedule-list.js" + - "src/main/shared/activity-trace.js" + - "src/main/shared/clean-env.js" + - "src/main/shared/diagnostic-files.js" + - "src/main/shared/ipc-path-validator.js" + - "src/main/shared/resolve-path-on-disk.js" + - "src/main/terminals/composer-state.js" + - "src/main/terminals/no-cli-restart.js" + - "src/main/terminals/output-buffer.js" + - "src/main/terminals/pre-launch-cmd-guard.js" + - "src/main/terminals/pty-ops.js" + - "src/main/terminals/stop-process-tree.js" + - "src/main/terminals/terminal-input.js" + - "src/main/terminals/terminal-path-target.js" + - "src/main/triggers/trigger-renderer-bridge.js" + - "src/main/triggers/trigger-watcher.js" + - "src/main/usage/codex-usage.js" + - "worktree-delete.js" +--- + # Context: ipc-bridge ## UI notice log (#1196) diff --git a/.ai/contexts/managed-browser.md b/.ai/contexts/managed-browser.md index 6ddd43fa5..6f3737630 100644 --- a/.ai/contexts/managed-browser.md +++ b/.ai/contexts/managed-browser.md @@ -1,3 +1,16 @@ +--- +covers: + - "harnesses/claude.js" + - "public/setting-defaults.js" + - "scripts/test-pr.js" + - "src/main/browser/discovery.js" + - "src/main/browser/linux-process.js" + - "src/main/browser/managed-browser.js" + - "src/main/browser/owner-lock.js" + - "src/main/browser/storage.js" + - "src/main/browser/transport.js" +--- + # Managed browser lifecycle (#812) `src/main/browser/managed-browser.js` exports `createManager` and diff --git a/.ai/contexts/module-moves.md b/.ai/contexts/module-moves.md index 26c3f8f70..f3b247a02 100644 --- a/.ai/contexts/module-moves.md +++ b/.ai/contexts/module-moves.md @@ -1,3 +1,9 @@ +--- +covers: + - "scripts/module-paths.js" + - "scripts/move-modules.js" +--- + # Module-move tooling `scripts/move-modules.js` plans reference rewrites using `scripts/module-paths.js`. diff --git a/.ai/contexts/panel-terminal.md b/.ai/contexts/panel-terminal.md index 4052503d4..0df272585 100644 --- a/.ai/contexts/panel-terminal.md +++ b/.ai/contexts/panel-terminal.md @@ -1,3 +1,20 @@ +--- +covers: + - "cli-session-state.js" + - "main.js" + - "public/app.js" + - "public/file-panel.js" + - "public/grid-view.js" + - "public/panel-terminal.js" + - "public/splitter.js" + - "public/terminal-manager.js" + - "session-cache.js" + - "session-transitions.js" + - "src/main/changes/git-changes-target.js" + - "src/main/terminals/panel-terminal-target.js" + - "src/main/terminals/terminal-path-target.js" +--- + # Context: panel-terminal **Purpose**: a shell inside the right-hand file panel, below whatever the panel diff --git a/.ai/contexts/plain-terminal.md b/.ai/contexts/plain-terminal.md index 9bd4548a0..627317d43 100644 --- a/.ai/contexts/plain-terminal.md +++ b/.ai/contexts/plain-terminal.md @@ -1,3 +1,11 @@ +--- +covers: + - "main.js" + - "src/main/shared/clean-env.js" + - "src/main/terminals/plain-terminal-shell.js" + - "src/main/terminals/shell-profiles.js" +--- + # Context: plain-terminal **Purpose**: a plain terminal (sidebar "+" → Terminal, and the panel shell of diff --git a/.ai/contexts/project-delete.md b/.ai/contexts/project-delete.md index 256d692ad..2d41334fd 100644 --- a/.ai/contexts/project-delete.md +++ b/.ai/contexts/project-delete.md @@ -1,3 +1,28 @@ +--- +covers: + - "derive-project-path.js" + - "main.js" + - "public/archived-manager.js" + - "public/memory-workfiles-view.js" + - "public/setting-defaults.js" + - "public/settings-panel.js" + - "public/sidebar.js" + - "session-index-writer.js" + - "src/main/projects/project-archive-workflow.js" + - "src/main/projects/project-delete-identity.js" + - "src/main/projects/project-delete-ipc.js" + - "src/main/projects/project-delete-main.js" + - "src/main/projects/project-delete-owner.js" + - "src/main/projects/project-delete-plan.js" + - "src/main/projects/project-delete-progress.js" + - "src/main/projects/project-delete-stop.js" + - "src/main/projects/project-delete-timer.js" + - "src/main/projects/project-delete-worktrees.js" + - "src/main/projects/project-delete-writer.js" + - "src/main/projects/project-delete.js" + - "workers/session-index-writer.js" +--- + # Project deletion (#474 A4a–A4d, E) ## Repository session grouping (#1137) diff --git a/.ai/contexts/project-operation-gate.md b/.ai/contexts/project-operation-gate.md index 714001734..e60e794f3 100644 --- a/.ai/contexts/project-operation-gate.md +++ b/.ai/contexts/project-operation-gate.md @@ -1,3 +1,10 @@ +--- +covers: + - "main.js" + - "src/main/projects/project-delete.js" + - "src/main/shared/project-operation-gate.js" +--- + # Project operation gate (#474 A3) `src/main/shared/project-operation-gate.js` exports the main-process singleton diff --git a/.ai/contexts/schedule-runner.md b/.ai/contexts/schedule-runner.md index 0a6ec191f..c0dbdf066 100644 --- a/.ai/contexts/schedule-runner.md +++ b/.ai/contexts/schedule-runner.md @@ -1,3 +1,30 @@ +--- +covers: + - "archived-projects.js" + - "claude-binary.js" + - "file-lists.js" + - "main.js" + - "public/dialogs.js" + - "public/index.html" + - "public/memory-workfiles-view.js" + - "public/resume-guard.js" + - "public/schedules-view.js" + - "public/sidebar.js" + - "scan-md-files.js" + - "session-index-writer.js" + - "src/main/schedules/run-schedule-now-target.js" + - "src/main/schedules/schedule-background.js" + - "src/main/schedules/schedule-delete-file.js" + - "src/main/schedules/schedule-history-import.js" + - "src/main/schedules/schedule-ipc.js" + - "src/main/schedules/schedule-list.js" + - "src/main/schedules/schedule-run-results.js" + - "src/main/schedules/schedule-runner.js" + - "src/main/schedules/schedules-tab-migration.js" + - "src/main/shared/normalize-project-path.js" + - "workers/session-index-writer.js" +--- + # Context: schedule-runner ## Opt-in background runs (#611) diff --git a/.ai/contexts/session-cache.md b/.ai/contexts/session-cache.md index 55970c6ef..f0d918b80 100644 --- a/.ai/contexts/session-cache.md +++ b/.ai/contexts/session-cache.md @@ -1,3 +1,81 @@ +--- +covers: + - "archived-projects.js" + - "cache-effects.js" + - "db.js" + - "derive-project-path.js" + - "encode-project-path.js" + - "file-lists.js" + - "folder-index-state.js" + - "fts-match.js" + - "harnesses/claude.js" + - "harnesses/codex.js" + - "harnesses/contract.js" + - "harnesses/index.js" + - "jsonl-scan.js" + - "local-transcript-activity.js" + - "main.js" + - "preload.js" + - "project-remap.js" + - "projects-worker-client.js" + - "public/app.js" + - "public/bridge-url.js" + - "public/choice-dialog.js" + - "public/dialogs.js" + - "public/remote-activity-ui.js" + - "public/remote-enrol-panel.js" + - "public/restore-plan.js" + - "public/session-activity-dom.js" + - "public/session-activity.js" + - "public/settings-panel.js" + - "public/sidebar.js" + - "public/stats-view.js" + - "public/task-registry.js" + - "public/utils.js" + - "public/worktree-nesting.js" + - "read-session-file.js" + - "remote-activity.js" + - "search-worker-client.js" + - "session-cache.js" + - "session-continuations.js" + - "session-index-commands.js" + - "session-index-store.js" + - "session-index-writer-client.js" + - "session-index-writer.js" + - "session-name.js" + - "src/main/changes/remote-touched-files.js" + - "src/main/projects/last-known-projects.js" + - "src/main/projects/project-delete-writer.js" + - "src/main/remote/remote-attach.js" + - "src/main/remote/remote-enrol.js" + - "src/main/remote/remote-host-profile.js" + - "src/main/remote/remote-hosts.js" + - "src/main/remote/remote-index.js" + - "src/main/remote/remote-launch.js" + - "src/main/remote/remote-mirror.js" + - "src/main/remote/remote-send.js" + - "src/main/remote/remote-ssh-binary.js" + - "src/main/remote/remote-stop.js" + - "src/main/remote/remote-transport.js" + - "src/main/remote/remote-watch.js" + - "src/main/session-index/full-read-state.js" + - "src/main/session-index/message-count.js" + - "src/main/session-index/read-counters.js" + - "src/main/session-index/session-refs.js" + - "src/main/shared/atomic-write.js" + - "src/main/shared/ipc-path-validator.js" + - "src/main/shared/long-path.js" + - "src/main/terminals/panel-terminal-target.js" + - "src/main/terminals/pty-ops.js" + - "src/main/triggers/trigger-actions.js" + - "subagent-attribution.js" + - "workers/projects-query.js" + - "workers/scan-projects.js" + - "workers/scan-session-titles.js" + - "workers/search-query.js" + - "workers/session-index-writer.js" +--- + # Context: session-cache **Purpose**: index every Claude session JSONL on disk, and every Codex rollout under `$CODEX_HOME/sessions` (folders `codex/...`, rows with `runtime: 'codex'`; see [cli-harnesses](cli-harnesses.md)), into a queryable SQLite cache so the sidebar renders without re-scanning `~/.claude/projects/` and so search is full-text. Watches the projects directory for changes and refreshes incrementally. diff --git a/.ai/contexts/session-index-writer.md b/.ai/contexts/session-index-writer.md index 039d17458..d3232c60c 100644 --- a/.ai/contexts/session-index-writer.md +++ b/.ai/contexts/session-index-writer.md @@ -1,3 +1,23 @@ +--- +covers: + - "cache-effects.js" + - "db.js" + - "folder-index-state.js" + - "public/worktree-nesting.js" + - "session-index-commands.js" + - "session-index-store.js" + - "session-index-writer-client.js" + - "session-index-writer.js" + - "src/main/projects/project-delete-main.js" + - "src/main/projects/project-delete-progress.js" + - "src/main/projects/project-delete-writer.js" + - "src/main/triggers/trigger-watcher.js" + - "workers/file-lists-query.js" + - "workers/projects-query.js" + - "workers/search-query.js" + - "workers/session-index-writer.js" +--- + # Session index writer — ADR 0004 slice 1b, step 1 Scope: one writable WAL connection in a Node worker; one main-side readonly diff --git a/.ai/contexts/session-state.md b/.ai/contexts/session-state.md index c928b975a..aaed81485 100644 --- a/.ai/contexts/session-state.md +++ b/.ai/contexts/session-state.md @@ -1,3 +1,44 @@ +--- +covers: + - "cli-session-state.js" + - "eslint.config.js" + - "local-transcript-activity.js" + - "main.js" + - "public/agents-view.js" + - "public/app-notices.js" + - "public/app.js" + - "public/cli-liveness.js" + - "public/dialogs.js" + - "public/file-panel.js" + - "public/jsonl-viewer.js" + - "public/local-transcript-adapter.js" + - "public/process-exit.js" + - "public/remote-activity-ui.js" + - "public/session-activity-dom.js" + - "public/session-activity.js" + - "public/session-state.js" + - "public/session-status-projection.js" + - "public/sidebar.js" + - "public/stop-session-ui.js" + - "public/style.css" + - "public/utils.js" + - "remote-activity.js" + - "session-continuations.js" + - "session-transitions.js" + - "src/main/integrations/mcp/mcp-bridge.js" + - "src/main/remote/remote-attach.js" + - "src/main/remote/remote-index.js" + - "src/main/remote/remote-stop.js" + - "src/main/remote/remote-transport.js" + - "src/main/terminals/no-cli-restart.js" + - "src/main/terminals/pty-ops.js" + - "src/main/triggers/session-status.js" + - "src/main/viewer/transcript-follower.js" + - "transcript-tail.js" + - "transcript-turn.js" + - "workers/task-records.js" +--- + # Session state — one domain module, one icon slot **Purpose**: `public/session-state.js` owns activity and unread transitions for diff --git a/.ai/contexts/subagent-observability.md b/.ai/contexts/subagent-observability.md index 45ad4a3a8..50436e978 100644 --- a/.ai/contexts/subagent-observability.md +++ b/.ai/contexts/subagent-observability.md @@ -1,3 +1,37 @@ +--- +covers: + - "db.js" + - "eslint.config.js" + - "local-transcript-activity.js" + - "main.js" + - "preload.js" + - "public/app.js" + - "public/grid-view.js" + - "public/index.html" + - "public/jsonl-viewer.js" + - "public/local-transcript-adapter.js" + - "public/remote-activity-ui.js" + - "public/session-activity-dom.js" + - "public/shortcuts.js" + - "public/sidebar.js" + - "public/subagent-timing.js" + - "public/task-registry.js" + - "public/terminal-manager.js" + - "read-session-file.js" + - "remote-activity.js" + - "session-cache.js" + - "session-index-store.js" + - "session-index-writer.js" + - "session-transitions.js" + - "src/main/bg-agents/bg-agents-roster.js" + - "subagent-attribution.js" + - "task-records-client.js" + - "task-records.js" + - "task-transcript-reader.js" + - "workers/session-index-writer.js" + - "workers/task-records.js" +--- + # Context: subagent-observability **Purpose**: Surface Claude's subagent runs (child tasks spawned via the `Agent` tool) in the Switchboard sidebar with parent→child grouping, live status badges, and a read-only transcript viewer. Avoid the original mistake of treating subagents as resumable sessions — they're ephemeral and re-resuming corrupts their context. diff --git a/.ai/contexts/terminal-path-links.md b/.ai/contexts/terminal-path-links.md index dfce9bd1a..b5f9acde5 100644 --- a/.ai/contexts/terminal-path-links.md +++ b/.ai/contexts/terminal-path-links.md @@ -1,3 +1,14 @@ +--- +covers: + - "main.js" + - "public/codemirror-setup.js" + - "public/file-panel.js" + - "public/terminal-manager.js" + - "public/terminal-path-links.js" + - "public/touched-files-view.js" + - "src/main/terminals/terminal-path-target.js" +--- + # Context: terminal-path-links **Purpose**: a filesystem path or bare filename printed in the terminal — by an diff --git a/.ai/contexts/terminal-refresh.md b/.ai/contexts/terminal-refresh.md index e8d1ae7c5..c12e29380 100644 --- a/.ai/contexts/terminal-refresh.md +++ b/.ai/contexts/terminal-refresh.md @@ -1,3 +1,14 @@ +--- +covers: + - "public/header-controls.js" + - "public/terminal-manager.js" + - "public/terminal-replay-queries.js" + - "src/main/app/power-log.js" + - "src/main/terminals/output-buffer.js" + - "src/main/terminals/pty-size.js" + - "src/main/terminals/terminal-resize.js" +--- + # Terminal screen refresh Issue #446 adds **Refresh screen** as the first control of `#terminal-header-session`, before Send to background and Stop, and in diff --git a/.ai/contexts/terminal-right-click.md b/.ai/contexts/terminal-right-click.md index a803842ab..0fb94009b 100644 --- a/.ai/contexts/terminal-right-click.md +++ b/.ai/contexts/terminal-right-click.md @@ -1,3 +1,13 @@ +--- +covers: + - "public/app.js" + - "public/dialogs.js" + - "public/setting-defaults.js" + - "public/settings-panel.js" + - "public/terminal-context-menu.js" + - "public/terminal-manager.js" +--- + # Context: terminal-right-click **Purpose**: what the right mouse button does inside a session's terminal. The diff --git a/.ai/contexts/theme.md b/.ai/contexts/theme.md index 9b8fc7421..fb32ca9dc 100644 --- a/.ai/contexts/theme.md +++ b/.ai/contexts/theme.md @@ -1,3 +1,13 @@ +--- +covers: + - "main.js" + - "public/setting-defaults.js" + - "public/style.css" + - "public/terminal-themes.js" + - "public/theme.js" + - "src/main/app/window-theme.js" +--- + # App appearance (#1176) `public/style.css` owns the color tokens: the default `:root` keeps the existing diff --git a/.ai/contexts/tool-bar.md b/.ai/contexts/tool-bar.md index 780db2bf9..055ed9e2f 100644 --- a/.ai/contexts/tool-bar.md +++ b/.ai/contexts/tool-bar.md @@ -1,3 +1,9 @@ +--- +covers: + - "public/style.css" + - "public/tool-bar.js" +--- + # Session tool bar Issue #506, including the shell order fix from #503. diff --git a/.ai/contexts/touched-files.md b/.ai/contexts/touched-files.md index 6c11caea0..ff14cd947 100644 --- a/.ai/contexts/touched-files.md +++ b/.ai/contexts/touched-files.md @@ -1,3 +1,19 @@ +--- +covers: + - "encode-project-path.js" + - "public/file-panel.js" + - "public/header-controls.js" + - "public/touched-files-view.js" + - "public/viewer-toolbar.js" + - "read-session-file.js" + - "src/main/changes/git-changes-file.js" + - "src/main/changes/remote-touched-files.js" + - "src/main/changes/session-touched-files.js" + - "src/main/changes/touched-transcript-cache.js" + - "src/main/files/panel-image.js" + - "src/main/integrations/mcp/mcp-bridge.js" +--- + # Context: touched-files Main-process modules for this context live in `src/main/changes/` (ADR 0005, step 6). diff --git a/.ai/contexts/trigger-watcher.md b/.ai/contexts/trigger-watcher.md index c47a38a3c..801cd4101 100644 --- a/.ai/contexts/trigger-watcher.md +++ b/.ai/contexts/trigger-watcher.md @@ -1,3 +1,40 @@ +--- +covers: + - "claude-binary.js" + - "cli-session-state.js" + - "db.js" + - "harnesses/claude.js" + - "main.js" + - "public/setting-defaults.js" + - "public/terminal-manager.js" + - "remote-activity.js" + - "scripts/claude-sandbox.sh" + - "scripts/platform-tests.js" + - "scripts/run-tests.js" + - "session-transitions.js" + - "src/main/cli/session-state-v1.js" + - "src/main/remote/remote-index.js" + - "src/main/remote/remote-watch.js" + - "src/main/terminals/composer-state.js" + - "src/main/terminals/input-attach.js" + - "src/main/terminals/shell-profiles.js" + - "src/main/terminals/stop-session.js" + - "src/main/terminals/tab-input-lock.js" + - "src/main/terminals/terminal-input.js" + - "src/main/triggers/session-request-contract.js" + - "src/main/triggers/session-request-namespace.js" + - "src/main/triggers/session-request-publication.js" + - "src/main/triggers/session-status.js" + - "src/main/triggers/trigger-actions.js" + - "src/main/triggers/trigger-context.js" + - "src/main/triggers/trigger-launch.js" + - "src/main/triggers/trigger-name.js" + - "src/main/triggers/trigger-renderer-bridge.js" + - "src/main/triggers/trigger-watcher.js" + - "transcript-tail.js" + - "transcript-turn.js" +--- + # Context: trigger-watcher **Purpose**: lets external harness scripts inject keyboard input into open PTY sessions without any Electron IPC. The primary use case is the token-usage harness calling `/compact` on a session when it detects a high context-window fill. It also carries typed read-only requests (`session-status`), versioned open/new/stop actions, and the shared result namespace described below. diff --git a/.ai/contexts/updater-relaunch.md b/.ai/contexts/updater-relaunch.md index cfed995a6..a81718030 100644 --- a/.ai/contexts/updater-relaunch.md +++ b/.ai/contexts/updater-relaunch.md @@ -1,3 +1,11 @@ +--- +covers: + - "main.js" + - "src/main/app/linux-startup.js" + - "src/main/app/relaunch.js" + - "src/main/shared/clean-env.js" +--- + # Linux update relaunch (#590) **Purpose**: after a Linux update installs, start the new version through the diff --git a/.ai/contexts/viewer-panel.md b/.ai/contexts/viewer-panel.md index f8893a788..0a6e9ac44 100644 --- a/.ai/contexts/viewer-panel.md +++ b/.ai/contexts/viewer-panel.md @@ -1,3 +1,31 @@ +--- +covers: + - "eslint.config.js" + - "file-lists-worker-client.js" + - "file-lists.js" + - "main.js" + - "public/activity-trace-panel.js" + - "public/app.js" + - "public/codemirror-setup.js" + - "public/file-panel.js" + - "public/jsonl-viewer.js" + - "public/memory-workfiles-view.js" + - "public/mermaid-setup.js" + - "public/message-search.js" + - "public/style.css" + - "public/viewer-panel.js" + - "public/viewer-toolbar.js" + - "src/main/app/session-exit.js" + - "src/main/app/unsaved-guard.js" + - "src/main/changes/git-changes-watch.js" + - "src/main/files/panel-image.js" + - "src/main/integrations/mcp/mcp-bridge.js" + - "src/main/shared/ipc-path-validator.js" + - "viewer-file-watch.js" + - "viewer-save-guard.js" + - "workers/file-lists-query.js" +--- + # Context: viewer-panel ## Message viewer search (#819) diff --git a/.ai/contexts/window-frame.md b/.ai/contexts/window-frame.md index a468dc7be..9f2462edb 100644 --- a/.ai/contexts/window-frame.md +++ b/.ai/contexts/window-frame.md @@ -1,3 +1,24 @@ +--- +covers: + - "eslint.config.js" + - "main.js" + - "preload.js" + - "public/app-dialogs.js" + - "public/app.js" + - "public/file-panel.js" + - "public/header-controls.js" + - "public/process-exit.js" + - "public/session-activity-dom.js" + - "public/style.css" + - "public/terminal-manager.js" + - "public/window-strip.js" + - "src/main/app/session-exit.js" + - "src/main/app/unsaved-guard.js" + - "src/main/app/window-frame.js" + - "src/main/app/window-theme.js" + - "src/main/terminals/pty-ops.js" +--- + # Context: window-frame **Purpose**: the window has no system title bar and no Electron menu bar. Its diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5e1acb8e8..549525ce9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -63,6 +63,14 @@ jobs: fetch-depth: 0 persist-credentials: false + - uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install the YAML parser without lifecycle scripts + run: npm ci --ignore-scripts + - name: Require documentation for app changes env: GH_TOKEN: ${{ github.token }} diff --git a/README.md b/README.md index 0bab2f0b8..e1e27ca56 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,10 @@ +--- +covers: + - "harnesses/claude.js" + - "harnesses/codex.js" + - "package.json" +--- + # Switchboard A desktop app for Claude Code and Codex CLI sessions. diff --git a/docs/activity-stats.md b/docs/activity-stats.md index 107cd222d..230aad403 100644 --- a/docs/activity-stats.md +++ b/docs/activity-stats.md @@ -1,3 +1,10 @@ +--- +covers: + - "public/stats-view.js" + - "session-index-store.js" + - "src/main/usage/*.js" +--- + # Stats The **Stats** tab summarises the activity recorded in every indexed diff --git a/docs/activity-trace.md b/docs/activity-trace.md index 3da78c545..3a0a9cc0b 100644 --- a/docs/activity-trace.md +++ b/docs/activity-trace.md @@ -1,3 +1,13 @@ +--- +covers: + - "classify-title-activity.js" + - "public/activity-trace-panel.js" + - "public/activity-trace.js" + - "src/main/app/ui-notice-log.js" + - "src/main/shared/activity-trace.js" + - "src/main/shared/redact-log-text.js" +--- + # Activity Trace Notices and question dialogs are also recorded in `main.log`, even with Debug diff --git a/docs/activitywatch.md b/docs/activitywatch.md index ad577ad3a..b7b596e3c 100644 --- a/docs/activitywatch.md +++ b/docs/activitywatch.md @@ -1,3 +1,9 @@ +--- +covers: + - "public/activity-reporting-panel.js" + - "src/main/integrations/activitywatch/*.js" +--- + # ActivityWatch Switchboard can report the time spent on Claude or Codex sessions to diff --git a/docs/automation.md b/docs/automation.md index e9c76f91b..7ed62f64a 100644 --- a/docs/automation.md +++ b/docs/automation.md @@ -1,3 +1,10 @@ +--- +covers: + - "src/main/schedules/*.js" + - "src/main/terminals/composer-state.js" + - "src/main/triggers/*.js" +--- + # Automation Schedules run recurring headless Claude tasks, or, if you opt in, diff --git a/docs/background-agents.md b/docs/background-agents.md index b268228ee..c9998fa8a 100644 --- a/docs/background-agents.md +++ b/docs/background-agents.md @@ -1,3 +1,11 @@ +--- +covers: + - "public/agents-view.js" + - "sidebar-bg-sessions.js" + - "src/main/app/session-exit.js" + - "src/main/bg-agents/*.js" +--- + # Background agents ![The Agents view grouped by state](../build/screenshot-agents.png) diff --git a/docs/branching.md b/docs/branching.md index 5744b013e..33e67dbcb 100644 --- a/docs/branching.md +++ b/docs/branching.md @@ -1,3 +1,11 @@ +--- +covers: + - ".github/workflows/build.yml" + - ".github/workflows/pr-title.yml" + - ".github/workflows/release-provenance.yml" + - "scripts/check-release-provenance.js" +--- + # Branches How branches are named, protected and merged in `devsuitup/switchboard`, and diff --git a/docs/changelog.md b/docs/changelog.md index 99222cefd..61736c57b 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,14 @@ +--- +covers: + - ".github/workflows/test.yml" + - "public/whats-new.js" + - "scripts/check-changelog.js" + - "scripts/check-doc-refs.js" + - "scripts/check-docs.js" + - "scripts/doc-refs-allow.json" + - "src/main/app/changelog.js" +--- + # Changelog [`CHANGELOG.md`](../CHANGELOG.md) at the repository root says what changes for @@ -124,38 +135,70 @@ needs no update, explain why. If neither needs an update, write `no docs: ` and apply the `no-docs` label. The PR template also asks for the summary, changelog entry or `no-changelog` waiver, and test results. -The PR-only `docs` job in `.github/workflows/test.yml` invokes the -dependency-free `scripts/check-docs.js`. It shares the changelog check's app -path classification: root JavaScript except `eslint.config.js`, `src/`, -`public/`, `workers/`, `harnesses/`, and `scripts/claude-sandbox.sh`. -An app change must include at least one changed path under `docs/` or -`.ai/contexts/`, or `README.md`, unless it has the exact `no-docs` label. -Test-only, CI-only, tooling-only and docs-only changes pass automatically. -`CHANGELOG.md` and `.ai/shared-guidelines.md` alone do not satisfy this gate. +The PR-only `docs` job in `.github/workflows/test.yml` invokes +`scripts/check-docs.js`. It shares the changelog check's app path classification: +root JavaScript except `eslint.config.js`, `src/`, `public/`, `workers/`, +`harnesses/`, and `scripts/claude-sandbox.sh`. + +Every agent context and every user page describing code declares YAML front +matter at the start of the file. For example: + +```yaml +--- +covers: + - "src/main/changes/git-changes*.js" + - "public/file-panel.js" +--- +``` -Like the changelog check, it reads the whole merge-base PR diff with renames -disabled and reads current labels through `gh api`. After adding `no-docs`, -re-run the failed job. This waiver is independent of `no-changelog`. +Paths are relative to the repository root and use forward slashes. A single +star matches within one path segment; a double-star segment matches zero or +more directories (or any remaining path when last). Quote globs. Exact paths +are preferred where the whole directory is not documented. The only metadata +key is `covers`, an array of strings; unknown keys, malformed YAML, absolute +paths, parent traversal and patterns matching no tracked file fail the check. +Each `.ai/contexts/*.md` must declare it. The context index uses `covers: []` +because it routes readers rather than describing code; other navigation-only +pages can omit front matter. + +For each changed app file covered by a doc, at least one changed doc must cover +that file. Changing an unrelated page does not satisfy it. If several docs +cover a file, one is sufficient mechanically. A deleted doc cannot count. +App files with no covering doc keep the previous fallback: any changed doc +under `docs/` or `.ai/contexts/`, or `README.md`. The check prints all uncovered +app files and their count, including on success; this inventory is advisory. +`CHANGELOG.md` and `.ai/shared-guidelines.md` alone do not satisfy the gate. +Non-app changes need no doc update, but their coverage metadata is validated. + +The exact `no-docs` label waives the update requirement only with a nonempty +`no docs: ` line in the PR body, replacing the placeholder with the +reason. It does not waive invalid coverage metadata. The checker reads the +whole merge-base PR diff with renames disabled, current labels and current +body through `gh api`. Re-run the job after adding the label or editing the +reason. This waiver is independent of `no-changelog`. ```bash node scripts/check-docs.js --base --head --repo --pr -node scripts/check-docs.js --base --head --labels '["no-docs"]' +node scripts/check-docs.js --base --head --labels '["no-docs"]' --body 'no docs: internal refactor' ``` -Exit codes are 0 for a pass, 1 for missing docs, and 2 for invalid arguments, -invalid labels or a git/gh failure. `test/check-docs.test.js` covers the rule -and CLI wiring, substituting only the git/gh command boundary. -The check detects paths, not documentation quality or relevance; it does not -parse the PR body or require both documentation categories mechanically. -Reviewers still check that each affected document is updated and named. -Repository label creation and required-check settings are maintained separately -from this workflow. +Validation lives in the docs gate so invalid declarations cannot weaken the +same decision that uses them. It uses the existing js-yaml development +dependency; the CI job installs locked dependencies with lifecycle scripts +disabled. It reads tracked, existing Markdown files from the checkout. +Exit codes are 0 for a pass, 1 for missing docs or invalid coverage metadata, +and 2 for invalid arguments, labels or a git/gh/read failure. +`test/check-docs.test.js` covers the rule and CLI wiring using the shipped +module and injected command/filesystem boundaries. Reviewers still check that +the docs touched describe what this PR changes: file coverage cannot prove +prose quality, and does not require both doc categories mechanically. +Repository label creation and required-check settings are separate. ## Doc references `scripts/check-doc-refs.js` checks that what the documentation cites still exists. It reads `docs/**/*.md`, `.ai/**/*.md` and `README.md` from the working -tree (tracked plus untracked, not ignored, files), skipping fenced code blocks. +tree (tracked plus untracked, not ignored, files), skipping fenced code blocks and initial YAML front matter while preserving body line numbers. It runs as the blocking `docs-refs` job in `.github/workflows/test.yml` on every PR and push, at the end of `task check`, and in the pre-commit fast check when a Markdown file is staged. diff --git a/docs/changes-view.md b/docs/changes-view.md index 0e19fff45..b0a80a55c 100644 --- a/docs/changes-view.md +++ b/docs/changes-view.md @@ -1,3 +1,9 @@ +--- +covers: + - "public/file-panel.js" + - "src/main/changes/git-changes*.js" +--- + # Changes View **Changes** shows a session's working tree as git sees it — the changed files, diff --git a/docs/customizing-colors.md b/docs/customizing-colors.md index 4c77a9420..fb64842fe 100644 --- a/docs/customizing-colors.md +++ b/docs/customizing-colors.md @@ -1,3 +1,11 @@ +--- +covers: + - "public/style.css" + - "public/terminal-themes.js" + - "public/theme.js" + - "scripts/apply-theme.ps1" +--- + # Customizing colors ## App appearance diff --git a/docs/decisions/0001-no-full-go-rewrite.md b/docs/decisions/0001-no-full-go-rewrite.md index 536c6363a..bfa4536fb 100644 --- a/docs/decisions/0001-no-full-go-rewrite.md +++ b/docs/decisions/0001-no-full-go-rewrite.md @@ -1,3 +1,8 @@ +--- +covers: + - "main.js" +--- + # 0001 — No full Go rewrite; Go backend sidecar only, if ever **Status**: Accepted (2026-06-08) diff --git a/docs/decisions/0002-discrete-steps-sidebar-animations.md b/docs/decisions/0002-discrete-steps-sidebar-animations.md index 02fd6a51f..02b33b054 100644 --- a/docs/decisions/0002-discrete-steps-sidebar-animations.md +++ b/docs/decisions/0002-discrete-steps-sidebar-animations.md @@ -1,3 +1,8 @@ +--- +covers: + - "public/style.css" +--- + # 0002 — Steady-state indicator animations must be discrete (`steps()`), never smooth 60fps **Status**: Accepted (2026-08-19) diff --git a/docs/decisions/0003-trigger-delivery-per-tab.md b/docs/decisions/0003-trigger-delivery-per-tab.md index 7a9597c9f..6d5ca0d7c 100644 --- a/docs/decisions/0003-trigger-delivery-per-tab.md +++ b/docs/decisions/0003-trigger-delivery-per-tab.md @@ -1,3 +1,17 @@ +--- +covers: + - ".github/workflows/build.yml" + - ".github/workflows/test.yml" + - "cli-session-state.js" + - "main.js" + - "session-cache.js" + - "session-continuations.js" + - "session-transitions.js" + - "src/main/terminals/plain-terminal-shell.js" + - "src/main/triggers/trigger-context.js" + - "src/main/triggers/trigger-watcher.js" +--- + # 0003 — Deliver triggers under one tab lock and a per-write ownership check **Status**: Accepted (2026-10-13). The maintainer's decisions on the four open questions (13/10) are recorded under "Maintainer decisions". No implementation existed at acceptance. diff --git a/docs/decisions/0004-session-index-single-writer.md b/docs/decisions/0004-session-index-single-writer.md index 5730dfb2b..4e85bb7c3 100644 --- a/docs/decisions/0004-session-index-single-writer.md +++ b/docs/decisions/0004-session-index-single-writer.md @@ -1,3 +1,23 @@ +--- +covers: + - "db.js" + - "folder-index-state.js" + - "local-transcript-activity.js" + - "main.js" + - "package.json" + - "public/app.js" + - "public/session-activity.js" + - "read-session-file.js" + - "scripts/postinstall.js" + - "session-cache.js" + - "session-index-writer.js" + - "session-transitions.js" + - "src/main/remote/remote-hosts.js" + - "workers/projects-query.js" + - "workers/search-query.js" + - "workers/session-index-writer.js" +--- + # 0004 — Update the session index incrementally through one writer and bind the display with deltas **Status**: Decided (2026-10-14), following the maintainer decisions for #616 and the review of PR #640. Implementation, performance acceptance and packaged-build qualification remain pending. diff --git a/docs/decisions/0004-session-index-study.md b/docs/decisions/0004-session-index-study.md index 172363ded..bb797a5b6 100644 --- a/docs/decisions/0004-session-index-study.md +++ b/docs/decisions/0004-session-index-study.md @@ -1,3 +1,37 @@ +--- +covers: + - "archived-projects.js" + - "db.js" + - "folder-index-state.js" + - "main.js" + - "package.json" + - "preload.js" + - "project-remap.js" + - "projects-worker-client.js" + - "public/agents-view.js" + - "public/app.js" + - "public/dialogs.js" + - "public/local-transcript-adapter.js" + - "public/remote-activity-ui.js" + - "public/session-activity.js" + - "public/settings-panel.js" + - "public/sidebar.js" + - "public/task-registry.js" + - "read-session-file.js" + - "scripts/postinstall.js" + - "search-worker-client.js" + - "session-cache.js" + - "session-transitions.js" + - "src/main/app/changelog.js" + - "src/main/remote/remote-hosts.js" + - "src/main/remote/remote-index.js" + - "src/main/schedules/schedule-runner.js" + - "workers/projects-query.js" + - "workers/scan-projects.js" + - "workers/scan-session-titles.js" + - "workers/search-query.js" +--- + # Session index study — reads, writes and display refreshes Initial inspection: 2026-10-14 at `33e8e10f63be0c1b51062e457000683393469cac`; second review revision verified against `433ba39d68dcf891eca58eae69518d31d2cc2923`; third review revision verified against `9b75e8d`, branch `docs/616-index-architecture-adr`. Production source is the merged slices 1–2 baseline. PR #637 is closed, superseded by ADR 0004; its source at `5053d7f` and the supplied review are evidence about that proposal, not code present in this branch. No production code or user database was changed. diff --git a/docs/decisions/0005-main-process-context-layout.md b/docs/decisions/0005-main-process-context-layout.md index 45f522f6c..131f9fc0d 100644 --- a/docs/decisions/0005-main-process-context-layout.md +++ b/docs/decisions/0005-main-process-context-layout.md @@ -1,3 +1,8 @@ +--- +covers: + - "main.js" +--- + # 0005 — Move main-process modules into flat contexts Status: Accepted by JB, 2026-10-28. Preparation: #832; lint prerequisite: #833. diff --git a/docs/decisions/0006-search-refs.md b/docs/decisions/0006-search-refs.md index 9138b3450..f00f61a52 100644 --- a/docs/decisions/0006-search-refs.md +++ b/docs/decisions/0006-search-refs.md @@ -1,3 +1,11 @@ +--- +covers: + - "fts-match.js" + - "public/sidebar.js" + - "src/main/session-index/session-refs.js" + - "workers/search-query.js" +--- + # 0006 — Index the identifiers of the whole session beside its opening text Status: Proposed, 2026-11-25, for 0.1.0-beta.2 (#1255). diff --git a/docs/development.md b/docs/development.md index 0c936a8a9..279d50b95 100644 --- a/docs/development.md +++ b/docs/development.md @@ -1,3 +1,14 @@ +--- +covers: + - "Taskfile.yaml" + - "package.json" + - "public/codemirror-setup.js" + - "public/mermaid-setup.js" + - "scripts/check-doc-refs.js" + - "scripts/postinstall.js" + - "scripts/run-tests.js" +--- + # Development ## Prerequisites diff --git a/docs/e2e.md b/docs/e2e.md index e7655e994..db8effadb 100644 --- a/docs/e2e.md +++ b/docs/e2e.md @@ -1,3 +1,10 @@ +--- +covers: + - ".c8rc.json" + - ".github/workflows/test.yml" + - "e2e/*.js" +--- + # End-to-end journeys `e2e/` holds a few Playwright journeys that launch the real Electron app and diff --git a/docs/evidence/session-capabilities/README.md b/docs/evidence/session-capabilities/README.md index 55323a9b8..c5164edf2 100644 --- a/docs/evidence/session-capabilities/README.md +++ b/docs/evidence/session-capabilities/README.md @@ -1,3 +1,8 @@ +--- +covers: + - "scripts/canary-cli-capabilities.js" +--- + # Phase 0 CLI capability evidence (#380) This is an evidence-only harness. It never qualifies production capabilities, diff --git a/docs/grid-overview.md b/docs/grid-overview.md index ccdc1e443..acc02568d 100644 --- a/docs/grid-overview.md +++ b/docs/grid-overview.md @@ -1,3 +1,9 @@ +--- +covers: + - "public/grid-view.js" + - "public/terminal-manager.js" +--- + # Grid Overview The grid shows every session open in Switchboard as a card holding its live diff --git a/docs/ide-emulation.md b/docs/ide-emulation.md index 935cc2187..9c4fe9304 100644 --- a/docs/ide-emulation.md +++ b/docs/ide-emulation.md @@ -1,3 +1,9 @@ +--- +covers: + - "public/file-panel.js" + - "src/main/integrations/mcp/*.js" +--- + # IDE Emulation With IDE Emulation on, Switchboard presents itself to each Claude session as diff --git a/docs/keyboard-shortcuts.md b/docs/keyboard-shortcuts.md index 85f999b16..344fbc825 100644 --- a/docs/keyboard-shortcuts.md +++ b/docs/keyboard-shortcuts.md @@ -1,3 +1,12 @@ +--- +covers: + - "public/app-dialogs.js" + - "public/modal-stack.js" + - "public/shortcuts.js" + - "public/viewer-toolbar.js" + - "src/main/app/window-frame.js" +--- + # Keyboard Shortcuts "Primary" below is `Cmd` on macOS and `Ctrl` on Windows and Linux. diff --git a/docs/launching-sessions.md b/docs/launching-sessions.md index 870444f3d..4b772f6b0 100644 --- a/docs/launching-sessions.md +++ b/docs/launching-sessions.md @@ -1,3 +1,13 @@ +--- +covers: + - "harnesses/*.js" + - "main.js" + - "public/dialogs.js" + - "public/resume-guard.js" + - "src/main/terminals/plain-terminal-shell.js" + - "src/main/terminals/shell-profiles.js" +--- + # Launching Sessions A Claude Code or Codex session started, resumed or forked from this machine's sidebar is a diff --git a/docs/live-testing.md b/docs/live-testing.md index 76d024784..d268b9199 100644 --- a/docs/live-testing.md +++ b/docs/live-testing.md @@ -1,3 +1,10 @@ +--- +covers: + - "e2e/fixtures.js" + - "scripts/launcher-env.js" + - "scripts/schedule-dataset.js" +--- + # Live Testing with a Throwaway HOME An instance with its own `SWITCHBOARD_DATA_DIR` has its own database and its own diff --git a/docs/memory-workfiles.md b/docs/memory-workfiles.md index 6f91dd298..d3a9253e8 100644 --- a/docs/memory-workfiles.md +++ b/docs/memory-workfiles.md @@ -1,3 +1,13 @@ +--- +covers: + - "file-lists-worker-client.js" + - "file-lists.js" + - "public/memory-workfiles-view.js" + - "public/viewer-panel.js" + - "scan-md-files.js" + - "workers/file-lists-query.js" +--- + # Agent Files and session files The Agent Files sidebar tab lists instruction and memory files and opens them diff --git a/docs/module-moves.md b/docs/module-moves.md index ddab1880c..0e2377122 100644 --- a/docs/module-moves.md +++ b/docs/module-moves.md @@ -1,3 +1,11 @@ +--- +covers: + - "scripts/module-paths.js" + - "scripts/move-modules.js" + - "scripts/source-map.json" + - "src/main/viewer/file-lists-path.js" +--- + # Moving main-process modules Follow [ADR 0005](decisions/0005-main-process-context-layout.md) and check open work before moving a context. diff --git a/docs/notifications.md b/docs/notifications.md index 92cf6fedb..f7fc8d77a 100644 --- a/docs/notifications.md +++ b/docs/notifications.md @@ -1,3 +1,13 @@ +--- +covers: + - "public/app-notices.js" + - "public/session-activity-dom.js" + - "public/session-state.js" + - "public/session-status-projection.js" + - "src/main/app/main-error-handlers.js" + - "src/main/app/ui-notice-log.js" +--- + # Status Indicators Every session row in the sidebar has one status icon, left of its name, so the diff --git a/docs/product/BUILDING-BLOCKS.md b/docs/product/BUILDING-BLOCKS.md index 8cadc2175..59c822b97 100644 --- a/docs/product/BUILDING-BLOCKS.md +++ b/docs/product/BUILDING-BLOCKS.md @@ -1,3 +1,28 @@ +--- +covers: + - "eslint.config.js" + - "public/activity-trace-panel.js" + - "public/agents-view.js" + - "public/app-dialogs.js" + - "public/app-notices.js" + - "public/app.js" + - "public/choice-dialog.js" + - "public/dialogs.js" + - "public/file-panel.js" + - "public/grid-view.js" + - "public/header-controls.js" + - "public/index.html" + - "public/memory-workfiles-view.js" + - "public/modal-stack.js" + - "public/process-exit.js" + - "public/session-activity-dom.js" + - "public/session-state.js" + - "public/sidebar.js" + - "public/style.css" + - "public/tool-bar.js" + - "public/touched-files-view.js" +--- + # Building blocks > The original audit and its numeric source references describe v0.0.94. diff --git a/docs/product/CONCEPT-MAP.md b/docs/product/CONCEPT-MAP.md index db8034af8..5808a50f6 100644 --- a/docs/product/CONCEPT-MAP.md +++ b/docs/product/CONCEPT-MAP.md @@ -1,3 +1,30 @@ +--- +covers: + - "delete-session-guard.js" + - "main.js" + - "public/agents-view.js" + - "public/app.js" + - "public/dialogs.js" + - "public/file-panel.js" + - "public/grid-view.js" + - "public/index.html" + - "public/process-exit.js" + - "public/resume-guard.js" + - "public/session-activity-dom.js" + - "public/session-state.js" + - "public/session-status-projection.js" + - "public/settings-panel.js" + - "public/shortcuts.js" + - "public/sidebar.js" + - "public/stop-session-ui.js" + - "public/style.css" + - "public/terminal-context-menu.js" + - "public/tool-bar.js" + - "public/utils.js" + - "session-cache.js" + - "src/main/app/session-exit.js" +--- + # Concept map > The original audit and its numeric source references describe v0.0.94. diff --git a/docs/product/GLOSSARY.md b/docs/product/GLOSSARY.md index c43816276..7cdd21e99 100644 --- a/docs/product/GLOSSARY.md +++ b/docs/product/GLOSSARY.md @@ -1,3 +1,44 @@ +--- +covers: + - "cli-session-state.js" + - "derive-project-path.js" + - "main.js" + - "public/agents-view.js" + - "public/app.js" + - "public/dialogs.js" + - "public/file-panel.js" + - "public/grid-view.js" + - "public/index.html" + - "public/jsonl-viewer.js" + - "public/message-search.js" + - "public/panel-terminal.js" + - "public/process-exit.js" + - "public/restore-plan.js" + - "public/resume-guard.js" + - "public/session-activity-dom.js" + - "public/session-state.js" + - "public/settings-panel.js" + - "public/sidebar.js" + - "public/stop-session-ui.js" + - "public/terminal-manager.js" + - "public/worktree-nesting.js" + - "read-session-file.js" + - "session-cache.js" + - "session-continuations.js" + - "session-index-store.js" + - "src/main/app/session-exit.js" + - "src/main/bg-agents/bg-agents-roster.js" + - "src/main/bg-agents/bg-agents.js" + - "src/main/remote/remote-attach.js" + - "src/main/remote/remote-send.js" + - "src/main/schedules/run-schedule-now-target.js" + - "src/main/schedules/schedule-ipc.js" + - "src/main/schedules/schedule-runner.js" + - "src/main/terminals/plain-terminal-shell.js" + - "src/main/triggers/trigger-context.js" + - "src/main/triggers/trigger-watcher.js" +--- + # Glossary > The original audit and its numeric source references describe v0.0.94. diff --git a/docs/product/UI-PATTERNS.md b/docs/product/UI-PATTERNS.md index f210f924e..f2ded3a40 100644 --- a/docs/product/UI-PATTERNS.md +++ b/docs/product/UI-PATTERNS.md @@ -1,3 +1,34 @@ +--- +covers: + - "eslint.config.js" + - "public/activity-trace-panel.js" + - "public/agents-view.js" + - "public/app-dialogs.js" + - "public/app-notices.js" + - "public/app.js" + - "public/choice-dialog.js" + - "public/dialogs.js" + - "public/file-panel.js" + - "public/grid-view.js" + - "public/header-controls.js" + - "public/index.html" + - "public/jsonl-viewer.js" + - "public/modal-stack.js" + - "public/process-exit.js" + - "public/resume-guard.js" + - "public/schedules-view.js" + - "public/session-activity-dom.js" + - "public/session-state.js" + - "public/settings-panel.js" + - "public/sidebar.js" + - "public/style.css" + - "public/tool-bar.js" + - "public/touched-files-view.js" + - "public/viewer-panel.js" + - "public/viewer-toolbar.js" + - "public/whats-new.js" +--- + # UI patterns > The original audit and its numeric source references describe v0.0.94. diff --git a/docs/releasing.md b/docs/releasing.md index a2a26233c..e136b0014 100644 --- a/docs/releasing.md +++ b/docs/releasing.md @@ -1,3 +1,15 @@ +--- +covers: + - ".github/workflows/build.yml" + - ".github/workflows/release-provenance.yml" + - "package.json" + - "scripts/after-pack.js" + - "scripts/changelog-section.js" + - "scripts/check-release-provenance.js" + - "scripts/check-release-tag.js" + - "scripts/publish-release.sh" +--- + # Releasing A release is a version tag on a release branch, `release/X.Y`. A beta's bump diff --git a/docs/remote-hosts.md b/docs/remote-hosts.md index 192d89307..37114771f 100644 --- a/docs/remote-hosts.md +++ b/docs/remote-hosts.md @@ -1,3 +1,11 @@ +--- +covers: + - "public/remote-activity-ui.js" + - "public/remote-enrol-panel.js" + - "remote-activity.js" + - "src/main/remote/*.js" +--- + # Remote Hosts Switchboard can observe the Claude sessions of other machines you reach over diff --git a/docs/sandbox.md b/docs/sandbox.md index 5acf38ea6..ce5ac9748 100644 --- a/docs/sandbox.md +++ b/docs/sandbox.md @@ -1,3 +1,8 @@ +--- +covers: + - "scripts/claude-sandbox.sh" +--- + # Sandbox (Linux) With **Sandbox** on, Switchboard runs `claude` inside a diff --git a/docs/schedules.md b/docs/schedules.md index 612d6b4c2..587a1019a 100644 --- a/docs/schedules.md +++ b/docs/schedules.md @@ -1,3 +1,9 @@ +--- +covers: + - "public/schedules-view.js" + - "src/main/schedules/*.js" +--- + # Schedules tab The **Schedules** tab (clock icon, after Agent Files) is where you manage a diff --git a/docs/session-browser.md b/docs/session-browser.md index 9175954c3..7fddb70d0 100644 --- a/docs/session-browser.md +++ b/docs/session-browser.md @@ -1,3 +1,14 @@ +--- +covers: + - "project-remap.js" + - "public/archived-manager.js" + - "public/sidebar.js" + - "public/worktree-nesting.js" + - "search-worker-client.js" + - "src/main/projects/project-delete*.js" + - "workers/search-query.js" +--- + # Session Browser The left sidebar lists indexed Claude Code sessions from `~/.claude/projects` diff --git a/docs/session-restore.md b/docs/session-restore.md index 012c391d5..f9c749d6d 100644 --- a/docs/session-restore.md +++ b/docs/session-restore.md @@ -1,3 +1,10 @@ +--- +covers: + - "public/app.js" + - "public/restore-plan.js" + - "public/resume-guard.js" +--- + # Session Restore Switchboard can reopen, at launch, the sessions that were open when it last diff --git a/docs/settings.md b/docs/settings.md index b7ca08dd9..1fb077fbc 100644 --- a/docs/settings.md +++ b/docs/settings.md @@ -1,3 +1,9 @@ +--- +covers: + - "public/setting-defaults.js" + - "public/settings-panel.js" +--- + # Settings Reference Switchboard has **Global Settings** (the gear in the sidebar's tab row) and diff --git a/docs/subagents.md b/docs/subagents.md index 49d75fd74..2125fa87c 100644 --- a/docs/subagents.md +++ b/docs/subagents.md @@ -1,3 +1,15 @@ +--- +covers: + - "public/jsonl-viewer.js" + - "public/subagent-timing.js" + - "public/task-registry.js" + - "session-transitions.js" + - "subagent-attribution.js" + - "task-records-client.js" + - "task-records.js" + - "workers/task-records.js" +--- + # Subagents A subagent is a child Claude that a session starts with its `Agent` tool. It diff --git a/docs/terminal.md b/docs/terminal.md index 10a987bc0..64e4c22e2 100644 --- a/docs/terminal.md +++ b/docs/terminal.md @@ -1,3 +1,14 @@ +--- +covers: + - "public/process-exit.js" + - "public/terminal-context-menu.js" + - "public/terminal-manager.js" + - "public/terminal-path-links.js" + - "public/terminal-themes.js" + - "src/main/terminals/output-buffer.js" + - "src/main/terminals/terminal-resize.js" +--- + # Terminal Each session runs in an xterm.js terminal attached to the session's PTY. How a diff --git a/docs/testing-a-pr.md b/docs/testing-a-pr.md index 3ddbc3b1d..e3d16bfa7 100644 --- a/docs/testing-a-pr.md +++ b/docs/testing-a-pr.md @@ -1,3 +1,9 @@ +--- +covers: + - "scripts/launcher-env.js" + - "scripts/test-pr.js" +--- + # Testing a PR Live `task test-pr PR=` runs a pull request's code from source, in its own diff --git a/docs/touched-files.md b/docs/touched-files.md index 4a535693f..506018069 100644 --- a/docs/touched-files.md +++ b/docs/touched-files.md @@ -1,3 +1,11 @@ +--- +covers: + - "public/touched-files-view.js" + - "src/main/changes/remote-touched-files.js" + - "src/main/changes/session-touched-files.js" + - "src/main/changes/touched-transcript-cache.js" +--- + # Touched Files **Touched** lists the files a session's file tools touched: what it created or diff --git a/docs/window.md b/docs/window.md index 640182885..0ea6877ee 100644 --- a/docs/window.md +++ b/docs/window.md @@ -1,3 +1,13 @@ +--- +covers: + - "public/header-controls.js" + - "public/window-strip.js" + - "src/main/app/session-exit.js" + - "src/main/app/unsaved-guard.js" + - "src/main/app/window-frame.js" + - "src/main/app/window-theme.js" +--- + # Window ## The strip diff --git a/docs/worktrees.md b/docs/worktrees.md index b909262d4..c20b67913 100644 --- a/docs/worktrees.md +++ b/docs/worktrees.md @@ -1,3 +1,11 @@ +--- +covers: + - "derive-project-path.js" + - "project-root.js" + - "public/worktree-nesting.js" + - "worktree-delete.js" +--- + # Worktree Sessions A worktree session runs Claude in its own git worktree: a second working diff --git a/scripts/check-doc-refs.js b/scripts/check-doc-refs.js index 4ef25f9a9..5ce57ac49 100644 --- a/scripts/check-doc-refs.js +++ b/scripts/check-doc-refs.js @@ -85,7 +85,8 @@ function tableStarts(header, delimiter) { } function parseDoc(text) { - const lines = text.split(/\r?\n/); + const body = /^\uFEFF?---[ \t]*\r?\n/.test(text) ? text.replace(/^\uFEFF?---[ \t]*\r?\n[\s\S]*?^---[ \t]*(?:\r?\n|$)/m, front => front.replace(/[^\r\n]/g, '')) : text; + const lines = body.split(/\r?\n/); const blocks = []; const headings = []; const ids = []; diff --git a/scripts/check-docs.js b/scripts/check-docs.js index 6e8882be0..d3b9b0c69 100644 --- a/scripts/check-docs.js +++ b/scripts/check-docs.js @@ -1,33 +1,100 @@ #!/usr/bin/env node 'use strict'; +const fs = require('node:fs'); +const path = require('node:path'); +const yaml = require('js-yaml'); const { execFileSync } = require('node:child_process'); const { isAppPath, parseLabels } = require('./check-changelog'); -function checkDocs({ files, labels }) { - const app = files.filter(isAppPath); - const hasDocs = files.some((file) => file.startsWith('docs/') || file.startsWith('.ai/contexts/') || file === 'README.md'); - if (app.length === 0 || hasDocs || labels.includes('no-docs')) { - return { ok: true, message: 'docs check passed' }; +function isDocPath(file) { + return file.startsWith('docs/') || file.startsWith('.ai/contexts/') || file === 'README.md'; +} + +function coverPattern(glob) { + if (typeof glob !== 'string' || !glob || glob.trim() !== glob + || /[\\\s?:[\]{}!]/.test(glob) || glob.startsWith('/') + || glob.split('/').some(part => !part || part === '.' || part === '..') + || glob.split('/').some(part => part.includes('**') && part !== '**')) { + throw new Error('covers entries must be repo-relative paths using only * or ** globs'); + } + const parts = glob.split('/'); + const source = parts.map((part, i) => { + if (part === '**') return i === parts.length - 1 ? '.*' : '(?:[^/]+/)*'; + return part.replace(/[.+^$()|]/g, '\\$&').replace(/\*/g, '[^/]*') + (i < parts.length - 1 ? '/' : ''); + }).join(''); + return new RegExp('^' + source + '$'); +} + +function coverageMap(documents, trackedFiles) { + const coverage = new Map(); + const errors = []; + for (const [doc, text] of Object.entries(documents)) { + if (!isDocPath(doc) || !doc.endsWith('.md')) continue; + const required = /^\.ai\/contexts\/[^/]+\.md$/.test(doc); + const starts = /^\uFEFF?---[ \t]*\r?\n/.test(text); + if (!starts) { + if (required) errors.push(doc + ': missing covers front matter'); + continue; + } + try { + const front = text.match(/^\uFEFF?---[ \t]*\r?\n([\s\S]*?)^---[ \t]*(?:\r?\n|$)/m); + if (!front) throw new Error('unterminated front matter'); + const data = yaml.load(front[1], { schema: yaml.JSON_SCHEMA }); + if (!data || typeof data !== 'object' || Array.isArray(data) + || Object.keys(data).some(key => key !== 'covers') || !Array.isArray(data.covers)) { + throw new Error('front matter must contain only covers: an array of source paths/globs'); + } + const patterns = data.covers.map(glob => { + const pattern = coverPattern(glob); + if (!trackedFiles.some(file => pattern.test(file))) throw new Error('covers pattern matches no tracked file: ' + glob); + return pattern; + }); + coverage.set(doc, patterns); + } catch (err) { + errors.push(doc + ': ' + err.message); + } + } + return { coverage, errors }; +} + +function checkDocs({ files, labels, body = '', documents = {}, trackedFiles = files }) { + const { coverage, errors } = coverageMap(documents, trackedFiles); + const covering = file => [...coverage].filter(([, patterns]) => patterns.some(pattern => pattern.test(file))).map(([doc]) => doc); + const uncovered = [...new Set([...trackedFiles, ...files])].filter(isAppPath).filter(file => covering(file).length === 0); + const report = ['Uncovered app files (' + uncovered.length + '), advisory:', ...uncovered.map(file => ' ' + file)]; + const hasDocs = files.some(file => isDocPath(file) && trackedFiles.includes(file)); + const reason = body.split(/\r?\n/).some(line => { + const match = line.match(/^[ \t]*no docs:[ \t]*(\S.*)$/i); + return match && match[1].trim() !== ''; + }); + const waived = labels.includes('no-docs') && reason; + const missing = files.filter(isAppPath).filter(file => { + const docs = covering(file); + return docs.length ? !docs.some(doc => files.includes(doc)) : !hasDocs; + }); + if (errors.length) return { ok: false, uncovered, message: [...errors, ...report].join('\n') }; + if (!waived && missing.length) { + return { + ok: false, uncovered, + message: [ + 'This PR changes the app without documentation:', + ...missing.map(file => ' ' + file + (covering(file).length ? ' — update one of: ' + covering(file).join(', ') : ' — update any doc (uncovered)')), + 'Update a doc whose covers includes each changed app file.', + 'If none are needed, write "no docs: " in the body and add the "no-docs" label, then re-run this job.', + ...report, + ].join('\n'), + }; } - return { - ok: false, - message: [ - 'This PR changes the app without documentation:', - ...app.map((file) => ` ${file}`), - 'Update the affected docs/ (or README.md) and .ai/contexts/ files in this PR,', - 'and name them in the PR body. If none are needed, write "no docs: "', - 'in the body and add the "no-docs" label, then re-run this job.', - ].join('\n'), - }; + return { ok: true, uncovered, message: ['docs check passed', ...report].join('\n') }; } -const USAGE = 'usage: check-docs.js --base --head (--labels | --repo --pr )'; +const USAGE = 'usage: check-docs.js --base --head (--labels [--body ] | --repo --pr )'; function parseArgs(argv) { const opts = {}; for (let i = 0; i < argv.length; i += 2) { - if (!['--base', '--head', '--labels', '--repo', '--pr'].includes(argv[i]) || argv[i + 1] === undefined) throw new Error(USAGE); + if (!['--base', '--head', '--labels', '--body', '--repo', '--pr'].includes(argv[i]) || argv[i + 1] === undefined) throw new Error(USAGE); opts[argv[i].slice(2)] = argv[i + 1]; } if (!opts.base || !opts.head) throw new Error(USAGE); @@ -42,7 +109,14 @@ if (require.main === module) { : execFileSync('gh', ['api', `repos/${opts.repo}/issues/${opts.pr}/labels`, '--jq', '[.[].name]'], { encoding: 'utf8' }).trim()); const files = execFileSync('git', ['diff', '--name-only', '--no-renames', '-z', `${opts.base}...${opts.head}`], { encoding: 'utf8' }) .split('\0').filter(Boolean); - const result = checkDocs({ files, labels }); + const body = opts.body !== undefined ? opts.body : opts.repo && opts.pr + ? execFileSync('gh', ['api', `repos/${opts.repo}/pulls/${opts.pr}`, '--jq', '.body // ""'], { encoding: 'utf8' }) : ''; + const root = path.join(__dirname, '..'); + const trackedFiles = execFileSync('git', ['ls-files', '-z', '--cached'], { cwd: root, encoding: 'utf8' }) + .split('\0').filter(Boolean).filter(file => fs.existsSync(path.join(root, file))); + const documents = Object.fromEntries(trackedFiles.filter(file => isDocPath(file) && file.endsWith('.md')) + .map(file => [file, fs.readFileSync(path.join(root, file), 'utf8')])); + const result = checkDocs({ files, labels, body, documents, trackedFiles }); console.log(result.message); process.exitCode = result.ok ? 0 : 1; } catch (err) { diff --git a/test/check-doc-refs.test.js b/test/check-doc-refs.test.js index 993ebfe37..b9e4742b5 100644 --- a/test/check-doc-refs.test.js +++ b/test/check-doc-refs.test.js @@ -215,3 +215,12 @@ test('the real allow-list is well formed', () => { assert.ok(Array.isArray(allow)); for (const entry of allow) assert.deepEqual(Object.keys(entry).sort(), ['doc', 'reason', 'ref']); }); + +test('GIVEN YAML front matter WHEN references and anchors are checked THEN metadata is skipped and body lines stay exact', (t) => { + const doc = '---\nmetadata: "[gone](missing.md) \x60public/gone.js\x60 settings.gone"\n# Metadata heading\n---\n# Body\n[bad](#metadata-heading) [ok](#body)\n\x60public/absent.js\x60\n'; + const root = repo(t, { 'docs/guide.md': doc }); + const result = checkDocRefs({ root, allow: [] }); + assert.deepEqual(result.failures.map(f => [f.category, f.line, f.ref]), [ + ['anchor', 6, '#metadata-heading'], ['path', 7, 'public/absent.js'], + ]); +}); diff --git a/test/check-docs.test.js b/test/check-docs.test.js index 5a02a1411..e53ff81b7 100644 --- a/test/check-docs.test.js +++ b/test/check-docs.test.js @@ -31,7 +31,7 @@ test('test-only, CI-only, tooling-only and docs-only PRs pass', () => { } }); -test('any accepted documentation path satisfies the mechanical gate', () => { +test('any accepted documentation path satisfies the fallback for uncovered app files', () => { for (const file of ['docs/guide.md', 'docs/nested/guide.md', '.ai/contexts/cli.md', 'README.md']) { assert.equal(checkDocs({ files: ['main.js', file], labels: [] }).ok, true, file); } @@ -45,13 +45,13 @@ test('changelog, guidelines and similarly named paths do not substitute for docu }); test('only the exact no-docs label waives runtime documentation', () => { - assert.equal(checkDocs({ files: ['main.js'], labels: ['bug', 'no-docs'] }).ok, true); + assert.equal(checkDocs({ files: ['main.js'], labels: ['bug', 'no-docs'], body: 'no docs: internal refactor' }).ok, true); for (const label of ['no-changelog', 'no-docs-please', 'No-Docs']) { assert.equal(checkDocs({ files: ['main.js'], labels: [label] }).ok, false, label); } }); -function runCli(args, { files = ['main.js'], labels = '[]', failCommand } = {}) { +function runCli(args, { files = ['main.js'], labels = '[]', body = '', documents = {}, trackedFiles = files, failCommand } = {}) { const calls = []; const output = []; const module = { exports: {} }; @@ -61,13 +61,18 @@ function runCli(args, { files = ['main.js'], labels = '[]', failCommand } = {}) calls.push({ command, argv: Array.from(argv), options: { ...options } }); if (command === failCommand) throw new Error(`${command} unavailable`); assert.ok(['git', 'gh'].includes(command), command); - return command === 'git' ? files.join('\0') + '\0' : labels; + if (command === 'git') return (argv[0] === 'ls-files' ? trackedFiles : files).join('\0') + '\0'; + return argv.includes('.body // ""') ? body : labels; }, - } : localRequire(name); + } : name === 'node:fs' ? { readFileSync: (file) => { + const relative = path.relative(path.join(__dirname, '..'), file).split(path.sep).join('/'); + assert.ok(Object.hasOwn(documents, relative), relative); + return documents[relative]; + }, existsSync: () => true } : localRequire(name); require.main = module; const process = { argv: ['node', SCRIPT, ...args] }; vm.runInNewContext(SOURCE, { - require, module, process, + require, module, process, __dirname: path.dirname(SCRIPT), console: { log: (s) => output.push(s), error: (s) => output.push(s) }, }, { filename: SCRIPT }); return { code: process.exitCode, calls, output: output.join('\n') }; @@ -78,15 +83,15 @@ const REFS = ['--base', 'base-sha', '--head', 'head-sha']; test('CLI reads the whole PR diff with renames exposed and uses exit codes 0 and 1', () => { const result = runCli([...REFS, '--labels', '[]']); assert.equal(result.code, 1, result.output); - assert.deepEqual(result.calls, [{ command: 'git', + assert.deepEqual(result.calls.filter(call => call.argv[0] === 'diff'), [{ command: 'git', argv: ['diff', '--name-only', '--no-renames', '-z', 'base-sha...head-sha'], options: { encoding: 'utf8' } }]); - assert.equal(runCli([...REFS, '--labels', '[]'], { files: ['main.js', 'docs/guide.md'] }).code, 0); - assert.equal(runCli([...REFS, '--labels', '["no-docs"]']).code, 0); + assert.equal(runCli([...REFS, '--labels', '[]'], { files: ['main.js', 'docs/guide.md'], documents: { 'docs/guide.md': '# Guide' } }).code, 0); + assert.equal(runCli([...REFS, '--labels', '["no-docs"]', '--body', 'no docs: refactor']).code, 0); }); test('CLI reads current labels from the PR at run time', () => { - const result = runCli([...REFS, '--repo', 'owner/repo', '--pr', '7'], { labels: '["no-docs"]' }); + const result = runCli([...REFS, '--repo', 'owner/repo', '--pr', '7'], { labels: '["no-docs"]', body: 'no docs: refactor' }); assert.equal(result.code, 0, result.output); assert.deepEqual(result.calls[0], { command: 'gh', argv: ['api', 'repos/owner/repo/issues/7/labels', '--jq', '[.[].name]'], @@ -117,15 +122,110 @@ test('CLI fails closed with exit 2 on invalid arguments, labels or command failu test('workflow runs the docs gate on PRs with full history, live labels and PR SHAs', () => { const workflow = fs.readFileSync(path.join(__dirname, '..', '.github/workflows/test.yml'), 'utf8'); - const job = workflow.match(/\n docs:\r?\n([\s\S]*?)(?=\n \w+:|$)/); + const job = workflow.match(/\n docs:\r?\n([\s\S]*?)(?=\n [\w-]+:|$)/); assert.ok(job, 'test.yml must carry a docs job'); assert.match(job[1], /if: github\.event_name == 'pull_request'/); assert.match(job[1], /fetch-depth: 0/); assert.match(job[1], /persist-credentials: false/); assert.match(job[1], /GH_TOKEN: \$\{\{ github\.token \}\}/); - assert.equal(job[1].match(/run: (.*)/)[1], 'node scripts/check-docs.js' + assert.match(job[1], /run: npm ci --ignore-scripts/); + assert.equal(job[1].match(/run: (node scripts\/check-docs\.js.*)/)[1], 'node scripts/check-docs.js' + ' --base "${{ github.event.pull_request.base.sha }}"' + ' --head "${{ github.event.pull_request.head.sha }}"' + ' --repo "${{ github.repository }}"' + ' --pr "${{ github.event.pull_request.number }}"'); }); + +const COVERAGE = { + 'docs/terminal.md': '---\ncovers: ["public/terminal*.js"]\n---\n# Terminal', + '.ai/contexts/index.md': '---\ncovers:\n - "src/main/index/**/*.js"\n---\n# Index', + 'docs/alternative.md': '---\ncovers: ["public/terminal.js"]\n---\n# Alternate', + 'docs/unrelated.md': '# Unrelated', +}; +const TRACKED = [...Object.keys(COVERAGE), 'public/terminal.js', 'public/terminal-links.js', + 'public/terminal/nested.js', 'src/main/index/query.js', 'src/main/index/deep/query.js', 'main.js']; +const covered = (files, extra = {}) => checkDocs({ files, labels: [], documents: COVERAGE, trackedFiles: TRACKED, ...extra }); + +test('GIVEN a covered app file WHEN only unrelated docs change THEN the PR fails', () => { + const result = covered(['public/terminal.js', 'docs/unrelated.md']); + assert.equal(result.ok, false); + assert.match(result.message, /public\/terminal.js/); + assert.match(result.message, /docs\/terminal.md/); +}); + +test('GIVEN two covered areas WHEN only one doc changes THEN the other area fails', () => { + assert.equal(covered(['public/terminal.js', 'src/main/index/deep/query.js', 'docs/terminal.md']).ok, false); +}); + +test('GIVEN matching docs WHEN each changed area has one THEN the PR passes', () => { + assert.equal(covered(['public/terminal-links.js', 'src/main/index/query.js', 'src/main/index/deep/query.js', + 'docs/terminal.md', '.ai/contexts/index.md']).ok, true); + assert.equal(covered(['public/terminal.js', 'docs/alternative.md']).ok, true); +}); + +test('GIVEN uncovered files WHEN any doc changes THEN fallback passes and reports all uncovered app paths', () => { + const result = covered(['main.js', 'docs/unrelated.md']); + assert.equal(result.ok, true); + assert.deepEqual(result.uncovered, ['public/terminal/nested.js', 'main.js']); + assert.match(result.message, /Uncovered app files \(2\)/); + assert.match(result.message, /public\/terminal\/nested.js/); +}); + +test('GIVEN a single-star pattern WHEN a nested path changes THEN it remains uncovered', () => { + const result = covered(['public/terminal/nested.js', 'docs/unrelated.md']); + assert.ok(result.uncovered?.includes('public/terminal/nested.js')); +}); + +test('GIVEN no-docs WHEN the body lacks a nonempty reason on that line THEN it cannot waive coverage', () => { + for (const body of ['', 'no docs:', 'no docs: \n## Tests', 'some no docs: text', 'no docs: ']) { + assert.equal(covered(['public/terminal.js'], { labels: ['no-docs'], body }).ok, false, JSON.stringify(body)); + } + assert.equal(covered(['public/terminal.js'], { labels: ['no-docs'], body: '## Docs\nno docs: internal refactor' }).ok, true); + assert.equal(covered(['public/terminal.js'], { body: 'no docs: internal refactor' }).ok, false); +}); + +test('GIVEN invalid covers metadata WHEN checking even a docs-only PR THEN it fails closed', () => { + for (const metadata of ['covers: ["public/missing*.js"]', 'cover: ["main.js"]', + 'covers: main.js', 'covers: [7]', 'covers: null', 'covers: ["../main.js"]', + 'covers: ["/main.js"]', 'covers: ["public/../main.js"]', + 'covers: ["public/?.js"]', 'covers: ["main.js"]\nother: true', + 'covers: ["main.js"]\ncovers: ["main.js"]', 'covers: [']) { + const result = checkDocs({ files: ['docs/a.md'], labels: [], trackedFiles: ['main.js'], + documents: { 'docs/a.md': '---\n' + metadata + '\n---\n# Doc' } }); + assert.equal(result.ok, false, metadata); + assert.match(result.message, /docs\/a.md/); + } +}); + +test('GIVEN missing or unterminated context front matter WHEN checked THEN it fails', () => { + for (const text of ['# Context', '---\ncovers: ["main.js"]', '---\n{}\n---\n# Context']) { + assert.equal(checkDocs({ files: [], labels: [], trackedFiles: ['main.js'], + documents: { '.ai/contexts/a.md': text } }).ok, false, text); + } +}); + +test('GIVEN an inventory-only context WHEN covers is empty THEN it is valid but covers nothing', () => { + const result = checkDocs({ files: ['main.js', '.ai/contexts/README.md'], labels: [], trackedFiles: ['main.js', '.ai/contexts/README.md'], + documents: { '.ai/contexts/README.md': '---\ncovers: []\n---\n# Index' } }); + assert.equal(result.ok, true); + assert.deepEqual(result.uncovered, ['main.js']); +}); + +test('GIVEN literal regex punctuation WHEN coverage is matched THEN dots are literal', () => { + const result = checkDocs({ files: ['mainXjs', 'docs/a.md'], labels: [], trackedFiles: ['main.js', 'public/aXjs'], + documents: { 'docs/a.md': '---\ncovers: ["main.js"]\n---\n# Doc' } }); + assert.deepEqual(result.uncovered, ['public/aXjs']); +}); + +test('GIVEN CLI input WHEN tracked docs cover the changed file THEN unrelated or deleted docs cannot waive it', () => { + const options = { documents: COVERAGE, trackedFiles: TRACKED }; + assert.equal(runCli([...REFS, '--labels', '[]'], { ...options, files: ['public/terminal.js', 'docs/unrelated.md'] }).code, 1); + assert.equal(runCli([...REFS, '--labels', '[]'], { ...options, files: ['public/terminal.js', 'docs/terminal.md'] }).code, 0); + const remaining = { 'docs/alternative.md': COVERAGE['docs/alternative.md'] }; + assert.equal(runCli([...REFS, '--labels', '[]'], { documents: remaining, trackedFiles: ['public/terminal.js', ...Object.keys(remaining)], + files: ['public/terminal.js', 'docs/terminal.md'] }).code, 1); +}); + +test('GIVEN live no-docs label WHEN the live PR body has no reason THEN CLI rejects the waiver', () => { + assert.equal(runCli([...REFS, '--repo', 'o/r', '--pr', '7'], { labels: '["no-docs"]' }).code, 1); +}); From 24138492353bbd8147470537f2d4c67ab505367a Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Sun, 29 Nov 2026 02:48:50 +0100 Subject: [PATCH 2/6] (docs): cap covers at four docs per file and require a body change --- .ai/contexts/README.md | 4 - .ai/contexts/_issues.md | 13 --- .ai/contexts/activitywatch.md | 3 - .ai/contexts/app-dialogs.md | 7 -- .ai/contexts/bg-agents.md | 26 +---- .ai/contexts/build-release.md | 6 -- .ai/contexts/changes-view.md | 15 --- .ai/contexts/cli-harnesses.md | 16 +-- .ai/contexts/cli-session-state.md | 12 +-- .ai/contexts/fast-check.md | 32 +++++- .ai/contexts/ipc-bridge.md | 65 +---------- .ai/contexts/managed-browser.md | 3 - .ai/contexts/panel-terminal.md | 10 +- .ai/contexts/plain-terminal.md | 2 - .ai/contexts/project-delete.md | 19 +--- .ai/contexts/project-operation-gate.md | 2 - .ai/contexts/schedule-runner.md | 13 --- .ai/contexts/session-cache.md | 37 +------ .ai/contexts/session-index-writer.md | 9 +- .ai/contexts/session-state.md | 16 --- .ai/contexts/subagent-observability.md | 19 ---- .ai/contexts/terminal-path-links.md | 5 - .ai/contexts/terminal-right-click.md | 4 - .ai/contexts/theme.md | 1 - .ai/contexts/touched-files.md | 7 -- .ai/contexts/trigger-watcher.md | 23 ---- .ai/contexts/updater-relaunch.md | 1 - .ai/contexts/viewer-panel.md | 11 -- .ai/contexts/window-frame.md | 11 -- .github/pull_request_template.md | 7 +- README.md | 7 -- Taskfile.yaml | 3 +- docs/changelog.md | 39 ++++--- docs/changes-view.md | 1 - docs/decisions/0001-no-full-go-rewrite.md | 5 - .../0002-discrete-steps-sidebar-animations.md | 5 - .../0003-trigger-delivery-per-tab.md | 14 --- .../0004-session-index-single-writer.md | 20 ---- docs/decisions/0004-session-index-study.md | 34 ------ .../0005-main-process-context-layout.md | 5 - docs/decisions/0006-search-refs.md | 8 -- docs/evidence/session-capabilities/README.md | 5 - docs/grid-overview.md | 1 - docs/ide-emulation.md | 1 - docs/launching-sessions.md | 1 - docs/product/BUILDING-BLOCKS.md | 25 ----- docs/product/CONCEPT-MAP.md | 27 ----- docs/product/GLOSSARY.md | 41 ------- docs/product/UI-PATTERNS.md | 31 ------ scripts/check-docs.js | 57 +++++++--- test/check-docs.test.js | 102 +++++++++++++++++- 51 files changed, 216 insertions(+), 615 deletions(-) diff --git a/.ai/contexts/README.md b/.ai/contexts/README.md index a9061da52..e02e5b719 100644 --- a/.ai/contexts/README.md +++ b/.ai/contexts/README.md @@ -1,7 +1,3 @@ ---- -covers: [] ---- - # Context engineering — Switchboard Thirty sub-system docs, written for AI agents who need to make a focused diff --git a/.ai/contexts/_issues.md b/.ai/contexts/_issues.md index 84804a29d..bc3bdd789 100644 --- a/.ai/contexts/_issues.md +++ b/.ai/contexts/_issues.md @@ -1,16 +1,3 @@ ---- -covers: - - "main.js" - - "preload.js" - - "public/jsonl-viewer.js" - - "public/sidebar.js" - - "public/viewer-panel.js" - - "session-cache.js" - - "session-index-store.js" - - "src/main/integrations/mcp/mcp-bridge.js" - - "src/main/schedules/schedule-runner.js" ---- - # Observations from writing the context docs Captured 2026-05-30 while writing the .ai/contexts/*.md files; pruned 2026-11-24 against main 4d468532 (resolved items removed). None are blockers; they're follow-ups worth picking up when adjacent work happens. diff --git a/.ai/contexts/activitywatch.md b/.ai/contexts/activitywatch.md index df685212e..c16af52b2 100644 --- a/.ai/contexts/activitywatch.md +++ b/.ai/contexts/activitywatch.md @@ -1,9 +1,6 @@ --- covers: - - "main.js" - "public/activity-reporting-panel.js" - - "public/app.js" - - "session-transitions.js" - "src/main/integrations/activitywatch/activitywatch-client.js" - "src/main/integrations/activitywatch/activitywatch-reporter.js" --- diff --git a/.ai/contexts/app-dialogs.md b/.ai/contexts/app-dialogs.md index 50bb6ef24..e14c62e0a 100644 --- a/.ai/contexts/app-dialogs.md +++ b/.ai/contexts/app-dialogs.md @@ -1,17 +1,10 @@ --- covers: - - "public/activity-trace-panel.js" - "public/app-dialogs.js" - "public/app-notices.js" - - "public/app.js" - "public/dialogs.js" - - "public/file-panel.js" - "public/modal-stack.js" - - "public/setting-defaults.js" - - "public/settings-panel.js" - - "public/viewer-panel.js" - "src/main/app/ui-notice-log.js" - - "src/main/shared/redact-log-text.js" --- # Renderer modal stack and questions diff --git a/.ai/contexts/bg-agents.md b/.ai/contexts/bg-agents.md index f48571f3a..f3b3f39a1 100644 --- a/.ai/contexts/bg-agents.md +++ b/.ai/contexts/bg-agents.md @@ -1,41 +1,17 @@ --- covers: - "bridge-session-id.js" - - "claude-binary.js" - - "cli-session-state.js" - - "delete-session-guard.js" - - "derive-project-path.js" - - "main.js" - - "preload.js" - "project-root.js" - "public/agents-view.js" - - "public/app-notices.js" - "public/app.js" - - "public/dialogs.js" - - "public/index.html" - - "public/resume-guard.js" - - "public/session-activity-dom.js" - - "public/shortcuts.js" - - "public/sidebar.js" - - "public/stop-session-ui.js" - - "public/style.css" - - "session-continuations.js" - - "session-transitions.js" - "sidebar-bg-sessions.js" - - "src/main/app/session-exit.js" - "src/main/bg-agents/bg-agents-ipc.js" - "src/main/bg-agents/bg-agents-roster.js" - "src/main/bg-agents/bg-agents.js" - "src/main/bg-agents/bg-handoff.js" - "src/main/bg-agents/bg-worker-liveness.js" - - "src/main/projects/project-delete-main.js" - - "src/main/projects/project-delete-stop.js" - - "src/main/terminals/pty-ops.js" - - "src/main/terminals/shell-profiles.js" + - "src/main/app/session-exit.js" - "src/main/terminals/tab-input-lock.js" - - "src/main/terminals/terminal-input.js" - - "task-records.js" - - "workers/task-records.js" --- # Context: bg-agents diff --git a/.ai/contexts/build-release.md b/.ai/contexts/build-release.md index 81cd8dd1c..25a86cf86 100644 --- a/.ai/contexts/build-release.md +++ b/.ai/contexts/build-release.md @@ -4,18 +4,12 @@ covers: - ".github/workflows/pr-title.yml" - ".github/workflows/release-provenance.yml" - ".github/workflows/test.yml" - - "package-lock.json" - "package.json" - - "scripts/after-pack.js" - - "scripts/check-changelog.js" - - "scripts/check-docs.js" - "scripts/check-release-provenance.js" - "scripts/check-release-tag.js" - "scripts/lint-pr-title.js" - "scripts/platform-tests.js" - - "scripts/postinstall.js" - "scripts/publish-release.sh" - - "src/main/app/changelog.js" --- # Build and release workflow diff --git a/.ai/contexts/changes-view.md b/.ai/contexts/changes-view.md index ec2260a95..1be3979ed 100644 --- a/.ai/contexts/changes-view.md +++ b/.ai/contexts/changes-view.md @@ -1,27 +1,12 @@ --- covers: - - "delete-session-target.js" - - "derive-project-path.js" - - "main.js" - - "public/app.js" - "public/file-panel.js" - - "public/index.html" - - "public/session-activity-dom.js" - - "public/session-activity.js" - - "public/splitter.js" - - "public/style.css" - - "read-session-file.js" - "src/main/changes/git-changes-file.js" - "src/main/changes/git-changes-runner.js" - "src/main/changes/git-changes-target.js" - "src/main/changes/git-changes-watch.js" - "src/main/changes/git-changes.js" - "src/main/remote/remote-attach.js" - - "src/main/remote/remote-hosts.js" - - "src/main/remote/remote-index.js" - - "src/main/remote/remote-stop.js" - - "src/main/schedules/run-schedule-now-target.js" - - "src/main/shared/ipc-path-validator.js" - "src/main/shared/run-to-exit.js" --- diff --git a/.ai/contexts/cli-harnesses.md b/.ai/contexts/cli-harnesses.md index 0de4288b6..f088deab2 100644 --- a/.ai/contexts/cli-harnesses.md +++ b/.ai/contexts/cli-harnesses.md @@ -1,29 +1,15 @@ --- covers: - - "classify-title-activity.js" - - "delete-session-guard.js" - - "delete-session-target.js" + - "main.js" - "harnesses/claude.js" - "harnesses/codex.js" - "harnesses/contract.js" - "harnesses/index.js" - "jsonl-scan.js" - - "main.js" - - "preload.js" - - "public/app.js" - - "public/grid-view.js" - - "public/setting-defaults.js" - - "public/sidebar.js" - "read-session-file.js" - "scripts/launcher-env.js" - - "scripts/test-pr.js" - "session-cache.js" - - "session-index-commands.js" - - "session-index-store.js" - - "session-transitions.js" - - "src/main/terminals/plain-terminal-shell.js" - "src/main/usage/codex-usage.js" - - "workers/session-index-writer.js" --- # CLI harness port diff --git a/.ai/contexts/cli-session-state.md b/.ai/contexts/cli-session-state.md index 7b156c3c7..3029a0c8b 100644 --- a/.ai/contexts/cli-session-state.md +++ b/.ai/contexts/cli-session-state.md @@ -2,19 +2,11 @@ covers: - "bridge-session-id.js" - "cli-session-state.js" - - "main.js" - - "public/app-notices.js" - "public/resume-guard.js" - - "public/sidebar.js" - - "session-transitions.js" - - "src/main/bg-agents/bg-worker-liveness.js" - "src/main/cli/proc-start.js" - "src/main/cli/session-state-v1.js" - - "src/main/projects/project-delete-main.js" - - "src/main/terminals/windows-job-helper.ps1" + - "src/main/terminals/windows-job-helper.js" - "src/main/triggers/session-status.js" - - "src/main/triggers/trigger-context.js" - - "workers/task-records.js" --- # Context: cli-session-state @@ -230,7 +222,7 @@ including the `session-live-elsewhere` and `sessions-live-elsewhere` IPCs), Related code: `src/main/cli/session-state-v1.js` (V1 reader), `src/main/cli/proc-start.js`, `src/main/projects/project-delete-main.js` (deletion snapshot), `src/main/triggers/trigger-context.js` (trigger consumer; `src/main/triggers/session-status.js` -builds the 2 s status deadline), `src/main/terminals/windows-job-helper.ps1` (`observe`). +builds the 2 s status deadline), `src/main/terminals/windows-job-helper.js` (`observe`). Only Claude descriptors are read (`~/.claude/sessions`, `DEFAULT_DIR`); nothing in this module or `public/resume-guard.js` reads Codex state. diff --git a/.ai/contexts/fast-check.md b/.ai/contexts/fast-check.md index 1af82848e..1d13e7662 100644 --- a/.ai/contexts/fast-check.md +++ b/.ai/contexts/fast-check.md @@ -16,12 +16,13 @@ skips tests, retaining staged-JS lint in both routes. When any staged path ends in `.md`, it first spawns `scripts/check-doc-refs.js --root ` (the whole tree, about a second) and returns its status if nonzero; `SKIP_TESTS` does not skip it. Reference scanning skips initial YAML front matter, retaining body -line numbers. Coverage declarations are validated by the separate PR docs gate -(`scripts/check-docs.js`), which requires a changed matching doc for covered app -files and prints uncovered files. A rename in JavaScript that breaks a doc is caught by `task check` and +line numbers. Coverage declarations are validated by `scripts/check-docs.js --validate` in +`Taskfile.yaml` (`task check`), by the real-checkout regression in +`test/check-docs.test.js`, and by the PR docs gate. The PR gate requires a body +change in a matching owner doc, comparing against the merge base, and prints +uncovered files. Metadata-only edits do not count. A rename in JavaScript that breaks a doc is caught by `task check` and the `docs-refs` CI job, not here. Rules are in -[changelog.md](../../docs/changelog.md#doc-references). `task check` and the full -suite runner remain unchanged and are the required gate before a PR. +[changelog.md](../../docs/changelog.md#doc-references). `task check` and the full suite remain the required gate before a PR. The script reads `git diff --cached --name-only --diff-filter=ACMR -z`, so deleted paths are excluded and spaces survive. The exported pure `selectTests` @@ -51,3 +52,24 @@ required CI and `task check` cover unrelated regressions. real lint and test execution and leaving files and the index untouched. `test/check-fast.test.js` exercises mapping, orchestration, errors and wiring; external command spawning is replaced only at its process boundary. + +## Coverage ownership + +`covers` records substantive documentation, not path mentions or test inventories. +ADRs, product docs, `_issues.md` and all navigation READMEs are excluded. +Patterns require a literal prefix; leading wildcards are rejected. There is no +files-per-pattern cap: validation instead limits each tracked file to four +distinct owner documents, even when a no-docs waiver is present. + +The hub owner sets are deliberately narrow: + +| File | Owners and substantive sections | +|---|---| +| `main.js` | ipc-bridge (IPC contracts), cli-harnesses (launching), window-frame (construction and exit) | +| `preload.js` | ipc-bridge (public surface), window-frame (exit handshake and native dialogs) | +| `public/app.js` | bg-agents (background restore), session-cache (startup and project projections), session-state (restore and lifecycle), docs/session-restore (restore behavior) | +| `public/sidebar.js` | session-cache (search and grouping), session-state (row state and lifecycle), subagent-observability (child rows), docs/session-browser (browser behavior) | +| `session-cache.js` | session-cache (index and watcher), cli-harnesses (harness folder dispatch), subagent-observability (subagent projection) | + +The PR template and checker accept `- no docs: ` on its own line with +the exact `no-docs` label. Replace the placeholder with a nonempty reason. diff --git a/.ai/contexts/ipc-bridge.md b/.ai/contexts/ipc-bridge.md index 051278e99..17dfda97f 100644 --- a/.ai/contexts/ipc-bridge.md +++ b/.ai/contexts/ipc-bridge.md @@ -1,77 +1,18 @@ --- covers: - - "classify-title-activity.js" - - "claude-auth.js" - - "db.js" - - "delete-session-target.js" - - "eslint.config.js" - - "fts-match.js" - - "local-transcript-activity.js" + - "src/main/projects/last-known-projects.js" - "main.js" - "preload.js" - - "public/activity-trace-panel.js" - - "public/activity-trace.js" - - "public/app-dialogs.js" - - "public/app-notices.js" - - "public/app.js" - "public/archived-manager.js" - - "public/index.html" - - "public/local-transcript-adapter.js" - - "public/memory-workfiles-view.js" - - "public/session-activity-dom.js" - - "public/session-activity.js" - - "public/session-state.js" - - "public/setting-defaults.js" - - "public/settings-panel.js" - - "public/sidebar.js" - - "public/style.css" - - "public/terminal-manager.js" - - "public/terminal-replay-queries.js" - - "public/utils.js" - - "public/worktree-nesting.js" - - "scan-md-files.js" - - "scripts/postinstall.js" - - "scripts/test-pr.js" - - "session-cache.js" - - "session-transitions.js" + - "public/activity-trace.js" - "src/main/app/main-error-handlers.js" - - "src/main/app/power-log.js" - - "src/main/app/ui-notice-log.js" - - "src/main/app/unsaved-guard.js" - - "src/main/app/window-theme.js" - - "src/main/bg-agents/bg-agents-ipc.js" - - "src/main/bg-agents/bg-handoff.js" - - "src/main/changes/git-changes-file.js" - - "src/main/changes/git-changes-runner.js" - - "src/main/changes/git-changes-watch.js" - - "src/main/changes/git-changes.js" - - "src/main/integrations/mcp/mcp-bridge.js" - - "src/main/projects/last-known-projects.js" - - "src/main/projects/project-delete-ipc.js" - - "src/main/remote/remote-attach.js" - - "src/main/remote/remote-hosts.js" - - "src/main/remote/remote-stop.js" - - "src/main/schedules/run-schedule-now-target.js" - - "src/main/schedules/schedule-delete-file.js" - - "src/main/schedules/schedule-ipc.js" - - "src/main/schedules/schedule-list.js" - - "src/main/shared/activity-trace.js" - - "src/main/shared/clean-env.js" - "src/main/shared/diagnostic-files.js" + - "src/main/shared/activity-trace.js" - "src/main/shared/ipc-path-validator.js" - "src/main/shared/resolve-path-on-disk.js" - - "src/main/terminals/composer-state.js" - - "src/main/terminals/no-cli-restart.js" - - "src/main/terminals/output-buffer.js" - "src/main/terminals/pre-launch-cmd-guard.js" - "src/main/terminals/pty-ops.js" - - "src/main/terminals/stop-process-tree.js" - - "src/main/terminals/terminal-input.js" - - "src/main/terminals/terminal-path-target.js" - "src/main/triggers/trigger-renderer-bridge.js" - - "src/main/triggers/trigger-watcher.js" - - "src/main/usage/codex-usage.js" - - "worktree-delete.js" --- # Context: ipc-bridge diff --git a/.ai/contexts/managed-browser.md b/.ai/contexts/managed-browser.md index 6f3737630..467370109 100644 --- a/.ai/contexts/managed-browser.md +++ b/.ai/contexts/managed-browser.md @@ -1,8 +1,5 @@ --- covers: - - "harnesses/claude.js" - - "public/setting-defaults.js" - - "scripts/test-pr.js" - "src/main/browser/discovery.js" - "src/main/browser/linux-process.js" - "src/main/browser/managed-browser.js" diff --git a/.ai/contexts/panel-terminal.md b/.ai/contexts/panel-terminal.md index 0df272585..059619bf1 100644 --- a/.ai/contexts/panel-terminal.md +++ b/.ai/contexts/panel-terminal.md @@ -1,18 +1,10 @@ --- covers: - - "cli-session-state.js" - - "main.js" - - "public/app.js" - - "public/file-panel.js" - - "public/grid-view.js" - "public/panel-terminal.js" + - "public/file-panel.js" - "public/splitter.js" - "public/terminal-manager.js" - - "session-cache.js" - - "session-transitions.js" - - "src/main/changes/git-changes-target.js" - "src/main/terminals/panel-terminal-target.js" - - "src/main/terminals/terminal-path-target.js" --- # Context: panel-terminal diff --git a/.ai/contexts/plain-terminal.md b/.ai/contexts/plain-terminal.md index 627317d43..9f093ecb2 100644 --- a/.ai/contexts/plain-terminal.md +++ b/.ai/contexts/plain-terminal.md @@ -1,7 +1,5 @@ --- covers: - - "main.js" - - "src/main/shared/clean-env.js" - "src/main/terminals/plain-terminal-shell.js" - "src/main/terminals/shell-profiles.js" --- diff --git a/.ai/contexts/project-delete.md b/.ai/contexts/project-delete.md index 2d41334fd..3efb38617 100644 --- a/.ai/contexts/project-delete.md +++ b/.ai/contexts/project-delete.md @@ -1,26 +1,9 @@ --- covers: - "derive-project-path.js" - - "main.js" - "public/archived-manager.js" - - "public/memory-workfiles-view.js" - - "public/setting-defaults.js" - - "public/settings-panel.js" - - "public/sidebar.js" - - "session-index-writer.js" - "src/main/projects/project-archive-workflow.js" - - "src/main/projects/project-delete-identity.js" - - "src/main/projects/project-delete-ipc.js" - - "src/main/projects/project-delete-main.js" - - "src/main/projects/project-delete-owner.js" - - "src/main/projects/project-delete-plan.js" - - "src/main/projects/project-delete-progress.js" - - "src/main/projects/project-delete-stop.js" - - "src/main/projects/project-delete-timer.js" - - "src/main/projects/project-delete-worktrees.js" - - "src/main/projects/project-delete-writer.js" - - "src/main/projects/project-delete.js" - - "workers/session-index-writer.js" + - "src/main/projects/project-delete*.js" --- # Project deletion (#474 A4a–A4d, E) diff --git a/.ai/contexts/project-operation-gate.md b/.ai/contexts/project-operation-gate.md index e60e794f3..6de7e7557 100644 --- a/.ai/contexts/project-operation-gate.md +++ b/.ai/contexts/project-operation-gate.md @@ -1,7 +1,5 @@ --- covers: - - "main.js" - - "src/main/projects/project-delete.js" - "src/main/shared/project-operation-gate.js" --- diff --git a/.ai/contexts/schedule-runner.md b/.ai/contexts/schedule-runner.md index c0dbdf066..0f398e674 100644 --- a/.ai/contexts/schedule-runner.md +++ b/.ai/contexts/schedule-runner.md @@ -1,17 +1,6 @@ --- covers: - - "archived-projects.js" - - "claude-binary.js" - - "file-lists.js" - - "main.js" - - "public/dialogs.js" - - "public/index.html" - - "public/memory-workfiles-view.js" - - "public/resume-guard.js" - "public/schedules-view.js" - - "public/sidebar.js" - - "scan-md-files.js" - - "session-index-writer.js" - "src/main/schedules/run-schedule-now-target.js" - "src/main/schedules/schedule-background.js" - "src/main/schedules/schedule-delete-file.js" @@ -21,8 +10,6 @@ covers: - "src/main/schedules/schedule-run-results.js" - "src/main/schedules/schedule-runner.js" - "src/main/schedules/schedules-tab-migration.js" - - "src/main/shared/normalize-project-path.js" - - "workers/session-index-writer.js" --- # Context: schedule-runner diff --git a/.ai/contexts/session-cache.md b/.ai/contexts/session-cache.md index f0d918b80..3fc63731d 100644 --- a/.ai/contexts/session-cache.md +++ b/.ai/contexts/session-cache.md @@ -5,47 +5,20 @@ covers: - "db.js" - "derive-project-path.js" - "encode-project-path.js" - - "file-lists.js" - "folder-index-state.js" - "fts-match.js" - - "harnesses/claude.js" - - "harnesses/codex.js" - - "harnesses/contract.js" - - "harnesses/index.js" - "jsonl-scan.js" - - "local-transcript-activity.js" - - "main.js" - - "preload.js" - "project-remap.js" - "projects-worker-client.js" - "public/app.js" - - "public/bridge-url.js" - - "public/choice-dialog.js" - - "public/dialogs.js" - - "public/remote-activity-ui.js" - - "public/remote-enrol-panel.js" - - "public/restore-plan.js" - - "public/session-activity-dom.js" - - "public/session-activity.js" - - "public/settings-panel.js" - "public/sidebar.js" - - "public/stats-view.js" - - "public/task-registry.js" - - "public/utils.js" - "public/worktree-nesting.js" + - "public/remote-enrol-panel.js" - "read-session-file.js" - - "remote-activity.js" - "search-worker-client.js" - "session-cache.js" - - "session-continuations.js" - - "session-index-commands.js" - "session-index-store.js" - - "session-index-writer-client.js" - - "session-index-writer.js" - "session-name.js" - - "src/main/changes/remote-touched-files.js" - - "src/main/projects/last-known-projects.js" - - "src/main/projects/project-delete-writer.js" - "src/main/remote/remote-attach.js" - "src/main/remote/remote-enrol.js" - "src/main/remote/remote-host-profile.js" @@ -55,25 +28,17 @@ covers: - "src/main/remote/remote-mirror.js" - "src/main/remote/remote-send.js" - "src/main/remote/remote-ssh-binary.js" - - "src/main/remote/remote-stop.js" - "src/main/remote/remote-transport.js" - "src/main/remote/remote-watch.js" - "src/main/session-index/full-read-state.js" - "src/main/session-index/message-count.js" - - "src/main/session-index/read-counters.js" - "src/main/session-index/session-refs.js" - "src/main/shared/atomic-write.js" - - "src/main/shared/ipc-path-validator.js" - "src/main/shared/long-path.js" - - "src/main/terminals/panel-terminal-target.js" - - "src/main/terminals/pty-ops.js" - - "src/main/triggers/trigger-actions.js" - - "subagent-attribution.js" - "workers/projects-query.js" - "workers/scan-projects.js" - "workers/scan-session-titles.js" - "workers/search-query.js" - - "workers/session-index-writer.js" --- # Context: session-cache diff --git a/.ai/contexts/session-index-writer.md b/.ai/contexts/session-index-writer.md index d3232c60c..2d7576534 100644 --- a/.ai/contexts/session-index-writer.md +++ b/.ai/contexts/session-index-writer.md @@ -3,19 +3,12 @@ covers: - "cache-effects.js" - "db.js" - "folder-index-state.js" - - "public/worktree-nesting.js" - "session-index-commands.js" - "session-index-store.js" - "session-index-writer-client.js" - "session-index-writer.js" - - "src/main/projects/project-delete-main.js" - - "src/main/projects/project-delete-progress.js" - - "src/main/projects/project-delete-writer.js" - - "src/main/triggers/trigger-watcher.js" - - "workers/file-lists-query.js" - - "workers/projects-query.js" - - "workers/search-query.js" - "workers/session-index-writer.js" + - "src/main/projects/project-delete-writer.js" --- # Session index writer — ADR 0004 slice 1b, step 1 diff --git a/.ai/contexts/session-state.md b/.ai/contexts/session-state.md index aaed81485..913935292 100644 --- a/.ai/contexts/session-state.md +++ b/.ai/contexts/session-state.md @@ -1,15 +1,9 @@ --- covers: - "cli-session-state.js" - - "eslint.config.js" - "local-transcript-activity.js" - - "main.js" - - "public/agents-view.js" - - "public/app-notices.js" - "public/app.js" - "public/cli-liveness.js" - - "public/dialogs.js" - - "public/file-panel.js" - "public/jsonl-viewer.js" - "public/local-transcript-adapter.js" - "public/process-exit.js" @@ -21,22 +15,12 @@ covers: - "public/sidebar.js" - "public/stop-session-ui.js" - "public/style.css" - - "public/utils.js" - "remote-activity.js" - "session-continuations.js" - "session-transitions.js" - - "src/main/integrations/mcp/mcp-bridge.js" - - "src/main/remote/remote-attach.js" - - "src/main/remote/remote-index.js" - "src/main/remote/remote-stop.js" - - "src/main/remote/remote-transport.js" - "src/main/terminals/no-cli-restart.js" - - "src/main/terminals/pty-ops.js" - - "src/main/triggers/session-status.js" - "src/main/viewer/transcript-follower.js" - - "transcript-tail.js" - - "transcript-turn.js" - - "workers/task-records.js" --- # Session state — one domain module, one icon slot diff --git a/.ai/contexts/subagent-observability.md b/.ai/contexts/subagent-observability.md index 50436e978..c0ae56681 100644 --- a/.ai/contexts/subagent-observability.md +++ b/.ai/contexts/subagent-observability.md @@ -1,34 +1,15 @@ --- covers: - - "db.js" - - "eslint.config.js" - - "local-transcript-activity.js" - - "main.js" - - "preload.js" - - "public/app.js" - "public/grid-view.js" - - "public/index.html" - "public/jsonl-viewer.js" - - "public/local-transcript-adapter.js" - - "public/remote-activity-ui.js" - - "public/session-activity-dom.js" - - "public/shortcuts.js" - "public/sidebar.js" - "public/subagent-timing.js" - "public/task-registry.js" - - "public/terminal-manager.js" - - "read-session-file.js" - - "remote-activity.js" - "session-cache.js" - - "session-index-store.js" - - "session-index-writer.js" - - "session-transitions.js" - - "src/main/bg-agents/bg-agents-roster.js" - "subagent-attribution.js" - "task-records-client.js" - "task-records.js" - "task-transcript-reader.js" - - "workers/session-index-writer.js" - "workers/task-records.js" --- diff --git a/.ai/contexts/terminal-path-links.md b/.ai/contexts/terminal-path-links.md index b5f9acde5..0472e8298 100644 --- a/.ai/contexts/terminal-path-links.md +++ b/.ai/contexts/terminal-path-links.md @@ -1,11 +1,6 @@ --- covers: - - "main.js" - - "public/codemirror-setup.js" - - "public/file-panel.js" - - "public/terminal-manager.js" - "public/terminal-path-links.js" - - "public/touched-files-view.js" - "src/main/terminals/terminal-path-target.js" --- diff --git a/.ai/contexts/terminal-right-click.md b/.ai/contexts/terminal-right-click.md index 0fb94009b..3c5cd51c9 100644 --- a/.ai/contexts/terminal-right-click.md +++ b/.ai/contexts/terminal-right-click.md @@ -1,9 +1,5 @@ --- covers: - - "public/app.js" - - "public/dialogs.js" - - "public/setting-defaults.js" - - "public/settings-panel.js" - "public/terminal-context-menu.js" - "public/terminal-manager.js" --- diff --git a/.ai/contexts/theme.md b/.ai/contexts/theme.md index fb32ca9dc..161b462e1 100644 --- a/.ai/contexts/theme.md +++ b/.ai/contexts/theme.md @@ -1,6 +1,5 @@ --- covers: - - "main.js" - "public/setting-defaults.js" - "public/style.css" - "public/terminal-themes.js" diff --git a/.ai/contexts/touched-files.md b/.ai/contexts/touched-files.md index ff14cd947..8aa758a86 100644 --- a/.ai/contexts/touched-files.md +++ b/.ai/contexts/touched-files.md @@ -1,17 +1,10 @@ --- covers: - - "encode-project-path.js" - "public/file-panel.js" - - "public/header-controls.js" - "public/touched-files-view.js" - - "public/viewer-toolbar.js" - - "read-session-file.js" - - "src/main/changes/git-changes-file.js" - "src/main/changes/remote-touched-files.js" - "src/main/changes/session-touched-files.js" - "src/main/changes/touched-transcript-cache.js" - - "src/main/files/panel-image.js" - - "src/main/integrations/mcp/mcp-bridge.js" --- # Context: touched-files diff --git a/.ai/contexts/trigger-watcher.md b/.ai/contexts/trigger-watcher.md index 801cd4101..cbb09692d 100644 --- a/.ai/contexts/trigger-watcher.md +++ b/.ai/contexts/trigger-watcher.md @@ -1,29 +1,6 @@ --- covers: - - "claude-binary.js" - - "cli-session-state.js" - - "db.js" - - "harnesses/claude.js" - - "main.js" - - "public/setting-defaults.js" - - "public/terminal-manager.js" - - "remote-activity.js" - - "scripts/claude-sandbox.sh" - - "scripts/platform-tests.js" - - "scripts/run-tests.js" - - "session-transitions.js" - - "src/main/cli/session-state-v1.js" - - "src/main/remote/remote-index.js" - - "src/main/remote/remote-watch.js" - "src/main/terminals/composer-state.js" - - "src/main/terminals/input-attach.js" - - "src/main/terminals/shell-profiles.js" - - "src/main/terminals/stop-session.js" - - "src/main/terminals/tab-input-lock.js" - - "src/main/terminals/terminal-input.js" - - "src/main/triggers/session-request-contract.js" - - "src/main/triggers/session-request-namespace.js" - - "src/main/triggers/session-request-publication.js" - "src/main/triggers/session-status.js" - "src/main/triggers/trigger-actions.js" - "src/main/triggers/trigger-context.js" diff --git a/.ai/contexts/updater-relaunch.md b/.ai/contexts/updater-relaunch.md index a81718030..114f3e913 100644 --- a/.ai/contexts/updater-relaunch.md +++ b/.ai/contexts/updater-relaunch.md @@ -1,6 +1,5 @@ --- covers: - - "main.js" - "src/main/app/linux-startup.js" - "src/main/app/relaunch.js" - "src/main/shared/clean-env.js" diff --git a/.ai/contexts/viewer-panel.md b/.ai/contexts/viewer-panel.md index 0a6e9ac44..447358da5 100644 --- a/.ai/contexts/viewer-panel.md +++ b/.ai/contexts/viewer-panel.md @@ -1,26 +1,15 @@ --- covers: - - "eslint.config.js" - "file-lists-worker-client.js" - "file-lists.js" - - "main.js" - - "public/activity-trace-panel.js" - - "public/app.js" - "public/codemirror-setup.js" - "public/file-panel.js" - - "public/jsonl-viewer.js" - - "public/memory-workfiles-view.js" - "public/mermaid-setup.js" - "public/message-search.js" - - "public/style.css" - "public/viewer-panel.js" - "public/viewer-toolbar.js" - - "src/main/app/session-exit.js" - "src/main/app/unsaved-guard.js" - - "src/main/changes/git-changes-watch.js" - "src/main/files/panel-image.js" - - "src/main/integrations/mcp/mcp-bridge.js" - - "src/main/shared/ipc-path-validator.js" - "viewer-file-watch.js" - "viewer-save-guard.js" - "workers/file-lists-query.js" diff --git a/.ai/contexts/window-frame.md b/.ai/contexts/window-frame.md index 9f2462edb..5a16e2159 100644 --- a/.ai/contexts/window-frame.md +++ b/.ai/contexts/window-frame.md @@ -1,22 +1,11 @@ --- covers: - - "eslint.config.js" - "main.js" - "preload.js" - - "public/app-dialogs.js" - - "public/app.js" - - "public/file-panel.js" - - "public/header-controls.js" - - "public/process-exit.js" - - "public/session-activity-dom.js" - - "public/style.css" - - "public/terminal-manager.js" - "public/window-strip.js" - "src/main/app/session-exit.js" - "src/main/app/unsaved-guard.js" - "src/main/app/window-frame.js" - - "src/main/app/window-theme.js" - - "src/main/terminals/pty-ops.js" --- # Context: window-frame diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index f614d302e..18b8e131e 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -7,7 +7,12 @@ What changes, and why? - User: `docs/...` or `README.md` / none + why - Agent: `.ai/contexts/...` / none + why -If neither needs an update: `no docs: ` and the `no-docs` label. +If neither needs an update, add the `no-docs` label and a separate line: + +- no docs: + +Replace `` with the explanation. Otherwise change the body of a covering +document; a front-matter-only edit does not count. ## Changelog diff --git a/README.md b/README.md index e1e27ca56..0bab2f0b8 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,3 @@ ---- -covers: - - "harnesses/claude.js" - - "harnesses/codex.js" - - "package.json" ---- - # Switchboard A desktop app for Claude Code and Codex CLI sessions. diff --git a/Taskfile.yaml b/Taskfile.yaml index f898ba584..40b7eec69 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -94,10 +94,11 @@ tasks: - node scripts/check-fast.js check: - desc: Run tests + lint + doc references (pre-commit / pre-push gate) + desc: Run tests + lint + doc references + covers validation (pre-commit / pre-push gate) deps: [test, lint] cmds: - node scripts/check-doc-refs.js + - node scripts/check-docs.js --validate ci: desc: CI gate — runs test then lint, verbose, exits on first failure diff --git a/docs/changelog.md b/docs/changelog.md index 61736c57b..a2acc0705 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -132,7 +132,7 @@ Every PR that changes behaviour updates the affected user documentation in `docs/` (or `README.md`) and agent documentation in `.ai/contexts/` in that same PR. Name the files in the PR body's Docs section. If either category needs no update, explain why. If neither needs an update, write -`no docs: ` and apply the `no-docs` label. The PR template also asks +`- no docs: ` on its own line and apply the `no-docs` label. The PR template also asks for the summary, changelog entry or `no-changelog` waiver, and test results. The PR-only `docs` job in `.github/workflows/test.yml` invokes @@ -140,7 +140,7 @@ The PR-only `docs` job in `.github/workflows/test.yml` invokes root JavaScript except `eslint.config.js`, `src/`, `public/`, `workers/`, `harnesses/`, and `scripts/claude-sandbox.sh`. -Every agent context and every user page describing code declares YAML front +Each eligible agent context and user page documenting code declares YAML front matter at the start of the file. For example: ```yaml @@ -157,13 +157,26 @@ more directories (or any remaining path when last). Quote globs. Exact paths are preferred where the whole directory is not documented. The only metadata key is `covers`, an array of strings; unknown keys, malformed YAML, absolute paths, parent traversal and patterns matching no tracked file fail the check. -Each `.ai/contexts/*.md` must declare it. The context index uses `covers: []` -because it routes readers rather than describing code; other navigation-only -pages can omit front matter. +Every eligible `.ai/contexts/*.md` must declare it. `covers` means the page +documents the file: retain files with a substantive section explaining their +behavior, contracts or invariants. A path mention, test list or cross-reference +is insufficient. ADRs (`docs/decisions/`), product vocabulary (`docs/product/`), +`.ai/contexts/_issues.md` and navigation READMEs carry no `covers`; the map +ignores those pages, including every `README.md`. + +A pattern needs a literal directory or filename prefix: a leading `**`, +`*.js` or `*/app.js` is invalid; `src/main/projects/project-delete*.js` is +valid. There is no files-per-pattern limit. Instead, each tracked file may have +at most four covering documents, counting a document once even if its patterns +overlap. A fifth owner is a validation error, including for non-app files. +Choose a small owner set for hub files; do not add every context that cites them. For each changed app file covered by a doc, at least one changed doc must cover -that file. Changing an unrelated page does not satisfy it. If several docs -cover a file, one is sufficient mechanically. A deleted doc cannot count. +that file and change its body outside the initial YAML front matter, compared +with the merge-base version. CRLF/LF differences alone do not count. A new doc +needs a nonempty body. Changing only metadata or an unrelated page does not +satisfy the rule. If several docs cover a file, one is sufficient mechanically. +A deleted doc cannot count. App files with no covering doc keep the previous fallback: any changed doc under `docs/` or `.ai/contexts/`, or `README.md`. The check prints all uncovered app files and their count, including on success; this inventory is advisory. @@ -171,19 +184,21 @@ app files and their count, including on success; this inventory is advisory. Non-app changes need no doc update, but their coverage metadata is validated. The exact `no-docs` label waives the update requirement only with a nonempty -`no docs: ` line in the PR body, replacing the placeholder with the -reason. It does not waive invalid coverage metadata. The checker reads the +`no docs: ` line in the PR body, optionally preceded by a Markdown +list marker (`-`, `*` or `+`), replacing the placeholder with the reason. It does not waive invalid coverage metadata. The checker reads the whole merge-base PR diff with renames disabled, current labels and current body through `gh api`. Re-run the job after adding the label or editing the reason. This waiver is independent of `no-changelog`. ```bash node scripts/check-docs.js --base --head --repo --pr -node scripts/check-docs.js --base --head --labels '["no-docs"]' --body 'no docs: internal refactor' +node scripts/check-docs.js --validate +node scripts/check-docs.js --base --head --labels '["no-docs"]' --body '- no docs: internal refactor' ``` -Validation lives in the docs gate so invalid declarations cannot weaken the -same decision that uses them. It uses the existing js-yaml development +Validation runs in the docs gate and locally through `task check` +(`node scripts/check-docs.js --validate`, without PR metadata). +`test/check-docs.test.js` also validates the real checkout declarations. It uses the existing js-yaml development dependency; the CI job installs locked dependencies with lifecycle scripts disabled. It reads tracked, existing Markdown files from the checkout. Exit codes are 0 for a pass, 1 for missing docs or invalid coverage metadata, diff --git a/docs/changes-view.md b/docs/changes-view.md index b0a80a55c..23b449c84 100644 --- a/docs/changes-view.md +++ b/docs/changes-view.md @@ -1,6 +1,5 @@ --- covers: - - "public/file-panel.js" - "src/main/changes/git-changes*.js" --- diff --git a/docs/decisions/0001-no-full-go-rewrite.md b/docs/decisions/0001-no-full-go-rewrite.md index bfa4536fb..536c6363a 100644 --- a/docs/decisions/0001-no-full-go-rewrite.md +++ b/docs/decisions/0001-no-full-go-rewrite.md @@ -1,8 +1,3 @@ ---- -covers: - - "main.js" ---- - # 0001 — No full Go rewrite; Go backend sidecar only, if ever **Status**: Accepted (2026-06-08) diff --git a/docs/decisions/0002-discrete-steps-sidebar-animations.md b/docs/decisions/0002-discrete-steps-sidebar-animations.md index 02b33b054..02fd6a51f 100644 --- a/docs/decisions/0002-discrete-steps-sidebar-animations.md +++ b/docs/decisions/0002-discrete-steps-sidebar-animations.md @@ -1,8 +1,3 @@ ---- -covers: - - "public/style.css" ---- - # 0002 — Steady-state indicator animations must be discrete (`steps()`), never smooth 60fps **Status**: Accepted (2026-08-19) diff --git a/docs/decisions/0003-trigger-delivery-per-tab.md b/docs/decisions/0003-trigger-delivery-per-tab.md index 6d5ca0d7c..7a9597c9f 100644 --- a/docs/decisions/0003-trigger-delivery-per-tab.md +++ b/docs/decisions/0003-trigger-delivery-per-tab.md @@ -1,17 +1,3 @@ ---- -covers: - - ".github/workflows/build.yml" - - ".github/workflows/test.yml" - - "cli-session-state.js" - - "main.js" - - "session-cache.js" - - "session-continuations.js" - - "session-transitions.js" - - "src/main/terminals/plain-terminal-shell.js" - - "src/main/triggers/trigger-context.js" - - "src/main/triggers/trigger-watcher.js" ---- - # 0003 — Deliver triggers under one tab lock and a per-write ownership check **Status**: Accepted (2026-10-13). The maintainer's decisions on the four open questions (13/10) are recorded under "Maintainer decisions". No implementation existed at acceptance. diff --git a/docs/decisions/0004-session-index-single-writer.md b/docs/decisions/0004-session-index-single-writer.md index 4e85bb7c3..5730dfb2b 100644 --- a/docs/decisions/0004-session-index-single-writer.md +++ b/docs/decisions/0004-session-index-single-writer.md @@ -1,23 +1,3 @@ ---- -covers: - - "db.js" - - "folder-index-state.js" - - "local-transcript-activity.js" - - "main.js" - - "package.json" - - "public/app.js" - - "public/session-activity.js" - - "read-session-file.js" - - "scripts/postinstall.js" - - "session-cache.js" - - "session-index-writer.js" - - "session-transitions.js" - - "src/main/remote/remote-hosts.js" - - "workers/projects-query.js" - - "workers/search-query.js" - - "workers/session-index-writer.js" ---- - # 0004 — Update the session index incrementally through one writer and bind the display with deltas **Status**: Decided (2026-10-14), following the maintainer decisions for #616 and the review of PR #640. Implementation, performance acceptance and packaged-build qualification remain pending. diff --git a/docs/decisions/0004-session-index-study.md b/docs/decisions/0004-session-index-study.md index bb797a5b6..172363ded 100644 --- a/docs/decisions/0004-session-index-study.md +++ b/docs/decisions/0004-session-index-study.md @@ -1,37 +1,3 @@ ---- -covers: - - "archived-projects.js" - - "db.js" - - "folder-index-state.js" - - "main.js" - - "package.json" - - "preload.js" - - "project-remap.js" - - "projects-worker-client.js" - - "public/agents-view.js" - - "public/app.js" - - "public/dialogs.js" - - "public/local-transcript-adapter.js" - - "public/remote-activity-ui.js" - - "public/session-activity.js" - - "public/settings-panel.js" - - "public/sidebar.js" - - "public/task-registry.js" - - "read-session-file.js" - - "scripts/postinstall.js" - - "search-worker-client.js" - - "session-cache.js" - - "session-transitions.js" - - "src/main/app/changelog.js" - - "src/main/remote/remote-hosts.js" - - "src/main/remote/remote-index.js" - - "src/main/schedules/schedule-runner.js" - - "workers/projects-query.js" - - "workers/scan-projects.js" - - "workers/scan-session-titles.js" - - "workers/search-query.js" ---- - # Session index study — reads, writes and display refreshes Initial inspection: 2026-10-14 at `33e8e10f63be0c1b51062e457000683393469cac`; second review revision verified against `433ba39d68dcf891eca58eae69518d31d2cc2923`; third review revision verified against `9b75e8d`, branch `docs/616-index-architecture-adr`. Production source is the merged slices 1–2 baseline. PR #637 is closed, superseded by ADR 0004; its source at `5053d7f` and the supplied review are evidence about that proposal, not code present in this branch. No production code or user database was changed. diff --git a/docs/decisions/0005-main-process-context-layout.md b/docs/decisions/0005-main-process-context-layout.md index 131f9fc0d..45f522f6c 100644 --- a/docs/decisions/0005-main-process-context-layout.md +++ b/docs/decisions/0005-main-process-context-layout.md @@ -1,8 +1,3 @@ ---- -covers: - - "main.js" ---- - # 0005 — Move main-process modules into flat contexts Status: Accepted by JB, 2026-10-28. Preparation: #832; lint prerequisite: #833. diff --git a/docs/decisions/0006-search-refs.md b/docs/decisions/0006-search-refs.md index f00f61a52..9138b3450 100644 --- a/docs/decisions/0006-search-refs.md +++ b/docs/decisions/0006-search-refs.md @@ -1,11 +1,3 @@ ---- -covers: - - "fts-match.js" - - "public/sidebar.js" - - "src/main/session-index/session-refs.js" - - "workers/search-query.js" ---- - # 0006 — Index the identifiers of the whole session beside its opening text Status: Proposed, 2026-11-25, for 0.1.0-beta.2 (#1255). diff --git a/docs/evidence/session-capabilities/README.md b/docs/evidence/session-capabilities/README.md index c5164edf2..55323a9b8 100644 --- a/docs/evidence/session-capabilities/README.md +++ b/docs/evidence/session-capabilities/README.md @@ -1,8 +1,3 @@ ---- -covers: - - "scripts/canary-cli-capabilities.js" ---- - # Phase 0 CLI capability evidence (#380) This is an evidence-only harness. It never qualifies production capabilities, diff --git a/docs/grid-overview.md b/docs/grid-overview.md index acc02568d..87cf86523 100644 --- a/docs/grid-overview.md +++ b/docs/grid-overview.md @@ -1,7 +1,6 @@ --- covers: - "public/grid-view.js" - - "public/terminal-manager.js" --- # Grid Overview diff --git a/docs/ide-emulation.md b/docs/ide-emulation.md index 9c4fe9304..02faed566 100644 --- a/docs/ide-emulation.md +++ b/docs/ide-emulation.md @@ -1,6 +1,5 @@ --- covers: - - "public/file-panel.js" - "src/main/integrations/mcp/*.js" --- diff --git a/docs/launching-sessions.md b/docs/launching-sessions.md index 4b772f6b0..7f44e1440 100644 --- a/docs/launching-sessions.md +++ b/docs/launching-sessions.md @@ -1,7 +1,6 @@ --- covers: - "harnesses/*.js" - - "main.js" - "public/dialogs.js" - "public/resume-guard.js" - "src/main/terminals/plain-terminal-shell.js" diff --git a/docs/product/BUILDING-BLOCKS.md b/docs/product/BUILDING-BLOCKS.md index 59c822b97..8cadc2175 100644 --- a/docs/product/BUILDING-BLOCKS.md +++ b/docs/product/BUILDING-BLOCKS.md @@ -1,28 +1,3 @@ ---- -covers: - - "eslint.config.js" - - "public/activity-trace-panel.js" - - "public/agents-view.js" - - "public/app-dialogs.js" - - "public/app-notices.js" - - "public/app.js" - - "public/choice-dialog.js" - - "public/dialogs.js" - - "public/file-panel.js" - - "public/grid-view.js" - - "public/header-controls.js" - - "public/index.html" - - "public/memory-workfiles-view.js" - - "public/modal-stack.js" - - "public/process-exit.js" - - "public/session-activity-dom.js" - - "public/session-state.js" - - "public/sidebar.js" - - "public/style.css" - - "public/tool-bar.js" - - "public/touched-files-view.js" ---- - # Building blocks > The original audit and its numeric source references describe v0.0.94. diff --git a/docs/product/CONCEPT-MAP.md b/docs/product/CONCEPT-MAP.md index 5808a50f6..db8034af8 100644 --- a/docs/product/CONCEPT-MAP.md +++ b/docs/product/CONCEPT-MAP.md @@ -1,30 +1,3 @@ ---- -covers: - - "delete-session-guard.js" - - "main.js" - - "public/agents-view.js" - - "public/app.js" - - "public/dialogs.js" - - "public/file-panel.js" - - "public/grid-view.js" - - "public/index.html" - - "public/process-exit.js" - - "public/resume-guard.js" - - "public/session-activity-dom.js" - - "public/session-state.js" - - "public/session-status-projection.js" - - "public/settings-panel.js" - - "public/shortcuts.js" - - "public/sidebar.js" - - "public/stop-session-ui.js" - - "public/style.css" - - "public/terminal-context-menu.js" - - "public/tool-bar.js" - - "public/utils.js" - - "session-cache.js" - - "src/main/app/session-exit.js" ---- - # Concept map > The original audit and its numeric source references describe v0.0.94. diff --git a/docs/product/GLOSSARY.md b/docs/product/GLOSSARY.md index 7cdd21e99..c43816276 100644 --- a/docs/product/GLOSSARY.md +++ b/docs/product/GLOSSARY.md @@ -1,44 +1,3 @@ ---- -covers: - - "cli-session-state.js" - - "derive-project-path.js" - - "main.js" - - "public/agents-view.js" - - "public/app.js" - - "public/dialogs.js" - - "public/file-panel.js" - - "public/grid-view.js" - - "public/index.html" - - "public/jsonl-viewer.js" - - "public/message-search.js" - - "public/panel-terminal.js" - - "public/process-exit.js" - - "public/restore-plan.js" - - "public/resume-guard.js" - - "public/session-activity-dom.js" - - "public/session-state.js" - - "public/settings-panel.js" - - "public/sidebar.js" - - "public/stop-session-ui.js" - - "public/terminal-manager.js" - - "public/worktree-nesting.js" - - "read-session-file.js" - - "session-cache.js" - - "session-continuations.js" - - "session-index-store.js" - - "src/main/app/session-exit.js" - - "src/main/bg-agents/bg-agents-roster.js" - - "src/main/bg-agents/bg-agents.js" - - "src/main/remote/remote-attach.js" - - "src/main/remote/remote-send.js" - - "src/main/schedules/run-schedule-now-target.js" - - "src/main/schedules/schedule-ipc.js" - - "src/main/schedules/schedule-runner.js" - - "src/main/terminals/plain-terminal-shell.js" - - "src/main/triggers/trigger-context.js" - - "src/main/triggers/trigger-watcher.js" ---- - # Glossary > The original audit and its numeric source references describe v0.0.94. diff --git a/docs/product/UI-PATTERNS.md b/docs/product/UI-PATTERNS.md index f2ded3a40..f210f924e 100644 --- a/docs/product/UI-PATTERNS.md +++ b/docs/product/UI-PATTERNS.md @@ -1,34 +1,3 @@ ---- -covers: - - "eslint.config.js" - - "public/activity-trace-panel.js" - - "public/agents-view.js" - - "public/app-dialogs.js" - - "public/app-notices.js" - - "public/app.js" - - "public/choice-dialog.js" - - "public/dialogs.js" - - "public/file-panel.js" - - "public/grid-view.js" - - "public/header-controls.js" - - "public/index.html" - - "public/jsonl-viewer.js" - - "public/modal-stack.js" - - "public/process-exit.js" - - "public/resume-guard.js" - - "public/schedules-view.js" - - "public/session-activity-dom.js" - - "public/session-state.js" - - "public/settings-panel.js" - - "public/sidebar.js" - - "public/style.css" - - "public/tool-bar.js" - - "public/touched-files-view.js" - - "public/viewer-panel.js" - - "public/viewer-toolbar.js" - - "public/whats-new.js" ---- - # UI patterns > The original audit and its numeric source references describe v0.0.94. diff --git a/scripts/check-docs.js b/scripts/check-docs.js index d3b9b0c69..baf3239cf 100644 --- a/scripts/check-docs.js +++ b/scripts/check-docs.js @@ -11,12 +11,23 @@ function isDocPath(file) { return file.startsWith('docs/') || file.startsWith('.ai/contexts/') || file === 'README.md'; } +function isCoverageDoc(file) { + return isDocPath(file) && file.endsWith('.md') + && !/^(docs\/(decisions|product)\/|\.ai\/contexts\/_issues\.md$)|(^|\/)README\.md$/i.test(file); +} + +function docBody(text = '') { + if (!/^\uFEFF?---[ \t]*\r?\n/.test(text)) return text.replace(/\r\n/g, '\n'); + return text.replace(/^\uFEFF?---[ \t]*\r?\n[\s\S]*?^---[ \t]*(?:\r?\n|$)/m, '').replace(/\r\n/g, '\n'); +} + function coverPattern(glob) { if (typeof glob !== 'string' || !glob || glob.trim() !== glob || /[\\\s?:[\]{}!]/.test(glob) || glob.startsWith('/') + || glob.startsWith('*') || glob.split('/').some(part => !part || part === '.' || part === '..') || glob.split('/').some(part => part.includes('**') && part !== '**')) { - throw new Error('covers entries must be repo-relative paths using only * or ** globs'); + throw new Error('covers entries must be repo-relative paths with a literal directory/file prefix using only * or ** globs'); } const parts = glob.split('/'); const source = parts.map((part, i) => { @@ -30,7 +41,7 @@ function coverageMap(documents, trackedFiles) { const coverage = new Map(); const errors = []; for (const [doc, text] of Object.entries(documents)) { - if (!isDocPath(doc) || !doc.endsWith('.md')) continue; + if (!isCoverageDoc(doc)) continue; const required = /^\.ai\/contexts\/[^/]+\.md$/.test(doc); const starts = /^\uFEFF?---[ \t]*\r?\n/.test(text); if (!starts) { @@ -55,23 +66,29 @@ function coverageMap(documents, trackedFiles) { errors.push(doc + ': ' + err.message); } } + for (const file of new Set(trackedFiles)) { + const owners = [...coverage].filter(([, patterns]) => patterns.some(pattern => pattern.test(file))).map(([doc]) => doc); + if (owners.length > 4) errors.push(file + ': covered by ' + owners.length + ' docs (maximum 4): ' + owners.join(', ')); + } return { coverage, errors }; } -function checkDocs({ files, labels, body = '', documents = {}, trackedFiles = files }) { +function checkDocs({ files, labels, body = '', documents = {}, previousDocuments = {}, trackedFiles = files }) { const { coverage, errors } = coverageMap(documents, trackedFiles); const covering = file => [...coverage].filter(([, patterns]) => patterns.some(pattern => pattern.test(file))).map(([doc]) => doc); const uncovered = [...new Set([...trackedFiles, ...files])].filter(isAppPath).filter(file => covering(file).length === 0); const report = ['Uncovered app files (' + uncovered.length + '), advisory:', ...uncovered.map(file => ' ' + file)]; + const changedBody = doc => Object.hasOwn(documents, doc) + && docBody(documents[doc]) !== docBody(previousDocuments[doc]); const hasDocs = files.some(file => isDocPath(file) && trackedFiles.includes(file)); const reason = body.split(/\r?\n/).some(line => { - const match = line.match(/^[ \t]*no docs:[ \t]*(\S.*)$/i); + const match = line.match(/^[ \t]*(?:[-*+][ \t]+)?no docs:[ \t]*(\S.*)$/i); return match && match[1].trim() !== ''; }); const waived = labels.includes('no-docs') && reason; const missing = files.filter(isAppPath).filter(file => { const docs = covering(file); - return docs.length ? !docs.some(doc => files.includes(doc)) : !hasDocs; + return docs.length ? !docs.some(doc => files.includes(doc) && changedBody(doc)) : !hasDocs; }); if (errors.length) return { ok: false, uncovered, message: [...errors, ...report].join('\n') }; if (!waived && missing.length) { @@ -80,8 +97,8 @@ function checkDocs({ files, labels, body = '', documents = {}, trackedFiles = fi message: [ 'This PR changes the app without documentation:', ...missing.map(file => ' ' + file + (covering(file).length ? ' — update one of: ' + covering(file).join(', ') : ' — update any doc (uncovered)')), - 'Update a doc whose covers includes each changed app file.', - 'If none are needed, write "no docs: " in the body and add the "no-docs" label, then re-run this job.', + 'Update the body (outside front matter) of a doc whose covers includes each changed app file.', + 'If none are needed, write "- no docs: " on its own line in the body and add the "no-docs" label, then re-run this job.', ...report, ].join('\n'), }; @@ -89,9 +106,10 @@ function checkDocs({ files, labels, body = '', documents = {}, trackedFiles = fi return { ok: true, uncovered, message: ['docs check passed', ...report].join('\n') }; } -const USAGE = 'usage: check-docs.js --base --head (--labels [--body ] | --repo --pr )'; +const USAGE = 'usage: check-docs.js --validate | --base --head (--labels [--body ] | --repo --pr )'; function parseArgs(argv) { + if (argv.length === 1 && argv[0] === '--validate') return { validate: true }; const opts = {}; for (let i = 0; i < argv.length; i += 2) { if (!['--base', '--head', '--labels', '--body', '--repo', '--pr'].includes(argv[i]) || argv[i + 1] === undefined) throw new Error(USAGE); @@ -105,18 +123,27 @@ function parseArgs(argv) { if (require.main === module) { try { const opts = parseArgs(process.argv.slice(2)); - const labels = parseLabels(opts.labels !== undefined ? opts.labels + const labels = opts.validate ? [] : parseLabels(opts.labels !== undefined ? opts.labels : execFileSync('gh', ['api', `repos/${opts.repo}/issues/${opts.pr}/labels`, '--jq', '[.[].name]'], { encoding: 'utf8' }).trim()); - const files = execFileSync('git', ['diff', '--name-only', '--no-renames', '-z', `${opts.base}...${opts.head}`], { encoding: 'utf8' }) - .split('\0').filter(Boolean); - const body = opts.body !== undefined ? opts.body : opts.repo && opts.pr - ? execFileSync('gh', ['api', `repos/${opts.repo}/pulls/${opts.pr}`, '--jq', '.body // ""'], { encoding: 'utf8' }) : ''; const root = path.join(__dirname, '..'); const trackedFiles = execFileSync('git', ['ls-files', '-z', '--cached'], { cwd: root, encoding: 'utf8' }) .split('\0').filter(Boolean).filter(file => fs.existsSync(path.join(root, file))); const documents = Object.fromEntries(trackedFiles.filter(file => isDocPath(file) && file.endsWith('.md')) .map(file => [file, fs.readFileSync(path.join(root, file), 'utf8')])); - const result = checkDocs({ files, labels, body, documents, trackedFiles }); + let result; + if (opts.validate) { + result = checkDocs({ files: [], labels: [], documents, trackedFiles }); + } else { + const files = execFileSync('git', ['diff', '--name-only', '--no-renames', '-z', `${opts.base}...${opts.head}`], { encoding: 'utf8' }) + .split('\0').filter(Boolean); + const body = opts.body !== undefined ? opts.body : opts.repo && opts.pr + ? execFileSync('gh', ['api', `repos/${opts.repo}/pulls/${opts.pr}`, '--jq', '.body // ""'], { encoding: 'utf8' }) : ''; + const base = execFileSync('git', ['merge-base', opts.base, opts.head], { cwd: root, encoding: 'utf8' }).trim(); + const baseFiles = new Set(execFileSync('git', ['ls-tree', '-r', '--name-only', '-z', base], { cwd: root, encoding: 'utf8' }).split('\0')); + const previousDocuments = Object.fromEntries(files.filter(file => isCoverageDoc(file) && baseFiles.has(file)) + .map(file => [file, execFileSync('git', ['show', base + ':' + file], { cwd: root, encoding: 'utf8' })])); + result = checkDocs({ files, labels, body, documents, previousDocuments, trackedFiles }); + } console.log(result.message); process.exitCode = result.ok ? 0 : 1; } catch (err) { @@ -125,4 +152,4 @@ if (require.main === module) { } } -module.exports = { checkDocs }; +module.exports = { checkDocs, coverageMap }; diff --git a/test/check-docs.test.js b/test/check-docs.test.js index e53ff81b7..c79ffa23a 100644 --- a/test/check-docs.test.js +++ b/test/check-docs.test.js @@ -51,7 +51,7 @@ test('only the exact no-docs label waives runtime documentation', () => { } }); -function runCli(args, { files = ['main.js'], labels = '[]', body = '', documents = {}, trackedFiles = files, failCommand } = {}) { +function runCli(args, { files = ['main.js'], labels = '[]', body = '', documents = {}, trackedFiles = files, previousDocuments = {}, failCommand } = {}) { const calls = []; const output = []; const module = { exports: {} }; @@ -61,6 +61,9 @@ function runCli(args, { files = ['main.js'], labels = '[]', body = '', documents calls.push({ command, argv: Array.from(argv), options: { ...options } }); if (command === failCommand) throw new Error(`${command} unavailable`); assert.ok(['git', 'gh'].includes(command), command); + if (command === 'git' && argv[0] === 'merge-base') return 'merge-base-sha'; + if (command === 'git' && argv[0] === 'ls-tree') return Object.keys(previousDocuments).join('\0'); + if (command === 'git' && argv[0] === 'show') return previousDocuments[argv[1].slice('merge-base-sha:'.length)]; if (command === 'git') return (argv[0] === 'ls-files' ? trackedFiles : files).join('\0') + '\0'; return argv.includes('.body // ""') ? body : labels; }, @@ -229,3 +232,100 @@ test('GIVEN CLI input WHEN tracked docs cover the changed file THEN unrelated or test('GIVEN live no-docs label WHEN the live PR body has no reason THEN CLI rejects the waiver', () => { assert.equal(runCli([...REFS, '--repo', 'o/r', '--pr', '7'], { labels: '["no-docs"]' }).code, 1); }); + +const root = path.join(__dirname, '..'); +const { execFileSync } = require('node:child_process'); +const realFiles = execFileSync('git', ['ls-files', '-z'], { cwd: root, encoding: 'utf8' }).split('\0').filter(Boolean); +const realDocuments = Object.fromEntries(realFiles.filter(file => /^(docs\/|\.ai\/contexts\/|README\.md$)/.test(file) && file.endsWith('.md')) + .map(file => [file, fs.readFileSync(path.join(root, file), 'utf8')])); + +for (const doc of ['docs/decisions/0001.md', 'docs/product/GLOSSARY.md', '.ai/contexts/_issues.md', '.ai/contexts/README.md', 'docs/nested/README.md', 'README.md']) { + test('GIVEN ineligible ' + doc + ' WHEN declaring covers THEN it cannot cover code', () => { + const result = checkDocs({ files: [], labels: [], trackedFiles: ['main.js'], + documents: { [doc]: '---\ncovers: ["main.js"]\n---\n# Navigation or historical note' } }); + assert.deepEqual(result.uncovered, ['main.js']); + }); +} + +for (const glob of ['**', '**/*.js', '*.js', '*/app.js']) { + test('GIVEN unprefixed glob ' + glob + ' WHEN validating THEN it fails', () => { + const result = checkDocs({ files: [], labels: [], trackedFiles: ['main.js', 'public/app.js'], + documents: { 'docs/a.md': '---\ncovers: ["' + glob + '"]\n---\n# A' } }); + assert.equal(result.ok, false, glob); + }); +} + +test('GIVEN five owners WHEN validating THEN the fifth fails even with a waiver', () => { + const documents = Object.fromEntries(Array.from({ length: 5 }, (_, i) => ['docs/owner-' + i + '.md', '---\ncovers: ["main.js", "main.js"]\n---\n# Owner'])); + const input = { files: [], labels: ['no-docs'], body: 'no docs: internal', trackedFiles: ['main.js'], documents }; + assert.equal(checkDocs(input).ok, false, 'five documents must fail validation'); + assert.match(checkDocs(input).message, /main.js.*5.*4/); + delete documents['docs/owner-4.md']; + assert.equal(checkDocs(input).ok, true, 'four documents, even with duplicate patterns, are allowed'); +}); + +test('GIVEN front-matter-only edits WHEN a covering doc is touched THEN it fails until its body changes', () => { + const previousDocuments = { 'docs/terminal.md': COVERAGE['docs/terminal.md'].replace('public/terminal*.js', 'public/terminal.js') }; + const files = ['public/terminal.js', 'docs/terminal.md']; + assert.equal(covered(files, { previousDocuments }).ok, false, 'metadata alone must not satisfy coverage'); + assert.equal(covered(files, { previousDocuments, documents: { ...COVERAGE, 'docs/terminal.md': COVERAGE['docs/terminal.md'] + '\nUpdated behavior.' } }).ok, true); + assert.equal(covered(files, { previousDocuments: COVERAGE }).ok, false, 'unchanged bodies must fail'); +}); + +test('GIVEN CLI comparison WHEN only front matter changes THEN it fails using the merge-base document', () => { + const options = { files: ['public/terminal.js', 'docs/terminal.md'], documents: COVERAGE, trackedFiles: TRACKED, + previousDocuments: { 'docs/terminal.md': COVERAGE['docs/terminal.md'].replace('public/terminal*.js', 'public/terminal.js') } }; + const result = runCli([...REFS, '--labels', '[]'], options); + assert.equal(result.code, 1, 'CLI must reject metadata-only coverage edits'); + assert.ok(result.calls.some(call => call.argv[0] === 'show' && call.argv[1] === 'merge-base-sha:docs/terminal.md')); + assert.equal(runCli([...REFS, '--labels', '[]'], { ...options, documents: { ...COVERAGE, 'docs/terminal.md': COVERAGE['docs/terminal.md'] + '\nBehavior changed.' } }).code, 0); +}); + +for (const marker of ['- ', '* ', '+ ']) { + test('GIVEN a list waiver ' + marker + ' WHEN the exact label and reason exist THEN it passes', () => { + assert.equal(covered(['public/terminal.js'], { labels: ['no-docs'], body: marker + 'no docs: internal refactor' }).ok, true); + for (const reason of ['', '']) assert.equal(covered(['public/terminal.js'], { labels: ['no-docs'], body: marker + 'no docs: ' + reason }).ok, false); + }); +} + +test('GIVEN validate mode WHEN checking a checkout THEN no PR metadata is needed and invalid covers fail', () => { + assert.equal(runCli(['--validate'], { documents: COVERAGE, trackedFiles: TRACKED }).code, 0); + assert.equal(runCli(['--validate'], { documents: { '.ai/contexts/broken.md': '# No covers' }, trackedFiles: ['.ai/contexts/broken.md'] }).code, 1); + const task = require('js-yaml').load(fs.readFileSync(path.join(root, 'Taskfile.yaml'), 'utf8')); + assert.ok(task.tasks.check.cmds.includes('node scripts/check-docs.js --validate')); +}); + +test('GIVEN the real checkout WHEN validating covers THEN declarations are valid and excluded docs have none', () => { + const result = checkDocs({ files: [], labels: [], documents: realDocuments, trackedFiles: realFiles }); + assert.equal(result.ok, true, result.message); + for (const [doc, text] of Object.entries(realDocuments)) { + if (/^(docs\/(decisions|product)\/|\.ai\/contexts\/_issues\.md$)|(^|\/)README\.md$/i.test(doc)) { + assert.doesNotMatch(text, /^covers:/m, doc); + } + } +}); + +for (const hub of ['main.js', 'preload.js', 'public/app.js', 'public/sidebar.js', 'session-cache.js']) { + test('GIVEN the real checkout WHEN counting owners of ' + hub + ' THEN there are one to four', () => { + const owners = Object.entries(realDocuments).filter(([doc, text]) => !checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: text } }).uncovered.includes(hub)).map(([doc]) => doc); + assert.ok(owners.length >= 1 && owners.length <= 4, hub + ': ' + owners.length + ' owners'); + }); +} + +for (const file of ['src/main/projects/project-delete-deadline.js', 'src/main/projects/project-delete-inventory.js', 'src/main/projects/project-delete-snapshot.js', 'src/main/terminals/windows-job-helper.js']) { + test('GIVEN the owning context WHEN checking ' + file + ' THEN it is covered', () => { + const doc = '.ai/contexts/' + (file.includes('project-delete') ? 'project-delete' : 'cli-session-state') + '.md'; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes(file), file + ' must be covered by ' + doc); + }); +} + +test('GIVEN horizontal rules in the body WHEN their enclosed prose changes THEN it counts as a body edit', () => { + const file = 'docs/terminal.md'; + const previousDocuments = { [file]: COVERAGE[file] + '\n\n---\nOld behavior\n---\n' }; + const documents = { ...COVERAGE, [file]: previousDocuments[file].replace('Old behavior', 'New behavior') }; + assert.equal(covered(['public/terminal.js', file], { documents, previousDocuments }).ok, true); + const noFront = { [file]: '# Terminal\n\n---\nOld behavior\n---\n' }; + assert.equal(covered(['public/terminal.js', file], { documents, previousDocuments: noFront }).ok, true); + assert.equal(covered(['public/terminal.js', file], { documents: { ...COVERAGE, [file]: '---\ncovers: ["public/terminal.js"]\n---\n' + noFront[file] }, previousDocuments: noFront }).ok, false, 'adding front matter above existing horizontal rules is metadata-only'); +}); From e1a8cae9aff2dbb33fb4ebb1b98221a9834d6c4b Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Sun, 29 Nov 2026 03:05:45 +0100 Subject: [PATCH 3/6] (docs): let any covering doc satisfy a hub file and read docs at the PR head --- .ai/contexts/app-dialogs.md | 2 + .ai/contexts/bg-agents.md | 3 + .ai/contexts/build-release.md | 9 +- .ai/contexts/fast-check.md | 10 +- .ai/contexts/ipc-bridge.md | 5 + .ai/contexts/schedule-runner.md | 1 + .ai/contexts/session-cache.md | 4 + .ai/contexts/session-state.md | 1 + .ai/contexts/trigger-watcher.md | 3 + docs/changelog.md | 29 +++-- docs/launching-sessions.md | 1 - scripts/check-docs.js | 27 +++-- test/check-docs.test.js | 196 +++++++++++++++++++++++++++++++- 13 files changed, 264 insertions(+), 27 deletions(-) diff --git a/.ai/contexts/app-dialogs.md b/.ai/contexts/app-dialogs.md index e14c62e0a..2de8fc628 100644 --- a/.ai/contexts/app-dialogs.md +++ b/.ai/contexts/app-dialogs.md @@ -1,5 +1,7 @@ --- covers: + - "public/choice-dialog.js" + - "public/resume-guard.js" - "public/app-dialogs.js" - "public/app-notices.js" - "public/dialogs.js" diff --git a/.ai/contexts/bg-agents.md b/.ai/contexts/bg-agents.md index f3b3f39a1..36c0fd6bc 100644 --- a/.ai/contexts/bg-agents.md +++ b/.ai/contexts/bg-agents.md @@ -1,5 +1,8 @@ --- covers: + - "claude-binary.js" + - "delete-session-guard.js" + - "public/resume-guard.js" - "bridge-session-id.js" - "project-root.js" - "public/agents-view.js" diff --git a/.ai/contexts/build-release.md b/.ai/contexts/build-release.md index 25a86cf86..fae2b4b7c 100644 --- a/.ai/contexts/build-release.md +++ b/.ai/contexts/build-release.md @@ -332,8 +332,13 @@ repository/PR number, full checkout history and `GH_TOKEN`. Node 22 installs locked dependencies with lifecycle scripts disabled for the existing js-yaml parser. The gate reuses the changelog app-path classification, reads a NUL-delimited diff with renames disabled and fetches live labels and PR body. -Each covered app change needs a changed doc whose `covers` matches it; uncovered -app files retain the any-doc fallback and are printed as an advisory inventory. +Covered non-hub app changes need a changed doc whose `covers` matches them. +The explicit hub list in the checker accepts any eligible coverage doc with a +non-whitespace body change. The gate reads docs from the PR head and compares +bodies with the merge base, ignoring metadata and whitespace-only edits. +Uncovered non-hub app files accept any changed eligible coverage doc; ADRs, +product pages, `_issues.md` and READMEs do not count. Uncovered files are printed +as an advisory inventory. The exact `no-docs` label requires a nonempty `no docs: ` body line. Unknown metadata keys, malformed covers or globs without a tracked match fail even a docs-only PR. Metadata is validated here so the gate cannot rely on diff --git a/.ai/contexts/fast-check.md b/.ai/contexts/fast-check.md index 1d13e7662..634393f0b 100644 --- a/.ai/contexts/fast-check.md +++ b/.ai/contexts/fast-check.md @@ -19,8 +19,14 @@ skip it. Reference scanning skips initial YAML front matter, retaining body line numbers. Coverage declarations are validated by `scripts/check-docs.js --validate` in `Taskfile.yaml` (`task check`), by the real-checkout regression in `test/check-docs.test.js`, and by the PR docs gate. The PR gate requires a body -change in a matching owner doc, comparing against the merge base, and prints -uncovered files. Metadata-only edits do not count. A rename in JavaScript that breaks a doc is caught by `task check` and +change in a matching owner doc for non-hubs, comparing the PR head with the +merge base, and prints uncovered files. The explicit `HUB_FILES` set in +`scripts/check-docs.js` accepts a non-whitespace body change in any eligible +coverage doc. Metadata-only and whitespace-only edits do not count, and the +uncovered-file fallback excludes ADRs, product pages, `_issues.md` and READMEs. +Root patterns must be exact paths; each file still has at most four owners. +`public/resume-guard.js` keeps the three contexts describing its decisions and +wording plus the session-restore user page as its four owners. A rename in JavaScript that breaks a doc is caught by `task check` and the `docs-refs` CI job, not here. Rules are in [changelog.md](../../docs/changelog.md#doc-references). `task check` and the full suite remain the required gate before a PR. diff --git a/.ai/contexts/ipc-bridge.md b/.ai/contexts/ipc-bridge.md index 17dfda97f..f8703a384 100644 --- a/.ai/contexts/ipc-bridge.md +++ b/.ai/contexts/ipc-bridge.md @@ -1,5 +1,10 @@ --- covers: + - "claude-auth.js" + - "delete-session-target.js" + - "public/utils.js" + - "src/main/terminals/stop-process-tree.js" + - "public/session-projection-diagnostics.js" - "src/main/projects/last-known-projects.js" - "main.js" - "preload.js" diff --git a/.ai/contexts/schedule-runner.md b/.ai/contexts/schedule-runner.md index 0f398e674..fb324c80f 100644 --- a/.ai/contexts/schedule-runner.md +++ b/.ai/contexts/schedule-runner.md @@ -1,5 +1,6 @@ --- covers: + - "src/main/shared/normalize-project-path.js" - "public/schedules-view.js" - "src/main/schedules/run-schedule-now-target.js" - "src/main/schedules/schedule-background.js" diff --git a/.ai/contexts/session-cache.md b/.ai/contexts/session-cache.md index 3fc63731d..d8fd9f4e4 100644 --- a/.ai/contexts/session-cache.md +++ b/.ai/contexts/session-cache.md @@ -1,5 +1,9 @@ --- covers: + - "conversation-meta.js" + - "public/bridge-url.js" + - "src/main/session-index/read-counters.js" + - "src/main/app/main-loop-monitor.js" - "archived-projects.js" - "cache-effects.js" - "db.js" diff --git a/.ai/contexts/session-state.md b/.ai/contexts/session-state.md index 913935292..d1c441dc5 100644 --- a/.ai/contexts/session-state.md +++ b/.ai/contexts/session-state.md @@ -1,5 +1,6 @@ --- covers: + - "public/index.html" - "cli-session-state.js" - "local-transcript-activity.js" - "public/app.js" diff --git a/.ai/contexts/trigger-watcher.md b/.ai/contexts/trigger-watcher.md index cbb09692d..f9dc3d3b2 100644 --- a/.ai/contexts/trigger-watcher.md +++ b/.ai/contexts/trigger-watcher.md @@ -1,5 +1,8 @@ --- covers: + - "src/main/terminals/terminal-input.js" + - "src/main/terminals/stop-session.js" + - "src/main/terminals/input-attach.js" - "src/main/terminals/composer-state.js" - "src/main/triggers/session-status.js" - "src/main/triggers/trigger-actions.js" diff --git a/docs/changelog.md b/docs/changelog.md index a2acc0705..7055ed009 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -166,20 +166,33 @@ ignores those pages, including every `README.md`. A pattern needs a literal directory or filename prefix: a leading `**`, `*.js` or `*/app.js` is invalid; `src/main/projects/project-delete*.js` is -valid. There is no files-per-pattern limit. Instead, each tracked file may have +valid. Root-level patterns without `/` must be exact paths: `s*` and +`main*.js` are invalid. There is no files-per-pattern limit. Instead, each tracked file may have at most four covering documents, counting a document once even if its patterns overlap. A fifth owner is a validation error, including for non-app files. Choose a small owner set for hub files; do not add every context that cites them. -For each changed app file covered by a doc, at least one changed doc must cover -that file and change its body outside the initial YAML front matter, compared -with the merge-base version. CRLF/LF differences alone do not count. A new doc -needs a nonempty body. Changing only metadata or an unrelated page does not +The checker explicitly declares seven hubs: `main.js`, `preload.js`, +`public/app.js`, `public/file-panel.js`, `public/style.css`, `public/sidebar.js` +and `public/index.html`. A changed hub accepts a body change in any eligible +coverage doc, even one that does not declare that hub in `covers`. Its own +owners are needed only if no other eligible coverage body changed; an owner +still needs a body change. This exception does not extend to other files in +the same PR. + +For each changed non-hub app file covered by a doc, at least one changed doc +must cover that file and change its body outside the initial YAML front matter. +The PR head document is compared with its merge-base version, using Git objects +for both snapshots; prose present only in the merge checkout cannot count. +Whitespace-only edits (including blank lines and CRLF/LF changes) do not count. +A new doc needs non-whitespace body content. Changing only metadata does not satisfy the rule. If several docs cover a file, one is sufficient mechanically. A deleted doc cannot count. -App files with no covering doc keep the previous fallback: any changed doc -under `docs/` or `.ai/contexts/`, or `README.md`. The check prints all uncovered -app files and their count, including on success; this inventory is advisory. +Non-hub app files with no covering doc retain a fallback: any changed eligible +coverage Markdown doc under `docs/` or `.ai/contexts/`. ADRs, product pages, +`_issues.md` and every `README.md` are excluded here too. The check prints all +uncovered app files and their count, including on success; this inventory is +advisory. `CHANGELOG.md` and `.ai/shared-guidelines.md` alone do not satisfy the gate. Non-app changes need no doc update, but their coverage metadata is validated. diff --git a/docs/launching-sessions.md b/docs/launching-sessions.md index 7f44e1440..af41ec21f 100644 --- a/docs/launching-sessions.md +++ b/docs/launching-sessions.md @@ -2,7 +2,6 @@ covers: - "harnesses/*.js" - "public/dialogs.js" - - "public/resume-guard.js" - "src/main/terminals/plain-terminal-shell.js" - "src/main/terminals/shell-profiles.js" --- diff --git a/scripts/check-docs.js b/scripts/check-docs.js index baf3239cf..3603681d5 100644 --- a/scripts/check-docs.js +++ b/scripts/check-docs.js @@ -7,6 +7,11 @@ const yaml = require('js-yaml'); const { execFileSync } = require('node:child_process'); const { isAppPath, parseLabels } = require('./check-changelog'); +const HUB_FILES = new Set([ + 'main.js', 'preload.js', 'public/app.js', 'public/file-panel.js', + 'public/style.css', 'public/sidebar.js', 'public/index.html', +]); + function isDocPath(file) { return file.startsWith('docs/') || file.startsWith('.ai/contexts/') || file === 'README.md'; } @@ -24,7 +29,7 @@ function docBody(text = '') { function coverPattern(glob) { if (typeof glob !== 'string' || !glob || glob.trim() !== glob || /[\\\s?:[\]{}!]/.test(glob) || glob.startsWith('/') - || glob.startsWith('*') + || glob.startsWith('*') || (!glob.includes('/') && glob.includes('*')) || glob.split('/').some(part => !part || part === '.' || part === '..') || glob.split('/').some(part => part.includes('**') && part !== '**')) { throw new Error('covers entries must be repo-relative paths with a literal directory/file prefix using only * or ** globs'); @@ -79,14 +84,16 @@ function checkDocs({ files, labels, body = '', documents = {}, previousDocuments const uncovered = [...new Set([...trackedFiles, ...files])].filter(isAppPath).filter(file => covering(file).length === 0); const report = ['Uncovered app files (' + uncovered.length + '), advisory:', ...uncovered.map(file => ' ' + file)]; const changedBody = doc => Object.hasOwn(documents, doc) - && docBody(documents[doc]) !== docBody(previousDocuments[doc]); - const hasDocs = files.some(file => isDocPath(file) && trackedFiles.includes(file)); + && docBody(documents[doc]).replace(/\s/g, '') !== docBody(previousDocuments[doc]).replace(/\s/g, ''); + const hasDocs = files.some(file => isCoverageDoc(file) && trackedFiles.includes(file)); + const hasChangedCoverageDoc = files.some(file => isCoverageDoc(file) && trackedFiles.includes(file) && changedBody(file)); const reason = body.split(/\r?\n/).some(line => { const match = line.match(/^[ \t]*(?:[-*+][ \t]+)?no docs:[ \t]*(\S.*)$/i); return match && match[1].trim() !== ''; }); const waived = labels.includes('no-docs') && reason; const missing = files.filter(isAppPath).filter(file => { + if (HUB_FILES.has(file)) return !hasChangedCoverageDoc; const docs = covering(file); return docs.length ? !docs.some(doc => files.includes(doc) && changedBody(doc)) : !hasDocs; }); @@ -96,8 +103,8 @@ function checkDocs({ files, labels, body = '', documents = {}, previousDocuments ok: false, uncovered, message: [ 'This PR changes the app without documentation:', - ...missing.map(file => ' ' + file + (covering(file).length ? ' — update one of: ' + covering(file).join(', ') : ' — update any doc (uncovered)')), - 'Update the body (outside front matter) of a doc whose covers includes each changed app file.', + ...missing.map(file => ' ' + file + (HUB_FILES.has(file) ? ' — update the body of any coverage doc (hub)' : covering(file).length ? ' — update one of: ' + covering(file).join(', ') : ' — update any coverage doc (uncovered)')), + 'Change non-whitespace body content outside front matter: any coverage doc for hubs, a matching owner for other covered files.', 'If none are needed, write "- no docs: " on its own line in the body and add the "no-docs" label, then re-run this job.', ...report, ].join('\n'), @@ -126,10 +133,14 @@ if (require.main === module) { const labels = opts.validate ? [] : parseLabels(opts.labels !== undefined ? opts.labels : execFileSync('gh', ['api', `repos/${opts.repo}/issues/${opts.pr}/labels`, '--jq', '[.[].name]'], { encoding: 'utf8' }).trim()); const root = path.join(__dirname, '..'); - const trackedFiles = execFileSync('git', ['ls-files', '-z', '--cached'], { cwd: root, encoding: 'utf8' }) - .split('\0').filter(Boolean).filter(file => fs.existsSync(path.join(root, file))); + const trackedFiles = (opts.validate + ? execFileSync('git', ['ls-files', '-z', '--cached'], { cwd: root, encoding: 'utf8' }) + .split('\0').filter(Boolean).filter(file => fs.existsSync(path.join(root, file))) + : execFileSync('git', ['ls-tree', '-r', '--name-only', '-z', opts.head], { cwd: root, encoding: 'utf8' }) + .split('\0').filter(Boolean)); const documents = Object.fromEntries(trackedFiles.filter(file => isDocPath(file) && file.endsWith('.md')) - .map(file => [file, fs.readFileSync(path.join(root, file), 'utf8')])); + .map(file => [file, opts.validate ? fs.readFileSync(path.join(root, file), 'utf8') + : execFileSync('git', ['show', opts.head + ':' + file], { cwd: root, encoding: 'utf8' })])); let result; if (opts.validate) { result = checkDocs({ files: [], labels: [], documents, trackedFiles }); diff --git a/test/check-docs.test.js b/test/check-docs.test.js index c79ffa23a..fd18928a3 100644 --- a/test/check-docs.test.js +++ b/test/check-docs.test.js @@ -32,8 +32,8 @@ test('test-only, CI-only, tooling-only and docs-only PRs pass', () => { }); test('any accepted documentation path satisfies the fallback for uncovered app files', () => { - for (const file of ['docs/guide.md', 'docs/nested/guide.md', '.ai/contexts/cli.md', 'README.md']) { - assert.equal(checkDocs({ files: ['main.js', file], labels: [] }).ok, true, file); + for (const file of ['docs/guide.md', 'docs/nested/guide.md', '.ai/contexts/cli.md']) { + assert.equal(checkDocs({ files: ['new-service.js', file], labels: [] }).ok, true, file); } }); @@ -51,7 +51,7 @@ test('only the exact no-docs label waives runtime documentation', () => { } }); -function runCli(args, { files = ['main.js'], labels = '[]', body = '', documents = {}, trackedFiles = files, previousDocuments = {}, failCommand } = {}) { +function runCli(args, { files = ['main.js'], labels = '[]', body = '', documents = {}, trackedFiles = files, previousDocuments = {}, headDocuments = documents, failCommand } = {}) { const calls = []; const output = []; const module = { exports: {} }; @@ -62,8 +62,13 @@ function runCli(args, { files = ['main.js'], labels = '[]', body = '', documents if (command === failCommand) throw new Error(`${command} unavailable`); assert.ok(['git', 'gh'].includes(command), command); if (command === 'git' && argv[0] === 'merge-base') return 'merge-base-sha'; - if (command === 'git' && argv[0] === 'ls-tree') return Object.keys(previousDocuments).join('\0'); - if (command === 'git' && argv[0] === 'show') return previousDocuments[argv[1].slice('merge-base-sha:'.length)]; + if (command === 'git' && argv[0] === 'ls-tree') return (argv.at(-1) === 'head-sha' ? trackedFiles : Object.keys(previousDocuments)).join('\0'); + if (command === 'git' && argv[0] === 'show') { + const [ref, file] = argv[1].split(':'); + const snapshot = ref === 'head-sha' ? headDocuments : previousDocuments; + assert.ok(Object.hasOwn(snapshot, file), argv[1]); + return snapshot[file]; + } if (command === 'git') return (argv[0] === 'ls-files' ? trackedFiles : files).join('\0') + '\0'; return argv.includes('.body // ""') ? body : labels; }, @@ -210,7 +215,7 @@ test('GIVEN missing or unterminated context front matter WHEN checked THEN it fa test('GIVEN an inventory-only context WHEN covers is empty THEN it is valid but covers nothing', () => { const result = checkDocs({ files: ['main.js', '.ai/contexts/README.md'], labels: [], trackedFiles: ['main.js', '.ai/contexts/README.md'], documents: { '.ai/contexts/README.md': '---\ncovers: []\n---\n# Index' } }); - assert.equal(result.ok, true); + assert.equal(result.ok, false); assert.deepEqual(result.uncovered, ['main.js']); }); @@ -329,3 +334,182 @@ test('GIVEN horizontal rules in the body WHEN their enclosed prose changes THEN assert.equal(covered(['public/terminal.js', file], { documents, previousDocuments: noFront }).ok, true); assert.equal(covered(['public/terminal.js', file], { documents: { ...COVERAGE, [file]: '---\ncovers: ["public/terminal.js"]\n---\n' + noFront[file] }, previousDocuments: noFront }).ok, false, 'adding front matter above existing horizontal rules is metadata-only'); }); + +for (const hub of ['main.js', 'preload.js', 'public/app.js', 'public/file-panel.js', 'public/style.css', 'public/sidebar.js', 'public/index.html']) { + test('GIVEN hub ' + hub + ' WHEN an eligible non-owner body changes THEN it passes', () => { + const documents = { 'docs/owner.md': '---\ncovers: ["' + hub + '"]\n---\n# Owner', 'docs/other.md': '# Before' }; + const previousDocuments = { ...documents }; + documents['docs/other.md'] = '# After'; + const input = { files: [hub, 'docs/other.md'], labels: [], documents, previousDocuments, trackedFiles: [hub, ...Object.keys(documents)] }; + assert.equal(checkDocs(input).ok, true, hub + ' must accept a changed non-owner body'); + assert.equal(checkDocs({ ...input, files: [hub] }).ok, false, 'doc must be in the PR diff'); + assert.equal(checkDocs({ ...input, previousDocuments: documents }).ok, false, 'unchanged body is insufficient'); + assert.equal(checkDocs({ ...input, files: [hub, 'docs/owner.md'], documents: { ...documents, 'docs/owner.md': documents['docs/owner.md'] + '\nBehavior changed.' } }).ok, true); + }); +} + +for (const doc of ['docs/decisions/0001.md', 'docs/product/GLOSSARY.md', '.ai/contexts/_issues.md', '.ai/contexts/README.md', 'docs/README.md', 'README.md']) { + test('GIVEN uncovered code WHEN only ineligible ' + doc + ' changes THEN fallback fails', () => { + assert.equal(checkDocs({ files: ['new-service.js', doc], labels: [], documents: { [doc]: '# Updated' } }).ok, false, 'ineligible docs must not satisfy uncovered files'); + }); +} + +for (const glob of ['s*', 'main*.js']) { + test('GIVEN root glob ' + glob + ' WHEN validating THEN exact paths are required', () => { + const result = checkDocs({ files: [], labels: [], trackedFiles: ['service.js', 'main.js'], documents: { 'docs/a.md': '---\ncovers: ["' + glob + '"]\n---\n# A' } }); + assert.equal(result.ok, false, 'root globs must fail validation'); + }); +} + +for (const change of ['\n', ' ', '\t', '\n \t\n']) { + test('GIVEN whitespace-only body change ' + JSON.stringify(change) + ' WHEN checking an owner THEN it fails', () => { + const documents = { ...COVERAGE, 'docs/terminal.md': COVERAGE['docs/terminal.md'] + change }; + assert.equal(covered(['public/terminal.js', 'docs/terminal.md'], { documents, previousDocuments: COVERAGE }).ok, false, 'whitespace alone must not satisfy coverage'); + }); +} + +test('GIVEN a merge checkout with main-only prose WHEN PR head changes only metadata THEN CLI fails', () => { + const options = { files: ['public/terminal.js', 'docs/terminal.md'], trackedFiles: TRACKED, + previousDocuments: { ...COVERAGE, 'docs/terminal.md': COVERAGE['docs/terminal.md'].replace('public/terminal*.js', 'public/terminal.js') }, + headDocuments: COVERAGE, documents: { ...COVERAGE, 'docs/terminal.md': COVERAGE['docs/terminal.md'] + '\nProse landed on main.' } }; + const result = runCli([...REFS, '--labels', '[]'], options); + assert.equal(result.code, 1, 'merge-only prose must not satisfy PR-head coverage'); + assert.equal(runCli([...REFS, '--labels', '[]'], { ...options, headDocuments: { ...COVERAGE, 'docs/terminal.md': COVERAGE['docs/terminal.md'] + '\nPR behavior.' } }).code, 0); +}); + +test('GIVEN main.js WHEN ADR whitespace or ipc-bridge metadata alone changes THEN it fails', () => { + const adr = 'docs/decisions/0001.md'; + const doc = '.ai/contexts/ipc-bridge.md'; + const previousDocuments = { [adr]: '# ADR', [doc]: '---\ncovers: ["main.js"]\n---\n# Bridge' }; + const documents = { [adr]: '# ADR\n', [doc]: previousDocuments[doc].replace('["main.js"]', '["main.js", "preload.js"]') }; + for (const changed of [adr, doc]) { + assert.equal(checkDocs({ files: ['main.js', changed], labels: [], documents, previousDocuments, trackedFiles: ['main.js', 'preload.js', adr, doc] }).ok, false, changed); + } + assert.equal(checkDocs({ files: ['main.js', doc], labels: [], documents: { [doc]: '---\ncovers: []\n---\n# Bridge\n' }, previousDocuments: { [doc]: '---\ncovers: []\n---\n# Bridge' }, trackedFiles: ['main.js', doc] }).ok, false); +}); + +test("GIVEN app-dialogs WHEN checking documented public/choice-dialog.js THEN ownership is declared", () => { + const doc = ".ai/contexts/app-dialogs.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("public/choice-dialog.js"), "public/choice-dialog.js must be covered by app-dialogs"); +}); + +test("GIVEN app-dialogs WHEN checking documented public/resume-guard.js THEN ownership is declared", () => { + const doc = ".ai/contexts/app-dialogs.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("public/resume-guard.js"), "public/resume-guard.js must be covered by app-dialogs"); +}); + +test("GIVEN bg-agents WHEN checking documented claude-binary.js THEN ownership is declared", () => { + const doc = ".ai/contexts/bg-agents.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("claude-binary.js"), "claude-binary.js must be covered by bg-agents"); +}); + +test("GIVEN bg-agents WHEN checking documented delete-session-guard.js THEN ownership is declared", () => { + const doc = ".ai/contexts/bg-agents.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("delete-session-guard.js"), "delete-session-guard.js must be covered by bg-agents"); +}); + +test("GIVEN bg-agents WHEN checking documented public/resume-guard.js THEN ownership is declared", () => { + const doc = ".ai/contexts/bg-agents.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("public/resume-guard.js"), "public/resume-guard.js must be covered by bg-agents"); +}); + +test("GIVEN trigger-watcher WHEN checking documented src/main/terminals/terminal-input.js THEN ownership is declared", () => { + const doc = ".ai/contexts/trigger-watcher.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("src/main/terminals/terminal-input.js"), "src/main/terminals/terminal-input.js must be covered by trigger-watcher"); +}); + +test("GIVEN trigger-watcher WHEN checking documented src/main/terminals/stop-session.js THEN ownership is declared", () => { + const doc = ".ai/contexts/trigger-watcher.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("src/main/terminals/stop-session.js"), "src/main/terminals/stop-session.js must be covered by trigger-watcher"); +}); + +test("GIVEN trigger-watcher WHEN checking documented src/main/terminals/input-attach.js THEN ownership is declared", () => { + const doc = ".ai/contexts/trigger-watcher.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("src/main/terminals/input-attach.js"), "src/main/terminals/input-attach.js must be covered by trigger-watcher"); +}); + +test("GIVEN ipc-bridge WHEN checking documented claude-auth.js THEN ownership is declared", () => { + const doc = ".ai/contexts/ipc-bridge.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("claude-auth.js"), "claude-auth.js must be covered by ipc-bridge"); +}); + +test("GIVEN ipc-bridge WHEN checking documented delete-session-target.js THEN ownership is declared", () => { + const doc = ".ai/contexts/ipc-bridge.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("delete-session-target.js"), "delete-session-target.js must be covered by ipc-bridge"); +}); + +test("GIVEN ipc-bridge WHEN checking documented public/utils.js THEN ownership is declared", () => { + const doc = ".ai/contexts/ipc-bridge.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("public/utils.js"), "public/utils.js must be covered by ipc-bridge"); +}); + +test("GIVEN ipc-bridge WHEN checking documented src/main/terminals/stop-process-tree.js THEN ownership is declared", () => { + const doc = ".ai/contexts/ipc-bridge.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("src/main/terminals/stop-process-tree.js"), "src/main/terminals/stop-process-tree.js must be covered by ipc-bridge"); +}); + +test("GIVEN ipc-bridge WHEN checking documented public/session-projection-diagnostics.js THEN ownership is declared", () => { + const doc = ".ai/contexts/ipc-bridge.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("public/session-projection-diagnostics.js"), "public/session-projection-diagnostics.js must be covered by ipc-bridge"); +}); + +test("GIVEN session-cache WHEN checking documented conversation-meta.js THEN ownership is declared", () => { + const doc = ".ai/contexts/session-cache.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("conversation-meta.js"), "conversation-meta.js must be covered by session-cache"); +}); + +test("GIVEN session-cache WHEN checking documented public/bridge-url.js THEN ownership is declared", () => { + const doc = ".ai/contexts/session-cache.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("public/bridge-url.js"), "public/bridge-url.js must be covered by session-cache"); +}); + +test("GIVEN session-cache WHEN checking documented src/main/session-index/read-counters.js THEN ownership is declared", () => { + const doc = ".ai/contexts/session-cache.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("src/main/session-index/read-counters.js"), "src/main/session-index/read-counters.js must be covered by session-cache"); +}); + +test("GIVEN session-cache WHEN checking documented src/main/app/main-loop-monitor.js THEN ownership is declared", () => { + const doc = ".ai/contexts/session-cache.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("src/main/app/main-loop-monitor.js"), "src/main/app/main-loop-monitor.js must be covered by session-cache"); +}); + +test("GIVEN schedule-runner WHEN checking documented src/main/shared/normalize-project-path.js THEN ownership is declared", () => { + const doc = ".ai/contexts/schedule-runner.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("src/main/shared/normalize-project-path.js"), "src/main/shared/normalize-project-path.js must be covered by schedule-runner"); +}); + +test("GIVEN session-state WHEN checking documented public/index.html THEN ownership is declared", () => { + const doc = ".ai/contexts/session-state.md"; + const result = checkDocs({ files: [], labels: [], trackedFiles: realFiles, documents: { [doc]: realDocuments[doc] } }); + assert.ok(!result.uncovered.includes("public/index.html"), "public/index.html must be covered by session-state"); +}); + +test('GIVEN replay dd7afe72 WHEN checking current owners THEN its documentation is accepted', () => { + const files = [".ai/contexts/app-dialogs.md",".ai/contexts/window-frame.md","CHANGELOG.md","docs/background-agents.md","docs/session-restore.md","public/app.js","public/file-panel.js","test/dom-file-panel-unsaved-guard.test.js","test/dom-ui-notice-log.test.js"]; + const result = checkDocs({ files, labels: [], documents: realDocuments, trackedFiles: realFiles }); + assert.equal(result.ok, true, result.message); +}); + +test('GIVEN replay 3f382b5f WHEN checking current owners THEN its documentation is accepted', () => { + const files = [".ai/contexts/app-dialogs.md",".ai/contexts/bg-agents.md","CHANGELOG.md","public/app.js","public/resume-guard.js","test/attach-resume-wording.test.js","test/detach-undo.test.js","test/resume-guard-live.test.js","test/schedule-live-resume.test.js","test/send-to-background-renderer.test.js"]; + const result = checkDocs({ files, labels: [], documents: realDocuments, trackedFiles: realFiles }); + assert.equal(result.ok, true, result.message); +}); From 4d2da104bd57dd87c9686a6573bba9b4666a0686 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Sun, 29 Nov 2026 03:13:19 +0100 Subject: [PATCH 4/6] (docs): require a body change for uncovered files and restore five owners --- .ai/contexts/ipc-bridge.md | 3 +++ .ai/contexts/session-cache.md | 1 + .ai/contexts/subagent-observability.md | 1 + scripts/check-docs.js | 3 +-- test/check-docs.test.js | 11 ++++++++++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/.ai/contexts/ipc-bridge.md b/.ai/contexts/ipc-bridge.md index f8703a384..e9b3d993a 100644 --- a/.ai/contexts/ipc-bridge.md +++ b/.ai/contexts/ipc-bridge.md @@ -18,6 +18,9 @@ covers: - "src/main/terminals/pre-launch-cmd-guard.js" - "src/main/terminals/pty-ops.js" - "src/main/triggers/trigger-renderer-bridge.js" + - "src/main/terminals/windows-job-helper.js" + - "src/main/shared/clean-env.js" + - "worktree-delete.js" --- # Context: ipc-bridge diff --git a/.ai/contexts/session-cache.md b/.ai/contexts/session-cache.md index d8fd9f4e4..64cd64c72 100644 --- a/.ai/contexts/session-cache.md +++ b/.ai/contexts/session-cache.md @@ -43,6 +43,7 @@ covers: - "workers/scan-projects.js" - "workers/scan-session-titles.js" - "workers/search-query.js" + - "session-index-commands.js" --- # Context: session-cache diff --git a/.ai/contexts/subagent-observability.md b/.ai/contexts/subagent-observability.md index c0ae56681..adb0f038f 100644 --- a/.ai/contexts/subagent-observability.md +++ b/.ai/contexts/subagent-observability.md @@ -11,6 +11,7 @@ covers: - "task-records.js" - "task-transcript-reader.js" - "workers/task-records.js" + - "session-transitions.js" --- # Context: subagent-observability diff --git a/scripts/check-docs.js b/scripts/check-docs.js index 3603681d5..fe7fd9d8f 100644 --- a/scripts/check-docs.js +++ b/scripts/check-docs.js @@ -85,7 +85,6 @@ function checkDocs({ files, labels, body = '', documents = {}, previousDocuments const report = ['Uncovered app files (' + uncovered.length + '), advisory:', ...uncovered.map(file => ' ' + file)]; const changedBody = doc => Object.hasOwn(documents, doc) && docBody(documents[doc]).replace(/\s/g, '') !== docBody(previousDocuments[doc]).replace(/\s/g, ''); - const hasDocs = files.some(file => isCoverageDoc(file) && trackedFiles.includes(file)); const hasChangedCoverageDoc = files.some(file => isCoverageDoc(file) && trackedFiles.includes(file) && changedBody(file)); const reason = body.split(/\r?\n/).some(line => { const match = line.match(/^[ \t]*(?:[-*+][ \t]+)?no docs:[ \t]*(\S.*)$/i); @@ -95,7 +94,7 @@ function checkDocs({ files, labels, body = '', documents = {}, previousDocuments const missing = files.filter(isAppPath).filter(file => { if (HUB_FILES.has(file)) return !hasChangedCoverageDoc; const docs = covering(file); - return docs.length ? !docs.some(doc => files.includes(doc) && changedBody(doc)) : !hasDocs; + return docs.length ? !docs.some(doc => files.includes(doc) && changedBody(doc)) : !hasChangedCoverageDoc; }); if (errors.length) return { ok: false, uncovered, message: [...errors, ...report].join('\n') }; if (!waived && missing.length) { diff --git a/test/check-docs.test.js b/test/check-docs.test.js index fd18928a3..b4e0e727c 100644 --- a/test/check-docs.test.js +++ b/test/check-docs.test.js @@ -33,7 +33,8 @@ test('test-only, CI-only, tooling-only and docs-only PRs pass', () => { test('any accepted documentation path satisfies the fallback for uncovered app files', () => { for (const file of ['docs/guide.md', 'docs/nested/guide.md', '.ai/contexts/cli.md']) { - assert.equal(checkDocs({ files: ['new-service.js', file], labels: [] }).ok, true, file); + assert.equal(checkDocs({ files: ['new-service.js', file], labels: [], trackedFiles: ['new-service.js', file, 'other.js'], + documents: { [file]: '---\ncovers: ["other.js"]\n---\n# Guide\nNew section.' } }).ok, true, file); } }); @@ -354,6 +355,14 @@ for (const doc of ['docs/decisions/0001.md', 'docs/product/GLOSSARY.md', '.ai/co }); } +test('GIVEN uncovered code WHEN a coverage doc changes only its front matter THEN fallback fails', () => { + const before = '---\ncovers: ["docs-only.js"]\n---\n# Guide\nBody.'; + const after = '---\ncovers: ["docs-only.js", "other.js"]\n---\n# Guide\nBody.'; + const result = checkDocs({ files: ['new-service.js', 'docs/guide.md'], labels: [], trackedFiles: ['new-service.js', 'docs/guide.md', 'docs-only.js', 'other.js'], + documents: { 'docs/guide.md': after }, previousDocuments: { 'docs/guide.md': before } }); + assert.equal(result.ok, false, 'metadata alone must not satisfy uncovered files'); +}); + for (const glob of ['s*', 'main*.js']) { test('GIVEN root glob ' + glob + ' WHEN validating THEN exact paths are required', () => { const result = checkDocs({ files: [], labels: [], trackedFiles: ['service.js', 'main.js'], documents: { 'docs/a.md': '---\ncovers: ["' + glob + '"]\n---\n# A' } }); From bcd65f2ce0c3ab1db57dbf89efe9db2466e6dcce Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Date: Sun, 29 Nov 2026 03:20:34 +0100 Subject: [PATCH 5/6] (docs): compare renamed or copied docs to their source and ignore invisible characters --- scripts/check-docs.js | 12 +++++++++--- test/check-docs.test.js | Bin 33956 -> 36167 bytes 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/scripts/check-docs.js b/scripts/check-docs.js index fe7fd9d8f..b42d55859 100644 --- a/scripts/check-docs.js +++ b/scripts/check-docs.js @@ -84,7 +84,7 @@ function checkDocs({ files, labels, body = '', documents = {}, previousDocuments const uncovered = [...new Set([...trackedFiles, ...files])].filter(isAppPath).filter(file => covering(file).length === 0); const report = ['Uncovered app files (' + uncovered.length + '), advisory:', ...uncovered.map(file => ' ' + file)]; const changedBody = doc => Object.hasOwn(documents, doc) - && docBody(documents[doc]).replace(/\s/g, '') !== docBody(previousDocuments[doc]).replace(/\s/g, ''); + && docBody(documents[doc]).replace(/[\s\p{Cc}\p{Cf}]/gu, '') !== docBody(previousDocuments[doc]).replace(/[\s\p{Cc}\p{Cf}]/gu, ''); const hasChangedCoverageDoc = files.some(file => isCoverageDoc(file) && trackedFiles.includes(file) && changedBody(file)); const reason = body.split(/\r?\n/).some(line => { const match = line.match(/^[ \t]*(?:[-*+][ \t]+)?no docs:[ \t]*(\S.*)$/i); @@ -150,8 +150,14 @@ if (require.main === module) { ? execFileSync('gh', ['api', `repos/${opts.repo}/pulls/${opts.pr}`, '--jq', '.body // ""'], { encoding: 'utf8' }) : ''; const base = execFileSync('git', ['merge-base', opts.base, opts.head], { cwd: root, encoding: 'utf8' }).trim(); const baseFiles = new Set(execFileSync('git', ['ls-tree', '-r', '--name-only', '-z', base], { cwd: root, encoding: 'utf8' }).split('\0')); - const previousDocuments = Object.fromEntries(files.filter(file => isCoverageDoc(file) && baseFiles.has(file)) - .map(file => [file, execFileSync('git', ['show', base + ':' + file], { cwd: root, encoding: 'utf8' })])); + const status = execFileSync('git', ['diff', '--name-status', '-M', '-C', '--find-copies-harder', '-z', `${opts.base}...${opts.head}`], { encoding: 'utf8' }).split(''); + const sources = new Map(); + for (let i = 0; i < status.length - 1;) { + if (/^[RC]/.test(status[i])) { sources.set(status[i + 2], status[i + 1]); i += 3; } else i += 2; + } + const source = file => sources.get(file) || file; + const previousDocuments = Object.fromEntries(files.filter(file => isCoverageDoc(file) && baseFiles.has(source(file))) + .map(file => [file, execFileSync('git', ['show', base + ':' + source(file)], { cwd: root, encoding: 'utf8' })])); result = checkDocs({ files, labels, body, documents, previousDocuments, trackedFiles }); } console.log(result.message); diff --git a/test/check-docs.test.js b/test/check-docs.test.js index b4e0e727ccc323ff63761b4b9a683e2daf00f6cd..1f710e97b3712a06421c616a0ec39e78b7611377 100644 GIT binary patch delta 4854 zcmZ`-drX_x6(4VG@B^?h4`VJd;lp4X8OIs%zS<*-P4{HQ82GU8Ae|tAT(Q=R_mE)?vt~AZ-oA($R zWH6b87r>dMMx+CI`QR^+!beF`nM}&qs!Y0y7`)}nq;5R#N*+S`&170%Pwqo%<#M1U zr7;eDPs${okrua8S|g~z)FZgMoa&3in$p}nb`+ExAw{^!S|%o)ELKafgw4oxb_Dz`}yl?`EsGcVgAR zPRQVrRHY${T>*b6%mPc{#icOMfgXBCx(zS+TuOd2WHce2$*4s7P{ttA=Q1_$Sw=0c zEScox=Q2(3NaoNfx6kY4SXmi!24|MdKEG>z$?XZ1b0!n1V+w_x;iV8~FtDH}ycG1~ zFJ4Xaf^)IFeB2uhEErih;4m;-6XS-g7R%Q-R>^1|e{uXrI3O$y=DC2+U(Rt9E5`r$ z;8&RsM6_9#rQ_;8nFZ-HvVBM;@`j2il0_8=`JIcQ*+6)lGQ+VcX_ZXU!oBidWPD5B zAQ2c>jWSRv$n0Ll6a_{u*TTyRh8rL7G+ns^*Nw`2qz9A){Du;97k;d4M*5+$S4VCP(x&T-AtL;eNR+k|agk?s!^rFDwT&hfS z^DcNICj0WY0U(lU(rwnUmaBe%abLOV<17JO|B;RK;G`?jwaVR zKOZtH}=utf@hK>hC9dkLKf-mZ?18sp$)Tp_D zGCqbo~6 zA?Td^VuxVsPfK->u2;bAZ58lFaVCO(Uwn$s)Wd8Xze-lHJC;h|xLplwJQZ#*CGK7y zVSN6w5~>PTQUZ6Bs6;nYllCgmZfg;@o!dtEZ3Dc&trHc&GDoFzz@{f35S(s! zM6VTDexVQJk)VVDSJy`h)55_ezU^<6QjyT*pOL0B*lnwt&>i1*5^Aw42~kD}ztD8a$w{DJ}&Lm0Ly52g^Np^l3Sz zZ>NEDde~q?`a45g8gC@yz*><5RTUiW(i65;L5cB2EeG#Z;EPC)8L&zzu7u}HsdAbZ z+*Q#ujlN*6O3JXSmDEA#!5B=%e@jL1{-iX?fz52e82{otYxE(uWTgxr90`C)3w{%o z?L`yy&}bAlO3PudIYYE)%sjctmI8k=_fU6Cs58Tp6WQReB1Jb!tCY@zb0Lm;M^wS5 zs_wueqlKPrp-w8`l7*V3_*DvvO)@$5N3$#7_6WrY0V}yJT4=YdBa!S#7_U}~Q0fBF ztDu^|@<0uBqhHsMMol{&MEcr}9zLk@wWotGimyiAVinFtQqgczUC^7+!3eNyOTf zHj*Bb_B@zqJg~VcfIl}#dD~+9o%t`wZ zp0+|p|0|;NUhV7zHb4opI6z7G`oOYq?I*oD@D3_)YiZDk^ui$JE|&X4^(q+Mw=?oF zq=t>540vH5B@mqsO-C1Wawbk~Hv9x0Um2!BRcIaC;qddtb z$KL(fpc$DLdVmJbk96X}^^pTbn*kKwqx~I2_MZOMzRC81Hf964j=?pZ9BjID`(gi{ zfcv4sQ-s zMPT(T)_R!g*VvLg zsd3X_INMkT(@8m4s#FkTq51!ow&<_tPrVH_P5hdl7=Xc0)qE8$;eZNzCR_*q2( zywW6B$2tRpA_RiGg54%pzU6cktV!i+&gWnDg?!WV9`TkC92(=`z3vR?8ZE+8jrWO$rldq#yz1qJ}TDsMF$N8s)=%>jT2PFH+mV| zH$m;;m5EiPU6VBNP$8~Qp67=IY-N!@3?Jh> zC$>T?@PVsOgza{dN?EQVcw>foQ&f@xCIe{@@-)RlEpRQMfG@r2@E_0i|HF3EJG_-8 za5QaGk@#CIaNq1+5q@pUq1!HZxD& zB{R25ZiGwo3V3%R2D%=$g2PYG9Ko*~rH&ixl|7K;F)j<+**p69$HT9 zfRoEn$%>V1WE9Q3_t-wsOoCDr^X{mQNZ$&#;0gX0!SNW~TTa;E;_ihhoL@qsxB* DaQZst delta 3155 zcmaJ@eNdD49Y2V?Bmt5T0wILtfrNyRkOT-X5J-nHkn?SHPlR^4uQ(_3d}>$a}8ws+pvyT0z5Cy!a!ddolgKELnh z`||sIU!LdMQ_(*?5uK!;pLH{{bAIp0oZc>26KmFNX0>3%H#IxQcxIVO#_yh)_xjzr z`YGS2yWBIYH`v#XYSu2Q*RB<=eN`4EKyg$P0#R0yUXB`oFnVBMz^*YV zzUC*OnqP+_3MtOp;sv z`tfse9%cNjBH7?fW-!n_DdK3zrk;d=} zNxs8NhgHGQSzfT!0#v{vdXVBRnG*LD$($_3V6j%h1Pta8YF!gUrYt&mtsiBm=}N)u zD!91G%0bL1J-DT8gErH)u1beL(-{1FEmIQw`!F+eU9|<(sxmC8Jot;M0-5Rx45*Db zrY={o#BhUC*VWhHsA+1TemEdt;B(9HP+bNS(;rQbSBvC$mMII0J-QTp#)zplc0^}6 zF`VVWwX8!_qn7NQm|2lxi;j;E^dj8MRuWNZ80PU=W;LY*y31qW)ueDYSk>%8PnQLM z)ruj`5y7g>;xs$7eWWqqwzd&WP9=-#9*o7kBC*6^_U$z>bN+c6%2097^rzu^j*|;- zV8b5P38=Uk7_%ngk}j8v{jE+3v8DiR`XnxrOYe$EyO8Rd0$pw)ryb7q;b!h6sto>6 z;d;9A@m@UxULF;Yl8}UX5b{f0!OJgNIG1kFss%AIIIg^d%UV-uQL_9QU zf?Eald;#@^2HyO{h}k`wKZp#XrlmJQ@aw z(iBuvIZB4q@Nd?!c0b!(kM9SB$ml31TLCJ{r5xQQM0FlZUhrB1+$tXskeAR}9L1>; z6?WPeD2=wQ3Ouk6(5B77RD~Hosj%aAg`S?rxb$Z#{e=6>p#raJ3=>rqRDU@vTNLvYt{G>S%6m0Js+|g7)`Xg`s&<6s z_+IS{=fPQLq-#p>RNW40#17oAmtiSS0c&0?7V4jmxSpl9+yu@|2>tjO4E zLi5(s^lDThqf&yHZ5EPMF!stYw$04R0=&7cgOkriq;;eBIo9i;zFz967`S7Lkl4R3 z0&%8)FTUw-Lj86JJ5^V=FH`C_OldeN6JltGof||N&K*UYf}@10p*+^<;!r2s-U-8_ zm>F(@z?qFZ!zxyn;PSF9e8kmHHMXF0FcqrZo`}F}yQenvQS(SD_0eg3K5}A1AN_H( zjOzXhN7FlQH>{rE`g^8biBpS-Jo;#2yZC~q4*&23uxF2shzNdl5Gi{Cp*0u!;JD5? zxjDWWd%eXt@6D$>@5l5JEB23fhP9I$G;dE=;qv&S{rX_iil--v@w*8lXKTRu$p+5$ z!Q{jSjnTI?tg%8Jh{IK%EdpW1+taNa;!}SMUi2qp-;9>xXX5pllyHRVIVtHR__4n$ zj1K$&$`{tQtk2ti03cnT7a@ON2ZwuZsQ{Pu6=7!46pr=!LT!XrH6_B-k^t?C+6^e9 zFL=(!z*1Eh?T$cLacBRdFN$E4H&*#@9;k~z7*IVY$HV~)Ue9E8;G)ADT^qd9H z@}ufpS)N4AiY1)wcZYho_*a%~EW_)E3nLKwBeZX<3SfP#HbNWBfsgK^QyWlx)UT#P zxuX3aq-u3HhdjQzLRy-`W72RgL0_L9o8u5;kJCb2$q~%Xx#ryF$$Ll%J jSI0e Date: Sun, 29 Nov 2026 03:26:47 +0100 Subject: [PATCH 6/6] (docs): treat a doc moved as delete plus add as unchanged when its text is --- scripts/check-docs.js | 8 +++++--- test/check-docs.test.js | Bin 36167 -> 36441 bytes 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/check-docs.js b/scripts/check-docs.js index b42d55859..56cfbda9a 100644 --- a/scripts/check-docs.js +++ b/scripts/check-docs.js @@ -83,8 +83,10 @@ function checkDocs({ files, labels, body = '', documents = {}, previousDocuments const covering = file => [...coverage].filter(([, patterns]) => patterns.some(pattern => pattern.test(file))).map(([doc]) => doc); const uncovered = [...new Set([...trackedFiles, ...files])].filter(isAppPath).filter(file => covering(file).length === 0); const report = ['Uncovered app files (' + uncovered.length + '), advisory:', ...uncovered.map(file => ' ' + file)]; - const changedBody = doc => Object.hasOwn(documents, doc) - && docBody(documents[doc]).replace(/[\s\p{Cc}\p{Cf}]/gu, '') !== docBody(previousDocuments[doc]).replace(/[\s\p{Cc}\p{Cf}]/gu, ''); + const visible = text => docBody(text).replace(/[\s\p{Cc}\p{Cf}]/gu, ''); + const movedBodies = new Set(Object.keys(previousDocuments).filter(doc => !Object.hasOwn(documents, doc)).map(doc => visible(previousDocuments[doc]))); + const changedBody = doc => Object.hasOwn(documents, doc) && visible(documents[doc]) !== visible(previousDocuments[doc]) + && (Object.hasOwn(previousDocuments, doc) || !movedBodies.has(visible(documents[doc]))); const hasChangedCoverageDoc = files.some(file => isCoverageDoc(file) && trackedFiles.includes(file) && changedBody(file)); const reason = body.split(/\r?\n/).some(line => { const match = line.match(/^[ \t]*(?:[-*+][ \t]+)?no docs:[ \t]*(\S.*)$/i); @@ -150,7 +152,7 @@ if (require.main === module) { ? execFileSync('gh', ['api', `repos/${opts.repo}/pulls/${opts.pr}`, '--jq', '.body // ""'], { encoding: 'utf8' }) : ''; const base = execFileSync('git', ['merge-base', opts.base, opts.head], { cwd: root, encoding: 'utf8' }).trim(); const baseFiles = new Set(execFileSync('git', ['ls-tree', '-r', '--name-only', '-z', base], { cwd: root, encoding: 'utf8' }).split('\0')); - const status = execFileSync('git', ['diff', '--name-status', '-M', '-C', '--find-copies-harder', '-z', `${opts.base}...${opts.head}`], { encoding: 'utf8' }).split(''); + const status = execFileSync('git', ['diff', '--name-status', '-M', '-C', '--find-copies-harder', '-z', `${opts.base}...${opts.head}`], { encoding: 'utf8' }).split('\0'); const sources = new Map(); for (let i = 0; i < status.length - 1;) { if (/^[RC]/.test(status[i])) { sources.set(status[i + 2], status[i + 1]); i += 3; } else i += 2; diff --git a/test/check-docs.test.js b/test/check-docs.test.js index 1f710e97b3712a06421c616a0ec39e78b7611377..b9b9d846e5ec9250c4bc4c1ba96718a77c282ad3 100644 GIT binary patch delta 3697 zcmaJ^drVvB6&E-VZ1b=&591j7f*l)UV+@!_Fc1jugm(xe5Ce{V4JO70+XP5rk~E=9 z7c~j|v{ZepYAUtargiO_O0Bx4?H`l6R&A0^lh$Zkwm!CXeWaDDwNsxv_xi?lwrc+8 zp6@%q^Z3p=-#MROc_8`5L&=%O#W2f+BO#wVVsuE>Wx92{RV#4^1K|kc4Ks~Qh+SCp zh1e2fAn0N1ykUll& zqg84}NZN#7O3nDQbO29gk7SVJE(Pj91`uVPK#1&Z#TNrOBIA>uZL8pmnY@$SP zyNsDJ?zb7~!*Rb`MS=otvd#v5ff6I-f)rlhl%|Def=fmda|A~-ZFnMc5Z`7x;K9GUqHexqo>*&H>Ba_kt%sU_M=U%kjl ze#+PyJfsw3f9?>`<+zz!lM>6hIxt{U&EvISa!iE6!^iJGi#x(619M0qrKtRHUC(vdjt z8U(x9>Ip2Uy?9f-3;II)hNb|aLNoVywouM}-YzWM&}>JurVc9_FaD}&K%uq)V_Gxr z*4C@|zzDanwST02sHL-=3hao4L6FVGr`kGLn9*cfUa3;zVWy5F2Msy+h>=l_97ry5 zVyeiCSBj2NuDXlIv2aR(?FKRaV$8zzVl@RSA5$VRA6Z>3f!-1^@ab}d6Rhd>W3ay* zf78n#+nNQNzDVHg(~l6xgd6$}Fk2gW)WAe4-mQ|!P1fK+s^-ul-SAj)&yVKg>Q<*< z-o%?dZjexNw_wJWfy;&x!S>e%HDtO9>@sEwmRv?xg4>mp*Bls1Dh2LTNf6gd=Fnsc z#S%BzUxqi@7>G(Kfkb;sZ&%o(r7Y6SLl`#?;OFK>yl-xW)zZwjrTZ*)Y9cDk)@R^T zi;iniaFj`?E_CpfWh69$lVuZlyUdAZYd=Zk;)C)GJZ&vbK)hx3k;4Y8rb%(7T!jne zEqJqhFfrD#b1Q{2oVHE!0+|(k6oqRRJ#N&g@o+^vJ~{J?2mC&Fxohui*htqX7S#7D zmf@=0K}EL%GgW&0sW=nLstjS>giBQeMAyJ-ABpwi51f_wl|4hSdfo2h>vf{KS=f2J z+Jx)Xbr9Dq$gb_?{MoaHcWR5#;mksA9jWYX$4i!UzUKy)Hsi)j7S2>C@UJ?( zh%N)N@>P^mC2A(M2yHX)azEMDhHuBD*wR~1vJy1ZD}->@P^e4!;Bm*2;LZ9m32BM- zSr5+EXfW$+Ro9MRl^x62{C);ZUx$@?DieoPF#`Ta*WZ}JLGbY_CSX*ZKrt(IMlyaxR=Pj|~ zYue%FWBl%p1wn(e)lA2f#uR6{!|MS54Ma9z@1y*C@au0~wy@*=alDvJWe&CK}RJUZBc z2fKBA$gg&f!L;*t_-dys!T#*7-}BtQo}IYA=MW|HD9zt|OwKCsY_BB&`AKgWo<5xr z(Mx^xM6I}VNbTQAF+6~0`n%{mjGRGvYV4}hvIRdIcuhFO(ZLJ6sp6plyzZ1@b?6}8 zAF^S~ZVS40pQAae#+F7oQijWk*1)_c7c;|FftKK<;a-8hFTt&AdmiDn9vj(16_o-u zwF()dhY}FyM-Sqw(N47O9pZ1*mA$Lv`ZY^F&g4olxz8b7M7o^&s$#xg{`bDmlG1Ju zu5bFN5)#N9Klz%(0XhB-)NhGklNx*4y_=MNh#ObI{xsk!sT z-$6pWu|{UNeWp7 zpgUY1^n1|a&c(KgLIlS%acrDP;SJ&9gch%j=ZhE`95U99Yb|LyVa!#Kw2RlxO#32? zCrD=q1S1R=036@XXk*tk#4d$=bkG1dq!_E!8k~>#=nZMX>UdFM>^R(`CeX(&F=5ut zF|9@>Dp>4_%ikWawzyr2a?s5z`64q+fP^FLa)b%HBEGQKN51f3a80xH65?9pHO?+)i0Dbpx24Ctt@x)mis@+sRW|n~ zr7E9}#^zS+IeJx4a(#9i4*IHb(N{)Ad>Hd5Y&bmI7w691!FhGQ3D3{o9+QnmvL2A|x2*}fGr-)09^=?Jn7f#oQcSi)o%nxY7o!TnlIv;DD v^AtM-pbft`-6nv(IPJacx<{NuEczE#@ZSSTKuOPd;ku^@Po4Sv{{sI5ica2m delta 4107 zcmaJ^drX_x6(3K>Ha31?Y#!zV48~w=UI__cOn5^A0URDnLwK410ZhOSNhlAuNmCe6 zfTMQlmaMF;GPPNyc2TEpof^yQcDcg*sBLT@YEq_SdY7UZr z><&Q?WCT?ONnk7}i(S1MbO={V0u4k3mm=31Y)AS=a3RvEjx>;jq|tt-UeGr%GacX%bPWF{5d3U3b3$rSXmI;}`Q7gTt) zN(Pj0WJhWM_WX|8V2KEpnzT@ifE&UHkO|9B#V(}SkYgnSa+Ie9D1I&cm5C15;~W`x zF+E*FL*tBe3dee(YB{VZWDE16q8)V?O7cPoU~7wpkv<{pQ%0h6))EW1 z)M0R1S%fRADh@tUk_X```nFZo$MX8nc2b=w*FZyT1U$%AEJrX7qIuYvByK%*RI2>M4D{#eqI0m^d)OARAMW-U=3`W6RbTV)3?P#j^g_2$H zAC(x&HKfED6R;wJ)s^$o8>$KDsgW5!-OPyLgaCm4A9pO#w9 z*W=1rss(Gj+{+z}kN0wy<0%g7aa#COJemC_p4Hb;dM>l{6CIU(XhH#&0yh^#ToaWY zXsKx0TUCJ_Gl?gI#F8i&PM}f6z$Lu~t|wSo{=Qxf&5a7U-WD(2JLGbVjdZyj2I@v= zG^n7Lk%ggU4AunG&dsMqLoD>@6>vzO4(7xN{Cq*;3|m`2Poz5Vn3eE@6d`=7kA?k7 zGL+cbm{5$j2;S1F*xBNIs#YgIX(qU9t(`UhCvW*vCPi|qwMkv--qD$CX zcqS!$Ur!-g(>G#Mc>@56&1x{GP@QwW7?HEJ#R^gGeKI$K$DTG zi&j4|`nAa4jSdtyrBiLcmQFM5pXpYl*%@Wtvo>Tz!-b3#ludOQ;j;`fBQw<^#Y+UH zO(Nuccg0m4{1hSnu2?fs`6XmhOt|}D2Rt|t53BiuIvO+0JCAt*=|-y( z7z@o=%q81rvzA=`;O|;GSZD^6X4SB84W#3Adn=2Q!-ZQQ>uMVuH_+_x-C&CBlej&f zO&28JL*ygBDutUi^f^a@(hqYeGW?zb?71xhwicK^IG!61i&iCKMdEC~uY8qD=is!` z;Zj}_@AohBs5I{7(L~bkBxf$|ynr-gR}EXx(+AJO*SqMdiOcWcs(*dDbSr8qSkJHH z#2!ly7e4mGG;kkus=>3H&i|v`c3yWhD+)TR!$aCJJTj93LnK=6rrxGB-rf@)VCC+f zLsXlIJu0X#m`B*10yhbkn)EPMNY~#=AzeA278*ElI%F34O+aVS818NqokQAhrMV$5 z&Vi4uq$4lB;$44HoX-a(#WsrK7i{A}l4VB>=-R`<(kX>Phdq>`L9kF_!+mb%;=828 zf~(lQ6G-{Y=->}~kMkyLOKD2EO9zosV@S*F$aR&y5^&mxa{MTo=|p z534^y{$@>=l*RZGC|VAVg8JI`aW7)uw~;#bo$#gc6vs54F@R^k_m$<-gP-oFLm2Du zm56~)fMaz9TndxnMjbWmn%)BU>Qmroy%bmOdV0EXGRhCfDPZ8h2Ydk2t1Dr;fvW#z z1GSp2M+=pW-hr&^*U8LgbFZ_7$1H9fW z2Y2fbt~Od}@Yvd#x6X3yrM7P&(#1-UhfFXU$9lfUwg4EmK_v`3ywLY{sl~>>|eI` z`$o4sh2Enym2VuSr}|e%DV~(iqW&^2pK4?!@M=F5$HRW=bnb<_$c`keIQAv{<-kqe z;@Tj2WjU6K^!UlsNE^-=Ve=Rt9#|XP1Md#Yzsqn4*on<_xOi~rz`)@hvsISyvn1QVT5jasMGmcDDpJ=L-K&!|Im~31Sq+F=NZ35 zKAOox*M-pgEd7+*Zh2+9Rf5$%r-9nD^ibIj&B2{+9{%=oXIO|1?B|roalWpfyTU`h z^E}-bo1PSinGMFbHuTb26--CuhC40*^~tple}jz8HS9 O@b4!