@uzysjung/agent-harness 26.134.1 → 26.136.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.1",
715
+ version: "26.136.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: {
@@ -744,7 +744,8 @@ var package_default = {
744
744
  format: "biome format --write src tests",
745
745
  ci: "npm run typecheck && npm run lint && npm run test:coverage && npm run build",
746
746
  prepare: "[ -d dist ] || npm run build",
747
- "cost:report": "npm run build && node scripts/context-cost-report.mjs"
747
+ "cost:report": "npm run build && node scripts/context-cost-report.mjs",
748
+ "cost:baseline": "npm run build && node scripts/context-cost-baseline.mjs"
748
749
  },
749
750
  dependencies: {
750
751
  "@clack/prompts": "^1.3.0",
@@ -1101,9 +1102,11 @@ import { dirname as dirname3, relative, sep } from "path";
1101
1102
  // src/install-log.ts
1102
1103
  init_esm_shims();
1103
1104
  import { createHash } from "crypto";
1104
- import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync } from "fs";
1105
+ import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, rmSync, writeFileSync } from "fs";
1105
1106
  import { dirname as dirname2, join as join3 } from "path";
1106
1107
  var INSTALL_LOG_FILENAME = ".harness-install.json";
1108
+ var INSTALL_LOG_DIR = ".uzys-agent-harness";
1109
+ var LEGACY_INSTALL_LOG_DIR = ".claude";
1107
1110
  var INSTALL_LOG_VERSION = 1;
1108
1111
  var POLICY_DIRS = [
1109
1112
  { dir: "rules", ext: ".md" },
@@ -1251,15 +1254,26 @@ function collectPolicyHashes(projectDir, templatesDir) {
1251
1254
  return out;
1252
1255
  }
1253
1256
  function writeInstallLog(projectDir, log) {
1254
- const path = join3(projectDir, ".claude", INSTALL_LOG_FILENAME);
1257
+ const path = installLogPath(projectDir);
1255
1258
  mkdirSync2(dirname2(path), { recursive: true });
1256
1259
  writeFileSync(path, `${JSON.stringify(log, null, 2)}
1257
1260
  `, "utf8");
1261
+ migrateAwayLegacyLog(projectDir);
1258
1262
  return path;
1259
1263
  }
1264
+ function migrateAwayLegacyLog(projectDir) {
1265
+ const legacy = legacyInstallLogPath(projectDir);
1266
+ if (!existsSync3(legacy)) return;
1267
+ try {
1268
+ rmSync(legacy);
1269
+ } catch {
1270
+ }
1271
+ }
1260
1272
  function readInstallLog(projectDir) {
1261
- const path = join3(projectDir, ".claude", INSTALL_LOG_FILENAME);
1262
- if (!existsSync3(path)) return null;
1273
+ const path = [installLogPath(projectDir), legacyInstallLogPath(projectDir)].find(
1274
+ (p2) => existsSync3(p2)
1275
+ );
1276
+ if (!path) return null;
1263
1277
  try {
1264
1278
  const parsed = JSON.parse(readFileSync2(path, "utf8"));
1265
1279
  if (Array.isArray(parsed.assets)) {
@@ -1273,7 +1287,10 @@ function readInstallLog(projectDir) {
1273
1287
  }
1274
1288
  }
1275
1289
  function installLogPath(projectDir) {
1276
- return join3(projectDir, ".claude", INSTALL_LOG_FILENAME);
1290
+ return join3(projectDir, INSTALL_LOG_DIR, INSTALL_LOG_FILENAME);
1291
+ }
1292
+ function legacyInstallLogPath(projectDir) {
1293
+ return join3(projectDir, LEGACY_INSTALL_LOG_DIR, INSTALL_LOG_FILENAME);
1277
1294
  }
1278
1295
 
1279
1296
  // src/owned-write.ts
@@ -3720,7 +3737,7 @@ function registerListCommand(cli2) {
3720
3737
  // src/commands/uninstall.ts
3721
3738
  init_esm_shims();
3722
3739
  import { spawnSync as spawnSync2 } from "child_process";
3723
- import { existsSync as existsSync15, readFileSync as readFileSync14, rmSync } from "fs";
3740
+ import { existsSync as existsSync15, readFileSync as readFileSync14, rmSync as rmSync2 } from "fs";
3724
3741
  import { join as join13, resolve as resolve4 } from "path";
3725
3742
 
3726
3743
  // src/uninstall-interactive.ts
@@ -4873,7 +4890,7 @@ function uninstallAction(options, deps = {}) {
4873
4890
  }
4874
4891
  }
4875
4892
  const logWriteFailed = settleLog(
4876
- { installLog, projectDir, selectedIds, keepTemplates, removedIds },
4893
+ { installLog, projectDir, selectedIds, removedIds },
4877
4894
  { log, err, rm, writeLog }
4878
4895
  );
4879
4896
  for (const line of advisoryLines(plan, targetAssets, projectDir, keepTemplates, rootFiles)) {
@@ -4948,7 +4965,7 @@ function executeReverse(plan, log, logSurvives) {
4948
4965
  return { succeeded, failed, removedIds };
4949
4966
  }
4950
4967
  function settleLog(ctx, io) {
4951
- const { installLog, projectDir, selectedIds, keepTemplates, removedIds } = ctx;
4968
+ const { installLog, projectDir, selectedIds, removedIds } = ctx;
4952
4969
  if (selectedIds) {
4953
4970
  const remaining = installLog.assets.filter((a) => !removedIds.includes(a.id));
4954
4971
  try {
@@ -4960,9 +4977,10 @@ function settleLog(ctx, io) {
4960
4977
  io.err(c.dim(` \uC2E4\uC81C\uB85C \uC81C\uAC70\uB41C \uC790\uC0B0: ${removedIds.join(", ") || "(\uC5C6\uC74C)"}`));
4961
4978
  return true;
4962
4979
  }
4963
- } else if (keepTemplates) {
4964
- io.rm(installLogPath(projectDir));
4965
- io.log(` ${status.success("install log removed (templates kept)")}`);
4980
+ } else {
4981
+ io.rm(join13(projectDir, INSTALL_LOG_DIR));
4982
+ io.rm(legacyInstallLogPath(projectDir));
4983
+ io.log(` ${status.success("install log removed")}`);
4966
4984
  }
4967
4985
  return false;
4968
4986
  }
@@ -5164,7 +5182,7 @@ function defaultSpawn2(cmd, args) {
5164
5182
  }
5165
5183
  function defaultRm(path) {
5166
5184
  if (existsSync15(path)) {
5167
- rmSync(path, { recursive: true, force: true });
5185
+ rmSync2(path, { recursive: true, force: true });
5168
5186
  }
5169
5187
  }
5170
5188
  function registerUninstallCommand(cli2) {
@@ -5224,16 +5242,28 @@ var LEGACY_SIGNATURES = [
5224
5242
  function detectInstallState(projectDir) {
5225
5243
  const claudeDir = join14(projectDir, ".claude");
5226
5244
  const hasClaudeDir = existsSync16(claudeDir);
5227
- if (!hasClaudeDir) {
5228
- return { state: "new", tracks: [], source: "none", hasClaudeDir: false };
5245
+ if (hasClaudeDir) {
5246
+ const metaPath = join14(projectDir, META_FILE);
5247
+ if (existsSync16(metaPath)) {
5248
+ const tracks2 = readMetafile(metaPath);
5249
+ return { state: "existing", tracks: tracks2, source: "metafile", hasClaudeDir: true };
5250
+ }
5251
+ const tracks = inferFromLegacySignatures(projectDir);
5252
+ return { state: "existing", tracks, source: "legacy", hasClaudeDir: true };
5229
5253
  }
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 };
5254
+ const log = readInstallLog(projectDir);
5255
+ if (log) {
5256
+ return {
5257
+ state: "existing",
5258
+ tracks: tracksFromLog(log.spec.tracks),
5259
+ source: "install-log",
5260
+ hasClaudeDir: false
5261
+ };
5234
5262
  }
5235
- const tracks = inferFromLegacySignatures(projectDir);
5236
- return { state: "existing", tracks, source: "legacy", hasClaudeDir: true };
5263
+ return { state: "new", tracks: [], source: "none", hasClaudeDir: false };
5264
+ }
5265
+ function tracksFromLog(tracks) {
5266
+ return [...new Set(tracks.filter(isTrack))].sort();
5237
5267
  }
5238
5268
  function readMetafile(path) {
5239
5269
  const raw = readFileSync15(path, "utf8");
@@ -5269,13 +5299,13 @@ function updateAction(options = {}, deps = {}) {
5269
5299
  const execute = deps.execute ?? executeSpec;
5270
5300
  const projectDir = resolve5(options.projectDir ?? process.cwd());
5271
5301
  const state = detect(projectDir);
5272
- if (!state.hasClaudeDir) {
5273
- err(status.failure(c.red(`No harness install found at ${projectDir}/.claude`)));
5302
+ if (state.state === "new") {
5303
+ err(status.failure(c.red(`No harness install found at ${projectDir}`)));
5274
5304
  err(c.dim(" Run `agent-harness install --track <name>` first."));
5275
5305
  exit(1);
5276
5306
  return;
5277
5307
  }
5278
- log(c.dim(`Updating policy files in ${projectDir}/.claude`));
5308
+ log(c.dim(`Updating installed harness files in ${projectDir}`));
5279
5309
  execute(buildUpdateSpec(projectDir, state.tracks), { log, err, exit, mode: "update" });
5280
5310
  }
5281
5311
  function registerUpdateCommand(cli2) {
@@ -5338,7 +5368,7 @@ function summarizeState(state) {
5338
5368
  return "No prior install detected \u2014 new install flow.";
5339
5369
  }
5340
5370
  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";
5371
+ 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
5372
  return `Existing install detected ${sourceLabel}. Tracks: ${trackList}.`;
5343
5373
  }
5344
5374