@inquir/compute-cli
v0.1.2
Published
Workspace-first CLI for Inquir Compute.
Readme
@inquir/compute-cli
CLI for workspace-first Inquir Compute development.
Install
Global:
npm install -g @inquir/compute-cliOr run with npx:
npx @inquir/compute-cli --helpConcepts
- Function: a single compute unit with typed input/output (Zod schemas). Defined with
defineFunction(). Run locally withinquir run, deployed and invoked remotely withinquir deploy/inquir invoke. - Pipeline: a declarative DAG of functions defined with
definePipeline(). Registered in the codegen registry for client use; remote run/deploy for pipelines is handled by the backend. - Client: the generated TypeScript module at
.inquir/generated/client.ts. Wraps remote invocation with schemas inferred from your source. Import it in your application code. - Source of truth: your local files under
functionsDirandpipelinesDir.registry.jsonis a derived artifact rebuilt byinquir codegen— never hand-edit it. - Local ↔ remote link: each deployed remote function stores a
linkedLocalName(your local asset name) and asourceHash.inquir sync statuscompares hashes to detect drift.
Quick Start
inquir init
inquir codegen
inquir list
inquir run hello --payload '{"name":"World"}'Authentication
The recommended way to authenticate on your own machine is a browser login,
which mints a user-scoped Personal Access Token (PAT) bound to your account
and stores it in ~/.inquir/config.json:
inquir login # opens your browser to approve this device
inquir whoami # show the signed-in user + active workspaceinquir login prints a short code and opens a dashboard page; confirm the code
matches and click Authorize. The CLI then receives its token automatically.
Other login modes:
inquir login --browserless # print the URL + code instead of opening a browser
inquir login --token <pat> # non-interactive (CI): use a PAT created in the dashboard
inquir login --name "my CI" # label the device/token shown in the dashboardCreate and revoke PATs from the dashboard under API Keys → Personal Access
Tokens. To sign out and remove the stored token: inquir logout.
A PAT can deploy to any workspace you belong to. A workspace-scoped API key is pinned to a single workspace and ignores workspace switching.
Workspaces
A single login works across every workspace you're a member of. List them and choose a default:
inquir workspaces # list workspaces (active one marked with *)
inquir use <slug|id> # set the active workspace for subsequent commandsTarget a different workspace for a single command with --workspace:
inquir deploy hello --workspace acme-prod
inquir deploys hello --workspace acme-prod
inquir whoami --workspace acme-prodUnder the hood, user-scoped credentials send an X-Inquir-Workspace header; the
server verifies your membership before honoring it.
Deploy a function (remote)
Once installed globally, deploying takes three steps:
# 1. Authenticate. Easiest on a workstation:
inquir login
# For CI / scripts, export env vars for a one-off instead:
# export INQUIR_API_URL="https://api.inquir.org"
# export INQUIR_API_KEY="<api-key>" # workspace-scoped key, or
# export INQUIR_TOKEN="<personal-access-token>"
# 2. From your workspace (created by `inquir init`), deploy an asset by name.
inquir deploy hello # streams build/deploy logs, exits non-zero on failure
# 3. Invoke it remotely.
inquir invoke hello --payload '{"name":"World"}'Get an API key from your Inquir Compute workspace settings. For CI, prefer the
inquir-compute/deploy-action GitHub Action (supports keyless
OIDC auth), or run inquir deploy --ci.
Commands
inquir init [--skip-install]- scaffoldinquir.config.json, folders, and sample function.inquir codegen- discover assets and generate.inquir/generated/client.ts+registry.json.inquir list- list discovered local assets.inquir run <asset>- run a local asset.inquir debug <asset>- run locally with inspector enabled.inquir login- authenticate the CLI (browser pairing,--browserless, or--token).inquir logout- remove the stored token + active workspace for the current environment.inquir whoami- show the signed-in user, active workspace, and role.inquir workspaces- list the workspaces you belong to.inquir use <slug|id>- set the active workspace for subsequent commands.inquir invoke <asset>- invoke remote function by name / linked local name.inquir deploy <asset>- package, upload, and deploy a function (async; streams build logs).inquir deploys <function>- list deploy history for a remote function.inquir status <deployId>- show a deploy's status (--followto stream logs).inquir rollback <function> [deployId]- roll back to a previous successful deploy.inquir logs <asset>- show recent remote invocation history.inquir sync status- compare local hashes with remote hashes (in-sync,drift,missing).
deploy flags
inquir deploy hello # package + async deploy, stream build logs
inquir deploy hello --environment staging
inquir deploy hello --no-logs # queue and wait for completion without streaming
inquir deploy hello --ci # plain output, non-zero exit on failure (for CI)
inquir deploy hello --dry-run # validate + package only; no create/deploy
inquir deploy hello --json # machine-readable resultExit codes: 0 success, 1 deploy/validation error, 3 network/timeout error.
Global Flags
--config <path>- config file path or workspace directory.--json- machine-readable output when supported.--env <name>- select environment from auth config.--workspace <slug|id>- target a specific workspace for this command (user-scoped login).
Global flags work in any position, for example both are valid:
inquir run hello --config ./inquir.config.json
inquir --config ./inquir.config.json run helloPayload Input
run and invoke support:
--payload '{"k":"v"}'--payload-file ./payload.json- stdin piping
Remote Auth / Environment
The CLI resolves each credential field independently, in this order (first match wins):
- CLI flags /
--env <name>selection (and--workspacefor the workspace) - Environment variables (
LAMBDA_*are legacy fallbacks):INQUIR_API_URL,INQUIR_API_KEYINQUIR_TOKEN— a Personal Access Token (takes precedence overapiKey)INQUIR_WORKSPACE— active workspace (slug or id)INQUIR_ENV— pick a named environment
- Selected environment in the config file
- Top-level config file values
- Default
apiUrlofhttps://api.inquir.org(override with env/config for local dev)
When both a token (PAT) and an apiKey are present, the PAT wins. The active
workspaceId is only applied to user-scoped credentials (PAT/session); for a
workspace-scoped API key it is ignored unless you pass --workspace explicitly.
Config file locations:
~/.inquir/config.json(preferred, written byinquir login/use)~/.lambda-cli/config.json(legacy fallback)
Example (written/managed by inquir login, inquir use, inquir logout):
{
"apiUrl": "https://api.inquir.org",
"token": "inq_pat_…",
"workspaceId": "acme-prod",
"user": { "id": "…", "email": "[email protected]", "name": "You" },
"environments": {
"staging": {
"apiUrl": "https://staging.example.com",
"apiKey": "staging-key"
}
}
}Publishing to npm (maintainers)
The CLI (@inquir/compute-cli) depends on the SDK (@inquir/compute), so the
SDK must be published first at a version satisfying the CLI's dependency
range (dependencies["@inquir/compute"], currently ^0.1.0).
Prerequisites:
- An npm account with publish access to the
@inquirscope (create the org/scope on npmjs.com), thennpm login. - Both packages declare
"publishConfig": { "access": "public" }, so scoped packages publish publicly. - Each package's
prepublishOnlyrebuildsdist/automatically; onlydist/ships (files: ["dist"]).
Steps (run from the repo root):
npm login
# 1) Publish the SDK first — the CLI resolves it from the public registry.
npm version <patch|minor|major> --workspace @inquir/compute
npm publish --workspace @inquir/compute
# 2) Publish the CLI. Ensure its @inquir/compute dependency range covers the
# SDK version you just published, then:
npm version <patch|minor|major> --workspace @inquir/compute-cli
npm publish --workspace @inquir/compute-cliTips:
- Preview the exact tarball contents without publishing:
npm publish --dry-run --workspace @inquir/compute-cli. - The published
binisinquir(fromdist/index.js, which keeps its#!/usr/bin/env nodeshebang). - After publishing, anyone can install and deploy:
npm install -g @inquir/compute-cli
inquir --help