feat(cli): wire mode dispatch ke server interfaces — --api/--ws/--grpc/--web start server; add tsconfig paths

This commit is contained in:
asepharyana
2026-09-02 22:50:38 +07:00
parent 1a6268bde5
commit 02a55235cf
4 changed files with 37 additions and 12 deletions
+5 -1
View File
@@ -11,7 +11,11 @@
"dependencies": {
"@zesdex/domain": "workspace:*",
"@zesdex/application": "workspace:*",
"@zesdex/infrastructure": "workspace:*"
"@zesdex/infrastructure": "workspace:*",
"@zesdex/api": "workspace:*",
"@zesdex/ws": "workspace:*",
"@zesdex/grpc": "workspace:*",
"@zesdex/web": "workspace:*"
},
"devDependencies": {
"@types/bun": "^1.2.0"
+23 -10
View File
@@ -127,23 +127,36 @@ async function main(): Promise<void> {
}
if (opts.daemon) {
console.info("daemon mode not yet wired (Fase 5) — falling back to REPL");
console.info("daemon mode not yet wired — falling back to REPL");
await runRepl();
} else if (opts.attach !== null) {
console.info(`attach mode for session '${opts.attach}' not yet wired (Fase 5)`);
console.info(`attach mode for session '${opts.attach}' not yet wired`);
process.exit(1);
} else if (opts.api) {
console.info(`api mode port ${opts.apiPort} not yet wired (Fase 5)`);
process.exit(1);
const { newApiState, startApiServer } = await import("@zesdex/api");
const baseDir =
process.env.ZESDEX_STORE ?? path.join(os.homedir(), ".local", "share", "zesdex");
const state = newApiState(
baseDir,
process.env.ZESDEX_JWT_SECRET ?? "dev-secret-change-me",
process.env.OPENAI_API_KEY ?? "",
process.env.ZESDEX_MODEL ?? "claude-opus-5",
process.env.OPENAI_API_BASE ?? undefined,
);
startApiServer(state, opts.apiPort);
await new Promise(() => {});
} else if (opts.ws) {
console.info(`ws mode port ${opts.wsPort} not yet wired (Fase 5)`);
process.exit(1);
const { startWsServer } = await import("@zesdex/ws");
startWsServer(opts.wsPort);
await new Promise(() => {});
} else if (opts.grpc) {
console.info(`grpc mode port ${opts.grpcPort} not yet wired (Fase 5)`);
process.exit(1);
const { startGrpcServer } = await import("@zesdex/grpc");
startGrpcServer(opts.grpcPort);
await new Promise(() => {});
} else if (opts.web) {
console.info(`web mode port ${opts.webPort} not yet wired (Fase 5)`);
process.exit(1);
const { startWebServer } = await import("@zesdex/web");
startWebServer(opts.webPort, process.env.ZESDEX_WEB_DIR ?? undefined);
await new Promise(() => {});
} else {
// Default: single-process REPL.
await runRepl();
+4
View File
@@ -28,9 +28,13 @@
"name": "@zesdex/cli",
"version": "1.21.2",
"dependencies": {
"@zesdex/api": "workspace:*",
"@zesdex/application": "workspace:*",
"@zesdex/domain": "workspace:*",
"@zesdex/grpc": "workspace:*",
"@zesdex/infrastructure": "workspace:*",
"@zesdex/web": "workspace:*",
"@zesdex/ws": "workspace:*",
},
"devDependencies": {
"@types/bun": "^1.2.0",
+5 -1
View File
@@ -22,7 +22,11 @@
"paths": {
"@zesdex/domain": ["./apps/packages/domain/src/index.ts"],
"@zesdex/application": ["./apps/packages/application/src/index.ts"],
"@zesdex/infrastructure": ["./apps/packages/infrastructure/src/index.ts"]
"@zesdex/infrastructure": ["./apps/packages/infrastructure/src/index.ts"],
"@zesdex/api": ["./apps/interfaces/api/src/index.ts"],
"@zesdex/ws": ["./apps/interfaces/ws/src/index.ts"],
"@zesdex/grpc": ["./apps/interfaces/grpc/src/index.ts"],
"@zesdex/web": ["./apps/interfaces/web/src/index.ts"]
}
},
"include": ["apps/packages/*/src", "apps/interfaces/*/src", "apps/interfaces/*/bin"]