@cohortapp/agent-sdk 2.12.0 → 2.13.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/bin/maestro.mjs +6 -2
- package/docs/guides/front-door-session.md +49 -0
- package/lib/cli/design.mjs +185 -0
- package/lib/cli/design.test.mjs +270 -0
- package/lib/cli/global-setup-extras.mjs +44 -0
- package/lib/cli/global-setup-extras.test.mjs +95 -0
- package/lib/cli/session.mjs +11 -1
- package/lib/cli/session.test.mjs +17 -6
- package/lib/collective/global-config.mjs +5 -0
- package/lib/collective/global-config.test.mjs +5 -0
- package/lib/collective/vendor-skills.mjs +305 -0
- package/lib/collective/vendor-skills.test.mjs +306 -0
- package/lib/design/design-md.mjs +793 -0
- package/lib/design/design-md.test.mjs +318 -0
- package/lib/design/fixtures/DESIGN.golden.md +238 -0
- package/lib/design/fixtures/PRODUCT.golden.md +67 -0
- package/lib/design/fixtures/foundation.json +133 -0
- package/lib/design/refresh-gate.mjs +154 -0
- package/lib/design/refresh-gate.test.mjs +144 -0
- package/lib/design/write.mjs +275 -0
- package/lib/design/write.test.mjs +241 -0
- package/lib/prompts/parallelism.mjs +79 -0
- package/lib/prompts/parallelism.test.mjs +177 -0
- package/package.json +1 -1
- package/plugins/maestro-skills/plugin.json +4 -0
- package/plugins/maestro-skills/skills/cohort-design.md +153 -0
- package/plugins/maestro-skills/vendor/emilkowalski/LICENSE +21 -0
- package/plugins/maestro-skills/vendor/emilkowalski/UPSTREAM.json +70 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/animate/RECIPES.md +324 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/animate/SKILL.md +199 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/animation-vocabulary/SKILL.md +173 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/apple-design/SKILL.md +282 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/emil-design-eng/SKILL.md +674 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/find-animation-opportunities/SKILL.md +132 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/improve-animations/AUDIT.md +115 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/improve-animations/PLAN-TEMPLATE.md +73 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/improve-animations/SKILL.md +101 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/prototype/PICKER.md +197 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/prototype/SKILL.md +90 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/review-animations/SKILL.md +112 -0
- package/plugins/maestro-skills/vendor/emilkowalski/skills/review-animations/STANDARDS.md +187 -0
- package/plugins/maestro-skills/vendor/impeccable/LICENSE +191 -0
- package/plugins/maestro-skills/vendor/impeccable/NOTICE.md +11 -0
- package/plugins/maestro-skills/vendor/impeccable/SKILL.md +86 -0
- package/plugins/maestro-skills/vendor/impeccable/UPSTREAM.json +201 -0
- package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-asset-producer.md +42 -0
- package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-documenter.md +29 -0
- package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-finish-reviewer.md +43 -0
- package/plugins/maestro-skills/vendor/impeccable/agents/impeccable-manual-edit-applier.md +97 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/adapt.md +312 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/adapt.native.md +58 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/android.md +46 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/animate.md +89 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/audit.md +136 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/audit.native.md +139 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/bolder.md +33 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/clarify.md +94 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/colorize.md +86 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/craft-floor.md +44 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/craft.md +5 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/critique.md +806 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/degraded/asset-producer.md +37 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/degraded/documenter.md +24 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/degraded/finish-reviewer.md +38 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/degraded/manual-edit-applier.md +92 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/delight.md +70 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/distill.md +111 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/doctor.md +54 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/document.md +416 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/extract.md +69 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/harden.md +336 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/hooks.md +111 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/init.md +131 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/ios.md +51 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/layout.md +84 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/live-setup.md +104 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/live.md +325 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/new-work.md +147 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/onboard.md +234 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/operate.md +61 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/optimize.md +258 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/overdrive.md +127 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/polish.md +105 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/quieter.md +99 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/routing.md +24 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/shape.md +59 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/typeset.md +80 -0
- package/plugins/maestro-skills/vendor/impeccable/reference/visualize.md +46 -0
- package/plugins/maestro-skills/vendor/taste-skill/LICENSE +21 -0
- package/plugins/maestro-skills/vendor/taste-skill/UPSTREAM.json +37 -0
- package/plugins/maestro-skills/vendor/taste-skill/skills/minimalist-skill/SKILL.md +85 -0
- package/plugins/maestro-skills/vendor/taste-skill/skills/redesign-skill/SKILL.md +178 -0
- package/plugins/maestro-skills/vendor/taste-skill/skills/soft-skill/SKILL.md +98 -0
- package/plugins/maestro-skills/vendor/taste-skill/skills/taste-skill/SKILL.md +1206 -0
- package/plugins/maestro-skills/vendor/unlazy/LICENSE +21 -0
- package/plugins/maestro-skills/vendor/unlazy/SECURITY.md +72 -0
- package/plugins/maestro-skills/vendor/unlazy/SKILL.md +104 -0
- package/plugins/maestro-skills/vendor/unlazy/UPSTREAM.json +94 -0
- package/plugins/maestro-skills/vendor/unlazy/references/dispatch.md +82 -0
- package/plugins/maestro-skills/vendor/unlazy/references/gates.md +149 -0
- package/plugins/maestro-skills/vendor/unlazy/references/method.md +49 -0
- package/plugins/maestro-skills/vendor/unlazy/references/orchestration.md +107 -0
- package/plugins/maestro-skills/vendor/unlazy/references/parallel.md +133 -0
- package/plugins/maestro-skills/vendor/unlazy/references/token-economy.md +48 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/dispatch-check.mjs +139 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/gate-check.mjs +960 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/gate-lint.mjs +245 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/lib/check-supervisor.mjs +46 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/lib/dispatch.mjs +293 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/lib/gates.mjs +953 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/lib/process-tree.mjs +161 -0
- package/plugins/maestro-skills/vendor/unlazy/scripts/lib/regex-worker.mjs +9 -0
- package/plugins/maestro-skills/vendor/unlazy/templates/PLAN.md +116 -0
- package/plugins/maestro-skills/vendor/unlazy/templates/gates-leaf.md +51 -0
- package/plugins/maestro-skills/vendor/unlazy/templates/gates-node.md +51 -0
- package/scripts/ci/check-skill-packs.mjs +388 -0
- package/scripts/ci/check-skill-packs.test.mjs +495 -0
- package/scripts/ci/check.mjs +3 -0
- package/scripts/daemon/agent-daemon-design.test.mjs +238 -0
- package/scripts/daemon/agent-daemon.mjs +108 -0
- package/scripts/daemon/cadence-consumer-frontdoor.test.mjs +61 -2
- package/scripts/daemon/cadence-consumer.mjs +46 -22
- package/scripts/daemon/prompt-builder.mjs +19 -3
- package/scripts/local-triggers/autoupdate.test.mjs +33 -3
- package/scripts/vendor/skill-packs.mjs +354 -0
- package/scripts/vendor/sync-skill-packs.mjs +242 -0
- package/scripts/vendor/sync-skill-packs.test.mjs +103 -0
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for lib/collective/vendor-skills.mjs — installing the VENDORED design
|
|
3
|
+
* skill packs into a seat's ~/.claude/skills.
|
|
4
|
+
*
|
|
5
|
+
* Three properties carry the weight, and each is pinned here:
|
|
6
|
+
*
|
|
7
|
+
* 1. **It installs under the frontmatter name**, not the directory name —
|
|
8
|
+
* `taste-skill/skills/soft-skill` is `high-end-visual-design` to every
|
|
9
|
+
* piece of prose that refers to it, including the harmoniser skill.
|
|
10
|
+
* 2. **It is idempotent.** A second run over an unchanged tree writes
|
|
11
|
+
* nothing, because `global-setup` runs on every upgrade hop on 40+ seats.
|
|
12
|
+
* 3. **It never clobbers a directory that is not ours.** A human who
|
|
13
|
+
* installed upstream `impeccable` themselves — launcher, hooks, live mode
|
|
14
|
+
* — keeps it, and the run says so instead of silently taking it away.
|
|
15
|
+
*
|
|
16
|
+
* The end-to-end cases run against the REAL vendored trees in a throwaway HOME,
|
|
17
|
+
* because a plan that is right about a synthetic pack and wrong about
|
|
18
|
+
* `emilkowalski`'s nested skill roots would ship.
|
|
19
|
+
*
|
|
20
|
+
* @module lib/collective/vendor-skills.test
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
import { describe, it } from "node:test";
|
|
24
|
+
import assert from "node:assert/strict";
|
|
25
|
+
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync, existsSync, statSync } from "node:fs";
|
|
26
|
+
import { tmpdir } from "node:os";
|
|
27
|
+
import { join, dirname } from "node:path";
|
|
28
|
+
import { fileURLToPath } from "node:url";
|
|
29
|
+
import {
|
|
30
|
+
frontmatterName, ownership, planVendorSkills, installVendorSkills, markerFor,
|
|
31
|
+
packSize, looksLikeSkillsDir, MARKER_FILE, MARKER_OWNER,
|
|
32
|
+
} from "./vendor-skills.mjs";
|
|
33
|
+
import { PACKS, findPack } from "../../scripts/vendor/skill-packs.mjs";
|
|
34
|
+
|
|
35
|
+
const SDK_ROOT = join(dirname(fileURLToPath(import.meta.url)), "..", "..");
|
|
36
|
+
|
|
37
|
+
/** A throwaway HOME. Returns {home, skillsDir, cleanup}. */
|
|
38
|
+
function throwawayHome() {
|
|
39
|
+
const home = mkdtempSync(join(tmpdir(), "maestro-vendor-home-"));
|
|
40
|
+
return {
|
|
41
|
+
home,
|
|
42
|
+
skillsDir: join(home, ".claude", "skills"),
|
|
43
|
+
cleanup: () => rmSync(home, { recursive: true, force: true }),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe("vendor-skills: pure helpers", () => {
|
|
48
|
+
it("frontmatterName reads the name and refuses a body that has none", () => {
|
|
49
|
+
assert.equal(frontmatterName("---\nname: impeccable\nversion: 4.3.1\n---\n# x"), "impeccable");
|
|
50
|
+
assert.equal(frontmatterName('---\nname: "quoted-name"\n---\n'), "quoted-name");
|
|
51
|
+
assert.equal(frontmatterName("# no frontmatter\n"), null);
|
|
52
|
+
assert.equal(frontmatterName("---\ndescription: no name here\n---\n"), null);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
it("frontmatterName refuses a name that would escape the skills directory", () => {
|
|
56
|
+
assert.equal(frontmatterName("---\nname: ../../etc\n---\n"), null);
|
|
57
|
+
assert.equal(frontmatterName("---\nname: a/b\n---\n"), null);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("looksLikeSkillsDir only accepts a path ending in skills/", () => {
|
|
61
|
+
assert.equal(looksLikeSkillsDir("/home/x/.claude/skills"), true);
|
|
62
|
+
assert.equal(looksLikeSkillsDir("/home/x/.claude"), false);
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
it("markerFor is deterministic — no clock, so a re-run writes nothing", () => {
|
|
66
|
+
const pack = findPack("unlazy");
|
|
67
|
+
assert.equal(markerFor(pack, "unlazy"), markerFor(pack, "unlazy"));
|
|
68
|
+
const doc = JSON.parse(markerFor(pack, "unlazy"));
|
|
69
|
+
assert.equal(doc.owner, MARKER_OWNER);
|
|
70
|
+
assert.equal(doc.sha, pack.sha);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
describe("vendor-skills: ownership", () => {
|
|
75
|
+
it("reports absent / ours / foreign", () => {
|
|
76
|
+
const { home, cleanup } = throwawayHome();
|
|
77
|
+
try {
|
|
78
|
+
const absent = join(home, "nothing");
|
|
79
|
+
assert.equal(ownership(absent), "absent");
|
|
80
|
+
|
|
81
|
+
const foreign = join(home, "impeccable");
|
|
82
|
+
mkdirSync(foreign, { recursive: true });
|
|
83
|
+
writeFileSync(join(foreign, "SKILL.md"), "the human's own install\n");
|
|
84
|
+
assert.equal(ownership(foreign), "foreign");
|
|
85
|
+
|
|
86
|
+
const ours = join(home, "unlazy");
|
|
87
|
+
mkdirSync(ours, { recursive: true });
|
|
88
|
+
writeFileSync(join(ours, MARKER_FILE), markerFor(findPack("unlazy"), "unlazy"));
|
|
89
|
+
assert.equal(ownership(ours), "ours");
|
|
90
|
+
|
|
91
|
+
writeFileSync(join(ours, MARKER_FILE), "{not json");
|
|
92
|
+
assert.equal(ownership(ours), "foreign", "an unreadable marker is not proof of ownership");
|
|
93
|
+
|
|
94
|
+
writeFileSync(join(ours, MARKER_FILE), JSON.stringify({ owner: "someone-else" }));
|
|
95
|
+
assert.equal(ownership(ours), "foreign");
|
|
96
|
+
} finally { cleanup(); }
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
describe("vendor-skills: the plan over the real vendored trees", () => {
|
|
101
|
+
const { skills, errors } = planVendorSkills({ sdkRoot: SDK_ROOT, skillsDir: "/tmp/unused", packs: PACKS });
|
|
102
|
+
|
|
103
|
+
it("plans one skill per declared skill root, with no errors", () => {
|
|
104
|
+
assert.deepEqual(errors, [], "every pack's tree is present and every root has a SKILL.md");
|
|
105
|
+
const roots = PACKS.reduce((n, p) => n + p.skillRoots.length, 0);
|
|
106
|
+
assert.equal(skills.length, roots);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("installs under the frontmatter name, not the directory name", () => {
|
|
110
|
+
const names = skills.map((s) => s.name);
|
|
111
|
+
for (const expected of [
|
|
112
|
+
"impeccable", "unlazy",
|
|
113
|
+
"emil-design-eng", "animate", "animation-vocabulary", "apple-design",
|
|
114
|
+
"find-animation-opportunities", "improve-animations", "review-animations", "prototype",
|
|
115
|
+
"design-taste-frontend", "redesign-existing-projects", "high-end-visual-design", "minimalist-ui",
|
|
116
|
+
]) assert.ok(names.includes(expected), `expected skill ${expected}, got ${names.join(", ")}`);
|
|
117
|
+
assert.equal(new Set(names).size, names.length, "no two packs claim the same directory");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
it("gives every skill a SKILL.md at its root and never a sibling skill's files", () => {
|
|
121
|
+
for (const s of skills) {
|
|
122
|
+
assert.ok(s.files.some((f) => f.to === "SKILL.md"), `${s.name} has SKILL.md at its root`);
|
|
123
|
+
assert.ok(s.files.every((f) => !f.to.startsWith("skills/")), `${s.name} carries no nested skills/ path`);
|
|
124
|
+
}
|
|
125
|
+
const animate = skills.find((s) => s.name === "animate");
|
|
126
|
+
assert.ok(animate.files.some((f) => f.to === "RECIPES.md"), "sibling reference file comes along");
|
|
127
|
+
assert.ok(animate.files.some((f) => f.to === "LICENSE"), "a sub-directory skill still ships its licence");
|
|
128
|
+
assert.ok(!animate.files.some((f) => f.to.includes("apple-design")), "a sibling skill's files stay out");
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
it("impeccable brings its reference tree, its subordinate briefs and its NOTICE", () => {
|
|
132
|
+
const imp = skills.find((s) => s.name === "impeccable");
|
|
133
|
+
assert.ok(imp.files.some((f) => f.to === "NOTICE.md"));
|
|
134
|
+
assert.ok(imp.files.some((f) => f.to.startsWith("reference/")));
|
|
135
|
+
assert.ok(imp.files.some((f) => f.to.startsWith("agents/impeccable-")));
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
it("a pack whose vendored tree is absent is an error, not a crash", () => {
|
|
139
|
+
const r = planVendorSkills({ sdkRoot: join(tmpdir(), "no-such-sdk-root"), skillsDir: "/tmp/unused", packs: PACKS });
|
|
140
|
+
assert.equal(r.skills.length, 0);
|
|
141
|
+
assert.equal(r.errors.length, PACKS.length);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
describe("vendor-skills: install into a throwaway HOME", () => {
|
|
146
|
+
it("installs every pack skill, is idempotent, and heals a tampered file", () => {
|
|
147
|
+
const { skillsDir, cleanup } = throwawayHome();
|
|
148
|
+
try {
|
|
149
|
+
const first = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS });
|
|
150
|
+
assert.deepEqual(first.errors, []);
|
|
151
|
+
assert.deepEqual(first.skipped, []);
|
|
152
|
+
assert.equal(first.unchanged.length, 0);
|
|
153
|
+
assert.ok(first.installed.length >= 14, `installed ${first.installed.length} skills`);
|
|
154
|
+
|
|
155
|
+
// The bytes landed, under the frontmatter name, with our marker.
|
|
156
|
+
const impeccable = join(skillsDir, "impeccable");
|
|
157
|
+
assert.ok(existsSync(join(impeccable, "SKILL.md")));
|
|
158
|
+
assert.ok(existsSync(join(impeccable, "reference", "critique.md")));
|
|
159
|
+
assert.ok(existsSync(join(impeccable, "LICENSE")));
|
|
160
|
+
assert.equal(ownership(impeccable), "ours");
|
|
161
|
+
assert.equal(statSync(join(impeccable, "SKILL.md")).mode & 0o777, 0o644);
|
|
162
|
+
|
|
163
|
+
const minimalist = join(skillsDir, "minimalist-ui");
|
|
164
|
+
assert.match(readFileSync(join(minimalist, "SKILL.md"), "utf8"), /name: minimalist-ui/);
|
|
165
|
+
|
|
166
|
+
// Second run: nothing written.
|
|
167
|
+
const second = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS });
|
|
168
|
+
assert.deepEqual(second.installed, [], "idempotent");
|
|
169
|
+
assert.equal(second.unchanged.length, first.installed.length);
|
|
170
|
+
|
|
171
|
+
// A locally edited file is restored; a stray file inside a directory we
|
|
172
|
+
// own is removed (it would otherwise be read as skill content forever).
|
|
173
|
+
writeFileSync(join(impeccable, "SKILL.md"), "tampered\n");
|
|
174
|
+
writeFileSync(join(impeccable, "stray.md"), "not upstream\n");
|
|
175
|
+
const third = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS });
|
|
176
|
+
assert.ok(third.installed.includes("impeccable"));
|
|
177
|
+
assert.match(readFileSync(join(impeccable, "SKILL.md"), "utf8"), /^---\nname: impeccable/);
|
|
178
|
+
assert.equal(existsSync(join(impeccable, "stray.md")), false);
|
|
179
|
+
} finally { cleanup(); }
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("leaves a FOREIGN directory exactly as it is and says which one", () => {
|
|
183
|
+
const { skillsDir, cleanup } = throwawayHome();
|
|
184
|
+
try {
|
|
185
|
+
// The human installed upstream impeccable themselves — launcher and all.
|
|
186
|
+
const foreign = join(skillsDir, "impeccable");
|
|
187
|
+
mkdirSync(join(foreign, "scripts"), { recursive: true });
|
|
188
|
+
const own = "---\nname: impeccable\n---\nthe human's own copy, with its launcher\n";
|
|
189
|
+
writeFileSync(join(foreign, "SKILL.md"), own);
|
|
190
|
+
writeFileSync(join(foreign, "scripts", "impeccable"), "#!/bin/sh\n");
|
|
191
|
+
|
|
192
|
+
const r = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS });
|
|
193
|
+
assert.deepEqual(r.installed.includes("impeccable"), false, "not installed over the human's copy");
|
|
194
|
+
assert.equal(r.skipped.length, 1);
|
|
195
|
+
assert.equal(r.skipped[0].name, "impeccable");
|
|
196
|
+
assert.match(r.skipped[0].reason, /not maestro's/);
|
|
197
|
+
assert.equal(readFileSync(join(foreign, "SKILL.md"), "utf8"), own, "byte-for-byte untouched");
|
|
198
|
+
assert.ok(existsSync(join(foreign, "scripts", "impeccable")), "their launcher is still theirs");
|
|
199
|
+
// Every other pack still installed.
|
|
200
|
+
assert.ok(r.installed.includes("unlazy"));
|
|
201
|
+
assert.ok(existsSync(join(skillsDir, "unlazy", "SKILL.md")));
|
|
202
|
+
} finally { cleanup(); }
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("dryRun reports what it would do and writes nothing", () => {
|
|
206
|
+
const { skillsDir, cleanup } = throwawayHome();
|
|
207
|
+
try {
|
|
208
|
+
const r = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS, dryRun: true });
|
|
209
|
+
assert.ok(r.installed.length > 0);
|
|
210
|
+
assert.equal(existsSync(skillsDir), false, "nothing written");
|
|
211
|
+
} finally { cleanup(); }
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
it("refuses a destination that is not a skills directory, and writes nothing", () => {
|
|
215
|
+
// The failure this pins: an unset variable interpolated to
|
|
216
|
+
// "undefined/home/.claude/skills" and a full 14-skill tree was created at
|
|
217
|
+
// ./undefined/ relative to the cwd, inside a repo checkout.
|
|
218
|
+
const home = mkdtempSync(join(tmpdir(), "maestro-vendor-bogus-"));
|
|
219
|
+
try {
|
|
220
|
+
const bogus = join(home, ".claude", "skulls");
|
|
221
|
+
const r = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir: bogus, packs: PACKS });
|
|
222
|
+
assert.equal(r.ok, false);
|
|
223
|
+
assert.deepEqual(r.installed, []);
|
|
224
|
+
assert.match(r.errors[0].error, /not a skills directory/);
|
|
225
|
+
assert.equal(existsSync(bogus), false, "nothing was created");
|
|
226
|
+
} finally { rmSync(home, { recursive: true, force: true }); }
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
it("refuses to install two packs into one skill name rather than letting one eat the other", () => {
|
|
230
|
+
// No collision exists today; the registry is meant to grow, and
|
|
231
|
+
// ownership() reads only the owner string, so the second pack would see
|
|
232
|
+
// "ours", delete the first pack's files as stale and report a normal
|
|
233
|
+
// install.
|
|
234
|
+
const fakeSdk = mkdtempSync(join(tmpdir(), "maestro-vendor-sdk-"));
|
|
235
|
+
const { skillsDir, cleanup } = throwawayHome();
|
|
236
|
+
try {
|
|
237
|
+
const packs = ["alpha", "beta"].map((id) => {
|
|
238
|
+
const dir = join(fakeSdk, "plugins", "maestro-skills", "vendor", id);
|
|
239
|
+
mkdirSync(dir, { recursive: true });
|
|
240
|
+
writeFileSync(join(dir, "SKILL.md"), `---\nname: shared-skill\n---\nfrom ${id}\n`);
|
|
241
|
+
return { id, repo: `example/${id}`, sha: "0".repeat(40), license: "MIT", skillRoots: ["."] };
|
|
242
|
+
});
|
|
243
|
+
const r = planVendorSkills({ sdkRoot: fakeSdk, skillsDir, packs });
|
|
244
|
+
assert.equal(r.skills.length, 1, "only the first claim stands");
|
|
245
|
+
assert.equal(r.skills[0].pack.id, "alpha");
|
|
246
|
+
assert.ok(r.errors.some((e) => e.pack === "beta" && /already claimed by pack alpha/.test(e.error)), JSON.stringify(r.errors));
|
|
247
|
+
|
|
248
|
+
const inst = installVendorSkills({ sdkRoot: fakeSdk, skillsDir, packs });
|
|
249
|
+
assert.equal(inst.ok, false, "a collision is an error, not a silent overwrite");
|
|
250
|
+
assert.match(readFileSync(join(skillsDir, "shared-skill", "SKILL.md"), "utf8"), /from alpha/);
|
|
251
|
+
} finally { cleanup(); rmSync(fakeSdk, { recursive: true, force: true }); }
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it("copies a directory aside before overwriting work somebody did in it", () => {
|
|
255
|
+
const { skillsDir, cleanup } = throwawayHome();
|
|
256
|
+
try {
|
|
257
|
+
installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS, stamp: "STAMP" });
|
|
258
|
+
const dir = join(skillsDir, "impeccable");
|
|
259
|
+
const tuned = "---\nname: impeccable\n---\ntuned for Cohort\n";
|
|
260
|
+
writeFileSync(join(dir, "SKILL.md"), tuned);
|
|
261
|
+
writeFileSync(join(dir, "cohort-notes.md"), "a person's own notes\n");
|
|
262
|
+
|
|
263
|
+
const r = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS, stamp: "STAMP" });
|
|
264
|
+
const b = r.backups.find((x) => x.name === "impeccable");
|
|
265
|
+
assert.ok(b, `expected a backup, got ${JSON.stringify(r.backups)}`);
|
|
266
|
+
assert.deepEqual(b.files.sort(), ["SKILL.md", "cohort-notes.md"]);
|
|
267
|
+
assert.equal(readFileSync(join(b.path, "SKILL.md"), "utf8"), tuned, "their edit survives");
|
|
268
|
+
assert.equal(readFileSync(join(b.path, "cohort-notes.md"), "utf8"), "a person's own notes\n");
|
|
269
|
+
// …and the live directory is back to the vendored bytes.
|
|
270
|
+
assert.match(readFileSync(join(dir, "SKILL.md"), "utf8"), /^---\nname: impeccable/);
|
|
271
|
+
assert.equal(existsSync(join(dir, "cohort-notes.md")), false);
|
|
272
|
+
} finally { cleanup(); }
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
it("backs nothing up when it only rewrites files it wrote itself", () => {
|
|
276
|
+
const { skillsDir, cleanup } = throwawayHome();
|
|
277
|
+
try {
|
|
278
|
+
const first = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS, stamp: "STAMP" });
|
|
279
|
+
assert.deepEqual(first.backups, []);
|
|
280
|
+
const second = installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS, stamp: "STAMP" });
|
|
281
|
+
assert.deepEqual(second.backups, [], "an idempotent re-run leaves no backup directories behind");
|
|
282
|
+
assert.deepEqual(second.installed, []);
|
|
283
|
+
} finally { cleanup(); }
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it("puts no hook machinery on the seat", () => {
|
|
287
|
+
const { skillsDir, cleanup } = throwawayHome();
|
|
288
|
+
try {
|
|
289
|
+
installVendorSkills({ sdkRoot: SDK_ROOT, skillsDir, packs: PACKS });
|
|
290
|
+
const unlazy = join(skillsDir, "unlazy");
|
|
291
|
+
assert.ok(existsSync(join(unlazy, "scripts", "gate-check.mjs")), "the gate checker is the reason scripts/ is vendored");
|
|
292
|
+
for (const name of ["install-hooks.mjs", "stop-hook.mjs"]) {
|
|
293
|
+
assert.equal(existsSync(join(unlazy, "scripts", name)), false,
|
|
294
|
+
`${name} would be one \`node <path>\` away from a Stop hook in the settings file every session reads`);
|
|
295
|
+
}
|
|
296
|
+
} finally { cleanup(); }
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
it("packSize reports a file count and a byte size for every pack", () => {
|
|
300
|
+
for (const pack of PACKS) {
|
|
301
|
+
const s = packSize(SDK_ROOT, pack);
|
|
302
|
+
assert.ok(s.files > 0, `${pack.id} has files`);
|
|
303
|
+
assert.ok(s.bytes > 0, `${pack.id} has bytes`);
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
});
|