@cohortapp/agent-sdk 2.11.15 → 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/.env.example +37 -22
- package/README.md +2 -0
- package/bin/maestro.mjs +117 -39
- package/bin/maestro.test.mjs +175 -5
- package/docs/guides/front-door-session.md +313 -0
- package/docs/guides/mac-mini.md +100 -28
- package/docs/guides/org-onboarding.md +1 -1
- package/docs/guides/setup-wizard.md +9 -5
- package/docs/runbooks/cohort-cutover.md +11 -1
- package/docs/runbooks/mac-mini-bootstrap.md +38 -63
- package/lib/cadence-bus-requeue.test.mjs +83 -0
- package/lib/cadence-bus.mjs +43 -7
- package/lib/channels/inbox-item.mjs +59 -2
- package/lib/cli/board.mjs +285 -0
- package/lib/cli/board.test.mjs +227 -0
- package/lib/cli/design.mjs +185 -0
- package/lib/cli/design.test.mjs +270 -0
- package/lib/cli/doctor-checks.mjs +441 -0
- package/lib/cli/doctor-checks.test.mjs +336 -0
- package/lib/cli/global-setup-extras.mjs +454 -0
- package/lib/cli/global-setup-extras.test.mjs +462 -0
- package/lib/cli/inbox.mjs +304 -0
- package/lib/cli/inbox.test.mjs +230 -0
- package/lib/cli/session-ack.mjs +63 -0
- package/lib/cli/session-ack.test.mjs +63 -0
- package/lib/cli/session.mjs +760 -0
- package/lib/cli/session.test.mjs +613 -0
- package/lib/collective/global-config.mjs +209 -6
- package/lib/collective/global-config.test.mjs +145 -0
- package/lib/collective/global-skills.mjs +145 -0
- package/lib/collective/global-skills.test.mjs +126 -0
- package/lib/collective/presence.mjs +4 -3
- package/lib/collective/vendor-skills.mjs +305 -0
- package/lib/collective/vendor-skills.test.mjs +306 -0
- package/lib/comms/send-gate.mjs +115 -0
- package/lib/comms/send-gate.test.mjs +113 -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/feature-init.mjs +2 -2
- package/lib/mcp/server.test.mjs +9 -4
- package/lib/model-router/spawn.test.mjs +21 -0
- package/lib/org/board-mine-cache.mjs +99 -0
- package/lib/org/board-mine-cache.test.mjs +53 -0
- package/lib/org/board.mjs +11 -0
- package/lib/org/board.test.mjs +11 -1
- package/lib/org/client.mjs +36 -0
- package/lib/org/client.test.mjs +46 -0
- package/lib/org/inbound/directedness.mjs +18 -2
- package/lib/org/inbound/directedness.test.mjs +58 -0
- package/lib/org/inbound/index.mjs +8 -1
- package/lib/org/inbound/index.test.mjs +22 -0
- package/lib/org/mesh-directives.test.mjs +110 -0
- package/lib/org/mesh.mjs +61 -1
- package/lib/org/protocol.checksum +1 -1
- package/lib/org/protocol.mjs +52 -0
- package/lib/org/protocol.test.mjs +12 -1
- package/lib/org/registry.mjs +3 -2
- package/lib/org/tool-surface.mjs +120 -0
- package/lib/org/tool-surface.test.mjs +118 -5
- package/lib/prompts/parallelism.mjs +79 -0
- package/lib/prompts/parallelism.test.mjs +177 -0
- package/lib/security/external-content.mjs +1 -1
- package/lib/security/external-content.test.mjs +17 -0
- package/lib/session/config.mjs +137 -0
- package/lib/session/config.test.mjs +92 -0
- package/lib/session/feed-core.mjs +229 -0
- package/lib/session/feed-core.test.mjs +198 -0
- package/lib/session/first-run.mjs +126 -0
- package/lib/session/first-run.test.mjs +121 -0
- package/lib/session/frontdoor.mjs +266 -0
- package/lib/session/frontdoor.test.mjs +205 -0
- package/lib/session/handoffs.mjs +295 -0
- package/lib/session/handoffs.test.mjs +183 -0
- package/lib/session/identity.mjs +220 -0
- package/lib/session/identity.test.mjs +180 -0
- package/lib/session/inbox-claims.mjs +434 -0
- package/lib/session/inbox-claims.test.mjs +286 -0
- package/lib/session/launch-args.mjs +161 -0
- package/lib/session/launch-args.test.mjs +157 -0
- package/lib/session/liveness.mjs +174 -0
- package/lib/session/liveness.test.mjs +100 -0
- package/lib/session/status-summary.mjs +172 -0
- package/lib/session/status-summary.test.mjs +118 -0
- package/lib/session-permissions.mjs +39 -3
- package/lib/session-permissions.test.mjs +20 -0
- package/lib/setup/claude-probe.mjs +161 -24
- package/lib/setup/claude-probe.test.mjs +187 -0
- package/lib/setup/sections/learning.mjs +2 -1
- package/lib/setup/sections/model.mjs +104 -24
- package/lib/setup/sections/model.test.mjs +240 -0
- package/lib/setup/sections/org.mjs +27 -2
- package/lib/setup/sections/org.test.mjs +35 -2
- package/lib/setup/sections/verify.mjs +5 -0
- package/lib/setup/state.mjs +30 -10
- package/lib/setup/state.test.mjs +24 -1
- package/lib/singleton.js +11 -3
- package/lib/singleton.test.mjs +16 -0
- package/lib/subagents/lock.mjs +1 -1
- package/lib/telemetry/collect.mjs +270 -6
- package/lib/telemetry/collect.test.mjs +196 -1
- package/lib/upgrade/global-refresh.mjs +108 -0
- package/lib/upgrade/global-refresh.test.mjs +65 -0
- package/lib/upgrade/launchd-reconcile.mjs +327 -0
- package/lib/upgrade/launchd-reconcile.test.mjs +272 -0
- package/lib/upgrade/post-steps.mjs +151 -0
- package/lib/upgrade/post-steps.test.mjs +200 -0
- package/lib/upgrade/verify.mjs +215 -0
- package/lib/upgrade/verify.test.mjs +164 -0
- package/lib/voice/outbound.mjs +3 -2
- package/lib/voice/post-call-brief.mjs +2 -1
- package/lib/voice/session-rotation.mjs +6 -1
- package/lib/voice/session-rotation.test.mjs +114 -0
- package/package.json +3 -3
- package/plugins/maestro-skills/plugin.json +25 -1
- package/plugins/maestro-skills/skills/board-work.md +63 -0
- package/plugins/maestro-skills/skills/cohort-design.md +153 -0
- package/plugins/maestro-skills/skills/inbound-triage.md +80 -0
- package/plugins/maestro-skills/skills/main-session.md +102 -0
- package/plugins/maestro-skills/skills/peer-sessions.md +65 -0
- package/plugins/maestro-skills/skills/persona-discipline.md +75 -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/scaffold/CLAUDE.md +24 -0
- package/scripts/ci/check-durable-write-seam.mjs +147 -0
- package/scripts/ci/check-durable-write-seam.test.mjs +90 -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 +6 -0
- package/scripts/collective/hook-runner.mjs +39 -4
- package/scripts/collective/hook-runner.test.mjs +85 -2
- package/scripts/daemon/agent-daemon-board-mine.test.mjs +96 -0
- package/scripts/daemon/agent-daemon-design.test.mjs +238 -0
- package/scripts/daemon/agent-daemon-frontdoor.test.mjs +60 -0
- package/scripts/daemon/agent-daemon.mjs +249 -10
- package/scripts/daemon/agent-daemon.test.mjs +73 -0
- package/scripts/daemon/assurance-e2e.test.mjs +141 -6
- package/scripts/daemon/assurance.mjs +461 -37
- package/scripts/daemon/assurance.test.mjs +408 -43
- package/scripts/daemon/cadence-consumer-frontdoor.test.mjs +393 -0
- package/scripts/daemon/cadence-consumer.mjs +289 -89
- package/scripts/daemon/cadence-handlers.mjs +53 -0
- package/scripts/daemon/classifier.mjs +1 -1
- package/scripts/daemon/dispatcher-resume.test.mjs +166 -0
- package/scripts/daemon/dispatcher.mjs +127 -19
- package/scripts/daemon/health.mjs +12 -1
- package/scripts/daemon/inbox-deferral-session.test.mjs +49 -0
- package/scripts/daemon/inbox-deferral.mjs +6 -0
- package/scripts/daemon/lib/self-echo.mjs +201 -0
- package/scripts/daemon/lib/self-echo.test.mjs +153 -0
- package/scripts/daemon/maestro-daemon.mjs +3 -0
- package/scripts/daemon/prompt-builder.mjs +19 -3
- package/scripts/daemon/responder.mjs +51 -40
- package/scripts/daemon/sdk-version.mjs +51 -0
- package/scripts/daemon/sdk-version.test.mjs +31 -0
- package/scripts/hooks/pre-send-audit.sh +97 -4
- package/scripts/hooks/pre-send-audit.test.mjs +140 -1
- package/scripts/local-triggers/autoupdate.sh +243 -19
- package/scripts/local-triggers/autoupdate.test.mjs +518 -0
- package/scripts/local-triggers/generate-plists.sh +24 -1
- package/scripts/local-triggers/generate-plists.test.mjs +49 -11
- package/scripts/org/send-orgmail.first-contact.test.mjs +102 -0
- package/scripts/org/send-orgmail.mjs +27 -3
- package/scripts/poller/inbox-privilege-injection.test.mjs +167 -0
- package/scripts/poller/slack-poller.mjs +13 -1
- package/scripts/poller/utils.mjs +46 -1
- package/scripts/poller-launchd/install.sh +19 -11
- package/scripts/poller-launchd/install.test.mjs +243 -0
- package/scripts/poller-launchd/launchd-poller-wrapper.sh +92 -0
- package/scripts/poller-launchd/migrate.sh +66 -0
- package/scripts/poller-launchd/poller.plist.template +4 -2
- package/scripts/session/feed.mjs +237 -0
- package/scripts/session/feed.test.mjs +196 -0
- package/scripts/session/supervisor-sh.test.mjs +218 -0
- package/scripts/session/supervisor.mjs +328 -0
- package/scripts/session/supervisor.sh +141 -0
- package/scripts/session/supervisor.test.mjs +482 -0
- package/scripts/setup/configure-macos.sh +250 -55
- package/scripts/setup/configure-macos.test.mjs +306 -0
- package/scripts/setup/init-agent.sh +112 -7
- package/scripts/setup/init-agent.test.mjs +220 -1
- 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
- package/scripts/watchdog/memory-watchdog.sh +37 -1
- package/scripts/watchdog/memory-watchdog.test.mjs +64 -0
- package/scripts/setup/boot-claude-session.sh +0 -94
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
|
|
14
14
|
import { test } from "node:test";
|
|
15
15
|
import assert from "node:assert/strict";
|
|
16
|
-
import { readFileSync, writeFileSync, mkdtempSync, rmSync } from "node:fs";
|
|
16
|
+
import { readFileSync, writeFileSync, mkdtempSync, mkdirSync, chmodSync, existsSync, rmSync, readdirSync } from "node:fs";
|
|
17
|
+
import { spawnSync } from "node:child_process";
|
|
17
18
|
import { execFileSync } from "node:child_process";
|
|
18
19
|
import { join, dirname } from "node:path";
|
|
19
20
|
import { tmpdir } from "node:os";
|
|
@@ -137,6 +138,14 @@ test("init-agent.sh additions contain no allow-all permissions or dangerous-skip
|
|
|
137
138
|
assert.ok(!m[1].includes("Bash(*)"), "additions must not contain Bash(*) allow-all");
|
|
138
139
|
});
|
|
139
140
|
|
|
141
|
+
test("init-agent.sh creates the front-door session state and log directories", () => {
|
|
142
|
+
// launchd creates StandardOutPath's FILE but not its directory; the session
|
|
143
|
+
// plist logs to logs/session/. The feed/supervisor write under state/session/.
|
|
144
|
+
for (const d of ["logs/session", "state/session", "state/session/handoffs/done"]) {
|
|
145
|
+
assert.ok(scriptSrc.includes(`"${d}"`), `DIRS must include ${d}`);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
|
|
140
149
|
test("init-agent.sh chmods the .env to 600", () => {
|
|
141
150
|
assert.ok(/chmod 600 "\$ENV_FILE"/.test(scriptSrc),
|
|
142
151
|
"the agent .env must be chmod 600 after writing (no world-readable credentials)");
|
|
@@ -149,3 +158,213 @@ test("init-agent.sh deep-merges rather than cat>-overwriting settings.json", ()
|
|
|
149
158
|
assert.ok(scriptSrc.includes("node -e \"$MAESTRO_MERGE_NODE\""),
|
|
150
159
|
"the merge must run via the embedded node program");
|
|
151
160
|
});
|
|
161
|
+
|
|
162
|
+
// ---------------------------------------------------------------------------
|
|
163
|
+
// Front-door session prerequisites (design §3.7 / §6 WP-M3): the global SDK
|
|
164
|
+
// install and a terminal multiplexer. The block is embedded in init-agent.sh
|
|
165
|
+
// between BEGIN/END markers; we extract that exact block and run it under
|
|
166
|
+
// bash with stub binaries, so the test pins what the script actually ships.
|
|
167
|
+
// ---------------------------------------------------------------------------
|
|
168
|
+
|
|
169
|
+
function extractGlobalSdkBlock() {
|
|
170
|
+
const m = scriptSrc.match(/# --- BEGIN maestro global-sdk check[^\n]*\n([\s\S]*?)# --- END maestro global-sdk check ---/);
|
|
171
|
+
assert.ok(m, "global-sdk check block (BEGIN/END markers) not found in init-agent.sh");
|
|
172
|
+
return m[1];
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Run the extracted block with a stub `npm` (and optional `tmux`) on PATH.
|
|
177
|
+
* `npm ls -g` exits per `installed`; `npm view` prints `latest`; every call is
|
|
178
|
+
* appended to calls.log. Returns {status, stdout, calls}.
|
|
179
|
+
*/
|
|
180
|
+
function runGlobalSdkBlock({ installed, installedVersion = "1.0.0", latest = "1.0.0", tmux = false, screenBin, env = {} }) {
|
|
181
|
+
const dir = makeTmp();
|
|
182
|
+
try {
|
|
183
|
+
const bin = join(dir, "bin");
|
|
184
|
+
const log = join(dir, "calls.log");
|
|
185
|
+
mkdirSync(bin, { recursive: true });
|
|
186
|
+
writeFileSync(join(bin, "npm"), `#!/bin/bash
|
|
187
|
+
echo "npm $*" >> "${log}"
|
|
188
|
+
case "$1" in
|
|
189
|
+
ls) ${installed ? `echo "/usr/local/lib"; echo "└── @cohortapp/agent-sdk@${installedVersion}"; exit 0` : "exit 1"} ;;
|
|
190
|
+
view) echo "${latest}"; exit 0 ;;
|
|
191
|
+
install) exit 0 ;;
|
|
192
|
+
esac
|
|
193
|
+
exit 0
|
|
194
|
+
`);
|
|
195
|
+
chmodSync(join(bin, "npm"), 0o755);
|
|
196
|
+
if (tmux) { writeFileSync(join(bin, "tmux"), "#!/bin/bash\necho 'tmux 3.4'\n"); chmodSync(join(bin, "tmux"), 0o755); }
|
|
197
|
+
const prog = `log(){ echo "[init] $1"; }; ok(){ echo " ok $1"; }; warn(){ echo " warn $1"; }; fail(){ echo " FAIL $1"; exit 1; }\n${extractGlobalSdkBlock()}`;
|
|
198
|
+
writeFileSync(join(dir, "block.sh"), prog);
|
|
199
|
+
const r = spawnSync("/bin/bash", [join(dir, "block.sh")], {
|
|
200
|
+
encoding: "utf8",
|
|
201
|
+
env: { PATH: `${bin}:${env.MAESTRO_TEST_EXTRA_PATH ? `${env.MAESTRO_TEST_EXTRA_PATH}:` : ""}/usr/bin:/bin`, HOME: dir, MAESTRO_SCREEN_BIN: screenBin || join(dir, "no-such-screen"), ...env },
|
|
202
|
+
});
|
|
203
|
+
const calls = existsSync(log) ? readFileSync(log, "utf8") : "";
|
|
204
|
+
return { status: r.status, stdout: r.stdout + r.stderr, calls };
|
|
205
|
+
} finally {
|
|
206
|
+
rmSync(dir, { recursive: true, force: true });
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
test("global SDK present and current: verified, nothing installed", () => {
|
|
211
|
+
const r = runGlobalSdkBlock({ installed: true, installedVersion: "2.0.0", latest: "2.0.0", tmux: true });
|
|
212
|
+
assert.equal(r.status, 0, r.stdout);
|
|
213
|
+
assert.match(r.calls, /^npm ls -g @cohortapp\/agent-sdk/m, `must verify with npm ls -g; calls:\n${r.calls}`);
|
|
214
|
+
assert.ok(!/npm install -g/.test(r.calls), `must not install; calls:\n${r.calls}`);
|
|
215
|
+
assert.match(r.stdout, /Global SDK.*2\.0\.0/);
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
test("global SDK missing: installs @latest", () => {
|
|
219
|
+
const r = runGlobalSdkBlock({ installed: false, tmux: true });
|
|
220
|
+
assert.equal(r.status, 0, r.stdout);
|
|
221
|
+
assert.match(r.calls, /^npm install -g @cohortapp\/agent-sdk@latest/m, `expected a global install; calls:\n${r.calls}`);
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
test("global SDK outdated: upgrades to @latest", () => {
|
|
225
|
+
const r = runGlobalSdkBlock({ installed: true, installedVersion: "1.0.0", latest: "2.0.0", tmux: true });
|
|
226
|
+
assert.equal(r.status, 0, r.stdout);
|
|
227
|
+
assert.match(r.calls, /^npm install -g @cohortapp\/agent-sdk@latest/m, `expected an upgrade; calls:\n${r.calls}`);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
test("MAESTRO_SKIP_GLOBAL_INSTALL=1 verifies but never installs or upgrades", () => {
|
|
231
|
+
for (const scenario of [{ installed: false }, { installed: true, installedVersion: "1.0.0", latest: "2.0.0" }]) {
|
|
232
|
+
const r = runGlobalSdkBlock({ ...scenario, tmux: true, env: { MAESTRO_SKIP_GLOBAL_INSTALL: "1" } });
|
|
233
|
+
assert.equal(r.status, 0, r.stdout);
|
|
234
|
+
assert.match(r.calls, /^npm ls -g @cohortapp\/agent-sdk/m, "still verifies");
|
|
235
|
+
assert.ok(!/npm install/.test(r.calls), `must not install under the skip flag; calls:\n${r.calls}`);
|
|
236
|
+
assert.match(r.stdout, /MAESTRO_SKIP_GLOBAL_INSTALL/, "must say why it skipped");
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
test("multiplexer: tmux preferred, /usr/bin/screen accepted, neither → warning naming brew install tmux", () => {
|
|
241
|
+
const withTmux = runGlobalSdkBlock({ installed: true, tmux: true });
|
|
242
|
+
assert.match(withTmux.stdout, /tmux/);
|
|
243
|
+
const dir = makeTmp();
|
|
244
|
+
try {
|
|
245
|
+
const screen = join(dir, "screen");
|
|
246
|
+
writeFileSync(screen, "#!/bin/bash\necho 'Screen version 4.00.03'\n"); chmodSync(screen, 0o755);
|
|
247
|
+
const withScreen = runGlobalSdkBlock({ installed: true, tmux: false, screenBin: screen });
|
|
248
|
+
assert.equal(withScreen.status, 0, withScreen.stdout);
|
|
249
|
+
assert.match(withScreen.stdout, /screen/i);
|
|
250
|
+
} finally { rmSync(dir, { recursive: true, force: true }); }
|
|
251
|
+
const neither = runGlobalSdkBlock({ installed: true, tmux: false });
|
|
252
|
+
assert.equal(neither.status, 0, "a missing multiplexer is a warning, not a fatal (screen ships with macOS)");
|
|
253
|
+
assert.match(neither.stdout, /brew install tmux/);
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// ---------------------------------------------------------------------------
|
|
257
|
+
// Review fixes (2026-09-08): the global-sdk block also verifies PATH and never
|
|
258
|
+
// blocks on the registry; Step 5 never unload/loads a live session or daemon.
|
|
259
|
+
// ---------------------------------------------------------------------------
|
|
260
|
+
|
|
261
|
+
test("global SDK block: `npm view` carries a fetch timeout so an offline init-agent does not hang for minutes", () => {
|
|
262
|
+
const r = runGlobalSdkBlock({ installed: true, installedVersion: "2.0.0", latest: "2.0.0", tmux: true });
|
|
263
|
+
assert.match(r.calls, /^npm view @cohortapp\/agent-sdk version.*--fetch-timeout=\d+/m, `calls:\n${r.calls}`);
|
|
264
|
+
});
|
|
265
|
+
|
|
266
|
+
test("global SDK block: verifies that maestro and cohort-mcp resolve on PATH (spec §3.7(6))", () => {
|
|
267
|
+
const missing = runGlobalSdkBlock({ installed: true, installedVersion: "2.0.0", latest: "2.0.0", tmux: true });
|
|
268
|
+
assert.equal(missing.status, 0, missing.stdout);
|
|
269
|
+
assert.match(missing.stdout, /warn.*maestro.*not on PATH|warn.*not on PATH.*maestro/i, `must warn when maestro is missing from PATH:\n${missing.stdout}`);
|
|
270
|
+
assert.match(missing.stdout, /cohort-mcp/, "must name cohort-mcp too");
|
|
271
|
+
// Present on PATH → ok lines naming both.
|
|
272
|
+
const dir = makeTmp();
|
|
273
|
+
try {
|
|
274
|
+
const extra = join(dir, "gbin");
|
|
275
|
+
mkdirSync(extra, { recursive: true });
|
|
276
|
+
for (const b of ["maestro", "cohort-mcp"]) { writeFileSync(join(extra, b), "#!/bin/bash\nexit 0\n"); chmodSync(join(extra, b), 0o755); }
|
|
277
|
+
const present = runGlobalSdkBlock({ installed: true, installedVersion: "2.0.0", latest: "2.0.0", tmux: true, env: { MAESTRO_TEST_EXTRA_PATH: extra } });
|
|
278
|
+
assert.equal(present.status, 0, present.stdout);
|
|
279
|
+
assert.match(present.stdout, /ok.*maestro on PATH/i, present.stdout);
|
|
280
|
+
assert.match(present.stdout, /ok.*cohort-mcp on PATH/i, present.stdout);
|
|
281
|
+
assert.ok(!/not on PATH/.test(present.stdout));
|
|
282
|
+
} finally { rmSync(dir, { recursive: true, force: true }); }
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
function extractLaunchdBlock() {
|
|
286
|
+
const m = scriptSrc.match(/# --- BEGIN maestro launchd install[^\n]*\n([\s\S]*?)# --- END maestro launchd install ---/);
|
|
287
|
+
assert.ok(m, "launchd install block (BEGIN/END markers) not found in init-agent.sh");
|
|
288
|
+
return m[1];
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Run Step 5 with a stub launchctl whose `list <label>` exits 0 for labels in
|
|
293
|
+
* `loaded`. Generated plists live in scripts/local-triggers/plists/ of a
|
|
294
|
+
* fixture agent dir. Returns {status, stdout, calls, home}.
|
|
295
|
+
*/
|
|
296
|
+
function runLaunchdBlock({ plists, loaded = [], supervisor = true, migrate = false }) {
|
|
297
|
+
const dir = makeTmp();
|
|
298
|
+
const agent = join(dir, "agent");
|
|
299
|
+
const home = join(dir, "home");
|
|
300
|
+
const bin = join(dir, "bin");
|
|
301
|
+
const log = join(dir, "calls.log");
|
|
302
|
+
mkdirSync(join(agent, "scripts", "local-triggers", "plists"), { recursive: true });
|
|
303
|
+
mkdirSync(join(agent, "scripts", "session"), { recursive: true });
|
|
304
|
+
mkdirSync(join(agent, "scripts", "poller-launchd"), { recursive: true });
|
|
305
|
+
mkdirSync(join(home, "Library", "LaunchAgents"), { recursive: true });
|
|
306
|
+
mkdirSync(bin, { recursive: true });
|
|
307
|
+
for (const label of plists) writeFileSync(join(agent, "scripts", "local-triggers", "plists", `${label}.plist`), `<plist>${label}</plist>\n`);
|
|
308
|
+
if (supervisor) writeFileSync(join(agent, "scripts", "session", "supervisor.sh"), "#!/bin/bash\n");
|
|
309
|
+
if (migrate) { writeFileSync(join(agent, "scripts", "poller-launchd", "migrate.sh"), `#!/bin/bash\necho "migrate $*" >> "${log}"\n`); chmodSync(join(agent, "scripts", "poller-launchd", "migrate.sh"), 0o755); }
|
|
310
|
+
writeFileSync(join(bin, "launchctl"), `#!/bin/bash
|
|
311
|
+
echo "launchctl $*" >> "${log}"
|
|
312
|
+
if [ "$1" = "list" ] && [ -n "$2" ]; then case " ${loaded.join(" ")} " in *" $2 "*) exit 0 ;; *) exit 1 ;; esac; fi
|
|
313
|
+
exit 0
|
|
314
|
+
`);
|
|
315
|
+
chmodSync(join(bin, "launchctl"), 0o755);
|
|
316
|
+
const prog = `set -u
|
|
317
|
+
log(){ echo "[init] $1"; }; ok(){ echo " ok $1"; }; warn(){ echo " warn $1"; }
|
|
318
|
+
AGENT_DIR="${agent}"
|
|
319
|
+
LAUNCH_AGENTS_DIR="$HOME/Library/LaunchAgents"
|
|
320
|
+
PLIST_DIR="$AGENT_DIR/scripts/local-triggers/plists"
|
|
321
|
+
${extractLaunchdBlock()}`;
|
|
322
|
+
writeFileSync(join(dir, "block.sh"), prog);
|
|
323
|
+
const r = spawnSync("/bin/bash", [join(dir, "block.sh")], { encoding: "utf8", env: { PATH: `${bin}:/usr/bin:/bin`, HOME: home } });
|
|
324
|
+
const calls = existsSync(log) ? readFileSync(log, "utf8") : "";
|
|
325
|
+
const installed = readdirSync(join(home, "Library", "LaunchAgents"));
|
|
326
|
+
rmSync(dir, { recursive: true, force: true });
|
|
327
|
+
return { status: r.status, stdout: r.stdout + r.stderr, calls, installed };
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
test("Step 5: a LOADED session or daemon job is rewritten but never unloaded/loaded on a re-run (WP-M6 'never bootout')", () => {
|
|
331
|
+
const r = runLaunchdBlock({
|
|
332
|
+
plists: ["ai.maestro.ivy-session", "ai.maestro.ivy-daemon", "ai.maestro.ivy-daily-brief"],
|
|
333
|
+
loaded: ["ai.maestro.ivy-session", "ai.maestro.ivy-daemon", "ai.maestro.ivy-daily-brief"],
|
|
334
|
+
});
|
|
335
|
+
assert.equal(r.status, 0, r.stdout);
|
|
336
|
+
assert.ok(!/launchctl (unload|bootout)[^\n]*-session/.test(r.calls), `must not unload the session job; calls:\n${r.calls}`);
|
|
337
|
+
assert.ok(!/launchctl load[^\n]*-session/.test(r.calls), `must not re-load a loaded session job; calls:\n${r.calls}`);
|
|
338
|
+
assert.ok(!/launchctl (unload|bootout|load)[^\n]*-daemon/.test(r.calls), `must not unload/load a loaded daemon; calls:\n${r.calls}`);
|
|
339
|
+
// The trigger job keeps today's unload + load (its script may have changed).
|
|
340
|
+
assert.match(r.calls, /launchctl unload[^\n]*daily-brief/);
|
|
341
|
+
assert.match(r.calls, /launchctl load[^\n]*daily-brief/);
|
|
342
|
+
// Files are still refreshed for all three.
|
|
343
|
+
assert.deepEqual(r.installed.sort(), ["ai.maestro.ivy-daemon.plist", "ai.maestro.ivy-daily-brief.plist", "ai.maestro.ivy-session.plist"]);
|
|
344
|
+
assert.match(r.stdout, /kept running/i);
|
|
345
|
+
});
|
|
346
|
+
|
|
347
|
+
test("Step 5: a NOT-loaded session/daemon job is installed and loaded (first run)", () => {
|
|
348
|
+
const r = runLaunchdBlock({ plists: ["ai.maestro.ivy-session", "ai.maestro.ivy-daemon"], loaded: [] });
|
|
349
|
+
assert.equal(r.status, 0, r.stdout);
|
|
350
|
+
assert.match(r.calls, /launchctl load[^\n]*ai\.maestro\.ivy-session\.plist/);
|
|
351
|
+
assert.match(r.calls, /launchctl load[^\n]*ai\.maestro\.ivy-daemon\.plist/);
|
|
352
|
+
assert.ok(!/launchctl unload/.test(r.calls), "nothing to unload on a first run");
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
test("Step 5: the session plist is skipped when scripts/session/supervisor.sh is absent (launchd would retry every 30 s forever)", () => {
|
|
356
|
+
const r = runLaunchdBlock({ plists: ["ai.maestro.ivy-session", "ai.maestro.ivy-daemon"], loaded: [], supervisor: false });
|
|
357
|
+
assert.equal(r.status, 0, r.stdout);
|
|
358
|
+
assert.ok(!/-session/.test(r.calls), `must not load a session plist with no supervisor; calls:\n${r.calls}`);
|
|
359
|
+
assert.ok(!r.installed.includes("ai.maestro.ivy-session.plist"));
|
|
360
|
+
assert.match(r.stdout, /supervisor\.sh/);
|
|
361
|
+
assert.match(r.calls, /launchctl load[^\n]*-daemon/);
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
test("Step 5: runs the poller-plist migration (audit F6 follow-through) when it ships", () => {
|
|
365
|
+
const r = runLaunchdBlock({ plists: ["ai.maestro.ivy-daemon"], migrate: true });
|
|
366
|
+
assert.equal(r.status, 0, r.stdout);
|
|
367
|
+
assert.match(r.calls, /^migrate/m, `calls:\n${r.calls}`);
|
|
368
|
+
const without = runLaunchdBlock({ plists: ["ai.maestro.ivy-daemon"], migrate: false });
|
|
369
|
+
assert.equal(without.status, 0, "an absent migrate.sh is not an error");
|
|
370
|
+
});
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* scripts/vendor/skill-packs.mjs — the pinned registry of vendored design
|
|
3
|
+
* skill packs, and the pure helpers both the syncer and the CI guard share.
|
|
4
|
+
*
|
|
5
|
+
* WP-M7 vendors four upstream Claude Code design skill packs into
|
|
6
|
+
* `plugins/maestro-skills/vendor/<pack>/` so that every seat gets them from the
|
|
7
|
+
* npm tarball. Two properties matter more than convenience and are enforced by
|
|
8
|
+
* `scripts/ci/check-skill-packs.mjs`:
|
|
9
|
+
*
|
|
10
|
+
* 1. **Pinned and verifiable.** Each pack is a single upstream commit; every
|
|
11
|
+
* vendored byte is recorded in `UPSTREAM.json` as a sha256. The SDK never
|
|
12
|
+
* fetches skill content at install or run time on a seat — vendoring is a
|
|
13
|
+
* reviewed commit, and the guard is what makes "reviewed" mean something.
|
|
14
|
+
* 2. **Markdown, not machinery.** The allow-list below takes skill prose and
|
|
15
|
+
* its reference files. It deliberately leaves behind every executable
|
|
16
|
+
* seam an upstream pack carries: hook manifests, launchers that download a
|
|
17
|
+
* binary on first run, browser-automation bundles and font-index data.
|
|
18
|
+
* Nothing in a vendored tree is ever executed by maestro.
|
|
19
|
+
*
|
|
20
|
+
* The allow-list is expressed as *rules* (one file, or one directory filtered
|
|
21
|
+
* by a regex) rather than a flat path list, because the syncer must be able to
|
|
22
|
+
* re-derive the tree from a fresh upstream checkout AND the guard must be able
|
|
23
|
+
* to decide, with no network, whether a path that exists on disk was allowed.
|
|
24
|
+
* {@link isAllowedDest} is that second half.
|
|
25
|
+
*
|
|
26
|
+
* Pure, dependency-light: Node builtins only, no I/O in this module.
|
|
27
|
+
*
|
|
28
|
+
* @module scripts/vendor/skill-packs
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
"use strict";
|
|
32
|
+
|
|
33
|
+
import { createHash } from "node:crypto";
|
|
34
|
+
|
|
35
|
+
/** @param {string} text */
|
|
36
|
+
function sha256Hex(text) {
|
|
37
|
+
return createHash("sha256").update(text).digest("hex");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @typedef {object} PackRule
|
|
42
|
+
* @property {"file"|"dir"} type
|
|
43
|
+
* @property {string} from path in the upstream tree (POSIX, repo-relative)
|
|
44
|
+
* @property {string} to path in the vendored pack (POSIX, pack-relative); "" = pack root
|
|
45
|
+
* @property {RegExp} [match] for `dir`: which basenames to take
|
|
46
|
+
* @property {boolean} [recursive] for `dir`: descend into subdirectories
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @typedef {object} SkillPack
|
|
51
|
+
* @property {string} id directory under plugins/maestro-skills/vendor/
|
|
52
|
+
* @property {string} repo "<owner>/<name>" on github.com
|
|
53
|
+
* @property {string} sha the pinned commit
|
|
54
|
+
* @property {string} date the pinned commit's date (ISO, informational)
|
|
55
|
+
* @property {string} license SPDX id
|
|
56
|
+
* @property {PackRule[]} rules the allow-list
|
|
57
|
+
* @property {string[]} omitted what upstream carries that we deliberately drop
|
|
58
|
+
* @property {string[]} skillRoots pack-relative dirs that each hold one SKILL.md
|
|
59
|
+
* @property {string[]} [execAllowed] pack-relative dir prefixes where a file may carry an executable bit
|
|
60
|
+
* @property {string} notes
|
|
61
|
+
* @property {string} [contentSha256] {@link manifestDigest} of the vendored file list
|
|
62
|
+
* @property {Acknowledgement[]} [acknowledged] the supply-chain tokens this pack's prose is known to carry
|
|
63
|
+
*/
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* One reviewed supply-chain token. Vendored prose is not code we run, but it IS
|
|
67
|
+
* read as instructions, and "fetch this and run it" is the same capability
|
|
68
|
+
* whether it arrives as `curl | sh`, `npx some-package`, or a CDN script tag in
|
|
69
|
+
* markup the reader is told to emit. The guard extracts a token for each such
|
|
70
|
+
* instruction it finds; a token with no entry here fails the build, which is
|
|
71
|
+
* how a re-sync that pulls in a NEW one stops rather than shipping.
|
|
72
|
+
*
|
|
73
|
+
* `covered` is the literal that must appear in
|
|
74
|
+
* `plugins/maestro-skills/skills/cohort-design.md`. Acknowledging a capability
|
|
75
|
+
* without telling a reader what to do instead is not a review, so the guard
|
|
76
|
+
* checks the prose too.
|
|
77
|
+
*
|
|
78
|
+
* @typedef {object} Acknowledgement
|
|
79
|
+
* @property {string} token
|
|
80
|
+
* @property {string} why
|
|
81
|
+
* @property {string} covered
|
|
82
|
+
*/
|
|
83
|
+
|
|
84
|
+
/** Hosts a vendored file may legitimately point a fetch instruction at. */
|
|
85
|
+
export const FETCH_HOST_ALLOWLIST = Object.freeze([
|
|
86
|
+
"github.com",
|
|
87
|
+
"www.github.com",
|
|
88
|
+
"raw.githubusercontent.com",
|
|
89
|
+
"objects.githubusercontent.com",
|
|
90
|
+
"codeload.github.com",
|
|
91
|
+
"gist.github.com",
|
|
92
|
+
"api.github.com",
|
|
93
|
+
]);
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Basenames that ARE the hook machinery, wherever a pack keeps them. A vendored
|
|
97
|
+
* tree must never contain one: `install-hooks.mjs` writes a Stop hook into a
|
|
98
|
+
* settings file (its `--global` flag writes the one every session on the
|
|
99
|
+
* machine reads), and `stop-hook.mjs` is the body that hook runs. Stripping the
|
|
100
|
+
* executable bit is cosmetic — `node <file>` does not consult it — so the only
|
|
101
|
+
* honest neutralisation is absence.
|
|
102
|
+
*/
|
|
103
|
+
export const HOOK_SCRIPT_BASENAMES = Object.freeze([
|
|
104
|
+
"install-hooks.mjs", "stop-hook.mjs", "install-hook.mjs", "hooks.mjs", "hook.mjs",
|
|
105
|
+
]);
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* The digest of a manifest's file list — sha256 over `"<path> <sha256>"` lines,
|
|
109
|
+
* sorted, newline-terminated.
|
|
110
|
+
*
|
|
111
|
+
* This is what makes the allow-list a ratchet rather than a description. A
|
|
112
|
+
* per-file sha256 recorded in `UPSTREAM.json` proves only that the manifest and
|
|
113
|
+
* the tree agree with each other, so a single commit that adds a file AND its
|
|
114
|
+
* hash — a poisoned re-sync, a hand-edit with cover — is self-consistent and
|
|
115
|
+
* passes. Pinning this digest in THIS module, which nothing in a vendored tree
|
|
116
|
+
* can reach, means such a change must also edit a reviewed source file whose
|
|
117
|
+
* diff says "the vendored bytes changed" in one line.
|
|
118
|
+
*
|
|
119
|
+
* @param {Array<{path:string, sha256:string}>} files
|
|
120
|
+
* @returns {string}
|
|
121
|
+
*/
|
|
122
|
+
export function manifestDigest(files) {
|
|
123
|
+
const lines = (files || [])
|
|
124
|
+
.map((f) => `${posix(f && f.path)} ${String((f && f.sha256) || "")}`)
|
|
125
|
+
.sort();
|
|
126
|
+
return sha256Hex(`${lines.join("\n")}\n`);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Every pack, in install order. @type {SkillPack[]} */
|
|
130
|
+
export const PACKS = Object.freeze([
|
|
131
|
+
{
|
|
132
|
+
id: "impeccable",
|
|
133
|
+
contentSha256: "0185da328c829c1d2265e3c61c608afc415103e07912a1e09cf05c6825c272f5",
|
|
134
|
+
repo: "pbakaus/impeccable",
|
|
135
|
+
sha: "cd12f8660e2dde57b9615c8a6b8ea674101f9cfc",
|
|
136
|
+
date: "2026-09-09",
|
|
137
|
+
license: "Apache-2.0",
|
|
138
|
+
skillRoots: ["."],
|
|
139
|
+
rules: [
|
|
140
|
+
{ type: "file", from: ".claude/skills/impeccable/SKILL.md", to: "SKILL.md" },
|
|
141
|
+
{ type: "dir", from: ".claude/skills/impeccable/reference", to: "reference", match: /\.md$/, recursive: true },
|
|
142
|
+
{ type: "dir", from: ".claude/agents", to: "agents", match: /^impeccable-[a-z0-9-]+\.md$/, recursive: false },
|
|
143
|
+
{ type: "file", from: "LICENSE", to: "LICENSE" },
|
|
144
|
+
{ type: "file", from: "NOTICE.md", to: "NOTICE.md" },
|
|
145
|
+
],
|
|
146
|
+
omitted: [
|
|
147
|
+
"hooks (plugin/hooks/hooks.json, .claude/settings.json) — maestro installs no hook from a vendored pack",
|
|
148
|
+
"skill scripts/ — the `impeccable` launcher downloads and runs a self-contained binary on first use; never run it on a seat",
|
|
149
|
+
"scripts/data/ (font-index.json, font-index-failures.json) — data for that launcher, ~20 MB",
|
|
150
|
+
"live-browser*.js, modern-screenshot.umd.js — live browser-automation mode, out of scope on a seat",
|
|
151
|
+
".claude-plugin/ and the other per-agent manifest trees (.cursor/, .gemini/, plugin/, …)",
|
|
152
|
+
"crates/, cli/, extension/, browser-bundle/, tests/, docs/ — the engine repo around the skill",
|
|
153
|
+
],
|
|
154
|
+
acknowledged: [
|
|
155
|
+
{
|
|
156
|
+
token: "npx:impeccable",
|
|
157
|
+
why: "reference/doctor.md and reference/hooks.md offer `npx impeccable update|detect|ignores` as the recovery path when the launcher is missing — which on a seat it always is, because scripts/ is not vendored. That is a registry fetch-and-execute and is exactly what vendoring exists to avoid.",
|
|
158
|
+
covered: "npx impeccable",
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
token: "hook-install-doc",
|
|
162
|
+
why: "reference/hooks.md is a full guide to writing the impeccable hook into .claude/settings.local.json, .codex/hooks.json, .cursor/hooks.json and .github/hooks/impeccable.json. The file is prose, not a manifest, so the no-manifest rule cannot see it.",
|
|
163
|
+
covered: "no hook from any of these packs is installed, and none should be",
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
notes: "Skill 4.3.1, Apache-2.0. Markdown only: SKILL.md, reference/**.md and the four impeccable-* subordinate briefs. The SKILL text still describes its launcher; the cohort-design harmoniser overrides that — never run it, and never use live mode on a seat.",
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
id: "emilkowalski",
|
|
170
|
+
contentSha256: "2c8397c22777f6cd71f7ea91e729799ef4128932a39be0f6f8068c8c1dbb5b92",
|
|
171
|
+
repo: "emilkowalski/skills",
|
|
172
|
+
sha: "d23d7f88a2e21c9e4b1418c7abe420f5c1052ba7",
|
|
173
|
+
date: "2026-08-21",
|
|
174
|
+
license: "MIT",
|
|
175
|
+
skillRoots: [
|
|
176
|
+
"skills/emil-design-eng",
|
|
177
|
+
"skills/animate",
|
|
178
|
+
"skills/animation-vocabulary",
|
|
179
|
+
"skills/apple-design",
|
|
180
|
+
"skills/find-animation-opportunities",
|
|
181
|
+
"skills/improve-animations",
|
|
182
|
+
"skills/review-animations",
|
|
183
|
+
"skills/prototype",
|
|
184
|
+
],
|
|
185
|
+
rules: [
|
|
186
|
+
{ type: "dir", from: "skills/emil-design-eng", to: "skills/emil-design-eng", match: /\.md$/, recursive: false },
|
|
187
|
+
{ type: "dir", from: "skills/animate", to: "skills/animate", match: /\.md$/, recursive: false },
|
|
188
|
+
{ type: "dir", from: "skills/animation-vocabulary", to: "skills/animation-vocabulary", match: /\.md$/, recursive: false },
|
|
189
|
+
{ type: "dir", from: "skills/apple-design", to: "skills/apple-design", match: /\.md$/, recursive: false },
|
|
190
|
+
{ type: "dir", from: "skills/find-animation-opportunities", to: "skills/find-animation-opportunities", match: /\.md$/, recursive: false },
|
|
191
|
+
{ type: "dir", from: "skills/improve-animations", to: "skills/improve-animations", match: /\.md$/, recursive: false },
|
|
192
|
+
{ type: "dir", from: "skills/review-animations", to: "skills/review-animations", match: /\.md$/, recursive: false },
|
|
193
|
+
{ type: "dir", from: "skills/prototype", to: "skills/prototype", match: /\.md$/, recursive: false },
|
|
194
|
+
{ type: "file", from: "LICENSE", to: "LICENSE" },
|
|
195
|
+
],
|
|
196
|
+
omitted: [
|
|
197
|
+
"skills/pick-ui-library — library choice is Cohort's, settled in the product repo",
|
|
198
|
+
"skills/ask-sonner — a single third-party toast library's API",
|
|
199
|
+
"skills/write-swift, skills/animate-expo — native platforms this fleet does not ship",
|
|
200
|
+
],
|
|
201
|
+
acknowledged: [],
|
|
202
|
+
notes: "MIT. Motion and design-engineering craft. Precedence sits below Cohort's DESIGN.md for tokens and type; these govern easing, duration and restraint.",
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
id: "taste-skill",
|
|
206
|
+
contentSha256: "e63fea105e36e4418bf625cb091bc10a316b35f588ad146a38fce15f4a749c5e",
|
|
207
|
+
repo: "Leonxlnx/taste-skill",
|
|
208
|
+
sha: "ccbc15639c97057cbfcf32ecebc38ef716e4bb37",
|
|
209
|
+
date: "2026-08-24",
|
|
210
|
+
license: "MIT",
|
|
211
|
+
skillRoots: [
|
|
212
|
+
"skills/taste-skill",
|
|
213
|
+
"skills/redesign-skill",
|
|
214
|
+
"skills/soft-skill",
|
|
215
|
+
"skills/minimalist-skill",
|
|
216
|
+
],
|
|
217
|
+
rules: [
|
|
218
|
+
{ type: "dir", from: "skills/taste-skill", to: "skills/taste-skill", match: /\.md$/, recursive: false },
|
|
219
|
+
{ type: "dir", from: "skills/redesign-skill", to: "skills/redesign-skill", match: /\.md$/, recursive: false },
|
|
220
|
+
{ type: "dir", from: "skills/soft-skill", to: "skills/soft-skill", match: /\.md$/, recursive: false },
|
|
221
|
+
{ type: "dir", from: "skills/minimalist-skill", to: "skills/minimalist-skill", match: /\.md$/, recursive: false },
|
|
222
|
+
{ type: "file", from: "LICENSE", to: "LICENSE" },
|
|
223
|
+
],
|
|
224
|
+
omitted: [
|
|
225
|
+
"skills/imagegen-frontend-web, skills/imagegen-frontend-mobile — image generation belongs to cohort-mcp design_generate_image",
|
|
226
|
+
"skills/brandkit — brand tokens are DESIGN.md's, never a skill's",
|
|
227
|
+
"skills/gpt-tasteskill, skills/stitch-skill — other vendors' model/tooling wrappers",
|
|
228
|
+
"skills/taste-skill-v1 — superseded by skills/taste-skill",
|
|
229
|
+
"skills/brutalist-skill, skills/output-skill, skills/image-to-code-skill — styles and behaviours outside the four the design ruling admitted",
|
|
230
|
+
"assets/, examples/, research/, scripts/, skill.sh, .claude-plugin/",
|
|
231
|
+
],
|
|
232
|
+
acknowledged: [
|
|
233
|
+
{
|
|
234
|
+
token: "npx:shadcn@latest",
|
|
235
|
+
why: "skills/taste-skill/SKILL.md tells the reader to run `npx shadcn@latest init|add` to pull components. Registry fetch-and-execute; Cohort's component grammar comes from DESIGN.md.",
|
|
236
|
+
covered: "npx shadcn",
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
token: "pkg-install",
|
|
240
|
+
why: "skills/taste-skill/SKILL.md carries ~10 `npm install` lines for design-system packages (@material/web, @fluentui/*, @carbon/*, @radix-ui/themes, @primer/*, govuk-frontend, uswds, bootstrap). Adding a dependency is a decision the product repo makes, not a skill.",
|
|
241
|
+
covered: "Adding a dependency is the product repo's decision",
|
|
242
|
+
},
|
|
243
|
+
{
|
|
244
|
+
token: "remote-asset:cdn.shopify.com",
|
|
245
|
+
why: "skills/taste-skill/SKILL.md shows a <script src=\"https://cdn.shopify.com/shopifycloud/polaris.js\"> tag as sample markup. A third-party CDN script in shipped output is a supply-chain edge, not a design choice.",
|
|
246
|
+
covered: "never a remote script tag",
|
|
247
|
+
},
|
|
248
|
+
{
|
|
249
|
+
token: "template-url:picsum.photos",
|
|
250
|
+
why: "skills/taste-skill, skills/redesign-skill and skills/minimalist-skill all instruct hotlinking https://picsum.photos/seed/{...} placeholder photography into generated markup.",
|
|
251
|
+
covered: "picsum.photos",
|
|
252
|
+
},
|
|
253
|
+
{
|
|
254
|
+
token: "template-url:cdn.simpleicons.org",
|
|
255
|
+
why: "skills/taste-skill/SKILL.md instructs hotlinking https://cdn.simpleicons.org/{slug}/ffffff for brand icons. The asset kit is design_export_kit's.",
|
|
256
|
+
covered: "cdn.simpleicons.org",
|
|
257
|
+
},
|
|
258
|
+
],
|
|
259
|
+
notes: "MIT. Marketing and site pages ONLY — these skills self-declare out of scope for dashboards, data tables, forms and product UI. Directory names differ from the frontmatter names: taste-skill=design-taste-frontend, redesign-skill=redesign-existing-projects, soft-skill=high-end-visual-design, minimalist-skill=minimalist-ui. Their em-dash ban does NOT apply to Cohort copy.",
|
|
260
|
+
},
|
|
261
|
+
{
|
|
262
|
+
id: "unlazy",
|
|
263
|
+
contentSha256: "07829533954d1c1aebc318fb8748adb262b4b25c56b9bea76ec1b5bb1b3ddd05",
|
|
264
|
+
repo: "Leonxlnx/unlazy",
|
|
265
|
+
sha: "16671491f6679ad9378f52604d3bc2415b4120c7",
|
|
266
|
+
date: "2026-09-03",
|
|
267
|
+
license: "MIT",
|
|
268
|
+
skillRoots: ["."],
|
|
269
|
+
execAllowed: ["scripts/"],
|
|
270
|
+
rules: [
|
|
271
|
+
{ type: "file", from: "SKILL.md", to: "SKILL.md" },
|
|
272
|
+
{ type: "file", from: "SECURITY.md", to: "SECURITY.md" },
|
|
273
|
+
{ type: "file", from: "LICENSE", to: "LICENSE" },
|
|
274
|
+
{ type: "dir", from: "references", to: "references", match: /\.md$/, recursive: false },
|
|
275
|
+
{ type: "dir", from: "templates", to: "templates", match: /\.md$/, recursive: false },
|
|
276
|
+
// The gate checker and its library, and NOT the hook machinery: see
|
|
277
|
+
// HOOK_SCRIPT_BASENAMES below for why those two names are excluded here
|
|
278
|
+
// rather than merely discouraged in prose.
|
|
279
|
+
{ type: "dir", from: "scripts", to: "scripts", match: /^(?!install-hooks\.mjs$|stop-hook\.mjs$)[\w.-]+\.mjs$/, recursive: true },
|
|
280
|
+
],
|
|
281
|
+
omitted: [
|
|
282
|
+
"scripts/install-hooks.mjs and scripts/stop-hook.mjs — the Stop hook MACHINERY is not vendored at all, so it never reaches a seat; `node install-hooks.mjs --global` would have written a Stop hook into ~/.claude/settings.json for every session on the machine, and stripping an executable bit does not stop `node` from running a file",
|
|
283
|
+
"README.md, CHANGELOG.md, CONTRIBUTING.md, package.json, agents/openai.yaml",
|
|
284
|
+
"research/, tests/, .github/",
|
|
285
|
+
],
|
|
286
|
+
acknowledged: [
|
|
287
|
+
{
|
|
288
|
+
token: "hook-install-doc",
|
|
289
|
+
why: "SKILL.md and SECURITY.md still describe unlazy's Stop hook and the settings files it would be written into. The two scripts that install and implement it are NOT vendored (see omitted[]), so the instruction has nothing to run — but the prose reaches the seat, and a reader who reconstructs the hook by hand gets the same fleet-wide blast radius.",
|
|
290
|
+
covered: "Never install unlazy's Stop hook",
|
|
291
|
+
},
|
|
292
|
+
],
|
|
293
|
+
notes: "MIT. Completion gates for substantial work. scripts/ is vendored so the gate checker can be read and run deliberately by a person who chose to; nothing here is wired into a hook. The two files that INSTALL and IMPLEMENT unlazy's Stop hook (scripts/install-hooks.mjs, scripts/stop-hook.mjs) are deliberately absent from the vendored tree: a prohibition in prose does not survive a reader who takes SKILL.md's own install line at face value, so the machinery is simply not on the seat. SKILL.md still describes it; the cohort-design harmoniser forbids reconstructing it.",
|
|
294
|
+
},
|
|
295
|
+
]);
|
|
296
|
+
|
|
297
|
+
/** @param {string} id @returns {SkillPack|null} */
|
|
298
|
+
export function findPack(id) {
|
|
299
|
+
return PACKS.find((p) => p.id === id) || null;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/** Normalise a path to POSIX separators with no leading "./". @param {string} p */
|
|
303
|
+
export function posix(p) {
|
|
304
|
+
return String(p == null ? "" : p).split("\\").join("/").replace(/^\.\//, "");
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Is `dest` (pack-relative) a path this pack's allow-list admits? This is the
|
|
309
|
+
* half the CI guard needs: it answers with no upstream tree in hand, so a file
|
|
310
|
+
* someone dropped into a vendored directory by mistake — or on purpose — fails
|
|
311
|
+
* the build even though its sha256 would happily be recomputed.
|
|
312
|
+
*
|
|
313
|
+
* `UPSTREAM.json` is always allowed: it IS the manifest.
|
|
314
|
+
*
|
|
315
|
+
* @param {SkillPack} pack
|
|
316
|
+
* @param {string} dest
|
|
317
|
+
* @returns {boolean}
|
|
318
|
+
*/
|
|
319
|
+
export function isAllowedDest(pack, dest) {
|
|
320
|
+
const d = posix(dest);
|
|
321
|
+
if (!d || d.startsWith("../") || d.includes("/../")) return false;
|
|
322
|
+
if (d === "UPSTREAM.json") return true;
|
|
323
|
+
for (const rule of (pack && pack.rules) || []) {
|
|
324
|
+
if (rule.type === "file") {
|
|
325
|
+
if (d === posix(rule.to)) return true;
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
const prefix = posix(rule.to);
|
|
329
|
+
const base = prefix ? `${prefix}/` : "";
|
|
330
|
+
if (!d.startsWith(base)) continue;
|
|
331
|
+
const rest = d.slice(base.length);
|
|
332
|
+
if (!rest) continue;
|
|
333
|
+
if (!rule.recursive && rest.includes("/")) continue;
|
|
334
|
+
const name = rest.slice(rest.lastIndexOf("/") + 1);
|
|
335
|
+
if (rule.match && !rule.match.test(name)) continue;
|
|
336
|
+
return true;
|
|
337
|
+
}
|
|
338
|
+
return false;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
/**
|
|
342
|
+
* May `dest` carry an executable bit? Only where a pack declares it (unlazy's
|
|
343
|
+
* `scripts/`, whose upstream files are 0644 today but need not stay that way).
|
|
344
|
+
* @param {SkillPack} pack @param {string} dest
|
|
345
|
+
*/
|
|
346
|
+
export function isExecAllowed(pack, dest) {
|
|
347
|
+
const d = posix(dest);
|
|
348
|
+
return ((pack && pack.execAllowed) || []).some((p) => d.startsWith(posix(p)));
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export default {
|
|
352
|
+
PACKS, findPack, isAllowedDest, isExecAllowed, posix,
|
|
353
|
+
FETCH_HOST_ALLOWLIST, HOOK_SCRIPT_BASENAMES, manifestDigest,
|
|
354
|
+
};
|