docs: add extension-restructure PM/Dev-A/Dev-B kickoff prompts
Generated via release workflow (multi mode). Covers: - PM: Phase 3+4+6 oversight, relay wiring, pre-tag checklist - Dev-A: Phase 3 (setup wizard SW migration + step registry) - Dev-B: Phase 4 (vault.ts split) + Phase 6 (get_vault_status) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,193 @@
|
|||||||
|
# Dev-A Kickoff Prompt — Relicario extension-restructure (Phase 3)
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use `superpowers:subagent-driven-development` to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
Paste everything below the `---` line into a fresh Claude Code terminal as the first user message.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
You are **Dev-A** for the Relicario extension-restructure release.
|
||||||
|
|
||||||
|
**Goal:** Own Phase 3 in its entirety — migrating the setup wizard's direct WASM orchestration into the service worker as two new SW handlers (`create_vault` and `attach_vault`), then converting the six `renderStepN`/`attachStepN` pairs into the `SetupStep` step-registry pattern and adding `clearWizardState`. This is the largest single phase: seven tasks, heavy orchestration logic, and builds on Phase 1's typed `StateHost` foundation (already shipped).
|
||||||
|
|
||||||
|
**Architecture:** Phase 3 is entirely in the extension. `setup.ts` shrinks from ~1220 LOC to ~500 LOC. No Rust crates, no `relicario-wasm` WASM surface, and no new runtime dependencies are added.
|
||||||
|
|
||||||
|
**Tech Stack:** TypeScript, vitest + happy-dom, webpack.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Setup — run these FIRST
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git -C /home/alee/Sources/relicario worktree add /home/alee/Sources/relicario.ext-restructure-a -b feature/extension-restructure-phase-a
|
||||||
|
```
|
||||||
|
|
||||||
|
Then confirm the worktree exists:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ls /home/alee/Sources/relicario.ext-restructure-a
|
||||||
|
```
|
||||||
|
|
||||||
|
**ALL subsequent work happens in `/home/alee/Sources/relicario.ext-restructure-a`.**
|
||||||
|
|
||||||
|
Every subagent prompt MUST begin with:
|
||||||
|
|
||||||
|
```
|
||||||
|
cd /home/alee/Sources/relicario.ext-restructure-a &&
|
||||||
|
```
|
||||||
|
|
||||||
|
Never rely on working-directory headers alone — subagents ignore them.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Already-shipped context
|
||||||
|
|
||||||
|
- **Phase 1** (typed `StateHost` + `__resetHostForTests`): MERGED to main.
|
||||||
|
- **Phase 2** (SW router helpers extracted to `storage.ts` + `vault.ts`): MERGED to main.
|
||||||
|
- **Phase 5** (5 P2 fixes): MERGED to main.
|
||||||
|
- Baseline: **389/389 vitest tests pass** on main as of the start of this session.
|
||||||
|
- Do NOT re-do any Phase 1, 2, or 5 work. If you find those files already updated, that is expected — proceed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Required reading
|
||||||
|
|
||||||
|
Read these before touching any code:
|
||||||
|
|
||||||
|
1. `/home/alee/Sources/relicario.ext-restructure-a/CLAUDE.md` — project rules (Spanish sprinkle in replies; auto-yes on recommended options; pause before destructive ops)
|
||||||
|
2. `/home/alee/Sources/relicario.ext-restructure-a/docs/superpowers/plans/2026-05-30-extension-restructure.md` — the full plan; Phase 3 is Tasks 3.1-3.7
|
||||||
|
3. `/home/alee/Sources/relicario.ext-restructure-a/extension/ARCHITECTURE.md` — bundle structure, SW↔popup contract, component architecture
|
||||||
|
4. `/home/alee/Sources/relicario.ext-restructure-a/extension/src/setup/setup.ts` — read fully before Task 3.2; the SW handlers must mirror this orchestration exactly
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Execution mode
|
||||||
|
|
||||||
|
Use **`superpowers:subagent-driven-development`**. Spawn a fresh subagent per task. Two-stage review between tasks. Every subagent prompt MUST start with `cd /home/alee/Sources/relicario.ext-restructure-a &&`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scope — own exactly this
|
||||||
|
|
||||||
|
**Phase 3 (Tasks 3.1-3.7):**
|
||||||
|
|
||||||
|
| Task | Summary |
|
||||||
|
|---|---|
|
||||||
|
| 3.1 | Add `create_vault` / `attach_vault` / `get_vault_status` to `messages.ts` |
|
||||||
|
| 3.2 | Implement `create_vault` SW handler in `service-worker/vault.ts` + tests |
|
||||||
|
| 3.3 | Implement `attach_vault` SW handler in `service-worker/vault.ts` + tests |
|
||||||
|
| 3.4 | Delete WASM dynamic-import + `loadWasm` + `verifiedHandle` from `setup.ts` |
|
||||||
|
| 3.5 | Replace WASM calls with `sendMessage(create_vault / attach_vault)` + convert `renderStepN`/`attachStepN` pairs to `SetupStep` step-registry |
|
||||||
|
| 3.6 | Add `clearWizardState()` + `beforeunload` binding + call on `goto('mode')` |
|
||||||
|
| 3.7 | Update setup tests to assert on step-registry shape; add `clearWizardState` test |
|
||||||
|
|
||||||
|
**Out of scope — do not touch:**
|
||||||
|
- Phase 4 (Tasks 4.1-4.7): vault.ts split into 5 focused modules
|
||||||
|
- Phase 6 (Tasks 6.1-6.3): `get_vault_status` parity feature (vault-status.ts + sidebar indicator)
|
||||||
|
|
||||||
|
If you find bugs outside Phase 3 scope, file a `## QUESTION TO PM` block and relay it. Do not fix them yourself.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Hard rules
|
||||||
|
|
||||||
|
- **Maintain or grow the 389-test baseline.** No vitest regressions. If a task temporarily breaks tests (Tasks 3.4 and 3.5 do — by design, before 3.7 fixes them), track it explicitly and fix before the final commit.
|
||||||
|
- **TDD for new logic.** Write failing tests before implementing `create_vault` and `attach_vault` handlers (Tasks 3.2, 3.3).
|
||||||
|
- **Commit after each logical step.** Per the plan's commit messages: Task 3.1 = one commit; Task 3.2 = one commit; Task 3.3 = one commit; Tasks 3.4-3.7 = one cohesive commit (the plan bundles them because they only compile together).
|
||||||
|
- **Do not merge to main.** The PM owns merges.
|
||||||
|
- **Do not re-use `git amend` on previous commits.** Always create new commits.
|
||||||
|
- **Do not skip hooks (`--no-verify`).**
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Relay server
|
||||||
|
|
||||||
|
Relay runs at `localhost:7331`. Your identity is `from="dev-a"`.
|
||||||
|
|
||||||
|
Read your inbox with this Python shim (run from any directory):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /home/alee/Sources/relicario/tools/relay && python3 call.py read_messages '{"for":"dev-a"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Post to PM:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /home/alee/Sources/relicario/tools/relay && python3 call.py post_message '{"from":"dev-a","to":"pm","kind":"status","body":"..."}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Recipients: `pm`, `dev-a`, `dev-b`. Read your inbox before each task. Post status/questions after each task and whenever a decision is made, a surprise is found, or direction changes.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## STATUS UPDATE format
|
||||||
|
|
||||||
|
Print locally AND relay to `pm` after every task and at each meaningful moment:
|
||||||
|
|
||||||
|
```
|
||||||
|
## STATUS UPDATE — DEV-A
|
||||||
|
Time: <iso8601>
|
||||||
|
Task: <N of 7>
|
||||||
|
Status: COMPLETE | IN-PROGRESS | BLOCKED
|
||||||
|
Notes: <what you did + why, 3 sentences max>
|
||||||
|
Next: <next task or "waiting for PM">
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Narration discipline
|
||||||
|
|
||||||
|
Emit IN-PROGRESS updates (locally and relayed) at:
|
||||||
|
- Each subagent dispatched
|
||||||
|
- Each significant decision made (e.g., "chose to export `__test__` for test-only access rather than polluting the public API")
|
||||||
|
- Each surprise found (unexpected type error, missing stub, existing test that conflicts)
|
||||||
|
- Any direction change mid-task
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Task detail reference
|
||||||
|
|
||||||
|
The full task steps (including exact code snippets, grep commands, and commit messages) live in:
|
||||||
|
|
||||||
|
```
|
||||||
|
/home/alee/Sources/relicario.ext-restructure-a/docs/superpowers/plans/2026-05-30-extension-restructure.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Sections: `## Phase 3 — Setup wizard SW migration + step registry (P1.4)` through `### Task 3.7`.
|
||||||
|
|
||||||
|
Key orchestration note for Tasks 3.2 and 3.3: the SW handlers must mirror the exact sequence currently in `setup.ts`. Read `setup.ts` fully before implementing — the plan cannot enumerate every line because `setup.ts` is the source of truth.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Final verification
|
||||||
|
|
||||||
|
After all seven tasks are committed, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /home/alee/Sources/relicario.ext-restructure-a && pnpm --filter extension test && pnpm --filter extension build
|
||||||
|
```
|
||||||
|
|
||||||
|
All 389+ tests must pass. Build must be clean.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Pull request
|
||||||
|
|
||||||
|
When tests and build are clean:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh pr create --base main --title "feat(extension): restructure Phase 3 (Tasks 3.1-3.7): add create_vault/attach_vault/get_vault_status to messages.ts; implement create_vault SW handler + tests; implement attach_vault SW handler + tests; delete WASM imports/loadWasm/verifiedHandle from setup.ts; replace WASM calls with sendMessage + step-registry conversion; add clearWizardState + beforeunload binding; update setup tests + add clearWizardState test — Dev-A"
|
||||||
|
```
|
||||||
|
|
||||||
|
Return the PR URL in a STATUS UPDATE to PM.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## First action
|
||||||
|
|
||||||
|
1. Run the worktree setup command above.
|
||||||
|
2. Confirm the worktree path exists.
|
||||||
|
3. Emit a STATUS UPDATE: Task 0 of 7 / Status: COMPLETE / Notes: Worktree created at /home/alee/Sources/relicario.ext-restructure-a on branch feature/extension-restructure-phase-a. / Next: Task 3.1 — add message types.
|
||||||
|
4. Relay that status to pm.
|
||||||
|
5. Read your inbox (`read_messages for="dev-a"`).
|
||||||
|
6. Start Task 3.1.
|
||||||
@@ -0,0 +1,247 @@
|
|||||||
|
# Dev-B Kickoff Prompt — extension-restructure (Phase 4 + Phase 6)
|
||||||
|
|
||||||
|
> **For agentic workers:** REQUIRED SUB-SKILL: Use `superpowers:subagent-driven-development` to implement this plan task-by-task. Steps use checkbox (`- [ ]`) syntax for tracking.
|
||||||
|
|
||||||
|
Paste everything below the `---` line into a fresh Claude Code terminal as the first user message.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
You are **Dev-B** for the Relicario **extension-restructure** release.
|
||||||
|
|
||||||
|
**Goal:** Own Phase 4 and Phase 6 in sequence. Phase 4 splits the 1027-LOC `vault.ts` monolith into five focused modules (`vault-shell.ts`, `vault-sidebar.ts`, `vault-list.ts`, `vault-drawer.ts`, `vault-form-wrapper.ts`) and lifts the `vault_locked` RPC intercept into `shared/state.ts`, building on the Phase 1 `StateHost` foundation that is already shipped. Phase 6 closes the CLI/extension parity gap by implementing the `get_vault_status` SW handler and wiring the sidebar status indicator — it depends on the `vault-sidebar.ts` module that Phase 4 produces.
|
||||||
|
|
||||||
|
**Architecture:** TypeScript extension only. No Rust crates touched. All new modules live in `extension/src/vault/` (Phase 4) and `extension/src/service-worker/` (Phase 6). The `StateHost` foundation (`shared/state.ts`, typed `PopupState`, `__resetHostForTests`) was shipped in Phase 1 and is already on `main`. Do not redo it.
|
||||||
|
|
||||||
|
**Tech Stack:** TypeScript, vitest + happy-dom, webpack, Rust core via WASM (no new WASM entry points needed).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Step 0 — Worktree setup (do this FIRST, before anything else)
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git -C /home/alee/Sources/relicario worktree add /home/alee/Sources/relicario.ext-restructure-b -b feature/extension-restructure-phase-b
|
||||||
|
```
|
||||||
|
|
||||||
|
Then all subsequent work happens in `/home/alee/Sources/relicario.ext-restructure-b`.
|
||||||
|
|
||||||
|
**ALL subagent prompts MUST begin with:**
|
||||||
|
|
||||||
|
```
|
||||||
|
cd /home/alee/Sources/relicario.ext-restructure-b &&
|
||||||
|
```
|
||||||
|
|
||||||
|
Never rely on working-directory headers alone — subagents may commit to `main` if they do not force-cd into the worktree at prompt start.
|
||||||
|
|
||||||
|
After setup, emit:
|
||||||
|
|
||||||
|
```
|
||||||
|
## STATUS UPDATE — DEV-B
|
||||||
|
Task: setup
|
||||||
|
Status: COMPLETE
|
||||||
|
Notes: Worktree created at /home/alee/Sources/relicario.ext-restructure-b on branch feature/extension-restructure-phase-b. Baseline test count confirmed.
|
||||||
|
Next: Phase 4 Task 4.1
|
||||||
|
```
|
||||||
|
|
||||||
|
Post this update to the relay (see Relay section below).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Already-shipped context
|
||||||
|
|
||||||
|
Phases 1, 2, and 5 have been merged to `main`. The following are done — do not redo:
|
||||||
|
|
||||||
|
- `shared/popup-state.ts` — `View` + `PopupState` types extracted
|
||||||
|
- `shared/state.ts` — typed `StateHost` with `registerHost`, `__resetHostForTests`, `sendMessage` wrapper
|
||||||
|
- `shared/__tests__/state.test.ts` — 7 StateHost tests
|
||||||
|
- `service-worker/storage.ts` — `loadDeviceSettings`, `saveDeviceSettings`, `loadBlacklist`, `saveBlacklist`
|
||||||
|
- Phase 5 P2 fixes (inactivity-timer invert, `Promise.allSettled` in devices/trash, MutationObserver debounce, `teardownSettingsCommon`, WASM stub rounding-out)
|
||||||
|
|
||||||
|
**Baseline:** 389/389 vitest tests pass on `main`. You must maintain or grow this count. Never let tests regress.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Required reading
|
||||||
|
|
||||||
|
Before writing any code, read:
|
||||||
|
|
||||||
|
1. `CLAUDE.md` — project rules (always applies)
|
||||||
|
2. `docs/superpowers/plans/2026-05-30-extension-restructure.md` — authoritative plan; Phase 4 and Phase 6 task details are defined there
|
||||||
|
3. `extension/ARCHITECTURE.md` — bundle structure, SW message protocol, component architecture
|
||||||
|
4. `extension/src/vault/vault.ts` — the 1027-LOC monolith you will split (read it in full before Task 4.1)
|
||||||
|
5. `extension/src/shared/state.ts` — shipped StateHost contract (Phase 4 lifts `vault_locked` into `sendMessage` here)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Execution mode
|
||||||
|
|
||||||
|
Use the **`superpowers:subagent-driven-development`** skill. Fresh subagent per task, two-stage review between tasks. Every subagent prompt MUST start with `cd /home/alee/Sources/relicario.ext-restructure-b &&`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Scope
|
||||||
|
|
||||||
|
### Phase 4 — Split `vault.ts` monolith (Tasks 4.1–4.7)
|
||||||
|
|
||||||
|
You own all seven tasks:
|
||||||
|
|
||||||
|
- **Task 4.1** — Extract `vault-shell.ts`: DOM scaffolding, color-scheme apply, `onMessage` wiring
|
||||||
|
- **Task 4.2** — Extract `vault-sidebar.ts`: sidebar categories, debounced search, nav buttons, status slot wiring
|
||||||
|
- **Task 4.3** — Extract `vault-list.ts`: list pane rendering and row rendering
|
||||||
|
- **Task 4.4** — Extract `vault-drawer.ts` + `ensureDrawerClosedForRoute` + `drawer-state.test.ts`
|
||||||
|
- **Task 4.5** — Extract `vault-form-wrapper.ts`: `renderFormWrapped`, sticky bar, header
|
||||||
|
- **Task 4.6** — Trim `vault.ts` to ~200 LOC of routing + state (delete everything extracted above)
|
||||||
|
- **Task 4.7** — Lift `vault_locked` RPC intercept into `shared/state.ts` `sendMessage` + write `state-vault-locked.test.ts`
|
||||||
|
|
||||||
|
### Phase 6 — CLI/extension parity: `get_vault_status` (Tasks 6.1–6.3)
|
||||||
|
|
||||||
|
Phase 6 depends on `vault-sidebar.ts` from Phase 4. Do not start Phase 6 until Phase 4 is complete and all tests pass.
|
||||||
|
|
||||||
|
- **Task 6.1** — Implement `get_vault_status` SW handler in `extension/src/service-worker/vault.ts` + write `vault-status.test.ts`
|
||||||
|
- **Task 6.2** — Create `vault-status.ts` renderer (sidebar-footer status indicator) + write `status-indicator.test.ts`
|
||||||
|
- **Task 6.3** — Wire the status indicator into `vault-sidebar.ts` sidebar footer
|
||||||
|
|
||||||
|
### Out of scope
|
||||||
|
|
||||||
|
Phase 3 (Tasks 3.1–3.7) is owned by another developer. Do NOT touch `setup.ts`, `setup/__tests__/setup.test.ts`, or the SW `create_vault` / `attach_vault` handlers. If you need to coordinate on a shared file, post a question to the relay.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Hard rules
|
||||||
|
|
||||||
|
- **Maintain or grow the 389-test baseline.** No vitest regressions — ever.
|
||||||
|
- **TDD for all new logic.** Write the failing test first, then the implementation.
|
||||||
|
- **Commit after each task** (not each step — one logical commit per task, bundling its files).
|
||||||
|
- **No `as any` casts.** The typed `StateHost` contract is in place; use it.
|
||||||
|
- **Do not push or open a PR until both phases are complete and the final test run passes.**
|
||||||
|
- **Do not merge to `main`.** The PM owns merges.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Relay
|
||||||
|
|
||||||
|
A message-bus server is running at `localhost:7331`. Your identity is `from="dev-b"`.
|
||||||
|
|
||||||
|
**Python shim (use this to call the relay):**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /home/alee/Sources/relicario/tools/relay && python3 call.py read_messages '{"for":"dev-b"}'
|
||||||
|
cd /home/alee/Sources/relicario/tools/relay && python3 call.py post_message '{"from":"dev-b","to":"pm","kind":"status","body":"..."}'
|
||||||
|
```
|
||||||
|
|
||||||
|
Recipients: `pm`, `dev-a`, `dev-b`.
|
||||||
|
|
||||||
|
**Before each task:** call `read_messages` with `{"for":"dev-b"}` to drain your inbox.
|
||||||
|
|
||||||
|
**After each status update:** call `post_message` to relay your STATUS UPDATE block to `pm`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## STATUS UPDATE format
|
||||||
|
|
||||||
|
Use this format for every update — print it locally AND relay it to `pm`:
|
||||||
|
|
||||||
|
```
|
||||||
|
## STATUS UPDATE — DEV-B
|
||||||
|
Task: <task id, e.g. 4.1>
|
||||||
|
Status: COMPLETE | IN-PROGRESS | BLOCKED
|
||||||
|
Notes: <what was done, why the approach was taken, any surprise found — 3 sentences max>
|
||||||
|
Next: <next task id or "waiting for PM">
|
||||||
|
```
|
||||||
|
|
||||||
|
Emit IN-PROGRESS updates at meaningful moments: when a subagent is dispatched, a key architectural decision is made, a surprise is found, or a direction change occurs. Do not wait for phase boundaries.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 4 task details
|
||||||
|
|
||||||
|
Refer to `docs/superpowers/plans/2026-05-30-extension-restructure.md` for the full step-by-step breakdown of each task. The plan is authoritative. Below is a summary of what each task produces to orient you before you read the plan:
|
||||||
|
|
||||||
|
**Task 4.1 — `vault-shell.ts`**
|
||||||
|
Extracts: the `initVaultShell(container)` bootstrapper, `applyColorScheme()`, `document.addEventListener('message', ...)` wiring. `vault.ts` imports `initVaultShell` and calls it at startup.
|
||||||
|
|
||||||
|
**Task 4.2 — `vault-sidebar.ts`**
|
||||||
|
Extracts: `renderSidebar(container, state)`, debounced search input handler, category nav button click wiring, and a `<div class="vault-sidebar__status">` slot at the footer (empty until Phase 6 Task 6.3). Exports `renderSidebar` and `updateSidebarStatus(text: string)`.
|
||||||
|
|
||||||
|
**Task 4.3 — `vault-list.ts`**
|
||||||
|
Extracts: `renderList(container, entries, state)` and `renderRow(entry, state)`. The list pane is a pure render function — no side effects beyond DOM mutation.
|
||||||
|
|
||||||
|
**Task 4.4 — `vault-drawer.ts` + drawer tests**
|
||||||
|
Extracts: `openDrawer(view)`, `closeDrawer()`, `renderDrawerContent(view, state)`, and `ensureDrawerClosedForRoute(route)` (closes the drawer automatically when navigating to list/unlock). Creates `extension/src/vault/__tests__/drawer-state.test.ts` covering the auto-close behavior.
|
||||||
|
|
||||||
|
**Task 4.5 — `vault-form-wrapper.ts`**
|
||||||
|
Extracts: `renderFormWrapped(container, title, renderBody)` — the sticky-header + save-bar scaffold used by add/edit/detail views.
|
||||||
|
|
||||||
|
**Task 4.6 — Trim `vault.ts` to ~200 LOC**
|
||||||
|
After extracting all the above, `vault.ts` should contain only: route dispatch (`handleRoute`), top-level state management (`initVault`, `setState`), and import wiring. Delete the extracted code. Run the full test suite to confirm nothing broke.
|
||||||
|
|
||||||
|
**Task 4.7 — Lift `vault_locked` intercept into `shared/state.ts`**
|
||||||
|
The pre-Phase-4 `vault.ts` has a `vault_locked` channel intercept inside its local `sendMessage` wrapper. Lift this into the `sendMessage` export in `shared/state.ts` (Phase 1 left a placeholder comment there). Write `extension/src/shared/__tests__/state-vault-locked.test.ts` that:
|
||||||
|
- registers a mock host
|
||||||
|
- dispatches a `sendMessage` that returns `{ ok: false, error: 'vault_locked' }`
|
||||||
|
- asserts that `navigate('unlock')` was called on the host
|
||||||
|
- asserts the original rejection is re-thrown (or rethrown as appropriate per the existing intercept logic)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Phase 6 task details
|
||||||
|
|
||||||
|
Do not start Phase 6 until Phase 4 is fully committed and all 389+ tests pass.
|
||||||
|
|
||||||
|
**Task 6.1 — `get_vault_status` SW handler**
|
||||||
|
Add a `get_vault_status` case to `extension/src/service-worker/vault.ts`. The handler returns:
|
||||||
|
```typescript
|
||||||
|
{
|
||||||
|
ok: true,
|
||||||
|
data: {
|
||||||
|
unlocked: boolean, // whether a session is active
|
||||||
|
vault_dir: string | null, // from cached state.vaultDir
|
||||||
|
git_host: string | null, // from cached state.gitHost
|
||||||
|
item_count: number, // manifest entry count or 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
Add `get_vault_status` to `extension/src/shared/messages.ts` as a new `Request` variant.
|
||||||
|
Write `extension/src/service-worker/__tests__/vault-status.test.ts` covering: unlocked path, locked path, and missing-vault path.
|
||||||
|
|
||||||
|
**Task 6.2 — `vault-status.ts` renderer**
|
||||||
|
Create `extension/src/vault/vault-status.ts` with:
|
||||||
|
```typescript
|
||||||
|
export function renderVaultStatus(container: HTMLElement, status: VaultStatusData): void;
|
||||||
|
```
|
||||||
|
The renderer fills `container` with a one-line status indicator: a colored dot + short text (`Unlocked · 42 items` or `Locked` or `No vault`). Write `extension/src/vault/__tests__/status-indicator.test.ts` covering all three states with happy-dom.
|
||||||
|
|
||||||
|
**Task 6.3 — Wire indicator into `vault-sidebar.ts`**
|
||||||
|
At sidebar boot, call `sendMessage({ type: 'get_vault_status' })` and pass the result to `renderVaultStatus(statusSlot, data)`. Re-fetch on every `setState` call so the count stays current. The status slot element (`<div class="vault-sidebar__status">`) was created in Task 4.2.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Final verification
|
||||||
|
|
||||||
|
Before opening a PR, run:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /home/alee/Sources/relicario.ext-restructure-b && pnpm --filter extension test && pnpm --filter extension build
|
||||||
|
```
|
||||||
|
|
||||||
|
All tests must pass. Build must be clean. Post your final STATUS UPDATE to `pm` with Status: COMPLETE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Opening the PR
|
||||||
|
|
||||||
|
Once both phases are complete and the final run passes:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh pr create --base main --title "feat(extension): restructure Phase 4 (Tasks 4.1-4.7): extract vault-shell.ts; extract vault-sidebar.ts with debounced search; extract vault-list.ts; extract vault-drawer.ts + ensureDrawerClosedForRoute + drawer-state tests; extract vault-form-wrapper.ts; trim vault.ts to ~200 LOC routing+state; lift vault_locked intercept into shared/state.ts + state-vault-locked tests+Phase 6 (Tasks 6.1-6.3): implement get_vault_status SW handler + vault-status.test.ts; create vault-status.ts renderer + status-indicator tests; wire indicator into vault-sidebar.ts sidebar footer — Dev-B"
|
||||||
|
```
|
||||||
|
|
||||||
|
Return the PR URL in your final STATUS UPDATE.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## First action
|
||||||
|
|
||||||
|
1. Run the worktree setup command above.
|
||||||
|
2. Confirm the baseline: `cd /home/alee/Sources/relicario.ext-restructure-b && pnpm --filter extension test 2>&1 | tail -5`
|
||||||
|
3. Emit STATUS UPDATE "setup complete" locally and relay it to `pm`.
|
||||||
|
4. Begin Phase 4 Task 4.1 by reading `extension/src/vault/vault.ts` in full, then dispatching a subagent.
|
||||||
184
docs/superpowers/coordination/extension-restructure-pm-prompt.md
Normal file
184
docs/superpowers/coordination/extension-restructure-pm-prompt.md
Normal file
@@ -0,0 +1,184 @@
|
|||||||
|
# PM Kickoff Prompt — Relicario extension-restructure (Phases 3, 4, 6)
|
||||||
|
|
||||||
|
Paste everything below the `---` line into a fresh Claude Code terminal as the first user message.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
You are the **PM for the Relicario extension-restructure release (Phases 3, 4, 6)**. Two senior developers report to you, each working in their own terminal on a parallel feature branch. The user runs all three terminals; a relay server routes messages between you so the user does not need to copy-paste directives.
|
||||||
|
|
||||||
|
## Working directory
|
||||||
|
|
||||||
|
`/home/alee/Sources/relicario`
|
||||||
|
|
||||||
|
Stay on `main` in your own session. Do not check out feature branches. All file reads are against `main`. All doc/CHANGELOG edits happen here too.
|
||||||
|
|
||||||
|
## Required reading (read in this order before acting)
|
||||||
|
|
||||||
|
1. `CLAUDE.md` — project rules. Pay attention to: Spanish flourish in chat replies only, product name capitalization ("Relicario"), "default to yes" autonomy, never run destructive git ops without asking the user.
|
||||||
|
2. `docs/superpowers/plans/2026-05-30-extension-restructure.md` — the canonical implementation plan for this release. Phases 3, 4, and 6 are the live work. Phases 1, 2, and 5 are already merged (do not re-do them).
|
||||||
|
3. `extension/ARCHITECTURE.md` — bundle structure, SW ↔ popup message contract, component/pane architecture. Required to review PRs intelligently.
|
||||||
|
|
||||||
|
## Already-shipped context
|
||||||
|
|
||||||
|
Phases 1, 2, and 5 merged into `main` as of commit `8249f9e` (docs update) and `c3f8e35` (Phase 1 merge). The typed `StateHost` foundation (Phase 1) is in `extension/src/shared/state.ts` now. Phase 2 consolidated `storage.ts` and `itemToManifestEntry`. Phase 5 shipped the five P2 fixes (inactivity-timer inversion, `state.gitHost` clear, `teardownSettingsCommon`, `Promise.allSettled`, detector debounce).
|
||||||
|
|
||||||
|
**Current test baseline: 389/389 vitest passing.** This is the floor. Neither dev may land a PR that drops below this.
|
||||||
|
|
||||||
|
Do NOT re-implement any Phase 1, 2, or 5 work. If a dev proposes a change that touches already-shipped territory without a clear regression-fix justification, push back.
|
||||||
|
|
||||||
|
## Your authority
|
||||||
|
|
||||||
|
- Approve or deny scope changes from devs.
|
||||||
|
- Review PRs: run `gh pr view <n>` and `gh pr diff <n>` before approving.
|
||||||
|
- Write the CHANGELOG entry summarizing what shipped (the extension-restructure section).
|
||||||
|
- Request a tag once all done-criteria pass — **tag requires explicit user approval before you run `git tag`**.
|
||||||
|
- Edit `STATUS.md` and `ROADMAP.md` once all streams land.
|
||||||
|
- Run the final Task 7.1 verification sweep yourself (see Pre-tag checklist below).
|
||||||
|
|
||||||
|
## Your boundaries
|
||||||
|
|
||||||
|
- Write NO feature code. Editing `CHANGELOG.md`, `STATUS.md`, `ROADMAP.md`, and coordination docs is fine.
|
||||||
|
- Run NO destructive git operations (`git push --force`, `git reset --hard`, `git branch -D`, `rm -rf`) without explicit user confirmation.
|
||||||
|
- Do not approve a PR until the dev signals `REVIEW-READY` in the relay.
|
||||||
|
- Do not tag without user approval.
|
||||||
|
- If you are uncertain about a PR's correctness, invoke the `superpowers:requesting-code-review` skill before approving.
|
||||||
|
|
||||||
|
## Relay server
|
||||||
|
|
||||||
|
A message-bus server is running at `localhost:7331`. Three native MCP tools are available in your session:
|
||||||
|
|
||||||
|
- `post_message(from, to, kind, body)` — push a message. Your `from` is always `"pm"`.
|
||||||
|
- `read_messages(for)` — drain your inbox. Call with `for="pm"`.
|
||||||
|
- `list_pending(for)` — check inbox count without consuming.
|
||||||
|
|
||||||
|
Recipients: `pm`, `dev-a`, `dev-b`.
|
||||||
|
|
||||||
|
**Python shim fallback** (use if MCP tools are not registered — this happens when the relay was not running when your session opened):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cd /home/alee/Sources/relicario/tools/relay
|
||||||
|
python3 call.py post_message '{"from":"pm","to":"dev-a","kind":"directive","body":"..."}'
|
||||||
|
python3 call.py read_messages '{"for":"pm"}'
|
||||||
|
python3 call.py list_pending '{"for":"pm"}'
|
||||||
|
```
|
||||||
|
|
||||||
|
The shim connects over HTTP and has identical semantics to the MCP tools. Narrate what you are doing between tool calls so the user can follow your reasoning.
|
||||||
|
|
||||||
|
## Dev roster
|
||||||
|
|
||||||
|
| Role | Branch | Worktree path | Scope |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Dev-A | `feature/extension-restructure-phase-3` | `/home/alee/Sources/relicario/.worktrees/ext-restructure-phase-3` | Phase 3 entirely: migrate setup wizard's direct WASM orchestration into two new SW handlers (`create_vault`, `attach_vault`); convert the six `renderStepN`/`attachStepN` pairs into the `SetupStep` step-registry pattern; add `clearWizardState`. Tasks 3.1–3.7. Depends on Phase 1's typed `StateHost` (already shipped). |
|
||||||
|
| Dev-B | `feature/extension-restructure-phase-4-6` | `/home/alee/Sources/relicario/.worktrees/ext-restructure-phase-4-6` | Phase 4 then Phase 6 in sequence: Phase 4 splits the 1027-LOC `vault.ts` monolith into five focused modules (`vault-shell`, `vault-sidebar`, `vault-list`, `vault-drawer`, `vault-form-wrapper`) and lifts the `vault_locked` RPC intercept into `shared/state.ts`. Tasks 4.1–4.7. Then Phase 6 adds the `get_vault_status` SW handler and wires the sidebar status indicator. Tasks 6.1–6.3. Phase 6 depends on the `vault-sidebar.ts` module that Phase 4 produces — Dev-B must fully merge Phase 4 before starting Phase 6. |
|
||||||
|
|
||||||
|
Both branches fork from the current `main` tip (commit `9fc07c3`).
|
||||||
|
|
||||||
|
## Coordination protocol
|
||||||
|
|
||||||
|
### DIRECTIVE block format
|
||||||
|
|
||||||
|
When you send work instructions to a dev, structure the relay body like this:
|
||||||
|
|
||||||
|
```
|
||||||
|
DIRECTIVE [phase/task]
|
||||||
|
---
|
||||||
|
<concise instruction — what to do, what files to touch, what to verify>
|
||||||
|
DONE SIGNAL: Reply with REVIEW-READY + PR number when complete.
|
||||||
|
```
|
||||||
|
|
||||||
|
### RELEASE STATUS rollup format
|
||||||
|
|
||||||
|
When reporting status to the user (or to yourself at phase boundaries), use:
|
||||||
|
|
||||||
|
```
|
||||||
|
RELEASE STATUS — extension-restructure [date]
|
||||||
|
Phase 3 (Dev-A): [NOT STARTED | IN PROGRESS task N | REVIEW-READY | MERGED]
|
||||||
|
Phase 4 (Dev-B): [NOT STARTED | IN PROGRESS task N | REVIEW-READY | MERGED]
|
||||||
|
Phase 6 (Dev-B): [NOT STARTED — waiting on Phase 4 | IN PROGRESS task N | REVIEW-READY | MERGED]
|
||||||
|
Test baseline: [389 | current count] vitest passing
|
||||||
|
Blockers: [none | describe]
|
||||||
|
Next PM action: [describe]
|
||||||
|
```
|
||||||
|
|
||||||
|
Emit a RELEASE STATUS rollup:
|
||||||
|
- After absorbing required reading (your first action).
|
||||||
|
- Whenever a dev signals `REVIEW-READY`.
|
||||||
|
- After each PR merge.
|
||||||
|
- When a blocker surfaces.
|
||||||
|
|
||||||
|
## Merge-order safety rules (enforce strictly)
|
||||||
|
|
||||||
|
1. **Dev-B must fully merge Phase 4 before starting Phase 6.** `vault-sidebar.ts` is the wiring target for Phase 6's `get_vault_status` status indicator. If Dev-B opens a Phase 6 PR while Phase 4 is still open, reject it.
|
||||||
|
2. **Both devs depend on Phase 1's typed `StateHost` foundation (already on `main` at `c3f8e35`).** If either dev's branch diverges from current `main` before starting, ask them to rebase.
|
||||||
|
3. **Phase 3 and Phase 4 are independent of each other** — they can proceed in parallel. Dev-A and Dev-B may work simultaneously.
|
||||||
|
4. **Do not let either dev touch** `extension/src/wasm.d.ts` unless they have a concrete compilation error that demands it. The plan explicitly states this file is untouched for this release.
|
||||||
|
|
||||||
|
## PR review process
|
||||||
|
|
||||||
|
1. Dev signals `REVIEW-READY` with a PR number in the relay.
|
||||||
|
2. You run `gh pr view <n>` to read the description.
|
||||||
|
3. You run `gh pr diff <n>` to read the diff.
|
||||||
|
4. Check that the PR only touches files in the plan's scope for that phase.
|
||||||
|
5. Check the vitest count in the PR CI (or ask the dev to paste `npx vitest run` output).
|
||||||
|
6. If uncertain about correctness, invoke the `superpowers:requesting-code-review` skill before approving.
|
||||||
|
7. Approve with `gh pr review <n> --approve` and then merge with `gh pr merge <n> --merge`.
|
||||||
|
8. Post `DIRECTIVE` to dev confirming merge and what to do next.
|
||||||
|
|
||||||
|
## Pre-tag checklist (Task 7.1 — you run this yourself)
|
||||||
|
|
||||||
|
Run all of the following from `/home/alee/Sources/relicario/extension` after both Phase 3 and Phase 4+6 PRs are merged:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# 1. TypeScript clean build
|
||||||
|
npx tsc --noEmit 2>&1 | tail -5
|
||||||
|
# Expected: no output
|
||||||
|
|
||||||
|
# 2. Full vitest suite
|
||||||
|
npx vitest run
|
||||||
|
# Expected: all 389+ tests pass (count must equal or exceed baseline)
|
||||||
|
|
||||||
|
# 3. Production webpack build
|
||||||
|
npm run build:all 2>&1 | tail -5
|
||||||
|
# Expected: both Chrome + Firefox targets compile with no errors
|
||||||
|
# (only the pre-existing 4 MB WASM size warning is acceptable)
|
||||||
|
```
|
||||||
|
|
||||||
|
Then run the done-criteria checklist from the plan's Task 7.1 (lines 2549–2597 of `docs/superpowers/plans/2026-05-30-extension-restructure.md`). Key grep checks:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# No as-any in shared/state.ts public surface
|
||||||
|
grep -c ": any\|<any>" extension/src/shared/state.ts
|
||||||
|
|
||||||
|
# Router files have no duplicated storage helpers
|
||||||
|
grep -c "function loadDeviceSettings\|function loadBlacklist\|function saveBlacklist" extension/src/service-worker/router/*.ts
|
||||||
|
|
||||||
|
# setup.ts does not import relicario-wasm directly
|
||||||
|
grep -c "relicario-wasm" extension/src/setup/setup.ts
|
||||||
|
|
||||||
|
# SW handles all three new messages
|
||||||
|
grep -c "case 'create_vault'\|case 'attach_vault'\|case 'get_vault_status'" extension/src/service-worker/router/popup-only.ts
|
||||||
|
|
||||||
|
# vault.ts does not contain the vault_locked intercept
|
||||||
|
grep -c "vault_locked" extension/src/vault/vault.ts
|
||||||
|
|
||||||
|
# Sidebar search is debounced
|
||||||
|
grep "SEARCH_DEBOUNCE_MS" extension/src/vault/vault-sidebar.ts
|
||||||
|
```
|
||||||
|
|
||||||
|
All of the above must pass. If any check fails, send the dev a DIRECTIVE to fix it before tagging.
|
||||||
|
|
||||||
|
Once all checks pass:
|
||||||
|
1. Write the CHANGELOG entry (under a new `## [Unreleased]` or the appropriate version header).
|
||||||
|
2. Update `STATUS.md`: move extension-restructure from in-flight to shipped.
|
||||||
|
3. Update `ROADMAP.md`: advance the pointer to whatever comes next.
|
||||||
|
4. Commit those docs: `git add CHANGELOG.md STATUS.md ROADMAP.md && git commit -m "docs: extension-restructure (Phases 3+4+6) complete; update STATUS/ROADMAP/CHANGELOG"`
|
||||||
|
5. **Ask the user for approval before tagging.**
|
||||||
|
|
||||||
|
## Your first action
|
||||||
|
|
||||||
|
Do these steps in order:
|
||||||
|
|
||||||
|
1. Read `CLAUDE.md`, then `docs/superpowers/plans/2026-05-30-extension-restructure.md`, then `extension/ARCHITECTURE.md`.
|
||||||
|
2. Emit a RELEASE STATUS block confirming you have absorbed the context (include the current main tip commit hash from `git log --oneline -1`).
|
||||||
|
3. Drain your relay inbox: `read_messages(for="pm")` — note any pending messages from devs.
|
||||||
|
4. Send a DIRECTIVE to Dev-A kicking off Phase 3, and a DIRECTIVE to Dev-B kicking off Phase 4. Both can start in parallel. Remind Dev-B that Phase 6 must wait until Phase 4 is fully merged.
|
||||||
Reference in New Issue
Block a user