|
| 1 | +# PR Drawer vs Workspace Contexts Separation Plan |
| 2 | + |
| 3 | +## Purpose |
| 4 | + |
| 5 | +Define a post-4C UX split so transactional GitHub actions stay focused while local-first workspace lifecycle actions move to a dedicated surface. |
| 6 | + |
| 7 | +## Problem Statement |
| 8 | + |
| 9 | +The current Open Pull Request drawer mixes two distinct concerns: |
| 10 | + |
| 11 | +1. Transactional sync actions: |
| 12 | + - Open pull request |
| 13 | + - Push commit to active pull request |
| 14 | +2. Workspace lifecycle management: |
| 15 | + - Select/search local contexts |
| 16 | + - Remove local contexts |
| 17 | + |
| 18 | +This creates cognitive overhead and makes destructive local operations feel coupled to one-shot GitHub actions. |
| 19 | + |
| 20 | +## Goals |
| 21 | + |
| 22 | +1. Keep PR drawer focused on transactional actions and immediate status. |
| 23 | +2. Move workspace lifecycle operations to a dedicated context management surface. |
| 24 | +3. Preserve local-first behavior and IndexedDB as source of truth for workspace content. |
| 25 | +4. Keep migration incremental and avoid breaking existing flows. |
| 26 | + |
| 27 | +## Product Decisions (Locked) |
| 28 | + |
| 29 | +The following decisions are accepted for implementation: |
| 30 | + |
| 31 | +1. Add a dedicated `Workspaces` control button in `app-grid-ai-controls`. |
| 32 | +2. `Workspaces` opens its own drawer for lifecycle operations (search/select/remove and future context features). |
| 33 | +3. Open PR / Push commit flows no longer expose `Component filename` and `Styles filename` fields. |
| 34 | +4. Commit target filenames are derived from workspace tab metadata stored in IndexedDB. |
| 35 | +5. The checkbox currently labeled `Include App wrapper in committed component source` will be relabeled to reflect entry-tab semantics. |
| 36 | +6. Open PR / Push commit confirmation summary shifts from two fixed file fields to a mapped tab/file list. |
| 37 | + |
| 38 | +## Proposed Information Architecture |
| 39 | + |
| 40 | +### 1. PR Drawer (Transactional) |
| 41 | + |
| 42 | +Keep only action-scoped fields and status: |
| 43 | + |
| 44 | +1. Repository and branch selection |
| 45 | +2. File mapping summary derived from workspace tab metadata |
| 46 | +3. PR title/body and commit message |
| 47 | +4. Submit actions (Open PR, Push commit) |
| 48 | +5. Transaction status/errors |
| 49 | + |
| 50 | +Optional shortcut: |
| 51 | + |
| 52 | +1. Current context selector (read-focused quick switch) |
| 53 | +2. Link/button to open full context manager |
| 54 | + |
| 55 | +### 2. Workspace Context Manager (Lifecycle) |
| 56 | + |
| 57 | +Dedicated UI surface (modal or side panel) for: |
| 58 | + |
| 59 | +1. Search/filter local contexts |
| 60 | +2. Select/activate local context |
| 61 | +3. Remove one or many local contexts |
| 62 | +4. Future: open PR binding and context metadata management |
| 63 | + |
| 64 | +Location and trigger: |
| 65 | + |
| 66 | +1. Triggered from a new `Workspaces` button in `app-grid-ai-controls`. |
| 67 | +2. Implemented as a dedicated drawer separate from the PR drawer. |
| 68 | +3. Uses a colocated module structure under a parent directory dedicated to workspace lifecycle UI. |
| 69 | + |
| 70 | +## Storage Boundaries (Unchanged) |
| 71 | + |
| 72 | +1. IndexedDB: |
| 73 | + - Workspace tabs and content |
| 74 | + - Tab sync metadata (dirty/synced markers) |
| 75 | + - Workspace context records |
| 76 | +2. localStorage: |
| 77 | + - User preferences |
| 78 | + - Lightweight per-repo PR drawer config |
| 79 | + |
| 80 | +## Migration Plan |
| 81 | + |
| 82 | +### Phase A: Transitional (Low Risk) |
| 83 | + |
| 84 | +1. Add `Workspaces` button in `app-grid-ai-controls` with dedicated icon. |
| 85 | +2. Add standalone `Workspaces` drawer skeleton and lifecycle list rendering. |
| 86 | +3. Move search/remove controls from PR drawer into `Workspaces` drawer. |
| 87 | +4. Keep quick context selection in PR drawer only as an optional shortcut. |
| 88 | + |
| 89 | +### Phase B: Consolidation |
| 90 | + |
| 91 | +1. Reduce PR drawer context UI to active context summary + switch shortcut. |
| 92 | +2. Remove component/styles filename fields from PR drawer. |
| 93 | +3. Derive commit file targets exclusively from workspace tab metadata in IndexedDB. |
| 94 | +4. Add multi-select removal and richer filters in manager. |
| 95 | + |
| 96 | +### Phase C: Follow-up Enhancements |
| 97 | + |
| 98 | +1. Open PR list binding tools live in manager. |
| 99 | +2. Context health indicators (dirty, synced, drift) appear in manager list. |
| 100 | +3. Optional pin/favorite/recents support. |
| 101 | +4. Optional tab-level include/exclude toggles for commit targets (if needed by workflow feedback). |
| 102 | + |
| 103 | +## Confirmation Summary Contract (Open PR / Push Commit) |
| 104 | + |
| 105 | +The confirmation dialog should show: |
| 106 | + |
| 107 | +1. Repository (`owner/repo`) |
| 108 | +2. Branch information: |
| 109 | + - Open PR: `Base` and `Head` |
| 110 | + - Push commit: `Head` |
| 111 | +3. Commit message |
| 112 | +4. A commit target list derived from tab metadata: |
| 113 | + - Tab display name |
| 114 | + - Repository-relative filepath |
| 115 | + - Optional tag for entry tab |
| 116 | + |
| 117 | +Recommended rendering: |
| 118 | + |
| 119 | +1. Keep the top metadata lines concise. |
| 120 | +2. Show a bulleted list for `Files to commit` so users can quickly scan exact targets. |
| 121 | +3. For long lists, cap visible rows and show `+N more` summary. |
| 122 | + |
| 123 | +## Accessibility and UX Requirements |
| 124 | + |
| 125 | +1. Dedicated manager must support keyboard navigation for list/select/remove. |
| 126 | +2. Destructive actions must require explicit confirmation. |
| 127 | +3. PR drawer status remains transactional only. |
| 128 | +4. Context manager explains local-only deletion scope clearly. |
| 129 | + |
| 130 | +## Testing Plan |
| 131 | + |
| 132 | +1. PR drawer tests verify transactional workflows independent of context cleanup. |
| 133 | +2. Context manager tests verify search/select/delete workflows. |
| 134 | +3. Migration test verifies existing users retain contexts after UI split. |
| 135 | + |
| 136 | +## Open Decisions |
| 137 | + |
| 138 | +1. Modal vs side panel for context manager. |
| 139 | +2. Whether quick-select remains in PR drawer after Phase B. |
| 140 | +3. Whether context removal supports undo window. |
| 141 | +4. Whether the PR drawer should show all mapped tabs or only tabs marked as commit-included. |
| 142 | + |
| 143 | +## Implementation Structure Guidance |
| 144 | + |
| 145 | +To keep implementation modular and colocated: |
| 146 | + |
| 147 | +1. Create a parent module directory for lifecycle UI, for example: |
| 148 | + - `src/modules/workspaces-drawer/` |
| 149 | +2. Keep small focused modules inside it, for example: |
| 150 | + - `drawer.js` (controller) |
| 151 | + - `state.js` (view state) |
| 152 | + - `list-render.js` (UI rendering) |
| 153 | + - `actions.js` (select/remove commands) |
| 154 | +3. Keep PR transactional logic in existing PR modules and consume workspace metadata via adapter functions only. |
| 155 | + |
| 156 | +## UI Copy Updates |
| 157 | + |
| 158 | +1. Rename checkbox label: |
| 159 | + - From: `Include App wrapper in committed component source` |
| 160 | + - To: `Include entry tab source in committed output` |
| 161 | +2. In summaries and status, refer to `entry tab` and `workspace files` rather than `component/styles files`. |
| 162 | + |
| 163 | +## Suggested Rollout |
| 164 | + |
| 165 | +1. Land after 4C stabilization tests are green. |
| 166 | +2. Ship Phase A first, then Phase B in follow-up PR. |
0 commit comments