@swmansion/argent 0.22.1-next.2 → 0.22.1-next.3
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-simulator-server.cjs +12 -19
- package/dist/bundled-paths.js +21 -28
- package/dist/bundled-paths.js.map +1 -1
- package/dist/cli-cmds.mjs +28 -46
- package/dist/cli.d.ts +3 -25
- package/dist/cli.js +12 -41
- package/dist/cli.js.map +1 -1
- package/dist/fatal-handlers.js +13 -17
- package/dist/fatal-handlers.js.map +1 -1
- package/dist/installer-help.d.ts +31 -49
- package/dist/installer-help.js +31 -54
- package/dist/installer-help.js.map +1 -1
- package/dist/installer.mjs +63 -120
- package/dist/mcp-server.mjs +16 -30
- package/dist/preview-window/main.cjs +9 -13
- package/dist/tool-server.cjs +426 -682
- package/package.json +1 -1
|
@@ -1,29 +1,24 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
"use strict";
|
|
3
3
|
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
// but the binary itself is platform-specific (Mach-O for darwin, ELF for
|
|
9
|
-
// linux). The native-devtools-ios resolver uses the same per-platform
|
|
10
|
-
// subdirectory layout, so a stable layout lives in exactly one place.
|
|
4
|
+
// Dispatcher published as the `argent-simulator-server` bin entry. npm's `bin`
|
|
5
|
+
// field resolves to a single file regardless of host platform, but the
|
|
6
|
+
// simulator-server binary is platform-specific, so pick it at invocation time
|
|
7
|
+
// and spawn it with the caller's args.
|
|
11
8
|
|
|
12
9
|
const { spawn } = require("node:child_process");
|
|
13
10
|
const path = require("node:path");
|
|
14
11
|
const fs = require("node:fs");
|
|
15
12
|
|
|
16
|
-
// Mirrors hostPlatformKey() in @argent/native-devtools-ios
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
//
|
|
20
|
-
// file — it ships verbatim as the npm `bin` entry.
|
|
13
|
+
// Mirrors hostPlatformKey() in @argent/native-devtools-ios; duplicated because
|
|
14
|
+
// this file ships verbatim as the npm `bin` entry and can't import. darwin ships
|
|
15
|
+
// a universal (lipo) binary, but Linux binaries are single-arch ELFs, so arm64
|
|
16
|
+
// Linux gets its own "linux-arm64" directory next to the x86_64 one ("linux").
|
|
21
17
|
const platformKey =
|
|
22
18
|
process.platform === "linux" && process.arch === "arm64" ? "linux-arm64" : process.platform;
|
|
23
19
|
|
|
24
|
-
//
|
|
25
|
-
//
|
|
26
|
-
// this file ships verbatim as the npm `bin` entry and can't import.
|
|
20
|
+
// Mirrors simulatorServerBinaryName() in @argent/native-devtools-ios; inlined
|
|
21
|
+
// because this file ships verbatim as the npm `bin` entry and can't import.
|
|
27
22
|
const binaryName = process.platform === "win32" ? "simulator-server.exe" : "simulator-server";
|
|
28
23
|
|
|
29
24
|
const binary = path.join(__dirname, platformKey, binaryName);
|
|
@@ -39,9 +34,7 @@ const child = spawn(binary, process.argv.slice(2), { stdio: "inherit" });
|
|
|
39
34
|
|
|
40
35
|
// Forward termination signals so a supervisor that signals only the dispatcher
|
|
41
36
|
// PID (systemd, `kill -TERM <pid>`, container stop) doesn't orphan the child.
|
|
42
|
-
// Ctrl+C
|
|
43
|
-
// receives it too — these handlers cover the non-TTY case where the parent
|
|
44
|
-
// would otherwise exit alone and leave the binary reparented to init.
|
|
37
|
+
// A TTY Ctrl+C already reaches the whole process group.
|
|
45
38
|
/** @type {NodeJS.Signals[]} */
|
|
46
39
|
const FORWARDED_SIGNALS = ["SIGTERM", "SIGINT", "SIGHUP"];
|
|
47
40
|
for (const sig of FORWARDED_SIGNALS) {
|
|
@@ -50,7 +43,7 @@ for (const sig of FORWARDED_SIGNALS) {
|
|
|
50
43
|
try {
|
|
51
44
|
child.kill(sig);
|
|
52
45
|
} catch {
|
|
53
|
-
//
|
|
46
|
+
// Child already exited between the signal arriving and forwarding.
|
|
54
47
|
}
|
|
55
48
|
}
|
|
56
49
|
});
|
package/dist/bundled-paths.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as fs from "node:fs";
|
|
2
2
|
import * as path from "node:path";
|
|
3
|
-
// Installed package version, read from the shipped package.json.
|
|
4
|
-
// launcher
|
|
5
|
-
// devDependency update rewrites tool-server.cjs at the same
|
|
6
|
-
//
|
|
7
|
-
// (--ignore-scripts, pnpm's build gate, Yarn
|
|
8
|
-
// why argent ships no postinstall script
|
|
3
|
+
// Installed package version, read from the shipped package.json. Feeds the
|
|
4
|
+
// launcher's version gate as the fallback for its on-disk read, so an in-place
|
|
5
|
+
// bump (a local devDependency update rewrites tool-server.cjs at the same
|
|
6
|
+
// path) retires the stale tool-server with no install-time hook: install
|
|
7
|
+
// scripts are frequently disabled (--ignore-scripts, pnpm's build gate, Yarn
|
|
8
|
+
// PnP, locked-down CI), which is why argent ships no postinstall script.
|
|
9
9
|
function readPackageVersion() {
|
|
10
10
|
try {
|
|
11
11
|
const pkg = JSON.parse(fs.readFileSync(path.join(import.meta.dirname, "..", "package.json"), "utf8"));
|
|
@@ -46,12 +46,10 @@ function findDeclaringRoot(startDir) {
|
|
|
46
46
|
// The version-STABLE package dir: the conventional <dir>/node_modules/<pkg>
|
|
47
47
|
// symlink closest to cwd that resolves to the running package. Unlike
|
|
48
48
|
// import.meta's realpath — pnpm's version-pinned .pnpm store dir, pruned on a
|
|
49
|
-
// bump — this symlink survives an in-place update.
|
|
50
|
-
// symlink sits in the DECLARING member's
|
|
51
|
-
// where the .pnpm store lives
|
|
52
|
-
//
|
|
53
|
-
// realpath equals the running package, so it can never point at a different
|
|
54
|
-
// install — just a different (stable) alias of the same real dir.
|
|
49
|
+
// bump — this symlink survives an in-place update. Scan every level from cwd
|
|
50
|
+
// up: in a pnpm WORKSPACE the symlink sits in the DECLARING member's
|
|
51
|
+
// node_modules, below the root where the .pnpm store lives. The realpath check
|
|
52
|
+
// means the result is only ever another alias of the same real dir.
|
|
55
53
|
export function findStablePackageDir(startDir, packageRoot) {
|
|
56
54
|
let dir = startDir;
|
|
57
55
|
for (;;) {
|
|
@@ -72,8 +70,7 @@ export function findStablePackageDir(startDir, packageRoot) {
|
|
|
72
70
|
// Install topology of this running package: a project's local devDependency
|
|
73
71
|
// (package root inside a node_modules found by walking up from cwd) or the
|
|
74
72
|
// global PATH install — and, for local, WHICH project. Classified at process
|
|
75
|
-
// start,
|
|
76
|
-
// resolves with cwd at the project root); the launcher forwards both as
|
|
73
|
+
// start, while cwd is still trustworthy; the launcher forwards both as
|
|
77
74
|
// ARGENT_INSTALL_KIND / ARGENT_PROJECT_ROOT so update-argent doesn't re-infer
|
|
78
75
|
// them from the detached server's editor-chosen cwd.
|
|
79
76
|
function classifyInstall() {
|
|
@@ -82,8 +79,8 @@ function classifyInstall() {
|
|
|
82
79
|
let cwd;
|
|
83
80
|
try {
|
|
84
81
|
packageRoot = fs.realpathSync(path.join(import.meta.dirname, ".."));
|
|
85
|
-
// cwd
|
|
86
|
-
//
|
|
82
|
+
// cwd throws (ENOENT) when the shell's directory was deleted, and this runs
|
|
83
|
+
// at module import, before fatal handlers are installed.
|
|
87
84
|
cwd = process.cwd();
|
|
88
85
|
dir = cwd;
|
|
89
86
|
}
|
|
@@ -94,11 +91,9 @@ function classifyInstall() {
|
|
|
94
91
|
try {
|
|
95
92
|
const nmReal = fs.realpathSync(path.join(dir, "node_modules"));
|
|
96
93
|
if (packageRoot === nmReal || packageRoot.startsWith(nmReal + path.sep)) {
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
//
|
|
100
|
-
// package dir (used for runtime paths that must survive a pnpm store
|
|
101
|
-
// prune) is found by its own cwd-up scan — see findStablePackageDir.
|
|
94
|
+
// Prefer the DECLARING root over this physical hoist root: in a
|
|
95
|
+
// hoisted workspace the declaring manifest sits at cwd (the member
|
|
96
|
+
// root) or an ancestor below `dir`.
|
|
102
97
|
return {
|
|
103
98
|
kind: "local",
|
|
104
99
|
projectRoot: findDeclaringRoot(cwd) ?? dir,
|
|
@@ -114,10 +109,9 @@ function classifyInstall() {
|
|
|
114
109
|
break;
|
|
115
110
|
dir = parent;
|
|
116
111
|
}
|
|
117
|
-
// Yarn PnP
|
|
118
|
-
//
|
|
119
|
-
//
|
|
120
|
-
// the user may not even have.
|
|
112
|
+
// Yarn PnP has no node_modules anywhere: the package runs from the project's
|
|
113
|
+
// .yarn dir. Falling through to "global" would point the update at a global
|
|
114
|
+
// install the user may not even have.
|
|
121
115
|
if (packageRoot.includes(`${path.sep}.yarn${path.sep}`)) {
|
|
122
116
|
const declRoot = findDeclaringRoot(cwd);
|
|
123
117
|
if (declRoot)
|
|
@@ -126,9 +120,8 @@ function classifyInstall() {
|
|
|
126
120
|
return { kind: "global" };
|
|
127
121
|
}
|
|
128
122
|
const classifiedInstall = classifyInstall();
|
|
129
|
-
//
|
|
130
|
-
//
|
|
131
|
-
// the classification found one (see classifyInstall).
|
|
123
|
+
// import.meta.dirname is dist/ in the published package, so ".." is the
|
|
124
|
+
// package root; prefer the version-stable alias when classification found one.
|
|
132
125
|
const packageDir = classifiedInstall.stablePackageDir ?? path.join(import.meta.dirname, "..");
|
|
133
126
|
export const BUNDLED_RUNTIME_PATHS = {
|
|
134
127
|
bundlePath: path.join(packageDir, "dist", "tool-server.cjs"),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundled-paths.js","sourceRoot":"","sources":["../src/bundled-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,
|
|
1
|
+
{"version":3,"file":"bundled-paths.js","sourceRoot":"","sources":["../src/bundled-paths.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,2EAA2E;AAC3E,+EAA+E;AAC/E,0EAA0E;AAC1E,yEAAyE;AACzE,6EAA6E;AAC7E,yEAAyE;AACzE,SAAS,kBAAkB;IACzB,IAAI,CAAC;QAC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AAU,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,EAAE,iBAAiB,CAAC;IAC5D,kBAAkB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,CAAC;IAChD,iBAAiB,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC;IAClD,OAAO,EAAE,kBAAkB,EAAE;IAC7B,WAAW,EAAE,iBAAiB,CAAC,IAAI;IACnC,kBAAkB,EAAE,iBAAiB,CAAC,WAAW;CAClD,CAAC"}
|
package/dist/cli-cmds.mjs
CHANGED
|
@@ -2405,15 +2405,12 @@ var FAILURE_CODES = {
|
|
|
2405
2405
|
NATIVE_PROFILER_SESSION_TORN_DOWN: "NATIVE_PROFILER_SESSION_TORN_DOWN",
|
|
2406
2406
|
NATIVE_PROFILER_APP_PROCESS_NOT_FOUND: "NATIVE_PROFILER_APP_PROCESS_NOT_FOUND",
|
|
2407
2407
|
NATIVE_PROFILER_NO_EXPORTED_TRACE: "NATIVE_PROFILER_NO_EXPORTED_TRACE",
|
|
2408
|
-
// Android perfetto start
|
|
2409
|
-
// failed recording start is classified rather than falling through to the
|
|
2410
|
-
// generic tool-execution bucket.
|
|
2408
|
+
// Android perfetto start failures, mirroring the iOS xctrace set above.
|
|
2411
2409
|
NATIVE_PROFILER_PERFETTO_PROCESS_ERROR: "NATIVE_PROFILER_PERFETTO_PROCESS_ERROR",
|
|
2412
2410
|
NATIVE_PROFILER_PERFETTO_READY_TIMEOUT: "NATIVE_PROFILER_PERFETTO_READY_TIMEOUT",
|
|
2413
2411
|
NATIVE_PROFILER_PERFETTO_READY_EXITED: "NATIVE_PROFILER_PERFETTO_READY_EXITED",
|
|
2414
|
-
//
|
|
2415
|
-
//
|
|
2416
|
-
// the step that failed rather than the device family.
|
|
2412
|
+
// iOS and Android share one capture path (simulator-server frames into
|
|
2413
|
+
// ffmpeg), so these name the failing stage, not the device family.
|
|
2417
2414
|
SCREEN_RECORDING_FACTORY_OPTIONS_MISSING: "SCREEN_RECORDING_FACTORY_OPTIONS_MISSING",
|
|
2418
2415
|
SCREEN_RECORDING_WRONG_PLATFORM: "SCREEN_RECORDING_WRONG_PLATFORM",
|
|
2419
2416
|
SCREEN_RECORDING_ALREADY_ACTIVE: "SCREEN_RECORDING_ALREADY_ACTIVE",
|
|
@@ -3272,14 +3269,12 @@ var CONFIG_SCHEMA = [
|
|
|
3272
3269
|
description: "Whether anonymous opt-out telemetry is enabled (on by default; environment opt-outs like DO_NOT_TRACK are not reflected here \u2014 `argent telemetry status` shows effective consent).",
|
|
3273
3270
|
scopes: ["global"],
|
|
3274
3271
|
parse: asBoolean,
|
|
3275
|
-
// A committed project file must never re-enable telemetry a user disabled
|
|
3276
|
-
// globally, so the more-restrictive (opt-out) value always wins.
|
|
3277
3272
|
merge: "prioritize-restrictive",
|
|
3278
|
-
//
|
|
3279
|
-
//
|
|
3273
|
+
// Opt-out: consent.ts reads an unstored value as enabled, so the config
|
|
3274
|
+
// surface must show the same rather than "(unset)".
|
|
3280
3275
|
default: true,
|
|
3281
|
-
//
|
|
3282
|
-
//
|
|
3276
|
+
// Opt-in/out goes through the dedicated command so the live client is
|
|
3277
|
+
// drained/reset, not just the file rewritten.
|
|
3283
3278
|
manageCommand: "argent telemetry"
|
|
3284
3279
|
},
|
|
3285
3280
|
{
|
|
@@ -3287,8 +3282,6 @@ var CONFIG_SCHEMA = [
|
|
|
3287
3282
|
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
3288
3283
|
scopes: ["project", "global"],
|
|
3289
3284
|
parse: asString,
|
|
3290
|
-
// A repo can pin the agent its screenshots should use; falls back to the
|
|
3291
|
-
// user's global remembered choice.
|
|
3292
3285
|
merge: "prioritize-local",
|
|
3293
3286
|
example: "claude"
|
|
3294
3287
|
},
|
|
@@ -3297,11 +3290,9 @@ var CONFIG_SCHEMA = [
|
|
|
3297
3290
|
description: "Additional CoreSimulator device-set directories whose simulators argent should see alongside the default set. Absolute paths (or ~/\u2026); relative entries resolve against the project root (project scope) or home (global scope).",
|
|
3298
3291
|
scopes: ["project", "global"],
|
|
3299
3292
|
parse: asStringArray,
|
|
3300
|
-
// Additive
|
|
3301
|
-
//
|
|
3302
|
-
//
|
|
3303
|
-
// `getAdditionalIosDeviceSets` re-implements this union (path resolution
|
|
3304
|
-
// must precede dedup) and guards on the preset staying "union".
|
|
3293
|
+
// Additive rather than shadowing: global baseline first, project extras
|
|
3294
|
+
// after, deduplicated. `getAdditionalIosDeviceSets` re-implements this union
|
|
3295
|
+
// (path resolution must precede dedup) and guards on the preset staying "union".
|
|
3305
3296
|
merge: "union",
|
|
3306
3297
|
example: '["~/DeviceSets/ci"]'
|
|
3307
3298
|
},
|
|
@@ -3310,10 +3301,8 @@ var CONFIG_SCHEMA = [
|
|
|
3310
3301
|
description: "Directory where finished screen recordings (mp4) are saved on the client host. Absolute, `~`-prefixed, or relative to the project root (home dir when not in a project). Unset \u21D2 `.argent/recordings` under the project root.",
|
|
3311
3302
|
scopes: ["project", "global"],
|
|
3312
3303
|
parse: asString,
|
|
3313
|
-
//
|
|
3314
|
-
//
|
|
3315
|
-
// persisted to), so with a remote `argent link` tool-server it is the
|
|
3316
|
-
// *client's* config that decides.
|
|
3304
|
+
// Resolved on the client (the machine the mp4 is persisted to), so with a
|
|
3305
|
+
// remote `argent link` tool-server it is the *client's* config that decides.
|
|
3317
3306
|
merge: "prioritize-local",
|
|
3318
3307
|
example: "~/Movies/argent"
|
|
3319
3308
|
}
|
|
@@ -6382,17 +6371,16 @@ function createExporter(config2) {
|
|
|
6382
6371
|
// The exporter bounds a request with `req.setTimeout()`, which Node only
|
|
6383
6372
|
// arms once the socket is CONNECTED — so a collector whose address drops
|
|
6384
6373
|
// packets (corporate egress filter, dead host behind a firewall) leaves a
|
|
6385
|
-
// socket stuck
|
|
6386
|
-
//
|
|
6387
|
-
//
|
|
6388
|
-
//
|
|
6389
|
-
//
|
|
6374
|
+
// socket stuck connecting that no export deadline can reach, holding the
|
|
6375
|
+
// process open for the OS connect timeout after shutdown() has resolved.
|
|
6376
|
+
// The agent's socket timeout is armed when the socket is CREATED, so it
|
|
6377
|
+
// covers connect too: it fires, the request emits 'timeout', and the
|
|
6378
|
+
// exporter's handler destroys it.
|
|
6390
6379
|
//
|
|
6391
6380
|
// keepAlive is restated because supplying httpAgentOptions at all
|
|
6392
|
-
// replaces the agent the SDK would otherwise build,
|
|
6393
|
-
// keepAlive: true
|
|
6394
|
-
// TCP+TLS handshake for every
|
|
6395
|
-
// request against a loopback collector, versus one socket shared.
|
|
6381
|
+
// replaces the agent the SDK would otherwise build, whose default is
|
|
6382
|
+
// keepAlive: true; without it the long-lived tool-server pays a fresh
|
|
6383
|
+
// TCP+TLS handshake for every batch.
|
|
6396
6384
|
httpAgentOptions: { timeout: EXPORT_TIMEOUT_MS, keepAlive: true }
|
|
6397
6385
|
});
|
|
6398
6386
|
} finally {
|
|
@@ -6603,7 +6591,6 @@ var ALLOWED = {
|
|
|
6603
6591
|
install_mode: INSTALL_MODE
|
|
6604
6592
|
},
|
|
6605
6593
|
"installation:global_install_decision": {
|
|
6606
|
-
// `from_tar` is intentionally absent; the installer skips that dev path.
|
|
6607
6594
|
decision: oneOf(["install", "cancel", "already_installed"])
|
|
6608
6595
|
},
|
|
6609
6596
|
"installation:update_decision": {
|
|
@@ -6682,9 +6669,8 @@ var ALLOWED = {
|
|
|
6682
6669
|
tool_invocation_id: UUID,
|
|
6683
6670
|
platform: PLATFORM,
|
|
6684
6671
|
duration_ms: DURATION_MS,
|
|
6685
|
-
//
|
|
6686
|
-
//
|
|
6687
|
-
// voids anything longer or with a non-identifier element.
|
|
6672
|
+
// Emit side sends only names declared in the tool's zod shape, capped at 16
|
|
6673
|
+
// because arrayOf voids the whole array once it is longer.
|
|
6688
6674
|
invalid_params: arrayOf(matches(/^[a-z][a-z0-9_]{0,63}$/i, 64), 16),
|
|
6689
6675
|
...FAILURE_SIGNAL,
|
|
6690
6676
|
...AI_TELEMETRY
|
|
@@ -7216,7 +7202,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
|
|
|
7216
7202
|
var SESSION_ID2 = randomUUID5();
|
|
7217
7203
|
function readCliVersion() {
|
|
7218
7204
|
if (true) {
|
|
7219
|
-
return "0.22.1-next.
|
|
7205
|
+
return "0.22.1-next.3";
|
|
7220
7206
|
}
|
|
7221
7207
|
return "0.0.0";
|
|
7222
7208
|
}
|
|
@@ -7513,15 +7499,11 @@ function resolveHostFingerprint() {
|
|
|
7513
7499
|
const out = execFileSync2(simulatorServerBinaryPath(), ["fingerprint"], {
|
|
7514
7500
|
encoding: "utf8",
|
|
7515
7501
|
timeout: FINGERPRINT_TIMEOUT_MS,
|
|
7516
|
-
//
|
|
7517
|
-
//
|
|
7518
|
-
// SIGKILL can't be trapped, so the timeout is a genuine bound here.
|
|
7502
|
+
// SIGKILL, not the default SIGTERM: a binary that ignores SIGTERM would
|
|
7503
|
+
// otherwise block the (synchronous) event loop past the cap forever.
|
|
7519
7504
|
killSignal: "SIGKILL",
|
|
7520
|
-
// Cap captured stdout (same limit as the async variant): a binary streaming
|
|
7521
|
-
// output is SIGKILL'd at this cap rather than filling Node's 1 MiB default.
|
|
7522
7505
|
maxBuffer: FINGERPRINT_MAX_BUFFER,
|
|
7523
|
-
// Ignore stderr so
|
|
7524
|
-
// caller's stderr; stdout (index 1) is captured as the return value.
|
|
7506
|
+
// Ignore stderr so the binary's diagnostics don't pollute the caller's.
|
|
7525
7507
|
stdio: ["ignore", "pipe", "ignore"]
|
|
7526
7508
|
}).trim();
|
|
7527
7509
|
return out.length > 0 ? out : null;
|
|
@@ -9558,8 +9540,8 @@ async function runDetached(paths, port, host, idleTimeoutMinutes, token) {
|
|
|
9558
9540
|
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
9559
9541
|
bundlePath: paths.bundlePath,
|
|
9560
9542
|
host,
|
|
9561
|
-
//
|
|
9562
|
-
//
|
|
9543
|
+
// Tags this as explicitly started (possibly supervisor-managed) so the MCP
|
|
9544
|
+
// auto-spawn path's kill-before-respawn never terminates it.
|
|
9563
9545
|
managed: "cli",
|
|
9564
9546
|
...token ? { token } : {}
|
|
9565
9547
|
});
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* argent CLI
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* lazy-imports the matching bundle, and forwards arguments. The actual
|
|
7
|
-
* subcommand implementations live in sibling workspace packages and ship as
|
|
8
|
-
* pre-bundled CJS files in dist/ alongside this dispatcher.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* argent mcp Start the MCP stdio server (used by editors)
|
|
12
|
-
* argent init Set up argent in a workspace (MCP + skills + rules)
|
|
13
|
-
* argent install Alias for init
|
|
14
|
-
* argent update Check for updates, refresh configuration
|
|
15
|
-
* argent uninstall Remove argent from a workspace
|
|
16
|
-
* argent remove Alias for uninstall
|
|
17
|
-
* argent tools List tools exposed by the tool-server
|
|
18
|
-
* argent tools describe <name> Show one tool's flags
|
|
19
|
-
* argent run <tool> [flags] Invoke a tool by name
|
|
20
|
-
* argent server start [flags] Spawn a long-lived tool-server (foreground by default)
|
|
21
|
-
* argent server status|stop|logs Manage the shared tool-server
|
|
22
|
-
* argent lens Open Argent Lens bound to a fresh coding-agent session (macOS)
|
|
23
|
-
* argent link [flags] Route client requests to a remote tool-server
|
|
24
|
-
* argent unlink Remove the persisted remote link
|
|
25
|
-
* argent enable <flag> Enable a feature flag (global by default)
|
|
26
|
-
* argent disable <flag> Disable a feature flag (global by default)
|
|
27
|
-
* argent flags Show current feature-flag state
|
|
3
|
+
* argent CLI entry point. Dispatch only: subcommand implementations live in the
|
|
4
|
+
* sibling workspace packages (@argent/installer, @argent/mcp, @argent/cli) and
|
|
5
|
+
* are lazy-imported from bundles in dist/.
|
|
28
6
|
*/
|
|
29
7
|
export {};
|
package/dist/cli.js
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
* argent CLI
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* lazy-imports the matching bundle, and forwards arguments. The actual
|
|
7
|
-
* subcommand implementations live in sibling workspace packages and ship as
|
|
8
|
-
* pre-bundled CJS files in dist/ alongside this dispatcher.
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* argent mcp Start the MCP stdio server (used by editors)
|
|
12
|
-
* argent init Set up argent in a workspace (MCP + skills + rules)
|
|
13
|
-
* argent install Alias for init
|
|
14
|
-
* argent update Check for updates, refresh configuration
|
|
15
|
-
* argent uninstall Remove argent from a workspace
|
|
16
|
-
* argent remove Alias for uninstall
|
|
17
|
-
* argent tools List tools exposed by the tool-server
|
|
18
|
-
* argent tools describe <name> Show one tool's flags
|
|
19
|
-
* argent run <tool> [flags] Invoke a tool by name
|
|
20
|
-
* argent server start [flags] Spawn a long-lived tool-server (foreground by default)
|
|
21
|
-
* argent server status|stop|logs Manage the shared tool-server
|
|
22
|
-
* argent lens Open Argent Lens bound to a fresh coding-agent session (macOS)
|
|
23
|
-
* argent link [flags] Route client requests to a remote tool-server
|
|
24
|
-
* argent unlink Remove the persisted remote link
|
|
25
|
-
* argent enable <flag> Enable a feature flag (global by default)
|
|
26
|
-
* argent disable <flag> Disable a feature flag (global by default)
|
|
27
|
-
* argent flags Show current feature-flag state
|
|
3
|
+
* argent CLI entry point. Dispatch only: subcommand implementations live in the
|
|
4
|
+
* sibling workspace packages (@argent/installer, @argent/mcp, @argent/cli) and
|
|
5
|
+
* are lazy-imported from bundles in dist/.
|
|
28
6
|
*/
|
|
29
7
|
import * as fs from "node:fs";
|
|
30
8
|
import * as path from "node:path";
|
|
@@ -34,8 +12,6 @@ import { INSTALLER_COMMAND_META, installerHelpRequested, printInstallerHelp, } f
|
|
|
34
12
|
const PACKAGE_NAME = "@swmansion/argent";
|
|
35
13
|
function getInstalledVersion() {
|
|
36
14
|
try {
|
|
37
|
-
// dist/cli.js lives in the published package's dist/, so two-up is the
|
|
38
|
-
// package root containing the shipped package.json.
|
|
39
15
|
const pkgPath = path.resolve(import.meta.dirname, "..", "package.json");
|
|
40
16
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
41
17
|
return pkg.version ?? null;
|
|
@@ -47,11 +23,8 @@ function getInstalledVersion() {
|
|
|
47
23
|
const [, , command, ...rest] = process.argv;
|
|
48
24
|
const isMcpServer = command === "mcp";
|
|
49
25
|
installFatalHandlers({ isMcpServer });
|
|
50
|
-
//
|
|
51
|
-
//
|
|
52
|
-
// shared with the per-command `--help`, so the two can't drift; the details
|
|
53
|
-
// are table-only prose kept in the meta so each command's help text lives in
|
|
54
|
-
// one place.
|
|
26
|
+
// `summary` is shared with the per-command `--help` so the two can't drift;
|
|
27
|
+
// `details` are rendered only in this table.
|
|
55
28
|
function installerHelpEntry(command) {
|
|
56
29
|
const meta = INSTALLER_COMMAND_META[command];
|
|
57
30
|
const details = (meta.details ?? []).map((line) => `\n ${line}`).join("");
|
|
@@ -94,9 +67,8 @@ Run \`argent <command> --help\` for command-specific help.
|
|
|
94
67
|
Package: ${PACKAGE_NAME}
|
|
95
68
|
`);
|
|
96
69
|
}
|
|
97
|
-
//
|
|
98
|
-
//
|
|
99
|
-
// Typed against the workspace packages so calls are still checked.
|
|
70
|
+
// The bundles are produced at build time by scripts/bundle-tools.cjs into dist/;
|
|
71
|
+
// typed against the workspace packages so calls are still checked.
|
|
100
72
|
async function loadInstaller() {
|
|
101
73
|
return (await import("./installer.mjs"));
|
|
102
74
|
}
|
|
@@ -107,12 +79,11 @@ async function loadCli() {
|
|
|
107
79
|
return (await import("./cli-cmds.mjs"));
|
|
108
80
|
}
|
|
109
81
|
async function main() {
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
//
|
|
113
|
-
//
|
|
114
|
-
//
|
|
115
|
-
// dispatching. Every other subcommand parses `--help` itself.
|
|
82
|
+
// The installers forward argv to side-effecting functions that ignore
|
|
83
|
+
// `--help` (so `argent uninstall --help` would run the real, destructive
|
|
84
|
+
// command), and `mcp` is handed no argv at all, so a help flag there starts
|
|
85
|
+
// the stdio server and blocks on stdin. Every other subcommand parses
|
|
86
|
+
// `--help` itself.
|
|
116
87
|
if (installerHelpRequested(command, rest)) {
|
|
117
88
|
// installerHelpRequested only returns true for an InstallerCommand.
|
|
118
89
|
printInstallerHelp(command);
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AACA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,kBAAkB,GAEnB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,YAAY,GAAG,mBAAmB,CAAC;AAEzC,SAAS,mBAAmB;IAC1B,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;QACxE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,OAAO,EAAE,MAAM,CAAC,CAAyB,CAAC;QACjF,OAAO,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC;IAC7B,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED,MAAM,CAAC,EAAE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AI,EAAE,CAAC;gBACxD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YAClB,CAAC;IACL,CAAC;AACH,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/fatal-handlers.js
CHANGED
|
@@ -1,25 +1,21 @@
|
|
|
1
|
-
// Process-level
|
|
1
|
+
// Process-level uncaughtException/unhandledRejection handlers.
|
|
2
2
|
//
|
|
3
3
|
// In MCP-server mode we do NOT exit on every uncaught error — many are
|
|
4
4
|
// transient and the editor expects the server to keep running. But the naive
|
|
5
5
|
// version (`stderr.write(...); if (!isMcp) exit`) burns 100% CPU when stderr
|
|
6
6
|
// itself is broken (e.g. the parent process is gone): the write emits an
|
|
7
|
-
// async 'error' event
|
|
8
|
-
// uncaughtException,
|
|
7
|
+
// async 'error' event, which without a listener becomes another
|
|
8
|
+
// uncaughtException, which writes to the same broken stream, ...
|
|
9
9
|
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
// cleanly instead of escaping into another uncaughtException.
|
|
16
|
-
// 3. try/catch around the formatter — a throwing `.stack` getter or
|
|
17
|
-
// `toString` (the production trace pointed at defaultPrepareStackTrace)
|
|
18
|
-
// can't take down the handler.
|
|
10
|
+
// Hence: `'error'` listeners on stdout/stderr (broken stdio is fatal — exit
|
|
11
|
+
// before the failure round-trips into uncaughtException; this is what breaks
|
|
12
|
+
// the loop), try/catch around `stderr.write` for synchronous failures, and
|
|
13
|
+
// try/catch around the formatter, since a throwing `.stack` getter is what
|
|
14
|
+
// the production trace pointed at.
|
|
19
15
|
//
|
|
20
|
-
//
|
|
21
|
-
//
|
|
22
|
-
//
|
|
16
|
+
// With stdio unusable we cannot report to the parent, so we leave a
|
|
17
|
+
// breadcrumb at `~/.argent/mcp-fatal.log`, next to the other persistent
|
|
18
|
+
// argent logs.
|
|
23
19
|
import * as fs from "node:fs";
|
|
24
20
|
import * as os from "node:os";
|
|
25
21
|
import * as path from "node:path";
|
|
@@ -32,8 +28,8 @@ function appendFatalLog(label, detail) {
|
|
|
32
28
|
fs.appendFileSync(FATAL_LOG_PATH, line);
|
|
33
29
|
}
|
|
34
30
|
catch {
|
|
35
|
-
// Last-resort log
|
|
36
|
-
//
|
|
31
|
+
// Last-resort log; if even this fails (read-only fs, missing home) there
|
|
32
|
+
// is nothing left to try.
|
|
37
33
|
}
|
|
38
34
|
}
|
|
39
35
|
export function installFatalHandlers(opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fatal-handlers.js","sourceRoot":"","sources":["../src/fatal-handlers.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"fatal-handlers.js","sourceRoot":"","sources":["../src/fatal-handlers.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,EAAE;AACF,uEAAuE;AACvE,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,gEAAgE;AAChE,iEAAiE;AACjE,EAAE;AACF,4EAA4E;AAC5E,6EAA6E;AAC7E,2EAA2E;AAC3E,2EAA2E;AAC3E,mCAAmC;AACnC,EAAE;AACF,oEAAoE;AACpE,wEAAwE;AACxE,eAAe;AAEf,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,IAAI,SAAS,GAAG,KAAK,CAAC;AAEtB,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;AAE3E,SAAS,cAAc,CAAC,KAAa,EAAE,MAAc;IACnD,IAAI,C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