@swmansion/argent 0.35.1-next.8 → 0.35.1-next.81
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 +2875 -2135
- package/dist/cli.js +22 -3
- package/dist/cli.js.map +1 -1
- package/dist/client.js +810 -455
- 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 +818 -726
- package/dist/mcp-server.mjs +1830 -1375
- package/dist/tool-args.generated.d.ts +409 -326
- package/dist/tool-server.cjs +13735 -8308
- 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 -4
- 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 +3 -2
- package/skills/argent-macos-app-interact/references/e2e.md +1 -0
- 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 constants5 = require_constants();
|
|
2435
2435
|
var SemVer = require_semver();
|
|
2436
2436
|
var truncate = (version, truncation, options) => {
|
|
2437
|
-
if (!
|
|
2437
|
+
if (!constants5.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 constants5 = 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: constants5.SEMVER_SPEC_VERSION,
|
|
3571
|
+
RELEASE_TYPES: constants5.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 fs29 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs29, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs29);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs29, 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 fs29 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs29, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs29);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs29, 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,75 +15137,116 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
15137
15137
|
init_esm();
|
|
15138
15138
|
|
|
15139
15139
|
// ../telemetry/src/debug.ts
|
|
15140
|
-
import * as
|
|
15140
|
+
import * as fs9 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
|
-
import * as
|
|
15146
|
+
import * as fs3 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/write-file.ts
|
|
15168
|
+
import * as fs2 from "node:fs";
|
|
15169
|
+
import { randomBytes } from "node:crypto";
|
|
15170
|
+
function writeFileAtomicSync(file, data, mode = 438) {
|
|
15171
|
+
const tmp = `${file}.${randomBytes(8).toString("hex")}.tmp`;
|
|
15172
|
+
try {
|
|
15173
|
+
fs2.writeFileSync(tmp, data, { flag: "wx", mode });
|
|
15174
|
+
fs2.renameSync(tmp, file);
|
|
15175
|
+
} catch (err) {
|
|
15176
|
+
fs2.rmSync(tmp, { force: true });
|
|
15177
|
+
if (err.code !== "EBUSY" || !writeOwnFileInPlace(file, data, mode)) {
|
|
15178
|
+
throw err;
|
|
15179
|
+
}
|
|
15180
|
+
}
|
|
15181
|
+
}
|
|
15182
|
+
var IN_PLACE_FLAGS = fs2.constants.O_WRONLY | fs2.constants.O_NOFOLLOW | fs2.constants.O_NONBLOCK;
|
|
15183
|
+
function writeOwnFileInPlace(file, data, mode) {
|
|
15184
|
+
const uid = process.getuid?.();
|
|
15185
|
+
if (uid === void 0) return false;
|
|
15186
|
+
let fd;
|
|
15187
|
+
try {
|
|
15188
|
+
fd = fs2.openSync(file, IN_PLACE_FLAGS);
|
|
15189
|
+
} catch {
|
|
15190
|
+
return false;
|
|
15191
|
+
}
|
|
15192
|
+
try {
|
|
15193
|
+
const stat6 = fs2.fstatSync(fd);
|
|
15194
|
+
if (!stat6.isFile() || stat6.uid !== uid && uid !== 0) return false;
|
|
15195
|
+
fs2.fchmodSync(fd, stat6.mode & mode & 511);
|
|
15196
|
+
fs2.ftruncateSync(fd);
|
|
15197
|
+
fs2.writeFileSync(fd, data);
|
|
15198
|
+
return true;
|
|
15199
|
+
} finally {
|
|
15200
|
+
fs2.closeSync(fd);
|
|
15201
|
+
}
|
|
15202
|
+
}
|
|
15203
|
+
|
|
15204
|
+
// ../configuration-core/src/flags.ts
|
|
15149
15205
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
15150
15206
|
function findProjectRoot(startDir) {
|
|
15151
|
-
let current =
|
|
15207
|
+
let current = path3.resolve(startDir);
|
|
15152
15208
|
while (true) {
|
|
15153
15209
|
for (const marker of PROJECT_MARKERS) {
|
|
15154
|
-
if (
|
|
15210
|
+
if (fs3.existsSync(path3.join(current, marker))) return current;
|
|
15155
15211
|
}
|
|
15156
|
-
const parent =
|
|
15212
|
+
const parent = path3.dirname(current);
|
|
15157
15213
|
if (parent === current) return null;
|
|
15158
15214
|
current = parent;
|
|
15159
15215
|
}
|
|
15160
15216
|
}
|
|
15161
15217
|
function resolveProjectRoot(startDir) {
|
|
15162
|
-
return findProjectRoot(startDir) ??
|
|
15218
|
+
return findProjectRoot(startDir) ?? path3.resolve(startDir);
|
|
15163
15219
|
}
|
|
15164
15220
|
|
|
15165
15221
|
// ../configuration-core/src/paths.ts
|
|
15166
|
-
import * as
|
|
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
|
-
}
|
|
15222
|
+
import * as fs4 from "node:fs";
|
|
15223
|
+
import * as path4 from "node:path";
|
|
15178
15224
|
function isHomeDir(dir, options = {}) {
|
|
15179
15225
|
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
15180
15226
|
}
|
|
15181
15227
|
function canonicalPath(p) {
|
|
15182
15228
|
try {
|
|
15183
|
-
return
|
|
15229
|
+
return fs4.realpathSync.native(p);
|
|
15184
15230
|
} catch {
|
|
15185
|
-
return
|
|
15231
|
+
return path4.resolve(p);
|
|
15186
15232
|
}
|
|
15187
15233
|
}
|
|
15188
|
-
function argentHomeDir() {
|
|
15189
|
-
return path3.join(resolveHomeDir(), ".argent");
|
|
15190
|
-
}
|
|
15191
15234
|
function configDir(scope = "global", options = {}) {
|
|
15192
|
-
if (scope === "global")
|
|
15193
|
-
return path3.join(resolveHomeDir(options), ".argent");
|
|
15194
|
-
}
|
|
15235
|
+
if (scope === "global") return argentHomeDir(options);
|
|
15195
15236
|
const cwd = options.cwd ?? process.cwd();
|
|
15196
|
-
return
|
|
15237
|
+
return path4.join(resolveProjectRoot(cwd), ".argent");
|
|
15197
15238
|
}
|
|
15198
15239
|
function configFilePath(scope = "global", options = {}) {
|
|
15199
|
-
return
|
|
15240
|
+
return path4.join(configDir(scope, options), "config.json");
|
|
15200
15241
|
}
|
|
15201
15242
|
|
|
15202
15243
|
// ../configuration-core/src/config.ts
|
|
15203
15244
|
import * as crypto from "node:crypto";
|
|
15204
|
-
import * as
|
|
15205
|
-
import * as
|
|
15245
|
+
import * as fs5 from "node:fs";
|
|
15246
|
+
import * as path5 from "node:path";
|
|
15206
15247
|
function readConfigObject(scope = "global", options = {}) {
|
|
15207
15248
|
try {
|
|
15208
|
-
const raw =
|
|
15249
|
+
const raw = fs5.readFileSync(configFilePath(scope, options), "utf8");
|
|
15209
15250
|
const json = JSON.parse(raw);
|
|
15210
15251
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
15211
15252
|
return json;
|
|
@@ -15263,9 +15304,9 @@ function acquireConfigLock(finalPath) {
|
|
|
15263
15304
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
15264
15305
|
for (; ; ) {
|
|
15265
15306
|
try {
|
|
15266
|
-
const fd =
|
|
15307
|
+
const fd = fs5.openSync(lockPath, "wx", 384);
|
|
15267
15308
|
try {
|
|
15268
|
-
|
|
15309
|
+
fs5.writeSync(fd, `${process.pid}
|
|
15269
15310
|
`);
|
|
15270
15311
|
} catch {
|
|
15271
15312
|
}
|
|
@@ -15273,8 +15314,8 @@ function acquireConfigLock(finalPath) {
|
|
|
15273
15314
|
} catch (err) {
|
|
15274
15315
|
if (err.code !== "EEXIST") return null;
|
|
15275
15316
|
try {
|
|
15276
|
-
if (Date.now() -
|
|
15277
|
-
|
|
15317
|
+
if (Date.now() - fs5.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
|
|
15318
|
+
fs5.unlinkSync(lockPath);
|
|
15278
15319
|
continue;
|
|
15279
15320
|
}
|
|
15280
15321
|
} catch {
|
|
@@ -15286,35 +15327,35 @@ function acquireConfigLock(finalPath) {
|
|
|
15286
15327
|
}
|
|
15287
15328
|
function releaseConfigLock(lock) {
|
|
15288
15329
|
try {
|
|
15289
|
-
|
|
15330
|
+
fs5.closeSync(lock.fd);
|
|
15290
15331
|
} catch {
|
|
15291
15332
|
}
|
|
15292
15333
|
try {
|
|
15293
|
-
|
|
15334
|
+
fs5.unlinkSync(lock.lockPath);
|
|
15294
15335
|
} catch {
|
|
15295
15336
|
}
|
|
15296
15337
|
}
|
|
15297
15338
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
15298
15339
|
const dir = configDir(scope, options);
|
|
15299
|
-
|
|
15340
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
15300
15341
|
const finalPath = configFilePath(scope, options);
|
|
15301
15342
|
const lock = acquireConfigLock(finalPath);
|
|
15302
15343
|
try {
|
|
15303
15344
|
const next = readConfigObject(scope, options);
|
|
15304
15345
|
mutate(next);
|
|
15305
|
-
const tmpPath =
|
|
15306
|
-
const fd =
|
|
15346
|
+
const tmpPath = path5.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
15347
|
+
const fd = fs5.openSync(tmpPath, "wx", 384);
|
|
15307
15348
|
try {
|
|
15308
|
-
|
|
15309
|
-
|
|
15349
|
+
fs5.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
15350
|
+
fs5.fsyncSync(fd);
|
|
15310
15351
|
} finally {
|
|
15311
|
-
|
|
15352
|
+
fs5.closeSync(fd);
|
|
15312
15353
|
}
|
|
15313
15354
|
try {
|
|
15314
|
-
|
|
15355
|
+
fs5.renameSync(tmpPath, finalPath);
|
|
15315
15356
|
} catch (err) {
|
|
15316
15357
|
try {
|
|
15317
|
-
|
|
15358
|
+
fs5.unlinkSync(tmpPath);
|
|
15318
15359
|
} catch {
|
|
15319
15360
|
}
|
|
15320
15361
|
throw err;
|
|
@@ -15348,8 +15389,8 @@ function setWhatsNewSeenVersion(version, options = {}) {
|
|
|
15348
15389
|
|
|
15349
15390
|
// ../configuration-core/src/secrets.ts
|
|
15350
15391
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
15351
|
-
import * as
|
|
15352
|
-
import * as
|
|
15392
|
+
import * as fs6 from "node:fs";
|
|
15393
|
+
import * as path6 from "node:path";
|
|
15353
15394
|
|
|
15354
15395
|
// ../configuration-core/src/merge.ts
|
|
15355
15396
|
function mergeRestrictive(local, global2) {
|
|
@@ -15437,7 +15478,9 @@ var CONFIG_SCHEMA = [
|
|
|
15437
15478
|
default: true,
|
|
15438
15479
|
// Opt-in/out goes through the dedicated command so the live client is
|
|
15439
15480
|
// drained/reset, not just the file rewritten.
|
|
15440
|
-
manageCommand: "argent telemetry"
|
|
15481
|
+
manageCommand: "argent telemetry",
|
|
15482
|
+
// consent.ts keeps a ~/.argent opt-out under a moved home; show the same.
|
|
15483
|
+
userHomeOptOut: true
|
|
15441
15484
|
},
|
|
15442
15485
|
{
|
|
15443
15486
|
key: "autoUpdate.enabled",
|
|
@@ -15446,6 +15489,8 @@ var CONFIG_SCHEMA = [
|
|
|
15446
15489
|
parse: asBoolean,
|
|
15447
15490
|
merge: "prioritize-local",
|
|
15448
15491
|
default: true,
|
|
15492
|
+
// The global install is shared by every Argent home.
|
|
15493
|
+
userHomeOptOut: true,
|
|
15449
15494
|
example: "false"
|
|
15450
15495
|
},
|
|
15451
15496
|
{
|
|
@@ -15536,7 +15581,8 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
|
15536
15581
|
}
|
|
15537
15582
|
|
|
15538
15583
|
// ../configuration-core/src/config-access.ts
|
|
15539
|
-
import * as
|
|
15584
|
+
import * as fs7 from "node:fs";
|
|
15585
|
+
import * as path7 from "node:path";
|
|
15540
15586
|
function readScopeValue(def, scope, options) {
|
|
15541
15587
|
if (!def.scopes.includes(scope)) return void 0;
|
|
15542
15588
|
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
@@ -15545,8 +15591,11 @@ function readScopeValue(def, scope, options) {
|
|
|
15545
15591
|
function getConfigValue(def, options = {}) {
|
|
15546
15592
|
const local = readScopeValue(def, "project", options);
|
|
15547
15593
|
const global2 = readScopeValue(def, "global", options);
|
|
15548
|
-
const merged = applyMergePolicy(def.merge, local, global2);
|
|
15549
|
-
return merged
|
|
15594
|
+
const merged = applyMergePolicy(def.merge, local, global2) ?? def.default;
|
|
15595
|
+
if (!def.userHomeOptOut) return merged;
|
|
15596
|
+
const userHome = { homeDir: resolveHomeDir(options) };
|
|
15597
|
+
if (argentHomeDir(options) === argentHomeDir(userHome)) return merged;
|
|
15598
|
+
return readScopeValue(def, "global", userHome) === false ? false : merged;
|
|
15550
15599
|
}
|
|
15551
15600
|
function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
|
|
15552
15601
|
const def = requireDefinition(key, registry);
|
|
@@ -15567,13 +15616,23 @@ var UnknownConfigKeyError = class extends Error {
|
|
|
15567
15616
|
}
|
|
15568
15617
|
key;
|
|
15569
15618
|
};
|
|
15619
|
+
var AUTO_UPDATE_ENABLED_KEY = "autoUpdate.enabled";
|
|
15620
|
+
function isAutoUpdateEnabled() {
|
|
15621
|
+
return getConfigValueByKey(AUTO_UPDATE_ENABLED_KEY) === true;
|
|
15622
|
+
}
|
|
15623
|
+
|
|
15624
|
+
// ../configuration-core/src/cloud-android.ts
|
|
15625
|
+
import * as fs8 from "node:fs";
|
|
15626
|
+
import * as os2 from "node:os";
|
|
15627
|
+
import * as path8 from "node:path";
|
|
15628
|
+
var CLOUD_ANDROID_MARKER_TTL_MS = 2 * 6e4;
|
|
15570
15629
|
|
|
15571
15630
|
// ../telemetry/src/paths.ts
|
|
15572
15631
|
function identityFilePath() {
|
|
15573
|
-
return
|
|
15632
|
+
return path9.join(argentHomeDir(), "telemetry-id");
|
|
15574
15633
|
}
|
|
15575
15634
|
function debugLogPath() {
|
|
15576
|
-
return
|
|
15635
|
+
return path9.join(argentHomeDir(), "telemetry-debug.log");
|
|
15577
15636
|
}
|
|
15578
15637
|
|
|
15579
15638
|
// ../telemetry/src/debug.ts
|
|
@@ -15603,8 +15662,8 @@ function emitDebugPayload(payload) {
|
|
|
15603
15662
|
} catch {
|
|
15604
15663
|
}
|
|
15605
15664
|
try {
|
|
15606
|
-
|
|
15607
|
-
|
|
15665
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15666
|
+
fs9.appendFileSync(debugLogPath(), line + "\n");
|
|
15608
15667
|
} catch {
|
|
15609
15668
|
}
|
|
15610
15669
|
}
|
|
@@ -15792,16 +15851,16 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
15792
15851
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15793
15852
|
|
|
15794
15853
|
// ../registry/src/flow-file-refs.ts
|
|
15795
|
-
import * as
|
|
15796
|
-
import * as
|
|
15854
|
+
import * as fs11 from "node:fs/promises";
|
|
15855
|
+
import * as path11 from "node:path";
|
|
15797
15856
|
|
|
15798
15857
|
// ../registry/src/e2e-dirs.ts
|
|
15799
|
-
import * as
|
|
15800
|
-
import * as
|
|
15801
|
-
var E2E_DIR =
|
|
15802
|
-
var LEGACY_E2E_DIRS = Object.freeze([
|
|
15858
|
+
import * as fs10 from "node:fs/promises";
|
|
15859
|
+
import * as path10 from "node:path";
|
|
15860
|
+
var E2E_DIR = path10.join(".argent", "e2e");
|
|
15861
|
+
var LEGACY_E2E_DIRS = Object.freeze([path10.join(".argent", "flows")]);
|
|
15803
15862
|
var E2E_DIRS = Object.freeze([E2E_DIR, ...LEGACY_E2E_DIRS]);
|
|
15804
|
-
var E2E_DIR_NAMES = E2E_DIRS.map((dir) =>
|
|
15863
|
+
var E2E_DIR_NAMES = E2E_DIRS.map((dir) => path10.basename(dir));
|
|
15805
15864
|
|
|
15806
15865
|
// ../registry/src/tool-ids.ts
|
|
15807
15866
|
var TOOL_ID_ALIASES = Object.freeze({
|
|
@@ -16221,6 +16280,8 @@ var FAILURE_CODES = {
|
|
|
16221
16280
|
MACOS_APP_FILE_ACCESS_FAILED: "MACOS_APP_FILE_ACCESS_FAILED",
|
|
16222
16281
|
/** The app's loaded Argent library lacks support for the requested operation. */
|
|
16223
16282
|
MACOS_APP_LIBRARY_OUTDATED: "MACOS_APP_LIBRARY_OUTDATED",
|
|
16283
|
+
/** The user clicked, scrolled or typed in the app while argent's pointer moved, and took the pointer back. */
|
|
16284
|
+
MACOS_APP_POINTER_TAKEN_OVER: "MACOS_APP_POINTER_TAKEN_OVER",
|
|
16224
16285
|
KEYBOARD_KEY_UNSUPPORTED: "KEYBOARD_KEY_UNSUPPORTED",
|
|
16225
16286
|
KEYBOARD_CHARACTER_UNSUPPORTED: "KEYBOARD_CHARACTER_UNSUPPORTED",
|
|
16226
16287
|
KEYBOARD_TEXT_AND_KEY_COMBINED: "KEYBOARD_TEXT_AND_KEY_COMBINED",
|
|
@@ -16252,6 +16313,17 @@ var FAILURE_CODES = {
|
|
|
16252
16313
|
BOOT_HARMONY_STOP_TIMEOUT: "BOOT_HARMONY_STOP_TIMEOUT",
|
|
16253
16314
|
BOOT_HARMONY_MANAGER_EXITED: "BOOT_HARMONY_MANAGER_EXITED",
|
|
16254
16315
|
BOOT_HARMONY_START_FAILED: "BOOT_HARMONY_START_FAILED",
|
|
16316
|
+
/**
|
|
16317
|
+
* Argent Cloud Android emulators
|
|
16318
|
+
* @see [leases.ts](../../tool-server/src/utils/cloud-android/leases.ts)
|
|
16319
|
+
*/
|
|
16320
|
+
CLOUD_ANDROID_ACCESS_DENIED: "CLOUD_ANDROID_ACCESS_DENIED",
|
|
16321
|
+
CLOUD_ANDROID_ACQUIRE_FAILED: "CLOUD_ANDROID_ACQUIRE_FAILED",
|
|
16322
|
+
CLOUD_ANDROID_ADB_KEY_MISSING: "CLOUD_ANDROID_ADB_KEY_MISSING",
|
|
16323
|
+
CLOUD_ANDROID_ADB_SERVER_REMOTE: "CLOUD_ANDROID_ADB_SERVER_REMOTE",
|
|
16324
|
+
CLOUD_ANDROID_CONNECT_FAILED: "CLOUD_ANDROID_CONNECT_FAILED",
|
|
16325
|
+
CLOUD_ANDROID_LEASE_IN_USE: "CLOUD_ANDROID_LEASE_IN_USE",
|
|
16326
|
+
CLOUD_ANDROID_NO_EMULATOR: "CLOUD_ANDROID_NO_EMULATOR",
|
|
16255
16327
|
/**
|
|
16256
16328
|
* External device providers
|
|
16257
16329
|
* @see [external-devices.ts](../../tool-server/src/utils/external-devices.ts)
|
|
@@ -16650,7 +16722,7 @@ function sanitize(event, raw) {
|
|
|
16650
16722
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
16651
16723
|
|
|
16652
16724
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
16653
|
-
import { existsSync as
|
|
16725
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
16654
16726
|
var CLAUDE_CLOUD_ENV_KINDS = /* @__PURE__ */ new Set(["byoc", "anthropic_cloud"]);
|
|
16655
16727
|
var CLAUDE_REMOTE_ENTRYPOINTS = /* @__PURE__ */ new Set([
|
|
16656
16728
|
"remote",
|
|
@@ -16681,9 +16753,9 @@ function isReplitAgent(env) {
|
|
|
16681
16753
|
}
|
|
16682
16754
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16683
16755
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16684
|
-
function safeExists(fileExists,
|
|
16756
|
+
function safeExists(fileExists, path35) {
|
|
16685
16757
|
try {
|
|
16686
|
-
return fileExists(
|
|
16758
|
+
return fileExists(path35);
|
|
16687
16759
|
} catch {
|
|
16688
16760
|
return false;
|
|
16689
16761
|
}
|
|
@@ -16693,7 +16765,7 @@ function detectCloudAgent(env = process.env, opts = {}) {
|
|
|
16693
16765
|
if (isCursorCloud(env)) return "cursor";
|
|
16694
16766
|
if (isCopilotAgent(env)) return "copilot";
|
|
16695
16767
|
if (isReplitAgent(env)) return "replit";
|
|
16696
|
-
const fileExists = opts.fileExists ??
|
|
16768
|
+
const fileExists = opts.fileExists ?? existsSync4;
|
|
16697
16769
|
if (safeExists(fileExists, DEVIN_MARKER_PATH)) return "devin";
|
|
16698
16770
|
if (safeExists(fileExists, JULES_MARKER_PATH)) return "jules";
|
|
16699
16771
|
return null;
|
|
@@ -17103,7 +17175,7 @@ function isCi(env = process.env) {
|
|
|
17103
17175
|
var SESSION_ID = randomUUID4();
|
|
17104
17176
|
function readCliVersion() {
|
|
17105
17177
|
if (true) {
|
|
17106
|
-
return "0.35.1-next.
|
|
17178
|
+
return "0.35.1-next.81";
|
|
17107
17179
|
}
|
|
17108
17180
|
return "0.0.0";
|
|
17109
17181
|
}
|
|
@@ -17136,8 +17208,8 @@ function getBaseProps(runtime) {
|
|
|
17136
17208
|
|
|
17137
17209
|
// ../telemetry/src/identity.ts
|
|
17138
17210
|
import * as crypto2 from "node:crypto";
|
|
17139
|
-
import * as
|
|
17140
|
-
import * as
|
|
17211
|
+
import * as fs12 from "node:fs";
|
|
17212
|
+
import * as path12 from "node:path";
|
|
17141
17213
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17142
17214
|
var cached = null;
|
|
17143
17215
|
var fingerprintResolved = null;
|
|
@@ -17244,66 +17316,66 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17244
17316
|
function isCorruptIdFile(filePath) {
|
|
17245
17317
|
let isRegularFile;
|
|
17246
17318
|
try {
|
|
17247
|
-
isRegularFile =
|
|
17319
|
+
isRegularFile = fs12.lstatSync(filePath).isFile();
|
|
17248
17320
|
} catch {
|
|
17249
17321
|
return false;
|
|
17250
17322
|
}
|
|
17251
17323
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17252
17324
|
}
|
|
17253
17325
|
function writeIdFileAtomic(finalPath, id) {
|
|
17254
|
-
|
|
17326
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17255
17327
|
let occupant;
|
|
17256
17328
|
try {
|
|
17257
|
-
occupant =
|
|
17329
|
+
occupant = fs12.lstatSync(finalPath);
|
|
17258
17330
|
} catch (err) {
|
|
17259
17331
|
if (err.code !== "ENOENT") throw err;
|
|
17260
17332
|
}
|
|
17261
17333
|
if (occupant && !occupant.isFile()) {
|
|
17262
17334
|
throw new Error("telemetry: refusing to replace a non-regular file at the identity path");
|
|
17263
17335
|
}
|
|
17264
|
-
const tmpPath =
|
|
17336
|
+
const tmpPath = path12.join(
|
|
17265
17337
|
argentHomeDir(),
|
|
17266
17338
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17267
17339
|
);
|
|
17268
|
-
const fd =
|
|
17340
|
+
const fd = fs12.openSync(tmpPath, "wx", 384);
|
|
17269
17341
|
try {
|
|
17270
17342
|
try {
|
|
17271
|
-
|
|
17272
|
-
|
|
17343
|
+
fs12.writeSync(fd, id);
|
|
17344
|
+
fs12.fsyncSync(fd);
|
|
17273
17345
|
} finally {
|
|
17274
|
-
|
|
17346
|
+
fs12.closeSync(fd);
|
|
17275
17347
|
}
|
|
17276
|
-
|
|
17348
|
+
fs12.renameSync(tmpPath, finalPath);
|
|
17277
17349
|
} finally {
|
|
17278
17350
|
try {
|
|
17279
|
-
|
|
17351
|
+
fs12.unlinkSync(tmpPath);
|
|
17280
17352
|
} catch {
|
|
17281
17353
|
}
|
|
17282
17354
|
}
|
|
17283
17355
|
}
|
|
17284
17356
|
function mintRandomId(finalPath) {
|
|
17285
|
-
|
|
17357
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17286
17358
|
let value = crypto2.randomUUID();
|
|
17287
17359
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17288
|
-
const tmpPath =
|
|
17360
|
+
const tmpPath = path12.join(
|
|
17289
17361
|
argentHomeDir(),
|
|
17290
17362
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17291
17363
|
);
|
|
17292
17364
|
let fd;
|
|
17293
17365
|
try {
|
|
17294
|
-
fd =
|
|
17366
|
+
fd = fs12.openSync(tmpPath, "wx", 384);
|
|
17295
17367
|
} catch (err) {
|
|
17296
17368
|
if (err.code === "EEXIST") continue;
|
|
17297
17369
|
throw err;
|
|
17298
17370
|
}
|
|
17299
17371
|
try {
|
|
17300
17372
|
try {
|
|
17301
|
-
|
|
17302
|
-
|
|
17373
|
+
fs12.writeSync(fd, value);
|
|
17374
|
+
fs12.fsyncSync(fd);
|
|
17303
17375
|
} finally {
|
|
17304
|
-
|
|
17376
|
+
fs12.closeSync(fd);
|
|
17305
17377
|
}
|
|
17306
|
-
|
|
17378
|
+
fs12.linkSync(tmpPath, finalPath);
|
|
17307
17379
|
cached = { path: finalPath, id: value };
|
|
17308
17380
|
return value;
|
|
17309
17381
|
} catch (err) {
|
|
@@ -17322,7 +17394,7 @@ function mintRandomId(finalPath) {
|
|
|
17322
17394
|
throw err;
|
|
17323
17395
|
} finally {
|
|
17324
17396
|
try {
|
|
17325
|
-
|
|
17397
|
+
fs12.unlinkSync(tmpPath);
|
|
17326
17398
|
} catch {
|
|
17327
17399
|
}
|
|
17328
17400
|
}
|
|
@@ -17330,12 +17402,12 @@ function mintRandomId(finalPath) {
|
|
|
17330
17402
|
throw new Error("telemetry: failed to create identity after retries");
|
|
17331
17403
|
}
|
|
17332
17404
|
function claimCorruptOccupant(finalPath) {
|
|
17333
|
-
const claimed =
|
|
17405
|
+
const claimed = path12.join(
|
|
17334
17406
|
argentHomeDir(),
|
|
17335
17407
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17336
17408
|
);
|
|
17337
17409
|
try {
|
|
17338
|
-
|
|
17410
|
+
fs12.renameSync(finalPath, claimed);
|
|
17339
17411
|
} catch {
|
|
17340
17412
|
return null;
|
|
17341
17413
|
}
|
|
@@ -17344,7 +17416,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17344
17416
|
grabbed = tryReadId(claimed);
|
|
17345
17417
|
} finally {
|
|
17346
17418
|
try {
|
|
17347
|
-
|
|
17419
|
+
fs12.unlinkSync(claimed);
|
|
17348
17420
|
} catch {
|
|
17349
17421
|
}
|
|
17350
17422
|
}
|
|
@@ -17353,7 +17425,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17353
17425
|
function deleteAnonId() {
|
|
17354
17426
|
cached = null;
|
|
17355
17427
|
try {
|
|
17356
|
-
|
|
17428
|
+
fs12.unlinkSync(identityFilePath());
|
|
17357
17429
|
} catch (err) {
|
|
17358
17430
|
if (err.code !== "ENOENT") throw err;
|
|
17359
17431
|
}
|
|
@@ -17361,9 +17433,9 @@ function deleteAnonId() {
|
|
|
17361
17433
|
function tryReadId(filePath) {
|
|
17362
17434
|
let raw;
|
|
17363
17435
|
try {
|
|
17364
|
-
const stats =
|
|
17436
|
+
const stats = fs12.lstatSync(filePath);
|
|
17365
17437
|
if (!stats.isFile()) return null;
|
|
17366
|
-
raw =
|
|
17438
|
+
raw = fs12.readFileSync(filePath, "utf8");
|
|
17367
17439
|
} catch (err) {
|
|
17368
17440
|
if (err.code === "ENOENT") return null;
|
|
17369
17441
|
return null;
|
|
@@ -17377,12 +17449,12 @@ function tryReadId(filePath) {
|
|
|
17377
17449
|
import { execFileSync, spawn } from "node:child_process";
|
|
17378
17450
|
|
|
17379
17451
|
// ../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 =
|
|
17452
|
+
import * as path13 from "node:path";
|
|
17453
|
+
import * as fs13 from "node:fs";
|
|
17454
|
+
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path13.join(__dirname, "..", "dylibs");
|
|
17455
|
+
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path13.join(__dirname, "..", "bin");
|
|
17456
|
+
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path13.join(DYLIB_DIR, "tcp");
|
|
17457
|
+
var DYLIB_TVOS_DIR = path13.join(DYLIB_DIR, "tvos");
|
|
17386
17458
|
function hostPlatformKey() {
|
|
17387
17459
|
if (process.platform === "linux" && process.arch === "arm64") {
|
|
17388
17460
|
return "linux-arm64";
|
|
@@ -17393,14 +17465,14 @@ function simulatorServerBinaryName() {
|
|
|
17393
17465
|
return process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
17394
17466
|
}
|
|
17395
17467
|
function platformBinDir() {
|
|
17396
|
-
return
|
|
17468
|
+
return path13.join(BIN_DIR, hostPlatformKey());
|
|
17397
17469
|
}
|
|
17398
17470
|
function simulatorServerBinaryPath() {
|
|
17399
17471
|
const binaryName = simulatorServerBinaryName();
|
|
17400
|
-
const p =
|
|
17401
|
-
if (!
|
|
17402
|
-
const flat =
|
|
17403
|
-
const migrationHint =
|
|
17472
|
+
const p = path13.join(platformBinDir(), binaryName);
|
|
17473
|
+
if (!fs13.existsSync(p)) {
|
|
17474
|
+
const flat = path13.join(BIN_DIR, binaryName);
|
|
17475
|
+
const migrationHint = fs13.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
17476
|
throw new Error(
|
|
17405
17477
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17406
17478
|
);
|
|
@@ -17429,12 +17501,12 @@ function resolveHostFingerprint() {
|
|
|
17429
17501
|
}
|
|
17430
17502
|
}
|
|
17431
17503
|
function resolveHostFingerprintAsync() {
|
|
17432
|
-
return new Promise((
|
|
17504
|
+
return new Promise((resolve22) => {
|
|
17433
17505
|
let binary;
|
|
17434
17506
|
try {
|
|
17435
17507
|
binary = simulatorServerBinaryPath();
|
|
17436
17508
|
} catch {
|
|
17437
|
-
|
|
17509
|
+
resolve22(null);
|
|
17438
17510
|
return;
|
|
17439
17511
|
}
|
|
17440
17512
|
let settled = false;
|
|
@@ -17447,7 +17519,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17447
17519
|
child?.kill("SIGKILL");
|
|
17448
17520
|
} catch {
|
|
17449
17521
|
}
|
|
17450
|
-
|
|
17522
|
+
resolve22(value);
|
|
17451
17523
|
};
|
|
17452
17524
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
17453
17525
|
watchdog.unref?.();
|
|
@@ -17480,15 +17552,15 @@ function resolveHostFingerprintAsync() {
|
|
|
17480
17552
|
}
|
|
17481
17553
|
|
|
17482
17554
|
// ../telemetry/src/consent.ts
|
|
17483
|
-
import * as
|
|
17484
|
-
import * as
|
|
17555
|
+
import * as fs14 from "node:fs";
|
|
17556
|
+
import * as path14 from "node:path";
|
|
17485
17557
|
var cache = /* @__PURE__ */ new Map();
|
|
17486
17558
|
var sessionOverride = null;
|
|
17487
17559
|
function readConfigOverrideAt(filePath) {
|
|
17488
17560
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17489
17561
|
let stats;
|
|
17490
17562
|
try {
|
|
17491
|
-
stats =
|
|
17563
|
+
stats = fs14.lstatSync(filePath);
|
|
17492
17564
|
} catch {
|
|
17493
17565
|
cache.set(filePath, miss);
|
|
17494
17566
|
return null;
|
|
@@ -17505,7 +17577,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17505
17577
|
}
|
|
17506
17578
|
let parsedEnabled = null;
|
|
17507
17579
|
try {
|
|
17508
|
-
const raw =
|
|
17580
|
+
const raw = fs14.readFileSync(filePath, "utf8");
|
|
17509
17581
|
const json = JSON.parse(raw);
|
|
17510
17582
|
if (json && typeof json === "object") {
|
|
17511
17583
|
const t2 = json.telemetry;
|
|
@@ -17522,8 +17594,12 @@ function readConfigOverrideAt(filePath) {
|
|
|
17522
17594
|
function readPersistedConsent(cwd) {
|
|
17523
17595
|
const globalPath = configFilePath("global");
|
|
17524
17596
|
const projectPath = configFilePath("project", { cwd });
|
|
17597
|
+
const userConfigPath = path14.join(resolveHomeDir(), ".argent", "config.json");
|
|
17598
|
+
if (userConfigPath !== globalPath && readConfigOverrideAt(userConfigPath) === false) {
|
|
17599
|
+
return { enabled: false, detail: `${userConfigPath} (user)` };
|
|
17600
|
+
}
|
|
17525
17601
|
const global2 = readConfigOverrideAt(globalPath);
|
|
17526
|
-
const projectRoot =
|
|
17602
|
+
const projectRoot = path14.dirname(path14.dirname(projectPath));
|
|
17527
17603
|
const project = isHomeDir(projectRoot) ? null : readConfigOverrideAt(projectPath);
|
|
17528
17604
|
if (project === false && global2 === false) {
|
|
17529
17605
|
return { enabled: false, detail: "config.json (project and global)" };
|
|
@@ -17719,7 +17795,7 @@ var DRAIN_GRACE_MS = 250;
|
|
|
17719
17795
|
async function raceDrain(client2, timeoutMs) {
|
|
17720
17796
|
await Promise.race([
|
|
17721
17797
|
client2.shutdown(timeoutMs),
|
|
17722
|
-
new Promise((
|
|
17798
|
+
new Promise((resolve22) => setTimeout(resolve22, timeoutMs + DRAIN_GRACE_MS).unref())
|
|
17723
17799
|
]);
|
|
17724
17800
|
}
|
|
17725
17801
|
async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
@@ -17739,8 +17815,8 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17739
17815
|
}
|
|
17740
17816
|
|
|
17741
17817
|
// ../argent-installer/src/mcp-configs.ts
|
|
17742
|
-
import * as
|
|
17743
|
-
import * as
|
|
17818
|
+
import * as fs21 from "node:fs";
|
|
17819
|
+
import * as path21 from "node:path";
|
|
17744
17820
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
17745
17821
|
import { homedir as homedir5 } from "node:os";
|
|
17746
17822
|
|
|
@@ -17755,11 +17831,11 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17755
17831
|
|
|
17756
17832
|
// ../argent-installer/src/utils.ts
|
|
17757
17833
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17758
|
-
import * as
|
|
17759
|
-
import * as
|
|
17834
|
+
import * as fs20 from "node:fs";
|
|
17835
|
+
import * as path20 from "node:path";
|
|
17760
17836
|
import * as dns from "node:dns";
|
|
17761
17837
|
import { createHash as createHash2 } from "node:crypto";
|
|
17762
|
-
import * as
|
|
17838
|
+
import * as os4 from "node:os";
|
|
17763
17839
|
import { execFileSync as execFileSync4, execSync } from "node:child_process";
|
|
17764
17840
|
|
|
17765
17841
|
// ../../node_modules/smol-toml/dist/error.js
|
|
@@ -19482,11 +19558,11 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19482
19558
|
onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });
|
|
19483
19559
|
ensurePropertyComplete(offset + length);
|
|
19484
19560
|
},
|
|
19485
|
-
onSeparator: (
|
|
19561
|
+
onSeparator: (sep10, offset, length) => {
|
|
19486
19562
|
if (currentParent.type === "property") {
|
|
19487
|
-
if (
|
|
19563
|
+
if (sep10 === ":") {
|
|
19488
19564
|
currentParent.colonOffset = offset;
|
|
19489
|
-
} else if (
|
|
19565
|
+
} else if (sep10 === ",") {
|
|
19490
19566
|
ensurePropertyComplete(offset);
|
|
19491
19567
|
}
|
|
19492
19568
|
}
|
|
@@ -19502,12 +19578,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19502
19578
|
}
|
|
19503
19579
|
return result;
|
|
19504
19580
|
}
|
|
19505
|
-
function findNodeAtLocation(root,
|
|
19581
|
+
function findNodeAtLocation(root, path35) {
|
|
19506
19582
|
if (!root) {
|
|
19507
19583
|
return void 0;
|
|
19508
19584
|
}
|
|
19509
19585
|
let node = root;
|
|
19510
|
-
for (let segment of
|
|
19586
|
+
for (let segment of path35) {
|
|
19511
19587
|
if (typeof segment === "string") {
|
|
19512
19588
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19513
19589
|
return void 0;
|
|
@@ -19861,14 +19937,14 @@ function getNodeType(value) {
|
|
|
19861
19937
|
|
|
19862
19938
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19863
19939
|
function setProperty(text2, originalPath, value, options) {
|
|
19864
|
-
const
|
|
19940
|
+
const path35 = originalPath.slice();
|
|
19865
19941
|
const errors = [];
|
|
19866
19942
|
const root = parseTree(text2, errors);
|
|
19867
19943
|
let parent = void 0;
|
|
19868
19944
|
let lastSegment = void 0;
|
|
19869
|
-
while (
|
|
19870
|
-
lastSegment =
|
|
19871
|
-
parent = findNodeAtLocation(root,
|
|
19945
|
+
while (path35.length > 0) {
|
|
19946
|
+
lastSegment = path35.pop();
|
|
19947
|
+
parent = findNodeAtLocation(root, path35);
|
|
19872
19948
|
if (parent === void 0 && value !== void 0) {
|
|
19873
19949
|
if (typeof lastSegment === "string") {
|
|
19874
19950
|
value = { [lastSegment]: value };
|
|
@@ -20054,8 +20130,8 @@ var ParseErrorCode;
|
|
|
20054
20130
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
20055
20131
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
20056
20132
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
20057
|
-
function modify(text2,
|
|
20058
|
-
return setProperty(text2,
|
|
20133
|
+
function modify(text2, path35, value, options) {
|
|
20134
|
+
return setProperty(text2, path35, value, options);
|
|
20059
20135
|
}
|
|
20060
20136
|
function applyEdits(text2, edits) {
|
|
20061
20137
|
let sortedEdits = edits.slice(0).sort((a2, b) => {
|
|
@@ -20079,39 +20155,39 @@ function applyEdits(text2, edits) {
|
|
|
20079
20155
|
}
|
|
20080
20156
|
|
|
20081
20157
|
// ../argent-installer/src/package-root.ts
|
|
20082
|
-
import * as
|
|
20083
|
-
import * as
|
|
20158
|
+
import * as fs15 from "node:fs";
|
|
20159
|
+
import * as path15 from "node:path";
|
|
20084
20160
|
function resolvePackageRoot(dirname20) {
|
|
20085
|
-
let current =
|
|
20161
|
+
let current = path15.resolve(dirname20);
|
|
20086
20162
|
while (true) {
|
|
20087
|
-
if (
|
|
20088
|
-
const parent =
|
|
20089
|
-
if (parent === current) return
|
|
20163
|
+
if (fs15.existsSync(path15.join(current, "package.json"))) return current;
|
|
20164
|
+
const parent = path15.dirname(current);
|
|
20165
|
+
if (parent === current) return path15.resolve(dirname20);
|
|
20090
20166
|
current = parent;
|
|
20091
20167
|
}
|
|
20092
20168
|
}
|
|
20093
20169
|
|
|
20094
20170
|
// ../argent-installer/src/package-manager.ts
|
|
20095
20171
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
20096
|
-
import * as
|
|
20097
|
-
import * as
|
|
20098
|
-
import * as
|
|
20172
|
+
import * as fs18 from "node:fs";
|
|
20173
|
+
import * as os3 from "node:os";
|
|
20174
|
+
import * as path18 from "node:path";
|
|
20099
20175
|
|
|
20100
20176
|
// ../argent-installer/src/topology.ts
|
|
20101
20177
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
20102
|
-
import * as
|
|
20103
|
-
import * as
|
|
20178
|
+
import * as fs17 from "node:fs";
|
|
20179
|
+
import * as path17 from "node:path";
|
|
20104
20180
|
import { createRequire } from "node:module";
|
|
20105
20181
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20106
20182
|
|
|
20107
20183
|
// ../argent-installer/src/preflight.ts
|
|
20108
|
-
import * as
|
|
20109
|
-
import * as
|
|
20184
|
+
import * as fs16 from "node:fs";
|
|
20185
|
+
import * as path16 from "node:path";
|
|
20110
20186
|
function hasProjectPackageJson(projectRoot) {
|
|
20111
|
-
return
|
|
20187
|
+
return fs16.existsSync(path16.join(projectRoot, "package.json"));
|
|
20112
20188
|
}
|
|
20113
20189
|
function isYarnPnp(projectRoot) {
|
|
20114
|
-
return
|
|
20190
|
+
return fs16.existsSync(path16.join(projectRoot, ".pnp.cjs")) || fs16.existsSync(path16.join(projectRoot, ".pnp.loader.mjs"));
|
|
20115
20191
|
}
|
|
20116
20192
|
|
|
20117
20193
|
// ../argent-installer/src/topology.ts
|
|
@@ -20137,12 +20213,12 @@ function isTempRunnerPath(binaryPath) {
|
|
|
20137
20213
|
}
|
|
20138
20214
|
function isProjectBinPath(binaryPath) {
|
|
20139
20215
|
const norm = (p) => process.platform === "win32" ? p.toLowerCase() : canonicalPath(p);
|
|
20140
|
-
const binDir = norm(
|
|
20216
|
+
const binDir = norm(path17.dirname(path17.resolve(binaryPath)));
|
|
20141
20217
|
const prefix = process.env.npm_config_local_prefix;
|
|
20142
|
-
if (prefix && norm(
|
|
20143
|
-
for (let dir =
|
|
20144
|
-
if (norm(
|
|
20145
|
-
if (
|
|
20218
|
+
if (prefix && norm(path17.join(prefix, "node_modules", ".bin")) === binDir) return true;
|
|
20219
|
+
for (let dir = path17.resolve(process.cwd()); ; dir = path17.dirname(dir)) {
|
|
20220
|
+
if (norm(path17.join(dir, "node_modules", ".bin")) === binDir) return true;
|
|
20221
|
+
if (path17.dirname(dir) === dir) return false;
|
|
20146
20222
|
}
|
|
20147
20223
|
}
|
|
20148
20224
|
function getPermanentBinaryPaths() {
|
|
@@ -20190,8 +20266,8 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20190
20266
|
}
|
|
20191
20267
|
function readShimScript(binaryPath) {
|
|
20192
20268
|
try {
|
|
20193
|
-
if (
|
|
20194
|
-
return
|
|
20269
|
+
if (fs17.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20270
|
+
return fs17.readFileSync(binaryPath, "utf8");
|
|
20195
20271
|
} catch {
|
|
20196
20272
|
return null;
|
|
20197
20273
|
}
|
|
@@ -20202,7 +20278,7 @@ function shimTargetOf(binaryPath) {
|
|
|
20202
20278
|
const trailer = /^# cmd-shim-target=(.+)$/m.exec(shim);
|
|
20203
20279
|
if (trailer) return trailer[1].trim();
|
|
20204
20280
|
const relative5 = /"\$basedir(?:_abs)?"?\/'?([^"'\s]*node_modules\/[^"'\s]*)/.exec(shim);
|
|
20205
|
-
return relative5 ?
|
|
20281
|
+
return relative5 ? path17.resolve(canonicalPath(path17.dirname(binaryPath)), relative5[1]) : null;
|
|
20206
20282
|
}
|
|
20207
20283
|
function globalPackageRootOf(binaryPath) {
|
|
20208
20284
|
const root = packageRootOf(binaryPath);
|
|
@@ -20212,9 +20288,9 @@ function globalPackageRootOf(binaryPath) {
|
|
|
20212
20288
|
}
|
|
20213
20289
|
function packageRootOf(binaryPath) {
|
|
20214
20290
|
try {
|
|
20215
|
-
const realPath =
|
|
20216
|
-
const root = resolvePackageRoot(
|
|
20217
|
-
const pkg = JSON.parse(
|
|
20291
|
+
const realPath = fs17.realpathSync(binaryPath);
|
|
20292
|
+
const root = resolvePackageRoot(path17.dirname(realPath));
|
|
20293
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(root, "package.json"), "utf8"));
|
|
20218
20294
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20219
20295
|
} catch {
|
|
20220
20296
|
return null;
|
|
@@ -20223,8 +20299,8 @@ function packageRootOf(binaryPath) {
|
|
|
20223
20299
|
function cliPathOf(packageRoot) {
|
|
20224
20300
|
const binSub = argentBinSubpath(packageRoot);
|
|
20225
20301
|
if (!binSub) return null;
|
|
20226
|
-
const cli =
|
|
20227
|
-
return
|
|
20302
|
+
const cli = path17.join(packageRoot, binSub);
|
|
20303
|
+
return fs17.existsSync(cli) ? cli : null;
|
|
20228
20304
|
}
|
|
20229
20305
|
function getGloballyInstalledLaunchPaths() {
|
|
20230
20306
|
if (process.platform === "win32") return null;
|
|
@@ -20234,8 +20310,8 @@ function getGloballyInstalledLaunchPaths() {
|
|
|
20234
20310
|
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20235
20311
|
if (!cli) return null;
|
|
20236
20312
|
try {
|
|
20237
|
-
const node =
|
|
20238
|
-
return
|
|
20313
|
+
const node = path17.join(fs17.realpathSync(path17.dirname(binaryPath)), "node");
|
|
20314
|
+
return fs17.existsSync(node) ? { node, cli } : null;
|
|
20239
20315
|
} catch {
|
|
20240
20316
|
return null;
|
|
20241
20317
|
}
|
|
@@ -20244,7 +20320,7 @@ function getGloballyInstalledVersion() {
|
|
|
20244
20320
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20245
20321
|
if (!pkgRoot) return null;
|
|
20246
20322
|
try {
|
|
20247
|
-
const pkg = JSON.parse(
|
|
20323
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(pkgRoot, "package.json"), "utf8"));
|
|
20248
20324
|
return pkg.version ?? null;
|
|
20249
20325
|
} catch {
|
|
20250
20326
|
return null;
|
|
@@ -20253,7 +20329,7 @@ function getGloballyInstalledVersion() {
|
|
|
20253
20329
|
function readManifestDeclaration(projectRoot) {
|
|
20254
20330
|
try {
|
|
20255
20331
|
const pkg = JSON.parse(
|
|
20256
|
-
|
|
20332
|
+
fs17.readFileSync(path17.join(projectRoot, "package.json"), "utf8")
|
|
20257
20333
|
);
|
|
20258
20334
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20259
20335
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20266,11 +20342,11 @@ function isDeclaredLocally(projectRoot) {
|
|
|
20266
20342
|
}
|
|
20267
20343
|
function resolveLocalArgentDir(projectRoot) {
|
|
20268
20344
|
try {
|
|
20269
|
-
const req = createRequire(
|
|
20270
|
-
return
|
|
20345
|
+
const req = createRequire(path17.join(projectRoot, "package.json"));
|
|
20346
|
+
return path17.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20271
20347
|
} catch {
|
|
20272
|
-
const plain =
|
|
20273
|
-
return
|
|
20348
|
+
const plain = path17.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20349
|
+
return fs17.existsSync(path17.join(plain, "package.json")) ? plain : null;
|
|
20274
20350
|
}
|
|
20275
20351
|
}
|
|
20276
20352
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20278,7 +20354,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20278
20354
|
if (packageDir) {
|
|
20279
20355
|
let version;
|
|
20280
20356
|
try {
|
|
20281
|
-
const pkg = JSON.parse(
|
|
20357
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(packageDir, "package.json"), "utf8"));
|
|
20282
20358
|
version = pkg.version ?? null;
|
|
20283
20359
|
} catch {
|
|
20284
20360
|
version = null;
|
|
@@ -20301,8 +20377,8 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20301
20377
|
}
|
|
20302
20378
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20303
20379
|
try {
|
|
20304
|
-
const pkgPath =
|
|
20305
|
-
const pkg = JSON.parse(
|
|
20380
|
+
const pkgPath = path17.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20381
|
+
const pkg = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
|
|
20306
20382
|
return pkg.version ?? null;
|
|
20307
20383
|
} catch {
|
|
20308
20384
|
return null;
|
|
@@ -20310,7 +20386,7 @@ function readLocalPackageVersionUncached(projectRoot) {
|
|
|
20310
20386
|
}
|
|
20311
20387
|
function argentBinSubpath(pkgDir) {
|
|
20312
20388
|
try {
|
|
20313
|
-
const pkg = JSON.parse(
|
|
20389
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(pkgDir, "package.json"), "utf8"));
|
|
20314
20390
|
if (typeof pkg.bin === "string") return pkg.bin;
|
|
20315
20391
|
if (pkg.bin && typeof pkg.bin === "object") {
|
|
20316
20392
|
return pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0] ?? null;
|
|
@@ -20327,16 +20403,16 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20327
20403
|
if (!binSub) return null;
|
|
20328
20404
|
let root = projectRoot;
|
|
20329
20405
|
try {
|
|
20330
|
-
root =
|
|
20406
|
+
root = fs17.realpathSync(projectRoot);
|
|
20331
20407
|
} catch {
|
|
20332
20408
|
}
|
|
20333
|
-
const stableRel =
|
|
20334
|
-
if (
|
|
20335
|
-
return stableRel.split(
|
|
20409
|
+
const stableRel = path17.join("node_modules", PACKAGE_NAME, binSub);
|
|
20410
|
+
if (fs17.existsSync(path17.join(root, stableRel))) {
|
|
20411
|
+
return stableRel.split(path17.sep).join("/");
|
|
20336
20412
|
}
|
|
20337
|
-
const abs =
|
|
20338
|
-
if (!
|
|
20339
|
-
return
|
|
20413
|
+
const abs = path17.join(pkgDir, binSub);
|
|
20414
|
+
if (!fs17.existsSync(abs)) return null;
|
|
20415
|
+
return path17.relative(root, abs).split(path17.sep).join("/");
|
|
20340
20416
|
}
|
|
20341
20417
|
|
|
20342
20418
|
// ../argent-installer/src/package-manager.ts
|
|
@@ -20369,10 +20445,10 @@ function detectGlobalPackageManager() {
|
|
|
20369
20445
|
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20370
20446
|
}
|
|
20371
20447
|
if (process.platform === "win32") {
|
|
20372
|
-
if (
|
|
20448
|
+
if (fs18.existsSync(path18.join(npmCopyBeside(path18.dirname(binaryPath)), "package.json"))) {
|
|
20373
20449
|
return "npm";
|
|
20374
20450
|
}
|
|
20375
|
-
if (
|
|
20451
|
+
if (fs18.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20376
20452
|
}
|
|
20377
20453
|
const shim = readShimScript(binaryPath);
|
|
20378
20454
|
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
@@ -20381,23 +20457,23 @@ function detectGlobalPackageManager() {
|
|
|
20381
20457
|
return (target ? lockfileOwnerOf(target) : null) ?? "yarn";
|
|
20382
20458
|
}
|
|
20383
20459
|
function lockfileOwnerOf(root) {
|
|
20384
|
-
for (let dir =
|
|
20460
|
+
for (let dir = path18.dirname(root); path18.dirname(dir) !== dir; dir = path18.dirname(dir)) {
|
|
20385
20461
|
const pm = pmFromLockfile(dir);
|
|
20386
20462
|
if (pm) return pm;
|
|
20387
20463
|
}
|
|
20388
20464
|
return null;
|
|
20389
20465
|
}
|
|
20390
20466
|
function npmCopyBeside(binDir) {
|
|
20391
|
-
return process.platform === "win32" ?
|
|
20467
|
+
return process.platform === "win32" ? path18.join(binDir, "node_modules", PACKAGE_NAME) : path18.join(path18.dirname(binDir), "lib", "node_modules", PACKAGE_NAME);
|
|
20392
20468
|
}
|
|
20393
20469
|
function isInNpmLayout(binaryPath, root) {
|
|
20394
20470
|
const realRoot = canonicalPath(root);
|
|
20395
20471
|
let link = binaryPath;
|
|
20396
20472
|
for (let hop = 0; hop < 40; hop++) {
|
|
20397
|
-
const binDir = canonicalPath(
|
|
20473
|
+
const binDir = canonicalPath(path18.dirname(link));
|
|
20398
20474
|
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20399
20475
|
try {
|
|
20400
|
-
link =
|
|
20476
|
+
link = path18.resolve(binDir, fs18.readlinkSync(link));
|
|
20401
20477
|
} catch {
|
|
20402
20478
|
return false;
|
|
20403
20479
|
}
|
|
@@ -20416,7 +20492,7 @@ function asKnownPm(name) {
|
|
|
20416
20492
|
}
|
|
20417
20493
|
function pmFromPackageManagerField(dir) {
|
|
20418
20494
|
try {
|
|
20419
|
-
const pkg = JSON.parse(
|
|
20495
|
+
const pkg = JSON.parse(fs18.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20420
20496
|
if (typeof pkg.packageManager === "string") {
|
|
20421
20497
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20422
20498
|
}
|
|
@@ -20427,7 +20503,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20427
20503
|
}
|
|
20428
20504
|
function pmFromDevEngines(dir) {
|
|
20429
20505
|
try {
|
|
20430
|
-
const pkg = JSON.parse(
|
|
20506
|
+
const pkg = JSON.parse(fs18.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20431
20507
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20432
20508
|
const names = /* @__PURE__ */ new Set();
|
|
20433
20509
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20440,7 +20516,7 @@ function pmFromDevEngines(dir) {
|
|
|
20440
20516
|
}
|
|
20441
20517
|
}
|
|
20442
20518
|
function pmFromLockfile(dir) {
|
|
20443
|
-
const has = (file) =>
|
|
20519
|
+
const has = (file) => fs18.existsSync(path18.join(dir, file));
|
|
20444
20520
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20445
20521
|
if (has("yarn.lock")) return "yarn";
|
|
20446
20522
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20448,15 +20524,15 @@ function pmFromLockfile(dir) {
|
|
|
20448
20524
|
return null;
|
|
20449
20525
|
}
|
|
20450
20526
|
function pmFromWorkspaceMarker(dir) {
|
|
20451
|
-
return
|
|
20527
|
+
return fs18.existsSync(path18.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20452
20528
|
}
|
|
20453
20529
|
function detectProjectPackageManager(projectRoot) {
|
|
20454
|
-
let dir =
|
|
20530
|
+
let dir = path18.resolve(projectRoot);
|
|
20455
20531
|
for (; ; ) {
|
|
20456
20532
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20457
20533
|
if (pm) return pm;
|
|
20458
|
-
if (
|
|
20459
|
-
const parent =
|
|
20534
|
+
if (fs18.existsSync(path18.join(dir, ".git"))) break;
|
|
20535
|
+
const parent = path18.dirname(dir);
|
|
20460
20536
|
if (parent === dir) break;
|
|
20461
20537
|
dir = parent;
|
|
20462
20538
|
}
|
|
@@ -20476,8 +20552,8 @@ function globalInstallCommand(pm, pkg) {
|
|
|
20476
20552
|
}
|
|
20477
20553
|
function globalCommandOptions(pm) {
|
|
20478
20554
|
if (pm === "npm") return {};
|
|
20479
|
-
const home =
|
|
20480
|
-
const cwd =
|
|
20555
|
+
const home = os3.homedir();
|
|
20556
|
+
const cwd = fs18.existsSync(home) ? { cwd: home } : {};
|
|
20481
20557
|
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20482
20558
|
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20483
20559
|
return { ...cwd, env };
|
|
@@ -20509,11 +20585,11 @@ function ownsGlobalInstall(pm, runningRoot) {
|
|
|
20509
20585
|
localBuild = !isRegistrySpec(dependency?.version);
|
|
20510
20586
|
} else {
|
|
20511
20587
|
const dir = pm === "bun" ? /^([^\r\n]+) node_modules \(/.exec(output)?.[1] : output;
|
|
20512
|
-
if (!dir || !
|
|
20513
|
-
pkg = pm === "npm" ?
|
|
20514
|
-
localBuild =
|
|
20588
|
+
if (!dir || !path18.isAbsolute(dir)) return false;
|
|
20589
|
+
pkg = pm === "npm" ? path18.join(dir, PACKAGE_NAME) : path18.join(dir, "node_modules", PACKAGE_NAME);
|
|
20590
|
+
localBuild = fs18.lstatSync(pkg).isSymbolicLink();
|
|
20515
20591
|
}
|
|
20516
|
-
return !localBuild && !!pkg &&
|
|
20592
|
+
return !localBuild && !!pkg && path18.isAbsolute(pkg) && fs18.realpathSync(pkg) === runningRoot;
|
|
20517
20593
|
} catch {
|
|
20518
20594
|
return false;
|
|
20519
20595
|
}
|
|
@@ -20568,15 +20644,15 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20568
20644
|
}
|
|
20569
20645
|
|
|
20570
20646
|
// ../argent-installer/src/install-record.ts
|
|
20571
|
-
import * as
|
|
20572
|
-
import * as
|
|
20647
|
+
import * as fs19 from "node:fs";
|
|
20648
|
+
import * as path19 from "node:path";
|
|
20573
20649
|
function getInstallRecordPath(projectRoot) {
|
|
20574
|
-
return
|
|
20650
|
+
return path19.join(projectRoot, ".argent", "install.json");
|
|
20575
20651
|
}
|
|
20576
20652
|
function readInstallRecord(projectRoot) {
|
|
20577
20653
|
try {
|
|
20578
20654
|
const parsed = JSON.parse(
|
|
20579
|
-
|
|
20655
|
+
fs19.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20580
20656
|
);
|
|
20581
20657
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20582
20658
|
return null;
|
|
@@ -20586,17 +20662,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20586
20662
|
}
|
|
20587
20663
|
function writeInstallRecord(projectRoot, record) {
|
|
20588
20664
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20589
|
-
|
|
20590
|
-
|
|
20665
|
+
fs19.mkdirSync(path19.dirname(recordPath), { recursive: true });
|
|
20666
|
+
fs19.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20591
20667
|
}
|
|
20592
20668
|
function removeInstallRecord(projectRoot) {
|
|
20593
20669
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20594
20670
|
try {
|
|
20595
|
-
if (!
|
|
20596
|
-
|
|
20597
|
-
const dir =
|
|
20671
|
+
if (!fs19.existsSync(recordPath)) return false;
|
|
20672
|
+
fs19.rmSync(recordPath, { force: true });
|
|
20673
|
+
const dir = path19.dirname(recordPath);
|
|
20598
20674
|
try {
|
|
20599
|
-
if (
|
|
20675
|
+
if (fs19.existsSync(dir) && fs19.readdirSync(dir).length === 0) fs19.rmdirSync(dir);
|
|
20600
20676
|
} catch {
|
|
20601
20677
|
}
|
|
20602
20678
|
return true;
|
|
@@ -20624,9 +20700,9 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20624
20700
|
// ../argent-installer/src/utils.ts
|
|
20625
20701
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20626
20702
|
function resolveBundledDir(dirName) {
|
|
20627
|
-
const packagedDir =
|
|
20628
|
-
if (
|
|
20629
|
-
return
|
|
20703
|
+
const packagedDir = path20.join(PACKAGE_ROOT, dirName);
|
|
20704
|
+
if (fs20.existsSync(packagedDir)) return packagedDir;
|
|
20705
|
+
return path20.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20630
20706
|
}
|
|
20631
20707
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
20632
20708
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -20638,18 +20714,18 @@ function buildArgentSkillsSource(version) {
|
|
|
20638
20714
|
}
|
|
20639
20715
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20640
20716
|
try {
|
|
20641
|
-
return
|
|
20717
|
+
return fs20.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs20.existsSync(path20.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20642
20718
|
} catch {
|
|
20643
20719
|
return [];
|
|
20644
20720
|
}
|
|
20645
20721
|
}
|
|
20646
20722
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
20647
|
-
return
|
|
20723
|
+
return path20.join(cwd, "skills-lock.json");
|
|
20648
20724
|
}
|
|
20649
20725
|
function getGlobalSkillLockPath() {
|
|
20650
20726
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
20651
|
-
if (xdgStateHome) return
|
|
20652
|
-
return
|
|
20727
|
+
if (xdgStateHome) return path20.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
20728
|
+
return path20.join(os4.homedir(), ".agents", ".skill-lock.json");
|
|
20653
20729
|
}
|
|
20654
20730
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
20655
20731
|
var LEGACY_ARGENT_SKILL_NAMES = [
|
|
@@ -20755,7 +20831,7 @@ function hashBundledContent(content) {
|
|
|
20755
20831
|
}
|
|
20756
20832
|
function listArgentSkillsInLock(lockPath) {
|
|
20757
20833
|
try {
|
|
20758
|
-
const raw =
|
|
20834
|
+
const raw = fs20.readFileSync(lockPath, "utf8");
|
|
20759
20835
|
const lock = JSON.parse(raw);
|
|
20760
20836
|
const tracked = lock.skills ?? {};
|
|
20761
20837
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20778,21 +20854,21 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
20778
20854
|
"opencode.jsonc",
|
|
20779
20855
|
"skills-lock.json"
|
|
20780
20856
|
];
|
|
20781
|
-
function resolveProjectRoot2(startDir, homeDir =
|
|
20782
|
-
const initialDir =
|
|
20857
|
+
function resolveProjectRoot2(startDir, homeDir = os4.homedir()) {
|
|
20858
|
+
const initialDir = path20.resolve(startDir);
|
|
20783
20859
|
const home = canonicalPath(homeDir);
|
|
20784
20860
|
let currentDir = initialDir;
|
|
20785
20861
|
while (true) {
|
|
20786
20862
|
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20787
20863
|
return initialDir;
|
|
20788
20864
|
}
|
|
20789
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20865
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs20.existsSync(path20.join(currentDir, marker)))) {
|
|
20790
20866
|
return currentDir;
|
|
20791
20867
|
}
|
|
20792
|
-
if (
|
|
20868
|
+
if (fs20.existsSync(path20.join(currentDir, ".git"))) {
|
|
20793
20869
|
return currentDir;
|
|
20794
20870
|
}
|
|
20795
|
-
const parentDir =
|
|
20871
|
+
const parentDir = path20.dirname(currentDir);
|
|
20796
20872
|
if (parentDir === currentDir) {
|
|
20797
20873
|
return initialDir;
|
|
20798
20874
|
}
|
|
@@ -20800,20 +20876,20 @@ function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
|
20800
20876
|
}
|
|
20801
20877
|
}
|
|
20802
20878
|
function readToml(filePath) {
|
|
20803
|
-
if (!
|
|
20879
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20804
20880
|
try {
|
|
20805
|
-
return parse(
|
|
20881
|
+
return parse(fs20.readFileSync(filePath, "utf8"));
|
|
20806
20882
|
} catch {
|
|
20807
20883
|
return {};
|
|
20808
20884
|
}
|
|
20809
20885
|
}
|
|
20810
20886
|
function writeToml(filePath, data) {
|
|
20811
|
-
|
|
20812
|
-
|
|
20887
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20888
|
+
fs20.writeFileSync(filePath, stringify(data) + "\n");
|
|
20813
20889
|
}
|
|
20814
20890
|
function readYaml(filePath) {
|
|
20815
|
-
if (!
|
|
20816
|
-
const text2 =
|
|
20891
|
+
if (!fs20.existsSync(filePath)) return new import_yaml.Document({});
|
|
20892
|
+
const text2 = fs20.readFileSync(filePath, "utf8");
|
|
20817
20893
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20818
20894
|
if (doc.errors.length > 0) {
|
|
20819
20895
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20822,20 +20898,20 @@ function readYaml(filePath) {
|
|
|
20822
20898
|
return doc;
|
|
20823
20899
|
}
|
|
20824
20900
|
function writeYaml(filePath, doc) {
|
|
20825
|
-
|
|
20826
|
-
|
|
20901
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20902
|
+
fs20.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20827
20903
|
}
|
|
20828
20904
|
function readJson(filePath) {
|
|
20829
|
-
if (!
|
|
20905
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20830
20906
|
try {
|
|
20831
|
-
return JSON.parse(
|
|
20907
|
+
return JSON.parse(fs20.readFileSync(filePath, "utf8"));
|
|
20832
20908
|
} catch {
|
|
20833
20909
|
return {};
|
|
20834
20910
|
}
|
|
20835
20911
|
}
|
|
20836
20912
|
function writeJson(filePath, data) {
|
|
20837
|
-
|
|
20838
|
-
|
|
20913
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20914
|
+
fs20.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20839
20915
|
}
|
|
20840
20916
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20841
20917
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20843,8 +20919,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20843
20919
|
return applyEdits(text2, edits);
|
|
20844
20920
|
}
|
|
20845
20921
|
function readJsoncFileRaw(filePath) {
|
|
20846
|
-
if (!
|
|
20847
|
-
let text2 =
|
|
20922
|
+
if (!fs20.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20923
|
+
let text2 = fs20.readFileSync(filePath, "utf8");
|
|
20848
20924
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20849
20925
|
if (hadBom) text2 = text2.slice(1);
|
|
20850
20926
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20863,26 +20939,26 @@ function isEmptyPlainObject(value) {
|
|
|
20863
20939
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20864
20940
|
}
|
|
20865
20941
|
function removePath(targetPath) {
|
|
20866
|
-
const entry =
|
|
20942
|
+
const entry = fs20.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20867
20943
|
if (!entry) return false;
|
|
20868
|
-
if (entry.isSymbolicLink())
|
|
20869
|
-
else
|
|
20944
|
+
if (entry.isSymbolicLink()) fs20.unlinkSync(targetPath);
|
|
20945
|
+
else fs20.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20870
20946
|
return true;
|
|
20871
20947
|
}
|
|
20872
20948
|
function rmEmptyDir(dirPath) {
|
|
20873
20949
|
try {
|
|
20874
|
-
if (!
|
|
20875
|
-
if (!
|
|
20876
|
-
if (
|
|
20877
|
-
|
|
20950
|
+
if (!fs20.existsSync(dirPath)) return false;
|
|
20951
|
+
if (!fs20.statSync(dirPath).isDirectory()) return false;
|
|
20952
|
+
if (fs20.readdirSync(dirPath).length > 0) return false;
|
|
20953
|
+
fs20.rmdirSync(dirPath);
|
|
20878
20954
|
return true;
|
|
20879
20955
|
} catch {
|
|
20880
20956
|
return false;
|
|
20881
20957
|
}
|
|
20882
20958
|
}
|
|
20883
20959
|
function readJsonc(filePath) {
|
|
20884
|
-
if (!
|
|
20885
|
-
let raw =
|
|
20960
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20961
|
+
let raw = fs20.readFileSync(filePath, "utf8");
|
|
20886
20962
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20887
20963
|
if (raw.trim() === "") return {};
|
|
20888
20964
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20903,7 +20979,7 @@ function yamlSyntaxErrorLine(raw) {
|
|
|
20903
20979
|
function findConfigSyntaxErrorLine(filePath, jsonOptions) {
|
|
20904
20980
|
let raw;
|
|
20905
20981
|
try {
|
|
20906
|
-
raw =
|
|
20982
|
+
raw = fs20.readFileSync(filePath, "utf8");
|
|
20907
20983
|
} catch {
|
|
20908
20984
|
return null;
|
|
20909
20985
|
}
|
|
@@ -20929,18 +21005,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20929
21005
|
}
|
|
20930
21006
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20931
21007
|
if (isEmptyPlainObject(parsed)) {
|
|
20932
|
-
|
|
20933
|
-
rmEmptyDir(
|
|
21008
|
+
fs20.rmSync(filePath, { force: true });
|
|
21009
|
+
rmEmptyDir(path20.dirname(filePath));
|
|
20934
21010
|
return;
|
|
20935
21011
|
}
|
|
20936
|
-
|
|
21012
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20937
21013
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20938
|
-
|
|
21014
|
+
fs20.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20939
21015
|
}
|
|
20940
21016
|
var MAX_SYMLINK_HOPS = 40;
|
|
20941
21017
|
function realpathOrSelf(p) {
|
|
20942
21018
|
try {
|
|
20943
|
-
return
|
|
21019
|
+
return fs20.realpathSync(p);
|
|
20944
21020
|
} catch {
|
|
20945
21021
|
return p;
|
|
20946
21022
|
}
|
|
@@ -20950,13 +21026,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20950
21026
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20951
21027
|
let entry;
|
|
20952
21028
|
try {
|
|
20953
|
-
entry =
|
|
21029
|
+
entry = fs20.lstatSync(current);
|
|
20954
21030
|
} catch {
|
|
20955
|
-
return current === dest || dirExists(
|
|
21031
|
+
return current === dest || dirExists(path20.dirname(current)) ? current : dest;
|
|
20956
21032
|
}
|
|
20957
21033
|
if (!entry.isSymbolicLink()) return current;
|
|
20958
21034
|
try {
|
|
20959
|
-
current =
|
|
21035
|
+
current = path20.resolve(realpathOrSelf(path20.dirname(current)), fs20.readlinkSync(current));
|
|
20960
21036
|
} catch {
|
|
20961
21037
|
return dest;
|
|
20962
21038
|
}
|
|
@@ -20964,30 +21040,30 @@ function resolveLinkedDestination(dest) {
|
|
|
20964
21040
|
return dest;
|
|
20965
21041
|
}
|
|
20966
21042
|
function copyDir(src, dest) {
|
|
20967
|
-
if (!
|
|
21043
|
+
if (!fs20.existsSync(src) || !treeHasFiles(src)) return null;
|
|
20968
21044
|
const target = resolveLinkedDestination(dest);
|
|
20969
21045
|
copyTree(src, target);
|
|
20970
21046
|
return target;
|
|
20971
21047
|
}
|
|
20972
21048
|
function treeHasFiles(dir) {
|
|
20973
|
-
return
|
|
21049
|
+
return fs20.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path20.join(dir, entry.name)));
|
|
20974
21050
|
}
|
|
20975
21051
|
function copyTree(src, dest) {
|
|
20976
|
-
const entries =
|
|
20977
|
-
|
|
21052
|
+
const entries = fs20.readdirSync(src, { withFileTypes: true });
|
|
21053
|
+
fs20.mkdirSync(dest, { recursive: true });
|
|
20978
21054
|
for (const entry of entries) {
|
|
20979
|
-
const from =
|
|
20980
|
-
const to = resolveLinkedDestination(
|
|
21055
|
+
const from = path20.join(src, entry.name);
|
|
21056
|
+
const to = resolveLinkedDestination(path20.join(dest, entry.name));
|
|
20981
21057
|
if (entry.isDirectory()) copyTree(from, to);
|
|
20982
|
-
else
|
|
21058
|
+
else fs20.copyFileSync(from, to);
|
|
20983
21059
|
}
|
|
20984
21060
|
}
|
|
20985
21061
|
function readRetiredFile(targetDir, relativePath) {
|
|
20986
|
-
const entryPath =
|
|
21062
|
+
const entryPath = path20.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
20987
21063
|
const file = resolveLinkedDestination(entryPath);
|
|
20988
21064
|
try {
|
|
20989
|
-
if (!
|
|
20990
|
-
return
|
|
21065
|
+
if (!fs20.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
21066
|
+
return fs20.readFileSync(file, "utf8");
|
|
20991
21067
|
} catch {
|
|
20992
21068
|
return null;
|
|
20993
21069
|
}
|
|
@@ -20995,7 +21071,7 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
20995
21071
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
20996
21072
|
const found = [];
|
|
20997
21073
|
for (const { path: relativePath, shipped } of retired) {
|
|
20998
|
-
if (bundleDir !== null &&
|
|
21074
|
+
if (bundleDir !== null && fs20.existsSync(path20.join(bundleDir, ...relativePath.split("/"))))
|
|
20999
21075
|
continue;
|
|
21000
21076
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21001
21077
|
if (content === null) continue;
|
|
@@ -21011,17 +21087,17 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21011
21087
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21012
21088
|
if (content === null || hashBundledContent(content) !== sha256) continue;
|
|
21013
21089
|
const segments = relativePath.split("/");
|
|
21014
|
-
const entryPath =
|
|
21090
|
+
const entryPath = path20.join(dir, ...segments);
|
|
21015
21091
|
const file = resolveLinkedDestination(entryPath);
|
|
21016
21092
|
try {
|
|
21017
|
-
|
|
21093
|
+
fs20.rmSync(file);
|
|
21018
21094
|
if (file !== entryPath) removePath(entryPath);
|
|
21019
21095
|
removedPaths.push(relativePath);
|
|
21020
21096
|
} catch {
|
|
21021
21097
|
continue;
|
|
21022
21098
|
}
|
|
21023
21099
|
for (let depth = segments.length - 1; depth > 0; depth--) {
|
|
21024
|
-
if (!rmEmptyDir(
|
|
21100
|
+
if (!rmEmptyDir(path20.join(dir, ...segments.slice(0, depth)))) break;
|
|
21025
21101
|
}
|
|
21026
21102
|
}
|
|
21027
21103
|
const removedRoot = removedPaths.length > 0 && dir === targetDir && rmEmptyDir(dir);
|
|
@@ -21029,15 +21105,15 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21029
21105
|
}
|
|
21030
21106
|
function dirExists(p) {
|
|
21031
21107
|
try {
|
|
21032
|
-
return
|
|
21108
|
+
return fs20.statSync(p).isDirectory();
|
|
21033
21109
|
} catch {
|
|
21034
21110
|
return false;
|
|
21035
21111
|
}
|
|
21036
21112
|
}
|
|
21037
21113
|
function getInstalledVersion() {
|
|
21038
21114
|
try {
|
|
21039
|
-
const pkgPath =
|
|
21040
|
-
const pkg = JSON.parse(
|
|
21115
|
+
const pkgPath = path20.join(PACKAGE_ROOT, "package.json");
|
|
21116
|
+
const pkg = JSON.parse(fs20.readFileSync(pkgPath, "utf8"));
|
|
21041
21117
|
return pkg.version ?? null;
|
|
21042
21118
|
} catch {
|
|
21043
21119
|
return null;
|
|
@@ -21082,12 +21158,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
21082
21158
|
} catch {
|
|
21083
21159
|
return false;
|
|
21084
21160
|
}
|
|
21085
|
-
return new Promise((
|
|
21086
|
-
const timer = setTimeout(() =>
|
|
21161
|
+
return new Promise((resolve22) => {
|
|
21162
|
+
const timer = setTimeout(() => resolve22(false), timeoutMs);
|
|
21087
21163
|
timer.unref();
|
|
21088
21164
|
dns.lookup(host, (err) => {
|
|
21089
21165
|
clearTimeout(timer);
|
|
21090
|
-
|
|
21166
|
+
resolve22(!err);
|
|
21091
21167
|
});
|
|
21092
21168
|
});
|
|
21093
21169
|
}
|
|
@@ -21104,7 +21180,7 @@ function escapeStringRegexp(string) {
|
|
|
21104
21180
|
}
|
|
21105
21181
|
|
|
21106
21182
|
// ../argent-installer/src/mcp-configs.ts
|
|
21107
|
-
var TOOL_SERVER_BUNDLE =
|
|
21183
|
+
var TOOL_SERVER_BUNDLE = path21.join(import.meta.dirname, "tool-server.cjs");
|
|
21108
21184
|
function getAvailableToolIds() {
|
|
21109
21185
|
const out = execFileSync5("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
21110
21186
|
const tools = JSON.parse(out);
|
|
@@ -21167,10 +21243,10 @@ function hasCustomizingEnv(entry) {
|
|
|
21167
21243
|
}
|
|
21168
21244
|
function removeDirIfEmpty(dirPath) {
|
|
21169
21245
|
try {
|
|
21170
|
-
if (!
|
|
21171
|
-
if (!
|
|
21172
|
-
if (
|
|
21173
|
-
|
|
21246
|
+
if (!fs21.existsSync(dirPath)) return;
|
|
21247
|
+
if (!fs21.statSync(dirPath).isDirectory()) return;
|
|
21248
|
+
if (fs21.readdirSync(dirPath).length > 0) return;
|
|
21249
|
+
fs21.rmdirSync(dirPath);
|
|
21174
21250
|
} catch {
|
|
21175
21251
|
}
|
|
21176
21252
|
}
|
|
@@ -21208,7 +21284,7 @@ function isArgentManagedEntry(entry) {
|
|
|
21208
21284
|
return args.length === 1 && args[0] === "mcp";
|
|
21209
21285
|
case "node": {
|
|
21210
21286
|
if (args.length !== 2 || args[1] !== "mcp" || !args[0]) return false;
|
|
21211
|
-
if (
|
|
21287
|
+
if (path21.isAbsolute(args[0])) return false;
|
|
21212
21288
|
const normalized = args[0].split("\\").join("/");
|
|
21213
21289
|
return normalized.includes(`node_modules/${PACKAGE_NAME}/`);
|
|
21214
21290
|
}
|
|
@@ -21222,12 +21298,12 @@ function isArgentManagedEntry(entry) {
|
|
|
21222
21298
|
}
|
|
21223
21299
|
function isPinnedGlobalEntry(entry) {
|
|
21224
21300
|
const [cli, subcommand] = entry.args;
|
|
21225
|
-
return
|
|
21301
|
+
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
21302
|
}
|
|
21227
21303
|
function writeTomlOrRemove(filePath, data) {
|
|
21228
21304
|
if (Object.keys(data).length === 0) {
|
|
21229
|
-
|
|
21230
|
-
removeDirIfEmpty(
|
|
21305
|
+
fs21.rmSync(filePath, { force: true });
|
|
21306
|
+
removeDirIfEmpty(path21.dirname(filePath));
|
|
21231
21307
|
return;
|
|
21232
21308
|
}
|
|
21233
21309
|
writeToml(filePath, data);
|
|
@@ -21236,12 +21312,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
21236
21312
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
21237
21313
|
}
|
|
21238
21314
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
21239
|
-
return
|
|
21315
|
+
return fs21.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
21240
21316
|
}
|
|
21241
21317
|
function parseJsoncStrict(filePath) {
|
|
21242
21318
|
let raw;
|
|
21243
21319
|
try {
|
|
21244
|
-
raw =
|
|
21320
|
+
raw = fs21.readFileSync(filePath, "utf8");
|
|
21245
21321
|
} catch {
|
|
21246
21322
|
return null;
|
|
21247
21323
|
}
|
|
@@ -21254,14 +21330,14 @@ function parseJsoncStrict(filePath) {
|
|
|
21254
21330
|
}
|
|
21255
21331
|
function parseTomlStrict(filePath) {
|
|
21256
21332
|
try {
|
|
21257
|
-
return parse(
|
|
21333
|
+
return parse(fs21.readFileSync(filePath, "utf8"));
|
|
21258
21334
|
} catch {
|
|
21259
21335
|
return null;
|
|
21260
21336
|
}
|
|
21261
21337
|
}
|
|
21262
21338
|
function parseYamlStrict(filePath) {
|
|
21263
21339
|
try {
|
|
21264
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21340
|
+
const parsed = (0, import_yaml2.parse)(fs21.readFileSync(filePath, "utf8"));
|
|
21265
21341
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
21266
21342
|
return parsed;
|
|
21267
21343
|
} catch {
|
|
@@ -21284,7 +21360,7 @@ function bundledManagedNames(kind) {
|
|
|
21284
21360
|
if (cached2) return cached2;
|
|
21285
21361
|
let names;
|
|
21286
21362
|
try {
|
|
21287
|
-
names = new Set(
|
|
21363
|
+
names = new Set(fs21.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
21288
21364
|
} catch {
|
|
21289
21365
|
names = /* @__PURE__ */ new Set();
|
|
21290
21366
|
}
|
|
@@ -21295,7 +21371,7 @@ function bundledManagedNames(kind) {
|
|
|
21295
21371
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
21296
21372
|
let entries;
|
|
21297
21373
|
try {
|
|
21298
|
-
entries =
|
|
21374
|
+
entries = fs21.readdirSync(dir);
|
|
21299
21375
|
} catch {
|
|
21300
21376
|
return false;
|
|
21301
21377
|
}
|
|
@@ -21307,13 +21383,13 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
21307
21383
|
function cursorDirLooksArgentOnly(dir) {
|
|
21308
21384
|
let entries;
|
|
21309
21385
|
try {
|
|
21310
|
-
entries =
|
|
21386
|
+
entries = fs21.readdirSync(dir);
|
|
21311
21387
|
} catch {
|
|
21312
21388
|
return false;
|
|
21313
21389
|
}
|
|
21314
21390
|
if (entries.length === 0) return false;
|
|
21315
21391
|
return entries.every((entry) => {
|
|
21316
|
-
const full =
|
|
21392
|
+
const full = path21.join(dir, entry);
|
|
21317
21393
|
if (entry === "mcp.json") {
|
|
21318
21394
|
return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21319
21395
|
}
|
|
@@ -21346,13 +21422,13 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
21346
21422
|
function claudeDirLooksArgentOnly(dir) {
|
|
21347
21423
|
let entries;
|
|
21348
21424
|
try {
|
|
21349
|
-
entries =
|
|
21425
|
+
entries = fs21.readdirSync(dir);
|
|
21350
21426
|
} catch {
|
|
21351
21427
|
return false;
|
|
21352
21428
|
}
|
|
21353
21429
|
if (entries.length === 0) return false;
|
|
21354
21430
|
return entries.every((entry) => {
|
|
21355
|
-
const full =
|
|
21431
|
+
const full = path21.join(dir, entry);
|
|
21356
21432
|
if (entry === "settings.json") return claudeSettingsLooksArgentOnly(full);
|
|
21357
21433
|
if (entry === "rules" || entry === "agents" || entry === "skills") {
|
|
21358
21434
|
return managedDirLooksArgentOnly(full, entry);
|
|
@@ -21363,25 +21439,25 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
21363
21439
|
function vscodeDirLooksArgentOnly(dir) {
|
|
21364
21440
|
let entries;
|
|
21365
21441
|
try {
|
|
21366
|
-
entries =
|
|
21442
|
+
entries = fs21.readdirSync(dir);
|
|
21367
21443
|
} catch {
|
|
21368
21444
|
return false;
|
|
21369
21445
|
}
|
|
21370
21446
|
if (entries.length === 0) return false;
|
|
21371
21447
|
return entries.every(
|
|
21372
|
-
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21448
|
+
(entry) => entry === "mcp.json" && jsonLooksArgentServerOnly(path21.join(dir, entry), "servers")
|
|
21373
21449
|
);
|
|
21374
21450
|
}
|
|
21375
21451
|
function windsurfDirLooksArgentOnly(dir) {
|
|
21376
21452
|
let entries;
|
|
21377
21453
|
try {
|
|
21378
|
-
entries =
|
|
21454
|
+
entries = fs21.readdirSync(dir);
|
|
21379
21455
|
} catch {
|
|
21380
21456
|
return false;
|
|
21381
21457
|
}
|
|
21382
21458
|
if (entries.length === 0) return false;
|
|
21383
21459
|
return entries.every(
|
|
21384
|
-
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(
|
|
21460
|
+
(entry) => entry === "mcp_config.json" && jsonLooksArgentServerOnly(path21.join(dir, entry), "mcpServers")
|
|
21385
21461
|
);
|
|
21386
21462
|
}
|
|
21387
21463
|
function zedSettingsLooksArgentOnly(filePath) {
|
|
@@ -21412,25 +21488,25 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21412
21488
|
function zedDirLooksArgentOnly(dir) {
|
|
21413
21489
|
let entries;
|
|
21414
21490
|
try {
|
|
21415
|
-
entries =
|
|
21491
|
+
entries = fs21.readdirSync(dir);
|
|
21416
21492
|
} catch {
|
|
21417
21493
|
return false;
|
|
21418
21494
|
}
|
|
21419
21495
|
if (entries.length === 0) return false;
|
|
21420
21496
|
return entries.every(
|
|
21421
|
-
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(
|
|
21497
|
+
(entry) => entry === "settings.json" && zedSettingsLooksArgentOnly(path21.join(dir, entry))
|
|
21422
21498
|
);
|
|
21423
21499
|
}
|
|
21424
21500
|
function geminiDirLooksArgentOnly(dir) {
|
|
21425
21501
|
let entries;
|
|
21426
21502
|
try {
|
|
21427
|
-
entries =
|
|
21503
|
+
entries = fs21.readdirSync(dir);
|
|
21428
21504
|
} catch {
|
|
21429
21505
|
return false;
|
|
21430
21506
|
}
|
|
21431
21507
|
if (entries.length === 0) return false;
|
|
21432
21508
|
return entries.every((entry) => {
|
|
21433
|
-
const full =
|
|
21509
|
+
const full = path21.join(dir, entry);
|
|
21434
21510
|
if (entry === "settings.json") return jsonLooksArgentServerOnly(full, "mcpServers");
|
|
21435
21511
|
if (entry === "rules" || entry === "agents") return managedDirLooksArgentOnly(full, entry);
|
|
21436
21512
|
return false;
|
|
@@ -21449,48 +21525,48 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21449
21525
|
function hermesDirLooksArgentOnly(dir) {
|
|
21450
21526
|
let entries;
|
|
21451
21527
|
try {
|
|
21452
|
-
entries =
|
|
21528
|
+
entries = fs21.readdirSync(dir);
|
|
21453
21529
|
} catch {
|
|
21454
21530
|
return false;
|
|
21455
21531
|
}
|
|
21456
21532
|
if (entries.length === 0) return false;
|
|
21457
21533
|
return entries.every(
|
|
21458
|
-
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(
|
|
21534
|
+
(entry) => entry === "config.yaml" && hermesConfigLooksArgentOnly(path21.join(dir, entry))
|
|
21459
21535
|
);
|
|
21460
21536
|
}
|
|
21461
21537
|
function kiroDirLooksArgentOnly(dir) {
|
|
21462
21538
|
let entries;
|
|
21463
21539
|
try {
|
|
21464
|
-
entries =
|
|
21540
|
+
entries = fs21.readdirSync(dir);
|
|
21465
21541
|
} catch {
|
|
21466
21542
|
return false;
|
|
21467
21543
|
}
|
|
21468
21544
|
if (entries.length === 0) return false;
|
|
21469
21545
|
return entries.every((entry) => {
|
|
21470
21546
|
if (entry !== "settings") return false;
|
|
21471
|
-
const settingsDir =
|
|
21547
|
+
const settingsDir = path21.join(dir, entry);
|
|
21472
21548
|
let settingsEntries;
|
|
21473
21549
|
try {
|
|
21474
|
-
settingsEntries =
|
|
21550
|
+
settingsEntries = fs21.readdirSync(settingsDir);
|
|
21475
21551
|
} catch {
|
|
21476
21552
|
return false;
|
|
21477
21553
|
}
|
|
21478
21554
|
if (settingsEntries.length === 0) return false;
|
|
21479
21555
|
return settingsEntries.every(
|
|
21480
|
-
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(
|
|
21556
|
+
(name) => name === "mcp.json" && jsonLooksArgentServerOnly(path21.join(settingsDir, name), "mcpServers")
|
|
21481
21557
|
);
|
|
21482
21558
|
});
|
|
21483
21559
|
}
|
|
21484
21560
|
function codexDirLooksArgentOnly(dir) {
|
|
21485
21561
|
let entries;
|
|
21486
21562
|
try {
|
|
21487
|
-
entries =
|
|
21563
|
+
entries = fs21.readdirSync(dir);
|
|
21488
21564
|
} catch {
|
|
21489
21565
|
return false;
|
|
21490
21566
|
}
|
|
21491
21567
|
if (entries.length === 0) return false;
|
|
21492
21568
|
return entries.every((entry) => {
|
|
21493
|
-
const full =
|
|
21569
|
+
const full = path21.join(dir, entry);
|
|
21494
21570
|
if (entry === "config.toml") {
|
|
21495
21571
|
const config = parseTomlStrict(full);
|
|
21496
21572
|
if (config === null) return false;
|
|
@@ -21515,7 +21591,7 @@ function codexDirLooksArgentOnly(dir) {
|
|
|
21515
21591
|
});
|
|
21516
21592
|
}
|
|
21517
21593
|
function cursorPermissionsPath() {
|
|
21518
|
-
return
|
|
21594
|
+
return path21.join(homedir5(), ".cursor", "permissions.json");
|
|
21519
21595
|
}
|
|
21520
21596
|
function cursorPermissionsList() {
|
|
21521
21597
|
const list = readJsonc(cursorPermissionsPath()).mcpAllowlist;
|
|
@@ -21524,13 +21600,13 @@ function cursorPermissionsList() {
|
|
|
21524
21600
|
var cursorAdapter = {
|
|
21525
21601
|
name: "Cursor",
|
|
21526
21602
|
detect() {
|
|
21527
|
-
return dirHasEditorEvidence(
|
|
21603
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".cursor"), cursorDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".cursor"), cursorDirLooksArgentOnly);
|
|
21528
21604
|
},
|
|
21529
21605
|
projectPath(root) {
|
|
21530
|
-
return
|
|
21606
|
+
return path21.join(root, ".cursor", "mcp.json");
|
|
21531
21607
|
},
|
|
21532
21608
|
globalPath() {
|
|
21533
|
-
return
|
|
21609
|
+
return path21.join(homedir5(), ".cursor", "mcp.json");
|
|
21534
21610
|
},
|
|
21535
21611
|
// Read and written as JSONC through readJsonc / editJsoncFile: path-targeted
|
|
21536
21612
|
// text edits that preserve user comments and foreign servers.
|
|
@@ -21542,7 +21618,7 @@ var cursorAdapter = {
|
|
|
21542
21618
|
});
|
|
21543
21619
|
},
|
|
21544
21620
|
remove(configPath) {
|
|
21545
|
-
if (!
|
|
21621
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21546
21622
|
const config = readJsonc(configPath);
|
|
21547
21623
|
const servers = config.mcpServers;
|
|
21548
21624
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21550,7 +21626,7 @@ var cursorAdapter = {
|
|
|
21550
21626
|
return true;
|
|
21551
21627
|
},
|
|
21552
21628
|
getArgentEntry(configPath) {
|
|
21553
|
-
if (!
|
|
21629
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21554
21630
|
const config = readJsonc(configPath);
|
|
21555
21631
|
const servers = config.mcpServers;
|
|
21556
21632
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21575,7 +21651,7 @@ var cursorAdapter = {
|
|
|
21575
21651
|
removeAllowlist(_root, scope) {
|
|
21576
21652
|
if (scope !== "global") return;
|
|
21577
21653
|
const permPath = cursorPermissionsPath();
|
|
21578
|
-
if (!
|
|
21654
|
+
if (!fs21.existsSync(permPath)) return;
|
|
21579
21655
|
const config = readJsonc(permPath);
|
|
21580
21656
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21581
21657
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21588,7 +21664,7 @@ function claudeProjectKeysForRoot(projects, root) {
|
|
|
21588
21664
|
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21589
21665
|
}
|
|
21590
21666
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21591
|
-
if (!
|
|
21667
|
+
if (!fs21.existsSync(settingsPath)) return null;
|
|
21592
21668
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21593
21669
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21594
21670
|
return {
|
|
@@ -21616,13 +21692,13 @@ var claudeAdapter = {
|
|
|
21616
21692
|
name: "Claude Code",
|
|
21617
21693
|
detect() {
|
|
21618
21694
|
const mcpJsonArgentOnly = (p) => jsonLooksArgentServerOnly(p, "mcpServers");
|
|
21619
|
-
return fileHasEditorEvidence(
|
|
21695
|
+
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
21696
|
},
|
|
21621
21697
|
projectPath(root) {
|
|
21622
|
-
return
|
|
21698
|
+
return path21.join(root, ".mcp.json");
|
|
21623
21699
|
},
|
|
21624
21700
|
globalPath() {
|
|
21625
|
-
return
|
|
21701
|
+
return path21.join(homedir5(), ".claude.json");
|
|
21626
21702
|
},
|
|
21627
21703
|
// JSONC is a superset of JSON, so this config shares the one comment- and
|
|
21628
21704
|
// foreign-server-preserving write path (see the Cursor adapter).
|
|
@@ -21635,7 +21711,7 @@ var claudeAdapter = {
|
|
|
21635
21711
|
});
|
|
21636
21712
|
},
|
|
21637
21713
|
remove(configPath) {
|
|
21638
|
-
if (!
|
|
21714
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21639
21715
|
const config = readJsonc(configPath);
|
|
21640
21716
|
const servers = config.mcpServers;
|
|
21641
21717
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21649,7 +21725,7 @@ var claudeAdapter = {
|
|
|
21649
21725
|
return true;
|
|
21650
21726
|
},
|
|
21651
21727
|
getArgentEntry(configPath) {
|
|
21652
|
-
if (!
|
|
21728
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21653
21729
|
const config = readJsonc(configPath);
|
|
21654
21730
|
const servers = config.mcpServers;
|
|
21655
21731
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21662,7 +21738,7 @@ var claudeAdapter = {
|
|
|
21662
21738
|
// .mcp.json rejections (see claudeDisabledListFinding).
|
|
21663
21739
|
findShadowingConfigs(root, writtenScope) {
|
|
21664
21740
|
const findings = [];
|
|
21665
|
-
const claudeJsonPath =
|
|
21741
|
+
const claudeJsonPath = path21.join(homedir5(), ".claude.json");
|
|
21666
21742
|
const projects = readJson(claudeJsonPath).projects;
|
|
21667
21743
|
if (isRecord(projects)) {
|
|
21668
21744
|
for (const key of claudeProjectKeysForRoot(projects, root)) {
|
|
@@ -21699,9 +21775,9 @@ var claudeAdapter = {
|
|
|
21699
21775
|
}
|
|
21700
21776
|
if (writtenScope === "local") {
|
|
21701
21777
|
const candidates = [
|
|
21702
|
-
[
|
|
21703
|
-
[
|
|
21704
|
-
[
|
|
21778
|
+
[path21.join(root, ".claude", "settings.json"), ".claude/settings.json", true],
|
|
21779
|
+
[path21.join(root, ".claude", "settings.local.json"), ".claude/settings.local.json", true],
|
|
21780
|
+
[path21.join(homedir5(), ".claude", "settings.json"), "~/.claude/settings.json", false]
|
|
21705
21781
|
];
|
|
21706
21782
|
for (const [settingsPath, label, projectConfined] of candidates) {
|
|
21707
21783
|
const finding = claudeDisabledListFinding(settingsPath, label, projectConfined);
|
|
@@ -21720,10 +21796,10 @@ var claudeAdapter = {
|
|
|
21720
21796
|
var vscodeAdapter = {
|
|
21721
21797
|
name: "VS Code",
|
|
21722
21798
|
detect() {
|
|
21723
|
-
return dirHasEditorEvidence(
|
|
21799
|
+
return dirHasEditorEvidence(path21.join(process.cwd(), ".vscode"), vscodeDirLooksArgentOnly) || dirExists(path21.join(homedir5(), ".vscode"));
|
|
21724
21800
|
},
|
|
21725
21801
|
projectPath(root) {
|
|
21726
|
-
return
|
|
21802
|
+
return path21.join(root, ".vscode", "mcp.json");
|
|
21727
21803
|
},
|
|
21728
21804
|
globalPath() {
|
|
21729
21805
|
return null;
|
|
@@ -21739,7 +21815,7 @@ var vscodeAdapter = {
|
|
|
21739
21815
|
});
|
|
21740
21816
|
},
|
|
21741
21817
|
remove(configPath) {
|
|
21742
|
-
if (!
|
|
21818
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21743
21819
|
const config = readJsonc(configPath);
|
|
21744
21820
|
const servers = config.servers;
|
|
21745
21821
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21747,7 +21823,7 @@ var vscodeAdapter = {
|
|
|
21747
21823
|
return true;
|
|
21748
21824
|
},
|
|
21749
21825
|
getArgentEntry(configPath) {
|
|
21750
|
-
if (!
|
|
21826
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21751
21827
|
const config = readJsonc(configPath);
|
|
21752
21828
|
const servers = config.servers;
|
|
21753
21829
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21760,7 +21836,7 @@ var vscodeAdapter = {
|
|
|
21760
21836
|
findShadowingConfigs(_root, _writtenScope) {
|
|
21761
21837
|
const findings = [];
|
|
21762
21838
|
for (const userDir of vscodeUserDirs()) {
|
|
21763
|
-
const configPath =
|
|
21839
|
+
const configPath = path21.join(userDir, "mcp.json");
|
|
21764
21840
|
const entry = this.getArgentEntry(configPath);
|
|
21765
21841
|
if (!entry) continue;
|
|
21766
21842
|
findings.push({
|
|
@@ -21777,16 +21853,16 @@ var vscodeAdapter = {
|
|
|
21777
21853
|
function vscodeUserDirs() {
|
|
21778
21854
|
const bases = [];
|
|
21779
21855
|
if (process.platform === "darwin") {
|
|
21780
|
-
bases.push(
|
|
21856
|
+
bases.push(path21.join(homedir5(), "Library", "Application Support"));
|
|
21781
21857
|
} else if (process.platform === "win32") {
|
|
21782
21858
|
if (process.env.APPDATA) bases.push(process.env.APPDATA);
|
|
21783
21859
|
} else {
|
|
21784
|
-
bases.push(
|
|
21860
|
+
bases.push(path21.join(homedir5(), ".config"));
|
|
21785
21861
|
}
|
|
21786
21862
|
const dirs = [];
|
|
21787
21863
|
for (const base of bases) {
|
|
21788
21864
|
for (const product of ["Code", "Code - Insiders"]) {
|
|
21789
|
-
const dir =
|
|
21865
|
+
const dir = path21.join(base, product, "User");
|
|
21790
21866
|
if (dirExists(dir)) dirs.push(dir);
|
|
21791
21867
|
}
|
|
21792
21868
|
}
|
|
@@ -21794,18 +21870,18 @@ function vscodeUserDirs() {
|
|
|
21794
21870
|
}
|
|
21795
21871
|
function devinUserConfigPath() {
|
|
21796
21872
|
if (process.platform === "win32") {
|
|
21797
|
-
const appData = process.env.APPDATA ||
|
|
21798
|
-
return
|
|
21873
|
+
const appData = process.env.APPDATA || path21.join(homedir5(), "AppData", "Roaming");
|
|
21874
|
+
return path21.join(appData, "devin", "config.json");
|
|
21799
21875
|
}
|
|
21800
21876
|
const xdg = process.env.XDG_CONFIG_HOME;
|
|
21801
|
-
return
|
|
21877
|
+
return path21.join(xdg || path21.join(homedir5(), ".config"), "devin", "config.json");
|
|
21802
21878
|
}
|
|
21803
21879
|
var windsurfAdapter = {
|
|
21804
21880
|
name: "Devin Desktop",
|
|
21805
21881
|
telemetryName: "windsurf",
|
|
21806
21882
|
detect() {
|
|
21807
21883
|
return dirHasEditorEvidence(
|
|
21808
|
-
|
|
21884
|
+
path21.join(homedir5(), ".codeium", "windsurf"),
|
|
21809
21885
|
windsurfDirLooksArgentOnly
|
|
21810
21886
|
);
|
|
21811
21887
|
},
|
|
@@ -21813,7 +21889,7 @@ var windsurfAdapter = {
|
|
|
21813
21889
|
return null;
|
|
21814
21890
|
},
|
|
21815
21891
|
globalPath() {
|
|
21816
|
-
return
|
|
21892
|
+
return path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21817
21893
|
},
|
|
21818
21894
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21819
21895
|
write(configPath, entry) {
|
|
@@ -21825,7 +21901,7 @@ var windsurfAdapter = {
|
|
|
21825
21901
|
});
|
|
21826
21902
|
},
|
|
21827
21903
|
remove(configPath) {
|
|
21828
|
-
if (!
|
|
21904
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21829
21905
|
const config = readJsonc(configPath);
|
|
21830
21906
|
const servers = config.mcpServers;
|
|
21831
21907
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21833,7 +21909,7 @@ var windsurfAdapter = {
|
|
|
21833
21909
|
return true;
|
|
21834
21910
|
},
|
|
21835
21911
|
getArgentEntry(configPath) {
|
|
21836
|
-
if (!
|
|
21912
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21837
21913
|
const config = readJsonc(configPath);
|
|
21838
21914
|
const servers = config.mcpServers;
|
|
21839
21915
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21845,7 +21921,7 @@ var windsurfAdapter = {
|
|
|
21845
21921
|
// servers survive. alwaysAllow serves the legacy Cascade agent; the Devin
|
|
21846
21922
|
// agent needs its own permission rule.
|
|
21847
21923
|
addAllowlist() {
|
|
21848
|
-
const configPath =
|
|
21924
|
+
const configPath = path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21849
21925
|
const config = readJsonc(configPath);
|
|
21850
21926
|
const servers = config.mcpServers;
|
|
21851
21927
|
if (!servers?.[MCP_SERVER_KEY]) return;
|
|
@@ -21855,8 +21931,8 @@ var windsurfAdapter = {
|
|
|
21855
21931
|
removeAllowlist(_root, scope) {
|
|
21856
21932
|
if (scope !== "global") return;
|
|
21857
21933
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21858
|
-
const configPath =
|
|
21859
|
-
if (!
|
|
21934
|
+
const configPath = path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21935
|
+
if (!fs21.existsSync(configPath)) return;
|
|
21860
21936
|
const config = readJsonc(configPath);
|
|
21861
21937
|
const servers = config.mcpServers;
|
|
21862
21938
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21867,13 +21943,13 @@ var windsurfAdapter = {
|
|
|
21867
21943
|
var zedAdapter = {
|
|
21868
21944
|
name: "Zed",
|
|
21869
21945
|
detect() {
|
|
21870
|
-
return dirHasEditorEvidence(
|
|
21946
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".config", "zed"), zedDirLooksArgentOnly);
|
|
21871
21947
|
},
|
|
21872
21948
|
projectPath(root) {
|
|
21873
|
-
return
|
|
21949
|
+
return path21.join(root, ".zed", "settings.json");
|
|
21874
21950
|
},
|
|
21875
21951
|
globalPath() {
|
|
21876
|
-
return
|
|
21952
|
+
return path21.join(homedir5(), ".config", "zed", "settings.json");
|
|
21877
21953
|
},
|
|
21878
21954
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
21879
21955
|
// formatting outside the touched key survive (see the Cursor adapter).
|
|
@@ -21886,7 +21962,7 @@ var zedAdapter = {
|
|
|
21886
21962
|
});
|
|
21887
21963
|
},
|
|
21888
21964
|
remove(configPath) {
|
|
21889
|
-
if (!
|
|
21965
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21890
21966
|
const config = readJsonc(configPath);
|
|
21891
21967
|
const servers = config.context_servers;
|
|
21892
21968
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21894,7 +21970,7 @@ var zedAdapter = {
|
|
|
21894
21970
|
return true;
|
|
21895
21971
|
},
|
|
21896
21972
|
getArgentEntry(configPath) {
|
|
21897
|
-
if (!
|
|
21973
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21898
21974
|
const config = readJsonc(configPath);
|
|
21899
21975
|
const servers = config.context_servers;
|
|
21900
21976
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21905,12 +21981,12 @@ var zedAdapter = {
|
|
|
21905
21981
|
// Zed has no server-level wildcard for MCP tools — each tool would need its
|
|
21906
21982
|
// own entry — so the global default is set to "allow" instead.
|
|
21907
21983
|
addAllowlist(root, scope) {
|
|
21908
|
-
const settingsPath = scope === "global" ?
|
|
21984
|
+
const settingsPath = scope === "global" ? path21.join(homedir5(), ".config", "zed", "settings.json") : path21.join(root, ".zed", "settings.json");
|
|
21909
21985
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
21910
21986
|
},
|
|
21911
21987
|
removeAllowlist(root, scope) {
|
|
21912
|
-
const settingsPath = scope === "global" ?
|
|
21913
|
-
if (!
|
|
21988
|
+
const settingsPath = scope === "global" ? path21.join(homedir5(), ".config", "zed", "settings.json") : path21.join(root, ".zed", "settings.json");
|
|
21989
|
+
if (!fs21.existsSync(settingsPath)) return;
|
|
21914
21990
|
const config = readJsonc(settingsPath);
|
|
21915
21991
|
const perms = config.agent?.tool_permissions;
|
|
21916
21992
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21920,13 +21996,13 @@ var zedAdapter = {
|
|
|
21920
21996
|
var geminiAdapter = {
|
|
21921
21997
|
name: "Gemini",
|
|
21922
21998
|
detect() {
|
|
21923
|
-
return dirHasEditorEvidence(
|
|
21999
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".gemini"), geminiDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".gemini"), geminiDirLooksArgentOnly);
|
|
21924
22000
|
},
|
|
21925
22001
|
projectPath(root) {
|
|
21926
|
-
return
|
|
22002
|
+
return path21.join(root, ".gemini", "settings.json");
|
|
21927
22003
|
},
|
|
21928
22004
|
globalPath() {
|
|
21929
|
-
return
|
|
22005
|
+
return path21.join(homedir5(), ".gemini", "settings.json");
|
|
21930
22006
|
},
|
|
21931
22007
|
// JSONC-safe writes (see the Cursor adapter).
|
|
21932
22008
|
write(configPath, entry) {
|
|
@@ -21938,7 +22014,7 @@ var geminiAdapter = {
|
|
|
21938
22014
|
});
|
|
21939
22015
|
},
|
|
21940
22016
|
remove(configPath) {
|
|
21941
|
-
if (!
|
|
22017
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21942
22018
|
const config = readJsonc(configPath);
|
|
21943
22019
|
const servers = config.mcpServers;
|
|
21944
22020
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21946,7 +22022,7 @@ var geminiAdapter = {
|
|
|
21946
22022
|
return true;
|
|
21947
22023
|
},
|
|
21948
22024
|
getArgentEntry(configPath) {
|
|
21949
|
-
if (!
|
|
22025
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21950
22026
|
const config = readJsonc(configPath);
|
|
21951
22027
|
const servers = config.mcpServers;
|
|
21952
22028
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21968,7 +22044,7 @@ var geminiAdapter = {
|
|
|
21968
22044
|
},
|
|
21969
22045
|
removeAllowlist(root, scope) {
|
|
21970
22046
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21971
|
-
if (!configPath || !
|
|
22047
|
+
if (!configPath || !fs21.existsSync(configPath)) {
|
|
21972
22048
|
return;
|
|
21973
22049
|
}
|
|
21974
22050
|
const config = readJsonc(configPath);
|
|
@@ -21982,13 +22058,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
21982
22058
|
var codexAdapter = {
|
|
21983
22059
|
name: "Codex",
|
|
21984
22060
|
detect() {
|
|
21985
|
-
return dirHasEditorEvidence(
|
|
22061
|
+
return dirHasEditorEvidence(path21.join(homedir5(), CODEX_FILENAME), codexDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), CODEX_FILENAME), codexDirLooksArgentOnly);
|
|
21986
22062
|
},
|
|
21987
22063
|
projectPath(root) {
|
|
21988
|
-
return
|
|
22064
|
+
return path21.join(root, CODEX_FILENAME, "config.toml");
|
|
21989
22065
|
},
|
|
21990
22066
|
globalPath() {
|
|
21991
|
-
return
|
|
22067
|
+
return path21.join(homedir5(), CODEX_FILENAME, "config.toml");
|
|
21992
22068
|
},
|
|
21993
22069
|
write(configPath, entry) {
|
|
21994
22070
|
const config = readToml(configPath);
|
|
@@ -22004,7 +22080,7 @@ var codexAdapter = {
|
|
|
22004
22080
|
writeToml(configPath, config);
|
|
22005
22081
|
},
|
|
22006
22082
|
remove(configPath) {
|
|
22007
|
-
if (!
|
|
22083
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22008
22084
|
const config = readToml(configPath);
|
|
22009
22085
|
const servers = config.mcp_servers;
|
|
22010
22086
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22014,7 +22090,7 @@ var codexAdapter = {
|
|
|
22014
22090
|
return true;
|
|
22015
22091
|
},
|
|
22016
22092
|
getArgentEntry(configPath) {
|
|
22017
|
-
if (!
|
|
22093
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22018
22094
|
const config = readToml(configPath);
|
|
22019
22095
|
const servers = config.mcp_servers;
|
|
22020
22096
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22046,7 +22122,7 @@ var codexAdapter = {
|
|
|
22046
22122
|
// them, and an emptied or removed table stays as it is.
|
|
22047
22123
|
refreshAllowlist(root, scope) {
|
|
22048
22124
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22049
|
-
if (!configPath || !
|
|
22125
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22050
22126
|
const config = readToml(configPath);
|
|
22051
22127
|
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
22052
22128
|
if (!toolsConfig) return;
|
|
@@ -22083,13 +22159,13 @@ var codexAdapter = {
|
|
|
22083
22159
|
var hermesAdapter = {
|
|
22084
22160
|
name: "Hermes",
|
|
22085
22161
|
detect() {
|
|
22086
|
-
return dirHasEditorEvidence(
|
|
22162
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".hermes"), hermesDirLooksArgentOnly);
|
|
22087
22163
|
},
|
|
22088
22164
|
projectPath() {
|
|
22089
22165
|
return null;
|
|
22090
22166
|
},
|
|
22091
22167
|
globalPath() {
|
|
22092
|
-
return
|
|
22168
|
+
return path21.join(homedir5(), ".hermes", "config.yaml");
|
|
22093
22169
|
},
|
|
22094
22170
|
write(configPath, entry) {
|
|
22095
22171
|
const doc = readYaml(configPath);
|
|
@@ -22108,7 +22184,7 @@ var hermesAdapter = {
|
|
|
22108
22184
|
writeYaml(configPath, doc);
|
|
22109
22185
|
},
|
|
22110
22186
|
remove(configPath) {
|
|
22111
|
-
if (!
|
|
22187
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22112
22188
|
const doc = readYaml(configPath);
|
|
22113
22189
|
const servers = doc.get("mcp_servers");
|
|
22114
22190
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -22121,7 +22197,7 @@ var hermesAdapter = {
|
|
|
22121
22197
|
return true;
|
|
22122
22198
|
},
|
|
22123
22199
|
getArgentEntry(configPath) {
|
|
22124
|
-
if (!
|
|
22200
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22125
22201
|
const doc = readYaml(configPath);
|
|
22126
22202
|
const servers = doc.get("mcp_servers");
|
|
22127
22203
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -22148,10 +22224,10 @@ function hasOpenCodeBinary() {
|
|
|
22148
22224
|
}
|
|
22149
22225
|
function pickOpencodeConfig(dir, candidates) {
|
|
22150
22226
|
for (const name of candidates) {
|
|
22151
|
-
const candidate =
|
|
22152
|
-
if (
|
|
22227
|
+
const candidate = path21.join(dir, name);
|
|
22228
|
+
if (fs21.existsSync(candidate)) return candidate;
|
|
22153
22229
|
}
|
|
22154
|
-
return
|
|
22230
|
+
return path21.join(dir, "opencode.json");
|
|
22155
22231
|
}
|
|
22156
22232
|
var openCodeAdapter = {
|
|
22157
22233
|
name: "opencode",
|
|
@@ -22162,7 +22238,7 @@ var openCodeAdapter = {
|
|
|
22162
22238
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
22163
22239
|
},
|
|
22164
22240
|
globalPath() {
|
|
22165
|
-
return pickOpencodeConfig(
|
|
22241
|
+
return pickOpencodeConfig(path21.join(homedir5(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
22166
22242
|
},
|
|
22167
22243
|
write(configPath, entry) {
|
|
22168
22244
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -22173,7 +22249,7 @@ var openCodeAdapter = {
|
|
|
22173
22249
|
});
|
|
22174
22250
|
},
|
|
22175
22251
|
remove(configPath) {
|
|
22176
|
-
if (!
|
|
22252
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22177
22253
|
const config = readJsonc(configPath);
|
|
22178
22254
|
const servers = config.mcp;
|
|
22179
22255
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22181,7 +22257,7 @@ var openCodeAdapter = {
|
|
|
22181
22257
|
return true;
|
|
22182
22258
|
},
|
|
22183
22259
|
getArgentEntry(configPath) {
|
|
22184
|
-
if (!
|
|
22260
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22185
22261
|
const config = readJsonc(configPath);
|
|
22186
22262
|
const servers = config.mcp;
|
|
22187
22263
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22196,7 +22272,7 @@ var openCodeAdapter = {
|
|
|
22196
22272
|
},
|
|
22197
22273
|
removeAllowlist(root, scope) {
|
|
22198
22274
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22199
|
-
if (!configPath || !
|
|
22275
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22200
22276
|
const config = readJsonc(configPath);
|
|
22201
22277
|
const tools = config.tools;
|
|
22202
22278
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -22207,13 +22283,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
22207
22283
|
var kiroAdapter = {
|
|
22208
22284
|
name: "Kiro",
|
|
22209
22285
|
detect() {
|
|
22210
|
-
return dirHasEditorEvidence(
|
|
22286
|
+
return dirHasEditorEvidence(path21.join(homedir5(), ".kiro"), kiroDirLooksArgentOnly) || dirHasEditorEvidence(path21.join(process.cwd(), ".kiro"), kiroDirLooksArgentOnly);
|
|
22211
22287
|
},
|
|
22212
22288
|
projectPath(root) {
|
|
22213
|
-
return
|
|
22289
|
+
return path21.join(root, ".kiro", "settings", "mcp.json");
|
|
22214
22290
|
},
|
|
22215
22291
|
globalPath() {
|
|
22216
|
-
return
|
|
22292
|
+
return path21.join(homedir5(), ".kiro", "settings", "mcp.json");
|
|
22217
22293
|
},
|
|
22218
22294
|
// Read and written as JSONC through readJsonc / editJsoncFile so comments and
|
|
22219
22295
|
// foreign servers survive (see the Cursor adapter).
|
|
@@ -22226,7 +22302,7 @@ var kiroAdapter = {
|
|
|
22226
22302
|
});
|
|
22227
22303
|
},
|
|
22228
22304
|
remove(configPath) {
|
|
22229
|
-
if (!
|
|
22305
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22230
22306
|
const config = readJsonc(configPath);
|
|
22231
22307
|
const servers = config.mcpServers;
|
|
22232
22308
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22234,7 +22310,7 @@ var kiroAdapter = {
|
|
|
22234
22310
|
return true;
|
|
22235
22311
|
},
|
|
22236
22312
|
getArgentEntry(configPath) {
|
|
22237
|
-
if (!
|
|
22313
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22238
22314
|
const config = readJsonc(configPath);
|
|
22239
22315
|
const servers = config.mcpServers;
|
|
22240
22316
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22258,7 +22334,7 @@ var kiroAdapter = {
|
|
|
22258
22334
|
},
|
|
22259
22335
|
removeAllowlist(root, scope) {
|
|
22260
22336
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22261
|
-
if (!configPath || !
|
|
22337
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22262
22338
|
const config = readJsonc(configPath);
|
|
22263
22339
|
const servers = config.mcpServers;
|
|
22264
22340
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -22310,7 +22386,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
22310
22386
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
22311
22387
|
}
|
|
22312
22388
|
function removeAllowRule(settingsPath, rule) {
|
|
22313
|
-
if (!
|
|
22389
|
+
if (!fs21.existsSync(settingsPath)) return;
|
|
22314
22390
|
const config = readJsonc(settingsPath);
|
|
22315
22391
|
const permissions = config?.permissions;
|
|
22316
22392
|
const allow = permissions?.allow;
|
|
@@ -22320,7 +22396,7 @@ function removeAllowRule(settingsPath, rule) {
|
|
|
22320
22396
|
editJsoncFile(settingsPath, ["permissions", "allow"], next.length > 0 ? next : void 0);
|
|
22321
22397
|
}
|
|
22322
22398
|
function claudeSettingsPath(root, scope) {
|
|
22323
|
-
return scope === "global" ?
|
|
22399
|
+
return scope === "global" ? path21.join(homedir5(), ".claude", "settings.json") : path21.join(root, ".claude", "settings.json");
|
|
22324
22400
|
}
|
|
22325
22401
|
function addClaudePermission(root, scope) {
|
|
22326
22402
|
addAllowRule(claudeSettingsPath(root, scope), PERMISSION_RULE);
|
|
@@ -22333,13 +22409,13 @@ function formatCopyDestination(target, writtenPath, root) {
|
|
|
22333
22409
|
return `${target.label} -> ${formatManagedPathLabel(writtenPath, realpathOrSelf(root))}`;
|
|
22334
22410
|
}
|
|
22335
22411
|
function formatManagedPathLabel(targetPath, root) {
|
|
22336
|
-
for (const home of [
|
|
22337
|
-
if (targetPath === home || targetPath.startsWith(`${home}${
|
|
22412
|
+
for (const home of [path21.resolve(homedir5()), canonicalPath(homedir5())]) {
|
|
22413
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path21.sep}`)) {
|
|
22338
22414
|
return `~${targetPath.slice(home.length)}`;
|
|
22339
22415
|
}
|
|
22340
22416
|
}
|
|
22341
|
-
const relative5 =
|
|
22342
|
-
if (relative5 && !relative5.startsWith("..") && !
|
|
22417
|
+
const relative5 = path21.relative(root, targetPath);
|
|
22418
|
+
if (relative5 && !relative5.startsWith("..") && !path21.isAbsolute(relative5)) {
|
|
22343
22419
|
return relative5;
|
|
22344
22420
|
}
|
|
22345
22421
|
return targetPath;
|
|
@@ -22353,7 +22429,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
22353
22429
|
}
|
|
22354
22430
|
function getAdapterBasePath(adapter, root, scope) {
|
|
22355
22431
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
22356
|
-
return configPath ?
|
|
22432
|
+
return configPath ? path21.dirname(configPath) : null;
|
|
22357
22433
|
}
|
|
22358
22434
|
function getManagedContentTargets(adapters, root, scope) {
|
|
22359
22435
|
const targets = {
|
|
@@ -22367,13 +22443,13 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22367
22443
|
addManagedTarget(
|
|
22368
22444
|
targets.skillTargets,
|
|
22369
22445
|
"skills",
|
|
22370
|
-
|
|
22446
|
+
path21.join(workspaceBase, ".agents", "skills"),
|
|
22371
22447
|
root
|
|
22372
22448
|
);
|
|
22373
22449
|
addManagedTarget(
|
|
22374
22450
|
targets.skillsLockTargets,
|
|
22375
22451
|
"skills",
|
|
22376
|
-
|
|
22452
|
+
path21.join(workspaceBase, "skills-lock.json"),
|
|
22377
22453
|
root
|
|
22378
22454
|
);
|
|
22379
22455
|
for (const adapter of adapters) {
|
|
@@ -22381,21 +22457,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22381
22457
|
case "Cursor": {
|
|
22382
22458
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
22383
22459
|
if (!base) break;
|
|
22384
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22385
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22460
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(base, "skills"), root);
|
|
22461
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(base, "rules"), root);
|
|
22386
22462
|
break;
|
|
22387
22463
|
}
|
|
22388
22464
|
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,
|
|
22465
|
+
const claudeBase = scope === "global" ? path21.join(homedir5(), ".claude") : path21.join(root, ".claude");
|
|
22466
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(claudeBase, "skills"), root);
|
|
22467
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(claudeBase, "rules"), root);
|
|
22468
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(claudeBase, "agents"), root);
|
|
22393
22469
|
break;
|
|
22394
22470
|
}
|
|
22395
22471
|
case "Gemini": {
|
|
22396
|
-
const geminiBase = scope === "global" ?
|
|
22397
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
22398
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22472
|
+
const geminiBase = scope === "global" ? path21.join(homedir5(), ".gemini") : path21.join(root, ".gemini");
|
|
22473
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path21.join(geminiBase, "rules"), root);
|
|
22474
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(geminiBase, "agents"), root);
|
|
22399
22475
|
break;
|
|
22400
22476
|
}
|
|
22401
22477
|
case "Codex": {
|
|
@@ -22405,19 +22481,19 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
22405
22481
|
break;
|
|
22406
22482
|
}
|
|
22407
22483
|
case "opencode": {
|
|
22408
|
-
const base = scope === "global" ?
|
|
22409
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22410
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
22484
|
+
const base = scope === "global" ? path21.join(homedir5(), ".config", "opencode") : path21.join(root, ".opencode");
|
|
22485
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(base, "skills"), root);
|
|
22486
|
+
addManagedTarget(targets.agentTargets, adapter.name, path21.join(base, "agents"), root);
|
|
22411
22487
|
break;
|
|
22412
22488
|
}
|
|
22413
22489
|
case "Kiro": {
|
|
22414
|
-
const kiroBase = scope === "global" ?
|
|
22415
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22490
|
+
const kiroBase = scope === "global" ? path21.join(homedir5(), ".kiro") : path21.join(root, ".kiro");
|
|
22491
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(kiroBase, "skills"), root);
|
|
22416
22492
|
break;
|
|
22417
22493
|
}
|
|
22418
22494
|
case "Devin Desktop": {
|
|
22419
|
-
const devinBase = scope === "global" ?
|
|
22420
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
22495
|
+
const devinBase = scope === "global" ? path21.join(process.env.XDG_CONFIG_HOME || path21.join(homedir5(), ".config"), "devin") : path21.join(root, ".devin");
|
|
22496
|
+
addManagedTarget(targets.skillTargets, adapter.name, path21.join(devinBase, "skills"), root);
|
|
22421
22497
|
break;
|
|
22422
22498
|
}
|
|
22423
22499
|
}
|
|
@@ -22431,12 +22507,12 @@ function stripFrontmatter(content) {
|
|
|
22431
22507
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22432
22508
|
}
|
|
22433
22509
|
function readAndConcatRules(rulesDir) {
|
|
22434
|
-
if (!
|
|
22435
|
-
const files =
|
|
22510
|
+
if (!fs21.existsSync(rulesDir)) return null;
|
|
22511
|
+
const files = fs21.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22436
22512
|
if (files.length === 0) return null;
|
|
22437
22513
|
const parts = [];
|
|
22438
22514
|
for (const file of files) {
|
|
22439
|
-
const raw =
|
|
22515
|
+
const raw = fs21.readFileSync(path21.join(rulesDir, file), "utf8");
|
|
22440
22516
|
const stripped = stripFrontmatter(raw);
|
|
22441
22517
|
if (stripped) parts.push(stripped);
|
|
22442
22518
|
}
|
|
@@ -22471,7 +22547,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22471
22547
|
return configPath;
|
|
22472
22548
|
}
|
|
22473
22549
|
function removeCodexRules(configPath) {
|
|
22474
|
-
if (!
|
|
22550
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22475
22551
|
const config = readToml(configPath);
|
|
22476
22552
|
const existing = config.developer_instructions;
|
|
22477
22553
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22563,10 +22639,10 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
22563
22639
|
}
|
|
22564
22640
|
|
|
22565
22641
|
// ../argent-installer/src/retired-files.ts
|
|
22566
|
-
import * as
|
|
22642
|
+
import * as path22 from "node:path";
|
|
22567
22643
|
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
22568
22644
|
function displayPath(entry, file) {
|
|
22569
|
-
return
|
|
22645
|
+
return path22.join(entry.location, ...file.relativePath.split("/"));
|
|
22570
22646
|
}
|
|
22571
22647
|
async function cleanupRetiredFiles(found, options) {
|
|
22572
22648
|
const result = { removed: [], declined: [], failed: [], removedRoots: [] };
|
|
@@ -22617,14 +22693,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22617
22693
|
|
|
22618
22694
|
// ../argent-installer/src/cli-record.ts
|
|
22619
22695
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22620
|
-
import * as
|
|
22621
|
-
import * as
|
|
22696
|
+
import * as fs22 from "node:fs";
|
|
22697
|
+
import * as path23 from "node:path";
|
|
22622
22698
|
function cliRecordPath() {
|
|
22623
|
-
return
|
|
22699
|
+
return path23.join(argentHomeDir(), "cli.json");
|
|
22624
22700
|
}
|
|
22625
22701
|
function readCliRecord() {
|
|
22626
22702
|
try {
|
|
22627
|
-
const parsed = JSON.parse(
|
|
22703
|
+
const parsed = JSON.parse(fs22.readFileSync(cliRecordPath(), "utf8"));
|
|
22628
22704
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22629
22705
|
return null;
|
|
22630
22706
|
} catch {
|
|
@@ -22634,7 +22710,7 @@ function readCliRecord() {
|
|
|
22634
22710
|
function resolveCliEntry(mode, projectRoot) {
|
|
22635
22711
|
if (mode === "local") {
|
|
22636
22712
|
const relative5 = getLocalArgentBinRelPath(projectRoot);
|
|
22637
|
-
return relative5 ?
|
|
22713
|
+
return relative5 ? path23.resolve(projectRoot, relative5) : null;
|
|
22638
22714
|
}
|
|
22639
22715
|
const packageRoot = getGloballyInstalledPackageRoot();
|
|
22640
22716
|
return packageRoot ? cliPathOf(packageRoot) : null;
|
|
@@ -22653,10 +22729,8 @@ function writeCliRecord(input) {
|
|
|
22653
22729
|
function persistCliRecord(record) {
|
|
22654
22730
|
const file = cliRecordPath();
|
|
22655
22731
|
try {
|
|
22656
|
-
|
|
22657
|
-
|
|
22658
|
-
fs19.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22659
|
-
fs19.renameSync(temporary, file);
|
|
22732
|
+
fs22.mkdirSync(path23.dirname(file), { recursive: true });
|
|
22733
|
+
writeFileAtomicSync(file, JSON.stringify(record, null, 2) + "\n");
|
|
22660
22734
|
return file;
|
|
22661
22735
|
} catch {
|
|
22662
22736
|
return null;
|
|
@@ -22664,10 +22738,10 @@ function persistCliRecord(record) {
|
|
|
22664
22738
|
}
|
|
22665
22739
|
function healCliRecord(input) {
|
|
22666
22740
|
try {
|
|
22667
|
-
if (!
|
|
22741
|
+
if (!fs22.existsSync(input.cli)) return null;
|
|
22668
22742
|
const existing = readCliRecord();
|
|
22669
22743
|
if (existing) {
|
|
22670
|
-
const alive =
|
|
22744
|
+
const alive = fs22.existsSync(existing.node) && fs22.existsSync(existing.cli);
|
|
22671
22745
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22672
22746
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22673
22747
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22688,11 +22762,11 @@ function removeCliRecordFor(installDir) {
|
|
|
22688
22762
|
if (!installDir) return false;
|
|
22689
22763
|
const record = readCliRecord();
|
|
22690
22764
|
if (!record) return false;
|
|
22691
|
-
const root =
|
|
22692
|
-
const relative5 =
|
|
22693
|
-
if (relative5.startsWith("..") ||
|
|
22765
|
+
const root = path23.resolve(installDir);
|
|
22766
|
+
const relative5 = path23.relative(root, path23.resolve(record.cli));
|
|
22767
|
+
if (relative5.startsWith("..") || path23.isAbsolute(relative5)) return false;
|
|
22694
22768
|
try {
|
|
22695
|
-
|
|
22769
|
+
fs22.rmSync(cliRecordPath(), { force: true });
|
|
22696
22770
|
return true;
|
|
22697
22771
|
} catch {
|
|
22698
22772
|
return false;
|
|
@@ -22728,9 +22802,11 @@ async function resolveTelemetryConsent(opts) {
|
|
|
22728
22802
|
printFirstRunNotice();
|
|
22729
22803
|
return { kind: "skipped" };
|
|
22730
22804
|
}
|
|
22731
|
-
const
|
|
22805
|
+
const state2 = getConsentState();
|
|
22806
|
+
const source = state2.source.source;
|
|
22732
22807
|
const envOwnsDecision = source === "env_do_not_track" || source === "env_argent_telemetry";
|
|
22733
|
-
|
|
22808
|
+
const configOptedOut = source === "config_file" && !state2.enabled;
|
|
22809
|
+
if (envOwnsDecision || configOptedOut || hasShownFirstRunNotice()) {
|
|
22734
22810
|
return { kind: "skipped" };
|
|
22735
22811
|
}
|
|
22736
22812
|
log.info(
|
|
@@ -22916,8 +22992,8 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22916
22992
|
|
|
22917
22993
|
// ../argent-installer/src/install-runner.ts
|
|
22918
22994
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22919
|
-
import * as
|
|
22920
|
-
import * as
|
|
22995
|
+
import * as fs25 from "node:fs";
|
|
22996
|
+
import * as path26 from "node:path";
|
|
22921
22997
|
|
|
22922
22998
|
// ../argent-installer/src/shell.ts
|
|
22923
22999
|
import { execFileSync as execFileSync6, spawn as spawn2 } from "node:child_process";
|
|
@@ -22949,7 +23025,7 @@ var ShellCommandError = class extends Error {
|
|
|
22949
23025
|
signal;
|
|
22950
23026
|
};
|
|
22951
23027
|
function runShellCommand(cmd, opts = {}) {
|
|
22952
|
-
return new Promise((
|
|
23028
|
+
return new Promise((resolve22, reject) => {
|
|
22953
23029
|
const child = spawn2(cmd.bin, cmd.args, {
|
|
22954
23030
|
stdio: ["ignore", "pipe", "pipe"],
|
|
22955
23031
|
shell: process.platform === "win32",
|
|
@@ -22965,7 +23041,7 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22965
23041
|
stderr += chunk.toString();
|
|
22966
23042
|
});
|
|
22967
23043
|
child.on("close", (code, signal) => {
|
|
22968
|
-
if (code === 0)
|
|
23044
|
+
if (code === 0) resolve22();
|
|
22969
23045
|
else
|
|
22970
23046
|
reject(
|
|
22971
23047
|
new ShellCommandError(
|
|
@@ -22981,33 +23057,33 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
22981
23057
|
|
|
22982
23058
|
// ../argent-installer/src/skills.ts
|
|
22983
23059
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
22984
|
-
import * as
|
|
22985
|
-
import * as
|
|
23060
|
+
import * as fs24 from "node:fs";
|
|
23061
|
+
import * as path25 from "node:path";
|
|
22986
23062
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
22987
23063
|
|
|
22988
23064
|
// ../argent-installer/src/skills-runner.ts
|
|
22989
23065
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
22990
|
-
import * as
|
|
22991
|
-
import * as
|
|
23066
|
+
import * as fs23 from "node:fs";
|
|
23067
|
+
import * as path24 from "node:path";
|
|
22992
23068
|
var WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
22993
23069
|
function findOnPath(bin, env, platform) {
|
|
22994
23070
|
const pathValue = env.PATH ?? env.Path ?? "";
|
|
22995
|
-
const dirs = pathValue.split(
|
|
23071
|
+
const dirs = pathValue.split(path24.delimiter).filter((dir) => path24.isAbsolute(dir));
|
|
22996
23072
|
if (platform === "win32") {
|
|
22997
23073
|
const exts = (env.PATHEXT ?? WIN32_DEFAULT_PATHEXT).split(";").filter(Boolean);
|
|
22998
23074
|
for (const dir of dirs) {
|
|
22999
23075
|
for (const ext of exts) {
|
|
23000
|
-
const candidate =
|
|
23001
|
-
if (
|
|
23076
|
+
const candidate = path24.join(dir, bin + ext);
|
|
23077
|
+
if (fs23.existsSync(candidate)) return candidate;
|
|
23002
23078
|
}
|
|
23003
23079
|
}
|
|
23004
23080
|
return null;
|
|
23005
23081
|
}
|
|
23006
23082
|
for (const dir of dirs) {
|
|
23007
|
-
const candidate =
|
|
23083
|
+
const candidate = path24.join(dir, bin);
|
|
23008
23084
|
try {
|
|
23009
|
-
if (!
|
|
23010
|
-
|
|
23085
|
+
if (!fs23.statSync(candidate).isFile()) continue;
|
|
23086
|
+
fs23.accessSync(candidate, fs23.constants.X_OK);
|
|
23011
23087
|
return candidate;
|
|
23012
23088
|
} catch {
|
|
23013
23089
|
}
|
|
@@ -23184,13 +23260,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
23184
23260
|
let candidates = names;
|
|
23185
23261
|
if (names.length === 0) {
|
|
23186
23262
|
try {
|
|
23187
|
-
candidates =
|
|
23263
|
+
candidates = fs24.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
23188
23264
|
} catch {
|
|
23189
23265
|
continue;
|
|
23190
23266
|
}
|
|
23191
23267
|
}
|
|
23192
23268
|
for (const name of candidates) {
|
|
23193
|
-
const stat6 =
|
|
23269
|
+
const stat6 = fs24.statSync(path25.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
23194
23270
|
if (!stat6?.isFile()) continue;
|
|
23195
23271
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
23196
23272
|
}
|
|
@@ -23208,7 +23284,7 @@ function pruneLegacySkillDirs(projectRoot, scope, bundled = new Set(listBundledS
|
|
|
23208
23284
|
const removed = /* @__PURE__ */ new Set();
|
|
23209
23285
|
for (const { targetPath } of skillTargets) {
|
|
23210
23286
|
for (const name of legacy) {
|
|
23211
|
-
const dir =
|
|
23287
|
+
const dir = path25.join(targetPath, name);
|
|
23212
23288
|
try {
|
|
23213
23289
|
if (removePath(dir)) removed.add(name);
|
|
23214
23290
|
} catch {
|
|
@@ -23228,13 +23304,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
23228
23304
|
}
|
|
23229
23305
|
function removeLockEntries(lockPath, names) {
|
|
23230
23306
|
try {
|
|
23231
|
-
const lock = JSON.parse(
|
|
23307
|
+
const lock = JSON.parse(fs24.readFileSync(lockPath, "utf8"));
|
|
23232
23308
|
const skills = lock.skills;
|
|
23233
23309
|
if (!skills) return [];
|
|
23234
23310
|
const removed = names.filter((name) => name in skills);
|
|
23235
23311
|
if (removed.length === 0) return [];
|
|
23236
23312
|
for (const name of removed) delete skills[name];
|
|
23237
|
-
|
|
23313
|
+
fs24.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
23238
23314
|
return removed;
|
|
23239
23315
|
} catch {
|
|
23240
23316
|
return [];
|
|
@@ -23305,7 +23381,7 @@ async function runInstall(args) {
|
|
|
23305
23381
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
23306
23382
|
}
|
|
23307
23383
|
function installSpec(fromTar) {
|
|
23308
|
-
return
|
|
23384
|
+
return fs25.existsSync(fromTar) ? path26.resolve(fromTar) : fromTar;
|
|
23309
23385
|
}
|
|
23310
23386
|
async function installLocally(opts) {
|
|
23311
23387
|
const { fromTar, tel } = opts;
|
|
@@ -23612,8 +23688,8 @@ async function chooseAdapters(opts) {
|
|
|
23612
23688
|
|
|
23613
23689
|
// ../argent-installer/src/init-scope.ts
|
|
23614
23690
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
23615
|
-
import { existsSync as
|
|
23616
|
-
import { resolve as
|
|
23691
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
23692
|
+
import { resolve as resolve15 } from "node:path";
|
|
23617
23693
|
async function chooseScope(opts) {
|
|
23618
23694
|
if (opts.installMode === "local") {
|
|
23619
23695
|
return { scope: "local" };
|
|
@@ -23650,13 +23726,13 @@ async function chooseScope(opts) {
|
|
|
23650
23726
|
placeholder: process.cwd(),
|
|
23651
23727
|
validate(value) {
|
|
23652
23728
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
23653
|
-
const resolved =
|
|
23654
|
-
if (!
|
|
23729
|
+
const resolved = resolve15(value.trim());
|
|
23730
|
+
if (!existsSync16(resolved))
|
|
23655
23731
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
23656
23732
|
}
|
|
23657
23733
|
});
|
|
23658
23734
|
if (isCancel(customPathInput)) throw new InitCancelled("scope");
|
|
23659
|
-
return { scope: "custom", customRoot:
|
|
23735
|
+
return { scope: "custom", customRoot: resolve15(customPathInput.trim()) };
|
|
23660
23736
|
}
|
|
23661
23737
|
|
|
23662
23738
|
// ../argent-installer/src/init-mcp-write.ts
|
|
@@ -23956,8 +24032,8 @@ async function configureAllowlist(args) {
|
|
|
23956
24032
|
// ../argent-installer/src/init-skills.ts
|
|
23957
24033
|
var import_picocolors10 = __toESM(require_picocolors(), 1);
|
|
23958
24034
|
import { spawn as spawn3 } from "node:child_process";
|
|
23959
|
-
import * as
|
|
23960
|
-
import * as
|
|
24035
|
+
import * as os5 from "node:os";
|
|
24036
|
+
import * as path27 from "node:path";
|
|
23961
24037
|
var REF_MISSING = /Remote branch .* not found in upstream|couldn't find remote ref|unknown revision/i;
|
|
23962
24038
|
function meaningfulLine(err) {
|
|
23963
24039
|
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 +24041,10 @@ function meaningfulLine(err) {
|
|
|
23965
24041
|
}
|
|
23966
24042
|
function bundledCopyFor(version) {
|
|
23967
24043
|
const local = probeLocalInstall(resolveProjectRoot2(process.cwd()));
|
|
23968
|
-
if (local.packageDir && local.version === version) return
|
|
24044
|
+
if (local.packageDir && local.version === version) return path27.join(local.packageDir, "skills");
|
|
23969
24045
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
23970
24046
|
if (globalRoot && getGloballyInstalledVersion() === version) {
|
|
23971
|
-
return
|
|
24047
|
+
return path27.join(globalRoot, "skills");
|
|
23972
24048
|
}
|
|
23973
24049
|
return SKILLS_DIR;
|
|
23974
24050
|
}
|
|
@@ -24073,7 +24149,7 @@ async function runSkillsStep(args) {
|
|
|
24073
24149
|
const useGitHubSource = online && !fromTar && version !== "unknown";
|
|
24074
24150
|
const skillsSource = useGitHubSource ? buildArgentSkillsSource(version) : SKILLS_DIR;
|
|
24075
24151
|
const bundledCopy = useGitHubSource ? bundledCopyFor(version) : SKILLS_DIR;
|
|
24076
|
-
const skillsRoot = scope === "global" ?
|
|
24152
|
+
const skillsRoot = scope === "global" ? os5.homedir() : effectiveRoot;
|
|
24077
24153
|
const skillsScope = scope === "global" ? "global" : "project";
|
|
24078
24154
|
const expected = listBundledSkills(bundledCopy);
|
|
24079
24155
|
const snapshot = () => snapshotArgentSkills(skillsRoot, skillsScope, expected);
|
|
@@ -24195,7 +24271,7 @@ async function runSkillsStep(args) {
|
|
|
24195
24271
|
async function runSkillsCli(runner, args, interactive, cwd) {
|
|
24196
24272
|
if (!runner) throw new Error(NO_SKILLS_RUNNER_MESSAGE);
|
|
24197
24273
|
const command = skillsCommand(runner, args);
|
|
24198
|
-
return new Promise((
|
|
24274
|
+
return new Promise((resolve22, reject) => {
|
|
24199
24275
|
const child = spawn3(command.file, command.args, {
|
|
24200
24276
|
env: npxChildEnv(),
|
|
24201
24277
|
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
@@ -24214,7 +24290,7 @@ async function runSkillsCli(runner, args, interactive, cwd) {
|
|
|
24214
24290
|
}
|
|
24215
24291
|
child.on("close", (code, signal) => {
|
|
24216
24292
|
if (code === 0) {
|
|
24217
|
-
|
|
24293
|
+
resolve22();
|
|
24218
24294
|
} else {
|
|
24219
24295
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
24220
24296
|
reject(
|
|
@@ -24535,9 +24611,9 @@ function printBanner() {
|
|
|
24535
24611
|
// ../argent-installer/src/update.ts
|
|
24536
24612
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24537
24613
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24538
|
-
import * as
|
|
24539
|
-
import * as
|
|
24540
|
-
import * as
|
|
24614
|
+
import * as fs27 from "node:fs";
|
|
24615
|
+
import * as os7 from "node:os";
|
|
24616
|
+
import * as path33 from "node:path";
|
|
24541
24617
|
|
|
24542
24618
|
// ../argent-installer/src/install-targets.ts
|
|
24543
24619
|
function parseTargetFlags(args) {
|
|
@@ -24609,17 +24685,17 @@ async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
|
|
|
24609
24685
|
|
|
24610
24686
|
// ../argent-tools-client/src/launcher.ts
|
|
24611
24687
|
import * as net from "node:net";
|
|
24612
|
-
import * as
|
|
24613
|
-
import * as
|
|
24688
|
+
import * as os6 from "node:os";
|
|
24689
|
+
import * as fs26 from "node:fs";
|
|
24690
|
+
import * as path28 from "node:path";
|
|
24614
24691
|
import * as readline from "node:readline";
|
|
24615
|
-
import { homedir as homedir7 } from "node:os";
|
|
24616
24692
|
import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
|
|
24617
|
-
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 =
|
|
24693
|
+
import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
|
|
24694
|
+
import { readFile, readdir as readdir2, unlink } from "node:fs/promises";
|
|
24695
|
+
var STATE_DIR = argentHomeDir();
|
|
24696
|
+
var STATE_FILE = path28.join(STATE_DIR, "tool-server.json");
|
|
24697
|
+
var LOG_FILE = path28.join(STATE_DIR, "tool-server.log");
|
|
24698
|
+
var LOCK_FILE = path28.join(STATE_DIR, "tool-server.lock");
|
|
24623
24699
|
function isProcessAlive(pid) {
|
|
24624
24700
|
try {
|
|
24625
24701
|
process.kill(pid, 0);
|
|
@@ -24628,9 +24704,10 @@ function isProcessAlive(pid) {
|
|
|
24628
24704
|
return false;
|
|
24629
24705
|
}
|
|
24630
24706
|
}
|
|
24631
|
-
function stateFileForBundle(bundlePath) {
|
|
24707
|
+
function stateFileForBundle(bundlePath, cloudProfile) {
|
|
24632
24708
|
const key = createHash3("sha256").update(bundlePath).digest("hex").slice(0, 12);
|
|
24633
|
-
|
|
24709
|
+
const profile = cloudProfile ? `-cloud-${cloudProfile}` : "";
|
|
24710
|
+
return path28.join(STATE_DIR, `tool-server-${key}${profile}.json`);
|
|
24634
24711
|
}
|
|
24635
24712
|
async function readStateFile(file) {
|
|
24636
24713
|
try {
|
|
@@ -24640,16 +24717,22 @@ async function readStateFile(file) {
|
|
|
24640
24717
|
return null;
|
|
24641
24718
|
}
|
|
24642
24719
|
}
|
|
24643
|
-
async function readToolsServerState(bundlePath) {
|
|
24720
|
+
async function readToolsServerState(bundlePath, cloudProfile) {
|
|
24644
24721
|
if (bundlePath === void 0) return readStateFile(STATE_FILE);
|
|
24722
|
+
if (cloudProfile) {
|
|
24723
|
+
const own2 = await readStateFile(stateFileForBundle(bundlePath, cloudProfile));
|
|
24724
|
+
return own2?.cloudProfile === cloudProfile ? own2 : null;
|
|
24725
|
+
}
|
|
24645
24726
|
const own = await readStateFile(stateFileForBundle(bundlePath));
|
|
24646
24727
|
if (own) return own;
|
|
24647
24728
|
const legacy = await readStateFile(STATE_FILE);
|
|
24648
24729
|
return legacy && legacy.bundlePath === bundlePath ? legacy : null;
|
|
24649
24730
|
}
|
|
24650
|
-
async function clearToolsServerState(bundlePath) {
|
|
24731
|
+
async function clearToolsServerState(bundlePath, cloudProfile) {
|
|
24651
24732
|
const files = [STATE_FILE];
|
|
24652
|
-
if (bundlePath !== void 0) {
|
|
24733
|
+
if (bundlePath !== void 0 && cloudProfile) {
|
|
24734
|
+
files[0] = stateFileForBundle(bundlePath, cloudProfile);
|
|
24735
|
+
} else if (bundlePath !== void 0) {
|
|
24653
24736
|
files[0] = stateFileForBundle(bundlePath);
|
|
24654
24737
|
const legacy = await readStateFile(STATE_FILE);
|
|
24655
24738
|
if (legacy && legacy.bundlePath === bundlePath) files.push(STATE_FILE);
|
|
@@ -24661,7 +24744,7 @@ async function clearToolsServerState(bundlePath) {
|
|
|
24661
24744
|
}
|
|
24662
24745
|
}
|
|
24663
24746
|
}
|
|
24664
|
-
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12})?\.json$/;
|
|
24747
|
+
var STATE_FILE_RE = /^tool-server(-[0-9a-f]{12}(-cloud-[0-9a-f]{12})?)?\.json$/;
|
|
24665
24748
|
async function readAllToolsServerStates() {
|
|
24666
24749
|
let names;
|
|
24667
24750
|
try {
|
|
@@ -24672,7 +24755,7 @@ async function readAllToolsServerStates() {
|
|
|
24672
24755
|
const out = [];
|
|
24673
24756
|
for (const name of names) {
|
|
24674
24757
|
if (!STATE_FILE_RE.test(name)) continue;
|
|
24675
|
-
const file =
|
|
24758
|
+
const file = path28.join(STATE_DIR, name);
|
|
24676
24759
|
const state2 = await readStateFile(file);
|
|
24677
24760
|
if (state2) out.push({ file, state: state2 });
|
|
24678
24761
|
}
|
|
@@ -24707,32 +24790,32 @@ async function terminatePid(pid, stillOurs) {
|
|
|
24707
24790
|
}
|
|
24708
24791
|
await waitForExit(pid, SIGKILL_GRACE_MS);
|
|
24709
24792
|
}
|
|
24710
|
-
async function killToolServer(bundlePath) {
|
|
24711
|
-
const state2 = await readState(bundlePath);
|
|
24793
|
+
async function killToolServer(bundlePath, cloudProfile) {
|
|
24794
|
+
const state2 = await readState(bundlePath, cloudProfile);
|
|
24712
24795
|
if (!state2) return false;
|
|
24713
24796
|
const stillOurs = () => couldBeOurToolServer(state2.pid, state2.bundlePath);
|
|
24714
24797
|
const alive = isProcessAlive(state2.pid);
|
|
24715
24798
|
if (alive && !stillOurs()) return false;
|
|
24716
24799
|
if (alive) await terminatePid(state2.pid, stillOurs);
|
|
24717
|
-
await clearToolsServerState(bundlePath ?? state2.bundlePath);
|
|
24800
|
+
await clearToolsServerState(bundlePath ?? state2.bundlePath, cloudProfile);
|
|
24718
24801
|
return alive;
|
|
24719
24802
|
}
|
|
24720
24803
|
function isPathWithin(child, parent) {
|
|
24721
|
-
const rel =
|
|
24722
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
24804
|
+
const rel = path28.relative(parent, child);
|
|
24805
|
+
return rel !== "" && !rel.startsWith("..") && !path28.isAbsolute(rel);
|
|
24723
24806
|
}
|
|
24724
24807
|
function tryRealpath(p) {
|
|
24725
24808
|
try {
|
|
24726
|
-
return
|
|
24809
|
+
return fs26.realpathSync(p);
|
|
24727
24810
|
} catch {
|
|
24728
24811
|
return p;
|
|
24729
24812
|
}
|
|
24730
24813
|
}
|
|
24731
24814
|
async function killToolServerForInstallDir(packageDir) {
|
|
24732
|
-
const parents = /* @__PURE__ */ new Set([
|
|
24815
|
+
const parents = /* @__PURE__ */ new Set([path28.resolve(packageDir), tryRealpath(packageDir)]);
|
|
24733
24816
|
let killed = 0;
|
|
24734
24817
|
for (const { file, state: state2 } of await readAllToolsServerStates()) {
|
|
24735
|
-
const bundles = /* @__PURE__ */ new Set([
|
|
24818
|
+
const bundles = /* @__PURE__ */ new Set([path28.resolve(state2.bundlePath), tryRealpath(state2.bundlePath)]);
|
|
24736
24819
|
const matches2 = [...bundles].some((b) => [...parents].some((p) => isPathWithin(b, p)));
|
|
24737
24820
|
if (!matches2) continue;
|
|
24738
24821
|
const fresh = await readStateFile(file);
|
|
@@ -24750,7 +24833,7 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24750
24833
|
}
|
|
24751
24834
|
return killed;
|
|
24752
24835
|
}
|
|
24753
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24836
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs26.existsSync(p)) ?? "ps";
|
|
24754
24837
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24755
24838
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24756
24839
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -24797,38 +24880,37 @@ function couldBeOurToolServer(pid, marker) {
|
|
|
24797
24880
|
var import_yaml4 = __toESM(require_dist2(), 1);
|
|
24798
24881
|
import { readFile as readFile5 } from "node:fs/promises";
|
|
24799
24882
|
import { maxHeaderSize } from "node:http";
|
|
24800
|
-
import * as
|
|
24883
|
+
import * as path32 from "node:path";
|
|
24801
24884
|
|
|
24802
24885
|
// ../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");
|
|
24886
|
+
import * as path29 from "node:path";
|
|
24887
|
+
import { mkdir, readFile as readFile2, unlink as unlink2 } from "node:fs/promises";
|
|
24888
|
+
var LINK_DIR = argentHomeDir();
|
|
24889
|
+
var LINK_FILE = path29.join(LINK_DIR, "link.json");
|
|
24808
24890
|
|
|
24809
24891
|
// ../argent-tools-client/src/file-inputs.ts
|
|
24810
24892
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
24811
|
-
import { createReadStream as createReadStream2, rmSync as
|
|
24893
|
+
import { createReadStream as createReadStream2, rmSync as rmSync7 } from "node:fs";
|
|
24812
24894
|
import {
|
|
24813
|
-
chmod
|
|
24895
|
+
chmod,
|
|
24814
24896
|
lstat,
|
|
24815
|
-
mkdir as
|
|
24897
|
+
mkdir as mkdir2,
|
|
24816
24898
|
readFile as readFile3,
|
|
24817
24899
|
realpath as realpath2,
|
|
24818
|
-
rename
|
|
24900
|
+
rename,
|
|
24819
24901
|
rm as rm2,
|
|
24820
24902
|
stat as stat3,
|
|
24821
|
-
writeFile
|
|
24903
|
+
writeFile
|
|
24822
24904
|
} from "node:fs/promises";
|
|
24823
|
-
import { constants as
|
|
24824
|
-
import * as
|
|
24905
|
+
import { constants as constants4, tmpdir } from "node:os";
|
|
24906
|
+
import * as path30 from "node:path";
|
|
24825
24907
|
|
|
24826
24908
|
// ../archive/src/index.ts
|
|
24827
24909
|
import { spawn as spawn5 } from "node:child_process";
|
|
24828
24910
|
import { once } from "node:events";
|
|
24829
24911
|
import { createReadStream, createWriteStream } from "node:fs";
|
|
24830
24912
|
import { open, rm, readdir as readdir3 } from "node:fs/promises";
|
|
24831
|
-
import { basename as basename5, dirname as
|
|
24913
|
+
import { basename as basename5, dirname as dirname15, join as join28, resolve as resolve17, sep as sep4 } from "node:path";
|
|
24832
24914
|
import { Writable } from "node:stream";
|
|
24833
24915
|
import { pipeline } from "node:stream/promises";
|
|
24834
24916
|
import zlib2 from "node:zlib";
|
|
@@ -24846,23 +24928,33 @@ var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
|
24846
24928
|
// ../argent-tools-client/src/flow-files.ts
|
|
24847
24929
|
var import_yaml3 = __toESM(require_dist2(), 1);
|
|
24848
24930
|
import { readdir as readdir4, readFile as readFile4, realpath as realpath3, stat as stat4 } from "node:fs/promises";
|
|
24849
|
-
import * as
|
|
24931
|
+
import * as path31 from "node:path";
|
|
24850
24932
|
var INLINE_MEMBERS_BYTES = 256 * 1024;
|
|
24851
24933
|
|
|
24934
|
+
// ../argent-tools-client/src/tools-client.ts
|
|
24935
|
+
var RECORDING_FILE_INPUT = {
|
|
24936
|
+
target: "__recording",
|
|
24937
|
+
path: `\${project_root}/${E2E_DIRS[0].split(path32.sep).join("/")}/\${name}.yaml`,
|
|
24938
|
+
paths: E2E_DIRS.map((dir) => `\${project_root}/${dir.split(path32.sep).join("/")}/\${name}.yaml`),
|
|
24939
|
+
kind: "file",
|
|
24940
|
+
optional: true,
|
|
24941
|
+
collect: "flow"
|
|
24942
|
+
};
|
|
24943
|
+
|
|
24852
24944
|
// ../argent-tools-client/src/artifacts.ts
|
|
24853
24945
|
import {
|
|
24854
24946
|
copyFile,
|
|
24855
|
-
mkdir as
|
|
24947
|
+
mkdir as mkdir3,
|
|
24856
24948
|
mkdtemp,
|
|
24857
24949
|
readFile as readFile6,
|
|
24858
24950
|
realpath as realpath4,
|
|
24859
24951
|
rm as rm3,
|
|
24860
24952
|
stat as stat5,
|
|
24861
|
-
writeFile as
|
|
24953
|
+
writeFile as writeFile2
|
|
24862
24954
|
} from "node:fs/promises";
|
|
24863
24955
|
import { constants as fsConstants } from "node:fs";
|
|
24864
24956
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
24865
|
-
import { basename as basename8,
|
|
24957
|
+
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
24958
|
import { createHash as createHash5 } from "node:crypto";
|
|
24867
24959
|
var ALLOWED_SAVE_DIRS = /* @__PURE__ */ new Set([normalize2(".argent/recordings")]);
|
|
24868
24960
|
var RECORDINGS_SAVE_DIR = normalize2(".argent/recordings");
|
|
@@ -24937,7 +25029,7 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24937
25029
|
return installed ? "standalone_update" : "standalone_install";
|
|
24938
25030
|
}
|
|
24939
25031
|
function isLivePinnedEntry(entry) {
|
|
24940
|
-
return entry !== null && isPinnedGlobalEntry(entry) &&
|
|
25032
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs27.existsSync(entry.command) && fs27.existsSync(entry.args[0]);
|
|
24941
25033
|
}
|
|
24942
25034
|
async function refreshConfiguration({
|
|
24943
25035
|
projectRoot,
|
|
@@ -25169,7 +25261,7 @@ async function update(args) {
|
|
|
25169
25261
|
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
25170
25262
|
if (automatic) {
|
|
25171
25263
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
25172
|
-
if (!globallyInstalled || !globalRoot ||
|
|
25264
|
+
if (!globallyInstalled || !globalRoot || fs27.realpathSync(globalRoot) !== projectRoot || !isAutoUpdateEnabled() || !ownsGlobalInstall(pm, projectRoot)) {
|
|
25173
25265
|
spinner2.stop("Could not confirm an automatic update for this installation.");
|
|
25174
25266
|
return "noop";
|
|
25175
25267
|
}
|
|
@@ -25370,7 +25462,7 @@ async function update(args) {
|
|
|
25370
25462
|
process.exit(1);
|
|
25371
25463
|
}
|
|
25372
25464
|
if (automatic) {
|
|
25373
|
-
const runningRoot =
|
|
25465
|
+
const runningRoot = fs27.realpathSync(resolvePackageRoot(import.meta.dirname));
|
|
25374
25466
|
const result = requestedVersion ? await applyUpdateForTarget("global", runningRoot) : "noop";
|
|
25375
25467
|
if (result === "updated" && requestedVersion) {
|
|
25376
25468
|
writeCliRecord({
|
|
@@ -25379,7 +25471,7 @@ async function update(args) {
|
|
|
25379
25471
|
version: getGloballyInstalledVersion() ?? requestedVersion
|
|
25380
25472
|
});
|
|
25381
25473
|
await refreshConfiguration({
|
|
25382
|
-
projectRoot:
|
|
25474
|
+
projectRoot: os7.homedir(),
|
|
25383
25475
|
installMode: "global",
|
|
25384
25476
|
nonInteractive: true,
|
|
25385
25477
|
globalOnly: true
|
|
@@ -25393,7 +25485,7 @@ async function update(args) {
|
|
|
25393
25485
|
return;
|
|
25394
25486
|
}
|
|
25395
25487
|
const rootOverride = getProjectRootOverride(args);
|
|
25396
|
-
const projectRoot = rootOverride ?
|
|
25488
|
+
const projectRoot = rootOverride ? path33.resolve(rootOverride) : resolveProjectRoot2(process.cwd());
|
|
25397
25489
|
installMode = resolveInstallMode(projectRoot);
|
|
25398
25490
|
const flags = parseTargetFlags(args);
|
|
25399
25491
|
const localInstalled = installMode === "local" && probeLocalInstall(projectRoot).installed;
|
|
@@ -25473,8 +25565,8 @@ async function update(args) {
|
|
|
25473
25565
|
// ../argent-installer/src/uninstall.ts
|
|
25474
25566
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
25475
25567
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
25476
|
-
import * as
|
|
25477
|
-
import * as
|
|
25568
|
+
import * as fs28 from "node:fs";
|
|
25569
|
+
import * as path34 from "node:path";
|
|
25478
25570
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
25479
25571
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
25480
25572
|
failure_stage: "installer_uninstall_toolserver_stop",
|
|
@@ -25495,10 +25587,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
25495
25587
|
};
|
|
25496
25588
|
function removeDirIfEmpty2(dirPath) {
|
|
25497
25589
|
try {
|
|
25498
|
-
if (!
|
|
25499
|
-
if (!
|
|
25500
|
-
if (
|
|
25501
|
-
|
|
25590
|
+
if (!fs28.existsSync(dirPath)) return false;
|
|
25591
|
+
if (!fs28.statSync(dirPath).isDirectory()) return false;
|
|
25592
|
+
if (fs28.readdirSync(dirPath).length > 0) return false;
|
|
25593
|
+
fs28.rmdirSync(dirPath);
|
|
25502
25594
|
return true;
|
|
25503
25595
|
} catch {
|
|
25504
25596
|
return false;
|
|
@@ -25508,9 +25600,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
25508
25600
|
const files = [];
|
|
25509
25601
|
const directories = [];
|
|
25510
25602
|
function walk(currentDir, relativeDir = "") {
|
|
25511
|
-
for (const entry of
|
|
25512
|
-
const relativePath = relativeDir ?
|
|
25513
|
-
const absolutePath =
|
|
25603
|
+
for (const entry of fs28.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25604
|
+
const relativePath = relativeDir ? path34.join(relativeDir, entry.name) : entry.name;
|
|
25605
|
+
const absolutePath = path34.join(currentDir, entry.name);
|
|
25514
25606
|
if (entry.isDirectory()) {
|
|
25515
25607
|
walk(absolutePath, relativePath);
|
|
25516
25608
|
directories.push(relativePath);
|
|
@@ -25523,15 +25615,15 @@ function collectBundledPaths(sourceDir) {
|
|
|
25523
25615
|
return { files, directories };
|
|
25524
25616
|
}
|
|
25525
25617
|
function removeBundledContent(sourceDir, targetDir) {
|
|
25526
|
-
if (!
|
|
25618
|
+
if (!fs28.existsSync(sourceDir) || !fs28.existsSync(targetDir)) {
|
|
25527
25619
|
return { removedPaths: [], removedRoot: false };
|
|
25528
25620
|
}
|
|
25529
25621
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
25530
25622
|
const removedPaths = [];
|
|
25531
25623
|
for (const relativePath of files) {
|
|
25532
|
-
const targetPath =
|
|
25624
|
+
const targetPath = path34.join(targetDir, relativePath);
|
|
25533
25625
|
try {
|
|
25534
|
-
const entry =
|
|
25626
|
+
const entry = fs28.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25535
25627
|
if (!entry || entry.isDirectory()) continue;
|
|
25536
25628
|
removePath(targetPath);
|
|
25537
25629
|
removedPaths.push(relativePath);
|
|
@@ -25539,36 +25631,36 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25539
25631
|
}
|
|
25540
25632
|
}
|
|
25541
25633
|
directories.sort(
|
|
25542
|
-
(a2, b) => b.split(
|
|
25634
|
+
(a2, b) => b.split(path34.sep).length - a2.split(path34.sep).length || b.length - a2.length
|
|
25543
25635
|
);
|
|
25544
25636
|
for (const relativePath of directories) {
|
|
25545
|
-
const targetPath =
|
|
25637
|
+
const targetPath = path34.join(targetDir, relativePath);
|
|
25546
25638
|
try {
|
|
25547
|
-
if (!
|
|
25548
|
-
if (!
|
|
25549
|
-
if (
|
|
25550
|
-
|
|
25639
|
+
if (!fs28.existsSync(targetPath)) continue;
|
|
25640
|
+
if (!fs28.statSync(targetPath).isDirectory()) continue;
|
|
25641
|
+
if (fs28.readdirSync(targetPath).length > 0) continue;
|
|
25642
|
+
fs28.rmdirSync(targetPath);
|
|
25551
25643
|
} catch {
|
|
25552
25644
|
}
|
|
25553
25645
|
}
|
|
25554
25646
|
let removedRoot = false;
|
|
25555
25647
|
try {
|
|
25556
|
-
if (
|
|
25557
|
-
if (
|
|
25558
|
-
|
|
25648
|
+
if (fs28.existsSync(targetDir) && fs28.statSync(targetDir).isDirectory()) {
|
|
25649
|
+
if (fs28.readdirSync(targetDir).length === 0) {
|
|
25650
|
+
fs28.rmdirSync(targetDir);
|
|
25559
25651
|
removedRoot = true;
|
|
25560
25652
|
}
|
|
25561
25653
|
}
|
|
25562
25654
|
} catch {
|
|
25563
25655
|
}
|
|
25564
25656
|
if (removedRoot) {
|
|
25565
|
-
removeDirIfEmpty2(
|
|
25657
|
+
removeDirIfEmpty2(path34.dirname(targetDir));
|
|
25566
25658
|
}
|
|
25567
25659
|
return { removedPaths, removedRoot };
|
|
25568
25660
|
}
|
|
25569
25661
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
25570
25662
|
try {
|
|
25571
|
-
const content =
|
|
25663
|
+
const content = fs28.readFileSync(skillFilePath, "utf8");
|
|
25572
25664
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
25573
25665
|
if (!frontmatter) return fallbackName;
|
|
25574
25666
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -25579,23 +25671,23 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
25579
25671
|
}
|
|
25580
25672
|
}
|
|
25581
25673
|
function getBundledSkillNames(skillsDir) {
|
|
25582
|
-
if (!
|
|
25674
|
+
if (!fs28.existsSync(skillsDir)) return [];
|
|
25583
25675
|
const skillNames = [];
|
|
25584
|
-
for (const entry of
|
|
25676
|
+
for (const entry of fs28.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
25585
25677
|
if (!entry.isDirectory()) continue;
|
|
25586
|
-
const skillFilePath =
|
|
25587
|
-
if (!
|
|
25678
|
+
const skillFilePath = path34.join(skillsDir, entry.name, "SKILL.md");
|
|
25679
|
+
if (!fs28.existsSync(skillFilePath)) continue;
|
|
25588
25680
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
25589
25681
|
}
|
|
25590
25682
|
return [...new Set(skillNames)].sort();
|
|
25591
25683
|
}
|
|
25592
25684
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
25593
|
-
if (!
|
|
25685
|
+
if (!fs28.existsSync(targetDir)) {
|
|
25594
25686
|
return { removedPaths: [], removedRoot: false };
|
|
25595
25687
|
}
|
|
25596
25688
|
const removedPaths = [];
|
|
25597
25689
|
for (const skillName of skillNames) {
|
|
25598
|
-
const targetPath =
|
|
25690
|
+
const targetPath = path34.join(targetDir, skillName);
|
|
25599
25691
|
try {
|
|
25600
25692
|
if (removePath(targetPath)) removedPaths.push(skillName);
|
|
25601
25693
|
} catch {
|
|
@@ -25603,17 +25695,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
25603
25695
|
}
|
|
25604
25696
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
25605
25697
|
if (removedRoot) {
|
|
25606
|
-
removeDirIfEmpty2(
|
|
25698
|
+
removeDirIfEmpty2(path34.dirname(targetDir));
|
|
25607
25699
|
}
|
|
25608
25700
|
return { removedPaths, removedRoot };
|
|
25609
25701
|
}
|
|
25610
25702
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
25611
|
-
if (!
|
|
25703
|
+
if (!fs28.existsSync(lockPath)) {
|
|
25612
25704
|
return { removedSkills: [], removedFile: false };
|
|
25613
25705
|
}
|
|
25614
25706
|
let parsed;
|
|
25615
25707
|
try {
|
|
25616
|
-
parsed = JSON.parse(
|
|
25708
|
+
parsed = JSON.parse(fs28.readFileSync(lockPath, "utf8"));
|
|
25617
25709
|
} catch {
|
|
25618
25710
|
return { removedSkills: [], removedFile: false };
|
|
25619
25711
|
}
|
|
@@ -25640,10 +25732,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25640
25732
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25641
25733
|
);
|
|
25642
25734
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25643
|
-
|
|
25735
|
+
fs28.rmSync(lockPath, { force: true });
|
|
25644
25736
|
return { removedSkills, removedFile: true };
|
|
25645
25737
|
}
|
|
25646
|
-
|
|
25738
|
+
fs28.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25647
25739
|
return { removedSkills, removedFile: false };
|
|
25648
25740
|
}
|
|
25649
25741
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25846,7 +25938,7 @@ async function uninstall(args) {
|
|
|
25846
25938
|
),
|
|
25847
25939
|
{ ask: false }
|
|
25848
25940
|
);
|
|
25849
|
-
for (const root of retired.removedRoots) removeDirIfEmpty2(
|
|
25941
|
+
for (const root of retired.removedRoots) removeDirIfEmpty2(path34.dirname(root));
|
|
25850
25942
|
const retiredLines = formatRetiredCleanup(retired);
|
|
25851
25943
|
pruneResults.push(...retiredLines.removed.map((line) => `${import_picocolors13.default.green("+")} ${line}`));
|
|
25852
25944
|
const retiredKept = retiredLines.kept.map((line) => ` ${line}`);
|
|
@@ -25965,10 +26057,10 @@ async function uninstall(args) {
|
|
|
25965
26057
|
try {
|
|
25966
26058
|
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25967
26059
|
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25968
|
-
const removed = !leftover || removable.installDir !== null && !
|
|
26060
|
+
const removed = !leftover || removable.installDir !== null && !fs28.existsSync(removable.installDir);
|
|
25969
26061
|
if (removed) hasUninstalledPackage = true;
|
|
25970
26062
|
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25971
|
-
log.info(import_picocolors13.default.dim(
|
|
26063
|
+
log.info(import_picocolors13.default.dim(`Removed ${cliRecordPath()} (provider CLI discovery record).`));
|
|
25972
26064
|
}
|
|
25973
26065
|
if (leftover) {
|
|
25974
26066
|
throw new Error(
|