Files
Felix ZhangandGitHub ec303e9d2e Add @base-org/account-cli package scaffolding (#257)
* Add @base-org/account-cli package scaffolding

Establish the account-cli workspace package with build tooling,
entry point, type system, and output formatting — ready for
commands to be added incrementally.

Made-with: Cursor

* Add account-cli unit tests to fix CI

Vitest exits with code 1 when no test files are found, which
caused the Tests job to fail. Add tests for CLIError and the
output formatting helpers.

Made-with: Cursor

* Fix shebang injection and license mismatch in account-cli

Add postbuild script to prepend #!/usr/bin/env node to dist/index.js
since tsc strips shebangs. Align license to MIT to match root package
and remove non-existent LICENSE from files array.

Made-with: Cursor
2026-03-23 11:03:27 -06:00

1.4 KiB

@base-org/account-cli

Agent-first CLI for interacting with a user's Base Account.

Development

Prerequisites

# Build the SDK dependency (account-cli depends on @base-org/account)
yarn workspace @base-org/account build

Build & Run

# Build the CLI
yarn workspace @base-org/account-cli build

# Run it
node packages/account-cli/dist/index.js --help

Watch Mode

yarn workspace @base-org/account-cli dev

This runs tsc --watch — every save recompiles to dist/. Then run node packages/account-cli/dist/index.js to test.

Tests

yarn workspace @base-org/account-cli test --run

Typecheck & Lint

yarn workspace @base-org/account-cli typecheck
npx biome lint packages/account-cli/

Architecture

Two layers with a hard boundary:

  • commands/ — CLI adapter. Parses flags with Commander, calls into core/, formats output. Only layer that touches process, stdin/stdout, or TTY.
  • core/ — Business logic. Zero CLI dependencies. Typed inputs → typed outputs. Reusable by a future MCP server.

Adding a command

  1. Create src/core/<name>.ts — pure function, typed inputs/outputs, no process or CLI deps
  2. Create src/commands/<name>.ts — parse flags with Commander, call core, call formatOutput
  3. Register in src/index.ts

output/index.ts provides formatOutput and formatError. types/errors.ts provides CLIError for structured error codes.