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