cclaw-cli 7.5.0 → 7.7.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/README.md +2 -1
- package/dist/artifact-linter/plan.js +238 -26
- package/dist/artifact-linter/tdd.js +4 -3
- package/dist/config.d.ts +18 -1
- package/dist/config.js +176 -5
- package/dist/content/core-agents.d.ts +1 -1
- package/dist/content/core-agents.js +17 -2
- package/dist/content/hooks.js +37 -0
- package/dist/content/meta-skill.js +4 -4
- package/dist/content/skills.js +12 -8
- package/dist/content/stage-schema.js +3 -2
- package/dist/content/stages/plan.js +18 -17
- package/dist/content/stages/tdd.js +13 -10
- package/dist/content/start-command.js +3 -3
- package/dist/content/subagent-context-skills.js +2 -2
- package/dist/content/subagents.js +6 -6
- package/dist/content/templates.js +12 -7
- package/dist/delegation.d.ts +43 -3
- package/dist/delegation.js +80 -9
- package/dist/execution-topology.d.ts +36 -0
- package/dist/execution-topology.js +73 -0
- package/dist/gate-evidence.js +10 -12
- package/dist/internal/advance-stage/start-flow.js +13 -4
- package/dist/internal/cohesion-contract-stub.js +2 -14
- package/dist/internal/plan-split-waves.d.ts +5 -2
- package/dist/internal/plan-split-waves.js +27 -16
- package/dist/internal/slice-commit.js +161 -7
- package/dist/internal/wave-status.d.ts +4 -0
- package/dist/internal/wave-status.js +50 -9
- package/dist/stack-detection.d.ts +94 -0
- package/dist/stack-detection.js +431 -0
- package/dist/tdd-cycle.js +7 -5
- package/dist/types.d.ts +67 -0
- package/dist/util/slice-id.d.ts +58 -0
- package/dist/util/slice-id.js +89 -0
- package/package.json +1 -1
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slice-ID helpers.
|
|
3
|
+
*
|
|
4
|
+
* 7.6.0 — relaxed strict `/^S-\d+$/` to allow lettered sub-slices
|
|
5
|
+
* (`S-36a`, `S-36b`, …) so plan amendments can insert work between
|
|
6
|
+
* existing numeric slices without renumbering.
|
|
7
|
+
*
|
|
8
|
+
* Canonical shape: `S-<integer>(<lowercase-letter>[<lowercase-or-digit>...])?`
|
|
9
|
+
*
|
|
10
|
+
* Sort order (used everywhere we list slice ids):
|
|
11
|
+
* 1. numeric chunk ascending
|
|
12
|
+
* 2. lexical suffix ascending (no suffix sorts before any suffix)
|
|
13
|
+
*
|
|
14
|
+
* So: `S-1 < S-2 < S-10 < S-36 < S-36a < S-36b < S-37`.
|
|
15
|
+
*
|
|
16
|
+
* Surface:
|
|
17
|
+
* - `SLICE_ID_PATTERN` — anchored regex source string for embedding
|
|
18
|
+
* - `SLICE_ID_REGEX` — anchored RegExp for tests
|
|
19
|
+
* - `parseSliceId` — strict parse → `{ numeric, suffix }` or null
|
|
20
|
+
* - `isSliceId` — boolean shape check
|
|
21
|
+
* - `compareSliceIds` — sort comparator
|
|
22
|
+
* - `sortSliceIds` — convenience wrapper around `compareSliceIds`
|
|
23
|
+
*/
|
|
24
|
+
/** Anchored, case-insensitive regex source for slice ids. */
|
|
25
|
+
export const SLICE_ID_PATTERN = "^S-(\\d+)([a-z][a-z0-9]*)?$";
|
|
26
|
+
/** Anchored, case-insensitive RegExp instance for slice ids. */
|
|
27
|
+
export const SLICE_ID_REGEX = new RegExp(SLICE_ID_PATTERN, "iu");
|
|
28
|
+
/**
|
|
29
|
+
* Strict parse of a slice id token.
|
|
30
|
+
*
|
|
31
|
+
* Returns `null` when the input is not a slice id. Whitespace and
|
|
32
|
+
* surrounding markdown decorations (backticks, brackets, quotes) are
|
|
33
|
+
* stripped before parsing so callers can pass cells from markdown
|
|
34
|
+
* tables verbatim.
|
|
35
|
+
*/
|
|
36
|
+
export function parseSliceId(raw) {
|
|
37
|
+
if (typeof raw !== "string")
|
|
38
|
+
return null;
|
|
39
|
+
const stripped = raw.trim().replace(/^[`"'[\]()]+|[`"'[\]()]+$/gu, "");
|
|
40
|
+
const match = SLICE_ID_REGEX.exec(stripped);
|
|
41
|
+
if (!match)
|
|
42
|
+
return null;
|
|
43
|
+
const numericPart = match[1] ?? "";
|
|
44
|
+
const suffixPart = (match[2] ?? "").toLowerCase();
|
|
45
|
+
const numeric = Number(numericPart);
|
|
46
|
+
if (!Number.isFinite(numeric) || !Number.isInteger(numeric))
|
|
47
|
+
return null;
|
|
48
|
+
const id = suffixPart.length > 0 ? `S-${numericPart}${suffixPart}` : `S-${numericPart}`;
|
|
49
|
+
return { id, numeric, suffix: suffixPart };
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Boolean shape check. Lowercase-or-uppercase `S-` prefix accepted; the
|
|
53
|
+
* canonical form is uppercase.
|
|
54
|
+
*/
|
|
55
|
+
export function isSliceId(raw) {
|
|
56
|
+
return parseSliceId(raw) !== null;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Comparator that orders slice ids by numeric chunk first, then by
|
|
60
|
+
* suffix (no-suffix sorts before any suffix). Non-slice tokens fall
|
|
61
|
+
* back to a stable lexical comparison so callers can pass mixed input
|
|
62
|
+
* without crashing.
|
|
63
|
+
*/
|
|
64
|
+
export function compareSliceIds(a, b) {
|
|
65
|
+
const pa = parseSliceId(a);
|
|
66
|
+
const pb = parseSliceId(b);
|
|
67
|
+
if (pa && pb) {
|
|
68
|
+
if (pa.numeric !== pb.numeric)
|
|
69
|
+
return pa.numeric - pb.numeric;
|
|
70
|
+
if (pa.suffix === pb.suffix)
|
|
71
|
+
return 0;
|
|
72
|
+
if (pa.suffix === "")
|
|
73
|
+
return -1;
|
|
74
|
+
if (pb.suffix === "")
|
|
75
|
+
return 1;
|
|
76
|
+
return pa.suffix < pb.suffix ? -1 : 1;
|
|
77
|
+
}
|
|
78
|
+
if (pa)
|
|
79
|
+
return -1;
|
|
80
|
+
if (pb)
|
|
81
|
+
return 1;
|
|
82
|
+
if (a === b)
|
|
83
|
+
return 0;
|
|
84
|
+
return a < b ? -1 : 1;
|
|
85
|
+
}
|
|
86
|
+
/** Convenience wrapper: returns a new sorted array using `compareSliceIds`. */
|
|
87
|
+
export function sortSliceIds(ids) {
|
|
88
|
+
return [...ids].sort(compareSliceIds);
|
|
89
|
+
}
|