@comfanion/workflow 4.6.1 → 4.7.1

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 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
- // Remove old .opencode directory completely
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.\n'));
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfanion/workflow",
3
- "version": "4.6.1",
3
+ "version": "4.7.1",
4
4
  "description": "Initialize OpenCode Workflow system for AI-assisted development with semantic code search",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "3.0.0",
3
- "buildDate": "2026-01-24T09:22:58.323Z",
3
+ "buildDate": "2026-01-24T09:28:33.562Z",
4
4
  "files": [
5
5
  "config.yaml",
6
6
  "FLOW.yaml",
@@ -93,8 +93,8 @@ This will download the embedding model (~100MB) and set up the vector database.`
93
93
  output += `⚠️ **No indexes created yet**\n\n`
94
94
  output += `Create indexes with:\n`
95
95
  output += `\`\`\`bash\n`
96
- output += `npx opencode-workflow index --index code\n`
97
- output += `npx opencode-workflow index --index docs --dir docs/\n`
96
+ output += `npx @comfanion/workflow index --index code\n`
97
+ output += `npx @comfanion/workflow index --index docs --dir docs/\n`
98
98
  output += `\`\`\`\n`
99
99
  } else {
100
100
  output += `### Active Indexes\n\n`
@@ -153,7 +153,7 @@ codesearch({ query: "your search query", index: "${indexName}" })
153
153
 
154
154
  To re-index:
155
155
  \`\`\`bash
156
- npx opencode-workflow index --index ${indexName}
156
+ npx @comfanion/workflow index --index ${indexName}
157
157
  \`\`\``
158
158
 
159
159
  } catch {
@@ -164,9 +164,9 @@ npx opencode-workflow index --index ${indexName}
164
164
 
165
165
  To create this index:
166
166
  \`\`\`bash
167
- npx opencode-workflow index --index ${indexName}
167
+ npx @comfanion/workflow index --index ${indexName}
168
168
  # Or with specific directory:
169
- npx opencode-workflow index --index ${indexName} --dir src/
169
+ npx @comfanion/workflow index --index ${indexName} --dir src/
170
170
  \`\`\``
171
171
  }
172
172
  }
@@ -174,7 +174,7 @@ npx opencode-workflow index --index ${indexName} --dir src/
174
174
  // REINDEX: Re-index using CLI
175
175
  if (args.action === "reindex") {
176
176
  try {
177
- execSync(`npx opencode-workflow index --index ${indexName}`, {
177
+ execSync(`npx @comfanion/workflow index --index ${indexName}`, {
178
178
  cwd: projectRoot,
179
179
  encoding: "utf8",
180
180
  timeout: 300000, // 5 min
@@ -201,7 +201,7 @@ codesearch({ query: "your search query", index: "${indexName}" })
201
201
 
202
202
  Try manually:
203
203
  \`\`\`bash
204
- npx opencode-workflow index --index ${indexName} --force
204
+ npx @comfanion/workflow index --index ${indexName} --force
205
205
  \`\`\``
206
206
  }
207
207
  }
@@ -12,9 +12,9 @@
12
12
  * codesearch({ query: "error handling", searchAll: true })
13
13
  *
14
14
  * Prerequisites:
15
- * npx opencode-workflow vectorizer install
16
- * npx opencode-workflow index --index code
17
- * npx opencode-workflow index --index docs
15
+ * npx @comfanion/workflow vectorizer install
16
+ * npx @comfanion/workflow index --index code
17
+ * npx @comfanion/workflow index --index docs
18
18
  */
19
19
 
20
20
  import { tool } from "@opencode-ai/plugin"
@@ -36,7 +36,7 @@ Examples:
36
36
  - "how to deploy" with index: "docs" → finds deployment docs
37
37
  - "API keys" with index: "config" → finds config with API settings
38
38
 
39
- Prerequisites: Run 'npx opencode-workflow index --index <name>' first.`,
39
+ Prerequisites: Run 'npx @comfanion/workflow index --index <name>' first.`,
40
40
 
41
41
  args: {
42
42
  query: tool.schema.string().describe("Semantic search query describing what you're looking for"),
@@ -54,7 +54,7 @@ Prerequisites: Run 'npx opencode-workflow index --index <name>' first.`,
54
54
  try {
55
55
  await fs.access(path.join(vectorizerDir, "node_modules"))
56
56
  } catch {
57
- return `❌ Vectorizer not installed. Run: npx opencode-workflow vectorizer install`
57
+ return `❌ Vectorizer not installed. Run: npx @comfanion/workflow vectorizer install`
58
58
  }
59
59
 
60
60
  try {
@@ -71,7 +71,7 @@ Prerequisites: Run 'npx opencode-workflow index --index <name>' first.`,
71
71
  const indexes = await tempIndexer.listIndexes()
72
72
 
73
73
  if (indexes.length === 0) {
74
- return `❌ No indexes found. Run: npx opencode-workflow index --index code`
74
+ return `❌ No indexes found. Run: npx @comfanion/workflow index --index code`
75
75
  }
76
76
 
77
77
  for (const idx of indexes) {
@@ -90,7 +90,7 @@ Prerequisites: Run 'npx opencode-workflow index --index <name>' first.`,
90
90
  try {
91
91
  await fs.access(hashesFile)
92
92
  } catch {
93
- return `❌ Index "${indexName}" not found. Run: npx opencode-workflow index --index ${indexName}`
93
+ return `❌ Index "${indexName}" not found. Run: npx @comfanion/workflow index --index ${indexName}`
94
94
  }
95
95
 
96
96
  const indexer = await new CodebaseIndexer(projectRoot, indexName).init()
@@ -100,7 +100,7 @@ Prerequisites: Run 'npx opencode-workflow index --index <name>' first.`,
100
100
 
101
101
  if (allResults.length === 0) {
102
102
  const scope = args.searchAll ? "any index" : `index "${indexName}"`
103
- return `No results found in ${scope} for: "${args.query}"\n\nTry:\n- Different keywords\n- Re-index with: npx opencode-workflow index --index ${indexName} --force`
103
+ return `No results found in ${scope} for: "${args.query}"\n\nTry:\n- Different keywords\n- Re-index with: npx @comfanion/workflow index --index ${indexName} --force`
104
104
  }
105
105
 
106
106
  // Format results for the model
@@ -128,7 +128,7 @@ Prerequisites: Run 'npx opencode-workflow index --index <name>' first.`,
128
128
  return output
129
129
 
130
130
  } catch (error: any) {
131
- return `❌ Search failed: ${error.message}\n\nTry re-indexing: npx opencode-workflow index --index ${args.index || "code"} --force`
131
+ return `❌ Search failed: ${error.message}\n\nTry re-indexing: npx @comfanion/workflow index --index ${args.index || "code"} --force`
132
132
  }
133
133
  },
134
134
  })