cclaw-cli 0.1.1 → 0.2.1
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/dist/artifact-linter.d.ts +20 -0
- package/dist/artifact-linter.js +368 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +8 -2
- package/dist/config.d.ts +4 -4
- package/dist/config.js +56 -5
- package/dist/constants.d.ts +4 -4
- package/dist/constants.js +6 -3
- package/dist/content/autoplan.js +51 -4
- package/dist/content/contexts.d.ts +9 -0
- package/dist/content/contexts.js +65 -0
- package/dist/content/hooks.d.ts +6 -2
- package/dist/content/hooks.js +448 -16
- package/dist/content/meta-skill.js +26 -0
- package/dist/content/next-command.d.ts +9 -0
- package/dist/content/next-command.js +138 -0
- package/dist/content/observe.d.ts +5 -1
- package/dist/content/observe.js +506 -24
- package/dist/content/skills.js +126 -0
- package/dist/content/stage-schema.d.ts +7 -0
- package/dist/content/stage-schema.js +70 -12
- package/dist/content/subagents.js +33 -0
- package/dist/content/templates.d.ts +1 -0
- package/dist/content/templates.js +182 -77
- package/dist/content/utility-skills.d.ts +5 -1
- package/dist/content/utility-skills.js +208 -2
- package/dist/delegation.d.ts +21 -0
- package/dist/delegation.js +94 -0
- package/dist/doctor.d.ts +5 -1
- package/dist/doctor.js +274 -23
- package/dist/fs-utils.d.ts +10 -0
- package/dist/fs-utils.js +47 -0
- package/dist/gate-evidence.d.ts +26 -0
- package/dist/gate-evidence.js +157 -0
- package/dist/harness-adapters.js +2 -0
- package/dist/hook-schema.d.ts +6 -0
- package/dist/hook-schema.js +45 -0
- package/dist/hook-schemas/claude-hooks.v1.json +12 -0
- package/dist/hook-schemas/codex-hooks.v1.json +12 -0
- package/dist/hook-schemas/cursor-hooks.v1.json +15 -0
- package/dist/install.js +431 -16
- package/dist/policy.d.ts +5 -1
- package/dist/policy.js +52 -1
- package/dist/runs.js +8 -3
- package/dist/trace-matrix.d.ts +13 -0
- package/dist/trace-matrix.js +182 -0
- package/dist/types.d.ts +11 -1
- package/package.json +1 -1
|
@@ -4,86 +4,130 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
4
4
|
"01-brainstorm.md": `# Brainstorm Artifact
|
|
5
5
|
|
|
6
6
|
## Problem Statement
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
-
|
|
22
|
-
|
|
7
|
+
- User problem:
|
|
8
|
+
- Success signal:
|
|
9
|
+
- Constraints:
|
|
10
|
+
|
|
11
|
+
## Alternatives Table
|
|
12
|
+
| Option | Summary | Trade-offs | Recommendation |
|
|
13
|
+
|---|---|---|---|
|
|
14
|
+
| A | | | |
|
|
15
|
+
| B | | | |
|
|
16
|
+
| C | | | |
|
|
17
|
+
|
|
18
|
+
## Approved Direction
|
|
19
|
+
- Selected option:
|
|
20
|
+
- Why selected:
|
|
21
|
+
- Approval marker:
|
|
22
|
+
|
|
23
|
+
## Open Questions
|
|
24
|
+
- None
|
|
23
25
|
`,
|
|
24
26
|
"02-scope.md": `# Scope Artifact
|
|
25
27
|
|
|
28
|
+
## Prime Directives
|
|
29
|
+
- Zero silent failures:
|
|
30
|
+
- Every error has a name:
|
|
31
|
+
- Four paths per data flow:
|
|
32
|
+
|
|
33
|
+
## Premise Challenge
|
|
34
|
+
- Is this the right problem?
|
|
35
|
+
- Why this path?
|
|
36
|
+
- What if we do nothing?
|
|
37
|
+
|
|
26
38
|
## Scope Mode
|
|
27
39
|
- [ ] expand
|
|
28
40
|
- [ ] selective
|
|
29
41
|
- [ ] hold
|
|
30
42
|
- [ ] reduce
|
|
31
43
|
|
|
32
|
-
## In Scope
|
|
33
|
-
-
|
|
44
|
+
## In Scope / Out of Scope
|
|
34
45
|
|
|
35
|
-
|
|
46
|
+
### In Scope
|
|
36
47
|
-
|
|
37
48
|
|
|
38
|
-
|
|
49
|
+
### Out of Scope
|
|
39
50
|
-
|
|
40
51
|
|
|
41
|
-
##
|
|
42
|
-
|
|
43
|
-
|
|
52
|
+
## Deferred Items
|
|
53
|
+
| Item | Rationale |
|
|
54
|
+
|---|---|
|
|
55
|
+
| | |
|
|
56
|
+
|
|
57
|
+
## Error & Rescue Registry
|
|
58
|
+
| Capability | Failure mode | Detection | Fallback |
|
|
59
|
+
|---|---|---|---|
|
|
60
|
+
| | | | |
|
|
61
|
+
|
|
62
|
+
## Scope Summary
|
|
63
|
+
- Selected mode:
|
|
64
|
+
- Accepted scope:
|
|
65
|
+
- Deferred:
|
|
66
|
+
- Explicitly excluded:
|
|
44
67
|
`,
|
|
45
68
|
"03-design.md": `# Design Artifact
|
|
46
69
|
|
|
47
|
-
## Architecture
|
|
48
|
-
|
|
70
|
+
## Architecture Boundaries
|
|
71
|
+
| Component | Responsibility | Owner |
|
|
72
|
+
|---|---|---|
|
|
73
|
+
| | | |
|
|
49
74
|
|
|
50
75
|
## Data Flow
|
|
51
|
-
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
-
|
|
76
|
+
- Happy path:
|
|
77
|
+
- Nil/empty input path:
|
|
78
|
+
- Upstream error path:
|
|
79
|
+
- Timeout/downstream path:
|
|
55
80
|
|
|
56
|
-
## Failure
|
|
57
|
-
|
|
81
|
+
## Failure Mode Table
|
|
82
|
+
| Failure mode | Trigger | Detection | Mitigation | User impact |
|
|
83
|
+
|---|---|---|---|---|
|
|
84
|
+
| | | | | |
|
|
58
85
|
|
|
59
86
|
## Test Strategy
|
|
60
87
|
- Unit:
|
|
61
88
|
- Integration:
|
|
62
89
|
- E2E:
|
|
63
90
|
|
|
64
|
-
##
|
|
91
|
+
## NOT in scope
|
|
65
92
|
-
|
|
93
|
+
|
|
94
|
+
## Parallelization Strategy
|
|
95
|
+
- Parallel lanes:
|
|
96
|
+
- Conflict risks:
|
|
97
|
+
|
|
98
|
+
## Unresolved Decisions
|
|
99
|
+
| Decision | Missing info | Owner | Default |
|
|
100
|
+
|---|---|---|---|
|
|
101
|
+
| | | | |
|
|
66
102
|
`,
|
|
67
103
|
"04-spec.md": `# Specification Artifact
|
|
68
104
|
|
|
69
105
|
## Acceptance Criteria
|
|
70
|
-
|
|
106
|
+
| ID | Criterion (observable/measurable/falsifiable) |
|
|
107
|
+
|---|---|
|
|
108
|
+
| AC-1 | |
|
|
71
109
|
|
|
72
|
-
##
|
|
73
|
-
|
|
110
|
+
## Edge Cases
|
|
111
|
+
| Criterion ID | Boundary case | Error case |
|
|
112
|
+
|---|---|---|
|
|
113
|
+
| AC-1 | | |
|
|
74
114
|
|
|
75
|
-
## Assumptions
|
|
76
|
-
-
|
|
115
|
+
## Constraints and Assumptions
|
|
116
|
+
- Constraints:
|
|
117
|
+
- Assumptions:
|
|
77
118
|
|
|
78
|
-
##
|
|
79
|
-
|
|
119
|
+
## Testability Map
|
|
120
|
+
| Criterion ID | Verification approach | Command/manual steps |
|
|
121
|
+
|---|---|---|
|
|
122
|
+
| AC-1 | | |
|
|
80
123
|
|
|
81
|
-
##
|
|
82
|
-
-
|
|
124
|
+
## Approval
|
|
125
|
+
- Approved by:
|
|
126
|
+
- Date:
|
|
83
127
|
`,
|
|
84
128
|
"05-plan.md": `# Plan Artifact
|
|
85
129
|
|
|
86
|
-
##
|
|
130
|
+
## Dependency Graph
|
|
87
131
|
-
|
|
88
132
|
|
|
89
133
|
## Dependency Waves
|
|
@@ -104,51 +148,80 @@ export const ARTIFACT_TEMPLATES = {
|
|
|
104
148
|
|
|
105
149
|
Execution rule: complete and verify each wave before starting the next wave.
|
|
106
150
|
|
|
107
|
-
##
|
|
108
|
-
|
|
109
|
-
|
|
151
|
+
## Task List
|
|
152
|
+
| Task ID | Description | Acceptance criterion | Verification command |
|
|
153
|
+
|---|---|---|---|
|
|
154
|
+
| T-1 | | | |
|
|
110
155
|
|
|
111
156
|
## Acceptance Mapping
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
-
|
|
157
|
+
| Criterion ID | Task IDs |
|
|
158
|
+
|---|---|
|
|
159
|
+
| AC-1 | T-1 |
|
|
116
160
|
|
|
117
|
-
##
|
|
161
|
+
## WAIT_FOR_CONFIRM
|
|
118
162
|
- Status: pending
|
|
119
163
|
- Confirmed by:
|
|
120
164
|
`,
|
|
121
165
|
"06-tdd.md": `# TDD Artifact
|
|
122
166
|
|
|
123
167
|
## RED Evidence
|
|
124
|
-
|
|
125
|
-
|
|
168
|
+
| Slice | Test name | Command | Failure output summary |
|
|
169
|
+
|---|---|---|---|
|
|
170
|
+
| S-1 | | | |
|
|
126
171
|
|
|
127
|
-
##
|
|
128
|
-
|
|
172
|
+
## Acceptance Mapping
|
|
173
|
+
| Slice | Plan task ID | Spec criterion ID |
|
|
174
|
+
|---|---|---|
|
|
175
|
+
| S-1 | T-1 | AC-1 |
|
|
176
|
+
|
|
177
|
+
## Failure Analysis
|
|
178
|
+
| Slice | Expected missing behavior | Actual failure reason |
|
|
179
|
+
|---|---|---|
|
|
180
|
+
| S-1 | | |
|
|
181
|
+
|
|
182
|
+
## GREEN Evidence
|
|
183
|
+
- Full suite command:
|
|
184
|
+
- Full suite result:
|
|
129
185
|
|
|
130
186
|
## REFACTOR Notes
|
|
131
|
-
-
|
|
187
|
+
- What changed:
|
|
188
|
+
- Why:
|
|
189
|
+
- Behavior preserved:
|
|
190
|
+
|
|
191
|
+
## Traceability
|
|
192
|
+
- Plan task IDs:
|
|
193
|
+
- Spec criterion IDs:
|
|
132
194
|
`,
|
|
133
195
|
"07-review.md": `# Review Artifact
|
|
134
196
|
|
|
135
|
-
##
|
|
136
|
-
|
|
137
|
-
|
|
197
|
+
## Layer 1 Verdict
|
|
198
|
+
| Criterion | Verdict | Evidence |
|
|
199
|
+
|---|---|---|
|
|
200
|
+
| AC-1 | PASS/FAIL | |
|
|
138
201
|
|
|
139
|
-
##
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
-
|
|
143
|
-
- Maintainability:
|
|
202
|
+
## Layer 2 Findings
|
|
203
|
+
| ID | Severity | Category | Description | Status |
|
|
204
|
+
|---|---|---|---|---|
|
|
205
|
+
| R-1 | Critical/Important/Suggestion | correctness/security/performance/architecture | | open/resolved |
|
|
144
206
|
|
|
145
|
-
##
|
|
207
|
+
## Review Army Contract
|
|
208
|
+
- See \`07-review-army.json\`
|
|
209
|
+
- Reconciliation summary:
|
|
210
|
+
|
|
211
|
+
## Review Readiness Dashboard
|
|
212
|
+
- Layer 1 complete:
|
|
213
|
+
- Layer 2 complete:
|
|
214
|
+
- Review army schema valid:
|
|
215
|
+
- Open critical blockers:
|
|
216
|
+
- Ship recommendation:
|
|
217
|
+
|
|
218
|
+
## Severity Summary
|
|
146
219
|
- Critical:
|
|
147
220
|
- Important:
|
|
148
|
-
-
|
|
221
|
+
- Suggestion:
|
|
149
222
|
|
|
150
|
-
##
|
|
151
|
-
-
|
|
223
|
+
## Final Verdict
|
|
224
|
+
- APPROVED | APPROVED_WITH_CONCERNS | BLOCKED
|
|
152
225
|
`,
|
|
153
226
|
"07-review-army.json": `{
|
|
154
227
|
"version": 1,
|
|
@@ -185,22 +258,35 @@ Execution rule: complete and verify each wave before starting the next wave.
|
|
|
185
258
|
`,
|
|
186
259
|
"08-ship.md": `# Ship Artifact
|
|
187
260
|
|
|
188
|
-
##
|
|
189
|
-
- Review
|
|
190
|
-
-
|
|
261
|
+
## Preflight Results
|
|
262
|
+
- Review verdict:
|
|
263
|
+
- Build:
|
|
264
|
+
- Tests:
|
|
265
|
+
- Lint:
|
|
266
|
+
- Type-check:
|
|
267
|
+
- Working tree clean:
|
|
191
268
|
|
|
192
269
|
## Release Notes
|
|
193
|
-
-
|
|
270
|
+
-
|
|
194
271
|
|
|
195
272
|
## Rollback Plan
|
|
196
273
|
- Trigger conditions:
|
|
197
274
|
- Rollback steps:
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
203
|
-
|
|
275
|
+
- Verification steps:
|
|
276
|
+
|
|
277
|
+
## Monitoring
|
|
278
|
+
- Metrics/logs to watch:
|
|
279
|
+
- Risk note (if no monitoring):
|
|
280
|
+
|
|
281
|
+
## Finalization
|
|
282
|
+
- Selected enum (exactly one):
|
|
283
|
+
- FINALIZE_MERGE_LOCAL
|
|
284
|
+
- FINALIZE_OPEN_PR
|
|
285
|
+
- FINALIZE_KEEP_BRANCH
|
|
286
|
+
- FINALIZE_DISCARD_BRANCH
|
|
287
|
+
- Selected label (A/B/C/D):
|
|
288
|
+
- Execution result:
|
|
289
|
+
- PR URL / merge commit / kept branch / discard confirmation:
|
|
204
290
|
`
|
|
205
291
|
};
|
|
206
292
|
export const RULEBOOK_MARKDOWN = `# Cclaw Rulebook
|
|
@@ -236,6 +322,25 @@ delegate to a specialized agent or skill if the harness supports it. The primary
|
|
|
236
322
|
2. Provide focused context (relevant files, the specific concern)
|
|
237
323
|
3. Evaluate the specialist output before acting on it — do not blindly apply recommendations
|
|
238
324
|
`;
|
|
325
|
+
export const CURSOR_WORKFLOW_RULE_MDC = `---
|
|
326
|
+
description: cclaw workflow guardrails for Cursor agent sessions
|
|
327
|
+
globs:
|
|
328
|
+
- "**/*"
|
|
329
|
+
alwaysApply: true
|
|
330
|
+
---
|
|
331
|
+
|
|
332
|
+
<!-- cclaw-managed-cursor-workflow-rule -->
|
|
333
|
+
|
|
334
|
+
# Cclaw Workflow Guardrails
|
|
335
|
+
|
|
336
|
+
- Follow stage order: brainstorm -> scope -> design -> spec -> plan -> test -> build -> review -> ship.
|
|
337
|
+
- Read \`.cclaw/state/flow-state.json\` before acting; continue from current stage when active.
|
|
338
|
+
- Use \`/cc-next\` only after required gates pass; never bypass explicit pause/approval rules.
|
|
339
|
+
- Keep evidence in \`.cclaw/artifacts/\` and canonical run copies in \`.cclaw/runs/<activeRunId>/artifacts/\`.
|
|
340
|
+
- For machine-only checks in design/plan/test/build/review/ship, dispatch required specialists automatically when tooling supports it.
|
|
341
|
+
- Ask for user input only at explicit approval gates (scope mode, plan approval, user challenge resolution, ship finalization).
|
|
342
|
+
- Treat \`.cclaw/skills/using-cclaw/SKILL.md\` as routing source of truth; load contextual utility skills only when their triggers apply.
|
|
343
|
+
`;
|
|
239
344
|
export function buildRulesJson() {
|
|
240
345
|
return {
|
|
241
346
|
version: 1,
|
|
@@ -8,5 +8,9 @@ export declare function debuggingSkill(): string;
|
|
|
8
8
|
export declare function performanceSkill(): string;
|
|
9
9
|
export declare function ciCdSkill(): string;
|
|
10
10
|
export declare function docsSkill(): string;
|
|
11
|
-
export declare
|
|
11
|
+
export declare function executingPlansSkill(): string;
|
|
12
|
+
export declare function contextEngineeringSkill(): string;
|
|
13
|
+
export declare function sourceDrivenDevelopmentSkill(): string;
|
|
14
|
+
export declare function frontendAccessibilitySkill(): string;
|
|
15
|
+
export declare const UTILITY_SKILL_FOLDERS: readonly ["security", "debugging", "performance", "ci-cd", "docs", "executing-plans", "context-engineering", "source-driven-development", "frontend-accessibility"];
|
|
12
16
|
export declare const UTILITY_SKILL_MAP: Record<string, () => string>;
|
|
@@ -170,6 +170,26 @@ Build fails
|
|
|
170
170
|
└── OOM / timeout? → Check input size, increase limits
|
|
171
171
|
\`\`\`
|
|
172
172
|
|
|
173
|
+
## Testing-Specific Anti-Patterns
|
|
174
|
+
|
|
175
|
+
When debugging test failures, treat these as root-cause signals, not noise:
|
|
176
|
+
|
|
177
|
+
- **Blind snapshot updates** (\`-u\`/accept-all) without verifying intent. This hides regressions.
|
|
178
|
+
- **Mocking internals instead of boundaries** (private functions, implementation details) which creates brittle tests.
|
|
179
|
+
- **Time-based sleeps** (\`setTimeout\`, arbitrary waits) instead of deterministic synchronization (\`await\` actual signal/event).
|
|
180
|
+
- **Shared mutable fixtures** reused across tests, causing order-dependent failures.
|
|
181
|
+
- **Unseeded randomness** in tests without fixed seeds or deterministic fixtures.
|
|
182
|
+
- **Leaking global state** (env vars, fake timers, singleton caches) between tests without teardown.
|
|
183
|
+
- **Disabling flaky tests** rather than isolating and fixing the non-determinism.
|
|
184
|
+
|
|
185
|
+
### CI-only failure checklist
|
|
186
|
+
|
|
187
|
+
If a test fails only in CI:
|
|
188
|
+
1. Compare runtime versions (Node/Java/Python), OS, and locale/timezone.
|
|
189
|
+
2. Check parallelism differences (worker count, test sharding, race conditions).
|
|
190
|
+
3. Check filesystem/network assumptions (case sensitivity, permissions, ephemeral ports).
|
|
191
|
+
4. Re-run locally with CI-like env vars and concurrency settings before changing production code.
|
|
192
|
+
|
|
173
193
|
## Anti-Patterns
|
|
174
194
|
|
|
175
195
|
- Fixing the symptom (adding a null check) instead of the root cause (why is it null?)
|
|
@@ -451,17 +471,203 @@ For public APIs:
|
|
|
451
471
|
- Documenting internal implementation details of public APIs
|
|
452
472
|
`;
|
|
453
473
|
}
|
|
474
|
+
export function executingPlansSkill() {
|
|
475
|
+
return `---
|
|
476
|
+
name: executing-plans
|
|
477
|
+
description: "Execute approved plans with disciplined batching, explicit checkpoints, and gate-safe progress tracking."
|
|
478
|
+
---
|
|
479
|
+
|
|
480
|
+
# Executing Plans
|
|
481
|
+
|
|
482
|
+
## Quick Start
|
|
483
|
+
|
|
484
|
+
> 1. Confirm the plan and stage gates are approved before execution.
|
|
485
|
+
> 2. Execute in batches (waves), not as one giant untracked stream.
|
|
486
|
+
> 3. Stop at checkpoint boundaries for verification and user visibility.
|
|
487
|
+
|
|
488
|
+
## HARD-GATE
|
|
489
|
+
|
|
490
|
+
Do not start implementation execution without an approved plan artifact and explicit gate satisfaction for the current stage.
|
|
491
|
+
|
|
492
|
+
## Execution Protocol
|
|
493
|
+
|
|
494
|
+
1. **Load plan source of truth** from \`.cclaw/artifacts/05-plan.md\` (canonical run copy when available).
|
|
495
|
+
2. **Group tasks into waves** by dependency order and risk.
|
|
496
|
+
3. **Run one wave at a time** with evidence after each task (tests, build, lint, or review evidence as applicable).
|
|
497
|
+
4. **Checkpoint each wave** by updating stage artifact evidence and unresolved blockers.
|
|
498
|
+
5. **Stop immediately** on any hard blocker, failing gate, or unresolved critical finding.
|
|
499
|
+
|
|
500
|
+
## Wave Checklist
|
|
501
|
+
|
|
502
|
+
- Wave scope is explicit (task IDs + expected outputs).
|
|
503
|
+
- Verification command for each task is predetermined.
|
|
504
|
+
- Machine-only checks are delegated to subagents when supported.
|
|
505
|
+
- User approvals are requested only at required gate boundaries.
|
|
506
|
+
|
|
507
|
+
## Anti-Patterns
|
|
508
|
+
|
|
509
|
+
- Executing all tasks in one pass without intermediate verification.
|
|
510
|
+
- Marking tasks done without command evidence.
|
|
511
|
+
- Reordering critical dependencies for speed.
|
|
512
|
+
- Continuing after a gate failure hoping later tasks fix it.
|
|
513
|
+
`;
|
|
514
|
+
}
|
|
515
|
+
export function contextEngineeringSkill() {
|
|
516
|
+
return `---
|
|
517
|
+
name: context-engineering
|
|
518
|
+
description: "Manage context modes and payload hygiene to keep agent execution reliable across long sessions."
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
# Context Engineering
|
|
522
|
+
|
|
523
|
+
## Quick Start
|
|
524
|
+
|
|
525
|
+
> 1. Read current mode from \`.cclaw/state/context-mode.json\`.
|
|
526
|
+
> 2. Load only the context needed for the current stage/task.
|
|
527
|
+
> 3. Switch modes intentionally when work type changes.
|
|
528
|
+
|
|
529
|
+
## HARD-GATE
|
|
530
|
+
|
|
531
|
+
Do not keep stale or oversized context loaded when task intent changes. Context must match current stage purpose.
|
|
532
|
+
|
|
533
|
+
## Context Modes
|
|
534
|
+
|
|
535
|
+
Modes are stored in \`.cclaw/contexts/\`:
|
|
536
|
+
- \`default\` — balanced execution
|
|
537
|
+
- \`execution\` — fast plan/test/build throughput
|
|
538
|
+
- \`review\` — defect/risk discovery
|
|
539
|
+
- \`incident\` — stabilization and recovery
|
|
540
|
+
|
|
541
|
+
## Mode Switching Protocol
|
|
542
|
+
|
|
543
|
+
1. Determine target mode based on current objective.
|
|
544
|
+
2. Update \`.cclaw/state/context-mode.json\`:
|
|
545
|
+
- \`activeMode\`: target mode id
|
|
546
|
+
- \`updatedAt\`: current ISO timestamp
|
|
547
|
+
3. Announce mode change in-session with one-line reason.
|
|
548
|
+
4. Continue using the corresponding \`.cclaw/contexts/<mode>.md\` guidance.
|
|
549
|
+
|
|
550
|
+
## Payload Hygiene Rules
|
|
551
|
+
|
|
552
|
+
- Prefer stage artifacts + current diff over full-repo dumps.
|
|
553
|
+
- Reference exact files/symbols, not broad vague prompts.
|
|
554
|
+
- For subagents, pass self-contained instructions and expected output schema.
|
|
555
|
+
- Trim or rotate outdated context after each major checkpoint.
|
|
556
|
+
|
|
557
|
+
## Anti-Patterns
|
|
558
|
+
|
|
559
|
+
- Staying in execution mode while doing deep review triage.
|
|
560
|
+
- Switching mode without updating state.
|
|
561
|
+
- Shipping decisions based on stale pre-compaction context.
|
|
562
|
+
`;
|
|
563
|
+
}
|
|
564
|
+
export function sourceDrivenDevelopmentSkill() {
|
|
565
|
+
return `---
|
|
566
|
+
name: source-driven-development
|
|
567
|
+
description: "Drive implementation decisions from existing source patterns before introducing new abstractions."
|
|
568
|
+
---
|
|
569
|
+
|
|
570
|
+
# Source-Driven Development
|
|
571
|
+
|
|
572
|
+
## Quick Start
|
|
573
|
+
|
|
574
|
+
> 1. Search the repo for existing patterns before writing new code.
|
|
575
|
+
> 2. Reuse proven modules/contracts unless a clear incompatibility is documented.
|
|
576
|
+
> 3. Record deviations with rationale when creating net-new patterns.
|
|
577
|
+
|
|
578
|
+
## HARD-GATE
|
|
579
|
+
|
|
580
|
+
Do not introduce new architecture patterns or helper layers without first checking whether an equivalent source pattern already exists.
|
|
581
|
+
|
|
582
|
+
## Protocol
|
|
583
|
+
|
|
584
|
+
1. **Discover**: inspect related modules, adapters, tests, and conventions.
|
|
585
|
+
2. **Compare**: list at least two in-repo pattern candidates.
|
|
586
|
+
3. **Select**: choose reuse/extension/new with explicit rationale.
|
|
587
|
+
4. **Implement**: follow selected pattern consistently across touched files.
|
|
588
|
+
5. **Verify**: ensure tests and docs reflect the adopted pattern.
|
|
589
|
+
|
|
590
|
+
## Selection Heuristics
|
|
591
|
+
|
|
592
|
+
- Prefer extension over duplication.
|
|
593
|
+
- Prefer explicit local adaptation over global abstraction when scope is narrow.
|
|
594
|
+
- Prefer tested, production-used patterns over speculative design.
|
|
595
|
+
|
|
596
|
+
## Required Evidence
|
|
597
|
+
|
|
598
|
+
- Paths of source references reused.
|
|
599
|
+
- Rationale for any intentional divergence.
|
|
600
|
+
- Tests proving behavior compatibility.
|
|
601
|
+
|
|
602
|
+
## Anti-Patterns
|
|
603
|
+
|
|
604
|
+
- Creating “better” abstractions without source comparison.
|
|
605
|
+
- Duplicating utility logic under a new name.
|
|
606
|
+
- Mixing incompatible patterns in the same change set.
|
|
607
|
+
`;
|
|
608
|
+
}
|
|
609
|
+
export function frontendAccessibilitySkill() {
|
|
610
|
+
return `---
|
|
611
|
+
name: frontend-accessibility
|
|
612
|
+
description: "Frontend quality lens for usability and accessibility (WCAG-oriented) during implementation and review."
|
|
613
|
+
---
|
|
614
|
+
|
|
615
|
+
# Frontend Accessibility
|
|
616
|
+
|
|
617
|
+
## Quick Start
|
|
618
|
+
|
|
619
|
+
> 1. Validate keyboard navigation and focus order first.
|
|
620
|
+
> 2. Confirm semantic roles/labels and screen-reader announcements.
|
|
621
|
+
> 3. Check contrast, motion, and responsive behavior before ship.
|
|
622
|
+
|
|
623
|
+
## HARD-GATE
|
|
624
|
+
|
|
625
|
+
Do not approve user-facing UI changes that break basic keyboard navigation or remove accessible name/role/value semantics.
|
|
626
|
+
|
|
627
|
+
## Checklist
|
|
628
|
+
|
|
629
|
+
1. Interactive elements are reachable and usable via keyboard only.
|
|
630
|
+
2. Focus indicators are visible and logical after navigation and dialogs.
|
|
631
|
+
3. Form fields have labels, error messages, and instructions tied programmatically.
|
|
632
|
+
4. Color contrast meets WCAG AA expectations for text and controls.
|
|
633
|
+
5. Dynamic updates (toasts/modals/async states) are announced accessibly.
|
|
634
|
+
6. Motion/animation respects reduced-motion preferences where relevant.
|
|
635
|
+
7. Mobile and narrow layouts preserve readability and interaction targets.
|
|
636
|
+
|
|
637
|
+
## Output Format
|
|
638
|
+
|
|
639
|
+
- **Issue**: concise defect description
|
|
640
|
+
- **Impact**: affected users and severity
|
|
641
|
+
- **Evidence**: file/component path and failing behavior
|
|
642
|
+
- **Fix**: concrete remediation guidance
|
|
643
|
+
|
|
644
|
+
## Anti-Patterns
|
|
645
|
+
|
|
646
|
+
- Relying on placeholder text as the only form label.
|
|
647
|
+
- Click-only interactions without keyboard fallback.
|
|
648
|
+
- Hiding focus ring without accessible replacement.
|
|
649
|
+
- Color-only status indicators with no text/aria support.
|
|
650
|
+
`;
|
|
651
|
+
}
|
|
454
652
|
export const UTILITY_SKILL_FOLDERS = [
|
|
455
653
|
"security",
|
|
456
654
|
"debugging",
|
|
457
655
|
"performance",
|
|
458
656
|
"ci-cd",
|
|
459
|
-
"docs"
|
|
657
|
+
"docs",
|
|
658
|
+
"executing-plans",
|
|
659
|
+
"context-engineering",
|
|
660
|
+
"source-driven-development",
|
|
661
|
+
"frontend-accessibility"
|
|
460
662
|
];
|
|
461
663
|
export const UTILITY_SKILL_MAP = {
|
|
462
664
|
security: securityReviewSkill,
|
|
463
665
|
debugging: debuggingSkill,
|
|
464
666
|
performance: performanceSkill,
|
|
465
667
|
"ci-cd": ciCdSkill,
|
|
466
|
-
docs: docsSkill
|
|
668
|
+
docs: docsSkill,
|
|
669
|
+
"executing-plans": executingPlansSkill,
|
|
670
|
+
"context-engineering": contextEngineeringSkill,
|
|
671
|
+
"source-driven-development": sourceDrivenDevelopmentSkill,
|
|
672
|
+
"frontend-accessibility": frontendAccessibilitySkill
|
|
467
673
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { FlowStage } from "./types.js";
|
|
2
|
+
export type DelegationEntry = {
|
|
3
|
+
stage: string;
|
|
4
|
+
agent: string;
|
|
5
|
+
mode: "mandatory" | "proactive";
|
|
6
|
+
status: "scheduled" | "completed" | "failed" | "waived";
|
|
7
|
+
taskId?: string;
|
|
8
|
+
waiverReason?: string;
|
|
9
|
+
ts: string;
|
|
10
|
+
};
|
|
11
|
+
export type DelegationLedger = {
|
|
12
|
+
runId: string;
|
|
13
|
+
entries: DelegationEntry[];
|
|
14
|
+
};
|
|
15
|
+
export declare function readDelegationLedger(projectRoot: string): Promise<DelegationLedger>;
|
|
16
|
+
export declare function appendDelegation(projectRoot: string, entry: DelegationEntry): Promise<void>;
|
|
17
|
+
export declare function checkMandatoryDelegations(projectRoot: string, stage: FlowStage): Promise<{
|
|
18
|
+
satisfied: boolean;
|
|
19
|
+
missing: string[];
|
|
20
|
+
waived: string[];
|
|
21
|
+
}>;
|