@event4u/agent-config 9.11.0 → 9.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/CHANGELOG.md +52 -0
  3. package/README.md +8 -1
  4. package/dist/agent-src/commands/fix/ci.md +29 -0
  5. package/dist/agent-src/commands/pr/create.md +60 -0
  6. package/dist/agent-src/contexts/authority/kernel-rule-edits.md +18 -2
  7. package/dist/agent-src/rules/design-fidelity.md +1 -1
  8. package/dist/agent-src/skills/ai-code-blindspots/SKILL.md +1 -0
  9. package/dist/agent-src/skills/design-intelligence/SKILL.md +27 -1
  10. package/dist/agent-src/skills/design-intelligence/data/font-pairings-reference.csv +74 -74
  11. package/dist/agent-src/skills/design-intelligence/data/manifest.json +2 -0
  12. package/dist/agent-src/skills/design-tokens/scripts/tokens.ts +0 -7
  13. package/dist/agent-src/skills/typography-system/SKILL.md +55 -11
  14. package/dist/agent-src/skills/ui-apply-generic/SKILL.md +180 -0
  15. package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
  16. package/dist/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +9 -5
  17. package/dist/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +9 -6
  18. package/dist/agent-src/templates/scripts/work_engine/directives/ui/review.ts +9 -5
  19. package/dist/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +182 -29
  20. package/dist/agent-src/templates/scripts/work_engine/stack/detect.ts +311 -24
  21. package/dist/cli-delegate/chunk-523HCFYO.js +90 -0
  22. package/dist/cli-delegate/{chunk-IR7P7JWA.js → chunk-A3HJ6NTI.js} +271 -59
  23. package/dist/cli-delegate/chunk-EJYIGZ3T.js +125 -0
  24. package/dist/cli-delegate/{chunk-RDGRHAAB.js → chunk-HYWSRNUX.js} +6 -86
  25. package/dist/cli-delegate/{chunk-YMFO6FDN.js → chunk-QFKQLQ7X.js} +313 -81
  26. package/dist/cli-delegate/{chunk-4SV3XGFA.js → chunk-TEGJU2JX.js} +7 -9
  27. package/dist/cli-delegate/chunk-TJIAM5FW.js +133 -0
  28. package/dist/cli-delegate/cmd_conformance.js +4 -7
  29. package/dist/cli-delegate/cmd_doctor.js +3 -5
  30. package/dist/cli-delegate/cmd_explain.js +153 -85
  31. package/dist/cli-delegate/cmd_export.js +5 -3
  32. package/dist/cli-delegate/cmd_fleet.js +2 -1
  33. package/dist/cli-delegate/cmd_preflight.js +6 -123
  34. package/dist/cli-delegate/cmd_prune.js +5 -3
  35. package/dist/cli-delegate/cmd_settings_migrate.js +5 -3
  36. package/dist/cli-delegate/cmd_sync.js +5 -3
  37. package/dist/cli-delegate/cmd_uninstall.js +6 -5
  38. package/dist/cli-delegate/cmd_validate.js +5 -3
  39. package/dist/discovery/deprecation-report.md +1 -1
  40. package/dist/discovery/discovery-manifest.json +36 -14
  41. package/dist/discovery/discovery-manifest.json.sha256 +1 -1
  42. package/dist/discovery/discovery-manifest.summary.md +3 -3
  43. package/dist/discovery/orphan-report.md +1 -1
  44. package/dist/discovery/packs.json +6 -5
  45. package/dist/discovery/trust-report.md +2 -2
  46. package/dist/discovery/workspaces.json +5 -4
  47. package/dist/install/install.mjs +605 -412
  48. package/dist/install/ruleInScope.js +123 -0
  49. package/dist/install/ruleInScope.js.map +1 -0
  50. package/dist/install/rule_scope.js +2 -2
  51. package/dist/install/rule_scope.js.map +1 -1
  52. package/dist/install/wizard-plan.js +10 -1
  53. package/dist/install/wizard-plan.js.map +1 -1
  54. package/dist/mcp/registry-manifest.json +3 -3
  55. package/dist/mcp/server.json +2 -2
  56. package/dist/mcp/server.mjs +405 -2429
  57. package/dist/scripts/condense.js +6 -22
  58. package/dist/scripts/condense.js.map +1 -1
  59. package/docs/guidelines/design-fidelity-mechanics.md +14 -0
  60. package/package.json +1 -1
  61. package/src/agent-src/templates/scripts/work_engine/directives/ui/apply.ts +9 -5
  62. package/src/agent-src/templates/scripts/work_engine/directives/ui/polish.ts +9 -6
  63. package/src/agent-src/templates/scripts/work_engine/directives/ui/review.ts +9 -5
  64. package/src/agent-src/templates/scripts/work_engine/directives/ui/stack_bundles.ts +182 -29
  65. package/src/agent-src/templates/scripts/work_engine/stack/detect.ts +311 -24
  66. package/src/install/ruleInScope.ts +133 -0
  67. package/src/install/rule_scope.ts +2 -2
  68. package/src/install/wizard-plan.ts +11 -1
  69. package/src/scripts/_lib/global_deploy_inventory.ts +38 -2
  70. package/src/scripts/check_installer_import_purity.ts +295 -0
  71. package/src/scripts/condense.ts +7 -28
  72. package/src/scripts/install-hooks.sh +36 -4
  73. package/src/scripts/install.ts +210 -5
  74. package/src/scripts/lint_ui_stack_bundles.ts +31 -0
  75. package/dist/cli-delegate/chunk-7DSAMZFU.js +0 -356
  76. package/dist/cli-delegate/chunk-BJGXZNPM.js +0 -266
  77. package/dist/cli-delegate/chunk-TFG57JJM.js +0 -1969
@@ -870,17 +870,17 @@ function _strip_frontmatter(text) {
870
870
  }
871
871
  return [meta, _lstripNewlines(body)];
872
872
  }
873
- function _splitMax(text, sep15, maxsplit) {
873
+ function _splitMax(text, sep14, maxsplit) {
874
874
  const out = [];
875
875
  let rest = text;
876
876
  let count = 0;
877
877
  while (count < maxsplit) {
878
- const idx = rest.indexOf(sep15);
878
+ const idx = rest.indexOf(sep14);
879
879
  if (idx === -1) {
880
880
  break;
881
881
  }
882
882
  out.push(rest.slice(0, idx));
883
- rest = rest.slice(idx + sep15.length);
883
+ rest = rest.slice(idx + sep14.length);
884
884
  count += 1;
885
885
  }
886
886
  out.push(rest);
@@ -1669,17 +1669,17 @@ var require_visit = __commonJS({
1669
1669
  visit.BREAK = BREAK;
1670
1670
  visit.SKIP = SKIP;
1671
1671
  visit.REMOVE = REMOVE;
1672
- function visit_(key, node, visitor, path50) {
1673
- const ctrl = callVisitor(key, node, visitor, path50);
1672
+ function visit_(key, node, visitor, path49) {
1673
+ const ctrl = callVisitor(key, node, visitor, path49);
1674
1674
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1675
- replaceNode(key, path50, ctrl);
1676
- return visit_(key, ctrl, visitor, path50);
1675
+ replaceNode(key, path49, ctrl);
1676
+ return visit_(key, ctrl, visitor, path49);
1677
1677
  }
1678
1678
  if (typeof ctrl !== "symbol") {
1679
1679
  if (identity.isCollection(node)) {
1680
- path50 = Object.freeze(path50.concat(node));
1680
+ path49 = Object.freeze(path49.concat(node));
1681
1681
  for (let i = 0; i < node.items.length; ++i) {
1682
- const ci = visit_(i, node.items[i], visitor, path50);
1682
+ const ci = visit_(i, node.items[i], visitor, path49);
1683
1683
  if (typeof ci === "number")
1684
1684
  i = ci - 1;
1685
1685
  else if (ci === BREAK)
@@ -1690,13 +1690,13 @@ var require_visit = __commonJS({
1690
1690
  }
1691
1691
  }
1692
1692
  } else if (identity.isPair(node)) {
1693
- path50 = Object.freeze(path50.concat(node));
1694
- const ck = visit_("key", node.key, visitor, path50);
1693
+ path49 = Object.freeze(path49.concat(node));
1694
+ const ck = visit_("key", node.key, visitor, path49);
1695
1695
  if (ck === BREAK)
1696
1696
  return BREAK;
1697
1697
  else if (ck === REMOVE)
1698
1698
  node.key = null;
1699
- const cv = visit_("value", node.value, visitor, path50);
1699
+ const cv = visit_("value", node.value, visitor, path49);
1700
1700
  if (cv === BREAK)
1701
1701
  return BREAK;
1702
1702
  else if (cv === REMOVE)
@@ -1717,17 +1717,17 @@ var require_visit = __commonJS({
1717
1717
  visitAsync.BREAK = BREAK;
1718
1718
  visitAsync.SKIP = SKIP;
1719
1719
  visitAsync.REMOVE = REMOVE;
1720
- async function visitAsync_(key, node, visitor, path50) {
1721
- const ctrl = await callVisitor(key, node, visitor, path50);
1720
+ async function visitAsync_(key, node, visitor, path49) {
1721
+ const ctrl = await callVisitor(key, node, visitor, path49);
1722
1722
  if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
1723
- replaceNode(key, path50, ctrl);
1724
- return visitAsync_(key, ctrl, visitor, path50);
1723
+ replaceNode(key, path49, ctrl);
1724
+ return visitAsync_(key, ctrl, visitor, path49);
1725
1725
  }
1726
1726
  if (typeof ctrl !== "symbol") {
1727
1727
  if (identity.isCollection(node)) {
1728
- path50 = Object.freeze(path50.concat(node));
1728
+ path49 = Object.freeze(path49.concat(node));
1729
1729
  for (let i = 0; i < node.items.length; ++i) {
1730
- const ci = await visitAsync_(i, node.items[i], visitor, path50);
1730
+ const ci = await visitAsync_(i, node.items[i], visitor, path49);
1731
1731
  if (typeof ci === "number")
1732
1732
  i = ci - 1;
1733
1733
  else if (ci === BREAK)
@@ -1738,13 +1738,13 @@ var require_visit = __commonJS({
1738
1738
  }
1739
1739
  }
1740
1740
  } else if (identity.isPair(node)) {
1741
- path50 = Object.freeze(path50.concat(node));
1742
- const ck = await visitAsync_("key", node.key, visitor, path50);
1741
+ path49 = Object.freeze(path49.concat(node));
1742
+ const ck = await visitAsync_("key", node.key, visitor, path49);
1743
1743
  if (ck === BREAK)
1744
1744
  return BREAK;
1745
1745
  else if (ck === REMOVE)
1746
1746
  node.key = null;
1747
- const cv = await visitAsync_("value", node.value, visitor, path50);
1747
+ const cv = await visitAsync_("value", node.value, visitor, path49);
1748
1748
  if (cv === BREAK)
1749
1749
  return BREAK;
1750
1750
  else if (cv === REMOVE)
@@ -1771,23 +1771,23 @@ var require_visit = __commonJS({
1771
1771
  }
1772
1772
  return visitor;
1773
1773
  }
1774
- function callVisitor(key, node, visitor, path50) {
1774
+ function callVisitor(key, node, visitor, path49) {
1775
1775
  if (typeof visitor === "function")
1776
- return visitor(key, node, path50);
1776
+ return visitor(key, node, path49);
1777
1777
  if (identity.isMap(node))
1778
- return visitor.Map?.(key, node, path50);
1778
+ return visitor.Map?.(key, node, path49);
1779
1779
  if (identity.isSeq(node))
1780
- return visitor.Seq?.(key, node, path50);
1780
+ return visitor.Seq?.(key, node, path49);
1781
1781
  if (identity.isPair(node))
1782
- return visitor.Pair?.(key, node, path50);
1782
+ return visitor.Pair?.(key, node, path49);
1783
1783
  if (identity.isScalar(node))
1784
- return visitor.Scalar?.(key, node, path50);
1784
+ return visitor.Scalar?.(key, node, path49);
1785
1785
  if (identity.isAlias(node))
1786
- return visitor.Alias?.(key, node, path50);
1786
+ return visitor.Alias?.(key, node, path49);
1787
1787
  return void 0;
1788
1788
  }
1789
- function replaceNode(key, path50, node) {
1790
- const parent = path50[path50.length - 1];
1789
+ function replaceNode(key, path49, node) {
1790
+ const parent = path49[path49.length - 1];
1791
1791
  if (identity.isCollection(parent)) {
1792
1792
  parent.items[key] = node;
1793
1793
  } else if (identity.isPair(parent)) {
@@ -2397,10 +2397,10 @@ var require_Collection = __commonJS({
2397
2397
  var createNode = require_createNode();
2398
2398
  var identity = require_identity();
2399
2399
  var Node = require_Node();
2400
- function collectionFromPath(schema, path50, value) {
2400
+ function collectionFromPath(schema, path49, value) {
2401
2401
  let v = value;
2402
- for (let i = path50.length - 1; i >= 0; --i) {
2403
- const k = path50[i];
2402
+ for (let i = path49.length - 1; i >= 0; --i) {
2403
+ const k = path49[i];
2404
2404
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
2405
2405
  const a = [];
2406
2406
  a[k] = v;
@@ -2419,7 +2419,7 @@ var require_Collection = __commonJS({
2419
2419
  sourceObjects: /* @__PURE__ */ new Map()
2420
2420
  });
2421
2421
  }
2422
- var isEmptyPath = (path50) => path50 == null || typeof path50 === "object" && !!path50[Symbol.iterator]().next().done;
2422
+ var isEmptyPath = (path49) => path49 == null || typeof path49 === "object" && !!path49[Symbol.iterator]().next().done;
2423
2423
  var Collection = class extends Node.NodeBase {
2424
2424
  constructor(type, schema) {
2425
2425
  super(type);
@@ -2449,11 +2449,11 @@ var require_Collection = __commonJS({
2449
2449
  * be a Pair instance or a `{ key, value }` object, which may not have a key
2450
2450
  * that already exists in the map.
2451
2451
  */
2452
- addIn(path50, value) {
2453
- if (isEmptyPath(path50))
2452
+ addIn(path49, value) {
2453
+ if (isEmptyPath(path49))
2454
2454
  this.add(value);
2455
2455
  else {
2456
- const [key, ...rest] = path50;
2456
+ const [key, ...rest] = path49;
2457
2457
  const node = this.get(key, true);
2458
2458
  if (identity.isCollection(node))
2459
2459
  node.addIn(rest, value);
@@ -2467,8 +2467,8 @@ var require_Collection = __commonJS({
2467
2467
  * Removes a value from the collection.
2468
2468
  * @returns `true` if the item was found and removed.
2469
2469
  */
2470
- deleteIn(path50) {
2471
- const [key, ...rest] = path50;
2470
+ deleteIn(path49) {
2471
+ const [key, ...rest] = path49;
2472
2472
  if (rest.length === 0)
2473
2473
  return this.delete(key);
2474
2474
  const node = this.get(key, true);
@@ -2482,8 +2482,8 @@ var require_Collection = __commonJS({
2482
2482
  * scalar values from their surrounding node; to disable set `keepScalar` to
2483
2483
  * `true` (collections are always returned intact).
2484
2484
  */
2485
- getIn(path50, keepScalar) {
2486
- const [key, ...rest] = path50;
2485
+ getIn(path49, keepScalar) {
2486
+ const [key, ...rest] = path49;
2487
2487
  const node = this.get(key, true);
2488
2488
  if (rest.length === 0)
2489
2489
  return !keepScalar && identity.isScalar(node) ? node.value : node;
@@ -2501,8 +2501,8 @@ var require_Collection = __commonJS({
2501
2501
  /**
2502
2502
  * Checks if the collection includes a value with the key `key`.
2503
2503
  */
2504
- hasIn(path50) {
2505
- const [key, ...rest] = path50;
2504
+ hasIn(path49) {
2505
+ const [key, ...rest] = path49;
2506
2506
  if (rest.length === 0)
2507
2507
  return this.has(key);
2508
2508
  const node = this.get(key, true);
@@ -2512,8 +2512,8 @@ var require_Collection = __commonJS({
2512
2512
  * Sets a value in this collection. For `!!set`, `value` needs to be a
2513
2513
  * boolean to add/remove the item from the set.
2514
2514
  */
2515
- setIn(path50, value) {
2516
- const [key, ...rest] = path50;
2515
+ setIn(path49, value) {
2516
+ const [key, ...rest] = path49;
2517
2517
  if (rest.length === 0) {
2518
2518
  this.set(key, value);
2519
2519
  } else {
@@ -5028,9 +5028,9 @@ var require_Document = __commonJS({
5028
5028
  this.contents.add(value);
5029
5029
  }
5030
5030
  /** Adds a value to the document. */
5031
- addIn(path50, value) {
5031
+ addIn(path49, value) {
5032
5032
  if (assertCollection(this.contents))
5033
- this.contents.addIn(path50, value);
5033
+ this.contents.addIn(path49, value);
5034
5034
  }
5035
5035
  /**
5036
5036
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -5105,14 +5105,14 @@ var require_Document = __commonJS({
5105
5105
  * Removes a value from the document.
5106
5106
  * @returns `true` if the item was found and removed.
5107
5107
  */
5108
- deleteIn(path50) {
5109
- if (Collection.isEmptyPath(path50)) {
5108
+ deleteIn(path49) {
5109
+ if (Collection.isEmptyPath(path49)) {
5110
5110
  if (this.contents == null)
5111
5111
  return false;
5112
5112
  this.contents = null;
5113
5113
  return true;
5114
5114
  }
5115
- return assertCollection(this.contents) ? this.contents.deleteIn(path50) : false;
5115
+ return assertCollection(this.contents) ? this.contents.deleteIn(path49) : false;
5116
5116
  }
5117
5117
  /**
5118
5118
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -5127,10 +5127,10 @@ var require_Document = __commonJS({
5127
5127
  * scalar values from their surrounding node; to disable set `keepScalar` to
5128
5128
  * `true` (collections are always returned intact).
5129
5129
  */
5130
- getIn(path50, keepScalar) {
5131
- if (Collection.isEmptyPath(path50))
5130
+ getIn(path49, keepScalar) {
5131
+ if (Collection.isEmptyPath(path49))
5132
5132
  return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
5133
- return identity.isCollection(this.contents) ? this.contents.getIn(path50, keepScalar) : void 0;
5133
+ return identity.isCollection(this.contents) ? this.contents.getIn(path49, keepScalar) : void 0;
5134
5134
  }
5135
5135
  /**
5136
5136
  * Checks if the document includes a value with the key `key`.
@@ -5141,10 +5141,10 @@ var require_Document = __commonJS({
5141
5141
  /**
5142
5142
  * Checks if the document includes a value at `path`.
5143
5143
  */
5144
- hasIn(path50) {
5145
- if (Collection.isEmptyPath(path50))
5144
+ hasIn(path49) {
5145
+ if (Collection.isEmptyPath(path49))
5146
5146
  return this.contents !== void 0;
5147
- return identity.isCollection(this.contents) ? this.contents.hasIn(path50) : false;
5147
+ return identity.isCollection(this.contents) ? this.contents.hasIn(path49) : false;
5148
5148
  }
5149
5149
  /**
5150
5150
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -5161,13 +5161,13 @@ var require_Document = __commonJS({
5161
5161
  * Sets a value in this document. For `!!set`, `value` needs to be a
5162
5162
  * boolean to add/remove the item from the set.
5163
5163
  */
5164
- setIn(path50, value) {
5165
- if (Collection.isEmptyPath(path50)) {
5164
+ setIn(path49, value) {
5165
+ if (Collection.isEmptyPath(path49)) {
5166
5166
  this.contents = value;
5167
5167
  } else if (this.contents == null) {
5168
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path50), value);
5168
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path49), value);
5169
5169
  } else if (assertCollection(this.contents)) {
5170
- this.contents.setIn(path50, value);
5170
+ this.contents.setIn(path49, value);
5171
5171
  }
5172
5172
  }
5173
5173
  /**
@@ -5553,10 +5553,10 @@ var require_resolve_block_map = __commonJS({
5553
5553
  let offset = bm.offset;
5554
5554
  let commentEnd = null;
5555
5555
  for (const collItem of bm.items) {
5556
- const { start, key, sep: sep15, value } = collItem;
5556
+ const { start, key, sep: sep14, value } = collItem;
5557
5557
  const keyProps = resolveProps.resolveProps(start, {
5558
5558
  indicator: "explicit-key-ind",
5559
- next: key ?? sep15?.[0],
5559
+ next: key ?? sep14?.[0],
5560
5560
  offset,
5561
5561
  onError,
5562
5562
  parentIndent: bm.indent,
@@ -5570,7 +5570,7 @@ var require_resolve_block_map = __commonJS({
5570
5570
  else if ("indent" in key && key.indent !== bm.indent)
5571
5571
  onError(offset, "BAD_INDENT", startColMsg);
5572
5572
  }
5573
- if (!keyProps.anchor && !keyProps.tag && !sep15) {
5573
+ if (!keyProps.anchor && !keyProps.tag && !sep14) {
5574
5574
  commentEnd = keyProps.end;
5575
5575
  if (keyProps.comment) {
5576
5576
  if (map.comment)
@@ -5594,7 +5594,7 @@ var require_resolve_block_map = __commonJS({
5594
5594
  ctx.atKey = false;
5595
5595
  if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
5596
5596
  onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
5597
- const valueProps = resolveProps.resolveProps(sep15 ?? [], {
5597
+ const valueProps = resolveProps.resolveProps(sep14 ?? [], {
5598
5598
  indicator: "map-value-ind",
5599
5599
  next: value,
5600
5600
  offset: keyNode.range[2],
@@ -5610,7 +5610,7 @@ var require_resolve_block_map = __commonJS({
5610
5610
  if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
5611
5611
  onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
5612
5612
  }
5613
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep15, null, valueProps, onError);
5613
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep14, null, valueProps, onError);
5614
5614
  if (ctx.schema.compat)
5615
5615
  utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
5616
5616
  offset = valueNode.range[2];
@@ -5701,7 +5701,7 @@ var require_resolve_end = __commonJS({
5701
5701
  let comment = "";
5702
5702
  if (end) {
5703
5703
  let hasSpace = false;
5704
- let sep15 = "";
5704
+ let sep14 = "";
5705
5705
  for (const token of end) {
5706
5706
  const { source, type } = token;
5707
5707
  switch (type) {
@@ -5715,13 +5715,13 @@ var require_resolve_end = __commonJS({
5715
5715
  if (!comment)
5716
5716
  comment = cb;
5717
5717
  else
5718
- comment += sep15 + cb;
5719
- sep15 = "";
5718
+ comment += sep14 + cb;
5719
+ sep14 = "";
5720
5720
  break;
5721
5721
  }
5722
5722
  case "newline":
5723
5723
  if (comment)
5724
- sep15 += source;
5724
+ sep14 += source;
5725
5725
  hasSpace = true;
5726
5726
  break;
5727
5727
  default:
@@ -5764,18 +5764,18 @@ var require_resolve_flow_collection = __commonJS({
5764
5764
  let offset = fc.offset + fc.start.source.length;
5765
5765
  for (let i = 0; i < fc.items.length; ++i) {
5766
5766
  const collItem = fc.items[i];
5767
- const { start, key, sep: sep15, value } = collItem;
5767
+ const { start, key, sep: sep14, value } = collItem;
5768
5768
  const props = resolveProps.resolveProps(start, {
5769
5769
  flow: fcName,
5770
5770
  indicator: "explicit-key-ind",
5771
- next: key ?? sep15?.[0],
5771
+ next: key ?? sep14?.[0],
5772
5772
  offset,
5773
5773
  onError,
5774
5774
  parentIndent: fc.indent,
5775
5775
  startOnNewline: false
5776
5776
  });
5777
5777
  if (!props.found) {
5778
- if (!props.anchor && !props.tag && !sep15 && !value) {
5778
+ if (!props.anchor && !props.tag && !sep14 && !value) {
5779
5779
  if (i === 0 && props.comma)
5780
5780
  onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
5781
5781
  else if (i < fc.items.length - 1)
@@ -5829,8 +5829,8 @@ var require_resolve_flow_collection = __commonJS({
5829
5829
  }
5830
5830
  }
5831
5831
  }
5832
- if (!isMap && !sep15 && !props.found) {
5833
- const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep15, null, props, onError);
5832
+ if (!isMap && !sep14 && !props.found) {
5833
+ const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep14, null, props, onError);
5834
5834
  coll.items.push(valueNode);
5835
5835
  offset = valueNode.range[2];
5836
5836
  if (isBlock(value))
@@ -5842,7 +5842,7 @@ var require_resolve_flow_collection = __commonJS({
5842
5842
  if (isBlock(key))
5843
5843
  onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
5844
5844
  ctx.atKey = false;
5845
- const valueProps = resolveProps.resolveProps(sep15 ?? [], {
5845
+ const valueProps = resolveProps.resolveProps(sep14 ?? [], {
5846
5846
  flow: fcName,
5847
5847
  indicator: "map-value-ind",
5848
5848
  next: value,
@@ -5853,8 +5853,8 @@ var require_resolve_flow_collection = __commonJS({
5853
5853
  });
5854
5854
  if (valueProps.found) {
5855
5855
  if (!isMap && !props.found && ctx.options.strict) {
5856
- if (sep15)
5857
- for (const st of sep15) {
5856
+ if (sep14)
5857
+ for (const st of sep14) {
5858
5858
  if (st === valueProps.found)
5859
5859
  break;
5860
5860
  if (st.type === "newline") {
@@ -5871,7 +5871,7 @@ var require_resolve_flow_collection = __commonJS({
5871
5871
  else
5872
5872
  onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
5873
5873
  }
5874
- const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep15, null, valueProps, onError) : null;
5874
+ const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep14, null, valueProps, onError) : null;
5875
5875
  if (valueNode) {
5876
5876
  if (isBlock(value))
5877
5877
  onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
@@ -6051,7 +6051,7 @@ var require_resolve_block_scalar = __commonJS({
6051
6051
  chompStart = i + 1;
6052
6052
  }
6053
6053
  let value = "";
6054
- let sep15 = "";
6054
+ let sep14 = "";
6055
6055
  let prevMoreIndented = false;
6056
6056
  for (let i = 0; i < contentStart; ++i)
6057
6057
  value += lines[i][0].slice(trimIndent) + "\n";
@@ -6068,24 +6068,24 @@ var require_resolve_block_scalar = __commonJS({
6068
6068
  indent = "";
6069
6069
  }
6070
6070
  if (type === Scalar.Scalar.BLOCK_LITERAL) {
6071
- value += sep15 + indent.slice(trimIndent) + content;
6072
- sep15 = "\n";
6071
+ value += sep14 + indent.slice(trimIndent) + content;
6072
+ sep14 = "\n";
6073
6073
  } else if (indent.length > trimIndent || content[0] === " ") {
6074
- if (sep15 === " ")
6075
- sep15 = "\n";
6076
- else if (!prevMoreIndented && sep15 === "\n")
6077
- sep15 = "\n\n";
6078
- value += sep15 + indent.slice(trimIndent) + content;
6079
- sep15 = "\n";
6074
+ if (sep14 === " ")
6075
+ sep14 = "\n";
6076
+ else if (!prevMoreIndented && sep14 === "\n")
6077
+ sep14 = "\n\n";
6078
+ value += sep14 + indent.slice(trimIndent) + content;
6079
+ sep14 = "\n";
6080
6080
  prevMoreIndented = true;
6081
6081
  } else if (content === "") {
6082
- if (sep15 === "\n")
6082
+ if (sep14 === "\n")
6083
6083
  value += "\n";
6084
6084
  else
6085
- sep15 = "\n";
6085
+ sep14 = "\n";
6086
6086
  } else {
6087
- value += sep15 + content;
6088
- sep15 = " ";
6087
+ value += sep14 + content;
6088
+ sep14 = " ";
6089
6089
  prevMoreIndented = false;
6090
6090
  }
6091
6091
  }
@@ -6267,25 +6267,25 @@ var require_resolve_flow_scalar = __commonJS({
6267
6267
  if (!match)
6268
6268
  return source;
6269
6269
  let res = match[1];
6270
- let sep15 = " ";
6270
+ let sep14 = " ";
6271
6271
  let pos = first.lastIndex;
6272
6272
  line.lastIndex = pos;
6273
6273
  while (match = line.exec(source)) {
6274
6274
  if (match[1] === "") {
6275
- if (sep15 === "\n")
6276
- res += sep15;
6275
+ if (sep14 === "\n")
6276
+ res += sep14;
6277
6277
  else
6278
- sep15 = "\n";
6278
+ sep14 = "\n";
6279
6279
  } else {
6280
- res += sep15 + match[1];
6281
- sep15 = " ";
6280
+ res += sep14 + match[1];
6281
+ sep14 = " ";
6282
6282
  }
6283
6283
  pos = line.lastIndex;
6284
6284
  }
6285
6285
  const last = /[ \t]*(.*)/sy;
6286
6286
  last.lastIndex = pos;
6287
6287
  match = last.exec(source);
6288
- return res + sep15 + (match?.[1] ?? "");
6288
+ return res + sep14 + (match?.[1] ?? "");
6289
6289
  }
6290
6290
  function doubleQuotedValue(source, onError) {
6291
6291
  let res = "";
@@ -7095,14 +7095,14 @@ var require_cst_stringify = __commonJS({
7095
7095
  }
7096
7096
  }
7097
7097
  }
7098
- function stringifyItem({ start, key, sep: sep15, value }) {
7098
+ function stringifyItem({ start, key, sep: sep14, value }) {
7099
7099
  let res = "";
7100
7100
  for (const st of start)
7101
7101
  res += st.source;
7102
7102
  if (key)
7103
7103
  res += stringifyToken(key);
7104
- if (sep15)
7105
- for (const st of sep15)
7104
+ if (sep14)
7105
+ for (const st of sep14)
7106
7106
  res += st.source;
7107
7107
  if (value)
7108
7108
  res += stringifyToken(value);
@@ -7127,9 +7127,9 @@ var require_cst_visit = __commonJS({
7127
7127
  visit.BREAK = BREAK;
7128
7128
  visit.SKIP = SKIP;
7129
7129
  visit.REMOVE = REMOVE;
7130
- visit.itemAtPath = (cst, path50) => {
7130
+ visit.itemAtPath = (cst, path49) => {
7131
7131
  let item = cst;
7132
- for (const [field, index] of path50) {
7132
+ for (const [field, index] of path49) {
7133
7133
  const tok = item?.[field];
7134
7134
  if (tok && "items" in tok) {
7135
7135
  item = tok.items[index];
@@ -7138,23 +7138,23 @@ var require_cst_visit = __commonJS({
7138
7138
  }
7139
7139
  return item;
7140
7140
  };
7141
- visit.parentCollection = (cst, path50) => {
7142
- const parent = visit.itemAtPath(cst, path50.slice(0, -1));
7143
- const field = path50[path50.length - 1][0];
7141
+ visit.parentCollection = (cst, path49) => {
7142
+ const parent = visit.itemAtPath(cst, path49.slice(0, -1));
7143
+ const field = path49[path49.length - 1][0];
7144
7144
  const coll = parent?.[field];
7145
7145
  if (coll && "items" in coll)
7146
7146
  return coll;
7147
7147
  throw new Error("Parent collection not found");
7148
7148
  };
7149
- function _visit(path50, item, visitor) {
7150
- let ctrl = visitor(item, path50);
7149
+ function _visit(path49, item, visitor) {
7150
+ let ctrl = visitor(item, path49);
7151
7151
  if (typeof ctrl === "symbol")
7152
7152
  return ctrl;
7153
7153
  for (const field of ["key", "value"]) {
7154
7154
  const token = item[field];
7155
7155
  if (token && "items" in token) {
7156
7156
  for (let i = 0; i < token.items.length; ++i) {
7157
- const ci = _visit(Object.freeze(path50.concat([[field, i]])), token.items[i], visitor);
7157
+ const ci = _visit(Object.freeze(path49.concat([[field, i]])), token.items[i], visitor);
7158
7158
  if (typeof ci === "number")
7159
7159
  i = ci - 1;
7160
7160
  else if (ci === BREAK)
@@ -7165,10 +7165,10 @@ var require_cst_visit = __commonJS({
7165
7165
  }
7166
7166
  }
7167
7167
  if (typeof ctrl === "function" && field === "key")
7168
- ctrl = ctrl(item, path50);
7168
+ ctrl = ctrl(item, path49);
7169
7169
  }
7170
7170
  }
7171
- return typeof ctrl === "function" ? ctrl(item, path50) : ctrl;
7171
+ return typeof ctrl === "function" ? ctrl(item, path49) : ctrl;
7172
7172
  }
7173
7173
  exports.visit = visit;
7174
7174
  }
@@ -8269,18 +8269,18 @@ var require_parser = __commonJS({
8269
8269
  if (this.type === "map-value-ind") {
8270
8270
  const prev = getPrevProps(this.peek(2));
8271
8271
  const start = getFirstKeyStartProps(prev);
8272
- let sep15;
8272
+ let sep14;
8273
8273
  if (scalar.end) {
8274
- sep15 = scalar.end;
8275
- sep15.push(this.sourceToken);
8274
+ sep14 = scalar.end;
8275
+ sep14.push(this.sourceToken);
8276
8276
  delete scalar.end;
8277
8277
  } else
8278
- sep15 = [this.sourceToken];
8278
+ sep14 = [this.sourceToken];
8279
8279
  const map = {
8280
8280
  type: "block-map",
8281
8281
  offset: scalar.offset,
8282
8282
  indent: scalar.indent,
8283
- items: [{ start, key: scalar, sep: sep15 }]
8283
+ items: [{ start, key: scalar, sep: sep14 }]
8284
8284
  };
8285
8285
  this.onKeyLine = true;
8286
8286
  this.stack[this.stack.length - 1] = map;
@@ -8433,15 +8433,15 @@ var require_parser = __commonJS({
8433
8433
  } else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
8434
8434
  const start2 = getFirstKeyStartProps(it.start);
8435
8435
  const key = it.key;
8436
- const sep15 = it.sep;
8437
- sep15.push(this.sourceToken);
8436
+ const sep14 = it.sep;
8437
+ sep14.push(this.sourceToken);
8438
8438
  delete it.key;
8439
8439
  delete it.sep;
8440
8440
  this.stack.push({
8441
8441
  type: "block-map",
8442
8442
  offset: this.offset,
8443
8443
  indent: this.indent,
8444
- items: [{ start: start2, key, sep: sep15 }]
8444
+ items: [{ start: start2, key, sep: sep14 }]
8445
8445
  });
8446
8446
  } else if (start.length > 0) {
8447
8447
  it.sep = it.sep.concat(start, this.sourceToken);
@@ -8635,13 +8635,13 @@ var require_parser = __commonJS({
8635
8635
  const prev = getPrevProps(parent);
8636
8636
  const start = getFirstKeyStartProps(prev);
8637
8637
  fixFlowSeqItems(fc);
8638
- const sep15 = fc.end.splice(1, fc.end.length);
8639
- sep15.push(this.sourceToken);
8638
+ const sep14 = fc.end.splice(1, fc.end.length);
8639
+ sep14.push(this.sourceToken);
8640
8640
  const map = {
8641
8641
  type: "block-map",
8642
8642
  offset: fc.offset,
8643
8643
  indent: fc.indent,
8644
- items: [{ start, key: fc, sep: sep15 }]
8644
+ items: [{ start, key: fc, sep: sep14 }]
8645
8645
  };
8646
8646
  this.onKeyLine = true;
8647
8647
  this.stack[this.stack.length - 1] = map;
@@ -12937,32 +12937,6 @@ function artefact_roots() {
12937
12937
  }
12938
12938
  return roots;
12939
12939
  }
12940
- function* iter_all_sources() {
12941
- const seen = /* @__PURE__ */ new Set();
12942
- for (const [root, prefix] of _root_specs()) {
12943
- for (const p of _rglobSorted2(root, "*")) {
12944
- if (!_isFile6(p)) {
12945
- continue;
12946
- }
12947
- if (p !== root && !_isUnder(p, root)) {
12948
- continue;
12949
- }
12950
- const rel = prefix + _relativeToPosix(p, root);
12951
- if (seen.has(rel)) {
12952
- continue;
12953
- }
12954
- seen.add(rel);
12955
- yield [p, rel];
12956
- }
12957
- }
12958
- for (const [p, rel] of _iter_domains_commands()) {
12959
- if (seen.has(rel)) {
12960
- continue;
12961
- }
12962
- seen.add(rel);
12963
- yield [p, rel];
12964
- }
12965
- }
12966
12940
  function* iter_commands() {
12967
12941
  const seen = /* @__PURE__ */ new Set();
12968
12942
  for (const [root, prefix] of _root_specs()) {
@@ -13020,44 +12994,13 @@ function resolve_logical(logical_rel) {
13020
12994
  }
13021
12995
  return null;
13022
12996
  }
13023
- function strip_source_prefix(rel) {
13024
- const posix = rel.replaceAll("\\", "/");
13025
- if (posix.startsWith(_LEGACY_PREFIX)) {
13026
- return posix.slice(_LEGACY_PREFIX.length);
13027
- }
13028
- if (posix.startsWith("packages/")) {
13029
- const idx = posix.indexOf(_PACKAGE_SUFFIX);
13030
- if (idx !== -1) {
13031
- return posix.slice(idx + _PACKAGE_SUFFIX.length);
13032
- }
13033
- }
13034
- if (posix.startsWith(_SRC_SKILLS_PREFIX)) {
13035
- return `skills/${posix.slice(_SRC_SKILLS_PREFIX.length)}`;
13036
- }
13037
- if (posix.startsWith(_SRC_RULES_PREFIX)) {
13038
- return `rules/${posix.slice(_SRC_RULES_PREFIX.length)}`;
13039
- }
13040
- if (posix.startsWith(_SRC_DOMAINS_PREFIX) && posix.endsWith("/command.md")) {
13041
- const rest = posix.slice(_SRC_DOMAINS_PREFIX.length);
13042
- const parts = rest.split("/");
13043
- if (parts.length >= 3) {
13044
- return `commands/${parts.slice(1, -1).join("/")}.md`;
13045
- }
13046
- }
13047
- return null;
13048
- }
13049
- var _HERE2, _DEFAULT_ROOT, _roots, _SRC_DOMAINS_PREFIX, _LEGACY_PREFIX, _PACKAGE_SUFFIX, _SRC_SKILLS_PREFIX, _SRC_RULES_PREFIX;
12997
+ var _HERE2, _DEFAULT_ROOT, _roots;
13050
12998
  var init_agent_src = __esm({
13051
12999
  "src/scripts/_lib/agent_src.ts"() {
13052
13000
  "use strict";
13053
13001
  _HERE2 = path16.dirname(fileURLToPath10(import.meta.url));
13054
13002
  _DEFAULT_ROOT = path16.resolve(_HERE2, "..", "..", "..");
13055
13003
  _roots = _deriveRoots(_DEFAULT_ROOT);
13056
- _SRC_DOMAINS_PREFIX = "src/domains/";
13057
- _LEGACY_PREFIX = ".agent-src.uncondensed/";
13058
- _PACKAGE_SUFFIX = "/.agent-src.uncondensed/";
13059
- _SRC_SKILLS_PREFIX = "src/skills/";
13060
- _SRC_RULES_PREFIX = "src/rules/";
13061
13004
  }
13062
13005
  });
13063
13006
 
@@ -17325,17 +17268,17 @@ function freshMatch(pattern, text) {
17325
17268
  const re = new RegExp(pattern.source, pattern.flags);
17326
17269
  return re.exec(text);
17327
17270
  }
17328
- function splitN(text, sep15, maxsplit) {
17271
+ function splitN(text, sep14, maxsplit) {
17329
17272
  const parts = [];
17330
17273
  let rest = text;
17331
17274
  let count = 0;
17332
17275
  while (count < maxsplit) {
17333
- const idx = rest.indexOf(sep15);
17276
+ const idx = rest.indexOf(sep14);
17334
17277
  if (idx === -1) {
17335
17278
  break;
17336
17279
  }
17337
17280
  parts.push(rest.slice(0, idx));
17338
- rest = rest.slice(idx + sep15.length);
17281
+ rest = rest.slice(idx + sep14.length);
17339
17282
  count += 1;
17340
17283
  }
17341
17284
  parts.push(rest);
@@ -19802,8 +19745,8 @@ function atomicAppendLine(target, line) {
19802
19745
  } catch {
19803
19746
  existing = "";
19804
19747
  }
19805
- const sep15 = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
19806
- atomicWriteFile(target, `${existing}${sep15}${line}
19748
+ const sep14 = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
19749
+ atomicWriteFile(target, `${existing}${sep14}${line}
19807
19750
  `);
19808
19751
  }
19809
19752
  function randSuffix() {
@@ -21018,8 +20961,8 @@ function lockfile_path(env) {
21018
20961
  }
21019
20962
  return write_target("installed.lock", { env: env ?? null });
21020
20963
  }
21021
- function read_lockfile(path50) {
21022
- const target = path50 ?? lockfile_path();
20964
+ function read_lockfile(path49) {
20965
+ const target = path49 ?? lockfile_path();
21023
20966
  let text;
21024
20967
  try {
21025
20968
  text = fs31.readFileSync(target, { encoding: "utf-8" });
@@ -21229,18 +21172,18 @@ function manifest_path(project_root, env) {
21229
21172
  }
21230
21173
  return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
21231
21174
  }
21232
- function read_manifest(path50) {
21175
+ function read_manifest(path49) {
21233
21176
  let text;
21234
21177
  try {
21235
- text = require_read_text(path50);
21178
+ text = require_read_text(path49);
21236
21179
  } catch {
21237
21180
  return null;
21238
21181
  }
21239
21182
  const data = _parse_manual(text);
21240
21183
  return _normalise_v2_shape(data);
21241
21184
  }
21242
- function require_read_text(path50) {
21243
- return fs33.readFileSync(path50, { encoding: "utf-8" });
21185
+ function require_read_text(path49) {
21186
+ return fs33.readFileSync(path49, { encoding: "utf-8" });
21244
21187
  }
21245
21188
  function _normalise_v2_shape(data) {
21246
21189
  if (data["tools"] === void 0 || data["tools"] === null) {
@@ -21421,9 +21364,9 @@ function stable_sort(items, key) {
21421
21364
  return a.index - b.index;
21422
21365
  }).map((entry) => entry.item);
21423
21366
  }
21424
- function write_manifest(path50, version, tools, options = {}) {
21367
+ function write_manifest(path49, version, tools, options = {}) {
21425
21368
  const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
21426
- return write_atomic(path50, rendered);
21369
+ return write_atomic(path49, rendered);
21427
21370
  }
21428
21371
  function upsert_tool(existing, options) {
21429
21372
  const {
@@ -21545,6 +21488,7 @@ __export(global_deploy_inventory_exports, {
21545
21488
  SCHEMA_VERSION: () => SCHEMA_VERSION5,
21546
21489
  expected_deploy_files: () => expected_deploy_files,
21547
21490
  inventory_path: () => inventory_path,
21491
+ is_ancestor: () => is_ancestor,
21548
21492
  load_inventory: () => load_inventory,
21549
21493
  reap_stale: () => reap_stale,
21550
21494
  reap_tagged_orphans: () => reap_tagged_orphans,
@@ -21699,7 +21643,7 @@ function json_string_ascii(s) {
21699
21643
  }
21700
21644
  return out;
21701
21645
  }
21702
- function expected_deploy_files(src, dest_rel) {
21646
+ function expected_deploy_files(src, dest_rel, file_filter = null) {
21703
21647
  const out = /* @__PURE__ */ new Set();
21704
21648
  let src_stat;
21705
21649
  try {
@@ -21708,6 +21652,9 @@ function expected_deploy_files(src, dest_rel) {
21708
21652
  return out;
21709
21653
  }
21710
21654
  if (!src_stat.isDirectory()) {
21655
+ if (file_filter !== null && !file_filter(src)) {
21656
+ return out;
21657
+ }
21711
21658
  out.add(as_posix(dest_rel));
21712
21659
  return out;
21713
21660
  }
@@ -21731,6 +21678,9 @@ function expected_deploy_files(src, dest_rel) {
21731
21678
  _walk(fs34.realpathSync(entry), rel);
21732
21679
  continue;
21733
21680
  }
21681
+ if (file_filter !== null && !file_filter(entry)) {
21682
+ continue;
21683
+ }
21734
21684
  out.add(as_posix(rel));
21735
21685
  }
21736
21686
  };
@@ -26205,253 +26155,9 @@ var init_review_gate = __esm({
26205
26155
  }
26206
26156
  });
26207
26157
 
26208
- // src/scripts/_lib/claude_builtin_names.ts
26209
- function is_claude_builtin_name(slug) {
26210
- return CLAUDE_CODE_BUILTIN_NAMES.has(slug.toLowerCase());
26211
- }
26212
- var _CURRENT, _LEGACY, CLAUDE_CODE_BUILTIN_NAMES;
26213
- var init_claude_builtin_names = __esm({
26214
- "src/scripts/_lib/claude_builtin_names.ts"() {
26215
- "use strict";
26216
- _CURRENT = [
26217
- "add-dir",
26218
- "advisor",
26219
- "agents",
26220
- "autofix-pr",
26221
- "background",
26222
- "batch",
26223
- "branch",
26224
- "btw",
26225
- "cd",
26226
- "chrome",
26227
- "claude-api",
26228
- "clear",
26229
- "code-review",
26230
- "color",
26231
- "compact",
26232
- "config",
26233
- "context",
26234
- "copy",
26235
- "cost",
26236
- "dataviz",
26237
- "debug",
26238
- "deep-research",
26239
- "design-login",
26240
- "design-sync",
26241
- "desktop",
26242
- "diff",
26243
- "doctor",
26244
- "effort",
26245
- "exit",
26246
- "export",
26247
- "fast",
26248
- "feedback",
26249
- "fewer-permission-prompts",
26250
- "focus",
26251
- "fork",
26252
- "goal",
26253
- "heapdump",
26254
- "help",
26255
- "hooks",
26256
- "ide",
26257
- "init",
26258
- "insights",
26259
- "install-github-app",
26260
- "install-slack-app",
26261
- "keybindings",
26262
- "login",
26263
- "logout",
26264
- "loop",
26265
- "mcp",
26266
- "memory",
26267
- "mobile",
26268
- "model",
26269
- "passes",
26270
- "permissions",
26271
- "plan",
26272
- "plugin",
26273
- "powerup",
26274
- "pr-comments",
26275
- "privacy-settings",
26276
- "radio",
26277
- "recap",
26278
- "release-notes",
26279
- "reload-plugins",
26280
- "reload-skills",
26281
- "remote-control",
26282
- "remote-env",
26283
- "rename",
26284
- "resume",
26285
- "review",
26286
- "rewind",
26287
- "run",
26288
- "run-skill-generator",
26289
- "sandbox",
26290
- "schedule",
26291
- "scroll-speed",
26292
- "security-review",
26293
- "setup-bedrock",
26294
- "setup-vertex",
26295
- "simplify",
26296
- "skills",
26297
- "stats",
26298
- "status",
26299
- "statusline",
26300
- "stickers",
26301
- "teleport",
26302
- "thinking",
26303
- "trust",
26304
- "upgrade",
26305
- "usage",
26306
- "verify",
26307
- "vim",
26308
- "web",
26309
- "whats-new",
26310
- "workflow",
26311
- "workflows",
26312
- "worktree"
26313
- ];
26314
- _LEGACY = [
26315
- "bashes",
26316
- "bug",
26317
- "migrate-installer",
26318
- "output-style",
26319
- "terminal-setup",
26320
- "theme",
26321
- "todos"
26322
- ];
26323
- CLAUDE_CODE_BUILTIN_NAMES = /* @__PURE__ */ new Set([
26324
- ..._CURRENT,
26325
- ..._LEGACY
26326
- ]);
26327
- }
26328
- });
26329
-
26330
- // src/scripts/_lib/compile_time_toggles.ts
26331
- function rule_is_compile_enabled(rule_id, settings) {
26332
- const predicate = COMPILE_TIME_TOGGLES[rule_id];
26333
- return predicate === void 0 ? true : predicate(settings);
26334
- }
26335
- var COMPILE_TIME_TOGGLES;
26336
- var init_compile_time_toggles = __esm({
26337
- "src/scripts/_lib/compile_time_toggles.ts"() {
26338
- "use strict";
26339
- COMPILE_TIME_TOGGLES = {
26340
- // `speak` defaults FALSE (dormant) per docs/adrs/telegraph/0002 — the absent-key
26341
- // fallback used to be `true`, which silently contradicted ADR 0001 (accepted,
26342
- // "default off until bench"). Measured basis: median vs_terse −9.27% (API) /
26343
- // −5.47% (exact cl100k_base) — telegraph emits MORE than a plain "be terse".
26344
- // Opt back in with an explicit `telegraph.speak: true` once an output-side bench
26345
- // clears the kill-criterion bar. `enabled` keeps its true default: it is the
26346
- // family master switch, and flipping it would silence sibling telegraph settings
26347
- // that were never measured negative.
26348
- //
26349
- // This predicate deliberately does NOT read `speak_scope`. That key disables the
26350
- // rule's *behaviour* and never removed its token cost — the trap the measurement
26351
- // exposed.
26352
- "telegraph-speak": (s) => {
26353
- const tg = s["telegraph"] ?? {};
26354
- const enabled = tg["enabled"] === void 0 ? true : tg["enabled"];
26355
- const speak = tg["speak"] === void 0 ? false : tg["speak"];
26356
- return Boolean(enabled) && Boolean(speak);
26357
- }
26358
- };
26359
- }
26360
- });
26361
-
26362
- // src/scripts/_lib/script_output.ts
26363
- function _read_settings_level(settings_path) {
26364
- const data = load_agent_settings({ project_path: settings_path });
26365
- const section = data["verbosity"];
26366
- if (typeof section !== "object" || section === null || Array.isArray(section)) {
26367
- return null;
26368
- }
26369
- const value = section["script_output"];
26370
- if (typeof value === "string" && VALID_LEVELS.includes(value)) {
26371
- return value;
26372
- }
26373
- return null;
26374
- }
26375
- function resolve_level(settings_path = null) {
26376
- if (_resolved_level !== null) {
26377
- return _resolved_level;
26378
- }
26379
- const env_value = (process.env[ENV_VAR] ?? "").trim().toLowerCase();
26380
- if (VALID_LEVELS.includes(env_value)) {
26381
- _resolved_level = env_value;
26382
- } else if ((process.env[ENV_ALIAS] ?? "").trim() === "1") {
26383
- _resolved_level = "verbose";
26384
- } else {
26385
- const p = settings_path ?? SETTINGS_FILE2;
26386
- _resolved_level = _read_settings_level(p) ?? DEFAULT_LEVEL;
26387
- }
26388
- process.env[ENV_VAR] = _resolved_level;
26389
- return _resolved_level;
26390
- }
26391
- function info(message) {
26392
- if (resolve_level() === "verbose") {
26393
- process.stdout.write(`${message}
26394
- `);
26395
- }
26396
- }
26397
- function success(message) {
26398
- const level = resolve_level();
26399
- if (level === "verbose") {
26400
- process.stdout.write(`${message}
26401
- `);
26402
- } else if (level === "minimal") {
26403
- _pending_summary.push(message);
26404
- }
26405
- }
26406
- function flush_summary(headline = null) {
26407
- const level = resolve_level();
26408
- if (level !== "minimal" || _pending_summary.length === 0) {
26409
- return;
26410
- }
26411
- if (headline) {
26412
- process.stdout.write(`${headline}
26413
- `);
26414
- } else {
26415
- process.stdout.write(`${_pending_summary[_pending_summary.length - 1]}
26416
- `);
26417
- }
26418
- _pending_summary.length = 0;
26419
- }
26420
- var VALID_LEVELS, DEFAULT_LEVEL, ENV_VAR, ENV_ALIAS, SETTINGS_FILE2, _resolved_level, _pending_summary;
26421
- var init_script_output = __esm({
26422
- "src/scripts/_lib/script_output.ts"() {
26423
- "use strict";
26424
- init_agent_settings();
26425
- VALID_LEVELS = ["silent", "minimal", "verbose"];
26426
- DEFAULT_LEVEL = "minimal";
26427
- ENV_VAR = "AGENT_SCRIPT_VERBOSITY";
26428
- ENV_ALIAS = "SCRIPT_OUTPUT_VERBOSE";
26429
- SETTINGS_FILE2 = ".agent-settings.yml";
26430
- _resolved_level = null;
26431
- _pending_summary = [];
26432
- }
26433
- });
26434
-
26435
- // src/scripts/_lib/model_tier.ts
26436
- var TIER_TO_CLAUDE_MODEL, MODEL_TIER_RE;
26437
- var init_model_tier = __esm({
26438
- "src/scripts/_lib/model_tier.ts"() {
26439
- "use strict";
26440
- TIER_TO_CLAUDE_MODEL = {
26441
- high: "opus",
26442
- medium: "sonnet",
26443
- lite: "haiku"
26444
- };
26445
- MODEL_TIER_RE = /^model_tier:\s*"?([a-z]+)"?\s*$/m;
26446
- }
26447
- });
26448
-
26449
- // src/scripts/condense.ts
26158
+ // src/install/ruleInScope.ts
26450
26159
  import * as fs41 from "node:fs";
26451
- import * as os11 from "node:os";
26452
- import * as path39 from "node:path";
26453
- import { fileURLToPath as fileURLToPath23, pathToFileURL as pathToFileURL15 } from "node:url";
26454
- function _yamlParse(text) {
26160
+ function parseYaml4(text) {
26455
26161
  try {
26456
26162
  const data = YAML4.parse(text, { version: "1.1" });
26457
26163
  return data === void 0 ? null : data;
@@ -26459,604 +26165,36 @@ function _yamlParse(text) {
26459
26165
  return null;
26460
26166
  }
26461
26167
  }
26462
- function _exists6(p) {
26463
- try {
26464
- fs41.lstatSync(p);
26465
- fs41.statSync(p);
26466
- return true;
26467
- } catch {
26468
- return false;
26469
- }
26470
- }
26471
- function _existsOrSymlink(p) {
26472
- try {
26473
- fs41.lstatSync(p);
26474
- return true;
26475
- } catch {
26476
- return false;
26477
- }
26478
- }
26479
- function _isDir11(p) {
26480
- try {
26481
- return fs41.statSync(p).isDirectory();
26482
- } catch {
26483
- return false;
26484
- }
26485
- }
26486
- function _isFile13(p) {
26487
- try {
26488
- return fs41.statSync(p).isFile();
26489
- } catch {
26490
- return false;
26491
- }
26492
- }
26493
- function _isSymlink2(p) {
26494
- try {
26495
- return fs41.lstatSync(p).isSymbolicLink();
26496
- } catch {
26497
- return false;
26498
- }
26499
- }
26500
- function _isDirNoFollow(p) {
26501
- try {
26502
- return fs41.lstatSync(p).isDirectory();
26503
- } catch {
26504
- return false;
26505
- }
26506
- }
26507
- function _readText2(p) {
26508
- return fs41.readFileSync(p, "utf-8");
26509
- }
26510
- function _writeText2(p, text) {
26511
- fs41.writeFileSync(p, text, "utf-8");
26512
- }
26513
- function _mkdirp(p) {
26514
- fs41.mkdirSync(p, { recursive: true });
26515
- }
26516
- function _iterdirSorted4(p) {
26517
- let names;
26518
- try {
26519
- names = fs41.readdirSync(p);
26520
- } catch {
26521
- return [];
26522
- }
26523
- names.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
26524
- return names.map((n) => path39.join(p, n));
26525
- }
26526
- function _rglobSorted4(root, pattern) {
26527
- const out = [];
26528
- const suffix = pattern === "*" ? null : pattern.slice(1);
26529
- const walk = (dir) => {
26530
- let entries;
26531
- try {
26532
- entries = fs41.readdirSync(dir, { withFileTypes: true });
26533
- } catch {
26534
- return;
26535
- }
26536
- for (const ent of entries) {
26537
- const full = path39.join(dir, ent.name);
26538
- const matches = suffix === null ? true : ent.name.endsWith(suffix);
26539
- if (matches) {
26540
- out.push(full);
26541
- }
26542
- if (ent.isDirectory() || ent.isSymbolicLink() && _isDir11(full)) {
26543
- walk(full);
26544
- }
26545
- }
26546
- };
26547
- walk(root);
26548
- out.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
26549
- return out;
26550
- }
26551
- function _relativeToPosix2(child, root) {
26552
- const rel = path39.relative(root, child);
26553
- return rel.split(path39.sep).join("/");
26554
- }
26555
- function _isUnder2(child, root) {
26556
- const rel = path39.relative(root, child);
26557
- return rel !== "" && !rel.startsWith("..") && !path39.isAbsolute(rel);
26558
- }
26559
- function _posixParts(p) {
26560
- return p.split("/").filter((s) => s.length > 0);
26561
- }
26562
- function _lstrip(s) {
26563
- return s.replace(/^\s+/u, "");
26564
- }
26565
- function _strip6(s) {
26168
+ function strip(s) {
26566
26169
  return s.replace(/^\s+/u, "").replace(/\s+$/u, "");
26567
26170
  }
26568
- function _lstripNewlines2(s) {
26171
+ function lstripNewlines(s) {
26569
26172
  return s.replace(/^\n+/, "");
26570
26173
  }
26571
- function _stripChars(s, chars) {
26572
- let start = 0;
26573
- let end = s.length;
26574
- while (start < end && chars.includes(s[start])) start += 1;
26575
- while (end > start && chars.includes(s[end - 1])) end -= 1;
26576
- return s.slice(start, end);
26577
- }
26578
- function _deriveState(root) {
26579
- return {
26580
- PROJECT_ROOT: root,
26581
- SOURCE_DIR: path39.join(root, ".agent-src.uncondensed"),
26582
- TARGET_DIR: path39.join(root, "dist/agent-src"),
26583
- AUGMENT_DIR: path39.join(root, ".augment"),
26584
- SETTINGS_FILE: project_settings_path(root),
26585
- RULES_SOURCE: path39.join(root, "dist/agent-src", "rules"),
26586
- SKILLS_SOURCE: path39.join(root, "dist/agent-src", "skills"),
26587
- COMMANDS_SOURCE: path39.join(root, "dist/agent-src", "commands"),
26588
- PERSONAS_SOURCE: path39.join(root, "dist/agent-src", "personas"),
26589
- USER_TYPES_SOURCE: path39.join(root, "dist/agent-src", "user-types"),
26590
- CLAUDE_SKILLS_DIR: path39.join(root, ".claude", "skills"),
26591
- // ADR-109: subagents project from src/ directly (NOT dist/) — a subagent
26592
- // is an executable system prompt Claude Code runs verbatim; telegraph
26593
- // condensation would alter its behaviour, and it is not routed through the
26594
- // pack/discovery condensation flow.
26595
- CLAUDE_AGENTS_DIR: path39.join(root, ".claude", "agents"),
26596
- SUBAGENTS_SOURCE: path39.join(root, "src", "subagents"),
26597
- PLUGIN_SKILLS_DIR: path39.join(root, ".claude-plugin", "skills"),
26598
- iter_all_sources,
26599
- resolve_logical,
26600
- artefact_roots
26601
- };
26602
- }
26603
- function _iter_sources() {
26604
- return MODULE_STATE.iter_all_sources();
26605
- }
26606
- function _resolve_source(relative15) {
26607
- return MODULE_STATE.resolve_logical(relative15);
26608
- }
26609
- function _any_source_root_exists() {
26610
- return [...MODULE_STATE.artefact_roots()].length > 0;
26611
- }
26612
- function _active_tools() {
26613
- const tools_file = path39.join(MODULE_STATE.PROJECT_ROOT, "agents", ".agent-tools.yml");
26614
- if (!_exists6(tools_file)) {
26615
- return null;
26616
- }
26617
- let data = _yamlParse(_readText2(tools_file));
26618
- if (data === null || data === void 0) {
26619
- data = {};
26620
- }
26621
- const tools = typeof data === "object" && data !== null && !Array.isArray(data) ? data["tools"] : null;
26622
- if (!Array.isArray(tools)) {
26623
- return null;
26624
- }
26625
- return new Set(tools.filter((t) => typeof t === "string"));
26626
- }
26627
- function _tool_active(tool_id) {
26628
- const active = _active_tools();
26629
- return active === null ? true : active.has(tool_id);
26630
- }
26631
- function _read_augment_rules_use_symlinks() {
26632
- const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
26633
- const augment = data["augment"];
26634
- if (typeof augment !== "object" || augment === null || Array.isArray(augment)) {
26635
- return false;
26636
- }
26637
- const value = augment["rules_use_symlinks"];
26638
- if (typeof value === "boolean") {
26639
- return value;
26640
- }
26641
- if (typeof value === "string") {
26642
- return ["true", "yes", "on", "1"].includes(value.trim().toLowerCase());
26643
- }
26644
- if (typeof value === "number") {
26645
- return value === 1;
26646
- }
26647
- return false;
26648
- }
26649
- function _read_projection_scope_dedup() {
26650
- const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
26651
- const projection = data["projection"];
26652
- if (typeof projection !== "object" || projection === null || Array.isArray(projection)) {
26653
- return false;
26654
- }
26655
- const value = projection["scope_dedup"];
26656
- if (typeof value === "boolean") {
26657
- return value;
26658
- }
26659
- if (typeof value === "string") {
26660
- return ["true", "yes", "on", "1"].includes(value.trim().toLowerCase());
26661
- }
26662
- return false;
26663
- }
26664
- function _dedupable_rules(tool_dir, rules, userHome) {
26665
- const relative15 = USER_SCOPE_RULE_DIRS[tool_dir];
26666
- if (relative15 === void 0) {
26667
- return /* @__PURE__ */ new Set();
26668
- }
26669
- let userDirStat;
26670
- const userDir = path39.join(userHome, relative15);
26671
- try {
26672
- userDirStat = fs41.statSync(userDir);
26673
- } catch {
26674
- return /* @__PURE__ */ new Set();
26675
- }
26676
- if (!userDirStat.isDirectory()) {
26677
- return /* @__PURE__ */ new Set();
26678
- }
26679
- if ((userDirStat.mode & 2) !== 0) {
26680
- _print3(` \u26A0\uFE0F ${tool_dir}: user-scope rules dir is world-writable \u2014 scope-dedup skipped`);
26681
- return /* @__PURE__ */ new Set();
26682
- }
26683
- const skip = /* @__PURE__ */ new Set();
26684
- for (const rule of rules) {
26685
- const twin = path39.join(userDir, rule);
26686
- const source = path39.join(MODULE_STATE.RULES_SOURCE, rule);
26687
- try {
26688
- if (!_isFile13(twin) || !_isFile13(source)) continue;
26689
- if (fs41.readFileSync(twin).equals(fs41.readFileSync(source))) {
26690
- skip.add(rule);
26691
- }
26692
- } catch {
26693
- }
26694
- }
26695
- return skip;
26696
- }
26697
- function _lean_projection_mode() {
26698
- const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
26699
- const lean = data["lean_projection"];
26700
- if (typeof lean === "object" && lean !== null && !Array.isArray(lean) && String(lean["mode"] ?? "").trim().toLowerCase() === "thin") {
26701
- return "thin";
26702
- }
26703
- return "eager-all";
26704
- }
26705
- function apply_path_rewriter(relative_path) {
26706
- const target = path39.join(MODULE_STATE.TARGET_DIR, relative_path);
26707
- if (!_exists6(target) || !relative_path.endsWith(".md")) {
26708
- return false;
26709
- }
26710
- const original = _readText2(target);
26711
- const rewritten = _rewrite_paths(original, relative_path);
26712
- if (rewritten === original) {
26713
- return false;
26714
- }
26715
- _writeText2(target, rewritten);
26716
- return true;
26717
- }
26718
- function is_projection_stale(relative15) {
26719
- const source = _resolve_source(relative15);
26720
- if (source === null) {
26721
- return false;
26722
- }
26723
- if (skip_compile_disabled_rule(relative15)) {
26724
- return false;
26725
- }
26726
- const target = path39.join(MODULE_STATE.TARGET_DIR, relative15);
26727
- if (!_exists6(target)) {
26728
- return true;
26729
- }
26730
- return _readText2(target) !== _rewrite_paths(_readText2(source), relative15);
26731
- }
26732
- function list_changed_md(_source_dir) {
26733
- const changed = [];
26734
- const seen = /* @__PURE__ */ new Set();
26735
- for (const [, relative15] of _iter_sources()) {
26736
- if (seen.has(relative15)) {
26737
- continue;
26738
- }
26739
- seen.add(relative15);
26740
- const source = _resolve_source(relative15);
26741
- if (source === null || !should_condense(source)) {
26742
- continue;
26743
- }
26744
- if (is_projection_stale(relative15)) {
26745
- changed.push(relative15);
26746
- }
26747
- }
26748
- return changed;
26749
- }
26750
- function should_condense(filepath) {
26751
- if (path39.extname(filepath) !== ".md") {
26752
- return false;
26753
- }
26754
- if (COPY_AS_IS.has(path39.basename(filepath))) {
26755
- return false;
26756
- }
26757
- let rel_parts = filepath.split(path39.sep).filter((s) => s.length > 0);
26758
- for (const root of MODULE_STATE.artefact_roots()) {
26759
- if (filepath !== root && !_isUnder2(filepath, root)) {
26760
- continue;
26761
- }
26762
- rel_parts = _relativeToPosix2(filepath, root).split("/");
26763
- break;
26764
- }
26765
- if (rel_parts.length > 0 && COPY_AS_IS_DIRS.has(rel_parts[0])) {
26766
- return false;
26767
- }
26768
- return true;
26769
- }
26770
- function copy_file(source, target) {
26771
- _mkdirp(path39.dirname(target));
26772
- fs41.copyFileSync(source, target);
26773
- try {
26774
- const st = fs41.statSync(source);
26775
- fs41.utimesSync(target, st.atime, st.mtime);
26776
- fs41.chmodSync(target, st.mode);
26777
- } catch {
26778
- }
26779
- }
26780
- function cleanup_stale(_source_dir, target_dir) {
26781
- let deleted = 0;
26782
- if (!_exists6(target_dir)) {
26783
- return 0;
26784
- }
26785
- for (const target_file of _rglobSorted4(target_dir, "*")) {
26786
- if (_isDir11(target_file)) {
26787
- continue;
26788
- }
26789
- const relative15 = _relativeToPosix2(target_file, target_dir);
26790
- if (_resolve_source(relative15) === null) {
26791
- _print3(` Deleting stale: ${relative15}`);
26792
- fs41.unlinkSync(target_file);
26793
- deleted += 1;
26794
- }
26795
- }
26796
- const dirs = _rglobSorted4(target_dir, "*").filter((p) => _isDir11(p)).sort((a, b) => a < b ? 1 : a > b ? -1 : 0);
26797
- for (const dirpath of dirs) {
26798
- try {
26799
- if (fs41.readdirSync(dirpath).length === 0) {
26800
- fs41.rmdirSync(dirpath);
26801
- _print3(` Removing empty dir: ${_relativeToPosix2(dirpath, target_dir)}`);
26802
- }
26803
- } catch {
26804
- }
26805
- }
26806
- return deleted;
26807
- }
26808
- function skip_compile_disabled_rule(relative15) {
26809
- const posix = relative15.split(path39.sep).join("/");
26810
- if (!posix.startsWith("rules/") || !posix.endsWith(".md")) {
26811
- return false;
26812
- }
26813
- const rule_id = path39.basename(posix, ".md");
26814
- const settings = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
26815
- return !rule_is_compile_enabled(rule_id, settings);
26816
- }
26817
- function sync_non_md(_source_dir, target_dir) {
26818
- let copied = 0;
26819
- const seen = /* @__PURE__ */ new Set();
26820
- for (const [source_file, relative15] of _iter_sources()) {
26821
- if (!COPY_MD_VERBATIM && should_condense(source_file)) {
26822
- continue;
26823
- }
26824
- if (seen.has(relative15)) {
26825
- continue;
26826
- }
26827
- if (skip_compile_disabled_rule(relative15)) {
26828
- continue;
26829
- }
26830
- seen.add(relative15);
26831
- const target_file = path39.join(target_dir, relative15);
26832
- copy_file(source_file, target_file);
26833
- if (COPY_MD_VERBATIM && relative15.endsWith(".md")) {
26834
- apply_path_rewriter(relative15);
26835
- }
26836
- _print3(` Copied: ${relative15}`);
26837
- copied += 1;
26838
- }
26839
- return copied;
26840
- }
26841
- function list_md_files(_source_dir) {
26842
- const files = [];
26843
- const seen = /* @__PURE__ */ new Set();
26844
- for (const [source_file, relative15] of _iter_sources()) {
26845
- if (!should_condense(source_file)) {
26846
- continue;
26847
- }
26848
- if (seen.has(relative15)) {
26849
- continue;
26850
- }
26851
- seen.add(relative15);
26852
- files.push(relative15);
26853
- }
26854
- return files.sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
26855
- }
26856
- function check_sync(_source_dir, target_dir) {
26857
- const missing = [];
26858
- const stale = [];
26859
- const seen = /* @__PURE__ */ new Set();
26860
- for (const [, relative15] of _iter_sources()) {
26861
- if (seen.has(relative15)) {
26862
- continue;
26863
- }
26864
- seen.add(relative15);
26865
- if (skip_compile_disabled_rule(relative15)) {
26866
- continue;
26867
- }
26868
- if (!_exists6(path39.join(target_dir, relative15))) {
26869
- missing.push(relative15);
26870
- }
26871
- }
26872
- if (_exists6(target_dir)) {
26873
- for (const target_file of _rglobSorted4(target_dir, "*")) {
26874
- if (_isDir11(target_file)) {
26875
- continue;
26876
- }
26877
- const relative15 = _relativeToPosix2(target_file, target_dir);
26878
- if (_resolve_source(relative15) === null || skip_compile_disabled_rule(relative15)) {
26879
- stale.push(relative15);
26880
- }
26881
- }
26882
- }
26883
- return [missing, stale];
26884
- }
26885
- function _filter_tool_dirs(mapping) {
26886
- const out = {};
26887
- for (const [d, p] of Object.entries(mapping)) {
26888
- if (_tool_active(_DIR_TOOL_ID[d] ?? "claude-code")) {
26889
- out[d] = p;
26890
- }
26891
- }
26892
- return out;
26893
- }
26894
- function strip_frontmatter(content) {
26895
- if (content.startsWith("---")) {
26896
- const end = content.indexOf("---", 3);
26897
- if (end !== -1) {
26898
- content = _lstripNewlines2(content.slice(end + 3));
26899
- }
26900
- }
26901
- return content;
26902
- }
26903
- function _depth_prefix(source_relative_path) {
26904
- const parts = _posixParts(source_relative_path);
26905
- const depth = Math.max(parts.length - 1, 1);
26906
- return "../".repeat(depth);
26907
- }
26908
- function _split_frontmatter(content) {
26909
- if (!content.startsWith("---\n")) {
26910
- return [null, content];
26174
+ function parseFrontmatter(content) {
26175
+ if (!content.startsWith("---")) {
26176
+ return [{}, content];
26911
26177
  }
26912
- const end = content.indexOf("\n---\n", 4);
26178
+ const end = content.indexOf("\n---", 3);
26913
26179
  if (end === -1) {
26914
- return [null, content];
26915
- }
26916
- const fm_text = content.slice(4, end);
26917
- const body = content.slice(end + "\n---\n".length);
26918
- return [fm_text.split("\n"), body];
26919
- }
26920
- function _rewrite_load_context_value(value, prefix) {
26921
- if (value.startsWith("../") || value.startsWith("./") || value.startsWith("/")) {
26922
- return value;
26923
- }
26924
- if (value.startsWith(_LEGACY_SRC_PREFIX)) {
26925
- return prefix + value.slice(_LEGACY_SRC_PREFIX.length);
26926
- }
26927
- if (value.startsWith(_PROJECTED_SRC_PREFIX)) {
26928
- return prefix + value.slice(_PROJECTED_SRC_PREFIX.length);
26929
- }
26930
- if (value.startsWith(_LEGACY_PROJECTED_SRC_PREFIX)) {
26931
- return prefix + value.slice(_LEGACY_PROJECTED_SRC_PREFIX.length);
26932
- }
26933
- return prefix + value;
26934
- }
26935
- function _rewrite_path_prefix_value(value) {
26936
- return value;
26937
- }
26938
- function _rewrite_frontmatter_lines(lines, prefix) {
26939
- let in_load_context = false;
26940
- const out = [];
26941
- for (const line of lines) {
26942
- const bare = _lstrip(line);
26943
- if (bare.startsWith("load_context:") || bare.startsWith("load_context_eager:")) {
26944
- in_load_context = true;
26945
- out.push(line);
26946
- continue;
26947
- }
26948
- if (in_load_context) {
26949
- const m = _FM_LIST_ITEM_RE.exec(line);
26950
- if (m) {
26951
- const indent = m[1] ?? "";
26952
- const q1 = m[2] ?? "";
26953
- const value = m[3] ?? "";
26954
- const q2 = m[4] ?? "";
26955
- out.push(`${indent}${q1}${_rewrite_load_context_value(value, prefix)}${q2}`);
26956
- continue;
26957
- }
26958
- in_load_context = false;
26959
- }
26960
- const pm = _FM_PATH_PREFIX_RE.exec(line);
26961
- if (pm) {
26962
- const head = pm[1] ?? "";
26963
- const q1 = pm[2] ?? "";
26964
- const value = pm[3] ?? "";
26965
- const q2 = pm[4] ?? "";
26966
- out.push(`${head}${q1}${_rewrite_path_prefix_value(value)}${q2}`);
26967
- continue;
26968
- }
26969
- out.push(line);
26970
- }
26971
- return out;
26972
- }
26973
- function _rewrite_body_links(body, prefix) {
26974
- return body.replace(_BODY_DOCS_RE, (_m, tail) => prefix + tail);
26975
- }
26976
- function _parse_trust_and_owner(fm_lines) {
26977
- let level = "core";
26978
- let hrr = false;
26979
- const packs = [];
26980
- const workspaces = [];
26981
- let in_trust = false;
26982
- let in_packs = false;
26983
- let in_workspaces = false;
26984
- for (const line of fm_lines) {
26985
- const stripped = _lstrip(line);
26986
- const indent = line.length - stripped.length;
26987
- if (indent === 0 && stripped.endsWith(":")) {
26988
- const key = stripped.slice(0, -1);
26989
- in_trust = key === "trust";
26990
- in_packs = key === "packs";
26991
- in_workspaces = key === "workspaces";
26992
- continue;
26993
- }
26994
- if (in_trust && stripped.startsWith("level:")) {
26995
- const after = stripped.slice(stripped.indexOf(":") + 1);
26996
- level = _stripChars(_stripChars(_strip6(after), '"'), "'");
26997
- } else if (in_trust && stripped.startsWith("human_review_required:")) {
26998
- const after = stripped.slice(stripped.indexOf(":") + 1);
26999
- hrr = _strip6(after).toLowerCase() === "true";
27000
- } else if (in_packs || in_workspaces) {
27001
- const m = _FM_PLAIN_LIST_RE.exec(line);
27002
- if (m) {
27003
- const value = _strip6(m[2] ?? "");
27004
- (in_packs ? packs : workspaces).push(value);
27005
- }
27006
- }
27007
- }
27008
- let owner = "unknown";
27009
- if (packs.length > 0) {
27010
- owner = packs[0].split("-")[0];
27011
- } else if (workspaces.length > 0) {
27012
- owner = workspaces[0];
26180
+ return [{}, content];
27013
26181
  }
27014
- return [level, hrr, owner];
27015
- }
27016
- function _inject_hrr_banner(body, level, owner) {
27017
- if (body.includes(_HRR_BANNER_MARKER)) {
27018
- return body;
26182
+ const raw = strip(content.slice(3, end));
26183
+ const body = lstripNewlines(content.slice(end + 4));
26184
+ let meta = parseYaml4(raw);
26185
+ if (meta === null || meta === void 0) {
26186
+ meta = {};
27019
26187
  }
27020
- const banner = `${_HRR_BANNER_MARKER}
27021
- > HUMAN REVIEW REQUIRED \xB7 trust: ${level} \xB7 owner: ${owner}
27022
-
27023
- `;
27024
- return banner + _lstripNewlines2(body);
27025
- }
27026
- function _rewrite_paths(content, source_relative_path) {
27027
- const prefix = _depth_prefix(source_relative_path);
27028
- const [fm_lines, bodyInitial] = _split_frontmatter(content);
27029
- let body = _rewrite_body_links(bodyInitial, prefix);
27030
- if (fm_lines === null) {
27031
- return body;
27032
- }
27033
- const new_fm = _rewrite_frontmatter_lines(fm_lines, prefix);
27034
- const [level, hrr, owner] = _parse_trust_and_owner(fm_lines);
27035
- if (hrr && level) {
27036
- body = _inject_hrr_banner(body, level, owner);
27037
- }
27038
- return "---\n" + new_fm.join("\n") + "\n---\n" + body;
27039
- }
27040
- function _read_projection_list(key) {
27041
- const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
27042
- const proj = data["projection"];
27043
- const value = typeof proj === "object" && proj !== null && !Array.isArray(proj) ? proj[key] : null;
27044
- if (Array.isArray(value) && value.length > 0) {
27045
- return value.map((v) => String(v));
26188
+ if (typeof meta === "object" && meta !== null && !Array.isArray(meta)) {
26189
+ return [meta, body];
27046
26190
  }
27047
- return null;
27048
- }
27049
- function _read_rule_workspaces() {
27050
- return _read_projection_list("rule_workspaces");
27051
- }
27052
- function _read_rule_packs() {
27053
- return _read_projection_list("rule_packs");
26191
+ return [{}, body];
27054
26192
  }
27055
26193
  function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null) {
27056
26194
  if (scope === null && pack_scope === null && role_scope === null) {
27057
26195
  return true;
27058
26196
  }
27059
- const [meta] = _parse_frontmatter(_readText2(source_path));
26197
+ const [meta] = parseFrontmatter(fs41.readFileSync(source_path, "utf-8"));
27060
26198
  if (meta["type"] === "always" || meta["alwaysApply"] === true) {
27061
26199
  return true;
27062
26200
  }
@@ -27072,1179 +26210,17 @@ function rule_in_scope(source_path, scope, pack_scope = null, role_scope = null)
27072
26210
  };
27073
26211
  return axis("workspaces", scope) && axis("packs", pack_scope) && axis("roles", role_scope);
27074
26212
  }
27075
- function _scoped_rule_basenames() {
27076
- const scope = _read_rule_workspaces();
27077
- const pack_scope = _read_rule_packs();
27078
- return _iterdirSorted4(MODULE_STATE.RULES_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p)).filter((p) => rule_in_scope(p, scope, pack_scope)).filter((p) => !skip_compile_disabled_rule(`rules/${path39.basename(p)}`)).map((p) => path39.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
27079
- }
27080
- function generate_rule_symlinks() {
27081
- const rules = _scoped_rule_basenames();
27082
- const tool_dirs = _filter_tool_dirs(TOOL_DIRS);
27083
- let thin_files = null;
27084
- if (_lean_projection_mode() === "thin") {
27085
- throw new Error(
27086
- "lean_projection.mode=thin requires project_thin_rules (not ported in condense.ts)"
27087
- );
27088
- }
27089
- const dedup_on = _read_projection_scope_dedup();
27090
- const user_home = process.env["HOME"] ?? os11.homedir();
27091
- const skipped_per_tool = {};
27092
- let total = 0;
27093
- for (const [tool_dir, rel_prefix] of Object.entries(tool_dirs)) {
27094
- const target_dir = path39.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
27095
- const skip = dedup_on ? _dedupable_rules(tool_dir, rules, user_home) : /* @__PURE__ */ new Set();
27096
- skipped_per_tool[tool_dir] = skip;
27097
- _mkdirp(target_dir);
27098
- for (const item of _iterdirSorted4(target_dir)) {
27099
- const name = path39.basename(item);
27100
- if (_isSymlink2(item) && (!rules.includes(name) || skip.has(name)) && name !== "README.md") {
27101
- fs41.unlinkSync(item);
27102
- }
27103
- }
27104
- for (const rule of rules) {
27105
- if (skip.has(rule)) {
27106
- continue;
27107
- }
27108
- const link = path39.join(target_dir, rule);
27109
- if (_existsOrSymlink(link)) {
27110
- fs41.unlinkSync(link);
27111
- }
27112
- if (thin_files !== null) {
27113
- _writeText2(link, thin_files[rule]);
27114
- } else {
27115
- fs41.symlinkSync(path39.join(rel_prefix, rule), link);
27116
- }
27117
- total += 1;
27118
- }
27119
- }
27120
- const source_count = rules.length;
27121
- for (const tool_dir of Object.keys(tool_dirs)) {
27122
- const target_dir = path39.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
27123
- const emitted = new Set(rules);
27124
- const tool_count = _iterdirSorted4(target_dir).filter((f) => emitted.has(path39.basename(f))).length;
27125
- const skipped = (skipped_per_tool[tool_dir] ?? /* @__PURE__ */ new Set()).size;
27126
- const expected = source_count - skipped;
27127
- if (tool_count !== expected) {
27128
- _print3(` \u26A0\uFE0F ${tool_dir}: ${tool_count} rules (expected ${expected})`);
27129
- }
27130
- if (skipped > 0) {
27131
- _print3(
27132
- ` \u2139\uFE0F ${tool_dir}: ${skipped} rule(s) skipped \u2014 byte-identical twin already installed at user scope`
27133
- );
27134
- }
27135
- }
27136
- info(
27137
- ` \u2705 Created ${total} rule symlinks across ${Object.keys(tool_dirs).length} tool directories (${source_count} rules each)`
27138
- );
27139
- return total;
27140
- }
27141
- function generate_windsurfrules() {
27142
- const rules = _scoped_rule_basenames();
27143
- const parts = ["# Auto-generated from dist/agent-src/rules/ \u2014 do not edit directly\n"];
27144
- for (const rule of rules) {
27145
- const p = path39.join(MODULE_STATE.RULES_SOURCE, rule);
27146
- const content = strip_frontmatter(_readText2(p));
27147
- parts.push(`---
27148
-
27149
- ${_strip6(content)}
27150
- `);
27151
- }
27152
- const output = path39.join(MODULE_STATE.PROJECT_ROOT, ".windsurfrules");
27153
- _writeText2(output, parts.join("\n") + "\n");
27154
- info(` \u2705 Generated .windsurfrules (${rules.length} rules)`);
27155
- return rules.length;
27156
- }
27157
- function _CURSOR_RULES_MDC_DIR() {
27158
- return path39.join(MODULE_STATE.PROJECT_ROOT, ".cursor", "rules");
27159
- }
27160
- function _WINDSURF_RULES_DIR() {
27161
- return path39.join(MODULE_STATE.PROJECT_ROOT, ".windsurf", "rules");
27162
- }
27163
- function _WINDSURF_WORKFLOWS_DIR() {
27164
- return path39.join(MODULE_STATE.PROJECT_ROOT, ".windsurf", "workflows");
27165
- }
27166
- function _CURSOR_COMMANDS_DIR() {
27167
- return path39.join(MODULE_STATE.PROJECT_ROOT, ".cursor", "commands");
27168
- }
27169
- function _parse_frontmatter(content) {
27170
- if (!content.startsWith("---")) {
27171
- return [{}, content];
27172
- }
27173
- const end = content.indexOf("\n---", 3);
27174
- if (end === -1) {
27175
- return [{}, content];
27176
- }
27177
- const raw = _strip6(content.slice(3, end));
27178
- const body = _lstripNewlines2(content.slice(end + 4));
27179
- let meta = _yamlParse(raw);
27180
- if (meta === null || meta === void 0) {
27181
- meta = {};
27182
- }
27183
- if (typeof meta === "object" && meta !== null && !Array.isArray(meta)) {
27184
- return [meta, body];
27185
- }
27186
- return [{}, body];
27187
- }
27188
- function _yaml_scalar(value) {
27189
- return JSON.stringify(value);
27190
- }
27191
- function derive_trigger_globs(meta) {
27192
- const triggers = meta["triggers"];
27193
- if (!Array.isArray(triggers)) {
27194
- return [];
27195
- }
27196
- const globs = [];
27197
- for (const t of triggers) {
27198
- if (t === null || typeof t !== "object" || Array.isArray(t)) continue;
27199
- const obj = t;
27200
- if (typeof obj["file_pattern"] === "string" && obj["file_pattern"]) {
27201
- globs.push(obj["file_pattern"]);
27202
- } else if (typeof obj["path_prefix"] === "string" && obj["path_prefix"]) {
27203
- const prefix = obj["path_prefix"];
27204
- globs.push(prefix.endsWith("/") ? `${prefix}**` : `${prefix}**`);
27205
- }
27206
- }
27207
- return [...new Set(globs)];
27208
- }
27209
- function _emit_cursor_mdc(source, target) {
27210
- const [meta, body] = _parse_frontmatter(_readText2(source));
27211
- const description = _strip6(String(meta["description"] ?? "").replace(/\n/g, " "));
27212
- const always_apply = Boolean(meta["alwaysApply"] || meta["type"] === "always");
27213
- const globs = always_apply ? [] : derive_trigger_globs(meta);
27214
- const lines = [
27215
- "---",
27216
- `description: ${_yaml_scalar(description)}`,
27217
- `globs: ${globs.join(",")}`,
27218
- `alwaysApply: ${always_apply ? "true" : "false"}`,
27219
- "---",
27220
- "",
27221
- _pyRstrip(body) + "\n"
27222
- ];
27223
- _mkdirp(path39.dirname(target));
27224
- _writeText2(target, lines.join("\n"));
27225
- }
27226
- function _emit_windsurf_rule(source, target) {
27227
- const [meta, body] = _parse_frontmatter(_readText2(source));
27228
- const description = _strip6(String(meta["description"] ?? "").replace(/\n/g, " "));
27229
- const always_apply = Boolean(meta["alwaysApply"] || meta["type"] === "always");
27230
- const globs = always_apply ? [] : derive_trigger_globs(meta);
27231
- const trigger = always_apply ? "always_on" : globs.length > 0 ? "glob" : "model_decision";
27232
- const lines = [
27233
- "---",
27234
- `trigger: ${trigger}`,
27235
- `description: ${_yaml_scalar(description)}`,
27236
- `globs: ${globs.join(",")}`,
27237
- "---",
27238
- "",
27239
- _pyRstrip(body) + "\n"
27240
- ];
27241
- _mkdirp(path39.dirname(target));
27242
- _writeText2(target, lines.join("\n"));
27243
- }
27244
- function _pyRstrip(s) {
27245
- return s.replace(/\s+$/u, "");
27246
- }
27247
- function _clean_modern_dir(target_dir, valid_names) {
27248
- if (!_exists6(target_dir)) {
27249
- return;
27250
- }
27251
- for (const item of _iterdirSorted4(target_dir)) {
27252
- const name = path39.basename(item);
27253
- if (name === "README.md") {
27254
- continue;
27255
- }
27256
- if (!valid_names.has(name)) {
27257
- if (_isDir11(item) && !_isSymlink2(item)) {
27258
- fs41.rmSync(item, { recursive: true, force: true });
27259
- } else {
27260
- fs41.unlinkSync(item);
27261
- }
27262
- }
27263
- }
27264
- }
27265
- function generate_cursor_mdc_rules() {
27266
- const scope = _read_rule_workspaces();
27267
- const pack_scope = _read_rule_packs();
27268
- const rules = _rglobSorted4(MODULE_STATE.RULES_SOURCE, "*.md").filter((p) => _isFile13(p)).filter((p) => rule_in_scope(p, scope, pack_scope));
27269
- const stems = rules.map((r) => path39.basename(r, ".md"));
27270
- const valid = /* @__PURE__ */ new Set([
27271
- ...stems.map((s) => `${s}.mdc`),
27272
- ...rules.map((r) => path39.basename(r))
27273
- ]);
27274
- _clean_modern_dir(_CURSOR_RULES_MDC_DIR(), valid);
27275
- for (const rule of rules) {
27276
- _emit_cursor_mdc(rule, path39.join(_CURSOR_RULES_MDC_DIR(), `${path39.basename(rule, ".md")}.mdc`));
27277
- }
27278
- info(` \u2705 Wrote ${rules.length} \`.cursor/rules/*.mdc\` files`);
27279
- return rules.length;
27280
- }
27281
- function generate_windsurf_modern_rules() {
27282
- const scope = _read_rule_workspaces();
27283
- const pack_scope = _read_rule_packs();
27284
- const rules = _rglobSorted4(MODULE_STATE.RULES_SOURCE, "*.md").filter((p) => _isFile13(p)).filter((p) => rule_in_scope(p, scope, pack_scope));
27285
- const valid = new Set(rules.map((r) => path39.basename(r)));
27286
- _clean_modern_dir(_WINDSURF_RULES_DIR(), valid);
27287
- for (const rule of rules) {
27288
- _emit_windsurf_rule(rule, path39.join(_WINDSURF_RULES_DIR(), path39.basename(rule)));
27289
- }
27290
- info(` \u2705 Wrote ${rules.length} \`.windsurf/rules/*.md\` files`);
27291
- return rules.length;
27292
- }
27293
- function generate_cursor_commands(active_command_slugs = null) {
27294
- if (!_isDir11(path39.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
27295
- return 0;
27296
- }
27297
- const cmds = [...iterCommands()].filter(
27298
- ([, slug]) => active_command_slugs === null || active_command_slugs.has(slug)
27299
- );
27300
- const valid = new Set(cmds.map(([, slug]) => `${slug}.md`));
27301
- _clean_modern_dir(_CURSOR_COMMANDS_DIR(), valid);
27302
- _mkdirp(_CURSOR_COMMANDS_DIR());
27303
- let count = 0;
27304
- for (const [source_file, slug] of cmds) {
27305
- const link = path39.join(_CURSOR_COMMANDS_DIR(), `${slug}.md`);
27306
- if (_existsOrSymlink(link)) {
27307
- fs41.unlinkSync(link);
27308
- }
27309
- const rel = path39.join("../..", _relativeToPosix2(source_file, MODULE_STATE.PROJECT_ROOT));
27310
- fs41.symlinkSync(rel, link);
27311
- count += 1;
27312
- }
27313
- info(` \u2705 Linked ${count} \`.cursor/commands/*.md\` files`);
27314
- return count;
27315
- }
27316
- function generate_windsurf_workflows(active_command_slugs = null) {
27317
- if (!_isDir11(path39.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
27318
- return 0;
27319
- }
27320
- const cmds = [...iterCommands()].filter(
27321
- ([, slug]) => active_command_slugs === null || active_command_slugs.has(slug)
27322
- );
27323
- const valid = new Set(cmds.map(([, slug]) => `${slug}.md`));
27324
- _clean_modern_dir(_WINDSURF_WORKFLOWS_DIR(), valid);
27325
- _mkdirp(_WINDSURF_WORKFLOWS_DIR());
27326
- let count = 0;
27327
- for (const [source_file, slug] of cmds) {
27328
- const link = path39.join(_WINDSURF_WORKFLOWS_DIR(), `${slug}.md`);
27329
- if (_existsOrSymlink(link)) {
27330
- fs41.unlinkSync(link);
27331
- }
27332
- const rel = path39.join("../..", _relativeToPosix2(source_file, MODULE_STATE.PROJECT_ROOT));
27333
- fs41.symlinkSync(rel, link);
27334
- count += 1;
27335
- }
27336
- info(` \u2705 Linked ${count} \`.windsurf/workflows/*.md\` files`);
27337
- return count;
27338
- }
27339
- function generate_gemini_md() {
27340
- const link = path39.join(MODULE_STATE.PROJECT_ROOT, "GEMINI.md");
27341
- if (_existsOrSymlink(link)) {
27342
- fs41.unlinkSync(link);
27343
- }
27344
- fs41.symlinkSync("AGENTS.md", link);
27345
- info(" \u2705 Created GEMINI.md \u2192 AGENTS.md symlink");
27346
- }
27347
- function* iterCommands() {
27348
- const src_domains = path39.join(MODULE_STATE.PROJECT_ROOT, "src", "domains");
27349
- if (!_isDir11(src_domains)) {
27350
- return;
27351
- }
27352
- for (const source_file of _rglobSorted4(src_domains, "command.md")) {
27353
- if (!_isFile13(source_file)) {
27354
- continue;
27355
- }
27356
- const rel = _relativeToPosix2(source_file, MODULE_STATE.PROJECT_ROOT);
27357
- let slug = _command_path_to_slug(rel);
27358
- if (!slug) {
27359
- continue;
27360
- }
27361
- const pack_id = _relativeToPosix2(source_file, src_domains).split("/")[0];
27362
- const prefix = _domains_slug_prefix(pack_id);
27363
- if (prefix && slug !== prefix && !slug.startsWith(prefix + "-")) {
27364
- slug = `${prefix}-${slug}`;
27365
- }
27366
- yield [source_file, slug];
27367
- }
27368
- }
27369
- function _read_model_auto_switch() {
27370
- const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
27371
- const model = data["model"];
27372
- const value = typeof model === "object" && model !== null && !Array.isArray(model) ? model["auto_switch"] : null;
27373
- if (typeof value === "string" && ["auto", "suggest", "off"].includes(value.trim().toLowerCase())) {
27374
- return value.trim().toLowerCase();
27375
- }
27376
- return "suggest";
27377
- }
27378
- function _read_projection_mode() {
27379
- const data = load_agent_settings({ project_path: MODULE_STATE.SETTINGS_FILE });
27380
- const proj = data["projection"];
27381
- const value = typeof proj === "object" && proj !== null && !Array.isArray(proj) ? proj["mode"] : null;
27382
- if (typeof value === "string" && ["legacy-all", "scoped"].includes(value.trim().toLowerCase())) {
27383
- return value.trim().toLowerCase();
27384
- }
27385
- return "legacy-all";
27386
- }
27387
- function _domains_slug_prefix(pack_id) {
27388
- const manifest = path39.join(MODULE_STATE.PROJECT_ROOT, "src", "domains", pack_id, "pack.yaml");
27389
- if (!_isFile13(manifest)) {
27390
- return "";
27391
- }
27392
- const m = _SLUG_PREFIX_RE.exec(_readText2(manifest));
27393
- return m ? m[1] : "";
27394
- }
27395
- function _command_path_to_slug(manifest_path2) {
27396
- const logical = strip_source_prefix(manifest_path2);
27397
- if (logical && logical.startsWith("commands/")) {
27398
- return _posixParts(logical.slice("commands/".length).replace(/\.md$/, "")).join("-");
27399
- }
27400
- const parts = manifest_path2.split(path39.sep).filter((s) => s.length > 0);
27401
- const i = parts.indexOf("commands");
27402
- return parts.slice(i + 1).join("/").replace(/\.md$/, "").split("/").join("-");
27403
- }
27404
- function _resolve_active_predicates() {
27405
- if (_read_projection_mode() !== "scoped") {
27406
- return [null, null];
27407
- }
27408
- throw new Error("projection.mode=scoped requires the config package (not ported in condense.ts)");
27409
- }
27410
- function _model_tier(skill_md) {
27411
- if (!_exists6(skill_md)) {
27412
- return null;
27413
- }
27414
- const text = fs41.readFileSync(skill_md).toString("utf-8");
27415
- if (!text.startsWith("---\n")) {
27416
- return null;
27417
- }
27418
- const end = text.indexOf("\n---\n", 4);
27419
- if (end === -1) {
27420
- return null;
27421
- }
27422
- const m = MODEL_TIER_RE.exec(text.slice(4, end));
27423
- return m ? m[1] : null;
27424
- }
27425
- function _render_native_model_md(src_md, tier) {
27426
- const text = _readText2(src_md);
27427
- const model = TIER_TO_CLAUDE_MODEL[tier];
27428
- return text.replace(MODEL_TIER_RE, `model: ${model}`);
27429
- }
27430
- function generate_claude_skills(active_skill_names = null) {
27431
- if (!_exists6(MODULE_STATE.SKILLS_SOURCE)) {
27432
- process.stderr.write(" \u26A0\uFE0F dist/agent-src/skills/ not found \u2014 skipping skills\n");
27433
- return 0;
27434
- }
27435
- let skills = _iterdirSorted4(MODULE_STATE.SKILLS_SOURCE).filter((p) => _isDir11(p)).map((p) => path39.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
27436
- if (active_skill_names !== null) {
27437
- skills = skills.filter((s) => active_skill_names.has(s));
27438
- }
27439
- const skill_set = new Set(skills);
27440
- const command_slugs = new Set([...iterCommands()].map(([, slug]) => slug));
27441
- _mkdirp(MODULE_STATE.CLAUDE_SKILLS_DIR);
27442
- const auto = _read_model_auto_switch() === "auto";
27443
- for (const item of _iterdirSorted4(MODULE_STATE.CLAUDE_SKILLS_DIR)) {
27444
- const name = path39.basename(item);
27445
- if (skill_set.has(name) || command_slugs.has(name) || name === "README.md") {
27446
- continue;
27447
- }
27448
- if (_isSymlink2(item)) {
27449
- fs41.unlinkSync(item);
27450
- } else if (_isDirNoFollow(item)) {
27451
- const skill_md = path39.join(item, "SKILL.md");
27452
- if (_isFile13(skill_md) && !_isSymlink2(skill_md)) {
27453
- fs41.rmSync(item, { recursive: true, force: true });
27454
- }
27455
- }
27456
- }
27457
- let count = 0;
27458
- let rendered = 0;
27459
- for (const skill of skills) {
27460
- const link = path39.join(MODULE_STATE.CLAUDE_SKILLS_DIR, skill);
27461
- const src_dir = path39.join(MODULE_STATE.SKILLS_SOURCE, skill);
27462
- const value = auto ? _model_tier(path39.join(src_dir, "SKILL.md")) : null;
27463
- if (_isSymlink2(link)) {
27464
- fs41.unlinkSync(link);
27465
- } else if (_isDirNoFollow(link)) {
27466
- fs41.rmSync(link, { recursive: true, force: true });
27467
- } else if (_existsOrSymlink(link)) {
27468
- fs41.unlinkSync(link);
27469
- }
27470
- if (value !== null && value in TIER_TO_CLAUDE_MODEL) {
27471
- _mkdirp(link);
27472
- for (const entry of _iterdirSorted4(src_dir)) {
27473
- const entryName = path39.basename(entry);
27474
- if (entryName === "SKILL.md") {
27475
- _writeText2(
27476
- path39.join(link, "SKILL.md"),
27477
- _render_native_model_md(entry, value)
27478
- );
27479
- } else {
27480
- fs41.symlinkSync(
27481
- path39.join("../../../dist/agent-src/skills", skill, entryName),
27482
- path39.join(link, entryName)
27483
- );
27484
- }
27485
- }
27486
- rendered += 1;
27487
- } else {
27488
- fs41.symlinkSync(path39.join("../../dist/agent-src/skills", skill), link);
27489
- }
27490
- count += 1;
27491
- }
27492
- const suffix = rendered ? ` (${rendered} rendered with native model:)` : "";
27493
- info(` \u2705 Created ${count} skill entries in .claude/skills/${suffix}`);
27494
- return count;
27495
- }
27496
- function generate_claude_commands(active_command_slugs = null) {
27497
- if (!_isDir11(path39.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
27498
- process.stderr.write(" \u26A0\uFE0F src/domains/ not found \u2014 skipping commands\n");
27499
- return 0;
27500
- }
27501
- _mkdirp(MODULE_STATE.CLAUDE_SKILLS_DIR);
27502
- let skill_names = /* @__PURE__ */ new Set();
27503
- if (_exists6(MODULE_STATE.SKILLS_SOURCE)) {
27504
- skill_names = new Set(
27505
- _iterdirSorted4(MODULE_STATE.SKILLS_SOURCE).filter((p) => _isDir11(p)).map((p) => path39.basename(p))
27506
- );
27507
- }
27508
- const current_slugs = /* @__PURE__ */ new Set();
27509
- let count = 0;
27510
- let skipped = 0;
27511
- let reserved = 0;
27512
- let rendered = 0;
27513
- const auto = _read_model_auto_switch() === "auto";
27514
- for (const [source_file, slug] of iterCommands()) {
27515
- if (active_command_slugs !== null && !active_command_slugs.has(slug)) {
27516
- continue;
27517
- }
27518
- if (skill_names.has(slug)) {
27519
- skipped += 1;
27520
- continue;
27521
- }
27522
- if (is_claude_builtin_name(slug)) {
27523
- reserved += 1;
27524
- continue;
27525
- }
27526
- current_slugs.add(slug);
27527
- const skill_dir = path39.join(MODULE_STATE.CLAUDE_SKILLS_DIR, slug);
27528
- _mkdirp(skill_dir);
27529
- const skill_file = path39.join(skill_dir, "SKILL.md");
27530
- if (_existsOrSymlink(skill_file)) {
27531
- fs41.unlinkSync(skill_file);
27532
- }
27533
- const rel_path = _relativeToPosix2(source_file, MODULE_STATE.PROJECT_ROOT);
27534
- const value = auto ? _model_tier(source_file) : null;
27535
- if (value !== null && value in TIER_TO_CLAUDE_MODEL) {
27536
- _writeText2(skill_file, _render_native_model_md(source_file, value));
27537
- rendered += 1;
27538
- } else {
27539
- const rel_target = path39.join("../../..", rel_path);
27540
- fs41.symlinkSync(rel_target, skill_file);
27541
- }
27542
- count += 1;
27543
- }
27544
- let removed_dirs = 0;
27545
- for (const item of _iterdirSorted4(MODULE_STATE.CLAUDE_SKILLS_DIR)) {
27546
- if (!_isDirNoFollow(item) || _isSymlink2(item)) {
27547
- continue;
27548
- }
27549
- const name = path39.basename(item);
27550
- if (skill_names.has(name) || current_slugs.has(name)) {
27551
- continue;
27552
- }
27553
- const skill_md = path39.join(item, "SKILL.md");
27554
- if (_isSymlink2(skill_md) || _isFile13(skill_md)) {
27555
- const entries = _iterdirSorted4(item);
27556
- if (entries.length === 1 && path39.basename(entries[0]) === "SKILL.md") {
27557
- fs41.unlinkSync(skill_md);
27558
- fs41.rmdirSync(item);
27559
- removed_dirs += 1;
27560
- }
27561
- }
27562
- }
27563
- let msg = ` \u2705 Created ${count} command entries in .claude/skills/`;
27564
- if (rendered) {
27565
- msg += ` (${rendered} rendered with native model:)`;
27566
- }
27567
- if (skipped) {
27568
- msg += ` (${skipped} skipped \u2014 same-name skill exists)`;
27569
- }
27570
- if (reserved) {
27571
- msg += ` (${reserved} withheld \u2014 Claude Code built-in name)`;
27572
- }
27573
- if (removed_dirs) {
27574
- msg += ` (${removed_dirs} stale dirs removed)`;
27575
- }
27576
- info(msg);
27577
- return count;
27578
- }
27579
- function generate_claude_subagents() {
27580
- if (!_isDir11(MODULE_STATE.SUBAGENTS_SOURCE)) {
27581
- return 0;
27582
- }
27583
- _mkdirp(MODULE_STATE.CLAUDE_AGENTS_DIR);
27584
- const sources = _rglobSorted4(MODULE_STATE.SUBAGENTS_SOURCE, "*.md").filter(
27585
- (p) => _isFile13(p) && !path39.basename(p).startsWith("_")
27586
- );
27587
- const current = /* @__PURE__ */ new Set();
27588
- let count = 0;
27589
- const defensePath = path39.join(MODULE_STATE.SUBAGENTS_SOURCE, "_prompt-defense.md");
27590
- const defense = _isFile13(defensePath) ? _readText2(defensePath).trim() : "";
27591
- for (const src of sources) {
27592
- const stem2 = path39.basename(src, ".md");
27593
- const text = _readText2(src);
27594
- if (!text.startsWith("---\n")) {
27595
- continue;
27596
- }
27597
- const end = text.indexOf("\n---\n", 4);
27598
- if (end === -1) {
27599
- continue;
27600
- }
27601
- const fmBlock = text.slice(4, end);
27602
- const body = text.slice(end + 5);
27603
- const fm = _yamlParse(fmBlock);
27604
- if (fm === null) {
27605
- continue;
27606
- }
27607
- const name = typeof fm["name"] === "string" ? fm["name"] : stem2;
27608
- const description = typeof fm["description"] === "string" ? fm["description"] : "";
27609
- const toolsRaw = fm["tools"];
27610
- const tools = Array.isArray(toolsRaw) ? toolsRaw.map((t) => String(t)).join(", ") : String(toolsRaw ?? "");
27611
- const tier = typeof fm["model_tier"] === "string" ? fm["model_tier"] : "inherit";
27612
- const model = tier === "inherit" ? "inherit" : TIER_TO_CLAUDE_MODEL[tier] ?? "inherit";
27613
- const effort = typeof fm["effort"] === "string" ? fm["effort"] : null;
27614
- const guardedBody = defense !== "" && !body.includes("prompt-defense-preamble") ? `
27615
- ${defense}
27616
- ${body}` : body;
27617
- const out = `---
27618
- name: ${name}
27619
- description: ${description}
27620
- tools: ${tools}
27621
- model: ${model}
27622
- ` + (effort !== null ? `effort: ${effort}
27623
- ` : "") + "---\n" + guardedBody;
27624
- const target = path39.join(MODULE_STATE.CLAUDE_AGENTS_DIR, `${name}.md`);
27625
- _writeText2(target, out);
27626
- current.add(`${name}.md`);
27627
- count += 1;
27628
- }
27629
- for (const item of _iterdirSorted4(MODULE_STATE.CLAUDE_AGENTS_DIR)) {
27630
- const base = path39.basename(item);
27631
- if (base === "README.md" || current.has(base)) {
27632
- continue;
27633
- }
27634
- if (_isFile13(item) && base.endsWith(".md") && !_isSymlink2(item)) {
27635
- fs41.unlinkSync(item);
27636
- }
27637
- }
27638
- info(` \u2705 Created ${count} subagent entries in .claude/agents/`);
27639
- return count;
27640
- }
27641
- function generate_subagent_host_contexts() {
27642
- if (!_isDir11(MODULE_STATE.SUBAGENTS_SOURCE)) {
27643
- return 0;
27644
- }
27645
- const sources = _rglobSorted4(MODULE_STATE.SUBAGENTS_SOURCE, "*.md").filter((p) => _isFile13(p));
27646
- const rendered = [];
27647
- for (const src of sources) {
27648
- const stem2 = path39.basename(src, ".md");
27649
- const text = _readText2(src);
27650
- if (!text.startsWith("---\n")) {
27651
- continue;
27652
- }
27653
- const end = text.indexOf("\n---\n", 4);
27654
- if (end === -1) {
27655
- continue;
27656
- }
27657
- const fm = _yamlParse(text.slice(4, end));
27658
- if (fm === null) {
27659
- continue;
27660
- }
27661
- const body = text.slice(end + 5);
27662
- const name = typeof fm["name"] === "string" ? fm["name"] : stem2;
27663
- const description = typeof fm["description"] === "string" ? fm["description"] : "";
27664
- const trustRaw = fm["trust"];
27665
- const trust = typeof trustRaw === "string" ? trustRaw : typeof trustRaw === "object" && trustRaw !== null && typeof trustRaw["level"] === "string" ? trustRaw["level"] : "unknown";
27666
- const lifecycle = typeof fm["lifecycle"] === "string" ? fm["lifecycle"] : "unknown";
27667
- const tier = typeof fm["model_tier"] === "string" ? fm["model_tier"] : "inherit";
27668
- const toolsRaw = fm["tools"];
27669
- const tools = Array.isArray(toolsRaw) ? toolsRaw.map((t) => String(t)).join(", ") : String(toolsRaw ?? "");
27670
- const out = `---
27671
- description: ${description}
27672
- ---
27673
-
27674
- # Subagent (passive reference): ${name}
27675
-
27676
- > Passive subagent reference. This host has **no native subagent dispatch** \u2014
27677
- > there is no \`@${name}\` here. Load this discipline manually and apply it.
27678
- > Governance parity (trust / lifecycle / model tier) is preserved below;
27679
- > feature parity is not (ADR-109 \xA74).
27680
-
27681
- - trust: ${trust}
27682
- - lifecycle: ${lifecycle}
27683
- - model tier: ${tier}
27684
- ` + (tools ? `- tools: ${tools}
27685
- ` : "") + "\n" + _pyRstrip(body) + "\n";
27686
- rendered.push({ name, text: out });
27687
- }
27688
- const targets = [
27689
- {
27690
- active: _tool_active("cursor"),
27691
- dir: path39.join(MODULE_STATE.PROJECT_ROOT, ".cursor", "subagents"),
27692
- file: (n) => `${n}.md`,
27693
- owns: (b) => b.endsWith(".md")
27694
- },
27695
- {
27696
- active: _tool_active("windsurf"),
27697
- dir: path39.join(MODULE_STATE.PROJECT_ROOT, ".windsurf", "subagents"),
27698
- file: (n) => `${n}.md`,
27699
- owns: (b) => b.endsWith(".md")
27700
- },
27701
- {
27702
- active: _tool_active("cline"),
27703
- dir: path39.join(MODULE_STATE.PROJECT_ROOT, ".clinerules"),
27704
- file: (n) => `${n}.subagent.md`,
27705
- owns: (b) => b.endsWith(".subagent.md")
27706
- }
27707
- ];
27708
- let count = 0;
27709
- for (const t of targets) {
27710
- if (!t.active) {
27711
- continue;
27712
- }
27713
- const current = new Set(rendered.map((r) => t.file(r.name)));
27714
- _mkdirp(t.dir);
27715
- for (const r of rendered) {
27716
- _writeText2(path39.join(t.dir, t.file(r.name)), r.text);
27717
- count += 1;
27718
- }
27719
- if (_exists6(t.dir)) {
27720
- for (const item of _iterdirSorted4(t.dir)) {
27721
- const base = path39.basename(item);
27722
- if (base === "README.md" || current.has(base)) {
27723
- continue;
27724
- }
27725
- if (_isFile13(item) && !_isSymlink2(item) && t.owns(base)) {
27726
- fs41.unlinkSync(item);
27727
- }
27728
- }
27729
- }
27730
- }
27731
- info(` \u2705 Projected ${count} passive subagent context file(s) to non-Claude-Code hosts`);
27732
- return count;
27733
- }
27734
- function generate_plugin_command_skills() {
27735
- if (!_isDir11(path39.join(MODULE_STATE.PROJECT_ROOT, "src", "domains"))) {
27736
- return 0;
27737
- }
27738
- _mkdirp(MODULE_STATE.PLUGIN_SKILLS_DIR);
27739
- const pointer_dir = path39.join(MODULE_STATE.PLUGIN_SKILLS_DIR, PLUGIN_POINTER_SLUG);
27740
- _mkdirp(pointer_dir);
27741
- const pointer_file = path39.join(pointer_dir, "SKILL.md");
27742
- if (_isSymlink2(pointer_file)) {
27743
- fs41.unlinkSync(pointer_file);
27744
- }
27745
- if (!_isFile13(pointer_file) || fs41.readFileSync(pointer_file, "utf-8") !== PLUGIN_POINTER_SKILL_BODY) {
27746
- fs41.writeFileSync(pointer_file, PLUGIN_POINTER_SKILL_BODY);
27747
- }
27748
- let removed_dirs = 0;
27749
- for (const item of _iterdirSorted4(MODULE_STATE.PLUGIN_SKILLS_DIR)) {
27750
- if (!_isDirNoFollow(item) || _isSymlink2(item)) {
27751
- continue;
27752
- }
27753
- if (path39.basename(item) === PLUGIN_POINTER_SLUG) {
27754
- continue;
27755
- }
27756
- const entries = _iterdirSorted4(item);
27757
- const all_symlinks = entries.length > 0 && entries.every((e) => _isSymlink2(e));
27758
- const single_skill_md = entries.length === 1 && path39.basename(entries[0]) === "SKILL.md" && _isFile13(entries[0]);
27759
- if (all_symlinks || single_skill_md) {
27760
- for (const e of entries) {
27761
- fs41.unlinkSync(e);
27762
- }
27763
- fs41.rmdirSync(item);
27764
- removed_dirs += 1;
27765
- }
27766
- }
27767
- let msg = " \u2705 Plugin skills: bootstrap shim (1 pointer skill) in .claude-plugin/skills/";
27768
- if (removed_dirs) {
27769
- msg += ` (${removed_dirs} content entries pruned)`;
27770
- }
27771
- info(msg);
27772
- return 1;
27773
- }
27774
- function generate_persona_symlinks() {
27775
- if (!_exists6(MODULE_STATE.PERSONAS_SOURCE)) {
27776
- _print3(" \u26A0\uFE0F dist/agent-src/personas/ not found \u2014 skipping personas");
27777
- return 0;
27778
- }
27779
- const personas = _rglobSorted4(MODULE_STATE.PERSONAS_SOURCE, "*.md").filter((p) => _isFile13(p) && path39.basename(p, ".md") !== "README").map((p) => path39.basename(p)).filter((name) => _isFile13(path39.join(MODULE_STATE.PERSONAS_SOURCE, name)));
27780
- const direct = _iterdirSorted4(MODULE_STATE.PERSONAS_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p) && path39.basename(p, ".md") !== "README").map((p) => path39.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
27781
- void personas;
27782
- const list = direct;
27783
- const tool_dirs = _filter_tool_dirs(PERSONA_TOOL_DIRS);
27784
- let total = 0;
27785
- for (const [tool_dir, rel_prefix] of Object.entries(tool_dirs)) {
27786
- const target_dir = path39.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
27787
- _mkdirp(target_dir);
27788
- for (const item of _iterdirSorted4(target_dir)) {
27789
- const name = path39.basename(item);
27790
- if (_isSymlink2(item) && !list.includes(name) && name !== "README.md") {
27791
- fs41.unlinkSync(item);
27792
- }
27793
- }
27794
- for (const persona of list) {
27795
- const link = path39.join(target_dir, persona);
27796
- const target = path39.join(rel_prefix, persona);
27797
- if (_existsOrSymlink(link)) {
27798
- fs41.unlinkSync(link);
27799
- }
27800
- fs41.symlinkSync(target, link);
27801
- total += 1;
27802
- }
27803
- }
27804
- info(
27805
- ` \u2705 Created ${total} persona symlinks across ${Object.keys(tool_dirs).length} tool directories (${list.length} personas each)`
27806
- );
27807
- return total;
27808
- }
27809
- function generate_user_type_symlinks() {
27810
- if (!_exists6(MODULE_STATE.USER_TYPES_SOURCE)) {
27811
- _print3(" \u26A0\uFE0F dist/agent-src/user-types/ not found \u2014 skipping user-types");
27812
- return 0;
27813
- }
27814
- const user_types = _iterdirSorted4(MODULE_STATE.USER_TYPES_SOURCE).filter((p) => p.endsWith(".md") && _isFile13(p) && path39.basename(p, ".md") !== "README").map((p) => path39.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
27815
- const tool_dirs = _filter_tool_dirs(USER_TYPE_TOOL_DIRS);
27816
- let total = 0;
27817
- for (const [tool_dir, rel_prefix] of Object.entries(tool_dirs)) {
27818
- const target_dir = path39.join(MODULE_STATE.PROJECT_ROOT, tool_dir);
27819
- _mkdirp(target_dir);
27820
- for (const item of _iterdirSorted4(target_dir)) {
27821
- const name = path39.basename(item);
27822
- if (_isSymlink2(item) && !user_types.includes(name) && name !== "README.md") {
27823
- fs41.unlinkSync(item);
27824
- }
27825
- }
27826
- for (const user_type of user_types) {
27827
- const link = path39.join(target_dir, user_type);
27828
- const target = path39.join(rel_prefix, user_type);
27829
- if (_existsOrSymlink(link)) {
27830
- fs41.unlinkSync(link);
27831
- }
27832
- fs41.symlinkSync(target, link);
27833
- total += 1;
27834
- }
27835
- }
27836
- info(
27837
- ` \u2705 Created ${total} user-type symlinks across ${Object.keys(tool_dirs).length} tool directories (${user_types.length} user-types each)`
27838
- );
27839
- return total;
27840
- }
27841
- function generate_plugin_hooks() {
27842
- const manifest_path2 = path39.join(
27843
- MODULE_STATE.PROJECT_ROOT,
27844
- "src",
27845
- "scripts",
27846
- "hook_manifest.yaml"
27847
- );
27848
- if (!_exists6(manifest_path2)) {
27849
- process.stderr.write(" \u26A0\uFE0F scripts/hook_manifest.yaml not found \u2014 skipping plugin hooks\n");
27850
- return 0;
27851
- }
27852
- const matrix = build_claude_hook_matrix(manifest_path2);
27853
- const hooks = {};
27854
- for (const [native, command] of Object.entries(matrix)) {
27855
- hooks[native] = [{ hooks: [{ type: "command", command }] }];
27856
- }
27857
- const hooks_dir = path39.join(MODULE_STATE.PROJECT_ROOT, "hooks");
27858
- _mkdirp(hooks_dir);
27859
- const out = path39.join(hooks_dir, "hooks.json");
27860
- _writeText2(out, _jsonDumpsHooks({ hooks }) + "\n");
27861
- info(` \u2705 Generated hooks/hooks.json (${Object.keys(hooks).length} Claude plugin hooks)`);
27862
- return Object.keys(hooks).length;
27863
- }
27864
- function _jsonDumpsHooks(obj) {
27865
- return _pyJson(obj, 0);
27866
- }
27867
- function _pyJson(value, indent) {
27868
- const pad = " ".repeat(indent);
27869
- const padInner = " ".repeat(indent + 1);
27870
- if (Array.isArray(value)) {
27871
- if (value.length === 0) {
27872
- return "[]";
27873
- }
27874
- const items = value.map((v) => padInner + _pyJson(v, indent + 1));
27875
- return `[
27876
- ${items.join(",\n")}
27877
- ${pad}]`;
27878
- }
27879
- if (value !== null && typeof value === "object") {
27880
- const entries = Object.entries(value);
27881
- if (entries.length === 0) {
27882
- return "{}";
27883
- }
27884
- const items = entries.map(([k, v]) => `${padInner}${JSON.stringify(k)}: ${_pyJson(v, indent + 1)}`);
27885
- return `{
27886
- ${items.join(",\n")}
27887
- ${pad}}`;
27888
- }
27889
- return JSON.stringify(value);
27890
- }
27891
- function _generate_tools_inner(cmd_slugs, skill_names) {
27892
- info("\u{1F527} Generating multi-agent tool directories...\n");
27893
- const rules = generate_rule_symlinks();
27894
- const windsurfrules = _tool_active("windsurf") ? generate_windsurfrules() : 0;
27895
- if (_tool_active("gemini")) {
27896
- generate_gemini_md();
27897
- }
27898
- const skills = _tool_active("claude-code") ? generate_claude_skills(skill_names) : 0;
27899
- const commands = _tool_active("claude-code") ? generate_claude_commands(cmd_slugs) : 0;
27900
- const subagents = _tool_active("claude-code") ? generate_claude_subagents() : 0;
27901
- const subagent_contexts = generate_subagent_host_contexts();
27902
- const plugin_cmd_skills = _tool_active("claude-code") ? generate_plugin_command_skills() : 0;
27903
- const plugin_hooks = _tool_active("claude-code") ? generate_plugin_hooks() : 0;
27904
- const personas = generate_persona_symlinks();
27905
- const user_types = generate_user_type_symlinks();
27906
- const cursor_mdc = _tool_active("cursor") ? generate_cursor_mdc_rules() : 0;
27907
- const windsurf_modern = _tool_active("windsurf") ? generate_windsurf_modern_rules() : 0;
27908
- const cursor_cmds = _tool_active("cursor") ? generate_cursor_commands(cmd_slugs) : 0;
27909
- const windsurf_wf = _tool_active("windsurf") ? generate_windsurf_workflows(cmd_slugs) : 0;
27910
- const summary = `\u2705 generate-tools \u2014 rules=${rules} skills=${skills} commands=${commands} subagents=${subagents} subagent_contexts=${subagent_contexts} plugin_cmd_skills=${plugin_cmd_skills} plugin_hooks=${plugin_hooks} personas=${personas} user_types=${user_types} cursor_mdc=${cursor_mdc} windsurf_rules=${windsurf_modern} cursor_commands=${cursor_cmds} windsurf_workflows=${windsurf_wf} windsurfrules=${windsurfrules}`;
27911
- if (resolve_level() === "verbose") {
27912
- _print3(`
27913
- ${summary}`);
27914
- } else {
27915
- success(summary);
27916
- flush_summary();
27917
- }
27918
- }
27919
- function generate_tools() {
27920
- const [cmd_slugs, skill_names] = _resolve_active_predicates();
27921
- const scoped = cmd_slugs !== null;
27922
- try {
27923
- _generate_tools_inner(cmd_slugs, skill_names);
27924
- } catch (e) {
27925
- if (scoped) {
27926
- info(" \u26A0\uFE0F scoped projection failed \u2014 restoring full (legacy-all) projection");
27927
- _generate_tools_inner(null, null);
27928
- }
27929
- throw e;
27930
- }
27931
- if (!scoped) {
27932
- info(
27933
- " \u2139\uFE0F Profile mode available \u2014 focused surface. Run `agent-config use --profile=developer`."
27934
- );
27935
- }
27936
- }
27937
- function project_to_augment() {
27938
- if (!_exists6(MODULE_STATE.TARGET_DIR)) {
27939
- _print3(` \u26A0\uFE0F ${path39.basename(MODULE_STATE.TARGET_DIR)}/ not found \u2014 nothing to project`);
27940
- return;
27941
- }
27942
- _mkdirp(MODULE_STATE.AUGMENT_DIR);
27943
- const use_symlinks = _read_augment_rules_use_symlinks();
27944
- const src_rules = path39.join(MODULE_STATE.TARGET_DIR, "rules");
27945
- const dst_rules = path39.join(MODULE_STATE.AUGMENT_DIR, "rules");
27946
- _mkdirp(dst_rules);
27947
- const existing = new Set(
27948
- _iterdirSorted4(dst_rules).filter((f) => _isFile13(f) || _isSymlink2(f)).map((f) => path39.basename(f))
27949
- );
27950
- const current = /* @__PURE__ */ new Set();
27951
- let written = 0;
27952
- if (_exists6(src_rules)) {
27953
- const rules = _iterdirSorted4(src_rules).filter((p) => p.endsWith(".md") && _isFile13(p)).map((p) => path39.basename(p)).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
27954
- for (const rule of rules) {
27955
- const target = path39.join(dst_rules, rule);
27956
- if (_isSymlink2(target) || _existsOrSymlink(target)) {
27957
- fs41.unlinkSync(target);
27958
- }
27959
- if (use_symlinks) {
27960
- fs41.symlinkSync(path39.join("..", "..", "dist/agent-src", "rules", rule), target);
27961
- } else {
27962
- copy_file(path39.join(src_rules, rule), target);
27963
- }
27964
- current.add(rule);
27965
- written += 1;
27966
- }
27967
- }
27968
- let removed_rules = 0;
27969
- for (const name of existing) {
27970
- if (!current.has(name)) {
27971
- fs41.unlinkSync(path39.join(dst_rules, name));
27972
- removed_rules += 1;
27973
- }
27974
- }
27975
- const mode_label = use_symlinks ? "Symlinked" : "Copied";
27976
- _print3(
27977
- ` \u2705 ${mode_label} ${written} rules to .augment/rules/` + (removed_rules ? ` (${removed_rules} stale removed)` : "")
27978
- );
27979
- for (const sub of AUGMENT_SYMLINK_DIRS) {
27980
- const dst = path39.join(MODULE_STATE.AUGMENT_DIR, sub);
27981
- if (_isSymlink2(dst) || _existsOrSymlink(dst)) {
27982
- if (_isDir11(dst) && !_isSymlink2(dst)) {
27983
- fs41.rmSync(dst, { recursive: true, force: true });
27984
- } else {
27985
- fs41.unlinkSync(dst);
27986
- }
27987
- }
27988
- const src = path39.join(MODULE_STATE.TARGET_DIR, sub);
27989
- if (_exists6(src)) {
27990
- fs41.symlinkSync(path39.join("..", "dist/agent-src", sub), dst);
27991
- _print3(` \u2705 Symlinked .augment/${sub} \u2192 ../dist/agent-src/${sub}`);
27992
- }
27993
- }
27994
- for (const name of AUGMENT_SYMLINK_FILES) {
27995
- const dst = path39.join(MODULE_STATE.AUGMENT_DIR, name);
27996
- const src = path39.join(MODULE_STATE.TARGET_DIR, name);
27997
- if (_isSymlink2(dst) || _existsOrSymlink(dst)) {
27998
- fs41.unlinkSync(dst);
27999
- }
28000
- if (_exists6(src)) {
28001
- fs41.symlinkSync(path39.join("..", "dist/agent-src", name), dst);
28002
- _print3(` \u2705 Symlinked .augment/${name} \u2192 ../dist/agent-src/${name}`);
28003
- }
28004
- }
28005
- const known = /* @__PURE__ */ new Set([...AUGMENT_SYMLINK_DIRS, ...AUGMENT_SYMLINK_FILES, "rules", "state"]);
28006
- for (const item of _iterdirSorted4(MODULE_STATE.AUGMENT_DIR)) {
28007
- const name = path39.basename(item);
28008
- if (known.has(name)) {
28009
- continue;
28010
- }
28011
- if (_isSymlink2(item) || _isFile13(item)) {
28012
- fs41.unlinkSync(item);
28013
- _print3(` \u{1F5D1}\uFE0F Removed stale .augment/${name}`);
28014
- } else if (_isDir11(item)) {
28015
- fs41.rmSync(item, { recursive: true, force: true });
28016
- _print3(` \u{1F5D1}\uFE0F Removed stale .augment/${name}/`);
28017
- }
28018
- }
28019
- }
28020
- function clean_tools() {
28021
- const targets = [
28022
- path39.join(MODULE_STATE.PROJECT_ROOT, ".claude"),
28023
- path39.join(MODULE_STATE.PROJECT_ROOT, ".cursor"),
28024
- path39.join(MODULE_STATE.PROJECT_ROOT, ".clinerules"),
28025
- path39.join(MODULE_STATE.PROJECT_ROOT, ".windsurf"),
28026
- path39.join(MODULE_STATE.PROJECT_ROOT, ".windsurfrules"),
28027
- path39.join(MODULE_STATE.PROJECT_ROOT, "GEMINI.md")
28028
- ];
28029
- for (const t of targets) {
28030
- if (_isDirNoFollow(t) && !_isSymlink2(t)) {
28031
- fs41.rmSync(t, { recursive: true, force: true });
28032
- _print3(` \u{1F5D1}\uFE0F Removed ${_relativeToPosix2(t, MODULE_STATE.PROJECT_ROOT)}`);
28033
- } else if (_existsOrSymlink(t)) {
28034
- fs41.unlinkSync(t);
28035
- _print3(` \u{1F5D1}\uFE0F Removed ${_relativeToPosix2(t, MODULE_STATE.PROJECT_ROOT)}`);
28036
- }
28037
- }
28038
- _print3("\u2705 All generated tool files cleaned");
28039
- }
28040
- function _print3(line) {
28041
- process.stdout.write(`${line}
28042
- `);
28043
- }
28044
- function main15(argv = process.argv.slice(2)) {
28045
- if (!_exists6(MODULE_STATE.SOURCE_DIR) && !_any_source_root_exists()) {
28046
- _print3(
28047
- `\u274C No source directory found (looked at the artefact roots under src/ and ${MODULE_STATE.SOURCE_DIR})`
28048
- );
28049
- return 1;
28050
- }
28051
- const arg = argv.length > 0 ? argv[0] : "--sync";
28052
- if (arg === "--list") {
28053
- const files = list_md_files(MODULE_STATE.SOURCE_DIR);
28054
- _print3(`\u{1F4C4} ${files.length} .md files total:
28055
- `);
28056
- for (const f of files) {
28057
- _print3(` ${f}`);
28058
- }
28059
- } else if (arg === "--changed") {
28060
- const changed = list_changed_md(MODULE_STATE.SOURCE_DIR);
28061
- if (changed.length === 0) {
28062
- _print3("\u2705 Every .md projection matches its source");
28063
- return 0;
28064
- }
28065
- _print3(`\u{1F4DD} ${changed.length} .md projection(s) out of date \u2014 run 'task sync':
28066
- `);
28067
- for (const f of changed) {
28068
- _print3(` ${f}`);
28069
- }
28070
- } else if (arg === "--check") {
28071
- const [missing, stale] = check_sync(MODULE_STATE.SOURCE_DIR, MODULE_STATE.TARGET_DIR);
28072
- if (missing.length === 0 && stale.length === 0) {
28073
- _print3("\u2705 dist/agent-src/ is in sync with the artefact roots under src/");
28074
- return 0;
28075
- }
28076
- if (missing.length > 0) {
28077
- _print3(`\u274C Missing in dist/agent-src/ (${missing.length}):`);
28078
- for (const f of missing) {
28079
- _print3(` ${f}`);
28080
- }
28081
- }
28082
- if (stale.length > 0) {
28083
- _print3(`\u274C Stale in dist/agent-src/ (${stale.length}):`);
28084
- for (const f of stale) {
28085
- _print3(` ${f}`);
28086
- }
28087
- }
28088
- _print3(`
28089
- Run 'task sync' \u2014 the projection is a deterministic copy, so it needs no agent step.`);
28090
- return 1;
28091
- } else if (arg === "--sync") {
28092
- _print3(`Source: the artefact roots under src/`);
28093
- _print3(`Target: ${MODULE_STATE.TARGET_DIR}
28094
- `);
28095
- _print3("--- Syncing non-.md files ---");
28096
- const copied = sync_non_md(MODULE_STATE.SOURCE_DIR, MODULE_STATE.TARGET_DIR);
28097
- _print3(`
28098
- --- Cleanup stale files ---`);
28099
- const deleted = cleanup_stale(MODULE_STATE.SOURCE_DIR, MODULE_STATE.TARGET_DIR);
28100
- const changed = list_changed_md(MODULE_STATE.SOURCE_DIR);
28101
- _print3(`
28102
- \u2705 Done: ${copied} copied, ${deleted} stale deleted`);
28103
- if (changed.length > 0) {
28104
- _print3(`\u274C ${changed.length} .md projection(s) still out of date after sync (run --changed)`);
28105
- } else {
28106
- _print3(`\u2705 Every .md projection matches its source`);
28107
- }
28108
- _print3(`
28109
- --- Projecting dist/agent-src/ \u2192 .augment/ ---`);
28110
- project_to_augment();
28111
- } else if (arg === "--generate-tools") {
28112
- generate_tools();
28113
- } else if (arg === "--clean-tools") {
28114
- clean_tools();
28115
- } else if (arg === "--project-augment") {
28116
- project_to_augment();
28117
- } else {
28118
- _print3(
28119
- "Usage: condense [--sync|--list|--changed|--check|--generate-tools|--clean-tools|--project-augment]"
28120
- );
28121
- return 1;
28122
- }
28123
- return 0;
28124
- }
28125
- function _isCliEntry15() {
28126
- if (process.argv[1] === void 0) {
28127
- return false;
28128
- }
28129
- const argvUrl = pathToFileURL15(path39.resolve(process.argv[1])).href;
28130
- if (import.meta.url === argvUrl) {
28131
- return true;
28132
- }
28133
- try {
28134
- const here = fs41.realpathSync(fileURLToPath23(import.meta.url));
28135
- const argv = fs41.realpathSync(path39.resolve(process.argv[1]));
28136
- return here === argv;
28137
- } catch {
28138
- return false;
28139
- }
28140
- }
28141
- var YAML4, _SLUG_PREFIX_RE, _HERE12, _DEFAULT_PROJECT_ROOT, MODULE_STATE, COPY_AS_IS, COPY_AS_IS_DIRS, USER_SCOPE_RULE_DIRS, COPY_MD_VERBATIM, TOOL_DIRS, PERSONA_TOOL_DIRS, USER_TYPE_TOOL_DIRS, _DIR_TOOL_ID, _LEGACY_SRC_PREFIX, _PROJECTED_SRC_PREFIX, _LEGACY_PROJECTED_SRC_PREFIX, _FM_LIST_ITEM_RE, _FM_PATH_PREFIX_RE, _BODY_DOCS_RE, _FM_PLAIN_LIST_RE, _HRR_BANNER_MARKER, PLUGIN_POINTER_SLUG, PLUGIN_POINTER_SKILL_BODY, AUGMENT_SYMLINK_DIRS, AUGMENT_SYMLINK_FILES, isMain;
28142
- var init_condense = __esm({
28143
- "src/scripts/condense.ts"() {
26213
+ var YAML4;
26214
+ var init_ruleInScope = __esm({
26215
+ "src/install/ruleInScope.ts"() {
28144
26216
  "use strict";
28145
26217
  YAML4 = __toESM(require_dist(), 1);
28146
- init_agent_src();
28147
- init_claude_settings_hooks();
28148
- init_claude_builtin_names();
28149
- init_agent_settings();
28150
- init_compile_time_toggles();
28151
- init_script_output();
28152
- init_model_tier();
28153
- _SLUG_PREFIX_RE = /^slug_prefix:\s*"?([a-z][a-z0-9-]*)"?\s*$/m;
28154
- _HERE12 = path39.dirname(fileURLToPath23(import.meta.url));
28155
- _DEFAULT_PROJECT_ROOT = path39.resolve(_HERE12, "..", "..");
28156
- MODULE_STATE = _deriveState(_DEFAULT_PROJECT_ROOT);
28157
- COPY_AS_IS = /* @__PURE__ */ new Set(["README.md"]);
28158
- COPY_AS_IS_DIRS = /* @__PURE__ */ new Set(["ghostwriter"]);
28159
- USER_SCOPE_RULE_DIRS = {
28160
- ".claude/rules": path39.join(".claude", "rules")
28161
- };
28162
- COPY_MD_VERBATIM = true;
28163
- TOOL_DIRS = {
28164
- ".claude/rules": "../../dist/agent-src/rules",
28165
- ".cursor/rules": "../../dist/agent-src/rules",
28166
- ".clinerules": "../dist/agent-src/rules"
28167
- };
28168
- PERSONA_TOOL_DIRS = {
28169
- ".claude/personas": "../../dist/agent-src/personas",
28170
- ".cursor/personas": "../../dist/agent-src/personas"
28171
- };
28172
- USER_TYPE_TOOL_DIRS = {
28173
- ".claude/user-types": "../../dist/agent-src/user-types",
28174
- ".cursor/user-types": "../../dist/agent-src/user-types"
28175
- };
28176
- _DIR_TOOL_ID = {
28177
- ".claude/rules": "claude-code",
28178
- ".cursor/rules": "cursor",
28179
- ".clinerules": "cline",
28180
- ".claude/personas": "claude-code",
28181
- ".cursor/personas": "cursor",
28182
- ".claude/user-types": "claude-code",
28183
- ".cursor/user-types": "cursor"
28184
- };
28185
- _LEGACY_SRC_PREFIX = ".agent-src.uncondensed/";
28186
- _PROJECTED_SRC_PREFIX = "dist/agent-src/";
28187
- _LEGACY_PROJECTED_SRC_PREFIX = ".agent-src/";
28188
- _FM_LIST_ITEM_RE = /^(\s*-\s*)(["']?)([^"'\n]+?\.md)(["']?)\s*$/;
28189
- _FM_PATH_PREFIX_RE = /^(\s*(?:-\s+)?path_prefix:\s*)(["']?)([^"'\n]+?)(["']?)\s*$/;
28190
- _BODY_DOCS_RE = /\.\.\/\.\.\/(docs\/(?:guidelines|contracts)\/[^)\s]+\.md)/g;
28191
- _FM_PLAIN_LIST_RE = /^\s*-\s*(["']?)([^"'\n]+?)\1\s*$/;
28192
- _HRR_BANNER_MARKER = "<!-- agent-config:human-review-banner -->";
28193
- PLUGIN_POINTER_SLUG = "install-agent-config";
28194
- PLUGIN_POINTER_SKILL_BODY = `---
28195
- name: install-agent-config
28196
- description: >-
28197
- Install or upgrade the event4u agent-config suite. This marketplace plugin
28198
- is a bootstrap shim \u2014 it ships hooks plus this pointer only; ALL skills,
28199
- rules, and commands are installed via \`npx -y @event4u/agent-config init\`.
28200
- Use when the user asks to install, set up, or upgrade agent-config, or
28201
- wonders why this plugin contains no other skills.
28202
- ---
28203
-
28204
- # Install agent-config
28205
-
28206
- This plugin is a **bootstrap shim**. It exists so the marketplace listing
28207
- stays discoverable and existing plugin installs keep working hooks \u2014 the
28208
- content surface (skills, rules, commands, personas) is distributed as a
28209
- file projection, not through this plugin.
28210
-
28211
- ## Install (canonical, one command)
28212
-
28213
- \`\`\`bash
28214
- npx -y @event4u/agent-config init
28215
- \`\`\`
28216
-
28217
- The installer writes the full content projection, registers the dispatcher
28218
- hooks as a managed block in \`~/.claude/settings.json\` (byte-identical to
28219
- this plugin's hooks, so nothing double-fires), and keeps everything
28220
- upgradeable via \`agent-config upgrade\`.
28221
-
28222
- ## Already installed both?
28223
-
28224
- Run \`agent-config doctor\` to check for duplicate surfaces, and
28225
- \`agent-config converge\` to clean up consented duplicates.
28226
- `;
28227
- AUGMENT_SYMLINK_DIRS = [
28228
- "skills",
28229
- "commands",
28230
- "guidelines",
28231
- "personas",
28232
- "user-types",
28233
- "templates",
28234
- "contexts",
28235
- "scripts"
28236
- ];
28237
- AUGMENT_SYMLINK_FILES = ["README.md"];
28238
- isMain = _isCliEntry15();
28239
- if (isMain) {
28240
- process.exit(main15());
28241
- }
28242
26218
  }
28243
26219
  });
28244
26220
 
28245
26221
  // src/install/rule_scope.ts
28246
26222
  import * as fs42 from "node:fs";
28247
- import * as path40 from "node:path";
26223
+ import * as path39 from "node:path";
28248
26224
  function _list(value) {
28249
26225
  if (Array.isArray(value) && value.length > 0) {
28250
26226
  return value.map((v) => String(v));
@@ -28267,8 +26243,8 @@ function ruleFileArrives(sourcePath, scope) {
28267
26243
  if (!sourcePath.endsWith(".md")) {
28268
26244
  return true;
28269
26245
  }
28270
- const basename19 = path40.basename(sourcePath);
28271
- if (COMPAT_ALWAYS_EXCLUDED.includes(basename19)) {
26246
+ const basename18 = path39.basename(sourcePath);
26247
+ if (COMPAT_ALWAYS_EXCLUDED.includes(basename18)) {
28272
26248
  return false;
28273
26249
  }
28274
26250
  return rule_in_scope(sourcePath, scope.workspaces, scope.packs, scope.roles ?? null);
@@ -28285,7 +26261,7 @@ function excludedRuleBasenames(rulesDir, scope) {
28285
26261
  if (!name.endsWith(".md")) {
28286
26262
  continue;
28287
26263
  }
28288
- const full = path40.join(rulesDir, name);
26264
+ const full = path39.join(rulesDir, name);
28289
26265
  try {
28290
26266
  if (!fs42.statSync(full).isFile()) {
28291
26267
  continue;
@@ -28303,7 +26279,7 @@ var COMPAT_ALWAYS_EXCLUDED, LEGACY_ALL;
28303
26279
  var init_rule_scope = __esm({
28304
26280
  "src/install/rule_scope.ts"() {
28305
26281
  "use strict";
28306
- init_condense();
26282
+ init_ruleInScope();
28307
26283
  COMPAT_ALWAYS_EXCLUDED = ["source-of-truth.md"];
28308
26284
  LEGACY_ALL = { workspaces: null, packs: null };
28309
26285
  }
@@ -28374,18 +26350,18 @@ __export(cmd_doctor_exports, {
28374
26350
  _settings_layer_chain: () => _settings_layer_chain,
28375
26351
  _skipped_manifest_check: () => _skipped_manifest_check,
28376
26352
  _wizard_state_path: () => _wizard_state_path,
28377
- main: () => main16
26353
+ main: () => main15
28378
26354
  });
28379
26355
  import * as crypto6 from "node:crypto";
28380
26356
  import * as fs43 from "node:fs";
28381
- import * as os12 from "node:os";
28382
- import * as path41 from "node:path";
26357
+ import * as os11 from "node:os";
26358
+ import * as path40 from "node:path";
28383
26359
  import process15 from "node:process";
28384
- import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL16 } from "node:url";
26360
+ import { fileURLToPath as fileURLToPath23, pathToFileURL as pathToFileURL15 } from "node:url";
28385
26361
  function expanduser5(p) {
28386
- if (p === "~") return os12.homedir();
26362
+ if (p === "~") return os11.homedir();
28387
26363
  if (p.startsWith("~/") || p.startsWith("~\\")) {
28388
- return path41.join(os12.homedir(), p.slice(2));
26364
+ return path40.join(os11.homedir(), p.slice(2));
28389
26365
  }
28390
26366
  return p;
28391
26367
  }
@@ -28413,9 +26389,9 @@ function isDir2(p) {
28413
26389
  }
28414
26390
  function resolvePath(p) {
28415
26391
  try {
28416
- return fs43.realpathSync(path41.resolve(p));
26392
+ return fs43.realpathSync(path40.resolve(p));
28417
26393
  } catch {
28418
- return path41.resolve(p);
26394
+ return path40.resolve(p);
28419
26395
  }
28420
26396
  }
28421
26397
  function readText2(p) {
@@ -28526,7 +26502,7 @@ function _resolve_project_root(arg) {
28526
26502
  return resolve_project_root(arg);
28527
26503
  }
28528
26504
  function _detect_install_mode(project_root) {
28529
- const marker = path41.join(project_root, _INSTALL_MODE_MARKER_REL);
26505
+ const marker = path40.join(project_root, _INSTALL_MODE_MARKER_REL);
28530
26506
  if (isFile3(marker)) {
28531
26507
  let value;
28532
26508
  try {
@@ -28538,9 +26514,9 @@ function _detect_install_mode(project_root) {
28538
26514
  return [value, "marker-file"];
28539
26515
  }
28540
26516
  }
28541
- const has_agents_md = pathExists(path41.join(project_root, "AGENTS.md"));
26517
+ const has_agents_md = pathExists(path40.join(project_root, "AGENTS.md"));
28542
26518
  const has_copilot = pathExists(
28543
- path41.join(project_root, ".github", "copilot-instructions.md")
26519
+ path40.join(project_root, ".github", "copilot-instructions.md")
28544
26520
  );
28545
26521
  if (has_agents_md && has_copilot) {
28546
26522
  return ["full", "heuristic"];
@@ -28560,7 +26536,7 @@ function _settings_layer_chain(project_root) {
28560
26536
  return layers;
28561
26537
  }
28562
26538
  function _detect_wrapper(project_root) {
28563
- const wrapper = path41.join(project_root, "agent-config");
26539
+ const wrapper = path40.join(project_root, "agent-config");
28564
26540
  if (!pathExists(wrapper)) {
28565
26541
  return { path: String(wrapper), exists: false, embedded_root: null };
28566
26542
  }
@@ -28627,8 +26603,8 @@ function _emit_context_text(ctx) {
28627
26603
  }
28628
26604
  function _resolve_path(project_root, raw) {
28629
26605
  let p = expanduser5(raw);
28630
- if (!path41.isAbsolute(p)) {
28631
- p = path41.join(project_root, p);
26606
+ if (!path40.isAbsolute(p)) {
26607
+ p = path40.join(project_root, p);
28632
26608
  }
28633
26609
  return p;
28634
26610
  }
@@ -28641,7 +26617,7 @@ function _sha256(p) {
28641
26617
  }
28642
26618
  }
28643
26619
  function _read_inline_package_tag(p) {
28644
- if (path41.extname(p) !== ".md") {
26620
+ if (path40.extname(p) !== ".md") {
28645
26621
  return NO_FRONTMATTER;
28646
26622
  }
28647
26623
  let text;
@@ -28776,7 +26752,7 @@ function rglob2(root) {
28776
26752
  }
28777
26753
  entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
28778
26754
  for (const ent of entries) {
28779
- const full = path41.join(dir, ent.name);
26755
+ const full = path40.join(dir, ent.name);
28780
26756
  out.push(full);
28781
26757
  let dirLike = ent.isDirectory();
28782
26758
  if (ent.isSymbolicLink()) {
@@ -28851,19 +26827,19 @@ function _foreign_records(project_root, foreign) {
28851
26827
  return out;
28852
26828
  }
28853
26829
  function relativeTo(p, base) {
28854
- const rel = path41.relative(base, p);
26830
+ const rel = path40.relative(base, p);
28855
26831
  if (rel === "") return rel;
28856
- if (rel.startsWith("..") || path41.isAbsolute(rel)) {
26832
+ if (rel.startsWith("..") || path40.isAbsolute(rel)) {
28857
26833
  return null;
28858
26834
  }
28859
26835
  return rel;
28860
26836
  }
28861
26837
  function _is_global_only_consumer(project_root) {
28862
- return isFile3(path41.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path41.join(project_root, "agents", "overrides"));
26838
+ return isFile3(path40.join(project_root, INSTALL_MODE_MARKER_RELATIVE)) || isDir2(path40.join(project_root, "agents", "overrides"));
28863
26839
  }
28864
26840
  function _check_scope(project_root) {
28865
26841
  for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
28866
- if (pathExists(path41.join(project_root, marker))) {
26842
+ if (pathExists(path40.join(project_root, marker))) {
28867
26843
  return {
28868
26844
  id: "scope",
28869
26845
  status: "warn",
@@ -28872,7 +26848,7 @@ function _check_scope(project_root) {
28872
26848
  };
28873
26849
  }
28874
26850
  }
28875
- const pkg = path41.join(project_root, "package.json");
26851
+ const pkg = path40.join(project_root, "package.json");
28876
26852
  if (pathExists(pkg)) {
28877
26853
  try {
28878
26854
  const data = JSON.parse(readText2(pkg));
@@ -28895,23 +26871,23 @@ function _check_scope(project_root) {
28895
26871
  };
28896
26872
  }
28897
26873
  function _git_config_path(project_root) {
28898
- const gd = path41.join(project_root, ".git");
26874
+ const gd = path40.join(project_root, ".git");
28899
26875
  try {
28900
26876
  const st = fs43.statSync(gd);
28901
26877
  if (st.isDirectory()) {
28902
- return path41.join(gd, "config");
26878
+ return path40.join(gd, "config");
28903
26879
  }
28904
26880
  const m = readText2(gd).match(/^gitdir:\s*(.+)\s*$/m);
28905
26881
  if (m === null) {
28906
26882
  return null;
28907
26883
  }
28908
- const gdPath = path41.resolve(project_root, m[1].trim());
28909
- const commondirFile = path41.join(gdPath, "commondir");
26884
+ const gdPath = path40.resolve(project_root, m[1].trim());
26885
+ const commondirFile = path40.join(gdPath, "commondir");
28910
26886
  if (pathExists(commondirFile)) {
28911
- const common = path41.resolve(gdPath, readText2(commondirFile).trim());
28912
- return path41.join(common, "config");
26887
+ const common = path40.resolve(gdPath, readText2(commondirFile).trim());
26888
+ return path40.join(common, "config");
28913
26889
  }
28914
- return path41.join(gdPath, "config");
26890
+ return path40.join(gdPath, "config");
28915
26891
  } catch {
28916
26892
  return null;
28917
26893
  }
@@ -28944,7 +26920,7 @@ function _check_git_identity(project_root) {
28944
26920
  }
28945
26921
  let ident = _parse_git_user(readText2(cfgPath));
28946
26922
  if (ident.name === null && ident.email === null) {
28947
- const globalCfg = path41.join(os12.homedir(), ".gitconfig");
26923
+ const globalCfg = path40.join(os11.homedir(), ".gitconfig");
28948
26924
  if (pathExists(globalCfg)) {
28949
26925
  ident = _parse_git_user(readText2(globalCfg));
28950
26926
  }
@@ -29005,7 +26981,7 @@ function _package_root() {
29005
26981
  }
29006
26982
  function _current_package_version() {
29007
26983
  try {
29008
- const data = JSON.parse(readText2(path41.join(_package_root(), "package.json")));
26984
+ const data = JSON.parse(readText2(path40.join(_package_root(), "package.json")));
29009
26985
  const v = data["version"];
29010
26986
  if (typeof v === "string" && v.trim()) {
29011
26987
  return v.trim();
@@ -29049,12 +27025,12 @@ function _check_lockfile_freshness(manifest) {
29049
27025
  };
29050
27026
  }
29051
27027
  function shutilWhich(name) {
29052
- if (path41.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
27028
+ if (path40.dirname(name) !== "." && (name.includes("/") || name.includes("\\"))) {
29053
27029
  return isExecutableFile(name) ? name : null;
29054
27030
  }
29055
27031
  const pathEnv = process15.env["PATH"] || "";
29056
- const sep15 = process15.platform === "win32" ? ";" : ":";
29057
- const dirs = pathEnv.split(sep15);
27032
+ const sep14 = process15.platform === "win32" ? ";" : ":";
27033
+ const dirs = pathEnv.split(sep14);
29058
27034
  const exts = process15.platform === "win32" ? (process15.env["PATHEXT"] || ".COM;.EXE;.BAT;.CMD").split(";") : [""];
29059
27035
  const seenDirs = /* @__PURE__ */ new Set();
29060
27036
  for (const dir of dirs) {
@@ -29062,12 +27038,12 @@ function shutilWhich(name) {
29062
27038
  if (seenDirs.has(d)) continue;
29063
27039
  seenDirs.add(d);
29064
27040
  for (const ext of exts) {
29065
- const candidate = path41.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
27041
+ const candidate = path40.join(d, name + (ext === "" ? "" : ext.toLowerCase() === ext ? ext : ext));
29066
27042
  if (isExecutableFile(candidate)) {
29067
27043
  return candidate;
29068
27044
  }
29069
27045
  if (ext !== "") {
29070
- const upper = path41.join(d, name + ext);
27046
+ const upper = path40.join(d, name + ext);
29071
27047
  if (isExecutableFile(upper)) return upper;
29072
27048
  }
29073
27049
  }
@@ -29143,7 +27119,7 @@ function _check_claude_plugin() {
29143
27119
  remedy: ""
29144
27120
  };
29145
27121
  }
29146
- const projection = path41.join(os12.homedir(), ".claude", "skills");
27122
+ const projection = path40.join(os11.homedir(), ".claude", "skills");
29147
27123
  const projection_present = isDir2(projection);
29148
27124
  if (projection_present) {
29149
27125
  return {
@@ -29180,8 +27156,8 @@ function _check_claude_command_wrappers() {
29180
27156
  remedy: ""
29181
27157
  };
29182
27158
  }
29183
- const anchor = path41.join(os12.homedir(), ".claude");
29184
- const commands_dir = path41.join(anchor, "commands");
27159
+ const anchor = path40.join(os11.homedir(), ".claude");
27160
+ const commands_dir = path40.join(anchor, "commands");
29185
27161
  if (!isDir2(commands_dir)) {
29186
27162
  return {
29187
27163
  id: "claude-command-wrappers",
@@ -29190,8 +27166,8 @@ function _check_claude_command_wrappers() {
29190
27166
  remedy: ""
29191
27167
  };
29192
27168
  }
29193
- const flat_probe = fs43.existsSync(path41.join(commands_dir, "commit.md"));
29194
- const wrapper_probe = fs43.existsSync(path41.join(anchor, "skills", "commit", "SKILL.md"));
27169
+ const flat_probe = fs43.existsSync(path40.join(commands_dir, "commit.md"));
27170
+ const wrapper_probe = fs43.existsSync(path40.join(anchor, "skills", "commit", "SKILL.md"));
29195
27171
  if (wrapper_probe) {
29196
27172
  return {
29197
27173
  id: "claude-command-wrappers",
@@ -29216,7 +27192,7 @@ function _check_claude_command_wrappers() {
29216
27192
  };
29217
27193
  }
29218
27194
  function _check_surface_state() {
29219
- const matrix_path = path41.join(_package_root(), "src", "config", "surface-matrix.yml");
27195
+ const matrix_path = path40.join(_package_root(), "src", "config", "surface-matrix.yml");
29220
27196
  if (!isFile3(matrix_path)) {
29221
27197
  return {
29222
27198
  id: "surface-state",
@@ -29240,7 +27216,7 @@ function _check_surface_state() {
29240
27216
  remedy: "agent-config upgrade (reinstalls the package data files)"
29241
27217
  };
29242
27218
  }
29243
- const _expand = (p) => p.startsWith("~/") ? path41.join(os12.homedir(), p.slice(2)) : path41.join(_package_root(), p);
27219
+ const _expand = (p) => p.startsWith("~/") ? path40.join(os11.homedir(), p.slice(2)) : path40.join(_package_root(), p);
29244
27220
  const violations = [];
29245
27221
  const remedies = [];
29246
27222
  let checked = 0;
@@ -29298,11 +27274,11 @@ function _check_hook_wiring() {
29298
27274
  remedy: ""
29299
27275
  };
29300
27276
  }
29301
- const settings_path = path41.join(os12.homedir(), ".claude", "settings.json");
27277
+ const settings_path = path40.join(os11.homedir(), ".claude", "settings.json");
29302
27278
  let missing;
29303
27279
  try {
29304
27280
  const matrix = build_claude_hook_matrix(
29305
- path41.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
27281
+ path40.join(_package_root(), "src", "scripts", "hook_manifest.yaml")
29306
27282
  );
29307
27283
  const settings = pathExists(settings_path) ? JSON.parse(fs43.readFileSync(settings_path, "utf8")) : {};
29308
27284
  const hooks = (settings["hooks"] ?? {}) || {};
@@ -29379,7 +27355,7 @@ function _check_mcp_mode(project_root) {
29379
27355
  ];
29380
27356
  const found = [];
29381
27357
  for (const [rel, label] of candidates) {
29382
- const p = path41.join(project_root, rel);
27358
+ const p = path40.join(project_root, rel);
29383
27359
  if (!pathExists(p)) {
29384
27360
  continue;
29385
27361
  }
@@ -29411,7 +27387,7 @@ function _check_mcp_mode(project_root) {
29411
27387
  };
29412
27388
  }
29413
27389
  function _check_offline_readiness() {
29414
- const script = path41.join(_package_root(), "src", "scripts", "hermetic-install.sh");
27390
+ const script = path40.join(_package_root(), "src", "scripts", "hermetic-install.sh");
29415
27391
  if (!pathExists(script)) {
29416
27392
  return {
29417
27393
  id: "offline-readiness",
@@ -29469,7 +27445,7 @@ function _check_stale_orphans() {
29469
27445
  (a, b) => a < b ? -1 : a > b ? 1 : 0
29470
27446
  );
29471
27447
  for (const root_name of ownedSorted) {
29472
- const root = path41.join(anchor, root_name);
27448
+ const root = path40.join(anchor, root_name);
29473
27449
  if (!isDir2(root)) {
29474
27450
  continue;
29475
27451
  }
@@ -29484,7 +27460,7 @@ function _check_stale_orphans() {
29484
27460
  if (rel === null) {
29485
27461
  continue;
29486
27462
  }
29487
- const relPosix2 = rel.split(path41.sep).join("/");
27463
+ const relPosix2 = rel.split(path40.sep).join("/");
29488
27464
  if (recorded_set.has(relPosix2)) {
29489
27465
  continue;
29490
27466
  }
@@ -29533,14 +27509,14 @@ function _check_rule_scope_drift(project_root) {
29533
27509
  let rules_dir = null;
29534
27510
  let found = 0;
29535
27511
  for (const rel of _RULE_PROJECTION_DIRS) {
29536
- const cand = path41.join(project_root, rel);
27512
+ const cand = path40.join(project_root, rel);
29537
27513
  if (!isDir2(cand)) {
29538
27514
  continue;
29539
27515
  }
29540
27516
  let count = 0;
29541
27517
  try {
29542
27518
  for (const name of fs43.readdirSync(cand)) {
29543
- if (name.endsWith(".md") && isFile3(path41.join(cand, name))) {
27519
+ if (name.endsWith(".md") && isFile3(path40.join(cand, name))) {
29544
27520
  count += 1;
29545
27521
  }
29546
27522
  }
@@ -29594,14 +27570,14 @@ function _check_rule_scope_drift(project_root) {
29594
27570
  };
29595
27571
  }
29596
27572
  function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
29597
- const user_rules_dir = userRulesDirOverride ?? path41.join(os12.homedir(), ".claude", "rules");
27573
+ const user_rules_dir = userRulesDirOverride ?? path40.join(os11.homedir(), ".claude", "rules");
29598
27574
  let project_rules_dir = null;
29599
27575
  if (_is_source_repo(project_root)) {
29600
- const cand = path41.join(project_root, "dist", "agent-src", "rules");
27576
+ const cand = path40.join(project_root, "dist", "agent-src", "rules");
29601
27577
  if (isDir2(cand)) project_rules_dir = cand;
29602
27578
  } else {
29603
27579
  for (const rel of _RULE_PROJECTION_DIRS) {
29604
- const cand = path41.join(project_root, rel);
27580
+ const cand = path40.join(project_root, rel);
29605
27581
  if (isDir2(cand)) {
29606
27582
  project_rules_dir = cand;
29607
27583
  break;
@@ -29670,7 +27646,7 @@ function _check_mcp_beta_readiness(project_root) {
29670
27646
  }
29671
27647
  const pending = [];
29672
27648
  for (const [gate_id, rel] of MCP_BETA_GATES) {
29673
- if (!pathExists(path41.join(project_root, rel))) {
27649
+ if (!pathExists(path40.join(project_root, rel))) {
29674
27650
  pending.push(`${gate_id} (${rel})`);
29675
27651
  }
29676
27652
  }
@@ -29691,7 +27667,7 @@ function _check_mcp_beta_readiness(project_root) {
29691
27667
  }
29692
27668
  function _check_tier_usage_readiness(project_root) {
29693
27669
  const settings_file = project_settings_path(project_root);
29694
- let log_path = path41.join(project_root, ".agent-tier-usage.jsonl");
27670
+ let log_path = path40.join(project_root, ".agent-tier-usage.jsonl");
29695
27671
  let enabled = false;
29696
27672
  if (isFile3(settings_file)) {
29697
27673
  let raw;
@@ -29710,7 +27686,7 @@ function _check_tier_usage_readiness(project_root) {
29710
27686
  const outputRaw = tu["output"];
29711
27687
  const output = typeof outputRaw === "object" && outputRaw !== null && !Array.isArray(outputRaw) ? outputRaw : {};
29712
27688
  if (typeof output["path"] === "string" && output["path"].trim()) {
29713
- log_path = path41.join(project_root, output["path"].trim());
27689
+ log_path = path40.join(project_root, output["path"].trim());
29714
27690
  }
29715
27691
  const val = tu["enabled"];
29716
27692
  if (typeof val === "boolean") {
@@ -29735,7 +27711,7 @@ function _check_tier_usage_readiness(project_root) {
29735
27711
  return {
29736
27712
  id: "tier-usage-readiness",
29737
27713
  status: "warn",
29738
- message: `tier-usage telemetry on but ${path41.basename(log_path)} not yet written \u2014 no signal accumulated`,
27714
+ message: `tier-usage telemetry on but ${path40.basename(log_path)} not yet written \u2014 no signal accumulated`,
29739
27715
  remedy: "run any tracked command to seed the log; the dispatcher writes one record per invocation"
29740
27716
  };
29741
27717
  }
@@ -29750,7 +27726,7 @@ function _check_tier_usage_readiness(project_root) {
29750
27726
  return {
29751
27727
  id: "tier-usage-readiness",
29752
27728
  status: "fail",
29753
- message: `cannot read ${path41.basename(log_path)}: ${osErrorStr2(exc)}`,
27729
+ message: `cannot read ${path40.basename(log_path)}: ${osErrorStr2(exc)}`,
29754
27730
  remedy: "fix permissions on the tier-usage log"
29755
27731
  };
29756
27732
  }
@@ -29781,7 +27757,7 @@ function _check_tier_usage_readiness(project_root) {
29781
27757
  return {
29782
27758
  id: "tier-usage-readiness",
29783
27759
  status: "fail",
29784
- message: `${total} record(s) in ${path41.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
27760
+ message: `${total} record(s) in ${path40.basename(log_path)} but 0 passed the privacy floor \u2014 report would refuse to render`,
29785
27761
  remedy: "inspect the log; the dispatcher is writing records the contract forbids (paths, argv, message bodies)"
29786
27762
  };
29787
27763
  }
@@ -29789,14 +27765,14 @@ function _check_tier_usage_readiness(project_root) {
29789
27765
  return {
29790
27766
  id: "tier-usage-readiness",
29791
27767
  status: "warn",
29792
- message: `${path41.basename(log_path)} present but empty \u2014 no signal yet`,
27768
+ message: `${path40.basename(log_path)} present but empty \u2014 no signal yet`,
29793
27769
  remedy: "run any tracked command to seed the log"
29794
27770
  };
29795
27771
  }
29796
27772
  return {
29797
27773
  id: "tier-usage-readiness",
29798
27774
  status: "ok",
29799
- message: `${valid} record(s) past the privacy floor in ${path41.basename(log_path)} \u2014 retiering signal available`,
27775
+ message: `${valid} record(s) past the privacy floor in ${path40.basename(log_path)} \u2014 retiering signal available`,
29800
27776
  remedy: ""
29801
27777
  };
29802
27778
  }
@@ -30135,7 +28111,7 @@ function _check_team(project_root) {
30135
28111
  if (binary_resolved === null) {
30136
28112
  remedies.push("install the codex CLI: `npm install -g @openai/codex`");
30137
28113
  }
30138
- const auth_path = path41.join(_codex_home(), "auth.json");
28114
+ const auth_path = path40.join(_codex_home(), "auth.json");
30139
28115
  const authed = pathExists(auth_path);
30140
28116
  let auth_str;
30141
28117
  if (!authed) {
@@ -30215,7 +28191,7 @@ function _check_unsupported_combos(manifest) {
30215
28191
  };
30216
28192
  }
30217
28193
  function _wizard_state_path() {
30218
- return path41.join(event4u_root(), "state", "wizard-state.json");
28194
+ return path40.join(event4u_root(), "state", "wizard-state.json");
30219
28195
  }
30220
28196
  function _check_wizard_state() {
30221
28197
  const state_pth = _wizard_state_path();
@@ -30295,7 +28271,7 @@ function _check_wizard_state() {
30295
28271
  };
30296
28272
  }
30297
28273
  function _check_settings_review_pending() {
30298
- const delta_pth = path41.join(event4u_root(), "state", "settings-delta.json");
28274
+ const delta_pth = path40.join(event4u_root(), "state", "settings-delta.json");
30299
28275
  if (!pathExists(delta_pth)) {
30300
28276
  return {
30301
28277
  id: "settings-review-pending",
@@ -30321,7 +28297,7 @@ function _check_settings_review_pending() {
30321
28297
  }
30322
28298
  function _check_memory_merge_union(project_root) {
30323
28299
  const remedy = "run: npx tsx src/scripts/sync_gitattributes.ts (or `agent-config refresh --project`)";
30324
- const target = path41.join(project_root, DEFAULT_GITATTRIBUTES);
28300
+ const target = path40.join(project_root, DEFAULT_GITATTRIBUTES);
30325
28301
  if (!pathExists(target)) {
30326
28302
  return {
30327
28303
  id: "memory-merge-union",
@@ -30814,7 +28790,7 @@ function _run_repair(opts) {
30814
28790
  eprint(`\u274C doctor: unknown repair target ${pyRepr2(target)}`);
30815
28791
  return 2;
30816
28792
  }
30817
- function main16(argv = null) {
28793
+ function main15(argv = null) {
30818
28794
  const opts = _parse2(argv !== null ? Array.from(argv) : process15.argv.slice(2));
30819
28795
  if (opts.ci) {
30820
28796
  opts.json = true;
@@ -30879,23 +28855,23 @@ function main16(argv = null) {
30879
28855
  }
30880
28856
  return drift_present ? 1 : 0;
30881
28857
  }
30882
- function _isCliEntry16() {
28858
+ function _isCliEntry15() {
30883
28859
  if (process15.argv[1] === void 0) {
30884
28860
  return false;
30885
28861
  }
30886
- const argvUrl = pathToFileURL16(path41.resolve(process15.argv[1])).href;
28862
+ const argvUrl = pathToFileURL15(path40.resolve(process15.argv[1])).href;
30887
28863
  if (import.meta.url === argvUrl) {
30888
28864
  return true;
30889
28865
  }
30890
28866
  try {
30891
- const here = fs43.realpathSync(fileURLToPath24(import.meta.url));
30892
- const argv = fs43.realpathSync(path41.resolve(process15.argv[1]));
28867
+ const here = fs43.realpathSync(fileURLToPath23(import.meta.url));
28868
+ const argv = fs43.realpathSync(path40.resolve(process15.argv[1]));
30893
28869
  return here === argv;
30894
28870
  } catch {
30895
28871
  return false;
30896
28872
  }
30897
28873
  }
30898
- var YAML5, _HERE13, ArgparseExit4, _Sentinel, NO_FRONTMATTER, _INSTALL_MODE_MARKER_REL, PACKAGE_TAG_ID, _FRONTMATTER_PACKAGE_RE, CHECK_IDS, GLOBAL_CHECK_IDS, MANIFEST_REQUIRED_CHECK_IDS, INSTALL_MODE_MARKER_RELATIVE, REPAIR_IDS, MCP_BETA_GATES, STATUS_SYMBOLS, MIN_PYTHON, _PLACEHOLDER_EMAIL_RE, _PLACEHOLDER_NAME_RE, _RULE_PROJECTION_DIRS, _CLI_PROVIDER_META, _detection_memo, PROG4, USAGE2, _STORE_TRUE_FLAGS, _VALUE_FLAGS;
28874
+ var YAML5, _HERE12, ArgparseExit4, _Sentinel, NO_FRONTMATTER, _INSTALL_MODE_MARKER_REL, PACKAGE_TAG_ID, _FRONTMATTER_PACKAGE_RE, CHECK_IDS, GLOBAL_CHECK_IDS, MANIFEST_REQUIRED_CHECK_IDS, INSTALL_MODE_MARKER_RELATIVE, REPAIR_IDS, MCP_BETA_GATES, STATUS_SYMBOLS, MIN_PYTHON, _PLACEHOLDER_EMAIL_RE, _PLACEHOLDER_NAME_RE, _RULE_PROJECTION_DIRS, _CLI_PROVIDER_META, _detection_memo, PROG4, USAGE2, _STORE_TRUE_FLAGS, _VALUE_FLAGS;
30899
28875
  var init_cmd_doctor = __esm({
30900
28876
  "src/scripts/_cli/cmd_doctor.ts"() {
30901
28877
  "use strict";
@@ -30917,7 +28893,7 @@ var init_cmd_doctor = __esm({
30917
28893
  init_review_gate();
30918
28894
  init_package_root();
30919
28895
  init_rule_scope();
30920
- _HERE13 = fileURLToPath24(import.meta.url);
28896
+ _HERE12 = fileURLToPath23(import.meta.url);
30921
28897
  ArgparseExit4 = class extends Error {
30922
28898
  constructor(code) {
30923
28899
  super(`argparse-exit-${code}`);
@@ -31030,9 +29006,9 @@ var init_cmd_doctor = __esm({
31030
29006
  "--check": "check",
31031
29007
  "--repair": "repair"
31032
29008
  };
31033
- if (_isCliEntry16() || process15.argv[1] === _HERE13) {
29009
+ if (_isCliEntry15() || process15.argv[1] === _HERE12) {
31034
29010
  try {
31035
- process15.exitCode = main16(process15.argv.slice(2));
29011
+ process15.exitCode = main15(process15.argv.slice(2));
31036
29012
  } catch (e) {
31037
29013
  if (e instanceof ArgparseExit4) {
31038
29014
  process15.exitCode = e.code;
@@ -31045,7 +29021,7 @@ var init_cmd_doctor = __esm({
31045
29021
  });
31046
29022
 
31047
29023
  // src/install/txlog.ts
31048
- import { createReadStream, createWriteStream, existsSync as existsSync19, readFileSync as readFileSync37, renameSync as renameSync7, statSync as statSync28, unlinkSync as unlinkSync7 } from "node:fs";
29024
+ import { createReadStream, createWriteStream, existsSync as existsSync19, readFileSync as readFileSync37, renameSync as renameSync7, statSync as statSync27, unlinkSync as unlinkSync6 } from "node:fs";
31049
29025
  function readRecentEntries(logPath) {
31050
29026
  if (!existsSync19(logPath)) {
31051
29027
  return [];
@@ -31085,21 +29061,21 @@ var init_txlog = __esm({
31085
29061
  });
31086
29062
 
31087
29063
  // src/install/detect.ts
31088
- import { existsSync as existsSync20, readFileSync as readFileSync38, readdirSync as readdirSync24, statSync as statSync29 } from "node:fs";
31089
- import { join as join40, resolve as resolve27 } from "node:path";
29064
+ import { existsSync as existsSync20, readFileSync as readFileSync38, readdirSync as readdirSync23, statSync as statSync28 } from "node:fs";
29065
+ import { join as join39, resolve as resolve26 } from "node:path";
31090
29066
  function detectToolPresence(root) {
31091
29067
  return {
31092
- augment: isDir3(join40(root, ".augment")),
31093
- claude: isDir3(join40(root, ".claude")),
31094
- cursor: isDir3(join40(root, ".cursor")),
31095
- cline: isDir3(join40(root, ".clinerules")),
31096
- windsurf: isDir3(join40(root, ".windsurf")) || existsSync20(join40(root, ".windsurfrules")),
31097
- agentsMd: existsSync20(join40(root, "AGENTS.md"))
29068
+ augment: isDir3(join39(root, ".augment")),
29069
+ claude: isDir3(join39(root, ".claude")),
29070
+ cursor: isDir3(join39(root, ".cursor")),
29071
+ cline: isDir3(join39(root, ".clinerules")),
29072
+ windsurf: isDir3(join39(root, ".windsurf")) || existsSync20(join39(root, ".windsurfrules")),
29073
+ agentsMd: existsSync20(join39(root, "AGENTS.md"))
31098
29074
  };
31099
29075
  }
31100
- function isDir3(path50) {
29076
+ function isDir3(path49) {
31101
29077
  try {
31102
- return statSync29(path50).isDirectory();
29078
+ return statSync28(path49).isDirectory();
31103
29079
  } catch {
31104
29080
  return false;
31105
29081
  }
@@ -31126,16 +29102,16 @@ __export(cmd_conformance_exports, {
31126
29102
  conformanceLogPath: () => conformanceLogPath,
31127
29103
  detectSmokePlatform: () => detectSmokePlatform,
31128
29104
  installLogPath: () => installLogPath,
31129
- main: () => main17,
29105
+ main: () => main16,
31130
29106
  routeTargetPaths: () => routeTargetPaths,
31131
29107
  runConformanceChecks: () => runConformanceChecks
31132
29108
  });
31133
29109
  import * as fs44 from "node:fs";
31134
- import * as os13 from "node:os";
31135
- import * as path42 from "node:path";
29110
+ import * as os12 from "node:os";
29111
+ import * as path41 from "node:path";
31136
29112
  import process16 from "node:process";
31137
29113
  import { spawnSync as spawnSync8 } from "node:child_process";
31138
- import { fileURLToPath as fileURLToPath25, pathToFileURL as pathToFileURL17 } from "node:url";
29114
+ import { fileURLToPath as fileURLToPath24, pathToFileURL as pathToFileURL16 } from "node:url";
31139
29115
  function print2(s = "") {
31140
29116
  process16.stdout.write(`${s}
31141
29117
  `);
@@ -31149,14 +29125,14 @@ function conformanceLogPath() {
31149
29125
  if (override && override.trim().length > 0) {
31150
29126
  return override;
31151
29127
  }
31152
- return path42.join(os13.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
29128
+ return path41.join(os12.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
31153
29129
  }
31154
29130
  function installLogPath() {
31155
29131
  const override = process16.env["AGENT_CONFIG_INSTALL_LOG"];
31156
29132
  if (override && override.trim().length > 0) {
31157
29133
  return override;
31158
29134
  }
31159
- return path42.join(os13.homedir(), ".event4u", "agent-config", "install-log.jsonl");
29135
+ return path41.join(os12.homedir(), ".event4u", "agent-config", "install-log.jsonl");
31160
29136
  }
31161
29137
  function _check_txlog_clean(logPath = installLogPath()) {
31162
29138
  if (!fs44.existsSync(logPath)) {
@@ -31193,29 +29169,29 @@ function _check_txlog_clean(logPath = installLogPath()) {
31193
29169
  };
31194
29170
  }
31195
29171
  function routeTargetPaths(target) {
31196
- const sep15 = target.indexOf(":");
31197
- if (sep15 <= 0) return [];
31198
- const kind = target.slice(0, sep15);
31199
- const id = target.slice(sep15 + 1);
29172
+ const sep14 = target.indexOf(":");
29173
+ if (sep14 <= 0) return [];
29174
+ const kind = target.slice(0, sep14);
29175
+ const id = target.slice(sep14 + 1);
31200
29176
  if (!id) return [];
31201
29177
  switch (kind) {
31202
29178
  case "skill":
31203
- return [path42.join("dist", "agent-src", "skills", id, "SKILL.md")];
29179
+ return [path41.join("dist", "agent-src", "skills", id, "SKILL.md")];
31204
29180
  case "command":
31205
- return [path42.join("dist", "agent-src", "commands", `${id}.md`)];
29181
+ return [path41.join("dist", "agent-src", "commands", `${id}.md`)];
31206
29182
  case "guideline":
31207
- return [path42.join("docs", "guidelines", `${id}.md`)];
29183
+ return [path41.join("docs", "guidelines", `${id}.md`)];
31208
29184
  case "contract":
31209
29185
  return [
31210
- path42.join("docs", "contracts", `${id}.md`),
31211
- path42.join("dist", "agent-src", "contexts", "contracts", `${id}.md`)
29186
+ path41.join("docs", "contracts", `${id}.md`),
29187
+ path41.join("dist", "agent-src", "contexts", "contracts", `${id}.md`)
31212
29188
  ];
31213
29189
  default:
31214
29190
  return [];
31215
29191
  }
31216
29192
  }
31217
29193
  function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
31218
- const routerPath = path42.join(packageRoot, "dist", "router.json");
29194
+ const routerPath = path41.join(packageRoot, "dist", "router.json");
31219
29195
  if (!fs44.existsSync(routerPath)) {
31220
29196
  return {
31221
29197
  id: "router-pointers",
@@ -31235,13 +29211,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
31235
29211
  remedy: "reinstall the package \u2014 dist/router.json is corrupt"
31236
29212
  };
31237
29213
  }
31238
- const rulesDir = path42.join(packageRoot, "dist", "agent-src", "rules");
29214
+ const rulesDir = path41.join(packageRoot, "dist", "agent-src", "rules");
31239
29215
  const broken = [];
31240
29216
  let ids = 0;
31241
29217
  let targets = 0;
31242
29218
  for (const kernelId of router["kernel"] ?? []) {
31243
29219
  ids += 1;
31244
- if (!fs44.existsSync(path42.join(rulesDir, `${kernelId}.md`))) {
29220
+ if (!fs44.existsSync(path41.join(rulesDir, `${kernelId}.md`))) {
31245
29221
  broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
31246
29222
  }
31247
29223
  }
@@ -31249,7 +29225,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
31249
29225
  for (const entry of router[tier] ?? []) {
31250
29226
  const ruleId = String(entry["id"] ?? "");
31251
29227
  ids += 1;
31252
- if (!fs44.existsSync(path42.join(rulesDir, `${ruleId}.md`))) {
29228
+ if (!fs44.existsSync(path41.join(rulesDir, `${ruleId}.md`))) {
31253
29229
  broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
31254
29230
  }
31255
29231
  for (const target of entry["routes_to"] ?? []) {
@@ -31259,7 +29235,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
31259
29235
  broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
31260
29236
  continue;
31261
29237
  }
31262
- if (!candidates.some((rel) => fs44.existsSync(path42.join(packageRoot, rel)))) {
29238
+ if (!candidates.some((rel) => fs44.existsSync(path41.join(packageRoot, rel)))) {
31263
29239
  broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
31264
29240
  }
31265
29241
  }
@@ -31291,8 +29267,8 @@ function detectSmokePlatform(projectRoot) {
31291
29267
  return "claude";
31292
29268
  }
31293
29269
  function dispatcherRunner(packageRoot) {
31294
- const localTsx = path42.join(packageRoot, "node_modules", ".bin", "tsx");
31295
- const script = path42.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
29270
+ const localTsx = path41.join(packageRoot, "node_modules", ".bin", "tsx");
29271
+ const script = path41.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
31296
29272
  if (fs44.existsSync(localTsx)) {
31297
29273
  return [localTsx, script];
31298
29274
  }
@@ -31343,7 +29319,7 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
31343
29319
  };
31344
29320
  }
31345
29321
  function readSettingsMode(projectRoot) {
31346
- const settingsPath = path42.join(projectRoot, ".agent-settings.yml");
29322
+ const settingsPath = path41.join(projectRoot, ".agent-settings.yml");
31347
29323
  if (!fs44.existsSync(settingsPath)) {
31348
29324
  return "eager-all";
31349
29325
  }
@@ -31359,7 +29335,7 @@ function readSettingsMode(projectRoot) {
31359
29335
  function kernelIdsFromRouter(packageRoot) {
31360
29336
  try {
31361
29337
  const router = JSON.parse(
31362
- fs44.readFileSync(path42.join(packageRoot, "dist", "router.json"), "utf8")
29338
+ fs44.readFileSync(path41.join(packageRoot, "dist", "router.json"), "utf8")
31363
29339
  );
31364
29340
  return new Set((router["kernel"] ?? []).map(String));
31365
29341
  } catch {
@@ -31376,7 +29352,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
31376
29352
  remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
31377
29353
  };
31378
29354
  }
31379
- const rulesDir = projectedRulesDir ?? path42.join(projectRoot, ".augment", "rules");
29355
+ const rulesDir = projectedRulesDir ?? path41.join(projectRoot, ".augment", "rules");
31380
29356
  if (!fs44.existsSync(rulesDir)) {
31381
29357
  return {
31382
29358
  id: "lean-projection",
@@ -31400,7 +29376,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
31400
29376
  for (const f of nonKernel) {
31401
29377
  let text = "";
31402
29378
  try {
31403
- text = fs44.readFileSync(path42.join(rulesDir, f), "utf8");
29379
+ text = fs44.readFileSync(path41.join(rulesDir, f), "utf8");
31404
29380
  } catch {
31405
29381
  continue;
31406
29382
  }
@@ -31431,7 +29407,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
31431
29407
  function _check_host_manifest(projectRoot) {
31432
29408
  const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
31433
29409
  const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
31434
- const settingsPath = path42.join(projectRoot, ".agent-settings.yml");
29410
+ const settingsPath = path41.join(projectRoot, ".agent-settings.yml");
31435
29411
  if (!fs44.existsSync(settingsPath)) {
31436
29412
  return {
31437
29413
  id: "host-manifest",
@@ -31568,7 +29544,7 @@ function _parse3(argv) {
31568
29544
  }
31569
29545
  return opts;
31570
29546
  }
31571
- function main17(argv = null) {
29547
+ function main16(argv = null) {
31572
29548
  const opts = _parse3(argv !== null ? Array.from(argv) : process16.argv.slice(2));
31573
29549
  let project_root;
31574
29550
  try {
@@ -31635,23 +29611,23 @@ function main17(argv = null) {
31635
29611
  }
31636
29612
  return failed ? 1 : 0;
31637
29613
  }
31638
- function _isCliEntry17() {
29614
+ function _isCliEntry16() {
31639
29615
  if (process16.argv[1] === void 0) {
31640
29616
  return false;
31641
29617
  }
31642
- const argvUrl = pathToFileURL17(path42.resolve(process16.argv[1])).href;
29618
+ const argvUrl = pathToFileURL16(path41.resolve(process16.argv[1])).href;
31643
29619
  if (import.meta.url === argvUrl) {
31644
29620
  return true;
31645
29621
  }
31646
29622
  try {
31647
- const here = fs44.realpathSync(fileURLToPath25(import.meta.url));
31648
- const argv = fs44.realpathSync(path42.resolve(process16.argv[1]));
29623
+ const here = fs44.realpathSync(fileURLToPath24(import.meta.url));
29624
+ const argv = fs44.realpathSync(path41.resolve(process16.argv[1]));
31649
29625
  return here === argv;
31650
29626
  } catch {
31651
29627
  return false;
31652
29628
  }
31653
29629
  }
31654
- var YAML6, _HERE14, PACKAGE_ROOT2, CONFORMANCE_CHECK_IDS, THIN_STUB_MARKER, HOST_MANIFEST_KEYS, USAGE3;
29630
+ var YAML6, _HERE13, PACKAGE_ROOT2, CONFORMANCE_CHECK_IDS, THIN_STUB_MARKER, HOST_MANIFEST_KEYS, USAGE3;
31655
29631
  var init_cmd_conformance = __esm({
31656
29632
  "src/scripts/_cli/cmd_conformance.ts"() {
31657
29633
  "use strict";
@@ -31662,7 +29638,7 @@ var init_cmd_conformance = __esm({
31662
29638
  init_detect();
31663
29639
  init_package_root();
31664
29640
  init_cmd_doctor();
31665
- _HERE14 = fileURLToPath25(import.meta.url);
29641
+ _HERE13 = fileURLToPath24(import.meta.url);
31666
29642
  PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
31667
29643
  CONFORMANCE_CHECK_IDS = [
31668
29644
  "txlog-clean",
@@ -31680,9 +29656,9 @@ var init_cmd_conformance = __esm({
31680
29656
  "separate_quota_pool"
31681
29657
  ]);
31682
29658
  USAGE3 = "usage: agent-config conformance [-h] [--project PROJECT] [--json]\n [--skip-dispatcher]\n";
31683
- if (_isCliEntry17() || process16.argv[1] === _HERE14) {
29659
+ if (_isCliEntry16() || process16.argv[1] === _HERE13) {
31684
29660
  try {
31685
- process16.exitCode = main17(process16.argv.slice(2));
29661
+ process16.exitCode = main16(process16.argv.slice(2));
31686
29662
  } catch (e) {
31687
29663
  if (e instanceof ArgparseExit4) {
31688
29664
  process16.exitCode = e.code;
@@ -31743,7 +29719,7 @@ function _coerce_path(value, def) {
31743
29719
  }
31744
29720
  return value.trim();
31745
29721
  }
31746
- function _isFile14(p) {
29722
+ function _isFile13(p) {
31747
29723
  try {
31748
29724
  return fs45.statSync(p).isFile();
31749
29725
  } catch {
@@ -31753,7 +29729,7 @@ function _isFile14(p) {
31753
29729
  function read_settings(p) {
31754
29730
  let section = {};
31755
29731
  let section_present = false;
31756
- if (_isFile14(p)) {
29732
+ if (_isFile13(p)) {
31757
29733
  let raw = {};
31758
29734
  try {
31759
29735
  raw = YAML7.parse(fs45.readFileSync(p, "utf-8"), { version: "1.1" });
@@ -31787,7 +29763,7 @@ function read_settings(p) {
31787
29763
  }
31788
29764
  function read_tier_usage_settings(p) {
31789
29765
  let section = {};
31790
- if (_isFile14(p)) {
29766
+ if (_isFile13(p)) {
31791
29767
  let raw = {};
31792
29768
  try {
31793
29769
  raw = YAML7.parse(fs45.readFileSync(p, "utf-8"), { version: "1.1" });
@@ -32362,7 +30338,7 @@ function _parse_iso(ts) {
32362
30338
  return epoch;
32363
30339
  }
32364
30340
  function* _iter_events(log_path) {
32365
- if (!_isFile15(log_path)) {
30341
+ if (!_isFile14(log_path)) {
32366
30342
  return;
32367
30343
  }
32368
30344
  const text = fs46.readFileSync(log_path, "utf-8");
@@ -32397,7 +30373,7 @@ function _pyFileLines(text) {
32397
30373
  }
32398
30374
  return parts;
32399
30375
  }
32400
- function _isFile15(p) {
30376
+ function _isFile14(p) {
32401
30377
  try {
32402
30378
  return fs46.statSync(p).isFile();
32403
30379
  } catch {
@@ -33538,8 +31514,8 @@ not. Cite the peer-reviewer label and the targeted response label
33538
31514
 
33539
31515
  // src/scripts/ai_council/advisors.ts
33540
31516
  import * as fs48 from "node:fs";
33541
- import * as path43 from "node:path";
33542
- function _split_frontmatter2(raw) {
31517
+ import * as path42 from "node:path";
31518
+ function _split_frontmatter(raw) {
33543
31519
  const match = _FRONTMATTER_RE2.exec(raw);
33544
31520
  if (!match) {
33545
31521
  return [{}, raw];
@@ -33566,13 +31542,13 @@ function _display_name_from(advisor_name, frontmatter) {
33566
31542
  }
33567
31543
  function resolve_persona_text(persona_path, repo_root) {
33568
31544
  const candidates = [
33569
- path43.join(repo_root, "dist/agent-src", persona_path),
33570
- path43.join(repo_root, ".agent-src.uncondensed", persona_path)
31545
+ path42.join(repo_root, "dist/agent-src", persona_path),
31546
+ path42.join(repo_root, ".agent-src.uncondensed", persona_path)
33571
31547
  ];
33572
31548
  for (const candidate of candidates) {
33573
31549
  if (fs48.existsSync(candidate)) {
33574
31550
  const raw = fs48.readFileSync(candidate, "utf-8");
33575
- const [meta, body] = _split_frontmatter2(raw);
31551
+ const [meta, body] = _split_frontmatter(raw);
33576
31552
  return [body.trim(), meta];
33577
31553
  }
33578
31554
  }
@@ -33985,11 +31961,11 @@ import * as fs49 from "node:fs";
33985
31961
  function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
33986
31962
  return { phrase, normalised, section, line_no, trailing_metadata };
33987
31963
  }
33988
- function _strip7(s) {
31964
+ function _strip6(s) {
33989
31965
  return s.trim();
33990
31966
  }
33991
31967
  function _normalise2(phrase) {
33992
- return _strip7(phrase.toLowerCase().replace(_NORM_PUNCT, " ").replace(_NORM_WS, " "));
31968
+ return _strip6(phrase.toLowerCase().replace(_NORM_PUNCT, " ").replace(_NORM_WS, " "));
33993
31969
  }
33994
31970
  function _sectionBounds(text, title, allTitles) {
33995
31971
  const needle = `## ${title}`;
@@ -34047,7 +32023,7 @@ function _scanSection(text, section, bodyStart, bodyEnd, strict) {
34047
32023
  for (let offset = 0; offset < bodyLines.length; offset += 1) {
34048
32024
  const rawLine = bodyLines[offset];
34049
32025
  const lineNo = baseLine + offset;
34050
- const stripped = _strip7(rawLine);
32026
+ const stripped = _strip6(rawLine);
34051
32027
  if (!stripped || stripped.startsWith("<!--") || stripped.startsWith("#")) {
34052
32028
  continue;
34053
32029
  }
@@ -34116,7 +32092,7 @@ function _scanSection(text, section, bodyStart, bodyEnd, strict) {
34116
32092
  continue;
34117
32093
  }
34118
32094
  const phrase = m[1];
34119
- const trailing = m[2] !== void 0 ? _strip7(m[2]) : "";
32095
+ const trailing = m[2] !== void 0 ? _strip6(m[2]) : "";
34120
32096
  const norm = _normalise2(phrase);
34121
32097
  if (!norm) {
34122
32098
  const reason = "empty_phrase";
@@ -34147,8 +32123,8 @@ function _checkHeadingDrift(text, title) {
34147
32123
  const lineNo = _lineNoAt(text, m.index);
34148
32124
  const hashes = m[1];
34149
32125
  const tail = m[2];
34150
- if (hashes !== "##" || _strip7(tail)) {
34151
- return [lineNo, `got '${_strip7(m[0])}', expected '${canonical}'`];
32126
+ if (hashes !== "##" || _strip6(tail)) {
32127
+ return [lineNo, `got '${_strip6(m[0])}', expected '${canonical}'`];
34152
32128
  }
34153
32129
  return [null, null];
34154
32130
  }
@@ -35081,7 +33057,7 @@ var init_necessity = __esm({
35081
33057
 
35082
33058
  // src/scripts/ai_council/budget_guard.ts
35083
33059
  import * as fs50 from "node:fs";
35084
- import * as path44 from "node:path";
33060
+ import * as path43 from "node:path";
35085
33061
  function _resolveLedgerPath(p) {
35086
33062
  if (p !== null) {
35087
33063
  return p;
@@ -35096,7 +33072,7 @@ function _nowUtcMs() {
35096
33072
  return Date.now();
35097
33073
  }
35098
33074
  function _ensureLedgerDir(p) {
35099
- const parent = path44.dirname(p);
33075
+ const parent = path43.dirname(p);
35100
33076
  try {
35101
33077
  fs50.mkdirSync(parent, { recursive: true });
35102
33078
  let mode;
@@ -35917,10 +33893,10 @@ __export(pricing_exports, {
35917
33893
  reprice_with_cache: () => reprice_with_cache
35918
33894
  });
35919
33895
  import * as fs51 from "node:fs";
35920
- import * as path45 from "node:path";
35921
- import { fileURLToPath as fileURLToPath26 } from "node:url";
33896
+ import * as path44 from "node:path";
33897
+ import { fileURLToPath as fileURLToPath25 } from "node:url";
35922
33898
  function prices_file_for(repo_root) {
35923
- return path45.join(repo_root, "agents", "runtime", ".agent-prices.md");
33899
+ return path44.join(repo_root, "agents", "runtime", ".agent-prices.md");
35924
33900
  }
35925
33901
  function lookup(table, provider, model) {
35926
33902
  return table.prices.get(priceKey(provider, model)) ?? null;
@@ -36020,7 +33996,7 @@ function load_prices(p = PRICES_FILE) {
36020
33996
  return _parse4(fs51.readFileSync(p, "utf-8"));
36021
33997
  }
36022
33998
  function bootstrap_from_defaults(p = PRICES_FILE) {
36023
- fs51.mkdirSync(path45.dirname(p), { recursive: true });
33999
+ fs51.mkdirSync(path44.dirname(p), { recursive: true });
36024
34000
  const rows = as_rows();
36025
34001
  const body = _render_markdown(LAST_UPDATED, "shipped-default", rows);
36026
34002
  fs51.writeFileSync(p, body, "utf-8");
@@ -36053,8 +34029,8 @@ function _render_markdown(lastUpdated, source, rows) {
36053
34029
  return lines.join("\n");
36054
34030
  }
36055
34031
  function _parse4(text) {
36056
- const [front, body] = _split_frontmatter3(text);
36057
- const meta = _parse_frontmatter2(front);
34032
+ const [front, body] = _split_frontmatter2(text);
34033
+ const meta = _parse_frontmatter(front);
36058
34034
  const prices = _parse_table(body);
36059
34035
  return {
36060
34036
  last_updated: meta.last_updated ?? "1970-01-01",
@@ -36064,7 +34040,7 @@ function _parse4(text) {
36064
34040
  prices
36065
34041
  };
36066
34042
  }
36067
- function _split_frontmatter3(text) {
34043
+ function _split_frontmatter2(text) {
36068
34044
  if (!text.startsWith("---")) {
36069
34045
  return ["", text];
36070
34046
  }
@@ -36074,23 +34050,23 @@ function _split_frontmatter3(text) {
36074
34050
  }
36075
34051
  return [parts[1], parts[2]];
36076
34052
  }
36077
- function _pySplit(s, sep15, maxsplit) {
34053
+ function _pySplit(s, sep14, maxsplit) {
36078
34054
  const out = [];
36079
34055
  let rest = s;
36080
34056
  let n = 0;
36081
34057
  while (n < maxsplit) {
36082
- const idx = rest.indexOf(sep15);
34058
+ const idx = rest.indexOf(sep14);
36083
34059
  if (idx === -1) {
36084
34060
  break;
36085
34061
  }
36086
34062
  out.push(rest.slice(0, idx));
36087
- rest = rest.slice(idx + sep15.length);
34063
+ rest = rest.slice(idx + sep14.length);
36088
34064
  n++;
36089
34065
  }
36090
34066
  out.push(rest);
36091
34067
  return out;
36092
34068
  }
36093
- function _parse_frontmatter2(front) {
34069
+ function _parse_frontmatter(front) {
36094
34070
  const out = {};
36095
34071
  for (let line of front.split("\n")) {
36096
34072
  line = line.trim();
@@ -36140,14 +34116,14 @@ function _pyFloat2(s) {
36140
34116
  const n = Number(t);
36141
34117
  return Number.isNaN(n) ? null : n;
36142
34118
  }
36143
- var _HERE15, REPO_ROOT, PRICES_FILE, _CHARS_PER_TOKEN, CACHE_READ_MULTIPLIER, CACHE_WRITE_MULTIPLIER_5M, CACHE_WRITE_MULTIPLIER_1H;
34119
+ var _HERE14, REPO_ROOT, PRICES_FILE, _CHARS_PER_TOKEN, CACHE_READ_MULTIPLIER, CACHE_WRITE_MULTIPLIER_5M, CACHE_WRITE_MULTIPLIER_1H;
36144
34120
  var init_pricing = __esm({
36145
34121
  "src/scripts/ai_council/pricing.ts"() {
36146
34122
  "use strict";
36147
34123
  init_default_prices();
36148
- _HERE15 = fileURLToPath26(import.meta.url);
36149
- REPO_ROOT = path45.resolve(path45.dirname(_HERE15), "..", "..", "..");
36150
- PRICES_FILE = path45.join(REPO_ROOT, "agents", "runtime", ".agent-prices.md");
34124
+ _HERE14 = fileURLToPath25(import.meta.url);
34125
+ REPO_ROOT = path44.resolve(path44.dirname(_HERE14), "..", "..", "..");
34126
+ PRICES_FILE = path44.join(REPO_ROOT, "agents", "runtime", ".agent-prices.md");
36151
34127
  _CHARS_PER_TOKEN = 4;
36152
34128
  CACHE_READ_MULTIPLIER = 0.1;
36153
34129
  CACHE_WRITE_MULTIPLIER_5M = 1.25;
@@ -37683,7 +35659,7 @@ __export(project_context_exports, {
37683
35659
  detect_project_context: () => detect_project_context
37684
35660
  });
37685
35661
  import * as fs52 from "node:fs";
37686
- import * as path46 from "node:path";
35662
+ import * as path45 from "node:path";
37687
35663
  function _isPlainObject11(v) {
37688
35664
  return typeof v === "object" && v !== null && !Array.isArray(v);
37689
35665
  }
@@ -37715,7 +35691,7 @@ function _name_from(composer, pkg, root) {
37715
35691
  }
37716
35692
  }
37717
35693
  try {
37718
- const base = path46.basename(root);
35694
+ const base = path45.basename(root);
37719
35695
  return base || null;
37720
35696
  } catch {
37721
35697
  return null;
@@ -37830,7 +35806,7 @@ function _pyLen6(s) {
37830
35806
  }
37831
35807
  return n;
37832
35808
  }
37833
- function _pyRstrip2(s) {
35809
+ function _pyRstrip(s) {
37834
35810
  return s.replace(/\s+$/u, "");
37835
35811
  }
37836
35812
  function _truncate_at_sentence(text, limit) {
@@ -37838,9 +35814,9 @@ function _truncate_at_sentence(text, limit) {
37838
35814
  const head = _pySlice2(text, budget);
37839
35815
  const cut = Math.max(_rfind(head, ". "), _rfind(head, "! "), _rfind(head, "? "));
37840
35816
  if (cut >= 0) {
37841
- return _pyRstrip2(_pySliceRange(head, 0, cut + 1)) + " \u2026";
35817
+ return _pyRstrip(_pySliceRange(head, 0, cut + 1)) + " \u2026";
37842
35818
  }
37843
- return _pyRstrip2(head) + " \u2026";
35819
+ return _pyRstrip(head) + " \u2026";
37844
35820
  }
37845
35821
  function _pySlice2(text, n) {
37846
35822
  const cps = Array.from(text);
@@ -37873,13 +35849,13 @@ function _rfind(haystack, needle) {
37873
35849
  return -1;
37874
35850
  }
37875
35851
  function detect_project_context(root) {
37876
- const resolvedRoot = path46.resolve(root ?? process.cwd());
37877
- const composer = _read_json(path46.join(resolvedRoot, "composer.json"));
37878
- const pkg = _read_json(path46.join(resolvedRoot, "package.json"));
35852
+ const resolvedRoot = path45.resolve(root ?? process.cwd());
35853
+ const composer = _read_json(path45.join(resolvedRoot, "composer.json"));
35854
+ const pkg = _read_json(path45.join(resolvedRoot, "package.json"));
37879
35855
  return new ProjectContext(
37880
35856
  _name_from(composer, pkg, resolvedRoot),
37881
35857
  _stack_from(composer, pkg),
37882
- _purpose_from_readme(path46.join(resolvedRoot, "README.md"))
35858
+ _purpose_from_readme(path45.join(resolvedRoot, "README.md"))
37883
35859
  );
37884
35860
  }
37885
35861
  var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
@@ -38162,7 +36138,7 @@ function _hashQuery(query) {
38162
36138
  return createHash9("sha256").update(Buffer.from(redacted, "utf-8")).digest("hex").slice(0, 16);
38163
36139
  }
38164
36140
  function _privacyDropped(redacted) {
38165
- const stripped = _strip8(redacted);
36141
+ const stripped = _strip7(redacted);
38166
36142
  if (!stripped) {
38167
36143
  return true;
38168
36144
  }
@@ -38211,7 +36187,7 @@ function* _iterLog(logPath) {
38211
36187
  }
38212
36188
  const content = fs53.readFileSync(logPath, { encoding: "utf-8" });
38213
36189
  for (const rawLine of _splitlines11(content)) {
38214
- const line = _strip8(rawLine);
36190
+ const line = _strip7(rawLine);
38215
36191
  if (!line) {
38216
36192
  continue;
38217
36193
  }
@@ -38402,7 +36378,7 @@ function _dirname2(p) {
38402
36378
  }
38403
36379
  return p.slice(0, i);
38404
36380
  }
38405
- function _strip8(s) {
36381
+ function _strip7(s) {
38406
36382
  return s.trim();
38407
36383
  }
38408
36384
  function _splitlines11(s) {
@@ -39128,11 +37104,11 @@ __export(council_cli_exports, {
39128
37104
  cmd_shadow_report: () => cmd_shadow_report,
39129
37105
  format_estimate_table: () => format_estimate_table,
39130
37106
  load_settings: () => load_settings,
39131
- main: () => main18
37107
+ main: () => main17
39132
37108
  });
39133
37109
  import * as fs54 from "node:fs";
39134
- import * as path47 from "node:path";
39135
- import { fileURLToPath as fileURLToPath27, pathToFileURL as pathToFileURL18 } from "node:url";
37110
+ import * as path46 from "node:path";
37111
+ import { fileURLToPath as fileURLToPath26, pathToFileURL as pathToFileURL17 } from "node:url";
39136
37112
  function _pyFixed6(x, ndigits) {
39137
37113
  if (!Number.isFinite(x)) {
39138
37114
  return String(x);
@@ -39337,7 +37313,7 @@ function _stdout2(s) {
39337
37313
  function _stderr2(s) {
39338
37314
  process.stderr.write(s);
39339
37315
  }
39340
- function load_settings(p = SETTINGS_FILE3, opts = {}) {
37316
+ function load_settings(p = SETTINGS_FILE2, opts = {}) {
39341
37317
  const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
39342
37318
  const settings = load_agent_settings({ project_path: p });
39343
37319
  if (fs54.existsSync(ai_council_path)) {
@@ -39859,8 +37835,8 @@ function _maybe_write_decision_replay(opts) {
39859
37835
  include_member_arguments: include_args
39860
37836
  })
39861
37837
  );
39862
- const target = path47.join(path47.dirname(opts.out_path), "decision-replay.md");
39863
- fs54.mkdirSync(path47.dirname(target), { recursive: true });
37838
+ const target = path46.join(path46.dirname(opts.out_path), "decision-replay.md");
37839
+ fs54.mkdirSync(path46.dirname(target), { recursive: true });
39864
37840
  fs54.writeFileSync(target, replay, { encoding: "utf-8" });
39865
37841
  return target;
39866
37842
  }
@@ -40751,7 +38727,7 @@ function cmd_run(args, opts = {}) {
40751
38727
  kind: "responses",
40752
38728
  subcommand: "run"
40753
38729
  });
40754
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
38730
+ fs54.mkdirSync(path46.dirname(_resolveTarget(out_path)), { recursive: true });
40755
38731
  fs54.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
40756
38732
  _stdout2(
40757
38733
  `
@@ -40801,7 +38777,7 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
40801
38777
  prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
40802
38778
  responses: _serialise_responses(responses)
40803
38779
  };
40804
- const out_path = path47.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
38780
+ const out_path = path46.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
40805
38781
  fs54.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
40806
38782
  return out_path;
40807
38783
  }
@@ -41107,7 +39083,7 @@ function cmd_render(args) {
41107
39083
  kind: "sessions",
41108
39084
  subcommand: "render"
41109
39085
  });
41110
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
39086
+ fs54.mkdirSync(path46.dirname(_resolveTarget(out_path)), { recursive: true });
41111
39087
  fs54.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
41112
39088
  _stdout2(`council:render \xB7 wrote ${out_path}
41113
39089
  `);
@@ -41119,7 +39095,7 @@ function cmd_render(args) {
41119
39095
  function _cmd_replay_low_impact_stats(args) {
41120
39096
  const li = low_impact_exports;
41121
39097
  const responses_path = args.responses;
41122
- const log_path = path47.join(path47.dirname(responses_path), "low-impact-resolutions.md");
39098
+ const log_path = path46.join(path46.dirname(responses_path), "low-impact-resolutions.md");
41123
39099
  if (!fs54.existsSync(log_path)) {
41124
39100
  _stdout2(
41125
39101
  `council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
@@ -41135,7 +39111,7 @@ function _cmd_replay_low_impact_stats(args) {
41135
39111
  kind: "sessions",
41136
39112
  subcommand: "replay"
41137
39113
  });
41138
- fs54.mkdirSync(path47.dirname(_resolveTarget(target)), { recursive: true });
39114
+ fs54.mkdirSync(path46.dirname(_resolveTarget(target)), { recursive: true });
41139
39115
  fs54.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
41140
39116
  _stdout2(`council:replay \xB7 wrote ${target}
41141
39117
  `);
@@ -41173,7 +39149,7 @@ function cmd_replay(args) {
41173
39149
  kind: "sessions",
41174
39150
  subcommand: "replay"
41175
39151
  });
41176
- fs54.mkdirSync(path47.dirname(_resolveTarget(out_path)), { recursive: true });
39152
+ fs54.mkdirSync(path46.dirname(_resolveTarget(out_path)), { recursive: true });
41177
39153
  fs54.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
41178
39154
  _stdout2(`council:replay \xB7 wrote ${out_path}
41179
39155
  `);
@@ -41231,8 +39207,8 @@ function cmd_quota(args, opts = {}) {
41231
39207
  }
41232
39208
  function _validate_council_output_path(path_str, opts) {
41233
39209
  const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
41234
- const expected_abs = _resolveReal(path47.join(REPO_ROOT2, expected_rel));
41235
- const target = path47.isAbsolute(path_str) ? path_str : path47.join(REPO_ROOT2, path_str);
39210
+ const expected_abs = _resolveReal(path46.join(REPO_ROOT2, expected_rel));
39211
+ const target = path46.isAbsolute(path_str) ? path_str : path46.join(REPO_ROOT2, path_str);
41236
39212
  const target_resolved = _resolveReal(target);
41237
39213
  if (!_isRelativeTo(target_resolved, expected_abs)) {
41238
39214
  throw new ArgumentTypeError(
@@ -41242,10 +39218,10 @@ function _validate_council_output_path(path_str, opts) {
41242
39218
  return path_str;
41243
39219
  }
41244
39220
  function _resolveTarget(path_str) {
41245
- return path47.isAbsolute(path_str) ? path_str : path47.join(REPO_ROOT2, path_str);
39221
+ return path46.isAbsolute(path_str) ? path_str : path46.join(REPO_ROOT2, path_str);
41246
39222
  }
41247
39223
  function _resolveReal(p) {
41248
- const abs = path47.resolve(p);
39224
+ const abs = path46.resolve(p);
41249
39225
  try {
41250
39226
  return fs54.realpathSync(abs);
41251
39227
  } catch {
@@ -41256,8 +39232,8 @@ function _isRelativeTo(target, base) {
41256
39232
  if (target === base) {
41257
39233
  return true;
41258
39234
  }
41259
- const rel = path47.relative(base, target);
41260
- return rel !== "" && !rel.startsWith("..") && !path47.isAbsolute(rel);
39235
+ const rel = path46.relative(base, target);
39236
+ return rel !== "" && !rel.startsWith("..") && !path46.isAbsolute(rel);
41261
39237
  }
41262
39238
  function _topError(message) {
41263
39239
  _stderr2(_TOP_USAGE2);
@@ -41575,7 +39551,7 @@ function _parse_siblings_overrides(items) {
41575
39551
  function _isFileNotFound(exc) {
41576
39552
  return exc instanceof FileNotFoundError3 || exc instanceof Error && exc.code === "ENOENT";
41577
39553
  }
41578
- function main18(argv = null) {
39554
+ function main17(argv = null) {
41579
39555
  const args = _parseArgs7(argv ?? process.argv.slice(2));
41580
39556
  try {
41581
39557
  if (args.cmd === "estimate") {
@@ -41614,23 +39590,23 @@ function main18(argv = null) {
41614
39590
  }
41615
39591
  return 1;
41616
39592
  }
41617
- function _isCliEntry18() {
39593
+ function _isCliEntry17() {
41618
39594
  if (process.argv[1] === void 0) {
41619
39595
  return false;
41620
39596
  }
41621
- const argvUrl = pathToFileURL18(path47.resolve(process.argv[1])).href;
39597
+ const argvUrl = pathToFileURL17(path46.resolve(process.argv[1])).href;
41622
39598
  if (import.meta.url === argvUrl) {
41623
39599
  return true;
41624
39600
  }
41625
39601
  try {
41626
- const here = fs54.realpathSync(fileURLToPath27(import.meta.url));
41627
- const argv = fs54.realpathSync(path47.resolve(process.argv[1]));
39602
+ const here = fs54.realpathSync(fileURLToPath26(import.meta.url));
39603
+ const argv = fs54.realpathSync(path46.resolve(process.argv[1]));
41628
39604
  return here === argv;
41629
39605
  } catch {
41630
39606
  return false;
41631
39607
  }
41632
39608
  }
41633
- var _ArgExit2, ArgumentTypeError, _PROG9, SCHEMA_VERSION8, _API_PROVIDERS, _CLI_PROVIDERS, _HERE16, REPO_ROOT2, SETTINGS_FILE3, AI_COUNCIL_FILE, COUNCIL_CANONICAL_DIRS, CouncilDisabledError, _CLI_FACTORY, ValueError4, FileNotFoundError3, _SUBCOMMANDS, _TOP_USAGE2;
39609
+ var _ArgExit2, ArgumentTypeError, _PROG9, SCHEMA_VERSION8, _API_PROVIDERS, _CLI_PROVIDERS, _HERE15, REPO_ROOT2, SETTINGS_FILE2, AI_COUNCIL_FILE, COUNCIL_CANONICAL_DIRS, CouncilDisabledError, _CLI_FACTORY, ValueError4, FileNotFoundError3, _SUBCOMMANDS, _TOP_USAGE2;
41634
39610
  var init_council_cli = __esm({
41635
39611
  "src/scripts/council_cli.ts"() {
41636
39612
  "use strict";
@@ -41676,9 +39652,9 @@ var init_council_cli = __esm({
41676
39652
  "xai",
41677
39653
  "perplexity"
41678
39654
  ]);
41679
- _HERE16 = path47.dirname(fileURLToPath27(import.meta.url));
39655
+ _HERE15 = path46.dirname(fileURLToPath26(import.meta.url));
41680
39656
  [REPO_ROOT2] = resolve_project_root(null);
41681
- SETTINGS_FILE3 = project_settings_path(REPO_ROOT2);
39657
+ SETTINGS_FILE2 = project_settings_path(REPO_ROOT2);
41682
39658
  AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT2);
41683
39659
  COUNCIL_CANONICAL_DIRS = {
41684
39660
  responses: "agents/runtime/council/responses",
@@ -41703,9 +39679,9 @@ var init_council_cli = __esm({
41703
39679
  {estimate,run,debate,render,replay,quota,shadow-report}
41704
39680
  ...
41705
39681
  `;
41706
- if (_isCliEntry18()) {
39682
+ if (_isCliEntry17()) {
41707
39683
  try {
41708
- process.exitCode = main18(process.argv.slice(2));
39684
+ process.exitCode = main17(process.argv.slice(2));
41709
39685
  } catch (err) {
41710
39686
  if (!(err instanceof _ArgExit2)) {
41711
39687
  throw err;
@@ -41734,7 +39710,7 @@ function run_enveloped(spec) {
41734
39710
  if (cmd === void 0) {
41735
39711
  throw new Error("envelope argv must not be empty");
41736
39712
  }
41737
- return new Promise((resolve34) => {
39713
+ return new Promise((resolve33) => {
41738
39714
  execFile(
41739
39715
  cmd,
41740
39716
  args,
@@ -41757,7 +39733,7 @@ function run_enveloped(spec) {
41757
39733
  }
41758
39734
  const [out, outTrunc] = _truncate(String(stdout ?? ""), spec.max_output_bytes);
41759
39735
  const [err, errTrunc] = _truncate(String(stderr ?? ""), spec.max_output_bytes);
41760
- resolve34({
39736
+ resolve33({
41761
39737
  exit_code: timedOut ? null : exitCode,
41762
39738
  timed_out: timedOut,
41763
39739
  stdout: out,
@@ -41778,8 +39754,8 @@ var init_safety_envelope = __esm({
41778
39754
  });
41779
39755
 
41780
39756
  // src/scripts/mcp_server/__main__.ts
41781
- import * as path49 from "node:path";
41782
- import { fileURLToPath as fileURLToPath29 } from "node:url";
39757
+ import * as path48 from "node:path";
39758
+ import { fileURLToPath as fileURLToPath28 } from "node:url";
41783
39759
 
41784
39760
  // src/scripts/mcp_server/index.ts
41785
39761
  var __version__ = "0.1.0";
@@ -41827,8 +39803,8 @@ init_resources();
41827
39803
 
41828
39804
  // src/scripts/mcp_server/tools.ts
41829
39805
  import * as fs55 from "node:fs";
41830
- import * as path48 from "node:path";
41831
- import { fileURLToPath as fileURLToPath28 } from "node:url";
39806
+ import * as path47 from "node:path";
39807
+ import { fileURLToPath as fileURLToPath27 } from "node:url";
41832
39808
 
41833
39809
  // src/scripts/chat_history.ts
41834
39810
  init_memory_lookup();
@@ -43117,9 +41093,9 @@ function _extract_gemini_text(payload, event) {
43117
41093
  }
43118
41094
  function _extract_windsurf_text(payload, event) {
43119
41095
  if (event === "agent_response" || event === "stop") {
43120
- const info2 = payload.tool_info ?? payload.toolInfo;
43121
- if (_isPlainObject5(info2)) {
43122
- const v = info2.response ?? info2.text;
41096
+ const info = payload.tool_info ?? payload.toolInfo;
41097
+ if (_isPlainObject5(info)) {
41098
+ const v = info.response ?? info.text;
43123
41099
  if (typeof v === "string" && _strip2(v)) {
43124
41100
  return _strip2(v);
43125
41101
  }
@@ -44070,14 +42046,14 @@ var _ALLOWED_WRITE_REL_PATHS = /* @__PURE__ */ new Set([
44070
42046
  "agents/.agent-chat-history",
44071
42047
  ".agent-chat-history"
44072
42048
  ]);
44073
- function _strip9(s) {
42049
+ function _strip8(s) {
44074
42050
  return s.replace(/^\s+/, "").replace(/\s+$/, "");
44075
42051
  }
44076
42052
  function _resolvePath2(p) {
44077
42053
  try {
44078
42054
  return fs55.realpathSync(p);
44079
42055
  } catch {
44080
- return path48.resolve(p);
42056
+ return path47.resolve(p);
44081
42057
  }
44082
42058
  }
44083
42059
  function _resolveConsumerRoot(override) {
@@ -44087,14 +42063,14 @@ function _resolveConsumerRoot(override) {
44087
42063
  return _resolvePath2(process.cwd());
44088
42064
  }
44089
42065
  function _relativeUnder(target, root) {
44090
- const rel = path48.relative(root, target);
42066
+ const rel = path47.relative(root, target);
44091
42067
  if (rel === "") {
44092
42068
  return "";
44093
42069
  }
44094
- if (rel.startsWith("..") || path48.isAbsolute(rel)) {
42070
+ if (rel.startsWith("..") || path47.isAbsolute(rel)) {
44095
42071
  return null;
44096
42072
  }
44097
- return rel.split(path48.sep).join("/");
42073
+ return rel.split(path47.sep).join("/");
44098
42074
  }
44099
42075
  function _reprStrList(values) {
44100
42076
  return `[${values.map((v) => `'${v}'`).join(", ")}]`;
@@ -44103,11 +42079,11 @@ function _validateInTreePath(raw, consumerRoot) {
44103
42079
  const root = _resolvePath2(consumerRoot);
44104
42080
  let target;
44105
42081
  if (raw === null || raw === void 0 || raw === "") {
44106
- target = path48.join(root, "agents", "runtime", ".agent-chat-history");
44107
- } else if (path48.isAbsolute(raw)) {
42082
+ target = path47.join(root, "agents", "runtime", ".agent-chat-history");
42083
+ } else if (path47.isAbsolute(raw)) {
44108
42084
  target = _resolvePath2(raw);
44109
42085
  } else {
44110
- target = _resolvePath2(path48.join(root, raw));
42086
+ target = _resolvePath2(path47.join(root, raw));
44111
42087
  }
44112
42088
  const rel = _relativeUnder(target, root);
44113
42089
  if (rel === null) {
@@ -44145,7 +42121,7 @@ async function _lintSkillsHandler(args, consumerRoot) {
44145
42121
  if (typeof raw !== "string") {
44146
42122
  throw new Error("'paths' entries must be strings");
44147
42123
  }
44148
- const resolved = path48.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path48.join(root, raw));
42124
+ const resolved = path47.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path47.join(root, raw));
44149
42125
  if (_relativeUnder(resolved, root) === null) {
44150
42126
  throw new Error(`path escapes consumer_root: ${resolved}`);
44151
42127
  }
@@ -44163,11 +42139,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
44163
42139
  }
44164
42140
  async function _chatHistoryAppendHandler(args, consumerRoot) {
44165
42141
  const text = args.text;
44166
- if (typeof text !== "string" || !_strip9(text)) {
42142
+ if (typeof text !== "string" || !_strip8(text)) {
44167
42143
  throw new Error("'text' must be a non-empty string");
44168
42144
  }
44169
42145
  const entryTypeRaw = args.entry_type ?? "note";
44170
- if (typeof entryTypeRaw !== "string" || !_strip9(entryTypeRaw)) {
42146
+ if (typeof entryTypeRaw !== "string" || !_strip8(entryTypeRaw)) {
44171
42147
  throw new Error("'entry_type' must be a non-empty string");
44172
42148
  }
44173
42149
  const entryType = entryTypeRaw || "note";
@@ -44202,7 +42178,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
44202
42178
  };
44203
42179
  }
44204
42180
  if (!fs55.existsSync(target) || _chReadHeader(target) === null) {
44205
- fs55.mkdirSync(path48.dirname(target), { recursive: true });
42181
+ fs55.mkdirSync(path47.dirname(target), { recursive: true });
44206
42182
  _chInit(target);
44207
42183
  }
44208
42184
  _chAppend(entry, target, session ?? null);
@@ -44348,15 +42324,15 @@ async function _memoryStatusHandler(_args, consumerRoot) {
44348
42324
  }
44349
42325
  return result;
44350
42326
  }
44351
- var _PACKAGE_ROOT2 = path48.resolve(
44352
- path48.dirname(fileURLToPath28(import.meta.url)),
42327
+ var _PACKAGE_ROOT2 = path47.resolve(
42328
+ path47.dirname(fileURLToPath27(import.meta.url)),
44353
42329
  "..",
44354
42330
  "..",
44355
42331
  ".."
44356
42332
  );
44357
42333
  function _requireString(args, key) {
44358
42334
  const value = args[key];
44359
- if (typeof value !== "string" || !_strip9(value)) {
42335
+ if (typeof value !== "string" || !_strip8(value)) {
44360
42336
  throw new Error(`'${key}' must be a non-empty string`);
44361
42337
  }
44362
42338
  return value;
@@ -44393,8 +42369,8 @@ async function _memorySignalHandler(args, consumerRoot) {
44393
42369
  async function _roadmapProgressHandler(args, consumerRoot) {
44394
42370
  const dryRun = _pyTruthy6(args.dry_run ?? false);
44395
42371
  const root = _resolvePath2(consumerRoot);
44396
- const roadmapRoot = path48.join(root, "agents", "roadmaps");
44397
- const target = path48.join(root, "agents", "roadmaps-progress.md");
42372
+ const roadmapRoot = path47.join(root, "agents", "roadmaps");
42373
+ const target = path47.join(root, "agents", "roadmaps-progress.md");
44398
42374
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
44399
42375
  if (!fs55.existsSync(roadmapRoot)) {
44400
42376
  return {
@@ -44432,11 +42408,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
44432
42408
  let dashboardRegenerated = false;
44433
42409
  if (archived.length > 0) {
44434
42410
  const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
44435
- const roadmapRoot = path48.join(root, "agents", "roadmaps");
42411
+ const roadmapRoot = path47.join(root, "agents", "roadmaps");
44436
42412
  if (fs55.existsSync(roadmapRoot)) {
44437
42413
  const roadmaps = urp.collect(roadmapRoot);
44438
42414
  fs55.writeFileSync(
44439
- path48.join(root, "agents", "roadmaps-progress.md"),
42415
+ path47.join(root, "agents", "roadmaps-progress.md"),
44440
42416
  urp.render(roadmaps, urp.collect_bundles(root)),
44441
42417
  "utf-8"
44442
42418
  );
@@ -44452,7 +42428,7 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
44452
42428
  async function _capabilitiesIndexHandler(args, consumerRoot) {
44453
42429
  const check = _pyTruthy6(args.check ?? false);
44454
42430
  const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
44455
- const out = path48.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
42431
+ const out = path47.join(_PACKAGE_ROOT2, "CAPABILITIES.yaml");
44456
42432
  const content = cap.build();
44457
42433
  const onDisk = fs55.existsSync(out) ? fs55.readFileSync(out, "utf-8") : "";
44458
42434
  const drift = onDisk !== content;
@@ -44565,7 +42541,7 @@ async function _councilEstimateHandler(args, consumerRoot) {
44565
42541
  throw new Error("'depth' must be 'shallow' or 'deep' when provided");
44566
42542
  }
44567
42543
  const root = _resolvePath2(consumerRoot);
44568
- const target = path48.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path48.join(root, inputRaw));
42544
+ const target = path47.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path47.join(root, inputRaw));
44569
42545
  if (_relativeUnder(target, root) === null) {
44570
42546
  throw new Error(`path escapes consumer_root: ${target}`);
44571
42547
  }
@@ -44622,16 +42598,16 @@ var _RUN_TESTS_MAX_OUTPUT_BYTES = 64 * 1024;
44622
42598
  async function _runTestsHandler(args, consumerRoot) {
44623
42599
  const root = _resolvePath2(consumerRoot);
44624
42600
  const filter = args.filter ?? null;
44625
- if (filter !== null && (typeof filter !== "string" || !_strip9(filter))) {
42601
+ if (filter !== null && (typeof filter !== "string" || !_strip8(filter))) {
44626
42602
  throw new Error("'filter' must be a non-empty string when provided");
44627
42603
  }
44628
42604
  const relPathRaw = args.path ?? null;
44629
42605
  let relArg = null;
44630
42606
  if (relPathRaw !== null) {
44631
- if (typeof relPathRaw !== "string" || !_strip9(relPathRaw)) {
42607
+ if (typeof relPathRaw !== "string" || !_strip8(relPathRaw)) {
44632
42608
  throw new Error("'path' must be a non-empty string when provided");
44633
42609
  }
44634
- const resolved = path48.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path48.join(root, relPathRaw));
42610
+ const resolved = path47.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path47.join(root, relPathRaw));
44635
42611
  const rel = _relativeUnder(resolved, root);
44636
42612
  if (rel === null) {
44637
42613
  throw new Error(`path escapes consumer_root: ${resolved}`);
@@ -44641,7 +42617,7 @@ async function _runTestsHandler(args, consumerRoot) {
44641
42617
  }
44642
42618
  relArg = rel;
44643
42619
  }
44644
- const vitestEntry = path48.join(root, "node_modules", "vitest", "vitest.mjs");
42620
+ const vitestEntry = path47.join(root, "node_modules", "vitest", "vitest.mjs");
44645
42621
  if (!fs55.existsSync(vitestEntry)) {
44646
42622
  throw new Error(
44647
42623
  "run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
@@ -45248,8 +43224,8 @@ function _strCmp3(a, b) {
45248
43224
  return a < b ? -1 : a > b ? 1 : 0;
45249
43225
  }
45250
43226
  function _pathlibCompare3(a, b) {
45251
- const pa = a.split(path48.sep);
45252
- const pb = b.split(path48.sep);
43227
+ const pa = a.split(path47.sep);
43228
+ const pb = b.split(path47.sep);
45253
43229
  const n = Math.min(pa.length, pb.length);
45254
43230
  for (let i = 0; i < n; i++) {
45255
43231
  const c = _strCmp3(pa[i], pb[i]);
@@ -45468,16 +43444,16 @@ async function _serveOverSdk(server) {
45468
43444
  const transport = new StdioServerTransport();
45469
43445
  await sdkServer.connect(transport);
45470
43446
  }
45471
- function main19() {
43447
+ function main18() {
45472
43448
  void run_stdio();
45473
43449
  }
45474
43450
 
45475
43451
  // src/scripts/mcp_server/__main__.ts
45476
- var _selfPath = fileURLToPath29(import.meta.url);
45477
- var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path49.resolve(process.argv[1]) === path49.resolve(_selfPath);
43452
+ var _selfPath = fileURLToPath28(import.meta.url);
43453
+ var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path48.resolve(process.argv[1]) === path48.resolve(_selfPath);
45478
43454
  if (_invokedDirectly2) {
45479
- main19();
43455
+ main18();
45480
43456
  }
45481
43457
  export {
45482
- main19 as main
43458
+ main18 as main
45483
43459
  };