@alchemy/cli 0.1.3 → 0.1.5
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 +65 -9
- package/dist/index.js +1 -1
- package/package.json +11 -4
- package/scripts/postinstall.cjs +17 -0
package/README.md
CHANGED
|
@@ -6,18 +6,17 @@ You can use API keys, access keys, or x402 wallet auth depending on the command.
|
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Install globally from npm:
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
|
|
13
|
-
cd alchemy-cli
|
|
14
|
-
pnpm install
|
|
15
|
-
pnpm build
|
|
16
|
-
pnpm link --global
|
|
12
|
+
npm i -g @alchemy/cli
|
|
17
13
|
```
|
|
18
14
|
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
Or run without installing globally:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npx @alchemy/cli <command>
|
|
19
|
+
```
|
|
21
20
|
|
|
22
21
|
## Command Reference
|
|
23
22
|
|
|
@@ -283,9 +282,22 @@ Errors are structured JSON in JSON mode:
|
|
|
283
282
|
|
|
284
283
|
Prerequisites:
|
|
285
284
|
|
|
286
|
-
- [Node.js
|
|
285
|
+
- [Node.js 22+](https://nodejs.org/)
|
|
287
286
|
- [pnpm](https://pnpm.io/)
|
|
288
287
|
|
|
288
|
+
### Local development setup
|
|
289
|
+
|
|
290
|
+
```bash
|
|
291
|
+
git clone https://github.com/alchemyplatform/alchemy-cli.git
|
|
292
|
+
cd alchemy-cli
|
|
293
|
+
pnpm install
|
|
294
|
+
pnpm build
|
|
295
|
+
pnpm link --global
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
This makes the local `alchemy` build available globally for testing.
|
|
299
|
+
To unlink later: `pnpm unlink --global`.
|
|
300
|
+
|
|
289
301
|
Run during development:
|
|
290
302
|
|
|
291
303
|
```bash
|
|
@@ -321,6 +333,50 @@ Coverage:
|
|
|
321
333
|
pnpm test:coverage
|
|
322
334
|
```
|
|
323
335
|
|
|
336
|
+
### Changesets & Releasing
|
|
337
|
+
|
|
338
|
+
This project uses [Changesets](https://github.com/changesets/changesets) for versioning and release notes.
|
|
339
|
+
|
|
340
|
+
**When to add a changeset:** Any PR with user-facing changes (new commands, bug fixes, flag changes, output format changes) needs a changeset. Internal changes (CI, refactors with no behavior change, docs) can skip by adding the `no-changeset` label.
|
|
341
|
+
|
|
342
|
+
**How to add a changeset:**
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
pnpm changeset
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
You'll be prompted to pick the bump type:
|
|
349
|
+
- **patch** — bug fixes, small tweaks (e.g. fixing `--json` output for a command)
|
|
350
|
+
- **minor** — new commands, new flags, new capabilities
|
|
351
|
+
- **major** — breaking changes (removed commands, changed flag behavior, output format changes)
|
|
352
|
+
|
|
353
|
+
This creates a file like `.changeset/cool-dogs-fly.md`:
|
|
354
|
+
|
|
355
|
+
```markdown
|
|
356
|
+
---
|
|
357
|
+
"@alchemy/cli": minor
|
|
358
|
+
---
|
|
359
|
+
|
|
360
|
+
Add `alchemy portfolio transactions` command for portfolio transaction history.
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
Write a 1-2 sentence summary of the change from a user's perspective. Commit this file with your PR.
|
|
364
|
+
|
|
365
|
+
**How releases work:** When PRs with changesets merge to `main`, the publish workflow automatically:
|
|
366
|
+
1. Verifies the build (typecheck, build, test)
|
|
367
|
+
2. Applies version bumps and updates `CHANGELOG.md` via `changeset version`
|
|
368
|
+
3. Creates a signed release commit via the GitHub Git Database API (using a GitHub App token)
|
|
369
|
+
4. Publishes to npm using OIDC trusted publishing (no long-lived npm token)
|
|
370
|
+
5. Creates a GitHub release/tag with notes extracted from `CHANGELOG.md`
|
|
371
|
+
|
|
372
|
+
If no changesets are pending, the workflow exits cleanly — no release is created.
|
|
373
|
+
|
|
374
|
+
**Release infrastructure:**
|
|
375
|
+
- Repository write operations use a GitHub App (`APP_ID` variable + `APP_PRIVATE_KEY` secret)
|
|
376
|
+
- npm publish uses [trusted publishing](https://docs.npmjs.com/generating-provenance-statements) (OIDC) — no `NPM_TOKEN` secret required
|
|
377
|
+
- Required GitHub repo settings: `APP_ID` (variable), `APP_PRIVATE_KEY` (secret)
|
|
378
|
+
- Required npm-side: configure trusted publishing for this repo/workflow at npmjs.com package settings
|
|
379
|
+
|
|
324
380
|
### Endpoint Override Env Vars (Local Testing Only)
|
|
325
381
|
|
|
326
382
|
These are for local/mock testing, not normal production usage:
|
package/dist/index.js
CHANGED
|
@@ -1683,7 +1683,7 @@ var findCommandByPath = (root, path) => {
|
|
|
1683
1683
|
};
|
|
1684
1684
|
program.name("alchemy").description(
|
|
1685
1685
|
"The Alchemy CLI lets you query blockchain data, call JSON-RPC methods, and manage your Alchemy configuration."
|
|
1686
|
-
).version("0.1.
|
|
1686
|
+
).version("0.1.5").option("--api-key <key>", "Alchemy API key (env: ALCHEMY_API_KEY)").option("--access-key <key>", "Alchemy access key (env: ALCHEMY_ACCESS_KEY)").option(
|
|
1687
1687
|
"-n, --network <network>",
|
|
1688
1688
|
"Target network (default: eth-mainnet) (env: ALCHEMY_NETWORK)"
|
|
1689
1689
|
).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").option("-q, --quiet", "Suppress non-essential output").option("-v, --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).configureOutput({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alchemy/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "Alchemy CLI — interact with blockchain data",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
],
|
|
15
15
|
"files": [
|
|
16
16
|
"dist",
|
|
17
|
-
"README.md"
|
|
17
|
+
"README.md",
|
|
18
|
+
"scripts/postinstall.cjs"
|
|
18
19
|
],
|
|
19
20
|
"repository": {
|
|
20
21
|
"type": "git",
|
|
@@ -25,7 +26,7 @@
|
|
|
25
26
|
},
|
|
26
27
|
"license": "MIT",
|
|
27
28
|
"engines": {
|
|
28
|
-
"node": ">=
|
|
29
|
+
"node": ">=22"
|
|
29
30
|
},
|
|
30
31
|
"dependencies": {
|
|
31
32
|
"@alchemy/x402": "^0.4.0",
|
|
@@ -34,6 +35,8 @@
|
|
|
34
35
|
"zod": "^4.3.6"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
38
|
+
"@changesets/changelog-github": "^0.6.0",
|
|
39
|
+
"@changesets/cli": "^2.30.0",
|
|
37
40
|
"@types/node": "^25.3.0",
|
|
38
41
|
"@vitest/coverage-v8": "^4.0.18",
|
|
39
42
|
"tsup": "^8.5.1",
|
|
@@ -44,10 +47,14 @@
|
|
|
44
47
|
"scripts": {
|
|
45
48
|
"build": "tsup",
|
|
46
49
|
"dev": "tsup --watch",
|
|
50
|
+
"postinstall": "node ./scripts/postinstall.cjs",
|
|
47
51
|
"test": "vitest run",
|
|
48
52
|
"test:coverage": "vitest run --coverage",
|
|
49
53
|
"test:e2e": "pnpm build && vitest run --config vitest.e2e.config.ts",
|
|
50
54
|
"test:watch": "vitest",
|
|
51
|
-
"lint": "tsc --noEmit"
|
|
55
|
+
"lint": "tsc --noEmit",
|
|
56
|
+
"changeset": "changeset",
|
|
57
|
+
"version-packages": "changeset version",
|
|
58
|
+
"release": "pnpm build && changeset publish"
|
|
52
59
|
}
|
|
53
60
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
function isGlobalInstall() {
|
|
4
|
+
return process.env.npm_config_global === "true";
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function isCI() {
|
|
8
|
+
return process.env.CI === "true";
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
if (isGlobalInstall() && !isCI()) {
|
|
12
|
+
// Keep this concise so it stays readable in npm install output.
|
|
13
|
+
console.log("");
|
|
14
|
+
console.log("◆ Alchemy CLI installed");
|
|
15
|
+
console.log(" Run `alchemy` to get started.");
|
|
16
|
+
console.log("");
|
|
17
|
+
}
|