forge-workflow 0.0.5 → 0.0.6
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/.claude/commands/dev.md +6 -1
- package/.claude/commands/plan.md +59 -14
- package/.claude/commands/premerge.md +10 -0
- package/.claude/commands/review.md +7 -1
- package/.claude/commands/ship.md +95 -47
- package/.claude/commands/status.md +42 -0
- package/.claude/commands/validate.md +7 -1
- package/.claude/commands/verify.md +52 -4
- package/.claude/rules/workflow.md +16 -0
- package/.claude/scripts/greptile-resolve.sh +32 -0
- package/.cline/workflows/dev.md +6 -1
- package/.cline/workflows/plan.md +59 -14
- package/.cline/workflows/premerge.md +10 -0
- package/.cline/workflows/review.md +7 -1
- package/.cline/workflows/ship.md +95 -47
- package/.cline/workflows/status.md +42 -0
- package/.cline/workflows/validate.md +7 -1
- package/.cline/workflows/verify.md +52 -4
- package/.codex/skills/dev/SKILL.md +6 -1
- package/.codex/skills/plan/SKILL.md +59 -14
- package/.codex/skills/premerge/SKILL.md +10 -0
- package/.codex/skills/review/SKILL.md +7 -1
- package/.codex/skills/ship/SKILL.md +95 -47
- package/.codex/skills/status/SKILL.md +42 -0
- package/.codex/skills/validate/SKILL.md +7 -1
- package/.codex/skills/verify/SKILL.md +52 -4
- package/.cursor/commands/dev.md +6 -1
- package/.cursor/commands/plan.md +59 -14
- package/.cursor/commands/premerge.md +10 -0
- package/.cursor/commands/review.md +7 -1
- package/.cursor/commands/ship.md +95 -47
- package/.cursor/commands/status.md +42 -0
- package/.cursor/commands/validate.md +7 -1
- package/.cursor/commands/verify.md +52 -4
- package/.github/prompts/dev.prompt.md +6 -1
- package/.github/prompts/plan.prompt.md +59 -14
- package/.github/prompts/premerge.prompt.md +10 -0
- package/.github/prompts/review.prompt.md +7 -1
- package/.github/prompts/ship.prompt.md +95 -47
- package/.github/prompts/status.prompt.md +42 -0
- package/.github/prompts/validate.prompt.md +7 -1
- package/.github/prompts/verify.prompt.md +52 -4
- package/.kilocode/workflows/dev.md +6 -1
- package/.kilocode/workflows/plan.md +59 -14
- package/.kilocode/workflows/premerge.md +10 -0
- package/.kilocode/workflows/review.md +7 -1
- package/.kilocode/workflows/ship.md +95 -47
- package/.kilocode/workflows/status.md +42 -0
- package/.kilocode/workflows/validate.md +7 -1
- package/.kilocode/workflows/verify.md +52 -4
- package/.opencode/commands/dev.md +6 -1
- package/.opencode/commands/plan.md +59 -14
- package/.opencode/commands/premerge.md +10 -0
- package/.opencode/commands/review.md +7 -1
- package/.opencode/commands/ship.md +95 -47
- package/.opencode/commands/status.md +42 -0
- package/.opencode/commands/validate.md +7 -1
- package/.opencode/commands/verify.md +52 -4
- package/.roo/commands/dev.md +6 -1
- package/.roo/commands/plan.md +59 -14
- package/.roo/commands/premerge.md +10 -0
- package/.roo/commands/review.md +7 -1
- package/.roo/commands/ship.md +95 -47
- package/.roo/commands/status.md +42 -0
- package/.roo/commands/validate.md +7 -1
- package/.roo/commands/verify.md +52 -4
- package/AGENTS.md +97 -0
- package/CLAUDE.md +10 -0
- package/README.md +2 -2
- package/bin/forge-cmd.js +5 -1
- package/bin/forge-preflight.js +15 -2
- package/bin/forge.js +178 -9
- package/docs/ENHANCED_ONBOARDING.md +96 -86
- package/docs/ROADMAP.md +2 -2
- package/docs/TOOLCHAIN.md +23 -0
- package/docs/VALIDATION.md +1 -1
- package/lefthook.yml +11 -0
- package/lib/agents-config.js +2 -2
- package/lib/commands/_registry.js +134 -0
- package/lib/commands/clean.js +181 -0
- package/lib/commands/dev.js +58 -0
- package/lib/commands/push.js +196 -0
- package/lib/commands/recommend.js +1 -1
- package/lib/commands/sync.js +55 -0
- package/lib/commands/team.js +37 -0
- package/lib/commands/test.js +207 -0
- package/lib/commands/worktree.js +310 -0
- package/lib/docs-command.js +51 -0
- package/lib/docs-copy.js +50 -0
- package/lib/freshness-token.js +148 -0
- package/lib/greptile-match.js +80 -0
- package/lib/reset.js +309 -0
- package/lib/task-ownership.js +117 -0
- package/package.json +2 -2
- package/scripts/beads-context.sh +157 -22
- package/scripts/beads-context.test.js +5 -1
- package/scripts/check-forge-token.js +98 -0
- package/scripts/conflict-detect.sh +2 -2
- package/scripts/dep-guard.sh +6 -28
- package/scripts/file-index.sh +117 -23
- package/scripts/forge-team/index.sh +86 -0
- package/scripts/forge-team/lib/agent-prompt.sh +52 -0
- package/scripts/forge-team/lib/claim.sh +256 -0
- package/scripts/forge-team/lib/dashboard.sh +341 -0
- package/scripts/forge-team/lib/epic.sh +332 -0
- package/scripts/forge-team/lib/hooks.sh +253 -0
- package/scripts/forge-team/lib/identity.sh +235 -0
- package/scripts/forge-team/lib/sync-github.sh +317 -0
- package/scripts/forge-team/lib/verify.sh +284 -0
- package/scripts/forge-team/lib/workload.sh +296 -0
- package/scripts/forge-team/tests/agent-prompt.test.sh +72 -0
- package/scripts/forge-team/tests/claim.test.sh +179 -0
- package/scripts/forge-team/tests/dashboard.test.sh +170 -0
- package/scripts/forge-team/tests/dispatcher.test.sh +79 -0
- package/scripts/forge-team/tests/epic.test.sh +176 -0
- package/scripts/forge-team/tests/hooks.test.sh +239 -0
- package/scripts/forge-team/tests/identity.test.sh +176 -0
- package/scripts/forge-team/tests/integration.test.sh +371 -0
- package/scripts/forge-team/tests/sync-github.test.sh +209 -0
- package/scripts/forge-team/tests/verify.test.sh +314 -0
- package/scripts/forge-team/tests/workflow-integration.test.sh +43 -0
- package/scripts/forge-team/tests/workload.test.sh +209 -0
- package/scripts/lib/eval-runner.js +39 -0
- package/scripts/lib/jsonl-lock.sh +48 -0
- package/scripts/lib/sanitize.sh +116 -0
- package/scripts/pr-coordinator.sh +706 -0
- package/scripts/smart-status.sh +37 -10
- package/scripts/sync-utils.sh +24 -29
- package/scripts/test.js +3 -1
package/.claude/commands/dev.md
CHANGED
|
@@ -275,7 +275,12 @@ Do NOT declare /dev complete until:
|
|
|
275
275
|
### Beads update
|
|
276
276
|
|
|
277
277
|
```bash
|
|
278
|
-
bash scripts/beads-context.sh
|
|
278
|
+
bash scripts/beads-context.sh validate <id>
|
|
279
|
+
bash scripts/beads-context.sh stage-transition <id> dev validate \
|
|
280
|
+
--summary "<N tasks done, M decision gates fired>" \
|
|
281
|
+
--decisions "<key spec gaps and how they were resolved>" \
|
|
282
|
+
--artifacts "<changed source files and test files>" \
|
|
283
|
+
--next "<validation priorities — lint issues, type concerns>"
|
|
279
284
|
```
|
|
280
285
|
|
|
281
286
|
---
|
package/.claude/commands/plan.md
CHANGED
|
@@ -76,6 +76,44 @@ If exit code 0: proceed silently to Phase 1.
|
|
|
76
76
|
|
|
77
77
|
---
|
|
78
78
|
|
|
79
|
+
### Parallel PR coordination check (soft block)
|
|
80
|
+
|
|
81
|
+
Before proceeding to Phase 1, check for merge conflicts and dependency issues with in-flight PRs:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
# Run merge simulation if on a feature branch
|
|
85
|
+
current_branch="$(git branch --show-current)"
|
|
86
|
+
if [[ "$current_branch" != "master" ]] && [[ "$current_branch" != "main" ]]; then
|
|
87
|
+
bash scripts/pr-coordinator.sh merge-sim "$current_branch" 2>&1 || true
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Show current merge queue
|
|
91
|
+
bash scripts/pr-coordinator.sh merge-order 2>&1 || true
|
|
92
|
+
|
|
93
|
+
# Check for stale worktrees (informational)
|
|
94
|
+
bash scripts/pr-coordinator.sh stale-worktrees 2>&1 || true
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
If merge conflicts or unmet dependencies are found:
|
|
98
|
+
- Display the findings to the developer
|
|
99
|
+
- Ask: "In-flight PRs have potential conflicts. Proceed with planning anyway? (y/n)"
|
|
100
|
+
- If `n`: exit cleanly, no side effects
|
|
101
|
+
- If `y`: log override via `bd comments add <id> "PR coordination override: proceeding despite in-flight conflicts"`, then continue to Phase 1
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
### Team identity verification
|
|
106
|
+
|
|
107
|
+
Before starting planning, verify team identity is mapped:
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
bash scripts/forge-team/index.sh verify 2>&1 || true
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
If verify reports issues, address them before proceeding (the output will include `FORGE_AGENT_7f3a:PROMPT:` directives with exact commands to run).
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
79
117
|
## Phase 1: Design Intent (Brainstorming)
|
|
80
118
|
|
|
81
119
|
**Goal**: Capture WHAT to build — purpose, constraints, success criteria, edge cases, approach.
|
|
@@ -153,7 +191,6 @@ Questions to cover (adapt to feature, don't ask mechanical copies):
|
|
|
153
191
|
3. **Success criteria** — How will we know it's done? What is the minimum viable result?
|
|
154
192
|
4. **Edge cases** — What happens when [key dependency] fails / [input] is missing / [state] is ambiguous?
|
|
155
193
|
5. **Technical preferences** — Library A or B? Pattern X or Y? (when real options exist)
|
|
156
|
-
6. **Ambiguity policy** — If a spec gap is found mid-dev, should the agent: (a) make a reasonable choice and document it, or (b) pause and wait for input?
|
|
157
194
|
|
|
158
195
|
### Step 3: Propose approaches
|
|
159
196
|
|
|
@@ -172,7 +209,7 @@ Save to `docs/plans/YYYY-MM-DD-<slug>-design.md` with these sections:
|
|
|
172
209
|
- **Approach selected**: which option and why
|
|
173
210
|
- **Constraints**: hard limits
|
|
174
211
|
- **Edge cases**: decisions made during Q&A
|
|
175
|
-
- **Ambiguity policy**:
|
|
212
|
+
- **Ambiguity policy**: Use 7-dimension rubric scoring per /dev decision gate. >= 80% confidence: proceed and document. < 80%: stop and ask.
|
|
176
213
|
|
|
177
214
|
Commit the design doc:
|
|
178
215
|
```bash
|
|
@@ -386,6 +423,9 @@ Expected output: <what running the test/code produces when done>
|
|
|
386
423
|
- Feature logic SECOND
|
|
387
424
|
- Integration/wiring THIRD
|
|
388
425
|
- Uncertain/ambiguous tasks LAST (so they can be deferred if blocked)
|
|
426
|
+
- **File ownership**: Each task MUST include an `OWNS:` line listing files it will modify
|
|
427
|
+
- No two tasks in the same wave can own the same file
|
|
428
|
+
- Cross-wave ownership is allowed (sequential execution prevents conflicts)
|
|
389
429
|
|
|
390
430
|
**YAGNI filter** (after initial task draft, before saving):
|
|
391
431
|
|
|
@@ -467,10 +507,15 @@ Do NOT proceed to /dev until ALL are confirmed:
|
|
|
467
507
|
</HARD-GATE>
|
|
468
508
|
```
|
|
469
509
|
|
|
470
|
-
After all HARD-GATE items pass, record the stage transition
|
|
510
|
+
After all HARD-GATE items pass, validate context and record the stage transition:
|
|
471
511
|
|
|
472
512
|
```bash
|
|
473
|
-
bash scripts/beads-context.sh
|
|
513
|
+
bash scripts/beads-context.sh validate <id>
|
|
514
|
+
bash scripts/beads-context.sh stage-transition <id> plan dev \
|
|
515
|
+
--summary "<design approach chosen, task count>" \
|
|
516
|
+
--decisions "<key trade-offs resolved during Q&A>" \
|
|
517
|
+
--artifacts "docs/plans/YYYY-MM-DD-<slug>-design.md docs/plans/YYYY-MM-DD-<slug>-tasks.md" \
|
|
518
|
+
--next "<first dev task focus area>"
|
|
474
519
|
```
|
|
475
520
|
|
|
476
521
|
---
|
|
@@ -479,20 +524,20 @@ bash scripts/beads-context.sh stage-transition <id> plan dev
|
|
|
479
524
|
|
|
480
525
|
```
|
|
481
526
|
✓ Phase 1: Design intent captured
|
|
482
|
-
- Design doc: docs/plans
|
|
483
|
-
- Approach:
|
|
484
|
-
- Ambiguity policy:
|
|
527
|
+
- Design doc: docs/plans/<date>-<slug>-design.md
|
|
528
|
+
- Approach: <selected approach> (selected over <alternatives>)
|
|
529
|
+
- Ambiguity policy: Rubric scoring (>= 80% proceed, < 80% ask)
|
|
485
530
|
|
|
486
531
|
✓ Phase 2: Technical research complete
|
|
487
|
-
- OWASP Top 10:
|
|
488
|
-
- TDD scenarios:
|
|
489
|
-
- Sources:
|
|
532
|
+
- OWASP Top 10: <N> risks identified, <N> mitigations planned
|
|
533
|
+
- TDD scenarios: <N> identified
|
|
534
|
+
- Sources: <N> references
|
|
490
535
|
|
|
491
536
|
✓ Phase 3: Setup complete
|
|
492
|
-
- Beads:
|
|
493
|
-
- Branch: feat
|
|
494
|
-
- Worktree: .worktrees
|
|
495
|
-
- Task list: docs/plans
|
|
537
|
+
- Beads: <issue-id> (in_progress)
|
|
538
|
+
- Branch: feat/<slug>
|
|
539
|
+
- Worktree: .worktrees/<slug> (baseline: <N>/<N> tests passing)
|
|
540
|
+
- Task list: docs/plans/<date>-<slug>-tasks.md (<N> tasks)
|
|
496
541
|
|
|
497
542
|
⏸️ Task list ready for review. Confirm to proceed.
|
|
498
543
|
|
|
@@ -123,6 +123,16 @@ Output:
|
|
|
123
123
|
After you merge, run /verify to confirm everything landed correctly.
|
|
124
124
|
```
|
|
125
125
|
|
|
126
|
+
### Step 6: Validate Context and Record Stage Transition
|
|
127
|
+
|
|
128
|
+
```bash
|
|
129
|
+
bash scripts/beads-context.sh validate <id>
|
|
130
|
+
bash scripts/beads-context.sh stage-transition <id> premerge verify \
|
|
131
|
+
--summary "<docs updated, CI green, PR ready>" \
|
|
132
|
+
--artifacts "<updated doc files, PR URL>" \
|
|
133
|
+
--next "<merge instructions for user>"
|
|
134
|
+
```
|
|
135
|
+
|
|
126
136
|
```
|
|
127
137
|
<HARD-GATE: /premerge exit>
|
|
128
138
|
Do NOT run gh pr merge.
|
|
@@ -364,7 +364,13 @@ Do NOT declare /review complete until:
|
|
|
364
364
|
1. bash .claude/scripts/greptile-resolve.sh stats <pr-number> shows "All Greptile threads resolved"
|
|
365
365
|
2. ALL human reviewer comments are either resolved or have a reply with explanation
|
|
366
366
|
3. gh pr checks <pr-number> shows all checks passing
|
|
367
|
-
4.
|
|
367
|
+
4. Context check: Run `bash scripts/beads-context.sh validate <id>` and address any warnings
|
|
368
|
+
5. Stage transition: Run the following → exit 0 confirmed:
|
|
369
|
+
bash scripts/beads-context.sh stage-transition <id> review premerge \
|
|
370
|
+
--summary "<all feedback addressed summary>" \
|
|
371
|
+
--decisions "<comment resolutions — valid fixes and justified rejections>" \
|
|
372
|
+
--artifacts "<fixed files, commit SHAs>" \
|
|
373
|
+
--next "<doc update needs for premerge>"
|
|
368
374
|
</HARD-GATE>
|
|
369
375
|
```
|
|
370
376
|
|
package/.claude/commands/ship.md
CHANGED
|
@@ -46,6 +46,36 @@ BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
|
|
|
46
46
|
|
|
47
47
|
This is NOT a full rebase — just a check. The rebase happens in /validate where the full test suite runs afterward.
|
|
48
48
|
|
|
49
|
+
### Parallel PR coordination (soft block)
|
|
50
|
+
|
|
51
|
+
Before creating the PR, check merge readiness:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
# Run merge simulation against base branch
|
|
55
|
+
bash scripts/pr-coordinator.sh merge-sim "$(git branch --show-current)" 2>&1
|
|
56
|
+
|
|
57
|
+
# Show recommended merge order
|
|
58
|
+
bash scripts/pr-coordinator.sh merge-order 2>&1 || true
|
|
59
|
+
|
|
60
|
+
# Auto-label the PR after creation (called after gh pr create below)
|
|
61
|
+
# bash scripts/pr-coordinator.sh auto-label <issue-id>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
If merge simulation finds conflicts:
|
|
65
|
+
- Display conflicted files
|
|
66
|
+
- Ask: "Merge conflicts detected with base branch. These PRs should merge first: [list]. Proceed with PR creation anyway? (y/n)"
|
|
67
|
+
- If `n`: exit cleanly
|
|
68
|
+
- If `y`: log override via `bd comments add <id> "Ship override: creating PR despite merge conflicts"`, then continue
|
|
69
|
+
|
|
70
|
+
After PR creation completes:
|
|
71
|
+
```bash
|
|
72
|
+
# Auto-label the newly created PR
|
|
73
|
+
bash scripts/pr-coordinator.sh auto-label <issue-id>
|
|
74
|
+
|
|
75
|
+
# Check for stale worktrees (informational)
|
|
76
|
+
bash scripts/pr-coordinator.sh stale-worktrees 2>&1 || true
|
|
77
|
+
```
|
|
78
|
+
|
|
49
79
|
### Step 3: Update Beads
|
|
50
80
|
```bash
|
|
51
81
|
bd update <id> --status done
|
|
@@ -60,68 +90,86 @@ Use `--force-with-lease` because `/validate` may have rebased the branch, rewrit
|
|
|
60
90
|
git push --force-with-lease -u origin <branch-name>
|
|
61
91
|
```
|
|
62
92
|
|
|
63
|
-
### Step 5: Create PR
|
|
93
|
+
### Step 5: Create PR Using Project's PR Template
|
|
64
94
|
|
|
65
|
-
|
|
95
|
+
**CRITICAL**: Always use the project's own PR template. Never use a hardcoded body.
|
|
66
96
|
|
|
67
|
-
|
|
97
|
+
**Step 5a: Locate the PR template**
|
|
68
98
|
|
|
99
|
+
Check for a PR template in the project (in order of precedence):
|
|
69
100
|
```bash
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
101
|
+
# Check standard locations
|
|
102
|
+
PR_TEMPLATE=""
|
|
103
|
+
for path in .github/pull_request_template.md .github/PULL_REQUEST_TEMPLATE.md docs/pull_request_template.md pull_request_template.md; do
|
|
104
|
+
if [ -f "$path" ]; then
|
|
105
|
+
PR_TEMPLATE="$path"
|
|
106
|
+
break
|
|
107
|
+
fi
|
|
108
|
+
done
|
|
109
|
+
```
|
|
76
110
|
|
|
77
|
-
|
|
78
|
-
[What this PR does to solve it — approach, not implementation details]
|
|
111
|
+
**Step 5b: Read and populate the template**
|
|
79
112
|
|
|
80
|
-
|
|
81
|
-
|
|
113
|
+
If a PR template exists:
|
|
114
|
+
1. **Read the template file** using the Read tool
|
|
115
|
+
2. **Fill in every section** with actual data from the current PR context:
|
|
116
|
+
- Replace HTML comments (`<!-- ... -->`) with real content
|
|
117
|
+
- Check applicable checkboxes (`- [x]`)
|
|
118
|
+
- Fill in beads issue IDs (replace `beads-xxx` with actual ID)
|
|
119
|
+
- Fill in test results, validation status, and other concrete data
|
|
120
|
+
- Reference the design doc: `docs/plans/YYYY-MM-DD-<slug>-design.md`
|
|
121
|
+
3. **Do NOT remove any sections** — fill them all, even if "N/A"
|
|
122
|
+
4. **Do NOT restructure the template** — keep the project's chosen format
|
|
82
123
|
|
|
83
|
-
|
|
84
|
-
|
|
124
|
+
If no PR template exists, use this minimal fallback:
|
|
125
|
+
```
|
|
126
|
+
## Summary
|
|
127
|
+
[1-3 sentences: what this PR does and why]
|
|
85
128
|
|
|
86
|
-
|
|
87
|
-
|
|
129
|
+
## Changes
|
|
130
|
+
[Bulleted list of key changes]
|
|
88
131
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
- Scenarios covered: [list key scenarios]
|
|
132
|
+
## Testing
|
|
133
|
+
[How it was tested, test results]
|
|
92
134
|
|
|
93
|
-
|
|
94
|
-
-
|
|
95
|
-
- Automated scan: [result]
|
|
135
|
+
## Beads
|
|
136
|
+
Closes beads-xxx
|
|
96
137
|
|
|
97
|
-
|
|
98
|
-
|
|
138
|
+
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
139
|
+
```
|
|
99
140
|
|
|
100
|
-
|
|
101
|
-
See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose during /dev)
|
|
141
|
+
**Step 5c: Create the PR**
|
|
102
142
|
|
|
103
|
-
|
|
104
|
-
|
|
143
|
+
```bash
|
|
144
|
+
gh pr create --title "<type>: <concise description>" --body "<populated-template-content>"
|
|
145
|
+
```
|
|
105
146
|
|
|
106
|
-
|
|
107
|
-
|
|
147
|
+
Rules for the PR body:
|
|
148
|
+
- **Use the project's template structure** — never substitute your own format
|
|
149
|
+
- **Fill in concrete data** — commit counts, test results, actual file paths, real beads IDs
|
|
150
|
+
- **Check applicable checkboxes** — `[x]` for items that apply, `[ ]` for items that don't
|
|
151
|
+
- **Include "Closes beads-xxx"** in the Beads section (required for auto-close in /verify)
|
|
108
152
|
|
|
109
|
-
###
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
-
|
|
113
|
-
|
|
153
|
+
### Step 6: Validate Context and Record Stage Transition
|
|
154
|
+
```bash
|
|
155
|
+
bash scripts/beads-context.sh validate <id>
|
|
156
|
+
bash scripts/beads-context.sh stage-transition <id> ship review \
|
|
157
|
+
--summary "<PR created, checks pending>" \
|
|
158
|
+
--decisions "<template sections filled, beads linked>" \
|
|
159
|
+
--artifacts "<PR URL, branch name>" \
|
|
160
|
+
--next "<review focus areas>"
|
|
161
|
+
```
|
|
114
162
|
|
|
115
|
-
|
|
163
|
+
### Team sync after PR
|
|
116
164
|
|
|
117
|
-
|
|
118
|
-
EOF
|
|
119
|
-
)"
|
|
120
|
-
```
|
|
165
|
+
After PR is created, sync issue state to GitHub and verify 1:1 mapping:
|
|
121
166
|
|
|
122
|
-
### Step 6: Record Stage Transition
|
|
123
167
|
```bash
|
|
124
|
-
|
|
168
|
+
# Sync issue state to GitHub
|
|
169
|
+
bash scripts/forge-team/index.sh sync 2>&1 || true
|
|
170
|
+
|
|
171
|
+
# Verify 1:1 mapping
|
|
172
|
+
bash scripts/forge-team/index.sh verify 2>&1 || true
|
|
125
173
|
```
|
|
126
174
|
|
|
127
175
|
## Example Output
|
|
@@ -156,9 +204,9 @@ Stage 7: /verify → Post-merge CI check on main
|
|
|
156
204
|
|
|
157
205
|
## Tips
|
|
158
206
|
|
|
159
|
-
- **
|
|
160
|
-
- **
|
|
161
|
-
- **
|
|
162
|
-
- **
|
|
207
|
+
- **Use the project's PR template**: Always read `.github/pull_request_template.md` (or equivalent) and populate it — never substitute your own format
|
|
208
|
+
- **Fill every section**: Even if "N/A" — empty/missing sections cause review friction
|
|
209
|
+
- **Include "Closes beads-xxx"**: Required for auto-close in /verify
|
|
210
|
+
- **Concrete data only**: Test counts, file paths, commit SHAs — not placeholder text
|
|
163
211
|
- **Wait for checks**: Let GitHub Actions, Greptile, SonarCloud run
|
|
164
212
|
- **NO auto-merge**: Always wait for /review phase
|
|
@@ -24,6 +24,7 @@ bash scripts/sync-utils.sh auto-sync
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### Step 1: Smart Status (ranked issues with conflict detection)
|
|
27
|
+
|
|
27
28
|
```bash
|
|
28
29
|
bash scripts/smart-status.sh
|
|
29
30
|
```
|
|
@@ -31,6 +32,35 @@ This script dynamically computes and displays all issues ranked by composite sco
|
|
|
31
32
|
|
|
32
33
|
For full context on any issue: `bd show <id>`
|
|
33
34
|
|
|
35
|
+
### Step 1b: Reconcile stale in-progress issues
|
|
36
|
+
|
|
37
|
+
Check if any in-progress issues were already merged but not closed (can happen if `/verify` was skipped or backup was restored from stale snapshot):
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Detect default branch dynamically (prefer main over master)
|
|
41
|
+
DEFAULT_BRANCH=$(git symbolic-ref refs/remotes/origin/HEAD 2>/dev/null | sed 's|refs/remotes/origin/||')
|
|
42
|
+
if [ -z "$DEFAULT_BRANCH" ]; then
|
|
43
|
+
if git rev-parse --verify main >/dev/null 2>&1; then DEFAULT_BRANCH="main"
|
|
44
|
+
elif git rev-parse --verify master >/dev/null 2>&1; then DEFAULT_BRANCH="master"
|
|
45
|
+
else echo "ERROR: No main or master branch found — skipping stale reconciliation" >&2; DEFAULT_BRANCH=""; fi
|
|
46
|
+
fi
|
|
47
|
+
|
|
48
|
+
# For each in_progress issue, check if its PR was already merged
|
|
49
|
+
if [ -n "$DEFAULT_BRANCH" ]; then
|
|
50
|
+
bd list --status=in_progress --json 2>/dev/null | jq -r '.[].id' | while read id; do
|
|
51
|
+
# Search git log for the issue ID in commit messages (fixed-strings for literal match)
|
|
52
|
+
if git log --oneline --first-parent "$DEFAULT_BRANCH" --fixed-strings --grep="$id" | grep -q .; then
|
|
53
|
+
echo "STALE: $id — found in git history, likely already merged"
|
|
54
|
+
fi
|
|
55
|
+
done
|
|
56
|
+
fi
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
If stale issues are found, close them:
|
|
60
|
+
```bash
|
|
61
|
+
bd close <id> --force --reason="Already merged — detected during status reconciliation"
|
|
62
|
+
```
|
|
63
|
+
|
|
34
64
|
### Step 2: Review Recent Commits
|
|
35
65
|
```bash
|
|
36
66
|
git log --oneline -10
|
|
@@ -41,6 +71,18 @@ git log --oneline -10
|
|
|
41
71
|
- **Continuing work**: In-progress issues found, resume where left off
|
|
42
72
|
- **Review needed**: Work marked complete, needs review/merge
|
|
43
73
|
|
|
74
|
+
### Team context
|
|
75
|
+
|
|
76
|
+
Show current developer's active work and team overview:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
# Show my active issues
|
|
80
|
+
bash scripts/forge-team/index.sh workload --me 2>&1 || true
|
|
81
|
+
|
|
82
|
+
# One-line team summary
|
|
83
|
+
bash scripts/forge-team/index.sh dashboard 2>&1 | head -5 || true
|
|
84
|
+
```
|
|
85
|
+
|
|
44
86
|
## Next Steps
|
|
45
87
|
|
|
46
88
|
- **If starting new work**: Run `/plan <feature-name>`
|
|
@@ -228,7 +228,13 @@ until ALL FOUR show fresh output in this session:
|
|
|
228
228
|
"Should pass", "was passing earlier", and "I'm confident" are not evidence.
|
|
229
229
|
Run the commands. Show the output. THEN declare done.
|
|
230
230
|
|
|
231
|
-
5.
|
|
231
|
+
5. Context check: Run `bash scripts/beads-context.sh validate <id>` and address any warnings
|
|
232
|
+
6. Stage transition: Run the following → exit 0 confirmed:
|
|
233
|
+
bash scripts/beads-context.sh stage-transition <id> validate ship \
|
|
234
|
+
--summary "<all checks pass/fail summary>" \
|
|
235
|
+
--decisions "<any failures diagnosed and fixed>" \
|
|
236
|
+
--artifacts "<scripts and commands run>" \
|
|
237
|
+
--next "<ship readiness notes>"
|
|
232
238
|
</HARD-GATE>
|
|
233
239
|
```
|
|
234
240
|
|
|
@@ -145,19 +145,67 @@ Branch: <branch-name> deleted ✓
|
|
|
145
145
|
bd create --title="Post-merge: <description of issue>" --type=bug --priority=1
|
|
146
146
|
```
|
|
147
147
|
|
|
148
|
-
### Step 8: Close Beads
|
|
148
|
+
### Step 8: Close Beads Issues (if healthy)
|
|
149
149
|
|
|
150
|
-
If everything is clean, close
|
|
150
|
+
If everything is clean, close all Beads issues referenced in the merged PR.
|
|
151
|
+
|
|
152
|
+
**Auto-detect beads issues from PR body and branch name:**
|
|
153
|
+
|
|
154
|
+
```bash
|
|
155
|
+
# Get PR body and branch name
|
|
156
|
+
PR_BODY=$(gh pr view <number> --json body --jq '.body')
|
|
157
|
+
PR_BRANCH=$(gh pr view <number> --json headRefName --jq '.headRefName')
|
|
158
|
+
|
|
159
|
+
# Extract beads IDs from PR body (matches "Closes beads-xxx", "closes forge-xxx", etc.)
|
|
160
|
+
# Patterns: "Closes <prefix>-<id>", "Fixes <prefix>-<id>", "Resolves <prefix>-<id>"
|
|
161
|
+
BEADS_IDS=$(echo "$PR_BODY" | grep -oiE '(closes|fixes|resolves):?\s+[a-z]+-[a-z0-9]+' | grep -oiE '[a-z]+-[a-z0-9]{3,6}$')
|
|
162
|
+
|
|
163
|
+
# Validate each ID exists in beads
|
|
164
|
+
VALID_IDS=""
|
|
165
|
+
for id in $BEADS_IDS; do
|
|
166
|
+
if bd show "$id" >/dev/null 2>&1; then
|
|
167
|
+
VALID_IDS="$VALID_IDS $id"
|
|
168
|
+
fi
|
|
169
|
+
done
|
|
170
|
+
BEADS_IDS="$VALID_IDS"
|
|
171
|
+
|
|
172
|
+
# Also check branch name for beads ID — extract segment after last /
|
|
173
|
+
# then validate with bd show to avoid false matches like "pr-templa"
|
|
174
|
+
BRANCH_SLUG=$(echo "$PR_BRANCH" | sed 's|.*/||')
|
|
175
|
+
BRANCH_ID=$(echo "$BRANCH_SLUG" | grep -oE '[a-z]+-[a-z0-9]{3,6}' | head -1)
|
|
176
|
+
if [ -n "$BRANCH_ID" ] && ! bd show "$BRANCH_ID" >/dev/null 2>&1; then
|
|
177
|
+
BRANCH_ID="" # Not a valid beads ID — discard
|
|
178
|
+
fi
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Close each matched issue:**
|
|
151
182
|
|
|
152
183
|
```bash
|
|
153
|
-
|
|
184
|
+
# Close issues found in PR body
|
|
185
|
+
for id in $BEADS_IDS; do
|
|
186
|
+
bd close "$id" --reason="Merged and verified on master (PR #<number>)" 2>&1 || echo "Warning: could not close $id"
|
|
187
|
+
done
|
|
188
|
+
|
|
189
|
+
# If no issues found in body, try branch name match (skip if already closed above)
|
|
190
|
+
if [ -z "$BEADS_IDS" ] && [ -n "$BRANCH_ID" ]; then
|
|
191
|
+
bd close "$BRANCH_ID" --reason="Merged and verified on master (PR #<number>)" 2>&1 || echo "Warning: could not close $BRANCH_ID"
|
|
192
|
+
elif [ -n "$BRANCH_ID" ] && ! echo "$BEADS_IDS" | grep -qw "$BRANCH_ID"; then
|
|
193
|
+
bd close "$BRANCH_ID" --reason="Merged and verified on master (PR #<number>)" 2>&1 || echo "Warning: could not close $BRANCH_ID"
|
|
194
|
+
fi
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**If no beads issues detected at all**, prompt the user:
|
|
198
|
+
```
|
|
199
|
+
⚠ No beads issue ID found in PR body or branch name.
|
|
200
|
+
If this PR closes a beads issue, run: bd close <id> --reason="Merged and verified on master (PR #<number>)"
|
|
154
201
|
```
|
|
155
202
|
|
|
156
203
|
```
|
|
157
204
|
<HARD-GATE: /verify exit>
|
|
158
205
|
Do NOT declare /verify complete until:
|
|
159
206
|
1. gh run list --branch master --limit 3 shows actual CI output (not "should be fine")
|
|
160
|
-
2. If healthy: Beads
|
|
207
|
+
2. If healthy: Beads issues extracted from PR body/branch and closed (bd close run and confirmed)
|
|
208
|
+
- If no beads ID found: user was warned and given manual close command
|
|
161
209
|
3. If issues found: Beads tracking issue created for every problem
|
|
162
210
|
4. Worktree removed (or confirmed already gone) — OR Step 6 was intentionally skipped because CI was unhealthy; if skipped, state explicitly: "cleanup deferred, CI was not healthy"
|
|
163
211
|
"It should be fine" is not evidence. Run the command. Show the output.
|
|
@@ -51,6 +51,18 @@ bd close <id> # Complete
|
|
|
51
51
|
bd sync # Sync with git
|
|
52
52
|
```
|
|
53
53
|
|
|
54
|
+
## Forge CLI Commands
|
|
55
|
+
|
|
56
|
+
Use forge commands instead of raw tools — forge handles OS quirks, beads integration, and quality gates:
|
|
57
|
+
|
|
58
|
+
| Instead of... | Use... |
|
|
59
|
+
|---------------|--------|
|
|
60
|
+
| `git worktree add .worktrees/<slug> -b feat/<slug>` | `forge worktree create <slug>` |
|
|
61
|
+
| `bd dolt pull && bd dolt push` / `bd sync` | `forge sync` |
|
|
62
|
+
| `bun test` / `bun run test` | `forge test` or `forge test --affected` |
|
|
63
|
+
| `git push` (with manual checks) | `forge push` or `forge push --quick` |
|
|
64
|
+
| Manual worktree cleanup | `forge clean` or `forge clean --dry-run` |
|
|
65
|
+
|
|
54
66
|
## Git Workflow
|
|
55
67
|
|
|
56
68
|
```bash
|
|
@@ -67,6 +79,10 @@ git commit -m "refactor: extract helpers" # REFACTOR
|
|
|
67
79
|
# Worktrees (required for /dev)
|
|
68
80
|
git worktree add .worktrees/<slug> feat/<slug>
|
|
69
81
|
# .worktrees/ is gitignored
|
|
82
|
+
|
|
83
|
+
# Push workflow (preferred)
|
|
84
|
+
forge push # Full quality gates: branch protection + lint + tests + push
|
|
85
|
+
forge push --quick # Review-cycle: lint-only + push (CI runs full suite)
|
|
70
86
|
```
|
|
71
87
|
|
|
72
88
|
## Configuration
|
|
@@ -360,6 +360,22 @@ cmd_resolve_all() {
|
|
|
360
360
|
local threads
|
|
361
361
|
threads=$(echo "$response" | jq -r '.data.repository.pullRequest.reviewThreads.nodes')
|
|
362
362
|
|
|
363
|
+
# Build threads JSON for the Node helper (file + line for each unresolved Greptile thread)
|
|
364
|
+
local THREADS_JSON
|
|
365
|
+
THREADS_JSON=$(echo "$threads" | jq -c '[.[] | select(.isResolved == false and (.comments.nodes[0].author.login | startswith("greptile-apps"))) | { file: .comments.nodes[0].path, line: (.comments.nodes[0].line // 0) }]')
|
|
366
|
+
|
|
367
|
+
# Use Node helper to match threads to recent commits
|
|
368
|
+
local match_results=""
|
|
369
|
+
if command -v node &> /dev/null && [ -f "$(dirname "$0")/../../lib/greptile-match.js" ]; then
|
|
370
|
+
echo -e "${BLUE}Matching threads to recent commits...${NC}"
|
|
371
|
+
match_results=$(node -e "
|
|
372
|
+
const { matchThreadsToCommits } = require('$(dirname "$0")/../../lib/greptile-match.js');
|
|
373
|
+
const threads = JSON.parse(process.argv[1]);
|
|
374
|
+
const results = matchThreadsToCommits(threads, process.cwd());
|
|
375
|
+
console.log(JSON.stringify(results));
|
|
376
|
+
" "$THREADS_JSON" 2>/dev/null || echo "")
|
|
377
|
+
fi
|
|
378
|
+
|
|
363
379
|
local resolved_count=0
|
|
364
380
|
local failed_count=0
|
|
365
381
|
|
|
@@ -383,6 +399,22 @@ cmd_resolve_all() {
|
|
|
383
399
|
continue
|
|
384
400
|
fi
|
|
385
401
|
|
|
402
|
+
# Check if the Node helper found a matching commit for this file
|
|
403
|
+
local file_path
|
|
404
|
+
file_path=$(echo "$thread" | jq -r '.comments.nodes[0].path // ""')
|
|
405
|
+
local match_sha=""
|
|
406
|
+
if [ -n "$match_results" ] && [ "$match_results" != "null" ]; then
|
|
407
|
+
match_sha=$(echo "$match_results" | jq -r --arg f "$file_path" '.[] | select(.file == $f and .resolved == true) | .sha // empty' 2>/dev/null | head -1)
|
|
408
|
+
fi
|
|
409
|
+
|
|
410
|
+
# Auto-reply with commit info if we have a matching SHA
|
|
411
|
+
local comment_id
|
|
412
|
+
comment_id=$(echo "$thread" | jq -r '.comments.nodes[0].databaseId // empty')
|
|
413
|
+
if [ -n "$match_sha" ] && [ -n "$comment_id" ]; then
|
|
414
|
+
echo -e "${BLUE}Auto-replying to thread $thread_id (commit $match_sha)...${NC}"
|
|
415
|
+
reply_to_comment "$pr_number" "$comment_id" "Addressed in commit $match_sha" > /dev/null 2>&1 || true
|
|
416
|
+
fi
|
|
417
|
+
|
|
386
418
|
# Resolve
|
|
387
419
|
echo -e "${BLUE}Resolving thread $thread_id...${NC}"
|
|
388
420
|
if resolve_thread "$thread_id" > /dev/null 2>&1; then
|
package/.cline/workflows/dev.md
CHANGED
|
@@ -272,7 +272,12 @@ Do NOT declare /dev complete until:
|
|
|
272
272
|
### Beads update
|
|
273
273
|
|
|
274
274
|
```bash
|
|
275
|
-
bash scripts/beads-context.sh
|
|
275
|
+
bash scripts/beads-context.sh validate <id>
|
|
276
|
+
bash scripts/beads-context.sh stage-transition <id> dev validate \
|
|
277
|
+
--summary "<N tasks done, M decision gates fired>" \
|
|
278
|
+
--decisions "<key spec gaps and how they were resolved>" \
|
|
279
|
+
--artifacts "<changed source files and test files>" \
|
|
280
|
+
--next "<validation priorities — lint issues, type concerns>"
|
|
276
281
|
```
|
|
277
282
|
|
|
278
283
|
---
|