server: CommunityStore — atomic communities/<slug> write (phase-2 plan Task 2) #29

Closed
opened 2026-08-28 21:00:22 +00:00 by ben · 1 comment
Owner

Plan

docs/superpowers/plans/2026-08-28-coa-phase-2.md Task 2.

Deliverable

server/src/community-store.ts: CommunityStore { exists, write, read, readHtml, patchStatus }, diskStore(root), SlugTakenError, logoFileName(type), types CommunityFiles, Community. write stages into <root>/.tmp-<slug>-<rand>/ and renames into place; an existing target → SlugTakenError and the temp dir is removed. AppDeps.store added; defaultDeps() reads COA_COMMUNITIES_DIR (default communities). .gitignore communities/.tmp-*; .env.example entry. Tests server/test/community-store.test.ts (plan's five).

Acceptance

  • Writes exactly brand.json onboarding.json features.json backend.json status.json logo.(svg|png) index.html; read round-trips through SubmissionSchema/StatusSchema.
  • Taken slug rejects with SlugTakenError, no .tmp-* left behind.
  • patchStatus bumps updatedAt; patching a key to undefined removes it.
  • Existing tests keep passing (defaultDeps() still compiles); no test writes into the repo's real communities/.

depends_on

  • schema: StatusSchema + FIXTURE_SUBMISSION (Task 1)

out_of_scope

Git, rendering, email, wiring into /api/submit.

Phase gate

No build dispatch, no coa-shared provisioning, no status transitions beyond page-ready (phase 3). Never delete or rewrite anything under communities/ (ADR 0002/0003).

## Plan `docs/superpowers/plans/2026-08-28-coa-phase-2.md` **Task 2**. ## Deliverable `server/src/community-store.ts`: `CommunityStore { exists, write, read, readHtml, patchStatus }`, `diskStore(root)`, `SlugTakenError`, `logoFileName(type)`, types `CommunityFiles`, `Community`. `write` stages into `<root>/.tmp-<slug>-<rand>/` and `rename`s into place; an existing target → `SlugTakenError` and the temp dir is removed. `AppDeps.store` added; `defaultDeps()` reads `COA_COMMUNITIES_DIR` (default `communities`). `.gitignore` `communities/.tmp-*`; `.env.example` entry. Tests `server/test/community-store.test.ts` (plan's five). ## Acceptance - Writes exactly `brand.json onboarding.json features.json backend.json status.json logo.(svg|png) index.html`; `read` round-trips through `SubmissionSchema`/`StatusSchema`. - Taken slug rejects with `SlugTakenError`, no `.tmp-*` left behind. - `patchStatus` bumps `updatedAt`; patching a key to `undefined` removes it. - Existing tests keep passing (`defaultDeps()` still compiles); no test writes into the repo's real `communities/`. ## depends_on - schema: StatusSchema + FIXTURE_SUBMISSION (Task 1) ## out_of_scope Git, rendering, email, wiring into `/api/submit`. ## Phase gate No build dispatch, no `coa-shared` provisioning, no status transitions beyond `page-ready` (phase 3). Never delete or rewrite anything under `communities/` (ADR 0002/0003).
Author
Owner

Claimed by the interactive session (Ben's laptop) — factory starved: workstation at claude usage limit, elitebook-03 busy on Matou/idss. Working plan Task 2 on branch agent/issue-29; PR to follow.

Claimed by the interactive session (Ben's laptop) — factory starved: workstation at claude usage limit, elitebook-03 busy on Matou/idss. Working plan Task 2 on branch agent/issue-29; PR to follow.
ben closed this issue 2026-08-30 00:23:55 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Matou/coa#29
No description provided.