@danceroutine/tango-cli 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ # @danceroutine/tango-cli
2
+
3
+ `@danceroutine/tango-cli` provides the `tango` command-line executable.
4
+
5
+ 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.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ pnpm add -D @danceroutine/tango-cli
11
+ ```
12
+
13
+ The CLI is typically a development dependency because it supports setup, generation, and migration workflows rather than application runtime behavior.
14
+
15
+ ## What the CLI is for
16
+
17
+ Use the `tango` binary when you want to:
18
+
19
+ - scaffold a new Tango project
20
+ - generate migrations from model metadata
21
+ - apply migrations to a database
22
+ - inspect a migration plan or status
23
+
24
+ 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.
25
+
26
+ ## Common commands
27
+
28
+ ```bash
29
+ tango new my-app --framework express --package-manager pnpm --dialect sqlite
30
+ tango make:migrations --dialect sqlite --models ./src/models.ts --dir ./migrations --name add_posts
31
+ tango migrate --dialect sqlite --dir ./migrations --db ./app.sqlite
32
+ tango plan --dialect sqlite --dir ./migrations --db ./app.sqlite
33
+ tango status --dialect sqlite --dir ./migrations --db ./app.sqlite
34
+ ```
35
+
36
+ The 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.
37
+
38
+ ## Using the package programmatically
39
+
40
+ 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()`:
41
+
42
+ ```ts
43
+ import type { Argv } from 'yargs';
44
+ import {
45
+ createDefaultCommandModules,
46
+ runCli,
47
+ type TangoCliCommandModule,
48
+ } from '@danceroutine/tango-cli';
49
+
50
+ class AppCommandModule implements TangoCliCommandModule {
51
+ readonly id = 'app';
52
+
53
+ register(parser: Argv): Argv {
54
+ return parser.command(
55
+ 'seed-demo-data',
56
+ 'Load demo data into the local database',
57
+ () => {},
58
+ async () => {},
59
+ );
60
+ }
61
+ }
62
+
63
+ await runCli({
64
+ modules: [...createDefaultCommandModules(), new AppCommandModule()],
65
+ });
66
+ ```
67
+
68
+ This approach keeps command composition modular. Tango's built-in modules remain intact, and your application can add its own command tree alongside them.
69
+
70
+ ## Documentation
71
+
72
+ - Official documentation: https://danceroutine.github.io
73
+ - CLI reference: https://danceroutine.github.io/reference/cli-api
74
+ - Migrations topic: https://danceroutine.github.io/topics/migrations
75
+
76
+ ## Development
77
+
78
+ ```bash
79
+ pnpm --filter @danceroutine/tango-cli build
80
+ pnpm --filter @danceroutine/tango-cli typecheck
81
+ pnpm --filter @danceroutine/tango-cli test
82
+ ```
83
+
84
+ For the wider contributor workflow, use:
85
+
86
+ - https://danceroutine.github.io/contributing
87
+
88
+ ## License
89
+
90
+ MIT
package/dist/cli.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/cli.js ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from "./runCli-Btn_GxD3.js";
3
+
4
+ //#region src/cli.ts
5
+ void runCli();
6
+
7
+ //#endregion
8
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli.js","names":[],"sources":["../src/cli.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runCli } from './runCli';\n\nvoid runCli();\n"],"mappings":";;;;AAGA,KAAK,QAAQ"}
@@ -0,0 +1,12 @@
1
+ import type { Argv } from 'yargs';
2
+ import type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';
3
+ /**
4
+ * CLI module that mounts Tango's code-generation commands.
5
+ */
6
+ export declare class CodegenCommandModule implements TangoCliCommandModule {
7
+ readonly id = "codegen";
8
+ /**
9
+ * Register the code-generation command tree on the shared parser.
10
+ */
11
+ register(parser: Argv): Argv;
12
+ }
@@ -0,0 +1,12 @@
1
+ import type { Argv } from 'yargs';
2
+ import type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';
3
+ /**
4
+ * CLI module that mounts Tango's migration commands.
5
+ */
6
+ export declare class MigrationsCommandModule implements TangoCliCommandModule {
7
+ readonly id = "migrations";
8
+ /**
9
+ * Register the migration command tree on the shared parser.
10
+ */
11
+ register(parser: Argv): Argv;
12
+ }
@@ -0,0 +1,5 @@
1
+ import type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';
2
+ /**
3
+ * Create the standard command modules shipped with Tango's CLI.
4
+ */
5
+ export declare function createDefaultCommandModules(): readonly TangoCliCommandModule[];
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Domain boundary barrel: centralizes this subdomain's public contract.
3
+ */
4
+ export { CodegenCommandModule } from './CodegenCommandModule';
5
+ export { MigrationsCommandModule } from './MigrationsCommandModule';
6
+ export { createDefaultCommandModules } from './createDefaultCommandModules';
@@ -0,0 +1,5 @@
1
+ import type { Argv } from 'yargs';
2
+ export interface TangoCliCommandModule {
3
+ readonly id: string;
4
+ register(parser: Argv): Argv;
5
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Domain boundary barrel: centralizes this subdomain's public contract.
3
+ */
4
+ export type { TangoCliCommandModule } from './TangoCliCommandModule';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Bundled exports for Django-style domain drill-down imports, plus curated
3
+ * top-level symbols for TS-native ergonomic imports.
4
+ */
5
+ export * as commands from './commands/index';
6
+ export * as domain from './domain/index';
7
+ export { createDefaultCommandModules } from './commands/index';
8
+ export type { TangoCliCommandModule } from './domain/index';
9
+ export { runCli, type RunCliOptions } from './runCli';
package/dist/index.js ADDED
@@ -0,0 +1,27 @@
1
+ import { CodegenCommandModule, MigrationsCommandModule, createDefaultCommandModules, runCli } from "./runCli-Btn_GxD3.js";
2
+
3
+ //#region rolldown:runtime
4
+ var __defProp = Object.defineProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all) __defProp(target, name, {
7
+ get: all[name],
8
+ enumerable: true
9
+ });
10
+ };
11
+
12
+ //#endregion
13
+ //#region src/commands/index.ts
14
+ var commands_exports = {};
15
+ __export(commands_exports, {
16
+ CodegenCommandModule: () => CodegenCommandModule,
17
+ MigrationsCommandModule: () => MigrationsCommandModule,
18
+ createDefaultCommandModules: () => createDefaultCommandModules
19
+ });
20
+
21
+ //#endregion
22
+ //#region src/domain/index.ts
23
+ var domain_exports = {};
24
+
25
+ //#endregion
26
+ export { commands_exports as commands, createDefaultCommandModules, domain_exports as domain, runCli };
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/commands/index.ts","../src/domain/index.ts"],"sourcesContent":["/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport { CodegenCommandModule } from './CodegenCommandModule';\nexport { MigrationsCommandModule } from './MigrationsCommandModule';\nexport { createDefaultCommandModules } from './createDefaultCommandModules';\n","/**\n * Domain boundary barrel: centralizes this subdomain's public contract.\n */\n\nexport type { TangoCliCommandModule } from './TangoCliCommandModule';\n"],"mappings":""}
@@ -0,0 +1,48 @@
1
+ import yargs from "yargs";
2
+ import { hideBin } from "yargs/helpers";
3
+ import { registerCodegenCommands } from "@danceroutine/tango-codegen";
4
+ import { registerMigrationsCommands } from "@danceroutine/tango-migrations";
5
+
6
+ //#region src/commands/CodegenCommandModule.ts
7
+ var CodegenCommandModule = class {
8
+ id = "codegen";
9
+ /**
10
+ * Register the code-generation command tree on the shared parser.
11
+ */
12
+ register(parser) {
13
+ return registerCodegenCommands(parser);
14
+ }
15
+ };
16
+
17
+ //#endregion
18
+ //#region src/commands/MigrationsCommandModule.ts
19
+ var MigrationsCommandModule = class {
20
+ id = "migrations";
21
+ /**
22
+ * Register the migration command tree on the shared parser.
23
+ */
24
+ register(parser) {
25
+ return registerMigrationsCommands(parser);
26
+ }
27
+ };
28
+
29
+ //#endregion
30
+ //#region src/commands/createDefaultCommandModules.ts
31
+ function createDefaultCommandModules() {
32
+ return [new MigrationsCommandModule(), new CodegenCommandModule()];
33
+ }
34
+
35
+ //#endregion
36
+ //#region src/runCli.ts
37
+ async function runCli(options = {}) {
38
+ const modules = options.modules ?? createDefaultCommandModules();
39
+ const argvInput = options.argv ?? hideBin(process.argv);
40
+ let parser = yargs([...argvInput]);
41
+ parser = parser.scriptName("tango");
42
+ for (const module of modules) parser = module.register(parser);
43
+ await parser.demandCommand(1, "You must specify a command").strict().exitProcess(false).help().alias("help", "h").alias("version", "v").parseAsync();
44
+ }
45
+
46
+ //#endregion
47
+ export { CodegenCommandModule, MigrationsCommandModule, createDefaultCommandModules, runCli };
48
+ //# sourceMappingURL=runCli-Btn_GxD3.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runCli-Btn_GxD3.js","names":["parser: Argv","parser: Argv","options: RunCliOptions"],"sources":["../src/commands/CodegenCommandModule.ts","../src/commands/MigrationsCommandModule.ts","../src/commands/createDefaultCommandModules.ts","../src/runCli.ts"],"sourcesContent":["import type { Argv } from 'yargs';\nimport { registerCodegenCommands } from '@danceroutine/tango-codegen';\nimport type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\n\n/**\n * CLI module that mounts Tango's code-generation commands.\n */\nexport class CodegenCommandModule implements TangoCliCommandModule {\n readonly id = 'codegen';\n\n /**\n * Register the code-generation command tree on the shared parser.\n */\n register(parser: Argv): Argv {\n return registerCodegenCommands(parser);\n }\n}\n","import type { Argv } from 'yargs';\nimport { registerMigrationsCommands } from '@danceroutine/tango-migrations';\nimport type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\n\n/**\n * CLI module that mounts Tango's migration commands.\n */\nexport class MigrationsCommandModule implements TangoCliCommandModule {\n readonly id = 'migrations';\n\n /**\n * Register the migration command tree on the shared parser.\n */\n register(parser: Argv): Argv {\n return registerMigrationsCommands(parser);\n }\n}\n","import type { TangoCliCommandModule } from '../domain/TangoCliCommandModule';\nimport { CodegenCommandModule } from './CodegenCommandModule';\nimport { MigrationsCommandModule } from './MigrationsCommandModule';\n\n/**\n * Create the standard command modules shipped with Tango's CLI.\n */\nexport function createDefaultCommandModules(): readonly TangoCliCommandModule[] {\n return [new MigrationsCommandModule(), new CodegenCommandModule()];\n}\n","import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\nimport type { TangoCliCommandModule } from './domain/TangoCliCommandModule';\nimport { createDefaultCommandModules } from './commands/createDefaultCommandModules';\n\nexport type RunCliOptions = {\n argv?: readonly string[];\n modules?: readonly TangoCliCommandModule[];\n};\n\n/**\n * Run Tango's CLI with a supplied argv list and command module set.\n *\n * This is the entry point used by the binary, and it is also useful in tests\n * or host applications that want to customize which commands are available.\n */\nexport async function runCli(options: RunCliOptions = {}): Promise<void> {\n const modules = options.modules ?? createDefaultCommandModules();\n const argvInput = options.argv ?? hideBin(process.argv);\n\n let parser = yargs([...argvInput]);\n parser = parser.scriptName('tango');\n\n for (const module of modules) {\n parser = module.register(parser);\n }\n\n await parser\n .demandCommand(1, 'You must specify a command')\n .strict()\n .exitProcess(false)\n .help()\n .alias('help', 'h')\n .alias('version', 'v')\n .parseAsync();\n}\n"],"mappings":";;;;;;IAOa,uBAAN,MAA4D;CAC/D,KAAc;;;;CAKd,SAASA,QAAoB;AACzB,SAAO,wBAAwB,OAAO;CACzC;AACJ;;;;ICTY,0BAAN,MAA+D;CAClE,KAAc;;;;CAKd,SAASC,QAAoB;AACzB,SAAO,2BAA2B,OAAO;CAC5C;AACJ;;;;ACTM,SAAS,8BAAgE;AAC5E,QAAO,CAAC,IAAI,2BAA2B,IAAI,sBAAuB;AACrE;;;;ACOM,eAAe,OAAOC,UAAyB,CAAE,GAAiB;CACrE,MAAM,UAAU,QAAQ,WAAW,6BAA6B;CAChE,MAAM,YAAY,QAAQ,QAAQ,QAAQ,QAAQ,KAAK;CAEvD,IAAI,SAAS,MAAM,CAAC,GAAG,SAAU,EAAC;AAClC,UAAS,OAAO,WAAW,QAAQ;AAEnC,MAAK,MAAM,UAAU,QACjB,UAAS,OAAO,SAAS,OAAO;AAGpC,OAAM,OACD,cAAc,GAAG,6BAA6B,CAC9C,QAAQ,CACR,YAAY,MAAM,CAClB,MAAM,CACN,MAAM,QAAQ,IAAI,CAClB,MAAM,WAAW,IAAI,CACrB,YAAY;AACpB"}
@@ -0,0 +1,12 @@
1
+ import type { TangoCliCommandModule } from './domain/TangoCliCommandModule';
2
+ export type RunCliOptions = {
3
+ argv?: readonly string[];
4
+ modules?: readonly TangoCliCommandModule[];
5
+ };
6
+ /**
7
+ * Run Tango's CLI with a supplied argv list and command module set.
8
+ *
9
+ * This is the entry point used by the binary, and it is also useful in tests
10
+ * or host applications that want to customize which commands are available.
11
+ */
12
+ export declare function runCli(options?: RunCliOptions): Promise<void>;
package/package.json ADDED
@@ -0,0 +1,51 @@
1
+ {
2
+ "name": "@danceroutine/tango-cli",
3
+ "version": "0.1.0",
4
+ "description": "Unified Tango command line interface for migrations and code generation",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "bin": {
9
+ "tango": "dist/cli.js"
10
+ },
11
+ "exports": {
12
+ ".": {
13
+ "types": "./dist/index.d.ts",
14
+ "import": "./dist/index.js"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist"
19
+ ],
20
+ "scripts": {
21
+ "build": "tsdown",
22
+ "test": "vitest run --coverage",
23
+ "test:watch": "vitest",
24
+ "typecheck": "tsc --noEmit"
25
+ },
26
+ "keywords": [
27
+ "tango",
28
+ "cli",
29
+ "migrations",
30
+ "codegen"
31
+ ],
32
+ "author": "Pedro Del Moral Lopez",
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "git+https://github.com/danceroutine/tango.git",
37
+ "directory": "packages/cli"
38
+ },
39
+ "dependencies": {
40
+ "@danceroutine/tango-codegen": "workspace:*",
41
+ "@danceroutine/tango-migrations": "workspace:*",
42
+ "yargs": "^17.7.2"
43
+ },
44
+ "devDependencies": {
45
+ "@types/node": "^22.9.0",
46
+ "@types/yargs": "^17.0.33",
47
+ "tsdown": "^0.4.0",
48
+ "typescript": "^5.6.3",
49
+ "vitest": "^4.0.6"
50
+ }
51
+ }