@swmansion/argent 0.16.1 → 0.16.2-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/argent-android-devtools-0.1.0.apk +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/tcp/ax-service +0 -0
- package/dist/cli-cmds.mjs +617 -119
- package/dist/cli.js +3 -0
- package/dist/cli.js.map +1 -1
- package/dist/installer.mjs +36 -13
- package/dist/mcp-server.mjs +27 -17
- package/dist/tool-server.cjs +15 -6
- package/dylibs/libArgentInjectionBootstrap.dylib +0 -0
- package/dylibs/libKeyboardPatch.dylib +0 -0
- package/dylibs/libNativeDevtoolsIos.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 +1 -1
package/dist/cli-cmds.mjs
CHANGED
|
@@ -204,7 +204,7 @@ function generateAuthToken() {
|
|
|
204
204
|
return generateToken();
|
|
205
205
|
}
|
|
206
206
|
function findFreePort() {
|
|
207
|
-
return new Promise((
|
|
207
|
+
return new Promise((resolve7, reject) => {
|
|
208
208
|
const srv = net.createServer();
|
|
209
209
|
srv.listen(0, "127.0.0.1", () => {
|
|
210
210
|
const addr = srv.address();
|
|
@@ -215,7 +215,7 @@ function findFreePort() {
|
|
|
215
215
|
const port = addr.port;
|
|
216
216
|
srv.close((err) => {
|
|
217
217
|
if (err) reject(err);
|
|
218
|
-
else
|
|
218
|
+
else resolve7(port);
|
|
219
219
|
});
|
|
220
220
|
});
|
|
221
221
|
srv.on("error", reject);
|
|
@@ -316,7 +316,7 @@ function killSpawnedChild(child, pid) {
|
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
function spawnToolsServer(paths, port, options = {}) {
|
|
319
|
-
return new Promise((
|
|
319
|
+
return new Promise((resolve7, reject) => {
|
|
320
320
|
let logFd;
|
|
321
321
|
try {
|
|
322
322
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -353,7 +353,7 @@ function spawnToolsServer(paths, port, options = {}) {
|
|
|
353
353
|
rl.close();
|
|
354
354
|
child.stdout?.resume();
|
|
355
355
|
child.stdout?.unref?.();
|
|
356
|
-
settle(() =>
|
|
356
|
+
settle(() => resolve7({ port: actualPort, pid }));
|
|
357
357
|
}
|
|
358
358
|
});
|
|
359
359
|
child.on("error", (err) => {
|
|
@@ -742,8 +742,8 @@ function parseLinkTarget(input) {
|
|
|
742
742
|
const host = u3.hostname.startsWith("[") ? u3.hostname.slice(1, -1) : u3.hostname;
|
|
743
743
|
if (!host) throw new Error(`URL "${input}" is missing a host.`);
|
|
744
744
|
const port = u3.port ? Number(u3.port) : u3.protocol === "https:" ? 443 : 80;
|
|
745
|
-
const
|
|
746
|
-
const url = `${u3.protocol}//${u3.host}${
|
|
745
|
+
const path15 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
|
|
746
|
+
const url = `${u3.protocol}//${u3.host}${path15}`;
|
|
747
747
|
const token = u3.username ? decodeURIComponent(u3.username) : void 0;
|
|
748
748
|
return { url, host, port, ...token ? { token } : {} };
|
|
749
749
|
}
|
|
@@ -879,9 +879,9 @@ async function tarball(sourcePath) {
|
|
|
879
879
|
return tarPath;
|
|
880
880
|
}
|
|
881
881
|
function sha256File(filePath) {
|
|
882
|
-
return new Promise((
|
|
882
|
+
return new Promise((resolve7, reject) => {
|
|
883
883
|
const hash = createHash2("sha256");
|
|
884
|
-
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () =>
|
|
884
|
+
createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve7(hash.digest("hex"))).on("error", reject);
|
|
885
885
|
});
|
|
886
886
|
}
|
|
887
887
|
async function uploadTar(tarPath, endpoint) {
|
|
@@ -1254,8 +1254,8 @@ function createGetModuleFromFilename(basePath = process.argv[1] ? dirname4(proce
|
|
|
1254
1254
|
return decodedFile;
|
|
1255
1255
|
};
|
|
1256
1256
|
}
|
|
1257
|
-
function normalizeWindowsPath(
|
|
1258
|
-
return
|
|
1257
|
+
function normalizeWindowsPath(path15) {
|
|
1258
|
+
return path15.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
|
|
1259
1259
|
}
|
|
1260
1260
|
|
|
1261
1261
|
// ../../node_modules/@posthog/core/dist/featureFlagUtils.mjs
|
|
@@ -2889,13 +2889,13 @@ var DEFAULT_EXCEPTION_STEPS_CONFIG = {
|
|
|
2889
2889
|
enabled: true,
|
|
2890
2890
|
max_bytes: 32768
|
|
2891
2891
|
};
|
|
2892
|
-
function resolveExceptionStepsConfig(
|
|
2893
|
-
if (!
|
|
2892
|
+
function resolveExceptionStepsConfig(config2) {
|
|
2893
|
+
if (!config2) return {
|
|
2894
2894
|
...DEFAULT_EXCEPTION_STEPS_CONFIG
|
|
2895
2895
|
};
|
|
2896
2896
|
return {
|
|
2897
|
-
enabled:
|
|
2898
|
-
max_bytes: normalizePositiveInteger(
|
|
2897
|
+
enabled: config2.enabled ?? DEFAULT_EXCEPTION_STEPS_CONFIG.enabled,
|
|
2898
|
+
max_bytes: normalizePositiveInteger(config2.max_bytes, DEFAULT_EXCEPTION_STEPS_CONFIG.max_bytes)
|
|
2899
2899
|
};
|
|
2900
2900
|
}
|
|
2901
2901
|
function stripReservedExceptionStepFields(properties) {
|
|
@@ -2918,13 +2918,13 @@ function stripReservedExceptionStepFields(properties) {
|
|
|
2918
2918
|
};
|
|
2919
2919
|
}
|
|
2920
2920
|
var ExceptionStepsBuffer = class {
|
|
2921
|
-
constructor(
|
|
2921
|
+
constructor(config2) {
|
|
2922
2922
|
this._entries = [];
|
|
2923
2923
|
this._totalBytes = 0;
|
|
2924
|
-
this._config = resolveExceptionStepsConfig(
|
|
2924
|
+
this._config = resolveExceptionStepsConfig(config2);
|
|
2925
2925
|
}
|
|
2926
|
-
setConfig(
|
|
2927
|
-
this._config = resolveExceptionStepsConfig(
|
|
2926
|
+
setConfig(config2) {
|
|
2927
|
+
this._config = resolveExceptionStepsConfig(config2);
|
|
2928
2928
|
this._trimToMaxBytes();
|
|
2929
2929
|
}
|
|
2930
2930
|
add(step) {
|
|
@@ -3807,15 +3807,15 @@ async function addSourceContext(frames) {
|
|
|
3807
3807
|
LRU_FILE_CONTENTS_CACHE.reduce();
|
|
3808
3808
|
return frames;
|
|
3809
3809
|
}
|
|
3810
|
-
function getContextLinesFromFile(
|
|
3811
|
-
return new Promise((
|
|
3812
|
-
const stream = createReadStream2(
|
|
3810
|
+
function getContextLinesFromFile(path15, ranges, output) {
|
|
3811
|
+
return new Promise((resolve7) => {
|
|
3812
|
+
const stream = createReadStream2(path15);
|
|
3813
3813
|
const lineReaded = createInterface2({
|
|
3814
3814
|
input: stream
|
|
3815
3815
|
});
|
|
3816
3816
|
function destroyStreamAndResolve() {
|
|
3817
3817
|
stream.destroy();
|
|
3818
|
-
|
|
3818
|
+
resolve7();
|
|
3819
3819
|
}
|
|
3820
3820
|
let lineNumber = 0;
|
|
3821
3821
|
let currentRangeIndex = 0;
|
|
@@ -3824,7 +3824,7 @@ function getContextLinesFromFile(path14, ranges, output) {
|
|
|
3824
3824
|
let rangeStart = range[0];
|
|
3825
3825
|
let rangeEnd = range[1];
|
|
3826
3826
|
function onStreamError() {
|
|
3827
|
-
LRU_FILE_CONTENTS_FS_READ_FAILED.set(
|
|
3827
|
+
LRU_FILE_CONTENTS_FS_READ_FAILED.set(path15, 1);
|
|
3828
3828
|
lineReaded.close();
|
|
3829
3829
|
lineReaded.removeAllListeners();
|
|
3830
3830
|
destroyStreamAndResolve();
|
|
@@ -3885,8 +3885,8 @@ function clearLineContext(frame) {
|
|
|
3885
3885
|
delete frame.context_line;
|
|
3886
3886
|
delete frame.post_context;
|
|
3887
3887
|
}
|
|
3888
|
-
function shouldSkipContextLinesForFile(
|
|
3889
|
-
return
|
|
3888
|
+
function shouldSkipContextLinesForFile(path15) {
|
|
3889
|
+
return path15.startsWith("node:") || path15.endsWith(".min.js") || path15.endsWith(".min.cjs") || path15.endsWith(".min.mjs") || path15.startsWith("data:");
|
|
3890
3890
|
}
|
|
3891
3891
|
function shouldSkipContextLinesForFrame(frame) {
|
|
3892
3892
|
if (void 0 !== frame.lineno && frame.lineno > MAX_CONTEXTLINES_LINENO) return true;
|
|
@@ -5112,9 +5112,9 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5112
5112
|
if (!waitUntil) return;
|
|
5113
5113
|
if (this.disabled || this.optedOut) return;
|
|
5114
5114
|
if (!this._waitUntilCycle) {
|
|
5115
|
-
let
|
|
5115
|
+
let resolve7;
|
|
5116
5116
|
const promise = new Promise((r2) => {
|
|
5117
|
-
|
|
5117
|
+
resolve7 = r2;
|
|
5118
5118
|
});
|
|
5119
5119
|
try {
|
|
5120
5120
|
waitUntil(promise);
|
|
@@ -5122,7 +5122,7 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5122
5122
|
return;
|
|
5123
5123
|
}
|
|
5124
5124
|
this._waitUntilCycle = {
|
|
5125
|
-
resolve:
|
|
5125
|
+
resolve: resolve7,
|
|
5126
5126
|
startedAt: Date.now(),
|
|
5127
5127
|
timer: void 0
|
|
5128
5128
|
};
|
|
@@ -5146,12 +5146,12 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5146
5146
|
return cycle?.resolve;
|
|
5147
5147
|
}
|
|
5148
5148
|
async resolveWaitUntilFlush() {
|
|
5149
|
-
const
|
|
5149
|
+
const resolve7 = this._consumeWaitUntilCycle();
|
|
5150
5150
|
try {
|
|
5151
5151
|
await super.flush();
|
|
5152
5152
|
} catch {
|
|
5153
5153
|
} finally {
|
|
5154
|
-
|
|
5154
|
+
resolve7?.();
|
|
5155
5155
|
}
|
|
5156
5156
|
}
|
|
5157
5157
|
getPersistedProperty(key) {
|
|
@@ -5272,15 +5272,15 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5272
5272
|
async waitForLocalEvaluationReady(timeoutMs = THIRTY_SECONDS) {
|
|
5273
5273
|
if (this.isLocalEvaluationReady()) return true;
|
|
5274
5274
|
if (void 0 === this.featureFlagsPoller) return false;
|
|
5275
|
-
return new Promise((
|
|
5275
|
+
return new Promise((resolve7) => {
|
|
5276
5276
|
const timeout = setTimeout(() => {
|
|
5277
5277
|
cleanup();
|
|
5278
|
-
|
|
5278
|
+
resolve7(false);
|
|
5279
5279
|
}, timeoutMs);
|
|
5280
5280
|
const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
|
|
5281
5281
|
clearTimeout(timeout);
|
|
5282
5282
|
cleanup();
|
|
5283
|
-
|
|
5283
|
+
resolve7(count > 0);
|
|
5284
5284
|
});
|
|
5285
5285
|
});
|
|
5286
5286
|
}
|
|
@@ -5735,14 +5735,14 @@ var PostHogBackendClient = class extends PostHogCoreStateless {
|
|
|
5735
5735
|
this.context?.enter(data, options);
|
|
5736
5736
|
}
|
|
5737
5737
|
async _shutdown(shutdownTimeoutMs) {
|
|
5738
|
-
const
|
|
5738
|
+
const resolve7 = this._consumeWaitUntilCycle();
|
|
5739
5739
|
await this.featureFlagsPoller?.stopPoller(shutdownTimeoutMs);
|
|
5740
5740
|
this.errorTracking.shutdown();
|
|
5741
5741
|
try {
|
|
5742
5742
|
return await super._shutdown(shutdownTimeoutMs);
|
|
5743
5743
|
} finally {
|
|
5744
5744
|
this.distinctIdHasSentFlagCalls = {};
|
|
5745
|
-
|
|
5745
|
+
resolve7?.();
|
|
5746
5746
|
}
|
|
5747
5747
|
}
|
|
5748
5748
|
async _requestRemoteConfigPayload(flagKey) {
|
|
@@ -6090,8 +6090,8 @@ function resolveConfig() {
|
|
|
6090
6090
|
var client;
|
|
6091
6091
|
function getClient() {
|
|
6092
6092
|
if (client !== void 0) return client;
|
|
6093
|
-
const
|
|
6094
|
-
if (!
|
|
6093
|
+
const config2 = resolveConfig();
|
|
6094
|
+
if (!config2.isUsable) {
|
|
6095
6095
|
client = null;
|
|
6096
6096
|
return null;
|
|
6097
6097
|
}
|
|
@@ -6104,7 +6104,7 @@ function getClient() {
|
|
|
6104
6104
|
fetchRetryCount: 0
|
|
6105
6105
|
};
|
|
6106
6106
|
try {
|
|
6107
|
-
client = new PostHog(
|
|
6107
|
+
client = new PostHog(config2.key, opts);
|
|
6108
6108
|
} catch {
|
|
6109
6109
|
client = null;
|
|
6110
6110
|
return null;
|
|
@@ -6711,9 +6711,9 @@ function isReplitAgent(env) {
|
|
|
6711
6711
|
}
|
|
6712
6712
|
var DEVIN_MARKER_PATH = "/opt/.devin";
|
|
6713
6713
|
var JULES_MARKER_PATH = "/opt/environment_summary.sh";
|
|
6714
|
-
function safeExists(fileExists,
|
|
6714
|
+
function safeExists(fileExists, path15) {
|
|
6715
6715
|
try {
|
|
6716
|
-
return fileExists(
|
|
6716
|
+
return fileExists(path15);
|
|
6717
6717
|
} catch {
|
|
6718
6718
|
return false;
|
|
6719
6719
|
}
|
|
@@ -7200,18 +7200,20 @@ function getFlagDefinition(name, registry = FLAG_REGISTRY) {
|
|
|
7200
7200
|
return registry.find((def) => def.name === name);
|
|
7201
7201
|
}
|
|
7202
7202
|
var PROJECT_MARKERS = [".argent", ".git", "package.json"];
|
|
7203
|
-
function
|
|
7204
|
-
|
|
7205
|
-
let current = initial;
|
|
7203
|
+
function findProjectRoot(startDir) {
|
|
7204
|
+
let current = path4.resolve(startDir);
|
|
7206
7205
|
while (true) {
|
|
7207
7206
|
for (const marker of PROJECT_MARKERS) {
|
|
7208
7207
|
if (fs2.existsSync(path4.join(current, marker))) return current;
|
|
7209
7208
|
}
|
|
7210
7209
|
const parent = path4.dirname(current);
|
|
7211
|
-
if (parent === current) return
|
|
7210
|
+
if (parent === current) return null;
|
|
7212
7211
|
current = parent;
|
|
7213
7212
|
}
|
|
7214
7213
|
}
|
|
7214
|
+
function resolveProjectRoot(startDir) {
|
|
7215
|
+
return findProjectRoot(startDir) ?? path4.resolve(startDir);
|
|
7216
|
+
}
|
|
7215
7217
|
function getFlagsPath(scope, options = {}) {
|
|
7216
7218
|
const home = options.homeDir ?? homedir3();
|
|
7217
7219
|
if (scope === "global") {
|
|
@@ -7296,33 +7298,91 @@ function argentHomeDir() {
|
|
|
7296
7298
|
const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
|
|
7297
7299
|
return path5.join(home, ".argent");
|
|
7298
7300
|
}
|
|
7299
|
-
function
|
|
7300
|
-
|
|
7301
|
+
function configDir(scope = "global", options = {}) {
|
|
7302
|
+
if (scope === "global") {
|
|
7303
|
+
return options.homeDir ? path5.join(options.homeDir, ".argent") : argentHomeDir();
|
|
7304
|
+
}
|
|
7305
|
+
const cwd = options.cwd ?? process.cwd();
|
|
7306
|
+
return path5.join(resolveProjectRoot(cwd), ".argent");
|
|
7307
|
+
}
|
|
7308
|
+
function configFilePath(scope = "global", options = {}) {
|
|
7309
|
+
return path5.join(configDir(scope, options), "config.json");
|
|
7301
7310
|
}
|
|
7302
7311
|
|
|
7303
7312
|
// ../configuration-core/src/config.ts
|
|
7304
7313
|
import * as crypto from "node:crypto";
|
|
7305
7314
|
import * as fs3 from "node:fs";
|
|
7306
7315
|
import * as path6 from "node:path";
|
|
7307
|
-
function readConfigObject() {
|
|
7316
|
+
function readConfigObject(scope = "global", options = {}) {
|
|
7308
7317
|
try {
|
|
7309
|
-
const raw = fs3.readFileSync(configFilePath(), "utf8");
|
|
7318
|
+
const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
|
|
7310
7319
|
const json = JSON.parse(raw);
|
|
7311
|
-
if (json && typeof json === "object") {
|
|
7320
|
+
if (json && typeof json === "object" && !Array.isArray(json)) {
|
|
7312
7321
|
return json;
|
|
7313
7322
|
}
|
|
7314
7323
|
} catch {
|
|
7315
7324
|
}
|
|
7316
7325
|
return {};
|
|
7317
7326
|
}
|
|
7327
|
+
var FORBIDDEN_SEGMENTS = /* @__PURE__ */ new Set(["__proto__", "prototype", "constructor"]);
|
|
7328
|
+
function splitKey(dottedKey) {
|
|
7329
|
+
const parts = dottedKey.split(".");
|
|
7330
|
+
if (parts.length === 0 || parts.some((p) => p === "")) {
|
|
7331
|
+
throw new Error(`Invalid config key "${dottedKey}": empty path segment`);
|
|
7332
|
+
}
|
|
7333
|
+
for (const p of parts) {
|
|
7334
|
+
if (FORBIDDEN_SEGMENTS.has(p)) {
|
|
7335
|
+
throw new Error(`Invalid config key "${dottedKey}": forbidden segment "${p}"`);
|
|
7336
|
+
}
|
|
7337
|
+
}
|
|
7338
|
+
return parts;
|
|
7339
|
+
}
|
|
7340
|
+
function isPlainObject2(value) {
|
|
7341
|
+
return !!value && typeof value === "object" && !Array.isArray(value);
|
|
7342
|
+
}
|
|
7343
|
+
function getAtPath(obj, dottedKey) {
|
|
7344
|
+
const parts = splitKey(dottedKey);
|
|
7345
|
+
let cur = obj;
|
|
7346
|
+
for (const part of parts) {
|
|
7347
|
+
if (!isPlainObject2(cur)) return void 0;
|
|
7348
|
+
cur = cur[part];
|
|
7349
|
+
}
|
|
7350
|
+
return cur;
|
|
7351
|
+
}
|
|
7352
|
+
function setAtPath(obj, dottedKey, value) {
|
|
7353
|
+
const parts = splitKey(dottedKey);
|
|
7354
|
+
let cur = obj;
|
|
7355
|
+
for (let i2 = 0; i2 < parts.length - 1; i2++) {
|
|
7356
|
+
const part = parts[i2];
|
|
7357
|
+
const next = cur[part];
|
|
7358
|
+
if (!isPlainObject2(next)) {
|
|
7359
|
+
cur[part] = {};
|
|
7360
|
+
}
|
|
7361
|
+
cur = cur[part];
|
|
7362
|
+
}
|
|
7363
|
+
cur[parts[parts.length - 1]] = value;
|
|
7364
|
+
}
|
|
7365
|
+
function deleteAtPath(obj, dottedKey) {
|
|
7366
|
+
const parts = splitKey(dottedKey);
|
|
7367
|
+
let cur = obj;
|
|
7368
|
+
for (let i2 = 0; i2 < parts.length - 1; i2++) {
|
|
7369
|
+
const next = cur[parts[i2]];
|
|
7370
|
+
if (!isPlainObject2(next)) return false;
|
|
7371
|
+
cur = next;
|
|
7372
|
+
}
|
|
7373
|
+
const leaf = parts[parts.length - 1];
|
|
7374
|
+
if (!Object.hasOwn(cur, leaf)) return false;
|
|
7375
|
+
delete cur[leaf];
|
|
7376
|
+
return true;
|
|
7377
|
+
}
|
|
7318
7378
|
var LOCK_STALE_MS2 = 1e4;
|
|
7319
7379
|
var LOCK_MAX_WAIT_MS = 2e3;
|
|
7320
7380
|
var LOCK_RETRY_MS = 25;
|
|
7321
7381
|
function sleepSync(ms) {
|
|
7322
7382
|
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
7323
7383
|
}
|
|
7324
|
-
function acquireConfigLock() {
|
|
7325
|
-
const lockPath =
|
|
7384
|
+
function acquireConfigLock(finalPath) {
|
|
7385
|
+
const lockPath = finalPath + ".lock";
|
|
7326
7386
|
const deadline = Date.now() + LOCK_MAX_WAIT_MS;
|
|
7327
7387
|
for (; ; ) {
|
|
7328
7388
|
try {
|
|
@@ -7357,14 +7417,15 @@ function releaseConfigLock(lock) {
|
|
|
7357
7417
|
} catch {
|
|
7358
7418
|
}
|
|
7359
7419
|
}
|
|
7360
|
-
function updateConfig(mutate) {
|
|
7361
|
-
|
|
7362
|
-
|
|
7420
|
+
function updateConfig(mutate, scope = "global", options = {}) {
|
|
7421
|
+
const dir = configDir(scope, options);
|
|
7422
|
+
fs3.mkdirSync(dir, { recursive: true });
|
|
7423
|
+
const finalPath = configFilePath(scope, options);
|
|
7424
|
+
const lock = acquireConfigLock(finalPath);
|
|
7363
7425
|
try {
|
|
7364
|
-
const next = readConfigObject();
|
|
7426
|
+
const next = readConfigObject(scope, options);
|
|
7365
7427
|
mutate(next);
|
|
7366
|
-
const
|
|
7367
|
-
const tmpPath = path6.join(argentHomeDir(), `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
7428
|
+
const tmpPath = path6.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
|
|
7368
7429
|
const fd = fs3.openSync(tmpPath, "wx", 384);
|
|
7369
7430
|
try {
|
|
7370
7431
|
fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
|
|
@@ -7385,27 +7446,215 @@ function updateConfig(mutate) {
|
|
|
7385
7446
|
if (lock) releaseConfigLock(lock);
|
|
7386
7447
|
}
|
|
7387
7448
|
}
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7449
|
+
|
|
7450
|
+
// ../configuration-core/src/merge.ts
|
|
7451
|
+
function mergeRestrictive(local, global2) {
|
|
7452
|
+
if (local === void 0) return global2;
|
|
7453
|
+
if (global2 === void 0) return local;
|
|
7454
|
+
if (typeof local === "boolean" && typeof global2 === "boolean") {
|
|
7455
|
+
return local && global2;
|
|
7456
|
+
}
|
|
7457
|
+
if (typeof local === "number" && typeof global2 === "number") {
|
|
7458
|
+
return Math.min(local, global2);
|
|
7459
|
+
}
|
|
7460
|
+
return local;
|
|
7461
|
+
}
|
|
7462
|
+
function toArray(value) {
|
|
7463
|
+
return Array.isArray(value) ? value : null;
|
|
7464
|
+
}
|
|
7465
|
+
function mergeUnion(local, global2) {
|
|
7466
|
+
const l2 = toArray(local);
|
|
7467
|
+
const g = toArray(global2);
|
|
7468
|
+
if (l2 === null && g === null) return local ?? global2;
|
|
7469
|
+
const merged = [...g ?? [], ...l2 ?? []];
|
|
7470
|
+
return Array.from(new Set(merged));
|
|
7471
|
+
}
|
|
7472
|
+
function mergeIntersection(local, global2) {
|
|
7473
|
+
const l2 = toArray(local);
|
|
7474
|
+
const g = toArray(global2);
|
|
7475
|
+
if (l2 === null && g === null) return local ?? global2;
|
|
7476
|
+
if (l2 === null) return global2;
|
|
7477
|
+
if (g === null) return local;
|
|
7478
|
+
const globalSet = new Set(g);
|
|
7479
|
+
return l2.filter((item) => globalSet.has(item));
|
|
7480
|
+
}
|
|
7481
|
+
function applyMergePolicy(policy, local, global2) {
|
|
7482
|
+
if (typeof policy === "function") return policy({ local, global: global2 });
|
|
7483
|
+
switch (policy) {
|
|
7484
|
+
case "prioritize-local":
|
|
7485
|
+
return local ?? global2;
|
|
7486
|
+
case "prioritize-global":
|
|
7487
|
+
return global2 ?? local;
|
|
7488
|
+
case "prioritize-restrictive":
|
|
7489
|
+
return mergeRestrictive(local, global2);
|
|
7490
|
+
case "union":
|
|
7491
|
+
return mergeUnion(local, global2);
|
|
7492
|
+
case "intersection":
|
|
7493
|
+
return mergeIntersection(local, global2);
|
|
7494
|
+
default: {
|
|
7495
|
+
const _exhaustive = policy;
|
|
7496
|
+
return _exhaustive;
|
|
7497
|
+
}
|
|
7498
|
+
}
|
|
7499
|
+
}
|
|
7500
|
+
|
|
7501
|
+
// ../configuration-core/src/config-schema.ts
|
|
7502
|
+
function asBoolean(raw) {
|
|
7503
|
+
return typeof raw === "boolean" ? raw : void 0;
|
|
7504
|
+
}
|
|
7505
|
+
function asString(raw) {
|
|
7506
|
+
if (typeof raw !== "string") return void 0;
|
|
7507
|
+
const trimmed = raw.trim();
|
|
7508
|
+
return trimmed === "" ? void 0 : trimmed;
|
|
7391
7509
|
}
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7510
|
+
var CONFIG_SCHEMA = [
|
|
7511
|
+
{
|
|
7512
|
+
key: "telemetry.enabled",
|
|
7513
|
+
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).",
|
|
7514
|
+
scopes: ["global"],
|
|
7515
|
+
parse: asBoolean,
|
|
7516
|
+
// A committed project file must never re-enable telemetry a user disabled
|
|
7517
|
+
// globally, so the more-restrictive (opt-out) value always wins.
|
|
7518
|
+
merge: "prioritize-restrictive",
|
|
7519
|
+
// Telemetry is opt-out: with nothing stored, consent.ts treats it as
|
|
7520
|
+
// enabled, and the config surface must report the same instead of "(unset)".
|
|
7521
|
+
default: true,
|
|
7522
|
+
// Read-only under `argent config`: opt-in/out goes through the dedicated
|
|
7523
|
+
// command so the live client is drained/reset, not just the file rewritten.
|
|
7524
|
+
manageCommand: "argent telemetry"
|
|
7525
|
+
},
|
|
7526
|
+
{
|
|
7527
|
+
key: "lens.agent",
|
|
7528
|
+
description: "Coding-agent id remembered by `argent lens` to skip the picker.",
|
|
7529
|
+
scopes: ["project", "global"],
|
|
7530
|
+
parse: asString,
|
|
7531
|
+
// A repo can pin the agent its screenshots should use; falls back to the
|
|
7532
|
+
// user's global remembered choice.
|
|
7533
|
+
merge: "prioritize-local",
|
|
7534
|
+
example: "claude"
|
|
7535
|
+
}
|
|
7536
|
+
];
|
|
7537
|
+
function getConfigDefinition(key, registry = CONFIG_SCHEMA) {
|
|
7538
|
+
return registry.find((def) => def.key === key);
|
|
7395
7539
|
}
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7540
|
+
|
|
7541
|
+
// ../configuration-core/src/config-access.ts
|
|
7542
|
+
function readScopeValue(def, scope, options) {
|
|
7543
|
+
if (!def.scopes.includes(scope)) return void 0;
|
|
7544
|
+
const raw = getAtPath(readConfigObject(scope, options), def.key);
|
|
7545
|
+
return raw === void 0 ? void 0 : def.parse(raw);
|
|
7402
7546
|
}
|
|
7403
|
-
function
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7547
|
+
function getConfigValue(def, options = {}) {
|
|
7548
|
+
const local = readScopeValue(def, "project", options);
|
|
7549
|
+
const global2 = readScopeValue(def, "global", options);
|
|
7550
|
+
const merged = applyMergePolicy(def.merge, local, global2);
|
|
7551
|
+
return merged ?? def.default;
|
|
7552
|
+
}
|
|
7553
|
+
function getConfigValueAtScope(key, scope, options = {}, registry = CONFIG_SCHEMA) {
|
|
7554
|
+
const def = requireDefinition(key, registry);
|
|
7555
|
+
return readScopeValue(def, scope, options);
|
|
7556
|
+
}
|
|
7557
|
+
function getConfigValueByKey(key, options = {}, registry = CONFIG_SCHEMA) {
|
|
7558
|
+
const def = requireDefinition(key, registry);
|
|
7559
|
+
return getConfigValue(def, options);
|
|
7560
|
+
}
|
|
7561
|
+
function requireDefinition(key, registry = CONFIG_SCHEMA) {
|
|
7562
|
+
const def = getConfigDefinition(key, registry);
|
|
7563
|
+
if (!def) {
|
|
7564
|
+
throw new UnknownConfigKeyError(key);
|
|
7565
|
+
}
|
|
7566
|
+
return def;
|
|
7567
|
+
}
|
|
7568
|
+
var UnknownConfigKeyError = class extends Error {
|
|
7569
|
+
constructor(key) {
|
|
7570
|
+
super(`Unknown configuration key "${key}".`);
|
|
7571
|
+
this.key = key;
|
|
7572
|
+
this.name = "UnknownConfigKeyError";
|
|
7573
|
+
}
|
|
7574
|
+
key;
|
|
7575
|
+
};
|
|
7576
|
+
var ConfigScopeError = class extends Error {
|
|
7577
|
+
constructor(key, scope, allowed) {
|
|
7578
|
+
super(`Config key "${key}" cannot be set at ${scope} scope (allowed: ${allowed.join(", ")}).`);
|
|
7579
|
+
this.key = key;
|
|
7580
|
+
this.scope = scope;
|
|
7581
|
+
this.allowed = allowed;
|
|
7582
|
+
this.name = "ConfigScopeError";
|
|
7583
|
+
}
|
|
7584
|
+
key;
|
|
7585
|
+
scope;
|
|
7586
|
+
allowed;
|
|
7587
|
+
};
|
|
7588
|
+
var ConfigValidationError = class extends Error {
|
|
7589
|
+
constructor(key) {
|
|
7590
|
+
super(`Invalid value for config key "${key}".`);
|
|
7591
|
+
this.key = key;
|
|
7592
|
+
this.name = "ConfigValidationError";
|
|
7593
|
+
}
|
|
7594
|
+
key;
|
|
7595
|
+
};
|
|
7596
|
+
var ConfigManagedElsewhereError = class extends Error {
|
|
7597
|
+
constructor(key, command) {
|
|
7598
|
+
super(`Config key "${key}" is managed by \`${command}\`.`);
|
|
7599
|
+
this.key = key;
|
|
7600
|
+
this.command = command;
|
|
7601
|
+
this.name = "ConfigManagedElsewhereError";
|
|
7602
|
+
}
|
|
7603
|
+
key;
|
|
7604
|
+
command;
|
|
7605
|
+
};
|
|
7606
|
+
function setConfigValue(key, rawValue, scope = "global", options = {}, registry = CONFIG_SCHEMA) {
|
|
7607
|
+
const def = requireDefinition(key, registry);
|
|
7608
|
+
if (def.manageCommand) throw new ConfigManagedElsewhereError(key, def.manageCommand);
|
|
7609
|
+
if (!def.scopes.includes(scope)) throw new ConfigScopeError(key, scope, def.scopes);
|
|
7610
|
+
const parsed = def.parse(rawValue);
|
|
7611
|
+
if (parsed === void 0) throw new ConfigValidationError(key);
|
|
7612
|
+
updateConfig((config2) => setAtPath(config2, key, parsed), scope, options);
|
|
7613
|
+
return parsed;
|
|
7614
|
+
}
|
|
7615
|
+
function unsetConfigValue(key, scope = "global", options = {}, registry = CONFIG_SCHEMA) {
|
|
7616
|
+
const def = requireDefinition(key, registry);
|
|
7617
|
+
if (def.manageCommand) throw new ConfigManagedElsewhereError(key, def.manageCommand);
|
|
7618
|
+
if (!def.scopes.includes(scope)) throw new ConfigScopeError(key, scope, def.scopes);
|
|
7619
|
+
if (getAtPath(readConfigObject(scope, options), key) === void 0) return false;
|
|
7620
|
+
let removed = false;
|
|
7621
|
+
updateConfig(
|
|
7622
|
+
(config2) => {
|
|
7623
|
+
removed = deleteAtPath(config2, key);
|
|
7624
|
+
},
|
|
7625
|
+
scope,
|
|
7626
|
+
options
|
|
7627
|
+
);
|
|
7628
|
+
return removed;
|
|
7629
|
+
}
|
|
7630
|
+
function listConfig(options = {}, registry = CONFIG_SCHEMA) {
|
|
7631
|
+
return registry.map((def) => ({
|
|
7632
|
+
key: def.key,
|
|
7633
|
+
description: def.description,
|
|
7634
|
+
scopes: def.scopes,
|
|
7635
|
+
...def.manageCommand ? { manageCommand: def.manageCommand } : {},
|
|
7636
|
+
effective: getConfigValue(def, options),
|
|
7637
|
+
project: readScopeValue(def, "project", options),
|
|
7638
|
+
global: readScopeValue(def, "global", options)
|
|
7639
|
+
}));
|
|
7640
|
+
}
|
|
7641
|
+
function coerceCliValue(raw) {
|
|
7642
|
+
try {
|
|
7643
|
+
return JSON.parse(raw);
|
|
7644
|
+
} catch {
|
|
7645
|
+
return raw;
|
|
7646
|
+
}
|
|
7647
|
+
}
|
|
7648
|
+
var LENS_AGENT_KEY = "lens.agent";
|
|
7649
|
+
function getRememberedAgent(options = {}) {
|
|
7650
|
+
const value = getConfigValueByKey(LENS_AGENT_KEY, options);
|
|
7651
|
+
return typeof value === "string" && value.trim() ? value : null;
|
|
7652
|
+
}
|
|
7653
|
+
function setRememberedAgent(agentId, options = {}) {
|
|
7654
|
+
setConfigValue(LENS_AGENT_KEY, agentId, "global", options);
|
|
7655
|
+
}
|
|
7656
|
+
function clearRememberedAgent(options = {}) {
|
|
7657
|
+
unsetConfigValue(LENS_AGENT_KEY, "global", options);
|
|
7409
7658
|
}
|
|
7410
7659
|
|
|
7411
7660
|
// ../telemetry/src/paths.ts
|
|
@@ -7692,12 +7941,12 @@ function resolveHostFingerprint() {
|
|
|
7692
7941
|
}
|
|
7693
7942
|
}
|
|
7694
7943
|
function resolveHostFingerprintAsync() {
|
|
7695
|
-
return new Promise((
|
|
7944
|
+
return new Promise((resolve7) => {
|
|
7696
7945
|
let binary;
|
|
7697
7946
|
try {
|
|
7698
7947
|
binary = simulatorServerBinaryPath();
|
|
7699
7948
|
} catch {
|
|
7700
|
-
|
|
7949
|
+
resolve7(null);
|
|
7701
7950
|
return;
|
|
7702
7951
|
}
|
|
7703
7952
|
let settled = false;
|
|
@@ -7710,7 +7959,7 @@ function resolveHostFingerprintAsync() {
|
|
|
7710
7959
|
child?.kill("SIGKILL");
|
|
7711
7960
|
} catch {
|
|
7712
7961
|
}
|
|
7713
|
-
|
|
7962
|
+
resolve7(value);
|
|
7714
7963
|
};
|
|
7715
7964
|
const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
|
|
7716
7965
|
watchdog.unref?.();
|
|
@@ -7822,9 +8071,9 @@ function isEnabled(env = process.env) {
|
|
|
7822
8071
|
return getConsentState(env).enabled;
|
|
7823
8072
|
}
|
|
7824
8073
|
function writeConsentFlag(enabled) {
|
|
7825
|
-
updateConfig((
|
|
7826
|
-
const telemetryBlock = typeof
|
|
7827
|
-
|
|
8074
|
+
updateConfig((config2) => {
|
|
8075
|
+
const telemetryBlock = typeof config2.telemetry === "object" && config2.telemetry ? config2.telemetry : {};
|
|
8076
|
+
config2.telemetry = { ...telemetryBlock, enabled };
|
|
7828
8077
|
});
|
|
7829
8078
|
cache.current = null;
|
|
7830
8079
|
}
|
|
@@ -7952,7 +8201,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
|
|
|
7952
8201
|
try {
|
|
7953
8202
|
await Promise.race([
|
|
7954
8203
|
client2.shutdown(timeoutMs),
|
|
7955
|
-
new Promise((
|
|
8204
|
+
new Promise((resolve7) => setTimeout(resolve7, timeoutMs + 250).unref())
|
|
7956
8205
|
]);
|
|
7957
8206
|
} catch (err) {
|
|
7958
8207
|
emitDebugError("shutdown failed", err);
|
|
@@ -7972,7 +8221,7 @@ async function markDisabled() {
|
|
|
7972
8221
|
try {
|
|
7973
8222
|
await Promise.race([
|
|
7974
8223
|
client2.shutdown(SHORT_FLUSH_TIMEOUT_MS),
|
|
7975
|
-
new Promise((
|
|
8224
|
+
new Promise((resolve7) => setTimeout(resolve7, SHORT_FLUSH_TIMEOUT_MS).unref())
|
|
7976
8225
|
]);
|
|
7977
8226
|
} catch {
|
|
7978
8227
|
}
|
|
@@ -7988,14 +8237,14 @@ function status() {
|
|
|
7988
8237
|
const anonId = peekAnonId();
|
|
7989
8238
|
const hasAnonIdOnDisk = anonId !== null;
|
|
7990
8239
|
const anonIdPrefix = anonId ? anonId.slice(0, 8) : null;
|
|
7991
|
-
const
|
|
8240
|
+
const config2 = resolveConfig();
|
|
7992
8241
|
return {
|
|
7993
8242
|
enabled: consent.enabled,
|
|
7994
8243
|
source: consent.source,
|
|
7995
8244
|
anonIdPrefix,
|
|
7996
8245
|
hasAnonIdOnDisk,
|
|
7997
8246
|
host: POSTHOG_HOST,
|
|
7998
|
-
isKeyConfigured:
|
|
8247
|
+
isKeyConfigured: config2.isUsable
|
|
7999
8248
|
};
|
|
8000
8249
|
}
|
|
8001
8250
|
|
|
@@ -8214,13 +8463,13 @@ function splitOptions(argv) {
|
|
|
8214
8463
|
return { json, outPath, argvForFlags: rest };
|
|
8215
8464
|
}
|
|
8216
8465
|
async function readStdin() {
|
|
8217
|
-
return new Promise((
|
|
8466
|
+
return new Promise((resolve7, reject) => {
|
|
8218
8467
|
let data = "";
|
|
8219
8468
|
process.stdin.setEncoding("utf8");
|
|
8220
8469
|
process.stdin.on("data", (chunk) => {
|
|
8221
8470
|
data += chunk;
|
|
8222
8471
|
});
|
|
8223
|
-
process.stdin.on("end", () =>
|
|
8472
|
+
process.stdin.on("end", () => resolve7(data));
|
|
8224
8473
|
process.stdin.on("error", reject);
|
|
8225
8474
|
});
|
|
8226
8475
|
}
|
|
@@ -8582,7 +8831,7 @@ function resolveArtifactDisplayPaths(report) {
|
|
|
8582
8831
|
}
|
|
8583
8832
|
function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
|
|
8584
8833
|
return Promise.all(
|
|
8585
|
-
streams.map((s) => new Promise((
|
|
8834
|
+
streams.map((s) => new Promise((resolve7) => s.write("", () => resolve7())))
|
|
8586
8835
|
).then(() => process.exit(code));
|
|
8587
8836
|
}
|
|
8588
8837
|
function renderReport(report) {
|
|
@@ -9467,7 +9716,7 @@ function ptyInjectBeats(text2) {
|
|
|
9467
9716
|
];
|
|
9468
9717
|
}
|
|
9469
9718
|
function sleep(ms) {
|
|
9470
|
-
return new Promise((
|
|
9719
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
9471
9720
|
}
|
|
9472
9721
|
var DEFAULT_COLS = 80;
|
|
9473
9722
|
var DEFAULT_ROWS = 24;
|
|
@@ -9688,7 +9937,7 @@ var SPAWN_GRACE_MS = 8e3;
|
|
|
9688
9937
|
var DEATH_CONFIRMATIONS = 3;
|
|
9689
9938
|
var SSE_RECONNECT_MS = 1e3;
|
|
9690
9939
|
function sleep2(ms) {
|
|
9691
|
-
return new Promise((
|
|
9940
|
+
return new Promise((resolve7) => setTimeout(resolve7, ms));
|
|
9692
9941
|
}
|
|
9693
9942
|
var TRUST_PROMPT_RE = /trust this folder|do you trust|yes,? i trust|trust the files in this/i;
|
|
9694
9943
|
async function dismissTrustPrompt(session) {
|
|
@@ -10334,8 +10583,8 @@ Options:
|
|
|
10334
10583
|
console.log("Feature flags (project overrides global):");
|
|
10335
10584
|
const maxName = registryView.reduce((m, f) => Math.max(m, f.name.length), 0);
|
|
10336
10585
|
for (const f of registryView) {
|
|
10337
|
-
const
|
|
10338
|
-
console.log(` ${f.name.padEnd(maxName, " ")} ${colorState(f.enabled)}${
|
|
10586
|
+
const scopeLabel2 = f.scope ? ` (${f.scope})` : "";
|
|
10587
|
+
console.log(` ${f.name.padEnd(maxName, " ")} ${colorState(f.enabled)}${scopeLabel2}`);
|
|
10339
10588
|
console.log(` ${" ".repeat(maxName)} ${f.description}`);
|
|
10340
10589
|
}
|
|
10341
10590
|
}
|
|
@@ -10351,6 +10600,254 @@ Options:
|
|
|
10351
10600
|
console.log(` Project: ${getFlagsPath("project")}`);
|
|
10352
10601
|
}
|
|
10353
10602
|
|
|
10603
|
+
// ../argent-cli/src/config.ts
|
|
10604
|
+
var import_picocolors2 = __toESM(require_picocolors(), 1);
|
|
10605
|
+
import * as path14 from "node:path";
|
|
10606
|
+
function config(argv) {
|
|
10607
|
+
if (argv.length === 0 || argv[0] === "--help" || argv[0] === "-h") {
|
|
10608
|
+
printUsage();
|
|
10609
|
+
return;
|
|
10610
|
+
}
|
|
10611
|
+
const [sub, ...rest] = argv;
|
|
10612
|
+
switch (sub) {
|
|
10613
|
+
case "list":
|
|
10614
|
+
return cmdList(rest);
|
|
10615
|
+
case "get":
|
|
10616
|
+
return cmdGet(rest);
|
|
10617
|
+
case "set":
|
|
10618
|
+
return cmdSet(rest);
|
|
10619
|
+
case "unset":
|
|
10620
|
+
return cmdUnset(rest);
|
|
10621
|
+
default:
|
|
10622
|
+
console.error(`Error: unknown subcommand "config ${sub}". Try \`argent config --help\`.`);
|
|
10623
|
+
process.exit(2);
|
|
10624
|
+
}
|
|
10625
|
+
}
|
|
10626
|
+
function cmdList(argv) {
|
|
10627
|
+
if (wantsHelp(argv)) {
|
|
10628
|
+
console.log(`Usage: argent config list [--json]
|
|
10629
|
+
|
|
10630
|
+
Show every recognized configuration value, its effective (merged) value, and
|
|
10631
|
+
the raw value stored at each scope.`);
|
|
10632
|
+
return;
|
|
10633
|
+
}
|
|
10634
|
+
const json = argv.includes("--json");
|
|
10635
|
+
const entries = listConfig();
|
|
10636
|
+
if (json) {
|
|
10637
|
+
console.log(JSON.stringify({ config: entries }, null, 2));
|
|
10638
|
+
return;
|
|
10639
|
+
}
|
|
10640
|
+
if (entries.length === 0) {
|
|
10641
|
+
console.log("No configurations are defined.");
|
|
10642
|
+
return;
|
|
10643
|
+
}
|
|
10644
|
+
console.log("Configuration (project overrides global unless noted):\n");
|
|
10645
|
+
const maxKey = entries.reduce((m, e) => Math.max(m, e.key.length), 0);
|
|
10646
|
+
for (const e of entries) {
|
|
10647
|
+
const managed = e.manageCommand ? import_picocolors2.default.dim(` [managed by \`${e.manageCommand}\`]`) : "";
|
|
10648
|
+
console.log(` ${e.key.padEnd(maxKey)} ${formatValue(e.effective)}${managed}`);
|
|
10649
|
+
console.log(` ${" ".repeat(maxKey)} ${import_picocolors2.default.dim(e.description)}`);
|
|
10650
|
+
console.log(` ${" ".repeat(maxKey)} ${import_picocolors2.default.dim(scopeDetail(e))}`);
|
|
10651
|
+
}
|
|
10652
|
+
}
|
|
10653
|
+
function scopeDetail(e) {
|
|
10654
|
+
const parts = [`scopes: ${e.scopes.join(", ")}`];
|
|
10655
|
+
if (e.project !== void 0) parts.push(`project=${formatValuePlain(e.project)}`);
|
|
10656
|
+
if (e.global !== void 0) parts.push(`global=${formatValuePlain(e.global)}`);
|
|
10657
|
+
return parts.join(" \xB7 ");
|
|
10658
|
+
}
|
|
10659
|
+
function cmdGet(argv) {
|
|
10660
|
+
if (wantsHelp(argv)) {
|
|
10661
|
+
console.log(`Usage: argent config get <key> [--scope global|project] [--json]
|
|
10662
|
+
|
|
10663
|
+
Print a configuration value. Without --scope, prints the effective value after
|
|
10664
|
+
merging project and global. With --scope, prints only that scope's stored value.`);
|
|
10665
|
+
return;
|
|
10666
|
+
}
|
|
10667
|
+
const { positionals, scope, json } = parseArgs2(argv);
|
|
10668
|
+
const key = positionals[0];
|
|
10669
|
+
if (!key) {
|
|
10670
|
+
console.error("Error: `argent config get` requires a <key>.");
|
|
10671
|
+
process.exit(2);
|
|
10672
|
+
}
|
|
10673
|
+
if (positionals.length > 1) {
|
|
10674
|
+
console.error(`Error: unexpected extra argument "${positionals[1]}".`);
|
|
10675
|
+
process.exit(2);
|
|
10676
|
+
}
|
|
10677
|
+
try {
|
|
10678
|
+
const value = scope ? getConfigValueAtScope(key, scope) : getConfigValueByKey(key);
|
|
10679
|
+
if (json) {
|
|
10680
|
+
console.log(
|
|
10681
|
+
JSON.stringify({ key, scope: scope ?? "effective", value: value ?? null }, null, 2)
|
|
10682
|
+
);
|
|
10683
|
+
} else if (value === void 0) {
|
|
10684
|
+
console.log("(unset)");
|
|
10685
|
+
} else {
|
|
10686
|
+
console.log(formatValuePlain(value));
|
|
10687
|
+
}
|
|
10688
|
+
} catch (err) {
|
|
10689
|
+
reportError(err);
|
|
10690
|
+
}
|
|
10691
|
+
}
|
|
10692
|
+
function cmdSet(argv) {
|
|
10693
|
+
if (wantsHelp(argv)) {
|
|
10694
|
+
console.log(`Usage: argent config set <key> <value> [--scope global|project]
|
|
10695
|
+
|
|
10696
|
+
Set a configuration value. Default scope is global; pass --scope project to
|
|
10697
|
+
write <project-root>/.argent/config.json. Booleans, numbers, and JSON arrays are
|
|
10698
|
+
parsed (e.g. \`true\`, \`42\`, \`["a","b"]\`); anything else is stored as a string.`);
|
|
10699
|
+
return;
|
|
10700
|
+
}
|
|
10701
|
+
const { positionals, scope } = parseArgs2(argv);
|
|
10702
|
+
const key = positionals[0];
|
|
10703
|
+
const rawValue = positionals[1];
|
|
10704
|
+
if (!key || rawValue === void 0) {
|
|
10705
|
+
console.error("Error: `argent config set` requires a <key> and a <value>.");
|
|
10706
|
+
process.exit(2);
|
|
10707
|
+
}
|
|
10708
|
+
if (positionals.length > 2) {
|
|
10709
|
+
console.error(`Error: unexpected extra argument "${positionals[2]}".`);
|
|
10710
|
+
process.exit(2);
|
|
10711
|
+
}
|
|
10712
|
+
const targetScope = scope ?? "global";
|
|
10713
|
+
const warning = degenerateProjectScopeWarning(targetScope);
|
|
10714
|
+
try {
|
|
10715
|
+
const stored = setConfigValue(key, coerceCliValue(rawValue), targetScope);
|
|
10716
|
+
if (warning) console.error(import_picocolors2.default.yellow(warning));
|
|
10717
|
+
console.log(`Set ${import_picocolors2.default.bold(key)} = ${formatValuePlain(stored)} (${scopeLabel(targetScope)}).`);
|
|
10718
|
+
} catch (err) {
|
|
10719
|
+
reportError(err);
|
|
10720
|
+
}
|
|
10721
|
+
}
|
|
10722
|
+
function cmdUnset(argv) {
|
|
10723
|
+
if (wantsHelp(argv)) {
|
|
10724
|
+
console.log(`Usage: argent config unset <key> [--scope global|project]
|
|
10725
|
+
|
|
10726
|
+
Remove a configuration value at a scope (default global). Falls back to the
|
|
10727
|
+
other scope / the default on the next read.`);
|
|
10728
|
+
return;
|
|
10729
|
+
}
|
|
10730
|
+
const { positionals, scope } = parseArgs2(argv);
|
|
10731
|
+
const key = positionals[0];
|
|
10732
|
+
if (!key) {
|
|
10733
|
+
console.error("Error: `argent config unset` requires a <key>.");
|
|
10734
|
+
process.exit(2);
|
|
10735
|
+
}
|
|
10736
|
+
if (positionals.length > 1) {
|
|
10737
|
+
console.error(`Error: unexpected extra argument "${positionals[1]}".`);
|
|
10738
|
+
process.exit(2);
|
|
10739
|
+
}
|
|
10740
|
+
const targetScope = scope ?? "global";
|
|
10741
|
+
const warning = degenerateProjectScopeWarning(targetScope);
|
|
10742
|
+
try {
|
|
10743
|
+
const removed = unsetConfigValue(key, targetScope);
|
|
10744
|
+
if (removed && warning) console.error(import_picocolors2.default.yellow(warning));
|
|
10745
|
+
console.log(
|
|
10746
|
+
removed ? `Unset ${import_picocolors2.default.bold(key)} (${scopeLabel(targetScope)}).` : import_picocolors2.default.dim(`${key} was not set at ${targetScope} scope.`)
|
|
10747
|
+
);
|
|
10748
|
+
} catch (err) {
|
|
10749
|
+
reportError(err);
|
|
10750
|
+
}
|
|
10751
|
+
}
|
|
10752
|
+
function parseArgs2(argv) {
|
|
10753
|
+
const positionals = [];
|
|
10754
|
+
let scope = null;
|
|
10755
|
+
let json = false;
|
|
10756
|
+
for (let i2 = 0; i2 < argv.length; i2++) {
|
|
10757
|
+
const tok = argv[i2];
|
|
10758
|
+
if (tok === "--json") {
|
|
10759
|
+
json = true;
|
|
10760
|
+
continue;
|
|
10761
|
+
}
|
|
10762
|
+
if (tok === "--scope") {
|
|
10763
|
+
scope = parseScope2(argv[++i2]);
|
|
10764
|
+
continue;
|
|
10765
|
+
}
|
|
10766
|
+
if (tok.startsWith("--scope=")) {
|
|
10767
|
+
scope = parseScope2(tok.slice("--scope=".length));
|
|
10768
|
+
continue;
|
|
10769
|
+
}
|
|
10770
|
+
if (tok.startsWith("--")) {
|
|
10771
|
+
console.error(`Error: unknown flag "${tok}".`);
|
|
10772
|
+
process.exit(2);
|
|
10773
|
+
}
|
|
10774
|
+
positionals.push(tok);
|
|
10775
|
+
}
|
|
10776
|
+
return { positionals, scope, json };
|
|
10777
|
+
}
|
|
10778
|
+
function parseScope2(raw) {
|
|
10779
|
+
if (raw === "global" || raw === "project") return raw;
|
|
10780
|
+
console.error(`Error: --scope must be "global" or "project"${raw ? `, got "${raw}"` : ""}.`);
|
|
10781
|
+
process.exit(2);
|
|
10782
|
+
}
|
|
10783
|
+
function wantsHelp(argv) {
|
|
10784
|
+
return argv.includes("--help") || argv.includes("-h");
|
|
10785
|
+
}
|
|
10786
|
+
function scopeLabel(scope) {
|
|
10787
|
+
if (scope === "global") return "global";
|
|
10788
|
+
return `project: ${path14.dirname(configDir("project"))}`;
|
|
10789
|
+
}
|
|
10790
|
+
function degenerateProjectScopeWarning(scope) {
|
|
10791
|
+
if (scope !== "project") return null;
|
|
10792
|
+
const projDir = configDir("project");
|
|
10793
|
+
if (path14.resolve(projDir) === path14.resolve(configDir("global"))) {
|
|
10794
|
+
return `WARNING: no project found between ${process.cwd()} and your home directory \u2014 "project" scope resolved to the home directory, so this writes the GLOBAL config file (${path14.join(projDir, "config.json")}).`;
|
|
10795
|
+
}
|
|
10796
|
+
if (findProjectRoot(process.cwd()) === null) {
|
|
10797
|
+
return `WARNING: no project markers (.argent, .git, package.json) found above ${process.cwd()} \u2014 treating it as the project root and creating ${path14.join(projDir, "config.json")}.`;
|
|
10798
|
+
}
|
|
10799
|
+
return null;
|
|
10800
|
+
}
|
|
10801
|
+
function formatValuePlain(value) {
|
|
10802
|
+
if (typeof value === "string") return value;
|
|
10803
|
+
return JSON.stringify(value);
|
|
10804
|
+
}
|
|
10805
|
+
function formatValue(value) {
|
|
10806
|
+
if (value === void 0) return import_picocolors2.default.dim("(unset)");
|
|
10807
|
+
if (typeof value === "boolean" && process.stdout.isTTY) {
|
|
10808
|
+
return value ? import_picocolors2.default.green("true") : import_picocolors2.default.red("false");
|
|
10809
|
+
}
|
|
10810
|
+
return formatValuePlain(value);
|
|
10811
|
+
}
|
|
10812
|
+
function reportError(err) {
|
|
10813
|
+
if (err instanceof ConfigManagedElsewhereError) {
|
|
10814
|
+
console.error(`Error: ${err.message} Use \`${err.command}\` instead.`);
|
|
10815
|
+
} else if (err instanceof UnknownConfigKeyError || err instanceof ConfigScopeError || err instanceof ConfigValidationError) {
|
|
10816
|
+
console.error(`Error: ${err.message}`);
|
|
10817
|
+
if (err instanceof UnknownConfigKeyError) {
|
|
10818
|
+
console.error(`Run \`argent config list\` to see available keys.`);
|
|
10819
|
+
}
|
|
10820
|
+
} else {
|
|
10821
|
+
console.error(`Error: ${err instanceof Error ? err.message : String(err)}`);
|
|
10822
|
+
}
|
|
10823
|
+
process.exit(2);
|
|
10824
|
+
}
|
|
10825
|
+
function printUsage() {
|
|
10826
|
+
const keys = CONFIG_SCHEMA.map((d) => d.key);
|
|
10827
|
+
const maxKey = keys.reduce((m, k) => Math.max(m, k.length), 0);
|
|
10828
|
+
const keyLines = CONFIG_SCHEMA.map((d) => {
|
|
10829
|
+
const managed = d.manageCommand ? import_picocolors2.default.dim(` [managed by \`${d.manageCommand}\`]`) : "";
|
|
10830
|
+
return ` ${d.key.padEnd(maxKey)} ${d.description}${managed}`;
|
|
10831
|
+
});
|
|
10832
|
+
console.log(`Usage: argent config <command> [options]
|
|
10833
|
+
|
|
10834
|
+
Manage argent configuration. Values are stored at two scopes and merged per the
|
|
10835
|
+
configuration's policy:
|
|
10836
|
+
~/.argent/config.json (global, default)
|
|
10837
|
+
<project-root>/.argent/config.json (project, with --scope project)
|
|
10838
|
+
|
|
10839
|
+
Commands:
|
|
10840
|
+
list Show all configurations and their values
|
|
10841
|
+
get <key> Print a value (effective, or --scope <scope>)
|
|
10842
|
+
set <key> <value> Set a value (--scope global|project, default global)
|
|
10843
|
+
unset <key> Remove a value at a scope (default global)
|
|
10844
|
+
|
|
10845
|
+
Recognized keys:
|
|
10846
|
+
${keyLines.join("\n")}
|
|
10847
|
+
|
|
10848
|
+
Run \`argent config <command> --help\` for command-specific help.`);
|
|
10849
|
+
}
|
|
10850
|
+
|
|
10354
10851
|
// ../../node_modules/@clack/core/dist/index.mjs
|
|
10355
10852
|
import { styleText } from "node:util";
|
|
10356
10853
|
import { stdout, stdin } from "node:process";
|
|
@@ -11071,7 +11568,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
|
|
|
11071
11568
|
import process$1 from "node:process";
|
|
11072
11569
|
var import_sisteransi2 = __toESM(require_src(), 1);
|
|
11073
11570
|
import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
|
|
11074
|
-
import { dirname as
|
|
11571
|
+
import { dirname as dirname9, join as join17 } from "node:path";
|
|
11075
11572
|
function isUnicodeSupported() {
|
|
11076
11573
|
if (process$1.platform !== "win32") {
|
|
11077
11574
|
return process$1.env.TERM !== "linux";
|
|
@@ -11508,7 +12005,7 @@ ${r2}
|
|
|
11508
12005
|
}).prompt();
|
|
11509
12006
|
|
|
11510
12007
|
// ../argent-cli/src/link.ts
|
|
11511
|
-
var
|
|
12008
|
+
var import_picocolors3 = __toESM(require_picocolors(), 1);
|
|
11512
12009
|
var WILDCARD_HOSTS = /* @__PURE__ */ new Set(["0.0.0.0", "::", "::0", ""]);
|
|
11513
12010
|
function isLoopback2(host) {
|
|
11514
12011
|
return host === "127.0.0.1" || host === "localhost" || host === "::1";
|
|
@@ -11766,7 +12263,7 @@ async function preflightHealth(url, token) {
|
|
|
11766
12263
|
}
|
|
11767
12264
|
function printRestartHint() {
|
|
11768
12265
|
console.log(
|
|
11769
|
-
|
|
12266
|
+
import_picocolors3.default.dim("Restart your editor to apply the change to any running `argent mcp` session.")
|
|
11770
12267
|
);
|
|
11771
12268
|
}
|
|
11772
12269
|
function printSecurityCaveat(host, token, url) {
|
|
@@ -11775,7 +12272,7 @@ function printSecurityCaveat(host, token, url) {
|
|
|
11775
12272
|
if (tls) {
|
|
11776
12273
|
if (!token) {
|
|
11777
12274
|
process.stderr.write(
|
|
11778
|
-
|
|
12275
|
+
import_picocolors3.default.yellow(
|
|
11779
12276
|
`WARNING: ${host} is reached over HTTPS but with NO token \u2014 anyone who can reach the URL can drive the server. Pair with a token.
|
|
11780
12277
|
`
|
|
11781
12278
|
)
|
|
@@ -11785,7 +12282,7 @@ function printSecurityCaveat(host, token, url) {
|
|
|
11785
12282
|
}
|
|
11786
12283
|
if (token) {
|
|
11787
12284
|
process.stderr.write(
|
|
11788
|
-
|
|
12285
|
+
import_picocolors3.default.dim(
|
|
11789
12286
|
`Note: ${host} is reached over plain HTTP (bearer-token auth, no TLS). Keep this link to a trusted network or VPN, or front it with an https:// tunnel.
|
|
11790
12287
|
`
|
|
11791
12288
|
)
|
|
@@ -11793,7 +12290,7 @@ function printSecurityCaveat(host, token, url) {
|
|
|
11793
12290
|
return;
|
|
11794
12291
|
}
|
|
11795
12292
|
process.stderr.write(
|
|
11796
|
-
|
|
12293
|
+
import_picocolors3.default.yellow(
|
|
11797
12294
|
`WARNING: linked target ${host} is non-loopback and has NO token \u2014 tool calls travel over plain HTTP with no auth. Treat this link as trusted-network-only, or pair with a token (start the server without --no-auth).
|
|
11798
12295
|
`
|
|
11799
12296
|
)
|
|
@@ -11826,9 +12323,9 @@ async function link(argv) {
|
|
|
11826
12323
|
if (flags2.host !== null) {
|
|
11827
12324
|
host = flags2.host;
|
|
11828
12325
|
} else {
|
|
11829
|
-
intro(
|
|
12326
|
+
intro(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" argent link ")));
|
|
11830
12327
|
if (existing) {
|
|
11831
|
-
log.info(`Current link: ${
|
|
12328
|
+
log.info(`Current link: ${import_picocolors3.default.cyan(existing.url)} (${existing.createdAt})`);
|
|
11832
12329
|
}
|
|
11833
12330
|
host = await promptHost(existing);
|
|
11834
12331
|
}
|
|
@@ -11844,12 +12341,12 @@ async function link(argv) {
|
|
|
11844
12341
|
let url = flags2.url ?? formatUrl(host, port);
|
|
11845
12342
|
if (!flags2.yes && existing) {
|
|
11846
12343
|
if (existing.url === url) {
|
|
11847
|
-
log.info(`Already linked to ${
|
|
12344
|
+
log.info(`Already linked to ${import_picocolors3.default.cyan(url)}.`);
|
|
11848
12345
|
outro("No changes.");
|
|
11849
12346
|
return;
|
|
11850
12347
|
}
|
|
11851
12348
|
const overwrite = await confirm({
|
|
11852
|
-
message: `Replace existing link ${
|
|
12349
|
+
message: `Replace existing link ${import_picocolors3.default.dim(existing.url)} with ${import_picocolors3.default.cyan(url)}?`,
|
|
11853
12350
|
initialValue: true
|
|
11854
12351
|
});
|
|
11855
12352
|
if (isCancel(overwrite) || !overwrite) {
|
|
@@ -11867,10 +12364,10 @@ async function link(argv) {
|
|
|
11867
12364
|
}
|
|
11868
12365
|
const result = await preflightHealth(url, token);
|
|
11869
12366
|
if (result.ok) {
|
|
11870
|
-
if (spinner2) spinner2.stop(
|
|
12367
|
+
if (spinner2) spinner2.stop(import_picocolors3.default.green("Tool-server reachable."));
|
|
11871
12368
|
break;
|
|
11872
12369
|
}
|
|
11873
|
-
if (spinner2) spinner2.stop(
|
|
12370
|
+
if (spinner2) spinner2.stop(import_picocolors3.default.red("Verification failed."));
|
|
11874
12371
|
const detail = result.error ? ` (${result.error})` : "";
|
|
11875
12372
|
if (flags2.yes) {
|
|
11876
12373
|
console.error(
|
|
@@ -11910,15 +12407,15 @@ async function link(argv) {
|
|
|
11910
12407
|
};
|
|
11911
12408
|
await writeLinkConfig(cfg);
|
|
11912
12409
|
if (existing && existing.url !== url) {
|
|
11913
|
-
console.log(`${
|
|
12410
|
+
console.log(`${import_picocolors3.default.green("\u2713")} Link updated: ${import_picocolors3.default.dim(existing.url)} \u2192 ${import_picocolors3.default.cyan(url)}`);
|
|
11914
12411
|
} else {
|
|
11915
|
-
console.log(`${
|
|
12412
|
+
console.log(`${import_picocolors3.default.green("\u2713")} Linked: ${import_picocolors3.default.cyan(url)}`);
|
|
11916
12413
|
}
|
|
11917
|
-
if (token) console.log(
|
|
12414
|
+
if (token) console.log(import_picocolors3.default.dim(" auth: token stored in ~/.argent/link.json (0600)"));
|
|
11918
12415
|
printSecurityCaveat(host, token, url);
|
|
11919
12416
|
if (process.env.ARGENT_TOOLS_URL) {
|
|
11920
12417
|
console.log(
|
|
11921
|
-
|
|
12418
|
+
import_picocolors3.default.yellow(
|
|
11922
12419
|
`Note: ARGENT_TOOLS_URL=${process.env.ARGENT_TOOLS_URL} is set in your environment and takes precedence over the link.`
|
|
11923
12420
|
)
|
|
11924
12421
|
);
|
|
@@ -11949,7 +12446,7 @@ async function unlink3(argv) {
|
|
|
11949
12446
|
}
|
|
11950
12447
|
if (!flags2.yes) {
|
|
11951
12448
|
const confirmed = await confirm({
|
|
11952
|
-
message: `Remove link to ${
|
|
12449
|
+
message: `Remove link to ${import_picocolors3.default.cyan(existing.url)}?`,
|
|
11953
12450
|
initialValue: true
|
|
11954
12451
|
});
|
|
11955
12452
|
if (isCancel(confirmed) || !confirmed) {
|
|
@@ -11958,10 +12455,10 @@ async function unlink3(argv) {
|
|
|
11958
12455
|
}
|
|
11959
12456
|
}
|
|
11960
12457
|
await clearLinkConfig();
|
|
11961
|
-
console.log(`${
|
|
12458
|
+
console.log(`${import_picocolors3.default.green("\u2713")} Unlinked from ${import_picocolors3.default.dim(existing.url)}.`);
|
|
11962
12459
|
if (process.env.ARGENT_TOOLS_URL) {
|
|
11963
12460
|
console.log(
|
|
11964
|
-
|
|
12461
|
+
import_picocolors3.default.yellow(
|
|
11965
12462
|
`The env var ARGENT_TOOLS_URL is also set in your shell (=${process.env.ARGENT_TOOLS_URL}) and takes precedence \u2014 unset it manually if you want fully local behaviour.`
|
|
11966
12463
|
)
|
|
11967
12464
|
);
|
|
@@ -11970,13 +12467,13 @@ async function unlink3(argv) {
|
|
|
11970
12467
|
}
|
|
11971
12468
|
|
|
11972
12469
|
// ../argent-cli/src/telemetry.ts
|
|
11973
|
-
var
|
|
12470
|
+
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
11974
12471
|
async function telemetry(args) {
|
|
11975
12472
|
const sub = args[0];
|
|
11976
12473
|
init("cli");
|
|
11977
12474
|
switch (sub) {
|
|
11978
12475
|
case void 0:
|
|
11979
|
-
|
|
12476
|
+
printUsage2();
|
|
11980
12477
|
await shutdown();
|
|
11981
12478
|
return;
|
|
11982
12479
|
case "status":
|
|
@@ -11991,7 +12488,7 @@ async function telemetry(args) {
|
|
|
11991
12488
|
return;
|
|
11992
12489
|
case "--help":
|
|
11993
12490
|
case "-h":
|
|
11994
|
-
|
|
12491
|
+
printUsage2();
|
|
11995
12492
|
await shutdown();
|
|
11996
12493
|
return;
|
|
11997
12494
|
default:
|
|
@@ -12000,7 +12497,7 @@ async function telemetry(args) {
|
|
|
12000
12497
|
process.exit(1);
|
|
12001
12498
|
}
|
|
12002
12499
|
}
|
|
12003
|
-
function
|
|
12500
|
+
function printUsage2() {
|
|
12004
12501
|
console.log(`Usage:
|
|
12005
12502
|
argent telemetry status Show telemetry state and device id
|
|
12006
12503
|
argent telemetry enable Enable telemetry
|
|
@@ -12018,25 +12515,26 @@ async function cmdEnable() {
|
|
|
12018
12515
|
const wasEnabled = isEnabled();
|
|
12019
12516
|
markEnabled();
|
|
12020
12517
|
if (wasEnabled) {
|
|
12021
|
-
console.log(
|
|
12518
|
+
console.log(import_picocolors4.default.dim("Telemetry was already enabled."));
|
|
12022
12519
|
} else {
|
|
12023
|
-
console.log(
|
|
12520
|
+
console.log(import_picocolors4.default.green("Telemetry enabled."));
|
|
12024
12521
|
}
|
|
12025
12522
|
await shutdown();
|
|
12026
12523
|
}
|
|
12027
12524
|
async function cmdDisable() {
|
|
12028
12525
|
const wasEnabled = isEnabled();
|
|
12029
12526
|
if (!wasEnabled) {
|
|
12030
|
-
console.log(
|
|
12527
|
+
console.log(import_picocolors4.default.dim("Telemetry was already disabled."));
|
|
12031
12528
|
await shutdown();
|
|
12032
12529
|
return;
|
|
12033
12530
|
}
|
|
12034
12531
|
await markDisabled();
|
|
12035
|
-
console.log(
|
|
12532
|
+
console.log(import_picocolors4.default.red("Telemetry disabled."));
|
|
12036
12533
|
await shutdown();
|
|
12037
12534
|
}
|
|
12038
12535
|
export {
|
|
12039
12536
|
FLAG_REGISTRY,
|
|
12537
|
+
config,
|
|
12040
12538
|
disable,
|
|
12041
12539
|
enable,
|
|
12042
12540
|
flags,
|