@danceroutine/tango-cli
v0.1.0
Published
Unified Tango command line interface for migrations and code generation
Maintainers
Readme
@danceroutine/tango-cli
@danceroutine/tango-cli provides the tango command-line executable.
This package gives Tango one unified command surface for project setup and maintenance workflows. It exists so that application developers can learn one CLI instead of having to remember which package owns which command. Today that means migrations and project scaffolding. Over time it also gives Tango a stable place to compose future command modules.
Install
pnpm add -D @danceroutine/tango-cliThe CLI is typically a development dependency because it supports setup, generation, and migration workflows rather than application runtime behavior.
What the CLI is for
Use the tango binary when you want to:
- scaffold a new Tango project
- generate migrations from model metadata
- apply migrations to a database
- inspect a migration plan or status
The CLI package owns the executable itself. The feature packages still own their underlying behavior. For example, @danceroutine/tango-migrations owns migration generation and execution, while @danceroutine/tango-cli is the package that exposes those workflows through the tango binary.
Common commands
tango new my-app --framework express --package-manager pnpm --dialect sqlite
tango make:migrations --dialect sqlite --models ./src/models.ts --dir ./migrations --name add_posts
tango migrate --dialect sqlite --dir ./migrations --db ./app.sqlite
tango plan --dialect sqlite --dir ./migrations --db ./app.sqlite
tango status --dialect sqlite --dir ./migrations --db ./app.sqliteThe top-level new command is also available as codegen new. Both paths exist so that the first-run project bootstrap workflow feels straightforward while still fitting into the broader command-module structure.
Using the package programmatically
The root export is intentionally small. If you need to embed Tango's CLI into a custom binary or test harness, start with runCli() and createDefaultCommandModules():
import type { Argv } from 'yargs';
import {
createDefaultCommandModules,
runCli,
type TangoCliCommandModule,
} from '@danceroutine/tango-cli';
class AppCommandModule implements TangoCliCommandModule {
readonly id = 'app';
register(parser: Argv): Argv {
return parser.command(
'seed-demo-data',
'Load demo data into the local database',
() => {},
async () => {},
);
}
}
await runCli({
modules: [...createDefaultCommandModules(), new AppCommandModule()],
});This approach keeps command composition modular. Tango's built-in modules remain intact, and your application can add its own command tree alongside them.
Documentation
- Official documentation: https://danceroutine.github.io
- CLI reference: https://danceroutine.github.io/reference/cli-api
- Migrations topic: https://danceroutine.github.io/topics/migrations
Development
pnpm --filter @danceroutine/tango-cli build
pnpm --filter @danceroutine/tango-cli typecheck
pnpm --filter @danceroutine/tango-cli testFor the wider contributor workflow, use:
- https://danceroutine.github.io/contributing
License
MIT
