CLI and scripts

April 18, 2026 · View on GitHub

Every bun run task and shell script in the repo, and what it does.

Root scripts (Turborepo)

Run from the repo root.

CommandPurpose
bun run buildBuild every package in dependency order.
bun run devRun every package in watch mode (spawns relay and worker).
bun run testRun the full test suite.
bun run lintESLint across all packages.
bun run formatPrettier --check across tracked files.
bun run format:fixPrettier --write — fixes style.

Relay scripts

Run from packages/relay.

CommandPurpose
bun run devStart the HTTP server with hot reload.
bun run buildBundle for production (bun builddist/).
bun run testRun the relay test suite.
bun run lintESLint on src/.
bun run db:generateGenerate a new Drizzle migration from schema changes.
bun run db:pushPush the current schema to the database without migrations (dev only).
bun run db:migrateApply pending migrations.
bun run db:seed-dashboardSeed demo data for the bazaar dashboard.

To run the relay in production without watch, execute the built bundle directly: bun dist/index.js after bun run build.

Worker scripts

Run from packages/worker.

CommandPurpose
bun run devStart the worker via tsx watch --env-file=.env src/worker.ts.
bun run buildCompile TypeScript with tsc.
bun run testRun the worker test suite (uses Temporal's test environment).
bun run lintESLint on src/.

To run the worker in production, execute the compiled output directly: node dist/worker.js after bun run build.

Shared scripts

Run from packages/shared.

CommandPurpose
bun run buildType-check and compile the library.
bun run testRun adapter tests.

Demo scripts

./scripts/demo.sh

End-to-end demo orchestrator from the repo root. Starts relay, worker, demo-seller, and demo-agent in order, with sleeps to let each boot, then runs the agent against the seller. Cleans up on exit.

./scripts/demo.sh

Env it honors:

  • RELAY_PORT (default 3000)
  • DEMO_SELLER_PORT (default 4000)
  • FACILITATOR_URL (default http://localhost:3000)

demo-seller

cd packages/demo-seller

FACILITATOR_URL=http://localhost:3000 \
SELLER_WALLET=GSELLER... \
SELLER_NETWORK=stellar:testnet \
DEMO_SELLER_PORT=4000 \
bun run src/index.ts

Self-registers with the relay, serves a paywalled GET /search?q=....

demo-agent

cd packages/demo-agent

FACILITATOR_URL=http://localhost:3000 \
DEMO_SELLER_URL=http://localhost:4000 \
AGENT_SECRET_KEY=SAGENT... \
bun run src/index.ts

Discovers services via /bazaar, pays via MPP, prints results.

Docker

CommandPurpose
docker compose up -dStart PostgreSQL, Redis, Temporal, Temporal UI.
docker compose downStop services, preserve volumes.
docker compose down -vStop services, wipe volumes (fresh state).
docker compose psCheck service status.
docker compose logs -f temporalTail one service's logs.

Temporal CLI

One-time setup (after docker compose up):

temporal operator namespace create 402md-settlement
temporal operator search-attribute create \
  --name sellerNetwork --type Keyword \
  --name buyerNetwork --type Keyword \
  --name settlementStatus --type Keyword \
  --name protocol --type Keyword

Ad-hoc queries:

temporal workflow list --namespace 402md-settlement \
  --query 'settlementStatus = "failed"'

temporal workflow describe --namespace 402md-settlement \
  --workflow-id <id>

See monitor workflows in Temporal.