forge-workflow 0.0.2 → 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 (175) hide show
  1. package/.claude/commands/dev.md +26 -0
  2. package/.claude/commands/plan.md +141 -9
  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 +337 -0
  9. package/.cline/workflows/plan.md +518 -0
  10. package/.cline/workflows/premerge.md +173 -0
  11. package/.cline/workflows/research.md +39 -0
  12. package/.cline/workflows/review.md +439 -0
  13. package/.cline/workflows/rollback.md +718 -0
  14. package/.cline/workflows/ship.md +161 -0
  15. package/.cline/workflows/sonarcloud.md +146 -0
  16. package/.cline/workflows/status.md +45 -0
  17. package/.cline/workflows/validate.md +279 -0
  18. package/.cline/workflows/verify.md +218 -0
  19. package/.codex/config.toml +11 -0
  20. package/.codex/skills/dev/SKILL.md +340 -0
  21. package/.codex/skills/plan/SKILL.md +521 -0
  22. package/.codex/skills/premerge/SKILL.md +176 -0
  23. package/.codex/skills/research/SKILL.md +42 -0
  24. package/.codex/skills/review/SKILL.md +442 -0
  25. package/.codex/skills/rollback/SKILL.md +721 -0
  26. package/.codex/skills/ship/SKILL.md +164 -0
  27. package/.codex/skills/sonarcloud/SKILL.md +149 -0
  28. package/.codex/skills/status/SKILL.md +48 -0
  29. package/.codex/skills/validate/SKILL.md +282 -0
  30. package/.codex/skills/verify/SKILL.md +221 -0
  31. package/.cursor/commands/dev.md +337 -0
  32. package/.cursor/commands/plan.md +518 -0
  33. package/.cursor/commands/premerge.md +173 -0
  34. package/.cursor/commands/research.md +39 -0
  35. package/.cursor/commands/review.md +439 -0
  36. package/.cursor/commands/rollback.md +718 -0
  37. package/.cursor/commands/ship.md +161 -0
  38. package/.cursor/commands/sonarcloud.md +146 -0
  39. package/.cursor/commands/status.md +45 -0
  40. package/.cursor/commands/validate.md +279 -0
  41. package/.cursor/commands/verify.md +218 -0
  42. package/.cursor/hooks/state/continual-learning-index.json +19 -0
  43. package/.cursor/hooks/state/continual-learning.json +8 -0
  44. package/.cursor/rules/permissions-guidance.mdc +37 -0
  45. package/.github/prompts/dev.prompt.md +342 -0
  46. package/.github/prompts/plan.prompt.md +523 -0
  47. package/.github/prompts/premerge.prompt.md +178 -0
  48. package/.github/prompts/research.prompt.md +44 -0
  49. package/.github/prompts/review.prompt.md +444 -0
  50. package/.github/prompts/rollback.prompt.md +723 -0
  51. package/.github/prompts/ship.prompt.md +166 -0
  52. package/.github/prompts/sonarcloud.prompt.md +151 -0
  53. package/.github/prompts/status.prompt.md +50 -0
  54. package/.github/prompts/validate.prompt.md +284 -0
  55. package/.github/prompts/verify.prompt.md +223 -0
  56. package/.kilocode/workflows/dev.md +341 -0
  57. package/.kilocode/workflows/plan.md +522 -0
  58. package/.kilocode/workflows/premerge.md +177 -0
  59. package/.kilocode/workflows/research.md +43 -0
  60. package/.kilocode/workflows/review.md +443 -0
  61. package/.kilocode/workflows/rollback.md +722 -0
  62. package/.kilocode/workflows/ship.md +165 -0
  63. package/.kilocode/workflows/sonarcloud.md +150 -0
  64. package/.kilocode/workflows/status.md +49 -0
  65. package/.kilocode/workflows/validate.md +283 -0
  66. package/.kilocode/workflows/verify.md +222 -0
  67. package/.opencode/commands/dev.md +340 -0
  68. package/.opencode/commands/plan.md +521 -0
  69. package/.opencode/commands/premerge.md +176 -0
  70. package/.opencode/commands/research.md +42 -0
  71. package/.opencode/commands/review.md +442 -0
  72. package/.opencode/commands/rollback.md +721 -0
  73. package/.opencode/commands/ship.md +164 -0
  74. package/.opencode/commands/sonarcloud.md +149 -0
  75. package/.opencode/commands/status.md +48 -0
  76. package/.opencode/commands/validate.md +282 -0
  77. package/.opencode/commands/verify.md +221 -0
  78. package/.roo/commands/dev.md +341 -0
  79. package/.roo/commands/plan.md +522 -0
  80. package/.roo/commands/premerge.md +177 -0
  81. package/.roo/commands/research.md +43 -0
  82. package/.roo/commands/review.md +443 -0
  83. package/.roo/commands/rollback.md +722 -0
  84. package/.roo/commands/ship.md +165 -0
  85. package/.roo/commands/sonarcloud.md +150 -0
  86. package/.roo/commands/status.md +49 -0
  87. package/.roo/commands/validate.md +283 -0
  88. package/.roo/commands/verify.md +222 -0
  89. package/AGENTS.md +7 -1
  90. package/CLAUDE.md +5 -4
  91. package/README.md +21 -19
  92. package/bin/{forge-validate.js → forge-preflight.js} +21 -15
  93. package/bin/forge.js +209 -138
  94. package/docs/AGENT_INSTALL_PROMPT.md +1 -1
  95. package/docs/BEADS_GITHUB_SYNC.md +251 -0
  96. package/docs/ENHANCED_ONBOARDING.md +8 -8
  97. package/docs/EXAMPLES.md +4 -4
  98. package/docs/GREPTILE_SETUP.md +1 -1
  99. package/docs/MANUAL_REVIEW_GUIDE.md +1 -1
  100. package/docs/ROADMAP.md +6 -6
  101. package/docs/SETUP.md +1 -2
  102. package/docs/TOOLCHAIN.md +15 -234
  103. package/docs/VALIDATION.md +11 -11
  104. package/install.sh +33 -39
  105. package/lib/agents-config.js +3 -3
  106. package/lib/commands/plan.js +11 -15
  107. package/lib/commands/recommend.js +2 -2
  108. package/lib/dep-guard/analyzer.js +294 -0
  109. package/lib/dep-guard/behavior-detector.js +98 -0
  110. package/lib/dep-guard/contract-detector.js +162 -0
  111. package/lib/dep-guard/import-detector.js +498 -0
  112. package/lib/dep-guard/path-utils.js +13 -0
  113. package/lib/dep-guard/rubric.js +120 -0
  114. package/lib/dep-guard/task-parser.js +318 -0
  115. package/lib/detect-agent.js +191 -0
  116. package/lib/detect-worktree.js +47 -0
  117. package/lib/file-hash.js +26 -0
  118. package/lib/plugin-catalog.js +18 -28
  119. package/lib/setup-action-log.js +139 -0
  120. package/lib/setup-summary-renderer.js +106 -0
  121. package/lib/setup.js +75 -1
  122. package/lib/workflow-profiles.js +5 -11
  123. package/package.json +17 -7
  124. package/skills/parallel-deep-research/SKILL.md +108 -0
  125. package/skills/parallel-deep-research/evals/README.md +27 -0
  126. package/skills/parallel-deep-research/evals/evals.json +62 -0
  127. package/skills/sonarcloud-analysis/SKILL.md +171 -0
  128. package/skills/sonarcloud-analysis/evals/README.md +27 -0
  129. package/skills/sonarcloud-analysis/evals/evals.json +50 -0
  130. package/skills/sonarcloud-analysis/references/api-reference.md +466 -0
  131. package/docs/WORKFLOW.md +0 -400
  132. package/docs/planning/PROGRESS.md +0 -396
  133. package/docs/plans/.gitkeep +0 -0
  134. package/docs/plans/2026-02-27-forge-test-suite-v2-decisions.md +0 -21
  135. package/docs/plans/2026-02-27-forge-test-suite-v2-design.md +0 -362
  136. package/docs/plans/2026-02-27-forge-test-suite-v2-tasks.md +0 -343
  137. package/docs/plans/2026-03-02-superpowers-gaps-decisions.md +0 -26
  138. package/docs/plans/2026-03-02-superpowers-gaps-design.md +0 -239
  139. package/docs/plans/2026-03-02-superpowers-gaps-tasks.md +0 -260
  140. package/docs/plans/2026-03-04-agent-command-parity-design.md +0 -163
  141. package/docs/plans/2026-03-04-verify-worktree-cleanup-decisions.md +0 -7
  142. package/docs/plans/2026-03-04-verify-worktree-cleanup-design.md +0 -165
  143. package/docs/plans/2026-03-05-forge-uto-decisions.md +0 -6
  144. package/docs/plans/2026-03-05-forge-uto-design.md +0 -116
  145. package/docs/plans/2026-03-05-forge-uto-tasks.md +0 -244
  146. package/docs/plans/2026-03-10-command-creator-and-eval-decisions.md +0 -52
  147. package/docs/plans/2026-03-10-command-creator-and-eval-design.md +0 -350
  148. package/docs/plans/2026-03-10-command-creator-and-eval-tasks.md +0 -426
  149. package/docs/plans/2026-03-10-stale-workflow-refs-decisions.md +0 -8
  150. package/docs/plans/2026-03-10-stale-workflow-refs-design.md +0 -80
  151. package/docs/plans/2026-03-10-stale-workflow-refs-tasks.md +0 -90
  152. package/docs/plans/2026-03-14-beads-plan-context-decisions.md +0 -9
  153. package/docs/plans/2026-03-14-beads-plan-context-design.md +0 -171
  154. package/docs/plans/2026-03-14-beads-plan-context-tasks.md +0 -160
  155. package/docs/plans/2026-03-14-skill-eval-loop-decisions.md +0 -33
  156. package/docs/plans/2026-03-14-skill-eval-loop-design.md +0 -118
  157. package/docs/plans/2026-03-14-skill-eval-loop-results.md +0 -78
  158. package/docs/plans/2026-03-14-skill-eval-loop-tasks.md +0 -160
  159. package/docs/plans/2026-03-15-agent-command-parity-v2-decisions.md +0 -11
  160. package/docs/plans/2026-03-15-agent-command-parity-v2-design.md +0 -145
  161. package/docs/plans/2026-03-15-agent-command-parity-v2-tasks.md +0 -211
  162. package/docs/research/TEMPLATE.md +0 -292
  163. package/docs/research/advanced-testing.md +0 -297
  164. package/docs/research/agent-permissions.md +0 -167
  165. package/docs/research/dependency-chain.md +0 -328
  166. package/docs/research/forge-workflow-v2.md +0 -550
  167. package/docs/research/plugin-architecture.md +0 -772
  168. package/docs/research/pr4-cli-automation.md +0 -326
  169. package/docs/research/premerge-verify-restructure.md +0 -205
  170. package/docs/research/skills-restructure.md +0 -508
  171. package/docs/research/sonarcloud-perfection-plan.md +0 -166
  172. package/docs/research/sonarcloud-quality-gate.md +0 -184
  173. package/docs/research/superpowers-integration.md +0 -403
  174. package/docs/research/superpowers.md +0 -319
  175. package/docs/research/test-environment.md +0 -519
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: ship
3
+ description: Create PR with comprehensive documentation
4
+ tools: []
5
+ ---
6
+
7
+ Push code and create a pull request with full context and documentation links.
8
+
9
+ # Ship
10
+
11
+ This command creates a PR after validation passes.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ /ship
17
+ ```
18
+
19
+ ```
20
+ <HARD-GATE: /ship entry>
21
+ Do NOT create PR until:
22
+ 1. /validate was run in this session with all four outputs shown (type, lint, tests, security)
23
+ 2. All checks confirmed passing — not assumed, not "was passing earlier"
24
+ 3. Beads issue is in_progress
25
+ 4. git branch --show-current output is NOT main or master
26
+ </HARD-GATE>
27
+ ```
28
+
29
+ ## What This Command Does
30
+
31
+ ### Step 1: Verify /validate Passed
32
+ Ensure all four validation checks completed successfully with fresh output in this session.
33
+
34
+ ### Step 2: Freshness Check — Is Branch Still Current?
35
+
36
+ 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.
37
+
38
+ ```bash
39
+ BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
40
+ if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
41
+ git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify freshness"; exit 1; }
42
+ BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
43
+ ```
44
+
45
+ - If `BEHIND > 0`: **STOP**. Print: "$BASE has advanced since /validate ($BEHIND new commits). Run /validate again to rebase and re-check."
46
+ - If `BEHIND = 0`: Continue to push.
47
+ - If fetch fails: the `|| { ...; exit 1; }` guard catches this — **STOP**. Do NOT push without confirming freshness.
48
+
49
+ This is NOT a full rebase — just a check. The rebase happens in /validate where the full test suite runs afterward.
50
+
51
+ ### Step 3: Update Beads
52
+ ```bash
53
+ bd update <id> --status done
54
+ bd sync
55
+ ```
56
+
57
+ ### Step 4: Push Branch
58
+
59
+ 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.
60
+
61
+ ```bash
62
+ git push --force-with-lease -u origin <branch-name>
63
+ ```
64
+
65
+ ### Step 5: Create PR
66
+
67
+ 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.
68
+
69
+ If no Beads issue exists (hotfix, external contribution), skip the "Closes" line.
70
+
71
+ ```bash
72
+ gh pr create --title "<type>: <concise description>" --body "$(cat <<'EOF'
73
+ ## Problem
74
+ [What was broken, what need existed, or what user pain this addresses]
75
+
76
+ ## Root Cause
77
+ [Why it happened, why it was missing, or what gap existed]
78
+
79
+ ## Fix
80
+ [What this PR does to solve it — approach, not implementation details]
81
+
82
+ ## Value
83
+ [Who benefits, what improves, what risk is removed]
84
+
85
+ ## Beads
86
+ Closes: <issue-id>
87
+
88
+ <details>
89
+ <summary>Implementation Details</summary>
90
+
91
+ ### Test Coverage
92
+ - Tests: [count] passing
93
+ - Scenarios covered: [list key scenarios]
94
+
95
+ ### Security Review
96
+ - OWASP Top 10: [summary — applicable risks and mitigations]
97
+ - Automated scan: [result]
98
+
99
+ ### Design Doc
100
+ See: docs/plans/YYYY-MM-DD-<slug>-design.md
101
+
102
+ ### Decisions Log
103
+ See: docs/plans/YYYY-MM-DD-<slug>-decisions.md (if any undocumented decisions arose during /dev)
104
+
105
+ ### Key Decisions
106
+ [From design doc — 3-5 key decisions with reasoning]
107
+
108
+ ### Documentation Updated
109
+ [List docs updated in this PR, or "None — no doc-facing changes"]
110
+
111
+ ### Validation
112
+ - [x] Type check passing
113
+ - [x] Lint passing (0 errors, 0 warnings)
114
+ - [x] All tests passing
115
+ - [x] Security review completed
116
+
117
+ </details>
118
+
119
+ 🤖 Generated with [Claude Code](https://claude.com/claude-code)
120
+ EOF
121
+ )"
122
+ ```
123
+
124
+ ### Step 6: Record Stage Transition
125
+ ```bash
126
+ bash scripts/beads-context.sh stage-transition <id> ship review
127
+ ```
128
+
129
+ ## Example Output
130
+
131
+ ```
132
+ ✓ Validation: /validate passed (all 4 checks — fresh output confirmed)
133
+ ✓ Freshness: Branch is up-to-date with master
134
+ ✓ Beads: Marked done & synced (forge-xyz)
135
+ ✓ Pushed: feat/stripe-billing
136
+ ✓ PR created: https://github.com/.../pull/123
137
+ - PR body: Problem → Root Cause → Fix → Value (narrative format)
138
+ - Beads linked: forge-xyz
139
+ - Implementation details in collapsible section
140
+
141
+ ⏸️ PR created, awaiting automated checks (Greptile, SonarCloud, GitHub Actions)
142
+
143
+ Next: /review <pr-number> (after automated checks complete)
144
+ ```
145
+
146
+ ## Integration with Workflow
147
+
148
+ ```
149
+ Utility: /status → Understand current context before starting
150
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
151
+ Stage 2: /dev → Implement each task with subagent-driven TDD
152
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output
153
+ Stage 4: /ship → Push + create PR (you are here)
154
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
155
+ Stage 6: /premerge → Update docs, hand off PR to user
156
+ Stage 7: /verify → Post-merge CI check on main
157
+ ```
158
+
159
+ ## Tips
160
+
161
+ - **Lead with why**: Problem → Root Cause → Fix → Value is what reviewers need first
162
+ - **Collapsible details**: Design doc, decisions log, test coverage go in `<details>` — available but not in the way
163
+ - **Document security**: OWASP Top 10 review in collapsible section
164
+ - **Test coverage**: Show all test scenarios passing
165
+ - **Wait for checks**: Let GitHub Actions, Greptile, SonarCloud run
166
+ - **NO auto-merge**: Always wait for /review phase
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: sonarcloud
3
+ description: Pull issues, metrics, quality gates, and analysis data from SonarCloud
4
+ tools: []
5
+ ---
6
+
7
+ # SonarCloud Query Command
8
+
9
+ Pull code quality data from SonarCloud. Requires `SONARCLOUD_TOKEN` environment variable.
10
+
11
+ ## Arguments
12
+
13
+ - `$ARGUMENTS` - Query type and parameters
14
+
15
+ ## Query Types
16
+
17
+ | Query | Description | Example |
18
+ |-------|-------------|---------|
19
+ | `issues <project>` | Get open issues | `/sonarcloud issues my-project` |
20
+ | `metrics <project>` | Get code metrics | `/sonarcloud metrics my-project` |
21
+ | `gate <project>` | Quality gate status | `/sonarcloud gate my-project` |
22
+ | `health <project>` | Full health report | `/sonarcloud health my-project` |
23
+ | `pr <project> <pr#>` | PR analysis | `/sonarcloud pr my-project 123` |
24
+ | `hotspots <project>` | Security hotspots | `/sonarcloud hotspots my-project` |
25
+ | `history <project>` | Analysis history | `/sonarcloud history my-project` |
26
+
27
+ ## Filters (append to query)
28
+
29
+ | Filter | Description | Example |
30
+ |--------|-------------|---------|
31
+ | `--branch <name>` | Filter by branch | `--branch develop` |
32
+ | `--severity <levels>` | Filter severity | `--severity BLOCKER,CRITICAL` |
33
+ | `--type <types>` | Filter issue type | `--type BUG,VULNERABILITY` |
34
+ | `--new-code` | Only new code issues | `--new-code` |
35
+
36
+ ## Instructions
37
+
38
+ 1. Parse the query from `$ARGUMENTS` to determine:
39
+ - Query type (issues, metrics, gate, health, pr, hotspots, history)
40
+ - Project key
41
+ - Optional filters (branch, severity, type, new-code, etc.)
42
+ 2. Check for `SONARCLOUD_TOKEN` environment variable. If not set, inform user.
43
+ 3. Check for `SONARCLOUD_ORG` environment variable or ask user for organization key.
44
+ 4. Execute the appropriate API call using curl or the TypeScript client at `next-app/src/lib/integrations/sonarcloud.ts`
45
+ 5. Format and present results clearly:
46
+ - For issues: Group by severity/type, show file, line, message
47
+ - For metrics: Show as table with metric name and value
48
+ - For quality gate: Show pass/fail with failed conditions
49
+ - For health: Comprehensive summary with all data
50
+ 6. Offer follow-up actions:
51
+ - "Show issues in specific file?"
52
+ - "Get more details on a specific issue?"
53
+ - "Compare with another branch?"
54
+
55
+ ## Example Outputs
56
+
57
+ ### Issues Query
58
+
59
+ ```
60
+ 📋 Open Issues for my-project (branch: main)
61
+
62
+ Total: 45 issues
63
+
64
+ By Severity:
65
+ 🔴 BLOCKER: 2
66
+ 🟠 CRITICAL: 5
67
+ 🟡 MAJOR: 18
68
+ ⚪ MINOR: 15
69
+ ⚫ INFO: 5
70
+
71
+ By Type:
72
+ 🐛 BUG: 8
73
+ 🔓 VULNERABILITY: 3
74
+ 💩 CODE_SMELL: 34
75
+
76
+ Top Issues:
77
+ 1. [CRITICAL] src/auth/login.ts:42 - SQL injection vulnerability
78
+ 2. [BLOCKER] src/api/users.ts:156 - Null pointer dereference
79
+ ...
80
+ ```
81
+
82
+ ### Metrics Query
83
+
84
+ ```
85
+ 📊 Metrics for my-project
86
+
87
+ | Metric | Value |
88
+ |--------|-------|
89
+ | Lines of Code | 51,234 |
90
+ | Coverage | 78.5% |
91
+ | Duplications | 3.2% |
92
+ | Bugs | 8 |
93
+ | Vulnerabilities | 3 |
94
+ | Code Smells | 34 |
95
+ | Technical Debt | 4d 2h |
96
+ | Maintainability | A |
97
+ | Reliability | B |
98
+ | Security | A |
99
+ ```
100
+
101
+ ### Quality Gate Query
102
+
103
+ ```
104
+ 🚦 Quality Gate: ❌ FAILED
105
+
106
+ Failed Conditions:
107
+ | Metric | Threshold | Actual |
108
+ |--------|-----------|--------|
109
+ | Coverage on New Code | ≥ 80% | 65.3% |
110
+ | New Bugs | = 0 | 2 |
111
+
112
+ Passed Conditions:
113
+ | Metric | Threshold | Actual |
114
+ |--------|-----------|--------|
115
+ | New Vulnerabilities | = 0 | 0 |
116
+ | Duplicated Lines | ≤ 3% | 1.2% |
117
+ ```
118
+
119
+ ## API Reference
120
+
121
+ Base URL: `https://sonarcloud.io/api`
122
+
123
+ ### Key Endpoints
124
+
125
+ ```bash
126
+ # Issues
127
+ curl -H "Authorization: Bearer $TOKEN" \
128
+ "https://sonarcloud.io/api/issues/search?organization=$ORG&componentKeys=$PROJECT&resolved=false"
129
+
130
+ # Metrics
131
+ curl -H "Authorization: Bearer $TOKEN" \
132
+ "https://sonarcloud.io/api/measures/component?component=$PROJECT&metricKeys=bugs,vulnerabilities,coverage"
133
+
134
+ # Quality Gate
135
+ curl -H "Authorization: Bearer $TOKEN" \
136
+ "https://sonarcloud.io/api/qualitygates/project_status?projectKey=$PROJECT"
137
+
138
+ # Hotspots
139
+ curl -H "Authorization: Bearer $TOKEN" \
140
+ "https://sonarcloud.io/api/hotspots/search?projectKey=$PROJECT&status=TO_REVIEW"
141
+ ```
142
+
143
+ ## Full Skill Reference
144
+
145
+ See `skills/sonarcloud-analysis/SKILL.md` for complete API documentation including:
146
+
147
+ - All endpoints and parameters
148
+ - Response structures
149
+ - Pagination handling
150
+ - Advanced filtering
151
+ - Integration patterns
@@ -0,0 +1,50 @@
1
+ ---
2
+ name: status
3
+ description: Check current stage and context
4
+ tools: []
5
+ ---
6
+
7
+ Check where you are in the project and what work is in progress.
8
+
9
+ # Status Check
10
+
11
+ This command helps you understand the current state of the project before starting new work.
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ /status
17
+ ```
18
+
19
+ ## What This Command Does
20
+
21
+ ## Step 0: Sync team state
22
+
23
+ ```bash
24
+ # Sync team state before showing status
25
+ bash scripts/sync-utils.sh auto-sync
26
+ ```
27
+
28
+ ### Step 1: Smart Status (ranked issues with conflict detection)
29
+ ```bash
30
+ bash scripts/smart-status.sh
31
+ ```
32
+ 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.
33
+
34
+ For full context on any issue: `bd show <id>`
35
+
36
+ ### Step 2: Review Recent Commits
37
+ ```bash
38
+ git log --oneline -10
39
+ ```
40
+
41
+ ### Step 3: Determine Context
42
+ - **New feature**: No active work, ready to start fresh
43
+ - **Continuing work**: In-progress issues found, resume where left off
44
+ - **Review needed**: Work marked complete, needs review/merge
45
+
46
+ ## Next Steps
47
+
48
+ - **If starting new work**: Run `/plan <feature-name>`
49
+ - **If continuing work**: Resume with appropriate phase command
50
+ - **If reviewing**: Run `/review <pr-number>` or `/premerge <pr-number>`
@@ -0,0 +1,284 @@
1
+ ---
2
+ name: validate
3
+ description: Complete validation (type/lint/tests/security)
4
+ tools: []
5
+ ---
6
+
7
+ > **Note:** Three things share the "validate" name in Forge:
8
+ > - `/validate` (this command): Workflow Stage 3 — rebases onto the base branch, then runs type/lint/test/security checks
9
+ > - `forge-preflight` (formerly forge-validate): CLI tool — checks prerequisites before a stage
10
+ > - `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)
11
+
12
+ Run comprehensive validation including type checking, linting, code review, security review, and tests.
13
+
14
+ # Validate
15
+
16
+ This command validates all code before creating a pull request.
17
+
18
+ ## Usage
19
+
20
+ ```bash
21
+ /validate
22
+ ```
23
+
24
+ Or use the validation script (checks only — no rebase):
25
+
26
+ ```bash
27
+ bun run check # Runs lint/test/security checks only. Does NOT rebase onto the base branch.
28
+ # Use /validate for the full workflow (rebase + checks).
29
+ ```
30
+
31
+ ```
32
+ <HARD-GATE: /validate entry — rebase onto latest base branch>
33
+ Before running ANY validation checks:
34
+
35
+ 0. Resolve the base branch dynamically (do NOT hardcode master or main):
36
+ BASE=$(git remote show origin 2>/dev/null | grep 'HEAD branch' | awk '{print $NF}')
37
+ if [ -z "$BASE" ] || [ "$BASE" = "(unknown)" ]; then BASE="master"; fi
38
+
39
+ This handles repos using main, master, or any other default branch.
40
+ Falls back to "master" when HEAD is unresolved (detached remote, empty repo).
41
+
42
+ 1. Fetch latest base branch:
43
+ git fetch origin "$BASE" || { echo "✗ Fetch failed — cannot verify branch freshness"; exit 1; }
44
+
45
+ The `|| { ...; exit 1; }` guard ensures fetch failures are never silently skipped.
46
+
47
+ 2. Check if branch is behind:
48
+ BEHIND=$(git rev-list --count HEAD..origin/"$BASE")
49
+
50
+ 3. If BEHIND > 0:
51
+ a. Run: git rebase origin/"$BASE" || REBASE_FAILED=1
52
+ b. If rebase succeeds (REBASE_FAILED unset): print "✓ Rebased onto latest $BASE ($BEHIND commits integrated)"
53
+ c. If rebase fails (REBASE_FAILED=1 — conflicts or any other error):
54
+ - Capture conflicting files BEFORE aborting: git diff --name-only --diff-filter=U
55
+ - Run: git rebase --abort
56
+ - Print the captured conflicting file list
57
+ - Print: "✗ Rebase conflict — resolve manually, then re-run /validate"
58
+ - STOP. Do NOT proceed to any validation checks.
59
+
60
+ 4. If BEHIND = 0:
61
+ Print "✓ Branch is up-to-date with $BASE" and continue.
62
+
63
+ Rationale: Without this step, validation checks run against stale code that doesn't
64
+ include recent base branch changes. Integration issues are only caught after the PR is
65
+ created, wasting CI cycles and review time. Rebasing here ensures /validate results
66
+ reflect the true state of what will be merged.
67
+ </HARD-GATE>
68
+ ```
69
+
70
+ ## What This Command Does
71
+
72
+ **Quick Start**: Run `bun run check` to execute the full validation pipeline (implemented in `scripts/validate.sh`). The npm script is named `check`; the workflow command is `/validate`. See individual steps below for details.
73
+
74
+ ### Step 1: Type Check
75
+ ```bash
76
+ # Run your project's type check command
77
+ bun run typecheck # or: npm run typecheck, tsc, etc.
78
+ ```
79
+ - Verify all TypeScript types are valid
80
+ - No `any` types allowed
81
+ - Strict mode enforcement
82
+
83
+ ### Step 2: Lint
84
+ ```bash
85
+ # Run your project's lint command
86
+ bun run lint # or: npm run lint, eslint ., etc.
87
+ ```
88
+ - Linting rules
89
+ - Code style consistency
90
+ - Best practices compliance
91
+
92
+ ### Step 3: Code Review (if available)
93
+ ```bash
94
+ /code-review:code-review
95
+ ```
96
+ - Static code analysis
97
+ - Code quality check
98
+ - Potential issues flagged
99
+
100
+ ### Step 4: Security Review
101
+
102
+ **OWASP Top 10 Checklist**:
103
+ - A01: Broken Access Control
104
+ - A02: Cryptographic Failures
105
+ - A03: Injection
106
+ - A04: Insecure Design
107
+ - A05: Security Misconfiguration
108
+ - A06: Vulnerable Components
109
+ - A07: Authentication Failures
110
+ - A08: Data Integrity Failures
111
+ - A09: Logging & Monitoring Failures
112
+ - A10: Server-Side Request Forgery
113
+
114
+ **Automated Security Scan**:
115
+ ```bash
116
+ # Run your project's security scan
117
+ npm audit # or: bun audit, snyk test, etc.
118
+ ```
119
+
120
+ **Manual Review**:
121
+ - Review security test scenarios (from design doc — `## Technical Research` section)
122
+ - Verify security mitigations implemented
123
+ - Check for sensitive data exposure
124
+
125
+ ### Step 5: Tests
126
+ ```bash
127
+ # Run your project's test command
128
+ bun test # or: npm run test, jest, vitest, etc.
129
+ ```
130
+ - All tests passing
131
+ - Includes security test scenarios
132
+ - TDD tests from /dev phase
133
+
134
+ > **💭 Plan-Act-Reflect Checkpoint**
135
+ > Before declaring validation complete:
136
+ > - Are all security test scenarios from your design doc actually implemented and passing?
137
+ > - Did you verify OWASP Top 10 mitigations, not just check a box?
138
+ > - Are there edge cases or integration scenarios you haven't tested?
139
+ >
140
+ > **If unsure**: Re-read the `## Technical Research` section in `docs/plans/YYYY-MM-DD-<slug>-design.md`
141
+
142
+ ## On Validation Failure: 4-Phase Debug Mode
143
+
144
+ > **Iron Law: NO FIXES WITHOUT ROOT CAUSE INVESTIGATION FIRST**
145
+ >
146
+ > Every fix attempt without a diagnosed root cause wastes time and masks the real problem.
147
+
148
+ ### Phase D1: Reproduce
149
+
150
+ Confirm the failure is deterministic. Capture the exact error.
151
+
152
+ - Run the failing command fresh — do not rely on cached output
153
+ - Record: exact command, exact error message, exact line number
154
+ - If intermittent: run 3 times, document frequency
155
+
156
+ ### Phase D2: Root-Cause Trace
157
+
158
+ Trace to the source, not the symptom. **Fix at source, not at symptom.**
159
+
160
+ - Read the stack trace — where does it originate?
161
+ - Is it a test bug, an implementation bug, or a config bug?
162
+ - What changed recently that could have caused this?
163
+ - Read the actual failing line and surrounding context
164
+
165
+ ### Phase D3: Fix
166
+
167
+ ONE minimal fix. ONE change at a time.
168
+
169
+ 1. Write the failing test FIRST (if not already a test failure)
170
+ 2. Make the smallest possible change to fix the root cause
171
+ 3. Do not fix multiple things in one commit
172
+ 4. Do not "also improve" unrelated code while fixing
173
+
174
+ ### Phase D4: Verify
175
+
176
+ Re-run full validation from the beginning.
177
+
178
+ - Do not declare fixed until you have run the full validate suite
179
+ - Show fresh output — not "it should be fine now"
180
+ - All checks must pass, not just the one that was failing
181
+
182
+ <HARD-GATE: 3+ fix attempts>
183
+ STOP. Question architecture before Fix #4.
184
+
185
+ If you have attempted 3+ fixes without resolution:
186
+ 1. Step back — is the approach fundamentally wrong?
187
+ 2. Read the original spec/design doc
188
+ 3. Ask: "Am I fixing symptoms or the real problem?"
189
+ 4. Consider: revert all changes and start fresh with better understanding
190
+
191
+ "Quick fix for now" is not a valid fix strategy.
192
+ </HARD-GATE>
193
+
194
+ ### Red Flags — STOP if you hear yourself saying:
195
+
196
+ - "Quick fix for now"
197
+ - "It's probably X"
198
+ - "I don't fully understand but this might work"
199
+ - "Should be fixed now"
200
+ - "It was passing earlier"
201
+ - "I'm confident this is right"
202
+
203
+ **None of these are evidence. Run the command. Show the output.**
204
+
205
+ ### Step 6: Handle Failures
206
+
207
+ If any check fails:
208
+ ```bash
209
+ # Create Beads issue for problems
210
+ bd create "Fix <issue-description>"
211
+
212
+ # Mark current issue as blocked
213
+ bd update <current-id> --status blocked --comment "Blocked by <new-issue-id>"
214
+
215
+ # Output what needs fixing
216
+ ```
217
+
218
+ If all pass:
219
+
220
+ ```
221
+ <HARD-GATE: /validate exit>
222
+ Do NOT output any variation of "check complete", "ready to ship", or proceed to /ship
223
+ until ALL FOUR show fresh output in this session:
224
+
225
+ 1. Type check: [command run] → [actual output] → exit 0 confirmed
226
+ 2. Lint: [command run] → [actual output] → 0 errors, 0 warnings confirmed
227
+ 3. Tests: [command run] → [actual output] → N/N passing confirmed
228
+ 4. Security scan: [command run] → [actual output] → no critical issues confirmed
229
+
230
+ "Should pass", "was passing earlier", and "I'm confident" are not evidence.
231
+ Run the commands. Show the output. THEN declare done.
232
+
233
+ 5. Stage transition: Run `bash scripts/beads-context.sh stage-transition <id> validate ship` → exit 0 confirmed
234
+ </HARD-GATE>
235
+ ```
236
+
237
+ ## Example Output (Success)
238
+
239
+ ```
240
+ ✓ Type check: Passed
241
+ ✓ Lint: Passed
242
+ ✓ Code review: No issues
243
+ ✓ Security Review:
244
+ - OWASP Top 10: All mitigations verified
245
+ - Automated scan: No vulnerabilities
246
+ - Manual review: Security tests passing
247
+ ✓ Tests: 15/15 passing (TDD complete)
248
+
249
+ Ready for /ship
250
+ ```
251
+
252
+ ## Example Output (Failure)
253
+
254
+ ```
255
+ ✗ Tests: 2/15 failing
256
+ - validation.test.ts: Assertion failed
257
+ - auth.test.ts: Timeout exceeded
258
+
259
+ ✓ Beads issue created: bd-k8m3 "Fix validation test"
260
+ ✓ Current issue marked: Blocked by bd-k8m3
261
+
262
+ Fix issues then re-run /validate
263
+ ```
264
+
265
+ ## Integration with Workflow
266
+
267
+ ```
268
+ Utility: /status → Understand current context before starting
269
+ Stage 1: /plan → Design intent → research → branch + worktree + task list
270
+ Stage 2: /dev → Implement each task with subagent-driven TDD
271
+ Stage 3: /validate → Type check, lint, tests, security — all fresh output (you are here)
272
+ Stage 4: /ship → Push + create PR
273
+ Stage 5: /review → Address GitHub Actions, Greptile, SonarCloud
274
+ Stage 6: /premerge → Update docs, hand off PR to user
275
+ Stage 7: /verify → Post-merge CI check on main
276
+ ```
277
+
278
+ ## Tips
279
+
280
+ - **All checks must pass**: Don't proceed to /ship with failures
281
+ - **Security is mandatory**: OWASP Top 10 review required for all features
282
+ - **Create issues for failures**: Track problems in Beads
283
+ - **TDD helps**: Tests should already pass from /dev phase
284
+ - **Fix before shipping**: Resolve all issues before creating PR