@uzysjung/agent-harness 26.177.0 → 26.179.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
@@ -77,6 +77,7 @@ import {
77
77
  formatResidentCostLine,
78
78
  hasUiTrack,
79
79
  hashContent,
80
+ importsAgentsMd,
80
81
  init_esm_shims,
81
82
  installLogPath,
82
83
  installedClis,
@@ -146,7 +147,7 @@ import {
146
147
  withoutAppleDouble,
147
148
  wrapHarnessBlock,
148
149
  writeInstallLog
149
- } from "./chunk-JIVFWRYB.js";
150
+ } from "./chunk-LRPCXEUU.js";
150
151
 
151
152
  // node_modules/sisteransi/src/index.js
152
153
  var require_src = __commonJS({
@@ -1952,11 +1953,6 @@ init_esm_shims();
1952
1953
  import { chmodSync as chmodSync3, existsSync as existsSync20, readdirSync as readdirSync5, readFileSync as readFileSync22, writeFileSync as writeFileSync7 } from "fs";
1953
1954
  import { basename as basename6, join as join30, relative as relative7, resolve, sep as sep8 } from "path";
1954
1955
 
1955
- // src/anchor-seed.ts
1956
- init_esm_shims();
1957
- import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
1958
- import { join as join6 } from "path";
1959
-
1960
1956
  // src/agents-md-render.ts
1961
1957
  init_esm_shims();
1962
1958
  var AGENTS_MD_TEMPLATE = "templates/AGENTS.md.template";
@@ -2038,6 +2034,9 @@ ${CODEX_SIZE_NOTE}` : RULES_NOTE : "",
2038
2034
  }
2039
2035
 
2040
2036
  // src/anchor-seed.ts
2037
+ init_esm_shims();
2038
+ import { existsSync as existsSync5, readFileSync as readFileSync3 } from "fs";
2039
+ import { join as join6 } from "path";
2041
2040
  function readIfExists(path) {
2042
2041
  if (!existsSync5(path)) return null;
2043
2042
  try {
@@ -6420,6 +6419,7 @@ function runInstallStages(ctx, args) {
6420
6419
  legacyRestored: legacyRestored(previousLog, ledger.shared, cliSharedFiles),
6421
6420
  pendingKeyExcludes: pendingKeyExcludes(projectDir, spec.keyExclude ?? [], ledger.portionPaths),
6422
6421
  ...legacyAnchor ? { legacyAnchor } : {},
6422
+ ...agentsMdImportField(projectDir, [...spec.cli, ...installedClis(previousLog)]),
6423
6423
  releasedThisRun: releasedThisRun({
6424
6424
  projectDir,
6425
6425
  spec,
@@ -6481,6 +6481,20 @@ function runInstallStages(ctx, args) {
6481
6481
  external
6482
6482
  };
6483
6483
  }
6484
+ function agentsMdImportField(projectDir, clis) {
6485
+ if (!clis.includes("claude") || !clis.some(isAgentsMdCli)) return {};
6486
+ const read = (name) => {
6487
+ try {
6488
+ return readFileSync22(join30(projectDir, name), "utf8");
6489
+ } catch {
6490
+ return null;
6491
+ }
6492
+ };
6493
+ const root = read("CLAUDE.md");
6494
+ const agents = read("AGENTS.md");
6495
+ if (root === null || agents === null || !importsAgentsMd(root)) return {};
6496
+ return { agentsMdImport: { bytes: Buffer.byteLength(agents, "utf8") } };
6497
+ }
6484
6498
  function legacyAnchorTrace(projectDir, spec) {
6485
6499
  if (!spec.cli.includes("claude")) return null;
6486
6500
  const { state, traces } = detectInstallState(projectDir);
@@ -6516,7 +6530,11 @@ function runUpdateInstall(ctx, templatesDir) {
6516
6530
  gitignoreEnvAdded: false,
6517
6531
  gitignoreNpxSkillsAdded: []
6518
6532
  },
6519
- rootClaudeMd: null
6533
+ rootClaudeMd: null,
6534
+ ...agentsMdImportField(ctx.projectDir, [
6535
+ ...ctx.spec.cli,
6536
+ ...installedClis(readInstallLog(ctx.projectDir))
6537
+ ])
6520
6538
  };
6521
6539
  ctx.onProgress?.({ type: "baseline-complete", baseline });
6522
6540
  return { ...baseline, external: null };
@@ -7159,6 +7177,16 @@ function onDiskTargets(spec, assetSpec) {
7159
7177
  // src/commands/install-render.ts
7160
7178
  var CLI_SUMMARY_LABELS = CLI_DISPLAY_NAMES;
7161
7179
  var LEGACY_ANCHOR_NOTE = `legacy anchor \xB7 no longer updated \u2014 content now in ${HARNESS_ANCHOR_FILE}; delete it when you no longer need it`;
7180
+ function agentsMdImportRow(hit, labelWidth) {
7181
+ if (hit === void 0) return null;
7182
+ const kb = Math.round(hit.bytes / 1024);
7183
+ return assetRow(
7184
+ "skip",
7185
+ "CLAUDE.md (root)",
7186
+ `imports @AGENTS.md \u2014 Claude Code reads the harness principles \xB7 rules twice \u2014 AGENTS.md (${kb} KB) carries them again, and it already gets them via ${HARNESS_ANCHOR_FILE} and .claude/rules/. Left as is \u2014 drop the import unless you need AGENTS.md's own sections`,
7187
+ labelWidth
7188
+ );
7189
+ }
7162
7190
  function renderInstallHeader(log, spec, mode) {
7163
7191
  const headerLabel = mode === "update" ? "uzys-agent-harness \xB7 update" : mode === "add" ? "uzys-agent-harness \xB7 add" : mode === "reinstall" ? "uzys-agent-harness \xB7 reinstall" : "uzys-agent-harness \xB7 install";
7164
7192
  log("");
@@ -7845,6 +7873,8 @@ function renderPhase1Rows(log, baseline, verbose = false) {
7845
7873
  if (baseline.updateMode.legacyAnchor) {
7846
7874
  log(assetRow("skip", baseline.updateMode.legacyAnchor, LEGACY_ANCHOR_NOTE));
7847
7875
  }
7876
+ const agentsImport2 = agentsMdImportRow(baseline.agentsMdImport);
7877
+ if (agentsImport2 !== null) log(agentsImport2);
7848
7878
  linkedSkillRows(
7849
7879
  log,
7850
7880
  baseline.updateMode.skillsLinked ?? [],
@@ -8121,6 +8151,8 @@ function renderPhase1Rows(log, baseline, verbose = false) {
8121
8151
  if (baseline.legacyAnchor) {
8122
8152
  log(assetRow("skip", baseline.legacyAnchor, LEGACY_ANCHOR_NOTE, TEMPLATES_COL));
8123
8153
  }
8154
+ const agentsImport = agentsMdImportRow(baseline.agentsMdImport, TEMPLATES_COL);
8155
+ if (agentsImport !== null) log(agentsImport);
8124
8156
  if (baseline.ciScaffold) {
8125
8157
  for (const f of baseline.ciScaffold.written) {
8126
8158
  log(assetRow("success", f, "CI scaffold (fill-in template)", TEMPLATES_COL));