refactor(cli): rewrite CLI for reliability and better UX

Replace brocli framework with Node's built-in util.parseArgs and a
declarative command registry. The CLI no longer hangs after completing
because:
- DB connections are lazily created and explicitly closed
- Winston/Redis logging is excluded from the bundle entirely
- process.exit() is always called with proper exit codes

Additional improvements:
- Bundle size reduced from 5.3MB to 1.2MB (native drivers externalized)
- Proper column-aligned table output for list commands
- --json flag on list commands for scripting/automation
- Per-command --help with usage examples
- Execution timing shown on success
- Consistent exit codes (0=success, 1=error, 2=usage)
- Docker wrapper sets DISABLE_REDIS_LOGS and uses exec
This commit is contained in:
Thomas Camlong committed 2026-05-21 16:05:27 +02:00
1 parent 48ef8eb6c0
commit 3dc382145c
20 files changed
+2248 -1469

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
import type { InferSelectModel } from "drizzle-orm";
import { createSchema } from "@homarr/core/infrastructure/db";
import { createDbMapping as createSchema } from "@homarr/core/infrastructure/db/mapping";
import * as mysqlSchema from "./mysql";
import * as pgSchema from "./postgresql";