@swmansion/argent 0.34.1-next.4 → 0.34.1-next.40
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/LICENSE +1 -0
- package/assets/ios-screen-stream/Info.plist +12 -0
- package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
- 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/simulator-server +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/linux/simulator-server +0 -0
- package/bin/linux-arm64/simulator-server +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/bin/win32/simulator-server.exe +0 -0
- package/dist/cli-cmds.mjs +923 -558
- package/dist/client.js +345 -179
- package/dist/flow-script-runner.mjs +1 -0
- package/dist/installer-help.js +4 -0
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +1219 -922
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentLaunchPerformanceTests.swift +21 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession+Commands.swift +9 -3
- package/dist/mcp-server.mjs +558 -712
- package/dist/preview-ui/index.html +28 -2
- package/dist/tool-args.generated.d.ts +58 -12
- package/dist/tool-server.cjs +11444 -5226
- 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/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 +1 -1
- package/rules/argent.md +6 -23
- package/skills/argent-create-e2e/references/e2e-yaml.md +2 -2
- package/skills/argent-create-e2e/references/live-authoring.md +1 -1
- package/skills/argent-device-interact/SKILL.md +22 -21
- package/skills/argent-device-interact/references/foldables.md +22 -0
- package/skills/argent-ios-device-interact/SKILL.md +2 -2
- package/skills/argent-macos-app-interact/SKILL.md +15 -5
- package/skills/argent-macos-app-interact/references/e2e.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +1 -1
- package/skills/argent-native-profiler/SKILL.md +14 -2
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/SKILL.md +10 -1
- package/skills/argent-react-native-profiler/SKILL.md +4 -3
- package/skills/argent-screen-recording/SKILL.md +3 -2
- package/skills/argent-screenshot-diff/SKILL.md +1 -1
package/dist/installer.mjs
CHANGED
|
@@ -2052,7 +2052,7 @@ var require_parse = __commonJS({
|
|
|
2052
2052
|
"../../node_modules/semver/functions/parse.js"(exports, module) {
|
|
2053
2053
|
"use strict";
|
|
2054
2054
|
var SemVer = require_semver();
|
|
2055
|
-
var
|
|
2055
|
+
var parse5 = (version, options, throwErrors = false) => {
|
|
2056
2056
|
if (version instanceof SemVer) {
|
|
2057
2057
|
return version;
|
|
2058
2058
|
}
|
|
@@ -2065,7 +2065,7 @@ var require_parse = __commonJS({
|
|
|
2065
2065
|
throw er;
|
|
2066
2066
|
}
|
|
2067
2067
|
};
|
|
2068
|
-
module.exports =
|
|
2068
|
+
module.exports = parse5;
|
|
2069
2069
|
}
|
|
2070
2070
|
});
|
|
2071
2071
|
|
|
@@ -2073,9 +2073,9 @@ var require_parse = __commonJS({
|
|
|
2073
2073
|
var require_valid = __commonJS({
|
|
2074
2074
|
"../../node_modules/semver/functions/valid.js"(exports, module) {
|
|
2075
2075
|
"use strict";
|
|
2076
|
-
var
|
|
2076
|
+
var parse5 = require_parse();
|
|
2077
2077
|
var valid = (version, options) => {
|
|
2078
|
-
const v =
|
|
2078
|
+
const v = parse5(version, options);
|
|
2079
2079
|
return v ? v.version : null;
|
|
2080
2080
|
};
|
|
2081
2081
|
module.exports = valid;
|
|
@@ -2086,9 +2086,9 @@ var require_valid = __commonJS({
|
|
|
2086
2086
|
var require_clean = __commonJS({
|
|
2087
2087
|
"../../node_modules/semver/functions/clean.js"(exports, module) {
|
|
2088
2088
|
"use strict";
|
|
2089
|
-
var
|
|
2089
|
+
var parse5 = require_parse();
|
|
2090
2090
|
var clean = (version, options) => {
|
|
2091
|
-
const s =
|
|
2091
|
+
const s = parse5(version.trim().replace(/^[=v]+/, ""), options);
|
|
2092
2092
|
return s ? s.version : null;
|
|
2093
2093
|
};
|
|
2094
2094
|
module.exports = clean;
|
|
@@ -2123,10 +2123,10 @@ var require_inc = __commonJS({
|
|
|
2123
2123
|
var require_diff = __commonJS({
|
|
2124
2124
|
"../../node_modules/semver/functions/diff.js"(exports, module) {
|
|
2125
2125
|
"use strict";
|
|
2126
|
-
var
|
|
2126
|
+
var parse5 = require_parse();
|
|
2127
2127
|
var diff = (version1, version2) => {
|
|
2128
|
-
const v1 =
|
|
2129
|
-
const v2 =
|
|
2128
|
+
const v1 = parse5(version1, null, true);
|
|
2129
|
+
const v2 = parse5(version2, null, true);
|
|
2130
2130
|
const comparison = v1.compare(v2);
|
|
2131
2131
|
if (comparison === 0) {
|
|
2132
2132
|
return null;
|
|
@@ -2197,9 +2197,9 @@ var require_patch = __commonJS({
|
|
|
2197
2197
|
var require_prerelease = __commonJS({
|
|
2198
2198
|
"../../node_modules/semver/functions/prerelease.js"(exports, module) {
|
|
2199
2199
|
"use strict";
|
|
2200
|
-
var
|
|
2200
|
+
var parse5 = require_parse();
|
|
2201
2201
|
var prerelease = (version, options) => {
|
|
2202
|
-
const parsed =
|
|
2202
|
+
const parsed = parse5(version, options);
|
|
2203
2203
|
return parsed && parsed.prerelease.length ? parsed.prerelease : null;
|
|
2204
2204
|
};
|
|
2205
2205
|
module.exports = prerelease;
|
|
@@ -2385,7 +2385,7 @@ var require_coerce = __commonJS({
|
|
|
2385
2385
|
"../../node_modules/semver/functions/coerce.js"(exports, module) {
|
|
2386
2386
|
"use strict";
|
|
2387
2387
|
var SemVer = require_semver();
|
|
2388
|
-
var
|
|
2388
|
+
var parse5 = require_parse();
|
|
2389
2389
|
var { safeRe: re2, t: t2 } = require_re();
|
|
2390
2390
|
var coerce = (version, options) => {
|
|
2391
2391
|
if (version instanceof SemVer) {
|
|
@@ -2420,7 +2420,7 @@ var require_coerce = __commonJS({
|
|
|
2420
2420
|
const patch = match[4] || "0";
|
|
2421
2421
|
const prerelease = options.includePrerelease && match[5] ? `-${match[5]}` : "";
|
|
2422
2422
|
const build = options.includePrerelease && match[6] ? `+${match[6]}` : "";
|
|
2423
|
-
return
|
|
2423
|
+
return parse5(`${major2}.${minor}.${patch}${prerelease}${build}`, options);
|
|
2424
2424
|
};
|
|
2425
2425
|
module.exports = coerce;
|
|
2426
2426
|
}
|
|
@@ -2430,7 +2430,7 @@ var require_coerce = __commonJS({
|
|
|
2430
2430
|
var require_truncate = __commonJS({
|
|
2431
2431
|
"../../node_modules/semver/functions/truncate.js"(exports, module) {
|
|
2432
2432
|
"use strict";
|
|
2433
|
-
var
|
|
2433
|
+
var parse5 = require_parse();
|
|
2434
2434
|
var constants2 = require_constants();
|
|
2435
2435
|
var SemVer = require_semver();
|
|
2436
2436
|
var truncate = (version, truncation, options) => {
|
|
@@ -2442,7 +2442,7 @@ var require_truncate = __commonJS({
|
|
|
2442
2442
|
};
|
|
2443
2443
|
var cloneInputVersion = (version, options) => {
|
|
2444
2444
|
const versionStringToParse = version instanceof SemVer ? version.version : version;
|
|
2445
|
-
return
|
|
2445
|
+
return parse5(versionStringToParse, options);
|
|
2446
2446
|
};
|
|
2447
2447
|
var doTruncation = (version, truncation) => {
|
|
2448
2448
|
if (isPrerelease(truncation)) {
|
|
@@ -3486,7 +3486,7 @@ var require_semver2 = __commonJS({
|
|
|
3486
3486
|
var constants2 = require_constants();
|
|
3487
3487
|
var SemVer = require_semver();
|
|
3488
3488
|
var identifiers = require_identifiers();
|
|
3489
|
-
var
|
|
3489
|
+
var parse5 = require_parse();
|
|
3490
3490
|
var valid = require_valid();
|
|
3491
3491
|
var clean = require_clean();
|
|
3492
3492
|
var inc = require_inc();
|
|
@@ -3525,7 +3525,7 @@ var require_semver2 = __commonJS({
|
|
|
3525
3525
|
var simplifyRange = require_simplify();
|
|
3526
3526
|
var subset = require_subset();
|
|
3527
3527
|
module.exports = {
|
|
3528
|
-
parse:
|
|
3528
|
+
parse: parse5,
|
|
3529
3529
|
valid,
|
|
3530
3530
|
clean,
|
|
3531
3531
|
inc,
|
|
@@ -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, path32) {
|
|
3656
|
+
const ctrl = callVisitor(key, node, visitor, path32);
|
|
3657
3657
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3658
|
-
replaceNode(key,
|
|
3659
|
-
return visit_(key, ctrl, visitor,
|
|
3658
|
+
replaceNode(key, path32, ctrl);
|
|
3659
|
+
return visit_(key, ctrl, visitor, path32);
|
|
3660
3660
|
}
|
|
3661
3661
|
if (typeof ctrl !== "symbol") {
|
|
3662
3662
|
if (identity2.isCollection(node)) {
|
|
3663
|
-
|
|
3663
|
+
path32 = Object.freeze(path32.concat(node));
|
|
3664
3664
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
3665
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
3665
|
+
const ci = visit_(i2, node.items[i2], visitor, path32);
|
|
3666
3666
|
if (typeof ci === "number")
|
|
3667
3667
|
i2 = ci - 1;
|
|
3668
3668
|
else if (ci === BREAK)
|
|
@@ -3673,13 +3673,13 @@ var require_visit = __commonJS({
|
|
|
3673
3673
|
}
|
|
3674
3674
|
}
|
|
3675
3675
|
} else if (identity2.isPair(node)) {
|
|
3676
|
-
|
|
3677
|
-
const ck = visit_("key", node.key, visitor,
|
|
3676
|
+
path32 = Object.freeze(path32.concat(node));
|
|
3677
|
+
const ck = visit_("key", node.key, visitor, path32);
|
|
3678
3678
|
if (ck === BREAK)
|
|
3679
3679
|
return BREAK;
|
|
3680
3680
|
else if (ck === REMOVE)
|
|
3681
3681
|
node.key = null;
|
|
3682
|
-
const cv = visit_("value", node.value, visitor,
|
|
3682
|
+
const cv = visit_("value", node.value, visitor, path32);
|
|
3683
3683
|
if (cv === BREAK)
|
|
3684
3684
|
return BREAK;
|
|
3685
3685
|
else if (cv === REMOVE)
|
|
@@ -3700,17 +3700,17 @@ var require_visit = __commonJS({
|
|
|
3700
3700
|
visitAsync.BREAK = BREAK;
|
|
3701
3701
|
visitAsync.SKIP = SKIP;
|
|
3702
3702
|
visitAsync.REMOVE = REMOVE;
|
|
3703
|
-
async function visitAsync_(key, node, visitor,
|
|
3704
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
3703
|
+
async function visitAsync_(key, node, visitor, path32) {
|
|
3704
|
+
const ctrl = await callVisitor(key, node, visitor, path32);
|
|
3705
3705
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3706
|
-
replaceNode(key,
|
|
3707
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3706
|
+
replaceNode(key, path32, ctrl);
|
|
3707
|
+
return visitAsync_(key, ctrl, visitor, path32);
|
|
3708
3708
|
}
|
|
3709
3709
|
if (typeof ctrl !== "symbol") {
|
|
3710
3710
|
if (identity2.isCollection(node)) {
|
|
3711
|
-
|
|
3711
|
+
path32 = Object.freeze(path32.concat(node));
|
|
3712
3712
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
3713
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
3713
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path32);
|
|
3714
3714
|
if (typeof ci === "number")
|
|
3715
3715
|
i2 = ci - 1;
|
|
3716
3716
|
else if (ci === BREAK)
|
|
@@ -3721,13 +3721,13 @@ var require_visit = __commonJS({
|
|
|
3721
3721
|
}
|
|
3722
3722
|
}
|
|
3723
3723
|
} else if (identity2.isPair(node)) {
|
|
3724
|
-
|
|
3725
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
3724
|
+
path32 = Object.freeze(path32.concat(node));
|
|
3725
|
+
const ck = await visitAsync_("key", node.key, visitor, path32);
|
|
3726
3726
|
if (ck === BREAK)
|
|
3727
3727
|
return BREAK;
|
|
3728
3728
|
else if (ck === REMOVE)
|
|
3729
3729
|
node.key = null;
|
|
3730
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
3730
|
+
const cv = await visitAsync_("value", node.value, visitor, path32);
|
|
3731
3731
|
if (cv === BREAK)
|
|
3732
3732
|
return BREAK;
|
|
3733
3733
|
else if (cv === REMOVE)
|
|
@@ -3754,23 +3754,23 @@ var require_visit = __commonJS({
|
|
|
3754
3754
|
}
|
|
3755
3755
|
return visitor;
|
|
3756
3756
|
}
|
|
3757
|
-
function callVisitor(key, node, visitor,
|
|
3757
|
+
function callVisitor(key, node, visitor, path32) {
|
|
3758
3758
|
if (typeof visitor === "function")
|
|
3759
|
-
return visitor(key, node,
|
|
3759
|
+
return visitor(key, node, path32);
|
|
3760
3760
|
if (identity2.isMap(node))
|
|
3761
|
-
return visitor.Map?.(key, node,
|
|
3761
|
+
return visitor.Map?.(key, node, path32);
|
|
3762
3762
|
if (identity2.isSeq(node))
|
|
3763
|
-
return visitor.Seq?.(key, node,
|
|
3763
|
+
return visitor.Seq?.(key, node, path32);
|
|
3764
3764
|
if (identity2.isPair(node))
|
|
3765
|
-
return visitor.Pair?.(key, node,
|
|
3765
|
+
return visitor.Pair?.(key, node, path32);
|
|
3766
3766
|
if (identity2.isScalar(node))
|
|
3767
|
-
return visitor.Scalar?.(key, node,
|
|
3767
|
+
return visitor.Scalar?.(key, node, path32);
|
|
3768
3768
|
if (identity2.isAlias(node))
|
|
3769
|
-
return visitor.Alias?.(key, node,
|
|
3769
|
+
return visitor.Alias?.(key, node, path32);
|
|
3770
3770
|
return void 0;
|
|
3771
3771
|
}
|
|
3772
|
-
function replaceNode(key,
|
|
3773
|
-
const parent =
|
|
3772
|
+
function replaceNode(key, path32, node) {
|
|
3773
|
+
const parent = path32[path32.length - 1];
|
|
3774
3774
|
if (identity2.isCollection(parent)) {
|
|
3775
3775
|
parent.items[key] = node;
|
|
3776
3776
|
} else if (identity2.isPair(parent)) {
|
|
@@ -4382,10 +4382,10 @@ var require_Collection = __commonJS({
|
|
|
4382
4382
|
var createNode = require_createNode();
|
|
4383
4383
|
var identity2 = require_identity();
|
|
4384
4384
|
var Node = require_Node();
|
|
4385
|
-
function collectionFromPath(schema,
|
|
4385
|
+
function collectionFromPath(schema, path32, value) {
|
|
4386
4386
|
let v = value;
|
|
4387
|
-
for (let i2 =
|
|
4388
|
-
const k =
|
|
4387
|
+
for (let i2 = path32.length - 1; i2 >= 0; --i2) {
|
|
4388
|
+
const k = path32[i2];
|
|
4389
4389
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
4390
4390
|
const a2 = [];
|
|
4391
4391
|
a2[k] = v;
|
|
@@ -4404,7 +4404,7 @@ var require_Collection = __commonJS({
|
|
|
4404
4404
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
4405
4405
|
});
|
|
4406
4406
|
}
|
|
4407
|
-
var isEmptyPath = (
|
|
4407
|
+
var isEmptyPath = (path32) => path32 == null || typeof path32 === "object" && !!path32[Symbol.iterator]().next().done;
|
|
4408
4408
|
var Collection = class extends Node.NodeBase {
|
|
4409
4409
|
constructor(type, schema) {
|
|
4410
4410
|
super(type);
|
|
@@ -4434,11 +4434,11 @@ var require_Collection = __commonJS({
|
|
|
4434
4434
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
4435
4435
|
* that already exists in the map.
|
|
4436
4436
|
*/
|
|
4437
|
-
addIn(
|
|
4438
|
-
if (isEmptyPath(
|
|
4437
|
+
addIn(path32, value) {
|
|
4438
|
+
if (isEmptyPath(path32))
|
|
4439
4439
|
this.add(value);
|
|
4440
4440
|
else {
|
|
4441
|
-
const [key, ...rest] =
|
|
4441
|
+
const [key, ...rest] = path32;
|
|
4442
4442
|
const node = this.get(key, true);
|
|
4443
4443
|
if (identity2.isCollection(node))
|
|
4444
4444
|
node.addIn(rest, value);
|
|
@@ -4452,8 +4452,8 @@ var require_Collection = __commonJS({
|
|
|
4452
4452
|
* Removes a value from the collection.
|
|
4453
4453
|
* @returns `true` if the item was found and removed.
|
|
4454
4454
|
*/
|
|
4455
|
-
deleteIn(
|
|
4456
|
-
const [key, ...rest] =
|
|
4455
|
+
deleteIn(path32) {
|
|
4456
|
+
const [key, ...rest] = path32;
|
|
4457
4457
|
if (rest.length === 0)
|
|
4458
4458
|
return this.delete(key);
|
|
4459
4459
|
const node = this.get(key, true);
|
|
@@ -4467,8 +4467,8 @@ var require_Collection = __commonJS({
|
|
|
4467
4467
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
4468
4468
|
* `true` (collections are always returned intact).
|
|
4469
4469
|
*/
|
|
4470
|
-
getIn(
|
|
4471
|
-
const [key, ...rest] =
|
|
4470
|
+
getIn(path32, keepScalar) {
|
|
4471
|
+
const [key, ...rest] = path32;
|
|
4472
4472
|
const node = this.get(key, true);
|
|
4473
4473
|
if (rest.length === 0)
|
|
4474
4474
|
return !keepScalar && identity2.isScalar(node) ? node.value : node;
|
|
@@ -4486,8 +4486,8 @@ var require_Collection = __commonJS({
|
|
|
4486
4486
|
/**
|
|
4487
4487
|
* Checks if the collection includes a value with the key `key`.
|
|
4488
4488
|
*/
|
|
4489
|
-
hasIn(
|
|
4490
|
-
const [key, ...rest] =
|
|
4489
|
+
hasIn(path32) {
|
|
4490
|
+
const [key, ...rest] = path32;
|
|
4491
4491
|
if (rest.length === 0)
|
|
4492
4492
|
return this.has(key);
|
|
4493
4493
|
const node = this.get(key, true);
|
|
@@ -4497,8 +4497,8 @@ var require_Collection = __commonJS({
|
|
|
4497
4497
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
4498
4498
|
* boolean to add/remove the item from the set.
|
|
4499
4499
|
*/
|
|
4500
|
-
setIn(
|
|
4501
|
-
const [key, ...rest] =
|
|
4500
|
+
setIn(path32, value) {
|
|
4501
|
+
const [key, ...rest] = path32;
|
|
4502
4502
|
if (rest.length === 0) {
|
|
4503
4503
|
this.set(key, value);
|
|
4504
4504
|
} else {
|
|
@@ -7013,9 +7013,9 @@ var require_Document = __commonJS({
|
|
|
7013
7013
|
this.contents.add(value);
|
|
7014
7014
|
}
|
|
7015
7015
|
/** Adds a value to the document. */
|
|
7016
|
-
addIn(
|
|
7016
|
+
addIn(path32, value) {
|
|
7017
7017
|
if (assertCollection(this.contents))
|
|
7018
|
-
this.contents.addIn(
|
|
7018
|
+
this.contents.addIn(path32, value);
|
|
7019
7019
|
}
|
|
7020
7020
|
/**
|
|
7021
7021
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -7090,14 +7090,14 @@ var require_Document = __commonJS({
|
|
|
7090
7090
|
* Removes a value from the document.
|
|
7091
7091
|
* @returns `true` if the item was found and removed.
|
|
7092
7092
|
*/
|
|
7093
|
-
deleteIn(
|
|
7094
|
-
if (Collection.isEmptyPath(
|
|
7093
|
+
deleteIn(path32) {
|
|
7094
|
+
if (Collection.isEmptyPath(path32)) {
|
|
7095
7095
|
if (this.contents == null)
|
|
7096
7096
|
return false;
|
|
7097
7097
|
this.contents = null;
|
|
7098
7098
|
return true;
|
|
7099
7099
|
}
|
|
7100
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
7100
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path32) : false;
|
|
7101
7101
|
}
|
|
7102
7102
|
/**
|
|
7103
7103
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -7112,10 +7112,10 @@ var require_Document = __commonJS({
|
|
|
7112
7112
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
7113
7113
|
* `true` (collections are always returned intact).
|
|
7114
7114
|
*/
|
|
7115
|
-
getIn(
|
|
7116
|
-
if (Collection.isEmptyPath(
|
|
7115
|
+
getIn(path32, keepScalar) {
|
|
7116
|
+
if (Collection.isEmptyPath(path32))
|
|
7117
7117
|
return !keepScalar && identity2.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
7118
|
-
return identity2.isCollection(this.contents) ? this.contents.getIn(
|
|
7118
|
+
return identity2.isCollection(this.contents) ? this.contents.getIn(path32, keepScalar) : void 0;
|
|
7119
7119
|
}
|
|
7120
7120
|
/**
|
|
7121
7121
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -7126,10 +7126,10 @@ var require_Document = __commonJS({
|
|
|
7126
7126
|
/**
|
|
7127
7127
|
* Checks if the document includes a value at `path`.
|
|
7128
7128
|
*/
|
|
7129
|
-
hasIn(
|
|
7130
|
-
if (Collection.isEmptyPath(
|
|
7129
|
+
hasIn(path32) {
|
|
7130
|
+
if (Collection.isEmptyPath(path32))
|
|
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(path32) : false;
|
|
7133
7133
|
}
|
|
7134
7134
|
/**
|
|
7135
7135
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -7146,13 +7146,13 @@ var require_Document = __commonJS({
|
|
|
7146
7146
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
7147
7147
|
* boolean to add/remove the item from the set.
|
|
7148
7148
|
*/
|
|
7149
|
-
setIn(
|
|
7150
|
-
if (Collection.isEmptyPath(
|
|
7149
|
+
setIn(path32, value) {
|
|
7150
|
+
if (Collection.isEmptyPath(path32)) {
|
|
7151
7151
|
this.contents = value;
|
|
7152
7152
|
} else if (this.contents == null) {
|
|
7153
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
7153
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path32), value);
|
|
7154
7154
|
} else if (assertCollection(this.contents)) {
|
|
7155
|
-
this.contents.setIn(
|
|
7155
|
+
this.contents.setIn(path32, value);
|
|
7156
7156
|
}
|
|
7157
7157
|
}
|
|
7158
7158
|
/**
|
|
@@ -7538,10 +7538,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
7538
7538
|
let offset = bm.offset;
|
|
7539
7539
|
let commentEnd = null;
|
|
7540
7540
|
for (const collItem of bm.items) {
|
|
7541
|
-
const { start, key, sep:
|
|
7541
|
+
const { start, key, sep: sep9, value } = collItem;
|
|
7542
7542
|
const keyProps = resolveProps.resolveProps(start, {
|
|
7543
7543
|
indicator: "explicit-key-ind",
|
|
7544
|
-
next: key ??
|
|
7544
|
+
next: key ?? sep9?.[0],
|
|
7545
7545
|
offset,
|
|
7546
7546
|
onError,
|
|
7547
7547
|
parentIndent: bm.indent,
|
|
@@ -7555,7 +7555,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7555
7555
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
7556
7556
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
7557
7557
|
}
|
|
7558
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
7558
|
+
if (!keyProps.anchor && !keyProps.tag && !sep9) {
|
|
7559
7559
|
commentEnd = keyProps.end;
|
|
7560
7560
|
if (keyProps.comment) {
|
|
7561
7561
|
if (map.comment)
|
|
@@ -7579,7 +7579,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7579
7579
|
ctx.atKey = false;
|
|
7580
7580
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
7581
7581
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
7582
|
-
const valueProps = resolveProps.resolveProps(
|
|
7582
|
+
const valueProps = resolveProps.resolveProps(sep9 ?? [], {
|
|
7583
7583
|
indicator: "map-value-ind",
|
|
7584
7584
|
next: value,
|
|
7585
7585
|
offset: keyNode.range[2],
|
|
@@ -7595,7 +7595,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
7595
7595
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
7596
7596
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
7597
7597
|
}
|
|
7598
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
7598
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep9, null, valueProps, onError);
|
|
7599
7599
|
if (ctx.schema.compat)
|
|
7600
7600
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
7601
7601
|
offset = valueNode.range[2];
|
|
@@ -7686,7 +7686,7 @@ var require_resolve_end = __commonJS({
|
|
|
7686
7686
|
let comment = "";
|
|
7687
7687
|
if (end) {
|
|
7688
7688
|
let hasSpace = false;
|
|
7689
|
-
let
|
|
7689
|
+
let sep9 = "";
|
|
7690
7690
|
for (const token of end) {
|
|
7691
7691
|
const { source, type } = token;
|
|
7692
7692
|
switch (type) {
|
|
@@ -7700,13 +7700,13 @@ var require_resolve_end = __commonJS({
|
|
|
7700
7700
|
if (!comment)
|
|
7701
7701
|
comment = cb;
|
|
7702
7702
|
else
|
|
7703
|
-
comment +=
|
|
7704
|
-
|
|
7703
|
+
comment += sep9 + cb;
|
|
7704
|
+
sep9 = "";
|
|
7705
7705
|
break;
|
|
7706
7706
|
}
|
|
7707
7707
|
case "newline":
|
|
7708
7708
|
if (comment)
|
|
7709
|
-
|
|
7709
|
+
sep9 += source;
|
|
7710
7710
|
hasSpace = true;
|
|
7711
7711
|
break;
|
|
7712
7712
|
default:
|
|
@@ -7749,18 +7749,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7749
7749
|
let offset = fc.offset + fc.start.source.length;
|
|
7750
7750
|
for (let i2 = 0; i2 < fc.items.length; ++i2) {
|
|
7751
7751
|
const collItem = fc.items[i2];
|
|
7752
|
-
const { start, key, sep:
|
|
7752
|
+
const { start, key, sep: sep9, value } = collItem;
|
|
7753
7753
|
const props = resolveProps.resolveProps(start, {
|
|
7754
7754
|
flow: fcName,
|
|
7755
7755
|
indicator: "explicit-key-ind",
|
|
7756
|
-
next: key ??
|
|
7756
|
+
next: key ?? sep9?.[0],
|
|
7757
7757
|
offset,
|
|
7758
7758
|
onError,
|
|
7759
7759
|
parentIndent: fc.indent,
|
|
7760
7760
|
startOnNewline: false
|
|
7761
7761
|
});
|
|
7762
7762
|
if (!props.found) {
|
|
7763
|
-
if (!props.anchor && !props.tag && !
|
|
7763
|
+
if (!props.anchor && !props.tag && !sep9 && !value) {
|
|
7764
7764
|
if (i2 === 0 && props.comma)
|
|
7765
7765
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
7766
7766
|
else if (i2 < fc.items.length - 1)
|
|
@@ -7814,8 +7814,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7814
7814
|
}
|
|
7815
7815
|
}
|
|
7816
7816
|
}
|
|
7817
|
-
if (!isMap2 && !
|
|
7818
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
7817
|
+
if (!isMap2 && !sep9 && !props.found) {
|
|
7818
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep9, null, props, onError);
|
|
7819
7819
|
coll.items.push(valueNode);
|
|
7820
7820
|
offset = valueNode.range[2];
|
|
7821
7821
|
if (isBlock(value))
|
|
@@ -7827,7 +7827,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7827
7827
|
if (isBlock(key))
|
|
7828
7828
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
7829
7829
|
ctx.atKey = false;
|
|
7830
|
-
const valueProps = resolveProps.resolveProps(
|
|
7830
|
+
const valueProps = resolveProps.resolveProps(sep9 ?? [], {
|
|
7831
7831
|
flow: fcName,
|
|
7832
7832
|
indicator: "map-value-ind",
|
|
7833
7833
|
next: value,
|
|
@@ -7838,8 +7838,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7838
7838
|
});
|
|
7839
7839
|
if (valueProps.found) {
|
|
7840
7840
|
if (!isMap2 && !props.found && ctx.options.strict) {
|
|
7841
|
-
if (
|
|
7842
|
-
for (const st of
|
|
7841
|
+
if (sep9)
|
|
7842
|
+
for (const st of sep9) {
|
|
7843
7843
|
if (st === valueProps.found)
|
|
7844
7844
|
break;
|
|
7845
7845
|
if (st.type === "newline") {
|
|
@@ -7856,7 +7856,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
7856
7856
|
else
|
|
7857
7857
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
7858
7858
|
}
|
|
7859
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
7859
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep9, null, valueProps, onError) : null;
|
|
7860
7860
|
if (valueNode) {
|
|
7861
7861
|
if (isBlock(value))
|
|
7862
7862
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -8036,7 +8036,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
8036
8036
|
chompStart = i2 + 1;
|
|
8037
8037
|
}
|
|
8038
8038
|
let value = "";
|
|
8039
|
-
let
|
|
8039
|
+
let sep9 = "";
|
|
8040
8040
|
let prevMoreIndented = false;
|
|
8041
8041
|
for (let i2 = 0; i2 < contentStart; ++i2)
|
|
8042
8042
|
value += lines[i2][0].slice(trimIndent) + "\n";
|
|
@@ -8053,24 +8053,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
8053
8053
|
indent = "";
|
|
8054
8054
|
}
|
|
8055
8055
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
8056
|
-
value +=
|
|
8057
|
-
|
|
8056
|
+
value += sep9 + indent.slice(trimIndent) + content;
|
|
8057
|
+
sep9 = "\n";
|
|
8058
8058
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
8059
|
-
if (
|
|
8060
|
-
|
|
8061
|
-
else if (!prevMoreIndented &&
|
|
8062
|
-
|
|
8063
|
-
value +=
|
|
8064
|
-
|
|
8059
|
+
if (sep9 === " ")
|
|
8060
|
+
sep9 = "\n";
|
|
8061
|
+
else if (!prevMoreIndented && sep9 === "\n")
|
|
8062
|
+
sep9 = "\n\n";
|
|
8063
|
+
value += sep9 + indent.slice(trimIndent) + content;
|
|
8064
|
+
sep9 = "\n";
|
|
8065
8065
|
prevMoreIndented = true;
|
|
8066
8066
|
} else if (content === "") {
|
|
8067
|
-
if (
|
|
8067
|
+
if (sep9 === "\n")
|
|
8068
8068
|
value += "\n";
|
|
8069
8069
|
else
|
|
8070
|
-
|
|
8070
|
+
sep9 = "\n";
|
|
8071
8071
|
} else {
|
|
8072
|
-
value +=
|
|
8073
|
-
|
|
8072
|
+
value += sep9 + content;
|
|
8073
|
+
sep9 = " ";
|
|
8074
8074
|
prevMoreIndented = false;
|
|
8075
8075
|
}
|
|
8076
8076
|
}
|
|
@@ -8253,25 +8253,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
8253
8253
|
trimBoth = /^[ \t]+|[ \t]+$/g;
|
|
8254
8254
|
}
|
|
8255
8255
|
let res = match[1].replace(trimEnd, "");
|
|
8256
|
-
let
|
|
8256
|
+
let sep9 = " ";
|
|
8257
8257
|
let pos = line.lastIndex;
|
|
8258
8258
|
while (match = line.exec(source)) {
|
|
8259
8259
|
const lm = match[1].replace(trimBoth, "");
|
|
8260
8260
|
if (lm === "") {
|
|
8261
|
-
if (
|
|
8262
|
-
res +=
|
|
8261
|
+
if (sep9 === "\n")
|
|
8262
|
+
res += sep9;
|
|
8263
8263
|
else
|
|
8264
|
-
|
|
8264
|
+
sep9 = "\n";
|
|
8265
8265
|
} else {
|
|
8266
|
-
res +=
|
|
8267
|
-
|
|
8266
|
+
res += sep9 + lm;
|
|
8267
|
+
sep9 = " ";
|
|
8268
8268
|
}
|
|
8269
8269
|
pos = line.lastIndex;
|
|
8270
8270
|
}
|
|
8271
8271
|
const last = /[ \t]*(.*)/sy;
|
|
8272
8272
|
last.lastIndex = pos;
|
|
8273
8273
|
match = last.exec(source);
|
|
8274
|
-
return res +
|
|
8274
|
+
return res + sep9 + (match?.[1] ?? "");
|
|
8275
8275
|
}
|
|
8276
8276
|
function doubleQuotedValue(source, onError) {
|
|
8277
8277
|
let res = "";
|
|
@@ -9081,14 +9081,14 @@ var require_cst_stringify = __commonJS({
|
|
|
9081
9081
|
}
|
|
9082
9082
|
}
|
|
9083
9083
|
}
|
|
9084
|
-
function stringifyItem({ start, key, sep:
|
|
9084
|
+
function stringifyItem({ start, key, sep: sep9, value }) {
|
|
9085
9085
|
let res = "";
|
|
9086
9086
|
for (const st of start)
|
|
9087
9087
|
res += st.source;
|
|
9088
9088
|
if (key)
|
|
9089
9089
|
res += stringifyToken(key);
|
|
9090
|
-
if (
|
|
9091
|
-
for (const st of
|
|
9090
|
+
if (sep9)
|
|
9091
|
+
for (const st of sep9)
|
|
9092
9092
|
res += st.source;
|
|
9093
9093
|
if (value)
|
|
9094
9094
|
res += stringifyToken(value);
|
|
@@ -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, path32) => {
|
|
9117
9117
|
let item = cst;
|
|
9118
|
-
for (const [field, index] of
|
|
9118
|
+
for (const [field, index] of path32) {
|
|
9119
9119
|
const tok = item?.[field];
|
|
9120
9120
|
if (tok && "items" in tok) {
|
|
9121
9121
|
item = tok.items[index];
|
|
@@ -9124,23 +9124,23 @@ var require_cst_visit = __commonJS({
|
|
|
9124
9124
|
}
|
|
9125
9125
|
return item;
|
|
9126
9126
|
};
|
|
9127
|
-
visit2.parentCollection = (cst,
|
|
9128
|
-
const parent = visit2.itemAtPath(cst,
|
|
9129
|
-
const field =
|
|
9127
|
+
visit2.parentCollection = (cst, path32) => {
|
|
9128
|
+
const parent = visit2.itemAtPath(cst, path32.slice(0, -1));
|
|
9129
|
+
const field = path32[path32.length - 1][0];
|
|
9130
9130
|
const coll = parent?.[field];
|
|
9131
9131
|
if (coll && "items" in coll)
|
|
9132
9132
|
return coll;
|
|
9133
9133
|
throw new Error("Parent collection not found");
|
|
9134
9134
|
};
|
|
9135
|
-
function _visit(
|
|
9136
|
-
let ctrl = visitor(item,
|
|
9135
|
+
function _visit(path32, item, visitor) {
|
|
9136
|
+
let ctrl = visitor(item, path32);
|
|
9137
9137
|
if (typeof ctrl === "symbol")
|
|
9138
9138
|
return ctrl;
|
|
9139
9139
|
for (const field of ["key", "value"]) {
|
|
9140
9140
|
const token = item[field];
|
|
9141
9141
|
if (token && "items" in token) {
|
|
9142
9142
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
9143
|
-
const ci = _visit(Object.freeze(
|
|
9143
|
+
const ci = _visit(Object.freeze(path32.concat([[field, i2]])), token.items[i2], visitor);
|
|
9144
9144
|
if (typeof ci === "number")
|
|
9145
9145
|
i2 = ci - 1;
|
|
9146
9146
|
else if (ci === BREAK)
|
|
@@ -9151,10 +9151,10 @@ var require_cst_visit = __commonJS({
|
|
|
9151
9151
|
}
|
|
9152
9152
|
}
|
|
9153
9153
|
if (typeof ctrl === "function" && field === "key")
|
|
9154
|
-
ctrl = ctrl(item,
|
|
9154
|
+
ctrl = ctrl(item, path32);
|
|
9155
9155
|
}
|
|
9156
9156
|
}
|
|
9157
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
9157
|
+
return typeof ctrl === "function" ? ctrl(item, path32) : ctrl;
|
|
9158
9158
|
}
|
|
9159
9159
|
exports.visit = visit2;
|
|
9160
9160
|
}
|
|
@@ -10255,18 +10255,18 @@ var require_parser = __commonJS({
|
|
|
10255
10255
|
if (this.type === "map-value-ind") {
|
|
10256
10256
|
const prev = getPrevProps(this.peek(2));
|
|
10257
10257
|
const start = getFirstKeyStartProps(prev);
|
|
10258
|
-
let
|
|
10258
|
+
let sep9;
|
|
10259
10259
|
if (scalar.end) {
|
|
10260
|
-
|
|
10261
|
-
|
|
10260
|
+
sep9 = scalar.end;
|
|
10261
|
+
sep9.push(this.sourceToken);
|
|
10262
10262
|
delete scalar.end;
|
|
10263
10263
|
} else
|
|
10264
|
-
|
|
10264
|
+
sep9 = [this.sourceToken];
|
|
10265
10265
|
const map = {
|
|
10266
10266
|
type: "block-map",
|
|
10267
10267
|
offset: scalar.offset,
|
|
10268
10268
|
indent: scalar.indent,
|
|
10269
|
-
items: [{ start, key: scalar, sep:
|
|
10269
|
+
items: [{ start, key: scalar, sep: sep9 }]
|
|
10270
10270
|
};
|
|
10271
10271
|
this.onKeyLine = true;
|
|
10272
10272
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -10419,15 +10419,15 @@ var require_parser = __commonJS({
|
|
|
10419
10419
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
10420
10420
|
const start2 = getFirstKeyStartProps(it.start);
|
|
10421
10421
|
const key = it.key;
|
|
10422
|
-
const
|
|
10423
|
-
|
|
10422
|
+
const sep9 = it.sep;
|
|
10423
|
+
sep9.push(this.sourceToken);
|
|
10424
10424
|
delete it.key;
|
|
10425
10425
|
delete it.sep;
|
|
10426
10426
|
this.stack.push({
|
|
10427
10427
|
type: "block-map",
|
|
10428
10428
|
offset: this.offset,
|
|
10429
10429
|
indent: this.indent,
|
|
10430
|
-
items: [{ start: start2, key, sep:
|
|
10430
|
+
items: [{ start: start2, key, sep: sep9 }]
|
|
10431
10431
|
});
|
|
10432
10432
|
} else if (start.length > 0) {
|
|
10433
10433
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -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 fs25 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs25, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs25);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs25, 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 fs25 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs25, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs25);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs25, sep: [] });
|
|
10601
10601
|
return;
|
|
10602
10602
|
}
|
|
10603
10603
|
case "flow-map-end":
|
|
@@ -10621,13 +10621,13 @@ var require_parser = __commonJS({
|
|
|
10621
10621
|
const prev = getPrevProps(parent);
|
|
10622
10622
|
const start = getFirstKeyStartProps(prev);
|
|
10623
10623
|
fixFlowSeqItems(fc);
|
|
10624
|
-
const
|
|
10625
|
-
|
|
10624
|
+
const sep9 = fc.end.splice(1, fc.end.length);
|
|
10625
|
+
sep9.push(this.sourceToken);
|
|
10626
10626
|
const map = {
|
|
10627
10627
|
type: "block-map",
|
|
10628
10628
|
offset: fc.offset,
|
|
10629
10629
|
indent: fc.indent,
|
|
10630
|
-
items: [{ start, key: fc, sep:
|
|
10630
|
+
items: [{ start, key: fc, sep: sep9 }]
|
|
10631
10631
|
};
|
|
10632
10632
|
this.onKeyLine = true;
|
|
10633
10633
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -10805,7 +10805,7 @@ var require_public_api = __commonJS({
|
|
|
10805
10805
|
}
|
|
10806
10806
|
return doc;
|
|
10807
10807
|
}
|
|
10808
|
-
function
|
|
10808
|
+
function parse5(src, reviver, options) {
|
|
10809
10809
|
let _reviver = void 0;
|
|
10810
10810
|
if (typeof reviver === "function") {
|
|
10811
10811
|
_reviver = reviver;
|
|
@@ -10846,7 +10846,7 @@ var require_public_api = __commonJS({
|
|
|
10846
10846
|
return value.toString(options);
|
|
10847
10847
|
return new Document2.Document(value, _replacer, options).toString(options);
|
|
10848
10848
|
}
|
|
10849
|
-
exports.parse =
|
|
10849
|
+
exports.parse = parse5;
|
|
10850
10850
|
exports.parseAllDocuments = parseAllDocuments;
|
|
10851
10851
|
exports.parseDocument = parseDocument2;
|
|
10852
10852
|
exports.stringify = stringify2;
|
|
@@ -11007,29 +11007,29 @@ var require_min_release_age = __commonJS({
|
|
|
11007
11007
|
const days = Number(override);
|
|
11008
11008
|
return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
|
|
11009
11009
|
}
|
|
11010
|
-
function probe(p) {
|
|
11011
|
-
return new Promise((
|
|
11012
|
-
(0, node_child_process_1.exec)(p.command, { timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
|
|
11010
|
+
function probe(p, cwd) {
|
|
11011
|
+
return new Promise((resolve21) => {
|
|
11012
|
+
(0, node_child_process_1.exec)(p.command, { cwd, timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
|
|
11013
11013
|
if (err) {
|
|
11014
|
-
|
|
11014
|
+
resolve21(0);
|
|
11015
11015
|
return;
|
|
11016
11016
|
}
|
|
11017
|
-
|
|
11017
|
+
resolve21(p.parse(stdout2));
|
|
11018
11018
|
});
|
|
11019
11019
|
});
|
|
11020
11020
|
}
|
|
11021
|
-
async function detectMinReleaseAgeMsForPm2(pm) {
|
|
11021
|
+
async function detectMinReleaseAgeMsForPm2(pm, cwd) {
|
|
11022
11022
|
const override = overrideMs();
|
|
11023
11023
|
if (override !== null)
|
|
11024
11024
|
return override;
|
|
11025
11025
|
const p = PM_PROBES[pm];
|
|
11026
|
-
return p ? probe(p) : 0;
|
|
11026
|
+
return p ? probe(p, cwd) : 0;
|
|
11027
11027
|
}
|
|
11028
11028
|
async function detectMinReleaseAgeMs() {
|
|
11029
11029
|
const override = overrideMs();
|
|
11030
11030
|
if (override !== null)
|
|
11031
11031
|
return override;
|
|
11032
|
-
const ages = await Promise.all(Object.values(PM_PROBES).map(probe));
|
|
11032
|
+
const ages = await Promise.all(Object.values(PM_PROBES).map((p) => probe(p)));
|
|
11033
11033
|
return ages.reduce((max, ms) => Math.max(max, ms), 0);
|
|
11034
11034
|
}
|
|
11035
11035
|
}
|
|
@@ -11047,12 +11047,12 @@ var require_registry = __commonJS({
|
|
|
11047
11047
|
var node_https_1 = __importDefault(__require("node:https"));
|
|
11048
11048
|
var REQUEST_TIMEOUT_MS = 1e4;
|
|
11049
11049
|
function fetchRegistryInfo2(url) {
|
|
11050
|
-
return new Promise((
|
|
11050
|
+
return new Promise((resolve21) => {
|
|
11051
11051
|
let resolved = false;
|
|
11052
11052
|
const safeResolve = (value) => {
|
|
11053
11053
|
if (!resolved) {
|
|
11054
11054
|
resolved = true;
|
|
11055
|
-
|
|
11055
|
+
resolve21(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((resolve21, reject) => {
|
|
12996
|
+
this._resolve = resolve21;
|
|
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((resolve21) => {
|
|
13890
|
+
this._exportScheduledResolve = resolve21;
|
|
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((resolve21, 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
|
+
resolve21();
|
|
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((resolve21) => {
|
|
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
|
+
resolve21({ 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
|
+
resolve21({
|
|
14732
14732
|
status: "success",
|
|
14733
14733
|
data: Buffer.concat(responseData)
|
|
14734
14734
|
});
|
|
14735
14735
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14736
|
-
|
|
14736
|
+
resolve21({
|
|
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
|
+
resolve21({
|
|
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
|
+
resolve21({
|
|
14751
14751
|
status: "success"
|
|
14752
14752
|
});
|
|
14753
14753
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14754
|
-
|
|
14754
|
+
resolve21({
|
|
14755
14755
|
status: "retryable",
|
|
14756
14756
|
error,
|
|
14757
14757
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
14758
14758
|
});
|
|
14759
14759
|
} else {
|
|
14760
|
-
|
|
14760
|
+
resolve21({
|
|
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
|
+
resolve21({
|
|
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
|
+
resolve21({
|
|
14777
14777
|
status: "retryable",
|
|
14778
14778
|
error
|
|
14779
14779
|
});
|
|
14780
14780
|
} else {
|
|
14781
|
-
|
|
14781
|
+
resolve21({
|
|
14782
14782
|
status: "failure",
|
|
14783
14783
|
error
|
|
14784
14784
|
});
|
|
14785
14785
|
}
|
|
14786
14786
|
});
|
|
14787
14787
|
compressAndSend(req, compression, data, (error) => {
|
|
14788
|
-
|
|
14788
|
+
resolve21({
|
|
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((resolve21, reject) => {
|
|
14879
14879
|
setTimeout(() => {
|
|
14880
|
-
this._transport.send(data, timeoutMillis).then(
|
|
14880
|
+
this._transport.send(data, timeoutMillis).then(resolve21, 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, path32) {
|
|
15016
15016
|
try {
|
|
15017
15017
|
new URL(url);
|
|
15018
15018
|
} catch {
|
|
@@ -15022,11 +15022,11 @@ function appendResourcePathToUrl(url, path30) {
|
|
|
15022
15022
|
if (!url.endsWith("/")) {
|
|
15023
15023
|
url = url + "/";
|
|
15024
15024
|
}
|
|
15025
|
-
url +=
|
|
15025
|
+
url += path32;
|
|
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 '${path32}' is not a valid URL, using 'undefined' instead of '${url}'`);
|
|
15030
15030
|
return void 0;
|
|
15031
15031
|
}
|
|
15032
15032
|
return url;
|
|
@@ -15137,7 +15137,7 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
15137
15137
|
init_esm();
|
|
15138
15138
|
|
|
15139
15139
|
// ../telemetry/src/debug.ts
|
|
15140
|
-
import * as
|
|
15140
|
+
import * as fs6 from "node:fs";
|
|
15141
15141
|
|
|
15142
15142
|
// ../telemetry/src/paths.ts
|
|
15143
15143
|
import * as path7 from "node:path";
|
|
@@ -15163,6 +15163,7 @@ function resolveProjectRoot(startDir) {
|
|
|
15163
15163
|
}
|
|
15164
15164
|
|
|
15165
15165
|
// ../configuration-core/src/paths.ts
|
|
15166
|
+
import * as fs3 from "node:fs";
|
|
15166
15167
|
import * as os from "node:os";
|
|
15167
15168
|
import * as path3 from "node:path";
|
|
15168
15169
|
function nonEmpty(value) {
|
|
@@ -15174,6 +15175,16 @@ function resolveHomeDir(options = {}) {
|
|
|
15174
15175
|
if (options.homeDir) return options.homeDir;
|
|
15175
15176
|
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
15176
15177
|
}
|
|
15178
|
+
function isHomeDir(dir, options = {}) {
|
|
15179
|
+
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
15180
|
+
}
|
|
15181
|
+
function canonicalPath(p) {
|
|
15182
|
+
try {
|
|
15183
|
+
return fs3.realpathSync.native(p);
|
|
15184
|
+
} catch {
|
|
15185
|
+
return path3.resolve(p);
|
|
15186
|
+
}
|
|
15187
|
+
}
|
|
15177
15188
|
function argentHomeDir() {
|
|
15178
15189
|
return path3.join(resolveHomeDir(), ".argent");
|
|
15179
15190
|
}
|
|
@@ -15190,11 +15201,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
15190
15201
|
|
|
15191
15202
|
// ../configuration-core/src/config.ts
|
|
15192
15203
|
import * as crypto from "node:crypto";
|
|
15193
|
-
import * as
|
|
15204
|
+
import * as fs4 from "node:fs";
|
|
15194
15205
|
import * as path4 from "node:path";
|
|
15195
15206
|
function readConfigObject(scope = "global", options = {}) {
|
|
15196
15207
|
try {
|
|
15197
|
-
const raw =
|
|
15208
|
+
const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
15198
15209
|
const json = JSON.parse(raw);
|
|
15199
15210
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
15200
15211
|
return json;
|
|
@@ -15203,31 +15214,6 @@ function readConfigObject(scope = "global", options = {}) {
|
|
|
15203
15214
|
}
|
|
15204
15215
|
return {};
|
|
15205
15216
|
}
|
|
15206
|
-
var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
15207
|
-
function splitKey(dottedKey) {
|
|
15208
|
-
const parts = dottedKey.split(".");
|
|
15209
|
-
if (parts.length === 0 || parts.some((p) => p === "")) {
|
|
15210
|
-
throw new Error(`Invalid config key "${dottedKey}": empty path segment`);
|
|
15211
|
-
}
|
|
15212
|
-
for (const p of parts) {
|
|
15213
|
-
if (FORBIDDEN_SEGMENTS.has(p)) {
|
|
15214
|
-
throw new Error(`Invalid config key "${dottedKey}": forbidden segment "${p}"`);
|
|
15215
|
-
}
|
|
15216
|
-
}
|
|
15217
|
-
return parts;
|
|
15218
|
-
}
|
|
15219
|
-
function isPlainObject(value) {
|
|
15220
|
-
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
15221
|
-
}
|
|
15222
|
-
function getAtPath(obj, dottedKey) {
|
|
15223
|
-
const parts = splitKey(dottedKey);
|
|
15224
|
-
let cur = obj;
|
|
15225
|
-
for (const part of parts) {
|
|
15226
|
-
if (!isPlainObject(cur)) return void 0;
|
|
15227
|
-
cur = cur[part];
|
|
15228
|
-
}
|
|
15229
|
-
return cur;
|
|
15230
|
-
}
|
|
15231
15217
|
var LOCK_STALE_MS = 1e4;
|
|
15232
15218
|
var LOCK_MAX_WAIT_MS = 2e3;
|
|
15233
15219
|
var LOCK_RETRY_MS = 25;
|
|
@@ -15239,9 +15225,9 @@ function acquireConfigLock(finalPath) {
|
|
|
15239
15225
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
15240
15226
|
for (; ; ) {
|
|
15241
15227
|
try {
|
|
15242
|
-
const fd =
|
|
15228
|
+
const fd = fs4.openSync(lockPath, "wx", 384);
|
|
15243
15229
|
try {
|
|
15244
|
-
|
|
15230
|
+
fs4.writeSync(fd, `${process.pid}
|
|
15245
15231
|
`);
|
|
15246
15232
|
} catch {
|
|
15247
15233
|
}
|
|
@@ -15249,8 +15235,8 @@ function acquireConfigLock(finalPath) {
|
|
|
15249
15235
|
} catch (err) {
|
|
15250
15236
|
if (err.code !== "EEXIST") return null;
|
|
15251
15237
|
try {
|
|
15252
|
-
if (Date.now() -
|
|
15253
|
-
|
|
15238
|
+
if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
|
|
15239
|
+
fs4.unlinkSync(lockPath);
|
|
15254
15240
|
continue;
|
|
15255
15241
|
}
|
|
15256
15242
|
} catch {
|
|
@@ -15262,35 +15248,35 @@ function acquireConfigLock(finalPath) {
|
|
|
15262
15248
|
}
|
|
15263
15249
|
function releaseConfigLock(lock) {
|
|
15264
15250
|
try {
|
|
15265
|
-
|
|
15251
|
+
fs4.closeSync(lock.fd);
|
|
15266
15252
|
} catch {
|
|
15267
15253
|
}
|
|
15268
15254
|
try {
|
|
15269
|
-
|
|
15255
|
+
fs4.unlinkSync(lock.lockPath);
|
|
15270
15256
|
} catch {
|
|
15271
15257
|
}
|
|
15272
15258
|
}
|
|
15273
15259
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
15274
15260
|
const dir = configDir(scope, options);
|
|
15275
|
-
|
|
15261
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
15276
15262
|
const finalPath = configFilePath(scope, options);
|
|
15277
15263
|
const lock = acquireConfigLock(finalPath);
|
|
15278
15264
|
try {
|
|
15279
15265
|
const next = readConfigObject(scope, options);
|
|
15280
15266
|
mutate(next);
|
|
15281
15267
|
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
15282
|
-
const fd =
|
|
15268
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
15283
15269
|
try {
|
|
15284
|
-
|
|
15285
|
-
|
|
15270
|
+
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
15271
|
+
fs4.fsyncSync(fd);
|
|
15286
15272
|
} finally {
|
|
15287
|
-
|
|
15273
|
+
fs4.closeSync(fd);
|
|
15288
15274
|
}
|
|
15289
15275
|
try {
|
|
15290
|
-
|
|
15276
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
15291
15277
|
} catch (err) {
|
|
15292
15278
|
try {
|
|
15293
|
-
|
|
15279
|
+
fs4.unlinkSync(tmpPath);
|
|
15294
15280
|
} catch {
|
|
15295
15281
|
}
|
|
15296
15282
|
throw err;
|
|
@@ -15302,60 +15288,9 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
15302
15288
|
|
|
15303
15289
|
// ../configuration-core/src/secrets.ts
|
|
15304
15290
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
15305
|
-
import * as
|
|
15291
|
+
import * as fs5 from "node:fs";
|
|
15306
15292
|
import * as path5 from "node:path";
|
|
15307
15293
|
|
|
15308
|
-
// ../configuration-core/src/merge.ts
|
|
15309
|
-
function mergeRestrictive(local, global2) {
|
|
15310
|
-
if (local === void 0) return global2;
|
|
15311
|
-
if (global2 === void 0) return local;
|
|
15312
|
-
if (typeof local === "boolean" && typeof global2 === "boolean") {
|
|
15313
|
-
return local && global2;
|
|
15314
|
-
}
|
|
15315
|
-
if (typeof local === "number" && typeof global2 === "number") {
|
|
15316
|
-
return Math.min(local, global2);
|
|
15317
|
-
}
|
|
15318
|
-
return local;
|
|
15319
|
-
}
|
|
15320
|
-
function toArray(value) {
|
|
15321
|
-
return Array.isArray(value) ? value : null;
|
|
15322
|
-
}
|
|
15323
|
-
function mergeUnion(local, global2) {
|
|
15324
|
-
const l2 = toArray(local);
|
|
15325
|
-
const g = toArray(global2);
|
|
15326
|
-
if (l2 === null && g === null) return local ?? global2;
|
|
15327
|
-
const merged = [...g ?? [], ...l2 ?? []];
|
|
15328
|
-
return Array.from(new Set(merged));
|
|
15329
|
-
}
|
|
15330
|
-
function mergeIntersection(local, global2) {
|
|
15331
|
-
const l2 = toArray(local);
|
|
15332
|
-
const g = toArray(global2);
|
|
15333
|
-
if (l2 === null && g === null) return local ?? global2;
|
|
15334
|
-
if (l2 === null) return global2;
|
|
15335
|
-
if (g === null) return local;
|
|
15336
|
-
const globalSet = new Set(g);
|
|
15337
|
-
return l2.filter((item) => globalSet.has(item));
|
|
15338
|
-
}
|
|
15339
|
-
function applyMergePolicy(policy, local, global2) {
|
|
15340
|
-
if (typeof policy === "function") return policy({ local, global: global2 });
|
|
15341
|
-
switch (policy) {
|
|
15342
|
-
case "prioritize-local":
|
|
15343
|
-
return local ?? global2;
|
|
15344
|
-
case "prioritize-global":
|
|
15345
|
-
return global2 ?? local;
|
|
15346
|
-
case "prioritize-restrictive":
|
|
15347
|
-
return mergeRestrictive(local, global2);
|
|
15348
|
-
case "union":
|
|
15349
|
-
return mergeUnion(local, global2);
|
|
15350
|
-
case "intersection":
|
|
15351
|
-
return mergeIntersection(local, global2);
|
|
15352
|
-
default: {
|
|
15353
|
-
const _exhaustive = policy;
|
|
15354
|
-
return _exhaustive;
|
|
15355
|
-
}
|
|
15356
|
-
}
|
|
15357
|
-
}
|
|
15358
|
-
|
|
15359
15294
|
// ../configuration-core/src/config-schema.ts
|
|
15360
15295
|
import { isAbsolute } from "node:path";
|
|
15361
15296
|
function asBoolean(raw) {
|
|
@@ -15393,14 +15328,6 @@ var CONFIG_SCHEMA = [
|
|
|
15393
15328
|
// drained/reset, not just the file rewritten.
|
|
15394
15329
|
manageCommand: "argent telemetry"
|
|
15395
15330
|
},
|
|
15396
|
-
{
|
|
15397
|
-
key: "allowlist.enabled",
|
|
15398
|
-
description: "Whether `argent update` re-applies editor auto-approve allowlist rules. Unset (the default) keeps the current behavior: update refreshes the rules for editors that already have argent configured. Set to `false` to keep update from touching editor allowlists. `false` in either scope wins, so a committed project opt-out holds for every teammate.",
|
|
15399
|
-
scopes: ["project", "global"],
|
|
15400
|
-
parse: asBoolean,
|
|
15401
|
-
merge: "prioritize-restrictive",
|
|
15402
|
-
example: "false"
|
|
15403
|
-
},
|
|
15404
15331
|
{
|
|
15405
15332
|
key: "lens.agent",
|
|
15406
15333
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
@@ -15484,42 +15411,9 @@ var CONFIG_SCHEMA = [
|
|
|
15484
15411
|
example: "512"
|
|
15485
15412
|
}
|
|
15486
15413
|
];
|
|
15487
|
-
function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
15488
|
-
return registry.find((def) => def.key === key);
|
|
15489
|
-
}
|
|
15490
15414
|
|
|
15491
15415
|
// ../configuration-core/src/config-access.ts
|
|
15492
15416
|
import * as path6 from "node:path";
|
|
15493
|
-
function readScopeValue(def, scope, options) {
|
|
15494
|
-
if (!def.scopes.includes(scope)) return void 0;
|
|
15495
|
-
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
15496
|
-
return raw === void 0 ? void 0 : def.parse(raw);
|
|
15497
|
-
}
|
|
15498
|
-
function getConfigValue(def, options = {}) {
|
|
15499
|
-
const local = readScopeValue(def, "project", options);
|
|
15500
|
-
const global2 = readScopeValue(def, "global", options);
|
|
15501
|
-
const merged = applyMergePolicy(def.merge, local, global2);
|
|
15502
|
-
return merged ?? def.default;
|
|
15503
|
-
}
|
|
15504
|
-
function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
|
|
15505
|
-
const def = requireDefinition(key, registry);
|
|
15506
|
-
return getConfigValue(def, options);
|
|
15507
|
-
}
|
|
15508
|
-
function requireDefinition(key, registry = CONFIG_SCHEMA) {
|
|
15509
|
-
const def = getConfigDefinition(key, registry);
|
|
15510
|
-
if (!def) {
|
|
15511
|
-
throw new UnknownConfigKeyError(key);
|
|
15512
|
-
}
|
|
15513
|
-
return def;
|
|
15514
|
-
}
|
|
15515
|
-
var UnknownConfigKeyError = class extends Error {
|
|
15516
|
-
constructor(key) {
|
|
15517
|
-
super(`Unknown configuration key "${key}".`);
|
|
15518
|
-
this.key = key;
|
|
15519
|
-
this.name = "UnknownConfigKeyError";
|
|
15520
|
-
}
|
|
15521
|
-
key;
|
|
15522
|
-
};
|
|
15523
15417
|
|
|
15524
15418
|
// ../telemetry/src/paths.ts
|
|
15525
15419
|
function identityFilePath() {
|
|
@@ -15556,8 +15450,8 @@ function emitDebugPayload(payload) {
|
|
|
15556
15450
|
} catch {
|
|
15557
15451
|
}
|
|
15558
15452
|
try {
|
|
15559
|
-
|
|
15560
|
-
|
|
15453
|
+
fs6.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15454
|
+
fs6.appendFileSync(debugLogPath(), line + "\n");
|
|
15561
15455
|
} catch {
|
|
15562
15456
|
}
|
|
15563
15457
|
}
|
|
@@ -15740,12 +15634,16 @@ var SCRIPT_FILE_NAME_PATTERN = new RegExp(
|
|
|
15740
15634
|
`^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
|
|
15741
15635
|
);
|
|
15742
15636
|
|
|
15637
|
+
// ../registry/src/flow-platforms.ts
|
|
15638
|
+
var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
15639
|
+
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15640
|
+
|
|
15743
15641
|
// ../registry/src/flow-file-refs.ts
|
|
15744
|
-
import * as
|
|
15642
|
+
import * as fs8 from "node:fs/promises";
|
|
15745
15643
|
import * as path9 from "node:path";
|
|
15746
15644
|
|
|
15747
15645
|
// ../registry/src/e2e-dirs.ts
|
|
15748
|
-
import * as
|
|
15646
|
+
import * as fs7 from "node:fs/promises";
|
|
15749
15647
|
import * as path8 from "node:path";
|
|
15750
15648
|
var E2E_DIR = path8.join(".argent", "e2e");
|
|
15751
15649
|
var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
|
|
@@ -15851,6 +15749,9 @@ var FAILURE_CODES = {
|
|
|
15851
15749
|
ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
|
|
15852
15750
|
ANDROID_ADB_BOOT_TERMINAL_STATE: "ANDROID_ADB_BOOT_TERMINAL_STATE",
|
|
15853
15751
|
ANDROID_ADB_BOOT_TIMEOUT: "ANDROID_ADB_BOOT_TIMEOUT",
|
|
15752
|
+
ANDROID_NETWORK_RESTORE_TIMEOUT: "ANDROID_NETWORK_RESTORE_TIMEOUT",
|
|
15753
|
+
ANDROID_OFFLINE_TIMEOUT: "ANDROID_OFFLINE_TIMEOUT",
|
|
15754
|
+
ANDROID_OFFLINE_UNSUPPORTED: "ANDROID_OFFLINE_UNSUPPORTED",
|
|
15854
15755
|
SIMULATOR_NETWORK_TIMEOUT: "SIMULATOR_NETWORK_TIMEOUT",
|
|
15855
15756
|
SIMULATOR_NETWORK_CONNECTION_REFUSED: "SIMULATOR_NETWORK_CONNECTION_REFUSED",
|
|
15856
15757
|
SIMULATOR_NETWORK_CONNECTION_RESET: "SIMULATOR_NETWORK_CONNECTION_RESET",
|
|
@@ -15970,12 +15871,15 @@ var FAILURE_CODES = {
|
|
|
15970
15871
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
15971
15872
|
DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
|
|
15972
15873
|
DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
|
|
15874
|
+
DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
|
|
15973
15875
|
DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
|
|
15974
15876
|
DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
|
|
15975
15877
|
DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
|
|
15976
15878
|
DEBUGGER_TARGET_DEVICE_MISMATCH: "DEBUGGER_TARGET_DEVICE_MISMATCH",
|
|
15977
15879
|
DEBUGGER_EVALUATE_EXPRESSION_THREW: "DEBUGGER_EVALUATE_EXPRESSION_THREW",
|
|
15978
15880
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
15881
|
+
// e2e-add-step refused a debugger-* call that answered `not_connected`.
|
|
15882
|
+
DEBUGGER_NOT_CONNECTED: "DEBUGGER_NOT_CONNECTED",
|
|
15979
15883
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
|
15980
15884
|
JS_RUNTIME_PAYLOAD_INVALID: "JS_RUNTIME_PAYLOAD_INVALID",
|
|
15981
15885
|
JS_RUNTIME_PAYLOAD_DEVICE_MISSING: "JS_RUNTIME_PAYLOAD_DEVICE_MISSING",
|
|
@@ -16044,6 +15948,32 @@ var FAILURE_CODES = {
|
|
|
16044
15948
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
16045
15949
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
16046
15950
|
NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
|
|
15951
|
+
/**
|
|
15952
|
+
* native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
|
|
15953
|
+
* devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
|
|
15954
|
+
* @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
|
|
15955
|
+
*/
|
|
15956
|
+
// Not macOS, or an Xcode that cannot record the launch on this target.
|
|
15957
|
+
LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
|
|
15958
|
+
// No usable iPhone or simulator was selected, or Argent's runner holds it.
|
|
15959
|
+
LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
|
|
15960
|
+
// The bundle_id app is not installed on the selected device.
|
|
15961
|
+
LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
|
|
15962
|
+
// The runner's xcodebuild failed on code signing or provisioning.
|
|
15963
|
+
LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
|
|
15964
|
+
// The iPhone's free developer profile has no slot for Argent's runner.
|
|
15965
|
+
LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
|
|
15966
|
+
// simctl could not wait for boot, find, launch or terminate the app.
|
|
15967
|
+
LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
|
|
15968
|
+
LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
|
|
15969
|
+
// xctrace could not export the TOC, the CPU samples or the first-frame marker.
|
|
15970
|
+
LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
|
|
15971
|
+
// The App Launch trace has no first frame of the app, so it has no launch window.
|
|
15972
|
+
LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
|
|
15973
|
+
// The XCTest launch run of Argent's runner failed.
|
|
15974
|
+
LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
|
|
15975
|
+
// The launch test ran, but Argent read no launch measurements from its result.
|
|
15976
|
+
LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
|
|
16047
15977
|
// iOS and Android share one capture path (simulator-server frames into
|
|
16048
15978
|
// ffmpeg), so these name the failing stage, not the device family.
|
|
16049
15979
|
SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
|
|
@@ -16058,6 +15988,19 @@ var FAILURE_CODES = {
|
|
|
16058
15988
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
16059
15989
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
16060
15990
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
15991
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
15992
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
15993
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
15994
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
15995
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
15996
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
15997
|
+
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
15998
|
+
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
15999
|
+
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
16000
|
+
AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
|
|
16001
|
+
AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
|
|
16002
|
+
AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
|
|
16003
|
+
AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
|
|
16061
16004
|
FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
|
|
16062
16005
|
FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
|
|
16063
16006
|
FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
|
|
@@ -16121,6 +16064,8 @@ var FAILURE_CODES = {
|
|
|
16121
16064
|
MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
|
|
16122
16065
|
MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
|
|
16123
16066
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
16067
|
+
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
16068
|
+
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
16124
16069
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
16125
16070
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
16126
16071
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -16190,13 +16135,19 @@ var FAILURE_COMMANDS = [
|
|
|
16190
16135
|
"ax_service",
|
|
16191
16136
|
"simulator_server",
|
|
16192
16137
|
"ffmpeg",
|
|
16138
|
+
"afconvert",
|
|
16193
16139
|
"cdp",
|
|
16194
16140
|
"electron",
|
|
16195
16141
|
"npm",
|
|
16196
16142
|
"npx",
|
|
16197
16143
|
"unknown",
|
|
16198
16144
|
"devicectl",
|
|
16199
|
-
"xcodebuild"
|
|
16145
|
+
"xcodebuild",
|
|
16146
|
+
"swiftc",
|
|
16147
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
16148
|
+
"ios_screen_stream",
|
|
16149
|
+
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
16150
|
+
"xcresulttool"
|
|
16200
16151
|
];
|
|
16201
16152
|
var FAILURE_SIGNAL_NAMES = [
|
|
16202
16153
|
"SIGABRT",
|
|
@@ -16245,7 +16196,8 @@ var DEVICE_KINDS = [
|
|
|
16245
16196
|
"emulator",
|
|
16246
16197
|
"vvd",
|
|
16247
16198
|
"device",
|
|
16248
|
-
"app"
|
|
16199
|
+
"app",
|
|
16200
|
+
"catalyst"
|
|
16249
16201
|
];
|
|
16250
16202
|
var DEBUGGER_NOT_CONNECTED_REASONS = [
|
|
16251
16203
|
"metro_not_running",
|
|
@@ -16383,7 +16335,8 @@ var ALLOWED = {
|
|
|
16383
16335
|
install_mode: INSTALL_MODE
|
|
16384
16336
|
},
|
|
16385
16337
|
"installation:allowlist_decision": {
|
|
16386
|
-
is_enabled: bool
|
|
16338
|
+
is_enabled: bool,
|
|
16339
|
+
decided_by: oneOf(["flag", "default", "prompt"])
|
|
16387
16340
|
},
|
|
16388
16341
|
"installation:stale_config_cleanup": {
|
|
16389
16342
|
removed_count: COUNT,
|
|
@@ -16570,9 +16523,9 @@ function isReplitAgent(env) {
|
|
|
16570
16523
|
}
|
|
16571
16524
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16572
16525
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16573
|
-
function safeExists(fileExists,
|
|
16526
|
+
function safeExists(fileExists, path32) {
|
|
16574
16527
|
try {
|
|
16575
|
-
return fileExists(
|
|
16528
|
+
return fileExists(path32);
|
|
16576
16529
|
} catch {
|
|
16577
16530
|
return false;
|
|
16578
16531
|
}
|
|
@@ -16987,13 +16940,12 @@ function isCi(env = process.env) {
|
|
|
16987
16940
|
if (GENERIC_CI_ENV_VARS.some((name) => Boolean(env[name]))) return true;
|
|
16988
16941
|
return isKnownVendorCi(env);
|
|
16989
16942
|
}
|
|
16990
|
-
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
16991
16943
|
|
|
16992
16944
|
// ../telemetry/src/base-props.ts
|
|
16993
16945
|
var SESSION_ID = randomUUID4();
|
|
16994
16946
|
function readCliVersion() {
|
|
16995
16947
|
if (true) {
|
|
16996
|
-
return "0.34.1-next.
|
|
16948
|
+
return "0.34.1-next.39";
|
|
16997
16949
|
}
|
|
16998
16950
|
return "0.0.0";
|
|
16999
16951
|
}
|
|
@@ -17026,7 +16978,7 @@ function getBaseProps(runtime) {
|
|
|
17026
16978
|
|
|
17027
16979
|
// ../telemetry/src/identity.ts
|
|
17028
16980
|
import * as crypto2 from "node:crypto";
|
|
17029
|
-
import * as
|
|
16981
|
+
import * as fs9 from "node:fs";
|
|
17030
16982
|
import * as path10 from "node:path";
|
|
17031
16983
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17032
16984
|
var cached = null;
|
|
@@ -17134,17 +17086,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17134
17086
|
function isCorruptIdFile(filePath) {
|
|
17135
17087
|
let isRegularFile;
|
|
17136
17088
|
try {
|
|
17137
|
-
isRegularFile =
|
|
17089
|
+
isRegularFile = fs9.lstatSync(filePath).isFile();
|
|
17138
17090
|
} catch {
|
|
17139
17091
|
return false;
|
|
17140
17092
|
}
|
|
17141
17093
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17142
17094
|
}
|
|
17143
17095
|
function writeIdFileAtomic(finalPath, id) {
|
|
17144
|
-
|
|
17096
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17145
17097
|
let occupant;
|
|
17146
17098
|
try {
|
|
17147
|
-
occupant =
|
|
17099
|
+
occupant = fs9.lstatSync(finalPath);
|
|
17148
17100
|
} catch (err) {
|
|
17149
17101
|
if (err.code !== "ENOENT") throw err;
|
|
17150
17102
|
}
|
|
@@ -17155,24 +17107,24 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
17155
17107
|
argentHomeDir(),
|
|
17156
17108
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17157
17109
|
);
|
|
17158
|
-
const fd =
|
|
17110
|
+
const fd = fs9.openSync(tmpPath, "wx", 384);
|
|
17159
17111
|
try {
|
|
17160
17112
|
try {
|
|
17161
|
-
|
|
17162
|
-
|
|
17113
|
+
fs9.writeSync(fd, id);
|
|
17114
|
+
fs9.fsyncSync(fd);
|
|
17163
17115
|
} finally {
|
|
17164
|
-
|
|
17116
|
+
fs9.closeSync(fd);
|
|
17165
17117
|
}
|
|
17166
|
-
|
|
17118
|
+
fs9.renameSync(tmpPath, finalPath);
|
|
17167
17119
|
} finally {
|
|
17168
17120
|
try {
|
|
17169
|
-
|
|
17121
|
+
fs9.unlinkSync(tmpPath);
|
|
17170
17122
|
} catch {
|
|
17171
17123
|
}
|
|
17172
17124
|
}
|
|
17173
17125
|
}
|
|
17174
17126
|
function mintRandomId(finalPath) {
|
|
17175
|
-
|
|
17127
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17176
17128
|
let value = crypto2.randomUUID();
|
|
17177
17129
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17178
17130
|
const tmpPath = path10.join(
|
|
@@ -17181,19 +17133,19 @@ function mintRandomId(finalPath) {
|
|
|
17181
17133
|
);
|
|
17182
17134
|
let fd;
|
|
17183
17135
|
try {
|
|
17184
|
-
fd =
|
|
17136
|
+
fd = fs9.openSync(tmpPath, "wx", 384);
|
|
17185
17137
|
} catch (err) {
|
|
17186
17138
|
if (err.code === "EEXIST") continue;
|
|
17187
17139
|
throw err;
|
|
17188
17140
|
}
|
|
17189
17141
|
try {
|
|
17190
17142
|
try {
|
|
17191
|
-
|
|
17192
|
-
|
|
17143
|
+
fs9.writeSync(fd, value);
|
|
17144
|
+
fs9.fsyncSync(fd);
|
|
17193
17145
|
} finally {
|
|
17194
|
-
|
|
17146
|
+
fs9.closeSync(fd);
|
|
17195
17147
|
}
|
|
17196
|
-
|
|
17148
|
+
fs9.linkSync(tmpPath, finalPath);
|
|
17197
17149
|
cached = { path: finalPath, id: value };
|
|
17198
17150
|
return value;
|
|
17199
17151
|
} catch (err) {
|
|
@@ -17212,7 +17164,7 @@ function mintRandomId(finalPath) {
|
|
|
17212
17164
|
throw err;
|
|
17213
17165
|
} finally {
|
|
17214
17166
|
try {
|
|
17215
|
-
|
|
17167
|
+
fs9.unlinkSync(tmpPath);
|
|
17216
17168
|
} catch {
|
|
17217
17169
|
}
|
|
17218
17170
|
}
|
|
@@ -17225,7 +17177,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17225
17177
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17226
17178
|
);
|
|
17227
17179
|
try {
|
|
17228
|
-
|
|
17180
|
+
fs9.renameSync(finalPath, claimed);
|
|
17229
17181
|
} catch {
|
|
17230
17182
|
return null;
|
|
17231
17183
|
}
|
|
@@ -17234,7 +17186,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17234
17186
|
grabbed = tryReadId(claimed);
|
|
17235
17187
|
} finally {
|
|
17236
17188
|
try {
|
|
17237
|
-
|
|
17189
|
+
fs9.unlinkSync(claimed);
|
|
17238
17190
|
} catch {
|
|
17239
17191
|
}
|
|
17240
17192
|
}
|
|
@@ -17243,7 +17195,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17243
17195
|
function deleteAnonId() {
|
|
17244
17196
|
cached = null;
|
|
17245
17197
|
try {
|
|
17246
|
-
|
|
17198
|
+
fs9.unlinkSync(identityFilePath());
|
|
17247
17199
|
} catch (err) {
|
|
17248
17200
|
if (err.code !== "ENOENT") throw err;
|
|
17249
17201
|
}
|
|
@@ -17251,9 +17203,9 @@ function deleteAnonId() {
|
|
|
17251
17203
|
function tryReadId(filePath) {
|
|
17252
17204
|
let raw;
|
|
17253
17205
|
try {
|
|
17254
|
-
const stats =
|
|
17206
|
+
const stats = fs9.lstatSync(filePath);
|
|
17255
17207
|
if (!stats.isFile()) return null;
|
|
17256
|
-
raw =
|
|
17208
|
+
raw = fs9.readFileSync(filePath, "utf8");
|
|
17257
17209
|
} catch (err) {
|
|
17258
17210
|
if (err.code === "ENOENT") return null;
|
|
17259
17211
|
return null;
|
|
@@ -17268,7 +17220,7 @@ import { execFileSync, spawn } from "node:child_process";
|
|
|
17268
17220
|
|
|
17269
17221
|
// ../native-devtools-ios/src/index.ts
|
|
17270
17222
|
import * as path11 from "node:path";
|
|
17271
|
-
import * as
|
|
17223
|
+
import * as fs10 from "node:fs";
|
|
17272
17224
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path11.join(__dirname, "..", "dylibs");
|
|
17273
17225
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path11.join(__dirname, "..", "bin");
|
|
17274
17226
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path11.join(DYLIB_DIR, "tcp");
|
|
@@ -17288,9 +17240,9 @@ function platformBinDir() {
|
|
|
17288
17240
|
function simulatorServerBinaryPath() {
|
|
17289
17241
|
const binaryName = simulatorServerBinaryName();
|
|
17290
17242
|
const p = path11.join(platformBinDir(), binaryName);
|
|
17291
|
-
if (!
|
|
17243
|
+
if (!fs10.existsSync(p)) {
|
|
17292
17244
|
const flat = path11.join(BIN_DIR, binaryName);
|
|
17293
|
-
const migrationHint =
|
|
17245
|
+
const migrationHint = fs10.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
17294
17246
|
throw new Error(
|
|
17295
17247
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17296
17248
|
);
|
|
@@ -17319,12 +17271,12 @@ function resolveHostFingerprint() {
|
|
|
17319
17271
|
}
|
|
17320
17272
|
}
|
|
17321
17273
|
function resolveHostFingerprintAsync() {
|
|
17322
|
-
return new Promise((
|
|
17274
|
+
return new Promise((resolve21) => {
|
|
17323
17275
|
let binary;
|
|
17324
17276
|
try {
|
|
17325
17277
|
binary = simulatorServerBinaryPath();
|
|
17326
17278
|
} catch {
|
|
17327
|
-
|
|
17279
|
+
resolve21(null);
|
|
17328
17280
|
return;
|
|
17329
17281
|
}
|
|
17330
17282
|
let settled = false;
|
|
@@ -17337,7 +17289,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17337
17289
|
child?.kill("SIGKILL");
|
|
17338
17290
|
} catch {
|
|
17339
17291
|
}
|
|
17340
|
-
|
|
17292
|
+
resolve21(value);
|
|
17341
17293
|
};
|
|
17342
17294
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17343
17295
|
watchdog.unref?.();
|
|
@@ -17370,14 +17322,15 @@ function resolveHostFingerprintAsync() {
|
|
|
17370
17322
|
}
|
|
17371
17323
|
|
|
17372
17324
|
// ../telemetry/src/consent.ts
|
|
17373
|
-
import * as
|
|
17325
|
+
import * as fs11 from "node:fs";
|
|
17326
|
+
import * as path12 from "node:path";
|
|
17374
17327
|
var cache = /* @__PURE__ */ new Map();
|
|
17375
17328
|
var sessionOverride = null;
|
|
17376
17329
|
function readConfigOverrideAt(filePath) {
|
|
17377
17330
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17378
17331
|
let stats;
|
|
17379
17332
|
try {
|
|
17380
|
-
stats =
|
|
17333
|
+
stats = fs11.lstatSync(filePath);
|
|
17381
17334
|
} catch {
|
|
17382
17335
|
cache.set(filePath, miss);
|
|
17383
17336
|
return null;
|
|
@@ -17394,7 +17347,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17394
17347
|
}
|
|
17395
17348
|
let parsedEnabled = null;
|
|
17396
17349
|
try {
|
|
17397
|
-
const raw =
|
|
17350
|
+
const raw = fs11.readFileSync(filePath, "utf8");
|
|
17398
17351
|
const json = JSON.parse(raw);
|
|
17399
17352
|
if (json && typeof json === "object") {
|
|
17400
17353
|
const t2 = json.telemetry;
|
|
@@ -17412,7 +17365,8 @@ function readPersistedConsent(cwd) {
|
|
|
17412
17365
|
const globalPath = configFilePath("global");
|
|
17413
17366
|
const projectPath = configFilePath("project", { cwd });
|
|
17414
17367
|
const global2 = readConfigOverrideAt(globalPath);
|
|
17415
|
-
const
|
|
17368
|
+
const projectRoot = path12.dirname(path12.dirname(projectPath));
|
|
17369
|
+
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
17416
17370
|
if (project === false && global2 === false) {
|
|
17417
17371
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
17418
17372
|
}
|
|
@@ -17607,7 +17561,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
17607
17561
|
async function raceDrain(client2, timeoutMs) {
|
|
17608
17562
|
await Promise.race([
|
|
17609
17563
|
client2.shutdown(timeoutMs),
|
|
17610
|
-
new Promise((
|
|
17564
|
+
new Promise((resolve21) => setTimeout(resolve21, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
17611
17565
|
]);
|
|
17612
17566
|
}
|
|
17613
17567
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -17627,10 +17581,10 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17627
17581
|
}
|
|
17628
17582
|
|
|
17629
17583
|
// ../argent-installer/src/mcp-configs.ts
|
|
17630
|
-
import * as
|
|
17631
|
-
import * as
|
|
17584
|
+
import * as fs18 from "node:fs";
|
|
17585
|
+
import * as path19 from "node:path";
|
|
17632
17586
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
17633
|
-
import { homedir as
|
|
17587
|
+
import { homedir as homedir5 } from "node:os";
|
|
17634
17588
|
|
|
17635
17589
|
// ../argent-installer/src/constants.ts
|
|
17636
17590
|
var PACKAGE_NAME = "@swmansion/argent";
|
|
@@ -17643,11 +17597,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17643
17597
|
|
|
17644
17598
|
// ../argent-installer/src/utils.ts
|
|
17645
17599
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17646
|
-
import * as
|
|
17647
|
-
import * as
|
|
17600
|
+
import * as fs17 from "node:fs";
|
|
17601
|
+
import * as path18 from "node:path";
|
|
17648
17602
|
import * as dns from "node:dns";
|
|
17649
17603
|
import { createHash as createHash2 } from "node:crypto";
|
|
17650
|
-
import * as
|
|
17604
|
+
import * as os3 from "node:os";
|
|
17651
17605
|
import { execFileSync as execFileSync3, execSync } from "node:child_process";
|
|
17652
17606
|
|
|
17653
17607
|
// ../../node_modules/smol-toml/dist/error.js
|
|
@@ -19370,11 +19324,11 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19370
19324
|
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
19371
19325
|
ensurePropertyComplete(offset + length);
|
|
19372
19326
|
},
|
|
19373
|
-
onSeparator: (
|
|
19327
|
+
onSeparator: (sep9, offset, length) => {
|
|
19374
19328
|
if (currentParent.type === "property") {
|
|
19375
|
-
if (
|
|
19329
|
+
if (sep9 === ":") {
|
|
19376
19330
|
currentParent.colonOffset = offset;
|
|
19377
|
-
} else if (
|
|
19331
|
+
} else if (sep9 === ",") {
|
|
19378
19332
|
ensurePropertyComplete(offset);
|
|
19379
19333
|
}
|
|
19380
19334
|
}
|
|
@@ -19390,12 +19344,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19390
19344
|
}
|
|
19391
19345
|
return result;
|
|
19392
19346
|
}
|
|
19393
|
-
function findNodeAtLocation(root,
|
|
19347
|
+
function findNodeAtLocation(root, path32) {
|
|
19394
19348
|
if (!root) {
|
|
19395
19349
|
return void 0;
|
|
19396
19350
|
}
|
|
19397
19351
|
let node = root;
|
|
19398
|
-
for (let segment of
|
|
19352
|
+
for (let segment of path32) {
|
|
19399
19353
|
if (typeof segment === "string") {
|
|
19400
19354
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19401
19355
|
return void 0;
|
|
@@ -19749,14 +19703,14 @@ function getNodeType(value) {
|
|
|
19749
19703
|
|
|
19750
19704
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19751
19705
|
function setProperty(text2, originalPath, value, options) {
|
|
19752
|
-
const
|
|
19706
|
+
const path32 = originalPath.slice();
|
|
19753
19707
|
const errors = [];
|
|
19754
19708
|
const root = parseTree(text2, errors);
|
|
19755
19709
|
let parent = void 0;
|
|
19756
19710
|
let lastSegment = void 0;
|
|
19757
|
-
while (
|
|
19758
|
-
lastSegment =
|
|
19759
|
-
parent = findNodeAtLocation(root,
|
|
19711
|
+
while (path32.length > 0) {
|
|
19712
|
+
lastSegment = path32.pop();
|
|
19713
|
+
parent = findNodeAtLocation(root, path32);
|
|
19760
19714
|
if (parent === void 0 && value !== void 0) {
|
|
19761
19715
|
if (typeof lastSegment === "string") {
|
|
19762
19716
|
value = { [lastSegment]: value };
|
|
@@ -19942,8 +19896,8 @@ var ParseErrorCode;
|
|
|
19942
19896
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
19943
19897
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
19944
19898
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
19945
|
-
function modify(text2,
|
|
19946
|
-
return setProperty(text2,
|
|
19899
|
+
function modify(text2, path32, value, options) {
|
|
19900
|
+
return setProperty(text2, path32, value, options);
|
|
19947
19901
|
}
|
|
19948
19902
|
function applyEdits(text2, edits) {
|
|
19949
19903
|
let sortedEdits = edits.slice(0).sort((a2, b) => {
|
|
@@ -19967,146 +19921,29 @@ function applyEdits(text2, edits) {
|
|
|
19967
19921
|
}
|
|
19968
19922
|
|
|
19969
19923
|
// ../argent-installer/src/package-root.ts
|
|
19970
|
-
import * as
|
|
19971
|
-
import * as
|
|
19972
|
-
function resolvePackageRoot(
|
|
19973
|
-
let current =
|
|
19924
|
+
import * as fs12 from "node:fs";
|
|
19925
|
+
import * as path13 from "node:path";
|
|
19926
|
+
function resolvePackageRoot(dirname20) {
|
|
19927
|
+
let current = path13.resolve(dirname20);
|
|
19974
19928
|
while (true) {
|
|
19975
|
-
if (
|
|
19976
|
-
const parent =
|
|
19977
|
-
if (parent === current) return
|
|
19929
|
+
if (fs12.existsSync(path13.join(current, "package.json"))) return current;
|
|
19930
|
+
const parent = path13.dirname(current);
|
|
19931
|
+
if (parent === current) return path13.resolve(dirname20);
|
|
19978
19932
|
current = parent;
|
|
19979
19933
|
}
|
|
19980
19934
|
}
|
|
19981
19935
|
|
|
19982
19936
|
// ../argent-installer/src/package-manager.ts
|
|
19983
|
-
import * as
|
|
19984
|
-
import * as
|
|
19985
|
-
|
|
19986
|
-
|
|
19987
|
-
|
|
19988
|
-
|
|
19989
|
-
|
|
19990
|
-
|
|
19991
|
-
}
|
|
19992
|
-
|
|
19993
|
-
const agent = process.env.npm_config_user_agent ?? "";
|
|
19994
|
-
if (agent.startsWith("yarn")) return "yarn";
|
|
19995
|
-
if (agent.startsWith("pnpm")) return "pnpm";
|
|
19996
|
-
if (agent.startsWith("bun")) return "bun";
|
|
19997
|
-
return "npm";
|
|
19998
|
-
}
|
|
19999
|
-
function asKnownPm(name) {
|
|
20000
|
-
return name === "npm" || name === "yarn" || name === "pnpm" || name === "bun" ? name : null;
|
|
20001
|
-
}
|
|
20002
|
-
function pmFromPackageManagerField(dir) {
|
|
20003
|
-
try {
|
|
20004
|
-
const pkg = JSON.parse(fs12.readFileSync(path13.join(dir, "package.json"), "utf8"));
|
|
20005
|
-
if (typeof pkg.packageManager === "string") {
|
|
20006
|
-
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20007
|
-
}
|
|
20008
|
-
return null;
|
|
20009
|
-
} catch {
|
|
20010
|
-
return null;
|
|
20011
|
-
}
|
|
20012
|
-
}
|
|
20013
|
-
function pmFromDevEngines(dir) {
|
|
20014
|
-
try {
|
|
20015
|
-
const pkg = JSON.parse(fs12.readFileSync(path13.join(dir, "package.json"), "utf8"));
|
|
20016
|
-
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20017
|
-
const names = /* @__PURE__ */ new Set();
|
|
20018
|
-
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
20019
|
-
const name = asKnownPm(entry?.name);
|
|
20020
|
-
if (name) names.add(name);
|
|
20021
|
-
}
|
|
20022
|
-
return names.size === 1 ? [...names][0] : null;
|
|
20023
|
-
} catch {
|
|
20024
|
-
return null;
|
|
20025
|
-
}
|
|
20026
|
-
}
|
|
20027
|
-
function pmFromLockfile(dir) {
|
|
20028
|
-
const has = (file) => fs12.existsSync(path13.join(dir, file));
|
|
20029
|
-
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20030
|
-
if (has("yarn.lock")) return "yarn";
|
|
20031
|
-
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
20032
|
-
if (has("package-lock.json") || has("npm-shrinkwrap.json")) return "npm";
|
|
20033
|
-
return null;
|
|
20034
|
-
}
|
|
20035
|
-
function pmFromWorkspaceMarker(dir) {
|
|
20036
|
-
return fs12.existsSync(path13.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20037
|
-
}
|
|
20038
|
-
function detectProjectPackageManager(projectRoot) {
|
|
20039
|
-
let dir = path13.resolve(projectRoot);
|
|
20040
|
-
for (; ; ) {
|
|
20041
|
-
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20042
|
-
if (pm) return pm;
|
|
20043
|
-
if (fs12.existsSync(path13.join(dir, ".git"))) break;
|
|
20044
|
-
const parent = path13.dirname(dir);
|
|
20045
|
-
if (parent === dir) break;
|
|
20046
|
-
dir = parent;
|
|
20047
|
-
}
|
|
20048
|
-
return detectPackageManager();
|
|
20049
|
-
}
|
|
20050
|
-
function globalInstallCommand(pm, pkg) {
|
|
20051
|
-
switch (pm) {
|
|
20052
|
-
case "yarn":
|
|
20053
|
-
return { bin: "yarn", args: ["global", "add", pkg] };
|
|
20054
|
-
case "pnpm":
|
|
20055
|
-
return { bin: "pnpm", args: ["add", "-g", pkg] };
|
|
20056
|
-
case "bun":
|
|
20057
|
-
return { bin: "bun", args: ["add", "-g", pkg] };
|
|
20058
|
-
default:
|
|
20059
|
-
return { bin: "npm", args: ["install", "-g", pkg] };
|
|
20060
|
-
}
|
|
20061
|
-
}
|
|
20062
|
-
function globalUninstallCommand(pm, pkg) {
|
|
20063
|
-
switch (pm) {
|
|
20064
|
-
case "yarn":
|
|
20065
|
-
return { bin: "yarn", args: ["global", "remove", pkg] };
|
|
20066
|
-
case "pnpm":
|
|
20067
|
-
return { bin: "pnpm", args: ["remove", "-g", pkg] };
|
|
20068
|
-
case "bun":
|
|
20069
|
-
return { bin: "bun", args: ["remove", "-g", pkg] };
|
|
20070
|
-
default:
|
|
20071
|
-
return { bin: "npm", args: ["uninstall", "-g", pkg] };
|
|
20072
|
-
}
|
|
20073
|
-
}
|
|
20074
|
-
function localInstallCommand(pm, pkg) {
|
|
20075
|
-
switch (pm) {
|
|
20076
|
-
case "yarn":
|
|
20077
|
-
return { bin: "yarn", args: ["add", "--dev", pkg] };
|
|
20078
|
-
case "pnpm":
|
|
20079
|
-
return { bin: "pnpm", args: ["add", "-D", "--ignore-workspace-root-check", pkg] };
|
|
20080
|
-
case "bun":
|
|
20081
|
-
return { bin: "bun", args: ["add", "-d", pkg] };
|
|
20082
|
-
default:
|
|
20083
|
-
return { bin: "npm", args: ["install", "--save-dev", pkg] };
|
|
20084
|
-
}
|
|
20085
|
-
}
|
|
20086
|
-
function projectInstallCommand(pm) {
|
|
20087
|
-
switch (pm) {
|
|
20088
|
-
case "yarn":
|
|
20089
|
-
return { bin: "yarn", args: ["install"] };
|
|
20090
|
-
case "pnpm":
|
|
20091
|
-
return { bin: "pnpm", args: ["install"] };
|
|
20092
|
-
case "bun":
|
|
20093
|
-
return { bin: "bun", args: ["install"] };
|
|
20094
|
-
default:
|
|
20095
|
-
return { bin: "npm", args: ["install"] };
|
|
20096
|
-
}
|
|
20097
|
-
}
|
|
20098
|
-
function localUninstallCommand(pm, pkg) {
|
|
20099
|
-
switch (pm) {
|
|
20100
|
-
case "yarn":
|
|
20101
|
-
return { bin: "yarn", args: ["remove", pkg] };
|
|
20102
|
-
case "pnpm":
|
|
20103
|
-
return { bin: "pnpm", args: ["remove", pkg] };
|
|
20104
|
-
case "bun":
|
|
20105
|
-
return { bin: "bun", args: ["remove", pkg] };
|
|
20106
|
-
default:
|
|
20107
|
-
return { bin: "npm", args: ["uninstall", pkg] };
|
|
20108
|
-
}
|
|
20109
|
-
}
|
|
19937
|
+
import * as fs15 from "node:fs";
|
|
19938
|
+
import * as os2 from "node:os";
|
|
19939
|
+
import * as path16 from "node:path";
|
|
19940
|
+
|
|
19941
|
+
// ../argent-installer/src/topology.ts
|
|
19942
|
+
var import_semver2 = __toESM(require_semver2(), 1);
|
|
19943
|
+
import * as fs14 from "node:fs";
|
|
19944
|
+
import * as path15 from "node:path";
|
|
19945
|
+
import { createRequire } from "node:module";
|
|
19946
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20110
19947
|
|
|
20111
19948
|
// ../argent-installer/src/preflight.ts
|
|
20112
19949
|
import * as fs13 from "node:fs";
|
|
@@ -20119,11 +19956,6 @@ function isYarnPnp(projectRoot) {
|
|
|
20119
19956
|
}
|
|
20120
19957
|
|
|
20121
19958
|
// ../argent-installer/src/topology.ts
|
|
20122
|
-
var import_semver2 = __toESM(require_semver2(), 1);
|
|
20123
|
-
import * as fs14 from "node:fs";
|
|
20124
|
-
import * as path15 from "node:path";
|
|
20125
|
-
import { createRequire } from "node:module";
|
|
20126
|
-
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20127
19959
|
var TEMP_RUNNER_PATTERNS = [
|
|
20128
19960
|
// npx: <npm cache>/_npx/<hash>/node_modules/.bin
|
|
20129
19961
|
/\/_npx\//,
|
|
@@ -20144,24 +19976,82 @@ function isTempRunnerPath(binaryPath) {
|
|
|
20144
19976
|
const slashed = binaryPath.split("\\").join("/");
|
|
20145
19977
|
return TEMP_RUNNER_PATTERNS.some((pattern) => pattern.test(slashed));
|
|
20146
19978
|
}
|
|
20147
|
-
function
|
|
19979
|
+
function isProjectBinPath(binaryPath) {
|
|
19980
|
+
const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
|
|
19981
|
+
const binDir = norm(path15.dirname(path15.resolve(binaryPath)));
|
|
19982
|
+
const prefix = process.env.npm_config_local_prefix;
|
|
19983
|
+
if (prefix && norm(path15.join(prefix, "node_modules", ".bin")) === binDir) return true;
|
|
19984
|
+
for (let dir = path15.resolve(process.cwd()); ; dir = path15.dirname(dir)) {
|
|
19985
|
+
if (norm(path15.join(dir, "node_modules", ".bin")) === binDir) return true;
|
|
19986
|
+
if (path15.dirname(dir) === dir) return false;
|
|
19987
|
+
}
|
|
19988
|
+
}
|
|
19989
|
+
function getPermanentBinaryPaths() {
|
|
20148
19990
|
try {
|
|
20149
19991
|
const [cmd, args] = process.platform === "win32" ? ["where", [MCP_BINARY_NAME]] : ["which", ["-a", MCP_BINARY_NAME]];
|
|
20150
19992
|
const output = execFileSync2(cmd, args, {
|
|
20151
19993
|
encoding: "utf8",
|
|
20152
19994
|
stdio: ["ignore", "pipe", "ignore"]
|
|
20153
19995
|
});
|
|
20154
|
-
return output.split(/\r?\n/).map((line) => line.trim()).filter(
|
|
19996
|
+
return output.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !isTempRunnerPath(line));
|
|
20155
19997
|
} catch {
|
|
20156
|
-
return
|
|
19998
|
+
return [];
|
|
19999
|
+
}
|
|
20000
|
+
}
|
|
20001
|
+
function getGlobalBinaryPaths() {
|
|
20002
|
+
return getPermanentBinaryPaths().filter((line) => !isProjectBinPath(line));
|
|
20003
|
+
}
|
|
20004
|
+
function isArgentOnPath() {
|
|
20005
|
+
return getPermanentBinaryPaths().length > 0;
|
|
20006
|
+
}
|
|
20007
|
+
function getRemainingGlobalBinaryPath() {
|
|
20008
|
+
for (const binaryPath of getGlobalBinaryPaths()) {
|
|
20009
|
+
if (process.platform === "win32" || globalPackageRootOf(binaryPath)) return binaryPath;
|
|
20010
|
+
try {
|
|
20011
|
+
execFileSync2(binaryPath, ["--version"], { stdio: "ignore", timeout: 1e4 });
|
|
20012
|
+
return binaryPath;
|
|
20013
|
+
} catch {
|
|
20014
|
+
}
|
|
20157
20015
|
}
|
|
20016
|
+
return null;
|
|
20158
20017
|
}
|
|
20159
20018
|
function isGloballyInstalled() {
|
|
20160
|
-
return
|
|
20019
|
+
return getRemainingGlobalBinaryPath() !== null;
|
|
20020
|
+
}
|
|
20021
|
+
function getUnshadowedGlobalBinaryPath() {
|
|
20022
|
+
const first = getPermanentBinaryPaths()[0];
|
|
20023
|
+
return first !== void 0 && !isProjectBinPath(first) ? getRemainingGlobalBinaryPath() : null;
|
|
20024
|
+
}
|
|
20025
|
+
function isGlobalInstallFirstOnPath() {
|
|
20026
|
+
return getUnshadowedGlobalBinaryPath() !== null;
|
|
20161
20027
|
}
|
|
20162
20028
|
function getGloballyInstalledPackageRoot() {
|
|
20163
|
-
const binaryPath =
|
|
20164
|
-
|
|
20029
|
+
const binaryPath = getRemainingGlobalBinaryPath();
|
|
20030
|
+
return binaryPath ? globalPackageRootOf(binaryPath) : null;
|
|
20031
|
+
}
|
|
20032
|
+
function readShimScript(binaryPath) {
|
|
20033
|
+
try {
|
|
20034
|
+
if (fs14.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20035
|
+
return fs14.readFileSync(binaryPath, "utf8");
|
|
20036
|
+
} catch {
|
|
20037
|
+
return null;
|
|
20038
|
+
}
|
|
20039
|
+
}
|
|
20040
|
+
function shimTargetOf(binaryPath) {
|
|
20041
|
+
const shim = readShimScript(binaryPath);
|
|
20042
|
+
if (!shim) return null;
|
|
20043
|
+
const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
|
|
20044
|
+
if (trailer) return trailer[1].trim();
|
|
20045
|
+
const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
|
|
20046
|
+
return relative5 ? path15.resolve(canonicalPath(path15.dirname(binaryPath)), relative5[1]) : null;
|
|
20047
|
+
}
|
|
20048
|
+
function globalPackageRootOf(binaryPath) {
|
|
20049
|
+
const root = packageRootOf(binaryPath);
|
|
20050
|
+
if (root) return root;
|
|
20051
|
+
const target = shimTargetOf(binaryPath);
|
|
20052
|
+
return target ? packageRootOf(target) : null;
|
|
20053
|
+
}
|
|
20054
|
+
function packageRootOf(binaryPath) {
|
|
20165
20055
|
try {
|
|
20166
20056
|
const realPath = fs14.realpathSync(binaryPath);
|
|
20167
20057
|
const root = resolvePackageRoot(path15.dirname(realPath));
|
|
@@ -20171,6 +20061,26 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20171
20061
|
return null;
|
|
20172
20062
|
}
|
|
20173
20063
|
}
|
|
20064
|
+
function cliPathOf(packageRoot) {
|
|
20065
|
+
const binSub = argentBinSubpath(packageRoot);
|
|
20066
|
+
if (!binSub) return null;
|
|
20067
|
+
const cli = path15.join(packageRoot, binSub);
|
|
20068
|
+
return fs14.existsSync(cli) ? cli : null;
|
|
20069
|
+
}
|
|
20070
|
+
function getGloballyInstalledLaunchPaths() {
|
|
20071
|
+
if (process.platform === "win32") return null;
|
|
20072
|
+
const binaryPath = getUnshadowedGlobalBinaryPath();
|
|
20073
|
+
if (!binaryPath) return null;
|
|
20074
|
+
const packageRoot = packageRootOf(binaryPath);
|
|
20075
|
+
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20076
|
+
if (!cli) return null;
|
|
20077
|
+
try {
|
|
20078
|
+
const node = path15.join(fs14.realpathSync(path15.dirname(binaryPath)), "node");
|
|
20079
|
+
return fs14.existsSync(node) ? { node, cli } : null;
|
|
20080
|
+
} catch {
|
|
20081
|
+
return null;
|
|
20082
|
+
}
|
|
20083
|
+
}
|
|
20174
20084
|
function getGloballyInstalledVersion() {
|
|
20175
20085
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20176
20086
|
if (!pkgRoot) return null;
|
|
@@ -20270,16 +20180,208 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20270
20180
|
return path15.relative(root, abs).split(path15.sep).join("/");
|
|
20271
20181
|
}
|
|
20272
20182
|
|
|
20183
|
+
// ../argent-installer/src/package-manager.ts
|
|
20184
|
+
function formatShellCommand(cmd) {
|
|
20185
|
+
const parts = [cmd.bin, ...cmd.args.map((a2) => a2.includes(" ") ? `"${a2}"` : a2)];
|
|
20186
|
+
return parts.join(" ");
|
|
20187
|
+
}
|
|
20188
|
+
function shellQuotePath(dir) {
|
|
20189
|
+
return "'" + dir.split("'").join("'\\''") + "'";
|
|
20190
|
+
}
|
|
20191
|
+
function detectPackageManager() {
|
|
20192
|
+
const agent = process.env.npm_config_user_agent ?? "";
|
|
20193
|
+
if (agent.startsWith("yarn")) return "yarn";
|
|
20194
|
+
if (agent.startsWith("pnpm")) return "pnpm";
|
|
20195
|
+
if (agent.startsWith("bun")) return "bun";
|
|
20196
|
+
return "npm";
|
|
20197
|
+
}
|
|
20198
|
+
var PNPM_GLOBAL_TARGET = new RegExp(
|
|
20199
|
+
String.raw`[\\/]global[\\/]v?\d+[\\/][^"'\s]*node_modules[\\/]` + PACKAGE_NAME.split("/").join(String.raw`[\\/]`) + String.raw`[\\/]`
|
|
20200
|
+
);
|
|
20201
|
+
var BUN_GLOBAL_ROOT = new RegExp(
|
|
20202
|
+
String.raw`[\\/]install[\\/]global[\\/]node_modules[\\/]` + PACKAGE_NAME.split("/").join(String.raw`[\\/]`) + "$"
|
|
20203
|
+
);
|
|
20204
|
+
function detectGlobalPackageManager() {
|
|
20205
|
+
const binaryPath = getRemainingGlobalBinaryPath();
|
|
20206
|
+
if (!binaryPath) return isYarnBerryLauncher() ? "npm" : detectPackageManager();
|
|
20207
|
+
const root = packageRootOf(binaryPath);
|
|
20208
|
+
if (root) {
|
|
20209
|
+
if (isInNpmLayout(binaryPath, root)) return "npm";
|
|
20210
|
+
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20211
|
+
}
|
|
20212
|
+
if (process.platform === "win32") {
|
|
20213
|
+
if (fs15.existsSync(path16.join(npmCopyBeside(path16.dirname(binaryPath)), "package.json"))) {
|
|
20214
|
+
return "npm";
|
|
20215
|
+
}
|
|
20216
|
+
if (fs15.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20217
|
+
}
|
|
20218
|
+
const shim = readShimScript(binaryPath);
|
|
20219
|
+
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
20220
|
+
if (PNPM_GLOBAL_TARGET.test(shim)) return "pnpm";
|
|
20221
|
+
const target = shimTargetOf(binaryPath);
|
|
20222
|
+
return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
|
|
20223
|
+
}
|
|
20224
|
+
function lockfileOwnerOf(root) {
|
|
20225
|
+
for (let dir = path16.dirname(root); path16.dirname(dir) !== dir; dir = path16.dirname(dir)) {
|
|
20226
|
+
const pm = pmFromLockfile(dir);
|
|
20227
|
+
if (pm) return pm;
|
|
20228
|
+
}
|
|
20229
|
+
return null;
|
|
20230
|
+
}
|
|
20231
|
+
function npmCopyBeside(binDir) {
|
|
20232
|
+
return process.platform === "win32" ? path16.join(binDir, "node_modules", PACKAGE_NAME) : path16.join(path16.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
|
|
20233
|
+
}
|
|
20234
|
+
function isInNpmLayout(binaryPath, root) {
|
|
20235
|
+
const realRoot = canonicalPath(root);
|
|
20236
|
+
let link = binaryPath;
|
|
20237
|
+
for (let hop = 0; hop < 40; hop++) {
|
|
20238
|
+
const binDir = canonicalPath(path16.dirname(link));
|
|
20239
|
+
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20240
|
+
try {
|
|
20241
|
+
link = path16.resolve(binDir, fs15.readlinkSync(link));
|
|
20242
|
+
} catch {
|
|
20243
|
+
return false;
|
|
20244
|
+
}
|
|
20245
|
+
}
|
|
20246
|
+
return false;
|
|
20247
|
+
}
|
|
20248
|
+
function isYarnBerryLauncher() {
|
|
20249
|
+
const agent = process.env.npm_config_user_agent ?? "";
|
|
20250
|
+
return agent.startsWith("yarn") && !agent.startsWith("yarn/1.");
|
|
20251
|
+
}
|
|
20252
|
+
function yarnClassicNote(cmd) {
|
|
20253
|
+
return cmd.bin === "yarn" && cmd.args[0] === "global" && isYarnBerryLauncher() ? " (with Yarn classic, outside this Yarn 2+ project)" : "";
|
|
20254
|
+
}
|
|
20255
|
+
function asKnownPm(name) {
|
|
20256
|
+
return name === "npm" || name === "yarn" || name === "pnpm" || name === "bun" ? name : null;
|
|
20257
|
+
}
|
|
20258
|
+
function pmFromPackageManagerField(dir) {
|
|
20259
|
+
try {
|
|
20260
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
|
|
20261
|
+
if (typeof pkg.packageManager === "string") {
|
|
20262
|
+
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20263
|
+
}
|
|
20264
|
+
return null;
|
|
20265
|
+
} catch {
|
|
20266
|
+
return null;
|
|
20267
|
+
}
|
|
20268
|
+
}
|
|
20269
|
+
function pmFromDevEngines(dir) {
|
|
20270
|
+
try {
|
|
20271
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
|
|
20272
|
+
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20273
|
+
const names = /* @__PURE__ */ new Set();
|
|
20274
|
+
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
20275
|
+
const name = asKnownPm(entry?.name);
|
|
20276
|
+
if (name) names.add(name);
|
|
20277
|
+
}
|
|
20278
|
+
return names.size === 1 ? [...names][0] : null;
|
|
20279
|
+
} catch {
|
|
20280
|
+
return null;
|
|
20281
|
+
}
|
|
20282
|
+
}
|
|
20283
|
+
function pmFromLockfile(dir) {
|
|
20284
|
+
const has = (file) => fs15.existsSync(path16.join(dir, file));
|
|
20285
|
+
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20286
|
+
if (has("yarn.lock")) return "yarn";
|
|
20287
|
+
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
20288
|
+
if (has("package-lock.json") || has("npm-shrinkwrap.json")) return "npm";
|
|
20289
|
+
return null;
|
|
20290
|
+
}
|
|
20291
|
+
function pmFromWorkspaceMarker(dir) {
|
|
20292
|
+
return fs15.existsSync(path16.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20293
|
+
}
|
|
20294
|
+
function detectProjectPackageManager(projectRoot) {
|
|
20295
|
+
let dir = path16.resolve(projectRoot);
|
|
20296
|
+
for (; ; ) {
|
|
20297
|
+
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20298
|
+
if (pm) return pm;
|
|
20299
|
+
if (fs15.existsSync(path16.join(dir, ".git"))) break;
|
|
20300
|
+
const parent = path16.dirname(dir);
|
|
20301
|
+
if (parent === dir) break;
|
|
20302
|
+
dir = parent;
|
|
20303
|
+
}
|
|
20304
|
+
return detectPackageManager();
|
|
20305
|
+
}
|
|
20306
|
+
function globalInstallCommand(pm, pkg) {
|
|
20307
|
+
switch (pm) {
|
|
20308
|
+
case "yarn":
|
|
20309
|
+
return { bin: "yarn", args: ["global", "add", pkg] };
|
|
20310
|
+
case "pnpm":
|
|
20311
|
+
return { bin: "pnpm", args: ["add", "-g", pkg] };
|
|
20312
|
+
case "bun":
|
|
20313
|
+
return { bin: "bun", args: ["add", "-g", pkg] };
|
|
20314
|
+
default:
|
|
20315
|
+
return { bin: "npm", args: ["install", "-g", pkg] };
|
|
20316
|
+
}
|
|
20317
|
+
}
|
|
20318
|
+
function globalCommandOptions(pm) {
|
|
20319
|
+
if (pm === "npm") return {};
|
|
20320
|
+
const home = os2.homedir();
|
|
20321
|
+
const cwd = fs15.existsSync(home) ? { cwd: home } : {};
|
|
20322
|
+
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20323
|
+
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20324
|
+
return { ...cwd, env };
|
|
20325
|
+
}
|
|
20326
|
+
function globalUninstallCommand(pm, pkg) {
|
|
20327
|
+
switch (pm) {
|
|
20328
|
+
case "yarn":
|
|
20329
|
+
return { bin: "yarn", args: ["global", "remove", pkg] };
|
|
20330
|
+
case "pnpm":
|
|
20331
|
+
return { bin: "pnpm", args: ["remove", "-g", pkg] };
|
|
20332
|
+
case "bun":
|
|
20333
|
+
return { bin: "bun", args: ["remove", "-g", pkg] };
|
|
20334
|
+
default:
|
|
20335
|
+
return { bin: "npm", args: ["uninstall", "-g", pkg] };
|
|
20336
|
+
}
|
|
20337
|
+
}
|
|
20338
|
+
function localInstallCommand(pm, pkg) {
|
|
20339
|
+
switch (pm) {
|
|
20340
|
+
case "yarn":
|
|
20341
|
+
return { bin: "yarn", args: ["add", "--dev", pkg] };
|
|
20342
|
+
case "pnpm":
|
|
20343
|
+
return { bin: "pnpm", args: ["add", "-D", "--ignore-workspace-root-check", pkg] };
|
|
20344
|
+
case "bun":
|
|
20345
|
+
return { bin: "bun", args: ["add", "-d", pkg] };
|
|
20346
|
+
default:
|
|
20347
|
+
return { bin: "npm", args: ["install", "--save-dev", pkg] };
|
|
20348
|
+
}
|
|
20349
|
+
}
|
|
20350
|
+
function projectInstallCommand(pm) {
|
|
20351
|
+
switch (pm) {
|
|
20352
|
+
case "yarn":
|
|
20353
|
+
return { bin: "yarn", args: ["install"] };
|
|
20354
|
+
case "pnpm":
|
|
20355
|
+
return { bin: "pnpm", args: ["install"] };
|
|
20356
|
+
case "bun":
|
|
20357
|
+
return { bin: "bun", args: ["install"] };
|
|
20358
|
+
default:
|
|
20359
|
+
return { bin: "npm", args: ["install"] };
|
|
20360
|
+
}
|
|
20361
|
+
}
|
|
20362
|
+
function localUninstallCommand(pm, pkg) {
|
|
20363
|
+
switch (pm) {
|
|
20364
|
+
case "yarn":
|
|
20365
|
+
return { bin: "yarn", args: ["remove", pkg] };
|
|
20366
|
+
case "pnpm":
|
|
20367
|
+
return { bin: "pnpm", args: ["remove", pkg] };
|
|
20368
|
+
case "bun":
|
|
20369
|
+
return { bin: "bun", args: ["remove", pkg] };
|
|
20370
|
+
default:
|
|
20371
|
+
return { bin: "npm", args: ["uninstall", pkg] };
|
|
20372
|
+
}
|
|
20373
|
+
}
|
|
20374
|
+
|
|
20273
20375
|
// ../argent-installer/src/install-record.ts
|
|
20274
|
-
import * as
|
|
20275
|
-
import * as
|
|
20376
|
+
import * as fs16 from "node:fs";
|
|
20377
|
+
import * as path17 from "node:path";
|
|
20276
20378
|
function getInstallRecordPath(projectRoot) {
|
|
20277
|
-
return
|
|
20379
|
+
return path17.join(projectRoot, ".argent", "install.json");
|
|
20278
20380
|
}
|
|
20279
20381
|
function readInstallRecord(projectRoot) {
|
|
20280
20382
|
try {
|
|
20281
20383
|
const parsed = JSON.parse(
|
|
20282
|
-
|
|
20384
|
+
fs16.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20283
20385
|
);
|
|
20284
20386
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20285
20387
|
return null;
|
|
@@ -20289,17 +20391,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20289
20391
|
}
|
|
20290
20392
|
function writeInstallRecord(projectRoot, record) {
|
|
20291
20393
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20292
|
-
|
|
20293
|
-
|
|
20394
|
+
fs16.mkdirSync(path17.dirname(recordPath), { recursive: true });
|
|
20395
|
+
fs16.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20294
20396
|
}
|
|
20295
20397
|
function removeInstallRecord(projectRoot) {
|
|
20296
20398
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20297
20399
|
try {
|
|
20298
|
-
if (!
|
|
20299
|
-
|
|
20300
|
-
const dir =
|
|
20400
|
+
if (!fs16.existsSync(recordPath)) return false;
|
|
20401
|
+
fs16.rmSync(recordPath, { force: true });
|
|
20402
|
+
const dir = path17.dirname(recordPath);
|
|
20301
20403
|
try {
|
|
20302
|
-
if (
|
|
20404
|
+
if (fs16.existsSync(dir) && fs16.readdirSync(dir).length === 0) fs16.rmdirSync(dir);
|
|
20303
20405
|
} catch {
|
|
20304
20406
|
}
|
|
20305
20407
|
return true;
|
|
@@ -20327,9 +20429,9 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20327
20429
|
// ../argent-installer/src/utils.ts
|
|
20328
20430
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20329
20431
|
function resolveBundledDir(dirName) {
|
|
20330
|
-
const packagedDir =
|
|
20331
|
-
if (
|
|
20332
|
-
return
|
|
20432
|
+
const packagedDir = path18.join(PACKAGE_ROOT, dirName);
|
|
20433
|
+
if (fs17.existsSync(packagedDir)) return packagedDir;
|
|
20434
|
+
return path18.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20333
20435
|
}
|
|
20334
20436
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20335
20437
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20341,18 +20443,18 @@ function buildArgentSkillsSource(version) {
|
|
|
20341
20443
|
}
|
|
20342
20444
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20343
20445
|
try {
|
|
20344
|
-
return
|
|
20446
|
+
return fs17.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs17.existsSync(path18.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20345
20447
|
} catch {
|
|
20346
20448
|
return [];
|
|
20347
20449
|
}
|
|
20348
20450
|
}
|
|
20349
20451
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20350
|
-
return
|
|
20452
|
+
return path18.join(cwd, "skills-lock.json");
|
|
20351
20453
|
}
|
|
20352
20454
|
function getGlobalSkillLockPath() {
|
|
20353
20455
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20354
|
-
if (xdgStateHome) return
|
|
20355
|
-
return
|
|
20456
|
+
if (xdgStateHome) return path18.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20457
|
+
return path18.join(os3.homedir(), ".agents", ".skill-lock.json");
|
|
20356
20458
|
}
|
|
20357
20459
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20358
20460
|
var LEGACY_ARGENT_SKILL_NAMES = [
|
|
@@ -20395,12 +20497,70 @@ var RETIRED_BUNDLED_PATHS = {
|
|
|
20395
20497
|
],
|
|
20396
20498
|
rules: []
|
|
20397
20499
|
};
|
|
20500
|
+
var RETIRED_GLOBAL_RULES = [
|
|
20501
|
+
{
|
|
20502
|
+
path: "argent.md",
|
|
20503
|
+
shipped: [
|
|
20504
|
+
"bfb07b5ad949f63ab9b41919f2c24c937b163c7644d6760fa8afda4f68c809f7",
|
|
20505
|
+
"90f6b24882ae077c8d5129652e7630c1b2a5651f5e800474d3b6e223222049f1",
|
|
20506
|
+
"cbf6cb5d898c14cd3460c85a15fd9ceeb7b3fed669df7e0932e61cad93a5a6fe",
|
|
20507
|
+
"ac8d19e2ece55ff6b7c554fd6a4a3eebc5a09af1eb95f6625f96781bb45505e2",
|
|
20508
|
+
"30bbef749f18d4fde7a5501941d58decf1e8abb2ca8c4e51f63e72bab3d863e2",
|
|
20509
|
+
"81663dc2f70aa2111388092e6027d27eddd89e9b5bdfb16043bdc96088d6850d",
|
|
20510
|
+
"5e3143dea13d15a9c80c7e24a1a3e4e1fb3ed34c8a077eccb74cb6e2a8a1c4a3",
|
|
20511
|
+
"51f8360f997c6bfcfb51c4c99d5f8b3a3b632ca4ca43a7f4ba5e7d8e8881798d",
|
|
20512
|
+
"5e27f0ed6dbdb4def30163387485b3c783c702bbc6594bc210d236454b6c5780",
|
|
20513
|
+
"06391305389e958b127a832de9977dc75a2164355a924bddb312b824656a8f72",
|
|
20514
|
+
"09ac21fd92efa4fc877e951475a0488a78ba4dbdfba63d6f1efd761c9f625866",
|
|
20515
|
+
"45fc6a4bf294af60e73ec9ab3c02219627767b5622467f7a57bb5b6976fd4126",
|
|
20516
|
+
"2f4eb998af8b5106b5fb49f19efd282d38366316c4a78f7123bc3d005c5848a4",
|
|
20517
|
+
"e425ebaafba2eeeb02f714d3e0b1ce19e0844fc4d661dbbd25bf6086ffc714b0",
|
|
20518
|
+
"d6cc846c1d3444bf8eaee6aa313a207e8c7a94391041df9d2a2908088c0191a7",
|
|
20519
|
+
"ad0f23a946e9bbc721a16b17a9516bf2570e7529094da0677f33ed63d43e0caa",
|
|
20520
|
+
"b1ce95af4c0e57cb478a148b6b8744ad4f8f15522441e566c0c6f7210c78fc79",
|
|
20521
|
+
"e3dc376ba736cef94de401bd5457c3df0192128164cbb44ac3e2ece57ad1af66",
|
|
20522
|
+
"aa43aeb338a5d0f50c425d8163dc697b9ffd7042539be05a67ed3ed85e8ba60f",
|
|
20523
|
+
"983f29ab70a565367bda4fbed705eb41fbe7b6767c70eb0569d2501f298e72c4",
|
|
20524
|
+
"251487afb2fda1707a27701be7fcc33b481e0176d43a4c946287a35595d26585",
|
|
20525
|
+
"933e657ec8789e57db8164fc2f58a692e9dc889bebd131eaa0f2017ef055add8",
|
|
20526
|
+
"35ea33df169b390d331733ab325dbf23b3804bc25927908e6050977563d7b10c",
|
|
20527
|
+
"7a89d0406784242b03ca187a2740898d4f69ccb7b76508ec373ad2aba5fb0a2c",
|
|
20528
|
+
"fa69c9e943572ab603b1318bc9a5c07f9d0e7c8f2cc208f6e29a6795991dab73",
|
|
20529
|
+
"192013fdee1954ba013985c022d91f37bbc34bf36ae4bcd76ab2cdf2f2b3f341",
|
|
20530
|
+
"4476fd58e33ede9cc938da7e954781fa8d5805f18cd71701cdaa4ec3bcabb085",
|
|
20531
|
+
"db80ca8efbe5dd775153ab39c63d4c387d1b5d864a1e7eae21fbd158f05d9e54",
|
|
20532
|
+
"32f3d3915f04fb43c4e835e076ec26ed7d88232f66963538308233c19055c951",
|
|
20533
|
+
"7aee698f1b8e5ed0399f45a72435961847b96097322e5f3391fd31adf03b8180",
|
|
20534
|
+
"1829b14538d913852bacb82a50d79cade45ea56c78fb2bc85e6e46f0f9ac6439",
|
|
20535
|
+
"c012bec1b6a225a0f03b7fc9133746d2130ce8f45cd1c2c86559bc31cafd81f7",
|
|
20536
|
+
"11f62b29badb21f0489e835975e5fa62b996188ed7194d01590b5eb6f020615b",
|
|
20537
|
+
"b83879ae5540a9e46140c5a1d0f93599e9aa48fbe752aba12db7a93cd8940834",
|
|
20538
|
+
"ec38c5e586782f376daec565302b3548fd22ea3236c384f9bb37b1d16bde3f39",
|
|
20539
|
+
"c40437e8afb99cc4cd6005ae3710d861b6f0af0da0f1de35499f4cb9ac790999",
|
|
20540
|
+
"4d62da692bc8735f3979f54e6c7e2c3b2e9d530e5898958aa41a869b5e9e6f11",
|
|
20541
|
+
"bec052b7cf7668da7f1cdddb5bae4c50b6db87ece0ec6930f1229e6e0bb8f96e",
|
|
20542
|
+
"0fffc00cc3d6fe32c93d857c8b4f8ad9754f7daf76c51cda6acc86aa5487e1e6",
|
|
20543
|
+
"1cb7d1f65d5014954a6d25bde4c9a271910ffed240899178b8dbf9e138ce83f3",
|
|
20544
|
+
"e3bc44c749ba6cecd50d1e4dc45c1dd3d896414982b339f07d62351c396e975d",
|
|
20545
|
+
"db0435ad74da7ba0e3ec362aab60c011ac24caa8aa9630dc77393058710c0deb",
|
|
20546
|
+
"aec395f5fdccc42c13ff39263ab101c5bebe68ed4181ee126a819c3a0a45aa94",
|
|
20547
|
+
"4867ae2b7f8bb207bad663759487b729be8bf58f9523d4589b885e5857966cc1",
|
|
20548
|
+
"5f9efed48536447a7ffc8d68b8a43eb20bceeb2adab884352f20cbbe5be37ac5",
|
|
20549
|
+
"51d5d412d5ff4edbc2dc837c33978d85678b5ff6461c987944469f535dbcc295",
|
|
20550
|
+
"d28de55c47c64bd9f7a7493825e1913f9fbf317976d6981f71ae24fb21631dea",
|
|
20551
|
+
"cb9a8c33b1dc6c1188674a1a846e97d1b3a58b2c386021b63139cfd33c1abe6c",
|
|
20552
|
+
"33bae8d5c6e38a730e15ceab19335145ed06988d475696690302daa1bf1221f3",
|
|
20553
|
+
"5f9b146efdac28c3d67a8b1fcdca3ab5950b69e7c74defa7dca5cbf4e44cc98a",
|
|
20554
|
+
"af428399983712d11e4cfc9999bd600ba5121f17acb1ce97f70e695ef68772b2"
|
|
20555
|
+
]
|
|
20556
|
+
}
|
|
20557
|
+
];
|
|
20398
20558
|
function hashBundledContent(content) {
|
|
20399
20559
|
return createHash2("sha256").update(content.replace(/\r\n/g, "\n")).digest("hex");
|
|
20400
20560
|
}
|
|
20401
20561
|
function listArgentSkillsInLock(lockPath) {
|
|
20402
20562
|
try {
|
|
20403
|
-
const raw =
|
|
20563
|
+
const raw = fs17.readFileSync(lockPath, "utf8");
|
|
20404
20564
|
const lock = JSON.parse(raw);
|
|
20405
20565
|
const tracked = lock.skills ?? {};
|
|
20406
20566
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20423,21 +20583,21 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20423
20583
|
"opencode.jsonc",
|
|
20424
20584
|
"skills-lock.json"
|
|
20425
20585
|
];
|
|
20426
|
-
function resolveProjectRoot2(startDir, homeDir =
|
|
20427
|
-
const initialDir =
|
|
20428
|
-
const home =
|
|
20586
|
+
function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
20587
|
+
const initialDir = path18.resolve(startDir);
|
|
20588
|
+
const home = canonicalPath(homeDir);
|
|
20429
20589
|
let currentDir = initialDir;
|
|
20430
20590
|
while (true) {
|
|
20431
|
-
if (currentDir
|
|
20591
|
+
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20432
20592
|
return initialDir;
|
|
20433
20593
|
}
|
|
20434
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20594
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs17.existsSync(path18.join(currentDir, marker)))) {
|
|
20435
20595
|
return currentDir;
|
|
20436
20596
|
}
|
|
20437
|
-
if (
|
|
20597
|
+
if (fs17.existsSync(path18.join(currentDir, ".git"))) {
|
|
20438
20598
|
return currentDir;
|
|
20439
20599
|
}
|
|
20440
|
-
const parentDir =
|
|
20600
|
+
const parentDir = path18.dirname(currentDir);
|
|
20441
20601
|
if (parentDir === currentDir) {
|
|
20442
20602
|
return initialDir;
|
|
20443
20603
|
}
|
|
@@ -20445,20 +20605,20 @@ function resolveProjectRoot2(startDir, homeDir = os2.homedir()) {
|
|
|
20445
20605
|
}
|
|
20446
20606
|
}
|
|
20447
20607
|
function readToml(filePath) {
|
|
20448
|
-
if (!
|
|
20608
|
+
if (!fs17.existsSync(filePath)) return {};
|
|
20449
20609
|
try {
|
|
20450
|
-
return parse(
|
|
20610
|
+
return parse(fs17.readFileSync(filePath, "utf8"));
|
|
20451
20611
|
} catch {
|
|
20452
20612
|
return {};
|
|
20453
20613
|
}
|
|
20454
20614
|
}
|
|
20455
20615
|
function writeToml(filePath, data) {
|
|
20456
|
-
|
|
20457
|
-
|
|
20616
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20617
|
+
fs17.writeFileSync(filePath, stringify(data) + "\n");
|
|
20458
20618
|
}
|
|
20459
20619
|
function readYaml(filePath) {
|
|
20460
|
-
if (!
|
|
20461
|
-
const text2 =
|
|
20620
|
+
if (!fs17.existsSync(filePath)) return new import_yaml.Document({});
|
|
20621
|
+
const text2 = fs17.readFileSync(filePath, "utf8");
|
|
20462
20622
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20463
20623
|
if (doc.errors.length > 0) {
|
|
20464
20624
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20467,20 +20627,20 @@ function readYaml(filePath) {
|
|
|
20467
20627
|
return doc;
|
|
20468
20628
|
}
|
|
20469
20629
|
function writeYaml(filePath, doc) {
|
|
20470
|
-
|
|
20471
|
-
|
|
20630
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20631
|
+
fs17.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20472
20632
|
}
|
|
20473
20633
|
function readJson(filePath) {
|
|
20474
|
-
if (!
|
|
20634
|
+
if (!fs17.existsSync(filePath)) return {};
|
|
20475
20635
|
try {
|
|
20476
|
-
return JSON.parse(
|
|
20636
|
+
return JSON.parse(fs17.readFileSync(filePath, "utf8"));
|
|
20477
20637
|
} catch {
|
|
20478
20638
|
return {};
|
|
20479
20639
|
}
|
|
20480
20640
|
}
|
|
20481
20641
|
function writeJson(filePath, data) {
|
|
20482
|
-
|
|
20483
|
-
|
|
20642
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20643
|
+
fs17.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20484
20644
|
}
|
|
20485
20645
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20486
20646
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20488,8 +20648,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20488
20648
|
return applyEdits(text2, edits);
|
|
20489
20649
|
}
|
|
20490
20650
|
function readJsoncFileRaw(filePath) {
|
|
20491
|
-
if (!
|
|
20492
|
-
let text2 =
|
|
20651
|
+
if (!fs17.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20652
|
+
let text2 = fs17.readFileSync(filePath, "utf8");
|
|
20493
20653
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20494
20654
|
if (hadBom) text2 = text2.slice(1);
|
|
20495
20655
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20508,26 +20668,26 @@ function isEmptyPlainObject(value) {
|
|
|
20508
20668
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20509
20669
|
}
|
|
20510
20670
|
function removePath(targetPath) {
|
|
20511
|
-
const entry =
|
|
20671
|
+
const entry = fs17.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20512
20672
|
if (!entry) return false;
|
|
20513
|
-
if (entry.isSymbolicLink())
|
|
20514
|
-
else
|
|
20673
|
+
if (entry.isSymbolicLink()) fs17.unlinkSync(targetPath);
|
|
20674
|
+
else fs17.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20515
20675
|
return true;
|
|
20516
20676
|
}
|
|
20517
20677
|
function rmEmptyDir(dirPath) {
|
|
20518
20678
|
try {
|
|
20519
|
-
if (!
|
|
20520
|
-
if (!
|
|
20521
|
-
if (
|
|
20522
|
-
|
|
20679
|
+
if (!fs17.existsSync(dirPath)) return false;
|
|
20680
|
+
if (!fs17.statSync(dirPath).isDirectory()) return false;
|
|
20681
|
+
if (fs17.readdirSync(dirPath).length > 0) return false;
|
|
20682
|
+
fs17.rmdirSync(dirPath);
|
|
20523
20683
|
return true;
|
|
20524
20684
|
} catch {
|
|
20525
20685
|
return false;
|
|
20526
20686
|
}
|
|
20527
20687
|
}
|
|
20528
20688
|
function readJsonc(filePath) {
|
|
20529
|
-
if (!
|
|
20530
|
-
let raw =
|
|
20689
|
+
if (!fs17.existsSync(filePath)) return {};
|
|
20690
|
+
let raw = fs17.readFileSync(filePath, "utf8");
|
|
20531
20691
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20532
20692
|
if (raw.trim() === "") return {};
|
|
20533
20693
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20546,18 +20706,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20546
20706
|
}
|
|
20547
20707
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20548
20708
|
if (isEmptyPlainObject(parsed)) {
|
|
20549
|
-
|
|
20550
|
-
rmEmptyDir(
|
|
20709
|
+
fs17.rmSync(filePath, { force: true });
|
|
20710
|
+
rmEmptyDir(path18.dirname(filePath));
|
|
20551
20711
|
return;
|
|
20552
20712
|
}
|
|
20553
|
-
|
|
20713
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20554
20714
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20555
|
-
|
|
20715
|
+
fs17.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20556
20716
|
}
|
|
20557
20717
|
var MAX_SYMLINK_HOPS = 40;
|
|
20558
20718
|
function realpathOrSelf(p) {
|
|
20559
20719
|
try {
|
|
20560
|
-
return
|
|
20720
|
+
return fs17.realpathSync(p);
|
|
20561
20721
|
} catch {
|
|
20562
20722
|
return p;
|
|
20563
20723
|
}
|
|
@@ -20567,13 +20727,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20567
20727
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20568
20728
|
let entry;
|
|
20569
20729
|
try {
|
|
20570
|
-
entry =
|
|
20730
|
+
entry = fs17.lstatSync(current);
|
|
20571
20731
|
} catch {
|
|
20572
|
-
return current === dest || dirExists(
|
|
20732
|
+
return current === dest || dirExists(path18.dirname(current)) ? current : dest;
|
|
20573
20733
|
}
|
|
20574
20734
|
if (!entry.isSymbolicLink()) return current;
|
|
20575
20735
|
try {
|
|
20576
|
-
current =
|
|
20736
|
+
current = path18.resolve(realpathOrSelf(path18.dirname(current)), fs17.readlinkSync(current));
|
|
20577
20737
|
} catch {
|
|
20578
20738
|
return dest;
|
|
20579
20739
|
}
|
|
@@ -20581,30 +20741,30 @@ function resolveLinkedDestination(dest) {
|
|
|
20581
20741
|
return dest;
|
|
20582
20742
|
}
|
|
20583
20743
|
function copyDir(src, dest) {
|
|
20584
|
-
if (!
|
|
20744
|
+
if (!fs17.existsSync(src) || !treeHasFiles(src)) return null;
|
|
20585
20745
|
const target = resolveLinkedDestination(dest);
|
|
20586
20746
|
copyTree(src, target);
|
|
20587
20747
|
return target;
|
|
20588
20748
|
}
|
|
20589
20749
|
function treeHasFiles(dir) {
|
|
20590
|
-
return
|
|
20750
|
+
return fs17.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path18.join(dir, entry.name)));
|
|
20591
20751
|
}
|
|
20592
20752
|
function copyTree(src, dest) {
|
|
20593
|
-
const entries =
|
|
20594
|
-
|
|
20753
|
+
const entries = fs17.readdirSync(src, { withFileTypes: true });
|
|
20754
|
+
fs17.mkdirSync(dest, { recursive: true });
|
|
20595
20755
|
for (const entry of entries) {
|
|
20596
|
-
const from =
|
|
20597
|
-
const to = resolveLinkedDestination(
|
|
20756
|
+
const from = path18.join(src, entry.name);
|
|
20757
|
+
const to = resolveLinkedDestination(path18.join(dest, entry.name));
|
|
20598
20758
|
if (entry.isDirectory()) copyTree(from, to);
|
|
20599
|
-
else
|
|
20759
|
+
else fs17.copyFileSync(from, to);
|
|
20600
20760
|
}
|
|
20601
20761
|
}
|
|
20602
20762
|
function readRetiredFile(targetDir, relativePath) {
|
|
20603
|
-
const entryPath =
|
|
20763
|
+
const entryPath = path18.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
20604
20764
|
const file = resolveLinkedDestination(entryPath);
|
|
20605
20765
|
try {
|
|
20606
|
-
if (!
|
|
20607
|
-
return
|
|
20766
|
+
if (!fs17.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
20767
|
+
return fs17.readFileSync(file, "utf8");
|
|
20608
20768
|
} catch {
|
|
20609
20769
|
return null;
|
|
20610
20770
|
}
|
|
@@ -20612,7 +20772,8 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
20612
20772
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
20613
20773
|
const found = [];
|
|
20614
20774
|
for (const { path: relativePath, shipped } of retired) {
|
|
20615
|
-
if (
|
|
20775
|
+
if (bundleDir !== null && fs17.existsSync(path18.join(bundleDir, ...relativePath.split("/"))))
|
|
20776
|
+
continue;
|
|
20616
20777
|
const content = readRetiredFile(targetDir, relativePath);
|
|
20617
20778
|
if (content === null) continue;
|
|
20618
20779
|
const sha256 = hashBundledContent(content);
|
|
@@ -20627,17 +20788,17 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
20627
20788
|
const content = readRetiredFile(targetDir, relativePath);
|
|
20628
20789
|
if (content === null || hashBundledContent(content) !== sha256) continue;
|
|
20629
20790
|
const segments = relativePath.split("/");
|
|
20630
|
-
const entryPath =
|
|
20791
|
+
const entryPath = path18.join(dir, ...segments);
|
|
20631
20792
|
const file = resolveLinkedDestination(entryPath);
|
|
20632
20793
|
try {
|
|
20633
|
-
|
|
20794
|
+
fs17.rmSync(file);
|
|
20634
20795
|
if (file !== entryPath) removePath(entryPath);
|
|
20635
20796
|
removedPaths.push(relativePath);
|
|
20636
20797
|
} catch {
|
|
20637
20798
|
continue;
|
|
20638
20799
|
}
|
|
20639
20800
|
for (let depth = segments.length - 1; depth > 0; depth--) {
|
|
20640
|
-
if (!rmEmptyDir(
|
|
20801
|
+
if (!rmEmptyDir(path18.join(dir, ...segments.slice(0, depth)))) break;
|
|
20641
20802
|
}
|
|
20642
20803
|
}
|
|
20643
20804
|
const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
|
|
@@ -20645,15 +20806,15 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
20645
20806
|
}
|
|
20646
20807
|
function dirExists(p) {
|
|
20647
20808
|
try {
|
|
20648
|
-
return
|
|
20809
|
+
return fs17.statSync(p).isDirectory();
|
|
20649
20810
|
} catch {
|
|
20650
20811
|
return false;
|
|
20651
20812
|
}
|
|
20652
20813
|
}
|
|
20653
20814
|
function getInstalledVersion() {
|
|
20654
20815
|
try {
|
|
20655
|
-
const pkgPath =
|
|
20656
|
-
const pkg = JSON.parse(
|
|
20816
|
+
const pkgPath = path18.join(PACKAGE_ROOT, "package.json");
|
|
20817
|
+
const pkg = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
|
|
20657
20818
|
return pkg.version ?? null;
|
|
20658
20819
|
} catch {
|
|
20659
20820
|
return null;
|
|
@@ -20711,12 +20872,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
20711
20872
|
} catch {
|
|
20712
20873
|
return false;
|
|
20713
20874
|
}
|
|
20714
|
-
return new Promise((
|
|
20715
|
-
const timer = setTimeout(() =>
|
|
20875
|
+
return new Promise((resolve21) => {
|
|
20876
|
+
const timer = setTimeout(() => resolve21(false), timeoutMs);
|
|
20716
20877
|
timer.unref();
|
|
20717
20878
|
dns.lookup(host, (err) => {
|
|
20718
20879
|
clearTimeout(timer);
|
|
20719
|
-
|
|
20880
|
+
resolve21(!err);
|
|
20720
20881
|
});
|
|
20721
20882
|
});
|
|
20722
20883
|
}
|
|
@@ -20733,12 +20894,27 @@ function escapeStringRegexp(string) {
|
|
|
20733
20894
|
}
|
|
20734
20895
|
|
|
20735
20896
|
// ../argent-installer/src/mcp-configs.ts
|
|
20736
|
-
var TOOL_SERVER_BUNDLE =
|
|
20897
|
+
var TOOL_SERVER_BUNDLE = path19.join(import.meta.dirname, "tool-server.cjs");
|
|
20737
20898
|
function getAvailableToolIds() {
|
|
20738
20899
|
const out = execFileSync4("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
20739
20900
|
const tools = JSON.parse(out);
|
|
20740
20901
|
return tools.map((t2) => t2.id);
|
|
20741
20902
|
}
|
|
20903
|
+
function existingEntryKeys(configPath, serversKey, keys) {
|
|
20904
|
+
let entry;
|
|
20905
|
+
try {
|
|
20906
|
+
entry = readJsonc(configPath)[serversKey]?.[MCP_SERVER_KEY];
|
|
20907
|
+
} catch {
|
|
20908
|
+
return {};
|
|
20909
|
+
}
|
|
20910
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return {};
|
|
20911
|
+
const kept = {};
|
|
20912
|
+
for (const key of keys) {
|
|
20913
|
+
const value = entry[key];
|
|
20914
|
+
if (value !== void 0) kept[key] = value;
|
|
20915
|
+
}
|
|
20916
|
+
return kept;
|
|
20917
|
+
}
|
|
20742
20918
|
function buildMcpEntry(mode = { kind: "global" }) {
|
|
20743
20919
|
switch (mode.kind) {
|
|
20744
20920
|
case "local-node":
|
|
@@ -20747,6 +20923,8 @@ function buildMcpEntry(mode = { kind: "global" }) {
|
|
|
20747
20923
|
return { command: "yarn", args: ["argent", "mcp"] };
|
|
20748
20924
|
case "local-npx":
|
|
20749
20925
|
return { command: "npx", args: ["--no-install", "argent", "mcp"] };
|
|
20926
|
+
case "global-pinned":
|
|
20927
|
+
return { command: mode.node, args: [mode.cli, "mcp"] };
|
|
20750
20928
|
default:
|
|
20751
20929
|
return { command: MCP_BINARY_NAME, args: ["mcp"] };
|
|
20752
20930
|
}
|
|
@@ -20760,8 +20938,15 @@ function resolveLocalCommandMode(root) {
|
|
|
20760
20938
|
if (binRelPath) return { kind: "local-node", binRelPath };
|
|
20761
20939
|
return { kind: "local-npx" };
|
|
20762
20940
|
}
|
|
20763
|
-
function
|
|
20764
|
-
|
|
20941
|
+
function resolveGlobalCommandMode() {
|
|
20942
|
+
const launch = getGloballyInstalledLaunchPaths();
|
|
20943
|
+
return launch ? { kind: "global-pinned", ...launch } : { kind: "global" };
|
|
20944
|
+
}
|
|
20945
|
+
function getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode) {
|
|
20946
|
+
if (installMode === "local" && configScope === "local" && localCmdMode) {
|
|
20947
|
+
return getMcpEntry(localCmdMode);
|
|
20948
|
+
}
|
|
20949
|
+
return getMcpEntry(configScope === "global" ? globalCmdMode : { kind: "global" });
|
|
20765
20950
|
}
|
|
20766
20951
|
function hasEnv(entry) {
|
|
20767
20952
|
return entry.env != null && Object.keys(entry.env).length > 0;
|
|
@@ -20772,10 +20957,10 @@ function hasCustomizingEnv(entry) {
|
|
|
20772
20957
|
}
|
|
20773
20958
|
function removeDirIfEmpty(dirPath) {
|
|
20774
20959
|
try {
|
|
20775
|
-
if (!
|
|
20776
|
-
if (!
|
|
20777
|
-
if (
|
|
20778
|
-
|
|
20960
|
+
if (!fs18.existsSync(dirPath)) return;
|
|
20961
|
+
if (!fs18.statSync(dirPath).isDirectory()) return;
|
|
20962
|
+
if (fs18.readdirSync(dirPath).length > 0) return;
|
|
20963
|
+
fs18.rmdirSync(dirPath);
|
|
20779
20964
|
} catch {
|
|
20780
20965
|
}
|
|
20781
20966
|
}
|
|
@@ -20806,13 +20991,14 @@ function normalizeServerEntry(raw) {
|
|
|
20806
20991
|
}
|
|
20807
20992
|
function isArgentManagedEntry(entry) {
|
|
20808
20993
|
if (entry === null || hasCustomizingEnv(entry)) return false;
|
|
20994
|
+
if (isPinnedGlobalEntry(entry)) return true;
|
|
20809
20995
|
const { command, args } = entry;
|
|
20810
20996
|
switch (command) {
|
|
20811
20997
|
case MCP_BINARY_NAME:
|
|
20812
20998
|
return args.length === 1 && args[0] === "mcp";
|
|
20813
20999
|
case "node": {
|
|
20814
21000
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
20815
|
-
if (
|
|
21001
|
+
if (path19.isAbsolute(args[0])) return false;
|
|
20816
21002
|
const normalized = args[0].split("\\").join("/");
|
|
20817
21003
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
20818
21004
|
}
|
|
@@ -20824,10 +21010,14 @@ function isArgentManagedEntry(entry) {
|
|
|
20824
21010
|
return false;
|
|
20825
21011
|
}
|
|
20826
21012
|
}
|
|
21013
|
+
function isPinnedGlobalEntry(entry) {
|
|
21014
|
+
const [cli, subcommand] = entry.args;
|
|
21015
|
+
return path19.isAbsolute(entry.command) && path19.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path19.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
|
|
21016
|
+
}
|
|
20827
21017
|
function writeTomlOrRemove(filePath, data) {
|
|
20828
21018
|
if (Object.keys(data).length === 0) {
|
|
20829
|
-
|
|
20830
|
-
removeDirIfEmpty(
|
|
21019
|
+
fs18.rmSync(filePath, { force: true });
|
|
21020
|
+
removeDirIfEmpty(path19.dirname(filePath));
|
|
20831
21021
|
return;
|
|
20832
21022
|
}
|
|
20833
21023
|
writeToml(filePath, data);
|
|
@@ -20836,12 +21026,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
20836
21026
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
20837
21027
|
}
|
|
20838
21028
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
20839
|
-
return
|
|
21029
|
+
return fs18.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
20840
21030
|
}
|
|
20841
21031
|
function parseJsoncStrict(filePath) {
|
|
20842
21032
|
let raw;
|
|
20843
21033
|
try {
|
|
20844
|
-
raw =
|
|
21034
|
+
raw = fs18.readFileSync(filePath, "utf8");
|
|
20845
21035
|
} catch {
|
|
20846
21036
|
return null;
|
|
20847
21037
|
}
|
|
@@ -20854,14 +21044,14 @@ function parseJsoncStrict(filePath) {
|
|
|
20854
21044
|
}
|
|
20855
21045
|
function parseTomlStrict(filePath) {
|
|
20856
21046
|
try {
|
|
20857
|
-
return parse(
|
|
21047
|
+
return parse(fs18.readFileSync(filePath, "utf8"));
|
|
20858
21048
|
} catch {
|
|
20859
21049
|
return null;
|
|
20860
21050
|
}
|
|
20861
21051
|
}
|
|
20862
21052
|
function parseYamlStrict(filePath) {
|
|
20863
21053
|
try {
|
|
20864
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21054
|
+
const parsed = (0, import_yaml2.parse)(fs18.readFileSync(filePath, "utf8"));
|
|
20865
21055
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
20866
21056
|
return parsed;
|
|
20867
21057
|
} catch {
|
|
@@ -20884,7 +21074,7 @@ function bundledManagedNames(kind) {
|
|
|
20884
21074
|
if (cached2) return cached2;
|
|
20885
21075
|
let names;
|
|
20886
21076
|
try {
|
|
20887
|
-
names = new Set(
|
|
21077
|
+
names = new Set(fs18.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
20888
21078
|
} catch {
|
|
20889
21079
|
names = /* @__PURE__ */ new Set();
|
|
20890
21080
|
}
|
|
@@ -20895,7 +21085,7 @@ function bundledManagedNames(kind) {
|
|
|
20895
21085
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
20896
21086
|
let entries;
|
|
20897
21087
|
try {
|
|
20898
|
-
entries =
|
|
21088
|
+
entries = fs18.readdirSync(dir);
|
|
20899
21089
|
} catch {
|
|
20900
21090
|
return false;
|
|
20901
21091
|
}
|
|
@@ -20907,13 +21097,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
20907
21097
|
function cursorDirLooksArgentOnly(dir) {
|
|
20908
21098
|
let entries;
|
|
20909
21099
|
try {
|
|
20910
|
-
entries =
|
|
21100
|
+
entries = fs18.readdirSync(dir);
|
|
20911
21101
|
} catch {
|
|
20912
21102
|
return false;
|
|
20913
21103
|
}
|
|
20914
21104
|
if (entries.length === 0) return false;
|
|
20915
21105
|
return entries.every((entry) => {
|
|
20916
|
-
const full =
|
|
21106
|
+
const full = path19.join(dir, entry);
|
|
20917
21107
|
if (entry === "mcp.json") {
|
|
20918
21108
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
20919
21109
|
}
|
|
@@ -20946,13 +21136,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
20946
21136
|
function claudeDirLooksArgentOnly(dir) {
|
|
20947
21137
|
let entries;
|
|
20948
21138
|
try {
|
|
20949
|
-
entries =
|
|
21139
|
+
entries = fs18.readdirSync(dir);
|
|
20950
21140
|
} catch {
|
|
20951
21141
|
return false;
|
|
20952
21142
|
}
|
|
20953
21143
|
if (entries.length === 0) return false;
|
|
20954
21144
|
return entries.every((entry) => {
|
|
20955
|
-
const full =
|
|
21145
|
+
const full = path19.join(dir, entry);
|
|
20956
21146
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
20957
21147
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
20958
21148
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -20963,25 +21153,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
20963
21153
|
function vscodeDirLooksArgentOnly(dir) {
|
|
20964
21154
|
let entries;
|
|
20965
21155
|
try {
|
|
20966
|
-
entries =
|
|
21156
|
+
entries = fs18.readdirSync(dir);
|
|
20967
21157
|
} catch {
|
|
20968
21158
|
return false;
|
|
20969
21159
|
}
|
|
20970
21160
|
if (entries.length === 0) return false;
|
|
20971
21161
|
return entries.every(
|
|
20972
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21162
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "servers")
|
|
20973
21163
|
);
|
|
20974
21164
|
}
|
|
20975
21165
|
function windsurfDirLooksArgentOnly(dir) {
|
|
20976
21166
|
let entries;
|
|
20977
21167
|
try {
|
|
20978
|
-
entries =
|
|
21168
|
+
entries = fs18.readdirSync(dir);
|
|
20979
21169
|
} catch {
|
|
20980
21170
|
return false;
|
|
20981
21171
|
}
|
|
20982
21172
|
if (entries.length === 0) return false;
|
|
20983
21173
|
return entries.every(
|
|
20984
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21174
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "mcpServers")
|
|
20985
21175
|
);
|
|
20986
21176
|
}
|
|
20987
21177
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -21012,25 +21202,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21012
21202
|
function zedDirLooksArgentOnly(dir) {
|
|
21013
21203
|
let entries;
|
|
21014
21204
|
try {
|
|
21015
|
-
entries =
|
|
21205
|
+
entries = fs18.readdirSync(dir);
|
|
21016
21206
|
} catch {
|
|
21017
21207
|
return false;
|
|
21018
21208
|
}
|
|
21019
21209
|
if (entries.length === 0) return false;
|
|
21020
21210
|
return entries.every(
|
|
21021
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21211
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path19.join(dir, entry))
|
|
21022
21212
|
);
|
|
21023
21213
|
}
|
|
21024
21214
|
function geminiDirLooksArgentOnly(dir) {
|
|
21025
21215
|
let entries;
|
|
21026
21216
|
try {
|
|
21027
|
-
entries =
|
|
21217
|
+
entries = fs18.readdirSync(dir);
|
|
21028
21218
|
} catch {
|
|
21029
21219
|
return false;
|
|
21030
21220
|
}
|
|
21031
21221
|
if (entries.length === 0) return false;
|
|
21032
21222
|
return entries.every((entry) => {
|
|
21033
|
-
const full =
|
|
21223
|
+
const full = path19.join(dir, entry);
|
|
21034
21224
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21035
21225
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21036
21226
|
return false;
|
|
@@ -21049,48 +21239,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21049
21239
|
function hermesDirLooksArgentOnly(dir) {
|
|
21050
21240
|
let entries;
|
|
21051
21241
|
try {
|
|
21052
|
-
entries =
|
|
21242
|
+
entries = fs18.readdirSync(dir);
|
|
21053
21243
|
} catch {
|
|
21054
21244
|
return false;
|
|
21055
21245
|
}
|
|
21056
21246
|
if (entries.length === 0) return false;
|
|
21057
21247
|
return entries.every(
|
|
21058
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21248
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path19.join(dir, entry))
|
|
21059
21249
|
);
|
|
21060
21250
|
}
|
|
21061
21251
|
function kiroDirLooksArgentOnly(dir) {
|
|
21062
21252
|
let entries;
|
|
21063
21253
|
try {
|
|
21064
|
-
entries =
|
|
21254
|
+
entries = fs18.readdirSync(dir);
|
|
21065
21255
|
} catch {
|
|
21066
21256
|
return false;
|
|
21067
21257
|
}
|
|
21068
21258
|
if (entries.length === 0) return false;
|
|
21069
21259
|
return entries.every((entry) => {
|
|
21070
21260
|
if (entry !== "settings") return false;
|
|
21071
|
-
const settingsDir =
|
|
21261
|
+
const settingsDir = path19.join(dir, entry);
|
|
21072
21262
|
let settingsEntries;
|
|
21073
21263
|
try {
|
|
21074
|
-
settingsEntries =
|
|
21264
|
+
settingsEntries = fs18.readdirSync(settingsDir);
|
|
21075
21265
|
} catch {
|
|
21076
21266
|
return false;
|
|
21077
21267
|
}
|
|
21078
21268
|
if (settingsEntries.length === 0) return false;
|
|
21079
21269
|
return settingsEntries.every(
|
|
21080
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21270
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path19.join(settingsDir, name), "mcpServers")
|
|
21081
21271
|
);
|
|
21082
21272
|
});
|
|
21083
21273
|
}
|
|
21084
21274
|
function codexDirLooksArgentOnly(dir) {
|
|
21085
21275
|
let entries;
|
|
21086
21276
|
try {
|
|
21087
|
-
entries =
|
|
21277
|
+
entries = fs18.readdirSync(dir);
|
|
21088
21278
|
} catch {
|
|
21089
21279
|
return false;
|
|
21090
21280
|
}
|
|
21091
21281
|
if (entries.length === 0) return false;
|
|
21092
21282
|
return entries.every((entry) => {
|
|
21093
|
-
const full =
|
|
21283
|
+
const full = path19.join(dir, entry);
|
|
21094
21284
|
if (entry === "config.toml") {
|
|
21095
21285
|
const config = parseTomlStrict(full);
|
|
21096
21286
|
if (config === null) return false;
|
|
@@ -21114,16 +21304,23 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21114
21304
|
return false;
|
|
21115
21305
|
});
|
|
21116
21306
|
}
|
|
21307
|
+
function cursorPermissionsPath() {
|
|
21308
|
+
return path19.join(homedir5(), ".cursor", "permissions.json");
|
|
21309
|
+
}
|
|
21310
|
+
function cursorPermissionsList() {
|
|
21311
|
+
const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
|
|
21312
|
+
return Array.isArray(list) ? list : null;
|
|
21313
|
+
}
|
|
21117
21314
|
var cursorAdapter = {
|
|
21118
21315
|
name: "Cursor",
|
|
21119
21316
|
detect() {
|
|
21120
|
-
return dirHasEditorEvidence(
|
|
21317
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21121
21318
|
},
|
|
21122
21319
|
projectPath(root) {
|
|
21123
|
-
return
|
|
21320
|
+
return path19.join(root, ".cursor", "mcp.json");
|
|
21124
21321
|
},
|
|
21125
21322
|
globalPath() {
|
|
21126
|
-
return
|
|
21323
|
+
return path19.join(homedir5(), ".cursor", "mcp.json");
|
|
21127
21324
|
},
|
|
21128
21325
|
// Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
|
|
21129
21326
|
// text edits that preserve user comments and foreign servers.
|
|
@@ -21135,7 +21332,7 @@ var cursorAdapter = {
|
|
|
21135
21332
|
});
|
|
21136
21333
|
},
|
|
21137
21334
|
remove(configPath) {
|
|
21138
|
-
if (!
|
|
21335
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21139
21336
|
const config = readJsonc(configPath);
|
|
21140
21337
|
const servers = config.mcpServers;
|
|
21141
21338
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21143,7 +21340,7 @@ var cursorAdapter = {
|
|
|
21143
21340
|
return true;
|
|
21144
21341
|
},
|
|
21145
21342
|
getArgentEntry(configPath) {
|
|
21146
|
-
if (!
|
|
21343
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21147
21344
|
const config = readJsonc(configPath);
|
|
21148
21345
|
const servers = config.mcpServers;
|
|
21149
21346
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21153,17 +21350,22 @@ var cursorAdapter = {
|
|
|
21153
21350
|
},
|
|
21154
21351
|
// The allowlist lives in a separate ~/.cursor/permissions.json that may carry
|
|
21155
21352
|
// the user's own rules, so edit that one key instead of rewriting the file.
|
|
21353
|
+
// Only a file that already has an mcpAllowlist is edited. Once that key is
|
|
21354
|
+
// non-empty, Cursor enforces the file: Run Everything drops to Allowlist, and
|
|
21355
|
+
// the file's list replaces the in-IDE one. Under Run Everything the rule does
|
|
21356
|
+
// nothing anyway, and without the file the user approves argent in Cursor.
|
|
21357
|
+
allowlistSkipReason() {
|
|
21358
|
+
return cursorPermissionsList() === null ? "creating ~/.cursor/permissions.json would turn off Cursor's Run Everything mode; approve argent in Cursor instead" : null;
|
|
21359
|
+
},
|
|
21156
21360
|
addAllowlist() {
|
|
21157
|
-
const
|
|
21158
|
-
|
|
21159
|
-
|
|
21160
|
-
if (list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
21161
|
-
editJsoncFile(permPath, ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
|
|
21361
|
+
const list = cursorPermissionsList();
|
|
21362
|
+
if (list === null || list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
21363
|
+
editJsoncFile(cursorPermissionsPath(), ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
|
|
21162
21364
|
},
|
|
21163
21365
|
removeAllowlist(_root, scope) {
|
|
21164
21366
|
if (scope !== "global") return;
|
|
21165
|
-
const permPath =
|
|
21166
|
-
if (!
|
|
21367
|
+
const permPath = cursorPermissionsPath();
|
|
21368
|
+
if (!fs18.existsSync(permPath)) return;
|
|
21167
21369
|
const config = readJsonc(permPath);
|
|
21168
21370
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21169
21371
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21172,18 +21374,11 @@ var cursorAdapter = {
|
|
|
21172
21374
|
}
|
|
21173
21375
|
};
|
|
21174
21376
|
function claudeProjectKeysForRoot(projects, root) {
|
|
21175
|
-
const
|
|
21176
|
-
|
|
21177
|
-
return fs17.realpathSync.native(value);
|
|
21178
|
-
} catch {
|
|
21179
|
-
return path18.resolve(value);
|
|
21180
|
-
}
|
|
21181
|
-
};
|
|
21182
|
-
const target = canonical(root);
|
|
21183
|
-
return Object.keys(projects).filter((key) => key === root || canonical(key) === target);
|
|
21377
|
+
const target = canonicalPath(root);
|
|
21378
|
+
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21184
21379
|
}
|
|
21185
21380
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21186
|
-
if (!
|
|
21381
|
+
if (!fs18.existsSync(settingsPath)) return null;
|
|
21187
21382
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21188
21383
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21189
21384
|
return {
|
|
@@ -21211,13 +21406,13 @@ var claudeAdapter = {
|
|
|
21211
21406
|
name: "Claude Code",
|
|
21212
21407
|
detect() {
|
|
21213
21408
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21214
|
-
return fileHasEditorEvidence(
|
|
21409
|
+
return fileHasEditorEvidence(path19.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path19.join(homedir5(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(homedir5(), ".claude"), claudeDirLooksArgentOnly);
|
|
21215
21410
|
},
|
|
21216
21411
|
projectPath(root) {
|
|
21217
|
-
return
|
|
21412
|
+
return path19.join(root, ".mcp.json");
|
|
21218
21413
|
},
|
|
21219
21414
|
globalPath() {
|
|
21220
|
-
return
|
|
21415
|
+
return path19.join(homedir5(), ".claude.json");
|
|
21221
21416
|
},
|
|
21222
21417
|
// JSONC is a superset of JSON, so this config shares the one comment- and
|
|
21223
21418
|
// foreign-server-preserving write path (see the Cursor adapter).
|
|
@@ -21230,7 +21425,7 @@ var claudeAdapter = {
|
|
|
21230
21425
|
});
|
|
21231
21426
|
},
|
|
21232
21427
|
remove(configPath) {
|
|
21233
|
-
if (!
|
|
21428
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21234
21429
|
const config = readJsonc(configPath);
|
|
21235
21430
|
const servers = config.mcpServers;
|
|
21236
21431
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21244,7 +21439,7 @@ var claudeAdapter = {
|
|
|
21244
21439
|
return true;
|
|
21245
21440
|
},
|
|
21246
21441
|
getArgentEntry(configPath) {
|
|
21247
|
-
if (!
|
|
21442
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21248
21443
|
const config = readJsonc(configPath);
|
|
21249
21444
|
const servers = config.mcpServers;
|
|
21250
21445
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21257,7 +21452,7 @@ var claudeAdapter = {
|
|
|
21257
21452
|
// .mcp.json rejections (see claudeDisabledListFinding).
|
|
21258
21453
|
findShadowingConfigs(root, writtenScope) {
|
|
21259
21454
|
const findings = [];
|
|
21260
|
-
const claudeJsonPath =
|
|
21455
|
+
const claudeJsonPath = path19.join(homedir5(), ".claude.json");
|
|
21261
21456
|
const projects = readJson(claudeJsonPath).projects;
|
|
21262
21457
|
if (isRecord(projects)) {
|
|
21263
21458
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21294,9 +21489,9 @@ var claudeAdapter = {
|
|
|
21294
21489
|
}
|
|
21295
21490
|
if (writtenScope === "local") {
|
|
21296
21491
|
const candidates = [
|
|
21297
|
-
[
|
|
21298
|
-
[
|
|
21299
|
-
[
|
|
21492
|
+
[path19.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21493
|
+
[path19.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21494
|
+
[path19.join(homedir5(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21300
21495
|
];
|
|
21301
21496
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21302
21497
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21315,10 +21510,10 @@ var claudeAdapter = {
|
|
|
21315
21510
|
var vscodeAdapter = {
|
|
21316
21511
|
name: "VS Code",
|
|
21317
21512
|
detect() {
|
|
21318
|
-
return dirHasEditorEvidence(
|
|
21513
|
+
return dirHasEditorEvidence(path19.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path19.join(homedir5(), ".vscode"));
|
|
21319
21514
|
},
|
|
21320
21515
|
projectPath(root) {
|
|
21321
|
-
return
|
|
21516
|
+
return path19.join(root, ".vscode", "mcp.json");
|
|
21322
21517
|
},
|
|
21323
21518
|
globalPath() {
|
|
21324
21519
|
return null;
|
|
@@ -21334,7 +21529,7 @@ var vscodeAdapter = {
|
|
|
21334
21529
|
});
|
|
21335
21530
|
},
|
|
21336
21531
|
remove(configPath) {
|
|
21337
|
-
if (!
|
|
21532
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21338
21533
|
const config = readJsonc(configPath);
|
|
21339
21534
|
const servers = config.servers;
|
|
21340
21535
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21342,7 +21537,7 @@ var vscodeAdapter = {
|
|
|
21342
21537
|
return true;
|
|
21343
21538
|
},
|
|
21344
21539
|
getArgentEntry(configPath) {
|
|
21345
|
-
if (!
|
|
21540
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21346
21541
|
const config = readJsonc(configPath);
|
|
21347
21542
|
const servers = config.servers;
|
|
21348
21543
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21355,7 +21550,7 @@ var vscodeAdapter = {
|
|
|
21355
21550
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21356
21551
|
const findings = [];
|
|
21357
21552
|
for (const userDir of vscodeUserDirs()) {
|
|
21358
|
-
const configPath =
|
|
21553
|
+
const configPath = path19.join(userDir, "mcp.json");
|
|
21359
21554
|
const entry = this.getArgentEntry(configPath);
|
|
21360
21555
|
if (!entry) continue;
|
|
21361
21556
|
findings.push({
|
|
@@ -21372,16 +21567,16 @@ var vscodeAdapter = {
|
|
|
21372
21567
|
function vscodeUserDirs() {
|
|
21373
21568
|
const bases = [];
|
|
21374
21569
|
if (process.platform === "darwin") {
|
|
21375
|
-
bases.push(
|
|
21570
|
+
bases.push(path19.join(homedir5(), "Library", "Application Support"));
|
|
21376
21571
|
} else if (process.platform === "win32") {
|
|
21377
21572
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21378
21573
|
} else {
|
|
21379
|
-
bases.push(
|
|
21574
|
+
bases.push(path19.join(homedir5(), ".config"));
|
|
21380
21575
|
}
|
|
21381
21576
|
const dirs = [];
|
|
21382
21577
|
for (const base of bases) {
|
|
21383
21578
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21384
|
-
const dir =
|
|
21579
|
+
const dir = path19.join(base, product, "User");
|
|
21385
21580
|
if (dirExists(dir)) dirs.push(dir);
|
|
21386
21581
|
}
|
|
21387
21582
|
}
|
|
@@ -21389,18 +21584,18 @@ function vscodeUserDirs() {
|
|
|
21389
21584
|
}
|
|
21390
21585
|
function devinUserConfigPath() {
|
|
21391
21586
|
if (process.platform === "win32") {
|
|
21392
|
-
const appData = process.env.APPDATA ||
|
|
21393
|
-
return
|
|
21587
|
+
const appData = process.env.APPDATA || path19.join(homedir5(), "AppData", "Roaming");
|
|
21588
|
+
return path19.join(appData, "devin", "config.json");
|
|
21394
21589
|
}
|
|
21395
21590
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
21396
|
-
return
|
|
21591
|
+
return path19.join(xdg || path19.join(homedir5(), ".config"), "devin", "config.json");
|
|
21397
21592
|
}
|
|
21398
21593
|
var windsurfAdapter = {
|
|
21399
21594
|
name: "Devin Desktop",
|
|
21400
21595
|
telemetryName: "windsurf",
|
|
21401
21596
|
detect() {
|
|
21402
21597
|
return dirHasEditorEvidence(
|
|
21403
|
-
|
|
21598
|
+
path19.join(homedir5(), ".codeium", "windsurf"),
|
|
21404
21599
|
windsurfDirLooksArgentOnly
|
|
21405
21600
|
);
|
|
21406
21601
|
},
|
|
@@ -21408,18 +21603,19 @@ var windsurfAdapter = {
|
|
|
21408
21603
|
return null;
|
|
21409
21604
|
},
|
|
21410
21605
|
globalPath() {
|
|
21411
|
-
return
|
|
21606
|
+
return path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21412
21607
|
},
|
|
21413
21608
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21414
21609
|
write(configPath, entry) {
|
|
21415
21610
|
editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
|
|
21416
21611
|
command: entry.command,
|
|
21417
21612
|
args: entry.args,
|
|
21418
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
21613
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
21614
|
+
...existingEntryKeys(configPath, "mcpServers", ["alwaysAllow"])
|
|
21419
21615
|
});
|
|
21420
21616
|
},
|
|
21421
21617
|
remove(configPath) {
|
|
21422
|
-
if (!
|
|
21618
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21423
21619
|
const config = readJsonc(configPath);
|
|
21424
21620
|
const servers = config.mcpServers;
|
|
21425
21621
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21427,7 +21623,7 @@ var windsurfAdapter = {
|
|
|
21427
21623
|
return true;
|
|
21428
21624
|
},
|
|
21429
21625
|
getArgentEntry(configPath) {
|
|
21430
|
-
if (!
|
|
21626
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21431
21627
|
const config = readJsonc(configPath);
|
|
21432
21628
|
const servers = config.mcpServers;
|
|
21433
21629
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21439,7 +21635,7 @@ var windsurfAdapter = {
|
|
|
21439
21635
|
// servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
|
|
21440
21636
|
// agent needs its own permission rule.
|
|
21441
21637
|
addAllowlist() {
|
|
21442
|
-
const configPath =
|
|
21638
|
+
const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21443
21639
|
const config = readJsonc(configPath);
|
|
21444
21640
|
const servers = config.mcpServers;
|
|
21445
21641
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21449,8 +21645,8 @@ var windsurfAdapter = {
|
|
|
21449
21645
|
removeAllowlist(_root, scope) {
|
|
21450
21646
|
if (scope !== "global") return;
|
|
21451
21647
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21452
|
-
const configPath =
|
|
21453
|
-
if (!
|
|
21648
|
+
const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21649
|
+
if (!fs18.existsSync(configPath)) return;
|
|
21454
21650
|
const config = readJsonc(configPath);
|
|
21455
21651
|
const servers = config.mcpServers;
|
|
21456
21652
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21461,13 +21657,13 @@ var windsurfAdapter = {
|
|
|
21461
21657
|
var zedAdapter = {
|
|
21462
21658
|
name: "Zed",
|
|
21463
21659
|
detect() {
|
|
21464
|
-
return dirHasEditorEvidence(
|
|
21660
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21465
21661
|
},
|
|
21466
21662
|
projectPath(root) {
|
|
21467
|
-
return
|
|
21663
|
+
return path19.join(root, ".zed", "settings.json");
|
|
21468
21664
|
},
|
|
21469
21665
|
globalPath() {
|
|
21470
|
-
return
|
|
21666
|
+
return path19.join(homedir5(), ".config", "zed", "settings.json");
|
|
21471
21667
|
},
|
|
21472
21668
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21473
21669
|
// formatting outside the touched key survive (see the Cursor adapter).
|
|
@@ -21480,7 +21676,7 @@ var zedAdapter = {
|
|
|
21480
21676
|
});
|
|
21481
21677
|
},
|
|
21482
21678
|
remove(configPath) {
|
|
21483
|
-
if (!
|
|
21679
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21484
21680
|
const config = readJsonc(configPath);
|
|
21485
21681
|
const servers = config.context_servers;
|
|
21486
21682
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21488,7 +21684,7 @@ var zedAdapter = {
|
|
|
21488
21684
|
return true;
|
|
21489
21685
|
},
|
|
21490
21686
|
getArgentEntry(configPath) {
|
|
21491
|
-
if (!
|
|
21687
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21492
21688
|
const config = readJsonc(configPath);
|
|
21493
21689
|
const servers = config.context_servers;
|
|
21494
21690
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21499,12 +21695,12 @@ var zedAdapter = {
|
|
|
21499
21695
|
// Zed has no server-level wildcard for MCP tools — each tool would need its
|
|
21500
21696
|
// own entry — so the global default is set to "allow" instead.
|
|
21501
21697
|
addAllowlist(root, scope) {
|
|
21502
|
-
const settingsPath = scope === "global" ?
|
|
21698
|
+
const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
|
|
21503
21699
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21504
21700
|
},
|
|
21505
21701
|
removeAllowlist(root, scope) {
|
|
21506
|
-
const settingsPath = scope === "global" ?
|
|
21507
|
-
if (!
|
|
21702
|
+
const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
|
|
21703
|
+
if (!fs18.existsSync(settingsPath)) return;
|
|
21508
21704
|
const config = readJsonc(settingsPath);
|
|
21509
21705
|
const perms = config.agent?.tool_permissions;
|
|
21510
21706
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21514,24 +21710,25 @@ var zedAdapter = {
|
|
|
21514
21710
|
var geminiAdapter = {
|
|
21515
21711
|
name: "Gemini",
|
|
21516
21712
|
detect() {
|
|
21517
|
-
return dirHasEditorEvidence(
|
|
21713
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21518
21714
|
},
|
|
21519
21715
|
projectPath(root) {
|
|
21520
|
-
return
|
|
21716
|
+
return path19.join(root, ".gemini", "settings.json");
|
|
21521
21717
|
},
|
|
21522
21718
|
globalPath() {
|
|
21523
|
-
return
|
|
21719
|
+
return path19.join(homedir5(), ".gemini", "settings.json");
|
|
21524
21720
|
},
|
|
21525
21721
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21526
21722
|
write(configPath, entry) {
|
|
21527
21723
|
editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
|
|
21528
21724
|
command: entry.command,
|
|
21529
21725
|
args: entry.args,
|
|
21530
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
21726
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
21727
|
+
...existingEntryKeys(configPath, "mcpServers", ["trust"])
|
|
21531
21728
|
});
|
|
21532
21729
|
},
|
|
21533
21730
|
remove(configPath) {
|
|
21534
|
-
if (!
|
|
21731
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21535
21732
|
const config = readJsonc(configPath);
|
|
21536
21733
|
const servers = config.mcpServers;
|
|
21537
21734
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21539,7 +21736,7 @@ var geminiAdapter = {
|
|
|
21539
21736
|
return true;
|
|
21540
21737
|
},
|
|
21541
21738
|
getArgentEntry(configPath) {
|
|
21542
|
-
if (!
|
|
21739
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21543
21740
|
const config = readJsonc(configPath);
|
|
21544
21741
|
const servers = config.mcpServers;
|
|
21545
21742
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21561,7 +21758,7 @@ var geminiAdapter = {
|
|
|
21561
21758
|
},
|
|
21562
21759
|
removeAllowlist(root, scope) {
|
|
21563
21760
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21564
|
-
if (!configPath || !
|
|
21761
|
+
if (!configPath || !fs18.existsSync(configPath)) {
|
|
21565
21762
|
return;
|
|
21566
21763
|
}
|
|
21567
21764
|
const config = readJsonc(configPath);
|
|
@@ -21575,27 +21772,29 @@ var CODEX_FILENAME = ".codex";
|
|
|
21575
21772
|
var codexAdapter = {
|
|
21576
21773
|
name: "Codex",
|
|
21577
21774
|
detect() {
|
|
21578
|
-
return dirHasEditorEvidence(
|
|
21775
|
+
return dirHasEditorEvidence(path19.join(homedir5(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21579
21776
|
},
|
|
21580
21777
|
projectPath(root) {
|
|
21581
|
-
return
|
|
21778
|
+
return path19.join(root, CODEX_FILENAME, "config.toml");
|
|
21582
21779
|
},
|
|
21583
21780
|
globalPath() {
|
|
21584
|
-
return
|
|
21781
|
+
return path19.join(homedir5(), CODEX_FILENAME, "config.toml");
|
|
21585
21782
|
},
|
|
21586
21783
|
write(configPath, entry) {
|
|
21587
21784
|
const config = readToml(configPath);
|
|
21588
21785
|
const servers = config.mcp_servers ?? {};
|
|
21786
|
+
const previous = servers[MCP_SERVER_KEY];
|
|
21589
21787
|
servers[MCP_SERVER_KEY] = {
|
|
21590
21788
|
command: entry.command,
|
|
21591
21789
|
args: entry.args,
|
|
21592
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
21790
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
21791
|
+
...previous?.tools !== void 0 ? { tools: previous.tools } : {}
|
|
21593
21792
|
};
|
|
21594
21793
|
config.mcp_servers = servers;
|
|
21595
21794
|
writeToml(configPath, config);
|
|
21596
21795
|
},
|
|
21597
21796
|
remove(configPath) {
|
|
21598
|
-
if (!
|
|
21797
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21599
21798
|
const config = readToml(configPath);
|
|
21600
21799
|
const servers = config.mcp_servers;
|
|
21601
21800
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21605,7 +21804,7 @@ var codexAdapter = {
|
|
|
21605
21804
|
return true;
|
|
21606
21805
|
},
|
|
21607
21806
|
getArgentEntry(configPath) {
|
|
21608
|
-
if (!
|
|
21807
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21609
21808
|
const config = readToml(configPath);
|
|
21610
21809
|
const servers = config.mcp_servers;
|
|
21611
21810
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21631,6 +21830,27 @@ var codexAdapter = {
|
|
|
21631
21830
|
}
|
|
21632
21831
|
writeToml(configPath, config);
|
|
21633
21832
|
},
|
|
21833
|
+
// Codex has no wildcard: each tool id is listed. A table with at least one
|
|
21834
|
+
// approved tool means the user kept the allowlist, so tools this version
|
|
21835
|
+
// added are approved too. Tools already listed keep the mode the user gave
|
|
21836
|
+
// them, and an emptied or removed table stays as it is.
|
|
21837
|
+
refreshAllowlist(root, scope) {
|
|
21838
|
+
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21839
|
+
if (!configPath || !fs18.existsSync(configPath)) return;
|
|
21840
|
+
const config = readToml(configPath);
|
|
21841
|
+
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
21842
|
+
if (!toolsConfig) return;
|
|
21843
|
+
const optedIn = Object.values(toolsConfig).some(
|
|
21844
|
+
(tool) => tool?.approval_mode === "approve"
|
|
21845
|
+
);
|
|
21846
|
+
if (!optedIn) return;
|
|
21847
|
+
const missing = getAvailableToolIds().filter((tool) => !(tool in toolsConfig));
|
|
21848
|
+
if (missing.length === 0) return;
|
|
21849
|
+
for (const tool of missing) {
|
|
21850
|
+
toolsConfig[tool] = { approval_mode: "approve" };
|
|
21851
|
+
}
|
|
21852
|
+
writeToml(configPath, config);
|
|
21853
|
+
},
|
|
21634
21854
|
removeAllowlist(root, scope) {
|
|
21635
21855
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21636
21856
|
if (!configPath) {
|
|
@@ -21653,13 +21873,13 @@ var codexAdapter = {
|
|
|
21653
21873
|
var hermesAdapter = {
|
|
21654
21874
|
name: "Hermes",
|
|
21655
21875
|
detect() {
|
|
21656
|
-
return dirHasEditorEvidence(
|
|
21876
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".hermes"), hermesDirLooksArgentOnly);
|
|
21657
21877
|
},
|
|
21658
21878
|
projectPath() {
|
|
21659
21879
|
return null;
|
|
21660
21880
|
},
|
|
21661
21881
|
globalPath() {
|
|
21662
|
-
return
|
|
21882
|
+
return path19.join(homedir5(), ".hermes", "config.yaml");
|
|
21663
21883
|
},
|
|
21664
21884
|
write(configPath, entry) {
|
|
21665
21885
|
const doc = readYaml(configPath);
|
|
@@ -21678,7 +21898,7 @@ var hermesAdapter = {
|
|
|
21678
21898
|
writeYaml(configPath, doc);
|
|
21679
21899
|
},
|
|
21680
21900
|
remove(configPath) {
|
|
21681
|
-
if (!
|
|
21901
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21682
21902
|
const doc = readYaml(configPath);
|
|
21683
21903
|
const servers = doc.get("mcp_servers");
|
|
21684
21904
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -21691,7 +21911,7 @@ var hermesAdapter = {
|
|
|
21691
21911
|
return true;
|
|
21692
21912
|
},
|
|
21693
21913
|
getArgentEntry(configPath) {
|
|
21694
|
-
if (!
|
|
21914
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21695
21915
|
const doc = readYaml(configPath);
|
|
21696
21916
|
const servers = doc.get("mcp_servers");
|
|
21697
21917
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -21718,10 +21938,10 @@ function hasOpenCodeBinary() {
|
|
|
21718
21938
|
}
|
|
21719
21939
|
function pickOpencodeConfig(dir, candidates) {
|
|
21720
21940
|
for (const name of candidates) {
|
|
21721
|
-
const candidate =
|
|
21722
|
-
if (
|
|
21941
|
+
const candidate = path19.join(dir, name);
|
|
21942
|
+
if (fs18.existsSync(candidate)) return candidate;
|
|
21723
21943
|
}
|
|
21724
|
-
return
|
|
21944
|
+
return path19.join(dir, "opencode.json");
|
|
21725
21945
|
}
|
|
21726
21946
|
var openCodeAdapter = {
|
|
21727
21947
|
name: "opencode",
|
|
@@ -21732,7 +21952,7 @@ var openCodeAdapter = {
|
|
|
21732
21952
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
21733
21953
|
},
|
|
21734
21954
|
globalPath() {
|
|
21735
|
-
return pickOpencodeConfig(
|
|
21955
|
+
return pickOpencodeConfig(path19.join(homedir5(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
21736
21956
|
},
|
|
21737
21957
|
write(configPath, entry) {
|
|
21738
21958
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -21743,7 +21963,7 @@ var openCodeAdapter = {
|
|
|
21743
21963
|
});
|
|
21744
21964
|
},
|
|
21745
21965
|
remove(configPath) {
|
|
21746
|
-
if (!
|
|
21966
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21747
21967
|
const config = readJsonc(configPath);
|
|
21748
21968
|
const servers = config.mcp;
|
|
21749
21969
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21751,7 +21971,7 @@ var openCodeAdapter = {
|
|
|
21751
21971
|
return true;
|
|
21752
21972
|
},
|
|
21753
21973
|
getArgentEntry(configPath) {
|
|
21754
|
-
if (!
|
|
21974
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21755
21975
|
const config = readJsonc(configPath);
|
|
21756
21976
|
const servers = config.mcp;
|
|
21757
21977
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21766,7 +21986,7 @@ var openCodeAdapter = {
|
|
|
21766
21986
|
},
|
|
21767
21987
|
removeAllowlist(root, scope) {
|
|
21768
21988
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21769
|
-
if (!configPath || !
|
|
21989
|
+
if (!configPath || !fs18.existsSync(configPath)) return;
|
|
21770
21990
|
const config = readJsonc(configPath);
|
|
21771
21991
|
const tools = config.tools;
|
|
21772
21992
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -21777,13 +21997,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
21777
21997
|
var kiroAdapter = {
|
|
21778
21998
|
name: "Kiro",
|
|
21779
21999
|
detect() {
|
|
21780
|
-
return dirHasEditorEvidence(
|
|
22000
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
21781
22001
|
},
|
|
21782
22002
|
projectPath(root) {
|
|
21783
|
-
return
|
|
22003
|
+
return path19.join(root, ".kiro", "settings", "mcp.json");
|
|
21784
22004
|
},
|
|
21785
22005
|
globalPath() {
|
|
21786
|
-
return
|
|
22006
|
+
return path19.join(homedir5(), ".kiro", "settings", "mcp.json");
|
|
21787
22007
|
},
|
|
21788
22008
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21789
22009
|
// foreign servers survive (see the Cursor adapter).
|
|
@@ -21791,11 +22011,12 @@ var kiroAdapter = {
|
|
|
21791
22011
|
editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
|
|
21792
22012
|
command: entry.command,
|
|
21793
22013
|
args: entry.args,
|
|
21794
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
22014
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
22015
|
+
...existingEntryKeys(configPath, "mcpServers", ["autoApprove"])
|
|
21795
22016
|
});
|
|
21796
22017
|
},
|
|
21797
22018
|
remove(configPath) {
|
|
21798
|
-
if (!
|
|
22019
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21799
22020
|
const config = readJsonc(configPath);
|
|
21800
22021
|
const servers = config.mcpServers;
|
|
21801
22022
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21803,7 +22024,7 @@ var kiroAdapter = {
|
|
|
21803
22024
|
return true;
|
|
21804
22025
|
},
|
|
21805
22026
|
getArgentEntry(configPath) {
|
|
21806
|
-
if (!
|
|
22027
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21807
22028
|
const config = readJsonc(configPath);
|
|
21808
22029
|
const servers = config.mcpServers;
|
|
21809
22030
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21827,7 +22048,7 @@ var kiroAdapter = {
|
|
|
21827
22048
|
},
|
|
21828
22049
|
removeAllowlist(root, scope) {
|
|
21829
22050
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21830
|
-
if (!configPath || !
|
|
22051
|
+
if (!configPath || !fs18.existsSync(configPath)) return;
|
|
21831
22052
|
const config = readJsonc(configPath);
|
|
21832
22053
|
const servers = config.mcpServers;
|
|
21833
22054
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21879,7 +22100,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
21879
22100
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
21880
22101
|
}
|
|
21881
22102
|
function removeAllowRule(settingsPath, rule) {
|
|
21882
|
-
if (!
|
|
22103
|
+
if (!fs18.existsSync(settingsPath)) return;
|
|
21883
22104
|
const config = readJsonc(settingsPath);
|
|
21884
22105
|
const permissions = config?.permissions;
|
|
21885
22106
|
const allow = permissions?.allow;
|
|
@@ -21889,7 +22110,7 @@ function removeAllowRule(settingsPath, rule) {
|
|
|
21889
22110
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
21890
22111
|
}
|
|
21891
22112
|
function claudeSettingsPath(root, scope) {
|
|
21892
|
-
return scope === "global" ?
|
|
22113
|
+
return scope === "global" ? path19.join(homedir5(), ".claude", "settings.json") : path19.join(root, ".claude", "settings.json");
|
|
21893
22114
|
}
|
|
21894
22115
|
function addClaudePermission(root, scope) {
|
|
21895
22116
|
addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
@@ -21902,12 +22123,13 @@ function formatCopyDestination(target, writtenPath, root) {
|
|
|
21902
22123
|
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
21903
22124
|
}
|
|
21904
22125
|
function formatManagedPathLabel(targetPath, root) {
|
|
21905
|
-
const home
|
|
21906
|
-
|
|
21907
|
-
|
|
22126
|
+
for (const home of [path19.resolve(homedir5()), canonicalPath(homedir5())]) {
|
|
22127
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path19.sep}`)) {
|
|
22128
|
+
return `~${targetPath.slice(home.length)}`;
|
|
22129
|
+
}
|
|
21908
22130
|
}
|
|
21909
|
-
const relative5 =
|
|
21910
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22131
|
+
const relative5 = path19.relative(root, targetPath);
|
|
22132
|
+
if (relative5 && !relative5.startsWith("..") && !path19.isAbsolute(relative5)) {
|
|
21911
22133
|
return relative5;
|
|
21912
22134
|
}
|
|
21913
22135
|
return targetPath;
|
|
@@ -21921,7 +22143,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
21921
22143
|
}
|
|
21922
22144
|
function getAdapterBasePath(adapter, root, scope) {
|
|
21923
22145
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
21924
|
-
return configPath ?
|
|
22146
|
+
return configPath ? path19.dirname(configPath) : null;
|
|
21925
22147
|
}
|
|
21926
22148
|
function getManagedContentTargets(adapters, root, scope) {
|
|
21927
22149
|
const targets = {
|
|
@@ -21931,17 +22153,17 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21931
22153
|
codexConfigTargets: [],
|
|
21932
22154
|
skillsLockTargets: []
|
|
21933
22155
|
};
|
|
21934
|
-
const workspaceBase = scope === "global" ?
|
|
22156
|
+
const workspaceBase = scope === "global" ? homedir5() : root;
|
|
21935
22157
|
addManagedTarget(
|
|
21936
22158
|
targets.skillTargets,
|
|
21937
22159
|
"skills",
|
|
21938
|
-
|
|
22160
|
+
path19.join(workspaceBase, ".agents", "skills"),
|
|
21939
22161
|
root
|
|
21940
22162
|
);
|
|
21941
22163
|
addManagedTarget(
|
|
21942
22164
|
targets.skillsLockTargets,
|
|
21943
22165
|
"skills",
|
|
21944
|
-
|
|
22166
|
+
path19.join(workspaceBase, "skills-lock.json"),
|
|
21945
22167
|
root
|
|
21946
22168
|
);
|
|
21947
22169
|
for (const adapter of adapters) {
|
|
@@ -21949,21 +22171,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21949
22171
|
case "Cursor": {
|
|
21950
22172
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
21951
22173
|
if (!base) break;
|
|
21952
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21953
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22174
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
|
|
22175
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path19.join(base, "rules"), root);
|
|
21954
22176
|
break;
|
|
21955
22177
|
}
|
|
21956
22178
|
case "Claude Code": {
|
|
21957
|
-
const claudeBase = scope === "global" ?
|
|
21958
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21959
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
21960
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22179
|
+
const claudeBase = scope === "global" ? path19.join(homedir5(), ".claude") : path19.join(root, ".claude");
|
|
22180
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(claudeBase, "skills"), root);
|
|
22181
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path19.join(claudeBase, "rules"), root);
|
|
22182
|
+
addManagedTarget(targets.agentTargets, adapter.name, path19.join(claudeBase, "agents"), root);
|
|
21961
22183
|
break;
|
|
21962
22184
|
}
|
|
21963
22185
|
case "Gemini": {
|
|
21964
|
-
const geminiBase = scope === "global" ?
|
|
21965
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
21966
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22186
|
+
const geminiBase = scope === "global" ? path19.join(homedir5(), ".gemini") : path19.join(root, ".gemini");
|
|
22187
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path19.join(geminiBase, "rules"), root);
|
|
22188
|
+
addManagedTarget(targets.agentTargets, adapter.name, path19.join(geminiBase, "agents"), root);
|
|
21967
22189
|
break;
|
|
21968
22190
|
}
|
|
21969
22191
|
case "Codex": {
|
|
@@ -21973,19 +22195,19 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21973
22195
|
break;
|
|
21974
22196
|
}
|
|
21975
22197
|
case "opencode": {
|
|
21976
|
-
const base = scope === "global" ?
|
|
21977
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
21978
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22198
|
+
const base = scope === "global" ? path19.join(homedir5(), ".config", "opencode") : path19.join(root, ".opencode");
|
|
22199
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
|
|
22200
|
+
addManagedTarget(targets.agentTargets, adapter.name, path19.join(base, "agents"), root);
|
|
21979
22201
|
break;
|
|
21980
22202
|
}
|
|
21981
22203
|
case "Kiro": {
|
|
21982
|
-
const kiroBase = scope === "global" ?
|
|
21983
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22204
|
+
const kiroBase = scope === "global" ? path19.join(homedir5(), ".kiro") : path19.join(root, ".kiro");
|
|
22205
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(kiroBase, "skills"), root);
|
|
21984
22206
|
break;
|
|
21985
22207
|
}
|
|
21986
22208
|
case "Devin Desktop": {
|
|
21987
|
-
const devinBase = scope === "global" ?
|
|
21988
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22209
|
+
const devinBase = scope === "global" ? path19.join(process.env.XDG_CONFIG_HOME || path19.join(homedir5(), ".config"), "devin") : path19.join(root, ".devin");
|
|
22210
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(devinBase, "skills"), root);
|
|
21989
22211
|
break;
|
|
21990
22212
|
}
|
|
21991
22213
|
}
|
|
@@ -21999,12 +22221,12 @@ function stripFrontmatter(content) {
|
|
|
21999
22221
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22000
22222
|
}
|
|
22001
22223
|
function readAndConcatRules(rulesDir) {
|
|
22002
|
-
if (!
|
|
22003
|
-
const files =
|
|
22224
|
+
if (!fs18.existsSync(rulesDir)) return null;
|
|
22225
|
+
const files = fs18.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22004
22226
|
if (files.length === 0) return null;
|
|
22005
22227
|
const parts = [];
|
|
22006
22228
|
for (const file of files) {
|
|
22007
|
-
const raw =
|
|
22229
|
+
const raw = fs18.readFileSync(path19.join(rulesDir, file), "utf8");
|
|
22008
22230
|
const stripped = stripFrontmatter(raw);
|
|
22009
22231
|
if (stripped) parts.push(stripped);
|
|
22010
22232
|
}
|
|
@@ -22039,7 +22261,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22039
22261
|
return configPath;
|
|
22040
22262
|
}
|
|
22041
22263
|
function removeCodexRules(configPath) {
|
|
22042
|
-
if (!
|
|
22264
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
22043
22265
|
const config = readToml(configPath);
|
|
22044
22266
|
const existing = config.developer_instructions;
|
|
22045
22267
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22055,18 +22277,29 @@ function removeCodexRules(configPath) {
|
|
|
22055
22277
|
function findRetiredRulesAndAgents(scans, root, rulesDir, agentsDir) {
|
|
22056
22278
|
const targets = scans.flatMap(({ adapters, scope }) => {
|
|
22057
22279
|
const { ruleTargets, agentTargets } = getManagedContentTargets(adapters, root, scope);
|
|
22280
|
+
const globalRules = scope === "global";
|
|
22058
22281
|
return [
|
|
22059
|
-
...ruleTargets.map((target) => ({
|
|
22060
|
-
|
|
22282
|
+
...ruleTargets.map((target) => ({
|
|
22283
|
+
kind: "rules",
|
|
22284
|
+
target,
|
|
22285
|
+
bundleDir: globalRules ? null : rulesDir,
|
|
22286
|
+
retired: globalRules ? [...RETIRED_BUNDLED_PATHS.rules, ...RETIRED_GLOBAL_RULES] : RETIRED_BUNDLED_PATHS.rules
|
|
22287
|
+
})),
|
|
22288
|
+
...agentTargets.map((target) => ({
|
|
22289
|
+
kind: "agents",
|
|
22290
|
+
target,
|
|
22291
|
+
bundleDir: agentsDir,
|
|
22292
|
+
retired: RETIRED_BUNDLED_PATHS.agents
|
|
22293
|
+
}))
|
|
22061
22294
|
];
|
|
22062
22295
|
});
|
|
22063
22296
|
const found = [];
|
|
22064
22297
|
const seen = /* @__PURE__ */ new Set();
|
|
22065
|
-
for (const { kind, target, bundleDir } of targets) {
|
|
22298
|
+
for (const { kind, target, bundleDir, retired } of targets) {
|
|
22066
22299
|
const dir = resolveLinkedDestination(target.targetPath);
|
|
22067
22300
|
if (seen.has(`${kind}:${realpathOrSelf(dir)}`)) continue;
|
|
22068
22301
|
seen.add(`${kind}:${realpathOrSelf(dir)}`);
|
|
22069
|
-
const files = findRetiredFiles(
|
|
22302
|
+
const files = findRetiredFiles(retired, bundleDir, target.targetPath);
|
|
22070
22303
|
if (files.length === 0) continue;
|
|
22071
22304
|
found.push({ kind, target, location: formatCopyDestination(target, dir, root), files });
|
|
22072
22305
|
}
|
|
@@ -22075,7 +22308,8 @@ function findRetiredRulesAndAgents(scans, root, rulesDir, agentsDir) {
|
|
|
22075
22308
|
function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
22076
22309
|
const results = [];
|
|
22077
22310
|
const managedTargets = getManagedContentTargets(adapters, root, scope);
|
|
22078
|
-
|
|
22311
|
+
const globalScope = scope === "global";
|
|
22312
|
+
for (const target of globalScope ? [] : managedTargets.ruleTargets) {
|
|
22079
22313
|
try {
|
|
22080
22314
|
const written = copyDir(rulesDir, target.targetPath);
|
|
22081
22315
|
if (written) {
|
|
@@ -22096,6 +22330,16 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22096
22330
|
}
|
|
22097
22331
|
}
|
|
22098
22332
|
for (const target of managedTargets.codexConfigTargets) {
|
|
22333
|
+
if (globalScope) {
|
|
22334
|
+
try {
|
|
22335
|
+
if (removeCodexRules(target.targetPath)) {
|
|
22336
|
+
results.push(` Removed argent rules from ${target.targetPath} (developer_instructions)`);
|
|
22337
|
+
}
|
|
22338
|
+
} catch (err) {
|
|
22339
|
+
results.push(` Could not remove argent rules from ${target.targetPath}: ${err}`);
|
|
22340
|
+
}
|
|
22341
|
+
continue;
|
|
22342
|
+
}
|
|
22099
22343
|
try {
|
|
22100
22344
|
const injected = injectCodexRules(target.targetPath, rulesDir);
|
|
22101
22345
|
if (injected) {
|
|
@@ -22109,10 +22353,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22109
22353
|
}
|
|
22110
22354
|
|
|
22111
22355
|
// ../argent-installer/src/retired-files.ts
|
|
22112
|
-
import * as
|
|
22356
|
+
import * as path20 from "node:path";
|
|
22113
22357
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
22114
22358
|
function displayPath(entry, file) {
|
|
22115
|
-
return
|
|
22359
|
+
return path20.join(entry.location, ...file.relativePath.split("/"));
|
|
22116
22360
|
}
|
|
22117
22361
|
async function cleanupRetiredFiles(found, options) {
|
|
22118
22362
|
const result = { removed: [], declined: [], failed: [], removedRoots: [] };
|
|
@@ -22163,14 +22407,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22163
22407
|
|
|
22164
22408
|
// ../argent-installer/src/cli-record.ts
|
|
22165
22409
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22166
|
-
import * as
|
|
22167
|
-
import * as
|
|
22410
|
+
import * as fs19 from "node:fs";
|
|
22411
|
+
import * as path21 from "node:path";
|
|
22168
22412
|
function cliRecordPath() {
|
|
22169
|
-
return
|
|
22413
|
+
return path21.join(argentHomeDir(), "cli.json");
|
|
22170
22414
|
}
|
|
22171
22415
|
function readCliRecord() {
|
|
22172
22416
|
try {
|
|
22173
|
-
const parsed = JSON.parse(
|
|
22417
|
+
const parsed = JSON.parse(fs19.readFileSync(cliRecordPath(), "utf8"));
|
|
22174
22418
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22175
22419
|
return null;
|
|
22176
22420
|
} catch {
|
|
@@ -22180,14 +22424,10 @@ function readCliRecord() {
|
|
|
22180
22424
|
function resolveCliEntry(mode, projectRoot) {
|
|
22181
22425
|
if (mode === "local") {
|
|
22182
22426
|
const relative5 = getLocalArgentBinRelPath(projectRoot);
|
|
22183
|
-
return relative5 ?
|
|
22427
|
+
return relative5 ? path21.resolve(projectRoot, relative5) : null;
|
|
22184
22428
|
}
|
|
22185
22429
|
const packageRoot = getGloballyInstalledPackageRoot();
|
|
22186
|
-
|
|
22187
|
-
const binSub = argentBinSubpath(packageRoot);
|
|
22188
|
-
if (!binSub) return null;
|
|
22189
|
-
const entry = path20.join(packageRoot, binSub);
|
|
22190
|
-
return fs18.existsSync(entry) ? entry : null;
|
|
22430
|
+
return packageRoot ? cliPathOf(packageRoot) : null;
|
|
22191
22431
|
}
|
|
22192
22432
|
function writeCliRecord(input) {
|
|
22193
22433
|
const cli = resolveCliEntry(input.mode, input.projectRoot);
|
|
@@ -22203,10 +22443,10 @@ function writeCliRecord(input) {
|
|
|
22203
22443
|
function persistCliRecord(record) {
|
|
22204
22444
|
const file = cliRecordPath();
|
|
22205
22445
|
try {
|
|
22206
|
-
|
|
22446
|
+
fs19.mkdirSync(path21.dirname(file), { recursive: true });
|
|
22207
22447
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
22208
|
-
|
|
22209
|
-
|
|
22448
|
+
fs19.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22449
|
+
fs19.renameSync(temporary, file);
|
|
22210
22450
|
return file;
|
|
22211
22451
|
} catch {
|
|
22212
22452
|
return null;
|
|
@@ -22214,10 +22454,10 @@ function persistCliRecord(record) {
|
|
|
22214
22454
|
}
|
|
22215
22455
|
function healCliRecord(input) {
|
|
22216
22456
|
try {
|
|
22217
|
-
if (!
|
|
22457
|
+
if (!fs19.existsSync(input.cli)) return null;
|
|
22218
22458
|
const existing = readCliRecord();
|
|
22219
22459
|
if (existing) {
|
|
22220
|
-
const alive =
|
|
22460
|
+
const alive = fs19.existsSync(existing.node) && fs19.existsSync(existing.cli);
|
|
22221
22461
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22222
22462
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22223
22463
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22238,11 +22478,11 @@ function removeCliRecordFor(installDir) {
|
|
|
22238
22478
|
if (!installDir) return false;
|
|
22239
22479
|
const record = readCliRecord();
|
|
22240
22480
|
if (!record) return false;
|
|
22241
|
-
const root =
|
|
22242
|
-
const relative5 =
|
|
22243
|
-
if (relative5.startsWith("..") ||
|
|
22481
|
+
const root = path21.resolve(installDir);
|
|
22482
|
+
const relative5 = path21.relative(root, path21.resolve(record.cli));
|
|
22483
|
+
if (relative5.startsWith("..") || path21.isAbsolute(relative5)) return false;
|
|
22244
22484
|
try {
|
|
22245
|
-
|
|
22485
|
+
fs19.rmSync(cliRecordPath(), { force: true });
|
|
22246
22486
|
return true;
|
|
22247
22487
|
} catch {
|
|
22248
22488
|
return false;
|
|
@@ -22328,6 +22568,7 @@ function parseInitArgs(args) {
|
|
|
22328
22568
|
return {
|
|
22329
22569
|
nonInteractive: args.includes("--yes") || args.includes("-y"),
|
|
22330
22570
|
noTelemetry: args.includes("--no-telemetry"),
|
|
22571
|
+
noAllowlist: args.includes("--no-allowlist"),
|
|
22331
22572
|
fromTar,
|
|
22332
22573
|
wantsLocal: args.includes("--local"),
|
|
22333
22574
|
wantsGlobal: args.includes("--global")
|
|
@@ -22462,6 +22703,8 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22462
22703
|
|
|
22463
22704
|
// ../argent-installer/src/install-runner.ts
|
|
22464
22705
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22706
|
+
import * as fs21 from "node:fs";
|
|
22707
|
+
import * as path23 from "node:path";
|
|
22465
22708
|
|
|
22466
22709
|
// ../argent-installer/src/shell.ts
|
|
22467
22710
|
import { execFileSync as execFileSync5, spawn as spawn2 } from "node:child_process";
|
|
@@ -22493,11 +22736,12 @@ var ShellCommandError = class extends Error {
|
|
|
22493
22736
|
signal;
|
|
22494
22737
|
};
|
|
22495
22738
|
function runShellCommand(cmd, opts = {}) {
|
|
22496
|
-
return new Promise((
|
|
22739
|
+
return new Promise((resolve21, reject) => {
|
|
22497
22740
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22498
22741
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22499
22742
|
shell: process.platform === "win32",
|
|
22500
|
-
...opts.cwd ? { cwd: opts.cwd } : {}
|
|
22743
|
+
...opts.cwd ? { cwd: opts.cwd } : {},
|
|
22744
|
+
...opts.env ? { env: opts.env } : {}
|
|
22501
22745
|
});
|
|
22502
22746
|
let stdout2 = "";
|
|
22503
22747
|
let stderr = "";
|
|
@@ -22508,7 +22752,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22508
22752
|
stderr += chunk.toString();
|
|
22509
22753
|
});
|
|
22510
22754
|
child.on("close", (code, signal) => {
|
|
22511
|
-
if (code === 0)
|
|
22755
|
+
if (code === 0) resolve21();
|
|
22512
22756
|
else
|
|
22513
22757
|
reject(
|
|
22514
22758
|
new ShellCommandError(
|
|
@@ -22524,8 +22768,8 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22524
22768
|
|
|
22525
22769
|
// ../argent-installer/src/skills.ts
|
|
22526
22770
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
22527
|
-
import * as
|
|
22528
|
-
import * as
|
|
22771
|
+
import * as fs20 from "node:fs";
|
|
22772
|
+
import * as path22 from "node:path";
|
|
22529
22773
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
22530
22774
|
function getScopeSpecs(projectRoot) {
|
|
22531
22775
|
return [
|
|
@@ -22605,13 +22849,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
22605
22849
|
let candidates = names;
|
|
22606
22850
|
if (names.length === 0) {
|
|
22607
22851
|
try {
|
|
22608
|
-
candidates =
|
|
22852
|
+
candidates = fs20.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
22609
22853
|
} catch {
|
|
22610
22854
|
continue;
|
|
22611
22855
|
}
|
|
22612
22856
|
}
|
|
22613
22857
|
for (const name of candidates) {
|
|
22614
|
-
const stat6 =
|
|
22858
|
+
const stat6 = fs20.statSync(path22.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
22615
22859
|
if (!stat6?.isFile()) continue;
|
|
22616
22860
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
22617
22861
|
}
|
|
@@ -22629,7 +22873,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
|
|
|
22629
22873
|
const removed = /* @__PURE__ */ new Set();
|
|
22630
22874
|
for (const { targetPath } of skillTargets) {
|
|
22631
22875
|
for (const name of legacy) {
|
|
22632
|
-
const dir =
|
|
22876
|
+
const dir = path22.join(targetPath, name);
|
|
22633
22877
|
try {
|
|
22634
22878
|
if (removePath(dir)) removed.add(name);
|
|
22635
22879
|
} catch {
|
|
@@ -22649,13 +22893,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
22649
22893
|
}
|
|
22650
22894
|
function removeLockEntries(lockPath, names) {
|
|
22651
22895
|
try {
|
|
22652
|
-
const lock = JSON.parse(
|
|
22896
|
+
const lock = JSON.parse(fs20.readFileSync(lockPath, "utf8"));
|
|
22653
22897
|
const skills = lock.skills;
|
|
22654
22898
|
if (!skills) return [];
|
|
22655
22899
|
const removed = names.filter((name) => name in skills);
|
|
22656
22900
|
if (removed.length === 0) return [];
|
|
22657
22901
|
for (const name of removed) delete skills[name];
|
|
22658
|
-
|
|
22902
|
+
fs20.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
22659
22903
|
return removed;
|
|
22660
22904
|
} catch {
|
|
22661
22905
|
return [];
|
|
@@ -22720,6 +22964,9 @@ async function runInstall(args) {
|
|
|
22720
22964
|
}
|
|
22721
22965
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
22722
22966
|
}
|
|
22967
|
+
function installSpec(fromTar) {
|
|
22968
|
+
return fs21.existsSync(fromTar) ? path23.resolve(fromTar) : fromTar;
|
|
22969
|
+
}
|
|
22723
22970
|
async function installLocally(opts) {
|
|
22724
22971
|
const { fromTar, tel } = opts;
|
|
22725
22972
|
const projectRoot = resolveProjectRoot2(process.cwd());
|
|
@@ -22744,7 +22991,7 @@ async function installLocally(opts) {
|
|
|
22744
22991
|
return;
|
|
22745
22992
|
}
|
|
22746
22993
|
const pm = detectProjectPackageManager(projectRoot);
|
|
22747
|
-
const installTarget = fromTar
|
|
22994
|
+
const installTarget = fromTar ? installSpec(fromTar) : PACKAGE_NAME;
|
|
22748
22995
|
const materializeOnly = isDeclaredLocally(projectRoot) && !fromTar;
|
|
22749
22996
|
const cmd = materializeOnly ? projectInstallCommand(pm) : localInstallCommand(pm, installTarget);
|
|
22750
22997
|
const cmdStr = formatShellCommand(cmd);
|
|
@@ -22825,18 +23072,18 @@ async function runGlobal(opts) {
|
|
|
22825
23072
|
const { fromTar, nonInteractive, tel } = opts;
|
|
22826
23073
|
let version = opts.version;
|
|
22827
23074
|
const globallyInstalled = isGloballyInstalled();
|
|
23075
|
+
const pm = detectGlobalPackageManager();
|
|
22828
23076
|
if (!globallyInstalled) {
|
|
22829
23077
|
log.info(`Argent is not installed globally \u2014 installing.`);
|
|
22830
23078
|
track("installation:global_install_decision", { decision: "install" });
|
|
22831
|
-
const
|
|
22832
|
-
const installTarget = fromTar ?? PACKAGE_NAME;
|
|
23079
|
+
const installTarget = fromTar ? installSpec(fromTar) : PACKAGE_NAME;
|
|
22833
23080
|
const cmd = globalInstallCommand(pm, installTarget);
|
|
22834
23081
|
const cmdStr = formatShellCommand(cmd);
|
|
22835
23082
|
const spinner3 = spinner();
|
|
22836
23083
|
spinner3.start(`Installing ${PACKAGE_NAME} globally...`);
|
|
22837
23084
|
const packageActionStartedAt2 = performance.now();
|
|
22838
23085
|
try {
|
|
22839
|
-
await runShellCommand(cmd);
|
|
23086
|
+
await runShellCommand(cmd, globalCommandOptions(pm));
|
|
22840
23087
|
spinner3.stop(import_picocolors4.default.green("Installed globally."));
|
|
22841
23088
|
if (!isGloballyInstalled()) {
|
|
22842
23089
|
log.warn(
|
|
@@ -22861,19 +23108,18 @@ async function runGlobal(opts) {
|
|
|
22861
23108
|
return version;
|
|
22862
23109
|
}
|
|
22863
23110
|
if (fromTar) {
|
|
22864
|
-
const
|
|
22865
|
-
const cmd = globalInstallCommand(pm, fromTar);
|
|
23111
|
+
const cmd = globalInstallCommand(pm, installSpec(fromTar));
|
|
22866
23112
|
const cmdStr = formatShellCommand(cmd);
|
|
22867
23113
|
const spinner3 = spinner();
|
|
22868
23114
|
spinner3.start(`Installing from ${fromTar}...`);
|
|
22869
23115
|
try {
|
|
22870
|
-
await runShellCommand(cmd);
|
|
23116
|
+
await runShellCommand(cmd, globalCommandOptions(pm));
|
|
22871
23117
|
spinner3.stop(import_picocolors4.default.green("Installed from tarball."));
|
|
22872
23118
|
version = getGloballyInstalledVersion() ?? getInstalledVersion() ?? version;
|
|
22873
23119
|
} catch (err) {
|
|
22874
23120
|
spinner3.stop(import_picocolors4.default.red("Installation failed."));
|
|
22875
23121
|
log.error(`${err}`);
|
|
22876
|
-
log.info(`Install manually with: ${import_picocolors4.default.cyan(cmdStr)}`);
|
|
23122
|
+
log.info(`Install manually with: ${import_picocolors4.default.cyan(cmdStr)}${yarnClassicNote(cmd)}`);
|
|
22877
23123
|
await tel.finalize(INSTALL_FROM_TAR_PACKAGE_FAILED);
|
|
22878
23124
|
process.exit(1);
|
|
22879
23125
|
}
|
|
@@ -22930,14 +23176,13 @@ async function runGlobal(opts) {
|
|
|
22930
23176
|
if (isCancel(updateChoice) || updateChoice === "skip") {
|
|
22931
23177
|
await tel.trackPackageAction("update_skipped", packageActionStartedAt, true);
|
|
22932
23178
|
} else if (updateChoice === "update") {
|
|
22933
|
-
const pm = detectPackageManager();
|
|
22934
23179
|
const cmd = globalInstallCommand(pm, `${PACKAGE_NAME}@${latest}`);
|
|
22935
23180
|
const cmdStr = formatShellCommand(cmd);
|
|
22936
23181
|
const updateSpinner = spinner();
|
|
22937
23182
|
updateSpinner.start(`Updating to v${latest}...`);
|
|
22938
23183
|
const updateStartedAt = performance.now();
|
|
22939
23184
|
try {
|
|
22940
|
-
await runShellCommand(cmd);
|
|
23185
|
+
await runShellCommand(cmd, globalCommandOptions(pm));
|
|
22941
23186
|
updateSpinner.stop(import_picocolors4.default.green(`Updated to v${latest}.`));
|
|
22942
23187
|
version = getGloballyInstalledVersion() ?? getInstalledVersion() ?? version;
|
|
22943
23188
|
await tel.trackPackageAction("init_triggered_update", updateStartedAt, true);
|
|
@@ -22945,7 +23190,7 @@ async function runGlobal(opts) {
|
|
|
22945
23190
|
} catch (err) {
|
|
22946
23191
|
updateSpinner.stop(import_picocolors4.default.red("Update failed."));
|
|
22947
23192
|
log.error(`${err}`);
|
|
22948
|
-
log.info(`You can update manually later: ${import_picocolors4.default.cyan(cmdStr)}`);
|
|
23193
|
+
log.info(`You can update manually later: ${import_picocolors4.default.cyan(cmdStr)}${yarnClassicNote(cmd)}`);
|
|
22949
23194
|
await tel.trackPackageAction(
|
|
22950
23195
|
"update_failed",
|
|
22951
23196
|
updateStartedAt,
|
|
@@ -23027,8 +23272,8 @@ async function chooseAdapters(opts) {
|
|
|
23027
23272
|
|
|
23028
23273
|
// ../argent-installer/src/init-scope.ts
|
|
23029
23274
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
23030
|
-
import { existsSync as
|
|
23031
|
-
import { resolve as
|
|
23275
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
23276
|
+
import { resolve as resolve14 } from "node:path";
|
|
23032
23277
|
async function chooseScope(opts) {
|
|
23033
23278
|
if (opts.installMode === "local") {
|
|
23034
23279
|
return { scope: "local" };
|
|
@@ -23065,13 +23310,13 @@ async function chooseScope(opts) {
|
|
|
23065
23310
|
placeholder: process.cwd(),
|
|
23066
23311
|
validate(value) {
|
|
23067
23312
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
23068
|
-
const resolved =
|
|
23069
|
-
if (!
|
|
23313
|
+
const resolved = resolve14(value.trim());
|
|
23314
|
+
if (!existsSync14(resolved))
|
|
23070
23315
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
23071
23316
|
}
|
|
23072
23317
|
});
|
|
23073
23318
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
23074
|
-
return { scope: "custom", customRoot:
|
|
23319
|
+
return { scope: "custom", customRoot: resolve14(customPathInput.trim()) };
|
|
23075
23320
|
}
|
|
23076
23321
|
|
|
23077
23322
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23103,7 +23348,8 @@ function writeMcpConfigs(args) {
|
|
|
23103
23348
|
);
|
|
23104
23349
|
}
|
|
23105
23350
|
}
|
|
23106
|
-
const
|
|
23351
|
+
const globalCmdMode = resolveGlobalCommandMode();
|
|
23352
|
+
const entryFor = (configScope) => getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode);
|
|
23107
23353
|
const stillLocalMode = (root) => readInstallRecord(root)?.mode === "local" || isDeclaredLocally(root);
|
|
23108
23354
|
const keepsCommittedLocalEntry = (adapter, configPath, root) => {
|
|
23109
23355
|
if (installMode !== "global") return false;
|
|
@@ -23174,7 +23420,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23174
23420
|
const lines = [];
|
|
23175
23421
|
let removedCount = 0;
|
|
23176
23422
|
let warnedCount = 0;
|
|
23177
|
-
const globalArgentOnPath =
|
|
23423
|
+
const globalArgentOnPath = isArgentOnPath();
|
|
23178
23424
|
const isProvablyDead = (entry) => entry !== null && entry.command === MCP_BINARY_NAME && !globalArgentOnPath && !hasCustomizingEnv(entry);
|
|
23179
23425
|
const removed = (adapterName, location, what) => {
|
|
23180
23426
|
removedCount += 1;
|
|
@@ -23233,7 +23479,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23233
23479
|
} catch {
|
|
23234
23480
|
continue;
|
|
23235
23481
|
}
|
|
23236
|
-
if (entry === null) continue;
|
|
23482
|
+
if (entry === null || isPinnedGlobalEntry(entry)) continue;
|
|
23237
23483
|
if (isProvablyDead(entry)) {
|
|
23238
23484
|
pending.push({
|
|
23239
23485
|
adapterName: adapter.name,
|
|
@@ -23265,7 +23511,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23265
23511
|
} catch {
|
|
23266
23512
|
continue;
|
|
23267
23513
|
}
|
|
23268
|
-
if (entry !== null && entry.command !== MCP_BINARY_NAME) {
|
|
23514
|
+
if (entry !== null && entry.command !== MCP_BINARY_NAME && !isPinnedGlobalEntry(entry)) {
|
|
23269
23515
|
warned(
|
|
23270
23516
|
adapter.name,
|
|
23271
23517
|
projectPath,
|
|
@@ -23312,11 +23558,15 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23312
23558
|
// ../argent-installer/src/init-allowlist.ts
|
|
23313
23559
|
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
23314
23560
|
async function configureAllowlist(args) {
|
|
23315
|
-
const { adapters, effectiveRoot, scope, nonInteractive } = args;
|
|
23561
|
+
const { adapters, effectiveRoot, scope, nonInteractive, noAllowlist = false } = args;
|
|
23316
23562
|
const adaptersWithAllowlist = adapters.filter((a2) => a2.addAllowlist);
|
|
23317
23563
|
const adaptersWithoutAllowlist = adapters.filter((a2) => !a2.addAllowlist);
|
|
23318
23564
|
let enabled = false;
|
|
23319
|
-
|
|
23565
|
+
let decidedBy = "default";
|
|
23566
|
+
if (noAllowlist) {
|
|
23567
|
+
decidedBy = "flag";
|
|
23568
|
+
log.info(import_picocolors9.default.dim("Skipped editor auto-approve lists (--no-allowlist)."));
|
|
23569
|
+
} else if (adaptersWithAllowlist.length > 0) {
|
|
23320
23570
|
log.info(
|
|
23321
23571
|
`By default, editors ask for confirmation before running each MCP tool.
|
|
23322
23572
|
Adding Argent to the auto-approve allowlist lets tools run without
|
|
@@ -23332,9 +23582,10 @@ async function configureAllowlist(args) {
|
|
|
23332
23582
|
});
|
|
23333
23583
|
if (isCancel(allowlistChoice)) throw new InitCancelled("allowlist");
|
|
23334
23584
|
enabled = allowlistChoice;
|
|
23585
|
+
decidedBy = "prompt";
|
|
23335
23586
|
}
|
|
23336
23587
|
}
|
|
23337
|
-
if (!enabled) return { enabled, lines: [] };
|
|
23588
|
+
if (!enabled) return { enabled, decidedBy, lines: [] };
|
|
23338
23589
|
const lines = [];
|
|
23339
23590
|
for (const adapter of adaptersWithAllowlist) {
|
|
23340
23591
|
const hasPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(effectiveRoot);
|
|
@@ -23343,6 +23594,11 @@ async function configureAllowlist(args) {
|
|
|
23343
23594
|
continue;
|
|
23344
23595
|
}
|
|
23345
23596
|
try {
|
|
23597
|
+
const skipReason = adapter.allowlistSkipReason?.(effectiveRoot, scope) ?? null;
|
|
23598
|
+
if (skipReason) {
|
|
23599
|
+
lines.push(`${import_picocolors9.default.yellow("-")} ${adapter.name} ${import_picocolors9.default.dim(`(skipped - ${skipReason})`)}`);
|
|
23600
|
+
continue;
|
|
23601
|
+
}
|
|
23346
23602
|
adapter.addAllowlist(effectiveRoot, scope);
|
|
23347
23603
|
lines.push(`${import_picocolors9.default.green("+")} ${adapter.name}`);
|
|
23348
23604
|
} catch (err) {
|
|
@@ -23354,14 +23610,14 @@ async function configureAllowlist(args) {
|
|
|
23354
23610
|
`${import_picocolors9.default.yellow("-")} ${adapter.name} ${import_picocolors9.default.dim("(no auto-approve API - configure manually)")}`
|
|
23355
23611
|
);
|
|
23356
23612
|
}
|
|
23357
|
-
return { enabled, lines };
|
|
23613
|
+
return { enabled, decidedBy, lines };
|
|
23358
23614
|
}
|
|
23359
23615
|
|
|
23360
23616
|
// ../argent-installer/src/init-skills.ts
|
|
23361
23617
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
23362
23618
|
import { spawn as spawn3 } from "node:child_process";
|
|
23363
|
-
import * as
|
|
23364
|
-
import * as
|
|
23619
|
+
import * as os4 from "node:os";
|
|
23620
|
+
import * as path24 from "node:path";
|
|
23365
23621
|
var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
|
|
23366
23622
|
function meaningfulLine(err) {
|
|
23367
23623
|
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));
|
|
@@ -23369,10 +23625,10 @@ function meaningfulLine(err) {
|
|
|
23369
23625
|
}
|
|
23370
23626
|
function bundledCopyFor(version) {
|
|
23371
23627
|
const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
|
|
23372
|
-
if (local.packageDir && local.version === version) return
|
|
23628
|
+
if (local.packageDir && local.version === version) return path24.join(local.packageDir, "skills");
|
|
23373
23629
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
23374
23630
|
if (globalRoot && getGloballyInstalledVersion() === version) {
|
|
23375
|
-
return
|
|
23631
|
+
return path24.join(globalRoot, "skills");
|
|
23376
23632
|
}
|
|
23377
23633
|
return SKILLS_DIR;
|
|
23378
23634
|
}
|
|
@@ -23468,7 +23724,7 @@ async function runSkillsStep(args) {
|
|
|
23468
23724
|
const useGitHubSource = online && !fromTar && version !== "unknown";
|
|
23469
23725
|
const skillsSource = useGitHubSource ? buildArgentSkillsSource(version) : SKILLS_DIR;
|
|
23470
23726
|
const bundledCopy = useGitHubSource ? bundledCopyFor(version) : SKILLS_DIR;
|
|
23471
|
-
const skillsRoot = scope === "global" ?
|
|
23727
|
+
const skillsRoot = scope === "global" ? os4.homedir() : effectiveRoot;
|
|
23472
23728
|
const skillsScope = scope === "global" ? "global" : "project";
|
|
23473
23729
|
const expected = listBundledSkills(bundledCopy);
|
|
23474
23730
|
const snapshot = () => snapshotArgentSkills(skillsRoot, skillsScope, expected);
|
|
@@ -23582,7 +23838,7 @@ async function runSkillsStep(args) {
|
|
|
23582
23838
|
};
|
|
23583
23839
|
}
|
|
23584
23840
|
function runNpxSkills(args, interactive, cwd) {
|
|
23585
|
-
return new Promise((
|
|
23841
|
+
return new Promise((resolve21, reject) => {
|
|
23586
23842
|
const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
23587
23843
|
const child = spawn3(npxCmd, args, {
|
|
23588
23844
|
env: npxChildEnv(),
|
|
@@ -23602,7 +23858,7 @@ function runNpxSkills(args, interactive, cwd) {
|
|
|
23602
23858
|
}
|
|
23603
23859
|
child.on("close", (code, signal) => {
|
|
23604
23860
|
if (code === 0) {
|
|
23605
|
-
|
|
23861
|
+
resolve21();
|
|
23606
23862
|
} else {
|
|
23607
23863
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
23608
23864
|
reject(
|
|
@@ -23766,9 +24022,13 @@ async function init2(args) {
|
|
|
23766
24022
|
adapters: writtenAdapters,
|
|
23767
24023
|
effectiveRoot,
|
|
23768
24024
|
scope: normalizedScope,
|
|
23769
|
-
nonInteractive: parsed.nonInteractive
|
|
24025
|
+
nonInteractive: parsed.nonInteractive,
|
|
24026
|
+
noAllowlist: parsed.noAllowlist
|
|
24027
|
+
});
|
|
24028
|
+
track("installation:allowlist_decision", {
|
|
24029
|
+
is_enabled: allowlist.enabled,
|
|
24030
|
+
decided_by: allowlist.decidedBy
|
|
23770
24031
|
});
|
|
23771
|
-
track("installation:allowlist_decision", { is_enabled: allowlist.enabled });
|
|
23772
24032
|
if (allowlist.enabled && allowlist.lines.length > 0) {
|
|
23773
24033
|
note(allowlist.lines.join("\n"), "Tool Auto-Approval");
|
|
23774
24034
|
}
|
|
@@ -23807,7 +24067,8 @@ async function init2(args) {
|
|
|
23807
24067
|
scope,
|
|
23808
24068
|
allowlistEnabled: allowlist.enabled,
|
|
23809
24069
|
skills,
|
|
23810
|
-
|
|
24070
|
+
// A global install writes no rule, only removes old ones.
|
|
24071
|
+
copiedRules: normalizedScope === "local" && copyResults.length > 0,
|
|
23811
24072
|
wroteProjectTelemetryOptOut
|
|
23812
24073
|
});
|
|
23813
24074
|
const skillsMissing = skillsAreMissing(skills);
|
|
@@ -23913,7 +24174,8 @@ function printBanner() {
|
|
|
23913
24174
|
// ../argent-installer/src/update.ts
|
|
23914
24175
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
23915
24176
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
23916
|
-
import * as
|
|
24177
|
+
import * as fs23 from "node:fs";
|
|
24178
|
+
import * as path30 from "node:path";
|
|
23917
24179
|
|
|
23918
24180
|
// ../argent-installer/src/install-targets.ts
|
|
23919
24181
|
function parseTargetFlags(args) {
|
|
@@ -23963,10 +24225,10 @@ async function promptInstallTargets(verb) {
|
|
|
23963
24225
|
|
|
23964
24226
|
// ../argent-installer/src/update-target.ts
|
|
23965
24227
|
var import_update_core = __toESM(require_dist3(), 1);
|
|
23966
|
-
async function resolveInstallableUpdateTarget(pm, current) {
|
|
24228
|
+
async function resolveInstallableUpdateTarget(pm, current, cwd) {
|
|
23967
24229
|
const info = await (0, import_update_core.fetchRegistryInfo)(`${NPM_REGISTRY}/${PACKAGE_NAME}`);
|
|
23968
24230
|
if (info === null) return null;
|
|
23969
|
-
const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm);
|
|
24231
|
+
const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm, cwd);
|
|
23970
24232
|
const target = (0, import_update_core.pickInstallableTarget)(info.latest, info.times, current, minReleaseAgeMs);
|
|
23971
24233
|
return {
|
|
23972
24234
|
latestVersion: info.latest.version,
|
|
@@ -23978,17 +24240,17 @@ async function resolveInstallableUpdateTarget(pm, current) {
|
|
|
23978
24240
|
|
|
23979
24241
|
// ../argent-tools-client/src/launcher.ts
|
|
23980
24242
|
import * as net from "node:net";
|
|
23981
|
-
import * as
|
|
23982
|
-
import * as
|
|
24243
|
+
import * as fs22 from "node:fs";
|
|
24244
|
+
import * as path25 from "node:path";
|
|
23983
24245
|
import * as readline from "node:readline";
|
|
23984
|
-
import { homedir as
|
|
24246
|
+
import { homedir as homedir7 } from "node:os";
|
|
23985
24247
|
import { spawn as spawn4, execFileSync as execFileSync7 } from "node:child_process";
|
|
23986
24248
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
23987
24249
|
import { mkdir, writeFile, readFile, readdir as readdir2, unlink, rename, chmod } from "node:fs/promises";
|
|
23988
|
-
var STATE_DIR =
|
|
23989
|
-
var STATE_FILE =
|
|
23990
|
-
var LOG_FILE =
|
|
23991
|
-
var LOCK_FILE =
|
|
24250
|
+
var STATE_DIR = path25.join(homedir7(), ".argent");
|
|
24251
|
+
var STATE_FILE = path25.join(STATE_DIR, "tool-server.json");
|
|
24252
|
+
var LOG_FILE = path25.join(STATE_DIR, "tool-server.log");
|
|
24253
|
+
var LOCK_FILE = path25.join(STATE_DIR, "tool-server.lock");
|
|
23992
24254
|
function isProcessAlive(pid) {
|
|
23993
24255
|
try {
|
|
23994
24256
|
process.kill(pid, 0);
|
|
@@ -23999,7 +24261,7 @@ function isProcessAlive(pid) {
|
|
|
23999
24261
|
}
|
|
24000
24262
|
function stateFileForBundle(bundlePath) {
|
|
24001
24263
|
const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
24002
|
-
return
|
|
24264
|
+
return path25.join(STATE_DIR, `tool-server-${key}.json`);
|
|
24003
24265
|
}
|
|
24004
24266
|
async function readStateFile(file) {
|
|
24005
24267
|
try {
|
|
@@ -24041,7 +24303,7 @@ async function readAllToolsServerStates() {
|
|
|
24041
24303
|
const out = [];
|
|
24042
24304
|
for (const name of names) {
|
|
24043
24305
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
24044
|
-
const file =
|
|
24306
|
+
const file = path25.join(STATE_DIR, name);
|
|
24045
24307
|
const state2 = await readStateFile(file);
|
|
24046
24308
|
if (state2) out.push({ file, state: state2 });
|
|
24047
24309
|
}
|
|
@@ -24087,21 +24349,21 @@ async function killToolServer(bundlePath) {
|
|
|
24087
24349
|
return alive;
|
|
24088
24350
|
}
|
|
24089
24351
|
function isPathWithin(child, parent) {
|
|
24090
|
-
const rel =
|
|
24091
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
24352
|
+
const rel = path25.relative(parent, child);
|
|
24353
|
+
return rel !== "" && !rel.startsWith("..") && !path25.isAbsolute(rel);
|
|
24092
24354
|
}
|
|
24093
24355
|
function tryRealpath(p) {
|
|
24094
24356
|
try {
|
|
24095
|
-
return
|
|
24357
|
+
return fs22.realpathSync(p);
|
|
24096
24358
|
} catch {
|
|
24097
24359
|
return p;
|
|
24098
24360
|
}
|
|
24099
24361
|
}
|
|
24100
24362
|
async function killToolServerForInstallDir(packageDir) {
|
|
24101
|
-
const parents = /* @__PURE__ */ new Set([
|
|
24363
|
+
const parents = /* @__PURE__ */ new Set([path25.resolve(packageDir), tryRealpath(packageDir)]);
|
|
24102
24364
|
let killed = 0;
|
|
24103
24365
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
24104
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
24366
|
+
const bundles = /* @__PURE__ */ new Set([path25.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
24105
24367
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
24106
24368
|
if (!matches2) continue;
|
|
24107
24369
|
const fresh = await readStateFile(file);
|
|
@@ -24119,7 +24381,7 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24119
24381
|
}
|
|
24120
24382
|
return killed;
|
|
24121
24383
|
}
|
|
24122
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24384
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs22.existsSync(p)) ?? "ps";
|
|
24123
24385
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24124
24386
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24125
24387
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -24166,14 +24428,14 @@ function couldBeOurToolServer(pid, marker) {
|
|
|
24166
24428
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
24167
24429
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
24168
24430
|
import { maxHeaderSize } from "node:http";
|
|
24169
|
-
import * as
|
|
24431
|
+
import * as path29 from "node:path";
|
|
24170
24432
|
|
|
24171
24433
|
// ../argent-tools-client/src/link-config.ts
|
|
24172
|
-
import * as
|
|
24173
|
-
import { homedir as
|
|
24434
|
+
import * as path26 from "node:path";
|
|
24435
|
+
import { homedir as homedir8 } from "node:os";
|
|
24174
24436
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
24175
|
-
var LINK_DIR =
|
|
24176
|
-
var LINK_FILE =
|
|
24437
|
+
var LINK_DIR = path26.join(homedir8(), ".argent");
|
|
24438
|
+
var LINK_FILE = path26.join(LINK_DIR, "link.json");
|
|
24177
24439
|
|
|
24178
24440
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24179
24441
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
@@ -24190,14 +24452,14 @@ import {
|
|
|
24190
24452
|
writeFile as writeFile3
|
|
24191
24453
|
} from "node:fs/promises";
|
|
24192
24454
|
import { constants, tmpdir } from "node:os";
|
|
24193
|
-
import * as
|
|
24455
|
+
import * as path27 from "node:path";
|
|
24194
24456
|
|
|
24195
24457
|
// ../archive/src/index.ts
|
|
24196
24458
|
import { spawn as spawn5 } from "node:child_process";
|
|
24197
24459
|
import { once } from "node:events";
|
|
24198
24460
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
24199
24461
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24200
|
-
import { basename as
|
|
24462
|
+
import { basename as basename5, dirname as dirname14, join as join24, resolve as resolve16, sep as sep4 } from "node:path";
|
|
24201
24463
|
import { Writable } from "node:stream";
|
|
24202
24464
|
import { pipeline } from "node:stream/promises";
|
|
24203
24465
|
import zlib2 from "node:zlib";
|
|
@@ -24215,14 +24477,23 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
24215
24477
|
// ../argent-tools-client/src/flow-files.ts
|
|
24216
24478
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
24217
24479
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
24218
|
-
import * as
|
|
24480
|
+
import * as path28 from "node:path";
|
|
24219
24481
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
24220
24482
|
|
|
24221
24483
|
// ../argent-tools-client/src/artifacts.ts
|
|
24222
|
-
import {
|
|
24484
|
+
import {
|
|
24485
|
+
copyFile,
|
|
24486
|
+
mkdir as mkdir4,
|
|
24487
|
+
mkdtemp,
|
|
24488
|
+
readFile as readFile6,
|
|
24489
|
+
realpath as realpath4,
|
|
24490
|
+
rm as rm3,
|
|
24491
|
+
stat as stat5,
|
|
24492
|
+
writeFile as writeFile4
|
|
24493
|
+
} from "node:fs/promises";
|
|
24223
24494
|
import { constants as fsConstants } from "node:fs";
|
|
24224
24495
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24225
|
-
import { basename as
|
|
24496
|
+
import { basename as basename8, dirname as dirname18, extname as extname2, isAbsolute as isAbsolute8, join as join28, normalize as normalize2, resolve as resolve19, sep as sep7 } from "node:path";
|
|
24226
24497
|
import { createHash as createHash5 } from "node:crypto";
|
|
24227
24498
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
24228
24499
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -24296,6 +24567,9 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24296
24567
|
if (trigger === "mcp_update") return "mcp_update";
|
|
24297
24568
|
return installed ? "standalone_update" : "standalone_install";
|
|
24298
24569
|
}
|
|
24570
|
+
function isLivePinnedEntry(entry) {
|
|
24571
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs23.existsSync(entry.command) && fs23.existsSync(entry.args[0]);
|
|
24572
|
+
}
|
|
24299
24573
|
async function update(args) {
|
|
24300
24574
|
const nonInteractive = args.includes("--yes") || args.includes("-y");
|
|
24301
24575
|
const noTelemetry = args.includes("--no-telemetry");
|
|
@@ -24392,7 +24666,8 @@ async function update(args) {
|
|
|
24392
24666
|
}
|
|
24393
24667
|
const spinner2 = spinner();
|
|
24394
24668
|
spinner2.start("Checking for updates...");
|
|
24395
|
-
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) :
|
|
24669
|
+
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
24670
|
+
const runIn = mode === "local" ? { cwd: projectRoot } : globalCommandOptions(pm);
|
|
24396
24671
|
let latest = null;
|
|
24397
24672
|
let target;
|
|
24398
24673
|
let minReleaseAgeMs = 0;
|
|
@@ -24401,7 +24676,7 @@ async function update(args) {
|
|
|
24401
24676
|
} else {
|
|
24402
24677
|
let resolved;
|
|
24403
24678
|
try {
|
|
24404
|
-
resolved = await resolveInstallableUpdateTarget(pm, installed);
|
|
24679
|
+
resolved = await resolveInstallableUpdateTarget(pm, installed, runIn.cwd);
|
|
24405
24680
|
} catch (err) {
|
|
24406
24681
|
spinner2.stop(import_picocolors12.default.red("Could not reach registry."));
|
|
24407
24682
|
await trackPackageAction(
|
|
@@ -24497,9 +24772,8 @@ async function update(args) {
|
|
|
24497
24772
|
// Current versions ship no postinstall, but downgrades and pinned
|
|
24498
24773
|
// installs fetch older ones whose postinstall honors this — keep it
|
|
24499
24774
|
// so they stay quiet and don't double-kill the tool server.
|
|
24500
|
-
env: { ...process.env, ARGENT_SKIP_POSTINSTALL: "1" },
|
|
24501
|
-
|
|
24502
|
-
...mode === "local" ? { cwd: projectRoot } : {}
|
|
24775
|
+
env: { ...runIn.env ?? process.env, ARGENT_SKIP_POSTINSTALL: "1" },
|
|
24776
|
+
cwd: runIn.cwd
|
|
24503
24777
|
});
|
|
24504
24778
|
},
|
|
24505
24779
|
() => {
|
|
@@ -24520,6 +24794,8 @@ async function update(args) {
|
|
|
24520
24794
|
UPDATE_PACKAGE_ACTION_FAILED
|
|
24521
24795
|
);
|
|
24522
24796
|
log.error(`${installed ? "Update" : "Install"} failed: ${installError}`);
|
|
24797
|
+
const note2 = yarnClassicNote(cmd);
|
|
24798
|
+
if (note2) log.info(`Run ${import_picocolors12.default.cyan(cmdStr)}${note2}.`);
|
|
24523
24799
|
return { failed: UPDATE_PACKAGE_ACTION_FAILED };
|
|
24524
24800
|
}
|
|
24525
24801
|
log.warn(
|
|
@@ -24581,7 +24857,7 @@ async function update(args) {
|
|
|
24581
24857
|
process.exit(1);
|
|
24582
24858
|
}
|
|
24583
24859
|
const rootOverride = getProjectRootOverride(args);
|
|
24584
|
-
const projectRoot = rootOverride ?
|
|
24860
|
+
const projectRoot = rootOverride ? path30.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
24585
24861
|
installMode = resolveInstallMode(projectRoot);
|
|
24586
24862
|
const flags = parseTargetFlags(args);
|
|
24587
24863
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -24649,8 +24925,10 @@ async function update(args) {
|
|
|
24649
24925
|
spinner2.start("Refreshing workspace configuration...");
|
|
24650
24926
|
const results = [];
|
|
24651
24927
|
const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
|
|
24928
|
+
const globalCmdMode = resolveGlobalCommandMode();
|
|
24929
|
+
const globalInstallOnPath = isGlobalInstallFirstOnPath();
|
|
24652
24930
|
const skipEntryRewrite = localCmdMode?.kind === "local-npx";
|
|
24653
|
-
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode);
|
|
24931
|
+
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
|
|
24654
24932
|
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
|
|
24655
24933
|
const adaptersByScope = /* @__PURE__ */ new Map([
|
|
24656
24934
|
["local", /* @__PURE__ */ new Set()],
|
|
@@ -24673,9 +24951,20 @@ async function update(args) {
|
|
|
24673
24951
|
);
|
|
24674
24952
|
continue;
|
|
24675
24953
|
}
|
|
24954
|
+
const entry = entryFor(normScope);
|
|
24955
|
+
const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
|
|
24956
|
+
if (replacesLivePin && normScope === "local") continue;
|
|
24957
|
+
if (replacesLivePin && !globalInstallOnPath) {
|
|
24958
|
+
results.push(
|
|
24959
|
+
`${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
|
|
24960
|
+
);
|
|
24961
|
+
continue;
|
|
24962
|
+
}
|
|
24676
24963
|
try {
|
|
24677
|
-
adapter.write(configPath,
|
|
24678
|
-
results.push(
|
|
24964
|
+
adapter.write(configPath, entry);
|
|
24965
|
+
results.push(
|
|
24966
|
+
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)}`
|
|
24967
|
+
);
|
|
24679
24968
|
} catch {
|
|
24680
24969
|
}
|
|
24681
24970
|
}
|
|
@@ -24686,15 +24975,12 @@ async function update(args) {
|
|
|
24686
24975
|
)
|
|
24687
24976
|
);
|
|
24688
24977
|
}
|
|
24689
|
-
const
|
|
24690
|
-
|
|
24691
|
-
|
|
24692
|
-
|
|
24693
|
-
|
|
24694
|
-
|
|
24695
|
-
adapter.addAllowlist(projectRoot, scope);
|
|
24696
|
-
} catch {
|
|
24697
|
-
}
|
|
24978
|
+
for (const [scope, adapters] of adaptersByScope) {
|
|
24979
|
+
for (const adapter of adapters) {
|
|
24980
|
+
if (!adapter.refreshAllowlist) continue;
|
|
24981
|
+
try {
|
|
24982
|
+
adapter.refreshAllowlist(projectRoot, scope);
|
|
24983
|
+
} catch {
|
|
24698
24984
|
}
|
|
24699
24985
|
}
|
|
24700
24986
|
}
|
|
@@ -24705,11 +24991,6 @@ async function update(args) {
|
|
|
24705
24991
|
...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
|
|
24706
24992
|
];
|
|
24707
24993
|
spinner2.stop("Configuration refreshed.");
|
|
24708
|
-
if (allowlistDisabled) {
|
|
24709
|
-
log.info(
|
|
24710
|
-
import_picocolors12.default.dim("Left editor auto-approve allowlists alone (allowlist.enabled is false).")
|
|
24711
|
-
);
|
|
24712
|
-
}
|
|
24713
24994
|
if (results.length > 0) {
|
|
24714
24995
|
note(results.join("\n"), "MCP Configs Updated");
|
|
24715
24996
|
}
|
|
@@ -24776,8 +25057,8 @@ async function update(args) {
|
|
|
24776
25057
|
// ../argent-installer/src/uninstall.ts
|
|
24777
25058
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
24778
25059
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
24779
|
-
import * as
|
|
24780
|
-
import * as
|
|
25060
|
+
import * as fs24 from "node:fs";
|
|
25061
|
+
import * as path31 from "node:path";
|
|
24781
25062
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
24782
25063
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
24783
25064
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -24798,10 +25079,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
24798
25079
|
};
|
|
24799
25080
|
function removeDirIfEmpty2(dirPath) {
|
|
24800
25081
|
try {
|
|
24801
|
-
if (!
|
|
24802
|
-
if (!
|
|
24803
|
-
if (
|
|
24804
|
-
|
|
25082
|
+
if (!fs24.existsSync(dirPath)) return false;
|
|
25083
|
+
if (!fs24.statSync(dirPath).isDirectory()) return false;
|
|
25084
|
+
if (fs24.readdirSync(dirPath).length > 0) return false;
|
|
25085
|
+
fs24.rmdirSync(dirPath);
|
|
24805
25086
|
return true;
|
|
24806
25087
|
} catch {
|
|
24807
25088
|
return false;
|
|
@@ -24811,9 +25092,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
24811
25092
|
const files = [];
|
|
24812
25093
|
const directories = [];
|
|
24813
25094
|
function walk(currentDir, relativeDir = "") {
|
|
24814
|
-
for (const entry of
|
|
24815
|
-
const relativePath = relativeDir ?
|
|
24816
|
-
const absolutePath =
|
|
25095
|
+
for (const entry of fs24.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25096
|
+
const relativePath = relativeDir ? path31.join(relativeDir, entry.name) : entry.name;
|
|
25097
|
+
const absolutePath = path31.join(currentDir, entry.name);
|
|
24817
25098
|
if (entry.isDirectory()) {
|
|
24818
25099
|
walk(absolutePath, relativePath);
|
|
24819
25100
|
directories.push(relativePath);
|
|
@@ -24826,52 +25107,52 @@ function collectBundledPaths(sourceDir) {
|
|
|
24826
25107
|
return { files, directories };
|
|
24827
25108
|
}
|
|
24828
25109
|
function removeBundledContent(sourceDir, targetDir) {
|
|
24829
|
-
if (!
|
|
25110
|
+
if (!fs24.existsSync(sourceDir) || !fs24.existsSync(targetDir)) {
|
|
24830
25111
|
return { removedPaths: [], removedRoot: false };
|
|
24831
25112
|
}
|
|
24832
25113
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
24833
25114
|
const removedPaths = [];
|
|
24834
25115
|
for (const relativePath of files) {
|
|
24835
|
-
const targetPath =
|
|
25116
|
+
const targetPath = path31.join(targetDir, relativePath);
|
|
24836
25117
|
try {
|
|
24837
|
-
|
|
24838
|
-
if (
|
|
25118
|
+
const entry = fs24.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25119
|
+
if (!entry || entry.isDirectory()) continue;
|
|
24839
25120
|
removePath(targetPath);
|
|
24840
25121
|
removedPaths.push(relativePath);
|
|
24841
25122
|
} catch {
|
|
24842
25123
|
}
|
|
24843
25124
|
}
|
|
24844
25125
|
directories.sort(
|
|
24845
|
-
(a2, b) => b.split(
|
|
25126
|
+
(a2, b) => b.split(path31.sep).length - a2.split(path31.sep).length || b.length - a2.length
|
|
24846
25127
|
);
|
|
24847
25128
|
for (const relativePath of directories) {
|
|
24848
|
-
const targetPath =
|
|
25129
|
+
const targetPath = path31.join(targetDir, relativePath);
|
|
24849
25130
|
try {
|
|
24850
|
-
if (!
|
|
24851
|
-
if (!
|
|
24852
|
-
if (
|
|
24853
|
-
|
|
25131
|
+
if (!fs24.existsSync(targetPath)) continue;
|
|
25132
|
+
if (!fs24.statSync(targetPath).isDirectory()) continue;
|
|
25133
|
+
if (fs24.readdirSync(targetPath).length > 0) continue;
|
|
25134
|
+
fs24.rmdirSync(targetPath);
|
|
24854
25135
|
} catch {
|
|
24855
25136
|
}
|
|
24856
25137
|
}
|
|
24857
25138
|
let removedRoot = false;
|
|
24858
25139
|
try {
|
|
24859
|
-
if (
|
|
24860
|
-
if (
|
|
24861
|
-
|
|
25140
|
+
if (fs24.existsSync(targetDir) && fs24.statSync(targetDir).isDirectory()) {
|
|
25141
|
+
if (fs24.readdirSync(targetDir).length === 0) {
|
|
25142
|
+
fs24.rmdirSync(targetDir);
|
|
24862
25143
|
removedRoot = true;
|
|
24863
25144
|
}
|
|
24864
25145
|
}
|
|
24865
25146
|
} catch {
|
|
24866
25147
|
}
|
|
24867
25148
|
if (removedRoot) {
|
|
24868
|
-
removeDirIfEmpty2(
|
|
25149
|
+
removeDirIfEmpty2(path31.dirname(targetDir));
|
|
24869
25150
|
}
|
|
24870
25151
|
return { removedPaths, removedRoot };
|
|
24871
25152
|
}
|
|
24872
25153
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
24873
25154
|
try {
|
|
24874
|
-
const content =
|
|
25155
|
+
const content = fs24.readFileSync(skillFilePath, "utf8");
|
|
24875
25156
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
24876
25157
|
if (!frontmatter) return fallbackName;
|
|
24877
25158
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -24882,23 +25163,23 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
24882
25163
|
}
|
|
24883
25164
|
}
|
|
24884
25165
|
function getBundledSkillNames(skillsDir) {
|
|
24885
|
-
if (!
|
|
25166
|
+
if (!fs24.existsSync(skillsDir)) return [];
|
|
24886
25167
|
const skillNames = [];
|
|
24887
|
-
for (const entry of
|
|
25168
|
+
for (const entry of fs24.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
24888
25169
|
if (!entry.isDirectory()) continue;
|
|
24889
|
-
const skillFilePath =
|
|
24890
|
-
if (!
|
|
25170
|
+
const skillFilePath = path31.join(skillsDir, entry.name, "SKILL.md");
|
|
25171
|
+
if (!fs24.existsSync(skillFilePath)) continue;
|
|
24891
25172
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
24892
25173
|
}
|
|
24893
25174
|
return [...new Set(skillNames)].sort();
|
|
24894
25175
|
}
|
|
24895
25176
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
24896
|
-
if (!
|
|
25177
|
+
if (!fs24.existsSync(targetDir)) {
|
|
24897
25178
|
return { removedPaths: [], removedRoot: false };
|
|
24898
25179
|
}
|
|
24899
25180
|
const removedPaths = [];
|
|
24900
25181
|
for (const skillName of skillNames) {
|
|
24901
|
-
const targetPath =
|
|
25182
|
+
const targetPath = path31.join(targetDir, skillName);
|
|
24902
25183
|
try {
|
|
24903
25184
|
if (removePath(targetPath)) removedPaths.push(skillName);
|
|
24904
25185
|
} catch {
|
|
@@ -24906,17 +25187,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
24906
25187
|
}
|
|
24907
25188
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
24908
25189
|
if (removedRoot) {
|
|
24909
|
-
removeDirIfEmpty2(
|
|
25190
|
+
removeDirIfEmpty2(path31.dirname(targetDir));
|
|
24910
25191
|
}
|
|
24911
25192
|
return { removedPaths, removedRoot };
|
|
24912
25193
|
}
|
|
24913
25194
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
24914
|
-
if (!
|
|
25195
|
+
if (!fs24.existsSync(lockPath)) {
|
|
24915
25196
|
return { removedSkills: [], removedFile: false };
|
|
24916
25197
|
}
|
|
24917
25198
|
let parsed;
|
|
24918
25199
|
try {
|
|
24919
|
-
parsed = JSON.parse(
|
|
25200
|
+
parsed = JSON.parse(fs24.readFileSync(lockPath, "utf8"));
|
|
24920
25201
|
} catch {
|
|
24921
25202
|
return { removedSkills: [], removedFile: false };
|
|
24922
25203
|
}
|
|
@@ -24943,10 +25224,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
24943
25224
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
24944
25225
|
);
|
|
24945
25226
|
if (!hasSkills && otherKeys.length === 0) {
|
|
24946
|
-
|
|
25227
|
+
fs24.rmSync(lockPath, { force: true });
|
|
24947
25228
|
return { removedSkills, removedFile: true };
|
|
24948
25229
|
}
|
|
24949
|
-
|
|
25230
|
+
fs24.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
24950
25231
|
return { removedSkills, removedFile: false };
|
|
24951
25232
|
}
|
|
24952
25233
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25049,7 +25330,7 @@ async function uninstall(args) {
|
|
|
25049
25330
|
removeTargets = targetDecision.targets;
|
|
25050
25331
|
}
|
|
25051
25332
|
const scopesToClean = /* @__PURE__ */ new Set(["local", "global"]);
|
|
25052
|
-
if (
|
|
25333
|
+
if (isArgentOnPath() && !removeTargets.includes("global")) {
|
|
25053
25334
|
scopesToClean.delete("global");
|
|
25054
25335
|
if (installMode === "global") scopesToClean.delete("local");
|
|
25055
25336
|
}
|
|
@@ -25149,7 +25430,7 @@ async function uninstall(args) {
|
|
|
25149
25430
|
),
|
|
25150
25431
|
{ ask: false }
|
|
25151
25432
|
);
|
|
25152
|
-
for (const root of retired.removedRoots) removeDirIfEmpty2(
|
|
25433
|
+
for (const root of retired.removedRoots) removeDirIfEmpty2(path31.dirname(root));
|
|
25153
25434
|
const retiredLines = formatRetiredCleanup(retired);
|
|
25154
25435
|
pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
|
|
25155
25436
|
const retiredKept = retiredLines.kept.map((line) => ` ${line}`);
|
|
@@ -25223,9 +25504,11 @@ async function uninstall(args) {
|
|
|
25223
25504
|
};
|
|
25224
25505
|
}
|
|
25225
25506
|
if (!globalPresent) return null;
|
|
25507
|
+
const pm = detectGlobalPackageManager();
|
|
25226
25508
|
return {
|
|
25227
25509
|
kind: "global",
|
|
25228
|
-
cmd: globalUninstallCommand(
|
|
25510
|
+
cmd: globalUninstallCommand(pm, PACKAGE_NAME),
|
|
25511
|
+
...globalCommandOptions(pm),
|
|
25229
25512
|
prompt: `Uninstall the global ${PACKAGE_NAME} package?`,
|
|
25230
25513
|
defaultRemove: false,
|
|
25231
25514
|
installDir: getGloballyInstalledPackageRoot()
|
|
@@ -25239,6 +25522,7 @@ async function uninstall(args) {
|
|
|
25239
25522
|
)
|
|
25240
25523
|
);
|
|
25241
25524
|
}
|
|
25525
|
+
let packageFailed = false;
|
|
25242
25526
|
for (const removable of removables) {
|
|
25243
25527
|
let shouldRemove = nonInteractive || removePreconfirmed;
|
|
25244
25528
|
if (!nonInteractive && !removePreconfirmed) {
|
|
@@ -25263,28 +25547,41 @@ async function uninstall(args) {
|
|
|
25263
25547
|
}
|
|
25264
25548
|
log.info(`Running: ${import_picocolors13.default.dim(formatShellCommand(removable.cmd))}`);
|
|
25265
25549
|
try {
|
|
25266
|
-
execShellCommandSync(removable.cmd,
|
|
25550
|
+
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25551
|
+
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25552
|
+
const removed = !leftover || removable.installDir !== null && !fs24.existsSync(removable.installDir);
|
|
25553
|
+
if (removed) hasUninstalledPackage = true;
|
|
25554
|
+
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25555
|
+
log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
|
|
25556
|
+
}
|
|
25557
|
+
if (leftover) {
|
|
25558
|
+
throw new Error(
|
|
25559
|
+
`${leftover} is still on PATH. Remove it with the package manager that installed it.`
|
|
25560
|
+
);
|
|
25561
|
+
}
|
|
25267
25562
|
log.success(`Removed ${removable.kind} package.`);
|
|
25268
|
-
hasUninstalledPackage = true;
|
|
25269
25563
|
if (removable.kind === "global") hasUninstalledGlobalPackage = true;
|
|
25270
25564
|
if (removable.kind === "local" && removeInstallRecord(projectRoot)) {
|
|
25271
25565
|
log.info(import_picocolors13.default.dim("Removed .argent/install.json (local mode marker)."));
|
|
25272
25566
|
}
|
|
25273
|
-
if (removeCliRecordFor(removable.installDir)) {
|
|
25274
|
-
log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
|
|
25275
|
-
}
|
|
25276
25567
|
} catch (err) {
|
|
25277
25568
|
log.error(`${removable.kind} uninstall failed: ${err}`);
|
|
25278
|
-
|
|
25279
|
-
|
|
25280
|
-
|
|
25281
|
-
UNINSTALL_PACKAGE_ACTION_FAILED
|
|
25282
|
-
);
|
|
25283
|
-
return;
|
|
25569
|
+
const note2 = yarnClassicNote(removable.cmd);
|
|
25570
|
+
if (note2) log.info(`Run ${import_picocolors13.default.cyan(formatShellCommand(removable.cmd))}${note2}.`);
|
|
25571
|
+
packageFailed = true;
|
|
25284
25572
|
}
|
|
25285
25573
|
}
|
|
25574
|
+
if (packageFailed) {
|
|
25575
|
+
await finalizeUninstallTelemetry(
|
|
25576
|
+
hasPrunedContent,
|
|
25577
|
+
hasUninstalledPackage,
|
|
25578
|
+
UNINSTALL_PACKAGE_ACTION_FAILED
|
|
25579
|
+
);
|
|
25580
|
+
process.exitCode = 1;
|
|
25581
|
+
return;
|
|
25582
|
+
}
|
|
25286
25583
|
await finalizeUninstallTelemetry(hasPrunedContent, hasUninstalledPackage);
|
|
25287
|
-
if (hasUninstalledGlobalPackage || hasUninstalledPackage && !
|
|
25584
|
+
if (hasUninstalledGlobalPackage || hasUninstalledPackage && !isArgentOnPath()) {
|
|
25288
25585
|
try {
|
|
25289
25586
|
await resetLocalTelemetryState();
|
|
25290
25587
|
} catch {
|