Skip to content
ContractSpec
Start here

Package manual · apps

·CLI, authoring and agent tooling

app.cli-database

Command-line database tooling for ContractSpec-managed schemas and operations.

appsappv6.0.4stableservernode
@lssm-tech/app.cli-database
bun add @lssm-tech/app.cli-database
Package source ↗Manifest ↗

Manifest declarations describe the current workspace; they do not verify registry publication or runtime execution.

Package guide

Website: https://contractspec.io

CLI tool for contract-source-first Drizzle/PostgreSQL database management: generate, migrate, seed, and schema operations.

What It Does

  • Uses @lssm-tech/lib.schema for schema definitions.
  • Generates Drizzle/PostgreSQL artifacts from portable ContractSpec database entities.
  • Commands dispatched via minimist argument parsing.
  • Related ContractSpec packages include @lssm-tech/lib.schema, @lssm-tech/tool.tsdown, @lssm-tech/tool.typescript.

Running Locally

From packages/apps/cli-database:

  • bun run dev
  • bun run build

Usage

bash
npx database --help
# or
bunx database --help

Architecture

  • Uses @lssm-tech/lib.schema for schema definitions.
  • Generates Drizzle/PostgreSQL artifacts from portable ContractSpec database entities.
  • Commands dispatched via minimist argument parsing.
  • src/cli.ts is the CLI entrypoint.
  • src/index.ts is the root public barrel and package entrypoint.

Public Entry Points

  • Binary database points to dist/cli.js.
  • Export . resolves through ./dist/index.mjs.
  • Export ./cli resolves through ./dist/cli.mjs.
  • Export ./commands/check resolves through ./dist/commands/check.mjs.
  • Export ./commands/generate resolves through ./dist/commands/generate.mjs.
  • Export ./commands/import resolves through ./dist/commands/import.mjs.
  • Export ./commands/migrate resolves through ./dist/commands/migrate.mjs.
  • Export ./commands/schema-compose resolves through ./dist/commands/schema-compose.mjs.
  • Export ./commands/schema-generate resolves through ./dist/commands/schema-generate.mjs.
  • Export ./commands/seed resolves through ./dist/commands/seed.mjs.
  • Export ./lib/config resolves through ./dist/lib/config.mjs.
  • The package publishes 12 total export subpaths; keep docs aligned with package.json.

Database Workflow Boundary

Prisma support is retired for supported workflows. Broad root workflows such as lint:fix, typecheck, and release checks must not run Prisma implicitly; use the explicit Drizzle/PostgreSQL packages/apps/cli-database commands below when a database schema workflow is required.

Local Commands

  • bun run dev — bun run build --watch
  • bun run build — tsdown
  • bun run lint — bun run lint:fix
  • bun run lint:check — biome check .
  • bun run lint:fix — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
  • bun run publish:pkg — bun publish --tolerate-republish --ignore-scripts --verbose
  • bun run publish:pkg:canary — bun publish:pkg --tag canary
  • bun run clean — rm -rf dist
  • bun run test — standalone host test: spawns src/cli.ts in a throwaway project (schema generate/compose, check, Drizzle config, dry-run and refused migrations, status, seed) with no database
  • bun run dbs:generate — database generate --dry-run
  • bun run dbs:migrate — database migrate:dev --dry-run
  • bun run dbs:deploy — database migrate:deploy --dry-run
  • bun run dbs:status — database migrate:status
  • bun run dbs:seed — database seed

Recent Updates

  • Replace eslint+prettier by biomejs to optimize speed.

Notes

  • Do not change CLI argument signatures without updating docs and CI scripts.
  • Drizzle/PostgreSQL artifact generation is contract-source-first — test migrations carefully.

Relationships

THIS PACKAGEapp.cli-database14 import paths

Arrows point from a package to its direct dependency. Counts are derived from captured workspace manifests.

6 declarations

Declared capabilities

This manifest does not declare a capability catalogue. Use the guide, import map and source to assess the package.

Scripts

  • cleanrm -rf dist
  • publish:pkgbun publish --tolerate-republish --ignore-scripts --verbose
  • publish:pkg:canarybun publish:pkg --tag canary
  • buildbun ../../../scripts/tsdown.mjs
  • devbun run build --watch
  • lintbun run lint:fix
  • lint:fixnode ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .
  • lint:checknode ../../../scripts/biome.cjs check .
  • dbs:generatedatabase generate --dry-run
  • dbs:migratedatabase migrate:dev --dry-run
  • dbs:deploydatabase migrate:deploy --dry-run
  • dbs:statusdatabase migrate:status
  • dbs:seeddatabase seed --dry-run
  • schema:generatedatabase schema:generate
  • schema:composedatabase schema:compose
  • testbun test