@uzysjung/agent-harness 26.134.0 → 26.135.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/dist/index.js CHANGED
@@ -712,7 +712,7 @@ var cac = (name = "") => new CAC(name);
712
712
  // package.json
713
713
  var package_default = {
714
714
  name: "@uzysjung/agent-harness",
715
- version: "26.134.0",
715
+ version: "26.135.0",
716
716
  description: "Curate vetted AI-coding skills & plugins by your tech stack \u2014 install only what you need, across Claude Code, Codex, OpenCode & Antigravity",
717
717
  type: "module",
718
718
  publishConfig: {
@@ -753,10 +753,10 @@ var package_default = {
753
753
  devDependencies: {
754
754
  "@biomejs/biome": "^2.4.13",
755
755
  "@types/node": "^25.6.0",
756
- "@vitest/coverage-v8": "^2.1.0",
756
+ "@vitest/coverage-v8": "^4.1.10",
757
757
  tsup: "^8.3.0",
758
758
  typescript: "^5.6.0",
759
- vitest: "^2.1.0"
759
+ vitest: "^4.1.10"
760
760
  },
761
761
  license: "MIT",
762
762
  repository: {
@@ -1101,9 +1101,11 @@ import { dirname as dirname3, relative, sep } from "path";
1101
1101
  // src/install-log.ts
1102
1102
  init_esm_shims();
1103
1103
  import { createHash } from "crypto";
1104
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
1104
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, rmSync, writeFileSync } from "fs";
1105
1105
  import { dirname as dirname2, join as join3 } from "path";
1106
1106
  var INSTALL_LOG_FILENAME = ".harness-install.json";
1107
+ var INSTALL_LOG_DIR = ".uzys-agent-harness";
1108
+ var LEGACY_INSTALL_LOG_DIR = ".claude";
1107
1109
  var INSTALL_LOG_VERSION = 1;
1108
1110
  var POLICY_DIRS = [
1109
1111
  { dir: "rules", ext: ".md" },
@@ -1251,15 +1253,26 @@ function collectPolicyHashes(projectDir, templatesDir) {
1251
1253
  return out;
1252
1254
  }
1253
1255
  function writeInstallLog(projectDir, log) {
1254
- const path = join3(projectDir, ".claude", INSTALL_LOG_FILENAME);
1256
+ const path = installLogPath(projectDir);
1255
1257
  mkdirSync2(dirname2(path), { recursive: true });
1256
1258
  writeFileSync(path, `${JSON.stringify(log, null, 2)}
1257
1259
  `, "utf8");
1260
+ migrateAwayLegacyLog(projectDir);
1258
1261
  return path;
1259
1262
  }
1263
+ function migrateAwayLegacyLog(projectDir) {
1264
+ const legacy = legacyInstallLogPath(projectDir);
1265
+ if (!existsSync3(legacy)) return;
1266
+ try {
1267
+ rmSync(legacy);
1268
+ } catch {
1269
+ }
1270
+ }
1260
1271
  function readInstallLog(projectDir) {
1261
- const path = join3(projectDir, ".claude", INSTALL_LOG_FILENAME);
1262
- if (!existsSync3(path)) return null;
1272
+ const path = [installLogPath(projectDir), legacyInstallLogPath(projectDir)].find(
1273
+ (p2) => existsSync3(p2)
1274
+ );
1275
+ if (!path) return null;
1263
1276
  try {
1264
1277
  const parsed = JSON.parse(readFileSync2(path, "utf8"));
1265
1278
  if (Array.isArray(parsed.assets)) {
@@ -1273,7 +1286,10 @@ function readInstallLog(projectDir) {
1273
1286
  }
1274
1287
  }
1275
1288
  function installLogPath(projectDir) {
1276
- return join3(projectDir, ".claude", INSTALL_LOG_FILENAME);
1289
+ return join3(projectDir, INSTALL_LOG_DIR, INSTALL_LOG_FILENAME);
1290
+ }
1291
+ function legacyInstallLogPath(projectDir) {
1292
+ return join3(projectDir, LEGACY_INSTALL_LOG_DIR, INSTALL_LOG_FILENAME);
1277
1293
  }
1278
1294
 
1279
1295
  // src/owned-write.ts
@@ -3720,7 +3736,7 @@ function registerListCommand(cli2) {
3720
3736
  // src/commands/uninstall.ts
3721
3737
  init_esm_shims();
3722
3738
  import { spawnSync as spawnSync2 } from "child_process";
3723
- import { existsSync as existsSync15, readFileSync as readFileSync14, rmSync } from "fs";
3739
+ import { existsSync as existsSync15, readFileSync as readFileSync14, rmSync as rmSync2 } from "fs";
3724
3740
  import { join as join13, resolve as resolve4 } from "path";
3725
3741
 
3726
3742
  // src/uninstall-interactive.ts
@@ -4873,7 +4889,7 @@ function uninstallAction(options, deps = {}) {
4873
4889
  }
4874
4890
  }
4875
4891
  const logWriteFailed = settleLog(
4876
- { installLog, projectDir, selectedIds, keepTemplates, removedIds },
4892
+ { installLog, projectDir, selectedIds, removedIds },
4877
4893
  { log, err, rm, writeLog }
4878
4894
  );
4879
4895
  for (const line of advisoryLines(plan, targetAssets, projectDir, keepTemplates, rootFiles)) {
@@ -4948,7 +4964,7 @@ function executeReverse(plan, log, logSurvives) {
4948
4964
  return { succeeded, failed, removedIds };
4949
4965
  }
4950
4966
  function settleLog(ctx, io) {
4951
- const { installLog, projectDir, selectedIds, keepTemplates, removedIds } = ctx;
4967
+ const { installLog, projectDir, selectedIds, removedIds } = ctx;
4952
4968
  if (selectedIds) {
4953
4969
  const remaining = installLog.assets.filter((a) => !removedIds.includes(a.id));
4954
4970
  try {
@@ -4960,9 +4976,10 @@ function settleLog(ctx, io) {
4960
4976
  io.err(c.dim(` \uC2E4\uC81C\uB85C \uC81C\uAC70\uB41C \uC790\uC0B0: ${removedIds.join(", ") || "(\uC5C6\uC74C)"}`));
4961
4977
  return true;
4962
4978
  }
4963
- } else if (keepTemplates) {
4964
- io.rm(installLogPath(projectDir));
4965
- io.log(` ${status.success("install log removed (templates kept)")}`);
4979
+ } else {
4980
+ io.rm(join13(projectDir, INSTALL_LOG_DIR));
4981
+ io.rm(legacyInstallLogPath(projectDir));
4982
+ io.log(` ${status.success("install log removed")}`);
4966
4983
  }
4967
4984
  return false;
4968
4985
  }
@@ -5164,7 +5181,7 @@ function defaultSpawn2(cmd, args) {
5164
5181
  }
5165
5182
  function defaultRm(path) {
5166
5183
  if (existsSync15(path)) {
5167
- rmSync(path, { recursive: true, force: true });
5184
+ rmSync2(path, { recursive: true, force: true });
5168
5185
  }
5169
5186
  }
5170
5187
  function registerUninstallCommand(cli2) {
@@ -5224,16 +5241,28 @@ var LEGACY_SIGNATURES = [
5224
5241
  function detectInstallState(projectDir) {
5225
5242
  const claudeDir = join14(projectDir, ".claude");
5226
5243
  const hasClaudeDir = existsSync16(claudeDir);
5227
- if (!hasClaudeDir) {
5228
- return { state: "new", tracks: [], source: "none", hasClaudeDir: false };
5244
+ if (hasClaudeDir) {
5245
+ const metaPath = join14(projectDir, META_FILE);
5246
+ if (existsSync16(metaPath)) {
5247
+ const tracks2 = readMetafile(metaPath);
5248
+ return { state: "existing", tracks: tracks2, source: "metafile", hasClaudeDir: true };
5249
+ }
5250
+ const tracks = inferFromLegacySignatures(projectDir);
5251
+ return { state: "existing", tracks, source: "legacy", hasClaudeDir: true };
5229
5252
  }
5230
- const metaPath = join14(projectDir, META_FILE);
5231
- if (existsSync16(metaPath)) {
5232
- const tracks2 = readMetafile(metaPath);
5233
- return { state: "existing", tracks: tracks2, source: "metafile", hasClaudeDir: true };
5253
+ const log = readInstallLog(projectDir);
5254
+ if (log) {
5255
+ return {
5256
+ state: "existing",
5257
+ tracks: tracksFromLog(log.spec.tracks),
5258
+ source: "install-log",
5259
+ hasClaudeDir: false
5260
+ };
5234
5261
  }
5235
- const tracks = inferFromLegacySignatures(projectDir);
5236
- return { state: "existing", tracks, source: "legacy", hasClaudeDir: true };
5262
+ return { state: "new", tracks: [], source: "none", hasClaudeDir: false };
5263
+ }
5264
+ function tracksFromLog(tracks) {
5265
+ return [...new Set(tracks.filter(isTrack))].sort();
5237
5266
  }
5238
5267
  function readMetafile(path) {
5239
5268
  const raw = readFileSync15(path, "utf8");
@@ -5269,13 +5298,13 @@ function updateAction(options = {}, deps = {}) {
5269
5298
  const execute = deps.execute ?? executeSpec;
5270
5299
  const projectDir = resolve5(options.projectDir ?? process.cwd());
5271
5300
  const state = detect(projectDir);
5272
- if (!state.hasClaudeDir) {
5273
- err(status.failure(c.red(`No harness install found at ${projectDir}/.claude`)));
5301
+ if (state.state === "new") {
5302
+ err(status.failure(c.red(`No harness install found at ${projectDir}`)));
5274
5303
  err(c.dim(" Run `agent-harness install --track <name>` first."));
5275
5304
  exit(1);
5276
5305
  return;
5277
5306
  }
5278
- log(c.dim(`Updating policy files in ${projectDir}/.claude`));
5307
+ log(c.dim(`Updating installed harness files in ${projectDir}`));
5279
5308
  execute(buildUpdateSpec(projectDir, state.tracks), { log, err, exit, mode: "update" });
5280
5309
  }
5281
5310
  function registerUpdateCommand(cli2) {
@@ -5338,7 +5367,7 @@ function summarizeState(state) {
5338
5367
  return "No prior install detected \u2014 new install flow.";
5339
5368
  }
5340
5369
  const trackList = state.tracks.length > 0 ? state.tracks.join(", ") : "(no tracks resolved)";
5341
- const sourceLabel = state.source === "metafile" ? "via .claude/.installed-tracks" : state.source === "legacy" ? "via legacy rules/*.md heuristic" : "via no source";
5370
+ const sourceLabel = state.source === "metafile" ? "via .claude/.installed-tracks" : state.source === "legacy" ? "via legacy rules/*.md heuristic" : state.source === "install-log" ? "via .uzys-agent-harness/ install log" : "via no source";
5342
5371
  return `Existing install detected ${sourceLabel}. Tracks: ${trackList}.`;
5343
5372
  }
5344
5373