@comfanion/workflow 4.36.5 → 4.36.6
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/bin/cli.js +32 -5
- package/package.json +1 -1
- package/src/build-info.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -278,6 +278,8 @@ program
|
|
|
278
278
|
let hadVectorizer = false;
|
|
279
279
|
let hadVectors = false;
|
|
280
280
|
|
|
281
|
+
let existingConfigContent = null;
|
|
282
|
+
|
|
281
283
|
if (await fs.pathExists(targetDir)) {
|
|
282
284
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
283
285
|
const backupDir = path.join(process.cwd(), `.opencode.backup-${timestamp}`);
|
|
@@ -286,6 +288,12 @@ program
|
|
|
286
288
|
hadVectorizer = await fs.pathExists(vectorizerNodeModules);
|
|
287
289
|
hadVectors = await fs.pathExists(vectorsDir);
|
|
288
290
|
|
|
291
|
+
// Read existing config.yaml for merge
|
|
292
|
+
const existingConfigPath = path.join(targetDir, 'config.yaml');
|
|
293
|
+
if (await fs.pathExists(existingConfigPath)) {
|
|
294
|
+
existingConfigContent = await fs.readFile(existingConfigPath, 'utf8');
|
|
295
|
+
}
|
|
296
|
+
|
|
289
297
|
// Preserve vectorizer node_modules (100MB+, don't backup)
|
|
290
298
|
if (hadVectorizer) {
|
|
291
299
|
spinner.text = 'Preserving vectorizer dependencies...';
|
|
@@ -341,18 +349,37 @@ program
|
|
|
341
349
|
const configPath = path.join(targetDir, 'config.yaml');
|
|
342
350
|
let configContent = await fs.readFile(configPath, 'utf8');
|
|
343
351
|
|
|
352
|
+
// If we had existing config, merge it (preserve user customizations)
|
|
353
|
+
if (existingConfigContent) {
|
|
354
|
+
try {
|
|
355
|
+
const newConfig = yaml.load(configContent) || {};
|
|
356
|
+
const existingConfig = yaml.load(existingConfigContent) || {};
|
|
357
|
+
const mergedConfig = deepMerge(newConfig, existingConfig);
|
|
358
|
+
configContent = yaml.dump(mergedConfig, {
|
|
359
|
+
indent: 2,
|
|
360
|
+
lineWidth: 120,
|
|
361
|
+
noRefs: true,
|
|
362
|
+
sortKeys: false
|
|
363
|
+
});
|
|
364
|
+
console.log(chalk.green(' ✅ Merged existing config settings'));
|
|
365
|
+
} catch (e) {
|
|
366
|
+
// Merge failed, continue with new config + user values
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
// Apply user's answers from prompts
|
|
344
371
|
configContent = configContent
|
|
345
|
-
.replace(/user_name:
|
|
346
|
-
.replace(/communication_language:
|
|
347
|
-
.replace(/project_name:
|
|
372
|
+
.replace(/user_name: .*/, `user_name: "${config.user_name}"`)
|
|
373
|
+
.replace(/communication_language: .*/, `communication_language: "${config.communication_language}"`)
|
|
374
|
+
.replace(/project_name: .*/, `project_name: "${config.project_name}"`)
|
|
348
375
|
.replace(/methodology: (tdd|stub)/, `methodology: ${config.methodology}`);
|
|
349
376
|
|
|
350
377
|
// Jira config
|
|
351
378
|
if (config.jira_enabled) {
|
|
352
379
|
configContent = configContent
|
|
353
380
|
.replace(/enabled: false\s+# Jira/, `enabled: true # Jira`)
|
|
354
|
-
.replace(/base_url:
|
|
355
|
-
.replace(/project_key:
|
|
381
|
+
.replace(/base_url: .*/, `base_url: "${config.jira_url}"`)
|
|
382
|
+
.replace(/project_key: .*/, `project_key: "${config.jira_project}"`);
|
|
356
383
|
}
|
|
357
384
|
|
|
358
385
|
// Vectorizer config
|
package/package.json
CHANGED