Skip to content

Commit 134212f

Browse files
fix(cli): swap cac → @stacksjs/clapp
`bun run build` was failing with "Could not resolve cac" because the source still imported from `cac` but cac wasn't in package.json deps. Per the standing rule across the org, we use @stacksjs/clapp not cac. Migration: - bin/cli.ts: `import { CAC } from 'cac'` → `import { CLI } from '@stacksjs/clapp'`, `new CAC` → `new CLI` - 9 files in src/cli/commands/: type-only `import type { CAC } from 'cac'` → `import type { CLI } from '@stacksjs/clapp'`, function param `cli: CAC` → `cli: CLI` - package.json: add `@stacksjs/clapp: 0.2.0` to devDeps. Pinned exactly to 0.2.0 — 0.2.3 ships a malformed CLI.d.ts that breaks typecheck (TS1138), 0.2.4 fixes the parse error but tightens action callback types in a way that breaks existing handlers. Adjacent fix: `commit-msg` hook was `bunx gitlint` (the bare `gitlint` package was unpublished from npm in 2022). Repointed at `bunx --bun @stacksjs/gitlint`. Same trap that's bitten several other repos this round.
1 parent 833f4d8 commit 134212f

12 files changed

Lines changed: 23 additions & 21 deletions

File tree

bin/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// ============================================================================
55

66
import nodeProcess from 'node:process'
7-
import { CAC } from 'cac'
7+
import { CLI } from '@stacksjs/clapp'
88
import { version } from '../package.json'
99
import {
1010
registerLocalCommands,
@@ -16,7 +16,7 @@ import {
1616
registerUtilityCommands,
1717
} from '../src/cli/commands'
1818

19-
const cli = new CAC('dbtooling')
19+
const cli = new CLI('dbtooling')
2020

2121
// Register all command modules
2222
registerTableCommands(cli)

bun.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
},
5858
"devDependencies": {
5959
"@stacksjs/cli": "^0.70.23",
60+
"@stacksjs/clapp": "0.2.0",
6061
"@stacksjs/logging": "^0.70.23",
6162
"@stacksjs/storage": "^0.70.23",
6263
"@types/tar": "^7.0.87",
@@ -73,6 +74,6 @@
7374
},
7475
"autoRestage": true
7576
},
76-
"commit-msg": "bunx gitlint --edit .git/COMMIT_EDITMSG"
77+
"commit-msg": "bunx --bun @stacksjs/gitlint --edit .git/COMMIT_EDITMSG"
7778
}
7879
}

src/cli/commands/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// CLI Commands Index
33
// ============================================================================
44

5-
import type { CAC } from 'cac'
5+
import type { CLI } from '@stacksjs/clapp'
66
import { registerLocalCommands } from './local'
77
import { registerMigrateCommands } from './migrate'
88
import { registerModelsCommands } from './models'
@@ -24,7 +24,7 @@ export { registerUtilityCommands } from './utility'
2424
/**
2525
* Register all CLI commands
2626
*/
27-
export function registerAllCommands(cli: CAC): void {
27+
export function registerAllCommands(cli: CLI): void {
2828
registerTableCommands(cli)
2929
registerMigrateCommands(cli)
3030
registerQueryCommands(cli)

src/cli/commands/local.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
// Local DynamoDB Development Commands
33
// ============================================================================
44

5-
import type { CAC } from 'cac'
5+
import type { CLI } from '@stacksjs/clapp'
66
import { getConfig } from '../../config'
77
import { dynamoDb, runningProcesses } from '../../dynamodb'
88
import { handleError } from '../utils'
99

1010
/**
1111
* Register local development commands
1212
*/
13-
export function registerLocalCommands(cli: CAC): void {
13+
export function registerLocalCommands(cli: CLI): void {
1414
// start - Start local DynamoDB
1515
cli
1616
.command('start', 'Start DynamoDB Local')

src/cli/commands/migrate.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Migration CLI Commands
33
// ============================================================================
44

5-
import type { CAC } from 'cac'
5+
import type { CLI } from '@stacksjs/clapp'
66
import { getConfig } from '../../config'
77
import {
88
formatSchemaSummary,
@@ -30,7 +30,7 @@ import {
3030
/**
3131
* Register migration commands
3232
*/
33-
export function registerMigrateCommands(cli: CAC): void {
33+
export function registerMigrateCommands(cli: CLI): void {
3434
// migrate - Run migrations
3535
cli
3636
.command('migrate', 'Run database migrations based on your Stacks models')

src/cli/commands/models.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// ============================================================================
44
// View and explore Stacks model definitions
55

6-
import type { CAC } from 'cac'
6+
import type { CLI } from '@stacksjs/clapp'
77
import type { TreeNode } from '../ui'
88
import { getConfig } from '../../config'
99
import { handleCommandError } from '../error-formatter'
@@ -55,7 +55,7 @@ interface ParsedModel {
5555
/**
5656
* Register models viewer commands
5757
*/
58-
export function registerModelsCommands(cli: CAC): void {
58+
export function registerModelsCommands(cli: CLI): void {
5959
// models - List all models
6060
cli
6161
.command('models', 'List all Stacks models')

src/cli/commands/query.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Query CLI Commands
33
// ============================================================================
44

5-
import type { CAC } from 'cac'
5+
import type { CLI } from '@stacksjs/clapp'
66
import { getConfig } from '../../config'
77
import { handleError } from '../utils'
88

99
/**
1010
* Register query commands
1111
*/
12-
export function registerQueryCommands(cli: CAC): void {
12+
export function registerQueryCommands(cli: CLI): void {
1313
// query - Interactive query
1414
cli
1515
.command('query [table]', 'Query a DynamoDB table')

src/cli/commands/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// ============================================================================
44
// Interactive schema visualization and exploration
55

6-
import type { CAC } from 'cac'
6+
import type { CLI } from '@stacksjs/clapp'
77
import type { TreeNode } from '../ui'
88
import { getConfig } from '../../config'
99
import {
@@ -30,7 +30,7 @@ import {
3030
/**
3131
* Register schema viewer commands
3232
*/
33-
export function registerSchemaCommands(cli: CAC): void {
33+
export function registerSchemaCommands(cli: CLI): void {
3434
// schema - Show schema overview
3535
cli
3636
.command('schema', 'Display table schema overview')

src/cli/commands/seed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
// Seeder CLI Commands
33
// ============================================================================
44

5-
import type { CAC } from 'cac'
5+
import type { CLI } from '@stacksjs/clapp'
66
import { getConfig } from '../../config'
77
import { handleError } from '../utils'
88

99
/**
1010
* Register seeder commands
1111
*/
12-
export function registerSeedCommands(cli: CAC): void {
12+
export function registerSeedCommands(cli: CLI): void {
1313
// seed - Run seeders
1414
cli
1515
.command('seed', 'Run database seeders')

0 commit comments

Comments
 (0)