@swmansion/argent 0.8.1 → 0.10.0
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 +49 -9
- package/bin/argent-simulator-server.cjs +56 -0
- package/bin/{ax-service → darwin/ax-service} +0 -0
- package/bin/{simulator-server → darwin/simulator-server} +0 -0
- package/bin/linux/simulator-server +0 -0
- package/dist/argent-android-devtools-0.1.0.apk +0 -0
- package/dist/cli-cmds.mjs +2364 -76
- package/dist/cli.d.ts +6 -0
- package/dist/cli.js +23 -2
- package/dist/cli.js.map +1 -1
- package/dist/installer.mjs +598 -122
- package/dist/mcp-server.mjs +196 -53
- package/dist/tool-server.cjs +6059 -859
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
- package/rules/argent.md +8 -2
- package/skills/argent-android-emulator-setup/SKILL.md +1 -1
- package/skills/argent-device-interact/SKILL.md +11 -2
- package/skills/argent-react-native-app-workflow/SKILL.md +2 -0
- package/skills/argent-screenshot-diff/SKILL.md +67 -0
- package/skills/argent-test-ui-flow/SKILL.md +38 -16
package/dist/installer.mjs
CHANGED
|
@@ -2209,17 +2209,17 @@ var require_visit = __commonJS({
|
|
|
2209
2209
|
visit2.BREAK = BREAK;
|
|
2210
2210
|
visit2.SKIP = SKIP;
|
|
2211
2211
|
visit2.REMOVE = REMOVE;
|
|
2212
|
-
function visit_(key, node, visitor,
|
|
2213
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
2212
|
+
function visit_(key, node, visitor, path6) {
|
|
2213
|
+
const ctrl = callVisitor(key, node, visitor, path6);
|
|
2214
2214
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2215
|
-
replaceNode(key,
|
|
2216
|
-
return visit_(key, ctrl, visitor,
|
|
2215
|
+
replaceNode(key, path6, ctrl);
|
|
2216
|
+
return visit_(key, ctrl, visitor, path6);
|
|
2217
2217
|
}
|
|
2218
2218
|
if (typeof ctrl !== "symbol") {
|
|
2219
2219
|
if (identity.isCollection(node)) {
|
|
2220
|
-
|
|
2220
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2221
2221
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2222
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
2222
|
+
const ci = visit_(i, node.items[i], visitor, path6);
|
|
2223
2223
|
if (typeof ci === "number")
|
|
2224
2224
|
i = ci - 1;
|
|
2225
2225
|
else if (ci === BREAK)
|
|
@@ -2230,13 +2230,13 @@ var require_visit = __commonJS({
|
|
|
2230
2230
|
}
|
|
2231
2231
|
}
|
|
2232
2232
|
} else if (identity.isPair(node)) {
|
|
2233
|
-
|
|
2234
|
-
const ck = visit_("key", node.key, visitor,
|
|
2233
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2234
|
+
const ck = visit_("key", node.key, visitor, path6);
|
|
2235
2235
|
if (ck === BREAK)
|
|
2236
2236
|
return BREAK;
|
|
2237
2237
|
else if (ck === REMOVE)
|
|
2238
2238
|
node.key = null;
|
|
2239
|
-
const cv = visit_("value", node.value, visitor,
|
|
2239
|
+
const cv = visit_("value", node.value, visitor, path6);
|
|
2240
2240
|
if (cv === BREAK)
|
|
2241
2241
|
return BREAK;
|
|
2242
2242
|
else if (cv === REMOVE)
|
|
@@ -2257,17 +2257,17 @@ var require_visit = __commonJS({
|
|
|
2257
2257
|
visitAsync.BREAK = BREAK;
|
|
2258
2258
|
visitAsync.SKIP = SKIP;
|
|
2259
2259
|
visitAsync.REMOVE = REMOVE;
|
|
2260
|
-
async function visitAsync_(key, node, visitor,
|
|
2261
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
2260
|
+
async function visitAsync_(key, node, visitor, path6) {
|
|
2261
|
+
const ctrl = await callVisitor(key, node, visitor, path6);
|
|
2262
2262
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2263
|
-
replaceNode(key,
|
|
2264
|
-
return visitAsync_(key, ctrl, visitor,
|
|
2263
|
+
replaceNode(key, path6, ctrl);
|
|
2264
|
+
return visitAsync_(key, ctrl, visitor, path6);
|
|
2265
2265
|
}
|
|
2266
2266
|
if (typeof ctrl !== "symbol") {
|
|
2267
2267
|
if (identity.isCollection(node)) {
|
|
2268
|
-
|
|
2268
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2269
2269
|
for (let i = 0; i < node.items.length; ++i) {
|
|
2270
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
2270
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path6);
|
|
2271
2271
|
if (typeof ci === "number")
|
|
2272
2272
|
i = ci - 1;
|
|
2273
2273
|
else if (ci === BREAK)
|
|
@@ -2278,13 +2278,13 @@ var require_visit = __commonJS({
|
|
|
2278
2278
|
}
|
|
2279
2279
|
}
|
|
2280
2280
|
} else if (identity.isPair(node)) {
|
|
2281
|
-
|
|
2282
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
2281
|
+
path6 = Object.freeze(path6.concat(node));
|
|
2282
|
+
const ck = await visitAsync_("key", node.key, visitor, path6);
|
|
2283
2283
|
if (ck === BREAK)
|
|
2284
2284
|
return BREAK;
|
|
2285
2285
|
else if (ck === REMOVE)
|
|
2286
2286
|
node.key = null;
|
|
2287
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
2287
|
+
const cv = await visitAsync_("value", node.value, visitor, path6);
|
|
2288
2288
|
if (cv === BREAK)
|
|
2289
2289
|
return BREAK;
|
|
2290
2290
|
else if (cv === REMOVE)
|
|
@@ -2311,23 +2311,23 @@ var require_visit = __commonJS({
|
|
|
2311
2311
|
}
|
|
2312
2312
|
return visitor;
|
|
2313
2313
|
}
|
|
2314
|
-
function callVisitor(key, node, visitor,
|
|
2314
|
+
function callVisitor(key, node, visitor, path6) {
|
|
2315
2315
|
if (typeof visitor === "function")
|
|
2316
|
-
return visitor(key, node,
|
|
2316
|
+
return visitor(key, node, path6);
|
|
2317
2317
|
if (identity.isMap(node))
|
|
2318
|
-
return visitor.Map?.(key, node,
|
|
2318
|
+
return visitor.Map?.(key, node, path6);
|
|
2319
2319
|
if (identity.isSeq(node))
|
|
2320
|
-
return visitor.Seq?.(key, node,
|
|
2320
|
+
return visitor.Seq?.(key, node, path6);
|
|
2321
2321
|
if (identity.isPair(node))
|
|
2322
|
-
return visitor.Pair?.(key, node,
|
|
2322
|
+
return visitor.Pair?.(key, node, path6);
|
|
2323
2323
|
if (identity.isScalar(node))
|
|
2324
|
-
return visitor.Scalar?.(key, node,
|
|
2324
|
+
return visitor.Scalar?.(key, node, path6);
|
|
2325
2325
|
if (identity.isAlias(node))
|
|
2326
|
-
return visitor.Alias?.(key, node,
|
|
2326
|
+
return visitor.Alias?.(key, node, path6);
|
|
2327
2327
|
return void 0;
|
|
2328
2328
|
}
|
|
2329
|
-
function replaceNode(key,
|
|
2330
|
-
const parent =
|
|
2329
|
+
function replaceNode(key, path6, node) {
|
|
2330
|
+
const parent = path6[path6.length - 1];
|
|
2331
2331
|
if (identity.isCollection(parent)) {
|
|
2332
2332
|
parent.items[key] = node;
|
|
2333
2333
|
} else if (identity.isPair(parent)) {
|
|
@@ -2937,10 +2937,10 @@ var require_Collection = __commonJS({
|
|
|
2937
2937
|
var createNode = require_createNode();
|
|
2938
2938
|
var identity = require_identity();
|
|
2939
2939
|
var Node = require_Node();
|
|
2940
|
-
function collectionFromPath(schema,
|
|
2940
|
+
function collectionFromPath(schema, path6, value) {
|
|
2941
2941
|
let v2 = value;
|
|
2942
|
-
for (let i =
|
|
2943
|
-
const k2 =
|
|
2942
|
+
for (let i = path6.length - 1; i >= 0; --i) {
|
|
2943
|
+
const k2 = path6[i];
|
|
2944
2944
|
if (typeof k2 === "number" && Number.isInteger(k2) && k2 >= 0) {
|
|
2945
2945
|
const a = [];
|
|
2946
2946
|
a[k2] = v2;
|
|
@@ -2959,7 +2959,7 @@ var require_Collection = __commonJS({
|
|
|
2959
2959
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2960
2960
|
});
|
|
2961
2961
|
}
|
|
2962
|
-
var isEmptyPath = (
|
|
2962
|
+
var isEmptyPath = (path6) => path6 == null || typeof path6 === "object" && !!path6[Symbol.iterator]().next().done;
|
|
2963
2963
|
var Collection = class extends Node.NodeBase {
|
|
2964
2964
|
constructor(type, schema) {
|
|
2965
2965
|
super(type);
|
|
@@ -2989,11 +2989,11 @@ var require_Collection = __commonJS({
|
|
|
2989
2989
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2990
2990
|
* that already exists in the map.
|
|
2991
2991
|
*/
|
|
2992
|
-
addIn(
|
|
2993
|
-
if (isEmptyPath(
|
|
2992
|
+
addIn(path6, value) {
|
|
2993
|
+
if (isEmptyPath(path6))
|
|
2994
2994
|
this.add(value);
|
|
2995
2995
|
else {
|
|
2996
|
-
const [key, ...rest] =
|
|
2996
|
+
const [key, ...rest] = path6;
|
|
2997
2997
|
const node = this.get(key, true);
|
|
2998
2998
|
if (identity.isCollection(node))
|
|
2999
2999
|
node.addIn(rest, value);
|
|
@@ -3007,8 +3007,8 @@ var require_Collection = __commonJS({
|
|
|
3007
3007
|
* Removes a value from the collection.
|
|
3008
3008
|
* @returns `true` if the item was found and removed.
|
|
3009
3009
|
*/
|
|
3010
|
-
deleteIn(
|
|
3011
|
-
const [key, ...rest] =
|
|
3010
|
+
deleteIn(path6) {
|
|
3011
|
+
const [key, ...rest] = path6;
|
|
3012
3012
|
if (rest.length === 0)
|
|
3013
3013
|
return this.delete(key);
|
|
3014
3014
|
const node = this.get(key, true);
|
|
@@ -3022,8 +3022,8 @@ var require_Collection = __commonJS({
|
|
|
3022
3022
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3023
3023
|
* `true` (collections are always returned intact).
|
|
3024
3024
|
*/
|
|
3025
|
-
getIn(
|
|
3026
|
-
const [key, ...rest] =
|
|
3025
|
+
getIn(path6, keepScalar) {
|
|
3026
|
+
const [key, ...rest] = path6;
|
|
3027
3027
|
const node = this.get(key, true);
|
|
3028
3028
|
if (rest.length === 0)
|
|
3029
3029
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -3041,8 +3041,8 @@ var require_Collection = __commonJS({
|
|
|
3041
3041
|
/**
|
|
3042
3042
|
* Checks if the collection includes a value with the key `key`.
|
|
3043
3043
|
*/
|
|
3044
|
-
hasIn(
|
|
3045
|
-
const [key, ...rest] =
|
|
3044
|
+
hasIn(path6) {
|
|
3045
|
+
const [key, ...rest] = path6;
|
|
3046
3046
|
if (rest.length === 0)
|
|
3047
3047
|
return this.has(key);
|
|
3048
3048
|
const node = this.get(key, true);
|
|
@@ -3052,8 +3052,8 @@ var require_Collection = __commonJS({
|
|
|
3052
3052
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3053
3053
|
* boolean to add/remove the item from the set.
|
|
3054
3054
|
*/
|
|
3055
|
-
setIn(
|
|
3056
|
-
const [key, ...rest] =
|
|
3055
|
+
setIn(path6, value) {
|
|
3056
|
+
const [key, ...rest] = path6;
|
|
3057
3057
|
if (rest.length === 0) {
|
|
3058
3058
|
this.set(key, value);
|
|
3059
3059
|
} else {
|
|
@@ -5568,9 +5568,9 @@ var require_Document = __commonJS({
|
|
|
5568
5568
|
this.contents.add(value);
|
|
5569
5569
|
}
|
|
5570
5570
|
/** Adds a value to the document. */
|
|
5571
|
-
addIn(
|
|
5571
|
+
addIn(path6, value) {
|
|
5572
5572
|
if (assertCollection(this.contents))
|
|
5573
|
-
this.contents.addIn(
|
|
5573
|
+
this.contents.addIn(path6, value);
|
|
5574
5574
|
}
|
|
5575
5575
|
/**
|
|
5576
5576
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5645,14 +5645,14 @@ var require_Document = __commonJS({
|
|
|
5645
5645
|
* Removes a value from the document.
|
|
5646
5646
|
* @returns `true` if the item was found and removed.
|
|
5647
5647
|
*/
|
|
5648
|
-
deleteIn(
|
|
5649
|
-
if (Collection.isEmptyPath(
|
|
5648
|
+
deleteIn(path6) {
|
|
5649
|
+
if (Collection.isEmptyPath(path6)) {
|
|
5650
5650
|
if (this.contents == null)
|
|
5651
5651
|
return false;
|
|
5652
5652
|
this.contents = null;
|
|
5653
5653
|
return true;
|
|
5654
5654
|
}
|
|
5655
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5655
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path6) : false;
|
|
5656
5656
|
}
|
|
5657
5657
|
/**
|
|
5658
5658
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5667,10 +5667,10 @@ var require_Document = __commonJS({
|
|
|
5667
5667
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5668
5668
|
* `true` (collections are always returned intact).
|
|
5669
5669
|
*/
|
|
5670
|
-
getIn(
|
|
5671
|
-
if (Collection.isEmptyPath(
|
|
5670
|
+
getIn(path6, keepScalar) {
|
|
5671
|
+
if (Collection.isEmptyPath(path6))
|
|
5672
5672
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5673
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5673
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path6, keepScalar) : void 0;
|
|
5674
5674
|
}
|
|
5675
5675
|
/**
|
|
5676
5676
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5681,10 +5681,10 @@ var require_Document = __commonJS({
|
|
|
5681
5681
|
/**
|
|
5682
5682
|
* Checks if the document includes a value at `path`.
|
|
5683
5683
|
*/
|
|
5684
|
-
hasIn(
|
|
5685
|
-
if (Collection.isEmptyPath(
|
|
5684
|
+
hasIn(path6) {
|
|
5685
|
+
if (Collection.isEmptyPath(path6))
|
|
5686
5686
|
return this.contents !== void 0;
|
|
5687
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5687
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path6) : false;
|
|
5688
5688
|
}
|
|
5689
5689
|
/**
|
|
5690
5690
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5701,13 +5701,13 @@ var require_Document = __commonJS({
|
|
|
5701
5701
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5702
5702
|
* boolean to add/remove the item from the set.
|
|
5703
5703
|
*/
|
|
5704
|
-
setIn(
|
|
5705
|
-
if (Collection.isEmptyPath(
|
|
5704
|
+
setIn(path6, value) {
|
|
5705
|
+
if (Collection.isEmptyPath(path6)) {
|
|
5706
5706
|
this.contents = value;
|
|
5707
5707
|
} else if (this.contents == null) {
|
|
5708
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5708
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path6), value);
|
|
5709
5709
|
} else if (assertCollection(this.contents)) {
|
|
5710
|
-
this.contents.setIn(
|
|
5710
|
+
this.contents.setIn(path6, value);
|
|
5711
5711
|
}
|
|
5712
5712
|
}
|
|
5713
5713
|
/**
|
|
@@ -7667,9 +7667,9 @@ var require_cst_visit = __commonJS({
|
|
|
7667
7667
|
visit2.BREAK = BREAK;
|
|
7668
7668
|
visit2.SKIP = SKIP;
|
|
7669
7669
|
visit2.REMOVE = REMOVE;
|
|
7670
|
-
visit2.itemAtPath = (cst,
|
|
7670
|
+
visit2.itemAtPath = (cst, path6) => {
|
|
7671
7671
|
let item = cst;
|
|
7672
|
-
for (const [field, index] of
|
|
7672
|
+
for (const [field, index] of path6) {
|
|
7673
7673
|
const tok = item?.[field];
|
|
7674
7674
|
if (tok && "items" in tok) {
|
|
7675
7675
|
item = tok.items[index];
|
|
@@ -7678,23 +7678,23 @@ var require_cst_visit = __commonJS({
|
|
|
7678
7678
|
}
|
|
7679
7679
|
return item;
|
|
7680
7680
|
};
|
|
7681
|
-
visit2.parentCollection = (cst,
|
|
7682
|
-
const parent = visit2.itemAtPath(cst,
|
|
7683
|
-
const field =
|
|
7681
|
+
visit2.parentCollection = (cst, path6) => {
|
|
7682
|
+
const parent = visit2.itemAtPath(cst, path6.slice(0, -1));
|
|
7683
|
+
const field = path6[path6.length - 1][0];
|
|
7684
7684
|
const coll = parent?.[field];
|
|
7685
7685
|
if (coll && "items" in coll)
|
|
7686
7686
|
return coll;
|
|
7687
7687
|
throw new Error("Parent collection not found");
|
|
7688
7688
|
};
|
|
7689
|
-
function _visit(
|
|
7690
|
-
let ctrl = visitor(item,
|
|
7689
|
+
function _visit(path6, item, visitor) {
|
|
7690
|
+
let ctrl = visitor(item, path6);
|
|
7691
7691
|
if (typeof ctrl === "symbol")
|
|
7692
7692
|
return ctrl;
|
|
7693
7693
|
for (const field of ["key", "value"]) {
|
|
7694
7694
|
const token = item[field];
|
|
7695
7695
|
if (token && "items" in token) {
|
|
7696
7696
|
for (let i = 0; i < token.items.length; ++i) {
|
|
7697
|
-
const ci = _visit(Object.freeze(
|
|
7697
|
+
const ci = _visit(Object.freeze(path6.concat([[field, i]])), token.items[i], visitor);
|
|
7698
7698
|
if (typeof ci === "number")
|
|
7699
7699
|
i = ci - 1;
|
|
7700
7700
|
else if (ci === BREAK)
|
|
@@ -7705,10 +7705,10 @@ var require_cst_visit = __commonJS({
|
|
|
7705
7705
|
}
|
|
7706
7706
|
}
|
|
7707
7707
|
if (typeof ctrl === "function" && field === "key")
|
|
7708
|
-
ctrl = ctrl(item,
|
|
7708
|
+
ctrl = ctrl(item, path6);
|
|
7709
7709
|
}
|
|
7710
7710
|
}
|
|
7711
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7711
|
+
return typeof ctrl === "function" ? ctrl(item, path6) : ctrl;
|
|
7712
7712
|
}
|
|
7713
7713
|
exports.visit = visit2;
|
|
7714
7714
|
}
|
|
@@ -9459,6 +9459,291 @@ var require_dist = __commonJS({
|
|
|
9459
9459
|
}
|
|
9460
9460
|
});
|
|
9461
9461
|
|
|
9462
|
+
// ../update-core/dist/config-parse.js
|
|
9463
|
+
var require_config_parse = __commonJS({
|
|
9464
|
+
"../update-core/dist/config-parse.js"(exports) {
|
|
9465
|
+
"use strict";
|
|
9466
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9467
|
+
exports.DAY_MS = exports.MINUTE_MS = exports.SECOND_MS = void 0;
|
|
9468
|
+
exports.parseConfigValue = parseConfigValue;
|
|
9469
|
+
exports.parseBeforeAgeMs = parseBeforeAgeMs;
|
|
9470
|
+
exports.parseYarnAgeGateMs = parseYarnAgeGateMs;
|
|
9471
|
+
exports.SECOND_MS = 1e3;
|
|
9472
|
+
exports.MINUTE_MS = 60 * 1e3;
|
|
9473
|
+
exports.DAY_MS = 24 * 60 * 60 * 1e3;
|
|
9474
|
+
function trimConfigValue(stdout) {
|
|
9475
|
+
const trimmed = stdout.trim();
|
|
9476
|
+
if (!trimmed || trimmed === "undefined" || trimmed === "null")
|
|
9477
|
+
return null;
|
|
9478
|
+
if (trimmed.startsWith('"') && trimmed.endsWith('"') || trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
9479
|
+
return trimmed.slice(1, -1).trim();
|
|
9480
|
+
}
|
|
9481
|
+
return trimmed;
|
|
9482
|
+
}
|
|
9483
|
+
function parseConfigValue(stdout) {
|
|
9484
|
+
const value = trimConfigValue(stdout);
|
|
9485
|
+
if (!value)
|
|
9486
|
+
return 0;
|
|
9487
|
+
const n = Number(value);
|
|
9488
|
+
return Number.isFinite(n) && n > 0 ? n : 0;
|
|
9489
|
+
}
|
|
9490
|
+
function parseBeforeAgeMs(stdout, now = Date.now()) {
|
|
9491
|
+
const value = trimConfigValue(stdout);
|
|
9492
|
+
if (!value)
|
|
9493
|
+
return 0;
|
|
9494
|
+
const candidates = [value, value.replace(/\s+\([^)]*\)$/, "")];
|
|
9495
|
+
for (const candidate of candidates) {
|
|
9496
|
+
const ts = Date.parse(candidate);
|
|
9497
|
+
if (!Number.isNaN(ts)) {
|
|
9498
|
+
return ts < now ? now - ts : 0;
|
|
9499
|
+
}
|
|
9500
|
+
}
|
|
9501
|
+
return 0;
|
|
9502
|
+
}
|
|
9503
|
+
function parseYarnAgeGateMs(stdout) {
|
|
9504
|
+
const value = trimConfigValue(stdout);
|
|
9505
|
+
if (!value)
|
|
9506
|
+
return 0;
|
|
9507
|
+
const numeric = Number(value);
|
|
9508
|
+
if (Number.isFinite(numeric) && numeric > 0) {
|
|
9509
|
+
return numeric * exports.MINUTE_MS;
|
|
9510
|
+
}
|
|
9511
|
+
const match = value.match(/^(\d+(?:\.\d+)?)\s*(ms|s|m|h|d|w)$/i);
|
|
9512
|
+
if (!match)
|
|
9513
|
+
return 0;
|
|
9514
|
+
const amount = Number(match[1]);
|
|
9515
|
+
if (!Number.isFinite(amount) || amount <= 0)
|
|
9516
|
+
return 0;
|
|
9517
|
+
switch (match[2].toLowerCase()) {
|
|
9518
|
+
case "ms":
|
|
9519
|
+
return amount;
|
|
9520
|
+
case "s":
|
|
9521
|
+
return amount * exports.SECOND_MS;
|
|
9522
|
+
case "m":
|
|
9523
|
+
return amount * exports.MINUTE_MS;
|
|
9524
|
+
case "h":
|
|
9525
|
+
return amount * 60 * exports.MINUTE_MS;
|
|
9526
|
+
case "d":
|
|
9527
|
+
return amount * exports.DAY_MS;
|
|
9528
|
+
case "w":
|
|
9529
|
+
return amount * 7 * exports.DAY_MS;
|
|
9530
|
+
default:
|
|
9531
|
+
return 0;
|
|
9532
|
+
}
|
|
9533
|
+
}
|
|
9534
|
+
}
|
|
9535
|
+
});
|
|
9536
|
+
|
|
9537
|
+
// ../update-core/dist/min-release-age.js
|
|
9538
|
+
var require_min_release_age = __commonJS({
|
|
9539
|
+
"../update-core/dist/min-release-age.js"(exports) {
|
|
9540
|
+
"use strict";
|
|
9541
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9542
|
+
exports.detectMinReleaseAgeMsForPm = detectMinReleaseAgeMsForPm2;
|
|
9543
|
+
exports.detectMinReleaseAgeMs = detectMinReleaseAgeMs;
|
|
9544
|
+
var node_child_process_1 = __require("node:child_process");
|
|
9545
|
+
var config_parse_1 = require_config_parse();
|
|
9546
|
+
var PROBE_TIMEOUT_MS2 = 3e3;
|
|
9547
|
+
var OVERRIDE_ENV = "ARGENT_MIN_RELEASE_AGE_DAYS";
|
|
9548
|
+
var PM_PROBES = {
|
|
9549
|
+
// npm flattens `min-release-age` to an effective `before` cutoff, and some
|
|
9550
|
+
// npm 11.x builds report `min-release-age=null` even while the policy is
|
|
9551
|
+
// active. Probe `before`, which is what the resolver actually uses.
|
|
9552
|
+
npm: { command: "npm config get before", parse: config_parse_1.parseBeforeAgeMs },
|
|
9553
|
+
pnpm: {
|
|
9554
|
+
command: "pnpm config get minimumReleaseAge",
|
|
9555
|
+
parse: (stdout) => (0, config_parse_1.parseConfigValue)(stdout) * config_parse_1.MINUTE_MS
|
|
9556
|
+
},
|
|
9557
|
+
yarn: { command: "yarn config get npmMinimalAgeGate", parse: config_parse_1.parseYarnAgeGateMs }
|
|
9558
|
+
};
|
|
9559
|
+
function overrideMs() {
|
|
9560
|
+
const override = process.env[OVERRIDE_ENV];
|
|
9561
|
+
if (override === void 0)
|
|
9562
|
+
return null;
|
|
9563
|
+
const days = Number(override);
|
|
9564
|
+
return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
|
|
9565
|
+
}
|
|
9566
|
+
function probe(p2) {
|
|
9567
|
+
return new Promise((resolve3) => {
|
|
9568
|
+
(0, node_child_process_1.exec)(p2.command, { timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout) => {
|
|
9569
|
+
if (err) {
|
|
9570
|
+
resolve3(0);
|
|
9571
|
+
return;
|
|
9572
|
+
}
|
|
9573
|
+
resolve3(p2.parse(stdout));
|
|
9574
|
+
});
|
|
9575
|
+
});
|
|
9576
|
+
}
|
|
9577
|
+
async function detectMinReleaseAgeMsForPm2(pm) {
|
|
9578
|
+
const override = overrideMs();
|
|
9579
|
+
if (override !== null)
|
|
9580
|
+
return override;
|
|
9581
|
+
const p2 = PM_PROBES[pm];
|
|
9582
|
+
return p2 ? probe(p2) : 0;
|
|
9583
|
+
}
|
|
9584
|
+
async function detectMinReleaseAgeMs() {
|
|
9585
|
+
const override = overrideMs();
|
|
9586
|
+
if (override !== null)
|
|
9587
|
+
return override;
|
|
9588
|
+
const ages = await Promise.all(Object.values(PM_PROBES).map(probe));
|
|
9589
|
+
return ages.reduce((max, ms) => Math.max(max, ms), 0);
|
|
9590
|
+
}
|
|
9591
|
+
}
|
|
9592
|
+
});
|
|
9593
|
+
|
|
9594
|
+
// ../update-core/dist/registry.js
|
|
9595
|
+
var require_registry = __commonJS({
|
|
9596
|
+
"../update-core/dist/registry.js"(exports) {
|
|
9597
|
+
"use strict";
|
|
9598
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
9599
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
9600
|
+
};
|
|
9601
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9602
|
+
exports.fetchRegistryInfo = fetchRegistryInfo2;
|
|
9603
|
+
var node_https_1 = __importDefault(__require("node:https"));
|
|
9604
|
+
var REQUEST_TIMEOUT_MS = 1e4;
|
|
9605
|
+
function fetchRegistryInfo2(url) {
|
|
9606
|
+
return new Promise((resolve3) => {
|
|
9607
|
+
let resolved = false;
|
|
9608
|
+
const safeResolve = (value) => {
|
|
9609
|
+
if (!resolved) {
|
|
9610
|
+
resolved = true;
|
|
9611
|
+
resolve3(value);
|
|
9612
|
+
}
|
|
9613
|
+
};
|
|
9614
|
+
const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
|
|
9615
|
+
if (res.statusCode !== 200) {
|
|
9616
|
+
res.resume();
|
|
9617
|
+
safeResolve(null);
|
|
9618
|
+
return;
|
|
9619
|
+
}
|
|
9620
|
+
let body = "";
|
|
9621
|
+
res.setEncoding("utf8");
|
|
9622
|
+
res.on("data", (chunk) => {
|
|
9623
|
+
body += chunk;
|
|
9624
|
+
});
|
|
9625
|
+
res.on("end", () => {
|
|
9626
|
+
try {
|
|
9627
|
+
const json = JSON.parse(body);
|
|
9628
|
+
const latestVersion = json["dist-tags"]?.latest;
|
|
9629
|
+
if (!latestVersion) {
|
|
9630
|
+
safeResolve(null);
|
|
9631
|
+
return;
|
|
9632
|
+
}
|
|
9633
|
+
const times = json.time ?? {};
|
|
9634
|
+
safeResolve({
|
|
9635
|
+
latest: { version: latestVersion, publishedAt: times[latestVersion] ?? null },
|
|
9636
|
+
times
|
|
9637
|
+
});
|
|
9638
|
+
} catch {
|
|
9639
|
+
safeResolve(null);
|
|
9640
|
+
}
|
|
9641
|
+
});
|
|
9642
|
+
res.on("error", () => safeResolve(null));
|
|
9643
|
+
});
|
|
9644
|
+
req.on("error", () => safeResolve(null));
|
|
9645
|
+
req.on("timeout", () => {
|
|
9646
|
+
req.destroy();
|
|
9647
|
+
safeResolve(null);
|
|
9648
|
+
});
|
|
9649
|
+
});
|
|
9650
|
+
}
|
|
9651
|
+
}
|
|
9652
|
+
});
|
|
9653
|
+
|
|
9654
|
+
// ../update-core/dist/pick-target.js
|
|
9655
|
+
var require_pick_target = __commonJS({
|
|
9656
|
+
"../update-core/dist/pick-target.js"(exports) {
|
|
9657
|
+
"use strict";
|
|
9658
|
+
var __importDefault = exports && exports.__importDefault || function(mod) {
|
|
9659
|
+
return mod && mod.__esModule ? mod : { "default": mod };
|
|
9660
|
+
};
|
|
9661
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9662
|
+
exports.pickInstallableTarget = pickInstallableTarget2;
|
|
9663
|
+
var semver_1 = __importDefault(require_semver2());
|
|
9664
|
+
function isStableUpgrade(version, current) {
|
|
9665
|
+
if (!semver_1.default.valid(version) || semver_1.default.prerelease(version))
|
|
9666
|
+
return false;
|
|
9667
|
+
if (current === null)
|
|
9668
|
+
return true;
|
|
9669
|
+
if (!semver_1.default.valid(current))
|
|
9670
|
+
return false;
|
|
9671
|
+
return semver_1.default.gt(version, current);
|
|
9672
|
+
}
|
|
9673
|
+
function isOldEnough(publishedAt, minReleaseAgeMs) {
|
|
9674
|
+
if (minReleaseAgeMs <= 0)
|
|
9675
|
+
return true;
|
|
9676
|
+
if (!publishedAt)
|
|
9677
|
+
return false;
|
|
9678
|
+
const published = Date.parse(publishedAt);
|
|
9679
|
+
if (Number.isNaN(published))
|
|
9680
|
+
return false;
|
|
9681
|
+
return Date.now() - published >= minReleaseAgeMs;
|
|
9682
|
+
}
|
|
9683
|
+
function pickInstallableTarget2(latest, times, current, minReleaseAgeMs) {
|
|
9684
|
+
if (minReleaseAgeMs <= 0) {
|
|
9685
|
+
return isStableUpgrade(latest.version, current) ? latest : null;
|
|
9686
|
+
}
|
|
9687
|
+
let best = null;
|
|
9688
|
+
for (const [version, publishedAt] of Object.entries(times)) {
|
|
9689
|
+
if (!semver_1.default.valid(version) || semver_1.default.prerelease(version))
|
|
9690
|
+
continue;
|
|
9691
|
+
if (current !== null && !semver_1.default.gt(version, current))
|
|
9692
|
+
continue;
|
|
9693
|
+
if (!isOldEnough(publishedAt, minReleaseAgeMs))
|
|
9694
|
+
continue;
|
|
9695
|
+
if (best === null || semver_1.default.gt(version, best.version)) {
|
|
9696
|
+
best = { version, publishedAt };
|
|
9697
|
+
}
|
|
9698
|
+
}
|
|
9699
|
+
return best;
|
|
9700
|
+
}
|
|
9701
|
+
}
|
|
9702
|
+
});
|
|
9703
|
+
|
|
9704
|
+
// ../update-core/dist/index.js
|
|
9705
|
+
var require_dist2 = __commonJS({
|
|
9706
|
+
"../update-core/dist/index.js"(exports) {
|
|
9707
|
+
"use strict";
|
|
9708
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9709
|
+
exports.pickInstallableTarget = exports.fetchRegistryInfo = exports.detectMinReleaseAgeMsForPm = exports.detectMinReleaseAgeMs = exports.parseYarnAgeGateMs = exports.parseBeforeAgeMs = exports.parseConfigValue = exports.DAY_MS = exports.MINUTE_MS = exports.SECOND_MS = void 0;
|
|
9710
|
+
var config_parse_1 = require_config_parse();
|
|
9711
|
+
Object.defineProperty(exports, "SECOND_MS", { enumerable: true, get: function() {
|
|
9712
|
+
return config_parse_1.SECOND_MS;
|
|
9713
|
+
} });
|
|
9714
|
+
Object.defineProperty(exports, "MINUTE_MS", { enumerable: true, get: function() {
|
|
9715
|
+
return config_parse_1.MINUTE_MS;
|
|
9716
|
+
} });
|
|
9717
|
+
Object.defineProperty(exports, "DAY_MS", { enumerable: true, get: function() {
|
|
9718
|
+
return config_parse_1.DAY_MS;
|
|
9719
|
+
} });
|
|
9720
|
+
Object.defineProperty(exports, "parseConfigValue", { enumerable: true, get: function() {
|
|
9721
|
+
return config_parse_1.parseConfigValue;
|
|
9722
|
+
} });
|
|
9723
|
+
Object.defineProperty(exports, "parseBeforeAgeMs", { enumerable: true, get: function() {
|
|
9724
|
+
return config_parse_1.parseBeforeAgeMs;
|
|
9725
|
+
} });
|
|
9726
|
+
Object.defineProperty(exports, "parseYarnAgeGateMs", { enumerable: true, get: function() {
|
|
9727
|
+
return config_parse_1.parseYarnAgeGateMs;
|
|
9728
|
+
} });
|
|
9729
|
+
var min_release_age_1 = require_min_release_age();
|
|
9730
|
+
Object.defineProperty(exports, "detectMinReleaseAgeMs", { enumerable: true, get: function() {
|
|
9731
|
+
return min_release_age_1.detectMinReleaseAgeMs;
|
|
9732
|
+
} });
|
|
9733
|
+
Object.defineProperty(exports, "detectMinReleaseAgeMsForPm", { enumerable: true, get: function() {
|
|
9734
|
+
return min_release_age_1.detectMinReleaseAgeMsForPm;
|
|
9735
|
+
} });
|
|
9736
|
+
var registry_1 = require_registry();
|
|
9737
|
+
Object.defineProperty(exports, "fetchRegistryInfo", { enumerable: true, get: function() {
|
|
9738
|
+
return registry_1.fetchRegistryInfo;
|
|
9739
|
+
} });
|
|
9740
|
+
var pick_target_1 = require_pick_target();
|
|
9741
|
+
Object.defineProperty(exports, "pickInstallableTarget", { enumerable: true, get: function() {
|
|
9742
|
+
return pick_target_1.pickInstallableTarget;
|
|
9743
|
+
} });
|
|
9744
|
+
}
|
|
9745
|
+
});
|
|
9746
|
+
|
|
9462
9747
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
9463
9748
|
import { styleText as v } from "node:util";
|
|
9464
9749
|
import { stdout as x, stdin as D } from "node:process";
|
|
@@ -12127,12 +12412,12 @@ function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
12127
12412
|
}
|
|
12128
12413
|
return result;
|
|
12129
12414
|
}
|
|
12130
|
-
function findNodeAtLocation(root,
|
|
12415
|
+
function findNodeAtLocation(root, path6) {
|
|
12131
12416
|
if (!root) {
|
|
12132
12417
|
return void 0;
|
|
12133
12418
|
}
|
|
12134
12419
|
let node = root;
|
|
12135
|
-
for (let segment of
|
|
12420
|
+
for (let segment of path6) {
|
|
12136
12421
|
if (typeof segment === "string") {
|
|
12137
12422
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
12138
12423
|
return void 0;
|
|
@@ -12486,14 +12771,14 @@ function getNodeType(value) {
|
|
|
12486
12771
|
|
|
12487
12772
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
12488
12773
|
function setProperty(text, originalPath, value, options) {
|
|
12489
|
-
const
|
|
12774
|
+
const path6 = originalPath.slice();
|
|
12490
12775
|
const errors = [];
|
|
12491
12776
|
const root = parseTree(text, errors);
|
|
12492
12777
|
let parent = void 0;
|
|
12493
12778
|
let lastSegment = void 0;
|
|
12494
|
-
while (
|
|
12495
|
-
lastSegment =
|
|
12496
|
-
parent = findNodeAtLocation(root,
|
|
12779
|
+
while (path6.length > 0) {
|
|
12780
|
+
lastSegment = path6.pop();
|
|
12781
|
+
parent = findNodeAtLocation(root, path6);
|
|
12497
12782
|
if (parent === void 0 && value !== void 0) {
|
|
12498
12783
|
if (typeof lastSegment === "string") {
|
|
12499
12784
|
value = { [lastSegment]: value };
|
|
@@ -12679,8 +12964,8 @@ var ParseErrorCode;
|
|
|
12679
12964
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
12680
12965
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
12681
12966
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
12682
|
-
function modify(text,
|
|
12683
|
-
return setProperty(text,
|
|
12967
|
+
function modify(text, path6, value, options) {
|
|
12968
|
+
return setProperty(text, path6, value, options);
|
|
12684
12969
|
}
|
|
12685
12970
|
function applyEdits(text, edits) {
|
|
12686
12971
|
let sortedEdits = edits.slice(0).sort((a, b2) => {
|
|
@@ -13106,6 +13391,12 @@ var cursorAdapter = {
|
|
|
13106
13391
|
writeJsonOrRemove(configPath, config);
|
|
13107
13392
|
return true;
|
|
13108
13393
|
},
|
|
13394
|
+
hasArgentEntry(configPath) {
|
|
13395
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13396
|
+
const config = readJson(configPath);
|
|
13397
|
+
const servers = config.mcpServers;
|
|
13398
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13399
|
+
},
|
|
13109
13400
|
addAllowlist() {
|
|
13110
13401
|
const permPath = path2.join(homedir2(), ".cursor", "permissions.json");
|
|
13111
13402
|
const config = readJson(permPath);
|
|
@@ -13161,6 +13452,12 @@ var claudeAdapter = {
|
|
|
13161
13452
|
writeJsonOrRemove(configPath, config);
|
|
13162
13453
|
return true;
|
|
13163
13454
|
},
|
|
13455
|
+
hasArgentEntry(configPath) {
|
|
13456
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13457
|
+
const config = readJson(configPath);
|
|
13458
|
+
const servers = config.mcpServers;
|
|
13459
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13460
|
+
},
|
|
13164
13461
|
addAllowlist(root, scope) {
|
|
13165
13462
|
addClaudePermission(root, scope);
|
|
13166
13463
|
},
|
|
@@ -13199,6 +13496,12 @@ var vscodeAdapter = {
|
|
|
13199
13496
|
delete servers[MCP_SERVER_KEY];
|
|
13200
13497
|
writeJsonOrRemove(configPath, config);
|
|
13201
13498
|
return true;
|
|
13499
|
+
},
|
|
13500
|
+
hasArgentEntry(configPath) {
|
|
13501
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13502
|
+
const config = readJson(configPath);
|
|
13503
|
+
const servers = config.servers;
|
|
13504
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13202
13505
|
}
|
|
13203
13506
|
};
|
|
13204
13507
|
var windsurfAdapter = {
|
|
@@ -13232,6 +13535,12 @@ var windsurfAdapter = {
|
|
|
13232
13535
|
writeJsonOrRemove(configPath, config);
|
|
13233
13536
|
return true;
|
|
13234
13537
|
},
|
|
13538
|
+
hasArgentEntry(configPath) {
|
|
13539
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13540
|
+
const config = readJson(configPath);
|
|
13541
|
+
const servers = config.mcpServers;
|
|
13542
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13543
|
+
},
|
|
13235
13544
|
addAllowlist() {
|
|
13236
13545
|
const configPath = path2.join(homedir2(), ".codeium", "windsurf", "mcp_config.json");
|
|
13237
13546
|
const config = readJson(configPath);
|
|
@@ -13284,6 +13593,12 @@ var zedAdapter = {
|
|
|
13284
13593
|
editJsoncFile(configPath, ["context_servers", MCP_SERVER_KEY], void 0);
|
|
13285
13594
|
return true;
|
|
13286
13595
|
},
|
|
13596
|
+
hasArgentEntry(configPath) {
|
|
13597
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13598
|
+
const config = readJsonc(configPath);
|
|
13599
|
+
const servers = config.context_servers;
|
|
13600
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13601
|
+
},
|
|
13287
13602
|
// Zed doesn't support server-level wildcards for MCP tools — each tool
|
|
13288
13603
|
// would need its own entry. Setting the global default to "allow" is the
|
|
13289
13604
|
// documented opt-in; built-in security rules still protect against
|
|
@@ -13332,6 +13647,12 @@ var geminiAdapter = {
|
|
|
13332
13647
|
writeJsonOrRemove(configPath, config);
|
|
13333
13648
|
return true;
|
|
13334
13649
|
},
|
|
13650
|
+
hasArgentEntry(configPath) {
|
|
13651
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13652
|
+
const config = readJson(configPath);
|
|
13653
|
+
const servers = config.mcpServers;
|
|
13654
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13655
|
+
},
|
|
13335
13656
|
addAllowlist(root, scope) {
|
|
13336
13657
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
13337
13658
|
if (!configPath) {
|
|
@@ -13389,6 +13710,12 @@ var codexAdapter = {
|
|
|
13389
13710
|
writeTomlOrRemove(configPath, config);
|
|
13390
13711
|
return true;
|
|
13391
13712
|
},
|
|
13713
|
+
hasArgentEntry(configPath) {
|
|
13714
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13715
|
+
const config = readToml(configPath);
|
|
13716
|
+
const servers = config.mcp_servers;
|
|
13717
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13718
|
+
},
|
|
13392
13719
|
addAllowlist(root, scope) {
|
|
13393
13720
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
13394
13721
|
if (!configPath) {
|
|
@@ -13465,6 +13792,13 @@ var hermesAdapter = {
|
|
|
13465
13792
|
}
|
|
13466
13793
|
writeYaml(configPath, doc);
|
|
13467
13794
|
return true;
|
|
13795
|
+
},
|
|
13796
|
+
hasArgentEntry(configPath) {
|
|
13797
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13798
|
+
const doc = readYaml(configPath);
|
|
13799
|
+
const servers = doc.get("mcp_servers");
|
|
13800
|
+
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
13801
|
+
return servers.has(MCP_SERVER_KEY);
|
|
13468
13802
|
}
|
|
13469
13803
|
};
|
|
13470
13804
|
var OPENCODE_BINARY = "opencode";
|
|
@@ -13514,6 +13848,12 @@ var openCodeAdapter = {
|
|
|
13514
13848
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], void 0);
|
|
13515
13849
|
return true;
|
|
13516
13850
|
},
|
|
13851
|
+
hasArgentEntry(configPath) {
|
|
13852
|
+
if (!fs2.existsSync(configPath)) return false;
|
|
13853
|
+
const config = readJsonc(configPath);
|
|
13854
|
+
const servers = config.mcp;
|
|
13855
|
+
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
13856
|
+
},
|
|
13517
13857
|
addAllowlist(root, scope) {
|
|
13518
13858
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
13519
13859
|
if (!configPath) return;
|
|
@@ -13542,6 +13882,27 @@ var ALL_ADAPTERS = [
|
|
|
13542
13882
|
function detectAdapters() {
|
|
13543
13883
|
return ALL_ADAPTERS.filter((a) => a.detect());
|
|
13544
13884
|
}
|
|
13885
|
+
function findConfiguredAdapterScopes(adapters, projectRoot) {
|
|
13886
|
+
const results = [];
|
|
13887
|
+
const hasEntry = (adapter, configPath) => {
|
|
13888
|
+
try {
|
|
13889
|
+
return adapter.hasArgentEntry(configPath);
|
|
13890
|
+
} catch {
|
|
13891
|
+
return false;
|
|
13892
|
+
}
|
|
13893
|
+
};
|
|
13894
|
+
for (const adapter of adapters) {
|
|
13895
|
+
const projectPath = adapter.projectPath(projectRoot);
|
|
13896
|
+
if (projectPath && hasEntry(adapter, projectPath)) {
|
|
13897
|
+
results.push({ adapter, scope: "project", configPath: projectPath });
|
|
13898
|
+
}
|
|
13899
|
+
const globalPath = adapter.globalPath();
|
|
13900
|
+
if (globalPath && hasEntry(adapter, globalPath)) {
|
|
13901
|
+
results.push({ adapter, scope: "global", configPath: globalPath });
|
|
13902
|
+
}
|
|
13903
|
+
}
|
|
13904
|
+
return results;
|
|
13905
|
+
}
|
|
13545
13906
|
function addClaudePermission(root, scope) {
|
|
13546
13907
|
const settingsPath = scope === "global" ? path2.join(homedir2(), ".claude", "settings.json") : path2.join(root, ".claude", "settings.json");
|
|
13547
13908
|
const config = readJson(settingsPath);
|
|
@@ -14326,8 +14687,24 @@ function runNpxSkills(args, interactive, cwd) {
|
|
|
14326
14687
|
|
|
14327
14688
|
// ../argent-installer/src/update.ts
|
|
14328
14689
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
14690
|
+
var import_semver2 = __toESM(require_semver2(), 1);
|
|
14329
14691
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
14330
14692
|
|
|
14693
|
+
// ../argent-installer/src/update-target.ts
|
|
14694
|
+
var import_update_core = __toESM(require_dist2(), 1);
|
|
14695
|
+
async function resolveInstallableUpdateTarget(pm, current) {
|
|
14696
|
+
const info = await (0, import_update_core.fetchRegistryInfo)(`${NPM_REGISTRY}/${PACKAGE_NAME}`);
|
|
14697
|
+
if (info === null) return null;
|
|
14698
|
+
const minReleaseAgeMs = await (0, import_update_core.detectMinReleaseAgeMsForPm)(pm);
|
|
14699
|
+
const target = (0, import_update_core.pickInstallableTarget)(info.latest, info.times, current, minReleaseAgeMs);
|
|
14700
|
+
return {
|
|
14701
|
+
latestVersion: info.latest.version,
|
|
14702
|
+
latestPublishedAt: info.latest.publishedAt,
|
|
14703
|
+
targetVersion: target?.version ?? null,
|
|
14704
|
+
minReleaseAgeMs
|
|
14705
|
+
};
|
|
14706
|
+
}
|
|
14707
|
+
|
|
14331
14708
|
// ../argent-tools-client/src/launcher.ts
|
|
14332
14709
|
import * as net from "node:net";
|
|
14333
14710
|
import * as fs3 from "node:fs";
|
|
@@ -14335,11 +14712,20 @@ import * as path3 from "node:path";
|
|
|
14335
14712
|
import * as readline from "node:readline";
|
|
14336
14713
|
import { homedir as homedir3 } from "node:os";
|
|
14337
14714
|
import { spawn as spawn2 } from "node:child_process";
|
|
14338
|
-
import {
|
|
14715
|
+
import { randomBytes } from "node:crypto";
|
|
14716
|
+
import { mkdir, writeFile, readFile, unlink, rename, chmod } from "node:fs/promises";
|
|
14339
14717
|
var STATE_DIR = path3.join(homedir3(), ".argent");
|
|
14340
14718
|
var STATE_FILE = path3.join(STATE_DIR, "tool-server.json");
|
|
14341
14719
|
var LOG_FILE = path3.join(STATE_DIR, "tool-server.log");
|
|
14342
|
-
|
|
14720
|
+
function isProcessAlive(pid) {
|
|
14721
|
+
try {
|
|
14722
|
+
process.kill(pid, 0);
|
|
14723
|
+
return true;
|
|
14724
|
+
} catch {
|
|
14725
|
+
return false;
|
|
14726
|
+
}
|
|
14727
|
+
}
|
|
14728
|
+
async function readToolsServerState() {
|
|
14343
14729
|
try {
|
|
14344
14730
|
const raw = await readFile(STATE_FILE, "utf8");
|
|
14345
14731
|
return JSON.parse(raw);
|
|
@@ -14347,25 +14733,75 @@ async function readState() {
|
|
|
14347
14733
|
return null;
|
|
14348
14734
|
}
|
|
14349
14735
|
}
|
|
14350
|
-
async function
|
|
14736
|
+
async function clearToolsServerState() {
|
|
14351
14737
|
try {
|
|
14352
14738
|
await unlink(STATE_FILE);
|
|
14353
14739
|
} catch {
|
|
14354
14740
|
}
|
|
14355
14741
|
}
|
|
14742
|
+
var readState = readToolsServerState;
|
|
14743
|
+
var clearState = clearToolsServerState;
|
|
14744
|
+
var SIGTERM_GRACE_MS = 6e3;
|
|
14745
|
+
var SIGKILL_GRACE_MS = 1e3;
|
|
14746
|
+
var KILL_POLL_MS = 100;
|
|
14747
|
+
async function waitForExit(pid, timeoutMs) {
|
|
14748
|
+
const deadline = Date.now() + timeoutMs;
|
|
14749
|
+
while (Date.now() < deadline) {
|
|
14750
|
+
if (!isProcessAlive(pid)) return true;
|
|
14751
|
+
await new Promise((r) => setTimeout(r, KILL_POLL_MS));
|
|
14752
|
+
}
|
|
14753
|
+
return !isProcessAlive(pid);
|
|
14754
|
+
}
|
|
14356
14755
|
async function killToolServer() {
|
|
14357
14756
|
const state = await readState();
|
|
14358
14757
|
if (!state) return;
|
|
14359
|
-
|
|
14360
|
-
|
|
14361
|
-
|
|
14758
|
+
let exited = !isProcessAlive(state.pid);
|
|
14759
|
+
if (!exited) {
|
|
14760
|
+
try {
|
|
14761
|
+
process.kill(state.pid, "SIGTERM");
|
|
14762
|
+
} catch {
|
|
14763
|
+
exited = true;
|
|
14764
|
+
}
|
|
14765
|
+
}
|
|
14766
|
+
if (!exited) {
|
|
14767
|
+
exited = await waitForExit(state.pid, SIGTERM_GRACE_MS);
|
|
14768
|
+
}
|
|
14769
|
+
if (!exited) {
|
|
14770
|
+
try {
|
|
14771
|
+
process.kill(state.pid, "SIGKILL");
|
|
14772
|
+
} catch {
|
|
14773
|
+
exited = true;
|
|
14774
|
+
}
|
|
14775
|
+
if (!exited) {
|
|
14776
|
+
await waitForExit(state.pid, SIGKILL_GRACE_MS);
|
|
14777
|
+
}
|
|
14362
14778
|
}
|
|
14363
14779
|
await clearState();
|
|
14364
14780
|
}
|
|
14365
14781
|
|
|
14782
|
+
// ../argent-tools-client/src/link-config.ts
|
|
14783
|
+
import * as path4 from "node:path";
|
|
14784
|
+
import { homedir as homedir4 } from "node:os";
|
|
14785
|
+
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
14786
|
+
var LINK_DIR = path4.join(homedir4(), ".argent");
|
|
14787
|
+
var LINK_FILE = path4.join(LINK_DIR, "link.json");
|
|
14788
|
+
|
|
14366
14789
|
// ../argent-installer/src/update.ts
|
|
14790
|
+
function getRequestedVersion(args) {
|
|
14791
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
14792
|
+
const arg = args[i];
|
|
14793
|
+
if (arg === "--version") {
|
|
14794
|
+
return args[i + 1] ?? null;
|
|
14795
|
+
}
|
|
14796
|
+
if (arg?.startsWith("--version=")) {
|
|
14797
|
+
return arg.slice("--version=".length) || null;
|
|
14798
|
+
}
|
|
14799
|
+
}
|
|
14800
|
+
return null;
|
|
14801
|
+
}
|
|
14367
14802
|
async function update(args) {
|
|
14368
14803
|
const nonInteractive = args.includes("--yes") || args.includes("-y");
|
|
14804
|
+
const requestedVersion = getRequestedVersion(args);
|
|
14369
14805
|
ge(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" argent update ")));
|
|
14370
14806
|
const globallyInstalled = isGloballyInstalled();
|
|
14371
14807
|
const installed = globallyInstalled ? getGloballyInstalledVersion() : null;
|
|
@@ -14375,13 +14811,34 @@ async function update(args) {
|
|
|
14375
14811
|
}
|
|
14376
14812
|
const spinner = ft();
|
|
14377
14813
|
spinner.start("Checking for updates...");
|
|
14378
|
-
|
|
14379
|
-
|
|
14380
|
-
|
|
14381
|
-
|
|
14382
|
-
|
|
14383
|
-
|
|
14384
|
-
|
|
14814
|
+
const pm = detectPackageManager();
|
|
14815
|
+
let latest = null;
|
|
14816
|
+
let target = null;
|
|
14817
|
+
let minReleaseAgeMs = 0;
|
|
14818
|
+
if (requestedVersion !== null) {
|
|
14819
|
+
if (!import_semver2.default.valid(requestedVersion) || import_semver2.default.prerelease(requestedVersion)) {
|
|
14820
|
+
spinner.stop(import_picocolors3.default.red("Invalid update target."));
|
|
14821
|
+
R2.error(`Requested version is not a stable semver: ${requestedVersion}`);
|
|
14822
|
+
process.exit(1);
|
|
14823
|
+
}
|
|
14824
|
+
target = requestedVersion;
|
|
14825
|
+
} else {
|
|
14826
|
+
let resolved;
|
|
14827
|
+
try {
|
|
14828
|
+
resolved = await resolveInstallableUpdateTarget(pm, installed);
|
|
14829
|
+
} catch (err) {
|
|
14830
|
+
spinner.stop(import_picocolors3.default.red("Could not reach registry."));
|
|
14831
|
+
R2.error(`Failed to check registry: ${err}`);
|
|
14832
|
+
process.exit(1);
|
|
14833
|
+
}
|
|
14834
|
+
if (resolved === null) {
|
|
14835
|
+
spinner.stop(import_picocolors3.default.red("Could not reach registry."));
|
|
14836
|
+
R2.error("Failed to determine the latest Argent release from the registry.");
|
|
14837
|
+
process.exit(1);
|
|
14838
|
+
}
|
|
14839
|
+
latest = resolved.latestVersion;
|
|
14840
|
+
target = resolved.targetVersion;
|
|
14841
|
+
minReleaseAgeMs = resolved.minReleaseAgeMs;
|
|
14385
14842
|
}
|
|
14386
14843
|
spinner.stop("Version check complete.");
|
|
14387
14844
|
if (installed) {
|
|
@@ -14389,19 +14846,26 @@ async function update(args) {
|
|
|
14389
14846
|
} else {
|
|
14390
14847
|
R2.warn(`${PACKAGE_NAME} is not installed globally.`);
|
|
14391
14848
|
}
|
|
14392
|
-
|
|
14393
|
-
|
|
14394
|
-
|
|
14849
|
+
if (latest) {
|
|
14850
|
+
R2.info(`Latest: ${import_picocolors3.default.cyan(`v${latest}`)}`);
|
|
14851
|
+
}
|
|
14852
|
+
if (target) {
|
|
14853
|
+
const label = latest && latest !== target ? "Target: " : "Version: ";
|
|
14854
|
+
const suffix = latest && latest !== target ? import_picocolors3.default.dim(" (newest installable)") : "";
|
|
14855
|
+
R2.info(`${label}${import_picocolors3.default.cyan(`v${target}`)}${suffix}`);
|
|
14856
|
+
}
|
|
14857
|
+
const needsInstall = target !== null && (!installed || isNewerVersion(target, installed));
|
|
14858
|
+
const latestIsNewer = latest !== null && (!installed || isNewerVersion(latest, installed));
|
|
14859
|
+
if (needsInstall && target !== null) {
|
|
14395
14860
|
if (installed) {
|
|
14396
|
-
R2.warn(`Update available: ${import_picocolors3.default.yellow(`v${installed}`)} -> ${import_picocolors3.default.green(`v${
|
|
14861
|
+
R2.warn(`Update available: ${import_picocolors3.default.yellow(`v${installed}`)} -> ${import_picocolors3.default.green(`v${target}`)}`);
|
|
14397
14862
|
}
|
|
14398
|
-
const
|
|
14399
|
-
const cmd = globalInstallCommand(pm, `${PACKAGE_NAME}@${latest}`);
|
|
14863
|
+
const cmd = globalInstallCommand(pm, `${PACKAGE_NAME}@${target}`);
|
|
14400
14864
|
const cmdStr = formatShellCommand(cmd);
|
|
14401
14865
|
if (!nonInteractive) {
|
|
14402
14866
|
R2.message(import_picocolors3.default.dim(" Press y for yes, n for no, enter to confirm."));
|
|
14403
14867
|
const proceed = await ue({
|
|
14404
|
-
message: installed ? `Update to v${
|
|
14868
|
+
message: installed ? `Update to v${target}?` : `Install ${PACKAGE_NAME}@${target} globally?`,
|
|
14405
14869
|
initialValue: true
|
|
14406
14870
|
});
|
|
14407
14871
|
if (q(proceed) || !proceed) {
|
|
@@ -14421,36 +14885,48 @@ async function update(args) {
|
|
|
14421
14885
|
process.exit(1);
|
|
14422
14886
|
}
|
|
14423
14887
|
} else {
|
|
14424
|
-
|
|
14888
|
+
if (latest && target === null && latestIsNewer && minReleaseAgeMs > 0) {
|
|
14889
|
+
R2.warn(
|
|
14890
|
+
`Latest version ${import_picocolors3.default.cyan(`v${latest}`)} is still held by your minimum-release-age policy.`
|
|
14891
|
+
);
|
|
14892
|
+
R2.info("No installable update is available yet.");
|
|
14893
|
+
} else if (latest && target && latest !== target) {
|
|
14894
|
+
R2.success("Already on the latest installable version.");
|
|
14895
|
+
} else {
|
|
14896
|
+
R2.success("Already on the latest version.");
|
|
14897
|
+
}
|
|
14425
14898
|
}
|
|
14426
14899
|
spinner.start("Refreshing workspace configuration...");
|
|
14427
14900
|
const projectRoot = resolveProjectRoot(process.cwd());
|
|
14428
|
-
const detected = detectAdapters();
|
|
14429
14901
|
const mcpEntry = getMcpEntry();
|
|
14430
14902
|
const results = [];
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
}
|
|
14903
|
+
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
|
|
14904
|
+
const adaptersByScope = /* @__PURE__ */ new Map([
|
|
14905
|
+
["local", /* @__PURE__ */ new Set()],
|
|
14906
|
+
["global", /* @__PURE__ */ new Set()]
|
|
14907
|
+
]);
|
|
14908
|
+
for (const { adapter, scope, configPath } of configuredScopes) {
|
|
14909
|
+
try {
|
|
14910
|
+
adapter.write(configPath, mcpEntry);
|
|
14911
|
+
results.push(`${import_picocolors3.default.green("+")} ${adapter.name} ${import_picocolors3.default.dim(configPath)}`);
|
|
14912
|
+
} catch {
|
|
14440
14913
|
}
|
|
14914
|
+
adaptersByScope.get(scope === "project" ? "local" : "global").add(adapter);
|
|
14441
14915
|
}
|
|
14442
|
-
for (const
|
|
14443
|
-
|
|
14444
|
-
|
|
14916
|
+
for (const [scope, adapters] of adaptersByScope) {
|
|
14917
|
+
for (const adapter of adapters) {
|
|
14918
|
+
if (!adapter.addAllowlist) continue;
|
|
14445
14919
|
try {
|
|
14446
|
-
adapter.addAllowlist(projectRoot,
|
|
14920
|
+
adapter.addAllowlist(projectRoot, scope);
|
|
14447
14921
|
} catch {
|
|
14448
14922
|
}
|
|
14449
14923
|
}
|
|
14450
14924
|
}
|
|
14925
|
+
const localAdapters = [...adaptersByScope.get("local")];
|
|
14926
|
+
const globalAdapters = [...adaptersByScope.get("global")];
|
|
14451
14927
|
const ruleResults = [
|
|
14452
|
-
...copyRulesAndAgents(
|
|
14453
|
-
...copyRulesAndAgents(
|
|
14928
|
+
...copyRulesAndAgents(globalAdapters, projectRoot, "global", RULES_DIR, AGENTS_DIR),
|
|
14929
|
+
...copyRulesAndAgents(localAdapters, projectRoot, "local", RULES_DIR, AGENTS_DIR)
|
|
14454
14930
|
];
|
|
14455
14931
|
spinner.stop("Configuration refreshed.");
|
|
14456
14932
|
if (results.length > 0) {
|
|
@@ -14469,7 +14945,7 @@ async function update(args) {
|
|
|
14469
14945
|
// ../argent-installer/src/uninstall.ts
|
|
14470
14946
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
14471
14947
|
import * as fs4 from "node:fs";
|
|
14472
|
-
import * as
|
|
14948
|
+
import * as path5 from "node:path";
|
|
14473
14949
|
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
14474
14950
|
function removeDirIfEmpty2(dirPath) {
|
|
14475
14951
|
try {
|
|
@@ -14487,8 +14963,8 @@ function collectBundledPaths(sourceDir) {
|
|
|
14487
14963
|
const directories = [];
|
|
14488
14964
|
function walk(currentDir, relativeDir = "") {
|
|
14489
14965
|
for (const entry of fs4.readdirSync(currentDir, { withFileTypes: true })) {
|
|
14490
|
-
const relativePath = relativeDir ?
|
|
14491
|
-
const absolutePath =
|
|
14966
|
+
const relativePath = relativeDir ? path5.join(relativeDir, entry.name) : entry.name;
|
|
14967
|
+
const absolutePath = path5.join(currentDir, entry.name);
|
|
14492
14968
|
if (entry.isDirectory()) {
|
|
14493
14969
|
walk(absolutePath, relativePath);
|
|
14494
14970
|
directories.push(relativePath);
|
|
@@ -14507,7 +14983,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
14507
14983
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
14508
14984
|
const removedPaths = [];
|
|
14509
14985
|
for (const relativePath of files) {
|
|
14510
|
-
const targetPath =
|
|
14986
|
+
const targetPath = path5.join(targetDir, relativePath);
|
|
14511
14987
|
try {
|
|
14512
14988
|
if (!fs4.existsSync(targetPath)) continue;
|
|
14513
14989
|
if (fs4.lstatSync(targetPath).isDirectory()) continue;
|
|
@@ -14517,10 +14993,10 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
14517
14993
|
}
|
|
14518
14994
|
}
|
|
14519
14995
|
directories.sort(
|
|
14520
|
-
(a, b2) => b2.split(
|
|
14996
|
+
(a, b2) => b2.split(path5.sep).length - a.split(path5.sep).length || b2.length - a.length
|
|
14521
14997
|
);
|
|
14522
14998
|
for (const relativePath of directories) {
|
|
14523
|
-
const targetPath =
|
|
14999
|
+
const targetPath = path5.join(targetDir, relativePath);
|
|
14524
15000
|
try {
|
|
14525
15001
|
if (!fs4.existsSync(targetPath)) continue;
|
|
14526
15002
|
if (!fs4.statSync(targetPath).isDirectory()) continue;
|
|
@@ -14540,7 +15016,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
14540
15016
|
} catch {
|
|
14541
15017
|
}
|
|
14542
15018
|
if (removedRoot) {
|
|
14543
|
-
removeDirIfEmpty2(
|
|
15019
|
+
removeDirIfEmpty2(path5.dirname(targetDir));
|
|
14544
15020
|
}
|
|
14545
15021
|
return { removedPaths, removedRoot };
|
|
14546
15022
|
}
|
|
@@ -14559,7 +15035,7 @@ function getBundledSkillNames(skillsDir) {
|
|
|
14559
15035
|
const skillNames = [];
|
|
14560
15036
|
for (const entry of fs4.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
14561
15037
|
if (!entry.isDirectory()) continue;
|
|
14562
|
-
const skillFilePath =
|
|
15038
|
+
const skillFilePath = path5.join(skillsDir, entry.name, "SKILL.md");
|
|
14563
15039
|
if (!fs4.existsSync(skillFilePath)) continue;
|
|
14564
15040
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
14565
15041
|
}
|
|
@@ -14571,7 +15047,7 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
14571
15047
|
}
|
|
14572
15048
|
const removedPaths = [];
|
|
14573
15049
|
for (const skillName of skillNames) {
|
|
14574
|
-
const targetPath =
|
|
15050
|
+
const targetPath = path5.join(targetDir, skillName);
|
|
14575
15051
|
try {
|
|
14576
15052
|
if (!fs4.existsSync(targetPath)) continue;
|
|
14577
15053
|
const stats = fs4.lstatSync(targetPath);
|
|
@@ -14586,7 +15062,7 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
14586
15062
|
}
|
|
14587
15063
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
14588
15064
|
if (removedRoot) {
|
|
14589
|
-
removeDirIfEmpty2(
|
|
15065
|
+
removeDirIfEmpty2(path5.dirname(targetDir));
|
|
14590
15066
|
}
|
|
14591
15067
|
return { removedPaths, removedRoot };
|
|
14592
15068
|
}
|