@alchemy/cli 0.7.0 → 0.7.2

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/README.md CHANGED
@@ -82,7 +82,7 @@ Have your agent run `agent-prompt` as its first step to get a complete, machine-
82
82
  alchemy --json --no-interactive agent-prompt
83
83
  ```
84
84
 
85
- This returns a single JSON document with execution policy, preflight instructions, auth matrix, the full command tree with all arguments and options, error codes with recovery actions, and example invocations. No external docs required.
85
+ This returns a single JSON document with execution policy, runtime discovery instructions, preflight instructions, auth matrix, the full command tree with all arguments and options, error codes with recovery actions, and example invocations. No external docs required.
86
86
 
87
87
  Agents can also call `alchemy --json --no-interactive update-check` to retrieve the current CLI version, latest known version, and install command for upgrades.
88
88
 
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
+ import {
4
+ registerAuth,
5
+ selectAppAfterAuth
6
+ } from "./chunk-LQXLZLCY.js";
7
+ import "./chunk-INVT5BV6.js";
8
+ import "./chunk-RE5HSYJJ.js";
9
+ import "./chunk-5LCA2B6S.js";
10
+ import "./chunk-DGKUBK7G.js";
11
+ import "./chunk-BAZ4NGOD.js";
12
+ import "./chunk-KLPWJFWP.js";
13
+ export {
14
+ registerAuth,
15
+ selectAppAfterAuth
16
+ };
@@ -11,8 +11,8 @@ import {
11
11
  prepareLogin,
12
12
  revokeToken,
13
13
  waitForCallback
14
- } from "./chunk-HSKKIATB.js";
15
- import "./chunk-QEDAULQ2.js";
14
+ } from "./chunk-INVT5BV6.js";
15
+ import "./chunk-KLPWJFWP.js";
16
16
  export {
17
17
  AUTH_PORT,
18
18
  DEFAULT_EXPIRES_IN_SECONDS,
@@ -4,7 +4,7 @@ import {
4
4
  configDir,
5
5
  load,
6
6
  save
7
- } from "./chunk-7WD3YLRK.js";
7
+ } from "./chunk-BAZ4NGOD.js";
8
8
  import {
9
9
  CLIError,
10
10
  ErrorCode,
@@ -29,7 +29,7 @@ import {
29
29
  parseBaseURLOverride,
30
30
  redactSensitiveText,
31
31
  verbose
32
- } from "./chunk-QEDAULQ2.js";
32
+ } from "./chunk-KLPWJFWP.js";
33
33
 
34
34
  // src/lib/resolve.ts
35
35
  import { readFileSync as readFileSync2 } from "fs";
@@ -2,7 +2,7 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  isRevealMode
5
- } from "./chunk-QEDAULQ2.js";
5
+ } from "./chunk-KLPWJFWP.js";
6
6
 
7
7
  // src/lib/secrets.ts
8
8
  function maskSecret(value) {
@@ -5,7 +5,7 @@ import {
5
5
  isJSONMode,
6
6
  quiet,
7
7
  rgb
8
- } from "./chunk-QEDAULQ2.js";
8
+ } from "./chunk-KLPWJFWP.js";
9
9
 
10
10
  // src/lib/terminal-ui.ts
11
11
  import * as readline from "readline";
@@ -46,6 +46,53 @@ function suspendStdinKeypressListeners() {
46
46
  }
47
47
  };
48
48
  }
49
+ function resetStdinKeypressDecoder() {
50
+ const input = stdin;
51
+ for (const symbol of Object.getOwnPropertySymbols(input)) {
52
+ const name = String(symbol);
53
+ if (name === "Symbol(keypress-decoder)" || name === "Symbol(escape-decoder)") {
54
+ delete input[symbol];
55
+ }
56
+ }
57
+ }
58
+ function isReadlineKeypressDataListener(listener) {
59
+ return typeof listener === "function" && listener.name === "onData";
60
+ }
61
+ function prepareStdinKeypressEvents() {
62
+ const dataListeners = stdin.listeners("data");
63
+ const keypressListeners = stdin.listeners("keypress");
64
+ for (const listener of dataListeners) {
65
+ stdin.removeListener("data", listener);
66
+ }
67
+ for (const listener of keypressListeners) {
68
+ stdin.removeListener("keypress", listener);
69
+ }
70
+ resetStdinKeypressDecoder();
71
+ readline.emitKeypressEvents(stdin);
72
+ return () => {
73
+ for (const listener of stdin.listeners("data")) {
74
+ stdin.removeListener("data", listener);
75
+ }
76
+ resetStdinKeypressDecoder();
77
+ for (const listener of dataListeners) {
78
+ if (!isReadlineKeypressDataListener(listener)) {
79
+ stdin.on("data", listener);
80
+ }
81
+ }
82
+ for (const listener of keypressListeners) {
83
+ stdin.on("keypress", listener);
84
+ }
85
+ if (keypressListeners.length > 0) {
86
+ readline.emitKeypressEvents(stdin);
87
+ }
88
+ };
89
+ }
90
+ function requestPromptInterrupt() {
91
+ const handled = process.emit("SIGINT", "SIGINT");
92
+ if (!handled) {
93
+ process.exit(130);
94
+ }
95
+ }
49
96
  async function runListPrompt(opts) {
50
97
  if (!stdin.isTTY || !stdout.isTTY) {
51
98
  if (opts.allowMultiple) {
@@ -54,8 +101,7 @@ async function runListPrompt(opts) {
54
101
  const initial = opts.initialValue ?? opts.options.find((o) => !o.disabled)?.value ?? null;
55
102
  return { value: initial, cancelled: false };
56
103
  }
57
- readline.emitKeypressEvents(stdin);
58
- const restoreKeypressListeners = suspendStdinKeypressListeners();
104
+ const restoreKeypressEvents = prepareStdinKeypressEvents();
59
105
  const previousRawMode = stdin.isRaw;
60
106
  stdin.resume();
61
107
  stdin.setRawMode(true);
@@ -131,7 +177,7 @@ async function runListPrompt(opts) {
131
177
  if (renderedLines > 0) clearRenderedLines(renderedLines);
132
178
  stdin.setRawMode(previousRawMode);
133
179
  stdin.removeListener("keypress", onKeypress);
134
- restoreKeypressListeners();
180
+ restoreKeypressEvents();
135
181
  if (!previousRawMode) {
136
182
  stdin.pause();
137
183
  }
@@ -144,7 +190,13 @@ async function runListPrompt(opts) {
144
190
  const onKeypress = (str, key) => {
145
191
  const filtered = getFiltered();
146
192
  const current = filtered[cursor];
147
- if (key.name === "escape" || key.ctrl && key.name === "c") {
193
+ if (key.ctrl && key.name === "c") {
194
+ cleanup();
195
+ requestPromptInterrupt();
196
+ resolver({ value: null, cancelled: true });
197
+ return;
198
+ }
199
+ if (key.name === "escape") {
148
200
  cleanup();
149
201
  resolver({ value: null, cancelled: true });
150
202
  return;
@@ -222,8 +274,10 @@ async function promptText(opts) {
222
274
  const previousRawMode = stdin.isRaw;
223
275
  if (previousRawMode) stdin.setRawMode(false);
224
276
  const ABORTED = /* @__PURE__ */ Symbol("aborted");
277
+ const INTERRUPTED = /* @__PURE__ */ Symbol("interrupted");
278
+ let removeAbortListener;
225
279
  const value = await new Promise((resolve) => {
226
- rl.on("SIGINT", () => resolve(null));
280
+ rl.on("SIGINT", () => resolve(INTERRUPTED));
227
281
  rl.question(question, (answer) => resolve(answer));
228
282
  if (opts.abortSignal) {
229
283
  const onAbort = () => resolve(ABORTED);
@@ -231,18 +285,24 @@ async function promptText(opts) {
231
285
  onAbort();
232
286
  } else {
233
287
  opts.abortSignal.addEventListener("abort", onAbort, { once: true });
288
+ removeAbortListener = () => opts.abortSignal?.removeEventListener("abort", onAbort);
234
289
  }
235
290
  }
236
291
  });
237
292
  rl.close();
293
+ removeAbortListener?.();
238
294
  restoreKeypressListeners();
239
- if (previousRawMode) stdin.setRawMode(true);
295
+ if (previousRawMode) {
296
+ stdin.setRawMode(true);
297
+ } else {
298
+ stdin.pause();
299
+ }
240
300
  if (opts.clearAfterSubmit || value === ABORTED) {
241
301
  clearRenderedLines(2);
242
302
  }
243
303
  if (value === ABORTED) return "";
244
- if (value === null) {
245
- printCancel(opts.cancelMessage);
304
+ if (value === INTERRUPTED) {
305
+ requestPromptInterrupt();
246
306
  return null;
247
307
  }
248
308
  if (!value.trim() && opts.defaultValue !== void 0) return opts.defaultValue;
@@ -2,10 +2,10 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  isInteractiveAllowed
5
- } from "./chunk-HYCRHNPX.js";
5
+ } from "./chunk-RE5HSYJJ.js";
6
6
  import {
7
7
  resolveAuthToken
8
- } from "./chunk-TOEVZMIP.js";
8
+ } from "./chunk-5LCA2B6S.js";
9
9
 
10
10
  // src/lib/onboarding.ts
11
11
  function hasAPIKey(cfg) {
@@ -2,7 +2,7 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  getBaseDomain
5
- } from "./chunk-QEDAULQ2.js";
5
+ } from "./chunk-KLPWJFWP.js";
6
6
 
7
7
  // src/lib/auth.ts
8
8
  import { createHash, randomBytes } from "crypto";
@@ -517,6 +517,9 @@ var replMode = false;
517
517
  function setReplMode(enabled) {
518
518
  replMode = enabled;
519
519
  }
520
+ function isReplMode() {
521
+ return replMode;
522
+ }
520
523
  function exitWithError(err) {
521
524
  const cliErr = err instanceof CLIError ? err : new CLIError(
522
525
  ErrorCode.INTERNAL_ERROR,
@@ -573,5 +576,6 @@ export {
573
576
  errAdminAPI,
574
577
  errSetupRequired,
575
578
  setReplMode,
579
+ isReplMode,
576
580
  exitWithError
577
581
  };
@@ -4,14 +4,14 @@ import {
4
4
  completeLogin,
5
5
  prepareLogin,
6
6
  revokeToken
7
- } from "./chunk-HSKKIATB.js";
7
+ } from "./chunk-INVT5BV6.js";
8
8
  import {
9
9
  isInteractiveAllowed
10
- } from "./chunk-HYCRHNPX.js";
10
+ } from "./chunk-RE5HSYJJ.js";
11
11
  import {
12
12
  AdminClient,
13
13
  resolveAuthToken
14
- } from "./chunk-TOEVZMIP.js";
14
+ } from "./chunk-5LCA2B6S.js";
15
15
  import {
16
16
  bold,
17
17
  brand,
@@ -20,13 +20,13 @@ import {
20
20
  promptAutocomplete,
21
21
  promptText,
22
22
  withSpinner
23
- } from "./chunk-A6L3WCJN.js";
23
+ } from "./chunk-DGKUBK7G.js";
24
24
  import {
25
25
  configPath,
26
26
  load,
27
27
  maskIf,
28
28
  save
29
- } from "./chunk-7WD3YLRK.js";
29
+ } from "./chunk-BAZ4NGOD.js";
30
30
  import {
31
31
  CLIError,
32
32
  ErrorCode,
@@ -34,7 +34,7 @@ import {
34
34
  exitWithError,
35
35
  isJSONMode,
36
36
  printHuman
37
- } from "./chunk-QEDAULQ2.js";
37
+ } from "./chunk-KLPWJFWP.js";
38
38
 
39
39
  // src/commands/auth.ts
40
40
  function registerAuth(program) {
@@ -2,10 +2,10 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  configPath
5
- } from "./chunk-7WD3YLRK.js";
5
+ } from "./chunk-BAZ4NGOD.js";
6
6
  import {
7
7
  esc
8
- } from "./chunk-QEDAULQ2.js";
8
+ } from "./chunk-KLPWJFWP.js";
9
9
 
10
10
  // src/lib/update-check.ts
11
11
  import { execFileSync } from "child_process";
@@ -53,7 +53,7 @@ function semverLT(a, b) {
53
53
  return false;
54
54
  }
55
55
  function currentVersion() {
56
- return true ? "0.7.0" : "0.0.0";
56
+ return true ? "0.7.2" : "0.0.0";
57
57
  }
58
58
  function toUpdateStatus(latestVersion, checkedAt) {
59
59
  const current = currentVersion();
@@ -2,7 +2,7 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  isJSONMode
5
- } from "./chunk-QEDAULQ2.js";
5
+ } from "./chunk-KLPWJFWP.js";
6
6
 
7
7
  // src/lib/interaction.ts
8
8
  import { stdin, stdout } from "process";
@@ -24,8 +24,9 @@ import {
24
24
  errSolanaWalletKeyRequired,
25
25
  errWalletKeyRequired,
26
26
  exitWithError,
27
+ isReplMode,
27
28
  setReplMode
28
- } from "./chunk-QEDAULQ2.js";
29
+ } from "./chunk-KLPWJFWP.js";
29
30
  export {
30
31
  CLIError,
31
32
  EXIT_CODES,
@@ -50,5 +51,6 @@ export {
50
51
  errSolanaWalletKeyRequired,
51
52
  errWalletKeyRequired,
52
53
  exitWithError,
54
+ isReplMode,
53
55
  setReplMode
54
56
  };
package/dist/index.js CHANGED
@@ -2,18 +2,18 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  registerAuth
5
- } from "./chunk-I3X4G2UY.js";
5
+ } from "./chunk-LQXLZLCY.js";
6
6
  import {
7
7
  openBrowser
8
- } from "./chunk-HSKKIATB.js";
8
+ } from "./chunk-INVT5BV6.js";
9
9
  import {
10
10
  getSetupStatus,
11
11
  isSetupComplete,
12
12
  shouldRunOnboarding
13
- } from "./chunk-V4IK4CJN.js";
13
+ } from "./chunk-EZ2ZD7YO.js";
14
14
  import {
15
15
  isInteractiveAllowed
16
- } from "./chunk-HYCRHNPX.js";
16
+ } from "./chunk-RE5HSYJJ.js";
17
17
  import {
18
18
  adminClientFromFlags,
19
19
  clearSession,
@@ -41,12 +41,12 @@ import {
41
41
  resolveX402Client,
42
42
  saveSession,
43
43
  updateSession
44
- } from "./chunk-TOEVZMIP.js";
44
+ } from "./chunk-5LCA2B6S.js";
45
45
  import {
46
46
  getAvailableUpdate,
47
47
  getUpdateStatus,
48
48
  printUpdateNotice
49
- } from "./chunk-WWWVMK3J.js";
49
+ } from "./chunk-MB6REYQL.js";
50
50
  import {
51
51
  bold,
52
52
  brand,
@@ -70,7 +70,7 @@ import {
70
70
  weiToEth,
71
71
  withSpinner,
72
72
  yellow
73
- } from "./chunk-A6L3WCJN.js";
73
+ } from "./chunk-DGKUBK7G.js";
74
74
  import {
75
75
  KEY_MAP,
76
76
  configDir,
@@ -81,7 +81,7 @@ import {
81
81
  save,
82
82
  toMap,
83
83
  validKeys
84
- } from "./chunk-7WD3YLRK.js";
84
+ } from "./chunk-BAZ4NGOD.js";
85
85
  import {
86
86
  CLIError,
87
87
  EXIT_CODES,
@@ -108,6 +108,7 @@ import {
108
108
  identity,
109
109
  isJSONMode,
110
110
  isLocalhost,
111
+ isReplMode,
111
112
  noColor,
112
113
  parseBaseURLOverride,
113
114
  printHuman,
@@ -116,7 +117,7 @@ import {
116
117
  setFlags,
117
118
  setNoColor,
118
119
  verbose
119
- } from "./chunk-QEDAULQ2.js";
120
+ } from "./chunk-KLPWJFWP.js";
120
121
 
121
122
  // src/index.ts
122
123
  import { Command, Help } from "commander";
@@ -283,7 +284,6 @@ function validateTxHash(hash) {
283
284
 
284
285
  // src/commands/config.ts
285
286
  var RESET_KEY_MAP = { ...KEY_MAP, app: "app" };
286
- var APP_SEARCH_THRESHOLD = 15;
287
287
  async function saveAppWithPrompt(app) {
288
288
  const cfg = load();
289
289
  const updated = {
@@ -331,17 +331,12 @@ async function selectOrCreateApp(admin) {
331
331
  })),
332
332
  { label: "Create a new app", value: CREATE_NEW }
333
333
  ];
334
- const selected = apps.length > APP_SEARCH_THRESHOLD ? await promptAutocomplete({
334
+ const selected = await promptAutocomplete({
335
335
  message: "Select default app",
336
336
  placeholder: "Type app name or id",
337
337
  options,
338
338
  cancelMessage: "Cancelled app selection.",
339
339
  commitLabel: null
340
- }) : await promptSelect({
341
- message: "Select default app",
342
- options,
343
- cancelMessage: "Cancelled app selection.",
344
- commitLabel: null
345
340
  });
346
341
  if (selected === null) {
347
342
  return;
@@ -629,7 +624,7 @@ function registerConfig(program2) {
629
624
  printJSON(toMap(cfg));
630
625
  return;
631
626
  }
632
- const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-R4JZZCCF.js");
627
+ const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-ZCR3YCHJ.js");
633
628
  const validToken = resolveAuthToken2(cfg);
634
629
  const authStatus = cfg.auth_token ? validToken ? `${green("\u2713")} authenticated${cfg.auth_token_expires_at ? ` ${dim(`(expires ${cfg.auth_token_expires_at})`)}` : ""}` : `${yellow("\u25C6")} expired${cfg.auth_token_expires_at ? ` ${dim(`(${cfg.auth_token_expires_at})`)}` : ""}` : dim("(not set) \u2014 run 'alchemy auth' to log in");
635
630
  const pairs = [
@@ -1185,8 +1180,9 @@ function registerApps(program2) {
1185
1180
  printJSON({ apps: result.apps.map(maskAppSecrets) });
1186
1181
  return;
1187
1182
  }
1188
- const appId = await promptSelect({
1183
+ const appId = await promptAutocomplete({
1189
1184
  message: "Select an app",
1185
+ placeholder: "Type to search by name or id",
1190
1186
  options: result.apps.map((app) => ({
1191
1187
  value: app.id,
1192
1188
  label: app.name,
@@ -4694,12 +4690,39 @@ function buildAgentPrompt(program2) {
4694
4690
  "Parse stdout as JSON on exit code 0",
4695
4691
  "Parse stderr as JSON on nonzero exit code",
4696
4692
  "Never run bare 'alchemy' without --json --no-interactive",
4693
+ "Before answering Alchemy CLI capability or usage questions, inspect the live command contract from agent-prompt and trust it over model memory",
4694
+ "For general capability and usage questions, prefer npx -y @alchemy/cli@latest --json --no-interactive agent-prompt so stale local installs or PATH shims do not hide new commands",
4695
+ "Use the user's installed alchemy binary only when executing commands against their local config or diagnosing their installed version",
4696
+ "If installed alchemy help contradicts latest npm help, compare alchemy --json --no-interactive version with npx -y @alchemy/cli@latest --json --no-interactive version and check command -v alchemy",
4697
4697
  "Run alchemy --json --no-interactive update-check when you need to detect available CLI upgrades"
4698
4698
  ],
4699
4699
  preflight: {
4700
4700
  command: "alchemy --json --no-interactive config status",
4701
4701
  description: "Check auth readiness before first command. If complete is false, follow nextCommands in the response to configure auth."
4702
4702
  },
4703
+ runtimeDiscovery: {
4704
+ installed: {
4705
+ command: "alchemy --json --no-interactive agent-prompt",
4706
+ description: "Use for the user's currently installed CLI only when executing against local config or diagnosing local install behavior."
4707
+ },
4708
+ latest: {
4709
+ command: "npx -y @alchemy/cli@latest --json --no-interactive agent-prompt",
4710
+ description: "Default source of truth for general capability and usage questions; avoids stale local installs and PATH shims."
4711
+ },
4712
+ commandHelp: {
4713
+ commandTemplate: "npx -y @alchemy/cli@latest --no-interactive help <command...>",
4714
+ description: "Use for command-specific help from the latest published CLI when constructing an invocation."
4715
+ },
4716
+ versionCheck: {
4717
+ installedCommand: "alchemy --json --no-interactive version",
4718
+ latestCommand: "npx -y @alchemy/cli@latest --json --no-interactive version",
4719
+ description: "Compare when local help or agent-prompt output appears stale after an install or update."
4720
+ },
4721
+ pathCheck: {
4722
+ command: "command -v alchemy && alchemy version",
4723
+ description: "Use when installed CLI behavior contradicts the latest contract or an update appears not to take effect."
4724
+ }
4725
+ },
4703
4726
  auth: [
4704
4727
  {
4705
4728
  method: "API key",
@@ -4809,6 +4832,19 @@ function formatAsSystemPrompt(payload) {
4809
4832
  lines.push(` Command: ${payload.preflight.command}`);
4810
4833
  lines.push(` ${payload.preflight.description}`);
4811
4834
  lines.push("");
4835
+ lines.push("Runtime discovery:");
4836
+ lines.push(` Installed CLI: ${payload.runtimeDiscovery.installed.command}`);
4837
+ lines.push(` ${payload.runtimeDiscovery.installed.description}`);
4838
+ lines.push(` Latest npm CLI: ${payload.runtimeDiscovery.latest.command}`);
4839
+ lines.push(` ${payload.runtimeDiscovery.latest.description}`);
4840
+ lines.push(` Command help: ${payload.runtimeDiscovery.commandHelp.commandTemplate}`);
4841
+ lines.push(` ${payload.runtimeDiscovery.commandHelp.description}`);
4842
+ lines.push(` Installed version: ${payload.runtimeDiscovery.versionCheck.installedCommand}`);
4843
+ lines.push(` Latest npm version: ${payload.runtimeDiscovery.versionCheck.latestCommand}`);
4844
+ lines.push(` ${payload.runtimeDiscovery.versionCheck.description}`);
4845
+ lines.push(` Path check: ${payload.runtimeDiscovery.pathCheck.command}`);
4846
+ lines.push(` ${payload.runtimeDiscovery.pathCheck.description}`);
4847
+ lines.push("");
4812
4848
  lines.push("Auth methods:");
4813
4849
  for (const auth of payload.auth) {
4814
4850
  lines.push(` ${auth.method}:`);
@@ -6599,7 +6635,7 @@ Examples:
6599
6635
  signer: parseSignerOpt(opts.signer)
6600
6636
  });
6601
6637
  } catch (err) {
6602
- const { exitWithError: exitWithError2 } = await import("./errors-3CNFGAXT.js");
6638
+ const { exitWithError: exitWithError2 } = await import("./errors-J6HNGXVA.js");
6603
6639
  exitWithError2(err);
6604
6640
  }
6605
6641
  });
@@ -7953,7 +7989,7 @@ function resetUpdateNoticeState() {
7953
7989
  }
7954
7990
  program.name("alchemy").description(
7955
7991
  "The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
7956
- ).version("0.7.0", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option(
7992
+ ).version("0.7.2", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option(
7957
7993
  "-n, --network <network>",
7958
7994
  "Target network (default: eth-mainnet) (env: ALCHEMY_NETWORK)"
7959
7995
  ).option("--x402", "Use x402 wallet-based gateway auth").option(
@@ -8140,11 +8176,11 @@ ${styledLine}`;
8140
8176
  "wallet"
8141
8177
  ];
8142
8178
  if (!skipAppPrompt.includes(cmdName) && isInteractiveAllowed(program) && !opts.apiKey && !process.env.ALCHEMY_API_KEY) {
8143
- const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-R4JZZCCF.js");
8179
+ const { resolveAuthToken: resolveAuthToken2 } = await import("./resolve-ZCR3YCHJ.js");
8144
8180
  const authToken = resolveAuthToken2(cfg);
8145
8181
  const hasApiKey = Boolean(cfg.api_key?.trim() || cfg.app?.apiKey);
8146
8182
  if (authToken && !hasApiKey) {
8147
- const { selectAppAfterAuth } = await import("./auth-4HAUNG54.js");
8183
+ const { selectAppAfterAuth } = await import("./auth-7QNYRHIK.js");
8148
8184
  console.log("");
8149
8185
  console.log(` No app selected. Please select an app to continue.`);
8150
8186
  await selectAppAfterAuth(authToken);
@@ -8159,6 +8195,9 @@ ${styledLine}`;
8159
8195
  }
8160
8196
  }
8161
8197
  resetUpdateNoticeState();
8198
+ if (!isReplMode()) {
8199
+ process.exit(0);
8200
+ }
8162
8201
  }).action(async (_opts, cmd) => {
8163
8202
  const excessArgs = cmd.args;
8164
8203
  if (excessArgs.length > 0) {
@@ -8175,7 +8214,7 @@ ${styledLine}`;
8175
8214
  if (isInteractiveAllowed(program)) {
8176
8215
  let latestForInteractiveStartup = null;
8177
8216
  if (shouldRunOnboarding(program, cfg)) {
8178
- const { runOnboarding } = await import("./onboarding-RBJF5E7U.js");
8217
+ const { runOnboarding } = await import("./onboarding-WN3IMTGS.js");
8179
8218
  const latest = getAvailableUpdateOnce();
8180
8219
  const completed = await runOnboarding(program, latest);
8181
8220
  updateShownDuringInteractiveStartup = Boolean(latest);
@@ -8189,7 +8228,7 @@ ${styledLine}`;
8189
8228
  latestForInteractiveStartup
8190
8229
  );
8191
8230
  }
8192
- const { startREPL } = await import("./interactive-F2AFLW7U.js");
8231
+ const { startREPL } = await import("./interactive-JNTFVCUJ.js");
8193
8232
  program.exitOverride();
8194
8233
  program.configureOutput({
8195
8234
  writeErr: () => {
@@ -2,14 +2,14 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  getSetupMethod
5
- } from "./chunk-V4IK4CJN.js";
6
- import "./chunk-HYCRHNPX.js";
5
+ } from "./chunk-EZ2ZD7YO.js";
6
+ import "./chunk-RE5HSYJJ.js";
7
7
  import {
8
8
  getRPCNetworkIds
9
- } from "./chunk-TOEVZMIP.js";
9
+ } from "./chunk-5LCA2B6S.js";
10
10
  import {
11
11
  getUpdateNoticeLines
12
- } from "./chunk-WWWVMK3J.js";
12
+ } from "./chunk-MB6REYQL.js";
13
13
  import {
14
14
  bold,
15
15
  brand,
@@ -17,18 +17,18 @@ import {
17
17
  dim,
18
18
  green,
19
19
  setBrandedHelpSuppressed
20
- } from "./chunk-A6L3WCJN.js";
20
+ } from "./chunk-DGKUBK7G.js";
21
21
  import {
22
22
  configDir,
23
23
  load
24
- } from "./chunk-7WD3YLRK.js";
24
+ } from "./chunk-BAZ4NGOD.js";
25
25
  import {
26
26
  bgRgb,
27
27
  isJSONMode,
28
28
  noColor,
29
29
  rgb,
30
30
  setReplMode
31
- } from "./chunk-QEDAULQ2.js";
31
+ } from "./chunk-KLPWJFWP.js";
32
32
 
33
33
  // src/commands/interactive.ts
34
34
  import * as readline from "readline";
@@ -436,6 +436,9 @@ async function startREPL(program, latestUpdate = null) {
436
436
  };
437
437
  return new Promise((resolve) => {
438
438
  rl.on("line", (line) => void onLine(line));
439
+ rl.on("SIGINT", () => {
440
+ rl.close();
441
+ });
439
442
  rl.on("close", () => {
440
443
  if (Array.isArray(rlWithHistory.history)) {
441
444
  saveReplHistory([...rlWithHistory.history].reverse());
@@ -2,7 +2,7 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  getUpdateNoticeLines
5
- } from "./chunk-WWWVMK3J.js";
5
+ } from "./chunk-MB6REYQL.js";
6
6
  import {
7
7
  bold,
8
8
  brand,
@@ -10,12 +10,12 @@ import {
10
10
  dim,
11
11
  green,
12
12
  promptText
13
- } from "./chunk-A6L3WCJN.js";
13
+ } from "./chunk-DGKUBK7G.js";
14
14
  import {
15
15
  load,
16
16
  save
17
- } from "./chunk-7WD3YLRK.js";
18
- import "./chunk-QEDAULQ2.js";
17
+ } from "./chunk-BAZ4NGOD.js";
18
+ import "./chunk-KLPWJFWP.js";
19
19
 
20
20
  // src/commands/onboarding.ts
21
21
  async function runOnboarding(_program, latestUpdate = null) {
@@ -38,7 +38,7 @@ async function runOnboarding(_program, latestUpdate = null) {
38
38
  if (answer === null) {
39
39
  return false;
40
40
  }
41
- const { performBrowserLogin, AUTH_PORT, getLoginUrl } = await import("./auth-JGON2JU6.js");
41
+ const { performBrowserLogin, AUTH_PORT, getLoginUrl } = await import("./auth-TA3SL4BL.js");
42
42
  console.log(` Opening browser to log in...`);
43
43
  console.log(` ${dim(getLoginUrl(AUTH_PORT))}`);
44
44
  console.log(` ${dim("Waiting for authentication...")}`);
@@ -51,7 +51,7 @@ async function runOnboarding(_program, latestUpdate = null) {
51
51
  auth_token_expires_at: result.expiresAt
52
52
  });
53
53
  console.log(` ${green("\u2713")} Logged in successfully`);
54
- const { selectAppAfterAuth } = await import("./auth-4HAUNG54.js");
54
+ const { selectAppAfterAuth } = await import("./auth-7QNYRHIK.js");
55
55
  await selectAppAfterAuth(result.token);
56
56
  return true;
57
57
  } catch (err) {
@@ -22,9 +22,9 @@ import {
22
22
  resolveWalletSession,
23
23
  resolveX402,
24
24
  resolveX402Client
25
- } from "./chunk-TOEVZMIP.js";
26
- import "./chunk-7WD3YLRK.js";
27
- import "./chunk-QEDAULQ2.js";
25
+ } from "./chunk-5LCA2B6S.js";
26
+ import "./chunk-BAZ4NGOD.js";
27
+ import "./chunk-KLPWJFWP.js";
28
28
  export {
29
29
  adminClientFromFlags,
30
30
  clientFromFlags,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/cli",
3
- "version": "0.7.0",
3
+ "version": "0.7.2",
4
4
  "description": "Alchemy CLI — interact with blockchain data",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,16 +0,0 @@
1
- #!/usr/bin/env node
2
- if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
- import {
4
- registerAuth,
5
- selectAppAfterAuth
6
- } from "./chunk-I3X4G2UY.js";
7
- import "./chunk-HSKKIATB.js";
8
- import "./chunk-HYCRHNPX.js";
9
- import "./chunk-TOEVZMIP.js";
10
- import "./chunk-A6L3WCJN.js";
11
- import "./chunk-7WD3YLRK.js";
12
- import "./chunk-QEDAULQ2.js";
13
- export {
14
- registerAuth,
15
- selectAppAfterAuth
16
- };