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