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.
Files changed (129) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +111 -0
  3. package/bin/codecruise.js +68 -0
  4. package/config/CLAUDE.md +107 -0
  5. package/config/agents/analyst.md +48 -0
  6. package/config/agents/architect-reviewer.md +161 -0
  7. package/config/agents/architect.md +119 -0
  8. package/config/agents/critic.md +63 -0
  9. package/config/agents/developer.md +96 -0
  10. package/config/agents/devops.md +81 -0
  11. package/config/agents/orchestrator.md +91 -0
  12. package/config/agents/planner.md +139 -0
  13. package/config/agents/retro.md +52 -0
  14. package/config/agents/reviewer.md +101 -0
  15. package/config/agents/security-reviewer.md +57 -0
  16. package/config/agents/stack/expo/AGENT.md +473 -0
  17. package/config/agents/stack/expo/rules/critical.md +427 -0
  18. package/config/agents/stack/expo/rules/native.md +455 -0
  19. package/config/agents/stack/expo/rules/navigation.md +445 -0
  20. package/config/agents/stack/expo/rules/performance.md +415 -0
  21. package/config/agents/stack/fastify/AGENT.md +397 -0
  22. package/config/agents/stack/fastify/rules/api-design.md +283 -0
  23. package/config/agents/stack/fastify/rules/critical.md +232 -0
  24. package/config/agents/stack/fastify/rules/queues.md +303 -0
  25. package/config/agents/stack/fastify/rules/security.md +384 -0
  26. package/config/agents/stack/index.yaml +48 -0
  27. package/config/agents/stack/nextjs/AGENT.md +421 -0
  28. package/config/agents/stack/nextjs/rules/components.md +413 -0
  29. package/config/agents/stack/nextjs/rules/critical.md +391 -0
  30. package/config/agents/stack/nextjs/rules/performance.md +403 -0
  31. package/config/agents/stack/nextjs/rules/styling.md +334 -0
  32. package/config/agents/stack/shared-ts/AGENT.md +384 -0
  33. package/config/agents/stack/shared-ts/rules/critical.md +315 -0
  34. package/config/agents/stack/shared-ts/rules/patterns.md +384 -0
  35. package/config/agents/stack/shared-ts/rules/zod.md +427 -0
  36. package/config/agents/tester.md +79 -0
  37. package/config/commands/architect-discuss.md +366 -0
  38. package/config/commands/architect-list.md +160 -0
  39. package/config/commands/architect-review.md +111 -0
  40. package/config/commands/architect.md +118 -0
  41. package/config/commands/compact.md +118 -0
  42. package/config/commands/companion.md +279 -0
  43. package/config/commands/dashboard.md +152 -0
  44. package/config/commands/doctor.md +227 -0
  45. package/config/commands/dogfood-report.md +101 -0
  46. package/config/commands/flags/run-autonomous.md +110 -0
  47. package/config/commands/flags/run-pause.md +80 -0
  48. package/config/commands/ingest.md +173 -0
  49. package/config/commands/init.md +128 -0
  50. package/config/commands/metrics.md +87 -0
  51. package/config/commands/parallel.md +320 -0
  52. package/config/commands/pause.md +55 -0
  53. package/config/commands/plan-review.md +130 -0
  54. package/config/commands/plan.md +216 -0
  55. package/config/commands/production-check.md +308 -0
  56. package/config/commands/refine.md +323 -0
  57. package/config/commands/resume.md +72 -0
  58. package/config/commands/retro.md +121 -0
  59. package/config/commands/retry.md +75 -0
  60. package/config/commands/role.md +310 -0
  61. package/config/commands/run.md +417 -0
  62. package/config/commands/scope.md +85 -0
  63. package/config/commands/setup-permissions.md +104 -0
  64. package/config/commands/skip.md +75 -0
  65. package/config/commands/spec-forge.md +213 -0
  66. package/config/commands/spec-help.md +194 -0
  67. package/config/commands/spec-patch.md +342 -0
  68. package/config/commands/spec-resolve.md +110 -0
  69. package/config/commands/spec-review.md +153 -0
  70. package/config/commands/status.md +114 -0
  71. package/config/commands/sync.md +131 -0
  72. package/config/commands/task.md +138 -0
  73. package/config/commands/verify.md +124 -0
  74. package/config/hooks/README.md +632 -0
  75. package/config/hooks/activity-log.sh +187 -0
  76. package/config/hooks/anti-rationalize.sh +52 -0
  77. package/config/hooks/capture-verification.sh +112 -0
  78. package/config/hooks/collect-metrics.sh +135 -0
  79. package/config/hooks/enforce-file-scope.sh +75 -0
  80. package/config/hooks/enforce-state-machine.sh +161 -0
  81. package/config/hooks/enforce-tdd.sh +180 -0
  82. package/config/hooks/format.sh +40 -0
  83. package/config/hooks/lib/activity-helpers.sh +162 -0
  84. package/config/hooks/lib/read-settings.sh +71 -0
  85. package/config/hooks/load-context-skills.sh +95 -0
  86. package/config/hooks/notify.sh +81 -0
  87. package/config/hooks/pre-commit.sample +35 -0
  88. package/config/hooks/protect-files.sh +63 -0
  89. package/config/hooks/track-agents.sh +41 -0
  90. package/config/hooks/track-commands.sh +37 -0
  91. package/config/hooks/track-enforcement.sh +44 -0
  92. package/config/hooks/track-ooda.sh +77 -0
  93. package/config/hooks/validate-commit-msg.sh +35 -0
  94. package/config/hooks/validate-plan.sh +213 -0
  95. package/config/hooks/verify-criteria.sh +46 -0
  96. package/config/hooks/verify-todo-completion.sh +140 -0
  97. package/config/rules/comments.md +25 -0
  98. package/config/rules/decision-rules.md +308 -0
  99. package/config/rules/hygiene.md +247 -0
  100. package/config/rules/pattern-detection.md +372 -0
  101. package/config/rules/profiles.md +193 -0
  102. package/config/rules/recovery.md +83 -0
  103. package/config/rules/scope-detection.md +213 -0
  104. package/config/rules/standards.md +127 -0
  105. package/config/rules/workflow.md +121 -0
  106. package/config/schemas.md +767 -0
  107. package/config/settings.json +195 -0
  108. package/config/skills/backend/SKILL.md +734 -0
  109. package/config/skills/database/SKILL.md +426 -0
  110. package/config/skills/frontend/SKILL.md +434 -0
  111. package/config/skills/git/SKILL.md +396 -0
  112. package/config/skills/index.yaml +36 -0
  113. package/config/skills/observability/SKILL.md +430 -0
  114. package/config/skills/package-dev/SKILL.md +498 -0
  115. package/config/skills/performance/SKILL.md +378 -0
  116. package/config/skills/resilience/SKILL.md +573 -0
  117. package/config/skills/testing/SKILL.md +398 -0
  118. package/config/skills/testing-patterns/SKILL.md +276 -0
  119. package/config/skills/typescript/SKILL.md +152 -0
  120. package/config/templates/CLAUDE.md +70 -0
  121. package/config/templates/README.md +117 -0
  122. package/config/templates/steering/adr-template.md +102 -0
  123. package/config/templates/steering/product.md +60 -0
  124. package/config/templates/steering/rfc-template.md +159 -0
  125. package/config/templates/steering/structure.md +146 -0
  126. package/config/templates/steering/tech.md +85 -0
  127. package/package.json +40 -0
  128. package/src/install.js +163 -0
  129. package/src/report.js +310 -0
@@ -0,0 +1,213 @@
1
+ # Scope Detection Rules
2
+
3
+ When `/run` receives a new intent (quoted string), determine the appropriate ceremony level.
4
+
5
+ ## Ceremony Levels
6
+
7
+ | Level | Spec | Plan | Human Gates | Use Case |
8
+ |-------|------|------|-------------|----------|
9
+ | **quick** | No | No | 0 | Trivial tasks, fixes |
10
+ | **medium** | Lightweight | Auto | 1 (spec) | Features, integrations |
11
+ | **full** | Detailed | Detailed | 2 (spec + plan) | Systems, major features |
12
+
13
+ ## Detection Algorithm
14
+
15
+ ```
16
+ INPUT: user_intent (string)
17
+
18
+ 1. KEYWORD ANALYSIS
19
+ - Extract key terms from intent
20
+ - Match against complexity indicators
21
+
22
+ 2. SCOPE ESTIMATION
23
+ - Estimate files to be touched
24
+ - Estimate time to complete
25
+ - Check for dependencies/integrations
26
+
27
+ 3. DETERMINE CEREMONY
28
+ - Apply rules below
29
+ - Return: quick | medium | full
30
+
31
+ 4. USER CAN OVERRIDE
32
+ - /run "intent" --ceremony full
33
+ - /run "intent" --quick
34
+ ```
35
+
36
+ ## Quick Ceremony Indicators
37
+
38
+ **Trigger quick when ALL of:**
39
+ - Single file likely (or 1-3 files max)
40
+ - No new dependencies needed
41
+ - No external integrations
42
+ - Estimated time < 15 minutes
43
+ - Simple, well-defined change
44
+
45
+ **Keyword patterns (case-insensitive):**
46
+ ```
47
+ fix|typo|rename|update|change|tweak|adjust
48
+ add .* button|add .* field|add .* prop
49
+ remove|delete .* (unused|old|deprecated)
50
+ move|relocate
51
+ style|css|color|font|margin|padding
52
+ comment|doc(s)?|readme
53
+ log|print|debug
54
+ ```
55
+
56
+ **Examples:**
57
+ ```
58
+ /run "fix typo in README" → quick
59
+ /run "add logout button to navbar" → quick
60
+ /run "update the primary color" → quick
61
+ /run "remove unused imports" → quick
62
+ ```
63
+
64
+ ## Medium Ceremony Indicators
65
+
66
+ **Trigger medium when ANY of:**
67
+ - Multiple files (4-10 estimated)
68
+ - New functionality (not just modification)
69
+ - API endpoint or route
70
+ - Database changes
71
+ - Estimated time 15-60 minutes
72
+
73
+ **Keyword patterns:**
74
+ ```
75
+ add .* (feature|endpoint|api|route|page|component|service)
76
+ implement|create|build .* (basic|simple)?
77
+ integrate .* (with)?
78
+ connect|hook up
79
+ auth|login|logout|session
80
+ form|validation
81
+ crud|list|table|grid
82
+ ```
83
+
84
+ **Examples:**
85
+ ```
86
+ /run "add user authentication" → medium
87
+ /run "create API endpoint for users" → medium
88
+ /run "implement form validation" → medium
89
+ /run "add search functionality" → medium
90
+ ```
91
+
92
+ ## Full Ceremony Indicators
93
+
94
+ **Trigger full when ANY of:**
95
+ - 10+ files estimated
96
+ - Multiple services/modules affected
97
+ - External service integration (Stripe, AWS, etc.)
98
+ - Database schema changes
99
+ - Security-critical functionality
100
+ - Estimated time > 1 hour
101
+ - Keywords indicate system-level work
102
+
103
+ **Keyword patterns:**
104
+ ```
105
+ (build|create|implement) .* system
106
+ (payment|billing|subscription|checkout)
107
+ (oauth|sso|two.?factor|2fa|mfa)
108
+ (migration|schema|database) .* (change|update|redesign)
109
+ refactor .* (architecture|structure|codebase)
110
+ (microservice|service|module) .* (new|add|create)
111
+ (security|encryption|compliance)
112
+ integration with .* (stripe|aws|gcp|azure|twilio|sendgrid)
113
+ ```
114
+
115
+ **Examples:**
116
+ ```
117
+ /run "build payment system" → full
118
+ /run "implement OAuth with Google" → full
119
+ /run "refactor the authentication architecture" → full
120
+ /run "integrate Stripe for subscriptions" → full
121
+ ```
122
+
123
+ ## File Count Heuristics
124
+
125
+ When analyzing intent, estimate files:
126
+
127
+ | Pattern | Estimated Files |
128
+ |---------|-----------------|
129
+ | "button", "field", "prop" | 1-2 |
130
+ | "component", "hook" | 2-3 |
131
+ | "endpoint", "route" | 3-5 |
132
+ | "feature", "page" | 4-8 |
133
+ | "service", "module" | 5-10 |
134
+ | "system", "integration" | 10+ |
135
+
136
+ ## Dependency Heuristics
137
+
138
+ Detect if new dependencies likely needed:
139
+
140
+ | Intent Contains | Likely Needs |
141
+ |-----------------|--------------|
142
+ | "stripe", "payment" | stripe |
143
+ | "auth", "oauth", "jwt" | auth libraries |
144
+ | "email", "sendgrid" | email service |
145
+ | "upload", "s3" | storage SDK |
146
+ | "chart", "graph", "visualization" | charting library |
147
+ | "form", "validation" | form library |
148
+ | "date", "time", "calendar" | date library |
149
+
150
+ If dependencies detected → bump to at least medium.
151
+
152
+ ## Override Flags
153
+
154
+ ```bash
155
+ # Force specific ceremony
156
+ /run "add auth" --ceremony full # Force full even if detected medium
157
+ /run "payment system" --quick # Force quick (not recommended)
158
+
159
+ # Shorthand
160
+ /run "add auth" --full
161
+ /run "fix typo" --medium # Overkill but allowed
162
+ ```
163
+
164
+ ## Output on Detection
165
+
166
+ When ceremony is determined, briefly explain:
167
+
168
+ ```
169
+ Analyzing: "add user authentication"
170
+
171
+ Detected:
172
+ - Keywords: auth, user → medium/full indicator
173
+ - Estimated files: 4-6
174
+ - Dependencies: likely (jwt/session library)
175
+ - Integrations: none detected
176
+
177
+ Ceremony: MEDIUM
178
+ → Will ask 2-4 clarifying questions
179
+ → Will generate spec for approval
180
+ → Then execute with verification
181
+
182
+ Proceed? [y/n/--full to upgrade]
183
+ ```
184
+
185
+ ## Ambiguous Cases
186
+
187
+ When detection is unclear:
188
+
189
+ 1. **Default to medium** - safer than quick
190
+ 2. **Ask user** if truly ambiguous:
191
+ ```
192
+ Intent: "update the user system"
193
+
194
+ This could be:
195
+ [1] Quick - minor updates to existing code
196
+ [2] Medium - new functionality in user module
197
+ [3] Full - major user system overhaul
198
+
199
+ Which best describes your intent? _
200
+ ```
201
+
202
+ ## Integration with /run
203
+
204
+ In `run.md`, after receiving quoted intent:
205
+
206
+ ```
207
+ 1. Parse intent string
208
+ 2. Apply scope-detection rules (this file)
209
+ 3. Determine ceremony level
210
+ 4. If quick → execute directly
211
+ 5. If medium → ask questions → generate spec → execute
212
+ 6. If full → ask questions → generate spec → review → generate plan → review → execute
213
+ ```
@@ -0,0 +1,127 @@
1
+ # Coding Standards
2
+
3
+ ## Priority Order
4
+
5
+ ```
6
+ Security > Correctness > Clarity > Performance
7
+ ```
8
+
9
+ Always optimize in this order. Never sacrifice security for performance.
10
+
11
+ ## Naming Conventions
12
+
13
+ ### Functions
14
+ - Use verbs: `getUser`, `createOrder`, `validateInput`
15
+ - Async functions: `fetchUser`, `loadData`, `saveSettings`
16
+ - Event handlers: `handleClick`, `onSubmit`, `onChange`
17
+ - Boolean returns: `isValid`, `hasPermission`, `canEdit`
18
+
19
+ ### Variables
20
+ - Descriptive: `userEmail` not `ue`
21
+ - Booleans: `isLoading`, `hasError`, `canSubmit`
22
+ - Collections: plural nouns `users`, `items`, `orders`
23
+ - Constants: `UPPER_SNAKE_CASE`
24
+
25
+ ### Files & Directories
26
+ - Components: `PascalCase.tsx`
27
+ - Utilities: `kebab-case.ts`
28
+ - Tests: `*.test.ts` or `*.spec.ts`
29
+ - Types: `*.types.ts` or inline
30
+
31
+ ## Error Handling
32
+
33
+ ### Never Swallow Errors
34
+ ```typescript
35
+ // BAD
36
+ try { doThing() } catch (e) {}
37
+
38
+ // GOOD
39
+ try {
40
+ doThing()
41
+ } catch (error) {
42
+ logger.error('Failed to do thing', { error, context })
43
+ throw new AppError('THING_FAILED', error)
44
+ }
45
+ ```
46
+
47
+ ### Error Messages
48
+ - Include context: what failed, why, what data
49
+ - Use error codes for programmatic handling
50
+ - User-facing messages separate from technical logs
51
+
52
+ ### Boundary Errors
53
+ - Validate at entry points (API routes, form handlers)
54
+ - Trust validated data within boundaries
55
+ - Parse, don't validate (use Zod or similar)
56
+
57
+ ## Comments
58
+
59
+ ### Explain WHY, Not WHAT
60
+ ```typescript
61
+ // BAD: Increments counter
62
+ counter++
63
+
64
+ // GOOD: Compensate for 0-indexed array when displaying to user
65
+ counter++
66
+ ```
67
+
68
+ ### Document Non-Obvious
69
+ - Business logic reasoning
70
+ - Performance optimizations
71
+ - Workarounds with issue links
72
+ - Magic numbers
73
+
74
+ ### TODO Format
75
+ ```typescript
76
+ // TODO(username): Description - JIRA-123
77
+ // FIXME: Temporary workaround, remove after v2.0
78
+ // HACK: Explain why this hack exists
79
+ ```
80
+
81
+ ## Code Organization
82
+
83
+ ### File Length
84
+ - Max ~300 lines per file
85
+ - Split when file serves multiple purposes
86
+ - Extract when logic is reusable
87
+
88
+ ### Function Length
89
+ - Max ~50 lines per function
90
+ - Single responsibility
91
+ - Extract helper functions
92
+
93
+ ### Import Order
94
+ 1. Node built-ins
95
+ 2. External packages
96
+ 3. Internal aliases (@/)
97
+ 4. Relative imports
98
+ 5. Types (if separate)
99
+
100
+ ## Security Rules
101
+
102
+ ### Never
103
+ - Commit secrets (use env vars)
104
+ - Log sensitive data (PII, tokens, passwords)
105
+ - Trust user input (always validate)
106
+ - Expose stack traces to users
107
+ - Use `eval()` or `new Function()`
108
+
109
+ ### Always
110
+ - Sanitize database inputs
111
+ - Validate file uploads (type, size, content)
112
+ - Use parameterized queries
113
+ - Implement rate limiting
114
+ - Check authorization on every request
115
+
116
+ ## Performance Guidelines
117
+
118
+ ### Measure First
119
+ - Don't optimize without profiling
120
+ - Focus on hot paths
121
+ - Consider user-perceived performance
122
+
123
+ ### Common Wins
124
+ - Lazy load non-critical resources
125
+ - Cache expensive computations
126
+ - Batch database operations
127
+ - Use appropriate data structures
@@ -0,0 +1,121 @@
1
+ # Workflow Rules
2
+
3
+ ## Work Breakdown Model
4
+
5
+ ```
6
+ PHASE → FEATURE → [SUBFEATURE] → TODO
7
+ ```
8
+
9
+ ## TODO Format (YAML Required)
10
+
11
+ Always use YAML for TODOs. Never use markdown tables.
12
+
13
+ ```yaml
14
+ todos:
15
+ - id: todo-001
16
+ description: Create LoginForm component
17
+ owner: dev
18
+ status: pending
19
+ files:
20
+ - src/components/LoginForm.tsx
21
+ - src/components/LoginForm.test.tsx
22
+ criteria:
23
+ - Form renders email and password inputs
24
+ - Validation errors display correctly
25
+ depends_on: []
26
+ ```
27
+
28
+ Valid statuses: `pending`, `in_progress`, `done`, `blocked`, `skipped`
29
+
30
+ - **Phases**: Major milestones (auth, dashboard, billing)
31
+ - **Features**: Deliverable units within a phase
32
+ - **Subfeatures**: Optional groupings when features are large
33
+ - **TODOs**: Atomic, independently shippable tasks
34
+
35
+ ## Branching Strategy
36
+
37
+ ```
38
+ main
39
+ └── feature/{feature-slug}
40
+ └── feature/{feature-slug}/{subfeature-slug}
41
+ ```
42
+
43
+ - Feature branches from `main`
44
+ - Subfeature branches from feature branch
45
+ - TODOs committed directly to their subfeature/feature branch
46
+ - Merge via PR with passing quality checks
47
+
48
+ ## PR Scope
49
+
50
+ - One feature per PR (all its TODOs ship together)
51
+ - If feature has subfeatures: one subfeature per PR
52
+ - Subfeature PRs merge into feature branch, then feature branch merges into main
53
+ - Atomic commits within PR (each TODO = 1-2 commits)
54
+
55
+ ## OODA Execution Loop
56
+
57
+ ```
58
+ OBSERVE → ORIENT → DECIDE → ACT → loop
59
+ ```
60
+
61
+ | Phase | Action | Cost |
62
+ |-------|--------|------|
63
+ | OBSERVE | git status, deps, retry patterns | Free (bash) |
64
+ | ORIENT | Confidence calculation, pattern match | Free (rules) |
65
+ | DECIDE | Route: execute/skip/replan/escalate | Free (lookup) |
66
+ | ACT | TDD cycle (red → green → refactor → verify) | Normal |
67
+
68
+ ### Confidence Levels
69
+
70
+ | Level | Meaning | Action |
71
+ |-------|---------|--------|
72
+ | High (0.7+) | No warnings, similar TODOs passed | Execute |
73
+ | Medium (0.4-0.7) | Some warnings, retries in module | Execute cautiously |
74
+ | Low (<0.4) | Patterns detected, failures clustered | Replan or escalate |
75
+
76
+ ### Guardrails
77
+
78
+ | Limit | Default | Purpose |
79
+ |-------|---------|---------|
80
+ | `max_retries_per_todo` | 3 | Stop same approach |
81
+ | `max_replans_per_module` | 2 | Stop different approaches |
82
+ | `on_limit_hit` | escalate | Human decides |
83
+
84
+ ## Quality Gate Checklist
85
+
86
+ Before marking a TODO complete:
87
+
88
+ - [ ] Tests written and passing
89
+ - [ ] Lint passing
90
+ - [ ] Type check passing (if applicable)
91
+ - [ ] No new warnings introduced
92
+ - [ ] Changes are minimal and focused
93
+ - [ ] Commit message follows convention
94
+
95
+ ## Stop Conditions
96
+
97
+ Stop and ask human when:
98
+
99
+ - Scope creep detected (TODO touches unexpected areas)
100
+ - Guardrail limit hit (max retries or replans)
101
+ - Security concern identified
102
+ - Architectural decision needed
103
+ - Dependencies need approval
104
+ - Confidence stays low after replan
105
+
106
+ ## Parallel Work Rules
107
+
108
+ TODOs can run in parallel when:
109
+
110
+ - They have no file overlap
111
+ - They have no data dependencies
112
+ - Different owners (dev vs tester)
113
+
114
+ Mark `depends_on` in TODO spec when sequential execution required.
115
+
116
+ ## Context Management
117
+
118
+ - Use Explore subagent for codebase research
119
+ - Suggest `/compact` after completing TODO
120
+ - Keep main context focused on current task
121
+ - Summarize findings, don't dump raw data