Rewrite project documentation
This commit is contained in:
@@ -2,12 +2,33 @@
|
||||
|
||||
## Project Goal
|
||||
|
||||
Build a spreadsheet-like electrical distribution board circuit list editor.
|
||||
Maintain and extend a spreadsheet-like electrical distribution board circuit list editor.
|
||||
|
||||
The editor is used for electrical planning in execution design.
|
||||
|
||||
It must support circuits, device rows, project devices, drag-and-drop restructuring, stable equipment identifiers and later electrical sizing logic.
|
||||
|
||||
## Current Supported Architecture
|
||||
|
||||
- Frontend: Next.js App Router under `src/app` with reusable editor modules under `src/frontend`.
|
||||
- API: Express composition starts in `src/server/index.ts`.
|
||||
- Domain rules: `src/domain`.
|
||||
- Persistence: SQLite/Drizzle schemas, repositories and migrations under `src/db`.
|
||||
- Primary editor route:
|
||||
`src/app/projects/[projectId]/circuit-lists/[circuitListId]/tree-edit/page.tsx`.
|
||||
- Primary editor component: `src/frontend/components/circuit-tree-editor.tsx`.
|
||||
- Grid ownership, projection, insertion and safety rules live in the pure
|
||||
`src/frontend/components/circuit-grid-*.ts` modules.
|
||||
- Critical multi-write commands use injected transaction repositories with real
|
||||
SQLite commit/rollback tests.
|
||||
|
||||
The supported runtime model is Circuit-First. The former Consumer UI and API are
|
||||
removed. Retained `consumers` rows, migration mappings and reports are upgrade-only
|
||||
data accessed by `npm run db:migrate:legacy-consumers`; do not build application
|
||||
features on them.
|
||||
|
||||
See `docs/current-architecture.md` for the complete module and request flow.
|
||||
|
||||
## Critical Domain Rules
|
||||
|
||||
- A circuit is not the same thing as one device row.
|
||||
@@ -112,6 +133,9 @@ Renumber only when the user explicitly triggers "Renumber section".
|
||||
|
||||
The circuit list table should behave like a spreadsheet.
|
||||
|
||||
User-facing frontend text must be German unless a domain-standard technical term
|
||||
is intentionally retained.
|
||||
|
||||
Cells show static text by default.
|
||||
|
||||
Inline edit starts by:
|
||||
@@ -196,7 +220,8 @@ After saving, the row becomes linked to the new project device.
|
||||
|
||||
## Undo / Redo
|
||||
|
||||
Implement undo/redo for structural and destructive operations.
|
||||
Session-local undo/redo exists for structural and destructive operations.
|
||||
Persistent project-wide undo/redo remains future work.
|
||||
|
||||
Required operations:
|
||||
|
||||
@@ -232,6 +257,46 @@ Future sizing will need:
|
||||
|
||||
Users must be able to override sizing suggestions.
|
||||
|
||||
## Persistence and Migration Rules
|
||||
|
||||
- SQLite is the currently supported database.
|
||||
- Never edit an already applied migration.
|
||||
- Back up an existing database before applying a new migration.
|
||||
- Inspect generated SQL; it must contain only the intended schema change.
|
||||
- Keep database backups separate from future logical project snapshots.
|
||||
- Do not import the global SQLite singleton into domain services.
|
||||
- Keep synchronous SQLite transaction behavior inside persistence adapters.
|
||||
- Preserve stable UUIDs and explicit transaction boundaries for a later
|
||||
PostgreSQL adapter.
|
||||
|
||||
## Current Deferred Work
|
||||
|
||||
- persistent project revisions and undo/redo
|
||||
- named logical snapshots and restore
|
||||
- Revit/CSV/IFCGUID round-trip
|
||||
- full electrical sizing
|
||||
- multi-user/PostgreSQL operation
|
||||
- supported production deployment
|
||||
|
||||
Do not implement these while working on an unrelated phase.
|
||||
|
||||
## Documentation and Verification
|
||||
|
||||
- `README.md` is the setup entry point.
|
||||
- `docs/README.md` is the documentation map.
|
||||
- `docs/current-architecture.md` describes current code paths.
|
||||
- `docs/spec/` contains requirements and roadmap, not proof of implementation.
|
||||
- `docs/archive/` is historical and must not drive current implementation.
|
||||
|
||||
For a normal code change run the relevant focused tests plus:
|
||||
|
||||
- `npm test`
|
||||
- `npm run build:api`
|
||||
- `npm run build:web`
|
||||
- `npx tsc --noEmit -p tsconfig.next.json`
|
||||
|
||||
Use a concise imperative commit message for each completed, verified work package.
|
||||
|
||||
## Response Style for Codex
|
||||
|
||||
Be concise.
|
||||
|
||||
Reference in New Issue
Block a user