@comfanion/workflow 4.6.1 → 4.7.0
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 +53 -4
- package/package.json +1 -1
- package/src/build-info.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -402,8 +402,9 @@ program
|
|
|
402
402
|
|
|
403
403
|
program
|
|
404
404
|
.command('update')
|
|
405
|
-
.description('Update .opencode/ to latest version (preserves config.yaml)')
|
|
405
|
+
.description('Update .opencode/ to latest version (preserves config.yaml and vectorizer)')
|
|
406
406
|
.option('--no-backup', 'Skip creating backup')
|
|
407
|
+
.option('--vectorizer', 'Update/install vectorizer too')
|
|
407
408
|
.action(async (options) => {
|
|
408
409
|
const spinner = ora('Updating OpenCode Workflow...').start();
|
|
409
410
|
|
|
@@ -416,6 +417,8 @@ program
|
|
|
416
417
|
}
|
|
417
418
|
|
|
418
419
|
const configPath = path.join(targetDir, 'config.yaml');
|
|
420
|
+
const vectorizerDir = path.join(targetDir, 'vectorizer');
|
|
421
|
+
const vectorsDir = path.join(targetDir, 'vectors');
|
|
419
422
|
const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
|
|
420
423
|
const backupDir = path.join(process.cwd(), `.opencode.backup-${timestamp}`);
|
|
421
424
|
|
|
@@ -423,13 +426,32 @@ program
|
|
|
423
426
|
spinner.text = 'Reading config.yaml...';
|
|
424
427
|
const configBackup = await fs.readFile(configPath, 'utf8');
|
|
425
428
|
|
|
429
|
+
// Check if vectorizer exists
|
|
430
|
+
const hasVectorizer = await fs.pathExists(path.join(vectorizerDir, 'node_modules'));
|
|
431
|
+
const hasVectors = await fs.pathExists(vectorsDir);
|
|
432
|
+
|
|
426
433
|
// Create full backup (unless --no-backup)
|
|
427
434
|
if (options.backup !== false) {
|
|
428
435
|
spinner.text = 'Creating backup...';
|
|
429
|
-
await fs.copy(targetDir, backupDir
|
|
436
|
+
await fs.copy(targetDir, backupDir, {
|
|
437
|
+
filter: (src) => !src.includes('node_modules') && !src.includes('vectors')
|
|
438
|
+
});
|
|
430
439
|
}
|
|
431
440
|
|
|
432
|
-
//
|
|
441
|
+
// Preserve vectorizer and vectors by moving them temporarily
|
|
442
|
+
const tempVectorizer = path.join(process.cwd(), '.vectorizer-temp');
|
|
443
|
+
const tempVectors = path.join(process.cwd(), '.vectors-temp');
|
|
444
|
+
|
|
445
|
+
if (hasVectorizer) {
|
|
446
|
+
spinner.text = 'Preserving vectorizer...';
|
|
447
|
+
await fs.move(vectorizerDir, tempVectorizer, { overwrite: true });
|
|
448
|
+
}
|
|
449
|
+
if (hasVectors) {
|
|
450
|
+
spinner.text = 'Preserving vector indexes...';
|
|
451
|
+
await fs.move(vectorsDir, tempVectors, { overwrite: true });
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
// Remove old .opencode directory
|
|
433
455
|
spinner.text = 'Removing old files...';
|
|
434
456
|
await fs.remove(targetDir);
|
|
435
457
|
|
|
@@ -437,6 +459,16 @@ program
|
|
|
437
459
|
spinner.text = 'Installing new version...';
|
|
438
460
|
await fs.copy(OPENCODE_SRC, targetDir);
|
|
439
461
|
|
|
462
|
+
// Restore vectorizer and vectors
|
|
463
|
+
if (hasVectorizer) {
|
|
464
|
+
spinner.text = 'Restoring vectorizer...';
|
|
465
|
+
await fs.move(tempVectorizer, vectorizerDir, { overwrite: true });
|
|
466
|
+
}
|
|
467
|
+
if (hasVectors) {
|
|
468
|
+
spinner.text = 'Restoring vector indexes...';
|
|
469
|
+
await fs.move(tempVectors, vectorsDir, { overwrite: true });
|
|
470
|
+
}
|
|
471
|
+
|
|
440
472
|
// Restore user's config.yaml
|
|
441
473
|
spinner.text = 'Restoring config.yaml...';
|
|
442
474
|
await fs.writeFile(configPath, configBackup);
|
|
@@ -448,7 +480,24 @@ program
|
|
|
448
480
|
console.log(chalk.gray(' You can delete it after verifying the update works.\n'));
|
|
449
481
|
}
|
|
450
482
|
|
|
451
|
-
console.log(chalk.green('✅ Your config.yaml was preserved
|
|
483
|
+
console.log(chalk.green('✅ Your config.yaml was preserved.'));
|
|
484
|
+
if (hasVectorizer) {
|
|
485
|
+
console.log(chalk.green('✅ Vectorizer was preserved.'));
|
|
486
|
+
}
|
|
487
|
+
if (hasVectors) {
|
|
488
|
+
console.log(chalk.green('✅ Vector indexes were preserved.'));
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Option to install/update vectorizer
|
|
492
|
+
if (options.vectorizer) {
|
|
493
|
+
console.log('');
|
|
494
|
+
await installVectorizer(targetDir);
|
|
495
|
+
} else if (!hasVectorizer) {
|
|
496
|
+
console.log(chalk.yellow('\n💡 Vectorizer not installed. Install with:'));
|
|
497
|
+
console.log(chalk.cyan(' npx opencode-workflow vectorizer install\n'));
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
console.log('');
|
|
452
501
|
|
|
453
502
|
} catch (error) {
|
|
454
503
|
spinner.fail(chalk.red('Failed to update'));
|
package/package.json
CHANGED