Summary
Implement Phase 4B for @knighted/develop: the user-facing sync controls for mapping arbitrary workspace tabs to GitHub file paths, selecting already-open PRs, and self-cleaning stored local workspaces.
This issue delivers the UX/workflow layer on top of Phase 4A sync metadata, while keeping local-first behavior as the primary product model.
Context
Arbitrary Dynamic Editor Tabs (vNext): Named Multi-File Workspace Model for @knighted/develop #53 defines multi-tab PR/file mapping as part of Phase 4.
Multi-Tab Workspace (Dynamic Tabs, Local IndexedDB Persistence, and Modular Preview Architecture) #62 delivered phases 1-3 local-first multi-tab foundations.
Phase 4A introduces per-tab sync metadata and dirty/reconcile state.
Phase 4B now adds the user controls and context workflows needed before bulk push orchestration.
Goals
Allow users to map any tab to a repository-relative target file path.
Allow users to select and bind to already-open PRs for a selected repository.
Provide local workspace management so users can search/select/delete IndexedDB entries.
Keep sync status and errors in PR drawer status text (no app-level toast expansion).
Keep implementation modular and composable.
In Scope
PR drawer UI for tab-to-file mapping:
search/select tab
set/edit/remove target path
mapped/unmapped and dirty indicators
Open PR selection flow:
list open PRs for selected repo
choose one PR and bind current workspace context
restore mapped tab metadata when switching contexts
Local workspace cleanup controls:
search/filter stored local contexts
select one or many entries
delete with confirmation
Persist and restore mapping/config state using established storage boundaries:
IndexedDB for workspace/mapping state
localStorage only for lightweight preferences/form state
Out of Scope
GitHub bulk commit implementation details (Phase 4C).
AI apply/undo tab routing (Phase 5).
Full fixed-assumption cleanup (Phase 6), except minimal compatibility glue.
UX Requirements
Mapping flow is explicit and reversible.
Search is available for tabs and/or contexts (dropdown/select is acceptable baseline).
Open PR binding is repository-scoped and does not destroy unsynced local data silently.
Cleanup flow is user-controlled, discoverable, and guarded with confirmation.
Status channel remains inside PR drawer.
Acceptance Criteria
User can map multiple tabs to repository-relative file paths and persist mappings across reload.
User can view open PRs for selected repo and bind current workspace to chosen PR.
Switching bound PR context restores associated mappings and sync metadata.
User can search/filter local stored contexts and delete selected entries.
Deletion removes only selected IndexedDB records and does not wipe unrelated preferences.
Dirty/mapped indicators render consistently from Phase 4A metadata.
Lint/build/tests pass.
Verification
Automated:
Playwright coverage for mapping create/edit/remove and reload persistence
Playwright coverage for open PR selection and context switching restore
Playwright coverage for search/filter/select/delete cleanup flow
integration tests for mapping state hydration and context binding behavior
Manual:
map 3+ tabs, reload, verify mappings persist
bind to an existing open PR, switch contexts, verify correct restore
delete selected local contexts, verify only targeted records are removed
confirm status/errors appear in PR drawer text only
Dependencies
Depends on: Phase 4A issue, Arbitrary Dynamic Editor Tabs (vNext): Named Multi-File Workspace Model for @knighted/develop #53 , Multi-Tab Workspace (Dynamic Tabs, Local IndexedDB Persistence, and Modular Preview Architecture) #62
Blocks: Phase 4C bulk push issue and contributes prerequisites for Phase 6 cleanup
Suggested Follow-up
Phase 4C: Git Database API atomic multi-file push + fallback orchestration
Phase 6: remove fixed component/styles sync assumptions end-to-end
Summary
Implement Phase 4B for @knighted/develop: the user-facing sync controls for mapping arbitrary workspace tabs to GitHub file paths, selecting already-open PRs, and self-cleaning stored local workspaces.
This issue delivers the UX/workflow layer on top of Phase 4A sync metadata, while keeping local-first behavior as the primary product model.
Context
Goals
In Scope
Out of Scope
UX Requirements
Acceptance Criteria
Verification
Dependencies
Suggested Follow-up