diff --git a/prompts/m5/README.md b/prompts/m5/README.md new file mode 100644 index 000000000..01d731646 --- /dev/null +++ b/prompts/m5/README.md @@ -0,0 +1,107 @@ +# M5 - Notes CRUD + BlockNote + CRDT / Phase Prompts + +Fresh-session prompts for M5. Run one phase per clean session. Do not start the +next phase until the previous phase is committed and verified. + +## Worktree + +M5 should run after M4 is merged to `main`. + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m4 +git fetch origin +git worktree add ../spike-tauri-m5 -b m5/notes-crud-blocknote-crdt main +cd ../spike-tauri-m5 +``` + +If the branch name is random, rename it before pushing: + +```bash +git branch -m m5/notes-crud-blocknote-crdt +``` + +All prompts assume this root: + +```text +/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +``` + +## Execution Order + +| Phase | Prompt | Task | Plan Tasks | Status | +|-------|--------|------|------------|--------| +| A | `m5-phase-a-crdt-foundation.md` | Rust yrs CRDT core, DocStore, apply/snapshot/state-vector/compaction/wire | 1-9 | TODO | +| B | `m5-phase-b-db-schema-notes.md` | CRDT migrations plus notes/folders/tags DB primitives | 10-19 | TODO | +| C | `m5-phase-c-db-properties-crdt-persistence.md` | Property definitions plus CRDT update/snapshot persistence | 20-22 | TODO | +| D | `m5-phase-d-notes-core-commands.md` | Notes command skeleton, create/get/update/delete/list | 23-28 | TODO | +| E | `m5-phase-e-notes-advanced-commands.md` | Rename/move/exists/local-only/tags/links/aggregate tests | 29-32 | TODO | +| F | `m5-phase-f-folder-commands.md` | Folder CRUD, configs, templates, positions | 33-35 | TODO | +| G | `m5-phase-g-property-commands.md` | Property definition and option command surface | 36-37 | TODO | +| H | `m5-phase-h-deferred-stubs-parity.md` | File metadata/open/reveal plus deferred M6/M8 mock ledger | 38-39 | TODO | +| I | `m5-phase-i-crdt-commands.md` | CRDT Tauri command surface, chunks, capabilities, tests | 40-46 | TODO | +| J | `m5-phase-j-renderer-provider-blocknote.md` | Renderer origin tags, Yjs provider, BlockNote binding, mock swap | 47-50 | TODO | +| K | `m5-phase-k-md-to-yjs-seed.md` | Markdown to BlockNote blocks and idempotent Y.Doc seed | 51-52 | TODO | +| L | `m5-phase-l-registration-devtools-bindings.md` | Devtools, registrations, capabilities, bindings, event parity | 53-56 | TODO | +| M | `m5-phase-m-renderer-legacy-contract-cleanup.md` | Replace legacy sync_crdt path, rehome contracts, IPC cleanup | 57-60 | TODO | +| N | `m5-phase-n-runtime-e2e.md` | Real Tauri runtime e2e lane | 65-71 | TODO | +| O | `m5-phase-o-final-verification-ledger.md` | Full verification, manual dogfood, carry-forward ledger | 72-74 | TODO | + +The source plan has 13 chunks. These prompts split the largest DB and notes-command +chunks into smaller sessions to reduce integration churn. + +## Global Rules + +1. Worktree root: `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +2. Branch: `m5/notes-crud-blocknote-crdt` +3. Source of truth: `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +4. Parent spec: `docs/superpowers/specs/2026-04-24-electron-to-tauri-full-migration-design.md` +5. Predecessor: M4 must be merged before M5 starts. +6. New work goes only to `apps/desktop-tauri/` unless a phase explicitly says otherwise. +7. `apps/desktop/**` is read-only reference material. Do not change Electron during M5. +8. Tauri command names are snake_case. Tauri events use kebab-case unless the plan + explicitly preserves a compatibility alias. +9. CRDT fragment name is exactly `prosemirror`. +10. Inline CRDT IPC update cap is 8 KB; larger updates use chunk commands. +11. Commit format: `m5(): `. +12. No branding in branch names, commit bodies, PR descriptions, or generated docs. + +## Required Method + +Each implementation phase starts by invoking: + +- `superpowers:using-superpowers` +- `superpowers:test-driven-development` for phases that write code +- `superpowers:systematic-debugging` for failures with non-obvious cause +- `superpowers:verification-before-completion` before reporting complete + +Use RED-GREEN for every task with a test file in the plan. Confirm the RED failure +before implementation, then confirm GREEN before committing. + +## Phase Handoff + +At the end of every phase, run the smallest full-phase gate listed in that prompt, +then report: + +```text +Phase complete. +Tasks covered: +Commits: (..) +Verification: +Next: Phase - +Blockers: +``` + +## Emergency Stop + +Stop and report if: + +- M4 is not merged or baseline checks are red. +- `yrs` APIs differ from the plan enough to change the CRDT design. +- renderer contracts conflict with generated Specta bindings. +- any production build would still rely on an unledgered mock route. +- `devtools_*` commands leak into production capabilities or generated production + command lists. +- runtime e2e requires fake JS-only CRDT convergence instead of real `crdt_*` commands. + +Do not guess. Identify root cause, state the smallest fix, and wait if the fix changes +scope. diff --git a/prompts/m5/m5-phase-a-crdt-foundation.md b/prompts/m5/m5-phase-a-crdt-foundation.md new file mode 100644 index 000000000..7d645d07e --- /dev/null +++ b/prompts/m5/m5-phase-a-crdt-foundation.md @@ -0,0 +1,110 @@ +# M5 Phase A - CRDT Foundation + +Fresh session prompt. This phase lands the Rust `yrs` CRDT core before any command +exposes it. + +--- + +## PROMPT START + +You are implementing **Phase A of Milestone M5** for Memry's Electron to Tauri +migration. This phase executes plan Tasks 1-9 from +`docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Spec:** `docs/superpowers/specs/2026-04-24-electron-to-tauri-full-migration-design.md` +**Prompts README:** `prompts/m5/README.md` + +M5 replaces mock notes/CRDT behavior with a Rust-owned authoritative Y.Doc runtime. +Phase A only builds the Rust CRDT core. It does not add DB persistence, commands, +renderer wiring, or runtime e2e. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +git rev-parse --abbrev-ref HEAD # expect: m5/notes-crud-blocknote-crdt +git log --oneline main | head -10 # expect M4 merged +test -f apps/desktop-tauri/src-tauri/Cargo.toml +test -f apps/desktop-tauri/src-tauri/src/error.rs +test -f apps/desktop-tauri/src-tauri/src/app_state.rs +test -f apps/desktop-tauri/src-tauri/src/lib.rs +grep -q '^yrs = "0.21"' apps/desktop-tauri/src-tauri/Cargo.toml +pnpm --filter @memry/desktop-tauri cargo:check +pnpm --filter @memry/desktop-tauri cargo:test +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri command:parity +``` + +If any command fails, STOP and report. Do not start M5 on an unverified M4 base. + +### Your Scope + +Execute Tasks 1-9 in order: + +- **Task 1:** Add `lru` and `once_cell` dependencies. +- **Task 2:** Add `AppError::Crdt` and `From` decode/apply error impls. +- **Task 3:** Add `crdt/mod.rs`, `CrdtRuntime`, origin tag, and `AppState` wiring. +- **Task 4:** Implement `DocStore`, `DocHandle`, `get_or_init`, `get`, `drop_doc`. +- **Task 5:** Implement `crdt/apply.rs` with `apply_update_v1`. +- **Task 6:** Implement `crdt/snapshot.rs` with snapshot and diff encoders. +- **Task 7:** Implement `crdt/state_vector.rs`. +- **Task 8:** Implement `crdt/compaction.rs` and threshold constants. +- **Task 9:** Implement `crdt/wire.rs` with `CRDT_UPDATE_EVENT` and payload types. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 1-9 fully before editing. Use the code snippets there as the + implementation baseline, but adapt to the exact repo APIs. +3. Keep the outer `DocStore` map lock short. Do not hold it across Yjs transactions. +4. Stamp updates with a stable non-zero origin tag. +5. Commit once per task when source changed. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/crdt/mod.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/docstore.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/apply.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/snapshot.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/state_vector.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/compaction.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/wire.rs + +cd apps/desktop-tauri/src-tauri +cargo test --test error_crdt_test +cargo test --test crdt_runtime_test +cargo test --test crdt_docstore_test +cargo test --test crdt_apply_test +cargo test --test crdt_snapshot_test +cargo test --test crdt_state_vector_test +cargo test --test crdt_compaction_test +cargo test --test crdt_wire_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri cargo:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'crdt_*' +``` + +### When Done + +Report: + +```text +Phase A complete. +Tasks covered: 1, 2, 3, 4, 5, 6, 7, 8, 9 +Commits: (..) +Verification: crdt/error tests + cargo check/clippy/test +Next: Phase B - prompts/m5/m5-phase-b-db-schema-notes.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-b-db-schema-notes.md b/prompts/m5/m5-phase-b-db-schema-notes.md new file mode 100644 index 000000000..58b5e727a --- /dev/null +++ b/prompts/m5/m5-phase-b-db-schema-notes.md @@ -0,0 +1,105 @@ +# M5 Phase B - DB Schema + Notes DB Primitives + +Fresh session prompt. This phase adds the CRDT migrations and fleshes out the notes, +folder-config, position, cache, and tag DB modules. + +--- + +## PROMPT START + +You are implementing **Phase B of Milestone M5**. This phase executes plan Tasks +10-19 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-a-crdt-foundation.md` + +Phase A created the in-memory CRDT runtime. Phase B builds the local data persistence +base needed by notes/folder/property/CRDT commands. It does not expose Tauri commands. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +git rev-parse --abbrev-ref HEAD +test -f apps/desktop-tauri/src-tauri/src/crdt/docstore.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/wire.rs +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'crdt_*' +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +If any command fails, STOP and fix Phase A first. + +### Your Scope + +Execute Tasks 10-19 in order: + +- **Task 10:** Capture schema diff baseline and inspect Electron SQL as read-only + reference. No commit. +- **Task 11:** Add migration `0029_crdt_updates.sql` and migration test. +- **Task 12:** Add migration `0030_crdt_snapshots.sql` and migration test. +- **Task 13:** Register both migrations in `db/migrations.rs`. +- **Task 14:** Declare/re-export DB modules in `db/mod.rs`. +- **Task 15:** Implement `db/note_metadata.rs` CRUD, soft delete, rename, local-only, + exists, list helpers, and tests. +- **Task 16:** Implement `db/note_positions.rs` reorder/get/drop helpers and tests. +- **Task 17:** Implement `db/notes_cache.rs` refresh/list/count/delete helpers and + tests. Add a migration only if the table is actually missing. +- **Task 18:** Implement `db/folder_configs.rs` get/set/delete/template inheritance + and tests. +- **Task 19:** Implement `db/tag_definitions.rs` list/count/upsert/rename behavior + and tests. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 10-19 fully before editing. +3. Use Electron SQL only as reference; do not modify `apps/desktop/**`. +4. Add `test_helpers` only if missing, behind the same cfg pattern already used in + the Tauri crate. +5. Keep SQL simple and explicit. No speculative indexing beyond the plan. +6. Commit once per task when source changed. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/migrations/0029_crdt_updates.sql +test -f apps/desktop-tauri/src-tauri/migrations/0030_crdt_snapshots.sql +test -f apps/desktop-tauri/src-tauri/src/db/note_metadata.rs +test -f apps/desktop-tauri/src-tauri/src/db/note_positions.rs +test -f apps/desktop-tauri/src-tauri/src/db/notes_cache.rs +test -f apps/desktop-tauri/src-tauri/src/db/folder_configs.rs +test -f apps/desktop-tauri/src-tauri/src/db/tag_definitions.rs + +cd apps/desktop-tauri/src-tauri +cargo test --test migrations_test +cargo test --test db_note_metadata_test +cargo test --test db_note_positions_test +cargo test --test db_notes_cache_test +cargo test --test db_folder_configs_test +cargo test --test db_tag_definitions_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'db_*' --test migrations_test +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +### When Done + +Report: + +```text +Phase B complete. +Tasks covered: 10, 11, 12, 13, 14, 15, 16, 17, 18, 19 +Commits: (..) +Verification: migrations_test + db note/folder/tag tests + cargo clippy +Next: Phase C - prompts/m5/m5-phase-c-db-properties-crdt-persistence.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-c-db-properties-crdt-persistence.md b/prompts/m5/m5-phase-c-db-properties-crdt-persistence.md new file mode 100644 index 000000000..e5697d264 --- /dev/null +++ b/prompts/m5/m5-phase-c-db-properties-crdt-persistence.md @@ -0,0 +1,90 @@ +# M5 Phase C - DB Properties + CRDT Persistence + +Fresh session prompt. This phase adds property-definition persistence and CRDT +update/snapshot persistence. + +--- + +## PROMPT START + +You are implementing **Phase C of Milestone M5**. This phase executes plan Tasks +20-22 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-b-db-schema-notes.md` + +Phase B landed the DB scaffolding and notes-adjacent modules. Phase C completes the +DB layer by adding property definitions and CRDT persistence modules. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/migrations/0029_crdt_updates.sql +test -f apps/desktop-tauri/src-tauri/migrations/0030_crdt_snapshots.sql +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'db_*' --test migrations_test +``` + +If this fails, STOP and finish Phase B. + +### Your Scope + +Execute Tasks 20-22 in order: + +- **Task 20:** Create `db/property_definitions.rs` and tests. Cover list/get/create, + update/ensure, add/remove/rename option, update option color, status options, delete. +- **Task 21:** Create `db/crdt_updates.rs` and tests. Cover append, max_seq, + list_for_note, drop_through, origin persistence, and payload size cap. +- **Task 22:** Create `db/crdt_snapshots.rs` and tests. Cover get_latest and + upsert_with_compaction dropping old updates in one transaction. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 20-22 fully before editing. +3. Keep JSON option mutation local to `property_definitions.rs`. +4. Do not introduce connection pools. Use the existing single-connection pattern. +5. For snapshot compaction, transactionality matters: write snapshot and drop old update + rows together. +6. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/db/property_definitions.rs +test -f apps/desktop-tauri/src-tauri/src/db/crdt_updates.rs +test -f apps/desktop-tauri/src-tauri/src/db/crdt_snapshots.rs +test -f apps/desktop-tauri/src-tauri/tests/db_property_definitions_test.rs +test -f apps/desktop-tauri/src-tauri/tests/db_crdt_updates_test.rs +test -f apps/desktop-tauri/src-tauri/tests/db_crdt_snapshots_test.rs + +cd apps/desktop-tauri/src-tauri +cargo test --test db_property_definitions_test +cargo test --test db_crdt_updates_test +cargo test --test db_crdt_snapshots_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'db_*' --test migrations_test +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +### When Done + +Report: + +```text +Phase C complete. +Tasks covered: 20, 21, 22 +Commits: (..) +Verification: property/crdt DB tests + db full slice + clippy +Next: Phase D - prompts/m5/m5-phase-d-notes-core-commands.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-d-notes-core-commands.md b/prompts/m5/m5-phase-d-notes-core-commands.md new file mode 100644 index 000000000..e53c5cb0d --- /dev/null +++ b/prompts/m5/m5-phase-d-notes-core-commands.md @@ -0,0 +1,98 @@ +# M5 Phase D - Notes Core Commands + +Fresh session prompt. This phase lands the notes command skeleton and basic lifecycle +commands. + +--- + +## PROMPT START + +You are implementing **Phase D of Milestone M5**. This phase executes plan Tasks +23-28 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-c-db-properties-crdt-persistence.md` + +The DB layer now exists. Phase D exposes the core notes lifecycle as Rust commands and +inner helpers. Advanced notes helpers come in Phase E. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/src/db/note_metadata.rs +test -f apps/desktop-tauri/src-tauri/src/db/notes_cache.rs +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'db_*' --test migrations_test +``` + +If this fails, STOP and finish the DB phases. + +### Your Scope + +Execute Tasks 23-28 in order: + +- **Task 23:** Create `commands/notes.rs` skeleton, renderer-shape DTOs, shared helpers, + and module registration. Add `chrono` only if needed after searching current deps. +- **Task 24:** Implement `notes_create` and `notes_create_inner`. +- **Task 25:** Implement `notes_get` and `notes_get_by_path`. +- **Task 26:** Implement `notes_update`. +- **Task 27:** Implement `notes_delete` soft delete. Add a minimal vault trash helper only + if the M3 vault layer lacks one. +- **Task 28:** Implement `notes_list` and `notes_list_by_folder`. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 23-28 fully before editing. +3. Keep commands thin: validate input -> vault FS -> DB modules -> emit event -> return DTO. +4. Write inner helpers for testability when `AppHandle` is not needed. +5. Register commands only after the implementation exists. +6. Commit once per task. + +### Critical Gotchas + +1. Body content lives in the vault FS. Metadata/cache live in SQLite. +2. User-facing command errors must use `AppError` variants, not raw strings. +3. Event names for this phase must be `note-created`, `note-updated`, and + `note-deleted`. +4. Do not implement folders/properties/CRDT commands here. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/commands/notes.rs +test -f apps/desktop-tauri/src-tauri/tests/commands_notes_create_test.rs +test -f apps/desktop-tauri/src-tauri/tests/commands_notes_get_test.rs + +cd apps/desktop-tauri/src-tauri +cargo test --test commands_notes_create_test +cargo test --test commands_notes_get_test +cargo test --test commands_notes_test || true + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri cargo:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +`commands_notes_test` may not exist until Phase E. If it exists, it must pass. + +### When Done + +Report: + +```text +Phase D complete. +Tasks covered: 23, 24, 25, 26, 27, 28 +Commits: (..) +Verification: notes create/get/update/delete/list tests + cargo check/clippy +Next: Phase E - prompts/m5/m5-phase-e-notes-advanced-commands.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-e-notes-advanced-commands.md b/prompts/m5/m5-phase-e-notes-advanced-commands.md new file mode 100644 index 000000000..dd4ce6609 --- /dev/null +++ b/prompts/m5/m5-phase-e-notes-advanced-commands.md @@ -0,0 +1,88 @@ +# M5 Phase E - Notes Advanced Commands + +Fresh session prompt. This phase completes the notes command surface that is not folder +or property specific. + +--- + +## PROMPT START + +You are implementing **Phase E of Milestone M5**. This phase executes plan Tasks +29-32 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-d-notes-core-commands.md` + +Phase D landed basic notes lifecycle commands. Phase E completes rename/move/existence, +local-only state, tags, links, wiki-link helpers, and the aggregate notes command test. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/src/commands/notes.rs +pnpm --filter @memry/desktop-tauri cargo:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +If this fails, STOP and finish Phase D. + +### Your Scope + +Execute Tasks 29-32 in order: + +- **Task 29:** Implement `notes_rename`, `notes_move`, and `notes_exists`. +- **Task 30:** Implement `notes_set_local_only` and `notes_get_local_only_count`. +- **Task 31:** Implement `notes_get_tags`, `notes_get_links`, + `notes_resolve_by_title`, and `notes_preview_by_title`. +- **Task 32:** Create/finish `commands_notes_test.rs` with at least 6 happy-path + scenarios across create/list/rename/move/delete/local-only/exists. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 29-32 fully before editing. +3. Keep wiki-link resolution SQL `LIKE`/`COLLATE NOCASE` only. Add the TODO(M7) note + from the plan, but do not build FTS in M5. +4. Preserve existing renderer DTO shape from Phase D. +5. Register new commands in the same Rust handler/bindings path used by Phase D. +6. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +rg -n "notes_rename|notes_move|notes_exists|notes_get_links|notes_preview_by_title" \ + apps/desktop-tauri/src-tauri/src/commands/notes.rs +test -f apps/desktop-tauri/src-tauri/tests/commands_notes_test.rs + +cd apps/desktop-tauri/src-tauri +cargo test --test commands_notes_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri bindings:generate +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +Commit regenerated bindings only if this phase changes generated bindings. + +### When Done + +Report: + +```text +Phase E complete. +Tasks covered: 29, 30, 31, 32 +Commits: (..) +Verification: commands_notes_test + bindings check + clippy +Next: Phase F - prompts/m5/m5-phase-f-folder-commands.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-f-folder-commands.md b/prompts/m5/m5-phase-f-folder-commands.md new file mode 100644 index 000000000..28781dfce --- /dev/null +++ b/prompts/m5/m5-phase-f-folder-commands.md @@ -0,0 +1,85 @@ +# M5 Phase F - Folder Commands + +Fresh session prompt. This phase ships folder CRUD, folder configs/templates, and note +position commands. + +--- + +## PROMPT START + +You are implementing **Phase F of Milestone M5**. This phase executes plan Tasks +33-35 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-e-notes-advanced-commands.md` + +The notes command surface exists. Phase F adds folder-level commands and positions. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/src/db/folder_configs.rs +test -f apps/desktop-tauri/src-tauri/src/db/note_positions.rs +test -f apps/desktop-tauri/src-tauri/src/commands/notes.rs +pnpm --filter @memry/desktop-tauri cargo:test -- --test commands_notes_test +``` + +If this fails, STOP and finish notes commands first. + +### Your Scope + +Execute Tasks 33-35 in order: + +- **Task 33:** Create `commands/folders.rs`; implement `notes_get_folders`, + `notes_create_folder`, `notes_rename_folder`, `notes_delete_folder`, with tests. +- **Task 34:** Implement `notes_get_folder_config`, `notes_set_folder_config`, and + `notes_get_folder_template`. +- **Task 35:** Implement `notes_get_positions`, `notes_get_all_positions`, and + `notes_reorder`. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 33-35 fully before editing. +3. Use M3 vault FS helpers for directory operations. If a helper is missing, add the + smallest method in the existing vault module. +4. Rename folder must update child note metadata paths. +5. Delete folder must refuse non-empty folders unless `recursive: true`. +6. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/commands/folders.rs +test -f apps/desktop-tauri/src-tauri/tests/commands_folders_test.rs +rg -n "notes_get_folders|notes_create_folder|notes_reorder" apps/desktop-tauri/src-tauri/src + +cd apps/desktop-tauri/src-tauri +cargo test --test commands_folders_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +### When Done + +Report: + +```text +Phase F complete. +Tasks covered: 33, 34, 35 +Commits: (..) +Verification: commands_folders_test + bindings check + clippy +Next: Phase G - prompts/m5/m5-phase-g-property-commands.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-g-property-commands.md b/prompts/m5/m5-phase-g-property-commands.md new file mode 100644 index 000000000..d365c44d5 --- /dev/null +++ b/prompts/m5/m5-phase-g-property-commands.md @@ -0,0 +1,81 @@ +# M5 Phase G - Property Commands + +Fresh session prompt. This phase ships the property-definition command surface. + +--- + +## PROMPT START + +You are implementing **Phase G of Milestone M5**. This phase executes plan Tasks +36-37 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-f-folder-commands.md` + +The property DB module exists. Phase G exposes it through Tauri commands. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/src/db/property_definitions.rs +pnpm --filter @memry/desktop-tauri cargo:test -- --test db_property_definitions_test +``` + +If this fails, STOP and finish Phase C. + +### Your Scope + +Execute Tasks 36-37 in order: + +- **Task 36:** Create `commands/properties.rs`; implement + `notes_get_property_definitions`, `notes_create_property_definition`, + `notes_update_property_definition`, and `notes_ensure_property_definition`. +- **Task 37:** Implement `notes_add_property_option`, `notes_add_status_option`, + `notes_remove_property_option`, `notes_rename_property_option`, + `notes_update_option_color`, and `notes_delete_property_definition`. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 36-37 fully before editing. +3. Commands should be thin wrappers over `db::property_definitions`. +4. Accept permissive JSON payloads where the current renderer contract is loose. +5. Emit/subscribe to `folder-config-updated` only where the current renderer expects it. +6. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/commands/properties.rs +test -f apps/desktop-tauri/src-tauri/tests/commands_properties_test.rs +rg -n "notes_add_property_option|notes_delete_property_definition" apps/desktop-tauri/src-tauri/src + +cd apps/desktop-tauri/src-tauri +cargo test --test commands_properties_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +### When Done + +Report: + +```text +Phase G complete. +Tasks covered: 36, 37 +Commits: (..) +Verification: commands_properties_test + bindings check + clippy +Next: Phase H - prompts/m5/m5-phase-h-deferred-stubs-parity.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-h-deferred-stubs-parity.md b/prompts/m5/m5-phase-h-deferred-stubs-parity.md new file mode 100644 index 000000000..8325474eb --- /dev/null +++ b/prompts/m5/m5-phase-h-deferred-stubs-parity.md @@ -0,0 +1,86 @@ +# M5 Phase H - Deferred Stubs + Parity Ledger + +Fresh session prompt. This phase classifies editor-adjacent command surface: real file +metadata/open/reveal commands plus explicit deferred M6/M8 stubs. + +--- + +## PROMPT START + +You are implementing **Phase H of Milestone M5**. This phase executes plan Tasks +38-39 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-g-property-commands.md` + +The core notes/folder/property commands exist. Phase H prevents command parity drift by +classifying everything editor-adjacent that M5 does not own yet. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri cargo:check +pnpm --filter @memry/desktop-tauri command:parity || true +``` + +The parity command may still show unclassified M5 routes at the start of this phase. + +### Your Scope + +Execute Tasks 38-39 in order: + +- **Task 38:** Create `commands/stubs_m6_m7_m8.rs`; implement real M5 + `notes_get_file`, `notes_open_external`, and `notes_reveal_in_finder`. +- **Task 39:** Create renderer deferred mock route files for attachments/export/ + versions/import, wire them into the mock router, and update the command parity + deferred ledger. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 38-39 fully before editing. +3. `notes_open_external` and `notes_reveal_in_finder` must delegate to existing shell + helpers. Add `*_inner` helper seams only if needed for tests. +4. Deferred mocks must include clear `deferred:M6` or `deferred:M8` markers. +5. Do not register export/import/version/attachment commands as real M5 commands. +6. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/commands/stubs_m6_m7_m8.rs +test -f apps/desktop-tauri/src/lib/ipc/mocks/stubs/attachments.ts +test -f apps/desktop-tauri/src/lib/ipc/mocks/stubs/export.ts +test -f apps/desktop-tauri/src/lib/ipc/mocks/stubs/versions.ts +test -f apps/desktop-tauri/src/lib/ipc/mocks/stubs/import.ts +rg -n "deferred:M6|deferred:M8" apps/desktop-tauri/src/lib/ipc/mocks apps/desktop-tauri/scripts + +pnpm --filter @memry/desktop-tauri cargo:check +pnpm --filter @memry/desktop-tauri command:parity +pnpm --filter @memry/desktop-tauri test +``` + +Expected: zero unclassified notes/folder/property/editor-adjacent commands after the +ledger update. + +### When Done + +Report: + +```text +Phase H complete. +Tasks covered: 38, 39 +Commits: (..) +Verification: cargo check + command parity + renderer tests +Next: Phase I - prompts/m5/m5-phase-i-crdt-commands.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-i-crdt-commands.md b/prompts/m5/m5-phase-i-crdt-commands.md new file mode 100644 index 000000000..c45263915 --- /dev/null +++ b/prompts/m5/m5-phase-i-crdt-commands.md @@ -0,0 +1,96 @@ +# M5 Phase I - CRDT Commands + +Fresh session prompt. This phase exposes the Rust CRDT runtime through Tauri commands. + +--- + +## PROMPT START + +You are implementing **Phase I of Milestone M5**. This phase executes plan Tasks +40-46 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-h-deferred-stubs-parity.md` + +The CRDT runtime and DB persistence exist. Phase I exposes open/apply/snapshot/state +vector/sync/chunk commands for the renderer provider. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/src/crdt/apply.rs +test -f apps/desktop-tauri/src-tauri/src/db/crdt_updates.rs +test -f apps/desktop-tauri/src-tauri/src/db/crdt_snapshots.rs +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'crdt_*' --test 'db_crdt_*' +``` + +If this fails, STOP and finish earlier CRDT/DB phases. + +### Your Scope + +Execute Tasks 40-46 in order: + +- **Task 40:** Create `commands/crdt.rs`; implement `crdt_open_doc`, + `crdt_close_doc`, and inner helpers. +- **Task 41:** Implement `crdt_apply_update` with 8 KB inline cap, persistence, + compaction, and `crdt-update` event emission. +- **Task 41A:** Implement large-update chunk commands: + `crdt_apply_update_chunk_start`, `crdt_apply_update_chunk_append`, + `crdt_apply_update_chunk_finish`. +- **Task 42:** Implement binary `Response` commands `crdt_get_snapshot` and + `crdt_get_state_vector`. +- **Task 43:** Implement `crdt_sync_step_1` and `crdt_sync_step_2`. +- **Task 44:** Implement `crdt_get_or_init_doc`. +- **Task 45:** Add capability scopes for CRDT commands. +- **Task 46:** Finish aggregate `commands_crdt_test.rs`. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 40-46 fully before editing. +3. Use binary `tauri::ipc::Response` for snapshot/state-vector returns. +4. Inline CRDT updates above 8 KB must fail and direct users to chunked transport. +5. Chunk finish must persist once, emit one `crdt-update`, and clear the accumulator. +6. Register commands and regenerate bindings after the commands compile. +7. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/commands/crdt.rs +test -f apps/desktop-tauri/src-tauri/tests/commands_crdt_test.rs +rg -n "crdt_apply_update_chunk_start|crdt_get_snapshot|crdt_sync_step_1" \ + apps/desktop-tauri/src-tauri/src + +cd apps/desktop-tauri/src-tauri +cargo test --test commands_crdt_test +cargo test --test crdt_compaction_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri bindings:generate +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri capability:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +### When Done + +Report: + +```text +Phase I complete. +Tasks covered: 40, 41, 41A, 42, 43, 44, 45, 46 +Commits: (..) +Verification: commands_crdt_test + bindings/capability check + clippy +Next: Phase J - prompts/m5/m5-phase-j-renderer-provider-blocknote.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-j-renderer-provider-blocknote.md b/prompts/m5/m5-phase-j-renderer-provider-blocknote.md new file mode 100644 index 000000000..1f886a2ab --- /dev/null +++ b/prompts/m5/m5-phase-j-renderer-provider-blocknote.md @@ -0,0 +1,87 @@ +# M5 Phase J - Renderer Provider + BlockNote Binding + +Fresh session prompt. This phase wires the renderer Y.Doc shadow state to the Rust CRDT +commands and BlockNote editor. + +--- + +## PROMPT START + +You are implementing **Phase J of Milestone M5**. This phase executes plan Tasks +47-50 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-i-crdt-commands.md` + +The Rust CRDT commands exist. Phase J adds the renderer provider, origin echo guard, +BlockNote binding, and graduated mock route removal for this slice. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +rg -n "crdt_get_or_init_doc|crdt_apply_update|crdt-update" apps/desktop-tauri/src-tauri/src +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri capability:check +``` + +If this fails, STOP and finish Phase I. + +### Your Scope + +Execute Tasks 47-50 in order: + +- **Task 47:** Create `src/lib/crdt/origin-tags.ts` and tests. +- **Task 48:** Create `src/lib/crdt/yjs-tauri-provider.ts` and tests. +- **Task 49:** Wire the current BlockNote `ContentArea`/collaboration hook to the + Rust-backed Yjs provider. +- **Task 50:** Add real M5 commands to renderer IPC allowlist and delete graduated + notes/folders/properties/CRDT mocks, leaving only deferred routes. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 47-50 fully before editing. +3. Keep one provider path. Do not leave a parallel unused provider implementation. +4. Fragment name is exactly `prosemirror`. +5. Echo prevention must drop events whose origin matches the renderer origin. +6. Do not hide real Rust command failures by falling back to mocks. +7. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src/lib/crdt/origin-tags.ts +test -f apps/desktop-tauri/src/lib/crdt/yjs-tauri-provider.ts +rg -n "prosemirror|YjsTauriProvider|crdt_apply_update" apps/desktop-tauri/src + +pnpm --filter @memry/desktop-tauri test -- src/lib/crdt/origin-tags.test.ts +pnpm --filter @memry/desktop-tauri test -- src/lib/crdt/yjs-tauri-provider.test.ts +pnpm --filter @memry/desktop-tauri test +pnpm --filter @memry/desktop-tauri command:parity +pnpm --filter @memry/desktop-tauri test:e2e -- --grep="@mock-lane" +``` + +If the mock lane is intentionally marked runtime-only for CRDT-backed editor behavior, +document the exact skipped tests and why. + +### When Done + +Report: + +```text +Phase J complete. +Tasks covered: 47, 48, 49, 50 +Commits: (..) +Verification: crdt renderer tests + full test + command parity + mock lane result +Next: Phase K - prompts/m5/m5-phase-k-md-to-yjs-seed.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-k-md-to-yjs-seed.md b/prompts/m5/m5-phase-k-md-to-yjs-seed.md new file mode 100644 index 000000000..7f899edeb --- /dev/null +++ b/prompts/m5/m5-phase-k-md-to-yjs-seed.md @@ -0,0 +1,94 @@ +# M5 Phase K - Markdown to Yjs Seed + +Fresh session prompt. This phase converts markdown from the vault into the first +BlockNote-compatible CRDT document. + +--- + +## PROMPT START + +You are implementing **Phase K of Milestone M5**. This phase executes plan Tasks +51-52 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-j-renderer-provider-blocknote.md` + +The renderer can talk to Rust CRDT commands. Phase K makes first-open seeding from +existing markdown useful and idempotent. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/src/commands/crdt.rs +test -f apps/desktop-tauri/src/lib/crdt/yjs-tauri-provider.ts +pnpm --filter @memry/desktop-tauri cargo:test -- --test commands_crdt_test +pnpm --filter @memry/desktop-tauri test -- src/lib/crdt +``` + +If this fails, STOP and finish Phases I/J. + +### Your Scope + +Execute Tasks 51-52 in order: + +- **Task 51:** Add `pulldown-cmark`; create `crdt/md_to_yjs.rs` and tests for + paragraphs, headings, lists, code blocks, empty input, and Turkish diacritics. +- **Task 52:** Create `crdt/seed.rs`; seed an empty Y.Doc under XmlFragment + `prosemirror`; make seeding idempotent; wire modules into `crdt/mod.rs`. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 51-52 fully before editing. +3. Keep markdown conversion intentionally scoped: paragraph, heading, list item, + code block. Do not build full markdown fidelity in M5. +4. If `yrs` XML APIs differ from the plan snippets, adapt the minimal code while + preserving the contract: BlockNote can render seeded content. +5. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/crdt/md_to_yjs.rs +test -f apps/desktop-tauri/src-tauri/src/crdt/seed.rs +rg -n "prosemirror|seed_from_markdown|md_to_blocknote_blocks" apps/desktop-tauri/src-tauri/src/crdt + +cd apps/desktop-tauri/src-tauri +cargo test --test crdt_md_to_yjs_test +cargo test --test crdt_seed_test + +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri cargo:test -- --test 'crdt_*' +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +``` + +Manual smoke before reporting complete: + +```bash +pnpm --filter @memry/desktop-tauri dev +``` + +Open a markdown-only note with paragraphs/headings/lists and confirm visible content in +BlockNote. + +### When Done + +Report: + +```text +Phase K complete. +Tasks covered: 51, 52 +Commits: (..) +Verification: crdt_md_to_yjs_test + crdt_seed_test + crdt slice + manual open smoke +Next: Phase L - prompts/m5/m5-phase-l-registration-devtools-bindings.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-l-registration-devtools-bindings.md b/prompts/m5/m5-phase-l-registration-devtools-bindings.md new file mode 100644 index 000000000..d223c1c76 --- /dev/null +++ b/prompts/m5/m5-phase-l-registration-devtools-bindings.md @@ -0,0 +1,94 @@ +# M5 Phase L - Registration, Devtools, Capabilities, Bindings + +Fresh session prompt. This phase makes all M5 commands reachable, adds debug-only +runtime helpers, and aligns bindings/capabilities/events/parity. + +--- + +## PROMPT START + +You are implementing **Phase L of Milestone M5**. This phase executes plan Tasks +53-56 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-k-md-to-yjs-seed.md` + +Command modules exist, but M5 is not complete until registrations, generated bindings, +capabilities, parity audit, and event names agree. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +test -f apps/desktop-tauri/src-tauri/src/commands/notes.rs +test -f apps/desktop-tauri/src-tauri/src/commands/folders.rs +test -f apps/desktop-tauri/src-tauri/src/commands/properties.rs +test -f apps/desktop-tauri/src-tauri/src/commands/crdt.rs +pnpm --filter @memry/desktop-tauri cargo:check +``` + +If this fails, STOP and finish implementation phases first. + +### Your Scope + +Execute Tasks 53-56 in order: + +- **Task 53:** Add debug/test-only `commands/devtools.rs`, `capabilities/dev.json`, + tests, and cfg-gated registration. +- **Task 54:** Register every M5 command in `generate_handler![]`, Specta/bindings + generation, and `examples/generate_bindings.rs`. +- **Task 55:** Add default capability grants, command parity `REQUIRED_REAL` and + `RETIRED` aliases, plus production mock guard in `src/lib/ipc/invoke.ts`. +- **Task 56:** Add event-name parity tests for Rust emissions and renderer + subscriptions. + +### Methodology + +1. Invoke `superpowers:using-superpowers`, `superpowers:test-driven-development`, and + `superpowers:verification-before-completion`. +2. Read plan Tasks 53-56 fully before editing. +3. `devtools_*` must compile only under debug/test-helper gates and must not appear in + production `default.json`. +4. Register every real M5 command exactly once. +5. `sync_crdt_*` aliases are retired. The audit must fail if literals remain. +6. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/src-tauri/src/commands/devtools.rs +test -f apps/desktop-tauri/src-tauri/capabilities/dev.json +test -f apps/desktop-tauri/src-tauri/tests/commands_devtools_test.rs + +pnpm --filter @memry/desktop-tauri cargo:test -- --test commands_devtools_test +pnpm --filter @memry/desktop-tauri bindings:generate +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri capability:check +pnpm --filter @memry/desktop-tauri command:parity +pnpm --filter @memry/desktop-tauri test -- scripts/command-parity-audit.test.ts +pnpm --filter @memry/desktop-tauri test -- src/services/notes-service.test.ts +``` + +Expected: generated `Commands` includes all real M5 commands and no production +`devtools_*` commands. + +### When Done + +Report: + +```text +Phase L complete. +Tasks covered: 53, 54, 55, 56 +Commits: (..) +Verification: devtools test + bindings/capability/parity + event tests +Next: Phase M - prompts/m5/m5-phase-m-renderer-legacy-contract-cleanup.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-m-renderer-legacy-contract-cleanup.md b/prompts/m5/m5-phase-m-renderer-legacy-contract-cleanup.md new file mode 100644 index 000000000..4f53e9d44 --- /dev/null +++ b/prompts/m5/m5-phase-m-renderer-legacy-contract-cleanup.md @@ -0,0 +1,89 @@ +# M5 Phase M - Renderer Legacy CRDT + Contract Cleanup + +Fresh session prompt. This phase removes legacy renderer CRDT aliases and rehomes +M5-owned renderer contracts. + +--- + +## PROMPT START + +You are implementing **Phase M of Milestone M5**. This phase executes plan Tasks +57-60 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-l-registration-devtools-bindings.md` + +The real command surface is registered. Phase M removes the old renderer CRDT path and +prevents shared-package dependencies from leaking into the Tauri app for notes/CRDT. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri command:parity +rg "sync_crdt_|crdt-state-changed" apps/desktop-tauri/src || true +``` + +Legacy matches are expected at the start only if Phase M has not run yet. + +### Your Scope + +Execute Tasks 57-60 in order: + +- **Task 57:** Replace legacy `sync_crdt_*` provider calls in + `src/sync/yjs-ipc-provider.ts` and `use-yjs-collaboration.ts`; update tests. +- **Task 58:** Bind current `ContentArea` deliberately to the Rust-backed provider, + including ready/error/not-ready test coverage. +- **Task 59:** Create narrow local contracts in `src/contracts/notes.ts` and + `src/contracts/crdt.ts`; update imports away from touched `@memry/*` notes/CRDT + surfaces. +- **Task 60:** Final mock router cleanup for all graduated M5 commands. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:test-driven-development`. +2. Read plan Tasks 57-60 fully before editing. +3. Do not keep two active CRDT provider implementations. +4. Move only M5-owned renderer types. Do not copy sync-server schemas or unrelated RPC + contracts. +5. Real M5 commands must route to Rust; deferred commands must be ledgered. +6. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +rg "sync_crdt_|crdt-state-changed" apps/desktop-tauri/src +# expected: no matches + +rg "@memry/(contracts|rpc).*(notes|ipc-crdt)|@memry/rpc/notes|@memry/contracts/ipc-crdt" \ + apps/desktop-tauri/src +# expected: no matches unless every remaining hit is documented with an owner milestone + +pnpm --filter @memry/desktop-tauri typecheck +pnpm --filter @memry/desktop-tauri test -- src/sync +pnpm --filter @memry/desktop-tauri test -- src/components/note/content-area +pnpm --filter @memry/desktop-tauri test -- src/lib/ipc +pnpm --filter @memry/desktop-tauri command:parity +``` + +### When Done + +Report: + +```text +Phase M complete. +Tasks covered: 57, 58, 59, 60 +Commits: (..) +Verification: no legacy CRDT aliases + typecheck + sync/content/ipc tests + parity +Next: Phase N - prompts/m5/m5-phase-n-runtime-e2e.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-n-runtime-e2e.md b/prompts/m5/m5-phase-n-runtime-e2e.md new file mode 100644 index 000000000..d50699380 --- /dev/null +++ b/prompts/m5/m5-phase-n-runtime-e2e.md @@ -0,0 +1,93 @@ +# M5 Phase N - Runtime E2E Lane + +Fresh session prompt. This phase adds the first real Tauri runtime e2e lane. + +--- + +## PROMPT START + +You are implementing **Phase N of Milestone M5**. This phase executes plan Tasks +65-71 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-m-renderer-legacy-contract-cleanup.md` + +M5 must prove real Tauri runtime behavior, not only mock-lane React tests. This phase +adds the additive `test:e2e:runtime` lane with tauri-driver/WebDriverIO. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri capability:check +pnpm --filter @memry/desktop-tauri command:parity +pnpm --filter @memry/desktop-tauri test +pnpm --filter @memry/desktop-tauri test:e2e +``` + +If the mock lane is not green, STOP and fix earlier phases first. + +### Your Scope + +Execute Tasks 65-71 in order: + +- **Task 65:** Add runtime e2e dependencies/scripts/config. Install or document + `tauri-driver`. +- **Task 66:** Add runtime runner and helpers for driver, vault, and devtools. +- **Task 67:** Add typing p95 and restart persistence scenarios. +- **Task 68:** Add slash/table/code/link, undo/redo, and paste/manual coverage. +- **Task 69:** Add concurrent-edit convergence scenario using real `crdt_*` commands. +- **Task 70:** Add empty/loading/error/offline/capability-denied state coverage. +- **Task 71:** Run runtime lane and mock lane close-out. + +### Methodology + +1. Invoke `superpowers:using-superpowers`, `superpowers:test-driven-development`, and + `superpowers:systematic-debugging` for flaky runtime failures. +2. Read plan Tasks 65-71 fully before editing. +3. Runtime lane is additive. Do not change `test:e2e` away from the fast mock lane. +4. Each runtime test uses a fresh temp vault under `$TMPDIR/memry-e2e-`. +5. Use `MEMRY_DEVICE` and `MEMRY_ORIGIN_TAG` to make multi-device cases deterministic. +6. Do not fake CRDT convergence in JS. Drive the real runtime command path. +7. Commit once per task. + +### Acceptance Criteria + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +test -f apps/desktop-tauri/e2e/runtime/run-runtime-e2e.ts +test -f apps/desktop-tauri/e2e/runtime/helpers/driver.ts +test -f apps/desktop-tauri/e2e/runtime/helpers/vault.ts +test -f apps/desktop-tauri/e2e/runtime/helpers/devtools.ts +test -f apps/desktop-tauri/e2e/runtime/specs/typing.spec.ts +test -f apps/desktop-tauri/e2e/runtime/specs/persistence.spec.ts +test -f apps/desktop-tauri/e2e/runtime/specs/concurrent-edit.spec.ts +test -f apps/desktop-tauri/e2e/runtime/specs/states.spec.ts + +pnpm --filter @memry/desktop-tauri test:e2e:runtime +pnpm --filter @memry/desktop-tauri test:e2e +``` + +Document any paste skip only if WebDriver clipboard support is unavailable, and keep the +manual checklist under `e2e/runtime/manual/clipboard-paste.md`. + +### When Done + +Report: + +```text +Phase N complete. +Tasks covered: 65, 66, 67, 68, 69, 70, 71 +Commits: (..) +Verification: runtime e2e + mock e2e +Next: Phase O - prompts/m5/m5-phase-o-final-verification-ledger.md +Blockers: +``` + +## PROMPT END diff --git a/prompts/m5/m5-phase-o-final-verification-ledger.md b/prompts/m5/m5-phase-o-final-verification-ledger.md new file mode 100644 index 000000000..b43550e4b --- /dev/null +++ b/prompts/m5/m5-phase-o-final-verification-ledger.md @@ -0,0 +1,127 @@ +# M5 Phase O - Final Verification + Ledger + +Fresh session prompt. This phase closes M5 with full verification, manual dogfood, and +carry-forward bookkeeping. + +--- + +## PROMPT START + +You are implementing **Phase O of Milestone M5**. This phase executes plan Tasks +72-74 from `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md`. + +### Context + +**Worktree:** `/Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5` +**Branch:** `m5/notes-crud-blocknote-crdt` +**Plan:** `docs/superpowers/plans/2026-04-26-m5-notes-crud-blocknote-crdt.md` +**Previous phase:** `prompts/m5/m5-phase-n-runtime-e2e.md` + +All implementation phases should be complete. Phase O adds no planned feature work; it +verifies, fixes only real verification issues, and records the carry-forward ledger. + +### Prerequisite Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 +git status --short +test -f apps/desktop-tauri/e2e/runtime/run-runtime-e2e.ts +pnpm --filter @memry/desktop-tauri command:parity +``` + +If implementation is incomplete, STOP and return to the missing phase. + +### Your Scope + +Execute Tasks 72-74 in order: + +- **Task 72:** Run full local verification: Rust fmt/check/clippy/test, renderer lint/ + typecheck/test, bindings, capabilities, parity, mock e2e, runtime e2e. +- **Task 73:** Run manual dogfood against a fresh real vault with `VITE_MOCK_IPC=false`. +- **Task 74:** Update PR body or milestone ledger with M5 carry-forward details. + +### Methodology + +1. Invoke `superpowers:using-superpowers` and `superpowers:verification-before-completion`. +2. Use `superpowers:systematic-debugging` for any failing command whose cause is not + obvious. +3. Do not add new feature scope in this phase. +4. If fixes are required, make the smallest patch, rerun the failing check, then rerun + the relevant full gate. +5. Commit fixes with narrow messages. Commit ledger/doc changes only if source docs + actually changed. + +### Automated Verification + +```bash +cd /Users/h4yfans/sideproject/memry-worktrees/spike-tauri-m5 + +pnpm --filter @memry/desktop-tauri cargo:fmt -- --check +pnpm --filter @memry/desktop-tauri cargo:check +pnpm --filter @memry/desktop-tauri cargo:clippy -- -D warnings +pnpm --filter @memry/desktop-tauri cargo:test + +pnpm --filter @memry/desktop-tauri lint +pnpm --filter @memry/desktop-tauri typecheck +pnpm --filter @memry/desktop-tauri test +pnpm --filter @memry/desktop-tauri bindings:check +pnpm --filter @memry/desktop-tauri capability:check +pnpm --filter @memry/desktop-tauri command:parity + +pnpm --filter @memry/desktop-tauri test:e2e +pnpm --filter @memry/desktop-tauri test:e2e:runtime +``` + +Expected: all pass before M5 is considered complete. + +### Manual Dogfood Checklist + +Run against a fresh vault with `VITE_MOCK_IPC=false`: + +- create note, type 500+ chars, restart, content remains +- rename note, move folder, reorder within folder +- delete note, verify it disappears and vault/trash behavior matches Task 27 +- wiki-link resolve and hover preview work +- file note metadata opens and reveal-in-Finder works +- local-only toggle and count update +- property create/update/options/status flows work in folder view +- attachment upload/list/delete shows M6 deferred error shape without data loss +- export/import/version commands show M8 deferred shape and are production-ledgered + +### Ledger Content + +Record the Task 74 carry-forward ledger in the PR body or milestone ledger: + +```markdown +## M5 Carry-Forward Ledger + +- M4 baseline command audit: `/tmp/m4-parity-baseline.txt` +- M5 final command audit: output from `pnpm --filter @memry/desktop-tauri command:parity` +- Real in M5: notes CRUD, folders, properties, positions, local-only, wiki-link helpers, + note file open/reveal, CRDT open/apply/snapshot/state-vector/sync-step/chunk helpers +- Deferred M6: attachment upload/list/delete if not fully local metadata-backed; cloud + blob upload/download +- Deferred M7: FTS-backed wiki-link/search ranking +- Deferred M8: import/export/pdf/html/version history and remaining editor chrome +- Retired aliases: `sync_crdt_*` -> `crdt_*` +- Production mock guard: enabled and tested +- Runtime e2e evidence: typing p95, persistence, slash, undo/redo, concurrent edit, + state coverage +- Known warnings carried forward: exact warning, owner milestone, non-blocking reason +``` + +### When Done + +Report: + +```text +Phase O complete. +Tasks covered: 72, 73, 74 +Commits: (..) +Automated verification: +Manual verification: +Carry-forward ledger: +Blockers: +``` + +## PROMPT END