@event4u/agent-config 8.2.0 → 8.4.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 (55) hide show
  1. package/.claude-plugin/marketplace.json +4 -426
  2. package/.claude-plugin/skills/install-agent-config/SKILL.md +32 -0
  3. package/CHANGELOG.md +57 -0
  4. package/MIGRATION.md +18 -0
  5. package/README.md +86 -3
  6. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  7. package/dist/cli/registry.js +1 -0
  8. package/dist/cli/registry.js.map +1 -1
  9. package/dist/discovery/deprecation-report.md +1 -1
  10. package/dist/discovery/discovery-manifest.json +1 -1
  11. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  12. package/dist/discovery/discovery-manifest.summary.md +1 -1
  13. package/dist/discovery/orphan-report.md +1 -1
  14. package/dist/discovery/packs.json +1 -1
  15. package/dist/discovery/trust-report.md +1 -1
  16. package/dist/discovery/workspaces.json +1 -1
  17. package/dist/install/install.mjs +586 -386
  18. package/dist/mcp/registry-manifest.json +2 -2
  19. package/docs/contracts/CHANGELOG-conventions.md +8 -5
  20. package/docs/contracts/branch-protection-policy.md +14 -5
  21. package/docs/contracts/mcp-phase-1-scope.md +75 -0
  22. package/docs/contracts/mcp-tool-inventory.md +22 -15
  23. package/docs/contracts/release-pr-gating.md +22 -11
  24. package/docs/contracts/surface-matrix.md +103 -0
  25. package/docs/decisions/ADR-111-canonical-glama-listing.md +97 -0
  26. package/docs/decisions/ADR-112-stdio-lite-stays-read-only.md +92 -0
  27. package/docs/decisions/ADR-113-ci-native-release-label-trigger.md +201 -0
  28. package/docs/decisions/INDEX.md +3 -0
  29. package/docs/distribution/registry-submissions.md +1 -1
  30. package/docs/getting-started.md +8 -6
  31. package/docs/installation.md +13 -14
  32. package/docs/mcp-server.md +32 -20
  33. package/docs/setup/mcp-cloud-endpoints.md +9 -2
  34. package/package.json +2 -2
  35. package/src/config/surface-matrix.yml +213 -0
  36. package/src/scripts/_cli/cmd_converge.ts +399 -0
  37. package/src/scripts/_cli/cmd_doctor.ts +203 -9
  38. package/src/scripts/_cli/cmd_uninstall.ts +22 -0
  39. package/src/scripts/_cli/cmd_upgrade.ts +101 -16
  40. package/src/scripts/_dispatch.bash +13 -0
  41. package/src/scripts/_lib/claude_settings_hooks.ts +251 -0
  42. package/src/scripts/condense.ts +74 -65
  43. package/src/scripts/hook_manifest.yaml +16 -7
  44. package/src/scripts/install +23 -4
  45. package/src/scripts/install.ts +30 -0
  46. package/src/scripts/lint_glama_drift.ts +75 -0
  47. package/src/scripts/lint_marketplace.ts +54 -56
  48. package/src/scripts/lint_surface_matrix.ts +200 -0
  49. package/src/scripts/mcp_exec/safety_envelope.ts +105 -0
  50. package/src/scripts/mcp_registry_submit.sh +14 -3
  51. package/src/scripts/mcp_server/__main__.ts +6 -8
  52. package/src/scripts/mcp_server/consumer_tool_catalog.json +78 -3
  53. package/src/scripts/mcp_server/tools.ts +731 -0
  54. package/src/scripts/release.ts +203 -39
  55. package/src/scripts/surface_probe_hook.ts +231 -0
@@ -1,5 +1,11 @@
1
1
  #!/usr/bin/env tsx
2
+ import { createRequire as __acCreateRequire } from 'node:module'; const require = globalThis.require ?? __acCreateRequire(import.meta.url);
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
2
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
3
9
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
4
10
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
5
11
  }) : x)(function(x) {
@@ -9,6 +15,22 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
9
15
  var __commonJS = (cb, mod) => function __require2() {
10
16
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
11
17
  };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
27
+ // If the importer is in node compatibility mode or this is not an ESM
28
+ // file that has been converted to a CommonJS file using a Babel-
29
+ // compatible transform (i.e. "__esModule" has not been set), then set
30
+ // "default" to the CommonJS "module.exports" for node compatibility.
31
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
32
+ mod
33
+ ));
12
34
 
13
35
  // node_modules/yaml/dist/nodes/identity.js
14
36
  var require_identity = __commonJS({
@@ -87,17 +109,17 @@ var require_visit = __commonJS({
87
109
  visit.BREAK = BREAK;
88
110
  visit.SKIP = SKIP;
89
111
  visit.REMOVE = REMOVE;
90
- function visit_(key, node, visitor, path11) {
91
- const ctrl = callVisitor(key, node, visitor, path11);
112
+ function visit_(key, node, visitor, path12) {
113
+ const ctrl = callVisitor(key, node, visitor, path12);
92
114
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
93
- replaceNode(key, path11, ctrl);
94
- return visit_(key, ctrl, visitor, path11);
115
+ replaceNode(key, path12, ctrl);
116
+ return visit_(key, ctrl, visitor, path12);
95
117
  }
96
118
  if (typeof ctrl !== "symbol") {
97
119
  if (identity.isCollection(node)) {
98
- path11 = Object.freeze(path11.concat(node));
120
+ path12 = Object.freeze(path12.concat(node));
99
121
  for (let i = 0; i < node.items.length; ++i) {
100
- const ci = visit_(i, node.items[i], visitor, path11);
122
+ const ci = visit_(i, node.items[i], visitor, path12);
101
123
  if (typeof ci === "number")
102
124
  i = ci - 1;
103
125
  else if (ci === BREAK)
@@ -108,13 +130,13 @@ var require_visit = __commonJS({
108
130
  }
109
131
  }
110
132
  } else if (identity.isPair(node)) {
111
- path11 = Object.freeze(path11.concat(node));
112
- const ck = visit_("key", node.key, visitor, path11);
133
+ path12 = Object.freeze(path12.concat(node));
134
+ const ck = visit_("key", node.key, visitor, path12);
113
135
  if (ck === BREAK)
114
136
  return BREAK;
115
137
  else if (ck === REMOVE)
116
138
  node.key = null;
117
- const cv = visit_("value", node.value, visitor, path11);
139
+ const cv = visit_("value", node.value, visitor, path12);
118
140
  if (cv === BREAK)
119
141
  return BREAK;
120
142
  else if (cv === REMOVE)
@@ -135,17 +157,17 @@ var require_visit = __commonJS({
135
157
  visitAsync.BREAK = BREAK;
136
158
  visitAsync.SKIP = SKIP;
137
159
  visitAsync.REMOVE = REMOVE;
138
- async function visitAsync_(key, node, visitor, path11) {
139
- const ctrl = await callVisitor(key, node, visitor, path11);
160
+ async function visitAsync_(key, node, visitor, path12) {
161
+ const ctrl = await callVisitor(key, node, visitor, path12);
140
162
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
141
- replaceNode(key, path11, ctrl);
142
- return visitAsync_(key, ctrl, visitor, path11);
163
+ replaceNode(key, path12, ctrl);
164
+ return visitAsync_(key, ctrl, visitor, path12);
143
165
  }
144
166
  if (typeof ctrl !== "symbol") {
145
167
  if (identity.isCollection(node)) {
146
- path11 = Object.freeze(path11.concat(node));
168
+ path12 = Object.freeze(path12.concat(node));
147
169
  for (let i = 0; i < node.items.length; ++i) {
148
- const ci = await visitAsync_(i, node.items[i], visitor, path11);
170
+ const ci = await visitAsync_(i, node.items[i], visitor, path12);
149
171
  if (typeof ci === "number")
150
172
  i = ci - 1;
151
173
  else if (ci === BREAK)
@@ -156,13 +178,13 @@ var require_visit = __commonJS({
156
178
  }
157
179
  }
158
180
  } else if (identity.isPair(node)) {
159
- path11 = Object.freeze(path11.concat(node));
160
- const ck = await visitAsync_("key", node.key, visitor, path11);
181
+ path12 = Object.freeze(path12.concat(node));
182
+ const ck = await visitAsync_("key", node.key, visitor, path12);
161
183
  if (ck === BREAK)
162
184
  return BREAK;
163
185
  else if (ck === REMOVE)
164
186
  node.key = null;
165
- const cv = await visitAsync_("value", node.value, visitor, path11);
187
+ const cv = await visitAsync_("value", node.value, visitor, path12);
166
188
  if (cv === BREAK)
167
189
  return BREAK;
168
190
  else if (cv === REMOVE)
@@ -189,23 +211,23 @@ var require_visit = __commonJS({
189
211
  }
190
212
  return visitor;
191
213
  }
192
- function callVisitor(key, node, visitor, path11) {
214
+ function callVisitor(key, node, visitor, path12) {
193
215
  if (typeof visitor === "function")
194
- return visitor(key, node, path11);
216
+ return visitor(key, node, path12);
195
217
  if (identity.isMap(node))
196
- return visitor.Map?.(key, node, path11);
218
+ return visitor.Map?.(key, node, path12);
197
219
  if (identity.isSeq(node))
198
- return visitor.Seq?.(key, node, path11);
220
+ return visitor.Seq?.(key, node, path12);
199
221
  if (identity.isPair(node))
200
- return visitor.Pair?.(key, node, path11);
222
+ return visitor.Pair?.(key, node, path12);
201
223
  if (identity.isScalar(node))
202
- return visitor.Scalar?.(key, node, path11);
224
+ return visitor.Scalar?.(key, node, path12);
203
225
  if (identity.isAlias(node))
204
- return visitor.Alias?.(key, node, path11);
226
+ return visitor.Alias?.(key, node, path12);
205
227
  return void 0;
206
228
  }
207
- function replaceNode(key, path11, node) {
208
- const parent = path11[path11.length - 1];
229
+ function replaceNode(key, path12, node) {
230
+ const parent = path12[path12.length - 1];
209
231
  if (identity.isCollection(parent)) {
210
232
  parent.items[key] = node;
211
233
  } else if (identity.isPair(parent)) {
@@ -815,10 +837,10 @@ var require_Collection = __commonJS({
815
837
  var createNode = require_createNode();
816
838
  var identity = require_identity();
817
839
  var Node = require_Node();
818
- function collectionFromPath(schema, path11, value) {
840
+ function collectionFromPath(schema, path12, value) {
819
841
  let v = value;
820
- for (let i = path11.length - 1; i >= 0; --i) {
821
- const k = path11[i];
842
+ for (let i = path12.length - 1; i >= 0; --i) {
843
+ const k = path12[i];
822
844
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
823
845
  const a = [];
824
846
  a[k] = v;
@@ -837,7 +859,7 @@ var require_Collection = __commonJS({
837
859
  sourceObjects: /* @__PURE__ */ new Map()
838
860
  });
839
861
  }
840
- var isEmptyPath = (path11) => path11 == null || typeof path11 === "object" && !!path11[Symbol.iterator]().next().done;
862
+ var isEmptyPath = (path12) => path12 == null || typeof path12 === "object" && !!path12[Symbol.iterator]().next().done;
841
863
  var Collection = class extends Node.NodeBase {
842
864
  constructor(type, schema) {
843
865
  super(type);
@@ -867,11 +889,11 @@ var require_Collection = __commonJS({
867
889
  * be a Pair instance or a `{ key, value }` object, which may not have a key
868
890
  * that already exists in the map.
869
891
  */
870
- addIn(path11, value) {
871
- if (isEmptyPath(path11))
892
+ addIn(path12, value) {
893
+ if (isEmptyPath(path12))
872
894
  this.add(value);
873
895
  else {
874
- const [key, ...rest] = path11;
896
+ const [key, ...rest] = path12;
875
897
  const node = this.get(key, true);
876
898
  if (identity.isCollection(node))
877
899
  node.addIn(rest, value);
@@ -885,8 +907,8 @@ var require_Collection = __commonJS({
885
907
  * Removes a value from the collection.
886
908
  * @returns `true` if the item was found and removed.
887
909
  */
888
- deleteIn(path11) {
889
- const [key, ...rest] = path11;
910
+ deleteIn(path12) {
911
+ const [key, ...rest] = path12;
890
912
  if (rest.length === 0)
891
913
  return this.delete(key);
892
914
  const node = this.get(key, true);
@@ -900,8 +922,8 @@ var require_Collection = __commonJS({
900
922
  * scalar values from their surrounding node; to disable set `keepScalar` to
901
923
  * `true` (collections are always returned intact).
902
924
  */
903
- getIn(path11, keepScalar) {
904
- const [key, ...rest] = path11;
925
+ getIn(path12, keepScalar) {
926
+ const [key, ...rest] = path12;
905
927
  const node = this.get(key, true);
906
928
  if (rest.length === 0)
907
929
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -919,8 +941,8 @@ var require_Collection = __commonJS({
919
941
  /**
920
942
  * Checks if the collection includes a value with the key `key`.
921
943
  */
922
- hasIn(path11) {
923
- const [key, ...rest] = path11;
944
+ hasIn(path12) {
945
+ const [key, ...rest] = path12;
924
946
  if (rest.length === 0)
925
947
  return this.has(key);
926
948
  const node = this.get(key, true);
@@ -930,8 +952,8 @@ var require_Collection = __commonJS({
930
952
  * Sets a value in this collection. For `!!set`, `value` needs to be a
931
953
  * boolean to add/remove the item from the set.
932
954
  */
933
- setIn(path11, value) {
934
- const [key, ...rest] = path11;
955
+ setIn(path12, value) {
956
+ const [key, ...rest] = path12;
935
957
  if (rest.length === 0) {
936
958
  this.set(key, value);
937
959
  } else {
@@ -3446,9 +3468,9 @@ var require_Document = __commonJS({
3446
3468
  this.contents.add(value);
3447
3469
  }
3448
3470
  /** Adds a value to the document. */
3449
- addIn(path11, value) {
3471
+ addIn(path12, value) {
3450
3472
  if (assertCollection(this.contents))
3451
- this.contents.addIn(path11, value);
3473
+ this.contents.addIn(path12, value);
3452
3474
  }
3453
3475
  /**
3454
3476
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -3523,14 +3545,14 @@ var require_Document = __commonJS({
3523
3545
  * Removes a value from the document.
3524
3546
  * @returns `true` if the item was found and removed.
3525
3547
  */
3526
- deleteIn(path11) {
3527
- if (Collection.isEmptyPath(path11)) {
3548
+ deleteIn(path12) {
3549
+ if (Collection.isEmptyPath(path12)) {
3528
3550
  if (this.contents == null)
3529
3551
  return false;
3530
3552
  this.contents = null;
3531
3553
  return true;
3532
3554
  }
3533
- return assertCollection(this.contents) ? this.contents.deleteIn(path11) : false;
3555
+ return assertCollection(this.contents) ? this.contents.deleteIn(path12) : false;
3534
3556
  }
3535
3557
  /**
3536
3558
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -3545,10 +3567,10 @@ var require_Document = __commonJS({
3545
3567
  * scalar values from their surrounding node; to disable set `keepScalar` to
3546
3568
  * `true` (collections are always returned intact).
3547
3569
  */
3548
- getIn(path11, keepScalar) {
3549
- if (Collection.isEmptyPath(path11))
3570
+ getIn(path12, keepScalar) {
3571
+ if (Collection.isEmptyPath(path12))
3550
3572
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
3551
- return identity.isCollection(this.contents) ? this.contents.getIn(path11, keepScalar) : void 0;
3573
+ return identity.isCollection(this.contents) ? this.contents.getIn(path12, keepScalar) : void 0;
3552
3574
  }
3553
3575
  /**
3554
3576
  * Checks if the document includes a value with the key `key`.
@@ -3559,10 +3581,10 @@ var require_Document = __commonJS({
3559
3581
  /**
3560
3582
  * Checks if the document includes a value at `path`.
3561
3583
  */
3562
- hasIn(path11) {
3563
- if (Collection.isEmptyPath(path11))
3584
+ hasIn(path12) {
3585
+ if (Collection.isEmptyPath(path12))
3564
3586
  return this.contents !== void 0;
3565
- return identity.isCollection(this.contents) ? this.contents.hasIn(path11) : false;
3587
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path12) : false;
3566
3588
  }
3567
3589
  /**
3568
3590
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -3579,13 +3601,13 @@ var require_Document = __commonJS({
3579
3601
  * Sets a value in this document. For `!!set`, `value` needs to be a
3580
3602
  * boolean to add/remove the item from the set.
3581
3603
  */
3582
- setIn(path11, value) {
3583
- if (Collection.isEmptyPath(path11)) {
3604
+ setIn(path12, value) {
3605
+ if (Collection.isEmptyPath(path12)) {
3584
3606
  this.contents = value;
3585
3607
  } else if (this.contents == null) {
3586
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path11), value);
3608
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path12), value);
3587
3609
  } else if (assertCollection(this.contents)) {
3588
- this.contents.setIn(path11, value);
3610
+ this.contents.setIn(path12, value);
3589
3611
  }
3590
3612
  }
3591
3613
  /**
@@ -5545,9 +5567,9 @@ var require_cst_visit = __commonJS({
5545
5567
  visit.BREAK = BREAK;
5546
5568
  visit.SKIP = SKIP;
5547
5569
  visit.REMOVE = REMOVE;
5548
- visit.itemAtPath = (cst, path11) => {
5570
+ visit.itemAtPath = (cst, path12) => {
5549
5571
  let item = cst;
5550
- for (const [field, index] of path11) {
5572
+ for (const [field, index] of path12) {
5551
5573
  const tok = item?.[field];
5552
5574
  if (tok && "items" in tok) {
5553
5575
  item = tok.items[index];
@@ -5556,23 +5578,23 @@ var require_cst_visit = __commonJS({
5556
5578
  }
5557
5579
  return item;
5558
5580
  };
5559
- visit.parentCollection = (cst, path11) => {
5560
- const parent = visit.itemAtPath(cst, path11.slice(0, -1));
5561
- const field = path11[path11.length - 1][0];
5581
+ visit.parentCollection = (cst, path12) => {
5582
+ const parent = visit.itemAtPath(cst, path12.slice(0, -1));
5583
+ const field = path12[path12.length - 1][0];
5562
5584
  const coll = parent?.[field];
5563
5585
  if (coll && "items" in coll)
5564
5586
  return coll;
5565
5587
  throw new Error("Parent collection not found");
5566
5588
  };
5567
- function _visit(path11, item, visitor) {
5568
- let ctrl = visitor(item, path11);
5589
+ function _visit(path12, item, visitor) {
5590
+ let ctrl = visitor(item, path12);
5569
5591
  if (typeof ctrl === "symbol")
5570
5592
  return ctrl;
5571
5593
  for (const field of ["key", "value"]) {
5572
5594
  const token = item[field];
5573
5595
  if (token && "items" in token) {
5574
5596
  for (let i = 0; i < token.items.length; ++i) {
5575
- const ci = _visit(Object.freeze(path11.concat([[field, i]])), token.items[i], visitor);
5597
+ const ci = _visit(Object.freeze(path12.concat([[field, i]])), token.items[i], visitor);
5576
5598
  if (typeof ci === "number")
5577
5599
  i = ci - 1;
5578
5600
  else if (ci === BREAK)
@@ -5583,10 +5605,10 @@ var require_cst_visit = __commonJS({
5583
5605
  }
5584
5606
  }
5585
5607
  if (typeof ctrl === "function" && field === "key")
5586
- ctrl = ctrl(item, path11);
5608
+ ctrl = ctrl(item, path12);
5587
5609
  }
5588
5610
  }
5589
- return typeof ctrl === "function" ? ctrl(item, path11) : ctrl;
5611
+ return typeof ctrl === "function" ? ctrl(item, path12) : ctrl;
5590
5612
  }
5591
5613
  exports.visit = visit;
5592
5614
  }
@@ -6888,14 +6910,14 @@ var require_parser = __commonJS({
6888
6910
  case "scalar":
6889
6911
  case "single-quoted-scalar":
6890
6912
  case "double-quoted-scalar": {
6891
- const fs13 = this.flowScalar(this.type);
6913
+ const fs14 = this.flowScalar(this.type);
6892
6914
  if (atNextItem || it.value) {
6893
- map.items.push({ start, key: fs13, sep: [] });
6915
+ map.items.push({ start, key: fs14, sep: [] });
6894
6916
  this.onKeyLine = true;
6895
6917
  } else if (it.sep) {
6896
- this.stack.push(fs13);
6918
+ this.stack.push(fs14);
6897
6919
  } else {
6898
- Object.assign(it, { key: fs13, sep: [] });
6920
+ Object.assign(it, { key: fs14, sep: [] });
6899
6921
  this.onKeyLine = true;
6900
6922
  }
6901
6923
  return;
@@ -7023,13 +7045,13 @@ var require_parser = __commonJS({
7023
7045
  case "scalar":
7024
7046
  case "single-quoted-scalar":
7025
7047
  case "double-quoted-scalar": {
7026
- const fs13 = this.flowScalar(this.type);
7048
+ const fs14 = this.flowScalar(this.type);
7027
7049
  if (!it || it.value)
7028
- fc.items.push({ start: [], key: fs13, sep: [] });
7050
+ fc.items.push({ start: [], key: fs14, sep: [] });
7029
7051
  else if (it.sep)
7030
- this.stack.push(fs13);
7052
+ this.stack.push(fs14);
7031
7053
  else
7032
- Object.assign(it, { key: fs13, sep: [] });
7054
+ Object.assign(it, { key: fs14, sep: [] });
7033
7055
  return;
7034
7056
  }
7035
7057
  case "flow-map-end":
@@ -7237,7 +7259,7 @@ var require_public_api = __commonJS({
7237
7259
  }
7238
7260
  return doc;
7239
7261
  }
7240
- function parse(src, reviver, options) {
7262
+ function parse2(src, reviver, options) {
7241
7263
  let _reviver = void 0;
7242
7264
  if (typeof reviver === "function") {
7243
7265
  _reviver = reviver;
@@ -7278,7 +7300,7 @@ var require_public_api = __commonJS({
7278
7300
  return value.toString(options);
7279
7301
  return new Document.Document(value, _replacer, options).toString(options);
7280
7302
  }
7281
- exports.parse = parse;
7303
+ exports.parse = parse2;
7282
7304
  exports.parseAllDocuments = parseAllDocuments;
7283
7305
  exports.parseDocument = parseDocument;
7284
7306
  exports.stringify = stringify;
@@ -7340,9 +7362,9 @@ var require_dist = __commonJS({
7340
7362
  // src/scripts/install.ts
7341
7363
  import { spawn, spawnSync as spawnSync2 } from "node:child_process";
7342
7364
  import * as crypto2 from "node:crypto";
7343
- import * as fs12 from "node:fs";
7365
+ import * as fs13 from "node:fs";
7344
7366
  import * as os6 from "node:os";
7345
- import * as path10 from "node:path";
7367
+ import * as path11 from "node:path";
7346
7368
  import process3 from "node:process";
7347
7369
  import { fileURLToPath as fileURLToPath3, pathToFileURL as pathToFileURL2 } from "node:url";
7348
7370
 
@@ -7726,8 +7748,8 @@ function lockfile_write_path(env) {
7726
7748
  }
7727
7749
  return write_target("installed.lock", { env: env ?? null });
7728
7750
  }
7729
- function read_lockfile(path11) {
7730
- const target = path11 ?? lockfile_path();
7751
+ function read_lockfile(path12) {
7752
+ const target = path12 ?? lockfile_path();
7731
7753
  let text;
7732
7754
  try {
7733
7755
  text = fs2.readFileSync(target, { encoding: "utf-8" });
@@ -7970,8 +7992,8 @@ function load_lab_pack_ids(repo_root) {
7970
7992
  const vocab = path3.join(repo_root, "src", "config", "discovery", "packs.yml");
7971
7993
  const ids = /* @__PURE__ */ new Set();
7972
7994
  try {
7973
- const YAML = require_dist();
7974
- const data = YAML.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
7995
+ const YAML2 = require_dist();
7996
+ const data = YAML2.parse(fs3.readFileSync(vocab, "utf-8"), { version: "1.1" });
7975
7997
  for (const entry of data ?? []) {
7976
7998
  if (entry && typeof entry === "object" && !Array.isArray(entry)) {
7977
7999
  const rec = entry;
@@ -8595,18 +8617,18 @@ function manifest_path(project_root, env) {
8595
8617
  var _TOP_KEY_RE = /^([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8596
8618
  var _LIST_DASH_RE = /^\s*-\s*(.+?)\s*$/;
8597
8619
  var _INDENT_KEY_RE = /^\s+([A-Za-z_][A-Za-z0-9_]*)\s*:\s*"?([^"\n]*?)"?\s*$/;
8598
- function read_manifest(path11) {
8620
+ function read_manifest(path12) {
8599
8621
  let text;
8600
8622
  try {
8601
- text = require_read_text(path11);
8623
+ text = require_read_text(path12);
8602
8624
  } catch {
8603
8625
  return null;
8604
8626
  }
8605
8627
  const data = _parse_manual(text);
8606
8628
  return _normalise_v2_shape(data);
8607
8629
  }
8608
- function require_read_text(path11) {
8609
- return fs6.readFileSync(path11, { encoding: "utf-8" });
8630
+ function require_read_text(path12) {
8631
+ return fs6.readFileSync(path12, { encoding: "utf-8" });
8610
8632
  }
8611
8633
  function _normalise_v2_shape(data) {
8612
8634
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -8787,9 +8809,9 @@ function stable_sort(items, key) {
8787
8809
  return a.index - b.index;
8788
8810
  }).map((entry) => entry.item);
8789
8811
  }
8790
- function write_manifest(path11, version, tools, options = {}) {
8812
+ function write_manifest(path12, version, tools, options = {}) {
8791
8813
  const rendered = _render2(version, tools, { deploy_roots: options.deploy_roots ?? null });
8792
- return write_atomic(path11, rendered);
8814
+ return write_atomic(path12, rendered);
8793
8815
  }
8794
8816
  var ScopeMismatchError = class extends Error {
8795
8817
  name_;
@@ -9151,11 +9173,167 @@ function build_command_bundles(package_root, dest_dir, force = false, curation =
9151
9173
  return written;
9152
9174
  }
9153
9175
 
9176
+ // src/scripts/_lib/claude_settings_hooks.ts
9177
+ var YAML = __toESM(require_dist(), 1);
9178
+ import * as fs8 from "node:fs";
9179
+ import * as path7 from "node:path";
9180
+
9181
+ // src/install/atomic.ts
9182
+ import {
9183
+ closeSync as closeSync3,
9184
+ fsyncSync,
9185
+ mkdirSync as mkdirSync5,
9186
+ openSync as openSync3,
9187
+ readFileSync as readFileSync6,
9188
+ renameSync as renameSync5,
9189
+ unlinkSync as unlinkSync4,
9190
+ writeSync
9191
+ } from "node:fs";
9192
+ import { dirname as dirname4, join as join7 } from "node:path";
9193
+ function atomicWriteFile(target, data, options = {}) {
9194
+ const mode = options.mode ?? 420;
9195
+ const parent = dirname4(target);
9196
+ mkdirSync5(parent, { recursive: true });
9197
+ const tmp = join7(parent, `.tmp.${process.pid}.${randSuffix()}`);
9198
+ let fd = null;
9199
+ try {
9200
+ fd = openSync3(tmp, "w", mode);
9201
+ const buf = typeof data === "string" ? Buffer.from(data, "utf8") : data;
9202
+ writeSync(fd, buf, 0, buf.length, 0);
9203
+ fsyncSync(fd);
9204
+ closeSync3(fd);
9205
+ fd = null;
9206
+ renameSync5(tmp, target);
9207
+ } catch (err) {
9208
+ if (fd !== null) {
9209
+ try {
9210
+ closeSync3(fd);
9211
+ } catch {
9212
+ }
9213
+ }
9214
+ try {
9215
+ unlinkSync4(tmp);
9216
+ } catch {
9217
+ }
9218
+ throw err;
9219
+ }
9220
+ }
9221
+ function randSuffix() {
9222
+ return Math.floor(Math.random() * 281474976710655).toString(16).padStart(12, "0");
9223
+ }
9224
+
9225
+ // src/scripts/_lib/claude_settings_hooks.ts
9226
+ function _yaml_parse(text) {
9227
+ return YAML.parse(text);
9228
+ }
9229
+ var MANAGED_SIGNATURE = "dispatch:hook --platform claude";
9230
+ var CorruptSettingsError = class extends Error {
9231
+ constructor(file, cause) {
9232
+ super(
9233
+ `${file} exists but is not valid JSON (${cause}). Refusing to overwrite a user-owned settings file \u2014 fix or remove it, then re-run.`
9234
+ );
9235
+ this.name = "CorruptSettingsError";
9236
+ }
9237
+ };
9238
+ var SettingsLockError = class extends Error {
9239
+ constructor(lockPath) {
9240
+ super(
9241
+ `settings lock ${lockPath} is held by another process. Re-run when the concurrent install finishes (stale lock: delete the file).`
9242
+ );
9243
+ this.name = "SettingsLockError";
9244
+ }
9245
+ };
9246
+ function build_claude_hook_matrix(manifest_path2) {
9247
+ const raw = fs8.readFileSync(manifest_path2, "utf8");
9248
+ const manifest = _yaml_parse(raw) ?? {};
9249
+ const hook_spec = manifest["schema_version"] ?? 1;
9250
+ const platforms = manifest["platforms"] ?? {};
9251
+ const claude_events = (platforms["claude"] ?? {}) || {};
9252
+ const aliasesAll = manifest["native_event_aliases"] ?? {};
9253
+ const aliases = (aliasesAll["claude"] ?? {}) || {};
9254
+ const ac_to_native = {};
9255
+ for (const [native, ac] of Object.entries(aliases)) {
9256
+ ac_to_native[String(ac)] = native;
9257
+ }
9258
+ const matrix = {};
9259
+ for (const [ac_event, concerns] of Object.entries(claude_events)) {
9260
+ if (!concerns || Array.isArray(concerns) && concerns.length === 0) continue;
9261
+ const native = ac_to_native[ac_event];
9262
+ if (native === void 0) continue;
9263
+ matrix[native] = `BIN="$CLAUDE_PROJECT_DIR/agent-config"; [ -x "$BIN" ] || BIN=agent-config; "$BIN" dispatch:hook --platform claude --event ${ac_event} --native-event ${native} --project-dir "$CLAUDE_PROJECT_DIR" --min-version ${String(hook_spec)}`;
9264
+ }
9265
+ return matrix;
9266
+ }
9267
+ function _is_managed_group(group) {
9268
+ if (typeof group !== "object" || group === null || Array.isArray(group)) return false;
9269
+ const hooks = group.hooks;
9270
+ if (!Array.isArray(hooks)) return false;
9271
+ return hooks.some(
9272
+ (h) => typeof h === "object" && h !== null && typeof h.command === "string" && h.command.includes(MANAGED_SIGNATURE)
9273
+ );
9274
+ }
9275
+ function _read_settings(settings_path) {
9276
+ if (!fs8.existsSync(settings_path)) return {};
9277
+ const raw = fs8.readFileSync(settings_path, "utf8");
9278
+ if (raw.trim() === "") return {};
9279
+ let parsed;
9280
+ try {
9281
+ parsed = JSON.parse(raw);
9282
+ } catch (e) {
9283
+ throw new CorruptSettingsError(settings_path, e.message);
9284
+ }
9285
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
9286
+ throw new CorruptSettingsError(settings_path, "top level is not an object");
9287
+ }
9288
+ return parsed;
9289
+ }
9290
+ function _with_lock(settings_path, fn) {
9291
+ const lockPath = settings_path + ".agent-config.lock";
9292
+ fs8.mkdirSync(path7.dirname(lockPath), { recursive: true });
9293
+ let fd;
9294
+ try {
9295
+ fd = fs8.openSync(lockPath, "wx");
9296
+ } catch {
9297
+ throw new SettingsLockError(lockPath);
9298
+ }
9299
+ try {
9300
+ return fn();
9301
+ } finally {
9302
+ fs8.closeSync(fd);
9303
+ fs8.rmSync(lockPath, { force: true });
9304
+ }
9305
+ }
9306
+ function ensure_managed_hooks(settings_path, matrix) {
9307
+ return _with_lock(settings_path, () => {
9308
+ const settings = _read_settings(settings_path);
9309
+ const before = JSON.stringify(settings);
9310
+ const hooks = (settings["hooks"] ?? {}) || {};
9311
+ const touched = [];
9312
+ for (const [native, command] of Object.entries(matrix)) {
9313
+ const existing = Array.isArray(hooks[native]) ? hooks[native] : [];
9314
+ const user_groups = existing.filter((g) => !_is_managed_group(g));
9315
+ const managed_group = {
9316
+ hooks: [{ type: "command", command }]
9317
+ };
9318
+ const next = [...user_groups, managed_group];
9319
+ if (JSON.stringify(next) !== JSON.stringify(existing)) touched.push(native);
9320
+ hooks[native] = next;
9321
+ }
9322
+ settings["hooks"] = hooks;
9323
+ const after = JSON.stringify(settings);
9324
+ if (after === before) {
9325
+ return { changed: false, events: [] };
9326
+ }
9327
+ atomicWriteFile(settings_path, JSON.stringify(settings, null, 2) + "\n");
9328
+ return { changed: true, events: touched };
9329
+ });
9330
+ }
9331
+
9154
9332
  // src/scripts/_lib/agent_settings.ts
9155
9333
  import { createRequire } from "node:module";
9156
- import * as fs8 from "node:fs";
9334
+ import * as fs9 from "node:fs";
9157
9335
  import * as os5 from "node:os";
9158
- import * as path7 from "node:path";
9336
+ import * as path8 from "node:path";
9159
9337
  var _require = createRequire(import.meta.url);
9160
9338
  var Logger = class {
9161
9339
  name = "scripts._lib.agent_settings";
@@ -9195,10 +9373,10 @@ var DEFAULT_PROJECT_FILE = ".agent-settings.yml";
9195
9373
  var LOCAL_PROJECT_FILE = ".agent-settings.local.yml";
9196
9374
  var LOCAL_PROJECT_SUBDIR = ["agents", "settings"];
9197
9375
  function _local_settings_path(project_root) {
9198
- return path7.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9376
+ return path8.join(project_root, ...LOCAL_PROJECT_SUBDIR, LOCAL_PROJECT_FILE);
9199
9377
  }
9200
9378
  function _canonical_settings_path(project_root) {
9201
- return path7.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9379
+ return path8.join(project_root, ...LOCAL_PROJECT_SUBDIR, DEFAULT_PROJECT_FILE);
9202
9380
  }
9203
9381
  var USER_GLOBAL_FILENAME = "agent-settings.yml";
9204
9382
  function DEFAULT_USER_GLOBAL_FILE() {
@@ -9243,8 +9421,8 @@ var _AGENTS_DIR_MARKERS = [
9243
9421
  var _LEGACY_ANCHOR_ENV = "AGENT_CONFIG_LEGACY_ANCHOR";
9244
9422
  function _exists(p) {
9245
9423
  try {
9246
- fs8.lstatSync(p);
9247
- fs8.statSync(p);
9424
+ fs9.lstatSync(p);
9425
+ fs9.statSync(p);
9248
9426
  return true;
9249
9427
  } catch {
9250
9428
  return false;
@@ -9252,22 +9430,22 @@ function _exists(p) {
9252
9430
  }
9253
9431
  function _is_dir2(p) {
9254
9432
  try {
9255
- return fs8.statSync(p).isDirectory();
9433
+ return fs9.statSync(p).isDirectory();
9256
9434
  } catch {
9257
9435
  return false;
9258
9436
  }
9259
9437
  }
9260
9438
  function _is_file(p) {
9261
9439
  try {
9262
- return fs8.statSync(p).isFile();
9440
+ return fs9.statSync(p).isFile();
9263
9441
  } catch {
9264
9442
  return false;
9265
9443
  }
9266
9444
  }
9267
9445
  function _resolve(p) {
9268
- const absolute = path7.resolve(p);
9446
+ const absolute = path8.resolve(p);
9269
9447
  try {
9270
- return fs8.realpathSync(absolute);
9448
+ return fs9.realpathSync(absolute);
9271
9449
  } catch {
9272
9450
  return absolute;
9273
9451
  }
@@ -9277,7 +9455,7 @@ function _ancestor_chain(start) {
9277
9455
  let cursor = start;
9278
9456
  for (; ; ) {
9279
9457
  chain.push(cursor);
9280
- const parent = path7.dirname(cursor);
9458
+ const parent = path8.dirname(cursor);
9281
9459
  if (parent === cursor) {
9282
9460
  break;
9283
9461
  }
@@ -9286,15 +9464,15 @@ function _ancestor_chain(start) {
9286
9464
  return chain;
9287
9465
  }
9288
9466
  function _boundary_anchor_at(dir) {
9289
- const agents_dir = path7.join(dir, "agents");
9467
+ const agents_dir = path8.join(dir, "agents");
9290
9468
  if (_is_dir2(agents_dir)) {
9291
9469
  for (const marker of _AGENTS_DIR_MARKERS) {
9292
- if (_exists(path7.join(agents_dir, marker))) {
9470
+ if (_exists(path8.join(agents_dir, marker))) {
9293
9471
  return ANCHOR_AGENTS_DIR;
9294
9472
  }
9295
9473
  }
9296
9474
  }
9297
- if (_exists(path7.join(dir, ".git"))) {
9475
+ if (_exists(path8.join(dir, ".git"))) {
9298
9476
  return ANCHOR_GIT;
9299
9477
  }
9300
9478
  return null;
@@ -9305,7 +9483,7 @@ function find_project_root_with_anchor(start) {
9305
9483
  const chain = _ancestor_chain(current);
9306
9484
  if (legacy) {
9307
9485
  for (const candidate of chain) {
9308
- if (_exists(path7.join(candidate, ".git"))) {
9486
+ if (_exists(path8.join(candidate, ".git"))) {
9309
9487
  return [candidate, ANCHOR_GIT];
9310
9488
  }
9311
9489
  }
@@ -9319,7 +9497,7 @@ function find_project_root_with_anchor(start) {
9319
9497
  }
9320
9498
  let outermost = null;
9321
9499
  for (const candidate of chain) {
9322
- if (_exists(path7.join(candidate, DEFAULT_PROJECT_FILE))) {
9500
+ if (_exists(path8.join(candidate, DEFAULT_PROJECT_FILE))) {
9323
9501
  outermost = candidate;
9324
9502
  }
9325
9503
  }
@@ -9363,7 +9541,7 @@ function _expanduser(p) {
9363
9541
  return os5.homedir();
9364
9542
  }
9365
9543
  if (p.startsWith("~/") || process.platform === "win32" && p.startsWith("~\\")) {
9366
- return path7.join(os5.homedir(), p.slice(2));
9544
+ return path8.join(os5.homedir(), p.slice(2));
9367
9545
  }
9368
9546
  return p;
9369
9547
  }
@@ -9392,13 +9570,13 @@ function resolve_project_root(arg, options = {}) {
9392
9570
  function _resolve_cascade_paths(cwd, project_path) {
9393
9571
  if (cwd === null) {
9394
9572
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9395
- const parent = path7.dirname(legacy);
9573
+ const parent = path8.dirname(legacy);
9396
9574
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9397
9575
  }
9398
9576
  const root = find_project_root(cwd);
9399
9577
  if (root === null) {
9400
9578
  const legacy = project_path ? project_path : DEFAULT_PROJECT_FILE;
9401
- const parent = path7.dirname(legacy);
9579
+ const parent = path8.dirname(legacy);
9402
9580
  return [legacy, _canonical_settings_path(parent), _local_settings_path(parent)];
9403
9581
  }
9404
9582
  const cwd_resolved = _resolve(cwd);
@@ -9409,7 +9587,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9409
9587
  if (cursor === root) {
9410
9588
  break;
9411
9589
  }
9412
- const parent = path7.dirname(cursor);
9590
+ const parent = path8.dirname(cursor);
9413
9591
  if (parent === cursor) {
9414
9592
  break;
9415
9593
  }
@@ -9417,7 +9595,7 @@ function _resolve_cascade_paths(cwd, project_path) {
9417
9595
  }
9418
9596
  chain.reverse();
9419
9597
  return [
9420
- ...chain.map((d) => path7.join(d, DEFAULT_PROJECT_FILE)),
9598
+ ...chain.map((d) => path8.join(d, DEFAULT_PROJECT_FILE)),
9421
9599
  _canonical_settings_path(root),
9422
9600
  _local_settings_path(root)
9423
9601
  ];
@@ -9450,16 +9628,16 @@ function _read_yaml(p) {
9450
9628
  if (!_is_file(p)) {
9451
9629
  return null;
9452
9630
  }
9453
- let YAML;
9631
+ let YAML2;
9454
9632
  try {
9455
- YAML = _require("yaml");
9633
+ YAML2 = _require("yaml");
9456
9634
  } catch {
9457
9635
  return null;
9458
9636
  }
9459
9637
  let data;
9460
9638
  try {
9461
- const text = fs8.readFileSync(p, "utf-8");
9462
- data = YAML.parse(text, { version: "1.1" });
9639
+ const text = fs9.readFileSync(p, "utf-8");
9640
+ data = YAML2.parse(text, { version: "1.1" });
9463
9641
  if (data === null || data === void 0) {
9464
9642
  data = {};
9465
9643
  }
@@ -9550,8 +9728,8 @@ function _is_plain_dict(value) {
9550
9728
  }
9551
9729
 
9552
9730
  // src/scripts/_lib/module_detection.ts
9553
- import * as fs9 from "node:fs";
9554
- import * as path8 from "node:path";
9731
+ import * as fs10 from "node:fs";
9732
+ import * as path9 from "node:path";
9555
9733
  var _SKIP_DIRS = /* @__PURE__ */ new Set([".module-template", ".example"]);
9556
9734
  var _RULES = [
9557
9735
  ["app/Modules", "laravel-hmvc", "App\\Modules\\{ModuleName}"],
@@ -9565,14 +9743,14 @@ var _RULES = [
9565
9743
  ];
9566
9744
  function _isDir(p) {
9567
9745
  try {
9568
- return fs9.statSync(p).isDirectory();
9746
+ return fs10.statSync(p).isDirectory();
9569
9747
  } catch {
9570
9748
  return false;
9571
9749
  }
9572
9750
  }
9573
9751
  function _isFile(p) {
9574
9752
  try {
9575
- return fs9.statSync(p).isFile();
9753
+ return fs10.statSync(p).isFile();
9576
9754
  } catch {
9577
9755
  return false;
9578
9756
  }
@@ -9586,13 +9764,13 @@ function _isUpperChar(ch) {
9586
9764
  function _list_module_subdirs(root) {
9587
9765
  let entries;
9588
9766
  try {
9589
- entries = fs9.readdirSync(root).sort();
9767
+ entries = fs10.readdirSync(root).sort();
9590
9768
  } catch {
9591
9769
  return [];
9592
9770
  }
9593
9771
  const out = [];
9594
9772
  for (const name of entries) {
9595
- if (!_isDir(path8.join(root, name))) {
9773
+ if (!_isDir(path9.join(root, name))) {
9596
9774
  continue;
9597
9775
  }
9598
9776
  if (name.startsWith(".")) {
@@ -9614,11 +9792,11 @@ function _score_confidence(stack, root, subdirs) {
9614
9792
  return capitalized.length > 0 ? "high" : "medium";
9615
9793
  }
9616
9794
  if (stack === "node-monorepo") {
9617
- const withPkgJson = subdirs.filter((name) => _isFile(path8.join(root, name, "package.json")));
9795
+ const withPkgJson = subdirs.filter((name) => _isFile(path9.join(root, name, "package.json")));
9618
9796
  return withPkgJson.length > 0 ? "high" : "medium";
9619
9797
  }
9620
9798
  if (stack === "python-src") {
9621
- const withInit = subdirs.filter((name) => _isFile(path8.join(root, name, "__init__.py")));
9799
+ const withInit = subdirs.filter((name) => _isFile(path9.join(root, name, "__init__.py")));
9622
9800
  return withInit.length > 0 ? "high" : "medium";
9623
9801
  }
9624
9802
  if (stack === "go-internal") {
@@ -9630,7 +9808,7 @@ function detect_module_roots(project_root) {
9630
9808
  const high = [];
9631
9809
  const medium = [];
9632
9810
  for (const [rel_path, stack, namespace_template] of _RULES) {
9633
- const abs_path = path8.join(project_root, rel_path);
9811
+ const abs_path = path9.join(project_root, rel_path);
9634
9812
  if (!_isDir(abs_path)) {
9635
9813
  continue;
9636
9814
  }
@@ -9652,7 +9830,7 @@ function detect_module_roots(project_root) {
9652
9830
  }
9653
9831
 
9654
9832
  // src/scripts/_lib/model_tier.ts
9655
- import fs10 from "node:fs";
9833
+ import fs11 from "node:fs";
9656
9834
  var TIER_TO_CLAUDE_MODEL = {
9657
9835
  high: "opus",
9658
9836
  medium: "sonnet",
@@ -9660,8 +9838,8 @@ var TIER_TO_CLAUDE_MODEL = {
9660
9838
  };
9661
9839
  var MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
9662
9840
  function read_model_tier(skill_md) {
9663
- if (!fs10.existsSync(skill_md)) return null;
9664
- const text = fs10.readFileSync(skill_md).toString("utf-8");
9841
+ if (!fs11.existsSync(skill_md)) return null;
9842
+ const text = fs11.readFileSync(skill_md).toString("utf-8");
9665
9843
  if (!text.startsWith("---\n")) return null;
9666
9844
  const end = text.indexOf("\n---\n", 4);
9667
9845
  if (end === -1) return null;
@@ -9678,8 +9856,8 @@ function render_native_model_md(text, tier) {
9678
9856
 
9679
9857
  // src/scripts/_cli/cmd_migrate.ts
9680
9858
  import { spawnSync } from "node:child_process";
9681
- import * as fs11 from "node:fs";
9682
- import * as path9 from "node:path";
9859
+ import * as fs12 from "node:fs";
9860
+ import * as path10 from "node:path";
9683
9861
  import process2 from "node:process";
9684
9862
  import { fileURLToPath as fileURLToPath2, pathToFileURL } from "node:url";
9685
9863
  var PACKAGE_NAME_NPM = "@event4u/agent-config";
@@ -9699,7 +9877,7 @@ var LEGACY_SETTINGS_FILES = [".agent-settings.yml", ".agent-user.yml"];
9699
9877
  var LEGACY_STATE_FILENAME = ".implement-ticket-state.json";
9700
9878
  var LEGACY_STATE_V1_FILENAME = ".work-state.json";
9701
9879
  var LEGACY_AGENT_CONFIG_SHELL = "agent-config";
9702
- var _HERE_DIR = path9.dirname(fileURLToPath2(import.meta.url));
9880
+ var _HERE_DIR = path10.dirname(fileURLToPath2(import.meta.url));
9703
9881
  var ArgparseExit = class extends Error {
9704
9882
  code;
9705
9883
  constructor(code) {
@@ -9798,38 +9976,38 @@ function _jsonDumpsIndentAscii(value, indent) {
9798
9976
  }
9799
9977
  function _isFile2(p) {
9800
9978
  try {
9801
- return fs11.statSync(p).isFile();
9979
+ return fs12.statSync(p).isFile();
9802
9980
  } catch {
9803
9981
  return false;
9804
9982
  }
9805
9983
  }
9806
9984
  function _isDir2(p) {
9807
9985
  try {
9808
- return fs11.statSync(p).isDirectory();
9986
+ return fs12.statSync(p).isDirectory();
9809
9987
  } catch {
9810
9988
  return false;
9811
9989
  }
9812
9990
  }
9813
9991
  function _isSymlink(p) {
9814
9992
  try {
9815
- return fs11.lstatSync(p).isSymbolicLink();
9993
+ return fs12.lstatSync(p).isSymbolicLink();
9816
9994
  } catch {
9817
9995
  return false;
9818
9996
  }
9819
9997
  }
9820
9998
  function _exists2(p) {
9821
9999
  try {
9822
- fs11.lstatSync(p);
10000
+ fs12.lstatSync(p);
9823
10001
  return true;
9824
10002
  } catch {
9825
10003
  return false;
9826
10004
  }
9827
10005
  }
9828
10006
  function _readText(p) {
9829
- return fs11.readFileSync(p, { encoding: "utf-8" });
10007
+ return fs12.readFileSync(p, { encoding: "utf-8" });
9830
10008
  }
9831
10009
  function _writeText(p, text) {
9832
- fs11.writeFileSync(p, text, { encoding: "utf-8" });
10010
+ fs12.writeFileSync(p, text, { encoding: "utf-8" });
9833
10011
  }
9834
10012
  function _jsonLoadFile(p) {
9835
10013
  return JSON.parse(_readText(p));
@@ -9885,7 +10063,7 @@ function _classify_symlink(link) {
9885
10063
  }
9886
10064
  let target;
9887
10065
  try {
9888
- target = fs11.readlinkSync(link);
10066
+ target = fs12.readlinkSync(link);
9889
10067
  } catch {
9890
10068
  return null;
9891
10069
  }
@@ -9896,16 +10074,16 @@ function _classify_symlink(link) {
9896
10074
  return "user";
9897
10075
  }
9898
10076
  function _detect_legacy_state(project) {
9899
- return _isFile2(path9.join(project, LEGACY_STATE_FILENAME));
10077
+ return _isFile2(path10.join(project, LEGACY_STATE_FILENAME));
9900
10078
  }
9901
10079
  function _detect_legacy_settings(project) {
9902
10080
  const found = [];
9903
10081
  for (const name of LEGACY_SETTINGS_FILES) {
9904
- const flat = path9.join(project, name);
10082
+ const flat = path10.join(project, name);
9905
10083
  if (_isFile2(flat)) {
9906
10084
  found.push(flat);
9907
10085
  }
9908
- const typed = path9.join(project, "settings", name);
10086
+ const typed = path10.join(project, "settings", name);
9909
10087
  if (_isFile2(typed)) {
9910
10088
  found.push(typed);
9911
10089
  }
@@ -9913,25 +10091,25 @@ function _detect_legacy_settings(project) {
9913
10091
  return found;
9914
10092
  }
9915
10093
  function _detect_empty_shell(project) {
9916
- const shell = path9.join(project, LEGACY_AGENT_CONFIG_SHELL);
10094
+ const shell = path10.join(project, LEGACY_AGENT_CONFIG_SHELL);
9917
10095
  if (!_isDir2(shell) || _isSymlink(shell)) {
9918
10096
  return false;
9919
10097
  }
9920
10098
  try {
9921
- return fs11.readdirSync(shell).length === 0;
10099
+ return fs12.readdirSync(shell).length === 0;
9922
10100
  } catch {
9923
10101
  return false;
9924
10102
  }
9925
10103
  }
9926
10104
  function _detect_already_migrated(project) {
9927
- if (_detect_npm(path9.join(project, "package.json"))) {
10105
+ if (_detect_npm(path10.join(project, "package.json"))) {
9928
10106
  return false;
9929
10107
  }
9930
- if (_detect_composer(path9.join(project, "composer.json"))) {
10108
+ if (_detect_composer(path10.join(project, "composer.json"))) {
9931
10109
  return false;
9932
10110
  }
9933
10111
  for (const name of MANAGED_SYMLINKS) {
9934
- if (_classify_symlink(path9.join(project, name)) === "legacy") {
10112
+ if (_classify_symlink(path10.join(project, name)) === "legacy") {
9935
10113
  return false;
9936
10114
  }
9937
10115
  }
@@ -10002,11 +10180,11 @@ function _purge_legacy_symlinks(project) {
10002
10180
  const removed = [];
10003
10181
  const preserved = [];
10004
10182
  for (const name of MANAGED_SYMLINKS) {
10005
- const link = path9.join(project, name);
10183
+ const link = path10.join(project, name);
10006
10184
  const kind = _classify_symlink(link);
10007
10185
  if (kind === "legacy") {
10008
10186
  try {
10009
- fs11.unlinkSync(link);
10187
+ fs12.unlinkSync(link);
10010
10188
  removed.push(name);
10011
10189
  } catch {
10012
10190
  preserved.push(name);
@@ -10018,14 +10196,14 @@ function _purge_legacy_symlinks(project) {
10018
10196
  return [removed, preserved];
10019
10197
  }
10020
10198
  function _migrate_state_file(project) {
10021
- const source = path9.join(project, LEGACY_STATE_FILENAME);
10199
+ const source = path10.join(project, LEGACY_STATE_FILENAME);
10022
10200
  if (!_isFile2(source)) {
10023
10201
  return null;
10024
10202
  }
10025
- const target = path9.join(project, LEGACY_STATE_V1_FILENAME);
10203
+ const target = path10.join(project, LEGACY_STATE_V1_FILENAME);
10026
10204
  if (_exists2(target)) {
10027
10205
  try {
10028
- fs11.unlinkSync(source);
10206
+ fs12.unlinkSync(source);
10029
10207
  return `removed stale ${LEGACY_STATE_FILENAME} (v1 already present)`;
10030
10208
  } catch {
10031
10209
  return null;
@@ -10039,8 +10217,8 @@ function _migrate_state_file(project) {
10039
10217
  return `migrated ${LEGACY_STATE_FILENAME} \u2192 ${LEGACY_STATE_V1_FILENAME}`;
10040
10218
  }
10041
10219
  function _load_state_migrator() {
10042
- const pkg_root = path9.resolve(_HERE_DIR, "..", "..", "..");
10043
- const rel = path9.join(
10220
+ const pkg_root = path10.resolve(_HERE_DIR, "..", "..", "..");
10221
+ const rel = path10.join(
10044
10222
  "agent-src",
10045
10223
  "templates",
10046
10224
  "scripts",
@@ -10048,8 +10226,8 @@ function _load_state_migrator() {
10048
10226
  "migration",
10049
10227
  "v0_to_v1.ts"
10050
10228
  );
10051
- const driver = [path9.join(pkg_root, "dist", rel), path9.join(pkg_root, "src", rel)].find(
10052
- (p) => fs11.existsSync(p)
10229
+ const driver = [path10.join(pkg_root, "dist", rel), path10.join(pkg_root, "src", rel)].find(
10230
+ (p) => fs12.existsSync(p)
10053
10231
  ) ?? null;
10054
10232
  if (driver === null) {
10055
10233
  return null;
@@ -10057,12 +10235,12 @@ function _load_state_migrator() {
10057
10235
  const binName = process2.platform === "win32" ? "tsx.cmd" : "tsx";
10058
10236
  let tsxBin = null;
10059
10237
  for (let dir = pkg_root; ; ) {
10060
- const cand = path9.join(dir, "node_modules", ".bin", binName);
10061
- if (fs11.existsSync(cand)) {
10238
+ const cand = path10.join(dir, "node_modules", ".bin", binName);
10239
+ if (fs12.existsSync(cand)) {
10062
10240
  tsxBin = cand;
10063
10241
  break;
10064
10242
  }
10065
- const parent = path9.dirname(dir);
10243
+ const parent = path10.dirname(dir);
10066
10244
  if (parent === dir) break;
10067
10245
  dir = parent;
10068
10246
  }
@@ -10089,17 +10267,17 @@ function _delete_legacy_settings(project) {
10089
10267
  const removed = [];
10090
10268
  for (const p of _detect_legacy_settings(project)) {
10091
10269
  try {
10092
- fs11.unlinkSync(p);
10093
- removed.push(path9.relative(project, p));
10270
+ fs12.unlinkSync(p);
10271
+ removed.push(path10.relative(project, p));
10094
10272
  } catch {
10095
10273
  continue;
10096
10274
  }
10097
10275
  }
10098
- const settings_dir = path9.join(project, "settings");
10276
+ const settings_dir = path10.join(project, "settings");
10099
10277
  if (_isDir2(settings_dir) && !_isSymlink(settings_dir)) {
10100
10278
  try {
10101
- if (fs11.readdirSync(settings_dir).length === 0) {
10102
- fs11.rmdirSync(settings_dir);
10279
+ if (fs12.readdirSync(settings_dir).length === 0) {
10280
+ fs12.rmdirSync(settings_dir);
10103
10281
  removed.push("settings/");
10104
10282
  }
10105
10283
  } catch {
@@ -10108,12 +10286,12 @@ function _delete_legacy_settings(project) {
10108
10286
  return removed;
10109
10287
  }
10110
10288
  function _remove_empty_shell(project) {
10111
- const shell = path9.join(project, LEGACY_AGENT_CONFIG_SHELL);
10289
+ const shell = path10.join(project, LEGACY_AGENT_CONFIG_SHELL);
10112
10290
  if (!_detect_empty_shell(project)) {
10113
10291
  return false;
10114
10292
  }
10115
10293
  try {
10116
- fs11.rmdirSync(shell);
10294
+ fs12.rmdirSync(shell);
10117
10295
  } catch {
10118
10296
  return false;
10119
10297
  }
@@ -10123,7 +10301,7 @@ function _reEscape(s) {
10123
10301
  return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
10124
10302
  }
10125
10303
  function _update_gitignore(project) {
10126
- const gitignore = path9.join(project, ".gitignore");
10304
+ const gitignore = path10.join(project, ".gitignore");
10127
10305
  const block = `${GITIGNORE_BLOCK_START}
10128
10306
  ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
10129
10307
  `;
@@ -10154,16 +10332,16 @@ ${GITIGNORE_NEW_BODY}${GITIGNORE_BLOCK_END}
10154
10332
  }
10155
10333
  function _build_plan(project) {
10156
10334
  return {
10157
- npm: _detect_npm(path9.join(project, "package.json")),
10158
- composer: _detect_composer(path9.join(project, "composer.json")),
10335
+ npm: _detect_npm(path10.join(project, "package.json")),
10336
+ composer: _detect_composer(path10.join(project, "composer.json")),
10159
10337
  symlinks_legacy: MANAGED_SYMLINKS.filter(
10160
- (name) => _classify_symlink(path9.join(project, name)) === "legacy"
10338
+ (name) => _classify_symlink(path10.join(project, name)) === "legacy"
10161
10339
  ),
10162
10340
  symlinks_user: MANAGED_SYMLINKS.filter(
10163
- (name) => _classify_symlink(path9.join(project, name)) === "user"
10341
+ (name) => _classify_symlink(path10.join(project, name)) === "user"
10164
10342
  ),
10165
- state_file: _isFile2(path9.join(project, LEGACY_STATE_FILENAME)),
10166
- settings_files: _detect_legacy_settings(project).map((p) => path9.relative(project, p)),
10343
+ state_file: _isFile2(path10.join(project, LEGACY_STATE_FILENAME)),
10344
+ settings_files: _detect_legacy_settings(project).map((p) => path10.relative(project, p)),
10167
10345
  empty_shell: _detect_empty_shell(project)
10168
10346
  };
10169
10347
  }
@@ -10227,10 +10405,10 @@ function _warn_on_major_mismatch(from_major, plan, out) {
10227
10405
  }
10228
10406
  function _apply(project, out, err) {
10229
10407
  const summary = [];
10230
- if (_strip_npm_entry(path9.join(project, "package.json"))) {
10408
+ if (_strip_npm_entry(path10.join(project, "package.json"))) {
10231
10409
  summary.push(`removed ${PACKAGE_NAME_NPM} from package.json`);
10232
10410
  }
10233
- if (_strip_composer_entry(path9.join(project, "composer.json"))) {
10411
+ if (_strip_composer_entry(path10.join(project, "composer.json"))) {
10234
10412
  summary.push(`removed ${PACKAGE_NAME_COMPOSER} from composer.json`);
10235
10413
  }
10236
10414
  const [removed_links, preserved_links] = _purge_legacy_symlinks(project);
@@ -10356,13 +10534,13 @@ function _isCliEntry() {
10356
10534
  if (process2.argv[1] === void 0) {
10357
10535
  return false;
10358
10536
  }
10359
- const argvUrl = pathToFileURL(path9.resolve(process2.argv[1])).href;
10537
+ const argvUrl = pathToFileURL(path10.resolve(process2.argv[1])).href;
10360
10538
  if (import.meta.url === argvUrl) {
10361
10539
  return true;
10362
10540
  }
10363
10541
  try {
10364
- const here = fs11.realpathSync(fileURLToPath2(import.meta.url));
10365
- const argv = fs11.realpathSync(path9.resolve(process2.argv[1]));
10542
+ const here = fs12.realpathSync(fileURLToPath2(import.meta.url));
10543
+ const argv = fs12.realpathSync(path10.resolve(process2.argv[1]));
10366
10544
  return here === argv;
10367
10545
  } catch {
10368
10546
  return false;
@@ -10399,34 +10577,34 @@ var ArgparseExit2 = class extends Error {
10399
10577
  function expanduser5(p) {
10400
10578
  if (p === "~") return os6.homedir();
10401
10579
  if (p.startsWith("~/") || p.startsWith("~\\")) {
10402
- return path10.join(os6.homedir(), p.slice(2));
10580
+ return path11.join(os6.homedir(), p.slice(2));
10403
10581
  }
10404
10582
  return p;
10405
10583
  }
10406
10584
  function resolvePath(p) {
10407
10585
  try {
10408
- return fs12.realpathSync(path10.resolve(p));
10586
+ return fs13.realpathSync(path11.resolve(p));
10409
10587
  } catch {
10410
- return path10.resolve(p);
10588
+ return path11.resolve(p);
10411
10589
  }
10412
10590
  }
10413
10591
  function isFile(p) {
10414
10592
  try {
10415
- return fs12.statSync(p).isFile();
10593
+ return fs13.statSync(p).isFile();
10416
10594
  } catch {
10417
10595
  return false;
10418
10596
  }
10419
10597
  }
10420
10598
  function isDir(p) {
10421
10599
  try {
10422
- return fs12.statSync(p).isDirectory();
10600
+ return fs13.statSync(p).isDirectory();
10423
10601
  } catch {
10424
10602
  return false;
10425
10603
  }
10426
10604
  }
10427
10605
  function pathExists(p) {
10428
10606
  try {
10429
- fs12.statSync(p);
10607
+ fs13.statSync(p);
10430
10608
  return true;
10431
10609
  } catch {
10432
10610
  return false;
@@ -10434,24 +10612,24 @@ function pathExists(p) {
10434
10612
  }
10435
10613
  function isSymlink(p) {
10436
10614
  try {
10437
- return fs12.lstatSync(p).isSymbolicLink();
10615
+ return fs13.lstatSync(p).isSymbolicLink();
10438
10616
  } catch {
10439
10617
  return false;
10440
10618
  }
10441
10619
  }
10442
10620
  function readText(p) {
10443
- return fs12.readFileSync(p, "utf-8");
10621
+ return fs13.readFileSync(p, "utf-8");
10444
10622
  }
10445
10623
  function writeText(p, content) {
10446
- fs12.writeFileSync(p, content, "utf-8");
10624
+ fs13.writeFileSync(p, content, "utf-8");
10447
10625
  }
10448
10626
  function mkdirp(p) {
10449
- fs12.mkdirSync(p, { recursive: true });
10627
+ fs13.mkdirSync(p, { recursive: true });
10450
10628
  }
10451
10629
  function sortedGlobStems(directory, suffix) {
10452
10630
  let entries;
10453
10631
  try {
10454
- entries = fs12.readdirSync(directory);
10632
+ entries = fs13.readdirSync(directory);
10455
10633
  } catch {
10456
10634
  return [];
10457
10635
  }
@@ -10471,7 +10649,7 @@ function sortedGlobStems(directory, suffix) {
10471
10649
  function countZips(directory) {
10472
10650
  if (!isDir(directory)) return 0;
10473
10651
  let n = 0;
10474
- for (const name of fs12.readdirSync(directory)) {
10652
+ for (const name of fs13.readdirSync(directory)) {
10475
10653
  if (name.endsWith(".zip")) n += 1;
10476
10654
  }
10477
10655
  return n;
@@ -10479,35 +10657,35 @@ function countZips(directory) {
10479
10657
  function sha256OfFile(p) {
10480
10658
  let data;
10481
10659
  try {
10482
- data = fs12.readFileSync(p);
10660
+ data = fs13.readFileSync(p);
10483
10661
  } catch {
10484
10662
  return null;
10485
10663
  }
10486
10664
  return crypto2.createHash("sha256").update(data).digest("hex");
10487
10665
  }
10488
10666
  function atomicWrite0644(target, body, prefix) {
10489
- const dir = path10.dirname(target);
10490
- const tmpName = path10.join(
10667
+ const dir = path11.dirname(target);
10668
+ const tmpName = path11.join(
10491
10669
  dir,
10492
10670
  `${prefix}${process3.pid}.${crypto2.randomBytes(6).toString("hex")}.yml.tmp`
10493
10671
  );
10494
10672
  let fd = null;
10495
10673
  try {
10496
- fd = fs12.openSync(tmpName, "wx", 420);
10497
- fs12.writeFileSync(fd, body, "utf-8");
10498
- fs12.closeSync(fd);
10674
+ fd = fs13.openSync(tmpName, "wx", 420);
10675
+ fs13.writeFileSync(fd, body, "utf-8");
10676
+ fs13.closeSync(fd);
10499
10677
  fd = null;
10500
- fs12.chmodSync(tmpName, 420);
10501
- fs12.renameSync(tmpName, target);
10678
+ fs13.chmodSync(tmpName, 420);
10679
+ fs13.renameSync(tmpName, target);
10502
10680
  } catch (err) {
10503
10681
  if (fd !== null) {
10504
10682
  try {
10505
- fs12.closeSync(fd);
10683
+ fs13.closeSync(fd);
10506
10684
  } catch {
10507
10685
  }
10508
10686
  }
10509
10687
  try {
10510
- fs12.unlinkSync(tmpName);
10688
+ fs13.unlinkSync(tmpName);
10511
10689
  } catch {
10512
10690
  }
10513
10691
  throw err;
@@ -10617,12 +10795,12 @@ var LEGACY_SETTINGS_FILE = ".agent-settings";
10617
10795
  var LEGACY_BACKUP_FILE = ".agent-settings.backup.key-value";
10618
10796
  var SETTINGS_SUBDIR = ["agents", "settings"];
10619
10797
  function _canonical_settings_target(project_root) {
10620
- return path10.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
10798
+ return path11.join(project_root, ...SETTINGS_SUBDIR, SETTINGS_FILE);
10621
10799
  }
10622
10800
  function _resolve_settings_read(project_root) {
10623
10801
  const canonical = _canonical_settings_target(project_root);
10624
10802
  if (pathExists(canonical)) return canonical;
10625
- const legacy = path10.join(project_root, SETTINGS_FILE);
10803
+ const legacy = path11.join(project_root, SETTINGS_FILE);
10626
10804
  if (pathExists(legacy)) return legacy;
10627
10805
  return canonical;
10628
10806
  }
@@ -10686,9 +10864,9 @@ function fail(msg) {
10686
10864
  throw new SystemExitError(1);
10687
10865
  }
10688
10866
  function detect_package_root(project_root) {
10689
- const npm_path = path10.join(project_root, "node_modules", "@event4u", "agent-config");
10867
+ const npm_path = path11.join(project_root, "node_modules", "@event4u", "agent-config");
10690
10868
  if (isDir(npm_path)) return resolvePath(npm_path);
10691
- if (pathExists(path10.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
10869
+ if (pathExists(path11.join(project_root, "src", "config", "profiles", "minimal.ini"))) {
10692
10870
  return project_root;
10693
10871
  }
10694
10872
  fail(
@@ -10696,12 +10874,12 @@ function detect_package_root(project_root) {
10696
10874
  );
10697
10875
  }
10698
10876
  function detect_package_type(package_root) {
10699
- if (package_root.split(path10.sep).includes("node_modules")) return "npm";
10877
+ if (package_root.split(path11.sep).includes("node_modules")) return "npm";
10700
10878
  return "local";
10701
10879
  }
10702
10880
  function detect_package_type_for_project(project_root, package_root) {
10703
10881
  const npm_path = resolvePath(
10704
- path10.join(project_root, "node_modules", "@event4u", "agent-config")
10882
+ path11.join(project_root, "node_modules", "@event4u", "agent-config")
10705
10883
  );
10706
10884
  const package_resolved = resolvePath(package_root);
10707
10885
  if (package_resolved === npm_path) return "npm";
@@ -10721,7 +10899,7 @@ function ensure_directory(p) {
10721
10899
  mkdirp(p);
10722
10900
  }
10723
10901
  function write_file(p, content) {
10724
- ensure_directory(path10.dirname(p));
10902
+ ensure_directory(path11.dirname(p));
10725
10903
  writeText(p, content);
10726
10904
  }
10727
10905
  function read_json_file(p) {
@@ -10892,7 +11070,7 @@ function _append_unknown_legacy(rendered, legacy_values, unknown_keys) {
10892
11070
  return rendered + "\n" + suffix;
10893
11071
  }
10894
11072
  function _migrate_legacy_if_present(project_root, template_body) {
10895
- const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
11073
+ const legacy_target = path11.join(project_root, LEGACY_SETTINGS_FILE);
10896
11074
  if (!isFile(legacy_target)) return null;
10897
11075
  const legacy_text = readText(legacy_target);
10898
11076
  const [values, unknown] = _parse_legacy_settings(legacy_text);
@@ -10907,9 +11085,9 @@ function _migrate_legacy_if_present(project_root, template_body) {
10907
11085
  }
10908
11086
  }
10909
11087
  rendered = _append_unknown_legacy(rendered, values, unknown);
10910
- const backup_target = path10.join(project_root, LEGACY_BACKUP_FILE);
11088
+ const backup_target = path11.join(project_root, LEGACY_BACKUP_FILE);
10911
11089
  writeText(backup_target, legacy_text);
10912
- fs12.unlinkSync(legacy_target);
11090
+ fs13.unlinkSync(legacy_target);
10913
11091
  info(`Migrated legacy ${LEGACY_SETTINGS_FILE} \u2192 ${SETTINGS_FILE}`);
10914
11092
  info(`Backup saved to ${LEGACY_BACKUP_FILE}`);
10915
11093
  if (unknown.length > 0) {
@@ -10944,7 +11122,7 @@ function _render_template(template, profile_values) {
10944
11122
  return body;
10945
11123
  }
10946
11124
  function _load_valid_user_types(package_root) {
10947
- const directory = path10.join(package_root, USER_TYPES_DIR);
11125
+ const directory = path11.join(package_root, USER_TYPES_DIR);
10948
11126
  if (!isDir(directory)) return [];
10949
11127
  return sortedGlobStems(directory, ".yml");
10950
11128
  }
@@ -11001,8 +11179,8 @@ function splitlinesKeepends(text) {
11001
11179
  }
11002
11180
  function ensure_agent_settings(project_root, package_root, profile, force, user_type = "", packs = null) {
11003
11181
  const target = _canonical_settings_target(project_root);
11004
- const profile_source = path10.join(package_root, "src", "config", "profiles", `${profile}.ini`);
11005
- const template_source = path10.join(package_root, "src", "config", "agent-settings.template.yml");
11182
+ const profile_source = path11.join(package_root, "src", "config", "profiles", `${profile}.ini`);
11183
+ const template_source = path11.join(package_root, "src", "config", "agent-settings.template.yml");
11006
11184
  if (!pathExists(profile_source)) fail(`Missing profile preset: ${profile_source}`);
11007
11185
  if (!pathExists(template_source)) fail(`Missing settings template: ${template_source}`);
11008
11186
  const template = readText(template_source);
@@ -11016,21 +11194,21 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
11016
11194
  if (profile_values["rule_loading_tier"] !== profile) {
11017
11195
  const got = "rule_loading_tier" in profile_values ? `'${profile_values["rule_loading_tier"]}'` : "None";
11018
11196
  fail(
11019
- `Profile preset ${path10.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
11197
+ `Profile preset ${path11.basename(profile_source)} has rule_loading_tier=${got} but --profile=${profile}`
11020
11198
  );
11021
11199
  }
11022
11200
  profile_values["user_type"] = _validate_user_type(package_root, user_type);
11023
11201
  let template_body = _render_template(template, profile_values);
11024
11202
  template_body = _inject_packs(template_body, packs ?? []);
11025
- const legacy_root = path10.join(project_root, SETTINGS_FILE);
11203
+ const legacy_root = path11.join(project_root, SETTINGS_FILE);
11026
11204
  if (isFile(legacy_root) && !pathExists(target)) {
11027
- mkdirp(path10.dirname(target));
11205
+ mkdirp(path11.dirname(target));
11028
11206
  writeText(target, readText(legacy_root));
11029
- fs12.unlinkSync(legacy_root);
11207
+ fs13.unlinkSync(legacy_root);
11030
11208
  success(`Migrated ${SETTINGS_FILE} \u2192 agents/settings/${SETTINGS_FILE} (ADR-038)`);
11031
11209
  return;
11032
11210
  }
11033
- const legacy_target = path10.join(project_root, LEGACY_SETTINGS_FILE);
11211
+ const legacy_target = path11.join(project_root, LEGACY_SETTINGS_FILE);
11034
11212
  if (isFile(legacy_target) && pathExists(target)) {
11035
11213
  warn(
11036
11214
  `Both ${SETTINGS_FILE} and legacy ${LEGACY_SETTINGS_FILE} exist. Skipping migration to avoid overwriting ${SETTINGS_FILE}. Delete one of them manually and re-run.`
@@ -11047,7 +11225,7 @@ function ensure_agent_settings(project_root, package_root, profile, force, user_
11047
11225
  skip(`${SETTINGS_FILE} already exists`);
11048
11226
  return;
11049
11227
  }
11050
- mkdirp(path10.dirname(target));
11228
+ mkdirp(path11.dirname(target));
11051
11229
  write_file(target, template_body);
11052
11230
  const user_type_value = profile_values["user_type"] ?? "";
11053
11231
  const suffix = user_type_value ? `, user_type=${user_type_value}` : "";
@@ -11060,7 +11238,7 @@ function ensure_vscode_bridge(project_root, package_type, force) {
11060
11238
  const plugin_path = plugin_paths[package_type] ?? "./plugin/agent-config";
11061
11239
  const bridge = { "chat.pluginLocations": { [plugin_path]: true } };
11062
11240
  merge_json_file(
11063
- path10.join(project_root, ".vscode", "settings.json"),
11241
+ path11.join(project_root, ".vscode", "settings.json"),
11064
11242
  bridge,
11065
11243
  force,
11066
11244
  ".vscode/settings.json"
@@ -11069,14 +11247,14 @@ function ensure_vscode_bridge(project_root, package_type, force) {
11069
11247
  function ensure_augment_bridge(project_root, force) {
11070
11248
  const bridge = { enabledPlugins: { "agent-config@event4u": true } };
11071
11249
  return merge_json_file(
11072
- path10.join(project_root, ".augment", "settings.json"),
11250
+ path11.join(project_root, ".augment", "settings.json"),
11073
11251
  bridge,
11074
11252
  force,
11075
11253
  ".augment/settings.json"
11076
11254
  );
11077
11255
  }
11078
- var AUGMENT_USER_DIR = path10.join(os6.homedir(), ".augment");
11079
- var AUGMENT_USER_HOOKS_DIR = path10.join(AUGMENT_USER_DIR, "hooks");
11256
+ var AUGMENT_USER_DIR = path11.join(os6.homedir(), ".augment");
11257
+ var AUGMENT_USER_HOOKS_DIR = path11.join(AUGMENT_USER_DIR, "hooks");
11080
11258
  var AUGMENT_DISPATCHER_TRAMPOLINE = "augment-dispatcher.sh";
11081
11259
  var AUGMENT_LEGACY_TRAMPOLINES = [
11082
11260
  "augment-chat-history.sh",
@@ -11092,29 +11270,29 @@ var AUGMENT_DISPATCHER_BINDINGS = [
11092
11270
  ["post_tool_use", "PostToolUse"]
11093
11271
  ];
11094
11272
  function _deploy_augment_trampoline(package_root, name, force) {
11095
- const src = path10.join(package_root, "scripts", "hooks", name);
11273
+ const src = path11.join(package_root, "scripts", "hooks", name);
11096
11274
  if (!pathExists(src)) {
11097
11275
  skip(`augment trampoline missing in package: ${src}`);
11098
11276
  return null;
11099
11277
  }
11100
11278
  mkdirp(AUGMENT_USER_HOOKS_DIR);
11101
- const dst = path10.join(AUGMENT_USER_HOOKS_DIR, name);
11279
+ const dst = path11.join(AUGMENT_USER_HOOKS_DIR, name);
11102
11280
  const src_text = readText(src);
11103
11281
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11104
11282
  skip(`~/.augment/hooks/${name} already up to date`);
11105
11283
  } else {
11106
11284
  writeText(dst, src_text);
11107
- fs12.chmodSync(dst, 493);
11285
+ fs13.chmodSync(dst, 493);
11108
11286
  success(`~/.augment/hooks/${name} installed`);
11109
11287
  }
11110
11288
  return dst;
11111
11289
  }
11112
11290
  function _remove_legacy_augment_trampolines() {
11113
11291
  for (const name of AUGMENT_LEGACY_TRAMPOLINES) {
11114
- const legacy = path10.join(AUGMENT_USER_HOOKS_DIR, name);
11292
+ const legacy = path11.join(AUGMENT_USER_HOOKS_DIR, name);
11115
11293
  try {
11116
11294
  if (isFile(legacy)) {
11117
- fs12.unlinkSync(legacy);
11295
+ fs13.unlinkSync(legacy);
11118
11296
  skip(`removed legacy ~/.augment/hooks/${name}`);
11119
11297
  }
11120
11298
  } catch {
@@ -11133,7 +11311,7 @@ function ensure_augment_user_hooks(package_root, force) {
11133
11311
  }
11134
11312
  const settings_patch = { hooks: per_event };
11135
11313
  return merge_json_file(
11136
- path10.join(AUGMENT_USER_DIR, "settings.json"),
11314
+ path11.join(AUGMENT_USER_DIR, "settings.json"),
11137
11315
  settings_patch,
11138
11316
  force,
11139
11317
  "~/.augment/settings.json"
@@ -11158,7 +11336,7 @@ function _heal_legacy_claude_plugin_ids(p) {
11158
11336
  return removed;
11159
11337
  }
11160
11338
  function ensure_claude_bridge(project_root, force) {
11161
- const target = path10.join(project_root, ".claude", "settings.json");
11339
+ const target = path11.join(project_root, ".claude", "settings.json");
11162
11340
  const healed = _heal_legacy_claude_plugin_ids(target);
11163
11341
  for (const pid of healed) {
11164
11342
  success(`.claude/settings.json: removed stale plugin id \`${pid}\``);
@@ -11183,29 +11361,29 @@ function ensure_cursor_bridge(project_root, force) {
11183
11361
  }
11184
11362
  const bridge = { version: 1, hooks };
11185
11363
  return merge_json_file(
11186
- path10.join(project_root, ".cursor", "hooks.json"),
11364
+ path11.join(project_root, ".cursor", "hooks.json"),
11187
11365
  bridge,
11188
11366
  force,
11189
11367
  ".cursor/hooks.json"
11190
11368
  );
11191
11369
  }
11192
- var CURSOR_USER_DIR = path10.join(os6.homedir(), ".cursor");
11193
- var CURSOR_USER_HOOKS_DIR = path10.join(CURSOR_USER_DIR, "hooks");
11370
+ var CURSOR_USER_DIR = path11.join(os6.homedir(), ".cursor");
11371
+ var CURSOR_USER_HOOKS_DIR = path11.join(CURSOR_USER_DIR, "hooks");
11194
11372
  var CURSOR_DISPATCHER_TRAMPOLINE = "cursor-dispatcher.sh";
11195
11373
  function ensure_cursor_user_hooks(package_root, force) {
11196
- const src = path10.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
11374
+ const src = path11.join(package_root, "scripts", "hooks", CURSOR_DISPATCHER_TRAMPOLINE);
11197
11375
  if (!pathExists(src)) {
11198
11376
  skip(`cursor trampoline missing in package: ${src}`);
11199
11377
  return [];
11200
11378
  }
11201
11379
  mkdirp(CURSOR_USER_HOOKS_DIR);
11202
- const dst = path10.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
11380
+ const dst = path11.join(CURSOR_USER_HOOKS_DIR, CURSOR_DISPATCHER_TRAMPOLINE);
11203
11381
  const src_text = readText(src);
11204
11382
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11205
11383
  skip(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} already up to date`);
11206
11384
  } else {
11207
11385
  writeText(dst, src_text);
11208
- fs12.chmodSync(dst, 493);
11386
+ fs13.chmodSync(dst, 493);
11209
11387
  success(`~/.cursor/hooks/${CURSOR_DISPATCHER_TRAMPOLINE} installed`);
11210
11388
  }
11211
11389
  const hooks = {};
@@ -11214,7 +11392,7 @@ function ensure_cursor_user_hooks(package_root, force) {
11214
11392
  }
11215
11393
  const settings_patch = { version: 1, hooks };
11216
11394
  return merge_json_file(
11217
- path10.join(CURSOR_USER_DIR, "hooks.json"),
11395
+ path11.join(CURSOR_USER_DIR, "hooks.json"),
11218
11396
  settings_patch,
11219
11397
  force,
11220
11398
  "~/.cursor/hooks.json"
@@ -11257,12 +11435,12 @@ exit 0
11257
11435
  `;
11258
11436
  }
11259
11437
  function ensure_cline_bridge(project_root, force) {
11260
- const hooks_dir = path10.join(project_root, ".clinerules", "hooks");
11438
+ const hooks_dir = path11.join(project_root, ".clinerules", "hooks");
11261
11439
  mkdirp(hooks_dir);
11262
11440
  const workspace_quoted = shlexQuote(resolvePath(project_root));
11263
11441
  let written = 0;
11264
11442
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
11265
- const target = path10.join(hooks_dir, native_event);
11443
+ const target = path11.join(hooks_dir, native_event);
11266
11444
  const body = clineProjectHookBody(native_event, ac_event, workspace_quoted);
11267
11445
  if (pathExists(target) && readText(target) === body && !force) {
11268
11446
  continue;
@@ -11272,7 +11450,7 @@ function ensure_cline_bridge(project_root, force) {
11272
11450
  continue;
11273
11451
  }
11274
11452
  writeText(target, body);
11275
- fs12.chmodSync(target, 493);
11453
+ fs13.chmodSync(target, 493);
11276
11454
  written += 1;
11277
11455
  }
11278
11456
  if (written) {
@@ -11281,27 +11459,27 @@ function ensure_cline_bridge(project_root, force) {
11281
11459
  skip(".clinerules/hooks/ already up to date");
11282
11460
  }
11283
11461
  }
11284
- var CLINE_USER_DIR = path10.join(os6.homedir(), "Documents", "Cline", "Hooks");
11462
+ var CLINE_USER_DIR = path11.join(os6.homedir(), "Documents", "Cline", "Hooks");
11285
11463
  var CLINE_DISPATCHER_TRAMPOLINE = "cline-dispatcher.sh";
11286
11464
  function ensure_cline_user_hooks(package_root, force) {
11287
- const src = path10.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
11465
+ const src = path11.join(package_root, "scripts", "hooks", CLINE_DISPATCHER_TRAMPOLINE);
11288
11466
  if (!pathExists(src)) {
11289
11467
  skip(`cline trampoline missing in package: ${src}`);
11290
11468
  return;
11291
11469
  }
11292
11470
  mkdirp(CLINE_USER_DIR);
11293
- const trampoline = path10.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
11471
+ const trampoline = path11.join(CLINE_USER_DIR, CLINE_DISPATCHER_TRAMPOLINE);
11294
11472
  const src_text = readText(src);
11295
11473
  if (pathExists(trampoline) && readText(trampoline) === src_text && !force) {
11296
11474
  skip(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} already up to date`);
11297
11475
  } else {
11298
11476
  writeText(trampoline, src_text);
11299
- fs12.chmodSync(trampoline, 493);
11477
+ fs13.chmodSync(trampoline, 493);
11300
11478
  success(`~/Documents/Cline/Hooks/${CLINE_DISPATCHER_TRAMPOLINE} installed`);
11301
11479
  }
11302
11480
  const trampoline_quoted = shlexQuote(trampoline);
11303
11481
  for (const [ac_event, native_event] of CLINE_DISPATCHER_BINDINGS) {
11304
- const wrapper = path10.join(CLINE_USER_DIR, native_event);
11482
+ const wrapper = path11.join(CLINE_USER_DIR, native_event);
11305
11483
  const body = `#!/usr/bin/env bash
11306
11484
  # Generated by event4u/agent-config install.py \u2014 DO NOT EDIT.
11307
11485
  # User-scope Cline hook for ${native_event} \u2192 agent-config ${ac_event}.
@@ -11311,7 +11489,7 @@ exec ${trampoline_quoted} ${ac_event} ${native_event}
11311
11489
  continue;
11312
11490
  }
11313
11491
  writeText(wrapper, body);
11314
- fs12.chmodSync(wrapper, 493);
11492
+ fs13.chmodSync(wrapper, 493);
11315
11493
  }
11316
11494
  }
11317
11495
  var WINDSURF_DISPATCHER_BINDINGS = [
@@ -11332,29 +11510,29 @@ function ensure_windsurf_bridge(project_root, force) {
11332
11510
  }
11333
11511
  const bridge = { hooks };
11334
11512
  return merge_json_file(
11335
- path10.join(project_root, ".windsurf", "hooks.json"),
11513
+ path11.join(project_root, ".windsurf", "hooks.json"),
11336
11514
  bridge,
11337
11515
  force,
11338
11516
  ".windsurf/hooks.json"
11339
11517
  );
11340
11518
  }
11341
- var WINDSURF_USER_DIR = path10.join(os6.homedir(), ".codeium", "windsurf");
11342
- var WINDSURF_USER_HOOKS_DIR = path10.join(WINDSURF_USER_DIR, "hooks");
11519
+ var WINDSURF_USER_DIR = path11.join(os6.homedir(), ".codeium", "windsurf");
11520
+ var WINDSURF_USER_HOOKS_DIR = path11.join(WINDSURF_USER_DIR, "hooks");
11343
11521
  var WINDSURF_DISPATCHER_TRAMPOLINE = "windsurf-dispatcher.sh";
11344
11522
  function ensure_windsurf_user_hooks(package_root, force) {
11345
- const src = path10.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
11523
+ const src = path11.join(package_root, "scripts", "hooks", WINDSURF_DISPATCHER_TRAMPOLINE);
11346
11524
  if (!pathExists(src)) {
11347
11525
  skip(`windsurf trampoline missing in package: ${src}`);
11348
11526
  return [];
11349
11527
  }
11350
11528
  mkdirp(WINDSURF_USER_HOOKS_DIR);
11351
- const dst = path10.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
11529
+ const dst = path11.join(WINDSURF_USER_HOOKS_DIR, WINDSURF_DISPATCHER_TRAMPOLINE);
11352
11530
  const src_text = readText(src);
11353
11531
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11354
11532
  skip(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} already up to date`);
11355
11533
  } else {
11356
11534
  writeText(dst, src_text);
11357
- fs12.chmodSync(dst, 493);
11535
+ fs13.chmodSync(dst, 493);
11358
11536
  success(`~/.codeium/windsurf/hooks/${WINDSURF_DISPATCHER_TRAMPOLINE} installed`);
11359
11537
  }
11360
11538
  const hooks = {};
@@ -11366,7 +11544,7 @@ function ensure_windsurf_user_hooks(package_root, force) {
11366
11544
  }
11367
11545
  const settings_patch = { hooks };
11368
11546
  return merge_json_file(
11369
- path10.join(WINDSURF_USER_DIR, "hooks.json"),
11547
+ path11.join(WINDSURF_USER_DIR, "hooks.json"),
11370
11548
  settings_patch,
11371
11549
  force,
11372
11550
  "~/.codeium/windsurf/hooks.json"
@@ -11395,43 +11573,43 @@ function _gemini_hooks_dict(command_factory) {
11395
11573
  function ensure_gemini_bridge(project_root, force) {
11396
11574
  const bridge = { hooks: _gemini_hooks_dict(_gemini_dispatch_command) };
11397
11575
  return merge_json_file(
11398
- path10.join(project_root, ".gemini", "settings.json"),
11576
+ path11.join(project_root, ".gemini", "settings.json"),
11399
11577
  bridge,
11400
11578
  force,
11401
11579
  ".gemini/settings.json"
11402
11580
  );
11403
11581
  }
11404
- var GEMINI_USER_DIR = path10.join(os6.homedir(), ".gemini");
11405
- var GEMINI_USER_HOOKS_DIR = path10.join(GEMINI_USER_DIR, "hooks");
11582
+ var GEMINI_USER_DIR = path11.join(os6.homedir(), ".gemini");
11583
+ var GEMINI_USER_HOOKS_DIR = path11.join(GEMINI_USER_DIR, "hooks");
11406
11584
  var GEMINI_DISPATCHER_TRAMPOLINE = "gemini-dispatcher.sh";
11407
11585
  function ensure_gemini_user_hooks(package_root, force) {
11408
- const src = path10.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
11586
+ const src = path11.join(package_root, "scripts", "hooks", GEMINI_DISPATCHER_TRAMPOLINE);
11409
11587
  if (!pathExists(src)) {
11410
11588
  skip(`gemini trampoline missing in package: ${src}`);
11411
11589
  return [];
11412
11590
  }
11413
11591
  mkdirp(GEMINI_USER_HOOKS_DIR);
11414
- const dst = path10.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
11592
+ const dst = path11.join(GEMINI_USER_HOOKS_DIR, GEMINI_DISPATCHER_TRAMPOLINE);
11415
11593
  const src_text = readText(src);
11416
11594
  if (pathExists(dst) && readText(dst) === src_text && !force) {
11417
11595
  skip(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} already up to date`);
11418
11596
  } else {
11419
11597
  writeText(dst, src_text);
11420
- fs12.chmodSync(dst, 493);
11598
+ fs13.chmodSync(dst, 493);
11421
11599
  success(`~/.gemini/hooks/${GEMINI_DISPATCHER_TRAMPOLINE} installed`);
11422
11600
  }
11423
11601
  const settings_patch = {
11424
11602
  hooks: _gemini_hooks_dict((ac_event, native) => `${dst} ${ac_event} ${native}`)
11425
11603
  };
11426
11604
  return merge_json_file(
11427
- path10.join(GEMINI_USER_DIR, "settings.json"),
11605
+ path11.join(GEMINI_USER_DIR, "settings.json"),
11428
11606
  settings_patch,
11429
11607
  force,
11430
11608
  "~/.gemini/settings.json"
11431
11609
  );
11432
11610
  }
11433
11611
  function ensure_copilot_bridge(project_root, force) {
11434
- const target = path10.join(project_root, ".github", "plugin", "marketplace.json");
11612
+ const target = path11.join(project_root, ".github", "plugin", "marketplace.json");
11435
11613
  const bridge = {
11436
11614
  marketplace: {
11437
11615
  name: "event4u-agent-marketplace",
@@ -11474,7 +11652,7 @@ See \`docs/setup/per-ide/roocode.md\` for the full activation guide.
11474
11652
  Run \`./agent-config --help\` for available commands.
11475
11653
  `;
11476
11654
  function ensure_roocode_bridge(project_root, force) {
11477
- const target = path10.join(project_root, ".roo", "rules", "agent-config.md");
11655
+ const target = path11.join(project_root, ".roo", "rules", "agent-config.md");
11478
11656
  if (pathExists(target) && !force) {
11479
11657
  skip(".roo/rules/agent-config.md already exists");
11480
11658
  return;
@@ -11496,7 +11674,7 @@ To wire Claude Desktop to this project's rules, run:
11496
11674
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11497
11675
  `;
11498
11676
  function ensure_claude_desktop_bridge(project_root, force) {
11499
- const target = path10.join(project_root, ".claude-desktop", "agent-config.md");
11677
+ const target = path11.join(project_root, ".claude-desktop", "agent-config.md");
11500
11678
  if (pathExists(target) && !force) {
11501
11679
  skip(".claude-desktop/agent-config.md already exists");
11502
11680
  return;
@@ -11521,7 +11699,7 @@ Or pass \`--read .aider/agent-config.md\` on the command line.
11521
11699
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11522
11700
  `;
11523
11701
  function ensure_aider_bridge(project_root, force) {
11524
- const target = path10.join(project_root, ".aider", "agent-config.md");
11702
+ const target = path11.join(project_root, ".aider", "agent-config.md");
11525
11703
  if (pathExists(target) && !force) {
11526
11704
  skip(".aider/agent-config.md already exists");
11527
11705
  return;
@@ -11540,7 +11718,7 @@ developers where the rules and skills live.
11540
11718
  Canonical rule and skill source: \`.augment/\` (see project \`AGENTS.md\`).
11541
11719
  `;
11542
11720
  function ensure_codex_bridge(project_root, force) {
11543
- const target = path10.join(project_root, ".codex", "agent-config.md");
11721
+ const target = path11.join(project_root, ".codex", "agent-config.md");
11544
11722
  if (pathExists(target) && !force) {
11545
11723
  skip(".codex/agent-config.md already exists");
11546
11724
  return;
@@ -11558,7 +11736,7 @@ rules per session. The canonical rule and skill source lives under
11558
11736
  orientation).
11559
11737
  `;
11560
11738
  function ensure_continue_bridge(project_root, force) {
11561
- const target = path10.join(project_root, ".continue", "rules", "agent-config.md");
11739
+ const target = path11.join(project_root, ".continue", "rules", "agent-config.md");
11562
11740
  if (pathExists(target) && !force) {
11563
11741
  skip(".continue/rules/agent-config.md already exists");
11564
11742
  return;
@@ -11589,7 +11767,7 @@ orientation).
11589
11767
  See \`docs/setup/per-ide/kilocode.md\` for the full activation guide.
11590
11768
  `;
11591
11769
  function ensure_kilocode_bridge(project_root, force) {
11592
- const target = path10.join(project_root, ".kilocode", "rules", "agent-config.md");
11770
+ const target = path11.join(project_root, ".kilocode", "rules", "agent-config.md");
11593
11771
  if (pathExists(target) && !force) {
11594
11772
  skip(".kilocode/rules/agent-config.md already exists");
11595
11773
  return;
@@ -11616,7 +11794,7 @@ canonical source (or symlink it):
11616
11794
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11617
11795
  `;
11618
11796
  function ensure_zed_bridge(project_root, force) {
11619
- const target = path10.join(project_root, ".zed", "agent-config.md");
11797
+ const target = path11.join(project_root, ".zed", "agent-config.md");
11620
11798
  if (pathExists(target) && !force) {
11621
11799
  skip(".zed/agent-config.md already exists");
11622
11800
  return;
@@ -11637,7 +11815,7 @@ rules into your JetBrains profile.
11637
11815
  Canonical rule and skill source: \`.augment/\` (see \`AGENTS.md\`).
11638
11816
  `;
11639
11817
  function ensure_jetbrains_bridge(project_root, force) {
11640
- const target = path10.join(project_root, ".jetbrains", "agent-config.md");
11818
+ const target = path11.join(project_root, ".jetbrains", "agent-config.md");
11641
11819
  if (pathExists(target) && !force) {
11642
11820
  skip(".jetbrains/agent-config.md already exists");
11643
11821
  return;
@@ -11668,7 +11846,7 @@ session. The canonical rule and skill source lives under \`.augment/\`
11668
11846
  See \`docs/setup/per-ide/kiro.md\` for the full activation guide.
11669
11847
  `;
11670
11848
  function ensure_kiro_bridge(project_root, force) {
11671
- const target = path10.join(project_root, ".kiro", "steering", "agent-config.md");
11849
+ const target = path11.join(project_root, ".kiro", "steering", "agent-config.md");
11672
11850
  if (pathExists(target) && !force) {
11673
11851
  skip(".kiro/steering/agent-config.md already exists");
11674
11852
  return;
@@ -11694,35 +11872,35 @@ var SMOKE_BRIDGE_PATHS = {
11694
11872
  };
11695
11873
  function dirHasEntries(p) {
11696
11874
  try {
11697
- return fs12.readdirSync(p).length > 0;
11875
+ return fs13.readdirSync(p).length > 0;
11698
11876
  } catch {
11699
11877
  return false;
11700
11878
  }
11701
11879
  }
11702
11880
  function _resolve_tsx_invocation(scriptPath, scriptArgs) {
11703
11881
  const binName = process3.platform === "win32" ? "tsx.cmd" : "tsx";
11704
- let dir = path10.dirname(scriptPath);
11882
+ let dir = path11.dirname(scriptPath);
11705
11883
  for (; ; ) {
11706
- const candidate = path10.join(dir, "node_modules", ".bin", binName);
11884
+ const candidate = path11.join(dir, "node_modules", ".bin", binName);
11707
11885
  if (isFile(candidate)) {
11708
11886
  return { command: candidate, args: [scriptPath, ...scriptArgs] };
11709
11887
  }
11710
- const parent = path10.dirname(dir);
11888
+ const parent = path11.dirname(dir);
11711
11889
  if (parent === dir) break;
11712
11890
  dir = parent;
11713
11891
  }
11714
11892
  return { command: "npx", args: ["tsx", scriptPath, ...scriptArgs] };
11715
11893
  }
11716
11894
  function _smoke_test_hooks(project_root, package_root) {
11717
- const dispatcher = path10.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
11718
- const manifest = path10.join(package_root, "scripts", "hook_manifest.yaml");
11895
+ const dispatcher = path11.join(package_root, "scripts", "hooks", "dispatch_hook.ts");
11896
+ const manifest = path11.join(package_root, "scripts", "hook_manifest.yaml");
11719
11897
  if (!isFile(dispatcher) || !isFile(manifest)) return 0;
11720
11898
  const failed = [];
11721
11899
  const skipped = [];
11722
11900
  const passed = [];
11723
11901
  for (const [platform, native] of SMOKE_PROBE_EVENTS) {
11724
11902
  const rel_bridge = SMOKE_BRIDGE_PATHS[platform] ?? "";
11725
- const bridge_path = rel_bridge ? path10.join(project_root, rel_bridge) : null;
11903
+ const bridge_path = rel_bridge ? path11.join(project_root, rel_bridge) : null;
11726
11904
  const bridge_present = Boolean(
11727
11905
  bridge_path && (isFile(bridge_path) || isDir(bridge_path) && dirHasEntries(bridge_path))
11728
11906
  );
@@ -11922,9 +12100,9 @@ To remove this marker, delete this file.
11922
12100
  `;
11923
12101
  }
11924
12102
  var _CLAUDE_DESKTOP_BUNDLES_SUBPATH = "claude-desktop/bundles";
11925
- var GLOBAL_ROOT = path10.join(os6.homedir(), ".event4u", "agent-config");
11926
- var GLOBAL_USER_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-user.yml");
11927
- var GLOBAL_AGENT_SETTINGS_PATH = path10.join(GLOBAL_ROOT, ".agent-settings.yml");
12103
+ var GLOBAL_ROOT = path11.join(os6.homedir(), ".event4u", "agent-config");
12104
+ var GLOBAL_USER_SETTINGS_PATH = path11.join(GLOBAL_ROOT, ".agent-user.yml");
12105
+ var GLOBAL_AGENT_SETTINGS_PATH = path11.join(GLOBAL_ROOT, ".agent-settings.yml");
11928
12106
  function _bridge_marker(tool_id, scope) {
11929
12107
  if (scope === "global") return USER_SCOPE_PATHS[tool_id] ?? "";
11930
12108
  return PROJECT_BRIDGE_MARKERS[tool_id] ?? "";
@@ -12037,9 +12215,9 @@ function detect_scope(cwd) {
12037
12215
  if (pathExists(_resolve_settings_read(cwd))) {
12038
12216
  return ["project", `existing ${SETTINGS_FILE}`];
12039
12217
  }
12040
- const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path10.join(cwd, m))) ?? null;
12041
- const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path10.join(cwd, d))) ?? null;
12042
- const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path10.join(cwd, f))) ?? null;
12218
+ const has_manifest = SCOPE_DETECT_MANIFESTS.find((m) => pathExists(path11.join(cwd, m))) ?? null;
12219
+ const has_ai_dir = SCOPE_DETECT_AI_DIRS.find((d) => isDir(path11.join(cwd, d))) ?? null;
12220
+ const has_ai_file = SCOPE_DETECT_AI_FILES.find((f) => pathExists(path11.join(cwd, f))) ?? null;
12043
12221
  if (has_manifest && (has_ai_dir || has_ai_file)) {
12044
12222
  const marker = has_ai_dir || has_ai_file;
12045
12223
  return ["prompt", `manifest (${has_manifest}) + AI-tool config (${marker})`];
@@ -12060,7 +12238,7 @@ function readLineSyncRaw(promptText) {
12060
12238
  for (; ; ) {
12061
12239
  let n;
12062
12240
  try {
12063
- n = fs12.readSync(0, buf, 0, 1, null);
12241
+ n = fs13.readSync(0, buf, 0, 1, null);
12064
12242
  } catch (err) {
12065
12243
  const code = err.code;
12066
12244
  if (code === "EAGAIN") {
@@ -12135,8 +12313,8 @@ function _files_by_tool_from_bridges(tools, project_root, scope) {
12135
12313
  const marker = _bridge_marker(tool_id, scope);
12136
12314
  if (!marker) continue;
12137
12315
  let marker_path = marker;
12138
- if (!path10.isAbsolute(marker_path)) {
12139
- marker_path = path10.join(project_root, marker_path);
12316
+ if (!path11.isAbsolute(marker_path)) {
12317
+ marker_path = path11.join(project_root, marker_path);
12140
12318
  }
12141
12319
  out[tool_id] = [_file_entry(marker_path, "bridge", false)];
12142
12320
  }
@@ -12175,26 +12353,26 @@ function _update_installed_tools_manifest(project_root, tools, scope, force, fil
12175
12353
  }
12176
12354
  write_manifest(target, version, entries);
12177
12355
  if (!state.QUIET) {
12178
- const rel = isRelativeTo(target, project_root) ? path10.relative(project_root, target) : target;
12356
+ const rel = isRelativeTo(target, project_root) ? path11.relative(project_root, target) : target;
12179
12357
  info(`Manifest updated: ${rel}`);
12180
12358
  }
12181
12359
  return 0;
12182
12360
  }
12183
12361
  function isRelativeTo(child, parent) {
12184
- const rel = path10.relative(parent, child);
12185
- return rel === "" || !rel.startsWith("..") && !path10.isAbsolute(rel);
12362
+ const rel = path11.relative(parent, child);
12363
+ return rel === "" || !rel.startsWith("..") && !path11.isAbsolute(rel);
12186
12364
  }
12187
12365
  function _resolve_package_root_for_global() {
12188
12366
  const here = resolvePath(_HERE2);
12189
- const candidate = path10.dirname(path10.dirname(path10.dirname(here)));
12190
- if (!pathExists(path10.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
12367
+ const candidate = path11.dirname(path11.dirname(path11.dirname(here)));
12368
+ if (!pathExists(path11.join(candidate, "src", "config", "profiles", "minimal.ini"))) {
12191
12369
  fail(
12192
12370
  `Could not locate agent-config package root from ${here}. Expected src/config/profiles/minimal.ini at the parent directory.`
12193
12371
  );
12194
12372
  }
12195
12373
  return candidate;
12196
12374
  }
12197
- var CONSUMER_BRIDGE_MARKER_RELPATH = path10.join("agents", ".event4u-bridge.yml");
12375
+ var CONSUMER_BRIDGE_MARKER_RELPATH = path11.join("agents", ".event4u-bridge.yml");
12198
12376
  var MIGRATE_LEGACY_YAML_FILES = [".agent-settings.yml", ".agent-user.yml"];
12199
12377
  var MIGRATE_LEGACY_TOOL_DIRS = [".augment", ".claude", ".cursor"];
12200
12378
  var AGENT_CONFIG_PACKAGE_NAME = "@event4u/agent-config";
@@ -12202,7 +12380,7 @@ function _is_agent_config_source_repo(project_root) {
12202
12380
  if (process3.env["AGENT_CONFIG_CONSUMER_MODE"] === "1") {
12203
12381
  return [false, "consumer-mode-override"];
12204
12382
  }
12205
- const pkg_json = path10.join(project_root, "package.json");
12383
+ const pkg_json = path11.join(project_root, "package.json");
12206
12384
  if (isFile(pkg_json)) {
12207
12385
  let data = {};
12208
12386
  try {
@@ -12214,18 +12392,18 @@ function _is_agent_config_source_repo(project_root) {
12214
12392
  return [true, "package.json:name"];
12215
12393
  }
12216
12394
  }
12217
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
12395
+ if (isDir(path11.join(project_root, ".agent-src.uncondensed"))) {
12218
12396
  return [true, ".agent-src.uncondensed/"];
12219
12397
  }
12220
- const packages_dir = path10.join(project_root, "packages");
12398
+ const packages_dir = path11.join(project_root, "packages");
12221
12399
  if (isDir(packages_dir)) {
12222
- for (const child of fs12.readdirSync(packages_dir)) {
12223
- if (isDir(path10.join(packages_dir, child, ".agent-src.uncondensed"))) {
12400
+ for (const child of fs13.readdirSync(packages_dir)) {
12401
+ if (isDir(path11.join(packages_dir, child, ".agent-src.uncondensed"))) {
12224
12402
  return [true, `packages/${child}/.agent-src.uncondensed/`];
12225
12403
  }
12226
12404
  }
12227
12405
  }
12228
- const installer_self = path10.join(project_root, "scripts", "install.py");
12406
+ const installer_self = path11.join(project_root, "scripts", "install.py");
12229
12407
  try {
12230
12408
  if (isFile(installer_self) && resolvePath(installer_self) === resolvePath(_HERE2)) {
12231
12409
  return [true, "src/scripts/install.py (self)"];
@@ -12245,17 +12423,17 @@ function _detect_legacy_for_migration(project_root) {
12245
12423
  }
12246
12424
  return [];
12247
12425
  }
12248
- if (isFile(path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH))) return [];
12426
+ if (isFile(path11.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH))) return [];
12249
12427
  const found = [];
12250
12428
  for (const name of MIGRATE_LEGACY_YAML_FILES) {
12251
- if (isFile(path10.join(project_root, name))) {
12429
+ if (isFile(path11.join(project_root, name))) {
12252
12430
  found.push(name);
12253
- } else if (isFile(path10.join(project_root, "settings", name))) {
12431
+ } else if (isFile(path11.join(project_root, "settings", name))) {
12254
12432
  found.push(`settings/${name}`);
12255
12433
  }
12256
12434
  }
12257
12435
  for (const name of MIGRATE_LEGACY_TOOL_DIRS) {
12258
- const p = path10.join(project_root, name);
12436
+ const p = path11.join(project_root, name);
12259
12437
  if (isDir(p) && !isSymlink(p)) {
12260
12438
  found.push(`${name}/`);
12261
12439
  }
@@ -12267,7 +12445,7 @@ function _prompt_migrate_to_global(project_root, artefacts) {
12267
12445
  process3.stdout.write("\n");
12268
12446
  warn("Legacy project-local artefacts detected \u2014 pre-ADR-020 layout:");
12269
12447
  for (const rel of artefacts) {
12270
- info(` ${path10.join(project_root, rel)}`);
12448
+ info(` ${path11.join(project_root, rel)}`);
12271
12449
  }
12272
12450
  info("The unified `agent-config migrate` sweeps these in one pass.");
12273
12451
  info("The wizard recreates fresh config afterwards.");
@@ -12298,16 +12476,16 @@ function _run_migrate_to_global(project_root) {
12298
12476
  function _format_global_root_for_marker(global_root) {
12299
12477
  const home = resolvePath(os6.homedir());
12300
12478
  const resolved = resolvePath(global_root);
12301
- const rel = path10.relative(home, resolved);
12302
- if (rel === "" || rel.startsWith("..") || path10.isAbsolute(rel)) {
12479
+ const rel = path11.relative(home, resolved);
12480
+ if (rel === "" || rel.startsWith("..") || path11.isAbsolute(rel)) {
12303
12481
  return global_root;
12304
12482
  }
12305
- return `~/${rel.split(path10.sep).join("/")}`;
12483
+ return `~/${rel.split(path11.sep).join("/")}`;
12306
12484
  }
12307
12485
  function _write_consumer_bridge_marker(project_root, installer_version, env = null, now = null) {
12308
12486
  const env_map = env ?? process3.env;
12309
12487
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return null;
12310
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return null;
12488
+ if (isDir(path11.join(project_root, ".agent-src.uncondensed"))) return null;
12311
12489
  const global_root_str = _format_global_root_for_marker(
12312
12490
  event4u_root(env_map)
12313
12491
  );
@@ -12321,8 +12499,8 @@ global_root: ${global_root_str}
12321
12499
  installed_at: ${stamp}
12322
12500
  installer_version: ${installer_version}
12323
12501
  `;
12324
- const target = path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12325
- mkdirp(path10.dirname(target));
12502
+ const target = path11.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12503
+ mkdirp(path11.dirname(target));
12326
12504
  atomicWrite0644(target, body, ".event4u-bridge.");
12327
12505
  return target;
12328
12506
  }
@@ -12334,7 +12512,7 @@ var PROJECT_ANCHOR_TOOLS = {
12334
12512
  function _write_per_tool_project_anchors(project_root, tools, env = null, now = null) {
12335
12513
  const env_map = env ?? process3.env;
12336
12514
  if (env_map["AGENT_CONFIG_DEV_MODE"] === "1") return [];
12337
- if (isDir(path10.join(project_root, ".agent-src.uncondensed"))) return [];
12515
+ if (isDir(path11.join(project_root, ".agent-src.uncondensed"))) return [];
12338
12516
  const global_root_str = _format_global_root_for_marker(
12339
12517
  event4u_root(env_map)
12340
12518
  );
@@ -12343,10 +12521,10 @@ function _write_per_tool_project_anchors(project_root, tools, env = null, now =
12343
12521
  for (const tool_id of Object.keys(PROJECT_ANCHOR_TOOLS).sort()) {
12344
12522
  const rel_path = PROJECT_ANCHOR_TOOLS[tool_id];
12345
12523
  if (!tools.has(tool_id)) continue;
12346
- const target = path10.join(project_root, rel_path);
12347
- mkdirp(path10.dirname(target));
12348
- const bridge_abs = path10.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12349
- const bridge_rel = path10.relative(path10.dirname(target), bridge_abs);
12524
+ const target = path11.join(project_root, rel_path);
12525
+ mkdirp(path11.dirname(target));
12526
+ const bridge_abs = path11.join(project_root, CONSUMER_BRIDGE_MARKER_RELPATH);
12527
+ const bridge_rel = path11.relative(path11.dirname(target), bridge_abs);
12350
12528
  const body = `# event4u/agent-config \u2014 per-tool project anchor (auto-written).
12351
12529
  # Spec: docs/contracts/consumer-bridge.md \xA7 Per-tool anchor strategy.
12352
12530
  # Tool: ${tool_id}. Bridge marker: agents/.event4u-bridge.yml.
@@ -12363,7 +12541,7 @@ installed_at: ${stamp}
12363
12541
  }
12364
12542
  var PACKAGE_TAG_ID = "event4u/agent-config";
12365
12543
  function _inject_package_tag(target, source, package_root) {
12366
- if (path10.extname(target) !== ".md") return;
12544
+ if (path11.extname(target) !== ".md") return;
12367
12545
  let text;
12368
12546
  try {
12369
12547
  text = readText(target);
@@ -12391,8 +12569,8 @@ function _inject_package_tag(target, source, package_root) {
12391
12569
  resolved_src = source;
12392
12570
  }
12393
12571
  if (package_root !== null) {
12394
- const rel = path10.relative(resolvePath(package_root), resolved_src);
12395
- if (rel !== "" && !rel.startsWith("..") && !path10.isAbsolute(rel)) {
12572
+ const rel = path11.relative(resolvePath(package_root), resolved_src);
12573
+ if (rel !== "" && !rel.startsWith("..") && !path11.isAbsolute(rel)) {
12396
12574
  source_value = rel;
12397
12575
  } else {
12398
12576
  source_value = resolved_src;
@@ -12429,10 +12607,10 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12429
12607
  const written_paths = [];
12430
12608
  if (!pathExists(src)) return [0, 0, written_paths];
12431
12609
  if (!isDir(src)) {
12432
- mkdirp(path10.dirname(dest));
12610
+ mkdirp(path11.dirname(dest));
12433
12611
  const decision = _resolve_file_conflict(dest, force);
12434
12612
  if (decision === "skip") return [0, 1, written_paths];
12435
- fs12.copyFileSync(src, dest);
12613
+ fs13.copyFileSync(src, dest);
12436
12614
  _inject_package_tag(dest, src, package_root);
12437
12615
  written_paths.push(dest);
12438
12616
  return [1, 0, written_paths];
@@ -12440,11 +12618,11 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12440
12618
  mkdirp(dest);
12441
12619
  const walk = (node) => {
12442
12620
  const acc = [];
12443
- const names = fs12.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
12621
+ const names = fs13.readdirSync(node).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
12444
12622
  for (const name of names) {
12445
- const entry = path10.join(node, name);
12623
+ const entry = path11.join(node, name);
12446
12624
  acc.push(entry);
12447
- const lst = fs12.lstatSync(entry);
12625
+ const lst = fs13.lstatSync(entry);
12448
12626
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
12449
12627
  acc.push(...walk(entry));
12450
12628
  }
@@ -12452,9 +12630,9 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12452
12630
  return acc;
12453
12631
  };
12454
12632
  for (const entry of walk(src)) {
12455
- const rel = path10.relative(src, entry);
12456
- const target = path10.join(dest, rel);
12457
- const lst = fs12.lstatSync(entry);
12633
+ const rel = path11.relative(src, entry);
12634
+ const target = path11.join(dest, rel);
12635
+ const lst = fs13.lstatSync(entry);
12458
12636
  if (lst.isDirectory() && !lst.isSymbolicLink()) {
12459
12637
  mkdirp(target);
12460
12638
  continue;
@@ -12462,8 +12640,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12462
12640
  let resolvedIsDir = false;
12463
12641
  let resolved = entry;
12464
12642
  try {
12465
- resolved = fs12.realpathSync(entry);
12466
- resolvedIsDir = fs12.statSync(entry).isDirectory();
12643
+ resolved = fs13.realpathSync(entry);
12644
+ resolvedIsDir = fs13.statSync(entry).isDirectory();
12467
12645
  } catch {
12468
12646
  resolvedIsDir = false;
12469
12647
  }
@@ -12485,8 +12663,8 @@ function _copy_dir_dereferencing_symlinks(src, dest, force, package_root = null)
12485
12663
  skipped += 1;
12486
12664
  continue;
12487
12665
  }
12488
- mkdirp(path10.dirname(target));
12489
- fs12.copyFileSync(resolved, target);
12666
+ mkdirp(path11.dirname(target));
12667
+ fs13.copyFileSync(resolved, target);
12490
12668
  _inject_package_tag(target, resolved, package_root);
12491
12669
  written += 1;
12492
12670
  written_paths.push(target);
@@ -12498,7 +12676,7 @@ function _claude_desktop_bundles_dir() {
12498
12676
  }
12499
12677
  function _write_claude_desktop_marker(_force, lockfile_path2, bundles_dir, bundle_count) {
12500
12678
  const anchor = expanduser5(USER_SCOPE_PATHS["claude-desktop"]);
12501
- const target = path10.join(anchor, "agent-config.md");
12679
+ const target = path11.join(anchor, "agent-config.md");
12502
12680
  mkdirp(anchor);
12503
12681
  const body = claudeDesktopMarkerBody(lockfile_path2, anchor, bundles_dir, bundle_count);
12504
12682
  writeText(target, body);
@@ -12541,8 +12719,8 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
12541
12719
  const written_paths = [];
12542
12720
  let current_files = /* @__PURE__ */ new Set();
12543
12721
  for (const [src_rel, dest_sub] of plan) {
12544
- const src = path10.join(package_root, src_rel);
12545
- const dest = dest_sub ? path10.join(anchor, dest_sub) : anchor;
12722
+ const src = path11.join(package_root, src_rel);
12723
+ const dest = dest_sub ? path11.join(anchor, dest_sub) : anchor;
12546
12724
  const [w, s, paths] = _copy_dir_dereferencing_symlinks(src, dest, force, package_root);
12547
12725
  written_total += w;
12548
12726
  skipped_total += s;
@@ -12590,6 +12768,28 @@ function _deploy_global_content(tools, force, package_root, lockfile_path2) {
12590
12768
  }
12591
12769
  _emit_progress({ type: "reaped", tool: tool_id, count: reaped.length });
12592
12770
  results[tool_id] = [written_total, skipped_total, "deployed", written_paths];
12771
+ if (tool_id === "claude-code") {
12772
+ try {
12773
+ const manifest = path11.join(package_root, "src", "scripts", "hook_manifest.yaml");
12774
+ const matrix = build_claude_hook_matrix(manifest);
12775
+ const res = ensure_managed_hooks(
12776
+ path11.join(anchor, "settings.json"),
12777
+ matrix
12778
+ );
12779
+ if (!state.QUIET) {
12780
+ if (res.changed) {
12781
+ success(
12782
+ `claude-code: managed hooks registered in ~/.claude/settings.json (${res.events.length} event(s))`
12783
+ );
12784
+ } else {
12785
+ skip("claude-code: managed hooks already registered");
12786
+ }
12787
+ }
12788
+ } catch (e) {
12789
+ warn(`claude-code: managed-hook registration failed \u2014 ${String(e)}`);
12790
+ _emit_progress({ type: "hooks_failed", tool: tool_id, error: String(e) });
12791
+ }
12792
+ }
12593
12793
  }
12594
12794
  return results;
12595
12795
  }
@@ -12609,7 +12809,7 @@ function _preview_global_reap(tools, package_root) {
12609
12809
  const anchor = expanduser5(anchor_raw);
12610
12810
  let current_files = /* @__PURE__ */ new Set();
12611
12811
  for (const [src_rel, dest_sub] of plan) {
12612
- const src = path10.join(package_root, src_rel);
12812
+ const src = path11.join(package_root, src_rel);
12613
12813
  current_files = setUnion(
12614
12814
  current_files,
12615
12815
  expected_deploy_files(src, dest_sub ? dest_sub : "")
@@ -12639,14 +12839,14 @@ function _preview_global_reap(tools, package_root) {
12639
12839
  function _verify_deploy_targets(anchor, plan) {
12640
12840
  const missing = [];
12641
12841
  for (const [, dest_sub] of plan) {
12642
- const target = dest_sub ? path10.join(anchor, dest_sub) : anchor;
12842
+ const target = dest_sub ? path11.join(anchor, dest_sub) : anchor;
12643
12843
  const label = dest_sub || ".";
12644
12844
  if (!isDir(target)) {
12645
12845
  missing.push(label);
12646
12846
  continue;
12647
12847
  }
12648
12848
  try {
12649
- const entries = fs12.readdirSync(target);
12849
+ const entries = fs13.readdirSync(target);
12650
12850
  if (entries.length === 0) missing.push(label);
12651
12851
  } catch {
12652
12852
  missing.push(label);
@@ -12661,13 +12861,13 @@ function _prune_lab_modules(deploy_results, lab_ids) {
12661
12861
  const [written, skipped, status, paths] = deploy_results[tool_id];
12662
12862
  const lab_skill_dirs = /* @__PURE__ */ new Set();
12663
12863
  for (const p of paths) {
12664
- const parts = p.split(path10.sep);
12864
+ const parts = p.split(path11.sep);
12665
12865
  if (parts.includes("skills")) {
12666
12866
  const i = parts.indexOf("skills");
12667
12867
  if (i + 1 < parts.length) {
12668
- const skill_root = parts.slice(0, i + 2).join(path10.sep);
12868
+ const skill_root = parts.slice(0, i + 2).join(path11.sep);
12669
12869
  if (!lab_skill_dirs.has(skill_root)) {
12670
- const skillmd = path10.join(skill_root, "SKILL.md");
12870
+ const skillmd = path11.join(skill_root, "SKILL.md");
12671
12871
  if (pathExists(skillmd) && is_lab_artefact(skillmd, lab_ids)) {
12672
12872
  lab_skill_dirs.add(skill_root);
12673
12873
  }
@@ -12678,25 +12878,25 @@ function _prune_lab_modules(deploy_results, lab_ids) {
12678
12878
  const keep = [];
12679
12879
  const delete_files = [];
12680
12880
  for (const p of paths) {
12681
- const parts = p.split(path10.sep);
12881
+ const parts = p.split(path11.sep);
12682
12882
  let is_lab = false;
12683
12883
  if (parts.includes("skills")) {
12684
12884
  const i = parts.indexOf("skills");
12685
- if (i + 1 < parts.length && lab_skill_dirs.has(parts.slice(0, i + 2).join(path10.sep))) {
12885
+ if (i + 1 < parts.length && lab_skill_dirs.has(parts.slice(0, i + 2).join(path11.sep))) {
12686
12886
  is_lab = true;
12687
12887
  }
12688
- } else if (parts.includes("commands") && path10.extname(p) === ".md" && is_lab_artefact(p, lab_ids)) {
12888
+ } else if (parts.includes("commands") && path11.extname(p) === ".md" && is_lab_artefact(p, lab_ids)) {
12689
12889
  is_lab = true;
12690
12890
  }
12691
12891
  (is_lab ? delete_files : keep).push(p);
12692
12892
  }
12693
12893
  for (const d of lab_skill_dirs) {
12694
- fs12.rmSync(d, { recursive: true, force: true });
12894
+ fs13.rmSync(d, { recursive: true, force: true });
12695
12895
  }
12696
12896
  for (const p of delete_files) {
12697
- if (p.split(path10.sep).includes("commands") && pathExists(p)) {
12897
+ if (p.split(path11.sep).includes("commands") && pathExists(p)) {
12698
12898
  try {
12699
- fs12.unlinkSync(p);
12899
+ fs13.unlinkSync(p);
12700
12900
  } catch {
12701
12901
  }
12702
12902
  }
@@ -12833,19 +13033,19 @@ function install_global(tools, force, project_root = null, core_only = false) {
12833
13033
  }
12834
13034
  }
12835
13035
  }
12836
- if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path10.join(project_root, ".agent-src.uncondensed"))) {
13036
+ if (project_root !== null && pathExists(_resolve_settings_read(project_root)) && !isDir(path11.join(project_root, ".agent-src.uncondensed"))) {
12837
13037
  const files_by_tool = _files_by_tool_from_deploy(deploy_results);
12838
13038
  const rc = _update_installed_tools_manifest(project_root, tools, "global", force, files_by_tool);
12839
13039
  if (rc !== 0) return rc;
12840
13040
  const marker_path = _write_consumer_bridge_marker(project_root, installed_version);
12841
13041
  if (marker_path !== null && !state.QUIET) {
12842
- const rel = isRelativeTo(marker_path, project_root) ? path10.relative(project_root, marker_path) : marker_path;
13042
+ const rel = isRelativeTo(marker_path, project_root) ? path11.relative(project_root, marker_path) : marker_path;
12843
13043
  info(`Bridge marker written: ${rel}`);
12844
13044
  }
12845
13045
  const anchor_paths = _write_per_tool_project_anchors(project_root, tools);
12846
13046
  if (anchor_paths.length > 0 && !state.QUIET) {
12847
13047
  for (const p of anchor_paths) {
12848
- const rel = isRelativeTo(p, project_root) ? path10.relative(project_root, p) : p;
13048
+ const rel = isRelativeTo(p, project_root) ? path11.relative(project_root, p) : p;
12849
13049
  info(`Project anchor written: ${rel}`);
12850
13050
  }
12851
13051
  }
@@ -13066,13 +13266,13 @@ function _minimal_templates_root() {
13066
13266
  const chain = [start];
13067
13267
  let cur = start;
13068
13268
  for (; ; ) {
13069
- const parent = path10.dirname(cur);
13269
+ const parent = path11.dirname(cur);
13070
13270
  if (parent === cur) break;
13071
13271
  chain.push(parent);
13072
13272
  cur = parent;
13073
13273
  }
13074
13274
  for (const ancestor of chain) {
13075
- const candidate = path10.join(ancestor, "src", "templates", "minimal");
13275
+ const candidate = path11.join(ancestor, "src", "templates", "minimal");
13076
13276
  if (isDir(candidate)) return candidate;
13077
13277
  }
13078
13278
  fail("Could not locate src/templates/minimal/ \u2014 package install is corrupt.");
@@ -13080,9 +13280,9 @@ function _minimal_templates_root() {
13080
13280
  var INSTALL_MODE_MARKER_REL = "agents/.agent-state/install-mode.txt";
13081
13281
  function _write_install_mode_marker(project_root, mode) {
13082
13282
  if (mode !== "minimal" && mode !== "full") return;
13083
- const marker = path10.join(project_root, INSTALL_MODE_MARKER_REL);
13283
+ const marker = path11.join(project_root, INSTALL_MODE_MARKER_REL);
13084
13284
  try {
13085
- mkdirp(path10.dirname(marker));
13285
+ mkdirp(path11.dirname(marker));
13086
13286
  writeText(marker, `${mode}
13087
13287
  `);
13088
13288
  } catch {
@@ -13091,7 +13291,7 @@ function _write_install_mode_marker(project_root, mode) {
13091
13291
  function install_minimal(target_root_in, force, user_type = "") {
13092
13292
  let target_root = resolvePath(target_root_in);
13093
13293
  mkdirp(target_root);
13094
- const parent = path10.dirname(target_root);
13294
+ const parent = path11.dirname(target_root);
13095
13295
  if (parent !== target_root) {
13096
13296
  const existing = find_project_root_with_anchor(parent);
13097
13297
  if (existing !== null && existing[0] !== target_root) {
@@ -13102,21 +13302,21 @@ function install_minimal(target_root_in, force, user_type = "") {
13102
13302
  }
13103
13303
  }
13104
13304
  const templates = _minimal_templates_root();
13105
- const settings_src = path10.join(templates, SETTINGS_FILE);
13106
- const overrides_gitkeep_src = path10.join(templates, "overrides-gitkeep");
13107
- const overrides_readme_src = path10.join(templates, "agents-overrides-readme.md");
13305
+ const settings_src = path11.join(templates, SETTINGS_FILE);
13306
+ const overrides_gitkeep_src = path11.join(templates, "overrides-gitkeep");
13307
+ const overrides_readme_src = path11.join(templates, "agents-overrides-readme.md");
13108
13308
  if (!isFile(settings_src)) fail(`Bundled minimal settings template missing under ${templates}`);
13109
13309
  if (!isFile(overrides_gitkeep_src) || !isFile(overrides_readme_src)) {
13110
13310
  fail(`Bundled overrides scaffold templates missing under ${templates}`);
13111
13311
  }
13112
13312
  info(`Minimal init \u2192 ${target_root}`);
13113
- const overrides_root = path10.join(target_root, "agents", "overrides");
13313
+ const overrides_root = path11.join(target_root, "agents", "overrides");
13114
13314
  mkdirp(overrides_root);
13115
13315
  const gitkeep_body = readText(overrides_gitkeep_src);
13116
13316
  for (const sub of ["rules", "skills", "commands"]) {
13117
- const sub_dir = path10.join(overrides_root, sub);
13317
+ const sub_dir = path11.join(overrides_root, sub);
13118
13318
  mkdirp(sub_dir);
13119
- const gitkeep_dst = path10.join(sub_dir, ".gitkeep");
13319
+ const gitkeep_dst = path11.join(sub_dir, ".gitkeep");
13120
13320
  if (pathExists(gitkeep_dst) && !force) {
13121
13321
  skip(`agents/overrides/${sub}/.gitkeep already exists (use --force to overwrite)`);
13122
13322
  } else {
@@ -13124,7 +13324,7 @@ function install_minimal(target_root_in, force, user_type = "") {
13124
13324
  success(`Wrote agents/overrides/${sub}/.gitkeep`);
13125
13325
  }
13126
13326
  }
13127
- const readme_dst = path10.join(overrides_root, "README.md");
13327
+ const readme_dst = path11.join(overrides_root, "README.md");
13128
13328
  if (pathExists(readme_dst) && !force) {
13129
13329
  skip("agents/overrides/README.md already exists (use --force to overwrite)");
13130
13330
  } else {
@@ -13142,7 +13342,7 @@ function install_minimal(target_root_in, force, user_type = "") {
13142
13342
  personal:
13143
13343
  user_type: ${user_type}
13144
13344
  `;
13145
- mkdirp(path10.dirname(settings_dst));
13345
+ mkdirp(path11.dirname(settings_dst));
13146
13346
  writeText(settings_dst, body);
13147
13347
  success(`Wrote ${SETTINGS_FILE} (user_type=${user_type})`);
13148
13348
  }
@@ -13150,7 +13350,7 @@ personal:
13150
13350
  const installed_version = current_package_version();
13151
13351
  const marker_path = _write_consumer_bridge_marker(target_root, installed_version);
13152
13352
  if (marker_path !== null) {
13153
- const rel = isRelativeTo(marker_path, target_root) ? path10.relative(target_root, marker_path) : marker_path;
13353
+ const rel = isRelativeTo(marker_path, target_root) ? path11.relative(target_root, marker_path) : marker_path;
13154
13354
  success(`Wrote ${rel}`);
13155
13355
  }
13156
13356
  _write_install_mode_marker(target_root, "minimal");
@@ -13224,7 +13424,7 @@ function run_interactive_init(project_root, force) {
13224
13424
  );
13225
13425
  return 0;
13226
13426
  }
13227
- const target = path10.join(project_root, _LOCAL_CONFIG_FILE);
13427
+ const target = path11.join(project_root, _LOCAL_CONFIG_FILE);
13228
13428
  if (pathExists(target) && !force) {
13229
13429
  warn(
13230
13430
  `${_LOCAL_CONFIG_FILE} already exists; re-run with --force to overwrite. Skipping interactive init.`
@@ -13251,7 +13451,7 @@ function run_interactive_init(project_root, force) {
13251
13451
  warn(`Could not write ${target}: ${String(exc)}`);
13252
13452
  return 1;
13253
13453
  }
13254
- success(`Wrote ${path10.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
13454
+ success(`Wrote ${path11.relative(project_root, target)} (${user_type} / ${stack} / ${verbosity})`);
13255
13455
  return 0;
13256
13456
  }
13257
13457
  var _WIZARD_READY_RE = /^WIZARD_READY (http:\/\/(?:127\.0\.0\.1|localhost):\d+\/\S*)\r?$/;
@@ -13269,12 +13469,12 @@ function _wizard_should_launch(opts) {
13269
13469
  return [true, ""];
13270
13470
  }
13271
13471
  function _wizard_cli_dist(_project_root) {
13272
- const package_root = path10.dirname(path10.dirname(path10.dirname(resolvePath(_HERE2))));
13273
- const cli = path10.join(package_root, "dist", "cli", "agent-config.js");
13472
+ const package_root = path11.dirname(path11.dirname(path11.dirname(resolvePath(_HERE2))));
13473
+ const cli = path11.join(package_root, "dist", "cli", "agent-config.js");
13274
13474
  return pathExists(cli) ? cli : null;
13275
13475
  }
13276
13476
  function _server_info_path() {
13277
- return path10.join(os6.homedir(), ".event4u", "agent-config", "local-server.json");
13477
+ return path11.join(os6.homedir(), ".event4u", "agent-config", "local-server.json");
13278
13478
  }
13279
13479
  function _pid_is_agent_config(pid) {
13280
13480
  let res;
@@ -13291,7 +13491,7 @@ function _pid_is_agent_config(pid) {
13291
13491
  }
13292
13492
  function unlinkMissingOk(p) {
13293
13493
  try {
13294
- fs12.unlinkSync(p);
13494
+ fs13.unlinkSync(p);
13295
13495
  } catch {
13296
13496
  }
13297
13497
  }
@@ -13369,14 +13569,14 @@ function _wizard_spawn(project_root, pass_project_root = true) {
13369
13569
  }
13370
13570
  function _wizard_run_sync(cmd, env, cli) {
13371
13571
  const total = _WIZARD_TIMEOUTS.reduce((a, b) => a + b, 0);
13372
- const log_path = path10.join(
13572
+ const log_path = path11.join(
13373
13573
  os6.tmpdir(),
13374
13574
  `agent-config-wizard-${process3.pid}-${Date.now()}.log`
13375
13575
  );
13376
13576
  let child;
13377
13577
  let log_fd = null;
13378
13578
  try {
13379
- log_fd = fs12.openSync(log_path, "w");
13579
+ log_fd = fs13.openSync(log_path, "w");
13380
13580
  child = spawn(cmd[0], cmd.slice(1), {
13381
13581
  env,
13382
13582
  detached: true,
@@ -13394,7 +13594,7 @@ function _wizard_run_sync(cmd, env, cli) {
13394
13594
  } finally {
13395
13595
  if (log_fd !== null) {
13396
13596
  try {
13397
- fs12.closeSync(log_fd);
13597
+ fs13.closeSync(log_fd);
13398
13598
  } catch {
13399
13599
  }
13400
13600
  }
@@ -13644,8 +13844,8 @@ function main2(argv) {
13644
13844
  const target_root = resolvePath(
13645
13845
  opts.custom_path || opts.project || process3.env["PROJECT_ROOT"] || process3.cwd()
13646
13846
  );
13647
- const minimal_package_root = path10.dirname(
13648
- path10.dirname(path10.dirname(_minimal_templates_root()))
13847
+ const minimal_package_root = path11.dirname(
13848
+ path11.dirname(path11.dirname(_minimal_templates_root()))
13649
13849
  );
13650
13850
  const validated_user_type = _validate_user_type(minimal_package_root, opts.user_type);
13651
13851
  return install_minimal(target_root, opts.force, validated_user_type);
@@ -13674,7 +13874,7 @@ function main2(argv) {
13674
13874
  return rc2;
13675
13875
  }
13676
13876
  const project_root = custom_path || resolvePath(opts.project || process3.env["PROJECT_ROOT"] || process3.cwd());
13677
- const is_first_run = !pathExists(path10.join(project_root, SETTINGS_FILE));
13877
+ const is_first_run = !pathExists(path11.join(project_root, SETTINGS_FILE));
13678
13878
  const rc = _main_project_install(opts, project_root, parsed_tools, is_first_run);
13679
13879
  if (rc === 0 && opts.interactive) {
13680
13880
  run_interactive_init(project_root, opts.force);
@@ -13725,16 +13925,16 @@ function _read_consumer_auto_switch(project_root) {
13725
13925
  return "suggest";
13726
13926
  }
13727
13927
  function finalize_claude_model_tiers(project_root) {
13728
- const claude_skills = path10.join(project_root, ".claude", "skills");
13729
- const augment_skills = path10.join(project_root, ".augment", "skills");
13928
+ const claude_skills = path11.join(project_root, ".claude", "skills");
13929
+ const augment_skills = path11.join(project_root, ".augment", "skills");
13730
13930
  if (!isDir(claude_skills) || !isDir(augment_skills)) return 0;
13731
13931
  if (_read_consumer_auto_switch(project_root) !== "auto") return 0;
13732
13932
  let rendered = 0;
13733
- const entries = fs12.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13933
+ const entries = fs13.readdirSync(claude_skills).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13734
13934
  for (const name of entries) {
13735
- const entry = path10.join(claude_skills, name);
13736
- const src_dir = path10.join(augment_skills, name);
13737
- const src_md = path10.join(src_dir, "SKILL.md");
13935
+ const entry = path11.join(claude_skills, name);
13936
+ const src_dir = path11.join(augment_skills, name);
13937
+ const src_md = path11.join(src_dir, "SKILL.md");
13738
13938
  let tier;
13739
13939
  try {
13740
13940
  tier = read_model_tier(src_md);
@@ -13743,22 +13943,22 @@ function finalize_claude_model_tiers(project_root) {
13743
13943
  }
13744
13944
  if (tier === null || !(tier in TIER_TO_CLAUDE_MODEL) || !isDir(src_dir)) continue;
13745
13945
  if (isSymlink(entry) || isFile(entry)) {
13746
- fs12.unlinkSync(entry);
13946
+ fs13.unlinkSync(entry);
13747
13947
  } else if (isDir(entry)) {
13748
- fs12.rmSync(entry, { recursive: true, force: true });
13948
+ fs13.rmSync(entry, { recursive: true, force: true });
13749
13949
  }
13750
13950
  mkdirp(entry);
13751
- const srcFiles = fs12.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13951
+ const srcFiles = fs13.readdirSync(src_dir).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
13752
13952
  for (const fname of srcFiles) {
13753
13953
  if (fname === "SKILL.md") {
13754
13954
  writeText(
13755
- path10.join(entry, "SKILL.md"),
13955
+ path11.join(entry, "SKILL.md"),
13756
13956
  render_native_model_md(readText(src_md), tier)
13757
13957
  );
13758
13958
  } else {
13759
- fs12.symlinkSync(
13760
- path10.join("../../../.augment/skills", name, fname),
13761
- path10.join(entry, fname)
13959
+ fs13.symlinkSync(
13960
+ path11.join("../../../.augment/skills", name, fname),
13961
+ path11.join(entry, fname)
13762
13962
  );
13763
13963
  }
13764
13964
  }
@@ -13776,7 +13976,7 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
13776
13976
  let package_type;
13777
13977
  if (opts.package) {
13778
13978
  package_root = resolvePath(opts.package);
13779
- if (!pathExists(path10.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
13979
+ if (!pathExists(path11.join(package_root, "src", "config", "profiles", "minimal.ini"))) {
13780
13980
  fail(`Invalid --package path (missing src/config/profiles/minimal.ini): ${package_root}`);
13781
13981
  }
13782
13982
  package_type = detect_package_type_for_project(project_root, package_root);
@@ -13904,9 +14104,9 @@ function _main_project_install(opts, project_root, parsed_tools, is_first_run) {
13904
14104
  function _resolvedArgv1() {
13905
14105
  if (process3.argv[1] === void 0) return void 0;
13906
14106
  try {
13907
- return fs12.realpathSync(path10.resolve(process3.argv[1]));
14107
+ return fs13.realpathSync(path11.resolve(process3.argv[1]));
13908
14108
  } catch {
13909
- return path10.resolve(process3.argv[1]);
14109
+ return path11.resolve(process3.argv[1]);
13910
14110
  }
13911
14111
  }
13912
14112
  var _argv1 = _resolvedArgv1();