@ktpartners/dgs-platform 2.6.2
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/LICENSE +38 -0
- package/README.md +851 -0
- package/agents/dgs-codebase-cross-analyzer.md +183 -0
- package/agents/dgs-codebase-mapper.md +782 -0
- package/agents/dgs-codebase-synthesizer.md +156 -0
- package/agents/dgs-debugger.md +1256 -0
- package/agents/dgs-executor.md +550 -0
- package/agents/dgs-integration-checker.md +481 -0
- package/agents/dgs-nyquist-auditor.md +178 -0
- package/agents/dgs-phase-researcher.md +563 -0
- package/agents/dgs-phase-verifier.md +450 -0
- package/agents/dgs-plan-checker.md +708 -0
- package/agents/dgs-planner.md +1324 -0
- package/agents/dgs-project-researcher.md +631 -0
- package/agents/dgs-research-synthesizer.md +249 -0
- package/agents/dgs-roadmapper.md +652 -0
- package/agents/dgs-verifier.md +607 -0
- package/bin/install.js +2073 -0
- package/commands/dgs/add-doc.md +45 -0
- package/commands/dgs/add-idea.md +38 -0
- package/commands/dgs/add-phase.md +43 -0
- package/commands/dgs/add-repo.md +54 -0
- package/commands/dgs/add-tests.md +41 -0
- package/commands/dgs/add-todo.md +47 -0
- package/commands/dgs/approve-spec.md +38 -0
- package/commands/dgs/audit-milestone.md +36 -0
- package/commands/dgs/audit-phase.md +37 -0
- package/commands/dgs/cancel-job.md +23 -0
- package/commands/dgs/capture-principle.md +143 -0
- package/commands/dgs/check-todos.md +45 -0
- package/commands/dgs/cleanup.md +18 -0
- package/commands/dgs/complete-milestone.md +136 -0
- package/commands/dgs/complete-project.md +70 -0
- package/commands/dgs/consolidate-ideas.md +50 -0
- package/commands/dgs/create-milestone-job.md +37 -0
- package/commands/dgs/debug.md +164 -0
- package/commands/dgs/develop-idea.md +53 -0
- package/commands/dgs/discuss-idea.md +41 -0
- package/commands/dgs/discuss-phase.md +83 -0
- package/commands/dgs/execute-phase.md +41 -0
- package/commands/dgs/fast.md +38 -0
- package/commands/dgs/find-related-ideas.md +43 -0
- package/commands/dgs/health.md +28 -0
- package/commands/dgs/help.md +22 -0
- package/commands/dgs/import-spec.md +36 -0
- package/commands/dgs/init-product.md +28 -0
- package/commands/dgs/insert-phase.md +32 -0
- package/commands/dgs/join-discord.md +18 -0
- package/commands/dgs/list-docs.md +40 -0
- package/commands/dgs/list-ideas.md +42 -0
- package/commands/dgs/list-jobs.md +22 -0
- package/commands/dgs/list-phase-assumptions.md +46 -0
- package/commands/dgs/list-projects.md +57 -0
- package/commands/dgs/list-specs.md +40 -0
- package/commands/dgs/map-codebase.md +92 -0
- package/commands/dgs/new-milestone.md +44 -0
- package/commands/dgs/new-project.md +42 -0
- package/commands/dgs/node-repair.md +26 -0
- package/commands/dgs/overlap-check.md +20 -0
- package/commands/dgs/pause-work.md +38 -0
- package/commands/dgs/plan-milestone-gaps.md +34 -0
- package/commands/dgs/plan-phase.md +44 -0
- package/commands/dgs/progress.md +24 -0
- package/commands/dgs/quick.md +41 -0
- package/commands/dgs/reactivate-project.md +70 -0
- package/commands/dgs/reapply-patches.md +110 -0
- package/commands/dgs/refine-spec.md +38 -0
- package/commands/dgs/reject-idea.md +43 -0
- package/commands/dgs/remove-doc.md +44 -0
- package/commands/dgs/remove-phase.md +31 -0
- package/commands/dgs/remove-repo.md +69 -0
- package/commands/dgs/research-idea.md +43 -0
- package/commands/dgs/research-phase.md +189 -0
- package/commands/dgs/restore-idea.md +45 -0
- package/commands/dgs/resume-work.md +40 -0
- package/commands/dgs/rollback-job.md +24 -0
- package/commands/dgs/run-job.md +35 -0
- package/commands/dgs/search.md +40 -0
- package/commands/dgs/set-profile.md +34 -0
- package/commands/dgs/settings.md +38 -0
- package/commands/dgs/switch-project.md +58 -0
- package/commands/dgs/undo-consolidation.md +42 -0
- package/commands/dgs/update-idea.md +44 -0
- package/commands/dgs/update.md +37 -0
- package/commands/dgs/validate-phase.md +35 -0
- package/commands/dgs/verify-work.md +39 -0
- package/commands/dgs/write-spec.md +49 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-01-SUMMARY.md +84 -0
- package/deliver-great-systems/.planning/phases/09-backend-wiring-and-error-handling/09-02-SUMMARY.md +86 -0
- package/deliver-great-systems/.planning/phases/10-v1-to-v2-migration-flow/10-01-SUMMARY.md +85 -0
- package/deliver-great-systems/bin/dgs-tools.cjs +1444 -0
- package/deliver-great-systems/bin/lib/auto-test.cjs +1365 -0
- package/deliver-great-systems/bin/lib/commands.cjs +570 -0
- package/deliver-great-systems/bin/lib/config.cjs +417 -0
- package/deliver-great-systems/bin/lib/conflict-agent.cjs +1063 -0
- package/deliver-great-systems/bin/lib/conflict-agent.test.cjs +554 -0
- package/deliver-great-systems/bin/lib/context.cjs +929 -0
- package/deliver-great-systems/bin/lib/context.test.cjs +693 -0
- package/deliver-great-systems/bin/lib/core.cjs +744 -0
- package/deliver-great-systems/bin/lib/core.test.cjs +822 -0
- package/deliver-great-systems/bin/lib/docs.cjs +919 -0
- package/deliver-great-systems/bin/lib/docs.test.cjs +211 -0
- package/deliver-great-systems/bin/lib/execution.cjs +705 -0
- package/deliver-great-systems/bin/lib/execution.test.cjs +1472 -0
- package/deliver-great-systems/bin/lib/frontmatter.cjs +324 -0
- package/deliver-great-systems/bin/lib/ideas.cjs +1406 -0
- package/deliver-great-systems/bin/lib/ideas.test.cjs +1417 -0
- package/deliver-great-systems/bin/lib/identity.cjs +125 -0
- package/deliver-great-systems/bin/lib/init.cjs +1114 -0
- package/deliver-great-systems/bin/lib/init.test.cjs +1271 -0
- package/deliver-great-systems/bin/lib/jobs.cjs +2015 -0
- package/deliver-great-systems/bin/lib/jobs.test.cjs +2619 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.cjs +654 -0
- package/deliver-great-systems/bin/lib/merge-conflicts.test.cjs +370 -0
- package/deliver-great-systems/bin/lib/migration.cjs +352 -0
- package/deliver-great-systems/bin/lib/migration.test.cjs +582 -0
- package/deliver-great-systems/bin/lib/milestone.cjs +243 -0
- package/deliver-great-systems/bin/lib/overlap.cjs +437 -0
- package/deliver-great-systems/bin/lib/overlap.test.cjs +747 -0
- package/deliver-great-systems/bin/lib/path-audit.test.cjs +384 -0
- package/deliver-great-systems/bin/lib/paths.cjs +144 -0
- package/deliver-great-systems/bin/lib/paths.test.cjs +486 -0
- package/deliver-great-systems/bin/lib/phase.cjs +910 -0
- package/deliver-great-systems/bin/lib/projects.cjs +691 -0
- package/deliver-great-systems/bin/lib/projects.test.cjs +871 -0
- package/deliver-great-systems/bin/lib/repos.cjs +1432 -0
- package/deliver-great-systems/bin/lib/repos.test.cjs +1882 -0
- package/deliver-great-systems/bin/lib/roadmap.cjs +305 -0
- package/deliver-great-systems/bin/lib/search.cjs +570 -0
- package/deliver-great-systems/bin/lib/specs.cjs +1303 -0
- package/deliver-great-systems/bin/lib/state.cjs +893 -0
- package/deliver-great-systems/bin/lib/template.cjs +228 -0
- package/deliver-great-systems/bin/lib/test-helpers.cjs +291 -0
- package/deliver-great-systems/bin/lib/verify.cjs +796 -0
- package/deliver-great-systems/references/checkpoints.md +776 -0
- package/deliver-great-systems/references/conflict-resolution.md +66 -0
- package/deliver-great-systems/references/context-tiers.md +166 -0
- package/deliver-great-systems/references/continuation-format.md +249 -0
- package/deliver-great-systems/references/decimal-phase-calculation.md +67 -0
- package/deliver-great-systems/references/git-integration.md +250 -0
- package/deliver-great-systems/references/git-planning-commit.md +40 -0
- package/deliver-great-systems/references/model-profile-resolution.md +36 -0
- package/deliver-great-systems/references/model-profiles.md +95 -0
- package/deliver-great-systems/references/phase-argument-parsing.md +61 -0
- package/deliver-great-systems/references/planning-config.md +224 -0
- package/deliver-great-systems/references/questioning.md +162 -0
- package/deliver-great-systems/references/spec-review-loop.md +177 -0
- package/deliver-great-systems/references/tdd.md +265 -0
- package/deliver-great-systems/references/ui-brand.md +160 -0
- package/deliver-great-systems/references/verification-patterns.md +612 -0
- package/deliver-great-systems/templates/DEBUG.md +166 -0
- package/deliver-great-systems/templates/UAT.md +251 -0
- package/deliver-great-systems/templates/VALIDATION.md +95 -0
- package/deliver-great-systems/templates/claude-md.md +74 -0
- package/deliver-great-systems/templates/codebase/architecture.md +257 -0
- package/deliver-great-systems/templates/codebase/concerns.md +312 -0
- package/deliver-great-systems/templates/codebase/conventions.md +309 -0
- package/deliver-great-systems/templates/codebase/integrations.md +282 -0
- package/deliver-great-systems/templates/codebase/stack.md +188 -0
- package/deliver-great-systems/templates/codebase/structure.md +287 -0
- package/deliver-great-systems/templates/codebase/testing.md +482 -0
- package/deliver-great-systems/templates/config.json +38 -0
- package/deliver-great-systems/templates/context.md +354 -0
- package/deliver-great-systems/templates/continue-here.md +80 -0
- package/deliver-great-systems/templates/debug-subagent-prompt.md +93 -0
- package/deliver-great-systems/templates/discovery.md +148 -0
- package/deliver-great-systems/templates/milestone-archive.md +125 -0
- package/deliver-great-systems/templates/milestone.md +117 -0
- package/deliver-great-systems/templates/phase-prompt.md +615 -0
- package/deliver-great-systems/templates/planner-subagent-prompt.md +119 -0
- package/deliver-great-systems/templates/project.md +186 -0
- package/deliver-great-systems/templates/requirements.md +233 -0
- package/deliver-great-systems/templates/research-project/ARCHITECTURE.md +206 -0
- package/deliver-great-systems/templates/research-project/FEATURES.md +149 -0
- package/deliver-great-systems/templates/research-project/PITFALLS.md +202 -0
- package/deliver-great-systems/templates/research-project/STACK.md +122 -0
- package/deliver-great-systems/templates/research-project/SUMMARY.md +172 -0
- package/deliver-great-systems/templates/research.md +554 -0
- package/deliver-great-systems/templates/retrospective.md +54 -0
- package/deliver-great-systems/templates/roadmap.md +204 -0
- package/deliver-great-systems/templates/state.md +178 -0
- package/deliver-great-systems/templates/summary-complex.md +59 -0
- package/deliver-great-systems/templates/summary-minimal.md +41 -0
- package/deliver-great-systems/templates/summary-standard.md +48 -0
- package/deliver-great-systems/templates/summary.md +253 -0
- package/deliver-great-systems/templates/user-setup.md +313 -0
- package/deliver-great-systems/templates/verification-report.md +324 -0
- package/deliver-great-systems/workflows/add-doc.md +151 -0
- package/deliver-great-systems/workflows/add-idea.md +96 -0
- package/deliver-great-systems/workflows/add-phase.md +120 -0
- package/deliver-great-systems/workflows/add-tests.md +359 -0
- package/deliver-great-systems/workflows/add-todo.md +162 -0
- package/deliver-great-systems/workflows/approve-spec.md +194 -0
- package/deliver-great-systems/workflows/audit-milestone.md +364 -0
- package/deliver-great-systems/workflows/audit-phase.md +462 -0
- package/deliver-great-systems/workflows/cancel-job.md +108 -0
- package/deliver-great-systems/workflows/check-todos.md +181 -0
- package/deliver-great-systems/workflows/cleanup.md +247 -0
- package/deliver-great-systems/workflows/codereview.md +526 -0
- package/deliver-great-systems/workflows/complete-milestone.md +1298 -0
- package/deliver-great-systems/workflows/consolidate-ideas.md +365 -0
- package/deliver-great-systems/workflows/create-milestone-job.md +177 -0
- package/deliver-great-systems/workflows/develop-idea.md +544 -0
- package/deliver-great-systems/workflows/diagnose-issues.md +231 -0
- package/deliver-great-systems/workflows/discovery-phase.md +301 -0
- package/deliver-great-systems/workflows/discuss-idea.md +263 -0
- package/deliver-great-systems/workflows/discuss-phase.md +733 -0
- package/deliver-great-systems/workflows/execute-phase.md +571 -0
- package/deliver-great-systems/workflows/execute-plan.md +592 -0
- package/deliver-great-systems/workflows/find-related-ideas.md +271 -0
- package/deliver-great-systems/workflows/health.md +173 -0
- package/deliver-great-systems/workflows/help.md +997 -0
- package/deliver-great-systems/workflows/import-spec.md +381 -0
- package/deliver-great-systems/workflows/init-product.md +767 -0
- package/deliver-great-systems/workflows/insert-phase.md +138 -0
- package/deliver-great-systems/workflows/list-docs.md +119 -0
- package/deliver-great-systems/workflows/list-ideas.md +154 -0
- package/deliver-great-systems/workflows/list-jobs.md +89 -0
- package/deliver-great-systems/workflows/list-phase-assumptions.md +192 -0
- package/deliver-great-systems/workflows/list-specs.md +101 -0
- package/deliver-great-systems/workflows/map-codebase.md +621 -0
- package/deliver-great-systems/workflows/new-milestone.md +591 -0
- package/deliver-great-systems/workflows/new-project.md +1113 -0
- package/deliver-great-systems/workflows/node-repair.md +94 -0
- package/deliver-great-systems/workflows/overlap-check.md +86 -0
- package/deliver-great-systems/workflows/pause-work.md +134 -0
- package/deliver-great-systems/workflows/plan-milestone-gaps.md +306 -0
- package/deliver-great-systems/workflows/plan-phase.md +698 -0
- package/deliver-great-systems/workflows/progress.md +386 -0
- package/deliver-great-systems/workflows/quick.md +845 -0
- package/deliver-great-systems/workflows/refine-spec.md +275 -0
- package/deliver-great-systems/workflows/reject-idea.md +109 -0
- package/deliver-great-systems/workflows/remove-doc.md +117 -0
- package/deliver-great-systems/workflows/remove-phase.md +163 -0
- package/deliver-great-systems/workflows/research-idea.md +325 -0
- package/deliver-great-systems/workflows/research-phase.md +81 -0
- package/deliver-great-systems/workflows/restore-idea.md +101 -0
- package/deliver-great-systems/workflows/resume-project.md +311 -0
- package/deliver-great-systems/workflows/rollback-job.md +130 -0
- package/deliver-great-systems/workflows/run-job.md +498 -0
- package/deliver-great-systems/workflows/search.md +130 -0
- package/deliver-great-systems/workflows/set-profile.md +83 -0
- package/deliver-great-systems/workflows/settings.md +470 -0
- package/deliver-great-systems/workflows/transition.md +563 -0
- package/deliver-great-systems/workflows/undo-consolidation.md +155 -0
- package/deliver-great-systems/workflows/update-idea.md +157 -0
- package/deliver-great-systems/workflows/update.md +242 -0
- package/deliver-great-systems/workflows/validate-phase.md +177 -0
- package/deliver-great-systems/workflows/verify-phase.md +253 -0
- package/deliver-great-systems/workflows/verify-work.md +671 -0
- package/deliver-great-systems/workflows/write-spec.md +450 -0
- package/hooks/dist/dgs-check-update.js +62 -0
- package/hooks/dist/dgs-context-monitor.js +141 -0
- package/hooks/dist/dgs-statusline.js +115 -0
- package/package.json +60 -0
- package/scripts/build-hooks.js +43 -0
|
@@ -0,0 +1,498 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Execute a milestone build job end-to-end. Reads the job file, loops through pending steps, spawns an isolated subagent per step, updates the job file in real-time, handles failures with immediate halt, manages dynamic gap-fix cycles at both milestone level (GapFixCycle, max 3) and phase level (PhaseFixCycle, max 2), and moves completed jobs to the completed/ directory. Supports --dry-run mode for step preview without execution. Auto-generates job summaries on completion and failure.
|
|
3
|
+
|
|
4
|
+
The orchestrator stays lean: it reads only the job file and MILESTONE-AUDIT.md (plus phase UAT status via CLI for phase-level audits). All actual work is delegated to subagents via Task tool. Each subagent gets a fresh context window with no shared state beyond what is on disk.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<context_tier>execution</context_tier>
|
|
8
|
+
|
|
9
|
+
<required_reading>
|
|
10
|
+
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
11
|
+
</required_reading>
|
|
12
|
+
|
|
13
|
+
<process>
|
|
14
|
+
|
|
15
|
+
<step name="initialize" priority="first">
|
|
16
|
+
Load planning context:
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
INIT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs init milestone-op)
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Extract: `project_root`, `jobs_root` as needed by the workflow.
|
|
23
|
+
|
|
24
|
+
**Load execution tier context:**
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier execution --raw 2>/dev/null)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Note: No `--phase` flag here at init time since the job orchestrator spans multiple phases. Each step's sub-agent loads its own phase-scoped context via its command shim.
|
|
31
|
+
</step>
|
|
32
|
+
|
|
33
|
+
<step name="parse_arguments">
|
|
34
|
+
Parse `$ARGUMENTS` to extract the version and flags.
|
|
35
|
+
|
|
36
|
+
- **VERSION:** First positional argument (e.g., `v6`, `v6.0`). Required.
|
|
37
|
+
- **DRY_RUN:** Check if `--dry-run` flag is present in $ARGUMENTS. Store as boolean.
|
|
38
|
+
|
|
39
|
+
If no version is provided, error immediately:
|
|
40
|
+
```
|
|
41
|
+
Error: Version argument required. Usage: /dgs:run-job <version> [--dry-run]
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
If `DRY_RUN` is true, proceed to `dry_run_preview` step instead of normal execution flow.
|
|
45
|
+
</step>
|
|
46
|
+
|
|
47
|
+
<step name="dry_run_preview">
|
|
48
|
+
**Execute only if `DRY_RUN` is true.** If `DRY_RUN` is false, skip this step entirely.
|
|
49
|
+
|
|
50
|
+
Run the dry-run preview CLI command:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
RESULT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs dry-run "$VERSION")
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Parse the JSON result.
|
|
57
|
+
|
|
58
|
+
**If `found: false`:**
|
|
59
|
+
```
|
|
60
|
+
Error: No job found for version {VERSION}.
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
**Display formatted step list:**
|
|
64
|
+
|
|
65
|
+
Header:
|
|
66
|
+
```
|
|
67
|
+
=== Dry Run: milestone-{version} ({status}) ===
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
For each step, display based on status:
|
|
71
|
+
- Completed: `[x] {command} {args}`
|
|
72
|
+
- Pending: `[ ] {command} {args}`
|
|
73
|
+
- Failed: `[!] {command} {args}`
|
|
74
|
+
- In-progress: `[>] {command} {args}`
|
|
75
|
+
|
|
76
|
+
Show resume point:
|
|
77
|
+
```
|
|
78
|
+
Resume from step {resume_from + 1}: {command} {args}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Show step name + command/skill each step would invoke.
|
|
82
|
+
|
|
83
|
+
Show warnings if any precondition issues found (e.g., missing planning root, ROADMAP.md, STATE.md).
|
|
84
|
+
|
|
85
|
+
**HALT -- do not proceed to execution.**
|
|
86
|
+
```
|
|
87
|
+
Dry run complete. Run without --dry-run to execute.
|
|
88
|
+
```
|
|
89
|
+
</step>
|
|
90
|
+
|
|
91
|
+
<step name="locate_job">
|
|
92
|
+
Find the job file for the given version:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
RESULT=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs find-job "$VERSION")
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Parse the JSON result.
|
|
99
|
+
|
|
100
|
+
**If `found: false`:**
|
|
101
|
+
```
|
|
102
|
+
Error: No job found for version {VERSION}. Create one with /dgs:create-milestone-job {VERSION}
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
**If found in `completed/` directory:**
|
|
106
|
+
```
|
|
107
|
+
Error: Job {VERSION} is already completed.
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
Store `JOB_PATH` from the result for all subsequent operations.
|
|
111
|
+
</step>
|
|
112
|
+
|
|
113
|
+
<step name="move_to_in_progress">
|
|
114
|
+
Transition the job to in-progress state if needed.
|
|
115
|
+
|
|
116
|
+
**If job is in `pending/`:**
|
|
117
|
+
|
|
118
|
+
1. Move the file to `in-progress/`:
|
|
119
|
+
```bash
|
|
120
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs move "$JOB_PATH" "${jobs_root}/in-progress"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
2. Update `JOB_PATH` to reflect the new location under `in-progress/`.
|
|
124
|
+
|
|
125
|
+
3. Update the header Status field (using the updated `$JOB_PATH`):
|
|
126
|
+
```bash
|
|
127
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-header "$JOB_PATH" Status in-progress
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**If already in `in-progress/`:** Skip the move. The job is being resumed.
|
|
131
|
+
|
|
132
|
+
**Record starting commit SHAs:**
|
|
133
|
+
|
|
134
|
+
After the job moves to in-progress (or is confirmed already there), record starting SHAs if not already present:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# Check if StartShas already recorded (skip on resume)
|
|
138
|
+
if ! grep -q '^\*\*StartShas:\*\*' "$JOB_PATH"; then
|
|
139
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs record-start-shas "$JOB_PATH"
|
|
140
|
+
fi
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
This captures the current HEAD of every registered code repo and the planning repo before any execution begins. The SHAs are written into the job file header as `**StartShas:**` and used by `/dgs:rollback-job` to reset repos if the job produces unwanted results.
|
|
144
|
+
</step>
|
|
145
|
+
|
|
146
|
+
<step name="parse_job_state">
|
|
147
|
+
Parse the current job state:
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
JOB=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs parse "$JOB_PATH")
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Extract from JSON:
|
|
154
|
+
- `stepCount` -- total number of steps
|
|
155
|
+
- `completedCount` -- how many steps are already completed
|
|
156
|
+
- `failedCount` -- how many steps have failed status
|
|
157
|
+
- `nextStepIndex` -- zero-based index of next step to execute (null if all done)
|
|
158
|
+
- `steps` -- array of step objects with command, args, status, timestamp, error
|
|
159
|
+
- `check` -- whether audit/complete steps are included
|
|
160
|
+
- `version` -- the milestone version
|
|
161
|
+
- `gapFixCycle` -- current gap-fix cycle number (0 if no gap-fix has occurred)
|
|
162
|
+
- `phaseFixCycle` -- current phase-level fix cycle number (0 if no phase fix has occurred)
|
|
163
|
+
- `phaseFixCyclePhase` -- which phase the PhaseFixCycle counter applies to (null if none)
|
|
164
|
+
|
|
165
|
+
Initialize `GAP_FIX_CYCLE` to the `gapFixCycle` value from the parsed result (not 0). This enables mid-cycle resume -- if the orchestrator restarts mid gap-fix, it knows which cycle it was on.
|
|
166
|
+
|
|
167
|
+
Initialize `PHASE_GAP_FIX_CYCLE` to the `phaseFixCycle` value from the parsed result.
|
|
168
|
+
Initialize `PHASE_FIX_CYCLE_PHASE` to the `phaseFixCyclePhase` value from the parsed result.
|
|
169
|
+
|
|
170
|
+
**If `nextStepIndex` is null** (all steps already done): Go directly to `complete_job`.
|
|
171
|
+
|
|
172
|
+
**If a step has `status: failed`:** Reset it to pending before resuming:
|
|
173
|
+
```bash
|
|
174
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-step "$JOB_PATH" $FAILED_INDEX pending
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**If `completedCount > 0`** (this is a resume): Display skip summary:
|
|
178
|
+
```
|
|
179
|
+
Skipping {completedCount} completed steps, resuming from step {nextStepIndex + 1}: {step.command} {step.args}
|
|
180
|
+
```
|
|
181
|
+
</step>
|
|
182
|
+
|
|
183
|
+
<step name="execute_steps">
|
|
184
|
+
Initialize tracking variables:
|
|
185
|
+
- `START_TIME` = current timestamp (for elapsed time calculation)
|
|
186
|
+
- `AUTO_RESOLVE_COUNT` = 0 (tracks auto-resolved prompts across all steps)
|
|
187
|
+
- `GAP_FIX_CYCLE` is loaded from the job file header in `parse_job_state` (not initialized here)
|
|
188
|
+
- `PHASE_GAP_FIX_CYCLE` is loaded from the job file header in `parse_job_state` (not initialized here)
|
|
189
|
+
- `PHASE_FIX_CYCLE_PHASE` tracks which phase the counter applies to
|
|
190
|
+
|
|
191
|
+
Loop through steps starting from `nextStepIndex`.
|
|
192
|
+
|
|
193
|
+
**Phase counter reset:** Before executing any step, check if the step's command is `plan-phase` or `map-codebase`. If so, reset `PHASE_GAP_FIX_CYCLE = 0` and `PHASE_FIX_CYCLE_PHASE = null` (a new phase is starting, so the previous phase's fix counter no longer applies).
|
|
194
|
+
|
|
195
|
+
**For each step:**
|
|
196
|
+
|
|
197
|
+
1. **Display start banner:**
|
|
198
|
+
```
|
|
199
|
+
Step {index+1}/{stepCount} [{elapsed}] > {command} {args_without_auto_flag}
|
|
200
|
+
```
|
|
201
|
+
Where `{elapsed}` is formatted as `Xm Ys` since job start. Strip `--auto` flags from display but preserve them in the actual subagent invocation.
|
|
202
|
+
|
|
203
|
+
2. **Mark step in-progress** with timestamp:
|
|
204
|
+
```bash
|
|
205
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-step "$JOB_PATH" $INDEX in-progress --timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
3. **Spawn subagent** via Task tool:
|
|
209
|
+
```
|
|
210
|
+
Task(
|
|
211
|
+
prompt="Execute /dgs:{command} {args}.
|
|
212
|
+
<job-mode>silent</job-mode>
|
|
213
|
+
Read the command file at ~/.claude/commands/dgs/{command}.md
|
|
214
|
+
and follow its workflow end-to-end.
|
|
215
|
+
You are running inside a job -- do NOT prompt the user for input.
|
|
216
|
+
Auto-resolve all interactive prompts per silent mode rules.
|
|
217
|
+
Report your result as a single line: SUCCESS or FAILED: <reason>"
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
The `{command}` and `{args}` come directly from the step's parsed data.
|
|
221
|
+
|
|
222
|
+
4. **On success:** Mark step completed with timestamp:
|
|
223
|
+
```bash
|
|
224
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-step "$JOB_PATH" $INDEX completed --timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)"
|
|
225
|
+
```
|
|
226
|
+
Display one-line result:
|
|
227
|
+
```
|
|
228
|
+
OK {command} {args_display} ({duration})
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
5. **On failure:** Mark step failed with timestamp and error:
|
|
232
|
+
```bash
|
|
233
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-step "$JOB_PATH" $INDEX failed --timestamp "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --error "{error_summary}"
|
|
234
|
+
```
|
|
235
|
+
Update header Status to `failed`:
|
|
236
|
+
```bash
|
|
237
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-header "$JOB_PATH" Status failed
|
|
238
|
+
```
|
|
239
|
+
Display error summary and restart hint:
|
|
240
|
+
```
|
|
241
|
+
FAILED {command} {args_display} ({duration})
|
|
242
|
+
Error: {error_summary}
|
|
243
|
+
|
|
244
|
+
Fix the issue, then run /dgs:run-job {version} to resume from step {index+1}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
**Generate job summary on failure:**
|
|
248
|
+
```bash
|
|
249
|
+
SUMMARY=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs generate-summary "$VERSION")
|
|
250
|
+
```
|
|
251
|
+
Parse the result. If `found: true`, write the `content` field to `${jobs_root}/in-progress/job-{version}-SUMMARY.md` using the Write tool (job stays in in-progress/ on failure).
|
|
252
|
+
Display: `Job summary written to ${jobs_root}/in-progress/job-{version}-SUMMARY.md`
|
|
253
|
+
|
|
254
|
+
**HALT immediately.** Do not proceed to the next step.
|
|
255
|
+
|
|
256
|
+
6. **After an audit-milestone step completes successfully:** Execute the `handle_audit_result` logic (see below).
|
|
257
|
+
|
|
258
|
+
6b. **After an audit-phase step completes successfully:** Execute the `handle_phase_audit_result` logic (see below). Detection is based on the step's `command` field: if `command === 'audit-milestone'` use `handle_audit_result`, if `command === 'audit-phase'` use `handle_phase_audit_result`.
|
|
259
|
+
|
|
260
|
+
7. **Re-parse the job file** after each step to get updated state (stepCount may change after gap-fix insertion):
|
|
261
|
+
```bash
|
|
262
|
+
JOB=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs parse "$JOB_PATH")
|
|
263
|
+
```
|
|
264
|
+
Update `stepCount` and the steps array from the fresh parse.
|
|
265
|
+
</step>
|
|
266
|
+
|
|
267
|
+
<step name="handle_audit_result">
|
|
268
|
+
After an `audit-milestone` step completes successfully, check the audit outcome.
|
|
269
|
+
|
|
270
|
+
Note: --no-check jobs never trigger this code path because they have no audit-milestone step. The `check: false` header means no `audit-milestone` step is generated by `generateMilestoneSteps`, so handle_audit_result is never reached.
|
|
271
|
+
|
|
272
|
+
Note: The original complete-milestone step (if present) remains at its position after the original
|
|
273
|
+
audit step. Gap-fix steps (including re-audit) are inserted between the original audit step and
|
|
274
|
+
complete-milestone. When the re-audit passes, the loop naturally reaches complete-milestone.
|
|
275
|
+
If the re-audit finds MORE gaps, another cycle inserts steps after THAT re-audit, further
|
|
276
|
+
deferring complete-milestone. This is correct -- complete-milestone only runs after a clean audit.
|
|
277
|
+
|
|
278
|
+
1. **Read audit status:**
|
|
279
|
+
```bash
|
|
280
|
+
AUDIT_STATUS=$(grep -m1 '^status:' ${project_root}/*MILESTONE-AUDIT.md 2>/dev/null | cut -d: -f2 | tr -d ' ' || echo "not_found")
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
2. **If `passed`:**
|
|
284
|
+
|
|
285
|
+
- If `GAP_FIX_CYCLE > 0` (audit passed AFTER gap-fix cycles): Display success banner:
|
|
286
|
+
```
|
|
287
|
+
=== AUDIT PASSED after {GAP_FIX_CYCLE} gap-fix cycle(s) ===
|
|
288
|
+
```
|
|
289
|
+
- If `GAP_FIX_CYCLE == 0` (audit passed first time): Display clean banner:
|
|
290
|
+
```
|
|
291
|
+
Audit passed -- no gaps found. Proceeding to complete milestone.
|
|
292
|
+
```
|
|
293
|
+
- Continue to the next step (should be `complete-milestone`).
|
|
294
|
+
|
|
295
|
+
3. **If `gaps_found`:**
|
|
296
|
+
|
|
297
|
+
Increment `GAP_FIX_CYCLE`.
|
|
298
|
+
|
|
299
|
+
**3a. Check cycle limit (AUDT-03):**
|
|
300
|
+
If `GAP_FIX_CYCLE > 3`:
|
|
301
|
+
- Read remaining gap details from MILESTONE-AUDIT.md for the halt message:
|
|
302
|
+
```bash
|
|
303
|
+
GAPS_SUMMARY=$(grep -A 5 'gaps:' ${project_root}/*MILESTONE-AUDIT.md 2>/dev/null | head -10)
|
|
304
|
+
```
|
|
305
|
+
- Display halt message:
|
|
306
|
+
```
|
|
307
|
+
Gap closure cycle limit reached (3/3). Remaining gaps require manual investigation.
|
|
308
|
+
|
|
309
|
+
Remaining gaps:
|
|
310
|
+
{GAPS_SUMMARY}
|
|
311
|
+
|
|
312
|
+
Suggested next steps:
|
|
313
|
+
1. Review: cat ${project_root}/*MILESTONE-AUDIT.md
|
|
314
|
+
2. Fix manually or run: /dgs:plan-milestone-gaps
|
|
315
|
+
3. Resume: /dgs:run-job {VERSION}
|
|
316
|
+
```
|
|
317
|
+
- Update header Status to `failed`:
|
|
318
|
+
```bash
|
|
319
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-header "$JOB_PATH" Status failed
|
|
320
|
+
```
|
|
321
|
+
- **HALT immediately.**
|
|
322
|
+
|
|
323
|
+
**3b. Auto-approve gap-fix insertion:**
|
|
324
|
+
The 3-cycle limit in 3a is the safety net. No user prompt needed.
|
|
325
|
+
|
|
326
|
+
Display:
|
|
327
|
+
```
|
|
328
|
+
Auto-approving gap-fix insertion (cycle {GAP_FIX_CYCLE}/3)
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
**3c. Display cycle start banner:**
|
|
332
|
+
```
|
|
333
|
+
=== Gap-Fix Cycle {GAP_FIX_CYCLE}/3 ===
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
**3d. Insert plan-milestone-gaps step and execute it:**
|
|
337
|
+
- Spawn subagent for `plan-milestone-gaps {VERSION} --auto`:
|
|
338
|
+
```
|
|
339
|
+
Task(
|
|
340
|
+
prompt="Execute /dgs:plan-milestone-gaps {VERSION} --auto.
|
|
341
|
+
<job-mode>silent</job-mode>
|
|
342
|
+
Read the command file and follow its workflow end-to-end.
|
|
343
|
+
Auto-resolve all interactive prompts.
|
|
344
|
+
Report: SUCCESS or FAILED: <reason>"
|
|
345
|
+
)
|
|
346
|
+
```
|
|
347
|
+
- On failure: Update header Status to `failed`, display error message with restart hint, and **HALT immediately.**
|
|
348
|
+
|
|
349
|
+
**3e. Discover new phases from ROADMAP.md:**
|
|
350
|
+
- Briefly read ROADMAP.md to find new phases created by plan-milestone-gaps. Look for phases in the milestone range that were not present before the gap planner ran. The simplest approach: look for phase directories that have `discussed` or `researched` disk status (the gap planner creates phase directories with CONTEXT/RESEARCH but no PLANs yet), OR check for phases where `disk_status` changed since the last parse.
|
|
351
|
+
- Build an array of `{number, name}` objects for the new phases.
|
|
352
|
+
|
|
353
|
+
**3f. Insert gap-fix section into job file (AUDT-01, AUDT-04):**
|
|
354
|
+
- Use the CLI command to insert the section marker + gap-fix steps + re-audit step, and update the GapFixCycle header:
|
|
355
|
+
```bash
|
|
356
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs insert-gap-fix-section "$JOB_PATH" $AUDIT_STEP_INDEX $GAP_FIX_CYCLE "$VERSION" '$PHASES_JSON'
|
|
357
|
+
```
|
|
358
|
+
Where `$AUDIT_STEP_INDEX` is the zero-based index of the audit-milestone step that just completed, `$GAP_FIX_CYCLE` is the current cycle number, and `$PHASES_JSON` is a JSON array of `[{number, name}]` objects for the new phases.
|
|
359
|
+
|
|
360
|
+
**3g. Re-parse the job file** and continue the execution loop with the newly inserted steps:
|
|
361
|
+
```bash
|
|
362
|
+
JOB=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs parse "$JOB_PATH")
|
|
363
|
+
```
|
|
364
|
+
Update `stepCount` and steps array. The execution loop will pick up the new plan+execute+audit steps.
|
|
365
|
+
</step>
|
|
366
|
+
|
|
367
|
+
<step name="handle_phase_audit_result">
|
|
368
|
+
After an `audit-phase` step completes successfully, check the phase audit outcome.
|
|
369
|
+
|
|
370
|
+
**Key differences from milestone-level handle_audit_result:**
|
|
371
|
+
- Uses `phase-uat-status` CLI (not grep of MILESTONE-AUDIT.md)
|
|
372
|
+
- Checks for `diagnosed` status (not `gaps_found` -- audit-phase transitions through gaps_found to diagnosed)
|
|
373
|
+
- Inserts 2 steps (not N steps with plan-milestone-gaps)
|
|
374
|
+
- Limit of 2 cycles (not 3)
|
|
375
|
+
- Does NOT spawn plan-milestone-gaps (uses execute-phase --gaps-only which runs existing gap closure plans)
|
|
376
|
+
- Uses independent PhaseFixCycle counter/header (not GapFixCycle)
|
|
377
|
+
|
|
378
|
+
1. **Extract phase number** from the completed step's args:
|
|
379
|
+
Parse the first positional argument from the step's args field (e.g., `args: "41"` or `args: "41 --rerun-failed"` both yield phase number `41`).
|
|
380
|
+
|
|
381
|
+
2. **Read phase UAT status:**
|
|
382
|
+
```bash
|
|
383
|
+
UAT_JSON=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs phase-uat-status "${PHASE_NUMBER}" --raw 2>/dev/null)
|
|
384
|
+
```
|
|
385
|
+
Parse the `status` field from the JSON result.
|
|
386
|
+
|
|
387
|
+
3. **If `passed` or `complete`:**
|
|
388
|
+
Display:
|
|
389
|
+
```
|
|
390
|
+
Phase {N} audit passed. Continuing to next step.
|
|
391
|
+
```
|
|
392
|
+
Continue to the next step (no gap-fix needed).
|
|
393
|
+
|
|
394
|
+
4. **If `diagnosed`:**
|
|
395
|
+
|
|
396
|
+
Increment `PHASE_GAP_FIX_CYCLE`.
|
|
397
|
+
|
|
398
|
+
**4a. Check cycle limit:**
|
|
399
|
+
If `PHASE_GAP_FIX_CYCLE > 2`:
|
|
400
|
+
- Display halt message:
|
|
401
|
+
```
|
|
402
|
+
Phase {N} gap closure cycle limit reached (2/2). Gap(s) remain after 2 fix attempts.
|
|
403
|
+
Manual intervention required.
|
|
404
|
+
|
|
405
|
+
Suggested next steps:
|
|
406
|
+
1. Review UAT file for remaining gaps
|
|
407
|
+
2. Fix manually
|
|
408
|
+
3. Resume: /dgs:run-job {VERSION}
|
|
409
|
+
```
|
|
410
|
+
- Update header Status to `failed`:
|
|
411
|
+
```bash
|
|
412
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-header "$JOB_PATH" Status failed
|
|
413
|
+
```
|
|
414
|
+
- **HALT immediately.**
|
|
415
|
+
|
|
416
|
+
**4b. Insert gap-fix steps:**
|
|
417
|
+
Display:
|
|
418
|
+
```
|
|
419
|
+
Phase {N} audit diagnosed -- inserting gap-fix steps (cycle {PHASE_GAP_FIX_CYCLE}/2)
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
```bash
|
|
423
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs insert-phase-gap-fix "$JOB_PATH" $AUDIT_STEP_INDEX $PHASE_GAP_FIX_CYCLE "$PHASE_NUMBER"
|
|
424
|
+
```
|
|
425
|
+
|
|
426
|
+
Where `$AUDIT_STEP_INDEX` is the zero-based index of the audit-phase step that just completed.
|
|
427
|
+
|
|
428
|
+
**4c. Re-parse the job file** and continue the execution loop:
|
|
429
|
+
```bash
|
|
430
|
+
JOB=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs parse "$JOB_PATH")
|
|
431
|
+
```
|
|
432
|
+
Update `stepCount` and steps array. The loop picks up the new execute-phase --gaps-only and audit-phase --rerun-failed steps.
|
|
433
|
+
|
|
434
|
+
5. **If status is anything else** (e.g., `testing`, `gaps_found`, or `not_found`):
|
|
435
|
+
Log a warning but do not halt -- the audit may still be in progress or the UAT file may not exist yet. Continue to the next step.
|
|
436
|
+
</step>
|
|
437
|
+
|
|
438
|
+
<step name="complete_job">
|
|
439
|
+
When all steps are completed (`nextStepIndex` is null after the loop):
|
|
440
|
+
|
|
441
|
+
1. **Update header Status to `completed`:**
|
|
442
|
+
```bash
|
|
443
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs update-header "$JOB_PATH" Status completed
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
2. **Move job to `completed/`:**
|
|
447
|
+
```bash
|
|
448
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs move "$JOB_PATH" "${jobs_root}/completed"
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
3. **Generate job summary:**
|
|
452
|
+
```bash
|
|
453
|
+
SUMMARY=$(node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs jobs generate-summary "$VERSION")
|
|
454
|
+
```
|
|
455
|
+
Parse the result. If `found: true`, write the `content` field to `${jobs_root}/completed/job-{version}-SUMMARY.md` using the Write tool.
|
|
456
|
+
Display: `Job summary written to ${jobs_root}/completed/job-{version}-SUMMARY.md`
|
|
457
|
+
|
|
458
|
+
4. **Display completion banner:**
|
|
459
|
+
|
|
460
|
+
If `AUTO_RESOLVE_COUNT` is 0:
|
|
461
|
+
```
|
|
462
|
+
=== JOB COMPLETE: {version} -- {stepCount}/{stepCount} steps in {total_elapsed} ===
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
If `AUTO_RESOLVE_COUNT > 0`:
|
|
466
|
+
```
|
|
467
|
+
=== JOB COMPLETE: {version} -- {stepCount}/{stepCount} steps, {total_elapsed} total. {AUTO_RESOLVE_COUNT} auto-resolved prompts (see job file) ===
|
|
468
|
+
```
|
|
469
|
+
</step>
|
|
470
|
+
|
|
471
|
+
</process>
|
|
472
|
+
|
|
473
|
+
<orchestrator_constraints>
|
|
474
|
+
The orchestrator MUST stay lean per EXEC-07:
|
|
475
|
+
- Do NOT read any files beyond the job file and MILESTONE-AUDIT.md (phase UAT status is read via CLI, not file access)
|
|
476
|
+
- Do NOT parse PLAN.md files, SUMMARY.md files, or codebase files
|
|
477
|
+
- Do NOT load STATE.md or ROADMAP.md (except briefly after plan-milestone-gaps to discover new phases)
|
|
478
|
+
- Do NOT read MILESTONE-AUDIT.md except in handle_audit_result after an audit-milestone step completes
|
|
479
|
+
- Phase UAT status is read via `phase-uat-status` CLI in handle_phase_audit_result -- no direct file access
|
|
480
|
+
- Each subagent gets ALL context it needs via its own command shim -- the orchestrator just passes the command name and args
|
|
481
|
+
- Keep orchestrator context usage minimal regardless of job length
|
|
482
|
+
</orchestrator_constraints>
|
|
483
|
+
|
|
484
|
+
<success_criteria>
|
|
485
|
+
- [ ] Job file located and moved to in-progress (or resumed if already there)
|
|
486
|
+
- [ ] Each step spawns an isolated subagent with fresh context
|
|
487
|
+
- [ ] Job file updated in real-time with step status and timestamps
|
|
488
|
+
- [ ] Failed steps halt execution immediately with error + restart hint
|
|
489
|
+
- [ ] Resume skips completed steps with skip summary
|
|
490
|
+
- [ ] Milestone audit gap-fix cycle auto-approved with 3-cycle safety limit
|
|
491
|
+
- [ ] Phase audit gap-fix cycle auto-approved with 2-cycle safety limit
|
|
492
|
+
- [ ] PhaseFixCycle counter resets on plan-phase/map-codebase steps
|
|
493
|
+
- [ ] Completed jobs moved to completed/ directory with banner
|
|
494
|
+
- [ ] Orchestrator reads only job file and MILESTONE-AUDIT.md (phase UAT via CLI)
|
|
495
|
+
- [ ] --dry-run flag displays step preview without executing
|
|
496
|
+
- [ ] Job summary auto-generated on completion (written to completed/)
|
|
497
|
+
- [ ] Job summary auto-generated on failure (written to in-progress/)
|
|
498
|
+
</success_criteria>
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Search across ideas, specs, docs, and projects with fuzzy keyword matching. Display results grouped by type with context snippets, titles, and file paths. Read-only operation.
|
|
3
|
+
</purpose>
|
|
4
|
+
|
|
5
|
+
<context_tier>lite</context_tier>
|
|
6
|
+
|
|
7
|
+
<required_reading>
|
|
8
|
+
Read all files referenced by the invoking prompt's execution_context before starting.
|
|
9
|
+
</required_reading>
|
|
10
|
+
|
|
11
|
+
<process>
|
|
12
|
+
|
|
13
|
+
<step name="load_context" priority="first">
|
|
14
|
+
Load project context via tier system:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
TIER_FILES=$(node "$HOME/.claude/deliver-great-systems/bin/dgs-tools.cjs" context load-tier lite --raw 2>/dev/null)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
Use `TIER_FILES` JSON `files` array for project context (PROJECT.md, STATE.md, config.json).
|
|
21
|
+
</step>
|
|
22
|
+
|
|
23
|
+
<step name="parse_arguments">
|
|
24
|
+
Extract the query string and filter flags from `$ARGUMENTS`.
|
|
25
|
+
|
|
26
|
+
**Query extraction:**
|
|
27
|
+
- The query is the first positional argument (may be quoted or unquoted)
|
|
28
|
+
- Examples: `/dgs:search "auth tokens"`, `/dgs:search authentication --ideas-only`
|
|
29
|
+
|
|
30
|
+
**Filter flags:**
|
|
31
|
+
- `--ideas-only` — search only ideas
|
|
32
|
+
- `--specs-only` — search only specs
|
|
33
|
+
- `--docs-only` — search only docs
|
|
34
|
+
- `--include-rejected` — include rejected ideas in results
|
|
35
|
+
- `--tags TAG1,TAG2` — filter by tags (comma-separated, OR logic)
|
|
36
|
+
|
|
37
|
+
Multiple type filters combine with OR: `--ideas-only --specs-only` shows both ideas and specs.
|
|
38
|
+
|
|
39
|
+
**If no query found in arguments:**
|
|
40
|
+
Use AskUserQuestion: "What would you like to search for?"
|
|
41
|
+
Use the response as the query string.
|
|
42
|
+
</step>
|
|
43
|
+
|
|
44
|
+
<step name="run_search">
|
|
45
|
+
Execute search via dgs-tools:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
node ~/.claude/deliver-great-systems/bin/dgs-tools.cjs search "QUERY" [--ideas-only] [--specs-only] [--docs-only] [--include-rejected] [--tags TAGS] --raw
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Build the command with applicable flags from step 1. Always include `--raw` for JSON output.
|
|
52
|
+
|
|
53
|
+
Parse the JSON result. Expected structure:
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"query": "search terms",
|
|
57
|
+
"groups": [
|
|
58
|
+
{
|
|
59
|
+
"type": "ideas",
|
|
60
|
+
"results": [
|
|
61
|
+
{ "title": "...", "path": "...", "snippet": "...", "id": 1, "state": "pending", "tags": [] }
|
|
62
|
+
],
|
|
63
|
+
"total": 3,
|
|
64
|
+
"shown": 3,
|
|
65
|
+
"overflow": 0
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"total_matches": 3
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Each result contains: `title`, `path`, `snippet` (plus type-specific fields like `id`, `state`, `tags` for ideas; `id`, `status` for specs; `scope` for docs).
|
|
73
|
+
</step>
|
|
74
|
+
|
|
75
|
+
<step name="display_results">
|
|
76
|
+
Format and display the search results.
|
|
77
|
+
|
|
78
|
+
**If `total_matches === 0`:**
|
|
79
|
+
|
|
80
|
+
Display:
|
|
81
|
+
```
|
|
82
|
+
No results found for "QUERY".
|
|
83
|
+
|
|
84
|
+
Try broadening your search with fewer or different keywords, or remove scope filters to search all content types.
|
|
85
|
+
```
|
|
86
|
+
Exit.
|
|
87
|
+
|
|
88
|
+
**Otherwise, iterate the `groups` array in order.** Each group has `type`, `results[]`, `total`, `shown`, and `overflow`. Display sections in the order groups appear (ideas, specs, docs, projects). Only show groups that have results.
|
|
89
|
+
|
|
90
|
+
For each group:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
### {type (title-cased)}
|
|
94
|
+
|
|
95
|
+
**{title}**
|
|
96
|
+
_{path}_
|
|
97
|
+
> {snippet}
|
|
98
|
+
|
|
99
|
+
**{title}**
|
|
100
|
+
_{path}_
|
|
101
|
+
> {snippet}
|
|
102
|
+
|
|
103
|
+
_... and {overflow} more in {type}_
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Display rules:
|
|
107
|
+
- **Type headers** derived from group `type` field: `### Ideas`, `### Specs`, `### Documents`, `### Projects`
|
|
108
|
+
- **Title** in bold on its own line
|
|
109
|
+
- **Path** in italics on the next line (from `path` field, not `filePath`)
|
|
110
|
+
- **Snippet** as a blockquote (indented with `>`)
|
|
111
|
+
- **Overflow line** only shown if `overflow > 0` for that group
|
|
112
|
+
- Skip groups entirely if `results` array is empty
|
|
113
|
+
|
|
114
|
+
**Total count at bottom:**
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Found {total_matches} results for "{query}"
|
|
118
|
+
```
|
|
119
|
+
</step>
|
|
120
|
+
|
|
121
|
+
</process>
|
|
122
|
+
|
|
123
|
+
<success_criteria>
|
|
124
|
+
- [ ] Query extracted from arguments or prompted via AskUserQuestion
|
|
125
|
+
- [ ] Filter flags parsed and passed to dgs-tools.cjs
|
|
126
|
+
- [ ] Results displayed grouped by type in fixed order
|
|
127
|
+
- [ ] Each result shows title, path, and context snippet
|
|
128
|
+
- [ ] Overflow indicator shown when more results exist
|
|
129
|
+
- [ ] Empty state shows helpful message with suggestions
|
|
130
|
+
</success_criteria>
|