codecruise 0.1.0
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/LICENSE +21 -0
- package/README.md +111 -0
- package/bin/codecruise.js +68 -0
- package/config/CLAUDE.md +107 -0
- package/config/agents/analyst.md +48 -0
- package/config/agents/architect-reviewer.md +161 -0
- package/config/agents/architect.md +119 -0
- package/config/agents/critic.md +63 -0
- package/config/agents/developer.md +96 -0
- package/config/agents/devops.md +81 -0
- package/config/agents/orchestrator.md +91 -0
- package/config/agents/planner.md +139 -0
- package/config/agents/retro.md +52 -0
- package/config/agents/reviewer.md +101 -0
- package/config/agents/security-reviewer.md +57 -0
- package/config/agents/stack/expo/AGENT.md +473 -0
- package/config/agents/stack/expo/rules/critical.md +427 -0
- package/config/agents/stack/expo/rules/native.md +455 -0
- package/config/agents/stack/expo/rules/navigation.md +445 -0
- package/config/agents/stack/expo/rules/performance.md +415 -0
- package/config/agents/stack/fastify/AGENT.md +397 -0
- package/config/agents/stack/fastify/rules/api-design.md +283 -0
- package/config/agents/stack/fastify/rules/critical.md +232 -0
- package/config/agents/stack/fastify/rules/queues.md +303 -0
- package/config/agents/stack/fastify/rules/security.md +384 -0
- package/config/agents/stack/index.yaml +48 -0
- package/config/agents/stack/nextjs/AGENT.md +421 -0
- package/config/agents/stack/nextjs/rules/components.md +413 -0
- package/config/agents/stack/nextjs/rules/critical.md +391 -0
- package/config/agents/stack/nextjs/rules/performance.md +403 -0
- package/config/agents/stack/nextjs/rules/styling.md +334 -0
- package/config/agents/stack/shared-ts/AGENT.md +384 -0
- package/config/agents/stack/shared-ts/rules/critical.md +315 -0
- package/config/agents/stack/shared-ts/rules/patterns.md +384 -0
- package/config/agents/stack/shared-ts/rules/zod.md +427 -0
- package/config/agents/tester.md +79 -0
- package/config/commands/architect-discuss.md +366 -0
- package/config/commands/architect-list.md +160 -0
- package/config/commands/architect-review.md +111 -0
- package/config/commands/architect.md +118 -0
- package/config/commands/compact.md +118 -0
- package/config/commands/companion.md +279 -0
- package/config/commands/dashboard.md +152 -0
- package/config/commands/doctor.md +227 -0
- package/config/commands/dogfood-report.md +101 -0
- package/config/commands/flags/run-autonomous.md +110 -0
- package/config/commands/flags/run-pause.md +80 -0
- package/config/commands/ingest.md +173 -0
- package/config/commands/init.md +128 -0
- package/config/commands/metrics.md +87 -0
- package/config/commands/parallel.md +320 -0
- package/config/commands/pause.md +55 -0
- package/config/commands/plan-review.md +130 -0
- package/config/commands/plan.md +216 -0
- package/config/commands/production-check.md +308 -0
- package/config/commands/refine.md +323 -0
- package/config/commands/resume.md +72 -0
- package/config/commands/retro.md +121 -0
- package/config/commands/retry.md +75 -0
- package/config/commands/role.md +310 -0
- package/config/commands/run.md +417 -0
- package/config/commands/scope.md +85 -0
- package/config/commands/setup-permissions.md +104 -0
- package/config/commands/skip.md +75 -0
- package/config/commands/spec-forge.md +213 -0
- package/config/commands/spec-help.md +194 -0
- package/config/commands/spec-patch.md +342 -0
- package/config/commands/spec-resolve.md +110 -0
- package/config/commands/spec-review.md +153 -0
- package/config/commands/status.md +114 -0
- package/config/commands/sync.md +131 -0
- package/config/commands/task.md +138 -0
- package/config/commands/verify.md +124 -0
- package/config/hooks/README.md +632 -0
- package/config/hooks/activity-log.sh +187 -0
- package/config/hooks/anti-rationalize.sh +52 -0
- package/config/hooks/capture-verification.sh +112 -0
- package/config/hooks/collect-metrics.sh +135 -0
- package/config/hooks/enforce-file-scope.sh +75 -0
- package/config/hooks/enforce-state-machine.sh +161 -0
- package/config/hooks/enforce-tdd.sh +180 -0
- package/config/hooks/format.sh +40 -0
- package/config/hooks/lib/activity-helpers.sh +162 -0
- package/config/hooks/lib/read-settings.sh +71 -0
- package/config/hooks/load-context-skills.sh +95 -0
- package/config/hooks/notify.sh +81 -0
- package/config/hooks/pre-commit.sample +35 -0
- package/config/hooks/protect-files.sh +63 -0
- package/config/hooks/track-agents.sh +41 -0
- package/config/hooks/track-commands.sh +37 -0
- package/config/hooks/track-enforcement.sh +44 -0
- package/config/hooks/track-ooda.sh +77 -0
- package/config/hooks/validate-commit-msg.sh +35 -0
- package/config/hooks/validate-plan.sh +213 -0
- package/config/hooks/verify-criteria.sh +46 -0
- package/config/hooks/verify-todo-completion.sh +140 -0
- package/config/rules/comments.md +25 -0
- package/config/rules/decision-rules.md +308 -0
- package/config/rules/hygiene.md +247 -0
- package/config/rules/pattern-detection.md +372 -0
- package/config/rules/profiles.md +193 -0
- package/config/rules/recovery.md +83 -0
- package/config/rules/scope-detection.md +213 -0
- package/config/rules/standards.md +127 -0
- package/config/rules/workflow.md +121 -0
- package/config/schemas.md +767 -0
- package/config/settings.json +195 -0
- package/config/skills/backend/SKILL.md +734 -0
- package/config/skills/database/SKILL.md +426 -0
- package/config/skills/frontend/SKILL.md +434 -0
- package/config/skills/git/SKILL.md +396 -0
- package/config/skills/index.yaml +36 -0
- package/config/skills/observability/SKILL.md +430 -0
- package/config/skills/package-dev/SKILL.md +498 -0
- package/config/skills/performance/SKILL.md +378 -0
- package/config/skills/resilience/SKILL.md +573 -0
- package/config/skills/testing/SKILL.md +398 -0
- package/config/skills/testing-patterns/SKILL.md +276 -0
- package/config/skills/typescript/SKILL.md +152 -0
- package/config/templates/CLAUDE.md +70 -0
- package/config/templates/README.md +117 -0
- package/config/templates/steering/adr-template.md +102 -0
- package/config/templates/steering/product.md +60 -0
- package/config/templates/steering/rfc-template.md +159 -0
- package/config/templates/steering/structure.md +146 -0
- package/config/templates/steering/tech.md +85 -0
- package/package.json +40 -0
- package/src/install.js +163 -0
- package/src/report.js +310 -0
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: scope
|
|
3
|
+
description: List available phases, features, and subfeatures for execution
|
|
4
|
+
model: haiku
|
|
5
|
+
tools: Read, Glob
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /scope — List Execution Scopes
|
|
9
|
+
|
|
10
|
+
Display available phases, features, and subfeatures from roadmap.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
/scope # All phases with features
|
|
16
|
+
/scope phase-01 # Features for phase
|
|
17
|
+
/scope feature-1.2 # Subfeatures for feature
|
|
18
|
+
/scope --pending # Only pending items
|
|
19
|
+
/scope --tree # Full tree view
|
|
20
|
+
/scope --todos # Include TODO details
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Data Sources
|
|
24
|
+
|
|
25
|
+
```yaml
|
|
26
|
+
roadmap/project.yaml # Phase definitions
|
|
27
|
+
roadmap/**/*.yaml # Features/TODOs
|
|
28
|
+
progress.yaml # Current state
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Status Icons
|
|
32
|
+
|
|
33
|
+
| Status | Icon |
|
|
34
|
+
|--------|------|
|
|
35
|
+
| complete | ✓ |
|
|
36
|
+
| in_progress | 🔄 |
|
|
37
|
+
| pending | ○ |
|
|
38
|
+
| blocked | ⚠ |
|
|
39
|
+
|
|
40
|
+
## Default View
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
╔═══════════════════════════════════════════════════════════════╗
|
|
44
|
+
║ AVAILABLE SCOPES ║
|
|
45
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
46
|
+
║ Current: todo-1.1b-004 (Verify directory structure) ║
|
|
47
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
48
|
+
║ PHASES ║
|
|
49
|
+
║ phase-01 Alpha Bootstrap 🔄 7% (12/164) ║
|
|
50
|
+
║ phase-02 Domain Modules ○ 0% (0/98) ║
|
|
51
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
52
|
+
║ FEATURES (phase-01) ║
|
|
53
|
+
║ feature-1.1 Monorepo Foundation 🔄 50% (7/14) ║
|
|
54
|
+
║ feature-1.2 Infrastructure ○ 0% (0/34) ║
|
|
55
|
+
╠═══════════════════════════════════════════════════════════════╣
|
|
56
|
+
║ COMMANDS ║
|
|
57
|
+
║ /run phase-01 Run entire phase ║
|
|
58
|
+
║ /run feature-1.1 Run specific feature ║
|
|
59
|
+
║ /scope feature-1.1 Drill into feature ║
|
|
60
|
+
╚═══════════════════════════════════════════════════════════════╝
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Tree View (`--tree`)
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
Project: Figu (7% complete)
|
|
67
|
+
├── phase-01: Alpha Bootstrap 🔄 7%
|
|
68
|
+
│ ├── feature-1.1: Monorepo Foundation 🔄 50%
|
|
69
|
+
│ │ ├── subfeature-1.1a: Root Config ✓ 100%
|
|
70
|
+
│ │ └── subfeature-1.1b: TypeScript 🔄 75%
|
|
71
|
+
│ └── feature-1.2: Infrastructure ○ 0%
|
|
72
|
+
└── phase-02: Domain Modules ○ 0%
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
## Error Handling
|
|
76
|
+
|
|
77
|
+
**No roadmap**: "Run /plan first"
|
|
78
|
+
**Invalid scope**: Lists available scopes
|
|
79
|
+
|
|
80
|
+
## Quality Bar
|
|
81
|
+
|
|
82
|
+
- Fast execution (< 1 second)
|
|
83
|
+
- Clear, scannable output
|
|
84
|
+
- Accurate progress
|
|
85
|
+
- Helpful next-step commands
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: setup-permissions
|
|
3
|
+
description: Configure Claude Code permissions for autonomous task execution
|
|
4
|
+
model: haiku
|
|
5
|
+
tools: Read, Write, Bash
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /setup-permissions — Permission Configuration
|
|
9
|
+
|
|
10
|
+
Configure `.claude/settings.json` for autonomous execution without prompts.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
/setup-permissions # Interactive setup
|
|
16
|
+
/setup-permissions --profile exec # Apply execution profile
|
|
17
|
+
/setup-permissions --profile strict # Apply strict profile
|
|
18
|
+
/setup-permissions --show # Show current permissions
|
|
19
|
+
/setup-permissions --reset # Remove custom permissions
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Profiles
|
|
23
|
+
|
|
24
|
+
| Profile | Description | Use Case |
|
|
25
|
+
|---------|-------------|----------|
|
|
26
|
+
| `exec` | Full execution permissions | Autonomous /run |
|
|
27
|
+
| `strict` | Minimal, ask for most | Security-conscious |
|
|
28
|
+
| `readonly` | Read + search only | Code review |
|
|
29
|
+
|
|
30
|
+
## Profile: exec (Default)
|
|
31
|
+
|
|
32
|
+
**Allow**: Package managers, git operations, build tools, file operations
|
|
33
|
+
|
|
34
|
+
```json
|
|
35
|
+
"allow": [
|
|
36
|
+
"Bash(pnpm *)", "Bash(npm *)", "Bash(turbo *)",
|
|
37
|
+
"Bash(git add *)", "Bash(git commit *)", "Bash(git checkout *)",
|
|
38
|
+
"Bash(vitest *)", "Bash(eslint *)", "Bash(tsc *)",
|
|
39
|
+
"Bash(mkdir *)", "Bash(cp *)", "Bash(mv *)"
|
|
40
|
+
]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Ask**: Destructive operations, cloud CLIs
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
"ask": [
|
|
47
|
+
"Bash(git push *)", "Bash(rm -rf *)",
|
|
48
|
+
"Bash(docker *)", "Bash(aws *)"
|
|
49
|
+
]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
**Deny**: Dangerous commands, secrets
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
"deny": [
|
|
56
|
+
"Bash(rm -rf /)", "Bash(curl * | bash)",
|
|
57
|
+
"Read(./.env)", "Read(./secrets/*)"
|
|
58
|
+
]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Profile: strict
|
|
62
|
+
|
|
63
|
+
**Allow**: Read-only git, file viewing
|
|
64
|
+
**Ask**: Package managers, git writes
|
|
65
|
+
**Deny**: Secrets
|
|
66
|
+
|
|
67
|
+
## Profile: readonly
|
|
68
|
+
|
|
69
|
+
**Allow**: git status/diff/log, cat/head/tail, find/grep
|
|
70
|
+
**Deny**: All writes, git commits
|
|
71
|
+
|
|
72
|
+
## Process
|
|
73
|
+
|
|
74
|
+
1. **Check State**: Look for existing settings.json
|
|
75
|
+
2. **Detect Stack**: Read package.json, turbo.json, CLAUDE.md
|
|
76
|
+
3. **Generate Profile**: Based on detection + selection
|
|
77
|
+
4. **Apply**: Merge with existing settings
|
|
78
|
+
|
|
79
|
+
## Integration with /run
|
|
80
|
+
|
|
81
|
+
Pre-flight checks if permissions configured. If not:
|
|
82
|
+
→ "Run /setup-permissions first? [Y/n]"
|
|
83
|
+
|
|
84
|
+
## Security Notes
|
|
85
|
+
|
|
86
|
+
- **Never allow** `Bash(*)` (any command)
|
|
87
|
+
- **Always deny** secrets files
|
|
88
|
+
- **Always ask** for destructive operations
|
|
89
|
+
- Review custom patterns before committing
|
|
90
|
+
|
|
91
|
+
## Output
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
✓ PERMISSIONS CONFIGURED
|
|
95
|
+
|
|
96
|
+
Profile: exec
|
|
97
|
+
File: .claude/settings.json
|
|
98
|
+
|
|
99
|
+
Allowed (45): pnpm, git, build tools
|
|
100
|
+
Ask (10): git push, rm -rf, cloud CLIs
|
|
101
|
+
Denied (16): dangerous commands, secrets
|
|
102
|
+
|
|
103
|
+
Next: /run will execute without prompts
|
|
104
|
+
```
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skip
|
|
3
|
+
description: DECIDE override - bypass TODO regardless of confidence
|
|
4
|
+
model: haiku
|
|
5
|
+
tools: Read, Write
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /skip
|
|
9
|
+
|
|
10
|
+
Force DECIDE phase to route "skip" — human override of OODA routing.
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
/skip # Skip current TODO
|
|
16
|
+
/skip todo-1.1b-004 # Skip specific TODO
|
|
17
|
+
/skip --reason "blocked by API" # Record reason
|
|
18
|
+
/skip --force # Skip even with dependents
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Behavior
|
|
22
|
+
|
|
23
|
+
| Action | Effect |
|
|
24
|
+
|--------|--------|
|
|
25
|
+
| Skip | DECIDE → skip, move to next TODO |
|
|
26
|
+
| With dependents | Warn, offer cancel |
|
|
27
|
+
| `--force` | Skip without dependent check |
|
|
28
|
+
|
|
29
|
+
## With Dependents
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
⚠ todo-1.1b-004 has dependents:
|
|
33
|
+
- todo-1.1b-005
|
|
34
|
+
- todo-1.1c-001
|
|
35
|
+
|
|
36
|
+
[y] Skip anyway
|
|
37
|
+
[n] Cancel
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Output
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
⏭ SKIP: todo-1.1b-004
|
|
44
|
+
|
|
45
|
+
Reason: External API not ready
|
|
46
|
+
Source: User override
|
|
47
|
+
|
|
48
|
+
Queue: 10 done | 1 skipped | 3 remaining
|
|
49
|
+
Next: todo-1.1b-005
|
|
50
|
+
|
|
51
|
+
Undo: /retry todo-1.1b-004
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## State Update
|
|
55
|
+
|
|
56
|
+
```yaml
|
|
57
|
+
queue:
|
|
58
|
+
skipped:
|
|
59
|
+
- id: todo-1.1b-004
|
|
60
|
+
reason: "External API not ready"
|
|
61
|
+
skip_source: user_override
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Skip vs OODA Skip
|
|
65
|
+
|
|
66
|
+
| Source | Tracking |
|
|
67
|
+
|--------|----------|
|
|
68
|
+
| User `/skip` | Not tracked as failure |
|
|
69
|
+
| OODA low-confidence | Tracked, affects confidence |
|
|
70
|
+
|
|
71
|
+
User skips are **intentional** — they don't pollute OODA patterns.
|
|
72
|
+
|
|
73
|
+
## OODA Integration
|
|
74
|
+
|
|
75
|
+
Skip is a human override of DECIDE. See `/run` for full OODA routing logic.
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-forge
|
|
3
|
+
description: Read inventory docs and generate canonical spec + issues + decisions
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
tools: Glob, Read, Write, Edit, Grep, Bash
|
|
6
|
+
model: opus
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /spec-forge — Canonical Spec Generator
|
|
10
|
+
|
|
11
|
+
Create/refresh canonical product spec from inventory docs.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
/spec-forge # Default: .codecruise/inventory/
|
|
17
|
+
/spec-forge .codecruise/ingested/combined.md # After /ingest
|
|
18
|
+
/spec-forge --dry-run # Preview without writing
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Size Check (Auto)
|
|
22
|
+
|
|
23
|
+
| Condition | Action |
|
|
24
|
+
|-----------|--------|
|
|
25
|
+
| > 50 files | STOP → Suggest `/ingest` first |
|
|
26
|
+
| > 2MB total | STOP → Suggest `/ingest` first |
|
|
27
|
+
| Any file > 256KB | WARN → Consider `/ingest` |
|
|
28
|
+
| ≤ 20 files, ≤ 2MB | Proceed |
|
|
29
|
+
|
|
30
|
+
## Inputs (read-only)
|
|
31
|
+
|
|
32
|
+
- `.codecruise/inventory/**` or argument path
|
|
33
|
+
- `.codecruise/inventory/index.yaml` (priority/ignore rules)
|
|
34
|
+
- `.codecruise/canon/**` (baseline for idempotent updates)
|
|
35
|
+
- `.codecruise/ingested/source-map.yaml` (if from /ingest)
|
|
36
|
+
|
|
37
|
+
## Outputs
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
.codecruise/canon/
|
|
41
|
+
├── spec.md # Canonical spec
|
|
42
|
+
├── issues.md # Conflicts + questions + assumptions
|
|
43
|
+
├── decisions.md # Resolved decisions (immutable)
|
|
44
|
+
├── changelog.md # Version history
|
|
45
|
+
.codecruise/context/
|
|
46
|
+
└── {feature}.yaml # Per-feature sources, decisions, constraints
|
|
47
|
+
.codecruise/roadmap/
|
|
48
|
+
└── future.md # Out-of-scope items
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Process
|
|
52
|
+
|
|
53
|
+
1. **Discover**: Read files by priority (index.yaml) or default sort (newest first)
|
|
54
|
+
2. **Extract**: Vision, requirements, entities, tech notes, future plans
|
|
55
|
+
3. **Conflicts** (MUST DO): Log contradicting sources with severity
|
|
56
|
+
4. **Open Questions** (MUST DO): Log ambiguous/missing requirements
|
|
57
|
+
5. **Assumptions** (MUST DO): Log interpretations made
|
|
58
|
+
6. **Scope Separate**: v1 → spec.md, future → future.md
|
|
59
|
+
7. **Context Files**: Create `.codecruise/context/{feature}.yaml` with sources, decisions, constraints
|
|
60
|
+
8. **Generate Spec**: spec.md with FR-XXX, NFR-XXX, acceptance criteria
|
|
61
|
+
9. **Generate Workflows**: WF-XXX with Mermaid sequence diagrams for complex flows
|
|
62
|
+
10. **Decisions Log**: Immutable D-XXX entries
|
|
63
|
+
11. **Changelog**: Version history
|
|
64
|
+
|
|
65
|
+
## Spec Structure
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
---
|
|
69
|
+
version: 0.1.0
|
|
70
|
+
generated: {timestamp}
|
|
71
|
+
sources_count: 12
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
# {Project} — Product Specification
|
|
75
|
+
|
|
76
|
+
## 1. Overview (pitch, problem, goals, non-goals, key terms)
|
|
77
|
+
## 2. Users (personas, use cases)
|
|
78
|
+
## 3. Scope (v1 in/out)
|
|
79
|
+
## 4. Requirements
|
|
80
|
+
- 4.1 Functional (FR-XXX with acceptance criteria)
|
|
81
|
+
- 4.2 Non-Functional (NFR-XXX with thresholds)
|
|
82
|
+
## 5. Workflows (WF-XXX with Mermaid sequence diagrams)
|
|
83
|
+
## 6. Data & Integrations (entities, systems, auth)
|
|
84
|
+
## 7. Risks
|
|
85
|
+
## 8. Links
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Workflow Format
|
|
89
|
+
|
|
90
|
+
Generate Mermaid sequence diagrams for complex flows:
|
|
91
|
+
|
|
92
|
+
```markdown
|
|
93
|
+
### WF-001: Password Reset Flow
|
|
94
|
+
- **Trigger**: User clicks "Forgot Password"
|
|
95
|
+
- **Actors**: User, API, Database, Email Service
|
|
96
|
+
- **Related**: FR-003, FR-004
|
|
97
|
+
|
|
98
|
+
\`\`\`mermaid
|
|
99
|
+
sequenceDiagram
|
|
100
|
+
participant U as User
|
|
101
|
+
participant A as API
|
|
102
|
+
participant D as Database
|
|
103
|
+
participant E as Email Service
|
|
104
|
+
|
|
105
|
+
U->>A: POST /reset-password {email}
|
|
106
|
+
A->>D: Find user by email
|
|
107
|
+
alt User exists
|
|
108
|
+
A->>D: Create reset token (expires 1hr)
|
|
109
|
+
A->>E: Send reset email
|
|
110
|
+
A-->>U: 200 "Check your email"
|
|
111
|
+
else User not found
|
|
112
|
+
A-->>U: 200 "Check your email" (no leak)
|
|
113
|
+
end
|
|
114
|
+
U->>A: GET /reset/{token}
|
|
115
|
+
A->>D: Validate token
|
|
116
|
+
A-->>U: Password reset form
|
|
117
|
+
U->>A: POST /reset/{token} {new_password}
|
|
118
|
+
A->>D: Update password, invalidate token
|
|
119
|
+
A-->>U: 200 "Password updated"
|
|
120
|
+
\`\`\`
|
|
121
|
+
|
|
122
|
+
**Error Handling:**
|
|
123
|
+
- Invalid token → 400 "Invalid or expired link"
|
|
124
|
+
- Rate limit exceeded → 429 with Retry-After
|
|
125
|
+
|
|
126
|
+
**Edge Cases:**
|
|
127
|
+
- Multiple reset requests → Only latest token valid
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
**When to generate diagrams:**
|
|
131
|
+
- Multi-step user flows (auth, checkout, onboarding)
|
|
132
|
+
- Async processes (webhooks, background jobs)
|
|
133
|
+
- Multi-service interactions (payment, notifications)
|
|
134
|
+
|
|
135
|
+
**Skip diagrams for:**
|
|
136
|
+
- Simple CRUD operations
|
|
137
|
+
- Single request-response flows
|
|
138
|
+
|
|
139
|
+
## Issue Format
|
|
140
|
+
|
|
141
|
+
```yaml
|
|
142
|
+
# Conflict
|
|
143
|
+
- id: conflict-001
|
|
144
|
+
description: "Auth timeout: 30min vs 1hr"
|
|
145
|
+
side_a: {position, sources}
|
|
146
|
+
side_b: {position, sources}
|
|
147
|
+
severity: P0|P1|P2
|
|
148
|
+
suggested_resolution: "..."
|
|
149
|
+
|
|
150
|
+
# Open Question
|
|
151
|
+
- id: oq-001
|
|
152
|
+
question: "Rate limit behavior?"
|
|
153
|
+
impact: "Cannot implement error handling"
|
|
154
|
+
owner: PM|Eng|Security
|
|
155
|
+
priority: P1
|
|
156
|
+
|
|
157
|
+
# Assumption
|
|
158
|
+
- id: assumption-001
|
|
159
|
+
assumption: "Free tier = no API"
|
|
160
|
+
rationale: "Inferred from pricing doc"
|
|
161
|
+
needs_validation: true
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Idempotency
|
|
165
|
+
|
|
166
|
+
| File | On Re-run |
|
|
167
|
+
|------|-----------|
|
|
168
|
+
| `spec.md` | Regenerate, show diff |
|
|
169
|
+
| `issues.md` | Append new, preserve existing |
|
|
170
|
+
| `decisions.md` | Append only (immutable) |
|
|
171
|
+
| `changelog.md` | Append version entry |
|
|
172
|
+
|
|
173
|
+
**Manual Edit Detection**: If `generated_hash` mismatch, create `spec.md.new` instead.
|
|
174
|
+
|
|
175
|
+
## Versioning
|
|
176
|
+
|
|
177
|
+
| Version | Meaning |
|
|
178
|
+
|---------|---------|
|
|
179
|
+
| `0.x.y` | Draft/iterating |
|
|
180
|
+
| `1.x.y` | First stable (human approved) |
|
|
181
|
+
|
|
182
|
+
Never auto-increment major version without human approval.
|
|
183
|
+
|
|
184
|
+
## Output
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
✓ Spec forge complete
|
|
188
|
+
|
|
189
|
+
Version: 0.1.0
|
|
190
|
+
Sources: 12 (10 supported, 2 skipped)
|
|
191
|
+
- Files: 11
|
|
192
|
+
- Free text: 1 (user-input-20260220-143052.md)
|
|
193
|
+
|
|
194
|
+
Spec: .codecruise/canon/spec.md
|
|
195
|
+
- FR: 15, NFR: 8
|
|
196
|
+
- Workflows: 4 (with sequence diagrams)
|
|
197
|
+
|
|
198
|
+
Issues:
|
|
199
|
+
- Conflicts: 3 (1 P0)
|
|
200
|
+
- Open Questions: 7
|
|
201
|
+
- Assumptions: 4
|
|
202
|
+
|
|
203
|
+
Context files: 9
|
|
204
|
+
|
|
205
|
+
Next: /spec-review or /plan
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
## Quality Bar
|
|
209
|
+
|
|
210
|
+
- No contradictions in spec.md (conflicts → issues.md)
|
|
211
|
+
- Concise spec, detail in appendices
|
|
212
|
+
- All requirements have testable criteria
|
|
213
|
+
- Sources attributed
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: spec-help
|
|
3
|
+
description: Quick reference for spec commands and workflow
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
tools: Read
|
|
6
|
+
model: haiku
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# /spec-help — Spec Commands Reference
|
|
10
|
+
|
|
11
|
+
Print the spec workflow and command reference.
|
|
12
|
+
|
|
13
|
+
## Output
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
╔═══════════════════════════════════════════════════════════╗
|
|
17
|
+
║ SPEC COMMAND SUITE ║
|
|
18
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
19
|
+
║ ║
|
|
20
|
+
║ /ingest Pre-process large inventories (50+) ║
|
|
21
|
+
║ /spec-forge Generate canonical spec from inventory║
|
|
22
|
+
║ /spec-resolve Apply issue resolutions to spec ║
|
|
23
|
+
║ /spec-review Deep audit of spec vs inventory ║
|
|
24
|
+
║ /spec-patch <t> Surgical update to specific section ║
|
|
25
|
+
║ /architect Generate architecture/EDD from spec ║
|
|
26
|
+
║ /architect-review Audit architecture against spec ║
|
|
27
|
+
║ /spec-help This reference ║
|
|
28
|
+
║ ║
|
|
29
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
30
|
+
║ WORKFLOW ║
|
|
31
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
32
|
+
║ ║
|
|
33
|
+
║ 1. Gather docs ──→ docs/inventory/ ║
|
|
34
|
+
║ │ ║
|
|
35
|
+
║ ┌─────────────┴─────────────┐ ║
|
|
36
|
+
║ │ │ ║
|
|
37
|
+
║ (< 20 files) (50+ files or > 256KB) ║
|
|
38
|
+
║ │ │ ║
|
|
39
|
+
║ ▼ ▼ ║
|
|
40
|
+
║ 2. /spec-forge 2a. /ingest ──→ combined.md ║
|
|
41
|
+
║ │ │ ║
|
|
42
|
+
║ │ 2b. /spec-forge combined.md ║
|
|
43
|
+
║ │ │ ║
|
|
44
|
+
║ └─────────────┬─────────────┘ ║
|
|
45
|
+
║ │ ║
|
|
46
|
+
║ ▼ ║
|
|
47
|
+
║ 3. Answer issues.md (add resolution: field) ║
|
|
48
|
+
║ │ ║
|
|
49
|
+
║ ▼ ║
|
|
50
|
+
║ 4. /spec-resolve ──→ Applies resolutions to spec ║
|
|
51
|
+
║ │ ║
|
|
52
|
+
║ ▼ ║
|
|
53
|
+
║ 5. /spec-review ──→ docs/canon/spec-audit.md ║
|
|
54
|
+
║ │ ║
|
|
55
|
+
║ ▼ ║
|
|
56
|
+
║ 6. /spec-patch ──→ Fix specific sections ║
|
|
57
|
+
║ │ │ ║
|
|
58
|
+
║ └────────────────┘ (iterate) ║
|
|
59
|
+
║ │ ║
|
|
60
|
+
║ ▼ ║
|
|
61
|
+
║ 7. /architect ──→ Generate architecture/EDD ║
|
|
62
|
+
║ │ ║
|
|
63
|
+
║ ▼ ║
|
|
64
|
+
║ 8. /architect-review ─→ Validate against spec ║
|
|
65
|
+
║ │ ║
|
|
66
|
+
║ ▼ ║
|
|
67
|
+
║ 9. /plan ──→ Create actionable roadmap ║
|
|
68
|
+
║ ║
|
|
69
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
70
|
+
║ WHEN TO USE ║
|
|
71
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
72
|
+
║ ║
|
|
73
|
+
║ 50+ files or files > 256KB → /ingest first ║
|
|
74
|
+
║ First time, no spec exists → /spec-forge ║
|
|
75
|
+
║ Added new inventory docs → /spec-forge ║
|
|
76
|
+
║ Answered issues in issues.md → /spec-resolve ║
|
|
77
|
+
║ Batch resolve multiple issues → /spec-resolve --all ║
|
|
78
|
+
║ Before sprint planning → /spec-review ║
|
|
79
|
+
║ Stakeholder review prep → /spec-review ║
|
|
80
|
+
║ Fix specific section → /spec-patch <topic> ║
|
|
81
|
+
║ Need to research for answer → /spec-patch <topic> ║
|
|
82
|
+
║ Apply audit patches → /spec-patch <topic> ║
|
|
83
|
+
║ Major rewrite needed → /spec-forge (fresh) ║
|
|
84
|
+
║ Spec ready, need architecture → /architect ║
|
|
85
|
+
║ Validate architecture vs spec → /architect-review ║
|
|
86
|
+
║ ║
|
|
87
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
88
|
+
║ FILE STRUCTURE ║
|
|
89
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
90
|
+
║ ║
|
|
91
|
+
║ docs/ ║
|
|
92
|
+
║ ├── inventory/ # Source docs (read-only) ║
|
|
93
|
+
║ │ ├── index.yaml # Optional: priority/ignore ║
|
|
94
|
+
║ │ └── *.md|pdf|txt ║
|
|
95
|
+
║ ├── ingested/ # From /ingest ║
|
|
96
|
+
║ │ ├── combined.md # Merged analyses ║
|
|
97
|
+
║ │ └── source-map.yaml # Feature→file index ║
|
|
98
|
+
║ ├── canon/ # Generated canonical docs ║
|
|
99
|
+
║ │ ├── spec.md # THE spec ║
|
|
100
|
+
║ │ ├── issues.md # Conflicts + questions ║
|
|
101
|
+
║ │ ├── decisions.md # Decision log ║
|
|
102
|
+
║ │ ├── changelog.md # Version history ║
|
|
103
|
+
║ │ └── spec-audit.md # Audit report ║
|
|
104
|
+
║ ├── context/ # Feature-scoped reference ║
|
|
105
|
+
║ │ ├── auth.yaml # Sources, decisions, constraints║
|
|
106
|
+
║ │ ├── architecture.yaml # Patterns, tech choices ║
|
|
107
|
+
║ │ └── {feature}.yaml # One per major feature ║
|
|
108
|
+
║ ├── roadmap/ ║
|
|
109
|
+
║ │ └── future.md # Out-of-scope items ║
|
|
110
|
+
║ └── appendix/ # Supporting detail ║
|
|
111
|
+
║ ├── edge-cases.md ║
|
|
112
|
+
║ ├── examples.md ║
|
|
113
|
+
║ └── research.md ║
|
|
114
|
+
║ ║
|
|
115
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
116
|
+
║ RESOLVE USAGE ║
|
|
117
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
118
|
+
║ ║
|
|
119
|
+
║ /spec-resolve conflict-001 Single issue ║
|
|
120
|
+
║ /spec-resolve conflict-001 oq-003 Multiple issues ║
|
|
121
|
+
║ /spec-resolve --all All answered issues ║
|
|
122
|
+
║ ║
|
|
123
|
+
║ Required format in issues.md: ║
|
|
124
|
+
║ - id: conflict-001 ║
|
|
125
|
+
║ status: open ║
|
|
126
|
+
║ resolution: "Your answer here" # ← add this ║
|
|
127
|
+
║ rationale: "Why this decision" # ← optional ║
|
|
128
|
+
║ ║
|
|
129
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
130
|
+
║ PATCH TOPICS ║
|
|
131
|
+
╠═══════════════════════════════════════════════════════════╣
|
|
132
|
+
║ ║
|
|
133
|
+
║ /spec-patch auth Authentication section ║
|
|
134
|
+
║ /spec-patch pricing Pricing/billing requirements ║
|
|
135
|
+
║ /spec-patch data-model Entities and relationships ║
|
|
136
|
+
║ /spec-patch integrations External systems ║
|
|
137
|
+
║ /spec-patch nfrs Non-functional requirements ║
|
|
138
|
+
║ /spec-patch edge-cases Error/edge handling ║
|
|
139
|
+
║ /spec-patch FR-003 Specific requirement ║
|
|
140
|
+
║ ║
|
|
141
|
+
╚═══════════════════════════════════════════════════════════╝
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Model & Cost Reference
|
|
145
|
+
|
|
146
|
+
| Command | Model | Est. Cost | Supports --dry-run |
|
|
147
|
+
|---------|-------|-----------|-------------------|
|
|
148
|
+
| /ingest | Sonnet+Haiku | $0.005/file | ✅ Yes |
|
|
149
|
+
| /spec-forge | Opus | $0.30-2.00 | ✅ Yes |
|
|
150
|
+
| /spec-resolve | Sonnet | $0.03-0.25 | ✅ Yes |
|
|
151
|
+
| /spec-review | Opus | $0.15-1.20 | ✅ Yes |
|
|
152
|
+
| /spec-patch | Sonnet | $0.03-0.25 | ✅ Yes |
|
|
153
|
+
| /architect | Opus | $1.00-3.00 | ✅ Yes |
|
|
154
|
+
| /architect-review | Opus | $0.30-1.50 | ✅ Yes |
|
|
155
|
+
| /spec-help | Haiku | ~$0.001 | N/A |
|
|
156
|
+
|
|
157
|
+
*All commands (except /spec-help) support `--dry-run` to preview output without writing files.*
|
|
158
|
+
|
|
159
|
+
## Quick Decision Tree
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
Do you have a spec?
|
|
163
|
+
│
|
|
164
|
+
├── NO → /spec-forge
|
|
165
|
+
│
|
|
166
|
+
└── YES → Are there answered issues in issues.md?
|
|
167
|
+
│
|
|
168
|
+
├── YES → /spec-resolve
|
|
169
|
+
│
|
|
170
|
+
└── NO → Do you have architecture docs?
|
|
171
|
+
│
|
|
172
|
+
├── NO → /architect
|
|
173
|
+
│
|
|
174
|
+
└── YES → Need audit or fix?
|
|
175
|
+
│
|
|
176
|
+
├── Audit arch → /architect-review
|
|
177
|
+
├── Audit spec → /spec-review
|
|
178
|
+
│
|
|
179
|
+
└── Fix section → /spec-patch <topic>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
## Context System (Cost Optimization)
|
|
183
|
+
|
|
184
|
+
Commands use `docs/context/*.yaml` to avoid re-reading inventory:
|
|
185
|
+
|
|
186
|
+
| Command | Reads context/ | Writes context/ |
|
|
187
|
+
|---------|----------------|-----------------|
|
|
188
|
+
| /ingest | - | source-map.yaml |
|
|
189
|
+
| /spec-forge | source-map | ✅ Creates |
|
|
190
|
+
| /spec-resolve | ✅ | ✅ Updates |
|
|
191
|
+
| /spec-review | ✅ | - |
|
|
192
|
+
| /spec-patch | ✅ | ✅ Updates |
|
|
193
|
+
|
|
194
|
+
**Tip:** Use `/ingest --detail` for rich context (page numbers, decisions).
|