harnessed 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.mjs CHANGED
@@ -670,7 +670,7 @@ var init_resume = __esm({
670
670
 
671
671
  // package.json
672
672
  var package_default = {
673
- version: "1.0.2"};
673
+ version: "1.0.4"};
674
674
 
675
675
  // src/manifest/errors.ts
676
676
  function instancePathToKeyPath(instancePath) {
@@ -3489,6 +3489,9 @@ ${newEntry}
3489
3489
  if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
3490
3490
  const r = await runArgs(addArgs, install.cwd ?? ctx.cwd);
3491
3491
  if (r.exitCode !== 0) {
3492
+ if (r.stderr.includes("already exists in .mcp.json")) {
3493
+ return { ok: true, alreadyInstalled: true, backupId: bk.backupId };
3494
+ }
3492
3495
  return {
3493
3496
  ok: false,
3494
3497
  phase: "spawn",
@@ -3634,6 +3637,9 @@ ${newEntry}
3634
3637
  if (!bk.ok) return { ok: false, phase: "preflight", error: bk.error };
3635
3638
  const r = await runArgs(addArgs, install.cwd ?? ctx.cwd);
3636
3639
  if (r.exitCode !== 0) {
3640
+ if (r.stderr.includes("already exists in .mcp.json")) {
3641
+ return { ok: true, alreadyInstalled: true, backupId: bk.backupId };
3642
+ }
3637
3643
  return {
3638
3644
  ok: false,
3639
3645
  phase: "spawn",
@@ -4068,6 +4074,7 @@ function registerInstallBase(program2) {
4068
4074
  color: "auto"
4069
4075
  };
4070
4076
  const installed = [];
4077
+ const alreadyInstalled = [];
4071
4078
  const skipped = [];
4072
4079
  const failed = [];
4073
4080
  for (const path of await listBaseManifests(getPackageRoot())) {
@@ -4091,18 +4098,21 @@ function registerInstallBase(program2) {
4091
4098
  }
4092
4099
  const r = await runInstall(v.manifest, opts);
4093
4100
  if ("aborted" in r) skipped.push({ name, reason: `aborted: ${r.reason}` });
4101
+ else if (r.ok && "alreadyInstalled" in r && r.alreadyInstalled) alreadyInstalled.push(name);
4094
4102
  else if (r.ok) installed.push(name);
4095
4103
  else failed.push({ name, reason: r.error.message });
4096
4104
  }
4097
4105
  console.log(
4098
4106
  `
4099
- installed: ${installed.length} / skipped (deferred phase 2.1): ${skipped.length} / failed: ${failed.length}`
4107
+ installed: ${installed.length} / already-installed: ${alreadyInstalled.length} / skipped (deferred phase 2.1): ${skipped.length} / failed: ${failed.length}`
4100
4108
  );
4101
- for (const i of installed) console.log(` installed ${i}`);
4102
- for (const s of skipped) console.log(` skipped ${s.name} \u2014 ${s.reason}`);
4103
- for (const f of failed) console.error(` failed ${f.name} \u2014 ${f.reason}`);
4109
+ for (const i of installed) console.log(` installed ${i}`);
4110
+ for (const a of alreadyInstalled)
4111
+ console.log(` already-installed ${a} \u2014 run \`/mcp\` in Claude Code to verify connection`);
4112
+ for (const s of skipped) console.log(` skipped ${s.name} \u2014 ${s.reason}`);
4113
+ for (const f of failed) console.error(` failed ${f.name} \u2014 ${f.reason}`);
4104
4114
  if (failed.length > 0) process.exit(1);
4105
- if (installed.length === 0) process.exit(2);
4115
+ if (installed.length === 0 && alreadyInstalled.length === 0) process.exit(2);
4106
4116
  process.exit(0);
4107
4117
  });
4108
4118
  }
@@ -4370,43 +4380,80 @@ Step A complete: ${skillsInstalled} workflow skill(s) installed to ${skillsBase}
4370
4380
  fullDiff: false,
4371
4381
  color: "auto"
4372
4382
  };
4383
+ const manifestPaths = await listBaseManifests2(pkgRoot);
4384
+ const stepBStart = Date.now();
4385
+ const settled = await Promise.allSettled(
4386
+ manifestPaths.map(async (path) => {
4387
+ let yamlSrc;
4388
+ try {
4389
+ yamlSrc = await readFile(path, "utf8");
4390
+ } catch (e) {
4391
+ return {
4392
+ status: "failed",
4393
+ name: path,
4394
+ reason: `read: ${e.message}`
4395
+ };
4396
+ }
4397
+ const v = validateManifestFile(yamlSrc, path);
4398
+ if (!v.ok) {
4399
+ return {
4400
+ status: "failed",
4401
+ name: path,
4402
+ reason: `validate: ${v.errors[0]?.message ?? "unknown"}`
4403
+ };
4404
+ }
4405
+ const name = v.manifest.metadata.name;
4406
+ const method = v.manifest.spec.install.method;
4407
+ if (PHASE_212.has(method)) {
4408
+ return { status: "skipped", name };
4409
+ }
4410
+ const r = await runInstall(v.manifest, opts);
4411
+ if ("aborted" in r) return { status: "skipped", name };
4412
+ if (r.ok && "alreadyInstalled" in r && r.alreadyInstalled)
4413
+ return { status: "already-installed", name };
4414
+ if (r.ok) return { status: "installed", name };
4415
+ return { status: "failed", name, reason: r.error.message };
4416
+ })
4417
+ );
4373
4418
  const baseInstalled = [];
4419
+ const baseAlreadyInstalled = [];
4374
4420
  const baseSkipped = [];
4375
4421
  const baseFailed = [];
4376
- for (const path of await listBaseManifests2(pkgRoot)) {
4377
- let yamlSrc;
4378
- try {
4379
- yamlSrc = await readFile(path, "utf8");
4380
- } catch (e) {
4381
- baseFailed.push(`${path}: read: ${e.message}`);
4382
- continue;
4383
- }
4384
- const v = validateManifestFile(yamlSrc, path);
4385
- if (!v.ok) {
4386
- baseFailed.push(`${path}: validate: ${v.errors[0]?.message ?? "unknown"}`);
4387
- continue;
4388
- }
4389
- const name = v.manifest.metadata.name;
4390
- const method = v.manifest.spec.install.method;
4391
- if (PHASE_212.has(method)) {
4392
- baseSkipped.push(name);
4393
- continue;
4394
- }
4395
- const r = await runInstall(v.manifest, opts);
4396
- if ("aborted" in r) baseSkipped.push(name);
4397
- else if (r.ok) baseInstalled.push(name);
4398
- else baseFailed.push(`${name}: ${r.error.message}`);
4422
+ for (const s of settled) {
4423
+ const v = s.status === "fulfilled" ? s.value : {
4424
+ status: "failed",
4425
+ name: "?",
4426
+ reason: String(s.reason)
4427
+ };
4428
+ if (v.status === "installed") baseInstalled.push(v.name);
4429
+ else if (v.status === "already-installed") baseAlreadyInstalled.push(v.name);
4430
+ else if (v.status === "skipped") baseSkipped.push(v.name);
4431
+ else
4432
+ baseFailed.push(
4433
+ `${v.name}: ${v.reason}`
4434
+ );
4399
4435
  }
4436
+ const stepBMs = ((Date.now() - stepBStart) / 1e3).toFixed(1);
4400
4437
  console.log(
4401
- `Step B complete: ${baseInstalled.length} manifest(s) installed / ${baseSkipped.length} skipped / ${baseFailed.length} failed`
4438
+ `Step B complete: ${baseInstalled.length} manifest(s) installed / ${baseAlreadyInstalled.length} already-installed / ${baseSkipped.length} skipped / ${baseFailed.length} failed [parallel ${stepBMs}s]`
4402
4439
  );
4403
- for (const n of baseInstalled) console.log(` [B] installed ${n}`);
4404
- for (const n of baseSkipped) console.log(` [B] skipped ${n}`);
4405
- for (const n of baseFailed) console.error(` [B] failed ${n}`);
4440
+ for (const n of baseInstalled) console.log(` [B] installed ${n}`);
4441
+ for (const n of baseAlreadyInstalled)
4442
+ console.log(
4443
+ ` [B] already-installed ${n} \u2014 run \`/mcp\` in Claude Code to verify connection`
4444
+ );
4445
+ for (const n of baseSkipped) console.log(` [B] skipped ${n}`);
4446
+ for (const n of baseFailed) console.error(` [B] failed ${n}`);
4406
4447
  console.log(
4407
4448
  `
4408
- setup complete: ${skillsInstalled} workflow skill(s) + ${baseInstalled.length} base manifest(s) installed`
4449
+ setup complete: ${skillsInstalled} workflow skill(s) + ${baseInstalled.length + baseAlreadyInstalled.length} base manifest(s) configured`
4409
4450
  );
4451
+ if (baseAlreadyInstalled.length > 0 || baseInstalled.length > 0) {
4452
+ console.log(
4453
+ `
4454
+ MCP servers configured. Run \`/mcp\` in Claude Code to verify each server's connection status. If a server shows disconnected, restart Claude Code or check the MCP command spec.`
4455
+ );
4456
+ }
4410
4457
  process.exit(0);
4411
4458
  });
4412
4459
  }