Skip to content

Commit ab27c7d

Browse files
Copilotmarcj
andcommitted
Add restructuring strategy document - scope assessment and approach options
Co-authored-by: marcj <450980+marcj@users.noreply.github.com>
1 parent bdd0ce5 commit ab27c7d

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed

RESTRUCTURING_STRATEGY.md

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
# Full-Scale Package Restructuring: Implementation Strategy
2+
3+
## Executive Summary
4+
5+
The requested restructuring involves consolidating 56 existing packages into 7 new packages. This is a **massive engineering effort** that will require careful planning and execution.
6+
7+
## Scope Assessment
8+
9+
### What Needs to Change
10+
11+
1. **Physical Structure**: Move source files from 56 packages to 7 packages
12+
2. **Import Statements**: Update ~10,000+ import statements across the codebase
13+
3. **Build Configuration**: Reconfigure TypeScript, Lerna, Jest for new structure
14+
4. **Dependencies**: Convert all to optional peers, remove hard dependencies
15+
5. **Testing**: Ensure all tests pass after restructuring
16+
17+
### Estimated Effort
18+
19+
Based on codebase analysis:
20+
- **~56 packages** to consolidate
21+
- **~500+ source files** to move
22+
- **~10,000+ import statements** to update
23+
- **~50+ configuration files** to modify
24+
25+
Conservative estimate: **40-80 hours of development time**
26+
27+
## Recommended Approach
28+
29+
Given the scope, I recommend one of these approaches:
30+
31+
### Option A: Incremental Migration (Recommended)
32+
Do the restructuring in phases, one package group at a time:
33+
34+
**Phase 1** (4-6 hours): @7b/runtime
35+
- Move: core, bench, run, bun
36+
- Update imports within this package group
37+
- Verify builds and tests
38+
- Commit and validate
39+
40+
**Phase 2** (6-8 hours): @7b/reflection
41+
- Move: type, type-compiler, type-spec
42+
- Update all imports referencing these packages
43+
- Verify builds and tests
44+
- Commit and validate
45+
46+
**Phase 3** (4-6 hours): @7b/codec
47+
- Move: bson, serialization parts of type
48+
- Update imports
49+
- Verify and commit
50+
51+
... and so on for each package group.
52+
53+
**Advantages**:
54+
- Can be done incrementally over multiple sessions
55+
- Each phase can be tested independently
56+
- Easier to rollback if issues arise
57+
- Can pause and resume between phases
58+
59+
### Option B: Automated Scripting
60+
Create automated scripts to handle the bulk of the work:
61+
62+
1. Script to move files maintaining structure
63+
2. Script to update import statements using AST transformation
64+
3. Script to update configuration files
65+
4. Manual verification and testing
66+
67+
**Time**: 10-15 hours (script development + execution + fixes)
68+
69+
**Advantages**:
70+
- Faster overall
71+
- More consistent
72+
- Repeatable if needed
73+
74+
**Disadvantages**:
75+
- Risk of script bugs affecting entire codebase
76+
- Harder to debug issues
77+
- Requires significant upfront scripting effort
78+
79+
### Option C: Manual, All-at-Once
80+
Complete the entire restructuring in one go:
81+
82+
**Time**: 30-40 hours of continuous work
83+
84+
**Disadvantages**:
85+
- Very high risk
86+
- Difficult to test incrementally
87+
- Large, risky commit
88+
- Hard to rollback
89+
- Cannot be done in single AI session
90+
91+
## My Recommendation
92+
93+
I recommend **Option A: Incremental Migration**, starting with @7b/runtime as it has the fewest dependencies and is the foundation package.
94+
95+
## Next Steps
96+
97+
Please confirm which approach you'd like me to take:
98+
99+
1. **Start with @7b/runtime** (incremental, 4-6 hours)
100+
2. **Create automation scripts** (10-15 hours total)
101+
3. **Something else** (please specify)
102+
103+
Additionally, please confirm:
104+
- Should I maintain the same directory structure within each new package (e.g., @7b/runtime/src/core/, @7b/runtime/src/bench/)?
105+
- Should old packages be deleted or kept temporarily for reference?
106+
- Are there any critical integration tests I should run after each phase?
107+
108+
## Important Notes
109+
110+
- This restructuring will create **massive PRs** (potentially 1000+ files changed)
111+
- The codebase will be **unbuildable during the migration** unless we use feature branches
112+
- **All developers** will need to stop work during migration or coordinate carefully
113+
- Consider **creating a migration branch** separate from main development
114+
115+
---
116+
117+
**Current Status**: Awaiting direction on approach and confirmation to proceed.

0 commit comments

Comments
 (0)