@comfanion/workflow 4.36.10 → 4.36.12
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 +47 -38
- package/package.json +1 -1
- package/src/build-info.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -273,21 +273,16 @@ program
|
|
|
273
273
|
// If updating, preserve vectorizer and indexes
|
|
274
274
|
const vectorizerDir = path.join(targetDir, 'vectorizer');
|
|
275
275
|
const vectorsDir = path.join(targetDir, 'vectors');
|
|
276
|
-
const vectorizerNodeModules = path.join(vectorizerDir, 'node_modules');
|
|
277
|
-
const tempNodeModules = path.join(process.cwd(), '.vectorizer-node_modules-temp');
|
|
278
276
|
const tempVectors = path.join(process.cwd(), '.vectors-temp');
|
|
279
277
|
|
|
280
|
-
let hadVectorizer = false;
|
|
281
278
|
let hadVectors = false;
|
|
282
|
-
|
|
283
279
|
let existingConfigContent = null;
|
|
284
280
|
|
|
285
281
|
if (await fs.pathExists(targetDir)) {
|
|
286
282
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
287
283
|
const backupDir = path.join(process.cwd(), `.opencode.backup-${timestamp}`);
|
|
288
284
|
|
|
289
|
-
// Check what we need to preserve
|
|
290
|
-
hadVectorizer = await fs.pathExists(vectorizerNodeModules);
|
|
285
|
+
// Check what we need to preserve (only vectors, vectorizer will be reinstalled fresh)
|
|
291
286
|
hadVectors = await fs.pathExists(vectorsDir);
|
|
292
287
|
|
|
293
288
|
// Read existing config.yaml for merge
|
|
@@ -296,13 +291,7 @@ program
|
|
|
296
291
|
existingConfigContent = await fs.readFile(existingConfigPath, 'utf8');
|
|
297
292
|
}
|
|
298
293
|
|
|
299
|
-
// Preserve
|
|
300
|
-
if (hadVectorizer) {
|
|
301
|
-
spinner.text = 'Preserving vectorizer dependencies...';
|
|
302
|
-
await fs.move(vectorizerNodeModules, tempNodeModules, { overwrite: true });
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
// Preserve vector indexes
|
|
294
|
+
// Preserve vector indexes only (not node_modules - will reinstall fresh)
|
|
306
295
|
if (hadVectors) {
|
|
307
296
|
spinner.text = 'Preserving vector indexes...';
|
|
308
297
|
await fs.move(vectorsDir, tempVectors, { overwrite: true });
|
|
@@ -325,19 +314,26 @@ program
|
|
|
325
314
|
// Copy .opencode structure (fresh, no old files)
|
|
326
315
|
await fs.copy(OPENCODE_SRC, targetDir);
|
|
327
316
|
|
|
328
|
-
// Copy
|
|
317
|
+
// Copy vectorizer source files (always copy, install only if enabled)
|
|
329
318
|
if (await fs.pathExists(VECTORIZER_SRC)) {
|
|
330
|
-
spinner.text = 'Updating vectorizer...';
|
|
331
319
|
const newVectorizerDir = path.join(targetDir, 'vectorizer');
|
|
332
320
|
await fs.ensureDir(newVectorizerDir);
|
|
333
321
|
await fs.copy(path.join(VECTORIZER_SRC, 'index.js'), path.join(newVectorizerDir, 'index.js'));
|
|
334
322
|
await fs.copy(path.join(VECTORIZER_SRC, 'package.json'), path.join(newVectorizerDir, 'package.json'));
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
323
|
+
|
|
324
|
+
// Install dependencies only if vectorizer is enabled
|
|
325
|
+
if (config.vectorizer_enabled) {
|
|
326
|
+
spinner.text = 'Installing vectorizer...';
|
|
327
|
+
try {
|
|
328
|
+
execSync('npm install --silent', {
|
|
329
|
+
cwd: newVectorizerDir,
|
|
330
|
+
stdio: 'pipe',
|
|
331
|
+
timeout: 120000
|
|
332
|
+
});
|
|
333
|
+
} catch (e) {
|
|
334
|
+
// Non-fatal, will show warning below
|
|
335
|
+
}
|
|
336
|
+
}
|
|
341
337
|
}
|
|
342
338
|
|
|
343
339
|
// Restore vector indexes
|
|
@@ -456,16 +452,21 @@ program
|
|
|
456
452
|
console.log(chalk.gray(' Run manually: cd .opencode && bun install'));
|
|
457
453
|
}
|
|
458
454
|
|
|
459
|
-
// Show what was
|
|
460
|
-
|
|
461
|
-
|
|
455
|
+
// Show what was done
|
|
456
|
+
const vectorizerInstalled = await fs.pathExists(path.join(targetDir, 'vectorizer', 'node_modules'));
|
|
457
|
+
if (vectorizerInstalled) {
|
|
458
|
+
console.log(chalk.green('✅ Vectorizer installed (fresh dependencies)'));
|
|
459
|
+
} else if (config.vectorizer_enabled) {
|
|
460
|
+
console.log(chalk.yellow('⚠️ Vectorizer: run `npx @comfanion/workflow vectorizer install`'));
|
|
461
|
+
} else {
|
|
462
|
+
console.log(chalk.gray('ℹ️ Vectorizer disabled (enable in config.yaml to use semantic search)'));
|
|
462
463
|
}
|
|
463
464
|
if (hadVectors) {
|
|
464
465
|
console.log(chalk.green('✅ Vector indexes preserved'));
|
|
465
466
|
}
|
|
466
467
|
|
|
467
|
-
// Install vectorizer if requested
|
|
468
|
-
if (config.install_vectorizer && !
|
|
468
|
+
// Install vectorizer if requested and failed above
|
|
469
|
+
if (config.install_vectorizer && !vectorizerInstalled) {
|
|
469
470
|
await installVectorizer(targetDir);
|
|
470
471
|
}
|
|
471
472
|
|
|
@@ -584,23 +585,28 @@ program
|
|
|
584
585
|
spinner.text = 'Installing new version...';
|
|
585
586
|
await fs.copy(OPENCODE_SRC, targetDir);
|
|
586
587
|
|
|
587
|
-
// Copy
|
|
588
|
+
// Copy vectorizer source files (always copy, install only if enabled)
|
|
588
589
|
if (await fs.pathExists(VECTORIZER_SRC)) {
|
|
589
|
-
spinner.text = 'Installing vectorizer...';
|
|
590
590
|
const newVectorizerDir = path.join(targetDir, 'vectorizer');
|
|
591
591
|
await fs.ensureDir(newVectorizerDir);
|
|
592
592
|
await fs.copy(path.join(VECTORIZER_SRC, 'index.js'), path.join(newVectorizerDir, 'index.js'));
|
|
593
593
|
await fs.copy(path.join(VECTORIZER_SRC, 'package.json'), path.join(newVectorizerDir, 'package.json'));
|
|
594
594
|
|
|
595
|
-
//
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
595
|
+
// Check if vectorizer is enabled in user's config
|
|
596
|
+
const vectorizerEnabled = /vectorizer:[\s\S]*?enabled:\s*true/i.test(configBackup);
|
|
597
|
+
|
|
598
|
+
// Install dependencies only if vectorizer is enabled
|
|
599
|
+
if (vectorizerEnabled) {
|
|
600
|
+
spinner.text = 'Installing vectorizer...';
|
|
601
|
+
try {
|
|
602
|
+
execSync('npm install --silent', {
|
|
603
|
+
cwd: newVectorizerDir,
|
|
604
|
+
stdio: 'pipe',
|
|
605
|
+
timeout: 120000
|
|
606
|
+
});
|
|
607
|
+
} catch (e) {
|
|
608
|
+
// Non-fatal, will show warning below
|
|
609
|
+
}
|
|
604
610
|
}
|
|
605
611
|
}
|
|
606
612
|
|
|
@@ -671,10 +677,13 @@ program
|
|
|
671
677
|
console.log(chalk.yellow('⚠️ Plugin deps: run `cd .opencode && bun install`'));
|
|
672
678
|
}
|
|
673
679
|
const vectorizerInstalled = await fs.pathExists(path.join(targetDir, 'vectorizer', 'node_modules'));
|
|
680
|
+
const vectorizerEnabled = /vectorizer:[\s\S]*?enabled:\s*true/i.test(configBackup);
|
|
674
681
|
if (vectorizerInstalled) {
|
|
675
682
|
console.log(chalk.green('✅ Vectorizer reinstalled (fresh dependencies).'));
|
|
676
|
-
} else {
|
|
683
|
+
} else if (vectorizerEnabled) {
|
|
677
684
|
console.log(chalk.yellow('⚠️ Vectorizer: run `npx @comfanion/workflow vectorizer install`'));
|
|
685
|
+
} else {
|
|
686
|
+
console.log(chalk.gray('ℹ️ Vectorizer disabled (enable in config.yaml to use semantic search)'));
|
|
678
687
|
}
|
|
679
688
|
if (hasVectors) {
|
|
680
689
|
console.log(chalk.green('✅ Vector indexes were preserved.'));
|
package/package.json
CHANGED