@swmansion/argent 0.34.1-next.9 → 0.34.1-next.91
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/README.md +1 -1
- package/assets/argent.tracecfg.pbtxt +7 -1
- package/assets/ios-screen-stream/Info.plist +12 -0
- package/assets/ios-screen-stream/ios-screen-stream.swift +321 -0
- package/assets/trace-processor/engine_bundle.node.js +2074 -11121
- package/assets/trace-processor/trace_processor.wasm +0 -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 +1268 -620
- package/dist/cli.js +0 -0
- package/dist/client.js +385 -180
- 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 +1165 -893
- package/dist/ios-device-runner/ArgentRunner/ArgentRunner.xcodeproj/xcshareddata/xcschemes/ArgentRunner.xcscheme +1 -0
- 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/ios-device-runner/ArgentRunner/ArgentRunnerUITests/ArgentRunnerSession.swift +3 -0
- package/dist/ios-device-runner/ArgentRunner/ArgentRunnerUITests/RunnerHTTPServer.swift +21 -9
- package/dist/mcp-server.mjs +15617 -7957
- package/dist/preview-ui/index.html +28 -2
- package/dist/tool-args.generated.d.ts +132 -34
- package/dist/tool-server.cjs +22729 -39276
- 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 +5 -4
- package/skills/argent-android-emulator-setup/SKILL.md +4 -4
- package/skills/argent-create-e2e/SKILL.md +3 -0
- package/skills/argent-create-e2e/references/e2e-yaml.md +20 -2
- package/skills/argent-create-e2e/references/live-authoring.md +24 -2
- package/skills/argent-device-interact/SKILL.md +23 -22
- package/skills/argent-device-interact/references/foldables.md +22 -0
- package/skills/argent-ios-device-interact/SKILL.md +3 -3
- package/skills/argent-ios-device-setup/SKILL.md +4 -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 +29 -7
- package/skills/argent-native-profiler/SKILL.md +14 -2
- package/skills/argent-qa-e2e/SKILL.md +4 -3
- package/skills/argent-react-native-app-workflow/SKILL.md +3 -3
- package/skills/argent-react-native-optimization/SKILL.md +11 -2
- package/skills/argent-react-native-optimization/references/fix-reference.md +10 -10
- package/skills/argent-react-native-profiler/SKILL.md +4 -3
- package/skills/argent-screen-recording/SKILL.md +6 -4
- package/skills/argent-screenshot-diff/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
- package/skills/argent-tv-interact/SKILL.md +3 -3
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;
|
|
@@ -15228,6 +15239,19 @@ function getAtPath(obj, dottedKey) {
|
|
|
15228
15239
|
}
|
|
15229
15240
|
return cur;
|
|
15230
15241
|
}
|
|
15242
|
+
function setAtPath(obj, dottedKey, value) {
|
|
15243
|
+
const parts = splitKey(dottedKey);
|
|
15244
|
+
let cur = obj;
|
|
15245
|
+
for (let i2 = 0; i2 < parts.length - 1; i2++) {
|
|
15246
|
+
const part = parts[i2];
|
|
15247
|
+
const next = cur[part];
|
|
15248
|
+
if (!isPlainObject(next)) {
|
|
15249
|
+
cur[part] = {};
|
|
15250
|
+
}
|
|
15251
|
+
cur = cur[part];
|
|
15252
|
+
}
|
|
15253
|
+
cur[parts[parts.length - 1]] = value;
|
|
15254
|
+
}
|
|
15231
15255
|
var LOCK_STALE_MS = 1e4;
|
|
15232
15256
|
var LOCK_MAX_WAIT_MS = 2e3;
|
|
15233
15257
|
var LOCK_RETRY_MS = 25;
|
|
@@ -15239,9 +15263,9 @@ function acquireConfigLock(finalPath) {
|
|
|
15239
15263
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
15240
15264
|
for (; ; ) {
|
|
15241
15265
|
try {
|
|
15242
|
-
const fd =
|
|
15266
|
+
const fd = fs4.openSync(lockPath, "wx", 384);
|
|
15243
15267
|
try {
|
|
15244
|
-
|
|
15268
|
+
fs4.writeSync(fd, `${process.pid}
|
|
15245
15269
|
`);
|
|
15246
15270
|
} catch {
|
|
15247
15271
|
}
|
|
@@ -15249,8 +15273,8 @@ function acquireConfigLock(finalPath) {
|
|
|
15249
15273
|
} catch (err) {
|
|
15250
15274
|
if (err.code !== "EEXIST") return null;
|
|
15251
15275
|
try {
|
|
15252
|
-
if (Date.now() -
|
|
15253
|
-
|
|
15276
|
+
if (Date.now() - fs4.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
|
|
15277
|
+
fs4.unlinkSync(lockPath);
|
|
15254
15278
|
continue;
|
|
15255
15279
|
}
|
|
15256
15280
|
} catch {
|
|
@@ -15262,35 +15286,35 @@ function acquireConfigLock(finalPath) {
|
|
|
15262
15286
|
}
|
|
15263
15287
|
function releaseConfigLock(lock) {
|
|
15264
15288
|
try {
|
|
15265
|
-
|
|
15289
|
+
fs4.closeSync(lock.fd);
|
|
15266
15290
|
} catch {
|
|
15267
15291
|
}
|
|
15268
15292
|
try {
|
|
15269
|
-
|
|
15293
|
+
fs4.unlinkSync(lock.lockPath);
|
|
15270
15294
|
} catch {
|
|
15271
15295
|
}
|
|
15272
15296
|
}
|
|
15273
15297
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
15274
15298
|
const dir = configDir(scope, options);
|
|
15275
|
-
|
|
15299
|
+
fs4.mkdirSync(dir, { recursive: true });
|
|
15276
15300
|
const finalPath = configFilePath(scope, options);
|
|
15277
15301
|
const lock = acquireConfigLock(finalPath);
|
|
15278
15302
|
try {
|
|
15279
15303
|
const next = readConfigObject(scope, options);
|
|
15280
15304
|
mutate(next);
|
|
15281
15305
|
const tmpPath = path4.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
15282
|
-
const fd =
|
|
15306
|
+
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
15283
15307
|
try {
|
|
15284
|
-
|
|
15285
|
-
|
|
15308
|
+
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
15309
|
+
fs4.fsyncSync(fd);
|
|
15286
15310
|
} finally {
|
|
15287
|
-
|
|
15311
|
+
fs4.closeSync(fd);
|
|
15288
15312
|
}
|
|
15289
15313
|
try {
|
|
15290
|
-
|
|
15314
|
+
fs4.renameSync(tmpPath, finalPath);
|
|
15291
15315
|
} catch (err) {
|
|
15292
15316
|
try {
|
|
15293
|
-
|
|
15317
|
+
fs4.unlinkSync(tmpPath);
|
|
15294
15318
|
} catch {
|
|
15295
15319
|
}
|
|
15296
15320
|
throw err;
|
|
@@ -15300,62 +15324,21 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
15300
15324
|
}
|
|
15301
15325
|
}
|
|
15302
15326
|
|
|
15327
|
+
// ../configuration-core/src/whats-new.ts
|
|
15328
|
+
var WHATS_NEW_SEEN_KEY = "notices.whats_new_seen";
|
|
15329
|
+
function getWhatsNewSeenVersion(options = {}) {
|
|
15330
|
+
const value = getAtPath(readConfigObject("global", options), WHATS_NEW_SEEN_KEY);
|
|
15331
|
+
return typeof value === "string" ? value : null;
|
|
15332
|
+
}
|
|
15333
|
+
function setWhatsNewSeenVersion(version, options = {}) {
|
|
15334
|
+
updateConfig((config) => setAtPath(config, WHATS_NEW_SEEN_KEY, version), "global", options);
|
|
15335
|
+
}
|
|
15336
|
+
|
|
15303
15337
|
// ../configuration-core/src/secrets.ts
|
|
15304
15338
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
15305
|
-
import * as
|
|
15339
|
+
import * as fs5 from "node:fs";
|
|
15306
15340
|
import * as path5 from "node:path";
|
|
15307
15341
|
|
|
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
15342
|
// ../configuration-core/src/config-schema.ts
|
|
15360
15343
|
import { isAbsolute } from "node:path";
|
|
15361
15344
|
function asBoolean(raw) {
|
|
@@ -15393,14 +15376,6 @@ var CONFIG_SCHEMA = [
|
|
|
15393
15376
|
// drained/reset, not just the file rewritten.
|
|
15394
15377
|
manageCommand: "argent telemetry"
|
|
15395
15378
|
},
|
|
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
15379
|
{
|
|
15405
15380
|
key: "lens.agent",
|
|
15406
15381
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
@@ -15484,42 +15459,9 @@ var CONFIG_SCHEMA = [
|
|
|
15484
15459
|
example: "512"
|
|
15485
15460
|
}
|
|
15486
15461
|
];
|
|
15487
|
-
function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
15488
|
-
return registry.find((def) => def.key === key);
|
|
15489
|
-
}
|
|
15490
15462
|
|
|
15491
15463
|
// ../configuration-core/src/config-access.ts
|
|
15492
15464
|
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
15465
|
|
|
15524
15466
|
// ../telemetry/src/paths.ts
|
|
15525
15467
|
function identityFilePath() {
|
|
@@ -15556,8 +15498,8 @@ function emitDebugPayload(payload) {
|
|
|
15556
15498
|
} catch {
|
|
15557
15499
|
}
|
|
15558
15500
|
try {
|
|
15559
|
-
|
|
15560
|
-
|
|
15501
|
+
fs6.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15502
|
+
fs6.appendFileSync(debugLogPath(), line + "\n");
|
|
15561
15503
|
} catch {
|
|
15562
15504
|
}
|
|
15563
15505
|
}
|
|
@@ -15740,12 +15682,16 @@ var SCRIPT_FILE_NAME_PATTERN = new RegExp(
|
|
|
15740
15682
|
`^${FLOW_NAME_CHARSET}(?:${SCRIPT_FILE_EXTENSIONS.map((ext) => `\\${ext}`).join("|")})$`
|
|
15741
15683
|
);
|
|
15742
15684
|
|
|
15685
|
+
// ../registry/src/flow-platforms.ts
|
|
15686
|
+
var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
15687
|
+
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15688
|
+
|
|
15743
15689
|
// ../registry/src/flow-file-refs.ts
|
|
15744
|
-
import * as
|
|
15690
|
+
import * as fs8 from "node:fs/promises";
|
|
15745
15691
|
import * as path9 from "node:path";
|
|
15746
15692
|
|
|
15747
15693
|
// ../registry/src/e2e-dirs.ts
|
|
15748
|
-
import * as
|
|
15694
|
+
import * as fs7 from "node:fs/promises";
|
|
15749
15695
|
import * as path8 from "node:path";
|
|
15750
15696
|
var E2E_DIR = path8.join(".argent", "e2e");
|
|
15751
15697
|
var LEGACY_E2E_DIRS = Object.freeze([path8.join(".argent", "flows")]);
|
|
@@ -15851,6 +15797,10 @@ var FAILURE_CODES = {
|
|
|
15851
15797
|
ANDROID_ADB_COMMAND_FAILED: "ANDROID_ADB_COMMAND_FAILED",
|
|
15852
15798
|
ANDROID_ADB_BOOT_TERMINAL_STATE: "ANDROID_ADB_BOOT_TERMINAL_STATE",
|
|
15853
15799
|
ANDROID_ADB_BOOT_TIMEOUT: "ANDROID_ADB_BOOT_TIMEOUT",
|
|
15800
|
+
ANDROID_NETWORK_PROXY_TIMEOUT: "ANDROID_NETWORK_PROXY_TIMEOUT",
|
|
15801
|
+
ANDROID_NETWORK_RESTORE_TIMEOUT: "ANDROID_NETWORK_RESTORE_TIMEOUT",
|
|
15802
|
+
ANDROID_OFFLINE_TIMEOUT: "ANDROID_OFFLINE_TIMEOUT",
|
|
15803
|
+
ANDROID_OFFLINE_UNSUPPORTED: "ANDROID_OFFLINE_UNSUPPORTED",
|
|
15854
15804
|
SIMULATOR_NETWORK_TIMEOUT: "SIMULATOR_NETWORK_TIMEOUT",
|
|
15855
15805
|
SIMULATOR_NETWORK_CONNECTION_REFUSED: "SIMULATOR_NETWORK_CONNECTION_REFUSED",
|
|
15856
15806
|
SIMULATOR_NETWORK_CONNECTION_RESET: "SIMULATOR_NETWORK_CONNECTION_RESET",
|
|
@@ -15970,12 +15920,15 @@ var FAILURE_CODES = {
|
|
|
15970
15920
|
DEBUGGER_CDP_PROTOCOL_ERROR: "DEBUGGER_CDP_PROTOCOL_ERROR",
|
|
15971
15921
|
DEBUGGER_CDP_CONNECT_FAILED: "DEBUGGER_CDP_CONNECT_FAILED",
|
|
15972
15922
|
DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN: "DEBUGGER_CDP_SOCKET_CLOSED_BEFORE_OPEN",
|
|
15923
|
+
DEBUGGER_CDP_ORIGIN_REJECTED: "DEBUGGER_CDP_ORIGIN_REJECTED",
|
|
15973
15924
|
DEBUGGER_CDP_NOT_CONNECTED: "DEBUGGER_CDP_NOT_CONNECTED",
|
|
15974
15925
|
DEBUGGER_CDP_REQUEST_TIMEOUT: "DEBUGGER_CDP_REQUEST_TIMEOUT",
|
|
15975
15926
|
DEBUGGER_CDP_CONNECTION_CLOSED: "DEBUGGER_CDP_CONNECTION_CLOSED",
|
|
15976
15927
|
DEBUGGER_TARGET_DEVICE_MISMATCH: "DEBUGGER_TARGET_DEVICE_MISMATCH",
|
|
15977
15928
|
DEBUGGER_EVALUATE_EXPRESSION_THREW: "DEBUGGER_EVALUATE_EXPRESSION_THREW",
|
|
15978
15929
|
DEBUGGER_RELOAD_FAILED: "DEBUGGER_RELOAD_FAILED",
|
|
15930
|
+
// e2e-add-step refused a debugger-* call that answered `not_connected`.
|
|
15931
|
+
DEBUGGER_NOT_CONNECTED: "DEBUGGER_NOT_CONNECTED",
|
|
15979
15932
|
JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED: "JS_RUNTIME_CONSOLE_SERVER_BIND_FAILED",
|
|
15980
15933
|
JS_RUNTIME_PAYLOAD_INVALID: "JS_RUNTIME_PAYLOAD_INVALID",
|
|
15981
15934
|
JS_RUNTIME_PAYLOAD_DEVICE_MISSING: "JS_RUNTIME_PAYLOAD_DEVICE_MISSING",
|
|
@@ -15989,7 +15942,8 @@ var FAILURE_CODES = {
|
|
|
15989
15942
|
ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED: "ANDROID_NETWORK_INSPECTOR_RUN_AS_FAILED",
|
|
15990
15943
|
ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE: "ANDROID_NETWORK_INSPECTOR_DEVICE_IN_USE",
|
|
15991
15944
|
ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT: "ANDROID_NETWORK_INSPECTOR_NO_DEVICE_PORT",
|
|
15992
|
-
|
|
15945
|
+
NETWORK_CAPTURE_UNAVAILABLE: "NETWORK_CAPTURE_UNAVAILABLE",
|
|
15946
|
+
NETWORK_CAPTURE_NOT_STARTED: "NETWORK_CAPTURE_NOT_STARTED",
|
|
15993
15947
|
NDJSON_CDP_REQUEST_TIMEOUT: "NDJSON_CDP_REQUEST_TIMEOUT",
|
|
15994
15948
|
NDJSON_CDP_REQUEST_FAILED: "NDJSON_CDP_REQUEST_FAILED",
|
|
15995
15949
|
NDJSON_CDP_CONNECTION_CLOSED: "NDJSON_CDP_CONNECTION_CLOSED",
|
|
@@ -16044,6 +15998,32 @@ var FAILURE_CODES = {
|
|
|
16044
15998
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
16045
15999
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
16046
16000
|
NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
|
|
16001
|
+
/**
|
|
16002
|
+
* native-profiler-launch-analysis. Input problems use TOOL_INPUT_INVALID and
|
|
16003
|
+
* devicectl steps IOS_DEVICECTL_COMMAND_FAILED.
|
|
16004
|
+
* @see [workflow.ts](../../tool-server/src/utils/ios-launch-time/workflow.ts)
|
|
16005
|
+
*/
|
|
16006
|
+
// Not macOS, or an Xcode that cannot record the launch on this target.
|
|
16007
|
+
LAUNCH_ANALYSIS_UNSUPPORTED_HOST: "LAUNCH_ANALYSIS_UNSUPPORTED_HOST",
|
|
16008
|
+
// No usable iPhone or simulator was selected, or Argent's runner holds it.
|
|
16009
|
+
LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE: "LAUNCH_ANALYSIS_DEVICE_UNAVAILABLE",
|
|
16010
|
+
// The bundle_id app is not installed on the selected device.
|
|
16011
|
+
LAUNCH_ANALYSIS_APP_NOT_INSTALLED: "LAUNCH_ANALYSIS_APP_NOT_INSTALLED",
|
|
16012
|
+
// The runner's xcodebuild failed on code signing or provisioning.
|
|
16013
|
+
LAUNCH_ANALYSIS_SIGNING_FAILED: "LAUNCH_ANALYSIS_SIGNING_FAILED",
|
|
16014
|
+
// The iPhone's free developer profile has no slot for Argent's runner.
|
|
16015
|
+
LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT: "LAUNCH_ANALYSIS_FREE_PROFILE_LIMIT",
|
|
16016
|
+
// simctl could not wait for boot, find, launch or terminate the app.
|
|
16017
|
+
LAUNCH_ANALYSIS_SIMCTL_FAILED: "LAUNCH_ANALYSIS_SIMCTL_FAILED",
|
|
16018
|
+
LAUNCH_ANALYSIS_RECORD_FAILED: "LAUNCH_ANALYSIS_RECORD_FAILED",
|
|
16019
|
+
// xctrace could not export the TOC, the CPU samples or the first-frame marker.
|
|
16020
|
+
LAUNCH_ANALYSIS_EXPORT_FAILED: "LAUNCH_ANALYSIS_EXPORT_FAILED",
|
|
16021
|
+
// The App Launch trace has no first frame of the app, so it has no launch window.
|
|
16022
|
+
LAUNCH_ANALYSIS_NO_FIRST_FRAME: "LAUNCH_ANALYSIS_NO_FIRST_FRAME",
|
|
16023
|
+
// The XCTest launch run of Argent's runner failed.
|
|
16024
|
+
LAUNCH_ANALYSIS_RUNNER_TEST_FAILED: "LAUNCH_ANALYSIS_RUNNER_TEST_FAILED",
|
|
16025
|
+
// The launch test ran, but Argent read no launch measurements from its result.
|
|
16026
|
+
LAUNCH_ANALYSIS_NO_SAMPLES: "LAUNCH_ANALYSIS_NO_SAMPLES",
|
|
16047
16027
|
// iOS and Android share one capture path (simulator-server frames into
|
|
16048
16028
|
// ffmpeg), so these name the failing stage, not the device family.
|
|
16049
16029
|
SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
|
|
@@ -16058,6 +16038,19 @@ var FAILURE_CODES = {
|
|
|
16058
16038
|
SCREEN_RECORDING_SERVER_SHUTTING_DOWN: "SCREEN_RECORDING_SERVER_SHUTTING_DOWN",
|
|
16059
16039
|
SCREEN_RECORDING_STREAM_UNAVAILABLE: "SCREEN_RECORDING_STREAM_UNAVAILABLE",
|
|
16060
16040
|
SCREEN_RECORDING_FFMPEG_NOT_FOUND: "SCREEN_RECORDING_FFMPEG_NOT_FOUND",
|
|
16041
|
+
// A cabled iPhone has no simulator-server: its frames come from a host-side
|
|
16042
|
+
// CoreMediaIO capture helper, which can fail in ways of its own.
|
|
16043
|
+
SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_BUILD_FAILED",
|
|
16044
|
+
SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND: "SCREEN_RECORDING_DEVICE_SCREEN_NOT_FOUND",
|
|
16045
|
+
SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED: "SCREEN_RECORDING_DEVICE_CAMERA_PERMISSION_DENIED",
|
|
16046
|
+
SCREEN_RECORDING_DEVICE_HELPER_FAILED: "SCREEN_RECORDING_DEVICE_HELPER_FAILED",
|
|
16047
|
+
AUDIO_CLIP_CONVERSION_FAILED: "AUDIO_CLIP_CONVERSION_FAILED",
|
|
16048
|
+
AUDIO_HOOK_NOT_ACTIVE: "AUDIO_HOOK_NOT_ACTIVE",
|
|
16049
|
+
AUDIO_ENV_SETUP_FAILED: "AUDIO_ENV_SETUP_FAILED",
|
|
16050
|
+
AUDIO_WRONG_PLATFORM: "AUDIO_WRONG_PLATFORM",
|
|
16051
|
+
AUDIO_HOOK_UNAVAILABLE: "AUDIO_HOOK_UNAVAILABLE",
|
|
16052
|
+
AUDIO_INJECTION_NOT_OURS: "AUDIO_INJECTION_NOT_OURS",
|
|
16053
|
+
AUDIO_SIMULATOR_NOT_BOOTED: "AUDIO_SIMULATOR_NOT_BOOTED",
|
|
16061
16054
|
FLOW_PROJECT_ROOT_INVALID: "FLOW_PROJECT_ROOT_INVALID",
|
|
16062
16055
|
FLOW_NAME_INVALID: "FLOW_NAME_INVALID",
|
|
16063
16056
|
FLOW_NO_ACTIVE_RECORDING: "FLOW_NO_ACTIVE_RECORDING",
|
|
@@ -16121,6 +16114,8 @@ var FAILURE_CODES = {
|
|
|
16121
16114
|
MACOS_APP_BUNDLE_ID_MISMATCH: "MACOS_APP_BUNDLE_ID_MISMATCH",
|
|
16122
16115
|
MACOS_APP_OPEN_URL_FAILED: "MACOS_APP_OPEN_URL_FAILED",
|
|
16123
16116
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
16117
|
+
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
16118
|
+
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
16124
16119
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
16125
16120
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
16126
16121
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -16143,6 +16138,9 @@ var FAILURE_CODES = {
|
|
|
16143
16138
|
BOOT_ANDROID_FIRST_FRAME_TIMEOUT: "BOOT_ANDROID_FIRST_FRAME_TIMEOUT",
|
|
16144
16139
|
BOOT_ANDROID_PACKAGE_MANAGER_UNAVAILABLE: "BOOT_ANDROID_PACKAGE_MANAGER_UNAVAILABLE",
|
|
16145
16140
|
BOOT_ANDROID_COLD_BOOT_FAILED: "BOOT_ANDROID_COLD_BOOT_FAILED",
|
|
16141
|
+
BOOT_ANDROID_PORT_INVALID: "BOOT_ANDROID_PORT_INVALID",
|
|
16142
|
+
BOOT_ANDROID_PORT_IN_USE: "BOOT_ANDROID_PORT_IN_USE",
|
|
16143
|
+
BOOT_ANDROID_READ_ONLY_CONFLICT: "BOOT_ANDROID_READ_ONLY_CONFLICT",
|
|
16146
16144
|
BOOT_HARMONY_INSTANCE_NOT_FOUND: "BOOT_HARMONY_INSTANCE_NOT_FOUND",
|
|
16147
16145
|
BOOT_HARMONY_TARGET_LIST_FAILED: "BOOT_HARMONY_TARGET_LIST_FAILED",
|
|
16148
16146
|
BOOT_HARMONY_STOP_FAILED: "BOOT_HARMONY_STOP_FAILED",
|
|
@@ -16190,13 +16188,19 @@ var FAILURE_COMMANDS = [
|
|
|
16190
16188
|
"ax_service",
|
|
16191
16189
|
"simulator_server",
|
|
16192
16190
|
"ffmpeg",
|
|
16191
|
+
"afconvert",
|
|
16193
16192
|
"cdp",
|
|
16194
16193
|
"electron",
|
|
16195
16194
|
"npm",
|
|
16196
16195
|
"npx",
|
|
16197
16196
|
"unknown",
|
|
16198
16197
|
"devicectl",
|
|
16199
|
-
"xcodebuild"
|
|
16198
|
+
"xcodebuild",
|
|
16199
|
+
"swiftc",
|
|
16200
|
+
// The host-side helper that captures a cabled iPhone's screen.
|
|
16201
|
+
"ios_screen_stream",
|
|
16202
|
+
// `xcrun xcresulttool`, which reads an XCTest result bundle.
|
|
16203
|
+
"xcresulttool"
|
|
16200
16204
|
];
|
|
16201
16205
|
var FAILURE_SIGNAL_NAMES = [
|
|
16202
16206
|
"SIGABRT",
|
|
@@ -16245,7 +16249,8 @@ var DEVICE_KINDS = [
|
|
|
16245
16249
|
"emulator",
|
|
16246
16250
|
"vvd",
|
|
16247
16251
|
"device",
|
|
16248
|
-
"app"
|
|
16252
|
+
"app",
|
|
16253
|
+
"catalyst"
|
|
16249
16254
|
];
|
|
16250
16255
|
var DEBUGGER_NOT_CONNECTED_REASONS = [
|
|
16251
16256
|
"metro_not_running",
|
|
@@ -16383,7 +16388,8 @@ var ALLOWED = {
|
|
|
16383
16388
|
install_mode: INSTALL_MODE
|
|
16384
16389
|
},
|
|
16385
16390
|
"installation:allowlist_decision": {
|
|
16386
|
-
is_enabled: bool
|
|
16391
|
+
is_enabled: bool,
|
|
16392
|
+
decided_by: oneOf(["flag", "default", "prompt"])
|
|
16387
16393
|
},
|
|
16388
16394
|
"installation:stale_config_cleanup": {
|
|
16389
16395
|
removed_count: COUNT,
|
|
@@ -16570,9 +16576,9 @@ function isReplitAgent(env) {
|
|
|
16570
16576
|
}
|
|
16571
16577
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16572
16578
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16573
|
-
function safeExists(fileExists,
|
|
16579
|
+
function safeExists(fileExists, path32) {
|
|
16574
16580
|
try {
|
|
16575
|
-
return fileExists(
|
|
16581
|
+
return fileExists(path32);
|
|
16576
16582
|
} catch {
|
|
16577
16583
|
return false;
|
|
16578
16584
|
}
|
|
@@ -16987,13 +16993,12 @@ function isCi(env = process.env) {
|
|
|
16987
16993
|
if (GENERIC_CI_ENV_VARS.some((name) => Boolean(env[name]))) return true;
|
|
16988
16994
|
return isKnownVendorCi(env);
|
|
16989
16995
|
}
|
|
16990
|
-
var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
16991
16996
|
|
|
16992
16997
|
// ../telemetry/src/base-props.ts
|
|
16993
16998
|
var SESSION_ID = randomUUID4();
|
|
16994
16999
|
function readCliVersion() {
|
|
16995
17000
|
if (true) {
|
|
16996
|
-
return "0.34.1-next.
|
|
17001
|
+
return "0.34.1-next.90";
|
|
16997
17002
|
}
|
|
16998
17003
|
return "0.0.0";
|
|
16999
17004
|
}
|
|
@@ -17026,7 +17031,7 @@ function getBaseProps(runtime) {
|
|
|
17026
17031
|
|
|
17027
17032
|
// ../telemetry/src/identity.ts
|
|
17028
17033
|
import * as crypto2 from "node:crypto";
|
|
17029
|
-
import * as
|
|
17034
|
+
import * as fs9 from "node:fs";
|
|
17030
17035
|
import * as path10 from "node:path";
|
|
17031
17036
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17032
17037
|
var cached = null;
|
|
@@ -17134,17 +17139,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17134
17139
|
function isCorruptIdFile(filePath) {
|
|
17135
17140
|
let isRegularFile;
|
|
17136
17141
|
try {
|
|
17137
|
-
isRegularFile =
|
|
17142
|
+
isRegularFile = fs9.lstatSync(filePath).isFile();
|
|
17138
17143
|
} catch {
|
|
17139
17144
|
return false;
|
|
17140
17145
|
}
|
|
17141
17146
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17142
17147
|
}
|
|
17143
17148
|
function writeIdFileAtomic(finalPath, id) {
|
|
17144
|
-
|
|
17149
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17145
17150
|
let occupant;
|
|
17146
17151
|
try {
|
|
17147
|
-
occupant =
|
|
17152
|
+
occupant = fs9.lstatSync(finalPath);
|
|
17148
17153
|
} catch (err) {
|
|
17149
17154
|
if (err.code !== "ENOENT") throw err;
|
|
17150
17155
|
}
|
|
@@ -17155,24 +17160,24 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
17155
17160
|
argentHomeDir(),
|
|
17156
17161
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17157
17162
|
);
|
|
17158
|
-
const fd =
|
|
17163
|
+
const fd = fs9.openSync(tmpPath, "wx", 384);
|
|
17159
17164
|
try {
|
|
17160
17165
|
try {
|
|
17161
|
-
|
|
17162
|
-
|
|
17166
|
+
fs9.writeSync(fd, id);
|
|
17167
|
+
fs9.fsyncSync(fd);
|
|
17163
17168
|
} finally {
|
|
17164
|
-
|
|
17169
|
+
fs9.closeSync(fd);
|
|
17165
17170
|
}
|
|
17166
|
-
|
|
17171
|
+
fs9.renameSync(tmpPath, finalPath);
|
|
17167
17172
|
} finally {
|
|
17168
17173
|
try {
|
|
17169
|
-
|
|
17174
|
+
fs9.unlinkSync(tmpPath);
|
|
17170
17175
|
} catch {
|
|
17171
17176
|
}
|
|
17172
17177
|
}
|
|
17173
17178
|
}
|
|
17174
17179
|
function mintRandomId(finalPath) {
|
|
17175
|
-
|
|
17180
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17176
17181
|
let value = crypto2.randomUUID();
|
|
17177
17182
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17178
17183
|
const tmpPath = path10.join(
|
|
@@ -17181,19 +17186,19 @@ function mintRandomId(finalPath) {
|
|
|
17181
17186
|
);
|
|
17182
17187
|
let fd;
|
|
17183
17188
|
try {
|
|
17184
|
-
fd =
|
|
17189
|
+
fd = fs9.openSync(tmpPath, "wx", 384);
|
|
17185
17190
|
} catch (err) {
|
|
17186
17191
|
if (err.code === "EEXIST") continue;
|
|
17187
17192
|
throw err;
|
|
17188
17193
|
}
|
|
17189
17194
|
try {
|
|
17190
17195
|
try {
|
|
17191
|
-
|
|
17192
|
-
|
|
17196
|
+
fs9.writeSync(fd, value);
|
|
17197
|
+
fs9.fsyncSync(fd);
|
|
17193
17198
|
} finally {
|
|
17194
|
-
|
|
17199
|
+
fs9.closeSync(fd);
|
|
17195
17200
|
}
|
|
17196
|
-
|
|
17201
|
+
fs9.linkSync(tmpPath, finalPath);
|
|
17197
17202
|
cached = { path: finalPath, id: value };
|
|
17198
17203
|
return value;
|
|
17199
17204
|
} catch (err) {
|
|
@@ -17212,7 +17217,7 @@ function mintRandomId(finalPath) {
|
|
|
17212
17217
|
throw err;
|
|
17213
17218
|
} finally {
|
|
17214
17219
|
try {
|
|
17215
|
-
|
|
17220
|
+
fs9.unlinkSync(tmpPath);
|
|
17216
17221
|
} catch {
|
|
17217
17222
|
}
|
|
17218
17223
|
}
|
|
@@ -17225,7 +17230,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17225
17230
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17226
17231
|
);
|
|
17227
17232
|
try {
|
|
17228
|
-
|
|
17233
|
+
fs9.renameSync(finalPath, claimed);
|
|
17229
17234
|
} catch {
|
|
17230
17235
|
return null;
|
|
17231
17236
|
}
|
|
@@ -17234,7 +17239,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17234
17239
|
grabbed = tryReadId(claimed);
|
|
17235
17240
|
} finally {
|
|
17236
17241
|
try {
|
|
17237
|
-
|
|
17242
|
+
fs9.unlinkSync(claimed);
|
|
17238
17243
|
} catch {
|
|
17239
17244
|
}
|
|
17240
17245
|
}
|
|
@@ -17243,7 +17248,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17243
17248
|
function deleteAnonId() {
|
|
17244
17249
|
cached = null;
|
|
17245
17250
|
try {
|
|
17246
|
-
|
|
17251
|
+
fs9.unlinkSync(identityFilePath());
|
|
17247
17252
|
} catch (err) {
|
|
17248
17253
|
if (err.code !== "ENOENT") throw err;
|
|
17249
17254
|
}
|
|
@@ -17251,9 +17256,9 @@ function deleteAnonId() {
|
|
|
17251
17256
|
function tryReadId(filePath) {
|
|
17252
17257
|
let raw;
|
|
17253
17258
|
try {
|
|
17254
|
-
const stats =
|
|
17259
|
+
const stats = fs9.lstatSync(filePath);
|
|
17255
17260
|
if (!stats.isFile()) return null;
|
|
17256
|
-
raw =
|
|
17261
|
+
raw = fs9.readFileSync(filePath, "utf8");
|
|
17257
17262
|
} catch (err) {
|
|
17258
17263
|
if (err.code === "ENOENT") return null;
|
|
17259
17264
|
return null;
|
|
@@ -17268,7 +17273,7 @@ import { execFileSync, spawn } from "node:child_process";
|
|
|
17268
17273
|
|
|
17269
17274
|
// ../native-devtools-ios/src/index.ts
|
|
17270
17275
|
import * as path11 from "node:path";
|
|
17271
|
-
import * as
|
|
17276
|
+
import * as fs10 from "node:fs";
|
|
17272
17277
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path11.join(__dirname, "..", "dylibs");
|
|
17273
17278
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path11.join(__dirname, "..", "bin");
|
|
17274
17279
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path11.join(DYLIB_DIR, "tcp");
|
|
@@ -17288,9 +17293,9 @@ function platformBinDir() {
|
|
|
17288
17293
|
function simulatorServerBinaryPath() {
|
|
17289
17294
|
const binaryName = simulatorServerBinaryName();
|
|
17290
17295
|
const p = path11.join(platformBinDir(), binaryName);
|
|
17291
|
-
if (!
|
|
17296
|
+
if (!fs10.existsSync(p)) {
|
|
17292
17297
|
const flat = path11.join(BIN_DIR, binaryName);
|
|
17293
|
-
const migrationHint =
|
|
17298
|
+
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
17299
|
throw new Error(
|
|
17295
17300
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17296
17301
|
);
|
|
@@ -17319,12 +17324,12 @@ function resolveHostFingerprint() {
|
|
|
17319
17324
|
}
|
|
17320
17325
|
}
|
|
17321
17326
|
function resolveHostFingerprintAsync() {
|
|
17322
|
-
return new Promise((
|
|
17327
|
+
return new Promise((resolve21) => {
|
|
17323
17328
|
let binary;
|
|
17324
17329
|
try {
|
|
17325
17330
|
binary = simulatorServerBinaryPath();
|
|
17326
17331
|
} catch {
|
|
17327
|
-
|
|
17332
|
+
resolve21(null);
|
|
17328
17333
|
return;
|
|
17329
17334
|
}
|
|
17330
17335
|
let settled = false;
|
|
@@ -17337,7 +17342,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17337
17342
|
child?.kill("SIGKILL");
|
|
17338
17343
|
} catch {
|
|
17339
17344
|
}
|
|
17340
|
-
|
|
17345
|
+
resolve21(value);
|
|
17341
17346
|
};
|
|
17342
17347
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17343
17348
|
watchdog.unref?.();
|
|
@@ -17370,14 +17375,15 @@ function resolveHostFingerprintAsync() {
|
|
|
17370
17375
|
}
|
|
17371
17376
|
|
|
17372
17377
|
// ../telemetry/src/consent.ts
|
|
17373
|
-
import * as
|
|
17378
|
+
import * as fs11 from "node:fs";
|
|
17379
|
+
import * as path12 from "node:path";
|
|
17374
17380
|
var cache = /* @__PURE__ */ new Map();
|
|
17375
17381
|
var sessionOverride = null;
|
|
17376
17382
|
function readConfigOverrideAt(filePath) {
|
|
17377
17383
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17378
17384
|
let stats;
|
|
17379
17385
|
try {
|
|
17380
|
-
stats =
|
|
17386
|
+
stats = fs11.lstatSync(filePath);
|
|
17381
17387
|
} catch {
|
|
17382
17388
|
cache.set(filePath, miss);
|
|
17383
17389
|
return null;
|
|
@@ -17394,7 +17400,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17394
17400
|
}
|
|
17395
17401
|
let parsedEnabled = null;
|
|
17396
17402
|
try {
|
|
17397
|
-
const raw =
|
|
17403
|
+
const raw = fs11.readFileSync(filePath, "utf8");
|
|
17398
17404
|
const json = JSON.parse(raw);
|
|
17399
17405
|
if (json && typeof json === "object") {
|
|
17400
17406
|
const t2 = json.telemetry;
|
|
@@ -17412,7 +17418,8 @@ function readPersistedConsent(cwd) {
|
|
|
17412
17418
|
const globalPath = configFilePath("global");
|
|
17413
17419
|
const projectPath = configFilePath("project", { cwd });
|
|
17414
17420
|
const global2 = readConfigOverrideAt(globalPath);
|
|
17415
|
-
const
|
|
17421
|
+
const projectRoot = path12.dirname(path12.dirname(projectPath));
|
|
17422
|
+
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
17416
17423
|
if (project === false && global2 === false) {
|
|
17417
17424
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
17418
17425
|
}
|
|
@@ -17607,7 +17614,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
17607
17614
|
async function raceDrain(client2, timeoutMs) {
|
|
17608
17615
|
await Promise.race([
|
|
17609
17616
|
client2.shutdown(timeoutMs),
|
|
17610
|
-
new Promise((
|
|
17617
|
+
new Promise((resolve21) => setTimeout(resolve21, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
17611
17618
|
]);
|
|
17612
17619
|
}
|
|
17613
17620
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -17627,10 +17634,10 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17627
17634
|
}
|
|
17628
17635
|
|
|
17629
17636
|
// ../argent-installer/src/mcp-configs.ts
|
|
17630
|
-
import * as
|
|
17631
|
-
import * as
|
|
17637
|
+
import * as fs18 from "node:fs";
|
|
17638
|
+
import * as path19 from "node:path";
|
|
17632
17639
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
17633
|
-
import { homedir as
|
|
17640
|
+
import { homedir as homedir5 } from "node:os";
|
|
17634
17641
|
|
|
17635
17642
|
// ../argent-installer/src/constants.ts
|
|
17636
17643
|
var PACKAGE_NAME = "@swmansion/argent";
|
|
@@ -17643,11 +17650,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17643
17650
|
|
|
17644
17651
|
// ../argent-installer/src/utils.ts
|
|
17645
17652
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17646
|
-
import * as
|
|
17647
|
-
import * as
|
|
17653
|
+
import * as fs17 from "node:fs";
|
|
17654
|
+
import * as path18 from "node:path";
|
|
17648
17655
|
import * as dns from "node:dns";
|
|
17649
17656
|
import { createHash as createHash2 } from "node:crypto";
|
|
17650
|
-
import * as
|
|
17657
|
+
import * as os3 from "node:os";
|
|
17651
17658
|
import { execFileSync as execFileSync3, execSync } from "node:child_process";
|
|
17652
17659
|
|
|
17653
17660
|
// ../../node_modules/smol-toml/dist/error.js
|
|
@@ -19370,11 +19377,11 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19370
19377
|
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
19371
19378
|
ensurePropertyComplete(offset + length);
|
|
19372
19379
|
},
|
|
19373
|
-
onSeparator: (
|
|
19380
|
+
onSeparator: (sep9, offset, length) => {
|
|
19374
19381
|
if (currentParent.type === "property") {
|
|
19375
|
-
if (
|
|
19382
|
+
if (sep9 === ":") {
|
|
19376
19383
|
currentParent.colonOffset = offset;
|
|
19377
|
-
} else if (
|
|
19384
|
+
} else if (sep9 === ",") {
|
|
19378
19385
|
ensurePropertyComplete(offset);
|
|
19379
19386
|
}
|
|
19380
19387
|
}
|
|
@@ -19390,12 +19397,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19390
19397
|
}
|
|
19391
19398
|
return result;
|
|
19392
19399
|
}
|
|
19393
|
-
function findNodeAtLocation(root,
|
|
19400
|
+
function findNodeAtLocation(root, path32) {
|
|
19394
19401
|
if (!root) {
|
|
19395
19402
|
return void 0;
|
|
19396
19403
|
}
|
|
19397
19404
|
let node = root;
|
|
19398
|
-
for (let segment of
|
|
19405
|
+
for (let segment of path32) {
|
|
19399
19406
|
if (typeof segment === "string") {
|
|
19400
19407
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19401
19408
|
return void 0;
|
|
@@ -19749,14 +19756,14 @@ function getNodeType(value) {
|
|
|
19749
19756
|
|
|
19750
19757
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19751
19758
|
function setProperty(text2, originalPath, value, options) {
|
|
19752
|
-
const
|
|
19759
|
+
const path32 = originalPath.slice();
|
|
19753
19760
|
const errors = [];
|
|
19754
19761
|
const root = parseTree(text2, errors);
|
|
19755
19762
|
let parent = void 0;
|
|
19756
19763
|
let lastSegment = void 0;
|
|
19757
|
-
while (
|
|
19758
|
-
lastSegment =
|
|
19759
|
-
parent = findNodeAtLocation(root,
|
|
19764
|
+
while (path32.length > 0) {
|
|
19765
|
+
lastSegment = path32.pop();
|
|
19766
|
+
parent = findNodeAtLocation(root, path32);
|
|
19760
19767
|
if (parent === void 0 && value !== void 0) {
|
|
19761
19768
|
if (typeof lastSegment === "string") {
|
|
19762
19769
|
value = { [lastSegment]: value };
|
|
@@ -19942,8 +19949,8 @@ var ParseErrorCode;
|
|
|
19942
19949
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
19943
19950
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
19944
19951
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
19945
|
-
function modify(text2,
|
|
19946
|
-
return setProperty(text2,
|
|
19952
|
+
function modify(text2, path32, value, options) {
|
|
19953
|
+
return setProperty(text2, path32, value, options);
|
|
19947
19954
|
}
|
|
19948
19955
|
function applyEdits(text2, edits) {
|
|
19949
19956
|
let sortedEdits = edits.slice(0).sort((a2, b) => {
|
|
@@ -19967,146 +19974,29 @@ function applyEdits(text2, edits) {
|
|
|
19967
19974
|
}
|
|
19968
19975
|
|
|
19969
19976
|
// ../argent-installer/src/package-root.ts
|
|
19970
|
-
import * as
|
|
19971
|
-
import * as
|
|
19972
|
-
function resolvePackageRoot(
|
|
19973
|
-
let current =
|
|
19977
|
+
import * as fs12 from "node:fs";
|
|
19978
|
+
import * as path13 from "node:path";
|
|
19979
|
+
function resolvePackageRoot(dirname20) {
|
|
19980
|
+
let current = path13.resolve(dirname20);
|
|
19974
19981
|
while (true) {
|
|
19975
|
-
if (
|
|
19976
|
-
const parent =
|
|
19977
|
-
if (parent === current) return
|
|
19982
|
+
if (fs12.existsSync(path13.join(current, "package.json"))) return current;
|
|
19983
|
+
const parent = path13.dirname(current);
|
|
19984
|
+
if (parent === current) return path13.resolve(dirname20);
|
|
19978
19985
|
current = parent;
|
|
19979
19986
|
}
|
|
19980
19987
|
}
|
|
19981
19988
|
|
|
19982
19989
|
// ../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
|
-
}
|
|
19990
|
+
import * as fs15 from "node:fs";
|
|
19991
|
+
import * as os2 from "node:os";
|
|
19992
|
+
import * as path16 from "node:path";
|
|
19993
|
+
|
|
19994
|
+
// ../argent-installer/src/topology.ts
|
|
19995
|
+
var import_semver2 = __toESM(require_semver2(), 1);
|
|
19996
|
+
import * as fs14 from "node:fs";
|
|
19997
|
+
import * as path15 from "node:path";
|
|
19998
|
+
import { createRequire } from "node:module";
|
|
19999
|
+
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20110
20000
|
|
|
20111
20001
|
// ../argent-installer/src/preflight.ts
|
|
20112
20002
|
import * as fs13 from "node:fs";
|
|
@@ -20119,11 +20009,6 @@ function isYarnPnp(projectRoot) {
|
|
|
20119
20009
|
}
|
|
20120
20010
|
|
|
20121
20011
|
// ../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
20012
|
var TEMP_RUNNER_PATTERNS = [
|
|
20128
20013
|
// npx: <npm cache>/_npx/<hash>/node_modules/.bin
|
|
20129
20014
|
/\/_npx\//,
|
|
@@ -20144,24 +20029,82 @@ function isTempRunnerPath(binaryPath) {
|
|
|
20144
20029
|
const slashed = binaryPath.split("\\").join("/");
|
|
20145
20030
|
return TEMP_RUNNER_PATTERNS.some((pattern) => pattern.test(slashed));
|
|
20146
20031
|
}
|
|
20147
|
-
function
|
|
20032
|
+
function isProjectBinPath(binaryPath) {
|
|
20033
|
+
const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
|
|
20034
|
+
const binDir = norm(path15.dirname(path15.resolve(binaryPath)));
|
|
20035
|
+
const prefix = process.env.npm_config_local_prefix;
|
|
20036
|
+
if (prefix && norm(path15.join(prefix, "node_modules", ".bin")) === binDir) return true;
|
|
20037
|
+
for (let dir = path15.resolve(process.cwd()); ; dir = path15.dirname(dir)) {
|
|
20038
|
+
if (norm(path15.join(dir, "node_modules", ".bin")) === binDir) return true;
|
|
20039
|
+
if (path15.dirname(dir) === dir) return false;
|
|
20040
|
+
}
|
|
20041
|
+
}
|
|
20042
|
+
function getPermanentBinaryPaths() {
|
|
20148
20043
|
try {
|
|
20149
20044
|
const [cmd, args] = process.platform === "win32" ? ["where", [MCP_BINARY_NAME]] : ["which", ["-a", MCP_BINARY_NAME]];
|
|
20150
20045
|
const output = execFileSync2(cmd, args, {
|
|
20151
20046
|
encoding: "utf8",
|
|
20152
20047
|
stdio: ["ignore", "pipe", "ignore"]
|
|
20153
20048
|
});
|
|
20154
|
-
return output.split(/\r?\n/).map((line) => line.trim()).filter(
|
|
20049
|
+
return output.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !isTempRunnerPath(line));
|
|
20155
20050
|
} catch {
|
|
20156
|
-
return
|
|
20051
|
+
return [];
|
|
20157
20052
|
}
|
|
20158
20053
|
}
|
|
20054
|
+
function getGlobalBinaryPaths() {
|
|
20055
|
+
return getPermanentBinaryPaths().filter((line) => !isProjectBinPath(line));
|
|
20056
|
+
}
|
|
20057
|
+
function isArgentOnPath() {
|
|
20058
|
+
return getPermanentBinaryPaths().length > 0;
|
|
20059
|
+
}
|
|
20060
|
+
function getRemainingGlobalBinaryPath() {
|
|
20061
|
+
for (const binaryPath of getGlobalBinaryPaths()) {
|
|
20062
|
+
if (process.platform === "win32" || globalPackageRootOf(binaryPath)) return binaryPath;
|
|
20063
|
+
try {
|
|
20064
|
+
execFileSync2(binaryPath, ["--version"], { stdio: "ignore", timeout: 1e4 });
|
|
20065
|
+
return binaryPath;
|
|
20066
|
+
} catch {
|
|
20067
|
+
}
|
|
20068
|
+
}
|
|
20069
|
+
return null;
|
|
20070
|
+
}
|
|
20159
20071
|
function isGloballyInstalled() {
|
|
20160
|
-
return
|
|
20072
|
+
return getRemainingGlobalBinaryPath() !== null;
|
|
20073
|
+
}
|
|
20074
|
+
function getUnshadowedGlobalBinaryPath() {
|
|
20075
|
+
const first = getPermanentBinaryPaths()[0];
|
|
20076
|
+
return first !== void 0 && !isProjectBinPath(first) ? getRemainingGlobalBinaryPath() : null;
|
|
20077
|
+
}
|
|
20078
|
+
function isGlobalInstallFirstOnPath() {
|
|
20079
|
+
return getUnshadowedGlobalBinaryPath() !== null;
|
|
20161
20080
|
}
|
|
20162
20081
|
function getGloballyInstalledPackageRoot() {
|
|
20163
|
-
const binaryPath =
|
|
20164
|
-
|
|
20082
|
+
const binaryPath = getRemainingGlobalBinaryPath();
|
|
20083
|
+
return binaryPath ? globalPackageRootOf(binaryPath) : null;
|
|
20084
|
+
}
|
|
20085
|
+
function readShimScript(binaryPath) {
|
|
20086
|
+
try {
|
|
20087
|
+
if (fs14.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20088
|
+
return fs14.readFileSync(binaryPath, "utf8");
|
|
20089
|
+
} catch {
|
|
20090
|
+
return null;
|
|
20091
|
+
}
|
|
20092
|
+
}
|
|
20093
|
+
function shimTargetOf(binaryPath) {
|
|
20094
|
+
const shim = readShimScript(binaryPath);
|
|
20095
|
+
if (!shim) return null;
|
|
20096
|
+
const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
|
|
20097
|
+
if (trailer) return trailer[1].trim();
|
|
20098
|
+
const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
|
|
20099
|
+
return relative5 ? path15.resolve(canonicalPath(path15.dirname(binaryPath)), relative5[1]) : null;
|
|
20100
|
+
}
|
|
20101
|
+
function globalPackageRootOf(binaryPath) {
|
|
20102
|
+
const root = packageRootOf(binaryPath);
|
|
20103
|
+
if (root) return root;
|
|
20104
|
+
const target = shimTargetOf(binaryPath);
|
|
20105
|
+
return target ? packageRootOf(target) : null;
|
|
20106
|
+
}
|
|
20107
|
+
function packageRootOf(binaryPath) {
|
|
20165
20108
|
try {
|
|
20166
20109
|
const realPath = fs14.realpathSync(binaryPath);
|
|
20167
20110
|
const root = resolvePackageRoot(path15.dirname(realPath));
|
|
@@ -20171,6 +20114,26 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20171
20114
|
return null;
|
|
20172
20115
|
}
|
|
20173
20116
|
}
|
|
20117
|
+
function cliPathOf(packageRoot) {
|
|
20118
|
+
const binSub = argentBinSubpath(packageRoot);
|
|
20119
|
+
if (!binSub) return null;
|
|
20120
|
+
const cli = path15.join(packageRoot, binSub);
|
|
20121
|
+
return fs14.existsSync(cli) ? cli : null;
|
|
20122
|
+
}
|
|
20123
|
+
function getGloballyInstalledLaunchPaths() {
|
|
20124
|
+
if (process.platform === "win32") return null;
|
|
20125
|
+
const binaryPath = getUnshadowedGlobalBinaryPath();
|
|
20126
|
+
if (!binaryPath) return null;
|
|
20127
|
+
const packageRoot = packageRootOf(binaryPath);
|
|
20128
|
+
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20129
|
+
if (!cli) return null;
|
|
20130
|
+
try {
|
|
20131
|
+
const node = path15.join(fs14.realpathSync(path15.dirname(binaryPath)), "node");
|
|
20132
|
+
return fs14.existsSync(node) ? { node, cli } : null;
|
|
20133
|
+
} catch {
|
|
20134
|
+
return null;
|
|
20135
|
+
}
|
|
20136
|
+
}
|
|
20174
20137
|
function getGloballyInstalledVersion() {
|
|
20175
20138
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20176
20139
|
if (!pkgRoot) return null;
|
|
@@ -20270,16 +20233,208 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20270
20233
|
return path15.relative(root, abs).split(path15.sep).join("/");
|
|
20271
20234
|
}
|
|
20272
20235
|
|
|
20236
|
+
// ../argent-installer/src/package-manager.ts
|
|
20237
|
+
function formatShellCommand(cmd) {
|
|
20238
|
+
const parts = [cmd.bin, ...cmd.args.map((a2) => a2.includes(" ") ? `"${a2}"` : a2)];
|
|
20239
|
+
return parts.join(" ");
|
|
20240
|
+
}
|
|
20241
|
+
function shellQuotePath(dir) {
|
|
20242
|
+
return "'" + dir.split("'").join("'\\''") + "'";
|
|
20243
|
+
}
|
|
20244
|
+
function detectPackageManager() {
|
|
20245
|
+
const agent = process.env.npm_config_user_agent ?? "";
|
|
20246
|
+
if (agent.startsWith("yarn")) return "yarn";
|
|
20247
|
+
if (agent.startsWith("pnpm")) return "pnpm";
|
|
20248
|
+
if (agent.startsWith("bun")) return "bun";
|
|
20249
|
+
return "npm";
|
|
20250
|
+
}
|
|
20251
|
+
var PNPM_GLOBAL_TARGET = new RegExp(
|
|
20252
|
+
String.raw`[\\/]global[\\/]v?\d+[\\/][^"'\s]*node_modules[\\/]` + PACKAGE_NAME.split("/").join(String.raw`[\\/]`) + String.raw`[\\/]`
|
|
20253
|
+
);
|
|
20254
|
+
var BUN_GLOBAL_ROOT = new RegExp(
|
|
20255
|
+
String.raw`[\\/]install[\\/]global[\\/]node_modules[\\/]` + PACKAGE_NAME.split("/").join(String.raw`[\\/]`) + "$"
|
|
20256
|
+
);
|
|
20257
|
+
function detectGlobalPackageManager() {
|
|
20258
|
+
const binaryPath = getRemainingGlobalBinaryPath();
|
|
20259
|
+
if (!binaryPath) return isYarnBerryLauncher() ? "npm" : detectPackageManager();
|
|
20260
|
+
const root = packageRootOf(binaryPath);
|
|
20261
|
+
if (root) {
|
|
20262
|
+
if (isInNpmLayout(binaryPath, root)) return "npm";
|
|
20263
|
+
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20264
|
+
}
|
|
20265
|
+
if (process.platform === "win32") {
|
|
20266
|
+
if (fs15.existsSync(path16.join(npmCopyBeside(path16.dirname(binaryPath)), "package.json"))) {
|
|
20267
|
+
return "npm";
|
|
20268
|
+
}
|
|
20269
|
+
if (fs15.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20270
|
+
}
|
|
20271
|
+
const shim = readShimScript(binaryPath);
|
|
20272
|
+
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
20273
|
+
if (PNPM_GLOBAL_TARGET.test(shim)) return "pnpm";
|
|
20274
|
+
const target = shimTargetOf(binaryPath);
|
|
20275
|
+
return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
|
|
20276
|
+
}
|
|
20277
|
+
function lockfileOwnerOf(root) {
|
|
20278
|
+
for (let dir = path16.dirname(root); path16.dirname(dir) !== dir; dir = path16.dirname(dir)) {
|
|
20279
|
+
const pm = pmFromLockfile(dir);
|
|
20280
|
+
if (pm) return pm;
|
|
20281
|
+
}
|
|
20282
|
+
return null;
|
|
20283
|
+
}
|
|
20284
|
+
function npmCopyBeside(binDir) {
|
|
20285
|
+
return process.platform === "win32" ? path16.join(binDir, "node_modules", PACKAGE_NAME) : path16.join(path16.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
|
|
20286
|
+
}
|
|
20287
|
+
function isInNpmLayout(binaryPath, root) {
|
|
20288
|
+
const realRoot = canonicalPath(root);
|
|
20289
|
+
let link = binaryPath;
|
|
20290
|
+
for (let hop = 0; hop < 40; hop++) {
|
|
20291
|
+
const binDir = canonicalPath(path16.dirname(link));
|
|
20292
|
+
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20293
|
+
try {
|
|
20294
|
+
link = path16.resolve(binDir, fs15.readlinkSync(link));
|
|
20295
|
+
} catch {
|
|
20296
|
+
return false;
|
|
20297
|
+
}
|
|
20298
|
+
}
|
|
20299
|
+
return false;
|
|
20300
|
+
}
|
|
20301
|
+
function isYarnBerryLauncher() {
|
|
20302
|
+
const agent = process.env.npm_config_user_agent ?? "";
|
|
20303
|
+
return agent.startsWith("yarn") && !agent.startsWith("yarn/1.");
|
|
20304
|
+
}
|
|
20305
|
+
function yarnClassicNote(cmd) {
|
|
20306
|
+
return cmd.bin === "yarn" && cmd.args[0] === "global" && isYarnBerryLauncher() ? " (with Yarn classic, outside this Yarn 2+ project)" : "";
|
|
20307
|
+
}
|
|
20308
|
+
function asKnownPm(name) {
|
|
20309
|
+
return name === "npm" || name === "yarn" || name === "pnpm" || name === "bun" ? name : null;
|
|
20310
|
+
}
|
|
20311
|
+
function pmFromPackageManagerField(dir) {
|
|
20312
|
+
try {
|
|
20313
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
|
|
20314
|
+
if (typeof pkg.packageManager === "string") {
|
|
20315
|
+
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20316
|
+
}
|
|
20317
|
+
return null;
|
|
20318
|
+
} catch {
|
|
20319
|
+
return null;
|
|
20320
|
+
}
|
|
20321
|
+
}
|
|
20322
|
+
function pmFromDevEngines(dir) {
|
|
20323
|
+
try {
|
|
20324
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(dir, "package.json"), "utf8"));
|
|
20325
|
+
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20326
|
+
const names = /* @__PURE__ */ new Set();
|
|
20327
|
+
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
20328
|
+
const name = asKnownPm(entry?.name);
|
|
20329
|
+
if (name) names.add(name);
|
|
20330
|
+
}
|
|
20331
|
+
return names.size === 1 ? [...names][0] : null;
|
|
20332
|
+
} catch {
|
|
20333
|
+
return null;
|
|
20334
|
+
}
|
|
20335
|
+
}
|
|
20336
|
+
function pmFromLockfile(dir) {
|
|
20337
|
+
const has = (file) => fs15.existsSync(path16.join(dir, file));
|
|
20338
|
+
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20339
|
+
if (has("yarn.lock")) return "yarn";
|
|
20340
|
+
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
20341
|
+
if (has("package-lock.json") || has("npm-shrinkwrap.json")) return "npm";
|
|
20342
|
+
return null;
|
|
20343
|
+
}
|
|
20344
|
+
function pmFromWorkspaceMarker(dir) {
|
|
20345
|
+
return fs15.existsSync(path16.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20346
|
+
}
|
|
20347
|
+
function detectProjectPackageManager(projectRoot) {
|
|
20348
|
+
let dir = path16.resolve(projectRoot);
|
|
20349
|
+
for (; ; ) {
|
|
20350
|
+
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20351
|
+
if (pm) return pm;
|
|
20352
|
+
if (fs15.existsSync(path16.join(dir, ".git"))) break;
|
|
20353
|
+
const parent = path16.dirname(dir);
|
|
20354
|
+
if (parent === dir) break;
|
|
20355
|
+
dir = parent;
|
|
20356
|
+
}
|
|
20357
|
+
return detectPackageManager();
|
|
20358
|
+
}
|
|
20359
|
+
function globalInstallCommand(pm, pkg) {
|
|
20360
|
+
switch (pm) {
|
|
20361
|
+
case "yarn":
|
|
20362
|
+
return { bin: "yarn", args: ["global", "add", pkg] };
|
|
20363
|
+
case "pnpm":
|
|
20364
|
+
return { bin: "pnpm", args: ["add", "-g", pkg] };
|
|
20365
|
+
case "bun":
|
|
20366
|
+
return { bin: "bun", args: ["add", "-g", pkg] };
|
|
20367
|
+
default:
|
|
20368
|
+
return { bin: "npm", args: ["install", "-g", pkg] };
|
|
20369
|
+
}
|
|
20370
|
+
}
|
|
20371
|
+
function globalCommandOptions(pm) {
|
|
20372
|
+
if (pm === "npm") return {};
|
|
20373
|
+
const home = os2.homedir();
|
|
20374
|
+
const cwd = fs15.existsSync(home) ? { cwd: home } : {};
|
|
20375
|
+
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20376
|
+
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20377
|
+
return { ...cwd, env };
|
|
20378
|
+
}
|
|
20379
|
+
function globalUninstallCommand(pm, pkg) {
|
|
20380
|
+
switch (pm) {
|
|
20381
|
+
case "yarn":
|
|
20382
|
+
return { bin: "yarn", args: ["global", "remove", pkg] };
|
|
20383
|
+
case "pnpm":
|
|
20384
|
+
return { bin: "pnpm", args: ["remove", "-g", pkg] };
|
|
20385
|
+
case "bun":
|
|
20386
|
+
return { bin: "bun", args: ["remove", "-g", pkg] };
|
|
20387
|
+
default:
|
|
20388
|
+
return { bin: "npm", args: ["uninstall", "-g", pkg] };
|
|
20389
|
+
}
|
|
20390
|
+
}
|
|
20391
|
+
function localInstallCommand(pm, pkg) {
|
|
20392
|
+
switch (pm) {
|
|
20393
|
+
case "yarn":
|
|
20394
|
+
return { bin: "yarn", args: ["add", "--dev", pkg] };
|
|
20395
|
+
case "pnpm":
|
|
20396
|
+
return { bin: "pnpm", args: ["add", "-D", "--ignore-workspace-root-check", pkg] };
|
|
20397
|
+
case "bun":
|
|
20398
|
+
return { bin: "bun", args: ["add", "-d", pkg] };
|
|
20399
|
+
default:
|
|
20400
|
+
return { bin: "npm", args: ["install", "--save-dev", pkg] };
|
|
20401
|
+
}
|
|
20402
|
+
}
|
|
20403
|
+
function projectInstallCommand(pm) {
|
|
20404
|
+
switch (pm) {
|
|
20405
|
+
case "yarn":
|
|
20406
|
+
return { bin: "yarn", args: ["install"] };
|
|
20407
|
+
case "pnpm":
|
|
20408
|
+
return { bin: "pnpm", args: ["install"] };
|
|
20409
|
+
case "bun":
|
|
20410
|
+
return { bin: "bun", args: ["install"] };
|
|
20411
|
+
default:
|
|
20412
|
+
return { bin: "npm", args: ["install"] };
|
|
20413
|
+
}
|
|
20414
|
+
}
|
|
20415
|
+
function localUninstallCommand(pm, pkg) {
|
|
20416
|
+
switch (pm) {
|
|
20417
|
+
case "yarn":
|
|
20418
|
+
return { bin: "yarn", args: ["remove", pkg] };
|
|
20419
|
+
case "pnpm":
|
|
20420
|
+
return { bin: "pnpm", args: ["remove", pkg] };
|
|
20421
|
+
case "bun":
|
|
20422
|
+
return { bin: "bun", args: ["remove", pkg] };
|
|
20423
|
+
default:
|
|
20424
|
+
return { bin: "npm", args: ["uninstall", pkg] };
|
|
20425
|
+
}
|
|
20426
|
+
}
|
|
20427
|
+
|
|
20273
20428
|
// ../argent-installer/src/install-record.ts
|
|
20274
|
-
import * as
|
|
20275
|
-
import * as
|
|
20429
|
+
import * as fs16 from "node:fs";
|
|
20430
|
+
import * as path17 from "node:path";
|
|
20276
20431
|
function getInstallRecordPath(projectRoot) {
|
|
20277
|
-
return
|
|
20432
|
+
return path17.join(projectRoot, ".argent", "install.json");
|
|
20278
20433
|
}
|
|
20279
20434
|
function readInstallRecord(projectRoot) {
|
|
20280
20435
|
try {
|
|
20281
20436
|
const parsed = JSON.parse(
|
|
20282
|
-
|
|
20437
|
+
fs16.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20283
20438
|
);
|
|
20284
20439
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20285
20440
|
return null;
|
|
@@ -20289,17 +20444,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20289
20444
|
}
|
|
20290
20445
|
function writeInstallRecord(projectRoot, record) {
|
|
20291
20446
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20292
|
-
|
|
20293
|
-
|
|
20447
|
+
fs16.mkdirSync(path17.dirname(recordPath), { recursive: true });
|
|
20448
|
+
fs16.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20294
20449
|
}
|
|
20295
20450
|
function removeInstallRecord(projectRoot) {
|
|
20296
20451
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20297
20452
|
try {
|
|
20298
|
-
if (!
|
|
20299
|
-
|
|
20300
|
-
const dir =
|
|
20453
|
+
if (!fs16.existsSync(recordPath)) return false;
|
|
20454
|
+
fs16.rmSync(recordPath, { force: true });
|
|
20455
|
+
const dir = path17.dirname(recordPath);
|
|
20301
20456
|
try {
|
|
20302
|
-
if (
|
|
20457
|
+
if (fs16.existsSync(dir) && fs16.readdirSync(dir).length === 0) fs16.rmdirSync(dir);
|
|
20303
20458
|
} catch {
|
|
20304
20459
|
}
|
|
20305
20460
|
return true;
|
|
@@ -20327,9 +20482,9 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20327
20482
|
// ../argent-installer/src/utils.ts
|
|
20328
20483
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20329
20484
|
function resolveBundledDir(dirName) {
|
|
20330
|
-
const packagedDir =
|
|
20331
|
-
if (
|
|
20332
|
-
return
|
|
20485
|
+
const packagedDir = path18.join(PACKAGE_ROOT, dirName);
|
|
20486
|
+
if (fs17.existsSync(packagedDir)) return packagedDir;
|
|
20487
|
+
return path18.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20333
20488
|
}
|
|
20334
20489
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20335
20490
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20341,18 +20496,18 @@ function buildArgentSkillsSource(version) {
|
|
|
20341
20496
|
}
|
|
20342
20497
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20343
20498
|
try {
|
|
20344
|
-
return
|
|
20499
|
+
return fs17.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs17.existsSync(path18.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20345
20500
|
} catch {
|
|
20346
20501
|
return [];
|
|
20347
20502
|
}
|
|
20348
20503
|
}
|
|
20349
20504
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20350
|
-
return
|
|
20505
|
+
return path18.join(cwd, "skills-lock.json");
|
|
20351
20506
|
}
|
|
20352
20507
|
function getGlobalSkillLockPath() {
|
|
20353
20508
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20354
|
-
if (xdgStateHome) return
|
|
20355
|
-
return
|
|
20509
|
+
if (xdgStateHome) return path18.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20510
|
+
return path18.join(os3.homedir(), ".agents", ".skill-lock.json");
|
|
20356
20511
|
}
|
|
20357
20512
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20358
20513
|
var LEGACY_ARGENT_SKILL_NAMES = [
|
|
@@ -20458,7 +20613,7 @@ function hashBundledContent(content) {
|
|
|
20458
20613
|
}
|
|
20459
20614
|
function listArgentSkillsInLock(lockPath) {
|
|
20460
20615
|
try {
|
|
20461
|
-
const raw =
|
|
20616
|
+
const raw = fs17.readFileSync(lockPath, "utf8");
|
|
20462
20617
|
const lock = JSON.parse(raw);
|
|
20463
20618
|
const tracked = lock.skills ?? {};
|
|
20464
20619
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20481,21 +20636,21 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20481
20636
|
"opencode.jsonc",
|
|
20482
20637
|
"skills-lock.json"
|
|
20483
20638
|
];
|
|
20484
|
-
function resolveProjectRoot2(startDir, homeDir =
|
|
20485
|
-
const initialDir =
|
|
20486
|
-
const home =
|
|
20639
|
+
function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
20640
|
+
const initialDir = path18.resolve(startDir);
|
|
20641
|
+
const home = canonicalPath(homeDir);
|
|
20487
20642
|
let currentDir = initialDir;
|
|
20488
20643
|
while (true) {
|
|
20489
|
-
if (currentDir
|
|
20644
|
+
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20490
20645
|
return initialDir;
|
|
20491
20646
|
}
|
|
20492
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20647
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs17.existsSync(path18.join(currentDir, marker)))) {
|
|
20493
20648
|
return currentDir;
|
|
20494
20649
|
}
|
|
20495
|
-
if (
|
|
20650
|
+
if (fs17.existsSync(path18.join(currentDir, ".git"))) {
|
|
20496
20651
|
return currentDir;
|
|
20497
20652
|
}
|
|
20498
|
-
const parentDir =
|
|
20653
|
+
const parentDir = path18.dirname(currentDir);
|
|
20499
20654
|
if (parentDir === currentDir) {
|
|
20500
20655
|
return initialDir;
|
|
20501
20656
|
}
|
|
@@ -20503,20 +20658,20 @@ function resolveProjectRoot2(startDir, homeDir = os2.homedir()) {
|
|
|
20503
20658
|
}
|
|
20504
20659
|
}
|
|
20505
20660
|
function readToml(filePath) {
|
|
20506
|
-
if (!
|
|
20661
|
+
if (!fs17.existsSync(filePath)) return {};
|
|
20507
20662
|
try {
|
|
20508
|
-
return parse(
|
|
20663
|
+
return parse(fs17.readFileSync(filePath, "utf8"));
|
|
20509
20664
|
} catch {
|
|
20510
20665
|
return {};
|
|
20511
20666
|
}
|
|
20512
20667
|
}
|
|
20513
20668
|
function writeToml(filePath, data) {
|
|
20514
|
-
|
|
20515
|
-
|
|
20669
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20670
|
+
fs17.writeFileSync(filePath, stringify(data) + "\n");
|
|
20516
20671
|
}
|
|
20517
20672
|
function readYaml(filePath) {
|
|
20518
|
-
if (!
|
|
20519
|
-
const text2 =
|
|
20673
|
+
if (!fs17.existsSync(filePath)) return new import_yaml.Document({});
|
|
20674
|
+
const text2 = fs17.readFileSync(filePath, "utf8");
|
|
20520
20675
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20521
20676
|
if (doc.errors.length > 0) {
|
|
20522
20677
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20525,20 +20680,20 @@ function readYaml(filePath) {
|
|
|
20525
20680
|
return doc;
|
|
20526
20681
|
}
|
|
20527
20682
|
function writeYaml(filePath, doc) {
|
|
20528
|
-
|
|
20529
|
-
|
|
20683
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20684
|
+
fs17.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20530
20685
|
}
|
|
20531
20686
|
function readJson(filePath) {
|
|
20532
|
-
if (!
|
|
20687
|
+
if (!fs17.existsSync(filePath)) return {};
|
|
20533
20688
|
try {
|
|
20534
|
-
return JSON.parse(
|
|
20689
|
+
return JSON.parse(fs17.readFileSync(filePath, "utf8"));
|
|
20535
20690
|
} catch {
|
|
20536
20691
|
return {};
|
|
20537
20692
|
}
|
|
20538
20693
|
}
|
|
20539
20694
|
function writeJson(filePath, data) {
|
|
20540
|
-
|
|
20541
|
-
|
|
20695
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20696
|
+
fs17.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20542
20697
|
}
|
|
20543
20698
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20544
20699
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20546,8 +20701,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20546
20701
|
return applyEdits(text2, edits);
|
|
20547
20702
|
}
|
|
20548
20703
|
function readJsoncFileRaw(filePath) {
|
|
20549
|
-
if (!
|
|
20550
|
-
let text2 =
|
|
20704
|
+
if (!fs17.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20705
|
+
let text2 = fs17.readFileSync(filePath, "utf8");
|
|
20551
20706
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20552
20707
|
if (hadBom) text2 = text2.slice(1);
|
|
20553
20708
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20566,26 +20721,26 @@ function isEmptyPlainObject(value) {
|
|
|
20566
20721
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20567
20722
|
}
|
|
20568
20723
|
function removePath(targetPath) {
|
|
20569
|
-
const entry =
|
|
20724
|
+
const entry = fs17.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20570
20725
|
if (!entry) return false;
|
|
20571
|
-
if (entry.isSymbolicLink())
|
|
20572
|
-
else
|
|
20726
|
+
if (entry.isSymbolicLink()) fs17.unlinkSync(targetPath);
|
|
20727
|
+
else fs17.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20573
20728
|
return true;
|
|
20574
20729
|
}
|
|
20575
20730
|
function rmEmptyDir(dirPath) {
|
|
20576
20731
|
try {
|
|
20577
|
-
if (!
|
|
20578
|
-
if (!
|
|
20579
|
-
if (
|
|
20580
|
-
|
|
20732
|
+
if (!fs17.existsSync(dirPath)) return false;
|
|
20733
|
+
if (!fs17.statSync(dirPath).isDirectory()) return false;
|
|
20734
|
+
if (fs17.readdirSync(dirPath).length > 0) return false;
|
|
20735
|
+
fs17.rmdirSync(dirPath);
|
|
20581
20736
|
return true;
|
|
20582
20737
|
} catch {
|
|
20583
20738
|
return false;
|
|
20584
20739
|
}
|
|
20585
20740
|
}
|
|
20586
20741
|
function readJsonc(filePath) {
|
|
20587
|
-
if (!
|
|
20588
|
-
let raw =
|
|
20742
|
+
if (!fs17.existsSync(filePath)) return {};
|
|
20743
|
+
let raw = fs17.readFileSync(filePath, "utf8");
|
|
20589
20744
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20590
20745
|
if (raw.trim() === "") return {};
|
|
20591
20746
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20604,18 +20759,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20604
20759
|
}
|
|
20605
20760
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20606
20761
|
if (isEmptyPlainObject(parsed)) {
|
|
20607
|
-
|
|
20608
|
-
rmEmptyDir(
|
|
20762
|
+
fs17.rmSync(filePath, { force: true });
|
|
20763
|
+
rmEmptyDir(path18.dirname(filePath));
|
|
20609
20764
|
return;
|
|
20610
20765
|
}
|
|
20611
|
-
|
|
20766
|
+
fs17.mkdirSync(path18.dirname(filePath), { recursive: true });
|
|
20612
20767
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20613
|
-
|
|
20768
|
+
fs17.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20614
20769
|
}
|
|
20615
20770
|
var MAX_SYMLINK_HOPS = 40;
|
|
20616
20771
|
function realpathOrSelf(p) {
|
|
20617
20772
|
try {
|
|
20618
|
-
return
|
|
20773
|
+
return fs17.realpathSync(p);
|
|
20619
20774
|
} catch {
|
|
20620
20775
|
return p;
|
|
20621
20776
|
}
|
|
@@ -20625,13 +20780,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20625
20780
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20626
20781
|
let entry;
|
|
20627
20782
|
try {
|
|
20628
|
-
entry =
|
|
20783
|
+
entry = fs17.lstatSync(current);
|
|
20629
20784
|
} catch {
|
|
20630
|
-
return current === dest || dirExists(
|
|
20785
|
+
return current === dest || dirExists(path18.dirname(current)) ? current : dest;
|
|
20631
20786
|
}
|
|
20632
20787
|
if (!entry.isSymbolicLink()) return current;
|
|
20633
20788
|
try {
|
|
20634
|
-
current =
|
|
20789
|
+
current = path18.resolve(realpathOrSelf(path18.dirname(current)), fs17.readlinkSync(current));
|
|
20635
20790
|
} catch {
|
|
20636
20791
|
return dest;
|
|
20637
20792
|
}
|
|
@@ -20639,30 +20794,30 @@ function resolveLinkedDestination(dest) {
|
|
|
20639
20794
|
return dest;
|
|
20640
20795
|
}
|
|
20641
20796
|
function copyDir(src, dest) {
|
|
20642
|
-
if (!
|
|
20797
|
+
if (!fs17.existsSync(src) || !treeHasFiles(src)) return null;
|
|
20643
20798
|
const target = resolveLinkedDestination(dest);
|
|
20644
20799
|
copyTree(src, target);
|
|
20645
20800
|
return target;
|
|
20646
20801
|
}
|
|
20647
20802
|
function treeHasFiles(dir) {
|
|
20648
|
-
return
|
|
20803
|
+
return fs17.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path18.join(dir, entry.name)));
|
|
20649
20804
|
}
|
|
20650
20805
|
function copyTree(src, dest) {
|
|
20651
|
-
const entries =
|
|
20652
|
-
|
|
20806
|
+
const entries = fs17.readdirSync(src, { withFileTypes: true });
|
|
20807
|
+
fs17.mkdirSync(dest, { recursive: true });
|
|
20653
20808
|
for (const entry of entries) {
|
|
20654
|
-
const from =
|
|
20655
|
-
const to = resolveLinkedDestination(
|
|
20809
|
+
const from = path18.join(src, entry.name);
|
|
20810
|
+
const to = resolveLinkedDestination(path18.join(dest, entry.name));
|
|
20656
20811
|
if (entry.isDirectory()) copyTree(from, to);
|
|
20657
|
-
else
|
|
20812
|
+
else fs17.copyFileSync(from, to);
|
|
20658
20813
|
}
|
|
20659
20814
|
}
|
|
20660
20815
|
function readRetiredFile(targetDir, relativePath) {
|
|
20661
|
-
const entryPath =
|
|
20816
|
+
const entryPath = path18.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
20662
20817
|
const file = resolveLinkedDestination(entryPath);
|
|
20663
20818
|
try {
|
|
20664
|
-
if (!
|
|
20665
|
-
return
|
|
20819
|
+
if (!fs17.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
20820
|
+
return fs17.readFileSync(file, "utf8");
|
|
20666
20821
|
} catch {
|
|
20667
20822
|
return null;
|
|
20668
20823
|
}
|
|
@@ -20670,7 +20825,7 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
20670
20825
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
20671
20826
|
const found = [];
|
|
20672
20827
|
for (const { path: relativePath, shipped } of retired) {
|
|
20673
|
-
if (bundleDir !== null &&
|
|
20828
|
+
if (bundleDir !== null && fs17.existsSync(path18.join(bundleDir, ...relativePath.split("/"))))
|
|
20674
20829
|
continue;
|
|
20675
20830
|
const content = readRetiredFile(targetDir, relativePath);
|
|
20676
20831
|
if (content === null) continue;
|
|
@@ -20686,17 +20841,17 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
20686
20841
|
const content = readRetiredFile(targetDir, relativePath);
|
|
20687
20842
|
if (content === null || hashBundledContent(content) !== sha256) continue;
|
|
20688
20843
|
const segments = relativePath.split("/");
|
|
20689
|
-
const entryPath =
|
|
20844
|
+
const entryPath = path18.join(dir, ...segments);
|
|
20690
20845
|
const file = resolveLinkedDestination(entryPath);
|
|
20691
20846
|
try {
|
|
20692
|
-
|
|
20847
|
+
fs17.rmSync(file);
|
|
20693
20848
|
if (file !== entryPath) removePath(entryPath);
|
|
20694
20849
|
removedPaths.push(relativePath);
|
|
20695
20850
|
} catch {
|
|
20696
20851
|
continue;
|
|
20697
20852
|
}
|
|
20698
20853
|
for (let depth = segments.length - 1; depth > 0; depth--) {
|
|
20699
|
-
if (!rmEmptyDir(
|
|
20854
|
+
if (!rmEmptyDir(path18.join(dir, ...segments.slice(0, depth)))) break;
|
|
20700
20855
|
}
|
|
20701
20856
|
}
|
|
20702
20857
|
const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
|
|
@@ -20704,15 +20859,15 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
20704
20859
|
}
|
|
20705
20860
|
function dirExists(p) {
|
|
20706
20861
|
try {
|
|
20707
|
-
return
|
|
20862
|
+
return fs17.statSync(p).isDirectory();
|
|
20708
20863
|
} catch {
|
|
20709
20864
|
return false;
|
|
20710
20865
|
}
|
|
20711
20866
|
}
|
|
20712
20867
|
function getInstalledVersion() {
|
|
20713
20868
|
try {
|
|
20714
|
-
const pkgPath =
|
|
20715
|
-
const pkg = JSON.parse(
|
|
20869
|
+
const pkgPath = path18.join(PACKAGE_ROOT, "package.json");
|
|
20870
|
+
const pkg = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
|
|
20716
20871
|
return pkg.version ?? null;
|
|
20717
20872
|
} catch {
|
|
20718
20873
|
return null;
|
|
@@ -20770,12 +20925,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
20770
20925
|
} catch {
|
|
20771
20926
|
return false;
|
|
20772
20927
|
}
|
|
20773
|
-
return new Promise((
|
|
20774
|
-
const timer = setTimeout(() =>
|
|
20928
|
+
return new Promise((resolve21) => {
|
|
20929
|
+
const timer = setTimeout(() => resolve21(false), timeoutMs);
|
|
20775
20930
|
timer.unref();
|
|
20776
20931
|
dns.lookup(host, (err) => {
|
|
20777
20932
|
clearTimeout(timer);
|
|
20778
|
-
|
|
20933
|
+
resolve21(!err);
|
|
20779
20934
|
});
|
|
20780
20935
|
});
|
|
20781
20936
|
}
|
|
@@ -20783,7 +20938,7 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
20783
20938
|
// ../argent-installer/src/mcp-configs.ts
|
|
20784
20939
|
var import_yaml2 = __toESM(require_dist2(), 1);
|
|
20785
20940
|
|
|
20786
|
-
//
|
|
20941
|
+
// ../../node_modules/escape-string-regexp/index.js
|
|
20787
20942
|
function escapeStringRegexp(string) {
|
|
20788
20943
|
if (typeof string !== "string") {
|
|
20789
20944
|
throw new TypeError("Expected a string");
|
|
@@ -20792,12 +20947,27 @@ function escapeStringRegexp(string) {
|
|
|
20792
20947
|
}
|
|
20793
20948
|
|
|
20794
20949
|
// ../argent-installer/src/mcp-configs.ts
|
|
20795
|
-
var TOOL_SERVER_BUNDLE =
|
|
20950
|
+
var TOOL_SERVER_BUNDLE = path19.join(import.meta.dirname, "tool-server.cjs");
|
|
20796
20951
|
function getAvailableToolIds() {
|
|
20797
20952
|
const out = execFileSync4("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
20798
20953
|
const tools = JSON.parse(out);
|
|
20799
20954
|
return tools.map((t2) => t2.id);
|
|
20800
20955
|
}
|
|
20956
|
+
function existingEntryKeys(configPath, serversKey, keys) {
|
|
20957
|
+
let entry;
|
|
20958
|
+
try {
|
|
20959
|
+
entry = readJsonc(configPath)[serversKey]?.[MCP_SERVER_KEY];
|
|
20960
|
+
} catch {
|
|
20961
|
+
return {};
|
|
20962
|
+
}
|
|
20963
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return {};
|
|
20964
|
+
const kept = {};
|
|
20965
|
+
for (const key of keys) {
|
|
20966
|
+
const value = entry[key];
|
|
20967
|
+
if (value !== void 0) kept[key] = value;
|
|
20968
|
+
}
|
|
20969
|
+
return kept;
|
|
20970
|
+
}
|
|
20801
20971
|
function buildMcpEntry(mode = { kind: "global" }) {
|
|
20802
20972
|
switch (mode.kind) {
|
|
20803
20973
|
case "local-node":
|
|
@@ -20806,6 +20976,8 @@ function buildMcpEntry(mode = { kind: "global" }) {
|
|
|
20806
20976
|
return { command: "yarn", args: ["argent", "mcp"] };
|
|
20807
20977
|
case "local-npx":
|
|
20808
20978
|
return { command: "npx", args: ["--no-install", "argent", "mcp"] };
|
|
20979
|
+
case "global-pinned":
|
|
20980
|
+
return { command: mode.node, args: [mode.cli, "mcp"] };
|
|
20809
20981
|
default:
|
|
20810
20982
|
return { command: MCP_BINARY_NAME, args: ["mcp"] };
|
|
20811
20983
|
}
|
|
@@ -20819,8 +20991,15 @@ function resolveLocalCommandMode(root) {
|
|
|
20819
20991
|
if (binRelPath) return { kind: "local-node", binRelPath };
|
|
20820
20992
|
return { kind: "local-npx" };
|
|
20821
20993
|
}
|
|
20822
|
-
function
|
|
20823
|
-
|
|
20994
|
+
function resolveGlobalCommandMode() {
|
|
20995
|
+
const launch = getGloballyInstalledLaunchPaths();
|
|
20996
|
+
return launch ? { kind: "global-pinned", ...launch } : { kind: "global" };
|
|
20997
|
+
}
|
|
20998
|
+
function getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode) {
|
|
20999
|
+
if (installMode === "local" && configScope === "local" && localCmdMode) {
|
|
21000
|
+
return getMcpEntry(localCmdMode);
|
|
21001
|
+
}
|
|
21002
|
+
return getMcpEntry(configScope === "global" ? globalCmdMode : { kind: "global" });
|
|
20824
21003
|
}
|
|
20825
21004
|
function hasEnv(entry) {
|
|
20826
21005
|
return entry.env != null && Object.keys(entry.env).length > 0;
|
|
@@ -20831,10 +21010,10 @@ function hasCustomizingEnv(entry) {
|
|
|
20831
21010
|
}
|
|
20832
21011
|
function removeDirIfEmpty(dirPath) {
|
|
20833
21012
|
try {
|
|
20834
|
-
if (!
|
|
20835
|
-
if (!
|
|
20836
|
-
if (
|
|
20837
|
-
|
|
21013
|
+
if (!fs18.existsSync(dirPath)) return;
|
|
21014
|
+
if (!fs18.statSync(dirPath).isDirectory()) return;
|
|
21015
|
+
if (fs18.readdirSync(dirPath).length > 0) return;
|
|
21016
|
+
fs18.rmdirSync(dirPath);
|
|
20838
21017
|
} catch {
|
|
20839
21018
|
}
|
|
20840
21019
|
}
|
|
@@ -20865,13 +21044,14 @@ function normalizeServerEntry(raw) {
|
|
|
20865
21044
|
}
|
|
20866
21045
|
function isArgentManagedEntry(entry) {
|
|
20867
21046
|
if (entry === null || hasCustomizingEnv(entry)) return false;
|
|
21047
|
+
if (isPinnedGlobalEntry(entry)) return true;
|
|
20868
21048
|
const { command, args } = entry;
|
|
20869
21049
|
switch (command) {
|
|
20870
21050
|
case MCP_BINARY_NAME:
|
|
20871
21051
|
return args.length === 1 && args[0] === "mcp";
|
|
20872
21052
|
case "node": {
|
|
20873
21053
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
20874
|
-
if (
|
|
21054
|
+
if (path19.isAbsolute(args[0])) return false;
|
|
20875
21055
|
const normalized = args[0].split("\\").join("/");
|
|
20876
21056
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
20877
21057
|
}
|
|
@@ -20883,10 +21063,14 @@ function isArgentManagedEntry(entry) {
|
|
|
20883
21063
|
return false;
|
|
20884
21064
|
}
|
|
20885
21065
|
}
|
|
21066
|
+
function isPinnedGlobalEntry(entry) {
|
|
21067
|
+
const [cli, subcommand] = entry.args;
|
|
21068
|
+
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}/`);
|
|
21069
|
+
}
|
|
20886
21070
|
function writeTomlOrRemove(filePath, data) {
|
|
20887
21071
|
if (Object.keys(data).length === 0) {
|
|
20888
|
-
|
|
20889
|
-
removeDirIfEmpty(
|
|
21072
|
+
fs18.rmSync(filePath, { force: true });
|
|
21073
|
+
removeDirIfEmpty(path19.dirname(filePath));
|
|
20890
21074
|
return;
|
|
20891
21075
|
}
|
|
20892
21076
|
writeToml(filePath, data);
|
|
@@ -20895,12 +21079,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
20895
21079
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
20896
21080
|
}
|
|
20897
21081
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
20898
|
-
return
|
|
21082
|
+
return fs18.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
20899
21083
|
}
|
|
20900
21084
|
function parseJsoncStrict(filePath) {
|
|
20901
21085
|
let raw;
|
|
20902
21086
|
try {
|
|
20903
|
-
raw =
|
|
21087
|
+
raw = fs18.readFileSync(filePath, "utf8");
|
|
20904
21088
|
} catch {
|
|
20905
21089
|
return null;
|
|
20906
21090
|
}
|
|
@@ -20913,14 +21097,14 @@ function parseJsoncStrict(filePath) {
|
|
|
20913
21097
|
}
|
|
20914
21098
|
function parseTomlStrict(filePath) {
|
|
20915
21099
|
try {
|
|
20916
|
-
return parse(
|
|
21100
|
+
return parse(fs18.readFileSync(filePath, "utf8"));
|
|
20917
21101
|
} catch {
|
|
20918
21102
|
return null;
|
|
20919
21103
|
}
|
|
20920
21104
|
}
|
|
20921
21105
|
function parseYamlStrict(filePath) {
|
|
20922
21106
|
try {
|
|
20923
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21107
|
+
const parsed = (0, import_yaml2.parse)(fs18.readFileSync(filePath, "utf8"));
|
|
20924
21108
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
20925
21109
|
return parsed;
|
|
20926
21110
|
} catch {
|
|
@@ -20943,7 +21127,7 @@ function bundledManagedNames(kind) {
|
|
|
20943
21127
|
if (cached2) return cached2;
|
|
20944
21128
|
let names;
|
|
20945
21129
|
try {
|
|
20946
|
-
names = new Set(
|
|
21130
|
+
names = new Set(fs18.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
20947
21131
|
} catch {
|
|
20948
21132
|
names = /* @__PURE__ */ new Set();
|
|
20949
21133
|
}
|
|
@@ -20954,7 +21138,7 @@ function bundledManagedNames(kind) {
|
|
|
20954
21138
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
20955
21139
|
let entries;
|
|
20956
21140
|
try {
|
|
20957
|
-
entries =
|
|
21141
|
+
entries = fs18.readdirSync(dir);
|
|
20958
21142
|
} catch {
|
|
20959
21143
|
return false;
|
|
20960
21144
|
}
|
|
@@ -20966,13 +21150,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
20966
21150
|
function cursorDirLooksArgentOnly(dir) {
|
|
20967
21151
|
let entries;
|
|
20968
21152
|
try {
|
|
20969
|
-
entries =
|
|
21153
|
+
entries = fs18.readdirSync(dir);
|
|
20970
21154
|
} catch {
|
|
20971
21155
|
return false;
|
|
20972
21156
|
}
|
|
20973
21157
|
if (entries.length === 0) return false;
|
|
20974
21158
|
return entries.every((entry) => {
|
|
20975
|
-
const full =
|
|
21159
|
+
const full = path19.join(dir, entry);
|
|
20976
21160
|
if (entry === "mcp.json") {
|
|
20977
21161
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
20978
21162
|
}
|
|
@@ -21005,13 +21189,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
21005
21189
|
function claudeDirLooksArgentOnly(dir) {
|
|
21006
21190
|
let entries;
|
|
21007
21191
|
try {
|
|
21008
|
-
entries =
|
|
21192
|
+
entries = fs18.readdirSync(dir);
|
|
21009
21193
|
} catch {
|
|
21010
21194
|
return false;
|
|
21011
21195
|
}
|
|
21012
21196
|
if (entries.length === 0) return false;
|
|
21013
21197
|
return entries.every((entry) => {
|
|
21014
|
-
const full =
|
|
21198
|
+
const full = path19.join(dir, entry);
|
|
21015
21199
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
21016
21200
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
21017
21201
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -21022,25 +21206,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
21022
21206
|
function vscodeDirLooksArgentOnly(dir) {
|
|
21023
21207
|
let entries;
|
|
21024
21208
|
try {
|
|
21025
|
-
entries =
|
|
21209
|
+
entries = fs18.readdirSync(dir);
|
|
21026
21210
|
} catch {
|
|
21027
21211
|
return false;
|
|
21028
21212
|
}
|
|
21029
21213
|
if (entries.length === 0) return false;
|
|
21030
21214
|
return entries.every(
|
|
21031
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21215
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "servers")
|
|
21032
21216
|
);
|
|
21033
21217
|
}
|
|
21034
21218
|
function windsurfDirLooksArgentOnly(dir) {
|
|
21035
21219
|
let entries;
|
|
21036
21220
|
try {
|
|
21037
|
-
entries =
|
|
21221
|
+
entries = fs18.readdirSync(dir);
|
|
21038
21222
|
} catch {
|
|
21039
21223
|
return false;
|
|
21040
21224
|
}
|
|
21041
21225
|
if (entries.length === 0) return false;
|
|
21042
21226
|
return entries.every(
|
|
21043
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21227
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path19.join(dir, entry), "mcpServers")
|
|
21044
21228
|
);
|
|
21045
21229
|
}
|
|
21046
21230
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -21071,25 +21255,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21071
21255
|
function zedDirLooksArgentOnly(dir) {
|
|
21072
21256
|
let entries;
|
|
21073
21257
|
try {
|
|
21074
|
-
entries =
|
|
21258
|
+
entries = fs18.readdirSync(dir);
|
|
21075
21259
|
} catch {
|
|
21076
21260
|
return false;
|
|
21077
21261
|
}
|
|
21078
21262
|
if (entries.length === 0) return false;
|
|
21079
21263
|
return entries.every(
|
|
21080
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21264
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path19.join(dir, entry))
|
|
21081
21265
|
);
|
|
21082
21266
|
}
|
|
21083
21267
|
function geminiDirLooksArgentOnly(dir) {
|
|
21084
21268
|
let entries;
|
|
21085
21269
|
try {
|
|
21086
|
-
entries =
|
|
21270
|
+
entries = fs18.readdirSync(dir);
|
|
21087
21271
|
} catch {
|
|
21088
21272
|
return false;
|
|
21089
21273
|
}
|
|
21090
21274
|
if (entries.length === 0) return false;
|
|
21091
21275
|
return entries.every((entry) => {
|
|
21092
|
-
const full =
|
|
21276
|
+
const full = path19.join(dir, entry);
|
|
21093
21277
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21094
21278
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21095
21279
|
return false;
|
|
@@ -21108,48 +21292,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21108
21292
|
function hermesDirLooksArgentOnly(dir) {
|
|
21109
21293
|
let entries;
|
|
21110
21294
|
try {
|
|
21111
|
-
entries =
|
|
21295
|
+
entries = fs18.readdirSync(dir);
|
|
21112
21296
|
} catch {
|
|
21113
21297
|
return false;
|
|
21114
21298
|
}
|
|
21115
21299
|
if (entries.length === 0) return false;
|
|
21116
21300
|
return entries.every(
|
|
21117
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21301
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path19.join(dir, entry))
|
|
21118
21302
|
);
|
|
21119
21303
|
}
|
|
21120
21304
|
function kiroDirLooksArgentOnly(dir) {
|
|
21121
21305
|
let entries;
|
|
21122
21306
|
try {
|
|
21123
|
-
entries =
|
|
21307
|
+
entries = fs18.readdirSync(dir);
|
|
21124
21308
|
} catch {
|
|
21125
21309
|
return false;
|
|
21126
21310
|
}
|
|
21127
21311
|
if (entries.length === 0) return false;
|
|
21128
21312
|
return entries.every((entry) => {
|
|
21129
21313
|
if (entry !== "settings") return false;
|
|
21130
|
-
const settingsDir =
|
|
21314
|
+
const settingsDir = path19.join(dir, entry);
|
|
21131
21315
|
let settingsEntries;
|
|
21132
21316
|
try {
|
|
21133
|
-
settingsEntries =
|
|
21317
|
+
settingsEntries = fs18.readdirSync(settingsDir);
|
|
21134
21318
|
} catch {
|
|
21135
21319
|
return false;
|
|
21136
21320
|
}
|
|
21137
21321
|
if (settingsEntries.length === 0) return false;
|
|
21138
21322
|
return settingsEntries.every(
|
|
21139
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21323
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path19.join(settingsDir, name), "mcpServers")
|
|
21140
21324
|
);
|
|
21141
21325
|
});
|
|
21142
21326
|
}
|
|
21143
21327
|
function codexDirLooksArgentOnly(dir) {
|
|
21144
21328
|
let entries;
|
|
21145
21329
|
try {
|
|
21146
|
-
entries =
|
|
21330
|
+
entries = fs18.readdirSync(dir);
|
|
21147
21331
|
} catch {
|
|
21148
21332
|
return false;
|
|
21149
21333
|
}
|
|
21150
21334
|
if (entries.length === 0) return false;
|
|
21151
21335
|
return entries.every((entry) => {
|
|
21152
|
-
const full =
|
|
21336
|
+
const full = path19.join(dir, entry);
|
|
21153
21337
|
if (entry === "config.toml") {
|
|
21154
21338
|
const config = parseTomlStrict(full);
|
|
21155
21339
|
if (config === null) return false;
|
|
@@ -21173,16 +21357,23 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21173
21357
|
return false;
|
|
21174
21358
|
});
|
|
21175
21359
|
}
|
|
21360
|
+
function cursorPermissionsPath() {
|
|
21361
|
+
return path19.join(homedir5(), ".cursor", "permissions.json");
|
|
21362
|
+
}
|
|
21363
|
+
function cursorPermissionsList() {
|
|
21364
|
+
const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
|
|
21365
|
+
return Array.isArray(list) ? list : null;
|
|
21366
|
+
}
|
|
21176
21367
|
var cursorAdapter = {
|
|
21177
21368
|
name: "Cursor",
|
|
21178
21369
|
detect() {
|
|
21179
|
-
return dirHasEditorEvidence(
|
|
21370
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21180
21371
|
},
|
|
21181
21372
|
projectPath(root) {
|
|
21182
|
-
return
|
|
21373
|
+
return path19.join(root, ".cursor", "mcp.json");
|
|
21183
21374
|
},
|
|
21184
21375
|
globalPath() {
|
|
21185
|
-
return
|
|
21376
|
+
return path19.join(homedir5(), ".cursor", "mcp.json");
|
|
21186
21377
|
},
|
|
21187
21378
|
// Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
|
|
21188
21379
|
// text edits that preserve user comments and foreign servers.
|
|
@@ -21194,7 +21385,7 @@ var cursorAdapter = {
|
|
|
21194
21385
|
});
|
|
21195
21386
|
},
|
|
21196
21387
|
remove(configPath) {
|
|
21197
|
-
if (!
|
|
21388
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21198
21389
|
const config = readJsonc(configPath);
|
|
21199
21390
|
const servers = config.mcpServers;
|
|
21200
21391
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21202,7 +21393,7 @@ var cursorAdapter = {
|
|
|
21202
21393
|
return true;
|
|
21203
21394
|
},
|
|
21204
21395
|
getArgentEntry(configPath) {
|
|
21205
|
-
if (!
|
|
21396
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21206
21397
|
const config = readJsonc(configPath);
|
|
21207
21398
|
const servers = config.mcpServers;
|
|
21208
21399
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21212,17 +21403,22 @@ var cursorAdapter = {
|
|
|
21212
21403
|
},
|
|
21213
21404
|
// The allowlist lives in a separate ~/.cursor/permissions.json that may carry
|
|
21214
21405
|
// the user's own rules, so edit that one key instead of rewriting the file.
|
|
21406
|
+
// Only a file that already has an mcpAllowlist is edited. Once that key is
|
|
21407
|
+
// non-empty, Cursor enforces the file: Run Everything drops to Allowlist, and
|
|
21408
|
+
// the file's list replaces the in-IDE one. Under Run Everything the rule does
|
|
21409
|
+
// nothing anyway, and without the file the user approves argent in Cursor.
|
|
21410
|
+
allowlistSkipReason() {
|
|
21411
|
+
return cursorPermissionsList() === null ? "creating ~/.cursor/permissions.json would turn off Cursor's Run Everything mode; approve argent in Cursor instead" : null;
|
|
21412
|
+
},
|
|
21215
21413
|
addAllowlist() {
|
|
21216
|
-
const
|
|
21217
|
-
|
|
21218
|
-
|
|
21219
|
-
if (list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
21220
|
-
editJsoncFile(permPath, ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
|
|
21414
|
+
const list = cursorPermissionsList();
|
|
21415
|
+
if (list === null || list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
21416
|
+
editJsoncFile(cursorPermissionsPath(), ["mcpAllowlist"], [...list, CURSOR_ALLOWLIST_PATTERN]);
|
|
21221
21417
|
},
|
|
21222
21418
|
removeAllowlist(_root, scope) {
|
|
21223
21419
|
if (scope !== "global") return;
|
|
21224
|
-
const permPath =
|
|
21225
|
-
if (!
|
|
21420
|
+
const permPath = cursorPermissionsPath();
|
|
21421
|
+
if (!fs18.existsSync(permPath)) return;
|
|
21226
21422
|
const config = readJsonc(permPath);
|
|
21227
21423
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21228
21424
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21231,18 +21427,11 @@ var cursorAdapter = {
|
|
|
21231
21427
|
}
|
|
21232
21428
|
};
|
|
21233
21429
|
function claudeProjectKeysForRoot(projects, root) {
|
|
21234
|
-
const
|
|
21235
|
-
|
|
21236
|
-
return fs17.realpathSync.native(value);
|
|
21237
|
-
} catch {
|
|
21238
|
-
return path18.resolve(value);
|
|
21239
|
-
}
|
|
21240
|
-
};
|
|
21241
|
-
const target = canonical(root);
|
|
21242
|
-
return Object.keys(projects).filter((key) => key === root || canonical(key) === target);
|
|
21430
|
+
const target = canonicalPath(root);
|
|
21431
|
+
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21243
21432
|
}
|
|
21244
21433
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21245
|
-
if (!
|
|
21434
|
+
if (!fs18.existsSync(settingsPath)) return null;
|
|
21246
21435
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21247
21436
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21248
21437
|
return {
|
|
@@ -21270,13 +21459,13 @@ var claudeAdapter = {
|
|
|
21270
21459
|
name: "Claude Code",
|
|
21271
21460
|
detect() {
|
|
21272
21461
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21273
|
-
return fileHasEditorEvidence(
|
|
21462
|
+
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);
|
|
21274
21463
|
},
|
|
21275
21464
|
projectPath(root) {
|
|
21276
|
-
return
|
|
21465
|
+
return path19.join(root, ".mcp.json");
|
|
21277
21466
|
},
|
|
21278
21467
|
globalPath() {
|
|
21279
|
-
return
|
|
21468
|
+
return path19.join(homedir5(), ".claude.json");
|
|
21280
21469
|
},
|
|
21281
21470
|
// JSONC is a superset of JSON, so this config shares the one comment- and
|
|
21282
21471
|
// foreign-server-preserving write path (see the Cursor adapter).
|
|
@@ -21289,7 +21478,7 @@ var claudeAdapter = {
|
|
|
21289
21478
|
});
|
|
21290
21479
|
},
|
|
21291
21480
|
remove(configPath) {
|
|
21292
|
-
if (!
|
|
21481
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21293
21482
|
const config = readJsonc(configPath);
|
|
21294
21483
|
const servers = config.mcpServers;
|
|
21295
21484
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21303,7 +21492,7 @@ var claudeAdapter = {
|
|
|
21303
21492
|
return true;
|
|
21304
21493
|
},
|
|
21305
21494
|
getArgentEntry(configPath) {
|
|
21306
|
-
if (!
|
|
21495
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21307
21496
|
const config = readJsonc(configPath);
|
|
21308
21497
|
const servers = config.mcpServers;
|
|
21309
21498
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21316,7 +21505,7 @@ var claudeAdapter = {
|
|
|
21316
21505
|
// .mcp.json rejections (see claudeDisabledListFinding).
|
|
21317
21506
|
findShadowingConfigs(root, writtenScope) {
|
|
21318
21507
|
const findings = [];
|
|
21319
|
-
const claudeJsonPath =
|
|
21508
|
+
const claudeJsonPath = path19.join(homedir5(), ".claude.json");
|
|
21320
21509
|
const projects = readJson(claudeJsonPath).projects;
|
|
21321
21510
|
if (isRecord(projects)) {
|
|
21322
21511
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21353,9 +21542,9 @@ var claudeAdapter = {
|
|
|
21353
21542
|
}
|
|
21354
21543
|
if (writtenScope === "local") {
|
|
21355
21544
|
const candidates = [
|
|
21356
|
-
[
|
|
21357
|
-
[
|
|
21358
|
-
[
|
|
21545
|
+
[path19.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21546
|
+
[path19.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21547
|
+
[path19.join(homedir5(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21359
21548
|
];
|
|
21360
21549
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21361
21550
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21374,10 +21563,10 @@ var claudeAdapter = {
|
|
|
21374
21563
|
var vscodeAdapter = {
|
|
21375
21564
|
name: "VS Code",
|
|
21376
21565
|
detect() {
|
|
21377
|
-
return dirHasEditorEvidence(
|
|
21566
|
+
return dirHasEditorEvidence(path19.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path19.join(homedir5(), ".vscode"));
|
|
21378
21567
|
},
|
|
21379
21568
|
projectPath(root) {
|
|
21380
|
-
return
|
|
21569
|
+
return path19.join(root, ".vscode", "mcp.json");
|
|
21381
21570
|
},
|
|
21382
21571
|
globalPath() {
|
|
21383
21572
|
return null;
|
|
@@ -21393,7 +21582,7 @@ var vscodeAdapter = {
|
|
|
21393
21582
|
});
|
|
21394
21583
|
},
|
|
21395
21584
|
remove(configPath) {
|
|
21396
|
-
if (!
|
|
21585
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21397
21586
|
const config = readJsonc(configPath);
|
|
21398
21587
|
const servers = config.servers;
|
|
21399
21588
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21401,7 +21590,7 @@ var vscodeAdapter = {
|
|
|
21401
21590
|
return true;
|
|
21402
21591
|
},
|
|
21403
21592
|
getArgentEntry(configPath) {
|
|
21404
|
-
if (!
|
|
21593
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21405
21594
|
const config = readJsonc(configPath);
|
|
21406
21595
|
const servers = config.servers;
|
|
21407
21596
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21414,7 +21603,7 @@ var vscodeAdapter = {
|
|
|
21414
21603
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21415
21604
|
const findings = [];
|
|
21416
21605
|
for (const userDir of vscodeUserDirs()) {
|
|
21417
|
-
const configPath =
|
|
21606
|
+
const configPath = path19.join(userDir, "mcp.json");
|
|
21418
21607
|
const entry = this.getArgentEntry(configPath);
|
|
21419
21608
|
if (!entry) continue;
|
|
21420
21609
|
findings.push({
|
|
@@ -21431,16 +21620,16 @@ var vscodeAdapter = {
|
|
|
21431
21620
|
function vscodeUserDirs() {
|
|
21432
21621
|
const bases = [];
|
|
21433
21622
|
if (process.platform === "darwin") {
|
|
21434
|
-
bases.push(
|
|
21623
|
+
bases.push(path19.join(homedir5(), "Library", "Application Support"));
|
|
21435
21624
|
} else if (process.platform === "win32") {
|
|
21436
21625
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21437
21626
|
} else {
|
|
21438
|
-
bases.push(
|
|
21627
|
+
bases.push(path19.join(homedir5(), ".config"));
|
|
21439
21628
|
}
|
|
21440
21629
|
const dirs = [];
|
|
21441
21630
|
for (const base of bases) {
|
|
21442
21631
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21443
|
-
const dir =
|
|
21632
|
+
const dir = path19.join(base, product, "User");
|
|
21444
21633
|
if (dirExists(dir)) dirs.push(dir);
|
|
21445
21634
|
}
|
|
21446
21635
|
}
|
|
@@ -21448,18 +21637,18 @@ function vscodeUserDirs() {
|
|
|
21448
21637
|
}
|
|
21449
21638
|
function devinUserConfigPath() {
|
|
21450
21639
|
if (process.platform === "win32") {
|
|
21451
|
-
const appData = process.env.APPDATA ||
|
|
21452
|
-
return
|
|
21640
|
+
const appData = process.env.APPDATA || path19.join(homedir5(), "AppData", "Roaming");
|
|
21641
|
+
return path19.join(appData, "devin", "config.json");
|
|
21453
21642
|
}
|
|
21454
21643
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
21455
|
-
return
|
|
21644
|
+
return path19.join(xdg || path19.join(homedir5(), ".config"), "devin", "config.json");
|
|
21456
21645
|
}
|
|
21457
21646
|
var windsurfAdapter = {
|
|
21458
21647
|
name: "Devin Desktop",
|
|
21459
21648
|
telemetryName: "windsurf",
|
|
21460
21649
|
detect() {
|
|
21461
21650
|
return dirHasEditorEvidence(
|
|
21462
|
-
|
|
21651
|
+
path19.join(homedir5(), ".codeium", "windsurf"),
|
|
21463
21652
|
windsurfDirLooksArgentOnly
|
|
21464
21653
|
);
|
|
21465
21654
|
},
|
|
@@ -21467,18 +21656,19 @@ var windsurfAdapter = {
|
|
|
21467
21656
|
return null;
|
|
21468
21657
|
},
|
|
21469
21658
|
globalPath() {
|
|
21470
|
-
return
|
|
21659
|
+
return path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21471
21660
|
},
|
|
21472
21661
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21473
21662
|
write(configPath, entry) {
|
|
21474
21663
|
editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
|
|
21475
21664
|
command: entry.command,
|
|
21476
21665
|
args: entry.args,
|
|
21477
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
21666
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
21667
|
+
...existingEntryKeys(configPath, "mcpServers", ["alwaysAllow"])
|
|
21478
21668
|
});
|
|
21479
21669
|
},
|
|
21480
21670
|
remove(configPath) {
|
|
21481
|
-
if (!
|
|
21671
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21482
21672
|
const config = readJsonc(configPath);
|
|
21483
21673
|
const servers = config.mcpServers;
|
|
21484
21674
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21486,7 +21676,7 @@ var windsurfAdapter = {
|
|
|
21486
21676
|
return true;
|
|
21487
21677
|
},
|
|
21488
21678
|
getArgentEntry(configPath) {
|
|
21489
|
-
if (!
|
|
21679
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21490
21680
|
const config = readJsonc(configPath);
|
|
21491
21681
|
const servers = config.mcpServers;
|
|
21492
21682
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21498,7 +21688,7 @@ var windsurfAdapter = {
|
|
|
21498
21688
|
// servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
|
|
21499
21689
|
// agent needs its own permission rule.
|
|
21500
21690
|
addAllowlist() {
|
|
21501
|
-
const configPath =
|
|
21691
|
+
const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21502
21692
|
const config = readJsonc(configPath);
|
|
21503
21693
|
const servers = config.mcpServers;
|
|
21504
21694
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21508,8 +21698,8 @@ var windsurfAdapter = {
|
|
|
21508
21698
|
removeAllowlist(_root, scope) {
|
|
21509
21699
|
if (scope !== "global") return;
|
|
21510
21700
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21511
|
-
const configPath =
|
|
21512
|
-
if (!
|
|
21701
|
+
const configPath = path19.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21702
|
+
if (!fs18.existsSync(configPath)) return;
|
|
21513
21703
|
const config = readJsonc(configPath);
|
|
21514
21704
|
const servers = config.mcpServers;
|
|
21515
21705
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21520,13 +21710,13 @@ var windsurfAdapter = {
|
|
|
21520
21710
|
var zedAdapter = {
|
|
21521
21711
|
name: "Zed",
|
|
21522
21712
|
detect() {
|
|
21523
|
-
return dirHasEditorEvidence(
|
|
21713
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21524
21714
|
},
|
|
21525
21715
|
projectPath(root) {
|
|
21526
|
-
return
|
|
21716
|
+
return path19.join(root, ".zed", "settings.json");
|
|
21527
21717
|
},
|
|
21528
21718
|
globalPath() {
|
|
21529
|
-
return
|
|
21719
|
+
return path19.join(homedir5(), ".config", "zed", "settings.json");
|
|
21530
21720
|
},
|
|
21531
21721
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21532
21722
|
// formatting outside the touched key survive (see the Cursor adapter).
|
|
@@ -21539,7 +21729,7 @@ var zedAdapter = {
|
|
|
21539
21729
|
});
|
|
21540
21730
|
},
|
|
21541
21731
|
remove(configPath) {
|
|
21542
|
-
if (!
|
|
21732
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21543
21733
|
const config = readJsonc(configPath);
|
|
21544
21734
|
const servers = config.context_servers;
|
|
21545
21735
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21547,7 +21737,7 @@ var zedAdapter = {
|
|
|
21547
21737
|
return true;
|
|
21548
21738
|
},
|
|
21549
21739
|
getArgentEntry(configPath) {
|
|
21550
|
-
if (!
|
|
21740
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21551
21741
|
const config = readJsonc(configPath);
|
|
21552
21742
|
const servers = config.context_servers;
|
|
21553
21743
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21558,12 +21748,12 @@ var zedAdapter = {
|
|
|
21558
21748
|
// Zed has no server-level wildcard for MCP tools — each tool would need its
|
|
21559
21749
|
// own entry — so the global default is set to "allow" instead.
|
|
21560
21750
|
addAllowlist(root, scope) {
|
|
21561
|
-
const settingsPath = scope === "global" ?
|
|
21751
|
+
const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
|
|
21562
21752
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21563
21753
|
},
|
|
21564
21754
|
removeAllowlist(root, scope) {
|
|
21565
|
-
const settingsPath = scope === "global" ?
|
|
21566
|
-
if (!
|
|
21755
|
+
const settingsPath = scope === "global" ? path19.join(homedir5(), ".config", "zed", "settings.json") : path19.join(root, ".zed", "settings.json");
|
|
21756
|
+
if (!fs18.existsSync(settingsPath)) return;
|
|
21567
21757
|
const config = readJsonc(settingsPath);
|
|
21568
21758
|
const perms = config.agent?.tool_permissions;
|
|
21569
21759
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21573,24 +21763,25 @@ var zedAdapter = {
|
|
|
21573
21763
|
var geminiAdapter = {
|
|
21574
21764
|
name: "Gemini",
|
|
21575
21765
|
detect() {
|
|
21576
|
-
return dirHasEditorEvidence(
|
|
21766
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21577
21767
|
},
|
|
21578
21768
|
projectPath(root) {
|
|
21579
|
-
return
|
|
21769
|
+
return path19.join(root, ".gemini", "settings.json");
|
|
21580
21770
|
},
|
|
21581
21771
|
globalPath() {
|
|
21582
|
-
return
|
|
21772
|
+
return path19.join(homedir5(), ".gemini", "settings.json");
|
|
21583
21773
|
},
|
|
21584
21774
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21585
21775
|
write(configPath, entry) {
|
|
21586
21776
|
editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
|
|
21587
21777
|
command: entry.command,
|
|
21588
21778
|
args: entry.args,
|
|
21589
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
21779
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
21780
|
+
...existingEntryKeys(configPath, "mcpServers", ["trust"])
|
|
21590
21781
|
});
|
|
21591
21782
|
},
|
|
21592
21783
|
remove(configPath) {
|
|
21593
|
-
if (!
|
|
21784
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21594
21785
|
const config = readJsonc(configPath);
|
|
21595
21786
|
const servers = config.mcpServers;
|
|
21596
21787
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21598,7 +21789,7 @@ var geminiAdapter = {
|
|
|
21598
21789
|
return true;
|
|
21599
21790
|
},
|
|
21600
21791
|
getArgentEntry(configPath) {
|
|
21601
|
-
if (!
|
|
21792
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21602
21793
|
const config = readJsonc(configPath);
|
|
21603
21794
|
const servers = config.mcpServers;
|
|
21604
21795
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21620,7 +21811,7 @@ var geminiAdapter = {
|
|
|
21620
21811
|
},
|
|
21621
21812
|
removeAllowlist(root, scope) {
|
|
21622
21813
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21623
|
-
if (!configPath || !
|
|
21814
|
+
if (!configPath || !fs18.existsSync(configPath)) {
|
|
21624
21815
|
return;
|
|
21625
21816
|
}
|
|
21626
21817
|
const config = readJsonc(configPath);
|
|
@@ -21634,27 +21825,29 @@ var CODEX_FILENAME = ".codex";
|
|
|
21634
21825
|
var codexAdapter = {
|
|
21635
21826
|
name: "Codex",
|
|
21636
21827
|
detect() {
|
|
21637
|
-
return dirHasEditorEvidence(
|
|
21828
|
+
return dirHasEditorEvidence(path19.join(homedir5(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21638
21829
|
},
|
|
21639
21830
|
projectPath(root) {
|
|
21640
|
-
return
|
|
21831
|
+
return path19.join(root, CODEX_FILENAME, "config.toml");
|
|
21641
21832
|
},
|
|
21642
21833
|
globalPath() {
|
|
21643
|
-
return
|
|
21834
|
+
return path19.join(homedir5(), CODEX_FILENAME, "config.toml");
|
|
21644
21835
|
},
|
|
21645
21836
|
write(configPath, entry) {
|
|
21646
21837
|
const config = readToml(configPath);
|
|
21647
21838
|
const servers = config.mcp_servers ?? {};
|
|
21839
|
+
const previous = servers[MCP_SERVER_KEY];
|
|
21648
21840
|
servers[MCP_SERVER_KEY] = {
|
|
21649
21841
|
command: entry.command,
|
|
21650
21842
|
args: entry.args,
|
|
21651
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
21843
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
21844
|
+
...previous?.tools !== void 0 ? { tools: previous.tools } : {}
|
|
21652
21845
|
};
|
|
21653
21846
|
config.mcp_servers = servers;
|
|
21654
21847
|
writeToml(configPath, config);
|
|
21655
21848
|
},
|
|
21656
21849
|
remove(configPath) {
|
|
21657
|
-
if (!
|
|
21850
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21658
21851
|
const config = readToml(configPath);
|
|
21659
21852
|
const servers = config.mcp_servers;
|
|
21660
21853
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21664,7 +21857,7 @@ var codexAdapter = {
|
|
|
21664
21857
|
return true;
|
|
21665
21858
|
},
|
|
21666
21859
|
getArgentEntry(configPath) {
|
|
21667
|
-
if (!
|
|
21860
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21668
21861
|
const config = readToml(configPath);
|
|
21669
21862
|
const servers = config.mcp_servers;
|
|
21670
21863
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21690,6 +21883,27 @@ var codexAdapter = {
|
|
|
21690
21883
|
}
|
|
21691
21884
|
writeToml(configPath, config);
|
|
21692
21885
|
},
|
|
21886
|
+
// Codex has no wildcard: each tool id is listed. A table with at least one
|
|
21887
|
+
// approved tool means the user kept the allowlist, so tools this version
|
|
21888
|
+
// added are approved too. Tools already listed keep the mode the user gave
|
|
21889
|
+
// them, and an emptied or removed table stays as it is.
|
|
21890
|
+
refreshAllowlist(root, scope) {
|
|
21891
|
+
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21892
|
+
if (!configPath || !fs18.existsSync(configPath)) return;
|
|
21893
|
+
const config = readToml(configPath);
|
|
21894
|
+
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
21895
|
+
if (!toolsConfig) return;
|
|
21896
|
+
const optedIn = Object.values(toolsConfig).some(
|
|
21897
|
+
(tool) => tool?.approval_mode === "approve"
|
|
21898
|
+
);
|
|
21899
|
+
if (!optedIn) return;
|
|
21900
|
+
const missing = getAvailableToolIds().filter((tool) => !(tool in toolsConfig));
|
|
21901
|
+
if (missing.length === 0) return;
|
|
21902
|
+
for (const tool of missing) {
|
|
21903
|
+
toolsConfig[tool] = { approval_mode: "approve" };
|
|
21904
|
+
}
|
|
21905
|
+
writeToml(configPath, config);
|
|
21906
|
+
},
|
|
21693
21907
|
removeAllowlist(root, scope) {
|
|
21694
21908
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21695
21909
|
if (!configPath) {
|
|
@@ -21712,13 +21926,13 @@ var codexAdapter = {
|
|
|
21712
21926
|
var hermesAdapter = {
|
|
21713
21927
|
name: "Hermes",
|
|
21714
21928
|
detect() {
|
|
21715
|
-
return dirHasEditorEvidence(
|
|
21929
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".hermes"), hermesDirLooksArgentOnly);
|
|
21716
21930
|
},
|
|
21717
21931
|
projectPath() {
|
|
21718
21932
|
return null;
|
|
21719
21933
|
},
|
|
21720
21934
|
globalPath() {
|
|
21721
|
-
return
|
|
21935
|
+
return path19.join(homedir5(), ".hermes", "config.yaml");
|
|
21722
21936
|
},
|
|
21723
21937
|
write(configPath, entry) {
|
|
21724
21938
|
const doc = readYaml(configPath);
|
|
@@ -21737,7 +21951,7 @@ var hermesAdapter = {
|
|
|
21737
21951
|
writeYaml(configPath, doc);
|
|
21738
21952
|
},
|
|
21739
21953
|
remove(configPath) {
|
|
21740
|
-
if (!
|
|
21954
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21741
21955
|
const doc = readYaml(configPath);
|
|
21742
21956
|
const servers = doc.get("mcp_servers");
|
|
21743
21957
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -21750,7 +21964,7 @@ var hermesAdapter = {
|
|
|
21750
21964
|
return true;
|
|
21751
21965
|
},
|
|
21752
21966
|
getArgentEntry(configPath) {
|
|
21753
|
-
if (!
|
|
21967
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21754
21968
|
const doc = readYaml(configPath);
|
|
21755
21969
|
const servers = doc.get("mcp_servers");
|
|
21756
21970
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -21777,10 +21991,10 @@ function hasOpenCodeBinary() {
|
|
|
21777
21991
|
}
|
|
21778
21992
|
function pickOpencodeConfig(dir, candidates) {
|
|
21779
21993
|
for (const name of candidates) {
|
|
21780
|
-
const candidate =
|
|
21781
|
-
if (
|
|
21994
|
+
const candidate = path19.join(dir, name);
|
|
21995
|
+
if (fs18.existsSync(candidate)) return candidate;
|
|
21782
21996
|
}
|
|
21783
|
-
return
|
|
21997
|
+
return path19.join(dir, "opencode.json");
|
|
21784
21998
|
}
|
|
21785
21999
|
var openCodeAdapter = {
|
|
21786
22000
|
name: "opencode",
|
|
@@ -21791,7 +22005,7 @@ var openCodeAdapter = {
|
|
|
21791
22005
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
21792
22006
|
},
|
|
21793
22007
|
globalPath() {
|
|
21794
|
-
return pickOpencodeConfig(
|
|
22008
|
+
return pickOpencodeConfig(path19.join(homedir5(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
21795
22009
|
},
|
|
21796
22010
|
write(configPath, entry) {
|
|
21797
22011
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -21802,7 +22016,7 @@ var openCodeAdapter = {
|
|
|
21802
22016
|
});
|
|
21803
22017
|
},
|
|
21804
22018
|
remove(configPath) {
|
|
21805
|
-
if (!
|
|
22019
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21806
22020
|
const config = readJsonc(configPath);
|
|
21807
22021
|
const servers = config.mcp;
|
|
21808
22022
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21810,7 +22024,7 @@ var openCodeAdapter = {
|
|
|
21810
22024
|
return true;
|
|
21811
22025
|
},
|
|
21812
22026
|
getArgentEntry(configPath) {
|
|
21813
|
-
if (!
|
|
22027
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21814
22028
|
const config = readJsonc(configPath);
|
|
21815
22029
|
const servers = config.mcp;
|
|
21816
22030
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21825,7 +22039,7 @@ var openCodeAdapter = {
|
|
|
21825
22039
|
},
|
|
21826
22040
|
removeAllowlist(root, scope) {
|
|
21827
22041
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21828
|
-
if (!configPath || !
|
|
22042
|
+
if (!configPath || !fs18.existsSync(configPath)) return;
|
|
21829
22043
|
const config = readJsonc(configPath);
|
|
21830
22044
|
const tools = config.tools;
|
|
21831
22045
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -21836,13 +22050,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
21836
22050
|
var kiroAdapter = {
|
|
21837
22051
|
name: "Kiro",
|
|
21838
22052
|
detect() {
|
|
21839
|
-
return dirHasEditorEvidence(
|
|
22053
|
+
return dirHasEditorEvidence(path19.join(homedir5(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path19.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
21840
22054
|
},
|
|
21841
22055
|
projectPath(root) {
|
|
21842
|
-
return
|
|
22056
|
+
return path19.join(root, ".kiro", "settings", "mcp.json");
|
|
21843
22057
|
},
|
|
21844
22058
|
globalPath() {
|
|
21845
|
-
return
|
|
22059
|
+
return path19.join(homedir5(), ".kiro", "settings", "mcp.json");
|
|
21846
22060
|
},
|
|
21847
22061
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21848
22062
|
// foreign servers survive (see the Cursor adapter).
|
|
@@ -21850,11 +22064,12 @@ var kiroAdapter = {
|
|
|
21850
22064
|
editJsoncFile(configPath, ["mcpServers", MCP_SERVER_KEY], {
|
|
21851
22065
|
command: entry.command,
|
|
21852
22066
|
args: entry.args,
|
|
21853
|
-
...hasEnv(entry) ? { env: entry.env } : {}
|
|
22067
|
+
...hasEnv(entry) ? { env: entry.env } : {},
|
|
22068
|
+
...existingEntryKeys(configPath, "mcpServers", ["autoApprove"])
|
|
21854
22069
|
});
|
|
21855
22070
|
},
|
|
21856
22071
|
remove(configPath) {
|
|
21857
|
-
if (!
|
|
22072
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
21858
22073
|
const config = readJsonc(configPath);
|
|
21859
22074
|
const servers = config.mcpServers;
|
|
21860
22075
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21862,7 +22077,7 @@ var kiroAdapter = {
|
|
|
21862
22077
|
return true;
|
|
21863
22078
|
},
|
|
21864
22079
|
getArgentEntry(configPath) {
|
|
21865
|
-
if (!
|
|
22080
|
+
if (!fs18.existsSync(configPath)) return null;
|
|
21866
22081
|
const config = readJsonc(configPath);
|
|
21867
22082
|
const servers = config.mcpServers;
|
|
21868
22083
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21886,7 +22101,7 @@ var kiroAdapter = {
|
|
|
21886
22101
|
},
|
|
21887
22102
|
removeAllowlist(root, scope) {
|
|
21888
22103
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21889
|
-
if (!configPath || !
|
|
22104
|
+
if (!configPath || !fs18.existsSync(configPath)) return;
|
|
21890
22105
|
const config = readJsonc(configPath);
|
|
21891
22106
|
const servers = config.mcpServers;
|
|
21892
22107
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21938,7 +22153,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
21938
22153
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
21939
22154
|
}
|
|
21940
22155
|
function removeAllowRule(settingsPath, rule) {
|
|
21941
|
-
if (!
|
|
22156
|
+
if (!fs18.existsSync(settingsPath)) return;
|
|
21942
22157
|
const config = readJsonc(settingsPath);
|
|
21943
22158
|
const permissions = config?.permissions;
|
|
21944
22159
|
const allow = permissions?.allow;
|
|
@@ -21948,7 +22163,7 @@ function removeAllowRule(settingsPath, rule) {
|
|
|
21948
22163
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
21949
22164
|
}
|
|
21950
22165
|
function claudeSettingsPath(root, scope) {
|
|
21951
|
-
return scope === "global" ?
|
|
22166
|
+
return scope === "global" ? path19.join(homedir5(), ".claude", "settings.json") : path19.join(root, ".claude", "settings.json");
|
|
21952
22167
|
}
|
|
21953
22168
|
function addClaudePermission(root, scope) {
|
|
21954
22169
|
addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
@@ -21961,12 +22176,13 @@ function formatCopyDestination(target, writtenPath, root) {
|
|
|
21961
22176
|
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
21962
22177
|
}
|
|
21963
22178
|
function formatManagedPathLabel(targetPath, root) {
|
|
21964
|
-
const home
|
|
21965
|
-
|
|
21966
|
-
|
|
22179
|
+
for (const home of [path19.resolve(homedir5()), canonicalPath(homedir5())]) {
|
|
22180
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path19.sep}`)) {
|
|
22181
|
+
return `~${targetPath.slice(home.length)}`;
|
|
22182
|
+
}
|
|
21967
22183
|
}
|
|
21968
|
-
const relative5 =
|
|
21969
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22184
|
+
const relative5 = path19.relative(root, targetPath);
|
|
22185
|
+
if (relative5 && !relative5.startsWith("..") && !path19.isAbsolute(relative5)) {
|
|
21970
22186
|
return relative5;
|
|
21971
22187
|
}
|
|
21972
22188
|
return targetPath;
|
|
@@ -21980,7 +22196,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
21980
22196
|
}
|
|
21981
22197
|
function getAdapterBasePath(adapter, root, scope) {
|
|
21982
22198
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
21983
|
-
return configPath ?
|
|
22199
|
+
return configPath ? path19.dirname(configPath) : null;
|
|
21984
22200
|
}
|
|
21985
22201
|
function getManagedContentTargets(adapters, root, scope) {
|
|
21986
22202
|
const targets = {
|
|
@@ -21990,17 +22206,17 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
21990
22206
|
codexConfigTargets: [],
|
|
21991
22207
|
skillsLockTargets: []
|
|
21992
22208
|
};
|
|
21993
|
-
const workspaceBase = scope === "global" ?
|
|
22209
|
+
const workspaceBase = scope === "global" ? homedir5() : root;
|
|
21994
22210
|
addManagedTarget(
|
|
21995
22211
|
targets.skillTargets,
|
|
21996
22212
|
"skills",
|
|
21997
|
-
|
|
22213
|
+
path19.join(workspaceBase, ".agents", "skills"),
|
|
21998
22214
|
root
|
|
21999
22215
|
);
|
|
22000
22216
|
addManagedTarget(
|
|
22001
22217
|
targets.skillsLockTargets,
|
|
22002
22218
|
"skills",
|
|
22003
|
-
|
|
22219
|
+
path19.join(workspaceBase, "skills-lock.json"),
|
|
22004
22220
|
root
|
|
22005
22221
|
);
|
|
22006
22222
|
for (const adapter of adapters) {
|
|
@@ -22008,21 +22224,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22008
22224
|
case "Cursor": {
|
|
22009
22225
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
22010
22226
|
if (!base) break;
|
|
22011
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22012
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22227
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
|
|
22228
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path19.join(base, "rules"), root);
|
|
22013
22229
|
break;
|
|
22014
22230
|
}
|
|
22015
22231
|
case "Claude Code": {
|
|
22016
|
-
const claudeBase = scope === "global" ?
|
|
22017
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22018
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22019
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22232
|
+
const claudeBase = scope === "global" ? path19.join(homedir5(), ".claude") : path19.join(root, ".claude");
|
|
22233
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(claudeBase, "skills"), root);
|
|
22234
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path19.join(claudeBase, "rules"), root);
|
|
22235
|
+
addManagedTarget(targets.agentTargets, adapter.name, path19.join(claudeBase, "agents"), root);
|
|
22020
22236
|
break;
|
|
22021
22237
|
}
|
|
22022
22238
|
case "Gemini": {
|
|
22023
|
-
const geminiBase = scope === "global" ?
|
|
22024
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22025
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22239
|
+
const geminiBase = scope === "global" ? path19.join(homedir5(), ".gemini") : path19.join(root, ".gemini");
|
|
22240
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path19.join(geminiBase, "rules"), root);
|
|
22241
|
+
addManagedTarget(targets.agentTargets, adapter.name, path19.join(geminiBase, "agents"), root);
|
|
22026
22242
|
break;
|
|
22027
22243
|
}
|
|
22028
22244
|
case "Codex": {
|
|
@@ -22032,19 +22248,19 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22032
22248
|
break;
|
|
22033
22249
|
}
|
|
22034
22250
|
case "opencode": {
|
|
22035
|
-
const base = scope === "global" ?
|
|
22036
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22037
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22251
|
+
const base = scope === "global" ? path19.join(homedir5(), ".config", "opencode") : path19.join(root, ".opencode");
|
|
22252
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(base, "skills"), root);
|
|
22253
|
+
addManagedTarget(targets.agentTargets, adapter.name, path19.join(base, "agents"), root);
|
|
22038
22254
|
break;
|
|
22039
22255
|
}
|
|
22040
22256
|
case "Kiro": {
|
|
22041
|
-
const kiroBase = scope === "global" ?
|
|
22042
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22257
|
+
const kiroBase = scope === "global" ? path19.join(homedir5(), ".kiro") : path19.join(root, ".kiro");
|
|
22258
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(kiroBase, "skills"), root);
|
|
22043
22259
|
break;
|
|
22044
22260
|
}
|
|
22045
22261
|
case "Devin Desktop": {
|
|
22046
|
-
const devinBase = scope === "global" ?
|
|
22047
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22262
|
+
const devinBase = scope === "global" ? path19.join(process.env.XDG_CONFIG_HOME || path19.join(homedir5(), ".config"), "devin") : path19.join(root, ".devin");
|
|
22263
|
+
addManagedTarget(targets.skillTargets, adapter.name, path19.join(devinBase, "skills"), root);
|
|
22048
22264
|
break;
|
|
22049
22265
|
}
|
|
22050
22266
|
}
|
|
@@ -22058,12 +22274,12 @@ function stripFrontmatter(content) {
|
|
|
22058
22274
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22059
22275
|
}
|
|
22060
22276
|
function readAndConcatRules(rulesDir) {
|
|
22061
|
-
if (!
|
|
22062
|
-
const files =
|
|
22277
|
+
if (!fs18.existsSync(rulesDir)) return null;
|
|
22278
|
+
const files = fs18.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22063
22279
|
if (files.length === 0) return null;
|
|
22064
22280
|
const parts = [];
|
|
22065
22281
|
for (const file of files) {
|
|
22066
|
-
const raw =
|
|
22282
|
+
const raw = fs18.readFileSync(path19.join(rulesDir, file), "utf8");
|
|
22067
22283
|
const stripped = stripFrontmatter(raw);
|
|
22068
22284
|
if (stripped) parts.push(stripped);
|
|
22069
22285
|
}
|
|
@@ -22098,7 +22314,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22098
22314
|
return configPath;
|
|
22099
22315
|
}
|
|
22100
22316
|
function removeCodexRules(configPath) {
|
|
22101
|
-
if (!
|
|
22317
|
+
if (!fs18.existsSync(configPath)) return false;
|
|
22102
22318
|
const config = readToml(configPath);
|
|
22103
22319
|
const existing = config.developer_instructions;
|
|
22104
22320
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22190,10 +22406,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22190
22406
|
}
|
|
22191
22407
|
|
|
22192
22408
|
// ../argent-installer/src/retired-files.ts
|
|
22193
|
-
import * as
|
|
22409
|
+
import * as path20 from "node:path";
|
|
22194
22410
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
22195
22411
|
function displayPath(entry, file) {
|
|
22196
|
-
return
|
|
22412
|
+
return path20.join(entry.location, ...file.relativePath.split("/"));
|
|
22197
22413
|
}
|
|
22198
22414
|
async function cleanupRetiredFiles(found, options) {
|
|
22199
22415
|
const result = { removed: [], declined: [], failed: [], removedRoots: [] };
|
|
@@ -22244,14 +22460,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22244
22460
|
|
|
22245
22461
|
// ../argent-installer/src/cli-record.ts
|
|
22246
22462
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22247
|
-
import * as
|
|
22248
|
-
import * as
|
|
22463
|
+
import * as fs19 from "node:fs";
|
|
22464
|
+
import * as path21 from "node:path";
|
|
22249
22465
|
function cliRecordPath() {
|
|
22250
|
-
return
|
|
22466
|
+
return path21.join(argentHomeDir(), "cli.json");
|
|
22251
22467
|
}
|
|
22252
22468
|
function readCliRecord() {
|
|
22253
22469
|
try {
|
|
22254
|
-
const parsed = JSON.parse(
|
|
22470
|
+
const parsed = JSON.parse(fs19.readFileSync(cliRecordPath(), "utf8"));
|
|
22255
22471
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22256
22472
|
return null;
|
|
22257
22473
|
} catch {
|
|
@@ -22261,14 +22477,10 @@ function readCliRecord() {
|
|
|
22261
22477
|
function resolveCliEntry(mode, projectRoot) {
|
|
22262
22478
|
if (mode === "local") {
|
|
22263
22479
|
const relative5 = getLocalArgentBinRelPath(projectRoot);
|
|
22264
|
-
return relative5 ?
|
|
22480
|
+
return relative5 ? path21.resolve(projectRoot, relative5) : null;
|
|
22265
22481
|
}
|
|
22266
22482
|
const packageRoot = getGloballyInstalledPackageRoot();
|
|
22267
|
-
|
|
22268
|
-
const binSub = argentBinSubpath(packageRoot);
|
|
22269
|
-
if (!binSub) return null;
|
|
22270
|
-
const entry = path20.join(packageRoot, binSub);
|
|
22271
|
-
return fs18.existsSync(entry) ? entry : null;
|
|
22483
|
+
return packageRoot ? cliPathOf(packageRoot) : null;
|
|
22272
22484
|
}
|
|
22273
22485
|
function writeCliRecord(input) {
|
|
22274
22486
|
const cli = resolveCliEntry(input.mode, input.projectRoot);
|
|
@@ -22284,10 +22496,10 @@ function writeCliRecord(input) {
|
|
|
22284
22496
|
function persistCliRecord(record) {
|
|
22285
22497
|
const file = cliRecordPath();
|
|
22286
22498
|
try {
|
|
22287
|
-
|
|
22499
|
+
fs19.mkdirSync(path21.dirname(file), { recursive: true });
|
|
22288
22500
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
22289
|
-
|
|
22290
|
-
|
|
22501
|
+
fs19.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22502
|
+
fs19.renameSync(temporary, file);
|
|
22291
22503
|
return file;
|
|
22292
22504
|
} catch {
|
|
22293
22505
|
return null;
|
|
@@ -22295,10 +22507,10 @@ function persistCliRecord(record) {
|
|
|
22295
22507
|
}
|
|
22296
22508
|
function healCliRecord(input) {
|
|
22297
22509
|
try {
|
|
22298
|
-
if (!
|
|
22510
|
+
if (!fs19.existsSync(input.cli)) return null;
|
|
22299
22511
|
const existing = readCliRecord();
|
|
22300
22512
|
if (existing) {
|
|
22301
|
-
const alive =
|
|
22513
|
+
const alive = fs19.existsSync(existing.node) && fs19.existsSync(existing.cli);
|
|
22302
22514
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22303
22515
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22304
22516
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22319,11 +22531,11 @@ function removeCliRecordFor(installDir) {
|
|
|
22319
22531
|
if (!installDir) return false;
|
|
22320
22532
|
const record = readCliRecord();
|
|
22321
22533
|
if (!record) return false;
|
|
22322
|
-
const root =
|
|
22323
|
-
const relative5 =
|
|
22324
|
-
if (relative5.startsWith("..") ||
|
|
22534
|
+
const root = path21.resolve(installDir);
|
|
22535
|
+
const relative5 = path21.relative(root, path21.resolve(record.cli));
|
|
22536
|
+
if (relative5.startsWith("..") || path21.isAbsolute(relative5)) return false;
|
|
22325
22537
|
try {
|
|
22326
|
-
|
|
22538
|
+
fs19.rmSync(cliRecordPath(), { force: true });
|
|
22327
22539
|
return true;
|
|
22328
22540
|
} catch {
|
|
22329
22541
|
return false;
|
|
@@ -22345,6 +22557,9 @@ function printFirstRunNotice() {
|
|
|
22345
22557
|
);
|
|
22346
22558
|
markFirstRunNoticeShown();
|
|
22347
22559
|
}
|
|
22560
|
+
function seedWhatsNewVersion(version) {
|
|
22561
|
+
if (getWhatsNewSeenVersion() === null) setWhatsNewSeenVersion(version);
|
|
22562
|
+
}
|
|
22348
22563
|
async function resolveTelemetryConsent(opts) {
|
|
22349
22564
|
if (opts.disableFlag) {
|
|
22350
22565
|
writeConsentFlag(false);
|
|
@@ -22409,6 +22624,7 @@ function parseInitArgs(args) {
|
|
|
22409
22624
|
return {
|
|
22410
22625
|
nonInteractive: args.includes("--yes") || args.includes("-y"),
|
|
22411
22626
|
noTelemetry: args.includes("--no-telemetry"),
|
|
22627
|
+
noAllowlist: args.includes("--no-allowlist"),
|
|
22412
22628
|
fromTar,
|
|
22413
22629
|
wantsLocal: args.includes("--local"),
|
|
22414
22630
|
wantsGlobal: args.includes("--global")
|
|
@@ -22543,6 +22759,8 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22543
22759
|
|
|
22544
22760
|
// ../argent-installer/src/install-runner.ts
|
|
22545
22761
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22762
|
+
import * as fs21 from "node:fs";
|
|
22763
|
+
import * as path23 from "node:path";
|
|
22546
22764
|
|
|
22547
22765
|
// ../argent-installer/src/shell.ts
|
|
22548
22766
|
import { execFileSync as execFileSync5, spawn as spawn2 } from "node:child_process";
|
|
@@ -22574,11 +22792,12 @@ var ShellCommandError = class extends Error {
|
|
|
22574
22792
|
signal;
|
|
22575
22793
|
};
|
|
22576
22794
|
function runShellCommand(cmd, opts = {}) {
|
|
22577
|
-
return new Promise((
|
|
22795
|
+
return new Promise((resolve21, reject) => {
|
|
22578
22796
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22579
22797
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22580
22798
|
shell: process.platform === "win32",
|
|
22581
|
-
...opts.cwd ? { cwd: opts.cwd } : {}
|
|
22799
|
+
...opts.cwd ? { cwd: opts.cwd } : {},
|
|
22800
|
+
...opts.env ? { env: opts.env } : {}
|
|
22582
22801
|
});
|
|
22583
22802
|
let stdout2 = "";
|
|
22584
22803
|
let stderr = "";
|
|
@@ -22589,7 +22808,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22589
22808
|
stderr += chunk.toString();
|
|
22590
22809
|
});
|
|
22591
22810
|
child.on("close", (code, signal) => {
|
|
22592
|
-
if (code === 0)
|
|
22811
|
+
if (code === 0) resolve21();
|
|
22593
22812
|
else
|
|
22594
22813
|
reject(
|
|
22595
22814
|
new ShellCommandError(
|
|
@@ -22605,8 +22824,8 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22605
22824
|
|
|
22606
22825
|
// ../argent-installer/src/skills.ts
|
|
22607
22826
|
import { execFileSync as execFileSync6 } from "node:child_process";
|
|
22608
|
-
import * as
|
|
22609
|
-
import * as
|
|
22827
|
+
import * as fs20 from "node:fs";
|
|
22828
|
+
import * as path22 from "node:path";
|
|
22610
22829
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
22611
22830
|
function getScopeSpecs(projectRoot) {
|
|
22612
22831
|
return [
|
|
@@ -22686,13 +22905,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
22686
22905
|
let candidates = names;
|
|
22687
22906
|
if (names.length === 0) {
|
|
22688
22907
|
try {
|
|
22689
|
-
candidates =
|
|
22908
|
+
candidates = fs20.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
22690
22909
|
} catch {
|
|
22691
22910
|
continue;
|
|
22692
22911
|
}
|
|
22693
22912
|
}
|
|
22694
22913
|
for (const name of candidates) {
|
|
22695
|
-
const stat6 =
|
|
22914
|
+
const stat6 = fs20.statSync(path22.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
22696
22915
|
if (!stat6?.isFile()) continue;
|
|
22697
22916
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
22698
22917
|
}
|
|
@@ -22710,7 +22929,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
|
|
|
22710
22929
|
const removed = /* @__PURE__ */ new Set();
|
|
22711
22930
|
for (const { targetPath } of skillTargets) {
|
|
22712
22931
|
for (const name of legacy) {
|
|
22713
|
-
const dir =
|
|
22932
|
+
const dir = path22.join(targetPath, name);
|
|
22714
22933
|
try {
|
|
22715
22934
|
if (removePath(dir)) removed.add(name);
|
|
22716
22935
|
} catch {
|
|
@@ -22730,13 +22949,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
22730
22949
|
}
|
|
22731
22950
|
function removeLockEntries(lockPath, names) {
|
|
22732
22951
|
try {
|
|
22733
|
-
const lock = JSON.parse(
|
|
22952
|
+
const lock = JSON.parse(fs20.readFileSync(lockPath, "utf8"));
|
|
22734
22953
|
const skills = lock.skills;
|
|
22735
22954
|
if (!skills) return [];
|
|
22736
22955
|
const removed = names.filter((name) => name in skills);
|
|
22737
22956
|
if (removed.length === 0) return [];
|
|
22738
22957
|
for (const name of removed) delete skills[name];
|
|
22739
|
-
|
|
22958
|
+
fs20.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
22740
22959
|
return removed;
|
|
22741
22960
|
} catch {
|
|
22742
22961
|
return [];
|
|
@@ -22801,6 +23020,9 @@ async function runInstall(args) {
|
|
|
22801
23020
|
}
|
|
22802
23021
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
22803
23022
|
}
|
|
23023
|
+
function installSpec(fromTar) {
|
|
23024
|
+
return fs21.existsSync(fromTar) ? path23.resolve(fromTar) : fromTar;
|
|
23025
|
+
}
|
|
22804
23026
|
async function installLocally(opts) {
|
|
22805
23027
|
const { fromTar, tel } = opts;
|
|
22806
23028
|
const projectRoot = resolveProjectRoot2(process.cwd());
|
|
@@ -22825,7 +23047,7 @@ async function installLocally(opts) {
|
|
|
22825
23047
|
return;
|
|
22826
23048
|
}
|
|
22827
23049
|
const pm = detectProjectPackageManager(projectRoot);
|
|
22828
|
-
const installTarget = fromTar
|
|
23050
|
+
const installTarget = fromTar ? installSpec(fromTar) : PACKAGE_NAME;
|
|
22829
23051
|
const materializeOnly = isDeclaredLocally(projectRoot) && !fromTar;
|
|
22830
23052
|
const cmd = materializeOnly ? projectInstallCommand(pm) : localInstallCommand(pm, installTarget);
|
|
22831
23053
|
const cmdStr = formatShellCommand(cmd);
|
|
@@ -22906,18 +23128,18 @@ async function runGlobal(opts) {
|
|
|
22906
23128
|
const { fromTar, nonInteractive, tel } = opts;
|
|
22907
23129
|
let version = opts.version;
|
|
22908
23130
|
const globallyInstalled = isGloballyInstalled();
|
|
23131
|
+
const pm = detectGlobalPackageManager();
|
|
22909
23132
|
if (!globallyInstalled) {
|
|
22910
23133
|
log.info(`Argent is not installed globally \u2014 installing.`);
|
|
22911
23134
|
track("installation:global_install_decision", { decision: "install" });
|
|
22912
|
-
const
|
|
22913
|
-
const installTarget = fromTar ?? PACKAGE_NAME;
|
|
23135
|
+
const installTarget = fromTar ? installSpec(fromTar) : PACKAGE_NAME;
|
|
22914
23136
|
const cmd = globalInstallCommand(pm, installTarget);
|
|
22915
23137
|
const cmdStr = formatShellCommand(cmd);
|
|
22916
23138
|
const spinner3 = spinner();
|
|
22917
23139
|
spinner3.start(`Installing ${PACKAGE_NAME} globally...`);
|
|
22918
23140
|
const packageActionStartedAt2 = performance.now();
|
|
22919
23141
|
try {
|
|
22920
|
-
await runShellCommand(cmd);
|
|
23142
|
+
await runShellCommand(cmd, globalCommandOptions(pm));
|
|
22921
23143
|
spinner3.stop(import_picocolors4.default.green("Installed globally."));
|
|
22922
23144
|
if (!isGloballyInstalled()) {
|
|
22923
23145
|
log.warn(
|
|
@@ -22942,19 +23164,18 @@ async function runGlobal(opts) {
|
|
|
22942
23164
|
return version;
|
|
22943
23165
|
}
|
|
22944
23166
|
if (fromTar) {
|
|
22945
|
-
const
|
|
22946
|
-
const cmd = globalInstallCommand(pm, fromTar);
|
|
23167
|
+
const cmd = globalInstallCommand(pm, installSpec(fromTar));
|
|
22947
23168
|
const cmdStr = formatShellCommand(cmd);
|
|
22948
23169
|
const spinner3 = spinner();
|
|
22949
23170
|
spinner3.start(`Installing from ${fromTar}...`);
|
|
22950
23171
|
try {
|
|
22951
|
-
await runShellCommand(cmd);
|
|
23172
|
+
await runShellCommand(cmd, globalCommandOptions(pm));
|
|
22952
23173
|
spinner3.stop(import_picocolors4.default.green("Installed from tarball."));
|
|
22953
23174
|
version = getGloballyInstalledVersion() ?? getInstalledVersion() ?? version;
|
|
22954
23175
|
} catch (err) {
|
|
22955
23176
|
spinner3.stop(import_picocolors4.default.red("Installation failed."));
|
|
22956
23177
|
log.error(`${err}`);
|
|
22957
|
-
log.info(`Install manually with: ${import_picocolors4.default.cyan(cmdStr)}`);
|
|
23178
|
+
log.info(`Install manually with: ${import_picocolors4.default.cyan(cmdStr)}${yarnClassicNote(cmd)}`);
|
|
22958
23179
|
await tel.finalize(INSTALL_FROM_TAR_PACKAGE_FAILED);
|
|
22959
23180
|
process.exit(1);
|
|
22960
23181
|
}
|
|
@@ -23011,14 +23232,13 @@ async function runGlobal(opts) {
|
|
|
23011
23232
|
if (isCancel(updateChoice) || updateChoice === "skip") {
|
|
23012
23233
|
await tel.trackPackageAction("update_skipped", packageActionStartedAt, true);
|
|
23013
23234
|
} else if (updateChoice === "update") {
|
|
23014
|
-
const pm = detectPackageManager();
|
|
23015
23235
|
const cmd = globalInstallCommand(pm, `${PACKAGE_NAME}@${latest}`);
|
|
23016
23236
|
const cmdStr = formatShellCommand(cmd);
|
|
23017
23237
|
const updateSpinner = spinner();
|
|
23018
23238
|
updateSpinner.start(`Updating to v${latest}...`);
|
|
23019
23239
|
const updateStartedAt = performance.now();
|
|
23020
23240
|
try {
|
|
23021
|
-
await runShellCommand(cmd);
|
|
23241
|
+
await runShellCommand(cmd, globalCommandOptions(pm));
|
|
23022
23242
|
updateSpinner.stop(import_picocolors4.default.green(`Updated to v${latest}.`));
|
|
23023
23243
|
version = getGloballyInstalledVersion() ?? getInstalledVersion() ?? version;
|
|
23024
23244
|
await tel.trackPackageAction("init_triggered_update", updateStartedAt, true);
|
|
@@ -23026,7 +23246,7 @@ async function runGlobal(opts) {
|
|
|
23026
23246
|
} catch (err) {
|
|
23027
23247
|
updateSpinner.stop(import_picocolors4.default.red("Update failed."));
|
|
23028
23248
|
log.error(`${err}`);
|
|
23029
|
-
log.info(`You can update manually later: ${import_picocolors4.default.cyan(cmdStr)}`);
|
|
23249
|
+
log.info(`You can update manually later: ${import_picocolors4.default.cyan(cmdStr)}${yarnClassicNote(cmd)}`);
|
|
23030
23250
|
await tel.trackPackageAction(
|
|
23031
23251
|
"update_failed",
|
|
23032
23252
|
updateStartedAt,
|
|
@@ -23108,8 +23328,8 @@ async function chooseAdapters(opts) {
|
|
|
23108
23328
|
|
|
23109
23329
|
// ../argent-installer/src/init-scope.ts
|
|
23110
23330
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
23111
|
-
import { existsSync as
|
|
23112
|
-
import { resolve as
|
|
23331
|
+
import { existsSync as existsSync14 } from "node:fs";
|
|
23332
|
+
import { resolve as resolve14 } from "node:path";
|
|
23113
23333
|
async function chooseScope(opts) {
|
|
23114
23334
|
if (opts.installMode === "local") {
|
|
23115
23335
|
return { scope: "local" };
|
|
@@ -23146,13 +23366,13 @@ async function chooseScope(opts) {
|
|
|
23146
23366
|
placeholder: process.cwd(),
|
|
23147
23367
|
validate(value) {
|
|
23148
23368
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
23149
|
-
const resolved =
|
|
23150
|
-
if (!
|
|
23369
|
+
const resolved = resolve14(value.trim());
|
|
23370
|
+
if (!existsSync14(resolved))
|
|
23151
23371
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
23152
23372
|
}
|
|
23153
23373
|
});
|
|
23154
23374
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
23155
|
-
return { scope: "custom", customRoot:
|
|
23375
|
+
return { scope: "custom", customRoot: resolve14(customPathInput.trim()) };
|
|
23156
23376
|
}
|
|
23157
23377
|
|
|
23158
23378
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23184,7 +23404,8 @@ function writeMcpConfigs(args) {
|
|
|
23184
23404
|
);
|
|
23185
23405
|
}
|
|
23186
23406
|
}
|
|
23187
|
-
const
|
|
23407
|
+
const globalCmdMode = resolveGlobalCommandMode();
|
|
23408
|
+
const entryFor = (configScope) => getMcpEntryForScope(installMode, configScope, localCmdMode, globalCmdMode);
|
|
23188
23409
|
const stillLocalMode = (root) => readInstallRecord(root)?.mode === "local" || isDeclaredLocally(root);
|
|
23189
23410
|
const keepsCommittedLocalEntry = (adapter, configPath, root) => {
|
|
23190
23411
|
if (installMode !== "global") return false;
|
|
@@ -23255,7 +23476,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23255
23476
|
const lines = [];
|
|
23256
23477
|
let removedCount = 0;
|
|
23257
23478
|
let warnedCount = 0;
|
|
23258
|
-
const globalArgentOnPath =
|
|
23479
|
+
const globalArgentOnPath = isArgentOnPath();
|
|
23259
23480
|
const isProvablyDead = (entry) => entry !== null && entry.command === MCP_BINARY_NAME && !globalArgentOnPath && !hasCustomizingEnv(entry);
|
|
23260
23481
|
const removed = (adapterName, location, what) => {
|
|
23261
23482
|
removedCount += 1;
|
|
@@ -23314,7 +23535,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23314
23535
|
} catch {
|
|
23315
23536
|
continue;
|
|
23316
23537
|
}
|
|
23317
|
-
if (entry === null) continue;
|
|
23538
|
+
if (entry === null || isPinnedGlobalEntry(entry)) continue;
|
|
23318
23539
|
if (isProvablyDead(entry)) {
|
|
23319
23540
|
pending.push({
|
|
23320
23541
|
adapterName: adapter.name,
|
|
@@ -23346,7 +23567,7 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23346
23567
|
} catch {
|
|
23347
23568
|
continue;
|
|
23348
23569
|
}
|
|
23349
|
-
if (entry !== null && entry.command !== MCP_BINARY_NAME) {
|
|
23570
|
+
if (entry !== null && entry.command !== MCP_BINARY_NAME && !isPinnedGlobalEntry(entry)) {
|
|
23350
23571
|
warned(
|
|
23351
23572
|
adapter.name,
|
|
23352
23573
|
projectPath,
|
|
@@ -23393,11 +23614,15 @@ async function cleanupStaleMcpConfigs(args) {
|
|
|
23393
23614
|
// ../argent-installer/src/init-allowlist.ts
|
|
23394
23615
|
var import_picocolors9 = __toESM(require_picocolors(), 1);
|
|
23395
23616
|
async function configureAllowlist(args) {
|
|
23396
|
-
const { adapters, effectiveRoot, scope, nonInteractive } = args;
|
|
23617
|
+
const { adapters, effectiveRoot, scope, nonInteractive, noAllowlist = false } = args;
|
|
23397
23618
|
const adaptersWithAllowlist = adapters.filter((a2) => a2.addAllowlist);
|
|
23398
23619
|
const adaptersWithoutAllowlist = adapters.filter((a2) => !a2.addAllowlist);
|
|
23399
23620
|
let enabled = false;
|
|
23400
|
-
|
|
23621
|
+
let decidedBy = "default";
|
|
23622
|
+
if (noAllowlist) {
|
|
23623
|
+
decidedBy = "flag";
|
|
23624
|
+
log.info(import_picocolors9.default.dim("Skipped editor auto-approve lists (--no-allowlist)."));
|
|
23625
|
+
} else if (adaptersWithAllowlist.length > 0) {
|
|
23401
23626
|
log.info(
|
|
23402
23627
|
`By default, editors ask for confirmation before running each MCP tool.
|
|
23403
23628
|
Adding Argent to the auto-approve allowlist lets tools run without
|
|
@@ -23413,9 +23638,10 @@ async function configureAllowlist(args) {
|
|
|
23413
23638
|
});
|
|
23414
23639
|
if (isCancel(allowlistChoice)) throw new InitCancelled("allowlist");
|
|
23415
23640
|
enabled = allowlistChoice;
|
|
23641
|
+
decidedBy = "prompt";
|
|
23416
23642
|
}
|
|
23417
23643
|
}
|
|
23418
|
-
if (!enabled) return { enabled, lines: [] };
|
|
23644
|
+
if (!enabled) return { enabled, decidedBy, lines: [] };
|
|
23419
23645
|
const lines = [];
|
|
23420
23646
|
for (const adapter of adaptersWithAllowlist) {
|
|
23421
23647
|
const hasPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(effectiveRoot);
|
|
@@ -23424,6 +23650,11 @@ async function configureAllowlist(args) {
|
|
|
23424
23650
|
continue;
|
|
23425
23651
|
}
|
|
23426
23652
|
try {
|
|
23653
|
+
const skipReason = adapter.allowlistSkipReason?.(effectiveRoot, scope) ?? null;
|
|
23654
|
+
if (skipReason) {
|
|
23655
|
+
lines.push(`${import_picocolors9.default.yellow("-")} ${adapter.name} ${import_picocolors9.default.dim(`(skipped - ${skipReason})`)}`);
|
|
23656
|
+
continue;
|
|
23657
|
+
}
|
|
23427
23658
|
adapter.addAllowlist(effectiveRoot, scope);
|
|
23428
23659
|
lines.push(`${import_picocolors9.default.green("+")} ${adapter.name}`);
|
|
23429
23660
|
} catch (err) {
|
|
@@ -23435,14 +23666,14 @@ async function configureAllowlist(args) {
|
|
|
23435
23666
|
`${import_picocolors9.default.yellow("-")} ${adapter.name} ${import_picocolors9.default.dim("(no auto-approve API - configure manually)")}`
|
|
23436
23667
|
);
|
|
23437
23668
|
}
|
|
23438
|
-
return { enabled, lines };
|
|
23669
|
+
return { enabled, decidedBy, lines };
|
|
23439
23670
|
}
|
|
23440
23671
|
|
|
23441
23672
|
// ../argent-installer/src/init-skills.ts
|
|
23442
23673
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
23443
23674
|
import { spawn as spawn3 } from "node:child_process";
|
|
23444
|
-
import * as
|
|
23445
|
-
import * as
|
|
23675
|
+
import * as os4 from "node:os";
|
|
23676
|
+
import * as path24 from "node:path";
|
|
23446
23677
|
var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
|
|
23447
23678
|
function meaningfulLine(err) {
|
|
23448
23679
|
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));
|
|
@@ -23450,10 +23681,10 @@ function meaningfulLine(err) {
|
|
|
23450
23681
|
}
|
|
23451
23682
|
function bundledCopyFor(version) {
|
|
23452
23683
|
const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
|
|
23453
|
-
if (local.packageDir && local.version === version) return
|
|
23684
|
+
if (local.packageDir && local.version === version) return path24.join(local.packageDir, "skills");
|
|
23454
23685
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
23455
23686
|
if (globalRoot && getGloballyInstalledVersion() === version) {
|
|
23456
|
-
return
|
|
23687
|
+
return path24.join(globalRoot, "skills");
|
|
23457
23688
|
}
|
|
23458
23689
|
return SKILLS_DIR;
|
|
23459
23690
|
}
|
|
@@ -23549,7 +23780,7 @@ async function runSkillsStep(args) {
|
|
|
23549
23780
|
const useGitHubSource = online && !fromTar && version !== "unknown";
|
|
23550
23781
|
const skillsSource = useGitHubSource ? buildArgentSkillsSource(version) : SKILLS_DIR;
|
|
23551
23782
|
const bundledCopy = useGitHubSource ? bundledCopyFor(version) : SKILLS_DIR;
|
|
23552
|
-
const skillsRoot = scope === "global" ?
|
|
23783
|
+
const skillsRoot = scope === "global" ? os4.homedir() : effectiveRoot;
|
|
23553
23784
|
const skillsScope = scope === "global" ? "global" : "project";
|
|
23554
23785
|
const expected = listBundledSkills(bundledCopy);
|
|
23555
23786
|
const snapshot = () => snapshotArgentSkills(skillsRoot, skillsScope, expected);
|
|
@@ -23663,7 +23894,7 @@ async function runSkillsStep(args) {
|
|
|
23663
23894
|
};
|
|
23664
23895
|
}
|
|
23665
23896
|
function runNpxSkills(args, interactive, cwd) {
|
|
23666
|
-
return new Promise((
|
|
23897
|
+
return new Promise((resolve21, reject) => {
|
|
23667
23898
|
const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
23668
23899
|
const child = spawn3(npxCmd, args, {
|
|
23669
23900
|
env: npxChildEnv(),
|
|
@@ -23683,7 +23914,7 @@ function runNpxSkills(args, interactive, cwd) {
|
|
|
23683
23914
|
}
|
|
23684
23915
|
child.on("close", (code, signal) => {
|
|
23685
23916
|
if (code === 0) {
|
|
23686
|
-
|
|
23917
|
+
resolve21();
|
|
23687
23918
|
} else {
|
|
23688
23919
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
23689
23920
|
reject(
|
|
@@ -23843,13 +24074,18 @@ async function init2(args) {
|
|
|
23843
24074
|
}
|
|
23844
24075
|
}
|
|
23845
24076
|
writeCliRecord({ mode: tel.installMode, projectRoot, version });
|
|
24077
|
+
seedWhatsNewVersion(version);
|
|
23846
24078
|
const allowlist = await configureAllowlist({
|
|
23847
24079
|
adapters: writtenAdapters,
|
|
23848
24080
|
effectiveRoot,
|
|
23849
24081
|
scope: normalizedScope,
|
|
23850
|
-
nonInteractive: parsed.nonInteractive
|
|
24082
|
+
nonInteractive: parsed.nonInteractive,
|
|
24083
|
+
noAllowlist: parsed.noAllowlist
|
|
24084
|
+
});
|
|
24085
|
+
track("installation:allowlist_decision", {
|
|
24086
|
+
is_enabled: allowlist.enabled,
|
|
24087
|
+
decided_by: allowlist.decidedBy
|
|
23851
24088
|
});
|
|
23852
|
-
track("installation:allowlist_decision", { is_enabled: allowlist.enabled });
|
|
23853
24089
|
if (allowlist.enabled && allowlist.lines.length > 0) {
|
|
23854
24090
|
note(allowlist.lines.join("\n"), "Tool Auto-Approval");
|
|
23855
24091
|
}
|
|
@@ -23995,7 +24231,8 @@ function printBanner() {
|
|
|
23995
24231
|
// ../argent-installer/src/update.ts
|
|
23996
24232
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
23997
24233
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
23998
|
-
import * as
|
|
24234
|
+
import * as fs23 from "node:fs";
|
|
24235
|
+
import * as path30 from "node:path";
|
|
23999
24236
|
|
|
24000
24237
|
// ../argent-installer/src/install-targets.ts
|
|
24001
24238
|
function parseTargetFlags(args) {
|
|
@@ -24045,10 +24282,10 @@ async function promptInstallTargets(verb) {
|
|
|
24045
24282
|
|
|
24046
24283
|
// ../argent-installer/src/update-target.ts
|
|
24047
24284
|
var import_update_core = __toESM(require_dist3(), 1);
|
|
24048
|
-
async function resolveInstallableUpdateTarget(pm, current) {
|
|
24285
|
+
async function resolveInstallableUpdateTarget(pm, current, cwd) {
|
|
24049
24286
|
const info = await (0, import_update_core.fetchRegistryInfo)(`${NPM_REGISTRY}/${PACKAGE_NAME}`);
|
|
24050
24287
|
if (info === null) return null;
|
|
24051
|
-
const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm);
|
|
24288
|
+
const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm, cwd);
|
|
24052
24289
|
const target = (0, import_update_core.pickInstallableTarget)(info.latest, info.times, current, minReleaseAgeMs);
|
|
24053
24290
|
return {
|
|
24054
24291
|
latestVersion: info.latest.version,
|
|
@@ -24060,17 +24297,17 @@ async function resolveInstallableUpdateTarget(pm, current) {
|
|
|
24060
24297
|
|
|
24061
24298
|
// ../argent-tools-client/src/launcher.ts
|
|
24062
24299
|
import * as net from "node:net";
|
|
24063
|
-
import * as
|
|
24064
|
-
import * as
|
|
24300
|
+
import * as fs22 from "node:fs";
|
|
24301
|
+
import * as path25 from "node:path";
|
|
24065
24302
|
import * as readline from "node:readline";
|
|
24066
|
-
import { homedir as
|
|
24303
|
+
import { homedir as homedir7 } from "node:os";
|
|
24067
24304
|
import { spawn as spawn4, execFileSync as execFileSync7 } from "node:child_process";
|
|
24068
24305
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
24069
24306
|
import { mkdir, writeFile, readFile, readdir as readdir2, unlink, rename, chmod } from "node:fs/promises";
|
|
24070
|
-
var STATE_DIR =
|
|
24071
|
-
var STATE_FILE =
|
|
24072
|
-
var LOG_FILE =
|
|
24073
|
-
var LOCK_FILE =
|
|
24307
|
+
var STATE_DIR = path25.join(homedir7(), ".argent");
|
|
24308
|
+
var STATE_FILE = path25.join(STATE_DIR, "tool-server.json");
|
|
24309
|
+
var LOG_FILE = path25.join(STATE_DIR, "tool-server.log");
|
|
24310
|
+
var LOCK_FILE = path25.join(STATE_DIR, "tool-server.lock");
|
|
24074
24311
|
function isProcessAlive(pid) {
|
|
24075
24312
|
try {
|
|
24076
24313
|
process.kill(pid, 0);
|
|
@@ -24081,7 +24318,7 @@ function isProcessAlive(pid) {
|
|
|
24081
24318
|
}
|
|
24082
24319
|
function stateFileForBundle(bundlePath) {
|
|
24083
24320
|
const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
24084
|
-
return
|
|
24321
|
+
return path25.join(STATE_DIR, `tool-server-${key}.json`);
|
|
24085
24322
|
}
|
|
24086
24323
|
async function readStateFile(file) {
|
|
24087
24324
|
try {
|
|
@@ -24123,7 +24360,7 @@ async function readAllToolsServerStates() {
|
|
|
24123
24360
|
const out = [];
|
|
24124
24361
|
for (const name of names) {
|
|
24125
24362
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
24126
|
-
const file =
|
|
24363
|
+
const file = path25.join(STATE_DIR, name);
|
|
24127
24364
|
const state2 = await readStateFile(file);
|
|
24128
24365
|
if (state2) out.push({ file, state: state2 });
|
|
24129
24366
|
}
|
|
@@ -24169,21 +24406,21 @@ async function killToolServer(bundlePath) {
|
|
|
24169
24406
|
return alive;
|
|
24170
24407
|
}
|
|
24171
24408
|
function isPathWithin(child, parent) {
|
|
24172
|
-
const rel =
|
|
24173
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
24409
|
+
const rel = path25.relative(parent, child);
|
|
24410
|
+
return rel !== "" && !rel.startsWith("..") && !path25.isAbsolute(rel);
|
|
24174
24411
|
}
|
|
24175
24412
|
function tryRealpath(p) {
|
|
24176
24413
|
try {
|
|
24177
|
-
return
|
|
24414
|
+
return fs22.realpathSync(p);
|
|
24178
24415
|
} catch {
|
|
24179
24416
|
return p;
|
|
24180
24417
|
}
|
|
24181
24418
|
}
|
|
24182
24419
|
async function killToolServerForInstallDir(packageDir) {
|
|
24183
|
-
const parents = /* @__PURE__ */ new Set([
|
|
24420
|
+
const parents = /* @__PURE__ */ new Set([path25.resolve(packageDir), tryRealpath(packageDir)]);
|
|
24184
24421
|
let killed = 0;
|
|
24185
24422
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
24186
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
24423
|
+
const bundles = /* @__PURE__ */ new Set([path25.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
24187
24424
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
24188
24425
|
if (!matches2) continue;
|
|
24189
24426
|
const fresh = await readStateFile(file);
|
|
@@ -24201,7 +24438,7 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24201
24438
|
}
|
|
24202
24439
|
return killed;
|
|
24203
24440
|
}
|
|
24204
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24441
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs22.existsSync(p)) ?? "ps";
|
|
24205
24442
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24206
24443
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24207
24444
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -24248,14 +24485,14 @@ function couldBeOurToolServer(pid, marker) {
|
|
|
24248
24485
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
24249
24486
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
24250
24487
|
import { maxHeaderSize } from "node:http";
|
|
24251
|
-
import * as
|
|
24488
|
+
import * as path29 from "node:path";
|
|
24252
24489
|
|
|
24253
24490
|
// ../argent-tools-client/src/link-config.ts
|
|
24254
|
-
import * as
|
|
24255
|
-
import { homedir as
|
|
24491
|
+
import * as path26 from "node:path";
|
|
24492
|
+
import { homedir as homedir8 } from "node:os";
|
|
24256
24493
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
24257
|
-
var LINK_DIR =
|
|
24258
|
-
var LINK_FILE =
|
|
24494
|
+
var LINK_DIR = path26.join(homedir8(), ".argent");
|
|
24495
|
+
var LINK_FILE = path26.join(LINK_DIR, "link.json");
|
|
24259
24496
|
|
|
24260
24497
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24261
24498
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
@@ -24272,14 +24509,14 @@ import {
|
|
|
24272
24509
|
writeFile as writeFile3
|
|
24273
24510
|
} from "node:fs/promises";
|
|
24274
24511
|
import { constants, tmpdir } from "node:os";
|
|
24275
|
-
import * as
|
|
24512
|
+
import * as path27 from "node:path";
|
|
24276
24513
|
|
|
24277
24514
|
// ../archive/src/index.ts
|
|
24278
24515
|
import { spawn as spawn5 } from "node:child_process";
|
|
24279
24516
|
import { once } from "node:events";
|
|
24280
24517
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
24281
24518
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24282
|
-
import { basename as
|
|
24519
|
+
import { basename as basename5, dirname as dirname14, join as join24, resolve as resolve16, sep as sep4 } from "node:path";
|
|
24283
24520
|
import { Writable } from "node:stream";
|
|
24284
24521
|
import { pipeline } from "node:stream/promises";
|
|
24285
24522
|
import zlib2 from "node:zlib";
|
|
@@ -24297,14 +24534,23 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
24297
24534
|
// ../argent-tools-client/src/flow-files.ts
|
|
24298
24535
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
24299
24536
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
24300
|
-
import * as
|
|
24537
|
+
import * as path28 from "node:path";
|
|
24301
24538
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
24302
24539
|
|
|
24303
24540
|
// ../argent-tools-client/src/artifacts.ts
|
|
24304
|
-
import {
|
|
24541
|
+
import {
|
|
24542
|
+
copyFile,
|
|
24543
|
+
mkdir as mkdir4,
|
|
24544
|
+
mkdtemp,
|
|
24545
|
+
readFile as readFile6,
|
|
24546
|
+
realpath as realpath4,
|
|
24547
|
+
rm as rm3,
|
|
24548
|
+
stat as stat5,
|
|
24549
|
+
writeFile as writeFile4
|
|
24550
|
+
} from "node:fs/promises";
|
|
24305
24551
|
import { constants as fsConstants } from "node:fs";
|
|
24306
24552
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24307
|
-
import { basename as
|
|
24553
|
+
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";
|
|
24308
24554
|
import { createHash as createHash5 } from "node:crypto";
|
|
24309
24555
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
24310
24556
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -24378,6 +24624,9 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24378
24624
|
if (trigger === "mcp_update") return "mcp_update";
|
|
24379
24625
|
return installed ? "standalone_update" : "standalone_install";
|
|
24380
24626
|
}
|
|
24627
|
+
function isLivePinnedEntry(entry) {
|
|
24628
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs23.existsSync(entry.command) && fs23.existsSync(entry.args[0]);
|
|
24629
|
+
}
|
|
24381
24630
|
async function update(args) {
|
|
24382
24631
|
const nonInteractive = args.includes("--yes") || args.includes("-y");
|
|
24383
24632
|
const noTelemetry = args.includes("--no-telemetry");
|
|
@@ -24474,7 +24723,8 @@ async function update(args) {
|
|
|
24474
24723
|
}
|
|
24475
24724
|
const spinner2 = spinner();
|
|
24476
24725
|
spinner2.start("Checking for updates...");
|
|
24477
|
-
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) :
|
|
24726
|
+
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
24727
|
+
const runIn = mode === "local" ? { cwd: projectRoot } : globalCommandOptions(pm);
|
|
24478
24728
|
let latest = null;
|
|
24479
24729
|
let target;
|
|
24480
24730
|
let minReleaseAgeMs = 0;
|
|
@@ -24483,7 +24733,7 @@ async function update(args) {
|
|
|
24483
24733
|
} else {
|
|
24484
24734
|
let resolved;
|
|
24485
24735
|
try {
|
|
24486
|
-
resolved = await resolveInstallableUpdateTarget(pm, installed);
|
|
24736
|
+
resolved = await resolveInstallableUpdateTarget(pm, installed, runIn.cwd);
|
|
24487
24737
|
} catch (err) {
|
|
24488
24738
|
spinner2.stop(import_picocolors12.default.red("Could not reach registry."));
|
|
24489
24739
|
await trackPackageAction(
|
|
@@ -24579,9 +24829,8 @@ async function update(args) {
|
|
|
24579
24829
|
// Current versions ship no postinstall, but downgrades and pinned
|
|
24580
24830
|
// installs fetch older ones whose postinstall honors this — keep it
|
|
24581
24831
|
// so they stay quiet and don't double-kill the tool server.
|
|
24582
|
-
env: { ...process.env, ARGENT_SKIP_POSTINSTALL: "1" },
|
|
24583
|
-
|
|
24584
|
-
...mode === "local" ? { cwd: projectRoot } : {}
|
|
24832
|
+
env: { ...runIn.env ?? process.env, ARGENT_SKIP_POSTINSTALL: "1" },
|
|
24833
|
+
cwd: runIn.cwd
|
|
24585
24834
|
});
|
|
24586
24835
|
},
|
|
24587
24836
|
() => {
|
|
@@ -24602,6 +24851,8 @@ async function update(args) {
|
|
|
24602
24851
|
UPDATE_PACKAGE_ACTION_FAILED
|
|
24603
24852
|
);
|
|
24604
24853
|
log.error(`${installed ? "Update" : "Install"} failed: ${installError}`);
|
|
24854
|
+
const note2 = yarnClassicNote(cmd);
|
|
24855
|
+
if (note2) log.info(`Run ${import_picocolors12.default.cyan(cmdStr)}${note2}.`);
|
|
24605
24856
|
return { failed: UPDATE_PACKAGE_ACTION_FAILED };
|
|
24606
24857
|
}
|
|
24607
24858
|
log.warn(
|
|
@@ -24663,7 +24914,7 @@ async function update(args) {
|
|
|
24663
24914
|
process.exit(1);
|
|
24664
24915
|
}
|
|
24665
24916
|
const rootOverride = getProjectRootOverride(args);
|
|
24666
|
-
const projectRoot = rootOverride ?
|
|
24917
|
+
const projectRoot = rootOverride ? path30.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
24667
24918
|
installMode = resolveInstallMode(projectRoot);
|
|
24668
24919
|
const flags = parseTargetFlags(args);
|
|
24669
24920
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -24731,8 +24982,10 @@ async function update(args) {
|
|
|
24731
24982
|
spinner2.start("Refreshing workspace configuration...");
|
|
24732
24983
|
const results = [];
|
|
24733
24984
|
const localCmdMode = installMode === "local" ? resolveLocalCommandMode(projectRoot) : null;
|
|
24985
|
+
const globalCmdMode = resolveGlobalCommandMode();
|
|
24986
|
+
const globalInstallOnPath = isGlobalInstallFirstOnPath();
|
|
24734
24987
|
const skipEntryRewrite = localCmdMode?.kind === "local-npx";
|
|
24735
|
-
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode);
|
|
24988
|
+
const entryFor = (scope) => getMcpEntryForScope(installMode, scope, localCmdMode, globalCmdMode);
|
|
24736
24989
|
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
|
|
24737
24990
|
const adaptersByScope = /* @__PURE__ */ new Map([
|
|
24738
24991
|
["local", /* @__PURE__ */ new Set()],
|
|
@@ -24755,9 +25008,20 @@ async function update(args) {
|
|
|
24755
25008
|
);
|
|
24756
25009
|
continue;
|
|
24757
25010
|
}
|
|
25011
|
+
const entry = entryFor(normScope);
|
|
25012
|
+
const replacesLivePin = isLivePinnedEntry(existing) && !isPinnedGlobalEntry(entry);
|
|
25013
|
+
if (replacesLivePin && normScope === "local") continue;
|
|
25014
|
+
if (replacesLivePin && !globalInstallOnPath) {
|
|
25015
|
+
results.push(
|
|
25016
|
+
`${import_picocolors12.default.yellow("!")} ${adapter.name} kept its absolute-path entry (no global install found first on PATH) ${import_picocolors12.default.dim(configPath)}`
|
|
25017
|
+
);
|
|
25018
|
+
continue;
|
|
25019
|
+
}
|
|
24758
25020
|
try {
|
|
24759
|
-
adapter.write(configPath,
|
|
24760
|
-
results.push(
|
|
25021
|
+
adapter.write(configPath, entry);
|
|
25022
|
+
results.push(
|
|
25023
|
+
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)}`
|
|
25024
|
+
);
|
|
24761
25025
|
} catch {
|
|
24762
25026
|
}
|
|
24763
25027
|
}
|
|
@@ -24768,15 +25032,12 @@ async function update(args) {
|
|
|
24768
25032
|
)
|
|
24769
25033
|
);
|
|
24770
25034
|
}
|
|
24771
|
-
const
|
|
24772
|
-
|
|
24773
|
-
|
|
24774
|
-
|
|
24775
|
-
|
|
24776
|
-
|
|
24777
|
-
adapter.addAllowlist(projectRoot, scope);
|
|
24778
|
-
} catch {
|
|
24779
|
-
}
|
|
25035
|
+
for (const [scope, adapters] of adaptersByScope) {
|
|
25036
|
+
for (const adapter of adapters) {
|
|
25037
|
+
if (!adapter.refreshAllowlist) continue;
|
|
25038
|
+
try {
|
|
25039
|
+
adapter.refreshAllowlist(projectRoot, scope);
|
|
25040
|
+
} catch {
|
|
24780
25041
|
}
|
|
24781
25042
|
}
|
|
24782
25043
|
}
|
|
@@ -24787,11 +25048,6 @@ async function update(args) {
|
|
|
24787
25048
|
...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
|
|
24788
25049
|
];
|
|
24789
25050
|
spinner2.stop("Configuration refreshed.");
|
|
24790
|
-
if (allowlistDisabled) {
|
|
24791
|
-
log.info(
|
|
24792
|
-
import_picocolors12.default.dim("Left editor auto-approve allowlists alone (allowlist.enabled is false).")
|
|
24793
|
-
);
|
|
24794
|
-
}
|
|
24795
25051
|
if (results.length > 0) {
|
|
24796
25052
|
note(results.join("\n"), "MCP Configs Updated");
|
|
24797
25053
|
}
|
|
@@ -24858,8 +25114,8 @@ async function update(args) {
|
|
|
24858
25114
|
// ../argent-installer/src/uninstall.ts
|
|
24859
25115
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
24860
25116
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
24861
|
-
import * as
|
|
24862
|
-
import * as
|
|
25117
|
+
import * as fs24 from "node:fs";
|
|
25118
|
+
import * as path31 from "node:path";
|
|
24863
25119
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
24864
25120
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
24865
25121
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -24880,10 +25136,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
24880
25136
|
};
|
|
24881
25137
|
function removeDirIfEmpty2(dirPath) {
|
|
24882
25138
|
try {
|
|
24883
|
-
if (!
|
|
24884
|
-
if (!
|
|
24885
|
-
if (
|
|
24886
|
-
|
|
25139
|
+
if (!fs24.existsSync(dirPath)) return false;
|
|
25140
|
+
if (!fs24.statSync(dirPath).isDirectory()) return false;
|
|
25141
|
+
if (fs24.readdirSync(dirPath).length > 0) return false;
|
|
25142
|
+
fs24.rmdirSync(dirPath);
|
|
24887
25143
|
return true;
|
|
24888
25144
|
} catch {
|
|
24889
25145
|
return false;
|
|
@@ -24893,9 +25149,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
24893
25149
|
const files = [];
|
|
24894
25150
|
const directories = [];
|
|
24895
25151
|
function walk(currentDir, relativeDir = "") {
|
|
24896
|
-
for (const entry of
|
|
24897
|
-
const relativePath = relativeDir ?
|
|
24898
|
-
const absolutePath =
|
|
25152
|
+
for (const entry of fs24.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25153
|
+
const relativePath = relativeDir ? path31.join(relativeDir, entry.name) : entry.name;
|
|
25154
|
+
const absolutePath = path31.join(currentDir, entry.name);
|
|
24899
25155
|
if (entry.isDirectory()) {
|
|
24900
25156
|
walk(absolutePath, relativePath);
|
|
24901
25157
|
directories.push(relativePath);
|
|
@@ -24908,52 +25164,52 @@ function collectBundledPaths(sourceDir) {
|
|
|
24908
25164
|
return { files, directories };
|
|
24909
25165
|
}
|
|
24910
25166
|
function removeBundledContent(sourceDir, targetDir) {
|
|
24911
|
-
if (!
|
|
25167
|
+
if (!fs24.existsSync(sourceDir) || !fs24.existsSync(targetDir)) {
|
|
24912
25168
|
return { removedPaths: [], removedRoot: false };
|
|
24913
25169
|
}
|
|
24914
25170
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
24915
25171
|
const removedPaths = [];
|
|
24916
25172
|
for (const relativePath of files) {
|
|
24917
|
-
const targetPath =
|
|
25173
|
+
const targetPath = path31.join(targetDir, relativePath);
|
|
24918
25174
|
try {
|
|
24919
|
-
|
|
24920
|
-
if (
|
|
25175
|
+
const entry = fs24.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25176
|
+
if (!entry || entry.isDirectory()) continue;
|
|
24921
25177
|
removePath(targetPath);
|
|
24922
25178
|
removedPaths.push(relativePath);
|
|
24923
25179
|
} catch {
|
|
24924
25180
|
}
|
|
24925
25181
|
}
|
|
24926
25182
|
directories.sort(
|
|
24927
|
-
(a2, b) => b.split(
|
|
25183
|
+
(a2, b) => b.split(path31.sep).length - a2.split(path31.sep).length || b.length - a2.length
|
|
24928
25184
|
);
|
|
24929
25185
|
for (const relativePath of directories) {
|
|
24930
|
-
const targetPath =
|
|
25186
|
+
const targetPath = path31.join(targetDir, relativePath);
|
|
24931
25187
|
try {
|
|
24932
|
-
if (!
|
|
24933
|
-
if (!
|
|
24934
|
-
if (
|
|
24935
|
-
|
|
25188
|
+
if (!fs24.existsSync(targetPath)) continue;
|
|
25189
|
+
if (!fs24.statSync(targetPath).isDirectory()) continue;
|
|
25190
|
+
if (fs24.readdirSync(targetPath).length > 0) continue;
|
|
25191
|
+
fs24.rmdirSync(targetPath);
|
|
24936
25192
|
} catch {
|
|
24937
25193
|
}
|
|
24938
25194
|
}
|
|
24939
25195
|
let removedRoot = false;
|
|
24940
25196
|
try {
|
|
24941
|
-
if (
|
|
24942
|
-
if (
|
|
24943
|
-
|
|
25197
|
+
if (fs24.existsSync(targetDir) && fs24.statSync(targetDir).isDirectory()) {
|
|
25198
|
+
if (fs24.readdirSync(targetDir).length === 0) {
|
|
25199
|
+
fs24.rmdirSync(targetDir);
|
|
24944
25200
|
removedRoot = true;
|
|
24945
25201
|
}
|
|
24946
25202
|
}
|
|
24947
25203
|
} catch {
|
|
24948
25204
|
}
|
|
24949
25205
|
if (removedRoot) {
|
|
24950
|
-
removeDirIfEmpty2(
|
|
25206
|
+
removeDirIfEmpty2(path31.dirname(targetDir));
|
|
24951
25207
|
}
|
|
24952
25208
|
return { removedPaths, removedRoot };
|
|
24953
25209
|
}
|
|
24954
25210
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
24955
25211
|
try {
|
|
24956
|
-
const content =
|
|
25212
|
+
const content = fs24.readFileSync(skillFilePath, "utf8");
|
|
24957
25213
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
24958
25214
|
if (!frontmatter) return fallbackName;
|
|
24959
25215
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -24964,23 +25220,23 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
24964
25220
|
}
|
|
24965
25221
|
}
|
|
24966
25222
|
function getBundledSkillNames(skillsDir) {
|
|
24967
|
-
if (!
|
|
25223
|
+
if (!fs24.existsSync(skillsDir)) return [];
|
|
24968
25224
|
const skillNames = [];
|
|
24969
|
-
for (const entry of
|
|
25225
|
+
for (const entry of fs24.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
24970
25226
|
if (!entry.isDirectory()) continue;
|
|
24971
|
-
const skillFilePath =
|
|
24972
|
-
if (!
|
|
25227
|
+
const skillFilePath = path31.join(skillsDir, entry.name, "SKILL.md");
|
|
25228
|
+
if (!fs24.existsSync(skillFilePath)) continue;
|
|
24973
25229
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
24974
25230
|
}
|
|
24975
25231
|
return [...new Set(skillNames)].sort();
|
|
24976
25232
|
}
|
|
24977
25233
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
24978
|
-
if (!
|
|
25234
|
+
if (!fs24.existsSync(targetDir)) {
|
|
24979
25235
|
return { removedPaths: [], removedRoot: false };
|
|
24980
25236
|
}
|
|
24981
25237
|
const removedPaths = [];
|
|
24982
25238
|
for (const skillName of skillNames) {
|
|
24983
|
-
const targetPath =
|
|
25239
|
+
const targetPath = path31.join(targetDir, skillName);
|
|
24984
25240
|
try {
|
|
24985
25241
|
if (removePath(targetPath)) removedPaths.push(skillName);
|
|
24986
25242
|
} catch {
|
|
@@ -24988,17 +25244,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
24988
25244
|
}
|
|
24989
25245
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
24990
25246
|
if (removedRoot) {
|
|
24991
|
-
removeDirIfEmpty2(
|
|
25247
|
+
removeDirIfEmpty2(path31.dirname(targetDir));
|
|
24992
25248
|
}
|
|
24993
25249
|
return { removedPaths, removedRoot };
|
|
24994
25250
|
}
|
|
24995
25251
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
24996
|
-
if (!
|
|
25252
|
+
if (!fs24.existsSync(lockPath)) {
|
|
24997
25253
|
return { removedSkills: [], removedFile: false };
|
|
24998
25254
|
}
|
|
24999
25255
|
let parsed;
|
|
25000
25256
|
try {
|
|
25001
|
-
parsed = JSON.parse(
|
|
25257
|
+
parsed = JSON.parse(fs24.readFileSync(lockPath, "utf8"));
|
|
25002
25258
|
} catch {
|
|
25003
25259
|
return { removedSkills: [], removedFile: false };
|
|
25004
25260
|
}
|
|
@@ -25025,10 +25281,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25025
25281
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25026
25282
|
);
|
|
25027
25283
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25028
|
-
|
|
25284
|
+
fs24.rmSync(lockPath, { force: true });
|
|
25029
25285
|
return { removedSkills, removedFile: true };
|
|
25030
25286
|
}
|
|
25031
|
-
|
|
25287
|
+
fs24.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25032
25288
|
return { removedSkills, removedFile: false };
|
|
25033
25289
|
}
|
|
25034
25290
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25131,7 +25387,7 @@ async function uninstall(args) {
|
|
|
25131
25387
|
removeTargets = targetDecision.targets;
|
|
25132
25388
|
}
|
|
25133
25389
|
const scopesToClean = /* @__PURE__ */ new Set(["local", "global"]);
|
|
25134
|
-
if (
|
|
25390
|
+
if (isArgentOnPath() && !removeTargets.includes("global")) {
|
|
25135
25391
|
scopesToClean.delete("global");
|
|
25136
25392
|
if (installMode === "global") scopesToClean.delete("local");
|
|
25137
25393
|
}
|
|
@@ -25231,7 +25487,7 @@ async function uninstall(args) {
|
|
|
25231
25487
|
),
|
|
25232
25488
|
{ ask: false }
|
|
25233
25489
|
);
|
|
25234
|
-
for (const root of retired.removedRoots) removeDirIfEmpty2(
|
|
25490
|
+
for (const root of retired.removedRoots) removeDirIfEmpty2(path31.dirname(root));
|
|
25235
25491
|
const retiredLines = formatRetiredCleanup(retired);
|
|
25236
25492
|
pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
|
|
25237
25493
|
const retiredKept = retiredLines.kept.map((line) => ` ${line}`);
|
|
@@ -25305,9 +25561,11 @@ async function uninstall(args) {
|
|
|
25305
25561
|
};
|
|
25306
25562
|
}
|
|
25307
25563
|
if (!globalPresent) return null;
|
|
25564
|
+
const pm = detectGlobalPackageManager();
|
|
25308
25565
|
return {
|
|
25309
25566
|
kind: "global",
|
|
25310
|
-
cmd: globalUninstallCommand(
|
|
25567
|
+
cmd: globalUninstallCommand(pm, PACKAGE_NAME),
|
|
25568
|
+
...globalCommandOptions(pm),
|
|
25311
25569
|
prompt: `Uninstall the global ${PACKAGE_NAME} package?`,
|
|
25312
25570
|
defaultRemove: false,
|
|
25313
25571
|
installDir: getGloballyInstalledPackageRoot()
|
|
@@ -25321,6 +25579,7 @@ async function uninstall(args) {
|
|
|
25321
25579
|
)
|
|
25322
25580
|
);
|
|
25323
25581
|
}
|
|
25582
|
+
let packageFailed = false;
|
|
25324
25583
|
for (const removable of removables) {
|
|
25325
25584
|
let shouldRemove = nonInteractive || removePreconfirmed;
|
|
25326
25585
|
if (!nonInteractive && !removePreconfirmed) {
|
|
@@ -25345,28 +25604,41 @@ async function uninstall(args) {
|
|
|
25345
25604
|
}
|
|
25346
25605
|
log.info(`Running: ${import_picocolors13.default.dim(formatShellCommand(removable.cmd))}`);
|
|
25347
25606
|
try {
|
|
25348
|
-
execShellCommandSync(removable.cmd,
|
|
25607
|
+
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25608
|
+
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25609
|
+
const removed = !leftover || removable.installDir !== null && !fs24.existsSync(removable.installDir);
|
|
25610
|
+
if (removed) hasUninstalledPackage = true;
|
|
25611
|
+
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25612
|
+
log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
|
|
25613
|
+
}
|
|
25614
|
+
if (leftover) {
|
|
25615
|
+
throw new Error(
|
|
25616
|
+
`${leftover} is still on PATH. Remove it with the package manager that installed it.`
|
|
25617
|
+
);
|
|
25618
|
+
}
|
|
25349
25619
|
log.success(`Removed ${removable.kind} package.`);
|
|
25350
|
-
hasUninstalledPackage = true;
|
|
25351
25620
|
if (removable.kind === "global") hasUninstalledGlobalPackage = true;
|
|
25352
25621
|
if (removable.kind === "local" && removeInstallRecord(projectRoot)) {
|
|
25353
25622
|
log.info(import_picocolors13.default.dim("Removed .argent/install.json (local mode marker)."));
|
|
25354
25623
|
}
|
|
25355
|
-
if (removeCliRecordFor(removable.installDir)) {
|
|
25356
|
-
log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
|
|
25357
|
-
}
|
|
25358
25624
|
} catch (err) {
|
|
25359
25625
|
log.error(`${removable.kind} uninstall failed: ${err}`);
|
|
25360
|
-
|
|
25361
|
-
|
|
25362
|
-
|
|
25363
|
-
UNINSTALL_PACKAGE_ACTION_FAILED
|
|
25364
|
-
);
|
|
25365
|
-
return;
|
|
25626
|
+
const note2 = yarnClassicNote(removable.cmd);
|
|
25627
|
+
if (note2) log.info(`Run ${import_picocolors13.default.cyan(formatShellCommand(removable.cmd))}${note2}.`);
|
|
25628
|
+
packageFailed = true;
|
|
25366
25629
|
}
|
|
25367
25630
|
}
|
|
25631
|
+
if (packageFailed) {
|
|
25632
|
+
await finalizeUninstallTelemetry(
|
|
25633
|
+
hasPrunedContent,
|
|
25634
|
+
hasUninstalledPackage,
|
|
25635
|
+
UNINSTALL_PACKAGE_ACTION_FAILED
|
|
25636
|
+
);
|
|
25637
|
+
process.exitCode = 1;
|
|
25638
|
+
return;
|
|
25639
|
+
}
|
|
25368
25640
|
await finalizeUninstallTelemetry(hasPrunedContent, hasUninstalledPackage);
|
|
25369
|
-
if (hasUninstalledGlobalPackage || hasUninstalledPackage && !
|
|
25641
|
+
if (hasUninstalledGlobalPackage || hasUninstalledPackage && !isArgentOnPath()) {
|
|
25370
25642
|
try {
|
|
25371
25643
|
await resetLocalTelemetryState();
|
|
25372
25644
|
} catch {
|