@alchemy/cli 0.3.0 → 0.3.1

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.
@@ -4,10 +4,13 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
4
4
  // src/lib/colors.ts
5
5
  var forceColor = "FORCE_COLOR" in process.env && process.env.FORCE_COLOR !== "0";
6
6
  var noColor = !forceColor && ("NO_COLOR" in process.env || process.env.TERM === "dumb");
7
+ function setNoColor(value) {
8
+ noColor = value;
9
+ }
7
10
  var identity = (s) => s;
8
- var esc = (code) => noColor ? identity : (s) => `\x1B[${code}m${s}\x1B[0m`;
9
- var rgb = (r, g, b) => noColor ? identity : (s) => `\x1B[38;2;${r};${g};${b}m${s}\x1B[39m`;
10
- var bgRgb = (r, g, b) => noColor ? identity : (s) => `\x1B[48;2;${r};${g};${b}m${s}\x1B[49m`;
11
+ var esc = (code) => (s) => noColor ? s : `\x1B[${code}m${s}\x1B[0m`;
12
+ var rgb = (r, g, b) => (s) => noColor ? s : `\x1B[38;2;${r};${g};${b}m${s}\x1B[39m`;
13
+ var bgRgb = (r, g, b) => (s) => noColor ? s : `\x1B[48;2;${r};${g};${b}m${s}\x1B[49m`;
11
14
 
12
15
  // src/lib/redact.ts
13
16
  var SENSITIVE_ERROR_CODES = /* @__PURE__ */ new Set([
@@ -475,7 +478,8 @@ function getHome() {
475
478
  }
476
479
  function configPath() {
477
480
  if (process.env.ALCHEMY_CONFIG) return process.env.ALCHEMY_CONFIG;
478
- return join(getHome(), ".config", "alchemy", "config.json");
481
+ const configHome = process.env.XDG_CONFIG_HOME || join(getHome(), ".config");
482
+ return join(configHome, "alchemy", "config.json");
479
483
  }
480
484
  function configDir() {
481
485
  return dirname(configPath());
@@ -1110,7 +1114,7 @@ function semverLT(a, b) {
1110
1114
  return false;
1111
1115
  }
1112
1116
  function currentVersion() {
1113
- return true ? "0.3.0" : "0.0.0";
1117
+ return true ? "0.3.1" : "0.0.0";
1114
1118
  }
1115
1119
  function toUpdateStatus(latestVersion, checkedAt) {
1116
1120
  const current = currentVersion();
@@ -1169,6 +1173,7 @@ ${getUpdateNoticeLines(latest).join("\n")}
1169
1173
 
1170
1174
  export {
1171
1175
  noColor,
1176
+ setNoColor,
1172
1177
  identity,
1173
1178
  esc,
1174
1179
  rgb,
@@ -43,7 +43,7 @@ import {
43
43
  verbose,
44
44
  withSpinner,
45
45
  yellow
46
- } from "./chunk-MF6DXNO7.js";
46
+ } from "./chunk-6XTLILDF.js";
47
47
 
48
48
  // src/lib/client-utils.ts
49
49
  function isLocalhost(hostname) {
@@ -2,7 +2,7 @@
2
2
  if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  isInteractiveAllowed
5
- } from "./chunk-MF6DXNO7.js";
5
+ } from "./chunk-6XTLILDF.js";
6
6
 
7
7
  // src/lib/networks.ts
8
8
  var TESTNET_TOKEN_RE = /(testnet|sepolia|holesky|hoodi|devnet|minato|amoy|fuji|saigon|cardona|aeneid|curtis|chiado|cassiopeia|blaze|ropsten|signet|mocha|fam|bepolia)$/i;
package/dist/index.js CHANGED
@@ -15,14 +15,14 @@ import {
15
15
  splitCommaList,
16
16
  validateAddress,
17
17
  validateTxHash
18
- } from "./chunk-UPQTWEPP.js";
18
+ } from "./chunk-J6RZM4CJ.js";
19
19
  import {
20
20
  getRPCNetworks,
21
21
  getSetupStatus,
22
22
  isSetupComplete,
23
23
  nativeTokenSymbol,
24
24
  shouldRunOnboarding
25
- } from "./chunk-VYQ5V2ZR.js";
25
+ } from "./chunk-QDDJ3OYO.js";
26
26
  import {
27
27
  EXIT_CODES,
28
28
  ErrorCode,
@@ -59,16 +59,18 @@ import {
59
59
  printSyntaxJSON,
60
60
  printTable,
61
61
  printUpdateNotice,
62
+ promptConfirm,
62
63
  promptSelect,
63
64
  quiet,
64
65
  red,
65
66
  setFlags,
67
+ setNoColor,
66
68
  successBadge,
67
69
  timeAgo,
68
70
  verbose,
69
71
  weiToEth,
70
72
  withSpinner
71
- } from "./chunk-MF6DXNO7.js";
73
+ } from "./chunk-6XTLILDF.js";
72
74
 
73
75
  // src/index.ts
74
76
  import { Command, Help } from "commander";
@@ -1037,9 +1039,21 @@ function registerApps(program2) {
1037
1039
  exitWithError(err);
1038
1040
  }
1039
1041
  });
1040
- cmd.command("delete <id>").description("Delete an app").option("--dry-run", "Preview without executing").action(async (id, opts) => {
1042
+ cmd.command("delete <id>").description("Delete an app").option("--dry-run", "Preview without executing").option("-y, --yes", "Skip confirmation prompt").action(async (id, opts) => {
1041
1043
  try {
1042
1044
  if (handleDryRun(opts, "delete", { id }, `Would delete app ${id}`)) return;
1045
+ if (!opts.yes && isInteractiveAllowed(program2)) {
1046
+ const proceed = await promptConfirm({
1047
+ message: `Delete app ${id}?`,
1048
+ initialValue: false,
1049
+ cancelMessage: "Cancelled app deletion."
1050
+ });
1051
+ if (proceed === null) return;
1052
+ if (!proceed) {
1053
+ console.log(` ${dim("Skipped app deletion.")}`);
1054
+ return;
1055
+ }
1056
+ }
1043
1057
  const admin = adminClientFromFlags(program2);
1044
1058
  await withSpinner(
1045
1059
  "Deleting app\u2026",
@@ -1734,8 +1748,20 @@ function registerWebhooks(program2) {
1734
1748
  exitWithError(err);
1735
1749
  }
1736
1750
  });
1737
- cmd.command("delete <webhookId>").description("Delete webhook").action(async (webhookId) => {
1751
+ cmd.command("delete <webhookId>").description("Delete webhook").option("-y, --yes", "Skip confirmation prompt").action(async (webhookId, opts) => {
1738
1752
  try {
1753
+ if (!opts.yes && isInteractiveAllowed(program2)) {
1754
+ const proceed = await promptConfirm({
1755
+ message: `Delete webhook ${webhookId}?`,
1756
+ initialValue: false,
1757
+ cancelMessage: "Cancelled webhook deletion."
1758
+ });
1759
+ if (proceed === null) return;
1760
+ if (!proceed) {
1761
+ console.log(` ${dim("Skipped webhook deletion.")}`);
1762
+ return;
1763
+ }
1764
+ }
1739
1765
  const token = resolveWebhookApiKey(cmd.opts());
1740
1766
  const result = await withSpinner(
1741
1767
  "Deleting webhook\u2026",
@@ -2500,7 +2526,7 @@ function resetUpdateNoticeState() {
2500
2526
  }
2501
2527
  program.name("alchemy").description(
2502
2528
  "The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
2503
- ).version("0.3.0", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option("--access-key <key>", "Alchemy access key (env: ALCHEMY_ACCESS_KEY)").option(
2529
+ ).version("0.3.1", "-v, --version", "display CLI version").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option("--access-key <key>", "Alchemy access key (env: ALCHEMY_ACCESS_KEY)").option(
2504
2530
  "-n, --network <network>",
2505
2531
  "Target network (default: eth-mainnet) (env: ALCHEMY_NETWORK)"
2506
2532
  ).option("--x402", "Use x402 wallet-based gateway auth").option("--wallet-key-file <path>", "Path to wallet private key file for x402").option("--json", "Force JSON output (auto-enabled when piped)").option("-q, --quiet", "Suppress non-essential output").option("--verbose", "Enable verbose output").option("--no-color", "Disable color output").option("--reveal", "Show secrets in plain text (TTY only)").option("--timeout <ms>", "Request timeout in milliseconds", parseInt).option("--debug", "Enable debug diagnostics").option("--no-interactive", "Disable REPL and prompt-driven interactions").addHelpCommand(false).allowExcessArguments(true).exitOverride((err) => {
@@ -2645,6 +2671,7 @@ ${styledLine}`;
2645
2671
  ].join("\n");
2646
2672
  }).hook("preAction", () => {
2647
2673
  const opts = program.opts();
2674
+ if (opts.color === false) setNoColor(true);
2648
2675
  const cfg = load();
2649
2676
  setFlags({
2650
2677
  json: opts.json,
@@ -2679,7 +2706,7 @@ ${styledLine}`;
2679
2706
  if (isInteractiveAllowed(program)) {
2680
2707
  let latestForInteractiveStartup = null;
2681
2708
  if (shouldRunOnboarding(program, cfg)) {
2682
- const { runOnboarding } = await import("./onboarding-MUJF5QIE.js");
2709
+ const { runOnboarding } = await import("./onboarding-XNAWN5BR.js");
2683
2710
  const latest = getAvailableUpdateOnce();
2684
2711
  const completed = await runOnboarding(program, latest);
2685
2712
  updateShownDuringInteractiveStartup = Boolean(latest);
@@ -2691,7 +2718,7 @@ ${styledLine}`;
2691
2718
  latestForInteractiveStartup = getAvailableUpdateOnce();
2692
2719
  updateShownDuringInteractiveStartup = Boolean(latestForInteractiveStartup);
2693
2720
  }
2694
- const { startREPL } = await import("./interactive-BFAXB5SN.js");
2721
+ const { startREPL } = await import("./interactive-CLPT5QDZ.js");
2695
2722
  program.exitOverride();
2696
2723
  program.configureOutput({
2697
2724
  writeErr: () => {
@@ -3,7 +3,7 @@ if(process.argv.includes("--no-color"))process.env.NO_COLOR="1";
3
3
  import {
4
4
  getRPCNetworkIds,
5
5
  getSetupMethod
6
- } from "./chunk-VYQ5V2ZR.js";
6
+ } from "./chunk-QDDJ3OYO.js";
7
7
  import {
8
8
  bgRgb,
9
9
  bold,
@@ -19,7 +19,7 @@ import {
19
19
  rgb,
20
20
  setBrandedHelpSuppressed,
21
21
  setReplMode
22
- } from "./chunk-MF6DXNO7.js";
22
+ } from "./chunk-6XTLILDF.js";
23
23
 
24
24
  // src/commands/interactive.ts
25
25
  import * as readline from "readline";
@@ -5,7 +5,7 @@ import {
5
5
  generateAndPersistWallet,
6
6
  importAndPersistWallet,
7
7
  selectOrCreateApp
8
- } from "./chunk-UPQTWEPP.js";
8
+ } from "./chunk-J6RZM4CJ.js";
9
9
  import {
10
10
  bold,
11
11
  brand,
@@ -19,7 +19,7 @@ import {
19
19
  promptSelect,
20
20
  promptText,
21
21
  save
22
- } from "./chunk-MF6DXNO7.js";
22
+ } from "./chunk-6XTLILDF.js";
23
23
 
24
24
  // src/commands/onboarding.ts
25
25
  function printNextSteps(method) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alchemy/cli",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Alchemy CLI — interact with blockchain data",
5
5
  "type": "module",
6
6
  "bin": {