cclaw-cli 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 (59) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +100 -0
  3. package/dist/cli.d.ts +10 -0
  4. package/dist/cli.js +101 -0
  5. package/dist/config.d.ts +5 -0
  6. package/dist/config.js +70 -0
  7. package/dist/constants.d.ts +12 -0
  8. package/dist/constants.js +50 -0
  9. package/dist/content/agents.d.ts +39 -0
  10. package/dist/content/agents.js +244 -0
  11. package/dist/content/autoplan.d.ts +7 -0
  12. package/dist/content/autoplan.js +297 -0
  13. package/dist/content/contracts.d.ts +2 -0
  14. package/dist/content/contracts.js +50 -0
  15. package/dist/content/examples.d.ts +2 -0
  16. package/dist/content/examples.js +327 -0
  17. package/dist/content/hooks.d.ts +16 -0
  18. package/dist/content/hooks.js +753 -0
  19. package/dist/content/learnings.d.ts +5 -0
  20. package/dist/content/learnings.js +265 -0
  21. package/dist/content/meta-skill.d.ts +10 -0
  22. package/dist/content/meta-skill.js +137 -0
  23. package/dist/content/observe.d.ts +21 -0
  24. package/dist/content/observe.js +1110 -0
  25. package/dist/content/session-hooks.d.ts +7 -0
  26. package/dist/content/session-hooks.js +137 -0
  27. package/dist/content/skills.d.ts +3 -0
  28. package/dist/content/skills.js +257 -0
  29. package/dist/content/stage-schema.d.ts +78 -0
  30. package/dist/content/stage-schema.js +1453 -0
  31. package/dist/content/subagents.d.ts +13 -0
  32. package/dist/content/subagents.js +616 -0
  33. package/dist/content/templates.d.ts +3 -0
  34. package/dist/content/templates.js +272 -0
  35. package/dist/content/utility-skills.d.ts +12 -0
  36. package/dist/content/utility-skills.js +467 -0
  37. package/dist/doctor.d.ts +7 -0
  38. package/dist/doctor.js +610 -0
  39. package/dist/flow-state.d.ts +19 -0
  40. package/dist/flow-state.js +41 -0
  41. package/dist/fs-utils.d.ts +5 -0
  42. package/dist/fs-utils.js +28 -0
  43. package/dist/gitignore.d.ts +3 -0
  44. package/dist/gitignore.js +43 -0
  45. package/dist/harness-adapters.d.ts +12 -0
  46. package/dist/harness-adapters.js +175 -0
  47. package/dist/install.d.ts +9 -0
  48. package/dist/install.js +562 -0
  49. package/dist/learnings-summarizer.d.ts +25 -0
  50. package/dist/learnings-summarizer.js +201 -0
  51. package/dist/logger.d.ts +3 -0
  52. package/dist/logger.js +6 -0
  53. package/dist/policy.d.ts +6 -0
  54. package/dist/policy.js +179 -0
  55. package/dist/runs.d.ts +18 -0
  56. package/dist/runs.js +446 -0
  57. package/dist/types.d.ts +19 -0
  58. package/dist/types.js +12 -0
  59. package/package.json +47 -0
@@ -0,0 +1,272 @@
1
+ import { COMMAND_FILE_ORDER } from "../constants.js";
2
+ import { orderedStageSchemas } from "./stage-schema.js";
3
+ export const ARTIFACT_TEMPLATES = {
4
+ "01-brainstorm.md": `# Brainstorm Artifact
5
+
6
+ ## Problem Statement
7
+ -
8
+
9
+ ## Clarifying Questions
10
+ -
11
+
12
+ ## Approaches (2-3)
13
+ - Approach A:
14
+ - Approach B:
15
+ - Approach C:
16
+
17
+ ## Chosen Direction
18
+ -
19
+
20
+ ## Approval
21
+ - Approved by:
22
+ - Date:
23
+ `,
24
+ "02-scope.md": `# Scope Artifact
25
+
26
+ ## Scope Mode
27
+ - [ ] expand
28
+ - [ ] selective
29
+ - [ ] hold
30
+ - [ ] reduce
31
+
32
+ ## In Scope
33
+ -
34
+
35
+ ## Out of Scope
36
+ -
37
+
38
+ ## Strategic Risks
39
+ -
40
+
41
+ ## Scope Contract
42
+ - Decision owner:
43
+ - Decision date:
44
+ `,
45
+ "03-design.md": `# Design Artifact
46
+
47
+ ## Architecture
48
+ -
49
+
50
+ ## Data Flow
51
+ -
52
+
53
+ ## State Transitions
54
+ -
55
+
56
+ ## Failure Modes and Mitigation
57
+ -
58
+
59
+ ## Test Strategy
60
+ - Unit:
61
+ - Integration:
62
+ - E2E:
63
+
64
+ ## Performance Budget
65
+ -
66
+ `,
67
+ "04-spec.md": `# Specification Artifact
68
+
69
+ ## Acceptance Criteria
70
+ -
71
+
72
+ ## Constraints
73
+ -
74
+
75
+ ## Assumptions
76
+ -
77
+
78
+ ## Edge Cases
79
+ -
80
+
81
+ ## Testability Notes
82
+ -
83
+ `,
84
+ "05-plan.md": `# Plan Artifact
85
+
86
+ ## Task Graph
87
+ -
88
+
89
+ ## Dependency Waves
90
+
91
+ ### Wave 1 (foundation)
92
+ - Task IDs:
93
+ - Verification gate:
94
+
95
+ ### Wave 2 (dependent)
96
+ - Task IDs:
97
+ - Depends on:
98
+ - Verification gate:
99
+
100
+ ### Wave 3 (integration)
101
+ - Task IDs:
102
+ - Depends on:
103
+ - Verification gate:
104
+
105
+ Execution rule: complete and verify each wave before starting the next wave.
106
+
107
+ ## Ordered Tasks
108
+ 1.
109
+ 2.
110
+
111
+ ## Acceptance Mapping
112
+ - Task 1 -> Criteria:
113
+
114
+ ## Checkpoints
115
+ -
116
+
117
+ ## User Confirmation
118
+ - Status: pending
119
+ - Confirmed by:
120
+ `,
121
+ "06-tdd.md": `# TDD Artifact
122
+
123
+ ## RED Evidence
124
+ - Test:
125
+ - Failure output:
126
+
127
+ ## GREEN Result
128
+ - Passing suite summary:
129
+
130
+ ## REFACTOR Notes
131
+ -
132
+ `,
133
+ "07-review.md": `# Review Artifact
134
+
135
+ ## Spec Compliance
136
+ - Status:
137
+ - Findings:
138
+
139
+ ## Code Quality
140
+ - Status:
141
+ - Security:
142
+ - Performance:
143
+ - Maintainability:
144
+
145
+ ## Severity Log
146
+ - Critical:
147
+ - Important:
148
+ - Minor:
149
+
150
+ ## Ready to Ship
151
+ - yes/no
152
+ `,
153
+ "07-review-army.json": `{
154
+ "version": 1,
155
+ "generatedAt": "",
156
+ "scope": {
157
+ "base": "",
158
+ "head": "",
159
+ "files": []
160
+ },
161
+ "findings": [
162
+ {
163
+ "id": "",
164
+ "title": "",
165
+ "severity": "Critical",
166
+ "confidence": 7,
167
+ "category": "correctness",
168
+ "location": {
169
+ "file": "",
170
+ "line": 0
171
+ },
172
+ "fingerprint": "",
173
+ "reportedBy": [],
174
+ "status": "open",
175
+ "recommendation": ""
176
+ }
177
+ ],
178
+ "reconciliation": {
179
+ "duplicatesCollapsed": 0,
180
+ "conflicts": [],
181
+ "multiSpecialistConfirmed": [],
182
+ "shipBlockers": []
183
+ }
184
+ }
185
+ `,
186
+ "08-ship.md": `# Ship Artifact
187
+
188
+ ## Pre-Ship Checks
189
+ - Review pass:
190
+ - Tests pass:
191
+
192
+ ## Release Notes
193
+ -
194
+
195
+ ## Rollback Plan
196
+ - Trigger conditions:
197
+ - Rollback steps:
198
+
199
+ ## Branch Finalization
200
+ - [ ] merge
201
+ - [ ] pull request
202
+ - [ ] keep branch
203
+ - [ ] discard branch
204
+ `
205
+ };
206
+ export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
207
+
208
+ ## MUST_ALWAYS
209
+ - Follow flow order: brainstorm -> scope -> design -> spec -> plan -> test -> build -> review -> ship
210
+ - Require explicit user confirmation after /plan before /test or /build
211
+ - Keep evidence artifacts in \`.cclaw/artifacts/\`
212
+ - Enforce RED before GREEN in TDD
213
+ - Run two-layer review (spec_compliance and code_quality) before ship
214
+ - Validate all inputs before processing — never trust external data without sanitization
215
+ - Prefer immutable data patterns and pure functions where the language supports them
216
+ - Follow existing repo conventions, patterns, and directory structure — match the codebase
217
+ - Verify claims with fresh evidence: "tests pass" requires running tests in this message
218
+ - Use conventional commits: \`type(scope): description\` (feat, fix, refactor, test, docs, chore)
219
+
220
+ ## MUST_NEVER
221
+ - Skip /test and jump directly to /build
222
+ - Ship with critical review findings
223
+ - Start implementation during /brainstorm
224
+ - Modify generated cclaw files manually when CLI can regenerate them
225
+ - Commit \`.cclaw/\` or generated shim files
226
+ - Expose secrets, tokens, API keys, or absolute system paths in agent output
227
+ - Duplicate existing functionality without explicit justification — search before building
228
+ - Bypass security checks, linting hooks, or type checking to "move faster"
229
+ - Claim success ("Done," "All good," "Tests pass") without running verification in this message
230
+ - Make changes outside the blast radius of the current task without user consent
231
+
232
+ ## DELEGATION
233
+ When a task requires specialist knowledge (security audit, performance profiling, database review),
234
+ delegate to a specialized agent or skill if the harness supports it. The primary agent should:
235
+ 1. Identify the specialist domain
236
+ 2. Provide focused context (relevant files, the specific concern)
237
+ 3. Evaluate the specialist output before acting on it — do not blindly apply recommendations
238
+ `;
239
+ export function buildRulesJson() {
240
+ return {
241
+ version: 1,
242
+ stage_order: COMMAND_FILE_ORDER,
243
+ stage_gates: Object.fromEntries(orderedStageSchemas().map((schema) => [
244
+ schema.stage,
245
+ schema.requiredGates.map((gate) => gate.id)
246
+ ])),
247
+ MUST_ALWAYS: [
248
+ "flow_order",
249
+ "plan_confirm_gate",
250
+ "artifact_evidence",
251
+ "tdd_red_before_green",
252
+ "two_layer_review_before_ship",
253
+ "validate_inputs",
254
+ "prefer_immutable",
255
+ "follow_repo_conventions",
256
+ "verify_claims_with_evidence",
257
+ "conventional_commits"
258
+ ],
259
+ MUST_NEVER: [
260
+ "skip_test_stage",
261
+ "ship_with_critical_findings",
262
+ "implement_in_brainstorm",
263
+ "manual_edit_generated",
264
+ "commit_cclaw_runtime",
265
+ "expose_secrets_or_paths",
266
+ "duplicate_without_justification",
267
+ "bypass_security_hooks",
268
+ "claim_success_without_verification",
269
+ "changes_outside_blast_radius"
270
+ ]
271
+ };
272
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Utility skills that complement the 9 flow stages.
3
+ * These are contextual lenses, not flow stages.
4
+ * Each skill: ~120-180 lines, under the 500-line progressive disclosure guideline.
5
+ */
6
+ export declare function securityReviewSkill(): string;
7
+ export declare function debuggingSkill(): string;
8
+ export declare function performanceSkill(): string;
9
+ export declare function ciCdSkill(): string;
10
+ export declare function docsSkill(): string;
11
+ export declare const UTILITY_SKILL_FOLDERS: readonly ["security", "debugging", "performance", "ci-cd", "docs"];
12
+ export declare const UTILITY_SKILL_MAP: Record<string, () => string>;