@swmansion/argent 0.16.1-next.9 → 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/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((resolve6, reject) => {
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 resolve6(port);
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((resolve6, reject) => {
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(() => resolve6({ port: actualPort, pid }));
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 path14 = u3.pathname === "/" ? "" : u3.pathname.replace(/\/+$/, "");
746
- const url = `${u3.protocol}//${u3.host}${path14}`;
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((resolve6, reject) => {
882
+ return new Promise((resolve7, reject) => {
883
883
  const hash = createHash2("sha256");
884
- createReadStream(filePath).on("data", (chunk) => hash.update(chunk)).on("end", () => resolve6(hash.digest("hex"))).on("error", reject);
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(path14) {
1258
- return path14.replace(/^[A-Z]:/, "").replace(/\\/g, "/");
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(config) {
2893
- if (!config) return {
2892
+ function resolveExceptionStepsConfig(config2) {
2893
+ if (!config2) return {
2894
2894
  ...DEFAULT_EXCEPTION_STEPS_CONFIG
2895
2895
  };
2896
2896
  return {
2897
- enabled: config.enabled ?? DEFAULT_EXCEPTION_STEPS_CONFIG.enabled,
2898
- max_bytes: normalizePositiveInteger(config.max_bytes, DEFAULT_EXCEPTION_STEPS_CONFIG.max_bytes)
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(config) {
2921
+ constructor(config2) {
2922
2922
  this._entries = [];
2923
2923
  this._totalBytes = 0;
2924
- this._config = resolveExceptionStepsConfig(config);
2924
+ this._config = resolveExceptionStepsConfig(config2);
2925
2925
  }
2926
- setConfig(config) {
2927
- this._config = resolveExceptionStepsConfig(config);
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(path14, ranges, output) {
3811
- return new Promise((resolve6) => {
3812
- const stream = createReadStream2(path14);
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
- resolve6();
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(path14, 1);
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(path14) {
3889
- return path14.startsWith("node:") || path14.endsWith(".min.js") || path14.endsWith(".min.cjs") || path14.endsWith(".min.mjs") || path14.startsWith("data:");
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 resolve6;
5115
+ let resolve7;
5116
5116
  const promise = new Promise((r2) => {
5117
- resolve6 = r2;
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: resolve6,
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 resolve6 = this._consumeWaitUntilCycle();
5149
+ const resolve7 = this._consumeWaitUntilCycle();
5150
5150
  try {
5151
5151
  await super.flush();
5152
5152
  } catch {
5153
5153
  } finally {
5154
- resolve6?.();
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((resolve6) => {
5275
+ return new Promise((resolve7) => {
5276
5276
  const timeout = setTimeout(() => {
5277
5277
  cleanup();
5278
- resolve6(false);
5278
+ resolve7(false);
5279
5279
  }, timeoutMs);
5280
5280
  const cleanup = this._events.on("localEvaluationFlagsLoaded", (count) => {
5281
5281
  clearTimeout(timeout);
5282
5282
  cleanup();
5283
- resolve6(count > 0);
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 resolve6 = this._consumeWaitUntilCycle();
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
- resolve6?.();
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 config = resolveConfig();
6094
- if (!config.isUsable) {
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(config.key, opts);
6107
+ client = new PostHog(config2.key, opts);
6108
6108
  } catch {
6109
6109
  client = null;
6110
6110
  return null;
@@ -6226,6 +6226,7 @@ var FAILURE_CODES = {
6226
6226
  NATIVE_DEVTOOLS_RPC_TIMEOUT: "NATIVE_DEVTOOLS_RPC_TIMEOUT",
6227
6227
  NATIVE_DEVTOOLS_RPC_ERROR: "NATIVE_DEVTOOLS_RPC_ERROR",
6228
6228
  NATIVE_DEVTOOLS_SERVICE_DISPOSED: "NATIVE_DEVTOOLS_SERVICE_DISPOSED",
6229
+ NATIVE_DEVTOOLS_SOCKET_BIND_FAILED: "NATIVE_DEVTOOLS_SOCKET_BIND_FAILED",
6229
6230
  NATIVE_TARGET_NO_CONNECTED_APPS: "NATIVE_TARGET_NO_CONNECTED_APPS",
6230
6231
  NATIVE_TARGET_SINGLE_APP_NOT_FOREGROUND: "NATIVE_TARGET_SINGLE_APP_NOT_FOREGROUND",
6231
6232
  NATIVE_TARGET_MULTIPLE_APPS_AMBIGUOUS: "NATIVE_TARGET_MULTIPLE_APPS_AMBIGUOUS",
@@ -6710,9 +6711,9 @@ function isReplitAgent(env) {
6710
6711
  }
6711
6712
  var DEVIN_MARKER_PATH = "/opt/.devin";
6712
6713
  var JULES_MARKER_PATH = "/opt/environment_summary.sh";
6713
- function safeExists(fileExists, path14) {
6714
+ function safeExists(fileExists, path15) {
6714
6715
  try {
6715
- return fileExists(path14);
6716
+ return fileExists(path15);
6716
6717
  } catch {
6717
6718
  return false;
6718
6719
  }
@@ -7133,7 +7134,7 @@ var _CI_VENDOR_COUNT_FOR_TEST = vendors_default.length;
7133
7134
  var SESSION_ID2 = randomUUID4();
7134
7135
  function readCliVersion() {
7135
7136
  if (true) {
7136
- return "0.16.0";
7137
+ return "0.16.1";
7137
7138
  }
7138
7139
  return "0.0.0";
7139
7140
  }
@@ -7199,18 +7200,20 @@ function getFlagDefinition(name, registry = FLAG_REGISTRY) {
7199
7200
  return registry.find((def) => def.name === name);
7200
7201
  }
7201
7202
  var PROJECT_MARKERS = [".argent", ".git", "package.json"];
7202
- function resolveProjectRoot(startDir) {
7203
- const initial = path4.resolve(startDir);
7204
- let current = initial;
7203
+ function findProjectRoot(startDir) {
7204
+ let current = path4.resolve(startDir);
7205
7205
  while (true) {
7206
7206
  for (const marker of PROJECT_MARKERS) {
7207
7207
  if (fs2.existsSync(path4.join(current, marker))) return current;
7208
7208
  }
7209
7209
  const parent = path4.dirname(current);
7210
- if (parent === current) return initial;
7210
+ if (parent === current) return null;
7211
7211
  current = parent;
7212
7212
  }
7213
7213
  }
7214
+ function resolveProjectRoot(startDir) {
7215
+ return findProjectRoot(startDir) ?? path4.resolve(startDir);
7216
+ }
7214
7217
  function getFlagsPath(scope, options = {}) {
7215
7218
  const home = options.homeDir ?? homedir3();
7216
7219
  if (scope === "global") {
@@ -7295,33 +7298,91 @@ function argentHomeDir() {
7295
7298
  const home = process.platform === "win32" ? nonEmpty(process.env.USERPROFILE) ?? os.homedir() : nonEmpty(process.env.HOME) ?? os.homedir();
7296
7299
  return path5.join(home, ".argent");
7297
7300
  }
7298
- function configFilePath() {
7299
- return path5.join(argentHomeDir(), "config.json");
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");
7300
7310
  }
7301
7311
 
7302
7312
  // ../configuration-core/src/config.ts
7303
7313
  import * as crypto from "node:crypto";
7304
7314
  import * as fs3 from "node:fs";
7305
7315
  import * as path6 from "node:path";
7306
- function readConfigObject() {
7316
+ function readConfigObject(scope = "global", options = {}) {
7307
7317
  try {
7308
- const raw = fs3.readFileSync(configFilePath(), "utf8");
7318
+ const raw = fs3.readFileSync(configFilePath(scope, options), "utf8");
7309
7319
  const json = JSON.parse(raw);
7310
- if (json && typeof json === "object") {
7320
+ if (json && typeof json === "object" && !Array.isArray(json)) {
7311
7321
  return json;
7312
7322
  }
7313
7323
  } catch {
7314
7324
  }
7315
7325
  return {};
7316
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
+ }
7317
7378
  var LOCK_STALE_MS2 = 1e4;
7318
7379
  var LOCK_MAX_WAIT_MS = 2e3;
7319
7380
  var LOCK_RETRY_MS = 25;
7320
7381
  function sleepSync(ms) {
7321
7382
  Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
7322
7383
  }
7323
- function acquireConfigLock() {
7324
- const lockPath = configFilePath() + ".lock";
7384
+ function acquireConfigLock(finalPath) {
7385
+ const lockPath = finalPath + ".lock";
7325
7386
  const deadline = Date.now() + LOCK_MAX_WAIT_MS;
7326
7387
  for (; ; ) {
7327
7388
  try {
@@ -7356,14 +7417,15 @@ function releaseConfigLock(lock) {
7356
7417
  } catch {
7357
7418
  }
7358
7419
  }
7359
- function updateConfig(mutate) {
7360
- fs3.mkdirSync(argentHomeDir(), { recursive: true });
7361
- const lock = acquireConfigLock();
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);
7362
7425
  try {
7363
- const next = readConfigObject();
7426
+ const next = readConfigObject(scope, options);
7364
7427
  mutate(next);
7365
- const finalPath = configFilePath();
7366
- const tmpPath = path6.join(argentHomeDir(), `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
7428
+ const tmpPath = path6.join(dir, `.config.tmp.${process.pid}.${crypto.randomUUID()}`);
7367
7429
  const fd = fs3.openSync(tmpPath, "wx", 384);
7368
7430
  try {
7369
7431
  fs3.writeSync(fd, JSON.stringify(next, null, 2) + "\n");
@@ -7384,27 +7446,215 @@ function updateConfig(mutate) {
7384
7446
  if (lock) releaseConfigLock(lock);
7385
7447
  }
7386
7448
  }
7387
- function readLensConfig() {
7388
- const lens2 = readConfigObject().lens;
7389
- return lens2 && typeof lens2 === "object" ? lens2 : {};
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;
7390
7509
  }
7391
- function getRememberedAgent() {
7392
- const agent = readLensConfig().agent;
7393
- return typeof agent === "string" && agent.trim() ? agent : null;
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);
7394
7539
  }
7395
- function setRememberedAgent(agentId) {
7396
- updateConfig((config) => {
7397
- const lens2 = config.lens && typeof config.lens === "object" ? config.lens : {};
7398
- lens2.agent = agentId;
7399
- config.lens = lens2;
7400
- });
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);
7401
7546
  }
7402
- function clearRememberedAgent() {
7403
- updateConfig((config) => {
7404
- if (config.lens && typeof config.lens === "object") {
7405
- delete config.lens.agent;
7406
- }
7407
- });
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);
7408
7658
  }
7409
7659
 
7410
7660
  // ../telemetry/src/paths.ts
@@ -7691,12 +7941,12 @@ function resolveHostFingerprint() {
7691
7941
  }
7692
7942
  }
7693
7943
  function resolveHostFingerprintAsync() {
7694
- return new Promise((resolve6) => {
7944
+ return new Promise((resolve7) => {
7695
7945
  let binary;
7696
7946
  try {
7697
7947
  binary = simulatorServerBinaryPath();
7698
7948
  } catch {
7699
- resolve6(null);
7949
+ resolve7(null);
7700
7950
  return;
7701
7951
  }
7702
7952
  let settled = false;
@@ -7709,7 +7959,7 @@ function resolveHostFingerprintAsync() {
7709
7959
  child?.kill("SIGKILL");
7710
7960
  } catch {
7711
7961
  }
7712
- resolve6(value);
7962
+ resolve7(value);
7713
7963
  };
7714
7964
  const watchdog = setTimeout(() => finish(null), FINGERPRINT_TIMEOUT_MS);
7715
7965
  watchdog.unref?.();
@@ -7821,9 +8071,9 @@ function isEnabled(env = process.env) {
7821
8071
  return getConsentState(env).enabled;
7822
8072
  }
7823
8073
  function writeConsentFlag(enabled) {
7824
- updateConfig((config) => {
7825
- const telemetryBlock = typeof config.telemetry === "object" && config.telemetry ? config.telemetry : {};
7826
- config.telemetry = { ...telemetryBlock, enabled };
8074
+ updateConfig((config2) => {
8075
+ const telemetryBlock = typeof config2.telemetry === "object" && config2.telemetry ? config2.telemetry : {};
8076
+ config2.telemetry = { ...telemetryBlock, enabled };
7827
8077
  });
7828
8078
  cache.current = null;
7829
8079
  }
@@ -7951,7 +8201,7 @@ async function shutdown(timeoutMs = SHORT_FLUSH_TIMEOUT_MS) {
7951
8201
  try {
7952
8202
  await Promise.race([
7953
8203
  client2.shutdown(timeoutMs),
7954
- new Promise((resolve6) => setTimeout(resolve6, timeoutMs + 250).unref())
8204
+ new Promise((resolve7) => setTimeout(resolve7, timeoutMs + 250).unref())
7955
8205
  ]);
7956
8206
  } catch (err) {
7957
8207
  emitDebugError("shutdown failed", err);
@@ -7971,7 +8221,7 @@ async function markDisabled() {
7971
8221
  try {
7972
8222
  await Promise.race([
7973
8223
  client2.shutdown(SHORT_FLUSH_TIMEOUT_MS),
7974
- new Promise((resolve6) => setTimeout(resolve6, SHORT_FLUSH_TIMEOUT_MS).unref())
8224
+ new Promise((resolve7) => setTimeout(resolve7, SHORT_FLUSH_TIMEOUT_MS).unref())
7975
8225
  ]);
7976
8226
  } catch {
7977
8227
  }
@@ -7987,14 +8237,14 @@ function status() {
7987
8237
  const anonId = peekAnonId();
7988
8238
  const hasAnonIdOnDisk = anonId !== null;
7989
8239
  const anonIdPrefix = anonId ? anonId.slice(0, 8) : null;
7990
- const config = resolveConfig();
8240
+ const config2 = resolveConfig();
7991
8241
  return {
7992
8242
  enabled: consent.enabled,
7993
8243
  source: consent.source,
7994
8244
  anonIdPrefix,
7995
8245
  hasAnonIdOnDisk,
7996
8246
  host: POSTHOG_HOST,
7997
- isKeyConfigured: config.isUsable
8247
+ isKeyConfigured: config2.isUsable
7998
8248
  };
7999
8249
  }
8000
8250
 
@@ -8213,13 +8463,13 @@ function splitOptions(argv) {
8213
8463
  return { json, outPath, argvForFlags: rest };
8214
8464
  }
8215
8465
  async function readStdin() {
8216
- return new Promise((resolve6, reject) => {
8466
+ return new Promise((resolve7, reject) => {
8217
8467
  let data = "";
8218
8468
  process.stdin.setEncoding("utf8");
8219
8469
  process.stdin.on("data", (chunk) => {
8220
8470
  data += chunk;
8221
8471
  });
8222
- process.stdin.on("end", () => resolve6(data));
8472
+ process.stdin.on("end", () => resolve7(data));
8223
8473
  process.stdin.on("error", reject);
8224
8474
  });
8225
8475
  }
@@ -8581,7 +8831,7 @@ function resolveArtifactDisplayPaths(report) {
8581
8831
  }
8582
8832
  function exitAfterFlush(code, streams = [process.stdout, process.stderr]) {
8583
8833
  return Promise.all(
8584
- streams.map((s) => new Promise((resolve6) => s.write("", () => resolve6())))
8834
+ streams.map((s) => new Promise((resolve7) => s.write("", () => resolve7())))
8585
8835
  ).then(() => process.exit(code));
8586
8836
  }
8587
8837
  function renderReport(report) {
@@ -9466,7 +9716,7 @@ function ptyInjectBeats(text2) {
9466
9716
  ];
9467
9717
  }
9468
9718
  function sleep(ms) {
9469
- return new Promise((resolve6) => setTimeout(resolve6, ms));
9719
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
9470
9720
  }
9471
9721
  var DEFAULT_COLS = 80;
9472
9722
  var DEFAULT_ROWS = 24;
@@ -9687,7 +9937,7 @@ var SPAWN_GRACE_MS = 8e3;
9687
9937
  var DEATH_CONFIRMATIONS = 3;
9688
9938
  var SSE_RECONNECT_MS = 1e3;
9689
9939
  function sleep2(ms) {
9690
- return new Promise((resolve6) => setTimeout(resolve6, ms));
9940
+ return new Promise((resolve7) => setTimeout(resolve7, ms));
9691
9941
  }
9692
9942
  var TRUST_PROMPT_RE = /trust this folder|do you trust|yes,? i trust|trust the files in this/i;
9693
9943
  async function dismissTrustPrompt(session) {
@@ -10333,8 +10583,8 @@ Options:
10333
10583
  console.log("Feature flags (project overrides global):");
10334
10584
  const maxName = registryView.reduce((m, f) => Math.max(m, f.name.length), 0);
10335
10585
  for (const f of registryView) {
10336
- const scopeLabel = f.scope ? ` (${f.scope})` : "";
10337
- console.log(` ${f.name.padEnd(maxName, " ")} ${colorState(f.enabled)}${scopeLabel}`);
10586
+ const scopeLabel2 = f.scope ? ` (${f.scope})` : "";
10587
+ console.log(` ${f.name.padEnd(maxName, " ")} ${colorState(f.enabled)}${scopeLabel2}`);
10338
10588
  console.log(` ${" ".repeat(maxName)} ${f.description}`);
10339
10589
  }
10340
10590
  }
@@ -10350,6 +10600,254 @@ Options:
10350
10600
  console.log(` Project: ${getFlagsPath("project")}`);
10351
10601
  }
10352
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
+
10353
10851
  // ../../node_modules/@clack/core/dist/index.mjs
10354
10852
  import { styleText } from "node:util";
10355
10853
  import { stdout, stdin } from "node:process";
@@ -11070,7 +11568,7 @@ import { styleText as styleText2, stripVTControlCharacters } from "node:util";
11070
11568
  import process$1 from "node:process";
11071
11569
  var import_sisteransi2 = __toESM(require_src(), 1);
11072
11570
  import { existsSync as existsSync7, lstatSync as lstatSync3, readdirSync as readdirSync3 } from "node:fs";
11073
- import { dirname as dirname8, join as join16 } from "node:path";
11571
+ import { dirname as dirname9, join as join17 } from "node:path";
11074
11572
  function isUnicodeSupported() {
11075
11573
  if (process$1.platform !== "win32") {
11076
11574
  return process$1.env.TERM !== "linux";
@@ -11507,7 +12005,7 @@ ${r2}
11507
12005
  }).prompt();
11508
12006
 
11509
12007
  // ../argent-cli/src/link.ts
11510
- var import_picocolors2 = __toESM(require_picocolors(), 1);
12008
+ var import_picocolors3 = __toESM(require_picocolors(), 1);
11511
12009
  var WILDCARD_HOSTS = /* @__PURE__ */ new Set(["0.0.0.0", "::", "::0", ""]);
11512
12010
  function isLoopback2(host) {
11513
12011
  return host === "127.0.0.1" || host === "localhost" || host === "::1";
@@ -11765,7 +12263,7 @@ async function preflightHealth(url, token) {
11765
12263
  }
11766
12264
  function printRestartHint() {
11767
12265
  console.log(
11768
- import_picocolors2.default.dim("Restart your editor to apply the change to any running `argent mcp` session.")
12266
+ import_picocolors3.default.dim("Restart your editor to apply the change to any running `argent mcp` session.")
11769
12267
  );
11770
12268
  }
11771
12269
  function printSecurityCaveat(host, token, url) {
@@ -11774,7 +12272,7 @@ function printSecurityCaveat(host, token, url) {
11774
12272
  if (tls) {
11775
12273
  if (!token) {
11776
12274
  process.stderr.write(
11777
- import_picocolors2.default.yellow(
12275
+ import_picocolors3.default.yellow(
11778
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.
11779
12277
  `
11780
12278
  )
@@ -11784,7 +12282,7 @@ function printSecurityCaveat(host, token, url) {
11784
12282
  }
11785
12283
  if (token) {
11786
12284
  process.stderr.write(
11787
- import_picocolors2.default.dim(
12285
+ import_picocolors3.default.dim(
11788
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.
11789
12287
  `
11790
12288
  )
@@ -11792,7 +12290,7 @@ function printSecurityCaveat(host, token, url) {
11792
12290
  return;
11793
12291
  }
11794
12292
  process.stderr.write(
11795
- import_picocolors2.default.yellow(
12293
+ import_picocolors3.default.yellow(
11796
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).
11797
12295
  `
11798
12296
  )
@@ -11825,9 +12323,9 @@ async function link(argv) {
11825
12323
  if (flags2.host !== null) {
11826
12324
  host = flags2.host;
11827
12325
  } else {
11828
- intro(import_picocolors2.default.bgCyan(import_picocolors2.default.black(" argent link ")));
12326
+ intro(import_picocolors3.default.bgCyan(import_picocolors3.default.black(" argent link ")));
11829
12327
  if (existing) {
11830
- log.info(`Current link: ${import_picocolors2.default.cyan(existing.url)} (${existing.createdAt})`);
12328
+ log.info(`Current link: ${import_picocolors3.default.cyan(existing.url)} (${existing.createdAt})`);
11831
12329
  }
11832
12330
  host = await promptHost(existing);
11833
12331
  }
@@ -11843,12 +12341,12 @@ async function link(argv) {
11843
12341
  let url = flags2.url ?? formatUrl(host, port);
11844
12342
  if (!flags2.yes && existing) {
11845
12343
  if (existing.url === url) {
11846
- log.info(`Already linked to ${import_picocolors2.default.cyan(url)}.`);
12344
+ log.info(`Already linked to ${import_picocolors3.default.cyan(url)}.`);
11847
12345
  outro("No changes.");
11848
12346
  return;
11849
12347
  }
11850
12348
  const overwrite = await confirm({
11851
- message: `Replace existing link ${import_picocolors2.default.dim(existing.url)} with ${import_picocolors2.default.cyan(url)}?`,
12349
+ message: `Replace existing link ${import_picocolors3.default.dim(existing.url)} with ${import_picocolors3.default.cyan(url)}?`,
11852
12350
  initialValue: true
11853
12351
  });
11854
12352
  if (isCancel(overwrite) || !overwrite) {
@@ -11866,10 +12364,10 @@ async function link(argv) {
11866
12364
  }
11867
12365
  const result = await preflightHealth(url, token);
11868
12366
  if (result.ok) {
11869
- if (spinner2) spinner2.stop(import_picocolors2.default.green("Tool-server reachable."));
12367
+ if (spinner2) spinner2.stop(import_picocolors3.default.green("Tool-server reachable."));
11870
12368
  break;
11871
12369
  }
11872
- if (spinner2) spinner2.stop(import_picocolors2.default.red("Verification failed."));
12370
+ if (spinner2) spinner2.stop(import_picocolors3.default.red("Verification failed."));
11873
12371
  const detail = result.error ? ` (${result.error})` : "";
11874
12372
  if (flags2.yes) {
11875
12373
  console.error(
@@ -11909,15 +12407,15 @@ async function link(argv) {
11909
12407
  };
11910
12408
  await writeLinkConfig(cfg);
11911
12409
  if (existing && existing.url !== url) {
11912
- console.log(`${import_picocolors2.default.green("\u2713")} Link updated: ${import_picocolors2.default.dim(existing.url)} \u2192 ${import_picocolors2.default.cyan(url)}`);
12410
+ console.log(`${import_picocolors3.default.green("\u2713")} Link updated: ${import_picocolors3.default.dim(existing.url)} \u2192 ${import_picocolors3.default.cyan(url)}`);
11913
12411
  } else {
11914
- console.log(`${import_picocolors2.default.green("\u2713")} Linked: ${import_picocolors2.default.cyan(url)}`);
12412
+ console.log(`${import_picocolors3.default.green("\u2713")} Linked: ${import_picocolors3.default.cyan(url)}`);
11915
12413
  }
11916
- if (token) console.log(import_picocolors2.default.dim(" auth: token stored in ~/.argent/link.json (0600)"));
12414
+ if (token) console.log(import_picocolors3.default.dim(" auth: token stored in ~/.argent/link.json (0600)"));
11917
12415
  printSecurityCaveat(host, token, url);
11918
12416
  if (process.env.ARGENT_TOOLS_URL) {
11919
12417
  console.log(
11920
- import_picocolors2.default.yellow(
12418
+ import_picocolors3.default.yellow(
11921
12419
  `Note: ARGENT_TOOLS_URL=${process.env.ARGENT_TOOLS_URL} is set in your environment and takes precedence over the link.`
11922
12420
  )
11923
12421
  );
@@ -11948,7 +12446,7 @@ async function unlink3(argv) {
11948
12446
  }
11949
12447
  if (!flags2.yes) {
11950
12448
  const confirmed = await confirm({
11951
- message: `Remove link to ${import_picocolors2.default.cyan(existing.url)}?`,
12449
+ message: `Remove link to ${import_picocolors3.default.cyan(existing.url)}?`,
11952
12450
  initialValue: true
11953
12451
  });
11954
12452
  if (isCancel(confirmed) || !confirmed) {
@@ -11957,10 +12455,10 @@ async function unlink3(argv) {
11957
12455
  }
11958
12456
  }
11959
12457
  await clearLinkConfig();
11960
- console.log(`${import_picocolors2.default.green("\u2713")} Unlinked from ${import_picocolors2.default.dim(existing.url)}.`);
12458
+ console.log(`${import_picocolors3.default.green("\u2713")} Unlinked from ${import_picocolors3.default.dim(existing.url)}.`);
11961
12459
  if (process.env.ARGENT_TOOLS_URL) {
11962
12460
  console.log(
11963
- import_picocolors2.default.yellow(
12461
+ import_picocolors3.default.yellow(
11964
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.`
11965
12463
  )
11966
12464
  );
@@ -11969,13 +12467,13 @@ async function unlink3(argv) {
11969
12467
  }
11970
12468
 
11971
12469
  // ../argent-cli/src/telemetry.ts
11972
- var import_picocolors3 = __toESM(require_picocolors(), 1);
12470
+ var import_picocolors4 = __toESM(require_picocolors(), 1);
11973
12471
  async function telemetry(args) {
11974
12472
  const sub = args[0];
11975
12473
  init("cli");
11976
12474
  switch (sub) {
11977
12475
  case void 0:
11978
- printUsage();
12476
+ printUsage2();
11979
12477
  await shutdown();
11980
12478
  return;
11981
12479
  case "status":
@@ -11990,7 +12488,7 @@ async function telemetry(args) {
11990
12488
  return;
11991
12489
  case "--help":
11992
12490
  case "-h":
11993
- printUsage();
12491
+ printUsage2();
11994
12492
  await shutdown();
11995
12493
  return;
11996
12494
  default:
@@ -11999,7 +12497,7 @@ async function telemetry(args) {
11999
12497
  process.exit(1);
12000
12498
  }
12001
12499
  }
12002
- function printUsage() {
12500
+ function printUsage2() {
12003
12501
  console.log(`Usage:
12004
12502
  argent telemetry status Show telemetry state and device id
12005
12503
  argent telemetry enable Enable telemetry
@@ -12017,25 +12515,26 @@ async function cmdEnable() {
12017
12515
  const wasEnabled = isEnabled();
12018
12516
  markEnabled();
12019
12517
  if (wasEnabled) {
12020
- console.log(import_picocolors3.default.dim("Telemetry was already enabled."));
12518
+ console.log(import_picocolors4.default.dim("Telemetry was already enabled."));
12021
12519
  } else {
12022
- console.log(import_picocolors3.default.green("Telemetry enabled."));
12520
+ console.log(import_picocolors4.default.green("Telemetry enabled."));
12023
12521
  }
12024
12522
  await shutdown();
12025
12523
  }
12026
12524
  async function cmdDisable() {
12027
12525
  const wasEnabled = isEnabled();
12028
12526
  if (!wasEnabled) {
12029
- console.log(import_picocolors3.default.dim("Telemetry was already disabled."));
12527
+ console.log(import_picocolors4.default.dim("Telemetry was already disabled."));
12030
12528
  await shutdown();
12031
12529
  return;
12032
12530
  }
12033
12531
  await markDisabled();
12034
- console.log(import_picocolors3.default.red("Telemetry disabled."));
12532
+ console.log(import_picocolors4.default.red("Telemetry disabled."));
12035
12533
  await shutdown();
12036
12534
  }
12037
12535
  export {
12038
12536
  FLAG_REGISTRY,
12537
+ config,
12039
12538
  disable,
12040
12539
  enable,
12041
12540
  flags,