@comfanion/workflow 4.5.2 → 4.6.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 +10 -3
- package/package.json +1 -1
- package/src/build-info.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -637,6 +637,7 @@ program
|
|
|
637
637
|
.command('index')
|
|
638
638
|
.description('Index codebase for semantic search')
|
|
639
639
|
.option('-i, --index <name>', 'Index name: code, docs, config, all, or custom', 'code')
|
|
640
|
+
.option('-d, --dir <path>', 'Directory to index (default: current directory)')
|
|
640
641
|
.option('-p, --pattern <glob>', 'File pattern (overrides preset)')
|
|
641
642
|
.option('--force', 'Re-index all files (ignore cache)')
|
|
642
643
|
.option('--list', 'List all indexes and their stats')
|
|
@@ -703,6 +704,11 @@ program
|
|
|
703
704
|
const { glob } = await import('glob');
|
|
704
705
|
const { default: ignore } = await import('ignore');
|
|
705
706
|
|
|
707
|
+
// Determine base directory
|
|
708
|
+
const baseDir = options.dir
|
|
709
|
+
? path.resolve(process.cwd(), options.dir)
|
|
710
|
+
: process.cwd();
|
|
711
|
+
|
|
706
712
|
// Load .gitignore
|
|
707
713
|
let ig = ignore();
|
|
708
714
|
try {
|
|
@@ -711,16 +717,17 @@ program
|
|
|
711
717
|
} catch {}
|
|
712
718
|
ig.add(['node_modules', '.git', 'dist', 'build', '.opencode/vectors', '.opencode/vectorizer']);
|
|
713
719
|
|
|
714
|
-
const files = await glob(pattern, { cwd:
|
|
720
|
+
const files = await glob(pattern, { cwd: baseDir, nodir: true });
|
|
715
721
|
const filtered = files.filter(f => !ig.ignores(f));
|
|
716
722
|
|
|
717
|
-
|
|
723
|
+
const dirLabel = options.dir ? ` in ${options.dir}` : '';
|
|
724
|
+
spinner.succeed(`Found ${filtered.length} files for index "${indexName}"${dirLabel}`);
|
|
718
725
|
|
|
719
726
|
let indexed = 0;
|
|
720
727
|
let skipped = 0;
|
|
721
728
|
|
|
722
729
|
for (const file of filtered) {
|
|
723
|
-
const filePath = path.join(
|
|
730
|
+
const filePath = path.join(baseDir, file);
|
|
724
731
|
spinner.start(`[${indexName}] Indexing: ${file}`);
|
|
725
732
|
|
|
726
733
|
try {
|
package/package.json
CHANGED