cclaw-cli 1.0.0 → 3.0.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/dist/artifact-linter/brainstorm.js +15 -1
- package/dist/artifact-linter/design.js +14 -0
- package/dist/artifact-linter/scope.js +14 -0
- package/dist/artifact-linter/shared.d.ts +1 -0
- package/dist/artifact-linter/shared.js +32 -0
- package/dist/artifact-linter.js +13 -5
- package/dist/cli.js +2 -9
- package/dist/config.d.ts +11 -67
- package/dist/config.js +59 -649
- package/dist/content/hook-events.js +1 -5
- package/dist/content/hook-manifest.d.ts +6 -4
- package/dist/content/hook-manifest.js +16 -65
- package/dist/content/hooks.js +54 -14
- package/dist/content/meta-skill.js +4 -3
- package/dist/content/node-hooks.d.ts +0 -26
- package/dist/content/node-hooks.js +459 -157
- package/dist/content/observe.js +5 -4
- package/dist/content/opencode-plugin.js +1 -78
- package/dist/content/skills-elicitation.d.ts +1 -0
- package/dist/content/skills-elicitation.js +123 -0
- package/dist/content/skills.js +6 -4
- package/dist/content/stages/brainstorm.js +7 -3
- package/dist/content/stages/design.js +6 -2
- package/dist/content/stages/plan.js +2 -2
- package/dist/content/stages/scope.js +9 -5
- package/dist/content/stages/tdd.js +11 -11
- package/dist/content/start-command.js +4 -4
- package/dist/content/templates.js +21 -0
- package/dist/flow-state.d.ts +7 -0
- package/dist/flow-state.js +1 -0
- package/dist/gate-evidence.js +1 -5
- package/dist/hook-schema.js +3 -0
- package/dist/hook-schemas/claude-hooks.v1.json +2 -5
- package/dist/hook-schemas/codex-hooks.v1.json +1 -4
- package/dist/hook-schemas/cursor-hooks.v1.json +1 -3
- package/dist/install.d.ts +2 -7
- package/dist/install.js +32 -123
- package/dist/internal/advance-stage/advance.js +22 -1
- package/dist/internal/advance-stage/parsers.d.ts +1 -0
- package/dist/internal/advance-stage/parsers.js +6 -0
- package/dist/internal/compound-readiness.js +1 -16
- package/dist/internal/early-loop-status.js +1 -3
- package/dist/internal/runtime-integrity.js +0 -20
- package/dist/policy.js +6 -9
- package/dist/run-persistence.d.ts +1 -1
- package/dist/run-persistence.js +29 -2
- package/dist/runtime/run-hook.mjs +459 -265
- package/dist/tdd-verification-evidence.js +6 -18
- package/dist/track-heuristics.d.ts +7 -1
- package/dist/track-heuristics.js +12 -0
- package/dist/types.d.ts +0 -56
- package/package.json +1 -1
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { readConfig } from "./config.js";
|
|
3
2
|
import { exists } from "./fs-utils.js";
|
|
4
3
|
export const TEST_COMMAND_HINT_PATTERN = /\b(?:npm test|npm run test(?::[\w:-]+)?|pnpm test|pnpm [\w:-]*test[\w:-]*|yarn test|yarn [\w:-]*test[\w:-]*|bun test|bun run test(?::[\w:-]+)?|vitest|jest|pytest|go test|cargo test|mvn test|gradle test|\.\/gradlew test|dotnet test)\b/iu;
|
|
5
4
|
export const SHA_WITH_LABEL_PATTERN = /\b(?:sha|commit)(?:\s*[:=]|\s+)\s*[0-9a-f]{7,40}\b/iu;
|
|
@@ -8,10 +7,8 @@ export const NO_VCS_ATTESTATION_PATTERN = /\b(?:no[-_ ]?vcs|no git|not a git rep
|
|
|
8
7
|
export const NO_VCS_HASH_PATTERN = /\b(?:content|artifact)[-_ ]?hash\s*[:=]\s*(?:sha256:)?[0-9a-f]{16,64}\b|\bsha256\s*[:=]\s*[0-9a-f]{16,64}\b/iu;
|
|
9
8
|
export async function validateTddVerificationEvidence(projectRoot, evidence, options = {}) {
|
|
10
9
|
const normalized = evidence.trim();
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const configuredVcs = config.vcs ?? "git-local-only";
|
|
14
|
-
const gitPresent = configuredVcs !== "none" && await exists(path.join(projectRoot, ".git"));
|
|
10
|
+
const mode = "auto";
|
|
11
|
+
const gitPresent = await exists(path.join(projectRoot, ".git"));
|
|
15
12
|
const issues = [];
|
|
16
13
|
if (options.requireCommand !== false && !TEST_COMMAND_HINT_PATTERN.test(normalized)) {
|
|
17
14
|
issues.push("GREEN repair needed: include the fresh verification command that was run (for example `npm test`, `pytest`, `go test`, or equivalent).");
|
|
@@ -21,23 +18,14 @@ export async function validateTddVerificationEvidence(projectRoot, evidence, opt
|
|
|
21
18
|
}
|
|
22
19
|
const hasSha = SHA_WITH_LABEL_PATTERN.test(normalized);
|
|
23
20
|
const hasNoVcs = NO_VCS_ATTESTATION_PATTERN.test(normalized);
|
|
24
|
-
|
|
25
|
-
if (mode !== "disabled" && configuredVcs === "none") {
|
|
26
|
-
if (!hasNoVcs) {
|
|
27
|
-
issues.push("NO_VCS_MODE repair needed: include an explicit no-VCS reason because `vcs` is `none`.");
|
|
28
|
-
}
|
|
29
|
-
if (!hasNoVcsHash) {
|
|
30
|
-
issues.push("NO_VCS_MODE repair needed: include a content/artifact hash for no-VCS TDD evidence (for example `artifact-hash: sha256:<hash>`).");
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
else if (mode === "required" && !hasSha) {
|
|
34
|
-
issues.push("must include a commit SHA token prefixed with `sha` or `commit` because `tdd.verificationRef` is `required`.");
|
|
35
|
-
}
|
|
36
|
-
else if (mode === "auto" && gitPresent && !hasSha) {
|
|
21
|
+
if (mode === "auto" && gitPresent && !hasSha) {
|
|
37
22
|
issues.push("must include a commit SHA token prefixed with `sha` or `commit` (for example `sha: abc1234`).");
|
|
38
23
|
}
|
|
39
24
|
else if (mode === "auto" && !gitPresent && !hasSha && !hasNoVcs) {
|
|
40
25
|
issues.push("must include either a commit SHA or an explicit no-VCS attestation (for example `no-vcs: project has no .git directory`).");
|
|
41
26
|
}
|
|
27
|
+
else if (mode === "auto" && !gitPresent && hasNoVcs && !NO_VCS_HASH_PATTERN.test(normalized)) {
|
|
28
|
+
issues.push("NO_VCS_MODE repair needed: include a content/artifact hash for no-VCS TDD evidence (for example `artifact-hash: sha256:<hash>`).");
|
|
29
|
+
}
|
|
42
30
|
return { ok: issues.length === 0, issues, mode, gitPresent };
|
|
43
31
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { FlowTrack, TrackHeuristicRule, TrackHeuristicsConfig } from "./types.js";
|
|
1
|
+
import type { FlowStage, FlowTrack, TrackHeuristicRule, TrackHeuristicsConfig } from "./types.js";
|
|
2
2
|
export interface TrackResolution {
|
|
3
3
|
track: FlowTrack;
|
|
4
4
|
reason: string;
|
|
@@ -6,6 +6,11 @@ export interface TrackResolution {
|
|
|
6
6
|
confidence: "high" | "medium" | "low";
|
|
7
7
|
overrideGuidance: string;
|
|
8
8
|
}
|
|
9
|
+
export interface QuestionBudgetHint {
|
|
10
|
+
min: number;
|
|
11
|
+
recommended: number;
|
|
12
|
+
hardCapWarning: number;
|
|
13
|
+
}
|
|
9
14
|
/**
|
|
10
15
|
* Reference implementation of the track classifier the /cc skill prose
|
|
11
16
|
* describes. Tests pin its behavior so the built-in defaults stay honest.
|
|
@@ -14,6 +19,7 @@ export interface TrackResolution {
|
|
|
14
19
|
* "advisory" language.
|
|
15
20
|
*/
|
|
16
21
|
export declare function resolveTrackFromPrompt(prompt: string, config: TrackHeuristicsConfig | undefined): TrackResolution;
|
|
22
|
+
export declare function questionBudgetHint(track: FlowTrack, stage: FlowStage): QuestionBudgetHint;
|
|
17
23
|
export declare const TRACK_HEURISTICS_DEFAULTS: {
|
|
18
24
|
readonly fallback: "standard";
|
|
19
25
|
readonly evaluationOrder: readonly ("quick" | "medium" | "standard")[];
|
package/dist/track-heuristics.js
CHANGED
|
@@ -54,6 +54,12 @@ const DEFAULT_RULES = {
|
|
|
54
54
|
// into runtime, so cclaw stopped offering the knob in v0.38.0.
|
|
55
55
|
const EVALUATION_ORDER = ["standard", "medium", "quick"];
|
|
56
56
|
const DEFAULT_FALLBACK = "standard";
|
|
57
|
+
const ADAPTIVE_ELICITATION_STAGES = new Set(["brainstorm", "scope", "design"]);
|
|
58
|
+
const QUESTION_BUDGET_HINTS_BY_TRACK = {
|
|
59
|
+
quick: { min: 2, recommended: 3, hardCapWarning: 4 },
|
|
60
|
+
medium: { min: 5, recommended: 6, hardCapWarning: 8 },
|
|
61
|
+
standard: { min: 10, recommended: 12, hardCapWarning: 14 }
|
|
62
|
+
};
|
|
57
63
|
function hasToken(promptLower, token) {
|
|
58
64
|
return promptLower.includes(token.toLowerCase());
|
|
59
65
|
}
|
|
@@ -130,6 +136,12 @@ export function resolveTrackFromPrompt(prompt, config) {
|
|
|
130
136
|
overrideGuidance: "Confirm or override before state is written; choose quick only for known low-blast-radius work, medium for known architecture with product framing, standard for uncertainty."
|
|
131
137
|
};
|
|
132
138
|
}
|
|
139
|
+
export function questionBudgetHint(track, stage) {
|
|
140
|
+
if (!ADAPTIVE_ELICITATION_STAGES.has(stage)) {
|
|
141
|
+
return { min: 0, recommended: 0, hardCapWarning: 0 };
|
|
142
|
+
}
|
|
143
|
+
return QUESTION_BUDGET_HINTS_BY_TRACK[track];
|
|
144
|
+
}
|
|
133
145
|
export const TRACK_HEURISTICS_DEFAULTS = {
|
|
134
146
|
fallback: DEFAULT_FALLBACK,
|
|
135
147
|
evaluationOrder: EVALUATION_ORDER,
|
package/dist/types.d.ts
CHANGED
|
@@ -163,62 +163,6 @@ export interface CclawConfig {
|
|
|
163
163
|
version: string;
|
|
164
164
|
flowVersion: string;
|
|
165
165
|
harnesses: HarnessId[];
|
|
166
|
-
/** Repository evidence mode for stages that need durable verification refs. */
|
|
167
|
-
vcs?: VcsMode;
|
|
168
|
-
/**
|
|
169
|
-
* Single knob that controls enforcement behaviour of all hook-driven guards
|
|
170
|
-
* (prompt guard, workflow guard, TDD enforcement, iron laws). Default:
|
|
171
|
-
* `"advisory"` — hooks append a stderr nudge and exit 0. `"strict"` flips
|
|
172
|
-
* the same hooks to fail-closed (non-zero exit) so the harness refuses the
|
|
173
|
-
* offending action.
|
|
174
|
-
*
|
|
175
|
-
* Per-law escapes live on `ironLaws.strictLaws` for teams that need to keep
|
|
176
|
-
* specific iron laws strict while the project-wide knob stays advisory.
|
|
177
|
-
*/
|
|
178
|
-
strictness?: "advisory" | "strict";
|
|
179
|
-
/**
|
|
180
|
-
* Legacy alias for test-side path detection in workflow-guard.
|
|
181
|
-
* Prefer `tdd.testPathPatterns` in new configs.
|
|
182
|
-
* @deprecated Use `tdd.testPathPatterns` instead.
|
|
183
|
-
*/
|
|
184
|
-
tddTestGlobs?: string[];
|
|
185
|
-
/** Path-pattern routing for TDD test/production write classification. */
|
|
186
|
-
tdd?: TddPathConfig;
|
|
187
|
-
/** Compound-stage recurrence policy overrides. */
|
|
188
|
-
compound?: CompoundConfig;
|
|
189
|
-
/** Early-stage producer/critic loop policy overrides. */
|
|
190
|
-
earlyLoop?: EarlyLoopConfig;
|
|
191
|
-
/** When true, cclaw installs managed git pre-commit/pre-push wrappers. */
|
|
192
|
-
gitHookGuards?: boolean;
|
|
193
|
-
/** Default flow track for new runs (quick = shortened path, standard = full pipeline). */
|
|
194
|
-
defaultTrack?: FlowTrack;
|
|
195
|
-
/**
|
|
196
|
-
* Opt-in language rule packs. Each enabled pack materializes a matching rule
|
|
197
|
-
* file under `.cclaw/rules/lang/<id>.md` on the next `cclaw sync`. The
|
|
198
|
-
* meta-skill router loads the pack during review/tdd when the diff touches
|
|
199
|
-
* the language in question. Disabled packs have no on-disk footprint.
|
|
200
|
-
*/
|
|
201
|
-
languageRulePacks?: LanguageRulePack[];
|
|
202
|
-
/**
|
|
203
|
-
* Optional prompt-to-track vocabulary overrides for /cc classification.
|
|
204
|
-
* Advisory (surfaced in the /cc skill prose), not machine-enforced.
|
|
205
|
-
* If omitted, cclaw uses built-in defaults.
|
|
206
|
-
*/
|
|
207
|
-
trackHeuristics?: TrackHeuristicsConfig;
|
|
208
|
-
/**
|
|
209
|
-
* Opt-in per-slice review heuristic. When enabled, the TDD skill
|
|
210
|
-
* requires a `## Per-Slice Review` section in `06-tdd.md` for slices
|
|
211
|
-
* that exceed `filesChangedThreshold` or match `touchTriggers`.
|
|
212
|
-
* Keeps obra's "fresh subagent + spec-then-quality review per task"
|
|
213
|
-
* discipline tractable without forcing it on tiny quick-track fixes.
|
|
214
|
-
*/
|
|
215
|
-
sliceReview?: SliceReviewConfig;
|
|
216
|
-
/** Optional per-law strictness controls for hook-enforced iron laws. */
|
|
217
|
-
ironLaws?: IronLawsConfig;
|
|
218
|
-
/** Optional opt-in audit gates for scope/design stages. */
|
|
219
|
-
optInAudits?: OptInAuditsConfig;
|
|
220
|
-
/** Optional runtime knobs for outside-voice review loops. */
|
|
221
|
-
reviewLoop?: ReviewLoopConfig;
|
|
222
166
|
}
|
|
223
167
|
export interface TransitionRule {
|
|
224
168
|
from: FlowStage;
|