@girardmedia/bootspring 2.0.31 → 2.0.32
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/mcp/contracts/mcp-contract.v1.json +1 -1
- package/package.json +1 -1
- package/src/cli/build.ts +28 -1
- package/src/cli/seed.ts +29 -2
- package/src/core/build-orchestrator.ts +50 -1
package/package.json
CHANGED
package/src/cli/build.ts
CHANGED
|
@@ -142,6 +142,33 @@ const c = {
|
|
|
142
142
|
magenta: '\x1b[35m'
|
|
143
143
|
};
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Detect if the project root contains an existing codebase
|
|
147
|
+
*/
|
|
148
|
+
function isExistingCodebase(projectRoot: string): boolean {
|
|
149
|
+
const indicators = [
|
|
150
|
+
'package.json', 'Cargo.toml', 'go.mod', 'requirements.txt',
|
|
151
|
+
'pyproject.toml', 'Gemfile', 'pom.xml', 'build.gradle', 'composer.json', '.git'
|
|
152
|
+
];
|
|
153
|
+
const srcDirs = ['src', 'lib', 'app', 'pages', 'components'];
|
|
154
|
+
|
|
155
|
+
for (const indicator of indicators) {
|
|
156
|
+
if (fs.existsSync(path.join(projectRoot, indicator))) return true;
|
|
157
|
+
}
|
|
158
|
+
for (const dir of srcDirs) {
|
|
159
|
+
const dirPath = path.join(projectRoot, dir);
|
|
160
|
+
if (fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) return true;
|
|
161
|
+
}
|
|
162
|
+
return false;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Get the appropriate preseed command suggestion
|
|
167
|
+
*/
|
|
168
|
+
function getPreseedSuggestion(projectRoot: string): string {
|
|
169
|
+
return isExistingCodebase(projectRoot) ? 'bootspring preseed codebase' : 'bootspring preseed start';
|
|
170
|
+
}
|
|
171
|
+
|
|
145
172
|
/**
|
|
146
173
|
* Main run function - Interactive by default
|
|
147
174
|
*/
|
|
@@ -233,7 +260,7 @@ This will:
|
|
|
233
260
|
const answer = await askQuestion('Initialize build from seed docs? [Y/n] ');
|
|
234
261
|
|
|
235
262
|
if (answer.toLowerCase() === 'n') {
|
|
236
|
-
console.log(`\n${c.dim}Run '
|
|
263
|
+
console.log(`\n${c.dim}Run '${getPreseedSuggestion(projectRoot)}' first if you haven't set up seed docs.${c.reset}\n`);
|
|
237
264
|
return;
|
|
238
265
|
}
|
|
239
266
|
|
package/src/cli/seed.ts
CHANGED
|
@@ -278,6 +278,33 @@ function getSeedExtractors(): SeedExtractors {
|
|
|
278
278
|
return require('./seed/extractors') as SeedExtractors;
|
|
279
279
|
}
|
|
280
280
|
|
|
281
|
+
/**
|
|
282
|
+
* Detect if the project root contains an existing codebase
|
|
283
|
+
*/
|
|
284
|
+
function isExistingCodebase(projectRoot: string): boolean {
|
|
285
|
+
const indicators = [
|
|
286
|
+
'package.json', 'Cargo.toml', 'go.mod', 'requirements.txt',
|
|
287
|
+
'pyproject.toml', 'Gemfile', 'pom.xml', 'build.gradle', 'composer.json', '.git'
|
|
288
|
+
];
|
|
289
|
+
const srcDirs = ['src', 'lib', 'app', 'pages', 'components'];
|
|
290
|
+
|
|
291
|
+
for (const indicator of indicators) {
|
|
292
|
+
if (fs.existsSync(path.join(projectRoot, indicator))) return true;
|
|
293
|
+
}
|
|
294
|
+
for (const dir of srcDirs) {
|
|
295
|
+
const dirPath = path.join(projectRoot, dir);
|
|
296
|
+
if (fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) return true;
|
|
297
|
+
}
|
|
298
|
+
return false;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* Get the appropriate preseed command suggestion
|
|
303
|
+
*/
|
|
304
|
+
function getPreseedSuggestion(projectRoot: string): string {
|
|
305
|
+
return isExistingCodebase(projectRoot) ? 'bootspring preseed codebase' : 'bootspring preseed start';
|
|
306
|
+
}
|
|
307
|
+
|
|
281
308
|
/**
|
|
282
309
|
* Run seed command
|
|
283
310
|
* @param args - Command arguments
|
|
@@ -993,7 +1020,7 @@ ${utils.COLORS.dim}Create SEED.md from your preseed documents${utils.COLORS.rese
|
|
|
993
1020
|
// Check for preseed documents
|
|
994
1021
|
if (!fs.existsSync(preseedDir)) {
|
|
995
1022
|
utils.print.error('No preseed documents found');
|
|
996
|
-
console.log(`\nRun ${utils.COLORS.cyan}
|
|
1023
|
+
console.log(`\nRun ${utils.COLORS.cyan}${getPreseedSuggestion(projectRoot)}${utils.COLORS.reset} first`);
|
|
997
1024
|
return;
|
|
998
1025
|
}
|
|
999
1026
|
|
|
@@ -1016,7 +1043,7 @@ ${utils.COLORS.dim}Create SEED.md from your preseed documents${utils.COLORS.rese
|
|
|
1016
1043
|
|
|
1017
1044
|
if (preseedFiles.length === 0) {
|
|
1018
1045
|
utils.print.error('No preseed documents found');
|
|
1019
|
-
console.log(`\nRun ${utils.COLORS.cyan}
|
|
1046
|
+
console.log(`\nRun ${utils.COLORS.cyan}${getPreseedSuggestion(projectRoot)}${utils.COLORS.reset} first`);
|
|
1020
1047
|
return;
|
|
1021
1048
|
}
|
|
1022
1049
|
|
|
@@ -73,6 +73,54 @@ function getPlanningTemplate(): PlanningTemplate {
|
|
|
73
73
|
return _planningTemplate;
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
/**
|
|
77
|
+
* Detect if the project root contains an existing codebase
|
|
78
|
+
* Used to suggest the right preseed command
|
|
79
|
+
*/
|
|
80
|
+
function isExistingCodebase(projectRoot: string): boolean {
|
|
81
|
+
// Check for common codebase indicators
|
|
82
|
+
const indicators = [
|
|
83
|
+
'package.json',
|
|
84
|
+
'Cargo.toml',
|
|
85
|
+
'go.mod',
|
|
86
|
+
'requirements.txt',
|
|
87
|
+
'pyproject.toml',
|
|
88
|
+
'Gemfile',
|
|
89
|
+
'pom.xml',
|
|
90
|
+
'build.gradle',
|
|
91
|
+
'composer.json',
|
|
92
|
+
'.git'
|
|
93
|
+
];
|
|
94
|
+
|
|
95
|
+
// Check for source directories
|
|
96
|
+
const srcDirs = ['src', 'lib', 'app', 'pages', 'components'];
|
|
97
|
+
|
|
98
|
+
for (const indicator of indicators) {
|
|
99
|
+
if (fs.existsSync(path.join(projectRoot, indicator))) {
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
for (const dir of srcDirs) {
|
|
105
|
+
const dirPath = path.join(projectRoot, dir);
|
|
106
|
+
if (fs.existsSync(dirPath) && fs.statSync(dirPath).isDirectory()) {
|
|
107
|
+
return true;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Get the appropriate preseed command suggestion based on project state
|
|
116
|
+
*/
|
|
117
|
+
function getPreseedSuggestion(projectRoot: string): string {
|
|
118
|
+
if (isExistingCodebase(projectRoot)) {
|
|
119
|
+
return 'bootspring preseed codebase';
|
|
120
|
+
}
|
|
121
|
+
return 'bootspring preseed start';
|
|
122
|
+
}
|
|
123
|
+
|
|
76
124
|
/**
|
|
77
125
|
* Build Orchestrator Class
|
|
78
126
|
*/
|
|
@@ -113,7 +161,8 @@ export class BuildOrchestrator {
|
|
|
113
161
|
this.docs = this.loadSeedDocuments();
|
|
114
162
|
|
|
115
163
|
if (Object.keys(this.docs).length === 0) {
|
|
116
|
-
|
|
164
|
+
const suggestion = getPreseedSuggestion(this.projectRoot);
|
|
165
|
+
result.error = `No seed documents found. Run "${suggestion}" first.`;
|
|
117
166
|
return result;
|
|
118
167
|
}
|
|
119
168
|
|