The uraijs CLI is for local development and CI of Urai tools, workflows, and
libraries. It never talks to the Urai server — you deploy by git push to your
Urai remote. Code runs in the UraiJS runtime (a sandboxed JavaScript/
TypeScript runtime, not Node.js).
- stdout = the machine-consumable payload only (result JSON, tool list, …).
- stderr = human "chrome": status, headers, errors.
- Every command returns a meaningful exit code (non-zero on failure).
- Global flags:
--json(machine-readable payload, chrome suppressed),--quiet(drop chrome, keep payload). Colors auto-disable when not a TTY, or underNO_COLOR/CI.
uraijs call tool.ts greet -a '{"name":"Ada"}' --json | jq .Create a new project: entry script, urai.toml, .gitignore, git init, editor
support (urai.d.ts + tsconfig.json), an AGENTS.md guide, and — for tools —
a generated declarations.ts. Prints the run + git push next steps.
uraijs init my-tool # a tool in ./my-tool
uraijs init flows --type workflow
uraijs init utils --type libraryWatch the sources; on save, reload and re-run — regenerates declarations.ts and
either re-runs --call <fn> or lists the tools. --interval-ms tunes polling.
Run one tool function once. Accepts -d/--work-dir, secrets/vars (see below).
The result JSON is the stdout payload.
Print the tool declarations. --json emits the raw declarations array.
Regenerate declarations.ts from the tool source (local codegen — the offline
equivalent of server-side schema generation). --stdout prints instead of
writing; declarations.ts is generated and versioned but hand-editable, so a
write refuses to clobber a hand-edited file without --force.
Run *.urai-test.json fixtures — an array of cases:
[
{ "fn": "greet", "args": { "name": "Ada" }, "expect": "Hello, Ada!" },
{ "fn": "charge", "args": { "amount": -1 }, "expectError": true }
]expect deep-equals the result; expectError: true passes iff the call throws.
Exits non-zero on any failure (a CI gate). --json emits a report. With no
fixtures it runs demo probes and exits 0.
Write/refresh urai.d.ts + tsconfig.json so the TypeScript language server
understands the tool globals, decorators, and urai:* imports.
List the secret names the code references (meta.secrets.X and
secrets.get("X")). See secrets.md for the full model.
Point a urai:lib/<org>/<name> import at a local checkout during development
(writes [lib."<org>/<name>"] to urai.toml), so you can develop a tool and its
libraries together offline.
uraijs lib link acme/billing ../billing-lib
uraijs lib listDrive a durable workflow to completion locally, persisting state + completed
steps to .urai/workflows.json. Reuse --id to resume an interrupted run —
completed steps are memoized and not re-run. --script, --store, -d, and
secrets/vars are accepted.
uraijs workflow run MyWorkflow -a '{"q":"hello"}' # prints the instance id
uraijs workflow run MyWorkflow --id <id> # resume
uraijs workflow listRun an arbitrary one-shot script in a fresh sandbox — the script must call
urai.complete(value). Flags: --timeout-ms, --heap-mb, --allow-host <host>
(repeatable), plus secrets/vars.
uraijs run job.ts -s '{"API_KEY":"…"}'-s/--secrets '<json>', --secrets-file <path>, -v/--vars '<json>',
--vars-file <path>; plus env vars and [run] defaults in urai.toml.
Precedence and the two in-code access forms are documented in
secrets.md.
The project manifest, discovered by walking up from the current directory:
[project]
name = "my-tool"
type = "tool" # tool | workflow | library
main = "tool.ts"
# Point urai:lib imports at local checkouts during dev:
[lib."acme/billing"]
path = "../billing-lib"
[run]
secrets_file = ".secrets.json"
vars_file = ".vars.json"
env_secrets = ["OPENAI_API_KEY", "TWILIO_*"]