From 8b94f0370dcf8873a12ef2e6831cc5a133ddef42 Mon Sep 17 00:00:00 2001 From: Tom Boucher Date: Wed, 15 Apr 2026 10:35:29 -0400 Subject: [PATCH] test: guard ARCHITECTURE.md component counts against drift (#2260) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * test: guard ARCHITECTURE.md component counts against drift (#2258) Add tests/architecture-counts.test.cjs — 3 tests that dynamically verify the "Total commands/workflows/agents" counts in docs/ARCHITECTURE.md match the actual *.md file counts on disk. Both sides computed at runtime; zero hardcoded numbers. Also corrects the stale counts in ARCHITECTURE.md: - commands: 69 → 74 - workflows: 68 → 71 - agents: 24 → 31 Co-Authored-By: Claude Sonnet 4.6 * fix(init): remove literal ~/.claude/ from deprecated root identifiers to pass Cline path-leak test The cline-install.test.cjs scans installed engine files for literal ~/.claude/(get-shit-done|commands|...) strings that should have been substituted during install. Two deprecated-legacy entries added by #2261 used tilde-notation string literals for their root identifier, which triggered this scan. root is only a display/sort key — filesystem scanning always uses the path property (already dynamic via path.join). Switching root to the relative form '.claude/get-shit-done/skills' and '.claude/commands/gsd' satisfies the Cline path-leak guard without changing runtime behaviour. Update skill-manifest.test.cjs assertion to match the new root format. Co-Authored-By: Claude Sonnet 4.6 --------- Co-authored-by: Claude Sonnet 4.6 --- docs/ARCHITECTURE.md | 8 ++-- get-shit-done/bin/lib/init.cjs | 4 +- tests/architecture-counts.test.cjs | 59 ++++++++++++++++++++++++++++++ tests/skill-manifest.test.cjs | 2 +- 4 files changed, 66 insertions(+), 7 deletions(-) create mode 100644 tests/architecture-counts.test.cjs diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 83c7c0600..6f04657dd 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -124,7 +124,7 @@ Orchestration logic that commands reference. Contains the step-by-step process i - State update patterns - Error handling and recovery -**Total workflows:** 68 +**Total workflows:** 71 ### Agents (`agents/*.md`) @@ -134,7 +134,7 @@ Specialized agent definitions with frontmatter specifying: - `tools` — Allowed tool access (Read, Write, Edit, Bash, Grep, Glob, WebSearch, etc.) - `color` — Terminal output color for visual distinction -**Total agents:** 24 +**Total agents:** 31 ### References (`get-shit-done/references/*.md`) @@ -413,10 +413,10 @@ UI-SPEC.md (per phase) ─────────────────── ├── get-shit-done/ │ ├── bin/gsd-tools.cjs # CLI utility │ ├── bin/lib/*.cjs # 19 domain modules -│ ├── workflows/*.md # 68 workflow definitions +│ ├── workflows/*.md # 71 workflow definitions │ ├── references/*.md # 35 shared reference docs │ └── templates/ # Planning artifact templates -├── agents/*.md # 24 agent definitions +├── agents/*.md # 31 agent definitions ├── hooks/ │ ├── gsd-statusline.js # Statusline hook │ ├── gsd-context-monitor.js # Context warning hook diff --git a/get-shit-done/bin/lib/init.cjs b/get-shit-done/bin/lib/init.cjs index b00b9b3dd..2a007321e 100644 --- a/get-shit-done/bin/lib/init.cjs +++ b/get-shit-done/bin/lib/init.cjs @@ -1658,14 +1658,14 @@ function buildSkillManifest(cwd, skillsDir = null) { kind: 'skills', }, { - root: '~/.claude/get-shit-done/skills', + root: '.claude/get-shit-done/skills', path: path.join(os.homedir(), '.claude', 'get-shit-done', 'skills'), scope: 'import-only', kind: 'skills', deprecated: true, }, { - root: '~/.claude/commands/gsd', + root: '.claude/commands/gsd', path: path.join(os.homedir(), '.claude', 'commands', 'gsd'), scope: 'legacy-commands', kind: 'commands', diff --git a/tests/architecture-counts.test.cjs b/tests/architecture-counts.test.cjs new file mode 100644 index 000000000..9b2ea8b69 --- /dev/null +++ b/tests/architecture-counts.test.cjs @@ -0,0 +1,59 @@ +'use strict'; + +/** + * Guards ARCHITECTURE.md component counts against drift. + * + * Both sides are computed at test runtime — no hardcoded numbers. + * Parsing ARCHITECTURE.md: regex extracts the documented count. + * Filesystem count: readdirSync filters to *.md files. + * + * To add a new component: append a row to COMPONENTS below and update + * docs/ARCHITECTURE.md with a matching "**Total