@swmansion/argent 0.35.1-next.4 → 0.35.1-next.41
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.
- package/README.md +16 -15
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +2353 -2063
- package/dist/client.js +302 -284
- package/dist/fatal-handlers.js +7 -1
- package/dist/fatal-handlers.js.map +1 -1
- package/dist/installer-help.js +2 -1
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +972 -753
- package/dist/mcp-server.mjs +1558 -1429
- package/dist/tool-args.generated.d.ts +396 -318
- package/dist/tool-server.cjs +105318 -102566
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/argent-audio-feeder +0 -0
- package/dylibs/tcp/libArgentAudio.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
- package/skills/argent-android-emulator-setup/SKILL.md +2 -2
- package/skills/argent-create-e2e/SKILL.md +2 -1
- package/skills/argent-create-e2e/references/e2e-yaml.md +25 -2
- package/skills/argent-create-e2e/references/live-authoring.md +13 -2
- package/skills/argent-device-interact/SKILL.md +21 -94
- package/skills/argent-device-interact/references/advanced.md +64 -0
- package/skills/argent-ios-device-interact/SKILL.md +1 -1
- package/skills/argent-ios-device-setup/SKILL.md +1 -1
- package/skills/argent-ios-simulator-setup/SKILL.md +1 -1
- package/skills/argent-lens/SKILL.md +1 -1
- package/skills/argent-macos-app-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +4 -4
- package/skills/argent-native-profiler/SKILL.md +1 -1
- package/skills/argent-qa-e2e/SKILL.md +1 -1
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/SKILL.md +1 -1
- package/skills/argent-react-native-profiler/SKILL.md +1 -1
- package/skills/argent-screen-recording/SKILL.md +1 -1
- package/skills/argent-screenshot-diff/SKILL.md +1 -1
- package/skills/argent-settings-permissions/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
- package/skills/argent-tv-interact/SKILL.md +1 -1
package/dist/installer.mjs
CHANGED
|
@@ -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,
|
|
3656
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
3655
|
+
function visit_(key, node, visitor, path34) {
|
|
3656
|
+
const ctrl = callVisitor(key, node, visitor, path34);
|
|
3657
3657
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3658
|
-
replaceNode(key,
|
|
3659
|
-
return visit_(key, ctrl, visitor,
|
|
3658
|
+
replaceNode(key, path34, ctrl);
|
|
3659
|
+
return visit_(key, ctrl, visitor, path34);
|
|
3660
3660
|
}
|
|
3661
3661
|
if (typeof ctrl !== "symbol") {
|
|
3662
3662
|
if (identity2.isCollection(node)) {
|
|
3663
|
-
|
|
3663
|
+
path34 = Object.freeze(path34.concat(node));
|
|
3664
3664
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
3665
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
3665
|
+
const ci = visit_(i2, node.items[i2], visitor, path34);
|
|
3666
3666
|
if (typeof ci === "number")
|
|
3667
3667
|
i2 = ci - 1;
|
|
3668
3668
|
else if (ci === BREAK)
|
|
@@ -3673,13 +3673,13 @@ var require_visit = __commonJS({
|
|
|
3673
3673
|
}
|
|
3674
3674
|
}
|
|
3675
3675
|
} else if (identity2.isPair(node)) {
|
|
3676
|
-
|
|
3677
|
-
const ck = visit_("key", node.key, visitor,
|
|
3676
|
+
path34 = Object.freeze(path34.concat(node));
|
|
3677
|
+
const ck = visit_("key", node.key, visitor, path34);
|
|
3678
3678
|
if (ck === BREAK)
|
|
3679
3679
|
return BREAK;
|
|
3680
3680
|
else if (ck === REMOVE)
|
|
3681
3681
|
node.key = null;
|
|
3682
|
-
const cv = visit_("value", node.value, visitor,
|
|
3682
|
+
const cv = visit_("value", node.value, visitor, path34);
|
|
3683
3683
|
if (cv === BREAK)
|
|
3684
3684
|
return BREAK;
|
|
3685
3685
|
else if (cv === REMOVE)
|
|
@@ -3700,17 +3700,17 @@ var require_visit = __commonJS({
|
|
|
3700
3700
|
visitAsync.BREAK = BREAK;
|
|
3701
3701
|
visitAsync.SKIP = SKIP;
|
|
3702
3702
|
visitAsync.REMOVE = REMOVE;
|
|
3703
|
-
async function visitAsync_(key, node, visitor,
|
|
3704
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3703
|
+
async function visitAsync_(key, node, visitor, path34) {
|
|
3704
|
+
const ctrl = await callVisitor(key, node, visitor, path34);
|
|
3705
3705
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3706
|
-
replaceNode(key,
|
|
3707
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3706
|
+
replaceNode(key, path34, ctrl);
|
|
3707
|
+
return visitAsync_(key, ctrl, visitor, path34);
|
|
3708
3708
|
}
|
|
3709
3709
|
if (typeof ctrl !== "symbol") {
|
|
3710
3710
|
if (identity2.isCollection(node)) {
|
|
3711
|
-
|
|
3711
|
+
path34 = Object.freeze(path34.concat(node));
|
|
3712
3712
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
3713
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
3713
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path34);
|
|
3714
3714
|
if (typeof ci === "number")
|
|
3715
3715
|
i2 = ci - 1;
|
|
3716
3716
|
else if (ci === BREAK)
|
|
@@ -3721,13 +3721,13 @@ var require_visit = __commonJS({
|
|
|
3721
3721
|
}
|
|
3722
3722
|
}
|
|
3723
3723
|
} else if (identity2.isPair(node)) {
|
|
3724
|
-
|
|
3725
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3724
|
+
path34 = Object.freeze(path34.concat(node));
|
|
3725
|
+
const ck = await visitAsync_("key", node.key, visitor, path34);
|
|
3726
3726
|
if (ck === BREAK)
|
|
3727
3727
|
return BREAK;
|
|
3728
3728
|
else if (ck === REMOVE)
|
|
3729
3729
|
node.key = null;
|
|
3730
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3730
|
+
const cv = await visitAsync_("value", node.value, visitor, path34);
|
|
3731
3731
|
if (cv === BREAK)
|
|
3732
3732
|
return BREAK;
|
|
3733
3733
|
else if (cv === REMOVE)
|
|
@@ -3754,23 +3754,23 @@ var require_visit = __commonJS({
|
|
|
3754
3754
|
}
|
|
3755
3755
|
return visitor;
|
|
3756
3756
|
}
|
|
3757
|
-
function callVisitor(key, node, visitor,
|
|
3757
|
+
function callVisitor(key, node, visitor, path34) {
|
|
3758
3758
|
if (typeof visitor === "function")
|
|
3759
|
-
return visitor(key, node,
|
|
3759
|
+
return visitor(key, node, path34);
|
|
3760
3760
|
if (identity2.isMap(node))
|
|
3761
|
-
return visitor.Map?.(key, node,
|
|
3761
|
+
return visitor.Map?.(key, node, path34);
|
|
3762
3762
|
if (identity2.isSeq(node))
|
|
3763
|
-
return visitor.Seq?.(key, node,
|
|
3763
|
+
return visitor.Seq?.(key, node, path34);
|
|
3764
3764
|
if (identity2.isPair(node))
|
|
3765
|
-
return visitor.Pair?.(key, node,
|
|
3765
|
+
return visitor.Pair?.(key, node, path34);
|
|
3766
3766
|
if (identity2.isScalar(node))
|
|
3767
|
-
return visitor.Scalar?.(key, node,
|
|
3767
|
+
return visitor.Scalar?.(key, node, path34);
|
|
3768
3768
|
if (identity2.isAlias(node))
|
|
3769
|
-
return visitor.Alias?.(key, node,
|
|
3769
|
+
return visitor.Alias?.(key, node, path34);
|
|
3770
3770
|
return void 0;
|
|
3771
3771
|
}
|
|
3772
|
-
function replaceNode(key,
|
|
3773
|
-
const parent =
|
|
3772
|
+
function replaceNode(key, path34, node) {
|
|
3773
|
+
const parent = path34[path34.length - 1];
|
|
3774
3774
|
if (identity2.isCollection(parent)) {
|
|
3775
3775
|
parent.items[key] = node;
|
|
3776
3776
|
} else if (identity2.isPair(parent)) {
|
|
@@ -4382,10 +4382,10 @@ var require_Collection = __commonJS({
|
|
|
4382
4382
|
var createNode = require_createNode();
|
|
4383
4383
|
var identity2 = require_identity();
|
|
4384
4384
|
var Node = require_Node();
|
|
4385
|
-
function collectionFromPath(schema,
|
|
4385
|
+
function collectionFromPath(schema, path34, value) {
|
|
4386
4386
|
let v = value;
|
|
4387
|
-
for (let i2 =
|
|
4388
|
-
const k =
|
|
4387
|
+
for (let i2 = path34.length - 1; i2 >= 0; --i2) {
|
|
4388
|
+
const k = path34[i2];
|
|
4389
4389
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
4390
4390
|
const a2 = [];
|
|
4391
4391
|
a2[k] = v;
|
|
@@ -4404,7 +4404,7 @@ var require_Collection = __commonJS({
|
|
|
4404
4404
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
4405
4405
|
});
|
|
4406
4406
|
}
|
|
4407
|
-
var isEmptyPath = (
|
|
4407
|
+
var isEmptyPath = (path34) => path34 == null || typeof path34 === "object" && !!path34[Symbol.iterator]().next().done;
|
|
4408
4408
|
var Collection = class extends Node.NodeBase {
|
|
4409
4409
|
constructor(type, schema) {
|
|
4410
4410
|
super(type);
|
|
@@ -4434,11 +4434,11 @@ var require_Collection = __commonJS({
|
|
|
4434
4434
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
4435
4435
|
* that already exists in the map.
|
|
4436
4436
|
*/
|
|
4437
|
-
addIn(
|
|
4438
|
-
if (isEmptyPath(
|
|
4437
|
+
addIn(path34, value) {
|
|
4438
|
+
if (isEmptyPath(path34))
|
|
4439
4439
|
this.add(value);
|
|
4440
4440
|
else {
|
|
4441
|
-
const [key, ...rest] =
|
|
4441
|
+
const [key, ...rest] = path34;
|
|
4442
4442
|
const node = this.get(key, true);
|
|
4443
4443
|
if (identity2.isCollection(node))
|
|
4444
4444
|
node.addIn(rest, value);
|
|
@@ -4452,8 +4452,8 @@ var require_Collection = __commonJS({
|
|
|
4452
4452
|
* Removes a value from the collection.
|
|
4453
4453
|
* @returns `true` if the item was found and removed.
|
|
4454
4454
|
*/
|
|
4455
|
-
deleteIn(
|
|
4456
|
-
const [key, ...rest] =
|
|
4455
|
+
deleteIn(path34) {
|
|
4456
|
+
const [key, ...rest] = path34;
|
|
4457
4457
|
if (rest.length === 0)
|
|
4458
4458
|
return this.delete(key);
|
|
4459
4459
|
const node = this.get(key, true);
|
|
@@ -4467,8 +4467,8 @@ var require_Collection = __commonJS({
|
|
|
4467
4467
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
4468
4468
|
* `true` (collections are always returned intact).
|
|
4469
4469
|
*/
|
|
4470
|
-
getIn(
|
|
4471
|
-
const [key, ...rest] =
|
|
4470
|
+
getIn(path34, keepScalar) {
|
|
4471
|
+
const [key, ...rest] = path34;
|
|
4472
4472
|
const node = this.get(key, true);
|
|
4473
4473
|
if (rest.length === 0)
|
|
4474
4474
|
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
@@ -4486,8 +4486,8 @@ var require_Collection = __commonJS({
|
|
|
4486
4486
|
/**
|
|
4487
4487
|
* Checks if the collection includes a value with the key `key`.
|
|
4488
4488
|
*/
|
|
4489
|
-
hasIn(
|
|
4490
|
-
const [key, ...rest] =
|
|
4489
|
+
hasIn(path34) {
|
|
4490
|
+
const [key, ...rest] = path34;
|
|
4491
4491
|
if (rest.length === 0)
|
|
4492
4492
|
return this.has(key);
|
|
4493
4493
|
const node = this.get(key, true);
|
|
@@ -4497,8 +4497,8 @@ var require_Collection = __commonJS({
|
|
|
4497
4497
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
4498
4498
|
* boolean to add/remove the item from the set.
|
|
4499
4499
|
*/
|
|
4500
|
-
setIn(
|
|
4501
|
-
const [key, ...rest] =
|
|
4500
|
+
setIn(path34, value) {
|
|
4501
|
+
const [key, ...rest] = path34;
|
|
4502
4502
|
if (rest.length === 0) {
|
|
4503
4503
|
this.set(key, value);
|
|
4504
4504
|
} else {
|
|
@@ -7013,9 +7013,9 @@ var require_Document = __commonJS({
|
|
|
7013
7013
|
this.contents.add(value);
|
|
7014
7014
|
}
|
|
7015
7015
|
/** Adds a value to the document. */
|
|
7016
|
-
addIn(
|
|
7016
|
+
addIn(path34, value) {
|
|
7017
7017
|
if (assertCollection(this.contents))
|
|
7018
|
-
this.contents.addIn(
|
|
7018
|
+
this.contents.addIn(path34, value);
|
|
7019
7019
|
}
|
|
7020
7020
|
/**
|
|
7021
7021
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -7090,14 +7090,14 @@ var require_Document = __commonJS({
|
|
|
7090
7090
|
* Removes a value from the document.
|
|
7091
7091
|
* @returns `true` if the item was found and removed.
|
|
7092
7092
|
*/
|
|
7093
|
-
deleteIn(
|
|
7094
|
-
if (Collection.isEmptyPath(
|
|
7093
|
+
deleteIn(path34) {
|
|
7094
|
+
if (Collection.isEmptyPath(path34)) {
|
|
7095
7095
|
if (this.contents == null)
|
|
7096
7096
|
return false;
|
|
7097
7097
|
this.contents = null;
|
|
7098
7098
|
return true;
|
|
7099
7099
|
}
|
|
7100
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
7100
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path34) : false;
|
|
7101
7101
|
}
|
|
7102
7102
|
/**
|
|
7103
7103
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -7112,10 +7112,10 @@ var require_Document = __commonJS({
|
|
|
7112
7112
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7113
7113
|
* `true` (collections are always returned intact).
|
|
7114
7114
|
*/
|
|
7115
|
-
getIn(
|
|
7116
|
-
if (Collection.isEmptyPath(
|
|
7115
|
+
getIn(path34, keepScalar) {
|
|
7116
|
+
if (Collection.isEmptyPath(path34))
|
|
7117
7117
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
7118
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
7118
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path34, keepScalar) : void 0;
|
|
7119
7119
|
}
|
|
7120
7120
|
/**
|
|
7121
7121
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -7126,10 +7126,10 @@ var require_Document = __commonJS({
|
|
|
7126
7126
|
/**
|
|
7127
7127
|
* Checks if the document includes a value at `path`.
|
|
7128
7128
|
*/
|
|
7129
|
-
hasIn(
|
|
7130
|
-
if (Collection.isEmptyPath(
|
|
7129
|
+
hasIn(path34) {
|
|
7130
|
+
if (Collection.isEmptyPath(path34))
|
|
7131
7131
|
return this.contents !== void 0;
|
|
7132
|
-
return identity2.isCollection(this.contents) ? this.contents.hasIn(
|
|
7132
|
+
return identity2.isCollection(this.contents) ? this.contents.hasIn(path34) : false;
|
|
7133
7133
|
}
|
|
7134
7134
|
/**
|
|
7135
7135
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -7146,13 +7146,13 @@ var require_Document = __commonJS({
|
|
|
7146
7146
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
7147
7147
|
* boolean to add/remove the item from the set.
|
|
7148
7148
|
*/
|
|
7149
|
-
setIn(
|
|
7150
|
-
if (Collection.isEmptyPath(
|
|
7149
|
+
setIn(path34, value) {
|
|
7150
|
+
if (Collection.isEmptyPath(path34)) {
|
|
7151
7151
|
this.contents = value;
|
|
7152
7152
|
} else if (this.contents == null) {
|
|
7153
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
7153
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path34), value);
|
|
7154
7154
|
} else if (assertCollection(this.contents)) {
|
|
7155
|
-
this.contents.setIn(
|
|
7155
|
+
this.contents.setIn(path34, value);
|
|
7156
7156
|
}
|
|
7157
7157
|
}
|
|
7158
7158
|
/**
|
|
@@ -9113,9 +9113,9 @@ var require_cst_visit = __commonJS({
|
|
|
9113
9113
|
visit2.BREAK = BREAK;
|
|
9114
9114
|
visit2.SKIP = SKIP;
|
|
9115
9115
|
visit2.REMOVE = REMOVE;
|
|
9116
|
-
visit2.itemAtPath = (cst,
|
|
9116
|
+
visit2.itemAtPath = (cst, path34) => {
|
|
9117
9117
|
let item = cst;
|
|
9118
|
-
for (const [field, index] of
|
|
9118
|
+
for (const [field, index] of path34) {
|
|
9119
9119
|
const tok = item?.[field];
|
|
9120
9120
|
if (tok && "items" in tok) {
|
|
9121
9121
|
item = tok.items[index];
|
|
@@ -9124,23 +9124,23 @@ var require_cst_visit = __commonJS({
|
|
|
9124
9124
|
}
|
|
9125
9125
|
return item;
|
|
9126
9126
|
};
|
|
9127
|
-
visit2.parentCollection = (cst,
|
|
9128
|
-
const parent = visit2.itemAtPath(cst,
|
|
9129
|
-
const field =
|
|
9127
|
+
visit2.parentCollection = (cst, path34) => {
|
|
9128
|
+
const parent = visit2.itemAtPath(cst, path34.slice(0, -1));
|
|
9129
|
+
const field = path34[path34.length - 1][0];
|
|
9130
9130
|
const coll = parent?.[field];
|
|
9131
9131
|
if (coll && "items" in coll)
|
|
9132
9132
|
return coll;
|
|
9133
9133
|
throw new Error("Parent collection not found");
|
|
9134
9134
|
};
|
|
9135
|
-
function _visit(
|
|
9136
|
-
let ctrl = visitor(item,
|
|
9135
|
+
function _visit(path34, item, visitor) {
|
|
9136
|
+
let ctrl = visitor(item, path34);
|
|
9137
9137
|
if (typeof ctrl === "symbol")
|
|
9138
9138
|
return ctrl;
|
|
9139
9139
|
for (const field of ["key", "value"]) {
|
|
9140
9140
|
const token = item[field];
|
|
9141
9141
|
if (token && "items" in token) {
|
|
9142
9142
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
9143
|
-
const ci = _visit(Object.freeze(
|
|
9143
|
+
const ci = _visit(Object.freeze(path34.concat([[field, i2]])), token.items[i2], visitor);
|
|
9144
9144
|
if (typeof ci === "number")
|
|
9145
9145
|
i2 = ci - 1;
|
|
9146
9146
|
else if (ci === BREAK)
|
|
@@ -9151,10 +9151,10 @@ var require_cst_visit = __commonJS({
|
|
|
9151
9151
|
}
|
|
9152
9152
|
}
|
|
9153
9153
|
if (typeof ctrl === "function" && field === "key")
|
|
9154
|
-
ctrl = ctrl(item,
|
|
9154
|
+
ctrl = ctrl(item, path34);
|
|
9155
9155
|
}
|
|
9156
9156
|
}
|
|
9157
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
9157
|
+
return typeof ctrl === "function" ? ctrl(item, path34) : 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
|
|
10459
|
+
const fs27 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs27, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs27);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs27, 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
|
|
10594
|
+
const fs27 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs27, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs27);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs27, sep: [] });
|
|
10601
10601
|
return;
|
|
10602
10602
|
}
|
|
10603
10603
|
case "flow-map-end":
|
|
@@ -11008,13 +11008,13 @@ var require_min_release_age = __commonJS({
|
|
|
11008
11008
|
return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
|
|
11009
11009
|
}
|
|
11010
11010
|
function probe(p, cwd) {
|
|
11011
|
-
return new Promise((
|
|
11011
|
+
return new Promise((resolve22) => {
|
|
11012
11012
|
(0, node_child_process_1.exec)(p.command, { cwd, timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
|
|
11013
11013
|
if (err) {
|
|
11014
|
-
|
|
11014
|
+
resolve22(0);
|
|
11015
11015
|
return;
|
|
11016
11016
|
}
|
|
11017
|
-
|
|
11017
|
+
resolve22(p.parse(stdout2));
|
|
11018
11018
|
});
|
|
11019
11019
|
});
|
|
11020
11020
|
}
|
|
@@ -11047,12 +11047,12 @@ var require_registry = __commonJS({
|
|
|
11047
11047
|
var node_https_1 = __importDefault(__require("node:https"));
|
|
11048
11048
|
var REQUEST_TIMEOUT_MS = 1e4;
|
|
11049
11049
|
function fetchRegistryInfo2(url) {
|
|
11050
|
-
return new Promise((
|
|
11050
|
+
return new Promise((resolve22) => {
|
|
11051
11051
|
let resolved = false;
|
|
11052
11052
|
const safeResolve = (value) => {
|
|
11053
11053
|
if (!resolved) {
|
|
11054
11054
|
resolved = true;
|
|
11055
|
-
|
|
11055
|
+
resolve22(value);
|
|
11056
11056
|
}
|
|
11057
11057
|
};
|
|
11058
11058
|
const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
|
|
@@ -12992,8 +12992,8 @@ var Deferred = class {
|
|
|
12992
12992
|
_resolve;
|
|
12993
12993
|
_reject;
|
|
12994
12994
|
constructor() {
|
|
12995
|
-
this._promise = new Promise((
|
|
12996
|
-
this._resolve =
|
|
12995
|
+
this._promise = new Promise((resolve22, reject) => {
|
|
12996
|
+
this._resolve = resolve22;
|
|
12997
12997
|
this._reject = reject;
|
|
12998
12998
|
});
|
|
12999
12999
|
}
|
|
@@ -13886,8 +13886,8 @@ var ExportOperation = class {
|
|
|
13886
13886
|
_metrics;
|
|
13887
13887
|
_exportScheduledResolve;
|
|
13888
13888
|
constructor(exporter, logRecords, exportTimeoutMillis, metrics) {
|
|
13889
|
-
this._exportScheduledPromise = new Promise((
|
|
13890
|
-
this._exportScheduledResolve =
|
|
13889
|
+
this._exportScheduledPromise = new Promise((resolve22) => {
|
|
13890
|
+
this._exportScheduledResolve = resolve22;
|
|
13891
13891
|
});
|
|
13892
13892
|
this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
|
|
13893
13893
|
this._metrics = metrics;
|
|
@@ -13912,7 +13912,7 @@ var ExportOperation = class {
|
|
|
13912
13912
|
}
|
|
13913
13913
|
}
|
|
13914
13914
|
async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
|
|
13915
|
-
return new Promise((
|
|
13915
|
+
return new Promise((resolve22, reject) => {
|
|
13916
13916
|
const timer = setTimeout(() => {
|
|
13917
13917
|
reject(new Error("Timeout"));
|
|
13918
13918
|
}, exportTimeoutMillis);
|
|
@@ -13920,7 +13920,7 @@ var ExportOperation = class {
|
|
|
13920
13920
|
this._metrics.finishLogs(logRecords.length, result.error);
|
|
13921
13921
|
clearTimeout(timer);
|
|
13922
13922
|
if (result.code === ExportResultCode.SUCCESS) {
|
|
13923
|
-
|
|
13923
|
+
resolve22();
|
|
13924
13924
|
} else {
|
|
13925
13925
|
reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
|
|
13926
13926
|
}
|
|
@@ -14701,7 +14701,7 @@ function parseRetryAfterToMills(retryAfter) {
|
|
|
14701
14701
|
var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION4}`;
|
|
14702
14702
|
var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
|
|
14703
14703
|
function sendWithHttp(request, url, headers, compression, userAgent, agent, data, timeoutMillis) {
|
|
14704
|
-
return new Promise((
|
|
14704
|
+
return new Promise((resolve22) => {
|
|
14705
14705
|
const parsedUrl = new URL(url);
|
|
14706
14706
|
if (userAgent) {
|
|
14707
14707
|
headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
|
|
@@ -14720,7 +14720,7 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14720
14720
|
responseSize += chunk.length;
|
|
14721
14721
|
if (responseSize > MAX_RESPONSE_BODY_SIZE) {
|
|
14722
14722
|
const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
|
|
14723
|
-
|
|
14723
|
+
resolve22({ status: "failure", error: sizeError });
|
|
14724
14724
|
res.destroy();
|
|
14725
14725
|
return;
|
|
14726
14726
|
}
|
|
@@ -14728,18 +14728,18 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14728
14728
|
});
|
|
14729
14729
|
res.on("end", () => {
|
|
14730
14730
|
if (res.statusCode && res.statusCode <= 299) {
|
|
14731
|
-
|
|
14731
|
+
resolve22({
|
|
14732
14732
|
status: "success",
|
|
14733
14733
|
data: Buffer.concat(responseData)
|
|
14734
14734
|
});
|
|
14735
14735
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14736
|
-
|
|
14736
|
+
resolve22({
|
|
14737
14737
|
status: "retryable",
|
|
14738
14738
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
14739
14739
|
});
|
|
14740
14740
|
} else {
|
|
14741
14741
|
const error = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
|
|
14742
|
-
|
|
14742
|
+
resolve22({
|
|
14743
14743
|
status: "failure",
|
|
14744
14744
|
error
|
|
14745
14745
|
});
|
|
@@ -14747,17 +14747,17 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14747
14747
|
});
|
|
14748
14748
|
res.on("error", (error) => {
|
|
14749
14749
|
if (res.statusCode && res.statusCode <= 299) {
|
|
14750
|
-
|
|
14750
|
+
resolve22({
|
|
14751
14751
|
status: "success"
|
|
14752
14752
|
});
|
|
14753
14753
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14754
|
-
|
|
14754
|
+
resolve22({
|
|
14755
14755
|
status: "retryable",
|
|
14756
14756
|
error,
|
|
14757
14757
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
14758
14758
|
});
|
|
14759
14759
|
} else {
|
|
14760
|
-
|
|
14760
|
+
resolve22({
|
|
14761
14761
|
status: "failure",
|
|
14762
14762
|
error
|
|
14763
14763
|
});
|
|
@@ -14766,26 +14766,26 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14766
14766
|
});
|
|
14767
14767
|
req.setTimeout(timeoutMillis, () => {
|
|
14768
14768
|
req.destroy();
|
|
14769
|
-
|
|
14769
|
+
resolve22({
|
|
14770
14770
|
status: "retryable",
|
|
14771
14771
|
error: new Error("Request timed out")
|
|
14772
14772
|
});
|
|
14773
14773
|
});
|
|
14774
14774
|
req.on("error", (error) => {
|
|
14775
14775
|
if (isHttpTransportNetworkErrorRetryable(error)) {
|
|
14776
|
-
|
|
14776
|
+
resolve22({
|
|
14777
14777
|
status: "retryable",
|
|
14778
14778
|
error
|
|
14779
14779
|
});
|
|
14780
14780
|
} else {
|
|
14781
|
-
|
|
14781
|
+
resolve22({
|
|
14782
14782
|
status: "failure",
|
|
14783
14783
|
error
|
|
14784
14784
|
});
|
|
14785
14785
|
}
|
|
14786
14786
|
});
|
|
14787
14787
|
compressAndSend(req, compression, data, (error) => {
|
|
14788
|
-
|
|
14788
|
+
resolve22({
|
|
14789
14789
|
status: "failure",
|
|
14790
14790
|
error
|
|
14791
14791
|
});
|
|
@@ -14875,9 +14875,9 @@ var RetryingTransport = class {
|
|
|
14875
14875
|
this._transport = transport;
|
|
14876
14876
|
}
|
|
14877
14877
|
retry(data, timeoutMillis, inMillis) {
|
|
14878
|
-
return new Promise((
|
|
14878
|
+
return new Promise((resolve22, reject) => {
|
|
14879
14879
|
setTimeout(() => {
|
|
14880
|
-
this._transport.send(data, timeoutMillis).then(
|
|
14880
|
+
this._transport.send(data, timeoutMillis).then(resolve22, reject);
|
|
14881
14881
|
}, inMillis);
|
|
14882
14882
|
});
|
|
14883
14883
|
}
|
|
@@ -15012,7 +15012,7 @@ function appendRootPathToUrlIfNeeded(url) {
|
|
|
15012
15012
|
return void 0;
|
|
15013
15013
|
}
|
|
15014
15014
|
}
|
|
15015
|
-
function appendResourcePathToUrl(url,
|
|
15015
|
+
function appendResourcePathToUrl(url, path34) {
|
|
15016
15016
|
try {
|
|
15017
15017
|
new URL(url);
|
|
15018
15018
|
} catch {
|
|
@@ -15022,11 +15022,11 @@ function appendResourcePathToUrl(url, path33) {
|
|
|
15022
15022
|
if (!url.endsWith("/")) {
|
|
15023
15023
|
url = url + "/";
|
|
15024
15024
|
}
|
|
15025
|
-
url +=
|
|
15025
|
+
url += path34;
|
|
15026
15026
|
try {
|
|
15027
15027
|
new URL(url);
|
|
15028
15028
|
} catch {
|
|
15029
|
-
diag2.warn(`Configuration: Provided URL appended with '${
|
|
15029
|
+
diag2.warn(`Configuration: Provided URL appended with '${path34}' is not a valid URL, using 'undefined' instead of '${url}'`);
|
|
15030
15030
|
return void 0;
|
|
15031
15031
|
}
|
|
15032
15032
|
return url;
|
|
@@ -15137,44 +15137,53 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
15137
15137
|
init_esm();
|
|
15138
15138
|
|
|
15139
15139
|
// ../telemetry/src/debug.ts
|
|
15140
|
-
import * as
|
|
15140
|
+
import * as fs7 from "node:fs";
|
|
15141
15141
|
|
|
15142
15142
|
// ../telemetry/src/paths.ts
|
|
15143
|
-
import * as
|
|
15143
|
+
import * as path8 from "node:path";
|
|
15144
15144
|
|
|
15145
15145
|
// ../configuration-core/src/flags.ts
|
|
15146
15146
|
import * as fs2 from "node:fs";
|
|
15147
|
+
import * as path3 from "node:path";
|
|
15148
|
+
|
|
15149
|
+
// ../configuration-core/src/home.ts
|
|
15150
|
+
import * as os from "node:os";
|
|
15147
15151
|
import * as path2 from "node:path";
|
|
15148
|
-
|
|
15152
|
+
var ARGENT_HOME_DIR_ENV = "ARGENT_HOME_DIR";
|
|
15153
|
+
function nonEmpty(value) {
|
|
15154
|
+
if (value == void 0) return null;
|
|
15155
|
+
const trimmed = value.trim();
|
|
15156
|
+
return trimmed === "" ? null : value;
|
|
15157
|
+
}
|
|
15158
|
+
function resolveHomeDir(options = {}) {
|
|
15159
|
+
if (options.homeDir) return options.homeDir;
|
|
15160
|
+
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
15161
|
+
}
|
|
15162
|
+
function argentHomeDir(options = {}) {
|
|
15163
|
+
const override = options.homeDir ? null : nonEmpty(process.env[ARGENT_HOME_DIR_ENV]);
|
|
15164
|
+
return override ? path2.resolve(override.trim()) : path2.join(resolveHomeDir(options), ".argent");
|
|
15165
|
+
}
|
|
15166
|
+
|
|
15167
|
+
// ../configuration-core/src/flags.ts
|
|
15149
15168
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
15150
15169
|
function findProjectRoot(startDir) {
|
|
15151
|
-
let current =
|
|
15170
|
+
let current = path3.resolve(startDir);
|
|
15152
15171
|
while (true) {
|
|
15153
15172
|
for (const marker of PROJECT_MARKERS) {
|
|
15154
|
-
if (fs2.existsSync(
|
|
15173
|
+
if (fs2.existsSync(path3.join(current, marker))) return current;
|
|
15155
15174
|
}
|
|
15156
|
-
const parent =
|
|
15175
|
+
const parent = path3.dirname(current);
|
|
15157
15176
|
if (parent === current) return null;
|
|
15158
15177
|
current = parent;
|
|
15159
15178
|
}
|
|
15160
15179
|
}
|
|
15161
15180
|
function resolveProjectRoot(startDir) {
|
|
15162
|
-
return findProjectRoot(startDir) ??
|
|
15181
|
+
return findProjectRoot(startDir) ?? path3.resolve(startDir);
|
|
15163
15182
|
}
|
|
15164
15183
|
|
|
15165
15184
|
// ../configuration-core/src/paths.ts
|
|
15166
15185
|
import * as fs3 from "node:fs";
|
|
15167
|
-
import * as
|
|
15168
|
-
import * as path3 from "node:path";
|
|
15169
|
-
function nonEmpty(value) {
|
|
15170
|
-
if (value == void 0) return null;
|
|
15171
|
-
const trimmed = value.trim();
|
|
15172
|
-
return trimmed === "" ? null : value;
|
|
15173
|
-
}
|
|
15174
|
-
function resolveHomeDir(options = {}) {
|
|
15175
|
-
if (options.homeDir) return options.homeDir;
|
|
15176
|
-
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
15177
|
-
}
|
|
15186
|
+
import * as path4 from "node:path";
|
|
15178
15187
|
function isHomeDir(dir, options = {}) {
|
|
15179
15188
|
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
15180
15189
|
}
|
|
@@ -15182,27 +15191,22 @@ function canonicalPath(p) {
|
|
|
15182
15191
|
try {
|
|
15183
15192
|
return fs3.realpathSync.native(p);
|
|
15184
15193
|
} catch {
|
|
15185
|
-
return
|
|
15194
|
+
return path4.resolve(p);
|
|
15186
15195
|
}
|
|
15187
15196
|
}
|
|
15188
|
-
function argentHomeDir() {
|
|
15189
|
-
return path3.join(resolveHomeDir(), ".argent");
|
|
15190
|
-
}
|
|
15191
15197
|
function configDir(scope = "global", options = {}) {
|
|
15192
|
-
if (scope === "global")
|
|
15193
|
-
return path3.join(resolveHomeDir(options), ".argent");
|
|
15194
|
-
}
|
|
15198
|
+
if (scope === "global") return argentHomeDir(options);
|
|
15195
15199
|
const cwd = options.cwd ?? process.cwd();
|
|
15196
|
-
return
|
|
15200
|
+
return path4.join(resolveProjectRoot(cwd), ".argent");
|
|
15197
15201
|
}
|
|
15198
15202
|
function configFilePath(scope = "global", options = {}) {
|
|
15199
|
-
return
|
|
15203
|
+
return path4.join(configDir(scope, options), "config.json");
|
|
15200
15204
|
}
|
|
15201
15205
|
|
|
15202
15206
|
// ../configuration-core/src/config.ts
|
|
15203
15207
|
import * as crypto from "node:crypto";
|
|
15204
15208
|
import * as fs4 from "node:fs";
|
|
15205
|
-
import * as
|
|
15209
|
+
import * as path5 from "node:path";
|
|
15206
15210
|
function readConfigObject(scope = "global", options = {}) {
|
|
15207
15211
|
try {
|
|
15208
15212
|
const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
@@ -15302,7 +15306,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
15302
15306
|
try {
|
|
15303
15307
|
const next = readConfigObject(scope, options);
|
|
15304
15308
|
mutate(next);
|
|
15305
|
-
const tmpPath =
|
|
15309
|
+
const tmpPath = path5.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
15306
15310
|
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
15307
15311
|
try {
|
|
15308
15312
|
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
@@ -15331,13 +15335,76 @@ function getWhatsNewSeenVersion(options = {}) {
|
|
|
15331
15335
|
return typeof value === "string" ? value : null;
|
|
15332
15336
|
}
|
|
15333
15337
|
function setWhatsNewSeenVersion(version, options = {}) {
|
|
15334
|
-
|
|
15338
|
+
let recorded = false;
|
|
15339
|
+
updateConfig(
|
|
15340
|
+
(config) => {
|
|
15341
|
+
const value = getAtPath(config, WHATS_NEW_SEEN_KEY);
|
|
15342
|
+
const seen = typeof value === "string" ? value : null;
|
|
15343
|
+
if (options.ifSeen !== void 0 && options.ifSeen !== seen) return;
|
|
15344
|
+
setAtPath(config, WHATS_NEW_SEEN_KEY, version);
|
|
15345
|
+
recorded = true;
|
|
15346
|
+
},
|
|
15347
|
+
"global",
|
|
15348
|
+
options
|
|
15349
|
+
);
|
|
15350
|
+
return recorded;
|
|
15335
15351
|
}
|
|
15336
15352
|
|
|
15337
15353
|
// ../configuration-core/src/secrets.ts
|
|
15338
15354
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
15339
15355
|
import * as fs5 from "node:fs";
|
|
15340
|
-
import * as
|
|
15356
|
+
import * as path6 from "node:path";
|
|
15357
|
+
|
|
15358
|
+
// ../configuration-core/src/merge.ts
|
|
15359
|
+
function mergeRestrictive(local, global2) {
|
|
15360
|
+
if (local === void 0) return global2;
|
|
15361
|
+
if (global2 === void 0) return local;
|
|
15362
|
+
if (typeof local === "boolean" && typeof global2 === "boolean") {
|
|
15363
|
+
return local && global2;
|
|
15364
|
+
}
|
|
15365
|
+
if (typeof local === "number" && typeof global2 === "number") {
|
|
15366
|
+
return Math.min(local, global2);
|
|
15367
|
+
}
|
|
15368
|
+
return local;
|
|
15369
|
+
}
|
|
15370
|
+
function toArray(value) {
|
|
15371
|
+
return Array.isArray(value) ? value : null;
|
|
15372
|
+
}
|
|
15373
|
+
function mergeUnion(local, global2) {
|
|
15374
|
+
const l2 = toArray(local);
|
|
15375
|
+
const g = toArray(global2);
|
|
15376
|
+
if (l2 === null && g === null) return local ?? global2;
|
|
15377
|
+
const merged = [...g ?? [], ...l2 ?? []];
|
|
15378
|
+
return Array.from(new Set(merged));
|
|
15379
|
+
}
|
|
15380
|
+
function mergeIntersection(local, global2) {
|
|
15381
|
+
const l2 = toArray(local);
|
|
15382
|
+
const g = toArray(global2);
|
|
15383
|
+
if (l2 === null && g === null) return local ?? global2;
|
|
15384
|
+
if (l2 === null) return global2;
|
|
15385
|
+
if (g === null) return local;
|
|
15386
|
+
const globalSet = new Set(g);
|
|
15387
|
+
return l2.filter((item) => globalSet.has(item));
|
|
15388
|
+
}
|
|
15389
|
+
function applyMergePolicy(policy, local, global2) {
|
|
15390
|
+
if (typeof policy === "function") return policy({ local, global: global2 });
|
|
15391
|
+
switch (policy) {
|
|
15392
|
+
case "prioritize-local":
|
|
15393
|
+
return local ?? global2;
|
|
15394
|
+
case "prioritize-global":
|
|
15395
|
+
return global2 ?? local;
|
|
15396
|
+
case "prioritize-restrictive":
|
|
15397
|
+
return mergeRestrictive(local, global2);
|
|
15398
|
+
case "union":
|
|
15399
|
+
return mergeUnion(local, global2);
|
|
15400
|
+
case "intersection":
|
|
15401
|
+
return mergeIntersection(local, global2);
|
|
15402
|
+
default: {
|
|
15403
|
+
const _exhaustive = policy;
|
|
15404
|
+
return _exhaustive;
|
|
15405
|
+
}
|
|
15406
|
+
}
|
|
15407
|
+
}
|
|
15341
15408
|
|
|
15342
15409
|
// ../configuration-core/src/config-schema.ts
|
|
15343
15410
|
import { isAbsolute } from "node:path";
|
|
@@ -15376,6 +15443,15 @@ var CONFIG_SCHEMA = [
|
|
|
15376
15443
|
// drained/reset, not just the file rewritten.
|
|
15377
15444
|
manageCommand: "argent telemetry"
|
|
15378
15445
|
},
|
|
15446
|
+
{
|
|
15447
|
+
key: "autoUpdate.enabled",
|
|
15448
|
+
description: "Automatically update the global Argent installation. Project-local installs require confirmation.",
|
|
15449
|
+
scopes: ["global"],
|
|
15450
|
+
parse: asBoolean,
|
|
15451
|
+
merge: "prioritize-local",
|
|
15452
|
+
default: true,
|
|
15453
|
+
example: "false"
|
|
15454
|
+
},
|
|
15379
15455
|
{
|
|
15380
15456
|
key: "lens.agent",
|
|
15381
15457
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
@@ -15459,16 +15535,60 @@ var CONFIG_SCHEMA = [
|
|
|
15459
15535
|
example: "512"
|
|
15460
15536
|
}
|
|
15461
15537
|
];
|
|
15538
|
+
function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
15539
|
+
return registry.find((def) => def.key === key);
|
|
15540
|
+
}
|
|
15462
15541
|
|
|
15463
15542
|
// ../configuration-core/src/config-access.ts
|
|
15464
|
-
import * as
|
|
15543
|
+
import * as fs6 from "node:fs";
|
|
15544
|
+
import * as path7 from "node:path";
|
|
15545
|
+
function readScopeValue(def, scope, options) {
|
|
15546
|
+
if (!def.scopes.includes(scope)) return void 0;
|
|
15547
|
+
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
15548
|
+
return raw === void 0 ? void 0 : def.parse(raw);
|
|
15549
|
+
}
|
|
15550
|
+
function getConfigValue(def, options = {}) {
|
|
15551
|
+
const local = readScopeValue(def, "project", options);
|
|
15552
|
+
const global2 = readScopeValue(def, "global", options);
|
|
15553
|
+
const merged = applyMergePolicy(def.merge, local, global2);
|
|
15554
|
+
return merged ?? def.default;
|
|
15555
|
+
}
|
|
15556
|
+
function getConfigValueAtScope(key, scope, options = {}, registry = CONFIG_SCHEMA) {
|
|
15557
|
+
const def = requireDefinition(key, registry);
|
|
15558
|
+
return readScopeValue(def, scope, options);
|
|
15559
|
+
}
|
|
15560
|
+
function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
|
|
15561
|
+
const def = requireDefinition(key, registry);
|
|
15562
|
+
return getConfigValue(def, options);
|
|
15563
|
+
}
|
|
15564
|
+
function requireDefinition(key, registry = CONFIG_SCHEMA) {
|
|
15565
|
+
const def = getConfigDefinition(key, registry);
|
|
15566
|
+
if (!def) {
|
|
15567
|
+
throw new UnknownConfigKeyError(key);
|
|
15568
|
+
}
|
|
15569
|
+
return def;
|
|
15570
|
+
}
|
|
15571
|
+
var UnknownConfigKeyError = class extends Error {
|
|
15572
|
+
constructor(key) {
|
|
15573
|
+
super(`Unknown configuration key "${key}".`);
|
|
15574
|
+
this.key = key;
|
|
15575
|
+
this.name = "UnknownConfigKeyError";
|
|
15576
|
+
}
|
|
15577
|
+
key;
|
|
15578
|
+
};
|
|
15579
|
+
var AUTO_UPDATE_ENABLED_KEY = "autoUpdate.enabled";
|
|
15580
|
+
function isAutoUpdateEnabled() {
|
|
15581
|
+
if (getConfigValueByKey(AUTO_UPDATE_ENABLED_KEY) !== true) return false;
|
|
15582
|
+
const userHome = { homeDir: resolveHomeDir() };
|
|
15583
|
+
return getConfigValueAtScope(AUTO_UPDATE_ENABLED_KEY, "global", userHome) !== false;
|
|
15584
|
+
}
|
|
15465
15585
|
|
|
15466
15586
|
// ../telemetry/src/paths.ts
|
|
15467
15587
|
function identityFilePath() {
|
|
15468
|
-
return
|
|
15588
|
+
return path8.join(argentHomeDir(), "telemetry-id");
|
|
15469
15589
|
}
|
|
15470
15590
|
function debugLogPath() {
|
|
15471
|
-
return
|
|
15591
|
+
return path8.join(argentHomeDir(), "telemetry-debug.log");
|
|
15472
15592
|
}
|
|
15473
15593
|
|
|
15474
15594
|
// ../telemetry/src/debug.ts
|
|
@@ -15498,8 +15618,8 @@ function emitDebugPayload(payload) {
|
|
|
15498
15618
|
} catch {
|
|
15499
15619
|
}
|
|
15500
15620
|
try {
|
|
15501
|
-
|
|
15502
|
-
|
|
15621
|
+
fs7.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15622
|
+
fs7.appendFileSync(debugLogPath(), line + "\n");
|
|
15503
15623
|
} catch {
|
|
15504
15624
|
}
|
|
15505
15625
|
}
|
|
@@ -15687,16 +15807,16 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
15687
15807
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15688
15808
|
|
|
15689
15809
|
// ../registry/src/flow-file-refs.ts
|
|
15690
|
-
import * as
|
|
15691
|
-
import * as
|
|
15810
|
+
import * as fs9 from "node:fs/promises";
|
|
15811
|
+
import * as path10 from "node:path";
|
|
15692
15812
|
|
|
15693
15813
|
// ../registry/src/e2e-dirs.ts
|
|
15694
|
-
import * as
|
|
15695
|
-
import * as
|
|
15696
|
-
var E2E_DIR =
|
|
15697
|
-
var LEGACY_E2E_DIRS = Object.freeze([
|
|
15814
|
+
import * as fs8 from "node:fs/promises";
|
|
15815
|
+
import * as path9 from "node:path";
|
|
15816
|
+
var E2E_DIR = path9.join(".argent", "e2e");
|
|
15817
|
+
var LEGACY_E2E_DIRS = Object.freeze([path9.join(".argent", "flows")]);
|
|
15698
15818
|
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
15699
|
-
var E2E_DIR_NAMES = E2E_DIRS.map((dir) =>
|
|
15819
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path9.basename(dir));
|
|
15700
15820
|
|
|
15701
15821
|
// ../registry/src/tool-ids.ts
|
|
15702
15822
|
var TOOL_ID_ALIASES = Object.freeze({
|
|
@@ -16545,7 +16665,7 @@ function sanitize(event, raw) {
|
|
|
16545
16665
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
16546
16666
|
|
|
16547
16667
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
16548
|
-
import { existsSync as
|
|
16668
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
16549
16669
|
var CLAUDE_CLOUD_ENV_KINDS = /* @__PURE__ */ new Set(["byoc", "anthropic_cloud"]);
|
|
16550
16670
|
var CLAUDE_REMOTE_ENTRYPOINTS = /* @__PURE__ */ new Set([
|
|
16551
16671
|
"remote",
|
|
@@ -16576,9 +16696,9 @@ function isReplitAgent(env) {
|
|
|
16576
16696
|
}
|
|
16577
16697
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16578
16698
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16579
|
-
function safeExists(fileExists,
|
|
16699
|
+
function safeExists(fileExists, path34) {
|
|
16580
16700
|
try {
|
|
16581
|
-
return fileExists(
|
|
16701
|
+
return fileExists(path34);
|
|
16582
16702
|
} catch {
|
|
16583
16703
|
return false;
|
|
16584
16704
|
}
|
|
@@ -16588,7 +16708,7 @@ function detectCloudAgent(env = process.env, opts = {}) {
|
|
|
16588
16708
|
if (isCursorCloud(env)) return "cursor";
|
|
16589
16709
|
if (isCopilotAgent(env)) return "copilot";
|
|
16590
16710
|
if (isReplitAgent(env)) return "replit";
|
|
16591
|
-
const fileExists = opts.fileExists ??
|
|
16711
|
+
const fileExists = opts.fileExists ?? existsSync4;
|
|
16592
16712
|
if (safeExists(fileExists, DEVIN_MARKER_PATH)) return "devin";
|
|
16593
16713
|
if (safeExists(fileExists, JULES_MARKER_PATH)) return "jules";
|
|
16594
16714
|
return null;
|
|
@@ -16998,7 +17118,7 @@ function isCi(env = process.env) {
|
|
|
16998
17118
|
var SESSION_ID = randomUUID4();
|
|
16999
17119
|
function readCliVersion() {
|
|
17000
17120
|
if (true) {
|
|
17001
|
-
return "0.35.1-next.
|
|
17121
|
+
return "0.35.1-next.41";
|
|
17002
17122
|
}
|
|
17003
17123
|
return "0.0.0";
|
|
17004
17124
|
}
|
|
@@ -17031,8 +17151,8 @@ function getBaseProps(runtime) {
|
|
|
17031
17151
|
|
|
17032
17152
|
// ../telemetry/src/identity.ts
|
|
17033
17153
|
import * as crypto2 from "node:crypto";
|
|
17034
|
-
import * as
|
|
17035
|
-
import * as
|
|
17154
|
+
import * as fs10 from "node:fs";
|
|
17155
|
+
import * as path11 from "node:path";
|
|
17036
17156
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17037
17157
|
var cached = null;
|
|
17038
17158
|
var fingerprintResolved = null;
|
|
@@ -17139,66 +17259,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17139
17259
|
function isCorruptIdFile(filePath) {
|
|
17140
17260
|
let isRegularFile;
|
|
17141
17261
|
try {
|
|
17142
|
-
isRegularFile =
|
|
17262
|
+
isRegularFile = fs10.lstatSync(filePath).isFile();
|
|
17143
17263
|
} catch {
|
|
17144
17264
|
return false;
|
|
17145
17265
|
}
|
|
17146
17266
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17147
17267
|
}
|
|
17148
17268
|
function writeIdFileAtomic(finalPath, id) {
|
|
17149
|
-
|
|
17269
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17150
17270
|
let occupant;
|
|
17151
17271
|
try {
|
|
17152
|
-
occupant =
|
|
17272
|
+
occupant = fs10.lstatSync(finalPath);
|
|
17153
17273
|
} catch (err) {
|
|
17154
17274
|
if (err.code !== "ENOENT") throw err;
|
|
17155
17275
|
}
|
|
17156
17276
|
if (occupant && !occupant.isFile()) {
|
|
17157
17277
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
17158
17278
|
}
|
|
17159
|
-
const tmpPath =
|
|
17279
|
+
const tmpPath = path11.join(
|
|
17160
17280
|
argentHomeDir(),
|
|
17161
17281
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17162
17282
|
);
|
|
17163
|
-
const fd =
|
|
17283
|
+
const fd = fs10.openSync(tmpPath, "wx", 384);
|
|
17164
17284
|
try {
|
|
17165
17285
|
try {
|
|
17166
|
-
|
|
17167
|
-
|
|
17286
|
+
fs10.writeSync(fd, id);
|
|
17287
|
+
fs10.fsyncSync(fd);
|
|
17168
17288
|
} finally {
|
|
17169
|
-
|
|
17289
|
+
fs10.closeSync(fd);
|
|
17170
17290
|
}
|
|
17171
|
-
|
|
17291
|
+
fs10.renameSync(tmpPath, finalPath);
|
|
17172
17292
|
} finally {
|
|
17173
17293
|
try {
|
|
17174
|
-
|
|
17294
|
+
fs10.unlinkSync(tmpPath);
|
|
17175
17295
|
} catch {
|
|
17176
17296
|
}
|
|
17177
17297
|
}
|
|
17178
17298
|
}
|
|
17179
17299
|
function mintRandomId(finalPath) {
|
|
17180
|
-
|
|
17300
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17181
17301
|
let value = crypto2.randomUUID();
|
|
17182
17302
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17183
|
-
const tmpPath =
|
|
17303
|
+
const tmpPath = path11.join(
|
|
17184
17304
|
argentHomeDir(),
|
|
17185
17305
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17186
17306
|
);
|
|
17187
17307
|
let fd;
|
|
17188
17308
|
try {
|
|
17189
|
-
fd =
|
|
17309
|
+
fd = fs10.openSync(tmpPath, "wx", 384);
|
|
17190
17310
|
} catch (err) {
|
|
17191
17311
|
if (err.code === "EEXIST") continue;
|
|
17192
17312
|
throw err;
|
|
17193
17313
|
}
|
|
17194
17314
|
try {
|
|
17195
17315
|
try {
|
|
17196
|
-
|
|
17197
|
-
|
|
17316
|
+
fs10.writeSync(fd, value);
|
|
17317
|
+
fs10.fsyncSync(fd);
|
|
17198
17318
|
} finally {
|
|
17199
|
-
|
|
17319
|
+
fs10.closeSync(fd);
|
|
17200
17320
|
}
|
|
17201
|
-
|
|
17321
|
+
fs10.linkSync(tmpPath, finalPath);
|
|
17202
17322
|
cached = { path: finalPath, id: value };
|
|
17203
17323
|
return value;
|
|
17204
17324
|
} catch (err) {
|
|
@@ -17217,7 +17337,7 @@ function mintRandomId(finalPath) {
|
|
|
17217
17337
|
throw err;
|
|
17218
17338
|
} finally {
|
|
17219
17339
|
try {
|
|
17220
|
-
|
|
17340
|
+
fs10.unlinkSync(tmpPath);
|
|
17221
17341
|
} catch {
|
|
17222
17342
|
}
|
|
17223
17343
|
}
|
|
@@ -17225,12 +17345,12 @@ function mintRandomId(finalPath) {
|
|
|
17225
17345
|
throw new Error("telemetry: failed to create identity after retries");
|
|
17226
17346
|
}
|
|
17227
17347
|
function claimCorruptOccupant(finalPath) {
|
|
17228
|
-
const claimed =
|
|
17348
|
+
const claimed = path11.join(
|
|
17229
17349
|
argentHomeDir(),
|
|
17230
17350
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17231
17351
|
);
|
|
17232
17352
|
try {
|
|
17233
|
-
|
|
17353
|
+
fs10.renameSync(finalPath, claimed);
|
|
17234
17354
|
} catch {
|
|
17235
17355
|
return null;
|
|
17236
17356
|
}
|
|
@@ -17239,7 +17359,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17239
17359
|
grabbed = tryReadId(claimed);
|
|
17240
17360
|
} finally {
|
|
17241
17361
|
try {
|
|
17242
|
-
|
|
17362
|
+
fs10.unlinkSync(claimed);
|
|
17243
17363
|
} catch {
|
|
17244
17364
|
}
|
|
17245
17365
|
}
|
|
@@ -17248,7 +17368,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17248
17368
|
function deleteAnonId() {
|
|
17249
17369
|
cached = null;
|
|
17250
17370
|
try {
|
|
17251
|
-
|
|
17371
|
+
fs10.unlinkSync(identityFilePath());
|
|
17252
17372
|
} catch (err) {
|
|
17253
17373
|
if (err.code !== "ENOENT") throw err;
|
|
17254
17374
|
}
|
|
@@ -17256,9 +17376,9 @@ function deleteAnonId() {
|
|
|
17256
17376
|
function tryReadId(filePath) {
|
|
17257
17377
|
let raw;
|
|
17258
17378
|
try {
|
|
17259
|
-
const stats =
|
|
17379
|
+
const stats = fs10.lstatSync(filePath);
|
|
17260
17380
|
if (!stats.isFile()) return null;
|
|
17261
|
-
raw =
|
|
17381
|
+
raw = fs10.readFileSync(filePath, "utf8");
|
|
17262
17382
|
} catch (err) {
|
|
17263
17383
|
if (err.code === "ENOENT") return null;
|
|
17264
17384
|
return null;
|
|
@@ -17272,12 +17392,12 @@ function tryReadId(filePath) {
|
|
|
17272
17392
|
import { execFileSync, spawn } from "node:child_process";
|
|
17273
17393
|
|
|
17274
17394
|
// ../native-devtools-ios/src/index.ts
|
|
17275
|
-
import * as
|
|
17276
|
-
import * as
|
|
17277
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
17278
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
17279
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
17280
|
-
var DYLIB_TVOS_DIR =
|
|
17395
|
+
import * as path12 from "node:path";
|
|
17396
|
+
import * as fs11 from "node:fs";
|
|
17397
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path12.join(__dirname, "..", "dylibs");
|
|
17398
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path12.join(__dirname, "..", "bin");
|
|
17399
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path12.join(DYLIB_DIR, "tcp");
|
|
17400
|
+
var DYLIB_TVOS_DIR = path12.join(DYLIB_DIR, "tvos");
|
|
17281
17401
|
function hostPlatformKey() {
|
|
17282
17402
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
17283
17403
|
return "linux-arm64";
|
|
@@ -17288,14 +17408,14 @@ function simulatorServerBinaryName() {
|
|
|
17288
17408
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
17289
17409
|
}
|
|
17290
17410
|
function platformBinDir() {
|
|
17291
|
-
return
|
|
17411
|
+
return path12.join(BIN_DIR, hostPlatformKey());
|
|
17292
17412
|
}
|
|
17293
17413
|
function simulatorServerBinaryPath() {
|
|
17294
17414
|
const binaryName = simulatorServerBinaryName();
|
|
17295
|
-
const p =
|
|
17296
|
-
if (!
|
|
17297
|
-
const flat =
|
|
17298
|
-
const migrationHint =
|
|
17415
|
+
const p = path12.join(platformBinDir(), binaryName);
|
|
17416
|
+
if (!fs11.existsSync(p)) {
|
|
17417
|
+
const flat = path12.join(BIN_DIR, binaryName);
|
|
17418
|
+
const migrationHint = fs11.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
17299
17419
|
throw new Error(
|
|
17300
17420
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17301
17421
|
);
|
|
@@ -17324,12 +17444,12 @@ function resolveHostFingerprint() {
|
|
|
17324
17444
|
}
|
|
17325
17445
|
}
|
|
17326
17446
|
function resolveHostFingerprintAsync() {
|
|
17327
|
-
return new Promise((
|
|
17447
|
+
return new Promise((resolve22) => {
|
|
17328
17448
|
let binary;
|
|
17329
17449
|
try {
|
|
17330
17450
|
binary = simulatorServerBinaryPath();
|
|
17331
17451
|
} catch {
|
|
17332
|
-
|
|
17452
|
+
resolve22(null);
|
|
17333
17453
|
return;
|
|
17334
17454
|
}
|
|
17335
17455
|
let settled = false;
|
|
@@ -17342,7 +17462,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17342
17462
|
child?.kill("SIGKILL");
|
|
17343
17463
|
} catch {
|
|
17344
17464
|
}
|
|
17345
|
-
|
|
17465
|
+
resolve22(value);
|
|
17346
17466
|
};
|
|
17347
17467
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17348
17468
|
watchdog.unref?.();
|
|
@@ -17375,15 +17495,15 @@ function resolveHostFingerprintAsync() {
|
|
|
17375
17495
|
}
|
|
17376
17496
|
|
|
17377
17497
|
// ../telemetry/src/consent.ts
|
|
17378
|
-
import * as
|
|
17379
|
-
import * as
|
|
17498
|
+
import * as fs12 from "node:fs";
|
|
17499
|
+
import * as path13 from "node:path";
|
|
17380
17500
|
var cache = /* @__PURE__ */ new Map();
|
|
17381
17501
|
var sessionOverride = null;
|
|
17382
17502
|
function readConfigOverrideAt(filePath) {
|
|
17383
17503
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17384
17504
|
let stats;
|
|
17385
17505
|
try {
|
|
17386
|
-
stats =
|
|
17506
|
+
stats = fs12.lstatSync(filePath);
|
|
17387
17507
|
} catch {
|
|
17388
17508
|
cache.set(filePath, miss);
|
|
17389
17509
|
return null;
|
|
@@ -17400,7 +17520,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17400
17520
|
}
|
|
17401
17521
|
let parsedEnabled = null;
|
|
17402
17522
|
try {
|
|
17403
|
-
const raw =
|
|
17523
|
+
const raw = fs12.readFileSync(filePath, "utf8");
|
|
17404
17524
|
const json = JSON.parse(raw);
|
|
17405
17525
|
if (json && typeof json === "object") {
|
|
17406
17526
|
const t2 = json.telemetry;
|
|
@@ -17417,8 +17537,12 @@ function readConfigOverrideAt(filePath) {
|
|
|
17417
17537
|
function readPersistedConsent(cwd) {
|
|
17418
17538
|
const globalPath = configFilePath("global");
|
|
17419
17539
|
const projectPath = configFilePath("project", { cwd });
|
|
17540
|
+
const userConfigPath = path13.join(resolveHomeDir(), ".argent", "config.json");
|
|
17541
|
+
if (userConfigPath !== globalPath && readConfigOverrideAt(userConfigPath) === false) {
|
|
17542
|
+
return { enabled: false, detail: `${userConfigPath} (user)` };
|
|
17543
|
+
}
|
|
17420
17544
|
const global2 = readConfigOverrideAt(globalPath);
|
|
17421
|
-
const projectRoot =
|
|
17545
|
+
const projectRoot = path13.dirname(path13.dirname(projectPath));
|
|
17422
17546
|
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
17423
17547
|
if (project === false && global2 === false) {
|
|
17424
17548
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
@@ -17614,7 +17738,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
17614
17738
|
async function raceDrain(client2, timeoutMs) {
|
|
17615
17739
|
await Promise.race([
|
|
17616
17740
|
client2.shutdown(timeoutMs),
|
|
17617
|
-
new Promise((
|
|
17741
|
+
new Promise((resolve22) => setTimeout(resolve22, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
17618
17742
|
]);
|
|
17619
17743
|
}
|
|
17620
17744
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -17634,10 +17758,10 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17634
17758
|
}
|
|
17635
17759
|
|
|
17636
17760
|
// ../argent-installer/src/mcp-configs.ts
|
|
17637
|
-
import * as
|
|
17638
|
-
import * as
|
|
17639
|
-
import { execFileSync as
|
|
17640
|
-
import { homedir as
|
|
17761
|
+
import * as fs19 from "node:fs";
|
|
17762
|
+
import * as path20 from "node:path";
|
|
17763
|
+
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
17764
|
+
import { homedir as homedir4 } from "node:os";
|
|
17641
17765
|
|
|
17642
17766
|
// ../argent-installer/src/constants.ts
|
|
17643
17767
|
var PACKAGE_NAME = "@swmansion/argent";
|
|
@@ -17650,12 +17774,12 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17650
17774
|
|
|
17651
17775
|
// ../argent-installer/src/utils.ts
|
|
17652
17776
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17653
|
-
import * as
|
|
17654
|
-
import * as
|
|
17777
|
+
import * as fs18 from "node:fs";
|
|
17778
|
+
import * as path19 from "node:path";
|
|
17655
17779
|
import * as dns from "node:dns";
|
|
17656
17780
|
import { createHash as createHash2 } from "node:crypto";
|
|
17657
17781
|
import * as os3 from "node:os";
|
|
17658
|
-
import { execFileSync as
|
|
17782
|
+
import { execFileSync as execFileSync4, execSync } from "node:child_process";
|
|
17659
17783
|
|
|
17660
17784
|
// ../../node_modules/smol-toml/dist/error.js
|
|
17661
17785
|
function getLineColFromPtr(string, ptr) {
|
|
@@ -19397,12 +19521,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19397
19521
|
}
|
|
19398
19522
|
return result;
|
|
19399
19523
|
}
|
|
19400
|
-
function findNodeAtLocation(root,
|
|
19524
|
+
function findNodeAtLocation(root, path34) {
|
|
19401
19525
|
if (!root) {
|
|
19402
19526
|
return void 0;
|
|
19403
19527
|
}
|
|
19404
19528
|
let node = root;
|
|
19405
|
-
for (let segment of
|
|
19529
|
+
for (let segment of path34) {
|
|
19406
19530
|
if (typeof segment === "string") {
|
|
19407
19531
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19408
19532
|
return void 0;
|
|
@@ -19756,14 +19880,14 @@ function getNodeType(value) {
|
|
|
19756
19880
|
|
|
19757
19881
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19758
19882
|
function setProperty(text2, originalPath, value, options) {
|
|
19759
|
-
const
|
|
19883
|
+
const path34 = originalPath.slice();
|
|
19760
19884
|
const errors = [];
|
|
19761
19885
|
const root = parseTree(text2, errors);
|
|
19762
19886
|
let parent = void 0;
|
|
19763
19887
|
let lastSegment = void 0;
|
|
19764
|
-
while (
|
|
19765
|
-
lastSegment =
|
|
19766
|
-
parent = findNodeAtLocation(root,
|
|
19888
|
+
while (path34.length > 0) {
|
|
19889
|
+
lastSegment = path34.pop();
|
|
19890
|
+
parent = findNodeAtLocation(root, path34);
|
|
19767
19891
|
if (parent === void 0 && value !== void 0) {
|
|
19768
19892
|
if (typeof lastSegment === "string") {
|
|
19769
19893
|
value = { [lastSegment]: value };
|
|
@@ -19949,8 +20073,8 @@ var ParseErrorCode;
|
|
|
19949
20073
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
19950
20074
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
19951
20075
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
19952
|
-
function modify(text2,
|
|
19953
|
-
return setProperty(text2,
|
|
20076
|
+
function modify(text2, path34, value, options) {
|
|
20077
|
+
return setProperty(text2, path34, value, options);
|
|
19954
20078
|
}
|
|
19955
20079
|
function applyEdits(text2, edits) {
|
|
19956
20080
|
let sortedEdits = edits.slice(0).sort((a2, b) => {
|
|
@@ -19974,38 +20098,39 @@ function applyEdits(text2, edits) {
|
|
|
19974
20098
|
}
|
|
19975
20099
|
|
|
19976
20100
|
// ../argent-installer/src/package-root.ts
|
|
19977
|
-
import * as
|
|
19978
|
-
import * as
|
|
19979
|
-
function resolvePackageRoot(
|
|
19980
|
-
let current =
|
|
20101
|
+
import * as fs13 from "node:fs";
|
|
20102
|
+
import * as path14 from "node:path";
|
|
20103
|
+
function resolvePackageRoot(dirname19) {
|
|
20104
|
+
let current = path14.resolve(dirname19);
|
|
19981
20105
|
while (true) {
|
|
19982
|
-
if (
|
|
19983
|
-
const parent =
|
|
19984
|
-
if (parent === current) return
|
|
20106
|
+
if (fs13.existsSync(path14.join(current, "package.json"))) return current;
|
|
20107
|
+
const parent = path14.dirname(current);
|
|
20108
|
+
if (parent === current) return path14.resolve(dirname19);
|
|
19985
20109
|
current = parent;
|
|
19986
20110
|
}
|
|
19987
20111
|
}
|
|
19988
20112
|
|
|
19989
20113
|
// ../argent-installer/src/package-manager.ts
|
|
19990
|
-
import
|
|
20114
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
20115
|
+
import * as fs16 from "node:fs";
|
|
19991
20116
|
import * as os2 from "node:os";
|
|
19992
|
-
import * as
|
|
20117
|
+
import * as path17 from "node:path";
|
|
19993
20118
|
|
|
19994
20119
|
// ../argent-installer/src/topology.ts
|
|
19995
20120
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
19996
|
-
import * as
|
|
19997
|
-
import * as
|
|
20121
|
+
import * as fs15 from "node:fs";
|
|
20122
|
+
import * as path16 from "node:path";
|
|
19998
20123
|
import { createRequire } from "node:module";
|
|
19999
20124
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20000
20125
|
|
|
20001
20126
|
// ../argent-installer/src/preflight.ts
|
|
20002
|
-
import * as
|
|
20003
|
-
import * as
|
|
20127
|
+
import * as fs14 from "node:fs";
|
|
20128
|
+
import * as path15 from "node:path";
|
|
20004
20129
|
function hasProjectPackageJson(projectRoot) {
|
|
20005
|
-
return
|
|
20130
|
+
return fs14.existsSync(path15.join(projectRoot, "package.json"));
|
|
20006
20131
|
}
|
|
20007
20132
|
function isYarnPnp(projectRoot) {
|
|
20008
|
-
return
|
|
20133
|
+
return fs14.existsSync(path15.join(projectRoot, ".pnp.cjs")) || fs14.existsSync(path15.join(projectRoot, ".pnp.loader.mjs"));
|
|
20009
20134
|
}
|
|
20010
20135
|
|
|
20011
20136
|
// ../argent-installer/src/topology.ts
|
|
@@ -20031,12 +20156,12 @@ function isTempRunnerPath(binaryPath) {
|
|
|
20031
20156
|
}
|
|
20032
20157
|
function isProjectBinPath(binaryPath) {
|
|
20033
20158
|
const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
|
|
20034
|
-
const binDir = norm(
|
|
20159
|
+
const binDir = norm(path16.dirname(path16.resolve(binaryPath)));
|
|
20035
20160
|
const prefix = process.env.npm_config_local_prefix;
|
|
20036
|
-
if (prefix && norm(
|
|
20037
|
-
for (let dir =
|
|
20038
|
-
if (norm(
|
|
20039
|
-
if (
|
|
20161
|
+
if (prefix && norm(path16.join(prefix, "node_modules", ".bin")) === binDir) return true;
|
|
20162
|
+
for (let dir = path16.resolve(process.cwd()); ; dir = path16.dirname(dir)) {
|
|
20163
|
+
if (norm(path16.join(dir, "node_modules", ".bin")) === binDir) return true;
|
|
20164
|
+
if (path16.dirname(dir) === dir) return false;
|
|
20040
20165
|
}
|
|
20041
20166
|
}
|
|
20042
20167
|
function getPermanentBinaryPaths() {
|
|
@@ -20084,8 +20209,8 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20084
20209
|
}
|
|
20085
20210
|
function readShimScript(binaryPath) {
|
|
20086
20211
|
try {
|
|
20087
|
-
if (
|
|
20088
|
-
return
|
|
20212
|
+
if (fs15.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20213
|
+
return fs15.readFileSync(binaryPath, "utf8");
|
|
20089
20214
|
} catch {
|
|
20090
20215
|
return null;
|
|
20091
20216
|
}
|
|
@@ -20096,7 +20221,7 @@ function shimTargetOf(binaryPath) {
|
|
|
20096
20221
|
const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
|
|
20097
20222
|
if (trailer) return trailer[1].trim();
|
|
20098
20223
|
const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
|
|
20099
|
-
return relative5 ?
|
|
20224
|
+
return relative5 ? path16.resolve(canonicalPath(path16.dirname(binaryPath)), relative5[1]) : null;
|
|
20100
20225
|
}
|
|
20101
20226
|
function globalPackageRootOf(binaryPath) {
|
|
20102
20227
|
const root = packageRootOf(binaryPath);
|
|
@@ -20106,9 +20231,9 @@ function globalPackageRootOf(binaryPath) {
|
|
|
20106
20231
|
}
|
|
20107
20232
|
function packageRootOf(binaryPath) {
|
|
20108
20233
|
try {
|
|
20109
|
-
const realPath =
|
|
20110
|
-
const root = resolvePackageRoot(
|
|
20111
|
-
const pkg = JSON.parse(
|
|
20234
|
+
const realPath = fs15.realpathSync(binaryPath);
|
|
20235
|
+
const root = resolvePackageRoot(path16.dirname(realPath));
|
|
20236
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(root, "package.json"), "utf8"));
|
|
20112
20237
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20113
20238
|
} catch {
|
|
20114
20239
|
return null;
|
|
@@ -20117,8 +20242,8 @@ function packageRootOf(binaryPath) {
|
|
|
20117
20242
|
function cliPathOf(packageRoot) {
|
|
20118
20243
|
const binSub = argentBinSubpath(packageRoot);
|
|
20119
20244
|
if (!binSub) return null;
|
|
20120
|
-
const cli =
|
|
20121
|
-
return
|
|
20245
|
+
const cli = path16.join(packageRoot, binSub);
|
|
20246
|
+
return fs15.existsSync(cli) ? cli : null;
|
|
20122
20247
|
}
|
|
20123
20248
|
function getGloballyInstalledLaunchPaths() {
|
|
20124
20249
|
if (process.platform === "win32") return null;
|
|
@@ -20128,8 +20253,8 @@ function getGloballyInstalledLaunchPaths() {
|
|
|
20128
20253
|
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20129
20254
|
if (!cli) return null;
|
|
20130
20255
|
try {
|
|
20131
|
-
const node =
|
|
20132
|
-
return
|
|
20256
|
+
const node = path16.join(fs15.realpathSync(path16.dirname(binaryPath)), "node");
|
|
20257
|
+
return fs15.existsSync(node) ? { node, cli } : null;
|
|
20133
20258
|
} catch {
|
|
20134
20259
|
return null;
|
|
20135
20260
|
}
|
|
@@ -20138,7 +20263,7 @@ function getGloballyInstalledVersion() {
|
|
|
20138
20263
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20139
20264
|
if (!pkgRoot) return null;
|
|
20140
20265
|
try {
|
|
20141
|
-
const pkg = JSON.parse(
|
|
20266
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(pkgRoot, "package.json"), "utf8"));
|
|
20142
20267
|
return pkg.version ?? null;
|
|
20143
20268
|
} catch {
|
|
20144
20269
|
return null;
|
|
@@ -20147,7 +20272,7 @@ function getGloballyInstalledVersion() {
|
|
|
20147
20272
|
function readManifestDeclaration(projectRoot) {
|
|
20148
20273
|
try {
|
|
20149
20274
|
const pkg = JSON.parse(
|
|
20150
|
-
|
|
20275
|
+
fs15.readFileSync(path16.join(projectRoot, "package.json"), "utf8")
|
|
20151
20276
|
);
|
|
20152
20277
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20153
20278
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20160,11 +20285,11 @@ function isDeclaredLocally(projectRoot) {
|
|
|
20160
20285
|
}
|
|
20161
20286
|
function resolveLocalArgentDir(projectRoot) {
|
|
20162
20287
|
try {
|
|
20163
|
-
const req = createRequire(
|
|
20164
|
-
return
|
|
20288
|
+
const req = createRequire(path16.join(projectRoot, "package.json"));
|
|
20289
|
+
return path16.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20165
20290
|
} catch {
|
|
20166
|
-
const plain =
|
|
20167
|
-
return
|
|
20291
|
+
const plain = path16.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20292
|
+
return fs15.existsSync(path16.join(plain, "package.json")) ? plain : null;
|
|
20168
20293
|
}
|
|
20169
20294
|
}
|
|
20170
20295
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20172,7 +20297,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20172
20297
|
if (packageDir) {
|
|
20173
20298
|
let version;
|
|
20174
20299
|
try {
|
|
20175
|
-
const pkg = JSON.parse(
|
|
20300
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(packageDir, "package.json"), "utf8"));
|
|
20176
20301
|
version = pkg.version ?? null;
|
|
20177
20302
|
} catch {
|
|
20178
20303
|
version = null;
|
|
@@ -20195,8 +20320,8 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20195
20320
|
}
|
|
20196
20321
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20197
20322
|
try {
|
|
20198
|
-
const pkgPath =
|
|
20199
|
-
const pkg = JSON.parse(
|
|
20323
|
+
const pkgPath = path16.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20324
|
+
const pkg = JSON.parse(fs15.readFileSync(pkgPath, "utf8"));
|
|
20200
20325
|
return pkg.version ?? null;
|
|
20201
20326
|
} catch {
|
|
20202
20327
|
return null;
|
|
@@ -20204,7 +20329,7 @@ function readLocalPackageVersionUncached(projectRoot) {
|
|
|
20204
20329
|
}
|
|
20205
20330
|
function argentBinSubpath(pkgDir) {
|
|
20206
20331
|
try {
|
|
20207
|
-
const pkg = JSON.parse(
|
|
20332
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(pkgDir, "package.json"), "utf8"));
|
|
20208
20333
|
if (typeof pkg.bin === "string") return pkg.bin;
|
|
20209
20334
|
if (pkg.bin && typeof pkg.bin === "object") {
|
|
20210
20335
|
return pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0] ?? null;
|
|
@@ -20221,16 +20346,16 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20221
20346
|
if (!binSub) return null;
|
|
20222
20347
|
let root = projectRoot;
|
|
20223
20348
|
try {
|
|
20224
|
-
root =
|
|
20349
|
+
root = fs15.realpathSync(projectRoot);
|
|
20225
20350
|
} catch {
|
|
20226
20351
|
}
|
|
20227
|
-
const stableRel =
|
|
20228
|
-
if (
|
|
20229
|
-
return stableRel.split(
|
|
20352
|
+
const stableRel = path16.join("node_modules", PACKAGE_NAME, binSub);
|
|
20353
|
+
if (fs15.existsSync(path16.join(root, stableRel))) {
|
|
20354
|
+
return stableRel.split(path16.sep).join("/");
|
|
20230
20355
|
}
|
|
20231
|
-
const abs =
|
|
20232
|
-
if (!
|
|
20233
|
-
return
|
|
20356
|
+
const abs = path16.join(pkgDir, binSub);
|
|
20357
|
+
if (!fs15.existsSync(abs)) return null;
|
|
20358
|
+
return path16.relative(root, abs).split(path16.sep).join("/");
|
|
20234
20359
|
}
|
|
20235
20360
|
|
|
20236
20361
|
// ../argent-installer/src/package-manager.ts
|
|
@@ -20263,10 +20388,10 @@ function detectGlobalPackageManager() {
|
|
|
20263
20388
|
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20264
20389
|
}
|
|
20265
20390
|
if (process.platform === "win32") {
|
|
20266
|
-
if (
|
|
20391
|
+
if (fs16.existsSync(path17.join(npmCopyBeside(path17.dirname(binaryPath)), "package.json"))) {
|
|
20267
20392
|
return "npm";
|
|
20268
20393
|
}
|
|
20269
|
-
if (
|
|
20394
|
+
if (fs16.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20270
20395
|
}
|
|
20271
20396
|
const shim = readShimScript(binaryPath);
|
|
20272
20397
|
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
@@ -20275,23 +20400,23 @@ function detectGlobalPackageManager() {
|
|
|
20275
20400
|
return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
|
|
20276
20401
|
}
|
|
20277
20402
|
function lockfileOwnerOf(root) {
|
|
20278
|
-
for (let dir =
|
|
20403
|
+
for (let dir = path17.dirname(root); path17.dirname(dir) !== dir; dir = path17.dirname(dir)) {
|
|
20279
20404
|
const pm = pmFromLockfile(dir);
|
|
20280
20405
|
if (pm) return pm;
|
|
20281
20406
|
}
|
|
20282
20407
|
return null;
|
|
20283
20408
|
}
|
|
20284
20409
|
function npmCopyBeside(binDir) {
|
|
20285
|
-
return process.platform === "win32" ?
|
|
20410
|
+
return process.platform === "win32" ? path17.join(binDir, "node_modules", PACKAGE_NAME) : path17.join(path17.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
|
|
20286
20411
|
}
|
|
20287
20412
|
function isInNpmLayout(binaryPath, root) {
|
|
20288
20413
|
const realRoot = canonicalPath(root);
|
|
20289
20414
|
let link = binaryPath;
|
|
20290
20415
|
for (let hop = 0; hop < 40; hop++) {
|
|
20291
|
-
const binDir = canonicalPath(
|
|
20416
|
+
const binDir = canonicalPath(path17.dirname(link));
|
|
20292
20417
|
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20293
20418
|
try {
|
|
20294
|
-
link =
|
|
20419
|
+
link = path17.resolve(binDir, fs16.readlinkSync(link));
|
|
20295
20420
|
} catch {
|
|
20296
20421
|
return false;
|
|
20297
20422
|
}
|
|
@@ -20310,7 +20435,7 @@ function asKnownPm(name) {
|
|
|
20310
20435
|
}
|
|
20311
20436
|
function pmFromPackageManagerField(dir) {
|
|
20312
20437
|
try {
|
|
20313
|
-
const pkg = JSON.parse(
|
|
20438
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(dir, "package.json"), "utf8"));
|
|
20314
20439
|
if (typeof pkg.packageManager === "string") {
|
|
20315
20440
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20316
20441
|
}
|
|
@@ -20321,7 +20446,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20321
20446
|
}
|
|
20322
20447
|
function pmFromDevEngines(dir) {
|
|
20323
20448
|
try {
|
|
20324
|
-
const pkg = JSON.parse(
|
|
20449
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(dir, "package.json"), "utf8"));
|
|
20325
20450
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20326
20451
|
const names = /* @__PURE__ */ new Set();
|
|
20327
20452
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20334,7 +20459,7 @@ function pmFromDevEngines(dir) {
|
|
|
20334
20459
|
}
|
|
20335
20460
|
}
|
|
20336
20461
|
function pmFromLockfile(dir) {
|
|
20337
|
-
const has = (file) =>
|
|
20462
|
+
const has = (file) => fs16.existsSync(path17.join(dir, file));
|
|
20338
20463
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20339
20464
|
if (has("yarn.lock")) return "yarn";
|
|
20340
20465
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20342,15 +20467,15 @@ function pmFromLockfile(dir) {
|
|
|
20342
20467
|
return null;
|
|
20343
20468
|
}
|
|
20344
20469
|
function pmFromWorkspaceMarker(dir) {
|
|
20345
|
-
return
|
|
20470
|
+
return fs16.existsSync(path17.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20346
20471
|
}
|
|
20347
20472
|
function detectProjectPackageManager(projectRoot) {
|
|
20348
|
-
let dir =
|
|
20473
|
+
let dir = path17.resolve(projectRoot);
|
|
20349
20474
|
for (; ; ) {
|
|
20350
20475
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20351
20476
|
if (pm) return pm;
|
|
20352
|
-
if (
|
|
20353
|
-
const parent =
|
|
20477
|
+
if (fs16.existsSync(path17.join(dir, ".git"))) break;
|
|
20478
|
+
const parent = path17.dirname(dir);
|
|
20354
20479
|
if (parent === dir) break;
|
|
20355
20480
|
dir = parent;
|
|
20356
20481
|
}
|
|
@@ -20371,11 +20496,47 @@ function globalInstallCommand(pm, pkg) {
|
|
|
20371
20496
|
function globalCommandOptions(pm) {
|
|
20372
20497
|
if (pm === "npm") return {};
|
|
20373
20498
|
const home = os2.homedir();
|
|
20374
|
-
const cwd =
|
|
20499
|
+
const cwd = fs16.existsSync(home) ? { cwd: home } : {};
|
|
20375
20500
|
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20376
20501
|
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20377
20502
|
return { ...cwd, env };
|
|
20378
20503
|
}
|
|
20504
|
+
var globalLocationArgs = {
|
|
20505
|
+
npm: ["root", "-g"],
|
|
20506
|
+
pnpm: ["list", "-g", "--depth", "0", "--json", PACKAGE_NAME],
|
|
20507
|
+
yarn: ["global", "dir"],
|
|
20508
|
+
bun: ["pm", "ls", "-g"]
|
|
20509
|
+
};
|
|
20510
|
+
function isRegistrySpec(spec) {
|
|
20511
|
+
return typeof spec === "string" && spec.length > 0 && !spec.includes(":") && !spec.includes("/");
|
|
20512
|
+
}
|
|
20513
|
+
function ownsGlobalInstall(pm, runningRoot) {
|
|
20514
|
+
try {
|
|
20515
|
+
const output = execFileSync3(pm, globalLocationArgs[pm], {
|
|
20516
|
+
...globalCommandOptions(pm),
|
|
20517
|
+
encoding: "utf8",
|
|
20518
|
+
stdio: ["ignore", "pipe", "ignore"],
|
|
20519
|
+
shell: process.platform === "win32",
|
|
20520
|
+
timeout: 5e3
|
|
20521
|
+
}).trim();
|
|
20522
|
+
let pkg;
|
|
20523
|
+
let localBuild;
|
|
20524
|
+
if (pm === "pnpm") {
|
|
20525
|
+
const listings = JSON.parse(output);
|
|
20526
|
+
const dependency = listings[0]?.dependencies?.[PACKAGE_NAME];
|
|
20527
|
+
pkg = dependency?.path;
|
|
20528
|
+
localBuild = !isRegistrySpec(dependency?.version);
|
|
20529
|
+
} else {
|
|
20530
|
+
const dir = pm === "bun" ? /^([^\r\n]+) node_modules \(/.exec(output)?.[1] : output;
|
|
20531
|
+
if (!dir || !path17.isAbsolute(dir)) return false;
|
|
20532
|
+
pkg = pm === "npm" ? path17.join(dir, PACKAGE_NAME) : path17.join(dir, "node_modules", PACKAGE_NAME);
|
|
20533
|
+
localBuild = fs16.lstatSync(pkg).isSymbolicLink();
|
|
20534
|
+
}
|
|
20535
|
+
return !localBuild && !!pkg && path17.isAbsolute(pkg) && fs16.realpathSync(pkg) === runningRoot;
|
|
20536
|
+
} catch {
|
|
20537
|
+
return false;
|
|
20538
|
+
}
|
|
20539
|
+
}
|
|
20379
20540
|
function globalUninstallCommand(pm, pkg) {
|
|
20380
20541
|
switch (pm) {
|
|
20381
20542
|
case "yarn":
|
|
@@ -20426,15 +20587,15 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20426
20587
|
}
|
|
20427
20588
|
|
|
20428
20589
|
// ../argent-installer/src/install-record.ts
|
|
20429
|
-
import * as
|
|
20430
|
-
import * as
|
|
20590
|
+
import * as fs17 from "node:fs";
|
|
20591
|
+
import * as path18 from "node:path";
|
|
20431
20592
|
function getInstallRecordPath(projectRoot) {
|
|
20432
|
-
return
|
|
20593
|
+
return path18.join(projectRoot, ".argent", "install.json");
|
|
20433
20594
|
}
|
|
20434
20595
|
function readInstallRecord(projectRoot) {
|
|
20435
20596
|
try {
|
|
20436
20597
|
const parsed = JSON.parse(
|
|
20437
|
-
|
|
20598
|
+
fs17.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20438
20599
|
);
|
|
20439
20600
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20440
20601
|
return null;
|
|
@@ -20444,17 +20605,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20444
20605
|
}
|
|
20445
20606
|
function writeInstallRecord(projectRoot, record) {
|
|
20446
20607
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20447
|
-
|
|
20448
|
-
|
|
20608
|
+
fs17.mkdirSync(path18.dirname(recordPath), { recursive: true });
|
|
20609
|
+
fs17.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20449
20610
|
}
|
|
20450
20611
|
function removeInstallRecord(projectRoot) {
|
|
20451
20612
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20452
20613
|
try {
|
|
20453
|
-
if (!
|
|
20454
|
-
|
|
20455
|
-
const dir =
|
|
20614
|
+
if (!fs17.existsSync(recordPath)) return false;
|
|
20615
|
+
fs17.rmSync(recordPath, { force: true });
|
|
20616
|
+
const dir = path18.dirname(recordPath);
|
|
20456
20617
|
try {
|
|
20457
|
-
if (
|
|
20618
|
+
if (fs17.existsSync(dir) && fs17.readdirSync(dir).length === 0) fs17.rmdirSync(dir);
|
|
20458
20619
|
} catch {
|
|
20459
20620
|
}
|
|
20460
20621
|
return true;
|
|
@@ -20482,9 +20643,9 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20482
20643
|
// ../argent-installer/src/utils.ts
|
|
20483
20644
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20484
20645
|
function resolveBundledDir(dirName) {
|
|
20485
|
-
const packagedDir =
|
|
20486
|
-
if (
|
|
20487
|
-
return
|
|
20646
|
+
const packagedDir = path19.join(PACKAGE_ROOT, dirName);
|
|
20647
|
+
if (fs18.existsSync(packagedDir)) return packagedDir;
|
|
20648
|
+
return path19.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20488
20649
|
}
|
|
20489
20650
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20490
20651
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20496,18 +20657,18 @@ function buildArgentSkillsSource(version) {
|
|
|
20496
20657
|
}
|
|
20497
20658
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20498
20659
|
try {
|
|
20499
|
-
return
|
|
20660
|
+
return fs18.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs18.existsSync(path19.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20500
20661
|
} catch {
|
|
20501
20662
|
return [];
|
|
20502
20663
|
}
|
|
20503
20664
|
}
|
|
20504
20665
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20505
|
-
return
|
|
20666
|
+
return path19.join(cwd, "skills-lock.json");
|
|
20506
20667
|
}
|
|
20507
20668
|
function getGlobalSkillLockPath() {
|
|
20508
20669
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20509
|
-
if (xdgStateHome) return
|
|
20510
|
-
return
|
|
20670
|
+
if (xdgStateHome) return path19.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20671
|
+
return path19.join(os3.homedir(), ".agents", ".skill-lock.json");
|
|
20511
20672
|
}
|
|
20512
20673
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20513
20674
|
var LEGACY_ARGENT_SKILL_NAMES = [
|
|
@@ -20613,7 +20774,7 @@ function hashBundledContent(content) {
|
|
|
20613
20774
|
}
|
|
20614
20775
|
function listArgentSkillsInLock(lockPath) {
|
|
20615
20776
|
try {
|
|
20616
|
-
const raw =
|
|
20777
|
+
const raw = fs18.readFileSync(lockPath, "utf8");
|
|
20617
20778
|
const lock = JSON.parse(raw);
|
|
20618
20779
|
const tracked = lock.skills ?? {};
|
|
20619
20780
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20637,20 +20798,20 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20637
20798
|
"skills-lock.json"
|
|
20638
20799
|
];
|
|
20639
20800
|
function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
20640
|
-
const initialDir =
|
|
20801
|
+
const initialDir = path19.resolve(startDir);
|
|
20641
20802
|
const home = canonicalPath(homeDir);
|
|
20642
20803
|
let currentDir = initialDir;
|
|
20643
20804
|
while (true) {
|
|
20644
20805
|
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20645
20806
|
return initialDir;
|
|
20646
20807
|
}
|
|
20647
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20808
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs18.existsSync(path19.join(currentDir, marker)))) {
|
|
20648
20809
|
return currentDir;
|
|
20649
20810
|
}
|
|
20650
|
-
if (
|
|
20811
|
+
if (fs18.existsSync(path19.join(currentDir, ".git"))) {
|
|
20651
20812
|
return currentDir;
|
|
20652
20813
|
}
|
|
20653
|
-
const parentDir =
|
|
20814
|
+
const parentDir = path19.dirname(currentDir);
|
|
20654
20815
|
if (parentDir === currentDir) {
|
|
20655
20816
|
return initialDir;
|
|
20656
20817
|
}
|
|
@@ -20658,20 +20819,20 @@ function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
|
20658
20819
|
}
|
|
20659
20820
|
}
|
|
20660
20821
|
function readToml(filePath) {
|
|
20661
|
-
if (!
|
|
20822
|
+
if (!fs18.existsSync(filePath)) return {};
|
|
20662
20823
|
try {
|
|
20663
|
-
return parse(
|
|
20824
|
+
return parse(fs18.readFileSync(filePath, "utf8"));
|
|
20664
20825
|
} catch {
|
|
20665
20826
|
return {};
|
|
20666
20827
|
}
|
|
20667
20828
|
}
|
|
20668
20829
|
function writeToml(filePath, data) {
|
|
20669
|
-
|
|
20670
|
-
|
|
20830
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20831
|
+
fs18.writeFileSync(filePath, stringify(data) + "\n");
|
|
20671
20832
|
}
|
|
20672
20833
|
function readYaml(filePath) {
|
|
20673
|
-
if (!
|
|
20674
|
-
const text2 =
|
|
20834
|
+
if (!fs18.existsSync(filePath)) return new import_yaml.Document({});
|
|
20835
|
+
const text2 = fs18.readFileSync(filePath, "utf8");
|
|
20675
20836
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20676
20837
|
if (doc.errors.length > 0) {
|
|
20677
20838
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20680,20 +20841,20 @@ function readYaml(filePath) {
|
|
|
20680
20841
|
return doc;
|
|
20681
20842
|
}
|
|
20682
20843
|
function writeYaml(filePath, doc) {
|
|
20683
|
-
|
|
20684
|
-
|
|
20844
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20845
|
+
fs18.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20685
20846
|
}
|
|
20686
20847
|
function readJson(filePath) {
|
|
20687
|
-
if (!
|
|
20848
|
+
if (!fs18.existsSync(filePath)) return {};
|
|
20688
20849
|
try {
|
|
20689
|
-
return JSON.parse(
|
|
20850
|
+
return JSON.parse(fs18.readFileSync(filePath, "utf8"));
|
|
20690
20851
|
} catch {
|
|
20691
20852
|
return {};
|
|
20692
20853
|
}
|
|
20693
20854
|
}
|
|
20694
20855
|
function writeJson(filePath, data) {
|
|
20695
|
-
|
|
20696
|
-
|
|
20856
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20857
|
+
fs18.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20697
20858
|
}
|
|
20698
20859
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20699
20860
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20701,8 +20862,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20701
20862
|
return applyEdits(text2, edits);
|
|
20702
20863
|
}
|
|
20703
20864
|
function readJsoncFileRaw(filePath) {
|
|
20704
|
-
if (!
|
|
20705
|
-
let text2 =
|
|
20865
|
+
if (!fs18.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20866
|
+
let text2 = fs18.readFileSync(filePath, "utf8");
|
|
20706
20867
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20707
20868
|
if (hadBom) text2 = text2.slice(1);
|
|
20708
20869
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20721,26 +20882,26 @@ function isEmptyPlainObject(value) {
|
|
|
20721
20882
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20722
20883
|
}
|
|
20723
20884
|
function removePath(targetPath) {
|
|
20724
|
-
const entry =
|
|
20885
|
+
const entry = fs18.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20725
20886
|
if (!entry) return false;
|
|
20726
|
-
if (entry.isSymbolicLink())
|
|
20727
|
-
else
|
|
20887
|
+
if (entry.isSymbolicLink()) fs18.unlinkSync(targetPath);
|
|
20888
|
+
else fs18.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20728
20889
|
return true;
|
|
20729
20890
|
}
|
|
20730
20891
|
function rmEmptyDir(dirPath) {
|
|
20731
20892
|
try {
|
|
20732
|
-
if (!
|
|
20733
|
-
if (!
|
|
20734
|
-
if (
|
|
20735
|
-
|
|
20893
|
+
if (!fs18.existsSync(dirPath)) return false;
|
|
20894
|
+
if (!fs18.statSync(dirPath).isDirectory()) return false;
|
|
20895
|
+
if (fs18.readdirSync(dirPath).length > 0) return false;
|
|
20896
|
+
fs18.rmdirSync(dirPath);
|
|
20736
20897
|
return true;
|
|
20737
20898
|
} catch {
|
|
20738
20899
|
return false;
|
|
20739
20900
|
}
|
|
20740
20901
|
}
|
|
20741
20902
|
function readJsonc(filePath) {
|
|
20742
|
-
if (!
|
|
20743
|
-
let raw =
|
|
20903
|
+
if (!fs18.existsSync(filePath)) return {};
|
|
20904
|
+
let raw = fs18.readFileSync(filePath, "utf8");
|
|
20744
20905
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20745
20906
|
if (raw.trim() === "") return {};
|
|
20746
20907
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20761,7 +20922,7 @@ function yamlSyntaxErrorLine(raw) {
|
|
|
20761
20922
|
function findConfigSyntaxErrorLine(filePath, jsonOptions) {
|
|
20762
20923
|
let raw;
|
|
20763
20924
|
try {
|
|
20764
|
-
raw =
|
|
20925
|
+
raw = fs18.readFileSync(filePath, "utf8");
|
|
20765
20926
|
} catch {
|
|
20766
20927
|
return null;
|
|
20767
20928
|
}
|
|
@@ -20787,18 +20948,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20787
20948
|
}
|
|
20788
20949
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20789
20950
|
if (isEmptyPlainObject(parsed)) {
|
|
20790
|
-
|
|
20791
|
-
rmEmptyDir(
|
|
20951
|
+
fs18.rmSync(filePath, { force: true });
|
|
20952
|
+
rmEmptyDir(path19.dirname(filePath));
|
|
20792
20953
|
return;
|
|
20793
20954
|
}
|
|
20794
|
-
|
|
20955
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20795
20956
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20796
|
-
|
|
20957
|
+
fs18.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20797
20958
|
}
|
|
20798
20959
|
var MAX_SYMLINK_HOPS = 40;
|
|
20799
20960
|
function realpathOrSelf(p) {
|
|
20800
20961
|
try {
|
|
20801
|
-
return
|
|
20962
|
+
return fs18.realpathSync(p);
|
|
20802
20963
|
} catch {
|
|
20803
20964
|
return p;
|
|
20804
20965
|
}
|
|
@@ -20808,13 +20969,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20808
20969
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20809
20970
|
let entry;
|
|
20810
20971
|
try {
|
|
20811
|
-
entry =
|
|
20972
|
+
entry = fs18.lstatSync(current);
|
|
20812
20973
|
} catch {
|
|
20813
|
-
return current === dest || dirExists(
|
|
20974
|
+
return current === dest || dirExists(path19.dirname(current)) ? current : dest;
|
|
20814
20975
|
}
|
|
20815
20976
|
if (!entry.isSymbolicLink()) return current;
|
|
20816
20977
|
try {
|
|
20817
|
-
current =
|
|
20978
|
+
current = path19.resolve(realpathOrSelf(path19.dirname(current)), fs18.readlinkSync(current));
|
|
20818
20979
|
} catch {
|
|
20819
20980
|
return dest;
|
|
20820
20981
|
}
|
|
@@ -20822,30 +20983,30 @@ function resolveLinkedDestination(dest) {
|
|
|
20822
20983
|
return dest;
|
|
20823
20984
|
}
|
|
20824
20985
|
function copyDir(src, dest) {
|
|
20825
|
-
if (!
|
|
20986
|
+
if (!fs18.existsSync(src) || !treeHasFiles(src)) return null;
|
|
20826
20987
|
const target = resolveLinkedDestination(dest);
|
|
20827
20988
|
copyTree(src, target);
|
|
20828
20989
|
return target;
|
|
20829
20990
|
}
|
|
20830
20991
|
function treeHasFiles(dir) {
|
|
20831
|
-
return
|
|
20992
|
+
return fs18.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path19.join(dir, entry.name)));
|
|
20832
20993
|
}
|
|
20833
20994
|
function copyTree(src, dest) {
|
|
20834
|
-
const entries =
|
|
20835
|
-
|
|
20995
|
+
const entries = fs18.readdirSync(src, { withFileTypes: true });
|
|
20996
|
+
fs18.mkdirSync(dest, { recursive: true });
|
|
20836
20997
|
for (const entry of entries) {
|
|
20837
|
-
const from =
|
|
20838
|
-
const to = resolveLinkedDestination(
|
|
20998
|
+
const from = path19.join(src, entry.name);
|
|
20999
|
+
const to = resolveLinkedDestination(path19.join(dest, entry.name));
|
|
20839
21000
|
if (entry.isDirectory()) copyTree(from, to);
|
|
20840
|
-
else
|
|
21001
|
+
else fs18.copyFileSync(from, to);
|
|
20841
21002
|
}
|
|
20842
21003
|
}
|
|
20843
21004
|
function readRetiredFile(targetDir, relativePath) {
|
|
20844
|
-
const entryPath =
|
|
21005
|
+
const entryPath = path19.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
20845
21006
|
const file = resolveLinkedDestination(entryPath);
|
|
20846
21007
|
try {
|
|
20847
|
-
if (!
|
|
20848
|
-
return
|
|
21008
|
+
if (!fs18.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
21009
|
+
return fs18.readFileSync(file, "utf8");
|
|
20849
21010
|
} catch {
|
|
20850
21011
|
return null;
|
|
20851
21012
|
}
|
|
@@ -20853,7 +21014,7 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
20853
21014
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
20854
21015
|
const found = [];
|
|
20855
21016
|
for (const { path: relativePath, shipped } of retired) {
|
|
20856
|
-
if (bundleDir !== null &&
|
|
21017
|
+
if (bundleDir !== null && fs18.existsSync(path19.join(bundleDir, ...relativePath.split("/"))))
|
|
20857
21018
|
continue;
|
|
20858
21019
|
const content = readRetiredFile(targetDir, relativePath);
|
|
20859
21020
|
if (content === null) continue;
|
|
@@ -20869,17 +21030,17 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
20869
21030
|
const content = readRetiredFile(targetDir, relativePath);
|
|
20870
21031
|
if (content === null || hashBundledContent(content) !== sha256) continue;
|
|
20871
21032
|
const segments = relativePath.split("/");
|
|
20872
|
-
const entryPath =
|
|
21033
|
+
const entryPath = path19.join(dir, ...segments);
|
|
20873
21034
|
const file = resolveLinkedDestination(entryPath);
|
|
20874
21035
|
try {
|
|
20875
|
-
|
|
21036
|
+
fs18.rmSync(file);
|
|
20876
21037
|
if (file !== entryPath) removePath(entryPath);
|
|
20877
21038
|
removedPaths.push(relativePath);
|
|
20878
21039
|
} catch {
|
|
20879
21040
|
continue;
|
|
20880
21041
|
}
|
|
20881
21042
|
for (let depth = segments.length - 1; depth > 0; depth--) {
|
|
20882
|
-
if (!rmEmptyDir(
|
|
21043
|
+
if (!rmEmptyDir(path19.join(dir, ...segments.slice(0, depth)))) break;
|
|
20883
21044
|
}
|
|
20884
21045
|
}
|
|
20885
21046
|
const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
|
|
@@ -20887,15 +21048,15 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
20887
21048
|
}
|
|
20888
21049
|
function dirExists(p) {
|
|
20889
21050
|
try {
|
|
20890
|
-
return
|
|
21051
|
+
return fs18.statSync(p).isDirectory();
|
|
20891
21052
|
} catch {
|
|
20892
21053
|
return false;
|
|
20893
21054
|
}
|
|
20894
21055
|
}
|
|
20895
21056
|
function getInstalledVersion() {
|
|
20896
21057
|
try {
|
|
20897
|
-
const pkgPath =
|
|
20898
|
-
const pkg = JSON.parse(
|
|
21058
|
+
const pkgPath = path19.join(PACKAGE_ROOT, "package.json");
|
|
21059
|
+
const pkg = JSON.parse(fs18.readFileSync(pkgPath, "utf8"));
|
|
20899
21060
|
return pkg.version ?? null;
|
|
20900
21061
|
} catch {
|
|
20901
21062
|
return null;
|
|
@@ -20905,7 +21066,7 @@ var PROBE_TIMEOUT_MS = 3e3;
|
|
|
20905
21066
|
function getLatestVersion() {
|
|
20906
21067
|
const args = ["view", PACKAGE_NAME, "version", "--registry", NPM_REGISTRY];
|
|
20907
21068
|
const opts = { encoding: "utf8", timeout: PROBE_TIMEOUT_MS };
|
|
20908
|
-
const result = process.platform === "win32" ? execSync(["npm", ...args].join(" "), opts) :
|
|
21069
|
+
const result = process.platform === "win32" ? execSync(["npm", ...args].join(" "), opts) : execFileSync4("npm", args, opts);
|
|
20909
21070
|
return result.trim();
|
|
20910
21071
|
}
|
|
20911
21072
|
function isNewerVersion(candidate, current) {
|
|
@@ -20940,12 +21101,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
20940
21101
|
} catch {
|
|
20941
21102
|
return false;
|
|
20942
21103
|
}
|
|
20943
|
-
return new Promise((
|
|
20944
|
-
const timer = setTimeout(() =>
|
|
21104
|
+
return new Promise((resolve22) => {
|
|
21105
|
+
const timer = setTimeout(() => resolve22(false), timeoutMs);
|
|
20945
21106
|
timer.unref();
|
|
20946
21107
|
dns.lookup(host, (err) => {
|
|
20947
21108
|
clearTimeout(timer);
|
|
20948
|
-
|
|
21109
|
+
resolve22(!err);
|
|
20949
21110
|
});
|
|
20950
21111
|
});
|
|
20951
21112
|
}
|
|
@@ -20962,9 +21123,9 @@ function escapeStringRegexp(string) {
|
|
|
20962
21123
|
}
|
|
20963
21124
|
|
|
20964
21125
|
// ../argent-installer/src/mcp-configs.ts
|
|
20965
|
-
var TOOL_SERVER_BUNDLE =
|
|
21126
|
+
var TOOL_SERVER_BUNDLE = path20.join(import.meta.dirname, "tool-server.cjs");
|
|
20966
21127
|
function getAvailableToolIds() {
|
|
20967
|
-
const out =
|
|
21128
|
+
const out = execFileSync5("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
20968
21129
|
const tools = JSON.parse(out);
|
|
20969
21130
|
return tools.map((t2) => t2.id);
|
|
20970
21131
|
}
|
|
@@ -21025,10 +21186,10 @@ function hasCustomizingEnv(entry) {
|
|
|
21025
21186
|
}
|
|
21026
21187
|
function removeDirIfEmpty(dirPath) {
|
|
21027
21188
|
try {
|
|
21028
|
-
if (!
|
|
21029
|
-
if (!
|
|
21030
|
-
if (
|
|
21031
|
-
|
|
21189
|
+
if (!fs19.existsSync(dirPath)) return;
|
|
21190
|
+
if (!fs19.statSync(dirPath).isDirectory()) return;
|
|
21191
|
+
if (fs19.readdirSync(dirPath).length > 0) return;
|
|
21192
|
+
fs19.rmdirSync(dirPath);
|
|
21032
21193
|
} catch {
|
|
21033
21194
|
}
|
|
21034
21195
|
}
|
|
@@ -21066,7 +21227,7 @@ function isArgentManagedEntry(entry) {
|
|
|
21066
21227
|
return args.length === 1 && args[0] === "mcp";
|
|
21067
21228
|
case "node": {
|
|
21068
21229
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
21069
|
-
if (
|
|
21230
|
+
if (path20.isAbsolute(args[0])) return false;
|
|
21070
21231
|
const normalized = args[0].split("\\").join("/");
|
|
21071
21232
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
21072
21233
|
}
|
|
@@ -21080,12 +21241,12 @@ function isArgentManagedEntry(entry) {
|
|
|
21080
21241
|
}
|
|
21081
21242
|
function isPinnedGlobalEntry(entry) {
|
|
21082
21243
|
const [cli, subcommand] = entry.args;
|
|
21083
|
-
return
|
|
21244
|
+
return path20.isAbsolute(entry.command) && path20.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path20.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
|
|
21084
21245
|
}
|
|
21085
21246
|
function writeTomlOrRemove(filePath, data) {
|
|
21086
21247
|
if (Object.keys(data).length === 0) {
|
|
21087
|
-
|
|
21088
|
-
removeDirIfEmpty(
|
|
21248
|
+
fs19.rmSync(filePath, { force: true });
|
|
21249
|
+
removeDirIfEmpty(path20.dirname(filePath));
|
|
21089
21250
|
return;
|
|
21090
21251
|
}
|
|
21091
21252
|
writeToml(filePath, data);
|
|
@@ -21094,12 +21255,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
21094
21255
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
21095
21256
|
}
|
|
21096
21257
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
21097
|
-
return
|
|
21258
|
+
return fs19.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
21098
21259
|
}
|
|
21099
21260
|
function parseJsoncStrict(filePath) {
|
|
21100
21261
|
let raw;
|
|
21101
21262
|
try {
|
|
21102
|
-
raw =
|
|
21263
|
+
raw = fs19.readFileSync(filePath, "utf8");
|
|
21103
21264
|
} catch {
|
|
21104
21265
|
return null;
|
|
21105
21266
|
}
|
|
@@ -21112,14 +21273,14 @@ function parseJsoncStrict(filePath) {
|
|
|
21112
21273
|
}
|
|
21113
21274
|
function parseTomlStrict(filePath) {
|
|
21114
21275
|
try {
|
|
21115
|
-
return parse(
|
|
21276
|
+
return parse(fs19.readFileSync(filePath, "utf8"));
|
|
21116
21277
|
} catch {
|
|
21117
21278
|
return null;
|
|
21118
21279
|
}
|
|
21119
21280
|
}
|
|
21120
21281
|
function parseYamlStrict(filePath) {
|
|
21121
21282
|
try {
|
|
21122
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21283
|
+
const parsed = (0, import_yaml2.parse)(fs19.readFileSync(filePath, "utf8"));
|
|
21123
21284
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
21124
21285
|
return parsed;
|
|
21125
21286
|
} catch {
|
|
@@ -21142,7 +21303,7 @@ function bundledManagedNames(kind) {
|
|
|
21142
21303
|
if (cached2) return cached2;
|
|
21143
21304
|
let names;
|
|
21144
21305
|
try {
|
|
21145
|
-
names = new Set(
|
|
21306
|
+
names = new Set(fs19.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
21146
21307
|
} catch {
|
|
21147
21308
|
names = /* @__PURE__ */ new Set();
|
|
21148
21309
|
}
|
|
@@ -21153,7 +21314,7 @@ function bundledManagedNames(kind) {
|
|
|
21153
21314
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
21154
21315
|
let entries;
|
|
21155
21316
|
try {
|
|
21156
|
-
entries =
|
|
21317
|
+
entries = fs19.readdirSync(dir);
|
|
21157
21318
|
} catch {
|
|
21158
21319
|
return false;
|
|
21159
21320
|
}
|
|
@@ -21165,13 +21326,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
21165
21326
|
function cursorDirLooksArgentOnly(dir) {
|
|
21166
21327
|
let entries;
|
|
21167
21328
|
try {
|
|
21168
|
-
entries =
|
|
21329
|
+
entries = fs19.readdirSync(dir);
|
|
21169
21330
|
} catch {
|
|
21170
21331
|
return false;
|
|
21171
21332
|
}
|
|
21172
21333
|
if (entries.length === 0) return false;
|
|
21173
21334
|
return entries.every((entry) => {
|
|
21174
|
-
const full =
|
|
21335
|
+
const full = path20.join(dir, entry);
|
|
21175
21336
|
if (entry === "mcp.json") {
|
|
21176
21337
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21177
21338
|
}
|
|
@@ -21204,13 +21365,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
21204
21365
|
function claudeDirLooksArgentOnly(dir) {
|
|
21205
21366
|
let entries;
|
|
21206
21367
|
try {
|
|
21207
|
-
entries =
|
|
21368
|
+
entries = fs19.readdirSync(dir);
|
|
21208
21369
|
} catch {
|
|
21209
21370
|
return false;
|
|
21210
21371
|
}
|
|
21211
21372
|
if (entries.length === 0) return false;
|
|
21212
21373
|
return entries.every((entry) => {
|
|
21213
|
-
const full =
|
|
21374
|
+
const full = path20.join(dir, entry);
|
|
21214
21375
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
21215
21376
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
21216
21377
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -21221,25 +21382,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
21221
21382
|
function vscodeDirLooksArgentOnly(dir) {
|
|
21222
21383
|
let entries;
|
|
21223
21384
|
try {
|
|
21224
|
-
entries =
|
|
21385
|
+
entries = fs19.readdirSync(dir);
|
|
21225
21386
|
} catch {
|
|
21226
21387
|
return false;
|
|
21227
21388
|
}
|
|
21228
21389
|
if (entries.length === 0) return false;
|
|
21229
21390
|
return entries.every(
|
|
21230
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21391
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path20.join(dir, entry), "servers")
|
|
21231
21392
|
);
|
|
21232
21393
|
}
|
|
21233
21394
|
function windsurfDirLooksArgentOnly(dir) {
|
|
21234
21395
|
let entries;
|
|
21235
21396
|
try {
|
|
21236
|
-
entries =
|
|
21397
|
+
entries = fs19.readdirSync(dir);
|
|
21237
21398
|
} catch {
|
|
21238
21399
|
return false;
|
|
21239
21400
|
}
|
|
21240
21401
|
if (entries.length === 0) return false;
|
|
21241
21402
|
return entries.every(
|
|
21242
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21403
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path20.join(dir, entry), "mcpServers")
|
|
21243
21404
|
);
|
|
21244
21405
|
}
|
|
21245
21406
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -21270,25 +21431,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21270
21431
|
function zedDirLooksArgentOnly(dir) {
|
|
21271
21432
|
let entries;
|
|
21272
21433
|
try {
|
|
21273
|
-
entries =
|
|
21434
|
+
entries = fs19.readdirSync(dir);
|
|
21274
21435
|
} catch {
|
|
21275
21436
|
return false;
|
|
21276
21437
|
}
|
|
21277
21438
|
if (entries.length === 0) return false;
|
|
21278
21439
|
return entries.every(
|
|
21279
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21440
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path20.join(dir, entry))
|
|
21280
21441
|
);
|
|
21281
21442
|
}
|
|
21282
21443
|
function geminiDirLooksArgentOnly(dir) {
|
|
21283
21444
|
let entries;
|
|
21284
21445
|
try {
|
|
21285
|
-
entries =
|
|
21446
|
+
entries = fs19.readdirSync(dir);
|
|
21286
21447
|
} catch {
|
|
21287
21448
|
return false;
|
|
21288
21449
|
}
|
|
21289
21450
|
if (entries.length === 0) return false;
|
|
21290
21451
|
return entries.every((entry) => {
|
|
21291
|
-
const full =
|
|
21452
|
+
const full = path20.join(dir, entry);
|
|
21292
21453
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21293
21454
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21294
21455
|
return false;
|
|
@@ -21307,48 +21468,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21307
21468
|
function hermesDirLooksArgentOnly(dir) {
|
|
21308
21469
|
let entries;
|
|
21309
21470
|
try {
|
|
21310
|
-
entries =
|
|
21471
|
+
entries = fs19.readdirSync(dir);
|
|
21311
21472
|
} catch {
|
|
21312
21473
|
return false;
|
|
21313
21474
|
}
|
|
21314
21475
|
if (entries.length === 0) return false;
|
|
21315
21476
|
return entries.every(
|
|
21316
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21477
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path20.join(dir, entry))
|
|
21317
21478
|
);
|
|
21318
21479
|
}
|
|
21319
21480
|
function kiroDirLooksArgentOnly(dir) {
|
|
21320
21481
|
let entries;
|
|
21321
21482
|
try {
|
|
21322
|
-
entries =
|
|
21483
|
+
entries = fs19.readdirSync(dir);
|
|
21323
21484
|
} catch {
|
|
21324
21485
|
return false;
|
|
21325
21486
|
}
|
|
21326
21487
|
if (entries.length === 0) return false;
|
|
21327
21488
|
return entries.every((entry) => {
|
|
21328
21489
|
if (entry !== "settings") return false;
|
|
21329
|
-
const settingsDir =
|
|
21490
|
+
const settingsDir = path20.join(dir, entry);
|
|
21330
21491
|
let settingsEntries;
|
|
21331
21492
|
try {
|
|
21332
|
-
settingsEntries =
|
|
21493
|
+
settingsEntries = fs19.readdirSync(settingsDir);
|
|
21333
21494
|
} catch {
|
|
21334
21495
|
return false;
|
|
21335
21496
|
}
|
|
21336
21497
|
if (settingsEntries.length === 0) return false;
|
|
21337
21498
|
return settingsEntries.every(
|
|
21338
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21499
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path20.join(settingsDir, name), "mcpServers")
|
|
21339
21500
|
);
|
|
21340
21501
|
});
|
|
21341
21502
|
}
|
|
21342
21503
|
function codexDirLooksArgentOnly(dir) {
|
|
21343
21504
|
let entries;
|
|
21344
21505
|
try {
|
|
21345
|
-
entries =
|
|
21506
|
+
entries = fs19.readdirSync(dir);
|
|
21346
21507
|
} catch {
|
|
21347
21508
|
return false;
|
|
21348
21509
|
}
|
|
21349
21510
|
if (entries.length === 0) return false;
|
|
21350
21511
|
return entries.every((entry) => {
|
|
21351
|
-
const full =
|
|
21512
|
+
const full = path20.join(dir, entry);
|
|
21352
21513
|
if (entry === "config.toml") {
|
|
21353
21514
|
const config = parseTomlStrict(full);
|
|
21354
21515
|
if (config === null) return false;
|
|
@@ -21373,7 +21534,7 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21373
21534
|
});
|
|
21374
21535
|
}
|
|
21375
21536
|
function cursorPermissionsPath() {
|
|
21376
|
-
return
|
|
21537
|
+
return path20.join(homedir4(), ".cursor", "permissions.json");
|
|
21377
21538
|
}
|
|
21378
21539
|
function cursorPermissionsList() {
|
|
21379
21540
|
const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
|
|
@@ -21382,13 +21543,13 @@ function cursorPermissionsList() {
|
|
|
21382
21543
|
var cursorAdapter = {
|
|
21383
21544
|
name: "Cursor",
|
|
21384
21545
|
detect() {
|
|
21385
|
-
return dirHasEditorEvidence(
|
|
21546
|
+
return dirHasEditorEvidence(path20.join(homedir4(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21386
21547
|
},
|
|
21387
21548
|
projectPath(root) {
|
|
21388
|
-
return
|
|
21549
|
+
return path20.join(root, ".cursor", "mcp.json");
|
|
21389
21550
|
},
|
|
21390
21551
|
globalPath() {
|
|
21391
|
-
return
|
|
21552
|
+
return path20.join(homedir4(), ".cursor", "mcp.json");
|
|
21392
21553
|
},
|
|
21393
21554
|
// Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
|
|
21394
21555
|
// text edits that preserve user comments and foreign servers.
|
|
@@ -21400,7 +21561,7 @@ var cursorAdapter = {
|
|
|
21400
21561
|
});
|
|
21401
21562
|
},
|
|
21402
21563
|
remove(configPath) {
|
|
21403
|
-
if (!
|
|
21564
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21404
21565
|
const config = readJsonc(configPath);
|
|
21405
21566
|
const servers = config.mcpServers;
|
|
21406
21567
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21408,7 +21569,7 @@ var cursorAdapter = {
|
|
|
21408
21569
|
return true;
|
|
21409
21570
|
},
|
|
21410
21571
|
getArgentEntry(configPath) {
|
|
21411
|
-
if (!
|
|
21572
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21412
21573
|
const config = readJsonc(configPath);
|
|
21413
21574
|
const servers = config.mcpServers;
|
|
21414
21575
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21433,7 +21594,7 @@ var cursorAdapter = {
|
|
|
21433
21594
|
removeAllowlist(_root, scope) {
|
|
21434
21595
|
if (scope !== "global") return;
|
|
21435
21596
|
const permPath = cursorPermissionsPath();
|
|
21436
|
-
if (!
|
|
21597
|
+
if (!fs19.existsSync(permPath)) return;
|
|
21437
21598
|
const config = readJsonc(permPath);
|
|
21438
21599
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21439
21600
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21446,7 +21607,7 @@ function claudeProjectKeysForRoot(projects, root) {
|
|
|
21446
21607
|
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21447
21608
|
}
|
|
21448
21609
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21449
|
-
if (!
|
|
21610
|
+
if (!fs19.existsSync(settingsPath)) return null;
|
|
21450
21611
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21451
21612
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21452
21613
|
return {
|
|
@@ -21474,13 +21635,13 @@ var claudeAdapter = {
|
|
|
21474
21635
|
name: "Claude Code",
|
|
21475
21636
|
detect() {
|
|
21476
21637
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21477
|
-
return fileHasEditorEvidence(
|
|
21638
|
+
return fileHasEditorEvidence(path20.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path20.join(homedir4(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(homedir4(), ".claude"), claudeDirLooksArgentOnly);
|
|
21478
21639
|
},
|
|
21479
21640
|
projectPath(root) {
|
|
21480
|
-
return
|
|
21641
|
+
return path20.join(root, ".mcp.json");
|
|
21481
21642
|
},
|
|
21482
21643
|
globalPath() {
|
|
21483
|
-
return
|
|
21644
|
+
return path20.join(homedir4(), ".claude.json");
|
|
21484
21645
|
},
|
|
21485
21646
|
// JSONC is a superset of JSON, so this config shares the one comment- and
|
|
21486
21647
|
// foreign-server-preserving write path (see the Cursor adapter).
|
|
@@ -21493,7 +21654,7 @@ var claudeAdapter = {
|
|
|
21493
21654
|
});
|
|
21494
21655
|
},
|
|
21495
21656
|
remove(configPath) {
|
|
21496
|
-
if (!
|
|
21657
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21497
21658
|
const config = readJsonc(configPath);
|
|
21498
21659
|
const servers = config.mcpServers;
|
|
21499
21660
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21507,7 +21668,7 @@ var claudeAdapter = {
|
|
|
21507
21668
|
return true;
|
|
21508
21669
|
},
|
|
21509
21670
|
getArgentEntry(configPath) {
|
|
21510
|
-
if (!
|
|
21671
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21511
21672
|
const config = readJsonc(configPath);
|
|
21512
21673
|
const servers = config.mcpServers;
|
|
21513
21674
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21520,7 +21681,7 @@ var claudeAdapter = {
|
|
|
21520
21681
|
// .mcp.json rejections (see claudeDisabledListFinding).
|
|
21521
21682
|
findShadowingConfigs(root, writtenScope) {
|
|
21522
21683
|
const findings = [];
|
|
21523
|
-
const claudeJsonPath =
|
|
21684
|
+
const claudeJsonPath = path20.join(homedir4(), ".claude.json");
|
|
21524
21685
|
const projects = readJson(claudeJsonPath).projects;
|
|
21525
21686
|
if (isRecord(projects)) {
|
|
21526
21687
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21557,9 +21718,9 @@ var claudeAdapter = {
|
|
|
21557
21718
|
}
|
|
21558
21719
|
if (writtenScope === "local") {
|
|
21559
21720
|
const candidates = [
|
|
21560
|
-
[
|
|
21561
|
-
[
|
|
21562
|
-
[
|
|
21721
|
+
[path20.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21722
|
+
[path20.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21723
|
+
[path20.join(homedir4(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21563
21724
|
];
|
|
21564
21725
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21565
21726
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21578,10 +21739,10 @@ var claudeAdapter = {
|
|
|
21578
21739
|
var vscodeAdapter = {
|
|
21579
21740
|
name: "VS Code",
|
|
21580
21741
|
detect() {
|
|
21581
|
-
return dirHasEditorEvidence(
|
|
21742
|
+
return dirHasEditorEvidence(path20.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path20.join(homedir4(), ".vscode"));
|
|
21582
21743
|
},
|
|
21583
21744
|
projectPath(root) {
|
|
21584
|
-
return
|
|
21745
|
+
return path20.join(root, ".vscode", "mcp.json");
|
|
21585
21746
|
},
|
|
21586
21747
|
globalPath() {
|
|
21587
21748
|
return null;
|
|
@@ -21597,7 +21758,7 @@ var vscodeAdapter = {
|
|
|
21597
21758
|
});
|
|
21598
21759
|
},
|
|
21599
21760
|
remove(configPath) {
|
|
21600
|
-
if (!
|
|
21761
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21601
21762
|
const config = readJsonc(configPath);
|
|
21602
21763
|
const servers = config.servers;
|
|
21603
21764
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21605,7 +21766,7 @@ var vscodeAdapter = {
|
|
|
21605
21766
|
return true;
|
|
21606
21767
|
},
|
|
21607
21768
|
getArgentEntry(configPath) {
|
|
21608
|
-
if (!
|
|
21769
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21609
21770
|
const config = readJsonc(configPath);
|
|
21610
21771
|
const servers = config.servers;
|
|
21611
21772
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21618,7 +21779,7 @@ var vscodeAdapter = {
|
|
|
21618
21779
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21619
21780
|
const findings = [];
|
|
21620
21781
|
for (const userDir of vscodeUserDirs()) {
|
|
21621
|
-
const configPath =
|
|
21782
|
+
const configPath = path20.join(userDir, "mcp.json");
|
|
21622
21783
|
const entry = this.getArgentEntry(configPath);
|
|
21623
21784
|
if (!entry) continue;
|
|
21624
21785
|
findings.push({
|
|
@@ -21635,16 +21796,16 @@ var vscodeAdapter = {
|
|
|
21635
21796
|
function vscodeUserDirs() {
|
|
21636
21797
|
const bases = [];
|
|
21637
21798
|
if (process.platform === "darwin") {
|
|
21638
|
-
bases.push(
|
|
21799
|
+
bases.push(path20.join(homedir4(), "Library", "Application Support"));
|
|
21639
21800
|
} else if (process.platform === "win32") {
|
|
21640
21801
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21641
21802
|
} else {
|
|
21642
|
-
bases.push(
|
|
21803
|
+
bases.push(path20.join(homedir4(), ".config"));
|
|
21643
21804
|
}
|
|
21644
21805
|
const dirs = [];
|
|
21645
21806
|
for (const base of bases) {
|
|
21646
21807
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21647
|
-
const dir =
|
|
21808
|
+
const dir = path20.join(base, product, "User");
|
|
21648
21809
|
if (dirExists(dir)) dirs.push(dir);
|
|
21649
21810
|
}
|
|
21650
21811
|
}
|
|
@@ -21652,18 +21813,18 @@ function vscodeUserDirs() {
|
|
|
21652
21813
|
}
|
|
21653
21814
|
function devinUserConfigPath() {
|
|
21654
21815
|
if (process.platform === "win32") {
|
|
21655
|
-
const appData = process.env.APPDATA ||
|
|
21656
|
-
return
|
|
21816
|
+
const appData = process.env.APPDATA || path20.join(homedir4(), "AppData", "Roaming");
|
|
21817
|
+
return path20.join(appData, "devin", "config.json");
|
|
21657
21818
|
}
|
|
21658
21819
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
21659
|
-
return
|
|
21820
|
+
return path20.join(xdg || path20.join(homedir4(), ".config"), "devin", "config.json");
|
|
21660
21821
|
}
|
|
21661
21822
|
var windsurfAdapter = {
|
|
21662
21823
|
name: "Devin Desktop",
|
|
21663
21824
|
telemetryName: "windsurf",
|
|
21664
21825
|
detect() {
|
|
21665
21826
|
return dirHasEditorEvidence(
|
|
21666
|
-
|
|
21827
|
+
path20.join(homedir4(), ".codeium", "windsurf"),
|
|
21667
21828
|
windsurfDirLooksArgentOnly
|
|
21668
21829
|
);
|
|
21669
21830
|
},
|
|
@@ -21671,7 +21832,7 @@ var windsurfAdapter = {
|
|
|
21671
21832
|
return null;
|
|
21672
21833
|
},
|
|
21673
21834
|
globalPath() {
|
|
21674
|
-
return
|
|
21835
|
+
return path20.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21675
21836
|
},
|
|
21676
21837
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21677
21838
|
write(configPath, entry) {
|
|
@@ -21683,7 +21844,7 @@ var windsurfAdapter = {
|
|
|
21683
21844
|
});
|
|
21684
21845
|
},
|
|
21685
21846
|
remove(configPath) {
|
|
21686
|
-
if (!
|
|
21847
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21687
21848
|
const config = readJsonc(configPath);
|
|
21688
21849
|
const servers = config.mcpServers;
|
|
21689
21850
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21691,7 +21852,7 @@ var windsurfAdapter = {
|
|
|
21691
21852
|
return true;
|
|
21692
21853
|
},
|
|
21693
21854
|
getArgentEntry(configPath) {
|
|
21694
|
-
if (!
|
|
21855
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21695
21856
|
const config = readJsonc(configPath);
|
|
21696
21857
|
const servers = config.mcpServers;
|
|
21697
21858
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21703,7 +21864,7 @@ var windsurfAdapter = {
|
|
|
21703
21864
|
// servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
|
|
21704
21865
|
// agent needs its own permission rule.
|
|
21705
21866
|
addAllowlist() {
|
|
21706
|
-
const configPath =
|
|
21867
|
+
const configPath = path20.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21707
21868
|
const config = readJsonc(configPath);
|
|
21708
21869
|
const servers = config.mcpServers;
|
|
21709
21870
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21713,8 +21874,8 @@ var windsurfAdapter = {
|
|
|
21713
21874
|
removeAllowlist(_root, scope) {
|
|
21714
21875
|
if (scope !== "global") return;
|
|
21715
21876
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21716
|
-
const configPath =
|
|
21717
|
-
if (!
|
|
21877
|
+
const configPath = path20.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21878
|
+
if (!fs19.existsSync(configPath)) return;
|
|
21718
21879
|
const config = readJsonc(configPath);
|
|
21719
21880
|
const servers = config.mcpServers;
|
|
21720
21881
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21725,13 +21886,13 @@ var windsurfAdapter = {
|
|
|
21725
21886
|
var zedAdapter = {
|
|
21726
21887
|
name: "Zed",
|
|
21727
21888
|
detect() {
|
|
21728
|
-
return dirHasEditorEvidence(
|
|
21889
|
+
return dirHasEditorEvidence(path20.join(homedir4(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21729
21890
|
},
|
|
21730
21891
|
projectPath(root) {
|
|
21731
|
-
return
|
|
21892
|
+
return path20.join(root, ".zed", "settings.json");
|
|
21732
21893
|
},
|
|
21733
21894
|
globalPath() {
|
|
21734
|
-
return
|
|
21895
|
+
return path20.join(homedir4(), ".config", "zed", "settings.json");
|
|
21735
21896
|
},
|
|
21736
21897
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21737
21898
|
// formatting outside the touched key survive (see the Cursor adapter).
|
|
@@ -21744,7 +21905,7 @@ var zedAdapter = {
|
|
|
21744
21905
|
});
|
|
21745
21906
|
},
|
|
21746
21907
|
remove(configPath) {
|
|
21747
|
-
if (!
|
|
21908
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21748
21909
|
const config = readJsonc(configPath);
|
|
21749
21910
|
const servers = config.context_servers;
|
|
21750
21911
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21752,7 +21913,7 @@ var zedAdapter = {
|
|
|
21752
21913
|
return true;
|
|
21753
21914
|
},
|
|
21754
21915
|
getArgentEntry(configPath) {
|
|
21755
|
-
if (!
|
|
21916
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21756
21917
|
const config = readJsonc(configPath);
|
|
21757
21918
|
const servers = config.context_servers;
|
|
21758
21919
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21763,12 +21924,12 @@ var zedAdapter = {
|
|
|
21763
21924
|
// Zed has no server-level wildcard for MCP tools — each tool would need its
|
|
21764
21925
|
// own entry — so the global default is set to "allow" instead.
|
|
21765
21926
|
addAllowlist(root, scope) {
|
|
21766
|
-
const settingsPath = scope === "global" ?
|
|
21927
|
+
const settingsPath = scope === "global" ? path20.join(homedir4(), ".config", "zed", "settings.json") : path20.join(root, ".zed", "settings.json");
|
|
21767
21928
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21768
21929
|
},
|
|
21769
21930
|
removeAllowlist(root, scope) {
|
|
21770
|
-
const settingsPath = scope === "global" ?
|
|
21771
|
-
if (!
|
|
21931
|
+
const settingsPath = scope === "global" ? path20.join(homedir4(), ".config", "zed", "settings.json") : path20.join(root, ".zed", "settings.json");
|
|
21932
|
+
if (!fs19.existsSync(settingsPath)) return;
|
|
21772
21933
|
const config = readJsonc(settingsPath);
|
|
21773
21934
|
const perms = config.agent?.tool_permissions;
|
|
21774
21935
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21778,13 +21939,13 @@ var zedAdapter = {
|
|
|
21778
21939
|
var geminiAdapter = {
|
|
21779
21940
|
name: "Gemini",
|
|
21780
21941
|
detect() {
|
|
21781
|
-
return dirHasEditorEvidence(
|
|
21942
|
+
return dirHasEditorEvidence(path20.join(homedir4(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21782
21943
|
},
|
|
21783
21944
|
projectPath(root) {
|
|
21784
|
-
return
|
|
21945
|
+
return path20.join(root, ".gemini", "settings.json");
|
|
21785
21946
|
},
|
|
21786
21947
|
globalPath() {
|
|
21787
|
-
return
|
|
21948
|
+
return path20.join(homedir4(), ".gemini", "settings.json");
|
|
21788
21949
|
},
|
|
21789
21950
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21790
21951
|
write(configPath, entry) {
|
|
@@ -21796,7 +21957,7 @@ var geminiAdapter = {
|
|
|
21796
21957
|
});
|
|
21797
21958
|
},
|
|
21798
21959
|
remove(configPath) {
|
|
21799
|
-
if (!
|
|
21960
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21800
21961
|
const config = readJsonc(configPath);
|
|
21801
21962
|
const servers = config.mcpServers;
|
|
21802
21963
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21804,7 +21965,7 @@ var geminiAdapter = {
|
|
|
21804
21965
|
return true;
|
|
21805
21966
|
},
|
|
21806
21967
|
getArgentEntry(configPath) {
|
|
21807
|
-
if (!
|
|
21968
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21808
21969
|
const config = readJsonc(configPath);
|
|
21809
21970
|
const servers = config.mcpServers;
|
|
21810
21971
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21826,7 +21987,7 @@ var geminiAdapter = {
|
|
|
21826
21987
|
},
|
|
21827
21988
|
removeAllowlist(root, scope) {
|
|
21828
21989
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21829
|
-
if (!configPath || !
|
|
21990
|
+
if (!configPath || !fs19.existsSync(configPath)) {
|
|
21830
21991
|
return;
|
|
21831
21992
|
}
|
|
21832
21993
|
const config = readJsonc(configPath);
|
|
@@ -21840,13 +22001,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
21840
22001
|
var codexAdapter = {
|
|
21841
22002
|
name: "Codex",
|
|
21842
22003
|
detect() {
|
|
21843
|
-
return dirHasEditorEvidence(
|
|
22004
|
+
return dirHasEditorEvidence(path20.join(homedir4(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21844
22005
|
},
|
|
21845
22006
|
projectPath(root) {
|
|
21846
|
-
return
|
|
22007
|
+
return path20.join(root, CODEX_FILENAME, "config.toml");
|
|
21847
22008
|
},
|
|
21848
22009
|
globalPath() {
|
|
21849
|
-
return
|
|
22010
|
+
return path20.join(homedir4(), CODEX_FILENAME, "config.toml");
|
|
21850
22011
|
},
|
|
21851
22012
|
write(configPath, entry) {
|
|
21852
22013
|
const config = readToml(configPath);
|
|
@@ -21862,7 +22023,7 @@ var codexAdapter = {
|
|
|
21862
22023
|
writeToml(configPath, config);
|
|
21863
22024
|
},
|
|
21864
22025
|
remove(configPath) {
|
|
21865
|
-
if (!
|
|
22026
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21866
22027
|
const config = readToml(configPath);
|
|
21867
22028
|
const servers = config.mcp_servers;
|
|
21868
22029
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21872,7 +22033,7 @@ var codexAdapter = {
|
|
|
21872
22033
|
return true;
|
|
21873
22034
|
},
|
|
21874
22035
|
getArgentEntry(configPath) {
|
|
21875
|
-
if (!
|
|
22036
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21876
22037
|
const config = readToml(configPath);
|
|
21877
22038
|
const servers = config.mcp_servers;
|
|
21878
22039
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21904,7 +22065,7 @@ var codexAdapter = {
|
|
|
21904
22065
|
// them, and an emptied or removed table stays as it is.
|
|
21905
22066
|
refreshAllowlist(root, scope) {
|
|
21906
22067
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21907
|
-
if (!configPath || !
|
|
22068
|
+
if (!configPath || !fs19.existsSync(configPath)) return;
|
|
21908
22069
|
const config = readToml(configPath);
|
|
21909
22070
|
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
21910
22071
|
if (!toolsConfig) return;
|
|
@@ -21941,13 +22102,13 @@ var codexAdapter = {
|
|
|
21941
22102
|
var hermesAdapter = {
|
|
21942
22103
|
name: "Hermes",
|
|
21943
22104
|
detect() {
|
|
21944
|
-
return dirHasEditorEvidence(
|
|
22105
|
+
return dirHasEditorEvidence(path20.join(homedir4(), ".hermes"), hermesDirLooksArgentOnly);
|
|
21945
22106
|
},
|
|
21946
22107
|
projectPath() {
|
|
21947
22108
|
return null;
|
|
21948
22109
|
},
|
|
21949
22110
|
globalPath() {
|
|
21950
|
-
return
|
|
22111
|
+
return path20.join(homedir4(), ".hermes", "config.yaml");
|
|
21951
22112
|
},
|
|
21952
22113
|
write(configPath, entry) {
|
|
21953
22114
|
const doc = readYaml(configPath);
|
|
@@ -21966,7 +22127,7 @@ var hermesAdapter = {
|
|
|
21966
22127
|
writeYaml(configPath, doc);
|
|
21967
22128
|
},
|
|
21968
22129
|
remove(configPath) {
|
|
21969
|
-
if (!
|
|
22130
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21970
22131
|
const doc = readYaml(configPath);
|
|
21971
22132
|
const servers = doc.get("mcp_servers");
|
|
21972
22133
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -21979,7 +22140,7 @@ var hermesAdapter = {
|
|
|
21979
22140
|
return true;
|
|
21980
22141
|
},
|
|
21981
22142
|
getArgentEntry(configPath) {
|
|
21982
|
-
if (!
|
|
22143
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21983
22144
|
const doc = readYaml(configPath);
|
|
21984
22145
|
const servers = doc.get("mcp_servers");
|
|
21985
22146
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -21998,7 +22159,7 @@ var OPENCODE_GLOBAL_FILES = ["opencode.jsonc", "opencode.json", "config.json"];
|
|
|
21998
22159
|
function hasOpenCodeBinary() {
|
|
21999
22160
|
try {
|
|
22000
22161
|
const cmd = process.platform === "win32" ? "where" : "which";
|
|
22001
|
-
|
|
22162
|
+
execFileSync5(cmd, [OPENCODE_BINARY], { stdio: ["ignore", "ignore", "ignore"] });
|
|
22002
22163
|
return true;
|
|
22003
22164
|
} catch {
|
|
22004
22165
|
return false;
|
|
@@ -22006,10 +22167,10 @@ function hasOpenCodeBinary() {
|
|
|
22006
22167
|
}
|
|
22007
22168
|
function pickOpencodeConfig(dir, candidates) {
|
|
22008
22169
|
for (const name of candidates) {
|
|
22009
|
-
const candidate =
|
|
22010
|
-
if (
|
|
22170
|
+
const candidate = path20.join(dir, name);
|
|
22171
|
+
if (fs19.existsSync(candidate)) return candidate;
|
|
22011
22172
|
}
|
|
22012
|
-
return
|
|
22173
|
+
return path20.join(dir, "opencode.json");
|
|
22013
22174
|
}
|
|
22014
22175
|
var openCodeAdapter = {
|
|
22015
22176
|
name: "opencode",
|
|
@@ -22020,7 +22181,7 @@ var openCodeAdapter = {
|
|
|
22020
22181
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
22021
22182
|
},
|
|
22022
22183
|
globalPath() {
|
|
22023
|
-
return pickOpencodeConfig(
|
|
22184
|
+
return pickOpencodeConfig(path20.join(homedir4(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
22024
22185
|
},
|
|
22025
22186
|
write(configPath, entry) {
|
|
22026
22187
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -22031,7 +22192,7 @@ var openCodeAdapter = {
|
|
|
22031
22192
|
});
|
|
22032
22193
|
},
|
|
22033
22194
|
remove(configPath) {
|
|
22034
|
-
if (!
|
|
22195
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22035
22196
|
const config = readJsonc(configPath);
|
|
22036
22197
|
const servers = config.mcp;
|
|
22037
22198
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22039,7 +22200,7 @@ var openCodeAdapter = {
|
|
|
22039
22200
|
return true;
|
|
22040
22201
|
},
|
|
22041
22202
|
getArgentEntry(configPath) {
|
|
22042
|
-
if (!
|
|
22203
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
22043
22204
|
const config = readJsonc(configPath);
|
|
22044
22205
|
const servers = config.mcp;
|
|
22045
22206
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22054,7 +22215,7 @@ var openCodeAdapter = {
|
|
|
22054
22215
|
},
|
|
22055
22216
|
removeAllowlist(root, scope) {
|
|
22056
22217
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22057
|
-
if (!configPath || !
|
|
22218
|
+
if (!configPath || !fs19.existsSync(configPath)) return;
|
|
22058
22219
|
const config = readJsonc(configPath);
|
|
22059
22220
|
const tools = config.tools;
|
|
22060
22221
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -22065,13 +22226,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
22065
22226
|
var kiroAdapter = {
|
|
22066
22227
|
name: "Kiro",
|
|
22067
22228
|
detect() {
|
|
22068
|
-
return dirHasEditorEvidence(
|
|
22229
|
+
return dirHasEditorEvidence(path20.join(homedir4(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path20.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
22069
22230
|
},
|
|
22070
22231
|
projectPath(root) {
|
|
22071
|
-
return
|
|
22232
|
+
return path20.join(root, ".kiro", "settings", "mcp.json");
|
|
22072
22233
|
},
|
|
22073
22234
|
globalPath() {
|
|
22074
|
-
return
|
|
22235
|
+
return path20.join(homedir4(), ".kiro", "settings", "mcp.json");
|
|
22075
22236
|
},
|
|
22076
22237
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
22077
22238
|
// foreign servers survive (see the Cursor adapter).
|
|
@@ -22084,7 +22245,7 @@ var kiroAdapter = {
|
|
|
22084
22245
|
});
|
|
22085
22246
|
},
|
|
22086
22247
|
remove(configPath) {
|
|
22087
|
-
if (!
|
|
22248
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22088
22249
|
const config = readJsonc(configPath);
|
|
22089
22250
|
const servers = config.mcpServers;
|
|
22090
22251
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22092,7 +22253,7 @@ var kiroAdapter = {
|
|
|
22092
22253
|
return true;
|
|
22093
22254
|
},
|
|
22094
22255
|
getArgentEntry(configPath) {
|
|
22095
|
-
if (!
|
|
22256
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
22096
22257
|
const config = readJsonc(configPath);
|
|
22097
22258
|
const servers = config.mcpServers;
|
|
22098
22259
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22116,7 +22277,7 @@ var kiroAdapter = {
|
|
|
22116
22277
|
},
|
|
22117
22278
|
removeAllowlist(root, scope) {
|
|
22118
22279
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22119
|
-
if (!configPath || !
|
|
22280
|
+
if (!configPath || !fs19.existsSync(configPath)) return;
|
|
22120
22281
|
const config = readJsonc(configPath);
|
|
22121
22282
|
const servers = config.mcpServers;
|
|
22122
22283
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -22168,7 +22329,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
22168
22329
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
22169
22330
|
}
|
|
22170
22331
|
function removeAllowRule(settingsPath, rule) {
|
|
22171
|
-
if (!
|
|
22332
|
+
if (!fs19.existsSync(settingsPath)) return;
|
|
22172
22333
|
const config = readJsonc(settingsPath);
|
|
22173
22334
|
const permissions = config?.permissions;
|
|
22174
22335
|
const allow = permissions?.allow;
|
|
@@ -22178,7 +22339,7 @@ function removeAllowRule(settingsPath, rule) {
|
|
|
22178
22339
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
22179
22340
|
}
|
|
22180
22341
|
function claudeSettingsPath(root, scope) {
|
|
22181
|
-
return scope === "global" ?
|
|
22342
|
+
return scope === "global" ? path20.join(homedir4(), ".claude", "settings.json") : path20.join(root, ".claude", "settings.json");
|
|
22182
22343
|
}
|
|
22183
22344
|
function addClaudePermission(root, scope) {
|
|
22184
22345
|
addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
@@ -22191,13 +22352,13 @@ function formatCopyDestination(target, writtenPath, root) {
|
|
|
22191
22352
|
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
22192
22353
|
}
|
|
22193
22354
|
function formatManagedPathLabel(targetPath, root) {
|
|
22194
|
-
for (const home of [
|
|
22195
|
-
if (targetPath === home || targetPath.startsWith(`${home}${
|
|
22355
|
+
for (const home of [path20.resolve(homedir4()), canonicalPath(homedir4())]) {
|
|
22356
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path20.sep}`)) {
|
|
22196
22357
|
return `~${targetPath.slice(home.length)}`;
|
|
22197
22358
|
}
|
|
22198
22359
|
}
|
|
22199
|
-
const relative5 =
|
|
22200
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22360
|
+
const relative5 = path20.relative(root, targetPath);
|
|
22361
|
+
if (relative5 && !relative5.startsWith("..") && !path20.isAbsolute(relative5)) {
|
|
22201
22362
|
return relative5;
|
|
22202
22363
|
}
|
|
22203
22364
|
return targetPath;
|
|
@@ -22211,7 +22372,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
22211
22372
|
}
|
|
22212
22373
|
function getAdapterBasePath(adapter, root, scope) {
|
|
22213
22374
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
22214
|
-
return configPath ?
|
|
22375
|
+
return configPath ? path20.dirname(configPath) : null;
|
|
22215
22376
|
}
|
|
22216
22377
|
function getManagedContentTargets(adapters, root, scope) {
|
|
22217
22378
|
const targets = {
|
|
@@ -22221,17 +22382,17 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22221
22382
|
codexConfigTargets: [],
|
|
22222
22383
|
skillsLockTargets: []
|
|
22223
22384
|
};
|
|
22224
|
-
const workspaceBase = scope === "global" ?
|
|
22385
|
+
const workspaceBase = scope === "global" ? homedir4() : root;
|
|
22225
22386
|
addManagedTarget(
|
|
22226
22387
|
targets.skillTargets,
|
|
22227
22388
|
"skills",
|
|
22228
|
-
|
|
22389
|
+
path20.join(workspaceBase, ".agents", "skills"),
|
|
22229
22390
|
root
|
|
22230
22391
|
);
|
|
22231
22392
|
addManagedTarget(
|
|
22232
22393
|
targets.skillsLockTargets,
|
|
22233
22394
|
"skills",
|
|
22234
|
-
|
|
22395
|
+
path20.join(workspaceBase, "skills-lock.json"),
|
|
22235
22396
|
root
|
|
22236
22397
|
);
|
|
22237
22398
|
for (const adapter of adapters) {
|
|
@@ -22239,21 +22400,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22239
22400
|
case "Cursor": {
|
|
22240
22401
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
22241
22402
|
if (!base) break;
|
|
22242
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22243
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22403
|
+
addManagedTarget(targets.skillTargets, adapter.name, path20.join(base, "skills"), root);
|
|
22404
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path20.join(base, "rules"), root);
|
|
22244
22405
|
break;
|
|
22245
22406
|
}
|
|
22246
22407
|
case "Claude Code": {
|
|
22247
|
-
const claudeBase = scope === "global" ?
|
|
22248
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22249
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22250
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22408
|
+
const claudeBase = scope === "global" ? path20.join(homedir4(), ".claude") : path20.join(root, ".claude");
|
|
22409
|
+
addManagedTarget(targets.skillTargets, adapter.name, path20.join(claudeBase, "skills"), root);
|
|
22410
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path20.join(claudeBase, "rules"), root);
|
|
22411
|
+
addManagedTarget(targets.agentTargets, adapter.name, path20.join(claudeBase, "agents"), root);
|
|
22251
22412
|
break;
|
|
22252
22413
|
}
|
|
22253
22414
|
case "Gemini": {
|
|
22254
|
-
const geminiBase = scope === "global" ?
|
|
22255
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22256
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22415
|
+
const geminiBase = scope === "global" ? path20.join(homedir4(), ".gemini") : path20.join(root, ".gemini");
|
|
22416
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path20.join(geminiBase, "rules"), root);
|
|
22417
|
+
addManagedTarget(targets.agentTargets, adapter.name, path20.join(geminiBase, "agents"), root);
|
|
22257
22418
|
break;
|
|
22258
22419
|
}
|
|
22259
22420
|
case "Codex": {
|
|
@@ -22263,19 +22424,19 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22263
22424
|
break;
|
|
22264
22425
|
}
|
|
22265
22426
|
case "opencode": {
|
|
22266
|
-
const base = scope === "global" ?
|
|
22267
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22268
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22427
|
+
const base = scope === "global" ? path20.join(homedir4(), ".config", "opencode") : path20.join(root, ".opencode");
|
|
22428
|
+
addManagedTarget(targets.skillTargets, adapter.name, path20.join(base, "skills"), root);
|
|
22429
|
+
addManagedTarget(targets.agentTargets, adapter.name, path20.join(base, "agents"), root);
|
|
22269
22430
|
break;
|
|
22270
22431
|
}
|
|
22271
22432
|
case "Kiro": {
|
|
22272
|
-
const kiroBase = scope === "global" ?
|
|
22273
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22433
|
+
const kiroBase = scope === "global" ? path20.join(homedir4(), ".kiro") : path20.join(root, ".kiro");
|
|
22434
|
+
addManagedTarget(targets.skillTargets, adapter.name, path20.join(kiroBase, "skills"), root);
|
|
22274
22435
|
break;
|
|
22275
22436
|
}
|
|
22276
22437
|
case "Devin Desktop": {
|
|
22277
|
-
const devinBase = scope === "global" ?
|
|
22278
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22438
|
+
const devinBase = scope === "global" ? path20.join(process.env.XDG_CONFIG_HOME || path20.join(homedir4(), ".config"), "devin") : path20.join(root, ".devin");
|
|
22439
|
+
addManagedTarget(targets.skillTargets, adapter.name, path20.join(devinBase, "skills"), root);
|
|
22279
22440
|
break;
|
|
22280
22441
|
}
|
|
22281
22442
|
}
|
|
@@ -22289,12 +22450,12 @@ function stripFrontmatter(content) {
|
|
|
22289
22450
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22290
22451
|
}
|
|
22291
22452
|
function readAndConcatRules(rulesDir) {
|
|
22292
|
-
if (!
|
|
22293
|
-
const files =
|
|
22453
|
+
if (!fs19.existsSync(rulesDir)) return null;
|
|
22454
|
+
const files = fs19.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22294
22455
|
if (files.length === 0) return null;
|
|
22295
22456
|
const parts = [];
|
|
22296
22457
|
for (const file of files) {
|
|
22297
|
-
const raw =
|
|
22458
|
+
const raw = fs19.readFileSync(path20.join(rulesDir, file), "utf8");
|
|
22298
22459
|
const stripped = stripFrontmatter(raw);
|
|
22299
22460
|
if (stripped) parts.push(stripped);
|
|
22300
22461
|
}
|
|
@@ -22329,7 +22490,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22329
22490
|
return configPath;
|
|
22330
22491
|
}
|
|
22331
22492
|
function removeCodexRules(configPath) {
|
|
22332
|
-
if (!
|
|
22493
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22333
22494
|
const config = readToml(configPath);
|
|
22334
22495
|
const existing = config.developer_instructions;
|
|
22335
22496
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22421,10 +22582,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22421
22582
|
}
|
|
22422
22583
|
|
|
22423
22584
|
// ../argent-installer/src/retired-files.ts
|
|
22424
|
-
import * as
|
|
22585
|
+
import * as path21 from "node:path";
|
|
22425
22586
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
22426
22587
|
function displayPath(entry, file) {
|
|
22427
|
-
return
|
|
22588
|
+
return path21.join(entry.location, ...file.relativePath.split("/"));
|
|
22428
22589
|
}
|
|
22429
22590
|
async function cleanupRetiredFiles(found, options) {
|
|
22430
22591
|
const result = { removed: [], declined: [], failed: [], removedRoots: [] };
|
|
@@ -22475,14 +22636,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22475
22636
|
|
|
22476
22637
|
// ../argent-installer/src/cli-record.ts
|
|
22477
22638
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22478
|
-
import * as
|
|
22479
|
-
import * as
|
|
22639
|
+
import * as fs20 from "node:fs";
|
|
22640
|
+
import * as path22 from "node:path";
|
|
22480
22641
|
function cliRecordPath() {
|
|
22481
|
-
return
|
|
22642
|
+
return path22.join(argentHomeDir(), "cli.json");
|
|
22482
22643
|
}
|
|
22483
22644
|
function readCliRecord() {
|
|
22484
22645
|
try {
|
|
22485
|
-
const parsed = JSON.parse(
|
|
22646
|
+
const parsed = JSON.parse(fs20.readFileSync(cliRecordPath(), "utf8"));
|
|
22486
22647
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22487
22648
|
return null;
|
|
22488
22649
|
} catch {
|
|
@@ -22492,7 +22653,7 @@ function readCliRecord() {
|
|
|
22492
22653
|
function resolveCliEntry(mode, projectRoot) {
|
|
22493
22654
|
if (mode === "local") {
|
|
22494
22655
|
const relative5 = getLocalArgentBinRelPath(projectRoot);
|
|
22495
|
-
return relative5 ?
|
|
22656
|
+
return relative5 ? path22.resolve(projectRoot, relative5) : null;
|
|
22496
22657
|
}
|
|
22497
22658
|
const packageRoot = getGloballyInstalledPackageRoot();
|
|
22498
22659
|
return packageRoot ? cliPathOf(packageRoot) : null;
|
|
@@ -22511,10 +22672,10 @@ function writeCliRecord(input) {
|
|
|
22511
22672
|
function persistCliRecord(record) {
|
|
22512
22673
|
const file = cliRecordPath();
|
|
22513
22674
|
try {
|
|
22514
|
-
|
|
22675
|
+
fs20.mkdirSync(path22.dirname(file), { recursive: true });
|
|
22515
22676
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
22516
|
-
|
|
22517
|
-
|
|
22677
|
+
fs20.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22678
|
+
fs20.renameSync(temporary, file);
|
|
22518
22679
|
return file;
|
|
22519
22680
|
} catch {
|
|
22520
22681
|
return null;
|
|
@@ -22522,10 +22683,10 @@ function persistCliRecord(record) {
|
|
|
22522
22683
|
}
|
|
22523
22684
|
function healCliRecord(input) {
|
|
22524
22685
|
try {
|
|
22525
|
-
if (!
|
|
22686
|
+
if (!fs20.existsSync(input.cli)) return null;
|
|
22526
22687
|
const existing = readCliRecord();
|
|
22527
22688
|
if (existing) {
|
|
22528
|
-
const alive =
|
|
22689
|
+
const alive = fs20.existsSync(existing.node) && fs20.existsSync(existing.cli);
|
|
22529
22690
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22530
22691
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22531
22692
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22546,11 +22707,11 @@ function removeCliRecordFor(installDir) {
|
|
|
22546
22707
|
if (!installDir) return false;
|
|
22547
22708
|
const record = readCliRecord();
|
|
22548
22709
|
if (!record) return false;
|
|
22549
|
-
const root =
|
|
22550
|
-
const relative5 =
|
|
22551
|
-
if (relative5.startsWith("..") ||
|
|
22710
|
+
const root = path22.resolve(installDir);
|
|
22711
|
+
const relative5 = path22.relative(root, path22.resolve(record.cli));
|
|
22712
|
+
if (relative5.startsWith("..") || path22.isAbsolute(relative5)) return false;
|
|
22552
22713
|
try {
|
|
22553
|
-
|
|
22714
|
+
fs20.rmSync(cliRecordPath(), { force: true });
|
|
22554
22715
|
return true;
|
|
22555
22716
|
} catch {
|
|
22556
22717
|
return false;
|
|
@@ -22573,7 +22734,7 @@ function printFirstRunNotice() {
|
|
|
22573
22734
|
markFirstRunNoticeShown();
|
|
22574
22735
|
}
|
|
22575
22736
|
function seedWhatsNewVersion(version) {
|
|
22576
|
-
if (getWhatsNewSeenVersion() === null) setWhatsNewSeenVersion(version);
|
|
22737
|
+
if (getWhatsNewSeenVersion() === null) setWhatsNewSeenVersion(version, { ifSeen: null });
|
|
22577
22738
|
}
|
|
22578
22739
|
async function resolveTelemetryConsent(opts) {
|
|
22579
22740
|
if (opts.disableFlag) {
|
|
@@ -22586,9 +22747,11 @@ async function resolveTelemetryConsent(opts) {
|
|
|
22586
22747
|
printFirstRunNotice();
|
|
22587
22748
|
return { kind: "skipped" };
|
|
22588
22749
|
}
|
|
22589
|
-
const
|
|
22750
|
+
const state2 = getConsentState();
|
|
22751
|
+
const source = state2.source.source;
|
|
22590
22752
|
const envOwnsDecision = source === "env_do_not_track" || source === "env_argent_telemetry";
|
|
22591
|
-
|
|
22753
|
+
const configOptedOut = source === "config_file" && !state2.enabled;
|
|
22754
|
+
if (envOwnsDecision || configOptedOut || hasShownFirstRunNotice()) {
|
|
22592
22755
|
return { kind: "skipped" };
|
|
22593
22756
|
}
|
|
22594
22757
|
log.info(
|
|
@@ -22774,11 +22937,11 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22774
22937
|
|
|
22775
22938
|
// ../argent-installer/src/install-runner.ts
|
|
22776
22939
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22777
|
-
import * as
|
|
22778
|
-
import * as
|
|
22940
|
+
import * as fs23 from "node:fs";
|
|
22941
|
+
import * as path25 from "node:path";
|
|
22779
22942
|
|
|
22780
22943
|
// ../argent-installer/src/shell.ts
|
|
22781
|
-
import { execFileSync as
|
|
22944
|
+
import { execFileSync as execFileSync6, spawn as spawn2 } from "node:child_process";
|
|
22782
22945
|
async function runTrustingDisk(execute, landedOnDisk) {
|
|
22783
22946
|
let exitError = null;
|
|
22784
22947
|
try {
|
|
@@ -22789,7 +22952,7 @@ async function runTrustingDisk(execute, landedOnDisk) {
|
|
|
22789
22952
|
return { landed: landedOnDisk(), exitError };
|
|
22790
22953
|
}
|
|
22791
22954
|
function execShellCommandSync(cmd, opts = {}) {
|
|
22792
|
-
|
|
22955
|
+
execFileSync6(cmd.bin, cmd.args, {
|
|
22793
22956
|
stdio: "inherit",
|
|
22794
22957
|
shell: process.platform === "win32",
|
|
22795
22958
|
...opts.cwd ? { cwd: opts.cwd } : {},
|
|
@@ -22807,7 +22970,7 @@ var ShellCommandError = class extends Error {
|
|
|
22807
22970
|
signal;
|
|
22808
22971
|
};
|
|
22809
22972
|
function runShellCommand(cmd, opts = {}) {
|
|
22810
|
-
return new Promise((
|
|
22973
|
+
return new Promise((resolve22, reject) => {
|
|
22811
22974
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22812
22975
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22813
22976
|
shell: process.platform === "win32",
|
|
@@ -22823,7 +22986,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22823
22986
|
stderr += chunk.toString();
|
|
22824
22987
|
});
|
|
22825
22988
|
child.on("close", (code, signal) => {
|
|
22826
|
-
if (code === 0)
|
|
22989
|
+
if (code === 0) resolve22();
|
|
22827
22990
|
else
|
|
22828
22991
|
reject(
|
|
22829
22992
|
new ShellCommandError(
|
|
@@ -22838,34 +23001,34 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22838
23001
|
}
|
|
22839
23002
|
|
|
22840
23003
|
// ../argent-installer/src/skills.ts
|
|
22841
|
-
import { execFileSync as
|
|
22842
|
-
import * as
|
|
22843
|
-
import * as
|
|
23004
|
+
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
23005
|
+
import * as fs22 from "node:fs";
|
|
23006
|
+
import * as path24 from "node:path";
|
|
22844
23007
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
22845
23008
|
|
|
22846
23009
|
// ../argent-installer/src/skills-runner.ts
|
|
22847
|
-
import { execFileSync as
|
|
22848
|
-
import * as
|
|
22849
|
-
import * as
|
|
23010
|
+
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
23011
|
+
import * as fs21 from "node:fs";
|
|
23012
|
+
import * as path23 from "node:path";
|
|
22850
23013
|
var WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
22851
23014
|
function findOnPath(bin, env, platform) {
|
|
22852
23015
|
const pathValue = env.PATH ?? env.Path ?? "";
|
|
22853
|
-
const dirs = pathValue.split(
|
|
23016
|
+
const dirs = pathValue.split(path23.delimiter).filter((dir) => path23.isAbsolute(dir));
|
|
22854
23017
|
if (platform === "win32") {
|
|
22855
23018
|
const exts = (env.PATHEXT ?? WIN32_DEFAULT_PATHEXT).split(";").filter(Boolean);
|
|
22856
23019
|
for (const dir of dirs) {
|
|
22857
23020
|
for (const ext of exts) {
|
|
22858
|
-
const candidate =
|
|
22859
|
-
if (
|
|
23021
|
+
const candidate = path23.join(dir, bin + ext);
|
|
23022
|
+
if (fs21.existsSync(candidate)) return candidate;
|
|
22860
23023
|
}
|
|
22861
23024
|
}
|
|
22862
23025
|
return null;
|
|
22863
23026
|
}
|
|
22864
23027
|
for (const dir of dirs) {
|
|
22865
|
-
const candidate =
|
|
23028
|
+
const candidate = path23.join(dir, bin);
|
|
22866
23029
|
try {
|
|
22867
|
-
if (!
|
|
22868
|
-
|
|
23030
|
+
if (!fs21.statSync(candidate).isFile()) continue;
|
|
23031
|
+
fs21.accessSync(candidate, fs21.constants.X_OK);
|
|
22869
23032
|
return candidate;
|
|
22870
23033
|
} catch {
|
|
22871
23034
|
}
|
|
@@ -22878,7 +23041,7 @@ function yarnSupportsDlx(bin, platform) {
|
|
|
22878
23041
|
try {
|
|
22879
23042
|
const probe = { kind: "yarn", bin, buildArgs: (args) => args, label: "yarn" };
|
|
22880
23043
|
const command = skillsCommand(probe, ["--version"], platform);
|
|
22881
|
-
const out =
|
|
23044
|
+
const out = execFileSync7(command.file, command.args, {
|
|
22882
23045
|
stdio: ["ignore", "pipe", "ignore"],
|
|
22883
23046
|
timeout: YARN_VERSION_TIMEOUT_MS,
|
|
22884
23047
|
shell: command.shell,
|
|
@@ -22940,7 +23103,7 @@ function isSkillsCliCached(runner, cwd, platform = process.platform) {
|
|
|
22940
23103
|
if (runner.kind !== "npx") return false;
|
|
22941
23104
|
try {
|
|
22942
23105
|
const command = skillsCommand(runner, ["--no-install", "skills", "--version"], platform);
|
|
22943
|
-
|
|
23106
|
+
execFileSync7(command.file, command.args, {
|
|
22944
23107
|
env: npxChildEnv(),
|
|
22945
23108
|
stdio: ["ignore", "ignore", "ignore"],
|
|
22946
23109
|
timeout: OFFLINE_PROBE_TIMEOUT_MS,
|
|
@@ -22971,7 +23134,7 @@ function getScopeSpecs(projectRoot) {
|
|
|
22971
23134
|
}
|
|
22972
23135
|
];
|
|
22973
23136
|
}
|
|
22974
|
-
function refreshArgentSkills(projectRoot) {
|
|
23137
|
+
function refreshArgentSkills(projectRoot, scopes = "all") {
|
|
22975
23138
|
const bundled = new Set(listBundledSkills());
|
|
22976
23139
|
if (bundled.size === 0) return [];
|
|
22977
23140
|
const results = [];
|
|
@@ -22985,9 +23148,12 @@ function refreshArgentSkills(projectRoot) {
|
|
|
22985
23148
|
const runSkills = (skillsArgs) => {
|
|
22986
23149
|
if (!runner) throw new Error(NO_SKILLS_RUNNER_MESSAGE);
|
|
22987
23150
|
const command = skillsCommand(runner, skillsArgs);
|
|
22988
|
-
|
|
23151
|
+
execFileSync8(command.file, command.args, { ...execOpts, shell: command.shell });
|
|
22989
23152
|
};
|
|
22990
|
-
|
|
23153
|
+
const specs = getScopeSpecs(projectRoot).filter(
|
|
23154
|
+
(spec) => scopes === "all" || spec.scope === "global"
|
|
23155
|
+
);
|
|
23156
|
+
for (const spec of specs) {
|
|
22991
23157
|
const tracked = listArgentSkillsInLock(spec.lockPath);
|
|
22992
23158
|
if (tracked.length === 0) continue;
|
|
22993
23159
|
const orphaned = tracked.filter((name) => !bundled.has(name) && ARGENT_SKILL_NAME.test(name));
|
|
@@ -23039,13 +23205,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
23039
23205
|
let candidates = names;
|
|
23040
23206
|
if (names.length === 0) {
|
|
23041
23207
|
try {
|
|
23042
|
-
candidates =
|
|
23208
|
+
candidates = fs22.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
23043
23209
|
} catch {
|
|
23044
23210
|
continue;
|
|
23045
23211
|
}
|
|
23046
23212
|
}
|
|
23047
23213
|
for (const name of candidates) {
|
|
23048
|
-
const stat6 =
|
|
23214
|
+
const stat6 = fs22.statSync(path24.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
23049
23215
|
if (!stat6?.isFile()) continue;
|
|
23050
23216
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
23051
23217
|
}
|
|
@@ -23063,7 +23229,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
|
|
|
23063
23229
|
const removed = /* @__PURE__ */ new Set();
|
|
23064
23230
|
for (const { targetPath } of skillTargets) {
|
|
23065
23231
|
for (const name of legacy) {
|
|
23066
|
-
const dir =
|
|
23232
|
+
const dir = path24.join(targetPath, name);
|
|
23067
23233
|
try {
|
|
23068
23234
|
if (removePath(dir)) removed.add(name);
|
|
23069
23235
|
} catch {
|
|
@@ -23083,13 +23249,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
23083
23249
|
}
|
|
23084
23250
|
function removeLockEntries(lockPath, names) {
|
|
23085
23251
|
try {
|
|
23086
|
-
const lock = JSON.parse(
|
|
23252
|
+
const lock = JSON.parse(fs22.readFileSync(lockPath, "utf8"));
|
|
23087
23253
|
const skills = lock.skills;
|
|
23088
23254
|
if (!skills) return [];
|
|
23089
23255
|
const removed = names.filter((name) => name in skills);
|
|
23090
23256
|
if (removed.length === 0) return [];
|
|
23091
23257
|
for (const name of removed) delete skills[name];
|
|
23092
|
-
|
|
23258
|
+
fs22.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
23093
23259
|
return removed;
|
|
23094
23260
|
} catch {
|
|
23095
23261
|
return [];
|
|
@@ -23125,8 +23291,8 @@ function summarizeSkillRefreshForTelemetry(results) {
|
|
|
23125
23291
|
failed_count: results.filter((result) => result.syncError || result.pruneError).length
|
|
23126
23292
|
};
|
|
23127
23293
|
}
|
|
23128
|
-
function reportSkillRefresh(projectRoot, stage) {
|
|
23129
|
-
const results = refreshArgentSkills(projectRoot);
|
|
23294
|
+
function reportSkillRefresh(projectRoot, stage, scopes = "all") {
|
|
23295
|
+
const results = refreshArgentSkills(projectRoot, scopes);
|
|
23130
23296
|
if (results.some((r2) => r2.syncError === NO_SKILLS_RUNNER_MESSAGE)) {
|
|
23131
23297
|
log.warn(noSkillsRunnerHelp("argent update"));
|
|
23132
23298
|
}
|
|
@@ -23160,7 +23326,7 @@ async function runInstall(args) {
|
|
|
23160
23326
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
23161
23327
|
}
|
|
23162
23328
|
function installSpec(fromTar) {
|
|
23163
|
-
return
|
|
23329
|
+
return fs23.existsSync(fromTar) ? path25.resolve(fromTar) : fromTar;
|
|
23164
23330
|
}
|
|
23165
23331
|
async function installLocally(opts) {
|
|
23166
23332
|
const { fromTar, tel } = opts;
|
|
@@ -23467,8 +23633,8 @@ async function chooseAdapters(opts) {
|
|
|
23467
23633
|
|
|
23468
23634
|
// ../argent-installer/src/init-scope.ts
|
|
23469
23635
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
23470
|
-
import { existsSync as
|
|
23471
|
-
import { resolve as
|
|
23636
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
23637
|
+
import { resolve as resolve15 } from "node:path";
|
|
23472
23638
|
async function chooseScope(opts) {
|
|
23473
23639
|
if (opts.installMode === "local") {
|
|
23474
23640
|
return { scope: "local" };
|
|
@@ -23505,13 +23671,13 @@ async function chooseScope(opts) {
|
|
|
23505
23671
|
placeholder: process.cwd(),
|
|
23506
23672
|
validate(value) {
|
|
23507
23673
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
23508
|
-
const resolved =
|
|
23509
|
-
if (!
|
|
23674
|
+
const resolved = resolve15(value.trim());
|
|
23675
|
+
if (!existsSync16(resolved))
|
|
23510
23676
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
23511
23677
|
}
|
|
23512
23678
|
});
|
|
23513
23679
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
23514
|
-
return { scope: "custom", customRoot:
|
|
23680
|
+
return { scope: "custom", customRoot: resolve15(customPathInput.trim()) };
|
|
23515
23681
|
}
|
|
23516
23682
|
|
|
23517
23683
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23812,7 +23978,7 @@ async function configureAllowlist(args) {
|
|
|
23812
23978
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
23813
23979
|
import { spawn as spawn3 } from "node:child_process";
|
|
23814
23980
|
import * as os4 from "node:os";
|
|
23815
|
-
import * as
|
|
23981
|
+
import * as path26 from "node:path";
|
|
23816
23982
|
var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
|
|
23817
23983
|
function meaningfulLine(err) {
|
|
23818
23984
|
const lines = (err instanceof Error ? err.message : String(err)).split("\n").map((l2) => l2.replace(/^[│┌└■◇\s]+/, "").trim()).filter((l2) => l2 && !/^npm (warn|notice)/i.test(l2));
|
|
@@ -23820,10 +23986,10 @@ function meaningfulLine(err) {
|
|
|
23820
23986
|
}
|
|
23821
23987
|
function bundledCopyFor(version) {
|
|
23822
23988
|
const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
|
|
23823
|
-
if (local.packageDir && local.version === version) return
|
|
23989
|
+
if (local.packageDir && local.version === version) return path26.join(local.packageDir, "skills");
|
|
23824
23990
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
23825
23991
|
if (globalRoot && getGloballyInstalledVersion() === version) {
|
|
23826
|
-
return
|
|
23992
|
+
return path26.join(globalRoot, "skills");
|
|
23827
23993
|
}
|
|
23828
23994
|
return SKILLS_DIR;
|
|
23829
23995
|
}
|
|
@@ -24050,7 +24216,7 @@ async function runSkillsStep(args) {
|
|
|
24050
24216
|
async function runSkillsCli(runner, args, interactive, cwd) {
|
|
24051
24217
|
if (!runner) throw new Error(NO_SKILLS_RUNNER_MESSAGE);
|
|
24052
24218
|
const command = skillsCommand(runner, args);
|
|
24053
|
-
return new Promise((
|
|
24219
|
+
return new Promise((resolve22, reject) => {
|
|
24054
24220
|
const child = spawn3(command.file, command.args, {
|
|
24055
24221
|
env: npxChildEnv(),
|
|
24056
24222
|
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
@@ -24069,7 +24235,7 @@ async function runSkillsCli(runner, args, interactive, cwd) {
|
|
|
24069
24235
|
}
|
|
24070
24236
|
child.on("close", (code, signal) => {
|
|
24071
24237
|
if (code === 0) {
|
|
24072
|
-
|
|
24238
|
+
resolve22();
|
|
24073
24239
|
} else {
|
|
24074
24240
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
24075
24241
|
reject(
|
|
@@ -24390,8 +24556,9 @@ function printBanner() {
|
|
|
24390
24556
|
// ../argent-installer/src/update.ts
|
|
24391
24557
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24392
24558
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24393
|
-
import * as
|
|
24394
|
-
import * as
|
|
24559
|
+
import * as fs25 from "node:fs";
|
|
24560
|
+
import * as os5 from "node:os";
|
|
24561
|
+
import * as path32 from "node:path";
|
|
24395
24562
|
|
|
24396
24563
|
// ../argent-installer/src/install-targets.ts
|
|
24397
24564
|
function parseTargetFlags(args) {
|
|
@@ -24441,11 +24608,18 @@ async function promptInstallTargets(verb) {
|
|
|
24441
24608
|
|
|
24442
24609
|
// ../argent-installer/src/update-target.ts
|
|
24443
24610
|
var import_update_core = __toESM(require_dist3(), 1);
|
|
24444
|
-
async function resolveInstallableUpdateTarget(pm, current, cwd) {
|
|
24611
|
+
async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
|
|
24445
24612
|
const info = await (0, import_update_core.fetchRegistryInfo)(`${NPM_REGISTRY}/${PACKAGE_NAME}`);
|
|
24446
24613
|
if (info === null) return null;
|
|
24447
24614
|
const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm, cwd);
|
|
24448
|
-
|
|
24615
|
+
let { latest, times } = info;
|
|
24616
|
+
if (candidate) {
|
|
24617
|
+
const publishedAt = times[candidate] ?? null;
|
|
24618
|
+
latest = { version: candidate, publishedAt };
|
|
24619
|
+
times = publishedAt ? { [candidate]: publishedAt } : {};
|
|
24620
|
+
if (candidate !== info.latest.version && !publishedAt) return null;
|
|
24621
|
+
}
|
|
24622
|
+
const target = (0, import_update_core.pickInstallableTarget)(latest, times, current, minReleaseAgeMs);
|
|
24449
24623
|
return {
|
|
24450
24624
|
latestVersion: info.latest.version,
|
|
24451
24625
|
latestPublishedAt: info.latest.publishedAt,
|
|
@@ -24456,17 +24630,16 @@ async function resolveInstallableUpdateTarget(pm, current, cwd) {
|
|
|
24456
24630
|
|
|
24457
24631
|
// ../argent-tools-client/src/launcher.ts
|
|
24458
24632
|
import * as net from "node:net";
|
|
24459
|
-
import * as
|
|
24460
|
-
import * as
|
|
24633
|
+
import * as fs24 from "node:fs";
|
|
24634
|
+
import * as path27 from "node:path";
|
|
24461
24635
|
import * as readline from "node:readline";
|
|
24462
|
-
import {
|
|
24463
|
-
import { spawn as spawn4, execFileSync as execFileSync8 } from "node:child_process";
|
|
24636
|
+
import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
|
|
24464
24637
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
24465
24638
|
import { mkdir, writeFile, readFile, readdir as readdir2, unlink, rename, chmod } from "node:fs/promises";
|
|
24466
|
-
var STATE_DIR =
|
|
24467
|
-
var STATE_FILE =
|
|
24468
|
-
var LOG_FILE =
|
|
24469
|
-
var LOCK_FILE =
|
|
24639
|
+
var STATE_DIR = argentHomeDir();
|
|
24640
|
+
var STATE_FILE = path27.join(STATE_DIR, "tool-server.json");
|
|
24641
|
+
var LOG_FILE = path27.join(STATE_DIR, "tool-server.log");
|
|
24642
|
+
var LOCK_FILE = path27.join(STATE_DIR, "tool-server.lock");
|
|
24470
24643
|
function isProcessAlive(pid) {
|
|
24471
24644
|
try {
|
|
24472
24645
|
process.kill(pid, 0);
|
|
@@ -24477,7 +24650,7 @@ function isProcessAlive(pid) {
|
|
|
24477
24650
|
}
|
|
24478
24651
|
function stateFileForBundle(bundlePath) {
|
|
24479
24652
|
const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
24480
|
-
return
|
|
24653
|
+
return path27.join(STATE_DIR, `tool-server-${key}.json`);
|
|
24481
24654
|
}
|
|
24482
24655
|
async function readStateFile(file) {
|
|
24483
24656
|
try {
|
|
@@ -24519,7 +24692,7 @@ async function readAllToolsServerStates() {
|
|
|
24519
24692
|
const out = [];
|
|
24520
24693
|
for (const name of names) {
|
|
24521
24694
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
24522
|
-
const file =
|
|
24695
|
+
const file = path27.join(STATE_DIR, name);
|
|
24523
24696
|
const state2 = await readStateFile(file);
|
|
24524
24697
|
if (state2) out.push({ file, state: state2 });
|
|
24525
24698
|
}
|
|
@@ -24565,21 +24738,21 @@ async function killToolServer(bundlePath) {
|
|
|
24565
24738
|
return alive;
|
|
24566
24739
|
}
|
|
24567
24740
|
function isPathWithin(child, parent) {
|
|
24568
|
-
const rel =
|
|
24569
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
24741
|
+
const rel = path27.relative(parent, child);
|
|
24742
|
+
return rel !== "" && !rel.startsWith("..") && !path27.isAbsolute(rel);
|
|
24570
24743
|
}
|
|
24571
24744
|
function tryRealpath(p) {
|
|
24572
24745
|
try {
|
|
24573
|
-
return
|
|
24746
|
+
return fs24.realpathSync(p);
|
|
24574
24747
|
} catch {
|
|
24575
24748
|
return p;
|
|
24576
24749
|
}
|
|
24577
24750
|
}
|
|
24578
24751
|
async function killToolServerForInstallDir(packageDir) {
|
|
24579
|
-
const parents = /* @__PURE__ */ new Set([
|
|
24752
|
+
const parents = /* @__PURE__ */ new Set([path27.resolve(packageDir), tryRealpath(packageDir)]);
|
|
24580
24753
|
let killed = 0;
|
|
24581
24754
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
24582
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
24755
|
+
const bundles = /* @__PURE__ */ new Set([path27.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
24583
24756
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
24584
24757
|
if (!matches2) continue;
|
|
24585
24758
|
const fresh = await readStateFile(file);
|
|
@@ -24597,11 +24770,11 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24597
24770
|
}
|
|
24598
24771
|
return killed;
|
|
24599
24772
|
}
|
|
24600
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24773
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs24.existsSync(p)) ?? "ps";
|
|
24601
24774
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24602
24775
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24603
24776
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
24604
|
-
return
|
|
24777
|
+
return execFileSync9(PS_BIN, [...flags, "-p", String(pid), "-o", "command="], {
|
|
24605
24778
|
env,
|
|
24606
24779
|
encoding: "utf8",
|
|
24607
24780
|
timeout: 2e3,
|
|
@@ -24644,14 +24817,13 @@ function couldBeOurToolServer(pid, marker) {
|
|
|
24644
24817
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
24645
24818
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
24646
24819
|
import { maxHeaderSize } from "node:http";
|
|
24647
|
-
import * as
|
|
24820
|
+
import * as path31 from "node:path";
|
|
24648
24821
|
|
|
24649
24822
|
// ../argent-tools-client/src/link-config.ts
|
|
24650
|
-
import * as
|
|
24651
|
-
import { homedir as homedir8 } from "node:os";
|
|
24823
|
+
import * as path28 from "node:path";
|
|
24652
24824
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
24653
|
-
var LINK_DIR =
|
|
24654
|
-
var LINK_FILE =
|
|
24825
|
+
var LINK_DIR = argentHomeDir();
|
|
24826
|
+
var LINK_FILE = path28.join(LINK_DIR, "link.json");
|
|
24655
24827
|
|
|
24656
24828
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24657
24829
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
@@ -24668,14 +24840,14 @@ import {
|
|
|
24668
24840
|
writeFile as writeFile3
|
|
24669
24841
|
} from "node:fs/promises";
|
|
24670
24842
|
import { constants as constants2, tmpdir } from "node:os";
|
|
24671
|
-
import * as
|
|
24843
|
+
import * as path29 from "node:path";
|
|
24672
24844
|
|
|
24673
24845
|
// ../archive/src/index.ts
|
|
24674
24846
|
import { spawn as spawn5 } from "node:child_process";
|
|
24675
24847
|
import { once } from "node:events";
|
|
24676
24848
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
24677
24849
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24678
|
-
import { basename as basename5, dirname as dirname14, join as
|
|
24850
|
+
import { basename as basename5, dirname as dirname14, join as join27, resolve as resolve17, sep as sep4 } from "node:path";
|
|
24679
24851
|
import { Writable } from "node:stream";
|
|
24680
24852
|
import { pipeline } from "node:stream/promises";
|
|
24681
24853
|
import zlib2 from "node:zlib";
|
|
@@ -24693,7 +24865,7 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
24693
24865
|
// ../argent-tools-client/src/flow-files.ts
|
|
24694
24866
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
24695
24867
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
24696
|
-
import * as
|
|
24868
|
+
import * as path30 from "node:path";
|
|
24697
24869
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
24698
24870
|
|
|
24699
24871
|
// ../argent-tools-client/src/artifacts.ts
|
|
@@ -24709,7 +24881,7 @@ import {
|
|
|
24709
24881
|
} from "node:fs/promises";
|
|
24710
24882
|
import { constants as fsConstants } from "node:fs";
|
|
24711
24883
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24712
|
-
import { basename as basename8,
|
|
24884
|
+
import { basename as basename8, extname as extname2, isAbsolute as isAbsolute10, join as join31, normalize as normalize2, resolve as resolve20, sep as sep7 } from "node:path";
|
|
24713
24885
|
import { createHash as createHash5 } from "node:crypto";
|
|
24714
24886
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
24715
24887
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -24784,13 +24956,144 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24784
24956
|
return installed ? "standalone_update" : "standalone_install";
|
|
24785
24957
|
}
|
|
24786
24958
|
function isLivePinnedEntry(entry) {
|
|
24787
|
-
return entry !== null && isPinnedGlobalEntry(entry) &&
|
|
24959
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs25.existsSync(entry.command) && fs25.existsSync(entry.args[0]);
|
|
24960
|
+
}
|
|
24961
|
+
async function refreshConfiguration({
|
|
24962
|
+
projectRoot,
|
|
24963
|
+
installMode,
|
|
24964
|
+
nonInteractive,
|
|
24965
|
+
globalOnly
|
|
24966
|
+
}) {
|
|
24967
|
+
const spinner2 = spinner();
|
|
24968
|
+
spinner2.start("Refreshing workspace configuration...");
|
|
24969
|
+
const results = [];
|
|
24970
|
+
const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
|
|
24971
|
+
const globalCmdMode = resolveGlobalCommandMode();
|
|
24972
|
+
const globalInstallOnPath = isGlobalInstallFirstOnPath();
|
|
24973
|
+
const skipEntryRewrite = localCmdMode?.kind === "local-npx";
|
|
24974
|
+
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
|
|
24975
|
+
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot).filter(
|
|
24976
|
+
({ scope }) => !globalOnly || scope !== "project"
|
|
24977
|
+
);
|
|
24978
|
+
const adaptersByScope = /* @__PURE__ */ new Map([
|
|
24979
|
+
["local", /* @__PURE__ */ new Set()],
|
|
24980
|
+
["global", /* @__PURE__ */ new Set()]
|
|
24981
|
+
]);
|
|
24982
|
+
for (const { adapter, scope, configPath } of configuredScopes) {
|
|
24983
|
+
const normScope = scope === "project" ? "local" : "global";
|
|
24984
|
+
adaptersByScope.get(normScope).add(adapter);
|
|
24985
|
+
if (skipEntryRewrite && normScope === "local") continue;
|
|
24986
|
+
let existing;
|
|
24987
|
+
try {
|
|
24988
|
+
existing = adapter.getArgentEntry(configPath);
|
|
24989
|
+
} catch {
|
|
24990
|
+
continue;
|
|
24991
|
+
}
|
|
24992
|
+
const isUnreadableSentinel = existing !== null && existing.command === "" && existing.args.length === 0;
|
|
24993
|
+
if (existing !== null && !isUnreadableSentinel && !isArgentManagedEntry(existing)) {
|
|
24994
|
+
results.push(
|
|
24995
|
+
`${import_picocolors12.default.yellow("!")} ${adapter.name} left a customized entry untouched ${import_picocolors12.default.dim(configPath)}`
|
|
24996
|
+
);
|
|
24997
|
+
continue;
|
|
24998
|
+
}
|
|
24999
|
+
const entry = entryFor(normScope);
|
|
25000
|
+
const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
|
|
25001
|
+
if (replacesLivePin && normScope === "local") continue;
|
|
25002
|
+
if (replacesLivePin && !globalInstallOnPath) {
|
|
25003
|
+
results.push(
|
|
25004
|
+
`${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
|
|
25005
|
+
);
|
|
25006
|
+
continue;
|
|
25007
|
+
}
|
|
25008
|
+
try {
|
|
25009
|
+
adapter.write(configPath, entry);
|
|
25010
|
+
results.push(
|
|
25011
|
+
replacesLivePin ? `${import_picocolors12.default.yellow("!")} ${adapter.name} now runs the bare argent command (the global install on PATH has no node beside it to pin) ${import_picocolors12.default.dim(configPath)}` : `${import_picocolors12.default.green("+")} ${adapter.name} ${import_picocolors12.default.dim(configPath)}`
|
|
25012
|
+
);
|
|
25013
|
+
} catch {
|
|
25014
|
+
}
|
|
25015
|
+
}
|
|
25016
|
+
if (skipEntryRewrite && configuredScopes.some(({ scope }) => scope === "project")) {
|
|
25017
|
+
log.info(
|
|
25018
|
+
import_picocolors12.default.dim(
|
|
25019
|
+
"Left project MCP entries unchanged \u2014 the repo-local argent binary can't be resolved right now (fresh checkout: run your package manager's install; after an out-of-band version bump, just re-run argent update)."
|
|
25020
|
+
)
|
|
25021
|
+
);
|
|
25022
|
+
}
|
|
25023
|
+
for (const [scope, adapters] of adaptersByScope) {
|
|
25024
|
+
for (const adapter of adapters) {
|
|
25025
|
+
if (!adapter.refreshAllowlist) continue;
|
|
25026
|
+
try {
|
|
25027
|
+
adapter.refreshAllowlist(projectRoot, scope);
|
|
25028
|
+
} catch {
|
|
25029
|
+
}
|
|
25030
|
+
}
|
|
25031
|
+
}
|
|
25032
|
+
const localAdapters = [...adaptersByScope.get("local")];
|
|
25033
|
+
const globalAdapters = [...adaptersByScope.get("global")];
|
|
25034
|
+
const ruleResults = [
|
|
25035
|
+
...copyRulesAndAgents(globalAdapters, projectRoot, "global", RULES_DIR, AGENTS_DIR),
|
|
25036
|
+
...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
|
|
25037
|
+
];
|
|
25038
|
+
spinner2.stop("Configuration refreshed.");
|
|
25039
|
+
if (results.length > 0) {
|
|
25040
|
+
note(results.join("\n"), "MCP Configs Updated");
|
|
25041
|
+
}
|
|
25042
|
+
if (!globalOnly) {
|
|
25043
|
+
const staleCleanup = await cleanupStaleMcpConfigs({
|
|
25044
|
+
writtenAdapters: [.../* @__PURE__ */ new Set([...localAdapters, ...globalAdapters])],
|
|
25045
|
+
detectedAdapters: detectAdapters(),
|
|
25046
|
+
installMode,
|
|
25047
|
+
scope: localAdapters.length > 0 ? "local" : "global",
|
|
25048
|
+
effectiveRoot: projectRoot,
|
|
25049
|
+
// Same one-shot confirmation init uses for cross-project removals.
|
|
25050
|
+
// --yes passes no confirmer (the sweep goes report-only) — the
|
|
25051
|
+
// agent-triggered `update --yes` must never delete cross-project state
|
|
25052
|
+
// on a fallible PATH probe.
|
|
25053
|
+
confirmCrossProjectRemovals: nonInteractive ? void 0 : async (items) => {
|
|
25054
|
+
log.warn(
|
|
25055
|
+
`Dead argent entries from a previous global install were found in
|
|
25056
|
+
global (cross-project) config files:
|
|
25057
|
+
` + items.map((item) => ` ${import_picocolors12.default.cyan(item)}`).join("\n")
|
|
25058
|
+
);
|
|
25059
|
+
const choice = await confirm({
|
|
25060
|
+
message: "Remove these dead global entries? - recommended",
|
|
25061
|
+
initialValue: true
|
|
25062
|
+
});
|
|
25063
|
+
return !isCancel(choice) && choice === true;
|
|
25064
|
+
}
|
|
25065
|
+
});
|
|
25066
|
+
if (staleCleanup.lines.length > 0) {
|
|
25067
|
+
note(staleCleanup.lines.join("\n"), "Stale Config Cleanup");
|
|
25068
|
+
track("installation:stale_config_cleanup", {
|
|
25069
|
+
removed_count: staleCleanup.removedCount,
|
|
25070
|
+
warned_count: staleCleanup.warnedCount
|
|
25071
|
+
});
|
|
25072
|
+
}
|
|
25073
|
+
}
|
|
25074
|
+
if (ruleResults.length > 0) {
|
|
25075
|
+
note(ruleResults.join("\n"), "Rules Updated");
|
|
25076
|
+
}
|
|
25077
|
+
await reportRetiredFiles(
|
|
25078
|
+
findRetiredRulesAndAgents(
|
|
25079
|
+
[
|
|
25080
|
+
{ adapters: globalAdapters, scope: "global" },
|
|
25081
|
+
{ adapters: localAdapters, scope: "local" }
|
|
25082
|
+
],
|
|
25083
|
+
projectRoot,
|
|
25084
|
+
RULES_DIR,
|
|
25085
|
+
AGENTS_DIR
|
|
25086
|
+
),
|
|
25087
|
+
!nonInteractive
|
|
25088
|
+
);
|
|
25089
|
+
reportSkillRefresh(projectRoot, "installer_update_skills_refresh", globalOnly ? "global" : "all");
|
|
24788
25090
|
}
|
|
24789
25091
|
async function update(args) {
|
|
24790
25092
|
const nonInteractive = args.includes("--yes") || args.includes("-y");
|
|
24791
25093
|
const noTelemetry = args.includes("--no-telemetry");
|
|
24792
25094
|
const requestedVersion = getRequestedVersion(args);
|
|
24793
25095
|
const trigger = getUpdateTriggerFromEnv();
|
|
25096
|
+
const automatic = process.env.ARGENT_AUTOMATIC_UPDATE === "1";
|
|
24794
25097
|
init("installer");
|
|
24795
25098
|
const updateStartTime = performance.now();
|
|
24796
25099
|
let telemetryFinalized = false;
|
|
@@ -24883,16 +25186,23 @@ async function update(args) {
|
|
|
24883
25186
|
const spinner2 = spinner();
|
|
24884
25187
|
spinner2.start("Checking for updates...");
|
|
24885
25188
|
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
25189
|
+
if (automatic) {
|
|
25190
|
+
const globalRoot = getGloballyInstalledPackageRoot();
|
|
25191
|
+
if (!globallyInstalled || !globalRoot || fs25.realpathSync(globalRoot) !== projectRoot || !isAutoUpdateEnabled() || !ownsGlobalInstall(pm, projectRoot)) {
|
|
25192
|
+
spinner2.stop("Could not confirm an automatic update for this installation.");
|
|
25193
|
+
return "noop";
|
|
25194
|
+
}
|
|
25195
|
+
}
|
|
24886
25196
|
const runIn = mode === "local" ? { cwd: projectRoot } : globalCommandOptions(pm);
|
|
24887
25197
|
let latest = null;
|
|
24888
25198
|
let target;
|
|
24889
25199
|
let minReleaseAgeMs = 0;
|
|
24890
|
-
if (requestedVersion !== null) {
|
|
25200
|
+
if (requestedVersion !== null && !automatic) {
|
|
24891
25201
|
target = requestedVersion;
|
|
24892
25202
|
} else {
|
|
24893
25203
|
let resolved;
|
|
24894
25204
|
try {
|
|
24895
|
-
resolved = await resolveInstallableUpdateTarget(pm, installed, runIn.cwd);
|
|
25205
|
+
resolved = automatic && requestedVersion ? await resolveInstallableUpdateTarget(pm, installed, runIn.cwd, requestedVersion) : await resolveInstallableUpdateTarget(pm, installed, runIn.cwd);
|
|
24896
25206
|
} catch (err) {
|
|
24897
25207
|
spinner2.stop(import_picocolors12.default.red("Could not reach registry."));
|
|
24898
25208
|
await trackPackageAction(
|
|
@@ -24915,6 +25225,10 @@ async function update(args) {
|
|
|
24915
25225
|
log.error("Failed to determine the latest Argent release from the registry.");
|
|
24916
25226
|
return { failed: UPDATE_REGISTRY_CHECK_FAILED };
|
|
24917
25227
|
}
|
|
25228
|
+
if (automatic && resolved.targetVersion !== requestedVersion) {
|
|
25229
|
+
spinner2.stop("The eligible version has changed.");
|
|
25230
|
+
return "noop";
|
|
25231
|
+
}
|
|
24918
25232
|
latest = resolved.latestVersion;
|
|
24919
25233
|
target = resolved.targetVersion;
|
|
24920
25234
|
minReleaseAgeMs = resolved.minReleaseAgeMs;
|
|
@@ -24959,22 +25273,24 @@ async function update(args) {
|
|
|
24959
25273
|
}
|
|
24960
25274
|
}
|
|
24961
25275
|
log.info(`Running: ${import_picocolors12.default.dim(cmdStr)}`);
|
|
24962
|
-
|
|
24963
|
-
|
|
24964
|
-
|
|
24965
|
-
|
|
24966
|
-
|
|
24967
|
-
|
|
25276
|
+
if (!automatic) {
|
|
25277
|
+
const installDirToStop = mode === "local" ? localProbe.packageDir : getGloballyInstalledPackageRoot();
|
|
25278
|
+
try {
|
|
25279
|
+
if (installDirToStop) {
|
|
25280
|
+
await killToolServerForInstallDir(installDirToStop);
|
|
25281
|
+
} else if (mode === "global") {
|
|
25282
|
+
await killToolServer();
|
|
25283
|
+
}
|
|
25284
|
+
} catch (err) {
|
|
25285
|
+
await trackPackageAction(
|
|
25286
|
+
"update_failed",
|
|
25287
|
+
updateStartTime,
|
|
25288
|
+
false,
|
|
25289
|
+
UPDATE_TOOLSERVER_STOP_FAILED
|
|
25290
|
+
);
|
|
25291
|
+
log.error(`Could not stop the running tool server: ${err}`);
|
|
25292
|
+
return { failed: UPDATE_TOOLSERVER_STOP_FAILED };
|
|
24968
25293
|
}
|
|
24969
|
-
} catch (err) {
|
|
24970
|
-
await trackPackageAction(
|
|
24971
|
-
"update_failed",
|
|
24972
|
-
updateStartTime,
|
|
24973
|
-
false,
|
|
24974
|
-
UPDATE_TOOLSERVER_STOP_FAILED
|
|
24975
|
-
);
|
|
24976
|
-
log.error(`Could not stop the running tool server: ${err}`);
|
|
24977
|
-
return { failed: UPDATE_TOOLSERVER_STOP_FAILED };
|
|
24978
25294
|
}
|
|
24979
25295
|
const packageAction = resolveUpdatePackageAction(
|
|
24980
25296
|
trigger,
|
|
@@ -25072,8 +25388,31 @@ async function update(args) {
|
|
|
25072
25388
|
log.error(`Requested version is not a stable semver: ${requestedVersion}`);
|
|
25073
25389
|
process.exit(1);
|
|
25074
25390
|
}
|
|
25391
|
+
if (automatic) {
|
|
25392
|
+
const runningRoot = fs25.realpathSync(resolvePackageRoot(import.meta.dirname));
|
|
25393
|
+
const result = requestedVersion ? await applyUpdateForTarget("global", runningRoot) : "noop";
|
|
25394
|
+
if (result === "updated" && requestedVersion) {
|
|
25395
|
+
writeCliRecord({
|
|
25396
|
+
mode: "global",
|
|
25397
|
+
projectRoot: runningRoot,
|
|
25398
|
+
version: getGloballyInstalledVersion() ?? requestedVersion
|
|
25399
|
+
});
|
|
25400
|
+
await refreshConfiguration({
|
|
25401
|
+
projectRoot: os5.homedir(),
|
|
25402
|
+
installMode: "global",
|
|
25403
|
+
nonInteractive: true,
|
|
25404
|
+
globalOnly: true
|
|
25405
|
+
});
|
|
25406
|
+
await completeUpdateTelemetry();
|
|
25407
|
+
} else {
|
|
25408
|
+
process.exitCode = 1;
|
|
25409
|
+
if (typeof result === "object") await failUpdateTelemetry(result.failed);
|
|
25410
|
+
else await completeUpdateTelemetry();
|
|
25411
|
+
}
|
|
25412
|
+
return;
|
|
25413
|
+
}
|
|
25075
25414
|
const rootOverride = getProjectRootOverride(args);
|
|
25076
|
-
const projectRoot = rootOverride ?
|
|
25415
|
+
const projectRoot = rootOverride ? path32.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
25077
25416
|
installMode = resolveInstallMode(projectRoot);
|
|
25078
25417
|
const flags = parseTargetFlags(args);
|
|
25079
25418
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -25136,127 +25475,7 @@ async function update(args) {
|
|
|
25136
25475
|
outro(import_picocolors12.default.red("Update failed."));
|
|
25137
25476
|
process.exit(1);
|
|
25138
25477
|
}
|
|
25139
|
-
{
|
|
25140
|
-
const spinner2 = spinner();
|
|
25141
|
-
spinner2.start("Refreshing workspace configuration...");
|
|
25142
|
-
const results = [];
|
|
25143
|
-
const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
|
|
25144
|
-
const globalCmdMode = resolveGlobalCommandMode();
|
|
25145
|
-
const globalInstallOnPath = isGlobalInstallFirstOnPath();
|
|
25146
|
-
const skipEntryRewrite = localCmdMode?.kind === "local-npx";
|
|
25147
|
-
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
|
|
25148
|
-
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
|
|
25149
|
-
const adaptersByScope = /* @__PURE__ */ new Map([
|
|
25150
|
-
["local", /* @__PURE__ */ new Set()],
|
|
25151
|
-
["global", /* @__PURE__ */ new Set()]
|
|
25152
|
-
]);
|
|
25153
|
-
for (const { adapter, scope, configPath } of configuredScopes) {
|
|
25154
|
-
const normScope = scope === "project" ? "local" : "global";
|
|
25155
|
-
adaptersByScope.get(normScope).add(adapter);
|
|
25156
|
-
if (skipEntryRewrite && normScope === "local") continue;
|
|
25157
|
-
let existing;
|
|
25158
|
-
try {
|
|
25159
|
-
existing = adapter.getArgentEntry(configPath);
|
|
25160
|
-
} catch {
|
|
25161
|
-
continue;
|
|
25162
|
-
}
|
|
25163
|
-
const isUnreadableSentinel = existing !== null && existing.command === "" && existing.args.length === 0;
|
|
25164
|
-
if (existing !== null && !isUnreadableSentinel && !isArgentManagedEntry(existing)) {
|
|
25165
|
-
results.push(
|
|
25166
|
-
`${import_picocolors12.default.yellow("!")} ${adapter.name} left a customized entry untouched ${import_picocolors12.default.dim(configPath)}`
|
|
25167
|
-
);
|
|
25168
|
-
continue;
|
|
25169
|
-
}
|
|
25170
|
-
const entry = entryFor(normScope);
|
|
25171
|
-
const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
|
|
25172
|
-
if (replacesLivePin && normScope === "local") continue;
|
|
25173
|
-
if (replacesLivePin && !globalInstallOnPath) {
|
|
25174
|
-
results.push(
|
|
25175
|
-
`${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
|
|
25176
|
-
);
|
|
25177
|
-
continue;
|
|
25178
|
-
}
|
|
25179
|
-
try {
|
|
25180
|
-
adapter.write(configPath, entry);
|
|
25181
|
-
results.push(
|
|
25182
|
-
replacesLivePin ? `${import_picocolors12.default.yellow("!")} ${adapter.name} now runs the bare argent command (the global install on PATH has no node beside it to pin) ${import_picocolors12.default.dim(configPath)}` : `${import_picocolors12.default.green("+")} ${adapter.name} ${import_picocolors12.default.dim(configPath)}`
|
|
25183
|
-
);
|
|
25184
|
-
} catch {
|
|
25185
|
-
}
|
|
25186
|
-
}
|
|
25187
|
-
if (skipEntryRewrite && configuredScopes.some(({ scope }) => scope === "project")) {
|
|
25188
|
-
log.info(
|
|
25189
|
-
import_picocolors12.default.dim(
|
|
25190
|
-
"Left project MCP entries unchanged \u2014 the repo-local argent binary can't be resolved right now (fresh checkout: run your package manager's install; after an out-of-band version bump, just re-run argent update)."
|
|
25191
|
-
)
|
|
25192
|
-
);
|
|
25193
|
-
}
|
|
25194
|
-
for (const [scope, adapters] of adaptersByScope) {
|
|
25195
|
-
for (const adapter of adapters) {
|
|
25196
|
-
if (!adapter.refreshAllowlist) continue;
|
|
25197
|
-
try {
|
|
25198
|
-
adapter.refreshAllowlist(projectRoot, scope);
|
|
25199
|
-
} catch {
|
|
25200
|
-
}
|
|
25201
|
-
}
|
|
25202
|
-
}
|
|
25203
|
-
const localAdapters = [...adaptersByScope.get("local")];
|
|
25204
|
-
const globalAdapters = [...adaptersByScope.get("global")];
|
|
25205
|
-
const ruleResults = [
|
|
25206
|
-
...copyRulesAndAgents(globalAdapters, projectRoot, "global", RULES_DIR, AGENTS_DIR),
|
|
25207
|
-
...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
|
|
25208
|
-
];
|
|
25209
|
-
spinner2.stop("Configuration refreshed.");
|
|
25210
|
-
if (results.length > 0) {
|
|
25211
|
-
note(results.join("\n"), "MCP Configs Updated");
|
|
25212
|
-
}
|
|
25213
|
-
const staleCleanup = await cleanupStaleMcpConfigs({
|
|
25214
|
-
writtenAdapters: [.../* @__PURE__ */ new Set([...localAdapters, ...globalAdapters])],
|
|
25215
|
-
detectedAdapters: detectAdapters(),
|
|
25216
|
-
installMode,
|
|
25217
|
-
scope: localAdapters.length > 0 ? "local" : "global",
|
|
25218
|
-
effectiveRoot: projectRoot,
|
|
25219
|
-
// Same one-shot confirmation init uses for cross-project removals.
|
|
25220
|
-
// --yes passes no confirmer (the sweep goes report-only) — the
|
|
25221
|
-
// agent-triggered `update --yes` must never delete cross-project state
|
|
25222
|
-
// on a fallible PATH probe.
|
|
25223
|
-
confirmCrossProjectRemovals: nonInteractive ? void 0 : async (items) => {
|
|
25224
|
-
log.warn(
|
|
25225
|
-
`Dead argent entries from a previous global install were found in
|
|
25226
|
-
global (cross-project) config files:
|
|
25227
|
-
` + items.map((item) => ` ${import_picocolors12.default.cyan(item)}`).join("\n")
|
|
25228
|
-
);
|
|
25229
|
-
const choice = await confirm({
|
|
25230
|
-
message: "Remove these dead global entries? - recommended",
|
|
25231
|
-
initialValue: true
|
|
25232
|
-
});
|
|
25233
|
-
return !isCancel(choice) && choice === true;
|
|
25234
|
-
}
|
|
25235
|
-
});
|
|
25236
|
-
if (staleCleanup.lines.length > 0) {
|
|
25237
|
-
note(staleCleanup.lines.join("\n"), "Stale Config Cleanup");
|
|
25238
|
-
track("installation:stale_config_cleanup", {
|
|
25239
|
-
removed_count: staleCleanup.removedCount,
|
|
25240
|
-
warned_count: staleCleanup.warnedCount
|
|
25241
|
-
});
|
|
25242
|
-
}
|
|
25243
|
-
if (ruleResults.length > 0) {
|
|
25244
|
-
note(ruleResults.join("\n"), "Rules Updated");
|
|
25245
|
-
}
|
|
25246
|
-
await reportRetiredFiles(
|
|
25247
|
-
findRetiredRulesAndAgents(
|
|
25248
|
-
[
|
|
25249
|
-
{ adapters: globalAdapters, scope: "global" },
|
|
25250
|
-
{ adapters: localAdapters, scope: "local" }
|
|
25251
|
-
],
|
|
25252
|
-
projectRoot,
|
|
25253
|
-
RULES_DIR,
|
|
25254
|
-
AGENTS_DIR
|
|
25255
|
-
),
|
|
25256
|
-
!nonInteractive
|
|
25257
|
-
);
|
|
25258
|
-
reportSkillRefresh(projectRoot, "installer_update_skills_refresh");
|
|
25259
|
-
}
|
|
25478
|
+
await refreshConfiguration({ projectRoot, installMode, nonInteractive, globalOnly: false });
|
|
25260
25479
|
if (firstFailure) {
|
|
25261
25480
|
await failUpdateTelemetry(firstFailure);
|
|
25262
25481
|
outro(import_picocolors12.default.yellow("Update finished with errors \u2014 see above."));
|
|
@@ -25273,8 +25492,8 @@ async function update(args) {
|
|
|
25273
25492
|
// ../argent-installer/src/uninstall.ts
|
|
25274
25493
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
25275
25494
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
25276
|
-
import * as
|
|
25277
|
-
import * as
|
|
25495
|
+
import * as fs26 from "node:fs";
|
|
25496
|
+
import * as path33 from "node:path";
|
|
25278
25497
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
25279
25498
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
25280
25499
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -25295,10 +25514,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
25295
25514
|
};
|
|
25296
25515
|
function removeDirIfEmpty2(dirPath) {
|
|
25297
25516
|
try {
|
|
25298
|
-
if (!
|
|
25299
|
-
if (!
|
|
25300
|
-
if (
|
|
25301
|
-
|
|
25517
|
+
if (!fs26.existsSync(dirPath)) return false;
|
|
25518
|
+
if (!fs26.statSync(dirPath).isDirectory()) return false;
|
|
25519
|
+
if (fs26.readdirSync(dirPath).length > 0) return false;
|
|
25520
|
+
fs26.rmdirSync(dirPath);
|
|
25302
25521
|
return true;
|
|
25303
25522
|
} catch {
|
|
25304
25523
|
return false;
|
|
@@ -25308,9 +25527,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
25308
25527
|
const files = [];
|
|
25309
25528
|
const directories = [];
|
|
25310
25529
|
function walk(currentDir, relativeDir = "") {
|
|
25311
|
-
for (const entry of
|
|
25312
|
-
const relativePath = relativeDir ?
|
|
25313
|
-
const absolutePath =
|
|
25530
|
+
for (const entry of fs26.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25531
|
+
const relativePath = relativeDir ? path33.join(relativeDir, entry.name) : entry.name;
|
|
25532
|
+
const absolutePath = path33.join(currentDir, entry.name);
|
|
25314
25533
|
if (entry.isDirectory()) {
|
|
25315
25534
|
walk(absolutePath, relativePath);
|
|
25316
25535
|
directories.push(relativePath);
|
|
@@ -25323,15 +25542,15 @@ function collectBundledPaths(sourceDir) {
|
|
|
25323
25542
|
return { files, directories };
|
|
25324
25543
|
}
|
|
25325
25544
|
function removeBundledContent(sourceDir, targetDir) {
|
|
25326
|
-
if (!
|
|
25545
|
+
if (!fs26.existsSync(sourceDir) || !fs26.existsSync(targetDir)) {
|
|
25327
25546
|
return { removedPaths: [], removedRoot: false };
|
|
25328
25547
|
}
|
|
25329
25548
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
25330
25549
|
const removedPaths = [];
|
|
25331
25550
|
for (const relativePath of files) {
|
|
25332
|
-
const targetPath =
|
|
25551
|
+
const targetPath = path33.join(targetDir, relativePath);
|
|
25333
25552
|
try {
|
|
25334
|
-
const entry =
|
|
25553
|
+
const entry = fs26.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25335
25554
|
if (!entry || entry.isDirectory()) continue;
|
|
25336
25555
|
removePath(targetPath);
|
|
25337
25556
|
removedPaths.push(relativePath);
|
|
@@ -25339,36 +25558,36 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25339
25558
|
}
|
|
25340
25559
|
}
|
|
25341
25560
|
directories.sort(
|
|
25342
|
-
(a2, b) => b.split(
|
|
25561
|
+
(a2, b) => b.split(path33.sep).length - a2.split(path33.sep).length || b.length - a2.length
|
|
25343
25562
|
);
|
|
25344
25563
|
for (const relativePath of directories) {
|
|
25345
|
-
const targetPath =
|
|
25564
|
+
const targetPath = path33.join(targetDir, relativePath);
|
|
25346
25565
|
try {
|
|
25347
|
-
if (!
|
|
25348
|
-
if (!
|
|
25349
|
-
if (
|
|
25350
|
-
|
|
25566
|
+
if (!fs26.existsSync(targetPath)) continue;
|
|
25567
|
+
if (!fs26.statSync(targetPath).isDirectory()) continue;
|
|
25568
|
+
if (fs26.readdirSync(targetPath).length > 0) continue;
|
|
25569
|
+
fs26.rmdirSync(targetPath);
|
|
25351
25570
|
} catch {
|
|
25352
25571
|
}
|
|
25353
25572
|
}
|
|
25354
25573
|
let removedRoot = false;
|
|
25355
25574
|
try {
|
|
25356
|
-
if (
|
|
25357
|
-
if (
|
|
25358
|
-
|
|
25575
|
+
if (fs26.existsSync(targetDir) && fs26.statSync(targetDir).isDirectory()) {
|
|
25576
|
+
if (fs26.readdirSync(targetDir).length === 0) {
|
|
25577
|
+
fs26.rmdirSync(targetDir);
|
|
25359
25578
|
removedRoot = true;
|
|
25360
25579
|
}
|
|
25361
25580
|
}
|
|
25362
25581
|
} catch {
|
|
25363
25582
|
}
|
|
25364
25583
|
if (removedRoot) {
|
|
25365
|
-
removeDirIfEmpty2(
|
|
25584
|
+
removeDirIfEmpty2(path33.dirname(targetDir));
|
|
25366
25585
|
}
|
|
25367
25586
|
return { removedPaths, removedRoot };
|
|
25368
25587
|
}
|
|
25369
25588
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
25370
25589
|
try {
|
|
25371
|
-
const content =
|
|
25590
|
+
const content = fs26.readFileSync(skillFilePath, "utf8");
|
|
25372
25591
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
25373
25592
|
if (!frontmatter) return fallbackName;
|
|
25374
25593
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -25379,23 +25598,23 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
25379
25598
|
}
|
|
25380
25599
|
}
|
|
25381
25600
|
function getBundledSkillNames(skillsDir) {
|
|
25382
|
-
if (!
|
|
25601
|
+
if (!fs26.existsSync(skillsDir)) return [];
|
|
25383
25602
|
const skillNames = [];
|
|
25384
|
-
for (const entry of
|
|
25603
|
+
for (const entry of fs26.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
25385
25604
|
if (!entry.isDirectory()) continue;
|
|
25386
|
-
const skillFilePath =
|
|
25387
|
-
if (!
|
|
25605
|
+
const skillFilePath = path33.join(skillsDir, entry.name, "SKILL.md");
|
|
25606
|
+
if (!fs26.existsSync(skillFilePath)) continue;
|
|
25388
25607
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
25389
25608
|
}
|
|
25390
25609
|
return [...new Set(skillNames)].sort();
|
|
25391
25610
|
}
|
|
25392
25611
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
25393
|
-
if (!
|
|
25612
|
+
if (!fs26.existsSync(targetDir)) {
|
|
25394
25613
|
return { removedPaths: [], removedRoot: false };
|
|
25395
25614
|
}
|
|
25396
25615
|
const removedPaths = [];
|
|
25397
25616
|
for (const skillName of skillNames) {
|
|
25398
|
-
const targetPath =
|
|
25617
|
+
const targetPath = path33.join(targetDir, skillName);
|
|
25399
25618
|
try {
|
|
25400
25619
|
if (removePath(targetPath)) removedPaths.push(skillName);
|
|
25401
25620
|
} catch {
|
|
@@ -25403,17 +25622,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
25403
25622
|
}
|
|
25404
25623
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
25405
25624
|
if (removedRoot) {
|
|
25406
|
-
removeDirIfEmpty2(
|
|
25625
|
+
removeDirIfEmpty2(path33.dirname(targetDir));
|
|
25407
25626
|
}
|
|
25408
25627
|
return { removedPaths, removedRoot };
|
|
25409
25628
|
}
|
|
25410
25629
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
25411
|
-
if (!
|
|
25630
|
+
if (!fs26.existsSync(lockPath)) {
|
|
25412
25631
|
return { removedSkills: [], removedFile: false };
|
|
25413
25632
|
}
|
|
25414
25633
|
let parsed;
|
|
25415
25634
|
try {
|
|
25416
|
-
parsed = JSON.parse(
|
|
25635
|
+
parsed = JSON.parse(fs26.readFileSync(lockPath, "utf8"));
|
|
25417
25636
|
} catch {
|
|
25418
25637
|
return { removedSkills: [], removedFile: false };
|
|
25419
25638
|
}
|
|
@@ -25440,10 +25659,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25440
25659
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25441
25660
|
);
|
|
25442
25661
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25443
|
-
|
|
25662
|
+
fs26.rmSync(lockPath, { force: true });
|
|
25444
25663
|
return { removedSkills, removedFile: true };
|
|
25445
25664
|
}
|
|
25446
|
-
|
|
25665
|
+
fs26.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25447
25666
|
return { removedSkills, removedFile: false };
|
|
25448
25667
|
}
|
|
25449
25668
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25646,7 +25865,7 @@ async function uninstall(args) {
|
|
|
25646
25865
|
),
|
|
25647
25866
|
{ ask: false }
|
|
25648
25867
|
);
|
|
25649
|
-
for (const root of retired.removedRoots) removeDirIfEmpty2(
|
|
25868
|
+
for (const root of retired.removedRoots) removeDirIfEmpty2(path33.dirname(root));
|
|
25650
25869
|
const retiredLines = formatRetiredCleanup(retired);
|
|
25651
25870
|
pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
|
|
25652
25871
|
const retiredKept = retiredLines.kept.map((line) => ` ${line}`);
|
|
@@ -25765,7 +25984,7 @@ async function uninstall(args) {
|
|
|
25765
25984
|
try {
|
|
25766
25985
|
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25767
25986
|
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25768
|
-
const removed = !leftover || removable.installDir !== null && !
|
|
25987
|
+
const removed = !leftover || removable.installDir !== null && !fs26.existsSync(removable.installDir);
|
|
25769
25988
|
if (removed) hasUninstalledPackage = true;
|
|
25770
25989
|
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25771
25990
|
log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
|