Tech Stack
Directory Structure
The repository uses a pnpm workspace to organize multiple packages. Key directories are:
The full directory definition is in the repository source.
V1 and V2 Relationship
The V2 core lives inserver/src/modules/director/. Business capabilities are exposed through the application layer. V1 retains its own orchestration modules. Both versions share saved novel assets and underlying chapter capabilities, while tasks, recovery, and version ownership are managed independently.
To temporarily disable V2, set
DIRECTOR_NEXT_ENABLED=false in server/.env. This closes the V2 entry point without switching the director for existing novels. For more version isolation rules, see the Development Wiki on GitHub and the Module Boundaries note.
Environment Requirements
Common Commands
Run the following commands from the repository root. The full script list is in the root package.json.Testing
Tests use Node’s built-innode:test and node:assert/strict. Backend fast tests exclude heavy files such as real SQLite paths, migration smoke tests, RAG-compatible imports, and prompt governance scans by default. These are covered by test:integration and test:all.
When adding pure functions or states, add a corresponding
*.test.js under server/tests/, keeping the existing style: run pnpm run build first, then require("../dist/...") to reference compiled output. For more detailed test scope and isolation rules, see the Backend Testing Guide.
Development Wiki
The project’s stable knowledge is stored underdocs/wiki/, covering architecture decisions, workflow boundaries, module ownership, and debugging experience. It is not a release changelog. Directories include:
docs/wiki/architecture/: module boundaries, configuration ownership, API access token boundaries, etc.docs/wiki/workflows/: director runtime, chapter production chain, task states, book breakdown workflow, etc.docs/wiki/prompts/: Prompt Registry, structured output, JSON repair, etc.docs/wiki/rag/: Knowledge Base and context assemblydocs/wiki/debugging/: recurring failure modes, database migration drift, test isolation, etc.docs/wiki/product/: beginner-first and whole-book completion principles, workbench state expression, etc.
Environment Variables
Server and frontend configuration reference
Contributing
Report issues, submit PRs, and community links