@economico/cli
v1.3.0
Published
Economico CLI — discover and call the shared business registry over REST
Downloads
547
Readme
Economico CLI
@economico/cli connects your terminal or agent to an Economico business over REST.
Login approves businesses and scopes for one connection. Each data command selects
its business explicitly; the server publishes the tools permitted for that target.
Version 1 replaces the old REST command tree with generic tool/verb dispatch.
Requires Node 24 or newer. Install with npm install -g @economico/cli.
economico login --server https://economi.co --local
economico businesses list
economico businesses list --audience public
economico --business example-co tools
economico --business example-co catalog list
economico --business example-co catalog describe --name parties.create
economico --business example-co commands execute --args @command.json
economico --business example-co reports list
economico --business example-co reports run --kind balance_sheet --currency USD --humaneconomico --business example-co <tool> <verb> --help reads that operation's current server description
and input schema from /v1/openapi.json and lists its flags. A body with one variant per
command or report is folded to the fields they share, and help names the operation that
describes one variant (catalog describe --name <name> for a command's input).
--help --json prints the complete schema. Tool/verb pairs come from its operationId
(for example, reports.run becomes reports run). Field flags use
the exact schema names (--effective_at); strings stay strings, including money.
Objects and arrays take JSON; a list in a read's query is sent as a repeated parameter. --args accepts a JSON object, @file, or - for stdin.
The server validates inputs and enforces membership and command visibility.
Where the server advertises multipart upload, --file reads exact local bytes (up to
10 MiB; individual document kinds may allow less) and sends them alongside the JSON
metadata. An upload gets two minutes to complete on the client side (ordinary calls get
30 seconds); the server separately requires the transfer to finish within 30 seconds. It uses the CLI's existing OAuth connection and explicit business selection:
economico --business example-co documents submit --file invoice.pdf \
--input '{"kind":"source_document"}' \
--idempotency_key invoice-123 --effective_at 2026-10-06T00:00:00ZOmit input.contentBase64 when using --file. This low-level registration retains the
source; uploading does not classify the document or record financial facts.
JSON is the default output. --human renders supported financial statements and
summarizes other results. Errors go to stderr and exit nonzero. Command calls are
never automatically retried after network failures; supply a stable
idempotency_key when deliberately retrying a command.
Login retains the original CLI's OAuth discovery, DCR/CIMD, PKCE, and loopback flow.
Use --no-browser to print the authorization URL, or --port to select the callback
port. logout removes stored tokens from the selected config file.
A person with no business yet creates one in the browser during login. To prefill that
signup form, pass --country (US, SG, CA or GB; US means Delaware and GB
England and Wales), or --jurisdiction for an exact register (US-CA, CA for a federal
corporation, CA-ON, GB-SCT), --legal-form (c_corp, llc, private_limited_company,
corporation, …), --currency (default: the country's) and --fiscal-year-end (MM-DD,
default 12-31):
economico login --server https://economi.co --country SG --fiscal-year-end 03-31They travel as signup_* parameters on the authorization request. The server validates
them and only prefills the form; the person reviews and submits it. They are ignored when
the account already has a business.
Configuration resolves in this order: ECONOMICO_CONFIG_FILE, the nearest trusted ancestor's
.economico/config.json, then $XDG_CONFIG_HOME/economico/config.json (normally
~/.config/economico/config.json). login --local creates a project config and
adds .economico/ to the current directory's .gitignore. Config files have mode
0600. ECONOMICO_API_URL overrides the stored server URL. Credentials belong to the
server that issued them; log in again when switching servers.
Automatic ancestor discovery never walks above $HOME and, on Unix, ignores files not owned
by the current user. Use ECONOMICO_CONFIG_FILE when selecting a deliberate path outside those
boundaries.
The default host is https://economi.co. Legacy domain commands such as
invoices create are replaced by catalog discovery and commands execute.
Human report output keeps native currencies and functional-currency statement periods separate.
When a shared report supplies indicative totals, --human labels them and prints the exact rate,
requested and observation dates, source/provider and settlement status. Missing rates leave the
combined total unavailable while retaining native figures. JSON output preserves the server's
report contract.
Develop from the workspace with pnpm --filter @economico/cli test and
pnpm --filter @economico/cli build; the executable is dist/bin.js.
Publishing is a separate release action: raise
version in package.json, land it on main, then run pnpm cli:publish from
the repository root (prepack builds and tests; pnpm refuses a dirty tree or a
branch other than main). pnpm cli:publish --dry-run shows what would ship.
Publishing plans to the vendor catalog
The server's plan_publications operations appear through ordinary OpenAPI discovery for the
business owner's interactive login with public.manage. Preview prints the exact public bundle
and a publish object; send that object back to publish. Versions are immutable: withdraw one
from new adoptions, or publish a new version that names the old one in supersedes.
economico --business example-co plan_publications preview --templateId TEMPLATE_ID \
--pricingUrl https://example.co/pricing --planKey team > preview.json
jq .publish preview.json > publish.json
economico --business example-co plan_publications publish --args @publish.json
economico --business example-co plan_publications list
economico --business example-co plan_publications withdraw --cid VERSION_CID --reason "Prices changed"Add "domain" (and "method": "dns" for a TXT record) to publish.json to prove a domain.
To change or reinstate a plan, preview again with --supersedes VERSION_CID --summary "…".
Platform upgrades and wallet payments
The server's platform.purchase and platform.pay operations appear through ordinary
OpenAPI discovery. Every signup starts on Solo; Startup and Solo extra events are separate
agreements. A full-access agent acting for the owner can accept the exact offered agreement.
The wallet applies its own payment approval policy.
economico --business example-co platform purchase --action offer --plan team --interval year
economico --business example-co platform purchase --action accept --offerId OFFER_ID --offerCid OFFER_CID --capacity Owner --authorized true
economico --business example-co platform purchase --action prepare --offerId OFFER_ID --method mpp
economico --business example-co platform pay --offerId OFFER_ID --method mpp
economico --business example-co platform purchase --action status --offerId OFFER_IDFor a saved card, make the payment explicitly with
platform purchase --action pay --method card --offerId OFFER_ID. Preparing an invoice
does not charge it. MPP and x402 payments use the separate platform pay exchange.
On prepare, an agent that knows the funding account can pass --fundingAccountId with
an existing USD account in the customer's books. Otherwise wallet payment can activate
service while the customer's payment bookkeeping waits for that account choice.
Choose a method the server returns. The first payment request can return HTTP 402 with a
wallet challenge in paymentHeaders on stderr. Give that challenge to the wallet, then
supply its complete MPP credential as the Payment header, or an x402 credential as
PAYMENT-SIGNATURE. Pass wallet-produced JSON through --args - on stdin so credentials
stay out of command-line arguments. The CLI keeps its OAuth bearer in Authorization.
Receipts are retained in paymentHeaders on the successful JSON result.
The status response lists open ordinary renewal and extra-event invoices with their
invoiceId, outstanding amount and paymentUrl. Follow nextInvoiceCursor by sending it
as invoiceCursor on the next status request. Include the returned invoiceId when
preparing and paying an invoice. Recover a pending purchase with action=status before attempting
another collection. Once the purchase is active, retry the blocked bookkeeping command
with its original idempotency key. The returned browserFallback opens the browser flow
when the agent's host has no compatible wallet.
Resolve a copied record link
economico --business acme references resolve --url 'https://economi.co/e/acme/r/1/business/W10'
economico --business acme references content --url '<canonical destination>' --byte_limit 65536
economico --business acme references children --url '<canonical destination>' --child positions --limit 25Pass the HTTPS destination from a Markdown link, without credentials. Server discovery supplies
these operations; the explicit business must match the destination. Current stored families have
typed native or basic views. Saved query references run their saved registered operation and
parameters over current data (report queries also pin their definition); capture references read
retained exact results without recomputation. Use only operations advertised by current discovery;
see report references. These reads do not create context
material or perform general keyword/full-text search.
A signed-in browser opens a readable basic view with identity, sources and copy controls.
New scalar projections exceeding a 256 KiB resolve response return status: "content_required",
value.data: null and value.content: {url,mediaType:"application/json",byteLength,revision},
retaining identity, provenance and authorized links. The content URL is absolute:
https://economi.co/v1/references/content?url=<canonical> (query-encoded). The 25 native-backed
payloads retain their own limits unchanged.
Content returns {reference,mediaType:"application/json",revision,contentBase64,nextCursor}.
--byte_limit counts raw bytes (1–65536, default 65536), not child items. Follow
--cursor '<nextCursor>' until null; Base64-decode and concatenate bytes before UTF-8 decoding
and parsing JSON. The bytes are exact bigint-normalized JSON of the whole typed value
{schemaVersion,record,data,provenance,links}, not arbitrary storage fields. Content cursors
bind reference, revision and byte offset. After cursor_stale, explicitly restart rather
than mixing revisions. Every page rechecks full live record authority, including revocation.
The browser provides explicit bounded structured-content reads and Next pages without replacing
its readable metadata and identity main view with raw JSON alone.
Children return {reference,child,items,nextCursor}. Closed names are contacts, positions,
allocations, costs, liabilities, facts, sourceLines and contactIds, only where declared
by the parent family. The default is 25 items, maximum 100, with a 256 KiB serialized response
ceiling. Continue with --cursor '<nextCursor>' until null; after cursor_stale, explicitly
restart without the old cursor rather than mixing revisions. Every page rechecks parent GET.
Children can also return contentLinks:[{record,url}] (at most one per page) when the first
row is oversized. record identifies the standalone party_contact; url uses the existing
/v1/references/content endpoint with that child's canonical URL. A page before an oversized
row returns preceding small items and a cursor before it. An oversized first row returns
items: [], an actionable link and a cursor past the row, keeping following rows reachable.
There is no truncated field or partial JSON item. Following the child rechecks its full live
authority; native party GET is unchanged. The browser links to the child's readable record
view and explicit structured-content Read, preserving continuation and the deferred-row count.
This is the existing content read, not a child-content mode or authorization bypass.
GET and discovery have independent permission checks. Contracts/documents use their actual
native LIST before every returned target's GET. Claims/payments have no native LIST; discovery
needs unrestricted whole-books SQL enumeration authority before each target GET. Known links
do not grant discovery rights. Relations use [fromDocumentId,toDocumentId,relationKind] and
require both endpoint document-read policies. Returned links contain no bearer tokens; document
bytes use their ordinary explicit read.
