@ai-coders/context 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -23
- package/dist/generators/agents/agentConfig.d.ts.map +1 -1
- package/dist/generators/agents/agentConfig.js +42 -0
- package/dist/generators/agents/agentConfig.js.map +1 -1
- package/dist/generators/agents/agentGenerator.d.ts +0 -1
- package/dist/generators/agents/agentGenerator.d.ts.map +1 -1
- package/dist/generators/agents/agentGenerator.js +7 -47
- package/dist/generators/agents/agentGenerator.js.map +1 -1
- package/dist/generators/agents/agentTypes.d.ts +1 -1
- package/dist/generators/agents/agentTypes.d.ts.map +1 -1
- package/dist/generators/agents/agentTypes.js +4 -1
- package/dist/generators/agents/agentTypes.js.map +1 -1
- package/dist/generators/agents/templates/indexTemplate.d.ts.map +1 -1
- package/dist/generators/agents/templates/indexTemplate.js +2 -1
- package/dist/generators/agents/templates/indexTemplate.js.map +1 -1
- package/dist/generators/agents/templates/playbookTemplate.d.ts.map +1 -1
- package/dist/generators/agents/templates/playbookTemplate.js +39 -3
- package/dist/generators/agents/templates/playbookTemplate.js.map +1 -1
- package/dist/generators/documentation/documentationGenerator.d.ts +3 -1
- package/dist/generators/documentation/documentationGenerator.d.ts.map +1 -1
- package/dist/generators/documentation/documentationGenerator.js +88 -15
- package/dist/generators/documentation/documentationGenerator.js.map +1 -1
- package/dist/generators/documentation/guideRegistry.js +8 -8
- package/dist/generators/documentation/guideRegistry.js.map +1 -1
- package/dist/generators/documentation/templates/apiReferenceTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/apiReferenceTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/apiReferenceTemplate.js +490 -0
- package/dist/generators/documentation/templates/apiReferenceTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/architectureTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/architectureTemplate.js +27 -27
- package/dist/generators/documentation/templates/architectureTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/common.js +2 -2
- package/dist/generators/documentation/templates/common.js.map +1 -1
- package/dist/generators/documentation/templates/dataFlowTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/dataFlowTemplate.js +5 -20
- package/dist/generators/documentation/templates/dataFlowTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.js +5 -20
- package/dist/generators/documentation/templates/developmentWorkflowTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/glossaryTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/glossaryTemplate.js +9 -23
- package/dist/generators/documentation/templates/glossaryTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/index.d.ts +4 -0
- package/dist/generators/documentation/templates/index.d.ts.map +1 -1
- package/dist/generators/documentation/templates/index.js +9 -1
- package/dist/generators/documentation/templates/index.js.map +1 -1
- package/dist/generators/documentation/templates/indexTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/indexTemplate.js +5 -19
- package/dist/generators/documentation/templates/indexTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/migrationTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/migrationTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/migrationTemplate.js +422 -0
- package/dist/generators/documentation/templates/migrationTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/onboardingTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/onboardingTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/onboardingTemplate.js +431 -0
- package/dist/generators/documentation/templates/onboardingTemplate.js.map +1 -0
- package/dist/generators/documentation/templates/projectOverviewTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/projectOverviewTemplate.js +22 -25
- package/dist/generators/documentation/templates/projectOverviewTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/securityTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/securityTemplate.js +5 -19
- package/dist/generators/documentation/templates/securityTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/testingTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/testingTemplate.js +5 -19
- package/dist/generators/documentation/templates/testingTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/toolingTemplate.d.ts.map +1 -1
- package/dist/generators/documentation/templates/toolingTemplate.js +6 -20
- package/dist/generators/documentation/templates/toolingTemplate.js.map +1 -1
- package/dist/generators/documentation/templates/troubleshootingTemplate.d.ts +2 -0
- package/dist/generators/documentation/templates/troubleshootingTemplate.d.ts.map +1 -0
- package/dist/generators/documentation/templates/troubleshootingTemplate.js +292 -0
- package/dist/generators/documentation/templates/troubleshootingTemplate.js.map +1 -0
- package/dist/generators/plans/templates/indexTemplate.d.ts.map +1 -1
- package/dist/generators/plans/templates/indexTemplate.js +3 -2
- package/dist/generators/plans/templates/indexTemplate.js.map +1 -1
- package/dist/generators/plans/templates/planTemplate.d.ts.map +1 -1
- package/dist/generators/plans/templates/planTemplate.js +74 -3
- package/dist/generators/plans/templates/planTemplate.js.map +1 -1
- package/dist/generators/shared/generatorUtils.d.ts +1 -1
- package/dist/generators/shared/generatorUtils.d.ts.map +1 -1
- package/dist/generators/shared/generatorUtils.js +1 -1
- package/dist/generators/shared/generatorUtils.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -1000
- package/dist/index.js.map +1 -1
- package/dist/prompts/defaults.d.ts +2 -2
- package/dist/prompts/defaults.d.ts.map +1 -1
- package/dist/prompts/defaults.js +11 -11
- package/dist/services/baseLLMClient.d.ts +3 -3
- package/dist/services/baseLLMClient.d.ts.map +1 -1
- package/dist/services/baseLLMClient.js +44 -5
- package/dist/services/baseLLMClient.js.map +1 -1
- package/dist/services/fill/fillService.d.ts +0 -4
- package/dist/services/fill/fillService.d.ts.map +1 -1
- package/dist/services/fill/fillService.js +6 -54
- package/dist/services/fill/fillService.js.map +1 -1
- package/dist/services/init/initService.d.ts +2 -2
- package/dist/services/init/initService.d.ts.map +1 -1
- package/dist/services/init/initService.js +45 -15
- package/dist/services/init/initService.js.map +1 -1
- package/dist/services/llmClientFactory.d.ts +2 -8
- package/dist/services/llmClientFactory.d.ts.map +1 -1
- package/dist/services/llmClientFactory.js +10 -96
- package/dist/services/llmClientFactory.js.map +1 -1
- package/dist/services/openRouterClient.d.ts +0 -3
- package/dist/services/openRouterClient.d.ts.map +1 -1
- package/dist/services/openRouterClient.js +2 -49
- package/dist/services/openRouterClient.js.map +1 -1
- package/dist/services/plan/planService.d.ts +2 -4
- package/dist/services/plan/planService.d.ts.map +1 -1
- package/dist/services/plan/planService.js +3 -12
- package/dist/services/plan/planService.js.map +1 -1
- package/dist/services/shared/llmConfig.d.ts.map +1 -1
- package/dist/services/shared/llmConfig.js +11 -53
- package/dist/services/shared/llmConfig.js.map +1 -1
- package/dist/types.d.ts +7 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/fileMapper.d.ts +1 -1
- package/dist/utils/fileMapper.d.ts.map +1 -1
- package/dist/utils/fileMapper.js +40 -19
- package/dist/utils/fileMapper.js.map +1 -1
- package/dist/utils/i18n.d.ts +11 -32
- package/dist/utils/i18n.d.ts.map +1 -1
- package/dist/utils/i18n.js +22 -64
- package/dist/utils/i18n.js.map +1 -1
- package/package.json +9 -12
- package/prompts/update_plan_prompt.md +4 -5
- package/prompts/update_scaffold_prompt.md +7 -8
- package/dist/generators/agents/contextUtils.d.ts +0 -8
- package/dist/generators/agents/contextUtils.d.ts.map +0 -1
- package/dist/generators/agents/contextUtils.js +0 -15
- package/dist/generators/agents/contextUtils.js.map +0 -1
- package/dist/generators/agents/promptFormatter.d.ts +0 -9
- package/dist/generators/agents/promptFormatter.d.ts.map +0 -1
- package/dist/generators/agents/promptFormatter.js +0 -84
- package/dist/generators/agents/promptFormatter.js.map +0 -1
- package/dist/generators/analyzers/codebaseAnalyzer.d.ts +0 -45
- package/dist/generators/analyzers/codebaseAnalyzer.d.ts.map +0 -1
- package/dist/generators/analyzers/codebaseAnalyzer.js +0 -293
- package/dist/generators/analyzers/codebaseAnalyzer.js.map +0 -1
- package/dist/generators/analyzers/index.d.ts +0 -3
- package/dist/generators/analyzers/index.d.ts.map +0 -1
- package/dist/generators/analyzers/index.js +0 -6
- package/dist/generators/analyzers/index.js.map +0 -1
- package/dist/generators/documentation/documentationTemplates.d.ts +0 -21
- package/dist/generators/documentation/documentationTemplates.d.ts.map +0 -1
- package/dist/generators/documentation/documentationTemplates.js +0 -359
- package/dist/generators/documentation/documentationTemplates.js.map +0 -1
- package/dist/generators/documentation/documentationTypes.d.ts +0 -11
- package/dist/generators/documentation/documentationTypes.d.ts.map +0 -1
- package/dist/generators/documentation/documentationTypes.js +0 -22
- package/dist/generators/documentation/documentationTypes.js.map +0 -1
- package/dist/generators/documentation/documentationUtils.d.ts +0 -7
- package/dist/generators/documentation/documentationUtils.d.ts.map +0 -1
- package/dist/generators/documentation/documentationUtils.js +0 -28
- package/dist/generators/documentation/documentationUtils.js.map +0 -1
- package/dist/generators/documentation/incrementalDocumentationGenerator.d.ts +0 -33
- package/dist/generators/documentation/incrementalDocumentationGenerator.d.ts.map +0 -1
- package/dist/generators/documentation/incrementalDocumentationGenerator.js +0 -400
- package/dist/generators/documentation/incrementalDocumentationGenerator.js.map +0 -1
- package/dist/generators/documentation/templates.d.ts +0 -31
- package/dist/generators/documentation/templates.d.ts.map +0 -1
- package/dist/generators/documentation/templates.js +0 -566
- package/dist/generators/documentation/templates.js.map +0 -1
- package/dist/generators/guidelines/agentIntegration.d.ts +0 -43
- package/dist/generators/guidelines/agentIntegration.d.ts.map +0 -1
- package/dist/generators/guidelines/agentIntegration.js +0 -157
- package/dist/generators/guidelines/agentIntegration.js.map +0 -1
- package/dist/generators/guidelines/guidelineTypes.d.ts +0 -40
- package/dist/generators/guidelines/guidelineTypes.d.ts.map +0 -1
- package/dist/generators/guidelines/guidelineTypes.js +0 -144
- package/dist/generators/guidelines/guidelineTypes.js.map +0 -1
- package/dist/generators/guidelines/guidelinesAnalyzer.d.ts +0 -30
- package/dist/generators/guidelines/guidelinesAnalyzer.d.ts.map +0 -1
- package/dist/generators/guidelines/guidelinesAnalyzer.js +0 -263
- package/dist/generators/guidelines/guidelinesAnalyzer.js.map +0 -1
- package/dist/generators/guidelines/guidelinesGenerator.d.ts +0 -30
- package/dist/generators/guidelines/guidelinesGenerator.d.ts.map +0 -1
- package/dist/generators/guidelines/guidelinesGenerator.js +0 -249
- package/dist/generators/guidelines/guidelinesGenerator.js.map +0 -1
- package/dist/generators/guidelines/guidelinesTemplates.d.ts +0 -23
- package/dist/generators/guidelines/guidelinesTemplates.d.ts.map +0 -1
- package/dist/generators/guidelines/guidelinesTemplates.js +0 -304
- package/dist/generators/guidelines/guidelinesTemplates.js.map +0 -1
- package/dist/generators/guidelines/index.d.ts +0 -6
- package/dist/generators/guidelines/index.d.ts.map +0 -1
- package/dist/generators/guidelines/index.js +0 -16
- package/dist/generators/guidelines/index.js.map +0 -1
- package/dist/generators/moduleGrouper.d.ts +0 -14
- package/dist/generators/moduleGrouper.d.ts.map +0 -1
- package/dist/generators/moduleGrouper.js +0 -82
- package/dist/generators/moduleGrouper.js.map +0 -1
- package/dist/generators/projectAnalyzer.d.ts +0 -14
- package/dist/generators/projectAnalyzer.d.ts.map +0 -1
- package/dist/generators/projectAnalyzer.js +0 -217
- package/dist/generators/projectAnalyzer.js.map +0 -1
- package/dist/services/changeAnalyzer.d.ts +0 -44
- package/dist/services/changeAnalyzer.d.ts.map +0 -1
- package/dist/services/changeAnalyzer.js +0 -344
- package/dist/services/changeAnalyzer.js.map +0 -1
- package/dist/utils/interactiveMode.d.ts +0 -21
- package/dist/utils/interactiveMode.d.ts.map +0 -1
- package/dist/utils/interactiveMode.js +0 -737
- package/dist/utils/interactiveMode.js.map +0 -1
- package/dist/utils/tokenEstimator.d.ts +0 -28
- package/dist/utils/tokenEstimator.d.ts.map +0 -1
- package/dist/utils/tokenEstimator.js +0 -134
- package/dist/utils/tokenEstimator.js.map +0 -1
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renderMigration = renderMigration;
|
|
4
|
+
function renderMigration() {
|
|
5
|
+
return `
|
|
6
|
+
<!-- agent-update:start:migration-guide -->
|
|
7
|
+
# Migration Guide
|
|
8
|
+
|
|
9
|
+
Complete guide for upgrading between versions, handling breaking changes, and migrating data.
|
|
10
|
+
|
|
11
|
+
## Current Version
|
|
12
|
+
**Latest Stable:** TODO: Add current version (e.g., v2.5.0)
|
|
13
|
+
**Release Date:** TODO: Add date
|
|
14
|
+
|
|
15
|
+
## Version Support Policy
|
|
16
|
+
- **Current major version:** Full support with security patches and bug fixes
|
|
17
|
+
- **Previous major version:** Security patches only for 12 months after new major release
|
|
18
|
+
- **Older versions:** No longer supported, upgrade strongly recommended
|
|
19
|
+
|
|
20
|
+
## Before You Migrate
|
|
21
|
+
### Pre-Migration Checklist
|
|
22
|
+
- [ ] **Backup all data** - Create complete backup of database and file storage
|
|
23
|
+
- [ ] **Review changelog** - Read release notes for the target version
|
|
24
|
+
- [ ] **Test in staging** - Run full migration in non-production environment first
|
|
25
|
+
- [ ] **Check dependencies** - Verify all dependencies are compatible
|
|
26
|
+
- [ ] **Notify stakeholders** - Communicate migration timeline and potential downtime
|
|
27
|
+
- [ ] **Plan rollback** - Prepare rollback procedure in case of issues
|
|
28
|
+
- [ ] **Schedule maintenance window** - Plan for adequate downtime if needed
|
|
29
|
+
|
|
30
|
+
### System Requirements
|
|
31
|
+
Before upgrading, verify your environment meets the new requirements:
|
|
32
|
+
- **Node.js version:** TODO: e.g., >= 18.0.0
|
|
33
|
+
- **Database version:** TODO: e.g., PostgreSQL >= 14.0
|
|
34
|
+
- **Operating System:** TODO: List supported OS versions
|
|
35
|
+
- **Memory:** TODO: Minimum RAM requirements
|
|
36
|
+
- **Disk space:** TODO: Required free space
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## Migration Paths
|
|
41
|
+
|
|
42
|
+
### Upgrading to v3.0 (Latest)
|
|
43
|
+
|
|
44
|
+
#### From v2.x → v3.0
|
|
45
|
+
|
|
46
|
+
**Overview:**
|
|
47
|
+
Major version upgrade with breaking changes. Migration estimated at 2-4 hours depending on data volume.
|
|
48
|
+
|
|
49
|
+
**Breaking Changes:**
|
|
50
|
+
1. **API endpoint restructuring**
|
|
51
|
+
- Old: \`/api/users/:id\`
|
|
52
|
+
- New: \`/api/v3/users/:id\`
|
|
53
|
+
- Migration: Update all API client code to use new base path
|
|
54
|
+
|
|
55
|
+
2. **Authentication changes**
|
|
56
|
+
- JWT token format changed
|
|
57
|
+
- Users must re-authenticate after upgrade
|
|
58
|
+
- Migration: Implement token migration middleware or force re-login
|
|
59
|
+
|
|
60
|
+
3. **Database schema changes**
|
|
61
|
+
- \`users\` table: Added \`email_verified_at\` column
|
|
62
|
+
- \`sessions\` table: Renamed to \`user_sessions\`
|
|
63
|
+
- Migration: Automatic via migration scripts
|
|
64
|
+
|
|
65
|
+
4. **Configuration format**
|
|
66
|
+
- Environment variables renamed:
|
|
67
|
+
- \`DB_HOST\` → \`DATABASE_URL\`
|
|
68
|
+
- \`REDIS_HOST\` → \`CACHE_URL\`
|
|
69
|
+
- Migration: Update .env file with new variable names
|
|
70
|
+
|
|
71
|
+
**Step-by-Step Migration:**
|
|
72
|
+
|
|
73
|
+
1. **Create backup**
|
|
74
|
+
\`\`\`bash
|
|
75
|
+
# Database backup
|
|
76
|
+
pg_dump -U postgres dbname > backup_v2.sql
|
|
77
|
+
|
|
78
|
+
# Application backup
|
|
79
|
+
tar -czf app_v2_backup.tar.gz /path/to/app
|
|
80
|
+
\`\`\`
|
|
81
|
+
|
|
82
|
+
2. **Update dependencies**
|
|
83
|
+
\`\`\`bash
|
|
84
|
+
# Update package.json to v3.0
|
|
85
|
+
npm install app-name@3.0.0
|
|
86
|
+
|
|
87
|
+
# Install updated dependencies
|
|
88
|
+
npm install
|
|
89
|
+
\`\`\`
|
|
90
|
+
|
|
91
|
+
3. **Update configuration**
|
|
92
|
+
\`\`\`bash
|
|
93
|
+
# Update environment variables
|
|
94
|
+
# Rename variables in .env file
|
|
95
|
+
DATABASE_URL=postgresql://user:pass@localhost:5432/db
|
|
96
|
+
CACHE_URL=redis://localhost:6379
|
|
97
|
+
\`\`\`
|
|
98
|
+
|
|
99
|
+
4. **Run database migrations**
|
|
100
|
+
\`\`\`bash
|
|
101
|
+
# Dry run to preview changes
|
|
102
|
+
npm run migrate:preview
|
|
103
|
+
|
|
104
|
+
# Execute migrations
|
|
105
|
+
npm run migrate:up
|
|
106
|
+
|
|
107
|
+
# Verify migration success
|
|
108
|
+
npm run migrate:status
|
|
109
|
+
\`\`\`
|
|
110
|
+
|
|
111
|
+
5. **Update application code**
|
|
112
|
+
- Update API client base URLs
|
|
113
|
+
- Replace deprecated function calls
|
|
114
|
+
- Update import paths if modules were reorganized
|
|
115
|
+
|
|
116
|
+
6. **Test the application**
|
|
117
|
+
\`\`\`bash
|
|
118
|
+
# Run full test suite
|
|
119
|
+
npm test
|
|
120
|
+
|
|
121
|
+
# Start application
|
|
122
|
+
npm start
|
|
123
|
+
|
|
124
|
+
# Verify critical functionality
|
|
125
|
+
# - User authentication
|
|
126
|
+
# - Core API endpoints
|
|
127
|
+
# - Database operations
|
|
128
|
+
\`\`\`
|
|
129
|
+
|
|
130
|
+
7. **Monitor after deployment**
|
|
131
|
+
- Check error logs for unexpected issues
|
|
132
|
+
- Monitor performance metrics
|
|
133
|
+
- Verify data integrity
|
|
134
|
+
|
|
135
|
+
**Rollback Procedure (if needed):**
|
|
136
|
+
\`\`\`bash
|
|
137
|
+
# Stop application
|
|
138
|
+
npm stop
|
|
139
|
+
|
|
140
|
+
# Restore database backup
|
|
141
|
+
psql -U postgres dbname < backup_v2.sql
|
|
142
|
+
|
|
143
|
+
# Revert to previous version
|
|
144
|
+
npm install app-name@2.x.x
|
|
145
|
+
|
|
146
|
+
# Restore old configuration
|
|
147
|
+
# Revert environment variables to v2 format
|
|
148
|
+
|
|
149
|
+
# Restart application
|
|
150
|
+
npm start
|
|
151
|
+
\`\`\`
|
|
152
|
+
|
|
153
|
+
---
|
|
154
|
+
|
|
155
|
+
#### From v1.x → v3.0
|
|
156
|
+
|
|
157
|
+
**Important:** Direct upgrade from v1.x to v3.0 is not supported. Please upgrade incrementally:
|
|
158
|
+
1. v1.x → v2.0
|
|
159
|
+
2. v2.0 → v3.0
|
|
160
|
+
|
|
161
|
+
Refer to the sections below for each migration step.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
### Upgrading to v2.0
|
|
166
|
+
|
|
167
|
+
#### From v1.x → v2.0
|
|
168
|
+
|
|
169
|
+
**Breaking Changes:**
|
|
170
|
+
1. **Database ORM change**
|
|
171
|
+
- Migrated from custom ORM to Prisma
|
|
172
|
+
- Requires regenerating database schema
|
|
173
|
+
|
|
174
|
+
2. **Configuration file format**
|
|
175
|
+
- Moved from JSON config to environment variables
|
|
176
|
+
- Migration: Convert config.json values to .env
|
|
177
|
+
|
|
178
|
+
3. **API response format**
|
|
179
|
+
- Standardized error response structure
|
|
180
|
+
- Migration: Update API client error handling
|
|
181
|
+
|
|
182
|
+
**Step-by-Step Migration:**
|
|
183
|
+
|
|
184
|
+
1. **Backup and preparation**
|
|
185
|
+
\`\`\`bash
|
|
186
|
+
# Create backup
|
|
187
|
+
pg_dump -U postgres dbname > backup_v1.sql
|
|
188
|
+
|
|
189
|
+
# Install v2.0
|
|
190
|
+
npm install app-name@2.0.0
|
|
191
|
+
\`\`\`
|
|
192
|
+
|
|
193
|
+
2. **Configure environment**
|
|
194
|
+
\`\`\`bash
|
|
195
|
+
# Convert config.json to .env
|
|
196
|
+
# Use provided migration script
|
|
197
|
+
node scripts/config-to-env.js config.json > .env
|
|
198
|
+
\`\`\`
|
|
199
|
+
|
|
200
|
+
3. **Migrate database schema**
|
|
201
|
+
\`\`\`bash
|
|
202
|
+
# Generate Prisma client
|
|
203
|
+
npx prisma generate
|
|
204
|
+
|
|
205
|
+
# Run migrations
|
|
206
|
+
npx prisma migrate deploy
|
|
207
|
+
\`\`\`
|
|
208
|
+
|
|
209
|
+
4. **Update code**
|
|
210
|
+
- Replace old ORM queries with Prisma queries
|
|
211
|
+
- Update error handling for new response format
|
|
212
|
+
|
|
213
|
+
5. **Test and deploy**
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Data Migration
|
|
218
|
+
|
|
219
|
+
### Database Migrations
|
|
220
|
+
|
|
221
|
+
#### Running Migrations
|
|
222
|
+
\`\`\`bash
|
|
223
|
+
# Check current migration status
|
|
224
|
+
npm run migrate:status
|
|
225
|
+
|
|
226
|
+
# Preview migrations without applying
|
|
227
|
+
npm run migrate:preview
|
|
228
|
+
|
|
229
|
+
# Apply all pending migrations
|
|
230
|
+
npm run migrate:up
|
|
231
|
+
|
|
232
|
+
# Rollback last migration
|
|
233
|
+
npm run migrate:down
|
|
234
|
+
|
|
235
|
+
# Rollback to specific version
|
|
236
|
+
npm run migrate:to 20240115_initial
|
|
237
|
+
\`\`\`
|
|
238
|
+
|
|
239
|
+
#### Creating Custom Migrations
|
|
240
|
+
\`\`\`bash
|
|
241
|
+
# Generate new migration file
|
|
242
|
+
npm run migrate:create add_user_roles
|
|
243
|
+
|
|
244
|
+
# Edit generated file at migrations/YYYYMMDD_add_user_roles.js
|
|
245
|
+
# Implement up() and down() functions
|
|
246
|
+
\`\`\`
|
|
247
|
+
|
|
248
|
+
**Example Migration:**
|
|
249
|
+
\`\`\`javascript
|
|
250
|
+
// migrations/20240115_add_user_roles.js
|
|
251
|
+
exports.up = async (db) => {
|
|
252
|
+
await db.schema.createTable('user_roles', (table) => {
|
|
253
|
+
table.increments('id').primary();
|
|
254
|
+
table.integer('user_id').references('users.id');
|
|
255
|
+
table.string('role').notNullable();
|
|
256
|
+
table.timestamps();
|
|
257
|
+
});
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
exports.down = async (db) => {
|
|
261
|
+
await db.schema.dropTable('user_roles');
|
|
262
|
+
};
|
|
263
|
+
\`\`\`
|
|
264
|
+
|
|
265
|
+
### Data Transformation
|
|
266
|
+
|
|
267
|
+
#### Large Dataset Migration
|
|
268
|
+
For large datasets that can't be migrated in a single transaction:
|
|
269
|
+
|
|
270
|
+
\`\`\`bash
|
|
271
|
+
# Use batch migration script
|
|
272
|
+
node scripts/migrate-data-batch.js \\
|
|
273
|
+
--source=old_table \\
|
|
274
|
+
--target=new_table \\
|
|
275
|
+
--batch-size=1000 \\
|
|
276
|
+
--delay=100
|
|
277
|
+
|
|
278
|
+
# Monitor progress
|
|
279
|
+
tail -f logs/migration.log
|
|
280
|
+
\`\`\`
|
|
281
|
+
|
|
282
|
+
#### Zero-Downtime Migration
|
|
283
|
+
For production migrations with no downtime:
|
|
284
|
+
|
|
285
|
+
1. **Dual-write phase**
|
|
286
|
+
- Write to both old and new schema
|
|
287
|
+
- Read from old schema
|
|
288
|
+
|
|
289
|
+
2. **Backfill phase**
|
|
290
|
+
- Migrate historical data in batches
|
|
291
|
+
- Verify data integrity
|
|
292
|
+
|
|
293
|
+
3. **Dual-read phase**
|
|
294
|
+
- Continue writing to both
|
|
295
|
+
- Switch reads to new schema
|
|
296
|
+
- Monitor for issues
|
|
297
|
+
|
|
298
|
+
4. **Cleanup phase**
|
|
299
|
+
- Stop writing to old schema
|
|
300
|
+
- Archive or drop old tables
|
|
301
|
+
|
|
302
|
+
---
|
|
303
|
+
|
|
304
|
+
## Deprecation Timeline
|
|
305
|
+
|
|
306
|
+
### Currently Deprecated (Remove in next major version)
|
|
307
|
+
- **Function:** \`oldApiCall()\` → Use \`newApiCall()\` instead
|
|
308
|
+
- **Endpoint:** \`/api/legacy/*\` → Use \`/api/v3/*\` instead
|
|
309
|
+
- **Configuration:** \`LEGACY_MODE=true\` → No longer needed
|
|
310
|
+
|
|
311
|
+
### Deprecated in v2.0 (Removed in v3.0)
|
|
312
|
+
- Legacy authentication system
|
|
313
|
+
- Old database ORM
|
|
314
|
+
- JSON configuration format
|
|
315
|
+
|
|
316
|
+
---
|
|
317
|
+
|
|
318
|
+
## Backward Compatibility
|
|
319
|
+
|
|
320
|
+
### Maintaining Compatibility
|
|
321
|
+
- Feature flags to toggle between old and new behavior
|
|
322
|
+
- Adapter layer for deprecated APIs
|
|
323
|
+
- Automatic data format conversion where possible
|
|
324
|
+
|
|
325
|
+
### Compatibility Mode
|
|
326
|
+
Enable compatibility mode during transition period:
|
|
327
|
+
\`\`\`bash
|
|
328
|
+
# .env
|
|
329
|
+
COMPATIBILITY_MODE=true
|
|
330
|
+
LEGACY_API_ENABLED=true
|
|
331
|
+
\`\`\`
|
|
332
|
+
|
|
333
|
+
**Warning:** Compatibility mode has performance overhead and should only be used temporarily.
|
|
334
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
## Common Migration Issues
|
|
338
|
+
|
|
339
|
+
### Issue: Migration Fails Midway
|
|
340
|
+
**Solution:**
|
|
341
|
+
1. Check migration logs for specific error
|
|
342
|
+
2. Fix underlying issue (permissions, constraints, etc.)
|
|
343
|
+
3. Resume migration or rollback and retry
|
|
344
|
+
|
|
345
|
+
### Issue: Data Inconsistency After Migration
|
|
346
|
+
**Solution:**
|
|
347
|
+
1. Run data validation scripts
|
|
348
|
+
2. Compare row counts between old and new tables
|
|
349
|
+
3. Use migration verification tools
|
|
350
|
+
4. Re-run failed batch migrations
|
|
351
|
+
|
|
352
|
+
### Issue: Performance Degradation
|
|
353
|
+
**Solution:**
|
|
354
|
+
1. Rebuild database indexes: \`npm run db:reindex\`
|
|
355
|
+
2. Update query optimizer statistics: \`ANALYZE;\`
|
|
356
|
+
3. Review query plans for new schema
|
|
357
|
+
4. Consider adding new indexes for changed access patterns
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Migration Scripts & Tools
|
|
362
|
+
|
|
363
|
+
### Available Scripts
|
|
364
|
+
\`\`\`bash
|
|
365
|
+
# Data validation
|
|
366
|
+
npm run validate:migration
|
|
367
|
+
|
|
368
|
+
# Dry run migration (no changes)
|
|
369
|
+
npm run migrate:dry-run
|
|
370
|
+
|
|
371
|
+
# Generate migration report
|
|
372
|
+
npm run migrate:report > migration-report.txt
|
|
373
|
+
|
|
374
|
+
# Performance test after migration
|
|
375
|
+
npm run test:performance
|
|
376
|
+
\`\`\`
|
|
377
|
+
|
|
378
|
+
### Third-Party Tools
|
|
379
|
+
- **DB migration tools:** Flyway, Liquibase
|
|
380
|
+
- **Data comparison:** DbDiff, Schema Spy
|
|
381
|
+
- **Performance testing:** Apache Bench, k6
|
|
382
|
+
|
|
383
|
+
---
|
|
384
|
+
|
|
385
|
+
## Getting Help
|
|
386
|
+
|
|
387
|
+
### Migration Support
|
|
388
|
+
- **Documentation:** [Link to detailed migration docs]
|
|
389
|
+
- **Support channel:** TODO: Add Slack/Discord channel
|
|
390
|
+
- **Migration assistance:** TODO: Add contact for migration help
|
|
391
|
+
- **Issue tracker:** TODO: Link to migration issues
|
|
392
|
+
|
|
393
|
+
### Reporting Migration Issues
|
|
394
|
+
When reporting migration problems, include:
|
|
395
|
+
1. Source version and target version
|
|
396
|
+
2. Full error message and stack trace
|
|
397
|
+
3. Migration log output
|
|
398
|
+
4. Database type and version
|
|
399
|
+
5. Steps to reproduce
|
|
400
|
+
|
|
401
|
+
<!-- agent-readonly:guidance -->
|
|
402
|
+
## AI Update Checklist
|
|
403
|
+
1. Update version numbers and release dates when new versions are published
|
|
404
|
+
2. Document new breaking changes with clear before/after examples
|
|
405
|
+
3. Add migration paths for each new major version
|
|
406
|
+
4. Update deprecation timeline as features are removed
|
|
407
|
+
5. Include actual migration scripts and examples from the codebase
|
|
408
|
+
6. Verify rollback procedures are tested and accurate
|
|
409
|
+
7. Update system requirements for new versions
|
|
410
|
+
|
|
411
|
+
<!-- agent-readonly:sources -->
|
|
412
|
+
## Acceptable Sources
|
|
413
|
+
- CHANGELOG.md and release notes
|
|
414
|
+
- Migration scripts in migrations/ or db/migrate/ directory
|
|
415
|
+
- Upgrade guides from official documentation
|
|
416
|
+
- Post-mortem reports from previous migrations
|
|
417
|
+
- Breaking changes documented in commit messages or PRs
|
|
418
|
+
|
|
419
|
+
<!-- agent-update:end -->
|
|
420
|
+
`;
|
|
421
|
+
}
|
|
422
|
+
//# sourceMappingURL=migrationTemplate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrationTemplate.js","sourceRoot":"","sources":["../../../../src/generators/documentation/templates/migrationTemplate.ts"],"names":[],"mappings":";;AACA,0CAkaC;AAlaD,SAAgB,eAAe;IAE7B,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+ZR,CAAC;AACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onboardingTemplate.d.ts","sourceRoot":"","sources":["../../../../src/generators/documentation/templates/onboardingTemplate.ts"],"names":[],"mappings":"AACA,wBAAgB,gBAAgB,IAAI,MAAM,CA2azC"}
|