mirror of
https://github.com/nexu-io/open-design.git
synced 2026-05-31 19:04:39 +07:00
4.8 KiB
4.8 KiB
AGENTS.md
Project shape
- pnpm workspace with packages from
pnpm-workspace.yaml:apps/web,apps/daemon,packages/contracts, ande2e. - Runtime target is Node
~24withpnpm@10.33.2; use Corepack so the pinned pnpm version frompackage.jsonis selected. apps/webis a Next.js 16 App Router + React 18 client. Entrypoints:apps/web/app/, main client shellapps/web/src/App.tsx.packages/contractsis the shared, pure TypeScript web/daemon contract layer for API DTOs, SSE events, task states, and unified errors.apps/daemonis the local Express + SQLite process and theodbin (apps/daemon/dist/cli.jsafter build). It owns/api/*, agent spawning, skills, design systems, artifacts, and static serving.e2econtains both Playwright UI specs (e2e/specs) and Vitest/jsdom integration tests (e2e/tests).
Commands
- Install:
corepack enable && pnpm install - Full local dev:
pnpm dev:all— starts daemon and Next together. Defaults are daemon:7456, web:3000; busy ports are probed forward and exported asOD_PORT/NEXT_PORT. - Web only:
pnpm devfrom the root starts Next; pair it withpnpm daemonwhen API routes are needed. - Production local path:
pnpm buildwrites the static Next export toapps/web/out/;pnpm startbuilds and serves that export through the daemon. - Main verification:
pnpm typecheck && pnpm test && pnpm build - Residual JavaScript check:
pnpm check:residual-js; rootpnpm typecheckruns it after package and support typechecks. - Package tests:
pnpm --filter @open-design/web test,pnpm --filter @open-design/daemon test,pnpm --filter @open-design/e2e test - Focused Vitest:
pnpm --dir apps/web exec vitest run -c vitest.config.ts src/providers/sse.test.ts(adjust package dir and test path as needed). - Playwright UI:
pnpm test:ui; headed:pnpm test:ui:headed. Playwright startspnpm dev:allwith isolated data undere2e/.od-dataand strict dynamic ports. - Live adapter smoke:
pnpm test:e2e:liverunse2e/scripts/runtime-adapter.e2e.live.test.tsthrough Node strip-types.
TypeScript and boundary conventions
- New project-owned entrypoints, modules, scripts, tests, reporters, and configs use TypeScript. The residual JavaScript allowlist is limited to generated output, vendored dependencies, and compatibility build artifacts such as
apps/daemon/dist/**/*.{js,mjs,cjs},apps/web/.next/**/*.{js,mjs,cjs}, andapps/web/out/**/*.{js,mjs,cjs}. - Shared web/daemon contracts go in
packages/contracts; keep this package free of Next.js, Express, Node filesystem/process APIs, browser APIs, SQLite, and daemon internals. - Keep UI-only state and presentation unions in
apps/web; import daemon-facing API, SSE, task, and error contracts from@open-design/contracts. - Keep local capability logic in
apps/daemon: filesystem, SQLite, agent CLI spawning, task lifecycle, logs, artifacts, skills, design systems, and static serving. - Runtime validation policy and schema enforcement belong to the later validation workstream; current shared contracts define the typed target shape.
Runtime data and ports
- The daemon auto-creates local data under
.od/by default: SQLite at.od/app.sqlite, per-project agent CWDs at.od/projects/<id>/, saved renders at.od/artifacts/. - Keep
.od/,e2e/.od-data, Playwright reports, and agent scratch dirs out of git;.gitignorealready covers them. OD_DATA_DIRrelocates daemon data relative to the repo root; Playwright uses this for isolated runs.- In development,
apps/web/next.config.tsrewrites/api/*,/artifacts/*, and/frames/*to the daemon port. In production, the daemon servesapps/web/out/directly.
Agent, skill, and design-system wiring
- The daemon scans
PATHfor local CLIs inapps/daemon/agents.tsand spawns them withcwdpinned to.od/projects/<id>/. - Agent stdout parsing is per transport: Claude stream JSON, Copilot stream JSON, ACP JSON-RPC, or plain text. Changes to CLI args belong in
apps/daemon/agents.tsand matching parser tests. - Skills are folder bundles under
skills/withSKILL.md; extendedod:frontmatter is parsed byapps/daemon/skills.ts. Restart the daemon after adding or changing skill folders. - Design systems are
design-systems/*/DESIGN.md;scripts/sync-design-systems.tsre-imports upstream systems. - Prompt composition lives in
apps/web/src/prompts/system.ts,discovery.ts, anddirections.ts; artifacts are parsed/rendered throughapps/web/src/artifacts/andapps/web/src/runtime/.
Testing notes
- Web Vitest includes
apps/web/src/**/*.test.{ts,tsx}in a Node environment. - Daemon Vitest includes
apps/daemon/**/*.test.{ts,tsx}in a Node environment. - E2E Vitest includes
e2e/tests/**/*.test.{ts,tsx}in jsdom with automatic React JSX. - Playwright uses Chromium only, writes reports under
e2e/reports/, and reuses an existing server outside CI.