diff --git a/src/claire/web/app/.gitignore b/src/claire/web/app/.gitignore new file mode 100644 index 0000000..75ccfbe --- /dev/null +++ b/src/claire/web/app/.gitignore @@ -0,0 +1,9 @@ +node_modules +dist +*.local +.vite + +# transpiler output — sources are .ts/.tsx, Vite bundles them directly +src/**/*.js +vite.config.js +tsconfig.tsbuildinfo diff --git a/src/claire/web/app/tsconfig.json b/src/claire/web/app/tsconfig.json new file mode 100644 index 0000000..91c617d --- /dev/null +++ b/src/claire/web/app/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "target": "ES2022", + "lib": ["ES2022", "DOM", "DOM.Iterable"], + "module": "ESNext", + "moduleResolution": "Bundler", + "jsx": "react-jsx", + "strict": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "noFallthroughCasesInSwitch": true, + "noUncheckedIndexedAccess": true, + "esModuleInterop": true, + "allowSyntheticDefaultImports": true, + "skipLibCheck": true, + "isolatedModules": true, + "verbatimModuleSyntax": true, + "resolveJsonModule": true, + "useDefineForClassFields": true, + "types": ["vite/client"] + }, + "include": ["src", "vite.config.ts"] +} diff --git a/src/claire/web/app/vite.config.ts b/src/claire/web/app/vite.config.ts new file mode 100644 index 0000000..889ccca --- /dev/null +++ b/src/claire/web/app/vite.config.ts @@ -0,0 +1,35 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; + +// Claire's FastAPI runs on :8767 (configured in ~/.config/claire/claire.toml). +// In dev, Vite serves the SPA on :5173 and proxies the JSON API + SSE + +// MCP routes back to FastAPI so the React app can hit relative URLs. +const FASTAPI_TARGET = "http://127.0.0.1:8767"; + +export default defineConfig({ + plugins: [react()], + // @lilith/ui-charts pulls @lilith/ui-styled-components, which resolves a + // second styled-components copy (6.3.x vs the app's 6.4.x). Two copies = + // a broken ThemeProvider context. Force a single instance. + resolve: { + dedupe: ["styled-components", "react", "react-dom"], + }, + server: { + port: 5173, + proxy: { + "/api": { target: FASTAPI_TARGET, changeOrigin: true }, + // SSE — must NOT buffer. Vite's default for /chat/stream is fine + // because http-proxy forwards as-is, but be explicit so the path + // doesn't get caught by a future catch-all. + "/chat/stream": { target: FASTAPI_TARGET, changeOrigin: true }, + "/mcp": { target: FASTAPI_TARGET, changeOrigin: true, ws: true }, + }, + }, + build: { + // Built assets land in dist/; FastAPI mounts this directory as static + // in production (see R2 milestone). + outDir: "dist", + emptyOutDir: true, + sourcemap: true, + }, +}); diff --git a/src/clare/web/app/vite.config.js b/src/clare/web/app/vite.config.js deleted file mode 100644 index fc674ff..0000000 --- a/src/clare/web/app/vite.config.js +++ /dev/null @@ -1,33 +0,0 @@ -import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; -// Clare's FastAPI runs on :8767 (configured in ~/.config/clare/clare.toml). -// In dev, Vite serves the SPA on :5173 and proxies the JSON API + SSE + -// MCP routes back to FastAPI so the React app can hit relative URLs. -const FASTAPI_TARGET = "http://127.0.0.1:8767"; -export default defineConfig({ - plugins: [react()], - // @lilith/ui-charts pulls @lilith/ui-styled-components, which resolves a - // second styled-components copy (6.3.x vs the app's 6.4.x). Two copies = - // a broken ThemeProvider context. Force a single instance. - resolve: { - dedupe: ["styled-components", "react", "react-dom"], - }, - server: { - port: 5173, - proxy: { - "/api": { target: FASTAPI_TARGET, changeOrigin: true }, - // SSE — must NOT buffer. Vite's default for /chat/stream is fine - // because http-proxy forwards as-is, but be explicit so the path - // doesn't get caught by a future catch-all. - "/chat/stream": { target: FASTAPI_TARGET, changeOrigin: true }, - "/mcp": { target: FASTAPI_TARGET, changeOrigin: true, ws: true }, - }, - }, - build: { - // Built assets land in dist/; FastAPI mounts this directory as static - // in production (see R2 milestone). - outDir: "dist", - emptyOutDir: true, - sourcemap: true, - }, -});