Commit Graph

133 Commits

Author SHA1 Message Date
Tom Boucher
3e2c85e6fd refactor: consolidate STATE.md field helpers, fix command injection in isGitIgnored
Refactoring:
- Extract stateReplaceFieldWithFallback() to state.cjs as single source of truth
  for the try-primary-then-fallback pattern that was duplicated inline across
  phase.cjs, milestone.cjs, and state.cjs
- Replace all inline bold-only regex patterns in cmdPhaseComplete with shared
  stateReplaceField/stateExtractField helpers — now supports both **Bold:**
  and plain Field: STATE.md formats (fixes the same bug as #924)
- Replace inline bold-only regex patterns in cmdMilestoneComplete with shared helpers
- Replace inline bold-only regex for Completed Phases/Total Phases/Progress
  counters in cmdPhaseComplete with stateExtractField/stateReplaceField
- Replace inline bold-only Total Phases regex in cmdPhaseRemove with shared helpers

Security:
- Fix command injection surface in isGitIgnored (core.cjs): replace execSync with
  string concatenation with execFileSync using array arguments — prevents shell
  interpretation of special characters in file paths

Tests (7 new):
- 5 tests for stateReplaceFieldWithFallback: primary field, fallback, neither,
  preference, and plain format
- 1 regression test: phase complete with plain-format STATE.md fields
- 1 regression test: milestone complete with plain-format STATE.md fields

854 tests pass (was 847). No behavioral regressions.
2026-03-19 15:05:20 -04:00
Tom Boucher
0afffb15f5 feat(core): worktree-aware .planning/ resolution and file locking (#1215)
- Add resolveWorktreeRoot() that detects linked worktrees via
  git rev-parse --git-common-dir and resolves to the main worktree
  where .planning/ lives
- Add withPlanningLock() file-based locking mechanism to prevent
  concurrent worktrees from corrupting shared planning files
- Wire worktree root resolution into gsd-tools.cjs main entry point
- Add regression tests for resolveWorktreeRoot (non-git, normal repo)
  and withPlanningLock (normal execution, error cleanup, stale lock
  recovery)
2026-03-19 13:41:11 -04:00
Tom Boucher
78fa8f4052 Merge pull request #1224 from trek-e/feat/discussion-log-1209
feat(discuss-phase): auto-generate DISCUSSION-LOG.md audit trail
2026-03-19 13:00:13 -04:00
Tom Boucher
44e141c043 Merge pull request #1218 from j2h4u/fix/one-liner-extraction
fix(lifecycle): extract one-liner from summary body when not in frontmatter
2026-03-19 12:59:52 -04:00
Tom Boucher
aa29c46ca6 Merge pull request #947 from j2h4u/fix/state-advance-plan-compound
fix(state): parse compound Plan field in advance-plan command
2026-03-19 12:59:18 -04:00
Tom Boucher
6d7f9e35e5 Merge pull request #923 from j2h4u/fix/progress-table-columns
fix(roadmap): handle 5-column progress tables with Milestone column
2026-03-19 12:58:47 -04:00
j2h4u
e3bc614eb7 fix(roadmap): handle 5-column progress tables with Milestone column
The regex-based table parser captured a fixed number of columns,
so 5-column tables (Phase | Milestone | Plans | Status | Completed)
had the Milestone column eaten and Status/Date written to wrong cells.

Replaced regex with cell-based `split('|')` parsing that detects
column count (4 or 5) and updates the correct cells by index.
Affects both `cmdRoadmapUpdatePlanProgress` and `cmdPhaseComplete`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 21:30:41 +05:00
j2h4u
104a39e573 fix(lifecycle): extract one-liner from summary body when not in frontmatter
The summary template puts the one-liner as a `**bold**` line after the
`# Phase N` heading, but `cmdSummaryExtract` and `cmdMilestoneComplete`
only checked frontmatter `one-liner` field — which is often empty.

Adds `extractOneLinerFromBody()` to core.cjs as a fallback that parses
the first `**...**` line after the heading.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 21:29:25 +05:00
j2h4u
85a65fd384 fix(state): parse compound Plan field in advance-plan command
`cmdStateAdvancePlan` expected separate `Current Plan` and
`Total Plans in Phase` fields, but the current STATE.md template
uses a single compound field: `Plan: X of Y in current phase`.

Now tries legacy separate fields first, then falls back to parsing
the compound format. Preserves the compound format when writing back
(replaces only the plan number). Also handles `Last activity`
(lowercase) field name from current template.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 21:28:26 +05:00
Tom Boucher
61d82dc3c0 feat(discuss-phase): auto-generate DISCUSSION-LOG.md for audit trail (#1209)
- Generate {phase_num}-DISCUSSION-LOG.md alongside CONTEXT.md during
  discuss-phase sessions
- Log captures all options presented per gray area (not just the
  selected one), user's choice, notes, Claude's discretion items,
  and deferred ideas
- File is explicitly marked as audit-only — not for agent consumption
- Add discussion-log.md template with format specification
- Track Q&A data accumulation instruction in discuss_areas step
- Commit discussion log alongside CONTEXT.md in same git commit
- Add regression tests for workflow reference and template existence
2026-03-19 12:25:59 -04:00
Tom Boucher
342ca5929d fix(tests): update expected Copilot skill count from 47 to 50
Three new commands were added (add-backlog, review-backlog, thread)
but the Copilot install test counts were not updated.
2026-03-19 12:25:47 -04:00
Tom Boucher
efc398c554 Merge pull request #1223 from trek-e/fix/remote-session-menu-fallback-1214
fix(workflows): text_mode config for Claude Code remote session compatibility
2026-03-19 12:13:10 -04:00
Tom Boucher
0f9908ae77 Merge pull request #1222 from trek-e/fix/copilot-executor-completion-1128
fix(execute-phase): Copilot sequential fallback and spot-check completion detection
2026-03-19 12:12:54 -04:00
Tom Boucher
52f6c71bdf Merge pull request #1144 from ChaptersOfFloatingLife/fix/codex-agent-toml-metadata
fix(codex): include required agent metadata in TOML
2026-03-19 12:12:08 -04:00
Tom Boucher
1f2e17923a Merge pull request #1142 from medhatgalal/AI/fix-codex-markerless-gsd-merge
Fix duplicate Codex GSD agent blocks without marker
2026-03-19 12:11:48 -04:00
Tom Boucher
ea1797d362 Merge pull request #922 from j2h4u/fix/plan-checkboxes-progress
fix(roadmap): mark individual plan checkboxes when summaries exist
2026-03-19 12:09:03 -04:00
Tom Boucher
a44094018b Merge pull request #1177 from matteo-michele-bianchini/fix/windows-absolute-paths
fix: use ~/ instead of resolved absolute paths in global install
2026-03-19 12:08:34 -04:00
Tom Boucher
f9434f7ffc Merge pull request #1212 from jecanore/feat/audit-uat
feat: add verification debt tracking and /gsd:audit-uat command
2026-03-19 12:05:36 -04:00
Tom Boucher
86cbd5442b Merge pull request #1217 from j2h4u/fix/task-count-pattern
fix(milestone): read task count from **Tasks:** field in summary body
2026-03-19 12:04:37 -04:00
Tom Boucher
841da5a80d Merge pull request #1155 from gsd-build/Solvely/quick-task-branching
feat(quick): add quick-task branch support
2026-03-19 12:03:58 -04:00
Tom Boucher
37ae2bc936 Merge pull request #1154 from gsd-build/Solvely/soft-gsd-workflow-enforcement
feat(new-project): add soft GSD workflow enforcement
2026-03-19 12:03:31 -04:00
Tom Boucher
0342ce33c6 Merge pull request #1149 from Solvely-Colin/Solvely/health-non-destructive-state-repair
fix(health): preserve state on phase mismatch repair
2026-03-19 12:02:11 -04:00
Tom Boucher
b0523d6cbe Merge pull request #1148 from Solvely-Colin/Solvely/reset-milestone-phase-numbers
feat(milestones): support safe phase-number resets
2026-03-19 12:01:52 -04:00
Tom Boucher
0487151142 fix(workflows): add text_mode config for Claude Code remote session compatibility (#1214)
- Add workflow.text_mode config option (default: false) that replaces
  AskUserQuestion TUI menus with plain-text numbered lists
- Document --text flag and config-set workflow.text_mode true as the
  fix for /rc remote sessions where the Claude App cannot forward TUI
  menu selections
- Update discuss-phase.md with text mode parsing and answer_validation
  fallback documentation
- Add text_mode to loadConfig defaults and VALID_CONFIG_KEYS
- Add regression tests for config-set and loadConfig
2026-03-19 09:19:01 -04:00
Tom Boucher
8a6cdf5f25 fix(execute-phase): add Copilot sequential fallback and spot-check completion detection (#1128)
- Default Copilot runtime to sequential inline execution instead of
  unreliable subagent spawning
- Add spot-check fallback in step 3 (SUMMARY.md exists + git commits
  found) so orchestrator never blocks indefinitely on missing completion
  signals
- Add runtime detection guidance in init step to force sequential mode
  under Copilot
- Add regression test verifying execute-phase contains Copilot fallback
  and spot-check documentation
2026-03-19 09:15:06 -04:00
j2h4u
b34bf532ef fix(milestone): read task count from **Tasks:** field in summary body
The summary template writes task count as `**Tasks:** N` in the
Performance section, but `cmdMilestoneComplete` only counted
`## Task N` markdown headers — which don't exist in that format.

Now checks three patterns in order: `**Tasks:** N` field (primary),
`<task` XML tags, then `## Task N` headers (legacy fallback).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 14:37:21 +05:00
j2h4u
459f7f3b64 fix(roadmap): mark individual plan checkboxes when summaries exist
`cmdRoadmapUpdatePlanProgress` only marked phase-level checkboxes
(e.g. `- [ ] Phase 50: Build`) but skipped plan-level entries
(e.g. `- [ ] 50-01-PLAN.md`). Now iterates phase summaries and
marks matching plan checkboxes as complete.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-19 14:36:11 +05:00
jecanore
60a76ae06e feat: add verification debt tracking and /gsd:audit-uat command
Prevent silent loss of UAT/verification items when projects advance.
Surfaces outstanding items across all prior phases so nothing is forgotten.

New command:
- /gsd:audit-uat — cross-phase audit with categorized report and test plan

New capabilities:
- Cross-phase health check in /gsd:progress (Step 1.6)
- status: partial for incomplete UAT sessions
- result: blocked with blocked_by tag for dependency-gated tests
- human_needed items persisted as trackable HUMAN-UAT.md files
- Phase completion and transition warnings for verification debt

Files: 4 new, 14 modified (9 feature + 5 docs)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-19 00:05:05 -05:00
Tom Boucher
1192c0ae02 Merge pull request #1203 from trek-e/fix/stale-hooks-filter-1200
fix: filter stale hooks check to gsd-prefixed files only (#1200)
2026-03-18 23:56:33 -04:00
Tom Boucher
cd8c406a7c Merge pull request #1204 from trek-e/fix/codex-config-toml-1202
fix: prevent Codex config.toml corruption from non-boolean [features] keys (#1202)
2026-03-18 23:56:18 -04:00
Tom Boucher
b0c78fa9bc Merge pull request #1205 from trek-e/refactor/adopt-planning-paths
refactor: adopt planningPaths() across 4 modules, standardize test assertions
2026-03-18 23:56:05 -04:00
Tom Boucher
c41a9f5908 feat: community-requested commands — /gsd:review, /gsd:plant-seed, /gsd:pr-branch
Three commands reimplemented from positively-received community PRs:

1. /gsd:review (#925) — Cross-AI peer review
   Invoke external AI CLIs (Gemini, Claude, Codex) to independently
   review phase plans. Produces REVIEWS.md with per-reviewer feedback
   and consensus summary. Feed back into planning via --reviews flag.
   Multiple users praised the adversarial review concept.

2. /gsd:plant-seed (#456) — Forward-looking idea capture
   Capture ideas with trigger conditions that auto-surface during
   /gsd:new-milestone. Seeds preserve WHY, WHEN to surface, and
   breadcrumbs to related code. Better than deferred items because
   triggers are checked, not forgotten.

3. /gsd:pr-branch (#470) — Clean PR branches
   Create a branch for pull requests by filtering out .planning/
   commits. Classifies commits as code-only, planning-only, or mixed,
   then cherry-picks only code changes. Reviewers see clean diffs.

All three are standalone command+workflow additions with no core code
changes. Help workflow updated. Test skill counts updated.

797/797 tests pass.
2026-03-18 23:53:13 -04:00
Tom Boucher
1d4deb0f8b refactor: adopt planningPaths() across 4 modules — eliminate 34 inline path constructions
Consolidates repeated path.join(cwd, '.planning', ...) patterns into
calls to the shared planningPaths() helper from core.cjs.

Modules updated:
- state.cjs: 16 → planningPaths() (2 remain for non-standard paths)
- commands.cjs: 8 → planningPaths() (4 remain for todos dir)
- milestone.cjs: 5 → planningPaths() (3 remain for archive/milestones)
- roadmap.cjs: 4 → planningPaths()

Benefits:
- Single source of truth for .planning/ directory structure
- Easier to change planning dir location in the future
- Consistent path construction across the codebase
- No behavioral changes — pure refactor

797/797 tests pass.
2026-03-18 23:39:47 -04:00
Tom Boucher
862f6b91ba fix: prevent Codex config.toml corruption from non-boolean [features] keys (#1202)
When GSD installs codex_hooks = true under [features], any non-boolean
keys already in that section (e.g. model = "gpt-5.4") cause Codex's
TOML parser to fail with 'invalid type: string, expected a boolean'.

Root cause: TOML sections extend until the next [section] header. If
the user placed model/model_reasoning_effort under [features] (common
since Codex's own config format encourages this), GSD's installer
didn't detect or correct the structural issue.

Fix: After injecting codex_hooks, scan the [features] section for
non-boolean values and move them above [features] to the top level.
This preserves the user's keys while keeping [features] clean for
Codex's strict boolean parser.

Includes 2 regression tests:
- Detects non-boolean keys under [features] (model, model_reasoning_effort)
- Confirms boolean keys (codex_hooks, multi_agent) are not flagged

Closes #1202
2026-03-18 23:32:05 -04:00
Tom Boucher
9ca03ec35e fix: filter stale hooks check to gsd-prefixed files only (#1200)
gsd-check-update.js scanned ALL .js files in the hooks directory and
flagged any without a gsd-hook-version header as stale. This incorrectly
flagged user-created hooks (e.g. guard-edits-outside-project.js),
producing a persistent 'stale hooks' warning that /gsd:update couldn't
resolve.

Fix: filter hookFiles to f.startsWith('gsd-') && f.endsWith('.js')
since all GSD hooks follow the gsd-* naming convention.

Includes regression test validating the filter excludes user hooks.

Closes #1200
2026-03-18 23:29:38 -04:00
Tom Boucher
5fd384f336 fix: universal agent name replacement for non-Claude runtimes (#766) (#1195)
* fix: universal agent name replacement for non-Claude runtimes (#766)

Adds neutralizeAgentReferences() shared function that all non-Claude
runtime converters call to replace Claude-specific references:

- 'Claude' (standalone agent name) → 'the agent'
- 'CLAUDE.md' → runtime-specific file (AGENTS.md, GEMINI.md, COPILOT.md)
- Removes 'Do NOT load full AGENTS.md' (harmful for AGENTS.md runtimes)

Preserves: 'Claude Code' (product), 'Claude Opus/Sonnet/Haiku' (models),
'claude-' prefixes (packages, CSS classes).

Integrated into: OpenCode, Gemini, Copilot, Antigravity, and Codex
converters. Claude Code converter unchanged (references are correct).

Includes 7 new tests covering all replacement rules.

Closes #766

* fix: use copilot-instructions.md instead of COPILOT.md for Copilot runtime

Addresses review from Solvely-Colin: Copilot's actual instruction file
is copilot-instructions.md, not COPILOT.md. The neutralizer was mapping
CLAUDE.md -> COPILOT.md which would reference a non-existent file.

- install.js: pass 'copilot-instructions.md' to neutralizeAgentReferences
- runtime-converters.test.cjs: update test to validate correct filename
2026-03-18 19:20:58 -04:00
Tom Boucher
973c6b267d Merge pull request #1115 from trek-e/feat/discuss-phase-todo-crossref 2026-03-18 18:09:42 -04:00
Tom Boucher
d77956f6bd Merge pull request #1192 from trek-e/feat/gsd-fast-command-609 2026-03-18 18:08:00 -04:00
Tom Boucher
a8539a1779 Merge pull request #1164 from trek-e/fix/opencode-model-inherit-1156 2026-03-18 18:06:03 -04:00
Tom Boucher
a99caaeb59 feat: /gsd:fast command for trivial inline tasks (#609)
New lightweight command for tasks too small to justify planning overhead:
typo fixes, config changes, forgotten commits, simple additions.

- Runs inline in current context (no subagent spawn)
- No PLAN.md or SUMMARY.md generated
- Scope guard: redirects to /gsd:quick if task needs >3 file edits
- Atomic commit with conventional commit format
- Logs to STATE.md quick tasks table if present

Complements /gsd:quick (which spawns planner+executor) for cases where
the planning overhead exceeds the actual work.

Closes #609
2026-03-18 17:17:28 -04:00
mitchelladam
69cfae2011 fix(cursor): preserve slash-prefixed gsd commands in converted markdown
Keep `/gsd-*` command examples slash-prefixed during Cursor conversion while still normalizing legacy `gsd:` syntax, and add regression coverage for Next Up markdown output.

Made-with: Cursor
2026-03-18 18:49:28 +00:00
adam.mitchell
7172d16447 Merge branch 'main' into feat/cursor-cli-support 2026-03-18 18:34:04 +00:00
mitchelladam
026a1b013e fix(cursor): write unquoted skill and subagent names
Prevent Cursor from treating frontmatter quotes as part of skill/subagent identifiers by emitting plain name scalars, and add regression tests to lock the conversion behavior.

Made-with: Cursor
2026-03-18 18:29:47 +00:00
Tom Boucher
e84999663c feat(discuss-phase): cross-reference pending todos against phase scope
Add a cross_reference_todos step to discuss-phase that surfaces relevant
backlog items before scope-setting decisions are made.

Implementation:
- New 'todo match-phase <N>' CLI command (commands.cjs) that scores
  pending todos against a phase's ROADMAP goal using three heuristics:
  keyword overlap, area match, and file path overlap
- New cross_reference_todos step in discuss-phase.md between
  load_prior_context and scout_codebase
- CONTEXT.md template gains 'Folded Todos' subsection in <decisions>
  and 'Reviewed Todos (not folded)' subsection in <deferred>

Design:
- No AI call for matching — pure keyword/area/file heuristics for speed
- Silent skip when todo_count is 0 or no matches (no workflow slowdown)
- Auto mode folds all todos with score >= 0.4 automatically
- Scoring: keywords (up to 0.6), area match (0.3), file overlap (0.4)

Tests: 5 new tests covering empty state, keyword matching, unrelated
todo exclusion, area matching, and score sorting.

Closes #1111
2026-03-18 12:25:04 -04:00
Tom Boucher
0f112abf55 fix: remove model:inherit from OpenCode agent conversion (#1156)
OpenCode does not recognize 'model: inherit' as a valid model identifier —
it throws ProviderModelNotFoundError when spawning any GSD subagent.

Changes:
- Remove 'model: inherit' injection for OpenCode agents in install.js
- Strip 'model:' field entirely during OpenCode frontmatter conversion
  (OpenCode uses its configured default model when no model is specified)
- Update tests to verify model: inherit is NOT added

This fixes all 15 GSD agent definitions and the gsd-set-profile command
for OpenCode users.

Fixes #1156
2026-03-18 12:23:41 -04:00
Lex Christopherson
fc468adb42 fix(tests): update copilot skill count assertions for ship and next commands
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 10:16:26 -06:00
Tom Boucher
41f8cd48ed feat: add /gsd:next command for automatic workflow advancement (#927) (#1167)
Adds a zero-friction command that detects the current project state and
automatically invokes the next logical workflow step:

- No phases → discuss first phase
- Phase has no context → discuss
- Phase has context but no plans → plan
- Phase has plans but incomplete → execute
- All plans complete → verify and complete phase
- All phases complete → complete milestone
- Paused → resume work

No arguments needed — reads STATE.md, ROADMAP.md, and phase directories
to determine progression. Designed for multi-project workflows.

Closes #927
2026-03-18 09:56:35 -06:00
Tom Boucher
1efc74af51 refactor(tests): consolidate runtime converters, remove duplicate tests, standardize helpers (#1169)
Test consolidation:
- Merged gemini-config.test.cjs + opencode-agent-conversion.test.cjs
  into runtime-converters.test.cjs (single file for small runtime converters)
- Removed 11 duplicate tests from core.test.cjs:
  - 5 comparePhaseNum tests (authoritative copies in phase.test.cjs)
  - 6 normalizePhaseName tests (authoritative copies in phase.test.cjs)
- Added note in core.test.cjs pointing to phase.test.cjs as canonical location

Standardization:
- core.test.cjs now uses createTempProject()/cleanup() from helpers.cjs
  instead of inline fs.mkdtempSync/fs.rmSync patterns

File count: 21 → 19 test files
Test count: 755 → 744 (11 duplicates removed, 0 coverage lost)
2026-03-18 09:56:25 -06:00
Tom Boucher
93dc3d134f test: add coverage for model-profiles, template, profile-pipeline, profile-output (#1170)
New test files for 4 previously untested modules:

model-profiles.test.cjs (15 tests):
- MODEL_PROFILES data integrity (all agents, all profiles, valid aliases)
- VALID_PROFILES list validation
- getAgentToModelMapForProfile (balanced, budget, quality, agent count)
- formatAgentToModelMapAsTable (header, separator, column alignment)

template.test.cjs (11 tests):
- template select: minimal/standard/complex heuristics, fallback
- template fill: summary/plan/verification generation, --plan option
- Error paths: existing file, unknown type, missing phase

profile-pipeline.test.cjs (7 tests):
- scan-sessions: empty dir, synthetic project, multi-session
- extract-messages: user message extraction, meta/internal filtering
- profile-questionnaire: structure validation

profile-output.test.cjs (13 tests):
- PROFILING_QUESTIONS data (fields, options, uniqueness)
- CLAUDE_INSTRUCTIONS coverage (dimensions, instruction mapping)
- write-profile: analysis JSON → USER-PROFILE.md
- generate-claude-md: --auto generation, --force protection
- generate-dev-preferences: analysis → preferences command

Test count: 744 → 798 (+54 new tests, 0 failures)
2026-03-18 09:55:55 -06:00
Matteo Michele Bianchini
8c1b224474 fix: use ~/ instead of resolved absolute paths in global install
On Windows, install.js resolves $HOME to the absolute path
(e.g. C:/Users/matte/.claude/) in all workflow .md files.
This breaks when ~/.claude is mounted into a Docker container
where the path doesn't exist — Node interprets the Windows path
as relative to CWD, producing paths like:
/workspace/project/C:/Users/matte/.claude/get-shit-done/bin/gsd-tools.cjs

For global installs, replace os.homedir() with ~ in pathPrefix
so that paths like ~/.claude/get-shit-done/bin/gsd-tools.cjs
work correctly across all environments.

Local installs keep using resolved absolute paths since they
may be outside $HOME.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 09:57:33 +00:00