Phase 1 Module Migration Strategy
Documentation for Plans
ποΈ PHASE 1: Module Migration Strategy
Date: October 31, 2025
Status: π― IN PROGRESS
Purpose: Transform all platform modules from manifest-only to Golden Template pattern
π― Mission
Transform 6 core platform modules from simple manifest objects into fully-fledged BrowserModuleContract classes with:
- Rich parameter metadata (
ModuleParameterBuilder) - Complete lifecycle management
- AI-trainable structure
- Observable-based async patterns
- Production-ready quality
π Discovery Results
Modules Found
| # | Module | File | LOC | Priority | Status |
|---|---|---|---|---|---|
| 0 | User Management | modules/user-management/src/lib/user-management.module.ts |
~480 | β TEMPLATE | β COMPLETE |
| 1 | Singularity | libs/singularity-lib/src/lib/singularity.manifest.ts |
~60 | π₯ CRITICAL | π Pending |
| 2 | Space Map | libs/space-map-lib/src/lib/space-map.manifest.ts |
~155 | π₯ CRITICAL | π Pending |
| 3 | Editor | libs/editor-web-lib/src/lib/editor.manifest.ts |
~160 | π₯ CRITICAL | π Pending |
| 4 | Modularity | libs/modularity-lib/src/lib/modularity.manifest.ts |
~? | π‘ Important | π Pending |
| 5 | Launch Station | libs/launch-station-lib/src/lib/launch-station.manifest.ts |
~? | π‘ Important | π Pending |
| 6 | Widgets Manager | libs/widgets/src/lib/widgets-manager/widgets-manager.manifest.ts |
~? | π‘ Important | π Pending |
Total Modules: 7 (1 complete, 6 to migrate)
π― Migration Strategy
Phase 1A: Critical Tools (Top Priority)
Goal: Get the 3 most important tools working with Golden Template
Modules:
- β¨ Singularity - Logic Builder + Flow Composer (visual logic)
- πΊοΈ Space Map - Universe organization
- π¨ Editor - Page/World builder
Why Critical:
- These are the CORE building blocks
- Users interact with these 80% of the time
- Other tools depend on these
Timeline: 2-3 days
Phase 1B: Supporting Tools
Goal: Complete the ecosystem
Modules: 4. π§© Modularity - Module creation/packaging 5. π Launch Station - Universe deployment 6. π§± Widgets Manager - Widget library
Why Important:
- Enable complete workflow
- Round out the platform
- Less frequently used but essential
Timeline: 1-2 days
π Migration Checklist (Per Module)
For EACH module, follow this checklist:
Pre-Migration
- Read existing
.manifest.tsfile - Identify public actions
- Identify routes
- Identify embeddable components
- List dependencies (storage, theme, etc.)
Migration Steps
- Create new
.module.tsfile (alongside manifest) - Add
@ModuleDecoratorwith id, version, name - Add
@Injectable({ providedIn: 'root' }) - Implement
BrowserModuleContract - Convert manifest object to inline
ModuleManifest - Transform public actions to use
ModuleParameterBuilder - Add rich metadata (labels, examples, validation)
- Implement lifecycle methods (configure, initialize, start, stop, destroy)
- Create public API methods (called by action handlers)
- Add comprehensive documentation with emojis
- Update barrel exports (
index.ts) - Update
apps/gograb-space/src/app/core/modules.tsto import module CLASS - Verify zero linter errors
- Test in browser
Post-Migration
- Document migration in progress tracker
- Update module-specific docs if needed
- Mark as complete in checklist
π¨ Transformation Pattern
Before (Manifest-Only)
// singularity.manifest.ts
export const SingularityManifest: ModuleManifest = {
id: 'singularity',
name: 'Singularity',
version: '1.0.0',
routes: [...],
publicActions: {
createLogicFlow: async (name: string) => {
// Just a function, no metadata
return { id: Date.now(), name };
}
}
};
After (Golden Template)
// singularity.module.ts
@ModuleDecorator({
id: 'singularity',
version: '1.0.0',
name: 'Singularity'
})
@Injectable({ providedIn: 'root' })
export class SingularityModule implements BrowserModuleContract {
readonly manifest: ModuleManifest = {
id: 'singularity',
version: '1.0.0',
name: 'Singularity',
description: 'Visual logic builder with AI-powered flows',
author: 'GoGrab Space Team',
category: 'core-tool',
publicActions: [
{
id: 'logic:create',
displayName: 'Create Logic Flow',
description: 'Create a new visual logic flow with blocks and connections',
category: 'crud',
parameters: [
ModuleParameterBuilder.string('name')
.required('Flow name is required')
.minLength(2, 'Name must be at least 2 characters')
.maxLength(100, 'Name must be less than 100 characters')
.label('Flow Name')
.placeholder('Enter flow name')
.example('User Registration Flow')
.build(),
ModuleParameterBuilder.string('description')
.label('Description')
.placeholder('Describe what this flow does')
.example('Handles user registration with validation')
.build(),
ModuleParameterBuilder.string('type')
.enum(['logic', 'database', 'api', 'ui'])
.defaultValue('logic')
.label('Flow Type')
.build()
],
handler: (params) => of(this.createLogicFlow(params))
}
],
routes: [...],
embeddableComponents: [...],
configuration: {...},
tags: ['logic', 'visual-programming', 'ai', 'flows', 'core-tool']
};
private storage?: any;
private isInitialized = false;
configure<T>(config: T): Observable<void> {
console.log('ποΈ [Lambo Builder - Singularity] Configuring module');
this.storage = (config as any).storage;
return of(void 0);
}
initialize(): Observable<void> {
console.log('π [Lambo Builder - Singularity] Initializing module');
this.isInitialized = true;
return of(void 0);
}
start(): Observable<void> {
console.log('βΆοΈ [Lambo Builder - Singularity] Starting module');
return of(void 0);
}
stop(): Observable<void> {
console.log('βΈοΈ [Lambo Builder - Singularity] Stopping module');
return of(void 0);
}
destroy(): Observable<void> {
console.log('ποΈ [Lambo Builder - Singularity] Destroying module');
this.storage = undefined;
this.isInitialized = false;
return of(void 0);
}
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
// π― PUBLIC API METHODS
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
/**
* π¨ CREATE LOGIC FLOW
* Creates a new visual logic flow with validation
*/
async createLogicFlow(params: any): Promise<any> {
const flowId = `flow-${Date.now()}`;
const flow = {
id: flowId,
name: params.name,
description: params.description || '',
type: params.type || 'logic',
blocks: [],
connections: [],
createdAt: new Date().toISOString(),
updatedAt: new Date().toISOString()
};
if (this.storage) {
await this.storage.put(`flows/${flowId}`, flow);
}
console.log('β
[Lambo Builder] Logic flow created:', flowId);
return flow;
}
}
π― Key Improvements
1. Rich Parameter Metadata
Before:
createLogicFlow: async (name: string) => { /* ... */ }
After:
parameters: [
ModuleParameterBuilder.string('name')
.required('Flow name is required')
.minLength(2)
.label('Flow Name')
.example('User Registration Flow')
.build()
]
Benefits:
- β AI understands what the parameter is
- β Auto-generated UI with validation
- β Examples for users
- β Type-safe
2. Observable-Based Lifecycle
Before: No lifecycle
After:
configure(), initialize(), start(), stop(), destroy()
Benefits:
- β Controlled initialization
- β Graceful cleanup
- β Consistent async handling
- β Testable lifecycle
3. Categorization & Discovery
Before: Just a name
After:
tags: ['logic', 'visual-programming', 'ai', 'flows', 'core-tool'],
category: 'core-tool'
Benefits:
- β Easy discovery
- β Filtering by category
- β Search functionality
π¦ Migration Order & Timeline
Week 1: Critical Tools (Phase 1A)
Day 1-2: Singularity
- Transform
singularity.manifest.tsβsingularity.module.ts - Estimated effort: 4-6 hours
- Key actions:
createLogicFlow,createFlowComposer,executeFlow
Day 2-3: Space Map
- Transform
space-map.manifest.tsβspace-map.module.ts - Estimated effort: 4-6 hours
- Key actions:
createUniverse,createGalaxy,createWorld,navigate
Day 3-4: Editor
- Transform
editor.manifest.tsβeditor.module.ts - Estimated effort: 4-6 hours
- Key actions:
openPage,savePage,addWidget,exportPage
Week 2: Supporting Tools (Phase 1B)
Day 5: Modularity
- Transform
modularity.manifest.tsβmodularity.module.ts - Estimated effort: 3-4 hours
Day 5-6: Launch Station + Widgets Manager
- Transform both manifests β modules
- Estimated effort: 4-5 hours
Day 7: Verification & Documentation
- Test all modules
- Update documentation
- Final checks
π Success Metrics
Per Module
- Zero linter errors
- All routes work
- All public actions callable
- Lifecycle methods implemented
- Documentation complete
- Browser testing passed
Overall Phase 1
- All 6 modules migrated
- All core tools working 100%
- AI can understand all modules
- Golden Template pattern consistent
- Documentation updated
- Ready for Phase 2 (Canvas Excellence)
π§ Technical Notes
Import Updates Required
Before (apps/gograb-space/src/app/core/modules.ts):
import { SingularityManifest } from '@libs-structural/singularity-lib';
const platformModules = [SingularityManifest, ...];
After:
import { SingularityModule } from '@libs-structural/singularity-lib';
// Module is auto-registered via @ModuleDecorator
// No need for manual array, just import to prevent tree-shaking
void SingularityModule;
Barrel Export Updates
Each library's index.ts needs:
// Export both manifest (for backward compat) and module
export * from './lib/singularity.manifest';
export * from './lib/singularity.module';
π Expected Outcome
After Phase 1 completion:
- All 6 platform modules will be Golden Template compliant
- AI training data will be perfect and consistent
- Module generation can begin (AI learns from templates)
- Routes will all work flawlessly
- Public actions will be AI-callable with rich metadata
- Foundation will be rock-solid for Phase 2
π LET'S BUILD!
Next Step: Start with Singularity (the most complex and important tool)
Philosophy:
"One module at a time, following the Golden Template, with zero compromises on quality."
STATUS: π― READY TO START MIGRATION!
FIRST TARGET: π Singularity Module
EXPECTED COMPLETION: November 7, 2025