@dzhechkov/harness-core 0.3.35 → 0.3.36
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/bundle.d.ts.map +1 -1
- package/dist/bundle.js +28 -8
- package/dist/bundle.js.map +1 -1
- package/package.json +3 -3
- package/src/bundle.ts +32 -6
package/dist/bundle.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;
|
|
1
|
+
{"version":3,"file":"bundle.d.ts","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA6CH,wCAAwC;AACxC,MAAM,WAAW,aAAa;IAC5B,2BAA2B;IAC3B,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC,4EAA4E;IAC5E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,gCAAgC;IAChC,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,iDAAiD;AACjD,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,uCAAuC;AACvC,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC;IACjC,yCAAyC;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,aAAa,GAAG,YAAY,CA6B9D"}
|
package/dist/bundle.js
CHANGED
|
@@ -18,15 +18,34 @@ import { loadSkillFromDir } from './skills.js';
|
|
|
18
18
|
function isInternalArtifact(path) {
|
|
19
19
|
return /(^|\/)(schemas|evals)\//.test(path) || path.endsWith('/sources.json') || path === 'sources.json';
|
|
20
20
|
}
|
|
21
|
-
/**
|
|
22
|
-
|
|
21
|
+
/**
|
|
22
|
+
* Detect Claude-Code host coupling the consumer must adapt (advisory) — including
|
|
23
|
+
* **cross-skill references** (a composite that loads sibling skills by path). Those
|
|
24
|
+
* sibling skills are separate bundles; if they aren't bundled too, the skill won't
|
|
25
|
+
* work standalone in a generic runtime, so they're surfaced loudly.
|
|
26
|
+
*/
|
|
27
|
+
function hostCouplingWarnings(id, skillMd, bundledIds) {
|
|
23
28
|
const w = [];
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
// Cross-skill references: `.claude/skills/<sub>/...` or `/mnt/skills/{user,public}/<sub>/...`.
|
|
30
|
+
// These are the load-bearing dependency for composites (e.g. analyst-manual-full → explore,
|
|
31
|
+
// goap-research-ed25519, problem-solver-enhanced). Only warn about sub-skills NOT already in
|
|
32
|
+
// this bundle set — if they're all bundled, the set is self-contained.
|
|
33
|
+
const subs = new Set();
|
|
34
|
+
for (const m of skillMd.matchAll(/(?:\.claude\/skills|\/mnt\/skills\/(?:user|public))\/([a-z0-9][a-z0-9-]*)/g)) {
|
|
35
|
+
if (m[1] !== undefined && m[1] !== id)
|
|
36
|
+
subs.add(m[1]);
|
|
37
|
+
}
|
|
38
|
+
const missing = [...subs].filter((s) => !bundledIds.has(s)).sort();
|
|
39
|
+
if (missing.length > 0) {
|
|
40
|
+
w.push(`${id}: depends on sub-skill(s) ${missing.join(', ')} NOT in this bundle — add them ` +
|
|
41
|
+
`(--select …,${missing.join(',')}) or this skill won't load them standalone`);
|
|
42
|
+
}
|
|
43
|
+
if (/\/mnt\/skills\//.test(skillMd)) {
|
|
44
|
+
w.push(`${id}: references absolute /mnt/skills/... paths — rewrite to bundle-relative paths (e.g. just the skill id) for your runtime`);
|
|
45
|
+
}
|
|
46
|
+
if (/\bview\(\)/.test(skillMd)) {
|
|
27
47
|
w.push(`${id}: uses view() (Claude-Code file-read) — inline the reference or expose a file-read tool`);
|
|
28
|
-
|
|
29
|
-
w.push(`${id}: mentions slash-commands — a generic runtime has none`);
|
|
48
|
+
}
|
|
30
49
|
return w;
|
|
31
50
|
}
|
|
32
51
|
/**
|
|
@@ -36,6 +55,7 @@ function hostCouplingWarnings(id, skillMd) {
|
|
|
36
55
|
*/
|
|
37
56
|
export function bundleSkills(opts) {
|
|
38
57
|
const found = new Set();
|
|
58
|
+
const bundledIds = new Set(opts.ids);
|
|
39
59
|
const bundled = [];
|
|
40
60
|
for (const id of opts.ids) {
|
|
41
61
|
if (found.has(id))
|
|
@@ -54,7 +74,7 @@ export function bundleSkills(opts) {
|
|
|
54
74
|
const skillMd = files.find((f) => f.path.endsWith('/SKILL.md'))?.content;
|
|
55
75
|
const warnings = [
|
|
56
76
|
...emit.warnings,
|
|
57
|
-
...(typeof skillMd === 'string' ? hostCouplingWarnings(id, skillMd) : []),
|
|
77
|
+
...(typeof skillMd === 'string' ? hostCouplingWarnings(id, skillMd, bundledIds) : []),
|
|
58
78
|
];
|
|
59
79
|
const applied = applyEmitResult({ files, warnings: [] }, { targetRoot: opts.outRoot, force: opts.force === true });
|
|
60
80
|
bundled.push({ id, written: applied.written.length, skipped: applied.skipped.length, warnings });
|
package/dist/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,gFA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-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
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",
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@dzhechkov/adapter-opencode": "^0.2.0",
|
|
32
32
|
"yaml": "^2.0.0",
|
|
33
33
|
"@dzhechkov/adapter-copilot": "0.1.1",
|
|
34
|
-
"@dzhechkov/
|
|
35
|
-
"@dzhechkov/
|
|
34
|
+
"@dzhechkov/core": "0.2.4",
|
|
35
|
+
"@dzhechkov/memory": "0.2.5"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^25.6.0",
|
package/src/bundle.ts
CHANGED
|
@@ -21,12 +21,37 @@ function isInternalArtifact(path: string): boolean {
|
|
|
21
21
|
return /(^|\/)(schemas|evals)\//.test(path) || path.endsWith('/sources.json') || path === 'sources.json';
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
/**
|
|
25
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Detect Claude-Code host coupling the consumer must adapt (advisory) — including
|
|
26
|
+
* **cross-skill references** (a composite that loads sibling skills by path). Those
|
|
27
|
+
* sibling skills are separate bundles; if they aren't bundled too, the skill won't
|
|
28
|
+
* work standalone in a generic runtime, so they're surfaced loudly.
|
|
29
|
+
*/
|
|
30
|
+
function hostCouplingWarnings(id: string, skillMd: string, bundledIds: ReadonlySet<string>): string[] {
|
|
26
31
|
const w: string[] = [];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
32
|
+
|
|
33
|
+
// Cross-skill references: `.claude/skills/<sub>/...` or `/mnt/skills/{user,public}/<sub>/...`.
|
|
34
|
+
// These are the load-bearing dependency for composites (e.g. analyst-manual-full → explore,
|
|
35
|
+
// goap-research-ed25519, problem-solver-enhanced). Only warn about sub-skills NOT already in
|
|
36
|
+
// this bundle set — if they're all bundled, the set is self-contained.
|
|
37
|
+
const subs = new Set<string>();
|
|
38
|
+
for (const m of skillMd.matchAll(/(?:\.claude\/skills|\/mnt\/skills\/(?:user|public))\/([a-z0-9][a-z0-9-]*)/g)) {
|
|
39
|
+
if (m[1] !== undefined && m[1] !== id) subs.add(m[1]);
|
|
40
|
+
}
|
|
41
|
+
const missing = [...subs].filter((s) => !bundledIds.has(s)).sort();
|
|
42
|
+
if (missing.length > 0) {
|
|
43
|
+
w.push(
|
|
44
|
+
`${id}: depends on sub-skill(s) ${missing.join(', ')} NOT in this bundle — add them ` +
|
|
45
|
+
`(--select …,${missing.join(',')}) or this skill won't load them standalone`,
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (/\/mnt\/skills\//.test(skillMd)) {
|
|
50
|
+
w.push(`${id}: references absolute /mnt/skills/... paths — rewrite to bundle-relative paths (e.g. just the skill id) for your runtime`);
|
|
51
|
+
}
|
|
52
|
+
if (/\bview\(\)/.test(skillMd)) {
|
|
53
|
+
w.push(`${id}: uses view() (Claude-Code file-read) — inline the reference or expose a file-read tool`);
|
|
54
|
+
}
|
|
30
55
|
return w;
|
|
31
56
|
}
|
|
32
57
|
|
|
@@ -64,6 +89,7 @@ export interface BundleResult {
|
|
|
64
89
|
*/
|
|
65
90
|
export function bundleSkills(opts: BundleOptions): BundleResult {
|
|
66
91
|
const found = new Set<string>();
|
|
92
|
+
const bundledIds = new Set(opts.ids);
|
|
67
93
|
const bundled: BundledSkill[] = [];
|
|
68
94
|
|
|
69
95
|
for (const id of opts.ids) {
|
|
@@ -81,7 +107,7 @@ export function bundleSkills(opts: BundleOptions): BundleResult {
|
|
|
81
107
|
const skillMd = files.find((f) => f.path.endsWith('/SKILL.md'))?.content;
|
|
82
108
|
const warnings = [
|
|
83
109
|
...emit.warnings,
|
|
84
|
-
...(typeof skillMd === 'string' ? hostCouplingWarnings(id, skillMd) : []),
|
|
110
|
+
...(typeof skillMd === 'string' ? hostCouplingWarnings(id, skillMd, bundledIds) : []),
|
|
85
111
|
];
|
|
86
112
|
const applied = applyEmitResult({ files, warnings: [] }, { targetRoot: opts.outRoot, force: opts.force === true });
|
|
87
113
|
bundled.push({ id, written: applied.written.length, skipped: applied.skipped.length, warnings });
|