harnessed 4.11.0 → 4.11.2

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
@@ -9,7 +9,7 @@ import lockfile from 'proper-lockfile';
9
9
  import { parse, LineCounter, parseDocument, isSeq, isScalar } from 'yaml';
10
10
  import { Ajv } from 'ajv';
11
11
  import * as ajvFormatsNs from 'ajv-formats';
12
- import { execFileSync, spawnSync, spawn, exec, execFile, execSync } from 'child_process';
12
+ import { execFileSync, spawnSync, spawn, exec, execSync, execFile } from 'child_process';
13
13
  import { fileURLToPath } from 'url';
14
14
  import { createHash } from 'crypto';
15
15
  import { Parser } from 'expr-eval';
@@ -38,7 +38,7 @@ var init_package = __esm({
38
38
  "package.json"() {
39
39
  package_default = {
40
40
  name: "harnessed",
41
- version: "4.11.0",
41
+ version: "4.11.2",
42
42
  description: "AI coding harness package manager + composition orchestrator",
43
43
  type: "module",
44
44
  license: "Apache-2.0",
@@ -337,18 +337,41 @@ var init_schemaVersion = __esm({
337
337
  ]);
338
338
  }
339
339
  });
340
+ function tmpName(path) {
341
+ return `${path}.${process.pid}.${++tmpSeq}.tmp`;
342
+ }
340
343
  async function writeFileAtomic(path, data) {
341
- const tmp = `${path}.tmp`;
344
+ const tmp = tmpName(path);
342
345
  await writeFile(tmp, data, "utf8");
343
- await rename(tmp, path);
346
+ for (let i = 0; ; i++) {
347
+ try {
348
+ await rename(tmp, path);
349
+ return;
350
+ } catch (e) {
351
+ if (i >= RENAME_RETRIES || !isTransient(e)) throw e;
352
+ await new Promise((r) => setTimeout(r, 10 * (i + 1)));
353
+ }
354
+ }
344
355
  }
345
356
  function writeFileSyncAtomic(path, data) {
346
- const tmp = `${path}.tmp`;
357
+ const tmp = tmpName(path);
347
358
  writeFileSync(tmp, data, "utf8");
348
- renameSync(tmp, path);
359
+ for (let i = 0; ; i++) {
360
+ try {
361
+ renameSync(tmp, path);
362
+ return;
363
+ } catch (e) {
364
+ if (i >= RENAME_RETRIES || !isTransient(e)) throw e;
365
+ }
366
+ }
349
367
  }
368
+ var tmpSeq, TRANSIENT_RENAME, RENAME_RETRIES, isTransient;
350
369
  var init_atomicWrite = __esm({
351
370
  "src/checkpoint/atomicWrite.ts"() {
371
+ tmpSeq = 0;
372
+ TRANSIENT_RENAME = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY", "ENOENT"]);
373
+ RENAME_RETRIES = 10;
374
+ isTransient = (e) => TRANSIENT_RENAME.has(e?.code ?? "");
352
375
  }
353
376
  });
354
377
  var CheckpointStatus, CheckpointV1;
@@ -6437,7 +6460,7 @@ var init_npxSkillInstaller2 = __esm({
6437
6460
  if (await isAlreadyInstalled(ctx)) {
6438
6461
  return { ok: true, alreadyInstalled: true, backupId: "noop-idempotent" };
6439
6462
  }
6440
- if (!/\B--copy\b/.test(install.cmd) || !/\B--global\b/.test(install.cmd)) {
6463
+ if (!/\B--copy\b/.test(install.cmd)) {
6441
6464
  return {
6442
6465
  ok: false,
6443
6466
  phase: "preflight",
@@ -6445,10 +6468,10 @@ var init_npxSkillInstaller2 = __esm({
6445
6468
  ...err(
6446
6469
  ctx,
6447
6470
  "/spec/install/cmd",
6448
- `npx-skill-installer cmd must include both \`--copy\` and \`--global\` flags (D2.1-5)`,
6471
+ `npx-skill-installer cmd must include the \`--copy\` flag (D2.1-5)`,
6449
6472
  "skills-flags-required"
6450
6473
  ),
6451
- suggest: "`--copy` materializes files (Windows symlink-safe); `--global` targets ~/.claude/skills/ (user scope)"
6474
+ suggest: "`--copy` materializes files into ~/.claude/skills/ (Windows symlink-safe); `--global` is optional and unsupported by some skill types (e.g. PromptScript)"
6452
6475
  }
6453
6476
  };
6454
6477
  }
@@ -9167,6 +9190,30 @@ async function makeIdempotentProbe(manifestPaths) {
9167
9190
  };
9168
9191
  }
9169
9192
 
9193
+ // src/cli/lib/version-banner.ts
9194
+ init_package();
9195
+ init_version_check();
9196
+ function versionBannerLines(installed, latest) {
9197
+ const lines = [`harnessed setup v${installed}`];
9198
+ if (latest === null) {
9199
+ lines.push(" could not check latest version");
9200
+ return lines;
9201
+ }
9202
+ const cmp = compareVersions(installed, latest);
9203
+ if (cmp === "behind") {
9204
+ lines.push(`\u26A0 update available: ${installed} \u2192 ${latest} \u2014 npm install -g harnessed@latest`);
9205
+ } else if (cmp === "current") {
9206
+ lines.push(`\u2713 latest (v${latest})`);
9207
+ } else if (cmp === "ahead") {
9208
+ lines.push(`\u2713 latest (v${installed})`);
9209
+ }
9210
+ return lines;
9211
+ }
9212
+ async function printSetupVersionBanner() {
9213
+ const latest = await fetchLatestVersion();
9214
+ for (const line of versionBannerLines(package_default.version, latest)) console.log(line);
9215
+ }
9216
+
9170
9217
  // src/cli/setup.ts
9171
9218
  var KNOWN_PLATFORMS = ["claude", "codex"];
9172
9219
  async function applyPlatformOption(platform) {
@@ -9248,6 +9295,7 @@ function registerSetup(program2) {
9248
9295
  "--update-installed",
9249
9296
  "force re-install already-installed plugins (excludes MCP servers); default: skip if installed"
9250
9297
  ).action(async (raw) => {
9298
+ await printSetupVersionBanner();
9251
9299
  const dryRun = raw.dryRun === true;
9252
9300
  if (raw.platform !== void 0) await applyPlatformOption(raw.platform);
9253
9301
  const pkgRoot = getPackageRoot();