@event4u/agent-config 14.19.0 → 14.20.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.
Files changed (101) hide show
  1. package/.augment-plugin/marketplace.json +3 -3
  2. package/.augment-plugin/plugin.json +1 -1
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/CHANGELOG.md +108 -156
  5. package/dist/agent-src/commands/agent-handoff.md +42 -41
  6. package/dist/agent-src/contexts/execution/host-capability-manifest.md +7 -1
  7. package/dist/agent-src/rules/untrusted-input-defense.md +0 -2
  8. package/dist/agent-src/skills/evaluate-llm-feature/SKILL.md +1 -1
  9. package/dist/agent-src/skills/markitdown/SKILL.md +1 -1
  10. package/dist/agent-src/skills/skill-improvement-pipeline/SKILL.md +28 -6
  11. package/dist/agent-src/skills/test-driven-development/SKILL.md +1 -3
  12. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  13. package/dist/agent-src/templates/roadmaps.md +14 -1
  14. package/dist/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  15. package/dist/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  16. package/dist/agent-src/templates/scripts/telemetry_report.ts +22 -2
  17. package/dist/cli/mcp/dispatch.js +10 -0
  18. package/dist/cli/mcp/stdio.js +33 -2
  19. package/dist/cli/mcp/telemetry.js +227 -0
  20. package/dist/cli-delegate/{chunk-GZTMRYCN.js → chunk-C6IPZRDA.js} +79 -12
  21. package/dist/cli-delegate/{chunk-CYH5SP6M.js → chunk-I6RHFQEG.js} +151 -16
  22. package/dist/cli-delegate/{chunk-IDHUQIXP.js → chunk-NUMQHLS5.js} +21 -4
  23. package/dist/cli-delegate/{chunk-PMEKGDED.js → chunk-PI2GU3DP.js} +163 -1
  24. package/dist/cli-delegate/{chunk-7PRE6ZV2.js → chunk-YS6XTLEK.js} +199 -4
  25. package/dist/cli-delegate/chunk-ZVBOHSVF.js +1109 -0
  26. package/dist/cli-delegate/cmd_conformance.js +73 -109
  27. package/dist/cli-delegate/cmd_doctor.js +2 -2
  28. package/dist/cli-delegate/cmd_export.js +2 -2
  29. package/dist/cli-delegate/cmd_handoff.js +41 -11
  30. package/dist/cli-delegate/cmd_memory_get.js +1 -1
  31. package/dist/cli-delegate/cmd_prune.js +2 -2
  32. package/dist/cli-delegate/cmd_route_audit.js +1 -1
  33. package/dist/cli-delegate/cmd_session_recycle.js +59 -902
  34. package/dist/cli-delegate/cmd_settings_migrate.js +2 -2
  35. package/dist/cli-delegate/cmd_sync.js +2 -2
  36. package/dist/cli-delegate/cmd_uninstall.js +2 -2
  37. package/dist/cli-delegate/cmd_validate.js +2 -2
  38. package/dist/discovery/deprecation-report.md +1 -1
  39. package/dist/discovery/discovery-manifest.json +9 -9
  40. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  41. package/dist/discovery/discovery-manifest.summary.md +1 -1
  42. package/dist/discovery/dormancy-report.md +1 -1
  43. package/dist/discovery/orphan-report.md +1 -1
  44. package/dist/discovery/packs.json +2 -2
  45. package/dist/discovery/trust-report.md +1 -1
  46. package/dist/discovery/workspaces.json +2 -2
  47. package/dist/hooks/dispatch.js +7257 -6497
  48. package/dist/install/install.mjs +393 -168
  49. package/dist/mcp/registry-manifest.json +2 -2
  50. package/dist/mcp/server.json +2 -2
  51. package/dist/mcp/server.mjs +497 -118
  52. package/dist/scripts/mcp_server/telemetry.js +148 -0
  53. package/docs/guidelines/agent-infra/naming.md +1 -1
  54. package/docs/guidelines/agent-infra/security-lint-containment.md +46 -6
  55. package/docs/guidelines/agent-infra/self-improvement-pipeline.md +4 -4
  56. package/docs/guidelines/agent-infra/untrusted-input-spotlighting.md +1 -1
  57. package/docs/guidelines/redundancy-taxonomy.md +28 -0
  58. package/package.json +1 -1
  59. package/src/agent-src/templates/scripts/telemetry/mcp_lite.ts +213 -0
  60. package/src/agent-src/templates/scripts/telemetry/report_renderer.ts +16 -0
  61. package/src/agent-src/templates/scripts/telemetry_report.ts +22 -2
  62. package/src/config/assurance-capability-registry.json +9 -0
  63. package/src/config/gate-coverage.yml +55 -0
  64. package/src/config/gate-violation-baselines.json +15 -3
  65. package/src/scripts/_cli/cmd_session_recycle.ts +51 -3
  66. package/src/scripts/_lib/audit_field_provenance.ts +44 -3
  67. package/src/scripts/_lib/host_capability.ts +38 -0
  68. package/src/scripts/_lib/install_reach_checks.ts +33 -1
  69. package/src/scripts/_lib/mcp_bridge.ts +222 -10
  70. package/src/scripts/_lib/mcp_consent_residual.ts +173 -0
  71. package/src/scripts/_lib/orchestration_record.ts +23 -1
  72. package/src/scripts/_lib/recycle_envelope_paths.ts +190 -0
  73. package/src/scripts/_lib/release_position.ts +96 -0
  74. package/src/scripts/_lib/review_skipped_record.ts +17 -1
  75. package/src/scripts/_lib/security_lint.ts +179 -7
  76. package/src/scripts/_lib/self_repair.ts +141 -6
  77. package/src/scripts/_lib/self_repair_store.ts +273 -7
  78. package/src/scripts/_lib/subagent_capsule.ts +155 -3
  79. package/src/scripts/build_rule_trigger_matrix.ts +5 -0
  80. package/src/scripts/check_mcp_doc_drift.ts +217 -0
  81. package/src/scripts/check_pack_size.ts +321 -3
  82. package/src/scripts/handoff_context_hook.ts +54 -7
  83. package/src/scripts/hooks/session_eol_hook.ts +18 -7
  84. package/src/scripts/install.ts +4 -4
  85. package/src/scripts/lint_agent_security.ts +316 -25
  86. package/src/scripts/lint_confusables.ts +42 -6
  87. package/src/scripts/lint_handoffs.ts +0 -132
  88. package/src/scripts/lint_hidden_unicode.ts +49 -7
  89. package/src/scripts/lint_instruction_smuggling.ts +42 -6
  90. package/src/scripts/lint_mcp_config_security.ts +42 -6
  91. package/src/scripts/lint_roadmap_later_disposition.ts +217 -27
  92. package/src/scripts/lint_skill_frontmatter_safety.ts +43 -7
  93. package/src/scripts/mcp_server/resources.ts +41 -0
  94. package/src/scripts/mcp_server/telemetry.ts +19 -4
  95. package/src/scripts/orchestration_record.ts +12 -1
  96. package/src/scripts/release.ts +24 -24
  97. package/src/scripts/release_publication.ts +6 -2
  98. package/src/scripts/self_repair_cli.ts +31 -1
  99. package/src/scripts/skill_scout.ts +69 -0
  100. package/dist/cli-delegate/chunk-2GNWGMAL.js +0 -172
  101. package/dist/cli-delegate/chunk-LPPWO5CE.js +0 -161
@@ -7373,7 +7373,7 @@ import * as crypto3 from "node:crypto";
7373
7373
  import * as fs24 from "node:fs";
7374
7374
  import * as os8 from "node:os";
7375
7375
  import * as path21 from "node:path";
7376
- import process3 from "node:process";
7376
+ import process4 from "node:process";
7377
7377
  import { fileURLToPath as fileURLToPath6, pathToFileURL as pathToFileURL2 } from "node:url";
7378
7378
 
7379
7379
  // src/scripts/_lib/json_pointers.ts
@@ -8130,17 +8130,170 @@ function current_package_version(repo_root) {
8130
8130
  // src/scripts/_lib/mcp_bridge.ts
8131
8131
  import * as fs3 from "node:fs";
8132
8132
  import * as path3 from "node:path";
8133
+
8134
+ // src/scripts/_lib/host_capability.ts
8135
+ import process2 from "node:process";
8136
+ var SAFE_DEFAULT = {
8137
+ schema_version: 1,
8138
+ subagent_spawn: false,
8139
+ parallel_spawn: false,
8140
+ status_polling: false,
8141
+ separate_quota_pool: false,
8142
+ agent_teams: false,
8143
+ worker_respawn: false,
8144
+ reads_project_mcp_config: false,
8145
+ // `true` because the safe answer here is "there is still a step", not
8146
+ // "there is nothing to do" — see the field's own note.
8147
+ mcp_needs_manual_activation: true
8148
+ };
8149
+ function asBool(value) {
8150
+ return value === true;
8151
+ }
8152
+ function normalizeHostManifest(input) {
8153
+ if (input === null || typeof input !== "object") {
8154
+ return { ...SAFE_DEFAULT };
8155
+ }
8156
+ const src = input;
8157
+ return {
8158
+ schema_version: 1,
8159
+ subagent_spawn: asBool(src.subagent_spawn),
8160
+ parallel_spawn: asBool(src.parallel_spawn),
8161
+ status_polling: asBool(src.status_polling),
8162
+ separate_quota_pool: asBool(src.separate_quota_pool),
8163
+ agent_teams: asBool(src.agent_teams),
8164
+ worker_respawn: asBool(src.worker_respawn),
8165
+ reads_project_mcp_config: asBool(src.reads_project_mcp_config),
8166
+ // Inverted coercion, matching the inverted default: only an explicit
8167
+ // `false` clears the residual, so an absent or malformed value keeps
8168
+ // the manual step visible instead of silently dropping it.
8169
+ mcp_needs_manual_activation: src.mcp_needs_manual_activation !== false
8170
+ };
8171
+ }
8172
+ var HOST_CAPABILITY_REGISTRY = {
8173
+ claude: { subagent_spawn: true, parallel_spawn: true }
8174
+ };
8175
+ function resolveHostCapabilities(hostId, override) {
8176
+ if (override !== void 0 && override !== null && typeof override === "object" && !Array.isArray(override)) {
8177
+ return normalizeHostManifest(override);
8178
+ }
8179
+ const row = hostId !== null && hostId !== void 0 ? HOST_CAPABILITY_REGISTRY[hostId] : void 0;
8180
+ if (row === void 0) {
8181
+ return { ...SAFE_DEFAULT };
8182
+ }
8183
+ return { ...SAFE_DEFAULT, ...row, schema_version: 1 };
8184
+ }
8185
+ function probeHostCapabilities(hostId) {
8186
+ const base = resolveHostCapabilities(hostId);
8187
+ const flag = process2.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
8188
+ const probedAgentTeams = typeof flag === "string" && flag !== "";
8189
+ return { ...base, agent_teams: base.agent_teams || probedAgentTeams };
8190
+ }
8191
+ var CAPABILITY_FIELDS = [
8192
+ "subagent_spawn",
8193
+ "parallel_spawn",
8194
+ "status_polling",
8195
+ "separate_quota_pool",
8196
+ "agent_teams",
8197
+ "worker_respawn",
8198
+ "reads_project_mcp_config",
8199
+ "mcp_needs_manual_activation"
8200
+ ];
8201
+ function describeHostCapabilities(hostId) {
8202
+ const manifest = probeHostCapabilities(hostId);
8203
+ const row = hostId !== null && hostId !== void 0 ? HOST_CAPABILITY_REGISTRY[hostId] : void 0;
8204
+ const flag = process2.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
8205
+ const probedAgentTeams = typeof flag === "string" && flag !== "";
8206
+ const sources = {};
8207
+ for (const field of CAPABILITY_FIELDS) {
8208
+ if (row !== void 0 && typeof row[field] === "boolean") {
8209
+ sources[field] = "registry";
8210
+ } else if (field === "agent_teams" && probedAgentTeams) {
8211
+ sources[field] = "live-probe";
8212
+ } else {
8213
+ sources[field] = "default";
8214
+ }
8215
+ }
8216
+ return { manifest, sources };
8217
+ }
8218
+
8219
+ // src/scripts/_lib/mcp_bridge.ts
8133
8220
  var MCP_SERVER_KEY = "agent-config";
8134
- var MCP_BRIDGE_ENTRY = {
8135
- mcpServers: {
8136
- [MCP_SERVER_KEY]: {
8137
- command: "npx",
8138
- args: ["-y", "@event4u/agent-config", "mcp-server"]
8221
+ var MCP_PACKAGE_NAME = "@event4u/agent-config";
8222
+ function mcpBridgeEntry(packageRoot) {
8223
+ const version = readPackageVersion(packageRoot);
8224
+ const spec = version === null ? MCP_PACKAGE_NAME : `${MCP_PACKAGE_NAME}@${version}`;
8225
+ return {
8226
+ mcpServers: {
8227
+ [MCP_SERVER_KEY]: {
8228
+ command: "npx",
8229
+ args: ["-y", spec, "mcp-server"]
8230
+ }
8139
8231
  }
8232
+ };
8233
+ }
8234
+ function readPackageVersion(packageRoot) {
8235
+ try {
8236
+ const raw = fs3.readFileSync(path3.join(packageRoot, "package.json"), "utf-8");
8237
+ const v = JSON.parse(raw).version;
8238
+ return typeof v === "string" && v.trim() !== "" ? v : null;
8239
+ } catch {
8240
+ return null;
8140
8241
  }
8141
- };
8242
+ }
8142
8243
  function makeEnsureMcpBridge(mergeJsonFile) {
8143
- return (projectRoot, force) => mergeJsonFile(path3.join(projectRoot, ".mcp.json"), MCP_BRIDGE_ENTRY, force, ".mcp.json");
8244
+ return (projectRoot, force, packageRoot = projectRoot) => mergeJsonFile(
8245
+ path3.join(projectRoot, ".mcp.json"),
8246
+ mcpBridgeEntry(packageRoot),
8247
+ force,
8248
+ ".mcp.json"
8249
+ );
8250
+ }
8251
+ var MCP_PROJECT_CONFIG = {
8252
+ "claude-code": { hostId: "claude", relPath: ".mcp.json" },
8253
+ cursor: { hostId: "cursor", relPath: ".cursor/mcp.json" },
8254
+ "gemini-cli": { hostId: "gemini", relPath: ".gemini/settings.json" }
8255
+ };
8256
+ function mcpRegistrationTargets(tools, readsConfig) {
8257
+ const out = [];
8258
+ for (const [toolId, spec] of Object.entries(MCP_PROJECT_CONFIG)) {
8259
+ if (toolId === "claude-code") continue;
8260
+ if (!tools.has(toolId)) continue;
8261
+ if (!readsConfig(spec.hostId)) continue;
8262
+ out.push({ toolId, hostId: spec.hostId, relPath: spec.relPath });
8263
+ }
8264
+ return out;
8265
+ }
8266
+ function makeEnsureMcpRegistrations(mergeJsonFile) {
8267
+ return (projectRoot, force, packageRoot, targets) => {
8268
+ const merged = {};
8269
+ for (const t of targets) {
8270
+ merged[t.toolId] = mergeJsonFile(
8271
+ path3.join(projectRoot, ...t.relPath.split("/")),
8272
+ mcpBridgeEntry(packageRoot),
8273
+ force,
8274
+ t.relPath
8275
+ );
8276
+ }
8277
+ return merged;
8278
+ };
8279
+ }
8280
+ function readsProjectMcpConfig(hostId) {
8281
+ return probeHostCapabilities(hostId).reads_project_mcp_config;
8282
+ }
8283
+ function registerMcpHosts(mergeJsonFile, projectRoot, force, packageRoot, tools, into, readsConfig = readsProjectMcpConfig) {
8284
+ const ensure = makeEnsureMcpRegistrations(mergeJsonFile);
8285
+ const claude = MCP_PROJECT_CONFIG["claude-code"];
8286
+ if (tools.has("claude-code") && claude !== void 0) {
8287
+ const merged = ensure(projectRoot, force, packageRoot, [
8288
+ { toolId: "claude-code", hostId: claude.hostId, relPath: claude.relPath }
8289
+ ]);
8290
+ (into["claude-code"] ??= []).push(...merged["claude-code"] ?? []);
8291
+ }
8292
+ for (const [toolId, keys] of Object.entries(
8293
+ ensure(projectRoot, force, packageRoot, mcpRegistrationTargets(tools, readsConfig))
8294
+ )) {
8295
+ (into[toolId] ??= []).push(...keys);
8296
+ }
8144
8297
  }
8145
8298
  function projectionModeOf(raw) {
8146
8299
  return raw === "scoped" ? "scoped" : raw === "tiered" ? "tiered" : "legacy-all";
@@ -8184,6 +8337,79 @@ function applyTieredPrune(deployResults, packageRoot, pruneBy) {
8184
8337
  };
8185
8338
  }
8186
8339
 
8340
+ // src/scripts/_lib/mcp_consent_residual.ts
8341
+ var SEEDED = {
8342
+ claude: {
8343
+ hostId: "claude",
8344
+ residual: "Approve the project-scoped `agent-config` server the first time the host prompts \u2014 the installer writes `.mcp.json` but does not pre-approve it.",
8345
+ source: "vendor-doc",
8346
+ cite: "Host documentation: a project-scope MCP server requires explicit approval, suppressible only through the user-global `enabledMcpjsonServers` key, which this package deliberately does not write (blocker `mcp-user-scope-approval-consent`)."
8347
+ }
8348
+ };
8349
+ var TOOL_TO_HOST = {
8350
+ "claude-code": "claude",
8351
+ cursor: "cursor",
8352
+ "gemini-cli": "gemini",
8353
+ windsurf: "windsurf",
8354
+ cline: "cline",
8355
+ copilot: "copilot",
8356
+ augment: "augment"
8357
+ };
8358
+ function residualFor(hostId) {
8359
+ const { manifest, sources } = describeHostCapabilities(hostId);
8360
+ if (sources.mcp_needs_manual_activation === "registry" && !manifest.mcp_needs_manual_activation) {
8361
+ return null;
8362
+ }
8363
+ return SEEDED[hostId] ?? null;
8364
+ }
8365
+ function isRecorded(hostId) {
8366
+ const { sources } = describeHostCapabilities(hostId);
8367
+ return hostId in SEEDED || sources.mcp_needs_manual_activation === "registry";
8368
+ }
8369
+ function residualLine(hostId) {
8370
+ const r = residualFor(hostId);
8371
+ if (r !== null) {
8372
+ return {
8373
+ hostId,
8374
+ state: "residual",
8375
+ text: `${hostId}: ${r.residual} (source: ${r.source} \u2014 not observed here)`
8376
+ };
8377
+ }
8378
+ if (isRecorded(hostId)) {
8379
+ return {
8380
+ hostId,
8381
+ state: "cleared",
8382
+ text: `${hostId}: nothing left to do (source: observed)`
8383
+ };
8384
+ }
8385
+ return {
8386
+ hostId,
8387
+ state: "unrecorded",
8388
+ text: `${hostId}: no residual recorded \u2014 nobody checked this host, which is not the same as nothing to do`
8389
+ };
8390
+ }
8391
+ function residualReport(toolIds) {
8392
+ const seen = /* @__PURE__ */ new Set();
8393
+ const out = [];
8394
+ for (const toolId of toolIds) {
8395
+ const hostId = TOOL_TO_HOST[toolId];
8396
+ if (hostId === void 0 || seen.has(hostId)) continue;
8397
+ seen.add(hostId);
8398
+ const line = residualLine(hostId);
8399
+ if (line.state !== "cleared") out.push(line);
8400
+ }
8401
+ return out;
8402
+ }
8403
+ function printResiduals(toolIds, quiet, write = (s) => process.stdout.write(s)) {
8404
+ if (quiet) return;
8405
+ const lines = residualReport(toolIds);
8406
+ if (lines.length === 0) return;
8407
+ write(" Still needs you (MCP):\n");
8408
+ for (const line of lines) write(` \u2022 ${line.text}
8409
+ `);
8410
+ write("\n");
8411
+ }
8412
+
8187
8413
  // src/scripts/_lib/scoped_projection.ts
8188
8414
  import * as fs5 from "node:fs";
8189
8415
  import { createRequire } from "node:module";
@@ -17278,7 +17504,7 @@ function render_native_model_md(text, tier) {
17278
17504
  import { spawnSync } from "node:child_process";
17279
17505
  import * as fs23 from "node:fs";
17280
17506
  import * as path20 from "node:path";
17281
- import process2 from "node:process";
17507
+ import process3 from "node:process";
17282
17508
  import { fileURLToPath as fileURLToPath5, pathToFileURL } from "node:url";
17283
17509
 
17284
17510
  // src/scripts/_lib/package_root.ts
@@ -17339,10 +17565,10 @@ var ArgparseExit = class extends Error {
17339
17565
  }
17340
17566
  };
17341
17567
  function _stdoutSink() {
17342
- return { write: (t) => process2.stdout.write(t) };
17568
+ return { write: (t) => process3.stdout.write(t) };
17343
17569
  }
17344
17570
  function _stderrSink() {
17345
- return { write: (t) => process2.stderr.write(t) };
17571
+ return { write: (t) => process3.stderr.write(t) };
17346
17572
  }
17347
17573
  function _print(out, line = "") {
17348
17574
  out.write(line + "\n");
@@ -17684,7 +17910,7 @@ function _load_state_migrator() {
17684
17910
  if (driver === null) {
17685
17911
  return null;
17686
17912
  }
17687
- const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
17913
+ const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
17688
17914
  let tsxBin = null;
17689
17915
  for (let dir = pkg_root; ; ) {
17690
17916
  const cand = path20.join(dir, "node_modules", ".bin", binName);
@@ -17955,7 +18181,7 @@ function _parse2(argv, out, err) {
17955
18181
  function main(argv = null, options = {}) {
17956
18182
  const out = options.out ?? _stdoutSink();
17957
18183
  const err = options.err ?? _stderrSink();
17958
- const args = _parse2(argv ?? process2.argv.slice(2), out, err);
18184
+ const args = _parse2(argv ?? process3.argv.slice(2), out, err);
17959
18185
  const [project] = resolve_project_root(null, { cwd: options.cwd ?? null });
17960
18186
  if (args.from_major) {
17961
18187
  _print(out, `\u2139\uFE0F declared source major: ${args.from_major}.x`);
@@ -17983,32 +18209,32 @@ function main(argv = null, options = {}) {
17983
18209
  var _inForeignBundle = !(typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__);
17984
18210
  var _HERE = fileURLToPath5(import.meta.url);
17985
18211
  function _isCliEntry() {
17986
- if (process2.argv[1] === void 0) {
18212
+ if (process3.argv[1] === void 0) {
17987
18213
  return false;
17988
18214
  }
17989
18215
  if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== "undefined" && __AGENT_CONFIG_CLI_DELEGATE__) {
17990
- if (path20.basename(process2.argv[1], ".js") === "cmd_migrate") {
18216
+ if (path20.basename(process3.argv[1], ".js") === "cmd_migrate") {
17991
18217
  return true;
17992
18218
  }
17993
18219
  }
17994
- const argvUrl = pathToFileURL(path20.resolve(process2.argv[1])).href;
18220
+ const argvUrl = pathToFileURL(path20.resolve(process3.argv[1])).href;
17995
18221
  if (import.meta.url === argvUrl) {
17996
18222
  return true;
17997
18223
  }
17998
18224
  try {
17999
18225
  const here = fs23.realpathSync(fileURLToPath5(import.meta.url));
18000
- const argv = fs23.realpathSync(path20.resolve(process2.argv[1]));
18226
+ const argv = fs23.realpathSync(path20.resolve(process3.argv[1]));
18001
18227
  return here === argv;
18002
18228
  } catch {
18003
18229
  return false;
18004
18230
  }
18005
18231
  }
18006
- if (!_inForeignBundle && (_isCliEntry() || process2.argv[1] === _HERE)) {
18232
+ if (!_inForeignBundle && (_isCliEntry() || process3.argv[1] === _HERE)) {
18007
18233
  try {
18008
- process2.exitCode = main(process2.argv.slice(2));
18234
+ process3.exitCode = main(process3.argv.slice(2));
18009
18235
  } catch (exc) {
18010
18236
  if (exc instanceof ArgparseExit) {
18011
- process2.exitCode = exc.code;
18237
+ process3.exitCode = exc.code;
18012
18238
  } else {
18013
18239
  throw exc;
18014
18240
  }
@@ -18148,7 +18374,7 @@ function atomicWrite0644(target, body, prefix) {
18148
18374
  const dir = path21.dirname(target);
18149
18375
  const tmpName = path21.join(
18150
18376
  dir,
18151
- `${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
18377
+ `${prefix}${process4.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
18152
18378
  );
18153
18379
  let fd = null;
18154
18380
  try {
@@ -18324,7 +18550,7 @@ var state = {
18324
18550
  };
18325
18551
  function _emit_progress(obj) {
18326
18552
  if (!state.PROGRESS_NDJSON) return;
18327
- process3.stdout.write(jsonDumpsCompact(obj) + "\n");
18553
+ process4.stdout.write(jsonDumpsCompact(obj) + "\n");
18328
18554
  }
18329
18555
  function _emit_progress_terminal(rc) {
18330
18556
  if (!state.PROGRESS_NDJSON) return;
@@ -18335,25 +18561,25 @@ function _emit_progress_terminal(rc) {
18335
18561
  }
18336
18562
  }
18337
18563
  function info(msg) {
18338
- if (!state.QUIET) process3.stdout.write(` ${msg}
18564
+ if (!state.QUIET) process4.stdout.write(` ${msg}
18339
18565
  `);
18340
18566
  }
18341
18567
  function success(msg) {
18342
- if (!state.QUIET) process3.stdout.write(` \u2705 ${msg}
18568
+ if (!state.QUIET) process4.stdout.write(` \u2705 ${msg}
18343
18569
  `);
18344
18570
  }
18345
18571
  function skip(msg) {
18346
- if (!state.QUIET) process3.stdout.write(` \u23ED\uFE0F ${msg}
18572
+ if (!state.QUIET) process4.stdout.write(` \u23ED\uFE0F ${msg}
18347
18573
  `);
18348
18574
  }
18349
18575
  function warn(msg) {
18350
- process3.stderr.write(` \u26A0\uFE0F ${msg}
18576
+ process4.stderr.write(` \u26A0\uFE0F ${msg}
18351
18577
  `);
18352
18578
  }
18353
18579
  function fail(msg) {
18354
- process3.stderr.write(` \u274C ${msg}
18580
+ process4.stderr.write(` \u274C ${msg}
18355
18581
  `);
18356
- process3.stderr.write(
18582
+ process4.stderr.write(
18357
18583
  " Diagnose: `./agent-config doctor` (or `--check <id>` for a single category)\n"
18358
18584
  );
18359
18585
  throw new SystemExitError(1);
@@ -18382,7 +18608,7 @@ function detect_package_type_for_project(project_root, package_root) {
18382
18608
  }
18383
18609
  function _is_interactive() {
18384
18610
  try {
18385
- return Boolean(process3.stdin.isTTY) && Boolean(process3.stdout.isTTY);
18611
+ return Boolean(process4.stdin.isTTY) && Boolean(process4.stdout.isTTY);
18386
18612
  } catch {
18387
18613
  return false;
18388
18614
  }
@@ -19355,7 +19581,7 @@ function dirHasEntries(p) {
19355
19581
  }
19356
19582
  }
19357
19583
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
19358
- const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
19584
+ const binName = process4.platform === "win32" ? "tsx.cmd" : "tsx";
19359
19585
  let dir = path21.dirname(scriptPath);
19360
19586
  for (; ; ) {
19361
19587
  const candidate = path21.join(dir, "node_modules", ".bin", binName);
@@ -19588,7 +19814,7 @@ function _validate_scope(tools, scope, was_all) {
19588
19814
  if (scope !== "project" && scope !== "global") {
19589
19815
  fail(`_validate_scope: unknown scope '${scope}'`);
19590
19816
  }
19591
- if (process3.env["AGENT_CONFIG_DEV_MODE"] === "1") return tools;
19817
+ if (process4.env["AGENT_CONFIG_DEV_MODE"] === "1") return tools;
19592
19818
  const incompatible = [...tools].filter((t) => {
19593
19819
  const sup = SCOPE_SUPPORT[t] ?? "both";
19594
19820
  return sup !== "both" && sup !== scope;
@@ -19602,14 +19828,14 @@ function _validate_scope(tools, scope, was_all) {
19602
19828
  }
19603
19829
  function _enforce_consumer_global_only(scope) {
19604
19830
  if (scope !== "project") return;
19605
- if (process3.env["AGENT_CONFIG_DEV_MODE"] === "1") return;
19831
+ if (process4.env["AGENT_CONFIG_DEV_MODE"] === "1") return;
19606
19832
  fail(
19607
19833
  "--scope=project is reserved for maintainers (ADR-020 \u2014 consumer installs are global-only). Set AGENT_CONFIG_DEV_MODE=1 to opt in. See docs/maintainers/dev-mode.md."
19608
19834
  );
19609
19835
  }
19610
19836
  function _enforce_not_source_repo(scope, project_root) {
19611
19837
  if (scope === "global") return;
19612
- if (process3.env["AGENT_CONFIG_ALLOW_SELF_INSTALL"] === "1") return;
19838
+ if (process4.env["AGENT_CONFIG_ALLOW_SELF_INSTALL"] === "1") return;
19613
19839
  const [is_source, signature] = _is_agent_config_source_repo(project_root);
19614
19840
  if (!is_source) return;
19615
19841
  fail(
@@ -19713,7 +19939,7 @@ function _resolve_scope(opts, detected, detect_reason, custom_path) {
19713
19939
  return "project";
19714
19940
  }
19715
19941
  function _run_scope_prompt(opts, reason, custom_path) {
19716
- if (!process3.stdin.isTTY && custom_path === null) {
19942
+ if (!process4.stdin.isTTY && custom_path === null) {
19717
19943
  fail(
19718
19944
  "Ambiguous install scope detected and stdin is not a TTY. Pass --scope=project|global (or --custom-path=<dir>) to override."
19719
19945
  );
@@ -19762,7 +19988,7 @@ function _read_line(prompt_text) {
19762
19988
  return line.trim();
19763
19989
  }
19764
19990
  function readLineSyncRaw(promptText) {
19765
- process3.stdout.write(promptText);
19991
+ process4.stdout.write(promptText);
19766
19992
  const buf = Buffer.alloc(1);
19767
19993
  const bytes = [];
19768
19994
  let sawAny = false;
@@ -19793,13 +20019,13 @@ function readLineSyncRaw(promptText) {
19793
20019
  return Buffer.from(bytes).toString("utf-8");
19794
20020
  }
19795
20021
  function prompt_scope_choice(reason) {
19796
- process3.stdout.write("\n");
20022
+ process4.stdout.write("\n");
19797
20023
  info(`Ambiguous install scope: ${reason}.`);
19798
20024
  info("Choose where to install:");
19799
- process3.stdout.write(" 1) Project \u2014 install into the current directory\n");
19800
- process3.stdout.write(" 2) User \u2014 install into ~/ (recommended; one install per machine)\n");
19801
- process3.stdout.write(" 3) Custom \u2014 specify an explicit destination path\n");
19802
- process3.stdout.write("\n");
20025
+ process4.stdout.write(" 1) Project \u2014 install into the current directory\n");
20026
+ process4.stdout.write(" 2) User \u2014 install into ~/ (recommended; one install per machine)\n");
20027
+ process4.stdout.write(" 3) Custom \u2014 specify an explicit destination path\n");
20028
+ process4.stdout.write("\n");
19803
20029
  let attempts = 0;
19804
20030
  while (attempts < 3) {
19805
20031
  const reply = _read_line("Choose [1/2/3]: ");
@@ -19908,7 +20134,7 @@ var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
19908
20134
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
19909
20135
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
19910
20136
  function _is_agent_config_source_repo(project_root) {
19911
- if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
20137
+ if (process4.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
19912
20138
  return [false, "consumer-mode-override"];
19913
20139
  }
19914
20140
  const pkg_json = path21.join(project_root, "package.json");
@@ -19937,7 +20163,7 @@ function _is_agent_config_source_repo(project_root) {
19937
20163
  return [false, ""];
19938
20164
  }
19939
20165
  function _detect_legacy_for_migration(project_root) {
19940
- if (process3.env["AGENT_CONFIG_DEV_MODE"] === "1") return [];
20166
+ if (process4.env["AGENT_CONFIG_DEV_MODE"] === "1") return [];
19941
20167
  const [is_source, signature] = _is_agent_config_source_repo(project_root);
19942
20168
  if (is_source) {
19943
20169
  if (!state.QUIET) {
@@ -19966,7 +20192,7 @@ function _detect_legacy_for_migration(project_root) {
19966
20192
  }
19967
20193
  function _prompt_migrate_to_global(project_root, artefacts) {
19968
20194
  if (!state.QUIET) {
19969
- process3.stdout.write("\n");
20195
+ process4.stdout.write("\n");
19970
20196
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
19971
20197
  for (const rel of artefacts) {
19972
20198
  info(` ${path21.join(project_root, rel)}`);
@@ -20007,7 +20233,7 @@ function _format_global_root_for_marker(global_root) {
20007
20233
  return `~/${rel.split(path21.sep).join("/")}`;
20008
20234
  }
20009
20235
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
20010
- const env_map = env ?? process3.env;
20236
+ const env_map = env ?? process4.env;
20011
20237
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
20012
20238
  if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) return null;
20013
20239
  const target = path21.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
@@ -20025,7 +20251,7 @@ var PROJECT_ANCHOR_TOOLS = {
20025
20251
  "gemini-cli": ".gemini/agent-config.bridge.yml"
20026
20252
  };
20027
20253
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
20028
- const env_map = env ?? process3.env;
20254
+ const env_map = env ?? process4.env;
20029
20255
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
20030
20256
  if (isDir(path21.join(project_root, ".agent-src.uncondensed"))) return [];
20031
20257
  const global_root_str = _format_global_root_for_marker(
@@ -20561,13 +20787,13 @@ function install_global(tools, force, project_root = null, core_only = false) {
20561
20787
  const classification = classify_mismatch(installed_version, recorded);
20562
20788
  if (classification === "downgrade" && !force) {
20563
20789
  if (!state.QUIET) {
20564
- process3.stdout.write("\n");
20790
+ process4.stdout.write("\n");
20565
20791
  warn("Refusing global install: lockfile records a newer version.");
20566
20792
  info(` Lockfile: ${read_path}`);
20567
20793
  info(` Recorded version: ${recorded}`);
20568
20794
  info(` Current package: ${installed_version}`);
20569
20795
  info(" Fix: upgrade the package, or re-run with `--force`");
20570
- process3.stdout.write("\n");
20796
+ process4.stdout.write("\n");
20571
20797
  }
20572
20798
  return 1;
20573
20799
  }
@@ -20581,13 +20807,13 @@ function install_global(tools, force, project_root = null, core_only = false) {
20581
20807
  );
20582
20808
  }
20583
20809
  if (!state.QUIET) {
20584
- process3.stdout.write("\n");
20810
+ process4.stdout.write("\n");
20585
20811
  info("Agent Config \u2014 Global (user-scope) install [ADR-007]");
20586
20812
  info("Per-tool anchor paths:");
20587
20813
  for (const tool_id of [...tools].sort()) {
20588
20814
  const anchor = USER_SCOPE_PATHS[tool_id];
20589
20815
  if (anchor === void 0) continue;
20590
- process3.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor}
20816
+ process4.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor}
20591
20817
  `);
20592
20818
  }
20593
20819
  }
@@ -20596,7 +20822,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
20596
20822
  const merged_tools = [.../* @__PURE__ */ new Set([...existing_tools, ...tools])].sort();
20597
20823
  const written = write_lockfile(installed_version, merged_tools, { path: write_path });
20598
20824
  if (!state.QUIET) {
20599
- process3.stdout.write("\n");
20825
+ process4.stdout.write("\n");
20600
20826
  info(`Lockfile written: ${written}`);
20601
20827
  info(` schema_version=1, agent_config_version=${installed_version}`);
20602
20828
  info(` tools=${merged_tools.join(",")}`);
@@ -20604,7 +20830,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
20604
20830
  if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path21.join(project_root, ".agent-src.uncondensed"))) {
20605
20831
  const drift = collect_drift(project_root);
20606
20832
  if (!state.QUIET) {
20607
- process3.stdout.write("\n");
20833
+ process4.stdout.write("\n");
20608
20834
  for (const line of format_drift_report(drift).replace(/\n$/, "").split("\n")) {
20609
20835
  info(line);
20610
20836
  }
@@ -20685,30 +20911,30 @@ function install_global(tools, force, project_root = null, core_only = false) {
20685
20911
  });
20686
20912
  }
20687
20913
  if (!state.QUIET) {
20688
- process3.stdout.write("\n");
20914
+ process4.stdout.write("\n");
20689
20915
  info("Deployed per-tool content:");
20690
20916
  for (const tool_id of Object.keys(deploy_results).sort()) {
20691
20917
  const [w, s, status] = deploy_results[tool_id];
20692
20918
  const anchor = USER_SCOPE_PATHS[tool_id] ?? "";
20693
20919
  if (status === "deployed" && tool_id === "claude-desktop") {
20694
20920
  const bundles_dir = _claude_desktop_bundles_dir();
20695
- process3.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${bundles_dir} (${w} bundles)
20921
+ process4.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${bundles_dir} (${w} bundles)
20696
20922
  `);
20697
20923
  } else if (status === "deployed") {
20698
- process3.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor} (${w} files, ${s} skipped)
20924
+ process4.stdout.write(` ${tool_id.padEnd(15)} \u2192 ${anchor} (${w} files, ${s} skipped)
20699
20925
  `);
20700
20926
  } else if (status === "marker") {
20701
- process3.stdout.write(
20927
+ process4.stdout.write(
20702
20928
  ` ${tool_id.padEnd(15)} \u2192 ${anchor}agent-config.md (${w ? "written" : "skipped"})
20703
20929
  `
20704
20930
  );
20705
20931
  } else if (status === "hint") {
20706
- process3.stdout.write(
20932
+ process4.stdout.write(
20707
20933
  ` ${tool_id.padEnd(15)} \u2192 no user-scope convention; use \`agent-config export --tool=${tool_id}\`
20708
20934
  `
20709
20935
  );
20710
20936
  } else {
20711
- process3.stdout.write(
20937
+ process4.stdout.write(
20712
20938
  ` ${tool_id.padEnd(15)} \u2192 no global-scope content yet (project-scope install supported)
20713
20939
  `
20714
20940
  );
@@ -20743,21 +20969,21 @@ function install_global(tools, force, project_root = null, core_only = false) {
20743
20969
  warn(line);
20744
20970
  }
20745
20971
  const notice = _scoped_migration_notice(deploy_results, project_root, package_root, {
20746
- env: process3.env,
20747
- stdinTty: process3.stdin.isTTY === true,
20748
- stdoutTty: process3.stdout.isTTY === true
20972
+ env: process4.env,
20973
+ stdinTty: process4.stdin.isTTY === true,
20974
+ stdoutTty: process4.stdout.isTTY === true
20749
20975
  });
20750
20976
  if (notice.length > 0) {
20751
- process3.stdout.write("\n");
20977
+ process4.stdout.write("\n");
20752
20978
  for (const line of notice) info(line);
20753
20979
  }
20754
20980
  } catch {
20755
20981
  }
20756
20982
  }
20757
20983
  if (!state.QUIET) {
20758
- process3.stdout.write("\n");
20984
+ process4.stdout.write("\n");
20759
20985
  success(`Global install completed (v${installed_version}).`);
20760
- process3.stdout.write("\n");
20986
+ process4.stdout.write("\n");
20761
20987
  }
20762
20988
  return 0;
20763
20989
  }
@@ -20914,8 +21140,8 @@ var _VALUE_FLAGS = {
20914
21140
  "--layer": "layer"
20915
21141
  };
20916
21142
  function _argError(msg) {
20917
- process3.stderr.write(USAGE);
20918
- process3.stderr.write(`${PROG}: error: ${msg}
21143
+ process4.stderr.write(USAGE);
21144
+ process4.stderr.write(`${PROG}: error: ${msg}
20919
21145
  `);
20920
21146
  throw new ArgparseExit2(2);
20921
21147
  }
@@ -20954,7 +21180,7 @@ function parse_options(argv) {
20954
21180
  while (i < argv.length) {
20955
21181
  const a = argv[i];
20956
21182
  if (a === "-h" || a === "--help") {
20957
- process3.stdout.write(USAGE);
21183
+ process4.stdout.write(USAGE);
20958
21184
  throw new ArgparseExit2(0);
20959
21185
  }
20960
21186
  const eq = a.startsWith("--") ? a.indexOf("=") : -1;
@@ -21158,12 +21384,12 @@ personal:
21158
21384
  }
21159
21385
  _write_install_mode_marker(target_root, "minimal");
21160
21386
  if (!state.QUIET) {
21161
- process3.stderr.write(
21387
+ process4.stderr.write(
21162
21388
  "\u2139\uFE0F Minimal install \u2014 run `agent-config install --force` to add AGENTS.md, bridges, and tool integrations.\n"
21163
21389
  );
21164
21390
  }
21165
21391
  if (!state.QUIET) {
21166
- process3.stdout.write("\n");
21392
+ process4.stdout.write("\n");
21167
21393
  info("Next steps:");
21168
21394
  info(" \u2022 Ensure `agent-config` is on $PATH: npm install -g @event4u/agent-config");
21169
21395
  info(" \u2022 Drop project-scoped overrides under `agents/overrides/{rules,skills,commands}/`.");
@@ -21195,14 +21421,14 @@ var _INTERACTIVE_VERBOSITIES = [
21195
21421
  ];
21196
21422
  var _LOCAL_CONFIG_FILE = ".agent-config.local.json";
21197
21423
  function _interactive_prompt_choice(label, options) {
21198
- process3.stdout.write("\n");
21199
- process3.stdout.write(` ${label}
21424
+ process4.stdout.write("\n");
21425
+ process4.stdout.write(` ${label}
21200
21426
  `);
21201
21427
  options.forEach(([key, blurb], idx) => {
21202
- process3.stdout.write(` ${idx + 1}. ${key} \u2014 ${blurb}
21428
+ process4.stdout.write(` ${idx + 1}. ${key} \u2014 ${blurb}
21203
21429
  `);
21204
21430
  });
21205
- process3.stdout.write("\n");
21431
+ process4.stdout.write("\n");
21206
21432
  for (; ; ) {
21207
21433
  const raw = _read_line(` Choice [1-${options.length}, default 1]: `);
21208
21434
  if (raw === null) return options[0][0];
@@ -21214,14 +21440,14 @@ function _interactive_prompt_choice(label, options) {
21214
21440
  for (const [key] of options) {
21215
21441
  if (raw.toLowerCase() === key) return key;
21216
21442
  }
21217
- process3.stdout.write(
21443
+ process4.stdout.write(
21218
21444
  ` \u26A0\uFE0F Pick a number 1-${options.length} or one of: ${options.map(([k]) => k).join(", ")}.
21219
21445
  `
21220
21446
  );
21221
21447
  }
21222
21448
  }
21223
21449
  function run_interactive_init(project_root, force) {
21224
- if (!process3.stdin.isTTY) {
21450
+ if (!process4.stdin.isTTY) {
21225
21451
  warn(
21226
21452
  `--interactive requested but stdin is not a TTY; skipping the prompt. Re-run interactively or hand-edit ${_LOCAL_CONFIG_FILE}.`
21227
21453
  );
@@ -21234,7 +21460,7 @@ function run_interactive_init(project_root, force) {
21234
21460
  );
21235
21461
  return 0;
21236
21462
  }
21237
- process3.stdout.write("\n");
21463
+ process4.stdout.write("\n");
21238
21464
  info("Interactive init \u2014 captures user-type / stack / verbosity");
21239
21465
  info("(forward-compatible stub; runtime filtering activates with step-9)");
21240
21466
  const user_type = _interactive_prompt_choice("Primary user type:", _INTERACTIVE_USER_TYPES);
@@ -21261,10 +21487,10 @@ var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/
21261
21487
  var _WIZARD_TIMEOUTS = [10, 20, 40, 80];
21262
21488
  function _wizard_should_launch(opts) {
21263
21489
  if (opts.no_ui) return [false, "--no-ui flag set"];
21264
- const env_no_ui = (process3.env["AGENT_CONFIG_NO_UI"] ?? "").trim();
21490
+ const env_no_ui = (process4.env["AGENT_CONFIG_NO_UI"] ?? "").trim();
21265
21491
  if (env_no_ui && env_no_ui !== "0") return [false, "AGENT_CONFIG_NO_UI env set"];
21266
- if ((process3.env["CI"] ?? "").trim()) return [false, "CI environment detected"];
21267
- if (!process3.stdout.isTTY) return [false, "stdout is not a TTY"];
21492
+ if ((process4.env["CI"] ?? "").trim()) return [false, "CI environment detected"];
21493
+ if (!process4.stdout.isTTY) return [false, "stdout is not a TTY"];
21268
21494
  const tools_raw = opts.tools;
21269
21495
  if (tools_raw && !_tools_was_all(tools_raw)) {
21270
21496
  return [false, "explicit --tools= selection (headless install)"];
@@ -21300,7 +21526,7 @@ function unlinkMissingOk(p) {
21300
21526
  }
21301
21527
  function pidAlive(pid) {
21302
21528
  try {
21303
- process3.kill(pid, 0);
21529
+ process4.kill(pid, 0);
21304
21530
  return true;
21305
21531
  } catch (err) {
21306
21532
  return err.code === "EPERM";
@@ -21325,7 +21551,7 @@ function _kill_stale_wizard_server() {
21325
21551
  }
21326
21552
  if (!_pid_is_agent_config(pid)) return;
21327
21553
  try {
21328
- process3.kill(pid, "SIGTERM");
21554
+ process4.kill(pid, "SIGTERM");
21329
21555
  } catch {
21330
21556
  unlinkMissingOk(p);
21331
21557
  return;
@@ -21340,12 +21566,12 @@ function _kill_stale_wizard_server() {
21340
21566
  }
21341
21567
  if (!exited) {
21342
21568
  try {
21343
- process3.kill(pid, "SIGKILL");
21569
+ process4.kill(pid, "SIGKILL");
21344
21570
  } catch {
21345
21571
  }
21346
21572
  }
21347
21573
  unlinkMissingOk(p);
21348
- process3.stdout.write("(Stopped the previous wizard server.)\n");
21574
+ process4.stdout.write("(Stopped the previous wizard server.)\n");
21349
21575
  }
21350
21576
  function sleepMs(ms) {
21351
21577
  const end = Date.now() + ms;
@@ -21358,7 +21584,7 @@ function _wizard_spawn(project_root, pass_project_root = true) {
21358
21584
  _kill_stale_wizard_server();
21359
21585
  const cli = _wizard_cli_dist(project_root);
21360
21586
  if (cli === null) {
21361
- process3.stdout.write(
21587
+ process4.stdout.write(
21362
21588
  "(Wizard not available \u2014 CLI bundle not built. Run 'npm run build' at the package root to produce dist/cli/.)\n"
21363
21589
  );
21364
21590
  return 0;
@@ -21367,14 +21593,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
21367
21593
  if (pass_project_root) {
21368
21594
  cmd.push("--project-root", project_root);
21369
21595
  }
21370
- const env = { ...process3.env };
21596
+ const env = { ...process4.env };
21371
21597
  return _wizard_run_sync(cmd, env, cli);
21372
21598
  }
21373
21599
  function _wizard_run_sync(cmd, env, cli) {
21374
21600
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
21375
21601
  const log_path = path21.join(
21376
21602
  os8.tmpdir(),
21377
- `agent-config-wizard-${process3.pid}-${Date.now()}.log`
21603
+ `agent-config-wizard-${process4.pid}-${Date.now()}.log`
21378
21604
  );
21379
21605
  let child;
21380
21606
  let log_fd = null;
@@ -21389,7 +21615,7 @@ function _wizard_run_sync(cmd, env, cli) {
21389
21615
  });
21390
21616
  child.unref();
21391
21617
  } catch (exc) {
21392
- process3.stdout.write(
21618
+ process4.stdout.write(
21393
21619
  `(Wizard failed to start: ${String(exc)}; run 'node ${cli} install --no-open' manually.)
21394
21620
  `
21395
21621
  );
@@ -21428,7 +21654,7 @@ function _wizard_run_sync(cmd, env, cli) {
21428
21654
  if (matched_url === null) {
21429
21655
  const logLines = read_log().split("\n").filter((l) => l !== "");
21430
21656
  const tail = logLines.length ? logLines.slice(-20).join("\n ") : "(no output captured)";
21431
- process3.stdout.write(
21657
+ process4.stdout.write(
21432
21658
  `(Wizard server did not report ready within ${Math.trunc(total)}s; run 'node ${cli} install --no-open' manually.)
21433
21659
  Last output:
21434
21660
  ${tail}
@@ -21436,49 +21662,49 @@ function _wizard_run_sync(cmd, env, cli) {
21436
21662
  );
21437
21663
  return 0;
21438
21664
  }
21439
- process3.stdout.write("\n");
21440
- process3.stdout.write(`Setup wizard ready: ${matched_url}
21665
+ process4.stdout.write("\n");
21666
+ process4.stdout.write(`Setup wizard ready: ${matched_url}
21441
21667
  `);
21442
21668
  _openBrowser(matched_url);
21443
- process3.stdout.write(
21669
+ process4.stdout.write(
21444
21670
  "(Wizard server keeps running in the background \u2014 finish the wizard in the browser tab; the next install run stops any stale server.)\n"
21445
21671
  );
21446
21672
  return 0;
21447
21673
  }
21448
21674
  function _openBrowser(url) {
21449
21675
  try {
21450
- const opener = process3.platform === "darwin" ? ["open", [url]] : process3.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
21676
+ const opener = process4.platform === "darwin" ? ["open", [url]] : process4.platform === "win32" ? ["cmd", ["/c", "start", "", url]] : ["xdg-open", [url]];
21451
21677
  spawnSync2(opener[0], opener[1], { stdio: "ignore" });
21452
21678
  } catch {
21453
21679
  }
21454
21680
  }
21455
21681
  function _dry_run_summary(opts) {
21456
21682
  const target = resolvePath(
21457
- opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
21683
+ opts.custom_path || opts.project || process4.env["PROJECT_ROOT"] || process4.cwd()
21458
21684
  );
21459
21685
  const [will_launch, why_not] = _wizard_should_launch(opts);
21460
- process3.stdout.write("\n");
21461
- process3.stdout.write("[dry-run] Plan summary \u2014 no files written, no subprocesses spawned:\n");
21462
- process3.stdout.write(` profile: ${opts.profile}
21686
+ process4.stdout.write("\n");
21687
+ process4.stdout.write("[dry-run] Plan summary \u2014 no files written, no subprocesses spawned:\n");
21688
+ process4.stdout.write(` profile: ${opts.profile}
21463
21689
  `);
21464
- process3.stdout.write(` user-type: ${opts.user_type || "(none)"}
21690
+ process4.stdout.write(` user-type: ${opts.user_type || "(none)"}
21465
21691
  `);
21466
- process3.stdout.write(` scope: ${opts.scope || (opts.global_install ? "global" : "auto")}
21692
+ process4.stdout.write(` scope: ${opts.scope || (opts.global_install ? "global" : "auto")}
21467
21693
  `);
21468
- process3.stdout.write(` tools: ${opts.tools || "all"}
21694
+ process4.stdout.write(` tools: ${opts.tools || "all"}
21469
21695
  `);
21470
- process3.stdout.write(` target: ${target}
21696
+ process4.stdout.write(` target: ${target}
21471
21697
  `);
21472
- process3.stdout.write(` minimal: ${pyBool(opts.minimal)}
21698
+ process4.stdout.write(` minimal: ${pyBool(opts.minimal)}
21473
21699
  `);
21474
- process3.stdout.write(` force: ${pyBool(opts.force)}
21700
+ process4.stdout.write(` force: ${pyBool(opts.force)}
21475
21701
  `);
21476
- process3.stdout.write(` offline: ${pyBool(opts.offline)}
21702
+ process4.stdout.write(` offline: ${pyBool(opts.offline)}
21477
21703
  `);
21478
21704
  if (will_launch) {
21479
- process3.stdout.write(" wizard: Would auto-launch (pass --no-ui to suppress).\n");
21705
+ process4.stdout.write(" wizard: Would auto-launch (pass --no-ui to suppress).\n");
21480
21706
  } else {
21481
- process3.stdout.write(` wizard: Suppressed (${why_not}).
21707
+ process4.stdout.write(` wizard: Suppressed (${why_not}).
21482
21708
  `);
21483
21709
  }
21484
21710
  if (opts.global_install) {
@@ -21492,21 +21718,21 @@ function _dry_run_summary(opts) {
21492
21718
  preview = {};
21493
21719
  }
21494
21720
  const total = Object.values(preview).reduce((a, v) => a + v.length, 0);
21495
- process3.stdout.write("\n");
21721
+ process4.stdout.write("\n");
21496
21722
  if (total === 0) {
21497
- process3.stdout.write(" reap (cleanup): nothing to reap \u2014 no stale deployed files.\n");
21723
+ process4.stdout.write(" reap (cleanup): nothing to reap \u2014 no stale deployed files.\n");
21498
21724
  } else {
21499
- process3.stdout.write(` reap (cleanup): would remove ${total} stale file(s):
21725
+ process4.stdout.write(` reap (cleanup): would remove ${total} stale file(s):
21500
21726
  `);
21501
21727
  for (const tool_id of Object.keys(preview).sort()) {
21502
21728
  for (const p of preview[tool_id]) {
21503
- process3.stdout.write(` ${tool_id}: ${p}
21729
+ process4.stdout.write(` ${tool_id}: ${p}
21504
21730
  `);
21505
21731
  }
21506
21732
  }
21507
21733
  }
21508
21734
  }
21509
- process3.stdout.write("\n");
21735
+ process4.stdout.write("\n");
21510
21736
  return 0;
21511
21737
  }
21512
21738
  function pyBool(v) {
@@ -21515,45 +21741,45 @@ function pyBool(v) {
21515
21741
  function _apply_payload_preview(payload, opts) {
21516
21742
  const schema_version = payload["schema_version"] ?? "<missing>";
21517
21743
  const target = resolvePath(
21518
- opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
21744
+ opts.custom_path || opts.project || process4.env["PROJECT_ROOT"] || process4.cwd()
21519
21745
  );
21520
- process3.stdout.write("\n");
21521
- process3.stdout.write(
21746
+ process4.stdout.write("\n");
21747
+ process4.stdout.write(
21522
21748
  "[apply-payload] Plan summary \u2014 no files written, no subprocesses spawned:\n"
21523
21749
  );
21524
- process3.stdout.write(` schema: ${schema_version}
21750
+ process4.stdout.write(` schema: ${schema_version}
21525
21751
  `);
21526
21752
  if (schema_version === "wizard-v2") {
21527
21753
  const tools = payload["tools"] || [];
21528
21754
  const packs = payload["packs"] || [];
21529
21755
  const settings = payload["settings"] || {};
21530
21756
  const scope_to_project = Boolean(payload["scope_to_project_only"] ?? false);
21531
- process3.stdout.write(` tools: ${tools.length ? tools.join(",") : "(none)"}
21757
+ process4.stdout.write(` tools: ${tools.length ? tools.join(",") : "(none)"}
21532
21758
  `);
21533
- process3.stdout.write(` packs: ${packs.length ? packs.join(",") : "(base)"}
21759
+ process4.stdout.write(` packs: ${packs.length ? packs.join(",") : "(base)"}
21534
21760
  `);
21535
- process3.stdout.write(` settings: ${Object.keys(settings).length} top-level key(s)
21761
+ process4.stdout.write(` settings: ${Object.keys(settings).length} top-level key(s)
21536
21762
  `);
21537
- process3.stdout.write(` scope: ${scope_to_project ? "project" : "global"}
21763
+ process4.stdout.write(` scope: ${scope_to_project ? "project" : "global"}
21538
21764
  `);
21539
21765
  } else if (schema_version === "installer-v1") {
21540
21766
  const ai_tools = payload["ai_tools"] || [];
21541
21767
  const configs = payload["configs"] || {};
21542
- process3.stdout.write(` ai_tools: ${ai_tools.length ? ai_tools.join(",") : "(none)"}
21768
+ process4.stdout.write(` ai_tools: ${ai_tools.length ? ai_tools.join(",") : "(none)"}
21543
21769
  `);
21544
- process3.stdout.write(` configs: ${Object.keys(configs).length} tool config(s)
21770
+ process4.stdout.write(` configs: ${Object.keys(configs).length} tool config(s)
21545
21771
  `);
21546
21772
  } else {
21547
- process3.stdout.write(` error: unsupported schema_version: ${pyRepr(schema_version)}
21773
+ process4.stdout.write(` error: unsupported schema_version: ${pyRepr(schema_version)}
21548
21774
  `);
21549
- process3.stdout.write("\n");
21775
+ process4.stdout.write("\n");
21550
21776
  return 2;
21551
21777
  }
21552
- process3.stdout.write(` target: ${target}
21778
+ process4.stdout.write(` target: ${target}
21553
21779
  `);
21554
- process3.stdout.write(` dry_run: ${pyBool(Boolean(payload["dry_run"] ?? opts.dry_run))}
21780
+ process4.stdout.write(` dry_run: ${pyBool(Boolean(payload["dry_run"] ?? opts.dry_run))}
21555
21781
  `);
21556
- process3.stdout.write("\n");
21782
+ process4.stdout.write("\n");
21557
21783
  return 0;
21558
21784
  }
21559
21785
  function pyRepr(v) {
@@ -21626,8 +21852,8 @@ function main2(argv) {
21626
21852
  state.QUIET = true;
21627
21853
  }
21628
21854
  if (opts.offline) {
21629
- process3.env["AGENT_CONFIG_OFFLINE"] = "1";
21630
- process3.env["AGENT_CONFIG_NO_UPDATE_CHECK"] = "1";
21855
+ process4.env["AGENT_CONFIG_OFFLINE"] = "1";
21856
+ process4.env["AGENT_CONFIG_NO_UPDATE_CHECK"] = "1";
21631
21857
  }
21632
21858
  if (!SUPPORTED_PROFILES.includes(opts.profile)) {
21633
21859
  fail(`Unsupported profile: ${opts.profile}. Supported: ${SUPPORTED_PROFILES.join(", ")}`);
@@ -21645,7 +21871,7 @@ function main2(argv) {
21645
21871
  }
21646
21872
  if (opts.minimal) {
21647
21873
  const target_root = resolvePath(
21648
- opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
21874
+ opts.custom_path || opts.project || process4.env["PROJECT_ROOT"] || process4.cwd()
21649
21875
  );
21650
21876
  const minimal_package_root = path21.dirname(
21651
21877
  path21.dirname(path21.dirname(_minimal_templates_root()))
@@ -21653,7 +21879,7 @@ function main2(argv) {
21653
21879
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
21654
21880
  return install_minimal(target_root, opts.force, validated_user_type);
21655
21881
  }
21656
- const detect_root = resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
21882
+ const detect_root = resolvePath(opts.project || process4.env["PROJECT_ROOT"] || process4.cwd());
21657
21883
  const [detected, detect_reason] = detect_scope(detect_root);
21658
21884
  const custom_path = opts.custom_path ? resolvePath(opts.custom_path) : null;
21659
21885
  const scope = _resolve_scope(opts, detected, detect_reason, custom_path);
@@ -21679,7 +21905,7 @@ function main2(argv) {
21679
21905
  }
21680
21906
  return rc2;
21681
21907
  }
21682
- const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
21908
+ const project_root = custom_path || resolvePath(opts.project || process4.env["PROJECT_ROOT"] || process4.cwd());
21683
21909
  const is_first_run = !pathExists(path21.join(project_root, SETTINGS_FILE));
21684
21910
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
21685
21911
  if (rc === 0 && opts.interactive) {
@@ -21689,7 +21915,7 @@ function main2(argv) {
21689
21915
  return rc;
21690
21916
  }
21691
21917
  function _propose_modules_config(project_root, is_first_run) {
21692
- if (!is_first_run || state.QUIET || !process3.stdin.isTTY || !process3.stdout.isTTY) return;
21918
+ if (!is_first_run || state.QUIET || !process4.stdin.isTTY || !process4.stdout.isTTY) return;
21693
21919
  let candidates;
21694
21920
  try {
21695
21921
  candidates = detect_module_roots(project_root);
@@ -21697,21 +21923,21 @@ function _propose_modules_config(project_root, is_first_run) {
21697
21923
  return;
21698
21924
  }
21699
21925
  if (!candidates || candidates.length === 0) return;
21700
- process3.stdout.write("\n");
21926
+ process4.stdout.write("\n");
21701
21927
  info("Module-root candidates detected \u2014 propose `modules:` block");
21702
21928
  info("Paste into .agent-project-settings.yml to enable module-aware skills (or skip; the block stays opt-in).");
21703
- process3.stdout.write("\n");
21704
- process3.stdout.write(" modules:\n");
21705
- process3.stdout.write(" enabled: true\n");
21706
- process3.stdout.write(" root_paths: [" + candidates.map((c) => c.path).join(", ") + "]\n");
21929
+ process4.stdout.write("\n");
21930
+ process4.stdout.write(" modules:\n");
21931
+ process4.stdout.write(" enabled: true\n");
21932
+ process4.stdout.write(" root_paths: [" + candidates.map((c) => c.path).join(", ") + "]\n");
21707
21933
  const primary_ns = candidates.find((c) => c.namespace_template_guess)?.namespace_template_guess ?? "";
21708
21934
  if (primary_ns) {
21709
- process3.stdout.write(` namespace_template: '${primary_ns}'
21935
+ process4.stdout.write(` namespace_template: '${primary_ns}'
21710
21936
  `);
21711
21937
  }
21712
- process3.stdout.write(" agent_folder: agents\n");
21713
- process3.stdout.write(" skip_dirs: [.module-template, .example]\n");
21714
- process3.stdout.write("\n");
21938
+ process4.stdout.write(" agent_folder: agents\n");
21939
+ process4.stdout.write(" skip_dirs: [.module-template, .example]\n");
21940
+ process4.stdout.write("\n");
21715
21941
  info(
21716
21942
  "Re-run anytime via `./scripts-run src/scripts/propose_modules_config` (installed under <package>/src/scripts/)."
21717
21943
  );
@@ -21804,14 +22030,14 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21804
22030
  package_type = detect_package_type(package_root);
21805
22031
  }
21806
22032
  if (!state.QUIET) {
21807
- process3.stdout.write("\n");
22033
+ process4.stdout.write("\n");
21808
22034
  info("Agent Config \u2014 Project Bridge Installer");
21809
22035
  info(`Project: ${project_root}`);
21810
22036
  info(`Package: ${package_root}`);
21811
22037
  info(`Type: ${package_type}`);
21812
22038
  info(`Profile: ${opts.profile}`);
21813
22039
  if (opts.user_type) info(`UserType: ${opts.user_type}`);
21814
- process3.stdout.write("\n");
22040
+ process4.stdout.write("\n");
21815
22041
  }
21816
22042
  ensure_agent_settings(project_root, package_root, opts.profile, opts.force, opts.user_type, opts.packs ?? null);
21817
22043
  _write_install_mode_marker(project_root, "full");
@@ -21823,11 +22049,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21823
22049
  ...ensure_augment_bridge(project_root, opts.force)
21824
22050
  ];
21825
22051
  if (_is_tool_enabled(tools, "claude-code")) {
21826
- merged_keys_by_tool["claude-code"] = [
21827
- ...ensure_claude_bridge(project_root, opts.force),
21828
- ...ensure_mcp_bridge(project_root, opts.force)
21829
- ];
22052
+ merged_keys_by_tool["claude-code"] = ensure_claude_bridge(project_root, opts.force);
21830
22053
  }
22054
+ registerMcpHosts(merge_json_file, project_root, opts.force, package_root, tools, merged_keys_by_tool);
21831
22055
  if (_is_tool_enabled(tools, "cursor")) {
21832
22056
  merged_keys_by_tool["cursor"] = ensure_cursor_bridge(project_root, opts.force);
21833
22057
  }
@@ -21877,7 +22101,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21877
22101
  }
21878
22102
  if (!opts.skip_bridges && !opts.no_smoke) {
21879
22103
  if (!state.QUIET) {
21880
- process3.stdout.write("\n");
22104
+ process4.stdout.write("\n");
21881
22105
  info("Smoke-testing installed hook bridges (dry-run)");
21882
22106
  }
21883
22107
  _smoke_test_hooks(project_root, package_root);
@@ -21898,34 +22122,35 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21898
22122
  finalize_claude_model_tiers(project_root);
21899
22123
  }
21900
22124
  if (!state.QUIET) {
21901
- process3.stdout.write("\n");
22125
+ process4.stdout.write("\n");
21902
22126
  success("Done.");
21903
22127
  if (is_first_run) {
21904
- process3.stdout.write("\n");
21905
- process3.stdout.write(" Try these 3 prompts with your agent:\n");
21906
- process3.stdout.write(' 1. "Refactor this function" \u2192 agent analyzes first\n');
21907
- process3.stdout.write(' 2. "Add caching to this" \u2192 agent asks instead of guessing\n');
21908
- process3.stdout.write(' 3. "Implement this feature" \u2192 agent respects your codebase\n');
21909
- process3.stdout.write("\n");
21910
- process3.stdout.write(" Next steps:\n");
21911
- process3.stdout.write(" \u2022 Commit .agent-settings.yml and bridge files to your repo\n");
21912
- process3.stdout.write(" \u2022 New team members run `npx @event4u/agent-config init` \u2014 done\n");
21913
- process3.stdout.write(" \u2022 Inspect hook coverage: ./agent-config hooks:status\n");
21914
- process3.stdout.write(
22128
+ process4.stdout.write("\n");
22129
+ process4.stdout.write(" Try these 3 prompts with your agent:\n");
22130
+ process4.stdout.write(' 1. "Refactor this function" \u2192 agent analyzes first\n');
22131
+ process4.stdout.write(' 2. "Add caching to this" \u2192 agent asks instead of guessing\n');
22132
+ process4.stdout.write(' 3. "Implement this feature" \u2192 agent respects your codebase\n');
22133
+ process4.stdout.write("\n");
22134
+ process4.stdout.write(" Next steps:\n");
22135
+ process4.stdout.write(" \u2022 Commit .agent-settings.yml and bridge files to your repo\n");
22136
+ process4.stdout.write(" \u2022 New team members run `npx @event4u/agent-config init` \u2014 done\n");
22137
+ process4.stdout.write(" \u2022 Inspect hook coverage: ./agent-config hooks:status\n");
22138
+ process4.stdout.write(
21915
22139
  " \u2022 Full walkthrough: https://github.com/event4u-app/agent-config/blob/main/docs/getting-started.md\n"
21916
22140
  );
21917
- process3.stdout.write("\n");
22141
+ process4.stdout.write("\n");
21918
22142
  } else {
21919
- process3.stdout.write(
22143
+ process4.stdout.write(
21920
22144
  " Re-run complete. Walkthrough: https://github.com/event4u-app/agent-config/blob/main/docs/getting-started.md\n"
21921
22145
  );
21922
- process3.stdout.write("\n");
22146
+ process4.stdout.write("\n");
21923
22147
  }
22148
+ printResiduals(tools, state.QUIET);
21924
22149
  if (_is_tool_enabled(tools, "claude-code")) {
21925
22150
  const team_hint = _team_setup_hint_line(project_root);
21926
22151
  if (team_hint !== null) {
21927
- process3.stdout.write(team_hint + "\n");
21928
- process3.stdout.write("\n");
22152
+ process4.stdout.write(team_hint + "\n");
22153
+ process4.stdout.write("\n");
21929
22154
  }
21930
22155
  }
21931
22156
  }
@@ -21937,21 +22162,21 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
21937
22162
  return 0;
21938
22163
  }
21939
22164
  function _resolvedArgv1() {
21940
- if (process3.argv[1] === void 0) return void 0;
22165
+ if (process4.argv[1] === void 0) return void 0;
21941
22166
  try {
21942
- return fs24.realpathSync(path21.resolve(process3.argv[1]));
22167
+ return fs24.realpathSync(path21.resolve(process4.argv[1]));
21943
22168
  } catch {
21944
- return path21.resolve(process3.argv[1]);
22169
+ return path21.resolve(process4.argv[1]);
21945
22170
  }
21946
22171
  }
21947
22172
  var _argv1 = _resolvedArgv1();
21948
22173
  var _isCliEntry2 = _argv1 !== void 0 && import.meta.url === pathToFileURL2(_argv1).href;
21949
22174
  if (_isCliEntry2 || _argv1 === _HERE2) {
21950
22175
  try {
21951
- process3.exitCode = main2(process3.argv.slice(2));
22176
+ process4.exitCode = main2(process4.argv.slice(2));
21952
22177
  } catch (e) {
21953
22178
  if (e instanceof SystemExitError || e instanceof ArgparseExit2) {
21954
- process3.exitCode = e.code;
22179
+ process4.exitCode = e.code;
21955
22180
  } else {
21956
22181
  throw e;
21957
22182
  }