Skip to content

Commit 1361973

Browse files
committed
refactor: enterprise architecture restructure - Extract features into modular structure - Move settings to src/features/settings/ - Move source/file-browser to src/features/source/ - Move workflows to src/features/workflows/ - Move seasonal effects to src/features/seasonal-effects/ - Create shared component modules (Avatar, ColorPicker, etc.) - Create core components directory - Reorganize lib utils into src/lib/utils/ - Clean up legacy component files
1 parent a4a4cdd commit 1361973

File tree

421 files changed

+42933
-25034
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

421 files changed

+42933
-25034
lines changed

.cursor/plans/AGENT-PROMPTS.md

Lines changed: 222 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,264 @@
1-
# Parallel Agent Prompts
1+
# Agent Prompts - Copy & Paste Ready
22

3-
Copy and paste the appropriate prompt into each Cursor agent window.
3+
Use these prompts to start each agent in a separate Cursor window or Composer session.
44

55
---
66

7-
## Agent 1: App.tsx Refactor
7+
## Agent 1: Core Components
88

99
```
10-
You are refactoring App.tsx as part of a parallel refactoring effort. Your plan file is at:
11-
12-
.cursor/plans/agent1-app-refactor.md
13-
14-
READ THE ENTIRE PLAN FILE BEFORE STARTING.
15-
16-
YOUR BOUNDARIES (CRITICAL - DO NOT VIOLATE):
17-
✅ CAN CREATE: src/hooks/*.ts, src/components/layout/*.tsx, src/providers/*.tsx
18-
✅ CAN EDIT: src/App.tsx, src/main.tsx
19-
❌ CANNOT TOUCH: ANY other component files, lib/, stores/, types/
20-
❌ SPECIFICALLY OFF-LIMITS: ActivityBar.tsx, BackupPanel.tsx, CommandSearch.tsx, lib/commands/
21-
22-
Other agents are working on those files in parallel. If you touch them, you will cause merge conflicts.
23-
24-
Execute the plan step by step. After each major step, verify the app still compiles with `npm run typecheck`.
25-
26-
Start by reading the plan file, then begin with Step 1.
10+
You are Agent 1 in a multi-agent refactoring operation for BluePLM. Your exclusive mission is to extract core reusable UI components.
11+
12+
## YOUR FILES ONLY (do not touch anything else):
13+
- src/components/Toast.tsx → Move to src/components/core/Toast/
14+
- src/components/ErrorBoundary.tsx → Move to src/components/core/ErrorBoundary/
15+
- CREATE: src/components/core/Loader/ (Spinner, loading states)
16+
- CREATE: src/components/core/Dialog/ (base dialog, confirm dialog)
17+
- CREATE: src/components/core/index.ts (barrel export)
18+
19+
## RULES:
20+
1. Create re-export stubs at original file locations for backward compatibility
21+
2. Use @/ import aliases for external imports
22+
3. Follow existing Tailwind patterns (plm-bg, plm-fg, plm-border, plm-accent)
23+
4. Run `npm run typecheck` after completing
24+
5. No emoji unless explicitly in original code
25+
26+
## READ YOUR PLAN:
27+
.cursor/plans/agent1-core-components.md
28+
29+
## START BY:
30+
Reading src/components/Toast.tsx and src/components/ErrorBoundary.tsx to understand current implementation.
2731
```
2832

2933
---
3034

31-
## Agent 2: ActivityBar Refactor
35+
## Agent 2: Shared Components
3236

3337
```
34-
You are refactoring ActivityBar.tsx as part of a parallel refactoring effort. Your plan file is at:
35-
36-
.cursor/plans/agent2-activitybar-refactor.md
37-
38-
READ THE ENTIRE PLAN FILE BEFORE STARTING.
39-
40-
YOUR BOUNDARIES (CRITICAL - DO NOT VIOLATE):
41-
✅ CAN CREATE: src/components/activity-bar/ (entire folder)
42-
✅ CAN EDIT: src/components/ActivityBar.tsx only
43-
✅ CAN READ (not edit): src/stores/pdmStore.ts, src/types/modules.ts
44-
❌ CANNOT TOUCH: App.tsx, BackupPanel.tsx, CommandSearch.tsx, Sidebar.tsx
45-
❌ CANNOT TOUCH: ANY file in src/lib/, src/stores/, src/types/, src/hooks/
46-
47-
Other agents are working on those files in parallel. If you touch them, you will cause merge conflicts.
48-
49-
Execute the plan step by step. After each major step, verify the app still compiles with `npm run typecheck`.
50-
51-
Start by reading the plan file, then begin with Step 1.
38+
You are Agent 2 in a multi-agent refactoring operation for BluePLM. Your exclusive mission is to organize shared smart components.
39+
40+
## YOUR FILES ONLY (do not touch anything else):
41+
- src/components/shared/ → Reorganize into subfolders
42+
- src/components/OnlineUsersIndicator.tsx → Move to shared/OnlineUsers/
43+
- src/components/ImpersonationBanner.tsx → Move to shared/ImpersonationBanner/
44+
- src/components/LanguageSelector.tsx → Move to shared/LanguageSelector/
45+
- src/components/SystemStats.tsx → Move to shared/SystemStats/
46+
- CREATE: src/components/shared/Avatar/ (extract avatar pattern from codebase)
47+
48+
## RULES:
49+
1. Create re-export stubs at original locations for backward compatibility
50+
2. Each component gets its own folder with index.ts
51+
3. Create barrel export at src/components/shared/index.ts
52+
4. Use @/ import aliases
53+
5. Run `npm run typecheck` after completing
54+
55+
## READ YOUR PLAN:
56+
.cursor/plans/agent2-shared-components.md
57+
58+
## START BY:
59+
Listing contents of src/components/shared/ to see current state.
5260
```
5361

5462
---
5563

56-
## Agent 3: BackupPanel Refactor
64+
## Agent 3: Seasonal Effects Feature
5765

5866
```
59-
You are refactoring BackupPanel.tsx as part of a parallel refactoring effort. Your plan file is at:
60-
61-
.cursor/plans/agent3-backuppanel-refactor.md
62-
63-
READ THE ENTIRE PLAN FILE BEFORE STARTING.
64-
65-
YOUR BOUNDARIES (CRITICAL - DO NOT VIOLATE):
66-
✅ CAN CREATE: src/components/backup/ (entire folder)
67-
✅ CAN EDIT: src/components/BackupPanel.tsx only
68-
✅ CAN READ (not edit): src/lib/backup.ts, src/stores/pdmStore.ts
69-
❌ CANNOT TOUCH: App.tsx, ActivityBar.tsx, CommandSearch.tsx
70-
❌ CANNOT TOUCH: ANY file in src/lib/ (including backup.ts), src/stores/, src/types/, src/hooks/
71-
72-
Other agents are working on those files in parallel. If you touch them, you will cause merge conflicts.
73-
74-
Execute the plan step by step. After each major step, verify the app still compiles with `npm run typecheck`.
75-
76-
Start by reading the plan file, then begin with Step 1.
67+
You are Agent 3 in a multi-agent refactoring operation for BluePLM. Your exclusive mission is to create the seasonal-effects feature module.
68+
69+
## YOUR FILES ONLY (do not touch anything else):
70+
- src/components/ChristmasEffects.tsx → Move to features/seasonal-effects/components/
71+
- src/components/HalloweenEffects.tsx → Move to features/seasonal-effects/components/
72+
- src/components/WeatherEffects.tsx → Move to features/seasonal-effects/components/
73+
- src/lib/weather.ts → Move to features/seasonal-effects/utils/
74+
- src/lib/snowPhysics.ts → Move to features/seasonal-effects/utils/
75+
- CREATE: src/features/seasonal-effects/ (complete feature module structure)
76+
77+
## RULES:
78+
1. Create re-export stubs at original locations for backward compatibility
79+
2. Use relative imports within the feature module
80+
3. Use @/ for imports from outside the feature
81+
4. Preserve ALL animation and physics logic exactly as-is
82+
5. Create types.ts, constants.ts, hooks/, utils/ in the feature
83+
6. Run `npm run typecheck` after completing
84+
7. Visual test: Set theme to 'christmas' or 'halloween' to verify effects work
85+
86+
## READ YOUR PLAN:
87+
.cursor/plans/agent3-seasonal-effects.md
88+
89+
## START BY:
90+
Creating the src/features/seasonal-effects/ directory structure, then reading existing effect components.
7791
```
7892

7993
---
8094

81-
## Agent 4: CommandSearch Refactor
95+
## Agent 4: Lib Utils Reorganization
8296

8397
```
84-
You are refactoring CommandSearch.tsx as part of a parallel refactoring effort. Your plan file is at:
85-
86-
.cursor/plans/agent4-commandsearch-refactor.md
87-
88-
READ THE ENTIRE PLAN FILE BEFORE STARTING.
89-
90-
YOUR BOUNDARIES (CRITICAL - DO NOT VIOLATE):
91-
✅ CAN CREATE: src/components/command-search/ (entire folder)
92-
✅ CAN EDIT: src/components/CommandSearch.tsx only
93-
✅ CAN READ (not edit): src/stores/pdmStore.ts
94-
❌ CANNOT TOUCH: App.tsx, ActivityBar.tsx, BackupPanel.tsx, MenuBar.tsx
95-
❌ CANNOT TOUCH: ANY file in src/lib/, src/stores/, src/types/, src/hooks/
96-
97-
Other agents are working on those files in parallel. If you touch them, you will cause merge conflicts.
98-
99-
Execute the plan step by step. After each major step, verify the app still compiles with `npm run typecheck`.
100-
101-
Start by reading the plan file, then begin with Step 1.
98+
You are Agent 4 in a multi-agent refactoring operation for BluePLM. Your exclusive mission is to reorganize lib utilities into a clean structure.
99+
100+
## YOUR FILES ONLY (do not touch anything else):
101+
- src/lib/utils.ts → Split into src/lib/utils/ folder
102+
- src/lib/clipboard.ts → Clean up, add JSDoc
103+
- src/lib/analytics.ts → Clean up, add JSDoc
104+
- CREATE: src/lib/utils/date.ts (date formatting utilities)
105+
- CREATE: src/lib/utils/string.ts (string manipulation)
106+
- CREATE: src/lib/utils/path.ts (platform-aware path utilities)
107+
- CREATE: src/lib/utils/format.ts (file size, number formatting)
108+
- CREATE: src/lib/utils/validation.ts (input validation)
109+
- CREATE: src/lib/utils/index.ts (barrel export)
110+
111+
## DO NOT TOUCH:
112+
- src/lib/supabase/ (separate agent later)
113+
- src/lib/commands/ (separate agent later)
114+
- src/lib/i18n/ (already organized)
115+
- src/lib/weather.ts (Agent 3's file)
116+
- src/lib/snowPhysics.ts (Agent 3's file)
117+
- src/lib/backup.ts, src/lib/workflows.ts, src/lib/realtime.ts (business logic)
118+
119+
## RULES:
120+
1. Pure utilities ONLY - no side effects, no API calls, no store access
121+
2. Add JSDoc comments to all exported functions
122+
3. Re-export from original utils.ts for backward compatibility
123+
4. Path utilities must work on both Windows and Mac
124+
5. Run `npm run typecheck` after completing
125+
126+
## READ YOUR PLAN:
127+
.cursor/plans/agent4-lib-utils.md
128+
129+
## START BY:
130+
Reading src/lib/utils.ts to audit existing utility functions.
102131
```
103132

104133
---
105134

106-
## Agent 5: Parser Refactor
135+
## Agent 5: FileBrowser Decomposition
107136

108137
```
109-
You are refactoring the command parser as part of a parallel refactoring effort. Your plan file is at:
110-
111-
.cursor/plans/agent5-parser-refactor.md
112-
113-
READ THE ENTIRE PLAN FILE BEFORE STARTING.
114-
115-
YOUR BOUNDARIES (CRITICAL - DO NOT VIOLATE):
116-
✅ CAN CREATE: src/lib/commands/registry.ts, src/lib/commands/errors.ts
117-
✅ CAN EDIT: src/lib/commands/parser.ts, src/lib/commands/index.ts, src/lib/commands/types.ts
118-
✅ CAN EDIT: src/lib/commands/handlers/*.ts (all handler files)
119-
❌ CANNOT TOUCH: src/lib/commands/executor.ts
120-
❌ CANNOT TOUCH: ANY file in src/components/
121-
❌ CANNOT TOUCH: ANY file in src/stores/, src/types/, src/hooks/
138+
You are Agent 5 in a multi-agent refactoring operation for BluePLM. Your exclusive mission is to decompose the massive FileBrowser.tsx into a clean feature module.
139+
140+
⚠️ THIS IS THE LARGEST REFACTOR - Work in phases, test after each phase.
141+
142+
## YOUR FILES ONLY (do not touch anything else):
143+
- src/components/FileBrowser.tsx (~7000 lines) → Split into features/file-browser/
144+
- src/components/file-browser/ → Move and expand into features/file-browser/
145+
- CREATE: src/features/file-browser/ (complete feature module)
146+
147+
## TARGET STRUCTURE:
148+
features/file-browser/
149+
├── components/
150+
│ ├── FileBrowser.tsx (main, ~400 lines MAX)
151+
│ ├── FileList/ (list view components)
152+
│ ├── FileGrid/ (grid view components)
153+
│ ├── ColumnHeaders/
154+
│ ├── Toolbar/
155+
│ ├── States/ (Empty, Loading, Error)
156+
│ └── Dialogs/ (Rename, Delete, Move, etc.)
157+
├── hooks/ (existing + new)
158+
├── utils/ (sorting, filtering, selection)
159+
├── types.ts
160+
├── constants.ts
161+
└── index.ts
162+
163+
## RULES:
164+
1. Work in PHASES - don't try to do everything at once
165+
2. Test after each phase - ensure file browser still works
166+
3. Preserve ALL functionality - selection, drag-drop, context menu, keyboard nav
167+
4. Build on existing hooks in file-browser/hooks/
168+
5. Run `npm run typecheck` after each phase
169+
6. Create re-export stub at src/components/FileBrowser.tsx
170+
171+
## READ YOUR PLAN:
172+
.cursor/plans/agent5-filebrowser-split.md
173+
174+
## START BY:
175+
Reading the first 200 lines of src/components/FileBrowser.tsx to understand imports and structure.
176+
Work in phases:
177+
1. Create directory structure
178+
2. Move existing helpers
179+
3. Extract utilities
180+
4. Extract hooks
181+
5. Extract components
182+
6. Rewrite main FileBrowser
183+
7. Create exports
184+
```
122185

123-
Other agents are working on those files in parallel. If you touch them, you will cause merge conflicts.
186+
---
124187

125-
Execute the plan step by step. After each major step, verify the app still compiles with `npm run typecheck`.
188+
## Agent 6: Settings Reorganization
126189

127-
Start by reading the plan file, then begin with Step 1.
190+
```
191+
You are Agent 6 in a multi-agent refactoring operation for BluePLM. Your exclusive mission is to reorganize 30+ settings files into domain groups.
192+
193+
## YOUR FILES ONLY (do not touch anything else):
194+
- src/components/settings/ (all files) → Move to features/settings/{domain}/
195+
- src/components/SettingsContent.tsx → Move to features/settings/components/
196+
- src/components/sidebar/SettingsNavigation.tsx → Move to features/settings/components/
197+
- CREATE: src/features/settings/ (complete feature module)
198+
199+
## DOMAIN GROUPINGS:
200+
- account/: AccountSettings, ProfileSettings, UserProfileModal, DeleteAccountSettings, KeybindingsSettings, PreferencesSettings
201+
- organization/: CompanyProfileSettings, VaultsSettings, ModulesSettings, team-members/, MetadataColumnsSettings, AuthProvidersSettings, PermissionsEditor
202+
- integrations/: ApiSettings, WebhooksSettings, GoogleDriveSettings, SolidWorksSettings, OdooSettings, SlackSettings, WooCommerceSettings
203+
- system/: PerformanceSettings, DevToolsSettings, LogsSettings, BackupSettings, ExportSettings, SerializationSettings, RFQSettings, SupabaseSettings, RecoveryCodeSettings, AboutSettings, ContributionHistory
204+
205+
## RULES:
206+
1. Create re-export stubs at original locations
207+
2. Keep team-members/ folder structure intact (it's already well organized)
208+
3. Watch for circular dependencies between settings files
209+
4. Check for exported utility functions (like getEffectiveExportSettings)
210+
5. Update SettingsContent.tsx to import from new locations
211+
6. Run `npm run typecheck` after completing
212+
213+
## READ YOUR PLAN:
214+
.cursor/plans/agent6-settings-reorg.md
215+
216+
## START BY:
217+
Listing all files in src/components/settings/ to get full inventory of files to move.
128218
```
129219

130220
---
131221

132-
# Execution Order Notes
222+
## Starting Multiple Agents
133223

134-
These 5 agents can run **fully in parallel** because they have non-overlapping file boundaries:
224+
### Option A: Multiple Cursor Windows
225+
1. Open 6 separate Cursor windows, all pointed at the same workspace
226+
2. Copy each agent prompt into a separate Composer session
227+
3. Let them run in parallel
135228

136-
| Agent | Creates | Edits | Off-Limits |
137-
|-------|---------|-------|------------|
138-
| 1 | hooks/, layout/, providers/ | App.tsx, main.tsx | All components, lib/ |
139-
| 2 | activity-bar/ | ActivityBar.tsx | App.tsx, other components |
140-
| 3 | backup/ | BackupPanel.tsx | App.tsx, lib/backup.ts |
141-
| 4 | command-search/ | CommandSearch.tsx | App.tsx, MenuBar.tsx |
142-
| 5 | lib/commands/registry.ts | parser.ts, handlers/*.ts | components/, executor.ts |
229+
### Option B: Sequential with Git Branches
230+
1. Create a branch for each agent: `git checkout -b refactor/agent1-core`
231+
2. Run agent prompt
232+
3. Commit changes
233+
4. Repeat for each agent
234+
5. Merge all branches
143235

144-
## After All Agents Complete
236+
### Option C: Cursor Background Agents
237+
If using Cursor's background agent feature:
238+
1. Start Agent 5 first (longest task)
239+
2. Start Agents 1-4 and 6 simultaneously
240+
3. Monitor progress in background agent panel
145241

146-
Once all agents finish, you may need to:
147-
1. Update any import statements in files that import the refactored components
148-
2. Run `npm run typecheck` to catch any type errors
149-
3. Run `npm run build` to verify production build works
150-
4. Test the app manually to ensure functionality
151-
152-
## Potential Import Updates Needed
153-
154-
After refactoring, these files may need import path updates:
155-
- `App.tsx` imports ActivityBar → may need update
156-
- `MenuBar.tsx` imports CommandSearch → may need update
157-
- `RightPanel.tsx` imports BackupPanel → may need update
158-
- `Sidebar.tsx` imports various sidebar views → unchanged
242+
---
159243

160-
The agents should handle re-exports from old locations, but verify imports work.
244+
## Verification After All Agents Complete
245+
246+
```bash
247+
# Run typecheck
248+
npm run typecheck
249+
250+
# Start the app
251+
npm run dev
252+
253+
# Test checklist:
254+
# - [ ] App starts without errors
255+
# - [ ] File browser list view works
256+
# - [ ] File browser grid view works
257+
# - [ ] Selection and drag-drop work
258+
# - [ ] Context menu works
259+
# - [ ] Settings pages all accessible
260+
# - [ ] Christmas effects work (set theme to christmas)
261+
# - [ ] Halloween effects work (set theme to halloween)
262+
# - [ ] Toast notifications work
263+
# - [ ] Dialogs open and close
264+
```

0 commit comments

Comments
 (0)