feat(M001/S04): Remove git commands from prompts

This commit is contained in:
Lex Christopherson 2026-03-12 12:19:57 -06:00
parent b2e7dbdc25
commit d9d773e44e
8 changed files with 124 additions and 7 deletions

View file

@ -61,7 +61,7 @@ This milestone is complete only when all are true:
- [x] **S03: Bug fixes and doc corrections** `risk:medium` `depends:[S02]`
> After this: Worktree create commits before fork. Worktree merge uses deterministic helper by default. README and GSD-WORKFLOW match actual branch deletion and snapshot behavior. Build passes.
- [ ] **S04: Remove git commands from prompts** `risk:low` `depends:[S02]`
- [x] **S04: Remove git commands from prompts** `risk:low` `depends:[S02]`
> After this: execute-task.md, complete-slice.md, replan-slice.md, complete-milestone.md contain no raw git commands. worktree-merge.md unchanged. Verified by grep.
- [ ] **S05: Enhanced features — merge guards, snapshots, auto-push, rich commits** `risk:medium` `depends:[S02]`

View file

@ -0,0 +1,59 @@
# S04: Remove git commands from prompts
**Goal:** No raw git commands in LLM-facing prompts (except worktree-merge.md for conflict resolution).
**Demo:** `grep -rn 'git add\|git commit\|git update-index\|git hash-object' src/resources/extensions/gsd/prompts/ --include="*.md" | grep -v worktree-merge.md` returns zero results.
## Must-Haves
- execute-task.md step 16 replaced — no `git add`, `git commit`, `git update-index`, or `git hash-object`
- complete-slice.md step 10 replaced — no `git add` or `git commit`; preserves "do not squash-merge manually" context
- replan-slice.md step 6 replaced — no `git add` or `git commit`
- complete-milestone.md step 9 replaced — no `git add` or `git commit`
- worktree-merge.md untouched
- Step numbering remains sequential in all modified files
- `npm run build` passes
- `npm run test` passes
## Proof Level
- This slice proves: contract
- Real runtime required: no
- Human/UAT required: no
## Verification
- `grep -rn 'git add\|git commit\|git update-index\|git hash-object' src/resources/extensions/gsd/prompts/ --include="*.md" | grep -v worktree-merge.md` returns zero lines
- `npm run build` passes
- `npm run test` passes
- worktree-merge.md unchanged (diff shows no modifications)
## Observability / Diagnostics
Not applicable — this slice modifies static prompt templates with no runtime behavior.
- Runtime signals: none
- Inspection surfaces: grep across prompt files
- Failure visibility: none
- Redaction constraints: none
## Integration Closure
- Upstream surfaces consumed: GitService auto-commit mechanism wired in S02 (auto.ts lines 498504) — makes manual commit instructions in prompts redundant
- New wiring introduced in this slice: none
- What remains before the milestone is truly usable end-to-end: S05 (merge guards, snapshots, auto-push, rich commits), S06 (cleanup and archive)
## Tasks
- [x] **T01: Replace raw git commands in all four prompt files** `est:15m`
- Why: R011 — LLMs should not run git commands; the GitService auto-commit (wired in S02) makes these instructions redundant and harmful
- Files: `src/resources/extensions/gsd/prompts/execute-task.md`, `src/resources/extensions/gsd/prompts/complete-slice.md`, `src/resources/extensions/gsd/prompts/replan-slice.md`, `src/resources/extensions/gsd/prompts/complete-milestone.md`
- Do: Replace the git command text in each step with a declarative "system auto-commits" message. Keep step numbers intact. Preserve the "do not squash-merge manually" context in complete-slice.md. Do NOT touch worktree-merge.md.
- Verify: grep returns zero hits; build passes; test passes; worktree-merge.md has no diff
- Done when: all four verification commands pass
## Files Likely Touched
- `src/resources/extensions/gsd/prompts/execute-task.md`
- `src/resources/extensions/gsd/prompts/complete-slice.md`
- `src/resources/extensions/gsd/prompts/replan-slice.md`
- `src/resources/extensions/gsd/prompts/complete-milestone.md`

View file

@ -0,0 +1,60 @@
---
id: T01
parent: S04
milestone: M001
provides:
- Raw git commands removed from all four LLM-facing prompt files
key_files:
- src/resources/extensions/gsd/prompts/execute-task.md
- src/resources/extensions/gsd/prompts/complete-slice.md
- src/resources/extensions/gsd/prompts/replan-slice.md
- src/resources/extensions/gsd/prompts/complete-milestone.md
- src/resources/extensions/gsd/tests/replan-slice.test.ts
key_decisions:
- Removed unused {{blockerTaskId}} template variable from replan-slice.md (was only used in the git commit message); kept the variable in auto.ts since it's still used in inlined context headings
patterns_established:
- Prompt steps that previously contained git commands now use declarative "system auto-commits" messages
observability_surfaces:
- none
duration: 8 minutes
verification_result: passed
completed_at: 2026-03-12
blocker_discovered: false
---
# T01: Replace raw git commands in all four prompt files
**Replaced git add/commit/update-index/hash-object instructions in execute-task.md, complete-slice.md, replan-slice.md, and complete-milestone.md with declarative auto-commit messages.**
## What Happened
Replaced the raw git command text in step 16 (execute-task.md), step 10 (complete-slice.md), step 6 (replan-slice.md), and step 9 (complete-milestone.md) with short declarative messages telling the LLM not to commit manually. The execute-task.md replacement also removed the `git update-index`/`git hash-object` workaround text. The complete-slice.md replacement preserves the squash-merge context.
Discovered that the replan-slice test asserted `{{blockerTaskId}}` rendered in the prompt — that variable was only present in the removed git commit message line. Removed the stale `blockerTaskId` assertion and the corresponding template var from that test case.
## Verification
- `grep -rn 'git add\|git commit\|git update-index\|git hash-object' src/resources/extensions/gsd/prompts/ --include="*.md" | grep -v worktree-merge.md` → zero results ✓
- `git diff src/resources/extensions/gsd/prompts/worktree-merge.md` → no changes ✓
- `npm run build` → passes ✓
- `npm run test` → 114 pass / 4 fail (same 4 pre-existing failures as before changes; replan-slice test now passes) ✓
## Diagnostics
None — this task modifies static prompt templates with no runtime behavior.
## Deviations
Updated `src/resources/extensions/gsd/tests/replan-slice.test.ts` to remove the `blockerTaskId` assertion and template var from the prompt-variable-substitution test. This was not in the original plan but was necessary because removing `{{blockerTaskId}}` from the template broke the test.
## Known Issues
None.
## Files Created/Modified
- `src/resources/extensions/gsd/prompts/execute-task.md` — Step 16 replaced with auto-commit message
- `src/resources/extensions/gsd/prompts/complete-slice.md` — Step 10 replaced with auto-commit + merge message
- `src/resources/extensions/gsd/prompts/replan-slice.md` — Step 6 replaced with auto-commit message
- `src/resources/extensions/gsd/prompts/complete-milestone.md` — Step 9 replaced with auto-commit message
- `src/resources/extensions/gsd/tests/replan-slice.test.ts` — Removed stale blockerTaskId assertion

View file

@ -15,7 +15,7 @@ Then:
6. Write `{{milestoneSummaryAbsPath}}` using the milestone-summary template. Fill all frontmatter fields and narrative sections. The `requirement_outcomes` field must list every requirement that changed status with `from_status`, `to_status`, and `proof`.
7. Update `.gsd/REQUIREMENTS.md` if any requirement status transitions were validated in step 5.
8. Update `.gsd/PROJECT.md` to reflect milestone completion and current project state.
9. Commit all changes: `git add -A && git commit -m 'feat(gsd): complete {{milestoneId}}'`
9. Do not commit manually — the system auto-commits your changes after this unit completes.
10. Update `.gsd/STATE.md`
**Important:** Do NOT skip the success criteria and definition of done verification (steps 3-4). The milestone summary must reflect actual verified outcomes, not assumed success. If any criterion was not met, document it clearly in the summary and do not mark the milestone as passing verification.

View file

@ -18,7 +18,7 @@ Then:
7. Write `{{sliceUatAbsPath}}`. Fill the new `UAT Type`, `Requirements Proved By This UAT`, and `Not Proven By This UAT` sections explicitly.
8. Review task summaries for `key_decisions`. Ensure any significant architectural, pattern, or observability decisions are in `.gsd/DECISIONS.md`. If any are missing, append them now.
9. Mark {{sliceId}} done in `{{roadmapPath}}` (change `[ ]` to `[x]`)
10. Commit all remaining slice changes: `git add -A && git commit -m 'feat(gsd): complete {{sliceId}}'`. Do not squash-merge manually; the extension will merge the slice branch back to main after this unit succeeds.
10. Do not commit or squash-merge manually — the system auto-commits your changes and handles the merge after this unit succeeds.
11. Update `.gsd/PROJECT.md` if it exists — refresh current state if needed.
12. Update `.gsd/STATE.md`

View file

@ -55,7 +55,7 @@ Then:
13. Read the template at `~/.gsd/agent/extensions/gsd/templates/task-summary.md`
14. Write `{{taskSummaryAbsPath}}`
15. Mark {{taskId}} done in `{{planPath}}` (change `[ ]` to `[x]`)
16. Commit your work: `git add -A && git commit -m 'feat({{sliceId}}/{{taskId}}): <what was built>'`. If `git add` silently fails to stage files (a known git worktree stat-cache bug), use this workaround per file: `git update-index --cacheinfo 100644,$(git hash-object -w <file>),<file>` then commit. If that also fails, move on — the system will auto-commit remaining changes after your session ends.
16. Do not commit manually — the system auto-commits your changes after this unit completes.
17. Update `.gsd/STATE.md`
You are on the slice branch. All work stays here.

View file

@ -31,7 +31,7 @@ All relevant context has been preloaded below — the roadmap, current slice pla
- Ensure the slice Goal and Demo sections are still achievable with the new tasks, or update them if the blocker fundamentally changes what the slice can deliver
- Update the Files Likely Touched section if the replan changes which files are affected
5. If any incomplete task had a `T0x-PLAN.md`, remove or rewrite it to match the new task description.
6. Commit all changes: `git add -A && git commit -m 'refactor({{sliceId}}): replan after blocker in {{blockerTaskId}}'`
6. Do not commit manually — the system auto-commits your changes after this unit completes.
7. Update `.gsd/STATE.md`
**You MUST write `{{replanAbsPath}}` and the updated slice plan before finishing.**

View file

@ -385,7 +385,6 @@ console.log('\n=== prompt: replan-slice template loads and substitutes variables
sliceTitle: 'Test Slice',
slicePath: '.gsd/milestones/M001/slices/S01',
planPath: '.gsd/milestones/M001/slices/S01/S01-PLAN.md',
blockerTaskId: 'T02',
inlinedContext: '## Inlined Context\n\nTest context here.',
});
@ -393,7 +392,6 @@ console.log('\n=== prompt: replan-slice template loads and substitutes variables
assert(prompt.includes('S01'), 'prompt contains sliceId');
assert(prompt.includes('Test Slice'), 'prompt contains sliceTitle');
assert(prompt.includes('.gsd/milestones/M001/slices/S01/S01-PLAN.md'), 'prompt contains planPath');
assert(prompt.includes('T02'), 'prompt contains blockerTaskId');
assert(prompt.includes('Test context here'), 'prompt contains inlined context');
}