@swmansion/argent 0.35.1-next.32 → 0.35.1-next.33
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 +240 -239
- package/dist/client.js +42 -41
- package/dist/installer.mjs +242 -241
- package/dist/mcp-server.mjs +47 -46
- package/dist/tool-server.cjs +398 -394
- package/package.json +2 -2
package/dist/installer.mjs
CHANGED
|
@@ -10456,14 +10456,14 @@ var require_parser = __commonJS({
|
|
|
10456
10456
|
case "scalar":
|
|
10457
10457
|
case "single-quoted-scalar":
|
|
10458
10458
|
case "double-quoted-scalar": {
|
|
10459
|
-
const
|
|
10459
|
+
const fs27 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs27, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs27);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs27, sep: [] });
|
|
10467
10467
|
this.onKeyLine = true;
|
|
10468
10468
|
}
|
|
10469
10469
|
return;
|
|
@@ -10591,13 +10591,13 @@ var require_parser = __commonJS({
|
|
|
10591
10591
|
case "scalar":
|
|
10592
10592
|
case "single-quoted-scalar":
|
|
10593
10593
|
case "double-quoted-scalar": {
|
|
10594
|
-
const
|
|
10594
|
+
const fs27 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs27, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs27);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs27, sep: [] });
|
|
10601
10601
|
return;
|
|
10602
10602
|
}
|
|
10603
10603
|
case "flow-map-end":
|
|
@@ -15137,7 +15137,7 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
15137
15137
|
init_esm();
|
|
15138
15138
|
|
|
15139
15139
|
// ../telemetry/src/debug.ts
|
|
15140
|
-
import * as
|
|
15140
|
+
import * as fs7 from "node:fs";
|
|
15141
15141
|
|
|
15142
15142
|
// ../telemetry/src/paths.ts
|
|
15143
15143
|
import * as path8 from "node:path";
|
|
@@ -15540,6 +15540,7 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
|
15540
15540
|
}
|
|
15541
15541
|
|
|
15542
15542
|
// ../configuration-core/src/config-access.ts
|
|
15543
|
+
import * as fs6 from "node:fs";
|
|
15543
15544
|
import * as path7 from "node:path";
|
|
15544
15545
|
function readScopeValue(def, scope, options) {
|
|
15545
15546
|
if (!def.scopes.includes(scope)) return void 0;
|
|
@@ -15617,8 +15618,8 @@ function emitDebugPayload(payload) {
|
|
|
15617
15618
|
} catch {
|
|
15618
15619
|
}
|
|
15619
15620
|
try {
|
|
15620
|
-
|
|
15621
|
-
|
|
15621
|
+
fs7.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15622
|
+
fs7.appendFileSync(debugLogPath(), line + "\n");
|
|
15622
15623
|
} catch {
|
|
15623
15624
|
}
|
|
15624
15625
|
}
|
|
@@ -15806,11 +15807,11 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
15806
15807
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15807
15808
|
|
|
15808
15809
|
// ../registry/src/flow-file-refs.ts
|
|
15809
|
-
import * as
|
|
15810
|
+
import * as fs9 from "node:fs/promises";
|
|
15810
15811
|
import * as path10 from "node:path";
|
|
15811
15812
|
|
|
15812
15813
|
// ../registry/src/e2e-dirs.ts
|
|
15813
|
-
import * as
|
|
15814
|
+
import * as fs8 from "node:fs/promises";
|
|
15814
15815
|
import * as path9 from "node:path";
|
|
15815
15816
|
var E2E_DIR = path9.join(".argent", "e2e");
|
|
15816
15817
|
var LEGACY_E2E_DIRS = Object.freeze([path9.join(".argent", "flows")]);
|
|
@@ -16664,7 +16665,7 @@ function sanitize(event, raw) {
|
|
|
16664
16665
|
import { randomUUID as randomUUID4 } from "node:crypto";
|
|
16665
16666
|
|
|
16666
16667
|
// ../telemetry/src/cloud-agent-detect.ts
|
|
16667
|
-
import { existsSync as
|
|
16668
|
+
import { existsSync as existsSync4 } from "node:fs";
|
|
16668
16669
|
var CLAUDE_CLOUD_ENV_KINDS = /* @__PURE__ */ new Set(["byoc", "anthropic_cloud"]);
|
|
16669
16670
|
var CLAUDE_REMOTE_ENTRYPOINTS = /* @__PURE__ */ new Set([
|
|
16670
16671
|
"remote",
|
|
@@ -16707,7 +16708,7 @@ function detectCloudAgent(env = process.env, opts = {}) {
|
|
|
16707
16708
|
if (isCursorCloud(env)) return "cursor";
|
|
16708
16709
|
if (isCopilotAgent(env)) return "copilot";
|
|
16709
16710
|
if (isReplitAgent(env)) return "replit";
|
|
16710
|
-
const fileExists = opts.fileExists ??
|
|
16711
|
+
const fileExists = opts.fileExists ?? existsSync4;
|
|
16711
16712
|
if (safeExists(fileExists, DEVIN_MARKER_PATH)) return "devin";
|
|
16712
16713
|
if (safeExists(fileExists, JULES_MARKER_PATH)) return "jules";
|
|
16713
16714
|
return null;
|
|
@@ -17117,7 +17118,7 @@ function isCi(env = process.env) {
|
|
|
17117
17118
|
var SESSION_ID = randomUUID4();
|
|
17118
17119
|
function readCliVersion() {
|
|
17119
17120
|
if (true) {
|
|
17120
|
-
return "0.35.1-next.
|
|
17121
|
+
return "0.35.1-next.33";
|
|
17121
17122
|
}
|
|
17122
17123
|
return "0.0.0";
|
|
17123
17124
|
}
|
|
@@ -17150,7 +17151,7 @@ function getBaseProps(runtime) {
|
|
|
17150
17151
|
|
|
17151
17152
|
// ../telemetry/src/identity.ts
|
|
17152
17153
|
import * as crypto2 from "node:crypto";
|
|
17153
|
-
import * as
|
|
17154
|
+
import * as fs10 from "node:fs";
|
|
17154
17155
|
import * as path11 from "node:path";
|
|
17155
17156
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17156
17157
|
var cached = null;
|
|
@@ -17258,17 +17259,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17258
17259
|
function isCorruptIdFile(filePath) {
|
|
17259
17260
|
let isRegularFile;
|
|
17260
17261
|
try {
|
|
17261
|
-
isRegularFile =
|
|
17262
|
+
isRegularFile = fs10.lstatSync(filePath).isFile();
|
|
17262
17263
|
} catch {
|
|
17263
17264
|
return false;
|
|
17264
17265
|
}
|
|
17265
17266
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17266
17267
|
}
|
|
17267
17268
|
function writeIdFileAtomic(finalPath, id) {
|
|
17268
|
-
|
|
17269
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17269
17270
|
let occupant;
|
|
17270
17271
|
try {
|
|
17271
|
-
occupant =
|
|
17272
|
+
occupant = fs10.lstatSync(finalPath);
|
|
17272
17273
|
} catch (err) {
|
|
17273
17274
|
if (err.code !== "ENOENT") throw err;
|
|
17274
17275
|
}
|
|
@@ -17279,24 +17280,24 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
17279
17280
|
argentHomeDir(),
|
|
17280
17281
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17281
17282
|
);
|
|
17282
|
-
const fd =
|
|
17283
|
+
const fd = fs10.openSync(tmpPath, "wx", 384);
|
|
17283
17284
|
try {
|
|
17284
17285
|
try {
|
|
17285
|
-
|
|
17286
|
-
|
|
17286
|
+
fs10.writeSync(fd, id);
|
|
17287
|
+
fs10.fsyncSync(fd);
|
|
17287
17288
|
} finally {
|
|
17288
|
-
|
|
17289
|
+
fs10.closeSync(fd);
|
|
17289
17290
|
}
|
|
17290
|
-
|
|
17291
|
+
fs10.renameSync(tmpPath, finalPath);
|
|
17291
17292
|
} finally {
|
|
17292
17293
|
try {
|
|
17293
|
-
|
|
17294
|
+
fs10.unlinkSync(tmpPath);
|
|
17294
17295
|
} catch {
|
|
17295
17296
|
}
|
|
17296
17297
|
}
|
|
17297
17298
|
}
|
|
17298
17299
|
function mintRandomId(finalPath) {
|
|
17299
|
-
|
|
17300
|
+
fs10.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17300
17301
|
let value = crypto2.randomUUID();
|
|
17301
17302
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17302
17303
|
const tmpPath = path11.join(
|
|
@@ -17305,19 +17306,19 @@ function mintRandomId(finalPath) {
|
|
|
17305
17306
|
);
|
|
17306
17307
|
let fd;
|
|
17307
17308
|
try {
|
|
17308
|
-
fd =
|
|
17309
|
+
fd = fs10.openSync(tmpPath, "wx", 384);
|
|
17309
17310
|
} catch (err) {
|
|
17310
17311
|
if (err.code === "EEXIST") continue;
|
|
17311
17312
|
throw err;
|
|
17312
17313
|
}
|
|
17313
17314
|
try {
|
|
17314
17315
|
try {
|
|
17315
|
-
|
|
17316
|
-
|
|
17316
|
+
fs10.writeSync(fd, value);
|
|
17317
|
+
fs10.fsyncSync(fd);
|
|
17317
17318
|
} finally {
|
|
17318
|
-
|
|
17319
|
+
fs10.closeSync(fd);
|
|
17319
17320
|
}
|
|
17320
|
-
|
|
17321
|
+
fs10.linkSync(tmpPath, finalPath);
|
|
17321
17322
|
cached = { path: finalPath, id: value };
|
|
17322
17323
|
return value;
|
|
17323
17324
|
} catch (err) {
|
|
@@ -17336,7 +17337,7 @@ function mintRandomId(finalPath) {
|
|
|
17336
17337
|
throw err;
|
|
17337
17338
|
} finally {
|
|
17338
17339
|
try {
|
|
17339
|
-
|
|
17340
|
+
fs10.unlinkSync(tmpPath);
|
|
17340
17341
|
} catch {
|
|
17341
17342
|
}
|
|
17342
17343
|
}
|
|
@@ -17349,7 +17350,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17349
17350
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17350
17351
|
);
|
|
17351
17352
|
try {
|
|
17352
|
-
|
|
17353
|
+
fs10.renameSync(finalPath, claimed);
|
|
17353
17354
|
} catch {
|
|
17354
17355
|
return null;
|
|
17355
17356
|
}
|
|
@@ -17358,7 +17359,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17358
17359
|
grabbed = tryReadId(claimed);
|
|
17359
17360
|
} finally {
|
|
17360
17361
|
try {
|
|
17361
|
-
|
|
17362
|
+
fs10.unlinkSync(claimed);
|
|
17362
17363
|
} catch {
|
|
17363
17364
|
}
|
|
17364
17365
|
}
|
|
@@ -17367,7 +17368,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17367
17368
|
function deleteAnonId() {
|
|
17368
17369
|
cached = null;
|
|
17369
17370
|
try {
|
|
17370
|
-
|
|
17371
|
+
fs10.unlinkSync(identityFilePath());
|
|
17371
17372
|
} catch (err) {
|
|
17372
17373
|
if (err.code !== "ENOENT") throw err;
|
|
17373
17374
|
}
|
|
@@ -17375,9 +17376,9 @@ function deleteAnonId() {
|
|
|
17375
17376
|
function tryReadId(filePath) {
|
|
17376
17377
|
let raw;
|
|
17377
17378
|
try {
|
|
17378
|
-
const stats =
|
|
17379
|
+
const stats = fs10.lstatSync(filePath);
|
|
17379
17380
|
if (!stats.isFile()) return null;
|
|
17380
|
-
raw =
|
|
17381
|
+
raw = fs10.readFileSync(filePath, "utf8");
|
|
17381
17382
|
} catch (err) {
|
|
17382
17383
|
if (err.code === "ENOENT") return null;
|
|
17383
17384
|
return null;
|
|
@@ -17392,7 +17393,7 @@ import { execFileSync, spawn } from "node:child_process";
|
|
|
17392
17393
|
|
|
17393
17394
|
// ../native-devtools-ios/src/index.ts
|
|
17394
17395
|
import * as path12 from "node:path";
|
|
17395
|
-
import * as
|
|
17396
|
+
import * as fs11 from "node:fs";
|
|
17396
17397
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path12.join(__dirname, "..", "dylibs");
|
|
17397
17398
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path12.join(__dirname, "..", "bin");
|
|
17398
17399
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path12.join(DYLIB_DIR, "tcp");
|
|
@@ -17412,9 +17413,9 @@ function platformBinDir() {
|
|
|
17412
17413
|
function simulatorServerBinaryPath() {
|
|
17413
17414
|
const binaryName = simulatorServerBinaryName();
|
|
17414
17415
|
const p = path12.join(platformBinDir(), binaryName);
|
|
17415
|
-
if (!
|
|
17416
|
+
if (!fs11.existsSync(p)) {
|
|
17416
17417
|
const flat = path12.join(BIN_DIR, binaryName);
|
|
17417
|
-
const migrationHint =
|
|
17418
|
+
const migrationHint = fs11.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
17418
17419
|
throw new Error(
|
|
17419
17420
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17420
17421
|
);
|
|
@@ -17494,7 +17495,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17494
17495
|
}
|
|
17495
17496
|
|
|
17496
17497
|
// ../telemetry/src/consent.ts
|
|
17497
|
-
import * as
|
|
17498
|
+
import * as fs12 from "node:fs";
|
|
17498
17499
|
import * as path13 from "node:path";
|
|
17499
17500
|
var cache = /* @__PURE__ */ new Map();
|
|
17500
17501
|
var sessionOverride = null;
|
|
@@ -17502,7 +17503,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17502
17503
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17503
17504
|
let stats;
|
|
17504
17505
|
try {
|
|
17505
|
-
stats =
|
|
17506
|
+
stats = fs12.lstatSync(filePath);
|
|
17506
17507
|
} catch {
|
|
17507
17508
|
cache.set(filePath, miss);
|
|
17508
17509
|
return null;
|
|
@@ -17519,7 +17520,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17519
17520
|
}
|
|
17520
17521
|
let parsedEnabled = null;
|
|
17521
17522
|
try {
|
|
17522
|
-
const raw =
|
|
17523
|
+
const raw = fs12.readFileSync(filePath, "utf8");
|
|
17523
17524
|
const json = JSON.parse(raw);
|
|
17524
17525
|
if (json && typeof json === "object") {
|
|
17525
17526
|
const t2 = json.telemetry;
|
|
@@ -17757,7 +17758,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17757
17758
|
}
|
|
17758
17759
|
|
|
17759
17760
|
// ../argent-installer/src/mcp-configs.ts
|
|
17760
|
-
import * as
|
|
17761
|
+
import * as fs19 from "node:fs";
|
|
17761
17762
|
import * as path20 from "node:path";
|
|
17762
17763
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
17763
17764
|
import { homedir as homedir4 } from "node:os";
|
|
@@ -17773,7 +17774,7 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17773
17774
|
|
|
17774
17775
|
// ../argent-installer/src/utils.ts
|
|
17775
17776
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17776
|
-
import * as
|
|
17777
|
+
import * as fs18 from "node:fs";
|
|
17777
17778
|
import * as path19 from "node:path";
|
|
17778
17779
|
import * as dns from "node:dns";
|
|
17779
17780
|
import { createHash as createHash2 } from "node:crypto";
|
|
@@ -20097,12 +20098,12 @@ function applyEdits(text2, edits) {
|
|
|
20097
20098
|
}
|
|
20098
20099
|
|
|
20099
20100
|
// ../argent-installer/src/package-root.ts
|
|
20100
|
-
import * as
|
|
20101
|
+
import * as fs13 from "node:fs";
|
|
20101
20102
|
import * as path14 from "node:path";
|
|
20102
20103
|
function resolvePackageRoot(dirname19) {
|
|
20103
20104
|
let current = path14.resolve(dirname19);
|
|
20104
20105
|
while (true) {
|
|
20105
|
-
if (
|
|
20106
|
+
if (fs13.existsSync(path14.join(current, "package.json"))) return current;
|
|
20106
20107
|
const parent = path14.dirname(current);
|
|
20107
20108
|
if (parent === current) return path14.resolve(dirname19);
|
|
20108
20109
|
current = parent;
|
|
@@ -20111,25 +20112,25 @@ function resolvePackageRoot(dirname19) {
|
|
|
20111
20112
|
|
|
20112
20113
|
// ../argent-installer/src/package-manager.ts
|
|
20113
20114
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
20114
|
-
import * as
|
|
20115
|
+
import * as fs16 from "node:fs";
|
|
20115
20116
|
import * as os2 from "node:os";
|
|
20116
20117
|
import * as path17 from "node:path";
|
|
20117
20118
|
|
|
20118
20119
|
// ../argent-installer/src/topology.ts
|
|
20119
20120
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
20120
|
-
import * as
|
|
20121
|
+
import * as fs15 from "node:fs";
|
|
20121
20122
|
import * as path16 from "node:path";
|
|
20122
20123
|
import { createRequire } from "node:module";
|
|
20123
20124
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20124
20125
|
|
|
20125
20126
|
// ../argent-installer/src/preflight.ts
|
|
20126
|
-
import * as
|
|
20127
|
+
import * as fs14 from "node:fs";
|
|
20127
20128
|
import * as path15 from "node:path";
|
|
20128
20129
|
function hasProjectPackageJson(projectRoot) {
|
|
20129
|
-
return
|
|
20130
|
+
return fs14.existsSync(path15.join(projectRoot, "package.json"));
|
|
20130
20131
|
}
|
|
20131
20132
|
function isYarnPnp(projectRoot) {
|
|
20132
|
-
return
|
|
20133
|
+
return fs14.existsSync(path15.join(projectRoot, ".pnp.cjs")) || fs14.existsSync(path15.join(projectRoot, ".pnp.loader.mjs"));
|
|
20133
20134
|
}
|
|
20134
20135
|
|
|
20135
20136
|
// ../argent-installer/src/topology.ts
|
|
@@ -20208,8 +20209,8 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20208
20209
|
}
|
|
20209
20210
|
function readShimScript(binaryPath) {
|
|
20210
20211
|
try {
|
|
20211
|
-
if (
|
|
20212
|
-
return
|
|
20212
|
+
if (fs15.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20213
|
+
return fs15.readFileSync(binaryPath, "utf8");
|
|
20213
20214
|
} catch {
|
|
20214
20215
|
return null;
|
|
20215
20216
|
}
|
|
@@ -20230,9 +20231,9 @@ function globalPackageRootOf(binaryPath) {
|
|
|
20230
20231
|
}
|
|
20231
20232
|
function packageRootOf(binaryPath) {
|
|
20232
20233
|
try {
|
|
20233
|
-
const realPath =
|
|
20234
|
+
const realPath = fs15.realpathSync(binaryPath);
|
|
20234
20235
|
const root = resolvePackageRoot(path16.dirname(realPath));
|
|
20235
|
-
const pkg = JSON.parse(
|
|
20236
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(root, "package.json"), "utf8"));
|
|
20236
20237
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20237
20238
|
} catch {
|
|
20238
20239
|
return null;
|
|
@@ -20242,7 +20243,7 @@ function cliPathOf(packageRoot) {
|
|
|
20242
20243
|
const binSub = argentBinSubpath(packageRoot);
|
|
20243
20244
|
if (!binSub) return null;
|
|
20244
20245
|
const cli = path16.join(packageRoot, binSub);
|
|
20245
|
-
return
|
|
20246
|
+
return fs15.existsSync(cli) ? cli : null;
|
|
20246
20247
|
}
|
|
20247
20248
|
function getGloballyInstalledLaunchPaths() {
|
|
20248
20249
|
if (process.platform === "win32") return null;
|
|
@@ -20252,8 +20253,8 @@ function getGloballyInstalledLaunchPaths() {
|
|
|
20252
20253
|
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20253
20254
|
if (!cli) return null;
|
|
20254
20255
|
try {
|
|
20255
|
-
const node = path16.join(
|
|
20256
|
-
return
|
|
20256
|
+
const node = path16.join(fs15.realpathSync(path16.dirname(binaryPath)), "node");
|
|
20257
|
+
return fs15.existsSync(node) ? { node, cli } : null;
|
|
20257
20258
|
} catch {
|
|
20258
20259
|
return null;
|
|
20259
20260
|
}
|
|
@@ -20262,7 +20263,7 @@ function getGloballyInstalledVersion() {
|
|
|
20262
20263
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20263
20264
|
if (!pkgRoot) return null;
|
|
20264
20265
|
try {
|
|
20265
|
-
const pkg = JSON.parse(
|
|
20266
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(pkgRoot, "package.json"), "utf8"));
|
|
20266
20267
|
return pkg.version ?? null;
|
|
20267
20268
|
} catch {
|
|
20268
20269
|
return null;
|
|
@@ -20271,7 +20272,7 @@ function getGloballyInstalledVersion() {
|
|
|
20271
20272
|
function readManifestDeclaration(projectRoot) {
|
|
20272
20273
|
try {
|
|
20273
20274
|
const pkg = JSON.parse(
|
|
20274
|
-
|
|
20275
|
+
fs15.readFileSync(path16.join(projectRoot, "package.json"), "utf8")
|
|
20275
20276
|
);
|
|
20276
20277
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20277
20278
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20288,7 +20289,7 @@ function resolveLocalArgentDir(projectRoot) {
|
|
|
20288
20289
|
return path16.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20289
20290
|
} catch {
|
|
20290
20291
|
const plain = path16.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20291
|
-
return
|
|
20292
|
+
return fs15.existsSync(path16.join(plain, "package.json")) ? plain : null;
|
|
20292
20293
|
}
|
|
20293
20294
|
}
|
|
20294
20295
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20296,7 +20297,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20296
20297
|
if (packageDir) {
|
|
20297
20298
|
let version;
|
|
20298
20299
|
try {
|
|
20299
|
-
const pkg = JSON.parse(
|
|
20300
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(packageDir, "package.json"), "utf8"));
|
|
20300
20301
|
version = pkg.version ?? null;
|
|
20301
20302
|
} catch {
|
|
20302
20303
|
version = null;
|
|
@@ -20320,7 +20321,7 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20320
20321
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20321
20322
|
try {
|
|
20322
20323
|
const pkgPath = path16.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20323
|
-
const pkg = JSON.parse(
|
|
20324
|
+
const pkg = JSON.parse(fs15.readFileSync(pkgPath, "utf8"));
|
|
20324
20325
|
return pkg.version ?? null;
|
|
20325
20326
|
} catch {
|
|
20326
20327
|
return null;
|
|
@@ -20328,7 +20329,7 @@ function readLocalPackageVersionUncached(projectRoot) {
|
|
|
20328
20329
|
}
|
|
20329
20330
|
function argentBinSubpath(pkgDir) {
|
|
20330
20331
|
try {
|
|
20331
|
-
const pkg = JSON.parse(
|
|
20332
|
+
const pkg = JSON.parse(fs15.readFileSync(path16.join(pkgDir, "package.json"), "utf8"));
|
|
20332
20333
|
if (typeof pkg.bin === "string") return pkg.bin;
|
|
20333
20334
|
if (pkg.bin && typeof pkg.bin === "object") {
|
|
20334
20335
|
return pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0] ?? null;
|
|
@@ -20345,15 +20346,15 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20345
20346
|
if (!binSub) return null;
|
|
20346
20347
|
let root = projectRoot;
|
|
20347
20348
|
try {
|
|
20348
|
-
root =
|
|
20349
|
+
root = fs15.realpathSync(projectRoot);
|
|
20349
20350
|
} catch {
|
|
20350
20351
|
}
|
|
20351
20352
|
const stableRel = path16.join("node_modules", PACKAGE_NAME, binSub);
|
|
20352
|
-
if (
|
|
20353
|
+
if (fs15.existsSync(path16.join(root, stableRel))) {
|
|
20353
20354
|
return stableRel.split(path16.sep).join("/");
|
|
20354
20355
|
}
|
|
20355
20356
|
const abs = path16.join(pkgDir, binSub);
|
|
20356
|
-
if (!
|
|
20357
|
+
if (!fs15.existsSync(abs)) return null;
|
|
20357
20358
|
return path16.relative(root, abs).split(path16.sep).join("/");
|
|
20358
20359
|
}
|
|
20359
20360
|
|
|
@@ -20387,10 +20388,10 @@ function detectGlobalPackageManager() {
|
|
|
20387
20388
|
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20388
20389
|
}
|
|
20389
20390
|
if (process.platform === "win32") {
|
|
20390
|
-
if (
|
|
20391
|
+
if (fs16.existsSync(path17.join(npmCopyBeside(path17.dirname(binaryPath)), "package.json"))) {
|
|
20391
20392
|
return "npm";
|
|
20392
20393
|
}
|
|
20393
|
-
if (
|
|
20394
|
+
if (fs16.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20394
20395
|
}
|
|
20395
20396
|
const shim = readShimScript(binaryPath);
|
|
20396
20397
|
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
@@ -20415,7 +20416,7 @@ function isInNpmLayout(binaryPath, root) {
|
|
|
20415
20416
|
const binDir = canonicalPath(path17.dirname(link));
|
|
20416
20417
|
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20417
20418
|
try {
|
|
20418
|
-
link = path17.resolve(binDir,
|
|
20419
|
+
link = path17.resolve(binDir, fs16.readlinkSync(link));
|
|
20419
20420
|
} catch {
|
|
20420
20421
|
return false;
|
|
20421
20422
|
}
|
|
@@ -20434,7 +20435,7 @@ function asKnownPm(name) {
|
|
|
20434
20435
|
}
|
|
20435
20436
|
function pmFromPackageManagerField(dir) {
|
|
20436
20437
|
try {
|
|
20437
|
-
const pkg = JSON.parse(
|
|
20438
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(dir, "package.json"), "utf8"));
|
|
20438
20439
|
if (typeof pkg.packageManager === "string") {
|
|
20439
20440
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20440
20441
|
}
|
|
@@ -20445,7 +20446,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20445
20446
|
}
|
|
20446
20447
|
function pmFromDevEngines(dir) {
|
|
20447
20448
|
try {
|
|
20448
|
-
const pkg = JSON.parse(
|
|
20449
|
+
const pkg = JSON.parse(fs16.readFileSync(path17.join(dir, "package.json"), "utf8"));
|
|
20449
20450
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20450
20451
|
const names = /* @__PURE__ */ new Set();
|
|
20451
20452
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20458,7 +20459,7 @@ function pmFromDevEngines(dir) {
|
|
|
20458
20459
|
}
|
|
20459
20460
|
}
|
|
20460
20461
|
function pmFromLockfile(dir) {
|
|
20461
|
-
const has = (file) =>
|
|
20462
|
+
const has = (file) => fs16.existsSync(path17.join(dir, file));
|
|
20462
20463
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20463
20464
|
if (has("yarn.lock")) return "yarn";
|
|
20464
20465
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20466,14 +20467,14 @@ function pmFromLockfile(dir) {
|
|
|
20466
20467
|
return null;
|
|
20467
20468
|
}
|
|
20468
20469
|
function pmFromWorkspaceMarker(dir) {
|
|
20469
|
-
return
|
|
20470
|
+
return fs16.existsSync(path17.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20470
20471
|
}
|
|
20471
20472
|
function detectProjectPackageManager(projectRoot) {
|
|
20472
20473
|
let dir = path17.resolve(projectRoot);
|
|
20473
20474
|
for (; ; ) {
|
|
20474
20475
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20475
20476
|
if (pm) return pm;
|
|
20476
|
-
if (
|
|
20477
|
+
if (fs16.existsSync(path17.join(dir, ".git"))) break;
|
|
20477
20478
|
const parent = path17.dirname(dir);
|
|
20478
20479
|
if (parent === dir) break;
|
|
20479
20480
|
dir = parent;
|
|
@@ -20495,7 +20496,7 @@ function globalInstallCommand(pm, pkg) {
|
|
|
20495
20496
|
function globalCommandOptions(pm) {
|
|
20496
20497
|
if (pm === "npm") return {};
|
|
20497
20498
|
const home = os2.homedir();
|
|
20498
|
-
const cwd =
|
|
20499
|
+
const cwd = fs16.existsSync(home) ? { cwd: home } : {};
|
|
20499
20500
|
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20500
20501
|
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20501
20502
|
return { ...cwd, env };
|
|
@@ -20529,9 +20530,9 @@ function ownsGlobalInstall(pm, runningRoot) {
|
|
|
20529
20530
|
const dir = pm === "bun" ? /^([^\r\n]+) node_modules \(/.exec(output)?.[1] : output;
|
|
20530
20531
|
if (!dir || !path17.isAbsolute(dir)) return false;
|
|
20531
20532
|
pkg = pm === "npm" ? path17.join(dir, PACKAGE_NAME) : path17.join(dir, "node_modules", PACKAGE_NAME);
|
|
20532
|
-
localBuild =
|
|
20533
|
+
localBuild = fs16.lstatSync(pkg).isSymbolicLink();
|
|
20533
20534
|
}
|
|
20534
|
-
return !localBuild && !!pkg && path17.isAbsolute(pkg) &&
|
|
20535
|
+
return !localBuild && !!pkg && path17.isAbsolute(pkg) && fs16.realpathSync(pkg) === runningRoot;
|
|
20535
20536
|
} catch {
|
|
20536
20537
|
return false;
|
|
20537
20538
|
}
|
|
@@ -20586,7 +20587,7 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20586
20587
|
}
|
|
20587
20588
|
|
|
20588
20589
|
// ../argent-installer/src/install-record.ts
|
|
20589
|
-
import * as
|
|
20590
|
+
import * as fs17 from "node:fs";
|
|
20590
20591
|
import * as path18 from "node:path";
|
|
20591
20592
|
function getInstallRecordPath(projectRoot) {
|
|
20592
20593
|
return path18.join(projectRoot, ".argent", "install.json");
|
|
@@ -20594,7 +20595,7 @@ function getInstallRecordPath(projectRoot) {
|
|
|
20594
20595
|
function readInstallRecord(projectRoot) {
|
|
20595
20596
|
try {
|
|
20596
20597
|
const parsed = JSON.parse(
|
|
20597
|
-
|
|
20598
|
+
fs17.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20598
20599
|
);
|
|
20599
20600
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20600
20601
|
return null;
|
|
@@ -20604,17 +20605,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20604
20605
|
}
|
|
20605
20606
|
function writeInstallRecord(projectRoot, record) {
|
|
20606
20607
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20607
|
-
|
|
20608
|
-
|
|
20608
|
+
fs17.mkdirSync(path18.dirname(recordPath), { recursive: true });
|
|
20609
|
+
fs17.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20609
20610
|
}
|
|
20610
20611
|
function removeInstallRecord(projectRoot) {
|
|
20611
20612
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20612
20613
|
try {
|
|
20613
|
-
if (!
|
|
20614
|
-
|
|
20614
|
+
if (!fs17.existsSync(recordPath)) return false;
|
|
20615
|
+
fs17.rmSync(recordPath, { force: true });
|
|
20615
20616
|
const dir = path18.dirname(recordPath);
|
|
20616
20617
|
try {
|
|
20617
|
-
if (
|
|
20618
|
+
if (fs17.existsSync(dir) && fs17.readdirSync(dir).length === 0) fs17.rmdirSync(dir);
|
|
20618
20619
|
} catch {
|
|
20619
20620
|
}
|
|
20620
20621
|
return true;
|
|
@@ -20643,7 +20644,7 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20643
20644
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20644
20645
|
function resolveBundledDir(dirName) {
|
|
20645
20646
|
const packagedDir = path19.join(PACKAGE_ROOT, dirName);
|
|
20646
|
-
if (
|
|
20647
|
+
if (fs18.existsSync(packagedDir)) return packagedDir;
|
|
20647
20648
|
return path19.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20648
20649
|
}
|
|
20649
20650
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
@@ -20656,7 +20657,7 @@ function buildArgentSkillsSource(version) {
|
|
|
20656
20657
|
}
|
|
20657
20658
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20658
20659
|
try {
|
|
20659
|
-
return
|
|
20660
|
+
return fs18.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs18.existsSync(path19.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20660
20661
|
} catch {
|
|
20661
20662
|
return [];
|
|
20662
20663
|
}
|
|
@@ -20773,7 +20774,7 @@ function hashBundledContent(content) {
|
|
|
20773
20774
|
}
|
|
20774
20775
|
function listArgentSkillsInLock(lockPath) {
|
|
20775
20776
|
try {
|
|
20776
|
-
const raw =
|
|
20777
|
+
const raw = fs18.readFileSync(lockPath, "utf8");
|
|
20777
20778
|
const lock = JSON.parse(raw);
|
|
20778
20779
|
const tracked = lock.skills ?? {};
|
|
20779
20780
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20804,10 +20805,10 @@ function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
|
20804
20805
|
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20805
20806
|
return initialDir;
|
|
20806
20807
|
}
|
|
20807
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20808
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs18.existsSync(path19.join(currentDir, marker)))) {
|
|
20808
20809
|
return currentDir;
|
|
20809
20810
|
}
|
|
20810
|
-
if (
|
|
20811
|
+
if (fs18.existsSync(path19.join(currentDir, ".git"))) {
|
|
20811
20812
|
return currentDir;
|
|
20812
20813
|
}
|
|
20813
20814
|
const parentDir = path19.dirname(currentDir);
|
|
@@ -20818,20 +20819,20 @@ function resolveProjectRoot2(startDir, homeDir = os3.homedir()) {
|
|
|
20818
20819
|
}
|
|
20819
20820
|
}
|
|
20820
20821
|
function readToml(filePath) {
|
|
20821
|
-
if (!
|
|
20822
|
+
if (!fs18.existsSync(filePath)) return {};
|
|
20822
20823
|
try {
|
|
20823
|
-
return parse(
|
|
20824
|
+
return parse(fs18.readFileSync(filePath, "utf8"));
|
|
20824
20825
|
} catch {
|
|
20825
20826
|
return {};
|
|
20826
20827
|
}
|
|
20827
20828
|
}
|
|
20828
20829
|
function writeToml(filePath, data) {
|
|
20829
|
-
|
|
20830
|
-
|
|
20830
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20831
|
+
fs18.writeFileSync(filePath, stringify(data) + "\n");
|
|
20831
20832
|
}
|
|
20832
20833
|
function readYaml(filePath) {
|
|
20833
|
-
if (!
|
|
20834
|
-
const text2 =
|
|
20834
|
+
if (!fs18.existsSync(filePath)) return new import_yaml.Document({});
|
|
20835
|
+
const text2 = fs18.readFileSync(filePath, "utf8");
|
|
20835
20836
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20836
20837
|
if (doc.errors.length > 0) {
|
|
20837
20838
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20840,20 +20841,20 @@ function readYaml(filePath) {
|
|
|
20840
20841
|
return doc;
|
|
20841
20842
|
}
|
|
20842
20843
|
function writeYaml(filePath, doc) {
|
|
20843
|
-
|
|
20844
|
-
|
|
20844
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20845
|
+
fs18.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20845
20846
|
}
|
|
20846
20847
|
function readJson(filePath) {
|
|
20847
|
-
if (!
|
|
20848
|
+
if (!fs18.existsSync(filePath)) return {};
|
|
20848
20849
|
try {
|
|
20849
|
-
return JSON.parse(
|
|
20850
|
+
return JSON.parse(fs18.readFileSync(filePath, "utf8"));
|
|
20850
20851
|
} catch {
|
|
20851
20852
|
return {};
|
|
20852
20853
|
}
|
|
20853
20854
|
}
|
|
20854
20855
|
function writeJson(filePath, data) {
|
|
20855
|
-
|
|
20856
|
-
|
|
20856
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20857
|
+
fs18.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20857
20858
|
}
|
|
20858
20859
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20859
20860
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20861,8 +20862,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20861
20862
|
return applyEdits(text2, edits);
|
|
20862
20863
|
}
|
|
20863
20864
|
function readJsoncFileRaw(filePath) {
|
|
20864
|
-
if (!
|
|
20865
|
-
let text2 =
|
|
20865
|
+
if (!fs18.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20866
|
+
let text2 = fs18.readFileSync(filePath, "utf8");
|
|
20866
20867
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20867
20868
|
if (hadBom) text2 = text2.slice(1);
|
|
20868
20869
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20881,26 +20882,26 @@ function isEmptyPlainObject(value) {
|
|
|
20881
20882
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20882
20883
|
}
|
|
20883
20884
|
function removePath(targetPath) {
|
|
20884
|
-
const entry =
|
|
20885
|
+
const entry = fs18.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20885
20886
|
if (!entry) return false;
|
|
20886
|
-
if (entry.isSymbolicLink())
|
|
20887
|
-
else
|
|
20887
|
+
if (entry.isSymbolicLink()) fs18.unlinkSync(targetPath);
|
|
20888
|
+
else fs18.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20888
20889
|
return true;
|
|
20889
20890
|
}
|
|
20890
20891
|
function rmEmptyDir(dirPath) {
|
|
20891
20892
|
try {
|
|
20892
|
-
if (!
|
|
20893
|
-
if (!
|
|
20894
|
-
if (
|
|
20895
|
-
|
|
20893
|
+
if (!fs18.existsSync(dirPath)) return false;
|
|
20894
|
+
if (!fs18.statSync(dirPath).isDirectory()) return false;
|
|
20895
|
+
if (fs18.readdirSync(dirPath).length > 0) return false;
|
|
20896
|
+
fs18.rmdirSync(dirPath);
|
|
20896
20897
|
return true;
|
|
20897
20898
|
} catch {
|
|
20898
20899
|
return false;
|
|
20899
20900
|
}
|
|
20900
20901
|
}
|
|
20901
20902
|
function readJsonc(filePath) {
|
|
20902
|
-
if (!
|
|
20903
|
-
let raw =
|
|
20903
|
+
if (!fs18.existsSync(filePath)) return {};
|
|
20904
|
+
let raw = fs18.readFileSync(filePath, "utf8");
|
|
20904
20905
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20905
20906
|
if (raw.trim() === "") return {};
|
|
20906
20907
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20921,7 +20922,7 @@ function yamlSyntaxErrorLine(raw) {
|
|
|
20921
20922
|
function findConfigSyntaxErrorLine(filePath, jsonOptions) {
|
|
20922
20923
|
let raw;
|
|
20923
20924
|
try {
|
|
20924
|
-
raw =
|
|
20925
|
+
raw = fs18.readFileSync(filePath, "utf8");
|
|
20925
20926
|
} catch {
|
|
20926
20927
|
return null;
|
|
20927
20928
|
}
|
|
@@ -20947,18 +20948,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20947
20948
|
}
|
|
20948
20949
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20949
20950
|
if (isEmptyPlainObject(parsed)) {
|
|
20950
|
-
|
|
20951
|
+
fs18.rmSync(filePath, { force: true });
|
|
20951
20952
|
rmEmptyDir(path19.dirname(filePath));
|
|
20952
20953
|
return;
|
|
20953
20954
|
}
|
|
20954
|
-
|
|
20955
|
+
fs18.mkdirSync(path19.dirname(filePath), { recursive: true });
|
|
20955
20956
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20956
|
-
|
|
20957
|
+
fs18.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20957
20958
|
}
|
|
20958
20959
|
var MAX_SYMLINK_HOPS = 40;
|
|
20959
20960
|
function realpathOrSelf(p) {
|
|
20960
20961
|
try {
|
|
20961
|
-
return
|
|
20962
|
+
return fs18.realpathSync(p);
|
|
20962
20963
|
} catch {
|
|
20963
20964
|
return p;
|
|
20964
20965
|
}
|
|
@@ -20968,13 +20969,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20968
20969
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20969
20970
|
let entry;
|
|
20970
20971
|
try {
|
|
20971
|
-
entry =
|
|
20972
|
+
entry = fs18.lstatSync(current);
|
|
20972
20973
|
} catch {
|
|
20973
20974
|
return current === dest || dirExists(path19.dirname(current)) ? current : dest;
|
|
20974
20975
|
}
|
|
20975
20976
|
if (!entry.isSymbolicLink()) return current;
|
|
20976
20977
|
try {
|
|
20977
|
-
current = path19.resolve(realpathOrSelf(path19.dirname(current)),
|
|
20978
|
+
current = path19.resolve(realpathOrSelf(path19.dirname(current)), fs18.readlinkSync(current));
|
|
20978
20979
|
} catch {
|
|
20979
20980
|
return dest;
|
|
20980
20981
|
}
|
|
@@ -20982,30 +20983,30 @@ function resolveLinkedDestination(dest) {
|
|
|
20982
20983
|
return dest;
|
|
20983
20984
|
}
|
|
20984
20985
|
function copyDir(src, dest) {
|
|
20985
|
-
if (!
|
|
20986
|
+
if (!fs18.existsSync(src) || !treeHasFiles(src)) return null;
|
|
20986
20987
|
const target = resolveLinkedDestination(dest);
|
|
20987
20988
|
copyTree(src, target);
|
|
20988
20989
|
return target;
|
|
20989
20990
|
}
|
|
20990
20991
|
function treeHasFiles(dir) {
|
|
20991
|
-
return
|
|
20992
|
+
return fs18.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path19.join(dir, entry.name)));
|
|
20992
20993
|
}
|
|
20993
20994
|
function copyTree(src, dest) {
|
|
20994
|
-
const entries =
|
|
20995
|
-
|
|
20995
|
+
const entries = fs18.readdirSync(src, { withFileTypes: true });
|
|
20996
|
+
fs18.mkdirSync(dest, { recursive: true });
|
|
20996
20997
|
for (const entry of entries) {
|
|
20997
20998
|
const from = path19.join(src, entry.name);
|
|
20998
20999
|
const to = resolveLinkedDestination(path19.join(dest, entry.name));
|
|
20999
21000
|
if (entry.isDirectory()) copyTree(from, to);
|
|
21000
|
-
else
|
|
21001
|
+
else fs18.copyFileSync(from, to);
|
|
21001
21002
|
}
|
|
21002
21003
|
}
|
|
21003
21004
|
function readRetiredFile(targetDir, relativePath) {
|
|
21004
21005
|
const entryPath = path19.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
21005
21006
|
const file = resolveLinkedDestination(entryPath);
|
|
21006
21007
|
try {
|
|
21007
|
-
if (!
|
|
21008
|
-
return
|
|
21008
|
+
if (!fs18.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
21009
|
+
return fs18.readFileSync(file, "utf8");
|
|
21009
21010
|
} catch {
|
|
21010
21011
|
return null;
|
|
21011
21012
|
}
|
|
@@ -21013,7 +21014,7 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
21013
21014
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
21014
21015
|
const found = [];
|
|
21015
21016
|
for (const { path: relativePath, shipped } of retired) {
|
|
21016
|
-
if (bundleDir !== null &&
|
|
21017
|
+
if (bundleDir !== null && fs18.existsSync(path19.join(bundleDir, ...relativePath.split("/"))))
|
|
21017
21018
|
continue;
|
|
21018
21019
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21019
21020
|
if (content === null) continue;
|
|
@@ -21032,7 +21033,7 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21032
21033
|
const entryPath = path19.join(dir, ...segments);
|
|
21033
21034
|
const file = resolveLinkedDestination(entryPath);
|
|
21034
21035
|
try {
|
|
21035
|
-
|
|
21036
|
+
fs18.rmSync(file);
|
|
21036
21037
|
if (file !== entryPath) removePath(entryPath);
|
|
21037
21038
|
removedPaths.push(relativePath);
|
|
21038
21039
|
} catch {
|
|
@@ -21047,7 +21048,7 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21047
21048
|
}
|
|
21048
21049
|
function dirExists(p) {
|
|
21049
21050
|
try {
|
|
21050
|
-
return
|
|
21051
|
+
return fs18.statSync(p).isDirectory();
|
|
21051
21052
|
} catch {
|
|
21052
21053
|
return false;
|
|
21053
21054
|
}
|
|
@@ -21055,7 +21056,7 @@ function dirExists(p) {
|
|
|
21055
21056
|
function getInstalledVersion() {
|
|
21056
21057
|
try {
|
|
21057
21058
|
const pkgPath = path19.join(PACKAGE_ROOT, "package.json");
|
|
21058
|
-
const pkg = JSON.parse(
|
|
21059
|
+
const pkg = JSON.parse(fs18.readFileSync(pkgPath, "utf8"));
|
|
21059
21060
|
return pkg.version ?? null;
|
|
21060
21061
|
} catch {
|
|
21061
21062
|
return null;
|
|
@@ -21185,10 +21186,10 @@ function hasCustomizingEnv(entry) {
|
|
|
21185
21186
|
}
|
|
21186
21187
|
function removeDirIfEmpty(dirPath) {
|
|
21187
21188
|
try {
|
|
21188
|
-
if (!
|
|
21189
|
-
if (!
|
|
21190
|
-
if (
|
|
21191
|
-
|
|
21189
|
+
if (!fs19.existsSync(dirPath)) return;
|
|
21190
|
+
if (!fs19.statSync(dirPath).isDirectory()) return;
|
|
21191
|
+
if (fs19.readdirSync(dirPath).length > 0) return;
|
|
21192
|
+
fs19.rmdirSync(dirPath);
|
|
21192
21193
|
} catch {
|
|
21193
21194
|
}
|
|
21194
21195
|
}
|
|
@@ -21244,7 +21245,7 @@ function isPinnedGlobalEntry(entry) {
|
|
|
21244
21245
|
}
|
|
21245
21246
|
function writeTomlOrRemove(filePath, data) {
|
|
21246
21247
|
if (Object.keys(data).length === 0) {
|
|
21247
|
-
|
|
21248
|
+
fs19.rmSync(filePath, { force: true });
|
|
21248
21249
|
removeDirIfEmpty(path20.dirname(filePath));
|
|
21249
21250
|
return;
|
|
21250
21251
|
}
|
|
@@ -21254,12 +21255,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
21254
21255
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
21255
21256
|
}
|
|
21256
21257
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
21257
|
-
return
|
|
21258
|
+
return fs19.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
21258
21259
|
}
|
|
21259
21260
|
function parseJsoncStrict(filePath) {
|
|
21260
21261
|
let raw;
|
|
21261
21262
|
try {
|
|
21262
|
-
raw =
|
|
21263
|
+
raw = fs19.readFileSync(filePath, "utf8");
|
|
21263
21264
|
} catch {
|
|
21264
21265
|
return null;
|
|
21265
21266
|
}
|
|
@@ -21272,14 +21273,14 @@ function parseJsoncStrict(filePath) {
|
|
|
21272
21273
|
}
|
|
21273
21274
|
function parseTomlStrict(filePath) {
|
|
21274
21275
|
try {
|
|
21275
|
-
return parse(
|
|
21276
|
+
return parse(fs19.readFileSync(filePath, "utf8"));
|
|
21276
21277
|
} catch {
|
|
21277
21278
|
return null;
|
|
21278
21279
|
}
|
|
21279
21280
|
}
|
|
21280
21281
|
function parseYamlStrict(filePath) {
|
|
21281
21282
|
try {
|
|
21282
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21283
|
+
const parsed = (0, import_yaml2.parse)(fs19.readFileSync(filePath, "utf8"));
|
|
21283
21284
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
21284
21285
|
return parsed;
|
|
21285
21286
|
} catch {
|
|
@@ -21302,7 +21303,7 @@ function bundledManagedNames(kind) {
|
|
|
21302
21303
|
if (cached2) return cached2;
|
|
21303
21304
|
let names;
|
|
21304
21305
|
try {
|
|
21305
|
-
names = new Set(
|
|
21306
|
+
names = new Set(fs19.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
21306
21307
|
} catch {
|
|
21307
21308
|
names = /* @__PURE__ */ new Set();
|
|
21308
21309
|
}
|
|
@@ -21313,7 +21314,7 @@ function bundledManagedNames(kind) {
|
|
|
21313
21314
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
21314
21315
|
let entries;
|
|
21315
21316
|
try {
|
|
21316
|
-
entries =
|
|
21317
|
+
entries = fs19.readdirSync(dir);
|
|
21317
21318
|
} catch {
|
|
21318
21319
|
return false;
|
|
21319
21320
|
}
|
|
@@ -21325,7 +21326,7 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
21325
21326
|
function cursorDirLooksArgentOnly(dir) {
|
|
21326
21327
|
let entries;
|
|
21327
21328
|
try {
|
|
21328
|
-
entries =
|
|
21329
|
+
entries = fs19.readdirSync(dir);
|
|
21329
21330
|
} catch {
|
|
21330
21331
|
return false;
|
|
21331
21332
|
}
|
|
@@ -21364,7 +21365,7 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
21364
21365
|
function claudeDirLooksArgentOnly(dir) {
|
|
21365
21366
|
let entries;
|
|
21366
21367
|
try {
|
|
21367
|
-
entries =
|
|
21368
|
+
entries = fs19.readdirSync(dir);
|
|
21368
21369
|
} catch {
|
|
21369
21370
|
return false;
|
|
21370
21371
|
}
|
|
@@ -21381,7 +21382,7 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
21381
21382
|
function vscodeDirLooksArgentOnly(dir) {
|
|
21382
21383
|
let entries;
|
|
21383
21384
|
try {
|
|
21384
|
-
entries =
|
|
21385
|
+
entries = fs19.readdirSync(dir);
|
|
21385
21386
|
} catch {
|
|
21386
21387
|
return false;
|
|
21387
21388
|
}
|
|
@@ -21393,7 +21394,7 @@ function vscodeDirLooksArgentOnly(dir) {
|
|
|
21393
21394
|
function windsurfDirLooksArgentOnly(dir) {
|
|
21394
21395
|
let entries;
|
|
21395
21396
|
try {
|
|
21396
|
-
entries =
|
|
21397
|
+
entries = fs19.readdirSync(dir);
|
|
21397
21398
|
} catch {
|
|
21398
21399
|
return false;
|
|
21399
21400
|
}
|
|
@@ -21430,7 +21431,7 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21430
21431
|
function zedDirLooksArgentOnly(dir) {
|
|
21431
21432
|
let entries;
|
|
21432
21433
|
try {
|
|
21433
|
-
entries =
|
|
21434
|
+
entries = fs19.readdirSync(dir);
|
|
21434
21435
|
} catch {
|
|
21435
21436
|
return false;
|
|
21436
21437
|
}
|
|
@@ -21442,7 +21443,7 @@ function zedDirLooksArgentOnly(dir) {
|
|
|
21442
21443
|
function geminiDirLooksArgentOnly(dir) {
|
|
21443
21444
|
let entries;
|
|
21444
21445
|
try {
|
|
21445
|
-
entries =
|
|
21446
|
+
entries = fs19.readdirSync(dir);
|
|
21446
21447
|
} catch {
|
|
21447
21448
|
return false;
|
|
21448
21449
|
}
|
|
@@ -21467,7 +21468,7 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21467
21468
|
function hermesDirLooksArgentOnly(dir) {
|
|
21468
21469
|
let entries;
|
|
21469
21470
|
try {
|
|
21470
|
-
entries =
|
|
21471
|
+
entries = fs19.readdirSync(dir);
|
|
21471
21472
|
} catch {
|
|
21472
21473
|
return false;
|
|
21473
21474
|
}
|
|
@@ -21479,7 +21480,7 @@ function hermesDirLooksArgentOnly(dir) {
|
|
|
21479
21480
|
function kiroDirLooksArgentOnly(dir) {
|
|
21480
21481
|
let entries;
|
|
21481
21482
|
try {
|
|
21482
|
-
entries =
|
|
21483
|
+
entries = fs19.readdirSync(dir);
|
|
21483
21484
|
} catch {
|
|
21484
21485
|
return false;
|
|
21485
21486
|
}
|
|
@@ -21489,7 +21490,7 @@ function kiroDirLooksArgentOnly(dir) {
|
|
|
21489
21490
|
const settingsDir = path20.join(dir, entry);
|
|
21490
21491
|
let settingsEntries;
|
|
21491
21492
|
try {
|
|
21492
|
-
settingsEntries =
|
|
21493
|
+
settingsEntries = fs19.readdirSync(settingsDir);
|
|
21493
21494
|
} catch {
|
|
21494
21495
|
return false;
|
|
21495
21496
|
}
|
|
@@ -21502,7 +21503,7 @@ function kiroDirLooksArgentOnly(dir) {
|
|
|
21502
21503
|
function codexDirLooksArgentOnly(dir) {
|
|
21503
21504
|
let entries;
|
|
21504
21505
|
try {
|
|
21505
|
-
entries =
|
|
21506
|
+
entries = fs19.readdirSync(dir);
|
|
21506
21507
|
} catch {
|
|
21507
21508
|
return false;
|
|
21508
21509
|
}
|
|
@@ -21560,7 +21561,7 @@ var cursorAdapter = {
|
|
|
21560
21561
|
});
|
|
21561
21562
|
},
|
|
21562
21563
|
remove(configPath) {
|
|
21563
|
-
if (!
|
|
21564
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21564
21565
|
const config = readJsonc(configPath);
|
|
21565
21566
|
const servers = config.mcpServers;
|
|
21566
21567
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21568,7 +21569,7 @@ var cursorAdapter = {
|
|
|
21568
21569
|
return true;
|
|
21569
21570
|
},
|
|
21570
21571
|
getArgentEntry(configPath) {
|
|
21571
|
-
if (!
|
|
21572
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21572
21573
|
const config = readJsonc(configPath);
|
|
21573
21574
|
const servers = config.mcpServers;
|
|
21574
21575
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21593,7 +21594,7 @@ var cursorAdapter = {
|
|
|
21593
21594
|
removeAllowlist(_root, scope) {
|
|
21594
21595
|
if (scope !== "global") return;
|
|
21595
21596
|
const permPath = cursorPermissionsPath();
|
|
21596
|
-
if (!
|
|
21597
|
+
if (!fs19.existsSync(permPath)) return;
|
|
21597
21598
|
const config = readJsonc(permPath);
|
|
21598
21599
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21599
21600
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21606,7 +21607,7 @@ function claudeProjectKeysForRoot(projects, root) {
|
|
|
21606
21607
|
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21607
21608
|
}
|
|
21608
21609
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21609
|
-
if (!
|
|
21610
|
+
if (!fs19.existsSync(settingsPath)) return null;
|
|
21610
21611
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21611
21612
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21612
21613
|
return {
|
|
@@ -21653,7 +21654,7 @@ var claudeAdapter = {
|
|
|
21653
21654
|
});
|
|
21654
21655
|
},
|
|
21655
21656
|
remove(configPath) {
|
|
21656
|
-
if (!
|
|
21657
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21657
21658
|
const config = readJsonc(configPath);
|
|
21658
21659
|
const servers = config.mcpServers;
|
|
21659
21660
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21667,7 +21668,7 @@ var claudeAdapter = {
|
|
|
21667
21668
|
return true;
|
|
21668
21669
|
},
|
|
21669
21670
|
getArgentEntry(configPath) {
|
|
21670
|
-
if (!
|
|
21671
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21671
21672
|
const config = readJsonc(configPath);
|
|
21672
21673
|
const servers = config.mcpServers;
|
|
21673
21674
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21757,7 +21758,7 @@ var vscodeAdapter = {
|
|
|
21757
21758
|
});
|
|
21758
21759
|
},
|
|
21759
21760
|
remove(configPath) {
|
|
21760
|
-
if (!
|
|
21761
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21761
21762
|
const config = readJsonc(configPath);
|
|
21762
21763
|
const servers = config.servers;
|
|
21763
21764
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21765,7 +21766,7 @@ var vscodeAdapter = {
|
|
|
21765
21766
|
return true;
|
|
21766
21767
|
},
|
|
21767
21768
|
getArgentEntry(configPath) {
|
|
21768
|
-
if (!
|
|
21769
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21769
21770
|
const config = readJsonc(configPath);
|
|
21770
21771
|
const servers = config.servers;
|
|
21771
21772
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21843,7 +21844,7 @@ var windsurfAdapter = {
|
|
|
21843
21844
|
});
|
|
21844
21845
|
},
|
|
21845
21846
|
remove(configPath) {
|
|
21846
|
-
if (!
|
|
21847
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21847
21848
|
const config = readJsonc(configPath);
|
|
21848
21849
|
const servers = config.mcpServers;
|
|
21849
21850
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21851,7 +21852,7 @@ var windsurfAdapter = {
|
|
|
21851
21852
|
return true;
|
|
21852
21853
|
},
|
|
21853
21854
|
getArgentEntry(configPath) {
|
|
21854
|
-
if (!
|
|
21855
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21855
21856
|
const config = readJsonc(configPath);
|
|
21856
21857
|
const servers = config.mcpServers;
|
|
21857
21858
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21874,7 +21875,7 @@ var windsurfAdapter = {
|
|
|
21874
21875
|
if (scope !== "global") return;
|
|
21875
21876
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21876
21877
|
const configPath = path20.join(homedir4(), ".codeium", "windsurf", "mcp_config.json");
|
|
21877
|
-
if (!
|
|
21878
|
+
if (!fs19.existsSync(configPath)) return;
|
|
21878
21879
|
const config = readJsonc(configPath);
|
|
21879
21880
|
const servers = config.mcpServers;
|
|
21880
21881
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21904,7 +21905,7 @@ var zedAdapter = {
|
|
|
21904
21905
|
});
|
|
21905
21906
|
},
|
|
21906
21907
|
remove(configPath) {
|
|
21907
|
-
if (!
|
|
21908
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21908
21909
|
const config = readJsonc(configPath);
|
|
21909
21910
|
const servers = config.context_servers;
|
|
21910
21911
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21912,7 +21913,7 @@ var zedAdapter = {
|
|
|
21912
21913
|
return true;
|
|
21913
21914
|
},
|
|
21914
21915
|
getArgentEntry(configPath) {
|
|
21915
|
-
if (!
|
|
21916
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21916
21917
|
const config = readJsonc(configPath);
|
|
21917
21918
|
const servers = config.context_servers;
|
|
21918
21919
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21928,7 +21929,7 @@ var zedAdapter = {
|
|
|
21928
21929
|
},
|
|
21929
21930
|
removeAllowlist(root, scope) {
|
|
21930
21931
|
const settingsPath = scope === "global" ? path20.join(homedir4(), ".config", "zed", "settings.json") : path20.join(root, ".zed", "settings.json");
|
|
21931
|
-
if (!
|
|
21932
|
+
if (!fs19.existsSync(settingsPath)) return;
|
|
21932
21933
|
const config = readJsonc(settingsPath);
|
|
21933
21934
|
const perms = config.agent?.tool_permissions;
|
|
21934
21935
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21956,7 +21957,7 @@ var geminiAdapter = {
|
|
|
21956
21957
|
});
|
|
21957
21958
|
},
|
|
21958
21959
|
remove(configPath) {
|
|
21959
|
-
if (!
|
|
21960
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
21960
21961
|
const config = readJsonc(configPath);
|
|
21961
21962
|
const servers = config.mcpServers;
|
|
21962
21963
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21964,7 +21965,7 @@ var geminiAdapter = {
|
|
|
21964
21965
|
return true;
|
|
21965
21966
|
},
|
|
21966
21967
|
getArgentEntry(configPath) {
|
|
21967
|
-
if (!
|
|
21968
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
21968
21969
|
const config = readJsonc(configPath);
|
|
21969
21970
|
const servers = config.mcpServers;
|
|
21970
21971
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21986,7 +21987,7 @@ var geminiAdapter = {
|
|
|
21986
21987
|
},
|
|
21987
21988
|
removeAllowlist(root, scope) {
|
|
21988
21989
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
21989
|
-
if (!configPath || !
|
|
21990
|
+
if (!configPath || !fs19.existsSync(configPath)) {
|
|
21990
21991
|
return;
|
|
21991
21992
|
}
|
|
21992
21993
|
const config = readJsonc(configPath);
|
|
@@ -22022,7 +22023,7 @@ var codexAdapter = {
|
|
|
22022
22023
|
writeToml(configPath, config);
|
|
22023
22024
|
},
|
|
22024
22025
|
remove(configPath) {
|
|
22025
|
-
if (!
|
|
22026
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22026
22027
|
const config = readToml(configPath);
|
|
22027
22028
|
const servers = config.mcp_servers;
|
|
22028
22029
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22032,7 +22033,7 @@ var codexAdapter = {
|
|
|
22032
22033
|
return true;
|
|
22033
22034
|
},
|
|
22034
22035
|
getArgentEntry(configPath) {
|
|
22035
|
-
if (!
|
|
22036
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
22036
22037
|
const config = readToml(configPath);
|
|
22037
22038
|
const servers = config.mcp_servers;
|
|
22038
22039
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22064,7 +22065,7 @@ var codexAdapter = {
|
|
|
22064
22065
|
// them, and an emptied or removed table stays as it is.
|
|
22065
22066
|
refreshAllowlist(root, scope) {
|
|
22066
22067
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22067
|
-
if (!configPath || !
|
|
22068
|
+
if (!configPath || !fs19.existsSync(configPath)) return;
|
|
22068
22069
|
const config = readToml(configPath);
|
|
22069
22070
|
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
22070
22071
|
if (!toolsConfig) return;
|
|
@@ -22126,7 +22127,7 @@ var hermesAdapter = {
|
|
|
22126
22127
|
writeYaml(configPath, doc);
|
|
22127
22128
|
},
|
|
22128
22129
|
remove(configPath) {
|
|
22129
|
-
if (!
|
|
22130
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22130
22131
|
const doc = readYaml(configPath);
|
|
22131
22132
|
const servers = doc.get("mcp_servers");
|
|
22132
22133
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -22139,7 +22140,7 @@ var hermesAdapter = {
|
|
|
22139
22140
|
return true;
|
|
22140
22141
|
},
|
|
22141
22142
|
getArgentEntry(configPath) {
|
|
22142
|
-
if (!
|
|
22143
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
22143
22144
|
const doc = readYaml(configPath);
|
|
22144
22145
|
const servers = doc.get("mcp_servers");
|
|
22145
22146
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -22167,7 +22168,7 @@ function hasOpenCodeBinary() {
|
|
|
22167
22168
|
function pickOpencodeConfig(dir, candidates) {
|
|
22168
22169
|
for (const name of candidates) {
|
|
22169
22170
|
const candidate = path20.join(dir, name);
|
|
22170
|
-
if (
|
|
22171
|
+
if (fs19.existsSync(candidate)) return candidate;
|
|
22171
22172
|
}
|
|
22172
22173
|
return path20.join(dir, "opencode.json");
|
|
22173
22174
|
}
|
|
@@ -22191,7 +22192,7 @@ var openCodeAdapter = {
|
|
|
22191
22192
|
});
|
|
22192
22193
|
},
|
|
22193
22194
|
remove(configPath) {
|
|
22194
|
-
if (!
|
|
22195
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22195
22196
|
const config = readJsonc(configPath);
|
|
22196
22197
|
const servers = config.mcp;
|
|
22197
22198
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22199,7 +22200,7 @@ var openCodeAdapter = {
|
|
|
22199
22200
|
return true;
|
|
22200
22201
|
},
|
|
22201
22202
|
getArgentEntry(configPath) {
|
|
22202
|
-
if (!
|
|
22203
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
22203
22204
|
const config = readJsonc(configPath);
|
|
22204
22205
|
const servers = config.mcp;
|
|
22205
22206
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22214,7 +22215,7 @@ var openCodeAdapter = {
|
|
|
22214
22215
|
},
|
|
22215
22216
|
removeAllowlist(root, scope) {
|
|
22216
22217
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22217
|
-
if (!configPath || !
|
|
22218
|
+
if (!configPath || !fs19.existsSync(configPath)) return;
|
|
22218
22219
|
const config = readJsonc(configPath);
|
|
22219
22220
|
const tools = config.tools;
|
|
22220
22221
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -22244,7 +22245,7 @@ var kiroAdapter = {
|
|
|
22244
22245
|
});
|
|
22245
22246
|
},
|
|
22246
22247
|
remove(configPath) {
|
|
22247
|
-
if (!
|
|
22248
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22248
22249
|
const config = readJsonc(configPath);
|
|
22249
22250
|
const servers = config.mcpServers;
|
|
22250
22251
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22252,7 +22253,7 @@ var kiroAdapter = {
|
|
|
22252
22253
|
return true;
|
|
22253
22254
|
},
|
|
22254
22255
|
getArgentEntry(configPath) {
|
|
22255
|
-
if (!
|
|
22256
|
+
if (!fs19.existsSync(configPath)) return null;
|
|
22256
22257
|
const config = readJsonc(configPath);
|
|
22257
22258
|
const servers = config.mcpServers;
|
|
22258
22259
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22276,7 +22277,7 @@ var kiroAdapter = {
|
|
|
22276
22277
|
},
|
|
22277
22278
|
removeAllowlist(root, scope) {
|
|
22278
22279
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22279
|
-
if (!configPath || !
|
|
22280
|
+
if (!configPath || !fs19.existsSync(configPath)) return;
|
|
22280
22281
|
const config = readJsonc(configPath);
|
|
22281
22282
|
const servers = config.mcpServers;
|
|
22282
22283
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -22328,7 +22329,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
22328
22329
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
22329
22330
|
}
|
|
22330
22331
|
function removeAllowRule(settingsPath, rule) {
|
|
22331
|
-
if (!
|
|
22332
|
+
if (!fs19.existsSync(settingsPath)) return;
|
|
22332
22333
|
const config = readJsonc(settingsPath);
|
|
22333
22334
|
const permissions = config?.permissions;
|
|
22334
22335
|
const allow = permissions?.allow;
|
|
@@ -22449,12 +22450,12 @@ function stripFrontmatter(content) {
|
|
|
22449
22450
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22450
22451
|
}
|
|
22451
22452
|
function readAndConcatRules(rulesDir) {
|
|
22452
|
-
if (!
|
|
22453
|
-
const files =
|
|
22453
|
+
if (!fs19.existsSync(rulesDir)) return null;
|
|
22454
|
+
const files = fs19.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22454
22455
|
if (files.length === 0) return null;
|
|
22455
22456
|
const parts = [];
|
|
22456
22457
|
for (const file of files) {
|
|
22457
|
-
const raw =
|
|
22458
|
+
const raw = fs19.readFileSync(path20.join(rulesDir, file), "utf8");
|
|
22458
22459
|
const stripped = stripFrontmatter(raw);
|
|
22459
22460
|
if (stripped) parts.push(stripped);
|
|
22460
22461
|
}
|
|
@@ -22489,7 +22490,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22489
22490
|
return configPath;
|
|
22490
22491
|
}
|
|
22491
22492
|
function removeCodexRules(configPath) {
|
|
22492
|
-
if (!
|
|
22493
|
+
if (!fs19.existsSync(configPath)) return false;
|
|
22493
22494
|
const config = readToml(configPath);
|
|
22494
22495
|
const existing = config.developer_instructions;
|
|
22495
22496
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22635,14 +22636,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22635
22636
|
|
|
22636
22637
|
// ../argent-installer/src/cli-record.ts
|
|
22637
22638
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22638
|
-
import * as
|
|
22639
|
+
import * as fs20 from "node:fs";
|
|
22639
22640
|
import * as path22 from "node:path";
|
|
22640
22641
|
function cliRecordPath() {
|
|
22641
22642
|
return path22.join(argentHomeDir(), "cli.json");
|
|
22642
22643
|
}
|
|
22643
22644
|
function readCliRecord() {
|
|
22644
22645
|
try {
|
|
22645
|
-
const parsed = JSON.parse(
|
|
22646
|
+
const parsed = JSON.parse(fs20.readFileSync(cliRecordPath(), "utf8"));
|
|
22646
22647
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22647
22648
|
return null;
|
|
22648
22649
|
} catch {
|
|
@@ -22671,10 +22672,10 @@ function writeCliRecord(input) {
|
|
|
22671
22672
|
function persistCliRecord(record) {
|
|
22672
22673
|
const file = cliRecordPath();
|
|
22673
22674
|
try {
|
|
22674
|
-
|
|
22675
|
+
fs20.mkdirSync(path22.dirname(file), { recursive: true });
|
|
22675
22676
|
const temporary = `${file}.${process.pid}.tmp`;
|
|
22676
|
-
|
|
22677
|
-
|
|
22677
|
+
fs20.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22678
|
+
fs20.renameSync(temporary, file);
|
|
22678
22679
|
return file;
|
|
22679
22680
|
} catch {
|
|
22680
22681
|
return null;
|
|
@@ -22682,10 +22683,10 @@ function persistCliRecord(record) {
|
|
|
22682
22683
|
}
|
|
22683
22684
|
function healCliRecord(input) {
|
|
22684
22685
|
try {
|
|
22685
|
-
if (!
|
|
22686
|
+
if (!fs20.existsSync(input.cli)) return null;
|
|
22686
22687
|
const existing = readCliRecord();
|
|
22687
22688
|
if (existing) {
|
|
22688
|
-
const alive =
|
|
22689
|
+
const alive = fs20.existsSync(existing.node) && fs20.existsSync(existing.cli);
|
|
22689
22690
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22690
22691
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22691
22692
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22710,7 +22711,7 @@ function removeCliRecordFor(installDir) {
|
|
|
22710
22711
|
const relative5 = path22.relative(root, path22.resolve(record.cli));
|
|
22711
22712
|
if (relative5.startsWith("..") || path22.isAbsolute(relative5)) return false;
|
|
22712
22713
|
try {
|
|
22713
|
-
|
|
22714
|
+
fs20.rmSync(cliRecordPath(), { force: true });
|
|
22714
22715
|
return true;
|
|
22715
22716
|
} catch {
|
|
22716
22717
|
return false;
|
|
@@ -22936,7 +22937,7 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22936
22937
|
|
|
22937
22938
|
// ../argent-installer/src/install-runner.ts
|
|
22938
22939
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22939
|
-
import * as
|
|
22940
|
+
import * as fs23 from "node:fs";
|
|
22940
22941
|
import * as path25 from "node:path";
|
|
22941
22942
|
|
|
22942
22943
|
// ../argent-installer/src/shell.ts
|
|
@@ -23001,13 +23002,13 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
23001
23002
|
|
|
23002
23003
|
// ../argent-installer/src/skills.ts
|
|
23003
23004
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
23004
|
-
import * as
|
|
23005
|
+
import * as fs22 from "node:fs";
|
|
23005
23006
|
import * as path24 from "node:path";
|
|
23006
23007
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
23007
23008
|
|
|
23008
23009
|
// ../argent-installer/src/skills-runner.ts
|
|
23009
23010
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
23010
|
-
import * as
|
|
23011
|
+
import * as fs21 from "node:fs";
|
|
23011
23012
|
import * as path23 from "node:path";
|
|
23012
23013
|
var WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
23013
23014
|
function findOnPath(bin, env, platform) {
|
|
@@ -23018,7 +23019,7 @@ function findOnPath(bin, env, platform) {
|
|
|
23018
23019
|
for (const dir of dirs) {
|
|
23019
23020
|
for (const ext of exts) {
|
|
23020
23021
|
const candidate = path23.join(dir, bin + ext);
|
|
23021
|
-
if (
|
|
23022
|
+
if (fs21.existsSync(candidate)) return candidate;
|
|
23022
23023
|
}
|
|
23023
23024
|
}
|
|
23024
23025
|
return null;
|
|
@@ -23026,8 +23027,8 @@ function findOnPath(bin, env, platform) {
|
|
|
23026
23027
|
for (const dir of dirs) {
|
|
23027
23028
|
const candidate = path23.join(dir, bin);
|
|
23028
23029
|
try {
|
|
23029
|
-
if (!
|
|
23030
|
-
|
|
23030
|
+
if (!fs21.statSync(candidate).isFile()) continue;
|
|
23031
|
+
fs21.accessSync(candidate, fs21.constants.X_OK);
|
|
23031
23032
|
return candidate;
|
|
23032
23033
|
} catch {
|
|
23033
23034
|
}
|
|
@@ -23204,13 +23205,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
23204
23205
|
let candidates = names;
|
|
23205
23206
|
if (names.length === 0) {
|
|
23206
23207
|
try {
|
|
23207
|
-
candidates =
|
|
23208
|
+
candidates = fs22.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
23208
23209
|
} catch {
|
|
23209
23210
|
continue;
|
|
23210
23211
|
}
|
|
23211
23212
|
}
|
|
23212
23213
|
for (const name of candidates) {
|
|
23213
|
-
const stat6 =
|
|
23214
|
+
const stat6 = fs22.statSync(path24.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
23214
23215
|
if (!stat6?.isFile()) continue;
|
|
23215
23216
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
23216
23217
|
}
|
|
@@ -23248,13 +23249,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
23248
23249
|
}
|
|
23249
23250
|
function removeLockEntries(lockPath, names) {
|
|
23250
23251
|
try {
|
|
23251
|
-
const lock = JSON.parse(
|
|
23252
|
+
const lock = JSON.parse(fs22.readFileSync(lockPath, "utf8"));
|
|
23252
23253
|
const skills = lock.skills;
|
|
23253
23254
|
if (!skills) return [];
|
|
23254
23255
|
const removed = names.filter((name) => name in skills);
|
|
23255
23256
|
if (removed.length === 0) return [];
|
|
23256
23257
|
for (const name of removed) delete skills[name];
|
|
23257
|
-
|
|
23258
|
+
fs22.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
23258
23259
|
return removed;
|
|
23259
23260
|
} catch {
|
|
23260
23261
|
return [];
|
|
@@ -23325,7 +23326,7 @@ async function runInstall(args) {
|
|
|
23325
23326
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
23326
23327
|
}
|
|
23327
23328
|
function installSpec(fromTar) {
|
|
23328
|
-
return
|
|
23329
|
+
return fs23.existsSync(fromTar) ? path25.resolve(fromTar) : fromTar;
|
|
23329
23330
|
}
|
|
23330
23331
|
async function installLocally(opts) {
|
|
23331
23332
|
const { fromTar, tel } = opts;
|
|
@@ -23632,7 +23633,7 @@ async function chooseAdapters(opts) {
|
|
|
23632
23633
|
|
|
23633
23634
|
// ../argent-installer/src/init-scope.ts
|
|
23634
23635
|
var import_picocolors6 = __toESM(require_picocolors(), 1);
|
|
23635
|
-
import { existsSync as
|
|
23636
|
+
import { existsSync as existsSync16 } from "node:fs";
|
|
23636
23637
|
import { resolve as resolve15 } from "node:path";
|
|
23637
23638
|
async function chooseScope(opts) {
|
|
23638
23639
|
if (opts.installMode === "local") {
|
|
@@ -23671,7 +23672,7 @@ async function chooseScope(opts) {
|
|
|
23671
23672
|
validate(value) {
|
|
23672
23673
|
if (!value?.trim()) return "Path cannot be empty.";
|
|
23673
23674
|
const resolved = resolve15(value.trim());
|
|
23674
|
-
if (!
|
|
23675
|
+
if (!existsSync16(resolved))
|
|
23675
23676
|
return `Path does not exist: ${resolved}. Please verify and enter a valid path.`;
|
|
23676
23677
|
}
|
|
23677
23678
|
});
|
|
@@ -24555,7 +24556,7 @@ function printBanner() {
|
|
|
24555
24556
|
// ../argent-installer/src/update.ts
|
|
24556
24557
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24557
24558
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24558
|
-
import * as
|
|
24559
|
+
import * as fs25 from "node:fs";
|
|
24559
24560
|
import * as os5 from "node:os";
|
|
24560
24561
|
import * as path32 from "node:path";
|
|
24561
24562
|
|
|
@@ -24629,7 +24630,7 @@ async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
|
|
|
24629
24630
|
|
|
24630
24631
|
// ../argent-tools-client/src/launcher.ts
|
|
24631
24632
|
import * as net from "node:net";
|
|
24632
|
-
import * as
|
|
24633
|
+
import * as fs24 from "node:fs";
|
|
24633
24634
|
import * as path27 from "node:path";
|
|
24634
24635
|
import * as readline from "node:readline";
|
|
24635
24636
|
import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
|
|
@@ -24742,7 +24743,7 @@ function isPathWithin(child, parent) {
|
|
|
24742
24743
|
}
|
|
24743
24744
|
function tryRealpath(p) {
|
|
24744
24745
|
try {
|
|
24745
|
-
return
|
|
24746
|
+
return fs24.realpathSync(p);
|
|
24746
24747
|
} catch {
|
|
24747
24748
|
return p;
|
|
24748
24749
|
}
|
|
@@ -24769,7 +24770,7 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24769
24770
|
}
|
|
24770
24771
|
return killed;
|
|
24771
24772
|
}
|
|
24772
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24773
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs24.existsSync(p)) ?? "ps";
|
|
24773
24774
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24774
24775
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24775
24776
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -24955,7 +24956,7 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24955
24956
|
return installed ? "standalone_update" : "standalone_install";
|
|
24956
24957
|
}
|
|
24957
24958
|
function isLivePinnedEntry(entry) {
|
|
24958
|
-
return entry !== null && isPinnedGlobalEntry(entry) &&
|
|
24959
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs25.existsSync(entry.command) && fs25.existsSync(entry.args[0]);
|
|
24959
24960
|
}
|
|
24960
24961
|
async function refreshConfiguration({
|
|
24961
24962
|
projectRoot,
|
|
@@ -25187,7 +25188,7 @@ async function update(args) {
|
|
|
25187
25188
|
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
25188
25189
|
if (automatic) {
|
|
25189
25190
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
25190
|
-
if (!globallyInstalled || !globalRoot ||
|
|
25191
|
+
if (!globallyInstalled || !globalRoot || fs25.realpathSync(globalRoot) !== projectRoot || !isAutoUpdateEnabled() || !ownsGlobalInstall(pm, projectRoot)) {
|
|
25191
25192
|
spinner2.stop("Could not confirm an automatic update for this installation.");
|
|
25192
25193
|
return "noop";
|
|
25193
25194
|
}
|
|
@@ -25388,7 +25389,7 @@ async function update(args) {
|
|
|
25388
25389
|
process.exit(1);
|
|
25389
25390
|
}
|
|
25390
25391
|
if (automatic) {
|
|
25391
|
-
const runningRoot =
|
|
25392
|
+
const runningRoot = fs25.realpathSync(resolvePackageRoot(import.meta.dirname));
|
|
25392
25393
|
const result = requestedVersion ? await applyUpdateForTarget("global", runningRoot) : "noop";
|
|
25393
25394
|
if (result === "updated" && requestedVersion) {
|
|
25394
25395
|
writeCliRecord({
|
|
@@ -25491,7 +25492,7 @@ async function update(args) {
|
|
|
25491
25492
|
// ../argent-installer/src/uninstall.ts
|
|
25492
25493
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
25493
25494
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
25494
|
-
import * as
|
|
25495
|
+
import * as fs26 from "node:fs";
|
|
25495
25496
|
import * as path33 from "node:path";
|
|
25496
25497
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
25497
25498
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
@@ -25513,10 +25514,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
25513
25514
|
};
|
|
25514
25515
|
function removeDirIfEmpty2(dirPath) {
|
|
25515
25516
|
try {
|
|
25516
|
-
if (!
|
|
25517
|
-
if (!
|
|
25518
|
-
if (
|
|
25519
|
-
|
|
25517
|
+
if (!fs26.existsSync(dirPath)) return false;
|
|
25518
|
+
if (!fs26.statSync(dirPath).isDirectory()) return false;
|
|
25519
|
+
if (fs26.readdirSync(dirPath).length > 0) return false;
|
|
25520
|
+
fs26.rmdirSync(dirPath);
|
|
25520
25521
|
return true;
|
|
25521
25522
|
} catch {
|
|
25522
25523
|
return false;
|
|
@@ -25526,7 +25527,7 @@ function collectBundledPaths(sourceDir) {
|
|
|
25526
25527
|
const files = [];
|
|
25527
25528
|
const directories = [];
|
|
25528
25529
|
function walk(currentDir, relativeDir = "") {
|
|
25529
|
-
for (const entry of
|
|
25530
|
+
for (const entry of fs26.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25530
25531
|
const relativePath = relativeDir ? path33.join(relativeDir, entry.name) : entry.name;
|
|
25531
25532
|
const absolutePath = path33.join(currentDir, entry.name);
|
|
25532
25533
|
if (entry.isDirectory()) {
|
|
@@ -25541,7 +25542,7 @@ function collectBundledPaths(sourceDir) {
|
|
|
25541
25542
|
return { files, directories };
|
|
25542
25543
|
}
|
|
25543
25544
|
function removeBundledContent(sourceDir, targetDir) {
|
|
25544
|
-
if (!
|
|
25545
|
+
if (!fs26.existsSync(sourceDir) || !fs26.existsSync(targetDir)) {
|
|
25545
25546
|
return { removedPaths: [], removedRoot: false };
|
|
25546
25547
|
}
|
|
25547
25548
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
@@ -25549,7 +25550,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25549
25550
|
for (const relativePath of files) {
|
|
25550
25551
|
const targetPath = path33.join(targetDir, relativePath);
|
|
25551
25552
|
try {
|
|
25552
|
-
const entry =
|
|
25553
|
+
const entry = fs26.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25553
25554
|
if (!entry || entry.isDirectory()) continue;
|
|
25554
25555
|
removePath(targetPath);
|
|
25555
25556
|
removedPaths.push(relativePath);
|
|
@@ -25562,18 +25563,18 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25562
25563
|
for (const relativePath of directories) {
|
|
25563
25564
|
const targetPath = path33.join(targetDir, relativePath);
|
|
25564
25565
|
try {
|
|
25565
|
-
if (!
|
|
25566
|
-
if (!
|
|
25567
|
-
if (
|
|
25568
|
-
|
|
25566
|
+
if (!fs26.existsSync(targetPath)) continue;
|
|
25567
|
+
if (!fs26.statSync(targetPath).isDirectory()) continue;
|
|
25568
|
+
if (fs26.readdirSync(targetPath).length > 0) continue;
|
|
25569
|
+
fs26.rmdirSync(targetPath);
|
|
25569
25570
|
} catch {
|
|
25570
25571
|
}
|
|
25571
25572
|
}
|
|
25572
25573
|
let removedRoot = false;
|
|
25573
25574
|
try {
|
|
25574
|
-
if (
|
|
25575
|
-
if (
|
|
25576
|
-
|
|
25575
|
+
if (fs26.existsSync(targetDir) && fs26.statSync(targetDir).isDirectory()) {
|
|
25576
|
+
if (fs26.readdirSync(targetDir).length === 0) {
|
|
25577
|
+
fs26.rmdirSync(targetDir);
|
|
25577
25578
|
removedRoot = true;
|
|
25578
25579
|
}
|
|
25579
25580
|
}
|
|
@@ -25586,7 +25587,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25586
25587
|
}
|
|
25587
25588
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
25588
25589
|
try {
|
|
25589
|
-
const content =
|
|
25590
|
+
const content = fs26.readFileSync(skillFilePath, "utf8");
|
|
25590
25591
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
25591
25592
|
if (!frontmatter) return fallbackName;
|
|
25592
25593
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -25597,18 +25598,18 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
25597
25598
|
}
|
|
25598
25599
|
}
|
|
25599
25600
|
function getBundledSkillNames(skillsDir) {
|
|
25600
|
-
if (!
|
|
25601
|
+
if (!fs26.existsSync(skillsDir)) return [];
|
|
25601
25602
|
const skillNames = [];
|
|
25602
|
-
for (const entry of
|
|
25603
|
+
for (const entry of fs26.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
25603
25604
|
if (!entry.isDirectory()) continue;
|
|
25604
25605
|
const skillFilePath = path33.join(skillsDir, entry.name, "SKILL.md");
|
|
25605
|
-
if (!
|
|
25606
|
+
if (!fs26.existsSync(skillFilePath)) continue;
|
|
25606
25607
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
25607
25608
|
}
|
|
25608
25609
|
return [...new Set(skillNames)].sort();
|
|
25609
25610
|
}
|
|
25610
25611
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
25611
|
-
if (!
|
|
25612
|
+
if (!fs26.existsSync(targetDir)) {
|
|
25612
25613
|
return { removedPaths: [], removedRoot: false };
|
|
25613
25614
|
}
|
|
25614
25615
|
const removedPaths = [];
|
|
@@ -25626,12 +25627,12 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
25626
25627
|
return { removedPaths, removedRoot };
|
|
25627
25628
|
}
|
|
25628
25629
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
25629
|
-
if (!
|
|
25630
|
+
if (!fs26.existsSync(lockPath)) {
|
|
25630
25631
|
return { removedSkills: [], removedFile: false };
|
|
25631
25632
|
}
|
|
25632
25633
|
let parsed;
|
|
25633
25634
|
try {
|
|
25634
|
-
parsed = JSON.parse(
|
|
25635
|
+
parsed = JSON.parse(fs26.readFileSync(lockPath, "utf8"));
|
|
25635
25636
|
} catch {
|
|
25636
25637
|
return { removedSkills: [], removedFile: false };
|
|
25637
25638
|
}
|
|
@@ -25658,10 +25659,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25658
25659
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25659
25660
|
);
|
|
25660
25661
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25661
|
-
|
|
25662
|
+
fs26.rmSync(lockPath, { force: true });
|
|
25662
25663
|
return { removedSkills, removedFile: true };
|
|
25663
25664
|
}
|
|
25664
|
-
|
|
25665
|
+
fs26.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25665
25666
|
return { removedSkills, removedFile: false };
|
|
25666
25667
|
}
|
|
25667
25668
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -25983,7 +25984,7 @@ async function uninstall(args) {
|
|
|
25983
25984
|
try {
|
|
25984
25985
|
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
25985
25986
|
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
25986
|
-
const removed = !leftover || removable.installDir !== null && !
|
|
25987
|
+
const removed = !leftover || removable.installDir !== null && !fs26.existsSync(removable.installDir);
|
|
25987
25988
|
if (removed) hasUninstalledPackage = true;
|
|
25988
25989
|
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
25989
25990
|
log.info(import_picocolors13.default.dim("Removed ~/.argent/cli.json (provider CLI discovery record)."));
|