@comfanion/workflow 4.36.2 → 4.36.3
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 +30 -0
- package/package.json +1 -1
- package/src/build-info.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -576,6 +576,12 @@ program
|
|
|
576
576
|
spinner.text = 'Restoring config.yaml...';
|
|
577
577
|
let mergedConfig = configBackup;
|
|
578
578
|
|
|
579
|
+
// Extract user's custom exclude patterns before merge
|
|
580
|
+
const userExcludeMatch = configBackup.match(/exclude:\s*\n((?:\s+-\s+.+\n?)+)/);
|
|
581
|
+
const userExcludes = userExcludeMatch
|
|
582
|
+
? userExcludeMatch[1].match(/-\s+(.+)/g)?.map(m => m.replace(/^-\s+/, '').trim()) || []
|
|
583
|
+
: [];
|
|
584
|
+
|
|
579
585
|
// Add vectorizer section if missing
|
|
580
586
|
if (!mergedConfig.includes('vectorizer:')) {
|
|
581
587
|
const newConfigPath = path.join(targetDir, 'config.yaml');
|
|
@@ -593,6 +599,30 @@ program
|
|
|
593
599
|
}
|
|
594
600
|
}
|
|
595
601
|
|
|
602
|
+
// Merge user's custom excludes into vectorizer section
|
|
603
|
+
if (userExcludes.length > 0) {
|
|
604
|
+
const newConfigPath = path.join(targetDir, 'config.yaml');
|
|
605
|
+
const newConfig = await fs.readFile(newConfigPath, 'utf8');
|
|
606
|
+
const defaultExcludeMatch = newConfig.match(/exclude:\s*\n((?:\s+-\s+.+\n?)+)/);
|
|
607
|
+
const defaultExcludes = defaultExcludeMatch
|
|
608
|
+
? defaultExcludeMatch[1].match(/-\s+(.+)/g)?.map(m => m.replace(/^-\s+/, '').trim()) || []
|
|
609
|
+
: [];
|
|
610
|
+
|
|
611
|
+
// Find excludes that user added (not in defaults)
|
|
612
|
+
const customExcludes = userExcludes.filter(e => !defaultExcludes.includes(e));
|
|
613
|
+
|
|
614
|
+
if (customExcludes.length > 0) {
|
|
615
|
+
// Add custom excludes to the merged config
|
|
616
|
+
const excludeInsertPoint = mergedConfig.match(/exclude:\s*\n((?:\s+-\s+.+\n?)+)/);
|
|
617
|
+
if (excludeInsertPoint) {
|
|
618
|
+
const insertAfter = excludeInsertPoint.index + excludeInsertPoint[0].length;
|
|
619
|
+
const customLines = customExcludes.map(e => ` - ${e}`).join('\n') + '\n';
|
|
620
|
+
mergedConfig = mergedConfig.slice(0, insertAfter) + customLines + mergedConfig.slice(insertAfter);
|
|
621
|
+
console.log(chalk.green(` ✅ Preserved ${customExcludes.length} custom exclude patterns`));
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
|
|
596
626
|
await fs.writeFile(configPath, mergedConfig);
|
|
597
627
|
|
|
598
628
|
// Install plugin dependencies
|
package/package.json
CHANGED