@@ -38,9 +38,33 @@ persistent SQLite database. Remaining work is described by the planned PRs.
3838- React 19 and Vite
3939- One production container with a mounted data directory
4040
41+ ## Set up a clone
42+
43+ After cloning the repository, run the post-clone setup as your normal user:
44+
45+ ``` sh
46+ ./scripts/setup.sh
47+ ```
48+
49+ The command prepares the development and production data directories, enables
50+ the tracked Git hooks, and reports Docker and local-development readiness
51+ separately. For every available workflow, it also installs or builds the locked
52+ application dependencies and creates or migrates that workflow's SQLite
53+ database.
54+
55+ Setup does not install Docker or Deno, create ` .env ` , or start Stackdraft. It
56+ prints the missing prerequisite and the next command for each workflow that is
57+ ready. The command is idempotent and can be rerun after pulling migrations or
58+ dependency changes. If the Compose service is running, paused, or restarting,
59+ setup leaves it alone and asks you to stop it before migrating the production
60+ database. Do not run setup with ` sudo ` .
61+
4162## Run with Docker
4263
4364Docker is the only host dependency for the production-style workflow.
65+ ` ./scripts/setup.sh ` verifies Docker and Compose, builds the production image,
66+ and initializes or migrates ` ./data/prod/stackdraft.sqlite ` in a one-shot
67+ container without publishing a port.
4468
4569``` sh
4670docker compose up --build
@@ -59,16 +83,16 @@ The database remains in `./data/prod`.
5983
6084## Develop locally
6185
62- Install Deno 2.9.1, then install the locked dependencies :
86+ Install Deno 2.9.1, then run the same post-clone setup command :
6387
6488``` sh
65- deno install --frozen
66- deno task setup:git-hooks
89+ ./scripts/setup.sh
6790```
6891
69- ` setup:git-hooks ` points this clone at ` .githooks/ ` so the ` prepare-commit-msg `
70- hook can strip ` Co-authored-by: Cursor ` lines from agent commits. Run it once
71- after checkout.
92+ When Deno 2.9.1 is available, setup runs ` deno install --frozen ` , applies the
93+ development migrations to ` ./data/dev/stackdraft.sqlite ` , and points this clone
94+ at ` .githooks/ ` . The ` prepare-commit-msg ` hook strips ` Co-authored-by: Cursor `
95+ lines from agent commits.
7296
7397Start the API and Vite development server together:
7498
@@ -97,10 +121,12 @@ installing the extension so it replaces the default TypeScript language server.
97121
98122### Setup
99123
100- | Command | Purpose |
101- | --------------------------- | ---------------------------------------- |
102- | ` deno install --frozen ` | Install locked Deno and npm dependencies |
103- | ` deno task setup:git-hooks ` | Enable tracked Git hooks for this clone |
124+ | Command | Purpose |
125+ | --------------------------- | --------------------------------------------------- |
126+ | ` ./scripts/setup.sh ` | Prepare the clone and report workflow readiness |
127+ | ` deno task setup ` | Run post-clone setup when Deno is already available |
128+ | ` deno install --frozen ` | Install locked Deno and npm dependencies |
129+ | ` deno task setup:git-hooks ` | Enable tracked Git hooks for this clone |
104130
105131### Development
106132
@@ -111,15 +137,17 @@ installing the extension so it replaces the default TypeScript language server.
111137| ` deno task dev:web ` | Run the Vite frontend dev server. Proxies ` /api ` to the Deno API. |
112138| ` deno task start ` | Run the API as a single local process without file watching. Also defaults to the development database. |
113139
114- ### Database (development only)
140+ ### Database
115141
116142| Command | Purpose |
117143| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
118144| ` deno task db:migrate:dev ` | Apply pending SQL migrations to ` ./data/dev/stackdraft.sqlite ` without starting the HTTP server. |
119145| ` deno task db:reset:dev ` | Delete development SQLite files under ` ./data/dev ` and recreate a fresh database. Refuses ` ./data/prod ` and any path outside ` ./data/dev ` . |
120146
121- There are no production-style migration or reset tasks yet. Docker Compose still
122- applies migrations automatically when the container starts.
147+ The direct database tasks target development only. For production-style data,
148+ ` ./scripts/setup.sh ` applies migrations through a one-shot container without
149+ starting the application. There is deliberately no production reset command.
150+ Docker Compose also applies pending migrations when the application starts.
123151
124152### Quality and build
125153
@@ -178,6 +206,10 @@ Runtime SQLite data lives in two host directories:
178206- ` ./data/dev ` for local Deno development
179207- ` ./data/prod ` for Docker Compose
180208
209+ ` ./scripts/setup.sh ` creates or migrates the database for each workflow whose
210+ runtime is available. Application startup also keeps migrations idempotently
211+ current.
212+
181213For a safe v0.1 backup of the production-style database:
182214
183215``` sh
@@ -186,14 +218,17 @@ cp data/prod/stackdraft.sqlite stackdraft-backup.sqlite
186218docker compose start
187219```
188220
189- To restore or transfer Stackdraft :
221+ To restore a stopped backup into a clean checkout or deployment :
190222
191- 1 . Stop Stackdraft.
192- 2 . Copy the repository and the relevant ` data/prod ` directory to the destination
193- machine.
194- 3 . Install Docker.
223+ 1 . Stop Stackdraft if the destination is already running.
224+ 2 . Create ` data/prod ` in the destination checkout if it does not exist.
225+ 3 . Copy the backup to ` data/prod/stackdraft.sqlite ` .
1952264 . Run ` docker compose up -d --build ` .
196227
228+ To transfer the complete deployment, copy the repository and its stopped
229+ ` data/prod ` directory to the destination machine, install Docker, and run the
230+ same Compose command.
231+
197232Do not copy the SQLite file while Stackdraft is running. An online backup
198233command can be added later.
199234
@@ -231,19 +266,19 @@ core behavior and typed failures. SQLite owns persistent state.
231266
232267## Current scope
233268
234- The skeleton intentionally implements only:
269+ Stackdraft v0.1 implements the Draft, Stack, and State workflows described in
270+ [ ` docs/v0.1-spec.md ` ] ( docs/v0.1-spec.md ) :
235271
236- - Application shell
237- - ` GET /api/health `
238- - State catalog, create, update, move, and default-selection APIs
239- - Effect health and state services
240- - SQLite connection and migration runner
241- - Development and production build paths
242- - Docker persistence
243- - Merge-blocking assembled API QA harness
272+ - Global standalone and stacked Draft capture, editing, assignment, and State
273+ filtering
274+ - Stack creation, editing, State filtering, and Stack-specific Draft capture
275+ - Stack and Draft State creation, editing, ordering, default selection, and
276+ guarded deletion
277+ - Persistent SQLite storage, migrations, health reporting, Docker deployment,
278+ and stopped-database backup and restoration
244279
245- It does not yet implement Stacks, Drafts, State deletion, or authentication. See
246- [ ` docs/v0.1-spec.md ` ] ( docs/v0.1-spec.md ) for the product scope .
280+ Stack and Draft deletion, authentication, and the specification's explicit
281+ non-goals remain outside v0.1 .
247282
248283## License
249284
0 commit comments