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