@vibest/cli 0.0.0 → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md ADDED
@@ -0,0 +1,9 @@
1
+ # @vibest/cli
2
+
3
+ ## 0.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - vibe coding cli & web ui
8
+ - Updated dependencies
9
+ - @vibest/web@0.0.1
package/package.json CHANGED
@@ -1,38 +1,38 @@
1
1
  {
2
- "name": "@vibest/cli",
3
- "type": "module",
4
- "version": "0.0.0",
5
- "bin": {
6
- "vibest": "./dist/cli.js"
7
- },
8
- "scripts": {
9
- "dev": "bun --watch src/cli.ts",
10
- "build": "tsdown src/cli.ts --format esm --platform node --outdir ./dist",
11
- "start": "NODE_ENV=production bun --bun dist/cli.js",
12
- "typecheck": "tsc --noEmit",
13
- "clean": "git clean -xdf node_modules .turbo dist"
14
- },
15
- "dependencies": {
16
- "@anthropic-ai/claude-agent-sdk": "^0.1.12",
17
- "@elysiajs/cors": "^1.4.0",
18
- "@elysiajs/node": "^1.4.1",
19
- "@elysiajs/static": "^1.4.2",
20
- "@orpc/openapi": "^1.9.3",
21
- "@orpc/server": "^1.9.1",
22
- "ai": "^5.0.63",
23
- "elysia": "^1.4.11",
24
- "uuid": "^13.0.0",
25
- "ws": "^8.18.3",
26
- "zod": "^3.25.61"
27
- },
28
- "devDependencies": {
29
- "@types/bun": "^1.3.0",
30
- "@vibe-web/agents": "workspace:*",
31
- "@vibe-web/server-rpc": "workspace:*",
32
- "@vibe-web/typescript": "workspace:*",
33
- "tsdown": "^0.13.5"
34
- },
35
- "engines": {
36
- "node": ">=18.0.0"
37
- }
38
- }
2
+ "name": "@vibest/cli",
3
+ "type": "module",
4
+ "version": "0.0.1",
5
+ "bin": {
6
+ "vibest": "./dist/cli.js"
7
+ },
8
+ "dependencies": {
9
+ "@anthropic-ai/claude-agent-sdk": "^0.1.12",
10
+ "@hono/node-server": "^1.19.5",
11
+ "@orpc/openapi": "^1.9.3",
12
+ "@orpc/server": "^1.9.1",
13
+ "ai": "^5.0.63",
14
+ "hono": "^4.9.12",
15
+ "uuid": "^13.0.0",
16
+ "ws": "^8.18.3",
17
+ "zod": "^3.25.61",
18
+ "@vibest/web": "0.0.1"
19
+ },
20
+ "devDependencies": {
21
+ "@types/bun": "^1.3.0",
22
+ "tsdown": "^0.13.5",
23
+ "tsx": "latest",
24
+ "@vibe-web/agents": "0.0.1",
25
+ "@vibe-web/server-rpc": "0.0.1",
26
+ "@vibe-web/typescript": "0.0.0"
27
+ },
28
+ "engines": {
29
+ "node": ">=18.0.0"
30
+ },
31
+ "scripts": {
32
+ "dev": "tsx --watch src/cli.ts",
33
+ "build": "tsdown",
34
+ "start": "NODE_ENV=production bun --bun dist/cli.js",
35
+ "typecheck": "tsc --noEmit",
36
+ "clean": "git clean -xdf node_modules .turbo dist"
37
+ }
38
+ }
package/src/cli.ts CHANGED
@@ -1,13 +1,25 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ import { serve } from "@hono/node-server";
3
4
  import { createServer } from "./server";
4
5
 
5
- async function main() {
6
- const server = createServer();
6
+ const app = createServer();
7
+ const server = serve({
8
+ fetch: app.fetch,
9
+ port: 4000,
10
+ });
7
11
 
8
- server.listen(4000, () => {
9
- console.log("Server is running on port 4000");
12
+ // graceful shutdown
13
+ process.on("SIGINT", () => {
14
+ server.close();
15
+ process.exit(0);
16
+ });
17
+ process.on("SIGTERM", () => {
18
+ server.close((err) => {
19
+ if (err) {
20
+ console.error(err);
21
+ process.exit(1);
22
+ }
23
+ process.exit(0);
10
24
  });
11
- }
12
-
13
- main();
25
+ });
package/src/server.ts CHANGED
@@ -1,64 +1,39 @@
1
- import path from "node:path";
2
- import { fileURLToPath } from "node:url";
3
- import { cors } from "@elysiajs/cors";
4
- import { node } from "@elysiajs/node";
5
- import { staticPlugin } from "@elysiajs/static";
6
- import { RPCHandler } from "@orpc/server/fetch";
7
- import { ClaudeCodeAgent } from "@vibe-web/agents/claude-code";
8
- import { router } from "@vibe-web/server-rpc/routes";
9
- import { Elysia, file } from "elysia";
1
+ import { createRequire } from "node:module";
2
+ import path, { extname } from "node:path";
3
+ import { serveStatic } from "@hono/node-server/serve-static";
4
+ import { createFetchRPCHandler } from "@vibe-web/server-rpc";
5
+ import { Hono } from "hono";
10
6
 
11
- const isBun = typeof Bun !== "undefined";
12
-
13
- const __filename = fileURLToPath(import.meta.url);
14
- const __dirname = path.dirname(__filename);
15
- const staticRoot = path.resolve(__dirname, "../../apps/web/.output/public");
7
+ const require = createRequire(import.meta.url);
8
+ const staticRoot = path.resolve(
9
+ path.dirname(require.resolve("@vibest/web/package.json")),
10
+ "dist",
11
+ );
16
12
 
17
13
  export function createServer() {
18
- const claudeCodeAgent = new ClaudeCodeAgent();
19
- const rpcHandler = new RPCHandler(router, {
20
- plugins: [],
21
- eventIteratorKeepAliveComment: "ping",
22
- });
14
+ const handler = createFetchRPCHandler();
15
+ const app = new Hono();
16
+ app
17
+ .get("/api/health", (c) => c.json({ status: "ok" }))
18
+ .use("/api/rpc/*", async (c, next) => {
19
+ const { matched, response } = await handler(c.req.raw, {
20
+ prefix: "/api/rpc",
21
+ });
22
+
23
+ if (matched) {
24
+ return c.newResponse(response.body, response);
25
+ }
23
26
 
24
- return (
25
- new Elysia({
26
- adapter: isBun ? undefined : node(),
27
+ await next();
27
28
  })
28
- .use(cors())
29
- .get("/api/health", () => ({
30
- status: "ok",
31
- timestamp: new Date().toISOString(),
32
- }))
33
- .all(
34
- "/api/rpc*",
35
- async ({ request }) => {
36
- const { response } = await rpcHandler.handle(request, {
37
- prefix: "/api/rpc",
38
- context: { claudeCodeAgent },
39
- });
40
- return response ?? new Response("Not Found", { status: 404 });
41
- },
42
- {
43
- parse: "none", // Disable Elysia body parser to prevent "body already used" error
44
- },
45
- )
46
- // Static file serving (handles /assets/* and other static files)
47
- .use(
48
- staticPlugin({
49
- assets: staticRoot,
50
- prefix: "/",
51
- indexHTML: false,
52
- ignorePatterns: ["_shell.html"],
53
- }),
54
- )
55
- // SPA fallback - serve _shell.html for all unmatched routes
56
- .onError(({ code, set }) => {
57
- if (code === "NOT_FOUND") {
58
- set.status = 200;
59
- set.headers["content-type"] = "text/html; charset=utf-8";
60
- return file(path.join(staticRoot, "_shell.html"));
61
- }
62
- })
63
- );
29
+ .use(
30
+ "*",
31
+ serveStatic({
32
+ root: staticRoot,
33
+ rewriteRequestPath: (requestPath) =>
34
+ extname(requestPath) ? requestPath : "/index.html",
35
+ }),
36
+ );
37
+
38
+ return app;
64
39
  }
@@ -0,0 +1,6 @@
1
+ import { defineConfig } from "tsdown";
2
+
3
+ export default defineConfig({
4
+ entry: ["src/cli.ts"],
5
+ platform: "node",
6
+ });
package/turbo.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "extends": ["//"],
4
4
  "tasks": {
5
5
  "dev": {
6
- "dependsOn": ["web#build"]
6
+ "dependsOn": ["@vibest/web#build"]
7
7
  }
8
8
  }
9
9
  }