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