Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This repository contains planning artifacts and the early implementation scaffol
- Runtime and tooling emphasis: **Bun**, Turborepo, Drizzle, BetterAuth, Hono.

## Assistant Identity / Model Context
- If asked which model is running, respond with: **GPT-5.2-Codex, created by OpenAI**.
- If asked which model is running, reply with the runtime-configured model identifier when available; otherwise provide a neutral capability-focused response.

## Current Strategic Inputs
Primary planning docs to align with before implementation:
Expand Down
16 changes: 16 additions & 0 deletions betterbase/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,23 @@ node_modules
.turbo
dist
.next

.vscode/
.idea/

.env
.env.*
.env.local
.env.test
!.env.example

*.log
npm-debug.log
yarn-error.log
pnpm-debug.log

coverage/
.cache/
.parcel-cache/

.DS_Store
6 changes: 6 additions & 0 deletions betterbase/apps/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,11 @@
"build": "bun build ./src/index.ts --outfile ./dist/index.js --target bun",
"dev": "bun run src/index.ts",
"typecheck": "tsc -p tsconfig.json --noEmit"
},
"dependencies": {
"@betterbase/cli": "workspace:*"
},
"devDependencies": {
"typescript": "^5.9.3"
}
}
14 changes: 10 additions & 4 deletions betterbase/apps/cli/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
#!/usr/bin/env node
#!/usr/bin/env bun

/**
* Legacy bb wrapper entrypoint.
*
* Forwards execution to the canonical CLI implementation in packages/cli.
*/
export async function runLegacyCli(): Promise<void> {
const cliModule = await import('../../../packages/cli/src/index');
await cliModule.runCli(process.argv);
const { runCli } = await import('@betterbase/cli');
await runCli(process.argv);
}

if (import.meta.main) {
await runLegacyCli();
(async () => {
await runLegacyCli();
})().catch((error) => {
const message = error instanceof Error ? error.message : String(error);
console.error(message);
process.exitCode = 1;
});
}
7 changes: 3 additions & 4 deletions betterbase/apps/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
"rootDir": ".",
"types": ["bun"]
},
"include": [
"src"
]
"include": ["src", "test"]
}
8 changes: 6 additions & 2 deletions betterbase/packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
},
"devDependencies": {
"@types/bun": "^1.3.9",
"typescript": "^5.6.0"
}
"typescript": "^5.9.3"
},
"exports": {
".": "./src/index.ts"
},
"main": "./src/index.ts"
}
18 changes: 16 additions & 2 deletions betterbase/packages/cli/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,26 @@ export async function buildStandaloneCli(): Promise<void> {
});

if (!result.success) {
throw new Error(`Build failed with ${result.logs.length} error(s).`);
const diagnostics = result.logs.map((log) => (typeof log === 'string' ? log : JSON.stringify(log))).join('\n');
throw new Error(`Build failed with ${result.logs.length} error(s).\n${diagnostics}`);
}

const outputPath = './dist/index.js';
const compiled = await Bun.file(outputPath).text();
await Bun.write(outputPath, `#!/usr/bin/env bun\n${compiled}`);
}

await buildStandaloneCli();
async function main(): Promise<void> {
await buildStandaloneCli();
}

const isEsmMain = typeof import.meta !== 'undefined' && import.meta.main;
const cjs = globalThis as unknown as { require?: { main?: unknown }; module?: unknown };
const isCjsMain = cjs.require?.main !== undefined && cjs.require.main === cjs.module;

if (isEsmMain || isCjsMain) {
main().catch((error) => {
console.error('Build failed:', error);
process.exit(1);
});
}
Loading