@swmansion/argent 0.13.1-next.1 → 0.13.1-next.2
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/dist/cli-cmds.mjs +1165 -209
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +4 -0
- package/dist/cli.js.map +1 -1
- package/dist/installer.mjs +441 -433
- package/dist/mcp-server.mjs +90 -89
- package/dist/preview-ui/index.html +746 -47
- package/dist/preview-ui/theme.css +1 -0
- package/dist/preview-window/main.cjs +4 -2
- package/dist/tool-server.cjs +1087 -753
- package/package.json +3 -2
- package/scripts/postinstall.cjs +22 -0
package/dist/installer.mjs
CHANGED
|
@@ -2238,17 +2238,17 @@ var require_visit = __commonJS({
|
|
|
2238
2238
|
visit2.BREAK = BREAK;
|
|
2239
2239
|
visit2.SKIP = SKIP;
|
|
2240
2240
|
visit2.REMOVE = REMOVE;
|
|
2241
|
-
function visit_(key, node, visitor,
|
|
2242
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
2241
|
+
function visit_(key, node, visitor, path12) {
|
|
2242
|
+
const ctrl = callVisitor(key, node, visitor, path12);
|
|
2243
2243
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2244
|
-
replaceNode(key,
|
|
2245
|
-
return visit_(key, ctrl, visitor,
|
|
2244
|
+
replaceNode(key, path12, ctrl);
|
|
2245
|
+
return visit_(key, ctrl, visitor, path12);
|
|
2246
2246
|
}
|
|
2247
2247
|
if (typeof ctrl !== "symbol") {
|
|
2248
2248
|
if (identity.isCollection(node)) {
|
|
2249
|
-
|
|
2249
|
+
path12 = Object.freeze(path12.concat(node));
|
|
2250
2250
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
2251
|
-
const ci = visit_(i2, node.items[i2], visitor,
|
|
2251
|
+
const ci = visit_(i2, node.items[i2], visitor, path12);
|
|
2252
2252
|
if (typeof ci === "number")
|
|
2253
2253
|
i2 = ci - 1;
|
|
2254
2254
|
else if (ci === BREAK)
|
|
@@ -2259,13 +2259,13 @@ var require_visit = __commonJS({
|
|
|
2259
2259
|
}
|
|
2260
2260
|
}
|
|
2261
2261
|
} else if (identity.isPair(node)) {
|
|
2262
|
-
|
|
2263
|
-
const ck = visit_("key", node.key, visitor,
|
|
2262
|
+
path12 = Object.freeze(path12.concat(node));
|
|
2263
|
+
const ck = visit_("key", node.key, visitor, path12);
|
|
2264
2264
|
if (ck === BREAK)
|
|
2265
2265
|
return BREAK;
|
|
2266
2266
|
else if (ck === REMOVE)
|
|
2267
2267
|
node.key = null;
|
|
2268
|
-
const cv = visit_("value", node.value, visitor,
|
|
2268
|
+
const cv = visit_("value", node.value, visitor, path12);
|
|
2269
2269
|
if (cv === BREAK)
|
|
2270
2270
|
return BREAK;
|
|
2271
2271
|
else if (cv === REMOVE)
|
|
@@ -2286,17 +2286,17 @@ var require_visit = __commonJS({
|
|
|
2286
2286
|
visitAsync.BREAK = BREAK;
|
|
2287
2287
|
visitAsync.SKIP = SKIP;
|
|
2288
2288
|
visitAsync.REMOVE = REMOVE;
|
|
2289
|
-
async function visitAsync_(key, node, visitor,
|
|
2290
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
2289
|
+
async function visitAsync_(key, node, visitor, path12) {
|
|
2290
|
+
const ctrl = await callVisitor(key, node, visitor, path12);
|
|
2291
2291
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2292
|
-
replaceNode(key,
|
|
2293
|
-
return visitAsync_(key, ctrl, visitor,
|
|
2292
|
+
replaceNode(key, path12, ctrl);
|
|
2293
|
+
return visitAsync_(key, ctrl, visitor, path12);
|
|
2294
2294
|
}
|
|
2295
2295
|
if (typeof ctrl !== "symbol") {
|
|
2296
2296
|
if (identity.isCollection(node)) {
|
|
2297
|
-
|
|
2297
|
+
path12 = Object.freeze(path12.concat(node));
|
|
2298
2298
|
for (let i2 = 0; i2 < node.items.length; ++i2) {
|
|
2299
|
-
const ci = await visitAsync_(i2, node.items[i2], visitor,
|
|
2299
|
+
const ci = await visitAsync_(i2, node.items[i2], visitor, path12);
|
|
2300
2300
|
if (typeof ci === "number")
|
|
2301
2301
|
i2 = ci - 1;
|
|
2302
2302
|
else if (ci === BREAK)
|
|
@@ -2307,13 +2307,13 @@ var require_visit = __commonJS({
|
|
|
2307
2307
|
}
|
|
2308
2308
|
}
|
|
2309
2309
|
} else if (identity.isPair(node)) {
|
|
2310
|
-
|
|
2311
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
2310
|
+
path12 = Object.freeze(path12.concat(node));
|
|
2311
|
+
const ck = await visitAsync_("key", node.key, visitor, path12);
|
|
2312
2312
|
if (ck === BREAK)
|
|
2313
2313
|
return BREAK;
|
|
2314
2314
|
else if (ck === REMOVE)
|
|
2315
2315
|
node.key = null;
|
|
2316
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
2316
|
+
const cv = await visitAsync_("value", node.value, visitor, path12);
|
|
2317
2317
|
if (cv === BREAK)
|
|
2318
2318
|
return BREAK;
|
|
2319
2319
|
else if (cv === REMOVE)
|
|
@@ -2340,23 +2340,23 @@ var require_visit = __commonJS({
|
|
|
2340
2340
|
}
|
|
2341
2341
|
return visitor;
|
|
2342
2342
|
}
|
|
2343
|
-
function callVisitor(key, node, visitor,
|
|
2343
|
+
function callVisitor(key, node, visitor, path12) {
|
|
2344
2344
|
if (typeof visitor === "function")
|
|
2345
|
-
return visitor(key, node,
|
|
2345
|
+
return visitor(key, node, path12);
|
|
2346
2346
|
if (identity.isMap(node))
|
|
2347
|
-
return visitor.Map?.(key, node,
|
|
2347
|
+
return visitor.Map?.(key, node, path12);
|
|
2348
2348
|
if (identity.isSeq(node))
|
|
2349
|
-
return visitor.Seq?.(key, node,
|
|
2349
|
+
return visitor.Seq?.(key, node, path12);
|
|
2350
2350
|
if (identity.isPair(node))
|
|
2351
|
-
return visitor.Pair?.(key, node,
|
|
2351
|
+
return visitor.Pair?.(key, node, path12);
|
|
2352
2352
|
if (identity.isScalar(node))
|
|
2353
|
-
return visitor.Scalar?.(key, node,
|
|
2353
|
+
return visitor.Scalar?.(key, node, path12);
|
|
2354
2354
|
if (identity.isAlias(node))
|
|
2355
|
-
return visitor.Alias?.(key, node,
|
|
2355
|
+
return visitor.Alias?.(key, node, path12);
|
|
2356
2356
|
return void 0;
|
|
2357
2357
|
}
|
|
2358
|
-
function replaceNode(key,
|
|
2359
|
-
const parent =
|
|
2358
|
+
function replaceNode(key, path12, node) {
|
|
2359
|
+
const parent = path12[path12.length - 1];
|
|
2360
2360
|
if (identity.isCollection(parent)) {
|
|
2361
2361
|
parent.items[key] = node;
|
|
2362
2362
|
} else if (identity.isPair(parent)) {
|
|
@@ -2966,10 +2966,10 @@ var require_Collection = __commonJS({
|
|
|
2966
2966
|
var createNode = require_createNode();
|
|
2967
2967
|
var identity = require_identity();
|
|
2968
2968
|
var Node = require_Node();
|
|
2969
|
-
function collectionFromPath(schema,
|
|
2969
|
+
function collectionFromPath(schema, path12, value) {
|
|
2970
2970
|
let v = value;
|
|
2971
|
-
for (let i2 =
|
|
2972
|
-
const k =
|
|
2971
|
+
for (let i2 = path12.length - 1; i2 >= 0; --i2) {
|
|
2972
|
+
const k = path12[i2];
|
|
2973
2973
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2974
2974
|
const a3 = [];
|
|
2975
2975
|
a3[k] = v;
|
|
@@ -2988,7 +2988,7 @@ var require_Collection = __commonJS({
|
|
|
2988
2988
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2989
2989
|
});
|
|
2990
2990
|
}
|
|
2991
|
-
var isEmptyPath = (
|
|
2991
|
+
var isEmptyPath = (path12) => path12 == null || typeof path12 === "object" && !!path12[Symbol.iterator]().next().done;
|
|
2992
2992
|
var Collection = class extends Node.NodeBase {
|
|
2993
2993
|
constructor(type, schema) {
|
|
2994
2994
|
super(type);
|
|
@@ -3018,11 +3018,11 @@ var require_Collection = __commonJS({
|
|
|
3018
3018
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
3019
3019
|
* that already exists in the map.
|
|
3020
3020
|
*/
|
|
3021
|
-
addIn(
|
|
3022
|
-
if (isEmptyPath(
|
|
3021
|
+
addIn(path12, value) {
|
|
3022
|
+
if (isEmptyPath(path12))
|
|
3023
3023
|
this.add(value);
|
|
3024
3024
|
else {
|
|
3025
|
-
const [key, ...rest] =
|
|
3025
|
+
const [key, ...rest] = path12;
|
|
3026
3026
|
const node = this.get(key, true);
|
|
3027
3027
|
if (identity.isCollection(node))
|
|
3028
3028
|
node.addIn(rest, value);
|
|
@@ -3036,8 +3036,8 @@ var require_Collection = __commonJS({
|
|
|
3036
3036
|
* Removes a value from the collection.
|
|
3037
3037
|
* @returns `true` if the item was found and removed.
|
|
3038
3038
|
*/
|
|
3039
|
-
deleteIn(
|
|
3040
|
-
const [key, ...rest] =
|
|
3039
|
+
deleteIn(path12) {
|
|
3040
|
+
const [key, ...rest] = path12;
|
|
3041
3041
|
if (rest.length === 0)
|
|
3042
3042
|
return this.delete(key);
|
|
3043
3043
|
const node = this.get(key, true);
|
|
@@ -3051,8 +3051,8 @@ var require_Collection = __commonJS({
|
|
|
3051
3051
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3052
3052
|
* `true` (collections are always returned intact).
|
|
3053
3053
|
*/
|
|
3054
|
-
getIn(
|
|
3055
|
-
const [key, ...rest] =
|
|
3054
|
+
getIn(path12, keepScalar) {
|
|
3055
|
+
const [key, ...rest] = path12;
|
|
3056
3056
|
const node = this.get(key, true);
|
|
3057
3057
|
if (rest.length === 0)
|
|
3058
3058
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -3070,8 +3070,8 @@ var require_Collection = __commonJS({
|
|
|
3070
3070
|
/**
|
|
3071
3071
|
* Checks if the collection includes a value with the key `key`.
|
|
3072
3072
|
*/
|
|
3073
|
-
hasIn(
|
|
3074
|
-
const [key, ...rest] =
|
|
3073
|
+
hasIn(path12) {
|
|
3074
|
+
const [key, ...rest] = path12;
|
|
3075
3075
|
if (rest.length === 0)
|
|
3076
3076
|
return this.has(key);
|
|
3077
3077
|
const node = this.get(key, true);
|
|
@@ -3081,8 +3081,8 @@ var require_Collection = __commonJS({
|
|
|
3081
3081
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
3082
3082
|
* boolean to add/remove the item from the set.
|
|
3083
3083
|
*/
|
|
3084
|
-
setIn(
|
|
3085
|
-
const [key, ...rest] =
|
|
3084
|
+
setIn(path12, value) {
|
|
3085
|
+
const [key, ...rest] = path12;
|
|
3086
3086
|
if (rest.length === 0) {
|
|
3087
3087
|
this.set(key, value);
|
|
3088
3088
|
} else {
|
|
@@ -5597,9 +5597,9 @@ var require_Document = __commonJS({
|
|
|
5597
5597
|
this.contents.add(value);
|
|
5598
5598
|
}
|
|
5599
5599
|
/** Adds a value to the document. */
|
|
5600
|
-
addIn(
|
|
5600
|
+
addIn(path12, value) {
|
|
5601
5601
|
if (assertCollection(this.contents))
|
|
5602
|
-
this.contents.addIn(
|
|
5602
|
+
this.contents.addIn(path12, value);
|
|
5603
5603
|
}
|
|
5604
5604
|
/**
|
|
5605
5605
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5674,14 +5674,14 @@ var require_Document = __commonJS({
|
|
|
5674
5674
|
* Removes a value from the document.
|
|
5675
5675
|
* @returns `true` if the item was found and removed.
|
|
5676
5676
|
*/
|
|
5677
|
-
deleteIn(
|
|
5678
|
-
if (Collection.isEmptyPath(
|
|
5677
|
+
deleteIn(path12) {
|
|
5678
|
+
if (Collection.isEmptyPath(path12)) {
|
|
5679
5679
|
if (this.contents == null)
|
|
5680
5680
|
return false;
|
|
5681
5681
|
this.contents = null;
|
|
5682
5682
|
return true;
|
|
5683
5683
|
}
|
|
5684
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5684
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path12) : false;
|
|
5685
5685
|
}
|
|
5686
5686
|
/**
|
|
5687
5687
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5696,10 +5696,10 @@ var require_Document = __commonJS({
|
|
|
5696
5696
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5697
5697
|
* `true` (collections are always returned intact).
|
|
5698
5698
|
*/
|
|
5699
|
-
getIn(
|
|
5700
|
-
if (Collection.isEmptyPath(
|
|
5699
|
+
getIn(path12, keepScalar) {
|
|
5700
|
+
if (Collection.isEmptyPath(path12))
|
|
5701
5701
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5702
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5702
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path12, keepScalar) : void 0;
|
|
5703
5703
|
}
|
|
5704
5704
|
/**
|
|
5705
5705
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5710,10 +5710,10 @@ var require_Document = __commonJS({
|
|
|
5710
5710
|
/**
|
|
5711
5711
|
* Checks if the document includes a value at `path`.
|
|
5712
5712
|
*/
|
|
5713
|
-
hasIn(
|
|
5714
|
-
if (Collection.isEmptyPath(
|
|
5713
|
+
hasIn(path12) {
|
|
5714
|
+
if (Collection.isEmptyPath(path12))
|
|
5715
5715
|
return this.contents !== void 0;
|
|
5716
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5716
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path12) : false;
|
|
5717
5717
|
}
|
|
5718
5718
|
/**
|
|
5719
5719
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5730,13 +5730,13 @@ var require_Document = __commonJS({
|
|
|
5730
5730
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5731
5731
|
* boolean to add/remove the item from the set.
|
|
5732
5732
|
*/
|
|
5733
|
-
setIn(
|
|
5734
|
-
if (Collection.isEmptyPath(
|
|
5733
|
+
setIn(path12, value) {
|
|
5734
|
+
if (Collection.isEmptyPath(path12)) {
|
|
5735
5735
|
this.contents = value;
|
|
5736
5736
|
} else if (this.contents == null) {
|
|
5737
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5737
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path12), value);
|
|
5738
5738
|
} else if (assertCollection(this.contents)) {
|
|
5739
|
-
this.contents.setIn(
|
|
5739
|
+
this.contents.setIn(path12, value);
|
|
5740
5740
|
}
|
|
5741
5741
|
}
|
|
5742
5742
|
/**
|
|
@@ -7696,9 +7696,9 @@ var require_cst_visit = __commonJS({
|
|
|
7696
7696
|
visit2.BREAK = BREAK;
|
|
7697
7697
|
visit2.SKIP = SKIP;
|
|
7698
7698
|
visit2.REMOVE = REMOVE;
|
|
7699
|
-
visit2.itemAtPath = (cst,
|
|
7699
|
+
visit2.itemAtPath = (cst, path12) => {
|
|
7700
7700
|
let item = cst;
|
|
7701
|
-
for (const [field, index] of
|
|
7701
|
+
for (const [field, index] of path12) {
|
|
7702
7702
|
const tok = item?.[field];
|
|
7703
7703
|
if (tok && "items" in tok) {
|
|
7704
7704
|
item = tok.items[index];
|
|
@@ -7707,23 +7707,23 @@ var require_cst_visit = __commonJS({
|
|
|
7707
7707
|
}
|
|
7708
7708
|
return item;
|
|
7709
7709
|
};
|
|
7710
|
-
visit2.parentCollection = (cst,
|
|
7711
|
-
const parent = visit2.itemAtPath(cst,
|
|
7712
|
-
const field =
|
|
7710
|
+
visit2.parentCollection = (cst, path12) => {
|
|
7711
|
+
const parent = visit2.itemAtPath(cst, path12.slice(0, -1));
|
|
7712
|
+
const field = path12[path12.length - 1][0];
|
|
7713
7713
|
const coll = parent?.[field];
|
|
7714
7714
|
if (coll && "items" in coll)
|
|
7715
7715
|
return coll;
|
|
7716
7716
|
throw new Error("Parent collection not found");
|
|
7717
7717
|
};
|
|
7718
|
-
function _visit(
|
|
7719
|
-
let ctrl = visitor(item,
|
|
7718
|
+
function _visit(path12, item, visitor) {
|
|
7719
|
+
let ctrl = visitor(item, path12);
|
|
7720
7720
|
if (typeof ctrl === "symbol")
|
|
7721
7721
|
return ctrl;
|
|
7722
7722
|
for (const field of ["key", "value"]) {
|
|
7723
7723
|
const token = item[field];
|
|
7724
7724
|
if (token && "items" in token) {
|
|
7725
7725
|
for (let i2 = 0; i2 < token.items.length; ++i2) {
|
|
7726
|
-
const ci = _visit(Object.freeze(
|
|
7726
|
+
const ci = _visit(Object.freeze(path12.concat([[field, i2]])), token.items[i2], visitor);
|
|
7727
7727
|
if (typeof ci === "number")
|
|
7728
7728
|
i2 = ci - 1;
|
|
7729
7729
|
else if (ci === BREAK)
|
|
@@ -7734,10 +7734,10 @@ var require_cst_visit = __commonJS({
|
|
|
7734
7734
|
}
|
|
7735
7735
|
}
|
|
7736
7736
|
if (typeof ctrl === "function" && field === "key")
|
|
7737
|
-
ctrl = ctrl(item,
|
|
7737
|
+
ctrl = ctrl(item, path12);
|
|
7738
7738
|
}
|
|
7739
7739
|
}
|
|
7740
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7740
|
+
return typeof ctrl === "function" ? ctrl(item, path12) : ctrl;
|
|
7741
7741
|
}
|
|
7742
7742
|
exports.visit = visit2;
|
|
7743
7743
|
}
|
|
@@ -9039,14 +9039,14 @@ var require_parser = __commonJS({
|
|
|
9039
9039
|
case "scalar":
|
|
9040
9040
|
case "single-quoted-scalar":
|
|
9041
9041
|
case "double-quoted-scalar": {
|
|
9042
|
-
const
|
|
9042
|
+
const fs10 = this.flowScalar(this.type);
|
|
9043
9043
|
if (atNextItem || it.value) {
|
|
9044
|
-
map.items.push({ start, key:
|
|
9044
|
+
map.items.push({ start, key: fs10, sep: [] });
|
|
9045
9045
|
this.onKeyLine = true;
|
|
9046
9046
|
} else if (it.sep) {
|
|
9047
|
-
this.stack.push(
|
|
9047
|
+
this.stack.push(fs10);
|
|
9048
9048
|
} else {
|
|
9049
|
-
Object.assign(it, { key:
|
|
9049
|
+
Object.assign(it, { key: fs10, sep: [] });
|
|
9050
9050
|
this.onKeyLine = true;
|
|
9051
9051
|
}
|
|
9052
9052
|
return;
|
|
@@ -9174,13 +9174,13 @@ var require_parser = __commonJS({
|
|
|
9174
9174
|
case "scalar":
|
|
9175
9175
|
case "single-quoted-scalar":
|
|
9176
9176
|
case "double-quoted-scalar": {
|
|
9177
|
-
const
|
|
9177
|
+
const fs10 = this.flowScalar(this.type);
|
|
9178
9178
|
if (!it || it.value)
|
|
9179
|
-
fc.items.push({ start: [], key:
|
|
9179
|
+
fc.items.push({ start: [], key: fs10, sep: [] });
|
|
9180
9180
|
else if (it.sep)
|
|
9181
|
-
this.stack.push(
|
|
9181
|
+
this.stack.push(fs10);
|
|
9182
9182
|
else
|
|
9183
|
-
Object.assign(it, { key:
|
|
9183
|
+
Object.assign(it, { key: fs10, sep: [] });
|
|
9184
9184
|
return;
|
|
9185
9185
|
}
|
|
9186
9186
|
case "flow-map-end":
|
|
@@ -9593,13 +9593,13 @@ var require_min_release_age = __commonJS({
|
|
|
9593
9593
|
return Number.isFinite(days) && days > 0 ? days * config_parse_1.DAY_MS : 0;
|
|
9594
9594
|
}
|
|
9595
9595
|
function probe(p) {
|
|
9596
|
-
return new Promise((
|
|
9596
|
+
return new Promise((resolve4) => {
|
|
9597
9597
|
(0, node_child_process_1.exec)(p.command, { timeout: PROBE_TIMEOUT_MS2, windowsHide: true }, (err, stdout2) => {
|
|
9598
9598
|
if (err) {
|
|
9599
|
-
|
|
9599
|
+
resolve4(0);
|
|
9600
9600
|
return;
|
|
9601
9601
|
}
|
|
9602
|
-
|
|
9602
|
+
resolve4(p.parse(stdout2));
|
|
9603
9603
|
});
|
|
9604
9604
|
});
|
|
9605
9605
|
}
|
|
@@ -9632,12 +9632,12 @@ var require_registry = __commonJS({
|
|
|
9632
9632
|
var node_https_1 = __importDefault(__require("node:https"));
|
|
9633
9633
|
var REQUEST_TIMEOUT_MS = 1e4;
|
|
9634
9634
|
function fetchRegistryInfo2(url) {
|
|
9635
|
-
return new Promise((
|
|
9635
|
+
return new Promise((resolve4) => {
|
|
9636
9636
|
let resolved = false;
|
|
9637
9637
|
const safeResolve = (value) => {
|
|
9638
9638
|
if (!resolved) {
|
|
9639
9639
|
resolved = true;
|
|
9640
|
-
|
|
9640
|
+
resolve4(value);
|
|
9641
9641
|
}
|
|
9642
9642
|
};
|
|
9643
9643
|
const req = node_https_1.default.get(url, { timeout: REQUEST_TIMEOUT_MS }, (res) => {
|
|
@@ -11120,8 +11120,8 @@ ${r2}
|
|
|
11120
11120
|
|
|
11121
11121
|
// ../argent-installer/src/init.ts
|
|
11122
11122
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
11123
|
-
import { existsSync as
|
|
11124
|
-
import { resolve as
|
|
11123
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
11124
|
+
import { resolve as resolve3 } from "node:path";
|
|
11125
11125
|
import { spawn } from "node:child_process";
|
|
11126
11126
|
|
|
11127
11127
|
// ../../node_modules/posthog-node/dist/extensions/error-tracking/modifiers/module.node.mjs
|
|
@@ -11151,8 +11151,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname2(proce
|
|
|
11151
11151
|
return decodedFile;
|
|
11152
11152
|
};
|
|
11153
11153
|
}
|
|
11154
|
-
function normalizeWindowsPath(
|
|
11155
|
-
return
|
|
11154
|
+
function normalizeWindowsPath(path12) {
|
|
11155
|
+
return path12.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
11156
11156
|
}
|
|
11157
11157
|
|
|
11158
11158
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -13704,15 +13704,15 @@ async function addSourceContext(frames) {
|
|
|
13704
13704
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
13705
13705
|
return frames;
|
|
13706
13706
|
}
|
|
13707
|
-
function getContextLinesFromFile(
|
|
13708
|
-
return new Promise((
|
|
13709
|
-
const stream = createReadStream(
|
|
13707
|
+
function getContextLinesFromFile(path12, ranges, output) {
|
|
13708
|
+
return new Promise((resolve4) => {
|
|
13709
|
+
const stream = createReadStream(path12);
|
|
13710
13710
|
const lineReaded = createInterface2({
|
|
13711
13711
|
input: stream
|
|
13712
13712
|
});
|
|
13713
13713
|
function destroyStreamAndResolve() {
|
|
13714
13714
|
stream.destroy();
|
|
13715
|
-
|
|
13715
|
+
resolve4();
|
|
13716
13716
|
}
|
|
13717
13717
|
let lineNumber = 0;
|
|
13718
13718
|
let currentRangeIndex = 0;
|
|
@@ -13721,7 +13721,7 @@ function getContextLinesFromFile(path10, ranges, output) {
|
|
|
13721
13721
|
let rangeStart = range[0];
|
|
13722
13722
|
let rangeEnd = range[1];
|
|
13723
13723
|
function onStreamError() {
|
|
13724
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
13724
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path12, 1);
|
|
13725
13725
|
lineReaded.close();
|
|
13726
13726
|
lineReaded.removeAllListeners();
|
|
13727
13727
|
destroyStreamAndResolve();
|
|
@@ -13782,8 +13782,8 @@ function clearLineContext(frame) {
|
|
|
13782
13782
|
delete frame.context_line;
|
|
13783
13783
|
delete frame.post_context;
|
|
13784
13784
|
}
|
|
13785
|
-
function shouldSkipContextLinesForFile(
|
|
13786
|
-
return
|
|
13785
|
+
function shouldSkipContextLinesForFile(path12) {
|
|
13786
|
+
return path12.startsWith("node:") || path12.endsWith(".min.js") || path12.endsWith(".min.cjs") || path12.endsWith(".min.mjs") || path12.startsWith("data:");
|
|
13787
13787
|
}
|
|
13788
13788
|
function shouldSkipContextLinesForFrame(frame) {
|
|
13789
13789
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -15009,9 +15009,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15009
15009
|
if (!waitUntil) return;
|
|
15010
15010
|
if (this.disabled || this.optedOut) return;
|
|
15011
15011
|
if (!this._waitUntilCycle) {
|
|
15012
|
-
let
|
|
15012
|
+
let resolve4;
|
|
15013
15013
|
const promise = new Promise((r2) => {
|
|
15014
|
-
|
|
15014
|
+
resolve4 = r2;
|
|
15015
15015
|
});
|
|
15016
15016
|
try {
|
|
15017
15017
|
waitUntil(promise);
|
|
@@ -15019,7 +15019,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15019
15019
|
return;
|
|
15020
15020
|
}
|
|
15021
15021
|
this._waitUntilCycle = {
|
|
15022
|
-
resolve:
|
|
15022
|
+
resolve: resolve4,
|
|
15023
15023
|
startedAt: Date.now(),
|
|
15024
15024
|
timer: void 0
|
|
15025
15025
|
};
|
|
@@ -15043,12 +15043,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15043
15043
|
return cycle?.resolve;
|
|
15044
15044
|
}
|
|
15045
15045
|
async resolveWaitUntilFlush() {
|
|
15046
|
-
const
|
|
15046
|
+
const resolve4 = this._consumeWaitUntilCycle();
|
|
15047
15047
|
try {
|
|
15048
15048
|
await super.flush();
|
|
15049
15049
|
} catch {
|
|
15050
15050
|
} finally {
|
|
15051
|
-
|
|
15051
|
+
resolve4?.();
|
|
15052
15052
|
}
|
|
15053
15053
|
}
|
|
15054
15054
|
getPersistedProperty(key) {
|
|
@@ -15169,15 +15169,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15169
15169
|
async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
|
|
15170
15170
|
if (this.isLocalEvaluationReady()) return true;
|
|
15171
15171
|
if (void 0 === this.featureFlagsPoller) return false;
|
|
15172
|
-
return new Promise((
|
|
15172
|
+
return new Promise((resolve4) => {
|
|
15173
15173
|
const timeout = setTimeout(() => {
|
|
15174
15174
|
cleanup();
|
|
15175
|
-
|
|
15175
|
+
resolve4(false);
|
|
15176
15176
|
}, timeoutMs);
|
|
15177
15177
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
15178
15178
|
clearTimeout(timeout);
|
|
15179
15179
|
cleanup();
|
|
15180
|
-
|
|
15180
|
+
resolve4(count > 0);
|
|
15181
15181
|
});
|
|
15182
15182
|
});
|
|
15183
15183
|
}
|
|
@@ -15632,14 +15632,14 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
15632
15632
|
this.context?.enter(data, options);
|
|
15633
15633
|
}
|
|
15634
15634
|
async _shutdown(shutdownTimeoutMs) {
|
|
15635
|
-
const
|
|
15635
|
+
const resolve4 = this._consumeWaitUntilCycle();
|
|
15636
15636
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
15637
15637
|
this.errorTracking.shutdown();
|
|
15638
15638
|
try {
|
|
15639
15639
|
return await super._shutdown(shutdownTimeoutMs);
|
|
15640
15640
|
} finally {
|
|
15641
15641
|
this.distinctIdHasSentFlagCalls = {};
|
|
15642
|
-
|
|
15642
|
+
resolve4?.();
|
|
15643
15643
|
}
|
|
15644
15644
|
}
|
|
15645
15645
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -16477,9 +16477,9 @@ function isReplitAgent(env) {
|
|
|
16477
16477
|
}
|
|
16478
16478
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
16479
16479
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
16480
|
-
function safeExists(fileExists,
|
|
16480
|
+
function safeExists(fileExists, path12) {
|
|
16481
16481
|
try {
|
|
16482
|
-
return fileExists(
|
|
16482
|
+
return fileExists(path12);
|
|
16483
16483
|
} catch {
|
|
16484
16484
|
return false;
|
|
16485
16485
|
}
|
|
@@ -16933,13 +16933,21 @@ function getBaseProps(runtime) {
|
|
|
16933
16933
|
}
|
|
16934
16934
|
|
|
16935
16935
|
// ../telemetry/src/identity.ts
|
|
16936
|
-
import * as
|
|
16937
|
-
import * as
|
|
16938
|
-
import * as
|
|
16936
|
+
import * as crypto2 from "node:crypto";
|
|
16937
|
+
import * as fs3 from "node:fs";
|
|
16938
|
+
import * as path5 from "node:path";
|
|
16939
16939
|
|
|
16940
16940
|
// ../telemetry/src/paths.ts
|
|
16941
|
-
import * as
|
|
16941
|
+
import * as path4 from "node:path";
|
|
16942
|
+
|
|
16943
|
+
// ../configuration-core/src/flags.ts
|
|
16944
|
+
import * as fs from "node:fs";
|
|
16942
16945
|
import * as path from "node:path";
|
|
16946
|
+
import { homedir } from "node:os";
|
|
16947
|
+
|
|
16948
|
+
// ../configuration-core/src/paths.ts
|
|
16949
|
+
import * as os from "node:os";
|
|
16950
|
+
import * as path2 from "node:path";
|
|
16943
16951
|
function nonEmpty(value) {
|
|
16944
16952
|
if (value == void 0) return null;
|
|
16945
16953
|
const trimmed = value.trim();
|
|
@@ -16947,99 +16955,14 @@ function nonEmpty(value) {
|
|
|
16947
16955
|
}
|
|
16948
16956
|
function argentHomeDir() {
|
|
16949
16957
|
const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
16950
|
-
return
|
|
16951
|
-
}
|
|
16952
|
-
function identityFilePath() {
|
|
16953
|
-
return path.join(argentHomeDir(), "telemetry-id");
|
|
16958
|
+
return path2.join(home, ".argent");
|
|
16954
16959
|
}
|
|
16955
16960
|
function configFilePath() {
|
|
16956
|
-
return
|
|
16957
|
-
}
|
|
16958
|
-
function debugLogPath() {
|
|
16959
|
-
return path.join(argentHomeDir(), "telemetry-debug.log");
|
|
16961
|
+
return path2.join(argentHomeDir(), "config.json");
|
|
16960
16962
|
}
|
|
16961
16963
|
|
|
16962
|
-
// ../
|
|
16963
|
-
|
|
16964
|
-
function readOrCreateAnonId() {
|
|
16965
|
-
const finalPath = identityFilePath();
|
|
16966
|
-
if (cached && cached.path === finalPath) return cached.id;
|
|
16967
|
-
const existing = tryReadId(finalPath);
|
|
16968
|
-
if (existing) {
|
|
16969
|
-
cached = { path: finalPath, id: existing };
|
|
16970
|
-
return existing;
|
|
16971
|
-
}
|
|
16972
|
-
fs.mkdirSync(argentHomeDir(), { recursive: true });
|
|
16973
|
-
const uuid = crypto.randomUUID();
|
|
16974
|
-
for (let attempt = 0; attempt < 3; attempt++) {
|
|
16975
|
-
const tmpPath = path2.join(
|
|
16976
|
-
argentHomeDir(),
|
|
16977
|
-
`.telemetry-id.tmp.${process.pid}.${crypto.randomUUID()}`
|
|
16978
|
-
);
|
|
16979
|
-
let fd;
|
|
16980
|
-
try {
|
|
16981
|
-
fd = fs.openSync(tmpPath, "wx", 384);
|
|
16982
|
-
} catch (err) {
|
|
16983
|
-
if (err.code === "EEXIST") continue;
|
|
16984
|
-
throw err;
|
|
16985
|
-
}
|
|
16986
|
-
try {
|
|
16987
|
-
try {
|
|
16988
|
-
fs.writeSync(fd, uuid);
|
|
16989
|
-
fs.fsyncSync(fd);
|
|
16990
|
-
} finally {
|
|
16991
|
-
fs.closeSync(fd);
|
|
16992
|
-
}
|
|
16993
|
-
fs.linkSync(tmpPath, finalPath);
|
|
16994
|
-
cached = { path: finalPath, id: uuid };
|
|
16995
|
-
return uuid;
|
|
16996
|
-
} catch (err) {
|
|
16997
|
-
if (err.code === "EEXIST") {
|
|
16998
|
-
const beatUs = tryReadId(finalPath);
|
|
16999
|
-
if (beatUs) {
|
|
17000
|
-
cached = { path: finalPath, id: beatUs };
|
|
17001
|
-
return beatUs;
|
|
17002
|
-
}
|
|
17003
|
-
continue;
|
|
17004
|
-
}
|
|
17005
|
-
throw err;
|
|
17006
|
-
} finally {
|
|
17007
|
-
try {
|
|
17008
|
-
fs.unlinkSync(tmpPath);
|
|
17009
|
-
} catch {
|
|
17010
|
-
}
|
|
17011
|
-
}
|
|
17012
|
-
}
|
|
17013
|
-
throw new Error("telemetry: failed to create anonymous identity after retries");
|
|
17014
|
-
}
|
|
17015
|
-
function deleteAnonId() {
|
|
17016
|
-
cached = null;
|
|
17017
|
-
try {
|
|
17018
|
-
fs.unlinkSync(identityFilePath());
|
|
17019
|
-
} catch (err) {
|
|
17020
|
-
if (err.code !== "ENOENT") throw err;
|
|
17021
|
-
}
|
|
17022
|
-
}
|
|
17023
|
-
function tryReadId(filePath) {
|
|
17024
|
-
let raw;
|
|
17025
|
-
try {
|
|
17026
|
-
const stats = fs.lstatSync(filePath);
|
|
17027
|
-
if (!stats.isFile()) return null;
|
|
17028
|
-
raw = fs.readFileSync(filePath, "utf8");
|
|
17029
|
-
} catch (err) {
|
|
17030
|
-
if (err.code === "ENOENT") return null;
|
|
17031
|
-
return null;
|
|
17032
|
-
}
|
|
17033
|
-
const value = raw.trim();
|
|
17034
|
-
if (/^[0-9a-fA-F-]{32,128}$/.test(value)) return value;
|
|
17035
|
-
return null;
|
|
17036
|
-
}
|
|
17037
|
-
|
|
17038
|
-
// ../telemetry/src/consent.ts
|
|
17039
|
-
import * as fs3 from "node:fs";
|
|
17040
|
-
|
|
17041
|
-
// ../telemetry/src/config-file.ts
|
|
17042
|
-
import * as crypto2 from "node:crypto";
|
|
16964
|
+
// ../configuration-core/src/config.ts
|
|
16965
|
+
import * as crypto from "node:crypto";
|
|
17043
16966
|
import * as fs2 from "node:fs";
|
|
17044
16967
|
import * as path3 from "node:path";
|
|
17045
16968
|
function readConfigObject() {
|
|
@@ -17102,7 +17025,7 @@ function updateConfig(mutate) {
|
|
|
17102
17025
|
const next = readConfigObject();
|
|
17103
17026
|
mutate(next);
|
|
17104
17027
|
const finalPath = configFilePath();
|
|
17105
|
-
const tmpPath = path3.join(argentHomeDir(), `.config.tmp.${process.pid}.${
|
|
17028
|
+
const tmpPath = path3.join(argentHomeDir(), `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
17106
17029
|
const fd = fs2.openSync(tmpPath, "wx", 384);
|
|
17107
17030
|
try {
|
|
17108
17031
|
fs2.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
@@ -17124,13 +17047,98 @@ function updateConfig(mutate) {
|
|
|
17124
17047
|
}
|
|
17125
17048
|
}
|
|
17126
17049
|
|
|
17050
|
+
// ../telemetry/src/paths.ts
|
|
17051
|
+
function identityFilePath() {
|
|
17052
|
+
return path4.join(argentHomeDir(), "telemetry-id");
|
|
17053
|
+
}
|
|
17054
|
+
function debugLogPath() {
|
|
17055
|
+
return path4.join(argentHomeDir(), "telemetry-debug.log");
|
|
17056
|
+
}
|
|
17057
|
+
|
|
17058
|
+
// ../telemetry/src/identity.ts
|
|
17059
|
+
var cached = null;
|
|
17060
|
+
function readOrCreateAnonId() {
|
|
17061
|
+
const finalPath = identityFilePath();
|
|
17062
|
+
if (cached && cached.path === finalPath) return cached.id;
|
|
17063
|
+
const existing = tryReadId(finalPath);
|
|
17064
|
+
if (existing) {
|
|
17065
|
+
cached = { path: finalPath, id: existing };
|
|
17066
|
+
return existing;
|
|
17067
|
+
}
|
|
17068
|
+
fs3.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17069
|
+
const uuid = crypto2.randomUUID();
|
|
17070
|
+
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17071
|
+
const tmpPath = path5.join(
|
|
17072
|
+
argentHomeDir(),
|
|
17073
|
+
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17074
|
+
);
|
|
17075
|
+
let fd;
|
|
17076
|
+
try {
|
|
17077
|
+
fd = fs3.openSync(tmpPath, "wx", 384);
|
|
17078
|
+
} catch (err) {
|
|
17079
|
+
if (err.code === "EEXIST") continue;
|
|
17080
|
+
throw err;
|
|
17081
|
+
}
|
|
17082
|
+
try {
|
|
17083
|
+
try {
|
|
17084
|
+
fs3.writeSync(fd, uuid);
|
|
17085
|
+
fs3.fsyncSync(fd);
|
|
17086
|
+
} finally {
|
|
17087
|
+
fs3.closeSync(fd);
|
|
17088
|
+
}
|
|
17089
|
+
fs3.linkSync(tmpPath, finalPath);
|
|
17090
|
+
cached = { path: finalPath, id: uuid };
|
|
17091
|
+
return uuid;
|
|
17092
|
+
} catch (err) {
|
|
17093
|
+
if (err.code === "EEXIST") {
|
|
17094
|
+
const beatUs = tryReadId(finalPath);
|
|
17095
|
+
if (beatUs) {
|
|
17096
|
+
cached = { path: finalPath, id: beatUs };
|
|
17097
|
+
return beatUs;
|
|
17098
|
+
}
|
|
17099
|
+
continue;
|
|
17100
|
+
}
|
|
17101
|
+
throw err;
|
|
17102
|
+
} finally {
|
|
17103
|
+
try {
|
|
17104
|
+
fs3.unlinkSync(tmpPath);
|
|
17105
|
+
} catch {
|
|
17106
|
+
}
|
|
17107
|
+
}
|
|
17108
|
+
}
|
|
17109
|
+
throw new Error("telemetry: failed to create anonymous identity after retries");
|
|
17110
|
+
}
|
|
17111
|
+
function deleteAnonId() {
|
|
17112
|
+
cached = null;
|
|
17113
|
+
try {
|
|
17114
|
+
fs3.unlinkSync(identityFilePath());
|
|
17115
|
+
} catch (err) {
|
|
17116
|
+
if (err.code !== "ENOENT") throw err;
|
|
17117
|
+
}
|
|
17118
|
+
}
|
|
17119
|
+
function tryReadId(filePath) {
|
|
17120
|
+
let raw;
|
|
17121
|
+
try {
|
|
17122
|
+
const stats = fs3.lstatSync(filePath);
|
|
17123
|
+
if (!stats.isFile()) return null;
|
|
17124
|
+
raw = fs3.readFileSync(filePath, "utf8");
|
|
17125
|
+
} catch (err) {
|
|
17126
|
+
if (err.code === "ENOENT") return null;
|
|
17127
|
+
return null;
|
|
17128
|
+
}
|
|
17129
|
+
const value = raw.trim();
|
|
17130
|
+
if (/^[0-9a-fA-F-]{32,128}$/.test(value)) return value;
|
|
17131
|
+
return null;
|
|
17132
|
+
}
|
|
17133
|
+
|
|
17127
17134
|
// ../telemetry/src/consent.ts
|
|
17135
|
+
import * as fs4 from "node:fs";
|
|
17128
17136
|
var cache = { current: null };
|
|
17129
17137
|
var sessionOverride = null;
|
|
17130
17138
|
function readConfigOverride() {
|
|
17131
17139
|
let stats;
|
|
17132
17140
|
try {
|
|
17133
|
-
stats =
|
|
17141
|
+
stats = fs4.lstatSync(configFilePath());
|
|
17134
17142
|
} catch (err) {
|
|
17135
17143
|
if (err.code === "ENOENT") {
|
|
17136
17144
|
cache.current = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
@@ -17150,7 +17158,7 @@ function readConfigOverride() {
|
|
|
17150
17158
|
}
|
|
17151
17159
|
let parsedEnabled = null;
|
|
17152
17160
|
try {
|
|
17153
|
-
const raw =
|
|
17161
|
+
const raw = fs4.readFileSync(configFilePath(), "utf8");
|
|
17154
17162
|
const json = JSON.parse(raw);
|
|
17155
17163
|
if (json && typeof json === "object") {
|
|
17156
17164
|
const t2 = json.telemetry;
|
|
@@ -17214,7 +17222,7 @@ function setSessionConsentOverride(enabled) {
|
|
|
17214
17222
|
}
|
|
17215
17223
|
|
|
17216
17224
|
// ../telemetry/src/debug.ts
|
|
17217
|
-
import * as
|
|
17225
|
+
import * as fs5 from "node:fs";
|
|
17218
17226
|
function isDebugEnabled(env = process.env) {
|
|
17219
17227
|
const v = env.ARGENT_TELEMETRY_DEBUG;
|
|
17220
17228
|
if (!v) return false;
|
|
@@ -17241,8 +17249,8 @@ function emitDebugPayload(payload) {
|
|
|
17241
17249
|
} catch {
|
|
17242
17250
|
}
|
|
17243
17251
|
try {
|
|
17244
|
-
|
|
17245
|
-
|
|
17252
|
+
fs5.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17253
|
+
fs5.appendFileSync(debugLogPath(), line + "\n");
|
|
17246
17254
|
} catch {
|
|
17247
17255
|
}
|
|
17248
17256
|
}
|
|
@@ -17384,7 +17392,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17384
17392
|
try {
|
|
17385
17393
|
await Promise.race([
|
|
17386
17394
|
client2.shutdown(timeoutMs),
|
|
17387
|
-
new Promise((
|
|
17395
|
+
new Promise((resolve4) => setTimeout(resolve4, timeoutMs + 250).unref())
|
|
17388
17396
|
]);
|
|
17389
17397
|
} catch (err) {
|
|
17390
17398
|
emitDebugError("shutdown failed", err);
|
|
@@ -17398,10 +17406,10 @@ async function forget2(options) {
|
|
|
17398
17406
|
}
|
|
17399
17407
|
|
|
17400
17408
|
// ../argent-installer/src/mcp-configs.ts
|
|
17401
|
-
import * as
|
|
17402
|
-
import * as
|
|
17409
|
+
import * as fs7 from "node:fs";
|
|
17410
|
+
import * as path7 from "node:path";
|
|
17403
17411
|
import { execFileSync } from "node:child_process";
|
|
17404
|
-
import { homedir as
|
|
17412
|
+
import { homedir as homedir4 } from "node:os";
|
|
17405
17413
|
|
|
17406
17414
|
// ../argent-installer/src/constants.ts
|
|
17407
17415
|
var PACKAGE_NAME = "@swmansion/argent";
|
|
@@ -17413,8 +17421,8 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17413
17421
|
|
|
17414
17422
|
// ../argent-installer/src/utils.ts
|
|
17415
17423
|
var import_semver = __toESM(require_semver2(), 1);
|
|
17416
|
-
import * as
|
|
17417
|
-
import * as
|
|
17424
|
+
import * as fs6 from "node:fs";
|
|
17425
|
+
import * as path6 from "node:path";
|
|
17418
17426
|
import * as dns from "node:dns";
|
|
17419
17427
|
import * as os2 from "node:os";
|
|
17420
17428
|
import { execSync } from "node:child_process";
|
|
@@ -19039,12 +19047,12 @@ function parseTree(text2, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
19039
19047
|
}
|
|
19040
19048
|
return result;
|
|
19041
19049
|
}
|
|
19042
|
-
function findNodeAtLocation(root,
|
|
19050
|
+
function findNodeAtLocation(root, path12) {
|
|
19043
19051
|
if (!root) {
|
|
19044
19052
|
return void 0;
|
|
19045
19053
|
}
|
|
19046
19054
|
let node = root;
|
|
19047
|
-
for (let segment of
|
|
19055
|
+
for (let segment of path12) {
|
|
19048
19056
|
if (typeof segment === "string") {
|
|
19049
19057
|
if (node.type !== "object" || !Array.isArray(node.children)) {
|
|
19050
19058
|
return void 0;
|
|
@@ -19398,14 +19406,14 @@ function getNodeType(value) {
|
|
|
19398
19406
|
|
|
19399
19407
|
// ../../node_modules/jsonc-parser/lib/esm/impl/edit.js
|
|
19400
19408
|
function setProperty(text2, originalPath, value, options) {
|
|
19401
|
-
const
|
|
19409
|
+
const path12 = originalPath.slice();
|
|
19402
19410
|
const errors = [];
|
|
19403
19411
|
const root = parseTree(text2, errors);
|
|
19404
19412
|
let parent = void 0;
|
|
19405
19413
|
let lastSegment = void 0;
|
|
19406
|
-
while (
|
|
19407
|
-
lastSegment =
|
|
19408
|
-
parent = findNodeAtLocation(root,
|
|
19414
|
+
while (path12.length > 0) {
|
|
19415
|
+
lastSegment = path12.pop();
|
|
19416
|
+
parent = findNodeAtLocation(root, path12);
|
|
19409
19417
|
if (parent === void 0 && value !== void 0) {
|
|
19410
19418
|
if (typeof lastSegment === "string") {
|
|
19411
19419
|
value = { [lastSegment]: value };
|
|
@@ -19591,8 +19599,8 @@ var ParseErrorCode;
|
|
|
19591
19599
|
ParseErrorCode2[ParseErrorCode2["InvalidEscapeCharacter"] = 15] = "InvalidEscapeCharacter";
|
|
19592
19600
|
ParseErrorCode2[ParseErrorCode2["InvalidCharacter"] = 16] = "InvalidCharacter";
|
|
19593
19601
|
})(ParseErrorCode || (ParseErrorCode = {}));
|
|
19594
|
-
function modify(text2,
|
|
19595
|
-
return setProperty(text2,
|
|
19602
|
+
function modify(text2, path12, value, options) {
|
|
19603
|
+
return setProperty(text2, path12, value, options);
|
|
19596
19604
|
}
|
|
19597
19605
|
function applyEdits(text2, edits) {
|
|
19598
19606
|
let sortedEdits = edits.slice(0).sort((a3, b) => {
|
|
@@ -19616,20 +19624,20 @@ function applyEdits(text2, edits) {
|
|
|
19616
19624
|
}
|
|
19617
19625
|
|
|
19618
19626
|
// ../argent-installer/src/utils.ts
|
|
19619
|
-
function resolvePackageRoot(
|
|
19620
|
-
let current =
|
|
19627
|
+
function resolvePackageRoot(dirname8) {
|
|
19628
|
+
let current = path6.resolve(dirname8);
|
|
19621
19629
|
while (true) {
|
|
19622
|
-
if (
|
|
19623
|
-
const parent =
|
|
19624
|
-
if (parent === current) return
|
|
19630
|
+
if (fs6.existsSync(path6.join(current, "package.json"))) return current;
|
|
19631
|
+
const parent = path6.dirname(current);
|
|
19632
|
+
if (parent === current) return path6.resolve(dirname8);
|
|
19625
19633
|
current = parent;
|
|
19626
19634
|
}
|
|
19627
19635
|
}
|
|
19628
19636
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
19629
19637
|
function resolveBundledDir(dirName) {
|
|
19630
|
-
const packagedDir =
|
|
19631
|
-
if (
|
|
19632
|
-
return
|
|
19638
|
+
const packagedDir = path6.join(PACKAGE_ROOT, dirName);
|
|
19639
|
+
if (fs6.existsSync(packagedDir)) return packagedDir;
|
|
19640
|
+
return path6.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
19633
19641
|
}
|
|
19634
19642
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
19635
19643
|
var RULES_DIR = resolveBundledDir("rules");
|
|
@@ -19641,23 +19649,23 @@ function buildArgentSkillsSource(version2) {
|
|
|
19641
19649
|
}
|
|
19642
19650
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
19643
19651
|
try {
|
|
19644
|
-
return
|
|
19652
|
+
return fs6.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs6.existsSync(path6.join(skillsDir, name, "SKILL.md"))).sort();
|
|
19645
19653
|
} catch {
|
|
19646
19654
|
return [];
|
|
19647
19655
|
}
|
|
19648
19656
|
}
|
|
19649
19657
|
function getProjectSkillLockPath(cwd = process.cwd()) {
|
|
19650
|
-
return
|
|
19658
|
+
return path6.join(cwd, "skills-lock.json");
|
|
19651
19659
|
}
|
|
19652
19660
|
function getGlobalSkillLockPath() {
|
|
19653
19661
|
const xdgStateHome = process.env.XDG_STATE_HOME;
|
|
19654
|
-
if (xdgStateHome) return
|
|
19655
|
-
return
|
|
19662
|
+
if (xdgStateHome) return path6.join(xdgStateHome, "skills", ".skill-lock.json");
|
|
19663
|
+
return path6.join(os2.homedir(), ".agents", ".skill-lock.json");
|
|
19656
19664
|
}
|
|
19657
19665
|
var ARGENT_SKILL_PREFIX = "argent-";
|
|
19658
19666
|
function listArgentSkillsInLock(lockPath) {
|
|
19659
19667
|
try {
|
|
19660
|
-
const raw =
|
|
19668
|
+
const raw = fs6.readFileSync(lockPath, "utf8");
|
|
19661
19669
|
const lock = JSON.parse(raw);
|
|
19662
19670
|
const tracked = lock.skills ?? {};
|
|
19663
19671
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -19680,17 +19688,17 @@ var PROJECT_ROOT_MARKERS = [
|
|
|
19680
19688
|
"opencode.jsonc",
|
|
19681
19689
|
"skills-lock.json"
|
|
19682
19690
|
];
|
|
19683
|
-
function
|
|
19684
|
-
const initialDir =
|
|
19691
|
+
function resolveProjectRoot2(startDir) {
|
|
19692
|
+
const initialDir = path6.resolve(startDir);
|
|
19685
19693
|
let currentDir = initialDir;
|
|
19686
19694
|
while (true) {
|
|
19687
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
19695
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs6.existsSync(path6.join(currentDir, marker)))) {
|
|
19688
19696
|
return currentDir;
|
|
19689
19697
|
}
|
|
19690
|
-
if (
|
|
19698
|
+
if (fs6.existsSync(path6.join(currentDir, ".git"))) {
|
|
19691
19699
|
return currentDir;
|
|
19692
19700
|
}
|
|
19693
|
-
const parentDir =
|
|
19701
|
+
const parentDir = path6.dirname(currentDir);
|
|
19694
19702
|
if (parentDir === currentDir) {
|
|
19695
19703
|
return initialDir;
|
|
19696
19704
|
}
|
|
@@ -19698,20 +19706,20 @@ function resolveProjectRoot(startDir) {
|
|
|
19698
19706
|
}
|
|
19699
19707
|
}
|
|
19700
19708
|
function readToml(filePath) {
|
|
19701
|
-
if (!
|
|
19709
|
+
if (!fs6.existsSync(filePath)) return {};
|
|
19702
19710
|
try {
|
|
19703
|
-
return parse(
|
|
19711
|
+
return parse(fs6.readFileSync(filePath, "utf8"));
|
|
19704
19712
|
} catch {
|
|
19705
19713
|
return {};
|
|
19706
19714
|
}
|
|
19707
19715
|
}
|
|
19708
19716
|
function writeToml(filePath, data) {
|
|
19709
|
-
|
|
19710
|
-
|
|
19717
|
+
fs6.mkdirSync(path6.dirname(filePath), { recursive: true });
|
|
19718
|
+
fs6.writeFileSync(filePath, stringify(data) + "\n");
|
|
19711
19719
|
}
|
|
19712
19720
|
function readYaml(filePath) {
|
|
19713
|
-
if (!
|
|
19714
|
-
const text2 =
|
|
19721
|
+
if (!fs6.existsSync(filePath)) return new import_yaml.Document({});
|
|
19722
|
+
const text2 = fs6.readFileSync(filePath, "utf8");
|
|
19715
19723
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
19716
19724
|
if (doc.errors.length > 0) {
|
|
19717
19725
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -19720,20 +19728,20 @@ function readYaml(filePath) {
|
|
|
19720
19728
|
return doc;
|
|
19721
19729
|
}
|
|
19722
19730
|
function writeYaml(filePath, doc) {
|
|
19723
|
-
|
|
19724
|
-
|
|
19731
|
+
fs6.mkdirSync(path6.dirname(filePath), { recursive: true });
|
|
19732
|
+
fs6.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
19725
19733
|
}
|
|
19726
19734
|
function readJson(filePath) {
|
|
19727
|
-
if (!
|
|
19735
|
+
if (!fs6.existsSync(filePath)) return {};
|
|
19728
19736
|
try {
|
|
19729
|
-
return JSON.parse(
|
|
19737
|
+
return JSON.parse(fs6.readFileSync(filePath, "utf8"));
|
|
19730
19738
|
} catch {
|
|
19731
19739
|
return {};
|
|
19732
19740
|
}
|
|
19733
19741
|
}
|
|
19734
19742
|
function writeJson(filePath, data) {
|
|
19735
|
-
|
|
19736
|
-
|
|
19743
|
+
fs6.mkdirSync(path6.dirname(filePath), { recursive: true });
|
|
19744
|
+
fs6.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
19737
19745
|
}
|
|
19738
19746
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
19739
19747
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -19741,8 +19749,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
19741
19749
|
return applyEdits(text2, edits);
|
|
19742
19750
|
}
|
|
19743
19751
|
function readJsoncFileRaw(filePath) {
|
|
19744
|
-
if (!
|
|
19745
|
-
let text2 =
|
|
19752
|
+
if (!fs6.existsSync(filePath)) return { text: "{}", hadBom: false };
|
|
19753
|
+
let text2 = fs6.readFileSync(filePath, "utf8");
|
|
19746
19754
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
19747
19755
|
if (hadBom) text2 = text2.slice(1);
|
|
19748
19756
|
if (text2.trim() === "") text2 = "{}";
|
|
@@ -19761,16 +19769,16 @@ function isEmptyPlainObject(value) {
|
|
|
19761
19769
|
}
|
|
19762
19770
|
function rmEmptyDir(dirPath) {
|
|
19763
19771
|
try {
|
|
19764
|
-
if (!
|
|
19765
|
-
if (!
|
|
19766
|
-
if (
|
|
19767
|
-
|
|
19772
|
+
if (!fs6.existsSync(dirPath)) return;
|
|
19773
|
+
if (!fs6.statSync(dirPath).isDirectory()) return;
|
|
19774
|
+
if (fs6.readdirSync(dirPath).length > 0) return;
|
|
19775
|
+
fs6.rmdirSync(dirPath);
|
|
19768
19776
|
} catch {
|
|
19769
19777
|
}
|
|
19770
19778
|
}
|
|
19771
19779
|
function readJsonc(filePath) {
|
|
19772
|
-
if (!
|
|
19773
|
-
let raw =
|
|
19780
|
+
if (!fs6.existsSync(filePath)) return {};
|
|
19781
|
+
let raw = fs6.readFileSync(filePath, "utf8");
|
|
19774
19782
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
19775
19783
|
if (raw.trim() === "") return {};
|
|
19776
19784
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -19789,24 +19797,24 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
19789
19797
|
}
|
|
19790
19798
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
19791
19799
|
if (isEmptyPlainObject(parsed)) {
|
|
19792
|
-
|
|
19793
|
-
rmEmptyDir(
|
|
19800
|
+
fs6.rmSync(filePath, { force: true });
|
|
19801
|
+
rmEmptyDir(path6.dirname(filePath));
|
|
19794
19802
|
return;
|
|
19795
19803
|
}
|
|
19796
|
-
|
|
19797
|
-
|
|
19804
|
+
fs6.mkdirSync(path6.dirname(filePath), { recursive: true });
|
|
19805
|
+
fs6.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + text2);
|
|
19798
19806
|
}
|
|
19799
19807
|
function dirExists(p) {
|
|
19800
19808
|
try {
|
|
19801
|
-
return
|
|
19809
|
+
return fs6.statSync(p).isDirectory();
|
|
19802
19810
|
} catch {
|
|
19803
19811
|
return false;
|
|
19804
19812
|
}
|
|
19805
19813
|
}
|
|
19806
19814
|
function getInstalledVersion() {
|
|
19807
19815
|
try {
|
|
19808
|
-
const pkgPath =
|
|
19809
|
-
const pkg = JSON.parse(
|
|
19816
|
+
const pkgPath = path6.join(PACKAGE_ROOT, "package.json");
|
|
19817
|
+
const pkg = JSON.parse(fs6.readFileSync(pkgPath, "utf8"));
|
|
19810
19818
|
return pkg.version ?? null;
|
|
19811
19819
|
} catch {
|
|
19812
19820
|
return null;
|
|
@@ -19816,9 +19824,9 @@ function getGloballyInstalledVersion() {
|
|
|
19816
19824
|
const binaryPath = getGlobalBinaryPath();
|
|
19817
19825
|
if (!binaryPath) return null;
|
|
19818
19826
|
try {
|
|
19819
|
-
const realPath =
|
|
19820
|
-
const pkgRoot = resolvePackageRoot(
|
|
19821
|
-
const pkg = JSON.parse(
|
|
19827
|
+
const realPath = fs6.realpathSync(binaryPath);
|
|
19828
|
+
const pkgRoot = resolvePackageRoot(path6.dirname(realPath));
|
|
19829
|
+
const pkg = JSON.parse(fs6.readFileSync(path6.join(pkgRoot, "package.json"), "utf8"));
|
|
19822
19830
|
return pkg.version ?? null;
|
|
19823
19831
|
} catch {
|
|
19824
19832
|
return null;
|
|
@@ -19882,12 +19890,12 @@ async function isOnline(timeoutMs = PROBE_TIMEOUT_MS) {
|
|
|
19882
19890
|
} catch {
|
|
19883
19891
|
return false;
|
|
19884
19892
|
}
|
|
19885
|
-
return new Promise((
|
|
19886
|
-
const timer = setTimeout(() =>
|
|
19893
|
+
return new Promise((resolve4) => {
|
|
19894
|
+
const timer = setTimeout(() => resolve4(false), timeoutMs);
|
|
19887
19895
|
timer.unref();
|
|
19888
19896
|
dns.lookup(host, (err) => {
|
|
19889
19897
|
clearTimeout(timer);
|
|
19890
|
-
|
|
19898
|
+
resolve4(!err);
|
|
19891
19899
|
});
|
|
19892
19900
|
});
|
|
19893
19901
|
}
|
|
@@ -19939,7 +19947,7 @@ function escapeStringRegexp(string) {
|
|
|
19939
19947
|
}
|
|
19940
19948
|
|
|
19941
19949
|
// ../argent-installer/src/mcp-configs.ts
|
|
19942
|
-
var TOOL_SERVER_BUNDLE =
|
|
19950
|
+
var TOOL_SERVER_BUNDLE = path7.join(import.meta.dirname, "tool-server.cjs");
|
|
19943
19951
|
function getAvailableToolIds() {
|
|
19944
19952
|
const out = execFileSync("node", [TOOL_SERVER_BUNDLE, "-t"], { encoding: "utf8" });
|
|
19945
19953
|
const tools = JSON.parse(out);
|
|
@@ -19959,10 +19967,10 @@ function hasEnv(entry) {
|
|
|
19959
19967
|
}
|
|
19960
19968
|
function removeDirIfEmpty(dirPath) {
|
|
19961
19969
|
try {
|
|
19962
|
-
if (!
|
|
19963
|
-
if (!
|
|
19964
|
-
if (
|
|
19965
|
-
|
|
19970
|
+
if (!fs7.existsSync(dirPath)) return;
|
|
19971
|
+
if (!fs7.statSync(dirPath).isDirectory()) return;
|
|
19972
|
+
if (fs7.readdirSync(dirPath).length > 0) return;
|
|
19973
|
+
fs7.rmdirSync(dirPath);
|
|
19966
19974
|
} catch {
|
|
19967
19975
|
}
|
|
19968
19976
|
}
|
|
@@ -19986,8 +19994,8 @@ function isRecord(value) {
|
|
|
19986
19994
|
function writeJsonOrRemove(filePath, data) {
|
|
19987
19995
|
const cleaned = pruneEmptyConfig(data);
|
|
19988
19996
|
if (!isRecord(cleaned)) {
|
|
19989
|
-
|
|
19990
|
-
removeDirIfEmpty(
|
|
19997
|
+
fs7.rmSync(filePath, { force: true });
|
|
19998
|
+
removeDirIfEmpty(path7.dirname(filePath));
|
|
19991
19999
|
return;
|
|
19992
20000
|
}
|
|
19993
20001
|
writeJson(filePath, cleaned);
|
|
@@ -19995,8 +20003,8 @@ function writeJsonOrRemove(filePath, data) {
|
|
|
19995
20003
|
function writeTomlOrRemove(filePath, data) {
|
|
19996
20004
|
const cleaned = pruneEmptyConfig(data);
|
|
19997
20005
|
if (!isRecord(cleaned)) {
|
|
19998
|
-
|
|
19999
|
-
removeDirIfEmpty(
|
|
20006
|
+
fs7.rmSync(filePath, { force: true });
|
|
20007
|
+
removeDirIfEmpty(path7.dirname(filePath));
|
|
20000
20008
|
return;
|
|
20001
20009
|
}
|
|
20002
20010
|
writeToml(filePath, cleaned);
|
|
@@ -20004,13 +20012,13 @@ function writeTomlOrRemove(filePath, data) {
|
|
|
20004
20012
|
var cursorAdapter = {
|
|
20005
20013
|
name: "Cursor",
|
|
20006
20014
|
detect() {
|
|
20007
|
-
return dirExists(
|
|
20015
|
+
return dirExists(path7.join(homedir4(), ".cursor")) || dirExists(path7.join(process.cwd(), ".cursor"));
|
|
20008
20016
|
},
|
|
20009
20017
|
projectPath(root) {
|
|
20010
|
-
return
|
|
20018
|
+
return path7.join(root, ".cursor", "mcp.json");
|
|
20011
20019
|
},
|
|
20012
20020
|
globalPath() {
|
|
20013
|
-
return
|
|
20021
|
+
return path7.join(homedir4(), ".cursor", "mcp.json");
|
|
20014
20022
|
},
|
|
20015
20023
|
write(configPath, entry) {
|
|
20016
20024
|
const config = readJson(configPath);
|
|
@@ -20024,7 +20032,7 @@ var cursorAdapter = {
|
|
|
20024
20032
|
writeJson(configPath, config);
|
|
20025
20033
|
},
|
|
20026
20034
|
remove(configPath) {
|
|
20027
|
-
if (!
|
|
20035
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20028
20036
|
const config = readJson(configPath);
|
|
20029
20037
|
const servers = config.mcpServers;
|
|
20030
20038
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20033,13 +20041,13 @@ var cursorAdapter = {
|
|
|
20033
20041
|
return true;
|
|
20034
20042
|
},
|
|
20035
20043
|
hasArgentEntry(configPath) {
|
|
20036
|
-
if (!
|
|
20044
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20037
20045
|
const config = readJson(configPath);
|
|
20038
20046
|
const servers = config.mcpServers;
|
|
20039
20047
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
20040
20048
|
},
|
|
20041
20049
|
addAllowlist() {
|
|
20042
|
-
const permPath =
|
|
20050
|
+
const permPath = path7.join(homedir4(), ".cursor", "permissions.json");
|
|
20043
20051
|
const config = readJson(permPath);
|
|
20044
20052
|
const list = config.mcpAllowlist ?? [];
|
|
20045
20053
|
if (!list.includes(CURSOR_ALLOWLIST_PATTERN)) {
|
|
@@ -20049,8 +20057,8 @@ var cursorAdapter = {
|
|
|
20049
20057
|
}
|
|
20050
20058
|
},
|
|
20051
20059
|
removeAllowlist() {
|
|
20052
|
-
const permPath =
|
|
20053
|
-
if (!
|
|
20060
|
+
const permPath = path7.join(homedir4(), ".cursor", "permissions.json");
|
|
20061
|
+
if (!fs7.existsSync(permPath)) return;
|
|
20054
20062
|
const config = readJson(permPath);
|
|
20055
20063
|
const list = config.mcpAllowlist;
|
|
20056
20064
|
if (!Array.isArray(list)) return;
|
|
@@ -20064,13 +20072,13 @@ var cursorAdapter = {
|
|
|
20064
20072
|
var claudeAdapter = {
|
|
20065
20073
|
name: "Claude Code",
|
|
20066
20074
|
detect() {
|
|
20067
|
-
return
|
|
20075
|
+
return fs7.existsSync(path7.join(process.cwd(), ".mcp.json")) || fs7.existsSync(path7.join(homedir4(), ".claude.json")) || dirExists(path7.join(process.cwd(), ".claude")) || dirExists(path7.join(homedir4(), ".claude"));
|
|
20068
20076
|
},
|
|
20069
20077
|
projectPath(root) {
|
|
20070
|
-
return
|
|
20078
|
+
return path7.join(root, ".mcp.json");
|
|
20071
20079
|
},
|
|
20072
20080
|
globalPath() {
|
|
20073
|
-
return
|
|
20081
|
+
return path7.join(homedir4(), ".claude.json");
|
|
20074
20082
|
},
|
|
20075
20083
|
write(configPath, entry) {
|
|
20076
20084
|
const config = readJson(configPath);
|
|
@@ -20085,7 +20093,7 @@ var claudeAdapter = {
|
|
|
20085
20093
|
writeJson(configPath, config);
|
|
20086
20094
|
},
|
|
20087
20095
|
remove(configPath) {
|
|
20088
|
-
if (!
|
|
20096
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20089
20097
|
const config = readJson(configPath);
|
|
20090
20098
|
const servers = config.mcpServers;
|
|
20091
20099
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20094,7 +20102,7 @@ var claudeAdapter = {
|
|
|
20094
20102
|
return true;
|
|
20095
20103
|
},
|
|
20096
20104
|
hasArgentEntry(configPath) {
|
|
20097
|
-
if (!
|
|
20105
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20098
20106
|
const config = readJson(configPath);
|
|
20099
20107
|
const servers = config.mcpServers;
|
|
20100
20108
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
@@ -20109,10 +20117,10 @@ var claudeAdapter = {
|
|
|
20109
20117
|
var vscodeAdapter = {
|
|
20110
20118
|
name: "VS Code",
|
|
20111
20119
|
detect() {
|
|
20112
|
-
return dirExists(
|
|
20120
|
+
return dirExists(path7.join(process.cwd(), ".vscode")) || dirExists(path7.join(homedir4(), ".vscode"));
|
|
20113
20121
|
},
|
|
20114
20122
|
projectPath(root) {
|
|
20115
|
-
return
|
|
20123
|
+
return path7.join(root, ".vscode", "mcp.json");
|
|
20116
20124
|
},
|
|
20117
20125
|
globalPath() {
|
|
20118
20126
|
return null;
|
|
@@ -20130,7 +20138,7 @@ var vscodeAdapter = {
|
|
|
20130
20138
|
writeJson(configPath, config);
|
|
20131
20139
|
},
|
|
20132
20140
|
remove(configPath) {
|
|
20133
|
-
if (!
|
|
20141
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20134
20142
|
const config = readJson(configPath);
|
|
20135
20143
|
const servers = config.servers;
|
|
20136
20144
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20139,7 +20147,7 @@ var vscodeAdapter = {
|
|
|
20139
20147
|
return true;
|
|
20140
20148
|
},
|
|
20141
20149
|
hasArgentEntry(configPath) {
|
|
20142
|
-
if (!
|
|
20150
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20143
20151
|
const config = readJson(configPath);
|
|
20144
20152
|
const servers = config.servers;
|
|
20145
20153
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
@@ -20148,13 +20156,13 @@ var vscodeAdapter = {
|
|
|
20148
20156
|
var windsurfAdapter = {
|
|
20149
20157
|
name: "Windsurf",
|
|
20150
20158
|
detect() {
|
|
20151
|
-
return dirExists(
|
|
20159
|
+
return dirExists(path7.join(homedir4(), ".codeium", "windsurf"));
|
|
20152
20160
|
},
|
|
20153
20161
|
projectPath() {
|
|
20154
20162
|
return null;
|
|
20155
20163
|
},
|
|
20156
20164
|
globalPath() {
|
|
20157
|
-
return
|
|
20165
|
+
return path7.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
20158
20166
|
},
|
|
20159
20167
|
write(configPath, entry) {
|
|
20160
20168
|
const config = readJson(configPath);
|
|
@@ -20168,7 +20176,7 @@ var windsurfAdapter = {
|
|
|
20168
20176
|
writeJson(configPath, config);
|
|
20169
20177
|
},
|
|
20170
20178
|
remove(configPath) {
|
|
20171
|
-
if (!
|
|
20179
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20172
20180
|
const config = readJson(configPath);
|
|
20173
20181
|
const servers = config.mcpServers;
|
|
20174
20182
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20177,13 +20185,13 @@ var windsurfAdapter = {
|
|
|
20177
20185
|
return true;
|
|
20178
20186
|
},
|
|
20179
20187
|
hasArgentEntry(configPath) {
|
|
20180
|
-
if (!
|
|
20188
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20181
20189
|
const config = readJson(configPath);
|
|
20182
20190
|
const servers = config.mcpServers;
|
|
20183
20191
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
20184
20192
|
},
|
|
20185
20193
|
addAllowlist() {
|
|
20186
|
-
const configPath =
|
|
20194
|
+
const configPath = path7.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
20187
20195
|
const config = readJson(configPath);
|
|
20188
20196
|
const servers = config.mcpServers ?? {};
|
|
20189
20197
|
const entry = servers[MCP_SERVER_KEY];
|
|
@@ -20192,8 +20200,8 @@ var windsurfAdapter = {
|
|
|
20192
20200
|
writeJson(configPath, config);
|
|
20193
20201
|
},
|
|
20194
20202
|
removeAllowlist() {
|
|
20195
|
-
const configPath =
|
|
20196
|
-
if (!
|
|
20203
|
+
const configPath = path7.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
20204
|
+
if (!fs7.existsSync(configPath)) return;
|
|
20197
20205
|
const config = readJson(configPath);
|
|
20198
20206
|
const servers = config.mcpServers ?? {};
|
|
20199
20207
|
const entry = servers[MCP_SERVER_KEY];
|
|
@@ -20205,13 +20213,13 @@ var windsurfAdapter = {
|
|
|
20205
20213
|
var zedAdapter = {
|
|
20206
20214
|
name: "Zed",
|
|
20207
20215
|
detect() {
|
|
20208
|
-
return dirExists(
|
|
20216
|
+
return dirExists(path7.join(homedir4(), ".config", "zed"));
|
|
20209
20217
|
},
|
|
20210
20218
|
projectPath(root) {
|
|
20211
|
-
return
|
|
20219
|
+
return path7.join(root, ".zed", "settings.json");
|
|
20212
20220
|
},
|
|
20213
20221
|
globalPath() {
|
|
20214
|
-
return
|
|
20222
|
+
return path7.join(homedir4(), ".config", "zed", "settings.json");
|
|
20215
20223
|
},
|
|
20216
20224
|
// Zed's settings.json is JSONC (line + block comments, trailing commas).
|
|
20217
20225
|
// The previous JSON.parse → mutate → JSON.stringify path silently stripped
|
|
@@ -20227,7 +20235,7 @@ var zedAdapter = {
|
|
|
20227
20235
|
});
|
|
20228
20236
|
},
|
|
20229
20237
|
remove(configPath) {
|
|
20230
|
-
if (!
|
|
20238
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20231
20239
|
const config = readJsonc(configPath);
|
|
20232
20240
|
const servers = config.context_servers;
|
|
20233
20241
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20235,7 +20243,7 @@ var zedAdapter = {
|
|
|
20235
20243
|
return true;
|
|
20236
20244
|
},
|
|
20237
20245
|
hasArgentEntry(configPath) {
|
|
20238
|
-
if (!
|
|
20246
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20239
20247
|
const config = readJsonc(configPath);
|
|
20240
20248
|
const servers = config.context_servers;
|
|
20241
20249
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
@@ -20245,12 +20253,12 @@ var zedAdapter = {
|
|
|
20245
20253
|
// documented opt-in; built-in security rules still protect against
|
|
20246
20254
|
// destructive operations.
|
|
20247
20255
|
addAllowlist(root, scope) {
|
|
20248
|
-
const settingsPath = scope === "global" ?
|
|
20256
|
+
const settingsPath = scope === "global" ? path7.join(homedir4(), ".config", "zed", "settings.json") : path7.join(root, ".zed", "settings.json");
|
|
20249
20257
|
editJsoncFile(settingsPath, ["agent", "tool_permissions", "default"], "allow");
|
|
20250
20258
|
},
|
|
20251
20259
|
removeAllowlist(root, scope) {
|
|
20252
|
-
const settingsPath = scope === "global" ?
|
|
20253
|
-
if (!
|
|
20260
|
+
const settingsPath = scope === "global" ? path7.join(homedir4(), ".config", "zed", "settings.json") : path7.join(root, ".zed", "settings.json");
|
|
20261
|
+
if (!fs7.existsSync(settingsPath)) return;
|
|
20254
20262
|
const config = readJsonc(settingsPath);
|
|
20255
20263
|
const perms = config.agent?.tool_permissions;
|
|
20256
20264
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -20260,13 +20268,13 @@ var zedAdapter = {
|
|
|
20260
20268
|
var geminiAdapter = {
|
|
20261
20269
|
name: "Gemini",
|
|
20262
20270
|
detect() {
|
|
20263
|
-
return dirExists(
|
|
20271
|
+
return dirExists(path7.join(homedir4(), ".gemini")) || dirExists(path7.join(process.cwd(), ".gemini"));
|
|
20264
20272
|
},
|
|
20265
20273
|
projectPath(root) {
|
|
20266
|
-
return
|
|
20274
|
+
return path7.join(root, ".gemini", "settings.json");
|
|
20267
20275
|
},
|
|
20268
20276
|
globalPath() {
|
|
20269
|
-
return
|
|
20277
|
+
return path7.join(homedir4(), ".gemini", "settings.json");
|
|
20270
20278
|
},
|
|
20271
20279
|
write(configPath, entry) {
|
|
20272
20280
|
const config = readJson(configPath);
|
|
@@ -20280,7 +20288,7 @@ var geminiAdapter = {
|
|
|
20280
20288
|
writeJson(configPath, config);
|
|
20281
20289
|
},
|
|
20282
20290
|
remove(configPath) {
|
|
20283
|
-
if (!
|
|
20291
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20284
20292
|
const config = readJson(configPath);
|
|
20285
20293
|
const servers = config.mcpServers;
|
|
20286
20294
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20289,7 +20297,7 @@ var geminiAdapter = {
|
|
|
20289
20297
|
return true;
|
|
20290
20298
|
},
|
|
20291
20299
|
hasArgentEntry(configPath) {
|
|
20292
|
-
if (!
|
|
20300
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20293
20301
|
const config = readJson(configPath);
|
|
20294
20302
|
const servers = config.mcpServers;
|
|
20295
20303
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
@@ -20308,7 +20316,7 @@ var geminiAdapter = {
|
|
|
20308
20316
|
},
|
|
20309
20317
|
removeAllowlist(root, scope) {
|
|
20310
20318
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
20311
|
-
if (!configPath || !
|
|
20319
|
+
if (!configPath || !fs7.existsSync(configPath)) {
|
|
20312
20320
|
return;
|
|
20313
20321
|
}
|
|
20314
20322
|
const config = readJson(configPath);
|
|
@@ -20323,13 +20331,13 @@ var CODEX_FILENAME = ".codex";
|
|
|
20323
20331
|
var codexAdapter = {
|
|
20324
20332
|
name: "Codex",
|
|
20325
20333
|
detect() {
|
|
20326
|
-
return dirExists(
|
|
20334
|
+
return dirExists(path7.join(homedir4(), CODEX_FILENAME)) || dirExists(path7.join(process.cwd(), CODEX_FILENAME));
|
|
20327
20335
|
},
|
|
20328
20336
|
projectPath(root) {
|
|
20329
|
-
return
|
|
20337
|
+
return path7.join(root, CODEX_FILENAME, "config.toml");
|
|
20330
20338
|
},
|
|
20331
20339
|
globalPath() {
|
|
20332
|
-
return
|
|
20340
|
+
return path7.join(homedir4(), CODEX_FILENAME, "config.toml");
|
|
20333
20341
|
},
|
|
20334
20342
|
write(configPath, entry) {
|
|
20335
20343
|
const config = readToml(configPath);
|
|
@@ -20343,7 +20351,7 @@ var codexAdapter = {
|
|
|
20343
20351
|
writeToml(configPath, config);
|
|
20344
20352
|
},
|
|
20345
20353
|
remove(configPath) {
|
|
20346
|
-
if (!
|
|
20354
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20347
20355
|
const config = readToml(configPath);
|
|
20348
20356
|
const servers = config.mcp_servers;
|
|
20349
20357
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20352,7 +20360,7 @@ var codexAdapter = {
|
|
|
20352
20360
|
return true;
|
|
20353
20361
|
},
|
|
20354
20362
|
hasArgentEntry(configPath) {
|
|
20355
|
-
if (!
|
|
20363
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20356
20364
|
const config = readToml(configPath);
|
|
20357
20365
|
const servers = config.mcp_servers;
|
|
20358
20366
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
@@ -20397,13 +20405,13 @@ var codexAdapter = {
|
|
|
20397
20405
|
var hermesAdapter = {
|
|
20398
20406
|
name: "Hermes",
|
|
20399
20407
|
detect() {
|
|
20400
|
-
return dirExists(
|
|
20408
|
+
return dirExists(path7.join(homedir4(), ".hermes"));
|
|
20401
20409
|
},
|
|
20402
20410
|
projectPath() {
|
|
20403
20411
|
return null;
|
|
20404
20412
|
},
|
|
20405
20413
|
globalPath() {
|
|
20406
|
-
return
|
|
20414
|
+
return path7.join(homedir4(), ".hermes", "config.yaml");
|
|
20407
20415
|
},
|
|
20408
20416
|
write(configPath, entry) {
|
|
20409
20417
|
const doc = readYaml(configPath);
|
|
@@ -20422,7 +20430,7 @@ var hermesAdapter = {
|
|
|
20422
20430
|
writeYaml(configPath, doc);
|
|
20423
20431
|
},
|
|
20424
20432
|
remove(configPath) {
|
|
20425
|
-
if (!
|
|
20433
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20426
20434
|
const doc = readYaml(configPath);
|
|
20427
20435
|
const servers = doc.get("mcp_servers");
|
|
20428
20436
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -20435,7 +20443,7 @@ var hermesAdapter = {
|
|
|
20435
20443
|
return true;
|
|
20436
20444
|
},
|
|
20437
20445
|
hasArgentEntry(configPath) {
|
|
20438
|
-
if (!
|
|
20446
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20439
20447
|
const doc = readYaml(configPath);
|
|
20440
20448
|
const servers = doc.get("mcp_servers");
|
|
20441
20449
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -20457,10 +20465,10 @@ function hasOpenCodeBinary() {
|
|
|
20457
20465
|
}
|
|
20458
20466
|
function pickOpencodeConfig(dir, candidates) {
|
|
20459
20467
|
for (const name of candidates) {
|
|
20460
|
-
const candidate =
|
|
20461
|
-
if (
|
|
20468
|
+
const candidate = path7.join(dir, name);
|
|
20469
|
+
if (fs7.existsSync(candidate)) return candidate;
|
|
20462
20470
|
}
|
|
20463
|
-
return
|
|
20471
|
+
return path7.join(dir, "opencode.json");
|
|
20464
20472
|
}
|
|
20465
20473
|
var openCodeAdapter = {
|
|
20466
20474
|
name: "opencode",
|
|
@@ -20471,7 +20479,7 @@ var openCodeAdapter = {
|
|
|
20471
20479
|
return pickOpencodeConfig(root, OPENCODE_PROJECT_FILES);
|
|
20472
20480
|
},
|
|
20473
20481
|
globalPath() {
|
|
20474
|
-
return pickOpencodeConfig(
|
|
20482
|
+
return pickOpencodeConfig(path7.join(homedir4(), ".config", "opencode"), OPENCODE_GLOBAL_FILES);
|
|
20475
20483
|
},
|
|
20476
20484
|
write(configPath, entry) {
|
|
20477
20485
|
editJsoncFile(configPath, ["mcp", MCP_SERVER_KEY], {
|
|
@@ -20482,7 +20490,7 @@ var openCodeAdapter = {
|
|
|
20482
20490
|
});
|
|
20483
20491
|
},
|
|
20484
20492
|
remove(configPath) {
|
|
20485
|
-
if (!
|
|
20493
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20486
20494
|
const config = readJsonc(configPath);
|
|
20487
20495
|
const servers = config.mcp;
|
|
20488
20496
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20490,7 +20498,7 @@ var openCodeAdapter = {
|
|
|
20490
20498
|
return true;
|
|
20491
20499
|
},
|
|
20492
20500
|
hasArgentEntry(configPath) {
|
|
20493
|
-
if (!
|
|
20501
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20494
20502
|
const config = readJsonc(configPath);
|
|
20495
20503
|
const servers = config.mcp;
|
|
20496
20504
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
@@ -20502,7 +20510,7 @@ var openCodeAdapter = {
|
|
|
20502
20510
|
},
|
|
20503
20511
|
removeAllowlist(root, scope) {
|
|
20504
20512
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
20505
|
-
if (!configPath || !
|
|
20513
|
+
if (!configPath || !fs7.existsSync(configPath)) return;
|
|
20506
20514
|
const config = readJsonc(configPath);
|
|
20507
20515
|
const tools = config.tools;
|
|
20508
20516
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -20513,13 +20521,13 @@ var KIRO_AUTO_APPROVE_ALL = ["*"];
|
|
|
20513
20521
|
var kiroAdapter = {
|
|
20514
20522
|
name: "Kiro",
|
|
20515
20523
|
detect() {
|
|
20516
|
-
return dirExists(
|
|
20524
|
+
return dirExists(path7.join(homedir4(), ".kiro")) || dirExists(path7.join(process.cwd(), ".kiro"));
|
|
20517
20525
|
},
|
|
20518
20526
|
projectPath(root) {
|
|
20519
|
-
return
|
|
20527
|
+
return path7.join(root, ".kiro", "settings", "mcp.json");
|
|
20520
20528
|
},
|
|
20521
20529
|
globalPath() {
|
|
20522
|
-
return
|
|
20530
|
+
return path7.join(homedir4(), ".kiro", "settings", "mcp.json");
|
|
20523
20531
|
},
|
|
20524
20532
|
write(configPath, entry) {
|
|
20525
20533
|
const config = readJson(configPath);
|
|
@@ -20533,7 +20541,7 @@ var kiroAdapter = {
|
|
|
20533
20541
|
writeJson(configPath, config);
|
|
20534
20542
|
},
|
|
20535
20543
|
remove(configPath) {
|
|
20536
|
-
if (!
|
|
20544
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20537
20545
|
const config = readJson(configPath);
|
|
20538
20546
|
const servers = config.mcpServers;
|
|
20539
20547
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -20542,7 +20550,7 @@ var kiroAdapter = {
|
|
|
20542
20550
|
return true;
|
|
20543
20551
|
},
|
|
20544
20552
|
hasArgentEntry(configPath) {
|
|
20545
|
-
if (!
|
|
20553
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20546
20554
|
const config = readJson(configPath);
|
|
20547
20555
|
const servers = config.mcpServers;
|
|
20548
20556
|
return Boolean(servers?.[MCP_SERVER_KEY]);
|
|
@@ -20559,7 +20567,7 @@ var kiroAdapter = {
|
|
|
20559
20567
|
},
|
|
20560
20568
|
removeAllowlist(root, scope) {
|
|
20561
20569
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
20562
|
-
if (!configPath || !
|
|
20570
|
+
if (!configPath || !fs7.existsSync(configPath)) return;
|
|
20563
20571
|
const config = readJson(configPath);
|
|
20564
20572
|
const servers = config.mcpServers;
|
|
20565
20573
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -20605,7 +20613,7 @@ function findConfiguredAdapterScopes(adapters, projectRoot) {
|
|
|
20605
20613
|
return results;
|
|
20606
20614
|
}
|
|
20607
20615
|
function addClaudePermission(root, scope) {
|
|
20608
|
-
const settingsPath = scope === "global" ?
|
|
20616
|
+
const settingsPath = scope === "global" ? path7.join(homedir4(), ".claude", "settings.json") : path7.join(root, ".claude", "settings.json");
|
|
20609
20617
|
const config = readJson(settingsPath);
|
|
20610
20618
|
const permissions = config.permissions ?? {};
|
|
20611
20619
|
const allow = permissions.allow ?? [];
|
|
@@ -20617,8 +20625,8 @@ function addClaudePermission(root, scope) {
|
|
|
20617
20625
|
}
|
|
20618
20626
|
}
|
|
20619
20627
|
function removeClaudePermission(root, scope) {
|
|
20620
|
-
const settingsPath = scope === "global" ?
|
|
20621
|
-
if (!
|
|
20628
|
+
const settingsPath = scope === "global" ? path7.join(homedir4(), ".claude", "settings.json") : path7.join(root, ".claude", "settings.json");
|
|
20629
|
+
if (!fs7.existsSync(settingsPath)) return;
|
|
20622
20630
|
const config = readJson(settingsPath);
|
|
20623
20631
|
const allow = config?.permissions?.allow;
|
|
20624
20632
|
if (!Array.isArray(allow)) return;
|
|
@@ -20628,12 +20636,12 @@ function removeClaudePermission(root, scope) {
|
|
|
20628
20636
|
writeJsonOrRemove(settingsPath, config);
|
|
20629
20637
|
}
|
|
20630
20638
|
function formatManagedPathLabel(targetPath, root) {
|
|
20631
|
-
const home =
|
|
20632
|
-
if (targetPath === home || targetPath.startsWith(`${home}${
|
|
20639
|
+
const home = homedir4();
|
|
20640
|
+
if (targetPath === home || targetPath.startsWith(`${home}${path7.sep}`)) {
|
|
20633
20641
|
return `~${targetPath.slice(home.length)}`;
|
|
20634
20642
|
}
|
|
20635
|
-
const relative3 =
|
|
20636
|
-
if (relative3 && !relative3.startsWith("..") && !
|
|
20643
|
+
const relative3 = path7.relative(root, targetPath);
|
|
20644
|
+
if (relative3 && !relative3.startsWith("..") && !path7.isAbsolute(relative3)) {
|
|
20637
20645
|
return relative3;
|
|
20638
20646
|
}
|
|
20639
20647
|
return targetPath;
|
|
@@ -20647,7 +20655,7 @@ function addManagedTarget(targets, editorName, targetPath, root) {
|
|
|
20647
20655
|
}
|
|
20648
20656
|
function getAdapterBasePath(adapter, root, scope) {
|
|
20649
20657
|
const configPath = scope === "global" ? adapter.globalPath() : adapter.projectPath(root);
|
|
20650
|
-
return configPath ?
|
|
20658
|
+
return configPath ? path7.dirname(configPath) : null;
|
|
20651
20659
|
}
|
|
20652
20660
|
function getManagedContentTargets(adapters, root, scope) {
|
|
20653
20661
|
const targets = {
|
|
@@ -20657,17 +20665,17 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
20657
20665
|
codexConfigTargets: [],
|
|
20658
20666
|
skillsLockTargets: []
|
|
20659
20667
|
};
|
|
20660
|
-
const workspaceBase = scope === "global" ?
|
|
20668
|
+
const workspaceBase = scope === "global" ? homedir4() : root;
|
|
20661
20669
|
addManagedTarget(
|
|
20662
20670
|
targets.skillTargets,
|
|
20663
20671
|
"skills",
|
|
20664
|
-
|
|
20672
|
+
path7.join(workspaceBase, ".agents", "skills"),
|
|
20665
20673
|
root
|
|
20666
20674
|
);
|
|
20667
20675
|
addManagedTarget(
|
|
20668
20676
|
targets.skillsLockTargets,
|
|
20669
20677
|
"skills",
|
|
20670
|
-
|
|
20678
|
+
path7.join(workspaceBase, "skills-lock.json"),
|
|
20671
20679
|
root
|
|
20672
20680
|
);
|
|
20673
20681
|
for (const adapter of adapters) {
|
|
@@ -20675,21 +20683,21 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
20675
20683
|
case "Cursor": {
|
|
20676
20684
|
const base = getAdapterBasePath(adapter, root, scope);
|
|
20677
20685
|
if (!base) break;
|
|
20678
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
20679
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
20686
|
+
addManagedTarget(targets.skillTargets, adapter.name, path7.join(base, "skills"), root);
|
|
20687
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path7.join(base, "rules"), root);
|
|
20680
20688
|
break;
|
|
20681
20689
|
}
|
|
20682
20690
|
case "Claude Code": {
|
|
20683
|
-
const claudeBase = scope === "global" ?
|
|
20684
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
20685
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
20686
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
20691
|
+
const claudeBase = scope === "global" ? path7.join(homedir4(), ".claude") : path7.join(root, ".claude");
|
|
20692
|
+
addManagedTarget(targets.skillTargets, adapter.name, path7.join(claudeBase, "skills"), root);
|
|
20693
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path7.join(claudeBase, "rules"), root);
|
|
20694
|
+
addManagedTarget(targets.agentTargets, adapter.name, path7.join(claudeBase, "agents"), root);
|
|
20687
20695
|
break;
|
|
20688
20696
|
}
|
|
20689
20697
|
case "Gemini": {
|
|
20690
|
-
const geminiBase = scope === "global" ?
|
|
20691
|
-
addManagedTarget(targets.ruleTargets, adapter.name,
|
|
20692
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
20698
|
+
const geminiBase = scope === "global" ? path7.join(homedir4(), ".gemini") : path7.join(root, ".gemini");
|
|
20699
|
+
addManagedTarget(targets.ruleTargets, adapter.name, path7.join(geminiBase, "rules"), root);
|
|
20700
|
+
addManagedTarget(targets.agentTargets, adapter.name, path7.join(geminiBase, "agents"), root);
|
|
20693
20701
|
break;
|
|
20694
20702
|
}
|
|
20695
20703
|
case "Codex": {
|
|
@@ -20699,9 +20707,9 @@ function getManagedContentTargets(adapters, root, scope) {
|
|
|
20699
20707
|
break;
|
|
20700
20708
|
}
|
|
20701
20709
|
case "opencode": {
|
|
20702
|
-
const base = scope === "global" ?
|
|
20703
|
-
addManagedTarget(targets.skillTargets, adapter.name,
|
|
20704
|
-
addManagedTarget(targets.agentTargets, adapter.name,
|
|
20710
|
+
const base = scope === "global" ? path7.join(homedir4(), ".config", "opencode") : path7.join(root, ".opencode");
|
|
20711
|
+
addManagedTarget(targets.skillTargets, adapter.name, path7.join(base, "skills"), root);
|
|
20712
|
+
addManagedTarget(targets.agentTargets, adapter.name, path7.join(base, "agents"), root);
|
|
20705
20713
|
break;
|
|
20706
20714
|
}
|
|
20707
20715
|
}
|
|
@@ -20715,12 +20723,12 @@ function stripFrontmatter(content) {
|
|
|
20715
20723
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
20716
20724
|
}
|
|
20717
20725
|
function readAndConcatRules(rulesDir) {
|
|
20718
|
-
if (!
|
|
20719
|
-
const files =
|
|
20726
|
+
if (!fs7.existsSync(rulesDir)) return null;
|
|
20727
|
+
const files = fs7.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
20720
20728
|
if (files.length === 0) return null;
|
|
20721
20729
|
const parts = [];
|
|
20722
20730
|
for (const file of files) {
|
|
20723
|
-
const raw =
|
|
20731
|
+
const raw = fs7.readFileSync(path7.join(rulesDir, file), "utf8");
|
|
20724
20732
|
const stripped = stripFrontmatter(raw);
|
|
20725
20733
|
if (stripped) parts.push(stripped);
|
|
20726
20734
|
}
|
|
@@ -20755,7 +20763,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
20755
20763
|
return configPath;
|
|
20756
20764
|
}
|
|
20757
20765
|
function removeCodexRules(configPath) {
|
|
20758
|
-
if (!
|
|
20766
|
+
if (!fs7.existsSync(configPath)) return false;
|
|
20759
20767
|
const config = readToml(configPath);
|
|
20760
20768
|
const existing = config.developer_instructions;
|
|
20761
20769
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -20773,9 +20781,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
20773
20781
|
const managedTargets = getManagedContentTargets(adapters, root, scope);
|
|
20774
20782
|
for (const target of managedTargets.ruleTargets) {
|
|
20775
20783
|
try {
|
|
20776
|
-
if (
|
|
20777
|
-
|
|
20778
|
-
|
|
20784
|
+
if (fs7.existsSync(rulesDir)) {
|
|
20785
|
+
fs7.mkdirSync(target.targetPath, { recursive: true });
|
|
20786
|
+
fs7.cpSync(rulesDir, target.targetPath, { recursive: true });
|
|
20779
20787
|
results.push(` Copied rules to ${target.targetPath}`);
|
|
20780
20788
|
}
|
|
20781
20789
|
} catch (err) {
|
|
@@ -20784,9 +20792,9 @@ function copyRulesAndAgents(adapters, root, scope, rulesDir, agentsDir) {
|
|
|
20784
20792
|
}
|
|
20785
20793
|
for (const target of managedTargets.agentTargets) {
|
|
20786
20794
|
try {
|
|
20787
|
-
if (
|
|
20788
|
-
|
|
20789
|
-
|
|
20795
|
+
if (fs7.existsSync(agentsDir)) {
|
|
20796
|
+
fs7.mkdirSync(target.targetPath, { recursive: true });
|
|
20797
|
+
fs7.cpSync(agentsDir, target.targetPath, { recursive: true });
|
|
20790
20798
|
results.push(` Copied agents to ${target.targetPath}`);
|
|
20791
20799
|
}
|
|
20792
20800
|
} catch (err) {
|
|
@@ -21014,7 +21022,7 @@ var INSTALL_UNCLASSIFIED_FAILED = {
|
|
|
21014
21022
|
error_kind: "unknown"
|
|
21015
21023
|
};
|
|
21016
21024
|
function runShellCommand(cmd) {
|
|
21017
|
-
return new Promise((
|
|
21025
|
+
return new Promise((resolve4, reject) => {
|
|
21018
21026
|
const isWin = process.platform === "win32";
|
|
21019
21027
|
const child = spawn(isWin ? `${cmd.bin}.cmd` : cmd.bin, cmd.args, {
|
|
21020
21028
|
stdio: ["ignore", "pipe", "pipe"],
|
|
@@ -21025,7 +21033,7 @@ function runShellCommand(cmd) {
|
|
|
21025
21033
|
stderr += chunk.toString();
|
|
21026
21034
|
});
|
|
21027
21035
|
child.on("close", (code) => {
|
|
21028
|
-
if (code === 0)
|
|
21036
|
+
if (code === 0) resolve4();
|
|
21029
21037
|
else reject(new Error(stderr.trim() || `Command exited with code ${code}`));
|
|
21030
21038
|
});
|
|
21031
21039
|
child.on("error", reject);
|
|
@@ -21204,7 +21212,7 @@ async function init2(args) {
|
|
|
21204
21212
|
updateSpinner.stop(import_picocolors3.default.green(`Updated to v${latest}.`));
|
|
21205
21213
|
version2 = getInstalledVersion() ?? version2;
|
|
21206
21214
|
await trackPackageAction("init_triggered_update", updateStartedAt, true);
|
|
21207
|
-
const skillRefreshResults = refreshArgentSkills(
|
|
21215
|
+
const skillRefreshResults = refreshArgentSkills(resolveProjectRoot2(process.cwd()));
|
|
21208
21216
|
const skillSummary = formatSkillRefreshSummary(skillRefreshResults);
|
|
21209
21217
|
if (skillSummary) {
|
|
21210
21218
|
note(skillSummary, "Skills Updated");
|
|
@@ -21320,8 +21328,8 @@ async function init2(args) {
|
|
|
21320
21328
|
placeholder: process.cwd(),
|
|
21321
21329
|
validate(value) {
|
|
21322
21330
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
21323
|
-
const resolved =
|
|
21324
|
-
if (!
|
|
21331
|
+
const resolved = resolve3(value.trim());
|
|
21332
|
+
if (!existsSync6(resolved))
|
|
21325
21333
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
21326
21334
|
}
|
|
21327
21335
|
});
|
|
@@ -21331,10 +21339,10 @@ async function init2(args) {
|
|
|
21331
21339
|
cancel("Initialization cancelled.");
|
|
21332
21340
|
process.exit(0);
|
|
21333
21341
|
}
|
|
21334
|
-
customRoot =
|
|
21342
|
+
customRoot = resolve3(customPathInput.trim());
|
|
21335
21343
|
}
|
|
21336
21344
|
}
|
|
21337
|
-
const projectRoot =
|
|
21345
|
+
const projectRoot = resolveProjectRoot2(process.cwd());
|
|
21338
21346
|
const effectiveRoot = scope === "custom" ? customRoot : projectRoot;
|
|
21339
21347
|
const normalizedScope = scope === "global" ? "global" : "local";
|
|
21340
21348
|
track("installation:editors_select", {
|
|
@@ -21604,7 +21612,7 @@ function printBanner() {
|
|
|
21604
21612
|
console.log();
|
|
21605
21613
|
}
|
|
21606
21614
|
function runNpxSkills(args, interactive, cwd) {
|
|
21607
|
-
return new Promise((
|
|
21615
|
+
return new Promise((resolve4, reject) => {
|
|
21608
21616
|
const npxCmd = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
21609
21617
|
const child = spawn(npxCmd, args, {
|
|
21610
21618
|
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
@@ -21623,7 +21631,7 @@ function runNpxSkills(args, interactive, cwd) {
|
|
|
21623
21631
|
}
|
|
21624
21632
|
child.on("close", (code) => {
|
|
21625
21633
|
if (code === 0) {
|
|
21626
|
-
|
|
21634
|
+
resolve4();
|
|
21627
21635
|
} else {
|
|
21628
21636
|
const output = [stderr, stdout2].filter(Boolean).join("\n").trim();
|
|
21629
21637
|
reject(new Error(output || `npx skills exited with code ${code}`));
|
|
@@ -21655,17 +21663,17 @@ async function resolveInstallableUpdateTarget(pm, current) {
|
|
|
21655
21663
|
|
|
21656
21664
|
// ../argent-tools-client/src/launcher.ts
|
|
21657
21665
|
import * as net from "node:net";
|
|
21658
|
-
import * as
|
|
21659
|
-
import * as
|
|
21666
|
+
import * as fs8 from "node:fs";
|
|
21667
|
+
import * as path8 from "node:path";
|
|
21660
21668
|
import * as readline from "node:readline";
|
|
21661
|
-
import { homedir as
|
|
21669
|
+
import { homedir as homedir5 } from "node:os";
|
|
21662
21670
|
import { spawn as spawn2, execFileSync as execFileSync3 } from "node:child_process";
|
|
21663
21671
|
import { randomBytes } from "node:crypto";
|
|
21664
21672
|
import { mkdir, writeFile, readFile, unlink, rename, chmod } from "node:fs/promises";
|
|
21665
|
-
var STATE_DIR =
|
|
21666
|
-
var STATE_FILE =
|
|
21667
|
-
var LOG_FILE =
|
|
21668
|
-
var LOCK_FILE =
|
|
21673
|
+
var STATE_DIR = path8.join(homedir5(), ".argent");
|
|
21674
|
+
var STATE_FILE = path8.join(STATE_DIR, "tool-server.json");
|
|
21675
|
+
var LOG_FILE = path8.join(STATE_DIR, "tool-server.log");
|
|
21676
|
+
var LOCK_FILE = path8.join(STATE_DIR, "tool-server.lock");
|
|
21669
21677
|
function isProcessAlive(pid) {
|
|
21670
21678
|
try {
|
|
21671
21679
|
process.kill(pid, 0);
|
|
@@ -21726,22 +21734,22 @@ async function killToolServer() {
|
|
|
21726
21734
|
}
|
|
21727
21735
|
|
|
21728
21736
|
// ../argent-tools-client/src/link-config.ts
|
|
21729
|
-
import * as
|
|
21730
|
-
import { homedir as
|
|
21737
|
+
import * as path9 from "node:path";
|
|
21738
|
+
import { homedir as homedir6 } from "node:os";
|
|
21731
21739
|
import { mkdir as mkdir2, writeFile as writeFile2, readFile as readFile2, unlink as unlink2, chmod as chmod2 } from "node:fs/promises";
|
|
21732
|
-
var LINK_DIR =
|
|
21733
|
-
var LINK_FILE =
|
|
21740
|
+
var LINK_DIR = path9.join(homedir6(), ".argent");
|
|
21741
|
+
var LINK_FILE = path9.join(LINK_DIR, "link.json");
|
|
21734
21742
|
|
|
21735
21743
|
// ../argent-tools-client/src/file-inputs.ts
|
|
21736
21744
|
import { mkdir as mkdir3, stat as stat2, writeFile as writeFile3 } from "node:fs/promises";
|
|
21737
21745
|
import { readFile as readFile3 } from "node:fs/promises";
|
|
21738
|
-
import * as
|
|
21746
|
+
import * as path10 from "node:path";
|
|
21739
21747
|
var MAX_CONTENT_BYTES = 32 * 1024 * 1024;
|
|
21740
21748
|
|
|
21741
21749
|
// ../argent-tools-client/src/artifacts.ts
|
|
21742
21750
|
import { mkdir as mkdir4, readFile as readFile4, rm, stat as stat3, writeFile as writeFile4 } from "node:fs/promises";
|
|
21743
21751
|
import { tmpdir } from "node:os";
|
|
21744
|
-
import { basename as basename2, join as
|
|
21752
|
+
import { basename as basename2, join as join11 } from "node:path";
|
|
21745
21753
|
import { createHash } from "node:crypto";
|
|
21746
21754
|
import { execFile } from "node:child_process";
|
|
21747
21755
|
import { promisify } from "node:util";
|
|
@@ -21996,7 +22004,7 @@ async function update(args) {
|
|
|
21996
22004
|
}
|
|
21997
22005
|
}
|
|
21998
22006
|
spinner2.start("Refreshing workspace configuration...");
|
|
21999
|
-
const projectRoot =
|
|
22007
|
+
const projectRoot = resolveProjectRoot2(process.cwd());
|
|
22000
22008
|
const mcpEntry = getMcpEntry();
|
|
22001
22009
|
const results = [];
|
|
22002
22010
|
const configuredScopes = findConfiguredAdapterScopes(ALL_ADAPTERS, projectRoot);
|
|
@@ -22058,8 +22066,8 @@ async function update(args) {
|
|
|
22058
22066
|
// ../argent-installer/src/uninstall.ts
|
|
22059
22067
|
var import_picocolors5 = __toESM(require_picocolors(), 1);
|
|
22060
22068
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
22061
|
-
import * as
|
|
22062
|
-
import * as
|
|
22069
|
+
import * as fs9 from "node:fs";
|
|
22070
|
+
import * as path11 from "node:path";
|
|
22063
22071
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
22064
22072
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
22065
22073
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
@@ -22081,10 +22089,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
22081
22089
|
};
|
|
22082
22090
|
function removeDirIfEmpty2(dirPath) {
|
|
22083
22091
|
try {
|
|
22084
|
-
if (!
|
|
22085
|
-
if (!
|
|
22086
|
-
if (
|
|
22087
|
-
|
|
22092
|
+
if (!fs9.existsSync(dirPath)) return false;
|
|
22093
|
+
if (!fs9.statSync(dirPath).isDirectory()) return false;
|
|
22094
|
+
if (fs9.readdirSync(dirPath).length > 0) return false;
|
|
22095
|
+
fs9.rmdirSync(dirPath);
|
|
22088
22096
|
return true;
|
|
22089
22097
|
} catch {
|
|
22090
22098
|
return false;
|
|
@@ -22094,9 +22102,9 @@ function collectBundledPaths(sourceDir) {
|
|
|
22094
22102
|
const files = [];
|
|
22095
22103
|
const directories = [];
|
|
22096
22104
|
function walk(currentDir, relativeDir = "") {
|
|
22097
|
-
for (const entry of
|
|
22098
|
-
const relativePath = relativeDir ?
|
|
22099
|
-
const absolutePath =
|
|
22105
|
+
for (const entry of fs9.readdirSync(currentDir, { withFileTypes: true })) {
|
|
22106
|
+
const relativePath = relativeDir ? path11.join(relativeDir, entry.name) : entry.name;
|
|
22107
|
+
const absolutePath = path11.join(currentDir, entry.name);
|
|
22100
22108
|
if (entry.isDirectory()) {
|
|
22101
22109
|
walk(absolutePath, relativePath);
|
|
22102
22110
|
directories.push(relativePath);
|
|
@@ -22109,52 +22117,52 @@ function collectBundledPaths(sourceDir) {
|
|
|
22109
22117
|
return { files, directories };
|
|
22110
22118
|
}
|
|
22111
22119
|
function removeBundledContent(sourceDir, targetDir) {
|
|
22112
|
-
if (!
|
|
22120
|
+
if (!fs9.existsSync(sourceDir) || !fs9.existsSync(targetDir)) {
|
|
22113
22121
|
return { removedPaths: [], removedRoot: false };
|
|
22114
22122
|
}
|
|
22115
22123
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
22116
22124
|
const removedPaths = [];
|
|
22117
22125
|
for (const relativePath of files) {
|
|
22118
|
-
const targetPath =
|
|
22126
|
+
const targetPath = path11.join(targetDir, relativePath);
|
|
22119
22127
|
try {
|
|
22120
|
-
if (!
|
|
22121
|
-
if (
|
|
22122
|
-
|
|
22128
|
+
if (!fs9.existsSync(targetPath)) continue;
|
|
22129
|
+
if (fs9.lstatSync(targetPath).isDirectory()) continue;
|
|
22130
|
+
fs9.rmSync(targetPath, { force: true });
|
|
22123
22131
|
removedPaths.push(relativePath);
|
|
22124
22132
|
} catch {
|
|
22125
22133
|
}
|
|
22126
22134
|
}
|
|
22127
22135
|
directories.sort(
|
|
22128
|
-
(a3, b) => b.split(
|
|
22136
|
+
(a3, b) => b.split(path11.sep).length - a3.split(path11.sep).length || b.length - a3.length
|
|
22129
22137
|
);
|
|
22130
22138
|
for (const relativePath of directories) {
|
|
22131
|
-
const targetPath =
|
|
22139
|
+
const targetPath = path11.join(targetDir, relativePath);
|
|
22132
22140
|
try {
|
|
22133
|
-
if (!
|
|
22134
|
-
if (!
|
|
22135
|
-
if (
|
|
22136
|
-
|
|
22141
|
+
if (!fs9.existsSync(targetPath)) continue;
|
|
22142
|
+
if (!fs9.statSync(targetPath).isDirectory()) continue;
|
|
22143
|
+
if (fs9.readdirSync(targetPath).length > 0) continue;
|
|
22144
|
+
fs9.rmdirSync(targetPath);
|
|
22137
22145
|
} catch {
|
|
22138
22146
|
}
|
|
22139
22147
|
}
|
|
22140
22148
|
let removedRoot = false;
|
|
22141
22149
|
try {
|
|
22142
|
-
if (
|
|
22143
|
-
if (
|
|
22144
|
-
|
|
22150
|
+
if (fs9.existsSync(targetDir) && fs9.statSync(targetDir).isDirectory()) {
|
|
22151
|
+
if (fs9.readdirSync(targetDir).length === 0) {
|
|
22152
|
+
fs9.rmdirSync(targetDir);
|
|
22145
22153
|
removedRoot = true;
|
|
22146
22154
|
}
|
|
22147
22155
|
}
|
|
22148
22156
|
} catch {
|
|
22149
22157
|
}
|
|
22150
22158
|
if (removedRoot) {
|
|
22151
|
-
removeDirIfEmpty2(
|
|
22159
|
+
removeDirIfEmpty2(path11.dirname(targetDir));
|
|
22152
22160
|
}
|
|
22153
22161
|
return { removedPaths, removedRoot };
|
|
22154
22162
|
}
|
|
22155
22163
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
22156
22164
|
try {
|
|
22157
|
-
const content =
|
|
22165
|
+
const content = fs9.readFileSync(skillFilePath, "utf8");
|
|
22158
22166
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
22159
22167
|
if (!frontmatter) return fallbackName;
|
|
22160
22168
|
const data = (0, import_yaml3.parse)(frontmatter);
|
|
@@ -22165,30 +22173,30 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
22165
22173
|
}
|
|
22166
22174
|
}
|
|
22167
22175
|
function getBundledSkillNames(skillsDir) {
|
|
22168
|
-
if (!
|
|
22176
|
+
if (!fs9.existsSync(skillsDir)) return [];
|
|
22169
22177
|
const skillNames = [];
|
|
22170
|
-
for (const entry of
|
|
22178
|
+
for (const entry of fs9.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
22171
22179
|
if (!entry.isDirectory()) continue;
|
|
22172
|
-
const skillFilePath =
|
|
22173
|
-
if (!
|
|
22180
|
+
const skillFilePath = path11.join(skillsDir, entry.name, "SKILL.md");
|
|
22181
|
+
if (!fs9.existsSync(skillFilePath)) continue;
|
|
22174
22182
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
22175
22183
|
}
|
|
22176
22184
|
return [...new Set(skillNames)].sort();
|
|
22177
22185
|
}
|
|
22178
22186
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
22179
|
-
if (!
|
|
22187
|
+
if (!fs9.existsSync(targetDir)) {
|
|
22180
22188
|
return { removedPaths: [], removedRoot: false };
|
|
22181
22189
|
}
|
|
22182
22190
|
const removedPaths = [];
|
|
22183
22191
|
for (const skillName of skillNames) {
|
|
22184
|
-
const targetPath =
|
|
22192
|
+
const targetPath = path11.join(targetDir, skillName);
|
|
22185
22193
|
try {
|
|
22186
|
-
if (!
|
|
22187
|
-
const stats =
|
|
22194
|
+
if (!fs9.existsSync(targetPath)) continue;
|
|
22195
|
+
const stats = fs9.lstatSync(targetPath);
|
|
22188
22196
|
if (stats.isDirectory() && !stats.isSymbolicLink()) {
|
|
22189
|
-
|
|
22197
|
+
fs9.rmSync(targetPath, { recursive: true, force: true });
|
|
22190
22198
|
} else {
|
|
22191
|
-
|
|
22199
|
+
fs9.rmSync(targetPath, { force: true });
|
|
22192
22200
|
}
|
|
22193
22201
|
removedPaths.push(skillName);
|
|
22194
22202
|
} catch {
|
|
@@ -22196,17 +22204,17 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
22196
22204
|
}
|
|
22197
22205
|
const removedRoot = removeDirIfEmpty2(targetDir);
|
|
22198
22206
|
if (removedRoot) {
|
|
22199
|
-
removeDirIfEmpty2(
|
|
22207
|
+
removeDirIfEmpty2(path11.dirname(targetDir));
|
|
22200
22208
|
}
|
|
22201
22209
|
return { removedPaths, removedRoot };
|
|
22202
22210
|
}
|
|
22203
22211
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
22204
|
-
if (!
|
|
22212
|
+
if (!fs9.existsSync(lockPath)) {
|
|
22205
22213
|
return { removedSkills: [], removedFile: false };
|
|
22206
22214
|
}
|
|
22207
22215
|
let parsed;
|
|
22208
22216
|
try {
|
|
22209
|
-
parsed = JSON.parse(
|
|
22217
|
+
parsed = JSON.parse(fs9.readFileSync(lockPath, "utf8"));
|
|
22210
22218
|
} catch {
|
|
22211
22219
|
return { removedSkills: [], removedFile: false };
|
|
22212
22220
|
}
|
|
@@ -22233,10 +22241,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
22233
22241
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
22234
22242
|
);
|
|
22235
22243
|
if (!hasSkills && otherKeys.length === 0) {
|
|
22236
|
-
|
|
22244
|
+
fs9.rmSync(lockPath, { force: true });
|
|
22237
22245
|
return { removedSkills, removedFile: true };
|
|
22238
22246
|
}
|
|
22239
|
-
|
|
22247
|
+
fs9.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
22240
22248
|
return { removedSkills, removedFile: false };
|
|
22241
22249
|
}
|
|
22242
22250
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -22306,7 +22314,7 @@ async function uninstall(args) {
|
|
|
22306
22314
|
process.exit(0);
|
|
22307
22315
|
}
|
|
22308
22316
|
}
|
|
22309
|
-
const projectRoot =
|
|
22317
|
+
const projectRoot = resolveProjectRoot2(process.cwd());
|
|
22310
22318
|
const results = [];
|
|
22311
22319
|
log.step(import_picocolors5.default.bold("Removing MCP server entries..."));
|
|
22312
22320
|
for (const adapter of ALL_ADAPTERS) {
|