feat: add database reconciler

This commit is contained in:
2026-08-16 09:35:34 +07:00 Unverified
parent 3f70382fd3
commit a244f49155
6 changed files with 659 additions and 105 deletions
+19 -3
View File
@@ -1,4 +1,5 @@
import { defineCommand, runMain } from "citty";
import { db } from "./command/db";
import { down } from "./command/down";
import { exec } from "./command/exec";
import { logs } from "./command/logs";
@@ -10,16 +11,31 @@ import { up } from "./command/up";
import { provideContext } from "./lib/context";
import z, { ZodError } from "zod";
function formatUnknownError(error: unknown): string {
if (error instanceof ZodError) return z.prettifyError(error);
if (error instanceof Error) {
const stack = error.stack?.split("\n").slice(0, 3).join("\n");
return stack && stack.trim().length > 0 ? stack : error.message;
}
try {
return JSON.stringify(error, null, 2);
} catch {
return String(error);
}
}
const main = defineCommand({
meta: {
name: "kuber",
version: "1.0.0",
description: "Docker Compose -> K8s translation layer",
},
subCommands: { down, exec, logs, ps, restart, start, stop, up },
subCommands: { db, down, exec, logs, ps, restart, start, stop, up },
});
provideContext(() => runMain(main)).catch((e) => {
if (e instanceof ZodError) console.error(z.prettifyError(e));
else console.error(e);
console.error(formatUnknownError(e));
process.exitCode = 1;
});