@dzhechkov/harness-core 0.4.4 → 0.5.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/.dz-manifest.json +283 -103
- package/LICENSE +21 -0
- package/README.md +73 -5
- package/dist/agents-policy.d.ts +67 -0
- package/dist/agents-policy.d.ts.map +1 -0
- package/dist/agents-policy.js +258 -0
- package/dist/agents-policy.js.map +1 -0
- package/dist/codex-hooks-assets.d.ts +47 -0
- package/dist/codex-hooks-assets.d.ts.map +1 -0
- package/dist/codex-hooks-assets.js +287 -0
- package/dist/codex-hooks-assets.js.map +1 -0
- package/dist/codex-hooks-verify.d.ts +74 -0
- package/dist/codex-hooks-verify.d.ts.map +1 -0
- package/dist/codex-hooks-verify.js +140 -0
- package/dist/codex-hooks-verify.js.map +1 -0
- package/dist/codex-hooks.d.ts +258 -0
- package/dist/codex-hooks.d.ts.map +1 -0
- package/dist/codex-hooks.js +391 -0
- package/dist/codex-hooks.js.map +1 -0
- package/dist/discrimination-gate.d.ts +88 -15
- package/dist/discrimination-gate.d.ts.map +1 -1
- package/dist/discrimination-gate.js +343 -51
- package/dist/discrimination-gate.js.map +1 -1
- package/dist/feature-adr-checkpoints.d.ts +22 -0
- package/dist/feature-adr-checkpoints.d.ts.map +1 -1
- package/dist/feature-adr-checkpoints.js +42 -0
- package/dist/feature-adr-checkpoints.js.map +1 -1
- package/dist/feature-adr-routing.d.ts +196 -5
- package/dist/feature-adr-routing.d.ts.map +1 -1
- package/dist/feature-adr-routing.js +538 -54
- package/dist/feature-adr-routing.js.map +1 -1
- package/dist/guard.d.ts +13 -0
- package/dist/guard.d.ts.map +1 -1
- package/dist/guard.js +25 -1
- package/dist/guard.js.map +1 -1
- package/dist/index.d.ts +17 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +23 -4
- package/dist/index.js.map +1 -1
- package/dist/loop-blobs.generated.js +2 -2
- package/dist/loop-blobs.generated.js.map +1 -1
- package/dist/managed-hooks.d.ts +76 -0
- package/dist/managed-hooks.d.ts.map +1 -0
- package/dist/managed-hooks.js +89 -0
- package/dist/managed-hooks.js.map +1 -0
- package/dist/mutation-gate.d.ts +14 -0
- package/dist/mutation-gate.d.ts.map +1 -1
- package/dist/mutation-gate.js +25 -2
- package/dist/mutation-gate.js.map +1 -1
- package/dist/operations.d.ts +153 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/operations.js +560 -24
- package/dist/operations.js.map +1 -1
- package/dist/parity.d.ts +38 -1
- package/dist/parity.d.ts.map +1 -1
- package/dist/parity.js +78 -5
- package/dist/parity.js.map +1 -1
- package/dist/recall-usage.d.ts +53 -0
- package/dist/recall-usage.d.ts.map +1 -1
- package/dist/recall-usage.js +125 -2
- package/dist/recall-usage.js.map +1 -1
- package/dist/setup.d.ts.map +1 -1
- package/dist/setup.js +14 -26
- package/dist/setup.js.map +1 -1
- package/dist/shell-veto-policy.d.ts +53 -0
- package/dist/shell-veto-policy.d.ts.map +1 -0
- package/dist/shell-veto-policy.js +103 -0
- package/dist/shell-veto-policy.js.map +1 -0
- package/dist/skills.d.ts +86 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +116 -1
- package/dist/skills.js.map +1 -1
- package/dist/targets.d.ts +75 -0
- package/dist/targets.d.ts.map +1 -1
- package/dist/targets.js +160 -0
- package/dist/targets.js.map +1 -1
- package/package.json +20 -19
- package/sbom.json +552 -102
- package/src/agents-policy.ts +338 -0
- package/src/codex-hooks-assets.ts +291 -0
- package/src/codex-hooks-verify.ts +184 -0
- package/src/codex-hooks.ts +571 -0
- package/src/discrimination-gate.ts +456 -58
- package/src/feature-adr-checkpoints.ts +38 -0
- package/src/feature-adr-routing.ts +642 -75
- package/src/guard.ts +36 -1
- package/src/index.ts +118 -2
- package/src/loop-blobs.generated.ts +2 -2
- package/src/managed-hooks.ts +129 -0
- package/src/mutation-gate.ts +24 -2
- package/src/operations.ts +719 -28
- package/src/parity.ts +120 -6
- package/src/recall-usage.ts +184 -1
- package/src/setup.ts +26 -27
- package/src/shell-veto-policy.ts +119 -0
- package/src/skills.ts +174 -1
- package/src/targets.ts +189 -0
package/dist/skills.d.ts
CHANGED
|
@@ -22,8 +22,93 @@ export interface SkillInfo {
|
|
|
22
22
|
}
|
|
23
23
|
/** Return the ids of every `<skillsDir>/<id>/SKILL.md`, sorted. */
|
|
24
24
|
export declare function discoverSkillIds(skillsDir: string): string[];
|
|
25
|
-
/**
|
|
25
|
+
/**
|
|
26
|
+
* Discover every skill in `skillsDir`, returning id + description.
|
|
27
|
+
*
|
|
28
|
+
* **Throws on the first unloadable skill — deliberately, and permanently.** This is a
|
|
29
|
+
* published export; silently turning it into a skip-and-collect function would downgrade
|
|
30
|
+
* every unknown third-party consumer from fail-closed to fail-silent without their
|
|
31
|
+
* consent (an incomplete catalogue reported as complete). Callers that want a partial
|
|
32
|
+
* listing ask for one by name: {@link listSkillsDetailed}. A pinned regression test
|
|
33
|
+
* asserts this function still throws, so a future "helpful" refactor cannot quietly
|
|
34
|
+
* erase the strict variant. (feature dz-cli-defects, ADR-001 as amended by AM-6.)
|
|
35
|
+
*/
|
|
26
36
|
export declare function listSkills(skillsDir: string): SkillSummary[];
|
|
37
|
+
/** How much of the offending file's first line is echoed back to the user. */
|
|
38
|
+
export declare const SKILL_FAILURE_FIRST_LINE_MAX = 100;
|
|
39
|
+
/** One skill directory that could not be loaded. Named, so a log is actionable. */
|
|
40
|
+
export interface SkillLoadFailure {
|
|
41
|
+
/** The skill id (its directory name), e.g. `bto`. */
|
|
42
|
+
readonly id: string;
|
|
43
|
+
/** ABSOLUTE path to the offending `SKILL.md`. */
|
|
44
|
+
readonly path: string;
|
|
45
|
+
/** The caught error's message, verbatim — the classifier stays out of the loader. */
|
|
46
|
+
readonly reason: string;
|
|
47
|
+
/**
|
|
48
|
+
* First line of the source text, trimmed and capped at
|
|
49
|
+
* {@link SKILL_FAILURE_FIRST_LINE_MAX}; `''` when the file is unreadable. Echoing it
|
|
50
|
+
* is what turns the message into a FIX — the user sees the H1 and knows to add the
|
|
51
|
+
* frontmatter fence.
|
|
52
|
+
*/
|
|
53
|
+
readonly firstLine: string;
|
|
54
|
+
}
|
|
55
|
+
/** A listing that separates what parsed from what did not. */
|
|
56
|
+
export interface SkillListing {
|
|
57
|
+
/** Sorted by id — same order, same shape as {@link listSkills} produces today. */
|
|
58
|
+
readonly skills: readonly SkillSummary[];
|
|
59
|
+
/** Sorted by id. Empty when every skill loaded. */
|
|
60
|
+
readonly failures: readonly SkillLoadFailure[];
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Attribute any skill-load throw to a file. Shared by every consumer
|
|
64
|
+
* (`listSkillsDetailed`, `runInit`, `runInitSingleFileMd`, `runSync`).
|
|
65
|
+
*
|
|
66
|
+
* Best-effort on the first line: an unreadable file yields `''` rather than a second
|
|
67
|
+
* throw — this helper runs on an error path and must never become one.
|
|
68
|
+
*/
|
|
69
|
+
export declare function describeSkillLoadFailure(skillsDir: string, id: string, error: unknown): SkillLoadFailure;
|
|
70
|
+
/**
|
|
71
|
+
* Discover every skill in `skillsDir`, separating the ones that parsed from the ones
|
|
72
|
+
* that did not. One broken `SKILL.md` never hides the rest.
|
|
73
|
+
*
|
|
74
|
+
* Catch policy: **every** error per id, not only `SkillDocumentError` — an `EACCES`, a
|
|
75
|
+
* YAML syntax error and a Zod schema rejection are all equally "this one skill is
|
|
76
|
+
* unusable". The `reason` is the caught message verbatim.
|
|
77
|
+
*/
|
|
78
|
+
export declare function listSkillsDetailed(skillsDir: string): SkillListing;
|
|
79
|
+
/**
|
|
80
|
+
* Render a `SkillLoadFailure[]` as the diagnostic block a CLI writes to **stderr**.
|
|
81
|
+
*
|
|
82
|
+
* One helper, two rendering modes, chosen by the CALLER — never by the helper sniffing
|
|
83
|
+
* the path. `dz list` / `dz sync` print absolute paths (the user can act on those);
|
|
84
|
+
* `dz install` passes `relativeTo` = the downloaded package root, because a
|
|
85
|
+
* `node_modules/**` absolute path is not something the user can act on.
|
|
86
|
+
*
|
|
87
|
+
* Returns `[]` for an empty input, so callers can splice it unconditionally.
|
|
88
|
+
*/
|
|
89
|
+
export declare function formatSkillLoadFailures(failures: readonly SkillLoadFailure[], opts?: {
|
|
90
|
+
readonly relativeTo?: string;
|
|
91
|
+
}): string[];
|
|
92
|
+
/**
|
|
93
|
+
* One skill that LOADED cleanly but could not be compiled for, or written to, the
|
|
94
|
+
* target. The subject is the TARGET, never the source `SKILL.md`.
|
|
95
|
+
*/
|
|
96
|
+
export interface SkillApplyFailure {
|
|
97
|
+
/** The skill id (its directory name). */
|
|
98
|
+
readonly id: string;
|
|
99
|
+
/** The caught error's message, verbatim. */
|
|
100
|
+
readonly reason: string;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Render a `SkillApplyFailure[]` as the diagnostic block a CLI writes to **stderr**.
|
|
104
|
+
*
|
|
105
|
+
* Deliberately a DIFFERENT header from {@link formatSkillLoadFailures}: the two kinds
|
|
106
|
+
* point the user at two different files, and a shared header is what let a write
|
|
107
|
+
* failure masquerade as a parse failure.
|
|
108
|
+
*
|
|
109
|
+
* Returns `[]` for an empty input, so callers can splice it unconditionally.
|
|
110
|
+
*/
|
|
111
|
+
export declare function formatSkillApplyFailures(failures: readonly SkillApplyFailure[]): string[];
|
|
27
112
|
/** Get detailed info about a single skill without loading all assets. */
|
|
28
113
|
export declare function getSkillInfo(skillsDir: string, id: string): SkillInfo | undefined;
|
|
29
114
|
/**
|
package/dist/skills.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAQH,OAAO,KAAK,EAAE,cAAc,EAAc,MAAM,iBAAiB,CAAC;AAElE,kEAAkE;AAClE,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B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ACzC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,4CAA4C;IAC5C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,SAAS,iBAAiB,EAAE,GAAG,MAAM,EAAE,CAQzF;AAED,yEAAyE;AACzE,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,CAqBjF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,cAAc,CAoB9E"}
|
package/dist/skills.js
CHANGED
|
@@ -52,7 +52,17 @@ export function discoverSkillIds(skillsDir) {
|
|
|
52
52
|
.map((entry) => entry.name)
|
|
53
53
|
.sort();
|
|
54
54
|
}
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Discover every skill in `skillsDir`, returning id + description.
|
|
57
|
+
*
|
|
58
|
+
* **Throws on the first unloadable skill — deliberately, and permanently.** This is a
|
|
59
|
+
* published export; silently turning it into a skip-and-collect function would downgrade
|
|
60
|
+
* every unknown third-party consumer from fail-closed to fail-silent without their
|
|
61
|
+
* consent (an incomplete catalogue reported as complete). Callers that want a partial
|
|
62
|
+
* listing ask for one by name: {@link listSkillsDetailed}. A pinned regression test
|
|
63
|
+
* asserts this function still throws, so a future "helpful" refactor cannot quietly
|
|
64
|
+
* erase the strict variant. (feature dz-cli-defects, ADR-001 as amended by AM-6.)
|
|
65
|
+
*/
|
|
56
66
|
export function listSkills(skillsDir) {
|
|
57
67
|
return discoverSkillIds(skillsDir).map((id) => {
|
|
58
68
|
const document = parseSkillDocument(readFileSync(join(skillsDir, id, 'SKILL.md'), 'utf-8'));
|
|
@@ -60,6 +70,111 @@ export function listSkills(skillsDir) {
|
|
|
60
70
|
return { id, description: frontmatter.description };
|
|
61
71
|
});
|
|
62
72
|
}
|
|
73
|
+
// ---------------------------------------------------------------------------
|
|
74
|
+
// Skip-and-collect (feature dz-cli-defects, D1)
|
|
75
|
+
//
|
|
76
|
+
// The parser (`@dzhechkov/core/src/skill-document.ts`) is handed only TEXT, so its
|
|
77
|
+
// message can never carry a path. `describeSkillLoadFailure` is the ONE place that
|
|
78
|
+
// turns a pathless throw into a named failure — every consumer calls it, so "named,
|
|
79
|
+
// never anonymous" has one implementation and one test.
|
|
80
|
+
// ---------------------------------------------------------------------------
|
|
81
|
+
/** How much of the offending file's first line is echoed back to the user. */
|
|
82
|
+
export const SKILL_FAILURE_FIRST_LINE_MAX = 100;
|
|
83
|
+
/**
|
|
84
|
+
* Attribute any skill-load throw to a file. Shared by every consumer
|
|
85
|
+
* (`listSkillsDetailed`, `runInit`, `runInitSingleFileMd`, `runSync`).
|
|
86
|
+
*
|
|
87
|
+
* Best-effort on the first line: an unreadable file yields `''` rather than a second
|
|
88
|
+
* throw — this helper runs on an error path and must never become one.
|
|
89
|
+
*/
|
|
90
|
+
export function describeSkillLoadFailure(skillsDir, id, error) {
|
|
91
|
+
const path = join(skillsDir, id, 'SKILL.md');
|
|
92
|
+
let firstLine = '';
|
|
93
|
+
try {
|
|
94
|
+
const raw = readFileSync(path, 'utf-8');
|
|
95
|
+
const line = (raw.split('\n', 1)[0] ?? '').replace(/\r$/, '').trim();
|
|
96
|
+
firstLine =
|
|
97
|
+
line.length > SKILL_FAILURE_FIRST_LINE_MAX
|
|
98
|
+
? `${line.slice(0, SKILL_FAILURE_FIRST_LINE_MAX)}…`
|
|
99
|
+
: line;
|
|
100
|
+
}
|
|
101
|
+
catch {
|
|
102
|
+
firstLine = '';
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
id,
|
|
106
|
+
path,
|
|
107
|
+
reason: error instanceof Error ? error.message : String(error),
|
|
108
|
+
firstLine,
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Discover every skill in `skillsDir`, separating the ones that parsed from the ones
|
|
113
|
+
* that did not. One broken `SKILL.md` never hides the rest.
|
|
114
|
+
*
|
|
115
|
+
* Catch policy: **every** error per id, not only `SkillDocumentError` — an `EACCES`, a
|
|
116
|
+
* YAML syntax error and a Zod schema rejection are all equally "this one skill is
|
|
117
|
+
* unusable". The `reason` is the caught message verbatim.
|
|
118
|
+
*/
|
|
119
|
+
export function listSkillsDetailed(skillsDir) {
|
|
120
|
+
const skills = [];
|
|
121
|
+
const failures = [];
|
|
122
|
+
for (const id of discoverSkillIds(skillsDir)) {
|
|
123
|
+
try {
|
|
124
|
+
const document = parseSkillDocument(readFileSync(join(skillsDir, id, 'SKILL.md'), 'utf-8'));
|
|
125
|
+
const frontmatter = ClaudeSkillFrontmatterSchema.parse(parseYaml(document.frontmatterYaml));
|
|
126
|
+
skills.push({ id, description: frontmatter.description });
|
|
127
|
+
}
|
|
128
|
+
catch (error) {
|
|
129
|
+
failures.push(describeSkillLoadFailure(skillsDir, id, error));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
return { skills, failures };
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Render a `SkillLoadFailure[]` as the diagnostic block a CLI writes to **stderr**.
|
|
136
|
+
*
|
|
137
|
+
* One helper, two rendering modes, chosen by the CALLER — never by the helper sniffing
|
|
138
|
+
* the path. `dz list` / `dz sync` print absolute paths (the user can act on those);
|
|
139
|
+
* `dz install` passes `relativeTo` = the downloaded package root, because a
|
|
140
|
+
* `node_modules/**` absolute path is not something the user can act on.
|
|
141
|
+
*
|
|
142
|
+
* Returns `[]` for an empty input, so callers can splice it unconditionally.
|
|
143
|
+
*/
|
|
144
|
+
export function formatSkillLoadFailures(failures, opts = {}) {
|
|
145
|
+
if (failures.length === 0)
|
|
146
|
+
return [];
|
|
147
|
+
const lines = [`⚠ ${failures.length} skill(s) skipped (unparseable SKILL.md):`];
|
|
148
|
+
for (const failure of failures) {
|
|
149
|
+
const shown = opts.relativeTo !== undefined
|
|
150
|
+
? relative(opts.relativeTo, failure.path).split('\\').join('/')
|
|
151
|
+
: failure.path;
|
|
152
|
+
lines.push(` ${shown}`);
|
|
153
|
+
lines.push(` ${failure.reason}`);
|
|
154
|
+
if (failure.firstLine !== '')
|
|
155
|
+
lines.push(` (line 1: ${JSON.stringify(failure.firstLine)})`);
|
|
156
|
+
}
|
|
157
|
+
return lines;
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Render a `SkillApplyFailure[]` as the diagnostic block a CLI writes to **stderr**.
|
|
161
|
+
*
|
|
162
|
+
* Deliberately a DIFFERENT header from {@link formatSkillLoadFailures}: the two kinds
|
|
163
|
+
* point the user at two different files, and a shared header is what let a write
|
|
164
|
+
* failure masquerade as a parse failure.
|
|
165
|
+
*
|
|
166
|
+
* Returns `[]` for an empty input, so callers can splice it unconditionally.
|
|
167
|
+
*/
|
|
168
|
+
export function formatSkillApplyFailures(failures) {
|
|
169
|
+
if (failures.length === 0)
|
|
170
|
+
return [];
|
|
171
|
+
const lines = [`✗ ${failures.length} skill(s) failed to install (compile/write error):`];
|
|
172
|
+
for (const failure of failures) {
|
|
173
|
+
lines.push(` ${failure.id}`);
|
|
174
|
+
lines.push(` ${failure.reason}`);
|
|
175
|
+
}
|
|
176
|
+
return lines;
|
|
177
|
+
}
|
|
63
178
|
/** Get detailed info about a single skill without loading all assets. */
|
|
64
179
|
export function getSkillInfo(skillsDir, id) {
|
|
65
180
|
const skillDir = join(skillsDir, id);
|
package/dist/skills.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MA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AAM,WAAW,GAAG,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,oBAAoB,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,eAAe,SAAS,GAAG,CAAC,CAAC;IACrF,CAAC;IACD,MAAM,QAAQ,GAAG,kBAAkB,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC;IACxE,MAAM,WAAW,GAAG,4BAA4B,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,CAAC,CAAC;IAC5F,MAAM,MAAM,GAAiB,SAAS,CAAC,QAAQ,CAAC;SAC7C,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,WAAW,CAAC;SACtC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,gBAAgB,CAAC,IAAI,CAAC,CAAC;QACrD,OAAO;YACL,IAAI,EAAE,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;YACpD,QAAQ;YACR,OAAO;SACR,CAAC;IACJ,CAAC,CAAC;SACD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,OAAO,EAAE,EAAE,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC;AAC/C,CAAC"}
|
package/dist/targets.d.ts
CHANGED
|
@@ -15,4 +15,79 @@ export declare const TARGETS: Record<TargetName, Adapter>;
|
|
|
15
15
|
export declare const TARGET_NAMES: TargetName[];
|
|
16
16
|
/** Type guard: is `value` a supported `--target` name? */
|
|
17
17
|
export declare function isTargetName(value: string): value is TargetName;
|
|
18
|
+
/** `TARGET_NAMES` sorted alphabetically, for display in error messages. */
|
|
19
|
+
export declare const TARGET_NAMES_SORTED: readonly TargetName[];
|
|
20
|
+
/**
|
|
21
|
+
* Semantic `--target` aliases — DATA, not branching logic. Adding a row is one line
|
|
22
|
+
* and zero control flow (ADR-002 §Rationale D5).
|
|
23
|
+
*
|
|
24
|
+
* Purely typographic variants (`Claude_Code`, `claudecode`, `agents.md`) are handled by
|
|
25
|
+
* normalisation, not by rows; the rows below carry only meanings normalisation cannot
|
|
26
|
+
* derive (`claude` ≠ `claude-code` by any string rule — it is an owner decision).
|
|
27
|
+
*/
|
|
28
|
+
export declare const TARGET_ALIASES: Readonly<Record<string, TargetName>>;
|
|
29
|
+
/**
|
|
30
|
+
* Rows deleted in fix round 1 (QE F7) because they were UNREACHABLE, not because their
|
|
31
|
+
* inputs stopped working: `claude_code`, `claudecode`, `agentsmd` and `agents.md` all
|
|
32
|
+
* normalise onto a canonical name, and precedence step 2 (normalised canonical) runs
|
|
33
|
+
* BEFORE step 3 (this table). Every one of them still resolves — through normalisation,
|
|
34
|
+
* which is where the README already says typographic variants are handled.
|
|
35
|
+
*
|
|
36
|
+
* They were invisible dead data because the table test iterated every row asserting
|
|
37
|
+
* `via === 'alias'`, which is true on both paths — a PRESENCE assertion where a
|
|
38
|
+
* REACHABILITY one was intended. `target-resolution.test.ts` now removes each row from a
|
|
39
|
+
* COPY of the table and asserts the resolution changes, so a future dead row is red.
|
|
40
|
+
*/
|
|
41
|
+
/** The outcome of {@link resolveTargetName}. Total: every string maps to one of these. */
|
|
42
|
+
export type TargetResolution = {
|
|
43
|
+
readonly kind: 'ok';
|
|
44
|
+
readonly target: TargetName;
|
|
45
|
+
readonly via: 'canonical' | 'alias';
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: 'unknown';
|
|
48
|
+
readonly input: string;
|
|
49
|
+
readonly suggestion: TargetName | null;
|
|
50
|
+
};
|
|
51
|
+
/** Levenshtein suggestions are only offered at or below this edit distance. */
|
|
52
|
+
export declare const TARGET_SUGGESTION_MAX_DISTANCE = 3;
|
|
53
|
+
/**
|
|
54
|
+
* Normalise a `--target` token for matching: byte-level lowercase (never
|
|
55
|
+
* `toLocaleLowerCase` — behaviour must not vary with the host locale), trimmed, with
|
|
56
|
+
* every separator dropped so `Claude_Code`, `claude-code` and `claudecode` collapse.
|
|
57
|
+
*
|
|
58
|
+
* Exported so the alias-REACHABILITY test can ask the production normaliser whether a
|
|
59
|
+
* proposed alias row is already carried by precedence step 2, instead of keeping a
|
|
60
|
+
* second copy of this rule in the test file (fix round 1, QE F7).
|
|
61
|
+
*/
|
|
62
|
+
export declare function normalizeTargetToken(value: string): string;
|
|
63
|
+
/**
|
|
64
|
+
* Resolve a user-supplied `--target` value to a canonical {@link TargetName}.
|
|
65
|
+
*
|
|
66
|
+
* Total, pure, no I/O. Precedence (fixed and tested):
|
|
67
|
+
*
|
|
68
|
+
* 1. exact canonical hit → `{kind:'ok', via:'canonical'}` (`isTargetName` semantics);
|
|
69
|
+
* 2. normalised canonical hit → `{kind:'ok', via:'alias'}` (`Claude_Code`, `agentsmd`);
|
|
70
|
+
* 3. explicit {@link TARGET_ALIASES} row → `{kind:'ok', via:'alias'}`;
|
|
71
|
+
* 4. unique normalised prefix → `{kind:'unknown', suggestion}`;
|
|
72
|
+
* 5. Levenshtein ≤ 3 strictly better than the runner-up → `{kind:'unknown', suggestion}`;
|
|
73
|
+
* 6. otherwise → `{kind:'unknown', suggestion:null}`.
|
|
74
|
+
*
|
|
75
|
+
* **Aliases ACCEPT; prefix and Levenshtein only SUGGEST.** An alias row is an owner
|
|
76
|
+
* decision recorded in data; a fuzzy match is a guess, and silently installing to the
|
|
77
|
+
* wrong target on a guess is worse than one round-trip.
|
|
78
|
+
*/
|
|
79
|
+
export declare function resolveTargetName(value: string): TargetResolution;
|
|
80
|
+
/**
|
|
81
|
+
* Render the two-line failure for an unresolvable `--target`.
|
|
82
|
+
*
|
|
83
|
+
* Line 2 keeps the literal substring `--target must be one of:` — three shipped
|
|
84
|
+
* assertions (`test/cli.test.ts`) pin it, and keeping the shape additive is what makes
|
|
85
|
+
* the D3 change prove itself with NEW tests instead of rewriting old ones. The values
|
|
86
|
+
* are {@link TARGET_NAMES_SORTED} (alphabetical), which the pre-change message was not.
|
|
87
|
+
*/
|
|
88
|
+
export declare function formatTargetProblem(command: string, resolution: Extract<TargetResolution, {
|
|
89
|
+
kind: 'unknown';
|
|
90
|
+
}>): readonly string[];
|
|
91
|
+
/** The one-line diagnostic emitted (on stderr) when an alias was accepted. */
|
|
92
|
+
export declare function formatTargetAliasNote(command: string, input: string, target: TargetName): string;
|
|
18
93
|
//# sourceMappingURL=targets.d.ts.map
|
package/dist/targets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"targets.d.ts","sourceRoot":"","sources":["../src/targets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;GAGG;AACH,+BAA+B;AAC/B,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAAG,YAAY,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAKrJ,eAAO,MAAM,OAAO,EAAE,MAAM,CAAC,UAAU,EAAE,OAAO,CAa/C,CAAC;AAEF,uCAAuC;AACvC,eAAO,MAAM,YAAY,EAA2B,UAAU,EAAE,CAAC;AAEjE,0DAA0D;AAC1D,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,UAAU,CAE/D"}
|
|
1
|
+
{"version":3,"file":"targets.d.ts","sourceRoot":"","sources":["../src/targets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/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G;AACH,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,OAAO,CAAC,gBAAgB,EAAE;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,CAAC,GACzD,SAAS,MAAM,EAAE,CAOnB;AAED,8EAA8E;AAC9E,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,CAEhG"}
|
package/dist/targets.js
CHANGED
|
@@ -36,4 +36,164 @@ export const TARGET_NAMES = Object.keys(TARGETS);
|
|
|
36
36
|
export function isTargetName(value) {
|
|
37
37
|
return Object.prototype.hasOwnProperty.call(TARGETS, value);
|
|
38
38
|
}
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// `--target` resolution — alias table + did-you-mean (feature dz-cli-defects, D3)
|
|
41
|
+
//
|
|
42
|
+
// `isTargetName`, `TARGETS` and `TARGET_NAMES` above are UNCHANGED: `boundaries.json`
|
|
43
|
+
// names `isTargetName` as the scanned validation boundary for `--target`, and every
|
|
44
|
+
// resolution below ends in exactly that guard, so the security boundary is preserved
|
|
45
|
+
// rather than relocated (ADR-002 / architecture §3.1).
|
|
46
|
+
// ---------------------------------------------------------------------------
|
|
47
|
+
/** `TARGET_NAMES` sorted alphabetically, for display in error messages. */
|
|
48
|
+
export const TARGET_NAMES_SORTED = [...TARGET_NAMES].sort();
|
|
49
|
+
/**
|
|
50
|
+
* Semantic `--target` aliases — DATA, not branching logic. Adding a row is one line
|
|
51
|
+
* and zero control flow (ADR-002 §Rationale D5).
|
|
52
|
+
*
|
|
53
|
+
* Purely typographic variants (`Claude_Code`, `claudecode`, `agents.md`) are handled by
|
|
54
|
+
* normalisation, not by rows; the rows below carry only meanings normalisation cannot
|
|
55
|
+
* derive (`claude` ≠ `claude-code` by any string rule — it is an owner decision).
|
|
56
|
+
*/
|
|
57
|
+
export const TARGET_ALIASES = {
|
|
58
|
+
claude: 'claude-code',
|
|
59
|
+
cc: 'claude-code',
|
|
60
|
+
agents: 'agents-md',
|
|
61
|
+
gpt: 'codex',
|
|
62
|
+
openai: 'codex',
|
|
63
|
+
};
|
|
64
|
+
/** Levenshtein suggestions are only offered at or below this edit distance. */
|
|
65
|
+
export const TARGET_SUGGESTION_MAX_DISTANCE = 3;
|
|
66
|
+
/**
|
|
67
|
+
* Normalise a `--target` token for matching: byte-level lowercase (never
|
|
68
|
+
* `toLocaleLowerCase` — behaviour must not vary with the host locale), trimmed, with
|
|
69
|
+
* every separator dropped so `Claude_Code`, `claude-code` and `claudecode` collapse.
|
|
70
|
+
*
|
|
71
|
+
* Exported so the alias-REACHABILITY test can ask the production normaliser whether a
|
|
72
|
+
* proposed alias row is already carried by precedence step 2, instead of keeping a
|
|
73
|
+
* second copy of this rule in the test file (fix round 1, QE F7).
|
|
74
|
+
*/
|
|
75
|
+
export function normalizeTargetToken(value) {
|
|
76
|
+
return value.trim().toLowerCase().replace(/[-_.\s]/g, '');
|
|
77
|
+
}
|
|
78
|
+
/** Iterative two-row Levenshtein. No dependency: harness-core ships no fuzzy matcher. */
|
|
79
|
+
function levenshtein(a, b) {
|
|
80
|
+
if (a === b)
|
|
81
|
+
return 0;
|
|
82
|
+
if (a.length === 0)
|
|
83
|
+
return b.length;
|
|
84
|
+
if (b.length === 0)
|
|
85
|
+
return a.length;
|
|
86
|
+
let prev = Array.from({ length: b.length + 1 }, (_, i) => i);
|
|
87
|
+
let curr = new Array(b.length + 1).fill(0);
|
|
88
|
+
for (let i = 1; i <= a.length; i += 1) {
|
|
89
|
+
curr[0] = i;
|
|
90
|
+
for (let j = 1; j <= b.length; j += 1) {
|
|
91
|
+
const cost = a[i - 1] === b[j - 1] ? 0 : 1;
|
|
92
|
+
curr[j] = Math.min((curr[j - 1] ?? 0) + 1, (prev[j] ?? 0) + 1, (prev[j - 1] ?? 0) + cost);
|
|
93
|
+
}
|
|
94
|
+
const swap = prev;
|
|
95
|
+
prev = curr;
|
|
96
|
+
curr = swap;
|
|
97
|
+
}
|
|
98
|
+
return prev[b.length] ?? 0;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Suggest a canonical target for an input that did not resolve.
|
|
102
|
+
*
|
|
103
|
+
* Two legs, in order, and each closes a case the other cannot:
|
|
104
|
+
*
|
|
105
|
+
* - **unique normalised prefix** — carries `clau → claude-code`, which is edit distance 5
|
|
106
|
+
* and therefore unreachable by any sane Levenshtein threshold. An input that prefixes
|
|
107
|
+
* TWO OR MORE canonical names is AMBIGUOUS and terminates with **no** suggestion
|
|
108
|
+
* (`co` → `codex`/`copilot`): guessing between two live targets is worse than a
|
|
109
|
+
* round-trip, and the fall-through would otherwise hand `co` to `codex` on a distance
|
|
110
|
+
* of 3 — a confident answer to a question the user has not yet decided.
|
|
111
|
+
* - **Levenshtein ≤ 3, strictly better than the runner-up** — carries the typo case
|
|
112
|
+
* `clade-code → claude-code`. A tie yields `null` for the same reason.
|
|
113
|
+
*/
|
|
114
|
+
function suggestTargetName(normalized) {
|
|
115
|
+
if (normalized.length === 0)
|
|
116
|
+
return null;
|
|
117
|
+
const prefixHits = TARGET_NAMES_SORTED.filter((name) => normalizeTargetToken(name).startsWith(normalized));
|
|
118
|
+
if (prefixHits.length === 1)
|
|
119
|
+
return prefixHits[0] ?? null;
|
|
120
|
+
// Ambiguous prefix is TERMINAL, not a fall-through (see doc comment).
|
|
121
|
+
if (prefixHits.length > 1)
|
|
122
|
+
return null;
|
|
123
|
+
let best = null;
|
|
124
|
+
let bestDistance = Number.POSITIVE_INFINITY;
|
|
125
|
+
let runnerUpDistance = Number.POSITIVE_INFINITY;
|
|
126
|
+
for (const name of TARGET_NAMES_SORTED) {
|
|
127
|
+
const distance = levenshtein(normalized, normalizeTargetToken(name));
|
|
128
|
+
if (distance < bestDistance) {
|
|
129
|
+
runnerUpDistance = bestDistance;
|
|
130
|
+
bestDistance = distance;
|
|
131
|
+
best = name;
|
|
132
|
+
}
|
|
133
|
+
else if (distance < runnerUpDistance) {
|
|
134
|
+
runnerUpDistance = distance;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (best === null)
|
|
138
|
+
return null;
|
|
139
|
+
if (bestDistance > TARGET_SUGGESTION_MAX_DISTANCE)
|
|
140
|
+
return null;
|
|
141
|
+
// Strictly better than the runner-up — a tie is not a suggestion.
|
|
142
|
+
if (bestDistance === runnerUpDistance)
|
|
143
|
+
return null;
|
|
144
|
+
return best;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Resolve a user-supplied `--target` value to a canonical {@link TargetName}.
|
|
148
|
+
*
|
|
149
|
+
* Total, pure, no I/O. Precedence (fixed and tested):
|
|
150
|
+
*
|
|
151
|
+
* 1. exact canonical hit → `{kind:'ok', via:'canonical'}` (`isTargetName` semantics);
|
|
152
|
+
* 2. normalised canonical hit → `{kind:'ok', via:'alias'}` (`Claude_Code`, `agentsmd`);
|
|
153
|
+
* 3. explicit {@link TARGET_ALIASES} row → `{kind:'ok', via:'alias'}`;
|
|
154
|
+
* 4. unique normalised prefix → `{kind:'unknown', suggestion}`;
|
|
155
|
+
* 5. Levenshtein ≤ 3 strictly better than the runner-up → `{kind:'unknown', suggestion}`;
|
|
156
|
+
* 6. otherwise → `{kind:'unknown', suggestion:null}`.
|
|
157
|
+
*
|
|
158
|
+
* **Aliases ACCEPT; prefix and Levenshtein only SUGGEST.** An alias row is an owner
|
|
159
|
+
* decision recorded in data; a fuzzy match is a guess, and silently installing to the
|
|
160
|
+
* wrong target on a guess is worse than one round-trip.
|
|
161
|
+
*/
|
|
162
|
+
export function resolveTargetName(value) {
|
|
163
|
+
if (isTargetName(value))
|
|
164
|
+
return { kind: 'ok', target: value, via: 'canonical' };
|
|
165
|
+
const normalized = normalizeTargetToken(value);
|
|
166
|
+
for (const name of TARGET_NAMES) {
|
|
167
|
+
if (normalizeTargetToken(name) === normalized) {
|
|
168
|
+
return { kind: 'ok', target: name, via: 'alias' };
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const aliased = Object.prototype.hasOwnProperty.call(TARGET_ALIASES, normalized)
|
|
172
|
+
? TARGET_ALIASES[normalized]
|
|
173
|
+
: Object.prototype.hasOwnProperty.call(TARGET_ALIASES, value.trim().toLowerCase())
|
|
174
|
+
? TARGET_ALIASES[value.trim().toLowerCase()]
|
|
175
|
+
: undefined;
|
|
176
|
+
if (aliased !== undefined)
|
|
177
|
+
return { kind: 'ok', target: aliased, via: 'alias' };
|
|
178
|
+
return { kind: 'unknown', input: value, suggestion: suggestTargetName(normalized) };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Render the two-line failure for an unresolvable `--target`.
|
|
182
|
+
*
|
|
183
|
+
* Line 2 keeps the literal substring `--target must be one of:` — three shipped
|
|
184
|
+
* assertions (`test/cli.test.ts`) pin it, and keeping the shape additive is what makes
|
|
185
|
+
* the D3 change prove itself with NEW tests instead of rewriting old ones. The values
|
|
186
|
+
* are {@link TARGET_NAMES_SORTED} (alphabetical), which the pre-change message was not.
|
|
187
|
+
*/
|
|
188
|
+
export function formatTargetProblem(command, resolution) {
|
|
189
|
+
const suggestion = resolution.suggestion !== null ? ` — did you mean ${JSON.stringify(resolution.suggestion)}?` : '';
|
|
190
|
+
return [
|
|
191
|
+
`${command}: unknown --target ${JSON.stringify(resolution.input)}${suggestion}`,
|
|
192
|
+
` --target must be one of: ${TARGET_NAMES_SORTED.join(', ')}`,
|
|
193
|
+
];
|
|
194
|
+
}
|
|
195
|
+
/** The one-line diagnostic emitted (on stderr) when an alias was accepted. */
|
|
196
|
+
export function formatTargetAliasNote(command, input, target) {
|
|
197
|
+
return `${command}: --target ${JSON.stringify(input)} → ${target} (alias)`;
|
|
198
|
+
}
|
|
39
199
|
//# sourceMappingURL=targets.js.map
|
package/dist/targets.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"targets.js","sourceRoot":"","sources":["../src/targets.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAE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CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dzhechkov/harness-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Shared harness logic - skill loading, additive apply, and the init/sync/verify/doctor operations.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
".": {
|
|
17
17
|
"types": "./dist/index.d.ts",
|
|
18
18
|
"import": "./dist/index.js"
|
|
19
|
-
}
|
|
19
|
+
},
|
|
20
|
+
"./package.json": "./package.json"
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
23
|
"dist",
|
|
@@ -25,28 +26,21 @@
|
|
|
25
26
|
".dz-manifest.json",
|
|
26
27
|
"sbom.json"
|
|
27
28
|
],
|
|
28
|
-
"scripts": {
|
|
29
|
-
"build": "tsc -p tsconfig.json",
|
|
30
|
-
"test": "vitest run",
|
|
31
|
-
"test:watch": "vitest",
|
|
32
|
-
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
33
|
-
"lint": "tsc -p tsconfig.json --noEmit"
|
|
34
|
-
},
|
|
35
29
|
"dependencies": {
|
|
36
|
-
"@dzhechkov/adapter-agents-md": "workspace:*",
|
|
37
30
|
"@dzhechkov/adapter-claude": "^0.2.0",
|
|
38
31
|
"@dzhechkov/adapter-codex": "^0.2.0",
|
|
39
|
-
"@dzhechkov/adapter-copilot": "workspace:*",
|
|
40
|
-
"@dzhechkov/adapter-cursor": "workspace:*",
|
|
41
|
-
"@dzhechkov/adapter-gemini": "workspace:*",
|
|
42
32
|
"@dzhechkov/adapter-hermes": "^0.2.0",
|
|
43
33
|
"@dzhechkov/adapter-openclaude": "^0.1.0",
|
|
44
34
|
"@dzhechkov/adapter-opencode": "^0.2.0",
|
|
45
|
-
"@dzhechkov/adapter-windsurf": "workspace:*",
|
|
46
|
-
"@dzhechkov/core": "workspace:*",
|
|
47
|
-
"@dzhechkov/memory": "workspace:*",
|
|
48
35
|
"proper-lockfile": "^4.1.2",
|
|
49
|
-
"yaml": "^2.0.0"
|
|
36
|
+
"yaml": "^2.0.0",
|
|
37
|
+
"@dzhechkov/adapter-agents-md": "0.1.1",
|
|
38
|
+
"@dzhechkov/adapter-cursor": "0.1.1",
|
|
39
|
+
"@dzhechkov/adapter-gemini": "0.1.1",
|
|
40
|
+
"@dzhechkov/adapter-windsurf": "0.1.1",
|
|
41
|
+
"@dzhechkov/adapter-copilot": "0.1.1",
|
|
42
|
+
"@dzhechkov/core": "0.2.15",
|
|
43
|
+
"@dzhechkov/memory": "0.2.9"
|
|
50
44
|
},
|
|
51
45
|
"peerDependenciesMeta": {
|
|
52
46
|
"@ruvector/rvf": {
|
|
@@ -71,5 +65,12 @@
|
|
|
71
65
|
"url": "https://github.com/djd1m/dz-harness-hub.git",
|
|
72
66
|
"directory": "packages/@dzhechkov/harness-core"
|
|
73
67
|
},
|
|
74
|
-
"homepage": "https://github.com/djd1m/dz-harness-hub/tree/main/packages/@dzhechkov/harness-core#readme"
|
|
75
|
-
|
|
68
|
+
"homepage": "https://github.com/djd1m/dz-harness-hub/tree/main/packages/@dzhechkov/harness-core#readme",
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "tsc -p tsconfig.json",
|
|
71
|
+
"test": "vitest run",
|
|
72
|
+
"test:watch": "vitest",
|
|
73
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
74
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
75
|
+
}
|
|
76
|
+
}
|