@comfanion/workflow 4.36.4 → 4.36.5
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 +46 -4
- package/package.json +2 -1
- package/src/build-info.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -8,6 +8,24 @@ import fs from 'fs-extra';
|
|
|
8
8
|
import path from 'path';
|
|
9
9
|
import { fileURLToPath } from 'url';
|
|
10
10
|
import { execSync } from 'child_process';
|
|
11
|
+
import yaml from 'js-yaml';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Deep merge two objects. User values override defaults.
|
|
15
|
+
* Arrays are replaced, not merged.
|
|
16
|
+
*/
|
|
17
|
+
function deepMerge(defaults, user) {
|
|
18
|
+
const result = { ...defaults };
|
|
19
|
+
for (const key of Object.keys(user)) {
|
|
20
|
+
if (user[key] !== null && typeof user[key] === 'object' && !Array.isArray(user[key]) &&
|
|
21
|
+
defaults[key] !== null && typeof defaults[key] === 'object' && !Array.isArray(defaults[key])) {
|
|
22
|
+
result[key] = deepMerge(defaults[key], user[key]);
|
|
23
|
+
} else {
|
|
24
|
+
result[key] = user[key];
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
return result;
|
|
28
|
+
}
|
|
11
29
|
|
|
12
30
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
13
31
|
const PACKAGE_DIR = path.join(__dirname, '..');
|
|
@@ -572,10 +590,34 @@ program
|
|
|
572
590
|
await fs.move(tempVectors, path.join(targetDir, 'vectors'), { overwrite: true });
|
|
573
591
|
}
|
|
574
592
|
|
|
575
|
-
//
|
|
576
|
-
spinner.text = '
|
|
577
|
-
|
|
578
|
-
|
|
593
|
+
// Merge config.yaml: new defaults + user overrides
|
|
594
|
+
spinner.text = 'Merging config.yaml...';
|
|
595
|
+
try {
|
|
596
|
+
const newConfigPath = path.join(targetDir, 'config.yaml');
|
|
597
|
+
const newConfigContent = await fs.readFile(newConfigPath, 'utf8');
|
|
598
|
+
|
|
599
|
+
// Parse both configs
|
|
600
|
+
const newConfig = yaml.load(newConfigContent) || {};
|
|
601
|
+
const userConfig = yaml.load(configBackup) || {};
|
|
602
|
+
|
|
603
|
+
// Deep merge: defaults from new config, overridden by user values
|
|
604
|
+
const mergedConfig = deepMerge(newConfig, userConfig);
|
|
605
|
+
|
|
606
|
+
// Dump back to YAML with nice formatting
|
|
607
|
+
const mergedContent = yaml.dump(mergedConfig, {
|
|
608
|
+
indent: 2,
|
|
609
|
+
lineWidth: 120,
|
|
610
|
+
noRefs: true,
|
|
611
|
+
sortKeys: false
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
await fs.writeFile(configPath, mergedContent);
|
|
615
|
+
console.log(chalk.green(' ✅ config.yaml merged (your settings preserved, new options added)'));
|
|
616
|
+
} catch (e) {
|
|
617
|
+
// Fallback: just restore user's config if merge fails
|
|
618
|
+
await fs.writeFile(configPath, configBackup);
|
|
619
|
+
console.log(chalk.yellow(' ⚠️ config.yaml restored (merge failed, using your original)'));
|
|
620
|
+
}
|
|
579
621
|
|
|
580
622
|
// Install plugin dependencies
|
|
581
623
|
spinner.text = 'Installing plugin dependencies...';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@comfanion/workflow",
|
|
3
|
-
"version": "4.36.
|
|
3
|
+
"version": "4.36.5",
|
|
4
4
|
"description": "Initialize OpenCode Workflow system for AI-assisted development with semantic code search",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -50,6 +50,7 @@
|
|
|
50
50
|
"glob": "^10.5.0",
|
|
51
51
|
"ignore": "^5.3.0",
|
|
52
52
|
"inquirer": "^9.2.0",
|
|
53
|
+
"js-yaml": "^4.1.1",
|
|
53
54
|
"ora": "^7.0.0"
|
|
54
55
|
}
|
|
55
56
|
}
|