Skip to main content

CLI commands reference

pnpm scripts for developing and operating Chive.

Development

Starting services

# Start full development environment (API + frontend)
pnpm dev

# Start API server only (on port 3001)
pnpm dev:api

# Start database containers
pnpm dev:db

# Stop development services
pnpm dev:stop

# Stop all services (including databases)
pnpm dev:stop:all

Building

# Build all packages
pnpm build

# Type checking only
pnpm typecheck

# Lint code
pnpm lint
pnpm lint:fix

# Format code
pnpm format
pnpm format:check

Testing

Running tests

# Run all tests
pnpm test

# Run specific test suites
pnpm test:unit # Unit tests only
pnpm test:unit:watch # Unit tests in watch mode
pnpm test:unit:ui # Unit tests with Vitest UI
pnpm test:integration # Integration tests
pnpm test:e2e # End-to-end tests
pnpm test:compliance # ATProto compliance tests
pnpm test:performance # Performance tests with k6

# Coverage report
pnpm test:coverage

E2E testing

# Run Playwright tests
pnpm test:e2e

# Run with UI
pnpm test:e2e:ui

# Debug mode
pnpm test:e2e:debug

Test infrastructure

# Start test stack (databases in Docker)
pnpm test:stack:start

# Stop test stack
pnpm test:stack:stop

# Seed test data
pnpm seed:test

# Clean up test data
pnpm cleanup:test

Database

Migrations

# Apply pending migrations
pnpm db:migrate:up

# Rollback last migration
pnpm db:migrate:down

# Create new migration
pnpm db:migrate:create <name>

Setup

# Initialize all databases (PostgreSQL, Elasticsearch, Neo4j)
pnpm db:init

# Seed knowledge graph data
pnpm db:seed:knowledge-graph

Code generation

# Generate TypeScript from lexicon definitions
pnpm lexicons:generate

# Generate frontend types from OpenAPI spec
pnpm openapi:generate

Health checks

# Check API health
curl http://localhost:3001/health

# Readiness check (includes database checks)
curl http://localhost:3001/health/ready

# Liveness check
curl http://localhost:3001/health/live

Scripts directory

Additional scripts in scripts/:

ScriptDescription
scripts/dev.shStart full development environment
scripts/dev-db.shStart database containers
scripts/start-test-stack.shStart Docker test databases
scripts/generate-lexicons.shGenerate TypeScript from lexicons
scripts/generate-api-types.shGenerate API types from OpenAPI
scripts/db/init-all.shInitialize all databases
scripts/db/migrate.tsRun database migrations

Usage

# Run TypeScript script
tsx scripts/db/migrate.ts up

# With arguments
tsx scripts/db/migrate.ts create migration_name

Package manager

Chive uses pnpm. Common commands:

# Install dependencies
pnpm install

# Add dependency
pnpm add <package>
pnpm add -D <package> # Dev dependency

# Update dependencies
pnpm update

# Check for outdated packages
pnpm outdated

Next steps