gsd-pi 2.38.0-dev.8f5c161 → 2.38.0-dev.98b44dc
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +15 -11
- package/dist/resource-loader.js +34 -1
- package/dist/resources/extensions/browser-tools/index.js +3 -1
- package/dist/resources/extensions/browser-tools/tools/verify.js +97 -0
- package/dist/resources/extensions/github-sync/cli.js +284 -0
- package/dist/resources/extensions/github-sync/index.js +73 -0
- package/dist/resources/extensions/github-sync/mapping.js +67 -0
- package/dist/resources/extensions/github-sync/sync.js +424 -0
- package/dist/resources/extensions/github-sync/templates.js +118 -0
- package/dist/resources/extensions/github-sync/types.js +7 -0
- package/dist/resources/extensions/gsd/auto-dispatch.js +1 -1
- package/dist/resources/extensions/gsd/auto-loop.js +538 -469
- package/dist/resources/extensions/gsd/auto-post-unit.js +28 -3
- package/dist/resources/extensions/gsd/auto-prompts.js +197 -19
- package/dist/resources/extensions/gsd/auto-worktree.js +3 -3
- package/dist/resources/extensions/gsd/commands.js +2 -1
- package/dist/resources/extensions/gsd/doctor-providers.js +3 -0
- package/dist/resources/extensions/gsd/doctor.js +20 -1
- package/dist/resources/extensions/gsd/exit-command.js +2 -1
- package/dist/resources/extensions/gsd/files.js +46 -7
- package/dist/resources/extensions/gsd/git-service.js +30 -12
- package/dist/resources/extensions/gsd/gitignore.js +16 -3
- package/dist/resources/extensions/gsd/guided-flow.js +149 -38
- package/dist/resources/extensions/gsd/health-widget-core.js +32 -70
- package/dist/resources/extensions/gsd/health-widget.js +3 -86
- package/dist/resources/extensions/gsd/index.js +22 -19
- package/dist/resources/extensions/gsd/migrate-external.js +18 -1
- package/dist/resources/extensions/gsd/native-git-bridge.js +37 -0
- package/dist/resources/extensions/gsd/paths.js +3 -0
- package/dist/resources/extensions/gsd/preferences-types.js +1 -0
- package/dist/resources/extensions/gsd/preferences-validation.js +58 -0
- package/dist/resources/extensions/gsd/preferences.js +20 -9
- package/dist/resources/extensions/gsd/prompt-loader.js +6 -2
- package/dist/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/execute-task.md +3 -1
- package/dist/resources/extensions/gsd/prompts/guided-complete-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-execute-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/dist/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/dist/resources/extensions/gsd/prompts/run-uat.md +3 -1
- package/dist/resources/extensions/gsd/roadmap-mutations.js +24 -0
- package/dist/resources/extensions/gsd/state.js +41 -22
- package/dist/resources/extensions/gsd/templates/runtime.md +21 -0
- package/dist/resources/extensions/gsd/templates/task-plan.md +3 -0
- package/dist/resources/extensions/mcp-client/index.js +14 -1
- package/dist/resources/extensions/remote-questions/status.js +4 -2
- package/dist/resources/extensions/remote-questions/store.js +4 -2
- package/dist/resources/extensions/shared/frontmatter.js +1 -1
- package/package.json +1 -1
- package/packages/pi-ai/dist/utils/oauth/anthropic.js +2 -2
- package/packages/pi-ai/dist/utils/oauth/anthropic.js.map +1 -1
- package/packages/pi-ai/src/utils/oauth/anthropic.ts +2 -2
- package/packages/pi-coding-agent/dist/core/extensions/loader.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/loader.js +205 -7
- package/packages/pi-coding-agent/dist/core/extensions/loader.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.d.ts +1 -0
- package/packages/pi-coding-agent/dist/core/skills.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/skills.js +6 -1
- package/packages/pi-coding-agent/dist/core/skills.js.map +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts +1 -1
- package/packages/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/index.js +1 -1
- package/packages/pi-coding-agent/dist/index.js.map +1 -1
- package/packages/pi-coding-agent/src/core/extensions/loader.ts +223 -7
- package/packages/pi-coding-agent/src/core/skills.ts +9 -1
- package/packages/pi-coding-agent/src/index.ts +1 -0
- package/src/resources/extensions/browser-tools/index.ts +3 -0
- package/src/resources/extensions/browser-tools/tools/verify.ts +117 -0
- package/src/resources/extensions/github-sync/cli.ts +364 -0
- package/src/resources/extensions/github-sync/index.ts +93 -0
- package/src/resources/extensions/github-sync/mapping.ts +81 -0
- package/src/resources/extensions/github-sync/sync.ts +556 -0
- package/src/resources/extensions/github-sync/templates.ts +183 -0
- package/src/resources/extensions/github-sync/tests/cli.test.ts +20 -0
- package/src/resources/extensions/github-sync/tests/commit-linking.test.ts +39 -0
- package/src/resources/extensions/github-sync/tests/mapping.test.ts +104 -0
- package/src/resources/extensions/github-sync/tests/templates.test.ts +110 -0
- package/src/resources/extensions/github-sync/types.ts +47 -0
- package/src/resources/extensions/gsd/auto-dispatch.ts +1 -1
- package/src/resources/extensions/gsd/auto-loop.ts +342 -304
- package/src/resources/extensions/gsd/auto-post-unit.ts +29 -3
- package/src/resources/extensions/gsd/auto-prompts.ts +242 -19
- package/src/resources/extensions/gsd/auto-worktree.ts +3 -3
- package/src/resources/extensions/gsd/commands.ts +2 -2
- package/src/resources/extensions/gsd/doctor-providers.ts +4 -0
- package/src/resources/extensions/gsd/doctor.ts +22 -1
- package/src/resources/extensions/gsd/exit-command.ts +2 -2
- package/src/resources/extensions/gsd/files.ts +49 -9
- package/src/resources/extensions/gsd/git-service.ts +44 -10
- package/src/resources/extensions/gsd/gitignore.ts +17 -3
- package/src/resources/extensions/gsd/guided-flow.ts +177 -44
- package/src/resources/extensions/gsd/health-widget-core.ts +28 -80
- package/src/resources/extensions/gsd/health-widget.ts +3 -89
- package/src/resources/extensions/gsd/index.ts +21 -16
- package/src/resources/extensions/gsd/migrate-external.ts +18 -1
- package/src/resources/extensions/gsd/native-git-bridge.ts +37 -0
- package/src/resources/extensions/gsd/paths.ts +4 -0
- package/src/resources/extensions/gsd/preferences-types.ts +4 -0
- package/src/resources/extensions/gsd/preferences-validation.ts +50 -0
- package/src/resources/extensions/gsd/preferences.ts +23 -9
- package/src/resources/extensions/gsd/prompt-loader.ts +7 -2
- package/src/resources/extensions/gsd/prompts/complete-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/execute-task.md +3 -1
- package/src/resources/extensions/gsd/prompts/guided-complete-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-execute-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/guided-resume-task.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/plan-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/reassess-roadmap.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-milestone.md +1 -1
- package/src/resources/extensions/gsd/prompts/research-slice.md +1 -1
- package/src/resources/extensions/gsd/prompts/run-uat.md +3 -1
- package/src/resources/extensions/gsd/roadmap-mutations.ts +29 -0
- package/src/resources/extensions/gsd/state.ts +38 -20
- package/src/resources/extensions/gsd/templates/runtime.md +21 -0
- package/src/resources/extensions/gsd/templates/task-plan.md +3 -0
- package/src/resources/extensions/gsd/tests/auto-loop.test.ts +106 -31
- package/src/resources/extensions/gsd/tests/auto-worktree-milestone-merge.test.ts +4 -3
- package/src/resources/extensions/gsd/tests/derive-state.test.ts +43 -0
- package/src/resources/extensions/gsd/tests/gitignore-tracked-gsd.test.ts +50 -0
- package/src/resources/extensions/gsd/tests/health-widget.test.ts +16 -54
- package/src/resources/extensions/gsd/tests/parsers.test.ts +131 -14
- package/src/resources/extensions/gsd/tests/plan-slice-prompt.test.ts +209 -0
- package/src/resources/extensions/gsd/tests/run-uat.test.ts +5 -1
- package/src/resources/extensions/gsd/tests/skill-activation.test.ts +140 -0
- package/src/resources/extensions/gsd/types.ts +18 -0
- package/src/resources/extensions/gsd/verification-evidence.ts +16 -0
- package/src/resources/extensions/mcp-client/index.ts +17 -1
- package/src/resources/extensions/remote-questions/status.ts +4 -2
- package/src/resources/extensions/remote-questions/store.ts +4 -2
- package/src/resources/extensions/shared/frontmatter.ts +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Complete slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Your working directory is `{{workingDirectory}}` — all file operations must use this path. All tasks are done. Your slice summary is the primary record of what was built — downstream agents (reassess-roadmap, future slice researchers) read it to understand what this slice delivered and what to watch out for. Use the **Slice Summary** and **UAT** output templates below.
|
|
1
|
+
Complete slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Your working directory is `{{workingDirectory}}` — all file operations must use this path. All tasks are done. Your slice summary is the primary record of what was built — downstream agents (reassess-roadmap, future slice researchers) read it to understand what this slice delivered and what to watch out for. Use the **Slice Summary** and **UAT** output templates below. {{skillActivation}} Write `{{sliceId}}-SUMMARY.md` (compress task summaries), write `{{sliceId}}-UAT.md`, and fill the `UAT Type` plus `Not Proven By This UAT` sections explicitly so the artifact states what class of acceptance it covers and what still remains unproven. Review task summaries for `key_decisions` and ensure any significant ones are in `.gsd/DECISIONS.md`. Mark the slice checkbox done in the roadmap, update milestone summary, Do not commit or merge manually — the system handles this after the unit completes.
|
|
2
2
|
|
|
3
3
|
{{inlinedTemplates}}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Execute the next task: {{taskId}} ("{{taskTitle}}") in slice {{sliceId}} of milestone {{milestoneId}}. Read the task plan (`{{taskId}}-PLAN.md`), load relevant summaries from prior tasks, and execute each step. Verify must-haves when done. If the task touches UI, browser flows, DOM behavior, or user-visible web state, exercise the real flow in the browser, prefer `browser_batch` for obvious sequences, prefer `browser_assert` for explicit pass/fail verification, use `browser_diff` when an action's effect is ambiguous, and use browser diagnostics when validating async or failure-prone UI. If you made an architectural, pattern, or library decision, append it to `.gsd/DECISIONS.md`. Use the **Task Summary** output template below. Write `{{taskId}}-SUMMARY.md`, mark it done, commit, and advance.
|
|
1
|
+
Execute the next task: {{taskId}} ("{{taskTitle}}") in slice {{sliceId}} of milestone {{milestoneId}}. Read the task plan (`{{taskId}}-PLAN.md`), load relevant summaries from prior tasks, and execute each step. Verify must-haves when done. If the task touches UI, browser flows, DOM behavior, or user-visible web state, exercise the real flow in the browser, prefer `browser_batch` for obvious sequences, prefer `browser_assert` for explicit pass/fail verification, use `browser_diff` when an action's effect is ambiguous, and use browser diagnostics when validating async or failure-prone UI. If you made an architectural, pattern, or library decision, append it to `.gsd/DECISIONS.md`. Use the **Task Summary** output template below. Write `{{taskId}}-SUMMARY.md`, mark it done, commit, and advance. {{skillActivation}} If running long and not all steps are finished, stop implementing and prioritize writing a clean partial summary over attempting one more step — a recoverable handoff is more valuable than a half-finished step with no documentation. If verification fails, debug methodically: form a hypothesis and test that specific theory before changing anything, change one variable at a time, read entire functions not just the suspect line, distinguish observable facts from assumptions, and if 3+ fixes fail without progress stop and reassess your mental model — list what you know for certain, what you've ruled out, and form fresh hypotheses. Don't fix symptoms — understand why something fails before changing code.
|
|
2
2
|
|
|
3
3
|
{{inlinedTemplates}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Plan milestone {{milestoneId}} ("{{milestoneTitle}}"). Read `.gsd/DECISIONS.md` if it exists — respect existing decisions. Read `.gsd/REQUIREMENTS.md` if it exists and treat Active requirements as the capability contract. If `REQUIREMENTS.md` is missing, continue in legacy compatibility mode but explicitly note missing requirement coverage. Use the **Roadmap** output template below. Create `{{milestoneId}}-ROADMAP.md` in the milestone directory with slices, risk levels, dependencies, demo sentences, verification classes, milestone definition of done, requirement coverage, and a boundary map. Write success criteria as observable truths, not implementation tasks. If the milestone crosses multiple runtime boundaries, include an explicit final integration slice that proves the assembled system works end-to-end in a real environment. If planning produces structural decisions, append them to `.gsd/DECISIONS.md`.
|
|
1
|
+
Plan milestone {{milestoneId}} ("{{milestoneTitle}}"). Read `.gsd/DECISIONS.md` if it exists — respect existing decisions. Read `.gsd/REQUIREMENTS.md` if it exists and treat Active requirements as the capability contract. If `REQUIREMENTS.md` is missing, continue in legacy compatibility mode but explicitly note missing requirement coverage. Use the **Roadmap** output template below. Create `{{milestoneId}}-ROADMAP.md` in the milestone directory with slices, risk levels, dependencies, demo sentences, verification classes, milestone definition of done, requirement coverage, and a boundary map. Write success criteria as observable truths, not implementation tasks. If the milestone crosses multiple runtime boundaries, include an explicit final integration slice that proves the assembled system works end-to-end in a real environment. If planning produces structural decisions, append them to `.gsd/DECISIONS.md`. {{skillActivation}}
|
|
2
2
|
|
|
3
3
|
## Requirement Rules
|
|
4
4
|
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
Plan slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements the roadmap says this slice owns or supports, and ensure the plan delivers them. Read the roadmap boundary map, any existing context/research files, and dependency summaries. Use the **Slice Plan** and **Task Plan** output templates below. Decompose into tasks with must-haves. Fill the `Proof Level` and `Integration Closure` sections truthfully so the plan says what class of proof this slice really delivers and what end-to-end wiring still remains. Write `{{sliceId}}-PLAN.md` and individual `T##-PLAN.md` files in the `tasks/` subdirectory. If planning produces structural decisions, append them to `.gsd/DECISIONS.md`.
|
|
1
|
+
Plan slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements the roadmap says this slice owns or supports, and ensure the plan delivers them. Read the roadmap boundary map, any existing context/research files, and dependency summaries. Use the **Slice Plan** and **Task Plan** output templates below. Decompose into tasks with must-haves. Fill the `Proof Level` and `Integration Closure` sections truthfully so the plan says what class of proof this slice really delivers and what end-to-end wiring still remains. Write `{{sliceId}}-PLAN.md` and individual `T##-PLAN.md` files in the `tasks/` subdirectory. If planning produces structural decisions, append them to `.gsd/DECISIONS.md`. {{skillActivation}} Before committing, self-audit the plan: every must-have maps to at least one task, every task has complete sections (steps, must-haves, verification, observability impact, inputs, and expected output), task ordering is consistent with no circular references, every pair of artifacts that must connect has an explicit wiring step, task scope targets 2–5 steps and 3–8 files (6–8 steps or 8–10 files — consider splitting; 10+ steps or 12+ files — must split), the plan honors locked decisions from context/research/decisions artifacts, the proof-level wording does not overclaim live integration if only fixture/contract proof is planned, every Active requirement this slice owns has at least one task with verification that proves it is met, and every task produces real user-facing progress — if the slice has a UI surface at least one task builds the real UI, if it has an API at least one task connects it to a real data source, and showing the completed result to a non-technical stakeholder would demonstrate real product progress rather than developer artifacts.
|
|
2
2
|
|
|
3
3
|
{{inlinedTemplates}}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Research slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions, don't contradict them. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements this slice owns or supports and target research toward risks, unknowns, and constraints that could affect delivery of those requirements.
|
|
1
|
+
Research slice {{sliceId}} ("{{sliceTitle}}") of milestone {{milestoneId}}. Read `.gsd/DECISIONS.md` if it exists — respect existing decisions, don't contradict them. Read `.gsd/REQUIREMENTS.md` if it exists — identify which Active requirements this slice owns or supports and target research toward risks, unknowns, and constraints that could affect delivery of those requirements. {{skillActivation}} Explore the relevant code — use `rg`/`find` for targeted reads, or `scout` if the area is broad or unfamiliar. Check libraries with `resolve_library`/`get_library_docs` — skip this for libraries already used in the codebase. Use the **Research** output template below. Write `{{sliceId}}-RESEARCH.md` in the slice directory.
|
|
2
2
|
|
|
3
3
|
**You are the scout.** A planner agent reads your output in a fresh context to decompose this slice into tasks. Write for the planner — surface key files, where the work divides naturally, what to build first, and how to verify. If the research doc is vague, the planner re-explores code you already read. If it's precise, the planner decomposes immediately.
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Resume interrupted work. Find the continue file (`{{sliceId}}-CONTINUE.md` or `continue.md`) in slice {{sliceId}} of milestone {{milestoneId}}, read it, and use it as the recovery contract for where to pick up. Do **not** delete the continue file immediately. Keep it until the task is successfully completed or you have written a newer summary/continue artifact that clearly supersedes it. If the resumed attempt fails again, update or replace the continue file so no recovery context is lost.
|
|
1
|
+
Resume interrupted work. Find the continue file (`{{sliceId}}-CONTINUE.md` or `continue.md`) in slice {{sliceId}} of milestone {{milestoneId}}, read it, and use it as the recovery contract for where to pick up. Do **not** delete the continue file immediately. Keep it until the task is successfully completed or you have written a newer summary/continue artifact that clearly supersedes it. If the resumed attempt fails again, update or replace the continue file so no recovery context is lost. {{skillActivation}}
|
|
@@ -44,7 +44,7 @@ Narrate your decomposition reasoning — why you're grouping work this way, what
|
|
|
44
44
|
|
|
45
45
|
Then:
|
|
46
46
|
1. Use the **Roadmap** output template from the inlined context above
|
|
47
|
-
2.
|
|
47
|
+
2. {{skillActivation}}
|
|
48
48
|
3. Create the roadmap: decompose into demoable vertical slices — as many as the work genuinely needs, no more. A simple feature might be 1 slice. Don't decompose for decomposition's sake.
|
|
49
49
|
4. Order by risk (high-risk first)
|
|
50
50
|
5. Write `{{outputPath}}` with checkboxes, risk, depends, demo sentences, proof strategy, verification classes, milestone definition of done, **requirement coverage**, and a boundary map. Write success criteria as observable truths, not implementation tasks. If the milestone crosses multiple runtime boundaries, include an explicit final integration slice that proves the assembled system works end-to-end in a real environment
|
|
@@ -47,7 +47,7 @@ Then:
|
|
|
47
47
|
1. Read the templates:
|
|
48
48
|
- `~/.gsd/agent/extensions/gsd/templates/plan.md`
|
|
49
49
|
- `~/.gsd/agent/extensions/gsd/templates/task-plan.md`
|
|
50
|
-
2.
|
|
50
|
+
2. {{skillActivation}} Record the installed skills you expect executors to use in each task plan's `skills_used` frontmatter.
|
|
51
51
|
3. Define slice-level verification — the objective stopping condition for this slice:
|
|
52
52
|
- For non-trivial slices: plan actual test files with real assertions. Name the files.
|
|
53
53
|
- For simple slices: executable commands or script assertions are fine.
|
|
@@ -22,7 +22,7 @@ The following user thoughts were captured during execution and deferred to futur
|
|
|
22
22
|
|
|
23
23
|
{{deferredCaptures}}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
{{skillActivation}}
|
|
26
26
|
|
|
27
27
|
Then assess whether the remaining roadmap still makes sense given what was just built.
|
|
28
28
|
|
|
@@ -21,7 +21,7 @@ Write for the roadmap planner. It needs to understand: what exists in the codeba
|
|
|
21
21
|
A milestone adding a small feature to an established codebase needs targeted research — check the relevant code, confirm the approach, note constraints. A milestone introducing new technology, building a new system, or spanning multiple unfamiliar subsystems needs deep research — explore broadly, look up docs, investigate alternatives. Match your effort to the actual uncertainty, not the template's section count. Include only sections that have real content.
|
|
22
22
|
|
|
23
23
|
Then research the codebase and relevant technologies. Narrate key findings and surprises as you go — what exists, what's missing, what constrains the approach.
|
|
24
|
-
1.
|
|
24
|
+
1. {{skillActivation}}
|
|
25
25
|
2. **Skill Discovery ({{skillDiscoveryMode}}):**{{skillDiscoveryInstructions}}
|
|
26
26
|
3. Explore relevant code. For small/familiar codebases, use `rg`, `find`, and targeted reads. For large or unfamiliar codebases, use `scout` to build a broad map efficiently before diving in.
|
|
27
27
|
4. Use `resolve_library` / `get_library_docs` for unfamiliar libraries — skip this for libraries already used in the codebase
|
|
@@ -42,7 +42,7 @@ An honest "this is straightforward, here's the pattern to follow" is more valuab
|
|
|
42
42
|
|
|
43
43
|
Research what this slice needs. Narrate key findings and surprises as you go — what exists, what's missing, what constrains the approach.
|
|
44
44
|
0. If `REQUIREMENTS.md` was preloaded above, identify which Active requirements this slice owns or supports. Research should target these requirements — surfacing risks, unknowns, and implementation constraints that could affect whether the slice actually delivers them.
|
|
45
|
-
1.
|
|
45
|
+
1. {{skillActivation}} Reference specific rules from loaded skills in your findings where they inform the implementation approach.
|
|
46
46
|
2. **Skill Discovery ({{skillDiscoveryMode}}):**{{skillDiscoveryInstructions}}
|
|
47
47
|
3. Explore relevant code for this slice's scope. For targeted exploration, use `rg`, `find`, and reads. For broad or unfamiliar subsystems, use `scout` to map the relevant area first.
|
|
48
48
|
4. Use `resolve_library` / `get_library_docs` for unfamiliar libraries — skip this for libraries already used in the codebase
|
|
@@ -10,7 +10,7 @@ All relevant context has been preloaded below. Start working immediately without
|
|
|
10
10
|
|
|
11
11
|
{{inlinedContext}}
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
{{skillActivation}}
|
|
14
14
|
|
|
15
15
|
---
|
|
16
16
|
|
|
@@ -25,6 +25,8 @@ You are the UAT runner. Execute every check defined in `{{uatPath}}` as deeply a
|
|
|
25
25
|
### Automation rules by mode
|
|
26
26
|
|
|
27
27
|
- `artifact-driven` — verify with shell commands, scripts, file reads, and artifact structure checks.
|
|
28
|
+
- `browser-executable` — use browser tools to navigate to the target URL and verify expected behavior. Capture screenshots as evidence. Record pass/fail with specific assertions.
|
|
29
|
+
- `runtime-executable` — execute the specified command or script. Capture stdout/stderr as evidence. Record pass/fail based on exit code and output.
|
|
28
30
|
- `live-runtime` — exercise the real runtime path. Start or connect to the app/service if needed, use browser/runtime/network checks, and verify observable behavior.
|
|
29
31
|
- `mixed` — run all automatable artifact-driven and live-runtime checks. Separate any remaining human-only checks explicitly.
|
|
30
32
|
- `human-experience` — automate setup, preconditions, screenshots, logs, and objective checks, but do **not** invent subjective PASS results. Mark taste-based, experiential, or purely human-judgment checks as `NEEDS-HUMAN` and use an overall verdict of `PARTIAL` unless every required check was objective and passed.
|
|
@@ -39,6 +39,35 @@ export function markSliceDoneInRoadmap(basePath: string, mid: string, sid: strin
|
|
|
39
39
|
return true;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Mark a slice as not done ([ ]) in the milestone roadmap.
|
|
44
|
+
* Idempotent — no-op if already unchecked or if the slice isn't found.
|
|
45
|
+
*
|
|
46
|
+
* @returns true if the roadmap was modified, false if no change was needed
|
|
47
|
+
*/
|
|
48
|
+
export function markSliceUndoneInRoadmap(basePath: string, mid: string, sid: string): boolean {
|
|
49
|
+
const roadmapFile = resolveMilestoneFile(basePath, mid, "ROADMAP");
|
|
50
|
+
if (!roadmapFile) return false;
|
|
51
|
+
|
|
52
|
+
let content: string;
|
|
53
|
+
try {
|
|
54
|
+
content = readFileSync(roadmapFile, "utf-8");
|
|
55
|
+
} catch {
|
|
56
|
+
return false;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const updated = content.replace(
|
|
60
|
+
new RegExp(`^(\\s*-\\s+)\\[x\\]\\s+\\*\\*${sid}:`, "m"),
|
|
61
|
+
`$1[ ] **${sid}:`,
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
if (updated === content) return false;
|
|
65
|
+
|
|
66
|
+
atomicWriteSync(roadmapFile, updated);
|
|
67
|
+
clearParseCache();
|
|
68
|
+
return true;
|
|
69
|
+
}
|
|
70
|
+
|
|
42
71
|
/**
|
|
43
72
|
* Mark a task as done ([x]) in the slice plan.
|
|
44
73
|
* Idempotent — no-op if already checked or if the task isn't found.
|
|
@@ -126,7 +126,12 @@ export async function getActiveMilestoneId(basePath: string): Promise<string | n
|
|
|
126
126
|
// A draft milestone is still "active" — this function only determines which milestone is current.
|
|
127
127
|
}
|
|
128
128
|
const roadmap = parseRoadmap(content);
|
|
129
|
-
if (!isMilestoneComplete(roadmap))
|
|
129
|
+
if (!isMilestoneComplete(roadmap)) {
|
|
130
|
+
// Summary is the terminal artifact — if it exists, the milestone is
|
|
131
|
+
// complete even when roadmap checkboxes weren't ticked (#864).
|
|
132
|
+
const summaryFile = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
133
|
+
if (!summaryFile) return mid;
|
|
134
|
+
}
|
|
130
135
|
}
|
|
131
136
|
return null;
|
|
132
137
|
}
|
|
@@ -258,7 +263,13 @@ async function _deriveStateImpl(basePath: string): Promise<GSDState> {
|
|
|
258
263
|
}
|
|
259
264
|
const rmap = parseRoadmap(rc);
|
|
260
265
|
roadmapCache.set(mid, rmap);
|
|
261
|
-
if (!isMilestoneComplete(rmap))
|
|
266
|
+
if (!isMilestoneComplete(rmap)) {
|
|
267
|
+
// Summary is the terminal artifact — if it exists, the milestone is
|
|
268
|
+
// complete even when roadmap checkboxes weren't ticked (#864).
|
|
269
|
+
const sf = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
270
|
+
if (sf) completeMilestoneIds.add(mid);
|
|
271
|
+
continue;
|
|
272
|
+
}
|
|
262
273
|
const sf = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
263
274
|
if (sf) completeMilestoneIds.add(mid);
|
|
264
275
|
}
|
|
@@ -357,26 +368,33 @@ async function _deriveStateImpl(basePath: string): Promise<GSDState> {
|
|
|
357
368
|
} else {
|
|
358
369
|
registry.push({ id: mid, title, status: 'complete' });
|
|
359
370
|
}
|
|
360
|
-
} else
|
|
361
|
-
//
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
if (
|
|
367
|
-
|
|
368
|
-
|
|
371
|
+
} else {
|
|
372
|
+
// Roadmap slices not all checked — but if a summary exists, the milestone
|
|
373
|
+
// is still complete. The summary is the terminal artifact (#864).
|
|
374
|
+
const summaryFile = resolveMilestoneFile(basePath, mid, "SUMMARY");
|
|
375
|
+
if (summaryFile) {
|
|
376
|
+
registry.push({ id: mid, title, status: 'complete' });
|
|
377
|
+
} else if (!activeMilestoneFound) {
|
|
378
|
+
// Check milestone-level dependencies before promoting to active
|
|
379
|
+
const contextFile = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
380
|
+
const contextContent = contextFile ? await cachedLoadFile(contextFile) : null;
|
|
381
|
+
const deps = parseContextDependsOn(contextContent);
|
|
382
|
+
const depsUnmet = deps.some(dep => !completeMilestoneIds.has(dep));
|
|
383
|
+
if (depsUnmet) {
|
|
384
|
+
registry.push({ id: mid, title, status: 'pending', dependsOn: deps });
|
|
385
|
+
// Do NOT set activeMilestoneFound — let the loop continue to the next milestone
|
|
386
|
+
} else {
|
|
387
|
+
activeMilestone = { id: mid, title };
|
|
388
|
+
activeRoadmap = roadmap;
|
|
389
|
+
activeMilestoneFound = true;
|
|
390
|
+
registry.push({ id: mid, title, status: 'active', ...(deps.length > 0 ? { dependsOn: deps } : {}) });
|
|
391
|
+
}
|
|
369
392
|
} else {
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
registry.push({ id: mid, title, status: '
|
|
393
|
+
const contextFile2 = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
394
|
+
const contextContent2 = contextFile2 ? await cachedLoadFile(contextFile2) : null;
|
|
395
|
+
const deps2 = parseContextDependsOn(contextContent2);
|
|
396
|
+
registry.push({ id: mid, title, status: 'pending', ...(deps2.length > 0 ? { dependsOn: deps2 } : {}) });
|
|
374
397
|
}
|
|
375
|
-
} else {
|
|
376
|
-
const contextFile2 = resolveMilestoneFile(basePath, mid, "CONTEXT");
|
|
377
|
-
const contextContent2 = contextFile2 ? await cachedLoadFile(contextFile2) : null;
|
|
378
|
-
const deps2 = parseContextDependsOn(contextContent2);
|
|
379
|
-
registry.push({ id: mid, title, status: 'pending', ...(deps2.length > 0 ? { dependsOn: deps2 } : {}) });
|
|
380
398
|
}
|
|
381
399
|
}
|
|
382
400
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# Runtime Context
|
|
2
|
+
|
|
3
|
+
## Stack
|
|
4
|
+
- **Language:** (e.g., TypeScript, Python, Go)
|
|
5
|
+
- **Framework:** (e.g., Next.js, FastAPI, Gin)
|
|
6
|
+
- **Build:** (e.g., npm run build, cargo build)
|
|
7
|
+
- **Test:** (e.g., npm run test, pytest)
|
|
8
|
+
- **Lint:** (e.g., npm run lint, ruff check)
|
|
9
|
+
|
|
10
|
+
## Environment
|
|
11
|
+
- **Node version:** (e.g., 20.x)
|
|
12
|
+
- **Package manager:** (e.g., npm, pnpm, yarn)
|
|
13
|
+
- **Required env vars:** (list any needed for local dev)
|
|
14
|
+
|
|
15
|
+
## Dev Server
|
|
16
|
+
- **Start command:** (e.g., npm run dev)
|
|
17
|
+
- **Default port:** (e.g., 3000)
|
|
18
|
+
- **Health check:** (e.g., curl http://localhost:3000/health)
|
|
19
|
+
|
|
20
|
+
## Notes
|
|
21
|
+
(Any runtime-specific context the executor needs to know)
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
# Tasks with 10+ estimated steps or 12+ estimated files trigger a warning to consider splitting.
|
|
4
4
|
estimated_steps: {{estimatedSteps}}
|
|
5
5
|
estimated_files: {{estimatedFiles}}
|
|
6
|
+
# Installed skills the planner expects the executor to load before coding.
|
|
7
|
+
skills_used:
|
|
8
|
+
- {{skillName}}
|
|
6
9
|
---
|
|
7
10
|
|
|
8
11
|
# {{taskId}}: {{taskTitle}}
|
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
resolveAgentEnd,
|
|
8
8
|
runUnit,
|
|
9
9
|
autoLoop,
|
|
10
|
+
detectStuck,
|
|
10
11
|
_resetPendingResolve,
|
|
11
12
|
_setActiveSession,
|
|
12
13
|
isSessionSwitchInFlight,
|
|
@@ -1042,7 +1043,7 @@ test("handleAgentEnd in auto.ts is a thin wrapper calling resolveAgentEnd", () =
|
|
|
1042
1043
|
|
|
1043
1044
|
// ── Stuck counter tests ──────────────────────────────────────────────────────
|
|
1044
1045
|
|
|
1045
|
-
test("stuck
|
|
1046
|
+
test("stuck detection: stops when sliding window detects same unit 3 consecutive times", async () => {
|
|
1046
1047
|
_resetPendingResolve();
|
|
1047
1048
|
|
|
1048
1049
|
const ctx = makeMockCtx();
|
|
@@ -1077,20 +1078,15 @@ test("stuck counter: stops when deriveState returns same unit 5 consecutive time
|
|
|
1077
1078
|
|
|
1078
1079
|
const loopPromise = autoLoop(ctx, pi, s, deps);
|
|
1079
1080
|
|
|
1080
|
-
//
|
|
1081
|
-
//
|
|
1082
|
-
//
|
|
1083
|
-
//
|
|
1084
|
-
//
|
|
1085
|
-
//
|
|
1081
|
+
// Sliding window: iteration 1 pushes [A], iteration 2 pushes [A,A],
|
|
1082
|
+
// iteration 3 pushes [A,A,A] → Rule 2 fires (3 consecutive) → Level 1 recovery.
|
|
1083
|
+
// Level 1 invalidates caches and continues. Iteration 4 pushes [A,A,A,A] →
|
|
1084
|
+
// Rule 2 fires again → Level 2 hard stop.
|
|
1085
|
+
// Iterations 1-3 each run a unit (3 resolves needed). Iteration 3 triggers
|
|
1086
|
+
// Level 1 (cache invalidation + continue). Iteration 4 triggers Level 2 (stop
|
|
1087
|
+
// before runUnit), so no 4th resolve needed.
|
|
1086
1088
|
|
|
1087
|
-
|
|
1088
|
-
// Iteration 2: derivedKey === lastDerivedUnit → sameUnitCount=1.
|
|
1089
|
-
// Iteration 3: sameUnitCount=2. Iteration 4: sameUnitCount=3.
|
|
1090
|
-
// Iteration 5: sameUnitCount=4. Iteration 6: sameUnitCount=5 → stop.
|
|
1091
|
-
// So we need to resolve 5 agent_end events (iterations 1-5 each run a unit).
|
|
1092
|
-
|
|
1093
|
-
for (let i = 0; i < 5; i++) {
|
|
1089
|
+
for (let i = 0; i < 3; i++) {
|
|
1094
1090
|
await new Promise((r) => setTimeout(r, 30));
|
|
1095
1091
|
resolveAgentEnd(makeEvent());
|
|
1096
1092
|
}
|
|
@@ -1105,17 +1101,13 @@ test("stuck counter: stops when deriveState returns same unit 5 consecutive time
|
|
|
1105
1101
|
stopReason.includes("Stuck"),
|
|
1106
1102
|
`stop reason should mention 'Stuck', got: ${stopReason}`,
|
|
1107
1103
|
);
|
|
1108
|
-
assert.ok(
|
|
1109
|
-
stopReason.includes("execute-task"),
|
|
1110
|
-
"stop reason should include unitType",
|
|
1111
|
-
);
|
|
1112
1104
|
assert.ok(
|
|
1113
1105
|
stopReason.includes("M001/S01/T01"),
|
|
1114
1106
|
"stop reason should include unitId",
|
|
1115
1107
|
);
|
|
1116
1108
|
});
|
|
1117
1109
|
|
|
1118
|
-
test("stuck
|
|
1110
|
+
test("stuck detection: window resets recovery when deriveState returns a different unit", async () => {
|
|
1119
1111
|
_resetPendingResolve();
|
|
1120
1112
|
|
|
1121
1113
|
const ctx = makeMockCtx();
|
|
@@ -1176,10 +1168,11 @@ test("stuck counter: resets when deriveState returns a different unit", async ()
|
|
|
1176
1168
|
|
|
1177
1169
|
await loopPromise;
|
|
1178
1170
|
|
|
1179
|
-
//
|
|
1171
|
+
// Level 1 recovery fires on iteration 3 (cache invalidation + continue),
|
|
1172
|
+
// then iteration 4 derives T02 — no Level 2 hard stop.
|
|
1180
1173
|
assert.ok(
|
|
1181
1174
|
!stopCalled,
|
|
1182
|
-
"stopAuto should NOT have been called —
|
|
1175
|
+
"stopAuto should NOT have been called — different unit broke stuck pattern",
|
|
1183
1176
|
);
|
|
1184
1177
|
assert.ok(
|
|
1185
1178
|
deriveCallCount >= 4,
|
|
@@ -1187,7 +1180,7 @@ test("stuck counter: resets when deriveState returns a different unit", async ()
|
|
|
1187
1180
|
);
|
|
1188
1181
|
});
|
|
1189
1182
|
|
|
1190
|
-
test("stuck
|
|
1183
|
+
test("stuck detection: does not push to window during verification retry", async () => {
|
|
1191
1184
|
_resetPendingResolve();
|
|
1192
1185
|
|
|
1193
1186
|
const ctx = makeMockCtx();
|
|
@@ -1249,10 +1242,10 @@ test("stuck counter: does not increment during verification retry", async () =>
|
|
|
1249
1242
|
await loopPromise;
|
|
1250
1243
|
|
|
1251
1244
|
// Even though same unit was derived 4 times, verification retries should
|
|
1252
|
-
// not
|
|
1245
|
+
// not push to the sliding window, so stuck detection should not have fired
|
|
1253
1246
|
assert.ok(
|
|
1254
1247
|
!stopReason.includes("Stuck"),
|
|
1255
|
-
`stuck
|
|
1248
|
+
`stuck detection should not fire during verification retries, got: ${stopReason}`,
|
|
1256
1249
|
);
|
|
1257
1250
|
assert.equal(
|
|
1258
1251
|
verifyCallCount,
|
|
@@ -1261,24 +1254,106 @@ test("stuck counter: does not increment during verification retry", async () =>
|
|
|
1261
1254
|
);
|
|
1262
1255
|
});
|
|
1263
1256
|
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1257
|
+
// ── detectStuck unit tests ────────────────────────────────────────────────────
|
|
1258
|
+
|
|
1259
|
+
test("detectStuck: returns null for fewer than 2 entries", () => {
|
|
1260
|
+
assert.equal(detectStuck([]), null);
|
|
1261
|
+
assert.equal(detectStuck([{ key: "A" }]), null);
|
|
1262
|
+
});
|
|
1263
|
+
|
|
1264
|
+
test("detectStuck: Rule 1 — same error twice in a row", () => {
|
|
1265
|
+
const result = detectStuck([
|
|
1266
|
+
{ key: "A", error: "ENOENT: file not found" },
|
|
1267
|
+
{ key: "A", error: "ENOENT: file not found" },
|
|
1268
|
+
]);
|
|
1269
|
+
assert.ok(result?.stuck, "should detect same error repeated");
|
|
1270
|
+
assert.ok(result?.reason.includes("Same error repeated"));
|
|
1271
|
+
});
|
|
1272
|
+
|
|
1273
|
+
test("detectStuck: Rule 1 — different errors do not trigger", () => {
|
|
1274
|
+
const result = detectStuck([
|
|
1275
|
+
{ key: "A", error: "ENOENT: file not found" },
|
|
1276
|
+
{ key: "A", error: "EACCES: permission denied" },
|
|
1277
|
+
]);
|
|
1278
|
+
assert.equal(result, null);
|
|
1279
|
+
});
|
|
1280
|
+
|
|
1281
|
+
test("detectStuck: Rule 2 — same unit 3 consecutive times", () => {
|
|
1282
|
+
const result = detectStuck([
|
|
1283
|
+
{ key: "execute-task/M001/S01/T01" },
|
|
1284
|
+
{ key: "execute-task/M001/S01/T01" },
|
|
1285
|
+
{ key: "execute-task/M001/S01/T01" },
|
|
1286
|
+
]);
|
|
1287
|
+
assert.ok(result?.stuck);
|
|
1288
|
+
assert.ok(result?.reason.includes("3 consecutive times"));
|
|
1289
|
+
});
|
|
1290
|
+
|
|
1291
|
+
test("detectStuck: Rule 2 — 2 consecutive does not trigger", () => {
|
|
1292
|
+
assert.equal(detectStuck([
|
|
1293
|
+
{ key: "A" },
|
|
1294
|
+
{ key: "A" },
|
|
1295
|
+
]), null);
|
|
1296
|
+
});
|
|
1297
|
+
|
|
1298
|
+
test("detectStuck: Rule 3 — oscillation A→B→A→B", () => {
|
|
1299
|
+
const result = detectStuck([
|
|
1300
|
+
{ key: "A" },
|
|
1301
|
+
{ key: "B" },
|
|
1302
|
+
{ key: "A" },
|
|
1303
|
+
{ key: "B" },
|
|
1304
|
+
]);
|
|
1305
|
+
assert.ok(result?.stuck);
|
|
1306
|
+
assert.ok(result?.reason.includes("Oscillation"));
|
|
1307
|
+
});
|
|
1308
|
+
|
|
1309
|
+
test("detectStuck: Rule 3 — non-oscillation pattern A→B→C→B", () => {
|
|
1310
|
+
assert.equal(detectStuck([
|
|
1311
|
+
{ key: "A" },
|
|
1312
|
+
{ key: "B" },
|
|
1313
|
+
{ key: "C" },
|
|
1314
|
+
{ key: "B" },
|
|
1315
|
+
]), null);
|
|
1316
|
+
});
|
|
1317
|
+
|
|
1318
|
+
test("detectStuck: Rule 1 takes priority over Rule 2 when both match", () => {
|
|
1319
|
+
const result = detectStuck([
|
|
1320
|
+
{ key: "A", error: "test error" },
|
|
1321
|
+
{ key: "A", error: "test error" },
|
|
1322
|
+
{ key: "A", error: "test error" },
|
|
1323
|
+
]);
|
|
1324
|
+
assert.ok(result?.stuck);
|
|
1325
|
+
// Rule 1 fires first
|
|
1326
|
+
assert.ok(result?.reason.includes("Same error repeated"));
|
|
1327
|
+
});
|
|
1328
|
+
|
|
1329
|
+
test("detectStuck: truncates long error strings", () => {
|
|
1330
|
+
const longError = "x".repeat(500);
|
|
1331
|
+
const result = detectStuck([
|
|
1332
|
+
{ key: "A", error: longError },
|
|
1333
|
+
{ key: "A", error: longError },
|
|
1334
|
+
]);
|
|
1335
|
+
assert.ok(result?.stuck);
|
|
1336
|
+
assert.ok(result!.reason.length < 300, "reason should be truncated");
|
|
1337
|
+
});
|
|
1338
|
+
|
|
1339
|
+
test("stuck detection: logs debug output with stuck-detected phase", () => {
|
|
1340
|
+
// Structural test: verify the auto-loop.ts source contains
|
|
1341
|
+
// stuck-detected and stuck-counter-reset debug log phases, plus detectStuck
|
|
1267
1342
|
const src = readFileSync(
|
|
1268
1343
|
resolve(import.meta.dirname, "..", "auto-loop.ts"),
|
|
1269
1344
|
"utf-8",
|
|
1270
1345
|
);
|
|
1271
1346
|
assert.ok(
|
|
1272
1347
|
src.includes('"stuck-detected"'),
|
|
1273
|
-
"auto-loop.ts must log phase: 'stuck-detected' when stuck
|
|
1348
|
+
"auto-loop.ts must log phase: 'stuck-detected' when stuck detection fires",
|
|
1274
1349
|
);
|
|
1275
1350
|
assert.ok(
|
|
1276
1351
|
src.includes('"stuck-counter-reset"'),
|
|
1277
|
-
"auto-loop.ts must log phase: 'stuck-counter-reset' when
|
|
1352
|
+
"auto-loop.ts must log phase: 'stuck-counter-reset' when recovery resets on new unit",
|
|
1278
1353
|
);
|
|
1279
1354
|
assert.ok(
|
|
1280
|
-
src.includes("
|
|
1281
|
-
"auto-loop.ts must
|
|
1355
|
+
src.includes("detectStuck"),
|
|
1356
|
+
"auto-loop.ts must use detectStuck for sliding window analysis",
|
|
1282
1357
|
);
|
|
1283
1358
|
});
|
|
1284
1359
|
|
|
@@ -242,9 +242,10 @@ async function main(): Promise<void> {
|
|
|
242
242
|
const remoteLog = run("git log --oneline main", bareDir);
|
|
243
243
|
assertTrue(remoteLog.includes("feat(M040)"), "milestone commit reachable on remote after manual push");
|
|
244
244
|
|
|
245
|
-
//
|
|
246
|
-
//
|
|
247
|
-
|
|
245
|
+
// Temp-repo prefs may or may not be discoverable depending on process cwd and
|
|
246
|
+
// current preference-loading behavior. The important contract is that remote
|
|
247
|
+
// push mechanics work and the returned value reflects what happened.
|
|
248
|
+
assertTrue(typeof result.pushed === "boolean", "pushed flag remains boolean");
|
|
248
249
|
}
|
|
249
250
|
|
|
250
251
|
// ─── Test 5: Auto-resolve .gsd/ state file conflicts (#530) ───────
|
|
@@ -779,6 +779,49 @@ slice: S01
|
|
|
779
779
|
}
|
|
780
780
|
}
|
|
781
781
|
|
|
782
|
+
// ─── Test: unchecked roadmap slices + summary → complete (summary is terminal) ────
|
|
783
|
+
console.log('\n=== unchecked roadmap slices + summary → complete (summary is terminal) ===');
|
|
784
|
+
{
|
|
785
|
+
const base = createFixtureBase();
|
|
786
|
+
try {
|
|
787
|
+
// M001: roadmap has unchecked slices but a summary exists — should be complete
|
|
788
|
+
writeRoadmap(base, 'M001', `# M001: First Milestone\n\n**Vision:** Already done.\n\n## Slices\n\n- [ ] **S01: Unchecked slice** \`risk:low\` \`depends:[]\`\n > Work was done but checkbox never ticked.\n- [ ] **S02: Another unchecked** \`risk:low\` \`depends:[]\`\n > Same.\n`);
|
|
789
|
+
writeMilestoneSummary(base, 'M001', '---\nid: M001\n---\n\n# M001: First Milestone\n\n**Completed despite unchecked roadmap.**');
|
|
790
|
+
// M002: genuinely incomplete — should be the active milestone
|
|
791
|
+
writeRoadmap(base, 'M002', `# M002: Active Milestone\n\n**Vision:** Do stuff.\n\n## Slices\n\n- [ ] **S01: Work slice** \`risk:low\` \`depends:[]\`\n > Needs work.\n`);
|
|
792
|
+
|
|
793
|
+
const state = await deriveState(base);
|
|
794
|
+
const m001Entry = state.registry.find(e => e.id === 'M001');
|
|
795
|
+
assertEq(m001Entry?.status, 'complete', 'M001 with unchecked roadmap + summary is complete');
|
|
796
|
+
assertEq(state.activeMilestone?.id, 'M002', 'active milestone is M002, not M001');
|
|
797
|
+
} finally {
|
|
798
|
+
cleanup(base);
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// ─── Test: unchecked roadmap + summary counts toward completeMilestoneIds (deps) ────
|
|
803
|
+
console.log('\n=== unchecked roadmap + summary satisfies dependency ===');
|
|
804
|
+
{
|
|
805
|
+
const base = createFixtureBase();
|
|
806
|
+
try {
|
|
807
|
+
// M001: unchecked roadmap + summary → complete
|
|
808
|
+
writeRoadmap(base, 'M001', `# M001: Foundation\n\n**Vision:** Done.\n\n## Slices\n\n- [ ] **S01: Setup** \`risk:low\` \`depends:[]\`\n > Done.\n`);
|
|
809
|
+
writeMilestoneSummary(base, 'M001', '---\nid: M001\n---\n\n# M001: Foundation\n\n**Done.**');
|
|
810
|
+
// M002: depends on M001 — should be active since M001 is complete
|
|
811
|
+
writeRoadmap(base, 'M002', `# M002: Dependent\n\n**Vision:** Depends on M001.\n\n## Slices\n\n- [ ] **S01: Work** \`risk:low\` \`depends:[]\`\n > Work.\n`);
|
|
812
|
+
const contextDir = join(base, '.gsd', 'milestones', 'M002');
|
|
813
|
+
mkdirSync(contextDir, { recursive: true });
|
|
814
|
+
writeFileSync(join(contextDir, 'M002-CONTEXT.md'), '---\ndepends_on:\n - M001\n---\n\n# M002 Context\n\nDepends on M001.');
|
|
815
|
+
|
|
816
|
+
const state = await deriveState(base);
|
|
817
|
+
assertEq(state.activeMilestone?.id, 'M002', 'M002 is active — M001 dependency satisfied via summary');
|
|
818
|
+
const m002Entry = state.registry.find(e => e.id === 'M002');
|
|
819
|
+
assertEq(m002Entry?.status, 'active', 'M002 status is active, not pending');
|
|
820
|
+
} finally {
|
|
821
|
+
cleanup(base);
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
782
825
|
report();
|
|
783
826
|
}
|
|
784
827
|
|
|
@@ -183,6 +183,28 @@ test("ensureGitignore with tracked .gsd/ does not cause git to see files as dele
|
|
|
183
183
|
}
|
|
184
184
|
});
|
|
185
185
|
|
|
186
|
+
test("hasGitTrackedGsdFiles returns true (fail-safe) when git is not available", () => {
|
|
187
|
+
const dir = makeTempRepo();
|
|
188
|
+
try {
|
|
189
|
+
// Create and track .gsd/ files
|
|
190
|
+
mkdirSync(join(dir, ".gsd"), { recursive: true });
|
|
191
|
+
writeFileSync(join(dir, ".gsd", "PROJECT.md"), "# Project\n");
|
|
192
|
+
git(dir, "add", ".gsd/");
|
|
193
|
+
git(dir, "commit", "-m", "track gsd");
|
|
194
|
+
|
|
195
|
+
// Corrupt the git index to simulate git failure
|
|
196
|
+
const indexPath = join(dir, ".git", "index.lock");
|
|
197
|
+
writeFileSync(indexPath, "locked");
|
|
198
|
+
|
|
199
|
+
// Should fail safe — assume tracked rather than silently returning false
|
|
200
|
+
// (The index lock causes git ls-files to fail; rev-parse also fails → true)
|
|
201
|
+
const result = hasGitTrackedGsdFiles(dir);
|
|
202
|
+
assert.equal(result, true, "Should return true (fail-safe) when git is unavailable");
|
|
203
|
+
} finally {
|
|
204
|
+
cleanup(dir);
|
|
205
|
+
}
|
|
206
|
+
});
|
|
207
|
+
|
|
186
208
|
// ─── migrateToExternalState — tracked .gsd/ protection ──────────────
|
|
187
209
|
|
|
188
210
|
test("migrateToExternalState aborts when .gsd/ has tracked files (#1364)", () => {
|
|
@@ -212,3 +234,31 @@ test("migrateToExternalState aborts when .gsd/ has tracked files (#1364)", () =>
|
|
|
212
234
|
cleanup(dir);
|
|
213
235
|
}
|
|
214
236
|
});
|
|
237
|
+
|
|
238
|
+
test("migrateToExternalState cleans git index so tracked files don't show as deleted (#1364 path 2)", () => {
|
|
239
|
+
const dir = makeTempRepo();
|
|
240
|
+
try {
|
|
241
|
+
// Track .gsd/ files, then untrack them so migration proceeds
|
|
242
|
+
mkdirSync(join(dir, ".gsd", "milestones", "M001"), { recursive: true });
|
|
243
|
+
writeFileSync(join(dir, ".gsd", "PROJECT.md"), "# Project\n");
|
|
244
|
+
writeFileSync(join(dir, ".gsd", "milestones", "M001", "PLAN.md"), "# Plan\n");
|
|
245
|
+
git(dir, "add", ".gsd/");
|
|
246
|
+
git(dir, "commit", "-m", "track gsd state");
|
|
247
|
+
git(dir, "rm", "-r", "--cached", ".gsd/");
|
|
248
|
+
git(dir, "commit", "-m", "untrack gsd (simulates pre-migration project)");
|
|
249
|
+
|
|
250
|
+
const result = migrateToExternalState(dir);
|
|
251
|
+
assert.equal(result.migrated, true, "Migration should succeed");
|
|
252
|
+
|
|
253
|
+
// git status must show NO deleted files after migration
|
|
254
|
+
const status = git(dir, "status", "--porcelain");
|
|
255
|
+
const deletions = status.split("\n").filter((l) => /^\s*D\s/.test(l) || /^D\s/.test(l));
|
|
256
|
+
assert.equal(
|
|
257
|
+
deletions.length,
|
|
258
|
+
0,
|
|
259
|
+
`Expected no deleted files after migration, but found:\n${deletions.join("\n")}`,
|
|
260
|
+
);
|
|
261
|
+
} finally {
|
|
262
|
+
cleanup(dir);
|
|
263
|
+
}
|
|
264
|
+
});
|