src/: Rust backend (main.rs,lib.rs,server.rs).web/: Vite + React SPA (TypeScript). Built assets inweb/dist..env: local config (e.g.,TAVILY_API_KEYS). Do not commit secrets.- SQLite files (
*.db) are runtime artifacts and safe to ignore.
- Backend
cargo build— compile the server.cargo run -- --help— show CLI flags;--bind/--port/--db-pathetc.cargo fmt— format Rust code;cargo clippy -- -D warnings— lint.cargo test— run tests (add as you go).
- Frontend (
web/)bun install --frozen-lockfile— install deps;bun run --bun dev— local dev (Vite under Bun runtime).bun run build— build SPA toweb/dist;bun run preview— preview build.bun run storybook— run Storybook dev server athttp://127.0.0.1:56006.
- Hooks
lefthook install— enable pre-commit (cargo fmt,clippy, Markdown format) and commitlint.
- Rust: 2024 edition, rustfmt defaults; modules/files
snake_case, typesPascalCase, functions/varssnake_case. - TypeScript/React: components
PascalCasein*.tsx; hooksuseXxx. - Markdown: formatted by dprint (line width 100). Run
bunx --bun dprint fmtfor changed.md.
- Rust: prefer module unit tests via
#[cfg(test)]and integration tests undertests/when needed. Run withcargo test. - Frontend: no test tooling preconfigured; if introducing tests, prefer Vitest + React Testing Library in
web/.
- Conventional Commits enforced (English only):
feat: add key rotation,fix(proxy): handle 432.- Header ≤ 72 chars; body wrapped ≤ 100; no Chinese chars (commitlint rule).
- PRs: include clear description, linked issues, CLI or UI screenshots for relevant changes, and local run steps.
- Configure keys via
.envor env vars (TAVILY_API_KEYS). - Do not commit secrets or local DB files. Backend can serve
web/distwhen present.
-
Default high ports: backend
58087, frontend55173(increment within high range if needed). -
Prefer foreground execution for development commands; if non-blocking execution is required, the caller manages lifecycle and logging explicitly.
-
Backend (Rust):
- Start:
scripts/start-backend-dev.sh - The script respects env vars like
TAVILY_API_KEYS,TAVILY_UPSTREAM,DEV_OPEN_ADMIN. - One-off smoke check (foreground):
timeout 120s scripts/start-backend-dev.sh(avoid hand-rollingcargo run).
- Start:
-
Frontend (Vite):
- Start:
scripts/start-frontend-dev.sh scripts/start-frontend-dev.shautomatically installs dependencies ifnode_modulesis missing, then starts Vite withbun run --bun dev.- Build for static serving:
cd web && bun run build, then run backend withscripts/start-backend-dev.shso it picks upweb/dist.
- Start:
-
Stop services:
- Use the process manager or shell session that launched each service.
- Avoid terminating unrelated sessions; only stop processes you started for this task.
-
Logs & notes:
- Logs stream to current stdout/stderr.
- If you need persisted logs, redirect output in the caller command and keep ownership clear.
- Vite dev server proxies to backend when configured in
web/vite.config.ts.
-
Storybook:
- Start:
cd web && bun install --frozen-lockfile && bun run storybook→http://127.0.0.1:56006(Storybook CLI forced through Bun runtime by the package script). - Keep it in the current shell for short sessions, or run it under any team-approved background strategy.
- Start:
-
Validation:
- Keep Playwright/Chrome DevTools sessions open for review; verify
/api/*,/mcp, and SPA routes. - Health:
curl -s http://127.0.0.1:58087/health→200; Summary:curl -s http://127.0.0.1:58087/api/summary | jq ..
- Keep Playwright/Chrome DevTools sessions open for review; verify
IMPORTANT
- 2025-03-??: During high-anonymity testing we accidentally hit the official Tavily MCP endpoint. Testing is now restricted to stub or sandbox upstreams only. Never point this project at the production Tavily endpoint unless explicitly approved.
- 2025-03-??: During high-anonymity testing we accidentally hit the official Tavily MCP endpoint. All future tests must target a local/mock upstream. Never hit production Tavily without explicit approval.
- daisyUI llms.txt: https://daisyui.com/llms.txt give me a light daisyUI 5 theme with tropical color palette
- 工作收尾时,心羽需确保后端服务正在运行(dev 模式可加
--dev-open-admin),以便主人可以立即访问/或/admin进行验收。若需关闭服务,必须先征得主人确认再停。 - 心羽在“工作就绪”进入评审前,必须确保开发服务器已就绪:后端监听在
127.0.0.1:58087且健康检查通过,前端 Vite Dev Server 运行在127.0.0.1:55173,页面可直接打开并完成交互验证(必要时保持 Playwright 会话开启供主人复查)。