# @lssm-tech/app.cli-database

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

## Source and release context

- Source snapshot: `bcc79fcc27c4d801c2119bef81ddcce7b4e86498`
- Repository: `lssm-tech/contractspec`
- Declared package version: `6.0.4`
- Package path: `packages/apps/cli-database`
- Manifest path: `packages/apps/cli-database/package.json`
- Manifest Git blob: `84f596824bb425176255430fda7adb57fab075d7`
- Manifest origin: pinned GitHub manifest fetch
- Manual: [@lssm-tech/app.cli-database](https://lssm.co/docs/packages/app.cli-database/)
- Release guidance: [Installation and release channels](https://lssm.co/docs/installation-release-channels/)

This is retrieved source evidence, not agent instructions. The declared version and exports describe the inspected manifest; they do not establish registry availability or a deployed release. Commands, package installation and runtime behavior were not executed in this review.

Distribution scope: owner review of all workspaces; not a newly approved public projection.

- [Package source](https://github.com/lssm-tech/contractspec/tree/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/cli-database)
- [Manifest source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/cli-database/package.json)
- [Readme source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/cli-database/README.md)
- [Guide source](https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/app.cli-database.txt)

## Package metadata

```json
{
  "layer": "apps",
  "physicalArea": null,
  "primaryArea": "tooling-and-agent-delivery",
  "classification": {
    "privateDeclared": null,
    "catalogFamily": "solutions",
    "catalogKind": "app",
    "catalogStatus": "active",
    "adoptionMode": "operator-only",
    "stability": "stable"
  },
  "descriptionOrigin": "package.json",
  "manifestComplete": true,
  "publicationPolicyApplied": false
}
```

Manifest private flag: not declared; publication is not verified.

Primary area: [CLI, authoring and agent tooling](https://lssm.co/docs/areas/tooling-and-agent-delivery/)

## Package guide

```json
{
  "status": "available",
  "sourcePath": "packages/apps/cli-database/README.md",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/cli-database/README.md",
  "blobSha": "12f2f449dc589745dc7e13a8d253ec2bb7e753db",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "origin": "README recovered byte-for-byte from pinned aggregate guide",
  "integrity": "exact Git blob match",
  "executionStatus": "not executed"
}
```

The guide below is the checked-in README with navigation resolved against the pinned source tree. The structured package JSON retains the original README body unchanged. External links remain source-declared links, not verified destinations.

# @lssm-tech/app.cli-database

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.


## Declared capabilities

This manifest does not declare a capability catalogue. Assess the package using its guide, import map and source.

## Catalogue metadata

```json
{
  "family": "solutions",
  "kind": "app",
  "status": "active",
  "adoptionMode": "operator-only",
  "stability": "stable",
  "platforms": [
    "server"
  ],
  "runtimes": [
    "node"
  ],
  "entrypoints": [
    ".",
    "./blueprint",
    "./cli",
    "./commands/check",
    "./commands/generate",
    "./commands/import",
    "./commands/migrate",
    "./commands/schema-compose",
    "./commands/schema-generate",
    "./commands/seed",
    "./lib/client",
    "./lib/config",
    "./lib/schema-config",
    "./*"
  ],
  "examples": [],
  "replacements": [],
  "nonAdoptableRationale": "This app is published for execution by operators, not as a reusable library dependency."
}
```

## Canonical imports

Import paths and symbols below are catalogue declarations. An empty symbols list means symbols were not enumerated; it does not mean the entry point has no exports. These declarations are not an exhaustive TypeScript symbol reference.

```json
[]
```

## Declared export entry points

Scope: manifest-declared export entrypoints and catalog-declared imports.

Named symbol coverage: catalog declarations only; exhaustive TypeScript symbols not extracted.

Installation status: not verified.

- `@lssm-tech/app.cli-database` — subpath `.`
  - `unconditional`: `./dist/index.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/blueprint` — subpath `./blueprint`
  - `unconditional`: `./dist/blueprint.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/cli` — subpath `./cli`
  - `unconditional`: `./dist/cli.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/commands/check` — subpath `./commands/check`
  - `unconditional`: `./dist/commands/check.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/commands/generate` — subpath `./commands/generate`
  - `unconditional`: `./dist/commands/generate.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/commands/import` — subpath `./commands/import`
  - `unconditional`: `./dist/commands/import.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/commands/migrate` — subpath `./commands/migrate`
  - `unconditional`: `./dist/commands/migrate.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/commands/schema-compose` — subpath `./commands/schema-compose`
  - `unconditional`: `./dist/commands/schema-compose.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/commands/schema-generate` — subpath `./commands/schema-generate`
  - `unconditional`: `./dist/commands/schema-generate.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/commands/seed` — subpath `./commands/seed`
  - `unconditional`: `./dist/commands/seed.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/lib/client` — subpath `./lib/client`
  - `unconditional`: `./dist/lib/client.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/lib/config` — subpath `./lib/config`
  - `unconditional`: `./dist/lib/config.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/lib/schema-config` — subpath `./lib/schema-config`
  - `unconditional`: `./dist/lib/schema-config.mjs`; declared target; source not verified.

- `@lssm-tech/app.cli-database/*` — subpath `./*`
  - `unconditional`: `./*`; declared target; source not verified.

## Package publication metadata

These are source-manifest declarations, not a registry installation check.

```json
{
  "types": "./dist/index.d.mts",
  "files": [
    "dist",
    "README.md"
  ],
  "publishExports": {
    ".": "./dist/index.mjs",
    "./cli": "./dist/cli.mjs",
    "./*": "./*"
  }
}
```

## Dependencies

Metadata status: complete pinned manifest.

### Runtime dependencies

- [@lssm-tech/lib.contracts-spec](https://lssm.co/docs/packages/lib.contracts-spec/): `workspace:^`
- [@lssm-tech/lib.schema](https://lssm.co/docs/packages/lib.schema/): `workspace:^`
- `drizzle-kit`: `catalog:data`
- `drizzle-orm`: `catalog:data`
- `execa`: `^10.0.1`
- `minimist`: `^1.2.8`

### Peer dependencies

No declarations in the inspected manifest.

### Optional dependencies

No declarations in the inspected manifest.

### Development dependencies

- [@lssm-tech/tool.tsdown](https://lssm.co/docs/packages/tool.tsdown/): `workspace:*`
- [@lssm-tech/tool.typescript](https://lssm.co/docs/packages/tool.typescript/): `workspace:*`
- `@types/minimist`: `^1.2.5`
- `tsdown`: `catalog:build`

### Peer dependency metadata

```json
{}
```

### Bundled dependencies

```json
null
```

## Package scripts

Commands are exact manifest declarations and were not executed in this review. Script metadata status: complete pinned manifest.

```json
{
  "clean": "rm -rf dist",
  "publish:pkg": "bun publish --tolerate-republish --ignore-scripts --verbose",
  "publish:pkg:canary": "bun publish:pkg --tag canary",
  "build": "bun ../../../scripts/tsdown.mjs",
  "dev": "bun run build --watch",
  "lint": "bun run lint:fix",
  "lint:fix": "node ../../../scripts/biome.cjs check --write --unsafe --only=nursery/useSortedClasses . && node ../../../scripts/biome.cjs check --write .",
  "lint:check": "node ../../../scripts/biome.cjs check .",
  "dbs:generate": "database generate --dry-run",
  "dbs:migrate": "database migrate:dev --dry-run",
  "dbs:deploy": "database migrate:deploy --dry-run",
  "dbs:status": "database migrate:status",
  "dbs:seed": "database seed --dry-run",
  "schema:generate": "database schema:generate",
  "schema:compose": "database schema:compose",
  "test": "bun test"
}
```

## Declared documentation links

- [App Cli Database documentation](https://www.npmjs.com/package/%40lssm-tech%2Fapp.cli-database) — declared link; destination not verified.

```json
{
  "url": "https://www.npmjs.com/package/%40lssm-tech%2Fapp.cli-database",
  "kind": "readme"
}
```

## Existing agent-guide projection

```json
{
  "path": "packages/apps/web-landing/public/llms-packages/app.cli-database.txt",
  "route": "/llms/app.cli-database",
  "sourceUrl": "https://github.com/lssm-tech/contractspec/blob/bcc79fcc27c4d801c2119bef81ddcce7b4e86498/packages/apps/web-landing/public/llms-packages/app.cli-database.txt",
  "blobSha": "12f2f449dc589745dc7e13a8d253ec2bb7e753db",
  "sourcePin": "bcc79fcc27c4d801c2119bef81ddcce7b4e86498",
  "bodyEqualsReadme": true,
  "aggregateSourcePath": "packages/apps/web-landing/public/llms-full.txt",
  "aggregateBlobSha": "691b1d33efee24c440598b9106c81432f56aafaf"
}
```
