forge-workflow 0.0.3 → 0.0.4
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 +26 -0
- package/.claude/commands/plan.md +48 -5
- package/.claude/commands/premerge.md +0 -3
- package/.claude/commands/rollback.md +4 -4
- package/.claude/commands/ship.md +71 -41
- package/.claude/commands/status.md +9 -38
- package/.claude/commands/validate.md +47 -2
- package/.cline/workflows/dev.md +26 -0
- package/.cline/workflows/plan.md +48 -5
- package/.cline/workflows/premerge.md +0 -3
- package/.cline/workflows/rollback.md +4 -4
- package/.cline/workflows/ship.md +71 -41
- package/.cline/workflows/status.md +9 -38
- package/.cline/workflows/validate.md +47 -2
- package/.codex/skills/dev/SKILL.md +26 -0
- package/.codex/skills/plan/SKILL.md +48 -5
- package/.codex/skills/premerge/SKILL.md +0 -3
- package/.codex/skills/rollback/SKILL.md +4 -4
- package/.codex/skills/ship/SKILL.md +71 -41
- package/.codex/skills/status/SKILL.md +9 -38
- package/.codex/skills/validate/SKILL.md +47 -2
- package/.cursor/commands/dev.md +26 -0
- package/.cursor/commands/plan.md +48 -5
- package/.cursor/commands/premerge.md +0 -3
- package/.cursor/commands/rollback.md +4 -4
- package/.cursor/commands/ship.md +71 -41
- package/.cursor/commands/status.md +9 -38
- package/.cursor/commands/validate.md +47 -2
- package/.cursor/hooks/state/continual-learning-index.json +19 -0
- package/.cursor/hooks/state/continual-learning.json +8 -0
- package/.github/prompts/dev.prompt.md +26 -0
- package/.github/prompts/plan.prompt.md +48 -5
- package/.github/prompts/premerge.prompt.md +0 -3
- package/.github/prompts/rollback.prompt.md +4 -4
- package/.github/prompts/ship.prompt.md +71 -41
- package/.github/prompts/status.prompt.md +9 -38
- package/.github/prompts/validate.prompt.md +47 -2
- package/.kilocode/workflows/dev.md +26 -0
- package/.kilocode/workflows/plan.md +48 -5
- package/.kilocode/workflows/premerge.md +0 -3
- package/.kilocode/workflows/rollback.md +4 -4
- package/.kilocode/workflows/ship.md +71 -41
- package/.kilocode/workflows/status.md +9 -38
- package/.kilocode/workflows/validate.md +47 -2
- package/.opencode/commands/dev.md +26 -0
- package/.opencode/commands/plan.md +48 -5
- package/.opencode/commands/premerge.md +0 -3
- package/.opencode/commands/rollback.md +4 -4
- package/.opencode/commands/ship.md +71 -41
- package/.opencode/commands/status.md +9 -38
- package/.opencode/commands/validate.md +47 -2
- package/.roo/commands/dev.md +26 -0
- package/.roo/commands/plan.md +48 -5
- package/.roo/commands/premerge.md +0 -3
- package/.roo/commands/rollback.md +4 -4
- package/.roo/commands/ship.md +71 -41
- package/.roo/commands/status.md +9 -38
- package/.roo/commands/validate.md +47 -2
- package/AGENTS.md +7 -1
- package/CLAUDE.md +5 -4
- package/LICENSE +21 -21
- package/README.md +21 -19
- package/bin/{forge-validate.js → forge-preflight.js} +21 -15
- package/bin/forge.js +209 -138
- package/docs/AGENT_INSTALL_PROMPT.md +1 -1
- package/docs/BEADS_GITHUB_SYNC.md +251 -0
- package/docs/ENHANCED_ONBOARDING.md +6 -6
- package/docs/EXAMPLES.md +4 -4
- package/docs/GREPTILE_SETUP.md +1 -1
- package/docs/MANUAL_REVIEW_GUIDE.md +1 -1
- package/docs/ROADMAP.md +6 -6
- package/docs/SETUP.md +1 -2
- package/docs/VALIDATION.md +11 -11
- package/install.sh +1 -3
- package/lib/agents-config.js +3 -3
- package/lib/detect-agent.js +191 -0
- package/lib/detect-worktree.js +47 -0
- package/lib/file-hash.js +26 -0
- package/lib/setup-action-log.js +139 -0
- package/lib/setup-summary-renderer.js +106 -0
- package/lib/setup.js +75 -1
- package/package.json +3 -4
- package/docs/WORKFLOW.md +0 -400
|
@@ -30,60 +30,97 @@ Do NOT create PR until:
|
|
|
30
30
|
### Step 1: Verify /validate Passed
|
|
31
31
|
Ensure all four validation checks completed successfully with fresh output in this session.
|
|
32
32
|
|
|
33
|
-
### Step 2:
|
|
33
|
+
### Step 2: Freshness Check — Is Branch Still Current?
|
|
34
|
+
|
|
35
|
+
Even though /validate rebased onto the base branch, time may have passed since then (user reviewed design doc, took a break, etc.). This lightweight check catches staleness before pushing.
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
|
|
39
|
+
if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
|
|
40
|
+
git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify freshness"; exit 1; }
|
|
41
|
+
BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- If `BEHIND > 0`: **STOP**. Print: "$BASE has advanced since /validate ($BEHIND new commits). Run /validate again to rebase and re-check."
|
|
45
|
+
- If `BEHIND = 0`: Continue to push.
|
|
46
|
+
- If fetch fails: the `|| { ...; exit 1; }` guard catches this — **STOP**. Do NOT push without confirming freshness.
|
|
47
|
+
|
|
48
|
+
This is NOT a full rebase — just a check. The rebase happens in /validate where the full test suite runs afterward.
|
|
49
|
+
|
|
50
|
+
### Step 3: Update Beads
|
|
34
51
|
```bash
|
|
35
52
|
bd update <id> --status done
|
|
36
53
|
bd sync
|
|
37
54
|
```
|
|
38
55
|
|
|
39
|
-
### Step
|
|
56
|
+
### Step 4: Push Branch
|
|
57
|
+
|
|
58
|
+
Use `--force-with-lease` because `/validate` may have rebased the branch, rewriting history. This is safe: it only forces the push if the remote branch hasn't been updated by someone else since the last fetch.
|
|
59
|
+
|
|
40
60
|
```bash
|
|
41
|
-
git push -u origin <branch-name>
|
|
61
|
+
git push --force-with-lease -u origin <branch-name>
|
|
42
62
|
```
|
|
43
63
|
|
|
44
|
-
### Step
|
|
64
|
+
### Step 5: Create PR
|
|
65
|
+
|
|
66
|
+
Use the narrative PR template below. Lead with WHY (Problem/Root Cause/Fix/Value) — this is what reviewers need to understand first. Keep implementation details (test coverage, security review, design doc) in a collapsible section so they're available but don't clutter the summary.
|
|
67
|
+
|
|
68
|
+
If no Beads issue exists (hotfix, external contribution), skip the "Closes" line.
|
|
45
69
|
|
|
46
70
|
```bash
|
|
47
|
-
gh pr create --title "
|
|
48
|
-
##
|
|
49
|
-
[
|
|
71
|
+
gh pr create --title "<type>: <concise description>" --body "$(cat <<'EOF'
|
|
72
|
+
## Problem
|
|
73
|
+
[What was broken, what need existed, or what user pain this addresses]
|
|
50
74
|
|
|
51
|
-
##
|
|
52
|
-
|
|
75
|
+
## Root Cause
|
|
76
|
+
[Why it happened, why it was missing, or what gap existed]
|
|
53
77
|
|
|
54
|
-
##
|
|
55
|
-
|
|
78
|
+
## Fix
|
|
79
|
+
[What this PR does to solve it — approach, not implementation details]
|
|
80
|
+
|
|
81
|
+
## Value
|
|
82
|
+
[Who benefits, what improves, what risk is removed]
|
|
56
83
|
|
|
57
|
-
## Beads
|
|
84
|
+
## Beads
|
|
58
85
|
Closes: <issue-id>
|
|
59
86
|
|
|
60
|
-
|
|
61
|
-
|
|
87
|
+
<details>
|
|
88
|
+
<summary>Implementation Details</summary>
|
|
62
89
|
|
|
63
|
-
|
|
64
|
-
-
|
|
65
|
-
-
|
|
66
|
-
- E2E tests: [count] tests
|
|
67
|
-
- All tests passing ✓
|
|
90
|
+
### Test Coverage
|
|
91
|
+
- Tests: [count] passing
|
|
92
|
+
- Scenarios covered: [list key scenarios]
|
|
68
93
|
|
|
69
|
-
|
|
70
|
-
- OWASP Top 10:
|
|
71
|
-
-
|
|
72
|
-
- Automated scan: No vulnerabilities
|
|
94
|
+
### Security Review
|
|
95
|
+
- OWASP Top 10: [summary — applicable risks and mitigations]
|
|
96
|
+
- Automated scan: [result]
|
|
73
97
|
|
|
74
|
-
|
|
98
|
+
### Design Doc
|
|
99
|
+
See: docs/plans/YYYY-MM-DD-<slug>-design.md
|
|
100
|
+
|
|
101
|
+
### Decisions Log
|
|
102
|
+
See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose during /dev)
|
|
103
|
+
|
|
104
|
+
### Key Decisions
|
|
105
|
+
[From design doc — 3-5 key decisions with reasoning]
|
|
106
|
+
|
|
107
|
+
### Documentation Updated
|
|
108
|
+
[List docs updated in this PR, or "None — no doc-facing changes"]
|
|
109
|
+
|
|
110
|
+
### Validation
|
|
75
111
|
- [x] Type check passing
|
|
76
|
-
- [x] Lint passing
|
|
77
|
-
- [x]
|
|
78
|
-
- [x] E2E tests passing
|
|
112
|
+
- [x] Lint passing (0 errors, 0 warnings)
|
|
113
|
+
- [x] All tests passing
|
|
79
114
|
- [x] Security review completed
|
|
80
115
|
|
|
116
|
+
</details>
|
|
117
|
+
|
|
81
118
|
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
82
119
|
EOF
|
|
83
120
|
)"
|
|
84
121
|
```
|
|
85
122
|
|
|
86
|
-
### Step
|
|
123
|
+
### Step 6: Record Stage Transition
|
|
87
124
|
```bash
|
|
88
125
|
bash scripts/beads-context.sh stage-transition <id> ship review
|
|
89
126
|
```
|
|
@@ -92,20 +129,13 @@ bash scripts/beads-context.sh stage-transition <id> ship review
|
|
|
92
129
|
|
|
93
130
|
```
|
|
94
131
|
✓ Validation: /validate passed (all 4 checks — fresh output confirmed)
|
|
132
|
+
✓ Freshness: Branch is up-to-date with master
|
|
95
133
|
✓ Beads: Marked done & synced (forge-xyz)
|
|
96
134
|
✓ Pushed: feat/stripe-billing
|
|
97
135
|
✓ PR created: https://github.com/.../pull/123
|
|
136
|
+
- PR body: Problem → Root Cause → Fix → Value (narrative format)
|
|
98
137
|
- Beads linked: forge-xyz
|
|
99
|
-
-
|
|
100
|
-
- Decisions log linked: docs/plans/2026-02-26-stripe-billing-decisions.md
|
|
101
|
-
- Test coverage documented
|
|
102
|
-
- Security review documented
|
|
103
|
-
|
|
104
|
-
PR Summary:
|
|
105
|
-
- 12 commits
|
|
106
|
-
- 18 test cases, all passing
|
|
107
|
-
- OWASP Top 10 security review completed
|
|
108
|
-
- 3 key architectural decisions documented
|
|
138
|
+
- Implementation details in collapsible section
|
|
109
139
|
|
|
110
140
|
⏸️ PR created, awaiting automated checks (Greptile, SonarCloud, GitHub Actions)
|
|
111
141
|
|
|
@@ -127,9 +157,9 @@ Stage 7: /verify → Post-merge CI check on main
|
|
|
127
157
|
|
|
128
158
|
## Tips
|
|
129
159
|
|
|
130
|
-
- **
|
|
131
|
-
- **
|
|
132
|
-
- **Document security**: OWASP Top 10 review in
|
|
160
|
+
- **Lead with why**: Problem → Root Cause → Fix → Value is what reviewers need first
|
|
161
|
+
- **Collapsible details**: Design doc, decisions log, test coverage go in `<details>` — available but not in the way
|
|
162
|
+
- **Document security**: OWASP Top 10 review in collapsible section
|
|
133
163
|
- **Test coverage**: Show all test scenarios passing
|
|
134
164
|
- **Wait for checks**: Let GitHub Actions, Greptile, SonarCloud run
|
|
135
165
|
- **NO auto-merge**: Always wait for /review phase
|
|
@@ -17,60 +17,31 @@ This command helps you understand the current state of the project before starti
|
|
|
17
17
|
|
|
18
18
|
## What This Command Does
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
bd stats
|
|
23
|
-
```
|
|
24
|
-
- How many open / in-progress / completed issues?
|
|
25
|
-
- Any blocked issues?
|
|
20
|
+
## Step 0: Sync team state
|
|
26
21
|
|
|
27
|
-
### Step 2: Check Active Work
|
|
28
22
|
```bash
|
|
29
|
-
#
|
|
30
|
-
|
|
23
|
+
# Sync team state before showing status
|
|
24
|
+
bash scripts/sync-utils.sh auto-sync
|
|
31
25
|
```
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
### Step 1: Smart Status (ranked issues with conflict detection)
|
|
34
28
|
```bash
|
|
35
|
-
bash scripts/
|
|
29
|
+
bash scripts/smart-status.sh
|
|
36
30
|
```
|
|
37
|
-
|
|
31
|
+
This script dynamically computes and displays all issues ranked by composite score (priority, dependency impact, type, staleness, epic proximity). Output includes active sessions, conflict risk annotations, and grouped categories. No manual querying needed — the script handles everything.
|
|
38
32
|
|
|
39
|
-
|
|
33
|
+
For full context on any issue: `bd show <id>`
|
|
40
34
|
|
|
41
|
-
### Step
|
|
35
|
+
### Step 2: Review Recent Commits
|
|
42
36
|
```bash
|
|
43
|
-
# Recent commits
|
|
44
37
|
git log --oneline -10
|
|
45
|
-
|
|
46
|
-
# Recently completed Beads
|
|
47
|
-
bd list --status completed --limit 5
|
|
48
38
|
```
|
|
49
39
|
|
|
50
|
-
### Step
|
|
40
|
+
### Step 3: Determine Context
|
|
51
41
|
- **New feature**: No active work, ready to start fresh
|
|
52
42
|
- **Continuing work**: In-progress issues found, resume where left off
|
|
53
43
|
- **Review needed**: Work marked complete, needs review/merge
|
|
54
44
|
|
|
55
|
-
## Example Output
|
|
56
|
-
|
|
57
|
-
```
|
|
58
|
-
✓ Project Health: 3 open, 1 in-progress, 12 completed
|
|
59
|
-
|
|
60
|
-
Active Work:
|
|
61
|
-
- forge-ctc: Clean up stale workflow refs (in_progress)
|
|
62
|
-
3/7 tasks done | Last: Validation logic (def5678)
|
|
63
|
-
→ bd show forge-ctc for full context
|
|
64
|
-
|
|
65
|
-
Recent Completions:
|
|
66
|
-
- forge-uto: Sync AGENTS.md with agent cleanup (closed 2 days ago)
|
|
67
|
-
- forge-abc: Auth refresh tokens (closed 5 days ago)
|
|
68
|
-
|
|
69
|
-
Context: Continuing work
|
|
70
|
-
|
|
71
|
-
Next: Resume with /dev or /validate (check issue status)
|
|
72
|
-
```
|
|
73
|
-
|
|
74
45
|
## Next Steps
|
|
75
46
|
|
|
76
47
|
- **If starting new work**: Run `/plan <feature-name>`
|
|
@@ -3,6 +3,11 @@ description: Complete validation (type/lint/tests/security)
|
|
|
3
3
|
mode: code
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
+
> **Note:** Three things share the "validate" name in Forge:
|
|
7
|
+
> - `/validate` (this command): Workflow Stage 3 — rebases onto the base branch, then runs type/lint/test/security checks
|
|
8
|
+
> - `forge-preflight` (formerly forge-validate): CLI tool — checks prerequisites before a stage
|
|
9
|
+
> - `bun run check` (scripts/validate.sh): Local quality gate — runs type/lint/test/security checks only (does NOT rebase; assumes branch is already current with the base branch)
|
|
10
|
+
|
|
6
11
|
Run comprehensive validation including type checking, linting, code review, security review, and tests.
|
|
7
12
|
|
|
8
13
|
# Validate
|
|
@@ -15,10 +20,50 @@ This command validates all code before creating a pull request.
|
|
|
15
20
|
/validate
|
|
16
21
|
```
|
|
17
22
|
|
|
18
|
-
Or use the
|
|
23
|
+
Or use the validation script (checks only — no rebase):
|
|
19
24
|
|
|
20
25
|
```bash
|
|
21
|
-
bun run check # Runs
|
|
26
|
+
bun run check # Runs lint/test/security checks only. Does NOT rebase onto the base branch.
|
|
27
|
+
# Use /validate for the full workflow (rebase + checks).
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
```
|
|
31
|
+
<HARD-GATE: /validate entry — rebase onto latest base branch>
|
|
32
|
+
Before running ANY validation checks:
|
|
33
|
+
|
|
34
|
+
0. Resolve the base branch dynamically (do NOT hardcode master or main):
|
|
35
|
+
BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
|
|
36
|
+
if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
|
|
37
|
+
|
|
38
|
+
This handles repos using main, master, or any other default branch.
|
|
39
|
+
Falls back to "master" when HEAD is unresolved (detached remote, empty repo).
|
|
40
|
+
|
|
41
|
+
1. Fetch latest base branch:
|
|
42
|
+
git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify branch freshness"; exit 1; }
|
|
43
|
+
|
|
44
|
+
The `|| { ...; exit 1; }` guard ensures fetch failures are never silently skipped.
|
|
45
|
+
|
|
46
|
+
2. Check if branch is behind:
|
|
47
|
+
BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
|
|
48
|
+
|
|
49
|
+
3. If BEHIND > 0:
|
|
50
|
+
a. Run: git rebase origin/"$BASE" || REBASE_FAILED=1
|
|
51
|
+
b. If rebase succeeds (REBASE_FAILED unset): print "✓ Rebased onto latest $BASE ($BEHIND commits integrated)"
|
|
52
|
+
c. If rebase fails (REBASE_FAILED=1 — conflicts or any other error):
|
|
53
|
+
- Capture conflicting files BEFORE aborting: git diff --name-only --diff-filter=U
|
|
54
|
+
- Run: git rebase --abort
|
|
55
|
+
- Print the captured conflicting file list
|
|
56
|
+
- Print: "✗ Rebase conflict — resolve manually, then re-run /validate"
|
|
57
|
+
- STOP. Do NOT proceed to any validation checks.
|
|
58
|
+
|
|
59
|
+
4. If BEHIND = 0:
|
|
60
|
+
Print "✓ Branch is up-to-date with $BASE" and continue.
|
|
61
|
+
|
|
62
|
+
Rationale: Without this step, validation checks run against stale code that doesn't
|
|
63
|
+
include recent base branch changes. Integration issues are only caught after the PR is
|
|
64
|
+
created, wasting CI cycles and review time. Rebasing here ensures /validate results
|
|
65
|
+
reflect the true state of what will be merged.
|
|
66
|
+
</HARD-GATE>
|
|
22
67
|
```
|
|
23
68
|
|
|
24
69
|
## What This Command Does
|
|
@@ -63,6 +63,32 @@ Do NOT write any code until ALL confirmed:
|
|
|
63
63
|
|
|
64
64
|
---
|
|
65
65
|
|
|
66
|
+
|
|
67
|
+
### Multi-developer conflict check (soft block)
|
|
68
|
+
|
|
69
|
+
Before starting the per-task loop, check for cross-developer conflicts:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
# Auto-sync to get latest team state
|
|
73
|
+
bash scripts/sync-utils.sh auto-sync
|
|
74
|
+
|
|
75
|
+
# Check for conflicts with the current beads issue
|
|
76
|
+
bash scripts/conflict-detect.sh --issue <beads-id>
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
If exit code 2 (validation error): show error message, abort — do not show conflict prompt.
|
|
80
|
+
|
|
81
|
+
If exit code 1 (conflicts found):
|
|
82
|
+
- Display the conflict output to the developer
|
|
83
|
+
- Ask: "Other developers are working in overlapping areas. Proceed anyway? (y/n)"
|
|
84
|
+
- If `n`: exit cleanly, no side effects
|
|
85
|
+
- If `y`: log override via `bd comments add <id> "Conflict override: proceeding despite overlap with <conflicting-issues>"`, then continue to Per-Task Loop
|
|
86
|
+
- Audit: record conflict override per OWASP A09
|
|
87
|
+
|
|
88
|
+
If exit code 0: proceed silently to Per-Task Loop.
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
66
92
|
## Per-Task Loop
|
|
67
93
|
|
|
68
94
|
Repeat for each task in the task list, in order:
|
|
@@ -23,7 +23,13 @@ Before ANY planning work begins:
|
|
|
23
23
|
a. bd worktree create .worktrees/<slug> --branch feat/<slug>
|
|
24
24
|
b. cd .worktrees/<slug>
|
|
25
25
|
4. Confirm: "Working in isolated worktree: .worktrees/<slug> (branch: feat/<slug>)"
|
|
26
|
-
5.
|
|
26
|
+
5. Create the epic issue and record the stage transition:
|
|
27
|
+
```bash
|
|
28
|
+
bd create --title="<feature-name>" --type=epic
|
|
29
|
+
bd update <id> --status=in_progress
|
|
30
|
+
bash scripts/beads-context.sh stage-transition <id> none plan
|
|
31
|
+
```
|
|
32
|
+
6. ONLY THEN begin Phase 1.
|
|
27
33
|
|
|
28
34
|
Rationale: Planning commits (design docs, task lists) belong only to this feature's branch.
|
|
29
35
|
If planning runs in the main directory on a non-master branch, those commits contaminate
|
|
@@ -44,6 +50,32 @@ between parallel features or sessions.
|
|
|
44
50
|
|
|
45
51
|
---
|
|
46
52
|
|
|
53
|
+
|
|
54
|
+
### Multi-developer conflict check (soft block)
|
|
55
|
+
|
|
56
|
+
Before proceeding to Phase 1, check for cross-developer conflicts:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
# Auto-sync to get latest team state
|
|
60
|
+
bash scripts/sync-utils.sh auto-sync
|
|
61
|
+
|
|
62
|
+
# Check for conflicts with this issue's planned work area
|
|
63
|
+
bash scripts/conflict-detect.sh --issue <beads-id>
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If exit code 2 (validation error): show error message, abort — do not show conflict prompt.
|
|
67
|
+
|
|
68
|
+
If exit code 1 (conflicts found):
|
|
69
|
+
- Display the conflict output to the developer
|
|
70
|
+
- Ask: "Other developers are working in overlapping areas. Proceed anyway? (y/n)"
|
|
71
|
+
- If `n`: exit cleanly, no side effects
|
|
72
|
+
- If `y`: log override via `bd comments add <id> "Conflict override: proceeding despite overlap with <conflicting-issues>"`, then continue to Phase 1
|
|
73
|
+
- Audit: record conflict override per OWASP A09
|
|
74
|
+
|
|
75
|
+
If exit code 0: proceed silently to Phase 1.
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
47
79
|
## Phase 1: Design Intent (Brainstorming)
|
|
48
80
|
|
|
49
81
|
**Goal**: Capture WHAT to build — purpose, constraints, success criteria, edge cases, approach.
|
|
@@ -181,6 +213,11 @@ Do NOT begin Phase 2 (web research) until:
|
|
|
181
213
|
|
|
182
214
|
**Goal**: Find HOW to build it — best practices, known issues, security risks, TDD scenarios.
|
|
183
215
|
|
|
216
|
+
Record the phase transition before starting research:
|
|
217
|
+
```bash
|
|
218
|
+
bash scripts/beads-context.sh stage-transition <id> plan research
|
|
219
|
+
```
|
|
220
|
+
|
|
184
221
|
Run these in parallel:
|
|
185
222
|
|
|
186
223
|
### Web research (parallel-deep-research skill)
|
|
@@ -271,13 +308,19 @@ Do NOT begin Phase 3 (setup) until:
|
|
|
271
308
|
|
|
272
309
|
## Phase 3: Setup + Task List
|
|
273
310
|
|
|
274
|
-
**Goal**: Create branch, worktree,
|
|
311
|
+
**Goal**: Create branch, worktree, and a complete task list ready for /dev.
|
|
312
|
+
|
|
313
|
+
Record the phase transition before starting setup:
|
|
314
|
+
```bash
|
|
315
|
+
bash scripts/beads-context.sh stage-transition <id> research setup
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
### Step 1: Link child issues to the epic
|
|
275
319
|
|
|
276
|
-
|
|
320
|
+
The epic was created in the Entry HARD-GATE (Phase 1 entry). If this feature requires child issues (sub-tasks tracked separately), create them now and link to the epic:
|
|
277
321
|
|
|
278
322
|
```bash
|
|
279
|
-
bd create --title="<
|
|
280
|
-
bd update <id> --status=in_progress
|
|
323
|
+
bd create --title="<sub-task-name>" --type=feature --parent=<epic-id>
|
|
281
324
|
```
|
|
282
325
|
|
|
283
326
|
### Step 2: Branch + worktree
|
|
@@ -82,9 +82,6 @@ Check each of the following and update if the feature affects it. Be selective
|
|
|
82
82
|
**F. `AGENTS.md`** (if agent config, skills, or cross-agent workflow changed):
|
|
83
83
|
- Update relevant sections describing agent capabilities or workflow
|
|
84
84
|
|
|
85
|
-
**G. `docs/WORKFLOW.md`** (if the workflow itself changed):
|
|
86
|
-
- Update stage descriptions or workflow tables
|
|
87
|
-
|
|
88
85
|
**Commit doc updates to feature branch**:
|
|
89
86
|
|
|
90
87
|
```bash
|
|
@@ -186,18 +186,18 @@ git commit -m "Rollback: <files>"
|
|
|
186
186
|
```bash
|
|
187
187
|
bunx forge rollback
|
|
188
188
|
# Select: 4. Rollback specific files
|
|
189
|
-
# Enter: AGENTS.md,
|
|
189
|
+
# Enter: AGENTS.md,CLAUDE.md
|
|
190
190
|
|
|
191
191
|
✓ Validating file paths...
|
|
192
192
|
✓ Working directory is clean
|
|
193
193
|
✓ Extracting USER sections...
|
|
194
|
-
✓ Executing: git checkout HEAD~1 -- AGENTS.md
|
|
194
|
+
✓ Executing: git checkout HEAD~1 -- AGENTS.md CLAUDE.md
|
|
195
195
|
✓ Committing changes...
|
|
196
196
|
✓ Restoring USER sections...
|
|
197
197
|
✓ Amended commit to preserve USER content
|
|
198
198
|
|
|
199
199
|
Rollback complete!
|
|
200
|
-
Commit: q4r5s6t "Rollback: AGENTS.md,
|
|
200
|
+
Commit: q4r5s6t "Rollback: AGENTS.md, CLAUDE.md"
|
|
201
201
|
Files affected: 2
|
|
202
202
|
```
|
|
203
203
|
|
|
@@ -717,5 +717,5 @@ bunx forge rollback
|
|
|
717
717
|
|
|
718
718
|
- [/dev](.claude/commands/dev.md) - TDD development workflow
|
|
719
719
|
- [/validate](.claude/commands/validate.md) - Validation before shipping
|
|
720
|
-
- [
|
|
720
|
+
- [AGENTS.md](../../AGENTS.md) - Complete workflow guide
|
|
721
721
|
- [Beads](https://github.com/beadshq/beads) - Issue tracking integration
|
|
@@ -29,60 +29,97 @@ Do NOT create PR until:
|
|
|
29
29
|
### Step 1: Verify /validate Passed
|
|
30
30
|
Ensure all four validation checks completed successfully with fresh output in this session.
|
|
31
31
|
|
|
32
|
-
### Step 2:
|
|
32
|
+
### Step 2: Freshness Check — Is Branch Still Current?
|
|
33
|
+
|
|
34
|
+
Even though /validate rebased onto the base branch, time may have passed since then (user reviewed design doc, took a break, etc.). This lightweight check catches staleness before pushing.
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
|
|
38
|
+
if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
|
|
39
|
+
git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify freshness"; exit 1; }
|
|
40
|
+
BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
- If `BEHIND > 0`: **STOP**. Print: "$BASE has advanced since /validate ($BEHIND new commits). Run /validate again to rebase and re-check."
|
|
44
|
+
- If `BEHIND = 0`: Continue to push.
|
|
45
|
+
- If fetch fails: the `|| { ...; exit 1; }` guard catches this — **STOP**. Do NOT push without confirming freshness.
|
|
46
|
+
|
|
47
|
+
This is NOT a full rebase — just a check. The rebase happens in /validate where the full test suite runs afterward.
|
|
48
|
+
|
|
49
|
+
### Step 3: Update Beads
|
|
33
50
|
```bash
|
|
34
51
|
bd update <id> --status done
|
|
35
52
|
bd sync
|
|
36
53
|
```
|
|
37
54
|
|
|
38
|
-
### Step
|
|
55
|
+
### Step 4: Push Branch
|
|
56
|
+
|
|
57
|
+
Use `--force-with-lease` because `/validate` may have rebased the branch, rewriting history. This is safe: it only forces the push if the remote branch hasn't been updated by someone else since the last fetch.
|
|
58
|
+
|
|
39
59
|
```bash
|
|
40
|
-
git push -u origin <branch-name>
|
|
60
|
+
git push --force-with-lease -u origin <branch-name>
|
|
41
61
|
```
|
|
42
62
|
|
|
43
|
-
### Step
|
|
63
|
+
### Step 5: Create PR
|
|
64
|
+
|
|
65
|
+
Use the narrative PR template below. Lead with WHY (Problem/Root Cause/Fix/Value) — this is what reviewers need to understand first. Keep implementation details (test coverage, security review, design doc) in a collapsible section so they're available but don't clutter the summary.
|
|
66
|
+
|
|
67
|
+
If no Beads issue exists (hotfix, external contribution), skip the "Closes" line.
|
|
44
68
|
|
|
45
69
|
```bash
|
|
46
|
-
gh pr create --title "
|
|
47
|
-
##
|
|
48
|
-
[
|
|
70
|
+
gh pr create --title "<type>: <concise description>" --body "$(cat <<'EOF'
|
|
71
|
+
## Problem
|
|
72
|
+
[What was broken, what need existed, or what user pain this addresses]
|
|
49
73
|
|
|
50
|
-
##
|
|
51
|
-
|
|
74
|
+
## Root Cause
|
|
75
|
+
[Why it happened, why it was missing, or what gap existed]
|
|
52
76
|
|
|
53
|
-
##
|
|
54
|
-
|
|
77
|
+
## Fix
|
|
78
|
+
[What this PR does to solve it — approach, not implementation details]
|
|
79
|
+
|
|
80
|
+
## Value
|
|
81
|
+
[Who benefits, what improves, what risk is removed]
|
|
55
82
|
|
|
56
|
-
## Beads
|
|
83
|
+
## Beads
|
|
57
84
|
Closes: <issue-id>
|
|
58
85
|
|
|
59
|
-
|
|
60
|
-
|
|
86
|
+
<details>
|
|
87
|
+
<summary>Implementation Details</summary>
|
|
61
88
|
|
|
62
|
-
|
|
63
|
-
-
|
|
64
|
-
-
|
|
65
|
-
- E2E tests: [count] tests
|
|
66
|
-
- All tests passing ✓
|
|
89
|
+
### Test Coverage
|
|
90
|
+
- Tests: [count] passing
|
|
91
|
+
- Scenarios covered: [list key scenarios]
|
|
67
92
|
|
|
68
|
-
|
|
69
|
-
- OWASP Top 10:
|
|
70
|
-
-
|
|
71
|
-
- Automated scan: No vulnerabilities
|
|
93
|
+
### Security Review
|
|
94
|
+
- OWASP Top 10: [summary — applicable risks and mitigations]
|
|
95
|
+
- Automated scan: [result]
|
|
72
96
|
|
|
73
|
-
|
|
97
|
+
### Design Doc
|
|
98
|
+
See: docs/plans/YYYY-MM-DD-<slug>-design.md
|
|
99
|
+
|
|
100
|
+
### Decisions Log
|
|
101
|
+
See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose during /dev)
|
|
102
|
+
|
|
103
|
+
### Key Decisions
|
|
104
|
+
[From design doc — 3-5 key decisions with reasoning]
|
|
105
|
+
|
|
106
|
+
### Documentation Updated
|
|
107
|
+
[List docs updated in this PR, or "None — no doc-facing changes"]
|
|
108
|
+
|
|
109
|
+
### Validation
|
|
74
110
|
- [x] Type check passing
|
|
75
|
-
- [x] Lint passing
|
|
76
|
-
- [x]
|
|
77
|
-
- [x] E2E tests passing
|
|
111
|
+
- [x] Lint passing (0 errors, 0 warnings)
|
|
112
|
+
- [x] All tests passing
|
|
78
113
|
- [x] Security review completed
|
|
79
114
|
|
|
115
|
+
</details>
|
|
116
|
+
|
|
80
117
|
🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
|
81
118
|
EOF
|
|
82
119
|
)"
|
|
83
120
|
```
|
|
84
121
|
|
|
85
|
-
### Step
|
|
122
|
+
### Step 6: Record Stage Transition
|
|
86
123
|
```bash
|
|
87
124
|
bash scripts/beads-context.sh stage-transition <id> ship review
|
|
88
125
|
```
|
|
@@ -91,20 +128,13 @@ bash scripts/beads-context.sh stage-transition <id> ship review
|
|
|
91
128
|
|
|
92
129
|
```
|
|
93
130
|
✓ Validation: /validate passed (all 4 checks — fresh output confirmed)
|
|
131
|
+
✓ Freshness: Branch is up-to-date with master
|
|
94
132
|
✓ Beads: Marked done & synced (forge-xyz)
|
|
95
133
|
✓ Pushed: feat/stripe-billing
|
|
96
134
|
✓ PR created: https://github.com/.../pull/123
|
|
135
|
+
- PR body: Problem → Root Cause → Fix → Value (narrative format)
|
|
97
136
|
- Beads linked: forge-xyz
|
|
98
|
-
-
|
|
99
|
-
- Decisions log linked: docs/plans/2026-02-26-stripe-billing-decisions.md
|
|
100
|
-
- Test coverage documented
|
|
101
|
-
- Security review documented
|
|
102
|
-
|
|
103
|
-
PR Summary:
|
|
104
|
-
- 12 commits
|
|
105
|
-
- 18 test cases, all passing
|
|
106
|
-
- OWASP Top 10 security review completed
|
|
107
|
-
- 3 key architectural decisions documented
|
|
137
|
+
- Implementation details in collapsible section
|
|
108
138
|
|
|
109
139
|
⏸️ PR created, awaiting automated checks (Greptile, SonarCloud, GitHub Actions)
|
|
110
140
|
|
|
@@ -126,9 +156,9 @@ Stage 7: /verify → Post-merge CI check on main
|
|
|
126
156
|
|
|
127
157
|
## Tips
|
|
128
158
|
|
|
129
|
-
- **
|
|
130
|
-
- **
|
|
131
|
-
- **Document security**: OWASP Top 10 review in
|
|
159
|
+
- **Lead with why**: Problem → Root Cause → Fix → Value is what reviewers need first
|
|
160
|
+
- **Collapsible details**: Design doc, decisions log, test coverage go in `<details>` — available but not in the way
|
|
161
|
+
- **Document security**: OWASP Top 10 review in collapsible section
|
|
132
162
|
- **Test coverage**: Show all test scenarios passing
|
|
133
163
|
- **Wait for checks**: Let GitHub Actions, Greptile, SonarCloud run
|
|
134
164
|
- **NO auto-merge**: Always wait for /review phase
|