@axboot-mcp/mcp-server 1.0.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/CLAUDE.md +119 -0
- package/MCP_TOOL_PLAN.md +710 -0
- package/MCP_USAGE.md +914 -0
- package/README.md +168 -0
- package/REPOSITORY_CONVENTIONS.md +250 -0
- package/SEARCH_PARAMS_MCP_TOOL_COMPLETE_PLAN.md +646 -0
- package/SEARCH_PARAMS_PLAN.md +2570 -0
- package/STORE_PATTERNS.md +1178 -0
- package/debug-dto.js +72 -0
- package/generate-banner-store.js +62 -0
- package/generation-plan.json +2176 -0
- package/generation-results.json +1817 -0
- package/package.json +45 -0
- package/scripts/batch-generate-all.js +159 -0
- package/scripts/batch-generate-mcp.js +329 -0
- package/scripts/batch-generate-stores-v2.js +272 -0
- package/scripts/batch-generate-stores.js +179 -0
- package/scripts/batch-plan.json +3810 -0
- package/scripts/batch-process.py +90 -0
- package/scripts/batch-regenerate.js +356 -0
- package/scripts/direct-generate.js +227 -0
- package/scripts/execute-batches.js +1911 -0
- package/scripts/generate-all-stores.js +144 -0
- package/scripts/generate-stores-mcp.js +161 -0
- package/scripts/generate-stores-v2.js +450 -0
- package/scripts/generate-stores-v3.js +412 -0
- package/scripts/generate-stores-v4.js +521 -0
- package/scripts/generate-stores.js +382 -0
- package/scripts/repos-to-process.json +1899 -0
- package/src/config/nh-layout-patterns.ts +166 -0
- package/src/docs/HOOK_GENERATION_PLAN.md +2226 -0
- package/src/docs/NH_STORE_PATTERNS.md +297 -0
- package/src/docs/README.md +216 -0
- package/src/docs/index.ts +28 -0
- package/src/docs/loader.ts +568 -0
- package/src/docs/patterns.json +419 -0
- package/src/docs/practical-examples.md +732 -0
- package/src/docs/quick-start.md +257 -0
- package/src/docs/requirements-analysis-guide.md +364 -0
- package/src/docs/rules.json +321 -0
- package/src/docs/store-pattern-analysis.md +664 -0
- package/src/docs/store-patterns-rules.md +1168 -0
- package/src/docs/store-patterns-usage-guide.md +1835 -0
- package/src/docs/troubleshooting.md +544 -0
- package/src/docs/type-selection-guide.md +572 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/AntD-/354/273/264/355/217/254/353/204/214/355/212/270-/354/202/254/354/232/251/353/262/225.md +1515 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/DataGrid-/354/202/254/354/232/251/353/262/225.md +866 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/FormItem-/354/202/254/354/232/251/353/262/225.md +903 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/FormModal-/354/202/254/354/232/251/353/262/225.md +1155 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/MCP-/353/260/224/354/235/264/353/270/214/354/275/224/353/224/251-/352/260/200/354/235/264/353/223/234.md +1133 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/MSW-Mock-/353/215/260/354/235/264/355/204/260-/354/202/254/354/232/251/353/262/225.md +579 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/Search-/354/273/264/355/217/254/353/204/214/355/212/270-/354/202/254/354/232/251/353/262/225.md +738 -0
- package/src/docs//354/202/254/354/232/251/353/262/225/Store-/355/214/250/355/204/264-/354/202/254/354/232/251/353/262/225.md +1135 -0
- package/src/docs//354/202/254/354/232/251/353/262/225//355/231/224/353/251/264/352/265/254/354/204/261-/355/203/200/354/236/205/353/263/204-/352/260/234/353/260/234/354/210/234/354/204/234.md +1805 -0
- package/src/docs//354/202/254/354/232/251/353/262/225//355/231/224/353/251/264/355/203/200/354/236/205/353/263/204-/352/260/234/353/260/234-/355/224/204/353/241/254/355/224/204/355/212/270-/352/260/200/354/235/264/353/223/234.md +946 -0
- package/src/docs//354/202/254/354/232/251/353/262/225//355/231/225/354/236/245/355/231/224/353/251/264/355/203/200/354/236/205/353/263/204-/354/203/201/354/204/270-/355/224/204/353/241/254/355/224/204/355/212/270/352/260/200/354/235/264/353/223/234.md +2422 -0
- package/src/features/store-features.ts +232 -0
- package/src/handlers/analyze-requirements.ts +403 -0
- package/src/handlers/analyze.ts +1373 -0
- package/src/handlers/generate-from-requirements.ts +250 -0
- package/src/handlers/generate-hook.ts +950 -0
- package/src/handlers/generate-interactive.ts +840 -0
- package/src/handlers/generate-listdatagrid.ts +521 -0
- package/src/handlers/generate-multi-stores.ts +577 -0
- package/src/handlers/generate-requirements-from-layout.ts +160 -0
- package/src/handlers/generate-search-params.ts +717 -0
- package/src/handlers/generate.ts +911 -0
- package/src/handlers/list-templates.ts +104 -0
- package/src/handlers/scan-metadata.ts +485 -0
- package/src/handlers/suggest-layout.ts +326 -0
- package/src/index.ts +959 -0
- package/src/prompts/search-params.md +793 -0
- package/src/templates/index.ts +107 -0
- package/src/templates/unified.ts +462 -0
- package/store-generation-error-patterns.md +225 -0
- package/test/useAgentStore.ts +136 -0
- package/test-server.js +78 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Batch Store Generator v2 - Using MCP Server Direct Integration
|
|
5
|
+
*
|
|
6
|
+
* This script processes Repository interface files and generates Zustand stores
|
|
7
|
+
* using the mcp-axboot MCP server's analyze_interface and generate_store tools.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
|
|
13
|
+
// Configuration
|
|
14
|
+
const REPO_DIR = '/Users/kyle/Desktop/nh-fe-bo/src/services/@interface/repository';
|
|
15
|
+
const OUTPUT_DIR = '/Users/kyle/Desktop/nh-fe-bo/src/pages/resources/NH/test';
|
|
16
|
+
const RESULTS_FILE = path.join(OUTPUT_DIR, 'generation-results.md');
|
|
17
|
+
const BATCH_SIZE = 10; // Process in batches
|
|
18
|
+
|
|
19
|
+
// Store type mapping based on feature analysis
|
|
20
|
+
const STORE_TYPE_MAPPING = {
|
|
21
|
+
// Type 7: Master-Detail + Modal + Delete + Excel (most complete)
|
|
22
|
+
'list-detail-save-delete-export': 7,
|
|
23
|
+
// Type 2: Master-Detail + Modal + Delete
|
|
24
|
+
'list-detail-save-delete': 2,
|
|
25
|
+
// Type 9: Master-Detail + Modal + Detail API
|
|
26
|
+
'list-detail-save-export': 9,
|
|
27
|
+
// Type 1: Basic List + Detail
|
|
28
|
+
'list-save-delete': 1,
|
|
29
|
+
'list-save': 1,
|
|
30
|
+
'list-detail-save': 1,
|
|
31
|
+
// Type 5: Simple List (default)
|
|
32
|
+
'default': 5
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Analyze repository file to determine best store type
|
|
37
|
+
*/
|
|
38
|
+
function analyzeRepository(filePath, repoName) {
|
|
39
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
40
|
+
|
|
41
|
+
const features = {
|
|
42
|
+
list: /\b(list|find|search)\b/i.test(content),
|
|
43
|
+
detail: /\b(detail|dtlinfo|get)\b/i.test(content),
|
|
44
|
+
save: /\b(save|update|insert|create|modify|regist)\b/i.test(content),
|
|
45
|
+
delete: /\b(delete|remove)\b/i.test(content),
|
|
46
|
+
excel: /\b(excel|export|download)\b/i.test(content)
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
// Determine store type
|
|
50
|
+
const featureKey = Object.entries(features)
|
|
51
|
+
.filter(([k, v]) => v)
|
|
52
|
+
.map(([k]) => k)
|
|
53
|
+
.sort()
|
|
54
|
+
.join('-');
|
|
55
|
+
|
|
56
|
+
const storeType = STORE_TYPE_MAPPING[featureKey] || STORE_TYPE_MAPPING['default'];
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
features,
|
|
60
|
+
storeType,
|
|
61
|
+
featureKey
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Get store name from repository name
|
|
67
|
+
*/
|
|
68
|
+
function getStoreName(repoName) {
|
|
69
|
+
const baseName = repoName.replace('Repository', '');
|
|
70
|
+
return `use${baseName}ListStore`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Get output file path from repository name
|
|
75
|
+
*/
|
|
76
|
+
function getOutputPath(repoName) {
|
|
77
|
+
const storeName = getStoreName(repoName);
|
|
78
|
+
return path.join(OUTPUT_DIR, `${storeName}.ts`);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* Process batch of repositories
|
|
83
|
+
*/
|
|
84
|
+
function processBatch(repos, batchNum) {
|
|
85
|
+
console.log(`\n${'='.repeat(80)}`);
|
|
86
|
+
console.log(`Processing Batch ${batchNum} (${repos.length} files)`);
|
|
87
|
+
console.log(`${'='.repeat(80)}\n`);
|
|
88
|
+
|
|
89
|
+
return repos.map((repoName, idx) => {
|
|
90
|
+
const filePath = path.join(REPO_DIR, `${repoName}.ts`);
|
|
91
|
+
const outputPath = getOutputPath(repoName);
|
|
92
|
+
const storeName = getStoreName(repoName);
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
const { features, storeType, featureKey } = analyzeRepository(filePath, repoName);
|
|
96
|
+
|
|
97
|
+
console.log(`${idx + 1}. ${repoName}`);
|
|
98
|
+
console.log(` Type: ${storeType} | Features: ${featureKey}`);
|
|
99
|
+
console.log(` Store: ${storeName}`);
|
|
100
|
+
console.log(` Output: ${outputPath}`);
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
repository: repoName,
|
|
104
|
+
storeName,
|
|
105
|
+
storeType,
|
|
106
|
+
features,
|
|
107
|
+
featureKey,
|
|
108
|
+
outputPath,
|
|
109
|
+
inputPath: filePath,
|
|
110
|
+
status: 'analyzed'
|
|
111
|
+
};
|
|
112
|
+
} catch (error) {
|
|
113
|
+
console.error(`${idx + 1}. ${repoName} - ERROR: ${error.message}`);
|
|
114
|
+
return {
|
|
115
|
+
repository: repoName,
|
|
116
|
+
status: 'failed',
|
|
117
|
+
error: error.message
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Generate markdown report
|
|
125
|
+
*/
|
|
126
|
+
function generateReport(allResults) {
|
|
127
|
+
const successful = allResults.filter(r => r.status === 'analyzed');
|
|
128
|
+
const failed = allResults.filter(r => r.status === 'failed');
|
|
129
|
+
|
|
130
|
+
// Type distribution
|
|
131
|
+
const typeDist = {};
|
|
132
|
+
successful.forEach(r => {
|
|
133
|
+
typeDist[r.storeType] = (typeDist[r.storeType] || 0) + 1;
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const lines = [];
|
|
137
|
+
|
|
138
|
+
lines.push('# Store Generation Results');
|
|
139
|
+
lines.push('');
|
|
140
|
+
lines.push(`**Generated:** ${new Date().toLocaleString('ko-KR')}`);
|
|
141
|
+
lines.push(`**Source Directory:** \`${REPO_DIR}\``);
|
|
142
|
+
lines.push(`**Output Directory:** \`${OUTPUT_DIR}\``);
|
|
143
|
+
lines.push('');
|
|
144
|
+
|
|
145
|
+
// Summary
|
|
146
|
+
lines.push('## Summary');
|
|
147
|
+
lines.push('');
|
|
148
|
+
lines.push('| Metric | Count |');
|
|
149
|
+
lines.push('|--------|-------|');
|
|
150
|
+
lines.push(`| Total Repositories | ${allResults.length} |`);
|
|
151
|
+
lines.push(`| ✅ Successfully Analyzed | ${successful.length} |`);
|
|
152
|
+
lines.push(`| ❌ Failed | ${failed.length} |`);
|
|
153
|
+
lines.push('');
|
|
154
|
+
|
|
155
|
+
// Store type distribution
|
|
156
|
+
lines.push('## Store Type Distribution');
|
|
157
|
+
lines.push('');
|
|
158
|
+
lines.push('| Type | Description | Count |');
|
|
159
|
+
lines.push('|------|-------------|-------|');
|
|
160
|
+
lines.push('| 1 | Basic List + Detail | ' + (typeDist[1] || 0) + ' |');
|
|
161
|
+
lines.push('| 2 | Master-Detail + Modal + Delete | ' + (typeDist[2] || 0) + ' |');
|
|
162
|
+
lines.push('| 5 | Simple List | ' + (typeDist[5] || 0) + ' |');
|
|
163
|
+
lines.push('| 7 | Master-Detail + Modal + Delete + Excel | ' + (typeDist[7] || 0) + ' |');
|
|
164
|
+
lines.push('| 9 | Master-Detail + Modal + Detail API | ' + (typeDist[9] || 0) + ' |');
|
|
165
|
+
lines.push('');
|
|
166
|
+
|
|
167
|
+
// Store Type Reference
|
|
168
|
+
lines.push('## Store Type Reference');
|
|
169
|
+
lines.push('');
|
|
170
|
+
lines.push('| Type | Template File | Pattern |');
|
|
171
|
+
lines.push('|------|---------------|---------|');
|
|
172
|
+
lines.push('| 1 | type1.ts | Basic List + Detail |');
|
|
173
|
+
lines.push('| 2 | type2.ts | Master-Detail + Modal + Delete |');
|
|
174
|
+
lines.push('| 5 | type6.ts | Simple List |');
|
|
175
|
+
lines.push('| 7 | type8.ts | Master-Detail + Modal + Delete + Excel |');
|
|
176
|
+
lines.push('| 9 | type10.ts | Master-Detail + Modal + Detail API |');
|
|
177
|
+
lines.push('');
|
|
178
|
+
|
|
179
|
+
// Detailed results
|
|
180
|
+
lines.push('## Detailed Results');
|
|
181
|
+
lines.push('');
|
|
182
|
+
lines.push('| # | Repository | Store Name | Type | Features | Input Path | Output Path |');
|
|
183
|
+
lines.push('|---|------------|------------|------|----------|------------|-------------|');
|
|
184
|
+
|
|
185
|
+
successful.forEach((r, i) => {
|
|
186
|
+
const featureStr = Object.entries(r.features)
|
|
187
|
+
.filter(([k, v]) => v)
|
|
188
|
+
.map(([k]) => k)
|
|
189
|
+
.join(', ') || '-';
|
|
190
|
+
lines.push(`| ${i + 1} | \`${r.repository}\` | \`${r.storeName}\` | ${r.storeType} | ${featureStr} | \`${r.inputPath}\` | \`${r.outputPath}\` |`);
|
|
191
|
+
});
|
|
192
|
+
lines.push('');
|
|
193
|
+
|
|
194
|
+
// Failed items
|
|
195
|
+
if (failed.length > 0) {
|
|
196
|
+
lines.push('## Failed Items');
|
|
197
|
+
lines.push('');
|
|
198
|
+
failed.forEach((r, i) => {
|
|
199
|
+
lines.push(`${i + 1}. **${r.repository}** - ${r.error}`);
|
|
200
|
+
});
|
|
201
|
+
lines.push('');
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// Generate commands for manual MCP usage
|
|
205
|
+
lines.push('## MCP Usage Examples');
|
|
206
|
+
lines.push('');
|
|
207
|
+
lines.push('To generate stores using the MCP server, use these commands:');
|
|
208
|
+
lines.push('');
|
|
209
|
+
lines.push('```typescript');
|
|
210
|
+
lines.push('// For a simple list store (Type 5)');
|
|
211
|
+
lines.push('await generateStore({');
|
|
212
|
+
lines.push(' interfacePath: "/absolute/path/to/Repository.ts",');
|
|
213
|
+
lines.push(' outputPath: "/absolute/path/to/useStoreName.ts",');
|
|
214
|
+
lines.push(' storeType: 5');
|
|
215
|
+
lines.push('});');
|
|
216
|
+
lines.push('```');
|
|
217
|
+
lines.push('');
|
|
218
|
+
|
|
219
|
+
fs.writeFileSync(RESULTS_FILE, lines.join('\n'), 'utf-8');
|
|
220
|
+
return RESULTS_FILE;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/**
|
|
224
|
+
* Main execution
|
|
225
|
+
*/
|
|
226
|
+
function main() {
|
|
227
|
+
console.log('\n' + '='.repeat(80));
|
|
228
|
+
console.log(' Batch Store Generator for mcp-axboot');
|
|
229
|
+
console.log('='.repeat(80));
|
|
230
|
+
|
|
231
|
+
// Ensure output directory exists
|
|
232
|
+
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
233
|
+
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// Get all repository files
|
|
237
|
+
const files = fs.readdirSync(REPO_DIR)
|
|
238
|
+
.filter(f => f.endsWith('Repository.ts'))
|
|
239
|
+
.map(f => f.replace('.ts', ''))
|
|
240
|
+
.sort();
|
|
241
|
+
|
|
242
|
+
console.log(`\n📁 Found ${files.length} repository files`);
|
|
243
|
+
console.log(`📂 Output directory: ${OUTPUT_DIR}`);
|
|
244
|
+
|
|
245
|
+
const allResults = [];
|
|
246
|
+
let batchNum = 1;
|
|
247
|
+
|
|
248
|
+
// Process in batches
|
|
249
|
+
for (let i = 0; i < files.length; i += BATCH_SIZE) {
|
|
250
|
+
const batch = files.slice(i, i + BATCH_SIZE);
|
|
251
|
+
const batchResults = processBatch(batch, batchNum++);
|
|
252
|
+
allResults.push(...batchResults);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// Generate report
|
|
256
|
+
console.log('\n' + '='.repeat(80));
|
|
257
|
+
console.log(' Generating Report...');
|
|
258
|
+
console.log('='.repeat(80));
|
|
259
|
+
|
|
260
|
+
const reportPath = generateReport(allResults);
|
|
261
|
+
|
|
262
|
+
console.log('\n' + '='.repeat(80));
|
|
263
|
+
console.log(' Summary');
|
|
264
|
+
console.log('='.repeat(80));
|
|
265
|
+
console.log(`Total: ${allResults.length}`);
|
|
266
|
+
console.log(`✅ Analyzed: ${allResults.filter(r => r.status === 'analyzed').length}`);
|
|
267
|
+
console.log(`❌ Failed: ${allResults.filter(r => r.status === 'failed').length}`);
|
|
268
|
+
console.log(`\n📄 Report saved to: ${reportPath}`);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Run
|
|
272
|
+
main();
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Batch Store Generator for MCP-AXBOOT
|
|
5
|
+
*
|
|
6
|
+
* This script processes all Repository interface files and generates Zustand stores
|
|
7
|
+
* using the mcp-axboot MCP server tools via the Skill tool.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
const fs = require('fs');
|
|
11
|
+
const path = require('path');
|
|
12
|
+
|
|
13
|
+
// Configuration
|
|
14
|
+
const SOURCE_DIR = '/Users/kyle/Desktop/nh-fe-bo/src/services/@interface/repository';
|
|
15
|
+
const OUTPUT_DIR = '/Users/kyle/Desktop/nh-fe-bo/src/pages/resources/NH/test';
|
|
16
|
+
const BATCH_SIZE = 20;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Extract repository name from file path
|
|
20
|
+
*/
|
|
21
|
+
function extractRepositoryName(filePath) {
|
|
22
|
+
const fileName = path.basename(filePath, '.ts');
|
|
23
|
+
return fileName.replace(/Repository$/, '');
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Generate store name from repository name
|
|
28
|
+
*/
|
|
29
|
+
function generateStoreName(repositoryName) {
|
|
30
|
+
return `use${repositoryName}ListStore`;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Detect store type based on method patterns in the repository file
|
|
35
|
+
*/
|
|
36
|
+
function detectStoreType(filePath) {
|
|
37
|
+
const content = fs.readFileSync(filePath, 'utf-8');
|
|
38
|
+
|
|
39
|
+
const hasList = /\b(list|find|search)\b/i.test(content);
|
|
40
|
+
const hasDetail = /\b(detail|dtl|info|get)\b/i.test(content);
|
|
41
|
+
const hasSave = /\b(save|update|insert|create|upt|modify)\b/i.test(content);
|
|
42
|
+
const hasDelete = /\b(delete|remove|delt|secsn)\b/i.test(content);
|
|
43
|
+
const hasExcel = /\b(excel|export|download)\b/i.test(content);
|
|
44
|
+
|
|
45
|
+
// Type 7: list + detail + save + delete + excel (Master-Detail + Modal + Delete + Excel)
|
|
46
|
+
if (hasList && hasDetail && hasSave && hasDelete && hasExcel) {
|
|
47
|
+
return 7;
|
|
48
|
+
}
|
|
49
|
+
// Type 2: list + detail + save + delete (Master-Detail + Modal + Delete)
|
|
50
|
+
if (hasList && hasDetail && hasSave && hasDelete) {
|
|
51
|
+
return 2;
|
|
52
|
+
}
|
|
53
|
+
// Type 1: list + save (Basic List + Detail)
|
|
54
|
+
if (hasList && hasSave) {
|
|
55
|
+
return 1;
|
|
56
|
+
}
|
|
57
|
+
// Type 5: simple list (default)
|
|
58
|
+
return 5;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Get all repository files
|
|
63
|
+
*/
|
|
64
|
+
function getRepositoryFiles() {
|
|
65
|
+
const files = fs.readdirSync(SOURCE_DIR)
|
|
66
|
+
.filter(file => file.endsWith('Repository.ts'))
|
|
67
|
+
.map(file => path.join(SOURCE_DIR, file));
|
|
68
|
+
|
|
69
|
+
return files.sort();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Process all repository files and create batch plan
|
|
74
|
+
*/
|
|
75
|
+
function main() {
|
|
76
|
+
console.log('='.repeat(80));
|
|
77
|
+
console.log('BATCH STORE GENERATION FOR MCP-AXBOOT');
|
|
78
|
+
console.log('='.repeat(80));
|
|
79
|
+
console.log(`Source Directory: ${SOURCE_DIR}`);
|
|
80
|
+
console.log(`Output Directory: ${OUTPUT_DIR}`);
|
|
81
|
+
console.log(`Batch Size: ${BATCH_SIZE}`);
|
|
82
|
+
console.log('='.repeat(80));
|
|
83
|
+
console.log();
|
|
84
|
+
|
|
85
|
+
const repositoryFiles = getRepositoryFiles();
|
|
86
|
+
console.log(`Found ${repositoryFiles.length} repository files\n`);
|
|
87
|
+
|
|
88
|
+
// Process all files
|
|
89
|
+
const results = repositoryFiles.map(filePath => {
|
|
90
|
+
const repositoryName = extractRepositoryName(filePath);
|
|
91
|
+
const storeName = generateStoreName(repositoryName);
|
|
92
|
+
const outputPath = path.join(OUTPUT_DIR, `${storeName}.ts`);
|
|
93
|
+
const storeType = detectStoreType(filePath);
|
|
94
|
+
|
|
95
|
+
return {
|
|
96
|
+
repositoryName,
|
|
97
|
+
storeName,
|
|
98
|
+
inputPath: filePath,
|
|
99
|
+
outputPath,
|
|
100
|
+
storeType
|
|
101
|
+
};
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Group by store type for summary
|
|
105
|
+
const typeGroups = {};
|
|
106
|
+
results.forEach(r => {
|
|
107
|
+
const typeName = `Type ${r.storeType}`;
|
|
108
|
+
if (!typeGroups[typeName]) {
|
|
109
|
+
typeGroups[typeName] = [];
|
|
110
|
+
}
|
|
111
|
+
typeGroups[typeName].push(r);
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
console.log('STORE TYPE DISTRIBUTION:');
|
|
115
|
+
console.log('-'.repeat(80));
|
|
116
|
+
Object.keys(typeGroups).sort().forEach(type => {
|
|
117
|
+
const count = typeGroups[type].length;
|
|
118
|
+
const pct = ((count / results.length) * 100).toFixed(1);
|
|
119
|
+
console.log(` ${type}: ${count} repositories (${pct}%)`);
|
|
120
|
+
});
|
|
121
|
+
console.log('-'.repeat(80));
|
|
122
|
+
console.log();
|
|
123
|
+
|
|
124
|
+
// Create output directory if it doesn't exist
|
|
125
|
+
if (!fs.existsSync(OUTPUT_DIR)) {
|
|
126
|
+
fs.mkdirSync(OUTPUT_DIR, { recursive: true });
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
// Save the processing plan to JSON for batch processing
|
|
130
|
+
const planPath = path.join(__dirname, 'batch-plan.json');
|
|
131
|
+
fs.writeFileSync(planPath, JSON.stringify({
|
|
132
|
+
generated: new Date().toISOString(),
|
|
133
|
+
total: results.length,
|
|
134
|
+
batchSize: BATCH_SIZE,
|
|
135
|
+
batches: Math.ceil(results.length / BATCH_SIZE),
|
|
136
|
+
typeDistribution: typeGroups,
|
|
137
|
+
repositories: results
|
|
138
|
+
}, null, 2));
|
|
139
|
+
|
|
140
|
+
console.log(`✓ Processing plan saved to: ${planPath}`);
|
|
141
|
+
console.log(`✓ Total repositories to process: ${results.length}`);
|
|
142
|
+
console.log(`✓ Number of batches: ${Math.ceil(results.length / BATCH_SIZE)}`);
|
|
143
|
+
console.log();
|
|
144
|
+
|
|
145
|
+
// Generate a batch file for execution
|
|
146
|
+
const batchScript = generateBatchScript(results);
|
|
147
|
+
const batchScriptPath = path.join(__dirname, 'execute-batches.js');
|
|
148
|
+
fs.writeFileSync(batchScriptPath, batchScript);
|
|
149
|
+
console.log(`✓ Batch execution script saved to: ${batchScriptPath}`);
|
|
150
|
+
console.log();
|
|
151
|
+
|
|
152
|
+
console.log('NEXT STEPS:');
|
|
153
|
+
console.log('1. Review the batch-plan.json file');
|
|
154
|
+
console.log('2. Run batches using the MCP tool: node scripts/execute-batches.js');
|
|
155
|
+
console.log();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/**
|
|
159
|
+
* Generate batch execution script
|
|
160
|
+
*/
|
|
161
|
+
function generateBatchScript(results) {
|
|
162
|
+
return `#!/usr/bin/env node
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Auto-generated batch execution script
|
|
166
|
+
* Generated: ${new Date().toISOString()}
|
|
167
|
+
*/
|
|
168
|
+
|
|
169
|
+
const plan = ${JSON.stringify(results, null, 2)};
|
|
170
|
+
|
|
171
|
+
console.log(\`Processing \${plan.length} repositories...\`);
|
|
172
|
+
|
|
173
|
+
// Export for use by other scripts
|
|
174
|
+
module.exports = { plan };
|
|
175
|
+
`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Run the script
|
|
179
|
+
main().catch(console.error);
|