Skip to content

Commit fd94889

Browse files
committed
refactor: update documentation and architecture references
- Changed design document paths in AGENTS.md for clarity and organization. - Removed ARCHITECTURE.md as it has been integrated into the new design structure. - Updated CONTEXT.md to reflect new command names and streamlined setup instructions. - Revised README.md to simplify quick start commands and document registry. - Added new ADRs for state store design, plugin system, instance state model, procedural model pipeline, simulation plugin, shared selection, and build configuration. - Introduced design invariants document to outline architectural principles. - Updated product vision document to clarify the core experience and target audience. - Renamed npm script from "reference:pull" to "reference" for consistency.
1 parent 3070ac3 commit fd94889

17 files changed

Lines changed: 134 additions & 334 deletions

AGENTS.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# CCIV Project
22

3-
Designed architecture: `DESIGN.md` — read before any change (invariant).
4-
Current architecture state: `ARCHITECTURE.md`changes as codebase evolves.
3+
Design invariants: `docs/design/invariants.md` — read before any change (locked).
4+
Architecture reference: `docs/design/architecture.md`layer audit, file map, ADR index.
55

66
## Structure
77

@@ -17,10 +17,11 @@ Current architecture state: `ARCHITECTURE.md` — changes as codebase evolves.
1717
- `src/controls/` — OrbitControls from three/addons.
1818
- **`index.html`** — minimal HTML shell with inline CSS; loads `src/main.ts`.
1919
- **`scripts/`** — build tools.
20-
- `pull-reference.mjs` — downloads + extracts external assets to `.cache/references/` (throwaway).
20+
- `reference/pull.ts` — downloads external assets to `.cache/references/`.
2121
- `references.json` — list of external sources to pull.
22-
- `build-model.mjs` — copies reference data into `src/models/<id>/`, renames with our conventions, generates config/textures.
23-
- `models.json` — mapping from reference → owned model with mesh renames + material overrides.
22+
- `pipeline/` — compile + publish stages for GLB artifacts.
23+
- `build/` — procedural model generators (palm-island, ice-floe).
24+
- `generate.ts` — CLI runner for procedural model generation.
2425
- **`public/textures/<model>/`** — owned textures (committed), copied from reference during build-model.
2526

2627
## Commands
@@ -35,14 +36,11 @@ npm run build
3536
# Preview production build
3637
npm run preview
3738

38-
# Step 1: Pull external references → .cache/references/
39-
npm run model:pull
39+
# Setup after clone (compile models + publish manifest)
40+
npm run setup
4041

41-
# Step 2: Build owned models from references
42-
npm run model:build
43-
44-
# Step 3: Compile owned models to portable GLB artifacts
45-
npm run model:compile
42+
# Pull external references → .cache/references/
43+
npm run reference
4644
```
4745

4846
## Skill sources (defined in bin/dev)
@@ -71,7 +69,6 @@ Add new sources by appending to `SOURCES` in `bin/dev:19-27`.
7169
- Coordinate convention: Y-up, Z-bow(+), X-starboard(-).
7270
- Ship model extracted into-code: `src/models/ship/` contains hardcoded Float32Array/Uint16Array geometry for all 7 mesh groups (hull, deck, sails, aft, rigging, details, interior).
7371
- Texture pipeline: external reference → `.cache/references/` (gitignored, throwaway). Then `scripts/build-model.mjs` copies textures to `public/textures/<model>/` and generates `src/textures/sources.ts`.
74-
- New models: add entry to `scripts/models.json`, run `build-model.mjs`. The model becomes owned code in `src/models/<id>/` with clean naming — no reference prefixes leak in.
7572
- Entity lifecycle: implement `SceneEntity` (in `src/entity/types.ts`) and attach via `entityManager.attach()`. Entities communicate via the event bus (`src/event-bus.ts`).
7673
- All Three.js scene graph interaction goes through `ISceneObject` (`src/scene/types.ts`). Never pass `THREE.Object3D` directly across module boundaries. `SceneObject` adapter wraps raw Three.js objects. Use `.object3D` escape hatch only when Three.js interop is unavoidable (TransformControls, raycaster).
7774
- Skills provide specialized instructions and workflows for specific tasks.

ARCHITECTURE.md

Lines changed: 0 additions & 31 deletions
This file was deleted.

CONTEXT.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,13 @@ The asset pipeline transforms model configs into compiled GLB artifacts. Two sta
8989
- **compile** (`scripts/pipeline/compile.ts`) — reads `src/models/<id>/config.ts` for each model. For extracted models, reads geometry from `.cache/references/<asset>/data/`. For procedural models, imports the generator function and runs it. Outputs `public/models/<id>.glb`.
9090
- **publish** (`scripts/pipeline/publish.ts`) — scans `public/models/` for GLBs, reads metadata from configs, writes `public/models/manifest.json`.
9191

92-
Run via: `npm run build:models`
92+
Run via: `npm run setup`
9393

9494
### Reference Downloads
9595

9696
External asset sources are downloaded via a standalone tool, not part of the pipeline:
9797

98-
- **`npm run reference:pull`** — downloads assets from Poly Haven etc. to `.cache/references/<asset>/`. Implementations in `scripts/reference/providers/`.
98+
- **`npm run reference`** — downloads assets from Poly Haven etc. to `.cache/references/<asset>/`. Implementations in `scripts/reference/providers/`.
9999

100100
### Model Creation Paths
101101

@@ -128,7 +128,6 @@ Three ways to create a model, defined in `src/models/<id>/config.ts`:
128128
npm run dev # Vite dev server with HMR
129129
npm run build # production build
130130
npm run test # run all tests
131-
npm run build:models # compile all models to GLB + publish manifest
132-
npm run setup # setup after clone (build:models)
133-
npm run reference:pull # clone external references (optional, for customization)
131+
npm run setup # setup after clone (compile models + publish manifest)
132+
npm run reference # download external references (optional, for customization)
134133
```

README.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# CCIV — The Vessel
22

3-
A 3D ship viewer and environment editor built with Three.js + Vite + TypeScript. Explore a fully realized vessel in a dynamic ocean scene with stormy atmosphere, ship's log telemetry, and a dual-mode editor/viewer interface.
3+
A 3D ship viewer and environment editor built with Three.js + Vite + TypeScript.
44

55
```sh
66
npm install
@@ -19,21 +19,8 @@ npm run dev
1919
## Quick start
2020

2121
```sh
22-
# Build all models (compile GLBs + publish manifest)
23-
npm run build:models
24-
25-
# Start dev server
26-
npm run dev
27-
```
28-
29-
## Project structure
30-
31-
```
32-
src/ Runtime code
33-
scripts/ Build pipeline + reference downloader
34-
public/models/ Compiled GLB artifacts
35-
public/textures/ Owned textures
36-
docs/superpowers/ Specs and design documents
22+
npm run setup # compile models + publish manifest
23+
npm run dev # start dev server
3724
```
3825

3926
## Commands
@@ -43,9 +30,18 @@ docs/superpowers/ Specs and design documents
4330
| `npm run dev` | Dev server with HMR |
4431
| `npm run build` | Production build |
4532
| `npm test` | Run all tests |
46-
| `npm run build:models` | Compile all models → GLB + publish manifest |
47-
| `npm run reference:pull` | Download external references → `.cache/references/` |
33+
| `npm run setup` | Compile all models → GLB + publish manifest |
34+
| `npm run reference` | Download external references → `.cache/references/` |
4835

49-
## Architecture
36+
## Document registry
5037

51-
See [`docs/architecture.md`](docs/architecture.md) for full diagrams, data flow, and module dependency graph.
38+
| Path | Contents |
39+
|---|---|
40+
| `docs/design/invariants.md` | Locked architectural golden rules (read before changes) |
41+
| `docs/design/architecture.md` | Layer compliance audit, module map, ADR index |
42+
| `docs/adr/` | Architecture Decision Records (ADR-001 through ADR-012) |
43+
| `docs/product/vision.md` | Product direction, audience, non-goals |
44+
| `docs/references/` | External model geometry references |
45+
| `docs/superpowers/` | Feature specs and implementation plans (historical) |
46+
| `CONTEXT.md` | Domain glossary for AI agents and developers |
47+
| `AGENTS.md` | AI agent instructions |

docs/decisions/ADR-001-state-store-design.md renamed to docs/adr/ADR-006-state-store-design.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ADR-001: StateStore with Dotted-Path Subscriptions
1+
# ADR-006: StateStore with Dotted-Path Subscriptions
22

33
## Status
44
Accepted
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ADR-002: Plugin System with Mode-Based Activation
1+
# ADR-007: Plugin System with Mode-Based Activation
22

33
## Status
44
Accepted

docs/decisions/ADR-003-instance-state-model.md renamed to docs/adr/ADR-008-instance-state-model.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ADR-003: InstanceState as Flat Record for Placed Props
1+
# ADR-008: InstanceState as Flat Record for Placed Props
22

33
## Status
44
Accepted

docs/decisions/ADR-004-procedural-model-pipeline.md renamed to docs/adr/ADR-009-procedural-model-pipeline.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ADR-004: Procedural Model Pipeline via Three.js Generators
1+
# ADR-009: Procedural Model Pipeline via Three.js Generators
22

33
## Status
44
Accepted

docs/decisions/ADR-005-simulation-plugin.md renamed to docs/adr/ADR-010-simulation-plugin.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ADR-005: Simulation as Plugin via EntityManager
1+
# ADR-010: Simulation as Plugin via EntityManager
22

33
## Status
44
Accepted

docs/decisions/ADR-006-shared-selection.md renamed to docs/adr/ADR-011-shared-selection.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# ADR-006: Shared Selection via Kernel.selectedObject
1+
# ADR-011: Shared Selection via Kernel.selectedObject
22

33
## Status
44
Accepted

0 commit comments

Comments
 (0)