Files
codetyper.cli/scripts/build.ts
Carlos Gutierrez 0062e5d9d9 Terminal-based AI coding agent with interactive TUI for autonomous code generation.
Features:
  - Interactive TUI with React/Ink
  - Autonomous agent with tool calls (bash, read, write, edit, glob, grep)
  - Permission system with pattern-based rules
  - Session management with auto-compaction
  - Dual providers: GitHub Copilot and Ollama
  - MCP server integration
  - Todo panel and theme system
  - Streaming responses
  - GitHub-compatible project context
2026-01-27 23:33:06 -05:00

63 lines
1.6 KiB
TypeScript

#!/usr/bin/env bun
/**
* Build script for codetyper-cli
*
* Uses the @opentui/solid plugin for JSX transformation during bundling.
*/
import solidPlugin from "../node_modules/@opentui/solid/scripts/solid-plugin";
import { join, dirname } from "path";
import { fileURLToPath } from "url";
import { readFile, writeFile } from "fs/promises";
const __filename = fileURLToPath(import.meta.url);
const __dirname = dirname(__filename);
const ROOT_DIR = join(__dirname, "..");
process.chdir(ROOT_DIR);
// Sync version before building
const syncVersion = async (): Promise<void> => {
const packageJson = JSON.parse(
await readFile(join(ROOT_DIR, "package.json"), "utf-8"),
);
const { version } = packageJson;
await writeFile(
join(ROOT_DIR, "src/version.json"),
JSON.stringify({ version }, null, 2) + "\n",
);
console.log(`Synced version: ${version}`);
};
await syncVersion();
// Build the application
console.log("Building codetyper-cli...");
const result = await Bun.build({
entrypoints: ["./src/index.ts"],
outdir: "./dist",
target: "node",
conditions: ["node"],
plugins: [solidPlugin],
sourcemap: "external",
});
if (!result.success) {
console.error("Build failed:");
for (const log of result.logs) {
console.error(log);
}
process.exit(1);
}
// Update shebang to use node
const distPath = join(ROOT_DIR, "dist/index.js");
let distContent = await readFile(distPath, "utf-8");
distContent = distContent.replace(/^#!.*\n/, "#!/usr/bin/env node\n");
await writeFile(distPath, distContent);
console.log("Build completed successfully!");