From d3a79917fab48d1b13aa72d0896a52a4c5635596 Mon Sep 17 00:00:00 2001 From: Rezolv Date: Wed, 15 Apr 2026 22:46:31 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20Phase=202=20caller=20migration=20?= =?UTF-8?q?=E2=80=94=20gsd-sdk=20query=20in=20workflows,=20agents,=20comma?= =?UTF-8?q?nds=20(#2179)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * feat: Phase 2 caller migration — gsd-sdk query in workflows (#2122) Cherry-picked orchestration rewrites from feat/sdk-foundation (#2008, 4018fee) onto current main, resolving conflicts to keep upstream worktree guards and post-merge test gate. SDK stub registry omitted (out of Phase 2 scope per #2122). Refs: #2122 #2008 Made-with: Cursor * docs: add gsd-sdk query migration blurb Made-with: Cursor * docs(workflows): extend Phase 2 gsd-sdk query caller migration - Swap node gsd-tools.cjs for gsd-sdk query in review, plan-phase, execute-plan, ship, extract_learnings, ai-integration-phase, eval-review, next, thread - Document graphify CJS-only in gsd-planner; dual-path in CLI-TOOLS and ARCHITECTURE - Update tests: workstreams gsd-sdk path, thread frontmatter.get, workspace init.*, CRLF-safe autonomous frontmatter parse - CHANGELOG: Phase 2 caller migration scope Made-with: Cursor * docs(phase2): USER-GUIDE + remaining gsd-sdk query call sites - USER-GUIDE: dual-path CLI section; state validate/sync use full CJS path - Commands: debug (config-get+tdd), quick (security note), intel Task prompt - Agent: gsd-debug-session-manager resolve-model via jq - Workflows: milestone-summary, forensics, next, complete-milestone/verify-work (audit-open CJS notes), discuss-phase, progress, verify-phase, add/insert/remove phase, transition, manager, quick workflow; remove-phase commit without --files - Test: quick-session-management accepts frontmatter.get - CHANGELOG: Phase 2 follow-up bullet Made-with: Cursor * docs(phase2): align gsd-sdk query examples in commands and agents - init.* query names; frontmatter.get uses positional field name - state.* handlers use positional args; commit uses positional paths - CJS-only notes for from-gsd2 and graphify; learnings.query wording - CHANGELOG: Phase 2 orchestration doc pass Made-with: Cursor * docs(phase2): normalize gsd-sdk query commit to positional file paths - Strip --files from commit examples in workflows, references, commands - Keep commit-to-subrepo ... --files (separate handler) - git-planning-commit.md: document positional args - Tests: new-project commit line, state.record-session, gates CRLF, roadmap.analyze - CHANGELOG [Unreleased] Made-with: Cursor * feat(sdk): gsd-sdk query parity with gsd-tools and PR 2179 registry fixes - Route query via longest-prefix match and dotted single-token expansion; fall back to runGsdToolsQuery (same argv as node gsd-tools.cjs) for full CLI coverage. - Parse gsd-sdk query permissively so gsd-tools flags (--json, --verify, etc.) are not rejected by strict parseArgs. - resolveGsdToolsPath: honor GSD_TOOLS_PATH; prefer bundled get-shit-done copy over project .claude installs; export runGsdToolsQuery from the SDK. - Fix gsd-tools audit-open (core.output; pass object for --json JSON). - Register summary-extract as alias of summary.extract; fix audit-fix workflow to call audit-uat instead of invalid init.audit-uat (PR review). Updates QUERY-HANDLERS.md and CHANGELOG [Unreleased]. Made-with: Cursor * fix(sdk): Phase 2 scope — Trek-e review (#2179, #2122) - Remove gsd-sdk query passthrough to gsd-tools.cjs; drop GSD_TOOLS_PATH - Consolidate argv routing in resolveQueryArgv(); update USAGE and QUERY-HANDLERS - Surface @file: read failures in GSDTools.parseOutput - execute-plan: defer Task Commit Protocol to gsd-executor - stale-colon-refs: skip .planning/ and root CLAUDE.md (gitignored overlays) - CHANGELOG [Unreleased]: maintainer review and routing notes Made-with: Cursor --- CHANGELOG.md | 11 +- agents/gsd-code-fixer.md | 17 +-- agents/gsd-debug-session-manager.md | 2 +- agents/gsd-debugger.md | 6 +- agents/gsd-executor.md | 39 +++--- agents/gsd-intel-updater.md | 16 +-- agents/gsd-phase-researcher.md | 6 +- agents/gsd-plan-checker.md | 18 +-- agents/gsd-planner.md | 19 +-- agents/gsd-project-researcher.md | 2 +- agents/gsd-research-synthesizer.md | 4 +- agents/gsd-ui-researcher.md | 2 +- agents/gsd-verifier.md | 18 +-- commands/gsd/add-backlog.md | 6 +- commands/gsd/autonomous.md | 2 +- commands/gsd/code-review-fix.md | 2 +- commands/gsd/code-review.md | 2 +- commands/gsd/debug.md | 6 +- commands/gsd/discuss-phase.md | 2 +- commands/gsd/execute-phase.md | 2 +- commands/gsd/from-gsd2.md | 2 + commands/gsd/graphify.md | 2 + commands/gsd/intel.md | 18 +-- commands/gsd/manager.md | 2 +- commands/gsd/quick.md | 6 +- commands/gsd/research-phase.md | 6 +- commands/gsd/review-backlog.md | 4 +- commands/gsd/set-profile.md | 2 +- commands/gsd/thread.md | 20 +-- commands/gsd/workstreams.md | 14 +-- docs/ARCHITECTURE.md | 6 +- docs/CLI-TOOLS.md | 2 + docs/USER-GUIDE.md | 14 ++- docs/gsd-sdk-query-migration-blurb.md | 22 ++++ .../references/autonomous-smart-discuss.md | 6 +- .../references/decimal-phase-calculation.md | 10 +- get-shit-done/references/git-integration.md | 8 +- .../references/git-planning-commit.md | 10 +- .../references/phase-argument-parsing.md | 6 +- get-shit-done/references/planner-revision.md | 2 +- get-shit-done/references/planning-config.md | 12 +- get-shit-done/references/workstream-flag.md | 26 ++-- get-shit-done/workflows/add-phase.md | 8 +- get-shit-done/workflows/add-tests.md | 4 +- get-shit-done/workflows/add-todo.md | 6 +- .../workflows/ai-integration-phase.md | 14 +-- get-shit-done/workflows/audit-fix.md | 2 +- get-shit-done/workflows/audit-milestone.md | 14 +-- get-shit-done/workflows/audit-uat.md | 2 +- get-shit-done/workflows/autonomous.md | 28 ++--- get-shit-done/workflows/check-todos.md | 4 +- get-shit-done/workflows/cleanup.md | 2 +- get-shit-done/workflows/code-review-fix.md | 6 +- get-shit-done/workflows/code-review.md | 10 +- get-shit-done/workflows/complete-milestone.md | 24 ++-- get-shit-done/workflows/diagnose-issues.md | 6 +- .../workflows/discuss-phase-assumptions.md | 20 +-- get-shit-done/workflows/discuss-phase.md | 26 ++-- get-shit-done/workflows/do.md | 2 +- get-shit-done/workflows/docs-update.md | 6 +- get-shit-done/workflows/eval-review.md | 4 +- get-shit-done/workflows/execute-phase.md | 68 +++++------ get-shit-done/workflows/execute-plan.md | 46 ++++--- get-shit-done/workflows/explore.md | 2 +- get-shit-done/workflows/extract_learnings.md | 4 +- get-shit-done/workflows/forensics.md | 6 +- get-shit-done/workflows/health.md | 4 +- get-shit-done/workflows/import.md | 2 +- get-shit-done/workflows/insert-phase.md | 8 +- get-shit-done/workflows/list-workspaces.md | 2 +- get-shit-done/workflows/manager.md | 6 +- get-shit-done/workflows/map-codebase.md | 6 +- get-shit-done/workflows/milestone-summary.md | 12 +- get-shit-done/workflows/new-milestone.md | 16 +-- get-shit-done/workflows/new-project.md | 28 ++--- get-shit-done/workflows/new-workspace.md | 2 +- get-shit-done/workflows/next.md | 6 +- get-shit-done/workflows/pause-work.md | 6 +- .../workflows/plan-milestone-gaps.md | 4 +- get-shit-done/workflows/plan-phase.md | 54 ++++---- get-shit-done/workflows/plant-seed.md | 2 +- get-shit-done/workflows/profile-user.md | 22 ++-- get-shit-done/workflows/progress.md | 24 ++-- get-shit-done/workflows/quick.md | 22 ++-- get-shit-done/workflows/remove-phase.md | 16 +-- get-shit-done/workflows/remove-workspace.md | 2 +- get-shit-done/workflows/research-phase.md | 6 +- get-shit-done/workflows/resume-project.md | 2 +- get-shit-done/workflows/review.md | 13 +- get-shit-done/workflows/scan.md | 2 +- get-shit-done/workflows/secure-phase.md | 10 +- get-shit-done/workflows/settings.md | 4 +- get-shit-done/workflows/ship.md | 16 +-- get-shit-done/workflows/stats.md | 2 +- get-shit-done/workflows/transition.md | 18 +-- get-shit-done/workflows/ui-phase.md | 18 +-- get-shit-done/workflows/ui-review.md | 8 +- get-shit-done/workflows/validate-phase.md | 10 +- get-shit-done/workflows/verify-phase.md | 20 +-- get-shit-done/workflows/verify-work.md | 16 +-- .../agents/gsd-research-synthesizer.md | 2 +- sdk/src/cli.test.ts | 12 +- sdk/src/cli.ts | 115 +++++++++++++++--- sdk/src/gsd-tools.test.ts | 13 +- sdk/src/gsd-tools.ts | 14 ++- sdk/src/query/QUERY-HANDLERS.md | 7 ++ sdk/src/query/index.ts | 1 + sdk/src/query/registry.test.ts | 44 ++++++- sdk/src/query/registry.ts | 62 ++++++++-- tests/autonomous-allowed-tools.test.cjs | 2 +- tests/claude-md.test.cjs | 5 +- tests/forensics.test.cjs | 4 +- tests/gates-taxonomy.test.cjs | 4 +- tests/gsd-tools-path-refs.test.cjs | 22 ++-- tests/milestone-summary.test.cjs | 4 +- tests/quick-session-management.test.cjs | 4 +- tests/stale-colon-refs.test.cjs | 8 +- tests/thread-session-management.test.cjs | 4 +- tests/verifier-deferred-items.test.cjs | 4 +- tests/workspace.test.cjs | 15 ++- 120 files changed, 845 insertions(+), 586 deletions(-) create mode 100644 docs/gsd-sdk-query-migration-blurb.md diff --git a/CHANGELOG.md b/CHANGELOG.md index c0b45d640..b5bbfd13c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,7 +49,16 @@ Format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/). - **Agent specs standardization** — Standardized `required_reading` patterns across agent specs (#2176) - **CI upgrades** — GitHub Actions upgraded to Node 22+ runtimes; release pipeline fixes (#2128, #1956) - **Branch cleanup workflow** — Auto-delete on merge + weekly sweep (#2051) -- **SDK query follow-up** — Expanded mutation commands, PID-liveness lock cleanup, depth-bounded JSON search, and comprehensive unit tests +- **PR #2179 maintainer review (Trek-e)** — Scoped SDK to Phase 2 (#2122): removed `gsd-sdk query` passthrough to `gsd-tools.cjs` and `GSD_TOOLS_PATH` override; argv routing consolidated in `resolveQueryArgv()`. `GSDTools` JSON parsing now reports `@file:` indirection read failures instead of failing opaquely. `execute-plan.md` defers Task Commit Protocol to `agents/gsd-executor.md` (single source of truth). Stale `/gsd:` scan (#1748) skips `.planning/` and root `CLAUDE.md` so local gitignored overlays do not fail CI. +- **SDK query registry (PR #2179 review)** — Register `summary-extract` as an alias of `summary.extract` so workflows/agents match CJS naming. Correct `audit-fix.md` to call `audit-uat` instead of nonexistent `init.audit-uat`. +- **`gsd-tools audit-open`** — Use `core.output()` (was undefined `output()`), and pass the artifact object for `--json` so stdout is JSON (not double-stringified). +- **SDK query layer (PR review hardening)** — `commit-to-subrepo` uses realpath-aware path containment and sanitized commit messages; `state.planned-phase` uses the STATE.md lockfile; `verifyKeyLinks` mitigates ReDoS on frontmatter patterns; frontmatter handlers resolve paths under the real project root; phase directory names reject `..` and separators; `gsd-sdk` restores strict CLI parsing by stripping `--pick` before `parseArgs`; `QueryRegistry.commands()` for enumeration; `todoComplete` uses static error imports. +- **`gsd-sdk query` routing (Phase 2 scope)** — `resolveQueryArgv()` maps argv to registered handlers (longest-prefix match on dotted and spaced command keys; optional single-token dotted split). Unregistered commands are rejected at the CLI; use `node …/gsd-tools.cjs` for CJS-only subcommands. `resolveGsdToolsPath()` probes the SDK-bundled copy, then project and user `~/.claude/get-shit-done/` installs (no `GSD_TOOLS_PATH` override). Broader “CLI parity” passthrough is explicitly out of scope for #2122 and tracked separately for a future approved issue. +- **SDK query follow-up (tests, docs, registry)** — Expanded `QUERY_MUTATION_COMMANDS` for event emission; stale lock cleanup uses PID liveness (`process.kill(pid, 0)`) when a lock file exists; `searchJsonEntries` is depth-bounded (`MAX_JSON_SEARCH_DEPTH`); removed unnecessary `readdirSync`/`Dirent` casts across query handlers; added `sdk/src/query/QUERY-HANDLERS.md` (error vs `{ data.error }`, mutations, locks, intel limits); unit tests for intel, profile, uat, skills, summary, websearch, workstream, registry vs `QUERY_MUTATION_COMMANDS`, and frontmatter extract/splice round-trip. +- **Phase 2 caller migration (#2122)** — Workflows, agents, and commands prefer `gsd-sdk query` for registered handlers; extended migration to additional orchestration call sites (review, plan-phase, execute-plan, ship, extract_learnings, ai-integration-phase, eval-review, next, profile-user, autonomous, thread command) and researcher agents; dual-path and CJS-only exceptions documented in `docs/CLI-TOOLS.md` and `docs/ARCHITECTURE.md`; relaxed `tests/gsd-tools-path-refs.test.cjs` so `commands/gsd/workstreams.md` may document `gsd-sdk query` without `node` + `gsd-tools.cjs`. CJS `gsd-tools.cjs` remains on disk; graphify and other non-registry commands stay on CJS until registered. (#2008) +- **Phase 2 docs and call sites (follow-up)** — `docs/USER-GUIDE.md` now explains `gsd-sdk query` vs legacy CJS and lists CJS-only commands (`state validate`/`sync`, `audit-open`, `graphify`, `from-gsd2`). Updated `commands/gsd` (`debug`, `quick`, `intel`), `agents/gsd-debug-session-manager.md`, and workflows (`milestone-summary`, `forensics`, `next`, `complete-milestone`, `verify-work`, `discuss-phase`, `progress`, `verify-phase`, `add-phase`/`insert-phase`/`remove-phase`, `transition`, `manager`, `quick`) for `gsd-sdk query` or explicit CJS exceptions (`audit-open`). +- **Phase 2 orchestration doc pass (#2122)** — Aligned `commands/gsd` (`execute-phase`, `code-review`, `code-review-fix`, `from-gsd2`, `graphify`) and agents (`gsd-verifier`, `gsd-plan-checker`, `gsd-code-fixer`, `gsd-executor`, `gsd-planner`, researchers, debugger) so examples use `init.*` query names, correct `frontmatter.get` positional field, `state.*` positional args, and `commit` with positional file paths (not `--files`, except `commit-to-subrepo` which keeps `--files`). +- **Phase 2 `commit` example sweep (#2122)** — Normalized `gsd-sdk query commit` usage across `get-shit-done/workflows/**/*.md`, `get-shit-done/references/**/*.md`, and `commands/gsd/**/*.md` so file paths follow the message positionally (SDK `commit` handler); `gsd-sdk query commit-to-subrepo … --files …` unchanged. Updated `get-shit-done/references/git-planning-commit.md` prose; adjusted workflow contract tests (`claude-md`, forensics, milestone-summary, gates taxonomy CRLF-safe `required_reading`, verifier `roadmap.analyze`) for the new examples. ### Fixed - **Init ignores archived phases** — Archived phases from prior milestones sharing a phase number no longer interfere (#2186) diff --git a/agents/gsd-code-fixer.md b/agents/gsd-code-fixer.md index 1244c933c..523f7f025 100644 --- a/agents/gsd-code-fixer.md +++ b/agents/gsd-code-fixer.md @@ -194,7 +194,7 @@ The **Fix:** section may contain: If a finding references multiple files (in Fix section or Issue section): - Collect ALL file paths into `files` array - Apply fix to each file -- Commit all modified files atomically (single commit, multiple files in `--files` list) +- Commit all modified files atomically (single commit, list every file path after the message — `commit` uses positional paths, not `--files`) **Parsing Rules:** @@ -308,20 +308,21 @@ For each finding in sorted order: **If verification passed:** -Use gsd-tools commit command with conventional format: +Use `gsd-sdk query commit` with conventional format (message first, then every staged file path): ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit \ +gsd-sdk query commit \ "fix({padded_phase}): {finding_id} {short_description}" \ - --files {all_modified_files} + {all_modified_files} ``` Examples: - `fix(02): CR-01 fix SQL injection in auth.py` - `fix(03): WR-05 add null check before array access` -**Multiple files:** List ALL modified files in `--files` (space-separated): +**Multiple files:** List ALL modified files after the message (space-separated): ```bash ---files src/api/auth.ts src/types/user.ts tests/auth.test.ts +gsd-sdk query commit "fix(02): CR-01 ..." \ + src/api/auth.ts src/types/user.ts tests/auth.test.ts ``` **Extract commit hash:** @@ -442,7 +443,7 @@ _Iteration: {N}_ **DO record which files will be touched** before every fix attempt — this is your rollback list. Rollback is `git checkout -- {file}`, not content capture. -**DO commit each fix atomically** — one commit per finding, listing ALL modified files in `--files` argument. +**DO commit each fix atomically** — one commit per finding, listing ALL modified file paths after the commit message. **DO use Edit tool (preferred)** over Write tool for targeted changes. Edit provides better diff visibility. @@ -504,7 +505,7 @@ Fixes are committed **per-finding**. This has operational implications: - [ ] All in-scope findings attempted (either fixed or skipped with reason) - [ ] Each fix committed atomically with `fix({padded_phase}): {id} {description}` format -- [ ] All modified files listed in each commit's `--files` argument (multi-file fix support) +- [ ] All modified files listed after each commit message (multi-file fix support) - [ ] REVIEW-FIX.md created with accurate counts, status, and iteration number - [ ] No source files left in broken state (failed fixes rolled back via git checkout) - [ ] No partial or uncommitted changes remain after execution diff --git a/agents/gsd-debug-session-manager.md b/agents/gsd-debug-session-manager.md index c4d4a607a..24455e580 100644 --- a/agents/gsd-debug-session-manager.md +++ b/agents/gsd-debug-session-manager.md @@ -93,7 +93,7 @@ Task( Resolve the debugger model before spawning: ```bash -debugger_model=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-debugger --raw) +debugger_model=$(gsd-sdk query resolve-model gsd-debugger 2>/dev/null | jq -r '.model' 2>/dev/null || true) ``` ## Step 3: Handle Agent Return diff --git a/agents/gsd-debugger.md b/agents/gsd-debugger.md index e57bc03aa..4a2a5b16b 100644 --- a/agents/gsd-debugger.md +++ b/agents/gsd-debugger.md @@ -1227,7 +1227,7 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/ **Check planning config using state load (commit_docs is available from the output):** ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load) +INIT=$(gsd-sdk query state.load) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi # commit_docs is in the JSON output ``` @@ -1245,7 +1245,7 @@ Root cause: {root_cause}" Then commit planning docs via CLI (respects `commit_docs` config automatically): ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: resolve debug {slug}" --files .planning/debug/resolved/{slug}.md +gsd-sdk query commit "docs: resolve debug {slug}" .planning/debug/resolved/{slug}.md ``` **Append to knowledge base:** @@ -1276,7 +1276,7 @@ Then append the entry: Commit the knowledge base update alongside the resolved session: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: update debug knowledge base with {slug}" --files .planning/debug/knowledge-base.md +gsd-sdk query commit "docs: update debug knowledge base with {slug}" .planning/debug/knowledge-base.md ``` Report completion and offer next steps. diff --git a/agents/gsd-executor.md b/agents/gsd-executor.md index 435ab959a..22ecf9a0a 100644 --- a/agents/gsd-executor.md +++ b/agents/gsd-executor.md @@ -72,7 +72,7 @@ This ensures project-specific patterns, conventions, and best practices are appl Load execution context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "${PHASE}") +INIT=$(gsd-sdk query init.execute-phase "${PHASE}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -248,8 +248,8 @@ Do NOT continue reading. Analysis without action is a stuck signal. Check if auto mode is active at executor start (chain flag or user preference): ```bash -AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false") -AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false") +AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false") +AUTO_CFG=$(gsd-sdk query config-get workflow.auto_advance 2>/dev/null || echo "false") ``` Auto mode is active if either `AUTO_CHAIN` or `AUTO_CFG` is `"true"`. Store the result for checkpoint handling below. @@ -388,7 +388,7 @@ git add src/types/user.ts **If `sub_repos` is configured (non-empty array from init context):** Use `commit-to-subrepo` to route files to their correct sub-repo: ```bash -node ~/.claude/get-shit-done/bin/gsd-tools.cjs commit-to-subrepo "{type}({phase}-{plan}): {concise task description}" --files file1 file2 ... +gsd-sdk query commit-to-subrepo "{type}({phase}-{plan}): {concise task description}" --files file1 file2 ... ``` Returns JSON with per-repo commit hashes: `{ committed: true, repos: { "backend": { hash: "abc", files: [...] }, ... } }`. Record all hashes for SUMMARY. @@ -515,38 +515,36 @@ Do NOT skip. Do NOT proceed to state updates if self-check fails. -After SUMMARY.md, update STATE.md using gsd-tools: +After SUMMARY.md, update STATE.md using `gsd-sdk query` state handlers (positional args; see `sdk/src/query/QUERY-HANDLERS.md`): ```bash # Advance plan counter (handles edge cases automatically) -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state advance-plan +gsd-sdk query state.advance-plan # Recalculate progress bar from disk state -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state update-progress +gsd-sdk query state.update-progress -# Record execution metrics -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-metric \ - --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \ - --tasks "${TASK_COUNT}" --files "${FILE_COUNT}" +# Record execution metrics (phase, plan, duration, tasks, files) +gsd-sdk query state.record-metric \ + "${PHASE}" "${PLAN}" "${DURATION}" "${TASK_COUNT}" "${FILE_COUNT}" # Add decisions (extract from SUMMARY.md key-decisions) for decision in "${DECISIONS[@]}"; do - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state add-decision \ - --phase "${PHASE}" --summary "${decision}" + gsd-sdk query state.add-decision "${decision}" done -# Update session info -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \ - --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" +# Update session info (timestamp, stopped-at, resume-file) +gsd-sdk query state.record-session \ + "" "Completed ${PHASE}-${PLAN}-PLAN.md" "None" ``` ```bash # Update ROADMAP.md progress for this phase (plan counts, status) -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap update-plan-progress "${PHASE_NUMBER}" +gsd-sdk query roadmap.update-plan-progress "${PHASE_NUMBER}" # Mark completed requirements from PLAN.md frontmatter # Extract the `requirements` array from the plan's frontmatter, then mark each complete -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" requirements mark-complete ${REQ_IDS} +gsd-sdk query requirements.mark-complete ${REQ_IDS} ``` **Requirement IDs:** Extract from the PLAN.md frontmatter `requirements:` field (e.g., `requirements: [AUTH-01, AUTH-02]`). Pass all IDs to `requirements mark-complete`. If the plan has no requirements field, skip this step. @@ -564,13 +562,14 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" requirements mark-complete **For blockers found during execution:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state add-blocker "Blocker description" +gsd-sdk query state.add-blocker "Blocker description" ``` ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md +gsd-sdk query commit "docs({phase}-{plan}): complete [plan-name] plan" \ + .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md ``` Separate from per-task commits — captures execution results only. diff --git a/agents/gsd-intel-updater.md b/agents/gsd-intel-updater.md index 76fe5fc4f..c64ba191d 100644 --- a/agents/gsd-intel-updater.md +++ b/agents/gsd-intel-updater.md @@ -37,7 +37,7 @@ Write machine-parseable, evidence-based intelligence. Every claim references act - **Always include file paths.** Every claim must reference the actual code location. - **Write current state only.** No temporal language ("recently added", "will be changed"). - **Evidence-based.** Read the actual files. Do not guess from file names or directory structures. -- **Cross-platform.** Use Glob, Read, and Grep tools -- not Bash `ls`, `find`, or `cat`. Bash file commands fail on Windows. Only use Bash for `node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel` CLI calls. +- **Cross-platform.** Use Glob, Read, and Grep tools -- not Bash `ls`, `find`, or `cat`. Bash file commands fail on Windows. Only use Bash for `gsd-sdk query intel` CLI calls. - **ALWAYS use the Write tool to create files** — never use `Bash(cat << 'EOF')` or heredoc commands for file creation. @@ -106,7 +106,7 @@ All JSON files include a `_meta` object with `updated_at` (ISO timestamp) and `v } ``` -**exports constraint:** Array of ACTUAL exported symbol names extracted from `module.exports` or `export` statements. MUST be real identifiers (e.g., `"configLoad"`, `"stateUpdate"`), NOT descriptions (e.g., `"config operations"`). If an export string contains a space, it is wrong -- extract the actual symbol name instead. Use `node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel extract-exports ` to get accurate exports. +**exports constraint:** Array of ACTUAL exported symbol names extracted from `module.exports` or `export` statements. MUST be real identifiers (e.g., `"configLoad"`, `"stateUpdate"`), NOT descriptions (e.g., `"config operations"`). If an export string contains a space, it is wrong -- extract the actual symbol name instead. Use `gsd-sdk query intel.extract-exports ` to get accurate exports. Types: `entry-point`, `module`, `config`, `test`, `script`, `type-def`, `style`, `template`, `data`. @@ -202,7 +202,7 @@ Glob for project structure indicators: Read package.json, configs, and build files. Write `stack.json`. Then patch its timestamp: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel patch-meta .planning/intel/stack.json --cwd +gsd-sdk query intel.patch-meta .planning/intel/stack.json --cwd ``` ### Step 3: File Graph @@ -211,7 +211,7 @@ Glob source files (`**/*.ts`, `**/*.js`, `**/*.py`, etc., excluding node_modules Read key files (entry points, configs, core modules) for imports/exports. Write `files.json`. Then patch its timestamp: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel patch-meta .planning/intel/files.json --cwd +gsd-sdk query intel.patch-meta .planning/intel/files.json --cwd ``` Focus on files that matter -- entry points, core modules, configs. Skip test files and generated code unless they reveal architecture. @@ -222,7 +222,7 @@ Grep for route definitions, endpoint declarations, CLI command registrations. Patterns to search: `app.get(`, `router.post(`, `@GetMapping`, `def route`, express route patterns. Write `apis.json`. If no API endpoints found, write an empty entries object. Then patch its timestamp: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel patch-meta .planning/intel/apis.json --cwd +gsd-sdk query intel.patch-meta .planning/intel/apis.json --cwd ``` ### Step 5: Dependencies @@ -231,7 +231,7 @@ Read package.json (dependencies, devDependencies), requirements.txt, go.mod, Car Cross-reference with actual imports to populate `used_by`. Write `deps.json`. Then patch its timestamp: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel patch-meta .planning/intel/deps.json --cwd +gsd-sdk query intel.patch-meta .planning/intel/deps.json --cwd ``` ### Step 6: Architecture @@ -241,7 +241,7 @@ Write `arch.md`. ### Step 6.5: Self-Check -Run: `node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel validate --cwd ` +Run: `gsd-sdk query intel.validate --cwd ` Review the output: @@ -253,7 +253,7 @@ This step is MANDATORY -- do not skip it. ### Step 7: Snapshot -Run: `node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel snapshot --cwd ` +Run: `gsd-sdk query intel.snapshot --cwd ` This writes `.last-refresh.json` with accurate timestamps and hashes. Do NOT write `.last-refresh.json` manually. diff --git a/agents/gsd-phase-researcher.md b/agents/gsd-phase-researcher.md index 284e27b1f..2b3b38ad7 100644 --- a/agents/gsd-phase-researcher.md +++ b/agents/gsd-phase-researcher.md @@ -158,7 +158,7 @@ When researching "best library for X": find what the ecosystem actually uses, do Check `brave_search` from init context. If `true`, use Brave Search for higher quality results: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" websearch "your query" --limit 10 +gsd-sdk query websearch "your query" --limit 10 ``` **Options:** @@ -514,7 +514,7 @@ Orchestrator provides: phase number/name, description/goal, requirements, constr Load phase context using init command: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE}") +INIT=$(gsd-sdk query init.phase-op "${PHASE}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -761,7 +761,7 @@ Write to: `$PHASE_DIR/$PADDED_PHASE-RESEARCH.md` ## Step 7: Commit Research (optional) ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs($PHASE): research phase domain" --files "$PHASE_DIR/$PADDED_PHASE-RESEARCH.md" +gsd-sdk query commit "docs($PHASE): research phase domain" "$PHASE_DIR/$PADDED_PHASE-RESEARCH.md" ``` ## Step 8: Return Structured Result diff --git a/agents/gsd-plan-checker.md b/agents/gsd-plan-checker.md index 7434b4927..073e00755 100644 --- a/agents/gsd-plan-checker.md +++ b/agents/gsd-plan-checker.md @@ -630,7 +630,7 @@ issue: Load phase operation context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -642,7 +642,7 @@ Orchestrator provides CONTEXT.md content in the verification prompt. If provided ls "$phase_dir"/*-PLAN.md 2>/dev/null # Read research for Nyquist validation data cat "$phase_dir"/*-RESEARCH.md 2>/dev/null -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "$phase_number" +gsd-sdk query roadmap.get-phase "$phase_number" ls "$phase_dir"/*-BRIEF.md 2>/dev/null ``` @@ -650,12 +650,12 @@ ls "$phase_dir"/*-BRIEF.md 2>/dev/null ## Step 2: Load All Plans -Use gsd-tools to validate plan structure: +Use `gsd-sdk query` to validate plan structure: ```bash for plan in "$PHASE_DIR"/*-PLAN.md; do echo "=== $plan ===" - PLAN_STRUCTURE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify plan-structure "$plan") + PLAN_STRUCTURE=$(gsd-sdk query verify.plan-structure "$plan") echo "$PLAN_STRUCTURE" done ``` @@ -670,10 +670,10 @@ Map errors/warnings to verification dimensions: ## Step 3: Parse must_haves -Extract must_haves from each plan using gsd-tools: +Extract must_haves from each plan using `gsd-sdk query`: ```bash -MUST_HAVES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter get "$PLAN_PATH" --field must_haves) +MUST_HAVES=$(gsd-sdk query frontmatter.get "$PLAN_PATH" must_haves) ``` Returns JSON: `{ truths: [...], artifacts: [...], key_links: [...] }` @@ -715,10 +715,10 @@ For each requirement: find covering task(s), verify action is specific, flag gap ## Step 5: Validate Task Structure -Use gsd-tools plan-structure verification (already run in Step 2): +Use `verify.plan-structure` (already run in Step 2): ```bash -PLAN_STRUCTURE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify plan-structure "$PLAN_PATH") +PLAN_STRUCTURE=$(gsd-sdk query verify.plan-structure "$PLAN_PATH") ``` The `tasks` array in the result shows each task's completeness: @@ -729,7 +729,7 @@ The `tasks` array in the result shows each task's completeness: **Check:** valid task type (auto, checkpoint:*, tdd), auto tasks have files/action/verify/done, action is specific, verify is runnable, done is measurable. -**For manual validation of specificity** (gsd-tools checks structure, not content quality): +**For manual validation of specificity** (`verify.plan-structure` checks structure, not content quality): ```bash grep -B5 "" "$PHASE_DIR"/*-PLAN.md | grep -v "" ``` diff --git a/agents/gsd-planner.md b/agents/gsd-planner.md index bcd26ed84..6d1f60709 100644 --- a/agents/gsd-planner.md +++ b/agents/gsd-planner.md @@ -828,7 +828,7 @@ start of execution when `--reviews` flag is present or reviews mode is active. Load planning context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init plan-phase "${PHASE}") +INIT=$(gsd-sdk query init.plan-phase "${PHASE}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -896,6 +896,8 @@ Query the graph for phase-relevant dependency context (single query per D-06): node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" graphify query "" --budget 2000 ``` +(graphify is not exposed on `gsd-sdk query` yet; use `gsd-tools.cjs` for graphify only.) + Use the keyword that best captures the phase goal. Examples: - Phase "User Authentication" -> query term "auth" - Phase "Payment Integration" -> query term "payment" @@ -931,7 +933,7 @@ Apply discovery level protocol (see discovery_levels section). **Step 1 — Generate digest index:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" history-digest +gsd-sdk query history-digest ``` **Step 2 — Select relevant phases (typically 2-4):** @@ -976,7 +978,7 @@ Read the most recent milestone retrospective and cross-milestone trends. Extract -If `features.global_learnings` is `true`: run `gsd-tools learnings query --tag --limit 5`, prefix matches with `[Prior learning from ]` as weak priors. Project-local decisions take precedence. Skip silently if disabled or no matches. For tags, use PLAN.md frontmatter `tags` field or keywords from the phase objective, comma-separated (e.g. `--tag auth,database,api`). +If `features.global_learnings` is `true`: run `gsd-sdk query learnings.query --tag --limit 5` once per tag from PLAN.md frontmatter `tags` (or use the single most specific keyword). The handler matches one `--tag` at a time. Prefix matches with `[Prior learning from ]` as weak priors. Project-local decisions take precedence. Skip silently if disabled or no matches. @@ -1090,7 +1092,7 @@ The filename MUST follow the exact pattern: `{padded_phase}-{NN}-PLAN.md` - Phase 3, Plan 2 → `03-02-PLAN.md` - Phase 2.1, Plan 1 → `02.1-01-PLAN.md` -**Incorrect (will break gsd-tools detection):** +**Incorrect (will break GSD plan filename conventions / tooling detection):** - ❌ `PLAN-01-auth.md` - ❌ `01-PLAN-01.md` - ❌ `plan-01.md` @@ -1102,10 +1104,10 @@ Include all frontmatter fields. -Validate each created PLAN.md using gsd-tools: +Validate each created PLAN.md using `gsd-sdk query`: ```bash -VALID=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter validate "$PLAN_PATH" --schema plan) +VALID=$(gsd-sdk query frontmatter.validate "$PLAN_PATH" --schema plan) ``` Returns JSON: `{ valid, missing, present, schema }` @@ -1118,7 +1120,7 @@ Required plan frontmatter fields: Also validate plan structure: ```bash -STRUCTURE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify plan-structure "$PLAN_PATH") +STRUCTURE=$(gsd-sdk query verify.plan-structure "$PLAN_PATH") ``` Returns JSON: `{ valid, errors, warnings, task_count, tasks }` @@ -1155,7 +1157,8 @@ Plans: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs($PHASE): create phase plan" --files .planning/phases/$PHASE-*/$PHASE-*-PLAN.md .planning/ROADMAP.md +gsd-sdk query commit "docs($PHASE): create phase plan" \ + .planning/phases/$PHASE-*/$PHASE-*-PLAN.md .planning/ROADMAP.md ``` diff --git a/agents/gsd-project-researcher.md b/agents/gsd-project-researcher.md index 561a4d312..5450301e7 100644 --- a/agents/gsd-project-researcher.md +++ b/agents/gsd-project-researcher.md @@ -128,7 +128,7 @@ Always include current year. Use multiple query variations. Mark WebSearch-only Check `brave_search` from orchestrator context. If `true`, use Brave Search for higher quality results: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" websearch "your query" --limit 10 +gsd-sdk query websearch "your query" --limit 10 ``` **Options:** diff --git a/agents/gsd-research-synthesizer.md b/agents/gsd-research-synthesizer.md index e2654d466..e9b9564dd 100644 --- a/agents/gsd-research-synthesizer.md +++ b/agents/gsd-research-synthesizer.md @@ -58,7 +58,7 @@ cat .planning/research/FEATURES.md cat .planning/research/ARCHITECTURE.md cat .planning/research/PITFALLS.md -# Planning config loaded via gsd-tools.cjs in commit step +# Planning config loaded via gsd-sdk query (or gsd-tools.cjs) in commit step ``` Parse each file to extract: @@ -139,7 +139,7 @@ Write to `.planning/research/SUMMARY.md` The 4 parallel researcher agents write files but do NOT commit. You commit everything together. ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: complete project research" --files .planning/research/ +gsd-sdk query commit "docs: complete project research" .planning/research/ ``` ## Step 8: Return Summary diff --git a/agents/gsd-ui-researcher.md b/agents/gsd-ui-researcher.md index 08a216686..2efca9265 100644 --- a/agents/gsd-ui-researcher.md +++ b/agents/gsd-ui-researcher.md @@ -292,7 +292,7 @@ Fill all sections. Write to `$PHASE_DIR/$PADDED_PHASE-UI-SPEC.md`. ## Step 6: Commit (optional) ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs($PHASE): UI design contract" --files "$PHASE_DIR/$PADDED_PHASE-UI-SPEC.md" +gsd-sdk query commit "docs($PHASE): UI design contract" "$PHASE_DIR/$PADDED_PHASE-UI-SPEC.md" ``` ## Step 7: Return Structured Result diff --git a/agents/gsd-verifier.md b/agents/gsd-verifier.md index c8a769fbd..f63dd75ce 100644 --- a/agents/gsd-verifier.md +++ b/agents/gsd-verifier.md @@ -91,7 +91,7 @@ Set `is_re_verification = false`, proceed with Step 1. ```bash ls "$PHASE_DIR"/*-PLAN.md 2>/dev/null ls "$PHASE_DIR"/*-SUMMARY.md 2>/dev/null -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "$PHASE_NUM" +gsd-sdk query roadmap.get-phase "$PHASE_NUM" grep -E "^| $PHASE_NUM" .planning/REQUIREMENTS.md 2>/dev/null ``` @@ -104,7 +104,7 @@ In re-verification mode, must-haves come from Step 0. **Step 2a: Always load ROADMAP Success Criteria** ```bash -PHASE_DATA=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "$PHASE_NUM" --raw) +PHASE_DATA=$(gsd-sdk query roadmap.get-phase "$PHASE_NUM" --raw) ``` Parse the `success_criteria` array from the JSON output. These are the **roadmap contract** — they must always be verified regardless of what PLAN frontmatter says. Store them as `roadmap_truths`. @@ -206,10 +206,10 @@ overrides: ## Step 4: Verify Artifacts (Three Levels) -Use gsd-tools for artifact verification against must_haves in PLAN frontmatter: +Use `gsd-sdk query` for artifact verification against must_haves in PLAN frontmatter: ```bash -ARTIFACT_RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify artifacts "$PLAN_PATH") +ARTIFACT_RESULT=$(gsd-sdk query verify.artifacts "$PLAN_PATH") ``` Parse JSON result: `{ all_passed, passed, total, artifacts: [{path, exists, issues, passed}] }` @@ -312,10 +312,10 @@ grep -r -A 3 "<${COMPONENT_NAME}" "${search_path:-src/}" --include="*.tsx" 2>/de Key links are critical connections. If broken, the goal fails even with all artifacts present. -Use gsd-tools for key link verification against must_haves in PLAN frontmatter: +Use `gsd-sdk query` for key link verification against must_haves in PLAN frontmatter: ```bash -LINKS_RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify key-links "$PLAN_PATH") +LINKS_RESULT=$(gsd-sdk query verify.key-links "$PLAN_PATH") ``` Parse JSON result: `{ all_verified, verified, total, links: [{from, to, via, verified, detail}] }` @@ -397,12 +397,12 @@ Identify files modified in this phase from SUMMARY.md key-files section, or extr ```bash # Option 1: Extract from SUMMARY frontmatter -SUMMARY_FILES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" summary-extract "$PHASE_DIR"/*-SUMMARY.md --fields key-files) +SUMMARY_FILES=$(gsd-sdk query summary-extract "$PHASE_DIR"/*-SUMMARY.md --fields key-files) # Option 2: Verify commits exist (if commit hashes documented) COMMIT_HASHES=$(grep -oE "[a-f0-9]{7,40}" "$PHASE_DIR"/*-SUMMARY.md | head -10) if [ -n "$COMMIT_HASHES" ]; then - COMMITS_VALID=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify commits $COMMIT_HASHES) + COMMITS_VALID=$(gsd-sdk query verify.commits $COMMIT_HASHES) fi # Fallback: grep for files @@ -516,7 +516,7 @@ Before reporting gaps, check if any identified gaps are explicitly addressed in **Load the full milestone roadmap:** ```bash -ROADMAP_DATA=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze --raw) +ROADMAP_DATA=$(gsd-sdk query roadmap.analyze --raw) ``` Parse the JSON to extract all phases. Identify phases with `number > current_phase_number` (later phases in the milestone). For each later phase, extract its `goal` and `success_criteria`. diff --git a/commands/gsd/add-backlog.md b/commands/gsd/add-backlog.md index 0ea4de97d..ee6c4ea09 100644 --- a/commands/gsd/add-backlog.md +++ b/commands/gsd/add-backlog.md @@ -23,7 +23,7 @@ the normal phase sequence and accumulate context over time. 2. **Find next backlog number:** ```bash - NEXT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase next-decimal 999 --raw) + NEXT=$(gsd-sdk query phase.next-decimal 999 --raw) ``` If no 999.x phases exist, start at 999.1. @@ -47,14 +47,14 @@ the normal phase sequence and accumulate context over time. 4. **Create the phase directory:** ```bash - SLUG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" generate-slug "$ARGUMENTS" --raw) + SLUG=$(gsd-sdk query generate-slug "$ARGUMENTS" --raw) mkdir -p ".planning/phases/${NEXT}-${SLUG}" touch ".planning/phases/${NEXT}-${SLUG}/.gitkeep" ``` 5. **Commit:** ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: add backlog item ${NEXT} — ${ARGUMENTS}" --files .planning/ROADMAP.md ".planning/phases/${NEXT}-${SLUG}/.gitkeep" + gsd-sdk query commit "docs: add backlog item ${NEXT} — ${ARGUMENTS}" .planning/ROADMAP.md ".planning/phases/${NEXT}-${SLUG}/.gitkeep" ``` 6. **Report:** diff --git a/commands/gsd/autonomous.md b/commands/gsd/autonomous.md index 61243503b..042b332da 100644 --- a/commands/gsd/autonomous.md +++ b/commands/gsd/autonomous.md @@ -37,7 +37,7 @@ Optional flags: - `--only N` — execute only phase N (single-phase mode). - `--interactive` — run discuss inline with questions (not auto-answered), then dispatch plan→execute as background agents. Keeps the main context lean while preserving user input on decisions. -Project context, phase list, and state are resolved inside the workflow using init commands (`gsd-tools.cjs init milestone-op`, `gsd-tools.cjs roadmap analyze`). No upfront context loading needed. +Project context, phase list, and state are resolved inside the workflow using init commands (`gsd-sdk query init.milestone-op`, `gsd-sdk query roadmap.analyze`). No upfront context loading needed. diff --git a/commands/gsd/code-review-fix.md b/commands/gsd/code-review-fix.md index 8c2ae949a..152b71898 100644 --- a/commands/gsd/code-review-fix.md +++ b/commands/gsd/code-review-fix.md @@ -33,7 +33,7 @@ Optional flags parsed from $ARGUMENTS: - `--all` — Include Info findings in fix scope. Default behavior fixes Critical + Warning only. - `--auto` — Enable fix + re-review iteration loop. After applying fixes, re-run code-review at same depth. If new issues found, iterate. Cap at 3 iterations total. Without this flag, single fix pass only. -Context files (CLAUDE.md, REVIEW.md, phase state) are resolved inside the workflow via `gsd-tools init phase-op` and delegated to agent via config blocks. +Context files (CLAUDE.md, REVIEW.md, phase state) are resolved inside the workflow via `gsd-sdk query init.phase-op` and delegated to agent via config blocks. diff --git a/commands/gsd/code-review.md b/commands/gsd/code-review.md index 20c57638b..257e500a2 100644 --- a/commands/gsd/code-review.md +++ b/commands/gsd/code-review.md @@ -37,7 +37,7 @@ Optional flags parsed from $ARGUMENTS: - `--depth=VALUE` — Depth override (quick|standard|deep). If provided, overrides workflow.code_review_depth config. - `--files=file1,file2,...` — Explicit file list override. Has highest precedence for file scoping per D-08. When provided, workflow skips SUMMARY.md extraction and git diff fallback entirely. -Context files (CLAUDE.md, SUMMARY.md, phase state) are resolved inside the workflow via `gsd-tools init phase-op` and delegated to agent via `` blocks. +Context files (CLAUDE.md, SUMMARY.md, phase state) are resolved inside the workflow via `gsd-sdk query init.phase-op` and delegated to agent via `` blocks. diff --git a/commands/gsd/debug.md b/commands/gsd/debug.md index 059eac6dd..717025371 100644 --- a/commands/gsd/debug.md +++ b/commands/gsd/debug.md @@ -52,18 +52,18 @@ ls .planning/debug/*.md 2>/dev/null | grep -v resolved | head -5 ## 0. Initialize Context ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load) +INIT=$(gsd-sdk query state.load) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` Extract `commit_docs` from init JSON. Resolve debugger model: ```bash -debugger_model=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-debugger --raw) +debugger_model=$(gsd-sdk query resolve-model gsd-debugger 2>/dev/null | jq -r '.model' 2>/dev/null || true) ``` Read TDD mode from config: ```bash -TDD_MODE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get tdd_mode 2>/dev/null || echo "false") +TDD_MODE=$(gsd-sdk query config-get tdd_mode 2>/dev/null | jq -r 'if type == "boolean" then tostring else . end' 2>/dev/null || echo "false") ``` ## 1a. LIST subcommand diff --git a/commands/gsd/discuss-phase.md b/commands/gsd/discuss-phase.md index 218309cdc..0a8ce97a8 100644 --- a/commands/gsd/discuss-phase.md +++ b/commands/gsd/discuss-phase.md @@ -48,7 +48,7 @@ Context files are resolved in-workflow using `init phase-op` and roadmap/state t **Mode routing:** ```bash -DISCUSS_MODE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.discuss_mode 2>/dev/null || echo "discuss") +DISCUSS_MODE=$(gsd-sdk query config-get workflow.discuss_mode 2>/dev/null || echo "discuss") ``` If `DISCUSS_MODE` is `"assumptions"`: Read and execute @~/.claude/get-shit-done/workflows/discuss-phase-assumptions.md end-to-end. diff --git a/commands/gsd/execute-phase.md b/commands/gsd/execute-phase.md index 62cde382f..d4ce895e3 100644 --- a/commands/gsd/execute-phase.md +++ b/commands/gsd/execute-phase.md @@ -54,7 +54,7 @@ Phase: $ARGUMENTS - If none of these tokens appear, run the standard full-phase execution flow with no flag-specific filtering - Do not infer that a flag is active just because it is documented in this prompt -Context files are resolved inside the workflow via `gsd-tools init execute-phase` and per-subagent `` blocks. +Context files are resolved inside the workflow via `gsd-sdk query init.execute-phase` and per-subagent `` blocks. diff --git a/commands/gsd/from-gsd2.md b/commands/gsd/from-gsd2.md index 5bfc4e483..934222199 100644 --- a/commands/gsd/from-gsd2.md +++ b/commands/gsd/from-gsd2.md @@ -13,6 +13,8 @@ type: prompt Reverse-migrate a GSD-2 project (`.gsd/` directory) back to GSD v1 (`.planning/`) format. Maps the GSD-2 hierarchy (Milestone → Slice → Task) to the GSD v1 hierarchy (Milestone sections in ROADMAP.md → Phase → Plan), preserving completion state, research files, and summaries. + +**CJS-only:** `from-gsd2` is not on the `gsd-sdk query` registry; call `gsd-tools.cjs` as shown below (see `docs/CLI-TOOLS.md`). diff --git a/commands/gsd/graphify.md b/commands/gsd/graphify.md index 1debb0f2e..52ecacdf7 100644 --- a/commands/gsd/graphify.md +++ b/commands/gsd/graphify.md @@ -10,6 +10,8 @@ allowed-tools: **STOP -- DO NOT READ THIS FILE. You are already reading it. This prompt was injected into your context by Claude Code's command system. Using the Read tool on this file wastes tokens. Begin executing Step 0 immediately.** +**CJS-only (graphify):** `graphify` subcommands are not registered on `gsd-sdk query`. Use `node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs graphify …` as documented in this command and in `docs/CLI-TOOLS.md`. Other tooling may still use `gsd-sdk query` where a handler exists. + ## Step 0 -- Banner **Before ANY tool calls**, display this banner: diff --git a/commands/gsd/intel.md b/commands/gsd/intel.md index f8b64b721..ac1cc79bf 100644 --- a/commands/gsd/intel.md +++ b/commands/gsd/intel.md @@ -39,7 +39,7 @@ GSD > INTEL Intel system is disabled. To activate: - node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs config-set intel.enabled true + gsd-sdk query config-set intel.enabled true Then run /gsd-intel refresh to build the initial index. ``` @@ -77,7 +77,7 @@ Modes: Run: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel query +gsd-sdk query intel.query ``` Parse the JSON output and display results: @@ -92,7 +92,7 @@ Parse the JSON output and display results: Run: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel status +gsd-sdk query intel.status ``` Parse the JSON output and display each intel file with: @@ -107,7 +107,7 @@ Parse the JSON output and display each intel file with: Run: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel diff +gsd-sdk query intel.diff ``` Parse the JSON output and display: @@ -137,15 +137,15 @@ Task( prompt="You are the gsd-intel-updater agent. Your job is to analyze this codebase and write/update intelligence files in .planning/intel/. Project root: ${CWD} -gsd-tools path: $HOME/.claude/get-shit-done/bin/gsd-tools.cjs +Prefer: gsd-sdk query (installed gsd-sdk on PATH). Legacy: node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs Instructions: 1. Analyze the codebase structure, dependencies, APIs, and architecture 2. Write JSON intel files to .planning/intel/ (stack.json, api-map.json, dependency-graph.json, file-roles.json, arch-decisions.json) 3. Each file must have a _meta object with updated_at timestamp -4. Use gsd-tools intel extract-exports to analyze source files -5. Use gsd-tools intel patch-meta to update timestamps after writing -6. Use gsd-tools intel validate to check your output +4. Use `gsd-sdk query intel.extract-exports ` to analyze source files +5. Use `gsd-sdk query intel.patch-meta ` to update timestamps after writing +6. Use `gsd-sdk query intel.validate` to check your output When complete, output: ## INTEL UPDATE COMPLETE If something fails, output: ## INTEL UPDATE FAILED with details." @@ -161,7 +161,7 @@ Wait for the agent to complete. After the agent completes, run: ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs intel status +gsd-sdk query intel.status ``` Display a summary showing: diff --git a/commands/gsd/manager.md b/commands/gsd/manager.md index 6dd41e054..ced2a95c0 100644 --- a/commands/gsd/manager.md +++ b/commands/gsd/manager.md @@ -31,7 +31,7 @@ Designed for power users who want to parallelize work across phases from one ter No arguments required. Requires an active milestone with ROADMAP.md and STATE.md. -Project context, phase list, dependencies, and recommendations are resolved inside the workflow using `gsd-tools.cjs init manager`. No upfront context loading needed. +Project context, phase list, dependencies, and recommendations are resolved inside the workflow using `gsd-sdk query init.manager`. No upfront context loading needed. diff --git a/commands/gsd/quick.md b/commands/gsd/quick.md index 120ce3276..88e1c9c08 100644 --- a/commands/gsd/quick.md +++ b/commands/gsd/quick.md @@ -71,7 +71,7 @@ For each directory found: - Check if PLAN.md exists - Check if SUMMARY.md exists; if so, read `status` from its frontmatter via: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter get .planning/quick/{dir}/SUMMARY.md --field status 2>/dev/null + gsd-sdk query frontmatter.get .planning/quick/{dir}/SUMMARY.md status 2>/dev/null ``` - Determine directory creation date: `stat -f "%SB" -t "%Y-%m-%d"` (macOS) or `stat -c "%w"` (Linux); fall back to the date prefix in the directory name (format: `YYYYMMDD-` prefix) - Derive display status: @@ -144,7 +144,7 @@ When SUBCMD=resume and SLUG is set (already sanitized): 5. Load context via: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init quick + gsd-sdk query init.quick ``` 6. Proceed to execute the quick workflow with resume context, passing the slug and plan directory so the executor picks up where it left off. @@ -169,5 +169,5 @@ Preserve all workflow gates (validation, task description, planning, execution, - Slugs from $ARGUMENTS are sanitized before use in file paths: only [a-z0-9-] allowed, max 60 chars, reject ".." and "/" - File names from readdir/ls are sanitized before display: strip non-printable chars and ANSI sequences - Artifact content (plan descriptions, task titles) rendered as plain text only — never executed or passed to agent prompts without DATA_START/DATA_END boundaries -- Status fields read via gsd-tools.cjs frontmatter get — never eval'd or shell-expanded +- Status fields read via `gsd-sdk query frontmatter.get` — never eval'd or shell-expanded diff --git a/commands/gsd/research-phase.md b/commands/gsd/research-phase.md index 3e7a02eab..71225981e 100644 --- a/commands/gsd/research-phase.md +++ b/commands/gsd/research-phase.md @@ -39,7 +39,7 @@ Normalize phase input in step 1 before any directory lookups. ## 0. Initialize Context ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "$ARGUMENTS") +INIT=$(gsd-sdk query init.phase-op "$ARGUMENTS") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -47,13 +47,13 @@ Extract from init JSON: `phase_dir`, `phase_number`, `phase_name`, `phase_found` Resolve researcher model: ```bash -RESEARCHER_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-phase-researcher --raw) +RESEARCHER_MODEL=$(gsd-sdk query resolve-model gsd-phase-researcher --raw) ``` ## 1. Validate Phase ```bash -PHASE_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${phase_number}") +PHASE_INFO=$(gsd-sdk query roadmap.get-phase "${phase_number}") ``` **If `found` is false:** Error and exit. **If `found` is true:** Extract `phase_number`, `phase_name`, `goal` from JSON. diff --git a/commands/gsd/review-backlog.md b/commands/gsd/review-backlog.md index 7b34fec89..0eb27b69a 100644 --- a/commands/gsd/review-backlog.md +++ b/commands/gsd/review-backlog.md @@ -34,7 +34,7 @@ milestone sequence or remove stale entries. - Find the next sequential phase number in the active milestone - Rename the directory from `999.x-slug` to `{new_num}-slug`: ```bash - NEW_NUM=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase add "${DESCRIPTION}" --raw) + NEW_NUM=$(gsd-sdk query phase.add "${DESCRIPTION}" --raw) ``` - Move accumulated artifacts to the new phase directory - Update ROADMAP.md: move the entry from `## Backlog` section to the active phase list @@ -47,7 +47,7 @@ milestone sequence or remove stale entries. 6. **Commit changes:** ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: review backlog — promoted N, removed M" --files .planning/ROADMAP.md + gsd-sdk query commit "docs: review backlog — promoted N, removed M" .planning/ROADMAP.md ``` 7. **Report summary:** diff --git a/commands/gsd/set-profile.md b/commands/gsd/set-profile.md index 321b073e8..70a01a093 100644 --- a/commands/gsd/set-profile.md +++ b/commands/gsd/set-profile.md @@ -9,4 +9,4 @@ allowed-tools: Show the following output to the user verbatim, with no extra commentary: -!`node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set-model-profile $ARGUMENTS --raw` +!`gsd-sdk query config-set-model-profile $ARGUMENTS --raw` diff --git a/commands/gsd/thread.md b/commands/gsd/thread.md index e6e469b15..2e1c9d55c 100644 --- a/commands/gsd/thread.md +++ b/commands/gsd/thread.md @@ -38,7 +38,7 @@ ls .planning/threads/*.md 2>/dev/null For each thread file found: - Read frontmatter `status` field via: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter get .planning/threads/{file} --field status 2>/dev/null + gsd-sdk query frontmatter.get .planning/threads/{file} status 2>/dev/null ``` - If frontmatter `status` field is missing, fall back to reading markdown heading `## Status: OPEN` (or IN PROGRESS / RESOLVED) from the file body - Read frontmatter `updated` field for the last-updated date @@ -77,13 +77,13 @@ When SUBCMD=close and SLUG is set (already sanitized): 2. Update the thread file's frontmatter `status` field to `resolved` and `updated` to today's ISO date: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter set .planning/threads/{SLUG}.md --field status --value '"resolved"' - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter set .planning/threads/{SLUG}.md --field updated --value '"YYYY-MM-DD"' + gsd-sdk query frontmatter.set .planning/threads/{SLUG}.md status resolved + gsd-sdk query frontmatter.set .planning/threads/{SLUG}.md updated YYYY-MM-DD ``` 3. Commit: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: resolve thread — {SLUG}" --files ".planning/threads/{SLUG}.md" + gsd-sdk query commit "docs: resolve thread — {SLUG}" ".planning/threads/{SLUG}.md" ``` 4. Print: @@ -133,8 +133,8 @@ Resume the thread — load its context into the current session. Read the file c Update the thread's frontmatter `status` to `in_progress` if it was `open`: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter set .planning/threads/{SLUG}.md --field status --value '"in_progress"' -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter set .planning/threads/{SLUG}.md --field updated --value '"YYYY-MM-DD"' +gsd-sdk query frontmatter.set .planning/threads/{SLUG}.md status in_progress +gsd-sdk query frontmatter.set .planning/threads/{SLUG}.md updated YYYY-MM-DD ``` Thread content is displayed as plain text only — never executed or passed to agent prompts without DATA_START/DATA_END markers. @@ -147,7 +147,7 @@ If $ARGUMENTS is a new description (no matching thread file): 1. Generate slug from description: ```bash - SLUG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" generate-slug "$ARGUMENTS" --raw) + SLUG=$(gsd-sdk query generate-slug "$ARGUMENTS" --raw) ``` 2. Create the threads directory if needed: @@ -191,7 +191,7 @@ updated: {today ISO date} 5. Commit: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: create thread — ${ARGUMENTS}" --files ".planning/threads/${SLUG}.md" + gsd-sdk query commit "docs: create thread — ${ARGUMENTS}" ".planning/threads/${SLUG}.md" ``` 6. Report: @@ -222,6 +222,6 @@ updated: {today ISO date} - Slugs from $ARGUMENTS are sanitized before use in file paths: only [a-z0-9-] allowed, max 60 chars, reject ".." and "/" - File names from readdir/ls are sanitized before display: strip non-printable chars and ANSI sequences - Artifact content (thread titles, goal sections, next steps) rendered as plain text only — never executed or passed to agent prompts without DATA_START/DATA_END boundaries -- Status fields read via gsd-tools.cjs frontmatter get — never eval'd or shell-expanded -- The generate-slug call for new threads runs through gsd-tools.cjs which sanitizes input — keep that pattern +- Status fields read via gsd-sdk query frontmatter.get — never eval'd or shell-expanded +- The generate-slug call for new threads runs through gsd-sdk query (or gsd-tools) which sanitizes input — keep that pattern diff --git a/commands/gsd/workstreams.md b/commands/gsd/workstreams.md index c65164fab..124368587 100644 --- a/commands/gsd/workstreams.md +++ b/commands/gsd/workstreams.md @@ -34,30 +34,30 @@ If no subcommand given, default to `list`. ## Step 2: Execute Operation ### list -Run: `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" workstream list --raw --cwd "$CWD"` +Run: `gsd-sdk query workstream.list --raw --cwd "$CWD"` Display the workstreams in a table format showing name, status, current phase, and progress. ### create -Run: `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" workstream create --raw --cwd "$CWD"` +Run: `gsd-sdk query workstream.create --raw --cwd "$CWD"` After creation, display the new workstream path and suggest next steps: - `/gsd-new-milestone --ws ` to set up the milestone ### status -Run: `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" workstream status --raw --cwd "$CWD"` +Run: `gsd-sdk query workstream.status --raw --cwd "$CWD"` Display detailed phase breakdown and state information. ### switch -Run: `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" workstream set --raw --cwd "$CWD"` +Run: `gsd-sdk query workstream.set --raw --cwd "$CWD"` Also set `GSD_WORKSTREAM` for the current session when the runtime supports it. If the runtime exposes a session identifier, GSD also stores the active workstream session-locally so concurrent sessions do not overwrite each other. ### progress -Run: `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" workstream progress --raw --cwd "$CWD"` +Run: `gsd-sdk query workstream.progress --raw --cwd "$CWD"` Display a progress overview across all workstreams. ### complete -Run: `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" workstream complete --raw --cwd "$CWD"` +Run: `gsd-sdk query workstream.complete --raw --cwd "$CWD"` Archive the workstream to milestones/. ### resume @@ -65,5 +65,5 @@ Set the workstream as active and suggest `/gsd-resume-work --ws `. ## Step 3: Display Results -Format the JSON output from gsd-tools into a human-readable display. +Format the JSON output from gsd-sdk query into a human-readable display. Include the `${GSD_WS}` flag in any routing suggestions. diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index 5d7c03d48..0a943890f 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -54,7 +54,7 @@ GSD is a **meta-prompting framework** that sits between the user and AI coding a │ │ │ ┌──────▼──────────────▼─────────────────▼──────────────┐ │ CLI TOOLS LAYER │ -│ get-shit-done/bin/gsd-tools.cjs │ +│ gsd-sdk query (sdk/src/query) + gsd-tools.cjs │ │ (State, config, phase, roadmap, verify, templates) │ └──────────────────────┬───────────────────────────────┘ │ @@ -76,7 +76,7 @@ Every agent spawned by an orchestrator gets a clean context window (up to 200K t ### 2. Thin Orchestrators Workflow files (`get-shit-done/workflows/*.md`) never do heavy lifting. They: -- Load context via `gsd-tools.cjs init ` +- Load context via `gsd-sdk query init.` (or legacy `gsd-tools.cjs init `) - Spawn specialized agents with focused prompts - Collect results and route to the next step - Update state between steps @@ -118,7 +118,7 @@ User-facing entry points. Each file contains YAML frontmatter (name, description ### Workflows (`get-shit-done/workflows/*.md`) Orchestration logic that commands reference. Contains the step-by-step process including: -- Context loading via `gsd-tools.cjs init` +- Context loading via `gsd-sdk query` init handlers (or legacy `gsd-tools.cjs init`) - Agent spawn instructions with model resolution - Gate/checkpoint definitions - State update patterns diff --git a/docs/CLI-TOOLS.md b/docs/CLI-TOOLS.md index 9910a5784..e76b71e8f 100644 --- a/docs/CLI-TOOLS.md +++ b/docs/CLI-TOOLS.md @@ -8,6 +8,8 @@ `gsd-tools.cjs` is a Node.js CLI utility that replaces repetitive inline bash patterns across GSD's ~50 command, workflow, and agent files. It centralizes: config parsing, model resolution, phase lookup, git commits, summary verification, state management, and template operations. +**Preferred for new orchestration:** Many of the same operations are available as `gsd-sdk query ` (see `sdk/src/query/index.ts` and `docs/QUERY-HANDLERS.md`). Use that in workflows and examples where the handler exists; keep `node … gsd-tools.cjs` for commands not yet in the registry (for example graphify) or when you need CJS-only flags. + **Location:** `get-shit-done/bin/gsd-tools.cjs` **Modules:** 15 domain modules in `get-shit-done/bin/lib/` diff --git a/docs/USER-GUIDE.md b/docs/USER-GUIDE.md index 73c0127fb..c67630f79 100644 --- a/docs/USER-GUIDE.md +++ b/docs/USER-GUIDE.md @@ -798,14 +798,20 @@ Each workspace gets: ## Troubleshooting +### Programmatic CLI (`gsd-sdk query` vs `gsd-tools.cjs`) + +For automation and copy-paste from docs, prefer **`gsd-sdk query`** with a registered subcommand (see [CLI-TOOLS.md](CLI-TOOLS.md) and [QUERY-HANDLERS.md](../sdk/src/query/QUERY-HANDLERS.md)). The legacy **`node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs`** CLI remains supported for dual-mode operation. + +**Not yet on `gsd-sdk query` (use CJS):** `state validate`, `state sync`, `audit-open`, `graphify`, `from-gsd2`, and any subcommand not listed in the registry. + ### STATE.md Out of Sync -If STATE.md shows incorrect phase status or position, use the state consistency commands: +If STATE.md shows incorrect phase status or position, use the state consistency commands (**CJS-only** until ported to the query layer): ```bash -node gsd-tools.cjs state validate # Detect drift between STATE.md and filesystem -node gsd-tools.cjs state sync --verify # Preview what sync would change -node gsd-tools.cjs state sync # Reconstruct STATE.md from disk +node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state validate # Detect drift between STATE.md and filesystem +node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state sync --verify # Preview what sync would change +node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state sync # Reconstruct STATE.md from disk ``` These commands are new in v1.32 and replace manual STATE.md editing. diff --git a/docs/gsd-sdk-query-migration-blurb.md b/docs/gsd-sdk-query-migration-blurb.md new file mode 100644 index 000000000..925fa5658 --- /dev/null +++ b/docs/gsd-sdk-query-migration-blurb.md @@ -0,0 +1,22 @@ +# GSD SDK query migration (summary blurb) + +Copy-paste friendly for Discord and GitHub comments. + +--- + +**@gsd-build/sdk** replaces the untyped, monolithic `gsd-tools.cjs` subprocess with a typed, tested, registry-based query system and **`gsd-sdk query`**, giving GSD structured results, classified errors (`GSDQueryError`), and golden-verified parity with the old CLI. That gives the framework one stable contract instead of a fragile, very large CLI that every workflow had to spawn and parse by hand. + +**What users can expect** + +- Same GSD commands and workflows they already use. +- Snappier runs (less Node startup on chained tool calls). +- Fewer mysterious mid-workflow failures and safer upgrades, because behavior is covered by tests and a single stable contract. +- Stronger predictability: outputs and failure modes are consistent and explicit. + +**Cost and tokens** + +The SDK does not automatically reduce LLM tokens per model call. Savings show up indirectly: fewer ambiguous tool results and fewer retry or recovery loops, which often lowers real-world session cost and wall time. + +**Agents then vs now** + +Agents always followed workflow instructions. What improved is the surface those steps run on. Before, workflows effectively said to shell out to `gsd-tools.cjs` and interpret stdout or JSON with brittle assumptions. Now they point at **`gsd-sdk query`** and typed handlers that return the shapes prompts expect, with clearer error reasons when something must stop or be fixed, so instruction following holds end to end with less thrash from bad parses or silent output drift. diff --git a/get-shit-done/references/autonomous-smart-discuss.md b/get-shit-done/references/autonomous-smart-discuss.md index 40d238156..cefe5d603 100644 --- a/get-shit-done/references/autonomous-smart-discuss.md +++ b/get-shit-done/references/autonomous-smart-discuss.md @@ -5,7 +5,7 @@ Smart discuss is the autonomous-optimized variant of `gsd-discuss-phase`. It pro **Inputs:** `PHASE_NUM` from execute_phase. Run init to get phase paths: ```bash -PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM}) +PHASE_STATE=$(gsd-sdk query init.phase-op ${PHASE_NUM}) ``` Parse from JSON: `phase_dir`, `phase_slug`, `padded_phase`, `phase_name`. @@ -94,7 +94,7 @@ Read the 3-5 most relevant files to understand existing patterns. **Get phase details:** ```bash -DETAIL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM}) +DETAIL=$(gsd-sdk query roadmap.get-phase ${PHASE_NUM}) ``` Extract `goal`, `requirements`, `success_criteria` from the JSON response. @@ -266,7 +266,7 @@ Write the file. **Commit:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${PADDED_PHASE}): smart discuss context" --files "${phase_dir}/${padded_phase}-CONTEXT.md" +gsd-sdk query commit "docs(${PADDED_PHASE}): smart discuss context" "${phase_dir}/${padded_phase}-CONTEXT.md" ``` Display confirmation: diff --git a/get-shit-done/references/decimal-phase-calculation.md b/get-shit-done/references/decimal-phase-calculation.md index ba5c5cbdc..44f88f748 100644 --- a/get-shit-done/references/decimal-phase-calculation.md +++ b/get-shit-done/references/decimal-phase-calculation.md @@ -6,7 +6,7 @@ Calculate the next decimal phase number for urgent insertions. ```bash # Get next decimal phase after phase 6 -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase next-decimal 6 +gsd-sdk query phase.next-decimal 6 ``` Output: @@ -32,13 +32,13 @@ With existing decimals: ## Extract Values ```bash -DECIMAL_PHASE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase next-decimal "${AFTER_PHASE}" --pick next) -BASE_PHASE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase next-decimal "${AFTER_PHASE}" --pick base_phase) +DECIMAL_PHASE=$(gsd-sdk query phase.next-decimal "${AFTER_PHASE}" --pick next) +BASE_PHASE=$(gsd-sdk query phase.next-decimal "${AFTER_PHASE}" --pick base_phase) ``` Or with --raw flag: ```bash -DECIMAL_PHASE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase next-decimal "${AFTER_PHASE}" --raw) +DECIMAL_PHASE=$(gsd-sdk query phase.next-decimal "${AFTER_PHASE}" --raw) # Returns just: 06.1 ``` @@ -56,7 +56,7 @@ DECIMAL_PHASE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase next- Decimal phase directories use the full decimal number: ```bash -SLUG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" generate-slug "$DESCRIPTION" --raw) +SLUG=$(gsd-sdk query generate-slug "$DESCRIPTION" --raw) PHASE_DIR=".planning/phases/${DECIMAL_PHASE}-${SLUG}" mkdir -p "$PHASE_DIR" ``` diff --git a/get-shit-done/references/git-integration.md b/get-shit-done/references/git-integration.md index c1413a094..3ac371edb 100644 --- a/get-shit-done/references/git-integration.md +++ b/get-shit-done/references/git-integration.md @@ -51,7 +51,7 @@ Phases: What to commit: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: initialize [project-name] ([N] phases)" --files .planning/ +gsd-sdk query commit "docs: initialize [project-name] ([N] phases)" .planning/ ``` @@ -133,7 +133,7 @@ SUMMARY: .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md What to commit: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-PLAN.md .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md +gsd-sdk query commit "docs({phase}-{plan}): complete [plan-name] plan" .planning/phases/XX-name/{phase}-{plan}-PLAN.md .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md ``` **Note:** Code files NOT included - already committed per-task. @@ -153,7 +153,7 @@ Current: [task name] What to commit: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "wip: [phase-name] paused at task [X]/[Y]" --files .planning/ +gsd-sdk query commit "wip: [phase-name] paused at task [X]/[Y]" .planning/ ``` @@ -284,7 +284,7 @@ Set `commit_docs: false` so planning docs stay local and are not committed to an Instead of the standard `commit` command, use `commit-to-subrepo` when `sub_repos` is configured: ```bash -node ~/.claude/get-shit-done/bin/gsd-tools.cjs commit-to-subrepo "feat(02-01): add user API" \ +gsd-sdk query commit-to-subrepo "feat(02-01): add user API" \ --files backend/src/api/users.ts backend/src/types/user.ts frontend/src/components/UserForm.tsx ``` diff --git a/get-shit-done/references/git-planning-commit.md b/get-shit-done/references/git-planning-commit.md index 56e00d5cb..2609aa1aa 100644 --- a/get-shit-done/references/git-planning-commit.md +++ b/get-shit-done/references/git-planning-commit.md @@ -1,13 +1,15 @@ # Git Planning Commit -Commit planning artifacts using the gsd-tools CLI, which automatically checks `commit_docs` config and gitignore status. +Commit planning artifacts via `gsd-sdk query commit`, which checks `commit_docs` config and gitignore status (same behavior as legacy `gsd-tools.cjs commit`). ## Commit via CLI -Always use `gsd-tools.cjs commit` for `.planning/` files — it handles `commit_docs` and gitignore checks automatically: +Pass the message first, then file paths (positional). Do not use `--files` for `commit` (that flag is only for `commit-to-subrepo`). + +Always use this for `.planning/` files — it handles `commit_docs` and gitignore checks automatically: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs({scope}): {description}" --files .planning/STATE.md .planning/ROADMAP.md +gsd-sdk query commit "docs({scope}): {description}" .planning/STATE.md .planning/ROADMAP.md ``` The CLI will return `skipped` (with reason) if `commit_docs` is `false` or `.planning/` is gitignored. No manual conditional checks needed. @@ -17,7 +19,7 @@ The CLI will return `skipped` (with reason) if `commit_docs` is `false` or `.pla To fold `.planning/` file changes into the previous commit: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "" --files .planning/codebase/*.md --amend +gsd-sdk query commit "" .planning/codebase/*.md --amend ``` ## Commit Message Patterns diff --git a/get-shit-done/references/phase-argument-parsing.md b/get-shit-done/references/phase-argument-parsing.md index 193ab14c4..d0081ed5f 100644 --- a/get-shit-done/references/phase-argument-parsing.md +++ b/get-shit-done/references/phase-argument-parsing.md @@ -14,7 +14,7 @@ From `$ARGUMENTS`: The `find-phase` command handles normalization and validation in one step: ```bash -PHASE_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" find-phase "${PHASE}") +PHASE_INFO=$(gsd-sdk query find-phase "${PHASE}") ``` Returns JSON with: @@ -45,7 +45,7 @@ fi Use `roadmap get-phase` to validate phase exists: ```bash -PHASE_CHECK=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" --pick found) +PHASE_CHECK=$(gsd-sdk query roadmap.get-phase "${PHASE}" --pick found) if [ "$PHASE_CHECK" = "false" ]; then echo "ERROR: Phase ${PHASE} not found in roadmap" exit 1 @@ -57,5 +57,5 @@ fi Use `find-phase` for directory lookup: ```bash -PHASE_DIR=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" find-phase "${PHASE}" --raw) +PHASE_DIR=$(gsd-sdk query find-phase "${PHASE}" --raw) ``` diff --git a/get-shit-done/references/planner-revision.md b/get-shit-done/references/planner-revision.md index ff8138729..7a7a79676 100644 --- a/get-shit-done/references/planner-revision.md +++ b/get-shit-done/references/planner-revision.md @@ -55,7 +55,7 @@ Group by plan, dimension, severity. ### Step 6: Commit ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "fix($PHASE): revise plans based on checker feedback" --files .planning/phases/$PHASE-*/$PHASE-*-PLAN.md +gsd-sdk query commit "fix($PHASE): revise plans based on checker feedback" .planning/phases/$PHASE-*/$PHASE-*-PLAN.md ``` ### Step 7: Return Revision Summary diff --git a/get-shit-done/references/planning-config.md b/get-shit-done/references/planning-config.md index c063f0438..921454ebb 100644 --- a/get-shit-done/references/planning-config.md +++ b/get-shit-done/references/planning-config.md @@ -58,15 +58,15 @@ Configuration options for `.planning/` directory behavior. ```bash # Commit with automatic commit_docs + gitignore checks: -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: update state" --files .planning/STATE.md +gsd-sdk query commit "docs: update state" .planning/STATE.md # Load config via state load (returns JSON): -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load) +INIT=$(gsd-sdk query state.load) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi # commit_docs is available in the JSON output # Or use init commands which include commit_docs: -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "1") +INIT=$(gsd-sdk query init.execute-phase "1") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi # commit_docs is included in all init command outputs ``` @@ -76,7 +76,7 @@ if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi **Commit via CLI (handles checks automatically):** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: update state" --files .planning/STATE.md +gsd-sdk query commit "docs: update state" .planning/STATE.md ``` The CLI checks `commit_docs` config and gitignore status internally — no manual conditionals needed. @@ -164,14 +164,14 @@ To use uncommitted mode: Use `init execute-phase` which returns all config as JSON: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "1") +INIT=$(gsd-sdk query init.execute-phase "1") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi # JSON output includes: branching_strategy, phase_branch_template, milestone_branch_template ``` Or use `state load` for the config values: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load) +INIT=$(gsd-sdk query state.load) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi # Parse branching_strategy, phase_branch_template, milestone_branch_template from JSON ``` diff --git a/get-shit-done/references/workstream-flag.md b/get-shit-done/references/workstream-flag.md index 9d6145786..99524423d 100644 --- a/get-shit-done/references/workstream-flag.md +++ b/get-shit-done/references/workstream-flag.md @@ -93,23 +93,19 @@ This ensures workstream scope chains automatically through the workflow: ## CLI Usage ```bash -# GSD_TOOLS resolves to the installed bin path, e.g.: -# $HOME/.claude/get-shit-done/bin/gsd-tools.cjs (global install) -# .claude/get-shit-done/bin/gsd-tools.cjs (local install) - -# All gsd-tools commands accept --ws -node "$GSD_TOOLS" state json --ws feature-a -node "$GSD_TOOLS" find-phase 3 --ws feature-b +# All gsd-sdk query commands accept --ws +gsd-sdk query state.json --ws feature-a +gsd-sdk query find-phase 3 --ws feature-b # Session-local switching without --ws on every command -GSD_SESSION_KEY=my-terminal-a node "$GSD_TOOLS" workstream set feature-a -GSD_SESSION_KEY=my-terminal-a node "$GSD_TOOLS" state json -GSD_SESSION_KEY=my-terminal-b node "$GSD_TOOLS" workstream set feature-b -GSD_SESSION_KEY=my-terminal-b node "$GSD_TOOLS" state json +GSD_SESSION_KEY=my-terminal-a gsd-sdk query workstream.set feature-a +GSD_SESSION_KEY=my-terminal-a gsd-sdk query state.json +GSD_SESSION_KEY=my-terminal-b gsd-sdk query workstream.set feature-b +GSD_SESSION_KEY=my-terminal-b gsd-sdk query state.json # Workstream CRUD -node "$GSD_TOOLS" workstream create -node "$GSD_TOOLS" workstream list -node "$GSD_TOOLS" workstream status -node "$GSD_TOOLS" workstream complete +gsd-sdk query workstream.create +gsd-sdk query workstream.list +gsd-sdk query workstream.status +gsd-sdk query workstream.complete ``` diff --git a/get-shit-done/workflows/add-phase.md b/get-shit-done/workflows/add-phase.md index e8fc06eba..524e17a8b 100644 --- a/get-shit-done/workflows/add-phase.md +++ b/get-shit-done/workflows/add-phase.md @@ -29,7 +29,7 @@ Exit. Load phase operation context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "0") +INIT=$(gsd-sdk query init.phase-op "0") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -42,10 +42,10 @@ Exit. -**Delegate the phase addition to gsd-tools:** +**Delegate the phase addition to `gsd-sdk query phase.add`:** ```bash -RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase add "${description}") +RESULT=$(gsd-sdk query phase.add "${description}") ``` The CLI handles: @@ -104,7 +104,7 @@ Roadmap updated: .planning/ROADMAP.md -- [ ] `gsd-tools phase add` executed successfully +- [ ] `gsd-sdk query phase.add` executed successfully - [ ] Phase directory created - [ ] Roadmap updated with new phase entry - [ ] STATE.md updated with roadmap evolution note diff --git a/get-shit-done/workflows/add-tests.md b/get-shit-done/workflows/add-tests.md index ce87b3c9f..732db4018 100644 --- a/get-shit-done/workflows/add-tests.md +++ b/get-shit-done/workflows/add-tests.md @@ -33,7 +33,7 @@ Exit. Load phase operation context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -300,7 +300,7 @@ Create a test coverage report and present to user: Record test generation in project state: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state-snapshot +gsd-sdk query state-snapshot ``` If there are passing tests to commit: diff --git a/get-shit-done/workflows/add-todo.md b/get-shit-done/workflows/add-todo.md index 002b1c8b8..439859da1 100644 --- a/get-shit-done/workflows/add-todo.md +++ b/get-shit-done/workflows/add-todo.md @@ -12,7 +12,7 @@ Read all files referenced by the invoking prompt's execution_context before star Load todo context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init todos) +INIT=$(gsd-sdk query init.todos) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -86,7 +86,7 @@ Use values from init context: `timestamp` and `date` are already available. Generate slug for the title: ```bash -slug=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" generate-slug "$title" --raw) +slug=$(gsd-sdk query generate-slug "$title" --raw) ``` Write to `.planning/todos/pending/${date}-${slug}.md`: @@ -121,7 +121,7 @@ If `.planning/STATE.md` exists: Commit the todo and any updated state: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: capture todo - [title]" --files .planning/todos/pending/[filename] .planning/STATE.md +gsd-sdk query commit "docs: capture todo - [title]" .planning/todos/pending/[filename] .planning/STATE.md ``` Tool respects `commit_docs` config and gitignore automatically. diff --git a/get-shit-done/workflows/ai-integration-phase.md b/get-shit-done/workflows/ai-integration-phase.md index 5820724a3..e8dcdc222 100644 --- a/get-shit-done/workflows/ai-integration-phase.md +++ b/get-shit-done/workflows/ai-integration-phase.md @@ -20,7 +20,7 @@ This prevents the two most common AI development failures: choosing the wrong fr ## 1. Initialize ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init plan-phase "$PHASE") +INIT=$(gsd-sdk query init.plan-phase "$PHASE") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -30,15 +30,15 @@ Parse JSON for: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded Resolve agent models: ```bash -SELECTOR_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-framework-selector --raw) -RESEARCHER_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-ai-researcher --raw) -DOMAIN_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-domain-researcher --raw) -PLANNER_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-eval-planner --raw) +SELECTOR_MODEL=$(gsd-sdk query resolve-model gsd-framework-selector 2>/dev/null | jq -r '.model' 2>/dev/null || true) +RESEARCHER_MODEL=$(gsd-sdk query resolve-model gsd-ai-researcher 2>/dev/null | jq -r '.model' 2>/dev/null || true) +DOMAIN_MODEL=$(gsd-sdk query resolve-model gsd-domain-researcher 2>/dev/null | jq -r '.model' 2>/dev/null || true) +PLANNER_MODEL=$(gsd-sdk query resolve-model gsd-eval-planner 2>/dev/null | jq -r '.model' 2>/dev/null || true) ``` Check config: ```bash -AI_PHASE_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ai_integration_phase 2>/dev/null || echo "true") +AI_PHASE_ENABLED=$(gsd-sdk query config-get workflow.ai_integration_phase 2>/dev/null || echo "true") ``` **If `AI_PHASE_ENABLED` is `false`:** @@ -54,7 +54,7 @@ Exit workflow. Extract phase number from $ARGUMENTS. If not provided, detect next unplanned phase. ```bash -PHASE_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}") +PHASE_INFO=$(gsd-sdk query roadmap.get-phase "${PHASE}") ``` **If `found` is false:** Error with available phases. diff --git a/get-shit-done/workflows/audit-fix.md b/get-shit-done/workflows/audit-fix.md index c81beab0f..7f7c0074b 100644 --- a/get-shit-done/workflows/audit-fix.md +++ b/get-shit-done/workflows/audit-fix.md @@ -32,7 +32,7 @@ Invoke the source audit command and capture output. For `audit-uat` source: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init audit-uat 2>/dev/null || echo "{}") +INIT=$(gsd-sdk query audit-uat 2>/dev/null || echo "{}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/audit-milestone.md b/get-shit-done/workflows/audit-milestone.md index 282836fe1..ed81cf171 100644 --- a/get-shit-done/workflows/audit-milestone.md +++ b/get-shit-done/workflows/audit-milestone.md @@ -16,23 +16,23 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo ## 0. Initialize Milestone Context ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init milestone-op) +INIT=$(gsd-sdk query init.milestone-op) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_CHECKER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-integration-checker 2>/dev/null) +AGENT_SKILLS_CHECKER=$(gsd-sdk query agent-skills gsd-integration-checker 2>/dev/null) ``` Extract from init JSON: `milestone_version`, `milestone_name`, `phase_count`, `completed_phases`, `commit_docs`. Resolve integration checker model: ```bash -integration_checker_model=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-integration-checker --raw) +integration_checker_model=$(gsd-sdk query resolve-model gsd-integration-checker --raw) ``` ## 1. Determine Milestone Scope ```bash # Get phases in milestone (sorted numerically, handles decimals) -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phases list +gsd-sdk query phases.list ``` - Parse version from arguments or detect current from ROADMAP.md @@ -46,7 +46,7 @@ For each phase directory, read the VERIFICATION.md: ```bash # For each phase, use find-phase to resolve the directory (handles archived phases) -PHASE_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" find-phase 01 --raw) +PHASE_INFO=$(gsd-sdk query find-phase 01 --raw) # Extract directory from JSON, then read VERIFICATION.md from that directory # Repeat for each phase number from ROADMAP.md ``` @@ -113,7 +113,7 @@ For each phase's SUMMARY.md, extract `requirements-completed` from YAML frontmat ```bash for summary in .planning/phases/*-*/*-SUMMARY.md; do [ -e "$summary" ] || continue - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" summary-extract "$summary" --fields requirements_completed --pick requirements_completed + gsd-sdk query summary-extract "$summary" --fields requirements_completed --pick requirements_completed done ``` @@ -141,7 +141,7 @@ For each REQ-ID, determine status using all three sources: Skip if `workflow.nyquist_validation` is explicitly `false` (absent = enabled). ```bash -NYQUIST_CONFIG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.nyquist_validation --raw 2>/dev/null) +NYQUIST_CONFIG=$(gsd-sdk query config-get workflow.nyquist_validation --raw 2>/dev/null) ``` If `false`: skip entirely. diff --git a/get-shit-done/workflows/audit-uat.md b/get-shit-done/workflows/audit-uat.md index 80fe1b1f2..29afc946f 100644 --- a/get-shit-done/workflows/audit-uat.md +++ b/get-shit-done/workflows/audit-uat.md @@ -8,7 +8,7 @@ Cross-phase audit of all UAT and verification files. Finds every outstanding ite Run the CLI audit: ```bash -AUDIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" audit-uat --raw) +AUDIT=$(gsd-sdk query audit-uat --raw) ``` Parse JSON for `results` array and `summary` object. diff --git a/get-shit-done/workflows/autonomous.md b/get-shit-done/workflows/autonomous.md index 2f50389b5..49fdf430c 100644 --- a/get-shit-done/workflows/autonomous.md +++ b/get-shit-done/workflows/autonomous.md @@ -48,7 +48,7 @@ When `--interactive` is set, discuss runs inline with questions (not auto-answer Bootstrap via milestone-level init: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init milestone-op) +INIT=$(gsd-sdk query init.milestone-op) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -82,7 +82,7 @@ If `INTERACTIVE` is set, display: `Mode: Interactive (discuss inline, plan+execu Run phase discovery: ```bash -ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze) +ROADMAP=$(gsd-sdk query roadmap.analyze) ``` Parse the JSON `phases` array. @@ -141,7 +141,7 @@ Exit cleanly. **Fetch details for each phase:** ```bash -DETAIL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM}) +DETAIL=$(gsd-sdk query roadmap.get-phase ${PHASE_NUM}) ``` Extract `phase_name`, `goal`, `success_criteria` from each. Store for use in execute_phase and transition messages. @@ -169,7 +169,7 @@ Where N = current phase number (from the ROADMAP, e.g., 63), T = total milestone Check if CONTEXT.md already exists for this phase: ```bash -PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM}) +PHASE_STATE=$(gsd-sdk query init.phase-op ${PHASE_NUM}) ``` Parse `has_context` from JSON. @@ -185,7 +185,7 @@ Proceed to 3b. **If has_context is false:** Check if discuss is disabled via settings: ```bash -SKIP_DISCUSS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.skip_discuss 2>/dev/null || echo "false") +SKIP_DISCUSS=$(gsd-sdk query config-get workflow.skip_discuss 2>/dev/null || echo "false") ``` **If SKIP_DISCUSS is `true`:** Skip discuss entirely — the ROADMAP phase description is the spec. Display: @@ -197,7 +197,7 @@ Phase ${PHASE_NUM}: Discuss skipped (workflow.skip_discuss=true) — using ROADM Write a minimal CONTEXT.md so downstream plan-phase has valid input. Get phase details: ```bash -DETAIL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM}) +DETAIL=$(gsd-sdk query roadmap.get-phase ${PHASE_NUM}) ``` Extract `goal` and `requirements` from JSON. Write `${phase_dir}/${padded_phase}-CONTEXT.md` with: @@ -249,7 +249,7 @@ None — discuss phase skipped. Commit the minimal context: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${PADDED_PHASE}): auto-generated context (discuss skipped)" --files "${phase_dir}/${padded_phase}-CONTEXT.md" +gsd-sdk query commit "docs(${PADDED_PHASE}): auto-generated context (discuss skipped)" "${phase_dir}/${padded_phase}-CONTEXT.md" ``` Proceed to 3b. @@ -270,7 +270,7 @@ Skill(skill="gsd:discuss-phase", args="${PHASE_NUM}") After discuss completes (either mode), verify context was written: ```bash -PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM}) +PHASE_STATE=$(gsd-sdk query init.phase-op ${PHASE_NUM}) ``` Check `has_context`. If false → go to handle_blocker: "Discuss for phase ${PHASE_NUM} did not produce CONTEXT.md." @@ -280,7 +280,7 @@ Check `has_context`. If false → go to handle_blocker: "Discuss for phase ${PHA Check if this phase has frontend indicators and whether a UI-SPEC already exists: ```bash -PHASE_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase ${PHASE_NUM} 2>/dev/null) +PHASE_SECTION=$(gsd-sdk query roadmap.get-phase ${PHASE_NUM} 2>/dev/null) echo "$PHASE_SECTION" | grep -iE "UI|interface|frontend|component|layout|page|screen|view|form|dashboard|widget" > /dev/null 2>&1 HAS_UI=$? UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1) @@ -289,7 +289,7 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1) Check if UI phase workflow is enabled: ```bash -UI_PHASE_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true") +UI_PHASE_CFG=$(gsd-sdk query config-get workflow.ui_phase 2>/dev/null || echo "true") ``` **If `HAS_UI` is 0 (frontend indicators found) AND `UI_SPEC_FILE` is empty (no UI-SPEC exists) AND `UI_PHASE_CFG` is not `false`:** @@ -362,7 +362,7 @@ Auto-invoke code review and fix chain. Autonomous mode chains both review and fi **Config gate:** ```bash -CODE_REVIEW_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true") +CODE_REVIEW_ENABLED=$(gsd-sdk query config-get workflow.code_review 2>/dev/null || echo "true") ``` If `"false"`: display "Code review skipped (workflow.code_review=false)" and proceed to 3d. @@ -390,7 +390,7 @@ VERIFY_STATUS=$(grep "^status:" "${PHASE_DIR}"/*-VERIFICATION.md 2>/dev/null | h Where `PHASE_DIR` comes from the `init phase-op` call already made in step 3a. If the variable is not in scope, re-fetch: ```bash -PHASE_STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op ${PHASE_NUM}) +PHASE_STATE=$(gsd-sdk query init.phase-op ${PHASE_NUM}) ``` Parse `phase_dir` from the JSON. @@ -486,7 +486,7 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1) Check if UI review is enabled: ```bash -UI_REVIEW_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_review 2>/dev/null || echo "true") +UI_REVIEW_CFG=$(gsd-sdk query config-get workflow.ui_review 2>/dev/null || echo "true") ``` **If `UI_SPEC_FILE` is not empty AND `UI_REVIEW_CFG` is not `false`:** @@ -545,7 +545,7 @@ Proceed directly to lifecycle step (which handles partial completion — skips a **Otherwise:** After each phase completes, re-read ROADMAP.md to catch phases inserted mid-execution (decimal phases like 5.1): ```bash -ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze) +ROADMAP=$(gsd-sdk query roadmap.analyze) ``` Re-filter incomplete phases using the same logic as discover_phases: diff --git a/get-shit-done/workflows/check-todos.md b/get-shit-done/workflows/check-todos.md index 6d0a141ca..0180c404f 100644 --- a/get-shit-done/workflows/check-todos.md +++ b/get-shit-done/workflows/check-todos.md @@ -12,7 +12,7 @@ Read all files referenced by the invoking prompt's execution_context before star Load todo context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init todos) +INIT=$(gsd-sdk query init.todos) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -157,7 +157,7 @@ If todo was moved to done/, commit the change: ```bash git rm --cached .planning/todos/pending/[filename] 2>/dev/null || true -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: start work on todo - [title]" --files .planning/todos/completed/[filename] .planning/STATE.md +gsd-sdk query commit "docs: start work on todo - [title]" .planning/todos/completed/[filename] .planning/STATE.md ``` Tool respects `commit_docs` config and gitignore automatically. diff --git a/get-shit-done/workflows/cleanup.md b/get-shit-done/workflows/cleanup.md index 41a201aca..534d33842 100644 --- a/get-shit-done/workflows/cleanup.md +++ b/get-shit-done/workflows/cleanup.md @@ -124,7 +124,7 @@ Repeat for all milestones in the cleanup set. Commit the changes: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "chore: archive phase directories from completed milestones" --files .planning/milestones/ .planning/phases/ +gsd-sdk query commit "chore: archive phase directories from completed milestones" .planning/milestones/ .planning/phases/ ``` diff --git a/get-shit-done/workflows/code-review-fix.md b/get-shit-done/workflows/code-review-fix.md index 41ca23eb2..ed3e2c486 100644 --- a/get-shit-done/workflows/code-review-fix.md +++ b/get-shit-done/workflows/code-review-fix.md @@ -18,7 +18,7 @@ Parse arguments and load project state: ```bash PHASE_ARG="${1}" -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -74,7 +74,7 @@ FIX_REPORT_PATH="${PHASE_DIR}/${PADDED_PHASE}-REVIEW-FIX.md" Check if code review is enabled via config: ```bash -CODE_REVIEW_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true") +CODE_REVIEW_ENABLED=$(gsd-sdk query config-get workflow.code_review 2>/dev/null || echo "true") ``` If CODE_REVIEW_ENABLED is "false": @@ -359,7 +359,7 @@ if [ -f "${FIX_REPORT_PATH}" ]; then echo "REVIEW-FIX.md created at ${FIX_REPORT_PATH}" if [ "$COMMIT_DOCS" = "true" ]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit \ + gsd-sdk query commit \ "docs(${PADDED_PHASE}): add code review fix report" \ --files "${FIX_REPORT_PATH}" fi diff --git a/get-shit-done/workflows/code-review.md b/get-shit-done/workflows/code-review.md index bf07b8606..5c5b0ea54 100644 --- a/get-shit-done/workflows/code-review.md +++ b/get-shit-done/workflows/code-review.md @@ -17,7 +17,7 @@ Parse arguments and load project state: ```bash PHASE_ARG="${1}" -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -74,7 +74,7 @@ fi Check if code review is enabled via config: ```bash -CODE_REVIEW_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true") +CODE_REVIEW_ENABLED=$(gsd-sdk query config-get workflow.code_review 2>/dev/null || echo "true") ``` If CODE_REVIEW_ENABLED is "false": @@ -90,14 +90,14 @@ Default is true — only skip on explicit false. This check runs AFTER phase val Determine review depth with priority order: 1. DEPTH_OVERRIDE from --depth flag (highest priority) -2. Config value: `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review_depth 2>/dev/null` +2. Config value: `gsd-sdk query config-get workflow.code_review_depth 2>/dev/null` 3. Default: "standard" ```bash if [ -n "$DEPTH_OVERRIDE" ]; then REVIEW_DEPTH="$DEPTH_OVERRIDE" else - CONFIG_DEPTH=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review_depth 2>/dev/null || echo "") + CONFIG_DEPTH=$(gsd-sdk query config-get workflow.code_review_depth 2>/dev/null || echo "") REVIEW_DEPTH="${CONFIG_DEPTH:-standard}" fi ``` @@ -395,7 +395,7 @@ if [ -f "${REVIEW_PATH}" ]; then echo "REVIEW.md created at ${REVIEW_PATH}" if [ "$COMMIT_DOCS" = "true" ]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit \ + gsd-sdk query commit \ "docs(${PADDED_PHASE}): add code review report" \ --files "${REVIEW_PATH}" fi diff --git a/get-shit-done/workflows/complete-milestone.md b/get-shit-done/workflows/complete-milestone.md index 6f1ea3fc7..9d5e2a6a5 100644 --- a/get-shit-done/workflows/complete-milestone.md +++ b/get-shit-done/workflows/complete-milestone.md @@ -38,7 +38,9 @@ When a milestone completes: -Before proceeding with milestone close, run the comprehensive open artifact audit: +Before proceeding with milestone close, run the comprehensive open artifact audit. + +`audit-open` is not registered on `gsd-sdk query` yet; use the installed CJS CLI: ```bash node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" audit-open 2>/dev/null @@ -76,7 +78,7 @@ If user chooses [A] (Acknowledge): If output shows all clear (no open items): print `All artifact types clear.` and proceed. -SECURITY: Audit JSON output is structured data from gsd-tools.cjs — validated and sanitized at source. When writing to STATE.md, item slugs and descriptions are sanitized via `sanitizeForDisplay()` before inclusion. Never inject raw user-supplied content into STATE.md without sanitization. +SECURITY: Audit JSON output is structured data from `audit-open` (gsd-tools.cjs) — validated and sanitized at source. When writing to STATE.md, item slugs and descriptions are sanitized via `sanitizeForDisplay()` before inclusion. Never inject raw user-supplied content into STATE.md without sanitization. @@ -84,7 +86,7 @@ SECURITY: Audit JSON output is structured data from gsd-tools.cjs — validated **Use `roadmap analyze` for comprehensive readiness check:** ```bash -ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze) +ROADMAP=$(gsd-sdk query roadmap.analyze) ``` This returns all phases with plan/summary counts and disk status. Use this to verify: @@ -199,7 +201,7 @@ Extract one-liners from SUMMARY.md files using summary-extract: # For each phase in milestone, extract one-liner for summary in .planning/phases/*-*/*-SUMMARY.md; do [ -e "$summary" ] || continue - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" summary-extract "$summary" --fields one_liner --pick one_liner + gsd-sdk query summary-extract "$summary" --fields one_liner --pick one_liner done ``` @@ -218,7 +220,7 @@ Key accomplishments for this milestone: -**Note:** MILESTONES.md entry is now created automatically by `gsd-tools milestone complete` in the archive_milestone step. The entry includes version, date, phase/plan/task counts, and accomplishments extracted from SUMMARY.md files. +**Note:** MILESTONES.md entry is now created automatically by `gsd-sdk query milestone.complete` in the archive_milestone step. The entry includes version, date, phase/plan/task counts, and accomplishments extracted from SUMMARY.md files. If additional details are needed (e.g., user-provided "Delivered" summary, git range, LOC stats), add them manually after the CLI creates the base entry. @@ -409,10 +411,10 @@ Update `.planning/ROADMAP.md` — group completed milestone phases: -**Delegate archival to gsd-tools:** +**Delegate archival to `gsd-sdk query milestone.complete`:** ```bash -ARCHIVE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" milestone complete "v[X.Y]" --name "[Milestone Name]") +ARCHIVE=$(gsd-sdk query milestone.complete "v[X.Y]" --name "[Milestone Name]") ``` The CLI handles: @@ -494,7 +496,7 @@ Append the extracted Backlog content verbatim to the end of the newly written RO **Safety commit — commit archive files BEFORE deleting any originals:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "chore: archive v[X.Y] milestone files" --files .planning/milestones/v[X.Y]-ROADMAP.md .planning/milestones/v[X.Y]-REQUIREMENTS.md .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md .planning/MILESTONES.md .planning/PROJECT.md .planning/STATE.md .planning/ROADMAP.md +gsd-sdk query commit "chore: archive v[X.Y] milestone files" .planning/milestones/v[X.Y]-ROADMAP.md .planning/milestones/v[X.Y]-REQUIREMENTS.md .planning/milestones/v[X.Y]-MILESTONE-AUDIT.md .planning/MILESTONES.md .planning/PROJECT.md .planning/STATE.md .planning/ROADMAP.md ``` This creates a durable checkpoint in git history. If anything fails after this point, the working tree can be reconstructed from git. @@ -563,7 +565,7 @@ If the "## Cross-Milestone Trends" section exists, update the tables with new da **Commit:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: update retrospective for v${VERSION}" --files .planning/RETROSPECTIVE.md +gsd-sdk query commit "docs: update retrospective for v${VERSION}" .planning/RETROSPECTIVE.md ``` @@ -597,7 +599,7 @@ Check branching strategy and offer merge options. Use `init milestone-op` for context, or load config directly: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "1") +INIT=$(gsd-sdk query init.execute-phase "1") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -605,7 +607,7 @@ Extract `branching_strategy`, `phase_branch_template`, `milestone_branch_templat Detect base branch: ```bash -BASE_BRANCH=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get git.base_branch 2>/dev/null || echo "") +BASE_BRANCH=$(gsd-sdk query config-get git.base_branch 2>/dev/null || echo "") if [ -z "$BASE_BRANCH" ] || [ "$BASE_BRANCH" = "null" ]; then BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|^refs/remotes/origin/||') BASE_BRANCH="${BASE_BRANCH:-main}" diff --git a/get-shit-done/workflows/diagnose-issues.md b/get-shit-done/workflows/diagnose-issues.md index 47cab374b..79e350842 100644 --- a/get-shit-done/workflows/diagnose-issues.md +++ b/get-shit-done/workflows/diagnose-issues.md @@ -58,7 +58,7 @@ gaps = [ **Read worktree config:** ```bash -USE_WORKTREES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true") +USE_WORKTREES=$(gsd-sdk query config-get workflow.use_worktrees 2>/dev/null || echo "true") ``` **Report diagnosis plan to user:** @@ -87,7 +87,7 @@ This runs in parallel - all gaps investigated simultaneously. **Load agent skills:** ```bash -AGENT_SKILLS_DEBUGGER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-debugger 2>/dev/null) +AGENT_SKILLS_DEBUGGER=$(gsd-sdk query agent-skills gsd-debugger 2>/dev/null) EXPECTED_BASE=$(git rev-parse HEAD) ``` @@ -177,7 +177,7 @@ Update status in frontmatter to "diagnosed". Commit the updated UAT.md: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs({phase_num}): add root causes from diagnosis" --files ".planning/phases/XX-name/{phase_num}-UAT.md" +gsd-sdk query commit "docs({phase_num}): add root causes from diagnosis" ".planning/phases/XX-name/{phase_num}-UAT.md" ``` diff --git a/get-shit-done/workflows/discuss-phase-assumptions.md b/get-shit-done/workflows/discuss-phase-assumptions.md index 265eba4f9..5aee97cec 100644 --- a/get-shit-done/workflows/discuss-phase-assumptions.md +++ b/get-shit-done/workflows/discuss-phase-assumptions.md @@ -64,9 +64,9 @@ plain-text numbered list and ask the user to type their choice number. Phase number from argument (required). ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE}") +INIT=$(gsd-sdk query init.phase-op "${PHASE}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_ANALYZER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-assumptions-analyzer 2>/dev/null) +AGENT_SKILLS_ANALYZER=$(gsd-sdk query agent-skills gsd-assumptions-analyzer 2>/dev/null) ``` Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, @@ -171,7 +171,7 @@ Structure the extracted information for use in assumption generation. Check if any pending todos are relevant to this phase's scope. ```bash -TODO_MATCHES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" todo match-phase "${PHASE_NUMBER}") +TODO_MATCHES=$(gsd-sdk query todo.match-phase "${PHASE_NUMBER}") ``` Parse JSON for: `todo_count`, `matches[]`. @@ -548,7 +548,7 @@ Write file. Commit phase context and discussion log: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): capture phase context (assumptions mode)" --files "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md" +gsd-sdk query commit "docs(${padded_phase}): capture phase context (assumptions mode)" "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md" ``` Confirm: "Committed: docs(${padded_phase}): capture phase context (assumptions mode)" @@ -558,7 +558,7 @@ Confirm: "Committed: docs(${padded_phase}): capture phase context (assumptions m Update STATE.md with session info: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \ +gsd-sdk query state.record-session \ --stopped-at "Phase ${PHASE} context gathered (assumptions mode)" \ --resume-file "${phase_dir}/${padded_phase}-CONTEXT.md" ``` @@ -566,7 +566,7 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \ Commit STATE.md: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md +gsd-sdk query commit "docs(state): record phase ${PHASE} context session" .planning/STATE.md ``` @@ -619,18 +619,18 @@ Check for auto-advance trigger: 2. Sync chain flag: ```bash if [[ ! "$ARGUMENTS" =~ --auto ]]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null + gsd-sdk query config-set workflow._auto_chain_active false 2>/dev/null fi ``` 3. Read chain flag and user preference: ```bash - AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false") - AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false") + AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false") + AUTO_CFG=$(gsd-sdk query config-get workflow.auto_advance 2>/dev/null || echo "false") ``` **If `--auto` flag present AND `AUTO_CHAIN` is not true:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true +gsd-sdk query config-set workflow._auto_chain_active true ``` **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:** diff --git a/get-shit-done/workflows/discuss-phase.md b/get-shit-done/workflows/discuss-phase.md index 7ab323120..46d0cded0 100644 --- a/get-shit-done/workflows/discuss-phase.md +++ b/get-shit-done/workflows/discuss-phase.md @@ -134,7 +134,7 @@ cannot forward TUI menu selections back to the host. Enable text mode: - Per-session: pass `--text` flag to any command (e.g., `/gsd-discuss-phase --text`) -- Per-project: `gsd-tools config-set workflow.text_mode true` +- Per-project: `gsd-sdk query config-set workflow.text_mode true` Text mode applies to ALL workflows in the session, not just discuss-phase. @@ -147,9 +147,9 @@ Text mode applies to ALL workflows in the session, not just discuss-phase. Phase number from argument (required). ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE}") +INIT=$(gsd-sdk query init.phase-op "${PHASE}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_ADVISOR=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-advisor 2>/dev/null) +AGENT_SKILLS_ADVISOR=$(gsd-sdk query agent-skills gsd-advisor 2>/dev/null) ``` Parse JSON for: `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_research`, `has_context`, `has_plans`, `has_verification`, `plan_count`, `roadmap_exists`, `planning_exists`, `response_language`. @@ -338,7 +338,7 @@ Check if any pending todos are relevant to this phase's scope. Surfaces backlog **Load and match todos:** ```bash -TODO_MATCHES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" todo match-phase "${PHASE_NUMBER}") +TODO_MATCHES=$(gsd-sdk query todo.match-phase "${PHASE_NUMBER}") ``` Parse JSON for: `todo_count`, `matches[]` (each with `file`, `title`, `area`, `score`, `reasons`). @@ -463,7 +463,7 @@ Check if advisor mode should activate: 3. Resolve model for advisor agents: ```bash - ADVISOR_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-advisor-researcher --raw) + ADVISOR_MODEL=$(gsd-sdk query resolve-model gsd-advisor-researcher --raw) ``` If ADVISOR_MODE is false, skip all advisor-specific steps — workflow proceeds with existing conversational flow unchanged. @@ -766,7 +766,7 @@ In `--auto` mode, the discuss step MUST complete in a **single pass**. After wri Check the pass cap from config: ```bash -MAX_PASSES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.max_discuss_passes 2>/dev/null || echo "3") +MAX_PASSES=$(gsd-sdk query config-get workflow.max_discuss_passes 2>/dev/null || echo "3") ``` If you have already written and committed CONTEXT.md, the discuss step is complete. Move on. @@ -1112,7 +1112,7 @@ rm -f "${phase_dir}/${padded_phase}-DISCUSS-CHECKPOINT.json" Commit phase context and discussion log: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): capture phase context" --files "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md" +gsd-sdk query commit "docs(${padded_phase}): capture phase context" "${phase_dir}/${padded_phase}-CONTEXT.md" "${phase_dir}/${padded_phase}-DISCUSSION-LOG.md" ``` Confirm: "Committed: docs(${padded_phase}): capture phase context" @@ -1122,7 +1122,7 @@ Confirm: "Committed: docs(${padded_phase}): capture phase context" Update STATE.md with session info: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \ +gsd-sdk query state.record-session \ --stopped-at "Phase ${PHASE} context gathered" \ --resume-file "${phase_dir}/${padded_phase}-CONTEXT.md" ``` @@ -1130,7 +1130,7 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \ Commit STATE.md: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(state): record phase ${PHASE} context session" --files .planning/STATE.md +gsd-sdk query commit "docs(state): record phase ${PHASE} context session" .planning/STATE.md ``` @@ -1141,18 +1141,18 @@ Check for auto-advance trigger: 2. **Sync chain flag with intent** — if user invoked manually (no `--auto` and no `--chain`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference): ```bash if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null + gsd-sdk query config-set workflow._auto_chain_active false 2>/dev/null fi ``` 3. Read both the chain flag and user preference: ```bash - AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false") - AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false") + AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false") + AUTO_CFG=$(gsd-sdk query config-get workflow.auto_advance 2>/dev/null || echo "false") ``` **If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct usage without new-project): ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true +gsd-sdk query config-set workflow._auto_chain_active true ``` **If `--auto` flag present OR `--chain` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true:** diff --git a/get-shit-done/workflows/do.md b/get-shit-done/workflows/do.md index 9d78e210d..89c8e337b 100644 --- a/get-shit-done/workflows/do.md +++ b/get-shit-done/workflows/do.md @@ -26,7 +26,7 @@ Wait for response before continuing. **Check if project exists.** ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load 2>/dev/null) +INIT=$(gsd-sdk query state.load 2>/dev/null) ``` Track whether `.planning/` exists — some routes require it, others don't. diff --git a/get-shit-done/workflows/docs-update.md b/get-shit-done/workflows/docs-update.md index 4a7032411..64a2f6c5a 100644 --- a/get-shit-done/workflows/docs-update.md +++ b/get-shit-done/workflows/docs-update.md @@ -14,9 +14,9 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo Load docs-update context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" docs-init) +INIT=$(gsd-sdk query docs-init) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-doc-writer 2>/dev/null) +AGENT_SKILLS=$(gsd-sdk query agent-skills gsd-doc-writer 2>/dev/null) ``` Extract from init JSON: @@ -1054,7 +1054,7 @@ Only run this step if `commit_docs` is `true` from the init JSON. If `commit_doc Assemble the list of files that were actually generated (do not include files that failed or were skipped): ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: generate project documentation" \ +gsd-sdk query commit "docs: generate project documentation" \ --files README.md docs/ARCHITECTURE.md docs/CONFIGURATION.md docs/GETTING-STARTED.md docs/DEVELOPMENT.md docs/TESTING.md # Append any conditional docs that were generated: # --files ... docs/API.md docs/DEPLOYMENT.md CONTRIBUTING.md diff --git a/get-shit-done/workflows/eval-review.md b/get-shit-done/workflows/eval-review.md index d78187a66..90b679018 100644 --- a/get-shit-done/workflows/eval-review.md +++ b/get-shit-done/workflows/eval-review.md @@ -13,14 +13,14 @@ Use after /gsd-execute-phase to verify that the evaluation strategy from AI-SPEC ## 0. Initialize ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `commit_docs`. ```bash -AUDITOR_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-eval-auditor --raw) +AUDITOR_MODEL=$(gsd-sdk query resolve-model gsd-eval-auditor 2>/dev/null | jq -r '.model' 2>/dev/null || true) ``` Display banner: diff --git a/get-shit-done/workflows/execute-phase.md b/get-shit-done/workflows/execute-phase.md index 4308ea78e..b89a5e14b 100644 --- a/get-shit-done/workflows/execute-phase.md +++ b/get-shit-done/workflows/execute-phase.md @@ -67,9 +67,9 @@ If `--wave` is absent, preserve the current behavior of executing all incomplete Load all context in one call: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "${PHASE_ARG}") +INIT=$(gsd-sdk query init.execute-phase "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-executor 2>/dev/null) +AGENT_SKILLS=$(gsd-sdk query agent-skills gsd-executor 2>/dev/null) ``` Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelization`, `branching_strategy`, `branch_name`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `plans`, `incomplete_plans`, `plan_count`, `incomplete_count`, `state_exists`, `roadmap_exists`, `phase_req_ids`, `response_language`. @@ -79,7 +79,7 @@ Parse JSON for: `executor_model`, `verifier_model`, `commit_docs`, `parallelizat Read worktree config: ```bash -USE_WORKTREES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true") +USE_WORKTREES=$(gsd-sdk query config-get workflow.use_worktrees 2>/dev/null || echo "true") ``` If the project uses git submodules, worktree isolation is skipped regardless of the `workflow.use_worktrees` config — the executor commit protocol cannot correctly handle submodule commits inside isolated worktrees. Sequential execution handles submodules transparently. @@ -96,7 +96,7 @@ When `USE_WORKTREES` is `false`, all executor agents run without `isolation="wor Read context window size for adaptive prompt enrichment: ```bash -CONTEXT_WINDOW=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get context_window 2>/dev/null || echo "200000") +CONTEXT_WINDOW=$(gsd-sdk query config-get context_window 2>/dev/null || echo "200000") ``` When `CONTEXT_WINDOW >= 500000` (1M-class models), subagent prompts include richer context: @@ -128,7 +128,7 @@ inline path for each plan. ```bash # REQUIRED: prevents stale auto-chain from previous --auto runs if [[ ! "$ARGUMENTS" =~ --auto ]]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null + gsd-sdk query config-set workflow._auto_chain_active false 2>/dev/null fi ``` @@ -225,7 +225,7 @@ Report: "Found {plan_count} plans in {phase_dir} ({incomplete_count} incomplete) **Update STATE.md for phase start:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state begin-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}" +gsd-sdk query state.begin-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}" ``` This updates Status, Last Activity, Current focus, Current Position, and plan counts in STATE.md so frontmatter and body text reflect the active phase immediately. @@ -234,7 +234,7 @@ This updates Status, Last Activity, Current focus, Current Position, and plan co Load plan inventory with wave grouping in one call: ```bash -PLAN_INDEX=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}") +PLAN_INDEX=$(gsd-sdk query phase-plan-index "${PHASE_NUMBER}") ``` Parse JSON for: `phase`, `plans[]` (each with `id`, `wave`, `autonomous`, `objective`, `files_modified`, `task_count`, `has_summary`), `waves` (map of wave number → plan IDs), `incomplete`, `has_checkpoints`. @@ -276,15 +276,15 @@ executor skips them. `workflow.cross_ai_execution` is `true`. Plans matching both conditions are marked for cross-AI. ```bash -CROSS_AI_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.cross_ai_execution --default false 2>/dev/null) -CROSS_AI_CMD=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.cross_ai_command --default "" 2>/dev/null) -CROSS_AI_TIMEOUT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.cross_ai_timeout --default 300 2>/dev/null) +CROSS_AI_ENABLED=$(gsd-sdk query config-get workflow.cross_ai_execution 2>/dev/null || echo "false") +CROSS_AI_CMD=$(gsd-sdk query config-get workflow.cross_ai_command 2>/dev/null || echo "") +CROSS_AI_TIMEOUT=$(gsd-sdk query config-get workflow.cross_ai_timeout 2>/dev/null || echo "300") ``` **If no plans are marked for cross-AI:** Skip to execute_waves. **If plans are marked but `cross_ai_command` is empty:** Error — tell user to set -`workflow.cross_ai_command` via `gsd-tools.cjs config-set workflow.cross_ai_command ""`. +`workflow.cross_ai_command` via `gsd-sdk query config-set workflow.cross_ai_command ""`. **For each cross-AI plan (sequentially):** @@ -463,7 +463,7 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT You are running as a PARALLEL executor agent in a git worktree. Use --no-verify on all git commits to avoid pre-commit hook contention with other agents. The orchestrator validates hooks once after all agents complete. - For gsd-tools commits: add --no-verify flag. + For `gsd-sdk query commit` (or legacy `gsd-tools.cjs` commit): add --no-verify flag when needed. For direct git commits: use git commit --no-verify -m "..." IMPORTANT: Do NOT modify STATE.md or ROADMAP.md. execute-plan.md @@ -646,7 +646,7 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT if ! git diff --quiet .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || \ [ -n "$DELETED_FILES" ]; then # Only amend the commit with .planning/ files if commit_docs is enabled (#1783) - COMMIT_DOCS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get commit_docs 2>/dev/null || echo "true") + COMMIT_DOCS=$(gsd-sdk query config-get commit_docs 2>/dev/null || echo "true") if [ "$COMMIT_DOCS" != "false" ]; then git add .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || true git commit --amend --no-edit 2>/dev/null || true @@ -737,12 +737,12 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT if [ "${TEST_EXIT}" -eq 0 ]; then # Update ROADMAP plan progress for each completed plan in this wave for plan_id in {completed_plan_ids}; do - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap update-plan-progress "${PHASE_NUMBER}" "${plan_id}" "complete" + gsd-sdk query roadmap.update-plan-progress "${PHASE_NUMBER}" "${plan_id}" "complete" done # Only commit tracking files if they actually changed if ! git diff --quiet .planning/ROADMAP.md .planning/STATE.md 2>/dev/null; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-${PHASE_NUMBER}): update tracking after wave ${N}" --files .planning/ROADMAP.md .planning/STATE.md + gsd-sdk query commit "docs(phase-${PHASE_NUMBER}): update tracking after wave ${N}" .planning/ROADMAP.md .planning/STATE.md fi elif [ "${TEST_EXIT}" -eq 124 ]; then echo "⚠ Skipping tracking update — test suite timed out. Plans remain in-progress. Run tests manually to confirm." @@ -819,7 +819,7 @@ Execute each selected wave in sequence. Within a wave: parallel if `PARALLELIZAT Before spawning wave N+1, for each plan in the upcoming wave: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify key-links {phase_dir}/{plan}-PLAN.md + gsd-sdk query verify.key-links {phase_dir}/{plan}-PLAN.md ``` If any key-link from a PRIOR wave's artifact fails verification: @@ -848,8 +848,8 @@ Plans with `autonomous: false` require user interaction. Read auto-advance config (chain flag + user preference): ```bash -AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false") -AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false") +AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false") +AUTO_CFG=$(gsd-sdk query config-get workflow.auto_advance 2>/dev/null || echo "false") ``` When executor returns a checkpoint AND (`AUTO_CHAIN` is `"true"` OR `AUTO_CFG` is `"true"`): @@ -910,7 +910,7 @@ After all waves: **Security gate check:** ```bash -SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") +SECURITY_CFG=$(gsd-sdk query config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1) ``` @@ -934,7 +934,7 @@ If `SECURITY_CFG` is `true` AND SECURITY.md exists: check frontmatter `threats_o **Optional step — TDD collaborative review.** ```bash -TDD_MODE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.tdd_mode --default false 2>/dev/null) +TDD_MODE=$(gsd-sdk query config-get workflow.tdd_mode 2>/dev/null || echo "false") ``` **Skip if `TDD_MODE` is `false`.** @@ -978,7 +978,7 @@ TDD_PLANS=$(grep -rl "^type: tdd" "${PHASE_DIR}"/*-PLAN.md 2>/dev/null | wc -l | If `WAVE_FILTER` was used, re-run plan discovery after execution: ```bash -POST_PLAN_INDEX=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase-plan-index "${PHASE_NUMBER}") +POST_PLAN_INDEX=$(gsd-sdk query phase-plan-index "${PHASE_NUMBER}") ``` Apply the same "incomplete" filtering rules as earlier: @@ -1010,7 +1010,7 @@ Selected wave finished successfully. This phase still has incomplete plans, so p **Config gate:** ```bash -CODE_REVIEW_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true") +CODE_REVIEW_ENABLED=$(gsd-sdk query config-get workflow.code_review 2>/dev/null || echo "true") ``` If `CODE_REVIEW_ENABLED` is `"false"`: display "Code review skipped (workflow.code_review=false)" and proceed to next step. @@ -1053,7 +1053,7 @@ fi **2. Find parent UAT file:** ```bash -PARENT_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" find-phase "${PARENT_PHASE}" --raw) +PARENT_INFO=$(gsd-sdk query find-phase "${PARENT_PHASE}" --raw) # Extract directory from PARENT_INFO JSON, then find UAT file in that directory ``` @@ -1084,7 +1084,7 @@ mv .planning/debug/{slug}.md .planning/debug/resolved/ **6. Commit updated artifacts:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" --files .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md +gsd-sdk query commit "docs(phase-${PARENT_PHASE}): resolve UAT gaps and debug sessions after ${PHASE_NUMBER} gap closure" .planning/phases/*${PARENT_PHASE}*/*-UAT.md .planning/debug/resolved/*.md ``` @@ -1157,7 +1157,7 @@ build/types pass because TypeScript types come from config, not the live databas **Run after execution completes but BEFORE verification marks success.** ```bash -SCHEMA_DRIFT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify schema-drift "${PHASE_NUMBER}" 2>/dev/null) +SCHEMA_DRIFT=$(gsd-sdk query verify.schema-drift "${PHASE_NUMBER}" 2>/dev/null) ``` Parse JSON result for: `drift_detected`, `blocking`, `schema_files`, `orms`, `unpushed_orms`, `message`. @@ -1220,7 +1220,7 @@ If `TEXT_MODE` is true, present as a plain-text numbered list. Otherwise use Ask Verify phase achieved its GOAL, not just completed tasks. ```bash -VERIFIER_SKILLS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-verifier 2>/dev/null) +VERIFIER_SKILLS=$(gsd-sdk query agent-skills gsd-verifier 2>/dev/null) ``` ``` @@ -1303,7 +1303,7 @@ blocked: 0 Commit the file: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "test({phase_num}): persist human verification items as UAT" --files "{phase_dir}/{phase_num}-HUMAN-UAT.md" +gsd-sdk query commit "test({phase_num}): persist human verification items as UAT" "{phase_dir}/{phase_num}-HUMAN-UAT.md" ``` **Step B: Present to user:** @@ -1352,7 +1352,7 @@ Gap closure cycle: `/gsd-plan-phase {X} --gaps ${GSD_WS}` reads VERIFICATION.md **Mark phase complete and update all tracking files:** ```bash -COMPLETION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase complete "${PHASE_NUMBER}") +COMPLETION=$(gsd-sdk query phase.complete "${PHASE_NUMBER}") ``` The CLI handles: @@ -1375,7 +1375,7 @@ These items are tracked and will appear in `/gsd-progress` and `/gsd-audit-uat`. ``` ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-{X}): complete phase execution" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md +gsd-sdk query commit "docs(phase-{X}): complete phase execution" .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md {phase_dir}/*-VERIFICATION.md ``` @@ -1387,7 +1387,7 @@ entries from the completed phase to the global learnings store at `~/.gsd/knowle **Check config gate:** ```bash -GL_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get features.global_learnings --raw 2>/dev/null || echo "false") +GL_ENABLED=$(gsd-sdk query config-get features.global_learnings --raw 2>/dev/null || echo "false") ``` **If `GL_ENABLED` is not `true`:** Skip this step entirely (feature disabled by default). @@ -1397,7 +1397,7 @@ GL_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get fea 1. Check if LEARNINGS.md exists in the phase directory (use the `phase_dir` value from init context) 2. If found, copy to global store: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" learnings copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing" +gsd-sdk query learnings.copy 2>/dev/null || echo "⚠ Learnings copy failed — continuing" ``` Copy failure must NOT block phase completion. @@ -1418,7 +1418,7 @@ PROJECT.md falls behind silently over multiple phases. 5. Commit the change: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-{X}): evolve PROJECT.md after phase completion" --files .planning/PROJECT.md +gsd-sdk query commit "docs(phase-{X}): evolve PROJECT.md after phase completion" .planning/PROJECT.md ``` **Skip this step if** `.planning/PROJECT.md` does not exist. @@ -1456,8 +1456,8 @@ STOP. Do not proceed to auto-advance or transition. 1. Parse `--auto` flag from $ARGUMENTS 2. Read both the chain flag and user preference (chain flag already synced in init step): ```bash - AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false") - AUTO_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.auto_advance 2>/dev/null || echo "false") + AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false") + AUTO_CFG=$(gsd-sdk query config-get workflow.auto_advance 2>/dev/null || echo "false") ``` **If `--auto` flag present OR `AUTO_CHAIN` is true OR `AUTO_CFG` is true (AND verification passed with no gaps):** diff --git a/get-shit-done/workflows/execute-plan.md b/get-shit-done/workflows/execute-plan.md index 0da90b469..035243e8a 100644 --- a/get-shit-done/workflows/execute-plan.md +++ b/get-shit-done/workflows/execute-plan.md @@ -20,7 +20,7 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo Load execution context (paths only to minimize orchestrator context): ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init execute-phase "${PHASE}") +INIT=$(gsd-sdk query init.execute-phase "${PHASE}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -40,7 +40,7 @@ Find first PLAN without matching SUMMARY. Decimal phases supported (`01.1-hotfix ```bash PHASE=$(echo "$PLAN_PATH" | grep -oE '[0-9]+(\.[0-9]+)?-[0-9]+') -# config settings can be fetched via gsd-tools config-get if needed +# config settings can be fetched via gsd-sdk query config-get if needed ``` @@ -63,7 +63,7 @@ PLAN_START_EPOCH=$(date +%s) ```bash # Count tasks — match ]' .planning/phases/XX-name/{phase}-{plan}-PLAN.md 2>/dev/null || echo "0") -INLINE_THRESHOLD=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.inline_plan_threshold --default 2 2>/dev/null || echo "2") +INLINE_THRESHOLD=$(gsd-sdk query config-get workflow.inline_plan_threshold 2>/dev/null || echo "2") grep -n "type=\"checkpoint" .planning/phases/XX-name/{phase}-{plan}-PLAN.md ``` @@ -141,7 +141,7 @@ This IS the execution instructions. Follow exactly. If plan references CONTEXT.m ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phases list --type summaries --raw +gsd-sdk query phases.list --type summaries --raw # Extract the second-to-last summary from the JSON result ``` @@ -255,13 +255,9 @@ If a commit is BLOCKED by a hook: ## Task Commit Protocol -Follow the task commit protocol from the gsd-executor agent definition (single source of truth): -- Stage files individually (NEVER `git add .` or `git add -A`) -- Format: `{type}({phase}-{plan}): {concise description}` with bullet points for key changes -- Types: feat, fix, test, refactor, perf, docs, style, chore -- Sub-repos: use `commit-to-subrepo` when `sub_repos` is configured -- Record commit hash for SUMMARY tracking -- Check for untracked generated files after each commit +Canonical per-task commit rules live in **`agents/gsd-executor.md`** (``). Follow that section for staging, `{type}({phase}-{plan})` messages, `commit-to-subrepo` when `sub_repos` is set, post-commit checks, and untracked-file handling — do not duplicate or paraphrase the full protocol here (single source of truth). + +**Orchestrator note:** After each task, the spawned executor reports commit hashes; this workflow does not re-specify commit semantics beyond pointing at the executor. @@ -294,7 +290,7 @@ If verification fails: **Check if node repair is enabled** (default: on): ```bash -NODE_REPAIR=$(node "./.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.node_repair 2>/dev/null || echo "true") +NODE_REPAIR=$(gsd-sdk query config-get workflow.node_repair 2>/dev/null || echo "true") ``` If `NODE_REPAIR` is `true`: invoke `@./.claude/get-shit-done/workflows/node-repair.md` with: @@ -353,7 +349,7 @@ Next: more plans → "Ready for {next-plan}" | last → "Phase complete, ready f handles STATE.md/ROADMAP.md updates centrally after merging worktrees to avoid merge conflicts). -Update STATE.md using gsd-tools: +Update STATE.md using gsd-sdk query (or legacy gsd-tools) state mutations: ```bash # Auto-detect parallel mode: .git is a file in worktrees, a directory in main repo @@ -362,13 +358,13 @@ IS_WORKTREE=$([ -f .git ] && echo "true" || echo "false") # Skip in parallel mode — orchestrator handles STATE.md centrally if [ "$IS_WORKTREE" != "true" ]; then # Advance plan counter (handles last-plan edge case) - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state advance-plan + gsd-sdk query state.advance-plan # Recalculate progress bar from disk state - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state update-progress + gsd-sdk query state.update-progress # Record execution metrics - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-metric \ + gsd-sdk query state.record-metric \ --phase "${PHASE}" --plan "${PLAN}" --duration "${DURATION}" \ --tasks "${TASK_COUNT}" --files "${FILE_COUNT}" fi @@ -381,19 +377,19 @@ From SUMMARY: Extract decisions and add to STATE.md: ```bash # Add each decision from SUMMARY key-decisions # Prefer file inputs for shell-safe text (preserves `$`, `*`, etc. exactly) -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state add-decision \ +gsd-sdk query state.add-decision \ --phase "${PHASE}" --summary-file "${DECISION_TEXT_FILE}" --rationale-file "${RATIONALE_FILE}" # Add blockers if any found -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state add-blocker --text-file "${BLOCKER_TEXT_FILE}" +gsd-sdk query state.add-blocker --text-file "${BLOCKER_TEXT_FILE}" ``` -Update session info using gsd-tools: +Update session info using gsd-sdk query (or legacy gsd-tools): ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \ +gsd-sdk query state.record-session \ --stopped-at "Completed ${PHASE}-${PLAN}-PLAN.md" \ --resume-file "None" ``` @@ -415,7 +411,7 @@ IS_WORKTREE=$([ -f .git ] && echo "true" || echo "false") # Skip in parallel mode — orchestrator handles ROADMAP.md centrally if [ "$IS_WORKTREE" != "true" ]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap update-plan-progress "${PHASE}" + gsd-sdk query roadmap.update-plan-progress "${PHASE}" fi ``` Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct count and status (`In Progress` or `Complete` with date). @@ -425,7 +421,7 @@ Counts PLAN vs SUMMARY files on disk. Updates progress table row with correct co Mark completed requirements from the PLAN.md frontmatter `requirements:` field: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" requirements mark-complete ${REQ_IDS} +gsd-sdk query requirements.mark-complete ${REQ_IDS} ``` Extract requirement IDs from the plan's frontmatter (e.g., `requirements: [AUTH-01, AUTH-02]`). If no requirements field, skip. @@ -440,9 +436,9 @@ IS_WORKTREE=$([ -f .git ] && echo "true" || echo "false") # In parallel mode: exclude STATE.md and ROADMAP.md (orchestrator commits these) if [ "$IS_WORKTREE" = "true" ]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/REQUIREMENTS.md + gsd-sdk query commit "docs({phase}-{plan}): complete [plan-name] plan" .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/REQUIREMENTS.md else - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs({phase}-{plan}): complete [plan-name] plan" --files .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md + gsd-sdk query commit "docs({phase}-{plan}): complete [plan-name] plan" .planning/phases/XX-name/{phase}-{plan}-SUMMARY.md .planning/STATE.md .planning/ROADMAP.md .planning/REQUIREMENTS.md fi ``` @@ -458,7 +454,7 @@ git diff --name-only ${FIRST_TASK}^..HEAD 2>/dev/null || true Update only structural changes: new src/ dir → STRUCTURE.md | deps → STACK.md | file pattern → CONVENTIONS.md | API client → INTEGRATIONS.md | config → STACK.md | renamed → update paths. Skip code-only/bugfix/content changes. ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "" --files .planning/codebase/*.md --amend +gsd-sdk query commit "" .planning/codebase/*.md --amend ``` diff --git a/get-shit-done/workflows/explore.md b/get-shit-done/workflows/explore.md index f6afd6f4c..ecb8d9d8d 100644 --- a/get-shit-done/workflows/explore.md +++ b/get-shit-done/workflows/explore.md @@ -111,7 +111,7 @@ For each selected output, write the file: Commit if `commit_docs` is enabled: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: capture exploration — {topic_slug}" --files {file_list} +gsd-sdk query commit "docs: capture exploration — {topic_slug}" {file_list} ``` ## Step 6: Close diff --git a/get-shit-done/workflows/extract_learnings.md b/get-shit-done/workflows/extract_learnings.md index 53c3607b3..7d74bdeea 100644 --- a/get-shit-done/workflows/extract_learnings.md +++ b/get-shit-done/workflows/extract_learnings.md @@ -16,7 +16,7 @@ Analyze completed phase artifacts (PLAN.md, SUMMARY.md, VERIFICATION.md, UAT.md, Parse arguments and load project state: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -179,7 +179,7 @@ The body follows this structure: Update STATE.md to reflect the learning extraction: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state update "Last Activity" "$(date +%Y-%m-%d)" +gsd-sdk query state.update "Last Activity" "$(date +%Y-%m-%d)" ``` diff --git a/get-shit-done/workflows/forensics.md b/get-shit-done/workflows/forensics.md index 6b07890ec..caa5d765e 100644 --- a/get-shit-done/workflows/forensics.md +++ b/get-shit-done/workflows/forensics.md @@ -259,7 +259,7 @@ gh issue create \ ## Step 8: Update STATE.md ```bash -gsd-tools.cjs state record-session \ - --stopped-at "Forensic investigation complete" \ - --resume-file ".planning/forensics/report-{timestamp}.md" +gsd-sdk query state.record-session "" \ + "Forensic investigation complete" \ + ".planning/forensics/report-{timestamp}.md" ``` diff --git a/get-shit-done/workflows/health.md b/get-shit-done/workflows/health.md index ad8bf9e3f..6c6352692 100644 --- a/get-shit-done/workflows/health.md +++ b/get-shit-done/workflows/health.md @@ -25,7 +25,7 @@ fi **Run health validation:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" validate health $REPAIR_FLAG +gsd-sdk query validate.health $REPAIR_FLAG ``` Parse JSON output: @@ -112,7 +112,7 @@ If yes, re-run with --repair flag and display results. Re-run health check without --repair to confirm issues are resolved: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" validate health +gsd-sdk query validate.health ``` Report final status. diff --git a/get-shit-done/workflows/import.md b/get-shit-done/workflows/import.md index a555c0edf..7f8a9ca85 100644 --- a/get-shit-done/workflows/import.md +++ b/get-shit-done/workflows/import.md @@ -248,7 +248,7 @@ Update `.planning/STATE.md` if appropriate (e.g., increment total plan count). Commit the imported plan and updated files: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs({phase}): import plan from {basename FILEPATH}" --files .planning/phases/{phase}/{plan}-PLAN.md .planning/ROADMAP.md +gsd-sdk query commit "docs({phase}): import plan from {basename FILEPATH}" .planning/phases/{phase}/{plan}-PLAN.md .planning/ROADMAP.md ``` Display completion: diff --git a/get-shit-done/workflows/insert-phase.md b/get-shit-done/workflows/insert-phase.md index 7ba383c73..a56e3fbf0 100644 --- a/get-shit-done/workflows/insert-phase.md +++ b/get-shit-done/workflows/insert-phase.md @@ -34,7 +34,7 @@ Validate first argument is an integer. Load phase operation context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${after_phase}") +INIT=$(gsd-sdk query init.phase-op "${after_phase}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -46,10 +46,10 @@ Exit. -**Delegate the phase insertion to gsd-tools:** +**Delegate the phase insertion to `gsd-sdk query phase.insert`:** ```bash -RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase insert "${after_phase}" "${description}") +RESULT=$(gsd-sdk query phase.insert "${after_phase}" "${description}") ``` The CLI handles: @@ -122,7 +122,7 @@ Project state updated: .planning/STATE.md Phase insertion is complete when: -- [ ] `gsd-tools phase insert` executed successfully +- [ ] `gsd-sdk query phase.insert` executed successfully - [ ] Phase directory created - [ ] Roadmap updated with new phase entry (includes "(INSERTED)" marker) - [ ] STATE.md updated with roadmap evolution note diff --git a/get-shit-done/workflows/list-workspaces.md b/get-shit-done/workflows/list-workspaces.md index a9ba0bdf3..c79a84bc9 100644 --- a/get-shit-done/workflows/list-workspaces.md +++ b/get-shit-done/workflows/list-workspaces.md @@ -11,7 +11,7 @@ Read all files referenced by the invoking prompt's execution_context before star ## 1. Setup ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init list-workspaces) +INIT=$(gsd-sdk query init.list-workspaces) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/manager.md b/get-shit-done/workflows/manager.md index b92feab59..8d9de60a4 100644 --- a/get-shit-done/workflows/manager.md +++ b/get-shit-done/workflows/manager.md @@ -19,7 +19,7 @@ Read all files referenced by the invoking prompt's execution_context before star Bootstrap via manager init: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init manager) +INIT=$(gsd-sdk query init.manager) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -30,7 +30,7 @@ Parse JSON for: `milestone_version`, `milestone_name`, `phase_count`, `completed - `manager_flags.plan` — appended to plan agent init command - `manager_flags.execute` — appended to execute agent init command -These are empty strings by default. Set via: `gsd-tools config-set manager.flags.discuss "--auto --analyze"` +These are empty strings by default. Set via: `gsd-sdk query config-set manager.flags.discuss "--auto --analyze"` **If error:** Display the error message and exit. @@ -60,7 +60,7 @@ Proceed to dashboard step. **Every time this step is reached**, re-read state from disk to pick up changes from background agents: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init manager) +INIT=$(gsd-sdk query init.manager) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/map-codebase.md b/get-shit-done/workflows/map-codebase.md index 75b770542..29c4a03a8 100644 --- a/get-shit-done/workflows/map-codebase.md +++ b/get-shit-done/workflows/map-codebase.md @@ -31,9 +31,9 @@ Documents are reference material for Claude when planning/executing. Always incl Load codebase mapping context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init map-codebase) +INIT=$(gsd-sdk query init.map-codebase) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_MAPPER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-codebase-mapper 2>/dev/null) +AGENT_SKILLS_MAPPER=$(gsd-sdk query agent-skills gsd-codebase-mapper 2>/dev/null) ``` Extract from init JSON: `mapper_model`, `commit_docs`, `codebase_dir`, `existing_maps`, `has_maps`, `codebase_dir_exists`, `subagent_timeout`. @@ -314,7 +314,7 @@ Continue to commit_codebase_map. Commit the codebase map: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: map existing codebase" --files .planning/codebase/*.md +gsd-sdk query commit "docs: map existing codebase" .planning/codebase/*.md ``` Continue to offer_next. diff --git a/get-shit-done/workflows/milestone-summary.md b/get-shit-done/workflows/milestone-summary.md index a3c8cb04f..ea660a4d3 100644 --- a/get-shit-done/workflows/milestone-summary.md +++ b/get-shit-done/workflows/milestone-summary.md @@ -53,7 +53,7 @@ Read all files that exist. Missing files are fine — the summary adapts to what Find all phase directories: ```bash -gsd-tools.cjs init progress +gsd-sdk query init.progress ``` This returns phase metadata. For each phase in the milestone scope: @@ -189,8 +189,8 @@ mkdir -p .planning/reports Write the summary, then commit: ```bash -gsd-tools.cjs commit "docs(v${VERSION}): generate milestone summary for onboarding" \ - --files ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md" +gsd-sdk query commit "docs(v${VERSION}): generate milestone summary for onboarding" \ + ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md" ``` ## Step 7: Present Summary @@ -217,7 +217,7 @@ If the user is done: ## Step 9: Update STATE.md ```bash -gsd-tools.cjs state record-session \ - --stopped-at "Milestone v${VERSION} summary generated" \ - --resume-file ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md" +gsd-sdk query state.record-session "" \ + "Milestone v${VERSION} summary generated" \ + ".planning/reports/MILESTONE_SUMMARY-v${VERSION}.md" ``` diff --git a/get-shit-done/workflows/new-milestone.md b/get-shit-done/workflows/new-milestone.md index d82260bd9..b7b0afa17 100644 --- a/get-shit-done/workflows/new-milestone.md +++ b/get-shit-done/workflows/new-milestone.md @@ -191,21 +191,21 @@ Delete MILESTONE-CONTEXT.md if exists (consumed). Clear leftover phase directories from the previous milestone: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phases clear --confirm +gsd-sdk query phases.clear --confirm ``` ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: start milestone v[X.Y] [Name]" --files .planning/PROJECT.md .planning/STATE.md +gsd-sdk query commit "docs: start milestone v[X.Y] [Name]" .planning/PROJECT.md .planning/STATE.md ``` ## 7. Load Context and Resolve Models ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init new-milestone) +INIT=$(gsd-sdk query init.new-milestone) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_RESEARCHER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-project-researcher 2>/dev/null) -AGENT_SKILLS_SYNTHESIZER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-synthesizer 2>/dev/null) -AGENT_SKILLS_ROADMAPPER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-roadmapper 2>/dev/null) +AGENT_SKILLS_RESEARCHER=$(gsd-sdk query agent-skills gsd-project-researcher 2>/dev/null) +AGENT_SKILLS_SYNTHESIZER=$(gsd-sdk query agent-skills gsd-synthesizer 2>/dev/null) +AGENT_SKILLS_ROADMAPPER=$(gsd-sdk query agent-skills gsd-roadmapper 2>/dev/null) ``` Extract from init JSON: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `research_enabled`, `current_milestone`, `project_exists`, `roadmap_exists`, `latest_completed_milestone`, `phase_dir_count`, `phase_archive_path`. @@ -409,7 +409,7 @@ If "adjust": Return to scoping. **Commit requirements:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: define milestone v[X.Y] requirements" --files .planning/REQUIREMENTS.md +gsd-sdk query commit "docs: define milestone v[X.Y] requirements" .planning/REQUIREMENTS.md ``` ## 10. Create Roadmap @@ -493,7 +493,7 @@ Success criteria: **Commit roadmap** (after approval): ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: create milestone v[X.Y] roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md +gsd-sdk query commit "docs: create milestone v[X.Y] roadmap ([N] phases)" .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md ``` ## 11. Done diff --git a/get-shit-done/workflows/new-project.md b/get-shit-done/workflows/new-project.md index 906eb3817..193e6e075 100644 --- a/get-shit-done/workflows/new-project.md +++ b/get-shit-done/workflows/new-project.md @@ -57,11 +57,11 @@ The document should describe what you want to build. **MANDATORY FIRST STEP — Execute these checks before ANY user interaction:** ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init new-project) +INIT=$(gsd-sdk query init.new-project) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_RESEARCHER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-project-researcher 2>/dev/null) -AGENT_SKILLS_SYNTHESIZER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-synthesizer 2>/dev/null) -AGENT_SKILLS_ROADMAPPER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-roadmapper 2>/dev/null) +AGENT_SKILLS_RESEARCHER=$(gsd-sdk query agent-skills gsd-project-researcher 2>/dev/null) +AGENT_SKILLS_SYNTHESIZER=$(gsd-sdk query agent-skills gsd-synthesizer 2>/dev/null) +AGENT_SKILLS_ROADMAPPER=$(gsd-sdk query agent-skills gsd-roadmapper 2>/dev/null) ``` Parse JSON for: `researcher_model`, `synthesizer_model`, `roadmapper_model`, `commit_docs`, `project_exists`, `has_codebase_map`, `planning_exists`, `has_existing_code`, `has_package_file`, `is_brownfield`, `needs_codebase_map`, `has_git`, `project_path`. @@ -213,7 +213,7 @@ Create `.planning/config.json` with all settings (CLI fills in remaining default ```bash mkdir -p .planning -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-new-project '{"mode":"yolo","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":true|false,"auto_advance":true}}' +gsd-sdk query config-new-project '{"mode":"yolo","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":true|false,"auto_advance":true}}' ``` **If commit_docs = No:** Add `.planning/` to `.gitignore`. @@ -222,13 +222,13 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-new-project '{"mode" ```bash mkdir -p .planning -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "chore: add project config" --files .planning/config.json +gsd-sdk query commit "chore: add project config" .planning/config.json ``` **Persist auto-advance chain flag to config (survives context compaction):** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true +gsd-sdk query config-set workflow._auto_chain_active true ``` Proceed to Step 4 (skip Steps 3 and 5). @@ -403,7 +403,7 @@ Do not compress. Capture everything gathered. ```bash mkdir -p .planning -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: initialize project" --files .planning/PROJECT.md +gsd-sdk query commit "docs: initialize project" .planning/PROJECT.md ``` ## 5. Workflow Preferences @@ -533,7 +533,7 @@ Create `.planning/config.json` with all settings (CLI fills in remaining default ```bash mkdir -p .planning -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-new-project '{"mode":"[yolo|interactive]","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":[false if granularity=coarse, true otherwise]}}' +gsd-sdk query config-new-project '{"mode":"[yolo|interactive]","granularity":"[selected]","parallelization":true|false,"commit_docs":true|false,"model_profile":"quality|balanced|budget|inherit","workflow":{"research":true|false,"plan_check":true|false,"verifier":true|false,"nyquist_validation":[false if granularity=coarse, true otherwise]}}' ``` **Note:** Run `/gsd-settings` anytime to update model profile, workflow agents, branching strategy, and other preferences. @@ -550,7 +550,7 @@ node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-new-project '{"mode" **Commit config.json:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "chore: add project config" --files .planning/config.json +gsd-sdk query commit "chore: add project config" .planning/config.json ``` ## 5.1. Sub-Repo Detection @@ -994,7 +994,7 @@ If "adjust": Return to scoping. **Commit requirements:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: define v1 requirements" --files .planning/REQUIREMENTS.md +gsd-sdk query commit "docs: define v1 requirements" .planning/REQUIREMENTS.md ``` ## 8. Create Roadmap @@ -1134,7 +1134,7 @@ Use AskUserQuestion: **Generate or refresh project instruction file before final commit:** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" generate-claude-md --output "$INSTRUCTION_FILE" +gsd-sdk query generate-claude-md --output "$INSTRUCTION_FILE" ``` This ensures new projects get the default GSD workflow-enforcement guidance and current project context in `$INSTRUCTION_FILE`. @@ -1142,7 +1142,7 @@ This ensures new projects get the default GSD workflow-enforcement guidance and **Commit roadmap (after approval or auto mode):** ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: create roadmap ([N] phases)" --files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md "$INSTRUCTION_FILE" +gsd-sdk query commit "docs: create roadmap ([N] phases)" .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md "$INSTRUCTION_FILE" ``` ## 9. Done @@ -1183,7 +1183,7 @@ Exit skill and invoke SlashCommand("/gsd-discuss-phase 1 --auto") Check if Phase 1 has UI indicators (look for `**UI hint**: yes` in Phase 1 detail section of ROADMAP.md): ```bash -PHASE1_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase 1 2>/dev/null) +PHASE1_SECTION=$(gsd-sdk query roadmap.get-phase 1 2>/dev/null) PHASE1_HAS_UI=$(echo "$PHASE1_SECTION" | grep -qi "UI hint.*yes" && echo "true" || echo "false") ``` diff --git a/get-shit-done/workflows/new-workspace.md b/get-shit-done/workflows/new-workspace.md index d732ecef1..4d61d5264 100644 --- a/get-shit-done/workflows/new-workspace.md +++ b/get-shit-done/workflows/new-workspace.md @@ -13,7 +13,7 @@ Read all files referenced by the invoking prompt's execution_context before star **MANDATORY FIRST STEP — Execute init command:** ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init new-workspace) +INIT=$(gsd-sdk query init.new-workspace) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/next.md b/get-shit-done/workflows/next.md index 828ed4292..7433f8919 100644 --- a/get-shit-done/workflows/next.md +++ b/get-shit-done/workflows/next.md @@ -14,7 +14,7 @@ Read project state to determine current position: ```bash # Get state snapshot -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state json 2>/dev/null || echo "{}" +gsd-sdk query state.json 2>/dev/null || echo "{}" ``` Also read: @@ -83,7 +83,7 @@ Use `--force` to bypass this check. Exit. **Prior-phase completeness scan:** -After passing all three hard-stop gates, scan all phases that precede the current phase in ROADMAP.md order for incomplete work. Use the existing `gsd-tools.cjs phase json ` output to inspect each prior phase. +After passing all three hard-stop gates, scan all phases that precede the current phase in ROADMAP.md order for incomplete work. For each prior phase number `N`, use `gsd-sdk query find-phase ` JSON (plans, summaries, incomplete_plans, etc.) to inspect that phase. Detect three categories of incomplete work: 1. **Plans without summaries** — a PLAN.md exists in a prior phase directory but no matching SUMMARY.md exists (execution started but not completed). @@ -127,7 +127,7 @@ Choice [S]: ``` 2. Commit the deferral record: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: defer incomplete Phase {src} items to backlog" +gsd-sdk query commit "docs: defer incomplete Phase {src} items to backlog" ``` 3. Continue routing to `determine_next_action` immediately — no second prompt. diff --git a/get-shit-done/workflows/pause-work.md b/get-shit-done/workflows/pause-work.md index d575dc4c3..976c17f31 100644 --- a/get-shit-done/workflows/pause-work.md +++ b/get-shit-done/workflows/pause-work.md @@ -62,7 +62,7 @@ Report any summaries with placeholder content as incomplete items. **Write structured handoff to `.planning/HANDOFF.json`:** ```bash -timestamp=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" current-timestamp full --raw) +timestamp=$(gsd-sdk query current-timestamp full --raw) ``` ```json @@ -197,13 +197,13 @@ Be specific enough for a fresh Claude to understand immediately. Use `current-timestamp` for last_updated field. You can use init todos (which provides timestamps) or call directly: ```bash -timestamp=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" current-timestamp full --raw) +timestamp=$(gsd-sdk query current-timestamp full --raw) ``` ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "wip: [context-name] paused at [X]/[Y]" --files [handoff-path] .planning/HANDOFF.json +gsd-sdk query commit "wip: [context-name] paused at [X]/[Y]" [handoff-path] .planning/HANDOFF.json ``` diff --git a/get-shit-done/workflows/plan-milestone-gaps.md b/get-shit-done/workflows/plan-milestone-gaps.md index 2c6eb4b03..b87feb8d6 100644 --- a/get-shit-done/workflows/plan-milestone-gaps.md +++ b/get-shit-done/workflows/plan-milestone-gaps.md @@ -65,7 +65,7 @@ Gap: Flow "View dashboard" broken at data fetch Find highest existing phase: ```bash # Get sorted phase list, extract last one -HIGHEST=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phases list --pick directories[-1]) +HIGHEST=$(gsd-sdk query phases.list --pick directories[-1]) ``` New phases continue from there: @@ -146,7 +146,7 @@ mkdir -p ".planning/phases/{NN}-{name}" ## 9. Commit Roadmap and Requirements Update ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(roadmap): add gap closure phases {N}-{M}" --files .planning/ROADMAP.md .planning/REQUIREMENTS.md +gsd-sdk query commit "docs(roadmap): add gap closure phases {N}-{M}" .planning/ROADMAP.md .planning/REQUIREMENTS.md ``` ## 10. Offer Next Steps diff --git a/get-shit-done/workflows/plan-phase.md b/get-shit-done/workflows/plan-phase.md index 9a04c71f7..cf7cbda32 100644 --- a/get-shit-done/workflows/plan-phase.md +++ b/get-shit-done/workflows/plan-phase.md @@ -27,13 +27,13 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo Load all context in one call (paths only to minimize orchestrator context): ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init plan-phase "$PHASE") +INIT=$(gsd-sdk query init.plan-phase "$PHASE") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_RESEARCHER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-researcher 2>/dev/null) -AGENT_SKILLS_PLANNER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-planner 2>/dev/null) -AGENT_SKILLS_CHECKER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-checker 2>/dev/null) -CONTEXT_WINDOW=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get context_window 2>/dev/null || echo "200000") -TDD_MODE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.tdd_mode 2>/dev/null || echo "false") +AGENT_SKILLS_RESEARCHER=$(gsd-sdk query agent-skills gsd-researcher 2>/dev/null) +AGENT_SKILLS_PLANNER=$(gsd-sdk query agent-skills gsd-planner 2>/dev/null) +AGENT_SKILLS_CHECKER=$(gsd-sdk query agent-skills gsd-checker 2>/dev/null) +CONTEXT_WINDOW=$(gsd-sdk query config-get context_window 2>/dev/null || echo "200000") +TDD_MODE=$(gsd-sdk query config-get workflow.tdd_mode 2>/dev/null || echo "false") ``` When `TDD_MODE` is `true`, the planner agent is instructed to apply `type: tdd` to eligible tasks using heuristics from `references/tdd.md`. The planner's `` is extended to include `@~/.claude/get-shit-done/references/tdd.md` so gate enforcement rules are available during planning. @@ -86,7 +86,7 @@ Exit workflow. ## 3. Validate Phase ```bash -PHASE_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}") +PHASE_INFO=$(gsd-sdk query roadmap.get-phase "${PHASE}") ``` **If `found` is false:** Error with available phases. **If `found` is true:** Extract `phase_number`, `phase_name`, `goal` from JSON. @@ -188,7 +188,7 @@ Use full relative paths. Group by topic area.] 5. Commit: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): generate context from PRD" --files "${phase_dir}/${padded_phase}-CONTEXT.md" +gsd-sdk query commit "docs(${padded_phase}): generate context from PRD" "${phase_dir}/${padded_phase}-CONTEXT.md" ``` 6. Set `context_content` to the generated CONTEXT.md content and continue to step 5 (Handle Research). @@ -207,7 +207,7 @@ If `context_path` is not null, display: `Using phase context from: ${context_pat Read discuss mode for context gate label: ```bash -DISCUSS_MODE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.discuss_mode 2>/dev/null || echo "discuss") +DISCUSS_MODE=$(gsd-sdk query config-get workflow.discuss_mode 2>/dev/null || echo "discuss") ``` If `TEXT_MODE` is true, present as a plain-text numbered list: @@ -251,7 +251,7 @@ If "Run discuss-phase first": ```bash AI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-AI-SPEC.md 2>/dev/null | head -1) -AI_PHASE_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ai_integration_phase 2>/dev/null || echo "true") +AI_PHASE_CFG=$(gsd-sdk query config-get workflow.ai_integration_phase 2>/dev/null || echo "true") ``` **Skip if `AI_PHASE_CFG` is `false`.** @@ -337,7 +337,7 @@ Display banner: ### Spawn gsd-phase-researcher ```bash -PHASE_DESC=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" --pick section) +PHASE_DESC=$(gsd-sdk query roadmap.get-phase "${PHASE}" --pick section) ``` Research prompt: @@ -418,9 +418,9 @@ test -f "${PHASE_DIR}/${PADDED_PHASE}-VALIDATION.md" && echo "VALIDATION_CREATED > Skip if `workflow.security_enforcement` is explicitly `false`. Absent = enabled. ```bash -SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") -SECURITY_ASVS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1") -SECURITY_BLOCK=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_block_on --raw 2>/dev/null || echo "high") +SECURITY_CFG=$(gsd-sdk query config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") +SECURITY_ASVS=$(gsd-sdk query config-get workflow.security_asvs_level --raw 2>/dev/null || echo "1") +SECURITY_BLOCK=$(gsd-sdk query config-get workflow.security_block_on --raw 2>/dev/null || echo "high") ``` **If `SECURITY_CFG` is `false`:** Skip to step 5.6. @@ -444,8 +444,8 @@ Continue to step 5.6. Security config is passed to the planner in step 8. > Skip if `workflow.ui_phase` is explicitly `false` AND `workflow.ui_safety_gate` is explicitly `false` in `.planning/config.json`. If keys are absent, treat as enabled. ```bash -UI_PHASE_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true") -UI_GATE_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_safety_gate 2>/dev/null || echo "true") +UI_PHASE_CFG=$(gsd-sdk query config-get workflow.ui_phase 2>/dev/null || echo "true") +UI_GATE_CFG=$(gsd-sdk query config-get workflow.ui_safety_gate 2>/dev/null || echo "true") ``` **If both are `false`:** Skip to step 6. @@ -453,7 +453,7 @@ UI_GATE_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get wo Check if phase has frontend indicators: ```bash -PHASE_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" 2>/dev/null) +PHASE_SECTION=$(gsd-sdk query roadmap.get-phase "${PHASE}" 2>/dev/null) echo "$PHASE_SECTION" | grep -iE "UI|interface|frontend|component|layout|page|screen|view|form|dashboard|widget" > /dev/null 2>&1 HAS_UI=$? ``` @@ -473,7 +473,7 @@ UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1) Read auto-chain state: ```bash -AUTO_CHAIN=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow._auto_chain_active 2>/dev/null || echo "false") +AUTO_CHAIN=$(gsd-sdk query config-get workflow._auto_chain_active 2>/dev/null || echo "false") ``` **If `AUTO_CHAIN` is `true` (running inside a `--chain` or `--auto` pipeline):** @@ -513,7 +513,7 @@ Also available: Check if any files in the phase scope match schema patterns: ```bash -PHASE_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}" --pick section 2>/dev/null) +PHASE_SECTION=$(gsd-sdk query roadmap.get-phase "${PHASE}" --pick section 2>/dev/null) ``` Scan `PHASE_SECTION`, `CONTEXT.md` (if loaded), and `RESEARCH.md` (if exists) for file paths matching these ORM patterns: @@ -613,7 +613,7 @@ VALIDATION_EXISTS=$(ls "${PHASE_DIR}"/*-VALIDATION.md 2>/dev/null | head -1) If missing and Nyquist is still enabled/applicable — ask user: 1. Re-run: `/gsd-plan-phase {PHASE} --research ${GSD_WS}` 2. Disable Nyquist with the exact command: - `node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow.nyquist_validation false` + `gsd-sdk query config-set workflow.nyquist_validation false` 3. Continue anyway (plans fail Dimension 8) Proceed to Step 7.8 (or Step 8 if pattern mapper is disabled) only if user selects 2 or 3. @@ -624,7 +624,7 @@ Proceed to Step 7.8 (or Step 8 if pattern mapper is disabled) only if user selec Check config: ```bash -PATTERN_MAPPER_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.pattern_mapper --default true 2>/dev/null) +PATTERN_MAPPER_CFG=$(gsd-sdk query config-get workflow.pattern_mapper 2>/dev/null || echo "true") ``` **If `PATTERN_MAPPER_CFG` is `false`:** Skip to step 8. @@ -1022,8 +1022,8 @@ Skipping bounce step. **Read pass count:** ```bash -BOUNCE_PASSES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.plan_bounce_passes --default 2) -BOUNCE_SCRIPT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.plan_bounce_script) +BOUNCE_PASSES=$(gsd-sdk query config-get workflow.plan_bounce_passes 2>/dev/null || echo "2") +BOUNCE_SCRIPT=$(gsd-sdk query config-get workflow.plan_bounce_script 2>/dev/null | jq -r '.' 2>/dev/null || true) ``` Display banner: @@ -1068,7 +1068,7 @@ After the script returns, check that the bounced file still has valid YAML front 6. **Commit surviving bounced plans:** If at least one plan survived both the frontmatter validation and the checker re-run, commit the changes: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "refactor(${padded_phase}): bounce plans through external refinement" --files "${PHASE_DIR}/*-PLAN.md" +gsd-sdk query commit "refactor(${padded_phase}): bounce plans through external refinement" "${PHASE_DIR}/*-PLAN.md" ``` Display summary: @@ -1134,7 +1134,7 @@ If `TEXT_MODE` is true, present as a plain-text numbered list (options already s After plans pass all gates, record that planning is complete so STATE.md reflects the new phase status: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}" +gsd-sdk query state.planned-phase --phase "${PHASE_NUMBER}" --name "${PHASE_NAME}" --plans "${PLAN_COUNT}" ``` This updates STATUS to "Ready to execute", sets the correct plan count, and timestamps Last Activity. @@ -1152,7 +1152,7 @@ Check for auto-advance trigger using values already loaded in step 1: 3. **Sync chain flag with intent** — if user invoked manually (no `--auto` and no `--chain`), clear the ephemeral chain flag from any previous interrupted `--auto` chain. This does NOT touch `workflow.auto_advance` (the user's persistent settings preference): ```bash if [[ ! "$ARGUMENTS" =~ --auto ]] && [[ ! "$ARGUMENTS" =~ --chain ]]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false 2>/dev/null + gsd-sdk query config-set workflow._auto_chain_active false 2>/dev/null fi ``` @@ -1163,7 +1163,7 @@ Set local variables from INIT (parsed once in step 1): **If `--auto` or `--chain` flag present AND `AUTO_CHAIN` is not true:** Persist chain flag to config (handles direct invocation without prior discuss-phase): ```bash if ([[ "$ARGUMENTS" =~ --auto ]] || [[ "$ARGUMENTS" =~ --chain ]]) && [[ "$AUTO_CHAIN" != "true" ]]; then - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active true + gsd-sdk query config-set workflow._auto_chain_active true fi ``` diff --git a/get-shit-done/workflows/plant-seed.md b/get-shit-done/workflows/plant-seed.md index 657f48082..85c463f3d 100644 --- a/get-shit-done/workflows/plant-seed.md +++ b/get-shit-done/workflows/plant-seed.md @@ -143,7 +143,7 @@ Related code and decisions found in the current codebase: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: plant seed — {$IDEA}" --files .planning/seeds/SEED-{PADDED}-{slug}.md +gsd-sdk query commit "docs: plant seed — {$IDEA}" .planning/seeds/SEED-{PADDED}-{slug}.md ``` diff --git a/get-shit-done/workflows/profile-user.md b/get-shit-done/workflows/profile-user.md index b35f1db16..4fe48f11d 100644 --- a/get-shit-done/workflows/profile-user.md +++ b/get-shit-done/workflows/profile-user.md @@ -1,7 +1,7 @@ Orchestrate the full developer profiling flow: consent, session analysis (or questionnaire fallback), profile generation, result display, and artifact creation. -This workflow wires Phase 1 (session pipeline) and Phase 2 (profiling engine) into a cohesive user-facing experience. All heavy lifting is done by existing gsd-tools.cjs subcommands and the gsd-user-profiler agent -- this workflow orchestrates the sequence, handles branching, and provides the UX. +This workflow wires Phase 1 (session pipeline) and Phase 2 (profiling engine) into a cohesive user-facing experience. All heavy lifting is done by existing `gsd-sdk query` handlers (with legacy `gsd-tools.cjs` parity where needed) and the gsd-user-profiler agent -- this workflow orchestrates the sequence, handles branching, and provides the UX. @@ -130,7 +130,7 @@ Display: "◆ Scanning sessions..." Run session scan: ```bash -SCAN_RESULT=$(node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs scan-sessions --json 2>/dev/null) +SCAN_RESULT=$(gsd-sdk query scan-sessions --json 2>/dev/null) ``` Parse the JSON output to get session count and project count. @@ -150,7 +150,7 @@ Display: "◆ Sampling messages..." Run profile sampling: ```bash -SAMPLE_RESULT=$(node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs profile-sample --json 2>/dev/null) +SAMPLE_RESULT=$(gsd-sdk query profile-sample --json 2>/dev/null) ``` Parse the JSON output to get the temp directory path and message count. @@ -201,7 +201,7 @@ Display: "Using questionnaire to build your profile." **Get questions:** ```bash -QUESTIONS=$(node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs profile-questionnaire --json 2>/dev/null) +QUESTIONS=$(gsd-sdk query profile-questionnaire --json 2>/dev/null) ``` Parse the questions JSON. It contains 8 questions, one per dimension. @@ -224,7 +224,7 @@ Write the answers JSON to `$ANSWERS_PATH`. **Convert answers to analysis:** ```bash -ANALYSIS_RESULT=$(node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs profile-questionnaire --answers "$ANSWERS_PATH" --json 2>/dev/null) +ANALYSIS_RESULT=$(gsd-sdk query profile-questionnaire --answers "$ANSWERS_PATH" --json 2>/dev/null) ``` Parse the analysis JSON from the result. @@ -271,7 +271,7 @@ Write updated analysis JSON back to `$ANALYSIS_PATH`. Display: "◆ Writing profile..." ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs write-profile --input "$ANALYSIS_PATH" --json 2>/dev/null +gsd-sdk query write-profile --input "$ANALYSIS_PATH" --json 2>/dev/null ``` Display: "✓ Profile written to $HOME/.claude/get-shit-done/USER-PROFILE.md" @@ -350,7 +350,7 @@ Generate selected artifacts sequentially (file I/O is fast, no benefit from para **For /gsd-dev-preferences (if selected):** ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs generate-dev-preferences --analysis "$ANALYSIS_PATH" --json 2>/dev/null +gsd-sdk query generate-dev-preferences --analysis "$ANALYSIS_PATH" --json 2>/dev/null ``` Display: "✓ Generated /gsd-dev-preferences at $HOME/.claude/commands/gsd/dev-preferences.md" @@ -358,7 +358,7 @@ Display: "✓ Generated /gsd-dev-preferences at $HOME/.claude/commands/gsd/dev-p **For CLAUDE.md profile section (if selected):** ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs generate-claude-profile --analysis "$ANALYSIS_PATH" --json 2>/dev/null +gsd-sdk query generate-claude-profile --analysis "$ANALYSIS_PATH" --json 2>/dev/null ``` Display: "✓ Added profile section to CLAUDE.md" @@ -366,12 +366,12 @@ Display: "✓ Added profile section to CLAUDE.md" **For Global CLAUDE.md (if selected):** ```bash -node $HOME/.claude/get-shit-done/bin/gsd-tools.cjs generate-claude-profile --analysis "$ANALYSIS_PATH" --global --json 2>/dev/null +gsd-sdk query generate-claude-profile --analysis "$ANALYSIS_PATH" --global --json 2>/dev/null ``` Display: "✓ Added profile section to $HOME/.claude/CLAUDE.md" -**Error handling:** If any gsd-tools.cjs call fails, display the error message and use AskUserQuestion to offer "Retry" or "Skip this artifact". On retry, re-run the command. On skip, continue to next artifact. +**Error handling:** If any `gsd-sdk query` or gsd-tools.cjs call fails, display the error message and use AskUserQuestion to offer "Retry" or "Skip this artifact". On retry, re-run the command. On skip, continue to next artifact. --- @@ -446,7 +446,7 @@ rm -f "$ANALYSIS_PATH" 2>/dev/null - [ ] Profile written to USER-PROFILE.md via write-profile subcommand - [ ] Result display shows report card table and highlight reel with evidence - [ ] Artifact selection uses multiSelect with all options pre-selected -- [ ] Artifacts generated sequentially via gsd-tools.cjs subcommands +- [ ] Artifacts generated sequentially via gsd-sdk query (or gsd-tools.cjs) subcommands - [ ] Refresh diff shows changed dimensions when --refresh was used - [ ] Temp files cleaned up on completion diff --git a/get-shit-done/workflows/progress.md b/get-shit-done/workflows/progress.md index 1d6e13c1b..3522c0b30 100644 --- a/get-shit-done/workflows/progress.md +++ b/get-shit-done/workflows/progress.md @@ -12,14 +12,14 @@ Read all files referenced by the invoking prompt's execution_context before star **Load progress context (paths only):** ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init progress) +INIT=$(gsd-sdk query init.progress) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` Extract from init JSON: `project_exists`, `roadmap_exists`, `state_exists`, `phases`, `current_phase`, `next_phase`, `milestone_version`, `completed_count`, `phase_count`, `paused_at`, `state_path`, `roadmap_path`, `project_path`, `config_path`. ```bash -DISCUSS_MODE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.discuss_mode 2>/dev/null || echo "discuss") +DISCUSS_MODE=$(gsd-sdk query config-get workflow.discuss_mode 2>/dev/null || echo "discuss") ``` If `project_exists` is false (no `.planning/` directory): @@ -42,11 +42,11 @@ If missing both ROADMAP.md and PROJECT.md: suggest `/gsd-new-project`. -**Use structured extraction from gsd-tools:** +**Use structured extraction from `gsd-sdk query` (or legacy gsd-tools.cjs):** Instead of reading full files, use targeted tools to get only the data needed for the report: -- `ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze)` -- `STATE=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state-snapshot)` +- `ROADMAP=$(gsd-sdk query roadmap.analyze)` +- `STATE=$(gsd-sdk query state-snapshot)` This minimizes orchestrator context usage. @@ -55,7 +55,7 @@ This minimizes orchestrator context usage. **Get comprehensive roadmap analysis (replaces manual parsing):** ```bash -ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze) +ROADMAP=$(gsd-sdk query roadmap.analyze) ``` This returns structured JSON with: @@ -74,7 +74,7 @@ Use this instead of manually reading/parsing ROADMAP.md. - Find the 2-3 most recent SUMMARY.md files - Use `summary-extract` for efficient parsing: ```bash - node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" summary-extract --fields one_liner + gsd-sdk query summary-extract --fields one_liner ``` - This shows "what we've been working on" @@ -89,11 +89,11 @@ Use this instead of manually reading/parsing ROADMAP.md. -**Generate progress bar from gsd-tools, then present rich status report:** +**Generate progress bar from `gsd-sdk query progress` / `progress.json`, then present rich status report:** ```bash # Get formatted progress bar -PROGRESS_BAR=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" progress bar --raw) +PROGRESS_BAR=$(gsd-sdk query progress.bar --raw) ``` Present: @@ -168,7 +168,7 @@ Track: Scan ALL phases in the current milestone for outstanding verification debt using the CLI (which respects milestone boundaries via `getMilestonePhaseFilter`): ```bash -DEBT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" audit-uat --raw 2>/dev/null) +DEBT=$(gsd-sdk query audit-uat --raw 2>/dev/null) ``` Parse JSON for `summary.total_items` and `summary.total_files`. @@ -231,7 +231,7 @@ Check if `{phase_num}-CONTEXT.md` exists in phase directory. Check if current phase has UI indicators: ```bash -PHASE_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${CURRENT_PHASE}" 2>/dev/null) +PHASE_SECTION=$(gsd-sdk query roadmap.get-phase "${CURRENT_PHASE}" 2>/dev/null) PHASE_HAS_UI=$(echo "$PHASE_SECTION" | grep -qi "UI hint.*yes" && echo "true" || echo "false") ``` @@ -377,7 +377,7 @@ Read ROADMAP.md to get the next phase's name and goal. Check if next phase has UI indicators: ```bash -NEXT_PHASE_SECTION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "$((Z+1))" 2>/dev/null) +NEXT_PHASE_SECTION=$(gsd-sdk query roadmap.get-phase "$((Z+1))" 2>/dev/null) NEXT_HAS_UI=$(echo "$NEXT_PHASE_SECTION" | grep -qi "UI hint.*yes" && echo "true" || echo "false") ``` diff --git a/get-shit-done/workflows/quick.md b/get-shit-done/workflows/quick.md index 3ecf888a3..69d872b8a 100644 --- a/get-shit-done/workflows/quick.md +++ b/get-shit-done/workflows/quick.md @@ -125,18 +125,18 @@ If `$VALIDATE_MODE` only: **Step 2: Initialize** ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init quick "$DESCRIPTION") +INIT=$(gsd-sdk query init.quick "$DESCRIPTION") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_PLANNER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-planner 2>/dev/null) -AGENT_SKILLS_EXECUTOR=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-executor 2>/dev/null) -AGENT_SKILLS_CHECKER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-checker 2>/dev/null) -AGENT_SKILLS_VERIFIER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-verifier 2>/dev/null) +AGENT_SKILLS_PLANNER=$(gsd-sdk query agent-skills gsd-planner 2>/dev/null) +AGENT_SKILLS_EXECUTOR=$(gsd-sdk query agent-skills gsd-executor 2>/dev/null) +AGENT_SKILLS_CHECKER=$(gsd-sdk query agent-skills gsd-checker 2>/dev/null) +AGENT_SKILLS_VERIFIER=$(gsd-sdk query agent-skills gsd-verifier 2>/dev/null) ``` Parse JSON for: `planner_model`, `executor_model`, `checker_model`, `verifier_model`, `commit_docs`, `branch_name`, `quick_id`, `slug`, `date`, `timestamp`, `quick_dir`, `task_dir`, `roadmap_exists`, `planning_exists`. ```bash -USE_WORKTREES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.use_worktrees 2>/dev/null || echo "true") +USE_WORKTREES=$(gsd-sdk query config-get workflow.use_worktrees 2>/dev/null || echo "true") ``` If the project uses git submodules, worktree isolation is skipped: @@ -653,7 +653,7 @@ After executor returns: if ! git diff --quiet .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || \ [ -n "$DELETED_FILES" ]; then - COMMIT_DOCS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get commit_docs 2>/dev/null || echo "true") + COMMIT_DOCS=$(gsd-sdk query config-get commit_docs 2>/dev/null || echo "true") if [ "$COMMIT_DOCS" != "false" ]; then git add .planning/STATE.md .planning/ROADMAP.md 2>/dev/null || true git commit --amend --no-edit 2>/dev/null || true @@ -684,7 +684,7 @@ Skip this step entirely if `$FULL_MODE` is false. **Config gate:** ```bash -CODE_REVIEW_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review 2>/dev/null || echo "true") +CODE_REVIEW_ENABLED=$(gsd-sdk query config-get workflow.code_review 2>/dev/null || echo "true") ``` If `"false"`, skip with message "Code review skipped (workflow.code_review=false)". @@ -831,7 +831,7 @@ Use Edit tool to make these changes atomically **Step 8: Final commit and completion** -Stage and commit quick task artifacts. This step MUST always run — even if the executor already committed some files (e.g. when running without worktree isolation). The `gsd-tools commit` command handles already-committed files gracefully. +Stage and commit quick task artifacts. This step MUST always run — even if the executor already committed some files (e.g. when running without worktree isolation). The `gsd-sdk query commit` command (or legacy `gsd-tools.cjs` commit) handles already-committed files gracefully. Build file list: - `${QUICK_DIR}/${quick_id}-PLAN.md` @@ -845,14 +845,14 @@ Build file list: # Explicitly stage all artifacts before commit — PLAN.md may be untracked # if the executor ran without worktree isolation and committed docs early # Filter .planning/ files from staging if commit_docs is disabled (#1783) -COMMIT_DOCS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get commit_docs 2>/dev/null || echo "true") +COMMIT_DOCS=$(gsd-sdk query config-get commit_docs 2>/dev/null || echo "true") if [ "$COMMIT_DOCS" = "false" ]; then file_list_filtered=$(echo "${file_list}" | tr ' ' '\n' | grep -v '^\.planning/' | tr '\n' ' ') git add ${file_list_filtered} 2>/dev/null else git add ${file_list} 2>/dev/null fi -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(quick-${quick_id}): ${DESCRIPTION}" --files ${file_list} +gsd-sdk query commit "docs(quick-${quick_id}): ${DESCRIPTION}" ${file_list} ``` Get final commit hash: diff --git a/get-shit-done/workflows/remove-phase.md b/get-shit-done/workflows/remove-phase.md index 9137ca525..0da804142 100644 --- a/get-shit-done/workflows/remove-phase.md +++ b/get-shit-done/workflows/remove-phase.md @@ -29,7 +29,7 @@ Exit. Load phase operation context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${target}") +INIT=$(gsd-sdk query init.phase-op "${target}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -77,16 +77,16 @@ Wait for confirmation. -**Delegate the entire removal operation to gsd-tools:** +**Delegate the entire removal operation to `gsd-sdk query phase.remove`:** ```bash -RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase remove "${target}") +RESULT=$(gsd-sdk query phase.remove "${target}") ``` -If the phase has executed plans (SUMMARY.md files), gsd-tools will error. Use `--force` only if the user confirms: +If the phase has executed plans (SUMMARY.md files), the CLI will error. Use `--force` only if the user confirms: ```bash -RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase remove "${target}" --force) +RESULT=$(gsd-sdk query phase.remove "${target}" --force) ``` The CLI handles: @@ -103,7 +103,7 @@ Extract from result: `removed`, `directory_deleted`, `renamed_directories`, `ren Stage and commit the removal: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "chore: remove phase {target} ({original-phase-name})" --files .planning/ +gsd-sdk query commit "chore: remove phase {target} ({original-phase-name})" .planning/ ``` The commit message preserves the historical record of what was removed. @@ -140,7 +140,7 @@ Would you like to: - Don't remove completed phases (have SUMMARY.md files) without --force - Don't remove current or past phases -- Don't manually renumber — use `gsd-tools phase remove` which handles all renumbering +- Don't manually renumber — use `gsd-sdk query phase.remove` which handles all renumbering - Don't add "removed phase" notes to STATE.md — git commit is the record - Don't modify completed phase directories @@ -149,7 +149,7 @@ Would you like to: Phase removal is complete when: - [ ] Target phase validated as future/unstarted -- [ ] `gsd-tools phase remove` executed successfully +- [ ] `gsd-sdk query phase.remove` executed successfully - [ ] Changes committed with descriptive message - [ ] User informed of changes diff --git a/get-shit-done/workflows/remove-workspace.md b/get-shit-done/workflows/remove-workspace.md index 63d6cc57b..98b189ea0 100644 --- a/get-shit-done/workflows/remove-workspace.md +++ b/get-shit-done/workflows/remove-workspace.md @@ -13,7 +13,7 @@ Read all files referenced by the invoking prompt's execution_context before star Extract workspace name from $ARGUMENTS. ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init remove-workspace "$WORKSPACE_NAME") +INIT=$(gsd-sdk query init.remove-workspace "$WORKSPACE_NAME") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/research-phase.md b/get-shit-done/workflows/research-phase.md index 737dd4edd..55c48ade0 100644 --- a/get-shit-done/workflows/research-phase.md +++ b/get-shit-done/workflows/research-phase.md @@ -23,7 +23,7 @@ Resolve model for: @~/.claude/get-shit-done/references/phase-argument-parsing.md ```bash -PHASE_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}") +PHASE_INFO=$(gsd-sdk query roadmap.get-phase "${PHASE}") ``` If `found` is false: Error and exit. @@ -39,10 +39,10 @@ If exists: Offer update/view/skip options. ## Step 3: Gather Phase Context ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE}") +INIT=$(gsd-sdk query init.phase-op "${PHASE}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi # Extract: phase_dir, padded_phase, phase_number, state_path, requirements_path, context_path -AGENT_SKILLS_RESEARCHER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-researcher 2>/dev/null) +AGENT_SKILLS_RESEARCHER=$(gsd-sdk query agent-skills gsd-researcher 2>/dev/null) ``` ## Step 4: Spawn Researcher diff --git a/get-shit-done/workflows/resume-project.md b/get-shit-done/workflows/resume-project.md index 71088c5c0..95ddc3316 100644 --- a/get-shit-done/workflows/resume-project.md +++ b/get-shit-done/workflows/resume-project.md @@ -20,7 +20,7 @@ Instantly restore full project context so "Where were we?" has an immediate, com Load all context in one call: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init resume) +INIT=$(gsd-sdk query init.resume) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/review.md b/get-shit-done/workflows/review.md index b14ce3f9e..d9c9911d0 100644 --- a/get-shit-done/workflows/review.md +++ b/get-shit-done/workflows/review.md @@ -80,7 +80,7 @@ Rules: Collect phase artifacts for the review prompt: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -151,10 +151,11 @@ Write to a temp file: `/tmp/gsd-review-prompt-{phase}.md` Read model preferences from planning config. Null/missing values fall back to CLI defaults. ```bash -GEMINI_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get review.models.gemini --raw 2>/dev/null || true) -CLAUDE_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get review.models.claude --raw 2>/dev/null || true) -CODEX_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get review.models.codex --raw 2>/dev/null || true) -OPENCODE_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get review.models.opencode --raw 2>/dev/null || true) +# JSON scalars from gsd-sdk query; use jq -r to strip JSON string quotes (install jq if missing) +GEMINI_MODEL=$(gsd-sdk query config-get review.models.gemini 2>/dev/null | jq -r '.' 2>/dev/null || true) +CLAUDE_MODEL=$(gsd-sdk query config-get review.models.claude 2>/dev/null | jq -r '.' 2>/dev/null || true) +CODEX_MODEL=$(gsd-sdk query config-get review.models.codex 2>/dev/null | jq -r '.' 2>/dev/null || true) +OPENCODE_MODEL=$(gsd-sdk query config-get review.models.opencode 2>/dev/null | jq -r '.' 2>/dev/null || true) ``` For each selected CLI, invoke in sequence (not parallel — avoid rate limits): @@ -306,7 +307,7 @@ plans_reviewed: [{list of PLAN.md files}] Commit: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: cross-AI review for phase {N}" --files {phase_dir}/{padded_phase}-REVIEWS.md +gsd-sdk query commit "docs: cross-AI review for phase {N}" {phase_dir}/{padded_phase}-REVIEWS.md ``` diff --git a/get-shit-done/workflows/scan.md b/get-shit-done/workflows/scan.md index 926fdcd8c..0d32765be 100644 --- a/get-shit-done/workflows/scan.md +++ b/get-shit-done/workflows/scan.md @@ -39,7 +39,7 @@ Exit. ## Step 2: Check for existing documents ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init map-codebase 2>/dev/null || echo "{}") +INIT=$(gsd-sdk query init.map-codebase 2>/dev/null || echo "{}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/secure-phase.md b/get-shit-done/workflows/secure-phase.md index bb4726814..ffcff717d 100644 --- a/get-shit-done/workflows/secure-phase.md +++ b/get-shit-done/workflows/secure-phase.md @@ -16,16 +16,16 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo ## 0. Initialize ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_AUDITOR=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-security-auditor 2>/dev/null) +AGENT_SKILLS_AUDITOR=$(gsd-sdk query agent-skills gsd-security-auditor 2>/dev/null) ``` Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`. ```bash -AUDITOR_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-security-auditor --raw) -SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") +AUDITOR_MODEL=$(gsd-sdk query resolve-model gsd-security-auditor --raw) +SECURITY_CFG=$(gsd-sdk query config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") ``` If `SECURITY_CFG` is `false`: exit with "Security enforcement disabled. Enable via /gsd-settings." @@ -134,7 +134,7 @@ Do NOT emit next-phase routing. Stop here. ## 7. Commit ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-${PHASE}): add/update security threat verification" +gsd-sdk query commit "docs(phase-${PHASE}): add/update security threat verification" ``` ## 8. Results + Routing diff --git a/get-shit-done/workflows/settings.md b/get-shit-done/workflows/settings.md index aa429af68..196bd2ac5 100644 --- a/get-shit-done/workflows/settings.md +++ b/get-shit-done/workflows/settings.md @@ -12,9 +12,9 @@ Read all files referenced by the invoking prompt's execution_context before star Ensure config exists and load current state: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-ensure-section +gsd-sdk query config-ensure-section GSD_CONFIG_PATH=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-path) -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load) +INIT=$(gsd-sdk query state.load) if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` diff --git a/get-shit-done/workflows/ship.md b/get-shit-done/workflows/ship.md index 218b31450..947c64cec 100644 --- a/get-shit-done/workflows/ship.md +++ b/get-shit-done/workflows/ship.md @@ -12,7 +12,7 @@ Read all files referenced by the invoking prompt's execution_context before star Parse arguments and load project state: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -20,14 +20,14 @@ Parse from init JSON: `phase_found`, `phase_dir`, `phase_number`, `phase_name`, Also load config for branching strategy: ```bash -CONFIG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load) +CONFIG=$(gsd-sdk query state.load) ``` Extract: `branching_strategy`, `branch_name`. Detect base branch for PRs and merges: ```bash -BASE_BRANCH=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get git.base_branch 2>/dev/null || echo "") +BASE_BRANCH=$(gsd-sdk query config-get git.base_branch 2>/dev/null || echo "") if [ -z "$BASE_BRANCH" ] || [ "$BASE_BRANCH" = "null" ]; then BASE_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|^refs/remotes/origin/||') BASE_BRANCH="${BASE_BRANCH:-main}" @@ -165,7 +165,7 @@ Report: "PR #{number} created: {url}" Before prompting the user, check if an external review command is configured: ```bash -REVIEW_CMD=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.code_review_command --default "" 2>/dev/null) +REVIEW_CMD=$(gsd-sdk query config-get workflow.code_review_command 2>/dev/null | jq -r '.' 2>/dev/null || echo "") ``` If `REVIEW_CMD` is non-empty and not `"null"`, run the external review: @@ -178,7 +178,7 @@ If `REVIEW_CMD` is non-empty and not `"null"`, run the external review: 2. **Load phase context from STATE.md:** ```bash - STATE_STATUS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state load 2>/dev/null | head -20) + STATE_STATUS=$(gsd-sdk query state.load 2>/dev/null | head -20) ``` 3. **Build review prompt and pipe to command via stdin:** @@ -251,13 +251,13 @@ Report the PR URL and suggest: "Review the diff at {url}/files" Update STATE.md to reflect the shipping action: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state update "Last Activity" "$(date +%Y-%m-%d)" -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state update "Status" "Phase ${PHASE_NUMBER} shipped — PR #${PR_NUMBER}" +gsd-sdk query state.update "Last Activity" "$(date +%Y-%m-%d)" +gsd-sdk query state.update "Status" "Phase ${PHASE_NUMBER} shipped — PR #${PR_NUMBER}" ``` If `commit_docs` is true: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): ship phase ${PHASE_NUMBER} — PR #${PR_NUMBER}" --files .planning/STATE.md +gsd-sdk query commit "docs(${padded_phase}): ship phase ${PHASE_NUMBER} — PR #${PR_NUMBER}" .planning/STATE.md ``` diff --git a/get-shit-done/workflows/stats.md b/get-shit-done/workflows/stats.md index 3abda9e5a..5886c560b 100644 --- a/get-shit-done/workflows/stats.md +++ b/get-shit-done/workflows/stats.md @@ -12,7 +12,7 @@ Read all files referenced by the invoking prompt's execution_context before star Gather project statistics: ```bash -STATS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" stats json) +STATS=$(gsd-sdk query stats.json) if [[ "$STATS" == @file:* ]]; then STATS=$(cat "${STATS#@file:}"); fi ``` diff --git a/get-shit-done/workflows/transition.md b/get-shit-done/workflows/transition.md index 37e8c48be..fe3b8ea92 100644 --- a/get-shit-done/workflows/transition.md +++ b/get-shit-done/workflows/transition.md @@ -160,10 +160,10 @@ If found, delete them — phase is complete, handoffs are stale. -**Delegate ROADMAP.md and STATE.md updates to gsd-tools:** +**Delegate ROADMAP.md and STATE.md updates to `gsd-sdk query phase.complete`:** ```bash -TRANSITION=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" phase complete "${current_phase}") +TRANSITION=$(gsd-sdk query phase.complete "${current_phase}") ``` The CLI handles: @@ -273,12 +273,12 @@ After (Phase 2 shipped JWT auth, discovered rate limiting needed): -**Note:** Basic position updates (Current Phase, Status, Current Plan, Last Activity) were already handled by `gsd-tools phase complete` in the update_roadmap_and_state step. +**Note:** Basic position updates (Current Phase, Status, Current Plan, Last Activity) were already handled by `gsd-sdk query phase.complete` in the update_roadmap_and_state step. Verify the updates are correct by reading STATE.md. If the progress bar needs updating, use: ```bash -PROGRESS=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" progress bar --raw) +PROGRESS=$(gsd-sdk query progress.bar --raw) ``` Update the progress bar line in STATE.md with the result. @@ -377,7 +377,7 @@ Resume file: None **MANDATORY: Verify milestone status before presenting next steps.** -**Use the transition result from `gsd-tools phase complete`:** +**Use the transition result from `gsd-sdk query phase.complete`:** The `is_last_phase` field from the phase complete result tells you directly: - `is_last_phase: false` → More phases remain → Go to **Route A** @@ -387,7 +387,7 @@ The `next_phase` and `next_phase_name` fields give you the next phase details. If you need additional context, use: ```bash -ROADMAP=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze) +ROADMAP=$(gsd-sdk query roadmap.analyze) ``` This returns all phases with goals, disk status, and completion info. @@ -406,7 +406,7 @@ In flat mode, go directly to **Route B**. ```bash # Only check if we're in workstream mode if [ -n "$GSD_WORKSTREAM" ]; then - WS_LIST=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" workstream list --raw) + WS_LIST=$(gsd-sdk query workstream.list --raw) fi ``` @@ -526,7 +526,7 @@ to the next milestone — other workstreams are still working. **Clear auto-advance chain flag** — workstream boundary is the natural stopping point: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false +gsd-sdk query config-set workflow._auto_chain_active false ``` @@ -580,7 +580,7 @@ Do NOT auto-invoke any further slash commands. **Clear auto-advance chain flag** — milestone boundary is the natural stopping point: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-set workflow._auto_chain_active false +gsd-sdk query config-set workflow._auto_chain_active false ``` diff --git a/get-shit-done/workflows/ui-phase.md b/get-shit-done/workflows/ui-phase.md index 2c7ec3a46..df1d38175 100644 --- a/get-shit-done/workflows/ui-phase.md +++ b/get-shit-done/workflows/ui-phase.md @@ -19,10 +19,10 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo ## 1. Initialize ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init plan-phase "$PHASE") +INIT=$(gsd-sdk query init.plan-phase "$PHASE") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_UI=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-ui-researcher 2>/dev/null) -AGENT_SKILLS_UI_CHECKER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-ui-checker 2>/dev/null) +AGENT_SKILLS_UI=$(gsd-sdk query agent-skills gsd-ui-researcher 2>/dev/null) +AGENT_SKILLS_UI_CHECKER=$(gsd-sdk query agent-skills gsd-ui-checker 2>/dev/null) ``` Parse JSON for: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `has_context`, `has_research`, `commit_docs`. @@ -32,14 +32,14 @@ Parse JSON for: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded Resolve UI agent models: ```bash -UI_RESEARCHER_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-ui-researcher --raw) -UI_CHECKER_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-ui-checker --raw) +UI_RESEARCHER_MODEL=$(gsd-sdk query resolve-model gsd-ui-researcher --raw) +UI_CHECKER_MODEL=$(gsd-sdk query resolve-model gsd-ui-checker --raw) ``` Check config: ```bash -UI_ENABLED=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_phase 2>/dev/null || echo "true") +UI_ENABLED=$(gsd-sdk query config-get workflow.ui_phase 2>/dev/null || echo "true") ``` **If `UI_ENABLED` is `false`:** @@ -55,7 +55,7 @@ Exit workflow. Extract phase number from $ARGUMENTS. If not provided, detect next unplanned phase. ```bash -PHASE_INFO=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${PHASE}") +PHASE_INFO=$(gsd-sdk query roadmap.get-phase "${PHASE}") ``` **If `found` is false:** Error with available phases. @@ -281,13 +281,13 @@ Dimensions: 6/6 passed ## 11. Commit (if configured) ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): UI design contract" --files "${PHASE_DIR}/${PADDED_PHASE}-UI-SPEC.md" +gsd-sdk query commit "docs(${padded_phase}): UI design contract" "${PHASE_DIR}/${PADDED_PHASE}-UI-SPEC.md" ``` ## 12. Update State ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" state record-session \ +gsd-sdk query state.record-session \ --stopped-at "Phase ${PHASE} UI-SPEC approved" \ --resume-file "${PHASE_DIR}/${PADDED_PHASE}-UI-SPEC.md" ``` diff --git a/get-shit-done/workflows/ui-review.md b/get-shit-done/workflows/ui-review.md index f3991db42..00b04f5fa 100644 --- a/get-shit-done/workflows/ui-review.md +++ b/get-shit-done/workflows/ui-review.md @@ -16,15 +16,15 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo ## 0. Initialize ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_UI_REVIEWER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-ui-reviewer 2>/dev/null) +AGENT_SKILLS_UI_REVIEWER=$(gsd-sdk query agent-skills gsd-ui-reviewer 2>/dev/null) ``` Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`, `commit_docs`. ```bash -UI_AUDITOR_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-ui-auditor --raw) +UI_AUDITOR_MODEL=$(gsd-sdk query resolve-model gsd-ui-auditor --raw) ``` Display banner: @@ -174,7 +174,7 @@ tools is detected at runtime. ## 5. Commit (if configured) ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(${padded_phase}): UI audit review" --files "${PHASE_DIR}/${PADDED_PHASE}-UI-REVIEW.md" +gsd-sdk query commit "docs(${padded_phase}): UI audit review" "${PHASE_DIR}/${PADDED_PHASE}-UI-REVIEW.md" ``` diff --git a/get-shit-done/workflows/validate-phase.md b/get-shit-done/workflows/validate-phase.md index e198773eb..2d0d59795 100644 --- a/get-shit-done/workflows/validate-phase.md +++ b/get-shit-done/workflows/validate-phase.md @@ -16,16 +16,16 @@ Valid GSD subagent types (use exact names — do not fall back to 'general-purpo ## 0. Initialize ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_AUDITOR=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-nyquist-auditor 2>/dev/null) +AGENT_SKILLS_AUDITOR=$(gsd-sdk query agent-skills gsd-nyquist-auditor 2>/dev/null) ``` Parse: `phase_dir`, `phase_number`, `phase_name`, `phase_slug`, `padded_phase`. ```bash -AUDITOR_MODEL=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" resolve-model gsd-nyquist-auditor --raw) -NYQUIST_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.nyquist_validation --raw) +AUDITOR_MODEL=$(gsd-sdk query resolve-model gsd-nyquist-auditor --raw) +NYQUIST_CFG=$(gsd-sdk query config-get workflow.nyquist_validation --raw) ``` If `NYQUIST_CFG` is `false`: exit with "Nyquist validation is disabled. Enable via /gsd-settings." @@ -137,7 +137,7 @@ Handle return: git add {test_files} git commit -m "test(phase-${PHASE}): add Nyquist validation tests" -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs(phase-${PHASE}): add/update validation strategy" +gsd-sdk query commit "docs(phase-${PHASE}): add/update validation strategy" ``` ## 8. Results + Routing diff --git a/get-shit-done/workflows/verify-phase.md b/get-shit-done/workflows/verify-phase.md index 468d27531..91b6744c6 100644 --- a/get-shit-done/workflows/verify-phase.md +++ b/get-shit-done/workflows/verify-phase.md @@ -29,7 +29,7 @@ Then verify each level against the actual codebase. Load phase operation context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init phase-op "${PHASE_ARG}") +INIT=$(gsd-sdk query init.phase-op "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi ``` @@ -37,14 +37,14 @@ Extract from init JSON: `phase_dir`, `phase_number`, `phase_name`, `has_plans`, Then load phase details and list plans/summaries: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${phase_number}" +gsd-sdk query roadmap.get-phase "${phase_number}" grep -E "^| ${phase_number}" .planning/REQUIREMENTS.md 2>/dev/null || true ls "$phase_dir"/*-SUMMARY.md "$phase_dir"/*-PLAN.md 2>/dev/null || true ``` Load full milestone phases for deferred-item filtering (Step 9b): ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap analyze +gsd-sdk query roadmap.analyze ``` Extract **phase goal** from ROADMAP.md (the outcome to verify, not tasks), **requirements** from REQUIREMENTS.md if it exists, and **all milestone phases** from roadmap analyze (for cross-referencing gaps against later phases). @@ -53,11 +53,11 @@ Extract **phase goal** from ROADMAP.md (the outcome to verify, not tasks), **req **Option A: Must-haves in PLAN frontmatter** -Use gsd-tools to extract must_haves from each PLAN: +Use `gsd-sdk query` verify handlers (or legacy gsd-tools) to extract must_haves from each PLAN: ```bash for plan in "$PHASE_DIR"/*-PLAN.md; do - MUST_HAVES=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" frontmatter get "$plan" --field must_haves) + MUST_HAVES=$(gsd-sdk query frontmatter.get "$plan" --field must_haves) echo "=== $plan ===" && echo "$MUST_HAVES" done ``` @@ -71,7 +71,7 @@ Aggregate all must_haves across plans for phase-level verification. If no must_haves in frontmatter (MUST_HAVES returns error or empty), check for Success Criteria: ```bash -PHASE_DATA=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" roadmap get-phase "${phase_number}" --raw) +PHASE_DATA=$(gsd-sdk query roadmap.get-phase "${phase_number}" --raw) ``` Parse the `success_criteria` array from the JSON output. If non-empty: @@ -103,11 +103,11 @@ For each truth: identify supporting artifacts → check artifact status → chec -Use gsd-tools for artifact verification against must_haves in each PLAN: +Use `gsd-sdk query verify.artifacts` (or legacy gsd-tools) for artifact verification against must_haves in each PLAN: ```bash for plan in "$PHASE_DIR"/*-PLAN.md; do - ARTIFACT_RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify artifacts "$plan") + ARTIFACT_RESULT=$(gsd-sdk query verify.artifacts "$plan") echo "=== $plan ===" && echo "$ARTIFACT_RESULT" done ``` @@ -146,11 +146,11 @@ wiring or leftover code from plan revisions. -Use gsd-tools for key link verification against must_haves in each PLAN: +Use `gsd-sdk query verify.key-links` (or legacy gsd-tools) for key link verification against must_haves in each PLAN: ```bash for plan in "$PHASE_DIR"/*-PLAN.md; do - LINKS_RESULT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" verify key-links "$plan") + LINKS_RESULT=$(gsd-sdk query verify.key-links "$plan") echo "=== $plan ===" && echo "$LINKS_RESULT" done ``` diff --git a/get-shit-done/workflows/verify-work.md b/get-shit-done/workflows/verify-work.md index 3b4c02d0e..ceef9ff1e 100644 --- a/get-shit-done/workflows/verify-work.md +++ b/get-shit-done/workflows/verify-work.md @@ -30,10 +30,10 @@ No Pass/Fail buttons. No severity questions. Just: "Here's what should happen. D If $ARGUMENTS contains a phase number, load context: ```bash -INIT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" init verify-work "${PHASE_ARG}") +INIT=$(gsd-sdk query init.verify-work "${PHASE_ARG}") if [[ "$INIT" == @file:* ]]; then INIT=$(cat "${INIT#@file:}"); fi -AGENT_SKILLS_PLANNER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-planner 2>/dev/null) -AGENT_SKILLS_CHECKER=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" agent-skills gsd-checker 2>/dev/null) +AGENT_SKILLS_PLANNER=$(gsd-sdk query agent-skills gsd-planner 2>/dev/null) +AGENT_SKILLS_CHECKER=$(gsd-sdk query agent-skills gsd-checker 2>/dev/null) ``` Parse JSON for: `planner_model`, `checker_model`, `commit_docs`, `phase_found`, `phase_dir`, `phase_number`, `phase_name`, `has_verification`, `uat_path`. @@ -93,7 +93,7 @@ Before running manual UAT, check whether this phase has a UI component and wheth `mcp__playwright__*` or `mcp__puppeteer__*` tools are available in the current session. ``` -UI_PHASE_FLAG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.ui_phase --raw 2>/dev/null || echo "true") +UI_PHASE_FLAG=$(gsd-sdk query config-get workflow.ui_phase --raw 2>/dev/null || echo "true") UI_SPEC_FILE=$(ls "${PHASE_DIR}"/*-UI-SPEC.md 2>/dev/null | head -1) ``` @@ -233,7 +233,7 @@ Proceed to `present_test`. Render the checkpoint from the structured UAT file instead of composing it freehand: ```bash -CHECKPOINT=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" uat render-checkpoint --file "$uat_path" --raw) +CHECKPOINT=$(gsd-sdk query uat.render-checkpoint --file "$uat_path" --raw) if [[ "$CHECKPOINT" == @file:* ]]; then CHECKPOINT=$(cat "${CHECKPOINT#@file:}"); fi ``` @@ -391,7 +391,7 @@ Clear Current Test section: Commit the UAT file: ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "test({phase_num}): complete UAT - {passed} passed, {issues} issues" --files ".planning/phases/XX-name/{phase_num}-UAT.md" +gsd-sdk query commit "test({phase_num}): complete UAT - {passed} passed, {issues} issues" ".planning/phases/XX-name/{phase_num}-UAT.md" ``` Present summary: @@ -415,7 +415,7 @@ Present summary: **If issues == 0:** ```bash -SECURITY_CFG=$(node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") +SECURITY_CFG=$(gsd-sdk query config-get workflow.security_enforcement --raw 2>/dev/null || echo "true") SECURITY_FILE=$(ls "${PHASE_DIR}"/*-SECURITY.md 2>/dev/null | head -1) ``` @@ -461,6 +461,8 @@ All tests passed. Phase {phase} marked complete. Run phase artifact scan to surface any open items before marking phase verified: +`audit-open` is CJS-only until registered on `gsd-sdk query`: + ```bash node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" audit-open --json 2>/dev/null ``` diff --git a/sdk/prompts/agents/gsd-research-synthesizer.md b/sdk/prompts/agents/gsd-research-synthesizer.md index e07b954ef..d6ff1684b 100644 --- a/sdk/prompts/agents/gsd-research-synthesizer.md +++ b/sdk/prompts/agents/gsd-research-synthesizer.md @@ -129,7 +129,7 @@ Write to `.planning/research/SUMMARY.md` The 4 parallel researcher agents write files but do NOT commit. You commit everything together. ```bash -node "$HOME/.claude/get-shit-done/bin/gsd-tools.cjs" commit "docs: complete project research" --files .planning/research/ +gsd-sdk query commit "docs: complete project research" .planning/research/ ``` ## Step 8: Return Summary diff --git a/sdk/src/cli.test.ts b/sdk/src/cli.test.ts index b7c9dedab..c2587f421 100644 --- a/sdk/src/cli.test.ts +++ b/sdk/src/cli.test.ts @@ -108,12 +108,22 @@ describe('parseCliArgs', () => { expect(() => parseCliArgs(['run', 'hello', '--not-a-real-option'])).toThrow(); }); - it('parses query with --pick stripped before strict parse', () => { + it('parses query permissively (keeps gsd-tools flags like --pick, --json)', () => { const result = parseCliArgs([ 'query', 'state.load', '--pick', 'data', '--project-dir', 'C:\\tmp\\proj', ]); expect(result.command).toBe('query'); expect(result.projectDir).toBe('C:\\tmp\\proj'); + expect(result.queryArgv).toEqual(['state.load', '--pick', 'data']); + }); + + it('parses query with extra flags forwarded in queryArgv', () => { + const result = parseCliArgs([ + 'query', 'audit-open', '--json', '--project-dir', 'D:\\proj', + ]); + expect(result.command).toBe('query'); + expect(result.projectDir).toBe('D:\\proj'); + expect(result.queryArgv).toEqual(['audit-open', '--json']); }); // ─── Init command parsing ────────────────────────────────────────────── diff --git a/sdk/src/cli.ts b/sdk/src/cli.ts index 63baf5abf..a7af34cb0 100644 --- a/sdk/src/cli.ts +++ b/sdk/src/cli.ts @@ -34,20 +34,82 @@ export interface ParsedCliArgs { ws: string | undefined; help: boolean; version: boolean; + /** + * When `command === 'query'`, tokens after `query` with only known SDK flags removed. + * Extra flags are kept so handlers that share gsd-tools-style argv (e.g. `--pick`) still receive them. + */ + queryArgv?: string[]; } /** - * Strip `--pick ` from argv before parseArgs so the global parser stays strict. - * Query dispatch removes --pick separately in main(); this only affects CLI parsing. + * Parse `gsd-sdk query …` without rejecting unknown flags (query argv is forwarded to the registry). */ -function argvForCliParse(argv: string[]): string[] { - if (argv[0] !== 'query') return argv; - const copy = [...argv]; - const pickIdx = copy.indexOf('--pick'); - if (pickIdx !== -1 && pickIdx + 1 < copy.length) { - copy.splice(pickIdx, 2); +function parseCliArgsQueryPermissive(argv: string[]): ParsedCliArgs { + let projectDir = process.cwd(); + let ws: string | undefined; + let wsPort: number | undefined; + let model: string | undefined; + let maxBudget: number | undefined; + let help = false; + let version = false; + const queryArgv: string[] = []; + + let i = 1; + while (i < argv.length) { + const a = argv[i]; + if (a === '--project-dir' && argv[i + 1]) { + projectDir = argv[i + 1]; + i += 2; + continue; + } + if (a === '--ws' && argv[i + 1]) { + ws = argv[i + 1]; + i += 2; + continue; + } + if (a === '--ws-port' && argv[i + 1]) { + wsPort = Number(argv[i + 1]); + i += 2; + continue; + } + if (a === '--model' && argv[i + 1]) { + model = argv[i + 1]; + i += 2; + continue; + } + if (a === '--max-budget' && argv[i + 1]) { + maxBudget = Number(argv[i + 1]); + i += 2; + continue; + } + if (a === '-h' || a === '--help') { + help = true; + i += 1; + continue; + } + if (a === '-v' || a === '--version') { + version = true; + i += 1; + continue; + } + queryArgv.push(a); + i += 1; } - return copy; + + return { + command: 'query', + prompt: undefined, + initInput: undefined, + init: undefined, + projectDir, + wsPort, + model, + maxBudget, + ws, + help, + version, + queryArgv, + }; } /** @@ -55,8 +117,12 @@ function argvForCliParse(argv: string[]): string[] { * Exported for testing — the main() function uses this internally. */ export function parseCliArgs(argv: string[]): ParsedCliArgs { + if (argv[0] === 'query') { + return parseCliArgsQueryPermissive(argv); + } + const { values, positionals } = parseArgs({ - args: argvForCliParse(argv), + args: argv, options: { 'project-dir': { type: 'string', default: process.cwd() }, 'ws-port': { type: 'string' }, @@ -106,8 +172,8 @@ Commands: @path/to/prd.md Read input from a file "description" Use text directly (empty) Read from stdin - query Execute a registered native query command (registry: sdk/src/query/index.ts) - Use --pick to extract a specific field + query Registered query handlers only (longest-prefix argv match; see QUERY-HANDLERS.md) + Use --pick to extract a specific field from JSON output Options: --init Bootstrap from a PRD before running (auto only) @@ -226,13 +292,13 @@ export async function main(argv: string[] = process.argv.slice(2)): Promise { // ─── resolveGsdToolsPath() tests ──────────────────────────────────────── describe('resolveGsdToolsPath()', () => { - it('returns repo-local path when it exists', async () => { + it('prefers bundled gsd-tools over project .claude when the bundled file exists', async () => { const localBinDir = join(tmpDir, '.claude', 'get-shit-done', 'bin'); await mkdir(localBinDir, { recursive: true }); await writeFile(join(localBinDir, 'gsd-tools.cjs'), '// stub'); const result = resolveGsdToolsPath(tmpDir); - expect(result).toBe(join(localBinDir, 'gsd-tools.cjs')); + if (existsSync(BUNDLED_GSD_TOOLS_PATH)) { + expect(result).toBe(BUNDLED_GSD_TOOLS_PATH); + } else { + expect(result).toBe(join(localBinDir, 'gsd-tools.cjs')); + } }); it('falls back to bundled repo path when repo-local does not exist', () => { @@ -345,7 +349,7 @@ describe('GSDTools', () => { expect(result).toBe(expected); }); - it('constructor uses repo-local path when available', async () => { + it('uses explicit gsdToolsPath when provided (overrides bundled / .claude resolution)', async () => { const localBinDir = join(tmpDir, '.claude', 'get-shit-done', 'bin'); await mkdir(localBinDir, { recursive: true }); const scriptPath = join(localBinDir, 'gsd-tools.cjs'); @@ -355,8 +359,7 @@ describe('GSDTools', () => { { mode: 0o755 }, ); - // No explicit gsdToolsPath — should auto-resolve to local - const tools = new GSDTools({ projectDir: tmpDir }); + const tools = new GSDTools({ projectDir: tmpDir, gsdToolsPath: scriptPath }); const result = await tools.exec('test', []); expect(result).toEqual({ source: 'local' }); }); diff --git a/sdk/src/gsd-tools.ts b/sdk/src/gsd-tools.ts index 3730e99d0..9639c876c 100644 --- a/sdk/src/gsd-tools.ts +++ b/sdk/src/gsd-tools.ts @@ -151,7 +151,12 @@ export class GSDTools { let jsonStr = trimmed; if (jsonStr.startsWith('@file:')) { const filePath = jsonStr.slice(6).trim(); - jsonStr = await readFile(filePath, 'utf-8'); + try { + jsonStr = await readFile(filePath, 'utf-8'); + } catch (err) { + const reason = err instanceof Error ? err.message : String(err); + throw new Error(`Failed to read gsd-tools @file: indirection at "${filePath}": ${reason}`); + } } return JSON.parse(jsonStr); @@ -294,13 +299,14 @@ export class GSDTools { // ─── Path resolution ──────────────────────────────────────────────────────── /** - * Resolve gsd-tools.cjs path with bundled-repo fallback. - * Probe order: project-local → repo-bundled → global home directory. + * Resolve gsd-tools.cjs path. + * Probe order: SDK-bundled repo copy → `project/.claude/get-shit-done/` → + * `~/.claude/get-shit-done/`. */ export function resolveGsdToolsPath(projectDir: string): string { const candidates = [ - join(projectDir, '.claude', 'get-shit-done', 'bin', 'gsd-tools.cjs'), BUNDLED_GSD_TOOLS_PATH, + join(projectDir, '.claude', 'get-shit-done', 'bin', 'gsd-tools.cjs'), join(homedir(), '.claude', 'get-shit-done', 'bin', 'gsd-tools.cjs'), ]; diff --git a/sdk/src/query/QUERY-HANDLERS.md b/sdk/src/query/QUERY-HANDLERS.md index 0f2b71bd3..9df469cd5 100644 --- a/sdk/src/query/QUERY-HANDLERS.md +++ b/sdk/src/query/QUERY-HANDLERS.md @@ -2,6 +2,13 @@ This document records contracts for the typed query layer consumed by `gsd-sdk query` and programmatic `createRegistry()` callers. +## `gsd-sdk query` routing + +- **Longest-prefix match** on argv (`resolveQueryArgv` in `registry.ts`): tries joined keys `a.b.c` then `a b c` for each prefix length, longest first. Example: `state update status X` → handler `state.update` with args `[status, X]`. +- **Dotted single token**: one token like `init.new-project` matches the registry; if the first pass finds no handler, a single dotted token is split and matching runs again (same helper as above). +- **No CJS passthrough**: if nothing matches a registered handler, the CLI exits with an error. Operations not ported to the query registry (e.g. `audit-open`, `graphify`, `from-gsd2`, `state validate`) must use `node …/gsd-tools.cjs` directly — see `docs/CLI-TOOLS.md`. +- **Output**: JSON written to stdout for successful handler results. + ## Error handling - **Validation and programmer errors**: Handlers throw `GSDError` with an `ErrorClassification` (e.g. missing required args, invalid phase). The CLI maps these to exit codes via `exitCodeFor()`. diff --git a/sdk/src/query/index.ts b/sdk/src/query/index.ts index 5ee813799..c99784c97 100644 --- a/sdk/src/query/index.ts +++ b/sdk/src/query/index.ts @@ -381,6 +381,7 @@ export function createRegistry(eventStream?: GSDEventStream): QueryRegistry { registry.register('milestone complete', milestoneComplete); registry.register('summary.extract', summaryExtract); registry.register('summary extract', summaryExtract); + registry.register('summary-extract', summaryExtract); registry.register('history.digest', historyDigest); registry.register('history digest', historyDigest); registry.register('history-digest', historyDigest); diff --git a/sdk/src/query/registry.test.ts b/sdk/src/query/registry.test.ts index 382175678..5e867b8eb 100644 --- a/sdk/src/query/registry.test.ts +++ b/sdk/src/query/registry.test.ts @@ -3,7 +3,7 @@ */ import { describe, it, expect, vi } from 'vitest'; -import { QueryRegistry, extractField } from './registry.js'; +import { QueryRegistry, extractField, resolveQueryArgv } from './registry.js'; import { createRegistry, QUERY_MUTATION_COMMANDS } from './index.js'; import type { QueryResult } from './utils.js'; @@ -130,6 +130,11 @@ describe('createRegistry', () => { expect(registry.has('current-timestamp')).toBe(true); }); + it('has summary-extract dash alias (PR #2179 / workflows)', () => { + const registry = createRegistry(); + expect(registry.has('summary-extract')).toBe(true); + }); + it('can dispatch generate-slug', async () => { const registry = createRegistry(); const result = await registry.dispatch('generate-slug', ['My Phase'], '/tmp'); @@ -137,3 +142,40 @@ describe('createRegistry', () => { expect(result).toEqual({ data: { slug: 'my-phase' } }); }); }); + +// ─── resolveQueryArgv ─────────────────────────────────────────────────────── + +describe('resolveQueryArgv', () => { + it('matches longest dotted prefix (state.update + args)', () => { + const registry = createRegistry(); + const m = resolveQueryArgv(['state', 'update', 'status', 'X'], registry); + expect(m).toEqual({ cmd: 'state.update', args: ['status', 'X'] }); + }); + + it('matches longest prefix (phase.add wins over phase when both registered)', () => { + const registry = createRegistry(); + const m = resolveQueryArgv(['phase', 'add', 'desc'], registry); + expect(m).toEqual({ cmd: 'phase.add', args: ['desc'] }); + }); + + it('prefers longer match over shorter', () => { + const registry = createRegistry(); + const m = resolveQueryArgv(['state', 'load'], registry); + expect(m?.cmd).toBe('state.load'); + expect(m?.args).toEqual([]); + }); + + it('returns null when no prefix matches', () => { + const registry = createRegistry(); + const m = resolveQueryArgv(['totally-unknown', 'x'], registry); + expect(m).toBeNull(); + }); + + it('matches a single dotted command token', () => { + const registry = createRegistry(); + expect(resolveQueryArgv(['init.new-project'], registry)).toEqual({ + cmd: 'init.new-project', + args: [], + }); + }); +}); diff --git a/sdk/src/query/registry.ts b/sdk/src/query/registry.ts index 8a89f7a39..c98e399a0 100644 --- a/sdk/src/query/registry.ts +++ b/sdk/src/query/registry.ts @@ -2,8 +2,9 @@ * Query command registry — routes commands to native SDK handlers. * * The registry is a flat `Map` that maps command names - * to handler functions. Unknown commands throw GSDError — the gsd-tools.cjs - * fallback was removed in v3.0 when all commands were migrated to native handlers. + * to handler functions. Unknown keys passed to `dispatch()` throw `GSDError`. + * The `gsd-sdk query` CLI resolves argv with `resolveQueryArgv()` before dispatch; + * there is no automatic delegation to `gsd-tools.cjs`. * * Also exports `extractField` — a TypeScript port of the `--pick` field * extraction logic from gsd-tools.cjs (lines 365-382). @@ -59,9 +60,9 @@ export function extractField(obj: unknown, fieldPath: string): unknown { /** * Flat command registry that routes query commands to native handlers. * - * Unknown commands throw `GSDError` from `dispatch()` — there is no fallback - * to gsd-tools.cjs (bridge removed in v3.0). All supported commands must be - * registered via `register()`. + * `dispatch()` throws `GSDError` for unknown command keys. The `gsd-sdk query` + * CLI uses `resolveQueryArgv()` to map argv to a registered handler; there is + * no passthrough to `gsd-tools.cjs` — CJS-only commands stay on the legacy CLI. */ export class QueryRegistry { private handlers = new Map(); @@ -106,9 +107,6 @@ export class QueryRegistry { /** * Dispatch a command to its registered native handler. * - * Throws GSDError for unknown commands — the gsd-tools.cjs fallback was - * removed in v3.0. All commands must be registered as native handlers (T-14-13). - * * @param command - The command name to dispatch * @param args - Arguments to pass to the handler * @param projectDir - The project directory for context @@ -126,3 +124,51 @@ export class QueryRegistry { return handler(args, projectDir); } } + +function expandSingleDottedToken(tokens: string[]): string[] { + if (tokens.length !== 1 || tokens[0].startsWith('--')) { + return tokens; + } + const t = tokens[0]; + if (!t.includes('.')) { + return tokens; + } + return t.split('.'); +} + +function matchRegisteredPrefix( + tokens: string[], + registry: QueryRegistry, +): { cmd: string; args: string[] } | null { + for (let i = tokens.length; i >= 1; i--) { + const head = tokens.slice(0, i); + const dotted = head.join('.'); + const spaced = head.join(' '); + if (registry.has(dotted)) { + return { cmd: dotted, args: tokens.slice(i) }; + } + if (registry.has(spaced)) { + return { cmd: spaced, args: tokens.slice(i) }; + } + } + return null; +} + +/** + * Map argv after `gsd-sdk query` to a registered handler key and remaining args. + * Longest-prefix match on dotted (`a.b.c`) and spaced (`a b c`) keys; if no match, + * expands a single dotted token (`state.validate` → `state`, `validate`) and retries. + */ +export function resolveQueryArgv( + tokens: string[], + registry: QueryRegistry, +): { cmd: string; args: string[] } | null { + let matched = matchRegisteredPrefix(tokens, registry); + if (!matched) { + const expanded = expandSingleDottedToken(tokens); + if (expanded !== tokens) { + matched = matchRegisteredPrefix(expanded, registry); + } + } + return matched; +} diff --git a/tests/autonomous-allowed-tools.test.cjs b/tests/autonomous-allowed-tools.test.cjs index ecf1cb5dc..9539d9693 100644 --- a/tests/autonomous-allowed-tools.test.cjs +++ b/tests/autonomous-allowed-tools.test.cjs @@ -18,7 +18,7 @@ describe('commands/gsd/autonomous.md allowed-tools', () => { const content = fs.readFileSync(filePath, 'utf-8'); // Extract the YAML frontmatter block between the first pair of --- delimiters - const frontmatterMatch = content.match(/^---\n([\s\S]*?)\n---/); + const frontmatterMatch = content.match(/^---\r?\n([\s\S]*?)\r?\n---/); assert.ok(frontmatterMatch, 'autonomous.md must have YAML frontmatter'); const frontmatter = frontmatterMatch[1]; diff --git a/tests/claude-md.test.cjs b/tests/claude-md.test.cjs index cd7b3a04d..c26a4560f 100644 --- a/tests/claude-md.test.cjs +++ b/tests/claude-md.test.cjs @@ -69,7 +69,10 @@ describe('new-project workflow includes CLAUDE.md generation', () => { const content = fs.readFileSync(workflowPath, 'utf-8'); assert.ok(content.includes('generate-claude-md')); // Codex fix: workflow now uses $INSTRUCTION_FILE (AGENTS.md for Codex, CLAUDE.md otherwise) - assert.ok(content.includes('--files .planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md "$INSTRUCTION_FILE"')); + assert.ok( + content.includes('.planning/ROADMAP.md .planning/STATE.md .planning/REQUIREMENTS.md "$INSTRUCTION_FILE"'), + 'final roadmap commit should stage ROADMAP, STATE, REQUIREMENTS, and instruction file' + ); }); test('new-project artifacts reference instruction file variable', () => { diff --git a/tests/forensics.test.cjs b/tests/forensics.test.cjs index 5367467ba..d0caf75a3 100644 --- a/tests/forensics.test.cjs +++ b/tests/forensics.test.cjs @@ -141,8 +141,8 @@ describe('forensics workflow', () => { test('workflow updates STATE.md', () => { const content = fs.readFileSync(workflowPath, 'utf-8'); assert.ok( - content.includes('state record-session'), - 'should update STATE.md via gsd-tools' + content.includes('state record-session') || content.includes('state.record-session'), + 'should update STATE.md via state record-session (CJS or gsd-sdk query)' ); }); diff --git a/tests/gates-taxonomy.test.cjs b/tests/gates-taxonomy.test.cjs index 5f2c0e49b..9ea51f191 100644 --- a/tests/gates-taxonomy.test.cjs +++ b/tests/gates-taxonomy.test.cjs @@ -89,7 +89,7 @@ describe('gates taxonomy (#1715)', () => { test('gsd-plan-checker.md references gates.md in required_reading block', () => { const planChecker = path.join(ROOT, 'agents', 'gsd-plan-checker.md'); const content = fs.readFileSync(planChecker, 'utf-8'); - const match = content.match(/\n([\s\S]*?)\n<\/required_reading>/); + const match = content.match(/\r?\n([\s\S]*?)\r?\n<\/required_reading>/); assert.ok( match, 'gsd-plan-checker.md must have a block' @@ -103,7 +103,7 @@ describe('gates taxonomy (#1715)', () => { test('gsd-verifier.md references gates.md in required_reading block', () => { const verifier = path.join(ROOT, 'agents', 'gsd-verifier.md'); const content = fs.readFileSync(verifier, 'utf-8'); - const match = content.match(/\n([\s\S]*?)\n<\/required_reading>/); + const match = content.match(/\r?\n([\s\S]*?)\r?\n<\/required_reading>/); assert.ok( match, 'gsd-verifier.md must have a block' diff --git a/tests/gsd-tools-path-refs.test.cjs b/tests/gsd-tools-path-refs.test.cjs index 6738977ce..d2518568d 100644 --- a/tests/gsd-tools-path-refs.test.cjs +++ b/tests/gsd-tools-path-refs.test.cjs @@ -38,20 +38,24 @@ describe('command files: gsd-tools path references (#1766)', () => { 'Violations:\n' + violations.join('\n')); }); - test('workstreams.md uses standard gsd-tools.cjs path', () => { + test('workstreams.md documents gsd-sdk query or legacy gsd-tools.cjs', () => { const content = fs.readFileSync( path.join(COMMANDS_DIR, 'workstreams.md'), 'utf-8' ); - const nodeLines = content.split('\n').filter(l => /node\s/.test(l)); - assert.ok(nodeLines.length > 0, - 'workstreams.md should contain node invocations'); + assert.ok( + /gsd-sdk\s+query/.test(content) || /gsd-tools\.cjs/.test(content), + 'workstreams.md should document gsd-sdk query or gsd-tools.cjs' + ); - for (const line of nodeLines) { - assert.ok( - line.includes('gsd-tools.cjs'), - 'Each node invocation must reference gsd-tools.cjs, got: ' + line.trim() - ); + const lines = content.split('\n'); + for (const line of lines) { + if (/node\s/.test(line)) { + assert.ok( + line.includes('gsd-tools.cjs'), + 'Each node invocation must reference gsd-tools.cjs, got: ' + line.trim() + ); + } } }); }); diff --git a/tests/milestone-summary.test.cjs b/tests/milestone-summary.test.cjs index 25946290b..56373d4d1 100644 --- a/tests/milestone-summary.test.cjs +++ b/tests/milestone-summary.test.cjs @@ -107,8 +107,8 @@ describe('milestone-summary workflow', () => { test('workflow updates STATE.md', () => { const content = fs.readFileSync(workflowPath, 'utf-8'); assert.ok( - content.includes('state record-session'), - 'should update STATE.md via gsd-tools' + content.includes('state record-session') || content.includes('state.record-session'), + 'should update STATE.md via state record-session (CJS or gsd-sdk query)' ); }); diff --git a/tests/quick-session-management.test.cjs b/tests/quick-session-management.test.cjs index 282f455c7..4db001090 100644 --- a/tests/quick-session-management.test.cjs +++ b/tests/quick-session-management.test.cjs @@ -57,8 +57,8 @@ describe('quick session management (#2155)', () => { test('quick command list uses frontmatter get for status', () => { assert.ok( - quickCmd.includes('frontmatter get'), - 'list should use frontmatter get to read status' + quickCmd.includes('frontmatter get') || quickCmd.includes('frontmatter.get'), + 'list should use frontmatter get / frontmatter.get to read status' ); }); diff --git a/tests/stale-colon-refs.test.cjs b/tests/stale-colon-refs.test.cjs index 7e501ee32..713f9bc96 100644 --- a/tests/stale-colon-refs.test.cjs +++ b/tests/stale-colon-refs.test.cjs @@ -20,10 +20,11 @@ const ROOT = path.resolve(__dirname, '..'); /** * Recursively collect files matching the given extensions, excluding - * CHANGELOG.md, node_modules/, .git/, and dist/. + * CHANGELOG.md, node_modules/, .git/, dist/, local planning overlays, and + * root CLAUDE.md (gitignored local IDE overlay — see repo .gitignore). */ function collectFiles(dir, extensions, results = []) { - const EXCLUDED_DIRS = new Set(['node_modules', '.git', 'dist', '.claude', '.worktrees']); + const EXCLUDED_DIRS = new Set(['node_modules', '.git', 'dist', '.claude', '.worktrees', '.planning']); let entries; try { entries = fs.readdirSync(dir, { withFileTypes: true }); @@ -36,6 +37,9 @@ function collectFiles(dir, extensions, results = []) { if (entry.isDirectory()) { collectFiles(full, extensions, results); } else if (entry.isFile()) { + if (entry.name === 'CLAUDE.md' && path.resolve(dir) === path.resolve(ROOT)) { + continue; + } const ext = path.extname(entry.name); if (extensions.has(ext) && entry.name !== 'CHANGELOG.md') { results.push(full); diff --git a/tests/thread-session-management.test.cjs b/tests/thread-session-management.test.cjs index efb6f29b4..153262d57 100644 --- a/tests/thread-session-management.test.cjs +++ b/tests/thread-session-management.test.cjs @@ -66,8 +66,8 @@ describe('thread session management (#2156)', () => { test('thread command list reads frontmatter status', () => { assert.ok( - threadCmd.includes('frontmatter get'), - 'list mode should read status via frontmatter get' + threadCmd.includes('frontmatter get') || threadCmd.includes('frontmatter.get'), + 'list mode should read status via frontmatter get / frontmatter.get' ); }); diff --git a/tests/verifier-deferred-items.test.cjs b/tests/verifier-deferred-items.test.cjs index 3df5b7ff1..786a43892 100644 --- a/tests/verifier-deferred-items.test.cjs +++ b/tests/verifier-deferred-items.test.cjs @@ -36,8 +36,8 @@ describe('verifier deferred-items filtering (#1624)', () => { test('Step 9b references roadmap analyze for cross-referencing', () => { verifierContent = verifierContent || fs.readFileSync(verifierPath, 'utf-8'); assert.ok( - verifierContent.includes('roadmap analyze'), - 'Step 9b should reference "roadmap analyze" command for loading full milestone data' + verifierContent.includes('roadmap analyze') || verifierContent.includes('roadmap.analyze'), + 'Step 9b should reference roadmap analyze (CJS or gsd-sdk query) for loading full milestone data' ); }); diff --git a/tests/workspace.test.cjs b/tests/workspace.test.cjs index 628c2caa7..67f4a551e 100644 --- a/tests/workspace.test.cjs +++ b/tests/workspace.test.cjs @@ -338,7 +338,10 @@ describe('workspace command files', () => { test('new-workspace workflow exists', () => { const content = fs.readFileSync(path.join(baseDir, 'get-shit-done/workflows/new-workspace.md'), 'utf8'); - assert.ok(content.includes('init new-workspace')); + assert.ok( + content.includes('init new-workspace') || content.includes('init.new-workspace'), + 'expected init new-workspace (CJS) or gsd-sdk query init.new-workspace' + ); assert.ok(content.includes('WORKSPACE.md')); assert.ok(content.includes('git worktree add')); assert.ok(content.includes('git clone')); @@ -346,12 +349,18 @@ describe('workspace command files', () => { test('list-workspaces workflow exists', () => { const content = fs.readFileSync(path.join(baseDir, 'get-shit-done/workflows/list-workspaces.md'), 'utf8'); - assert.ok(content.includes('init list-workspaces')); + assert.ok( + content.includes('init list-workspaces') || content.includes('init.list-workspaces'), + 'expected init list-workspaces or gsd-sdk query init.list-workspaces' + ); }); test('remove-workspace workflow exists', () => { const content = fs.readFileSync(path.join(baseDir, 'get-shit-done/workflows/remove-workspace.md'), 'utf8'); - assert.ok(content.includes('init remove-workspace')); + assert.ok( + content.includes('init remove-workspace') || content.includes('init.remove-workspace'), + 'expected init remove-workspace or gsd-sdk query init.remove-workspace' + ); assert.ok(content.includes('git worktree remove')); }); });