@event4u/agent-config 9.13.0 → 9.14.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 (33) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +48 -0
  3. package/README.md +1 -1
  4. package/dist/agent-src/commands/optimize/deep.md +147 -0
  5. package/dist/agent-src/commands/optimize.md +12 -6
  6. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  7. package/dist/cli-delegate/{chunk-QFKQLQ7X.js → chunk-GCVFLBP2.js} +399 -365
  8. package/dist/cli-delegate/cmd_export.js +1 -1
  9. package/dist/cli-delegate/cmd_prune.js +1 -1
  10. package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
  11. package/dist/cli-delegate/cmd_sync.js +1 -1
  12. package/dist/cli-delegate/cmd_uninstall.js +1 -1
  13. package/dist/cli-delegate/cmd_validate.js +1 -1
  14. package/dist/discovery/deprecation-report.md +1 -1
  15. package/dist/discovery/discovery-manifest.json +39 -11
  16. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  17. package/dist/discovery/discovery-manifest.summary.md +3 -3
  18. package/dist/discovery/orphan-report.md +1 -1
  19. package/dist/discovery/packs.json +6 -5
  20. package/dist/discovery/trust-report.md +3 -3
  21. package/dist/discovery/workspaces.json +5 -4
  22. package/dist/install/install.mjs +648 -614
  23. package/dist/mcp/registry-manifest.json +2 -2
  24. package/dist/mcp/server.json +2 -2
  25. package/dist/mcp/server.mjs +46 -13
  26. package/package.json +1 -1
  27. package/src/scripts/_lib/exec_evidence.ts +5 -0
  28. package/src/scripts/_lib/scoped_projection.ts +212 -0
  29. package/src/scripts/check_artefact_count_messaging.ts +128 -15
  30. package/src/scripts/count_scoped_projection.ts +104 -0
  31. package/src/scripts/install.ts +13 -90
  32. package/src/scripts/skill_linter.ts +81 -14
  33. package/src/scripts/update_counts.ts +90 -11
@@ -117,17 +117,17 @@ var require_visit = __commonJS({
117
117
  visit.BREAK = BREAK;
118
118
  visit.SKIP = SKIP;
119
119
  visit.REMOVE = REMOVE;
120
- function visit_(key, node, visitor, path15) {
121
- const ctrl = callVisitor(key, node, visitor, path15);
120
+ function visit_(key, node, visitor, path16) {
121
+ const ctrl = callVisitor(key, node, visitor, path16);
122
122
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
123
- replaceNode(key, path15, ctrl);
124
- return visit_(key, ctrl, visitor, path15);
123
+ replaceNode(key, path16, ctrl);
124
+ return visit_(key, ctrl, visitor, path16);
125
125
  }
126
126
  if (typeof ctrl !== "symbol") {
127
127
  if (identity.isCollection(node)) {
128
- path15 = Object.freeze(path15.concat(node));
128
+ path16 = Object.freeze(path16.concat(node));
129
129
  for (let i = 0; i < node.items.length; ++i) {
130
- const ci = visit_(i, node.items[i], visitor, path15);
130
+ const ci = visit_(i, node.items[i], visitor, path16);
131
131
  if (typeof ci === "number")
132
132
  i = ci - 1;
133
133
  else if (ci === BREAK)
@@ -138,13 +138,13 @@ var require_visit = __commonJS({
138
138
  }
139
139
  }
140
140
  } else if (identity.isPair(node)) {
141
- path15 = Object.freeze(path15.concat(node));
142
- const ck = visit_("key", node.key, visitor, path15);
141
+ path16 = Object.freeze(path16.concat(node));
142
+ const ck = visit_("key", node.key, visitor, path16);
143
143
  if (ck === BREAK)
144
144
  return BREAK;
145
145
  else if (ck === REMOVE)
146
146
  node.key = null;
147
- const cv = visit_("value", node.value, visitor, path15);
147
+ const cv = visit_("value", node.value, visitor, path16);
148
148
  if (cv === BREAK)
149
149
  return BREAK;
150
150
  else if (cv === REMOVE)
@@ -165,17 +165,17 @@ var require_visit = __commonJS({
165
165
  visitAsync.BREAK = BREAK;
166
166
  visitAsync.SKIP = SKIP;
167
167
  visitAsync.REMOVE = REMOVE;
168
- async function visitAsync_(key, node, visitor, path15) {
169
- const ctrl = await callVisitor(key, node, visitor, path15);
168
+ async function visitAsync_(key, node, visitor, path16) {
169
+ const ctrl = await callVisitor(key, node, visitor, path16);
170
170
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
171
- replaceNode(key, path15, ctrl);
172
- return visitAsync_(key, ctrl, visitor, path15);
171
+ replaceNode(key, path16, ctrl);
172
+ return visitAsync_(key, ctrl, visitor, path16);
173
173
  }
174
174
  if (typeof ctrl !== "symbol") {
175
175
  if (identity.isCollection(node)) {
176
- path15 = Object.freeze(path15.concat(node));
176
+ path16 = Object.freeze(path16.concat(node));
177
177
  for (let i = 0; i < node.items.length; ++i) {
178
- const ci = await visitAsync_(i, node.items[i], visitor, path15);
178
+ const ci = await visitAsync_(i, node.items[i], visitor, path16);
179
179
  if (typeof ci === "number")
180
180
  i = ci - 1;
181
181
  else if (ci === BREAK)
@@ -186,13 +186,13 @@ var require_visit = __commonJS({
186
186
  }
187
187
  }
188
188
  } else if (identity.isPair(node)) {
189
- path15 = Object.freeze(path15.concat(node));
190
- const ck = await visitAsync_("key", node.key, visitor, path15);
189
+ path16 = Object.freeze(path16.concat(node));
190
+ const ck = await visitAsync_("key", node.key, visitor, path16);
191
191
  if (ck === BREAK)
192
192
  return BREAK;
193
193
  else if (ck === REMOVE)
194
194
  node.key = null;
195
- const cv = await visitAsync_("value", node.value, visitor, path15);
195
+ const cv = await visitAsync_("value", node.value, visitor, path16);
196
196
  if (cv === BREAK)
197
197
  return BREAK;
198
198
  else if (cv === REMOVE)
@@ -219,23 +219,23 @@ var require_visit = __commonJS({
219
219
  }
220
220
  return visitor;
221
221
  }
222
- function callVisitor(key, node, visitor, path15) {
222
+ function callVisitor(key, node, visitor, path16) {
223
223
  if (typeof visitor === "function")
224
- return visitor(key, node, path15);
224
+ return visitor(key, node, path16);
225
225
  if (identity.isMap(node))
226
- return visitor.Map?.(key, node, path15);
226
+ return visitor.Map?.(key, node, path16);
227
227
  if (identity.isSeq(node))
228
- return visitor.Seq?.(key, node, path15);
228
+ return visitor.Seq?.(key, node, path16);
229
229
  if (identity.isPair(node))
230
- return visitor.Pair?.(key, node, path15);
230
+ return visitor.Pair?.(key, node, path16);
231
231
  if (identity.isScalar(node))
232
- return visitor.Scalar?.(key, node, path15);
232
+ return visitor.Scalar?.(key, node, path16);
233
233
  if (identity.isAlias(node))
234
- return visitor.Alias?.(key, node, path15);
234
+ return visitor.Alias?.(key, node, path16);
235
235
  return void 0;
236
236
  }
237
- function replaceNode(key, path15, node) {
238
- const parent = path15[path15.length - 1];
237
+ function replaceNode(key, path16, node) {
238
+ const parent = path16[path16.length - 1];
239
239
  if (identity.isCollection(parent)) {
240
240
  parent.items[key] = node;
241
241
  } else if (identity.isPair(parent)) {
@@ -845,10 +845,10 @@ var require_Collection = __commonJS({
845
845
  var createNode = require_createNode();
846
846
  var identity = require_identity();
847
847
  var Node = require_Node();
848
- function collectionFromPath(schema, path15, value) {
848
+ function collectionFromPath(schema, path16, value) {
849
849
  let v = value;
850
- for (let i = path15.length - 1; i >= 0; --i) {
851
- const k = path15[i];
850
+ for (let i = path16.length - 1; i >= 0; --i) {
851
+ const k = path16[i];
852
852
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
853
853
  const a = [];
854
854
  a[k] = v;
@@ -867,7 +867,7 @@ var require_Collection = __commonJS({
867
867
  sourceObjects: /* @__PURE__ */ new Map()
868
868
  });
869
869
  }
870
- var isEmptyPath = (path15) => path15 == null || typeof path15 === "object" && !!path15[Symbol.iterator]().next().done;
870
+ var isEmptyPath = (path16) => path16 == null || typeof path16 === "object" && !!path16[Symbol.iterator]().next().done;
871
871
  var Collection = class extends Node.NodeBase {
872
872
  constructor(type, schema) {
873
873
  super(type);
@@ -897,11 +897,11 @@ var require_Collection = __commonJS({
897
897
  * be a Pair instance or a `{ key, value }` object, which may not have a key
898
898
  * that already exists in the map.
899
899
  */
900
- addIn(path15, value) {
901
- if (isEmptyPath(path15))
900
+ addIn(path16, value) {
901
+ if (isEmptyPath(path16))
902
902
  this.add(value);
903
903
  else {
904
- const [key, ...rest] = path15;
904
+ const [key, ...rest] = path16;
905
905
  const node = this.get(key, true);
906
906
  if (identity.isCollection(node))
907
907
  node.addIn(rest, value);
@@ -915,8 +915,8 @@ var require_Collection = __commonJS({
915
915
  * Removes a value from the collection.
916
916
  * @returns `true` if the item was found and removed.
917
917
  */
918
- deleteIn(path15) {
919
- const [key, ...rest] = path15;
918
+ deleteIn(path16) {
919
+ const [key, ...rest] = path16;
920
920
  if (rest.length === 0)
921
921
  return this.delete(key);
922
922
  const node = this.get(key, true);
@@ -930,8 +930,8 @@ var require_Collection = __commonJS({
930
930
  * scalar values from their surrounding node; to disable set `keepScalar` to
931
931
  * `true` (collections are always returned intact).
932
932
  */
933
- getIn(path15, keepScalar) {
934
- const [key, ...rest] = path15;
933
+ getIn(path16, keepScalar) {
934
+ const [key, ...rest] = path16;
935
935
  const node = this.get(key, true);
936
936
  if (rest.length === 0)
937
937
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -949,8 +949,8 @@ var require_Collection = __commonJS({
949
949
  /**
950
950
  * Checks if the collection includes a value with the key `key`.
951
951
  */
952
- hasIn(path15) {
953
- const [key, ...rest] = path15;
952
+ hasIn(path16) {
953
+ const [key, ...rest] = path16;
954
954
  if (rest.length === 0)
955
955
  return this.has(key);
956
956
  const node = this.get(key, true);
@@ -960,8 +960,8 @@ var require_Collection = __commonJS({
960
960
  * Sets a value in this collection. For `!!set`, `value` needs to be a
961
961
  * boolean to add/remove the item from the set.
962
962
  */
963
- setIn(path15, value) {
964
- const [key, ...rest] = path15;
963
+ setIn(path16, value) {
964
+ const [key, ...rest] = path16;
965
965
  if (rest.length === 0) {
966
966
  this.set(key, value);
967
967
  } else {
@@ -3476,9 +3476,9 @@ var require_Document = __commonJS({
3476
3476
  this.contents.add(value);
3477
3477
  }
3478
3478
  /** Adds a value to the document. */
3479
- addIn(path15, value) {
3479
+ addIn(path16, value) {
3480
3480
  if (assertCollection(this.contents))
3481
- this.contents.addIn(path15, value);
3481
+ this.contents.addIn(path16, value);
3482
3482
  }
3483
3483
  /**
3484
3484
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3553,14 +3553,14 @@ var require_Document = __commonJS({
3553
3553
  * Removes a value from the document.
3554
3554
  * @returns `true` if the item was found and removed.
3555
3555
  */
3556
- deleteIn(path15) {
3557
- if (Collection.isEmptyPath(path15)) {
3556
+ deleteIn(path16) {
3557
+ if (Collection.isEmptyPath(path16)) {
3558
3558
  if (this.contents == null)
3559
3559
  return false;
3560
3560
  this.contents = null;
3561
3561
  return true;
3562
3562
  }
3563
- return assertCollection(this.contents) ? this.contents.deleteIn(path15) : false;
3563
+ return assertCollection(this.contents) ? this.contents.deleteIn(path16) : false;
3564
3564
  }
3565
3565
  /**
3566
3566
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3575,10 +3575,10 @@ var require_Document = __commonJS({
3575
3575
  * scalar values from their surrounding node; to disable set `keepScalar` to
3576
3576
  * `true` (collections are always returned intact).
3577
3577
  */
3578
- getIn(path15, keepScalar) {
3579
- if (Collection.isEmptyPath(path15))
3578
+ getIn(path16, keepScalar) {
3579
+ if (Collection.isEmptyPath(path16))
3580
3580
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3581
- return identity.isCollection(this.contents) ? this.contents.getIn(path15, keepScalar) : void 0;
3581
+ return identity.isCollection(this.contents) ? this.contents.getIn(path16, keepScalar) : void 0;
3582
3582
  }
3583
3583
  /**
3584
3584
  * Checks if the document includes a value with the key `key`.
@@ -3589,10 +3589,10 @@ var require_Document = __commonJS({
3589
3589
  /**
3590
3590
  * Checks if the document includes a value at `path`.
3591
3591
  */
3592
- hasIn(path15) {
3593
- if (Collection.isEmptyPath(path15))
3592
+ hasIn(path16) {
3593
+ if (Collection.isEmptyPath(path16))
3594
3594
  return this.contents !== void 0;
3595
- return identity.isCollection(this.contents) ? this.contents.hasIn(path15) : false;
3595
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path16) : false;
3596
3596
  }
3597
3597
  /**
3598
3598
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3609,13 +3609,13 @@ var require_Document = __commonJS({
3609
3609
  * Sets a value in this document. For `!!set`, `value` needs to be a
3610
3610
  * boolean to add/remove the item from the set.
3611
3611
  */
3612
- setIn(path15, value) {
3613
- if (Collection.isEmptyPath(path15)) {
3612
+ setIn(path16, value) {
3613
+ if (Collection.isEmptyPath(path16)) {
3614
3614
  this.contents = value;
3615
3615
  } else if (this.contents == null) {
3616
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path15), value);
3616
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path16), value);
3617
3617
  } else if (assertCollection(this.contents)) {
3618
- this.contents.setIn(path15, value);
3618
+ this.contents.setIn(path16, value);
3619
3619
  }
3620
3620
  }
3621
3621
  /**
@@ -5575,9 +5575,9 @@ var require_cst_visit = __commonJS({
5575
5575
  visit.BREAK = BREAK;
5576
5576
  visit.SKIP = SKIP;
5577
5577
  visit.REMOVE = REMOVE;
5578
- visit.itemAtPath = (cst, path15) => {
5578
+ visit.itemAtPath = (cst, path16) => {
5579
5579
  let item = cst;
5580
- for (const [field, index] of path15) {
5580
+ for (const [field, index] of path16) {
5581
5581
  const tok = item?.[field];
5582
5582
  if (tok && "items" in tok) {
5583
5583
  item = tok.items[index];
@@ -5586,23 +5586,23 @@ var require_cst_visit = __commonJS({
5586
5586
  }
5587
5587
  return item;
5588
5588
  };
5589
- visit.parentCollection = (cst, path15) => {
5590
- const parent = visit.itemAtPath(cst, path15.slice(0, -1));
5591
- const field = path15[path15.length - 1][0];
5589
+ visit.parentCollection = (cst, path16) => {
5590
+ const parent = visit.itemAtPath(cst, path16.slice(0, -1));
5591
+ const field = path16[path16.length - 1][0];
5592
5592
  const coll = parent?.[field];
5593
5593
  if (coll && "items" in coll)
5594
5594
  return coll;
5595
5595
  throw new Error("Parent collection not found");
5596
5596
  };
5597
- function _visit(path15, item, visitor) {
5598
- let ctrl = visitor(item, path15);
5597
+ function _visit(path16, item, visitor) {
5598
+ let ctrl = visitor(item, path16);
5599
5599
  if (typeof ctrl === "symbol")
5600
5600
  return ctrl;
5601
5601
  for (const field of ["key", "value"]) {
5602
5602
  const token = item[field];
5603
5603
  if (token && "items" in token) {
5604
5604
  for (let i = 0; i < token.items.length; ++i) {
5605
- const ci = _visit(Object.freeze(path15.concat([[field, i]])), token.items[i], visitor);
5605
+ const ci = _visit(Object.freeze(path16.concat([[field, i]])), token.items[i], visitor);
5606
5606
  if (typeof ci === "number")
5607
5607
  i = ci - 1;
5608
5608
  else if (ci === BREAK)
@@ -5613,10 +5613,10 @@ var require_cst_visit = __commonJS({
5613
5613
  }
5614
5614
  }
5615
5615
  if (typeof ctrl === "function" && field === "key")
5616
- ctrl = ctrl(item, path15);
5616
+ ctrl = ctrl(item, path16);
5617
5617
  }
5618
5618
  }
5619
- return typeof ctrl === "function" ? ctrl(item, path15) : ctrl;
5619
+ return typeof ctrl === "function" ? ctrl(item, path16) : ctrl;
5620
5620
  }
5621
5621
  exports.visit = visit;
5622
5622
  }
@@ -6918,14 +6918,14 @@ var require_parser = __commonJS({
6918
6918
  case "scalar":
6919
6919
  case "single-quoted-scalar":
6920
6920
  case "double-quoted-scalar": {
6921
- const fs17 = this.flowScalar(this.type);
6921
+ const fs18 = this.flowScalar(this.type);
6922
6922
  if (atNextItem || it.value) {
6923
- map.items.push({ start, key: fs17, sep: [] });
6923
+ map.items.push({ start, key: fs18, sep: [] });
6924
6924
  this.onKeyLine = true;
6925
6925
  } else if (it.sep) {
6926
- this.stack.push(fs17);
6926
+ this.stack.push(fs18);
6927
6927
  } else {
6928
- Object.assign(it, { key: fs17, sep: [] });
6928
+ Object.assign(it, { key: fs18, sep: [] });
6929
6929
  this.onKeyLine = true;
6930
6930
  }
6931
6931
  return;
@@ -7053,13 +7053,13 @@ var require_parser = __commonJS({
7053
7053
  case "scalar":
7054
7054
  case "single-quoted-scalar":
7055
7055
  case "double-quoted-scalar": {
7056
- const fs17 = this.flowScalar(this.type);
7056
+ const fs18 = this.flowScalar(this.type);
7057
7057
  if (!it || it.value)
7058
- fc.items.push({ start: [], key: fs17, sep: [] });
7058
+ fc.items.push({ start: [], key: fs18, sep: [] });
7059
7059
  else if (it.sep)
7060
- this.stack.push(fs17);
7060
+ this.stack.push(fs18);
7061
7061
  else
7062
- Object.assign(it, { key: fs17, sep: [] });
7062
+ Object.assign(it, { key: fs18, sep: [] });
7063
7063
  return;
7064
7064
  }
7065
7065
  case "flow-map-end":
@@ -7370,9 +7370,9 @@ var require_dist = __commonJS({
7370
7370
  // src/scripts/install.ts
7371
7371
  import { spawn, spawnSync as spawnSync2 } from "node:child_process";
7372
7372
  import * as crypto3 from "node:crypto";
7373
- import * as fs16 from "node:fs";
7373
+ import * as fs17 from "node:fs";
7374
7374
  import * as os7 from "node:os";
7375
- import * as path14 from "node:path";
7375
+ import * as path15 from "node:path";
7376
7376
  import process3 from "node:process";
7377
7377
  import { fileURLToPath as fileURLToPath4, pathToFileURL as pathToFileURL2 } from "node:url";
7378
7378
 
@@ -7872,8 +7872,8 @@ function lockfile_write_path(env) {
7872
7872
  }
7873
7873
  return write_target("installed.lock", { env: env ?? null });
7874
7874
  }
7875
- function read_lockfile(path15) {
7876
- const target = path15 ?? lockfile_path();
7875
+ function read_lockfile(path16) {
7876
+ const target = path16 ?? lockfile_path();
7877
7877
  let text;
7878
7878
  try {
7879
7879
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -8108,6 +8108,11 @@ function current_package_version(repo_root) {
8108
8108
  return _find_package_version_upward(here) ?? "0.0.0";
8109
8109
  }
8110
8110
 
8111
+ // src/scripts/_lib/scoped_projection.ts
8112
+ import * as fs4 from "node:fs";
8113
+ import { createRequire } from "node:module";
8114
+ import * as path4 from "node:path";
8115
+
8111
8116
  // src/scripts/_lib/surface_tiers.ts
8112
8117
  import * as fs3 from "node:fs";
8113
8118
  import * as path3 from "node:path";
@@ -8198,11 +8203,91 @@ function _strip_quotes(s) {
8198
8203
  return out;
8199
8204
  }
8200
8205
 
8206
+ // src/scripts/_lib/scoped_projection.ts
8207
+ var _require = createRequire(import.meta.url);
8208
+ var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set([
8209
+ "engineering",
8210
+ "agent-config-maintainer"
8211
+ ]);
8212
+ function isPlainObject(v) {
8213
+ return typeof v === "object" && v !== null && !Array.isArray(v);
8214
+ }
8215
+ function yamlSafeLoad(text) {
8216
+ let YAML3;
8217
+ try {
8218
+ YAML3 = _require("yaml");
8219
+ } catch {
8220
+ return null;
8221
+ }
8222
+ try {
8223
+ return YAML3.parse(text, { version: "1.1" }) ?? null;
8224
+ } catch {
8225
+ return null;
8226
+ }
8227
+ }
8228
+ var PACKS_YML_REL = path4.join("src", "config", "discovery", "packs.yml");
8229
+ function load_packs_registry(package_root) {
8230
+ const vocab_path = path4.join(package_root, PACKS_YML_REL);
8231
+ const data = yamlSafeLoad(fs4.readFileSync(vocab_path, "utf-8"));
8232
+ if (!Array.isArray(data)) {
8233
+ throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
8234
+ }
8235
+ const out = [];
8236
+ for (const entry of data) {
8237
+ if (!isPlainObject(entry)) continue;
8238
+ const id = entry["id"];
8239
+ if (typeof id !== "string" || id === "") continue;
8240
+ const workspaces_raw = entry["workspaces"];
8241
+ const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
8242
+ const requires_raw = entry["requires"] ?? entry["requires_hint"];
8243
+ const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
8244
+ out.push({ id, workspaces, requires });
8245
+ }
8246
+ return out;
8247
+ }
8248
+ function compute_active_pack_ids(packs, runtime_active_packs) {
8249
+ const by_id = /* @__PURE__ */ new Map();
8250
+ for (const p of packs) by_id.set(p.id, p);
8251
+ const active = /* @__PURE__ */ new Set();
8252
+ for (const p of packs) {
8253
+ if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
8254
+ active.add(p.id);
8255
+ }
8256
+ }
8257
+ for (const id of runtime_active_packs) {
8258
+ active.add(id);
8259
+ }
8260
+ let frontier = [...active];
8261
+ while (frontier.length > 0) {
8262
+ const next = [];
8263
+ for (const id of frontier) {
8264
+ const rec = by_id.get(id);
8265
+ if (rec === void 0) continue;
8266
+ for (const dep of rec.requires) {
8267
+ if (!active.has(dep)) {
8268
+ active.add(dep);
8269
+ next.push(dep);
8270
+ }
8271
+ }
8272
+ }
8273
+ frontier = next;
8274
+ }
8275
+ return active;
8276
+ }
8277
+ function is_pruned_under_scoped(md_path, active_ids) {
8278
+ const packs = frontmatter_packs(md_path);
8279
+ if (packs.size === 0) return false;
8280
+ for (const id of packs) {
8281
+ if (active_ids.has(id)) return false;
8282
+ }
8283
+ return true;
8284
+ }
8285
+
8201
8286
  // src/scripts/_lib/global_deploy_inventory.ts
8202
8287
  import { randomBytes as randomBytes2 } from "node:crypto";
8203
- import * as fs4 from "node:fs";
8288
+ import * as fs5 from "node:fs";
8204
8289
  import * as os3 from "node:os";
8205
- import * as path4 from "node:path";
8290
+ import * as path5 from "node:path";
8206
8291
  var SCHEMA_VERSION2 = 1;
8207
8292
  var INVENTORY_BASENAME = "deployed-files.json";
8208
8293
  var INVENTORY_ENV = "AGENT_CONFIG_DEPLOY_INVENTORY";
@@ -8211,22 +8296,22 @@ function expanduser3(p) {
8211
8296
  return os3.homedir();
8212
8297
  }
8213
8298
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
8214
- return path4.join(os3.homedir(), p.slice(2));
8299
+ return path5.join(os3.homedir(), p.slice(2));
8215
8300
  }
8216
8301
  return p;
8217
8302
  }
8218
8303
  function resolve_path(p) {
8219
8304
  try {
8220
- return fs4.realpathSync(p);
8305
+ return fs5.realpathSync(p);
8221
8306
  } catch {
8222
- const abs = path4.resolve(p);
8223
- const parts = abs.split(path4.sep);
8307
+ const abs = path5.resolve(p);
8308
+ const parts = abs.split(path5.sep);
8224
8309
  for (let i = parts.length; i > 0; i -= 1) {
8225
- const prefix = parts.slice(0, i).join(path4.sep) || path4.sep;
8310
+ const prefix = parts.slice(0, i).join(path5.sep) || path5.sep;
8226
8311
  try {
8227
- const real = fs4.realpathSync(prefix);
8312
+ const real = fs5.realpathSync(prefix);
8228
8313
  const rest = parts.slice(i);
8229
- return rest.length > 0 ? path4.join(real, ...rest) : real;
8314
+ return rest.length > 0 ? path5.join(real, ...rest) : real;
8230
8315
  } catch {
8231
8316
  continue;
8232
8317
  }
@@ -8236,7 +8321,7 @@ function resolve_path(p) {
8236
8321
  }
8237
8322
  function path_exists(p) {
8238
8323
  try {
8239
- fs4.statSync(p);
8324
+ fs5.statSync(p);
8240
8325
  return true;
8241
8326
  } catch {
8242
8327
  return false;
@@ -8254,7 +8339,7 @@ function load_inventory(p) {
8254
8339
  const target = p ?? inventory_path();
8255
8340
  let data;
8256
8341
  try {
8257
- data = JSON.parse(fs4.readFileSync(target, { encoding: "utf-8" }));
8342
+ data = JSON.parse(fs5.readFileSync(target, { encoding: "utf-8" }));
8258
8343
  } catch {
8259
8344
  return { schema_version: SCHEMA_VERSION2, tools: {} };
8260
8345
  }
@@ -8265,15 +8350,15 @@ function load_inventory(p) {
8265
8350
  }
8266
8351
  function save_inventory(data, p) {
8267
8352
  const target = p ?? inventory_path();
8268
- fs4.mkdirSync(path4.dirname(target), { recursive: true });
8353
+ fs5.mkdirSync(path5.dirname(target), { recursive: true });
8269
8354
  const payload = json_dumps_sorted(data, 2) + "\n";
8270
- const parent = path4.dirname(target);
8355
+ const parent = path5.dirname(target);
8271
8356
  let fd = null;
8272
8357
  let tmp_name = "";
8273
8358
  for (let attempt = 0; attempt < 32; attempt += 1) {
8274
- tmp_name = path4.join(parent, `${path4.basename(target)}.${randomBytes2(6).toString("hex")}`);
8359
+ tmp_name = path5.join(parent, `${path5.basename(target)}.${randomBytes2(6).toString("hex")}`);
8275
8360
  try {
8276
- fd = fs4.openSync(tmp_name, "wx", 384);
8361
+ fd = fs5.openSync(tmp_name, "wx", 384);
8277
8362
  break;
8278
8363
  } catch (err) {
8279
8364
  if (err.code === "EEXIST") {
@@ -8286,16 +8371,16 @@ function save_inventory(data, p) {
8286
8371
  throw new Error("save_inventory: could not create a unique temp file");
8287
8372
  }
8288
8373
  try {
8289
- fs4.writeFileSync(fd, payload, { encoding: "utf-8" });
8290
- fs4.closeSync(fd);
8291
- fs4.renameSync(tmp_name, target);
8374
+ fs5.writeFileSync(fd, payload, { encoding: "utf-8" });
8375
+ fs5.closeSync(fd);
8376
+ fs5.renameSync(tmp_name, target);
8292
8377
  } catch (err) {
8293
8378
  try {
8294
- fs4.closeSync(fd);
8379
+ fs5.closeSync(fd);
8295
8380
  } catch {
8296
8381
  }
8297
8382
  try {
8298
- fs4.unlinkSync(tmp_name);
8383
+ fs5.unlinkSync(tmp_name);
8299
8384
  } catch {
8300
8385
  }
8301
8386
  throw err;
@@ -8354,7 +8439,7 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8354
8439
  const out = /* @__PURE__ */ new Set();
8355
8440
  let src_stat;
8356
8441
  try {
8357
- src_stat = fs4.statSync(src);
8442
+ src_stat = fs5.statSync(src);
8358
8443
  } catch {
8359
8444
  return out;
8360
8445
  }
@@ -8366,23 +8451,23 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8366
8451
  return out;
8367
8452
  }
8368
8453
  const _walk = (node, prefix) => {
8369
- const entries = fs4.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8454
+ const entries = fs5.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8370
8455
  for (const name of entries) {
8371
- const entry = path4.join(node, name);
8456
+ const entry = path5.join(node, name);
8372
8457
  const rel = join_rel(prefix, name);
8373
- const lst = fs4.lstatSync(entry);
8458
+ const lst = fs5.lstatSync(entry);
8374
8459
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
8375
8460
  _walk(entry, rel);
8376
8461
  continue;
8377
8462
  }
8378
8463
  let resolved_is_dir = false;
8379
8464
  try {
8380
- resolved_is_dir = fs4.statSync(entry).isDirectory();
8465
+ resolved_is_dir = fs5.statSync(entry).isDirectory();
8381
8466
  } catch {
8382
8467
  resolved_is_dir = false;
8383
8468
  }
8384
8469
  if (resolved_is_dir) {
8385
- _walk(fs4.realpathSync(entry), rel);
8470
+ _walk(fs5.realpathSync(entry), rel);
8386
8471
  continue;
8387
8472
  }
8388
8473
  if (file_filter !== null && !file_filter(entry)) {
@@ -8395,13 +8480,13 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
8395
8480
  return out;
8396
8481
  }
8397
8482
  function join_rel(prefix, name) {
8398
- return prefix ? path4.join(prefix, name) : name;
8483
+ return prefix ? path5.join(prefix, name) : name;
8399
8484
  }
8400
8485
  function as_posix(p) {
8401
8486
  if (p === "") {
8402
8487
  return ".";
8403
8488
  }
8404
- return p.split(path4.sep).join("/");
8489
+ return p.split(path5.sep).join("/");
8405
8490
  }
8406
8491
  function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false) {
8407
8492
  const tools = inventory["tools"] ?? {};
@@ -8426,15 +8511,15 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
8426
8511
  if (typeof rel !== "string" || !rel || rel.startsWith("/") || rel.startsWith("..")) {
8427
8512
  continue;
8428
8513
  }
8429
- const target = path4.join(anchor_resolved, rel);
8514
+ const target = path5.join(anchor_resolved, rel);
8430
8515
  try {
8431
- relative_to(resolve_path(path4.dirname(target)), anchor_resolved);
8516
+ relative_to(resolve_path(path5.dirname(target)), anchor_resolved);
8432
8517
  } catch {
8433
8518
  continue;
8434
8519
  }
8435
8520
  let lst = null;
8436
8521
  try {
8437
- lst = fs4.lstatSync(target);
8522
+ lst = fs5.lstatSync(target);
8438
8523
  } catch {
8439
8524
  lst = null;
8440
8525
  }
@@ -8448,12 +8533,12 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
8448
8533
  continue;
8449
8534
  }
8450
8535
  try {
8451
- fs4.unlinkSync(target);
8536
+ fs5.unlinkSync(target);
8452
8537
  } catch {
8453
8538
  continue;
8454
8539
  }
8455
8540
  deleted.push(target);
8456
- prune_candidates.add(path4.dirname(target));
8541
+ prune_candidates.add(path5.dirname(target));
8457
8542
  }
8458
8543
  prune_empty_dirs(prune_candidates, anchor_resolved);
8459
8544
  return deleted;
@@ -8464,10 +8549,10 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8464
8549
  const prune_candidates = /* @__PURE__ */ new Set();
8465
8550
  const needle = `package: ${package_tag}`;
8466
8551
  for (const dest_sub of dest_subs) {
8467
- const root = dest_sub ? path4.join(anchor_resolved, dest_sub) : anchor_resolved;
8552
+ const root = dest_sub ? path5.join(anchor_resolved, dest_sub) : anchor_resolved;
8468
8553
  let root_stat;
8469
8554
  try {
8470
- root_stat = fs4.statSync(root);
8555
+ root_stat = fs5.statSync(root);
8471
8556
  } catch {
8472
8557
  continue;
8473
8558
  }
@@ -8477,7 +8562,7 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8477
8562
  for (const md of rglob_md(root)) {
8478
8563
  let md_lst;
8479
8564
  try {
8480
- md_lst = fs4.lstatSync(md);
8565
+ md_lst = fs5.lstatSync(md);
8481
8566
  } catch {
8482
8567
  continue;
8483
8568
  }
@@ -8489,13 +8574,13 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8489
8574
  continue;
8490
8575
  }
8491
8576
  try {
8492
- relative_to(resolve_path(path4.dirname(md)), anchor_resolved);
8577
+ relative_to(resolve_path(path5.dirname(md)), anchor_resolved);
8493
8578
  } catch {
8494
8579
  continue;
8495
8580
  }
8496
8581
  let head;
8497
8582
  try {
8498
- head = fs4.readFileSync(md, { encoding: "utf-8" });
8583
+ head = fs5.readFileSync(md, { encoding: "utf-8" });
8499
8584
  } catch {
8500
8585
  continue;
8501
8586
  }
@@ -8513,12 +8598,12 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
8513
8598
  continue;
8514
8599
  }
8515
8600
  try {
8516
- fs4.unlinkSync(md);
8601
+ fs5.unlinkSync(md);
8517
8602
  } catch {
8518
8603
  continue;
8519
8604
  }
8520
8605
  deleted.push(md);
8521
- prune_candidates.add(path4.dirname(md));
8606
+ prune_candidates.add(path5.dirname(md));
8522
8607
  }
8523
8608
  }
8524
8609
  prune_empty_dirs(prune_candidates, anchor_resolved);
@@ -8538,51 +8623,51 @@ function record_deploy(tool_id, anchor, current_files, inventory) {
8538
8623
  }
8539
8624
  function prune_empty_dirs(prune_candidates, anchor_resolved) {
8540
8625
  const ordered = [...prune_candidates].sort(
8541
- (a, b) => b.split(path4.sep).length - a.split(path4.sep).length
8626
+ (a, b) => b.split(path5.sep).length - a.split(path5.sep).length
8542
8627
  );
8543
8628
  for (const start of ordered) {
8544
8629
  let node = start;
8545
8630
  while (node !== anchor_resolved && is_ancestor(anchor_resolved, node)) {
8546
8631
  try {
8547
- fs4.rmdirSync(node);
8632
+ fs5.rmdirSync(node);
8548
8633
  } catch {
8549
8634
  break;
8550
8635
  }
8551
- node = path4.dirname(node);
8636
+ node = path5.dirname(node);
8552
8637
  }
8553
8638
  }
8554
8639
  }
8555
8640
  function is_ancestor(anchor, node) {
8556
- const rel = path4.relative(anchor, node);
8557
- return rel !== "" && !rel.startsWith("..") && !path4.isAbsolute(rel);
8641
+ const rel = path5.relative(anchor, node);
8642
+ return rel !== "" && !rel.startsWith("..") && !path5.isAbsolute(rel);
8558
8643
  }
8559
8644
  function relative_to(child, parent) {
8560
8645
  if (child === parent) {
8561
8646
  return "";
8562
8647
  }
8563
- const rel = path4.relative(parent, child);
8564
- if (rel.startsWith("..") || path4.isAbsolute(rel)) {
8648
+ const rel = path5.relative(parent, child);
8649
+ if (rel.startsWith("..") || path5.isAbsolute(rel)) {
8565
8650
  throw new Error(`'${child}' is not in the subpath of '${parent}'`);
8566
8651
  }
8567
8652
  return rel;
8568
8653
  }
8569
8654
  function relative_to_posix(child, parent) {
8570
- return path4.relative(parent, child).split(path4.sep).join("/");
8655
+ return path5.relative(parent, child).split(path5.sep).join("/");
8571
8656
  }
8572
8657
  function rglob_md(root) {
8573
8658
  const out = [];
8574
8659
  const walk = (dir) => {
8575
8660
  let names;
8576
8661
  try {
8577
- names = fs4.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8662
+ names = fs5.readdirSync(dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
8578
8663
  } catch {
8579
8664
  return;
8580
8665
  }
8581
8666
  for (const name of names) {
8582
- const full = path4.join(dir, name);
8667
+ const full = path5.join(dir, name);
8583
8668
  let lst;
8584
8669
  try {
8585
- lst = fs4.lstatSync(full);
8670
+ lst = fs5.lstatSync(full);
8586
8671
  } catch {
8587
8672
  continue;
8588
8673
  }
@@ -8623,13 +8708,13 @@ function splitlines2(text) {
8623
8708
  }
8624
8709
 
8625
8710
  // src/scripts/_lib/installed_tools.ts
8626
- import * as fs6 from "node:fs";
8711
+ import * as fs7 from "node:fs";
8627
8712
  import * as os4 from "node:os";
8628
8713
  import * as fsPath from "node:path";
8629
8714
 
8630
8715
  // src/scripts/_lib/fs_atomic.ts
8631
- import fs5 from "node:fs";
8632
- import path5 from "node:path";
8716
+ import fs6 from "node:fs";
8717
+ import path6 from "node:path";
8633
8718
  import { randomBytes as randomBytes3 } from "node:crypto";
8634
8719
  function _normalize_encoding(encoding) {
8635
8720
  const compact = encoding.toLowerCase().replace(/[-_\s]/g, "");
@@ -8645,9 +8730,9 @@ function _normalize_encoding(encoding) {
8645
8730
  }
8646
8731
  function write_atomic(p, data, options = {}) {
8647
8732
  const encoding = options.encoding ?? "utf-8";
8648
- const target = path5.normalize(p);
8649
- const parent = path5.dirname(target);
8650
- fs5.mkdirSync(parent, { recursive: true });
8733
+ const target = path6.normalize(p);
8734
+ const parent = path6.dirname(target);
8735
+ fs6.mkdirSync(parent, { recursive: true });
8651
8736
  let payload;
8652
8737
  if (typeof data === "string") {
8653
8738
  payload = Buffer.from(data, _normalize_encoding(encoding));
@@ -8661,12 +8746,12 @@ function write_atomic(p, data, options = {}) {
8661
8746
  let fd = null;
8662
8747
  let tmp_path = "";
8663
8748
  for (let attempt = 0; attempt < 32; attempt += 1) {
8664
- tmp_path = path5.join(
8749
+ tmp_path = path6.join(
8665
8750
  parent,
8666
- `.${path5.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
8751
+ `.${path6.basename(target)}.tmp.${randomBytes3(6).toString("hex")}`
8667
8752
  );
8668
8753
  try {
8669
- fd = fs5.openSync(tmp_path, "wx", 384);
8754
+ fd = fs6.openSync(tmp_path, "wx", 384);
8670
8755
  break;
8671
8756
  } catch (err) {
8672
8757
  if (err.code === "EEXIST") continue;
@@ -8680,24 +8765,24 @@ function write_atomic(p, data, options = {}) {
8680
8765
  try {
8681
8766
  let offset = 0;
8682
8767
  while (offset < payload.length) {
8683
- offset += fs5.writeSync(fd, payload, offset, payload.length - offset);
8768
+ offset += fs6.writeSync(fd, payload, offset, payload.length - offset);
8684
8769
  }
8685
8770
  try {
8686
- fs5.fsyncSync(fd);
8771
+ fs6.fsyncSync(fd);
8687
8772
  } catch {
8688
8773
  }
8689
- fs5.closeSync(fd);
8774
+ fs6.closeSync(fd);
8690
8775
  closed = true;
8691
- fs5.renameSync(tmp_path, target);
8776
+ fs6.renameSync(tmp_path, target);
8692
8777
  } catch (err) {
8693
8778
  if (!closed) {
8694
8779
  try {
8695
- fs5.closeSync(fd);
8780
+ fs6.closeSync(fd);
8696
8781
  } catch {
8697
8782
  }
8698
8783
  }
8699
8784
  try {
8700
- fs5.unlinkSync(tmp_path);
8785
+ fs6.unlinkSync(tmp_path);
8701
8786
  } catch {
8702
8787
  }
8703
8788
  throw err;
@@ -8708,17 +8793,17 @@ function write_atomic(p, data, options = {}) {
8708
8793
  function _fsync_dir(directory) {
8709
8794
  let dir_fd;
8710
8795
  try {
8711
- dir_fd = fs5.openSync(directory, fs5.constants.O_RDONLY);
8796
+ dir_fd = fs6.openSync(directory, fs6.constants.O_RDONLY);
8712
8797
  } catch {
8713
8798
  return;
8714
8799
  }
8715
8800
  try {
8716
8801
  try {
8717
- fs5.fsyncSync(dir_fd);
8802
+ fs6.fsyncSync(dir_fd);
8718
8803
  } catch {
8719
8804
  }
8720
8805
  } finally {
8721
- fs5.closeSync(dir_fd);
8806
+ fs6.closeSync(dir_fd);
8722
8807
  }
8723
8808
  }
8724
8809
 
@@ -8747,18 +8832,18 @@ function manifest_path(project_root, env) {
8747
8832
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8748
8833
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
8749
8834
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8750
- function read_manifest(path15) {
8835
+ function read_manifest(path16) {
8751
8836
  let text;
8752
8837
  try {
8753
- text = require_read_text(path15);
8838
+ text = require_read_text(path16);
8754
8839
  } catch {
8755
8840
  return null;
8756
8841
  }
8757
8842
  const data = _parse_manual(text);
8758
8843
  return _normalise_v2_shape(data);
8759
8844
  }
8760
- function require_read_text(path15) {
8761
- return fs6.readFileSync(path15, { encoding: "utf-8" });
8845
+ function require_read_text(path16) {
8846
+ return fs7.readFileSync(path16, { encoding: "utf-8" });
8762
8847
  }
8763
8848
  function _normalise_v2_shape(data) {
8764
8849
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -8939,9 +9024,9 @@ function stable_sort(items, key) {
8939
9024
  return a.index - b.index;
8940
9025
  }).map((entry) => entry.item);
8941
9026
  }
8942
- function write_manifest(path15, version, tools, options = {}) {
9027
+ function write_manifest(path16, version, tools, options = {}) {
8943
9028
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
8944
- return write_atomic(path15, rendered);
9029
+ return write_atomic(path16, rendered);
8945
9030
  }
8946
9031
  var ScopeMismatchError = class extends Error {
8947
9032
  name_;
@@ -9032,25 +9117,25 @@ function _today() {
9032
9117
  // src/scripts/_lib/install_drift.ts
9033
9118
  var import_yaml = __toESM(require_dist(), 1);
9034
9119
  import * as crypto from "node:crypto";
9035
- import * as fs7 from "node:fs";
9120
+ import * as fs8 from "node:fs";
9036
9121
  import * as os5 from "node:os";
9037
- import * as path6 from "node:path";
9122
+ import * as path7 from "node:path";
9038
9123
  function expanduser5(p) {
9039
9124
  if (p === "~") {
9040
9125
  return os5.homedir();
9041
9126
  }
9042
9127
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
9043
- return path6.join(os5.homedir(), p.slice(2));
9128
+ return path7.join(os5.homedir(), p.slice(2));
9044
9129
  }
9045
9130
  return p;
9046
9131
  }
9047
9132
  function resolve_entry_path(project_root, raw) {
9048
9133
  const p = expanduser5(raw);
9049
- return path6.isAbsolute(p) ? p : path6.join(project_root, p);
9134
+ return path7.isAbsolute(p) ? p : path7.join(project_root, p);
9050
9135
  }
9051
9136
  function sha256_of_file(p) {
9052
9137
  try {
9053
- return crypto.createHash("sha256").update(fs7.readFileSync(p)).digest("hex");
9138
+ return crypto.createHash("sha256").update(fs8.readFileSync(p)).digest("hex");
9054
9139
  } catch {
9055
9140
  return null;
9056
9141
  }
@@ -9059,7 +9144,7 @@ function collect_drift(project_root, env) {
9059
9144
  const target = manifest_path(project_root, env);
9060
9145
  let text;
9061
9146
  try {
9062
- text = fs7.readFileSync(target, "utf-8");
9147
+ text = fs8.readFileSync(target, "utf-8");
9063
9148
  } catch {
9064
9149
  return null;
9065
9150
  }
@@ -9104,7 +9189,7 @@ function collect_drift(project_root, env) {
9104
9189
  continue;
9105
9190
  }
9106
9191
  const resolved = resolve_entry_path(project_root, raw_path);
9107
- if (!fs7.existsSync(resolved)) {
9192
+ if (!fs8.existsSync(resolved)) {
9108
9193
  out.push({
9109
9194
  tool_id,
9110
9195
  path: resolved,
@@ -9158,8 +9243,8 @@ function format_drift_report(entries) {
9158
9243
 
9159
9244
  // src/scripts/_lib/claude_desktop_bundler.ts
9160
9245
  import * as crypto2 from "node:crypto";
9161
- import * as fs8 from "node:fs";
9162
- import * as path7 from "node:path";
9246
+ import * as fs9 from "node:fs";
9247
+ import * as path8 from "node:path";
9163
9248
 
9164
9249
  // src/scripts/_lib/zip_min.ts
9165
9250
  import * as zlib from "node:zlib";
@@ -9266,7 +9351,7 @@ function _is_excluded(rel_parts) {
9266
9351
  }
9267
9352
  function _is_dir(p) {
9268
9353
  try {
9269
- return fs8.statSync(p).isDirectory();
9354
+ return fs9.statSync(p).isDirectory();
9270
9355
  } catch {
9271
9356
  return false;
9272
9357
  }
@@ -9278,12 +9363,12 @@ function _compare_rel_parts(a, b) {
9278
9363
  }
9279
9364
  function _walk_skill_files(skill_dir) {
9280
9365
  const out = [];
9281
- const resolved = fs8.realpathSync(skill_dir);
9366
+ const resolved = fs9.realpathSync(skill_dir);
9282
9367
  const walk = (root, relRoot) => {
9283
9368
  const dirNames = [];
9284
9369
  const fileNames = [];
9285
- for (const dirent of fs8.readdirSync(root, { withFileTypes: true })) {
9286
- const full = path7.join(root, dirent.name);
9370
+ for (const dirent of fs9.readdirSync(root, { withFileTypes: true })) {
9371
+ const full = path8.join(root, dirent.name);
9287
9372
  const isDir2 = dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full);
9288
9373
  if (isDir2) {
9289
9374
  dirNames.push(dirent.name);
@@ -9296,13 +9381,13 @@ function _walk_skill_files(skill_dir) {
9296
9381
  if (_is_excluded(rel_parts)) {
9297
9382
  continue;
9298
9383
  }
9299
- out.push([path7.join(root, fname), rel_parts]);
9384
+ out.push([path8.join(root, fname), rel_parts]);
9300
9385
  }
9301
9386
  for (const dname of dirNames) {
9302
9387
  if (_is_excluded([dname])) {
9303
9388
  continue;
9304
9389
  }
9305
- walk(path7.join(root, dname), [...relRoot, dname]);
9390
+ walk(path8.join(root, dname), [...relRoot, dname]);
9306
9391
  }
9307
9392
  };
9308
9393
  walk(resolved, []);
@@ -9315,53 +9400,53 @@ function _manifest_digest(files) {
9315
9400
  const rel = rel_parts.join("/");
9316
9401
  h.update(Buffer.from(rel, "utf-8"));
9317
9402
  h.update(Buffer.from([0]));
9318
- h.update(crypto2.createHash("sha256").update(fs8.readFileSync(abs_path)).digest());
9403
+ h.update(crypto2.createHash("sha256").update(fs9.readFileSync(abs_path)).digest());
9319
9404
  h.update(Buffer.from([0]));
9320
9405
  }
9321
9406
  return h.digest("hex");
9322
9407
  }
9323
9408
  function _atomic_write_zip(zip_path, files) {
9324
- fs8.mkdirSync(path7.dirname(zip_path), { recursive: true });
9325
- const stem = path7.basename(zip_path, path7.extname(zip_path));
9326
- const tmp_path = path7.join(
9327
- path7.dirname(zip_path),
9409
+ fs9.mkdirSync(path8.dirname(zip_path), { recursive: true });
9410
+ const stem = path8.basename(zip_path, path8.extname(zip_path));
9411
+ const tmp_path = path8.join(
9412
+ path8.dirname(zip_path),
9328
9413
  `.${stem}.${crypto2.randomBytes(6).toString("hex")}.zip.tmp`
9329
9414
  );
9330
9415
  try {
9331
9416
  const entries = files.map(([abs_path, rel_parts]) => ({
9332
9417
  name: rel_parts.join("/"),
9333
- data: fs8.readFileSync(abs_path)
9418
+ data: fs9.readFileSync(abs_path)
9334
9419
  }));
9335
- fs8.writeFileSync(tmp_path, zip_write_sync(entries));
9336
- fs8.renameSync(tmp_path, zip_path);
9420
+ fs9.writeFileSync(tmp_path, zip_write_sync(entries));
9421
+ fs9.renameSync(tmp_path, zip_path);
9337
9422
  } finally {
9338
- if (fs8.existsSync(tmp_path)) {
9339
- fs8.unlinkSync(tmp_path);
9423
+ if (fs9.existsSync(tmp_path)) {
9424
+ fs9.unlinkSync(tmp_path);
9340
9425
  }
9341
9426
  }
9342
9427
  }
9343
9428
  function _write_if_changed(dest_dir, slug, files, force, written) {
9344
9429
  const digest = _manifest_digest(files);
9345
- const zip_path = path7.join(dest_dir, `${slug}.zip`);
9346
- const digest_path = path7.join(dest_dir, `${slug}.sha256`);
9347
- const recorded = fs8.existsSync(digest_path) ? fs8.readFileSync(digest_path, "utf-8").trim() : "";
9348
- if (!force && recorded === digest && fs8.existsSync(zip_path)) {
9430
+ const zip_path = path8.join(dest_dir, `${slug}.zip`);
9431
+ const digest_path = path8.join(dest_dir, `${slug}.sha256`);
9432
+ const recorded = fs9.existsSync(digest_path) ? fs9.readFileSync(digest_path, "utf-8").trim() : "";
9433
+ if (!force && recorded === digest && fs9.existsSync(zip_path)) {
9349
9434
  return;
9350
9435
  }
9351
9436
  _atomic_write_zip(zip_path, files);
9352
- fs8.writeFileSync(digest_path, digest + "\n", "utf-8");
9437
+ fs9.writeFileSync(digest_path, digest + "\n", "utf-8");
9353
9438
  written.push(zip_path);
9354
9439
  }
9355
9440
  function build_skill_bundles(package_root, dest_dir, force = false, curation = null) {
9356
- const skills_root = path7.join(package_root, "dist/agent-src", "skills");
9441
+ const skills_root = path8.join(package_root, "dist/agent-src", "skills");
9357
9442
  if (!_is_dir(skills_root)) {
9358
9443
  return [];
9359
9444
  }
9360
- fs8.mkdirSync(dest_dir, { recursive: true });
9445
+ fs9.mkdirSync(dest_dir, { recursive: true });
9361
9446
  const written = [];
9362
- for (const name of fs8.readdirSync(skills_root).sort()) {
9363
- const entry = path7.join(skills_root, name);
9364
- const isSymlink2 = fs8.lstatSync(entry).isSymbolicLink();
9447
+ for (const name of fs9.readdirSync(skills_root).sort()) {
9448
+ const entry = path8.join(skills_root, name);
9449
+ const isSymlink2 = fs9.lstatSync(entry).isSymbolicLink();
9365
9450
  if (!(_is_dir(entry) || isSymlink2)) {
9366
9451
  continue;
9367
9452
  }
@@ -9369,8 +9454,8 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9369
9454
  if (curation !== null && !curation.includes(skill_name)) {
9370
9455
  continue;
9371
9456
  }
9372
- const skill_md = path7.join(entry, "SKILL.md");
9373
- if (!fs8.existsSync(skill_md)) {
9457
+ const skill_md = path8.join(entry, "SKILL.md");
9458
+ if (!fs9.existsSync(skill_md)) {
9374
9459
  continue;
9375
9460
  }
9376
9461
  const files = _walk_skill_files(entry);
@@ -9382,15 +9467,15 @@ function build_skill_bundles(package_root, dest_dir, force = false, curation = n
9382
9467
  return written;
9383
9468
  }
9384
9469
  function _command_slug(source_file, commands_root) {
9385
- const rel = path7.relative(commands_root, source_file);
9386
- const noExt = rel.slice(0, rel.length - path7.extname(rel).length);
9387
- return noExt.split(path7.sep).join("-");
9470
+ const rel = path8.relative(commands_root, source_file);
9471
+ const noExt = rel.slice(0, rel.length - path8.extname(rel).length);
9472
+ return noExt.split(path8.sep).join("-");
9388
9473
  }
9389
9474
  function _iter_command_files(commands_root) {
9390
9475
  const found = [];
9391
9476
  const walk = (dir) => {
9392
- for (const dirent of fs8.readdirSync(dir, { withFileTypes: true })) {
9393
- const full = path7.join(dir, dirent.name);
9477
+ for (const dirent of fs9.readdirSync(dir, { withFileTypes: true })) {
9478
+ const full = path8.join(dir, dirent.name);
9394
9479
  if (dirent.isDirectory() || dirent.isSymbolicLink() && _is_dir(full)) {
9395
9480
  walk(full);
9396
9481
  } else if (dirent.name.endsWith(".md")) {
@@ -9400,21 +9485,21 @@ function _iter_command_files(commands_root) {
9400
9485
  };
9401
9486
  walk(commands_root);
9402
9487
  found.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
9403
- return found.filter((source_file) => path7.basename(source_file) !== "AGENTS.md");
9488
+ return found.filter((source_file) => path8.basename(source_file) !== "AGENTS.md");
9404
9489
  }
9405
9490
  function build_command_bundles(package_root, dest_dir, force = false, curation = null) {
9406
- const commands_root = path7.join(package_root, "dist/agent-src", "commands");
9491
+ const commands_root = path8.join(package_root, "dist/agent-src", "commands");
9407
9492
  if (!_is_dir(commands_root)) {
9408
9493
  return [];
9409
9494
  }
9410
- const skills_root = path7.join(package_root, "dist/agent-src", "skills");
9495
+ const skills_root = path8.join(package_root, "dist/agent-src", "skills");
9411
9496
  let skill_names = /* @__PURE__ */ new Set();
9412
9497
  if (_is_dir(skills_root)) {
9413
9498
  skill_names = new Set(
9414
- fs8.readdirSync(skills_root).filter((name) => _is_dir(path7.join(skills_root, name)))
9499
+ fs9.readdirSync(skills_root).filter((name) => _is_dir(path8.join(skills_root, name)))
9415
9500
  );
9416
9501
  }
9417
- fs8.mkdirSync(dest_dir, { recursive: true });
9502
+ fs9.mkdirSync(dest_dir, { recursive: true });
9418
9503
  const written = [];
9419
9504
  for (const source_file of _iter_command_files(commands_root)) {
9420
9505
  const slug = _command_slug(source_file, commands_root);
@@ -9424,7 +9509,7 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9424
9509
  if (curation !== null && !curation.includes(slug)) {
9425
9510
  continue;
9426
9511
  }
9427
- const files = [[fs8.realpathSync(source_file), ["SKILL.md"]]];
9512
+ const files = [[fs9.realpathSync(source_file), ["SKILL.md"]]];
9428
9513
  _write_if_changed(dest_dir, slug, files, force, written);
9429
9514
  }
9430
9515
  return written;
@@ -9432,8 +9517,8 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9432
9517
 
9433
9518
  // src/scripts/_lib/claude_settings_hooks.ts
9434
9519
  var YAML = __toESM(require_dist(), 1);
9435
- import * as fs9 from "node:fs";
9436
- import * as path8 from "node:path";
9520
+ import * as fs10 from "node:fs";
9521
+ import * as path9 from "node:path";
9437
9522
 
9438
9523
  // src/install/atomic.ts
9439
9524
  import {
@@ -9441,17 +9526,17 @@ import {
9441
9526
  fsyncSync,
9442
9527
  mkdirSync as mkdirSync5,
9443
9528
  openSync as openSync3,
9444
- readFileSync as readFileSync7,
9529
+ readFileSync as readFileSync8,
9445
9530
  renameSync as renameSync5,
9446
9531
  unlinkSync as unlinkSync4,
9447
9532
  writeSync
9448
9533
  } from "node:fs";
9449
- import { dirname as dirname4, join as join8 } from "node:path";
9534
+ import { dirname as dirname4, join as join9 } from "node:path";
9450
9535
  function atomicWriteFile(target, data, options = {}) {
9451
9536
  const mode = options.mode ?? 420;
9452
9537
  const parent = dirname4(target);
9453
9538
  mkdirSync5(parent, { recursive: true });
9454
- const tmp = join8(parent, `.tmp.${process.pid}.${randSuffix()}`);
9539
+ const tmp = join9(parent, `.tmp.${process.pid}.${randSuffix()}`);
9455
9540
  let fd = null;
9456
9541
  try {
9457
9542
  fd = openSync3(tmp, "w", mode);
@@ -9501,7 +9586,7 @@ var SettingsLockError = class extends Error {
9501
9586
  }
9502
9587
  };
9503
9588
  function build_claude_hook_matrix(manifest_path2) {
9504
- const raw = fs9.readFileSync(manifest_path2, "utf8");
9589
+ const raw = fs10.readFileSync(manifest_path2, "utf8");
9505
9590
  const manifest = _yaml_parse(raw) ?? {};
9506
9591
  const hook_spec = manifest["schema_version"] ?? 1;
9507
9592
  const platforms = manifest["platforms"] ?? {};
@@ -9530,8 +9615,8 @@ function _is_managed_group(group) {
9530
9615
  );
9531
9616
  }
9532
9617
  function _read_settings(settings_path) {
9533
- if (!fs9.existsSync(settings_path)) return {};
9534
- const raw = fs9.readFileSync(settings_path, "utf8");
9618
+ if (!fs10.existsSync(settings_path)) return {};
9619
+ const raw = fs10.readFileSync(settings_path, "utf8");
9535
9620
  if (raw.trim() === "") return {};
9536
9621
  let parsed;
9537
9622
  try {
@@ -9546,18 +9631,18 @@ function _read_settings(settings_path) {
9546
9631
  }
9547
9632
  function _with_lock(settings_path, fn) {
9548
9633
  const lockPath = settings_path + ".agent-config.lock";
9549
- fs9.mkdirSync(path8.dirname(lockPath), { recursive: true });
9634
+ fs10.mkdirSync(path9.dirname(lockPath), { recursive: true });
9550
9635
  let fd;
9551
9636
  try {
9552
- fd = fs9.openSync(lockPath, "wx");
9637
+ fd = fs10.openSync(lockPath, "wx");
9553
9638
  } catch {
9554
9639
  throw new SettingsLockError(lockPath);
9555
9640
  }
9556
9641
  try {
9557
9642
  return fn();
9558
9643
  } finally {
9559
- fs9.closeSync(fd);
9560
- fs9.rmSync(lockPath, { force: true });
9644
+ fs10.closeSync(fd);
9645
+ fs10.rmSync(lockPath, { force: true });
9561
9646
  }
9562
9647
  }
9563
9648
  function ensure_managed_hooks(settings_path, matrix) {
@@ -9587,11 +9672,11 @@ function ensure_managed_hooks(settings_path, matrix) {
9587
9672
  }
9588
9673
 
9589
9674
  // src/scripts/_lib/agent_settings.ts
9590
- import { createRequire } from "node:module";
9591
- import * as fs10 from "node:fs";
9675
+ import { createRequire as createRequire2 } from "node:module";
9676
+ import * as fs11 from "node:fs";
9592
9677
  import * as os6 from "node:os";
9593
- import * as path9 from "node:path";
9594
- var _require = createRequire(import.meta.url);
9678
+ import * as path10 from "node:path";
9679
+ var _require2 = createRequire2(import.meta.url);
9595
9680
  var Logger = class {
9596
9681
  name = "scripts._lib.agent_settings";
9597
9682
  records = [];
@@ -9630,10 +9715,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
9630
9715
  var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
9631
9716
  var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
9632
9717
  function _local_settings_path(project_root) {
9633
- return path9.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9718
+ return path10.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9634
9719
  }
9635
9720
  function _canonical_settings_path(project_root) {
9636
- return path9.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9721
+ return path10.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9637
9722
  }
9638
9723
  var USER_GLOBAL_FILENAME = "agent-settings.yml";
9639
9724
  function DEFAULT_USER_GLOBAL_FILE() {
@@ -9681,8 +9766,8 @@ var _AGENTS_DIR_MARKERS = [
9681
9766
  var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
9682
9767
  function _exists(p) {
9683
9768
  try {
9684
- fs10.lstatSync(p);
9685
- fs10.statSync(p);
9769
+ fs11.lstatSync(p);
9770
+ fs11.statSync(p);
9686
9771
  return true;
9687
9772
  } catch {
9688
9773
  return false;
@@ -9690,22 +9775,22 @@ function _exists(p) {
9690
9775
  }
9691
9776
  function _is_dir2(p) {
9692
9777
  try {
9693
- return fs10.statSync(p).isDirectory();
9778
+ return fs11.statSync(p).isDirectory();
9694
9779
  } catch {
9695
9780
  return false;
9696
9781
  }
9697
9782
  }
9698
9783
  function _is_file(p) {
9699
9784
  try {
9700
- return fs10.statSync(p).isFile();
9785
+ return fs11.statSync(p).isFile();
9701
9786
  } catch {
9702
9787
  return false;
9703
9788
  }
9704
9789
  }
9705
9790
  function _resolve(p) {
9706
- const absolute = path9.resolve(p);
9791
+ const absolute = path10.resolve(p);
9707
9792
  try {
9708
- return fs10.realpathSync(absolute);
9793
+ return fs11.realpathSync(absolute);
9709
9794
  } catch {
9710
9795
  return absolute;
9711
9796
  }
@@ -9715,7 +9800,7 @@ function _ancestor_chain(start) {
9715
9800
  let cursor = start;
9716
9801
  for (; ; ) {
9717
9802
  chain.push(cursor);
9718
- const parent = path9.dirname(cursor);
9803
+ const parent = path10.dirname(cursor);
9719
9804
  if (parent === cursor) {
9720
9805
  break;
9721
9806
  }
@@ -9724,15 +9809,15 @@ function _ancestor_chain(start) {
9724
9809
  return chain;
9725
9810
  }
9726
9811
  function _boundary_anchor_at(dir) {
9727
- const agents_dir = path9.join(dir, "agents");
9812
+ const agents_dir = path10.join(dir, "agents");
9728
9813
  if (_is_dir2(agents_dir)) {
9729
9814
  for (const marker of _AGENTS_DIR_MARKERS) {
9730
- if (_exists(path9.join(agents_dir, marker))) {
9815
+ if (_exists(path10.join(agents_dir, marker))) {
9731
9816
  return ANCHOR_AGENTS_DIR;
9732
9817
  }
9733
9818
  }
9734
9819
  }
9735
- if (_exists(path9.join(dir, ".git"))) {
9820
+ if (_exists(path10.join(dir, ".git"))) {
9736
9821
  return ANCHOR_GIT;
9737
9822
  }
9738
9823
  return null;
@@ -9743,7 +9828,7 @@ function find_project_root_with_anchor(start) {
9743
9828
  const chain = _ancestor_chain(current);
9744
9829
  if (legacy) {
9745
9830
  for (const candidate of chain) {
9746
- if (_exists(path9.join(candidate, ".git"))) {
9831
+ if (_exists(path10.join(candidate, ".git"))) {
9747
9832
  return [candidate, ANCHOR_GIT];
9748
9833
  }
9749
9834
  }
@@ -9757,7 +9842,7 @@ function find_project_root_with_anchor(start) {
9757
9842
  }
9758
9843
  let outermost = null;
9759
9844
  for (const candidate of chain) {
9760
- if (_exists(path9.join(candidate, DEFAULT_PROJECT_FILE))) {
9845
+ if (_exists(path10.join(candidate, DEFAULT_PROJECT_FILE))) {
9761
9846
  outermost = candidate;
9762
9847
  }
9763
9848
  }
@@ -9801,7 +9886,7 @@ function _expanduser(p) {
9801
9886
  return os6.homedir();
9802
9887
  }
9803
9888
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
9804
- return path9.join(os6.homedir(), p.slice(2));
9889
+ return path10.join(os6.homedir(), p.slice(2));
9805
9890
  }
9806
9891
  return p;
9807
9892
  }
@@ -9830,13 +9915,13 @@ function resolve_project_root(arg, options = {}) {
9830
9915
  function _resolve_cascade_paths(cwd, project_path) {
9831
9916
  if (cwd === null) {
9832
9917
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9833
- const parent = path9.dirname(legacy);
9918
+ const parent = path10.dirname(legacy);
9834
9919
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9835
9920
  }
9836
9921
  const root = find_project_root(cwd);
9837
9922
  if (root === null) {
9838
9923
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9839
- const parent = path9.dirname(legacy);
9924
+ const parent = path10.dirname(legacy);
9840
9925
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9841
9926
  }
9842
9927
  const cwd_resolved = _resolve(cwd);
@@ -9847,7 +9932,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9847
9932
  if (cursor === root) {
9848
9933
  break;
9849
9934
  }
9850
- const parent = path9.dirname(cursor);
9935
+ const parent = path10.dirname(cursor);
9851
9936
  if (parent === cursor) {
9852
9937
  break;
9853
9938
  }
@@ -9855,7 +9940,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9855
9940
  }
9856
9941
  chain.reverse();
9857
9942
  return [
9858
- ...chain.map((d) => path9.join(d, DEFAULT_PROJECT_FILE)),
9943
+ ...chain.map((d) => path10.join(d, DEFAULT_PROJECT_FILE)),
9859
9944
  _canonical_settings_path(root),
9860
9945
  _local_settings_path(root)
9861
9946
  ];
@@ -9890,13 +9975,13 @@ function _read_yaml(p) {
9890
9975
  }
9891
9976
  let YAML3;
9892
9977
  try {
9893
- YAML3 = _require("yaml");
9978
+ YAML3 = _require2("yaml");
9894
9979
  } catch {
9895
9980
  return null;
9896
9981
  }
9897
9982
  let data;
9898
9983
  try {
9899
- const text = fs10.readFileSync(p, "utf-8");
9984
+ const text = fs11.readFileSync(p, "utf-8");
9900
9985
  data = YAML3.parse(text, { version: "1.1" });
9901
9986
  if (data === null || data === void 0) {
9902
9987
  data = {};
@@ -9988,11 +10073,11 @@ function _is_plain_dict(value) {
9988
10073
  }
9989
10074
 
9990
10075
  // src/install/rule_scope.ts
9991
- import * as path10 from "node:path";
10076
+ import * as path11 from "node:path";
9992
10077
 
9993
10078
  // src/install/ruleInScope.ts
9994
10079
  var YAML2 = __toESM(require_dist(), 1);
9995
- import * as fs11 from "node:fs";
10080
+ import * as fs12 from "node:fs";
9996
10081
  function parseYaml2(text) {
9997
10082
  try {
9998
10083
  const data = YAML2.parse(text, { version: "1.1" });
@@ -10030,7 +10115,7 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
10030
10115
  if (scope === null && pack_scope === null && role_scope === null) {
10031
10116
  return true;
10032
10117
  }
10033
- const [meta] = parseFrontmatter(fs11.readFileSync(source_path, "utf-8"));
10118
+ const [meta] = parseFrontmatter(fs12.readFileSync(source_path, "utf-8"));
10034
10119
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
10035
10120
  return true;
10036
10121
  }
@@ -10072,7 +10157,7 @@ function ruleFileArrives(sourcePath, scope) {
10072
10157
  if (!sourcePath.endsWith(".md")) {
10073
10158
  return true;
10074
10159
  }
10075
- const basename5 = path10.basename(sourcePath);
10160
+ const basename5 = path11.basename(sourcePath);
10076
10161
  if (COMPAT_ALWAYS_EXCLUDED.includes(basename5)) {
10077
10162
  return false;
10078
10163
  }
@@ -10630,8 +10715,8 @@ function getErrorMap() {
10630
10715
 
10631
10716
  // node_modules/zod/v3/helpers/parseUtil.js
10632
10717
  var makeIssue = (params) => {
10633
- const { data, path: path15, errorMaps, issueData } = params;
10634
- const fullPath = [...path15, ...issueData.path || []];
10718
+ const { data, path: path16, errorMaps, issueData } = params;
10719
+ const fullPath = [...path16, ...issueData.path || []];
10635
10720
  const fullIssue = {
10636
10721
  ...issueData,
10637
10722
  path: fullPath
@@ -10747,11 +10832,11 @@ var errorUtil;
10747
10832
 
10748
10833
  // node_modules/zod/v3/types.js
10749
10834
  var ParseInputLazyPath = class {
10750
- constructor(parent, value, path15, key) {
10835
+ constructor(parent, value, path16, key) {
10751
10836
  this._cachedPath = [];
10752
10837
  this.parent = parent;
10753
10838
  this.data = value;
10754
- this._path = path15;
10839
+ this._path = path16;
10755
10840
  this._key = key;
10756
10841
  }
10757
10842
  get path() {
@@ -15981,8 +16066,8 @@ var zodToJsonSchema = (schema, options) => {
15981
16066
  };
15982
16067
 
15983
16068
  // src/scripts/_lib/module_detection.ts
15984
- import * as fs12 from "node:fs";
15985
- import * as path11 from "node:path";
16069
+ import * as fs13 from "node:fs";
16070
+ import * as path12 from "node:path";
15986
16071
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
15987
16072
  var _RULES = [
15988
16073
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -15996,14 +16081,14 @@ var _RULES = [
15996
16081
  ];
15997
16082
  function _isDir(p) {
15998
16083
  try {
15999
- return fs12.statSync(p).isDirectory();
16084
+ return fs13.statSync(p).isDirectory();
16000
16085
  } catch {
16001
16086
  return false;
16002
16087
  }
16003
16088
  }
16004
16089
  function _isFile(p) {
16005
16090
  try {
16006
- return fs12.statSync(p).isFile();
16091
+ return fs13.statSync(p).isFile();
16007
16092
  } catch {
16008
16093
  return false;
16009
16094
  }
@@ -16017,13 +16102,13 @@ function _isUpperChar(ch) {
16017
16102
  function _list_module_subdirs(root) {
16018
16103
  let entries;
16019
16104
  try {
16020
- entries = fs12.readdirSync(root).sort();
16105
+ entries = fs13.readdirSync(root).sort();
16021
16106
  } catch {
16022
16107
  return [];
16023
16108
  }
16024
16109
  const out = [];
16025
16110
  for (const name of entries) {
16026
- if (!_isDir(path11.join(root, name))) {
16111
+ if (!_isDir(path12.join(root, name))) {
16027
16112
  continue;
16028
16113
  }
16029
16114
  if (name.startsWith(".")) {
@@ -16045,11 +16130,11 @@ function _score_confidence(stack, root, subdirs) {
16045
16130
  return capitalized.length > 0 ? "high" : "medium";
16046
16131
  }
16047
16132
  if (stack === "node-monorepo") {
16048
- const withPkgJson = subdirs.filter((name) => _isFile(path11.join(root, name, "package.json")));
16133
+ const withPkgJson = subdirs.filter((name) => _isFile(path12.join(root, name, "package.json")));
16049
16134
  return withPkgJson.length > 0 ? "high" : "medium";
16050
16135
  }
16051
16136
  if (stack === "python-src") {
16052
- const withInit = subdirs.filter((name) => _isFile(path11.join(root, name, "__init__.py")));
16137
+ const withInit = subdirs.filter((name) => _isFile(path12.join(root, name, "__init__.py")));
16053
16138
  return withInit.length > 0 ? "high" : "medium";
16054
16139
  }
16055
16140
  if (stack === "go-internal") {
@@ -16061,7 +16146,7 @@ function detect_module_roots(project_root) {
16061
16146
  const high = [];
16062
16147
  const medium = [];
16063
16148
  for (const [rel_path, stack, namespace_template] of _RULES) {
16064
- const abs_path = path11.join(project_root, rel_path);
16149
+ const abs_path = path12.join(project_root, rel_path);
16065
16150
  if (!_isDir(abs_path)) {
16066
16151
  continue;
16067
16152
  }
@@ -16083,7 +16168,7 @@ function detect_module_roots(project_root) {
16083
16168
  }
16084
16169
 
16085
16170
  // src/scripts/_lib/model_tier.ts
16086
- import fs13 from "node:fs";
16171
+ import fs14 from "node:fs";
16087
16172
  var TIER_TO_CLAUDE_MODEL = {
16088
16173
  high: "opus",
16089
16174
  medium: "sonnet",
@@ -16091,8 +16176,8 @@ var TIER_TO_CLAUDE_MODEL = {
16091
16176
  };
16092
16177
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
16093
16178
  function read_model_tier(skill_md) {
16094
- if (!fs13.existsSync(skill_md)) return null;
16095
- const text = fs13.readFileSync(skill_md).toString("utf-8");
16179
+ if (!fs14.existsSync(skill_md)) return null;
16180
+ const text = fs14.readFileSync(skill_md).toString("utf-8");
16096
16181
  if (!text.startsWith("---\n")) return null;
16097
16182
  const end = text.indexOf("\n---\n", 4);
16098
16183
  if (end === -1) return null;
@@ -16109,39 +16194,39 @@ function render_native_model_md(text, tier) {
16109
16194
 
16110
16195
  // src/scripts/_cli/cmd_migrate.ts
16111
16196
  import { spawnSync } from "node:child_process";
16112
- import * as fs15 from "node:fs";
16113
- import * as path13 from "node:path";
16197
+ import * as fs16 from "node:fs";
16198
+ import * as path14 from "node:path";
16114
16199
  import process2 from "node:process";
16115
16200
  import { fileURLToPath as fileURLToPath3, pathToFileURL } from "node:url";
16116
16201
 
16117
16202
  // src/scripts/_lib/package_root.ts
16118
- import * as fs14 from "node:fs";
16119
- import * as path12 from "node:path";
16203
+ import * as fs15 from "node:fs";
16204
+ import * as path13 from "node:path";
16120
16205
  import { fileURLToPath as fileURLToPath2 } from "node:url";
16121
16206
  var PACKAGE_NAME = "@event4u/agent-config";
16122
16207
  var MAX_ASCENT = 16;
16123
16208
  function resolvePackageRoot(fromUrlOrPath, legacyHops = 3) {
16124
16209
  const start = fromUrlOrPath.startsWith("file:") ? fileURLToPath2(fromUrlOrPath) : fromUrlOrPath;
16125
- const startDir = path12.dirname(start);
16210
+ const startDir = path13.dirname(start);
16126
16211
  let dir = startDir;
16127
16212
  for (let i = 0; i < MAX_ASCENT; i++) {
16128
- const manifest = path12.join(dir, "package.json");
16129
- if (fs14.existsSync(manifest)) {
16213
+ const manifest = path13.join(dir, "package.json");
16214
+ if (fs15.existsSync(manifest)) {
16130
16215
  try {
16131
- const parsed = JSON.parse(fs14.readFileSync(manifest, "utf8"));
16216
+ const parsed = JSON.parse(fs15.readFileSync(manifest, "utf8"));
16132
16217
  if (parsed.name === PACKAGE_NAME) {
16133
16218
  return dir;
16134
16219
  }
16135
16220
  } catch {
16136
16221
  }
16137
16222
  }
16138
- const parent = path12.dirname(dir);
16223
+ const parent = path13.dirname(dir);
16139
16224
  if (parent === dir) {
16140
16225
  break;
16141
16226
  }
16142
16227
  dir = parent;
16143
16228
  }
16144
- return path12.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16229
+ return path13.resolve(startDir, ...Array.from({ length: legacyHops }, () => ".."));
16145
16230
  }
16146
16231
 
16147
16232
  // src/scripts/_cli/cmd_migrate.ts
@@ -16162,7 +16247,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
16162
16247
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
16163
16248
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
16164
16249
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
16165
- var _HERE_DIR = path13.dirname(fileURLToPath3(import.meta.url));
16250
+ var _HERE_DIR = path14.dirname(fileURLToPath3(import.meta.url));
16166
16251
  var ArgparseExit = class extends Error {
16167
16252
  code;
16168
16253
  constructor(code) {
@@ -16261,38 +16346,38 @@ function _jsonDumpsIndentAscii(value, indent) {
16261
16346
  }
16262
16347
  function _isFile2(p) {
16263
16348
  try {
16264
- return fs15.statSync(p).isFile();
16349
+ return fs16.statSync(p).isFile();
16265
16350
  } catch {
16266
16351
  return false;
16267
16352
  }
16268
16353
  }
16269
16354
  function _isDir2(p) {
16270
16355
  try {
16271
- return fs15.statSync(p).isDirectory();
16356
+ return fs16.statSync(p).isDirectory();
16272
16357
  } catch {
16273
16358
  return false;
16274
16359
  }
16275
16360
  }
16276
16361
  function _isSymlink(p) {
16277
16362
  try {
16278
- return fs15.lstatSync(p).isSymbolicLink();
16363
+ return fs16.lstatSync(p).isSymbolicLink();
16279
16364
  } catch {
16280
16365
  return false;
16281
16366
  }
16282
16367
  }
16283
16368
  function _exists2(p) {
16284
16369
  try {
16285
- fs15.lstatSync(p);
16370
+ fs16.lstatSync(p);
16286
16371
  return true;
16287
16372
  } catch {
16288
16373
  return false;
16289
16374
  }
16290
16375
  }
16291
16376
  function _readText(p) {
16292
- return fs15.readFileSync(p, { encoding: "utf-8" });
16377
+ return fs16.readFileSync(p, { encoding: "utf-8" });
16293
16378
  }
16294
16379
  function _writeText(p, text) {
16295
- fs15.writeFileSync(p, text, { encoding: "utf-8" });
16380
+ fs16.writeFileSync(p, text, { encoding: "utf-8" });
16296
16381
  }
16297
16382
  function _jsonLoadFile(p) {
16298
16383
  return JSON.parse(_readText(p));
@@ -16348,7 +16433,7 @@ function _classify_symlink(link) {
16348
16433
  }
16349
16434
  let target;
16350
16435
  try {
16351
- target = fs15.readlinkSync(link);
16436
+ target = fs16.readlinkSync(link);
16352
16437
  } catch {
16353
16438
  return null;
16354
16439
  }
@@ -16359,16 +16444,16 @@ function _classify_symlink(link) {
16359
16444
  return "user";
16360
16445
  }
16361
16446
  function _detect_legacy_state(project) {
16362
- return _isFile2(path13.join(project, LEGACY_STATE_FILENAME));
16447
+ return _isFile2(path14.join(project, LEGACY_STATE_FILENAME));
16363
16448
  }
16364
16449
  function _detect_legacy_settings(project) {
16365
16450
  const found = [];
16366
16451
  for (const name of LEGACY_SETTINGS_FILES) {
16367
- const flat = path13.join(project, name);
16452
+ const flat = path14.join(project, name);
16368
16453
  if (_isFile2(flat)) {
16369
16454
  found.push(flat);
16370
16455
  }
16371
- const typed = path13.join(project, "settings", name);
16456
+ const typed = path14.join(project, "settings", name);
16372
16457
  if (_isFile2(typed)) {
16373
16458
  found.push(typed);
16374
16459
  }
@@ -16376,25 +16461,25 @@ function _detect_legacy_settings(project) {
16376
16461
  return found;
16377
16462
  }
16378
16463
  function _detect_empty_shell(project) {
16379
- const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
16464
+ const shell = path14.join(project, LEGACY_AGENT_CONFIG_SHELL);
16380
16465
  if (!_isDir2(shell) || _isSymlink(shell)) {
16381
16466
  return false;
16382
16467
  }
16383
16468
  try {
16384
- return fs15.readdirSync(shell).length === 0;
16469
+ return fs16.readdirSync(shell).length === 0;
16385
16470
  } catch {
16386
16471
  return false;
16387
16472
  }
16388
16473
  }
16389
16474
  function _detect_already_migrated(project) {
16390
- if (_detect_npm(path13.join(project, "package.json"))) {
16475
+ if (_detect_npm(path14.join(project, "package.json"))) {
16391
16476
  return false;
16392
16477
  }
16393
- if (_detect_composer(path13.join(project, "composer.json"))) {
16478
+ if (_detect_composer(path14.join(project, "composer.json"))) {
16394
16479
  return false;
16395
16480
  }
16396
16481
  for (const name of MANAGED_SYMLINKS) {
16397
- if (_classify_symlink(path13.join(project, name)) === "legacy") {
16482
+ if (_classify_symlink(path14.join(project, name)) === "legacy") {
16398
16483
  return false;
16399
16484
  }
16400
16485
  }
@@ -16465,11 +16550,11 @@ function _purge_legacy_symlinks(project) {
16465
16550
  const removed = [];
16466
16551
  const preserved = [];
16467
16552
  for (const name of MANAGED_SYMLINKS) {
16468
- const link = path13.join(project, name);
16553
+ const link = path14.join(project, name);
16469
16554
  const kind = _classify_symlink(link);
16470
16555
  if (kind === "legacy") {
16471
16556
  try {
16472
- fs15.unlinkSync(link);
16557
+ fs16.unlinkSync(link);
16473
16558
  removed.push(name);
16474
16559
  } catch {
16475
16560
  preserved.push(name);
@@ -16481,14 +16566,14 @@ function _purge_legacy_symlinks(project) {
16481
16566
  return [removed, preserved];
16482
16567
  }
16483
16568
  function _migrate_state_file(project) {
16484
- const source = path13.join(project, LEGACY_STATE_FILENAME);
16569
+ const source = path14.join(project, LEGACY_STATE_FILENAME);
16485
16570
  if (!_isFile2(source)) {
16486
16571
  return null;
16487
16572
  }
16488
- const target = path13.join(project, LEGACY_STATE_V1_FILENAME);
16573
+ const target = path14.join(project, LEGACY_STATE_V1_FILENAME);
16489
16574
  if (_exists2(target)) {
16490
16575
  try {
16491
- fs15.unlinkSync(source);
16576
+ fs16.unlinkSync(source);
16492
16577
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
16493
16578
  } catch {
16494
16579
  return null;
@@ -16503,7 +16588,7 @@ function _migrate_state_file(project) {
16503
16588
  }
16504
16589
  function _load_state_migrator() {
16505
16590
  const pkg_root = resolvePackageRoot(import.meta.url);
16506
- const rel = path13.join(
16591
+ const rel = path14.join(
16507
16592
  "agent-src",
16508
16593
  "templates",
16509
16594
  "scripts",
@@ -16511,8 +16596,8 @@ function _load_state_migrator() {
16511
16596
  "migration",
16512
16597
  "v0_to_v1.ts"
16513
16598
  );
16514
- const driver = [path13.join(pkg_root, "dist", rel), path13.join(pkg_root, "src", rel)].find(
16515
- (p) => fs15.existsSync(p)
16599
+ const driver = [path14.join(pkg_root, "dist", rel), path14.join(pkg_root, "src", rel)].find(
16600
+ (p) => fs16.existsSync(p)
16516
16601
  ) ?? null;
16517
16602
  if (driver === null) {
16518
16603
  return null;
@@ -16520,12 +16605,12 @@ function _load_state_migrator() {
16520
16605
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
16521
16606
  let tsxBin = null;
16522
16607
  for (let dir = pkg_root; ; ) {
16523
- const cand = path13.join(dir, "node_modules", ".bin", binName);
16524
- if (fs15.existsSync(cand)) {
16608
+ const cand = path14.join(dir, "node_modules", ".bin", binName);
16609
+ if (fs16.existsSync(cand)) {
16525
16610
  tsxBin = cand;
16526
16611
  break;
16527
16612
  }
16528
- const parent = path13.dirname(dir);
16613
+ const parent = path14.dirname(dir);
16529
16614
  if (parent === dir) break;
16530
16615
  dir = parent;
16531
16616
  }
@@ -16552,17 +16637,17 @@ function _delete_legacy_settings(project) {
16552
16637
  const removed = [];
16553
16638
  for (const p of _detect_legacy_settings(project)) {
16554
16639
  try {
16555
- fs15.unlinkSync(p);
16556
- removed.push(path13.relative(project, p));
16640
+ fs16.unlinkSync(p);
16641
+ removed.push(path14.relative(project, p));
16557
16642
  } catch {
16558
16643
  continue;
16559
16644
  }
16560
16645
  }
16561
- const settings_dir = path13.join(project, "settings");
16646
+ const settings_dir = path14.join(project, "settings");
16562
16647
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
16563
16648
  try {
16564
- if (fs15.readdirSync(settings_dir).length === 0) {
16565
- fs15.rmdirSync(settings_dir);
16649
+ if (fs16.readdirSync(settings_dir).length === 0) {
16650
+ fs16.rmdirSync(settings_dir);
16566
16651
  removed.push("settings/");
16567
16652
  }
16568
16653
  } catch {
@@ -16571,12 +16656,12 @@ function _delete_legacy_settings(project) {
16571
16656
  return removed;
16572
16657
  }
16573
16658
  function _remove_empty_shell(project) {
16574
- const shell = path13.join(project, LEGACY_AGENT_CONFIG_SHELL);
16659
+ const shell = path14.join(project, LEGACY_AGENT_CONFIG_SHELL);
16575
16660
  if (!_detect_empty_shell(project)) {
16576
16661
  return false;
16577
16662
  }
16578
16663
  try {
16579
- fs15.rmdirSync(shell);
16664
+ fs16.rmdirSync(shell);
16580
16665
  } catch {
16581
16666
  return false;
16582
16667
  }
@@ -16586,7 +16671,7 @@ function _reEscape(s) {
16586
16671
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
16587
16672
  }
16588
16673
  function _update_gitignore(project) {
16589
- const gitignore = path13.join(project, ".gitignore");
16674
+ const gitignore = path14.join(project, ".gitignore");
16590
16675
  const block = `${GITIGNORE_BLOCK_START}
16591
16676
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
16592
16677
  `;
@@ -16617,16 +16702,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
16617
16702
  }
16618
16703
  function _build_plan(project) {
16619
16704
  return {
16620
- npm: _detect_npm(path13.join(project, "package.json")),
16621
- composer: _detect_composer(path13.join(project, "composer.json")),
16705
+ npm: _detect_npm(path14.join(project, "package.json")),
16706
+ composer: _detect_composer(path14.join(project, "composer.json")),
16622
16707
  symlinks_legacy: MANAGED_SYMLINKS.filter(
16623
- (name) => _classify_symlink(path13.join(project, name)) === "legacy"
16708
+ (name) => _classify_symlink(path14.join(project, name)) === "legacy"
16624
16709
  ),
16625
16710
  symlinks_user: MANAGED_SYMLINKS.filter(
16626
- (name) => _classify_symlink(path13.join(project, name)) === "user"
16711
+ (name) => _classify_symlink(path14.join(project, name)) === "user"
16627
16712
  ),
16628
- state_file: _isFile2(path13.join(project, LEGACY_STATE_FILENAME)),
16629
- settings_files: _detect_legacy_settings(project).map((p) => path13.relative(project, p)),
16713
+ state_file: _isFile2(path14.join(project, LEGACY_STATE_FILENAME)),
16714
+ settings_files: _detect_legacy_settings(project).map((p) => path14.relative(project, p)),
16630
16715
  empty_shell: _detect_empty_shell(project)
16631
16716
  };
16632
16717
  }
@@ -16690,10 +16775,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
16690
16775
  }
16691
16776
  function _apply(project, out, err) {
16692
16777
  const summary = [];
16693
- if (_strip_npm_entry(path13.join(project, "package.json"))) {
16778
+ if (_strip_npm_entry(path14.join(project, "package.json"))) {
16694
16779
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
16695
16780
  }
16696
- if (_strip_composer_entry(path13.join(project, "composer.json"))) {
16781
+ if (_strip_composer_entry(path14.join(project, "composer.json"))) {
16697
16782
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
16698
16783
  }
16699
16784
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -16819,13 +16904,13 @@ function _isCliEntry() {
16819
16904
  if (process2.argv[1] === void 0) {
16820
16905
  return false;
16821
16906
  }
16822
- const argvUrl = pathToFileURL(path13.resolve(process2.argv[1])).href;
16907
+ const argvUrl = pathToFileURL(path14.resolve(process2.argv[1])).href;
16823
16908
  if (import.meta.url === argvUrl) {
16824
16909
  return true;
16825
16910
  }
16826
16911
  try {
16827
- const here = fs15.realpathSync(fileURLToPath3(import.meta.url));
16828
- const argv = fs15.realpathSync(path13.resolve(process2.argv[1]));
16912
+ const here = fs16.realpathSync(fileURLToPath3(import.meta.url));
16913
+ const argv = fs16.realpathSync(path14.resolve(process2.argv[1]));
16829
16914
  return here === argv;
16830
16915
  } catch {
16831
16916
  return false;
@@ -16862,34 +16947,34 @@ var ArgparseExit2 = class extends Error {
16862
16947
  function expanduser6(p) {
16863
16948
  if (p === "~") return os7.homedir();
16864
16949
  if (p.startsWith("~/") || p.startsWith("~\\")) {
16865
- return path14.join(os7.homedir(), p.slice(2));
16950
+ return path15.join(os7.homedir(), p.slice(2));
16866
16951
  }
16867
16952
  return p;
16868
16953
  }
16869
16954
  function resolvePath(p) {
16870
16955
  try {
16871
- return fs16.realpathSync(path14.resolve(p));
16956
+ return fs17.realpathSync(path15.resolve(p));
16872
16957
  } catch {
16873
- return path14.resolve(p);
16958
+ return path15.resolve(p);
16874
16959
  }
16875
16960
  }
16876
16961
  function isFile(p) {
16877
16962
  try {
16878
- return fs16.statSync(p).isFile();
16963
+ return fs17.statSync(p).isFile();
16879
16964
  } catch {
16880
16965
  return false;
16881
16966
  }
16882
16967
  }
16883
16968
  function isDir(p) {
16884
16969
  try {
16885
- return fs16.statSync(p).isDirectory();
16970
+ return fs17.statSync(p).isDirectory();
16886
16971
  } catch {
16887
16972
  return false;
16888
16973
  }
16889
16974
  }
16890
16975
  function pathExists(p) {
16891
16976
  try {
16892
- fs16.statSync(p);
16977
+ fs17.statSync(p);
16893
16978
  return true;
16894
16979
  } catch {
16895
16980
  return false;
@@ -16897,24 +16982,24 @@ function pathExists(p) {
16897
16982
  }
16898
16983
  function isSymlink(p) {
16899
16984
  try {
16900
- return fs16.lstatSync(p).isSymbolicLink();
16985
+ return fs17.lstatSync(p).isSymbolicLink();
16901
16986
  } catch {
16902
16987
  return false;
16903
16988
  }
16904
16989
  }
16905
16990
  function readText(p) {
16906
- return fs16.readFileSync(p, "utf-8");
16991
+ return fs17.readFileSync(p, "utf-8");
16907
16992
  }
16908
16993
  function writeText(p, content) {
16909
- fs16.writeFileSync(p, content, "utf-8");
16994
+ fs17.writeFileSync(p, content, "utf-8");
16910
16995
  }
16911
16996
  function mkdirp(p) {
16912
- fs16.mkdirSync(p, { recursive: true });
16997
+ fs17.mkdirSync(p, { recursive: true });
16913
16998
  }
16914
16999
  function sortedGlobStems(directory, suffix) {
16915
17000
  let entries;
16916
17001
  try {
16917
- entries = fs16.readdirSync(directory);
17002
+ entries = fs17.readdirSync(directory);
16918
17003
  } catch {
16919
17004
  return [];
16920
17005
  }
@@ -16934,7 +17019,7 @@ function sortedGlobStems(directory, suffix) {
16934
17019
  function countZips(directory) {
16935
17020
  if (!isDir(directory)) return 0;
16936
17021
  let n = 0;
16937
- for (const name of fs16.readdirSync(directory)) {
17022
+ for (const name of fs17.readdirSync(directory)) {
16938
17023
  if (name.endsWith(".zip")) n += 1;
16939
17024
  }
16940
17025
  return n;
@@ -16942,35 +17027,35 @@ function countZips(directory) {
16942
17027
  function sha256OfFile(p) {
16943
17028
  let data;
16944
17029
  try {
16945
- data = fs16.readFileSync(p);
17030
+ data = fs17.readFileSync(p);
16946
17031
  } catch {
16947
17032
  return null;
16948
17033
  }
16949
17034
  return crypto3.createHash("sha256").update(data).digest("hex");
16950
17035
  }
16951
17036
  function atomicWrite0644(target, body, prefix) {
16952
- const dir = path14.dirname(target);
16953
- const tmpName = path14.join(
17037
+ const dir = path15.dirname(target);
17038
+ const tmpName = path15.join(
16954
17039
  dir,
16955
17040
  `${prefix}${process3.pid}.${crypto3.randomBytes(6).toString("hex")}.yml.tmp`
16956
17041
  );
16957
17042
  let fd = null;
16958
17043
  try {
16959
- fd = fs16.openSync(tmpName, "wx", 420);
16960
- fs16.writeFileSync(fd, body, "utf-8");
16961
- fs16.closeSync(fd);
17044
+ fd = fs17.openSync(tmpName, "wx", 420);
17045
+ fs17.writeFileSync(fd, body, "utf-8");
17046
+ fs17.closeSync(fd);
16962
17047
  fd = null;
16963
- fs16.chmodSync(tmpName, 420);
16964
- fs16.renameSync(tmpName, target);
17048
+ fs17.chmodSync(tmpName, 420);
17049
+ fs17.renameSync(tmpName, target);
16965
17050
  } catch (err) {
16966
17051
  if (fd !== null) {
16967
17052
  try {
16968
- fs16.closeSync(fd);
17053
+ fs17.closeSync(fd);
16969
17054
  } catch {
16970
17055
  }
16971
17056
  }
16972
17057
  try {
16973
- fs16.unlinkSync(tmpName);
17058
+ fs17.unlinkSync(tmpName);
16974
17059
  } catch {
16975
17060
  }
16976
17061
  throw err;
@@ -17070,7 +17155,7 @@ function jsonDumpsCompact(value) {
17070
17155
  }
17071
17156
  return _jsonStrNoAscii(String(value));
17072
17157
  }
17073
- function yamlSafeLoad(text) {
17158
+ function yamlSafeLoad2(text) {
17074
17159
  let YAML3;
17075
17160
  try {
17076
17161
  YAML3 = require_dist();
@@ -17094,12 +17179,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
17094
17179
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
17095
17180
  var SETTINGS_SUBDIR = ["agents", "settings"];
17096
17181
  function _canonical_settings_target(project_root) {
17097
- return path14.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17182
+ return path15.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
17098
17183
  }
17099
17184
  function _resolve_settings_read(project_root) {
17100
17185
  const canonical = _canonical_settings_target(project_root);
17101
17186
  if (pathExists(canonical)) return canonical;
17102
- const legacy = path14.join(project_root, SETTINGS_FILE);
17187
+ const legacy = path15.join(project_root, SETTINGS_FILE);
17103
17188
  if (pathExists(legacy)) return legacy;
17104
17189
  return canonical;
17105
17190
  }
@@ -17163,9 +17248,9 @@ function fail(msg) {
17163
17248
  throw new SystemExitError(1);
17164
17249
  }
17165
17250
  function detect_package_root(project_root) {
17166
- const npm_path = path14.join(project_root, "node_modules", "@event4u", "agent-config");
17251
+ const npm_path = path15.join(project_root, "node_modules", "@event4u", "agent-config");
17167
17252
  if (isDir(npm_path)) return resolvePath(npm_path);
17168
- if (pathExists(path14.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17253
+ if (pathExists(path15.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
17169
17254
  return project_root;
17170
17255
  }
17171
17256
  fail(
@@ -17173,12 +17258,12 @@ function detect_package_root(project_root) {
17173
17258
  );
17174
17259
  }
17175
17260
  function detect_package_type(package_root) {
17176
- if (package_root.split(path14.sep).includes("node_modules")) return "npm";
17261
+ if (package_root.split(path15.sep).includes("node_modules")) return "npm";
17177
17262
  return "local";
17178
17263
  }
17179
17264
  function detect_package_type_for_project(project_root, package_root) {
17180
17265
  const npm_path = resolvePath(
17181
- path14.join(project_root, "node_modules", "@event4u", "agent-config")
17266
+ path15.join(project_root, "node_modules", "@event4u", "agent-config")
17182
17267
  );
17183
17268
  const package_resolved = resolvePath(package_root);
17184
17269
  if (package_resolved === npm_path) return "npm";
@@ -17198,7 +17283,7 @@ function ensure_directory(p) {
17198
17283
  mkdirp(p);
17199
17284
  }
17200
17285
  function write_file(p, content) {
17201
- ensure_directory(path14.dirname(p));
17286
+ ensure_directory(path15.dirname(p));
17202
17287
  writeText(p, content);
17203
17288
  }
17204
17289
  function read_json_file(p) {
@@ -17369,7 +17454,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
17369
17454
  return rendered + "\n" + suffix;
17370
17455
  }
17371
17456
  function _migrate_legacy_if_present(project_root, template_body) {
17372
- const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
17457
+ const legacy_target = path15.join(project_root, LEGACY_SETTINGS_FILE);
17373
17458
  if (!isFile(legacy_target)) return null;
17374
17459
  const legacy_text = readText(legacy_target);
17375
17460
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -17384,9 +17469,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
17384
17469
  }
17385
17470
  }
17386
17471
  rendered = _append_unknown_legacy(rendered, values, unknown);
17387
- const backup_target = path14.join(project_root, LEGACY_BACKUP_FILE);
17472
+ const backup_target = path15.join(project_root, LEGACY_BACKUP_FILE);
17388
17473
  writeText(backup_target, legacy_text);
17389
- fs16.unlinkSync(legacy_target);
17474
+ fs17.unlinkSync(legacy_target);
17390
17475
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
17391
17476
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
17392
17477
  if (unknown.length > 0) {
@@ -17421,7 +17506,7 @@ function _render_template(template, profile_values) {
17421
17506
  return body;
17422
17507
  }
17423
17508
  function _load_valid_user_types(package_root) {
17424
- const directory = path14.join(package_root, USER_TYPES_DIR);
17509
+ const directory = path15.join(package_root, USER_TYPES_DIR);
17425
17510
  if (!isDir(directory)) return [];
17426
17511
  return sortedGlobStems(directory, ".yml");
17427
17512
  }
@@ -17478,8 +17563,8 @@ function splitlinesKeepends(text) {
17478
17563
  }
17479
17564
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
17480
17565
  const target = _canonical_settings_target(project_root);
17481
- const profile_source = path14.join(package_root, "src", "config", "profiles", `${profile}.ini`);
17482
- const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
17566
+ const profile_source = path15.join(package_root, "src", "config", "profiles", `${profile}.ini`);
17567
+ const template_source = path15.join(package_root, "src", "config", "agent-settings.template.yml");
17483
17568
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
17484
17569
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
17485
17570
  const template = readText(template_source);
@@ -17493,21 +17578,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17493
17578
  if (profile_values["rule_loading_tier"] !== profile) {
17494
17579
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
17495
17580
  fail(
17496
- `Profile preset ${path14.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
17581
+ `Profile preset ${path15.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
17497
17582
  );
17498
17583
  }
17499
17584
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
17500
17585
  let template_body = _render_template(template, profile_values);
17501
17586
  template_body = _inject_packs(template_body, packs ?? []);
17502
- const legacy_root = path14.join(project_root, SETTINGS_FILE);
17587
+ const legacy_root = path15.join(project_root, SETTINGS_FILE);
17503
17588
  if (isFile(legacy_root) && !pathExists(target)) {
17504
- mkdirp(path14.dirname(target));
17589
+ mkdirp(path15.dirname(target));
17505
17590
  writeText(target, readText(legacy_root));
17506
- fs16.unlinkSync(legacy_root);
17591
+ fs17.unlinkSync(legacy_root);
17507
17592
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
17508
17593
  return;
17509
17594
  }
17510
- const legacy_target = path14.join(project_root, LEGACY_SETTINGS_FILE);
17595
+ const legacy_target = path15.join(project_root, LEGACY_SETTINGS_FILE);
17511
17596
  if (isFile(legacy_target) && pathExists(target)) {
17512
17597
  warn(
17513
17598
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -17524,7 +17609,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
17524
17609
  skip(`${SETTINGS_FILE} already exists`);
17525
17610
  return;
17526
17611
  }
17527
- mkdirp(path14.dirname(target));
17612
+ mkdirp(path15.dirname(target));
17528
17613
  write_file(target, template_body);
17529
17614
  const user_type_value = profile_values["user_type"] ?? "";
17530
17615
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -17537,7 +17622,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17537
17622
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
17538
17623
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
17539
17624
  merge_json_file(
17540
- path14.join(project_root, ".vscode", "settings.json"),
17625
+ path15.join(project_root, ".vscode", "settings.json"),
17541
17626
  bridge,
17542
17627
  force,
17543
17628
  ".vscode/settings.json"
@@ -17546,14 +17631,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
17546
17631
  function ensure_augment_bridge(project_root, force) {
17547
17632
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
17548
17633
  return merge_json_file(
17549
- path14.join(project_root, ".augment", "settings.json"),
17634
+ path15.join(project_root, ".augment", "settings.json"),
17550
17635
  bridge,
17551
17636
  force,
17552
17637
  ".augment/settings.json"
17553
17638
  );
17554
17639
  }
17555
- var AUGMENT_USER_DIR = path14.join(os7.homedir(), ".augment");
17556
- var AUGMENT_USER_HOOKS_DIR = path14.join(AUGMENT_USER_DIR, "hooks");
17640
+ var AUGMENT_USER_DIR = path15.join(os7.homedir(), ".augment");
17641
+ var AUGMENT_USER_HOOKS_DIR = path15.join(AUGMENT_USER_DIR, "hooks");
17557
17642
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
17558
17643
  var AUGMENT_LEGACY_TRAMPOLINES = [
17559
17644
  "augment-chat-history.sh",
@@ -17569,29 +17654,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
17569
17654
  ["post_tool_use", "PostToolUse"]
17570
17655
  ];
17571
17656
  function _deploy_augment_trampoline(package_root, name, force) {
17572
- const src = path14.join(package_root, "scripts", "hooks", name);
17657
+ const src = path15.join(package_root, "scripts", "hooks", name);
17573
17658
  if (!pathExists(src)) {
17574
17659
  skip(`augment trampoline missing in package: ${src}`);
17575
17660
  return null;
17576
17661
  }
17577
17662
  mkdirp(AUGMENT_USER_HOOKS_DIR);
17578
- const dst = path14.join(AUGMENT_USER_HOOKS_DIR, name);
17663
+ const dst = path15.join(AUGMENT_USER_HOOKS_DIR, name);
17579
17664
  const src_text = readText(src);
17580
17665
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17581
17666
  skip(`~/.augment/hooks/${name} already up to date`);
17582
17667
  } else {
17583
17668
  writeText(dst, src_text);
17584
- fs16.chmodSync(dst, 493);
17669
+ fs17.chmodSync(dst, 493);
17585
17670
  success(`~/.augment/hooks/${name} installed`);
17586
17671
  }
17587
17672
  return dst;
17588
17673
  }
17589
17674
  function _remove_legacy_augment_trampolines() {
17590
17675
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
17591
- const legacy = path14.join(AUGMENT_USER_HOOKS_DIR, name);
17676
+ const legacy = path15.join(AUGMENT_USER_HOOKS_DIR, name);
17592
17677
  try {
17593
17678
  if (isFile(legacy)) {
17594
- fs16.unlinkSync(legacy);
17679
+ fs17.unlinkSync(legacy);
17595
17680
  skip(`removed legacy ~/.augment/hooks/${name}`);
17596
17681
  }
17597
17682
  } catch {
@@ -17610,7 +17695,7 @@ function ensure_augment_user_hooks(package_root, force) {
17610
17695
  }
17611
17696
  const settings_patch = { hooks: per_event };
17612
17697
  return merge_json_file(
17613
- path14.join(AUGMENT_USER_DIR, "settings.json"),
17698
+ path15.join(AUGMENT_USER_DIR, "settings.json"),
17614
17699
  settings_patch,
17615
17700
  force,
17616
17701
  "~/.augment/settings.json"
@@ -17635,7 +17720,7 @@ function _heal_legacy_claude_plugin_ids(p) {
17635
17720
  return removed;
17636
17721
  }
17637
17722
  function ensure_claude_bridge(project_root, force) {
17638
- const target = path14.join(project_root, ".claude", "settings.json");
17723
+ const target = path15.join(project_root, ".claude", "settings.json");
17639
17724
  const healed = _heal_legacy_claude_plugin_ids(target);
17640
17725
  for (const pid of healed) {
17641
17726
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -17660,29 +17745,29 @@ function ensure_cursor_bridge(project_root, force) {
17660
17745
  }
17661
17746
  const bridge = { version: 1, hooks };
17662
17747
  return merge_json_file(
17663
- path14.join(project_root, ".cursor", "hooks.json"),
17748
+ path15.join(project_root, ".cursor", "hooks.json"),
17664
17749
  bridge,
17665
17750
  force,
17666
17751
  ".cursor/hooks.json"
17667
17752
  );
17668
17753
  }
17669
- var CURSOR_USER_DIR = path14.join(os7.homedir(), ".cursor");
17670
- var CURSOR_USER_HOOKS_DIR = path14.join(CURSOR_USER_DIR, "hooks");
17754
+ var CURSOR_USER_DIR = path15.join(os7.homedir(), ".cursor");
17755
+ var CURSOR_USER_HOOKS_DIR = path15.join(CURSOR_USER_DIR, "hooks");
17671
17756
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
17672
17757
  function ensure_cursor_user_hooks(package_root, force) {
17673
- const src = path14.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
17758
+ const src = path15.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
17674
17759
  if (!pathExists(src)) {
17675
17760
  skip(`cursor trampoline missing in package: ${src}`);
17676
17761
  return [];
17677
17762
  }
17678
17763
  mkdirp(CURSOR_USER_HOOKS_DIR);
17679
- const dst = path14.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
17764
+ const dst = path15.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
17680
17765
  const src_text = readText(src);
17681
17766
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17682
17767
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
17683
17768
  } else {
17684
17769
  writeText(dst, src_text);
17685
- fs16.chmodSync(dst, 493);
17770
+ fs17.chmodSync(dst, 493);
17686
17771
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
17687
17772
  }
17688
17773
  const hooks = {};
@@ -17691,7 +17776,7 @@ function ensure_cursor_user_hooks(package_root, force) {
17691
17776
  }
17692
17777
  const settings_patch = { version: 1, hooks };
17693
17778
  return merge_json_file(
17694
- path14.join(CURSOR_USER_DIR, "hooks.json"),
17779
+ path15.join(CURSOR_USER_DIR, "hooks.json"),
17695
17780
  settings_patch,
17696
17781
  force,
17697
17782
  "~/.cursor/hooks.json"
@@ -17734,12 +17819,12 @@ exit 0
17734
17819
  `;
17735
17820
  }
17736
17821
  function ensure_cline_bridge(project_root, force) {
17737
- const hooks_dir = path14.join(project_root, ".clinerules", "hooks");
17822
+ const hooks_dir = path15.join(project_root, ".clinerules", "hooks");
17738
17823
  mkdirp(hooks_dir);
17739
17824
  const workspace_quoted = shlexQuote(resolvePath(project_root));
17740
17825
  let written = 0;
17741
17826
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
17742
- const target = path14.join(hooks_dir, native_event);
17827
+ const target = path15.join(hooks_dir, native_event);
17743
17828
  const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
17744
17829
  if (pathExists(target) && readText(target) === body && !force) {
17745
17830
  continue;
@@ -17749,7 +17834,7 @@ function ensure_cline_bridge(project_root, force) {
17749
17834
  continue;
17750
17835
  }
17751
17836
  writeText(target, body);
17752
- fs16.chmodSync(target, 493);
17837
+ fs17.chmodSync(target, 493);
17753
17838
  written += 1;
17754
17839
  }
17755
17840
  if (written) {
@@ -17758,27 +17843,27 @@ function ensure_cline_bridge(project_root, force) {
17758
17843
  skip(".clinerules/hooks/ already up to date");
17759
17844
  }
17760
17845
  }
17761
- var CLINE_USER_DIR = path14.join(os7.homedir(), "Documents", "Cline", "Hooks");
17846
+ var CLINE_USER_DIR = path15.join(os7.homedir(), "Documents", "Cline", "Hooks");
17762
17847
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
17763
17848
  function ensure_cline_user_hooks(package_root, force) {
17764
- const src = path14.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
17849
+ const src = path15.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
17765
17850
  if (!pathExists(src)) {
17766
17851
  skip(`cline trampoline missing in package: ${src}`);
17767
17852
  return;
17768
17853
  }
17769
17854
  mkdirp(CLINE_USER_DIR);
17770
- const trampoline = path14.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
17855
+ const trampoline = path15.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
17771
17856
  const src_text = readText(src);
17772
17857
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
17773
17858
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
17774
17859
  } else {
17775
17860
  writeText(trampoline, src_text);
17776
- fs16.chmodSync(trampoline, 493);
17861
+ fs17.chmodSync(trampoline, 493);
17777
17862
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
17778
17863
  }
17779
17864
  const trampoline_quoted = shlexQuote(trampoline);
17780
17865
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
17781
- const wrapper = path14.join(CLINE_USER_DIR, native_event);
17866
+ const wrapper = path15.join(CLINE_USER_DIR, native_event);
17782
17867
  const body = `#!/usr/bin/env bash
17783
17868
  # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
17784
17869
  # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
@@ -17788,7 +17873,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
17788
17873
  continue;
17789
17874
  }
17790
17875
  writeText(wrapper, body);
17791
- fs16.chmodSync(wrapper, 493);
17876
+ fs17.chmodSync(wrapper, 493);
17792
17877
  }
17793
17878
  }
17794
17879
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -17809,29 +17894,29 @@ function ensure_windsurf_bridge(project_root, force) {
17809
17894
  }
17810
17895
  const bridge = { hooks };
17811
17896
  return merge_json_file(
17812
- path14.join(project_root, ".windsurf", "hooks.json"),
17897
+ path15.join(project_root, ".windsurf", "hooks.json"),
17813
17898
  bridge,
17814
17899
  force,
17815
17900
  ".windsurf/hooks.json"
17816
17901
  );
17817
17902
  }
17818
- var WINDSURF_USER_DIR = path14.join(os7.homedir(), ".codeium", "windsurf");
17819
- var WINDSURF_USER_HOOKS_DIR = path14.join(WINDSURF_USER_DIR, "hooks");
17903
+ var WINDSURF_USER_DIR = path15.join(os7.homedir(), ".codeium", "windsurf");
17904
+ var WINDSURF_USER_HOOKS_DIR = path15.join(WINDSURF_USER_DIR, "hooks");
17820
17905
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
17821
17906
  function ensure_windsurf_user_hooks(package_root, force) {
17822
- const src = path14.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
17907
+ const src = path15.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
17823
17908
  if (!pathExists(src)) {
17824
17909
  skip(`windsurf trampoline missing in package: ${src}`);
17825
17910
  return [];
17826
17911
  }
17827
17912
  mkdirp(WINDSURF_USER_HOOKS_DIR);
17828
- const dst = path14.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
17913
+ const dst = path15.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
17829
17914
  const src_text = readText(src);
17830
17915
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17831
17916
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
17832
17917
  } else {
17833
17918
  writeText(dst, src_text);
17834
- fs16.chmodSync(dst, 493);
17919
+ fs17.chmodSync(dst, 493);
17835
17920
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
17836
17921
  }
17837
17922
  const hooks = {};
@@ -17843,7 +17928,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
17843
17928
  }
17844
17929
  const settings_patch = { hooks };
17845
17930
  return merge_json_file(
17846
- path14.join(WINDSURF_USER_DIR, "hooks.json"),
17931
+ path15.join(WINDSURF_USER_DIR, "hooks.json"),
17847
17932
  settings_patch,
17848
17933
  force,
17849
17934
  "~/.codeium/windsurf/hooks.json"
@@ -17872,43 +17957,43 @@ function _gemini_hooks_dict(command_factory) {
17872
17957
  function ensure_gemini_bridge(project_root, force) {
17873
17958
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
17874
17959
  return merge_json_file(
17875
- path14.join(project_root, ".gemini", "settings.json"),
17960
+ path15.join(project_root, ".gemini", "settings.json"),
17876
17961
  bridge,
17877
17962
  force,
17878
17963
  ".gemini/settings.json"
17879
17964
  );
17880
17965
  }
17881
- var GEMINI_USER_DIR = path14.join(os7.homedir(), ".gemini");
17882
- var GEMINI_USER_HOOKS_DIR = path14.join(GEMINI_USER_DIR, "hooks");
17966
+ var GEMINI_USER_DIR = path15.join(os7.homedir(), ".gemini");
17967
+ var GEMINI_USER_HOOKS_DIR = path15.join(GEMINI_USER_DIR, "hooks");
17883
17968
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
17884
17969
  function ensure_gemini_user_hooks(package_root, force) {
17885
- const src = path14.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
17970
+ const src = path15.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
17886
17971
  if (!pathExists(src)) {
17887
17972
  skip(`gemini trampoline missing in package: ${src}`);
17888
17973
  return [];
17889
17974
  }
17890
17975
  mkdirp(GEMINI_USER_HOOKS_DIR);
17891
- const dst = path14.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
17976
+ const dst = path15.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
17892
17977
  const src_text = readText(src);
17893
17978
  if (pathExists(dst) && readText(dst) === src_text && !force) {
17894
17979
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
17895
17980
  } else {
17896
17981
  writeText(dst, src_text);
17897
- fs16.chmodSync(dst, 493);
17982
+ fs17.chmodSync(dst, 493);
17898
17983
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
17899
17984
  }
17900
17985
  const settings_patch = {
17901
17986
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
17902
17987
  };
17903
17988
  return merge_json_file(
17904
- path14.join(GEMINI_USER_DIR, "settings.json"),
17989
+ path15.join(GEMINI_USER_DIR, "settings.json"),
17905
17990
  settings_patch,
17906
17991
  force,
17907
17992
  "~/.gemini/settings.json"
17908
17993
  );
17909
17994
  }
17910
17995
  function ensure_copilot_bridge(project_root, force) {
17911
- const target = path14.join(project_root, ".github", "plugin", "marketplace.json");
17996
+ const target = path15.join(project_root, ".github", "plugin", "marketplace.json");
17912
17997
  const bridge = {
17913
17998
  marketplace: {
17914
17999
  name: "event4u-agent-marketplace",
@@ -17951,7 +18036,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
17951
18036
  Run \`./agent-config --help\` for available commands.
17952
18037
  `;
17953
18038
  function ensure_roocode_bridge(project_root, force) {
17954
- const target = path14.join(project_root, ".roo", "rules", "agent-config.md");
18039
+ const target = path15.join(project_root, ".roo", "rules", "agent-config.md");
17955
18040
  if (pathExists(target) && !force) {
17956
18041
  skip(".roo/rules/agent-config.md already exists");
17957
18042
  return;
@@ -17973,7 +18058,7 @@ To wire Claude Desktop to this project's rules, run:
17973
18058
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17974
18059
  `;
17975
18060
  function ensure_claude_desktop_bridge(project_root, force) {
17976
- const target = path14.join(project_root, ".claude-desktop", "agent-config.md");
18061
+ const target = path15.join(project_root, ".claude-desktop", "agent-config.md");
17977
18062
  if (pathExists(target) && !force) {
17978
18063
  skip(".claude-desktop/agent-config.md already exists");
17979
18064
  return;
@@ -17998,7 +18083,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
17998
18083
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
17999
18084
  `;
18000
18085
  function ensure_aider_bridge(project_root, force) {
18001
- const target = path14.join(project_root, ".aider", "agent-config.md");
18086
+ const target = path15.join(project_root, ".aider", "agent-config.md");
18002
18087
  if (pathExists(target) && !force) {
18003
18088
  skip(".aider/agent-config.md already exists");
18004
18089
  return;
@@ -18017,7 +18102,7 @@ developers where the rules and skills live.
18017
18102
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
18018
18103
  `;
18019
18104
  function ensure_codex_bridge(project_root, force) {
18020
- const target = path14.join(project_root, ".codex", "agent-config.md");
18105
+ const target = path15.join(project_root, ".codex", "agent-config.md");
18021
18106
  if (pathExists(target) && !force) {
18022
18107
  skip(".codex/agent-config.md already exists");
18023
18108
  return;
@@ -18035,7 +18120,7 @@ rules per session. The canonical rule and skill source lives under
18035
18120
  orientation).
18036
18121
  `;
18037
18122
  function ensure_continue_bridge(project_root, force) {
18038
- const target = path14.join(project_root, ".continue", "rules", "agent-config.md");
18123
+ const target = path15.join(project_root, ".continue", "rules", "agent-config.md");
18039
18124
  if (pathExists(target) && !force) {
18040
18125
  skip(".continue/rules/agent-config.md already exists");
18041
18126
  return;
@@ -18066,7 +18151,7 @@ orientation).
18066
18151
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
18067
18152
  `;
18068
18153
  function ensure_kilocode_bridge(project_root, force) {
18069
- const target = path14.join(project_root, ".kilocode", "rules", "agent-config.md");
18154
+ const target = path15.join(project_root, ".kilocode", "rules", "agent-config.md");
18070
18155
  if (pathExists(target) && !force) {
18071
18156
  skip(".kilocode/rules/agent-config.md already exists");
18072
18157
  return;
@@ -18093,7 +18178,7 @@ canonical source (or symlink it):
18093
18178
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18094
18179
  `;
18095
18180
  function ensure_zed_bridge(project_root, force) {
18096
- const target = path14.join(project_root, ".zed", "agent-config.md");
18181
+ const target = path15.join(project_root, ".zed", "agent-config.md");
18097
18182
  if (pathExists(target) && !force) {
18098
18183
  skip(".zed/agent-config.md already exists");
18099
18184
  return;
@@ -18114,7 +18199,7 @@ rules into your JetBrains profile.
18114
18199
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
18115
18200
  `;
18116
18201
  function ensure_jetbrains_bridge(project_root, force) {
18117
- const target = path14.join(project_root, ".jetbrains", "agent-config.md");
18202
+ const target = path15.join(project_root, ".jetbrains", "agent-config.md");
18118
18203
  if (pathExists(target) && !force) {
18119
18204
  skip(".jetbrains/agent-config.md already exists");
18120
18205
  return;
@@ -18145,7 +18230,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
18145
18230
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
18146
18231
  `;
18147
18232
  function ensure_kiro_bridge(project_root, force) {
18148
- const target = path14.join(project_root, ".kiro", "steering", "agent-config.md");
18233
+ const target = path15.join(project_root, ".kiro", "steering", "agent-config.md");
18149
18234
  if (pathExists(target) && !force) {
18150
18235
  skip(".kiro/steering/agent-config.md already exists");
18151
18236
  return;
@@ -18171,35 +18256,35 @@ var SMOKE_BRIDGE_PATHS = {
18171
18256
  };
18172
18257
  function dirHasEntries(p) {
18173
18258
  try {
18174
- return fs16.readdirSync(p).length > 0;
18259
+ return fs17.readdirSync(p).length > 0;
18175
18260
  } catch {
18176
18261
  return false;
18177
18262
  }
18178
18263
  }
18179
18264
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
18180
18265
  const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
18181
- let dir = path14.dirname(scriptPath);
18266
+ let dir = path15.dirname(scriptPath);
18182
18267
  for (; ; ) {
18183
- const candidate = path14.join(dir, "node_modules", ".bin", binName);
18268
+ const candidate = path15.join(dir, "node_modules", ".bin", binName);
18184
18269
  if (isFile(candidate)) {
18185
18270
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
18186
18271
  }
18187
- const parent = path14.dirname(dir);
18272
+ const parent = path15.dirname(dir);
18188
18273
  if (parent === dir) break;
18189
18274
  dir = parent;
18190
18275
  }
18191
18276
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
18192
18277
  }
18193
18278
  function _smoke_test_hooks(project_root, package_root) {
18194
- const dispatcher = path14.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18195
- const manifest = path14.join(package_root, "scripts", "hook_manifest.yaml");
18279
+ const dispatcher = path15.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
18280
+ const manifest = path15.join(package_root, "scripts", "hook_manifest.yaml");
18196
18281
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
18197
18282
  const failed = [];
18198
18283
  const skipped = [];
18199
18284
  const passed = [];
18200
18285
  for (const [platform, native] of SMOKE_PROBE_EVENTS) {
18201
18286
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
18202
- const bridge_path = rel_bridge ? path14.join(project_root, rel_bridge) : null;
18287
+ const bridge_path = rel_bridge ? path15.join(project_root, rel_bridge) : null;
18203
18288
  const bridge_present = Boolean(
18204
18289
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
18205
18290
  );
@@ -18399,9 +18484,9 @@ To remove this marker, delete this file.
18399
18484
  `;
18400
18485
  }
18401
18486
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
18402
- var GLOBAL_ROOT = path14.join(os7.homedir(), ".event4u", "agent-config");
18403
- var GLOBAL_USER_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-user.yml");
18404
- var GLOBAL_AGENT_SETTINGS_PATH = path14.join(GLOBAL_ROOT, ".agent-settings.yml");
18487
+ var GLOBAL_ROOT = path15.join(os7.homedir(), ".event4u", "agent-config");
18488
+ var GLOBAL_USER_SETTINGS_PATH = path15.join(GLOBAL_ROOT, ".agent-user.yml");
18489
+ var GLOBAL_AGENT_SETTINGS_PATH = path15.join(GLOBAL_ROOT, ".agent-settings.yml");
18405
18490
  function _bridge_marker(tool_id, scope) {
18406
18491
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
18407
18492
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -18446,11 +18531,11 @@ function _load_yaml_doc(p) {
18446
18531
  } catch {
18447
18532
  return {};
18448
18533
  }
18449
- const data = yamlSafeLoad(text);
18534
+ const data = yamlSafeLoad2(text);
18450
18535
  return _isPlainObject2(data) ? data : {};
18451
18536
  }
18452
18537
  function _load_default_settings(package_root) {
18453
- const template_source = path14.join(package_root, "src", "config", "agent-settings.template.yml");
18538
+ const template_source = path15.join(package_root, "src", "config", "agent-settings.template.yml");
18454
18539
  if (!pathExists(template_source)) return {};
18455
18540
  let text;
18456
18541
  try {
@@ -18459,7 +18544,7 @@ function _load_default_settings(package_root) {
18459
18544
  return {};
18460
18545
  }
18461
18546
  const rendered = text.split(RULE_LOADING_TIER_PLACEHOLDER).join(DEFAULT_PROFILE).split(USER_TYPE_PLACEHOLDER).join("");
18462
- const data = yamlSafeLoad(rendered);
18547
+ const data = yamlSafeLoad2(rendered);
18463
18548
  return _isPlainObject2(data) ? data : {};
18464
18549
  }
18465
18550
  function _resolve_scope(opts, detected, detect_reason, custom_path) {
@@ -18538,9 +18623,9 @@ function detect_scope(cwd) {
18538
18623
  if (pathExists(_resolve_settings_read(cwd))) {
18539
18624
  return ["project", `existing ${SETTINGS_FILE}`];
18540
18625
  }
18541
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path14.join(cwd, m))) ?? null;
18542
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path14.join(cwd, d))) ?? null;
18543
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path14.join(cwd, f))) ?? null;
18626
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path15.join(cwd, m))) ?? null;
18627
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path15.join(cwd, d))) ?? null;
18628
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path15.join(cwd, f))) ?? null;
18544
18629
  if (has_manifest && (has_ai_dir || has_ai_file)) {
18545
18630
  const marker = has_ai_dir || has_ai_file;
18546
18631
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -18561,7 +18646,7 @@ function readLineSyncRaw(promptText) {
18561
18646
  for (; ; ) {
18562
18647
  let n;
18563
18648
  try {
18564
- n = fs16.readSync(0, buf, 0, 1, null);
18649
+ n = fs17.readSync(0, buf, 0, 1, null);
18565
18650
  } catch (err) {
18566
18651
  const code = err.code;
18567
18652
  if (code === "EAGAIN") {
@@ -18636,8 +18721,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
18636
18721
  const marker = _bridge_marker(tool_id, scope);
18637
18722
  if (!marker) continue;
18638
18723
  let marker_path = marker;
18639
- if (!path14.isAbsolute(marker_path)) {
18640
- marker_path = path14.join(project_root, marker_path);
18724
+ if (!path15.isAbsolute(marker_path)) {
18725
+ marker_path = path15.join(project_root, marker_path);
18641
18726
  }
18642
18727
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
18643
18728
  }
@@ -18676,26 +18761,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
18676
18761
  }
18677
18762
  write_manifest(target, version, entries);
18678
18763
  if (!state.QUIET) {
18679
- const rel = isRelativeTo(target, project_root) ? path14.relative(project_root, target) : target;
18764
+ const rel = isRelativeTo(target, project_root) ? path15.relative(project_root, target) : target;
18680
18765
  info(`Manifest updated: ${rel}`);
18681
18766
  }
18682
18767
  return 0;
18683
18768
  }
18684
18769
  function isRelativeTo(child, parent) {
18685
- const rel = path14.relative(parent, child);
18686
- return rel === "" || !rel.startsWith("..") && !path14.isAbsolute(rel);
18770
+ const rel = path15.relative(parent, child);
18771
+ return rel === "" || !rel.startsWith("..") && !path15.isAbsolute(rel);
18687
18772
  }
18688
18773
  function _resolve_package_root_for_global() {
18689
18774
  const here = resolvePath(_HERE2);
18690
- const candidate = path14.dirname(path14.dirname(path14.dirname(here)));
18691
- if (!pathExists(path14.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
18775
+ const candidate = path15.dirname(path15.dirname(path15.dirname(here)));
18776
+ if (!pathExists(path15.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
18692
18777
  fail(
18693
18778
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
18694
18779
  );
18695
18780
  }
18696
18781
  return candidate;
18697
18782
  }
18698
- var CONSUMER_BRIDGE_MARKER_RELPATH = path14.join("agents", ".event4u-bridge.yml");
18783
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path15.join("agents", ".event4u-bridge.yml");
18699
18784
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
18700
18785
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
18701
18786
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -18703,7 +18788,7 @@ function _is_agent_config_source_repo(project_root) {
18703
18788
  if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
18704
18789
  return [false, "consumer-mode-override"];
18705
18790
  }
18706
- const pkg_json = path14.join(project_root, "package.json");
18791
+ const pkg_json = path15.join(project_root, "package.json");
18707
18792
  if (isFile(pkg_json)) {
18708
18793
  let data = {};
18709
18794
  try {
@@ -18715,18 +18800,18 @@ function _is_agent_config_source_repo(project_root) {
18715
18800
  return [true, "package.json:name"];
18716
18801
  }
18717
18802
  }
18718
- if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
18803
+ if (isDir(path15.join(project_root, ".agent-src.uncondensed"))) {
18719
18804
  return [true, ".agent-src.uncondensed/"];
18720
18805
  }
18721
- const packages_dir = path14.join(project_root, "packages");
18806
+ const packages_dir = path15.join(project_root, "packages");
18722
18807
  if (isDir(packages_dir)) {
18723
- for (const child of fs16.readdirSync(packages_dir)) {
18724
- if (isDir(path14.join(packages_dir, child, ".agent-src.uncondensed"))) {
18808
+ for (const child of fs17.readdirSync(packages_dir)) {
18809
+ if (isDir(path15.join(packages_dir, child, ".agent-src.uncondensed"))) {
18725
18810
  return [true, `packages/${child}/.agent-src.uncondensed/`];
18726
18811
  }
18727
18812
  }
18728
18813
  }
18729
- const installer_self = path14.join(project_root, "scripts", "install.py");
18814
+ const installer_self = path15.join(project_root, "scripts", "install.py");
18730
18815
  try {
18731
18816
  if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
18732
18817
  return [true, "src/scripts/install.py (self)"];
@@ -18746,17 +18831,17 @@ function _detect_legacy_for_migration(project_root) {
18746
18831
  }
18747
18832
  return [];
18748
18833
  }
18749
- if (isFile(path14.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
18834
+ if (isFile(path15.join(project_root, INSTALL_MODE_MARKER_REL))) return [];
18750
18835
  const found = [];
18751
18836
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
18752
- if (isFile(path14.join(project_root, name))) {
18837
+ if (isFile(path15.join(project_root, name))) {
18753
18838
  found.push(name);
18754
- } else if (isFile(path14.join(project_root, "settings", name))) {
18839
+ } else if (isFile(path15.join(project_root, "settings", name))) {
18755
18840
  found.push(`settings/${name}`);
18756
18841
  }
18757
18842
  }
18758
18843
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
18759
- const p = path14.join(project_root, name);
18844
+ const p = path15.join(project_root, name);
18760
18845
  if (isDir(p) && !isSymlink(p)) {
18761
18846
  found.push(`${name}/`);
18762
18847
  }
@@ -18768,7 +18853,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
18768
18853
  process3.stdout.write("\n");
18769
18854
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
18770
18855
  for (const rel of artefacts) {
18771
- info(` ${path14.join(project_root, rel)}`);
18856
+ info(` ${path15.join(project_root, rel)}`);
18772
18857
  }
18773
18858
  info("The unified `agent-config migrate` sweeps these in one pass.");
18774
18859
  info("The wizard recreates fresh config afterwards.");
@@ -18799,20 +18884,20 @@ function _run_migrate_to_global(project_root) {
18799
18884
  function _format_global_root_for_marker(global_root) {
18800
18885
  const home = resolvePath(os7.homedir());
18801
18886
  const resolved = resolvePath(global_root);
18802
- const rel = path14.relative(home, resolved);
18803
- if (rel === "" || rel.startsWith("..") || path14.isAbsolute(rel)) {
18887
+ const rel = path15.relative(home, resolved);
18888
+ if (rel === "" || rel.startsWith("..") || path15.isAbsolute(rel)) {
18804
18889
  return global_root;
18805
18890
  }
18806
- return `~/${rel.split(path14.sep).join("/")}`;
18891
+ return `~/${rel.split(path15.sep).join("/")}`;
18807
18892
  }
18808
18893
  function _remove_legacy_consumer_bridge_marker(project_root, env = null) {
18809
18894
  const env_map = env ?? process3.env;
18810
18895
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
18811
- if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return null;
18812
- const target = path14.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
18896
+ if (isDir(path15.join(project_root, ".agent-src.uncondensed"))) return null;
18897
+ const target = path15.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
18813
18898
  if (!isFile(target)) return null;
18814
18899
  try {
18815
- fs16.rmSync(target);
18900
+ fs17.rmSync(target);
18816
18901
  } catch {
18817
18902
  return null;
18818
18903
  }
@@ -18826,7 +18911,7 @@ var PROJECT_ANCHOR_TOOLS = {
18826
18911
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
18827
18912
  const env_map = env ?? process3.env;
18828
18913
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
18829
- if (isDir(path14.join(project_root, ".agent-src.uncondensed"))) return [];
18914
+ if (isDir(path15.join(project_root, ".agent-src.uncondensed"))) return [];
18830
18915
  const global_root_str = _format_global_root_for_marker(
18831
18916
  event4u_root(env_map)
18832
18917
  );
@@ -18835,8 +18920,8 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
18835
18920
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
18836
18921
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
18837
18922
  if (!tools.has(tool_id)) continue;
18838
- const target = path14.join(project_root, rel_path);
18839
- mkdirp(path14.dirname(target));
18923
+ const target = path15.join(project_root, rel_path);
18924
+ mkdirp(path15.dirname(target));
18840
18925
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
18841
18926
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
18842
18927
  # Tool: ${tool_id}. Resolves the global install directly \u2014 no
@@ -18854,7 +18939,7 @@ installed_at: ${stamp}
18854
18939
  }
18855
18940
  var PACKAGE_TAG_ID = "event4u/agent-config";
18856
18941
  function _inject_package_tag(target, source, package_root) {
18857
- if (path14.extname(target) !== ".md") return;
18942
+ if (path15.extname(target) !== ".md") return;
18858
18943
  let text;
18859
18944
  try {
18860
18945
  text = readText(target);
@@ -18882,8 +18967,8 @@ function _inject_package_tag(target, source, package_root) {
18882
18967
  resolved_src = source;
18883
18968
  }
18884
18969
  if (package_root !== null) {
18885
- const rel = path14.relative(resolvePath(package_root), resolved_src);
18886
- if (rel !== "" && !rel.startsWith("..") && !path14.isAbsolute(rel)) {
18970
+ const rel = path15.relative(resolvePath(package_root), resolved_src);
18971
+ if (rel !== "" && !rel.startsWith("..") && !path15.isAbsolute(rel)) {
18887
18972
  source_value = rel;
18888
18973
  } else {
18889
18974
  source_value = resolved_src;
@@ -18918,7 +19003,7 @@ function _escapes_package_root(resolved, package_root) {
18918
19003
  if (package_root === null) return false;
18919
19004
  let root;
18920
19005
  try {
18921
- root = fs16.realpathSync(package_root);
19006
+ root = fs17.realpathSync(package_root);
18922
19007
  } catch {
18923
19008
  return false;
18924
19009
  }
@@ -18933,7 +19018,7 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18933
19018
  if (file_filter !== null && !file_filter(src)) return [0, 0, written_paths];
18934
19019
  let resolved_src = src;
18935
19020
  try {
18936
- resolved_src = fs16.realpathSync(src);
19021
+ resolved_src = fs17.realpathSync(src);
18937
19022
  } catch {
18938
19023
  resolved_src = src;
18939
19024
  }
@@ -18941,10 +19026,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18941
19026
  warn(`refused: ${src} dereferences outside the package root \u2014 not copied`);
18942
19027
  return [0, 0, written_paths];
18943
19028
  }
18944
- mkdirp(path14.dirname(dest));
19029
+ mkdirp(path15.dirname(dest));
18945
19030
  const decision = _resolve_file_conflict(dest, force);
18946
19031
  if (decision === "skip") return [0, 1, written_paths];
18947
- fs16.copyFileSync(src, dest);
19032
+ fs17.copyFileSync(src, dest);
18948
19033
  _inject_package_tag(dest, src, package_root);
18949
19034
  written_paths.push(dest);
18950
19035
  return [1, 0, written_paths];
@@ -18952,11 +19037,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18952
19037
  mkdirp(dest);
18953
19038
  const walk = (node) => {
18954
19039
  const acc = [];
18955
- const names = fs16.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
19040
+ const names = fs17.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
18956
19041
  for (const name of names) {
18957
- const entry = path14.join(node, name);
19042
+ const entry = path15.join(node, name);
18958
19043
  acc.push(entry);
18959
- const lst = fs16.lstatSync(entry);
19044
+ const lst = fs17.lstatSync(entry);
18960
19045
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
18961
19046
  acc.push(...walk(entry));
18962
19047
  }
@@ -18964,9 +19049,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18964
19049
  return acc;
18965
19050
  };
18966
19051
  for (const entry of walk(src)) {
18967
- const rel = path14.relative(src, entry);
18968
- const target = path14.join(dest, rel);
18969
- const lst = fs16.lstatSync(entry);
19052
+ const rel = path15.relative(src, entry);
19053
+ const target = path15.join(dest, rel);
19054
+ const lst = fs17.lstatSync(entry);
18970
19055
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
18971
19056
  mkdirp(target);
18972
19057
  continue;
@@ -18974,8 +19059,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
18974
19059
  let resolvedIsDir = false;
18975
19060
  let resolved = entry;
18976
19061
  try {
18977
- resolved = fs16.realpathSync(entry);
18978
- resolvedIsDir = fs16.statSync(entry).isDirectory();
19062
+ resolved = fs17.realpathSync(entry);
19063
+ resolvedIsDir = fs17.statSync(entry).isDirectory();
18979
19064
  } catch {
18980
19065
  resolvedIsDir = false;
18981
19066
  }
@@ -19005,8 +19090,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null,
19005
19090
  skipped += 1;
19006
19091
  continue;
19007
19092
  }
19008
- mkdirp(path14.dirname(target));
19009
- fs16.copyFileSync(resolved, target);
19093
+ mkdirp(path15.dirname(target));
19094
+ fs17.copyFileSync(resolved, target);
19010
19095
  _inject_package_tag(target, resolved, package_root);
19011
19096
  written += 1;
19012
19097
  written_paths.push(target);
@@ -19018,7 +19103,7 @@ function _claude_desktop_bundles_dir() {
19018
19103
  }
19019
19104
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
19020
19105
  const anchor = expanduser6(USER_SCOPE_PATHS["claude-desktop"]);
19021
- const target = path14.join(anchor, "agent-config.md");
19106
+ const target = path15.join(anchor, "agent-config.md");
19022
19107
  mkdirp(anchor);
19023
19108
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
19024
19109
  writeText(target, body);
@@ -19042,23 +19127,23 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19042
19127
  const wrapped = [];
19043
19128
  const collisions = [];
19044
19129
  const reserved = [];
19045
- const commands_dir = path14.join(anchor, "commands");
19130
+ const commands_dir = path15.join(anchor, "commands");
19046
19131
  let flat_entries = [];
19047
19132
  try {
19048
- flat_entries = fs16.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19133
+ flat_entries = fs17.readdirSync(commands_dir).filter((f) => f.endsWith(".md"));
19049
19134
  } catch {
19050
19135
  }
19051
19136
  for (const fname of flat_entries.sort()) {
19052
19137
  const slug = fname.slice(0, -".md".length);
19053
19138
  if (!is_claude_builtin_name(slug)) continue;
19054
- fs16.rmSync(path14.join(commands_dir, fname), { force: true });
19139
+ fs17.rmSync(path15.join(commands_dir, fname), { force: true });
19055
19140
  current_files.delete(`commands/${fname}`);
19056
19141
  reserved.push(slug);
19057
19142
  }
19058
19143
  const eligible = new Set(_CLAUDE_FLAT_WRAPPER_EXTRA);
19059
19144
  try {
19060
19145
  const manifest = JSON.parse(
19061
- fs16.readFileSync(path14.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19146
+ fs17.readFileSync(path15.join(package_root, "dist", "discovery", "discovery-manifest.json"), "utf8")
19062
19147
  );
19063
19148
  for (const a of manifest.artefacts ?? []) {
19064
19149
  if (a.category !== "command" || typeof a.slug !== "string") continue;
@@ -19069,22 +19154,22 @@ function _apply_claude_flat_command_wrappers(anchor, package_root, current_files
19069
19154
  }
19070
19155
  for (const slug of [...eligible].sort()) {
19071
19156
  const flat_rel = `commands/${slug}.md`;
19072
- const flat_abs = path14.join(anchor, "commands", `${slug}.md`);
19073
- if (!fs16.existsSync(flat_abs)) continue;
19074
- const skill_dir = path14.join(anchor, "skills", slug);
19075
- if (fs16.existsSync(skill_dir)) {
19157
+ const flat_abs = path15.join(anchor, "commands", `${slug}.md`);
19158
+ if (!fs17.existsSync(flat_abs)) continue;
19159
+ const skill_dir = path15.join(anchor, "skills", slug);
19160
+ if (fs17.existsSync(skill_dir)) {
19076
19161
  collisions.push(slug);
19077
19162
  continue;
19078
19163
  }
19079
- let body = fs16.readFileSync(flat_abs, "utf8");
19164
+ let body = fs17.readFileSync(flat_abs, "utf8");
19080
19165
  if (body.startsWith("---\n") && !/^name:/m.test(body.split("\n---")[0] ?? "")) {
19081
19166
  body = body.replace("---\n", `---
19082
19167
  name: ${slug}
19083
19168
  `);
19084
19169
  }
19085
- fs16.mkdirSync(skill_dir, { recursive: true });
19086
- fs16.writeFileSync(path14.join(skill_dir, "SKILL.md"), body, "utf8");
19087
- fs16.rmSync(flat_abs, { force: true });
19170
+ fs17.mkdirSync(skill_dir, { recursive: true });
19171
+ fs17.writeFileSync(path15.join(skill_dir, "SKILL.md"), body, "utf8");
19172
+ fs17.rmSync(flat_abs, { force: true });
19088
19173
  current_files.delete(flat_rel);
19089
19174
  current_files.add(`skills/${slug}/SKILL.md`);
19090
19175
  wrapped.push(slug);
@@ -19116,8 +19201,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19116
19201
  const written_paths = [];
19117
19202
  let current_files = /* @__PURE__ */ new Set();
19118
19203
  for (const [src_rel, dest_sub] of plan) {
19119
- const src = path14.join(package_root, src_rel);
19120
- const dest = dest_sub ? path14.join(anchor, dest_sub) : anchor;
19204
+ const src = path15.join(package_root, src_rel);
19205
+ const dest = dest_sub ? path15.join(anchor, dest_sub) : anchor;
19121
19206
  const rule_filter = _rule_filter_for_source(src_rel, rule_scope);
19122
19207
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(
19123
19208
  src,
@@ -19191,10 +19276,10 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
19191
19276
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
19192
19277
  if (tool_id === "claude-code") {
19193
19278
  try {
19194
- const manifest = path14.join(package_root, "src", "scripts", "hook_manifest.yaml");
19279
+ const manifest = path15.join(package_root, "src", "scripts", "hook_manifest.yaml");
19195
19280
  const matrix = build_claude_hook_matrix(manifest);
19196
19281
  const res = ensure_managed_hooks(
19197
- path14.join(anchor, "settings.json"),
19282
+ path15.join(anchor, "settings.json"),
19198
19283
  matrix
19199
19284
  );
19200
19285
  if (!state.QUIET) {
@@ -19231,7 +19316,7 @@ function _preview_global_reap(tools, package_root) {
19231
19316
  const anchor = expanduser6(anchor_raw);
19232
19317
  let current_files = /* @__PURE__ */ new Set();
19233
19318
  for (const [src_rel, dest_sub] of plan) {
19234
- const src = path14.join(package_root, src_rel);
19319
+ const src = path15.join(package_root, src_rel);
19235
19320
  current_files = setUnion(
19236
19321
  current_files,
19237
19322
  expected_deploy_files(
@@ -19265,14 +19350,14 @@ function _preview_global_reap(tools, package_root) {
19265
19350
  function _verify_deploy_targets(anchor, plan) {
19266
19351
  const missing = [];
19267
19352
  for (const [, dest_sub] of plan) {
19268
- const target = dest_sub ? path14.join(anchor, dest_sub) : anchor;
19353
+ const target = dest_sub ? path15.join(anchor, dest_sub) : anchor;
19269
19354
  const label = dest_sub || ".";
19270
19355
  if (!isDir(target)) {
19271
19356
  missing.push(label);
19272
19357
  continue;
19273
19358
  }
19274
19359
  try {
19275
- const entries = fs16.readdirSync(target);
19360
+ const entries = fs17.readdirSync(target);
19276
19361
  if (entries.length === 0) missing.push(label);
19277
19362
  } catch {
19278
19363
  missing.push(label);
@@ -19287,13 +19372,13 @@ function _prune_modules_by(deploy_results, is_pruned) {
19287
19372
  const [written, skipped, status, paths] = deploy_results[tool_id];
19288
19373
  const pruned_skill_dirs = /* @__PURE__ */ new Set();
19289
19374
  for (const p of paths) {
19290
- const parts = p.split(path14.sep);
19375
+ const parts = p.split(path15.sep);
19291
19376
  if (parts.includes("skills")) {
19292
19377
  const i = parts.indexOf("skills");
19293
19378
  if (i + 1 < parts.length) {
19294
- const skill_root = parts.slice(0, i + 2).join(path14.sep);
19379
+ const skill_root = parts.slice(0, i + 2).join(path15.sep);
19295
19380
  if (!pruned_skill_dirs.has(skill_root)) {
19296
- const skillmd = path14.join(skill_root, "SKILL.md");
19381
+ const skillmd = path15.join(skill_root, "SKILL.md");
19297
19382
  if (pathExists(skillmd) && is_pruned(skillmd)) {
19298
19383
  pruned_skill_dirs.add(skill_root);
19299
19384
  }
@@ -19304,25 +19389,25 @@ function _prune_modules_by(deploy_results, is_pruned) {
19304
19389
  const keep = [];
19305
19390
  const delete_files = [];
19306
19391
  for (const p of paths) {
19307
- const parts = p.split(path14.sep);
19392
+ const parts = p.split(path15.sep);
19308
19393
  let is_target = false;
19309
19394
  if (parts.includes("skills")) {
19310
19395
  const i = parts.indexOf("skills");
19311
- if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path14.sep))) {
19396
+ if (i + 1 < parts.length && pruned_skill_dirs.has(parts.slice(0, i + 2).join(path15.sep))) {
19312
19397
  is_target = true;
19313
19398
  }
19314
- } else if (parts.includes("commands") && path14.extname(p) === ".md" && is_pruned(p)) {
19399
+ } else if (parts.includes("commands") && path15.extname(p) === ".md" && is_pruned(p)) {
19315
19400
  is_target = true;
19316
19401
  }
19317
19402
  (is_target ? delete_files : keep).push(p);
19318
19403
  }
19319
19404
  for (const d of pruned_skill_dirs) {
19320
- fs16.rmSync(d, { recursive: true, force: true });
19405
+ fs17.rmSync(d, { recursive: true, force: true });
19321
19406
  }
19322
19407
  for (const p of delete_files) {
19323
- if (p.split(path14.sep).includes("commands") && pathExists(p)) {
19408
+ if (p.split(path15.sep).includes("commands") && pathExists(p)) {
19324
19409
  try {
19325
- fs16.unlinkSync(p);
19410
+ fs17.unlinkSync(p);
19326
19411
  } catch {
19327
19412
  }
19328
19413
  }
@@ -19335,64 +19420,17 @@ function _prune_modules_by(deploy_results, is_pruned) {
19335
19420
  function _prune_lab_modules(deploy_results, lab_ids) {
19336
19421
  return _prune_modules_by(deploy_results, (p) => is_lab_artefact(p, lab_ids));
19337
19422
  }
19338
- var SCOPED_ACTIVE_WORKSPACES = /* @__PURE__ */ new Set(["engineering", "agent-config-maintainer"]);
19339
- function _load_packs_registry(package_root) {
19340
- const vocab_path = path14.join(package_root, "src", "config", "discovery", "packs.yml");
19341
- const data = yamlSafeLoad(readText(vocab_path));
19342
- if (!Array.isArray(data)) {
19343
- throw new Error(`packs.yml did not parse to a list: ${vocab_path}`);
19344
- }
19345
- const out = [];
19346
- for (const entry of data) {
19347
- if (!_isPlainObject2(entry)) continue;
19348
- const id = entry["id"];
19349
- if (typeof id !== "string" || id === "") continue;
19350
- const workspaces_raw = entry["workspaces"];
19351
- const workspaces = Array.isArray(workspaces_raw) ? workspaces_raw.filter((w) => typeof w === "string") : [];
19352
- const requires_raw = entry["requires"] ?? entry["requires_hint"];
19353
- const requires = Array.isArray(requires_raw) ? requires_raw.filter((r) => typeof r === "string") : [];
19354
- out.push({ id, workspaces, requires });
19355
- }
19356
- return out;
19357
- }
19358
- function _compute_active_pack_ids(packs, runtime_active_packs) {
19359
- const by_id = /* @__PURE__ */ new Map();
19360
- for (const p of packs) by_id.set(p.id, p);
19361
- const active = /* @__PURE__ */ new Set();
19362
- for (const p of packs) {
19363
- if (p.workspaces.some((w) => SCOPED_ACTIVE_WORKSPACES.has(w))) {
19364
- active.add(p.id);
19365
- }
19366
- }
19367
- for (const id of runtime_active_packs) {
19368
- active.add(id);
19369
- }
19370
- let frontier = [...active];
19371
- while (frontier.length > 0) {
19372
- const next = [];
19373
- for (const id of frontier) {
19374
- const rec = by_id.get(id);
19375
- if (rec === void 0) continue;
19376
- for (const dep of rec.requires) {
19377
- if (!active.has(dep)) {
19378
- active.add(dep);
19379
- next.push(dep);
19380
- }
19381
- }
19382
- }
19383
- frontier = next;
19384
- }
19385
- return active;
19386
- }
19423
+ var _load_packs_registry = load_packs_registry;
19424
+ var _compute_active_pack_ids = compute_active_pack_ids;
19387
19425
  function _resolve_global_settings_doc() {
19388
19426
  const p = _resolve_global_settings_path();
19389
19427
  return p === null ? null : _load_yaml_doc(p);
19390
19428
  }
19391
19429
  function _resolve_global_settings_path() {
19392
19430
  const root = event4u_root();
19393
- const canonical = path14.join(root, "settings", SETTINGS_FILE);
19431
+ const canonical = path15.join(root, "settings", SETTINGS_FILE);
19394
19432
  if (pathExists(canonical)) return canonical;
19395
- const legacy = path14.join(root, SETTINGS_FILE);
19433
+ const legacy = path15.join(root, SETTINGS_FILE);
19396
19434
  if (pathExists(legacy)) return legacy;
19397
19435
  return null;
19398
19436
  }
@@ -19423,7 +19461,7 @@ function _resolve_global_rule_scope(package_root) {
19423
19461
  );
19424
19462
  return LEGACY_ALL;
19425
19463
  }
19426
- const parsed = yamlSafeLoad(text);
19464
+ const parsed = yamlSafeLoad2(text);
19427
19465
  if (!_isPlainObject2(parsed)) {
19428
19466
  warn(
19429
19467
  `${settings_path} is not a YAML mapping \u2014 rule scoping falls back to legacy-all, so ALL rules including maintainer-only ones will be installed. Fix the file to restore scoping.`
@@ -19444,14 +19482,10 @@ function _rule_filter_for_source(src_rel, scope) {
19444
19482
  return (srcFile) => ruleFileArrives(srcFile, scope);
19445
19483
  }
19446
19484
  function _prune_scoped_modules(deploy_results, active_ids) {
19447
- return _prune_modules_by(deploy_results, (p) => {
19448
- const packs = frontmatter_packs(p);
19449
- if (packs.size === 0) return false;
19450
- for (const id of packs) {
19451
- if (active_ids.has(id)) return false;
19452
- }
19453
- return true;
19454
- });
19485
+ return _prune_modules_by(
19486
+ deploy_results,
19487
+ (p) => is_pruned_under_scoped(p, active_ids)
19488
+ );
19455
19489
  }
19456
19490
  function install_global(tools, force, project_root = null, core_only = false) {
19457
19491
  const migrated = migrate_legacy_namespace();
@@ -19507,7 +19541,7 @@ function install_global(tools, force, project_root = null, core_only = false) {
19507
19541
  info(` schema_version=1, agent_config_version=${installed_version}`);
19508
19542
  info(` tools=${merged_tools.join(",")}`);
19509
19543
  }
19510
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
19544
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path15.join(project_root, ".agent-src.uncondensed"))) {
19511
19545
  const drift = collect_drift(project_root);
19512
19546
  if (!state.QUIET) {
19513
19547
  process3.stdout.write("\n");
@@ -19607,19 +19641,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
19607
19641
  }
19608
19642
  }
19609
19643
  }
19610
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path14.join(project_root, ".agent-src.uncondensed"))) {
19644
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path15.join(project_root, ".agent-src.uncondensed"))) {
19611
19645
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
19612
19646
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
19613
19647
  if (rc !== 0) return rc;
19614
19648
  const removed_marker = _remove_legacy_consumer_bridge_marker(project_root);
19615
19649
  if (removed_marker !== null && !state.QUIET) {
19616
- const rel = isRelativeTo(removed_marker, project_root) ? path14.relative(project_root, removed_marker) : removed_marker;
19650
+ const rel = isRelativeTo(removed_marker, project_root) ? path15.relative(project_root, removed_marker) : removed_marker;
19617
19651
  info(`Removed legacy bridge marker: ${rel}`);
19618
19652
  }
19619
19653
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
19620
19654
  if (anchor_paths.length > 0 && !state.QUIET) {
19621
19655
  for (const p of anchor_paths) {
19622
- const rel = isRelativeTo(p, project_root) ? path14.relative(project_root, p) : p;
19656
+ const rel = isRelativeTo(p, project_root) ? path15.relative(project_root, p) : p;
19623
19657
  info(`Project anchor written: ${rel}`);
19624
19658
  }
19625
19659
  }
@@ -19636,8 +19670,8 @@ function install_global(tools, force, project_root = null, core_only = false) {
19636
19670
  }
19637
19671
  return 0;
19638
19672
  }
19639
- var SETTINGS_SURFACE_REL = path14.join("state", "settings-surface.json");
19640
- var SETTINGS_DELTA_REL = path14.join("state", "settings-delta.json");
19673
+ var SETTINGS_SURFACE_REL = path15.join("state", "settings-surface.json");
19674
+ var SETTINGS_DELTA_REL = path15.join("state", "settings-delta.json");
19641
19675
  function _current_settings_surface(version) {
19642
19676
  const jsonSchema = zodToJsonSchema(settingsSchema, {
19643
19677
  name: "AgentSettings",
@@ -19648,20 +19682,20 @@ function _current_settings_surface(version) {
19648
19682
  }
19649
19683
  function _write_settings_surface_snapshot(installed_version) {
19650
19684
  const root = event4u_root();
19651
- const surface_path = path14.join(root, SETTINGS_SURFACE_REL);
19652
- const delta_path = path14.join(root, SETTINGS_DELTA_REL);
19685
+ const surface_path = path15.join(root, SETTINGS_SURFACE_REL);
19686
+ const delta_path = path15.join(root, SETTINGS_DELTA_REL);
19653
19687
  const next = _current_settings_surface(installed_version);
19654
19688
  let previous = null;
19655
19689
  try {
19656
- const parsed = JSON.parse(fs16.readFileSync(surface_path, "utf8"));
19690
+ const parsed = JSON.parse(fs17.readFileSync(surface_path, "utf8"));
19657
19691
  if (parsed !== null && typeof parsed === "object" && parsed.entries !== void 0) previous = parsed;
19658
19692
  } catch {
19659
19693
  }
19660
19694
  if (previous !== null && previous.version !== next.version) {
19661
19695
  const delta = computeSurfaceDelta(previous, next);
19662
19696
  if (delta.changes.length > 0) {
19663
- fs16.mkdirSync(path14.dirname(delta_path), { recursive: true, mode: 448 });
19664
- fs16.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
19697
+ fs17.mkdirSync(path15.dirname(delta_path), { recursive: true, mode: 448 });
19698
+ fs17.writeFileSync(delta_path, `${JSON.stringify(delta, null, 2)}
19665
19699
  `, { mode: 384 });
19666
19700
  if (!state.QUIET) {
19667
19701
  const counts = {};
@@ -19673,8 +19707,8 @@ function _write_settings_surface_snapshot(installed_version) {
19673
19707
  }
19674
19708
  }
19675
19709
  }
19676
- fs16.mkdirSync(path14.dirname(surface_path), { recursive: true, mode: 448 });
19677
- fs16.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
19710
+ fs17.mkdirSync(path15.dirname(surface_path), { recursive: true, mode: 448 });
19711
+ fs17.writeFileSync(surface_path, `${JSON.stringify(next, null, 2)}
19678
19712
  `, { mode: 384 });
19679
19713
  }
19680
19714
  function arrayStrEqual(a, b) {
@@ -19886,13 +19920,13 @@ function _minimal_templates_root() {
19886
19920
  const chain = [start];
19887
19921
  let cur = start;
19888
19922
  for (; ; ) {
19889
- const parent = path14.dirname(cur);
19923
+ const parent = path15.dirname(cur);
19890
19924
  if (parent === cur) break;
19891
19925
  chain.push(parent);
19892
19926
  cur = parent;
19893
19927
  }
19894
19928
  for (const ancestor of chain) {
19895
- const candidate = path14.join(ancestor, "src", "templates", "minimal");
19929
+ const candidate = path15.join(ancestor, "src", "templates", "minimal");
19896
19930
  if (isDir(candidate)) return candidate;
19897
19931
  }
19898
19932
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -19900,9 +19934,9 @@ function _minimal_templates_root() {
19900
19934
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
19901
19935
  function _write_install_mode_marker(project_root, mode) {
19902
19936
  if (mode !== "minimal" && mode !== "full") return;
19903
- const marker = path14.join(project_root, INSTALL_MODE_MARKER_REL);
19937
+ const marker = path15.join(project_root, INSTALL_MODE_MARKER_REL);
19904
19938
  try {
19905
- mkdirp(path14.dirname(marker));
19939
+ mkdirp(path15.dirname(marker));
19906
19940
  writeText(marker, `${mode}
19907
19941
  `);
19908
19942
  } catch {
@@ -19911,7 +19945,7 @@ function _write_install_mode_marker(project_root, mode) {
19911
19945
  function install_minimal(target_root_in, force, user_type = "") {
19912
19946
  let target_root = resolvePath(target_root_in);
19913
19947
  mkdirp(target_root);
19914
- const parent = path14.dirname(target_root);
19948
+ const parent = path15.dirname(target_root);
19915
19949
  if (parent !== target_root) {
19916
19950
  const existing = find_project_root_with_anchor(parent);
19917
19951
  if (existing !== null && existing[0] !== target_root) {
@@ -19922,21 +19956,21 @@ function install_minimal(target_root_in, force, user_type = "") {
19922
19956
  }
19923
19957
  }
19924
19958
  const templates = _minimal_templates_root();
19925
- const settings_src = path14.join(templates, SETTINGS_FILE);
19926
- const overrides_gitkeep_src = path14.join(templates, "overrides-gitkeep");
19927
- const overrides_readme_src = path14.join(templates, "agents-overrides-readme.md");
19959
+ const settings_src = path15.join(templates, SETTINGS_FILE);
19960
+ const overrides_gitkeep_src = path15.join(templates, "overrides-gitkeep");
19961
+ const overrides_readme_src = path15.join(templates, "agents-overrides-readme.md");
19928
19962
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
19929
19963
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
19930
19964
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
19931
19965
  }
19932
19966
  info(`Minimal init \u2192 ${target_root}`);
19933
- const overrides_root = path14.join(target_root, "agents", "overrides");
19967
+ const overrides_root = path15.join(target_root, "agents", "overrides");
19934
19968
  mkdirp(overrides_root);
19935
19969
  const gitkeep_body = readText(overrides_gitkeep_src);
19936
19970
  for (const sub of ["rules", "skills", "commands"]) {
19937
- const sub_dir = path14.join(overrides_root, sub);
19971
+ const sub_dir = path15.join(overrides_root, sub);
19938
19972
  mkdirp(sub_dir);
19939
- const gitkeep_dst = path14.join(sub_dir, ".gitkeep");
19973
+ const gitkeep_dst = path15.join(sub_dir, ".gitkeep");
19940
19974
  if (pathExists(gitkeep_dst) && !force) {
19941
19975
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
19942
19976
  } else {
@@ -19944,7 +19978,7 @@ function install_minimal(target_root_in, force, user_type = "") {
19944
19978
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
19945
19979
  }
19946
19980
  }
19947
- const readme_dst = path14.join(overrides_root, "README.md");
19981
+ const readme_dst = path15.join(overrides_root, "README.md");
19948
19982
  if (pathExists(readme_dst) && !force) {
19949
19983
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
19950
19984
  } else {
@@ -19962,14 +19996,14 @@ function install_minimal(target_root_in, force, user_type = "") {
19962
19996
  personal:
19963
19997
  user_type: ${user_type}
19964
19998
  `;
19965
- mkdirp(path14.dirname(settings_dst));
19999
+ mkdirp(path15.dirname(settings_dst));
19966
20000
  writeText(settings_dst, body);
19967
20001
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
19968
20002
  }
19969
20003
  }
19970
20004
  const removed_marker = _remove_legacy_consumer_bridge_marker(target_root);
19971
20005
  if (removed_marker !== null) {
19972
- const rel = isRelativeTo(removed_marker, target_root) ? path14.relative(target_root, removed_marker) : removed_marker;
20006
+ const rel = isRelativeTo(removed_marker, target_root) ? path15.relative(target_root, removed_marker) : removed_marker;
19973
20007
  success(`Removed legacy bridge marker: ${rel}`);
19974
20008
  }
19975
20009
  _write_install_mode_marker(target_root, "minimal");
@@ -20043,7 +20077,7 @@ function run_interactive_init(project_root, force) {
20043
20077
  );
20044
20078
  return 0;
20045
20079
  }
20046
- const target = path14.join(project_root, _LOCAL_CONFIG_FILE);
20080
+ const target = path15.join(project_root, _LOCAL_CONFIG_FILE);
20047
20081
  if (pathExists(target) && !force) {
20048
20082
  warn(
20049
20083
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -20070,7 +20104,7 @@ function run_interactive_init(project_root, force) {
20070
20104
  warn(`Could not write ${target}: ${String(exc)}`);
20071
20105
  return 1;
20072
20106
  }
20073
- success(`Wrote ${path14.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20107
+ success(`Wrote ${path15.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
20074
20108
  return 0;
20075
20109
  }
20076
20110
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -20088,12 +20122,12 @@ function _wizard_should_launch(opts) {
20088
20122
  return [true, ""];
20089
20123
  }
20090
20124
  function _wizard_cli_dist(_project_root) {
20091
- const package_root = path14.dirname(path14.dirname(path14.dirname(resolvePath(_HERE2))));
20092
- const cli = path14.join(package_root, "dist", "cli", "agent-config.js");
20125
+ const package_root = path15.dirname(path15.dirname(path15.dirname(resolvePath(_HERE2))));
20126
+ const cli = path15.join(package_root, "dist", "cli", "agent-config.js");
20093
20127
  return pathExists(cli) ? cli : null;
20094
20128
  }
20095
20129
  function _server_info_path() {
20096
- return path14.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
20130
+ return path15.join(os7.homedir(), ".event4u", "agent-config", "local-server.json");
20097
20131
  }
20098
20132
  function _pid_is_agent_config(pid) {
20099
20133
  let res;
@@ -20110,7 +20144,7 @@ function _pid_is_agent_config(pid) {
20110
20144
  }
20111
20145
  function unlinkMissingOk(p) {
20112
20146
  try {
20113
- fs16.unlinkSync(p);
20147
+ fs17.unlinkSync(p);
20114
20148
  } catch {
20115
20149
  }
20116
20150
  }
@@ -20188,14 +20222,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
20188
20222
  }
20189
20223
  function _wizard_run_sync(cmd, env, cli) {
20190
20224
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
20191
- const log_path = path14.join(
20225
+ const log_path = path15.join(
20192
20226
  os7.tmpdir(),
20193
20227
  `agent-config-wizard-${process3.pid}-${Date.now()}.log`
20194
20228
  );
20195
20229
  let child;
20196
20230
  let log_fd = null;
20197
20231
  try {
20198
- log_fd = fs16.openSync(log_path, "w");
20232
+ log_fd = fs17.openSync(log_path, "w");
20199
20233
  child = spawn(cmd[0], cmd.slice(1), {
20200
20234
  env,
20201
20235
  detached: true,
@@ -20213,7 +20247,7 @@ function _wizard_run_sync(cmd, env, cli) {
20213
20247
  } finally {
20214
20248
  if (log_fd !== null) {
20215
20249
  try {
20216
- fs16.closeSync(log_fd);
20250
+ fs17.closeSync(log_fd);
20217
20251
  } catch {
20218
20252
  }
20219
20253
  }
@@ -20463,8 +20497,8 @@ function main2(argv) {
20463
20497
  const target_root = resolvePath(
20464
20498
  opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
20465
20499
  );
20466
- const minimal_package_root = path14.dirname(
20467
- path14.dirname(path14.dirname(_minimal_templates_root()))
20500
+ const minimal_package_root = path15.dirname(
20501
+ path15.dirname(path15.dirname(_minimal_templates_root()))
20468
20502
  );
20469
20503
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
20470
20504
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -20493,7 +20527,7 @@ function main2(argv) {
20493
20527
  return rc2;
20494
20528
  }
20495
20529
  const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
20496
- const is_first_run = !pathExists(path14.join(project_root, SETTINGS_FILE));
20530
+ const is_first_run = !pathExists(path15.join(project_root, SETTINGS_FILE));
20497
20531
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
20498
20532
  if (rc === 0 && opts.interactive) {
20499
20533
  run_interactive_init(project_root, opts.force);
@@ -20557,16 +20591,16 @@ function _team_setup_hint_line(project_root) {
20557
20591
  return " \u2022 Claude Code team mode (optional cross-model review via the official codex plugin): run `agent-config doctor --check team` for setup status.";
20558
20592
  }
20559
20593
  function finalize_claude_model_tiers(project_root) {
20560
- const claude_skills = path14.join(project_root, ".claude", "skills");
20561
- const augment_skills = path14.join(project_root, ".augment", "skills");
20594
+ const claude_skills = path15.join(project_root, ".claude", "skills");
20595
+ const augment_skills = path15.join(project_root, ".augment", "skills");
20562
20596
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
20563
20597
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
20564
20598
  let rendered = 0;
20565
- const entries = fs16.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20599
+ const entries = fs17.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20566
20600
  for (const name of entries) {
20567
- const entry = path14.join(claude_skills, name);
20568
- const src_dir = path14.join(augment_skills, name);
20569
- const src_md = path14.join(src_dir, "SKILL.md");
20601
+ const entry = path15.join(claude_skills, name);
20602
+ const src_dir = path15.join(augment_skills, name);
20603
+ const src_md = path15.join(src_dir, "SKILL.md");
20570
20604
  let tier;
20571
20605
  try {
20572
20606
  tier = read_model_tier(src_md);
@@ -20575,22 +20609,22 @@ function finalize_claude_model_tiers(project_root) {
20575
20609
  }
20576
20610
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
20577
20611
  if (isSymlink(entry) || isFile(entry)) {
20578
- fs16.unlinkSync(entry);
20612
+ fs17.unlinkSync(entry);
20579
20613
  } else if (isDir(entry)) {
20580
- fs16.rmSync(entry, { recursive: true, force: true });
20614
+ fs17.rmSync(entry, { recursive: true, force: true });
20581
20615
  }
20582
20616
  mkdirp(entry);
20583
- const srcFiles = fs16.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20617
+ const srcFiles = fs17.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
20584
20618
  for (const fname of srcFiles) {
20585
20619
  if (fname === "SKILL.md") {
20586
20620
  writeText(
20587
- path14.join(entry, "SKILL.md"),
20621
+ path15.join(entry, "SKILL.md"),
20588
20622
  render_native_model_md(readText(src_md), tier)
20589
20623
  );
20590
20624
  } else {
20591
- fs16.symlinkSync(
20592
- path14.join("../../../.augment/skills", name, fname),
20593
- path14.join(entry, fname)
20625
+ fs17.symlinkSync(
20626
+ path15.join("../../../.augment/skills", name, fname),
20627
+ path15.join(entry, fname)
20594
20628
  );
20595
20629
  }
20596
20630
  }
@@ -20608,7 +20642,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
20608
20642
  let package_type;
20609
20643
  if (opts.package) {
20610
20644
  package_root = resolvePath(opts.package);
20611
- if (!pathExists(path14.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
20645
+ if (!pathExists(path15.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
20612
20646
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
20613
20647
  }
20614
20648
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -20743,9 +20777,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
20743
20777
  function _resolvedArgv1() {
20744
20778
  if (process3.argv[1] === void 0) return void 0;
20745
20779
  try {
20746
- return fs16.realpathSync(path14.resolve(process3.argv[1]));
20780
+ return fs17.realpathSync(path15.resolve(process3.argv[1]));
20747
20781
  } catch {
20748
- return path14.resolve(process3.argv[1]);
20782
+ return path15.resolve(process3.argv[1]);
20749
20783
  }
20750
20784
  }
20751
20785
  var _argv1 = _resolvedArgv1();