@swmansion/argent 0.35.1-next.7 → 0.35.1-next.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +16 -15
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +2821 -2159
- package/dist/cli.js +22 -3
- package/dist/cli.js.map +1 -1
- package/dist/client.js +760 -440
- package/dist/fatal-handlers.d.ts +1 -0
- package/dist/fatal-handlers.js +8 -2
- package/dist/fatal-handlers.js.map +1 -1
- package/dist/installer-help.js +4 -2
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +760 -705
- package/dist/mcp-server.mjs +1825 -1408
- package/dist/tool-args.generated.d.ts +409 -320
- package/dist/tool-server.cjs +17569 -12596
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/argent-audio-feeder +0 -0
- package/dylibs/tcp/libArgentAudio.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
- package/skills/argent-android-emulator-setup/SKILL.md +2 -2
- package/skills/argent-create-e2e/SKILL.md +2 -1
- package/skills/argent-create-e2e/references/e2e-yaml.md +40 -5
- package/skills/argent-create-e2e/references/live-authoring.md +14 -3
- package/skills/argent-device-interact/SKILL.md +21 -94
- package/skills/argent-device-interact/references/advanced.md +64 -0
- package/skills/argent-ios-device-interact/SKILL.md +1 -1
- package/skills/argent-ios-device-setup/SKILL.md +1 -1
- package/skills/argent-ios-simulator-setup/SKILL.md +1 -1
- package/skills/argent-lens/SKILL.md +1 -1
- package/skills/argent-macos-app-interact/SKILL.md +1 -1
- package/skills/argent-metro-debugger/SKILL.md +4 -4
- package/skills/argent-native-profiler/SKILL.md +1 -1
- package/skills/argent-qa-e2e/SKILL.md +1 -1
- package/skills/argent-react-native-app-workflow/SKILL.md +1 -1
- package/skills/argent-react-native-optimization/SKILL.md +1 -1
- package/skills/argent-react-native-profiler/SKILL.md +1 -1
- package/skills/argent-screen-recording/SKILL.md +1 -1
- package/skills/argent-screenshot-diff/SKILL.md +1 -1
- package/skills/argent-settings-permissions/SKILL.md +1 -1
- package/skills/argent-test-ui-flow/SKILL.md +1 -1
- package/skills/argent-tv-interact/SKILL.md +1 -1
package/dist/installer.mjs
CHANGED
|
@@ -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 parse6 = (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 = parse6;
|
|
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 parse6 = require_parse();
|
|
2077
2077
|
var valid = (version, options) => {
|
|
2078
|
-
const v =
|
|
2078
|
+
const v = parse6(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 parse6 = require_parse();
|
|
2090
2090
|
var clean = (version, options) => {
|
|
2091
|
-
const s =
|
|
2091
|
+
const s = parse6(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 parse6 = require_parse();
|
|
2127
2127
|
var diff = (version1, version2) => {
|
|
2128
|
-
const v1 =
|
|
2129
|
-
const v2 =
|
|
2128
|
+
const v1 = parse6(version1, null, true);
|
|
2129
|
+
const v2 = parse6(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 parse6 = require_parse();
|
|
2201
2201
|
var prerelease = (version, options) => {
|
|
2202
|
-
const parsed =
|
|
2202
|
+
const parsed = parse6(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 parse6 = 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 parse6(`${major2}.${minor}.${patch}${prerelease}${build}`, options);
|
|
2424
2424
|
};
|
|
2425
2425
|
module.exports = coerce;
|
|
2426
2426
|
}
|
|
@@ -2430,11 +2430,11 @@ 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
|
|
2434
|
-
var
|
|
2433
|
+
var parse6 = require_parse();
|
|
2434
|
+
var constants4 = require_constants();
|
|
2435
2435
|
var SemVer = require_semver();
|
|
2436
2436
|
var truncate = (version, truncation, options) => {
|
|
2437
|
-
if (!
|
|
2437
|
+
if (!constants4.RELEASE_TYPES.includes(truncation)) {
|
|
2438
2438
|
return null;
|
|
2439
2439
|
}
|
|
2440
2440
|
const clonedVersion = cloneInputVersion(version, 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 parse6(versionStringToParse, options);
|
|
2446
2446
|
};
|
|
2447
2447
|
var doTruncation = (version, truncation) => {
|
|
2448
2448
|
if (isPrerelease(truncation)) {
|
|
@@ -3483,10 +3483,10 @@ var require_semver2 = __commonJS({
|
|
|
3483
3483
|
"../../node_modules/semver/index.js"(exports, module) {
|
|
3484
3484
|
"use strict";
|
|
3485
3485
|
var internalRe = require_re();
|
|
3486
|
-
var
|
|
3486
|
+
var constants4 = require_constants();
|
|
3487
3487
|
var SemVer = require_semver();
|
|
3488
3488
|
var identifiers = require_identifiers();
|
|
3489
|
-
var
|
|
3489
|
+
var parse6 = 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: parse6,
|
|
3529
3529
|
valid,
|
|
3530
3530
|
clean,
|
|
3531
3531
|
inc,
|
|
@@ -3567,8 +3567,8 @@ var require_semver2 = __commonJS({
|
|
|
3567
3567
|
re: internalRe.re,
|
|
3568
3568
|
src: internalRe.src,
|
|
3569
3569
|
tokens: internalRe.t,
|
|
3570
|
-
SEMVER_SPEC_VERSION:
|
|
3571
|
-
RELEASE_TYPES:
|
|
3570
|
+
SEMVER_SPEC_VERSION: constants4.SEMVER_SPEC_VERSION,
|
|
3571
|
+
RELEASE_TYPES: constants4.RELEASE_TYPES,
|
|
3572
3572
|
compareIdentifiers: identifiers.compareIdentifiers,
|
|
3573
3573
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
3574
3574
|
};
|
|
@@ -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, path35) {
|
|
3656
|
+
const ctrl = callVisitor(key, node, visitor, path35);
|
|
3657
3657
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3658
|
-
replaceNode(key,
|
|
3659
|
-
return visit_(key, ctrl, visitor,
|
|
3658
|
+
replaceNode(key, path35, ctrl);
|
|
3659
|
+
return visit_(key, ctrl, visitor, path35);
|
|
3660
3660
|
}
|
|
3661
3661
|
if (typeof ctrl !== "symbol") {
|
|
3662
3662
|
if (identity2.isCollection(node)) {
|
|
3663
|
-
|
|
3663
|
+
path35 = Object.freeze(path35.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, path35);
|
|
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
|
+
path35 = Object.freeze(path35.concat(node));
|
|
3677
|
+
const ck = visit_("key", node.key, visitor, path35);
|
|
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, path35);
|
|
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, path35) {
|
|
3704
|
+
const ctrl = await callVisitor(key, node, visitor, path35);
|
|
3705
3705
|
if (identity2.isNode(ctrl) || identity2.isPair(ctrl)) {
|
|
3706
|
-
replaceNode(key,
|
|
3707
|
-
return visitAsync_(key, ctrl, visitor,
|
|
3706
|
+
replaceNode(key, path35, ctrl);
|
|
3707
|
+
return visitAsync_(key, ctrl, visitor, path35);
|
|
3708
3708
|
}
|
|
3709
3709
|
if (typeof ctrl !== "symbol") {
|
|
3710
3710
|
if (identity2.isCollection(node)) {
|
|
3711
|
-
|
|
3711
|
+
path35 = Object.freeze(path35.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, path35);
|
|
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
|
+
path35 = Object.freeze(path35.concat(node));
|
|
3725
|
+
const ck = await visitAsync_("key", node.key, visitor, path35);
|
|
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, path35);
|
|
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, path35) {
|
|
3758
3758
|
if (typeof visitor === "function")
|
|
3759
|
-
return visitor(key, node,
|
|
3759
|
+
return visitor(key, node, path35);
|
|
3760
3760
|
if (identity2.isMap(node))
|
|
3761
|
-
return visitor.Map?.(key, node,
|
|
3761
|
+
return visitor.Map?.(key, node, path35);
|
|
3762
3762
|
if (identity2.isSeq(node))
|
|
3763
|
-
return visitor.Seq?.(key, node,
|
|
3763
|
+
return visitor.Seq?.(key, node, path35);
|
|
3764
3764
|
if (identity2.isPair(node))
|
|
3765
|
-
return visitor.Pair?.(key, node,
|
|
3765
|
+
return visitor.Pair?.(key, node, path35);
|
|
3766
3766
|
if (identity2.isScalar(node))
|
|
3767
|
-
return visitor.Scalar?.(key, node,
|
|
3767
|
+
return visitor.Scalar?.(key, node, path35);
|
|
3768
3768
|
if (identity2.isAlias(node))
|
|
3769
|
-
return visitor.Alias?.(key, node,
|
|
3769
|
+
return visitor.Alias?.(key, node, path35);
|
|
3770
3770
|
return void 0;
|
|
3771
3771
|
}
|
|
3772
|
-
function replaceNode(key,
|
|
3773
|
-
const parent =
|
|
3772
|
+
function replaceNode(key, path35, node) {
|
|
3773
|
+
const parent = path35[path35.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, path35, value) {
|
|
4386
4386
|
let v = value;
|
|
4387
|
-
for (let i2 =
|
|
4388
|
-
const k =
|
|
4387
|
+
for (let i2 = path35.length - 1; i2 >= 0; --i2) {
|
|
4388
|
+
const k = path35[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 = (path35) => path35 == null || typeof path35 === "object" && !!path35[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(path35, value) {
|
|
4438
|
+
if (isEmptyPath(path35))
|
|
4439
4439
|
this.add(value);
|
|
4440
4440
|
else {
|
|
4441
|
-
const [key, ...rest] =
|
|
4441
|
+
const [key, ...rest] = path35;
|
|
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(path35) {
|
|
4456
|
+
const [key, ...rest] = path35;
|
|
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(path35, keepScalar) {
|
|
4471
|
+
const [key, ...rest] = path35;
|
|
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(path35) {
|
|
4490
|
+
const [key, ...rest] = path35;
|
|
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(path35, value) {
|
|
4501
|
+
const [key, ...rest] = path35;
|
|
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(path35, value) {
|
|
7017
7017
|
if (assertCollection(this.contents))
|
|
7018
|
-
this.contents.addIn(
|
|
7018
|
+
this.contents.addIn(path35, 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(path35) {
|
|
7094
|
+
if (Collection.isEmptyPath(path35)) {
|
|
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(path35) : 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(path35, keepScalar) {
|
|
7116
|
+
if (Collection.isEmptyPath(path35))
|
|
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(path35, 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(path35) {
|
|
7130
|
+
if (Collection.isEmptyPath(path35))
|
|
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(path35) : 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(path35, value) {
|
|
7150
|
+
if (Collection.isEmptyPath(path35)) {
|
|
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(path35), value);
|
|
7154
7154
|
} else if (assertCollection(this.contents)) {
|
|
7155
|
-
this.contents.setIn(
|
|
7155
|
+
this.contents.setIn(path35, 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: sep10, value } = collItem;
|
|
7542
7542
|
const keyProps = resolveProps.resolveProps(start, {
|
|
7543
7543
|
indicator: "explicit-key-ind",
|
|
7544
|
-
next: key ??
|
|
7544
|
+
next: key ?? sep10?.[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 && !sep10) {
|
|
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(sep10 ?? [], {
|
|
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, sep10, 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 sep10 = "";
|
|
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 += sep10 + cb;
|
|
7704
|
+
sep10 = "";
|
|
7705
7705
|
break;
|
|
7706
7706
|
}
|
|
7707
7707
|
case "newline":
|
|
7708
7708
|
if (comment)
|
|
7709
|
-
|
|
7709
|
+
sep10 += 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: sep10, 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 ?? sep10?.[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 && !sep10 && !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 && !sep10 && !props.found) {
|
|
7818
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep10, 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(sep10 ?? [], {
|
|
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 (sep10)
|
|
7842
|
+
for (const st of sep10) {
|
|
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, sep10, 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 sep10 = "";
|
|
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 += sep10 + indent.slice(trimIndent) + content;
|
|
8057
|
+
sep10 = "\n";
|
|
8058
8058
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
8059
|
-
if (
|
|
8060
|
-
|
|
8061
|
-
else if (!prevMoreIndented &&
|
|
8062
|
-
|
|
8063
|
-
value +=
|
|
8064
|
-
|
|
8059
|
+
if (sep10 === " ")
|
|
8060
|
+
sep10 = "\n";
|
|
8061
|
+
else if (!prevMoreIndented && sep10 === "\n")
|
|
8062
|
+
sep10 = "\n\n";
|
|
8063
|
+
value += sep10 + indent.slice(trimIndent) + content;
|
|
8064
|
+
sep10 = "\n";
|
|
8065
8065
|
prevMoreIndented = true;
|
|
8066
8066
|
} else if (content === "") {
|
|
8067
|
-
if (
|
|
8067
|
+
if (sep10 === "\n")
|
|
8068
8068
|
value += "\n";
|
|
8069
8069
|
else
|
|
8070
|
-
|
|
8070
|
+
sep10 = "\n";
|
|
8071
8071
|
} else {
|
|
8072
|
-
value +=
|
|
8073
|
-
|
|
8072
|
+
value += sep10 + content;
|
|
8073
|
+
sep10 = " ";
|
|
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 sep10 = " ";
|
|
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 (sep10 === "\n")
|
|
8262
|
+
res += sep10;
|
|
8263
8263
|
else
|
|
8264
|
-
|
|
8264
|
+
sep10 = "\n";
|
|
8265
8265
|
} else {
|
|
8266
|
-
res +=
|
|
8267
|
-
|
|
8266
|
+
res += sep10 + lm;
|
|
8267
|
+
sep10 = " ";
|
|
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 + sep10 + (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: sep10, 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 (sep10)
|
|
9091
|
+
for (const st of sep10)
|
|
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, path35) => {
|
|
9117
9117
|
let item = cst;
|
|
9118
|
-
for (const [field, index] of
|
|
9118
|
+
for (const [field, index] of path35) {
|
|
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, path35) => {
|
|
9128
|
+
const parent = visit2.itemAtPath(cst, path35.slice(0, -1));
|
|
9129
|
+
const field = path35[path35.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(path35, item, visitor) {
|
|
9136
|
+
let ctrl = visitor(item, path35);
|
|
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(path35.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, path35);
|
|
9155
9155
|
}
|
|
9156
9156
|
}
|
|
9157
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
9157
|
+
return typeof ctrl === "function" ? ctrl(item, path35) : 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 sep10;
|
|
10259
10259
|
if (scalar.end) {
|
|
10260
|
-
|
|
10261
|
-
|
|
10260
|
+
sep10 = scalar.end;
|
|
10261
|
+
sep10.push(this.sourceToken);
|
|
10262
10262
|
delete scalar.end;
|
|
10263
10263
|
} else
|
|
10264
|
-
|
|
10264
|
+
sep10 = [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: sep10 }]
|
|
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 sep10 = it.sep;
|
|
10423
|
+
sep10.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: sep10 }]
|
|
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 fs28 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs28, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs28);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs28, 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 fs28 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs28, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs28);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs28, 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 sep10 = fc.end.splice(1, fc.end.length);
|
|
10625
|
+
sep10.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: sep10 }]
|
|
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 parse6(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 = parse6;
|
|
10850
10850
|
exports.parseAllDocuments = parseAllDocuments;
|
|
10851
10851
|
exports.parseDocument = parseDocument2;
|
|
10852
10852
|
exports.stringify = stringify2;
|
|
@@ -11008,13 +11008,13 @@ var require_min_release_age = __commonJS({
|
|
|
11008
11008
|
return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
|
|
11009
11009
|
}
|
|
11010
11010
|
function probe(p, cwd) {
|
|
11011
|
-
return new Promise((
|
|
11011
|
+
return new Promise((resolve22) => {
|
|
11012
11012
|
(0, node_child_process_1.exec)(p.command, { cwd, timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
|
|
11013
11013
|
if (err) {
|
|
11014
|
-
|
|
11014
|
+
resolve22(0);
|
|
11015
11015
|
return;
|
|
11016
11016
|
}
|
|
11017
|
-
|
|
11017
|
+
resolve22(p.parse(stdout2));
|
|
11018
11018
|
});
|
|
11019
11019
|
});
|
|
11020
11020
|
}
|
|
@@ -11047,12 +11047,12 @@ var require_registry = __commonJS({
|
|
|
11047
11047
|
var node_https_1 = __importDefault(__require("node:https"));
|
|
11048
11048
|
var REQUEST_TIMEOUT_MS = 1e4;
|
|
11049
11049
|
function fetchRegistryInfo2(url) {
|
|
11050
|
-
return new Promise((
|
|
11050
|
+
return new Promise((resolve22) => {
|
|
11051
11051
|
let resolved = false;
|
|
11052
11052
|
const safeResolve = (value) => {
|
|
11053
11053
|
if (!resolved) {
|
|
11054
11054
|
resolved = true;
|
|
11055
|
-
|
|
11055
|
+
resolve22(value);
|
|
11056
11056
|
}
|
|
11057
11057
|
};
|
|
11058
11058
|
const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
|
|
@@ -12992,8 +12992,8 @@ var Deferred = class {
|
|
|
12992
12992
|
_resolve;
|
|
12993
12993
|
_reject;
|
|
12994
12994
|
constructor() {
|
|
12995
|
-
this._promise = new Promise((
|
|
12996
|
-
this._resolve =
|
|
12995
|
+
this._promise = new Promise((resolve22, reject) => {
|
|
12996
|
+
this._resolve = resolve22;
|
|
12997
12997
|
this._reject = reject;
|
|
12998
12998
|
});
|
|
12999
12999
|
}
|
|
@@ -13886,8 +13886,8 @@ var ExportOperation = class {
|
|
|
13886
13886
|
_metrics;
|
|
13887
13887
|
_exportScheduledResolve;
|
|
13888
13888
|
constructor(exporter, logRecords, exportTimeoutMillis, metrics) {
|
|
13889
|
-
this._exportScheduledPromise = new Promise((
|
|
13890
|
-
this._exportScheduledResolve =
|
|
13889
|
+
this._exportScheduledPromise = new Promise((resolve22) => {
|
|
13890
|
+
this._exportScheduledResolve = resolve22;
|
|
13891
13891
|
});
|
|
13892
13892
|
this._exportCompleted = this._executeExport(exporter, logRecords, exportTimeoutMillis);
|
|
13893
13893
|
this._metrics = metrics;
|
|
@@ -13912,7 +13912,7 @@ var ExportOperation = class {
|
|
|
13912
13912
|
}
|
|
13913
13913
|
}
|
|
13914
13914
|
async _exportWithTimeout(exporter, logRecords, exportTimeoutMillis) {
|
|
13915
|
-
return new Promise((
|
|
13915
|
+
return new Promise((resolve22, reject) => {
|
|
13916
13916
|
const timer = setTimeout(() => {
|
|
13917
13917
|
reject(new Error("Timeout"));
|
|
13918
13918
|
}, exportTimeoutMillis);
|
|
@@ -13920,7 +13920,7 @@ var ExportOperation = class {
|
|
|
13920
13920
|
this._metrics.finishLogs(logRecords.length, result.error);
|
|
13921
13921
|
clearTimeout(timer);
|
|
13922
13922
|
if (result.code === ExportResultCode.SUCCESS) {
|
|
13923
|
-
|
|
13923
|
+
resolve22();
|
|
13924
13924
|
} else {
|
|
13925
13925
|
reject(result.error ?? new Error("BatchLogRecordProcessor: log record export failed"));
|
|
13926
13926
|
}
|
|
@@ -14701,7 +14701,7 @@ function parseRetryAfterToMills(retryAfter) {
|
|
|
14701
14701
|
var DEFAULT_USER_AGENT = `OTel-OTLP-Exporter-JavaScript/${VERSION4}`;
|
|
14702
14702
|
var MAX_RESPONSE_BODY_SIZE = 4 * 1024 * 1024;
|
|
14703
14703
|
function sendWithHttp(request, url, headers, compression, userAgent, agent, data, timeoutMillis) {
|
|
14704
|
-
return new Promise((
|
|
14704
|
+
return new Promise((resolve22) => {
|
|
14705
14705
|
const parsedUrl = new URL(url);
|
|
14706
14706
|
if (userAgent) {
|
|
14707
14707
|
headers["User-Agent"] = `${userAgent} ${DEFAULT_USER_AGENT}`;
|
|
@@ -14720,7 +14720,7 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14720
14720
|
responseSize += chunk.length;
|
|
14721
14721
|
if (responseSize > MAX_RESPONSE_BODY_SIZE) {
|
|
14722
14722
|
const sizeError = new Error(`OTLP export response body exceeded size limit of ${MAX_RESPONSE_BODY_SIZE} bytes`);
|
|
14723
|
-
|
|
14723
|
+
resolve22({ status: "failure", error: sizeError });
|
|
14724
14724
|
res.destroy();
|
|
14725
14725
|
return;
|
|
14726
14726
|
}
|
|
@@ -14728,18 +14728,18 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14728
14728
|
});
|
|
14729
14729
|
res.on("end", () => {
|
|
14730
14730
|
if (res.statusCode && res.statusCode <= 299) {
|
|
14731
|
-
|
|
14731
|
+
resolve22({
|
|
14732
14732
|
status: "success",
|
|
14733
14733
|
data: Buffer.concat(responseData)
|
|
14734
14734
|
});
|
|
14735
14735
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14736
|
-
|
|
14736
|
+
resolve22({
|
|
14737
14737
|
status: "retryable",
|
|
14738
14738
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
14739
14739
|
});
|
|
14740
14740
|
} else {
|
|
14741
14741
|
const error = new OTLPExporterError(res.statusMessage, res.statusCode, Buffer.concat(responseData).toString());
|
|
14742
|
-
|
|
14742
|
+
resolve22({
|
|
14743
14743
|
status: "failure",
|
|
14744
14744
|
error
|
|
14745
14745
|
});
|
|
@@ -14747,17 +14747,17 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14747
14747
|
});
|
|
14748
14748
|
res.on("error", (error) => {
|
|
14749
14749
|
if (res.statusCode && res.statusCode <= 299) {
|
|
14750
|
-
|
|
14750
|
+
resolve22({
|
|
14751
14751
|
status: "success"
|
|
14752
14752
|
});
|
|
14753
14753
|
} else if (res.statusCode && isExportHTTPErrorRetryable(res.statusCode)) {
|
|
14754
|
-
|
|
14754
|
+
resolve22({
|
|
14755
14755
|
status: "retryable",
|
|
14756
14756
|
error,
|
|
14757
14757
|
retryInMillis: parseRetryAfterToMills(res.headers["retry-after"])
|
|
14758
14758
|
});
|
|
14759
14759
|
} else {
|
|
14760
|
-
|
|
14760
|
+
resolve22({
|
|
14761
14761
|
status: "failure",
|
|
14762
14762
|
error
|
|
14763
14763
|
});
|
|
@@ -14766,26 +14766,26 @@ function sendWithHttp(request, url, headers, compression, userAgent, agent, data
|
|
|
14766
14766
|
});
|
|
14767
14767
|
req.setTimeout(timeoutMillis, () => {
|
|
14768
14768
|
req.destroy();
|
|
14769
|
-
|
|
14769
|
+
resolve22({
|
|
14770
14770
|
status: "retryable",
|
|
14771
14771
|
error: new Error("Request timed out")
|
|
14772
14772
|
});
|
|
14773
14773
|
});
|
|
14774
14774
|
req.on("error", (error) => {
|
|
14775
14775
|
if (isHttpTransportNetworkErrorRetryable(error)) {
|
|
14776
|
-
|
|
14776
|
+
resolve22({
|
|
14777
14777
|
status: "retryable",
|
|
14778
14778
|
error
|
|
14779
14779
|
});
|
|
14780
14780
|
} else {
|
|
14781
|
-
|
|
14781
|
+
resolve22({
|
|
14782
14782
|
status: "failure",
|
|
14783
14783
|
error
|
|
14784
14784
|
});
|
|
14785
14785
|
}
|
|
14786
14786
|
});
|
|
14787
14787
|
compressAndSend(req, compression, data, (error) => {
|
|
14788
|
-
|
|
14788
|
+
resolve22({
|
|
14789
14789
|
status: "failure",
|
|
14790
14790
|
error
|
|
14791
14791
|
});
|
|
@@ -14875,9 +14875,9 @@ var RetryingTransport = class {
|
|
|
14875
14875
|
this._transport = transport;
|
|
14876
14876
|
}
|
|
14877
14877
|
retry(data, timeoutMillis, inMillis) {
|
|
14878
|
-
return new Promise((
|
|
14878
|
+
return new Promise((resolve22, reject) => {
|
|
14879
14879
|
setTimeout(() => {
|
|
14880
|
-
this._transport.send(data, timeoutMillis).then(
|
|
14880
|
+
this._transport.send(data, timeoutMillis).then(resolve22, reject);
|
|
14881
14881
|
}, inMillis);
|
|
14882
14882
|
});
|
|
14883
14883
|
}
|
|
@@ -15012,7 +15012,7 @@ function appendRootPathToUrlIfNeeded(url) {
|
|
|
15012
15012
|
return void 0;
|
|
15013
15013
|
}
|
|
15014
15014
|
}
|
|
15015
|
-
function appendResourcePathToUrl(url,
|
|
15015
|
+
function appendResourcePathToUrl(url, path35) {
|
|
15016
15016
|
try {
|
|
15017
15017
|
new URL(url);
|
|
15018
15018
|
} catch {
|
|
@@ -15022,11 +15022,11 @@ function appendResourcePathToUrl(url, path33) {
|
|
|
15022
15022
|
if (!url.endsWith("/")) {
|
|
15023
15023
|
url = url + "/";
|
|
15024
15024
|
}
|
|
15025
|
-
url +=
|
|
15025
|
+
url += path35;
|
|
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 '${path35}' is not a valid URL, using 'undefined' instead of '${url}'`);
|
|
15030
15030
|
return void 0;
|
|
15031
15031
|
}
|
|
15032
15032
|
return url;
|
|
@@ -15137,44 +15137,53 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
15137
15137
|
init_esm();
|
|
15138
15138
|
|
|
15139
15139
|
// ../telemetry/src/debug.ts
|
|
15140
|
-
import * as
|
|
15140
|
+
import * as fs8 from "node:fs";
|
|
15141
15141
|
|
|
15142
15142
|
// ../telemetry/src/paths.ts
|
|
15143
|
-
import * as
|
|
15143
|
+
import * as path9 from "node:path";
|
|
15144
15144
|
|
|
15145
15145
|
// ../configuration-core/src/flags.ts
|
|
15146
15146
|
import * as fs2 from "node:fs";
|
|
15147
|
+
import * as path3 from "node:path";
|
|
15148
|
+
|
|
15149
|
+
// ../configuration-core/src/home.ts
|
|
15150
|
+
import * as os from "node:os";
|
|
15147
15151
|
import * as path2 from "node:path";
|
|
15148
|
-
|
|
15152
|
+
var ARGENT_HOME_DIR_ENV = "ARGENT_HOME_DIR";
|
|
15153
|
+
function nonEmpty(value) {
|
|
15154
|
+
if (value == void 0) return null;
|
|
15155
|
+
const trimmed = value.trim();
|
|
15156
|
+
return trimmed === "" ? null : value;
|
|
15157
|
+
}
|
|
15158
|
+
function resolveHomeDir(options = {}) {
|
|
15159
|
+
if (options.homeDir) return options.homeDir;
|
|
15160
|
+
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
15161
|
+
}
|
|
15162
|
+
function argentHomeDir(options = {}) {
|
|
15163
|
+
const override = options.homeDir ? null : nonEmpty(process.env[ARGENT_HOME_DIR_ENV]);
|
|
15164
|
+
return override ? path2.resolve(override.trim()) : path2.join(resolveHomeDir(options), ".argent");
|
|
15165
|
+
}
|
|
15166
|
+
|
|
15167
|
+
// ../configuration-core/src/flags.ts
|
|
15149
15168
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
15150
15169
|
function findProjectRoot(startDir) {
|
|
15151
|
-
let current =
|
|
15170
|
+
let current = path3.resolve(startDir);
|
|
15152
15171
|
while (true) {
|
|
15153
15172
|
for (const marker of PROJECT_MARKERS) {
|
|
15154
|
-
if (fs2.existsSync(
|
|
15173
|
+
if (fs2.existsSync(path3.join(current, marker))) return current;
|
|
15155
15174
|
}
|
|
15156
|
-
const parent =
|
|
15175
|
+
const parent = path3.dirname(current);
|
|
15157
15176
|
if (parent === current) return null;
|
|
15158
15177
|
current = parent;
|
|
15159
15178
|
}
|
|
15160
15179
|
}
|
|
15161
15180
|
function resolveProjectRoot(startDir) {
|
|
15162
|
-
return findProjectRoot(startDir) ??
|
|
15181
|
+
return findProjectRoot(startDir) ?? path3.resolve(startDir);
|
|
15163
15182
|
}
|
|
15164
15183
|
|
|
15165
15184
|
// ../configuration-core/src/paths.ts
|
|
15166
15185
|
import * as fs3 from "node:fs";
|
|
15167
|
-
import * as
|
|
15168
|
-
import * as path3 from "node:path";
|
|
15169
|
-
function nonEmpty(value) {
|
|
15170
|
-
if (value == void 0) return null;
|
|
15171
|
-
const trimmed = value.trim();
|
|
15172
|
-
return trimmed === "" ? null : value;
|
|
15173
|
-
}
|
|
15174
|
-
function resolveHomeDir(options = {}) {
|
|
15175
|
-
if (options.homeDir) return options.homeDir;
|
|
15176
|
-
return process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
15177
|
-
}
|
|
15186
|
+
import * as path4 from "node:path";
|
|
15178
15187
|
function isHomeDir(dir, options = {}) {
|
|
15179
15188
|
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
15180
15189
|
}
|
|
@@ -15182,27 +15191,22 @@ function canonicalPath(p) {
|
|
|
15182
15191
|
try {
|
|
15183
15192
|
return fs3.realpathSync.native(p);
|
|
15184
15193
|
} catch {
|
|
15185
|
-
return
|
|
15194
|
+
return path4.resolve(p);
|
|
15186
15195
|
}
|
|
15187
15196
|
}
|
|
15188
|
-
function argentHomeDir() {
|
|
15189
|
-
return path3.join(resolveHomeDir(), ".argent");
|
|
15190
|
-
}
|
|
15191
15197
|
function configDir(scope = "global", options = {}) {
|
|
15192
|
-
if (scope === "global")
|
|
15193
|
-
return path3.join(resolveHomeDir(options), ".argent");
|
|
15194
|
-
}
|
|
15198
|
+
if (scope === "global") return argentHomeDir(options);
|
|
15195
15199
|
const cwd = options.cwd ?? process.cwd();
|
|
15196
|
-
return
|
|
15200
|
+
return path4.join(resolveProjectRoot(cwd), ".argent");
|
|
15197
15201
|
}
|
|
15198
15202
|
function configFilePath(scope = "global", options = {}) {
|
|
15199
|
-
return
|
|
15203
|
+
return path4.join(configDir(scope, options), "config.json");
|
|
15200
15204
|
}
|
|
15201
15205
|
|
|
15202
15206
|
// ../configuration-core/src/config.ts
|
|
15203
15207
|
import * as crypto from "node:crypto";
|
|
15204
15208
|
import * as fs4 from "node:fs";
|
|
15205
|
-
import * as
|
|
15209
|
+
import * as path5 from "node:path";
|
|
15206
15210
|
function readConfigObject(scope = "global", options = {}) {
|
|
15207
15211
|
try {
|
|
15208
15212
|
const raw = fs4.readFileSync(configFilePath(scope, options), "utf8");
|
|
@@ -15302,7 +15306,7 @@ function updateConfig(mutate, scope = "global", options = {}) {
|
|
|
15302
15306
|
try {
|
|
15303
15307
|
const next = readConfigObject(scope, options);
|
|
15304
15308
|
mutate(next);
|
|
15305
|
-
const tmpPath =
|
|
15309
|
+
const tmpPath = path5.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
15306
15310
|
const fd = fs4.openSync(tmpPath, "wx", 384);
|
|
15307
15311
|
try {
|
|
15308
15312
|
fs4.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
@@ -15349,7 +15353,7 @@ function setWhatsNewSeenVersion(version, options = {}) {
|
|
|
15349
15353
|
// ../configuration-core/src/secrets.ts
|
|
15350
15354
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
15351
15355
|
import * as fs5 from "node:fs";
|
|
15352
|
-
import * as
|
|
15356
|
+
import * as path6 from "node:path";
|
|
15353
15357
|
|
|
15354
15358
|
// ../configuration-core/src/merge.ts
|
|
15355
15359
|
function mergeRestrictive(local, global2) {
|
|
@@ -15437,7 +15441,9 @@ var CONFIG_SCHEMA = [
|
|
|
15437
15441
|
default: true,
|
|
15438
15442
|
// Opt-in/out goes through the dedicated command so the live client is
|
|
15439
15443
|
// drained/reset, not just the file rewritten.
|
|
15440
|
-
manageCommand: "argent telemetry"
|
|
15444
|
+
manageCommand: "argent telemetry",
|
|
15445
|
+
// consent.ts keeps a ~/.argent opt-out under a moved home; show the same.
|
|
15446
|
+
userHomeOptOut: true
|
|
15441
15447
|
},
|
|
15442
15448
|
{
|
|
15443
15449
|
key: "autoUpdate.enabled",
|
|
@@ -15446,6 +15452,8 @@ var CONFIG_SCHEMA = [
|
|
|
15446
15452
|
parse: asBoolean,
|
|
15447
15453
|
merge: "prioritize-local",
|
|
15448
15454
|
default: true,
|
|
15455
|
+
// The global install is shared by every Argent home.
|
|
15456
|
+
userHomeOptOut: true,
|
|
15449
15457
|
example: "false"
|
|
15450
15458
|
},
|
|
15451
15459
|
{
|
|
@@ -15536,7 +15544,8 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
|
15536
15544
|
}
|
|
15537
15545
|
|
|
15538
15546
|
// ../configuration-core/src/config-access.ts
|
|
15539
|
-
import * as
|
|
15547
|
+
import * as fs6 from "node:fs";
|
|
15548
|
+
import * as path7 from "node:path";
|
|
15540
15549
|
function readScopeValue(def, scope, options) {
|
|
15541
15550
|
if (!def.scopes.includes(scope)) return void 0;
|
|
15542
15551
|
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
@@ -15545,8 +15554,11 @@ function readScopeValue(def, scope, options) {
|
|
|
15545
15554
|
function getConfigValue(def, options = {}) {
|
|
15546
15555
|
const local = readScopeValue(def, "project", options);
|
|
15547
15556
|
const global2 = readScopeValue(def, "global", options);
|
|
15548
|
-
const merged = applyMergePolicy(def.merge, local, global2);
|
|
15549
|
-
return merged
|
|
15557
|
+
const merged = applyMergePolicy(def.merge, local, global2) ?? def.default;
|
|
15558
|
+
if (!def.userHomeOptOut) return merged;
|
|
15559
|
+
const userHome = { homeDir: resolveHomeDir(options) };
|
|
15560
|
+
if (argentHomeDir(options) === argentHomeDir(userHome)) return merged;
|
|
15561
|
+
return readScopeValue(def, "global", userHome) === false ? false : merged;
|
|
15550
15562
|
}
|
|
15551
15563
|
function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
|
|
15552
15564
|
const def = requireDefinition(key, registry);
|
|
@@ -15567,13 +15579,23 @@ var UnknownConfigKeyError = class extends Error {
|
|
|
15567
15579
|
}
|
|
15568
15580
|
key;
|
|
15569
15581
|
};
|
|
15582
|
+
var AUTO_UPDATE_ENABLED_KEY = "autoUpdate.enabled";
|
|
15583
|
+
function isAutoUpdateEnabled() {
|
|
15584
|
+
return getConfigValueByKey(AUTO_UPDATE_ENABLED_KEY) === true;
|
|
15585
|
+
}
|
|
15586
|
+
|
|
15587
|
+
// ../configuration-core/src/cloud-android.ts
|
|
15588
|
+
import * as fs7 from "node:fs";
|
|
15589
|
+
import * as os2 from "node:os";
|
|
15590
|
+
import * as path8 from "node:path";
|
|
15591
|
+
var CLOUD_ANDROID_MARKER_TTL_MS = 2 * 6e4;
|
|
15570
15592
|
|
|
15571
15593
|
// ../telemetry/src/paths.ts
|
|
15572
15594
|
function identityFilePath() {
|
|
15573
|
-
return
|
|
15595
|
+
return path9.join(argentHomeDir(), "telemetry-id");
|
|
15574
15596
|
}
|
|
15575
15597
|
function debugLogPath() {
|
|
15576
|
-
return
|
|
15598
|
+
return path9.join(argentHomeDir(), "telemetry-debug.log");
|
|
15577
15599
|
}
|
|
15578
15600
|
|
|
15579
15601
|
// ../telemetry/src/debug.ts
|
|
@@ -15603,8 +15625,8 @@ function emitDebugPayload(payload) {
|
|
|
15603
15625
|
} catch {
|
|
15604
15626
|
}
|
|
15605
15627
|
try {
|
|
15606
|
-
|
|
15607
|
-
|
|
15628
|
+
fs8.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15629
|
+
fs8.appendFileSync(debugLogPath(), line + "\n");
|
|
15608
15630
|
} catch {
|
|
15609
15631
|
}
|
|
15610
15632
|
}
|
|
@@ -15792,16 +15814,16 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
15792
15814
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15793
15815
|
|
|
15794
15816
|
// ../registry/src/flow-file-refs.ts
|
|
15795
|
-
import * as
|
|
15796
|
-
import * as
|
|
15817
|
+
import * as fs10 from "node:fs/promises";
|
|
15818
|
+
import * as path11 from "node:path";
|
|
15797
15819
|
|
|
15798
15820
|
// ../registry/src/e2e-dirs.ts
|
|
15799
|
-
import * as
|
|
15800
|
-
import * as
|
|
15801
|
-
var E2E_DIR =
|
|
15802
|
-
var LEGACY_E2E_DIRS = Object.freeze([
|
|
15821
|
+
import * as fs9 from "node:fs/promises";
|
|
15822
|
+
import * as path10 from "node:path";
|
|
15823
|
+
var E2E_DIR = path10.join(".argent", "e2e");
|
|
15824
|
+
var LEGACY_E2E_DIRS = Object.freeze([path10.join(".argent", "flows")]);
|
|
15803
15825
|
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
15804
|
-
var E2E_DIR_NAMES = E2E_DIRS.map((dir) =>
|
|
15826
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path10.basename(dir));
|
|
15805
15827
|
|
|
15806
15828
|
// ../registry/src/tool-ids.ts
|
|
15807
15829
|
var TOOL_ID_ALIASES = Object.freeze({
|
|
@@ -16252,6 +16274,17 @@ var FAILURE_CODES = {
|
|
|
16252
16274
|
BOOT_HARMONY_STOP_TIMEOUT: "BOOT_HARMONY_STOP_TIMEOUT",
|
|
16253
16275
|
BOOT_HARMONY_MANAGER_EXITED: "BOOT_HARMONY_MANAGER_EXITED",
|
|
16254
16276
|
BOOT_HARMONY_START_FAILED: "BOOT_HARMONY_START_FAILED",
|
|
16277
|
+
/**
|
|
16278
|
+
* Argent Cloud Android emulators
|
|
16279
|
+
* @see [leases.ts](../../tool-server/src/utils/cloud-android/leases.ts)
|
|
16280
|
+
*/
|
|
16281
|
+
CLOUD_ANDROID_ACCESS_DENIED: "CLOUD_ANDROID_ACCESS_DENIED",
|
|
16282
|
+
CLOUD_ANDROID_ACQUIRE_FAILED: "CLOUD_ANDROID_ACQUIRE_FAILED",
|
|
16283
|
+
CLOUD_ANDROID_ADB_KEY_MISSING: "CLOUD_ANDROID_ADB_KEY_MISSING",
|
|
16284
|
+
CLOUD_ANDROID_ADB_SERVER_REMOTE: "CLOUD_ANDROID_ADB_SERVER_REMOTE",
|
|
16285
|
+
CLOUD_ANDROID_CONNECT_FAILED: "CLOUD_ANDROID_CONNECT_FAILED",
|
|
16286
|
+
CLOUD_ANDROID_LEASE_IN_USE: "CLOUD_ANDROID_LEASE_IN_USE",
|
|
16287
|
+
CLOUD_ANDROID_NO_EMULATOR: "CLOUD_ANDROID_NO_EMULATOR",
|
|
16255
16288
|
/**
|
|
16256
16289
|
* External device providers
|
|
16257
16290
|
* @see [external-devices.ts](../../tool-server/src/utils/external-devices.ts)
|
|
@@ -16650,7 +16683,7 @@ function sanitize(event, raw) {
|
|
|
16650
16683
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
16651
16684
|
|
|
16652
16685
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
16653
|
-
import { existsSync as
|
|
16686
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
16654
16687
|
var CLAUDE_CLOUD_ENV_KINDS = /* @__PURE__ */ new Set(["byoc", "anthropic_cloud"]);
|
|
16655
16688
|
var CLAUDE_REMOTE_ENTRYPOINTS = /* @__PURE__ */ new Set([
|
|
16656
16689
|
"remote",
|
|
@@ -16681,9 +16714,9 @@ function isReplitAgent(env) {
|
|
|
16681
16714
|
}
|
|
16682
16715
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16683
16716
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16684
|
-
function safeExists(fileExists,
|
|
16717
|
+
function safeExists(fileExists, path35) {
|
|
16685
16718
|
try {
|
|
16686
|
-
return fileExists(
|
|
16719
|
+
return fileExists(path35);
|
|
16687
16720
|
} catch {
|
|
16688
16721
|
return false;
|
|
16689
16722
|
}
|
|
@@ -16693,7 +16726,7 @@ function detectCloudAgent(env = process.env, opts = {}) {
|
|
|
16693
16726
|
if (isCursorCloud(env)) return "cursor";
|
|
16694
16727
|
if (isCopilotAgent(env)) return "copilot";
|
|
16695
16728
|
if (isReplitAgent(env)) return "replit";
|
|
16696
|
-
const fileExists = opts.fileExists ??
|
|
16729
|
+
const fileExists = opts.fileExists ?? existsSync4;
|
|
16697
16730
|
if (safeExists(fileExists, DEVIN_MARKER_PATH)) return "devin";
|
|
16698
16731
|
if (safeExists(fileExists, JULES_MARKER_PATH)) return "jules";
|
|
16699
16732
|
return null;
|
|
@@ -17103,7 +17136,7 @@ function isCi(env = process.env) {
|
|
|
17103
17136
|
var SESSION_ID = randomUUID4();
|
|
17104
17137
|
function readCliVersion() {
|
|
17105
17138
|
if (true) {
|
|
17106
|
-
return "0.35.1-next.
|
|
17139
|
+
return "0.35.1-next.71";
|
|
17107
17140
|
}
|
|
17108
17141
|
return "0.0.0";
|
|
17109
17142
|
}
|
|
@@ -17136,8 +17169,8 @@ function getBaseProps(runtime) {
|
|
|
17136
17169
|
|
|
17137
17170
|
// ../telemetry/src/identity.ts
|
|
17138
17171
|
import * as crypto2 from "node:crypto";
|
|
17139
|
-
import * as
|
|
17140
|
-
import * as
|
|
17172
|
+
import * as fs11 from "node:fs";
|
|
17173
|
+
import * as path12 from "node:path";
|
|
17141
17174
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17142
17175
|
var cached = null;
|
|
17143
17176
|
var fingerprintResolved = null;
|
|
@@ -17244,66 +17277,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17244
17277
|
function isCorruptIdFile(filePath) {
|
|
17245
17278
|
let isRegularFile;
|
|
17246
17279
|
try {
|
|
17247
|
-
isRegularFile =
|
|
17280
|
+
isRegularFile = fs11.lstatSync(filePath).isFile();
|
|
17248
17281
|
} catch {
|
|
17249
17282
|
return false;
|
|
17250
17283
|
}
|
|
17251
17284
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17252
17285
|
}
|
|
17253
17286
|
function writeIdFileAtomic(finalPath, id) {
|
|
17254
|
-
|
|
17287
|
+
fs11.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17255
17288
|
let occupant;
|
|
17256
17289
|
try {
|
|
17257
|
-
occupant =
|
|
17290
|
+
occupant = fs11.lstatSync(finalPath);
|
|
17258
17291
|
} catch (err) {
|
|
17259
17292
|
if (err.code !== "ENOENT") throw err;
|
|
17260
17293
|
}
|
|
17261
17294
|
if (occupant && !occupant.isFile()) {
|
|
17262
17295
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
17263
17296
|
}
|
|
17264
|
-
const tmpPath =
|
|
17297
|
+
const tmpPath = path12.join(
|
|
17265
17298
|
argentHomeDir(),
|
|
17266
17299
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17267
17300
|
);
|
|
17268
|
-
const fd =
|
|
17301
|
+
const fd = fs11.openSync(tmpPath, "wx", 384);
|
|
17269
17302
|
try {
|
|
17270
17303
|
try {
|
|
17271
|
-
|
|
17272
|
-
|
|
17304
|
+
fs11.writeSync(fd, id);
|
|
17305
|
+
fs11.fsyncSync(fd);
|
|
17273
17306
|
} finally {
|
|
17274
|
-
|
|
17307
|
+
fs11.closeSync(fd);
|
|
17275
17308
|
}
|
|
17276
|
-
|
|
17309
|
+
fs11.renameSync(tmpPath, finalPath);
|
|
17277
17310
|
} finally {
|
|
17278
17311
|
try {
|
|
17279
|
-
|
|
17312
|
+
fs11.unlinkSync(tmpPath);
|
|
17280
17313
|
} catch {
|
|
17281
17314
|
}
|
|
17282
17315
|
}
|
|
17283
17316
|
}
|
|
17284
17317
|
function mintRandomId(finalPath) {
|
|
17285
|
-
|
|
17318
|
+
fs11.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17286
17319
|
let value = crypto2.randomUUID();
|
|
17287
17320
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17288
|
-
const tmpPath =
|
|
17321
|
+
const tmpPath = path12.join(
|
|
17289
17322
|
argentHomeDir(),
|
|
17290
17323
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17291
17324
|
);
|
|
17292
17325
|
let fd;
|
|
17293
17326
|
try {
|
|
17294
|
-
fd =
|
|
17327
|
+
fd = fs11.openSync(tmpPath, "wx", 384);
|
|
17295
17328
|
} catch (err) {
|
|
17296
17329
|
if (err.code === "EEXIST") continue;
|
|
17297
17330
|
throw err;
|
|
17298
17331
|
}
|
|
17299
17332
|
try {
|
|
17300
17333
|
try {
|
|
17301
|
-
|
|
17302
|
-
|
|
17334
|
+
fs11.writeSync(fd, value);
|
|
17335
|
+
fs11.fsyncSync(fd);
|
|
17303
17336
|
} finally {
|
|
17304
|
-
|
|
17337
|
+
fs11.closeSync(fd);
|
|
17305
17338
|
}
|
|
17306
|
-
|
|
17339
|
+
fs11.linkSync(tmpPath, finalPath);
|
|
17307
17340
|
cached = { path: finalPath, id: value };
|
|
17308
17341
|
return value;
|
|
17309
17342
|
} catch (err) {
|
|
@@ -17322,7 +17355,7 @@ function mintRandomId(finalPath) {
|
|
|
17322
17355
|
throw err;
|
|
17323
17356
|
} finally {
|
|
17324
17357
|
try {
|
|
17325
|
-
|
|
17358
|
+
fs11.unlinkSync(tmpPath);
|
|
17326
17359
|
} catch {
|
|
17327
17360
|
}
|
|
17328
17361
|
}
|
|
@@ -17330,12 +17363,12 @@ function mintRandomId(finalPath) {
|
|
|
17330
17363
|
throw new Error("telemetry: failed to create identity after retries");
|
|
17331
17364
|
}
|
|
17332
17365
|
function claimCorruptOccupant(finalPath) {
|
|
17333
|
-
const claimed =
|
|
17366
|
+
const claimed = path12.join(
|
|
17334
17367
|
argentHomeDir(),
|
|
17335
17368
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17336
17369
|
);
|
|
17337
17370
|
try {
|
|
17338
|
-
|
|
17371
|
+
fs11.renameSync(finalPath, claimed);
|
|
17339
17372
|
} catch {
|
|
17340
17373
|
return null;
|
|
17341
17374
|
}
|
|
@@ -17344,7 +17377,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17344
17377
|
grabbed = tryReadId(claimed);
|
|
17345
17378
|
} finally {
|
|
17346
17379
|
try {
|
|
17347
|
-
|
|
17380
|
+
fs11.unlinkSync(claimed);
|
|
17348
17381
|
} catch {
|
|
17349
17382
|
}
|
|
17350
17383
|
}
|
|
@@ -17353,7 +17386,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17353
17386
|
function deleteAnonId() {
|
|
17354
17387
|
cached = null;
|
|
17355
17388
|
try {
|
|
17356
|
-
|
|
17389
|
+
fs11.unlinkSync(identityFilePath());
|
|
17357
17390
|
} catch (err) {
|
|
17358
17391
|
if (err.code !== "ENOENT") throw err;
|
|
17359
17392
|
}
|
|
@@ -17361,9 +17394,9 @@ function deleteAnonId() {
|
|
|
17361
17394
|
function tryReadId(filePath) {
|
|
17362
17395
|
let raw;
|
|
17363
17396
|
try {
|
|
17364
|
-
const stats =
|
|
17397
|
+
const stats = fs11.lstatSync(filePath);
|
|
17365
17398
|
if (!stats.isFile()) return null;
|
|
17366
|
-
raw =
|
|
17399
|
+
raw = fs11.readFileSync(filePath, "utf8");
|
|
17367
17400
|
} catch (err) {
|
|
17368
17401
|
if (err.code === "ENOENT") return null;
|
|
17369
17402
|
return null;
|
|
@@ -17377,12 +17410,12 @@ function tryReadId(filePath) {
|
|
|
17377
17410
|
import { execFileSync, spawn } from "node:child_process";
|
|
17378
17411
|
|
|
17379
17412
|
// ../native-devtools-ios/src/index.ts
|
|
17380
|
-
import * as
|
|
17381
|
-
import * as
|
|
17382
|
-
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ??
|
|
17383
|
-
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ??
|
|
17384
|
-
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ??
|
|
17385
|
-
var DYLIB_TVOS_DIR =
|
|
17413
|
+
import * as path13 from "node:path";
|
|
17414
|
+
import * as fs12 from "node:fs";
|
|
17415
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path13.join(__dirname, "..", "dylibs");
|
|
17416
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path13.join(__dirname, "..", "bin");
|
|
17417
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path13.join(DYLIB_DIR, "tcp");
|
|
17418
|
+
var DYLIB_TVOS_DIR = path13.join(DYLIB_DIR, "tvos");
|
|
17386
17419
|
function hostPlatformKey() {
|
|
17387
17420
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
17388
17421
|
return "linux-arm64";
|
|
@@ -17393,14 +17426,14 @@ function simulatorServerBinaryName() {
|
|
|
17393
17426
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
17394
17427
|
}
|
|
17395
17428
|
function platformBinDir() {
|
|
17396
|
-
return
|
|
17429
|
+
return path13.join(BIN_DIR, hostPlatformKey());
|
|
17397
17430
|
}
|
|
17398
17431
|
function simulatorServerBinaryPath() {
|
|
17399
17432
|
const binaryName = simulatorServerBinaryName();
|
|
17400
|
-
const p =
|
|
17401
|
-
if (!
|
|
17402
|
-
const flat =
|
|
17403
|
-
const migrationHint =
|
|
17433
|
+
const p = path13.join(platformBinDir(), binaryName);
|
|
17434
|
+
if (!fs12.existsSync(p)) {
|
|
17435
|
+
const flat = path13.join(BIN_DIR, binaryName);
|
|
17436
|
+
const migrationHint = fs12.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.` : "";
|
|
17404
17437
|
throw new Error(
|
|
17405
17438
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17406
17439
|
);
|
|
@@ -17429,12 +17462,12 @@ function resolveHostFingerprint() {
|
|
|
17429
17462
|
}
|
|
17430
17463
|
}
|
|
17431
17464
|
function resolveHostFingerprintAsync() {
|
|
17432
|
-
return new Promise((
|
|
17465
|
+
return new Promise((resolve22) => {
|
|
17433
17466
|
let binary;
|
|
17434
17467
|
try {
|
|
17435
17468
|
binary = simulatorServerBinaryPath();
|
|
17436
17469
|
} catch {
|
|
17437
|
-
|
|
17470
|
+
resolve22(null);
|
|
17438
17471
|
return;
|
|
17439
17472
|
}
|
|
17440
17473
|
let settled = false;
|
|
@@ -17447,7 +17480,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17447
17480
|
child?.kill("SIGKILL");
|
|
17448
17481
|
} catch {
|
|
17449
17482
|
}
|
|
17450
|
-
|
|
17483
|
+
resolve22(value);
|
|
17451
17484
|
};
|
|
17452
17485
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17453
17486
|
watchdog.unref?.();
|
|
@@ -17480,15 +17513,15 @@ function resolveHostFingerprintAsync() {
|
|
|
17480
17513
|
}
|
|
17481
17514
|
|
|
17482
17515
|
// ../telemetry/src/consent.ts
|
|
17483
|
-
import * as
|
|
17484
|
-
import * as
|
|
17516
|
+
import * as fs13 from "node:fs";
|
|
17517
|
+
import * as path14 from "node:path";
|
|
17485
17518
|
var cache = /* @__PURE__ */ new Map();
|
|
17486
17519
|
var sessionOverride = null;
|
|
17487
17520
|
function readConfigOverrideAt(filePath) {
|
|
17488
17521
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17489
17522
|
let stats;
|
|
17490
17523
|
try {
|
|
17491
|
-
stats =
|
|
17524
|
+
stats = fs13.lstatSync(filePath);
|
|
17492
17525
|
} catch {
|
|
17493
17526
|
cache.set(filePath, miss);
|
|
17494
17527
|
return null;
|
|
@@ -17505,7 +17538,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17505
17538
|
}
|
|
17506
17539
|
let parsedEnabled = null;
|
|
17507
17540
|
try {
|
|
17508
|
-
const raw =
|
|
17541
|
+
const raw = fs13.readFileSync(filePath, "utf8");
|
|
17509
17542
|
const json = JSON.parse(raw);
|
|
17510
17543
|
if (json && typeof json === "object") {
|
|
17511
17544
|
const t2 = json.telemetry;
|
|
@@ -17522,8 +17555,12 @@ function readConfigOverrideAt(filePath) {
|
|
|
17522
17555
|
function readPersistedConsent(cwd) {
|
|
17523
17556
|
const globalPath = configFilePath("global");
|
|
17524
17557
|
const projectPath = configFilePath("project", { cwd });
|
|
17558
|
+
const userConfigPath = path14.join(resolveHomeDir(), ".argent", "config.json");
|
|
17559
|
+
if (userConfigPath !== globalPath && readConfigOverrideAt(userConfigPath) === false) {
|
|
17560
|
+
return { enabled: false, detail: `${userConfigPath} (user)` };
|
|
17561
|
+
}
|
|
17525
17562
|
const global2 = readConfigOverrideAt(globalPath);
|
|
17526
|
-
const projectRoot =
|
|
17563
|
+
const projectRoot = path14.dirname(path14.dirname(projectPath));
|
|
17527
17564
|
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
17528
17565
|
if (project === false && global2 === false) {
|
|
17529
17566
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
@@ -17719,7 +17756,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
17719
17756
|
async function raceDrain(client2, timeoutMs) {
|
|
17720
17757
|
await Promise.race([
|
|
17721
17758
|
client2.shutdown(timeoutMs),
|
|
17722
|
-
new Promise((
|
|
17759
|
+
new Promise((resolve22) => setTimeout(resolve22, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
17723
17760
|
]);
|
|
17724
17761
|
}
|
|
17725
17762
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -17739,8 +17776,8 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17739
17776
|
}
|
|
17740
17777
|
|
|
17741
17778
|
// ../argent-installer/src/mcp-configs.ts
|
|
17742
|
-
import * as
|
|
17743
|
-
import * as
|
|
17779
|
+
import * as fs20 from "node:fs";
|
|
17780
|
+
import * as path21 from "node:path";
|
|
17744
17781
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
17745
17782
|
import { homedir as homedir5 } from "node:os";
|
|
17746
17783
|
|
|
@@ -17755,11 +17792,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17755
17792
|
|
|
17756
17793
|
// ../argent-installer/src/utils.ts
|
|
17757
17794
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17758
|
-
import * as
|
|
17759
|
-
import * as
|
|
17795
|
+
import * as fs19 from "node:fs";
|
|
17796
|
+
import * as path20 from "node:path";
|
|
17760
17797
|
import * as dns from "node:dns";
|
|
17761
17798
|
import { createHash as createHash2 } from "node:crypto";
|
|
17762
|
-
import * as
|
|
17799
|
+
import * as os4 from "node:os";
|
|
17763
17800
|
import { execFileSync as execFileSync4, execSync } from "node:child_process";
|
|
17764
17801
|
|
|
17765
17802
|
// ../../node_modules/smol-toml/dist/error.js
|
|
@@ -19482,11 +19519,11 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19482
19519
|
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
19483
19520
|
ensurePropertyComplete(offset + length);
|
|
19484
19521
|
},
|
|
19485
|
-
onSeparator: (
|
|
19522
|
+
onSeparator: (sep10, offset, length) => {
|
|
19486
19523
|
if (currentParent.type === "property") {
|
|
19487
|
-
if (
|
|
19524
|
+
if (sep10 === ":") {
|
|
19488
19525
|
currentParent.colonOffset = offset;
|
|
19489
|
-
} else if (
|
|
19526
|
+
} else if (sep10 === ",") {
|
|
19490
19527
|
ensurePropertyComplete(offset);
|
|
19491
19528
|
}
|
|
19492
19529
|
}
|
|
@@ -19502,12 +19539,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19502
19539
|
}
|
|
19503
19540
|
return result;
|
|
19504
19541
|
}
|
|
19505
|
-
function findNodeAtLocation(root,
|
|
19542
|
+
function findNodeAtLocation(root, path35) {
|
|
19506
19543
|
if (!root) {
|
|
19507
19544
|
return void 0;
|
|
19508
19545
|
}
|
|
19509
19546
|
let node = root;
|
|
19510
|
-
for (let segment of
|
|
19547
|
+
for (let segment of path35) {
|
|
19511
19548
|
if (typeof segment === "string") {
|
|
19512
19549
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19513
19550
|
return void 0;
|
|
@@ -19861,14 +19898,14 @@ function getNodeType(value) {
|
|
|
19861
19898
|
|
|
19862
19899
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19863
19900
|
function setProperty(text2, originalPath, value, options) {
|
|
19864
|
-
const
|
|
19901
|
+
const path35 = originalPath.slice();
|
|
19865
19902
|
const errors = [];
|
|
19866
19903
|
const root = parseTree(text2, errors);
|
|
19867
19904
|
let parent = void 0;
|
|
19868
19905
|
let lastSegment = void 0;
|
|
19869
|
-
while (
|
|
19870
|
-
lastSegment =
|
|
19871
|
-
parent = findNodeAtLocation(root,
|
|
19906
|
+
while (path35.length > 0) {
|
|
19907
|
+
lastSegment = path35.pop();
|
|
19908
|
+
parent = findNodeAtLocation(root, path35);
|
|
19872
19909
|
if (parent === void 0 && value !== void 0) {
|
|
19873
19910
|
if (typeof lastSegment === "string") {
|
|
19874
19911
|
value = { [lastSegment]: value };
|
|
@@ -20054,8 +20091,8 @@ var ParseErrorCode;
|
|
|
20054
20091
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
20055
20092
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
20056
20093
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
20057
|
-
function modify(text2,
|
|
20058
|
-
return setProperty(text2,
|
|
20094
|
+
function modify(text2, path35, value, options) {
|
|
20095
|
+
return setProperty(text2, path35, value, options);
|
|
20059
20096
|
}
|
|
20060
20097
|
function applyEdits(text2, edits) {
|
|
20061
20098
|
let sortedEdits = edits.slice(0).sort((a2, b) => {
|
|
@@ -20079,39 +20116,39 @@ function applyEdits(text2, edits) {
|
|
|
20079
20116
|
}
|
|
20080
20117
|
|
|
20081
20118
|
// ../argent-installer/src/package-root.ts
|
|
20082
|
-
import * as
|
|
20083
|
-
import * as
|
|
20119
|
+
import * as fs14 from "node:fs";
|
|
20120
|
+
import * as path15 from "node:path";
|
|
20084
20121
|
function resolvePackageRoot(dirname20) {
|
|
20085
|
-
let current =
|
|
20122
|
+
let current = path15.resolve(dirname20);
|
|
20086
20123
|
while (true) {
|
|
20087
|
-
if (
|
|
20088
|
-
const parent =
|
|
20089
|
-
if (parent === current) return
|
|
20124
|
+
if (fs14.existsSync(path15.join(current, "package.json"))) return current;
|
|
20125
|
+
const parent = path15.dirname(current);
|
|
20126
|
+
if (parent === current) return path15.resolve(dirname20);
|
|
20090
20127
|
current = parent;
|
|
20091
20128
|
}
|
|
20092
20129
|
}
|
|
20093
20130
|
|
|
20094
20131
|
// ../argent-installer/src/package-manager.ts
|
|
20095
20132
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
20096
|
-
import * as
|
|
20097
|
-
import * as
|
|
20098
|
-
import * as
|
|
20133
|
+
import * as fs17 from "node:fs";
|
|
20134
|
+
import * as os3 from "node:os";
|
|
20135
|
+
import * as path18 from "node:path";
|
|
20099
20136
|
|
|
20100
20137
|
// ../argent-installer/src/topology.ts
|
|
20101
20138
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
20102
|
-
import * as
|
|
20103
|
-
import * as
|
|
20139
|
+
import * as fs16 from "node:fs";
|
|
20140
|
+
import * as path17 from "node:path";
|
|
20104
20141
|
import { createRequire } from "node:module";
|
|
20105
20142
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20106
20143
|
|
|
20107
20144
|
// ../argent-installer/src/preflight.ts
|
|
20108
|
-
import * as
|
|
20109
|
-
import * as
|
|
20145
|
+
import * as fs15 from "node:fs";
|
|
20146
|
+
import * as path16 from "node:path";
|
|
20110
20147
|
function hasProjectPackageJson(projectRoot) {
|
|
20111
|
-
return
|
|
20148
|
+
return fs15.existsSync(path16.join(projectRoot, "package.json"));
|
|
20112
20149
|
}
|
|
20113
20150
|
function isYarnPnp(projectRoot) {
|
|
20114
|
-
return
|
|
20151
|
+
return fs15.existsSync(path16.join(projectRoot, ".pnp.cjs")) || fs15.existsSync(path16.join(projectRoot, ".pnp.loader.mjs"));
|
|
20115
20152
|
}
|
|
20116
20153
|
|
|
20117
20154
|
// ../argent-installer/src/topology.ts
|
|
@@ -20137,12 +20174,12 @@ function isTempRunnerPath(binaryPath) {
|
|
|
20137
20174
|
}
|
|
20138
20175
|
function isProjectBinPath(binaryPath) {
|
|
20139
20176
|
const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
|
|
20140
|
-
const binDir = norm(
|
|
20177
|
+
const binDir = norm(path17.dirname(path17.resolve(binaryPath)));
|
|
20141
20178
|
const prefix = process.env.npm_config_local_prefix;
|
|
20142
|
-
if (prefix && norm(
|
|
20143
|
-
for (let dir =
|
|
20144
|
-
if (norm(
|
|
20145
|
-
if (
|
|
20179
|
+
if (prefix && norm(path17.join(prefix, "node_modules", ".bin")) === binDir) return true;
|
|
20180
|
+
for (let dir = path17.resolve(process.cwd()); ; dir = path17.dirname(dir)) {
|
|
20181
|
+
if (norm(path17.join(dir, "node_modules", ".bin")) === binDir) return true;
|
|
20182
|
+
if (path17.dirname(dir) === dir) return false;
|
|
20146
20183
|
}
|
|
20147
20184
|
}
|
|
20148
20185
|
function getPermanentBinaryPaths() {
|
|
@@ -20190,8 +20227,8 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20190
20227
|
}
|
|
20191
20228
|
function readShimScript(binaryPath) {
|
|
20192
20229
|
try {
|
|
20193
|
-
if (
|
|
20194
|
-
return
|
|
20230
|
+
if (fs16.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20231
|
+
return fs16.readFileSync(binaryPath, "utf8");
|
|
20195
20232
|
} catch {
|
|
20196
20233
|
return null;
|
|
20197
20234
|
}
|
|
@@ -20202,7 +20239,7 @@ function shimTargetOf(binaryPath) {
|
|
|
20202
20239
|
const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
|
|
20203
20240
|
if (trailer) return trailer[1].trim();
|
|
20204
20241
|
const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
|
|
20205
|
-
return relative5 ?
|
|
20242
|
+
return relative5 ? path17.resolve(canonicalPath(path17.dirname(binaryPath)), relative5[1]) : null;
|
|
20206
20243
|
}
|
|
20207
20244
|
function globalPackageRootOf(binaryPath) {
|
|
20208
20245
|
const root = packageRootOf(binaryPath);
|
|
@@ -20212,9 +20249,9 @@ function globalPackageRootOf(binaryPath) {
|
|
|
20212
20249
|
}
|
|
20213
20250
|
function packageRootOf(binaryPath) {
|
|
20214
20251
|
try {
|
|
20215
|
-
const realPath =
|
|
20216
|
-
const root = resolvePackageRoot(
|
|
20217
|
-
const pkg = JSON.parse(
|
|
20252
|
+
const realPath = fs16.realpathSync(binaryPath);
|
|
20253
|
+
const root = resolvePackageRoot(path17.dirname(realPath));
|
|
20254
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(root, "package.json"), "utf8"));
|
|
20218
20255
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20219
20256
|
} catch {
|
|
20220
20257
|
return null;
|
|
@@ -20223,8 +20260,8 @@ function packageRootOf(binaryPath) {
|
|
|
20223
20260
|
function cliPathOf(packageRoot) {
|
|
20224
20261
|
const binSub = argentBinSubpath(packageRoot);
|
|
20225
20262
|
if (!binSub) return null;
|
|
20226
|
-
const cli =
|
|
20227
|
-
return
|
|
20263
|
+
const cli = path17.join(packageRoot, binSub);
|
|
20264
|
+
return fs16.existsSync(cli) ? cli : null;
|
|
20228
20265
|
}
|
|
20229
20266
|
function getGloballyInstalledLaunchPaths() {
|
|
20230
20267
|
if (process.platform === "win32") return null;
|
|
@@ -20234,8 +20271,8 @@ function getGloballyInstalledLaunchPaths() {
|
|
|
20234
20271
|
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20235
20272
|
if (!cli) return null;
|
|
20236
20273
|
try {
|
|
20237
|
-
const node =
|
|
20238
|
-
return
|
|
20274
|
+
const node = path17.join(fs16.realpathSync(path17.dirname(binaryPath)), "node");
|
|
20275
|
+
return fs16.existsSync(node) ? { node, cli } : null;
|
|
20239
20276
|
} catch {
|
|
20240
20277
|
return null;
|
|
20241
20278
|
}
|
|
@@ -20244,7 +20281,7 @@ function getGloballyInstalledVersion() {
|
|
|
20244
20281
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20245
20282
|
if (!pkgRoot) return null;
|
|
20246
20283
|
try {
|
|
20247
|
-
const pkg = JSON.parse(
|
|
20284
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(pkgRoot, "package.json"), "utf8"));
|
|
20248
20285
|
return pkg.version ?? null;
|
|
20249
20286
|
} catch {
|
|
20250
20287
|
return null;
|
|
@@ -20253,7 +20290,7 @@ function getGloballyInstalledVersion() {
|
|
|
20253
20290
|
function readManifestDeclaration(projectRoot) {
|
|
20254
20291
|
try {
|
|
20255
20292
|
const pkg = JSON.parse(
|
|
20256
|
-
|
|
20293
|
+
fs16.readFileSync(path17.join(projectRoot, "package.json"), "utf8")
|
|
20257
20294
|
);
|
|
20258
20295
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20259
20296
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20266,11 +20303,11 @@ function isDeclaredLocally(projectRoot) {
|
|
|
20266
20303
|
}
|
|
20267
20304
|
function resolveLocalArgentDir(projectRoot) {
|
|
20268
20305
|
try {
|
|
20269
|
-
const req = createRequire(
|
|
20270
|
-
return
|
|
20306
|
+
const req = createRequire(path17.join(projectRoot, "package.json"));
|
|
20307
|
+
return path17.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20271
20308
|
} catch {
|
|
20272
|
-
const plain =
|
|
20273
|
-
return
|
|
20309
|
+
const plain = path17.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20310
|
+
return fs16.existsSync(path17.join(plain, "package.json")) ? plain : null;
|
|
20274
20311
|
}
|
|
20275
20312
|
}
|
|
20276
20313
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20278,7 +20315,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20278
20315
|
if (packageDir) {
|
|
20279
20316
|
let version;
|
|
20280
20317
|
try {
|
|
20281
|
-
const pkg = JSON.parse(
|
|
20318
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(packageDir, "package.json"), "utf8"));
|
|
20282
20319
|
version = pkg.version ?? null;
|
|
20283
20320
|
} catch {
|
|
20284
20321
|
version = null;
|
|
@@ -20301,8 +20338,8 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20301
20338
|
}
|
|
20302
20339
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20303
20340
|
try {
|
|
20304
|
-
const pkgPath =
|
|
20305
|
-
const pkg = JSON.parse(
|
|
20341
|
+
const pkgPath = path17.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20342
|
+
const pkg = JSON.parse(fs16.readFileSync(pkgPath, "utf8"));
|
|
20306
20343
|
return pkg.version ?? null;
|
|
20307
20344
|
} catch {
|
|
20308
20345
|
return null;
|
|
@@ -20310,7 +20347,7 @@ function readLocalPackageVersionUncached(projectRoot) {
|
|
|
20310
20347
|
}
|
|
20311
20348
|
function argentBinSubpath(pkgDir) {
|
|
20312
20349
|
try {
|
|
20313
|
-
const pkg = JSON.parse(
|
|
20350
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(pkgDir, "package.json"), "utf8"));
|
|
20314
20351
|
if (typeof pkg.bin === "string") return pkg.bin;
|
|
20315
20352
|
if (pkg.bin && typeof pkg.bin === "object") {
|
|
20316
20353
|
return pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0] ?? null;
|
|
@@ -20327,16 +20364,16 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20327
20364
|
if (!binSub) return null;
|
|
20328
20365
|
let root = projectRoot;
|
|
20329
20366
|
try {
|
|
20330
|
-
root =
|
|
20367
|
+
root = fs16.realpathSync(projectRoot);
|
|
20331
20368
|
} catch {
|
|
20332
20369
|
}
|
|
20333
|
-
const stableRel =
|
|
20334
|
-
if (
|
|
20335
|
-
return stableRel.split(
|
|
20370
|
+
const stableRel = path17.join("node_modules", PACKAGE_NAME, binSub);
|
|
20371
|
+
if (fs16.existsSync(path17.join(root, stableRel))) {
|
|
20372
|
+
return stableRel.split(path17.sep).join("/");
|
|
20336
20373
|
}
|
|
20337
|
-
const abs =
|
|
20338
|
-
if (!
|
|
20339
|
-
return
|
|
20374
|
+
const abs = path17.join(pkgDir, binSub);
|
|
20375
|
+
if (!fs16.existsSync(abs)) return null;
|
|
20376
|
+
return path17.relative(root, abs).split(path17.sep).join("/");
|
|
20340
20377
|
}
|
|
20341
20378
|
|
|
20342
20379
|
// ../argent-installer/src/package-manager.ts
|
|
@@ -20369,10 +20406,10 @@ function detectGlobalPackageManager() {
|
|
|
20369
20406
|
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20370
20407
|
}
|
|
20371
20408
|
if (process.platform === "win32") {
|
|
20372
|
-
if (
|
|
20409
|
+
if (fs17.existsSync(path18.join(npmCopyBeside(path18.dirname(binaryPath)), "package.json"))) {
|
|
20373
20410
|
return "npm";
|
|
20374
20411
|
}
|
|
20375
|
-
if (
|
|
20412
|
+
if (fs17.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20376
20413
|
}
|
|
20377
20414
|
const shim = readShimScript(binaryPath);
|
|
20378
20415
|
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
@@ -20381,23 +20418,23 @@ function detectGlobalPackageManager() {
|
|
|
20381
20418
|
return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
|
|
20382
20419
|
}
|
|
20383
20420
|
function lockfileOwnerOf(root) {
|
|
20384
|
-
for (let dir =
|
|
20421
|
+
for (let dir = path18.dirname(root); path18.dirname(dir) !== dir; dir = path18.dirname(dir)) {
|
|
20385
20422
|
const pm = pmFromLockfile(dir);
|
|
20386
20423
|
if (pm) return pm;
|
|
20387
20424
|
}
|
|
20388
20425
|
return null;
|
|
20389
20426
|
}
|
|
20390
20427
|
function npmCopyBeside(binDir) {
|
|
20391
|
-
return process.platform === "win32" ?
|
|
20428
|
+
return process.platform === "win32" ? path18.join(binDir, "node_modules", PACKAGE_NAME) : path18.join(path18.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
|
|
20392
20429
|
}
|
|
20393
20430
|
function isInNpmLayout(binaryPath, root) {
|
|
20394
20431
|
const realRoot = canonicalPath(root);
|
|
20395
20432
|
let link = binaryPath;
|
|
20396
20433
|
for (let hop = 0; hop < 40; hop++) {
|
|
20397
|
-
const binDir = canonicalPath(
|
|
20434
|
+
const binDir = canonicalPath(path18.dirname(link));
|
|
20398
20435
|
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20399
20436
|
try {
|
|
20400
|
-
link =
|
|
20437
|
+
link = path18.resolve(binDir, fs17.readlinkSync(link));
|
|
20401
20438
|
} catch {
|
|
20402
20439
|
return false;
|
|
20403
20440
|
}
|
|
@@ -20416,7 +20453,7 @@ function asKnownPm(name) {
|
|
|
20416
20453
|
}
|
|
20417
20454
|
function pmFromPackageManagerField(dir) {
|
|
20418
20455
|
try {
|
|
20419
|
-
const pkg = JSON.parse(
|
|
20456
|
+
const pkg = JSON.parse(fs17.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20420
20457
|
if (typeof pkg.packageManager === "string") {
|
|
20421
20458
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20422
20459
|
}
|
|
@@ -20427,7 +20464,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20427
20464
|
}
|
|
20428
20465
|
function pmFromDevEngines(dir) {
|
|
20429
20466
|
try {
|
|
20430
|
-
const pkg = JSON.parse(
|
|
20467
|
+
const pkg = JSON.parse(fs17.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20431
20468
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20432
20469
|
const names = /* @__PURE__ */ new Set();
|
|
20433
20470
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20440,7 +20477,7 @@ function pmFromDevEngines(dir) {
|
|
|
20440
20477
|
}
|
|
20441
20478
|
}
|
|
20442
20479
|
function pmFromLockfile(dir) {
|
|
20443
|
-
const has = (file) =>
|
|
20480
|
+
const has = (file) => fs17.existsSync(path18.join(dir, file));
|
|
20444
20481
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20445
20482
|
if (has("yarn.lock")) return "yarn";
|
|
20446
20483
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20448,15 +20485,15 @@ function pmFromLockfile(dir) {
|
|
|
20448
20485
|
return null;
|
|
20449
20486
|
}
|
|
20450
20487
|
function pmFromWorkspaceMarker(dir) {
|
|
20451
|
-
return
|
|
20488
|
+
return fs17.existsSync(path18.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20452
20489
|
}
|
|
20453
20490
|
function detectProjectPackageManager(projectRoot) {
|
|
20454
|
-
let dir =
|
|
20491
|
+
let dir = path18.resolve(projectRoot);
|
|
20455
20492
|
for (; ; ) {
|
|
20456
20493
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20457
20494
|
if (pm) return pm;
|
|
20458
|
-
if (
|
|
20459
|
-
const parent =
|
|
20495
|
+
if (fs17.existsSync(path18.join(dir, ".git"))) break;
|
|
20496
|
+
const parent = path18.dirname(dir);
|
|
20460
20497
|
if (parent === dir) break;
|
|
20461
20498
|
dir = parent;
|
|
20462
20499
|
}
|
|
@@ -20476,8 +20513,8 @@ function globalInstallCommand(pm, pkg) {
|
|
|
20476
20513
|
}
|
|
20477
20514
|
function globalCommandOptions(pm) {
|
|
20478
20515
|
if (pm === "npm") return {};
|
|
20479
|
-
const home =
|
|
20480
|
-
const cwd =
|
|
20516
|
+
const home = os3.homedir();
|
|
20517
|
+
const cwd = fs17.existsSync(home) ? { cwd: home } : {};
|
|
20481
20518
|
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20482
20519
|
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20483
20520
|
return { ...cwd, env };
|
|
@@ -20509,11 +20546,11 @@ function ownsGlobalInstall(pm, runningRoot) {
|
|
|
20509
20546
|
localBuild = !isRegistrySpec(dependency?.version);
|
|
20510
20547
|
} else {
|
|
20511
20548
|
const dir = pm === "bun" ? /^([^\r\n]+) node_modules \(/.exec(output)?.[1] : output;
|
|
20512
|
-
if (!dir || !
|
|
20513
|
-
pkg = pm === "npm" ?
|
|
20514
|
-
localBuild =
|
|
20549
|
+
if (!dir || !path18.isAbsolute(dir)) return false;
|
|
20550
|
+
pkg = pm === "npm" ? path18.join(dir, PACKAGE_NAME) : path18.join(dir, "node_modules", PACKAGE_NAME);
|
|
20551
|
+
localBuild = fs17.lstatSync(pkg).isSymbolicLink();
|
|
20515
20552
|
}
|
|
20516
|
-
return !localBuild && !!pkg &&
|
|
20553
|
+
return !localBuild && !!pkg && path18.isAbsolute(pkg) && fs17.realpathSync(pkg) === runningRoot;
|
|
20517
20554
|
} catch {
|
|
20518
20555
|
return false;
|
|
20519
20556
|
}
|
|
@@ -20568,15 +20605,15 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20568
20605
|
}
|
|
20569
20606
|
|
|
20570
20607
|
// ../argent-installer/src/install-record.ts
|
|
20571
|
-
import * as
|
|
20572
|
-
import * as
|
|
20608
|
+
import * as fs18 from "node:fs";
|
|
20609
|
+
import * as path19 from "node:path";
|
|
20573
20610
|
function getInstallRecordPath(projectRoot) {
|
|
20574
|
-
return
|
|
20611
|
+
return path19.join(projectRoot, ".argent", "install.json");
|
|
20575
20612
|
}
|
|
20576
20613
|
function readInstallRecord(projectRoot) {
|
|
20577
20614
|
try {
|
|
20578
20615
|
const parsed = JSON.parse(
|
|
20579
|
-
|
|
20616
|
+
fs18.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20580
20617
|
);
|
|
20581
20618
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20582
20619
|
return null;
|
|
@@ -20586,17 +20623,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20586
20623
|
}
|
|
20587
20624
|
function writeInstallRecord(projectRoot, record) {
|
|
20588
20625
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20589
|
-
|
|
20590
|
-
|
|
20626
|
+
fs18.mkdirSync(path19.dirname(recordPath), { recursive: true });
|
|
20627
|
+
fs18.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20591
20628
|
}
|
|
20592
20629
|
function removeInstallRecord(projectRoot) {
|
|
20593
20630
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20594
20631
|
try {
|
|
20595
|
-
if (!
|
|
20596
|
-
|
|
20597
|
-
const dir =
|
|
20632
|
+
if (!fs18.existsSync(recordPath)) return false;
|
|
20633
|
+
fs18.rmSync(recordPath, { force: true });
|
|
20634
|
+
const dir = path19.dirname(recordPath);
|
|
20598
20635
|
try {
|
|
20599
|
-
if (
|
|
20636
|
+
if (fs18.existsSync(dir) && fs18.readdirSync(dir).length === 0) fs18.rmdirSync(dir);
|
|
20600
20637
|
} catch {
|
|
20601
20638
|
}
|
|
20602
20639
|
return true;
|
|
@@ -20624,9 +20661,9 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20624
20661
|
// ../argent-installer/src/utils.ts
|
|
20625
20662
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20626
20663
|
function resolveBundledDir(dirName) {
|
|
20627
|
-
const packagedDir =
|
|
20628
|
-
if (
|
|
20629
|
-
return
|
|
20664
|
+
const packagedDir = path20.join(PACKAGE_ROOT, dirName);
|
|
20665
|
+
if (fs19.existsSync(packagedDir)) return packagedDir;
|
|
20666
|
+
return path20.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20630
20667
|
}
|
|
20631
20668
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20632
20669
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20638,18 +20675,18 @@ function buildArgentSkillsSource(version) {
|
|
|
20638
20675
|
}
|
|
20639
20676
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20640
20677
|
try {
|
|
20641
|
-
return
|
|
20678
|
+
return fs19.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs19.existsSync(path20.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20642
20679
|
} catch {
|
|
20643
20680
|
return [];
|
|
20644
20681
|
}
|
|
20645
20682
|
}
|
|
20646
20683
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20647
|
-
return
|
|
20684
|
+
return path20.join(cwd, "skills-lock.json");
|
|
20648
20685
|
}
|
|
20649
20686
|
function getGlobalSkillLockPath() {
|
|
20650
20687
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20651
|
-
if (xdgStateHome) return
|
|
20652
|
-
return
|
|
20688
|
+
if (xdgStateHome) return path20.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20689
|
+
return path20.join(os4.homedir(), ".agents", ".skill-lock.json");
|
|
20653
20690
|
}
|
|
20654
20691
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20655
20692
|
var LEGACY_ARGENT_SKILL_NAMES = [
|
|
@@ -20755,7 +20792,7 @@ function hashBundledContent(content) {
|
|
|
20755
20792
|
}
|
|
20756
20793
|
function listArgentSkillsInLock(lockPath) {
|
|
20757
20794
|
try {
|
|
20758
|
-
const raw =
|
|
20795
|
+
const raw = fs19.readFileSync(lockPath, "utf8");
|
|
20759
20796
|
const lock = JSON.parse(raw);
|
|
20760
20797
|
const tracked = lock.skills ?? {};
|
|
20761
20798
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20778,21 +20815,21 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20778
20815
|
"opencode.jsonc",
|
|
20779
20816
|
"skills-lock.json"
|
|
20780
20817
|
];
|
|
20781
|
-
function resolveProjectRoot2(startDir, homeDir =
|
|
20782
|
-
const initialDir =
|
|
20818
|
+
function resolveProjectRoot2(startDir, homeDir = os4.homedir()) {
|
|
20819
|
+
const initialDir = path20.resolve(startDir);
|
|
20783
20820
|
const home = canonicalPath(homeDir);
|
|
20784
20821
|
let currentDir = initialDir;
|
|
20785
20822
|
while (true) {
|
|
20786
20823
|
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20787
20824
|
return initialDir;
|
|
20788
20825
|
}
|
|
20789
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20826
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs19.existsSync(path20.join(currentDir, marker)))) {
|
|
20790
20827
|
return currentDir;
|
|
20791
20828
|
}
|
|
20792
|
-
if (
|
|
20829
|
+
if (fs19.existsSync(path20.join(currentDir, ".git"))) {
|
|
20793
20830
|
return currentDir;
|
|
20794
20831
|
}
|
|
20795
|
-
const parentDir =
|
|
20832
|
+
const parentDir = path20.dirname(currentDir);
|
|
20796
20833
|
if (parentDir === currentDir) {
|
|
20797
20834
|
return initialDir;
|
|
20798
20835
|
}
|
|
@@ -20800,20 +20837,20 @@ function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
|
20800
20837
|
}
|
|
20801
20838
|
}
|
|
20802
20839
|
function readToml(filePath) {
|
|
20803
|
-
if (!
|
|
20840
|
+
if (!fs19.existsSync(filePath)) return {};
|
|
20804
20841
|
try {
|
|
20805
|
-
return parse(
|
|
20842
|
+
return parse(fs19.readFileSync(filePath, "utf8"));
|
|
20806
20843
|
} catch {
|
|
20807
20844
|
return {};
|
|
20808
20845
|
}
|
|
20809
20846
|
}
|
|
20810
20847
|
function writeToml(filePath, data) {
|
|
20811
|
-
|
|
20812
|
-
|
|
20848
|
+
fs19.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20849
|
+
fs19.writeFileSync(filePath, stringify(data) + "\n");
|
|
20813
20850
|
}
|
|
20814
20851
|
function readYaml(filePath) {
|
|
20815
|
-
if (!
|
|
20816
|
-
const text2 =
|
|
20852
|
+
if (!fs19.existsSync(filePath)) return new import_yaml.Document({});
|
|
20853
|
+
const text2 = fs19.readFileSync(filePath, "utf8");
|
|
20817
20854
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20818
20855
|
if (doc.errors.length > 0) {
|
|
20819
20856
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20822,20 +20859,20 @@ function readYaml(filePath) {
|
|
|
20822
20859
|
return doc;
|
|
20823
20860
|
}
|
|
20824
20861
|
function writeYaml(filePath, doc) {
|
|
20825
|
-
|
|
20826
|
-
|
|
20862
|
+
fs19.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20863
|
+
fs19.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20827
20864
|
}
|
|
20828
20865
|
function readJson(filePath) {
|
|
20829
|
-
if (!
|
|
20866
|
+
if (!fs19.existsSync(filePath)) return {};
|
|
20830
20867
|
try {
|
|
20831
|
-
return JSON.parse(
|
|
20868
|
+
return JSON.parse(fs19.readFileSync(filePath, "utf8"));
|
|
20832
20869
|
} catch {
|
|
20833
20870
|
return {};
|
|
20834
20871
|
}
|
|
20835
20872
|
}
|
|
20836
20873
|
function writeJson(filePath, data) {
|
|
20837
|
-
|
|
20838
|
-
|
|
20874
|
+
fs19.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20875
|
+
fs19.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20839
20876
|
}
|
|
20840
20877
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20841
20878
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20843,8 +20880,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20843
20880
|
return applyEdits(text2, edits);
|
|
20844
20881
|
}
|
|
20845
20882
|
function readJsoncFileRaw(filePath) {
|
|
20846
|
-
if (!
|
|
20847
|
-
let text2 =
|
|
20883
|
+
if (!fs19.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20884
|
+
let text2 = fs19.readFileSync(filePath, "utf8");
|
|
20848
20885
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20849
20886
|
if (hadBom) text2 = text2.slice(1);
|
|
20850
20887
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20863,26 +20900,26 @@ function isEmptyPlainObject(value) {
|
|
|
20863
20900
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20864
20901
|
}
|
|
20865
20902
|
function removePath(targetPath) {
|
|
20866
|
-
const entry =
|
|
20903
|
+
const entry = fs19.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20867
20904
|
if (!entry) return false;
|
|
20868
|
-
if (entry.isSymbolicLink())
|
|
20869
|
-
else
|
|
20905
|
+
if (entry.isSymbolicLink()) fs19.unlinkSync(targetPath);
|
|
20906
|
+
else fs19.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20870
20907
|
return true;
|
|
20871
20908
|
}
|
|
20872
20909
|
function rmEmptyDir(dirPath) {
|
|
20873
20910
|
try {
|
|
20874
|
-
if (!
|
|
20875
|
-
if (!
|
|
20876
|
-
if (
|
|
20877
|
-
|
|
20911
|
+
if (!fs19.existsSync(dirPath)) return false;
|
|
20912
|
+
if (!fs19.statSync(dirPath).isDirectory()) return false;
|
|
20913
|
+
if (fs19.readdirSync(dirPath).length > 0) return false;
|
|
20914
|
+
fs19.rmdirSync(dirPath);
|
|
20878
20915
|
return true;
|
|
20879
20916
|
} catch {
|
|
20880
20917
|
return false;
|
|
20881
20918
|
}
|
|
20882
20919
|
}
|
|
20883
20920
|
function readJsonc(filePath) {
|
|
20884
|
-
if (!
|
|
20885
|
-
let raw =
|
|
20921
|
+
if (!fs19.existsSync(filePath)) return {};
|
|
20922
|
+
let raw = fs19.readFileSync(filePath, "utf8");
|
|
20886
20923
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20887
20924
|
if (raw.trim() === "") return {};
|
|
20888
20925
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20903,7 +20940,7 @@ function yamlSyntaxErrorLine(raw) {
|
|
|
20903
20940
|
function findConfigSyntaxErrorLine(filePath, jsonOptions) {
|
|
20904
20941
|
let raw;
|
|
20905
20942
|
try {
|
|
20906
|
-
raw =
|
|
20943
|
+
raw = fs19.readFileSync(filePath, "utf8");
|
|
20907
20944
|
} catch {
|
|
20908
20945
|
return null;
|
|
20909
20946
|
}
|
|
@@ -20929,18 +20966,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20929
20966
|
}
|
|
20930
20967
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20931
20968
|
if (isEmptyPlainObject(parsed)) {
|
|
20932
|
-
|
|
20933
|
-
rmEmptyDir(
|
|
20969
|
+
fs19.rmSync(filePath, { force: true });
|
|
20970
|
+
rmEmptyDir(path20.dirname(filePath));
|
|
20934
20971
|
return;
|
|
20935
20972
|
}
|
|
20936
|
-
|
|
20973
|
+
fs19.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20937
20974
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20938
|
-
|
|
20975
|
+
fs19.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20939
20976
|
}
|
|
20940
20977
|
var MAX_SYMLINK_HOPS = 40;
|
|
20941
20978
|
function realpathOrSelf(p) {
|
|
20942
20979
|
try {
|
|
20943
|
-
return
|
|
20980
|
+
return fs19.realpathSync(p);
|
|
20944
20981
|
} catch {
|
|
20945
20982
|
return p;
|
|
20946
20983
|
}
|
|
@@ -20950,13 +20987,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20950
20987
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20951
20988
|
let entry;
|
|
20952
20989
|
try {
|
|
20953
|
-
entry =
|
|
20990
|
+
entry = fs19.lstatSync(current);
|
|
20954
20991
|
} catch {
|
|
20955
|
-
return current === dest || dirExists(
|
|
20992
|
+
return current === dest || dirExists(path20.dirname(current)) ? current : dest;
|
|
20956
20993
|
}
|
|
20957
20994
|
if (!entry.isSymbolicLink()) return current;
|
|
20958
20995
|
try {
|
|
20959
|
-
current =
|
|
20996
|
+
current = path20.resolve(realpathOrSelf(path20.dirname(current)), fs19.readlinkSync(current));
|
|
20960
20997
|
} catch {
|
|
20961
20998
|
return dest;
|
|
20962
20999
|
}
|
|
@@ -20964,30 +21001,30 @@ function resolveLinkedDestination(dest) {
|
|
|
20964
21001
|
return dest;
|
|
20965
21002
|
}
|
|
20966
21003
|
function copyDir(src, dest) {
|
|
20967
|
-
if (!
|
|
21004
|
+
if (!fs19.existsSync(src) || !treeHasFiles(src)) return null;
|
|
20968
21005
|
const target = resolveLinkedDestination(dest);
|
|
20969
21006
|
copyTree(src, target);
|
|
20970
21007
|
return target;
|
|
20971
21008
|
}
|
|
20972
21009
|
function treeHasFiles(dir) {
|
|
20973
|
-
return
|
|
21010
|
+
return fs19.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path20.join(dir, entry.name)));
|
|
20974
21011
|
}
|
|
20975
21012
|
function copyTree(src, dest) {
|
|
20976
|
-
const entries =
|
|
20977
|
-
|
|
21013
|
+
const entries = fs19.readdirSync(src, { withFileTypes: true });
|
|
21014
|
+
fs19.mkdirSync(dest, { recursive: true });
|
|
20978
21015
|
for (const entry of entries) {
|
|
20979
|
-
const from =
|
|
20980
|
-
const to = resolveLinkedDestination(
|
|
21016
|
+
const from = path20.join(src, entry.name);
|
|
21017
|
+
const to = resolveLinkedDestination(path20.join(dest, entry.name));
|
|
20981
21018
|
if (entry.isDirectory()) copyTree(from, to);
|
|
20982
|
-
else
|
|
21019
|
+
else fs19.copyFileSync(from, to);
|
|
20983
21020
|
}
|
|
20984
21021
|
}
|
|
20985
21022
|
function readRetiredFile(targetDir, relativePath) {
|
|
20986
|
-
const entryPath =
|
|
21023
|
+
const entryPath = path20.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
20987
21024
|
const file = resolveLinkedDestination(entryPath);
|
|
20988
21025
|
try {
|
|
20989
|
-
if (!
|
|
20990
|
-
return
|
|
21026
|
+
if (!fs19.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
21027
|
+
return fs19.readFileSync(file, "utf8");
|
|
20991
21028
|
} catch {
|
|
20992
21029
|
return null;
|
|
20993
21030
|
}
|
|
@@ -20995,7 +21032,7 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
20995
21032
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
20996
21033
|
const found = [];
|
|
20997
21034
|
for (const { path: relativePath, shipped } of retired) {
|
|
20998
|
-
if (bundleDir !== null &&
|
|
21035
|
+
if (bundleDir !== null && fs19.existsSync(path20.join(bundleDir, ...relativePath.split("/"))))
|
|
20999
21036
|
continue;
|
|
21000
21037
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21001
21038
|
if (content === null) continue;
|
|
@@ -21011,17 +21048,17 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21011
21048
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21012
21049
|
if (content === null || hashBundledContent(content) !== sha256) continue;
|
|
21013
21050
|
const segments = relativePath.split("/");
|
|
21014
|
-
const entryPath =
|
|
21051
|
+
const entryPath = path20.join(dir, ...segments);
|
|
21015
21052
|
const file = resolveLinkedDestination(entryPath);
|
|
21016
21053
|
try {
|
|
21017
|
-
|
|
21054
|
+
fs19.rmSync(file);
|
|
21018
21055
|
if (file !== entryPath) removePath(entryPath);
|
|
21019
21056
|
removedPaths.push(relativePath);
|
|
21020
21057
|
} catch {
|
|
21021
21058
|
continue;
|
|
21022
21059
|
}
|
|
21023
21060
|
for (let depth = segments.length - 1; depth > 0; depth--) {
|
|
21024
|
-
if (!rmEmptyDir(
|
|
21061
|
+
if (!rmEmptyDir(path20.join(dir, ...segments.slice(0, depth)))) break;
|
|
21025
21062
|
}
|
|
21026
21063
|
}
|
|
21027
21064
|
const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
|
|
@@ -21029,15 +21066,15 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21029
21066
|
}
|
|
21030
21067
|
function dirExists(p) {
|
|
21031
21068
|
try {
|
|
21032
|
-
return
|
|
21069
|
+
return fs19.statSync(p).isDirectory();
|
|
21033
21070
|
} catch {
|
|
21034
21071
|
return false;
|
|
21035
21072
|
}
|
|
21036
21073
|
}
|
|
21037
21074
|
function getInstalledVersion() {
|
|
21038
21075
|
try {
|
|
21039
|
-
const pkgPath =
|
|
21040
|
-
const pkg = JSON.parse(
|
|
21076
|
+
const pkgPath = path20.join(PACKAGE_ROOT, "package.json");
|
|
21077
|
+
const pkg = JSON.parse(fs19.readFileSync(pkgPath, "utf8"));
|
|
21041
21078
|
return pkg.version ?? null;
|
|
21042
21079
|
} catch {
|
|
21043
21080
|
return null;
|
|
@@ -21082,12 +21119,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
21082
21119
|
} catch {
|
|
21083
21120
|
return false;
|
|
21084
21121
|
}
|
|
21085
|
-
return new Promise((
|
|
21086
|
-
const timer = setTimeout(() =>
|
|
21122
|
+
return new Promise((resolve22) => {
|
|
21123
|
+
const timer = setTimeout(() => resolve22(false), timeoutMs);
|
|
21087
21124
|
timer.unref();
|
|
21088
21125
|
dns.lookup(host, (err) => {
|
|
21089
21126
|
clearTimeout(timer);
|
|
21090
|
-
|
|
21127
|
+
resolve22(!err);
|
|
21091
21128
|
});
|
|
21092
21129
|
});
|
|
21093
21130
|
}
|
|
@@ -21104,7 +21141,7 @@ function escapeStringRegexp(string) {
|
|
|
21104
21141
|
}
|
|
21105
21142
|
|
|
21106
21143
|
// ../argent-installer/src/mcp-configs.ts
|
|
21107
|
-
var TOOL_SERVER_BUNDLE =
|
|
21144
|
+
var TOOL_SERVER_BUNDLE = path21.join(import.meta.dirname, "tool-server.cjs");
|
|
21108
21145
|
function getAvailableToolIds() {
|
|
21109
21146
|
const out = execFileSync5("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
21110
21147
|
const tools = JSON.parse(out);
|
|
@@ -21167,10 +21204,10 @@ function hasCustomizingEnv(entry) {
|
|
|
21167
21204
|
}
|
|
21168
21205
|
function removeDirIfEmpty(dirPath) {
|
|
21169
21206
|
try {
|
|
21170
|
-
if (!
|
|
21171
|
-
if (!
|
|
21172
|
-
if (
|
|
21173
|
-
|
|
21207
|
+
if (!fs20.existsSync(dirPath)) return;
|
|
21208
|
+
if (!fs20.statSync(dirPath).isDirectory()) return;
|
|
21209
|
+
if (fs20.readdirSync(dirPath).length > 0) return;
|
|
21210
|
+
fs20.rmdirSync(dirPath);
|
|
21174
21211
|
} catch {
|
|
21175
21212
|
}
|
|
21176
21213
|
}
|
|
@@ -21208,7 +21245,7 @@ function isArgentManagedEntry(entry) {
|
|
|
21208
21245
|
return args.length === 1 && args[0] === "mcp";
|
|
21209
21246
|
case "node": {
|
|
21210
21247
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
21211
|
-
if (
|
|
21248
|
+
if (path21.isAbsolute(args[0])) return false;
|
|
21212
21249
|
const normalized = args[0].split("\\").join("/");
|
|
21213
21250
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
21214
21251
|
}
|
|
@@ -21222,12 +21259,12 @@ function isArgentManagedEntry(entry) {
|
|
|
21222
21259
|
}
|
|
21223
21260
|
function isPinnedGlobalEntry(entry) {
|
|
21224
21261
|
const [cli, subcommand] = entry.args;
|
|
21225
|
-
return
|
|
21262
|
+
return path21.isAbsolute(entry.command) && path21.basename(entry.command) === "node" && entry.args.length === 2 && subcommand === "mcp" && path21.isAbsolute(cli) && cli.includes(`/node_modules/${PACKAGE_NAME}/`);
|
|
21226
21263
|
}
|
|
21227
21264
|
function writeTomlOrRemove(filePath, data) {
|
|
21228
21265
|
if (Object.keys(data).length === 0) {
|
|
21229
|
-
|
|
21230
|
-
removeDirIfEmpty(
|
|
21266
|
+
fs20.rmSync(filePath, { force: true });
|
|
21267
|
+
removeDirIfEmpty(path21.dirname(filePath));
|
|
21231
21268
|
return;
|
|
21232
21269
|
}
|
|
21233
21270
|
writeToml(filePath, data);
|
|
@@ -21236,12 +21273,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
21236
21273
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
21237
21274
|
}
|
|
21238
21275
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
21239
|
-
return
|
|
21276
|
+
return fs20.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
21240
21277
|
}
|
|
21241
21278
|
function parseJsoncStrict(filePath) {
|
|
21242
21279
|
let raw;
|
|
21243
21280
|
try {
|
|
21244
|
-
raw =
|
|
21281
|
+
raw = fs20.readFileSync(filePath, "utf8");
|
|
21245
21282
|
} catch {
|
|
21246
21283
|
return null;
|
|
21247
21284
|
}
|
|
@@ -21254,14 +21291,14 @@ function parseJsoncStrict(filePath) {
|
|
|
21254
21291
|
}
|
|
21255
21292
|
function parseTomlStrict(filePath) {
|
|
21256
21293
|
try {
|
|
21257
|
-
return parse(
|
|
21294
|
+
return parse(fs20.readFileSync(filePath, "utf8"));
|
|
21258
21295
|
} catch {
|
|
21259
21296
|
return null;
|
|
21260
21297
|
}
|
|
21261
21298
|
}
|
|
21262
21299
|
function parseYamlStrict(filePath) {
|
|
21263
21300
|
try {
|
|
21264
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21301
|
+
const parsed = (0, import_yaml2.parse)(fs20.readFileSync(filePath, "utf8"));
|
|
21265
21302
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
21266
21303
|
return parsed;
|
|
21267
21304
|
} catch {
|
|
@@ -21284,7 +21321,7 @@ function bundledManagedNames(kind) {
|
|
|
21284
21321
|
if (cached2) return cached2;
|
|
21285
21322
|
let names;
|
|
21286
21323
|
try {
|
|
21287
|
-
names = new Set(
|
|
21324
|
+
names = new Set(fs20.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
21288
21325
|
} catch {
|
|
21289
21326
|
names = /* @__PURE__ */ new Set();
|
|
21290
21327
|
}
|
|
@@ -21295,7 +21332,7 @@ function bundledManagedNames(kind) {
|
|
|
21295
21332
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
21296
21333
|
let entries;
|
|
21297
21334
|
try {
|
|
21298
|
-
entries =
|
|
21335
|
+
entries = fs20.readdirSync(dir);
|
|
21299
21336
|
} catch {
|
|
21300
21337
|
return false;
|
|
21301
21338
|
}
|
|
@@ -21307,13 +21344,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
21307
21344
|
function cursorDirLooksArgentOnly(dir) {
|
|
21308
21345
|
let entries;
|
|
21309
21346
|
try {
|
|
21310
|
-
entries =
|
|
21347
|
+
entries = fs20.readdirSync(dir);
|
|
21311
21348
|
} catch {
|
|
21312
21349
|
return false;
|
|
21313
21350
|
}
|
|
21314
21351
|
if (entries.length === 0) return false;
|
|
21315
21352
|
return entries.every((entry) => {
|
|
21316
|
-
const full =
|
|
21353
|
+
const full = path21.join(dir, entry);
|
|
21317
21354
|
if (entry === "mcp.json") {
|
|
21318
21355
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21319
21356
|
}
|
|
@@ -21346,13 +21383,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
21346
21383
|
function claudeDirLooksArgentOnly(dir) {
|
|
21347
21384
|
let entries;
|
|
21348
21385
|
try {
|
|
21349
|
-
entries =
|
|
21386
|
+
entries = fs20.readdirSync(dir);
|
|
21350
21387
|
} catch {
|
|
21351
21388
|
return false;
|
|
21352
21389
|
}
|
|
21353
21390
|
if (entries.length === 0) return false;
|
|
21354
21391
|
return entries.every((entry) => {
|
|
21355
|
-
const full =
|
|
21392
|
+
const full = path21.join(dir, entry);
|
|
21356
21393
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
21357
21394
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
21358
21395
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -21363,25 +21400,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
21363
21400
|
function vscodeDirLooksArgentOnly(dir) {
|
|
21364
21401
|
let entries;
|
|
21365
21402
|
try {
|
|
21366
|
-
entries =
|
|
21403
|
+
entries = fs20.readdirSync(dir);
|
|
21367
21404
|
} catch {
|
|
21368
21405
|
return false;
|
|
21369
21406
|
}
|
|
21370
21407
|
if (entries.length === 0) return false;
|
|
21371
21408
|
return entries.every(
|
|
21372
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21409
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path21.join(dir, entry), "servers")
|
|
21373
21410
|
);
|
|
21374
21411
|
}
|
|
21375
21412
|
function windsurfDirLooksArgentOnly(dir) {
|
|
21376
21413
|
let entries;
|
|
21377
21414
|
try {
|
|
21378
|
-
entries =
|
|
21415
|
+
entries = fs20.readdirSync(dir);
|
|
21379
21416
|
} catch {
|
|
21380
21417
|
return false;
|
|
21381
21418
|
}
|
|
21382
21419
|
if (entries.length === 0) return false;
|
|
21383
21420
|
return entries.every(
|
|
21384
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21421
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path21.join(dir, entry), "mcpServers")
|
|
21385
21422
|
);
|
|
21386
21423
|
}
|
|
21387
21424
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -21412,25 +21449,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21412
21449
|
function zedDirLooksArgentOnly(dir) {
|
|
21413
21450
|
let entries;
|
|
21414
21451
|
try {
|
|
21415
|
-
entries =
|
|
21452
|
+
entries = fs20.readdirSync(dir);
|
|
21416
21453
|
} catch {
|
|
21417
21454
|
return false;
|
|
21418
21455
|
}
|
|
21419
21456
|
if (entries.length === 0) return false;
|
|
21420
21457
|
return entries.every(
|
|
21421
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21458
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path21.join(dir, entry))
|
|
21422
21459
|
);
|
|
21423
21460
|
}
|
|
21424
21461
|
function geminiDirLooksArgentOnly(dir) {
|
|
21425
21462
|
let entries;
|
|
21426
21463
|
try {
|
|
21427
|
-
entries =
|
|
21464
|
+
entries = fs20.readdirSync(dir);
|
|
21428
21465
|
} catch {
|
|
21429
21466
|
return false;
|
|
21430
21467
|
}
|
|
21431
21468
|
if (entries.length === 0) return false;
|
|
21432
21469
|
return entries.every((entry) => {
|
|
21433
|
-
const full =
|
|
21470
|
+
const full = path21.join(dir, entry);
|
|
21434
21471
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21435
21472
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21436
21473
|
return false;
|
|
@@ -21449,48 +21486,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21449
21486
|
function hermesDirLooksArgentOnly(dir) {
|
|
21450
21487
|
let entries;
|
|
21451
21488
|
try {
|
|
21452
|
-
entries =
|
|
21489
|
+
entries = fs20.readdirSync(dir);
|
|
21453
21490
|
} catch {
|
|
21454
21491
|
return false;
|
|
21455
21492
|
}
|
|
21456
21493
|
if (entries.length === 0) return false;
|
|
21457
21494
|
return entries.every(
|
|
21458
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21495
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path21.join(dir, entry))
|
|
21459
21496
|
);
|
|
21460
21497
|
}
|
|
21461
21498
|
function kiroDirLooksArgentOnly(dir) {
|
|
21462
21499
|
let entries;
|
|
21463
21500
|
try {
|
|
21464
|
-
entries =
|
|
21501
|
+
entries = fs20.readdirSync(dir);
|
|
21465
21502
|
} catch {
|
|
21466
21503
|
return false;
|
|
21467
21504
|
}
|
|
21468
21505
|
if (entries.length === 0) return false;
|
|
21469
21506
|
return entries.every((entry) => {
|
|
21470
21507
|
if (entry !== "settings") return false;
|
|
21471
|
-
const settingsDir =
|
|
21508
|
+
const settingsDir = path21.join(dir, entry);
|
|
21472
21509
|
let settingsEntries;
|
|
21473
21510
|
try {
|
|
21474
|
-
settingsEntries =
|
|
21511
|
+
settingsEntries = fs20.readdirSync(settingsDir);
|
|
21475
21512
|
} catch {
|
|
21476
21513
|
return false;
|
|
21477
21514
|
}
|
|
21478
21515
|
if (settingsEntries.length === 0) return false;
|
|
21479
21516
|
return settingsEntries.every(
|
|
21480
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21517
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path21.join(settingsDir, name), "mcpServers")
|
|
21481
21518
|
);
|
|
21482
21519
|
});
|
|
21483
21520
|
}
|
|
21484
21521
|
function codexDirLooksArgentOnly(dir) {
|
|
21485
21522
|
let entries;
|
|
21486
21523
|
try {
|
|
21487
|
-
entries =
|
|
21524
|
+
entries = fs20.readdirSync(dir);
|
|
21488
21525
|
} catch {
|
|
21489
21526
|
return false;
|
|
21490
21527
|
}
|
|
21491
21528
|
if (entries.length === 0) return false;
|
|
21492
21529
|
return entries.every((entry) => {
|
|
21493
|
-
const full =
|
|
21530
|
+
const full = path21.join(dir, entry);
|
|
21494
21531
|
if (entry === "config.toml") {
|
|
21495
21532
|
const config = parseTomlStrict(full);
|
|
21496
21533
|
if (config === null) return false;
|
|
@@ -21515,7 +21552,7 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21515
21552
|
});
|
|
21516
21553
|
}
|
|
21517
21554
|
function cursorPermissionsPath() {
|
|
21518
|
-
return
|
|
21555
|
+
return path21.join(homedir5(), ".cursor", "permissions.json");
|
|
21519
21556
|
}
|
|
21520
21557
|
function cursorPermissionsList() {
|
|
21521
21558
|
const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
|
|
@@ -21524,13 +21561,13 @@ function cursorPermissionsList() {
|
|
|
21524
21561
|
var cursorAdapter = {
|
|
21525
21562
|
name: "Cursor",
|
|
21526
21563
|
detect() {
|
|
21527
|
-
return dirHasEditorEvidence(
|
|
21564
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21528
21565
|
},
|
|
21529
21566
|
projectPath(root) {
|
|
21530
|
-
return
|
|
21567
|
+
return path21.join(root, ".cursor", "mcp.json");
|
|
21531
21568
|
},
|
|
21532
21569
|
globalPath() {
|
|
21533
|
-
return
|
|
21570
|
+
return path21.join(homedir5(), ".cursor", "mcp.json");
|
|
21534
21571
|
},
|
|
21535
21572
|
// Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
|
|
21536
21573
|
// text edits that preserve user comments and foreign servers.
|
|
@@ -21542,7 +21579,7 @@ var cursorAdapter = {
|
|
|
21542
21579
|
});
|
|
21543
21580
|
},
|
|
21544
21581
|
remove(configPath) {
|
|
21545
|
-
if (!
|
|
21582
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
21546
21583
|
const config = readJsonc(configPath);
|
|
21547
21584
|
const servers = config.mcpServers;
|
|
21548
21585
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21550,7 +21587,7 @@ var cursorAdapter = {
|
|
|
21550
21587
|
return true;
|
|
21551
21588
|
},
|
|
21552
21589
|
getArgentEntry(configPath) {
|
|
21553
|
-
if (!
|
|
21590
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
21554
21591
|
const config = readJsonc(configPath);
|
|
21555
21592
|
const servers = config.mcpServers;
|
|
21556
21593
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21575,7 +21612,7 @@ var cursorAdapter = {
|
|
|
21575
21612
|
removeAllowlist(_root, scope) {
|
|
21576
21613
|
if (scope !== "global") return;
|
|
21577
21614
|
const permPath = cursorPermissionsPath();
|
|
21578
|
-
if (!
|
|
21615
|
+
if (!fs20.existsSync(permPath)) return;
|
|
21579
21616
|
const config = readJsonc(permPath);
|
|
21580
21617
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21581
21618
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21588,7 +21625,7 @@ function claudeProjectKeysForRoot(projects, root) {
|
|
|
21588
21625
|
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21589
21626
|
}
|
|
21590
21627
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21591
|
-
if (!
|
|
21628
|
+
if (!fs20.existsSync(settingsPath)) return null;
|
|
21592
21629
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21593
21630
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21594
21631
|
return {
|
|
@@ -21616,13 +21653,13 @@ var claudeAdapter = {
|
|
|
21616
21653
|
name: "Claude Code",
|
|
21617
21654
|
detect() {
|
|
21618
21655
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21619
|
-
return fileHasEditorEvidence(
|
|
21656
|
+
return fileHasEditorEvidence(path21.join(process.cwd(), ".mcp.json"), mcpJsonArgentOnly) || fileHasEditorEvidence(path21.join(homedir5(), ".claude.json"), mcpJsonArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".claude"), claudeDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(homedir5(), ".claude"), claudeDirLooksArgentOnly);
|
|
21620
21657
|
},
|
|
21621
21658
|
projectPath(root) {
|
|
21622
|
-
return
|
|
21659
|
+
return path21.join(root, ".mcp.json");
|
|
21623
21660
|
},
|
|
21624
21661
|
globalPath() {
|
|
21625
|
-
return
|
|
21662
|
+
return path21.join(homedir5(), ".claude.json");
|
|
21626
21663
|
},
|
|
21627
21664
|
// JSONC is a superset of JSON, so this config shares the one comment- and
|
|
21628
21665
|
// foreign-server-preserving write path (see the Cursor adapter).
|
|
@@ -21635,7 +21672,7 @@ var claudeAdapter = {
|
|
|
21635
21672
|
});
|
|
21636
21673
|
},
|
|
21637
21674
|
remove(configPath) {
|
|
21638
|
-
if (!
|
|
21675
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
21639
21676
|
const config = readJsonc(configPath);
|
|
21640
21677
|
const servers = config.mcpServers;
|
|
21641
21678
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21649,7 +21686,7 @@ var claudeAdapter = {
|
|
|
21649
21686
|
return true;
|
|
21650
21687
|
},
|
|
21651
21688
|
getArgentEntry(configPath) {
|
|
21652
|
-
if (!
|
|
21689
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
21653
21690
|
const config = readJsonc(configPath);
|
|
21654
21691
|
const servers = config.mcpServers;
|
|
21655
21692
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21662,7 +21699,7 @@ var claudeAdapter = {
|
|
|
21662
21699
|
// .mcp.json rejections (see claudeDisabledListFinding).
|
|
21663
21700
|
findShadowingConfigs(root, writtenScope) {
|
|
21664
21701
|
const findings = [];
|
|
21665
|
-
const claudeJsonPath =
|
|
21702
|
+
const claudeJsonPath = path21.join(homedir5(), ".claude.json");
|
|
21666
21703
|
const projects = readJson(claudeJsonPath).projects;
|
|
21667
21704
|
if (isRecord(projects)) {
|
|
21668
21705
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21699,9 +21736,9 @@ var claudeAdapter = {
|
|
|
21699
21736
|
}
|
|
21700
21737
|
if (writtenScope === "local") {
|
|
21701
21738
|
const candidates = [
|
|
21702
|
-
[
|
|
21703
|
-
[
|
|
21704
|
-
[
|
|
21739
|
+
[path21.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21740
|
+
[path21.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21741
|
+
[path21.join(homedir5(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21705
21742
|
];
|
|
21706
21743
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21707
21744
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21720,10 +21757,10 @@ var claudeAdapter = {
|
|
|
21720
21757
|
var vscodeAdapter = {
|
|
21721
21758
|
name: "VS Code",
|
|
21722
21759
|
detect() {
|
|
21723
|
-
return dirHasEditorEvidence(
|
|
21760
|
+
return dirHasEditorEvidence(path21.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path21.join(homedir5(), ".vscode"));
|
|
21724
21761
|
},
|
|
21725
21762
|
projectPath(root) {
|
|
21726
|
-
return
|
|
21763
|
+
return path21.join(root, ".vscode", "mcp.json");
|
|
21727
21764
|
},
|
|
21728
21765
|
globalPath() {
|
|
21729
21766
|
return null;
|
|
@@ -21739,7 +21776,7 @@ var vscodeAdapter = {
|
|
|
21739
21776
|
});
|
|
21740
21777
|
},
|
|
21741
21778
|
remove(configPath) {
|
|
21742
|
-
if (!
|
|
21779
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
21743
21780
|
const config = readJsonc(configPath);
|
|
21744
21781
|
const servers = config.servers;
|
|
21745
21782
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21747,7 +21784,7 @@ var vscodeAdapter = {
|
|
|
21747
21784
|
return true;
|
|
21748
21785
|
},
|
|
21749
21786
|
getArgentEntry(configPath) {
|
|
21750
|
-
if (!
|
|
21787
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
21751
21788
|
const config = readJsonc(configPath);
|
|
21752
21789
|
const servers = config.servers;
|
|
21753
21790
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21760,7 +21797,7 @@ var vscodeAdapter = {
|
|
|
21760
21797
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21761
21798
|
const findings = [];
|
|
21762
21799
|
for (const userDir of vscodeUserDirs()) {
|
|
21763
|
-
const configPath =
|
|
21800
|
+
const configPath = path21.join(userDir, "mcp.json");
|
|
21764
21801
|
const entry = this.getArgentEntry(configPath);
|
|
21765
21802
|
if (!entry) continue;
|
|
21766
21803
|
findings.push({
|
|
@@ -21777,16 +21814,16 @@ var vscodeAdapter = {
|
|
|
21777
21814
|
function vscodeUserDirs() {
|
|
21778
21815
|
const bases = [];
|
|
21779
21816
|
if (process.platform === "darwin") {
|
|
21780
|
-
bases.push(
|
|
21817
|
+
bases.push(path21.join(homedir5(), "Library", "Application Support"));
|
|
21781
21818
|
} else if (process.platform === "win32") {
|
|
21782
21819
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21783
21820
|
} else {
|
|
21784
|
-
bases.push(
|
|
21821
|
+
bases.push(path21.join(homedir5(), ".config"));
|
|
21785
21822
|
}
|
|
21786
21823
|
const dirs = [];
|
|
21787
21824
|
for (const base of bases) {
|
|
21788
21825
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21789
|
-
const dir =
|
|
21826
|
+
const dir = path21.join(base, product, "User");
|
|
21790
21827
|
if (dirExists(dir)) dirs.push(dir);
|
|
21791
21828
|
}
|
|
21792
21829
|
}
|
|
@@ -21794,18 +21831,18 @@ function vscodeUserDirs() {
|
|
|
21794
21831
|
}
|
|
21795
21832
|
function devinUserConfigPath() {
|
|
21796
21833
|
if (process.platform === "win32") {
|
|
21797
|
-
const appData = process.env.APPDATA ||
|
|
21798
|
-
return
|
|
21834
|
+
const appData = process.env.APPDATA || path21.join(homedir5(), "AppData", "Roaming");
|
|
21835
|
+
return path21.join(appData, "devin", "config.json");
|
|
21799
21836
|
}
|
|
21800
21837
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
21801
|
-
return
|
|
21838
|
+
return path21.join(xdg || path21.join(homedir5(), ".config"), "devin", "config.json");
|
|
21802
21839
|
}
|
|
21803
21840
|
var windsurfAdapter = {
|
|
21804
21841
|
name: "Devin Desktop",
|
|
21805
21842
|
telemetryName: "windsurf",
|
|
21806
21843
|
detect() {
|
|
21807
21844
|
return dirHasEditorEvidence(
|
|
21808
|
-
|
|
21845
|
+
path21.join(homedir5(), ".codeium", "windsurf"),
|
|
21809
21846
|
windsurfDirLooksArgentOnly
|
|
21810
21847
|
);
|
|
21811
21848
|
},
|
|
@@ -21813,7 +21850,7 @@ var windsurfAdapter = {
|
|
|
21813
21850
|
return null;
|
|
21814
21851
|
},
|
|
21815
21852
|
globalPath() {
|
|
21816
|
-
return
|
|
21853
|
+
return path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21817
21854
|
},
|
|
21818
21855
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21819
21856
|
write(configPath, entry) {
|
|
@@ -21825,7 +21862,7 @@ var windsurfAdapter = {
|
|
|
21825
21862
|
});
|
|
21826
21863
|
},
|
|
21827
21864
|
remove(configPath) {
|
|
21828
|
-
if (!
|
|
21865
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
21829
21866
|
const config = readJsonc(configPath);
|
|
21830
21867
|
const servers = config.mcpServers;
|
|
21831
21868
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21833,7 +21870,7 @@ var windsurfAdapter = {
|
|
|
21833
21870
|
return true;
|
|
21834
21871
|
},
|
|
21835
21872
|
getArgentEntry(configPath) {
|
|
21836
|
-
if (!
|
|
21873
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
21837
21874
|
const config = readJsonc(configPath);
|
|
21838
21875
|
const servers = config.mcpServers;
|
|
21839
21876
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21845,7 +21882,7 @@ var windsurfAdapter = {
|
|
|
21845
21882
|
// servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
|
|
21846
21883
|
// agent needs its own permission rule.
|
|
21847
21884
|
addAllowlist() {
|
|
21848
|
-
const configPath =
|
|
21885
|
+
const configPath = path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21849
21886
|
const config = readJsonc(configPath);
|
|
21850
21887
|
const servers = config.mcpServers;
|
|
21851
21888
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21855,8 +21892,8 @@ var windsurfAdapter = {
|
|
|
21855
21892
|
removeAllowlist(_root, scope) {
|
|
21856
21893
|
if (scope !== "global") return;
|
|
21857
21894
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21858
|
-
const configPath =
|
|
21859
|
-
if (!
|
|
21895
|
+
const configPath = path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21896
|
+
if (!fs20.existsSync(configPath)) return;
|
|
21860
21897
|
const config = readJsonc(configPath);
|
|
21861
21898
|
const servers = config.mcpServers;
|
|
21862
21899
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21867,13 +21904,13 @@ var windsurfAdapter = {
|
|
|
21867
21904
|
var zedAdapter = {
|
|
21868
21905
|
name: "Zed",
|
|
21869
21906
|
detect() {
|
|
21870
|
-
return dirHasEditorEvidence(
|
|
21907
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21871
21908
|
},
|
|
21872
21909
|
projectPath(root) {
|
|
21873
|
-
return
|
|
21910
|
+
return path21.join(root, ".zed", "settings.json");
|
|
21874
21911
|
},
|
|
21875
21912
|
globalPath() {
|
|
21876
|
-
return
|
|
21913
|
+
return path21.join(homedir5(), ".config", "zed", "settings.json");
|
|
21877
21914
|
},
|
|
21878
21915
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21879
21916
|
// formatting outside the touched key survive (see the Cursor adapter).
|
|
@@ -21886,7 +21923,7 @@ var zedAdapter = {
|
|
|
21886
21923
|
});
|
|
21887
21924
|
},
|
|
21888
21925
|
remove(configPath) {
|
|
21889
|
-
if (!
|
|
21926
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
21890
21927
|
const config = readJsonc(configPath);
|
|
21891
21928
|
const servers = config.context_servers;
|
|
21892
21929
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21894,7 +21931,7 @@ var zedAdapter = {
|
|
|
21894
21931
|
return true;
|
|
21895
21932
|
},
|
|
21896
21933
|
getArgentEntry(configPath) {
|
|
21897
|
-
if (!
|
|
21934
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
21898
21935
|
const config = readJsonc(configPath);
|
|
21899
21936
|
const servers = config.context_servers;
|
|
21900
21937
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21905,12 +21942,12 @@ var zedAdapter = {
|
|
|
21905
21942
|
// Zed has no server-level wildcard for MCP tools — each tool would need its
|
|
21906
21943
|
// own entry — so the global default is set to "allow" instead.
|
|
21907
21944
|
addAllowlist(root, scope) {
|
|
21908
|
-
const settingsPath = scope === "global" ?
|
|
21945
|
+
const settingsPath = scope === "global" ? path21.join(homedir5(), ".config", "zed", "settings.json") : path21.join(root, ".zed", "settings.json");
|
|
21909
21946
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21910
21947
|
},
|
|
21911
21948
|
removeAllowlist(root, scope) {
|
|
21912
|
-
const settingsPath = scope === "global" ?
|
|
21913
|
-
if (!
|
|
21949
|
+
const settingsPath = scope === "global" ? path21.join(homedir5(), ".config", "zed", "settings.json") : path21.join(root, ".zed", "settings.json");
|
|
21950
|
+
if (!fs20.existsSync(settingsPath)) return;
|
|
21914
21951
|
const config = readJsonc(settingsPath);
|
|
21915
21952
|
const perms = config.agent?.tool_permissions;
|
|
21916
21953
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21920,13 +21957,13 @@ var zedAdapter = {
|
|
|
21920
21957
|
var geminiAdapter = {
|
|
21921
21958
|
name: "Gemini",
|
|
21922
21959
|
detect() {
|
|
21923
|
-
return dirHasEditorEvidence(
|
|
21960
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21924
21961
|
},
|
|
21925
21962
|
projectPath(root) {
|
|
21926
|
-
return
|
|
21963
|
+
return path21.join(root, ".gemini", "settings.json");
|
|
21927
21964
|
},
|
|
21928
21965
|
globalPath() {
|
|
21929
|
-
return
|
|
21966
|
+
return path21.join(homedir5(), ".gemini", "settings.json");
|
|
21930
21967
|
},
|
|
21931
21968
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21932
21969
|
write(configPath, entry) {
|
|
@@ -21938,7 +21975,7 @@ var geminiAdapter = {
|
|
|
21938
21975
|
});
|
|
21939
21976
|
},
|
|
21940
21977
|
remove(configPath) {
|
|
21941
|
-
if (!
|
|
21978
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
21942
21979
|
const config = readJsonc(configPath);
|
|
21943
21980
|
const servers = config.mcpServers;
|
|
21944
21981
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21946,7 +21983,7 @@ var geminiAdapter = {
|
|
|
21946
21983
|
return true;
|
|
21947
21984
|
},
|
|
21948
21985
|
getArgentEntry(configPath) {
|
|
21949
|
-
if (!
|
|
21986
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
21950
21987
|
const config = readJsonc(configPath);
|
|
21951
21988
|
const servers = config.mcpServers;
|
|
21952
21989
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21968,7 +22005,7 @@ var geminiAdapter = {
|
|
|
21968
22005
|
},
|
|
21969
22006
|
removeAllowlist(root, scope) {
|
|
21970
22007
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21971
|
-
if (!configPath || !
|
|
22008
|
+
if (!configPath || !fs20.existsSync(configPath)) {
|
|
21972
22009
|
return;
|
|
21973
22010
|
}
|
|
21974
22011
|
const config = readJsonc(configPath);
|
|
@@ -21982,13 +22019,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
21982
22019
|
var codexAdapter = {
|
|
21983
22020
|
name: "Codex",
|
|
21984
22021
|
detect() {
|
|
21985
|
-
return dirHasEditorEvidence(
|
|
22022
|
+
return dirHasEditorEvidence(path21.join(homedir5(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21986
22023
|
},
|
|
21987
22024
|
projectPath(root) {
|
|
21988
|
-
return
|
|
22025
|
+
return path21.join(root, CODEX_FILENAME, "config.toml");
|
|
21989
22026
|
},
|
|
21990
22027
|
globalPath() {
|
|
21991
|
-
return
|
|
22028
|
+
return path21.join(homedir5(), CODEX_FILENAME, "config.toml");
|
|
21992
22029
|
},
|
|
21993
22030
|
write(configPath, entry) {
|
|
21994
22031
|
const config = readToml(configPath);
|
|
@@ -22004,7 +22041,7 @@ var codexAdapter = {
|
|
|
22004
22041
|
writeToml(configPath, config);
|
|
22005
22042
|
},
|
|
22006
22043
|
remove(configPath) {
|
|
22007
|
-
if (!
|
|
22044
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
22008
22045
|
const config = readToml(configPath);
|
|
22009
22046
|
const servers = config.mcp_servers;
|
|
22010
22047
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22014,7 +22051,7 @@ var codexAdapter = {
|
|
|
22014
22051
|
return true;
|
|
22015
22052
|
},
|
|
22016
22053
|
getArgentEntry(configPath) {
|
|
22017
|
-
if (!
|
|
22054
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
22018
22055
|
const config = readToml(configPath);
|
|
22019
22056
|
const servers = config.mcp_servers;
|
|
22020
22057
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22046,7 +22083,7 @@ var codexAdapter = {
|
|
|
22046
22083
|
// them, and an emptied or removed table stays as it is.
|
|
22047
22084
|
refreshAllowlist(root, scope) {
|
|
22048
22085
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22049
|
-
if (!configPath || !
|
|
22086
|
+
if (!configPath || !fs20.existsSync(configPath)) return;
|
|
22050
22087
|
const config = readToml(configPath);
|
|
22051
22088
|
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
22052
22089
|
if (!toolsConfig) return;
|
|
@@ -22083,13 +22120,13 @@ var codexAdapter = {
|
|
|
22083
22120
|
var hermesAdapter = {
|
|
22084
22121
|
name: "Hermes",
|
|
22085
22122
|
detect() {
|
|
22086
|
-
return dirHasEditorEvidence(
|
|
22123
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".hermes"), hermesDirLooksArgentOnly);
|
|
22087
22124
|
},
|
|
22088
22125
|
projectPath() {
|
|
22089
22126
|
return null;
|
|
22090
22127
|
},
|
|
22091
22128
|
globalPath() {
|
|
22092
|
-
return
|
|
22129
|
+
return path21.join(homedir5(), ".hermes", "config.yaml");
|
|
22093
22130
|
},
|
|
22094
22131
|
write(configPath, entry) {
|
|
22095
22132
|
const doc = readYaml(configPath);
|
|
@@ -22108,7 +22145,7 @@ var hermesAdapter = {
|
|
|
22108
22145
|
writeYaml(configPath, doc);
|
|
22109
22146
|
},
|
|
22110
22147
|
remove(configPath) {
|
|
22111
|
-
if (!
|
|
22148
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
22112
22149
|
const doc = readYaml(configPath);
|
|
22113
22150
|
const servers = doc.get("mcp_servers");
|
|
22114
22151
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -22121,7 +22158,7 @@ var hermesAdapter = {
|
|
|
22121
22158
|
return true;
|
|
22122
22159
|
},
|
|
22123
22160
|
getArgentEntry(configPath) {
|
|
22124
|
-
if (!
|
|
22161
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
22125
22162
|
const doc = readYaml(configPath);
|
|
22126
22163
|
const servers = doc.get("mcp_servers");
|
|
22127
22164
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -22148,10 +22185,10 @@ function hasOpenCodeBinary() {
|
|
|
22148
22185
|
}
|
|
22149
22186
|
function pickOpencodeConfig(dir, candidates) {
|
|
22150
22187
|
for (const name of candidates) {
|
|
22151
|
-
const candidate =
|
|
22152
|
-
if (
|
|
22188
|
+
const candidate = path21.join(dir, name);
|
|
22189
|
+
if (fs20.existsSync(candidate)) return candidate;
|
|
22153
22190
|
}
|
|
22154
|
-
return
|
|
22191
|
+
return path21.join(dir, "opencode.json");
|
|
22155
22192
|
}
|
|
22156
22193
|
var openCodeAdapter = {
|
|
22157
22194
|
name: "opencode",
|
|
@@ -22162,7 +22199,7 @@ var openCodeAdapter = {
|
|
|
22162
22199
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
22163
22200
|
},
|
|
22164
22201
|
globalPath() {
|
|
22165
|
-
return pickOpencodeConfig(
|
|
22202
|
+
return pickOpencodeConfig(path21.join(homedir5(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
22166
22203
|
},
|
|
22167
22204
|
write(configPath, entry) {
|
|
22168
22205
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -22173,7 +22210,7 @@ var openCodeAdapter = {
|
|
|
22173
22210
|
});
|
|
22174
22211
|
},
|
|
22175
22212
|
remove(configPath) {
|
|
22176
|
-
if (!
|
|
22213
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
22177
22214
|
const config = readJsonc(configPath);
|
|
22178
22215
|
const servers = config.mcp;
|
|
22179
22216
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22181,7 +22218,7 @@ var openCodeAdapter = {
|
|
|
22181
22218
|
return true;
|
|
22182
22219
|
},
|
|
22183
22220
|
getArgentEntry(configPath) {
|
|
22184
|
-
if (!
|
|
22221
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
22185
22222
|
const config = readJsonc(configPath);
|
|
22186
22223
|
const servers = config.mcp;
|
|
22187
22224
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22196,7 +22233,7 @@ var openCodeAdapter = {
|
|
|
22196
22233
|
},
|
|
22197
22234
|
removeAllowlist(root, scope) {
|
|
22198
22235
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22199
|
-
if (!configPath || !
|
|
22236
|
+
if (!configPath || !fs20.existsSync(configPath)) return;
|
|
22200
22237
|
const config = readJsonc(configPath);
|
|
22201
22238
|
const tools = config.tools;
|
|
22202
22239
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -22207,13 +22244,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
22207
22244
|
var kiroAdapter = {
|
|
22208
22245
|
name: "Kiro",
|
|
22209
22246
|
detect() {
|
|
22210
|
-
return dirHasEditorEvidence(
|
|
22247
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
22211
22248
|
},
|
|
22212
22249
|
projectPath(root) {
|
|
22213
|
-
return
|
|
22250
|
+
return path21.join(root, ".kiro", "settings", "mcp.json");
|
|
22214
22251
|
},
|
|
22215
22252
|
globalPath() {
|
|
22216
|
-
return
|
|
22253
|
+
return path21.join(homedir5(), ".kiro", "settings", "mcp.json");
|
|
22217
22254
|
},
|
|
22218
22255
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
22219
22256
|
// foreign servers survive (see the Cursor adapter).
|
|
@@ -22226,7 +22263,7 @@ var kiroAdapter = {
|
|
|
22226
22263
|
});
|
|
22227
22264
|
},
|
|
22228
22265
|
remove(configPath) {
|
|
22229
|
-
if (!
|
|
22266
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
22230
22267
|
const config = readJsonc(configPath);
|
|
22231
22268
|
const servers = config.mcpServers;
|
|
22232
22269
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22234,7 +22271,7 @@ var kiroAdapter = {
|
|
|
22234
22271
|
return true;
|
|
22235
22272
|
},
|
|
22236
22273
|
getArgentEntry(configPath) {
|
|
22237
|
-
if (!
|
|
22274
|
+
if (!fs20.existsSync(configPath)) return null;
|
|
22238
22275
|
const config = readJsonc(configPath);
|
|
22239
22276
|
const servers = config.mcpServers;
|
|
22240
22277
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22258,7 +22295,7 @@ var kiroAdapter = {
|
|
|
22258
22295
|
},
|
|
22259
22296
|
removeAllowlist(root, scope) {
|
|
22260
22297
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22261
|
-
if (!configPath || !
|
|
22298
|
+
if (!configPath || !fs20.existsSync(configPath)) return;
|
|
22262
22299
|
const config = readJsonc(configPath);
|
|
22263
22300
|
const servers = config.mcpServers;
|
|
22264
22301
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -22310,7 +22347,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
22310
22347
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
22311
22348
|
}
|
|
22312
22349
|
function removeAllowRule(settingsPath, rule) {
|
|
22313
|
-
if (!
|
|
22350
|
+
if (!fs20.existsSync(settingsPath)) return;
|
|
22314
22351
|
const config = readJsonc(settingsPath);
|
|
22315
22352
|
const permissions = config?.permissions;
|
|
22316
22353
|
const allow = permissions?.allow;
|
|
@@ -22320,7 +22357,7 @@ function removeAllowRule(settingsPath, rule) {
|
|
|
22320
22357
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
22321
22358
|
}
|
|
22322
22359
|
function claudeSettingsPath(root, scope) {
|
|
22323
|
-
return scope === "global" ?
|
|
22360
|
+
return scope === "global" ? path21.join(homedir5(), ".claude", "settings.json") : path21.join(root, ".claude", "settings.json");
|
|
22324
22361
|
}
|
|
22325
22362
|
function addClaudePermission(root, scope) {
|
|
22326
22363
|
addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
@@ -22333,13 +22370,13 @@ function formatCopyDestination(target, writtenPath, root) {
|
|
|
22333
22370
|
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
22334
22371
|
}
|
|
22335
22372
|
function formatManagedPathLabel(targetPath, root) {
|
|
22336
|
-
for (const home of [
|
|
22337
|
-
if (targetPath === home || targetPath.startsWith(`${home}${
|
|
22373
|
+
for (const home of [path21.resolve(homedir5()), canonicalPath(homedir5())]) {
|
|
22374
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path21.sep}`)) {
|
|
22338
22375
|
return `~${targetPath.slice(home.length)}`;
|
|
22339
22376
|
}
|
|
22340
22377
|
}
|
|
22341
|
-
const relative5 =
|
|
22342
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22378
|
+
const relative5 = path21.relative(root, targetPath);
|
|
22379
|
+
if (relative5 && !relative5.startsWith("..") && !path21.isAbsolute(relative5)) {
|
|
22343
22380
|
return relative5;
|
|
22344
22381
|
}
|
|
22345
22382
|
return targetPath;
|
|
@@ -22353,7 +22390,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
22353
22390
|
}
|
|
22354
22391
|
function getAdapterBasePath(adapter, root, scope) {
|
|
22355
22392
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
22356
|
-
return configPath ?
|
|
22393
|
+
return configPath ? path21.dirname(configPath) : null;
|
|
22357
22394
|
}
|
|
22358
22395
|
function getManagedContentTargets(adapters, root, scope) {
|
|
22359
22396
|
const targets = {
|
|
@@ -22367,13 +22404,13 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22367
22404
|
addManagedTarget(
|
|
22368
22405
|
targets.skillTargets,
|
|
22369
22406
|
"skills",
|
|
22370
|
-
|
|
22407
|
+
path21.join(workspaceBase, ".agents", "skills"),
|
|
22371
22408
|
root
|
|
22372
22409
|
);
|
|
22373
22410
|
addManagedTarget(
|
|
22374
22411
|
targets.skillsLockTargets,
|
|
22375
22412
|
"skills",
|
|
22376
|
-
|
|
22413
|
+
path21.join(workspaceBase, "skills-lock.json"),
|
|
22377
22414
|
root
|
|
22378
22415
|
);
|
|
22379
22416
|
for (const adapter of adapters) {
|
|
@@ -22381,21 +22418,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22381
22418
|
case "Cursor": {
|
|
22382
22419
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
22383
22420
|
if (!base) break;
|
|
22384
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22385
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22421
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(base, "skills"), root);
|
|
22422
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(base, "rules"), root);
|
|
22386
22423
|
break;
|
|
22387
22424
|
}
|
|
22388
22425
|
case "Claude Code": {
|
|
22389
|
-
const claudeBase = scope === "global" ?
|
|
22390
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22391
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22392
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22426
|
+
const claudeBase = scope === "global" ? path21.join(homedir5(), ".claude") : path21.join(root, ".claude");
|
|
22427
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(claudeBase, "skills"), root);
|
|
22428
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(claudeBase, "rules"), root);
|
|
22429
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(claudeBase, "agents"), root);
|
|
22393
22430
|
break;
|
|
22394
22431
|
}
|
|
22395
22432
|
case "Gemini": {
|
|
22396
|
-
const geminiBase = scope === "global" ?
|
|
22397
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22398
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22433
|
+
const geminiBase = scope === "global" ? path21.join(homedir5(), ".gemini") : path21.join(root, ".gemini");
|
|
22434
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(geminiBase, "rules"), root);
|
|
22435
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(geminiBase, "agents"), root);
|
|
22399
22436
|
break;
|
|
22400
22437
|
}
|
|
22401
22438
|
case "Codex": {
|
|
@@ -22405,19 +22442,19 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22405
22442
|
break;
|
|
22406
22443
|
}
|
|
22407
22444
|
case "opencode": {
|
|
22408
|
-
const base = scope === "global" ?
|
|
22409
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22410
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22445
|
+
const base = scope === "global" ? path21.join(homedir5(), ".config", "opencode") : path21.join(root, ".opencode");
|
|
22446
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(base, "skills"), root);
|
|
22447
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(base, "agents"), root);
|
|
22411
22448
|
break;
|
|
22412
22449
|
}
|
|
22413
22450
|
case "Kiro": {
|
|
22414
|
-
const kiroBase = scope === "global" ?
|
|
22415
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22451
|
+
const kiroBase = scope === "global" ? path21.join(homedir5(), ".kiro") : path21.join(root, ".kiro");
|
|
22452
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(kiroBase, "skills"), root);
|
|
22416
22453
|
break;
|
|
22417
22454
|
}
|
|
22418
22455
|
case "Devin Desktop": {
|
|
22419
|
-
const devinBase = scope === "global" ?
|
|
22420
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22456
|
+
const devinBase = scope === "global" ? path21.join(process.env.XDG_CONFIG_HOME || path21.join(homedir5(), ".config"), "devin") : path21.join(root, ".devin");
|
|
22457
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(devinBase, "skills"), root);
|
|
22421
22458
|
break;
|
|
22422
22459
|
}
|
|
22423
22460
|
}
|
|
@@ -22431,12 +22468,12 @@ function stripFrontmatter(content) {
|
|
|
22431
22468
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22432
22469
|
}
|
|
22433
22470
|
function readAndConcatRules(rulesDir) {
|
|
22434
|
-
if (!
|
|
22435
|
-
const files =
|
|
22471
|
+
if (!fs20.existsSync(rulesDir)) return null;
|
|
22472
|
+
const files = fs20.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22436
22473
|
if (files.length === 0) return null;
|
|
22437
22474
|
const parts = [];
|
|
22438
22475
|
for (const file of files) {
|
|
22439
|
-
const raw =
|
|
22476
|
+
const raw = fs20.readFileSync(path21.join(rulesDir, file), "utf8");
|
|
22440
22477
|
const stripped = stripFrontmatter(raw);
|
|
22441
22478
|
if (stripped) parts.push(stripped);
|
|
22442
22479
|
}
|
|
@@ -22471,7 +22508,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22471
22508
|
return configPath;
|
|
22472
22509
|
}
|
|
22473
22510
|
function removeCodexRules(configPath) {
|
|
22474
|
-
if (!
|
|
22511
|
+
if (!fs20.existsSync(configPath)) return false;
|
|
22475
22512
|
const config = readToml(configPath);
|
|
22476
22513
|
const existing = config.developer_instructions;
|
|
22477
22514
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22563,10 +22600,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22563
22600
|
}
|
|
22564
22601
|
|
|
22565
22602
|
// ../argent-installer/src/retired-files.ts
|
|
22566
|
-
import * as
|
|
22603
|
+
import * as path22 from "node:path";
|
|
22567
22604
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
22568
22605
|
function displayPath(entry, file) {
|
|
22569
|
-
return
|
|
22606
|
+
return path22.join(entry.location, ...file.relativePath.split("/"));
|
|
22570
22607
|
}
|
|
22571
22608
|
async function cleanupRetiredFiles(found, options) {
|
|
22572
22609
|
const result = { removed: [], declined: [], failed: [], removedRoots: [] };
|
|
@@ -22617,14 +22654,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22617
22654
|
|
|
22618
22655
|
// ../argent-installer/src/cli-record.ts
|
|
22619
22656
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22620
|
-
import * as
|
|
22621
|
-
import * as
|
|
22657
|
+
import * as fs21 from "node:fs";
|
|
22658
|
+
import * as path23 from "node:path";
|
|
22622
22659
|
function cliRecordPath() {
|
|
22623
|
-
return
|
|
22660
|
+
return path23.join(argentHomeDir(), "cli.json");
|
|
22624
22661
|
}
|
|
22625
22662
|
function readCliRecord() {
|
|
22626
22663
|
try {
|
|
22627
|
-
const parsed = JSON.parse(
|
|
22664
|
+
const parsed = JSON.parse(fs21.readFileSync(cliRecordPath(), "utf8"));
|
|
22628
22665
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22629
22666
|
return null;
|
|
22630
22667
|
} catch {
|
|
@@ -22634,7 +22671,7 @@ function readCliRecord() {
|
|
|
22634
22671
|
function resolveCliEntry(mode, projectRoot) {
|
|
22635
22672
|
if (mode === "local") {
|
|
22636
22673
|
const relative5 = getLocalArgentBinRelPath(projectRoot);
|
|
22637
|
-
return relative5 ?
|
|
22674
|
+
return relative5 ? path23.resolve(projectRoot, relative5) : null;
|
|
22638
22675
|
}
|
|
22639
22676
|
const packageRoot = getGloballyInstalledPackageRoot();
|
|
22640
22677
|
return packageRoot ? cliPathOf(packageRoot) : null;
|
|
@@ -22653,10 +22690,10 @@ function writeCliRecord(input) {
|
|
|
22653
22690
|
function persistCliRecord(record) {
|
|
22654
22691
|
const file = cliRecordPath();
|
|
22655
22692
|
try {
|
|
22656
|
-
|
|
22693
|
+
fs21.mkdirSync(path23.dirname(file), { recursive: true });
|
|
22657
22694
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
22658
|
-
|
|
22659
|
-
|
|
22695
|
+
fs21.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22696
|
+
fs21.renameSync(temporary, file);
|
|
22660
22697
|
return file;
|
|
22661
22698
|
} catch {
|
|
22662
22699
|
return null;
|
|
@@ -22664,10 +22701,10 @@ function persistCliRecord(record) {
|
|
|
22664
22701
|
}
|
|
22665
22702
|
function healCliRecord(input) {
|
|
22666
22703
|
try {
|
|
22667
|
-
if (!
|
|
22704
|
+
if (!fs21.existsSync(input.cli)) return null;
|
|
22668
22705
|
const existing = readCliRecord();
|
|
22669
22706
|
if (existing) {
|
|
22670
|
-
const alive =
|
|
22707
|
+
const alive = fs21.existsSync(existing.node) && fs21.existsSync(existing.cli);
|
|
22671
22708
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22672
22709
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22673
22710
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22688,11 +22725,11 @@ function removeCliRecordFor(installDir) {
|
|
|
22688
22725
|
if (!installDir) return false;
|
|
22689
22726
|
const record = readCliRecord();
|
|
22690
22727
|
if (!record) return false;
|
|
22691
|
-
const root =
|
|
22692
|
-
const relative5 =
|
|
22693
|
-
if (relative5.startsWith("..") ||
|
|
22728
|
+
const root = path23.resolve(installDir);
|
|
22729
|
+
const relative5 = path23.relative(root, path23.resolve(record.cli));
|
|
22730
|
+
if (relative5.startsWith("..") || path23.isAbsolute(relative5)) return false;
|
|
22694
22731
|
try {
|
|
22695
|
-
|
|
22732
|
+
fs21.rmSync(cliRecordPath(), { force: true });
|
|
22696
22733
|
return true;
|
|
22697
22734
|
} catch {
|
|
22698
22735
|
return false;
|
|
@@ -22728,9 +22765,11 @@ async function resolveTelemetryConsent(opts) {
|
|
|
22728
22765
|
printFirstRunNotice();
|
|
22729
22766
|
return { kind: "skipped" };
|
|
22730
22767
|
}
|
|
22731
|
-
const
|
|
22768
|
+
const state2 = getConsentState();
|
|
22769
|
+
const source = state2.source.source;
|
|
22732
22770
|
const envOwnsDecision = source === "env_do_not_track" || source === "env_argent_telemetry";
|
|
22733
|
-
|
|
22771
|
+
const configOptedOut = source === "config_file" && !state2.enabled;
|
|
22772
|
+
if (envOwnsDecision || configOptedOut || hasShownFirstRunNotice()) {
|
|
22734
22773
|
return { kind: "skipped" };
|
|
22735
22774
|
}
|
|
22736
22775
|
log.info(
|
|
@@ -22916,8 +22955,8 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22916
22955
|
|
|
22917
22956
|
// ../argent-installer/src/install-runner.ts
|
|
22918
22957
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22919
|
-
import * as
|
|
22920
|
-
import * as
|
|
22958
|
+
import * as fs24 from "node:fs";
|
|
22959
|
+
import * as path26 from "node:path";
|
|
22921
22960
|
|
|
22922
22961
|
// ../argent-installer/src/shell.ts
|
|
22923
22962
|
import { execFileSync as execFileSync6, spawn as spawn2 } from "node:child_process";
|
|
@@ -22949,7 +22988,7 @@ var ShellCommandError = class extends Error {
|
|
|
22949
22988
|
signal;
|
|
22950
22989
|
};
|
|
22951
22990
|
function runShellCommand(cmd, opts = {}) {
|
|
22952
|
-
return new Promise((
|
|
22991
|
+
return new Promise((resolve22, reject) => {
|
|
22953
22992
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22954
22993
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22955
22994
|
shell: process.platform === "win32",
|
|
@@ -22965,7 +23004,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22965
23004
|
stderr += chunk.toString();
|
|
22966
23005
|
});
|
|
22967
23006
|
child.on("close", (code, signal) => {
|
|
22968
|
-
if (code === 0)
|
|
23007
|
+
if (code === 0) resolve22();
|
|
22969
23008
|
else
|
|
22970
23009
|
reject(
|
|
22971
23010
|
new ShellCommandError(
|
|
@@ -22981,33 +23020,33 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22981
23020
|
|
|
22982
23021
|
// ../argent-installer/src/skills.ts
|
|
22983
23022
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
22984
|
-
import * as
|
|
22985
|
-
import * as
|
|
23023
|
+
import * as fs23 from "node:fs";
|
|
23024
|
+
import * as path25 from "node:path";
|
|
22986
23025
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
22987
23026
|
|
|
22988
23027
|
// ../argent-installer/src/skills-runner.ts
|
|
22989
23028
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
22990
|
-
import * as
|
|
22991
|
-
import * as
|
|
23029
|
+
import * as fs22 from "node:fs";
|
|
23030
|
+
import * as path24 from "node:path";
|
|
22992
23031
|
var WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
22993
23032
|
function findOnPath(bin, env, platform) {
|
|
22994
23033
|
const pathValue = env.PATH ?? env.Path ?? "";
|
|
22995
|
-
const dirs = pathValue.split(
|
|
23034
|
+
const dirs = pathValue.split(path24.delimiter).filter((dir) => path24.isAbsolute(dir));
|
|
22996
23035
|
if (platform === "win32") {
|
|
22997
23036
|
const exts = (env.PATHEXT ?? WIN32_DEFAULT_PATHEXT).split(";").filter(Boolean);
|
|
22998
23037
|
for (const dir of dirs) {
|
|
22999
23038
|
for (const ext of exts) {
|
|
23000
|
-
const candidate =
|
|
23001
|
-
if (
|
|
23039
|
+
const candidate = path24.join(dir, bin + ext);
|
|
23040
|
+
if (fs22.existsSync(candidate)) return candidate;
|
|
23002
23041
|
}
|
|
23003
23042
|
}
|
|
23004
23043
|
return null;
|
|
23005
23044
|
}
|
|
23006
23045
|
for (const dir of dirs) {
|
|
23007
|
-
const candidate =
|
|
23046
|
+
const candidate = path24.join(dir, bin);
|
|
23008
23047
|
try {
|
|
23009
|
-
if (!
|
|
23010
|
-
|
|
23048
|
+
if (!fs22.statSync(candidate).isFile()) continue;
|
|
23049
|
+
fs22.accessSync(candidate, fs22.constants.X_OK);
|
|
23011
23050
|
return candidate;
|
|
23012
23051
|
} catch {
|
|
23013
23052
|
}
|
|
@@ -23184,13 +23223,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
23184
23223
|
let candidates = names;
|
|
23185
23224
|
if (names.length === 0) {
|
|
23186
23225
|
try {
|
|
23187
|
-
candidates =
|
|
23226
|
+
candidates = fs23.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
23188
23227
|
} catch {
|
|
23189
23228
|
continue;
|
|
23190
23229
|
}
|
|
23191
23230
|
}
|
|
23192
23231
|
for (const name of candidates) {
|
|
23193
|
-
const stat6 =
|
|
23232
|
+
const stat6 = fs23.statSync(path25.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
23194
23233
|
if (!stat6?.isFile()) continue;
|
|
23195
23234
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
23196
23235
|
}
|
|
@@ -23208,7 +23247,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
|
|
|
23208
23247
|
const removed = /* @__PURE__ */ new Set();
|
|
23209
23248
|
for (const { targetPath } of skillTargets) {
|
|
23210
23249
|
for (const name of legacy) {
|
|
23211
|
-
const dir =
|
|
23250
|
+
const dir = path25.join(targetPath, name);
|
|
23212
23251
|
try {
|
|
23213
23252
|
if (removePath(dir)) removed.add(name);
|
|
23214
23253
|
} catch {
|
|
@@ -23228,13 +23267,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
23228
23267
|
}
|
|
23229
23268
|
function removeLockEntries(lockPath, names) {
|
|
23230
23269
|
try {
|
|
23231
|
-
const lock = JSON.parse(
|
|
23270
|
+
const lock = JSON.parse(fs23.readFileSync(lockPath, "utf8"));
|
|
23232
23271
|
const skills = lock.skills;
|
|
23233
23272
|
if (!skills) return [];
|
|
23234
23273
|
const removed = names.filter((name) => name in skills);
|
|
23235
23274
|
if (removed.length === 0) return [];
|
|
23236
23275
|
for (const name of removed) delete skills[name];
|
|
23237
|
-
|
|
23276
|
+
fs23.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
23238
23277
|
return removed;
|
|
23239
23278
|
} catch {
|
|
23240
23279
|
return [];
|
|
@@ -23305,7 +23344,7 @@ async function runInstall(args) {
|
|
|
23305
23344
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
23306
23345
|
}
|
|
23307
23346
|
function installSpec(fromTar) {
|
|
23308
|
-
return
|
|
23347
|
+
return fs24.existsSync(fromTar) ? path26.resolve(fromTar) : fromTar;
|
|
23309
23348
|
}
|
|
23310
23349
|
async function installLocally(opts) {
|
|
23311
23350
|
const { fromTar, tel } = opts;
|
|
@@ -23612,8 +23651,8 @@ async function chooseAdapters(opts) {
|
|
|
23612
23651
|
|
|
23613
23652
|
// ../argent-installer/src/init-scope.ts
|
|
23614
23653
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
23615
|
-
import { existsSync as
|
|
23616
|
-
import { resolve as
|
|
23654
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
23655
|
+
import { resolve as resolve15 } from "node:path";
|
|
23617
23656
|
async function chooseScope(opts) {
|
|
23618
23657
|
if (opts.installMode === "local") {
|
|
23619
23658
|
return { scope: "local" };
|
|
@@ -23650,13 +23689,13 @@ async function chooseScope(opts) {
|
|
|
23650
23689
|
placeholder: process.cwd(),
|
|
23651
23690
|
validate(value) {
|
|
23652
23691
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
23653
|
-
const resolved =
|
|
23654
|
-
if (!
|
|
23692
|
+
const resolved = resolve15(value.trim());
|
|
23693
|
+
if (!existsSync16(resolved))
|
|
23655
23694
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
23656
23695
|
}
|
|
23657
23696
|
});
|
|
23658
23697
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
23659
|
-
return { scope: "custom", customRoot:
|
|
23698
|
+
return { scope: "custom", customRoot: resolve15(customPathInput.trim()) };
|
|
23660
23699
|
}
|
|
23661
23700
|
|
|
23662
23701
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23956,8 +23995,8 @@ async function configureAllowlist(args) {
|
|
|
23956
23995
|
// ../argent-installer/src/init-skills.ts
|
|
23957
23996
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
23958
23997
|
import { spawn as spawn3 } from "node:child_process";
|
|
23959
|
-
import * as
|
|
23960
|
-
import * as
|
|
23998
|
+
import * as os5 from "node:os";
|
|
23999
|
+
import * as path27 from "node:path";
|
|
23961
24000
|
var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
|
|
23962
24001
|
function meaningfulLine(err) {
|
|
23963
24002
|
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));
|
|
@@ -23965,10 +24004,10 @@ function meaningfulLine(err) {
|
|
|
23965
24004
|
}
|
|
23966
24005
|
function bundledCopyFor(version) {
|
|
23967
24006
|
const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
|
|
23968
|
-
if (local.packageDir && local.version === version) return
|
|
24007
|
+
if (local.packageDir && local.version === version) return path27.join(local.packageDir, "skills");
|
|
23969
24008
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
23970
24009
|
if (globalRoot && getGloballyInstalledVersion() === version) {
|
|
23971
|
-
return
|
|
24010
|
+
return path27.join(globalRoot, "skills");
|
|
23972
24011
|
}
|
|
23973
24012
|
return SKILLS_DIR;
|
|
23974
24013
|
}
|
|
@@ -24073,7 +24112,7 @@ async function runSkillsStep(args) {
|
|
|
24073
24112
|
const useGitHubSource = online && !fromTar && version !== "unknown";
|
|
24074
24113
|
const skillsSource = useGitHubSource ? buildArgentSkillsSource(version) : SKILLS_DIR;
|
|
24075
24114
|
const bundledCopy = useGitHubSource ? bundledCopyFor(version) : SKILLS_DIR;
|
|
24076
|
-
const skillsRoot = scope === "global" ?
|
|
24115
|
+
const skillsRoot = scope === "global" ? os5.homedir() : effectiveRoot;
|
|
24077
24116
|
const skillsScope = scope === "global" ? "global" : "project";
|
|
24078
24117
|
const expected = listBundledSkills(bundledCopy);
|
|
24079
24118
|
const snapshot = () => snapshotArgentSkills(skillsRoot, skillsScope, expected);
|
|
@@ -24195,7 +24234,7 @@ async function runSkillsStep(args) {
|
|
|
24195
24234
|
async function runSkillsCli(runner, args, interactive, cwd) {
|
|
24196
24235
|
if (!runner) throw new Error(NO_SKILLS_RUNNER_MESSAGE);
|
|
24197
24236
|
const command = skillsCommand(runner, args);
|
|
24198
|
-
return new Promise((
|
|
24237
|
+
return new Promise((resolve22, reject) => {
|
|
24199
24238
|
const child = spawn3(command.file, command.args, {
|
|
24200
24239
|
env: npxChildEnv(),
|
|
24201
24240
|
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
@@ -24214,7 +24253,7 @@ async function runSkillsCli(runner, args, interactive, cwd) {
|
|
|
24214
24253
|
}
|
|
24215
24254
|
child.on("close", (code, signal) => {
|
|
24216
24255
|
if (code === 0) {
|
|
24217
|
-
|
|
24256
|
+
resolve22();
|
|
24218
24257
|
} else {
|
|
24219
24258
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
24220
24259
|
reject(
|
|
@@ -24535,9 +24574,9 @@ function printBanner() {
|
|
|
24535
24574
|
// ../argent-installer/src/update.ts
|
|
24536
24575
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24537
24576
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24538
|
-
import * as
|
|
24539
|
-
import * as
|
|
24540
|
-
import * as
|
|
24577
|
+
import * as fs26 from "node:fs";
|
|
24578
|
+
import * as os7 from "node:os";
|
|
24579
|
+
import * as path33 from "node:path";
|
|
24541
24580
|
|
|
24542
24581
|
// ../argent-installer/src/install-targets.ts
|
|
24543
24582
|
function parseTargetFlags(args) {
|
|
@@ -24609,17 +24648,17 @@ async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
|
|
|
24609
24648
|
|
|
24610
24649
|
// ../argent-tools-client/src/launcher.ts
|
|
24611
24650
|
import * as net from "node:net";
|
|
24612
|
-
import * as
|
|
24613
|
-
import * as
|
|
24651
|
+
import * as os6 from "node:os";
|
|
24652
|
+
import * as fs25 from "node:fs";
|
|
24653
|
+
import * as path28 from "node:path";
|
|
24614
24654
|
import * as readline from "node:readline";
|
|
24615
|
-
import { homedir as homedir7 } from "node:os";
|
|
24616
24655
|
import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
|
|
24617
24656
|
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
24618
|
-
import {
|
|
24619
|
-
var STATE_DIR =
|
|
24620
|
-
var STATE_FILE =
|
|
24621
|
-
var LOG_FILE =
|
|
24622
|
-
var LOCK_FILE =
|
|
24657
|
+
import { readFile, readdir as readdir2, unlink } from "node:fs/promises";
|
|
24658
|
+
var STATE_DIR = argentHomeDir();
|
|
24659
|
+
var STATE_FILE = path28.join(STATE_DIR, "tool-server.json");
|
|
24660
|
+
var LOG_FILE = path28.join(STATE_DIR, "tool-server.log");
|
|
24661
|
+
var LOCK_FILE = path28.join(STATE_DIR, "tool-server.lock");
|
|
24623
24662
|
function isProcessAlive(pid) {
|
|
24624
24663
|
try {
|
|
24625
24664
|
process.kill(pid, 0);
|
|
@@ -24628,9 +24667,10 @@ function isProcessAlive(pid) {
|
|
|
24628
24667
|
return false;
|
|
24629
24668
|
}
|
|
24630
24669
|
}
|
|
24631
|
-
function stateFileForBundle(bundlePath) {
|
|
24670
|
+
function stateFileForBundle(bundlePath, cloudProfile) {
|
|
24632
24671
|
const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
24633
|
-
|
|
24672
|
+
const profile = cloudProfile ? `-cloud-${cloudProfile}` : "";
|
|
24673
|
+
return path28.join(STATE_DIR, `tool-server-${key}${profile}.json`);
|
|
24634
24674
|
}
|
|
24635
24675
|
async function readStateFile(file) {
|
|
24636
24676
|
try {
|
|
@@ -24640,16 +24680,22 @@ async function readStateFile(file) {
|
|
|
24640
24680
|
return null;
|
|
24641
24681
|
}
|
|
24642
24682
|
}
|
|
24643
|
-
async function readToolsServerState(bundlePath) {
|
|
24683
|
+
async function readToolsServerState(bundlePath, cloudProfile) {
|
|
24644
24684
|
if (bundlePath === void 0) return readStateFile(STATE_FILE);
|
|
24685
|
+
if (cloudProfile) {
|
|
24686
|
+
const own2 = await readStateFile(stateFileForBundle(bundlePath, cloudProfile));
|
|
24687
|
+
return own2?.cloudProfile === cloudProfile ? own2 : null;
|
|
24688
|
+
}
|
|
24645
24689
|
const own = await readStateFile(stateFileForBundle(bundlePath));
|
|
24646
24690
|
if (own) return own;
|
|
24647
24691
|
const legacy = await readStateFile(STATE_FILE);
|
|
24648
24692
|
return legacy && legacy.bundlePath === bundlePath ? legacy : null;
|
|
24649
24693
|
}
|
|
24650
|
-
async function clearToolsServerState(bundlePath) {
|
|
24694
|
+
async function clearToolsServerState(bundlePath, cloudProfile) {
|
|
24651
24695
|
const files = [STATE_FILE];
|
|
24652
|
-
if (bundlePath !== void 0) {
|
|
24696
|
+
if (bundlePath !== void 0 && cloudProfile) {
|
|
24697
|
+
files[0] = stateFileForBundle(bundlePath, cloudProfile);
|
|
24698
|
+
} else if (bundlePath !== void 0) {
|
|
24653
24699
|
files[0] = stateFileForBundle(bundlePath);
|
|
24654
24700
|
const legacy = await readStateFile(STATE_FILE);
|
|
24655
24701
|
if (legacy && legacy.bundlePath === bundlePath) files.push(STATE_FILE);
|
|
@@ -24661,7 +24707,7 @@ async function clearToolsServerState(bundlePath) {
|
|
|
24661
24707
|
}
|
|
24662
24708
|
}
|
|
24663
24709
|
}
|
|
24664
|
-
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12})?\.json$/;
|
|
24710
|
+
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12}(-cloud-[0-9a-f]{12})?)?\.json$/;
|
|
24665
24711
|
async function readAllToolsServerStates() {
|
|
24666
24712
|
let names;
|
|
24667
24713
|
try {
|
|
@@ -24672,7 +24718,7 @@ async function readAllToolsServerStates() {
|
|
|
24672
24718
|
const out = [];
|
|
24673
24719
|
for (const name of names) {
|
|
24674
24720
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
24675
|
-
const file =
|
|
24721
|
+
const file = path28.join(STATE_DIR, name);
|
|
24676
24722
|
const state2 = await readStateFile(file);
|
|
24677
24723
|
if (state2) out.push({ file, state: state2 });
|
|
24678
24724
|
}
|
|
@@ -24707,32 +24753,32 @@ async function terminatePid(pid, stillOurs) {
|
|
|
24707
24753
|
}
|
|
24708
24754
|
await waitForExit(pid, SIGKILL_GRACE_MS);
|
|
24709
24755
|
}
|
|
24710
|
-
async function killToolServer(bundlePath) {
|
|
24711
|
-
const state2 = await readState(bundlePath);
|
|
24756
|
+
async function killToolServer(bundlePath, cloudProfile) {
|
|
24757
|
+
const state2 = await readState(bundlePath, cloudProfile);
|
|
24712
24758
|
if (!state2) return false;
|
|
24713
24759
|
const stillOurs = () => couldBeOurToolServer(state2.pid, state2.bundlePath);
|
|
24714
24760
|
const alive = isProcessAlive(state2.pid);
|
|
24715
24761
|
if (alive && !stillOurs()) return false;
|
|
24716
24762
|
if (alive) await terminatePid(state2.pid, stillOurs);
|
|
24717
|
-
await clearToolsServerState(bundlePath ?? state2.bundlePath);
|
|
24763
|
+
await clearToolsServerState(bundlePath ?? state2.bundlePath, cloudProfile);
|
|
24718
24764
|
return alive;
|
|
24719
24765
|
}
|
|
24720
24766
|
function isPathWithin(child, parent) {
|
|
24721
|
-
const rel =
|
|
24722
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
24767
|
+
const rel = path28.relative(parent, child);
|
|
24768
|
+
return rel !== "" && !rel.startsWith("..") && !path28.isAbsolute(rel);
|
|
24723
24769
|
}
|
|
24724
24770
|
function tryRealpath(p) {
|
|
24725
24771
|
try {
|
|
24726
|
-
return
|
|
24772
|
+
return fs25.realpathSync(p);
|
|
24727
24773
|
} catch {
|
|
24728
24774
|
return p;
|
|
24729
24775
|
}
|
|
24730
24776
|
}
|
|
24731
24777
|
async function killToolServerForInstallDir(packageDir) {
|
|
24732
|
-
const parents = /* @__PURE__ */ new Set([
|
|
24778
|
+
const parents = /* @__PURE__ */ new Set([path28.resolve(packageDir), tryRealpath(packageDir)]);
|
|
24733
24779
|
let killed = 0;
|
|
24734
24780
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
24735
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
24781
|
+
const bundles = /* @__PURE__ */ new Set([path28.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
24736
24782
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
24737
24783
|
if (!matches2) continue;
|
|
24738
24784
|
const fresh = await readStateFile(file);
|
|
@@ -24750,7 +24796,7 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24750
24796
|
}
|
|
24751
24797
|
return killed;
|
|
24752
24798
|
}
|
|
24753
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24799
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs25.existsSync(p)) ?? "ps";
|
|
24754
24800
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24755
24801
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24756
24802
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -24797,38 +24843,37 @@ function couldBeOurToolServer(pid, marker) {
|
|
|
24797
24843
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
24798
24844
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
24799
24845
|
import { maxHeaderSize } from "node:http";
|
|
24800
|
-
import * as
|
|
24846
|
+
import * as path32 from "node:path";
|
|
24801
24847
|
|
|
24802
24848
|
// ../argent-tools-client/src/link-config.ts
|
|
24803
|
-
import * as
|
|
24804
|
-
import {
|
|
24805
|
-
|
|
24806
|
-
var
|
|
24807
|
-
var LINK_FILE = path27.join(LINK_DIR, "link.json");
|
|
24849
|
+
import * as path29 from "node:path";
|
|
24850
|
+
import { mkdir, writeFile, readFile as readFile2, unlink as unlink2, chmod } from "node:fs/promises";
|
|
24851
|
+
var LINK_DIR = argentHomeDir();
|
|
24852
|
+
var LINK_FILE = path29.join(LINK_DIR, "link.json");
|
|
24808
24853
|
|
|
24809
24854
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24810
24855
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
24811
|
-
import { createReadStream as createReadStream2, rmSync as
|
|
24856
|
+
import { createReadStream as createReadStream2, rmSync as rmSync7 } from "node:fs";
|
|
24812
24857
|
import {
|
|
24813
|
-
chmod as
|
|
24858
|
+
chmod as chmod2,
|
|
24814
24859
|
lstat,
|
|
24815
|
-
mkdir as
|
|
24860
|
+
mkdir as mkdir2,
|
|
24816
24861
|
readFile as readFile3,
|
|
24817
24862
|
realpath as realpath2,
|
|
24818
|
-
rename
|
|
24863
|
+
rename,
|
|
24819
24864
|
rm as rm2,
|
|
24820
24865
|
stat as stat3,
|
|
24821
|
-
writeFile as
|
|
24866
|
+
writeFile as writeFile2
|
|
24822
24867
|
} from "node:fs/promises";
|
|
24823
|
-
import { constants as
|
|
24824
|
-
import * as
|
|
24868
|
+
import { constants as constants3, tmpdir } from "node:os";
|
|
24869
|
+
import * as path30 from "node:path";
|
|
24825
24870
|
|
|
24826
24871
|
// ../archive/src/index.ts
|
|
24827
24872
|
import { spawn as spawn5 } from "node:child_process";
|
|
24828
24873
|
import { once } from "node:events";
|
|
24829
24874
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
24830
24875
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24831
|
-
import { basename as basename5, dirname as
|
|
24876
|
+
import { basename as basename5, dirname as dirname15, join as join28, resolve as resolve17, sep as sep4 } from "node:path";
|
|
24832
24877
|
import { Writable } from "node:stream";
|
|
24833
24878
|
import { pipeline } from "node:stream/promises";
|
|
24834
24879
|
import zlib2 from "node:zlib";
|
|
@@ -24846,23 +24891,33 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
24846
24891
|
// ../argent-tools-client/src/flow-files.ts
|
|
24847
24892
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
24848
24893
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
24849
|
-
import * as
|
|
24894
|
+
import * as path31 from "node:path";
|
|
24850
24895
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
24851
24896
|
|
|
24897
|
+
// ../argent-tools-client/src/tools-client.ts
|
|
24898
|
+
var RECORDING_FILE_INPUT = {
|
|
24899
|
+
target: "__recording",
|
|
24900
|
+
path: `\${project_root}/${E2E_DIRS[0].split(path32.sep).join("/")}/\${name}.yaml`,
|
|
24901
|
+
paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(path32.sep).join("/")}/\${name}.yaml`),
|
|
24902
|
+
kind: "file",
|
|
24903
|
+
optional: true,
|
|
24904
|
+
collect: "flow"
|
|
24905
|
+
};
|
|
24906
|
+
|
|
24852
24907
|
// ../argent-tools-client/src/artifacts.ts
|
|
24853
24908
|
import {
|
|
24854
24909
|
copyFile,
|
|
24855
|
-
mkdir as
|
|
24910
|
+
mkdir as mkdir3,
|
|
24856
24911
|
mkdtemp,
|
|
24857
24912
|
readFile as readFile6,
|
|
24858
24913
|
realpath as realpath4,
|
|
24859
24914
|
rm as rm3,
|
|
24860
24915
|
stat as stat5,
|
|
24861
|
-
writeFile as
|
|
24916
|
+
writeFile as writeFile3
|
|
24862
24917
|
} from "node:fs/promises";
|
|
24863
24918
|
import { constants as fsConstants } from "node:fs";
|
|
24864
24919
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24865
|
-
import { basename as basename8,
|
|
24920
|
+
import { basename as basename8, extname as extname2, isAbsolute as isAbsolute10, join as join32, normalize as normalize2, resolve as resolve20, sep as sep8 } from "node:path";
|
|
24866
24921
|
import { createHash as createHash5 } from "node:crypto";
|
|
24867
24922
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
24868
24923
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -24937,7 +24992,7 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24937
24992
|
return installed ? "standalone_update" : "standalone_install";
|
|
24938
24993
|
}
|
|
24939
24994
|
function isLivePinnedEntry(entry) {
|
|
24940
|
-
return entry !== null && isPinnedGlobalEntry(entry) &&
|
|
24995
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs26.existsSync(entry.command) && fs26.existsSync(entry.args[0]);
|
|
24941
24996
|
}
|
|
24942
24997
|
async function refreshConfiguration({
|
|
24943
24998
|
projectRoot,
|
|
@@ -25169,7 +25224,7 @@ async function update(args) {
|
|
|
25169
25224
|
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
25170
25225
|
if (automatic) {
|
|
25171
25226
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
25172
|
-
if (!globallyInstalled || !globalRoot ||
|
|
25227
|
+
if (!globallyInstalled || !globalRoot || fs26.realpathSync(globalRoot) !== projectRoot || !isAutoUpdateEnabled() || !ownsGlobalInstall(pm, projectRoot)) {
|
|
25173
25228
|
spinner2.stop("Could not confirm an automatic update for this installation.");
|
|
25174
25229
|
return "noop";
|
|
25175
25230
|
}
|
|
@@ -25370,7 +25425,7 @@ async function update(args) {
|
|
|
25370
25425
|
process.exit(1);
|
|
25371
25426
|
}
|
|
25372
25427
|
if (automatic) {
|
|
25373
|
-
const runningRoot =
|
|
25428
|
+
const runningRoot = fs26.realpathSync(resolvePackageRoot(import.meta.dirname));
|
|
25374
25429
|
const result = requestedVersion ? await applyUpdateForTarget("global", runningRoot) : "noop";
|
|
25375
25430
|
if (result === "updated" && requestedVersion) {
|
|
25376
25431
|
writeCliRecord({
|
|
@@ -25379,7 +25434,7 @@ async function update(args) {
|
|
|
25379
25434
|
version: getGloballyInstalledVersion() ?? requestedVersion
|
|
25380
25435
|
});
|
|
25381
25436
|
await refreshConfiguration({
|
|
25382
|
-
projectRoot:
|
|
25437
|
+
projectRoot: os7.homedir(),
|
|
25383
25438
|
installMode: "global",
|
|
25384
25439
|
nonInteractive: true,
|
|
25385
25440
|
globalOnly: true
|
|
@@ -25393,7 +25448,7 @@ async function update(args) {
|
|
|
25393
25448
|
return;
|
|
25394
25449
|
}
|
|
25395
25450
|
const rootOverride = getProjectRootOverride(args);
|
|
25396
|
-
const projectRoot = rootOverride ?
|
|
25451
|
+
const projectRoot = rootOverride ? path33.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
25397
25452
|
installMode = resolveInstallMode(projectRoot);
|
|
25398
25453
|
const flags = parseTargetFlags(args);
|
|
25399
25454
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -25473,8 +25528,8 @@ async function update(args) {
|
|
|
25473
25528
|
// ../argent-installer/src/uninstall.ts
|
|
25474
25529
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
25475
25530
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
25476
|
-
import * as
|
|
25477
|
-
import * as
|
|
25531
|
+
import * as fs27 from "node:fs";
|
|
25532
|
+
import * as path34 from "node:path";
|
|
25478
25533
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
25479
25534
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
25480
25535
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -25495,10 +25550,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
25495
25550
|
};
|
|
25496
25551
|
function removeDirIfEmpty2(dirPath) {
|
|
25497
25552
|
try {
|
|
25498
|
-
if (!
|
|
25499
|
-
if (!
|
|
25500
|
-
if (
|
|
25501
|
-
|
|
25553
|
+
if (!fs27.existsSync(dirPath)) return false;
|
|
25554
|
+
if (!fs27.statSync(dirPath).isDirectory()) return false;
|
|
25555
|
+
if (fs27.readdirSync(dirPath).length > 0) return false;
|
|
25556
|
+
fs27.rmdirSync(dirPath);
|
|
25502
25557
|
return true;
|
|
25503
25558
|
} catch {
|
|
25504
25559
|
return false;
|
|
@@ -25508,9 +25563,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
25508
25563
|
const files = [];
|
|
25509
25564
|
const directories = [];
|
|
25510
25565
|
function walk(currentDir, relativeDir = "") {
|
|
25511
|
-
for (const entry of
|
|
25512
|
-
const relativePath = relativeDir ?
|
|
25513
|
-
const absolutePath =
|
|
25566
|
+
for (const entry of fs27.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25567
|
+
const relativePath = relativeDir ? path34.join(relativeDir, entry.name) : entry.name;
|
|
25568
|
+
const absolutePath = path34.join(currentDir, entry.name);
|
|
25514
25569
|
if (entry.isDirectory()) {
|
|
25515
25570
|
walk(absolutePath, relativePath);
|
|
25516
25571
|
directories.push(relativePath);
|
|
@@ -25523,15 +25578,15 @@ function collectBundledPaths(sourceDir) {
|
|
|
25523
25578
|
return { files, directories };
|
|
25524
25579
|
}
|
|
25525
25580
|
function removeBundledContent(sourceDir, targetDir) {
|
|
25526
|
-
if (!
|
|
25581
|
+
if (!fs27.existsSync(sourceDir) || !fs27.existsSync(targetDir)) {
|
|
25527
25582
|
return { removedPaths: [], removedRoot: false };
|
|
25528
25583
|
}
|
|
25529
25584
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
25530
25585
|
const removedPaths = [];
|
|
25531
25586
|
for (const relativePath of files) {
|
|
25532
|
-
const targetPath =
|
|
25587
|
+
const targetPath = path34.join(targetDir, relativePath);
|
|
25533
25588
|
try {
|
|
25534
|
-
const entry =
|
|
25589
|
+
const entry = fs27.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25535
25590
|
if (!entry || entry.isDirectory()) continue;
|
|
25536
25591
|
removePath(targetPath);
|
|
25537
25592
|
removedPaths.push(relativePath);
|
|
@@ -25539,36 +25594,36 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25539
25594
|
}
|
|
25540
25595
|
}
|
|
25541
25596
|
directories.sort(
|
|
25542
|
-
(a2, b) => b.split(
|
|
25597
|
+
(a2, b) => b.split(path34.sep).length - a2.split(path34.sep).length || b.length - a2.length
|
|
25543
25598
|
);
|
|
25544
25599
|
for (const relativePath of directories) {
|
|
25545
|
-
const targetPath =
|
|
25600
|
+
const targetPath = path34.join(targetDir, relativePath);
|
|
25546
25601
|
try {
|
|
25547
|
-
if (!
|
|
25548
|
-
if (!
|
|
25549
|
-
if (
|
|
25550
|
-
|
|
25602
|
+
if (!fs27.existsSync(targetPath)) continue;
|
|
25603
|
+
if (!fs27.statSync(targetPath).isDirectory()) continue;
|
|
25604
|
+
if (fs27.readdirSync(targetPath).length > 0) continue;
|
|
25605
|
+
fs27.rmdirSync(targetPath);
|
|
25551
25606
|
} catch {
|
|
25552
25607
|
}
|
|
25553
25608
|
}
|
|
25554
25609
|
let removedRoot = false;
|
|
25555
25610
|
try {
|
|
25556
|
-
if (
|
|
25557
|
-
if (
|
|
25558
|
-
|
|
25611
|
+
if (fs27.existsSync(targetDir) && fs27.statSync(targetDir).isDirectory()) {
|
|
25612
|
+
if (fs27.readdirSync(targetDir).length === 0) {
|
|
25613
|
+
fs27.rmdirSync(targetDir);
|
|
25559
25614
|
removedRoot = true;
|
|
25560
25615
|
}
|
|
25561
25616
|
}
|
|
25562
25617
|
} catch {
|
|
25563
25618
|
}
|
|
25564
25619
|
if (removedRoot) {
|
|
25565
|
-
removeDirIfEmpty2(
|
|
25620
|
+
removeDirIfEmpty2(path34.dirname(targetDir));
|
|
25566
25621
|
}
|
|
25567
25622
|
return { removedPaths, removedRoot };
|
|
25568
25623
|
}
|
|
25569
25624
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
25570
25625
|
try {
|
|
25571
|
-
const content =
|
|
25626
|
+
const content = fs27.readFileSync(skillFilePath, "utf8");
|
|
25572
25627
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
25573
25628
|
if (!frontmatter) return fallbackName;
|
|
25574
25629
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -25579,23 +25634,23 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
25579
25634
|
}
|
|
25580
25635
|
}
|
|
25581
25636
|
function getBundledSkillNames(skillsDir) {
|
|
25582
|
-
if (!
|
|
25637
|
+
if (!fs27.existsSync(skillsDir)) return [];
|
|
25583
25638
|
const skillNames = [];
|
|
25584
|
-
for (const entry of
|
|
25639
|
+
for (const entry of fs27.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
25585
25640
|
if (!entry.isDirectory()) continue;
|
|
25586
|
-
const skillFilePath =
|
|
25587
|
-
if (!
|
|
25641
|
+
const skillFilePath = path34.join(skillsDir, entry.name, "SKILL.md");
|
|
25642
|
+
if (!fs27.existsSync(skillFilePath)) continue;
|
|
25588
25643
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
25589
25644
|
}
|
|
25590
25645
|
return [...new Set(skillNames)].sort();
|
|
25591
25646
|
}
|
|
25592
25647
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
25593
|
-
if (!
|
|
25648
|
+
if (!fs27.existsSync(targetDir)) {
|
|
25594
25649
|
return { removedPaths: [], removedRoot: false };
|
|
25595
25650
|
}
|
|
25596
25651
|
const removedPaths = [];
|
|
25597
25652
|
for (const skillName of skillNames) {
|
|
25598
|
-
const targetPath =
|
|
25653
|
+
const targetPath = path34.join(targetDir, skillName);
|
|
25599
25654
|
try {
|
|
25600
25655
|
if (removePath(targetPath)) removedPaths.push(skillName);
|
|
25601
25656
|
} catch {
|
|
@@ -25603,17 +25658,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
25603
25658
|
}
|
|
25604
25659
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
25605
25660
|
if (removedRoot) {
|
|
25606
|
-
removeDirIfEmpty2(
|
|
25661
|
+
removeDirIfEmpty2(path34.dirname(targetDir));
|
|
25607
25662
|
}
|
|
25608
25663
|
return { removedPaths, removedRoot };
|
|
25609
25664
|
}
|
|
25610
25665
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
25611
|
-
if (!
|
|
25666
|
+
if (!fs27.existsSync(lockPath)) {
|
|
25612
25667
|
return { removedSkills: [], removedFile: false };
|
|
25613
25668
|
}
|
|
25614
25669
|
let parsed;
|
|
25615
25670
|
try {
|
|
25616
|
-
parsed = JSON.parse(
|
|
25671
|
+
parsed = JSON.parse(fs27.readFileSync(lockPath, "utf8"));
|
|
25617
25672
|
} catch {
|
|
25618
25673
|
return { removedSkills: [], removedFile: false };
|
|
25619
25674
|
}
|
|
@@ -25640,10 +25695,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25640
25695
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25641
25696
|
);
|
|
25642
25697
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25643
|
-
|
|
25698
|
+
fs27.rmSync(lockPath, { force: true });
|
|
25644
25699
|
return { removedSkills, removedFile: true };
|
|
25645
25700
|
}
|
|
25646
|
-
|
|
25701
|
+
fs27.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25647
25702
|
return { removedSkills, removedFile: false };
|
|
25648
25703
|
}
|
|
25649
25704
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25846,7 +25901,7 @@ async function uninstall(args) {
|
|
|
25846
25901
|
),
|
|
25847
25902
|
{ ask: false }
|
|
25848
25903
|
);
|
|
25849
|
-
for (const root of retired.removedRoots) removeDirIfEmpty2(
|
|
25904
|
+
for (const root of retired.removedRoots) removeDirIfEmpty2(path34.dirname(root));
|
|
25850
25905
|
const retiredLines = formatRetiredCleanup(retired);
|
|
25851
25906
|
pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
|
|
25852
25907
|
const retiredKept = retiredLines.kept.map((line) => ` ${line}`);
|
|
@@ -25965,10 +26020,10 @@ async function uninstall(args) {
|
|
|
25965
26020
|
try {
|
|
25966
26021
|
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25967
26022
|
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25968
|
-
const removed = !leftover || removable.installDir !== null && !
|
|
26023
|
+
const removed = !leftover || removable.installDir !== null && !fs27.existsSync(removable.installDir);
|
|
25969
26024
|
if (removed) hasUninstalledPackage = true;
|
|
25970
26025
|
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25971
|
-
log.info(import_picocolors13.default.dim(
|
|
26026
|
+
log.info(import_picocolors13.default.dim(`Removed ${cliRecordPath()} (provider CLI discovery record).`));
|
|
25972
26027
|
}
|
|
25973
26028
|
if (leftover) {
|
|
25974
26029
|
throw new Error(
|