feat: update cli to work with up to date developer api#11
feat: update cli to work with up to date developer api#11alitariksahin wants to merge 5 commits intomainfrom
Conversation
|
let's also document usage with read only token, nothing extra, just mention as a suggested way to use with agents |
|
There was a problem hiding this comment.
Pull request overview
This PR migrates the Upstash CLI from the previous Deno/Cliffy implementation to a Node.js/TypeScript + commander CLI aligned with the current Upstash Developer API, with a strong focus on non-interactive JSON I/O for automation/agents.
Changes:
- Replaces the Deno-based CLI entrypoint, config/auth helpers, and HTTP client with a Node.js (
commander) CLI + shared request/auth/output helpers. - Adds new/updated command implementations for Redis, Team, Vector, Search, and QStash using
/v2/...Developer API endpoints. - Updates packaging/build setup (TypeScript
tsc, npm package metadata) and refreshes docs for the new CLI behavior.
Reviewed changes
Copilot reviewed 93 out of 97 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
| tsconfig.json | Adds TypeScript compiler configuration for Node (ESM, Node16 resolution, dist output). |
| src/version.ts | Removes build-time version constant from the old Deno build pipeline. |
| src/util/http.ts | Removes the old Deno/isomorphic-fetch HTTP client wrapper. |
| src/util/command.ts | Removes the Cliffy-based Command wrapper type. |
| src/util/auth.ts | Removes config-file-based Basic auth header generation. |
| src/types.ts | Introduces shared API payload types and allowed-value lists (regions, plans, etc.). |
| src/output.ts | Adds shared JSON stdout printing and JSON stderr error handling. |
| src/mod.ts | Removes the Deno CLI entrypoint. |
| src/deps.ts | Removes Deno URL imports for Cliffy/std libs. |
| src/config.ts | Removes local config file read/write support. |
| src/commands/vector/transfer.ts | Adds vector index transfer command using Developer API. |
| src/commands/vector/stats.ts | Adds vector stats and per-index stats commands. |
| src/commands/vector/set-plan.ts | Adds vector index plan change command. |
| src/commands/vector/reset-password.ts | Adds vector token reset command. |
| src/commands/vector/rename.ts | Adds vector index rename command. |
| src/commands/vector/list.ts | Adds vector index list command. |
| src/commands/vector/index.ts | Registers vector subcommands under upstash vector. |
| src/commands/vector/get.ts | Adds vector index get command. |
| src/commands/vector/delete.ts | Adds vector index delete command (with dry-run). |
| src/commands/vector/create.ts | Adds vector index create command. |
| src/commands/team/remove-member.ts | Adds team member removal command (with dry-run). |
| src/commands/team/remove_member.ts | Removes old Deno/Cliffy team member removal implementation. |
| src/commands/team/mod.ts | Removes old Deno/Cliffy team command module. |
| src/commands/team/members.ts | Adds team member listing command. |
| src/commands/team/list.ts | Reimplements team list using Node + shared request/auth/output. |
| src/commands/team/list_members.ts | Removes old Deno/Cliffy members list implementation. |
| src/commands/team/index.ts | Registers team subcommands under upstash team. |
| src/commands/team/delete.ts | Reimplements team delete using Node + shared request/auth/output (with dry-run). |
| src/commands/team/create.ts | Reimplements team create using Node + shared request/auth/output. |
| src/commands/team/add-member.ts | Adds team member add command with role validation. |
| src/commands/team/add_member.ts | Removes old Deno/Cliffy add-member implementation. |
| src/commands/search/transfer.ts | Adds search index transfer command. |
| src/commands/search/stats.ts | Adds search stats and per-index stats commands. |
| src/commands/search/reset-password.ts | Adds search token reset command. |
| src/commands/search/rename.ts | Adds search index rename command. |
| src/commands/search/list.ts | Adds search index list command. |
| src/commands/search/index.ts | Registers search subcommands under upstash search. |
| src/commands/search/get.ts | Adds search index get command. |
| src/commands/search/delete.ts | Adds search index delete command (with dry-run). |
| src/commands/search/create.ts | Adds search index create command. |
| src/commands/redis/update-regions.ts | Adds Redis read-replica region update command. |
| src/commands/redis/update-budget.ts | Adds Redis budget update command. |
| src/commands/redis/types.ts | Removes old Redis command-local type definition. |
| src/commands/redis/stats.ts | Reimplements Redis stats using Node + shared request/auth/output. |
| src/commands/redis/reset-password.ts | Adds Redis password reset command. |
| src/commands/redis/reset_password.ts | Removes old Deno/Cliffy reset-password implementation. |
| src/commands/redis/rename.ts | Reimplements Redis rename using Node + shared request/auth/output. |
| src/commands/redis/move-to-team.ts | Adds Redis move-to-team command. |
| src/commands/redis/move_to_team.ts | Removes old Deno/Cliffy move-to-team implementation. |
| src/commands/redis/mod.ts | Removes old Deno/Cliffy Redis command module. |
| src/commands/redis/list.ts | Reimplements Redis list using Node + shared request/auth/output. |
| src/commands/redis/index.ts | Registers Redis subcommands under upstash redis. |
| src/commands/redis/get.ts | Reimplements Redis get using Node + shared request/auth/output (+ hide credentials). |
| src/commands/redis/exec.ts | Adds Redis REST exec command (uses DB REST token, not Developer API key). |
| src/commands/redis/enable-tls.ts | Adds Redis enable TLS command. |
| src/commands/redis/enable-eviction.ts | Adds Redis enable eviction command. |
| src/commands/redis/enable-autoupgrade.ts | Adds Redis enable autoupgrade command. |
| src/commands/redis/enable_multizone_replication.ts | Removes old Deno/Cliffy multizone replication command implementation. |
| src/commands/redis/disable-eviction.ts | Adds Redis disable eviction command. |
| src/commands/redis/disable-autoupgrade.ts | Adds Redis disable autoupgrade command. |
| src/commands/redis/delete.ts | Reimplements Redis delete using Node + shared request/auth/output (with dry-run). |
| src/commands/redis/create.ts | Reimplements Redis create using Node + shared request/auth/output. |
| src/commands/redis/change-plan.ts | Adds Redis change-plan command. |
| src/commands/redis/backup/restore.ts | Adds Redis backup restore command. |
| src/commands/redis/backup/list.ts | Adds Redis backup list command. |
| src/commands/redis/backup/index.ts | Registers Redis backup subcommands. |
| src/commands/redis/backup/enable-daily.ts | Adds enable daily backup command. |
| src/commands/redis/backup/disable-daily.ts | Adds disable daily backup command. |
| src/commands/redis/backup/delete.ts | Adds delete backup command (with dry-run). |
| src/commands/redis/backup/create.ts | Adds create backup command. |
| src/commands/qstash/update-budget.ts | Adds QStash budget update command. |
| src/commands/qstash/stats.ts | Adds QStash stats command (with period option). |
| src/commands/qstash/set-plan.ts | Adds QStash set-plan command. |
| src/commands/qstash/rotate-token.ts | Adds QStash rotate-token command. |
| src/commands/qstash/move-to-team.ts | Adds QStash move-to-team command. |
| src/commands/qstash/list.ts | Adds QStash list command. |
| src/commands/qstash/ipv4.ts | Adds QStash ipv4 CIDR listing command. |
| src/commands/qstash/index.ts | Registers QStash subcommands under upstash qstash. |
| src/commands/qstash/get.ts | Adds QStash get command. |
| src/commands/qstash/enable-prodpack.ts | Adds QStash enable-prodpack command. |
| src/commands/qstash/disable-prodpack.ts | Adds QStash disable-prodpack command. |
| src/commands/auth/whoami.ts | Removes old Deno/Cliffy auth whoami command. |
| src/commands/auth/mod.ts | Removes old Deno/Cliffy auth module registration. |
| src/commands/auth/logout.ts | Removes old Deno/Cliffy logout command. |
| src/commands/auth/login.ts | Removes old Deno/Cliffy login command (config-file based). |
| src/client.ts | Adds shared Developer API request helper (Basic auth + JSON parsing). |
| src/cli.ts | Adds the Node CLI entrypoint and command registration. |
| src/auth.ts | Adds env/flag-based auth resolution helper. |
| README.md | Updates docs to match new non-interactive JSON CLI behavior and command catalog. |
| package.json | Adds npm package metadata, commander dependency, and tsc build scripts. |
| package-lock.json | Adds lockfile for new npm-based dependency graph. |
| Makefile | Removes Deno-focused build/compile targets. |
| cmd/build.ts | Removes the Deno dnt build script previously used for publishing. |
| CLAUDE.md | Adds agent-oriented CLI skill documentation. |
| .gitignore | Adds node_modules to ignored paths. |
| .agents/skills/upstash-cli/SKILL.md | Adds packaged agent skill documentation for the CLI. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if (!(REGIONS as readonly string[]).includes(flags.region)) { | ||
| console.error(JSON.stringify({ error: `Invalid region '${flags.region}'. Available: ${REGIONS.join(", ")}` })); | ||
| process.exit(1); | ||
| } |
There was a problem hiding this comment.
This branch manually prints a JSON error and calls process.exit(1). To keep error formatting and exit behavior consistent across the CLI (and avoid duplicating logic), consider routing this through the shared handleError helper instead.
| } catch (err) { | ||
| handleError(err); | ||
| } |
There was a problem hiding this comment.
do we actually need try catch & handleError() on every command?? Can't we add this to a higher level so we wouldn't have to have try catches on every command?
No description provided.