Git Komut Rehberi & Terminal Asistanı
Sıfırdan Yeni Bir Depo Başlatın:
Mevcut Bir Git Deposu veya Klasörü Gönderin:
Hataları Geri Alma, İptal & Temizlik:
Son commit'i geri al (yapılan değişiklikleri korur):
git reset --soft HEAD~1
Yapılan yerel değişiklikleri iptal et (çalışma ağacını temizler):
git restore .
Takip edilmeyen gereksiz dosyaları sil:
git clean -fd
Değişiklikleri geçici sakla ve geri getir (stash):
git stash git stash pop
Dal (Branch) ve Sürüm Etiketleri:
Yeni dal aç ve geçiş yap:
git checkout -b yeni-ozellik git push -u origin yeni-ozellik
Sürüm etiketi (tag) oluştur ve gönder:
git tag -a v1.0.0 -m "Sürüm 1.0.0" git push origin --tags
141 lines
7.9 KiB
Markdown
141 lines
7.9 KiB
Markdown
# Scene Bridge — Phase 0 Orientation Notes
|
||||
|
|
|
|||
|
|
Verified against source on 2026-06-26. No code written. Line references are to the
|
|||
|
|
files as read this session.
|
|||
|
|
|
|||
|
|
## Data flow (from CLAUDE.md, restated)
|
|||
|
|
|
|||
|
|
```
|
|||
|
|
MCP (Node) ──POST──▶ local Next route (/api/scene) ──writes──▶ .codex/pending-scenes/<projectId>.json
|
|||
|
|
│
|
|||
|
|
editor page (browser) ──GET /api/scene poll──▶ hydrate into IndexedDB via the app's
|
|||
|
|
existing save path ──▶ editor opens/refreshes the project
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
Node never touches IndexedDB/localStorage — that storage is origin-sandboxed to the page.
|
|||
|
|
The route only stages a file on disk; the browser-side poller is the only thing that writes
|
|||
|
|
the scene store. (Confirmed: the existing `/api/local-download` route is the template — it is
|
|||
|
|
a pure disk-writer behind a same-origin guard.)
|
|||
|
|
|
|||
|
|
## IndexedDB record shape — CONFIRMED
|
|||
|
|
|
|||
|
|
Source: `apps/web/src/app/page.tsx`.
|
|||
|
|
|
|||
|
|
- DB name: `sketchForge.projectShapes` (`PROJECT_SHAPES_DB_NAME`, page.tsx:44), version `1`.
|
|||
|
|
- Object store: `projectShapes` (`PROJECT_SHAPES_STORE_NAME`, page.tsx:45), `keyPath: "id"`
|
|||
|
|
(page.tsx:70).
|
|||
|
|
- Record (`ProjectShapeRecord`, page.tsx:33–41):
|
|||
|
|
```ts
|
|||
|
|
{ id: string; revision: number; shapes: WorkplaneShape[]; updatedAt: number }
|
|||
|
|
```
|
|||
|
|
`id` is the projectId. Matches CLAUDE.md exactly.
|
|||
|
|
|
|||
|
|
## localStorage key — CONFIRMED
|
|||
|
|
|
|||
|
|
- Key: **`sketchForge.projects`** (`PROJECTS_STORAGE_KEY`, page.tsx:43). Note the plural.
|
|||
|
|
- Value: JSON array of project metadata (`StoredDashboardProject[]`), written via
|
|||
|
|
`projectForStorage` (page.tsx:200) at page.tsx:293.
|
|||
|
|
- A project is only listed/openable if it has an entry here. **Confirms CLAUDE.md's rule:**
|
|||
|
|
a project needs BOTH a localStorage metadata entry AND an IndexedDB shapes record.
|
|||
|
|
|
|||
|
|
Other localStorage keys (not the project store, noted to avoid confusion):
|
|||
|
|
`sketchForge.downloadMode`, `sketchForge.downloadFolder` (page.tsx:46–47).
|
|||
|
|
|
|||
|
|
## Read/write helpers to reuse — names confirmed, BUT see "Contradictions" below
|
|||
|
|
|
|||
|
|
IndexedDB (page.tsx):
|
|||
|
|
- `openProjectShapesDb()` — 59
|
|||
|
|
- `loadProjectShapes(projectId)` — 78
|
|||
|
|
- `saveProjectShapes(projectId, shapes, revision)` — 93 (has a revision guard: skips the put
|
|||
|
|
when an existing record's `revision > revision`, page.tsx:104)
|
|||
|
|
- `deleteProjectShapes(projectId)` — 124
|
|||
|
|
|
|||
|
|
localStorage (page.tsx):
|
|||
|
|
- `readStoredProjects()` — 140 (returns `{ projects, legacyShapes }`)
|
|||
|
|
- `readProjects()` — 175
|
|||
|
|
- `mergeProjectForStorage` / `projectForStorage` / `mergeProjectsForStorage` — 179 / 200 / 216
|
|||
|
|
- `newProject(name, index, shapeCount?)` — 222
|
|||
|
|
|
|||
|
|
React-level save path the editor already uses (page.tsx):
|
|||
|
|
- `updateProjectShapes({ projectId, shapes })` — 443. This is the callback passed to the editor
|
|||
|
|
as `onProjectShapesChange` (page.tsx:653). It bumps a monotonic revision
|
|||
|
|
(`Math.max(Date.now(), nextProjectRevisionRef + 1)`, page.tsx:444), updates in-memory state,
|
|||
|
|
AND queues `saveProjectShapes`. **This is the real "existing save path"** the Phase 2 hydrator
|
|||
|
|
should drive, because it keeps localStorage `shapes` count + `revision` consistent with
|
|||
|
|
IndexedDB. Writing IndexedDB directly would desync the dashboard metadata.
|
|||
|
|
|
|||
|
|
Reuse for staging (workplaneShapes.ts):
|
|||
|
|
- `serializeShapesForSync(shapes)` — 117: `canonicalizeShape`s then `JSON.stringify`s. Good
|
|||
|
|
candidate for what the route/hydrator serialize.
|
|||
|
|
- `canonicalizeShape` — 61.
|
|||
|
|
|
|||
|
|
## Editor open-URL — CONFIRMED
|
|||
|
|
|
|||
|
|
- Canonical: `/?editor=1&project=<projectId>` (built at page.tsx:398, `encodeURIComponent`'d).
|
|||
|
|
- Bare `/?editor=1` (no project) also valid.
|
|||
|
|
- Mount-time parse (page.tsx:274–282): editor opens when `editor=1` **or** the test param
|
|||
|
|
`codexBooleanCase` is present. The `project` query param only becomes the active project if
|
|||
|
|
it already exists in stored projects (page.tsx:277) — i.e. **the localStorage entry must
|
|||
|
|
exist first**, otherwise the editor opens with no active project.
|
|||
|
|
|
|||
|
|
## Same-origin guard (Phase 1 template) — CONFIRMED
|
|||
|
|
|
|||
|
|
Source: `apps/web/src/app/api/local-download/route.ts`.
|
|||
|
|
- `isLocalSameOriginRequest(request)` (line 15): hostname must be in
|
|||
|
|
`{localhost, 127.0.0.1, ::1}`; if an `Origin` header is present it must be local same-origin;
|
|||
|
|
`sec-fetch-site` must be absent, `same-origin`, or `none`.
|
|||
|
|
- Implication for the MCP (Node `fetch` to `http://127.0.0.1:3000`): no `Origin` and no
|
|||
|
|
`sec-fetch-site` header are sent by default → **passes**. So the MCP needs no special header.
|
|||
|
|
(To be re-verified empirically in Phase 1, per the plan's acceptance note.)
|
|||
|
|
- Also reusable from this file: `safeFileName` (line 10) regex-strips
|
|||
|
|
`[<>:"/\\|?* |