@event4u/agent-config 9.10.0 → 9.12.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 (142) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +111 -0
  3. package/README.md +20 -16
  4. package/agents/templates/.ai-council.yml.example +481 -0
  5. package/agents/templates/.ai-video.xml.example +247 -0
  6. package/dist/agent-src/commands/fix/ci.md +29 -0
  7. package/dist/agent-src/commands/pr/create.md +60 -0
  8. package/dist/agent-src/contexts/authority/kernel-rule-edits.md +18 -2
  9. package/dist/agent-src/rules/design-fidelity.md +2 -2
  10. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +1 -0
  11. package/dist/agent-src/skills/design-intelligence/SKILL.md +27 -1
  12. package/dist/agent-src/skills/design-intelligence/data/font-pairings-reference.csv +74 -74
  13. package/dist/agent-src/skills/design-intelligence/data/manifest.json +2 -0
  14. package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +0 -7
  15. package/dist/agent-src/skills/existing-ui-audit/SKILL.md +15 -2
  16. package/dist/agent-src/skills/fe-design/SKILL.md +10 -0
  17. package/dist/agent-src/skills/typography-system/SKILL.md +55 -11
  18. package/dist/agent-src/skills/ui-apply-generic/SKILL.md +180 -0
  19. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  20. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +34 -30
  21. package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
  22. package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +23 -0
  23. package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +24 -1
  24. package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +332 -0
  25. package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +449 -11
  26. package/dist/agent-src/templates/scripts/work_engine/state.ts +21 -4
  27. package/dist/cli/initRouting.js +74 -11
  28. package/dist/cli/initRouting.js.map +1 -1
  29. package/dist/cli/main.js +14 -3
  30. package/dist/cli/main.js.map +1 -1
  31. package/dist/cli-delegate/chunk-523HCFYO.js +90 -0
  32. package/dist/cli-delegate/chunk-736JCWLM.js +1104 -0
  33. package/dist/cli-delegate/chunk-7HQ52DHU.js +74 -0
  34. package/dist/cli-delegate/chunk-A3HJ6NTI.js +1084 -0
  35. package/dist/cli-delegate/chunk-EJYIGZ3T.js +125 -0
  36. package/dist/cli-delegate/chunk-FTAISGDQ.js +117 -0
  37. package/dist/cli-delegate/chunk-GME3Q44L.js +82 -0
  38. package/dist/cli-delegate/chunk-GRRPEPRN.js +336 -0
  39. package/dist/cli-delegate/chunk-HJ6DAJHR.js +502 -0
  40. package/dist/cli-delegate/chunk-HYWSRNUX.js +179 -0
  41. package/dist/cli-delegate/chunk-J55WI3RR.js +47 -0
  42. package/dist/cli-delegate/chunk-MCJYCQPF.js +35 -0
  43. package/dist/cli-delegate/chunk-NDJLNC6Q.js +169 -0
  44. package/dist/cli-delegate/chunk-OMIVVCG2.js +26 -0
  45. package/dist/cli-delegate/chunk-OY53J6II.js +7336 -0
  46. package/dist/cli-delegate/chunk-QFKQLQ7X.js +10835 -0
  47. package/dist/cli-delegate/chunk-TEGJU2JX.js +6908 -0
  48. package/dist/cli-delegate/chunk-TJIAM5FW.js +133 -0
  49. package/dist/cli-delegate/chunk-XX6TOPD7.js +715 -0
  50. package/dist/cli-delegate/cmd_analyze_session.js +294 -0
  51. package/dist/cli-delegate/cmd_conformance.js +643 -0
  52. package/dist/cli-delegate/cmd_converge.js +326 -0
  53. package/dist/cli-delegate/cmd_doctor.js +142 -0
  54. package/dist/cli-delegate/cmd_explain.js +2576 -0
  55. package/dist/cli-delegate/cmd_export.js +298 -0
  56. package/dist/cli-delegate/cmd_fleet.js +333 -0
  57. package/dist/cli-delegate/cmd_memory_get.js +3878 -0
  58. package/dist/cli-delegate/cmd_migrate.js +11 -0
  59. package/dist/cli-delegate/cmd_preflight.js +153 -0
  60. package/dist/cli-delegate/cmd_prune.js +446 -0
  61. package/dist/cli-delegate/cmd_refresh.js +28 -0
  62. package/dist/cli-delegate/cmd_settings_check.js +574 -0
  63. package/dist/cli-delegate/cmd_settings_migrate.js +225 -0
  64. package/dist/cli-delegate/cmd_sync.js +266 -0
  65. package/dist/cli-delegate/cmd_uninstall.js +657 -0
  66. package/dist/cli-delegate/cmd_update.js +425 -0
  67. package/dist/cli-delegate/cmd_upgrade.js +444 -0
  68. package/dist/cli-delegate/cmd_validate.js +307 -0
  69. package/dist/cli-delegate/cmd_versions.js +370 -0
  70. package/dist/discovery/deprecation-report.md +1 -1
  71. package/dist/discovery/discovery-manifest.json +45 -16
  72. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  73. package/dist/discovery/discovery-manifest.summary.md +3 -3
  74. package/dist/discovery/orphan-report.md +1 -1
  75. package/dist/discovery/packs.json +13 -7
  76. package/dist/discovery/trust-report.md +2 -2
  77. package/dist/discovery/workspaces.json +6 -4
  78. package/dist/install/emit_host_rules_cli.js +2 -1
  79. package/dist/install/emit_host_rules_cli.js.map +1 -1
  80. package/dist/install/install.mjs +634 -409
  81. package/dist/install/ruleInScope.js +123 -0
  82. package/dist/install/ruleInScope.js.map +1 -0
  83. package/dist/install/rule_scope.js +7 -3
  84. package/dist/install/rule_scope.js.map +1 -1
  85. package/dist/install/toolDetection.js +40 -12
  86. package/dist/install/toolDetection.js.map +1 -1
  87. package/dist/install/wizard-plan.js +12 -3
  88. package/dist/install/wizard-plan.js.map +1 -1
  89. package/dist/mcp/registry-manifest.json +3 -3
  90. package/dist/mcp/server.json +2 -2
  91. package/dist/mcp/server.mjs +1553 -2728
  92. package/dist/router.json +1 -1
  93. package/dist/scripts/condense.js +6 -22
  94. package/dist/scripts/condense.js.map +1 -1
  95. package/docs/guidelines/design-fidelity-mechanics.md +14 -0
  96. package/package.json +4 -2
  97. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +34 -30
  98. package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +88 -33
  99. package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +23 -0
  100. package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +24 -1
  101. package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +332 -0
  102. package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +449 -11
  103. package/src/agent-src/templates/scripts/work_engine/state.ts +21 -4
  104. package/src/config/discovery/packs.yml +7 -0
  105. package/src/config/evaluator-budgets.json +1 -1
  106. package/src/config/pack-size-budget.json +27 -0
  107. package/src/install/emit_host_rules_cli.ts +2 -1
  108. package/src/install/ruleInScope.ts +133 -0
  109. package/src/install/rule_scope.ts +7 -3
  110. package/src/install/toolDetection.ts +39 -8
  111. package/src/install/wizard-plan.ts +13 -3
  112. package/src/scripts/_cli/cmd_conformance.ts +2 -1
  113. package/src/scripts/_cli/cmd_converge.ts +2 -1
  114. package/src/scripts/_cli/cmd_doctor.ts +214 -13
  115. package/src/scripts/_cli/cmd_export.ts +2 -1
  116. package/src/scripts/_cli/cmd_fleet.ts +2 -1
  117. package/src/scripts/_cli/cmd_migrate.ts +2 -1
  118. package/src/scripts/_cli/cmd_preflight.ts +2 -1
  119. package/src/scripts/_cli/cmd_refresh.ts +2 -1
  120. package/src/scripts/_cli/cmd_update.ts +2 -1
  121. package/src/scripts/_cli/cmd_upgrade.ts +2 -1
  122. package/src/scripts/_cli/cmd_versions.ts +2 -1
  123. package/src/scripts/_cli/detection_report.ts +480 -0
  124. package/src/scripts/_dispatch.bash +52 -14
  125. package/src/scripts/_lib/changelog_eras.ts +103 -9
  126. package/src/scripts/_lib/environment_detector.ts +441 -0
  127. package/src/scripts/_lib/global_deploy_inventory.ts +38 -2
  128. package/src/scripts/_lib/package_root.ts +72 -0
  129. package/src/scripts/ai_council/config.ts +15 -7
  130. package/src/scripts/ai_council/modes.ts +68 -2
  131. package/src/scripts/ai_council/transport_resolver.ts +331 -0
  132. package/src/scripts/check_bundle_path_leakage.ts +10 -4
  133. package/src/scripts/check_dependency_floors.ts +153 -0
  134. package/src/scripts/check_installer_import_purity.ts +295 -0
  135. package/src/scripts/check_pack_size.ts +188 -0
  136. package/src/scripts/condense.ts +7 -28
  137. package/src/scripts/council_cli.ts +6 -2
  138. package/src/scripts/evaluator_umbrella.sh +34 -1
  139. package/src/scripts/install-hooks.sh +36 -4
  140. package/src/scripts/install.ts +210 -5
  141. package/src/scripts/lint_eval_fixture_citations.ts +113 -0
  142. package/src/scripts/lint_ui_stack_bundles.ts +201 -0
@@ -0,0 +1,444 @@
1
+ #!/usr/bin/env tsx
2
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
3
+ import {
4
+ _is_newer,
5
+ fetch_latest_from_npm
6
+ } from "./chunk-7HQ52DHU.js";
7
+ import {
8
+ CLAUDE_MARKETPLACE_NAME,
9
+ CLAUDE_PLUGIN_ID,
10
+ claude_plugin_installed
11
+ } from "./chunk-FTAISGDQ.js";
12
+ import {
13
+ _is_source_repo,
14
+ install_cli_wrapper,
15
+ needs_refresh
16
+ } from "./chunk-736JCWLM.js";
17
+ import {
18
+ read_lockfile
19
+ } from "./chunk-GRRPEPRN.js";
20
+ import {
21
+ project_settings_path
22
+ } from "./chunk-HJ6DAJHR.js";
23
+ import {
24
+ event4u_root,
25
+ write_target
26
+ } from "./chunk-NDJLNC6Q.js";
27
+ import {
28
+ resolvePackageRoot
29
+ } from "./chunk-MCJYCQPF.js";
30
+ import "./chunk-J55WI3RR.js";
31
+
32
+ // src/scripts/_cli/cmd_upgrade.ts
33
+ import * as fs from "node:fs";
34
+ import * as path from "node:path";
35
+ import { spawnSync } from "node:child_process";
36
+ import process from "node:process";
37
+ import { fileURLToPath, pathToFileURL } from "node:url";
38
+ var PACKAGE_NAME = "@event4u/agent-config";
39
+ var PACKAGE_ROOT = resolvePackageRoot(import.meta.url);
40
+ var _HERE = fileURLToPath(import.meta.url);
41
+ var ArgparseExit = class extends Error {
42
+ constructor(code) {
43
+ super(`argparse-exit-${code}`);
44
+ this.code = code;
45
+ }
46
+ code;
47
+ };
48
+ var _stdout = { write: (t) => process.stdout.write(t) };
49
+ var _stderr = { write: (t) => process.stderr.write(t) };
50
+ function _print(out, line = "") {
51
+ out.write(line + "\n");
52
+ }
53
+ function _isFile(p) {
54
+ try {
55
+ return fs.statSync(p).isFile();
56
+ } catch {
57
+ return false;
58
+ }
59
+ }
60
+ function shutilWhich(name) {
61
+ const isExe = (p) => {
62
+ try {
63
+ const st = fs.statSync(p);
64
+ if (!st.isFile()) return false;
65
+ if (process.platform === "win32") return true;
66
+ fs.accessSync(p, fs.constants.X_OK);
67
+ return true;
68
+ } catch {
69
+ return false;
70
+ }
71
+ };
72
+ if (name.includes("/") || name.includes("\\")) {
73
+ return isExe(name) ? name : null;
74
+ }
75
+ const pathEnv = process.env["PATH"] || "";
76
+ const sep = process.platform === "win32" ? ";" : ":";
77
+ const exts = process.platform === "win32" ? (process.env["PATHEXT"] || ".COM;.EXE;.BAT;.CMD").split(";") : [""];
78
+ const seen = /* @__PURE__ */ new Set();
79
+ for (const dir of pathEnv.split(sep)) {
80
+ const d = dir === "" ? "." : dir;
81
+ if (seen.has(d)) continue;
82
+ seen.add(d);
83
+ for (const ext of exts) {
84
+ const candidate = path.join(d, name + ext);
85
+ if (isExe(candidate)) {
86
+ return candidate;
87
+ }
88
+ }
89
+ }
90
+ return null;
91
+ }
92
+ function _default_runner(cmd) {
93
+ const r = spawnSync(cmd[0], cmd.slice(1), { stdio: "inherit" });
94
+ if (r.error) {
95
+ _stderr.write(`agent-config upgrade: cannot run ${cmd[0]}: ${osErrorStr(r.error)}
96
+ `);
97
+ return 1;
98
+ }
99
+ return r.status ?? 1;
100
+ }
101
+ function osErrorStr(exc) {
102
+ if (exc && typeof exc === "object" && "message" in exc) {
103
+ return String(exc.message);
104
+ }
105
+ return String(exc);
106
+ }
107
+ function lstripV(s) {
108
+ let out = s;
109
+ while (out.length > 0 && out[0] === "v") {
110
+ out = out.slice(1);
111
+ }
112
+ return out;
113
+ }
114
+ function _installed_version() {
115
+ const lock = read_lockfile();
116
+ if (lock !== null && typeof lock === "object") {
117
+ const v = lock["agent_config_version"];
118
+ if (typeof v === "string" && v) {
119
+ return lstripV(v.trim());
120
+ }
121
+ }
122
+ return "";
123
+ }
124
+ function _agent_config_bin() {
125
+ return shutilWhich("agent-config") ?? path.join(PACKAGE_ROOT, "agent-config");
126
+ }
127
+ function _maybe_refresh_project_wrapper(project_root, out, _err) {
128
+ if (_is_source_repo(project_root)) {
129
+ return;
130
+ }
131
+ if (!_isFile(path.join(project_root, "agent-config"))) {
132
+ return;
133
+ }
134
+ if (!needs_refresh(project_root)) {
135
+ return;
136
+ }
137
+ const wrapper = install_cli_wrapper(project_root);
138
+ if (wrapper !== null) {
139
+ _print(out, `\u2705 refreshed stale project wrapper: ${wrapper}`);
140
+ }
141
+ }
142
+ function _maybe_refresh_git_hook(project_root, runner, out, err) {
143
+ const hook = path.join(project_root, ".git", "hooks", "pre-commit");
144
+ let text;
145
+ try {
146
+ text = fs.readFileSync(hook, "utf-8");
147
+ } catch {
148
+ return;
149
+ }
150
+ if (!text.includes("pre-commit-roadmap-progress")) {
151
+ return;
152
+ }
153
+ const cmd = [_agent_config_bin(), "hooks:install", "--force"];
154
+ _print(out, "\u2192 " + cmd.join(" "));
155
+ let rc;
156
+ try {
157
+ rc = runner(cmd);
158
+ } catch (exc) {
159
+ rc = 127;
160
+ _print(err, `cannot run ${cmd[0]}: ${osErrorStr(exc)}`);
161
+ }
162
+ if (rc !== 0) {
163
+ _print(
164
+ err,
165
+ `\u26A0\uFE0F agent-config upgrade: pre-commit hook refresh failed (exit ${rc}) \u2014 run \`agent-config hooks:install --force\` manually.`
166
+ );
167
+ }
168
+ }
169
+ function _settings_sync_targets(project_root) {
170
+ const targets = [];
171
+ const global_settings = path.join(event4u_root(), "settings", ".agent-settings.yml");
172
+ if (_isFile(global_settings)) {
173
+ targets.push(global_settings);
174
+ }
175
+ const project_settings = project_settings_path(project_root);
176
+ if (project_settings !== global_settings && _isFile(project_settings)) {
177
+ targets.push(project_settings);
178
+ }
179
+ return targets;
180
+ }
181
+ function _sync_settings_files(targets, runner, out, err) {
182
+ for (const target of targets) {
183
+ const cmd = [_agent_config_bin(), "settings:sync", "--path", target];
184
+ _print(out, "\u2192 " + cmd.join(" "));
185
+ let rc;
186
+ try {
187
+ rc = runner(cmd);
188
+ } catch (exc) {
189
+ rc = 127;
190
+ _print(err, `cannot run ${cmd[0]}: ${osErrorStr(exc)}`);
191
+ }
192
+ if (rc !== 0) {
193
+ _print(
194
+ err,
195
+ `\u26A0\uFE0F agent-config upgrade: settings sync failed (exit ${rc}) for ${target} \u2014 run \`agent-config settings:sync --path ${target}\` manually.`
196
+ );
197
+ }
198
+ }
199
+ }
200
+ function _claude_plugin_refresh_steps() {
201
+ const claude = shutilWhich("claude");
202
+ if (claude === null) return [];
203
+ if (!claude_plugin_installed()) return [];
204
+ return [
205
+ [claude, "plugin", "marketplace", "update", CLAUDE_MARKETPLACE_NAME],
206
+ [
207
+ claude,
208
+ "plugin",
209
+ "update",
210
+ `${CLAUDE_PLUGIN_ID}@${CLAUDE_MARKETPLACE_NAME}`
211
+ ]
212
+ ];
213
+ }
214
+ function _refresh_claude_plugin(steps, runner, out, err) {
215
+ for (const cmd of steps) {
216
+ _print(out, "\u2192 " + cmd.join(" "));
217
+ let rc;
218
+ try {
219
+ rc = runner(cmd);
220
+ } catch (exc) {
221
+ rc = 127;
222
+ _print(err, `cannot run ${cmd[0]}: ${osErrorStr(exc)}`);
223
+ }
224
+ if (rc !== 0) {
225
+ _print(
226
+ err,
227
+ `\u26A0\uFE0F agent-config upgrade: Claude Code plugin refresh failed (exit ${rc}) \u2014 run \`${cmd.join(" ")}\` manually.`
228
+ );
229
+ return;
230
+ }
231
+ }
232
+ if (steps.length > 0) {
233
+ _print(out, "\u2139\uFE0F Claude Code plugin refreshed \u2014 restart Claude Code to load it.");
234
+ }
235
+ }
236
+ var PROG = "agent-config upgrade";
237
+ var USAGE = `usage: ${PROG} [-h] [--check] [--dry-run] [--converge]
238
+ `;
239
+ function _argError(msg) {
240
+ _stderr.write(USAGE);
241
+ _stderr.write(`${PROG}: error: ${msg}
242
+ `);
243
+ throw new ArgparseExit(2);
244
+ }
245
+ function _parse(argv) {
246
+ const args = { check: false, dry_run: false, converge: false };
247
+ const positionals = [];
248
+ let i = 0;
249
+ while (i < argv.length) {
250
+ const a = argv[i];
251
+ if (a === "-h" || a === "--help") {
252
+ _stdout.write(USAGE);
253
+ throw new ArgparseExit(0);
254
+ }
255
+ const eq = a.startsWith("--") ? a.indexOf("=") : -1;
256
+ const flag = eq >= 0 ? a.slice(0, eq) : a;
257
+ const inlineVal = eq >= 0 ? a.slice(eq + 1) : null;
258
+ if (flag === "--check") {
259
+ if (inlineVal !== null) {
260
+ _argError(`argument --check: ignored explicit argument '${inlineVal}'`);
261
+ }
262
+ args.check = true;
263
+ i += 1;
264
+ continue;
265
+ }
266
+ if (flag === "--dry-run") {
267
+ if (inlineVal !== null) {
268
+ _argError(`argument --dry-run: ignored explicit argument '${inlineVal}'`);
269
+ }
270
+ args.dry_run = true;
271
+ i += 1;
272
+ continue;
273
+ }
274
+ if (flag === "--converge") {
275
+ if (inlineVal !== null) {
276
+ _argError(`argument --converge: ignored explicit argument '${inlineVal}'`);
277
+ }
278
+ args.converge = true;
279
+ i += 1;
280
+ continue;
281
+ }
282
+ if (a.startsWith("-") && a !== "-") {
283
+ _argError(`unrecognized arguments: ${a}`);
284
+ }
285
+ positionals.push(a);
286
+ i += 1;
287
+ }
288
+ if (positionals.length > 0) {
289
+ _argError(`unrecognized arguments: ${positionals.join(" ")}`);
290
+ }
291
+ return args;
292
+ }
293
+ async function main(argv = null, options = {}) {
294
+ const runner = options.runner ?? _default_runner;
295
+ const fetcher = options.fetcher ?? (() => fetch_latest_from_npm());
296
+ const out = options.out ?? _stdout;
297
+ const err = options.err ?? _stderr;
298
+ const args = _parse(argv ?? process.argv.slice(2));
299
+ const installed = options.installed !== void 0 && options.installed !== null ? options.installed : _installed_version();
300
+ const latest = await fetcher() || "";
301
+ if (args.check) {
302
+ if (!latest) {
303
+ _print(
304
+ err,
305
+ "agent-config upgrade: latest version unavailable (registry unreachable)."
306
+ );
307
+ return 0;
308
+ }
309
+ if (installed && !installed_lock_is_newer(latest, installed)) {
310
+ _print(out, `\u2705 agent-config is up to date (${installed}).`);
311
+ } else {
312
+ _print(
313
+ out,
314
+ `\u2139\uFE0F agent-config ${latest} available (installed: ${installed || "unknown"}). Run \`agent-config upgrade\`.`
315
+ );
316
+ }
317
+ return 0;
318
+ }
319
+ const target = `${PACKAGE_NAME}@latest`;
320
+ const npm_cmd = ["npm", "install", "-g", target];
321
+ const global_cmd = [_agent_config_bin(), "global", "--no-ui"];
322
+ const steps = [npm_cmd, global_cmd];
323
+ const project_root = options.project_root ?? process.cwd();
324
+ const sync_targets = _settings_sync_targets(project_root);
325
+ const plugin_steps = _claude_plugin_refresh_steps();
326
+ if (args.dry_run) {
327
+ _print(out, "agent-config upgrade \u2014 dry run, would execute:");
328
+ for (const cmd of steps) {
329
+ _print(out, " " + cmd.join(" "));
330
+ }
331
+ for (const cmd of plugin_steps) {
332
+ _print(out, " " + cmd.join(" "));
333
+ }
334
+ for (const target2 of sync_targets) {
335
+ _print(out, " " + [_agent_config_bin(), "settings:sync", "--path", target2].join(" "));
336
+ }
337
+ return 0;
338
+ }
339
+ _print(out, "\u2192 " + npm_cmd.join(" "));
340
+ const npm_rc = runner(npm_cmd);
341
+ if (npm_rc !== 0) {
342
+ _print(
343
+ err,
344
+ `\u274C agent-config upgrade: step failed (exit ${npm_rc}): ${npm_cmd.join(" ")}`
345
+ );
346
+ return 1;
347
+ }
348
+ const failed_essential = [];
349
+ for (const cmd of steps.slice(1)) {
350
+ _print(out, "\u2192 " + cmd.join(" "));
351
+ const rc = runner(cmd);
352
+ if (rc !== 0) {
353
+ failed_essential.push(cmd.join(" "));
354
+ _print(
355
+ err,
356
+ `\u274C agent-config upgrade: step failed (exit ${rc}): ${cmd.join(" ")} \u2014 continuing with the remaining steps.`
357
+ );
358
+ }
359
+ }
360
+ _refresh_claude_plugin(plugin_steps, runner, out, err);
361
+ {
362
+ const converge_mod = await import("./cmd_converge.js");
363
+ const consent = converge_mod.read_consent(write_target("agent-settings.yml"));
364
+ const tty = Boolean(process.stdin.isTTY && process.stdout.isTTY);
365
+ if (args.converge || consent || tty) {
366
+ const rc = converge_mod.main(args.converge ? ["--yes"] : [], { out, err });
367
+ if (rc !== 0 && (args.converge || consent)) {
368
+ failed_essential.push("agent-config converge");
369
+ }
370
+ } else if (plugin_steps.length > 0) {
371
+ _print(
372
+ out,
373
+ `\u2139\uFE0F Claude Code marketplace plugin detected \u2014 deprecated surface. Hooks now live in ~/.claude/settings.json (wired by the global step above), so the plugin only duplicates skills/commands. Remove it with:
374
+ claude plugin uninstall ${CLAUDE_PLUGIN_ID}@${CLAUDE_MARKETPLACE_NAME}
375
+ (or: agent-config converge)`
376
+ );
377
+ }
378
+ }
379
+ _sync_settings_files(sync_targets, runner, out, err);
380
+ _maybe_refresh_project_wrapper(project_root, out, err);
381
+ _maybe_refresh_git_hook(project_root, runner, out, err);
382
+ const doctor_cmd = [_agent_config_bin(), "doctor"];
383
+ _print(out, "\u2192 " + doctor_cmd.join(" "));
384
+ const doctor_rc = runner(doctor_cmd);
385
+ if (doctor_rc !== 0) {
386
+ _print(
387
+ err,
388
+ `\u26A0\uFE0F agent-config doctor reported findings (exit ${doctor_rc}) \u2014 see the check output above for per-item fixes.`
389
+ );
390
+ }
391
+ if (failed_essential.length > 0) {
392
+ _print(
393
+ err,
394
+ `\u274C agent-config upgrade finished with ${failed_essential.length} failed step(s):
395
+ ` + failed_essential.map((c) => ` \xB7 ${c}`).join("\n") + "\n Re-run `agent-config upgrade`, or run the failed step directly. `agent-config doctor` names anything left in a mixed state."
396
+ );
397
+ return 1;
398
+ }
399
+ _print(
400
+ out,
401
+ "\u2705 agent-config upgraded" + (doctor_rc === 0 ? " \u2014 doctor green." : " \u2014 review the doctor findings above.") + " Tune settings any time with `agent-config config`."
402
+ );
403
+ return 0;
404
+ }
405
+ function installed_lock_is_newer(latest, installed) {
406
+ return _is_newer(latest, installed);
407
+ }
408
+ function _isCliEntry() {
409
+ if (process.argv[1] === void 0) {
410
+ return false;
411
+ }
412
+ const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
413
+ if (import.meta.url === argvUrl) {
414
+ return true;
415
+ }
416
+ try {
417
+ const here = fs.realpathSync(fileURLToPath(import.meta.url));
418
+ const argv = fs.realpathSync(path.resolve(process.argv[1]));
419
+ return here === argv;
420
+ } catch {
421
+ return false;
422
+ }
423
+ }
424
+ if (_isCliEntry() || process.argv[1] === _HERE) {
425
+ main(process.argv.slice(2)).then((code) => {
426
+ process.exitCode = code;
427
+ }).catch((exc) => {
428
+ if (exc instanceof ArgparseExit) {
429
+ process.exitCode = exc.code;
430
+ } else {
431
+ throw exc;
432
+ }
433
+ });
434
+ }
435
+ export {
436
+ ArgparseExit,
437
+ _agent_config_bin,
438
+ _default_runner,
439
+ _installed_version,
440
+ _maybe_refresh_project_wrapper,
441
+ _parse,
442
+ installed_lock_is_newer,
443
+ main
444
+ };