@swmansion/argent 0.35.1-next.2 → 0.35.1-next.20

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 (52) hide show
  1. package/bin/argent-android-devtools-0.4.0.apk +0 -0
  2. package/bin/darwin/argent-macos-helper +0 -0
  3. package/bin/darwin/ax-service +0 -0
  4. package/bin/darwin/tvos-ax-service +0 -0
  5. package/bin/darwin/tvos-hid-daemon +0 -0
  6. package/bin/network-inspector/network-inspector.jar +0 -0
  7. package/bin/tcp/ax-service +0 -0
  8. package/dist/cli-cmds.mjs +1782 -1642
  9. package/dist/client.js +267 -250
  10. package/dist/fatal-handlers.js +7 -1
  11. package/dist/fatal-handlers.js.map +1 -1
  12. package/dist/installer.mjs +768 -550
  13. package/dist/mcp-server.mjs +1224 -1173
  14. package/dist/tool-args.generated.d.ts +353 -317
  15. package/dist/tool-server.cjs +103420 -102271
  16. package/dylibs/libArgentAudio.dylib +0 -0
  17. package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
  18. package/dylibs/libKeyboardPatch.dylib +0 -0
  19. package/dylibs/libNativeDevtoolsIos.dylib +0 -0
  20. package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
  21. package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
  22. package/dylibs/tcp/argent-audio-feeder +0 -0
  23. package/dylibs/tcp/libArgentAudio.dylib +0 -0
  24. package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
  25. package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
  26. package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
  27. package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
  28. package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
  29. package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
  30. package/package.json +2 -2
  31. package/skills/argent-android-emulator-setup/SKILL.md +2 -2
  32. package/skills/argent-create-e2e/SKILL.md +1 -1
  33. package/skills/argent-create-e2e/references/e2e-yaml.md +23 -2
  34. package/skills/argent-create-e2e/references/live-authoring.md +9 -0
  35. package/skills/argent-device-interact/SKILL.md +21 -94
  36. package/skills/argent-device-interact/references/advanced.md +64 -0
  37. package/skills/argent-ios-device-interact/SKILL.md +1 -1
  38. package/skills/argent-ios-device-setup/SKILL.md +1 -1
  39. package/skills/argent-ios-simulator-setup/SKILL.md +1 -1
  40. package/skills/argent-lens/SKILL.md +1 -1
  41. package/skills/argent-macos-app-interact/SKILL.md +1 -1
  42. package/skills/argent-metro-debugger/SKILL.md +1 -1
  43. package/skills/argent-native-profiler/SKILL.md +1 -1
  44. package/skills/argent-qa-e2e/SKILL.md +1 -1
  45. package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
  46. package/skills/argent-react-native-optimization/SKILL.md +1 -1
  47. package/skills/argent-react-native-profiler/SKILL.md +1 -1
  48. package/skills/argent-screen-recording/SKILL.md +1 -1
  49. package/skills/argent-screenshot-diff/SKILL.md +1 -1
  50. package/skills/argent-settings-permissions/SKILL.md +1 -1
  51. package/skills/argent-test-ui-flow/SKILL.md +1 -1
  52. package/skills/argent-tv-interact/SKILL.md +1 -1
@@ -3652,17 +3652,17 @@ var require_visit = __commonJS({
3652
3652
  visit2.BREAK = BREAK;
3653
3653
  visit2.SKIP = SKIP;
3654
3654
  visit2.REMOVE = REMOVE;
3655
- function visit_(key, node, visitor, path33) {
3656
- const ctrl = callVisitor(key, node, visitor, path33);
3655
+ function visit_(key, node, visitor, path34) {
3656
+ const ctrl = callVisitor(key, node, visitor, path34);
3657
3657
  if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
3658
- replaceNode(key, path33, ctrl);
3659
- return visit_(key, ctrl, visitor, path33);
3658
+ replaceNode(key, path34, ctrl);
3659
+ return visit_(key, ctrl, visitor, path34);
3660
3660
  }
3661
3661
  if (typeof ctrl !== "symbol") {
3662
3662
  if (identity2.isCollection(node)) {
3663
- path33 = Object.freeze(path33.concat(node));
3663
+ path34 = Object.freeze(path34.concat(node));
3664
3664
  for (let i2 = 0; i2 < node.items.length; ++i2) {
3665
- const ci = visit_(i2, node.items[i2], visitor, path33);
3665
+ const ci = visit_(i2, node.items[i2], visitor, path34);
3666
3666
  if (typeof ci === "number")
3667
3667
  i2 = ci - 1;
3668
3668
  else if (ci === BREAK)
@@ -3673,13 +3673,13 @@ var require_visit = __commonJS({
3673
3673
  }
3674
3674
  }
3675
3675
  } else if (identity2.isPair(node)) {
3676
- path33 = Object.freeze(path33.concat(node));
3677
- const ck = visit_("key", node.key, visitor, path33);
3676
+ path34 = Object.freeze(path34.concat(node));
3677
+ const ck = visit_("key", node.key, visitor, path34);
3678
3678
  if (ck === BREAK)
3679
3679
  return BREAK;
3680
3680
  else if (ck === REMOVE)
3681
3681
  node.key = null;
3682
- const cv = visit_("value", node.value, visitor, path33);
3682
+ const cv = visit_("value", node.value, visitor, path34);
3683
3683
  if (cv === BREAK)
3684
3684
  return BREAK;
3685
3685
  else if (cv === REMOVE)
@@ -3700,17 +3700,17 @@ var require_visit = __commonJS({
3700
3700
  visitAsync.BREAK = BREAK;
3701
3701
  visitAsync.SKIP = SKIP;
3702
3702
  visitAsync.REMOVE = REMOVE;
3703
- async function visitAsync_(key, node, visitor, path33) {
3704
- const ctrl = await callVisitor(key, node, visitor, path33);
3703
+ async function visitAsync_(key, node, visitor, path34) {
3704
+ const ctrl = await callVisitor(key, node, visitor, path34);
3705
3705
  if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
3706
- replaceNode(key, path33, ctrl);
3707
- return visitAsync_(key, ctrl, visitor, path33);
3706
+ replaceNode(key, path34, ctrl);
3707
+ return visitAsync_(key, ctrl, visitor, path34);
3708
3708
  }
3709
3709
  if (typeof ctrl !== "symbol") {
3710
3710
  if (identity2.isCollection(node)) {
3711
- path33 = Object.freeze(path33.concat(node));
3711
+ path34 = Object.freeze(path34.concat(node));
3712
3712
  for (let i2 = 0; i2 < node.items.length; ++i2) {
3713
- const ci = await visitAsync_(i2, node.items[i2], visitor, path33);
3713
+ const ci = await visitAsync_(i2, node.items[i2], visitor, path34);
3714
3714
  if (typeof ci === "number")
3715
3715
  i2 = ci - 1;
3716
3716
  else if (ci === BREAK)
@@ -3721,13 +3721,13 @@ var require_visit = __commonJS({
3721
3721
  }
3722
3722
  }
3723
3723
  } else if (identity2.isPair(node)) {
3724
- path33 = Object.freeze(path33.concat(node));
3725
- const ck = await visitAsync_("key", node.key, visitor, path33);
3724
+ path34 = Object.freeze(path34.concat(node));
3725
+ const ck = await visitAsync_("key", node.key, visitor, path34);
3726
3726
  if (ck === BREAK)
3727
3727
  return BREAK;
3728
3728
  else if (ck === REMOVE)
3729
3729
  node.key = null;
3730
- const cv = await visitAsync_("value", node.value, visitor, path33);
3730
+ const cv = await visitAsync_("value", node.value, visitor, path34);
3731
3731
  if (cv === BREAK)
3732
3732
  return BREAK;
3733
3733
  else if (cv === REMOVE)
@@ -3754,23 +3754,23 @@ var require_visit = __commonJS({
3754
3754
  }
3755
3755
  return visitor;
3756
3756
  }
3757
- function callVisitor(key, node, visitor, path33) {
3757
+ function callVisitor(key, node, visitor, path34) {
3758
3758
  if (typeof visitor === "function")
3759
- return visitor(key, node, path33);
3759
+ return visitor(key, node, path34);
3760
3760
  if (identity2.isMap(node))
3761
- return visitor.Map?.(key, node, path33);
3761
+ return visitor.Map?.(key, node, path34);
3762
3762
  if (identity2.isSeq(node))
3763
- return visitor.Seq?.(key, node, path33);
3763
+ return visitor.Seq?.(key, node, path34);
3764
3764
  if (identity2.isPair(node))
3765
- return visitor.Pair?.(key, node, path33);
3765
+ return visitor.Pair?.(key, node, path34);
3766
3766
  if (identity2.isScalar(node))
3767
- return visitor.Scalar?.(key, node, path33);
3767
+ return visitor.Scalar?.(key, node, path34);
3768
3768
  if (identity2.isAlias(node))
3769
- return visitor.Alias?.(key, node, path33);
3769
+ return visitor.Alias?.(key, node, path34);
3770
3770
  return void 0;
3771
3771
  }
3772
- function replaceNode(key, path33, node) {
3773
- const parent = path33[path33.length - 1];
3772
+ function replaceNode(key, path34, node) {
3773
+ const parent = path34[path34.length - 1];
3774
3774
  if (identity2.isCollection(parent)) {
3775
3775
  parent.items[key] = node;
3776
3776
  } else if (identity2.isPair(parent)) {
@@ -4382,10 +4382,10 @@ var require_Collection = __commonJS({
4382
4382
  var createNode = require_createNode();
4383
4383
  var identity2 = require_identity();
4384
4384
  var Node = require_Node();
4385
- function collectionFromPath(schema, path33, value) {
4385
+ function collectionFromPath(schema, path34, value) {
4386
4386
  let v = value;
4387
- for (let i2 = path33.length - 1; i2 >= 0; --i2) {
4388
- const k = path33[i2];
4387
+ for (let i2 = path34.length - 1; i2 >= 0; --i2) {
4388
+ const k = path34[i2];
4389
4389
  if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
4390
4390
  const a2 = [];
4391
4391
  a2[k] = v;
@@ -4404,7 +4404,7 @@ var require_Collection = __commonJS({
4404
4404
  sourceObjects: /* @__PURE__ */ new Map()
4405
4405
  });
4406
4406
  }
4407
- var isEmptyPath = (path33) => path33 == null || typeof path33 === "object" && !!path33[Symbol.iterator]().next().done;
4407
+ var isEmptyPath = (path34) => path34 == null || typeof path34 === "object" && !!path34[Symbol.iterator]().next().done;
4408
4408
  var Collection = class extends Node.NodeBase {
4409
4409
  constructor(type, schema) {
4410
4410
  super(type);
@@ -4434,11 +4434,11 @@ var require_Collection = __commonJS({
4434
4434
  * be a Pair instance or a `{ key, value }` object, which may not have a key
4435
4435
  * that already exists in the map.
4436
4436
  */
4437
- addIn(path33, value) {
4438
- if (isEmptyPath(path33))
4437
+ addIn(path34, value) {
4438
+ if (isEmptyPath(path34))
4439
4439
  this.add(value);
4440
4440
  else {
4441
- const [key, ...rest] = path33;
4441
+ const [key, ...rest] = path34;
4442
4442
  const node = this.get(key, true);
4443
4443
  if (identity2.isCollection(node))
4444
4444
  node.addIn(rest, value);
@@ -4452,8 +4452,8 @@ var require_Collection = __commonJS({
4452
4452
  * Removes a value from the collection.
4453
4453
  * @returns `true` if the item was found and removed.
4454
4454
  */
4455
- deleteIn(path33) {
4456
- const [key, ...rest] = path33;
4455
+ deleteIn(path34) {
4456
+ const [key, ...rest] = path34;
4457
4457
  if (rest.length === 0)
4458
4458
  return this.delete(key);
4459
4459
  const node = this.get(key, true);
@@ -4467,8 +4467,8 @@ var require_Collection = __commonJS({
4467
4467
  * scalar values from their surrounding node; to disable set `keepScalar` to
4468
4468
  * `true` (collections are always returned intact).
4469
4469
  */
4470
- getIn(path33, keepScalar) {
4471
- const [key, ...rest] = path33;
4470
+ getIn(path34, keepScalar) {
4471
+ const [key, ...rest] = path34;
4472
4472
  const node = this.get(key, true);
4473
4473
  if (rest.length === 0)
4474
4474
  return !keepScalar && identity2.isScalar(node) ? node.value : node;
@@ -4486,8 +4486,8 @@ var require_Collection = __commonJS({
4486
4486
  /**
4487
4487
  * Checks if the collection includes a value with the key `key`.
4488
4488
  */
4489
- hasIn(path33) {
4490
- const [key, ...rest] = path33;
4489
+ hasIn(path34) {
4490
+ const [key, ...rest] = path34;
4491
4491
  if (rest.length === 0)
4492
4492
  return this.has(key);
4493
4493
  const node = this.get(key, true);
@@ -4497,8 +4497,8 @@ var require_Collection = __commonJS({
4497
4497
  * Sets a value in this collection. For `!!set`, `value` needs to be a
4498
4498
  * boolean to add/remove the item from the set.
4499
4499
  */
4500
- setIn(path33, value) {
4501
- const [key, ...rest] = path33;
4500
+ setIn(path34, value) {
4501
+ const [key, ...rest] = path34;
4502
4502
  if (rest.length === 0) {
4503
4503
  this.set(key, value);
4504
4504
  } else {
@@ -7013,9 +7013,9 @@ var require_Document = __commonJS({
7013
7013
  this.contents.add(value);
7014
7014
  }
7015
7015
  /** Adds a value to the document. */
7016
- addIn(path33, value) {
7016
+ addIn(path34, value) {
7017
7017
  if (assertCollection(this.contents))
7018
- this.contents.addIn(path33, value);
7018
+ this.contents.addIn(path34, value);
7019
7019
  }
7020
7020
  /**
7021
7021
  * Create a new `Alias` node, ensuring that the target `node` has the required anchor.
@@ -7090,14 +7090,14 @@ var require_Document = __commonJS({
7090
7090
  * Removes a value from the document.
7091
7091
  * @returns `true` if the item was found and removed.
7092
7092
  */
7093
- deleteIn(path33) {
7094
- if (Collection.isEmptyPath(path33)) {
7093
+ deleteIn(path34) {
7094
+ if (Collection.isEmptyPath(path34)) {
7095
7095
  if (this.contents == null)
7096
7096
  return false;
7097
7097
  this.contents = null;
7098
7098
  return true;
7099
7099
  }
7100
- return assertCollection(this.contents) ? this.contents.deleteIn(path33) : false;
7100
+ return assertCollection(this.contents) ? this.contents.deleteIn(path34) : false;
7101
7101
  }
7102
7102
  /**
7103
7103
  * Returns item at `key`, or `undefined` if not found. By default unwraps
@@ -7112,10 +7112,10 @@ var require_Document = __commonJS({
7112
7112
  * scalar values from their surrounding node; to disable set `keepScalar` to
7113
7113
  * `true` (collections are always returned intact).
7114
7114
  */
7115
- getIn(path33, keepScalar) {
7116
- if (Collection.isEmptyPath(path33))
7115
+ getIn(path34, keepScalar) {
7116
+ if (Collection.isEmptyPath(path34))
7117
7117
  return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
7118
- return identity2.isCollection(this.contents) ? this.contents.getIn(path33, keepScalar) : void 0;
7118
+ return identity2.isCollection(this.contents) ? this.contents.getIn(path34, keepScalar) : void 0;
7119
7119
  }
7120
7120
  /**
7121
7121
  * Checks if the document includes a value with the key `key`.
@@ -7126,10 +7126,10 @@ var require_Document = __commonJS({
7126
7126
  /**
7127
7127
  * Checks if the document includes a value at `path`.
7128
7128
  */
7129
- hasIn(path33) {
7130
- if (Collection.isEmptyPath(path33))
7129
+ hasIn(path34) {
7130
+ if (Collection.isEmptyPath(path34))
7131
7131
  return this.contents !== void 0;
7132
- return identity2.isCollection(this.contents) ? this.contents.hasIn(path33) : false;
7132
+ return identity2.isCollection(this.contents) ? this.contents.hasIn(path34) : false;
7133
7133
  }
7134
7134
  /**
7135
7135
  * Sets a value in this document. For `!!set`, `value` needs to be a
@@ -7146,13 +7146,13 @@ var require_Document = __commonJS({
7146
7146
  * Sets a value in this document. For `!!set`, `value` needs to be a
7147
7147
  * boolean to add/remove the item from the set.
7148
7148
  */
7149
- setIn(path33, value) {
7150
- if (Collection.isEmptyPath(path33)) {
7149
+ setIn(path34, value) {
7150
+ if (Collection.isEmptyPath(path34)) {
7151
7151
  this.contents = value;
7152
7152
  } else if (this.contents == null) {
7153
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path33), value);
7153
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path34), value);
7154
7154
  } else if (assertCollection(this.contents)) {
7155
- this.contents.setIn(path33, value);
7155
+ this.contents.setIn(path34, value);
7156
7156
  }
7157
7157
  }
7158
7158
  /**
@@ -9113,9 +9113,9 @@ var require_cst_visit = __commonJS({
9113
9113
  visit2.BREAK = BREAK;
9114
9114
  visit2.SKIP = SKIP;
9115
9115
  visit2.REMOVE = REMOVE;
9116
- visit2.itemAtPath = (cst, path33) => {
9116
+ visit2.itemAtPath = (cst, path34) => {
9117
9117
  let item = cst;
9118
- for (const [field, index] of path33) {
9118
+ for (const [field, index] of path34) {
9119
9119
  const tok = item?.[field];
9120
9120
  if (tok && "items" in tok) {
9121
9121
  item = tok.items[index];
@@ -9124,23 +9124,23 @@ var require_cst_visit = __commonJS({
9124
9124
  }
9125
9125
  return item;
9126
9126
  };
9127
- visit2.parentCollection = (cst, path33) => {
9128
- const parent = visit2.itemAtPath(cst, path33.slice(0, -1));
9129
- const field = path33[path33.length - 1][0];
9127
+ visit2.parentCollection = (cst, path34) => {
9128
+ const parent = visit2.itemAtPath(cst, path34.slice(0, -1));
9129
+ const field = path34[path34.length - 1][0];
9130
9130
  const coll = parent?.[field];
9131
9131
  if (coll && "items" in coll)
9132
9132
  return coll;
9133
9133
  throw new Error("Parent collection not found");
9134
9134
  };
9135
- function _visit(path33, item, visitor) {
9136
- let ctrl = visitor(item, path33);
9135
+ function _visit(path34, item, visitor) {
9136
+ let ctrl = visitor(item, path34);
9137
9137
  if (typeof ctrl === "symbol")
9138
9138
  return ctrl;
9139
9139
  for (const field of ["key", "value"]) {
9140
9140
  const token = item[field];
9141
9141
  if (token && "items" in token) {
9142
9142
  for (let i2 = 0; i2 < token.items.length; ++i2) {
9143
- const ci = _visit(Object.freeze(path33.concat([[field, i2]])), token.items[i2], visitor);
9143
+ const ci = _visit(Object.freeze(path34.concat([[field, i2]])), token.items[i2], visitor);
9144
9144
  if (typeof ci === "number")
9145
9145
  i2 = ci - 1;
9146
9146
  else if (ci === BREAK)
@@ -9151,10 +9151,10 @@ var require_cst_visit = __commonJS({
9151
9151
  }
9152
9152
  }
9153
9153
  if (typeof ctrl === "function" && field === "key")
9154
- ctrl = ctrl(item, path33);
9154
+ ctrl = ctrl(item, path34);
9155
9155
  }
9156
9156
  }
9157
- return typeof ctrl === "function" ? ctrl(item, path33) : ctrl;
9157
+ return typeof ctrl === "function" ? ctrl(item, path34) : ctrl;
9158
9158
  }
9159
9159
  exports.visit = visit2;
9160
9160
  }
@@ -11008,13 +11008,13 @@ var require_min_release_age = __commonJS({
11008
11008
  return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
11009
11009
  }
11010
11010
  function probe(p, cwd) {
11011
- return new Promise((resolve21) => {
11011
+ return new Promise((resolve22) => {
11012
11012
  (0, node_child_process_1.exec)(p.command, { cwd, timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
11013
11013
  if (err) {
11014
- resolve21(0);
11014
+ resolve22(0);
11015
11015
  return;
11016
11016
  }
11017
- resolve21(p.parse(stdout2));
11017
+ resolve22(p.parse(stdout2));
11018
11018
  });
11019
11019
  });
11020
11020
  }
@@ -11047,12 +11047,12 @@ var require_registry = __commonJS({
11047
11047
  var node_https_1 = __importDefault(__require("node:https"));
11048
11048
  var REQUEST_TIMEOUT_MS = 1e4;
11049
11049
  function fetchRegistryInfo2(url) {
11050
- return new Promise((resolve21) => {
11050
+ return new Promise((resolve22) => {
11051
11051
  let resolved = false;
11052
11052
  const safeResolve = (value) => {
11053
11053
  if (!resolved) {
11054
11054
  resolved = true;
11055
- resolve21(value);
11055
+ resolve22(value);
11056
11056
  }
11057
11057
  };
11058
11058
  const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
@@ -12992,8 +12992,8 @@ var Deferred = class {
12992
12992
  _resolve;
12993
12993
  _reject;
12994
12994
  constructor() {
12995
- this._promise = new Promise((resolve21, reject) => {
12996
- this._resolve = resolve21;
12995
+ this._promise = new Promise((resolve22, reject) => {
12996
+ this._resolve = resolve22;
12997
12997
  this._reject = reject;
12998
12998
  });
12999
12999
  }
@@ -13886,8 +13886,8 @@ var ExportOperation = class {
13886
13886
  _metrics;
13887
13887
  _exportScheduledResolve;
13888
13888
  constructor(exporter, logRecords, exportTimeoutMillis, metrics) {
13889
- this._exportScheduledPromise = new Promise((resolve21) => {
13890
- this._exportScheduledResolve = resolve21;
13889
+ this._exportScheduledPromise = new Promise((resolve22) => {
13890
+ this._exportScheduledResolve = resolve22;
13891
13891
  });
13892
13892
  this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
13893
13893
  this._metrics = metrics;
@@ -13912,7 +13912,7 @@ var ExportOperation = class {
13912
13912
  }
13913
13913
  }
13914
13914
  async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
13915
- return new Promise((resolve21, reject) => {
13915
+ return new Promise((resolve22, reject) => {
13916
13916
  const timer = setTimeout(() => {
13917
13917
  reject(new Error("Timeout"));
13918
13918
  }, exportTimeoutMillis);
@@ -13920,7 +13920,7 @@ var ExportOperation = class {
13920
13920
  this._metrics.finishLogs(logRecords.length, result.error);
13921
13921
  clearTimeout(timer);
13922
13922
  if (result.code === ExportResultCode.SUCCESS) {
13923
- resolve21();
13923
+ resolve22();
13924
13924
  } else {
13925
13925
  reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
13926
13926
  }
@@ -14701,7 +14701,7 @@ function parseRetryAfterToMills(retryAfter) {
14701
14701
  var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION4}`;
14702
14702
  var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
14703
14703
  function sendWithHttp(request, url, headers, compression, userAgent, agent, data, timeoutMillis) {
14704
- return new Promise((resolve21) => {
14704
+ return new Promise((resolve22) => {
14705
14705
  const parsedUrl = new URL(url);
14706
14706
  if (userAgent) {
14707
14707
  headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
@@ -14720,7 +14720,7 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
14720
14720
  responseSize += chunk.length;
14721
14721
  if (responseSize > MAX_RESPONSE_BODY_SIZE) {
14722
14722
  const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
14723
- resolve21({ status: "failure", error: sizeError });
14723
+ resolve22({ status: "failure", error: sizeError });
14724
14724
  res.destroy();
14725
14725
  return;
14726
14726
  }
@@ -14728,18 +14728,18 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
14728
14728
  });
14729
14729
  res.on("end", () => {
14730
14730
  if (res.statusCode && res.statusCode <= 299) {
14731
- resolve21({
14731
+ resolve22({
14732
14732
  status: "success",
14733
14733
  data: Buffer.concat(responseData)
14734
14734
  });
14735
14735
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
14736
- resolve21({
14736
+ resolve22({
14737
14737
  status: "retryable",
14738
14738
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
14739
14739
  });
14740
14740
  } else {
14741
14741
  const error = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
14742
- resolve21({
14742
+ resolve22({
14743
14743
  status: "failure",
14744
14744
  error
14745
14745
  });
@@ -14747,17 +14747,17 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
14747
14747
  });
14748
14748
  res.on("error", (error) => {
14749
14749
  if (res.statusCode && res.statusCode <= 299) {
14750
- resolve21({
14750
+ resolve22({
14751
14751
  status: "success"
14752
14752
  });
14753
14753
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
14754
- resolve21({
14754
+ resolve22({
14755
14755
  status: "retryable",
14756
14756
  error,
14757
14757
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
14758
14758
  });
14759
14759
  } else {
14760
- resolve21({
14760
+ resolve22({
14761
14761
  status: "failure",
14762
14762
  error
14763
14763
  });
@@ -14766,26 +14766,26 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
14766
14766
  });
14767
14767
  req.setTimeout(timeoutMillis, () => {
14768
14768
  req.destroy();
14769
- resolve21({
14769
+ resolve22({
14770
14770
  status: "retryable",
14771
14771
  error: new Error("Request timed out")
14772
14772
  });
14773
14773
  });
14774
14774
  req.on("error", (error) => {
14775
14775
  if (isHttpTransportNetworkErrorRetryable(error)) {
14776
- resolve21({
14776
+ resolve22({
14777
14777
  status: "retryable",
14778
14778
  error
14779
14779
  });
14780
14780
  } else {
14781
- resolve21({
14781
+ resolve22({
14782
14782
  status: "failure",
14783
14783
  error
14784
14784
  });
14785
14785
  }
14786
14786
  });
14787
14787
  compressAndSend(req, compression, data, (error) => {
14788
- resolve21({
14788
+ resolve22({
14789
14789
  status: "failure",
14790
14790
  error
14791
14791
  });
@@ -14875,9 +14875,9 @@ var RetryingTransport = class {
14875
14875
  this._transport = transport;
14876
14876
  }
14877
14877
  retry(data, timeoutMillis, inMillis) {
14878
- return new Promise((resolve21, reject) => {
14878
+ return new Promise((resolve22, reject) => {
14879
14879
  setTimeout(() => {
14880
- this._transport.send(data, timeoutMillis).then(resolve21, reject);
14880
+ this._transport.send(data, timeoutMillis).then(resolve22, reject);
14881
14881
  }, inMillis);
14882
14882
  });
14883
14883
  }
@@ -15012,7 +15012,7 @@ function appendRootPathToUrlIfNeeded(url) {
15012
15012
  return void 0;
15013
15013
  }
15014
15014
  }
15015
- function appendResourcePathToUrl(url, path33) {
15015
+ function appendResourcePathToUrl(url, path34) {
15016
15016
  try {
15017
15017
  new URL(url);
15018
15018
  } catch {
@@ -15022,11 +15022,11 @@ function appendResourcePathToUrl(url, path33) {
15022
15022
  if (!url.endsWith("/")) {
15023
15023
  url = url + "/";
15024
15024
  }
15025
- url += path33;
15025
+ url += path34;
15026
15026
  try {
15027
15027
  new URL(url);
15028
15028
  } catch {
15029
- diag2.warn(`Configuration: Provided URL appended with '${path33}' is not a valid URL, using 'undefined' instead of '${url}'`);
15029
+ diag2.warn(`Configuration: Provided URL appended with '${path34}' is not a valid URL, using 'undefined' instead of '${url}'`);
15030
15030
  return void 0;
15031
15031
  }
15032
15032
  return url;
@@ -15140,41 +15140,50 @@ init_esm();
15140
15140
  import * as fs6 from "node:fs";
15141
15141
 
15142
15142
  // ../telemetry/src/paths.ts
15143
- import * as path7 from "node:path";
15143
+ import * as path8 from "node:path";
15144
15144
 
15145
15145
  // ../configuration-core/src/flags.ts
15146
15146
  import * as fs2 from "node:fs";
15147
+ import * as path3 from "node:path";
15148
+
15149
+ // ../configuration-core/src/home.ts
15150
+ import * as os from "node:os";
15147
15151
  import * as path2 from "node:path";
15148
- import { homedir } from "node:os";
15152
+ var ARGENT_HOME_DIR_ENV = "ARGENT_HOME_DIR";
15153
+ function nonEmpty(value) {
15154
+ if (value == void 0) return null;
15155
+ const trimmed = value.trim();
15156
+ return trimmed === "" ? null : value;
15157
+ }
15158
+ function resolveHomeDir(options = {}) {
15159
+ if (options.homeDir) return options.homeDir;
15160
+ return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
15161
+ }
15162
+ function argentHomeDir(options = {}) {
15163
+ const override = options.homeDir ? null : nonEmpty(process.env[ARGENT_HOME_DIR_ENV]);
15164
+ return override ? path2.resolve(override.trim()) : path2.join(resolveHomeDir(options), ".argent");
15165
+ }
15166
+
15167
+ // ../configuration-core/src/flags.ts
15149
15168
  var PROJECT_MARKERS = [".argent", ".git", "package.json"];
15150
15169
  function findProjectRoot(startDir) {
15151
- let current = path2.resolve(startDir);
15170
+ let current = path3.resolve(startDir);
15152
15171
  while (true) {
15153
15172
  for (const marker of PROJECT_MARKERS) {
15154
- if (fs2.existsSync(path2.join(current, marker))) return current;
15173
+ if (fs2.existsSync(path3.join(current, marker))) return current;
15155
15174
  }
15156
- const parent = path2.dirname(current);
15175
+ const parent = path3.dirname(current);
15157
15176
  if (parent === current) return null;
15158
15177
  current = parent;
15159
15178
  }
15160
15179
  }
15161
15180
  function resolveProjectRoot(startDir) {
15162
- return findProjectRoot(startDir) ?? path2.resolve(startDir);
15181
+ return findProjectRoot(startDir) ?? path3.resolve(startDir);
15163
15182
  }
15164
15183
 
15165
15184
  // ../configuration-core/src/paths.ts
15166
15185
  import * as fs3 from "node:fs";
15167
- import * as os from "node:os";
15168
- import * as path3 from "node:path";
15169
- function nonEmpty(value) {
15170
- if (value == void 0) return null;
15171
- const trimmed = value.trim();
15172
- return trimmed === "" ? null : value;
15173
- }
15174
- function resolveHomeDir(options = {}) {
15175
- if (options.homeDir) return options.homeDir;
15176
- return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
15177
- }
15186
+ import * as path4 from "node:path";
15178
15187
  function isHomeDir(dir, options = {}) {
15179
15188
  return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
15180
15189
  }
@@ -15182,27 +15191,22 @@ function canonicalPath(p) {
15182
15191
  try {
15183
15192
  return fs3.realpathSync.native(p);
15184
15193
  } catch {
15185
- return path3.resolve(p);
15194
+ return path4.resolve(p);
15186
15195
  }
15187
15196
  }
15188
- function argentHomeDir() {
15189
- return path3.join(resolveHomeDir(), ".argent");
15190
- }
15191
15197
  function configDir(scope = "global", options = {}) {
15192
- if (scope === "global") {
15193
- return path3.join(resolveHomeDir(options), ".argent");
15194
- }
15198
+ if (scope === "global") return argentHomeDir(options);
15195
15199
  const cwd = options.cwd ?? process.cwd();
15196
- return path3.join(resolveProjectRoot(cwd), ".argent");
15200
+ return path4.join(resolveProjectRoot(cwd), ".argent");
15197
15201
  }
15198
15202
  function configFilePath(scope = "global", options = {}) {
15199
- return path3.join(configDir(scope, options), "config.json");
15203
+ return path4.join(configDir(scope, options), "config.json");
15200
15204
  }
15201
15205
 
15202
15206
  // ../configuration-core/src/config.ts
15203
15207
  import * as crypto from "node:crypto";
15204
15208
  import * as fs4 from "node:fs";
15205
- import * as path4 from "node:path";
15209
+ import * as path5 from "node:path";
15206
15210
  function readConfigObject(scope = "global", options = {}) {
15207
15211
  try {
15208
15212
  const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
@@ -15302,7 +15306,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
15302
15306
  try {
15303
15307
  const next = readConfigObject(scope, options);
15304
15308
  mutate(next);
15305
- const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
15309
+ const tmpPath = path5.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
15306
15310
  const fd = fs4.openSync(tmpPath, "wx", 384);
15307
15311
  try {
15308
15312
  fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
@@ -15331,13 +15335,76 @@ function getWhatsNewSeenVersion(options = {}) {
15331
15335
  return typeof value === "string" ? value : null;
15332
15336
  }
15333
15337
  function setWhatsNewSeenVersion(version, options = {}) {
15334
- updateConfig((config) => setAtPath(config, WHATS_NEW_SEEN_KEY, version), "global", options);
15338
+ let recorded = false;
15339
+ updateConfig(
15340
+ (config) => {
15341
+ const value = getAtPath(config, WHATS_NEW_SEEN_KEY);
15342
+ const seen = typeof value === "string" ? value : null;
15343
+ if (options.ifSeen !== void 0 && options.ifSeen !== seen) return;
15344
+ setAtPath(config, WHATS_NEW_SEEN_KEY, version);
15345
+ recorded = true;
15346
+ },
15347
+ "global",
15348
+ options
15349
+ );
15350
+ return recorded;
15335
15351
  }
15336
15352
 
15337
15353
  // ../configuration-core/src/secrets.ts
15338
15354
  var import_dotenv = __toESM(require_dist(), 1);
15339
15355
  import * as fs5 from "node:fs";
15340
- import * as path5 from "node:path";
15356
+ import * as path6 from "node:path";
15357
+
15358
+ // ../configuration-core/src/merge.ts
15359
+ function mergeRestrictive(local, global2) {
15360
+ if (local === void 0) return global2;
15361
+ if (global2 === void 0) return local;
15362
+ if (typeof local === "boolean" && typeof global2 === "boolean") {
15363
+ return local && global2;
15364
+ }
15365
+ if (typeof local === "number" && typeof global2 === "number") {
15366
+ return Math.min(local, global2);
15367
+ }
15368
+ return local;
15369
+ }
15370
+ function toArray(value) {
15371
+ return Array.isArray(value) ? value : null;
15372
+ }
15373
+ function mergeUnion(local, global2) {
15374
+ const l2 = toArray(local);
15375
+ const g = toArray(global2);
15376
+ if (l2 === null && g === null) return local ?? global2;
15377
+ const merged = [...g ?? [], ...l2 ?? []];
15378
+ return Array.from(new Set(merged));
15379
+ }
15380
+ function mergeIntersection(local, global2) {
15381
+ const l2 = toArray(local);
15382
+ const g = toArray(global2);
15383
+ if (l2 === null && g === null) return local ?? global2;
15384
+ if (l2 === null) return global2;
15385
+ if (g === null) return local;
15386
+ const globalSet = new Set(g);
15387
+ return l2.filter((item) => globalSet.has(item));
15388
+ }
15389
+ function applyMergePolicy(policy, local, global2) {
15390
+ if (typeof policy === "function") return policy({ local, global: global2 });
15391
+ switch (policy) {
15392
+ case "prioritize-local":
15393
+ return local ?? global2;
15394
+ case "prioritize-global":
15395
+ return global2 ?? local;
15396
+ case "prioritize-restrictive":
15397
+ return mergeRestrictive(local, global2);
15398
+ case "union":
15399
+ return mergeUnion(local, global2);
15400
+ case "intersection":
15401
+ return mergeIntersection(local, global2);
15402
+ default: {
15403
+ const _exhaustive = policy;
15404
+ return _exhaustive;
15405
+ }
15406
+ }
15407
+ }
15341
15408
 
15342
15409
  // ../configuration-core/src/config-schema.ts
15343
15410
  import { isAbsolute } from "node:path";
@@ -15376,6 +15443,15 @@ var CONFIG_SCHEMA = [
15376
15443
  // drained/reset, not just the file rewritten.
15377
15444
  manageCommand: "argent telemetry"
15378
15445
  },
15446
+ {
15447
+ key: "autoUpdate.enabled",
15448
+ description: "Automatically update the global Argent installation. Project-local installs require confirmation.",
15449
+ scopes: ["global"],
15450
+ parse: asBoolean,
15451
+ merge: "prioritize-local",
15452
+ default: true,
15453
+ example: "false"
15454
+ },
15379
15455
  {
15380
15456
  key: "lens.agent",
15381
15457
  description: "Coding-agent id remembered by `argent lens` to skip the picker.",
@@ -15459,16 +15535,59 @@ var CONFIG_SCHEMA = [
15459
15535
  example: "512"
15460
15536
  }
15461
15537
  ];
15538
+ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
15539
+ return registry.find((def) => def.key === key);
15540
+ }
15462
15541
 
15463
15542
  // ../configuration-core/src/config-access.ts
15464
- import * as path6 from "node:path";
15543
+ import * as path7 from "node:path";
15544
+ function readScopeValue(def, scope, options) {
15545
+ if (!def.scopes.includes(scope)) return void 0;
15546
+ const raw = getAtPath(readConfigObject(scope, options), def.key);
15547
+ return raw === void 0 ? void 0 : def.parse(raw);
15548
+ }
15549
+ function getConfigValue(def, options = {}) {
15550
+ const local = readScopeValue(def, "project", options);
15551
+ const global2 = readScopeValue(def, "global", options);
15552
+ const merged = applyMergePolicy(def.merge, local, global2);
15553
+ return merged ?? def.default;
15554
+ }
15555
+ function getConfigValueAtScope(key, scope, options = {}, registry = CONFIG_SCHEMA) {
15556
+ const def = requireDefinition(key, registry);
15557
+ return readScopeValue(def, scope, options);
15558
+ }
15559
+ function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
15560
+ const def = requireDefinition(key, registry);
15561
+ return getConfigValue(def, options);
15562
+ }
15563
+ function requireDefinition(key, registry = CONFIG_SCHEMA) {
15564
+ const def = getConfigDefinition(key, registry);
15565
+ if (!def) {
15566
+ throw new UnknownConfigKeyError(key);
15567
+ }
15568
+ return def;
15569
+ }
15570
+ var UnknownConfigKeyError = class extends Error {
15571
+ constructor(key) {
15572
+ super(`Unknown configuration key "${key}".`);
15573
+ this.key = key;
15574
+ this.name = "UnknownConfigKeyError";
15575
+ }
15576
+ key;
15577
+ };
15578
+ var AUTO_UPDATE_ENABLED_KEY = "autoUpdate.enabled";
15579
+ function isAutoUpdateEnabled() {
15580
+ if (getConfigValueByKey(AUTO_UPDATE_ENABLED_KEY) !== true) return false;
15581
+ const userHome = { homeDir: resolveHomeDir() };
15582
+ return getConfigValueAtScope(AUTO_UPDATE_ENABLED_KEY, "global", userHome) !== false;
15583
+ }
15465
15584
 
15466
15585
  // ../telemetry/src/paths.ts
15467
15586
  function identityFilePath() {
15468
- return path7.join(argentHomeDir(), "telemetry-id");
15587
+ return path8.join(argentHomeDir(), "telemetry-id");
15469
15588
  }
15470
15589
  function debugLogPath() {
15471
- return path7.join(argentHomeDir(), "telemetry-debug.log");
15590
+ return path8.join(argentHomeDir(), "telemetry-debug.log");
15472
15591
  }
15473
15592
 
15474
15593
  // ../telemetry/src/debug.ts
@@ -15688,15 +15807,15 @@ var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
15688
15807
 
15689
15808
  // ../registry/src/flow-file-refs.ts
15690
15809
  import * as fs8 from "node:fs/promises";
15691
- import * as path9 from "node:path";
15810
+ import * as path10 from "node:path";
15692
15811
 
15693
15812
  // ../registry/src/e2e-dirs.ts
15694
15813
  import * as fs7 from "node:fs/promises";
15695
- import * as path8 from "node:path";
15696
- var E2E_DIR = path8.join(".argent", "e2e");
15697
- var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
15814
+ import * as path9 from "node:path";
15815
+ var E2E_DIR = path9.join(".argent", "e2e");
15816
+ var LEGACY_E2E_DIRS = Object.freeze([path9.join(".argent", "flows")]);
15698
15817
  var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
15699
- var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path8.basename(dir));
15818
+ var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path9.basename(dir));
15700
15819
 
15701
15820
  // ../registry/src/tool-ids.ts
15702
15821
  var TOOL_ID_ALIASES = Object.freeze({
@@ -16576,9 +16695,9 @@ function isReplitAgent(env) {
16576
16695
  }
16577
16696
  var DEVIN_MARKER_PATH = "/opt/.devin";
16578
16697
  var JULES_MARKER_PATH = "/opt/environment_summary.sh";
16579
- function safeExists(fileExists, path33) {
16698
+ function safeExists(fileExists, path34) {
16580
16699
  try {
16581
- return fileExists(path33);
16700
+ return fileExists(path34);
16582
16701
  } catch {
16583
16702
  return false;
16584
16703
  }
@@ -16998,7 +17117,7 @@ function isCi(env = process.env) {
16998
17117
  var SESSION_ID = randomUUID4();
16999
17118
  function readCliVersion() {
17000
17119
  if (true) {
17001
- return "0.35.1-next.2";
17120
+ return "0.35.1-next.20";
17002
17121
  }
17003
17122
  return "0.0.0";
17004
17123
  }
@@ -17032,7 +17151,7 @@ function getBaseProps(runtime) {
17032
17151
  // ../telemetry/src/identity.ts
17033
17152
  import * as crypto2 from "node:crypto";
17034
17153
  import * as fs9 from "node:fs";
17035
- import * as path10 from "node:path";
17154
+ import * as path11 from "node:path";
17036
17155
  var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
17037
17156
  var cached = null;
17038
17157
  var fingerprintResolved = null;
@@ -17156,7 +17275,7 @@ function writeIdFileAtomic(finalPath, id) {
17156
17275
  if (occupant && !occupant.isFile()) {
17157
17276
  throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
17158
17277
  }
17159
- const tmpPath = path10.join(
17278
+ const tmpPath = path11.join(
17160
17279
  argentHomeDir(),
17161
17280
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
17162
17281
  );
@@ -17180,7 +17299,7 @@ function mintRandomId(finalPath) {
17180
17299
  fs9.mkdirSync(argentHomeDir(), { recursive: true });
17181
17300
  let value = crypto2.randomUUID();
17182
17301
  for (let attempt = 0; attempt < 3; attempt++) {
17183
- const tmpPath = path10.join(
17302
+ const tmpPath = path11.join(
17184
17303
  argentHomeDir(),
17185
17304
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
17186
17305
  );
@@ -17225,7 +17344,7 @@ function mintRandomId(finalPath) {
17225
17344
  throw new Error("telemetry: failed to create identity after retries");
17226
17345
  }
17227
17346
  function claimCorruptOccupant(finalPath) {
17228
- const claimed = path10.join(
17347
+ const claimed = path11.join(
17229
17348
  argentHomeDir(),
17230
17349
  `.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
17231
17350
  );
@@ -17272,12 +17391,12 @@ function tryReadId(filePath) {
17272
17391
  import { execFileSync, spawn } from "node:child_process";
17273
17392
 
17274
17393
  // ../native-devtools-ios/src/index.ts
17275
- import * as path11 from "node:path";
17394
+ import * as path12 from "node:path";
17276
17395
  import * as fs10 from "node:fs";
17277
- var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path11.join(__dirname, "..", "dylibs");
17278
- var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path11.join(__dirname, "..", "bin");
17279
- var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path11.join(DYLIB_DIR, "tcp");
17280
- var DYLIB_TVOS_DIR = path11.join(DYLIB_DIR, "tvos");
17396
+ var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path12.join(__dirname, "..", "dylibs");
17397
+ var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path12.join(__dirname, "..", "bin");
17398
+ var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path12.join(DYLIB_DIR, "tcp");
17399
+ var DYLIB_TVOS_DIR = path12.join(DYLIB_DIR, "tvos");
17281
17400
  function hostPlatformKey() {
17282
17401
  if (process.platform === "linux" && process.arch === "arm64") {
17283
17402
  return "linux-arm64";
@@ -17288,13 +17407,13 @@ function simulatorServerBinaryName() {
17288
17407
  return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
17289
17408
  }
17290
17409
  function platformBinDir() {
17291
- return path11.join(BIN_DIR, hostPlatformKey());
17410
+ return path12.join(BIN_DIR, hostPlatformKey());
17292
17411
  }
17293
17412
  function simulatorServerBinaryPath() {
17294
17413
  const binaryName = simulatorServerBinaryName();
17295
- const p = path11.join(platformBinDir(), binaryName);
17414
+ const p = path12.join(platformBinDir(), binaryName);
17296
17415
  if (!fs10.existsSync(p)) {
17297
- const flat = path11.join(BIN_DIR, binaryName);
17416
+ const flat = path12.join(BIN_DIR, binaryName);
17298
17417
  const migrationHint = fs10.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
17299
17418
  throw new Error(
17300
17419
  `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
@@ -17324,12 +17443,12 @@ function resolveHostFingerprint() {
17324
17443
  }
17325
17444
  }
17326
17445
  function resolveHostFingerprintAsync() {
17327
- return new Promise((resolve21) => {
17446
+ return new Promise((resolve22) => {
17328
17447
  let binary;
17329
17448
  try {
17330
17449
  binary = simulatorServerBinaryPath();
17331
17450
  } catch {
17332
- resolve21(null);
17451
+ resolve22(null);
17333
17452
  return;
17334
17453
  }
17335
17454
  let settled = false;
@@ -17342,7 +17461,7 @@ function resolveHostFingerprintAsync() {
17342
17461
  child?.kill("SIGKILL");
17343
17462
  } catch {
17344
17463
  }
17345
- resolve21(value);
17464
+ resolve22(value);
17346
17465
  };
17347
17466
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
17348
17467
  watchdog.unref?.();
@@ -17376,7 +17495,7 @@ function resolveHostFingerprintAsync() {
17376
17495
 
17377
17496
  // ../telemetry/src/consent.ts
17378
17497
  import * as fs11 from "node:fs";
17379
- import * as path12 from "node:path";
17498
+ import * as path13 from "node:path";
17380
17499
  var cache = /* @__PURE__ */ new Map();
17381
17500
  var sessionOverride = null;
17382
17501
  function readConfigOverrideAt(filePath) {
@@ -17417,8 +17536,12 @@ function readConfigOverrideAt(filePath) {
17417
17536
  function readPersistedConsent(cwd) {
17418
17537
  const globalPath = configFilePath("global");
17419
17538
  const projectPath = configFilePath("project", { cwd });
17539
+ const userConfigPath = path13.join(resolveHomeDir(), ".argent", "config.json");
17540
+ if (userConfigPath !== globalPath && readConfigOverrideAt(userConfigPath) === false) {
17541
+ return { enabled: false, detail: `${userConfigPath} (user)` };
17542
+ }
17420
17543
  const global2 = readConfigOverrideAt(globalPath);
17421
- const projectRoot = path12.dirname(path12.dirname(projectPath));
17544
+ const projectRoot = path13.dirname(path13.dirname(projectPath));
17422
17545
  const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
17423
17546
  if (project === false && global2 === false) {
17424
17547
  return { enabled: false, detail: "config.json (project and global)" };
@@ -17614,7 +17737,7 @@ var DRAIN_GRACE_MS = 250;
17614
17737
  async function raceDrain(client2, timeoutMs) {
17615
17738
  await Promise.race([
17616
17739
  client2.shutdown(timeoutMs),
17617
- new Promise((resolve21) => setTimeout(resolve21, timeoutMs + DRAIN_GRACE_MS).unref())
17740
+ new Promise((resolve22) => setTimeout(resolve22, timeoutMs + DRAIN_GRACE_MS).unref())
17618
17741
  ]);
17619
17742
  }
17620
17743
  async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
@@ -17635,9 +17758,9 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
17635
17758
 
17636
17759
  // ../argent-installer/src/mcp-configs.ts
17637
17760
  import * as fs18 from "node:fs";
17638
- import * as path19 from "node:path";
17639
- import { execFileSync as execFileSync4 } from "node:child_process";
17640
- import { homedir as homedir5 } from "node:os";
17761
+ import * as path20 from "node:path";
17762
+ import { execFileSync as execFileSync5 } from "node:child_process";
17763
+ import { homedir as homedir4 } from "node:os";
17641
17764
 
17642
17765
  // ../argent-installer/src/constants.ts
17643
17766
  var PACKAGE_NAME = "@swmansion/argent";
@@ -17651,11 +17774,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
17651
17774
  // ../argent-installer/src/utils.ts
17652
17775
  var import_semver3 = __toESM(require_semver2(), 1);
17653
17776
  import * as fs17 from "node:fs";
17654
- import * as path18 from "node:path";
17777
+ import * as path19 from "node:path";
17655
17778
  import * as dns from "node:dns";
17656
17779
  import { createHash as createHash2 } from "node:crypto";
17657
17780
  import * as os3 from "node:os";
17658
- import { execFileSync as execFileSync3, execSync } from "node:child_process";
17781
+ import { execFileSync as execFileSync4, execSync } from "node:child_process";
17659
17782
 
17660
17783
  // ../../node_modules/smol-toml/dist/error.js
17661
17784
  function getLineColFromPtr(string, ptr) {
@@ -19397,12 +19520,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
19397
19520
  }
19398
19521
  return result;
19399
19522
  }
19400
- function findNodeAtLocation(root, path33) {
19523
+ function findNodeAtLocation(root, path34) {
19401
19524
  if (!root) {
19402
19525
  return void 0;
19403
19526
  }
19404
19527
  let node = root;
19405
- for (let segment of path33) {
19528
+ for (let segment of path34) {
19406
19529
  if (typeof segment === "string") {
19407
19530
  if (node.type !== "object" || !Array.isArray(node.children)) {
19408
19531
  return void 0;
@@ -19756,14 +19879,14 @@ function getNodeType(value) {
19756
19879
 
19757
19880
  // ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
19758
19881
  function setProperty(text2, originalPath, value, options) {
19759
- const path33 = originalPath.slice();
19882
+ const path34 = originalPath.slice();
19760
19883
  const errors = [];
19761
19884
  const root = parseTree(text2, errors);
19762
19885
  let parent = void 0;
19763
19886
  let lastSegment = void 0;
19764
- while (path33.length > 0) {
19765
- lastSegment = path33.pop();
19766
- parent = findNodeAtLocation(root, path33);
19887
+ while (path34.length > 0) {
19888
+ lastSegment = path34.pop();
19889
+ parent = findNodeAtLocation(root, path34);
19767
19890
  if (parent === void 0 && value !== void 0) {
19768
19891
  if (typeof lastSegment === "string") {
19769
19892
  value = { [lastSegment]: value };
@@ -19949,8 +20072,8 @@ var ParseErrorCode;
19949
20072
  ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
19950
20073
  ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
19951
20074
  })(ParseErrorCode || (ParseErrorCode = {}));
19952
- function modify(text2, path33, value, options) {
19953
- return setProperty(text2, path33, value, options);
20075
+ function modify(text2, path34, value, options) {
20076
+ return setProperty(text2, path34, value, options);
19954
20077
  }
19955
20078
  function applyEdits(text2, edits) {
19956
20079
  let sortedEdits = edits.slice(0).sort((a2, b) => {
@@ -19975,37 +20098,38 @@ function applyEdits(text2, edits) {
19975
20098
 
19976
20099
  // ../argent-installer/src/package-root.ts
19977
20100
  import * as fs12 from "node:fs";
19978
- import * as path13 from "node:path";
19979
- function resolvePackageRoot(dirname20) {
19980
- let current = path13.resolve(dirname20);
20101
+ import * as path14 from "node:path";
20102
+ function resolvePackageRoot(dirname19) {
20103
+ let current = path14.resolve(dirname19);
19981
20104
  while (true) {
19982
- if (fs12.existsSync(path13.join(current, "package.json"))) return current;
19983
- const parent = path13.dirname(current);
19984
- if (parent === current) return path13.resolve(dirname20);
20105
+ if (fs12.existsSync(path14.join(current, "package.json"))) return current;
20106
+ const parent = path14.dirname(current);
20107
+ if (parent === current) return path14.resolve(dirname19);
19985
20108
  current = parent;
19986
20109
  }
19987
20110
  }
19988
20111
 
19989
20112
  // ../argent-installer/src/package-manager.ts
20113
+ import { execFileSync as execFileSync3 } from "node:child_process";
19990
20114
  import * as fs15 from "node:fs";
19991
20115
  import * as os2 from "node:os";
19992
- import * as path16 from "node:path";
20116
+ import * as path17 from "node:path";
19993
20117
 
19994
20118
  // ../argent-installer/src/topology.ts
19995
20119
  var import_semver2 = __toESM(require_semver2(), 1);
19996
20120
  import * as fs14 from "node:fs";
19997
- import * as path15 from "node:path";
20121
+ import * as path16 from "node:path";
19998
20122
  import { createRequire } from "node:module";
19999
20123
  import { execFileSync as execFileSync2 } from "node:child_process";
20000
20124
 
20001
20125
  // ../argent-installer/src/preflight.ts
20002
20126
  import * as fs13 from "node:fs";
20003
- import * as path14 from "node:path";
20127
+ import * as path15 from "node:path";
20004
20128
  function hasProjectPackageJson(projectRoot) {
20005
- return fs13.existsSync(path14.join(projectRoot, "package.json"));
20129
+ return fs13.existsSync(path15.join(projectRoot, "package.json"));
20006
20130
  }
20007
20131
  function isYarnPnp(projectRoot) {
20008
- return fs13.existsSync(path14.join(projectRoot, ".pnp.cjs")) || fs13.existsSync(path14.join(projectRoot, ".pnp.loader.mjs"));
20132
+ return fs13.existsSync(path15.join(projectRoot, ".pnp.cjs")) || fs13.existsSync(path15.join(projectRoot, ".pnp.loader.mjs"));
20009
20133
  }
20010
20134
 
20011
20135
  // ../argent-installer/src/topology.ts
@@ -20031,12 +20155,12 @@ function isTempRunnerPath(binaryPath) {
20031
20155
  }
20032
20156
  function isProjectBinPath(binaryPath) {
20033
20157
  const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
20034
- const binDir = norm(path15.dirname(path15.resolve(binaryPath)));
20158
+ const binDir = norm(path16.dirname(path16.resolve(binaryPath)));
20035
20159
  const prefix = process.env.npm_config_local_prefix;
20036
- if (prefix && norm(path15.join(prefix, "node_modules", ".bin")) === binDir) return true;
20037
- for (let dir = path15.resolve(process.cwd()); ; dir = path15.dirname(dir)) {
20038
- if (norm(path15.join(dir, "node_modules", ".bin")) === binDir) return true;
20039
- if (path15.dirname(dir) === dir) return false;
20160
+ if (prefix && norm(path16.join(prefix, "node_modules", ".bin")) === binDir) return true;
20161
+ for (let dir = path16.resolve(process.cwd()); ; dir = path16.dirname(dir)) {
20162
+ if (norm(path16.join(dir, "node_modules", ".bin")) === binDir) return true;
20163
+ if (path16.dirname(dir) === dir) return false;
20040
20164
  }
20041
20165
  }
20042
20166
  function getPermanentBinaryPaths() {
@@ -20096,7 +20220,7 @@ function shimTargetOf(binaryPath) {
20096
20220
  const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
20097
20221
  if (trailer) return trailer[1].trim();
20098
20222
  const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
20099
- return relative5 ? path15.resolve(canonicalPath(path15.dirname(binaryPath)), relative5[1]) : null;
20223
+ return relative5 ? path16.resolve(canonicalPath(path16.dirname(binaryPath)), relative5[1]) : null;
20100
20224
  }
20101
20225
  function globalPackageRootOf(binaryPath) {
20102
20226
  const root = packageRootOf(binaryPath);
@@ -20107,8 +20231,8 @@ function globalPackageRootOf(binaryPath) {
20107
20231
  function packageRootOf(binaryPath) {
20108
20232
  try {
20109
20233
  const realPath = fs14.realpathSync(binaryPath);
20110
- const root = resolvePackageRoot(path15.dirname(realPath));
20111
- const pkg = JSON.parse(fs14.readFileSync(path15.join(root, "package.json"), "utf8"));
20234
+ const root = resolvePackageRoot(path16.dirname(realPath));
20235
+ const pkg = JSON.parse(fs14.readFileSync(path16.join(root, "package.json"), "utf8"));
20112
20236
  return pkg.name === PACKAGE_NAME ? root : null;
20113
20237
  } catch {
20114
20238
  return null;
@@ -20117,7 +20241,7 @@ function packageRootOf(binaryPath) {
20117
20241
  function cliPathOf(packageRoot) {
20118
20242
  const binSub = argentBinSubpath(packageRoot);
20119
20243
  if (!binSub) return null;
20120
- const cli = path15.join(packageRoot, binSub);
20244
+ const cli = path16.join(packageRoot, binSub);
20121
20245
  return fs14.existsSync(cli) ? cli : null;
20122
20246
  }
20123
20247
  function getGloballyInstalledLaunchPaths() {
@@ -20128,7 +20252,7 @@ function getGloballyInstalledLaunchPaths() {
20128
20252
  const cli = packageRoot ? cliPathOf(packageRoot) : null;
20129
20253
  if (!cli) return null;
20130
20254
  try {
20131
- const node = path15.join(fs14.realpathSync(path15.dirname(binaryPath)), "node");
20255
+ const node = path16.join(fs14.realpathSync(path16.dirname(binaryPath)), "node");
20132
20256
  return fs14.existsSync(node) ? { node, cli } : null;
20133
20257
  } catch {
20134
20258
  return null;
@@ -20138,7 +20262,7 @@ function getGloballyInstalledVersion() {
20138
20262
  const pkgRoot = getGloballyInstalledPackageRoot();
20139
20263
  if (!pkgRoot) return null;
20140
20264
  try {
20141
- const pkg = JSON.parse(fs14.readFileSync(path15.join(pkgRoot, "package.json"), "utf8"));
20265
+ const pkg = JSON.parse(fs14.readFileSync(path16.join(pkgRoot, "package.json"), "utf8"));
20142
20266
  return pkg.version ?? null;
20143
20267
  } catch {
20144
20268
  return null;
@@ -20147,7 +20271,7 @@ function getGloballyInstalledVersion() {
20147
20271
  function readManifestDeclaration(projectRoot) {
20148
20272
  try {
20149
20273
  const pkg = JSON.parse(
20150
- fs14.readFileSync(path15.join(projectRoot, "package.json"), "utf8")
20274
+ fs14.readFileSync(path16.join(projectRoot, "package.json"), "utf8")
20151
20275
  );
20152
20276
  const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
20153
20277
  return typeof spec === "string" ? spec : null;
@@ -20160,11 +20284,11 @@ function isDeclaredLocally(projectRoot) {
20160
20284
  }
20161
20285
  function resolveLocalArgentDir(projectRoot) {
20162
20286
  try {
20163
- const req = createRequire(path15.join(projectRoot, "package.json"));
20164
- return path15.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
20287
+ const req = createRequire(path16.join(projectRoot, "package.json"));
20288
+ return path16.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
20165
20289
  } catch {
20166
- const plain = path15.join(projectRoot, "node_modules", PACKAGE_NAME);
20167
- return fs14.existsSync(path15.join(plain, "package.json")) ? plain : null;
20290
+ const plain = path16.join(projectRoot, "node_modules", PACKAGE_NAME);
20291
+ return fs14.existsSync(path16.join(plain, "package.json")) ? plain : null;
20168
20292
  }
20169
20293
  }
20170
20294
  function probeLocalInstall(projectRoot) {
@@ -20172,7 +20296,7 @@ function probeLocalInstall(projectRoot) {
20172
20296
  if (packageDir) {
20173
20297
  let version;
20174
20298
  try {
20175
- const pkg = JSON.parse(fs14.readFileSync(path15.join(packageDir, "package.json"), "utf8"));
20299
+ const pkg = JSON.parse(fs14.readFileSync(path16.join(packageDir, "package.json"), "utf8"));
20176
20300
  version = pkg.version ?? null;
20177
20301
  } catch {
20178
20302
  version = null;
@@ -20195,7 +20319,7 @@ function getLocallyInstalledVersion(projectRoot) {
20195
20319
  }
20196
20320
  function readLocalPackageVersionUncached(projectRoot) {
20197
20321
  try {
20198
- const pkgPath = path15.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
20322
+ const pkgPath = path16.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
20199
20323
  const pkg = JSON.parse(fs14.readFileSync(pkgPath, "utf8"));
20200
20324
  return pkg.version ?? null;
20201
20325
  } catch {
@@ -20204,7 +20328,7 @@ function readLocalPackageVersionUncached(projectRoot) {
20204
20328
  }
20205
20329
  function argentBinSubpath(pkgDir) {
20206
20330
  try {
20207
- const pkg = JSON.parse(fs14.readFileSync(path15.join(pkgDir, "package.json"), "utf8"));
20331
+ const pkg = JSON.parse(fs14.readFileSync(path16.join(pkgDir, "package.json"), "utf8"));
20208
20332
  if (typeof pkg.bin === "string") return pkg.bin;
20209
20333
  if (pkg.bin && typeof pkg.bin === "object") {
20210
20334
  return pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0] ?? null;
@@ -20224,13 +20348,13 @@ function getLocalArgentBinRelPath(projectRoot) {
20224
20348
  root = fs14.realpathSync(projectRoot);
20225
20349
  } catch {
20226
20350
  }
20227
- const stableRel = path15.join("node_modules", PACKAGE_NAME, binSub);
20228
- if (fs14.existsSync(path15.join(root, stableRel))) {
20229
- return stableRel.split(path15.sep).join("/");
20351
+ const stableRel = path16.join("node_modules", PACKAGE_NAME, binSub);
20352
+ if (fs14.existsSync(path16.join(root, stableRel))) {
20353
+ return stableRel.split(path16.sep).join("/");
20230
20354
  }
20231
- const abs = path15.join(pkgDir, binSub);
20355
+ const abs = path16.join(pkgDir, binSub);
20232
20356
  if (!fs14.existsSync(abs)) return null;
20233
- return path15.relative(root, abs).split(path15.sep).join("/");
20357
+ return path16.relative(root, abs).split(path16.sep).join("/");
20234
20358
  }
20235
20359
 
20236
20360
  // ../argent-installer/src/package-manager.ts
@@ -20263,7 +20387,7 @@ function detectGlobalPackageManager() {
20263
20387
  return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
20264
20388
  }
20265
20389
  if (process.platform === "win32") {
20266
- if (fs15.existsSync(path16.join(npmCopyBeside(path16.dirname(binaryPath)), "package.json"))) {
20390
+ if (fs15.existsSync(path17.join(npmCopyBeside(path17.dirname(binaryPath)), "package.json"))) {
20267
20391
  return "npm";
20268
20392
  }
20269
20393
  if (fs15.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
@@ -20275,23 +20399,23 @@ function detectGlobalPackageManager() {
20275
20399
  return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
20276
20400
  }
20277
20401
  function lockfileOwnerOf(root) {
20278
- for (let dir = path16.dirname(root); path16.dirname(dir) !== dir; dir = path16.dirname(dir)) {
20402
+ for (let dir = path17.dirname(root); path17.dirname(dir) !== dir; dir = path17.dirname(dir)) {
20279
20403
  const pm = pmFromLockfile(dir);
20280
20404
  if (pm) return pm;
20281
20405
  }
20282
20406
  return null;
20283
20407
  }
20284
20408
  function npmCopyBeside(binDir) {
20285
- return process.platform === "win32" ? path16.join(binDir, "node_modules", PACKAGE_NAME) : path16.join(path16.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
20409
+ return process.platform === "win32" ? path17.join(binDir, "node_modules", PACKAGE_NAME) : path17.join(path17.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
20286
20410
  }
20287
20411
  function isInNpmLayout(binaryPath, root) {
20288
20412
  const realRoot = canonicalPath(root);
20289
20413
  let link = binaryPath;
20290
20414
  for (let hop = 0; hop < 40; hop++) {
20291
- const binDir = canonicalPath(path16.dirname(link));
20415
+ const binDir = canonicalPath(path17.dirname(link));
20292
20416
  if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
20293
20417
  try {
20294
- link = path16.resolve(binDir, fs15.readlinkSync(link));
20418
+ link = path17.resolve(binDir, fs15.readlinkSync(link));
20295
20419
  } catch {
20296
20420
  return false;
20297
20421
  }
@@ -20310,7 +20434,7 @@ function asKnownPm(name) {
20310
20434
  }
20311
20435
  function pmFromPackageManagerField(dir) {
20312
20436
  try {
20313
- const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
20437
+ const pkg = JSON.parse(fs15.readFileSync(path17.join(dir, "package.json"), "utf8"));
20314
20438
  if (typeof pkg.packageManager === "string") {
20315
20439
  return asKnownPm(pkg.packageManager.split("@")[0]);
20316
20440
  }
@@ -20321,7 +20445,7 @@ function pmFromPackageManagerField(dir) {
20321
20445
  }
20322
20446
  function pmFromDevEngines(dir) {
20323
20447
  try {
20324
- const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
20448
+ const pkg = JSON.parse(fs15.readFileSync(path17.join(dir, "package.json"), "utf8"));
20325
20449
  const devEnginesPm = pkg.devEngines?.packageManager;
20326
20450
  const names = /* @__PURE__ */ new Set();
20327
20451
  for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
@@ -20334,7 +20458,7 @@ function pmFromDevEngines(dir) {
20334
20458
  }
20335
20459
  }
20336
20460
  function pmFromLockfile(dir) {
20337
- const has = (file) => fs15.existsSync(path16.join(dir, file));
20461
+ const has = (file) => fs15.existsSync(path17.join(dir, file));
20338
20462
  if (has("pnpm-lock.yaml")) return "pnpm";
20339
20463
  if (has("yarn.lock")) return "yarn";
20340
20464
  if (has("bun.lock") || has("bun.lockb")) return "bun";
@@ -20342,15 +20466,15 @@ function pmFromLockfile(dir) {
20342
20466
  return null;
20343
20467
  }
20344
20468
  function pmFromWorkspaceMarker(dir) {
20345
- return fs15.existsSync(path16.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
20469
+ return fs15.existsSync(path17.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
20346
20470
  }
20347
20471
  function detectProjectPackageManager(projectRoot) {
20348
- let dir = path16.resolve(projectRoot);
20472
+ let dir = path17.resolve(projectRoot);
20349
20473
  for (; ; ) {
20350
20474
  const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
20351
20475
  if (pm) return pm;
20352
- if (fs15.existsSync(path16.join(dir, ".git"))) break;
20353
- const parent = path16.dirname(dir);
20476
+ if (fs15.existsSync(path17.join(dir, ".git"))) break;
20477
+ const parent = path17.dirname(dir);
20354
20478
  if (parent === dir) break;
20355
20479
  dir = parent;
20356
20480
  }
@@ -20376,6 +20500,42 @@ function globalCommandOptions(pm) {
20376
20500
  const { npm_config_prefix: _npmPrefix, ...env } = process.env;
20377
20501
  return { ...cwd, env };
20378
20502
  }
20503
+ var globalLocationArgs = {
20504
+ npm: ["root", "-g"],
20505
+ pnpm: ["list", "-g", "--depth", "0", "--json", PACKAGE_NAME],
20506
+ yarn: ["global", "dir"],
20507
+ bun: ["pm", "ls", "-g"]
20508
+ };
20509
+ function isRegistrySpec(spec) {
20510
+ return typeof spec === "string" && spec.length > 0 && !spec.includes(":") && !spec.includes("/");
20511
+ }
20512
+ function ownsGlobalInstall(pm, runningRoot) {
20513
+ try {
20514
+ const output = execFileSync3(pm, globalLocationArgs[pm], {
20515
+ ...globalCommandOptions(pm),
20516
+ encoding: "utf8",
20517
+ stdio: ["ignore", "pipe", "ignore"],
20518
+ shell: process.platform === "win32",
20519
+ timeout: 5e3
20520
+ }).trim();
20521
+ let pkg;
20522
+ let localBuild;
20523
+ if (pm === "pnpm") {
20524
+ const listings = JSON.parse(output);
20525
+ const dependency = listings[0]?.dependencies?.[PACKAGE_NAME];
20526
+ pkg = dependency?.path;
20527
+ localBuild = !isRegistrySpec(dependency?.version);
20528
+ } else {
20529
+ const dir = pm === "bun" ? /^([^\r\n]+) node_modules \(/.exec(output)?.[1] : output;
20530
+ if (!dir || !path17.isAbsolute(dir)) return false;
20531
+ pkg = pm === "npm" ? path17.join(dir, PACKAGE_NAME) : path17.join(dir, "node_modules", PACKAGE_NAME);
20532
+ localBuild = fs15.lstatSync(pkg).isSymbolicLink();
20533
+ }
20534
+ return !localBuild && !!pkg && path17.isAbsolute(pkg) && fs15.realpathSync(pkg) === runningRoot;
20535
+ } catch {
20536
+ return false;
20537
+ }
20538
+ }
20379
20539
  function globalUninstallCommand(pm, pkg) {
20380
20540
  switch (pm) {
20381
20541
  case "yarn":
@@ -20427,9 +20587,9 @@ function localUninstallCommand(pm, pkg) {
20427
20587
 
20428
20588
  // ../argent-installer/src/install-record.ts
20429
20589
  import * as fs16 from "node:fs";
20430
- import * as path17 from "node:path";
20590
+ import * as path18 from "node:path";
20431
20591
  function getInstallRecordPath(projectRoot) {
20432
- return path17.join(projectRoot, ".argent", "install.json");
20592
+ return path18.join(projectRoot, ".argent", "install.json");
20433
20593
  }
20434
20594
  function readInstallRecord(projectRoot) {
20435
20595
  try {
@@ -20444,7 +20604,7 @@ function readInstallRecord(projectRoot) {
20444
20604
  }
20445
20605
  function writeInstallRecord(projectRoot, record) {
20446
20606
  const recordPath = getInstallRecordPath(projectRoot);
20447
- fs16.mkdirSync(path17.dirname(recordPath), { recursive: true });
20607
+ fs16.mkdirSync(path18.dirname(recordPath), { recursive: true });
20448
20608
  fs16.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
20449
20609
  }
20450
20610
  function removeInstallRecord(projectRoot) {
@@ -20452,7 +20612,7 @@ function removeInstallRecord(projectRoot) {
20452
20612
  try {
20453
20613
  if (!fs16.existsSync(recordPath)) return false;
20454
20614
  fs16.rmSync(recordPath, { force: true });
20455
- const dir = path17.dirname(recordPath);
20615
+ const dir = path18.dirname(recordPath);
20456
20616
  try {
20457
20617
  if (fs16.existsSync(dir) && fs16.readdirSync(dir).length === 0) fs16.rmdirSync(dir);
20458
20618
  } catch {
@@ -20482,9 +20642,9 @@ function resolveInstallModeFromFlags(opts) {
20482
20642
  // ../argent-installer/src/utils.ts
20483
20643
  var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
20484
20644
  function resolveBundledDir(dirName) {
20485
- const packagedDir = path18.join(PACKAGE_ROOT, dirName);
20645
+ const packagedDir = path19.join(PACKAGE_ROOT, dirName);
20486
20646
  if (fs17.existsSync(packagedDir)) return packagedDir;
20487
- return path18.resolve(PACKAGE_ROOT, "..", "skills", dirName);
20647
+ return path19.resolve(PACKAGE_ROOT, "..", "skills", dirName);
20488
20648
  }
20489
20649
  var SKILLS_DIR = resolveBundledDir("skills");
20490
20650
  var RULES_DIR = resolveBundledDir("rules");
@@ -20496,18 +20656,18 @@ function buildArgentSkillsSource(version) {
20496
20656
  }
20497
20657
  function listBundledSkills(skillsDir = SKILLS_DIR) {
20498
20658
  try {
20499
- return fs17.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs17.existsSync(path18.join(skillsDir, name, "SKILL.md"))).sort();
20659
+ return fs17.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs17.existsSync(path19.join(skillsDir, name, "SKILL.md"))).sort();
20500
20660
  } catch {
20501
20661
  return [];
20502
20662
  }
20503
20663
  }
20504
20664
  function getProjectSkillLockPath(cwd = process.cwd()) {
20505
- return path18.join(cwd, "skills-lock.json");
20665
+ return path19.join(cwd, "skills-lock.json");
20506
20666
  }
20507
20667
  function getGlobalSkillLockPath() {
20508
20668
  const xdgStateHome = process.env.XDG_STATE_HOME;
20509
- if (xdgStateHome) return path18.join(xdgStateHome, "skills", ".skill-lock.json");
20510
- return path18.join(os3.homedir(), ".agents", ".skill-lock.json");
20669
+ if (xdgStateHome) return path19.join(xdgStateHome, "skills", ".skill-lock.json");
20670
+ return path19.join(os3.homedir(), ".agents", ".skill-lock.json");
20511
20671
  }
20512
20672
  var ARGENT_SKILL_PREFIX = "argent-";
20513
20673
  var LEGACY_ARGENT_SKILL_NAMES = [
@@ -20637,20 +20797,20 @@ var PROJECT_ROOT_MARKERS = [
20637
20797
  "skills-lock.json"
20638
20798
  ];
20639
20799
  function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
20640
- const initialDir = path18.resolve(startDir);
20800
+ const initialDir = path19.resolve(startDir);
20641
20801
  const home = canonicalPath(homeDir);
20642
20802
  let currentDir = initialDir;
20643
20803
  while (true) {
20644
20804
  if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
20645
20805
  return initialDir;
20646
20806
  }
20647
- if (PROJECT_ROOT_MARKERS.some((marker) => fs17.existsSync(path18.join(currentDir, marker)))) {
20807
+ if (PROJECT_ROOT_MARKERS.some((marker) => fs17.existsSync(path19.join(currentDir, marker)))) {
20648
20808
  return currentDir;
20649
20809
  }
20650
- if (fs17.existsSync(path18.join(currentDir, ".git"))) {
20810
+ if (fs17.existsSync(path19.join(currentDir, ".git"))) {
20651
20811
  return currentDir;
20652
20812
  }
20653
- const parentDir = path18.dirname(currentDir);
20813
+ const parentDir = path19.dirname(currentDir);
20654
20814
  if (parentDir === currentDir) {
20655
20815
  return initialDir;
20656
20816
  }
@@ -20666,7 +20826,7 @@ function readToml(filePath) {
20666
20826
  }
20667
20827
  }
20668
20828
  function writeToml(filePath, data) {
20669
- fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20829
+ fs17.mkdirSync(path19.dirname(filePath), { recursive: true });
20670
20830
  fs17.writeFileSync(filePath, stringify(data) + "\n");
20671
20831
  }
20672
20832
  function readYaml(filePath) {
@@ -20680,7 +20840,7 @@ function readYaml(filePath) {
20680
20840
  return doc;
20681
20841
  }
20682
20842
  function writeYaml(filePath, doc) {
20683
- fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20843
+ fs17.mkdirSync(path19.dirname(filePath), { recursive: true });
20684
20844
  fs17.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
20685
20845
  }
20686
20846
  function readJson(filePath) {
@@ -20692,7 +20852,7 @@ function readJson(filePath) {
20692
20852
  }
20693
20853
  }
20694
20854
  function writeJson(filePath, data) {
20695
- fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20855
+ fs17.mkdirSync(path19.dirname(filePath), { recursive: true });
20696
20856
  fs17.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
20697
20857
  }
20698
20858
  var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
@@ -20788,10 +20948,10 @@ function editJsoncFile(filePath, jsonPath, value) {
20788
20948
  const parsed = parse3(text2, [], { allowTrailingComma: true });
20789
20949
  if (isEmptyPlainObject(parsed)) {
20790
20950
  fs17.rmSync(filePath, { force: true });
20791
- rmEmptyDir(path18.dirname(filePath));
20951
+ rmEmptyDir(path19.dirname(filePath));
20792
20952
  return;
20793
20953
  }
20794
- fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20954
+ fs17.mkdirSync(path19.dirname(filePath), { recursive: true });
20795
20955
  const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
20796
20956
  fs17.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
20797
20957
  }
@@ -20810,11 +20970,11 @@ function resolveLinkedDestination(dest) {
20810
20970
  try {
20811
20971
  entry = fs17.lstatSync(current);
20812
20972
  } catch {
20813
- return current === dest || dirExists(path18.dirname(current)) ? current : dest;
20973
+ return current === dest || dirExists(path19.dirname(current)) ? current : dest;
20814
20974
  }
20815
20975
  if (!entry.isSymbolicLink()) return current;
20816
20976
  try {
20817
- current = path18.resolve(realpathOrSelf(path18.dirname(current)), fs17.readlinkSync(current));
20977
+ current = path19.resolve(realpathOrSelf(path19.dirname(current)), fs17.readlinkSync(current));
20818
20978
  } catch {
20819
20979
  return dest;
20820
20980
  }
@@ -20828,20 +20988,20 @@ function copyDir(src, dest) {
20828
20988
  return target;
20829
20989
  }
20830
20990
  function treeHasFiles(dir) {
20831
- return fs17.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path18.join(dir, entry.name)));
20991
+ return fs17.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path19.join(dir, entry.name)));
20832
20992
  }
20833
20993
  function copyTree(src, dest) {
20834
20994
  const entries = fs17.readdirSync(src, { withFileTypes: true });
20835
20995
  fs17.mkdirSync(dest, { recursive: true });
20836
20996
  for (const entry of entries) {
20837
- const from = path18.join(src, entry.name);
20838
- const to = resolveLinkedDestination(path18.join(dest, entry.name));
20997
+ const from = path19.join(src, entry.name);
20998
+ const to = resolveLinkedDestination(path19.join(dest, entry.name));
20839
20999
  if (entry.isDirectory()) copyTree(from, to);
20840
21000
  else fs17.copyFileSync(from, to);
20841
21001
  }
20842
21002
  }
20843
21003
  function readRetiredFile(targetDir, relativePath) {
20844
- const entryPath = path18.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
21004
+ const entryPath = path19.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
20845
21005
  const file = resolveLinkedDestination(entryPath);
20846
21006
  try {
20847
21007
  if (!fs17.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
@@ -20853,7 +21013,7 @@ function readRetiredFile(targetDir, relativePath) {
20853
21013
  function findRetiredFiles(retired, bundleDir, targetDir) {
20854
21014
  const found = [];
20855
21015
  for (const { path: relativePath, shipped } of retired) {
20856
- if (bundleDir !== null && fs17.existsSync(path18.join(bundleDir, ...relativePath.split("/"))))
21016
+ if (bundleDir !== null && fs17.existsSync(path19.join(bundleDir, ...relativePath.split("/"))))
20857
21017
  continue;
20858
21018
  const content = readRetiredFile(targetDir, relativePath);
20859
21019
  if (content === null) continue;
@@ -20869,7 +21029,7 @@ function removeRetiredFiles(targetDir, files) {
20869
21029
  const content = readRetiredFile(targetDir, relativePath);
20870
21030
  if (content === null || hashBundledContent(content) !== sha256) continue;
20871
21031
  const segments = relativePath.split("/");
20872
- const entryPath = path18.join(dir, ...segments);
21032
+ const entryPath = path19.join(dir, ...segments);
20873
21033
  const file = resolveLinkedDestination(entryPath);
20874
21034
  try {
20875
21035
  fs17.rmSync(file);
@@ -20879,7 +21039,7 @@ function removeRetiredFiles(targetDir, files) {
20879
21039
  continue;
20880
21040
  }
20881
21041
  for (let depth = segments.length - 1; depth > 0; depth--) {
20882
- if (!rmEmptyDir(path18.join(dir, ...segments.slice(0, depth)))) break;
21042
+ if (!rmEmptyDir(path19.join(dir, ...segments.slice(0, depth)))) break;
20883
21043
  }
20884
21044
  }
20885
21045
  const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
@@ -20894,7 +21054,7 @@ function dirExists(p) {
20894
21054
  }
20895
21055
  function getInstalledVersion() {
20896
21056
  try {
20897
- const pkgPath = path18.join(PACKAGE_ROOT, "package.json");
21057
+ const pkgPath = path19.join(PACKAGE_ROOT, "package.json");
20898
21058
  const pkg = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
20899
21059
  return pkg.version ?? null;
20900
21060
  } catch {
@@ -20905,7 +21065,7 @@ var PROBE_TIMEOUT_MS = 3e3;
20905
21065
  function getLatestVersion() {
20906
21066
  const args = ["view", PACKAGE_NAME, "version", "--registry", NPM_REGISTRY];
20907
21067
  const opts = { encoding: "utf8", timeout: PROBE_TIMEOUT_MS };
20908
- const result = process.platform === "win32" ? execSync(["npm", ...args].join(" "), opts) : execFileSync3("npm", args, opts);
21068
+ const result = process.platform === "win32" ? execSync(["npm", ...args].join(" "), opts) : execFileSync4("npm", args, opts);
20909
21069
  return result.trim();
20910
21070
  }
20911
21071
  function isNewerVersion(candidate, current) {
@@ -20940,12 +21100,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
20940
21100
  } catch {
20941
21101
  return false;
20942
21102
  }
20943
- return new Promise((resolve21) => {
20944
- const timer = setTimeout(() => resolve21(false), timeoutMs);
21103
+ return new Promise((resolve22) => {
21104
+ const timer = setTimeout(() => resolve22(false), timeoutMs);
20945
21105
  timer.unref();
20946
21106
  dns.lookup(host, (err) => {
20947
21107
  clearTimeout(timer);
20948
- resolve21(!err);
21108
+ resolve22(!err);
20949
21109
  });
20950
21110
  });
20951
21111
  }
@@ -20962,9 +21122,9 @@ function escapeStringRegexp(string) {
20962
21122
  }
20963
21123
 
20964
21124
  // ../argent-installer/src/mcp-configs.ts
20965
- var TOOL_SERVER_BUNDLE = path19.join(import.meta.dirname, "tool-server.cjs");
21125
+ var TOOL_SERVER_BUNDLE = path20.join(import.meta.dirname, "tool-server.cjs");
20966
21126
  function getAvailableToolIds() {
20967
- const out = execFileSync4("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
21127
+ const out = execFileSync5("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
20968
21128
  const tools = JSON.parse(out);
20969
21129
  return tools.map((t2) => t2.id);
20970
21130
  }
@@ -21066,7 +21226,7 @@ function isArgentManagedEntry(entry) {
21066
21226
  return args.length === 1 && args[0] === "mcp";
21067
21227
  case "node": {
21068
21228
  if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
21069
- if (path19.isAbsolute(args[0])) return false;
21229
+ if (path20.isAbsolute(args[0])) return false;
21070
21230
  const normalized = args[0].split("\\").join("/");
21071
21231
  return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
21072
21232
  }
@@ -21080,12 +21240,12 @@ function isArgentManagedEntry(entry) {
21080
21240
  }
21081
21241
  function isPinnedGlobalEntry(entry) {
21082
21242
  const [cli, subcommand] = entry.args;
21083
- return path19.isAbsolute(entry.command) && path19.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path19.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
21243
+ return path20.isAbsolute(entry.command) && path20.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path20.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
21084
21244
  }
21085
21245
  function writeTomlOrRemove(filePath, data) {
21086
21246
  if (Object.keys(data).length === 0) {
21087
21247
  fs18.rmSync(filePath, { force: true });
21088
- removeDirIfEmpty(path19.dirname(filePath));
21248
+ removeDirIfEmpty(path20.dirname(filePath));
21089
21249
  return;
21090
21250
  }
21091
21251
  writeToml(filePath, data);
@@ -21171,7 +21331,7 @@ function cursorDirLooksArgentOnly(dir) {
21171
21331
  }
21172
21332
  if (entries.length === 0) return false;
21173
21333
  return entries.every((entry) => {
21174
- const full = path19.join(dir, entry);
21334
+ const full = path20.join(dir, entry);
21175
21335
  if (entry === "mcp.json") {
21176
21336
  return jsonLooksArgentServerOnly(full, "mcpServers");
21177
21337
  }
@@ -21210,7 +21370,7 @@ function claudeDirLooksArgentOnly(dir) {
21210
21370
  }
21211
21371
  if (entries.length === 0) return false;
21212
21372
  return entries.every((entry) => {
21213
- const full = path19.join(dir, entry);
21373
+ const full = path20.join(dir, entry);
21214
21374
  if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
21215
21375
  if (entry === "rules" || entry === "agents" || entry === "skills") {
21216
21376
  return managedDirLooksArgentOnly(full, entry);
@@ -21227,7 +21387,7 @@ function vscodeDirLooksArgentOnly(dir) {
21227
21387
  }
21228
21388
  if (entries.length === 0) return false;
21229
21389
  return entries.every(
21230
- (entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "servers")
21390
+ (entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path20.join(dir, entry), "servers")
21231
21391
  );
21232
21392
  }
21233
21393
  function windsurfDirLooksArgentOnly(dir) {
@@ -21239,7 +21399,7 @@ function windsurfDirLooksArgentOnly(dir) {
21239
21399
  }
21240
21400
  if (entries.length === 0) return false;
21241
21401
  return entries.every(
21242
- (entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "mcpServers")
21402
+ (entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path20.join(dir, entry), "mcpServers")
21243
21403
  );
21244
21404
  }
21245
21405
  function zedSettingsLooksArgentOnly(filePath) {
@@ -21276,7 +21436,7 @@ function zedDirLooksArgentOnly(dir) {
21276
21436
  }
21277
21437
  if (entries.length === 0) return false;
21278
21438
  return entries.every(
21279
- (entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path19.join(dir, entry))
21439
+ (entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path20.join(dir, entry))
21280
21440
  );
21281
21441
  }
21282
21442
  function geminiDirLooksArgentOnly(dir) {
@@ -21288,7 +21448,7 @@ function geminiDirLooksArgentOnly(dir) {
21288
21448
  }
21289
21449
  if (entries.length === 0) return false;
21290
21450
  return entries.every((entry) => {
21291
- const full = path19.join(dir, entry);
21451
+ const full = path20.join(dir, entry);
21292
21452
  if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
21293
21453
  if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
21294
21454
  return false;
@@ -21313,7 +21473,7 @@ function hermesDirLooksArgentOnly(dir) {
21313
21473
  }
21314
21474
  if (entries.length === 0) return false;
21315
21475
  return entries.every(
21316
- (entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path19.join(dir, entry))
21476
+ (entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path20.join(dir, entry))
21317
21477
  );
21318
21478
  }
21319
21479
  function kiroDirLooksArgentOnly(dir) {
@@ -21326,7 +21486,7 @@ function kiroDirLooksArgentOnly(dir) {
21326
21486
  if (entries.length === 0) return false;
21327
21487
  return entries.every((entry) => {
21328
21488
  if (entry !== "settings") return false;
21329
- const settingsDir = path19.join(dir, entry);
21489
+ const settingsDir = path20.join(dir, entry);
21330
21490
  let settingsEntries;
21331
21491
  try {
21332
21492
  settingsEntries = fs18.readdirSync(settingsDir);
@@ -21335,7 +21495,7 @@ function kiroDirLooksArgentOnly(dir) {
21335
21495
  }
21336
21496
  if (settingsEntries.length === 0) return false;
21337
21497
  return settingsEntries.every(
21338
- (name) => name === "mcp.json" && jsonLooksArgentServerOnly(path19.join(settingsDir, name), "mcpServers")
21498
+ (name) => name === "mcp.json" && jsonLooksArgentServerOnly(path20.join(settingsDir, name), "mcpServers")
21339
21499
  );
21340
21500
  });
21341
21501
  }
@@ -21348,7 +21508,7 @@ function codexDirLooksArgentOnly(dir) {
21348
21508
  }
21349
21509
  if (entries.length === 0) return false;
21350
21510
  return entries.every((entry) => {
21351
- const full = path19.join(dir, entry);
21511
+ const full = path20.join(dir, entry);
21352
21512
  if (entry === "config.toml") {
21353
21513
  const config = parseTomlStrict(full);
21354
21514
  if (config === null) return false;
@@ -21373,7 +21533,7 @@ function codexDirLooksArgentOnly(dir) {
21373
21533
  });
21374
21534
  }
21375
21535
  function cursorPermissionsPath() {
21376
- return path19.join(homedir5(), ".cursor", "permissions.json");
21536
+ return path20.join(homedir4(), ".cursor", "permissions.json");
21377
21537
  }
21378
21538
  function cursorPermissionsList() {
21379
21539
  const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
@@ -21382,13 +21542,13 @@ function cursorPermissionsList() {
21382
21542
  var cursorAdapter = {
21383
21543
  name: "Cursor",
21384
21544
  detect() {
21385
- return dirHasEditorEvidence(path19.join(homedir5(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
21545
+ return dirHasEditorEvidence(path20.join(homedir4(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
21386
21546
  },
21387
21547
  projectPath(root) {
21388
- return path19.join(root, ".cursor", "mcp.json");
21548
+ return path20.join(root, ".cursor", "mcp.json");
21389
21549
  },
21390
21550
  globalPath() {
21391
- return path19.join(homedir5(), ".cursor", "mcp.json");
21551
+ return path20.join(homedir4(), ".cursor", "mcp.json");
21392
21552
  },
21393
21553
  // Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
21394
21554
  // text edits that preserve user comments and foreign servers.
@@ -21474,13 +21634,13 @@ var claudeAdapter = {
21474
21634
  name: "Claude Code",
21475
21635
  detect() {
21476
21636
  const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
21477
- return fileHasEditorEvidence(path19.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path19.join(homedir5(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(homedir5(), ".claude"), claudeDirLooksArgentOnly);
21637
+ return fileHasEditorEvidence(path20.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path20.join(homedir4(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(homedir4(), ".claude"), claudeDirLooksArgentOnly);
21478
21638
  },
21479
21639
  projectPath(root) {
21480
- return path19.join(root, ".mcp.json");
21640
+ return path20.join(root, ".mcp.json");
21481
21641
  },
21482
21642
  globalPath() {
21483
- return path19.join(homedir5(), ".claude.json");
21643
+ return path20.join(homedir4(), ".claude.json");
21484
21644
  },
21485
21645
  // JSONC is a superset of JSON, so this config shares the one comment- and
21486
21646
  // foreign-server-preserving write path (see the Cursor adapter).
@@ -21520,7 +21680,7 @@ var claudeAdapter = {
21520
21680
  // .mcp.json rejections (see claudeDisabledListFinding).
21521
21681
  findShadowingConfigs(root, writtenScope) {
21522
21682
  const findings = [];
21523
- const claudeJsonPath = path19.join(homedir5(), ".claude.json");
21683
+ const claudeJsonPath = path20.join(homedir4(), ".claude.json");
21524
21684
  const projects = readJson(claudeJsonPath).projects;
21525
21685
  if (isRecord(projects)) {
21526
21686
  for (const key of claudeProjectKeysForRoot(projects, root)) {
@@ -21557,9 +21717,9 @@ var claudeAdapter = {
21557
21717
  }
21558
21718
  if (writtenScope === "local") {
21559
21719
  const candidates = [
21560
- [path19.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
21561
- [path19.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
21562
- [path19.join(homedir5(), ".claude", "settings.json"), "~/.claude/settings.json", false]
21720
+ [path20.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
21721
+ [path20.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
21722
+ [path20.join(homedir4(), ".claude", "settings.json"), "~/.claude/settings.json", false]
21563
21723
  ];
21564
21724
  for (const [settingsPath, label, projectConfined] of candidates) {
21565
21725
  const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
@@ -21578,10 +21738,10 @@ var claudeAdapter = {
21578
21738
  var vscodeAdapter = {
21579
21739
  name: "VS Code",
21580
21740
  detect() {
21581
- return dirHasEditorEvidence(path19.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path19.join(homedir5(), ".vscode"));
21741
+ return dirHasEditorEvidence(path20.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path20.join(homedir4(), ".vscode"));
21582
21742
  },
21583
21743
  projectPath(root) {
21584
- return path19.join(root, ".vscode", "mcp.json");
21744
+ return path20.join(root, ".vscode", "mcp.json");
21585
21745
  },
21586
21746
  globalPath() {
21587
21747
  return null;
@@ -21618,7 +21778,7 @@ var vscodeAdapter = {
21618
21778
  findShadowingConfigs(_root, _writtenScope) {
21619
21779
  const findings = [];
21620
21780
  for (const userDir of vscodeUserDirs()) {
21621
- const configPath = path19.join(userDir, "mcp.json");
21781
+ const configPath = path20.join(userDir, "mcp.json");
21622
21782
  const entry = this.getArgentEntry(configPath);
21623
21783
  if (!entry) continue;
21624
21784
  findings.push({
@@ -21635,16 +21795,16 @@ var vscodeAdapter = {
21635
21795
  function vscodeUserDirs() {
21636
21796
  const bases = [];
21637
21797
  if (process.platform === "darwin") {
21638
- bases.push(path19.join(homedir5(), "Library", "Application Support"));
21798
+ bases.push(path20.join(homedir4(), "Library", "Application Support"));
21639
21799
  } else if (process.platform === "win32") {
21640
21800
  if (process.env.APPDATA) bases.push(process.env.APPDATA);
21641
21801
  } else {
21642
- bases.push(path19.join(homedir5(), ".config"));
21802
+ bases.push(path20.join(homedir4(), ".config"));
21643
21803
  }
21644
21804
  const dirs = [];
21645
21805
  for (const base of bases) {
21646
21806
  for (const product of ["Code", "Code - Insiders"]) {
21647
- const dir = path19.join(base, product, "User");
21807
+ const dir = path20.join(base, product, "User");
21648
21808
  if (dirExists(dir)) dirs.push(dir);
21649
21809
  }
21650
21810
  }
@@ -21652,18 +21812,18 @@ function vscodeUserDirs() {
21652
21812
  }
21653
21813
  function devinUserConfigPath() {
21654
21814
  if (process.platform === "win32") {
21655
- const appData = process.env.APPDATA || path19.join(homedir5(), "AppData", "Roaming");
21656
- return path19.join(appData, "devin", "config.json");
21815
+ const appData = process.env.APPDATA || path20.join(homedir4(), "AppData", "Roaming");
21816
+ return path20.join(appData, "devin", "config.json");
21657
21817
  }
21658
21818
  const xdg = process.env.XDG_CONFIG_HOME;
21659
- return path19.join(xdg || path19.join(homedir5(), ".config"), "devin", "config.json");
21819
+ return path20.join(xdg || path20.join(homedir4(), ".config"), "devin", "config.json");
21660
21820
  }
21661
21821
  var windsurfAdapter = {
21662
21822
  name: "Devin Desktop",
21663
21823
  telemetryName: "windsurf",
21664
21824
  detect() {
21665
21825
  return dirHasEditorEvidence(
21666
- path19.join(homedir5(), ".codeium", "windsurf"),
21826
+ path20.join(homedir4(), ".codeium", "windsurf"),
21667
21827
  windsurfDirLooksArgentOnly
21668
21828
  );
21669
21829
  },
@@ -21671,7 +21831,7 @@ var windsurfAdapter = {
21671
21831
  return null;
21672
21832
  },
21673
21833
  globalPath() {
21674
- return path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
21834
+ return path20.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21675
21835
  },
21676
21836
  // JSONC-safe writes (see the Cursor adapter).
21677
21837
  write(configPath, entry) {
@@ -21703,7 +21863,7 @@ var windsurfAdapter = {
21703
21863
  // servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
21704
21864
  // agent needs its own permission rule.
21705
21865
  addAllowlist() {
21706
- const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
21866
+ const configPath = path20.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21707
21867
  const config = readJsonc(configPath);
21708
21868
  const servers = config.mcpServers;
21709
21869
  if (!servers?.[MCP_SERVER_KEY]) return;
@@ -21713,7 +21873,7 @@ var windsurfAdapter = {
21713
21873
  removeAllowlist(_root, scope) {
21714
21874
  if (scope !== "global") return;
21715
21875
  removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
21716
- const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
21876
+ const configPath = path20.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21717
21877
  if (!fs18.existsSync(configPath)) return;
21718
21878
  const config = readJsonc(configPath);
21719
21879
  const servers = config.mcpServers;
@@ -21725,13 +21885,13 @@ var windsurfAdapter = {
21725
21885
  var zedAdapter = {
21726
21886
  name: "Zed",
21727
21887
  detect() {
21728
- return dirHasEditorEvidence(path19.join(homedir5(), ".config", "zed"), zedDirLooksArgentOnly);
21888
+ return dirHasEditorEvidence(path20.join(homedir4(), ".config", "zed"), zedDirLooksArgentOnly);
21729
21889
  },
21730
21890
  projectPath(root) {
21731
- return path19.join(root, ".zed", "settings.json");
21891
+ return path20.join(root, ".zed", "settings.json");
21732
21892
  },
21733
21893
  globalPath() {
21734
- return path19.join(homedir5(), ".config", "zed", "settings.json");
21894
+ return path20.join(homedir4(), ".config", "zed", "settings.json");
21735
21895
  },
21736
21896
  // Read and written as JSONC through readJsonc / editJsoncFile so comments and
21737
21897
  // formatting outside the touched key survive (see the Cursor adapter).
@@ -21763,11 +21923,11 @@ var zedAdapter = {
21763
21923
  // Zed has no server-level wildcard for MCP tools — each tool would need its
21764
21924
  // own entry — so the global default is set to "allow" instead.
21765
21925
  addAllowlist(root, scope) {
21766
- const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
21926
+ const settingsPath = scope === "global" ? path20.join(homedir4(), ".config", "zed", "settings.json") : path20.join(root, ".zed", "settings.json");
21767
21927
  editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
21768
21928
  },
21769
21929
  removeAllowlist(root, scope) {
21770
- const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
21930
+ const settingsPath = scope === "global" ? path20.join(homedir4(), ".config", "zed", "settings.json") : path20.join(root, ".zed", "settings.json");
21771
21931
  if (!fs18.existsSync(settingsPath)) return;
21772
21932
  const config = readJsonc(settingsPath);
21773
21933
  const perms = config.agent?.tool_permissions;
@@ -21778,13 +21938,13 @@ var zedAdapter = {
21778
21938
  var geminiAdapter = {
21779
21939
  name: "Gemini",
21780
21940
  detect() {
21781
- return dirHasEditorEvidence(path19.join(homedir5(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
21941
+ return dirHasEditorEvidence(path20.join(homedir4(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
21782
21942
  },
21783
21943
  projectPath(root) {
21784
- return path19.join(root, ".gemini", "settings.json");
21944
+ return path20.join(root, ".gemini", "settings.json");
21785
21945
  },
21786
21946
  globalPath() {
21787
- return path19.join(homedir5(), ".gemini", "settings.json");
21947
+ return path20.join(homedir4(), ".gemini", "settings.json");
21788
21948
  },
21789
21949
  // JSONC-safe writes (see the Cursor adapter).
21790
21950
  write(configPath, entry) {
@@ -21840,13 +22000,13 @@ var CODEX_FILENAME = ".codex";
21840
22000
  var codexAdapter = {
21841
22001
  name: "Codex",
21842
22002
  detect() {
21843
- return dirHasEditorEvidence(path19.join(homedir5(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
22003
+ return dirHasEditorEvidence(path20.join(homedir4(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
21844
22004
  },
21845
22005
  projectPath(root) {
21846
- return path19.join(root, CODEX_FILENAME, "config.toml");
22006
+ return path20.join(root, CODEX_FILENAME, "config.toml");
21847
22007
  },
21848
22008
  globalPath() {
21849
- return path19.join(homedir5(), CODEX_FILENAME, "config.toml");
22009
+ return path20.join(homedir4(), CODEX_FILENAME, "config.toml");
21850
22010
  },
21851
22011
  write(configPath, entry) {
21852
22012
  const config = readToml(configPath);
@@ -21941,13 +22101,13 @@ var codexAdapter = {
21941
22101
  var hermesAdapter = {
21942
22102
  name: "Hermes",
21943
22103
  detect() {
21944
- return dirHasEditorEvidence(path19.join(homedir5(), ".hermes"), hermesDirLooksArgentOnly);
22104
+ return dirHasEditorEvidence(path20.join(homedir4(), ".hermes"), hermesDirLooksArgentOnly);
21945
22105
  },
21946
22106
  projectPath() {
21947
22107
  return null;
21948
22108
  },
21949
22109
  globalPath() {
21950
- return path19.join(homedir5(), ".hermes", "config.yaml");
22110
+ return path20.join(homedir4(), ".hermes", "config.yaml");
21951
22111
  },
21952
22112
  write(configPath, entry) {
21953
22113
  const doc = readYaml(configPath);
@@ -21998,7 +22158,7 @@ var OPENCODE_GLOBAL_FILES = ["opencode.jsonc", "opencode.json", "config.json"];
21998
22158
  function hasOpenCodeBinary() {
21999
22159
  try {
22000
22160
  const cmd = process.platform === "win32" ? "where" : "which";
22001
- execFileSync4(cmd, [OPENCODE_BINARY], { stdio: ["ignore", "ignore", "ignore"] });
22161
+ execFileSync5(cmd, [OPENCODE_BINARY], { stdio: ["ignore", "ignore", "ignore"] });
22002
22162
  return true;
22003
22163
  } catch {
22004
22164
  return false;
@@ -22006,10 +22166,10 @@ function hasOpenCodeBinary() {
22006
22166
  }
22007
22167
  function pickOpencodeConfig(dir, candidates) {
22008
22168
  for (const name of candidates) {
22009
- const candidate = path19.join(dir, name);
22169
+ const candidate = path20.join(dir, name);
22010
22170
  if (fs18.existsSync(candidate)) return candidate;
22011
22171
  }
22012
- return path19.join(dir, "opencode.json");
22172
+ return path20.join(dir, "opencode.json");
22013
22173
  }
22014
22174
  var openCodeAdapter = {
22015
22175
  name: "opencode",
@@ -22020,7 +22180,7 @@ var openCodeAdapter = {
22020
22180
  return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
22021
22181
  },
22022
22182
  globalPath() {
22023
- return pickOpencodeConfig(path19.join(homedir5(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
22183
+ return pickOpencodeConfig(path20.join(homedir4(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
22024
22184
  },
22025
22185
  write(configPath, entry) {
22026
22186
  editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
@@ -22065,13 +22225,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
22065
22225
  var kiroAdapter = {
22066
22226
  name: "Kiro",
22067
22227
  detect() {
22068
- return dirHasEditorEvidence(path19.join(homedir5(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
22228
+ return dirHasEditorEvidence(path20.join(homedir4(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
22069
22229
  },
22070
22230
  projectPath(root) {
22071
- return path19.join(root, ".kiro", "settings", "mcp.json");
22231
+ return path20.join(root, ".kiro", "settings", "mcp.json");
22072
22232
  },
22073
22233
  globalPath() {
22074
- return path19.join(homedir5(), ".kiro", "settings", "mcp.json");
22234
+ return path20.join(homedir4(), ".kiro", "settings", "mcp.json");
22075
22235
  },
22076
22236
  // Read and written as JSONC through readJsonc / editJsoncFile so comments and
22077
22237
  // foreign servers survive (see the Cursor adapter).
@@ -22178,7 +22338,7 @@ function removeAllowRule(settingsPath, rule) {
22178
22338
  editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
22179
22339
  }
22180
22340
  function claudeSettingsPath(root, scope) {
22181
- return scope === "global" ? path19.join(homedir5(), ".claude", "settings.json") : path19.join(root, ".claude", "settings.json");
22341
+ return scope === "global" ? path20.join(homedir4(), ".claude", "settings.json") : path20.join(root, ".claude", "settings.json");
22182
22342
  }
22183
22343
  function addClaudePermission(root, scope) {
22184
22344
  addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
@@ -22191,13 +22351,13 @@ function formatCopyDestination(target, writtenPath, root) {
22191
22351
  return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
22192
22352
  }
22193
22353
  function formatManagedPathLabel(targetPath, root) {
22194
- for (const home of [path19.resolve(homedir5()), canonicalPath(homedir5())]) {
22195
- if (targetPath === home || targetPath.startsWith(`${home}${path19.sep}`)) {
22354
+ for (const home of [path20.resolve(homedir4()), canonicalPath(homedir4())]) {
22355
+ if (targetPath === home || targetPath.startsWith(`${home}${path20.sep}`)) {
22196
22356
  return `~${targetPath.slice(home.length)}`;
22197
22357
  }
22198
22358
  }
22199
- const relative5 = path19.relative(root, targetPath);
22200
- if (relative5 && !relative5.startsWith("..") && !path19.isAbsolute(relative5)) {
22359
+ const relative5 = path20.relative(root, targetPath);
22360
+ if (relative5 && !relative5.startsWith("..") && !path20.isAbsolute(relative5)) {
22201
22361
  return relative5;
22202
22362
  }
22203
22363
  return targetPath;
@@ -22211,7 +22371,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
22211
22371
  }
22212
22372
  function getAdapterBasePath(adapter, root, scope) {
22213
22373
  const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
22214
- return configPath ? path19.dirname(configPath) : null;
22374
+ return configPath ? path20.dirname(configPath) : null;
22215
22375
  }
22216
22376
  function getManagedContentTargets(adapters, root, scope) {
22217
22377
  const targets = {
@@ -22221,17 +22381,17 @@ function getManagedContentTargets(adapters, root, scope) {
22221
22381
  codexConfigTargets: [],
22222
22382
  skillsLockTargets: []
22223
22383
  };
22224
- const workspaceBase = scope === "global" ? homedir5() : root;
22384
+ const workspaceBase = scope === "global" ? homedir4() : root;
22225
22385
  addManagedTarget(
22226
22386
  targets.skillTargets,
22227
22387
  "skills",
22228
- path19.join(workspaceBase, ".agents", "skills"),
22388
+ path20.join(workspaceBase, ".agents", "skills"),
22229
22389
  root
22230
22390
  );
22231
22391
  addManagedTarget(
22232
22392
  targets.skillsLockTargets,
22233
22393
  "skills",
22234
- path19.join(workspaceBase, "skills-lock.json"),
22394
+ path20.join(workspaceBase, "skills-lock.json"),
22235
22395
  root
22236
22396
  );
22237
22397
  for (const adapter of adapters) {
@@ -22239,21 +22399,21 @@ function getManagedContentTargets(adapters, root, scope) {
22239
22399
  case "Cursor": {
22240
22400
  const base = getAdapterBasePath(adapter, root, scope);
22241
22401
  if (!base) break;
22242
- addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
22243
- addManagedTarget(targets.ruleTargets, adapter.name, path19.join(base, "rules"), root);
22402
+ addManagedTarget(targets.skillTargets, adapter.name, path20.join(base, "skills"), root);
22403
+ addManagedTarget(targets.ruleTargets, adapter.name, path20.join(base, "rules"), root);
22244
22404
  break;
22245
22405
  }
22246
22406
  case "Claude Code": {
22247
- const claudeBase = scope === "global" ? path19.join(homedir5(), ".claude") : path19.join(root, ".claude");
22248
- addManagedTarget(targets.skillTargets, adapter.name, path19.join(claudeBase, "skills"), root);
22249
- addManagedTarget(targets.ruleTargets, adapter.name, path19.join(claudeBase, "rules"), root);
22250
- addManagedTarget(targets.agentTargets, adapter.name, path19.join(claudeBase, "agents"), root);
22407
+ const claudeBase = scope === "global" ? path20.join(homedir4(), ".claude") : path20.join(root, ".claude");
22408
+ addManagedTarget(targets.skillTargets, adapter.name, path20.join(claudeBase, "skills"), root);
22409
+ addManagedTarget(targets.ruleTargets, adapter.name, path20.join(claudeBase, "rules"), root);
22410
+ addManagedTarget(targets.agentTargets, adapter.name, path20.join(claudeBase, "agents"), root);
22251
22411
  break;
22252
22412
  }
22253
22413
  case "Gemini": {
22254
- const geminiBase = scope === "global" ? path19.join(homedir5(), ".gemini") : path19.join(root, ".gemini");
22255
- addManagedTarget(targets.ruleTargets, adapter.name, path19.join(geminiBase, "rules"), root);
22256
- addManagedTarget(targets.agentTargets, adapter.name, path19.join(geminiBase, "agents"), root);
22414
+ const geminiBase = scope === "global" ? path20.join(homedir4(), ".gemini") : path20.join(root, ".gemini");
22415
+ addManagedTarget(targets.ruleTargets, adapter.name, path20.join(geminiBase, "rules"), root);
22416
+ addManagedTarget(targets.agentTargets, adapter.name, path20.join(geminiBase, "agents"), root);
22257
22417
  break;
22258
22418
  }
22259
22419
  case "Codex": {
@@ -22263,19 +22423,19 @@ function getManagedContentTargets(adapters, root, scope) {
22263
22423
  break;
22264
22424
  }
22265
22425
  case "opencode": {
22266
- const base = scope === "global" ? path19.join(homedir5(), ".config", "opencode") : path19.join(root, ".opencode");
22267
- addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
22268
- addManagedTarget(targets.agentTargets, adapter.name, path19.join(base, "agents"), root);
22426
+ const base = scope === "global" ? path20.join(homedir4(), ".config", "opencode") : path20.join(root, ".opencode");
22427
+ addManagedTarget(targets.skillTargets, adapter.name, path20.join(base, "skills"), root);
22428
+ addManagedTarget(targets.agentTargets, adapter.name, path20.join(base, "agents"), root);
22269
22429
  break;
22270
22430
  }
22271
22431
  case "Kiro": {
22272
- const kiroBase = scope === "global" ? path19.join(homedir5(), ".kiro") : path19.join(root, ".kiro");
22273
- addManagedTarget(targets.skillTargets, adapter.name, path19.join(kiroBase, "skills"), root);
22432
+ const kiroBase = scope === "global" ? path20.join(homedir4(), ".kiro") : path20.join(root, ".kiro");
22433
+ addManagedTarget(targets.skillTargets, adapter.name, path20.join(kiroBase, "skills"), root);
22274
22434
  break;
22275
22435
  }
22276
22436
  case "Devin Desktop": {
22277
- const devinBase = scope === "global" ? path19.join(process.env.XDG_CONFIG_HOME || path19.join(homedir5(), ".config"), "devin") : path19.join(root, ".devin");
22278
- addManagedTarget(targets.skillTargets, adapter.name, path19.join(devinBase, "skills"), root);
22437
+ const devinBase = scope === "global" ? path20.join(process.env.XDG_CONFIG_HOME || path20.join(homedir4(), ".config"), "devin") : path20.join(root, ".devin");
22438
+ addManagedTarget(targets.skillTargets, adapter.name, path20.join(devinBase, "skills"), root);
22279
22439
  break;
22280
22440
  }
22281
22441
  }
@@ -22294,7 +22454,7 @@ function readAndConcatRules(rulesDir) {
22294
22454
  if (files.length === 0) return null;
22295
22455
  const parts = [];
22296
22456
  for (const file of files) {
22297
- const raw = fs18.readFileSync(path19.join(rulesDir, file), "utf8");
22457
+ const raw = fs18.readFileSync(path20.join(rulesDir, file), "utf8");
22298
22458
  const stripped = stripFrontmatter(raw);
22299
22459
  if (stripped) parts.push(stripped);
22300
22460
  }
@@ -22421,10 +22581,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
22421
22581
  }
22422
22582
 
22423
22583
  // ../argent-installer/src/retired-files.ts
22424
- import * as path20 from "node:path";
22584
+ import * as path21 from "node:path";
22425
22585
  var import_picocolors = __toESM(require_picocolors(), 1);
22426
22586
  function displayPath(entry, file) {
22427
- return path20.join(entry.location, ...file.relativePath.split("/"));
22587
+ return path21.join(entry.location, ...file.relativePath.split("/"));
22428
22588
  }
22429
22589
  async function cleanupRetiredFiles(found, options) {
22430
22590
  const result = { removed: [], declined: [], failed: [], removedRoots: [] };
@@ -22476,9 +22636,9 @@ async function reportRetiredFiles(found, interactive) {
22476
22636
  // ../argent-installer/src/cli-record.ts
22477
22637
  var import_semver4 = __toESM(require_semver2(), 1);
22478
22638
  import * as fs19 from "node:fs";
22479
- import * as path21 from "node:path";
22639
+ import * as path22 from "node:path";
22480
22640
  function cliRecordPath() {
22481
- return path21.join(argentHomeDir(), "cli.json");
22641
+ return path22.join(argentHomeDir(), "cli.json");
22482
22642
  }
22483
22643
  function readCliRecord() {
22484
22644
  try {
@@ -22492,7 +22652,7 @@ function readCliRecord() {
22492
22652
  function resolveCliEntry(mode, projectRoot) {
22493
22653
  if (mode === "local") {
22494
22654
  const relative5 = getLocalArgentBinRelPath(projectRoot);
22495
- return relative5 ? path21.resolve(projectRoot, relative5) : null;
22655
+ return relative5 ? path22.resolve(projectRoot, relative5) : null;
22496
22656
  }
22497
22657
  const packageRoot = getGloballyInstalledPackageRoot();
22498
22658
  return packageRoot ? cliPathOf(packageRoot) : null;
@@ -22511,7 +22671,7 @@ function writeCliRecord(input) {
22511
22671
  function persistCliRecord(record) {
22512
22672
  const file = cliRecordPath();
22513
22673
  try {
22514
- fs19.mkdirSync(path21.dirname(file), { recursive: true });
22674
+ fs19.mkdirSync(path22.dirname(file), { recursive: true });
22515
22675
  const temporary = `${file}.${process.pid}.tmp`;
22516
22676
  fs19.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
22517
22677
  fs19.renameSync(temporary, file);
@@ -22546,9 +22706,9 @@ function removeCliRecordFor(installDir) {
22546
22706
  if (!installDir) return false;
22547
22707
  const record = readCliRecord();
22548
22708
  if (!record) return false;
22549
- const root = path21.resolve(installDir);
22550
- const relative5 = path21.relative(root, path21.resolve(record.cli));
22551
- if (relative5.startsWith("..") || path21.isAbsolute(relative5)) return false;
22709
+ const root = path22.resolve(installDir);
22710
+ const relative5 = path22.relative(root, path22.resolve(record.cli));
22711
+ if (relative5.startsWith("..") || path22.isAbsolute(relative5)) return false;
22552
22712
  try {
22553
22713
  fs19.rmSync(cliRecordPath(), { force: true });
22554
22714
  return true;
@@ -22573,7 +22733,7 @@ function printFirstRunNotice() {
22573
22733
  markFirstRunNoticeShown();
22574
22734
  }
22575
22735
  function seedWhatsNewVersion(version) {
22576
- if (getWhatsNewSeenVersion() === null) setWhatsNewSeenVersion(version);
22736
+ if (getWhatsNewSeenVersion() === null) setWhatsNewSeenVersion(version, { ifSeen: null });
22577
22737
  }
22578
22738
  async function resolveTelemetryConsent(opts) {
22579
22739
  if (opts.disableFlag) {
@@ -22586,9 +22746,11 @@ async function resolveTelemetryConsent(opts) {
22586
22746
  printFirstRunNotice();
22587
22747
  return { kind: "skipped" };
22588
22748
  }
22589
- const source = getConsentState().source.source;
22749
+ const state2 = getConsentState();
22750
+ const source = state2.source.source;
22590
22751
  const envOwnsDecision = source === "env_do_not_track" || source === "env_argent_telemetry";
22591
- if (envOwnsDecision || hasShownFirstRunNotice()) {
22752
+ const configOptedOut = source === "config_file" && !state2.enabled;
22753
+ if (envOwnsDecision || configOptedOut || hasShownFirstRunNotice()) {
22592
22754
  return { kind: "skipped" };
22593
22755
  }
22594
22756
  log.info(
@@ -22775,10 +22937,10 @@ async function promptInstallMode(defaultMode = "global") {
22775
22937
  // ../argent-installer/src/install-runner.ts
22776
22938
  var import_picocolors4 = __toESM(require_picocolors(), 1);
22777
22939
  import * as fs22 from "node:fs";
22778
- import * as path24 from "node:path";
22940
+ import * as path25 from "node:path";
22779
22941
 
22780
22942
  // ../argent-installer/src/shell.ts
22781
- import { execFileSync as execFileSync5, spawn as spawn2 } from "node:child_process";
22943
+ import { execFileSync as execFileSync6, spawn as spawn2 } from "node:child_process";
22782
22944
  async function runTrustingDisk(execute, landedOnDisk) {
22783
22945
  let exitError = null;
22784
22946
  try {
@@ -22789,7 +22951,7 @@ async function runTrustingDisk(execute, landedOnDisk) {
22789
22951
  return { landed: landedOnDisk(), exitError };
22790
22952
  }
22791
22953
  function execShellCommandSync(cmd, opts = {}) {
22792
- execFileSync5(cmd.bin, cmd.args, {
22954
+ execFileSync6(cmd.bin, cmd.args, {
22793
22955
  stdio: "inherit",
22794
22956
  shell: process.platform === "win32",
22795
22957
  ...opts.cwd ? { cwd: opts.cwd } : {},
@@ -22807,7 +22969,7 @@ var ShellCommandError = class extends Error {
22807
22969
  signal;
22808
22970
  };
22809
22971
  function runShellCommand(cmd, opts = {}) {
22810
- return new Promise((resolve21, reject) => {
22972
+ return new Promise((resolve22, reject) => {
22811
22973
  const child = spawn2(cmd.bin, cmd.args, {
22812
22974
  stdio: ["ignore", "pipe", "pipe"],
22813
22975
  shell: process.platform === "win32",
@@ -22823,7 +22985,7 @@ function runShellCommand(cmd, opts = {}) {
22823
22985
  stderr += chunk.toString();
22824
22986
  });
22825
22987
  child.on("close", (code, signal) => {
22826
- if (code === 0) resolve21();
22988
+ if (code === 0) resolve22();
22827
22989
  else
22828
22990
  reject(
22829
22991
  new ShellCommandError(
@@ -22838,31 +23000,31 @@ function runShellCommand(cmd, opts = {}) {
22838
23000
  }
22839
23001
 
22840
23002
  // ../argent-installer/src/skills.ts
22841
- import { execFileSync as execFileSync7 } from "node:child_process";
23003
+ import { execFileSync as execFileSync8 } from "node:child_process";
22842
23004
  import * as fs21 from "node:fs";
22843
- import * as path23 from "node:path";
23005
+ import * as path24 from "node:path";
22844
23006
  var import_picocolors3 = __toESM(require_picocolors(), 1);
22845
23007
 
22846
23008
  // ../argent-installer/src/skills-runner.ts
22847
- import { execFileSync as execFileSync6 } from "node:child_process";
23009
+ import { execFileSync as execFileSync7 } from "node:child_process";
22848
23010
  import * as fs20 from "node:fs";
22849
- import * as path22 from "node:path";
23011
+ import * as path23 from "node:path";
22850
23012
  var WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
22851
23013
  function findOnPath(bin, env, platform) {
22852
23014
  const pathValue = env.PATH ?? env.Path ?? "";
22853
- const dirs = pathValue.split(path22.delimiter).filter((dir) => path22.isAbsolute(dir));
23015
+ const dirs = pathValue.split(path23.delimiter).filter((dir) => path23.isAbsolute(dir));
22854
23016
  if (platform === "win32") {
22855
23017
  const exts = (env.PATHEXT ?? WIN32_DEFAULT_PATHEXT).split(";").filter(Boolean);
22856
23018
  for (const dir of dirs) {
22857
23019
  for (const ext of exts) {
22858
- const candidate = path22.join(dir, bin + ext);
23020
+ const candidate = path23.join(dir, bin + ext);
22859
23021
  if (fs20.existsSync(candidate)) return candidate;
22860
23022
  }
22861
23023
  }
22862
23024
  return null;
22863
23025
  }
22864
23026
  for (const dir of dirs) {
22865
- const candidate = path22.join(dir, bin);
23027
+ const candidate = path23.join(dir, bin);
22866
23028
  try {
22867
23029
  if (!fs20.statSync(candidate).isFile()) continue;
22868
23030
  fs20.accessSync(candidate, fs20.constants.X_OK);
@@ -22878,7 +23040,7 @@ function yarnSupportsDlx(bin, platform) {
22878
23040
  try {
22879
23041
  const probe = { kind: "yarn", bin, buildArgs: (args) => args, label: "yarn" };
22880
23042
  const command = skillsCommand(probe, ["--version"], platform);
22881
- const out = execFileSync6(command.file, command.args, {
23043
+ const out = execFileSync7(command.file, command.args, {
22882
23044
  stdio: ["ignore", "pipe", "ignore"],
22883
23045
  timeout: YARN_VERSION_TIMEOUT_MS,
22884
23046
  shell: command.shell,
@@ -22940,7 +23102,7 @@ function isSkillsCliCached(runner, cwd, platform = process.platform) {
22940
23102
  if (runner.kind !== "npx") return false;
22941
23103
  try {
22942
23104
  const command = skillsCommand(runner, ["--no-install", "skills", "--version"], platform);
22943
- execFileSync6(command.file, command.args, {
23105
+ execFileSync7(command.file, command.args, {
22944
23106
  env: npxChildEnv(),
22945
23107
  stdio: ["ignore", "ignore", "ignore"],
22946
23108
  timeout: OFFLINE_PROBE_TIMEOUT_MS,
@@ -22971,7 +23133,7 @@ function getScopeSpecs(projectRoot) {
22971
23133
  }
22972
23134
  ];
22973
23135
  }
22974
- function refreshArgentSkills(projectRoot) {
23136
+ function refreshArgentSkills(projectRoot, scopes = "all") {
22975
23137
  const bundled = new Set(listBundledSkills());
22976
23138
  if (bundled.size === 0) return [];
22977
23139
  const results = [];
@@ -22985,9 +23147,12 @@ function refreshArgentSkills(projectRoot) {
22985
23147
  const runSkills = (skillsArgs) => {
22986
23148
  if (!runner) throw new Error(NO_SKILLS_RUNNER_MESSAGE);
22987
23149
  const command = skillsCommand(runner, skillsArgs);
22988
- execFileSync7(command.file, command.args, { ...execOpts, shell: command.shell });
23150
+ execFileSync8(command.file, command.args, { ...execOpts, shell: command.shell });
22989
23151
  };
22990
- for (const spec of getScopeSpecs(projectRoot)) {
23152
+ const specs = getScopeSpecs(projectRoot).filter(
23153
+ (spec) => scopes === "all" || spec.scope === "global"
23154
+ );
23155
+ for (const spec of specs) {
22991
23156
  const tracked = listArgentSkillsInLock(spec.lockPath);
22992
23157
  if (tracked.length === 0) continue;
22993
23158
  const orphaned = tracked.filter((name) => !bundled.has(name) && ARGENT_SKILL_NAME.test(name));
@@ -23045,7 +23210,7 @@ function snapshotArgentSkills(projectRoot, scope, names) {
23045
23210
  }
23046
23211
  }
23047
23212
  for (const name of candidates) {
23048
- const stat6 = fs21.statSync(path23.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
23213
+ const stat6 = fs21.statSync(path24.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
23049
23214
  if (!stat6?.isFile()) continue;
23050
23215
  found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
23051
23216
  }
@@ -23063,7 +23228,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
23063
23228
  const removed = /* @__PURE__ */ new Set();
23064
23229
  for (const { targetPath } of skillTargets) {
23065
23230
  for (const name of legacy) {
23066
- const dir = path23.join(targetPath, name);
23231
+ const dir = path24.join(targetPath, name);
23067
23232
  try {
23068
23233
  if (removePath(dir)) removed.add(name);
23069
23234
  } catch {
@@ -23125,8 +23290,8 @@ function summarizeSkillRefreshForTelemetry(results) {
23125
23290
  failed_count: results.filter((result) => result.syncError || result.pruneError).length
23126
23291
  };
23127
23292
  }
23128
- function reportSkillRefresh(projectRoot, stage) {
23129
- const results = refreshArgentSkills(projectRoot);
23293
+ function reportSkillRefresh(projectRoot, stage, scopes = "all") {
23294
+ const results = refreshArgentSkills(projectRoot, scopes);
23130
23295
  if (results.some((r2) => r2.syncError === NO_SKILLS_RUNNER_MESSAGE)) {
23131
23296
  log.warn(noSkillsRunnerHelp("argent update"));
23132
23297
  }
@@ -23160,7 +23325,7 @@ async function runInstall(args) {
23160
23325
  return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
23161
23326
  }
23162
23327
  function installSpec(fromTar) {
23163
- return fs22.existsSync(fromTar) ? path24.resolve(fromTar) : fromTar;
23328
+ return fs22.existsSync(fromTar) ? path25.resolve(fromTar) : fromTar;
23164
23329
  }
23165
23330
  async function installLocally(opts) {
23166
23331
  const { fromTar, tel } = opts;
@@ -23468,7 +23633,7 @@ async function chooseAdapters(opts) {
23468
23633
  // ../argent-installer/src/init-scope.ts
23469
23634
  var import_picocolors6 = __toESM(require_picocolors(), 1);
23470
23635
  import { existsSync as existsSync15 } from "node:fs";
23471
- import { resolve as resolve14 } from "node:path";
23636
+ import { resolve as resolve15 } from "node:path";
23472
23637
  async function chooseScope(opts) {
23473
23638
  if (opts.installMode === "local") {
23474
23639
  return { scope: "local" };
@@ -23505,13 +23670,13 @@ async function chooseScope(opts) {
23505
23670
  placeholder: process.cwd(),
23506
23671
  validate(value) {
23507
23672
  if (!value?.trim()) return "Path cannot be empty.";
23508
- const resolved = resolve14(value.trim());
23673
+ const resolved = resolve15(value.trim());
23509
23674
  if (!existsSync15(resolved))
23510
23675
  return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
23511
23676
  }
23512
23677
  });
23513
23678
  if (isCancel(customPathInput)) throw new InitCancelled("scope");
23514
- return { scope: "custom", customRoot: resolve14(customPathInput.trim()) };
23679
+ return { scope: "custom", customRoot: resolve15(customPathInput.trim()) };
23515
23680
  }
23516
23681
 
23517
23682
  // ../argent-installer/src/init-mcp-write.ts
@@ -23812,7 +23977,7 @@ async function configureAllowlist(args) {
23812
23977
  var import_picocolors10 = __toESM(require_picocolors(), 1);
23813
23978
  import { spawn as spawn3 } from "node:child_process";
23814
23979
  import * as os4 from "node:os";
23815
- import * as path25 from "node:path";
23980
+ import * as path26 from "node:path";
23816
23981
  var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
23817
23982
  function meaningfulLine(err) {
23818
23983
  const lines = (err instanceof Error ? err.message : String(err)).split("\n").map((l2) => l2.replace(/^[│┌└■◇\s]+/, "").trim()).filter((l2) => l2 && !/^npm (warn|notice)/i.test(l2));
@@ -23820,10 +23985,10 @@ function meaningfulLine(err) {
23820
23985
  }
23821
23986
  function bundledCopyFor(version) {
23822
23987
  const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
23823
- if (local.packageDir && local.version === version) return path25.join(local.packageDir, "skills");
23988
+ if (local.packageDir && local.version === version) return path26.join(local.packageDir, "skills");
23824
23989
  const globalRoot = getGloballyInstalledPackageRoot();
23825
23990
  if (globalRoot && getGloballyInstalledVersion() === version) {
23826
- return path25.join(globalRoot, "skills");
23991
+ return path26.join(globalRoot, "skills");
23827
23992
  }
23828
23993
  return SKILLS_DIR;
23829
23994
  }
@@ -24050,7 +24215,7 @@ async function runSkillsStep(args) {
24050
24215
  async function runSkillsCli(runner, args, interactive, cwd) {
24051
24216
  if (!runner) throw new Error(NO_SKILLS_RUNNER_MESSAGE);
24052
24217
  const command = skillsCommand(runner, args);
24053
- return new Promise((resolve21, reject) => {
24218
+ return new Promise((resolve22, reject) => {
24054
24219
  const child = spawn3(command.file, command.args, {
24055
24220
  env: npxChildEnv(),
24056
24221
  stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
@@ -24069,7 +24234,7 @@ async function runSkillsCli(runner, args, interactive, cwd) {
24069
24234
  }
24070
24235
  child.on("close", (code, signal) => {
24071
24236
  if (code === 0) {
24072
- resolve21();
24237
+ resolve22();
24073
24238
  } else {
24074
24239
  const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
24075
24240
  reject(
@@ -24391,7 +24556,8 @@ function printBanner() {
24391
24556
  var import_picocolors12 = __toESM(require_picocolors(), 1);
24392
24557
  var import_semver5 = __toESM(require_semver2(), 1);
24393
24558
  import * as fs24 from "node:fs";
24394
- import * as path31 from "node:path";
24559
+ import * as os5 from "node:os";
24560
+ import * as path32 from "node:path";
24395
24561
 
24396
24562
  // ../argent-installer/src/install-targets.ts
24397
24563
  function parseTargetFlags(args) {
@@ -24441,11 +24607,18 @@ async function promptInstallTargets(verb) {
24441
24607
 
24442
24608
  // ../argent-installer/src/update-target.ts
24443
24609
  var import_update_core = __toESM(require_dist3(), 1);
24444
- async function resolveInstallableUpdateTarget(pm, current, cwd) {
24610
+ async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
24445
24611
  const info = await (0, import_update_core.fetchRegistryInfo)(`${NPM_REGISTRY}/${PACKAGE_NAME}`);
24446
24612
  if (info === null) return null;
24447
24613
  const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm, cwd);
24448
- const target = (0, import_update_core.pickInstallableTarget)(info.latest, info.times, current, minReleaseAgeMs);
24614
+ let { latest, times } = info;
24615
+ if (candidate) {
24616
+ const publishedAt = times[candidate] ?? null;
24617
+ latest = { version: candidate, publishedAt };
24618
+ times = publishedAt ? { [candidate]: publishedAt } : {};
24619
+ if (candidate !== info.latest.version && !publishedAt) return null;
24620
+ }
24621
+ const target = (0, import_update_core.pickInstallableTarget)(latest, times, current, minReleaseAgeMs);
24449
24622
  return {
24450
24623
  latestVersion: info.latest.version,
24451
24624
  latestPublishedAt: info.latest.publishedAt,
@@ -24457,16 +24630,15 @@ async function resolveInstallableUpdateTarget(pm, current, cwd) {
24457
24630
  // ../argent-tools-client/src/launcher.ts
24458
24631
  import * as net from "node:net";
24459
24632
  import * as fs23 from "node:fs";
24460
- import * as path26 from "node:path";
24633
+ import * as path27 from "node:path";
24461
24634
  import * as readline from "node:readline";
24462
- import { homedir as homedir7 } from "node:os";
24463
- import { spawn as spawn4, execFileSync as execFileSync8 } from "node:child_process";
24635
+ import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
24464
24636
  import { createHash as createHash3, randomBytes } from "node:crypto";
24465
24637
  import { mkdir, writeFile, readFile, readdir as readdir2, unlink, rename, chmod } from "node:fs/promises";
24466
- var STATE_DIR = path26.join(homedir7(), ".argent");
24467
- var STATE_FILE = path26.join(STATE_DIR, "tool-server.json");
24468
- var LOG_FILE = path26.join(STATE_DIR, "tool-server.log");
24469
- var LOCK_FILE = path26.join(STATE_DIR, "tool-server.lock");
24638
+ var STATE_DIR = argentHomeDir();
24639
+ var STATE_FILE = path27.join(STATE_DIR, "tool-server.json");
24640
+ var LOG_FILE = path27.join(STATE_DIR, "tool-server.log");
24641
+ var LOCK_FILE = path27.join(STATE_DIR, "tool-server.lock");
24470
24642
  function isProcessAlive(pid) {
24471
24643
  try {
24472
24644
  process.kill(pid, 0);
@@ -24477,7 +24649,7 @@ function isProcessAlive(pid) {
24477
24649
  }
24478
24650
  function stateFileForBundle(bundlePath) {
24479
24651
  const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
24480
- return path26.join(STATE_DIR, `tool-server-${key}.json`);
24652
+ return path27.join(STATE_DIR, `tool-server-${key}.json`);
24481
24653
  }
24482
24654
  async function readStateFile(file) {
24483
24655
  try {
@@ -24519,7 +24691,7 @@ async function readAllToolsServerStates() {
24519
24691
  const out = [];
24520
24692
  for (const name of names) {
24521
24693
  if (!STATE_FILE_RE.test(name)) continue;
24522
- const file = path26.join(STATE_DIR, name);
24694
+ const file = path27.join(STATE_DIR, name);
24523
24695
  const state2 = await readStateFile(file);
24524
24696
  if (state2) out.push({ file, state: state2 });
24525
24697
  }
@@ -24565,8 +24737,8 @@ async function killToolServer(bundlePath) {
24565
24737
  return alive;
24566
24738
  }
24567
24739
  function isPathWithin(child, parent) {
24568
- const rel = path26.relative(parent, child);
24569
- return rel !== "" && !rel.startsWith("..") && !path26.isAbsolute(rel);
24740
+ const rel = path27.relative(parent, child);
24741
+ return rel !== "" && !rel.startsWith("..") && !path27.isAbsolute(rel);
24570
24742
  }
24571
24743
  function tryRealpath(p) {
24572
24744
  try {
@@ -24576,10 +24748,10 @@ function tryRealpath(p) {
24576
24748
  }
24577
24749
  }
24578
24750
  async function killToolServerForInstallDir(packageDir) {
24579
- const parents = /* @__PURE__ */ new Set([path26.resolve(packageDir), tryRealpath(packageDir)]);
24751
+ const parents = /* @__PURE__ */ new Set([path27.resolve(packageDir), tryRealpath(packageDir)]);
24580
24752
  let killed = 0;
24581
24753
  for (const { file, state: state2 } of await readAllToolsServerStates()) {
24582
- const bundles = /* @__PURE__ */ new Set([path26.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
24754
+ const bundles = /* @__PURE__ */ new Set([path27.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
24583
24755
  const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
24584
24756
  if (!matches2) continue;
24585
24757
  const fresh = await readStateFile(file);
@@ -24601,7 +24773,7 @@ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs23.existsSync(p)) ?? "ps";
24601
24773
  var PS_WIDTH_FLAGS = ["-ww"];
24602
24774
  var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
24603
24775
  function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
24604
- return execFileSync8(PS_BIN, [...flags, "-p", String(pid), "-o", "command="], {
24776
+ return execFileSync9(PS_BIN, [...flags, "-p", String(pid), "-o", "command="], {
24605
24777
  env,
24606
24778
  encoding: "utf8",
24607
24779
  timeout: 2e3,
@@ -24644,14 +24816,13 @@ function couldBeOurToolServer(pid, marker) {
24644
24816
  var import_yaml4 = __toESM(require_dist2(), 1);
24645
24817
  import { readFile as readFile5 } from "node:fs/promises";
24646
24818
  import { maxHeaderSize } from "node:http";
24647
- import * as path30 from "node:path";
24819
+ import * as path31 from "node:path";
24648
24820
 
24649
24821
  // ../argent-tools-client/src/link-config.ts
24650
- import * as path27 from "node:path";
24651
- import { homedir as homedir8 } from "node:os";
24822
+ import * as path28 from "node:path";
24652
24823
  import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
24653
- var LINK_DIR = path27.join(homedir8(), ".argent");
24654
- var LINK_FILE = path27.join(LINK_DIR, "link.json");
24824
+ var LINK_DIR = argentHomeDir();
24825
+ var LINK_FILE = path28.join(LINK_DIR, "link.json");
24655
24826
 
24656
24827
  // ../argent-tools-client/src/file-inputs.ts
24657
24828
  import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
@@ -24668,14 +24839,14 @@ import {
24668
24839
  writeFile as writeFile3
24669
24840
  } from "node:fs/promises";
24670
24841
  import { constants as constants2, tmpdir } from "node:os";
24671
- import * as path28 from "node:path";
24842
+ import * as path29 from "node:path";
24672
24843
 
24673
24844
  // ../archive/src/index.ts
24674
24845
  import { spawn as spawn5 } from "node:child_process";
24675
24846
  import { once } from "node:events";
24676
24847
  import { createReadStream, createWriteStream } from "node:fs";
24677
24848
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
24678
- import { basename as basename5, dirname as dirname14, join as join25, resolve as resolve16, sep as sep4 } from "node:path";
24849
+ import { basename as basename5, dirname as dirname14, join as join27, resolve as resolve17, sep as sep4 } from "node:path";
24679
24850
  import { Writable } from "node:stream";
24680
24851
  import { pipeline } from "node:stream/promises";
24681
24852
  import zlib2 from "node:zlib";
@@ -24693,7 +24864,7 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
24693
24864
  // ../argent-tools-client/src/flow-files.ts
24694
24865
  var import_yaml3 = __toESM(require_dist2(), 1);
24695
24866
  import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
24696
- import * as path29 from "node:path";
24867
+ import * as path30 from "node:path";
24697
24868
  var INLINE_MEMBERS_BYTES = 256 * 1024;
24698
24869
 
24699
24870
  // ../argent-tools-client/src/artifacts.ts
@@ -24709,7 +24880,7 @@ import {
24709
24880
  } from "node:fs/promises";
24710
24881
  import { constants as fsConstants } from "node:fs";
24711
24882
  import { tmpdir as tmpdir2 } from "node:os";
24712
- import { basename as basename8, dirname as dirname18, extname as extname2, isAbsolute as isAbsolute9, join as join29, normalize as normalize2, resolve as resolve19, sep as sep7 } from "node:path";
24883
+ import { basename as basename8, extname as extname2, isAbsolute as isAbsolute10, join as join31, normalize as normalize2, resolve as resolve20, sep as sep7 } from "node:path";
24713
24884
  import { createHash as createHash5 } from "node:crypto";
24714
24885
  var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
24715
24886
  var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
@@ -24786,11 +24957,142 @@ function resolveUpdatePackageAction(trigger, installed) {
24786
24957
  function isLivePinnedEntry(entry) {
24787
24958
  return entry !== null && isPinnedGlobalEntry(entry) && fs24.existsSync(entry.command) && fs24.existsSync(entry.args[0]);
24788
24959
  }
24960
+ async function refreshConfiguration({
24961
+ projectRoot,
24962
+ installMode,
24963
+ nonInteractive,
24964
+ globalOnly
24965
+ }) {
24966
+ const spinner2 = spinner();
24967
+ spinner2.start("Refreshing workspace configuration...");
24968
+ const results = [];
24969
+ const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
24970
+ const globalCmdMode = resolveGlobalCommandMode();
24971
+ const globalInstallOnPath = isGlobalInstallFirstOnPath();
24972
+ const skipEntryRewrite = localCmdMode?.kind === "local-npx";
24973
+ const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
24974
+ const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot).filter(
24975
+ ({ scope }) => !globalOnly || scope !== "project"
24976
+ );
24977
+ const adaptersByScope = /* @__PURE__ */ new Map([
24978
+ ["local", /* @__PURE__ */ new Set()],
24979
+ ["global", /* @__PURE__ */ new Set()]
24980
+ ]);
24981
+ for (const { adapter, scope, configPath } of configuredScopes) {
24982
+ const normScope = scope === "project" ? "local" : "global";
24983
+ adaptersByScope.get(normScope).add(adapter);
24984
+ if (skipEntryRewrite && normScope === "local") continue;
24985
+ let existing;
24986
+ try {
24987
+ existing = adapter.getArgentEntry(configPath);
24988
+ } catch {
24989
+ continue;
24990
+ }
24991
+ const isUnreadableSentinel = existing !== null && existing.command === "" && existing.args.length === 0;
24992
+ if (existing !== null && !isUnreadableSentinel && !isArgentManagedEntry(existing)) {
24993
+ results.push(
24994
+ `${import_picocolors12.default.yellow("!")} ${adapter.name} left a customized entry untouched ${import_picocolors12.default.dim(configPath)}`
24995
+ );
24996
+ continue;
24997
+ }
24998
+ const entry = entryFor(normScope);
24999
+ const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
25000
+ if (replacesLivePin && normScope === "local") continue;
25001
+ if (replacesLivePin && !globalInstallOnPath) {
25002
+ results.push(
25003
+ `${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
25004
+ );
25005
+ continue;
25006
+ }
25007
+ try {
25008
+ adapter.write(configPath, entry);
25009
+ results.push(
25010
+ replacesLivePin ? `${import_picocolors12.default.yellow("!")} ${adapter.name} now runs the bare argent command (the global install on PATH has no node beside it to pin) ${import_picocolors12.default.dim(configPath)}` : `${import_picocolors12.default.green("+")} ${adapter.name} ${import_picocolors12.default.dim(configPath)}`
25011
+ );
25012
+ } catch {
25013
+ }
25014
+ }
25015
+ if (skipEntryRewrite && configuredScopes.some(({ scope }) => scope === "project")) {
25016
+ log.info(
25017
+ import_picocolors12.default.dim(
25018
+ "Left project MCP entries unchanged \u2014 the repo-local argent binary can't be resolved right now (fresh checkout: run your package manager's install; after an out-of-band version bump, just re-run argent update)."
25019
+ )
25020
+ );
25021
+ }
25022
+ for (const [scope, adapters] of adaptersByScope) {
25023
+ for (const adapter of adapters) {
25024
+ if (!adapter.refreshAllowlist) continue;
25025
+ try {
25026
+ adapter.refreshAllowlist(projectRoot, scope);
25027
+ } catch {
25028
+ }
25029
+ }
25030
+ }
25031
+ const localAdapters = [...adaptersByScope.get("local")];
25032
+ const globalAdapters = [...adaptersByScope.get("global")];
25033
+ const ruleResults = [
25034
+ ...copyRulesAndAgents(globalAdapters, projectRoot, "global", RULES_DIR, AGENTS_DIR),
25035
+ ...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
25036
+ ];
25037
+ spinner2.stop("Configuration refreshed.");
25038
+ if (results.length > 0) {
25039
+ note(results.join("\n"), "MCP Configs Updated");
25040
+ }
25041
+ if (!globalOnly) {
25042
+ const staleCleanup = await cleanupStaleMcpConfigs({
25043
+ writtenAdapters: [.../* @__PURE__ */ new Set([...localAdapters, ...globalAdapters])],
25044
+ detectedAdapters: detectAdapters(),
25045
+ installMode,
25046
+ scope: localAdapters.length > 0 ? "local" : "global",
25047
+ effectiveRoot: projectRoot,
25048
+ // Same one-shot confirmation init uses for cross-project removals.
25049
+ // --yes passes no confirmer (the sweep goes report-only) — the
25050
+ // agent-triggered `update --yes` must never delete cross-project state
25051
+ // on a fallible PATH probe.
25052
+ confirmCrossProjectRemovals: nonInteractive ? void 0 : async (items) => {
25053
+ log.warn(
25054
+ `Dead argent entries from a previous global install were found in
25055
+ global (cross-project) config files:
25056
+ ` + items.map((item) => ` ${import_picocolors12.default.cyan(item)}`).join("\n")
25057
+ );
25058
+ const choice = await confirm({
25059
+ message: "Remove these dead global entries? - recommended",
25060
+ initialValue: true
25061
+ });
25062
+ return !isCancel(choice) && choice === true;
25063
+ }
25064
+ });
25065
+ if (staleCleanup.lines.length > 0) {
25066
+ note(staleCleanup.lines.join("\n"), "Stale Config Cleanup");
25067
+ track("installation:stale_config_cleanup", {
25068
+ removed_count: staleCleanup.removedCount,
25069
+ warned_count: staleCleanup.warnedCount
25070
+ });
25071
+ }
25072
+ }
25073
+ if (ruleResults.length > 0) {
25074
+ note(ruleResults.join("\n"), "Rules Updated");
25075
+ }
25076
+ await reportRetiredFiles(
25077
+ findRetiredRulesAndAgents(
25078
+ [
25079
+ { adapters: globalAdapters, scope: "global" },
25080
+ { adapters: localAdapters, scope: "local" }
25081
+ ],
25082
+ projectRoot,
25083
+ RULES_DIR,
25084
+ AGENTS_DIR
25085
+ ),
25086
+ !nonInteractive
25087
+ );
25088
+ reportSkillRefresh(projectRoot, "installer_update_skills_refresh", globalOnly ? "global" : "all");
25089
+ }
24789
25090
  async function update(args) {
24790
25091
  const nonInteractive = args.includes("--yes") || args.includes("-y");
24791
25092
  const noTelemetry = args.includes("--no-telemetry");
24792
25093
  const requestedVersion = getRequestedVersion(args);
24793
25094
  const trigger = getUpdateTriggerFromEnv();
25095
+ const automatic = process.env.ARGENT_AUTOMATIC_UPDATE === "1";
24794
25096
  init("installer");
24795
25097
  const updateStartTime = performance.now();
24796
25098
  let telemetryFinalized = false;
@@ -24883,16 +25185,23 @@ async function update(args) {
24883
25185
  const spinner2 = spinner();
24884
25186
  spinner2.start("Checking for updates...");
24885
25187
  const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
25188
+ if (automatic) {
25189
+ const globalRoot = getGloballyInstalledPackageRoot();
25190
+ if (!globallyInstalled || !globalRoot || fs24.realpathSync(globalRoot) !== projectRoot || !isAutoUpdateEnabled() || !ownsGlobalInstall(pm, projectRoot)) {
25191
+ spinner2.stop("Could not confirm an automatic update for this installation.");
25192
+ return "noop";
25193
+ }
25194
+ }
24886
25195
  const runIn = mode === "local" ? { cwd: projectRoot } : globalCommandOptions(pm);
24887
25196
  let latest = null;
24888
25197
  let target;
24889
25198
  let minReleaseAgeMs = 0;
24890
- if (requestedVersion !== null) {
25199
+ if (requestedVersion !== null && !automatic) {
24891
25200
  target = requestedVersion;
24892
25201
  } else {
24893
25202
  let resolved;
24894
25203
  try {
24895
- resolved = await resolveInstallableUpdateTarget(pm, installed, runIn.cwd);
25204
+ resolved = automatic && requestedVersion ? await resolveInstallableUpdateTarget(pm, installed, runIn.cwd, requestedVersion) : await resolveInstallableUpdateTarget(pm, installed, runIn.cwd);
24896
25205
  } catch (err) {
24897
25206
  spinner2.stop(import_picocolors12.default.red("Could not reach registry."));
24898
25207
  await trackPackageAction(
@@ -24915,6 +25224,10 @@ async function update(args) {
24915
25224
  log.error("Failed to determine the latest Argent release from the registry.");
24916
25225
  return { failed: UPDATE_REGISTRY_CHECK_FAILED };
24917
25226
  }
25227
+ if (automatic && resolved.targetVersion !== requestedVersion) {
25228
+ spinner2.stop("The eligible version has changed.");
25229
+ return "noop";
25230
+ }
24918
25231
  latest = resolved.latestVersion;
24919
25232
  target = resolved.targetVersion;
24920
25233
  minReleaseAgeMs = resolved.minReleaseAgeMs;
@@ -24959,22 +25272,24 @@ async function update(args) {
24959
25272
  }
24960
25273
  }
24961
25274
  log.info(`Running: ${import_picocolors12.default.dim(cmdStr)}`);
24962
- const installDirToStop = mode === "local" ? localProbe.packageDir : getGloballyInstalledPackageRoot();
24963
- try {
24964
- if (installDirToStop) {
24965
- await killToolServerForInstallDir(installDirToStop);
24966
- } else if (mode === "global") {
24967
- await killToolServer();
25275
+ if (!automatic) {
25276
+ const installDirToStop = mode === "local" ? localProbe.packageDir : getGloballyInstalledPackageRoot();
25277
+ try {
25278
+ if (installDirToStop) {
25279
+ await killToolServerForInstallDir(installDirToStop);
25280
+ } else if (mode === "global") {
25281
+ await killToolServer();
25282
+ }
25283
+ } catch (err) {
25284
+ await trackPackageAction(
25285
+ "update_failed",
25286
+ updateStartTime,
25287
+ false,
25288
+ UPDATE_TOOLSERVER_STOP_FAILED
25289
+ );
25290
+ log.error(`Could not stop the running tool server: ${err}`);
25291
+ return { failed: UPDATE_TOOLSERVER_STOP_FAILED };
24968
25292
  }
24969
- } catch (err) {
24970
- await trackPackageAction(
24971
- "update_failed",
24972
- updateStartTime,
24973
- false,
24974
- UPDATE_TOOLSERVER_STOP_FAILED
24975
- );
24976
- log.error(`Could not stop the running tool server: ${err}`);
24977
- return { failed: UPDATE_TOOLSERVER_STOP_FAILED };
24978
25293
  }
24979
25294
  const packageAction = resolveUpdatePackageAction(
24980
25295
  trigger,
@@ -25072,8 +25387,31 @@ async function update(args) {
25072
25387
  log.error(`Requested version is not a stable semver: ${requestedVersion}`);
25073
25388
  process.exit(1);
25074
25389
  }
25390
+ if (automatic) {
25391
+ const runningRoot = fs24.realpathSync(resolvePackageRoot(import.meta.dirname));
25392
+ const result = requestedVersion ? await applyUpdateForTarget("global", runningRoot) : "noop";
25393
+ if (result === "updated" && requestedVersion) {
25394
+ writeCliRecord({
25395
+ mode: "global",
25396
+ projectRoot: runningRoot,
25397
+ version: getGloballyInstalledVersion() ?? requestedVersion
25398
+ });
25399
+ await refreshConfiguration({
25400
+ projectRoot: os5.homedir(),
25401
+ installMode: "global",
25402
+ nonInteractive: true,
25403
+ globalOnly: true
25404
+ });
25405
+ await completeUpdateTelemetry();
25406
+ } else {
25407
+ process.exitCode = 1;
25408
+ if (typeof result === "object") await failUpdateTelemetry(result.failed);
25409
+ else await completeUpdateTelemetry();
25410
+ }
25411
+ return;
25412
+ }
25075
25413
  const rootOverride = getProjectRootOverride(args);
25076
- const projectRoot = rootOverride ? path31.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
25414
+ const projectRoot = rootOverride ? path32.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
25077
25415
  installMode = resolveInstallMode(projectRoot);
25078
25416
  const flags = parseTargetFlags(args);
25079
25417
  const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
@@ -25136,127 +25474,7 @@ async function update(args) {
25136
25474
  outro(import_picocolors12.default.red("Update failed."));
25137
25475
  process.exit(1);
25138
25476
  }
25139
- {
25140
- const spinner2 = spinner();
25141
- spinner2.start("Refreshing workspace configuration...");
25142
- const results = [];
25143
- const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
25144
- const globalCmdMode = resolveGlobalCommandMode();
25145
- const globalInstallOnPath = isGlobalInstallFirstOnPath();
25146
- const skipEntryRewrite = localCmdMode?.kind === "local-npx";
25147
- const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
25148
- const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
25149
- const adaptersByScope = /* @__PURE__ */ new Map([
25150
- ["local", /* @__PURE__ */ new Set()],
25151
- ["global", /* @__PURE__ */ new Set()]
25152
- ]);
25153
- for (const { adapter, scope, configPath } of configuredScopes) {
25154
- const normScope = scope === "project" ? "local" : "global";
25155
- adaptersByScope.get(normScope).add(adapter);
25156
- if (skipEntryRewrite && normScope === "local") continue;
25157
- let existing;
25158
- try {
25159
- existing = adapter.getArgentEntry(configPath);
25160
- } catch {
25161
- continue;
25162
- }
25163
- const isUnreadableSentinel = existing !== null && existing.command === "" && existing.args.length === 0;
25164
- if (existing !== null && !isUnreadableSentinel && !isArgentManagedEntry(existing)) {
25165
- results.push(
25166
- `${import_picocolors12.default.yellow("!")} ${adapter.name} left a customized entry untouched ${import_picocolors12.default.dim(configPath)}`
25167
- );
25168
- continue;
25169
- }
25170
- const entry = entryFor(normScope);
25171
- const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
25172
- if (replacesLivePin && normScope === "local") continue;
25173
- if (replacesLivePin && !globalInstallOnPath) {
25174
- results.push(
25175
- `${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
25176
- );
25177
- continue;
25178
- }
25179
- try {
25180
- adapter.write(configPath, entry);
25181
- results.push(
25182
- replacesLivePin ? `${import_picocolors12.default.yellow("!")} ${adapter.name} now runs the bare argent command (the global install on PATH has no node beside it to pin) ${import_picocolors12.default.dim(configPath)}` : `${import_picocolors12.default.green("+")} ${adapter.name} ${import_picocolors12.default.dim(configPath)}`
25183
- );
25184
- } catch {
25185
- }
25186
- }
25187
- if (skipEntryRewrite && configuredScopes.some(({ scope }) => scope === "project")) {
25188
- log.info(
25189
- import_picocolors12.default.dim(
25190
- "Left project MCP entries unchanged \u2014 the repo-local argent binary can't be resolved right now (fresh checkout: run your package manager's install; after an out-of-band version bump, just re-run argent update)."
25191
- )
25192
- );
25193
- }
25194
- for (const [scope, adapters] of adaptersByScope) {
25195
- for (const adapter of adapters) {
25196
- if (!adapter.refreshAllowlist) continue;
25197
- try {
25198
- adapter.refreshAllowlist(projectRoot, scope);
25199
- } catch {
25200
- }
25201
- }
25202
- }
25203
- const localAdapters = [...adaptersByScope.get("local")];
25204
- const globalAdapters = [...adaptersByScope.get("global")];
25205
- const ruleResults = [
25206
- ...copyRulesAndAgents(globalAdapters, projectRoot, "global", RULES_DIR, AGENTS_DIR),
25207
- ...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
25208
- ];
25209
- spinner2.stop("Configuration refreshed.");
25210
- if (results.length > 0) {
25211
- note(results.join("\n"), "MCP Configs Updated");
25212
- }
25213
- const staleCleanup = await cleanupStaleMcpConfigs({
25214
- writtenAdapters: [.../* @__PURE__ */ new Set([...localAdapters, ...globalAdapters])],
25215
- detectedAdapters: detectAdapters(),
25216
- installMode,
25217
- scope: localAdapters.length > 0 ? "local" : "global",
25218
- effectiveRoot: projectRoot,
25219
- // Same one-shot confirmation init uses for cross-project removals.
25220
- // --yes passes no confirmer (the sweep goes report-only) — the
25221
- // agent-triggered `update --yes` must never delete cross-project state
25222
- // on a fallible PATH probe.
25223
- confirmCrossProjectRemovals: nonInteractive ? void 0 : async (items) => {
25224
- log.warn(
25225
- `Dead argent entries from a previous global install were found in
25226
- global (cross-project) config files:
25227
- ` + items.map((item) => ` ${import_picocolors12.default.cyan(item)}`).join("\n")
25228
- );
25229
- const choice = await confirm({
25230
- message: "Remove these dead global entries? - recommended",
25231
- initialValue: true
25232
- });
25233
- return !isCancel(choice) && choice === true;
25234
- }
25235
- });
25236
- if (staleCleanup.lines.length > 0) {
25237
- note(staleCleanup.lines.join("\n"), "Stale Config Cleanup");
25238
- track("installation:stale_config_cleanup", {
25239
- removed_count: staleCleanup.removedCount,
25240
- warned_count: staleCleanup.warnedCount
25241
- });
25242
- }
25243
- if (ruleResults.length > 0) {
25244
- note(ruleResults.join("\n"), "Rules Updated");
25245
- }
25246
- await reportRetiredFiles(
25247
- findRetiredRulesAndAgents(
25248
- [
25249
- { adapters: globalAdapters, scope: "global" },
25250
- { adapters: localAdapters, scope: "local" }
25251
- ],
25252
- projectRoot,
25253
- RULES_DIR,
25254
- AGENTS_DIR
25255
- ),
25256
- !nonInteractive
25257
- );
25258
- reportSkillRefresh(projectRoot, "installer_update_skills_refresh");
25259
- }
25477
+ await refreshConfiguration({ projectRoot, installMode, nonInteractive, globalOnly: false });
25260
25478
  if (firstFailure) {
25261
25479
  await failUpdateTelemetry(firstFailure);
25262
25480
  outro(import_picocolors12.default.yellow("Update finished with errors \u2014 see above."));
@@ -25274,7 +25492,7 @@ async function update(args) {
25274
25492
  var import_picocolors13 = __toESM(require_picocolors(), 1);
25275
25493
  var import_yaml5 = __toESM(require_dist2(), 1);
25276
25494
  import * as fs25 from "node:fs";
25277
- import * as path32 from "node:path";
25495
+ import * as path33 from "node:path";
25278
25496
  var UNINSTALL_TOOLSERVER_STOP_FAILED = {
25279
25497
  error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
25280
25498
  failure_stage: "installer_uninstall_toolserver_stop",
@@ -25309,8 +25527,8 @@ function collectBundledPaths(sourceDir) {
25309
25527
  const directories = [];
25310
25528
  function walk(currentDir, relativeDir = "") {
25311
25529
  for (const entry of fs25.readdirSync(currentDir, { withFileTypes: true })) {
25312
- const relativePath = relativeDir ? path32.join(relativeDir, entry.name) : entry.name;
25313
- const absolutePath = path32.join(currentDir, entry.name);
25530
+ const relativePath = relativeDir ? path33.join(relativeDir, entry.name) : entry.name;
25531
+ const absolutePath = path33.join(currentDir, entry.name);
25314
25532
  if (entry.isDirectory()) {
25315
25533
  walk(absolutePath, relativePath);
25316
25534
  directories.push(relativePath);
@@ -25329,7 +25547,7 @@ function removeBundledContent(sourceDir, targetDir) {
25329
25547
  const { files, directories } = collectBundledPaths(sourceDir);
25330
25548
  const removedPaths = [];
25331
25549
  for (const relativePath of files) {
25332
- const targetPath = path32.join(targetDir, relativePath);
25550
+ const targetPath = path33.join(targetDir, relativePath);
25333
25551
  try {
25334
25552
  const entry = fs25.lstatSync(targetPath, { throwIfNoEntry: false });
25335
25553
  if (!entry || entry.isDirectory()) continue;
@@ -25339,10 +25557,10 @@ function removeBundledContent(sourceDir, targetDir) {
25339
25557
  }
25340
25558
  }
25341
25559
  directories.sort(
25342
- (a2, b) => b.split(path32.sep).length - a2.split(path32.sep).length || b.length - a2.length
25560
+ (a2, b) => b.split(path33.sep).length - a2.split(path33.sep).length || b.length - a2.length
25343
25561
  );
25344
25562
  for (const relativePath of directories) {
25345
- const targetPath = path32.join(targetDir, relativePath);
25563
+ const targetPath = path33.join(targetDir, relativePath);
25346
25564
  try {
25347
25565
  if (!fs25.existsSync(targetPath)) continue;
25348
25566
  if (!fs25.statSync(targetPath).isDirectory()) continue;
@@ -25362,7 +25580,7 @@ function removeBundledContent(sourceDir, targetDir) {
25362
25580
  } catch {
25363
25581
  }
25364
25582
  if (removedRoot) {
25365
- removeDirIfEmpty2(path32.dirname(targetDir));
25583
+ removeDirIfEmpty2(path33.dirname(targetDir));
25366
25584
  }
25367
25585
  return { removedPaths, removedRoot };
25368
25586
  }
@@ -25383,7 +25601,7 @@ function getBundledSkillNames(skillsDir) {
25383
25601
  const skillNames = [];
25384
25602
  for (const entry of fs25.readdirSync(skillsDir, { withFileTypes: true })) {
25385
25603
  if (!entry.isDirectory()) continue;
25386
- const skillFilePath = path32.join(skillsDir, entry.name, "SKILL.md");
25604
+ const skillFilePath = path33.join(skillsDir, entry.name, "SKILL.md");
25387
25605
  if (!fs25.existsSync(skillFilePath)) continue;
25388
25606
  skillNames.push(readBundledSkillName(skillFilePath, entry.name));
25389
25607
  }
@@ -25395,7 +25613,7 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
25395
25613
  }
25396
25614
  const removedPaths = [];
25397
25615
  for (const skillName of skillNames) {
25398
- const targetPath = path32.join(targetDir, skillName);
25616
+ const targetPath = path33.join(targetDir, skillName);
25399
25617
  try {
25400
25618
  if (removePath(targetPath)) removedPaths.push(skillName);
25401
25619
  } catch {
@@ -25403,7 +25621,7 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
25403
25621
  }
25404
25622
  const removedRoot = removeDirIfEmpty2(targetDir);
25405
25623
  if (removedRoot) {
25406
- removeDirIfEmpty2(path32.dirname(targetDir));
25624
+ removeDirIfEmpty2(path33.dirname(targetDir));
25407
25625
  }
25408
25626
  return { removedPaths, removedRoot };
25409
25627
  }
@@ -25646,7 +25864,7 @@ async function uninstall(args) {
25646
25864
  ),
25647
25865
  { ask: false }
25648
25866
  );
25649
- for (const root of retired.removedRoots) removeDirIfEmpty2(path32.dirname(root));
25867
+ for (const root of retired.removedRoots) removeDirIfEmpty2(path33.dirname(root));
25650
25868
  const retiredLines = formatRetiredCleanup(retired);
25651
25869
  pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
25652
25870
  const retiredKept = retiredLines.kept.map((line) => ` ${line}`);