@code-rag/cli 0.1.1 → 0.1.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/dist/commands/index-cmd.js +29 -30
- package/dist/index.js +4 -1
- package/package.json +11 -11
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
2
|
import ora from 'ora';
|
|
3
3
|
import { writeFile, readFile, mkdir, appendFile, unlink } from 'node:fs/promises';
|
|
4
|
-
import { join, resolve, sep } from 'node:path';
|
|
4
|
+
import { basename, join, resolve, sep } from 'node:path';
|
|
5
5
|
import { createHash } from 'node:crypto';
|
|
6
6
|
import { existsSync } from 'node:fs';
|
|
7
|
-
import { loadConfig, createIgnoreFilter, FileScanner, TreeSitterParser, MarkdownParser, ASTChunker, OllamaClient, NLEnricher, OllamaEmbeddingProvider, OpenAICompatibleEmbeddingProvider, ModelLifecycleManager, LanceDBStore, BM25Index, GraphBuilder, DependencyGraph, scanForABReferences, IndexState,
|
|
7
|
+
import { loadConfig, createIgnoreFilter, FileScanner, TreeSitterParser, MarkdownParser, ASTChunker, OllamaClient, NLEnricher, OllamaEmbeddingProvider, OpenAICompatibleEmbeddingProvider, ModelLifecycleManager, LanceDBStore, BM25Index, GraphBuilder, DependencyGraph, scanForABReferences, IndexState, AzureDevOpsProvider, JiraProvider, ClickUpProvider, } from '@code-rag/core';
|
|
8
8
|
// ---------------------------------------------------------------------------
|
|
9
9
|
// Simple embedding provider factory — dispatches based on provider name
|
|
10
10
|
// (Used for non-lifecycle providers like openai-compatible and direct ollama)
|
|
@@ -870,7 +870,7 @@ export function registerIndexCommand(program) {
|
|
|
870
870
|
try {
|
|
871
871
|
// Multi-repo path: if repos are configured, index each independently
|
|
872
872
|
if (config.repos && config.repos.length > 0) {
|
|
873
|
-
await indexMultiRepo(config, storagePath, options, logger, startTime);
|
|
873
|
+
await indexMultiRepo(config, storagePath, options, logger, startTime, managed.provider);
|
|
874
874
|
return;
|
|
875
875
|
}
|
|
876
876
|
// Single-repo path
|
|
@@ -972,7 +972,7 @@ export function registerIndexCommand(program) {
|
|
|
972
972
|
* Multi-repo indexing: iterate configured repos, index each with separate
|
|
973
973
|
* progress reporting and per-repo storage directories.
|
|
974
974
|
*/
|
|
975
|
-
async function indexMultiRepo(config, storagePath, options, logger, startTime) {
|
|
975
|
+
async function indexMultiRepo(config, storagePath, options, logger, startTime, embeddingProvider) {
|
|
976
976
|
const repos = config.repos;
|
|
977
977
|
// eslint-disable-next-line no-console
|
|
978
978
|
console.log('');
|
|
@@ -980,38 +980,37 @@ async function indexMultiRepo(config, storagePath, options, logger, startTime) {
|
|
|
980
980
|
console.log(chalk.bold(`Indexing ${repos.length} repo(s)...`));
|
|
981
981
|
// eslint-disable-next-line no-console
|
|
982
982
|
console.log('');
|
|
983
|
-
const multiRepoIndexer = new MultiRepoIndexer(repos, storagePath);
|
|
984
983
|
let totalFiles = 0;
|
|
985
984
|
let totalChunks = 0;
|
|
986
985
|
let totalErrors = 0;
|
|
987
986
|
logger.start('Starting multi-repo indexing...');
|
|
988
|
-
const
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
}
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
987
|
+
for (const repo of repos) {
|
|
988
|
+
const repoName = repo.name ?? basename(repo.path);
|
|
989
|
+
const repoPath = resolve(repo.path);
|
|
990
|
+
const repoStoragePath = join(storagePath, repoName);
|
|
991
|
+
await mkdir(repoStoragePath, { recursive: true });
|
|
992
|
+
try {
|
|
993
|
+
const result = await indexSingleRepo(repoPath, repoStoragePath, config, options, logger, repoName, embeddingProvider);
|
|
994
|
+
totalFiles += result.filesProcessed;
|
|
995
|
+
totalChunks += result.chunksCreated;
|
|
996
|
+
if (result.filesProcessed === 0 && result.chunksCreated === 0 && result.parseErrors === 0) {
|
|
997
|
+
await logger.succeed(`[${repoName}] Up to date`);
|
|
998
|
+
}
|
|
999
|
+
else {
|
|
1000
|
+
await logger.succeed(`[${repoName}] ${result.filesProcessed} file(s), ${result.chunksCreated} chunks`);
|
|
1001
|
+
}
|
|
1002
|
+
if (result.parseErrors > 0) {
|
|
1003
|
+
totalErrors += result.parseErrors;
|
|
1004
|
+
for (const detail of result.parseErrorDetails.slice(0, 3)) {
|
|
1005
|
+
// eslint-disable-next-line no-console
|
|
1006
|
+
console.log(` ${chalk.gray('→')} ${detail.file}: ${chalk.yellow(detail.reason)}`);
|
|
1007
|
+
}
|
|
1008
1008
|
}
|
|
1009
1009
|
}
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
await logger.succeed(`[${repoResult.repoName}] ${repoResult.filesProcessed} file(s) processed`);
|
|
1010
|
+
catch (error) {
|
|
1011
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
1012
|
+
totalErrors++;
|
|
1013
|
+
await logger.fail(`[${repoName}] ${message}`);
|
|
1015
1014
|
}
|
|
1016
1015
|
}
|
|
1017
1016
|
// Total summary
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { Command } from 'commander';
|
|
3
|
+
import { createRequire } from 'node:module';
|
|
3
4
|
import { registerInitCommand } from './commands/init.js';
|
|
4
5
|
import { registerIndexCommand } from './commands/index-cmd.js';
|
|
5
6
|
import { registerSearchCommand } from './commands/search.js';
|
|
@@ -8,11 +9,13 @@ import { registerStatusCommand } from './commands/status.js';
|
|
|
8
9
|
import { registerViewerCommand } from './commands/viewer.js';
|
|
9
10
|
import { registerWatchCommand } from './commands/watch-cmd.js';
|
|
10
11
|
import { registerHooksCommand } from './commands/hooks-cmd.js';
|
|
12
|
+
const require = createRequire(import.meta.url);
|
|
13
|
+
const pkg = require('../package.json');
|
|
11
14
|
const program = new Command();
|
|
12
15
|
program
|
|
13
16
|
.name('coderag')
|
|
14
17
|
.description('CodeRAG — intelligent codebase context engine for AI coding agents')
|
|
15
|
-
.version(
|
|
18
|
+
.version(pkg.version);
|
|
16
19
|
registerInitCommand(program);
|
|
17
20
|
registerIndexCommand(program);
|
|
18
21
|
registerSearchCommand(program);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@code-rag/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "CLI tool for CodeRAG — init, index, search, serve, and status commands for codebase context engine",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -42,25 +42,25 @@
|
|
|
42
42
|
"types": "./dist/index.d.ts"
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"build": "tsc",
|
|
47
|
-
"clean": "rm -rf dist",
|
|
48
|
-
"test": "vitest run"
|
|
49
|
-
},
|
|
50
45
|
"dependencies": {
|
|
51
|
-
"@code-rag/api-server": "workspace:*",
|
|
52
|
-
"@code-rag/core": "workspace:*",
|
|
53
|
-
"@code-rag/mcp-server": "workspace:*",
|
|
54
46
|
"@inquirer/prompts": "^8.3.0",
|
|
55
47
|
"chalk": "^5.4.1",
|
|
56
48
|
"commander": "^13.1.0",
|
|
57
49
|
"ora": "^8.2.0",
|
|
58
|
-
"yaml": "^2.7.0"
|
|
50
|
+
"yaml": "^2.7.0",
|
|
51
|
+
"@code-rag/api-server": "0.1.3",
|
|
52
|
+
"@code-rag/mcp-server": "0.1.3",
|
|
53
|
+
"@code-rag/core": "0.1.3"
|
|
59
54
|
},
|
|
60
55
|
"devDependencies": {
|
|
61
56
|
"@types/node": "^22.13.4",
|
|
62
57
|
"@vitest/coverage-v8": "^3.0.5",
|
|
63
58
|
"typescript": "^5.7.3",
|
|
64
59
|
"vitest": "^3.0.5"
|
|
60
|
+
},
|
|
61
|
+
"scripts": {
|
|
62
|
+
"build": "tsc",
|
|
63
|
+
"clean": "rm -rf dist",
|
|
64
|
+
"test": "vitest run"
|
|
65
65
|
}
|
|
66
|
-
}
|
|
66
|
+
}
|