harnessed 4.12.0 → 4.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -11
- package/dist/cli.mjs +532 -196
- package/dist/cli.mjs.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/schemas/index.mjs +16 -1
- package/dist/schemas/index.mjs.map +1 -1
- package/manifests/SCHEMA.md +2 -0
- package/manifests/skill-packs/design-taste-frontend.yaml +6 -2
- package/manifests/skill-packs/gsd.yaml +12 -0
- package/manifests/skill-packs/karpathy-skills.yaml +13 -0
- package/manifests/skill-packs/mattpocock-skills.yaml +10 -3
- package/manifests/skill-packs/planning-with-files.yaml +12 -0
- package/manifests/skill-packs/ui-ux-pro-max.yaml +12 -0
- package/manifests/tools/playwright-test.yaml +6 -3
- package/manifests/tools/superpowers.yaml +13 -0
- package/messages/en.json +1 -0
- package/messages/zh-Hans.json +1 -0
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -38,7 +38,7 @@ var init_package = __esm({
|
|
|
38
38
|
"package.json"() {
|
|
39
39
|
package_default = {
|
|
40
40
|
name: "harnessed",
|
|
41
|
-
version: "4.
|
|
41
|
+
version: "4.14.0",
|
|
42
42
|
description: "AI coding harness package manager + composition orchestrator",
|
|
43
43
|
type: "module",
|
|
44
44
|
license: "Apache-2.0",
|
|
@@ -220,7 +220,8 @@ function getMcpConfigPath(home) {
|
|
|
220
220
|
return detectPlatform(home).mcpConfigPath;
|
|
221
221
|
}
|
|
222
222
|
function harnessSkillsDirs(home) {
|
|
223
|
-
const
|
|
223
|
+
const codex = codexDescriptor(home);
|
|
224
|
+
const dirs = [claudeDescriptor(home).skillsDir, codex.skillsDir, join(codex.homeDir, "skills")];
|
|
224
225
|
return [...new Set(dirs)];
|
|
225
226
|
}
|
|
226
227
|
var init_platform = __esm({
|
|
@@ -569,9 +570,9 @@ async function writeStoreRaw(store) {
|
|
|
569
570
|
const errs = [...Value.Errors(WorkflowStoreV1, store)].map((e) => e.message).join("; ");
|
|
570
571
|
throw new Error(`workflow-store schema validation failed: ${errs}`);
|
|
571
572
|
}
|
|
572
|
-
const
|
|
573
|
-
await mkdir(dirname(
|
|
574
|
-
await writeFileAtomic(
|
|
573
|
+
const p6 = storePath();
|
|
574
|
+
await mkdir(dirname(p6), { recursive: true });
|
|
575
|
+
await writeFileAtomic(p6, JSON.stringify(store, null, 2));
|
|
575
576
|
}
|
|
576
577
|
async function listWorkflows() {
|
|
577
578
|
const store = await readStoreRaw();
|
|
@@ -785,9 +786,9 @@ function scanPhases(repoRoot, includeTasks) {
|
|
|
785
786
|
function scanTasks(dirPath) {
|
|
786
787
|
for (const fname of ["task_plan.md", "progress.md"]) {
|
|
787
788
|
try {
|
|
788
|
-
const
|
|
789
|
-
if (!existsSync(
|
|
790
|
-
const m = /^[ \t]*- \[ \]\s+(.+)$/m.exec(readFileSync(
|
|
789
|
+
const p6 = join(dirPath, fname);
|
|
790
|
+
if (!existsSync(p6)) continue;
|
|
791
|
+
const m = /^[ \t]*- \[ \]\s+(.+)$/m.exec(readFileSync(p6, "utf8"));
|
|
791
792
|
const task = m?.[1];
|
|
792
793
|
if (task) return { nextUnchecked: task.trim() };
|
|
793
794
|
} catch {
|
|
@@ -866,7 +867,7 @@ function deriveNext(snapshot) {
|
|
|
866
867
|
reason: `sub '${failed.sub}' failed ${failed.fail_count}x \u2014 resolve before advancing`
|
|
867
868
|
};
|
|
868
869
|
}
|
|
869
|
-
const firstIncomplete = snapshot.phases.find((
|
|
870
|
+
const firstIncomplete = snapshot.phases.find((p6) => !p6.complete);
|
|
870
871
|
if (firstIncomplete) {
|
|
871
872
|
const task = firstIncomplete.tasks?.nextUnchecked;
|
|
872
873
|
if (task) return { kind: "task", phase: firstIncomplete.phase, task };
|
|
@@ -902,7 +903,7 @@ function describeUnit(unit) {
|
|
|
902
903
|
}
|
|
903
904
|
}
|
|
904
905
|
function remainingPhases(snapshot) {
|
|
905
|
-
return snapshot.phases.filter((
|
|
906
|
+
return snapshot.phases.filter((p6) => !p6.complete).length;
|
|
906
907
|
}
|
|
907
908
|
function pluralPhases(n) {
|
|
908
909
|
return `${n} phase${n === 1 ? "" : "s"} remain`;
|
|
@@ -1285,7 +1286,7 @@ var init_installMethods = __esm({
|
|
|
1285
1286
|
Type.Union([...branches]);
|
|
1286
1287
|
}
|
|
1287
1288
|
});
|
|
1288
|
-
var TypeEnum, ComponentType, Verify, Uninstall, Stability, FallbackAction, UpstreamHealth, Platform, Signature, TestedWithVersions, Category, InstallType, DecisionRules, Phase, Triggers, ProvidedUnit, SpecSchema;
|
|
1289
|
+
var TypeEnum, ComponentType, Verify, Uninstall, Stability, FallbackAction, UpstreamHealth, Platform, Signature, TestedWithVersions, Category, InstallType, DecisionRules, Phase, Triggers, ProvidedUnit, HarnessOverride, HarnessOverrides, SpecSchema;
|
|
1289
1290
|
var init_spec = __esm({
|
|
1290
1291
|
"src/manifest/schema/spec.ts"() {
|
|
1291
1292
|
init_installMethods();
|
|
@@ -1416,6 +1417,19 @@ var init_spec = __esm({
|
|
|
1416
1417
|
},
|
|
1417
1418
|
{ additionalProperties: false }
|
|
1418
1419
|
);
|
|
1420
|
+
HarnessOverride = Type.Object(
|
|
1421
|
+
{
|
|
1422
|
+
install: Type.Unsafe(InstallSchema),
|
|
1423
|
+
verify: Type.Optional(Verify)
|
|
1424
|
+
},
|
|
1425
|
+
{ additionalProperties: false }
|
|
1426
|
+
);
|
|
1427
|
+
HarnessOverrides = Type.Object(
|
|
1428
|
+
{
|
|
1429
|
+
codex: Type.Optional(HarnessOverride)
|
|
1430
|
+
},
|
|
1431
|
+
{ additionalProperties: false }
|
|
1432
|
+
);
|
|
1419
1433
|
SpecSchema = Type.Object(
|
|
1420
1434
|
{
|
|
1421
1435
|
type: TypeEnum,
|
|
@@ -1436,7 +1450,9 @@ var init_spec = __esm({
|
|
|
1436
1450
|
phase: Type.Optional(Phase),
|
|
1437
1451
|
triggers: Type.Optional(Triggers),
|
|
1438
1452
|
// ADR 0010 errata (phase 2.1 T1.3) — bundle-install `provides` field.
|
|
1439
|
-
provides: Type.Optional(Type.Array(ProvidedUnit, { minItems: 2, uniqueItems: true }))
|
|
1453
|
+
provides: Type.Optional(Type.Array(ProvidedUnit, { minItems: 2, uniqueItems: true })),
|
|
1454
|
+
// v4.14.0 — per-harness install/verify overrides (codex only for now).
|
|
1455
|
+
harness_overrides: Type.Optional(HarnessOverrides)
|
|
1440
1456
|
},
|
|
1441
1457
|
{ additionalProperties: false }
|
|
1442
1458
|
);
|
|
@@ -1539,8 +1555,8 @@ function checkSecurityViolations(doc, filename, lineCounter) {
|
|
|
1539
1555
|
["spec", "verify", "cmd"],
|
|
1540
1556
|
["spec", "uninstall", "cmd"]
|
|
1541
1557
|
];
|
|
1542
|
-
for (const
|
|
1543
|
-
const err2 = checkScalarCmd(doc, lineCounter,
|
|
1558
|
+
for (const p6 of cmdPaths) {
|
|
1559
|
+
const err2 = checkScalarCmd(doc, lineCounter, p6, filename);
|
|
1544
1560
|
if (err2) errors.push(err2);
|
|
1545
1561
|
}
|
|
1546
1562
|
const cleanupNode = doc.getIn(["spec", "uninstall", "cleanup_paths"], true);
|
|
@@ -2486,7 +2502,7 @@ function nameToYamlHintPath(name) {
|
|
|
2486
2502
|
function shouldOverwriteFile(content) {
|
|
2487
2503
|
return HARNESSED_MARKER_RX.test(content) || V3_4_3_SIGNATURE_SUB_RX.test(content) || V3_4_3_SIGNATURE_MASTER_RX.test(content);
|
|
2488
2504
|
}
|
|
2489
|
-
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync14 = (
|
|
2505
|
+
async function writeAllCommands(slashNames, commandsDir, rolePrompts, capabilities, installedPlugins, installedUserSkills, writer, fileExists2 = existsSync, readFileSync14 = (p6) => readFileSync(p6, "utf8")) {
|
|
2490
2506
|
const results = [];
|
|
2491
2507
|
const aggregatedWarnings = /* @__PURE__ */ new Set();
|
|
2492
2508
|
for (const name of slashNames) {
|
|
@@ -3443,10 +3459,10 @@ ${rp.checklist.map((c, i) => ` ${i + 1}. ${c}`).join("\n")}` : "";
|
|
|
3443
3459
|
}
|
|
3444
3460
|
function isRalphLoopOptIn(phase) {
|
|
3445
3461
|
if (!phase || typeof phase !== "object") return false;
|
|
3446
|
-
const
|
|
3447
|
-
if (
|
|
3448
|
-
if (
|
|
3449
|
-
const fb =
|
|
3462
|
+
const p6 = phase;
|
|
3463
|
+
if (p6.max_iterations !== void 0 && p6.max_iterations !== null) return true;
|
|
3464
|
+
if (p6.upstream === "ralph-loop") return true;
|
|
3465
|
+
const fb = p6.fallback;
|
|
3450
3466
|
if (fb?.max_iterations_exceeded !== void 0) return true;
|
|
3451
3467
|
return false;
|
|
3452
3468
|
}
|
|
@@ -3955,19 +3971,19 @@ async function listWorkflowNames(workflowsDir) {
|
|
|
3955
3971
|
const names = [];
|
|
3956
3972
|
const entries = await readdir(workflowsDir);
|
|
3957
3973
|
for (const e of entries.sort()) {
|
|
3958
|
-
const
|
|
3959
|
-
const s = await stat(
|
|
3974
|
+
const p6 = join(workflowsDir, e);
|
|
3975
|
+
const s = await stat(p6).catch(() => null);
|
|
3960
3976
|
if (!s?.isDirectory()) continue;
|
|
3961
|
-
if (await fileExists(join(
|
|
3977
|
+
if (await fileExists(join(p6, "workflow.yaml"))) {
|
|
3962
3978
|
names.push(e);
|
|
3963
3979
|
continue;
|
|
3964
3980
|
}
|
|
3965
|
-
if (await fileExists(join(
|
|
3981
|
+
if (await fileExists(join(p6, "auto", "workflow.yaml"))) {
|
|
3966
3982
|
names.push(e);
|
|
3967
|
-
const subs = await readdir(
|
|
3983
|
+
const subs = await readdir(p6).catch(() => []);
|
|
3968
3984
|
for (const sub of subs.sort()) {
|
|
3969
3985
|
if (sub === "auto") continue;
|
|
3970
|
-
if (await fileExists(join(
|
|
3986
|
+
if (await fileExists(join(p6, sub, "workflow.yaml"))) {
|
|
3971
3987
|
names.push(`${e}-${sub}`);
|
|
3972
3988
|
}
|
|
3973
3989
|
}
|
|
@@ -4184,10 +4200,10 @@ function learningsPath(repoRoot) {
|
|
|
4184
4200
|
return join(repoRoot, ".planning", "LEARNINGS.md");
|
|
4185
4201
|
}
|
|
4186
4202
|
async function appendLearning(repoRoot, entry) {
|
|
4187
|
-
const
|
|
4188
|
-
await mkdir(dirname(
|
|
4189
|
-
if (!existsSync(
|
|
4190
|
-
await appendFile(
|
|
4203
|
+
const p6 = learningsPath(repoRoot);
|
|
4204
|
+
await mkdir(dirname(p6), { recursive: true });
|
|
4205
|
+
if (!existsSync(p6)) await writeFile(p6, HEADER, "utf8");
|
|
4206
|
+
await appendFile(p6, entry, "utf8");
|
|
4191
4207
|
}
|
|
4192
4208
|
async function captureWorkflowLearnings(ledger, phase) {
|
|
4193
4209
|
const signals = extractLearnings(ledger);
|
|
@@ -4404,6 +4420,13 @@ function checkNodeVersion() {
|
|
|
4404
4420
|
};
|
|
4405
4421
|
}
|
|
4406
4422
|
async function checkMcpScope() {
|
|
4423
|
+
if (detectPlatform().id !== "claude") {
|
|
4424
|
+
return {
|
|
4425
|
+
name: "mcp scope = project",
|
|
4426
|
+
status: "pass",
|
|
4427
|
+
message: "skipped (claude-only check)"
|
|
4428
|
+
};
|
|
4429
|
+
}
|
|
4407
4430
|
const projectMcp = join(process.cwd(), ".mcp.json");
|
|
4408
4431
|
const userClaude = join(homedir(), ".claude.json");
|
|
4409
4432
|
let projectExists = false;
|
|
@@ -4474,6 +4497,7 @@ function checkWinBash() {
|
|
|
4474
4497
|
}
|
|
4475
4498
|
var init_check_builtin = __esm({
|
|
4476
4499
|
"src/cli/lib/check-builtin.ts"() {
|
|
4500
|
+
init_platform();
|
|
4477
4501
|
}
|
|
4478
4502
|
});
|
|
4479
4503
|
|
|
@@ -4634,7 +4658,7 @@ function scanSkillsDir(root) {
|
|
|
4634
4658
|
});
|
|
4635
4659
|
}
|
|
4636
4660
|
function checkTokenBudget() {
|
|
4637
|
-
const roots = [
|
|
4661
|
+
const roots = [getSkillsDir(), join(process.cwd(), "skills")];
|
|
4638
4662
|
const items = roots.flatMap(scanSkillsDir);
|
|
4639
4663
|
const total = items.reduce((s, i) => s + i.tokens, 0);
|
|
4640
4664
|
const over = items.filter((i) => i.tokens > PER_SKILL_THRESHOLD).length;
|
|
@@ -4656,6 +4680,7 @@ var CONTEXT_WINDOW_TOKENS, TOTAL_THRESHOLD, PER_SKILL_THRESHOLD;
|
|
|
4656
4680
|
var init_check_token_budget = __esm({
|
|
4657
4681
|
"src/cli/lib/check-token-budget.ts"() {
|
|
4658
4682
|
init_template();
|
|
4683
|
+
init_platform();
|
|
4659
4684
|
CONTEXT_WINDOW_TOKENS = 2e5;
|
|
4660
4685
|
TOTAL_THRESHOLD = 2e3;
|
|
4661
4686
|
PER_SKILL_THRESHOLD = 5e3;
|
|
@@ -4667,7 +4692,7 @@ async function checkAgentTeams() {
|
|
|
4667
4692
|
let settingsValue;
|
|
4668
4693
|
let settingsOn = false;
|
|
4669
4694
|
try {
|
|
4670
|
-
const path =
|
|
4695
|
+
const path = getSettingsPath();
|
|
4671
4696
|
const raw = await readFile(path, "utf8");
|
|
4672
4697
|
const data = JSON.parse(raw);
|
|
4673
4698
|
settingsValue = data.env?.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
|
|
@@ -4688,6 +4713,7 @@ async function checkAgentTeams() {
|
|
|
4688
4713
|
}
|
|
4689
4714
|
var init_checkAgentTeams = __esm({
|
|
4690
4715
|
"src/cli/lib/checkAgentTeams.ts"() {
|
|
4716
|
+
init_platform();
|
|
4691
4717
|
}
|
|
4692
4718
|
});
|
|
4693
4719
|
|
|
@@ -4697,6 +4723,13 @@ __export(check_agent_teams_doctor_exports, {
|
|
|
4697
4723
|
checkAgentTeamsDoctor: () => checkAgentTeamsDoctor
|
|
4698
4724
|
});
|
|
4699
4725
|
async function checkAgentTeamsDoctor() {
|
|
4726
|
+
if (detectPlatform().id !== "claude") {
|
|
4727
|
+
return {
|
|
4728
|
+
name: "Agent Teams env",
|
|
4729
|
+
status: "pass",
|
|
4730
|
+
message: "skipped (claude-only check)"
|
|
4731
|
+
};
|
|
4732
|
+
}
|
|
4700
4733
|
const r = await checkAgentTeams();
|
|
4701
4734
|
if (r.status === "pass") {
|
|
4702
4735
|
const source = r.detected.env ? "env var" : "settings.json";
|
|
@@ -4715,6 +4748,7 @@ async function checkAgentTeamsDoctor() {
|
|
|
4715
4748
|
}
|
|
4716
4749
|
var init_check_agent_teams_doctor = __esm({
|
|
4717
4750
|
"src/cli/lib/check-agent-teams-doctor.ts"() {
|
|
4751
|
+
init_platform();
|
|
4718
4752
|
init_checkAgentTeams();
|
|
4719
4753
|
}
|
|
4720
4754
|
});
|
|
@@ -4725,6 +4759,13 @@ __export(check_planning_with_files_exports, {
|
|
|
4725
4759
|
checkPlanningWithFiles: () => checkPlanningWithFiles
|
|
4726
4760
|
});
|
|
4727
4761
|
async function checkPlanningWithFiles() {
|
|
4762
|
+
if (getPluginsRegistry() === null) {
|
|
4763
|
+
return {
|
|
4764
|
+
name: "planning-with-files plugin",
|
|
4765
|
+
status: "pass",
|
|
4766
|
+
message: "skipped (claude-only plugin-cache probe; no plugin registry on this platform)"
|
|
4767
|
+
};
|
|
4768
|
+
}
|
|
4728
4769
|
const root = join(
|
|
4729
4770
|
homedir(),
|
|
4730
4771
|
".claude",
|
|
@@ -4763,6 +4804,7 @@ async function checkPlanningWithFiles() {
|
|
|
4763
4804
|
var REMEDIATION, INSTALL_COMMANDS;
|
|
4764
4805
|
var init_check_planning_with_files = __esm({
|
|
4765
4806
|
"src/cli/lib/check-planning-with-files.ts"() {
|
|
4807
|
+
init_platform();
|
|
4766
4808
|
REMEDIATION = "install via `claude plugin marketplace add OthmanAdi/planning-with-files && claude plugin install planning-with-files` (requires >=2.2.0 per R20.15 + D-15)";
|
|
4767
4809
|
INSTALL_COMMANDS = [
|
|
4768
4810
|
"claude plugin marketplace add OthmanAdi/planning-with-files",
|
|
@@ -4776,6 +4818,10 @@ var check_mattpocock_skills_exports = {};
|
|
|
4776
4818
|
__export(check_mattpocock_skills_exports, {
|
|
4777
4819
|
checkMattpocockSkills: () => checkMattpocockSkills
|
|
4778
4820
|
});
|
|
4821
|
+
function installCommands() {
|
|
4822
|
+
const agent = detectPlatform().id === "codex" ? "codex" : "claude-code";
|
|
4823
|
+
return [`npx skills@latest add mattpocock/skills --copy -y --agent ${agent}`];
|
|
4824
|
+
}
|
|
4779
4825
|
async function checkMattpocockSkills() {
|
|
4780
4826
|
const pluginRoot = join(
|
|
4781
4827
|
homedir(),
|
|
@@ -4785,54 +4831,59 @@ async function checkMattpocockSkills() {
|
|
|
4785
4831
|
"mattpocock-skills",
|
|
4786
4832
|
"mattpocock-skills"
|
|
4787
4833
|
);
|
|
4788
|
-
|
|
4789
|
-
|
|
4790
|
-
|
|
4791
|
-
|
|
4792
|
-
|
|
4793
|
-
|
|
4794
|
-
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
|
|
4834
|
+
if (getPluginsRegistry() !== null) {
|
|
4835
|
+
try {
|
|
4836
|
+
const entries = await readdir(pluginRoot);
|
|
4837
|
+
const versions = entries.filter((e) => /^\d+\.\d+/.test(e));
|
|
4838
|
+
if (versions.length > 0) {
|
|
4839
|
+
return {
|
|
4840
|
+
name: "mattpocock-skills",
|
|
4841
|
+
status: "pass",
|
|
4842
|
+
message: `installed as plugin (version ${versions.join(", ")})`
|
|
4843
|
+
};
|
|
4844
|
+
}
|
|
4845
|
+
} catch {
|
|
4798
4846
|
}
|
|
4799
|
-
} catch {
|
|
4800
|
-
}
|
|
4801
|
-
try {
|
|
4802
|
-
await stat(skillRoot);
|
|
4803
|
-
return {
|
|
4804
|
-
name: "mattpocock-skills",
|
|
4805
|
-
status: "pass",
|
|
4806
|
-
message: `installed as user-skill (${skillRoot})`
|
|
4807
|
-
};
|
|
4808
|
-
} catch {
|
|
4809
4847
|
}
|
|
4810
|
-
const
|
|
4811
|
-
for (const ind of indicators) {
|
|
4812
|
-
const indPath = join(homedir(), ".claude", "skills", ind);
|
|
4848
|
+
for (const skillsDir of harnessSkillsDirs()) {
|
|
4813
4849
|
try {
|
|
4814
|
-
|
|
4850
|
+
const skillRoot = join(skillsDir, "mattpocock-skills");
|
|
4851
|
+
await stat(skillRoot);
|
|
4815
4852
|
return {
|
|
4816
4853
|
name: "mattpocock-skills",
|
|
4817
4854
|
status: "pass",
|
|
4818
|
-
message: `installed as
|
|
4855
|
+
message: `installed as user-skill (${skillRoot})`
|
|
4819
4856
|
};
|
|
4820
4857
|
} catch {
|
|
4821
4858
|
}
|
|
4822
4859
|
}
|
|
4860
|
+
const indicators = ["diagnose", "tdd", "zoom-out"];
|
|
4861
|
+
for (const skillsDir of harnessSkillsDirs()) {
|
|
4862
|
+
for (const ind of indicators) {
|
|
4863
|
+
try {
|
|
4864
|
+
await stat(join(skillsDir, ind));
|
|
4865
|
+
return {
|
|
4866
|
+
name: "mattpocock-skills",
|
|
4867
|
+
status: "pass",
|
|
4868
|
+
message: `installed as individual skills (found ${ind}/)`
|
|
4869
|
+
};
|
|
4870
|
+
} catch {
|
|
4871
|
+
}
|
|
4872
|
+
}
|
|
4873
|
+
}
|
|
4823
4874
|
return {
|
|
4824
4875
|
name: "mattpocock-skills",
|
|
4825
4876
|
status: "warn",
|
|
4826
4877
|
message: "not installed (plugin cache + user-skill paths both missing)",
|
|
4827
4878
|
fix: REMEDIATION2,
|
|
4828
|
-
install_commands:
|
|
4879
|
+
install_commands: installCommands()
|
|
4829
4880
|
};
|
|
4830
4881
|
}
|
|
4831
|
-
var REMEDIATION2
|
|
4882
|
+
var REMEDIATION2;
|
|
4832
4883
|
var init_check_mattpocock_skills = __esm({
|
|
4833
4884
|
"src/cli/lib/check-mattpocock-skills.ts"() {
|
|
4885
|
+
init_platform();
|
|
4834
4886
|
REMEDIATION2 = "install via `npx skills@latest add mattpocock/skills` (or git clone https://github.com/mattpocock/skills ~/.claude/skills/mattpocock-skills); methodology fallback already inline in role-prompts.yaml per v3.6.0 Phase 1 \u2014 install is optional but enables /grill-with-docs /zoom-out etc. SlashCommand acceleration";
|
|
4835
|
-
INSTALL_COMMANDS2 = ["npx skills@latest add mattpocock/skills"];
|
|
4836
4887
|
}
|
|
4837
4888
|
});
|
|
4838
4889
|
function getUserClaudeJsonPath() {
|
|
@@ -4855,7 +4906,23 @@ async function readUserClaudeJson() {
|
|
|
4855
4906
|
return {};
|
|
4856
4907
|
}
|
|
4857
4908
|
}
|
|
4909
|
+
function isMcpServerInToml(raw, name) {
|
|
4910
|
+
const esc = name.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4911
|
+
const re = new RegExp(`^\\s*\\[mcp_servers\\.(?:${esc}|"${esc}"|'${esc}')(?:\\]|\\.)`, "m");
|
|
4912
|
+
return re.test(raw);
|
|
4913
|
+
}
|
|
4858
4914
|
async function isMcpServerRegistered(name) {
|
|
4915
|
+
const platform = detectPlatform();
|
|
4916
|
+
if (platform.id === "codex") {
|
|
4917
|
+
let raw;
|
|
4918
|
+
try {
|
|
4919
|
+
raw = await readFile(platform.mcpConfigPath, "utf8");
|
|
4920
|
+
} catch (err2) {
|
|
4921
|
+
if (err2.code === "ENOENT") return false;
|
|
4922
|
+
throw err2;
|
|
4923
|
+
}
|
|
4924
|
+
return isMcpServerInToml(raw, name);
|
|
4925
|
+
}
|
|
4859
4926
|
const config = await readUserClaudeJson();
|
|
4860
4927
|
const servers = config.mcpServers;
|
|
4861
4928
|
if (!servers || typeof servers !== "object") return false;
|
|
@@ -5107,7 +5174,9 @@ async function confirmAt(level, ctx) {
|
|
|
5107
5174
|
if (p.isCancel(first)) return { proceed: false, reason: "user-cancel" };
|
|
5108
5175
|
if (first !== true) return { proceed: false };
|
|
5109
5176
|
const second = await p.confirm({
|
|
5110
|
-
|
|
5177
|
+
// v4.14.0 — wording generalized: the shared user-scope config is
|
|
5178
|
+
// ~/.claude.json on claude, ~/.codex/config.toml on codex.
|
|
5179
|
+
message: "This affects other plugins (the harness user-scope config is shared state). Confirm again?",
|
|
5111
5180
|
initialValue: false
|
|
5112
5181
|
});
|
|
5113
5182
|
if (p.isCancel(second)) return { proceed: false, reason: "user-cancel" };
|
|
@@ -5420,23 +5489,25 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5420
5489
|
const cwd = installCfg.cwd ?? ctx.cwd;
|
|
5421
5490
|
let child;
|
|
5422
5491
|
let triedBash = false;
|
|
5492
|
+
const stdio = ["ignore", "pipe", "pipe"];
|
|
5423
5493
|
if (process.platform === "win32") {
|
|
5424
5494
|
if (opts?.posixShell) {
|
|
5425
5495
|
const joined = args.length > 0 ? `${cmd} ${args.join(" ")}` : cmd;
|
|
5426
5496
|
triedBash = true;
|
|
5427
|
-
child = spawn("bash", ["-c", joined], { cwd, env, windowsHide: true });
|
|
5497
|
+
child = spawn("bash", ["-c", joined], { cwd, env, windowsHide: true, stdio });
|
|
5428
5498
|
} else {
|
|
5429
5499
|
const expandedCmd = expandTildeForWindows(cmd);
|
|
5430
5500
|
const expandedArgs = args.map(expandTildeForWindows);
|
|
5431
5501
|
child = spawn("cmd.exe", ["/c", expandedCmd, ...expandedArgs], {
|
|
5432
5502
|
cwd,
|
|
5433
5503
|
env,
|
|
5434
|
-
windowsHide: true
|
|
5504
|
+
windowsHide: true,
|
|
5505
|
+
stdio
|
|
5435
5506
|
});
|
|
5436
5507
|
}
|
|
5437
5508
|
} else {
|
|
5438
5509
|
const joined = args.length > 0 ? `${cmd} ${args.join(" ")}` : cmd;
|
|
5439
|
-
child = spawn("/bin/sh", ["-c", joined], { cwd, env });
|
|
5510
|
+
child = spawn("/bin/sh", ["-c", joined], { cwd, env, stdio });
|
|
5440
5511
|
}
|
|
5441
5512
|
let stdout2 = "";
|
|
5442
5513
|
let stderr = "";
|
|
@@ -5446,10 +5517,10 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5446
5517
|
child.stderr?.setEncoding("utf8").on("data", (chunk) => {
|
|
5447
5518
|
stderr += chunk;
|
|
5448
5519
|
});
|
|
5449
|
-
return await new Promise((
|
|
5520
|
+
return await new Promise((resolve17) => {
|
|
5450
5521
|
const timer = setTimeout(() => {
|
|
5451
5522
|
child.kill("SIGKILL");
|
|
5452
|
-
|
|
5523
|
+
resolve17({
|
|
5453
5524
|
ok: false,
|
|
5454
5525
|
phase: "spawn",
|
|
5455
5526
|
error: {
|
|
@@ -5465,7 +5536,7 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5465
5536
|
child.on("error", (err2) => {
|
|
5466
5537
|
clearTimeout(timer);
|
|
5467
5538
|
const bashMissing = triedBash && err2.code === "ENOENT";
|
|
5468
|
-
|
|
5539
|
+
resolve17({
|
|
5469
5540
|
ok: false,
|
|
5470
5541
|
phase: "spawn",
|
|
5471
5542
|
error: {
|
|
@@ -5480,7 +5551,7 @@ async function spawnCmd(ctx, cmd, args, timeoutMs, opts) {
|
|
|
5480
5551
|
});
|
|
5481
5552
|
child.on("close", (code) => {
|
|
5482
5553
|
clearTimeout(timer);
|
|
5483
|
-
|
|
5554
|
+
resolve17({ ok: true, exitCode: code ?? -1, stdout: stdout2, stderr });
|
|
5484
5555
|
});
|
|
5485
5556
|
});
|
|
5486
5557
|
}
|
|
@@ -5493,6 +5564,8 @@ var init_spawn = __esm({
|
|
|
5493
5564
|
}
|
|
5494
5565
|
});
|
|
5495
5566
|
function extractSkillName(cmd, fallback) {
|
|
5567
|
+
const flag = cmd.match(/(?:^|\s)(?:--skill|-s)\s+['"]?([^\s'"]+)['"]?/);
|
|
5568
|
+
if (flag?.[1] && flag[1] !== "*") return flag[1];
|
|
5496
5569
|
const m = cmd.match(/\bskills(?:@\S+)?\s+add\s+(\S+)/i);
|
|
5497
5570
|
if (!m?.[1]) return fallback;
|
|
5498
5571
|
const seg = m[1].split("/");
|
|
@@ -5513,21 +5586,43 @@ function extractGitCloneTarget(cmd) {
|
|
|
5513
5586
|
if (dest.startsWith("/") || /^[A-Z]:[\\/]/i.test(dest)) return dest;
|
|
5514
5587
|
return null;
|
|
5515
5588
|
}
|
|
5516
|
-
async function
|
|
5517
|
-
const method = ctx.manifest.spec.install.method;
|
|
5518
|
-
const cmd = ctx.manifest.spec.install.cmd;
|
|
5519
|
-
const name = ctx.manifest.metadata.name;
|
|
5589
|
+
async function indicatorPresent(name) {
|
|
5520
5590
|
const indicators = INSTALLED_INDICATORS[name];
|
|
5521
|
-
if (indicators)
|
|
5591
|
+
if (!indicators) return false;
|
|
5592
|
+
for (const skillsDir of harnessSkillsDirs()) {
|
|
5522
5593
|
for (const ind of indicators) {
|
|
5523
|
-
const dir = join(getSkillsDir(), ind);
|
|
5524
5594
|
try {
|
|
5525
|
-
await access(
|
|
5595
|
+
await access(join(skillsDir, ind));
|
|
5526
5596
|
return true;
|
|
5527
5597
|
} catch {
|
|
5528
5598
|
}
|
|
5529
5599
|
}
|
|
5530
5600
|
}
|
|
5601
|
+
return false;
|
|
5602
|
+
}
|
|
5603
|
+
async function detectSkillPresence(cmd, name) {
|
|
5604
|
+
if (await indicatorPresent(name)) return true;
|
|
5605
|
+
const skillName = extractSkillName(cmd, name);
|
|
5606
|
+
for (const skillsDir of harnessSkillsDirs()) {
|
|
5607
|
+
try {
|
|
5608
|
+
await access(join(skillsDir, skillName, "SKILL.md"));
|
|
5609
|
+
return true;
|
|
5610
|
+
} catch {
|
|
5611
|
+
}
|
|
5612
|
+
}
|
|
5613
|
+
return false;
|
|
5614
|
+
}
|
|
5615
|
+
async function detectNative(ctx) {
|
|
5616
|
+
const method = ctx.manifest.spec.install.method;
|
|
5617
|
+
const cmd = ctx.manifest.spec.install.cmd;
|
|
5618
|
+
const name = ctx.manifest.metadata.name;
|
|
5619
|
+
if (await indicatorPresent(name)) return true;
|
|
5620
|
+
if (method === "mcp-stdio-add" || method === "mcp-http-add") {
|
|
5621
|
+
try {
|
|
5622
|
+
if (await isMcpServerRegistered(name)) return true;
|
|
5623
|
+
} catch {
|
|
5624
|
+
}
|
|
5625
|
+
}
|
|
5531
5626
|
if (method === "cc-plugin-marketplace") {
|
|
5532
5627
|
const m = cmd.match(/(?:claude\s+)?plugin\s+install\s+(\S+)/i);
|
|
5533
5628
|
const pluginName = m?.[1]?.split("@")[0] ?? name;
|
|
@@ -5603,28 +5698,38 @@ var init_idempotent = __esm({
|
|
|
5603
5698
|
};
|
|
5604
5699
|
}
|
|
5605
5700
|
});
|
|
5606
|
-
function
|
|
5607
|
-
return new Promise((
|
|
5701
|
+
function runHarnessArgs(bin, args, cwd, timeoutMs = 15e3) {
|
|
5702
|
+
return new Promise((resolve17) => {
|
|
5608
5703
|
const isWin = process.platform === "win32";
|
|
5609
|
-
const
|
|
5704
|
+
const stdio = ["ignore", "pipe", "pipe"];
|
|
5705
|
+
const child = isWin ? spawn("cmd.exe", ["/c", bin, ...args], { cwd, windowsHide: true, stdio }) : spawn(bin, args, { cwd, shell: false, stdio });
|
|
5706
|
+
let stdout2 = "";
|
|
5610
5707
|
let stderr = "";
|
|
5708
|
+
child.stdout?.setEncoding("utf8").on("data", (c) => {
|
|
5709
|
+
stdout2 += c;
|
|
5710
|
+
});
|
|
5611
5711
|
child.stderr?.setEncoding("utf8").on("data", (c) => {
|
|
5612
5712
|
stderr += c;
|
|
5613
5713
|
});
|
|
5614
5714
|
const timer = setTimeout(() => {
|
|
5615
5715
|
child.kill("SIGKILL");
|
|
5616
|
-
|
|
5716
|
+
resolve17({ exitCode: -1, stdout: stdout2, stderr: `${stderr}[timeout after ${timeoutMs}ms]` });
|
|
5617
5717
|
}, timeoutMs);
|
|
5618
5718
|
child.on("error", (e) => {
|
|
5619
5719
|
clearTimeout(timer);
|
|
5620
|
-
|
|
5720
|
+
const enoent = e.code === "ENOENT";
|
|
5721
|
+
const msg = enoent && bin === "codex" ? "codex CLI not found on PATH \u2014 install Codex CLI or re-run setup on the claude platform" : e.message;
|
|
5722
|
+
resolve17({ exitCode: -1, stdout: stdout2, stderr: `${stderr}${msg}` });
|
|
5621
5723
|
});
|
|
5622
5724
|
child.on("close", (code) => {
|
|
5623
5725
|
clearTimeout(timer);
|
|
5624
|
-
|
|
5726
|
+
resolve17({ exitCode: code ?? -1, stdout: stdout2, stderr });
|
|
5625
5727
|
});
|
|
5626
5728
|
});
|
|
5627
5729
|
}
|
|
5730
|
+
function runArgs(claudeArgs, cwd, timeoutMs = 15e3) {
|
|
5731
|
+
return runHarnessArgs("claude", claudeArgs, cwd, timeoutMs);
|
|
5732
|
+
}
|
|
5628
5733
|
var init_runClaudeArgs = __esm({
|
|
5629
5734
|
"src/installers/lib/runClaudeArgs.ts"() {
|
|
5630
5735
|
}
|
|
@@ -5640,7 +5745,7 @@ var init_safeCwd = __esm({
|
|
|
5640
5745
|
// src/installers/ccPluginMarketplace.ts
|
|
5641
5746
|
function parseCmd(cmd) {
|
|
5642
5747
|
const mktMatch = cmd.match(/(?:\/?plugin)\s+marketplace\s+add\s+(\S+)/i);
|
|
5643
|
-
const pluginMatch = cmd.match(/(?:\/?plugin)\s+install\s+(\S+)/i);
|
|
5748
|
+
const pluginMatch = cmd.match(/(?:\/?plugin)\s+(?:install|add)\s+(?!marketplace\b)(\S+)/i);
|
|
5644
5749
|
if (!pluginMatch || pluginMatch[1] === void 0) return null;
|
|
5645
5750
|
const pluginAtMkt = pluginMatch[1].replace(/[;&]+$/, "");
|
|
5646
5751
|
if (!pluginAtMkt.includes("@")) return null;
|
|
@@ -5659,6 +5764,7 @@ var init_ccPluginMarketplace2 = __esm({
|
|
|
5659
5764
|
init_diff();
|
|
5660
5765
|
init_err();
|
|
5661
5766
|
init_idempotent();
|
|
5767
|
+
init_platform();
|
|
5662
5768
|
init_preflight();
|
|
5663
5769
|
init_readClaudeConfig();
|
|
5664
5770
|
init_runClaudeArgs();
|
|
@@ -5678,6 +5784,12 @@ var init_ccPluginMarketplace2 = __esm({
|
|
|
5678
5784
|
)
|
|
5679
5785
|
};
|
|
5680
5786
|
}
|
|
5787
|
+
const platform = detectPlatform();
|
|
5788
|
+
const isCodexCmd = /^codex\b/.test(install.cmd.trim());
|
|
5789
|
+
if (platform.id !== "claude" && !(platform.id === "codex" && isCodexCmd)) {
|
|
5790
|
+
return { aborted: true, reason: "harness-mismatch" };
|
|
5791
|
+
}
|
|
5792
|
+
const bin = platform.id === "codex" ? "codex" : "claude";
|
|
5681
5793
|
const pre = preflight(ctx);
|
|
5682
5794
|
if (!pre.ok) {
|
|
5683
5795
|
if (pre.abortReason === "platform-mismatch")
|
|
@@ -5705,7 +5817,7 @@ var init_ccPluginMarketplace2 = __esm({
|
|
|
5705
5817
|
};
|
|
5706
5818
|
}
|
|
5707
5819
|
const pluginName = parsed.pluginAtMkt.split("@")[0] ?? parsed.pluginAtMkt;
|
|
5708
|
-
const installArgs = ["plugin", "install", parsed.pluginAtMkt, "--scope", "user"];
|
|
5820
|
+
const installArgs = bin === "codex" ? ["plugin", "add", parsed.pluginAtMkt] : ["plugin", "install", parsed.pluginAtMkt, "--scope", "user"];
|
|
5709
5821
|
const allArgs = [];
|
|
5710
5822
|
if (parsed.marketplaceRef !== null) {
|
|
5711
5823
|
allArgs.push(["plugin", "marketplace", "add", parsed.marketplaceRef]);
|
|
@@ -5728,15 +5840,16 @@ var init_ccPluginMarketplace2 = __esm({
|
|
|
5728
5840
|
}
|
|
5729
5841
|
}
|
|
5730
5842
|
}
|
|
5731
|
-
const settingsFile = `${getMcpSpawnCwd()}/.claude.json`;
|
|
5843
|
+
const settingsFile = bin === "codex" ? platform.mcpConfigPath : `${getMcpSpawnCwd()}/.claude.json`;
|
|
5732
5844
|
const newEntry = JSON.stringify({ enabledPlugins: { [parsed.pluginAtMkt]: true } }, null, 2);
|
|
5845
|
+
const mergeNote = bin === "codex" ? "// will be registered in ~/.codex/config.toml by `codex plugin add`:" : "// will be merged into ~/.claude.json enabledPlugins map by `claude plugin install --scope user`:";
|
|
5733
5846
|
const plan = {
|
|
5734
5847
|
files: [
|
|
5735
5848
|
{
|
|
5736
5849
|
target: settingsFile,
|
|
5737
5850
|
scope: "HOME",
|
|
5738
5851
|
oldText: "",
|
|
5739
|
-
newText:
|
|
5852
|
+
newText: `${mergeNote}
|
|
5740
5853
|
${newEntry}
|
|
5741
5854
|
`
|
|
5742
5855
|
}
|
|
@@ -5754,10 +5867,14 @@ ${newEntry}
|
|
|
5754
5867
|
const spawnCwd = install.cwd ?? getMcpSpawnCwd();
|
|
5755
5868
|
let stepOneStderr = "";
|
|
5756
5869
|
if (parsed.marketplaceRef !== null) {
|
|
5757
|
-
const r1 = await
|
|
5870
|
+
const r1 = await runHarnessArgs(
|
|
5871
|
+
bin,
|
|
5872
|
+
["plugin", "marketplace", "add", parsed.marketplaceRef],
|
|
5873
|
+
spawnCwd
|
|
5874
|
+
);
|
|
5758
5875
|
stepOneStderr = r1.stderr;
|
|
5759
5876
|
}
|
|
5760
|
-
const r2 = await
|
|
5877
|
+
const r2 = await runHarnessArgs(bin, installArgs, spawnCwd, 6e4);
|
|
5761
5878
|
if (r2.exitCode !== 0) {
|
|
5762
5879
|
return {
|
|
5763
5880
|
ok: false,
|
|
@@ -5766,13 +5883,20 @@ ${newEntry}
|
|
|
5766
5883
|
error: err(
|
|
5767
5884
|
ctx,
|
|
5768
5885
|
"/spec/install/cmd",
|
|
5769
|
-
|
|
5886
|
+
`${bin} plugin ${bin === "codex" ? "add" : "install"} exited ${r2.exitCode}: ${r2.stderr.slice(0, 200)}${stepOneStderr ? ` | marketplace-add stderr: ${stepOneStderr.slice(0, 100)}` : ""}`,
|
|
5770
5887
|
"install-failed"
|
|
5771
5888
|
)
|
|
5772
5889
|
};
|
|
5773
5890
|
}
|
|
5774
|
-
|
|
5891
|
+
let registered;
|
|
5892
|
+
if (bin === "codex") {
|
|
5893
|
+
const vr = await runHarnessArgs("codex", ["plugin", "list"], spawnCwd, 15e3);
|
|
5894
|
+
registered = vr.exitCode === 0 && vr.stdout.includes(pluginName);
|
|
5895
|
+
} else {
|
|
5896
|
+
registered = await isPluginRegistered(pluginName);
|
|
5897
|
+
}
|
|
5775
5898
|
if (!registered) {
|
|
5899
|
+
const cfgLabel = bin === "codex" ? "`codex plugin list` output" : "enabledPlugins map of ~/.claude.json";
|
|
5776
5900
|
return {
|
|
5777
5901
|
ok: false,
|
|
5778
5902
|
phase: "verify",
|
|
@@ -5780,7 +5904,7 @@ ${newEntry}
|
|
|
5780
5904
|
error: err(
|
|
5781
5905
|
ctx,
|
|
5782
5906
|
"/spec/verify/cmd",
|
|
5783
|
-
`verify: plugin '${pluginName}' not found in
|
|
5907
|
+
`verify: plugin '${pluginName}' not found in ${cfgLabel} after install spawn exit 0 (file may have been overwritten, or ${bin} plugin ${bin === "codex" ? "add" : "install"} wrote to a non-default location)`,
|
|
5784
5908
|
"verify-failed"
|
|
5785
5909
|
)
|
|
5786
5910
|
};
|
|
@@ -5791,7 +5915,7 @@ ${newEntry}
|
|
|
5791
5915
|
}
|
|
5792
5916
|
});
|
|
5793
5917
|
function gitRevParseHead(cwd, timeoutMs = 1e4) {
|
|
5794
|
-
return new Promise((
|
|
5918
|
+
return new Promise((resolve17) => {
|
|
5795
5919
|
const isWin = process.platform === "win32";
|
|
5796
5920
|
const child = isWin ? spawn("cmd.exe", ["/c", "git", "rev-parse", "HEAD"], { cwd, windowsHide: true }) : spawn("git", ["rev-parse", "HEAD"], { cwd, shell: false });
|
|
5797
5921
|
let stdout2 = "";
|
|
@@ -5800,15 +5924,15 @@ function gitRevParseHead(cwd, timeoutMs = 1e4) {
|
|
|
5800
5924
|
});
|
|
5801
5925
|
const timer = setTimeout(() => {
|
|
5802
5926
|
child.kill("SIGKILL");
|
|
5803
|
-
|
|
5927
|
+
resolve17({ sha: "", exit: -1 });
|
|
5804
5928
|
}, timeoutMs);
|
|
5805
5929
|
child.on("error", () => {
|
|
5806
5930
|
clearTimeout(timer);
|
|
5807
|
-
|
|
5931
|
+
resolve17({ sha: "", exit: -1 });
|
|
5808
5932
|
});
|
|
5809
5933
|
child.on("close", (code) => {
|
|
5810
5934
|
clearTimeout(timer);
|
|
5811
|
-
|
|
5935
|
+
resolve17({ sha: stdout2.trim(), exit: code ?? -1 });
|
|
5812
5936
|
});
|
|
5813
5937
|
});
|
|
5814
5938
|
}
|
|
@@ -6036,6 +6160,7 @@ var init_mcpHttpAdd2 = __esm({
|
|
|
6036
6160
|
init_diff();
|
|
6037
6161
|
init_err();
|
|
6038
6162
|
init_idempotent();
|
|
6163
|
+
init_platform();
|
|
6039
6164
|
init_preflight();
|
|
6040
6165
|
init_readClaudeConfig();
|
|
6041
6166
|
init_runClaudeArgs();
|
|
@@ -6095,7 +6220,27 @@ var init_mcpHttpAdd2 = __esm({
|
|
|
6095
6220
|
}
|
|
6096
6221
|
};
|
|
6097
6222
|
}
|
|
6098
|
-
const
|
|
6223
|
+
const platform = detectPlatform();
|
|
6224
|
+
if (platform.id !== "claude" && platform.id !== "codex") {
|
|
6225
|
+
return { aborted: true, reason: "harness-mismatch" };
|
|
6226
|
+
}
|
|
6227
|
+
const bin = platform.id;
|
|
6228
|
+
if (bin === "codex" && hdr.flat.length > 0) {
|
|
6229
|
+
return {
|
|
6230
|
+
ok: false,
|
|
6231
|
+
phase: "preflight",
|
|
6232
|
+
error: {
|
|
6233
|
+
...err(
|
|
6234
|
+
ctx,
|
|
6235
|
+
"/spec/install/cmd",
|
|
6236
|
+
`mcp-http-add --header is not supported by the codex CLI (\`codex mcp add\` has no --header flag); this server cannot be installed on the codex platform with auth headers`,
|
|
6237
|
+
"harness-unsupported-headers"
|
|
6238
|
+
),
|
|
6239
|
+
suggest: "install this MCP server on the claude platform, or drop the --header from the manifest if the endpoint is unauthenticated"
|
|
6240
|
+
}
|
|
6241
|
+
};
|
|
6242
|
+
}
|
|
6243
|
+
const addArgs = bin === "codex" ? ["mcp", "add", name, "--url", url] : ["mcp", "add", "--scope", "user", "--transport", "http", ...hdr.flat, name, url];
|
|
6099
6244
|
for (const a of addArgs) {
|
|
6100
6245
|
const violation = checkCmdString(a);
|
|
6101
6246
|
if (violation) {
|
|
@@ -6111,7 +6256,7 @@ var init_mcpHttpAdd2 = __esm({
|
|
|
6111
6256
|
};
|
|
6112
6257
|
}
|
|
6113
6258
|
}
|
|
6114
|
-
const mcpFile = `${getMcpSpawnCwd()}/.claude.json`;
|
|
6259
|
+
const mcpFile = bin === "codex" ? platform.mcpConfigPath : `${getMcpSpawnCwd()}/.claude.json`;
|
|
6115
6260
|
const headersObj = {};
|
|
6116
6261
|
for (let i = 0; i < hdr.flat.length; i += 2) {
|
|
6117
6262
|
const kv = hdr.flat[i + 1];
|
|
@@ -6121,13 +6266,14 @@ var init_mcpHttpAdd2 = __esm({
|
|
|
6121
6266
|
}
|
|
6122
6267
|
const entry = Object.keys(headersObj).length > 0 ? { [name]: { type: "http", url, headers: headersObj } } : { [name]: { type: "http", url } };
|
|
6123
6268
|
const newEntry = JSON.stringify(entry, null, 2);
|
|
6269
|
+
const mergeNote = bin === "codex" ? `// will be written as [mcp_servers.${name}] (url form) into ~/.codex/config.toml by \`codex mcp add\`:` : "// will be merged into ~/.claude.json mcpServers map by `claude mcp add --scope user`:";
|
|
6124
6270
|
const plan = {
|
|
6125
6271
|
files: [
|
|
6126
6272
|
{
|
|
6127
6273
|
target: mcpFile,
|
|
6128
6274
|
scope: "HOME",
|
|
6129
6275
|
oldText: "",
|
|
6130
|
-
newText:
|
|
6276
|
+
newText: `${mergeNote}
|
|
6131
6277
|
${newEntry}
|
|
6132
6278
|
`
|
|
6133
6279
|
}
|
|
@@ -6143,7 +6289,7 @@ ${newEntry}
|
|
|
6143
6289
|
const bk = await backup(plan, ctx);
|
|
6144
6290
|
if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
|
|
6145
6291
|
const spawnCwd = install.cwd ?? getMcpSpawnCwd();
|
|
6146
|
-
const r = await
|
|
6292
|
+
const r = await runHarnessArgs(bin, addArgs, spawnCwd);
|
|
6147
6293
|
if (r.exitCode !== 0) {
|
|
6148
6294
|
if (r.stderr.includes("already exists")) {
|
|
6149
6295
|
return { ok: true, alreadyInstalled: true, backupId: bk.backupId };
|
|
@@ -6155,13 +6301,14 @@ ${newEntry}
|
|
|
6155
6301
|
error: err(
|
|
6156
6302
|
ctx,
|
|
6157
6303
|
"/spec/install/cmd",
|
|
6158
|
-
|
|
6304
|
+
`${bin} mcp add (http) exited ${r.exitCode}: ${r.stderr.slice(0, 200)}`,
|
|
6159
6305
|
"install-failed"
|
|
6160
6306
|
)
|
|
6161
6307
|
};
|
|
6162
6308
|
}
|
|
6163
6309
|
const registered = await isMcpServerRegistered(name);
|
|
6164
6310
|
if (!registered) {
|
|
6311
|
+
const cfgLabel = bin === "codex" ? "[mcp_servers] table of ~/.codex/config.toml" : "mcpServers map of ~/.claude.json";
|
|
6165
6312
|
return {
|
|
6166
6313
|
ok: false,
|
|
6167
6314
|
phase: "verify",
|
|
@@ -6169,7 +6316,7 @@ ${newEntry}
|
|
|
6169
6316
|
error: err(
|
|
6170
6317
|
ctx,
|
|
6171
6318
|
"/spec/verify/cmd",
|
|
6172
|
-
`verify: '${name}' not found in
|
|
6319
|
+
`verify: '${name}' not found in ${cfgLabel} after install spawn exit 0 (file may have been overwritten, or ${bin} mcp add wrote to a non-default location)`,
|
|
6173
6320
|
"verify-failed"
|
|
6174
6321
|
)
|
|
6175
6322
|
};
|
|
@@ -6190,6 +6337,7 @@ var init_mcpStdioAdd2 = __esm({
|
|
|
6190
6337
|
init_diff();
|
|
6191
6338
|
init_err();
|
|
6192
6339
|
init_idempotent();
|
|
6340
|
+
init_platform();
|
|
6193
6341
|
init_preflight();
|
|
6194
6342
|
init_readClaudeConfig();
|
|
6195
6343
|
init_runClaudeArgs();
|
|
@@ -6222,7 +6370,12 @@ var init_mcpStdioAdd2 = __esm({
|
|
|
6222
6370
|
const name = ctx.manifest.metadata.name;
|
|
6223
6371
|
const pkg = ctx.manifest.metadata.upstream.source;
|
|
6224
6372
|
const ver = install.npm_version;
|
|
6225
|
-
const
|
|
6373
|
+
const platform = detectPlatform();
|
|
6374
|
+
if (platform.id !== "claude" && platform.id !== "codex") {
|
|
6375
|
+
return { aborted: true, reason: "harness-mismatch" };
|
|
6376
|
+
}
|
|
6377
|
+
const bin = platform.id;
|
|
6378
|
+
const addArgs = bin === "codex" ? ["mcp", "add", name, "--", "npx", "--yes", `${pkg}@${ver}`] : [
|
|
6226
6379
|
"mcp",
|
|
6227
6380
|
"add",
|
|
6228
6381
|
"--scope",
|
|
@@ -6250,19 +6403,20 @@ var init_mcpStdioAdd2 = __esm({
|
|
|
6250
6403
|
};
|
|
6251
6404
|
}
|
|
6252
6405
|
}
|
|
6253
|
-
const mcpFile = `${getMcpSpawnCwd()}/.claude.json`;
|
|
6406
|
+
const mcpFile = bin === "codex" ? platform.mcpConfigPath : `${getMcpSpawnCwd()}/.claude.json`;
|
|
6254
6407
|
const newEntry = JSON.stringify(
|
|
6255
6408
|
{ [name]: { type: "stdio", command: "npx", args: ["--yes", `${pkg}@${ver}`] } },
|
|
6256
6409
|
null,
|
|
6257
6410
|
2
|
|
6258
6411
|
);
|
|
6412
|
+
const mergeNote = bin === "codex" ? `// will be written as [mcp_servers.${name}] into ~/.codex/config.toml by \`codex mcp add\`:` : "// will be merged into ~/.claude.json mcpServers map by `claude mcp add --scope user`:";
|
|
6259
6413
|
const plan = {
|
|
6260
6414
|
files: [
|
|
6261
6415
|
{
|
|
6262
6416
|
target: mcpFile,
|
|
6263
6417
|
scope: "HOME",
|
|
6264
6418
|
oldText: "",
|
|
6265
|
-
newText:
|
|
6419
|
+
newText: `${mergeNote}
|
|
6266
6420
|
${newEntry}
|
|
6267
6421
|
`
|
|
6268
6422
|
}
|
|
@@ -6278,7 +6432,7 @@ ${newEntry}
|
|
|
6278
6432
|
const bk = await backup(plan, ctx);
|
|
6279
6433
|
if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
|
|
6280
6434
|
const spawnCwd = install.cwd ?? getMcpSpawnCwd();
|
|
6281
|
-
const r = await
|
|
6435
|
+
const r = await runHarnessArgs(bin, addArgs, spawnCwd);
|
|
6282
6436
|
if (r.exitCode !== 0) {
|
|
6283
6437
|
if (r.stderr.includes("already exists")) {
|
|
6284
6438
|
return { ok: true, alreadyInstalled: true, backupId: bk.backupId };
|
|
@@ -6290,13 +6444,14 @@ ${newEntry}
|
|
|
6290
6444
|
error: err(
|
|
6291
6445
|
ctx,
|
|
6292
6446
|
"/spec/install/cmd",
|
|
6293
|
-
|
|
6447
|
+
`${bin} mcp add exited ${r.exitCode}: ${r.stderr.slice(0, 200)}`,
|
|
6294
6448
|
"install-failed"
|
|
6295
6449
|
)
|
|
6296
6450
|
};
|
|
6297
6451
|
}
|
|
6298
6452
|
const registered = await isMcpServerRegistered(name);
|
|
6299
6453
|
if (!registered) {
|
|
6454
|
+
const cfgLabel = bin === "codex" ? "[mcp_servers] table of ~/.codex/config.toml" : "mcpServers map of ~/.claude.json";
|
|
6300
6455
|
return {
|
|
6301
6456
|
ok: false,
|
|
6302
6457
|
phase: "verify",
|
|
@@ -6304,7 +6459,7 @@ ${newEntry}
|
|
|
6304
6459
|
error: err(
|
|
6305
6460
|
ctx,
|
|
6306
6461
|
"/spec/verify/cmd",
|
|
6307
|
-
`verify: '${name}' not found in
|
|
6462
|
+
`verify: '${name}' not found in ${cfgLabel} after install spawn exit 0 (file may have been overwritten, or ${bin} mcp add wrote to a non-default location)`,
|
|
6308
6463
|
"verify-failed"
|
|
6309
6464
|
)
|
|
6310
6465
|
};
|
|
@@ -6433,6 +6588,7 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6433
6588
|
init_diff();
|
|
6434
6589
|
init_err();
|
|
6435
6590
|
init_idempotent();
|
|
6591
|
+
init_platform();
|
|
6436
6592
|
init_preflight();
|
|
6437
6593
|
init_spawn();
|
|
6438
6594
|
init_state2();
|
|
@@ -6475,9 +6631,17 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6475
6631
|
}
|
|
6476
6632
|
};
|
|
6477
6633
|
}
|
|
6634
|
+
const AGENT_BY_PLATFORM = {
|
|
6635
|
+
claude: "claude-code",
|
|
6636
|
+
codex: "codex"
|
|
6637
|
+
};
|
|
6638
|
+
const platformId = detectPlatform().id;
|
|
6639
|
+
const agentId = AGENT_BY_PLATFORM[platformId];
|
|
6640
|
+
const hasExplicitAgent = /(?:^|\s)(?:--agent|-a)\s/.test(install.cmd);
|
|
6641
|
+
const effectiveCmd = agentId && !hasExplicitAgent ? `${install.cmd} --agent ${agentId}` : install.cmd;
|
|
6478
6642
|
const name = ctx.manifest.metadata.name;
|
|
6479
6643
|
const skillSegment = extractSkillName(install.cmd, name);
|
|
6480
|
-
const skillDir = join(
|
|
6644
|
+
const skillDir = join(getSkillsDir(), skillSegment);
|
|
6481
6645
|
const skillMdPath = join(skillDir, "SKILL.md");
|
|
6482
6646
|
const plan = {
|
|
6483
6647
|
files: [
|
|
@@ -6485,7 +6649,7 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6485
6649
|
target: skillMdPath,
|
|
6486
6650
|
scope: "HOME",
|
|
6487
6651
|
oldText: "",
|
|
6488
|
-
newText: `// new SKILL.md created by: ${
|
|
6652
|
+
newText: `// new SKILL.md created by: ${effectiveCmd}
|
|
6489
6653
|
`
|
|
6490
6654
|
}
|
|
6491
6655
|
]
|
|
@@ -6499,7 +6663,7 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6499
6663
|
if (ctx.opts.dryRun) return { aborted: true, reason: "user-cancel" };
|
|
6500
6664
|
const bk = await backup(plan, ctx);
|
|
6501
6665
|
if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
|
|
6502
|
-
const sp = await spawnCmd(ctx,
|
|
6666
|
+
const sp = await spawnCmd(ctx, effectiveCmd, [], DEFAULT_INSTALL_TIMEOUT_MS);
|
|
6503
6667
|
if (!("exitCode" in sp)) return { ...sp, backupId: bk.backupId };
|
|
6504
6668
|
if (sp.exitCode !== 0) {
|
|
6505
6669
|
return {
|
|
@@ -6514,9 +6678,8 @@ var init_npxSkillInstaller2 = __esm({
|
|
|
6514
6678
|
)
|
|
6515
6679
|
};
|
|
6516
6680
|
}
|
|
6517
|
-
|
|
6518
|
-
|
|
6519
|
-
} catch {
|
|
6681
|
+
const present = await detectSkillPresence(install.cmd, name);
|
|
6682
|
+
if (!present) {
|
|
6520
6683
|
return {
|
|
6521
6684
|
ok: false,
|
|
6522
6685
|
phase: "verify",
|
|
@@ -6573,16 +6736,37 @@ function levelOf(manifest) {
|
|
|
6573
6736
|
return "L4";
|
|
6574
6737
|
}
|
|
6575
6738
|
}
|
|
6739
|
+
function resolveForHarness(manifest) {
|
|
6740
|
+
const platform = detectPlatform();
|
|
6741
|
+
if (platform.id === "claude") return { manifest, gate: null };
|
|
6742
|
+
const override = platform.id === "codex" ? manifest.spec.harness_overrides?.codex : void 0;
|
|
6743
|
+
if (override) {
|
|
6744
|
+
const spec = {
|
|
6745
|
+
...manifest.spec,
|
|
6746
|
+
install: override.install,
|
|
6747
|
+
verify: override.verify ?? manifest.spec.verify
|
|
6748
|
+
};
|
|
6749
|
+
return { manifest: { ...manifest, spec }, gate: null };
|
|
6750
|
+
}
|
|
6751
|
+
if (CLAUDE_ONLY_METHODS.has(manifest.spec.install.method)) {
|
|
6752
|
+
return { manifest, gate: { aborted: true, reason: "harness-mismatch" } };
|
|
6753
|
+
}
|
|
6754
|
+
return { manifest, gate: null };
|
|
6755
|
+
}
|
|
6576
6756
|
async function runInstall(manifest, opts) {
|
|
6577
|
-
const
|
|
6578
|
-
|
|
6757
|
+
const resolved = resolveForHarness(manifest);
|
|
6758
|
+
if (resolved.gate) return resolved.gate;
|
|
6759
|
+
const effective = resolved.manifest;
|
|
6760
|
+
const installer = installers[effective.spec.install.method];
|
|
6761
|
+
return installer({ manifest: effective, opts, level: levelOf(effective), cwd: process.cwd() });
|
|
6579
6762
|
}
|
|
6580
|
-
var installers;
|
|
6763
|
+
var installers, CLAUDE_ONLY_METHODS;
|
|
6581
6764
|
var init_installers = __esm({
|
|
6582
6765
|
"src/installers/index.ts"() {
|
|
6583
6766
|
init_ccHookAdd2();
|
|
6584
6767
|
init_ccPluginMarketplace2();
|
|
6585
6768
|
init_gitCloneWithSetup2();
|
|
6769
|
+
init_platform();
|
|
6586
6770
|
init_mcpHttpAdd2();
|
|
6587
6771
|
init_mcpStdioAdd2();
|
|
6588
6772
|
init_npmCli2();
|
|
@@ -6597,6 +6781,7 @@ var init_installers = __esm({
|
|
|
6597
6781
|
// Phase 2.4 W3 T3.1 (D-04 § 3.1) — 7th installer.
|
|
6598
6782
|
"cc-hook-add": installCcHookAdd
|
|
6599
6783
|
};
|
|
6784
|
+
CLAUDE_ONLY_METHODS = /* @__PURE__ */ new Set(["cc-plugin-marketplace", "cc-hook-add"]);
|
|
6600
6785
|
}
|
|
6601
6786
|
});
|
|
6602
6787
|
var PinnedUpstream, KnownGoodV1;
|
|
@@ -6960,6 +7145,77 @@ var init_resume = __esm({
|
|
|
6960
7145
|
}
|
|
6961
7146
|
});
|
|
6962
7147
|
|
|
7148
|
+
// src/cli/lib/l4-rescue.ts
|
|
7149
|
+
var l4_rescue_exports = {};
|
|
7150
|
+
__export(l4_rescue_exports, {
|
|
7151
|
+
runL4Rescue: () => runL4Rescue
|
|
7152
|
+
});
|
|
7153
|
+
async function runL4Rescue(manifestPaths, skipped) {
|
|
7154
|
+
const out = { installed: [], skipped: [], failed: [] };
|
|
7155
|
+
const targets = skipped.filter((s) => s.reason === "level-flag-missing");
|
|
7156
|
+
if (targets.length === 0) return out;
|
|
7157
|
+
const byName = /* @__PURE__ */ new Map();
|
|
7158
|
+
for (const path of manifestPaths) {
|
|
7159
|
+
try {
|
|
7160
|
+
const v = validateManifestFile(await readFile(path, "utf8"), path);
|
|
7161
|
+
if (v.ok) byName.set(v.manifest.metadata.name, v.manifest);
|
|
7162
|
+
} catch {
|
|
7163
|
+
}
|
|
7164
|
+
}
|
|
7165
|
+
console.log(
|
|
7166
|
+
`
|
|
7167
|
+
${targets.length} component(s) need a system-wide (L4) install \u2014 harnessed can run them now:`
|
|
7168
|
+
);
|
|
7169
|
+
for (const t2 of targets) {
|
|
7170
|
+
const manifest = byName.get(t2.name);
|
|
7171
|
+
if (!manifest) {
|
|
7172
|
+
out.failed.push({ name: t2.name, reason: "manifest not found for L4 rescue" });
|
|
7173
|
+
continue;
|
|
7174
|
+
}
|
|
7175
|
+
console.log(`
|
|
7176
|
+
${t2.name}:`);
|
|
7177
|
+
console.log(` $ ${manifest.spec.install.cmd}`);
|
|
7178
|
+
const ans = await p.confirm({
|
|
7179
|
+
message: `Run L4 install for "${t2.name}"? (system-wide \u2014 modifies global PATH)`,
|
|
7180
|
+
initialValue: false
|
|
7181
|
+
});
|
|
7182
|
+
if (p.isCancel(ans) || ans !== true) {
|
|
7183
|
+
out.skipped.push(t2.name);
|
|
7184
|
+
continue;
|
|
7185
|
+
}
|
|
7186
|
+
const opts = {
|
|
7187
|
+
apply: true,
|
|
7188
|
+
dryRun: false,
|
|
7189
|
+
system: true,
|
|
7190
|
+
// the explicit L4 opt-in confirmAt requires
|
|
7191
|
+
nonInteractive: true,
|
|
7192
|
+
// consent already given via the confirm above
|
|
7193
|
+
fullDiff: false,
|
|
7194
|
+
color: "auto",
|
|
7195
|
+
updateInstalled: false,
|
|
7196
|
+
quiet: true
|
|
7197
|
+
};
|
|
7198
|
+
const r = await runInstall(manifest, opts);
|
|
7199
|
+
if ("aborted" in r) {
|
|
7200
|
+
out.skipped.push(t2.name);
|
|
7201
|
+
console.log(` \u21B7 skipped ${t2.name} (${r.reason})`);
|
|
7202
|
+
} else if (r.ok) {
|
|
7203
|
+
out.installed.push(t2.name);
|
|
7204
|
+
console.log(` \u2713 installed ${t2.name}`);
|
|
7205
|
+
} else {
|
|
7206
|
+
out.failed.push({ name: t2.name, reason: r.error.message });
|
|
7207
|
+
console.error(` \u2717 failed ${t2.name}: ${r.error.message}`);
|
|
7208
|
+
}
|
|
7209
|
+
}
|
|
7210
|
+
return out;
|
|
7211
|
+
}
|
|
7212
|
+
var init_l4_rescue = __esm({
|
|
7213
|
+
"src/cli/lib/l4-rescue.ts"() {
|
|
7214
|
+
init_installers();
|
|
7215
|
+
init_validate();
|
|
7216
|
+
}
|
|
7217
|
+
});
|
|
7218
|
+
|
|
6963
7219
|
// src/cli/lib/auto-install.ts
|
|
6964
7220
|
var auto_install_exports = {};
|
|
6965
7221
|
__export(auto_install_exports, {
|
|
@@ -7313,7 +7569,7 @@ function renderHumanTable(records) {
|
|
|
7313
7569
|
}
|
|
7314
7570
|
}
|
|
7315
7571
|
function pipeToJq(filterExpr, lines) {
|
|
7316
|
-
return new Promise((
|
|
7572
|
+
return new Promise((resolve17, reject) => {
|
|
7317
7573
|
const child = spawn("jq", [filterExpr], {
|
|
7318
7574
|
stdio: ["pipe", "inherit", "inherit"],
|
|
7319
7575
|
windowsHide: true
|
|
@@ -7322,12 +7578,12 @@ function pipeToJq(filterExpr, lines) {
|
|
|
7322
7578
|
const e = err2;
|
|
7323
7579
|
if (e.code === "ENOENT") {
|
|
7324
7580
|
console.error(t("audit_log.jq_missing"));
|
|
7325
|
-
|
|
7581
|
+
resolve17(1);
|
|
7326
7582
|
} else {
|
|
7327
7583
|
reject(err2);
|
|
7328
7584
|
}
|
|
7329
7585
|
});
|
|
7330
|
-
child.on("close", (code) =>
|
|
7586
|
+
child.on("close", (code) => resolve17(code ?? 0));
|
|
7331
7587
|
child.stdin.write(lines.join("\n"));
|
|
7332
7588
|
child.stdin.end();
|
|
7333
7589
|
});
|
|
@@ -7441,15 +7697,15 @@ async function parsePlan(raw) {
|
|
|
7441
7697
|
} catch {
|
|
7442
7698
|
return null;
|
|
7443
7699
|
}
|
|
7444
|
-
const
|
|
7445
|
-
if (!Array.isArray(
|
|
7700
|
+
const p6 = parsed;
|
|
7701
|
+
if (!Array.isArray(p6.fire) && !Array.isArray(p6.skip)) return null;
|
|
7446
7702
|
const plan = {
|
|
7447
|
-
fire: Array.isArray(
|
|
7448
|
-
skip: Array.isArray(
|
|
7703
|
+
fire: Array.isArray(p6.fire) ? p6.fire : [],
|
|
7704
|
+
skip: Array.isArray(p6.skip) ? p6.skip : []
|
|
7449
7705
|
};
|
|
7450
|
-
if (typeof
|
|
7451
|
-
if (
|
|
7452
|
-
plan.parallelism =
|
|
7706
|
+
if (typeof p6.master === "string") plan.master = p6.master;
|
|
7707
|
+
if (p6.parallelism && typeof p6.parallelism === "object" && !Array.isArray(p6.parallelism)) {
|
|
7708
|
+
plan.parallelism = p6.parallelism;
|
|
7453
7709
|
}
|
|
7454
7710
|
return plan;
|
|
7455
7711
|
}
|
|
@@ -7804,10 +8060,10 @@ async function dirSizeKb(dir) {
|
|
|
7804
8060
|
if (!cur) break;
|
|
7805
8061
|
const entries = await readdir(cur, { withFileTypes: true });
|
|
7806
8062
|
for (const e of entries) {
|
|
7807
|
-
const
|
|
7808
|
-
if (e.isDirectory()) stack.push(
|
|
8063
|
+
const p6 = join(cur, e.name);
|
|
8064
|
+
if (e.isDirectory()) stack.push(p6);
|
|
7809
8065
|
else if (e.isFile()) {
|
|
7810
|
-
const st = await stat(
|
|
8066
|
+
const st = await stat(p6);
|
|
7811
8067
|
total += st.size;
|
|
7812
8068
|
}
|
|
7813
8069
|
}
|
|
@@ -7902,10 +8158,10 @@ function registerInstall(program2) {
|
|
|
7902
8158
|
);
|
|
7903
8159
|
let yamlSrc;
|
|
7904
8160
|
let chosenPath;
|
|
7905
|
-
for (const
|
|
8161
|
+
for (const p6 of candidatePaths) {
|
|
7906
8162
|
try {
|
|
7907
|
-
yamlSrc = await readFile(
|
|
7908
|
-
chosenPath =
|
|
8163
|
+
yamlSrc = await readFile(p6, "utf8");
|
|
8164
|
+
chosenPath = p6;
|
|
7909
8165
|
break;
|
|
7910
8166
|
} catch {
|
|
7911
8167
|
}
|
|
@@ -8995,6 +9251,7 @@ async function renderAllSkills(skillNames, skillsBase, workflowsDir, homedirOver
|
|
|
8995
9251
|
// src/cli/lib/setup-helpers.ts
|
|
8996
9252
|
init_installers();
|
|
8997
9253
|
init_idempotent();
|
|
9254
|
+
init_platform();
|
|
8998
9255
|
init_validate();
|
|
8999
9256
|
init_checkAgentTeams();
|
|
9000
9257
|
var FLAT_LEGACY_KEEP = /* @__PURE__ */ new Set(["research", "retro", "auto"]);
|
|
@@ -9056,6 +9313,7 @@ async function scanWorkflowsNested(workflowsDir, entries) {
|
|
|
9056
9313
|
|
|
9057
9314
|
// src/cli/lib/setup-helpers.ts
|
|
9058
9315
|
async function warnIfAgentTeamsMissing() {
|
|
9316
|
+
if (detectPlatform().id !== "claude") return;
|
|
9059
9317
|
const r = await checkAgentTeams();
|
|
9060
9318
|
if (r.status !== "missing") return;
|
|
9061
9319
|
console.warn("\n\u26A0\uFE0F Agent Teams \u672A\u542F\u7528 \u2014 parallelism-gate \u5347\u7EA7\u8DEF\u5F84\u4E0D\u53EF\u7528");
|
|
@@ -9070,6 +9328,7 @@ async function warnIfAgentTeamsMissing() {
|
|
|
9070
9328
|
async function scanWorkflowsWithSkill(workflowsDir, entries) {
|
|
9071
9329
|
return scanWorkflowsNested(workflowsDir, entries);
|
|
9072
9330
|
}
|
|
9331
|
+
var MCP_METHODS = /* @__PURE__ */ new Set(["mcp-stdio-add", "mcp-http-add"]);
|
|
9073
9332
|
async function runStepBInstall(manifestPaths, runOpts = {}) {
|
|
9074
9333
|
const opts = {
|
|
9075
9334
|
apply: true,
|
|
@@ -9083,49 +9342,79 @@ async function runStepBInstall(manifestPaths, runOpts = {}) {
|
|
|
9083
9342
|
};
|
|
9084
9343
|
const start = Date.now();
|
|
9085
9344
|
const componentTypes = {};
|
|
9086
|
-
const
|
|
9087
|
-
|
|
9088
|
-
|
|
9089
|
-
|
|
9090
|
-
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
|
|
9094
|
-
|
|
9095
|
-
|
|
9096
|
-
|
|
9345
|
+
const total = manifestPaths.length;
|
|
9346
|
+
let done = 0;
|
|
9347
|
+
const emit = (entry) => {
|
|
9348
|
+
done += 1;
|
|
9349
|
+
try {
|
|
9350
|
+
runOpts.onProgress?.({ done, total, name: entry.name, status: entry.status });
|
|
9351
|
+
} catch {
|
|
9352
|
+
}
|
|
9353
|
+
return entry;
|
|
9354
|
+
};
|
|
9355
|
+
const invalid = [];
|
|
9356
|
+
const valid = [];
|
|
9357
|
+
for (const path of manifestPaths) {
|
|
9358
|
+
let yamlSrc;
|
|
9359
|
+
try {
|
|
9360
|
+
yamlSrc = await readFile(path, "utf8");
|
|
9361
|
+
} catch (e) {
|
|
9362
|
+
invalid.push(emit({ status: "failed", name: path, reason: `read: ${e.message}` }));
|
|
9363
|
+
continue;
|
|
9364
|
+
}
|
|
9365
|
+
const v = validateManifestFile(yamlSrc, path);
|
|
9366
|
+
if (!v.ok) {
|
|
9367
|
+
invalid.push(
|
|
9368
|
+
emit({
|
|
9097
9369
|
status: "failed",
|
|
9098
9370
|
name: path,
|
|
9099
9371
|
reason: `validate: ${v.errors[0]?.message ?? "unknown"}`
|
|
9100
|
-
}
|
|
9372
|
+
})
|
|
9373
|
+
);
|
|
9374
|
+
continue;
|
|
9375
|
+
}
|
|
9376
|
+
componentTypes[v.manifest.metadata.name] = v.manifest.spec.component_type;
|
|
9377
|
+
valid.push({ manifest: v.manifest });
|
|
9378
|
+
}
|
|
9379
|
+
const runOne = async (manifest) => {
|
|
9380
|
+
const name = manifest.metadata.name;
|
|
9381
|
+
try {
|
|
9382
|
+
const r = await runInstall(manifest, opts);
|
|
9383
|
+
if ("aborted" in r) {
|
|
9384
|
+
const reason = r.reason === "harness-mismatch" ? `harness-mismatch \u2014 claude-only install method (no ${detectPlatform().id} equivalent)` : r.reason;
|
|
9385
|
+
return emit({ status: "skipped", name, reason });
|
|
9101
9386
|
}
|
|
9102
|
-
const name = v.manifest.metadata.name;
|
|
9103
|
-
componentTypes[name] = v.manifest.spec.component_type;
|
|
9104
|
-
const r = await runInstall(v.manifest, opts);
|
|
9105
|
-
if ("aborted" in r) return { status: "skipped", name, reason: r.reason };
|
|
9106
9387
|
if (r.ok && "alreadyInstalled" in r && r.alreadyInstalled)
|
|
9107
|
-
return { status: "already-installed", name };
|
|
9108
|
-
if (r.ok) return { status: "installed", name };
|
|
9109
|
-
return { status: "failed", name, reason: r.error.message };
|
|
9110
|
-
})
|
|
9388
|
+
return emit({ status: "already-installed", name });
|
|
9389
|
+
if (r.ok) return emit({ status: "installed", name });
|
|
9390
|
+
return emit({ status: "failed", name, reason: r.error.message });
|
|
9391
|
+
} catch (e) {
|
|
9392
|
+
return emit({ status: "failed", name, reason: String(e) });
|
|
9393
|
+
}
|
|
9394
|
+
};
|
|
9395
|
+
const mcp = valid.filter((v) => MCP_METHODS.has(v.manifest.spec.install.method));
|
|
9396
|
+
const rest = valid.filter((v) => !MCP_METHODS.has(v.manifest.spec.install.method));
|
|
9397
|
+
const runMcpSerial = async () => {
|
|
9398
|
+
const out = [];
|
|
9399
|
+
for (const { manifest } of mcp) out.push(await runOne(manifest));
|
|
9400
|
+
return out;
|
|
9401
|
+
};
|
|
9402
|
+
const [mcpEntries, restSettled] = await Promise.all([
|
|
9403
|
+
runMcpSerial(),
|
|
9404
|
+
Promise.allSettled(rest.map(({ manifest }) => runOne(manifest)))
|
|
9405
|
+
]);
|
|
9406
|
+
const restEntries = restSettled.map(
|
|
9407
|
+
(s) => s.status === "fulfilled" ? s.value : { status: "failed", name: "?", reason: String(s.reason) }
|
|
9111
9408
|
);
|
|
9112
9409
|
const installed = [];
|
|
9113
9410
|
const alreadyInstalled = [];
|
|
9114
9411
|
const skipped = [];
|
|
9115
9412
|
const failed = [];
|
|
9116
|
-
for (const
|
|
9117
|
-
const v = s.status === "fulfilled" ? s.value : {
|
|
9118
|
-
status: "failed",
|
|
9119
|
-
name: "?",
|
|
9120
|
-
reason: String(s.reason)
|
|
9121
|
-
};
|
|
9413
|
+
for (const v of [...invalid, ...mcpEntries, ...restEntries]) {
|
|
9122
9414
|
if (v.status === "installed") installed.push(v.name);
|
|
9123
9415
|
else if (v.status === "already-installed") alreadyInstalled.push(v.name);
|
|
9124
|
-
else if (v.status === "skipped") {
|
|
9125
|
-
|
|
9126
|
-
skipped.push({ name: v.name, reason: skipReason });
|
|
9127
|
-
} else
|
|
9128
|
-
failed.push(`${v.name}: ${v.reason}`);
|
|
9416
|
+
else if (v.status === "skipped") skipped.push({ name: v.name, reason: v.reason });
|
|
9417
|
+
else if (v.status === "failed") failed.push(`${v.name}: ${v.reason}`);
|
|
9129
9418
|
}
|
|
9130
9419
|
return {
|
|
9131
9420
|
installed,
|
|
@@ -9258,6 +9547,14 @@ function printGrouped(b, prefix = "") {
|
|
|
9258
9547
|
other: "Other"
|
|
9259
9548
|
};
|
|
9260
9549
|
const GROUP_ORDER = ["mcp-tool", "command", "cli-binary", "other"];
|
|
9550
|
+
const NOTE_MAX = 100;
|
|
9551
|
+
const GLYPHS = {
|
|
9552
|
+
failed: "\u2717",
|
|
9553
|
+
installed: "\u2713",
|
|
9554
|
+
skipped: "\u21B7",
|
|
9555
|
+
"already-installed": "\u25CB",
|
|
9556
|
+
"kept-existing": "\u26A0"
|
|
9557
|
+
};
|
|
9261
9558
|
const groupOf = (n) => b.componentTypes[n] ?? "other";
|
|
9262
9559
|
const buckets = {};
|
|
9263
9560
|
const push = (group, entry) => {
|
|
@@ -9265,27 +9562,29 @@ function printGrouped(b, prefix = "") {
|
|
|
9265
9562
|
buckets[group].push(entry);
|
|
9266
9563
|
};
|
|
9267
9564
|
for (const n of b.failed) {
|
|
9268
|
-
const m = n.match(/^([^:]+)
|
|
9269
|
-
|
|
9270
|
-
push(groupOf(baseName), { status: "failed", name: n });
|
|
9565
|
+
const m = n.match(/^([^:]+):\s*(.*)$/s);
|
|
9566
|
+
push(groupOf(m?.[1] ?? n), { status: "failed", name: m?.[1] ?? n, note: m?.[2] });
|
|
9271
9567
|
}
|
|
9272
9568
|
for (const n of b.installed) push(groupOf(n), { status: "installed", name: n });
|
|
9273
9569
|
for (const s of b.skipped)
|
|
9274
|
-
push(groupOf(s.name), { status: "skipped", name: s.name,
|
|
9570
|
+
push(groupOf(s.name), { status: "skipped", name: s.name, note: s.reason });
|
|
9275
9571
|
for (const n of b.alreadyInstalled) push(groupOf(n), { status: "already-installed", name: n });
|
|
9276
9572
|
for (const n of b.keptExisting ?? [])
|
|
9277
9573
|
push(groupOf(n), {
|
|
9278
9574
|
status: "kept-existing",
|
|
9279
9575
|
name: n,
|
|
9280
|
-
|
|
9576
|
+
note: "refresh failed, prior version retained"
|
|
9281
9577
|
});
|
|
9282
9578
|
for (const g of GROUP_ORDER) {
|
|
9283
9579
|
const entries = buckets[g];
|
|
9284
9580
|
if (!entries || entries.length === 0) continue;
|
|
9285
9581
|
console.log(`
|
|
9286
9582
|
${prefix}${GROUP_LABELS[g] ?? g} (${entries.length})`);
|
|
9583
|
+
const nameW = Math.max(...entries.map((e) => e.name.length), "component".length);
|
|
9584
|
+
console.log(` ${"\u2014".repeat(2 + 18 + 1 + nameW + 2 + 24)}`);
|
|
9287
9585
|
for (const e of entries) {
|
|
9288
|
-
const
|
|
9586
|
+
const note2 = e.note && e.note.length > NOTE_MAX ? `${e.note.slice(0, NOTE_MAX)}\u2026` : e.note;
|
|
9587
|
+
const line = ` ${GLYPHS[e.status] ?? " "} ${e.status.padEnd(18)} ${e.name.padEnd(nameW)}${note2 ? ` ${note2}` : ""}`;
|
|
9289
9588
|
if (e.status === "failed") console.error(line);
|
|
9290
9589
|
else if (e.status === "kept-existing") console.warn(line);
|
|
9291
9590
|
else console.log(line);
|
|
@@ -9383,7 +9682,7 @@ function registerSetup(program2) {
|
|
|
9383
9682
|
capabilitiesMap,
|
|
9384
9683
|
installedPlugins,
|
|
9385
9684
|
installedUserSkills,
|
|
9386
|
-
async (
|
|
9685
|
+
async (p6, c) => writeFile(p6, c, "utf8")
|
|
9387
9686
|
);
|
|
9388
9687
|
const writtenCount = cmdResult.results.filter((r) => r.written).length;
|
|
9389
9688
|
const skippedCount = cmdResult.results.filter((r) => !r.written && r.warning).length;
|
|
@@ -9394,9 +9693,17 @@ function registerSetup(program2) {
|
|
|
9394
9693
|
await enableUserLangInSettings(raw.userLang);
|
|
9395
9694
|
const manifestPaths = await listBaseManifests2(pkgRoot);
|
|
9396
9695
|
const forceFirstPass = raw.updateInstalled === true;
|
|
9696
|
+
const progressPrinter = (ev) => {
|
|
9697
|
+
console.log(` [${ev.done}/${ev.total}] ${ev.status} ${ev.name}`);
|
|
9698
|
+
};
|
|
9699
|
+
console.log(
|
|
9700
|
+
`
|
|
9701
|
+
installing ${manifestPaths.length} upstream components (MCP serialized, rest parallel)...`
|
|
9702
|
+
);
|
|
9397
9703
|
const b = await runStepBInstall(manifestPaths, {
|
|
9398
9704
|
updateInstalled: forceFirstPass,
|
|
9399
|
-
quiet: true
|
|
9705
|
+
quiet: true,
|
|
9706
|
+
onProgress: progressPrinter
|
|
9400
9707
|
});
|
|
9401
9708
|
const stepBMs = (b.elapsedMs / 1e3).toFixed(1);
|
|
9402
9709
|
console.log(
|
|
@@ -9412,13 +9719,17 @@ function registerSetup(program2) {
|
|
|
9412
9719
|
if (!forceFirstPass && !dryRun && raw.nonInteractive !== true && b.alreadyInstalled.length > 0) {
|
|
9413
9720
|
const isTty = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
9414
9721
|
if (isTty) {
|
|
9415
|
-
const { confirm:
|
|
9416
|
-
const ans = await
|
|
9722
|
+
const { confirm: confirm5, isCancel: isCancel6 } = await import('@clack/prompts');
|
|
9723
|
+
const ans = await confirm5({
|
|
9417
9724
|
message: `Update ${b.alreadyInstalled.length} already-installed plugin(s) listed above? (MCP servers excluded \u2014 they ignore force-update)`,
|
|
9418
9725
|
initialValue: false
|
|
9419
9726
|
});
|
|
9420
|
-
if (!
|
|
9421
|
-
const b2 = await runStepBInstall(manifestPaths, {
|
|
9727
|
+
if (!isCancel6(ans) && ans === true) {
|
|
9728
|
+
const b2 = await runStepBInstall(manifestPaths, {
|
|
9729
|
+
updateInstalled: true,
|
|
9730
|
+
quiet: true,
|
|
9731
|
+
onProgress: progressPrinter
|
|
9732
|
+
});
|
|
9422
9733
|
const probe = await makeIdempotentProbe(manifestPaths);
|
|
9423
9734
|
const reclass = await reclassifyForceUpdateFailures(b, b2, probe);
|
|
9424
9735
|
b2.failed = reclass.failed;
|
|
@@ -9438,6 +9749,13 @@ Force-update pass complete: ${b2.installed.length} installed / ${b2.keptExisting
|
|
|
9438
9749
|
}
|
|
9439
9750
|
}
|
|
9440
9751
|
}
|
|
9752
|
+
if (!dryRun && raw.nonInteractive !== true && b.skipped.some((s) => s.reason === "level-flag-missing")) {
|
|
9753
|
+
const isTty = process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
9754
|
+
if (isTty) {
|
|
9755
|
+
const { runL4Rescue: runL4Rescue2 } = await Promise.resolve().then(() => (init_l4_rescue(), l4_rescue_exports));
|
|
9756
|
+
await runL4Rescue2(manifestPaths, b.skipped);
|
|
9757
|
+
}
|
|
9758
|
+
}
|
|
9441
9759
|
console.log(
|
|
9442
9760
|
t("setup.complete", {
|
|
9443
9761
|
skills: skillsInstalled,
|
|
@@ -9445,7 +9763,7 @@ Force-update pass complete: ${b2.installed.length} installed / ${b2.keptExisting
|
|
|
9445
9763
|
})
|
|
9446
9764
|
);
|
|
9447
9765
|
if (b.alreadyInstalled.length > 0 || b.installed.length > 0) {
|
|
9448
|
-
console.log(t("setup.mcp_hint"));
|
|
9766
|
+
console.log(t(detectPlatform().id === "codex" ? "setup.mcp_hint_codex" : "setup.mcp_hint"));
|
|
9449
9767
|
}
|
|
9450
9768
|
console.log(t("setup.bundled_summary"));
|
|
9451
9769
|
console.log(t("setup.bundled_location"));
|
|
@@ -9466,9 +9784,13 @@ Force-update pass complete: ${b2.installed.length} installed / ${b2.keptExisting
|
|
|
9466
9784
|
// src/cli/uninstall.ts
|
|
9467
9785
|
init_i18n();
|
|
9468
9786
|
init_harnessedRoot();
|
|
9787
|
+
init_platform();
|
|
9469
9788
|
init_path_guard();
|
|
9470
9789
|
init_validate();
|
|
9471
9790
|
|
|
9791
|
+
// src/uninstallers/ccHookAdd.ts
|
|
9792
|
+
init_platform();
|
|
9793
|
+
|
|
9472
9794
|
// src/uninstallers/lib/runOrPreview.ts
|
|
9473
9795
|
function dryRunGate(ctx) {
|
|
9474
9796
|
if (ctx.opts.dryRun) return { aborted: true, reason: "dry-run" };
|
|
@@ -9483,7 +9805,7 @@ var uninstallCcHookAdd = async (ctx) => {
|
|
|
9483
9805
|
}
|
|
9484
9806
|
const abort = dryRunGate(ctx);
|
|
9485
9807
|
if (abort) return abort;
|
|
9486
|
-
const settingsPath =
|
|
9808
|
+
const settingsPath = getSettingsPath();
|
|
9487
9809
|
let existing;
|
|
9488
9810
|
try {
|
|
9489
9811
|
existing = await readFile(settingsPath, "utf8");
|
|
@@ -9520,6 +9842,7 @@ var uninstallCcHookAdd = async (ctx) => {
|
|
|
9520
9842
|
};
|
|
9521
9843
|
|
|
9522
9844
|
// src/uninstallers/ccPluginMarketplace.ts
|
|
9845
|
+
init_platform();
|
|
9523
9846
|
init_runClaudeArgs();
|
|
9524
9847
|
function extractPluginAtMkt(cmd) {
|
|
9525
9848
|
const m = cmd.match(/(?:\/?plugin)\s+install\s+(\S+)/i);
|
|
@@ -9534,6 +9857,13 @@ var uninstallCcPluginMarketplace = async (ctx) => {
|
|
|
9534
9857
|
}
|
|
9535
9858
|
const abort = dryRunGate(ctx);
|
|
9536
9859
|
if (abort) return abort;
|
|
9860
|
+
if (detectPlatform().id !== "claude") {
|
|
9861
|
+
return {
|
|
9862
|
+
ok: false,
|
|
9863
|
+
phase: "preflight",
|
|
9864
|
+
error: "cc-plugin-marketplace uninstall is claude-only; on codex remove the plugin with `codex plugin remove <plugin>@<marketplace>`"
|
|
9865
|
+
};
|
|
9866
|
+
}
|
|
9537
9867
|
const pluginAtMkt = extractPluginAtMkt(install.cmd);
|
|
9538
9868
|
if (!pluginAtMkt) {
|
|
9539
9869
|
return {
|
|
@@ -9598,6 +9928,7 @@ var uninstallGitCloneWithSetup = async (ctx) => {
|
|
|
9598
9928
|
};
|
|
9599
9929
|
|
|
9600
9930
|
// src/uninstallers/mcpHttpAdd.ts
|
|
9931
|
+
init_platform();
|
|
9601
9932
|
init_runClaudeArgs();
|
|
9602
9933
|
var uninstallMcpHttpAdd = async (ctx) => {
|
|
9603
9934
|
const install = ctx.manifest.spec.install;
|
|
@@ -9606,19 +9937,21 @@ var uninstallMcpHttpAdd = async (ctx) => {
|
|
|
9606
9937
|
}
|
|
9607
9938
|
const abort = dryRunGate(ctx);
|
|
9608
9939
|
if (abort) return abort;
|
|
9940
|
+
const bin = detectPlatform().id === "codex" ? "codex" : "claude";
|
|
9609
9941
|
const name = ctx.manifest.metadata.name;
|
|
9610
|
-
const r = await
|
|
9942
|
+
const r = await runHarnessArgs(bin, ["mcp", "remove", name], ctx.cwd);
|
|
9611
9943
|
if (r.exitCode !== 0) {
|
|
9612
9944
|
return {
|
|
9613
9945
|
ok: false,
|
|
9614
9946
|
phase: "spawn",
|
|
9615
|
-
error:
|
|
9947
|
+
error: `${bin} mcp remove exited ${r.exitCode}: ${r.stderr.slice(0, 200)}`
|
|
9616
9948
|
};
|
|
9617
9949
|
}
|
|
9618
9950
|
return { ok: true, removedPaths: [name] };
|
|
9619
9951
|
};
|
|
9620
9952
|
|
|
9621
9953
|
// src/uninstallers/mcpStdioAdd.ts
|
|
9954
|
+
init_platform();
|
|
9622
9955
|
init_runClaudeArgs();
|
|
9623
9956
|
var uninstallMcpStdioAdd = async (ctx) => {
|
|
9624
9957
|
const install = ctx.manifest.spec.install;
|
|
@@ -9627,13 +9960,14 @@ var uninstallMcpStdioAdd = async (ctx) => {
|
|
|
9627
9960
|
}
|
|
9628
9961
|
const abort = dryRunGate(ctx);
|
|
9629
9962
|
if (abort) return abort;
|
|
9963
|
+
const bin = detectPlatform().id === "codex" ? "codex" : "claude";
|
|
9630
9964
|
const name = ctx.manifest.metadata.name;
|
|
9631
|
-
const r = await
|
|
9965
|
+
const r = await runHarnessArgs(bin, ["mcp", "remove", name], ctx.cwd);
|
|
9632
9966
|
if (r.exitCode !== 0) {
|
|
9633
9967
|
return {
|
|
9634
9968
|
ok: false,
|
|
9635
9969
|
phase: "spawn",
|
|
9636
|
-
error:
|
|
9970
|
+
error: `${bin} mcp remove exited ${r.exitCode}: ${r.stderr.slice(0, 200)}`
|
|
9637
9971
|
};
|
|
9638
9972
|
}
|
|
9639
9973
|
return { ok: true, removedPaths: [name] };
|
|
@@ -9655,7 +9989,7 @@ var uninstallNpmCli = async (ctx) => {
|
|
|
9655
9989
|
const m = install.cmd.match(/npm\s+(?:install|i)\s+(?:-g\s+)?(\S+)/);
|
|
9656
9990
|
const pkg = m?.[1] ?? ctx.manifest.metadata.upstream.source;
|
|
9657
9991
|
const isWin = process.platform === "win32";
|
|
9658
|
-
const result = await new Promise((
|
|
9992
|
+
const result = await new Promise((resolve17) => {
|
|
9659
9993
|
const child = isWin ? spawn("cmd.exe", ["/c", "npm", "uninstall", "-g", pkg], { windowsHide: true }) : spawn("npm", ["uninstall", "-g", pkg], { shell: false });
|
|
9660
9994
|
let stderr = "";
|
|
9661
9995
|
child.stderr?.setEncoding("utf8").on("data", (c) => {
|
|
@@ -9663,15 +9997,15 @@ var uninstallNpmCli = async (ctx) => {
|
|
|
9663
9997
|
});
|
|
9664
9998
|
const timer = setTimeout(() => {
|
|
9665
9999
|
child.kill("SIGKILL");
|
|
9666
|
-
|
|
10000
|
+
resolve17({ exitCode: -1, stderr: `${stderr}[timeout]` });
|
|
9667
10001
|
}, 3e4);
|
|
9668
10002
|
child.on("error", (e) => {
|
|
9669
10003
|
clearTimeout(timer);
|
|
9670
|
-
|
|
10004
|
+
resolve17({ exitCode: -1, stderr: e.message });
|
|
9671
10005
|
});
|
|
9672
10006
|
child.on("close", (code) => {
|
|
9673
10007
|
clearTimeout(timer);
|
|
9674
|
-
|
|
10008
|
+
resolve17({ exitCode: code ?? -1, stderr });
|
|
9675
10009
|
});
|
|
9676
10010
|
});
|
|
9677
10011
|
if (result.exitCode !== 0) {
|
|
@@ -9686,6 +10020,7 @@ var uninstallNpmCli = async (ctx) => {
|
|
|
9686
10020
|
|
|
9687
10021
|
// src/uninstallers/npxSkillInstaller.ts
|
|
9688
10022
|
init_idempotent();
|
|
10023
|
+
init_platform();
|
|
9689
10024
|
var uninstallNpxSkillInstaller = async (ctx) => {
|
|
9690
10025
|
const install = ctx.manifest.spec.install;
|
|
9691
10026
|
if (install.method !== "npx-skill-installer") {
|
|
@@ -9695,7 +10030,7 @@ var uninstallNpxSkillInstaller = async (ctx) => {
|
|
|
9695
10030
|
if (abort) return abort;
|
|
9696
10031
|
const name = ctx.manifest.metadata.name;
|
|
9697
10032
|
const skillName = extractSkillName(install.cmd, name);
|
|
9698
|
-
const skillDir = join(
|
|
10033
|
+
const skillDir = join(getSkillsDir(), skillName);
|
|
9699
10034
|
await rm(skillDir, { recursive: true, force: true, maxRetries: 3 });
|
|
9700
10035
|
return { ok: true, removedPaths: [skillDir] };
|
|
9701
10036
|
};
|
|
@@ -9728,10 +10063,10 @@ async function discoverCommandFiles(commandsDir) {
|
|
|
9728
10063
|
}
|
|
9729
10064
|
for (const entry of entries) {
|
|
9730
10065
|
if (!entry.endsWith(".md")) continue;
|
|
9731
|
-
const
|
|
10066
|
+
const p6 = join(commandsDir, entry);
|
|
9732
10067
|
try {
|
|
9733
|
-
const content = await readFile(
|
|
9734
|
-
if (shouldOverwriteFile(content)) owned.push(
|
|
10068
|
+
const content = await readFile(p6, "utf8");
|
|
10069
|
+
if (shouldOverwriteFile(content)) owned.push(p6);
|
|
9735
10070
|
} catch {
|
|
9736
10071
|
}
|
|
9737
10072
|
}
|
|
@@ -9771,9 +10106,10 @@ async function removeSettingsEnv(settingsPath) {
|
|
|
9771
10106
|
return true;
|
|
9772
10107
|
}
|
|
9773
10108
|
async function runUnifiedUninstall(home, dryRun) {
|
|
9774
|
-
const
|
|
9775
|
-
const
|
|
9776
|
-
const
|
|
10109
|
+
const platform = detectPlatform(home);
|
|
10110
|
+
const commandsDir = platform.commandsDir;
|
|
10111
|
+
const skillsDir = platform.skillsDir;
|
|
10112
|
+
const settingsPath = platform.settingsPath;
|
|
9777
10113
|
const harnessedRoot = getHarnessedRoot();
|
|
9778
10114
|
const pkgRoot = getPackageRoot();
|
|
9779
10115
|
let workflowNames = [];
|
|
@@ -9848,9 +10184,9 @@ async function runUnifiedUninstall(home, dryRun) {
|
|
|
9848
10184
|
}
|
|
9849
10185
|
}
|
|
9850
10186
|
const normalizedRoot = resolve(harnessedRoot);
|
|
9851
|
-
const
|
|
9852
|
-
if (!normalizedRoot.startsWith(resolve(
|
|
9853
|
-
console.error(`error: state dir ${harnessedRoot} is not under ${
|
|
10187
|
+
const platformHome = platform.homeDir;
|
|
10188
|
+
if (!normalizedRoot.startsWith(resolve(platformHome) + sep)) {
|
|
10189
|
+
console.error(`error: state dir ${harnessedRoot} is not under ${platformHome} \u2014 refusing`);
|
|
9854
10190
|
process.exit(1);
|
|
9855
10191
|
}
|
|
9856
10192
|
let removedStateDir = false;
|
|
@@ -9952,9 +10288,9 @@ function npmExecutable2() {
|
|
|
9952
10288
|
}
|
|
9953
10289
|
function changelogTop() {
|
|
9954
10290
|
try {
|
|
9955
|
-
const
|
|
9956
|
-
if (!existsSync(
|
|
9957
|
-
const body = readFileSync(
|
|
10291
|
+
const p6 = join(getPackageRoot(), "CHANGELOG.md");
|
|
10292
|
+
if (!existsSync(p6)) return null;
|
|
10293
|
+
const body = readFileSync(p6, "utf8");
|
|
9958
10294
|
const start = body.indexOf("\n## ");
|
|
9959
10295
|
if (start < 0) return null;
|
|
9960
10296
|
const rest = body.slice(start + 1);
|