chore: add pnpm monorepo skeleton with core contracts
Shared notebook model (types.ts), HTTP/WebSocket protocol (protocol.ts) and core function signatures (stubs) so core, server and web can be built in parallel. Minimal Fastify server with a health route and test.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import Fastify, { type FastifyInstance } from "fastify";
|
||||
import websocket from "@fastify/websocket";
|
||||
|
||||
export interface AppOptions {
|
||||
logger?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Builds the Fastify app. Feature areas live in their own folders and are
|
||||
* registered here as Fastify plugins, one line each:
|
||||
* M2 src/workspace/ (notebooks, hosts.yaml), src/ssh/, src/runs/ (queue, audit, artifacts, /api/events)
|
||||
* M4 src/terminal/ (node-pty + tmux, /api/terminal), src/watch/ (file.changed events)
|
||||
* M5 src/auth/ (login, persistent session secret)
|
||||
*/
|
||||
export async function buildApp(options: AppOptions = {}): Promise<FastifyInstance> {
|
||||
const app = Fastify({ logger: options.logger ?? false });
|
||||
await app.register(websocket);
|
||||
|
||||
app.get("/api/health", async () => ({ ok: true }));
|
||||
|
||||
return app;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import { buildApp } from "./app";
|
||||
|
||||
const host = process.env.SHELLBOOK_HOST ?? "127.0.0.1";
|
||||
const port = Number(process.env.SHELLBOOK_PORT ?? 8080);
|
||||
|
||||
const app = await buildApp({ logger: true });
|
||||
await app.listen({ host, port });
|
||||
Reference in New Issue
Block a user