CLI

Discover the catalogue for an API key, sync JSON agent and workflow files, and deploy TypeScript definitions.

The @lunnoa/client CLI discovers what a key can see, syncs JSON agent and workflow files with the UI, and deploys TypeScript define* files. The binary is lunnoa-client. npx lunnoa-client and npx @lunnoa/client run the same command. Prefer the CLI. Thin SDK upsert helpers exist as an implementation detail.

JSON files in lunnoa/ round-trip with the UI (pull, push, status). A .json path passed to agents deploy or workflows deploy is a push. A .ts, .js, or .mjs file is a TypeScript deploy and sets codeSource to generated, which locks that agent or workflow in the UI. Full loop, conflicts, and CI: Sync with the UI.

Auth is the same everywhere: --url / LUNNOA_URL, --api-key / LUNNOA_API_KEY, and optional --access-token. Deploy uses the workspace on the API key. The CLI also reads ./.env in the working directory; real environment variables take precedence. Optional lunnoa.config.ts (or .mjs / .js / .json) in the working directory can supply the same values. Use --json when a coding agent is reading the output.

Set up the app

CommandWhat it does
init <dir> [--url <url>] [--api-key lna_…] [--template owner/repo[#ref] | ./folder]Scaffold the starter app and write .env. See Quick start.
skills install [projectDir]Copy this SDK version's agent skills into .claude/skills/ and .cursor/skills/. projectDir is a folder on disk. See For agents.

Discover

tools list is compact. tools get prints inputConfig, field summaries, and a defineAction({ id, appId, input }) sketch. --for-agent keeps only catalogue entries marked availableForAgent. --app scopes tools and connections to one workflow app.

discover.sh
npx @lunnoa/client tools list --for-agent --json
npx @lunnoa/client tools search email --for-agent --json
npx @lunnoa/client tools get http_action_send-request --json
npx @lunnoa/client tools get http.http_action_send-request --json
npx @lunnoa/client apps list --json
npx @lunnoa/client apps get http --json
npx @lunnoa/client connections list --app gmail --json
npx @lunnoa/client connections get <connection-uuid> --json
npx @lunnoa/client ai-connections list --json
npx @lunnoa/client agents list --json
npx @lunnoa/client workflows list --json
npx @lunnoa/client entity-types list --json
npx @lunnoa/client tables list --json
npx @lunnoa/client tables get <slugOrId> --json
npx @lunnoa/client features --json

Typical coding-agent loop: tools list or tools search → tools get for the schema → write defineAction → deploy. connections list supplies the Connection instance UUID when a tool needsConnection. Before defineAgent, run ai-connections list --json and set model to a returned models[].id. Before defineTrigger, run apps get <appId> --json and use triggers[].triggerId. Do not invent trigger ids.

There is no actions run CLI command. Run catalogue actions from code (actions.run / runs.start). See Run actions and Discovery.

Deploy

DefinitionUpsert keyScopeCLI
defineWorkflowworkspace-scoped slugWorkspaceworkflows deploy
defineAgentworkspace-scoped slugWorkspaceagents deploy
defineEntityTypedeployment-wide slugWorkspaceentity-types deploy
deploy.sh
npx @lunnoa/client workflows deploy ./workflows/sync-orders.ts \
  --url https://lunnoa.example \
  --api-key "$LUNNOA_API_KEY"

npx @lunnoa/client agents deploy ./agents/triage.ts \
  --url https://lunnoa.example \
  --api-key "$LUNNOA_API_KEY"

npx @lunnoa/client entity-types deploy ./types/invoice.ts \
  --url https://lunnoa.example \
  --api-key "$LUNNOA_API_KEY"

You can also list what is already deployed: workflows list, agents list, entity-types list. Agent and workflow slugs are unique in the workspace. agents list and workflows list include a SOURCE column (codeSource: none, synced, or generated).

Redeploying a TypeScript file updates that row and keeps codeSource as generated. A JSON file goes through push and sets codeSource to synced. A push onto a slug that is missing from lunnoa.lock.json is refused until you pull. See Sync with the UI.

For TypeScript definition files, run under Node with --experimental-strip-types (Node ≥ 22) or use tsx.

Definition file shape

Export defineWorkflow(…), defineAgent(…), or defineEntityType(…) as default, or as workflow / agent / entityType. Nested defineWorkflow tools on an agent are deployed first, then linked via workflowIds.

What gets written

  • Real Workflow, Agent, and ObjectType rows, visible in Automate.
  • Agents and workflows store codeSource. A TypeScript deploy sets generated. A JSON push sets synced. Entity types still store managedByCode. Tables do too.
  • A generated agent or workflow is locked in the UI. Change the TypeScript file and deploy again.
  • A synced agent or workflow can be edited in the UI. pull brings those edits into lunnoa/. push stops when the UI changed after the revision in the lock, so a push does not silently replace them. See Sync with the UI.
  • A TypeScript defineWorkflow builds one catalogue trigger (Manually Run with no input fields when trigger is omitted), then catalogue-action steps. The last step may branch with paths (Request Approval, Conditional Paths, Manually Decide Path). ref.trigger and ref.step become references to the real node ids. Keyed steps keep their node ids. The trigger keeps its id while its type and settings stay the same. See Define locally.
  • A workflow the steps shape would lose, such as paths that join or a for-each loop, is stored in full. pull writes it as format: "graph", and push keeps it.
  • Entity types: attributeSchema, optional stateSchema, schemaRevision bumped on schema changes, allowUnknownAttributes default false.

Related