@swmansion/argent 0.35.1-next.80 → 0.35.1-next.81
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/argent-android-devtools-0.4.0.apk +0 -0
- package/bin/darwin/argent-macos-helper +0 -0
- package/bin/darwin/ax-service +0 -0
- package/bin/darwin/tvos-ax-service +0 -0
- package/bin/darwin/tvos-hid-daemon +0 -0
- package/bin/network-inspector/network-inspector.jar +0 -0
- package/bin/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +345 -307
- package/dist/client.js +121 -88
- package/dist/installer.mjs +306 -271
- package/dist/mcp-server.mjs +196 -163
- package/dist/tool-server.cjs +609 -580
- package/dylibs/libArgentAudio.dylib +0 -0
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/macos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/macos/libNativeDevtoolsMacos.dylib +0 -0
- package/dylibs/tcp/argent-audio-feeder +0 -0
- package/dylibs/tcp/libArgentAudio.dylib +0 -0
- package/dylibs/tcp/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tcp/libKeyboardPatch.dylib +0 -0
- package/dylibs/tcp/libNativeDevtoolsIos.dylib +0 -0
- package/dylibs/tvos/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/tvos/libKeyboardPatch.dylib +0 -0
- package/dylibs/tvos/libNativeDevtoolsIos.dylib +0 -0
- package/package.json +2 -2
package/dist/installer.mjs
CHANGED
|
@@ -2431,10 +2431,10 @@ var require_truncate = __commonJS({
|
|
|
2431
2431
|
"../../node_modules/semver/functions/truncate.js"(exports, module) {
|
|
2432
2432
|
"use strict";
|
|
2433
2433
|
var parse6 = require_parse();
|
|
2434
|
-
var
|
|
2434
|
+
var constants5 = require_constants();
|
|
2435
2435
|
var SemVer = require_semver();
|
|
2436
2436
|
var truncate = (version, truncation, options) => {
|
|
2437
|
-
if (!
|
|
2437
|
+
if (!constants5.RELEASE_TYPES.includes(truncation)) {
|
|
2438
2438
|
return null;
|
|
2439
2439
|
}
|
|
2440
2440
|
const clonedVersion = cloneInputVersion(version, options);
|
|
@@ -3483,7 +3483,7 @@ var require_semver2 = __commonJS({
|
|
|
3483
3483
|
"../../node_modules/semver/index.js"(exports, module) {
|
|
3484
3484
|
"use strict";
|
|
3485
3485
|
var internalRe = require_re();
|
|
3486
|
-
var
|
|
3486
|
+
var constants5 = require_constants();
|
|
3487
3487
|
var SemVer = require_semver();
|
|
3488
3488
|
var identifiers = require_identifiers();
|
|
3489
3489
|
var parse6 = require_parse();
|
|
@@ -3567,8 +3567,8 @@ var require_semver2 = __commonJS({
|
|
|
3567
3567
|
re: internalRe.re,
|
|
3568
3568
|
src: internalRe.src,
|
|
3569
3569
|
tokens: internalRe.t,
|
|
3570
|
-
SEMVER_SPEC_VERSION:
|
|
3571
|
-
RELEASE_TYPES:
|
|
3570
|
+
SEMVER_SPEC_VERSION: constants5.SEMVER_SPEC_VERSION,
|
|
3571
|
+
RELEASE_TYPES: constants5.RELEASE_TYPES,
|
|
3572
3572
|
compareIdentifiers: identifiers.compareIdentifiers,
|
|
3573
3573
|
rcompareIdentifiers: identifiers.rcompareIdentifiers
|
|
3574
3574
|
};
|
|
@@ -10456,14 +10456,14 @@ var require_parser = __commonJS({
|
|
|
10456
10456
|
case "scalar":
|
|
10457
10457
|
case "single-quoted-scalar":
|
|
10458
10458
|
case "double-quoted-scalar": {
|
|
10459
|
-
const
|
|
10459
|
+
const fs29 = this.flowScalar(this.type);
|
|
10460
10460
|
if (atNextItem || it.value) {
|
|
10461
|
-
map.items.push({ start, key:
|
|
10461
|
+
map.items.push({ start, key: fs29, sep: [] });
|
|
10462
10462
|
this.onKeyLine = true;
|
|
10463
10463
|
} else if (it.sep) {
|
|
10464
|
-
this.stack.push(
|
|
10464
|
+
this.stack.push(fs29);
|
|
10465
10465
|
} else {
|
|
10466
|
-
Object.assign(it, { key:
|
|
10466
|
+
Object.assign(it, { key: fs29, sep: [] });
|
|
10467
10467
|
this.onKeyLine = true;
|
|
10468
10468
|
}
|
|
10469
10469
|
return;
|
|
@@ -10591,13 +10591,13 @@ var require_parser = __commonJS({
|
|
|
10591
10591
|
case "scalar":
|
|
10592
10592
|
case "single-quoted-scalar":
|
|
10593
10593
|
case "double-quoted-scalar": {
|
|
10594
|
-
const
|
|
10594
|
+
const fs29 = this.flowScalar(this.type);
|
|
10595
10595
|
if (!it || it.value)
|
|
10596
|
-
fc.items.push({ start: [], key:
|
|
10596
|
+
fc.items.push({ start: [], key: fs29, sep: [] });
|
|
10597
10597
|
else if (it.sep)
|
|
10598
|
-
this.stack.push(
|
|
10598
|
+
this.stack.push(fs29);
|
|
10599
10599
|
else
|
|
10600
|
-
Object.assign(it, { key:
|
|
10600
|
+
Object.assign(it, { key: fs29, sep: [] });
|
|
10601
10601
|
return;
|
|
10602
10602
|
}
|
|
10603
10603
|
case "flow-map-end":
|
|
@@ -15137,13 +15137,13 @@ var OTLPLogExporter = class extends OTLPExporterBase {
|
|
|
15137
15137
|
init_esm();
|
|
15138
15138
|
|
|
15139
15139
|
// ../telemetry/src/debug.ts
|
|
15140
|
-
import * as
|
|
15140
|
+
import * as fs9 from "node:fs";
|
|
15141
15141
|
|
|
15142
15142
|
// ../telemetry/src/paths.ts
|
|
15143
15143
|
import * as path9 from "node:path";
|
|
15144
15144
|
|
|
15145
15145
|
// ../configuration-core/src/flags.ts
|
|
15146
|
-
import * as
|
|
15146
|
+
import * as fs3 from "node:fs";
|
|
15147
15147
|
import * as path3 from "node:path";
|
|
15148
15148
|
|
|
15149
15149
|
// ../configuration-core/src/home.ts
|
|
@@ -15164,13 +15164,50 @@ function argentHomeDir(options = {}) {
|
|
|
15164
15164
|
return override ? path2.resolve(override.trim()) : path2.join(resolveHomeDir(options), ".argent");
|
|
15165
15165
|
}
|
|
15166
15166
|
|
|
15167
|
+
// ../configuration-core/src/write-file.ts
|
|
15168
|
+
import * as fs2 from "node:fs";
|
|
15169
|
+
import { randomBytes } from "node:crypto";
|
|
15170
|
+
function writeFileAtomicSync(file, data, mode = 438) {
|
|
15171
|
+
const tmp = `${file}.${randomBytes(8).toString("hex")}.tmp`;
|
|
15172
|
+
try {
|
|
15173
|
+
fs2.writeFileSync(tmp, data, { flag: "wx", mode });
|
|
15174
|
+
fs2.renameSync(tmp, file);
|
|
15175
|
+
} catch (err) {
|
|
15176
|
+
fs2.rmSync(tmp, { force: true });
|
|
15177
|
+
if (err.code !== "EBUSY" || !writeOwnFileInPlace(file, data, mode)) {
|
|
15178
|
+
throw err;
|
|
15179
|
+
}
|
|
15180
|
+
}
|
|
15181
|
+
}
|
|
15182
|
+
var IN_PLACE_FLAGS = fs2.constants.O_WRONLY | fs2.constants.O_NOFOLLOW | fs2.constants.O_NONBLOCK;
|
|
15183
|
+
function writeOwnFileInPlace(file, data, mode) {
|
|
15184
|
+
const uid = process.getuid?.();
|
|
15185
|
+
if (uid === void 0) return false;
|
|
15186
|
+
let fd;
|
|
15187
|
+
try {
|
|
15188
|
+
fd = fs2.openSync(file, IN_PLACE_FLAGS);
|
|
15189
|
+
} catch {
|
|
15190
|
+
return false;
|
|
15191
|
+
}
|
|
15192
|
+
try {
|
|
15193
|
+
const stat6 = fs2.fstatSync(fd);
|
|
15194
|
+
if (!stat6.isFile() || stat6.uid !== uid && uid !== 0) return false;
|
|
15195
|
+
fs2.fchmodSync(fd, stat6.mode & mode & 511);
|
|
15196
|
+
fs2.ftruncateSync(fd);
|
|
15197
|
+
fs2.writeFileSync(fd, data);
|
|
15198
|
+
return true;
|
|
15199
|
+
} finally {
|
|
15200
|
+
fs2.closeSync(fd);
|
|
15201
|
+
}
|
|
15202
|
+
}
|
|
15203
|
+
|
|
15167
15204
|
// ../configuration-core/src/flags.ts
|
|
15168
15205
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
15169
15206
|
function findProjectRoot(startDir) {
|
|
15170
15207
|
let current = path3.resolve(startDir);
|
|
15171
15208
|
while (true) {
|
|
15172
15209
|
for (const marker of PROJECT_MARKERS) {
|
|
15173
|
-
if (
|
|
15210
|
+
if (fs3.existsSync(path3.join(current, marker))) return current;
|
|
15174
15211
|
}
|
|
15175
15212
|
const parent = path3.dirname(current);
|
|
15176
15213
|
if (parent === current) return null;
|
|
@@ -15182,14 +15219,14 @@ function resolveProjectRoot(startDir) {
|
|
|
15182
15219
|
}
|
|
15183
15220
|
|
|
15184
15221
|
// ../configuration-core/src/paths.ts
|
|
15185
|
-
import * as
|
|
15222
|
+
import * as fs4 from "node:fs";
|
|
15186
15223
|
import * as path4 from "node:path";
|
|
15187
15224
|
function isHomeDir(dir, options = {}) {
|
|
15188
15225
|
return canonicalPath(dir) === canonicalPath(resolveHomeDir(options));
|
|
15189
15226
|
}
|
|
15190
15227
|
function canonicalPath(p) {
|
|
15191
15228
|
try {
|
|
15192
|
-
return
|
|
15229
|
+
return fs4.realpathSync.native(p);
|
|
15193
15230
|
} catch {
|
|
15194
15231
|
return path4.resolve(p);
|
|
15195
15232
|
}
|
|
@@ -15205,11 +15242,11 @@ function configFilePath(scope = "global", options = {}) {
|
|
|
15205
15242
|
|
|
15206
15243
|
// ../configuration-core/src/config.ts
|
|
15207
15244
|
import * as crypto from "node:crypto";
|
|
15208
|
-
import * as
|
|
15245
|
+
import * as fs5 from "node:fs";
|
|
15209
15246
|
import * as path5 from "node:path";
|
|
15210
15247
|
function readConfigObject(scope = "global", options = {}) {
|
|
15211
15248
|
try {
|
|
15212
|
-
const raw =
|
|
15249
|
+
const raw = fs5.readFileSync(configFilePath(scope, options), "utf8");
|
|
15213
15250
|
const json = JSON.parse(raw);
|
|
15214
15251
|
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
15215
15252
|
return json;
|
|
@@ -15267,9 +15304,9 @@ function acquireConfigLock(finalPath) {
|
|
|
15267
15304
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
15268
15305
|
for (; ; ) {
|
|
15269
15306
|
try {
|
|
15270
|
-
const fd =
|
|
15307
|
+
const fd = fs5.openSync(lockPath, "wx", 384);
|
|
15271
15308
|
try {
|
|
15272
|
-
|
|
15309
|
+
fs5.writeSync(fd, `${process.pid}
|
|
15273
15310
|
`);
|
|
15274
15311
|
} catch {
|
|
15275
15312
|
}
|
|
@@ -15277,8 +15314,8 @@ function acquireConfigLock(finalPath) {
|
|
|
15277
15314
|
} catch (err) {
|
|
15278
15315
|
if (err.code !== "EEXIST") return null;
|
|
15279
15316
|
try {
|
|
15280
|
-
if (Date.now() -
|
|
15281
|
-
|
|
15317
|
+
if (Date.now() - fs5.statSync(lockPath).mtimeMs > LOCK_STALE_MS) {
|
|
15318
|
+
fs5.unlinkSync(lockPath);
|
|
15282
15319
|
continue;
|
|
15283
15320
|
}
|
|
15284
15321
|
} catch {
|
|
@@ -15290,35 +15327,35 @@ function acquireConfigLock(finalPath) {
|
|
|
15290
15327
|
}
|
|
15291
15328
|
function releaseConfigLock(lock) {
|
|
15292
15329
|
try {
|
|
15293
|
-
|
|
15330
|
+
fs5.closeSync(lock.fd);
|
|
15294
15331
|
} catch {
|
|
15295
15332
|
}
|
|
15296
15333
|
try {
|
|
15297
|
-
|
|
15334
|
+
fs5.unlinkSync(lock.lockPath);
|
|
15298
15335
|
} catch {
|
|
15299
15336
|
}
|
|
15300
15337
|
}
|
|
15301
15338
|
function updateConfig(mutate, scope = "global", options = {}) {
|
|
15302
15339
|
const dir = configDir(scope, options);
|
|
15303
|
-
|
|
15340
|
+
fs5.mkdirSync(dir, { recursive: true });
|
|
15304
15341
|
const finalPath = configFilePath(scope, options);
|
|
15305
15342
|
const lock = acquireConfigLock(finalPath);
|
|
15306
15343
|
try {
|
|
15307
15344
|
const next = readConfigObject(scope, options);
|
|
15308
15345
|
mutate(next);
|
|
15309
15346
|
const tmpPath = path5.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
15310
|
-
const fd =
|
|
15347
|
+
const fd = fs5.openSync(tmpPath, "wx", 384);
|
|
15311
15348
|
try {
|
|
15312
|
-
|
|
15313
|
-
|
|
15349
|
+
fs5.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
15350
|
+
fs5.fsyncSync(fd);
|
|
15314
15351
|
} finally {
|
|
15315
|
-
|
|
15352
|
+
fs5.closeSync(fd);
|
|
15316
15353
|
}
|
|
15317
15354
|
try {
|
|
15318
|
-
|
|
15355
|
+
fs5.renameSync(tmpPath, finalPath);
|
|
15319
15356
|
} catch (err) {
|
|
15320
15357
|
try {
|
|
15321
|
-
|
|
15358
|
+
fs5.unlinkSync(tmpPath);
|
|
15322
15359
|
} catch {
|
|
15323
15360
|
}
|
|
15324
15361
|
throw err;
|
|
@@ -15352,7 +15389,7 @@ function setWhatsNewSeenVersion(version, options = {}) {
|
|
|
15352
15389
|
|
|
15353
15390
|
// ../configuration-core/src/secrets.ts
|
|
15354
15391
|
var import_dotenv = __toESM(require_dist(), 1);
|
|
15355
|
-
import * as
|
|
15392
|
+
import * as fs6 from "node:fs";
|
|
15356
15393
|
import * as path6 from "node:path";
|
|
15357
15394
|
|
|
15358
15395
|
// ../configuration-core/src/merge.ts
|
|
@@ -15544,7 +15581,7 @@ function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
|
15544
15581
|
}
|
|
15545
15582
|
|
|
15546
15583
|
// ../configuration-core/src/config-access.ts
|
|
15547
|
-
import * as
|
|
15584
|
+
import * as fs7 from "node:fs";
|
|
15548
15585
|
import * as path7 from "node:path";
|
|
15549
15586
|
function readScopeValue(def, scope, options) {
|
|
15550
15587
|
if (!def.scopes.includes(scope)) return void 0;
|
|
@@ -15585,7 +15622,7 @@ function isAutoUpdateEnabled() {
|
|
|
15585
15622
|
}
|
|
15586
15623
|
|
|
15587
15624
|
// ../configuration-core/src/cloud-android.ts
|
|
15588
|
-
import * as
|
|
15625
|
+
import * as fs8 from "node:fs";
|
|
15589
15626
|
import * as os2 from "node:os";
|
|
15590
15627
|
import * as path8 from "node:path";
|
|
15591
15628
|
var CLOUD_ANDROID_MARKER_TTL_MS = 2 * 6e4;
|
|
@@ -15625,8 +15662,8 @@ function emitDebugPayload(payload) {
|
|
|
15625
15662
|
} catch {
|
|
15626
15663
|
}
|
|
15627
15664
|
try {
|
|
15628
|
-
|
|
15629
|
-
|
|
15665
|
+
fs9.mkdirSync(argentHomeDir(), { recursive: true });
|
|
15666
|
+
fs9.appendFileSync(debugLogPath(), line + "\n");
|
|
15630
15667
|
} catch {
|
|
15631
15668
|
}
|
|
15632
15669
|
}
|
|
@@ -15814,11 +15851,11 @@ var LAUNCH_PLATFORMS = ["ios", "android", "chromium", "vega", "macos"];
|
|
|
15814
15851
|
var SELECTABLE_PLATFORMS = [...LAUNCH_PLATFORMS, "ios-remote"];
|
|
15815
15852
|
|
|
15816
15853
|
// ../registry/src/flow-file-refs.ts
|
|
15817
|
-
import * as
|
|
15854
|
+
import * as fs11 from "node:fs/promises";
|
|
15818
15855
|
import * as path11 from "node:path";
|
|
15819
15856
|
|
|
15820
15857
|
// ../registry/src/e2e-dirs.ts
|
|
15821
|
-
import * as
|
|
15858
|
+
import * as fs10 from "node:fs/promises";
|
|
15822
15859
|
import * as path10 from "node:path";
|
|
15823
15860
|
var E2E_DIR = path10.join(".argent", "e2e");
|
|
15824
15861
|
var LEGACY_E2E_DIRS = Object.freeze([path10.join(".argent", "flows")]);
|
|
@@ -17138,7 +17175,7 @@ function isCi(env = process.env) {
|
|
|
17138
17175
|
var SESSION_ID = randomUUID4();
|
|
17139
17176
|
function readCliVersion() {
|
|
17140
17177
|
if (true) {
|
|
17141
|
-
return "0.35.1-next.
|
|
17178
|
+
return "0.35.1-next.81";
|
|
17142
17179
|
}
|
|
17143
17180
|
return "0.0.0";
|
|
17144
17181
|
}
|
|
@@ -17171,7 +17208,7 @@ function getBaseProps(runtime) {
|
|
|
17171
17208
|
|
|
17172
17209
|
// ../telemetry/src/identity.ts
|
|
17173
17210
|
import * as crypto2 from "node:crypto";
|
|
17174
|
-
import * as
|
|
17211
|
+
import * as fs12 from "node:fs";
|
|
17175
17212
|
import * as path12 from "node:path";
|
|
17176
17213
|
var FINGERPRINT_PATTERN = /^[0-9a-f]{64}$/;
|
|
17177
17214
|
var cached = null;
|
|
@@ -17279,17 +17316,17 @@ function resolveFingerprintOnce(resolveFingerprint) {
|
|
|
17279
17316
|
function isCorruptIdFile(filePath) {
|
|
17280
17317
|
let isRegularFile;
|
|
17281
17318
|
try {
|
|
17282
|
-
isRegularFile =
|
|
17319
|
+
isRegularFile = fs12.lstatSync(filePath).isFile();
|
|
17283
17320
|
} catch {
|
|
17284
17321
|
return false;
|
|
17285
17322
|
}
|
|
17286
17323
|
return isRegularFile && tryReadId(filePath) === null;
|
|
17287
17324
|
}
|
|
17288
17325
|
function writeIdFileAtomic(finalPath, id) {
|
|
17289
|
-
|
|
17326
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17290
17327
|
let occupant;
|
|
17291
17328
|
try {
|
|
17292
|
-
occupant =
|
|
17329
|
+
occupant = fs12.lstatSync(finalPath);
|
|
17293
17330
|
} catch (err) {
|
|
17294
17331
|
if (err.code !== "ENOENT") throw err;
|
|
17295
17332
|
}
|
|
@@ -17300,24 +17337,24 @@ function writeIdFileAtomic(finalPath, id) {
|
|
|
17300
17337
|
argentHomeDir(),
|
|
17301
17338
|
`.telemetry-id.tmp.${process.pid}.${crypto2.randomUUID()}`
|
|
17302
17339
|
);
|
|
17303
|
-
const fd =
|
|
17340
|
+
const fd = fs12.openSync(tmpPath, "wx", 384);
|
|
17304
17341
|
try {
|
|
17305
17342
|
try {
|
|
17306
|
-
|
|
17307
|
-
|
|
17343
|
+
fs12.writeSync(fd, id);
|
|
17344
|
+
fs12.fsyncSync(fd);
|
|
17308
17345
|
} finally {
|
|
17309
|
-
|
|
17346
|
+
fs12.closeSync(fd);
|
|
17310
17347
|
}
|
|
17311
|
-
|
|
17348
|
+
fs12.renameSync(tmpPath, finalPath);
|
|
17312
17349
|
} finally {
|
|
17313
17350
|
try {
|
|
17314
|
-
|
|
17351
|
+
fs12.unlinkSync(tmpPath);
|
|
17315
17352
|
} catch {
|
|
17316
17353
|
}
|
|
17317
17354
|
}
|
|
17318
17355
|
}
|
|
17319
17356
|
function mintRandomId(finalPath) {
|
|
17320
|
-
|
|
17357
|
+
fs12.mkdirSync(argentHomeDir(), { recursive: true });
|
|
17321
17358
|
let value = crypto2.randomUUID();
|
|
17322
17359
|
for (let attempt = 0; attempt < 3; attempt++) {
|
|
17323
17360
|
const tmpPath = path12.join(
|
|
@@ -17326,19 +17363,19 @@ function mintRandomId(finalPath) {
|
|
|
17326
17363
|
);
|
|
17327
17364
|
let fd;
|
|
17328
17365
|
try {
|
|
17329
|
-
fd =
|
|
17366
|
+
fd = fs12.openSync(tmpPath, "wx", 384);
|
|
17330
17367
|
} catch (err) {
|
|
17331
17368
|
if (err.code === "EEXIST") continue;
|
|
17332
17369
|
throw err;
|
|
17333
17370
|
}
|
|
17334
17371
|
try {
|
|
17335
17372
|
try {
|
|
17336
|
-
|
|
17337
|
-
|
|
17373
|
+
fs12.writeSync(fd, value);
|
|
17374
|
+
fs12.fsyncSync(fd);
|
|
17338
17375
|
} finally {
|
|
17339
|
-
|
|
17376
|
+
fs12.closeSync(fd);
|
|
17340
17377
|
}
|
|
17341
|
-
|
|
17378
|
+
fs12.linkSync(tmpPath, finalPath);
|
|
17342
17379
|
cached = { path: finalPath, id: value };
|
|
17343
17380
|
return value;
|
|
17344
17381
|
} catch (err) {
|
|
@@ -17357,7 +17394,7 @@ function mintRandomId(finalPath) {
|
|
|
17357
17394
|
throw err;
|
|
17358
17395
|
} finally {
|
|
17359
17396
|
try {
|
|
17360
|
-
|
|
17397
|
+
fs12.unlinkSync(tmpPath);
|
|
17361
17398
|
} catch {
|
|
17362
17399
|
}
|
|
17363
17400
|
}
|
|
@@ -17370,7 +17407,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17370
17407
|
`.telemetry-id.corrupt.${process.pid}.${crypto2.randomUUID()}`
|
|
17371
17408
|
);
|
|
17372
17409
|
try {
|
|
17373
|
-
|
|
17410
|
+
fs12.renameSync(finalPath, claimed);
|
|
17374
17411
|
} catch {
|
|
17375
17412
|
return null;
|
|
17376
17413
|
}
|
|
@@ -17379,7 +17416,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17379
17416
|
grabbed = tryReadId(claimed);
|
|
17380
17417
|
} finally {
|
|
17381
17418
|
try {
|
|
17382
|
-
|
|
17419
|
+
fs12.unlinkSync(claimed);
|
|
17383
17420
|
} catch {
|
|
17384
17421
|
}
|
|
17385
17422
|
}
|
|
@@ -17388,7 +17425,7 @@ function claimCorruptOccupant(finalPath) {
|
|
|
17388
17425
|
function deleteAnonId() {
|
|
17389
17426
|
cached = null;
|
|
17390
17427
|
try {
|
|
17391
|
-
|
|
17428
|
+
fs12.unlinkSync(identityFilePath());
|
|
17392
17429
|
} catch (err) {
|
|
17393
17430
|
if (err.code !== "ENOENT") throw err;
|
|
17394
17431
|
}
|
|
@@ -17396,9 +17433,9 @@ function deleteAnonId() {
|
|
|
17396
17433
|
function tryReadId(filePath) {
|
|
17397
17434
|
let raw;
|
|
17398
17435
|
try {
|
|
17399
|
-
const stats =
|
|
17436
|
+
const stats = fs12.lstatSync(filePath);
|
|
17400
17437
|
if (!stats.isFile()) return null;
|
|
17401
|
-
raw =
|
|
17438
|
+
raw = fs12.readFileSync(filePath, "utf8");
|
|
17402
17439
|
} catch (err) {
|
|
17403
17440
|
if (err.code === "ENOENT") return null;
|
|
17404
17441
|
return null;
|
|
@@ -17413,7 +17450,7 @@ import { execFileSync, spawn } from "node:child_process";
|
|
|
17413
17450
|
|
|
17414
17451
|
// ../native-devtools-ios/src/index.ts
|
|
17415
17452
|
import * as path13 from "node:path";
|
|
17416
|
-
import * as
|
|
17453
|
+
import * as fs13 from "node:fs";
|
|
17417
17454
|
var DYLIB_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_DIR ?? path13.join(__dirname, "..", "dylibs");
|
|
17418
17455
|
var BIN_DIR = process.env.ARGENT_SIMULATOR_SERVER_DIR ?? path13.join(__dirname, "..", "bin");
|
|
17419
17456
|
var DYLIB_TCP_DIR = process.env.ARGENT_NATIVE_DEVTOOLS_TCP_DIR ?? path13.join(DYLIB_DIR, "tcp");
|
|
@@ -17433,9 +17470,9 @@ function platformBinDir() {
|
|
|
17433
17470
|
function simulatorServerBinaryPath() {
|
|
17434
17471
|
const binaryName = simulatorServerBinaryName();
|
|
17435
17472
|
const p = path13.join(platformBinDir(), binaryName);
|
|
17436
|
-
if (!
|
|
17473
|
+
if (!fs13.existsSync(p)) {
|
|
17437
17474
|
const flat = path13.join(BIN_DIR, binaryName);
|
|
17438
|
-
const migrationHint =
|
|
17475
|
+
const migrationHint = fs13.existsSync(flat) ? ` Found a binary at the old flat path ${flat}; move it to ${p} or update ARGENT_SIMULATOR_SERVER_DIR to point at the parent of the platform subdirectory.` : "";
|
|
17439
17476
|
throw new Error(
|
|
17440
17477
|
`simulator-server binary not found for platform "${hostPlatformKey()}" at ${p}. Supported hosts today: darwin, linux (x86_64 and arm64), win32.${migrationHint}`
|
|
17441
17478
|
);
|
|
@@ -17515,7 +17552,7 @@ function resolveHostFingerprintAsync() {
|
|
|
17515
17552
|
}
|
|
17516
17553
|
|
|
17517
17554
|
// ../telemetry/src/consent.ts
|
|
17518
|
-
import * as
|
|
17555
|
+
import * as fs14 from "node:fs";
|
|
17519
17556
|
import * as path14 from "node:path";
|
|
17520
17557
|
var cache = /* @__PURE__ */ new Map();
|
|
17521
17558
|
var sessionOverride = null;
|
|
@@ -17523,7 +17560,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17523
17560
|
const miss = { mtimeMs: null, fingerprint: null, enabledOverride: null };
|
|
17524
17561
|
let stats;
|
|
17525
17562
|
try {
|
|
17526
|
-
stats =
|
|
17563
|
+
stats = fs14.lstatSync(filePath);
|
|
17527
17564
|
} catch {
|
|
17528
17565
|
cache.set(filePath, miss);
|
|
17529
17566
|
return null;
|
|
@@ -17540,7 +17577,7 @@ function readConfigOverrideAt(filePath) {
|
|
|
17540
17577
|
}
|
|
17541
17578
|
let parsedEnabled = null;
|
|
17542
17579
|
try {
|
|
17543
|
-
const raw =
|
|
17580
|
+
const raw = fs14.readFileSync(filePath, "utf8");
|
|
17544
17581
|
const json = JSON.parse(raw);
|
|
17545
17582
|
if (json && typeof json === "object") {
|
|
17546
17583
|
const t2 = json.telemetry;
|
|
@@ -17778,7 +17815,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
17778
17815
|
}
|
|
17779
17816
|
|
|
17780
17817
|
// ../argent-installer/src/mcp-configs.ts
|
|
17781
|
-
import * as
|
|
17818
|
+
import * as fs21 from "node:fs";
|
|
17782
17819
|
import * as path21 from "node:path";
|
|
17783
17820
|
import { execFileSync as execFileSync5 } from "node:child_process";
|
|
17784
17821
|
import { homedir as homedir5 } from "node:os";
|
|
@@ -17794,7 +17831,7 @@ var CURSOR_ALLOWLIST_PATTERN = "argent:*";
|
|
|
17794
17831
|
|
|
17795
17832
|
// ../argent-installer/src/utils.ts
|
|
17796
17833
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
17797
|
-
import * as
|
|
17834
|
+
import * as fs20 from "node:fs";
|
|
17798
17835
|
import * as path20 from "node:path";
|
|
17799
17836
|
import * as dns from "node:dns";
|
|
17800
17837
|
import { createHash as createHash2 } from "node:crypto";
|
|
@@ -20118,12 +20155,12 @@ function applyEdits(text2, edits) {
|
|
|
20118
20155
|
}
|
|
20119
20156
|
|
|
20120
20157
|
// ../argent-installer/src/package-root.ts
|
|
20121
|
-
import * as
|
|
20158
|
+
import * as fs15 from "node:fs";
|
|
20122
20159
|
import * as path15 from "node:path";
|
|
20123
20160
|
function resolvePackageRoot(dirname20) {
|
|
20124
20161
|
let current = path15.resolve(dirname20);
|
|
20125
20162
|
while (true) {
|
|
20126
|
-
if (
|
|
20163
|
+
if (fs15.existsSync(path15.join(current, "package.json"))) return current;
|
|
20127
20164
|
const parent = path15.dirname(current);
|
|
20128
20165
|
if (parent === current) return path15.resolve(dirname20);
|
|
20129
20166
|
current = parent;
|
|
@@ -20132,25 +20169,25 @@ function resolvePackageRoot(dirname20) {
|
|
|
20132
20169
|
|
|
20133
20170
|
// ../argent-installer/src/package-manager.ts
|
|
20134
20171
|
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
20135
|
-
import * as
|
|
20172
|
+
import * as fs18 from "node:fs";
|
|
20136
20173
|
import * as os3 from "node:os";
|
|
20137
20174
|
import * as path18 from "node:path";
|
|
20138
20175
|
|
|
20139
20176
|
// ../argent-installer/src/topology.ts
|
|
20140
20177
|
var import_semver2 = __toESM(require_semver2(), 1);
|
|
20141
|
-
import * as
|
|
20178
|
+
import * as fs17 from "node:fs";
|
|
20142
20179
|
import * as path17 from "node:path";
|
|
20143
20180
|
import { createRequire } from "node:module";
|
|
20144
20181
|
import { execFileSync as execFileSync2 } from "node:child_process";
|
|
20145
20182
|
|
|
20146
20183
|
// ../argent-installer/src/preflight.ts
|
|
20147
|
-
import * as
|
|
20184
|
+
import * as fs16 from "node:fs";
|
|
20148
20185
|
import * as path16 from "node:path";
|
|
20149
20186
|
function hasProjectPackageJson(projectRoot) {
|
|
20150
|
-
return
|
|
20187
|
+
return fs16.existsSync(path16.join(projectRoot, "package.json"));
|
|
20151
20188
|
}
|
|
20152
20189
|
function isYarnPnp(projectRoot) {
|
|
20153
|
-
return
|
|
20190
|
+
return fs16.existsSync(path16.join(projectRoot, ".pnp.cjs")) || fs16.existsSync(path16.join(projectRoot, ".pnp.loader.mjs"));
|
|
20154
20191
|
}
|
|
20155
20192
|
|
|
20156
20193
|
// ../argent-installer/src/topology.ts
|
|
@@ -20229,8 +20266,8 @@ function getGloballyInstalledPackageRoot() {
|
|
|
20229
20266
|
}
|
|
20230
20267
|
function readShimScript(binaryPath) {
|
|
20231
20268
|
try {
|
|
20232
|
-
if (
|
|
20233
|
-
return
|
|
20269
|
+
if (fs17.statSync(binaryPath).size > 64 * 1024) return null;
|
|
20270
|
+
return fs17.readFileSync(binaryPath, "utf8");
|
|
20234
20271
|
} catch {
|
|
20235
20272
|
return null;
|
|
20236
20273
|
}
|
|
@@ -20251,9 +20288,9 @@ function globalPackageRootOf(binaryPath) {
|
|
|
20251
20288
|
}
|
|
20252
20289
|
function packageRootOf(binaryPath) {
|
|
20253
20290
|
try {
|
|
20254
|
-
const realPath =
|
|
20291
|
+
const realPath = fs17.realpathSync(binaryPath);
|
|
20255
20292
|
const root = resolvePackageRoot(path17.dirname(realPath));
|
|
20256
|
-
const pkg = JSON.parse(
|
|
20293
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(root, "package.json"), "utf8"));
|
|
20257
20294
|
return pkg.name === PACKAGE_NAME ? root : null;
|
|
20258
20295
|
} catch {
|
|
20259
20296
|
return null;
|
|
@@ -20263,7 +20300,7 @@ function cliPathOf(packageRoot) {
|
|
|
20263
20300
|
const binSub = argentBinSubpath(packageRoot);
|
|
20264
20301
|
if (!binSub) return null;
|
|
20265
20302
|
const cli = path17.join(packageRoot, binSub);
|
|
20266
|
-
return
|
|
20303
|
+
return fs17.existsSync(cli) ? cli : null;
|
|
20267
20304
|
}
|
|
20268
20305
|
function getGloballyInstalledLaunchPaths() {
|
|
20269
20306
|
if (process.platform === "win32") return null;
|
|
@@ -20273,8 +20310,8 @@ function getGloballyInstalledLaunchPaths() {
|
|
|
20273
20310
|
const cli = packageRoot ? cliPathOf(packageRoot) : null;
|
|
20274
20311
|
if (!cli) return null;
|
|
20275
20312
|
try {
|
|
20276
|
-
const node = path17.join(
|
|
20277
|
-
return
|
|
20313
|
+
const node = path17.join(fs17.realpathSync(path17.dirname(binaryPath)), "node");
|
|
20314
|
+
return fs17.existsSync(node) ? { node, cli } : null;
|
|
20278
20315
|
} catch {
|
|
20279
20316
|
return null;
|
|
20280
20317
|
}
|
|
@@ -20283,7 +20320,7 @@ function getGloballyInstalledVersion() {
|
|
|
20283
20320
|
const pkgRoot = getGloballyInstalledPackageRoot();
|
|
20284
20321
|
if (!pkgRoot) return null;
|
|
20285
20322
|
try {
|
|
20286
|
-
const pkg = JSON.parse(
|
|
20323
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(pkgRoot, "package.json"), "utf8"));
|
|
20287
20324
|
return pkg.version ?? null;
|
|
20288
20325
|
} catch {
|
|
20289
20326
|
return null;
|
|
@@ -20292,7 +20329,7 @@ function getGloballyInstalledVersion() {
|
|
|
20292
20329
|
function readManifestDeclaration(projectRoot) {
|
|
20293
20330
|
try {
|
|
20294
20331
|
const pkg = JSON.parse(
|
|
20295
|
-
|
|
20332
|
+
fs17.readFileSync(path17.join(projectRoot, "package.json"), "utf8")
|
|
20296
20333
|
);
|
|
20297
20334
|
const spec = pkg.devDependencies?.[PACKAGE_NAME] ?? pkg.dependencies?.[PACKAGE_NAME] ?? pkg.optionalDependencies?.[PACKAGE_NAME];
|
|
20298
20335
|
return typeof spec === "string" ? spec : null;
|
|
@@ -20309,7 +20346,7 @@ function resolveLocalArgentDir(projectRoot) {
|
|
|
20309
20346
|
return path17.dirname(req.resolve(`${PACKAGE_NAME}/package.json`));
|
|
20310
20347
|
} catch {
|
|
20311
20348
|
const plain = path17.join(projectRoot, "node_modules", PACKAGE_NAME);
|
|
20312
|
-
return
|
|
20349
|
+
return fs17.existsSync(path17.join(plain, "package.json")) ? plain : null;
|
|
20313
20350
|
}
|
|
20314
20351
|
}
|
|
20315
20352
|
function probeLocalInstall(projectRoot) {
|
|
@@ -20317,7 +20354,7 @@ function probeLocalInstall(projectRoot) {
|
|
|
20317
20354
|
if (packageDir) {
|
|
20318
20355
|
let version;
|
|
20319
20356
|
try {
|
|
20320
|
-
const pkg = JSON.parse(
|
|
20357
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(packageDir, "package.json"), "utf8"));
|
|
20321
20358
|
version = pkg.version ?? null;
|
|
20322
20359
|
} catch {
|
|
20323
20360
|
version = null;
|
|
@@ -20341,7 +20378,7 @@ function getLocallyInstalledVersion(projectRoot) {
|
|
|
20341
20378
|
function readLocalPackageVersionUncached(projectRoot) {
|
|
20342
20379
|
try {
|
|
20343
20380
|
const pkgPath = path17.join(projectRoot, "node_modules", PACKAGE_NAME, "package.json");
|
|
20344
|
-
const pkg = JSON.parse(
|
|
20381
|
+
const pkg = JSON.parse(fs17.readFileSync(pkgPath, "utf8"));
|
|
20345
20382
|
return pkg.version ?? null;
|
|
20346
20383
|
} catch {
|
|
20347
20384
|
return null;
|
|
@@ -20349,7 +20386,7 @@ function readLocalPackageVersionUncached(projectRoot) {
|
|
|
20349
20386
|
}
|
|
20350
20387
|
function argentBinSubpath(pkgDir) {
|
|
20351
20388
|
try {
|
|
20352
|
-
const pkg = JSON.parse(
|
|
20389
|
+
const pkg = JSON.parse(fs17.readFileSync(path17.join(pkgDir, "package.json"), "utf8"));
|
|
20353
20390
|
if (typeof pkg.bin === "string") return pkg.bin;
|
|
20354
20391
|
if (pkg.bin && typeof pkg.bin === "object") {
|
|
20355
20392
|
return pkg.bin[MCP_BINARY_NAME] ?? Object.values(pkg.bin)[0] ?? null;
|
|
@@ -20366,15 +20403,15 @@ function getLocalArgentBinRelPath(projectRoot) {
|
|
|
20366
20403
|
if (!binSub) return null;
|
|
20367
20404
|
let root = projectRoot;
|
|
20368
20405
|
try {
|
|
20369
|
-
root =
|
|
20406
|
+
root = fs17.realpathSync(projectRoot);
|
|
20370
20407
|
} catch {
|
|
20371
20408
|
}
|
|
20372
20409
|
const stableRel = path17.join("node_modules", PACKAGE_NAME, binSub);
|
|
20373
|
-
if (
|
|
20410
|
+
if (fs17.existsSync(path17.join(root, stableRel))) {
|
|
20374
20411
|
return stableRel.split(path17.sep).join("/");
|
|
20375
20412
|
}
|
|
20376
20413
|
const abs = path17.join(pkgDir, binSub);
|
|
20377
|
-
if (!
|
|
20414
|
+
if (!fs17.existsSync(abs)) return null;
|
|
20378
20415
|
return path17.relative(root, abs).split(path17.sep).join("/");
|
|
20379
20416
|
}
|
|
20380
20417
|
|
|
@@ -20408,10 +20445,10 @@ function detectGlobalPackageManager() {
|
|
|
20408
20445
|
return BUN_GLOBAL_ROOT.test(root) ? "bun" : lockfileOwnerOf(root) ?? "yarn";
|
|
20409
20446
|
}
|
|
20410
20447
|
if (process.platform === "win32") {
|
|
20411
|
-
if (
|
|
20448
|
+
if (fs18.existsSync(path18.join(npmCopyBeside(path18.dirname(binaryPath)), "package.json"))) {
|
|
20412
20449
|
return "npm";
|
|
20413
20450
|
}
|
|
20414
|
-
if (
|
|
20451
|
+
if (fs18.existsSync(binaryPath.replace(/\.exe$/i, "") + ".bunx")) return "bun";
|
|
20415
20452
|
}
|
|
20416
20453
|
const shim = readShimScript(binaryPath);
|
|
20417
20454
|
if (shim === null || !/node_modules[\\/]/.test(shim)) return "npm";
|
|
@@ -20436,7 +20473,7 @@ function isInNpmLayout(binaryPath, root) {
|
|
|
20436
20473
|
const binDir = canonicalPath(path18.dirname(link));
|
|
20437
20474
|
if (canonicalPath(npmCopyBeside(binDir)) === realRoot) return true;
|
|
20438
20475
|
try {
|
|
20439
|
-
link = path18.resolve(binDir,
|
|
20476
|
+
link = path18.resolve(binDir, fs18.readlinkSync(link));
|
|
20440
20477
|
} catch {
|
|
20441
20478
|
return false;
|
|
20442
20479
|
}
|
|
@@ -20455,7 +20492,7 @@ function asKnownPm(name) {
|
|
|
20455
20492
|
}
|
|
20456
20493
|
function pmFromPackageManagerField(dir) {
|
|
20457
20494
|
try {
|
|
20458
|
-
const pkg = JSON.parse(
|
|
20495
|
+
const pkg = JSON.parse(fs18.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20459
20496
|
if (typeof pkg.packageManager === "string") {
|
|
20460
20497
|
return asKnownPm(pkg.packageManager.split("@")[0]);
|
|
20461
20498
|
}
|
|
@@ -20466,7 +20503,7 @@ function pmFromPackageManagerField(dir) {
|
|
|
20466
20503
|
}
|
|
20467
20504
|
function pmFromDevEngines(dir) {
|
|
20468
20505
|
try {
|
|
20469
|
-
const pkg = JSON.parse(
|
|
20506
|
+
const pkg = JSON.parse(fs18.readFileSync(path18.join(dir, "package.json"), "utf8"));
|
|
20470
20507
|
const devEnginesPm = pkg.devEngines?.packageManager;
|
|
20471
20508
|
const names = /* @__PURE__ */ new Set();
|
|
20472
20509
|
for (const entry of Array.isArray(devEnginesPm) ? devEnginesPm : [devEnginesPm]) {
|
|
@@ -20479,7 +20516,7 @@ function pmFromDevEngines(dir) {
|
|
|
20479
20516
|
}
|
|
20480
20517
|
}
|
|
20481
20518
|
function pmFromLockfile(dir) {
|
|
20482
|
-
const has = (file) =>
|
|
20519
|
+
const has = (file) => fs18.existsSync(path18.join(dir, file));
|
|
20483
20520
|
if (has("pnpm-lock.yaml")) return "pnpm";
|
|
20484
20521
|
if (has("yarn.lock")) return "yarn";
|
|
20485
20522
|
if (has("bun.lock") || has("bun.lockb")) return "bun";
|
|
@@ -20487,14 +20524,14 @@ function pmFromLockfile(dir) {
|
|
|
20487
20524
|
return null;
|
|
20488
20525
|
}
|
|
20489
20526
|
function pmFromWorkspaceMarker(dir) {
|
|
20490
|
-
return
|
|
20527
|
+
return fs18.existsSync(path18.join(dir, "pnpm-workspace.yaml")) ? "pnpm" : null;
|
|
20491
20528
|
}
|
|
20492
20529
|
function detectProjectPackageManager(projectRoot) {
|
|
20493
20530
|
let dir = path18.resolve(projectRoot);
|
|
20494
20531
|
for (; ; ) {
|
|
20495
20532
|
const pm = pmFromPackageManagerField(dir) ?? pmFromLockfile(dir) ?? pmFromDevEngines(dir) ?? pmFromWorkspaceMarker(dir);
|
|
20496
20533
|
if (pm) return pm;
|
|
20497
|
-
if (
|
|
20534
|
+
if (fs18.existsSync(path18.join(dir, ".git"))) break;
|
|
20498
20535
|
const parent = path18.dirname(dir);
|
|
20499
20536
|
if (parent === dir) break;
|
|
20500
20537
|
dir = parent;
|
|
@@ -20516,7 +20553,7 @@ function globalInstallCommand(pm, pkg) {
|
|
|
20516
20553
|
function globalCommandOptions(pm) {
|
|
20517
20554
|
if (pm === "npm") return {};
|
|
20518
20555
|
const home = os3.homedir();
|
|
20519
|
-
const cwd =
|
|
20556
|
+
const cwd = fs18.existsSync(home) ? { cwd: home } : {};
|
|
20520
20557
|
if (pm !== "yarn" || !process.env.npm_config_user_agent?.startsWith("npm/")) return cwd;
|
|
20521
20558
|
const { npm_config_prefix: _npmPrefix, ...env } = process.env;
|
|
20522
20559
|
return { ...cwd, env };
|
|
@@ -20550,9 +20587,9 @@ function ownsGlobalInstall(pm, runningRoot) {
|
|
|
20550
20587
|
const dir = pm === "bun" ? /^([^\r\n]+) node_modules \(/.exec(output)?.[1] : output;
|
|
20551
20588
|
if (!dir || !path18.isAbsolute(dir)) return false;
|
|
20552
20589
|
pkg = pm === "npm" ? path18.join(dir, PACKAGE_NAME) : path18.join(dir, "node_modules", PACKAGE_NAME);
|
|
20553
|
-
localBuild =
|
|
20590
|
+
localBuild = fs18.lstatSync(pkg).isSymbolicLink();
|
|
20554
20591
|
}
|
|
20555
|
-
return !localBuild && !!pkg && path18.isAbsolute(pkg) &&
|
|
20592
|
+
return !localBuild && !!pkg && path18.isAbsolute(pkg) && fs18.realpathSync(pkg) === runningRoot;
|
|
20556
20593
|
} catch {
|
|
20557
20594
|
return false;
|
|
20558
20595
|
}
|
|
@@ -20607,7 +20644,7 @@ function localUninstallCommand(pm, pkg) {
|
|
|
20607
20644
|
}
|
|
20608
20645
|
|
|
20609
20646
|
// ../argent-installer/src/install-record.ts
|
|
20610
|
-
import * as
|
|
20647
|
+
import * as fs19 from "node:fs";
|
|
20611
20648
|
import * as path19 from "node:path";
|
|
20612
20649
|
function getInstallRecordPath(projectRoot) {
|
|
20613
20650
|
return path19.join(projectRoot, ".argent", "install.json");
|
|
@@ -20615,7 +20652,7 @@ function getInstallRecordPath(projectRoot) {
|
|
|
20615
20652
|
function readInstallRecord(projectRoot) {
|
|
20616
20653
|
try {
|
|
20617
20654
|
const parsed = JSON.parse(
|
|
20618
|
-
|
|
20655
|
+
fs19.readFileSync(getInstallRecordPath(projectRoot), "utf8")
|
|
20619
20656
|
);
|
|
20620
20657
|
if (parsed && (parsed.mode === "local" || parsed.mode === "global")) return parsed;
|
|
20621
20658
|
return null;
|
|
@@ -20625,17 +20662,17 @@ function readInstallRecord(projectRoot) {
|
|
|
20625
20662
|
}
|
|
20626
20663
|
function writeInstallRecord(projectRoot, record) {
|
|
20627
20664
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20628
|
-
|
|
20629
|
-
|
|
20665
|
+
fs19.mkdirSync(path19.dirname(recordPath), { recursive: true });
|
|
20666
|
+
fs19.writeFileSync(recordPath, JSON.stringify(record, null, 2) + "\n");
|
|
20630
20667
|
}
|
|
20631
20668
|
function removeInstallRecord(projectRoot) {
|
|
20632
20669
|
const recordPath = getInstallRecordPath(projectRoot);
|
|
20633
20670
|
try {
|
|
20634
|
-
if (!
|
|
20635
|
-
|
|
20671
|
+
if (!fs19.existsSync(recordPath)) return false;
|
|
20672
|
+
fs19.rmSync(recordPath, { force: true });
|
|
20636
20673
|
const dir = path19.dirname(recordPath);
|
|
20637
20674
|
try {
|
|
20638
|
-
if (
|
|
20675
|
+
if (fs19.existsSync(dir) && fs19.readdirSync(dir).length === 0) fs19.rmdirSync(dir);
|
|
20639
20676
|
} catch {
|
|
20640
20677
|
}
|
|
20641
20678
|
return true;
|
|
@@ -20664,7 +20701,7 @@ function resolveInstallModeFromFlags(opts) {
|
|
|
20664
20701
|
var PACKAGE_ROOT = resolvePackageRoot(import.meta.dirname);
|
|
20665
20702
|
function resolveBundledDir(dirName) {
|
|
20666
20703
|
const packagedDir = path20.join(PACKAGE_ROOT, dirName);
|
|
20667
|
-
if (
|
|
20704
|
+
if (fs20.existsSync(packagedDir)) return packagedDir;
|
|
20668
20705
|
return path20.resolve(PACKAGE_ROOT, "..", "skills", dirName);
|
|
20669
20706
|
}
|
|
20670
20707
|
var SKILLS_DIR = resolveBundledDir("skills");
|
|
@@ -20677,7 +20714,7 @@ function buildArgentSkillsSource(version) {
|
|
|
20677
20714
|
}
|
|
20678
20715
|
function listBundledSkills(skillsDir = SKILLS_DIR) {
|
|
20679
20716
|
try {
|
|
20680
|
-
return
|
|
20717
|
+
return fs20.readdirSync(skillsDir, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name).filter((name) => fs20.existsSync(path20.join(skillsDir, name, "SKILL.md"))).sort();
|
|
20681
20718
|
} catch {
|
|
20682
20719
|
return [];
|
|
20683
20720
|
}
|
|
@@ -20794,7 +20831,7 @@ function hashBundledContent(content) {
|
|
|
20794
20831
|
}
|
|
20795
20832
|
function listArgentSkillsInLock(lockPath) {
|
|
20796
20833
|
try {
|
|
20797
|
-
const raw =
|
|
20834
|
+
const raw = fs20.readFileSync(lockPath, "utf8");
|
|
20798
20835
|
const lock = JSON.parse(raw);
|
|
20799
20836
|
const tracked = lock.skills ?? {};
|
|
20800
20837
|
return Object.keys(tracked).filter((name) => name.startsWith(ARGENT_SKILL_PREFIX)).sort();
|
|
@@ -20825,10 +20862,10 @@ function resolveProjectRoot2(startDir, homeDir = os4.homedir()) {
|
|
|
20825
20862
|
if (currentDir !== initialDir && canonicalPath(currentDir) === home) {
|
|
20826
20863
|
return initialDir;
|
|
20827
20864
|
}
|
|
20828
|
-
if (PROJECT_ROOT_MARKERS.some((marker) =>
|
|
20865
|
+
if (PROJECT_ROOT_MARKERS.some((marker) => fs20.existsSync(path20.join(currentDir, marker)))) {
|
|
20829
20866
|
return currentDir;
|
|
20830
20867
|
}
|
|
20831
|
-
if (
|
|
20868
|
+
if (fs20.existsSync(path20.join(currentDir, ".git"))) {
|
|
20832
20869
|
return currentDir;
|
|
20833
20870
|
}
|
|
20834
20871
|
const parentDir = path20.dirname(currentDir);
|
|
@@ -20839,20 +20876,20 @@ function resolveProjectRoot2(startDir, homeDir = os4.homedir()) {
|
|
|
20839
20876
|
}
|
|
20840
20877
|
}
|
|
20841
20878
|
function readToml(filePath) {
|
|
20842
|
-
if (!
|
|
20879
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20843
20880
|
try {
|
|
20844
|
-
return parse(
|
|
20881
|
+
return parse(fs20.readFileSync(filePath, "utf8"));
|
|
20845
20882
|
} catch {
|
|
20846
20883
|
return {};
|
|
20847
20884
|
}
|
|
20848
20885
|
}
|
|
20849
20886
|
function writeToml(filePath, data) {
|
|
20850
|
-
|
|
20851
|
-
|
|
20887
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20888
|
+
fs20.writeFileSync(filePath, stringify(data) + "\n");
|
|
20852
20889
|
}
|
|
20853
20890
|
function readYaml(filePath) {
|
|
20854
|
-
if (!
|
|
20855
|
-
const text2 =
|
|
20891
|
+
if (!fs20.existsSync(filePath)) return new import_yaml.Document({});
|
|
20892
|
+
const text2 = fs20.readFileSync(filePath, "utf8");
|
|
20856
20893
|
const doc = (0, import_yaml.parseDocument)(text2);
|
|
20857
20894
|
if (doc.errors.length > 0) {
|
|
20858
20895
|
const messages = doc.errors.map((e) => e.message).join("; ");
|
|
@@ -20861,20 +20898,20 @@ function readYaml(filePath) {
|
|
|
20861
20898
|
return doc;
|
|
20862
20899
|
}
|
|
20863
20900
|
function writeYaml(filePath, doc) {
|
|
20864
|
-
|
|
20865
|
-
|
|
20901
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20902
|
+
fs20.writeFileSync(filePath, doc.toString({ lineWidth: 0 }));
|
|
20866
20903
|
}
|
|
20867
20904
|
function readJson(filePath) {
|
|
20868
|
-
if (!
|
|
20905
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20869
20906
|
try {
|
|
20870
|
-
return JSON.parse(
|
|
20907
|
+
return JSON.parse(fs20.readFileSync(filePath, "utf8"));
|
|
20871
20908
|
} catch {
|
|
20872
20909
|
return {};
|
|
20873
20910
|
}
|
|
20874
20911
|
}
|
|
20875
20912
|
function writeJson(filePath, data) {
|
|
20876
|
-
|
|
20877
|
-
|
|
20913
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20914
|
+
fs20.writeFileSync(filePath, JSON.stringify(data, null, 2) + "\n");
|
|
20878
20915
|
}
|
|
20879
20916
|
var JSONC_FORMATTING = { tabSize: 2, insertSpaces: true };
|
|
20880
20917
|
function setJsoncIn(text2, jsonPath, value) {
|
|
@@ -20882,8 +20919,8 @@ function setJsoncIn(text2, jsonPath, value) {
|
|
|
20882
20919
|
return applyEdits(text2, edits);
|
|
20883
20920
|
}
|
|
20884
20921
|
function readJsoncFileRaw(filePath) {
|
|
20885
|
-
if (!
|
|
20886
|
-
let text2 =
|
|
20922
|
+
if (!fs20.existsSync(filePath)) return { text: "{}", hadBom: false, wasEmpty: true };
|
|
20923
|
+
let text2 = fs20.readFileSync(filePath, "utf8");
|
|
20887
20924
|
const hadBom = text2.charCodeAt(0) === 65279;
|
|
20888
20925
|
if (hadBom) text2 = text2.slice(1);
|
|
20889
20926
|
const wasEmpty = text2.trim() === "";
|
|
@@ -20902,26 +20939,26 @@ function isEmptyPlainObject(value) {
|
|
|
20902
20939
|
return value !== null && typeof value === "object" && !Array.isArray(value) && Object.keys(value).length === 0;
|
|
20903
20940
|
}
|
|
20904
20941
|
function removePath(targetPath) {
|
|
20905
|
-
const entry =
|
|
20942
|
+
const entry = fs20.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
20906
20943
|
if (!entry) return false;
|
|
20907
|
-
if (entry.isSymbolicLink())
|
|
20908
|
-
else
|
|
20944
|
+
if (entry.isSymbolicLink()) fs20.unlinkSync(targetPath);
|
|
20945
|
+
else fs20.rmSync(targetPath, { recursive: entry.isDirectory(), force: true });
|
|
20909
20946
|
return true;
|
|
20910
20947
|
}
|
|
20911
20948
|
function rmEmptyDir(dirPath) {
|
|
20912
20949
|
try {
|
|
20913
|
-
if (!
|
|
20914
|
-
if (!
|
|
20915
|
-
if (
|
|
20916
|
-
|
|
20950
|
+
if (!fs20.existsSync(dirPath)) return false;
|
|
20951
|
+
if (!fs20.statSync(dirPath).isDirectory()) return false;
|
|
20952
|
+
if (fs20.readdirSync(dirPath).length > 0) return false;
|
|
20953
|
+
fs20.rmdirSync(dirPath);
|
|
20917
20954
|
return true;
|
|
20918
20955
|
} catch {
|
|
20919
20956
|
return false;
|
|
20920
20957
|
}
|
|
20921
20958
|
}
|
|
20922
20959
|
function readJsonc(filePath) {
|
|
20923
|
-
if (!
|
|
20924
|
-
let raw =
|
|
20960
|
+
if (!fs20.existsSync(filePath)) return {};
|
|
20961
|
+
let raw = fs20.readFileSync(filePath, "utf8");
|
|
20925
20962
|
if (raw.charCodeAt(0) === 65279) raw = raw.slice(1);
|
|
20926
20963
|
if (raw.trim() === "") return {};
|
|
20927
20964
|
const parsed = parse3(raw, [], { allowTrailingComma: true });
|
|
@@ -20942,7 +20979,7 @@ function yamlSyntaxErrorLine(raw) {
|
|
|
20942
20979
|
function findConfigSyntaxErrorLine(filePath, jsonOptions) {
|
|
20943
20980
|
let raw;
|
|
20944
20981
|
try {
|
|
20945
|
-
raw =
|
|
20982
|
+
raw = fs20.readFileSync(filePath, "utf8");
|
|
20946
20983
|
} catch {
|
|
20947
20984
|
return null;
|
|
20948
20985
|
}
|
|
@@ -20968,18 +21005,18 @@ function editJsoncFile(filePath, jsonPath, value) {
|
|
|
20968
21005
|
}
|
|
20969
21006
|
const parsed = parse3(text2, [], { allowTrailingComma: true });
|
|
20970
21007
|
if (isEmptyPlainObject(parsed)) {
|
|
20971
|
-
|
|
21008
|
+
fs20.rmSync(filePath, { force: true });
|
|
20972
21009
|
rmEmptyDir(path20.dirname(filePath));
|
|
20973
21010
|
return;
|
|
20974
21011
|
}
|
|
20975
|
-
|
|
21012
|
+
fs20.mkdirSync(path20.dirname(filePath), { recursive: true });
|
|
20976
21013
|
const out = wasEmpty && !text2.endsWith("\n") ? text2 + "\n" : text2;
|
|
20977
|
-
|
|
21014
|
+
fs20.writeFileSync(filePath, (hadBom ? "\uFEFF" : "") + out);
|
|
20978
21015
|
}
|
|
20979
21016
|
var MAX_SYMLINK_HOPS = 40;
|
|
20980
21017
|
function realpathOrSelf(p) {
|
|
20981
21018
|
try {
|
|
20982
|
-
return
|
|
21019
|
+
return fs20.realpathSync(p);
|
|
20983
21020
|
} catch {
|
|
20984
21021
|
return p;
|
|
20985
21022
|
}
|
|
@@ -20989,13 +21026,13 @@ function resolveLinkedDestination(dest) {
|
|
|
20989
21026
|
for (let hop = 0; hop < MAX_SYMLINK_HOPS; hop++) {
|
|
20990
21027
|
let entry;
|
|
20991
21028
|
try {
|
|
20992
|
-
entry =
|
|
21029
|
+
entry = fs20.lstatSync(current);
|
|
20993
21030
|
} catch {
|
|
20994
21031
|
return current === dest || dirExists(path20.dirname(current)) ? current : dest;
|
|
20995
21032
|
}
|
|
20996
21033
|
if (!entry.isSymbolicLink()) return current;
|
|
20997
21034
|
try {
|
|
20998
|
-
current = path20.resolve(realpathOrSelf(path20.dirname(current)),
|
|
21035
|
+
current = path20.resolve(realpathOrSelf(path20.dirname(current)), fs20.readlinkSync(current));
|
|
20999
21036
|
} catch {
|
|
21000
21037
|
return dest;
|
|
21001
21038
|
}
|
|
@@ -21003,30 +21040,30 @@ function resolveLinkedDestination(dest) {
|
|
|
21003
21040
|
return dest;
|
|
21004
21041
|
}
|
|
21005
21042
|
function copyDir(src, dest) {
|
|
21006
|
-
if (!
|
|
21043
|
+
if (!fs20.existsSync(src) || !treeHasFiles(src)) return null;
|
|
21007
21044
|
const target = resolveLinkedDestination(dest);
|
|
21008
21045
|
copyTree(src, target);
|
|
21009
21046
|
return target;
|
|
21010
21047
|
}
|
|
21011
21048
|
function treeHasFiles(dir) {
|
|
21012
|
-
return
|
|
21049
|
+
return fs20.readdirSync(dir, { withFileTypes: true }).some((entry) => !entry.isDirectory() || treeHasFiles(path20.join(dir, entry.name)));
|
|
21013
21050
|
}
|
|
21014
21051
|
function copyTree(src, dest) {
|
|
21015
|
-
const entries =
|
|
21016
|
-
|
|
21052
|
+
const entries = fs20.readdirSync(src, { withFileTypes: true });
|
|
21053
|
+
fs20.mkdirSync(dest, { recursive: true });
|
|
21017
21054
|
for (const entry of entries) {
|
|
21018
21055
|
const from = path20.join(src, entry.name);
|
|
21019
21056
|
const to = resolveLinkedDestination(path20.join(dest, entry.name));
|
|
21020
21057
|
if (entry.isDirectory()) copyTree(from, to);
|
|
21021
|
-
else
|
|
21058
|
+
else fs20.copyFileSync(from, to);
|
|
21022
21059
|
}
|
|
21023
21060
|
}
|
|
21024
21061
|
function readRetiredFile(targetDir, relativePath) {
|
|
21025
21062
|
const entryPath = path20.join(resolveLinkedDestination(targetDir), ...relativePath.split("/"));
|
|
21026
21063
|
const file = resolveLinkedDestination(entryPath);
|
|
21027
21064
|
try {
|
|
21028
|
-
if (!
|
|
21029
|
-
return
|
|
21065
|
+
if (!fs20.statSync(file, { throwIfNoEntry: false })?.isFile()) return null;
|
|
21066
|
+
return fs20.readFileSync(file, "utf8");
|
|
21030
21067
|
} catch {
|
|
21031
21068
|
return null;
|
|
21032
21069
|
}
|
|
@@ -21034,7 +21071,7 @@ function readRetiredFile(targetDir, relativePath) {
|
|
|
21034
21071
|
function findRetiredFiles(retired, bundleDir, targetDir) {
|
|
21035
21072
|
const found = [];
|
|
21036
21073
|
for (const { path: relativePath, shipped } of retired) {
|
|
21037
|
-
if (bundleDir !== null &&
|
|
21074
|
+
if (bundleDir !== null && fs20.existsSync(path20.join(bundleDir, ...relativePath.split("/"))))
|
|
21038
21075
|
continue;
|
|
21039
21076
|
const content = readRetiredFile(targetDir, relativePath);
|
|
21040
21077
|
if (content === null) continue;
|
|
@@ -21053,7 +21090,7 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21053
21090
|
const entryPath = path20.join(dir, ...segments);
|
|
21054
21091
|
const file = resolveLinkedDestination(entryPath);
|
|
21055
21092
|
try {
|
|
21056
|
-
|
|
21093
|
+
fs20.rmSync(file);
|
|
21057
21094
|
if (file !== entryPath) removePath(entryPath);
|
|
21058
21095
|
removedPaths.push(relativePath);
|
|
21059
21096
|
} catch {
|
|
@@ -21068,7 +21105,7 @@ function removeRetiredFiles(targetDir, files) {
|
|
|
21068
21105
|
}
|
|
21069
21106
|
function dirExists(p) {
|
|
21070
21107
|
try {
|
|
21071
|
-
return
|
|
21108
|
+
return fs20.statSync(p).isDirectory();
|
|
21072
21109
|
} catch {
|
|
21073
21110
|
return false;
|
|
21074
21111
|
}
|
|
@@ -21076,7 +21113,7 @@ function dirExists(p) {
|
|
|
21076
21113
|
function getInstalledVersion() {
|
|
21077
21114
|
try {
|
|
21078
21115
|
const pkgPath = path20.join(PACKAGE_ROOT, "package.json");
|
|
21079
|
-
const pkg = JSON.parse(
|
|
21116
|
+
const pkg = JSON.parse(fs20.readFileSync(pkgPath, "utf8"));
|
|
21080
21117
|
return pkg.version ?? null;
|
|
21081
21118
|
} catch {
|
|
21082
21119
|
return null;
|
|
@@ -21206,10 +21243,10 @@ function hasCustomizingEnv(entry) {
|
|
|
21206
21243
|
}
|
|
21207
21244
|
function removeDirIfEmpty(dirPath) {
|
|
21208
21245
|
try {
|
|
21209
|
-
if (!
|
|
21210
|
-
if (!
|
|
21211
|
-
if (
|
|
21212
|
-
|
|
21246
|
+
if (!fs21.existsSync(dirPath)) return;
|
|
21247
|
+
if (!fs21.statSync(dirPath).isDirectory()) return;
|
|
21248
|
+
if (fs21.readdirSync(dirPath).length > 0) return;
|
|
21249
|
+
fs21.rmdirSync(dirPath);
|
|
21213
21250
|
} catch {
|
|
21214
21251
|
}
|
|
21215
21252
|
}
|
|
@@ -21265,7 +21302,7 @@ function isPinnedGlobalEntry(entry) {
|
|
|
21265
21302
|
}
|
|
21266
21303
|
function writeTomlOrRemove(filePath, data) {
|
|
21267
21304
|
if (Object.keys(data).length === 0) {
|
|
21268
|
-
|
|
21305
|
+
fs21.rmSync(filePath, { force: true });
|
|
21269
21306
|
removeDirIfEmpty(path21.dirname(filePath));
|
|
21270
21307
|
return;
|
|
21271
21308
|
}
|
|
@@ -21275,12 +21312,12 @@ function dirHasEditorEvidence(dir, looksArgentOnly) {
|
|
|
21275
21312
|
return dirExists(dir) && !looksArgentOnly(dir);
|
|
21276
21313
|
}
|
|
21277
21314
|
function fileHasEditorEvidence(filePath, looksArgentOnly) {
|
|
21278
|
-
return
|
|
21315
|
+
return fs21.existsSync(filePath) && !looksArgentOnly(filePath);
|
|
21279
21316
|
}
|
|
21280
21317
|
function parseJsoncStrict(filePath) {
|
|
21281
21318
|
let raw;
|
|
21282
21319
|
try {
|
|
21283
|
-
raw =
|
|
21320
|
+
raw = fs21.readFileSync(filePath, "utf8");
|
|
21284
21321
|
} catch {
|
|
21285
21322
|
return null;
|
|
21286
21323
|
}
|
|
@@ -21293,14 +21330,14 @@ function parseJsoncStrict(filePath) {
|
|
|
21293
21330
|
}
|
|
21294
21331
|
function parseTomlStrict(filePath) {
|
|
21295
21332
|
try {
|
|
21296
|
-
return parse(
|
|
21333
|
+
return parse(fs21.readFileSync(filePath, "utf8"));
|
|
21297
21334
|
} catch {
|
|
21298
21335
|
return null;
|
|
21299
21336
|
}
|
|
21300
21337
|
}
|
|
21301
21338
|
function parseYamlStrict(filePath) {
|
|
21302
21339
|
try {
|
|
21303
|
-
const parsed = (0, import_yaml2.parse)(
|
|
21340
|
+
const parsed = (0, import_yaml2.parse)(fs21.readFileSync(filePath, "utf8"));
|
|
21304
21341
|
if (parsed === null || typeof parsed !== "object" || Array.isArray(parsed)) return null;
|
|
21305
21342
|
return parsed;
|
|
21306
21343
|
} catch {
|
|
@@ -21323,7 +21360,7 @@ function bundledManagedNames(kind) {
|
|
|
21323
21360
|
if (cached2) return cached2;
|
|
21324
21361
|
let names;
|
|
21325
21362
|
try {
|
|
21326
|
-
names = new Set(
|
|
21363
|
+
names = new Set(fs21.readdirSync(kind === "rules" ? RULES_DIR : AGENTS_DIR));
|
|
21327
21364
|
} catch {
|
|
21328
21365
|
names = /* @__PURE__ */ new Set();
|
|
21329
21366
|
}
|
|
@@ -21334,7 +21371,7 @@ function bundledManagedNames(kind) {
|
|
|
21334
21371
|
function managedDirLooksArgentOnly(dir, kind) {
|
|
21335
21372
|
let entries;
|
|
21336
21373
|
try {
|
|
21337
|
-
entries =
|
|
21374
|
+
entries = fs21.readdirSync(dir);
|
|
21338
21375
|
} catch {
|
|
21339
21376
|
return false;
|
|
21340
21377
|
}
|
|
@@ -21346,7 +21383,7 @@ function managedDirLooksArgentOnly(dir, kind) {
|
|
|
21346
21383
|
function cursorDirLooksArgentOnly(dir) {
|
|
21347
21384
|
let entries;
|
|
21348
21385
|
try {
|
|
21349
|
-
entries =
|
|
21386
|
+
entries = fs21.readdirSync(dir);
|
|
21350
21387
|
} catch {
|
|
21351
21388
|
return false;
|
|
21352
21389
|
}
|
|
@@ -21385,7 +21422,7 @@ function claudeSettingsLooksArgentOnly(filePath) {
|
|
|
21385
21422
|
function claudeDirLooksArgentOnly(dir) {
|
|
21386
21423
|
let entries;
|
|
21387
21424
|
try {
|
|
21388
|
-
entries =
|
|
21425
|
+
entries = fs21.readdirSync(dir);
|
|
21389
21426
|
} catch {
|
|
21390
21427
|
return false;
|
|
21391
21428
|
}
|
|
@@ -21402,7 +21439,7 @@ function claudeDirLooksArgentOnly(dir) {
|
|
|
21402
21439
|
function vscodeDirLooksArgentOnly(dir) {
|
|
21403
21440
|
let entries;
|
|
21404
21441
|
try {
|
|
21405
|
-
entries =
|
|
21442
|
+
entries = fs21.readdirSync(dir);
|
|
21406
21443
|
} catch {
|
|
21407
21444
|
return false;
|
|
21408
21445
|
}
|
|
@@ -21414,7 +21451,7 @@ function vscodeDirLooksArgentOnly(dir) {
|
|
|
21414
21451
|
function windsurfDirLooksArgentOnly(dir) {
|
|
21415
21452
|
let entries;
|
|
21416
21453
|
try {
|
|
21417
|
-
entries =
|
|
21454
|
+
entries = fs21.readdirSync(dir);
|
|
21418
21455
|
} catch {
|
|
21419
21456
|
return false;
|
|
21420
21457
|
}
|
|
@@ -21451,7 +21488,7 @@ function zedSettingsLooksArgentOnly(filePath) {
|
|
|
21451
21488
|
function zedDirLooksArgentOnly(dir) {
|
|
21452
21489
|
let entries;
|
|
21453
21490
|
try {
|
|
21454
|
-
entries =
|
|
21491
|
+
entries = fs21.readdirSync(dir);
|
|
21455
21492
|
} catch {
|
|
21456
21493
|
return false;
|
|
21457
21494
|
}
|
|
@@ -21463,7 +21500,7 @@ function zedDirLooksArgentOnly(dir) {
|
|
|
21463
21500
|
function geminiDirLooksArgentOnly(dir) {
|
|
21464
21501
|
let entries;
|
|
21465
21502
|
try {
|
|
21466
|
-
entries =
|
|
21503
|
+
entries = fs21.readdirSync(dir);
|
|
21467
21504
|
} catch {
|
|
21468
21505
|
return false;
|
|
21469
21506
|
}
|
|
@@ -21488,7 +21525,7 @@ function hermesConfigLooksArgentOnly(filePath) {
|
|
|
21488
21525
|
function hermesDirLooksArgentOnly(dir) {
|
|
21489
21526
|
let entries;
|
|
21490
21527
|
try {
|
|
21491
|
-
entries =
|
|
21528
|
+
entries = fs21.readdirSync(dir);
|
|
21492
21529
|
} catch {
|
|
21493
21530
|
return false;
|
|
21494
21531
|
}
|
|
@@ -21500,7 +21537,7 @@ function hermesDirLooksArgentOnly(dir) {
|
|
|
21500
21537
|
function kiroDirLooksArgentOnly(dir) {
|
|
21501
21538
|
let entries;
|
|
21502
21539
|
try {
|
|
21503
|
-
entries =
|
|
21540
|
+
entries = fs21.readdirSync(dir);
|
|
21504
21541
|
} catch {
|
|
21505
21542
|
return false;
|
|
21506
21543
|
}
|
|
@@ -21510,7 +21547,7 @@ function kiroDirLooksArgentOnly(dir) {
|
|
|
21510
21547
|
const settingsDir = path21.join(dir, entry);
|
|
21511
21548
|
let settingsEntries;
|
|
21512
21549
|
try {
|
|
21513
|
-
settingsEntries =
|
|
21550
|
+
settingsEntries = fs21.readdirSync(settingsDir);
|
|
21514
21551
|
} catch {
|
|
21515
21552
|
return false;
|
|
21516
21553
|
}
|
|
@@ -21523,7 +21560,7 @@ function kiroDirLooksArgentOnly(dir) {
|
|
|
21523
21560
|
function codexDirLooksArgentOnly(dir) {
|
|
21524
21561
|
let entries;
|
|
21525
21562
|
try {
|
|
21526
|
-
entries =
|
|
21563
|
+
entries = fs21.readdirSync(dir);
|
|
21527
21564
|
} catch {
|
|
21528
21565
|
return false;
|
|
21529
21566
|
}
|
|
@@ -21581,7 +21618,7 @@ var cursorAdapter = {
|
|
|
21581
21618
|
});
|
|
21582
21619
|
},
|
|
21583
21620
|
remove(configPath) {
|
|
21584
|
-
if (!
|
|
21621
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21585
21622
|
const config = readJsonc(configPath);
|
|
21586
21623
|
const servers = config.mcpServers;
|
|
21587
21624
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21589,7 +21626,7 @@ var cursorAdapter = {
|
|
|
21589
21626
|
return true;
|
|
21590
21627
|
},
|
|
21591
21628
|
getArgentEntry(configPath) {
|
|
21592
|
-
if (!
|
|
21629
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21593
21630
|
const config = readJsonc(configPath);
|
|
21594
21631
|
const servers = config.mcpServers;
|
|
21595
21632
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21614,7 +21651,7 @@ var cursorAdapter = {
|
|
|
21614
21651
|
removeAllowlist(_root, scope) {
|
|
21615
21652
|
if (scope !== "global") return;
|
|
21616
21653
|
const permPath = cursorPermissionsPath();
|
|
21617
|
-
if (!
|
|
21654
|
+
if (!fs21.existsSync(permPath)) return;
|
|
21618
21655
|
const config = readJsonc(permPath);
|
|
21619
21656
|
const list = Array.isArray(config.mcpAllowlist) ? config.mcpAllowlist : void 0;
|
|
21620
21657
|
if (!list || !list.includes(CURSOR_ALLOWLIST_PATTERN)) return;
|
|
@@ -21627,7 +21664,7 @@ function claudeProjectKeysForRoot(projects, root) {
|
|
|
21627
21664
|
return Object.keys(projects).filter((key) => key === root || canonicalPath(key) === target);
|
|
21628
21665
|
}
|
|
21629
21666
|
function claudeDisabledListFinding(settingsPath, label, projectConfined) {
|
|
21630
|
-
if (!
|
|
21667
|
+
if (!fs21.existsSync(settingsPath)) return null;
|
|
21631
21668
|
const disabled = readJson(settingsPath).disabledMcpjsonServers;
|
|
21632
21669
|
if (!Array.isArray(disabled) || !disabled.includes(MCP_SERVER_KEY)) return null;
|
|
21633
21670
|
return {
|
|
@@ -21674,7 +21711,7 @@ var claudeAdapter = {
|
|
|
21674
21711
|
});
|
|
21675
21712
|
},
|
|
21676
21713
|
remove(configPath) {
|
|
21677
|
-
if (!
|
|
21714
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21678
21715
|
const config = readJsonc(configPath);
|
|
21679
21716
|
const servers = config.mcpServers;
|
|
21680
21717
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21688,7 +21725,7 @@ var claudeAdapter = {
|
|
|
21688
21725
|
return true;
|
|
21689
21726
|
},
|
|
21690
21727
|
getArgentEntry(configPath) {
|
|
21691
|
-
if (!
|
|
21728
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21692
21729
|
const config = readJsonc(configPath);
|
|
21693
21730
|
const servers = config.mcpServers;
|
|
21694
21731
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21778,7 +21815,7 @@ var vscodeAdapter = {
|
|
|
21778
21815
|
});
|
|
21779
21816
|
},
|
|
21780
21817
|
remove(configPath) {
|
|
21781
|
-
if (!
|
|
21818
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21782
21819
|
const config = readJsonc(configPath);
|
|
21783
21820
|
const servers = config.servers;
|
|
21784
21821
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21786,7 +21823,7 @@ var vscodeAdapter = {
|
|
|
21786
21823
|
return true;
|
|
21787
21824
|
},
|
|
21788
21825
|
getArgentEntry(configPath) {
|
|
21789
|
-
if (!
|
|
21826
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21790
21827
|
const config = readJsonc(configPath);
|
|
21791
21828
|
const servers = config.servers;
|
|
21792
21829
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21864,7 +21901,7 @@ var windsurfAdapter = {
|
|
|
21864
21901
|
});
|
|
21865
21902
|
},
|
|
21866
21903
|
remove(configPath) {
|
|
21867
|
-
if (!
|
|
21904
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21868
21905
|
const config = readJsonc(configPath);
|
|
21869
21906
|
const servers = config.mcpServers;
|
|
21870
21907
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21872,7 +21909,7 @@ var windsurfAdapter = {
|
|
|
21872
21909
|
return true;
|
|
21873
21910
|
},
|
|
21874
21911
|
getArgentEntry(configPath) {
|
|
21875
|
-
if (!
|
|
21912
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21876
21913
|
const config = readJsonc(configPath);
|
|
21877
21914
|
const servers = config.mcpServers;
|
|
21878
21915
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21895,7 +21932,7 @@ var windsurfAdapter = {
|
|
|
21895
21932
|
if (scope !== "global") return;
|
|
21896
21933
|
removeAllowRule(devinUserConfigPath(), DEVIN_PERMISSION_RULE);
|
|
21897
21934
|
const configPath = path21.join(homedir5(), ".codeium", "windsurf", "mcp_config.json");
|
|
21898
|
-
if (!
|
|
21935
|
+
if (!fs21.existsSync(configPath)) return;
|
|
21899
21936
|
const config = readJsonc(configPath);
|
|
21900
21937
|
const servers = config.mcpServers;
|
|
21901
21938
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -21925,7 +21962,7 @@ var zedAdapter = {
|
|
|
21925
21962
|
});
|
|
21926
21963
|
},
|
|
21927
21964
|
remove(configPath) {
|
|
21928
|
-
if (!
|
|
21965
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21929
21966
|
const config = readJsonc(configPath);
|
|
21930
21967
|
const servers = config.context_servers;
|
|
21931
21968
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21933,7 +21970,7 @@ var zedAdapter = {
|
|
|
21933
21970
|
return true;
|
|
21934
21971
|
},
|
|
21935
21972
|
getArgentEntry(configPath) {
|
|
21936
|
-
if (!
|
|
21973
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21937
21974
|
const config = readJsonc(configPath);
|
|
21938
21975
|
const servers = config.context_servers;
|
|
21939
21976
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -21949,7 +21986,7 @@ var zedAdapter = {
|
|
|
21949
21986
|
},
|
|
21950
21987
|
removeAllowlist(root, scope) {
|
|
21951
21988
|
const settingsPath = scope === "global" ? path21.join(homedir5(), ".config", "zed", "settings.json") : path21.join(root, ".zed", "settings.json");
|
|
21952
|
-
if (!
|
|
21989
|
+
if (!fs21.existsSync(settingsPath)) return;
|
|
21953
21990
|
const config = readJsonc(settingsPath);
|
|
21954
21991
|
const perms = config.agent?.tool_permissions;
|
|
21955
21992
|
if (!perms || perms.default !== "allow") return;
|
|
@@ -21977,7 +22014,7 @@ var geminiAdapter = {
|
|
|
21977
22014
|
});
|
|
21978
22015
|
},
|
|
21979
22016
|
remove(configPath) {
|
|
21980
|
-
if (!
|
|
22017
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
21981
22018
|
const config = readJsonc(configPath);
|
|
21982
22019
|
const servers = config.mcpServers;
|
|
21983
22020
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -21985,7 +22022,7 @@ var geminiAdapter = {
|
|
|
21985
22022
|
return true;
|
|
21986
22023
|
},
|
|
21987
22024
|
getArgentEntry(configPath) {
|
|
21988
|
-
if (!
|
|
22025
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
21989
22026
|
const config = readJsonc(configPath);
|
|
21990
22027
|
const servers = config.mcpServers;
|
|
21991
22028
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22007,7 +22044,7 @@ var geminiAdapter = {
|
|
|
22007
22044
|
},
|
|
22008
22045
|
removeAllowlist(root, scope) {
|
|
22009
22046
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22010
|
-
if (!configPath || !
|
|
22047
|
+
if (!configPath || !fs21.existsSync(configPath)) {
|
|
22011
22048
|
return;
|
|
22012
22049
|
}
|
|
22013
22050
|
const config = readJsonc(configPath);
|
|
@@ -22043,7 +22080,7 @@ var codexAdapter = {
|
|
|
22043
22080
|
writeToml(configPath, config);
|
|
22044
22081
|
},
|
|
22045
22082
|
remove(configPath) {
|
|
22046
|
-
if (!
|
|
22083
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22047
22084
|
const config = readToml(configPath);
|
|
22048
22085
|
const servers = config.mcp_servers;
|
|
22049
22086
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22053,7 +22090,7 @@ var codexAdapter = {
|
|
|
22053
22090
|
return true;
|
|
22054
22091
|
},
|
|
22055
22092
|
getArgentEntry(configPath) {
|
|
22056
|
-
if (!
|
|
22093
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22057
22094
|
const config = readToml(configPath);
|
|
22058
22095
|
const servers = config.mcp_servers;
|
|
22059
22096
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22085,7 +22122,7 @@ var codexAdapter = {
|
|
|
22085
22122
|
// them, and an emptied or removed table stays as it is.
|
|
22086
22123
|
refreshAllowlist(root, scope) {
|
|
22087
22124
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22088
|
-
if (!configPath || !
|
|
22125
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22089
22126
|
const config = readToml(configPath);
|
|
22090
22127
|
const toolsConfig = config.mcp_servers?.argent?.tools;
|
|
22091
22128
|
if (!toolsConfig) return;
|
|
@@ -22147,7 +22184,7 @@ var hermesAdapter = {
|
|
|
22147
22184
|
writeYaml(configPath, doc);
|
|
22148
22185
|
},
|
|
22149
22186
|
remove(configPath) {
|
|
22150
|
-
if (!
|
|
22187
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22151
22188
|
const doc = readYaml(configPath);
|
|
22152
22189
|
const servers = doc.get("mcp_servers");
|
|
22153
22190
|
if (!(0, import_yaml2.isMap)(servers)) return false;
|
|
@@ -22160,7 +22197,7 @@ var hermesAdapter = {
|
|
|
22160
22197
|
return true;
|
|
22161
22198
|
},
|
|
22162
22199
|
getArgentEntry(configPath) {
|
|
22163
|
-
if (!
|
|
22200
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22164
22201
|
const doc = readYaml(configPath);
|
|
22165
22202
|
const servers = doc.get("mcp_servers");
|
|
22166
22203
|
if (!(0, import_yaml2.isMap)(servers)) return null;
|
|
@@ -22188,7 +22225,7 @@ function hasOpenCodeBinary() {
|
|
|
22188
22225
|
function pickOpencodeConfig(dir, candidates) {
|
|
22189
22226
|
for (const name of candidates) {
|
|
22190
22227
|
const candidate = path21.join(dir, name);
|
|
22191
|
-
if (
|
|
22228
|
+
if (fs21.existsSync(candidate)) return candidate;
|
|
22192
22229
|
}
|
|
22193
22230
|
return path21.join(dir, "opencode.json");
|
|
22194
22231
|
}
|
|
@@ -22212,7 +22249,7 @@ var openCodeAdapter = {
|
|
|
22212
22249
|
});
|
|
22213
22250
|
},
|
|
22214
22251
|
remove(configPath) {
|
|
22215
|
-
if (!
|
|
22252
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22216
22253
|
const config = readJsonc(configPath);
|
|
22217
22254
|
const servers = config.mcp;
|
|
22218
22255
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22220,7 +22257,7 @@ var openCodeAdapter = {
|
|
|
22220
22257
|
return true;
|
|
22221
22258
|
},
|
|
22222
22259
|
getArgentEntry(configPath) {
|
|
22223
|
-
if (!
|
|
22260
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22224
22261
|
const config = readJsonc(configPath);
|
|
22225
22262
|
const servers = config.mcp;
|
|
22226
22263
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22235,7 +22272,7 @@ var openCodeAdapter = {
|
|
|
22235
22272
|
},
|
|
22236
22273
|
removeAllowlist(root, scope) {
|
|
22237
22274
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22238
|
-
if (!configPath || !
|
|
22275
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22239
22276
|
const config = readJsonc(configPath);
|
|
22240
22277
|
const tools = config.tools;
|
|
22241
22278
|
if (!tools || !(OPENCODE_ALLOWLIST_PATTERN in tools)) return;
|
|
@@ -22265,7 +22302,7 @@ var kiroAdapter = {
|
|
|
22265
22302
|
});
|
|
22266
22303
|
},
|
|
22267
22304
|
remove(configPath) {
|
|
22268
|
-
if (!
|
|
22305
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22269
22306
|
const config = readJsonc(configPath);
|
|
22270
22307
|
const servers = config.mcpServers;
|
|
22271
22308
|
if (!servers?.[MCP_SERVER_KEY]) return false;
|
|
@@ -22273,7 +22310,7 @@ var kiroAdapter = {
|
|
|
22273
22310
|
return true;
|
|
22274
22311
|
},
|
|
22275
22312
|
getArgentEntry(configPath) {
|
|
22276
|
-
if (!
|
|
22313
|
+
if (!fs21.existsSync(configPath)) return null;
|
|
22277
22314
|
const config = readJsonc(configPath);
|
|
22278
22315
|
const servers = config.mcpServers;
|
|
22279
22316
|
return normalizeServerEntry(servers?.[MCP_SERVER_KEY]);
|
|
@@ -22297,7 +22334,7 @@ var kiroAdapter = {
|
|
|
22297
22334
|
},
|
|
22298
22335
|
removeAllowlist(root, scope) {
|
|
22299
22336
|
const configPath = scope === "global" ? this.globalPath() : this.projectPath(root);
|
|
22300
|
-
if (!configPath || !
|
|
22337
|
+
if (!configPath || !fs21.existsSync(configPath)) return;
|
|
22301
22338
|
const config = readJsonc(configPath);
|
|
22302
22339
|
const servers = config.mcpServers;
|
|
22303
22340
|
const entry = servers?.[MCP_SERVER_KEY];
|
|
@@ -22349,7 +22386,7 @@ function addAllowRule(settingsPath, rule) {
|
|
|
22349
22386
|
editJsoncFile(settingsPath, ["permissions", "allow"], [...allow, rule]);
|
|
22350
22387
|
}
|
|
22351
22388
|
function removeAllowRule(settingsPath, rule) {
|
|
22352
|
-
if (!
|
|
22389
|
+
if (!fs21.existsSync(settingsPath)) return;
|
|
22353
22390
|
const config = readJsonc(settingsPath);
|
|
22354
22391
|
const permissions = config?.permissions;
|
|
22355
22392
|
const allow = permissions?.allow;
|
|
@@ -22470,12 +22507,12 @@ function stripFrontmatter(content) {
|
|
|
22470
22507
|
return match ? content.slice(match[0].length).trim() : content.trim();
|
|
22471
22508
|
}
|
|
22472
22509
|
function readAndConcatRules(rulesDir) {
|
|
22473
|
-
if (!
|
|
22474
|
-
const files =
|
|
22510
|
+
if (!fs21.existsSync(rulesDir)) return null;
|
|
22511
|
+
const files = fs21.readdirSync(rulesDir).filter((f) => f.endsWith(".md")).sort();
|
|
22475
22512
|
if (files.length === 0) return null;
|
|
22476
22513
|
const parts = [];
|
|
22477
22514
|
for (const file of files) {
|
|
22478
|
-
const raw =
|
|
22515
|
+
const raw = fs21.readFileSync(path21.join(rulesDir, file), "utf8");
|
|
22479
22516
|
const stripped = stripFrontmatter(raw);
|
|
22480
22517
|
if (stripped) parts.push(stripped);
|
|
22481
22518
|
}
|
|
@@ -22510,7 +22547,7 @@ function injectCodexRules(configPath, rulesDir) {
|
|
|
22510
22547
|
return configPath;
|
|
22511
22548
|
}
|
|
22512
22549
|
function removeCodexRules(configPath) {
|
|
22513
|
-
if (!
|
|
22550
|
+
if (!fs21.existsSync(configPath)) return false;
|
|
22514
22551
|
const config = readToml(configPath);
|
|
22515
22552
|
const existing = config.developer_instructions;
|
|
22516
22553
|
if (!existing || !existing.includes(ARGENT_RULES_START)) return false;
|
|
@@ -22656,14 +22693,14 @@ async function reportRetiredFiles(found, interactive) {
|
|
|
22656
22693
|
|
|
22657
22694
|
// ../argent-installer/src/cli-record.ts
|
|
22658
22695
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
22659
|
-
import * as
|
|
22696
|
+
import * as fs22 from "node:fs";
|
|
22660
22697
|
import * as path23 from "node:path";
|
|
22661
22698
|
function cliRecordPath() {
|
|
22662
22699
|
return path23.join(argentHomeDir(), "cli.json");
|
|
22663
22700
|
}
|
|
22664
22701
|
function readCliRecord() {
|
|
22665
22702
|
try {
|
|
22666
|
-
const parsed = JSON.parse(
|
|
22703
|
+
const parsed = JSON.parse(fs22.readFileSync(cliRecordPath(), "utf8"));
|
|
22667
22704
|
if (typeof parsed?.cli === "string" && typeof parsed?.node === "string") return parsed;
|
|
22668
22705
|
return null;
|
|
22669
22706
|
} catch {
|
|
@@ -22692,10 +22729,8 @@ function writeCliRecord(input) {
|
|
|
22692
22729
|
function persistCliRecord(record) {
|
|
22693
22730
|
const file = cliRecordPath();
|
|
22694
22731
|
try {
|
|
22695
|
-
|
|
22696
|
-
|
|
22697
|
-
fs21.writeFileSync(temporary, JSON.stringify(record, null, 2) + "\n");
|
|
22698
|
-
fs21.renameSync(temporary, file);
|
|
22732
|
+
fs22.mkdirSync(path23.dirname(file), { recursive: true });
|
|
22733
|
+
writeFileAtomicSync(file, JSON.stringify(record, null, 2) + "\n");
|
|
22699
22734
|
return file;
|
|
22700
22735
|
} catch {
|
|
22701
22736
|
return null;
|
|
@@ -22703,10 +22738,10 @@ function persistCliRecord(record) {
|
|
|
22703
22738
|
}
|
|
22704
22739
|
function healCliRecord(input) {
|
|
22705
22740
|
try {
|
|
22706
|
-
if (!
|
|
22741
|
+
if (!fs22.existsSync(input.cli)) return null;
|
|
22707
22742
|
const existing = readCliRecord();
|
|
22708
22743
|
if (existing) {
|
|
22709
|
-
const alive =
|
|
22744
|
+
const alive = fs22.existsSync(existing.node) && fs22.existsSync(existing.cli);
|
|
22710
22745
|
const ourVersion = import_semver4.default.valid(input.version);
|
|
22711
22746
|
const theirVersion = import_semver4.default.valid(existing.version);
|
|
22712
22747
|
const newerThanExisting = ourVersion !== null && (theirVersion === null || import_semver4.default.gt(ourVersion, theirVersion));
|
|
@@ -22731,7 +22766,7 @@ function removeCliRecordFor(installDir) {
|
|
|
22731
22766
|
const relative5 = path23.relative(root, path23.resolve(record.cli));
|
|
22732
22767
|
if (relative5.startsWith("..") || path23.isAbsolute(relative5)) return false;
|
|
22733
22768
|
try {
|
|
22734
|
-
|
|
22769
|
+
fs22.rmSync(cliRecordPath(), { force: true });
|
|
22735
22770
|
return true;
|
|
22736
22771
|
} catch {
|
|
22737
22772
|
return false;
|
|
@@ -22957,7 +22992,7 @@ async function promptInstallMode(defaultMode = "global") {
|
|
|
22957
22992
|
|
|
22958
22993
|
// ../argent-installer/src/install-runner.ts
|
|
22959
22994
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
22960
|
-
import * as
|
|
22995
|
+
import * as fs25 from "node:fs";
|
|
22961
22996
|
import * as path26 from "node:path";
|
|
22962
22997
|
|
|
22963
22998
|
// ../argent-installer/src/shell.ts
|
|
@@ -23022,13 +23057,13 @@ function runShellCommand(cmd, opts = {}) {
|
|
|
23022
23057
|
|
|
23023
23058
|
// ../argent-installer/src/skills.ts
|
|
23024
23059
|
import { execFileSync as execFileSync8 } from "node:child_process";
|
|
23025
|
-
import * as
|
|
23060
|
+
import * as fs24 from "node:fs";
|
|
23026
23061
|
import * as path25 from "node:path";
|
|
23027
23062
|
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
23028
23063
|
|
|
23029
23064
|
// ../argent-installer/src/skills-runner.ts
|
|
23030
23065
|
import { execFileSync as execFileSync7 } from "node:child_process";
|
|
23031
|
-
import * as
|
|
23066
|
+
import * as fs23 from "node:fs";
|
|
23032
23067
|
import * as path24 from "node:path";
|
|
23033
23068
|
var WIN32_DEFAULT_PATHEXT = ".COM;.EXE;.BAT;.CMD";
|
|
23034
23069
|
function findOnPath(bin, env, platform) {
|
|
@@ -23039,7 +23074,7 @@ function findOnPath(bin, env, platform) {
|
|
|
23039
23074
|
for (const dir of dirs) {
|
|
23040
23075
|
for (const ext of exts) {
|
|
23041
23076
|
const candidate = path24.join(dir, bin + ext);
|
|
23042
|
-
if (
|
|
23077
|
+
if (fs23.existsSync(candidate)) return candidate;
|
|
23043
23078
|
}
|
|
23044
23079
|
}
|
|
23045
23080
|
return null;
|
|
@@ -23047,8 +23082,8 @@ function findOnPath(bin, env, platform) {
|
|
|
23047
23082
|
for (const dir of dirs) {
|
|
23048
23083
|
const candidate = path24.join(dir, bin);
|
|
23049
23084
|
try {
|
|
23050
|
-
if (!
|
|
23051
|
-
|
|
23085
|
+
if (!fs23.statSync(candidate).isFile()) continue;
|
|
23086
|
+
fs23.accessSync(candidate, fs23.constants.X_OK);
|
|
23052
23087
|
return candidate;
|
|
23053
23088
|
} catch {
|
|
23054
23089
|
}
|
|
@@ -23225,13 +23260,13 @@ function snapshotArgentSkills(projectRoot, scope, names) {
|
|
|
23225
23260
|
let candidates = names;
|
|
23226
23261
|
if (names.length === 0) {
|
|
23227
23262
|
try {
|
|
23228
|
-
candidates =
|
|
23263
|
+
candidates = fs24.readdirSync(targetPath).filter((n3) => n3.startsWith(ARGENT_SKILL_PREFIX));
|
|
23229
23264
|
} catch {
|
|
23230
23265
|
continue;
|
|
23231
23266
|
}
|
|
23232
23267
|
}
|
|
23233
23268
|
for (const name of candidates) {
|
|
23234
|
-
const stat6 =
|
|
23269
|
+
const stat6 = fs24.statSync(path25.join(targetPath, name, "SKILL.md"), { throwIfNoEntry: false });
|
|
23235
23270
|
if (!stat6?.isFile()) continue;
|
|
23236
23271
|
found.set(name, `${found.get(name) ?? ""}${stat6.ino}:${stat6.mtimeMs};`);
|
|
23237
23272
|
}
|
|
@@ -23269,13 +23304,13 @@ function listTrackedLegacySkills(projectRoot, scope, bundled = new Set(listBundl
|
|
|
23269
23304
|
}
|
|
23270
23305
|
function removeLockEntries(lockPath, names) {
|
|
23271
23306
|
try {
|
|
23272
|
-
const lock = JSON.parse(
|
|
23307
|
+
const lock = JSON.parse(fs24.readFileSync(lockPath, "utf8"));
|
|
23273
23308
|
const skills = lock.skills;
|
|
23274
23309
|
if (!skills) return [];
|
|
23275
23310
|
const removed = names.filter((name) => name in skills);
|
|
23276
23311
|
if (removed.length === 0) return [];
|
|
23277
23312
|
for (const name of removed) delete skills[name];
|
|
23278
|
-
|
|
23313
|
+
fs24.writeFileSync(lockPath, JSON.stringify(lock, null, 2) + "\n");
|
|
23279
23314
|
return removed;
|
|
23280
23315
|
} catch {
|
|
23281
23316
|
return [];
|
|
@@ -23346,7 +23381,7 @@ async function runInstall(args) {
|
|
|
23346
23381
|
return runGlobal({ fromTar, nonInteractive, version: args.version, tel });
|
|
23347
23382
|
}
|
|
23348
23383
|
function installSpec(fromTar) {
|
|
23349
|
-
return
|
|
23384
|
+
return fs25.existsSync(fromTar) ? path26.resolve(fromTar) : fromTar;
|
|
23350
23385
|
}
|
|
23351
23386
|
async function installLocally(opts) {
|
|
23352
23387
|
const { fromTar, tel } = opts;
|
|
@@ -24576,7 +24611,7 @@ function printBanner() {
|
|
|
24576
24611
|
// ../argent-installer/src/update.ts
|
|
24577
24612
|
var import_picocolors12 = __toESM(require_picocolors(), 1);
|
|
24578
24613
|
var import_semver5 = __toESM(require_semver2(), 1);
|
|
24579
|
-
import * as
|
|
24614
|
+
import * as fs27 from "node:fs";
|
|
24580
24615
|
import * as os7 from "node:os";
|
|
24581
24616
|
import * as path33 from "node:path";
|
|
24582
24617
|
|
|
@@ -24651,11 +24686,11 @@ async function resolveInstallableUpdateTarget(pm, current, cwd, candidate) {
|
|
|
24651
24686
|
// ../argent-tools-client/src/launcher.ts
|
|
24652
24687
|
import * as net from "node:net";
|
|
24653
24688
|
import * as os6 from "node:os";
|
|
24654
|
-
import * as
|
|
24689
|
+
import * as fs26 from "node:fs";
|
|
24655
24690
|
import * as path28 from "node:path";
|
|
24656
24691
|
import * as readline from "node:readline";
|
|
24657
24692
|
import { spawn as spawn4, execFileSync as execFileSync9 } from "node:child_process";
|
|
24658
|
-
import { createHash as createHash3, randomBytes } from "node:crypto";
|
|
24693
|
+
import { createHash as createHash3, randomBytes as randomBytes2 } from "node:crypto";
|
|
24659
24694
|
import { readFile, readdir as readdir2, unlink } from "node:fs/promises";
|
|
24660
24695
|
var STATE_DIR = argentHomeDir();
|
|
24661
24696
|
var STATE_FILE = path28.join(STATE_DIR, "tool-server.json");
|
|
@@ -24771,7 +24806,7 @@ function isPathWithin(child, parent) {
|
|
|
24771
24806
|
}
|
|
24772
24807
|
function tryRealpath(p) {
|
|
24773
24808
|
try {
|
|
24774
|
-
return
|
|
24809
|
+
return fs26.realpathSync(p);
|
|
24775
24810
|
} catch {
|
|
24776
24811
|
return p;
|
|
24777
24812
|
}
|
|
@@ -24798,7 +24833,7 @@ async function killToolServerForInstallDir(packageDir) {
|
|
|
24798
24833
|
}
|
|
24799
24834
|
return killed;
|
|
24800
24835
|
}
|
|
24801
|
-
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) =>
|
|
24836
|
+
var PS_BIN = ["/bin/ps", "/usr/bin/ps"].find((p) => fs26.existsSync(p)) ?? "ps";
|
|
24802
24837
|
var PS_WIDTH_FLAGS = ["-ww"];
|
|
24803
24838
|
var PS_LOCALE = process.platform === "darwin" ? "en_US.UTF-8" : "C.UTF-8";
|
|
24804
24839
|
function readProcessCommandLine(pid, flags = PS_WIDTH_FLAGS, env = { ...process.env, LC_ALL: PS_LOCALE }) {
|
|
@@ -24849,7 +24884,7 @@ import * as path32 from "node:path";
|
|
|
24849
24884
|
|
|
24850
24885
|
// ../argent-tools-client/src/link-config.ts
|
|
24851
24886
|
import * as path29 from "node:path";
|
|
24852
|
-
import { mkdir,
|
|
24887
|
+
import { mkdir, readFile as readFile2, unlink as unlink2 } from "node:fs/promises";
|
|
24853
24888
|
var LINK_DIR = argentHomeDir();
|
|
24854
24889
|
var LINK_FILE = path29.join(LINK_DIR, "link.json");
|
|
24855
24890
|
|
|
@@ -24857,7 +24892,7 @@ var LINK_FILE = path29.join(LINK_DIR, "link.json");
|
|
|
24857
24892
|
import { createHash as createHash4, randomUUID as randomUUID6 } from "node:crypto";
|
|
24858
24893
|
import { createReadStream as createReadStream2, rmSync as rmSync7 } from "node:fs";
|
|
24859
24894
|
import {
|
|
24860
|
-
chmod
|
|
24895
|
+
chmod,
|
|
24861
24896
|
lstat,
|
|
24862
24897
|
mkdir as mkdir2,
|
|
24863
24898
|
readFile as readFile3,
|
|
@@ -24865,9 +24900,9 @@ import {
|
|
|
24865
24900
|
rename,
|
|
24866
24901
|
rm as rm2,
|
|
24867
24902
|
stat as stat3,
|
|
24868
|
-
writeFile
|
|
24903
|
+
writeFile
|
|
24869
24904
|
} from "node:fs/promises";
|
|
24870
|
-
import { constants as
|
|
24905
|
+
import { constants as constants4, tmpdir } from "node:os";
|
|
24871
24906
|
import * as path30 from "node:path";
|
|
24872
24907
|
|
|
24873
24908
|
// ../archive/src/index.ts
|
|
@@ -24915,7 +24950,7 @@ import {
|
|
|
24915
24950
|
realpath as realpath4,
|
|
24916
24951
|
rm as rm3,
|
|
24917
24952
|
stat as stat5,
|
|
24918
|
-
writeFile as
|
|
24953
|
+
writeFile as writeFile2
|
|
24919
24954
|
} from "node:fs/promises";
|
|
24920
24955
|
import { constants as fsConstants } from "node:fs";
|
|
24921
24956
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
@@ -24994,7 +25029,7 @@ function resolveUpdatePackageAction(trigger, installed) {
|
|
|
24994
25029
|
return installed ? "standalone_update" : "standalone_install";
|
|
24995
25030
|
}
|
|
24996
25031
|
function isLivePinnedEntry(entry) {
|
|
24997
|
-
return entry !== null && isPinnedGlobalEntry(entry) &&
|
|
25032
|
+
return entry !== null && isPinnedGlobalEntry(entry) && fs27.existsSync(entry.command) && fs27.existsSync(entry.args[0]);
|
|
24998
25033
|
}
|
|
24999
25034
|
async function refreshConfiguration({
|
|
25000
25035
|
projectRoot,
|
|
@@ -25226,7 +25261,7 @@ async function update(args) {
|
|
|
25226
25261
|
const pm = mode === "local" ? detectProjectPackageManager(projectRoot) : detectGlobalPackageManager();
|
|
25227
25262
|
if (automatic) {
|
|
25228
25263
|
const globalRoot = getGloballyInstalledPackageRoot();
|
|
25229
|
-
if (!globallyInstalled || !globalRoot ||
|
|
25264
|
+
if (!globallyInstalled || !globalRoot || fs27.realpathSync(globalRoot) !== projectRoot || !isAutoUpdateEnabled() || !ownsGlobalInstall(pm, projectRoot)) {
|
|
25230
25265
|
spinner2.stop("Could not confirm an automatic update for this installation.");
|
|
25231
25266
|
return "noop";
|
|
25232
25267
|
}
|
|
@@ -25427,7 +25462,7 @@ async function update(args) {
|
|
|
25427
25462
|
process.exit(1);
|
|
25428
25463
|
}
|
|
25429
25464
|
if (automatic) {
|
|
25430
|
-
const runningRoot =
|
|
25465
|
+
const runningRoot = fs27.realpathSync(resolvePackageRoot(import.meta.dirname));
|
|
25431
25466
|
const result = requestedVersion ? await applyUpdateForTarget("global", runningRoot) : "noop";
|
|
25432
25467
|
if (result === "updated" && requestedVersion) {
|
|
25433
25468
|
writeCliRecord({
|
|
@@ -25530,7 +25565,7 @@ async function update(args) {
|
|
|
25530
25565
|
// ../argent-installer/src/uninstall.ts
|
|
25531
25566
|
var import_picocolors13 = __toESM(require_picocolors(), 1);
|
|
25532
25567
|
var import_yaml5 = __toESM(require_dist2(), 1);
|
|
25533
|
-
import * as
|
|
25568
|
+
import * as fs28 from "node:fs";
|
|
25534
25569
|
import * as path34 from "node:path";
|
|
25535
25570
|
var UNINSTALL_TOOLSERVER_STOP_FAILED = {
|
|
25536
25571
|
error_code: FAILURE_CODES.UNINSTALL_TOOLSERVER_STOP_FAILED,
|
|
@@ -25552,10 +25587,10 @@ var UNINSTALL_UNCLASSIFIED_FAILED = {
|
|
|
25552
25587
|
};
|
|
25553
25588
|
function removeDirIfEmpty2(dirPath) {
|
|
25554
25589
|
try {
|
|
25555
|
-
if (!
|
|
25556
|
-
if (!
|
|
25557
|
-
if (
|
|
25558
|
-
|
|
25590
|
+
if (!fs28.existsSync(dirPath)) return false;
|
|
25591
|
+
if (!fs28.statSync(dirPath).isDirectory()) return false;
|
|
25592
|
+
if (fs28.readdirSync(dirPath).length > 0) return false;
|
|
25593
|
+
fs28.rmdirSync(dirPath);
|
|
25559
25594
|
return true;
|
|
25560
25595
|
} catch {
|
|
25561
25596
|
return false;
|
|
@@ -25565,7 +25600,7 @@ function collectBundledPaths(sourceDir) {
|
|
|
25565
25600
|
const files = [];
|
|
25566
25601
|
const directories = [];
|
|
25567
25602
|
function walk(currentDir, relativeDir = "") {
|
|
25568
|
-
for (const entry of
|
|
25603
|
+
for (const entry of fs28.readdirSync(currentDir, { withFileTypes: true })) {
|
|
25569
25604
|
const relativePath = relativeDir ? path34.join(relativeDir, entry.name) : entry.name;
|
|
25570
25605
|
const absolutePath = path34.join(currentDir, entry.name);
|
|
25571
25606
|
if (entry.isDirectory()) {
|
|
@@ -25580,7 +25615,7 @@ function collectBundledPaths(sourceDir) {
|
|
|
25580
25615
|
return { files, directories };
|
|
25581
25616
|
}
|
|
25582
25617
|
function removeBundledContent(sourceDir, targetDir) {
|
|
25583
|
-
if (!
|
|
25618
|
+
if (!fs28.existsSync(sourceDir) || !fs28.existsSync(targetDir)) {
|
|
25584
25619
|
return { removedPaths: [], removedRoot: false };
|
|
25585
25620
|
}
|
|
25586
25621
|
const { files, directories } = collectBundledPaths(sourceDir);
|
|
@@ -25588,7 +25623,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25588
25623
|
for (const relativePath of files) {
|
|
25589
25624
|
const targetPath = path34.join(targetDir, relativePath);
|
|
25590
25625
|
try {
|
|
25591
|
-
const entry =
|
|
25626
|
+
const entry = fs28.lstatSync(targetPath, { throwIfNoEntry: false });
|
|
25592
25627
|
if (!entry || entry.isDirectory()) continue;
|
|
25593
25628
|
removePath(targetPath);
|
|
25594
25629
|
removedPaths.push(relativePath);
|
|
@@ -25601,18 +25636,18 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25601
25636
|
for (const relativePath of directories) {
|
|
25602
25637
|
const targetPath = path34.join(targetDir, relativePath);
|
|
25603
25638
|
try {
|
|
25604
|
-
if (!
|
|
25605
|
-
if (!
|
|
25606
|
-
if (
|
|
25607
|
-
|
|
25639
|
+
if (!fs28.existsSync(targetPath)) continue;
|
|
25640
|
+
if (!fs28.statSync(targetPath).isDirectory()) continue;
|
|
25641
|
+
if (fs28.readdirSync(targetPath).length > 0) continue;
|
|
25642
|
+
fs28.rmdirSync(targetPath);
|
|
25608
25643
|
} catch {
|
|
25609
25644
|
}
|
|
25610
25645
|
}
|
|
25611
25646
|
let removedRoot = false;
|
|
25612
25647
|
try {
|
|
25613
|
-
if (
|
|
25614
|
-
if (
|
|
25615
|
-
|
|
25648
|
+
if (fs28.existsSync(targetDir) && fs28.statSync(targetDir).isDirectory()) {
|
|
25649
|
+
if (fs28.readdirSync(targetDir).length === 0) {
|
|
25650
|
+
fs28.rmdirSync(targetDir);
|
|
25616
25651
|
removedRoot = true;
|
|
25617
25652
|
}
|
|
25618
25653
|
}
|
|
@@ -25625,7 +25660,7 @@ function removeBundledContent(sourceDir, targetDir) {
|
|
|
25625
25660
|
}
|
|
25626
25661
|
function readBundledSkillName(skillFilePath, fallbackName) {
|
|
25627
25662
|
try {
|
|
25628
|
-
const content =
|
|
25663
|
+
const content = fs28.readFileSync(skillFilePath, "utf8");
|
|
25629
25664
|
const frontmatter = content.match(/^---\r?\n([\s\S]*?)\r?\n---/)?.[1];
|
|
25630
25665
|
if (!frontmatter) return fallbackName;
|
|
25631
25666
|
const data = (0, import_yaml5.parse)(frontmatter);
|
|
@@ -25636,18 +25671,18 @@ function readBundledSkillName(skillFilePath, fallbackName) {
|
|
|
25636
25671
|
}
|
|
25637
25672
|
}
|
|
25638
25673
|
function getBundledSkillNames(skillsDir) {
|
|
25639
|
-
if (!
|
|
25674
|
+
if (!fs28.existsSync(skillsDir)) return [];
|
|
25640
25675
|
const skillNames = [];
|
|
25641
|
-
for (const entry of
|
|
25676
|
+
for (const entry of fs28.readdirSync(skillsDir, { withFileTypes: true })) {
|
|
25642
25677
|
if (!entry.isDirectory()) continue;
|
|
25643
25678
|
const skillFilePath = path34.join(skillsDir, entry.name, "SKILL.md");
|
|
25644
|
-
if (!
|
|
25679
|
+
if (!fs28.existsSync(skillFilePath)) continue;
|
|
25645
25680
|
skillNames.push(readBundledSkillName(skillFilePath, entry.name));
|
|
25646
25681
|
}
|
|
25647
25682
|
return [...new Set(skillNames)].sort();
|
|
25648
25683
|
}
|
|
25649
25684
|
function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
25650
|
-
if (!
|
|
25685
|
+
if (!fs28.existsSync(targetDir)) {
|
|
25651
25686
|
return { removedPaths: [], removedRoot: false };
|
|
25652
25687
|
}
|
|
25653
25688
|
const removedPaths = [];
|
|
@@ -25665,12 +25700,12 @@ function removeBundledSkillInstalls(skillNames, targetDir) {
|
|
|
25665
25700
|
return { removedPaths, removedRoot };
|
|
25666
25701
|
}
|
|
25667
25702
|
function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
25668
|
-
if (!
|
|
25703
|
+
if (!fs28.existsSync(lockPath)) {
|
|
25669
25704
|
return { removedSkills: [], removedFile: false };
|
|
25670
25705
|
}
|
|
25671
25706
|
let parsed;
|
|
25672
25707
|
try {
|
|
25673
|
-
parsed = JSON.parse(
|
|
25708
|
+
parsed = JSON.parse(fs28.readFileSync(lockPath, "utf8"));
|
|
25674
25709
|
} catch {
|
|
25675
25710
|
return { removedSkills: [], removedFile: false };
|
|
25676
25711
|
}
|
|
@@ -25697,10 +25732,10 @@ function cleanupSkillsLockFile(lockPath, skillNames) {
|
|
|
25697
25732
|
parsed.skills && typeof parsed.skills === "object" && Object.keys(parsed.skills).length > 0
|
|
25698
25733
|
);
|
|
25699
25734
|
if (!hasSkills && otherKeys.length === 0) {
|
|
25700
|
-
|
|
25735
|
+
fs28.rmSync(lockPath, { force: true });
|
|
25701
25736
|
return { removedSkills, removedFile: true };
|
|
25702
25737
|
}
|
|
25703
|
-
|
|
25738
|
+
fs28.writeFileSync(lockPath, JSON.stringify(parsed, null, 2) + "\n");
|
|
25704
25739
|
return { removedSkills, removedFile: false };
|
|
25705
25740
|
}
|
|
25706
25741
|
function cleanupBundledSkills(skillNames, targets) {
|
|
@@ -26022,7 +26057,7 @@ async function uninstall(args) {
|
|
|
26022
26057
|
try {
|
|
26023
26058
|
execShellCommandSync(removable.cmd, { cwd: removable.cwd, env: removable.env });
|
|
26024
26059
|
const leftover = removable.kind === "global" ? getRemainingGlobalBinaryPath() : null;
|
|
26025
|
-
const removed = !leftover || removable.installDir !== null && !
|
|
26060
|
+
const removed = !leftover || removable.installDir !== null && !fs28.existsSync(removable.installDir);
|
|
26026
26061
|
if (removed) hasUninstalledPackage = true;
|
|
26027
26062
|
if (removed && removeCliRecordFor(removable.installDir)) {
|
|
26028
26063
|
log.info(import_picocolors13.default.dim(`Removed ${cliRecordPath()} (provider CLI discovery record).`));
|