Skip to content

Getting started with the CLI ​

The luna CLI is Luna's developer tool for running operational commands against the platform — copying data between environments, seeding databases, running migrations, backfilling records, and similar recurring tasks. Set it up once and use it for the rest of your Luna work.

What it's for ​

Commands are generic and reusable, modelled on the AWS CLI (luna <command> <subcommand> [options]) rather than one-off scripts. It's a Node/TypeScript project built with Commander — unlike services and clients it isn't deployed, it's built locally and linked as a global luna binary.

Every command run goes through the same lifecycle: the CLI resolves your target environment, checks your AWS credentials, assumes the right role for that environment, runs your command, and records an audit entry — all automatically, so individual commands don't need to handle any of that themselves. See Patterns & conventions for how this lifecycle works under the hood.

Install and set up ​

Prerequisites: Node >=24 and Yarn 1.22.22 (see Getting Started if you haven't cloned the repo yet).

From the repo root:

bash
cd cli
yarn run setup

This installs dependencies, builds the CLI, and links it globally as the luna command. Verify it worked:

bash
luna --version
luna --help

Needs review

cli/README.md's "Global Installation" section says a plain yarn install automatically builds and links luna via postinstall/postbuild scripts. cli/package.json doesn't define either script, so that doesn't happen — yarn run setup (which wraps yarn install --ignore-scripts + build + a manual link) is the install path that actually works today. Doc owner: update cli/README.md's Global Installation section, or reinstate the postinstall/postbuild scripts, so the two agree.

If you change CLI source later, rebuild and relink with yarn run update, or use yarn run dev for a watch mode that rebuilds on save (see cli/README.md for both).

Configure AWS access ​

Every command except those run with -e local needs AWS credentials — the CLI checks for them before doing anything else. Set up AWS setup & CLI auth first if you haven't.

The CLI then needs to know which environment to target — local, staging, polaris, pulsar, sol, or production. It resolves this in order:

  1. the -e/--environment flag,
  2. the ENVIRONMENT environment variable,
  3. an interactive prompt, if neither is set.

For anything other than local, it assumes the ${environment}-iam-role-luna-cli role for you — you don't assume it by hand — and creates an audit record for the command before it runs. local skips all of this (no credentials, no role, no audit), which makes it the quickest way to try a command out.

Run your first commands ​

Check the CLI is linked and see what's available:

bash
luna --help
luna --version

Try a real command without needing any AWS credentials, using the built-in example command and the local environment:

bash
luna -e local example run
luna -e local example stop

Each just prints a line to confirm it ran — a safe way to check your setup works end-to-end before touching a real environment. Once you're ready to target a real one, pass -e (or export ENVIRONMENT) and get the environment's AWS credentials first:

bash
export ENVIRONMENT=polaris
luna datacopyback copy --help

Get help for any command or subcommand with --help:

bash
luna <command> --help
luna <command> <subcommand> --help

What you can run ​

The current top-level commands (luna <command> ...):

CommandWhat it does
aiAI tooling: embeddings and AI token usage tracking
assessmentsAssessment-related operations
auroraManage Serverless Aurora databases
bulkheadUpdate bulkheaded data for domain entities
data-retentionData retention operations for managing ANDi PII data
datacopybackCopy DynamoDB data between AWS environments
dynamodbDynamoDB operations for data management
exampleA harmless example command — a safe way to try the CLI
expensesManage expense categories
feedback-analysisAnalyse feedback data via embeddings
harness-agentsRegister, update, suspend, resume and list the and-harness agents allowed to call the Luna MCP gateway
invoicesRead Luna invoices: invoices amounts totals the amount, days and number of invoices by readiness for a period
invoicing-calendarWrite (put, validated) and read (get) the invoicing calendar the Luna MCP gateway serves to agents
mfaManage microfrontend client development (install, dev server)
performance-reviewPerformance review operations
public-holidaysImport public holiday templates into the system
scheduleSchedule service operations
scriptRun a one-off .js/.ts script with full CLI context
user-rolesCreate role rows (with --dry-run to preview) in the user roles table
xero-syncSync Xero accounts and tracking categories via JSON files

This list grows over time — luna --help always reflects what's actually registered.

Next steps ​

Troubleshooting ​

  • Install/link issues, command not found, or credential errors — see the Troubleshooting section of cli/README.md.
  • luna script run errors (module not found, ENOENT, AWS calls failing) — see the Troubleshooting section of Run one-off scripts.

Made with ❤️ by the Luna team