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
|
@@ -16,60 +16,31 @@ This command helps you understand the current state of the project before starti
|
|
|
16
16
|
|
|
17
17
|
## What This Command Does
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
```bash
|
|
21
|
-
bd stats
|
|
22
|
-
```
|
|
23
|
-
- How many open / in-progress / completed issues?
|
|
24
|
-
- Any blocked issues?
|
|
19
|
+
## Step 0: Sync team state
|
|
25
20
|
|
|
26
|
-
### Step 2: Check Active Work
|
|
27
21
|
```bash
|
|
28
|
-
#
|
|
29
|
-
|
|
22
|
+
# Sync team state before showing status
|
|
23
|
+
bash scripts/sync-utils.sh auto-sync
|
|
30
24
|
```
|
|
31
25
|
|
|
32
|
-
|
|
26
|
+
### Step 1: Smart Status (ranked issues with conflict detection)
|
|
33
27
|
```bash
|
|
34
|
-
bash scripts/
|
|
28
|
+
bash scripts/smart-status.sh
|
|
35
29
|
```
|
|
36
|
-
|
|
30
|
+
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.
|
|
37
31
|
|
|
38
|
-
|
|
32
|
+
For full context on any issue: `bd show <id>`
|
|
39
33
|
|
|
40
|
-
### Step
|
|
34
|
+
### Step 2: Review Recent Commits
|
|
41
35
|
```bash
|
|
42
|
-
# Recent commits
|
|
43
36
|
git log --oneline -10
|
|
44
|
-
|
|
45
|
-
# Recently completed Beads
|
|
46
|
-
bd list --status completed --limit 5
|
|
47
37
|
```
|
|
48
38
|
|
|
49
|
-
### Step
|
|
39
|
+
### Step 3: Determine Context
|
|
50
40
|
- **New feature**: No active work, ready to start fresh
|
|
51
41
|
- **Continuing work**: In-progress issues found, resume where left off
|
|
52
42
|
- **Review needed**: Work marked complete, needs review/merge
|
|
53
43
|
|
|
54
|
-
## Example Output
|
|
55
|
-
|
|
56
|
-
```
|
|
57
|
-
✓ Project Health: 3 open, 1 in-progress, 12 completed
|
|
58
|
-
|
|
59
|
-
Active Work:
|
|
60
|
-
- forge-ctc: Clean up stale workflow refs (in_progress)
|
|
61
|
-
3/7 tasks done | Last: Validation logic (def5678)
|
|
62
|
-
→ bd show forge-ctc for full context
|
|
63
|
-
|
|
64
|
-
Recent Completions:
|
|
65
|
-
- forge-uto: Sync AGENTS.md with agent cleanup (closed 2 days ago)
|
|
66
|
-
- forge-abc: Auth refresh tokens (closed 5 days ago)
|
|
67
|
-
|
|
68
|
-
Context: Continuing work
|
|
69
|
-
|
|
70
|
-
Next: Resume with /dev or /validate (check issue status)
|
|
71
|
-
```
|
|
72
|
-
|
|
73
44
|
## Next Steps
|
|
74
45
|
|
|
75
46
|
- **If starting new work**: Run `/plan <feature-name>`
|
|
@@ -2,6 +2,11 @@
|
|
|
2
2
|
description: Complete validation (type/lint/tests/security)
|
|
3
3
|
---
|
|
4
4
|
|
|
5
|
+
> **Note:** Three things share the "validate" name in Forge:
|
|
6
|
+
> - `/validate` (this command): Workflow Stage 3 — rebases onto the base branch, then runs type/lint/test/security checks
|
|
7
|
+
> - `forge-preflight` (formerly forge-validate): CLI tool — checks prerequisites before a stage
|
|
8
|
+
> - `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)
|
|
9
|
+
|
|
5
10
|
Run comprehensive validation including type checking, linting, code review, security review, and tests.
|
|
6
11
|
|
|
7
12
|
# Validate
|
|
@@ -14,10 +19,50 @@ This command validates all code before creating a pull request.
|
|
|
14
19
|
/validate
|
|
15
20
|
```
|
|
16
21
|
|
|
17
|
-
Or use the
|
|
22
|
+
Or use the validation script (checks only — no rebase):
|
|
18
23
|
|
|
19
24
|
```bash
|
|
20
|
-
bun run check # Runs
|
|
25
|
+
bun run check # Runs lint/test/security checks only. Does NOT rebase onto the base branch.
|
|
26
|
+
# Use /validate for the full workflow (rebase + checks).
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
<HARD-GATE: /validate entry — rebase onto latest base branch>
|
|
31
|
+
Before running ANY validation checks:
|
|
32
|
+
|
|
33
|
+
0. Resolve the base branch dynamically (do NOT hardcode master or main):
|
|
34
|
+
BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
|
|
35
|
+
if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
|
|
36
|
+
|
|
37
|
+
This handles repos using main, master, or any other default branch.
|
|
38
|
+
Falls back to "master" when HEAD is unresolved (detached remote, empty repo).
|
|
39
|
+
|
|
40
|
+
1. Fetch latest base branch:
|
|
41
|
+
git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify branch freshness"; exit 1; }
|
|
42
|
+
|
|
43
|
+
The `|| { ...; exit 1; }` guard ensures fetch failures are never silently skipped.
|
|
44
|
+
|
|
45
|
+
2. Check if branch is behind:
|
|
46
|
+
BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
|
|
47
|
+
|
|
48
|
+
3. If BEHIND > 0:
|
|
49
|
+
a. Run: git rebase origin/"$BASE" || REBASE_FAILED=1
|
|
50
|
+
b. If rebase succeeds (REBASE_FAILED unset): print "✓ Rebased onto latest $BASE ($BEHIND commits integrated)"
|
|
51
|
+
c. If rebase fails (REBASE_FAILED=1 — conflicts or any other error):
|
|
52
|
+
- Capture conflicting files BEFORE aborting: git diff --name-only --diff-filter=U
|
|
53
|
+
- Run: git rebase --abort
|
|
54
|
+
- Print the captured conflicting file list
|
|
55
|
+
- Print: "✗ Rebase conflict — resolve manually, then re-run /validate"
|
|
56
|
+
- STOP. Do NOT proceed to any validation checks.
|
|
57
|
+
|
|
58
|
+
4. If BEHIND = 0:
|
|
59
|
+
Print "✓ Branch is up-to-date with $BASE" and continue.
|
|
60
|
+
|
|
61
|
+
Rationale: Without this step, validation checks run against stale code that doesn't
|
|
62
|
+
include recent base branch changes. Integration issues are only caught after the PR is
|
|
63
|
+
created, wasting CI cycles and review time. Rebasing here ensures /validate results
|
|
64
|
+
reflect the true state of what will be merged.
|
|
65
|
+
</HARD-GATE>
|
|
21
66
|
```
|
|
22
67
|
|
|
23
68
|
## What This Command Does
|
package/.roo/commands/dev.md
CHANGED
|
@@ -64,6 +64,32 @@ Do NOT write any code until ALL confirmed:
|
|
|
64
64
|
|
|
65
65
|
---
|
|
66
66
|
|
|
67
|
+
|
|
68
|
+
### Multi-developer conflict check (soft block)
|
|
69
|
+
|
|
70
|
+
Before starting the per-task loop, check for cross-developer conflicts:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
# Auto-sync to get latest team state
|
|
74
|
+
bash scripts/sync-utils.sh auto-sync
|
|
75
|
+
|
|
76
|
+
# Check for conflicts with the current beads issue
|
|
77
|
+
bash scripts/conflict-detect.sh --issue <beads-id>
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
If exit code 2 (validation error): show error message, abort — do not show conflict prompt.
|
|
81
|
+
|
|
82
|
+
If exit code 1 (conflicts found):
|
|
83
|
+
- Display the conflict output to the developer
|
|
84
|
+
- Ask: "Other developers are working in overlapping areas. Proceed anyway? (y/n)"
|
|
85
|
+
- If `n`: exit cleanly, no side effects
|
|
86
|
+
- If `y`: log override via `bd comments add <id> "Conflict override: proceeding despite overlap with <conflicting-issues>"`, then continue to Per-Task Loop
|
|
87
|
+
- Audit: record conflict override per OWASP A09
|
|
88
|
+
|
|
89
|
+
If exit code 0: proceed silently to Per-Task Loop.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
67
93
|
## Per-Task Loop
|
|
68
94
|
|
|
69
95
|
Repeat for each task in the task list, in order:
|
package/.roo/commands/plan.md
CHANGED
|
@@ -24,7 +24,13 @@ Before ANY planning work begins:
|
|
|
24
24
|
a. bd worktree create .worktrees/<slug> --branch feat/<slug>
|
|
25
25
|
b. cd .worktrees/<slug>
|
|
26
26
|
4. Confirm: "Working in isolated worktree: .worktrees/<slug> (branch: feat/<slug>)"
|
|
27
|
-
5.
|
|
27
|
+
5. Create the epic issue and record the stage transition:
|
|
28
|
+
```bash
|
|
29
|
+
bd create --title="<feature-name>" --type=epic
|
|
30
|
+
bd update <id> --status=in_progress
|
|
31
|
+
bash scripts/beads-context.sh stage-transition <id> none plan
|
|
32
|
+
```
|
|
33
|
+
6. ONLY THEN begin Phase 1.
|
|
28
34
|
|
|
29
35
|
Rationale: Planning commits (design docs, task lists) belong only to this feature's branch.
|
|
30
36
|
If planning runs in the main directory on a non-master branch, those commits contaminate
|
|
@@ -45,6 +51,32 @@ between parallel features or sessions.
|
|
|
45
51
|
|
|
46
52
|
---
|
|
47
53
|
|
|
54
|
+
|
|
55
|
+
### Multi-developer conflict check (soft block)
|
|
56
|
+
|
|
57
|
+
Before proceeding to Phase 1, check for cross-developer conflicts:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
# Auto-sync to get latest team state
|
|
61
|
+
bash scripts/sync-utils.sh auto-sync
|
|
62
|
+
|
|
63
|
+
# Check for conflicts with this issue's planned work area
|
|
64
|
+
bash scripts/conflict-detect.sh --issue <beads-id>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
If exit code 2 (validation error): show error message, abort — do not show conflict prompt.
|
|
68
|
+
|
|
69
|
+
If exit code 1 (conflicts found):
|
|
70
|
+
- Display the conflict output to the developer
|
|
71
|
+
- Ask: "Other developers are working in overlapping areas. Proceed anyway? (y/n)"
|
|
72
|
+
- If `n`: exit cleanly, no side effects
|
|
73
|
+
- If `y`: log override via `bd comments add <id> "Conflict override: proceeding despite overlap with <conflicting-issues>"`, then continue to Phase 1
|
|
74
|
+
- Audit: record conflict override per OWASP A09
|
|
75
|
+
|
|
76
|
+
If exit code 0: proceed silently to Phase 1.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
48
80
|
## Phase 1: Design Intent (Brainstorming)
|
|
49
81
|
|
|
50
82
|
**Goal**: Capture WHAT to build — purpose, constraints, success criteria, edge cases, approach.
|
|
@@ -182,6 +214,11 @@ Do NOT begin Phase 2 (web research) until:
|
|
|
182
214
|
|
|
183
215
|
**Goal**: Find HOW to build it — best practices, known issues, security risks, TDD scenarios.
|
|
184
216
|
|
|
217
|
+
Record the phase transition before starting research:
|
|
218
|
+
```bash
|
|
219
|
+
bash scripts/beads-context.sh stage-transition <id> plan research
|
|
220
|
+
```
|
|
221
|
+
|
|
185
222
|
Run these in parallel:
|
|
186
223
|
|
|
187
224
|
### Web research (parallel-deep-research skill)
|
|
@@ -272,13 +309,19 @@ Do NOT begin Phase 3 (setup) until:
|
|
|
272
309
|
|
|
273
310
|
## Phase 3: Setup + Task List
|
|
274
311
|
|
|
275
|
-
**Goal**: Create branch, worktree,
|
|
312
|
+
**Goal**: Create branch, worktree, and a complete task list ready for /dev.
|
|
313
|
+
|
|
314
|
+
Record the phase transition before starting setup:
|
|
315
|
+
```bash
|
|
316
|
+
bash scripts/beads-context.sh stage-transition <id> research setup
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### Step 1: Link child issues to the epic
|
|
276
320
|
|
|
277
|
-
|
|
321
|
+
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:
|
|
278
322
|
|
|
279
323
|
```bash
|
|
280
|
-
bd create --title="<
|
|
281
|
-
bd update <id> --status=in_progress
|
|
324
|
+
bd create --title="<sub-task-name>" --type=feature --parent=<epic-id>
|
|
282
325
|
```
|
|
283
326
|
|
|
284
327
|
### Step 2: Branch + worktree
|
|
@@ -83,9 +83,6 @@ Check each of the following and update if the feature affects it. Be selective
|
|
|
83
83
|
**F. `AGENTS.md`** (if agent config, skills, or cross-agent workflow changed):
|
|
84
84
|
- Update relevant sections describing agent capabilities or workflow
|
|
85
85
|
|
|
86
|
-
**G. `docs/WORKFLOW.md`** (if the workflow itself changed):
|
|
87
|
-
- Update stage descriptions or workflow tables
|
|
88
|
-
|
|
89
86
|
**Commit doc updates to feature branch**:
|
|
90
87
|
|
|
91
88
|
```bash
|
|
@@ -187,18 +187,18 @@ git commit -m "Rollback: <files>"
|
|
|
187
187
|
```bash
|
|
188
188
|
bunx forge rollback
|
|
189
189
|
# Select: 4. Rollback specific files
|
|
190
|
-
# Enter: AGENTS.md,
|
|
190
|
+
# Enter: AGENTS.md,CLAUDE.md
|
|
191
191
|
|
|
192
192
|
✓ Validating file paths...
|
|
193
193
|
✓ Working directory is clean
|
|
194
194
|
✓ Extracting USER sections...
|
|
195
|
-
✓ Executing: git checkout HEAD~1 -- AGENTS.md
|
|
195
|
+
✓ Executing: git checkout HEAD~1 -- AGENTS.md CLAUDE.md
|
|
196
196
|
✓ Committing changes...
|
|
197
197
|
✓ Restoring USER sections...
|
|
198
198
|
✓ Amended commit to preserve USER content
|
|
199
199
|
|
|
200
200
|
Rollback complete!
|
|
201
|
-
Commit: q4r5s6t "Rollback: AGENTS.md,
|
|
201
|
+
Commit: q4r5s6t "Rollback: AGENTS.md, CLAUDE.md"
|
|
202
202
|
Files affected: 2
|
|
203
203
|
```
|
|
204
204
|
|
|
@@ -718,5 +718,5 @@ bunx forge rollback
|
|
|
718
718
|
|
|
719
719
|
- [/dev](.claude/commands/dev.md) - TDD development workflow
|
|
720
720
|
- [/validate](.claude/commands/validate.md) - Validation before shipping
|
|
721
|
-
- [
|
|
721
|
+
- [AGENTS.md](../../AGENTS.md) - Complete workflow guide
|
|
722
722
|
- [Beads](https://github.com/beadshq/beads) - Issue tracking integration
|
package/.roo/commands/ship.md
CHANGED
|
@@ -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
|
package/.roo/commands/status.md
CHANGED
|
@@ -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
|
package/AGENTS.md
CHANGED
|
@@ -71,6 +71,10 @@ When the user requests work, **you MUST automatically classify** the change type
|
|
|
71
71
|
|
|
72
72
|
Proceed?"
|
|
73
73
|
|
|
74
|
+
**Dynamic commands — no hardcoded examples:**
|
|
75
|
+
|
|
76
|
+
Command files (`.claude/commands/*.md` and agent equivalents) must never hardcode example output when a script generates that output dynamically. Reference the script and describe what it does — don't duplicate its output with fake data that becomes stale.
|
|
77
|
+
|
|
74
78
|
## TDD Development (Stage 2: /dev)
|
|
75
79
|
|
|
76
80
|
**Subagent-driven per-task implementation loop:**
|
|
@@ -108,6 +112,8 @@ Task 2: Validation logic
|
|
|
108
112
|
|
|
109
113
|
## State Management (Single Source of Truth)
|
|
110
114
|
|
|
115
|
+
> GitHub issue lifecycle may sync to Beads via CI -- see [docs/BEADS_GITHUB_SYNC.md](docs/BEADS_GITHUB_SYNC.md).
|
|
116
|
+
|
|
111
117
|
**All workflow state stored in Beads metadata** (survives compaction):
|
|
112
118
|
|
|
113
119
|
```json
|
|
@@ -162,7 +168,7 @@ Task 2: Validation logic
|
|
|
162
168
|
- `docs/plans/YYYY-MM-DD-<slug>-decisions.md` - Decisions log from /dev
|
|
163
169
|
|
|
164
170
|
**Comprehensive workflow guide:**
|
|
165
|
-
-
|
|
171
|
+
- This file (AGENTS.md) is the single source of truth for the complete workflow
|
|
166
172
|
- [docs/TOOLCHAIN.md](docs/TOOLCHAIN.md) - Tool setup and configuration
|
|
167
173
|
- [docs/VALIDATION.md](docs/VALIDATION.md) - Enforcement and validation details
|
|
168
174
|
|
package/CLAUDE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Project Instructions
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Forge is a 7-stage TDD-first development workflow harness for AI coding agents (9 commands total, including utility stages).
|
|
4
4
|
|
|
5
5
|
**Package manager**: Bun (preferred for performance)
|
|
6
6
|
|
|
@@ -72,13 +72,13 @@ This project uses the **Professional Git Workflow** with Lefthook for automated
|
|
|
72
72
|
- **All review comments must be resolved** before merge
|
|
73
73
|
- Squash-only merging: Clean, linear git history
|
|
74
74
|
|
|
75
|
-
**Emergency bypass
|
|
75
|
+
**Emergency bypass** (human-only, NEVER for AI agents):
|
|
76
76
|
```bash
|
|
77
77
|
LEFTHOOK=0 git push # Skip all pre-push hooks
|
|
78
78
|
git commit --no-verify # Skip pre-commit hooks
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
**⚠️
|
|
81
|
+
**⚠️ AI agents must NEVER use `LEFTHOOK=0`, `--no-verify`, or any hook bypass.** If a hook fails, fix the underlying issue. Only humans may bypass hooks in emergencies, documented in the PR description.
|
|
82
82
|
|
|
83
83
|
See [.github/pull_request_template.md](.github/pull_request_template.md) for PR guidelines.
|
|
84
84
|
|
|
@@ -93,7 +93,8 @@ As you work, when you give the same instruction twice, add it here:
|
|
|
93
93
|
- **Scope discipline**: Do ONLY what was explicitly asked. Answer a question → stop. Check something → stop. Never auto-continue to next steps or pending work unless told to.
|
|
94
94
|
- **Stage names**: The validation stage is `/validate` (not `/check`) — renamed in PR #50.
|
|
95
95
|
- **Unused params**: Prefix with `_` (e.g., `_searchTerm`) — ESLint `no-unused-vars` enforced with `--max-warnings 0`.
|
|
96
|
-
- **Pre-push test env**: `test-env/` fixture tests can fail during actual `git push` due to git mid-push state
|
|
96
|
+
- **Pre-push test env**: `test-env/` fixture tests can fail during actual `git push` due to git mid-push state. Fix the root cause — never use `LEFTHOOK=0`.
|
|
97
97
|
- **Command sync**: After editing `.claude/commands/*.md`, run `node scripts/sync-commands.js` to update all 7 agent directories. Use `--check` in CI to detect drift. Use `--dry-run` to preview.
|
|
98
|
+
- **Dynamic commands**: Never hardcode example output in command files (`.claude/commands/*.md`) when a script generates that output dynamically. Command files should reference the script and describe what it does — not duplicate its output with fake data that becomes stale.
|
|
98
99
|
|
|
99
100
|
<!-- USER:END -->
|