@swmansion/argent 0.34.1-next.29 → 0.34.1-next.30

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.
@@ -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, path30) {
3656
- const ctrl = callVisitor(key, node, visitor, path30);
3655
+ function visit_(key, node, visitor, path32) {
3656
+ const ctrl = callVisitor(key, node, visitor, path32);
3657
3657
  if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
3658
- replaceNode(key, path30, ctrl);
3659
- return visit_(key, ctrl, visitor, path30);
3658
+ replaceNode(key, path32, ctrl);
3659
+ return visit_(key, ctrl, visitor, path32);
3660
3660
  }
3661
3661
  if (typeof ctrl !== "symbol") {
3662
3662
  if (identity2.isCollection(node)) {
3663
- path30 = Object.freeze(path30.concat(node));
3663
+ path32 = Object.freeze(path32.concat(node));
3664
3664
  for (let i2 = 0; i2 < node.items.length; ++i2) {
3665
- const ci = visit_(i2, node.items[i2], visitor, path30);
3665
+ const ci = visit_(i2, node.items[i2], visitor, path32);
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
- path30 = Object.freeze(path30.concat(node));
3677
- const ck = visit_("key", node.key, visitor, path30);
3676
+ path32 = Object.freeze(path32.concat(node));
3677
+ const ck = visit_("key", node.key, visitor, path32);
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, path30);
3682
+ const cv = visit_("value", node.value, visitor, path32);
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, path30) {
3704
- const ctrl = await callVisitor(key, node, visitor, path30);
3703
+ async function visitAsync_(key, node, visitor, path32) {
3704
+ const ctrl = await callVisitor(key, node, visitor, path32);
3705
3705
  if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
3706
- replaceNode(key, path30, ctrl);
3707
- return visitAsync_(key, ctrl, visitor, path30);
3706
+ replaceNode(key, path32, ctrl);
3707
+ return visitAsync_(key, ctrl, visitor, path32);
3708
3708
  }
3709
3709
  if (typeof ctrl !== "symbol") {
3710
3710
  if (identity2.isCollection(node)) {
3711
- path30 = Object.freeze(path30.concat(node));
3711
+ path32 = Object.freeze(path32.concat(node));
3712
3712
  for (let i2 = 0; i2 < node.items.length; ++i2) {
3713
- const ci = await visitAsync_(i2, node.items[i2], visitor, path30);
3713
+ const ci = await visitAsync_(i2, node.items[i2], visitor, path32);
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
- path30 = Object.freeze(path30.concat(node));
3725
- const ck = await visitAsync_("key", node.key, visitor, path30);
3724
+ path32 = Object.freeze(path32.concat(node));
3725
+ const ck = await visitAsync_("key", node.key, visitor, path32);
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, path30);
3730
+ const cv = await visitAsync_("value", node.value, visitor, path32);
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, path30) {
3757
+ function callVisitor(key, node, visitor, path32) {
3758
3758
  if (typeof visitor === "function")
3759
- return visitor(key, node, path30);
3759
+ return visitor(key, node, path32);
3760
3760
  if (identity2.isMap(node))
3761
- return visitor.Map?.(key, node, path30);
3761
+ return visitor.Map?.(key, node, path32);
3762
3762
  if (identity2.isSeq(node))
3763
- return visitor.Seq?.(key, node, path30);
3763
+ return visitor.Seq?.(key, node, path32);
3764
3764
  if (identity2.isPair(node))
3765
- return visitor.Pair?.(key, node, path30);
3765
+ return visitor.Pair?.(key, node, path32);
3766
3766
  if (identity2.isScalar(node))
3767
- return visitor.Scalar?.(key, node, path30);
3767
+ return visitor.Scalar?.(key, node, path32);
3768
3768
  if (identity2.isAlias(node))
3769
- return visitor.Alias?.(key, node, path30);
3769
+ return visitor.Alias?.(key, node, path32);
3770
3770
  return void 0;
3771
3771
  }
3772
- function replaceNode(key, path30, node) {
3773
- const parent = path30[path30.length - 1];
3772
+ function replaceNode(key, path32, node) {
3773
+ const parent = path32[path32.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, path30, value) {
4385
+ function collectionFromPath(schema, path32, value) {
4386
4386
  let v = value;
4387
- for (let i2 = path30.length - 1; i2 >= 0; --i2) {
4388
- const k = path30[i2];
4387
+ for (let i2 = path32.length - 1; i2 >= 0; --i2) {
4388
+ const k = path32[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 = (path30) => path30 == null || typeof path30 === "object" && !!path30[Symbol.iterator]().next().done;
4407
+ var isEmptyPath = (path32) => path32 == null || typeof path32 === "object" && !!path32[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(path30, value) {
4438
- if (isEmptyPath(path30))
4437
+ addIn(path32, value) {
4438
+ if (isEmptyPath(path32))
4439
4439
  this.add(value);
4440
4440
  else {
4441
- const [key, ...rest] = path30;
4441
+ const [key, ...rest] = path32;
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(path30) {
4456
- const [key, ...rest] = path30;
4455
+ deleteIn(path32) {
4456
+ const [key, ...rest] = path32;
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(path30, keepScalar) {
4471
- const [key, ...rest] = path30;
4470
+ getIn(path32, keepScalar) {
4471
+ const [key, ...rest] = path32;
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(path30) {
4490
- const [key, ...rest] = path30;
4489
+ hasIn(path32) {
4490
+ const [key, ...rest] = path32;
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(path30, value) {
4501
- const [key, ...rest] = path30;
4500
+ setIn(path32, value) {
4501
+ const [key, ...rest] = path32;
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(path30, value) {
7016
+ addIn(path32, value) {
7017
7017
  if (assertCollection(this.contents))
7018
- this.contents.addIn(path30, value);
7018
+ this.contents.addIn(path32, 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(path30) {
7094
- if (Collection.isEmptyPath(path30)) {
7093
+ deleteIn(path32) {
7094
+ if (Collection.isEmptyPath(path32)) {
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(path30) : false;
7100
+ return assertCollection(this.contents) ? this.contents.deleteIn(path32) : 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(path30, keepScalar) {
7116
- if (Collection.isEmptyPath(path30))
7115
+ getIn(path32, keepScalar) {
7116
+ if (Collection.isEmptyPath(path32))
7117
7117
  return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
7118
- return identity2.isCollection(this.contents) ? this.contents.getIn(path30, keepScalar) : void 0;
7118
+ return identity2.isCollection(this.contents) ? this.contents.getIn(path32, 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(path30) {
7130
- if (Collection.isEmptyPath(path30))
7129
+ hasIn(path32) {
7130
+ if (Collection.isEmptyPath(path32))
7131
7131
  return this.contents !== void 0;
7132
- return identity2.isCollection(this.contents) ? this.contents.hasIn(path30) : false;
7132
+ return identity2.isCollection(this.contents) ? this.contents.hasIn(path32) : 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(path30, value) {
7150
- if (Collection.isEmptyPath(path30)) {
7149
+ setIn(path32, value) {
7150
+ if (Collection.isEmptyPath(path32)) {
7151
7151
  this.contents = value;
7152
7152
  } else if (this.contents == null) {
7153
- this.contents = Collection.collectionFromPath(this.schema, Array.from(path30), value);
7153
+ this.contents = Collection.collectionFromPath(this.schema, Array.from(path32), value);
7154
7154
  } else if (assertCollection(this.contents)) {
7155
- this.contents.setIn(path30, value);
7155
+ this.contents.setIn(path32, 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, path30) => {
9116
+ visit2.itemAtPath = (cst, path32) => {
9117
9117
  let item = cst;
9118
- for (const [field, index] of path30) {
9118
+ for (const [field, index] of path32) {
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, path30) => {
9128
- const parent = visit2.itemAtPath(cst, path30.slice(0, -1));
9129
- const field = path30[path30.length - 1][0];
9127
+ visit2.parentCollection = (cst, path32) => {
9128
+ const parent = visit2.itemAtPath(cst, path32.slice(0, -1));
9129
+ const field = path32[path32.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(path30, item, visitor) {
9136
- let ctrl = visitor(item, path30);
9135
+ function _visit(path32, item, visitor) {
9136
+ let ctrl = visitor(item, path32);
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(path30.concat([[field, i2]])), token.items[i2], visitor);
9143
+ const ci = _visit(Object.freeze(path32.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, path30);
9154
+ ctrl = ctrl(item, path32);
9155
9155
  }
9156
9156
  }
9157
- return typeof ctrl === "function" ? ctrl(item, path30) : ctrl;
9157
+ return typeof ctrl === "function" ? ctrl(item, path32) : ctrl;
9158
9158
  }
9159
9159
  exports.visit = visit2;
9160
9160
  }
@@ -10456,14 +10456,14 @@ var require_parser = __commonJS({
10456
10456
  case "scalar":
10457
10457
  case "single-quoted-scalar":
10458
10458
  case "double-quoted-scalar": {
10459
- const fs22 = this.flowScalar(this.type);
10459
+ const fs24 = this.flowScalar(this.type);
10460
10460
  if (atNextItem || it.value) {
10461
- map.items.push({ start, key: fs22, sep: [] });
10461
+ map.items.push({ start, key: fs24, sep: [] });
10462
10462
  this.onKeyLine = true;
10463
10463
  } else if (it.sep) {
10464
- this.stack.push(fs22);
10464
+ this.stack.push(fs24);
10465
10465
  } else {
10466
- Object.assign(it, { key: fs22, sep: [] });
10466
+ Object.assign(it, { key: fs24, sep: [] });
10467
10467
  this.onKeyLine = true;
10468
10468
  }
10469
10469
  return;
@@ -10591,13 +10591,13 @@ var require_parser = __commonJS({
10591
10591
  case "scalar":
10592
10592
  case "single-quoted-scalar":
10593
10593
  case "double-quoted-scalar": {
10594
- const fs22 = this.flowScalar(this.type);
10594
+ const fs24 = this.flowScalar(this.type);
10595
10595
  if (!it || it.value)
10596
- fc.items.push({ start: [], key: fs22, sep: [] });
10596
+ fc.items.push({ start: [], key: fs24, sep: [] });
10597
10597
  else if (it.sep)
10598
- this.stack.push(fs22);
10598
+ this.stack.push(fs24);
10599
10599
  else
10600
- Object.assign(it, { key: fs22, sep: [] });
10600
+ Object.assign(it, { key: fs24, sep: [] });
10601
10601
  return;
10602
10602
  }
10603
10603
  case "flow-map-end":
@@ -11007,29 +11007,29 @@ var require_min_release_age = __commonJS({
11007
11007
  const days = Number(override);
11008
11008
  return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
11009
11009
  }
11010
- function probe(p) {
11011
- return new Promise((resolve17) => {
11012
- (0, node_child_process_1.exec)(p.command, { timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
11010
+ function probe(p, cwd) {
11011
+ return new Promise((resolve20) => {
11012
+ (0, node_child_process_1.exec)(p.command, { cwd, timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
11013
11013
  if (err) {
11014
- resolve17(0);
11014
+ resolve20(0);
11015
11015
  return;
11016
11016
  }
11017
- resolve17(p.parse(stdout2));
11017
+ resolve20(p.parse(stdout2));
11018
11018
  });
11019
11019
  });
11020
11020
  }
11021
- async function detectMinReleaseAgeMsForPm2(pm) {
11021
+ async function detectMinReleaseAgeMsForPm2(pm, cwd) {
11022
11022
  const override = overrideMs();
11023
11023
  if (override !== null)
11024
11024
  return override;
11025
11025
  const p = PM_PROBES[pm];
11026
- return p ? probe(p) : 0;
11026
+ return p ? probe(p, cwd) : 0;
11027
11027
  }
11028
11028
  async function detectMinReleaseAgeMs() {
11029
11029
  const override = overrideMs();
11030
11030
  if (override !== null)
11031
11031
  return override;
11032
- const ages = await Promise.all(Object.values(PM_PROBES).map(probe));
11032
+ const ages = await Promise.all(Object.values(PM_PROBES).map((p) => probe(p)));
11033
11033
  return ages.reduce((max, ms) => Math.max(max, ms), 0);
11034
11034
  }
11035
11035
  }
@@ -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((resolve17) => {
11050
+ return new Promise((resolve20) => {
11051
11051
  let resolved = false;
11052
11052
  const safeResolve = (value) => {
11053
11053
  if (!resolved) {
11054
11054
  resolved = true;
11055
- resolve17(value);
11055
+ resolve20(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((resolve17, reject) => {
12996
- this._resolve = resolve17;
12995
+ this._promise = new Promise((resolve20, reject) => {
12996
+ this._resolve = resolve20;
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((resolve17) => {
13890
- this._exportScheduledResolve = resolve17;
13889
+ this._exportScheduledPromise = new Promise((resolve20) => {
13890
+ this._exportScheduledResolve = resolve20;
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((resolve17, reject) => {
13915
+ return new Promise((resolve20, 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
- resolve17();
13923
+ resolve20();
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((resolve17) => {
14704
+ return new Promise((resolve20) => {
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
- resolve17({ status: "failure", error: sizeError });
14723
+ resolve20({ 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
- resolve17({
14731
+ resolve20({
14732
14732
  status: "success",
14733
14733
  data: Buffer.concat(responseData)
14734
14734
  });
14735
14735
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
14736
- resolve17({
14736
+ resolve20({
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
- resolve17({
14742
+ resolve20({
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
- resolve17({
14750
+ resolve20({
14751
14751
  status: "success"
14752
14752
  });
14753
14753
  } else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
14754
- resolve17({
14754
+ resolve20({
14755
14755
  status: "retryable",
14756
14756
  error,
14757
14757
  retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
14758
14758
  });
14759
14759
  } else {
14760
- resolve17({
14760
+ resolve20({
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
- resolve17({
14769
+ resolve20({
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
- resolve17({
14776
+ resolve20({
14777
14777
  status: "retryable",
14778
14778
  error
14779
14779
  });
14780
14780
  } else {
14781
- resolve17({
14781
+ resolve20({
14782
14782
  status: "failure",
14783
14783
  error
14784
14784
  });
14785
14785
  }
14786
14786
  });
14787
14787
  compressAndSend(req, compression, data, (error) => {
14788
- resolve17({
14788
+ resolve20({
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((resolve17, reject) => {
14878
+ return new Promise((resolve20, reject) => {
14879
14879
  setTimeout(() => {
14880
- this._transport.send(data, timeoutMillis).then(resolve17, reject);
14880
+ this._transport.send(data, timeoutMillis).then(resolve20, 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, path30) {
15015
+ function appendResourcePathToUrl(url, path32) {
15016
15016
  try {
15017
15017
  new URL(url);
15018
15018
  } catch {
@@ -15022,11 +15022,11 @@ function appendResourcePathToUrl(url, path30) {
15022
15022
  if (!url.endsWith("/")) {
15023
15023
  url = url + "/";
15024
15024
  }
15025
- url += path30;
15025
+ url += path32;
15026
15026
  try {
15027
15027
  new URL(url);
15028
15028
  } catch {
15029
- diag2.warn(`Configuration: Provided URL appended with '${path30}' is not a valid URL, using 'undefined' instead of '${url}'`);
15029
+ diag2.warn(`Configuration: Provided URL appended with '${path32}' is not a valid URL, using 'undefined' instead of '${url}'`);
15030
15030
  return void 0;
15031
15031
  }
15032
15032
  return url;
@@ -15137,7 +15137,7 @@ var OTLPLogExporter = class extends OTLPExporterBase {
15137
15137
  init_esm();
15138
15138
 
15139
15139
  // ../telemetry/src/debug.ts
15140
- import * as fs5 from "node:fs";
15140
+ import * as fs6 from "node:fs";
15141
15141
 
15142
15142
  // ../telemetry/src/paths.ts
15143
15143
  import * as path7 from "node:path";
@@ -15163,6 +15163,7 @@ function resolveProjectRoot(startDir) {
15163
15163
  }
15164
15164
 
15165
15165
  // ../configuration-core/src/paths.ts
15166
+ import * as fs3 from "node:fs";
15166
15167
  import * as os from "node:os";
15167
15168
  import * as path3 from "node:path";
15168
15169
  function nonEmpty(value) {
@@ -15174,6 +15175,16 @@ function resolveHomeDir(options = {}) {
15174
15175
  if (options.homeDir) return options.homeDir;
15175
15176
  return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
15176
15177
  }
15178
+ function isHomeDir(dir, options = {}) {
15179
+ return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
15180
+ }
15181
+ function canonicalPath(p) {
15182
+ try {
15183
+ return fs3.realpathSync.native(p);
15184
+ } catch {
15185
+ return path3.resolve(p);
15186
+ }
15187
+ }
15177
15188
  function argentHomeDir() {
15178
15189
  return path3.join(resolveHomeDir(), ".argent");
15179
15190
  }
@@ -15190,11 +15201,11 @@ function configFilePath(scope = "global", options = {}) {
15190
15201
 
15191
15202
  // ../configuration-core/src/config.ts
15192
15203
  import * as crypto from "node:crypto";
15193
- import * as fs3 from "node:fs";
15204
+ import * as fs4 from "node:fs";
15194
15205
  import * as path4 from "node:path";
15195
15206
  function readConfigObject(scope = "global", options = {}) {
15196
15207
  try {
15197
- const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
15208
+ const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
15198
15209
  const json = JSON.parse(raw);
15199
15210
  if (json && typeof json === "object" && !Array.isArray(json)) {
15200
15211
  return json;
@@ -15214,9 +15225,9 @@ function acquireConfigLock(finalPath) {
15214
15225
  const deadline = Date.now() + LOCK_MAX_WAIT_MS;
15215
15226
  for (; ; ) {
15216
15227
  try {
15217
- const fd = fs3.openSync(lockPath, "wx", 384);
15228
+ const fd = fs4.openSync(lockPath, "wx", 384);
15218
15229
  try {
15219
- fs3.writeSync(fd, `${process.pid}
15230
+ fs4.writeSync(fd, `${process.pid}
15220
15231
  `);
15221
15232
  } catch {
15222
15233
  }
@@ -15224,8 +15235,8 @@ function acquireConfigLock(finalPath) {
15224
15235
  } catch (err) {
15225
15236
  if (err.code !== "EEXIST") return null;
15226
15237
  try {
15227
- if (Date.now() - fs3.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
15228
- fs3.unlinkSync(lockPath);
15238
+ if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
15239
+ fs4.unlinkSync(lockPath);
15229
15240
  continue;
15230
15241
  }
15231
15242
  } catch {
@@ -15237,35 +15248,35 @@ function acquireConfigLock(finalPath) {
15237
15248
  }
15238
15249
  function releaseConfigLock(lock) {
15239
15250
  try {
15240
- fs3.closeSync(lock.fd);
15251
+ fs4.closeSync(lock.fd);
15241
15252
  } catch {
15242
15253
  }
15243
15254
  try {
15244
- fs3.unlinkSync(lock.lockPath);
15255
+ fs4.unlinkSync(lock.lockPath);
15245
15256
  } catch {
15246
15257
  }
15247
15258
  }
15248
15259
  function updateConfig(mutate, scope = "global", options = {}) {
15249
15260
  const dir = configDir(scope, options);
15250
- fs3.mkdirSync(dir, { recursive: true });
15261
+ fs4.mkdirSync(dir, { recursive: true });
15251
15262
  const finalPath = configFilePath(scope, options);
15252
15263
  const lock = acquireConfigLock(finalPath);
15253
15264
  try {
15254
15265
  const next = readConfigObject(scope, options);
15255
15266
  mutate(next);
15256
15267
  const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
15257
- const fd = fs3.openSync(tmpPath, "wx", 384);
15268
+ const fd = fs4.openSync(tmpPath, "wx", 384);
15258
15269
  try {
15259
- fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
15260
- fs3.fsyncSync(fd);
15270
+ fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
15271
+ fs4.fsyncSync(fd);
15261
15272
  } finally {
15262
- fs3.closeSync(fd);
15273
+ fs4.closeSync(fd);
15263
15274
  }
15264
15275
  try {
15265
- fs3.renameSync(tmpPath, finalPath);
15276
+ fs4.renameSync(tmpPath, finalPath);
15266
15277
  } catch (err) {
15267
15278
  try {
15268
- fs3.unlinkSync(tmpPath);
15279
+ fs4.unlinkSync(tmpPath);
15269
15280
  } catch {
15270
15281
  }
15271
15282
  throw err;
@@ -15277,7 +15288,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
15277
15288
 
15278
15289
  // ../configuration-core/src/secrets.ts
15279
15290
  var import_dotenv = __toESM(require_dist(), 1);
15280
- import * as fs4 from "node:fs";
15291
+ import * as fs5 from "node:fs";
15281
15292
  import * as path5 from "node:path";
15282
15293
 
15283
15294
  // ../configuration-core/src/config-schema.ts
@@ -15439,8 +15450,8 @@ function emitDebugPayload(payload) {
15439
15450
  } catch {
15440
15451
  }
15441
15452
  try {
15442
- fs5.mkdirSync(argentHomeDir(), { recursive: true });
15443
- fs5.appendFileSync(debugLogPath(), line + "\n");
15453
+ fs6.mkdirSync(argentHomeDir(), { recursive: true });
15454
+ fs6.appendFileSync(debugLogPath(), line + "\n");
15444
15455
  } catch {
15445
15456
  }
15446
15457
  }
@@ -15624,11 +15635,11 @@ var SCRIPT_FILE_NAME_PATTERN = new RegExp(
15624
15635
  );
15625
15636
 
15626
15637
  // ../registry/src/flow-file-refs.ts
15627
- import * as fs7 from "node:fs/promises";
15638
+ import * as fs8 from "node:fs/promises";
15628
15639
  import * as path9 from "node:path";
15629
15640
 
15630
15641
  // ../registry/src/e2e-dirs.ts
15631
- import * as fs6 from "node:fs/promises";
15642
+ import * as fs7 from "node:fs/promises";
15632
15643
  import * as path8 from "node:path";
15633
15644
  var E2E_DIR = path8.join(".argent", "e2e");
15634
15645
  var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
@@ -16503,9 +16514,9 @@ function isReplitAgent(env) {
16503
16514
  }
16504
16515
  var DEVIN_MARKER_PATH = "/opt/.devin";
16505
16516
  var JULES_MARKER_PATH = "/opt/environment_summary.sh";
16506
- function safeExists(fileExists, path30) {
16517
+ function safeExists(fileExists, path32) {
16507
16518
  try {
16508
- return fileExists(path30);
16519
+ return fileExists(path32);
16509
16520
  } catch {
16510
16521
  return false;
16511
16522
  }
@@ -16925,7 +16936,7 @@ function isCi(env = process.env) {
16925
16936
  var SESSION_ID = randomUUID4();
16926
16937
  function readCliVersion() {
16927
16938
  if (true) {
16928
- return "0.34.1-next.29";
16939
+ return "0.34.1-next.30";
16929
16940
  }
16930
16941
  return "0.0.0";
16931
16942
  }
@@ -16958,7 +16969,7 @@ function getBaseProps(runtime) {
16958
16969
 
16959
16970
  // ../telemetry/src/identity.ts
16960
16971
  import * as crypto2 from "node:crypto";
16961
- import * as fs8 from "node:fs";
16972
+ import * as fs9 from "node:fs";
16962
16973
  import * as path10 from "node:path";
16963
16974
  var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
16964
16975
  var cached = null;
@@ -17066,17 +17077,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
17066
17077
  function isCorruptIdFile(filePath) {
17067
17078
  let isRegularFile;
17068
17079
  try {
17069
- isRegularFile = fs8.lstatSync(filePath).isFile();
17080
+ isRegularFile = fs9.lstatSync(filePath).isFile();
17070
17081
  } catch {
17071
17082
  return false;
17072
17083
  }
17073
17084
  return isRegularFile && tryReadId(filePath) === null;
17074
17085
  }
17075
17086
  function writeIdFileAtomic(finalPath, id) {
17076
- fs8.mkdirSync(argentHomeDir(), { recursive: true });
17087
+ fs9.mkdirSync(argentHomeDir(), { recursive: true });
17077
17088
  let occupant;
17078
17089
  try {
17079
- occupant = fs8.lstatSync(finalPath);
17090
+ occupant = fs9.lstatSync(finalPath);
17080
17091
  } catch (err) {
17081
17092
  if (err.code !== "ENOENT") throw err;
17082
17093
  }
@@ -17087,24 +17098,24 @@ function writeIdFileAtomic(finalPath, id) {
17087
17098
  argentHomeDir(),
17088
17099
  `.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
17089
17100
  );
17090
- const fd = fs8.openSync(tmpPath, "wx", 384);
17101
+ const fd = fs9.openSync(tmpPath, "wx", 384);
17091
17102
  try {
17092
17103
  try {
17093
- fs8.writeSync(fd, id);
17094
- fs8.fsyncSync(fd);
17104
+ fs9.writeSync(fd, id);
17105
+ fs9.fsyncSync(fd);
17095
17106
  } finally {
17096
- fs8.closeSync(fd);
17107
+ fs9.closeSync(fd);
17097
17108
  }
17098
- fs8.renameSync(tmpPath, finalPath);
17109
+ fs9.renameSync(tmpPath, finalPath);
17099
17110
  } finally {
17100
17111
  try {
17101
- fs8.unlinkSync(tmpPath);
17112
+ fs9.unlinkSync(tmpPath);
17102
17113
  } catch {
17103
17114
  }
17104
17115
  }
17105
17116
  }
17106
17117
  function mintRandomId(finalPath) {
17107
- fs8.mkdirSync(argentHomeDir(), { recursive: true });
17118
+ fs9.mkdirSync(argentHomeDir(), { recursive: true });
17108
17119
  let value = crypto2.randomUUID();
17109
17120
  for (let attempt = 0; attempt < 3; attempt++) {
17110
17121
  const tmpPath = path10.join(
@@ -17113,19 +17124,19 @@ function mintRandomId(finalPath) {
17113
17124
  );
17114
17125
  let fd;
17115
17126
  try {
17116
- fd = fs8.openSync(tmpPath, "wx", 384);
17127
+ fd = fs9.openSync(tmpPath, "wx", 384);
17117
17128
  } catch (err) {
17118
17129
  if (err.code === "EEXIST") continue;
17119
17130
  throw err;
17120
17131
  }
17121
17132
  try {
17122
17133
  try {
17123
- fs8.writeSync(fd, value);
17124
- fs8.fsyncSync(fd);
17134
+ fs9.writeSync(fd, value);
17135
+ fs9.fsyncSync(fd);
17125
17136
  } finally {
17126
- fs8.closeSync(fd);
17137
+ fs9.closeSync(fd);
17127
17138
  }
17128
- fs8.linkSync(tmpPath, finalPath);
17139
+ fs9.linkSync(tmpPath, finalPath);
17129
17140
  cached = { path: finalPath, id: value };
17130
17141
  return value;
17131
17142
  } catch (err) {
@@ -17144,7 +17155,7 @@ function mintRandomId(finalPath) {
17144
17155
  throw err;
17145
17156
  } finally {
17146
17157
  try {
17147
- fs8.unlinkSync(tmpPath);
17158
+ fs9.unlinkSync(tmpPath);
17148
17159
  } catch {
17149
17160
  }
17150
17161
  }
@@ -17157,7 +17168,7 @@ function claimCorruptOccupant(finalPath) {
17157
17168
  `.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
17158
17169
  );
17159
17170
  try {
17160
- fs8.renameSync(finalPath, claimed);
17171
+ fs9.renameSync(finalPath, claimed);
17161
17172
  } catch {
17162
17173
  return null;
17163
17174
  }
@@ -17166,7 +17177,7 @@ function claimCorruptOccupant(finalPath) {
17166
17177
  grabbed = tryReadId(claimed);
17167
17178
  } finally {
17168
17179
  try {
17169
- fs8.unlinkSync(claimed);
17180
+ fs9.unlinkSync(claimed);
17170
17181
  } catch {
17171
17182
  }
17172
17183
  }
@@ -17175,7 +17186,7 @@ function claimCorruptOccupant(finalPath) {
17175
17186
  function deleteAnonId() {
17176
17187
  cached = null;
17177
17188
  try {
17178
- fs8.unlinkSync(identityFilePath());
17189
+ fs9.unlinkSync(identityFilePath());
17179
17190
  } catch (err) {
17180
17191
  if (err.code !== "ENOENT") throw err;
17181
17192
  }
@@ -17183,9 +17194,9 @@ function deleteAnonId() {
17183
17194
  function tryReadId(filePath) {
17184
17195
  let raw;
17185
17196
  try {
17186
- const stats = fs8.lstatSync(filePath);
17197
+ const stats = fs9.lstatSync(filePath);
17187
17198
  if (!stats.isFile()) return null;
17188
- raw = fs8.readFileSync(filePath, "utf8");
17199
+ raw = fs9.readFileSync(filePath, "utf8");
17189
17200
  } catch (err) {
17190
17201
  if (err.code === "ENOENT") return null;
17191
17202
  return null;
@@ -17200,7 +17211,7 @@ import { execFileSync, spawn } from "node:child_process";
17200
17211
 
17201
17212
  // ../native-devtools-ios/src/index.ts
17202
17213
  import * as path11 from "node:path";
17203
- import * as fs9 from "node:fs";
17214
+ import * as fs10 from "node:fs";
17204
17215
  var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path11.join(__dirname, "..", "dylibs");
17205
17216
  var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path11.join(__dirname, "..", "bin");
17206
17217
  var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path11.join(DYLIB_DIR, "tcp");
@@ -17220,9 +17231,9 @@ function platformBinDir() {
17220
17231
  function simulatorServerBinaryPath() {
17221
17232
  const binaryName = simulatorServerBinaryName();
17222
17233
  const p = path11.join(platformBinDir(), binaryName);
17223
- if (!fs9.existsSync(p)) {
17234
+ if (!fs10.existsSync(p)) {
17224
17235
  const flat = path11.join(BIN_DIR, binaryName);
17225
- const migrationHint = fs9.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.` : "";
17236
+ 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.` : "";
17226
17237
  throw new Error(
17227
17238
  `simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
17228
17239
  );
@@ -17251,12 +17262,12 @@ function resolveHostFingerprint() {
17251
17262
  }
17252
17263
  }
17253
17264
  function resolveHostFingerprintAsync() {
17254
- return new Promise((resolve17) => {
17265
+ return new Promise((resolve20) => {
17255
17266
  let binary;
17256
17267
  try {
17257
17268
  binary = simulatorServerBinaryPath();
17258
17269
  } catch {
17259
- resolve17(null);
17270
+ resolve20(null);
17260
17271
  return;
17261
17272
  }
17262
17273
  let settled = false;
@@ -17269,7 +17280,7 @@ function resolveHostFingerprintAsync() {
17269
17280
  child?.kill("SIGKILL");
17270
17281
  } catch {
17271
17282
  }
17272
- resolve17(value);
17283
+ resolve20(value);
17273
17284
  };
17274
17285
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
17275
17286
  watchdog.unref?.();
@@ -17302,14 +17313,15 @@ function resolveHostFingerprintAsync() {
17302
17313
  }
17303
17314
 
17304
17315
  // ../telemetry/src/consent.ts
17305
- import * as fs10 from "node:fs";
17316
+ import * as fs11 from "node:fs";
17317
+ import * as path12 from "node:path";
17306
17318
  var cache = /* @__PURE__ */ new Map();
17307
17319
  var sessionOverride = null;
17308
17320
  function readConfigOverrideAt(filePath) {
17309
17321
  const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
17310
17322
  let stats;
17311
17323
  try {
17312
- stats = fs10.lstatSync(filePath);
17324
+ stats = fs11.lstatSync(filePath);
17313
17325
  } catch {
17314
17326
  cache.set(filePath, miss);
17315
17327
  return null;
@@ -17326,7 +17338,7 @@ function readConfigOverrideAt(filePath) {
17326
17338
  }
17327
17339
  let parsedEnabled = null;
17328
17340
  try {
17329
- const raw = fs10.readFileSync(filePath, "utf8");
17341
+ const raw = fs11.readFileSync(filePath, "utf8");
17330
17342
  const json = JSON.parse(raw);
17331
17343
  if (json && typeof json === "object") {
17332
17344
  const t2 = json.telemetry;
@@ -17344,7 +17356,8 @@ function readPersistedConsent(cwd) {
17344
17356
  const globalPath = configFilePath("global");
17345
17357
  const projectPath = configFilePath("project", { cwd });
17346
17358
  const global2 = readConfigOverrideAt(globalPath);
17347
- const project = projectPath === globalPath ? null : readConfigOverrideAt(projectPath);
17359
+ const projectRoot = path12.dirname(path12.dirname(projectPath));
17360
+ const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
17348
17361
  if (project === false && global2 === false) {
17349
17362
  return { enabled: false, detail: "config.json (project and global)" };
17350
17363
  }
@@ -17539,7 +17552,7 @@ var DRAIN_GRACE_MS = 250;
17539
17552
  async function raceDrain(client2, timeoutMs) {
17540
17553
  await Promise.race([
17541
17554
  client2.shutdown(timeoutMs),
17542
- new Promise((resolve17) => setTimeout(resolve17, timeoutMs + DRAIN_GRACE_MS).unref())
17555
+ new Promise((resolve20) => setTimeout(resolve20, timeoutMs + DRAIN_GRACE_MS).unref())
17543
17556
  ]);
17544
17557
  }
17545
17558
  async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
@@ -17559,10 +17572,10 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
17559
17572
  }
17560
17573
 
17561
17574
  // ../argent-installer/src/mcp-configs.ts
17562
- import * as fs17 from "node:fs";
17563
- import * as path18 from "node:path";
17575
+ import * as fs18 from "node:fs";
17576
+ import * as path19 from "node:path";
17564
17577
  import { execFileSync as execFileSync4 } from "node:child_process";
17565
- import { homedir as homedir4 } from "node:os";
17578
+ import { homedir as homedir5 } from "node:os";
17566
17579
 
17567
17580
  // ../argent-installer/src/constants.ts
17568
17581
  var PACKAGE_NAME = "@swmansion/argent";
@@ -17575,11 +17588,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
17575
17588
 
17576
17589
  // ../argent-installer/src/utils.ts
17577
17590
  var import_semver3 = __toESM(require_semver2(), 1);
17578
- import * as fs16 from "node:fs";
17579
- import * as path17 from "node:path";
17591
+ import * as fs17 from "node:fs";
17592
+ import * as path18 from "node:path";
17580
17593
  import * as dns from "node:dns";
17581
17594
  import { createHash as createHash2 } from "node:crypto";
17582
- import * as os2 from "node:os";
17595
+ import * as os3 from "node:os";
17583
17596
  import { execFileSync as execFileSync3, execSync } from "node:child_process";
17584
17597
 
17585
17598
  // ../../node_modules/smol-toml/dist/error.js
@@ -19322,12 +19335,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
19322
19335
  }
19323
19336
  return result;
19324
19337
  }
19325
- function findNodeAtLocation(root, path30) {
19338
+ function findNodeAtLocation(root, path32) {
19326
19339
  if (!root) {
19327
19340
  return void 0;
19328
19341
  }
19329
19342
  let node = root;
19330
- for (let segment of path30) {
19343
+ for (let segment of path32) {
19331
19344
  if (typeof segment === "string") {
19332
19345
  if (node.type !== "object" || !Array.isArray(node.children)) {
19333
19346
  return void 0;
@@ -19681,14 +19694,14 @@ function getNodeType(value) {
19681
19694
 
19682
19695
  // ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
19683
19696
  function setProperty(text2, originalPath, value, options) {
19684
- const path30 = originalPath.slice();
19697
+ const path32 = originalPath.slice();
19685
19698
  const errors = [];
19686
19699
  const root = parseTree(text2, errors);
19687
19700
  let parent = void 0;
19688
19701
  let lastSegment = void 0;
19689
- while (path30.length > 0) {
19690
- lastSegment = path30.pop();
19691
- parent = findNodeAtLocation(root, path30);
19702
+ while (path32.length > 0) {
19703
+ lastSegment = path32.pop();
19704
+ parent = findNodeAtLocation(root, path32);
19692
19705
  if (parent === void 0 && value !== void 0) {
19693
19706
  if (typeof lastSegment === "string") {
19694
19707
  value = { [lastSegment]: value };
@@ -19874,8 +19887,8 @@ var ParseErrorCode;
19874
19887
  ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
19875
19888
  ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
19876
19889
  })(ParseErrorCode || (ParseErrorCode = {}));
19877
- function modify(text2, path30, value, options) {
19878
- return setProperty(text2, path30, value, options);
19890
+ function modify(text2, path32, value, options) {
19891
+ return setProperty(text2, path32, value, options);
19879
19892
  }
19880
19893
  function applyEdits(text2, edits) {
19881
19894
  let sortedEdits = edits.slice(0).sort((a2, b) => {
@@ -19899,146 +19912,29 @@ function applyEdits(text2, edits) {
19899
19912
  }
19900
19913
 
19901
19914
  // ../argent-installer/src/package-root.ts
19902
- import * as fs11 from "node:fs";
19903
- import * as path12 from "node:path";
19904
- function resolvePackageRoot(dirname19) {
19905
- let current = path12.resolve(dirname19);
19915
+ import * as fs12 from "node:fs";
19916
+ import * as path13 from "node:path";
19917
+ function resolvePackageRoot(dirname20) {
19918
+ let current = path13.resolve(dirname20);
19906
19919
  while (true) {
19907
- if (fs11.existsSync(path12.join(current, "package.json"))) return current;
19908
- const parent = path12.dirname(current);
19909
- if (parent === current) return path12.resolve(dirname19);
19920
+ if (fs12.existsSync(path13.join(current, "package.json"))) return current;
19921
+ const parent = path13.dirname(current);
19922
+ if (parent === current) return path13.resolve(dirname20);
19910
19923
  current = parent;
19911
19924
  }
19912
19925
  }
19913
19926
 
19914
19927
  // ../argent-installer/src/package-manager.ts
19915
- import * as fs12 from "node:fs";
19916
- import * as path13 from "node:path";
19917
- function formatShellCommand(cmd) {
19918
- const parts = [cmd.bin, ...cmd.args.map((a2) => a2.includes(" ") ? `"${a2}"` : a2)];
19919
- return parts.join(" ");
19920
- }
19921
- function shellQuotePath(dir) {
19922
- return "'" + dir.split("'").join("'\\''") + "'";
19923
- }
19924
- function detectPackageManager() {
19925
- const agent = process.env.npm_config_user_agent ?? "";
19926
- if (agent.startsWith("yarn")) return "yarn";
19927
- if (agent.startsWith("pnpm")) return "pnpm";
19928
- if (agent.startsWith("bun")) return "bun";
19929
- return "npm";
19930
- }
19931
- function asKnownPm(name) {
19932
- return name === "npm" || name === "yarn" || name === "pnpm" || name === "bun" ? name : null;
19933
- }
19934
- function pmFromPackageManagerField(dir) {
19935
- try {
19936
- const pkg = JSON.parse(fs12.readFileSync(path13.join(dir, "package.json"), "utf8"));
19937
- if (typeof pkg.packageManager === "string") {
19938
- return asKnownPm(pkg.packageManager.split("@")[0]);
19939
- }
19940
- return null;
19941
- } catch {
19942
- return null;
19943
- }
19944
- }
19945
- function pmFromDevEngines(dir) {
19946
- try {
19947
- const pkg = JSON.parse(fs12.readFileSync(path13.join(dir, "package.json"), "utf8"));
19948
- const devEnginesPm = pkg.devEngines?.packageManager;
19949
- const names = /* @__PURE__ */ new Set();
19950
- for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
19951
- const name = asKnownPm(entry?.name);
19952
- if (name) names.add(name);
19953
- }
19954
- return names.size === 1 ? [...names][0] : null;
19955
- } catch {
19956
- return null;
19957
- }
19958
- }
19959
- function pmFromLockfile(dir) {
19960
- const has = (file) => fs12.existsSync(path13.join(dir, file));
19961
- if (has("pnpm-lock.yaml")) return "pnpm";
19962
- if (has("yarn.lock")) return "yarn";
19963
- if (has("bun.lock") || has("bun.lockb")) return "bun";
19964
- if (has("package-lock.json") || has("npm-shrinkwrap.json")) return "npm";
19965
- return null;
19966
- }
19967
- function pmFromWorkspaceMarker(dir) {
19968
- return fs12.existsSync(path13.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
19969
- }
19970
- function detectProjectPackageManager(projectRoot) {
19971
- let dir = path13.resolve(projectRoot);
19972
- for (; ; ) {
19973
- const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
19974
- if (pm) return pm;
19975
- if (fs12.existsSync(path13.join(dir, ".git"))) break;
19976
- const parent = path13.dirname(dir);
19977
- if (parent === dir) break;
19978
- dir = parent;
19979
- }
19980
- return detectPackageManager();
19981
- }
19982
- function globalInstallCommand(pm, pkg) {
19983
- switch (pm) {
19984
- case "yarn":
19985
- return { bin: "yarn", args: ["global", "add", pkg] };
19986
- case "pnpm":
19987
- return { bin: "pnpm", args: ["add", "-g", pkg] };
19988
- case "bun":
19989
- return { bin: "bun", args: ["add", "-g", pkg] };
19990
- default:
19991
- return { bin: "npm", args: ["install", "-g", pkg] };
19992
- }
19993
- }
19994
- function globalUninstallCommand(pm, pkg) {
19995
- switch (pm) {
19996
- case "yarn":
19997
- return { bin: "yarn", args: ["global", "remove", pkg] };
19998
- case "pnpm":
19999
- return { bin: "pnpm", args: ["remove", "-g", pkg] };
20000
- case "bun":
20001
- return { bin: "bun", args: ["remove", "-g", pkg] };
20002
- default:
20003
- return { bin: "npm", args: ["uninstall", "-g", pkg] };
20004
- }
20005
- }
20006
- function localInstallCommand(pm, pkg) {
20007
- switch (pm) {
20008
- case "yarn":
20009
- return { bin: "yarn", args: ["add", "--dev", pkg] };
20010
- case "pnpm":
20011
- return { bin: "pnpm", args: ["add", "-D", "--ignore-workspace-root-check", pkg] };
20012
- case "bun":
20013
- return { bin: "bun", args: ["add", "-d", pkg] };
20014
- default:
20015
- return { bin: "npm", args: ["install", "--save-dev", pkg] };
20016
- }
20017
- }
20018
- function projectInstallCommand(pm) {
20019
- switch (pm) {
20020
- case "yarn":
20021
- return { bin: "yarn", args: ["install"] };
20022
- case "pnpm":
20023
- return { bin: "pnpm", args: ["install"] };
20024
- case "bun":
20025
- return { bin: "bun", args: ["install"] };
20026
- default:
20027
- return { bin: "npm", args: ["install"] };
20028
- }
20029
- }
20030
- function localUninstallCommand(pm, pkg) {
20031
- switch (pm) {
20032
- case "yarn":
20033
- return { bin: "yarn", args: ["remove", pkg] };
20034
- case "pnpm":
20035
- return { bin: "pnpm", args: ["remove", pkg] };
20036
- case "bun":
20037
- return { bin: "bun", args: ["remove", pkg] };
20038
- default:
20039
- return { bin: "npm", args: ["uninstall", pkg] };
20040
- }
20041
- }
19928
+ import * as fs15 from "node:fs";
19929
+ import * as os2 from "node:os";
19930
+ import * as path16 from "node:path";
19931
+
19932
+ // ../argent-installer/src/topology.ts
19933
+ var import_semver2 = __toESM(require_semver2(), 1);
19934
+ import * as fs14 from "node:fs";
19935
+ import * as path15 from "node:path";
19936
+ import { createRequire } from "node:module";
19937
+ import { execFileSync as execFileSync2 } from "node:child_process";
20042
19938
 
20043
19939
  // ../argent-installer/src/preflight.ts
20044
19940
  import * as fs13 from "node:fs";
@@ -20051,11 +19947,6 @@ function isYarnPnp(projectRoot) {
20051
19947
  }
20052
19948
 
20053
19949
  // ../argent-installer/src/topology.ts
20054
- var import_semver2 = __toESM(require_semver2(), 1);
20055
- import * as fs14 from "node:fs";
20056
- import * as path15 from "node:path";
20057
- import { createRequire } from "node:module";
20058
- import { execFileSync as execFileSync2 } from "node:child_process";
20059
19950
  var TEMP_RUNNER_PATTERNS = [
20060
19951
  // npx: <npm cache>/_npx/<hash>/node_modules/.bin
20061
19952
  /\/_npx\//,
@@ -20076,24 +19967,75 @@ function isTempRunnerPath(binaryPath) {
20076
19967
  const slashed = binaryPath.split("\\").join("/");
20077
19968
  return TEMP_RUNNER_PATTERNS.some((pattern) => pattern.test(slashed));
20078
19969
  }
20079
- function getGlobalBinaryPath() {
19970
+ function isProjectBinPath(binaryPath) {
19971
+ const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
19972
+ const binDir = norm(path15.dirname(path15.resolve(binaryPath)));
19973
+ const prefix = process.env.npm_config_local_prefix;
19974
+ if (prefix && norm(path15.join(prefix, "node_modules", ".bin")) === binDir) return true;
19975
+ for (let dir = path15.resolve(process.cwd()); ; dir = path15.dirname(dir)) {
19976
+ if (norm(path15.join(dir, "node_modules", ".bin")) === binDir) return true;
19977
+ if (path15.dirname(dir) === dir) return false;
19978
+ }
19979
+ }
19980
+ function getPermanentBinaryPaths() {
20080
19981
  try {
20081
19982
  const [cmd, args] = process.platform === "win32" ? ["where", [MCP_BINARY_NAME]] : ["which", ["-a", MCP_BINARY_NAME]];
20082
19983
  const output = execFileSync2(cmd, args, {
20083
19984
  encoding: "utf8",
20084
19985
  stdio: ["ignore", "pipe", "ignore"]
20085
19986
  });
20086
- return output.split(/\r?\n/).map((line) => line.trim()).filter(Boolean).find((line) => !isTempRunnerPath(line)) ?? null;
19987
+ return output.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !isTempRunnerPath(line));
20087
19988
  } catch {
20088
- return null;
19989
+ return [];
20089
19990
  }
20090
19991
  }
19992
+ function getGlobalBinaryPaths() {
19993
+ return getPermanentBinaryPaths().filter((line) => !isProjectBinPath(line));
19994
+ }
19995
+ function isArgentOnPath() {
19996
+ return getPermanentBinaryPaths().length > 0;
19997
+ }
19998
+ function getRemainingGlobalBinaryPath() {
19999
+ for (const binaryPath of getGlobalBinaryPaths()) {
20000
+ if (process.platform === "win32" || globalPackageRootOf(binaryPath)) return binaryPath;
20001
+ try {
20002
+ execFileSync2(binaryPath, ["--version"], { stdio: "ignore", timeout: 1e4 });
20003
+ return binaryPath;
20004
+ } catch {
20005
+ }
20006
+ }
20007
+ return null;
20008
+ }
20091
20009
  function isGloballyInstalled() {
20092
- return getGlobalBinaryPath() !== null;
20010
+ return getRemainingGlobalBinaryPath() !== null;
20093
20011
  }
20094
20012
  function getGloballyInstalledPackageRoot() {
20095
- const binaryPath = getGlobalBinaryPath();
20096
- if (!binaryPath) return null;
20013
+ const binaryPath = getRemainingGlobalBinaryPath();
20014
+ return binaryPath ? globalPackageRootOf(binaryPath) : null;
20015
+ }
20016
+ function readShimScript(binaryPath) {
20017
+ try {
20018
+ if (fs14.statSync(binaryPath).size > 64 * 1024) return null;
20019
+ return fs14.readFileSync(binaryPath, "utf8");
20020
+ } catch {
20021
+ return null;
20022
+ }
20023
+ }
20024
+ function shimTargetOf(binaryPath) {
20025
+ const shim = readShimScript(binaryPath);
20026
+ if (!shim) return null;
20027
+ const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
20028
+ if (trailer) return trailer[1].trim();
20029
+ const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
20030
+ return relative5 ? path15.resolve(canonicalPath(path15.dirname(binaryPath)), relative5[1]) : null;
20031
+ }
20032
+ function globalPackageRootOf(binaryPath) {
20033
+ const root = packageRootOf(binaryPath);
20034
+ if (root) return root;
20035
+ const target = shimTargetOf(binaryPath);
20036
+ return target ? packageRootOf(target) : null;
20037
+ }
20038
+ function packageRootOf(binaryPath) {
20097
20039
  try {
20098
20040
  const realPath = fs14.realpathSync(binaryPath);
20099
20041
  const root = resolvePackageRoot(path15.dirname(realPath));
@@ -20202,16 +20144,208 @@ function getLocalArgentBinRelPath(projectRoot) {
20202
20144
  return path15.relative(root, abs).split(path15.sep).join("/");
20203
20145
  }
20204
20146
 
20147
+ // ../argent-installer/src/package-manager.ts
20148
+ function formatShellCommand(cmd) {
20149
+ const parts = [cmd.bin, ...cmd.args.map((a2) => a2.includes(" ") ? `"${a2}"` : a2)];
20150
+ return parts.join(" ");
20151
+ }
20152
+ function shellQuotePath(dir) {
20153
+ return "'" + dir.split("'").join("'\\''") + "'";
20154
+ }
20155
+ function detectPackageManager() {
20156
+ const agent = process.env.npm_config_user_agent ?? "";
20157
+ if (agent.startsWith("yarn")) return "yarn";
20158
+ if (agent.startsWith("pnpm")) return "pnpm";
20159
+ if (agent.startsWith("bun")) return "bun";
20160
+ return "npm";
20161
+ }
20162
+ var PNPM_GLOBAL_TARGET = new RegExp(
20163
+ String.raw`[\\/]global[\\/]v?\d+[\\/][^"'\s]*node_modules[\\/]` + PACKAGE_NAME.split("/").join(String.raw`[\\/]`) + String.raw`[\\/]`
20164
+ );
20165
+ var BUN_GLOBAL_ROOT = new RegExp(
20166
+ String.raw`[\\/]install[\\/]global[\\/]node_modules[\\/]` + PACKAGE_NAME.split("/").join(String.raw`[\\/]`) + "$"
20167
+ );
20168
+ function detectGlobalPackageManager() {
20169
+ const binaryPath = getRemainingGlobalBinaryPath();
20170
+ if (!binaryPath) return isYarnBerryLauncher() ? "npm" : detectPackageManager();
20171
+ const root = packageRootOf(binaryPath);
20172
+ if (root) {
20173
+ if (isInNpmLayout(binaryPath, root)) return "npm";
20174
+ return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
20175
+ }
20176
+ if (process.platform === "win32") {
20177
+ if (fs15.existsSync(path16.join(npmCopyBeside(path16.dirname(binaryPath)), "package.json"))) {
20178
+ return "npm";
20179
+ }
20180
+ if (fs15.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
20181
+ }
20182
+ const shim = readShimScript(binaryPath);
20183
+ if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
20184
+ if (PNPM_GLOBAL_TARGET.test(shim)) return "pnpm";
20185
+ const target = shimTargetOf(binaryPath);
20186
+ return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
20187
+ }
20188
+ function lockfileOwnerOf(root) {
20189
+ for (let dir = path16.dirname(root); path16.dirname(dir) !== dir; dir = path16.dirname(dir)) {
20190
+ const pm = pmFromLockfile(dir);
20191
+ if (pm) return pm;
20192
+ }
20193
+ return null;
20194
+ }
20195
+ function npmCopyBeside(binDir) {
20196
+ return process.platform === "win32" ? path16.join(binDir, "node_modules", PACKAGE_NAME) : path16.join(path16.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
20197
+ }
20198
+ function isInNpmLayout(binaryPath, root) {
20199
+ const realRoot = canonicalPath(root);
20200
+ let link = binaryPath;
20201
+ for (let hop = 0; hop < 40; hop++) {
20202
+ const binDir = canonicalPath(path16.dirname(link));
20203
+ if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
20204
+ try {
20205
+ link = path16.resolve(binDir, fs15.readlinkSync(link));
20206
+ } catch {
20207
+ return false;
20208
+ }
20209
+ }
20210
+ return false;
20211
+ }
20212
+ function isYarnBerryLauncher() {
20213
+ const agent = process.env.npm_config_user_agent ?? "";
20214
+ return agent.startsWith("yarn") && !agent.startsWith("yarn/1.");
20215
+ }
20216
+ function yarnClassicNote(cmd) {
20217
+ return cmd.bin === "yarn" && cmd.args[0] === "global" && isYarnBerryLauncher() ? " (with Yarn classic, outside this Yarn 2+ project)" : "";
20218
+ }
20219
+ function asKnownPm(name) {
20220
+ return name === "npm" || name === "yarn" || name === "pnpm" || name === "bun" ? name : null;
20221
+ }
20222
+ function pmFromPackageManagerField(dir) {
20223
+ try {
20224
+ const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
20225
+ if (typeof pkg.packageManager === "string") {
20226
+ return asKnownPm(pkg.packageManager.split("@")[0]);
20227
+ }
20228
+ return null;
20229
+ } catch {
20230
+ return null;
20231
+ }
20232
+ }
20233
+ function pmFromDevEngines(dir) {
20234
+ try {
20235
+ const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
20236
+ const devEnginesPm = pkg.devEngines?.packageManager;
20237
+ const names = /* @__PURE__ */ new Set();
20238
+ for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
20239
+ const name = asKnownPm(entry?.name);
20240
+ if (name) names.add(name);
20241
+ }
20242
+ return names.size === 1 ? [...names][0] : null;
20243
+ } catch {
20244
+ return null;
20245
+ }
20246
+ }
20247
+ function pmFromLockfile(dir) {
20248
+ const has = (file) => fs15.existsSync(path16.join(dir, file));
20249
+ if (has("pnpm-lock.yaml")) return "pnpm";
20250
+ if (has("yarn.lock")) return "yarn";
20251
+ if (has("bun.lock") || has("bun.lockb")) return "bun";
20252
+ if (has("package-lock.json") || has("npm-shrinkwrap.json")) return "npm";
20253
+ return null;
20254
+ }
20255
+ function pmFromWorkspaceMarker(dir) {
20256
+ return fs15.existsSync(path16.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
20257
+ }
20258
+ function detectProjectPackageManager(projectRoot) {
20259
+ let dir = path16.resolve(projectRoot);
20260
+ for (; ; ) {
20261
+ const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
20262
+ if (pm) return pm;
20263
+ if (fs15.existsSync(path16.join(dir, ".git"))) break;
20264
+ const parent = path16.dirname(dir);
20265
+ if (parent === dir) break;
20266
+ dir = parent;
20267
+ }
20268
+ return detectPackageManager();
20269
+ }
20270
+ function globalInstallCommand(pm, pkg) {
20271
+ switch (pm) {
20272
+ case "yarn":
20273
+ return { bin: "yarn", args: ["global", "add", pkg] };
20274
+ case "pnpm":
20275
+ return { bin: "pnpm", args: ["add", "-g", pkg] };
20276
+ case "bun":
20277
+ return { bin: "bun", args: ["add", "-g", pkg] };
20278
+ default:
20279
+ return { bin: "npm", args: ["install", "-g", pkg] };
20280
+ }
20281
+ }
20282
+ function globalCommandOptions(pm) {
20283
+ if (pm === "npm") return {};
20284
+ const home = os2.homedir();
20285
+ const cwd = fs15.existsSync(home) ? { cwd: home } : {};
20286
+ if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
20287
+ const { npm_config_prefix: _npmPrefix, ...env } = process.env;
20288
+ return { ...cwd, env };
20289
+ }
20290
+ function globalUninstallCommand(pm, pkg) {
20291
+ switch (pm) {
20292
+ case "yarn":
20293
+ return { bin: "yarn", args: ["global", "remove", pkg] };
20294
+ case "pnpm":
20295
+ return { bin: "pnpm", args: ["remove", "-g", pkg] };
20296
+ case "bun":
20297
+ return { bin: "bun", args: ["remove", "-g", pkg] };
20298
+ default:
20299
+ return { bin: "npm", args: ["uninstall", "-g", pkg] };
20300
+ }
20301
+ }
20302
+ function localInstallCommand(pm, pkg) {
20303
+ switch (pm) {
20304
+ case "yarn":
20305
+ return { bin: "yarn", args: ["add", "--dev", pkg] };
20306
+ case "pnpm":
20307
+ return { bin: "pnpm", args: ["add", "-D", "--ignore-workspace-root-check", pkg] };
20308
+ case "bun":
20309
+ return { bin: "bun", args: ["add", "-d", pkg] };
20310
+ default:
20311
+ return { bin: "npm", args: ["install", "--save-dev", pkg] };
20312
+ }
20313
+ }
20314
+ function projectInstallCommand(pm) {
20315
+ switch (pm) {
20316
+ case "yarn":
20317
+ return { bin: "yarn", args: ["install"] };
20318
+ case "pnpm":
20319
+ return { bin: "pnpm", args: ["install"] };
20320
+ case "bun":
20321
+ return { bin: "bun", args: ["install"] };
20322
+ default:
20323
+ return { bin: "npm", args: ["install"] };
20324
+ }
20325
+ }
20326
+ function localUninstallCommand(pm, pkg) {
20327
+ switch (pm) {
20328
+ case "yarn":
20329
+ return { bin: "yarn", args: ["remove", pkg] };
20330
+ case "pnpm":
20331
+ return { bin: "pnpm", args: ["remove", pkg] };
20332
+ case "bun":
20333
+ return { bin: "bun", args: ["remove", pkg] };
20334
+ default:
20335
+ return { bin: "npm", args: ["uninstall", pkg] };
20336
+ }
20337
+ }
20338
+
20205
20339
  // ../argent-installer/src/install-record.ts
20206
- import * as fs15 from "node:fs";
20207
- import * as path16 from "node:path";
20340
+ import * as fs16 from "node:fs";
20341
+ import * as path17 from "node:path";
20208
20342
  function getInstallRecordPath(projectRoot) {
20209
- return path16.join(projectRoot, ".argent", "install.json");
20343
+ return path17.join(projectRoot, ".argent", "install.json");
20210
20344
  }
20211
20345
  function readInstallRecord(projectRoot) {
20212
20346
  try {
20213
20347
  const parsed = JSON.parse(
20214
- fs15.readFileSync(getInstallRecordPath(projectRoot), "utf8")
20348
+ fs16.readFileSync(getInstallRecordPath(projectRoot), "utf8")
20215
20349
  );
20216
20350
  if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
20217
20351
  return null;
@@ -20221,17 +20355,17 @@ function readInstallRecord(projectRoot) {
20221
20355
  }
20222
20356
  function writeInstallRecord(projectRoot, record) {
20223
20357
  const recordPath = getInstallRecordPath(projectRoot);
20224
- fs15.mkdirSync(path16.dirname(recordPath), { recursive: true });
20225
- fs15.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
20358
+ fs16.mkdirSync(path17.dirname(recordPath), { recursive: true });
20359
+ fs16.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
20226
20360
  }
20227
20361
  function removeInstallRecord(projectRoot) {
20228
20362
  const recordPath = getInstallRecordPath(projectRoot);
20229
20363
  try {
20230
- if (!fs15.existsSync(recordPath)) return false;
20231
- fs15.rmSync(recordPath, { force: true });
20232
- const dir = path16.dirname(recordPath);
20364
+ if (!fs16.existsSync(recordPath)) return false;
20365
+ fs16.rmSync(recordPath, { force: true });
20366
+ const dir = path17.dirname(recordPath);
20233
20367
  try {
20234
- if (fs15.existsSync(dir) && fs15.readdirSync(dir).length === 0) fs15.rmdirSync(dir);
20368
+ if (fs16.existsSync(dir) && fs16.readdirSync(dir).length === 0) fs16.rmdirSync(dir);
20235
20369
  } catch {
20236
20370
  }
20237
20371
  return true;
@@ -20259,9 +20393,9 @@ function resolveInstallModeFromFlags(opts) {
20259
20393
  // ../argent-installer/src/utils.ts
20260
20394
  var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
20261
20395
  function resolveBundledDir(dirName) {
20262
- const packagedDir = path17.join(PACKAGE_ROOT, dirName);
20263
- if (fs16.existsSync(packagedDir)) return packagedDir;
20264
- return path17.resolve(PACKAGE_ROOT, "..", "skills", dirName);
20396
+ const packagedDir = path18.join(PACKAGE_ROOT, dirName);
20397
+ if (fs17.existsSync(packagedDir)) return packagedDir;
20398
+ return path18.resolve(PACKAGE_ROOT, "..", "skills", dirName);
20265
20399
  }
20266
20400
  var SKILLS_DIR = resolveBundledDir("skills");
20267
20401
  var RULES_DIR = resolveBundledDir("rules");
@@ -20273,18 +20407,18 @@ function buildArgentSkillsSource(version) {
20273
20407
  }
20274
20408
  function listBundledSkills(skillsDir = SKILLS_DIR) {
20275
20409
  try {
20276
- return fs16.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs16.existsSync(path17.join(skillsDir, name, "SKILL.md"))).sort();
20410
+ 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();
20277
20411
  } catch {
20278
20412
  return [];
20279
20413
  }
20280
20414
  }
20281
20415
  function getProjectSkillLockPath(cwd = process.cwd()) {
20282
- return path17.join(cwd, "skills-lock.json");
20416
+ return path18.join(cwd, "skills-lock.json");
20283
20417
  }
20284
20418
  function getGlobalSkillLockPath() {
20285
20419
  const xdgStateHome = process.env.XDG_STATE_HOME;
20286
- if (xdgStateHome) return path17.join(xdgStateHome, "skills", ".skill-lock.json");
20287
- return path17.join(os2.homedir(), ".agents", ".skill-lock.json");
20420
+ if (xdgStateHome) return path18.join(xdgStateHome, "skills", ".skill-lock.json");
20421
+ return path18.join(os3.homedir(), ".agents", ".skill-lock.json");
20288
20422
  }
20289
20423
  var ARGENT_SKILL_PREFIX = "argent-";
20290
20424
  var LEGACY_ARGENT_SKILL_NAMES = [
@@ -20390,7 +20524,7 @@ function hashBundledContent(content) {
20390
20524
  }
20391
20525
  function listArgentSkillsInLock(lockPath) {
20392
20526
  try {
20393
- const raw = fs16.readFileSync(lockPath, "utf8");
20527
+ const raw = fs17.readFileSync(lockPath, "utf8");
20394
20528
  const lock = JSON.parse(raw);
20395
20529
  const tracked = lock.skills ?? {};
20396
20530
  return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
@@ -20413,21 +20547,21 @@ var PROJECT_ROOT_MARKERS = [
20413
20547
  "opencode.jsonc",
20414
20548
  "skills-lock.json"
20415
20549
  ];
20416
- function resolveProjectRoot2(startDir, homeDir = os2.homedir()) {
20417
- const initialDir = path17.resolve(startDir);
20418
- const home = path17.resolve(homeDir);
20550
+ function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
20551
+ const initialDir = path18.resolve(startDir);
20552
+ const home = canonicalPath(homeDir);
20419
20553
  let currentDir = initialDir;
20420
20554
  while (true) {
20421
- if (currentDir === home && currentDir !== initialDir) {
20555
+ if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
20422
20556
  return initialDir;
20423
20557
  }
20424
- if (PROJECT_ROOT_MARKERS.some((marker) => fs16.existsSync(path17.join(currentDir, marker)))) {
20558
+ if (PROJECT_ROOT_MARKERS.some((marker) => fs17.existsSync(path18.join(currentDir, marker)))) {
20425
20559
  return currentDir;
20426
20560
  }
20427
- if (fs16.existsSync(path17.join(currentDir, ".git"))) {
20561
+ if (fs17.existsSync(path18.join(currentDir, ".git"))) {
20428
20562
  return currentDir;
20429
20563
  }
20430
- const parentDir = path17.dirname(currentDir);
20564
+ const parentDir = path18.dirname(currentDir);
20431
20565
  if (parentDir === currentDir) {
20432
20566
  return initialDir;
20433
20567
  }
@@ -20435,20 +20569,20 @@ function resolveProjectRoot2(startDir, homeDir = os2.homedir()) {
20435
20569
  }
20436
20570
  }
20437
20571
  function readToml(filePath) {
20438
- if (!fs16.existsSync(filePath)) return {};
20572
+ if (!fs17.existsSync(filePath)) return {};
20439
20573
  try {
20440
- return parse(fs16.readFileSync(filePath, "utf8"));
20574
+ return parse(fs17.readFileSync(filePath, "utf8"));
20441
20575
  } catch {
20442
20576
  return {};
20443
20577
  }
20444
20578
  }
20445
20579
  function writeToml(filePath, data) {
20446
- fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
20447
- fs16.writeFileSync(filePath, stringify(data) + "\n");
20580
+ fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20581
+ fs17.writeFileSync(filePath, stringify(data) + "\n");
20448
20582
  }
20449
20583
  function readYaml(filePath) {
20450
- if (!fs16.existsSync(filePath)) return new import_yaml.Document({});
20451
- const text2 = fs16.readFileSync(filePath, "utf8");
20584
+ if (!fs17.existsSync(filePath)) return new import_yaml.Document({});
20585
+ const text2 = fs17.readFileSync(filePath, "utf8");
20452
20586
  const doc = (0, import_yaml.parseDocument)(text2);
20453
20587
  if (doc.errors.length > 0) {
20454
20588
  const messages = doc.errors.map((e) => e.message).join("; ");
@@ -20457,20 +20591,20 @@ function readYaml(filePath) {
20457
20591
  return doc;
20458
20592
  }
20459
20593
  function writeYaml(filePath, doc) {
20460
- fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
20461
- fs16.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
20594
+ fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20595
+ fs17.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
20462
20596
  }
20463
20597
  function readJson(filePath) {
20464
- if (!fs16.existsSync(filePath)) return {};
20598
+ if (!fs17.existsSync(filePath)) return {};
20465
20599
  try {
20466
- return JSON.parse(fs16.readFileSync(filePath, "utf8"));
20600
+ return JSON.parse(fs17.readFileSync(filePath, "utf8"));
20467
20601
  } catch {
20468
20602
  return {};
20469
20603
  }
20470
20604
  }
20471
20605
  function writeJson(filePath, data) {
20472
- fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
20473
- fs16.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
20606
+ fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20607
+ fs17.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
20474
20608
  }
20475
20609
  var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
20476
20610
  function setJsoncIn(text2, jsonPath, value) {
@@ -20478,8 +20612,8 @@ function setJsoncIn(text2, jsonPath, value) {
20478
20612
  return applyEdits(text2, edits);
20479
20613
  }
20480
20614
  function readJsoncFileRaw(filePath) {
20481
- if (!fs16.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
20482
- let text2 = fs16.readFileSync(filePath, "utf8");
20615
+ if (!fs17.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
20616
+ let text2 = fs17.readFileSync(filePath, "utf8");
20483
20617
  const hadBom = text2.charCodeAt(0) === 65279;
20484
20618
  if (hadBom) text2 = text2.slice(1);
20485
20619
  const wasEmpty = text2.trim() === "";
@@ -20498,26 +20632,26 @@ function isEmptyPlainObject(value) {
20498
20632
  return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
20499
20633
  }
20500
20634
  function removePath(targetPath) {
20501
- const entry = fs16.lstatSync(targetPath, { throwIfNoEntry: false });
20635
+ const entry = fs17.lstatSync(targetPath, { throwIfNoEntry: false });
20502
20636
  if (!entry) return false;
20503
- if (entry.isSymbolicLink()) fs16.unlinkSync(targetPath);
20504
- else fs16.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
20637
+ if (entry.isSymbolicLink()) fs17.unlinkSync(targetPath);
20638
+ else fs17.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
20505
20639
  return true;
20506
20640
  }
20507
20641
  function rmEmptyDir(dirPath) {
20508
20642
  try {
20509
- if (!fs16.existsSync(dirPath)) return false;
20510
- if (!fs16.statSync(dirPath).isDirectory()) return false;
20511
- if (fs16.readdirSync(dirPath).length > 0) return false;
20512
- fs16.rmdirSync(dirPath);
20643
+ if (!fs17.existsSync(dirPath)) return false;
20644
+ if (!fs17.statSync(dirPath).isDirectory()) return false;
20645
+ if (fs17.readdirSync(dirPath).length > 0) return false;
20646
+ fs17.rmdirSync(dirPath);
20513
20647
  return true;
20514
20648
  } catch {
20515
20649
  return false;
20516
20650
  }
20517
20651
  }
20518
20652
  function readJsonc(filePath) {
20519
- if (!fs16.existsSync(filePath)) return {};
20520
- let raw = fs16.readFileSync(filePath, "utf8");
20653
+ if (!fs17.existsSync(filePath)) return {};
20654
+ let raw = fs17.readFileSync(filePath, "utf8");
20521
20655
  if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
20522
20656
  if (raw.trim() === "") return {};
20523
20657
  const parsed = parse3(raw, [], { allowTrailingComma: true });
@@ -20536,18 +20670,18 @@ function editJsoncFile(filePath, jsonPath, value) {
20536
20670
  }
20537
20671
  const parsed = parse3(text2, [], { allowTrailingComma: true });
20538
20672
  if (isEmptyPlainObject(parsed)) {
20539
- fs16.rmSync(filePath, { force: true });
20540
- rmEmptyDir(path17.dirname(filePath));
20673
+ fs17.rmSync(filePath, { force: true });
20674
+ rmEmptyDir(path18.dirname(filePath));
20541
20675
  return;
20542
20676
  }
20543
- fs16.mkdirSync(path17.dirname(filePath), { recursive: true });
20677
+ fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
20544
20678
  const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
20545
- fs16.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
20679
+ fs17.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
20546
20680
  }
20547
20681
  var MAX_SYMLINK_HOPS = 40;
20548
20682
  function realpathOrSelf(p) {
20549
20683
  try {
20550
- return fs16.realpathSync(p);
20684
+ return fs17.realpathSync(p);
20551
20685
  } catch {
20552
20686
  return p;
20553
20687
  }
@@ -20557,13 +20691,13 @@ function resolveLinkedDestination(dest) {
20557
20691
  for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
20558
20692
  let entry;
20559
20693
  try {
20560
- entry = fs16.lstatSync(current);
20694
+ entry = fs17.lstatSync(current);
20561
20695
  } catch {
20562
- return current === dest || dirExists(path17.dirname(current)) ? current : dest;
20696
+ return current === dest || dirExists(path18.dirname(current)) ? current : dest;
20563
20697
  }
20564
20698
  if (!entry.isSymbolicLink()) return current;
20565
20699
  try {
20566
- current = path17.resolve(realpathOrSelf(path17.dirname(current)), fs16.readlinkSync(current));
20700
+ current = path18.resolve(realpathOrSelf(path18.dirname(current)), fs17.readlinkSync(current));
20567
20701
  } catch {
20568
20702
  return dest;
20569
20703
  }
@@ -20571,30 +20705,30 @@ function resolveLinkedDestination(dest) {
20571
20705
  return dest;
20572
20706
  }
20573
20707
  function copyDir(src, dest) {
20574
- if (!fs16.existsSync(src) || !treeHasFiles(src)) return null;
20708
+ if (!fs17.existsSync(src) || !treeHasFiles(src)) return null;
20575
20709
  const target = resolveLinkedDestination(dest);
20576
20710
  copyTree(src, target);
20577
20711
  return target;
20578
20712
  }
20579
20713
  function treeHasFiles(dir) {
20580
- return fs16.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path17.join(dir, entry.name)));
20714
+ return fs17.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path18.join(dir, entry.name)));
20581
20715
  }
20582
20716
  function copyTree(src, dest) {
20583
- const entries = fs16.readdirSync(src, { withFileTypes: true });
20584
- fs16.mkdirSync(dest, { recursive: true });
20717
+ const entries = fs17.readdirSync(src, { withFileTypes: true });
20718
+ fs17.mkdirSync(dest, { recursive: true });
20585
20719
  for (const entry of entries) {
20586
- const from = path17.join(src, entry.name);
20587
- const to = resolveLinkedDestination(path17.join(dest, entry.name));
20720
+ const from = path18.join(src, entry.name);
20721
+ const to = resolveLinkedDestination(path18.join(dest, entry.name));
20588
20722
  if (entry.isDirectory()) copyTree(from, to);
20589
- else fs16.copyFileSync(from, to);
20723
+ else fs17.copyFileSync(from, to);
20590
20724
  }
20591
20725
  }
20592
20726
  function readRetiredFile(targetDir, relativePath) {
20593
- const entryPath = path17.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
20727
+ const entryPath = path18.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
20594
20728
  const file = resolveLinkedDestination(entryPath);
20595
20729
  try {
20596
- if (!fs16.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
20597
- return fs16.readFileSync(file, "utf8");
20730
+ if (!fs17.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
20731
+ return fs17.readFileSync(file, "utf8");
20598
20732
  } catch {
20599
20733
  return null;
20600
20734
  }
@@ -20602,7 +20736,7 @@ function readRetiredFile(targetDir, relativePath) {
20602
20736
  function findRetiredFiles(retired, bundleDir, targetDir) {
20603
20737
  const found = [];
20604
20738
  for (const { path: relativePath, shipped } of retired) {
20605
- if (bundleDir !== null && fs16.existsSync(path17.join(bundleDir, ...relativePath.split("/"))))
20739
+ if (bundleDir !== null && fs17.existsSync(path18.join(bundleDir, ...relativePath.split("/"))))
20606
20740
  continue;
20607
20741
  const content = readRetiredFile(targetDir, relativePath);
20608
20742
  if (content === null) continue;
@@ -20618,17 +20752,17 @@ function removeRetiredFiles(targetDir, files) {
20618
20752
  const content = readRetiredFile(targetDir, relativePath);
20619
20753
  if (content === null || hashBundledContent(content) !== sha256) continue;
20620
20754
  const segments = relativePath.split("/");
20621
- const entryPath = path17.join(dir, ...segments);
20755
+ const entryPath = path18.join(dir, ...segments);
20622
20756
  const file = resolveLinkedDestination(entryPath);
20623
20757
  try {
20624
- fs16.rmSync(file);
20758
+ fs17.rmSync(file);
20625
20759
  if (file !== entryPath) removePath(entryPath);
20626
20760
  removedPaths.push(relativePath);
20627
20761
  } catch {
20628
20762
  continue;
20629
20763
  }
20630
20764
  for (let depth = segments.length - 1; depth > 0; depth--) {
20631
- if (!rmEmptyDir(path17.join(dir, ...segments.slice(0, depth)))) break;
20765
+ if (!rmEmptyDir(path18.join(dir, ...segments.slice(0, depth)))) break;
20632
20766
  }
20633
20767
  }
20634
20768
  const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
@@ -20636,15 +20770,15 @@ function removeRetiredFiles(targetDir, files) {
20636
20770
  }
20637
20771
  function dirExists(p) {
20638
20772
  try {
20639
- return fs16.statSync(p).isDirectory();
20773
+ return fs17.statSync(p).isDirectory();
20640
20774
  } catch {
20641
20775
  return false;
20642
20776
  }
20643
20777
  }
20644
20778
  function getInstalledVersion() {
20645
20779
  try {
20646
- const pkgPath = path17.join(PACKAGE_ROOT, "package.json");
20647
- const pkg = JSON.parse(fs16.readFileSync(pkgPath, "utf8"));
20780
+ const pkgPath = path18.join(PACKAGE_ROOT, "package.json");
20781
+ const pkg = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
20648
20782
  return pkg.version ?? null;
20649
20783
  } catch {
20650
20784
  return null;
@@ -20702,12 +20836,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
20702
20836
  } catch {
20703
20837
  return false;
20704
20838
  }
20705
- return new Promise((resolve17) => {
20706
- const timer = setTimeout(() => resolve17(false), timeoutMs);
20839
+ return new Promise((resolve20) => {
20840
+ const timer = setTimeout(() => resolve20(false), timeoutMs);
20707
20841
  timer.unref();
20708
20842
  dns.lookup(host, (err) => {
20709
20843
  clearTimeout(timer);
20710
- resolve17(!err);
20844
+ resolve20(!err);
20711
20845
  });
20712
20846
  });
20713
20847
  }
@@ -20724,7 +20858,7 @@ function escapeStringRegexp(string) {
20724
20858
  }
20725
20859
 
20726
20860
  // ../argent-installer/src/mcp-configs.ts
20727
- var TOOL_SERVER_BUNDLE = path18.join(import.meta.dirname, "tool-server.cjs");
20861
+ var TOOL_SERVER_BUNDLE = path19.join(import.meta.dirname, "tool-server.cjs");
20728
20862
  function getAvailableToolIds() {
20729
20863
  const out = execFileSync4("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
20730
20864
  const tools = JSON.parse(out);
@@ -20778,10 +20912,10 @@ function hasCustomizingEnv(entry) {
20778
20912
  }
20779
20913
  function removeDirIfEmpty(dirPath) {
20780
20914
  try {
20781
- if (!fs17.existsSync(dirPath)) return;
20782
- if (!fs17.statSync(dirPath).isDirectory()) return;
20783
- if (fs17.readdirSync(dirPath).length > 0) return;
20784
- fs17.rmdirSync(dirPath);
20915
+ if (!fs18.existsSync(dirPath)) return;
20916
+ if (!fs18.statSync(dirPath).isDirectory()) return;
20917
+ if (fs18.readdirSync(dirPath).length > 0) return;
20918
+ fs18.rmdirSync(dirPath);
20785
20919
  } catch {
20786
20920
  }
20787
20921
  }
@@ -20818,7 +20952,7 @@ function isArgentManagedEntry(entry) {
20818
20952
  return args.length === 1 && args[0] === "mcp";
20819
20953
  case "node": {
20820
20954
  if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
20821
- if (path18.isAbsolute(args[0])) return false;
20955
+ if (path19.isAbsolute(args[0])) return false;
20822
20956
  const normalized = args[0].split("\\").join("/");
20823
20957
  return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
20824
20958
  }
@@ -20832,8 +20966,8 @@ function isArgentManagedEntry(entry) {
20832
20966
  }
20833
20967
  function writeTomlOrRemove(filePath, data) {
20834
20968
  if (Object.keys(data).length === 0) {
20835
- fs17.rmSync(filePath, { force: true });
20836
- removeDirIfEmpty(path18.dirname(filePath));
20969
+ fs18.rmSync(filePath, { force: true });
20970
+ removeDirIfEmpty(path19.dirname(filePath));
20837
20971
  return;
20838
20972
  }
20839
20973
  writeToml(filePath, data);
@@ -20842,12 +20976,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
20842
20976
  return dirExists(dir) && !looksArgentOnly(dir);
20843
20977
  }
20844
20978
  function fileHasEditorEvidence(filePath, looksArgentOnly) {
20845
- return fs17.existsSync(filePath) && !looksArgentOnly(filePath);
20979
+ return fs18.existsSync(filePath) && !looksArgentOnly(filePath);
20846
20980
  }
20847
20981
  function parseJsoncStrict(filePath) {
20848
20982
  let raw;
20849
20983
  try {
20850
- raw = fs17.readFileSync(filePath, "utf8");
20984
+ raw = fs18.readFileSync(filePath, "utf8");
20851
20985
  } catch {
20852
20986
  return null;
20853
20987
  }
@@ -20860,14 +20994,14 @@ function parseJsoncStrict(filePath) {
20860
20994
  }
20861
20995
  function parseTomlStrict(filePath) {
20862
20996
  try {
20863
- return parse(fs17.readFileSync(filePath, "utf8"));
20997
+ return parse(fs18.readFileSync(filePath, "utf8"));
20864
20998
  } catch {
20865
20999
  return null;
20866
21000
  }
20867
21001
  }
20868
21002
  function parseYamlStrict(filePath) {
20869
21003
  try {
20870
- const parsed = (0, import_yaml2.parse)(fs17.readFileSync(filePath, "utf8"));
21004
+ const parsed = (0, import_yaml2.parse)(fs18.readFileSync(filePath, "utf8"));
20871
21005
  if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
20872
21006
  return parsed;
20873
21007
  } catch {
@@ -20890,7 +21024,7 @@ function bundledManagedNames(kind) {
20890
21024
  if (cached2) return cached2;
20891
21025
  let names;
20892
21026
  try {
20893
- names = new Set(fs17.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
21027
+ names = new Set(fs18.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
20894
21028
  } catch {
20895
21029
  names = /* @__PURE__ */ new Set();
20896
21030
  }
@@ -20901,7 +21035,7 @@ function bundledManagedNames(kind) {
20901
21035
  function managedDirLooksArgentOnly(dir, kind) {
20902
21036
  let entries;
20903
21037
  try {
20904
- entries = fs17.readdirSync(dir);
21038
+ entries = fs18.readdirSync(dir);
20905
21039
  } catch {
20906
21040
  return false;
20907
21041
  }
@@ -20913,13 +21047,13 @@ function managedDirLooksArgentOnly(dir, kind) {
20913
21047
  function cursorDirLooksArgentOnly(dir) {
20914
21048
  let entries;
20915
21049
  try {
20916
- entries = fs17.readdirSync(dir);
21050
+ entries = fs18.readdirSync(dir);
20917
21051
  } catch {
20918
21052
  return false;
20919
21053
  }
20920
21054
  if (entries.length === 0) return false;
20921
21055
  return entries.every((entry) => {
20922
- const full = path18.join(dir, entry);
21056
+ const full = path19.join(dir, entry);
20923
21057
  if (entry === "mcp.json") {
20924
21058
  return jsonLooksArgentServerOnly(full, "mcpServers");
20925
21059
  }
@@ -20952,13 +21086,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
20952
21086
  function claudeDirLooksArgentOnly(dir) {
20953
21087
  let entries;
20954
21088
  try {
20955
- entries = fs17.readdirSync(dir);
21089
+ entries = fs18.readdirSync(dir);
20956
21090
  } catch {
20957
21091
  return false;
20958
21092
  }
20959
21093
  if (entries.length === 0) return false;
20960
21094
  return entries.every((entry) => {
20961
- const full = path18.join(dir, entry);
21095
+ const full = path19.join(dir, entry);
20962
21096
  if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
20963
21097
  if (entry === "rules" || entry === "agents" || entry === "skills") {
20964
21098
  return managedDirLooksArgentOnly(full, entry);
@@ -20969,25 +21103,25 @@ function claudeDirLooksArgentOnly(dir) {
20969
21103
  function vscodeDirLooksArgentOnly(dir) {
20970
21104
  let entries;
20971
21105
  try {
20972
- entries = fs17.readdirSync(dir);
21106
+ entries = fs18.readdirSync(dir);
20973
21107
  } catch {
20974
21108
  return false;
20975
21109
  }
20976
21110
  if (entries.length === 0) return false;
20977
21111
  return entries.every(
20978
- (entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path18.join(dir, entry), "servers")
21112
+ (entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "servers")
20979
21113
  );
20980
21114
  }
20981
21115
  function windsurfDirLooksArgentOnly(dir) {
20982
21116
  let entries;
20983
21117
  try {
20984
- entries = fs17.readdirSync(dir);
21118
+ entries = fs18.readdirSync(dir);
20985
21119
  } catch {
20986
21120
  return false;
20987
21121
  }
20988
21122
  if (entries.length === 0) return false;
20989
21123
  return entries.every(
20990
- (entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path18.join(dir, entry), "mcpServers")
21124
+ (entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "mcpServers")
20991
21125
  );
20992
21126
  }
20993
21127
  function zedSettingsLooksArgentOnly(filePath) {
@@ -21018,25 +21152,25 @@ function zedSettingsLooksArgentOnly(filePath) {
21018
21152
  function zedDirLooksArgentOnly(dir) {
21019
21153
  let entries;
21020
21154
  try {
21021
- entries = fs17.readdirSync(dir);
21155
+ entries = fs18.readdirSync(dir);
21022
21156
  } catch {
21023
21157
  return false;
21024
21158
  }
21025
21159
  if (entries.length === 0) return false;
21026
21160
  return entries.every(
21027
- (entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path18.join(dir, entry))
21161
+ (entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path19.join(dir, entry))
21028
21162
  );
21029
21163
  }
21030
21164
  function geminiDirLooksArgentOnly(dir) {
21031
21165
  let entries;
21032
21166
  try {
21033
- entries = fs17.readdirSync(dir);
21167
+ entries = fs18.readdirSync(dir);
21034
21168
  } catch {
21035
21169
  return false;
21036
21170
  }
21037
21171
  if (entries.length === 0) return false;
21038
21172
  return entries.every((entry) => {
21039
- const full = path18.join(dir, entry);
21173
+ const full = path19.join(dir, entry);
21040
21174
  if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
21041
21175
  if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
21042
21176
  return false;
@@ -21055,48 +21189,48 @@ function hermesConfigLooksArgentOnly(filePath) {
21055
21189
  function hermesDirLooksArgentOnly(dir) {
21056
21190
  let entries;
21057
21191
  try {
21058
- entries = fs17.readdirSync(dir);
21192
+ entries = fs18.readdirSync(dir);
21059
21193
  } catch {
21060
21194
  return false;
21061
21195
  }
21062
21196
  if (entries.length === 0) return false;
21063
21197
  return entries.every(
21064
- (entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path18.join(dir, entry))
21198
+ (entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path19.join(dir, entry))
21065
21199
  );
21066
21200
  }
21067
21201
  function kiroDirLooksArgentOnly(dir) {
21068
21202
  let entries;
21069
21203
  try {
21070
- entries = fs17.readdirSync(dir);
21204
+ entries = fs18.readdirSync(dir);
21071
21205
  } catch {
21072
21206
  return false;
21073
21207
  }
21074
21208
  if (entries.length === 0) return false;
21075
21209
  return entries.every((entry) => {
21076
21210
  if (entry !== "settings") return false;
21077
- const settingsDir = path18.join(dir, entry);
21211
+ const settingsDir = path19.join(dir, entry);
21078
21212
  let settingsEntries;
21079
21213
  try {
21080
- settingsEntries = fs17.readdirSync(settingsDir);
21214
+ settingsEntries = fs18.readdirSync(settingsDir);
21081
21215
  } catch {
21082
21216
  return false;
21083
21217
  }
21084
21218
  if (settingsEntries.length === 0) return false;
21085
21219
  return settingsEntries.every(
21086
- (name) => name === "mcp.json" && jsonLooksArgentServerOnly(path18.join(settingsDir, name), "mcpServers")
21220
+ (name) => name === "mcp.json" && jsonLooksArgentServerOnly(path19.join(settingsDir, name), "mcpServers")
21087
21221
  );
21088
21222
  });
21089
21223
  }
21090
21224
  function codexDirLooksArgentOnly(dir) {
21091
21225
  let entries;
21092
21226
  try {
21093
- entries = fs17.readdirSync(dir);
21227
+ entries = fs18.readdirSync(dir);
21094
21228
  } catch {
21095
21229
  return false;
21096
21230
  }
21097
21231
  if (entries.length === 0) return false;
21098
21232
  return entries.every((entry) => {
21099
- const full = path18.join(dir, entry);
21233
+ const full = path19.join(dir, entry);
21100
21234
  if (entry === "config.toml") {
21101
21235
  const config = parseTomlStrict(full);
21102
21236
  if (config === null) return false;
@@ -21121,7 +21255,7 @@ function codexDirLooksArgentOnly(dir) {
21121
21255
  });
21122
21256
  }
21123
21257
  function cursorPermissionsPath() {
21124
- return path18.join(homedir4(), ".cursor", "permissions.json");
21258
+ return path19.join(homedir5(), ".cursor", "permissions.json");
21125
21259
  }
21126
21260
  function cursorPermissionsList() {
21127
21261
  const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
@@ -21130,13 +21264,13 @@ function cursorPermissionsList() {
21130
21264
  var cursorAdapter = {
21131
21265
  name: "Cursor",
21132
21266
  detect() {
21133
- return dirHasEditorEvidence(path18.join(homedir4(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path18.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
21267
+ return dirHasEditorEvidence(path19.join(homedir5(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
21134
21268
  },
21135
21269
  projectPath(root) {
21136
- return path18.join(root, ".cursor", "mcp.json");
21270
+ return path19.join(root, ".cursor", "mcp.json");
21137
21271
  },
21138
21272
  globalPath() {
21139
- return path18.join(homedir4(), ".cursor", "mcp.json");
21273
+ return path19.join(homedir5(), ".cursor", "mcp.json");
21140
21274
  },
21141
21275
  // Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
21142
21276
  // text edits that preserve user comments and foreign servers.
@@ -21148,7 +21282,7 @@ var cursorAdapter = {
21148
21282
  });
21149
21283
  },
21150
21284
  remove(configPath) {
21151
- if (!fs17.existsSync(configPath)) return false;
21285
+ if (!fs18.existsSync(configPath)) return false;
21152
21286
  const config = readJsonc(configPath);
21153
21287
  const servers = config.mcpServers;
21154
21288
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21156,7 +21290,7 @@ var cursorAdapter = {
21156
21290
  return true;
21157
21291
  },
21158
21292
  getArgentEntry(configPath) {
21159
- if (!fs17.existsSync(configPath)) return null;
21293
+ if (!fs18.existsSync(configPath)) return null;
21160
21294
  const config = readJsonc(configPath);
21161
21295
  const servers = config.mcpServers;
21162
21296
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21181,7 +21315,7 @@ var cursorAdapter = {
21181
21315
  removeAllowlist(_root, scope) {
21182
21316
  if (scope !== "global") return;
21183
21317
  const permPath = cursorPermissionsPath();
21184
- if (!fs17.existsSync(permPath)) return;
21318
+ if (!fs18.existsSync(permPath)) return;
21185
21319
  const config = readJsonc(permPath);
21186
21320
  const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
21187
21321
  if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
@@ -21190,18 +21324,11 @@ var cursorAdapter = {
21190
21324
  }
21191
21325
  };
21192
21326
  function claudeProjectKeysForRoot(projects, root) {
21193
- const canonical = (value) => {
21194
- try {
21195
- return fs17.realpathSync.native(value);
21196
- } catch {
21197
- return path18.resolve(value);
21198
- }
21199
- };
21200
- const target = canonical(root);
21201
- return Object.keys(projects).filter((key) => key === root || canonical(key) === target);
21327
+ const target = canonicalPath(root);
21328
+ return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
21202
21329
  }
21203
21330
  function claudeDisabledListFinding(settingsPath, label, projectConfined) {
21204
- if (!fs17.existsSync(settingsPath)) return null;
21331
+ if (!fs18.existsSync(settingsPath)) return null;
21205
21332
  const disabled = readJson(settingsPath).disabledMcpjsonServers;
21206
21333
  if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
21207
21334
  return {
@@ -21229,13 +21356,13 @@ var claudeAdapter = {
21229
21356
  name: "Claude Code",
21230
21357
  detect() {
21231
21358
  const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
21232
- return fileHasEditorEvidence(path18.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path18.join(homedir4(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path18.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path18.join(homedir4(), ".claude"), claudeDirLooksArgentOnly);
21359
+ 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);
21233
21360
  },
21234
21361
  projectPath(root) {
21235
- return path18.join(root, ".mcp.json");
21362
+ return path19.join(root, ".mcp.json");
21236
21363
  },
21237
21364
  globalPath() {
21238
- return path18.join(homedir4(), ".claude.json");
21365
+ return path19.join(homedir5(), ".claude.json");
21239
21366
  },
21240
21367
  // JSONC is a superset of JSON, so this config shares the one comment- and
21241
21368
  // foreign-server-preserving write path (see the Cursor adapter).
@@ -21248,7 +21375,7 @@ var claudeAdapter = {
21248
21375
  });
21249
21376
  },
21250
21377
  remove(configPath) {
21251
- if (!fs17.existsSync(configPath)) return false;
21378
+ if (!fs18.existsSync(configPath)) return false;
21252
21379
  const config = readJsonc(configPath);
21253
21380
  const servers = config.mcpServers;
21254
21381
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21262,7 +21389,7 @@ var claudeAdapter = {
21262
21389
  return true;
21263
21390
  },
21264
21391
  getArgentEntry(configPath) {
21265
- if (!fs17.existsSync(configPath)) return null;
21392
+ if (!fs18.existsSync(configPath)) return null;
21266
21393
  const config = readJsonc(configPath);
21267
21394
  const servers = config.mcpServers;
21268
21395
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21275,7 +21402,7 @@ var claudeAdapter = {
21275
21402
  // .mcp.json rejections (see claudeDisabledListFinding).
21276
21403
  findShadowingConfigs(root, writtenScope) {
21277
21404
  const findings = [];
21278
- const claudeJsonPath = path18.join(homedir4(), ".claude.json");
21405
+ const claudeJsonPath = path19.join(homedir5(), ".claude.json");
21279
21406
  const projects = readJson(claudeJsonPath).projects;
21280
21407
  if (isRecord(projects)) {
21281
21408
  for (const key of claudeProjectKeysForRoot(projects, root)) {
@@ -21312,9 +21439,9 @@ var claudeAdapter = {
21312
21439
  }
21313
21440
  if (writtenScope === "local") {
21314
21441
  const candidates = [
21315
- [path18.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
21316
- [path18.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
21317
- [path18.join(homedir4(), ".claude", "settings.json"), "~/.claude/settings.json", false]
21442
+ [path19.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
21443
+ [path19.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
21444
+ [path19.join(homedir5(), ".claude", "settings.json"), "~/.claude/settings.json", false]
21318
21445
  ];
21319
21446
  for (const [settingsPath, label, projectConfined] of candidates) {
21320
21447
  const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
@@ -21333,10 +21460,10 @@ var claudeAdapter = {
21333
21460
  var vscodeAdapter = {
21334
21461
  name: "VS Code",
21335
21462
  detect() {
21336
- return dirHasEditorEvidence(path18.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path18.join(homedir4(), ".vscode"));
21463
+ return dirHasEditorEvidence(path19.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path19.join(homedir5(), ".vscode"));
21337
21464
  },
21338
21465
  projectPath(root) {
21339
- return path18.join(root, ".vscode", "mcp.json");
21466
+ return path19.join(root, ".vscode", "mcp.json");
21340
21467
  },
21341
21468
  globalPath() {
21342
21469
  return null;
@@ -21352,7 +21479,7 @@ var vscodeAdapter = {
21352
21479
  });
21353
21480
  },
21354
21481
  remove(configPath) {
21355
- if (!fs17.existsSync(configPath)) return false;
21482
+ if (!fs18.existsSync(configPath)) return false;
21356
21483
  const config = readJsonc(configPath);
21357
21484
  const servers = config.servers;
21358
21485
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21360,7 +21487,7 @@ var vscodeAdapter = {
21360
21487
  return true;
21361
21488
  },
21362
21489
  getArgentEntry(configPath) {
21363
- if (!fs17.existsSync(configPath)) return null;
21490
+ if (!fs18.existsSync(configPath)) return null;
21364
21491
  const config = readJsonc(configPath);
21365
21492
  const servers = config.servers;
21366
21493
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21373,7 +21500,7 @@ var vscodeAdapter = {
21373
21500
  findShadowingConfigs(_root, _writtenScope) {
21374
21501
  const findings = [];
21375
21502
  for (const userDir of vscodeUserDirs()) {
21376
- const configPath = path18.join(userDir, "mcp.json");
21503
+ const configPath = path19.join(userDir, "mcp.json");
21377
21504
  const entry = this.getArgentEntry(configPath);
21378
21505
  if (!entry) continue;
21379
21506
  findings.push({
@@ -21390,16 +21517,16 @@ var vscodeAdapter = {
21390
21517
  function vscodeUserDirs() {
21391
21518
  const bases = [];
21392
21519
  if (process.platform === "darwin") {
21393
- bases.push(path18.join(homedir4(), "Library", "Application Support"));
21520
+ bases.push(path19.join(homedir5(), "Library", "Application Support"));
21394
21521
  } else if (process.platform === "win32") {
21395
21522
  if (process.env.APPDATA) bases.push(process.env.APPDATA);
21396
21523
  } else {
21397
- bases.push(path18.join(homedir4(), ".config"));
21524
+ bases.push(path19.join(homedir5(), ".config"));
21398
21525
  }
21399
21526
  const dirs = [];
21400
21527
  for (const base of bases) {
21401
21528
  for (const product of ["Code", "Code - Insiders"]) {
21402
- const dir = path18.join(base, product, "User");
21529
+ const dir = path19.join(base, product, "User");
21403
21530
  if (dirExists(dir)) dirs.push(dir);
21404
21531
  }
21405
21532
  }
@@ -21407,18 +21534,18 @@ function vscodeUserDirs() {
21407
21534
  }
21408
21535
  function devinUserConfigPath() {
21409
21536
  if (process.platform === "win32") {
21410
- const appData = process.env.APPDATA || path18.join(homedir4(), "AppData", "Roaming");
21411
- return path18.join(appData, "devin", "config.json");
21537
+ const appData = process.env.APPDATA || path19.join(homedir5(), "AppData", "Roaming");
21538
+ return path19.join(appData, "devin", "config.json");
21412
21539
  }
21413
21540
  const xdg = process.env.XDG_CONFIG_HOME;
21414
- return path18.join(xdg || path18.join(homedir4(), ".config"), "devin", "config.json");
21541
+ return path19.join(xdg || path19.join(homedir5(), ".config"), "devin", "config.json");
21415
21542
  }
21416
21543
  var windsurfAdapter = {
21417
21544
  name: "Devin Desktop",
21418
21545
  telemetryName: "windsurf",
21419
21546
  detect() {
21420
21547
  return dirHasEditorEvidence(
21421
- path18.join(homedir4(), ".codeium", "windsurf"),
21548
+ path19.join(homedir5(), ".codeium", "windsurf"),
21422
21549
  windsurfDirLooksArgentOnly
21423
21550
  );
21424
21551
  },
@@ -21426,7 +21553,7 @@ var windsurfAdapter = {
21426
21553
  return null;
21427
21554
  },
21428
21555
  globalPath() {
21429
- return path18.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21556
+ return path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
21430
21557
  },
21431
21558
  // JSONC-safe writes (see the Cursor adapter).
21432
21559
  write(configPath, entry) {
@@ -21438,7 +21565,7 @@ var windsurfAdapter = {
21438
21565
  });
21439
21566
  },
21440
21567
  remove(configPath) {
21441
- if (!fs17.existsSync(configPath)) return false;
21568
+ if (!fs18.existsSync(configPath)) return false;
21442
21569
  const config = readJsonc(configPath);
21443
21570
  const servers = config.mcpServers;
21444
21571
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21446,7 +21573,7 @@ var windsurfAdapter = {
21446
21573
  return true;
21447
21574
  },
21448
21575
  getArgentEntry(configPath) {
21449
- if (!fs17.existsSync(configPath)) return null;
21576
+ if (!fs18.existsSync(configPath)) return null;
21450
21577
  const config = readJsonc(configPath);
21451
21578
  const servers = config.mcpServers;
21452
21579
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21458,7 +21585,7 @@ var windsurfAdapter = {
21458
21585
  // servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
21459
21586
  // agent needs its own permission rule.
21460
21587
  addAllowlist() {
21461
- const configPath = path18.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21588
+ const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
21462
21589
  const config = readJsonc(configPath);
21463
21590
  const servers = config.mcpServers;
21464
21591
  if (!servers?.[MCP_SERVER_KEY]) return;
@@ -21468,8 +21595,8 @@ var windsurfAdapter = {
21468
21595
  removeAllowlist(_root, scope) {
21469
21596
  if (scope !== "global") return;
21470
21597
  removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
21471
- const configPath = path18.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
21472
- if (!fs17.existsSync(configPath)) return;
21598
+ const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
21599
+ if (!fs18.existsSync(configPath)) return;
21473
21600
  const config = readJsonc(configPath);
21474
21601
  const servers = config.mcpServers;
21475
21602
  const entry = servers?.[MCP_SERVER_KEY];
@@ -21480,13 +21607,13 @@ var windsurfAdapter = {
21480
21607
  var zedAdapter = {
21481
21608
  name: "Zed",
21482
21609
  detect() {
21483
- return dirHasEditorEvidence(path18.join(homedir4(), ".config", "zed"), zedDirLooksArgentOnly);
21610
+ return dirHasEditorEvidence(path19.join(homedir5(), ".config", "zed"), zedDirLooksArgentOnly);
21484
21611
  },
21485
21612
  projectPath(root) {
21486
- return path18.join(root, ".zed", "settings.json");
21613
+ return path19.join(root, ".zed", "settings.json");
21487
21614
  },
21488
21615
  globalPath() {
21489
- return path18.join(homedir4(), ".config", "zed", "settings.json");
21616
+ return path19.join(homedir5(), ".config", "zed", "settings.json");
21490
21617
  },
21491
21618
  // Read and written as JSONC through readJsonc / editJsoncFile so comments and
21492
21619
  // formatting outside the touched key survive (see the Cursor adapter).
@@ -21499,7 +21626,7 @@ var zedAdapter = {
21499
21626
  });
21500
21627
  },
21501
21628
  remove(configPath) {
21502
- if (!fs17.existsSync(configPath)) return false;
21629
+ if (!fs18.existsSync(configPath)) return false;
21503
21630
  const config = readJsonc(configPath);
21504
21631
  const servers = config.context_servers;
21505
21632
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21507,7 +21634,7 @@ var zedAdapter = {
21507
21634
  return true;
21508
21635
  },
21509
21636
  getArgentEntry(configPath) {
21510
- if (!fs17.existsSync(configPath)) return null;
21637
+ if (!fs18.existsSync(configPath)) return null;
21511
21638
  const config = readJsonc(configPath);
21512
21639
  const servers = config.context_servers;
21513
21640
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21518,12 +21645,12 @@ var zedAdapter = {
21518
21645
  // Zed has no server-level wildcard for MCP tools — each tool would need its
21519
21646
  // own entry — so the global default is set to "allow" instead.
21520
21647
  addAllowlist(root, scope) {
21521
- const settingsPath = scope === "global" ? path18.join(homedir4(), ".config", "zed", "settings.json") : path18.join(root, ".zed", "settings.json");
21648
+ const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
21522
21649
  editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
21523
21650
  },
21524
21651
  removeAllowlist(root, scope) {
21525
- const settingsPath = scope === "global" ? path18.join(homedir4(), ".config", "zed", "settings.json") : path18.join(root, ".zed", "settings.json");
21526
- if (!fs17.existsSync(settingsPath)) return;
21652
+ const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
21653
+ if (!fs18.existsSync(settingsPath)) return;
21527
21654
  const config = readJsonc(settingsPath);
21528
21655
  const perms = config.agent?.tool_permissions;
21529
21656
  if (!perms || perms.default !== "allow") return;
@@ -21533,13 +21660,13 @@ var zedAdapter = {
21533
21660
  var geminiAdapter = {
21534
21661
  name: "Gemini",
21535
21662
  detect() {
21536
- return dirHasEditorEvidence(path18.join(homedir4(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path18.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
21663
+ return dirHasEditorEvidence(path19.join(homedir5(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
21537
21664
  },
21538
21665
  projectPath(root) {
21539
- return path18.join(root, ".gemini", "settings.json");
21666
+ return path19.join(root, ".gemini", "settings.json");
21540
21667
  },
21541
21668
  globalPath() {
21542
- return path18.join(homedir4(), ".gemini", "settings.json");
21669
+ return path19.join(homedir5(), ".gemini", "settings.json");
21543
21670
  },
21544
21671
  // JSONC-safe writes (see the Cursor adapter).
21545
21672
  write(configPath, entry) {
@@ -21551,7 +21678,7 @@ var geminiAdapter = {
21551
21678
  });
21552
21679
  },
21553
21680
  remove(configPath) {
21554
- if (!fs17.existsSync(configPath)) return false;
21681
+ if (!fs18.existsSync(configPath)) return false;
21555
21682
  const config = readJsonc(configPath);
21556
21683
  const servers = config.mcpServers;
21557
21684
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21559,7 +21686,7 @@ var geminiAdapter = {
21559
21686
  return true;
21560
21687
  },
21561
21688
  getArgentEntry(configPath) {
21562
- if (!fs17.existsSync(configPath)) return null;
21689
+ if (!fs18.existsSync(configPath)) return null;
21563
21690
  const config = readJsonc(configPath);
21564
21691
  const servers = config.mcpServers;
21565
21692
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21581,7 +21708,7 @@ var geminiAdapter = {
21581
21708
  },
21582
21709
  removeAllowlist(root, scope) {
21583
21710
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21584
- if (!configPath || !fs17.existsSync(configPath)) {
21711
+ if (!configPath || !fs18.existsSync(configPath)) {
21585
21712
  return;
21586
21713
  }
21587
21714
  const config = readJsonc(configPath);
@@ -21595,13 +21722,13 @@ var CODEX_FILENAME = ".codex";
21595
21722
  var codexAdapter = {
21596
21723
  name: "Codex",
21597
21724
  detect() {
21598
- return dirHasEditorEvidence(path18.join(homedir4(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path18.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
21725
+ return dirHasEditorEvidence(path19.join(homedir5(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
21599
21726
  },
21600
21727
  projectPath(root) {
21601
- return path18.join(root, CODEX_FILENAME, "config.toml");
21728
+ return path19.join(root, CODEX_FILENAME, "config.toml");
21602
21729
  },
21603
21730
  globalPath() {
21604
- return path18.join(homedir4(), CODEX_FILENAME, "config.toml");
21731
+ return path19.join(homedir5(), CODEX_FILENAME, "config.toml");
21605
21732
  },
21606
21733
  write(configPath, entry) {
21607
21734
  const config = readToml(configPath);
@@ -21617,7 +21744,7 @@ var codexAdapter = {
21617
21744
  writeToml(configPath, config);
21618
21745
  },
21619
21746
  remove(configPath) {
21620
- if (!fs17.existsSync(configPath)) return false;
21747
+ if (!fs18.existsSync(configPath)) return false;
21621
21748
  const config = readToml(configPath);
21622
21749
  const servers = config.mcp_servers;
21623
21750
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21627,7 +21754,7 @@ var codexAdapter = {
21627
21754
  return true;
21628
21755
  },
21629
21756
  getArgentEntry(configPath) {
21630
- if (!fs17.existsSync(configPath)) return null;
21757
+ if (!fs18.existsSync(configPath)) return null;
21631
21758
  const config = readToml(configPath);
21632
21759
  const servers = config.mcp_servers;
21633
21760
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21659,7 +21786,7 @@ var codexAdapter = {
21659
21786
  // them, and an emptied or removed table stays as it is.
21660
21787
  refreshAllowlist(root, scope) {
21661
21788
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21662
- if (!configPath || !fs17.existsSync(configPath)) return;
21789
+ if (!configPath || !fs18.existsSync(configPath)) return;
21663
21790
  const config = readToml(configPath);
21664
21791
  const toolsConfig = config.mcp_servers?.argent?.tools;
21665
21792
  if (!toolsConfig) return;
@@ -21696,13 +21823,13 @@ var codexAdapter = {
21696
21823
  var hermesAdapter = {
21697
21824
  name: "Hermes",
21698
21825
  detect() {
21699
- return dirHasEditorEvidence(path18.join(homedir4(), ".hermes"), hermesDirLooksArgentOnly);
21826
+ return dirHasEditorEvidence(path19.join(homedir5(), ".hermes"), hermesDirLooksArgentOnly);
21700
21827
  },
21701
21828
  projectPath() {
21702
21829
  return null;
21703
21830
  },
21704
21831
  globalPath() {
21705
- return path18.join(homedir4(), ".hermes", "config.yaml");
21832
+ return path19.join(homedir5(), ".hermes", "config.yaml");
21706
21833
  },
21707
21834
  write(configPath, entry) {
21708
21835
  const doc = readYaml(configPath);
@@ -21721,7 +21848,7 @@ var hermesAdapter = {
21721
21848
  writeYaml(configPath, doc);
21722
21849
  },
21723
21850
  remove(configPath) {
21724
- if (!fs17.existsSync(configPath)) return false;
21851
+ if (!fs18.existsSync(configPath)) return false;
21725
21852
  const doc = readYaml(configPath);
21726
21853
  const servers = doc.get("mcp_servers");
21727
21854
  if (!(0, import_yaml2.isMap)(servers)) return false;
@@ -21734,7 +21861,7 @@ var hermesAdapter = {
21734
21861
  return true;
21735
21862
  },
21736
21863
  getArgentEntry(configPath) {
21737
- if (!fs17.existsSync(configPath)) return null;
21864
+ if (!fs18.existsSync(configPath)) return null;
21738
21865
  const doc = readYaml(configPath);
21739
21866
  const servers = doc.get("mcp_servers");
21740
21867
  if (!(0, import_yaml2.isMap)(servers)) return null;
@@ -21761,10 +21888,10 @@ function hasOpenCodeBinary() {
21761
21888
  }
21762
21889
  function pickOpencodeConfig(dir, candidates) {
21763
21890
  for (const name of candidates) {
21764
- const candidate = path18.join(dir, name);
21765
- if (fs17.existsSync(candidate)) return candidate;
21891
+ const candidate = path19.join(dir, name);
21892
+ if (fs18.existsSync(candidate)) return candidate;
21766
21893
  }
21767
- return path18.join(dir, "opencode.json");
21894
+ return path19.join(dir, "opencode.json");
21768
21895
  }
21769
21896
  var openCodeAdapter = {
21770
21897
  name: "opencode",
@@ -21775,7 +21902,7 @@ var openCodeAdapter = {
21775
21902
  return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
21776
21903
  },
21777
21904
  globalPath() {
21778
- return pickOpencodeConfig(path18.join(homedir4(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
21905
+ return pickOpencodeConfig(path19.join(homedir5(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
21779
21906
  },
21780
21907
  write(configPath, entry) {
21781
21908
  editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
@@ -21786,7 +21913,7 @@ var openCodeAdapter = {
21786
21913
  });
21787
21914
  },
21788
21915
  remove(configPath) {
21789
- if (!fs17.existsSync(configPath)) return false;
21916
+ if (!fs18.existsSync(configPath)) return false;
21790
21917
  const config = readJsonc(configPath);
21791
21918
  const servers = config.mcp;
21792
21919
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21794,7 +21921,7 @@ var openCodeAdapter = {
21794
21921
  return true;
21795
21922
  },
21796
21923
  getArgentEntry(configPath) {
21797
- if (!fs17.existsSync(configPath)) return null;
21924
+ if (!fs18.existsSync(configPath)) return null;
21798
21925
  const config = readJsonc(configPath);
21799
21926
  const servers = config.mcp;
21800
21927
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21809,7 +21936,7 @@ var openCodeAdapter = {
21809
21936
  },
21810
21937
  removeAllowlist(root, scope) {
21811
21938
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21812
- if (!configPath || !fs17.existsSync(configPath)) return;
21939
+ if (!configPath || !fs18.existsSync(configPath)) return;
21813
21940
  const config = readJsonc(configPath);
21814
21941
  const tools = config.tools;
21815
21942
  if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
@@ -21820,13 +21947,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
21820
21947
  var kiroAdapter = {
21821
21948
  name: "Kiro",
21822
21949
  detect() {
21823
- return dirHasEditorEvidence(path18.join(homedir4(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path18.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
21950
+ return dirHasEditorEvidence(path19.join(homedir5(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
21824
21951
  },
21825
21952
  projectPath(root) {
21826
- return path18.join(root, ".kiro", "settings", "mcp.json");
21953
+ return path19.join(root, ".kiro", "settings", "mcp.json");
21827
21954
  },
21828
21955
  globalPath() {
21829
- return path18.join(homedir4(), ".kiro", "settings", "mcp.json");
21956
+ return path19.join(homedir5(), ".kiro", "settings", "mcp.json");
21830
21957
  },
21831
21958
  // Read and written as JSONC through readJsonc / editJsoncFile so comments and
21832
21959
  // foreign servers survive (see the Cursor adapter).
@@ -21839,7 +21966,7 @@ var kiroAdapter = {
21839
21966
  });
21840
21967
  },
21841
21968
  remove(configPath) {
21842
- if (!fs17.existsSync(configPath)) return false;
21969
+ if (!fs18.existsSync(configPath)) return false;
21843
21970
  const config = readJsonc(configPath);
21844
21971
  const servers = config.mcpServers;
21845
21972
  if (!servers?.[MCP_SERVER_KEY]) return false;
@@ -21847,7 +21974,7 @@ var kiroAdapter = {
21847
21974
  return true;
21848
21975
  },
21849
21976
  getArgentEntry(configPath) {
21850
- if (!fs17.existsSync(configPath)) return null;
21977
+ if (!fs18.existsSync(configPath)) return null;
21851
21978
  const config = readJsonc(configPath);
21852
21979
  const servers = config.mcpServers;
21853
21980
  return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
@@ -21871,7 +21998,7 @@ var kiroAdapter = {
21871
21998
  },
21872
21999
  removeAllowlist(root, scope) {
21873
22000
  const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
21874
- if (!configPath || !fs17.existsSync(configPath)) return;
22001
+ if (!configPath || !fs18.existsSync(configPath)) return;
21875
22002
  const config = readJsonc(configPath);
21876
22003
  const servers = config.mcpServers;
21877
22004
  const entry = servers?.[MCP_SERVER_KEY];
@@ -21923,7 +22050,7 @@ function addAllowRule(settingsPath, rule) {
21923
22050
  editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
21924
22051
  }
21925
22052
  function removeAllowRule(settingsPath, rule) {
21926
- if (!fs17.existsSync(settingsPath)) return;
22053
+ if (!fs18.existsSync(settingsPath)) return;
21927
22054
  const config = readJsonc(settingsPath);
21928
22055
  const permissions = config?.permissions;
21929
22056
  const allow = permissions?.allow;
@@ -21933,7 +22060,7 @@ function removeAllowRule(settingsPath, rule) {
21933
22060
  editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
21934
22061
  }
21935
22062
  function claudeSettingsPath(root, scope) {
21936
- return scope === "global" ? path18.join(homedir4(), ".claude", "settings.json") : path18.join(root, ".claude", "settings.json");
22063
+ return scope === "global" ? path19.join(homedir5(), ".claude", "settings.json") : path19.join(root, ".claude", "settings.json");
21937
22064
  }
21938
22065
  function addClaudePermission(root, scope) {
21939
22066
  addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
@@ -21946,12 +22073,13 @@ function formatCopyDestination(target, writtenPath, root) {
21946
22073
  return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
21947
22074
  }
21948
22075
  function formatManagedPathLabel(targetPath, root) {
21949
- const home = homedir4();
21950
- if (targetPath === home || targetPath.startsWith(`${home}${path18.sep}`)) {
21951
- return `~${targetPath.slice(home.length)}`;
22076
+ for (const home of [path19.resolve(homedir5()), canonicalPath(homedir5())]) {
22077
+ if (targetPath === home || targetPath.startsWith(`${home}${path19.sep}`)) {
22078
+ return `~${targetPath.slice(home.length)}`;
22079
+ }
21952
22080
  }
21953
- const relative5 = path18.relative(root, targetPath);
21954
- if (relative5 && !relative5.startsWith("..") && !path18.isAbsolute(relative5)) {
22081
+ const relative5 = path19.relative(root, targetPath);
22082
+ if (relative5 && !relative5.startsWith("..") && !path19.isAbsolute(relative5)) {
21955
22083
  return relative5;
21956
22084
  }
21957
22085
  return targetPath;
@@ -21965,7 +22093,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
21965
22093
  }
21966
22094
  function getAdapterBasePath(adapter, root, scope) {
21967
22095
  const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
21968
- return configPath ? path18.dirname(configPath) : null;
22096
+ return configPath ? path19.dirname(configPath) : null;
21969
22097
  }
21970
22098
  function getManagedContentTargets(adapters, root, scope) {
21971
22099
  const targets = {
@@ -21975,17 +22103,17 @@ function getManagedContentTargets(adapters, root, scope) {
21975
22103
  codexConfigTargets: [],
21976
22104
  skillsLockTargets: []
21977
22105
  };
21978
- const workspaceBase = scope === "global" ? homedir4() : root;
22106
+ const workspaceBase = scope === "global" ? homedir5() : root;
21979
22107
  addManagedTarget(
21980
22108
  targets.skillTargets,
21981
22109
  "skills",
21982
- path18.join(workspaceBase, ".agents", "skills"),
22110
+ path19.join(workspaceBase, ".agents", "skills"),
21983
22111
  root
21984
22112
  );
21985
22113
  addManagedTarget(
21986
22114
  targets.skillsLockTargets,
21987
22115
  "skills",
21988
- path18.join(workspaceBase, "skills-lock.json"),
22116
+ path19.join(workspaceBase, "skills-lock.json"),
21989
22117
  root
21990
22118
  );
21991
22119
  for (const adapter of adapters) {
@@ -21993,21 +22121,21 @@ function getManagedContentTargets(adapters, root, scope) {
21993
22121
  case "Cursor": {
21994
22122
  const base = getAdapterBasePath(adapter, root, scope);
21995
22123
  if (!base) break;
21996
- addManagedTarget(targets.skillTargets, adapter.name, path18.join(base, "skills"), root);
21997
- addManagedTarget(targets.ruleTargets, adapter.name, path18.join(base, "rules"), root);
22124
+ addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
22125
+ addManagedTarget(targets.ruleTargets, adapter.name, path19.join(base, "rules"), root);
21998
22126
  break;
21999
22127
  }
22000
22128
  case "Claude Code": {
22001
- const claudeBase = scope === "global" ? path18.join(homedir4(), ".claude") : path18.join(root, ".claude");
22002
- addManagedTarget(targets.skillTargets, adapter.name, path18.join(claudeBase, "skills"), root);
22003
- addManagedTarget(targets.ruleTargets, adapter.name, path18.join(claudeBase, "rules"), root);
22004
- addManagedTarget(targets.agentTargets, adapter.name, path18.join(claudeBase, "agents"), root);
22129
+ const claudeBase = scope === "global" ? path19.join(homedir5(), ".claude") : path19.join(root, ".claude");
22130
+ addManagedTarget(targets.skillTargets, adapter.name, path19.join(claudeBase, "skills"), root);
22131
+ addManagedTarget(targets.ruleTargets, adapter.name, path19.join(claudeBase, "rules"), root);
22132
+ addManagedTarget(targets.agentTargets, adapter.name, path19.join(claudeBase, "agents"), root);
22005
22133
  break;
22006
22134
  }
22007
22135
  case "Gemini": {
22008
- const geminiBase = scope === "global" ? path18.join(homedir4(), ".gemini") : path18.join(root, ".gemini");
22009
- addManagedTarget(targets.ruleTargets, adapter.name, path18.join(geminiBase, "rules"), root);
22010
- addManagedTarget(targets.agentTargets, adapter.name, path18.join(geminiBase, "agents"), root);
22136
+ const geminiBase = scope === "global" ? path19.join(homedir5(), ".gemini") : path19.join(root, ".gemini");
22137
+ addManagedTarget(targets.ruleTargets, adapter.name, path19.join(geminiBase, "rules"), root);
22138
+ addManagedTarget(targets.agentTargets, adapter.name, path19.join(geminiBase, "agents"), root);
22011
22139
  break;
22012
22140
  }
22013
22141
  case "Codex": {
@@ -22017,19 +22145,19 @@ function getManagedContentTargets(adapters, root, scope) {
22017
22145
  break;
22018
22146
  }
22019
22147
  case "opencode": {
22020
- const base = scope === "global" ? path18.join(homedir4(), ".config", "opencode") : path18.join(root, ".opencode");
22021
- addManagedTarget(targets.skillTargets, adapter.name, path18.join(base, "skills"), root);
22022
- addManagedTarget(targets.agentTargets, adapter.name, path18.join(base, "agents"), root);
22148
+ const base = scope === "global" ? path19.join(homedir5(), ".config", "opencode") : path19.join(root, ".opencode");
22149
+ addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
22150
+ addManagedTarget(targets.agentTargets, adapter.name, path19.join(base, "agents"), root);
22023
22151
  break;
22024
22152
  }
22025
22153
  case "Kiro": {
22026
- const kiroBase = scope === "global" ? path18.join(homedir4(), ".kiro") : path18.join(root, ".kiro");
22027
- addManagedTarget(targets.skillTargets, adapter.name, path18.join(kiroBase, "skills"), root);
22154
+ const kiroBase = scope === "global" ? path19.join(homedir5(), ".kiro") : path19.join(root, ".kiro");
22155
+ addManagedTarget(targets.skillTargets, adapter.name, path19.join(kiroBase, "skills"), root);
22028
22156
  break;
22029
22157
  }
22030
22158
  case "Devin Desktop": {
22031
- const devinBase = scope === "global" ? path18.join(process.env.XDG_CONFIG_HOME || path18.join(homedir4(), ".config"), "devin") : path18.join(root, ".devin");
22032
- addManagedTarget(targets.skillTargets, adapter.name, path18.join(devinBase, "skills"), root);
22159
+ const devinBase = scope === "global" ? path19.join(process.env.XDG_CONFIG_HOME || path19.join(homedir5(), ".config"), "devin") : path19.join(root, ".devin");
22160
+ addManagedTarget(targets.skillTargets, adapter.name, path19.join(devinBase, "skills"), root);
22033
22161
  break;
22034
22162
  }
22035
22163
  }
@@ -22043,12 +22171,12 @@ function stripFrontmatter(content) {
22043
22171
  return match ? content.slice(match[0].length).trim() : content.trim();
22044
22172
  }
22045
22173
  function readAndConcatRules(rulesDir) {
22046
- if (!fs17.existsSync(rulesDir)) return null;
22047
- const files = fs17.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
22174
+ if (!fs18.existsSync(rulesDir)) return null;
22175
+ const files = fs18.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
22048
22176
  if (files.length === 0) return null;
22049
22177
  const parts = [];
22050
22178
  for (const file of files) {
22051
- const raw = fs17.readFileSync(path18.join(rulesDir, file), "utf8");
22179
+ const raw = fs18.readFileSync(path19.join(rulesDir, file), "utf8");
22052
22180
  const stripped = stripFrontmatter(raw);
22053
22181
  if (stripped) parts.push(stripped);
22054
22182
  }
@@ -22083,7 +22211,7 @@ function injectCodexRules(configPath, rulesDir) {
22083
22211
  return configPath;
22084
22212
  }
22085
22213
  function removeCodexRules(configPath) {
22086
- if (!fs17.existsSync(configPath)) return false;
22214
+ if (!fs18.existsSync(configPath)) return false;
22087
22215
  const config = readToml(configPath);
22088
22216
  const existing = config.developer_instructions;
22089
22217
  if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
@@ -22175,10 +22303,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
22175
22303
  }
22176
22304
 
22177
22305
  // ../argent-installer/src/retired-files.ts
22178
- import * as path19 from "node:path";
22306
+ import * as path20 from "node:path";
22179
22307
  var import_picocolors = __toESM(require_picocolors(), 1);
22180
22308
  function displayPath(entry, file) {
22181
- return path19.join(entry.location, ...file.relativePath.split("/"));
22309
+ return path20.join(entry.location, ...file.relativePath.split("/"));
22182
22310
  }
22183
22311
  async function cleanupRetiredFiles(found, options) {
22184
22312
  const result = { removed: [], declined: [], failed: [], removedRoots: [] };
@@ -22229,14 +22357,14 @@ async function reportRetiredFiles(found, interactive) {
22229
22357
 
22230
22358
  // ../argent-installer/src/cli-record.ts
22231
22359
  var import_semver4 = __toESM(require_semver2(), 1);
22232
- import * as fs18 from "node:fs";
22233
- import * as path20 from "node:path";
22360
+ import * as fs19 from "node:fs";
22361
+ import * as path21 from "node:path";
22234
22362
  function cliRecordPath() {
22235
- return path20.join(argentHomeDir(), "cli.json");
22363
+ return path21.join(argentHomeDir(), "cli.json");
22236
22364
  }
22237
22365
  function readCliRecord() {
22238
22366
  try {
22239
- const parsed = JSON.parse(fs18.readFileSync(cliRecordPath(), "utf8"));
22367
+ const parsed = JSON.parse(fs19.readFileSync(cliRecordPath(), "utf8"));
22240
22368
  if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
22241
22369
  return null;
22242
22370
  } catch {
@@ -22246,14 +22374,14 @@ function readCliRecord() {
22246
22374
  function resolveCliEntry(mode, projectRoot) {
22247
22375
  if (mode === "local") {
22248
22376
  const relative5 = getLocalArgentBinRelPath(projectRoot);
22249
- return relative5 ? path20.resolve(projectRoot, relative5) : null;
22377
+ return relative5 ? path21.resolve(projectRoot, relative5) : null;
22250
22378
  }
22251
22379
  const packageRoot = getGloballyInstalledPackageRoot();
22252
22380
  if (!packageRoot) return null;
22253
22381
  const binSub = argentBinSubpath(packageRoot);
22254
22382
  if (!binSub) return null;
22255
- const entry = path20.join(packageRoot, binSub);
22256
- return fs18.existsSync(entry) ? entry : null;
22383
+ const entry = path21.join(packageRoot, binSub);
22384
+ return fs19.existsSync(entry) ? entry : null;
22257
22385
  }
22258
22386
  function writeCliRecord(input) {
22259
22387
  const cli = resolveCliEntry(input.mode, input.projectRoot);
@@ -22269,10 +22397,10 @@ function writeCliRecord(input) {
22269
22397
  function persistCliRecord(record) {
22270
22398
  const file = cliRecordPath();
22271
22399
  try {
22272
- fs18.mkdirSync(path20.dirname(file), { recursive: true });
22400
+ fs19.mkdirSync(path21.dirname(file), { recursive: true });
22273
22401
  const temporary = `${file}.${process.pid}.tmp`;
22274
- fs18.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
22275
- fs18.renameSync(temporary, file);
22402
+ fs19.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
22403
+ fs19.renameSync(temporary, file);
22276
22404
  return file;
22277
22405
  } catch {
22278
22406
  return null;
@@ -22280,10 +22408,10 @@ function persistCliRecord(record) {
22280
22408
  }
22281
22409
  function healCliRecord(input) {
22282
22410
  try {
22283
- if (!fs18.existsSync(input.cli)) return null;
22411
+ if (!fs19.existsSync(input.cli)) return null;
22284
22412
  const existing = readCliRecord();
22285
22413
  if (existing) {
22286
- const alive = fs18.existsSync(existing.node) && fs18.existsSync(existing.cli);
22414
+ const alive = fs19.existsSync(existing.node) && fs19.existsSync(existing.cli);
22287
22415
  const ourVersion = import_semver4.default.valid(input.version);
22288
22416
  const theirVersion = import_semver4.default.valid(existing.version);
22289
22417
  const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
@@ -22304,11 +22432,11 @@ function removeCliRecordFor(installDir) {
22304
22432
  if (!installDir) return false;
22305
22433
  const record = readCliRecord();
22306
22434
  if (!record) return false;
22307
- const root = path20.resolve(installDir);
22308
- const relative5 = path20.relative(root, path20.resolve(record.cli));
22309
- if (relative5.startsWith("..") || path20.isAbsolute(relative5)) return false;
22435
+ const root = path21.resolve(installDir);
22436
+ const relative5 = path21.relative(root, path21.resolve(record.cli));
22437
+ if (relative5.startsWith("..") || path21.isAbsolute(relative5)) return false;
22310
22438
  try {
22311
- fs18.rmSync(cliRecordPath(), { force: true });
22439
+ fs19.rmSync(cliRecordPath(), { force: true });
22312
22440
  return true;
22313
22441
  } catch {
22314
22442
  return false;
@@ -22529,6 +22657,8 @@ async function promptInstallMode(defaultMode = "global") {
22529
22657
 
22530
22658
  // ../argent-installer/src/install-runner.ts
22531
22659
  var import_picocolors4 = __toESM(require_picocolors(), 1);
22660
+ import * as fs21 from "node:fs";
22661
+ import * as path23 from "node:path";
22532
22662
 
22533
22663
  // ../argent-installer/src/shell.ts
22534
22664
  import { execFileSync as execFileSync5, spawn as spawn2 } from "node:child_process";
@@ -22560,11 +22690,12 @@ var ShellCommandError = class extends Error {
22560
22690
  signal;
22561
22691
  };
22562
22692
  function runShellCommand(cmd, opts = {}) {
22563
- return new Promise((resolve17, reject) => {
22693
+ return new Promise((resolve20, reject) => {
22564
22694
  const child = spawn2(cmd.bin, cmd.args, {
22565
22695
  stdio: ["ignore", "pipe", "pipe"],
22566
22696
  shell: process.platform === "win32",
22567
- ...opts.cwd ? { cwd: opts.cwd } : {}
22697
+ ...opts.cwd ? { cwd: opts.cwd } : {},
22698
+ ...opts.env ? { env: opts.env } : {}
22568
22699
  });
22569
22700
  let stdout2 = "";
22570
22701
  let stderr = "";
@@ -22575,7 +22706,7 @@ function runShellCommand(cmd, opts = {}) {
22575
22706
  stderr += chunk.toString();
22576
22707
  });
22577
22708
  child.on("close", (code, signal) => {
22578
- if (code === 0) resolve17();
22709
+ if (code === 0) resolve20();
22579
22710
  else
22580
22711
  reject(
22581
22712
  new ShellCommandError(
@@ -22591,8 +22722,8 @@ function runShellCommand(cmd, opts = {}) {
22591
22722
 
22592
22723
  // ../argent-installer/src/skills.ts
22593
22724
  import { execFileSync as execFileSync6 } from "node:child_process";
22594
- import * as fs19 from "node:fs";
22595
- import * as path21 from "node:path";
22725
+ import * as fs20 from "node:fs";
22726
+ import * as path22 from "node:path";
22596
22727
  var import_picocolors3 = __toESM(require_picocolors(), 1);
22597
22728
  function getScopeSpecs(projectRoot) {
22598
22729
  return [
@@ -22672,13 +22803,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
22672
22803
  let candidates = names;
22673
22804
  if (names.length === 0) {
22674
22805
  try {
22675
- candidates = fs19.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
22806
+ candidates = fs20.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
22676
22807
  } catch {
22677
22808
  continue;
22678
22809
  }
22679
22810
  }
22680
22811
  for (const name of candidates) {
22681
- const stat6 = fs19.statSync(path21.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
22812
+ const stat6 = fs20.statSync(path22.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
22682
22813
  if (!stat6?.isFile()) continue;
22683
22814
  found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
22684
22815
  }
@@ -22696,7 +22827,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
22696
22827
  const removed = /* @__PURE__ */ new Set();
22697
22828
  for (const { targetPath } of skillTargets) {
22698
22829
  for (const name of legacy) {
22699
- const dir = path21.join(targetPath, name);
22830
+ const dir = path22.join(targetPath, name);
22700
22831
  try {
22701
22832
  if (removePath(dir)) removed.add(name);
22702
22833
  } catch {
@@ -22716,13 +22847,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
22716
22847
  }
22717
22848
  function removeLockEntries(lockPath, names) {
22718
22849
  try {
22719
- const lock = JSON.parse(fs19.readFileSync(lockPath, "utf8"));
22850
+ const lock = JSON.parse(fs20.readFileSync(lockPath, "utf8"));
22720
22851
  const skills = lock.skills;
22721
22852
  if (!skills) return [];
22722
22853
  const removed = names.filter((name) => name in skills);
22723
22854
  if (removed.length === 0) return [];
22724
22855
  for (const name of removed) delete skills[name];
22725
- fs19.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
22856
+ fs20.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
22726
22857
  return removed;
22727
22858
  } catch {
22728
22859
  return [];
@@ -22787,6 +22918,9 @@ async function runInstall(args) {
22787
22918
  }
22788
22919
  return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
22789
22920
  }
22921
+ function installSpec(fromTar) {
22922
+ return fs21.existsSync(fromTar) ? path23.resolve(fromTar) : fromTar;
22923
+ }
22790
22924
  async function installLocally(opts) {
22791
22925
  const { fromTar, tel } = opts;
22792
22926
  const projectRoot = resolveProjectRoot2(process.cwd());
@@ -22811,7 +22945,7 @@ async function installLocally(opts) {
22811
22945
  return;
22812
22946
  }
22813
22947
  const pm = detectProjectPackageManager(projectRoot);
22814
- const installTarget = fromTar ?? PACKAGE_NAME;
22948
+ const installTarget = fromTar ? installSpec(fromTar) : PACKAGE_NAME;
22815
22949
  const materializeOnly = isDeclaredLocally(projectRoot) && !fromTar;
22816
22950
  const cmd = materializeOnly ? projectInstallCommand(pm) : localInstallCommand(pm, installTarget);
22817
22951
  const cmdStr = formatShellCommand(cmd);
@@ -22892,18 +23026,18 @@ async function runGlobal(opts) {
22892
23026
  const { fromTar, nonInteractive, tel } = opts;
22893
23027
  let version = opts.version;
22894
23028
  const globallyInstalled = isGloballyInstalled();
23029
+ const pm = detectGlobalPackageManager();
22895
23030
  if (!globallyInstalled) {
22896
23031
  log.info(`Argent is not installed globally \u2014 installing.`);
22897
23032
  track("installation:global_install_decision", { decision: "install" });
22898
- const pm = detectPackageManager();
22899
- const installTarget = fromTar ?? PACKAGE_NAME;
23033
+ const installTarget = fromTar ? installSpec(fromTar) : PACKAGE_NAME;
22900
23034
  const cmd = globalInstallCommand(pm, installTarget);
22901
23035
  const cmdStr = formatShellCommand(cmd);
22902
23036
  const spinner3 = spinner();
22903
23037
  spinner3.start(`Installing ${PACKAGE_NAME} globally...`);
22904
23038
  const packageActionStartedAt2 = performance.now();
22905
23039
  try {
22906
- await runShellCommand(cmd);
23040
+ await runShellCommand(cmd, globalCommandOptions(pm));
22907
23041
  spinner3.stop(import_picocolors4.default.green("Installed globally."));
22908
23042
  if (!isGloballyInstalled()) {
22909
23043
  log.warn(
@@ -22928,19 +23062,18 @@ async function runGlobal(opts) {
22928
23062
  return version;
22929
23063
  }
22930
23064
  if (fromTar) {
22931
- const pm = detectPackageManager();
22932
- const cmd = globalInstallCommand(pm, fromTar);
23065
+ const cmd = globalInstallCommand(pm, installSpec(fromTar));
22933
23066
  const cmdStr = formatShellCommand(cmd);
22934
23067
  const spinner3 = spinner();
22935
23068
  spinner3.start(`Installing from ${fromTar}...`);
22936
23069
  try {
22937
- await runShellCommand(cmd);
23070
+ await runShellCommand(cmd, globalCommandOptions(pm));
22938
23071
  spinner3.stop(import_picocolors4.default.green("Installed from tarball."));
22939
23072
  version = getGloballyInstalledVersion() ?? getInstalledVersion() ?? version;
22940
23073
  } catch (err) {
22941
23074
  spinner3.stop(import_picocolors4.default.red("Installation failed."));
22942
23075
  log.error(`${err}`);
22943
- log.info(`Install manually with: ${import_picocolors4.default.cyan(cmdStr)}`);
23076
+ log.info(`Install manually with: ${import_picocolors4.default.cyan(cmdStr)}${yarnClassicNote(cmd)}`);
22944
23077
  await tel.finalize(INSTALL_FROM_TAR_PACKAGE_FAILED);
22945
23078
  process.exit(1);
22946
23079
  }
@@ -22997,14 +23130,13 @@ async function runGlobal(opts) {
22997
23130
  if (isCancel(updateChoice) || updateChoice === "skip") {
22998
23131
  await tel.trackPackageAction("update_skipped", packageActionStartedAt, true);
22999
23132
  } else if (updateChoice === "update") {
23000
- const pm = detectPackageManager();
23001
23133
  const cmd = globalInstallCommand(pm, `${PACKAGE_NAME}@${latest}`);
23002
23134
  const cmdStr = formatShellCommand(cmd);
23003
23135
  const updateSpinner = spinner();
23004
23136
  updateSpinner.start(`Updating to v${latest}...`);
23005
23137
  const updateStartedAt = performance.now();
23006
23138
  try {
23007
- await runShellCommand(cmd);
23139
+ await runShellCommand(cmd, globalCommandOptions(pm));
23008
23140
  updateSpinner.stop(import_picocolors4.default.green(`Updated to v${latest}.`));
23009
23141
  version = getGloballyInstalledVersion() ?? getInstalledVersion() ?? version;
23010
23142
  await tel.trackPackageAction("init_triggered_update", updateStartedAt, true);
@@ -23012,7 +23144,7 @@ async function runGlobal(opts) {
23012
23144
  } catch (err) {
23013
23145
  updateSpinner.stop(import_picocolors4.default.red("Update failed."));
23014
23146
  log.error(`${err}`);
23015
- log.info(`You can update manually later: ${import_picocolors4.default.cyan(cmdStr)}`);
23147
+ log.info(`You can update manually later: ${import_picocolors4.default.cyan(cmdStr)}${yarnClassicNote(cmd)}`);
23016
23148
  await tel.trackPackageAction(
23017
23149
  "update_failed",
23018
23150
  updateStartedAt,
@@ -23094,8 +23226,8 @@ async function chooseAdapters(opts) {
23094
23226
 
23095
23227
  // ../argent-installer/src/init-scope.ts
23096
23228
  var import_picocolors6 = __toESM(require_picocolors(), 1);
23097
- import { existsSync as existsSync13 } from "node:fs";
23098
- import { resolve as resolve11 } from "node:path";
23229
+ import { existsSync as existsSync14 } from "node:fs";
23230
+ import { resolve as resolve14 } from "node:path";
23099
23231
  async function chooseScope(opts) {
23100
23232
  if (opts.installMode === "local") {
23101
23233
  return { scope: "local" };
@@ -23132,13 +23264,13 @@ async function chooseScope(opts) {
23132
23264
  placeholder: process.cwd(),
23133
23265
  validate(value) {
23134
23266
  if (!value?.trim()) return "Path cannot be empty.";
23135
- const resolved = resolve11(value.trim());
23136
- if (!existsSync13(resolved))
23267
+ const resolved = resolve14(value.trim());
23268
+ if (!existsSync14(resolved))
23137
23269
  return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
23138
23270
  }
23139
23271
  });
23140
23272
  if (isCancel(customPathInput)) throw new InitCancelled("scope");
23141
- return { scope: "custom", customRoot: resolve11(customPathInput.trim()) };
23273
+ return { scope: "custom", customRoot: resolve14(customPathInput.trim()) };
23142
23274
  }
23143
23275
 
23144
23276
  // ../argent-installer/src/init-mcp-write.ts
@@ -23241,7 +23373,7 @@ async function cleanupStaleMcpConfigs(args) {
23241
23373
  const lines = [];
23242
23374
  let removedCount = 0;
23243
23375
  let warnedCount = 0;
23244
- const globalArgentOnPath = isGloballyInstalled();
23376
+ const globalArgentOnPath = isArgentOnPath();
23245
23377
  const isProvablyDead = (entry) => entry !== null && entry.command === MCP_BINARY_NAME && !globalArgentOnPath && !hasCustomizingEnv(entry);
23246
23378
  const removed = (adapterName, location, what) => {
23247
23379
  removedCount += 1;
@@ -23437,8 +23569,8 @@ async function configureAllowlist(args) {
23437
23569
  // ../argent-installer/src/init-skills.ts
23438
23570
  var import_picocolors10 = __toESM(require_picocolors(), 1);
23439
23571
  import { spawn as spawn3 } from "node:child_process";
23440
- import * as os3 from "node:os";
23441
- import * as path22 from "node:path";
23572
+ import * as os4 from "node:os";
23573
+ import * as path24 from "node:path";
23442
23574
  var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
23443
23575
  function meaningfulLine(err) {
23444
23576
  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));
@@ -23446,10 +23578,10 @@ function meaningfulLine(err) {
23446
23578
  }
23447
23579
  function bundledCopyFor(version) {
23448
23580
  const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
23449
- if (local.packageDir && local.version === version) return path22.join(local.packageDir, "skills");
23581
+ if (local.packageDir && local.version === version) return path24.join(local.packageDir, "skills");
23450
23582
  const globalRoot = getGloballyInstalledPackageRoot();
23451
23583
  if (globalRoot && getGloballyInstalledVersion() === version) {
23452
- return path22.join(globalRoot, "skills");
23584
+ return path24.join(globalRoot, "skills");
23453
23585
  }
23454
23586
  return SKILLS_DIR;
23455
23587
  }
@@ -23545,7 +23677,7 @@ async function runSkillsStep(args) {
23545
23677
  const useGitHubSource = online && !fromTar && version !== "unknown";
23546
23678
  const skillsSource = useGitHubSource ? buildArgentSkillsSource(version) : SKILLS_DIR;
23547
23679
  const bundledCopy = useGitHubSource ? bundledCopyFor(version) : SKILLS_DIR;
23548
- const skillsRoot = scope === "global" ? os3.homedir() : effectiveRoot;
23680
+ const skillsRoot = scope === "global" ? os4.homedir() : effectiveRoot;
23549
23681
  const skillsScope = scope === "global" ? "global" : "project";
23550
23682
  const expected = listBundledSkills(bundledCopy);
23551
23683
  const snapshot = () => snapshotArgentSkills(skillsRoot, skillsScope, expected);
@@ -23659,7 +23791,7 @@ async function runSkillsStep(args) {
23659
23791
  };
23660
23792
  }
23661
23793
  function runNpxSkills(args, interactive, cwd) {
23662
- return new Promise((resolve17, reject) => {
23794
+ return new Promise((resolve20, reject) => {
23663
23795
  const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
23664
23796
  const child = spawn3(npxCmd, args, {
23665
23797
  env: npxChildEnv(),
@@ -23679,7 +23811,7 @@ function runNpxSkills(args, interactive, cwd) {
23679
23811
  }
23680
23812
  child.on("close", (code, signal) => {
23681
23813
  if (code === 0) {
23682
- resolve17();
23814
+ resolve20();
23683
23815
  } else {
23684
23816
  const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
23685
23817
  reject(
@@ -23995,7 +24127,7 @@ function printBanner() {
23995
24127
  // ../argent-installer/src/update.ts
23996
24128
  var import_picocolors12 = __toESM(require_picocolors(), 1);
23997
24129
  var import_semver5 = __toESM(require_semver2(), 1);
23998
- import * as path28 from "node:path";
24130
+ import * as path30 from "node:path";
23999
24131
 
24000
24132
  // ../argent-installer/src/install-targets.ts
24001
24133
  function parseTargetFlags(args) {
@@ -24045,10 +24177,10 @@ async function promptInstallTargets(verb) {
24045
24177
 
24046
24178
  // ../argent-installer/src/update-target.ts
24047
24179
  var import_update_core = __toESM(require_dist3(), 1);
24048
- async function resolveInstallableUpdateTarget(pm, current) {
24180
+ async function resolveInstallableUpdateTarget(pm, current, cwd) {
24049
24181
  const info = await (0, import_update_core.fetchRegistryInfo)(`${NPM_REGISTRY}/${PACKAGE_NAME}`);
24050
24182
  if (info === null) return null;
24051
- const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm);
24183
+ const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm, cwd);
24052
24184
  const target = (0, import_update_core.pickInstallableTarget)(info.latest, info.times, current, minReleaseAgeMs);
24053
24185
  return {
24054
24186
  latestVersion: info.latest.version,
@@ -24060,17 +24192,17 @@ async function resolveInstallableUpdateTarget(pm, current) {
24060
24192
 
24061
24193
  // ../argent-tools-client/src/launcher.ts
24062
24194
  import * as net from "node:net";
24063
- import * as fs20 from "node:fs";
24064
- import * as path23 from "node:path";
24195
+ import * as fs22 from "node:fs";
24196
+ import * as path25 from "node:path";
24065
24197
  import * as readline from "node:readline";
24066
- import { homedir as homedir6 } from "node:os";
24198
+ import { homedir as homedir7 } from "node:os";
24067
24199
  import { spawn as spawn4, execFileSync as execFileSync7 } from "node:child_process";
24068
24200
  import { createHash as createHash3, randomBytes } from "node:crypto";
24069
24201
  import { mkdir, writeFile, readFile, readdir as readdir2, unlink, rename, chmod } from "node:fs/promises";
24070
- var STATE_DIR = path23.join(homedir6(), ".argent");
24071
- var STATE_FILE = path23.join(STATE_DIR, "tool-server.json");
24072
- var LOG_FILE = path23.join(STATE_DIR, "tool-server.log");
24073
- var LOCK_FILE = path23.join(STATE_DIR, "tool-server.lock");
24202
+ var STATE_DIR = path25.join(homedir7(), ".argent");
24203
+ var STATE_FILE = path25.join(STATE_DIR, "tool-server.json");
24204
+ var LOG_FILE = path25.join(STATE_DIR, "tool-server.log");
24205
+ var LOCK_FILE = path25.join(STATE_DIR, "tool-server.lock");
24074
24206
  function isProcessAlive(pid) {
24075
24207
  try {
24076
24208
  process.kill(pid, 0);
@@ -24081,7 +24213,7 @@ function isProcessAlive(pid) {
24081
24213
  }
24082
24214
  function stateFileForBundle(bundlePath) {
24083
24215
  const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
24084
- return path23.join(STATE_DIR, `tool-server-${key}.json`);
24216
+ return path25.join(STATE_DIR, `tool-server-${key}.json`);
24085
24217
  }
24086
24218
  async function readStateFile(file) {
24087
24219
  try {
@@ -24123,7 +24255,7 @@ async function readAllToolsServerStates() {
24123
24255
  const out = [];
24124
24256
  for (const name of names) {
24125
24257
  if (!STATE_FILE_RE.test(name)) continue;
24126
- const file = path23.join(STATE_DIR, name);
24258
+ const file = path25.join(STATE_DIR, name);
24127
24259
  const state2 = await readStateFile(file);
24128
24260
  if (state2) out.push({ file, state: state2 });
24129
24261
  }
@@ -24169,21 +24301,21 @@ async function killToolServer(bundlePath) {
24169
24301
  return alive;
24170
24302
  }
24171
24303
  function isPathWithin(child, parent) {
24172
- const rel = path23.relative(parent, child);
24173
- return rel !== "" && !rel.startsWith("..") && !path23.isAbsolute(rel);
24304
+ const rel = path25.relative(parent, child);
24305
+ return rel !== "" && !rel.startsWith("..") && !path25.isAbsolute(rel);
24174
24306
  }
24175
24307
  function tryRealpath(p) {
24176
24308
  try {
24177
- return fs20.realpathSync(p);
24309
+ return fs22.realpathSync(p);
24178
24310
  } catch {
24179
24311
  return p;
24180
24312
  }
24181
24313
  }
24182
24314
  async function killToolServerForInstallDir(packageDir) {
24183
- const parents = /* @__PURE__ */ new Set([path23.resolve(packageDir), tryRealpath(packageDir)]);
24315
+ const parents = /* @__PURE__ */ new Set([path25.resolve(packageDir), tryRealpath(packageDir)]);
24184
24316
  let killed = 0;
24185
24317
  for (const { file, state: state2 } of await readAllToolsServerStates()) {
24186
- const bundles = /* @__PURE__ */ new Set([path23.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
24318
+ const bundles = /* @__PURE__ */ new Set([path25.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
24187
24319
  const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
24188
24320
  if (!matches2) continue;
24189
24321
  const fresh = await readStateFile(file);
@@ -24201,7 +24333,7 @@ async function killToolServerForInstallDir(packageDir) {
24201
24333
  }
24202
24334
  return killed;
24203
24335
  }
24204
- var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs20.existsSync(p)) ?? "ps";
24336
+ var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs22.existsSync(p)) ?? "ps";
24205
24337
  var PS_WIDTH_FLAGS = ["-ww"];
24206
24338
  var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
24207
24339
  function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
@@ -24248,14 +24380,14 @@ function couldBeOurToolServer(pid, marker) {
24248
24380
  var import_yaml4 = __toESM(require_dist2(), 1);
24249
24381
  import { readFile as readFile5 } from "node:fs/promises";
24250
24382
  import { maxHeaderSize } from "node:http";
24251
- import * as path27 from "node:path";
24383
+ import * as path29 from "node:path";
24252
24384
 
24253
24385
  // ../argent-tools-client/src/link-config.ts
24254
- import * as path24 from "node:path";
24255
- import { homedir as homedir7 } from "node:os";
24386
+ import * as path26 from "node:path";
24387
+ import { homedir as homedir8 } from "node:os";
24256
24388
  import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
24257
- var LINK_DIR = path24.join(homedir7(), ".argent");
24258
- var LINK_FILE = path24.join(LINK_DIR, "link.json");
24389
+ var LINK_DIR = path26.join(homedir8(), ".argent");
24390
+ var LINK_FILE = path26.join(LINK_DIR, "link.json");
24259
24391
 
24260
24392
  // ../argent-tools-client/src/file-inputs.ts
24261
24393
  import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
@@ -24272,14 +24404,14 @@ import {
24272
24404
  writeFile as writeFile3
24273
24405
  } from "node:fs/promises";
24274
24406
  import { constants, tmpdir } from "node:os";
24275
- import * as path25 from "node:path";
24407
+ import * as path27 from "node:path";
24276
24408
 
24277
24409
  // ../archive/src/index.ts
24278
24410
  import { spawn as spawn5 } from "node:child_process";
24279
24411
  import { once } from "node:events";
24280
24412
  import { createReadStream, createWriteStream } from "node:fs";
24281
24413
  import { open, rm, readdir as readdir3 } from "node:fs/promises";
24282
- import { basename as basename4, dirname as dirname13, join as join24, resolve as resolve13, sep as sep4 } from "node:path";
24414
+ import { basename as basename4, dirname as dirname14, join as join24, resolve as resolve16, sep as sep4 } from "node:path";
24283
24415
  import { Writable } from "node:stream";
24284
24416
  import { pipeline } from "node:stream/promises";
24285
24417
  import zlib2 from "node:zlib";
@@ -24297,7 +24429,7 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
24297
24429
  // ../argent-tools-client/src/flow-files.ts
24298
24430
  var import_yaml3 = __toESM(require_dist2(), 1);
24299
24431
  import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
24300
- import * as path26 from "node:path";
24432
+ import * as path28 from "node:path";
24301
24433
  var INLINE_MEMBERS_BYTES = 256 * 1024;
24302
24434
 
24303
24435
  // ../argent-tools-client/src/artifacts.ts
@@ -24313,7 +24445,7 @@ import {
24313
24445
  } from "node:fs/promises";
24314
24446
  import { constants as fsConstants } from "node:fs";
24315
24447
  import { tmpdir as tmpdir2 } from "node:os";
24316
- import { basename as basename7, dirname as dirname17, extname as extname2, isAbsolute as isAbsolute8, join as join28, normalize as normalize2, resolve as resolve15, sep as sep6 } from "node:path";
24448
+ import { basename as basename7, dirname as dirname18, extname as extname2, isAbsolute as isAbsolute8, join as join28, normalize as normalize2, resolve as resolve18, sep as sep6 } from "node:path";
24317
24449
  import { createHash as createHash5 } from "node:crypto";
24318
24450
  var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
24319
24451
  var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
@@ -24483,7 +24615,8 @@ async function update(args) {
24483
24615
  }
24484
24616
  const spinner2 = spinner();
24485
24617
  spinner2.start("Checking for updates...");
24486
- const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectPackageManager();
24618
+ const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
24619
+ const runIn = mode === "local" ? { cwd: projectRoot } : globalCommandOptions(pm);
24487
24620
  let latest = null;
24488
24621
  let target;
24489
24622
  let minReleaseAgeMs = 0;
@@ -24492,7 +24625,7 @@ async function update(args) {
24492
24625
  } else {
24493
24626
  let resolved;
24494
24627
  try {
24495
- resolved = await resolveInstallableUpdateTarget(pm, installed);
24628
+ resolved = await resolveInstallableUpdateTarget(pm, installed, runIn.cwd);
24496
24629
  } catch (err) {
24497
24630
  spinner2.stop(import_picocolors12.default.red("Could not reach registry."));
24498
24631
  await trackPackageAction(
@@ -24588,9 +24721,8 @@ async function update(args) {
24588
24721
  // Current versions ship no postinstall, but downgrades and pinned
24589
24722
  // installs fetch older ones whose postinstall honors this — keep it
24590
24723
  // so they stay quiet and don't double-kill the tool server.
24591
- env: { ...process.env, ARGENT_SKIP_POSTINSTALL: "1" },
24592
- // Local installs must rewrite the project's manifest/lockfile.
24593
- ...mode === "local" ? { cwd: projectRoot } : {}
24724
+ env: { ...runIn.env ?? process.env, ARGENT_SKIP_POSTINSTALL: "1" },
24725
+ cwd: runIn.cwd
24594
24726
  });
24595
24727
  },
24596
24728
  () => {
@@ -24611,6 +24743,8 @@ async function update(args) {
24611
24743
  UPDATE_PACKAGE_ACTION_FAILED
24612
24744
  );
24613
24745
  log.error(`${installed ? "Update" : "Install"} failed: ${installError}`);
24746
+ const note2 = yarnClassicNote(cmd);
24747
+ if (note2) log.info(`Run ${import_picocolors12.default.cyan(cmdStr)}${note2}.`);
24614
24748
  return { failed: UPDATE_PACKAGE_ACTION_FAILED };
24615
24749
  }
24616
24750
  log.warn(
@@ -24672,7 +24806,7 @@ async function update(args) {
24672
24806
  process.exit(1);
24673
24807
  }
24674
24808
  const rootOverride = getProjectRootOverride(args);
24675
- const projectRoot = rootOverride ? path28.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
24809
+ const projectRoot = rootOverride ? path30.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
24676
24810
  installMode = resolveInstallMode(projectRoot);
24677
24811
  const flags = parseTargetFlags(args);
24678
24812
  const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
@@ -24859,8 +24993,8 @@ async function update(args) {
24859
24993
  // ../argent-installer/src/uninstall.ts
24860
24994
  var import_picocolors13 = __toESM(require_picocolors(), 1);
24861
24995
  var import_yaml5 = __toESM(require_dist2(), 1);
24862
- import * as fs21 from "node:fs";
24863
- import * as path29 from "node:path";
24996
+ import * as fs23 from "node:fs";
24997
+ import * as path31 from "node:path";
24864
24998
  var UNINSTALL_TOOLSERVER_STOP_FAILED = {
24865
24999
  error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
24866
25000
  failure_stage: "installer_uninstall_toolserver_stop",
@@ -24881,10 +25015,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
24881
25015
  };
24882
25016
  function removeDirIfEmpty2(dirPath) {
24883
25017
  try {
24884
- if (!fs21.existsSync(dirPath)) return false;
24885
- if (!fs21.statSync(dirPath).isDirectory()) return false;
24886
- if (fs21.readdirSync(dirPath).length > 0) return false;
24887
- fs21.rmdirSync(dirPath);
25018
+ if (!fs23.existsSync(dirPath)) return false;
25019
+ if (!fs23.statSync(dirPath).isDirectory()) return false;
25020
+ if (fs23.readdirSync(dirPath).length > 0) return false;
25021
+ fs23.rmdirSync(dirPath);
24888
25022
  return true;
24889
25023
  } catch {
24890
25024
  return false;
@@ -24894,9 +25028,9 @@ function collectBundledPaths(sourceDir) {
24894
25028
  const files = [];
24895
25029
  const directories = [];
24896
25030
  function walk(currentDir, relativeDir = "") {
24897
- for (const entry of fs21.readdirSync(currentDir, { withFileTypes: true })) {
24898
- const relativePath = relativeDir ? path29.join(relativeDir, entry.name) : entry.name;
24899
- const absolutePath = path29.join(currentDir, entry.name);
25031
+ for (const entry of fs23.readdirSync(currentDir, { withFileTypes: true })) {
25032
+ const relativePath = relativeDir ? path31.join(relativeDir, entry.name) : entry.name;
25033
+ const absolutePath = path31.join(currentDir, entry.name);
24900
25034
  if (entry.isDirectory()) {
24901
25035
  walk(absolutePath, relativePath);
24902
25036
  directories.push(relativePath);
@@ -24909,15 +25043,15 @@ function collectBundledPaths(sourceDir) {
24909
25043
  return { files, directories };
24910
25044
  }
24911
25045
  function removeBundledContent(sourceDir, targetDir) {
24912
- if (!fs21.existsSync(sourceDir) || !fs21.existsSync(targetDir)) {
25046
+ if (!fs23.existsSync(sourceDir) || !fs23.existsSync(targetDir)) {
24913
25047
  return { removedPaths: [], removedRoot: false };
24914
25048
  }
24915
25049
  const { files, directories } = collectBundledPaths(sourceDir);
24916
25050
  const removedPaths = [];
24917
25051
  for (const relativePath of files) {
24918
- const targetPath = path29.join(targetDir, relativePath);
25052
+ const targetPath = path31.join(targetDir, relativePath);
24919
25053
  try {
24920
- const entry = fs21.lstatSync(targetPath, { throwIfNoEntry: false });
25054
+ const entry = fs23.lstatSync(targetPath, { throwIfNoEntry: false });
24921
25055
  if (!entry || entry.isDirectory()) continue;
24922
25056
  removePath(targetPath);
24923
25057
  removedPaths.push(relativePath);
@@ -24925,36 +25059,36 @@ function removeBundledContent(sourceDir, targetDir) {
24925
25059
  }
24926
25060
  }
24927
25061
  directories.sort(
24928
- (a2, b) => b.split(path29.sep).length - a2.split(path29.sep).length || b.length - a2.length
25062
+ (a2, b) => b.split(path31.sep).length - a2.split(path31.sep).length || b.length - a2.length
24929
25063
  );
24930
25064
  for (const relativePath of directories) {
24931
- const targetPath = path29.join(targetDir, relativePath);
25065
+ const targetPath = path31.join(targetDir, relativePath);
24932
25066
  try {
24933
- if (!fs21.existsSync(targetPath)) continue;
24934
- if (!fs21.statSync(targetPath).isDirectory()) continue;
24935
- if (fs21.readdirSync(targetPath).length > 0) continue;
24936
- fs21.rmdirSync(targetPath);
25067
+ if (!fs23.existsSync(targetPath)) continue;
25068
+ if (!fs23.statSync(targetPath).isDirectory()) continue;
25069
+ if (fs23.readdirSync(targetPath).length > 0) continue;
25070
+ fs23.rmdirSync(targetPath);
24937
25071
  } catch {
24938
25072
  }
24939
25073
  }
24940
25074
  let removedRoot = false;
24941
25075
  try {
24942
- if (fs21.existsSync(targetDir) && fs21.statSync(targetDir).isDirectory()) {
24943
- if (fs21.readdirSync(targetDir).length === 0) {
24944
- fs21.rmdirSync(targetDir);
25076
+ if (fs23.existsSync(targetDir) && fs23.statSync(targetDir).isDirectory()) {
25077
+ if (fs23.readdirSync(targetDir).length === 0) {
25078
+ fs23.rmdirSync(targetDir);
24945
25079
  removedRoot = true;
24946
25080
  }
24947
25081
  }
24948
25082
  } catch {
24949
25083
  }
24950
25084
  if (removedRoot) {
24951
- removeDirIfEmpty2(path29.dirname(targetDir));
25085
+ removeDirIfEmpty2(path31.dirname(targetDir));
24952
25086
  }
24953
25087
  return { removedPaths, removedRoot };
24954
25088
  }
24955
25089
  function readBundledSkillName(skillFilePath, fallbackName) {
24956
25090
  try {
24957
- const content = fs21.readFileSync(skillFilePath, "utf8");
25091
+ const content = fs23.readFileSync(skillFilePath, "utf8");
24958
25092
  const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
24959
25093
  if (!frontmatter) return fallbackName;
24960
25094
  const data = (0, import_yaml5.parse)(frontmatter);
@@ -24965,23 +25099,23 @@ function readBundledSkillName(skillFilePath, fallbackName) {
24965
25099
  }
24966
25100
  }
24967
25101
  function getBundledSkillNames(skillsDir) {
24968
- if (!fs21.existsSync(skillsDir)) return [];
25102
+ if (!fs23.existsSync(skillsDir)) return [];
24969
25103
  const skillNames = [];
24970
- for (const entry of fs21.readdirSync(skillsDir, { withFileTypes: true })) {
25104
+ for (const entry of fs23.readdirSync(skillsDir, { withFileTypes: true })) {
24971
25105
  if (!entry.isDirectory()) continue;
24972
- const skillFilePath = path29.join(skillsDir, entry.name, "SKILL.md");
24973
- if (!fs21.existsSync(skillFilePath)) continue;
25106
+ const skillFilePath = path31.join(skillsDir, entry.name, "SKILL.md");
25107
+ if (!fs23.existsSync(skillFilePath)) continue;
24974
25108
  skillNames.push(readBundledSkillName(skillFilePath, entry.name));
24975
25109
  }
24976
25110
  return [...new Set(skillNames)].sort();
24977
25111
  }
24978
25112
  function removeBundledSkillInstalls(skillNames, targetDir) {
24979
- if (!fs21.existsSync(targetDir)) {
25113
+ if (!fs23.existsSync(targetDir)) {
24980
25114
  return { removedPaths: [], removedRoot: false };
24981
25115
  }
24982
25116
  const removedPaths = [];
24983
25117
  for (const skillName of skillNames) {
24984
- const targetPath = path29.join(targetDir, skillName);
25118
+ const targetPath = path31.join(targetDir, skillName);
24985
25119
  try {
24986
25120
  if (removePath(targetPath)) removedPaths.push(skillName);
24987
25121
  } catch {
@@ -24989,17 +25123,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
24989
25123
  }
24990
25124
  const removedRoot = removeDirIfEmpty2(targetDir);
24991
25125
  if (removedRoot) {
24992
- removeDirIfEmpty2(path29.dirname(targetDir));
25126
+ removeDirIfEmpty2(path31.dirname(targetDir));
24993
25127
  }
24994
25128
  return { removedPaths, removedRoot };
24995
25129
  }
24996
25130
  function cleanupSkillsLockFile(lockPath, skillNames) {
24997
- if (!fs21.existsSync(lockPath)) {
25131
+ if (!fs23.existsSync(lockPath)) {
24998
25132
  return { removedSkills: [], removedFile: false };
24999
25133
  }
25000
25134
  let parsed;
25001
25135
  try {
25002
- parsed = JSON.parse(fs21.readFileSync(lockPath, "utf8"));
25136
+ parsed = JSON.parse(fs23.readFileSync(lockPath, "utf8"));
25003
25137
  } catch {
25004
25138
  return { removedSkills: [], removedFile: false };
25005
25139
  }
@@ -25026,10 +25160,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
25026
25160
  parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
25027
25161
  );
25028
25162
  if (!hasSkills && otherKeys.length === 0) {
25029
- fs21.rmSync(lockPath, { force: true });
25163
+ fs23.rmSync(lockPath, { force: true });
25030
25164
  return { removedSkills, removedFile: true };
25031
25165
  }
25032
- fs21.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
25166
+ fs23.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
25033
25167
  return { removedSkills, removedFile: false };
25034
25168
  }
25035
25169
  function cleanupBundledSkills(skillNames, targets) {
@@ -25132,7 +25266,7 @@ async function uninstall(args) {
25132
25266
  removeTargets = targetDecision.targets;
25133
25267
  }
25134
25268
  const scopesToClean = /* @__PURE__ */ new Set(["local", "global"]);
25135
- if (globalPresent && !removeTargets.includes("global")) {
25269
+ if (isArgentOnPath() && !removeTargets.includes("global")) {
25136
25270
  scopesToClean.delete("global");
25137
25271
  if (installMode === "global") scopesToClean.delete("local");
25138
25272
  }
@@ -25232,7 +25366,7 @@ async function uninstall(args) {
25232
25366
  ),
25233
25367
  { ask: false }
25234
25368
  );
25235
- for (const root of retired.removedRoots) removeDirIfEmpty2(path29.dirname(root));
25369
+ for (const root of retired.removedRoots) removeDirIfEmpty2(path31.dirname(root));
25236
25370
  const retiredLines = formatRetiredCleanup(retired);
25237
25371
  pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
25238
25372
  const retiredKept = retiredLines.kept.map((line) => ` ${line}`);
@@ -25306,9 +25440,11 @@ async function uninstall(args) {
25306
25440
  };
25307
25441
  }
25308
25442
  if (!globalPresent) return null;
25443
+ const pm = detectGlobalPackageManager();
25309
25444
  return {
25310
25445
  kind: "global",
25311
- cmd: globalUninstallCommand(detectPackageManager(), PACKAGE_NAME),
25446
+ cmd: globalUninstallCommand(pm, PACKAGE_NAME),
25447
+ ...globalCommandOptions(pm),
25312
25448
  prompt: `Uninstall the global ${PACKAGE_NAME} package?`,
25313
25449
  defaultRemove: false,
25314
25450
  installDir: getGloballyInstalledPackageRoot()
@@ -25322,6 +25458,7 @@ async function uninstall(args) {
25322
25458
  )
25323
25459
  );
25324
25460
  }
25461
+ let packageFailed = false;
25325
25462
  for (const removable of removables) {
25326
25463
  let shouldRemove = nonInteractive || removePreconfirmed;
25327
25464
  if (!nonInteractive && !removePreconfirmed) {
@@ -25346,28 +25483,41 @@ async function uninstall(args) {
25346
25483
  }
25347
25484
  log.info(`Running: ${import_picocolors13.default.dim(formatShellCommand(removable.cmd))}`);
25348
25485
  try {
25349
- execShellCommandSync(removable.cmd, removable.cwd ? { cwd: removable.cwd } : {});
25486
+ execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
25487
+ const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
25488
+ const removed = !leftover || removable.installDir !== null && !fs23.existsSync(removable.installDir);
25489
+ if (removed) hasUninstalledPackage = true;
25490
+ if (removed && removeCliRecordFor(removable.installDir)) {
25491
+ log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
25492
+ }
25493
+ if (leftover) {
25494
+ throw new Error(
25495
+ `${leftover} is still on PATH. Remove it with the package manager that installed it.`
25496
+ );
25497
+ }
25350
25498
  log.success(`Removed ${removable.kind} package.`);
25351
- hasUninstalledPackage = true;
25352
25499
  if (removable.kind === "global") hasUninstalledGlobalPackage = true;
25353
25500
  if (removable.kind === "local" && removeInstallRecord(projectRoot)) {
25354
25501
  log.info(import_picocolors13.default.dim("Removed .argent/install.json (local mode marker)."));
25355
25502
  }
25356
- if (removeCliRecordFor(removable.installDir)) {
25357
- log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
25358
- }
25359
25503
  } catch (err) {
25360
25504
  log.error(`${removable.kind} uninstall failed: ${err}`);
25361
- await finalizeUninstallTelemetry(
25362
- hasPrunedContent,
25363
- hasUninstalledPackage,
25364
- UNINSTALL_PACKAGE_ACTION_FAILED
25365
- );
25366
- return;
25505
+ const note2 = yarnClassicNote(removable.cmd);
25506
+ if (note2) log.info(`Run ${import_picocolors13.default.cyan(formatShellCommand(removable.cmd))}${note2}.`);
25507
+ packageFailed = true;
25367
25508
  }
25368
25509
  }
25510
+ if (packageFailed) {
25511
+ await finalizeUninstallTelemetry(
25512
+ hasPrunedContent,
25513
+ hasUninstalledPackage,
25514
+ UNINSTALL_PACKAGE_ACTION_FAILED
25515
+ );
25516
+ process.exitCode = 1;
25517
+ return;
25518
+ }
25369
25519
  await finalizeUninstallTelemetry(hasPrunedContent, hasUninstalledPackage);
25370
- if (hasUninstalledGlobalPackage || hasUninstalledPackage && !isGloballyInstalled()) {
25520
+ if (hasUninstalledGlobalPackage || hasUninstalledPackage && !isArgentOnPath()) {
25371
25521
  try {
25372
25522
  await resetLocalTelemetryState();
25373
25523
  } catch {