bluera-knowledge 0.9.32 → 0.9.34
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/.claude/hooks/post-edit-check.sh +5 -3
- package/.claude/skills/atomic-commits/SKILL.md +3 -1
- package/.husky/pre-commit +3 -2
- package/.prettierrc +9 -0
- package/.versionrc.json +1 -1
- package/CHANGELOG.md +33 -0
- package/CLAUDE.md +6 -0
- package/README.md +25 -13
- package/bun.lock +277 -33
- package/dist/{chunk-L2YVNC63.js → chunk-6FHWC36B.js} +9 -1
- package/dist/chunk-6FHWC36B.js.map +1 -0
- package/dist/{chunk-RST4XGRL.js → chunk-DC7CGSGT.js} +288 -241
- package/dist/chunk-DC7CGSGT.js.map +1 -0
- package/dist/{chunk-6PBP5DVD.js → chunk-WFNPNAAP.js} +3212 -3054
- package/dist/chunk-WFNPNAAP.js.map +1 -0
- package/dist/{chunk-WT2DAEO7.js → chunk-Z2KKVH45.js} +548 -482
- package/dist/chunk-Z2KKVH45.js.map +1 -0
- package/dist/index.js +871 -758
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +3 -3
- package/dist/watch.service-BJV3TI3F.js +7 -0
- package/dist/workers/background-worker-cli.js +46 -45
- package/dist/workers/background-worker-cli.js.map +1 -1
- package/eslint.config.js +43 -1
- package/package.json +18 -11
- package/plugin.json +8 -0
- package/python/requirements.txt +1 -1
- package/src/analysis/ast-parser.test.ts +12 -11
- package/src/analysis/ast-parser.ts +28 -22
- package/src/analysis/code-graph.test.ts +52 -62
- package/src/analysis/code-graph.ts +9 -13
- package/src/analysis/dependency-usage-analyzer.test.ts +91 -271
- package/src/analysis/dependency-usage-analyzer.ts +52 -24
- package/src/analysis/go-ast-parser.test.ts +22 -22
- package/src/analysis/go-ast-parser.ts +18 -25
- package/src/analysis/parser-factory.test.ts +9 -9
- package/src/analysis/parser-factory.ts +3 -3
- package/src/analysis/python-ast-parser.test.ts +27 -27
- package/src/analysis/python-ast-parser.ts +2 -2
- package/src/analysis/repo-url-resolver.test.ts +82 -82
- package/src/analysis/rust-ast-parser.test.ts +19 -19
- package/src/analysis/rust-ast-parser.ts +17 -27
- package/src/analysis/tree-sitter-parser.test.ts +3 -3
- package/src/analysis/tree-sitter-parser.ts +10 -16
- package/src/cli/commands/crawl.test.ts +40 -24
- package/src/cli/commands/crawl.ts +186 -166
- package/src/cli/commands/index-cmd.test.ts +90 -90
- package/src/cli/commands/index-cmd.ts +52 -36
- package/src/cli/commands/mcp.test.ts +6 -6
- package/src/cli/commands/mcp.ts +2 -2
- package/src/cli/commands/plugin-api.test.ts +16 -18
- package/src/cli/commands/plugin-api.ts +9 -6
- package/src/cli/commands/search.test.ts +16 -7
- package/src/cli/commands/search.ts +124 -87
- package/src/cli/commands/serve.test.ts +67 -25
- package/src/cli/commands/serve.ts +18 -3
- package/src/cli/commands/setup.test.ts +176 -101
- package/src/cli/commands/setup.ts +140 -117
- package/src/cli/commands/store.test.ts +82 -53
- package/src/cli/commands/store.ts +56 -37
- package/src/cli/program.ts +2 -2
- package/src/crawl/article-converter.test.ts +4 -1
- package/src/crawl/article-converter.ts +46 -31
- package/src/crawl/bridge.test.ts +240 -132
- package/src/crawl/bridge.ts +87 -30
- package/src/crawl/claude-client.test.ts +124 -56
- package/src/crawl/claude-client.ts +7 -15
- package/src/crawl/intelligent-crawler.test.ts +65 -22
- package/src/crawl/intelligent-crawler.ts +86 -53
- package/src/crawl/markdown-utils.ts +1 -4
- package/src/db/embeddings.ts +4 -6
- package/src/db/lance.test.ts +4 -4
- package/src/db/lance.ts +16 -12
- package/src/index.ts +26 -17
- package/src/logging/index.ts +1 -5
- package/src/logging/logger.ts +3 -5
- package/src/logging/payload.test.ts +1 -1
- package/src/logging/payload.ts +3 -5
- package/src/mcp/commands/index.ts +2 -2
- package/src/mcp/commands/job.commands.ts +12 -18
- package/src/mcp/commands/meta.commands.ts +13 -13
- package/src/mcp/commands/registry.ts +5 -8
- package/src/mcp/commands/store.commands.ts +19 -19
- package/src/mcp/handlers/execute.handler.test.ts +10 -10
- package/src/mcp/handlers/execute.handler.ts +4 -5
- package/src/mcp/handlers/index.ts +10 -14
- package/src/mcp/handlers/job.handler.test.ts +10 -10
- package/src/mcp/handlers/job.handler.ts +22 -25
- package/src/mcp/handlers/search.handler.test.ts +36 -65
- package/src/mcp/handlers/search.handler.ts +135 -104
- package/src/mcp/handlers/store.handler.test.ts +41 -52
- package/src/mcp/handlers/store.handler.ts +108 -88
- package/src/mcp/schemas/index.test.ts +73 -68
- package/src/mcp/schemas/index.ts +18 -12
- package/src/mcp/server.test.ts +1 -1
- package/src/mcp/server.ts +59 -46
- package/src/plugin/commands.test.ts +230 -95
- package/src/plugin/commands.ts +24 -25
- package/src/plugin/dependency-analyzer.test.ts +52 -52
- package/src/plugin/dependency-analyzer.ts +85 -22
- package/src/plugin/git-clone.test.ts +24 -13
- package/src/plugin/git-clone.ts +3 -7
- package/src/server/app.test.ts +109 -109
- package/src/server/app.ts +32 -23
- package/src/server/index.test.ts +64 -66
- package/src/services/chunking.service.test.ts +32 -32
- package/src/services/chunking.service.ts +16 -9
- package/src/services/code-graph.service.test.ts +30 -36
- package/src/services/code-graph.service.ts +24 -10
- package/src/services/code-unit.service.test.ts +55 -11
- package/src/services/code-unit.service.ts +85 -11
- package/src/services/config.service.test.ts +37 -18
- package/src/services/config.service.ts +30 -7
- package/src/services/index.service.test.ts +49 -18
- package/src/services/index.service.ts +98 -48
- package/src/services/index.ts +6 -9
- package/src/services/job.service.test.ts +22 -22
- package/src/services/job.service.ts +18 -18
- package/src/services/project-root.service.test.ts +1 -3
- package/src/services/search.service.test.ts +248 -120
- package/src/services/search.service.ts +286 -156
- package/src/services/services.test.ts +1 -1
- package/src/services/snippet.service.test.ts +14 -6
- package/src/services/snippet.service.ts +7 -5
- package/src/services/store.service.test.ts +68 -29
- package/src/services/store.service.ts +41 -12
- package/src/services/watch.service.test.ts +34 -14
- package/src/services/watch.service.ts +11 -1
- package/src/types/brands.test.ts +3 -1
- package/src/types/index.ts +2 -13
- package/src/types/search.ts +10 -8
- package/src/utils/type-guards.test.ts +20 -15
- package/src/utils/type-guards.ts +1 -1
- package/src/workers/background-worker-cli.ts +2 -2
- package/src/workers/background-worker.test.ts +54 -40
- package/src/workers/background-worker.ts +76 -60
- package/src/workers/spawn-worker.test.ts +22 -10
- package/src/workers/spawn-worker.ts +6 -6
- package/tests/analysis/ast-parser.test.ts +3 -3
- package/tests/analysis/code-graph.test.ts +5 -5
- package/tests/fixtures/code-snippets/api/error-handling.ts +4 -15
- package/tests/fixtures/code-snippets/api/rest-controller.ts +3 -9
- package/tests/fixtures/code-snippets/auth/jwt-auth.ts +5 -21
- package/tests/fixtures/code-snippets/auth/oauth-flow.ts +4 -4
- package/tests/fixtures/code-snippets/database/repository-pattern.ts +11 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/handler.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-pages/handler.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/serve-static.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/client/client.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/client/types.ts +22 -20
- package/tests/fixtures/corpus/oss-repos/hono/src/context.ts +13 -10
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/accepts/accepts.ts +10 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/adapter/index.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/css/index.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/factory/index.ts +16 -16
- package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/ssg.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/hono-base.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/hono.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/css.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/intrinsic-element/components.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/render.ts +7 -7
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/hooks/index.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-element/components.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/jsx/utils.ts +6 -6
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jsx-renderer/index.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/middleware/serve-static/index.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/preset/quick.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/preset/tiny.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/router/pattern-router/router.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/node.ts +4 -4
- package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/router.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/node.ts +1 -1
- package/tests/fixtures/corpus/oss-repos/hono/src/types.ts +166 -169
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/body.ts +8 -8
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/color.ts +3 -3
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/cookie.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/encode.ts +2 -2
- package/tests/fixtures/corpus/oss-repos/hono/src/utils/types.ts +30 -33
- package/tests/fixtures/corpus/oss-repos/hono/src/validator/validator.ts +2 -2
- package/tests/fixtures/test-server.ts +3 -2
- package/tests/helpers/performance-metrics.ts +8 -25
- package/tests/helpers/search-relevance.ts +14 -69
- package/tests/integration/cli-consistency.test.ts +5 -4
- package/tests/integration/python-bridge.test.ts +13 -3
- package/tests/mcp/server.test.ts +1 -1
- package/tests/services/code-unit.service.test.ts +48 -0
- package/tests/services/job.service.test.ts +124 -0
- package/tests/services/search.progressive-context.test.ts +2 -2
- package/.claude-plugin/plugin.json +0 -13
- package/dist/chunk-6PBP5DVD.js.map +0 -1
- package/dist/chunk-L2YVNC63.js.map +0 -1
- package/dist/chunk-RST4XGRL.js.map +0 -1
- package/dist/chunk-WT2DAEO7.js.map +0 -1
- package/dist/watch.service-YAIKKDCF.js +0 -7
- package/skills/atomic-commits/SKILL.md +0 -77
- /package/dist/{watch.service-YAIKKDCF.js.map → watch.service-BJV3TI3F.js.map} +0 -0
|
@@ -1,153 +1,176 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import { spawnSync } from 'node:child_process';
|
|
3
2
|
import { existsSync } from 'node:fs';
|
|
4
3
|
import { mkdir } from 'node:fs/promises';
|
|
5
|
-
import { join } from 'node:path';
|
|
6
4
|
import { homedir } from 'node:os';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
import { Command } from 'commander';
|
|
7
7
|
import ora from 'ora';
|
|
8
|
-
import { createServices, destroyServices } from '../../services/index.js';
|
|
9
8
|
import { DEFAULT_REPOS, type DefaultRepo } from '../../defaults/repos.js';
|
|
9
|
+
import { createServices, destroyServices } from '../../services/index.js';
|
|
10
10
|
import type { GlobalOptions } from '../program.js';
|
|
11
11
|
|
|
12
12
|
const DEFAULT_REPOS_DIR = join(homedir(), '.bluera', 'bluera-knowledge', 'repos');
|
|
13
13
|
|
|
14
14
|
export function createSetupCommand(getOptions: () => GlobalOptions): Command {
|
|
15
|
-
const setup = new Command('setup')
|
|
16
|
-
|
|
15
|
+
const setup = new Command('setup').description(
|
|
16
|
+
'Quick-start with pre-configured Claude/Anthropic documentation repos'
|
|
17
|
+
);
|
|
17
18
|
|
|
18
19
|
setup
|
|
19
20
|
.command('repos')
|
|
20
|
-
.description(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
.option(
|
|
21
|
+
.description(
|
|
22
|
+
'Clone repos to ~/.bluera/bluera-knowledge/repos/, create stores, index all content'
|
|
23
|
+
)
|
|
24
|
+
.option(
|
|
25
|
+
'--repos-dir <path>',
|
|
26
|
+
'Clone destination (default: ~/.bluera/bluera-knowledge/repos/)',
|
|
27
|
+
DEFAULT_REPOS_DIR
|
|
28
|
+
)
|
|
29
|
+
.option('--skip-clone', "Don't clone; assume repos already exist locally")
|
|
30
|
+
.option('--skip-index', "Clone and create stores but don't index yet")
|
|
24
31
|
.option('--only <names>', 'Only process matching repos (comma-separated, partial match)')
|
|
25
32
|
.option('--list', 'Print available repos without cloning/indexing')
|
|
26
|
-
.action(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const services = await createServices(globalOpts.config, globalOpts.dataDir);
|
|
49
|
-
try {
|
|
50
|
-
// Filter repos if --only specified
|
|
51
|
-
let repos: readonly DefaultRepo[] = DEFAULT_REPOS;
|
|
52
|
-
if (options.only !== undefined && options.only !== '') {
|
|
53
|
-
const onlyNames = options.only.split(',').map(n => n.trim().toLowerCase());
|
|
54
|
-
repos = DEFAULT_REPOS.filter(r =>
|
|
55
|
-
onlyNames.some(n => r.name.toLowerCase().includes(n))
|
|
56
|
-
);
|
|
57
|
-
if (repos.length === 0) {
|
|
58
|
-
console.error(`No repos matched: ${options.only}`);
|
|
59
|
-
console.log('Available repos:', DEFAULT_REPOS.map(r => r.name).join(', '));
|
|
60
|
-
process.exit(1);
|
|
33
|
+
.action(
|
|
34
|
+
async (options: {
|
|
35
|
+
reposDir: string;
|
|
36
|
+
skipClone?: boolean;
|
|
37
|
+
skipIndex?: boolean;
|
|
38
|
+
only?: string;
|
|
39
|
+
list?: boolean;
|
|
40
|
+
}) => {
|
|
41
|
+
const globalOpts = getOptions();
|
|
42
|
+
|
|
43
|
+
// List mode: just show available repos
|
|
44
|
+
if (options.list === true) {
|
|
45
|
+
console.log('\nDefault repositories:\n');
|
|
46
|
+
for (const repo of DEFAULT_REPOS) {
|
|
47
|
+
console.log(` ${repo.name}`);
|
|
48
|
+
console.log(` URL: ${repo.url}`);
|
|
49
|
+
console.log(` Description: ${repo.description}`);
|
|
50
|
+
console.log(` Tags: ${repo.tags.join(', ')}`);
|
|
51
|
+
console.log('');
|
|
61
52
|
}
|
|
53
|
+
return;
|
|
62
54
|
}
|
|
63
55
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
56
|
+
const services = await createServices(globalOpts.config, globalOpts.dataDir);
|
|
57
|
+
try {
|
|
58
|
+
// Filter repos if --only specified
|
|
59
|
+
let repos: readonly DefaultRepo[] = DEFAULT_REPOS;
|
|
60
|
+
if (options.only !== undefined && options.only !== '') {
|
|
61
|
+
const onlyNames = options.only.split(',').map((n) => n.trim().toLowerCase());
|
|
62
|
+
repos = DEFAULT_REPOS.filter((r) =>
|
|
63
|
+
onlyNames.some((n) => r.name.toLowerCase().includes(n))
|
|
64
|
+
);
|
|
65
|
+
if (repos.length === 0) {
|
|
66
|
+
console.error(`No repos matched: ${options.only}`);
|
|
67
|
+
console.log('Available repos:', DEFAULT_REPOS.map((r) => r.name).join(', '));
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
|
|
89
|
-
: '
|
|
90
|
-
|
|
72
|
+
console.log(`\nSetting up ${String(repos.length)} repositories...\n`);
|
|
73
|
+
|
|
74
|
+
// Ensure repos directory exists
|
|
75
|
+
await mkdir(options.reposDir, { recursive: true });
|
|
76
|
+
|
|
77
|
+
for (const repo of repos) {
|
|
78
|
+
const repoPath = join(options.reposDir, repo.name);
|
|
79
|
+
const spinner = ora(`Processing ${repo.name}`).start();
|
|
80
|
+
|
|
81
|
+
try {
|
|
82
|
+
// Step 1: Clone if needed
|
|
83
|
+
if (options.skipClone !== true) {
|
|
84
|
+
if (existsSync(repoPath)) {
|
|
85
|
+
spinner.text = `${repo.name}: Already cloned, pulling latest...`;
|
|
86
|
+
const pullResult = spawnSync('git', ['pull', '--ff-only'], {
|
|
87
|
+
cwd: repoPath,
|
|
88
|
+
stdio: 'pipe',
|
|
89
|
+
});
|
|
90
|
+
if (pullResult.status !== 0) {
|
|
91
|
+
// Pull failed (maybe diverged), that's okay
|
|
92
|
+
spinner.text = `${repo.name}: Pull skipped (local changes)`;
|
|
93
|
+
}
|
|
94
|
+
} else {
|
|
95
|
+
spinner.text = `${repo.name}: Cloning...`;
|
|
96
|
+
const cloneResult = spawnSync('git', ['clone', repo.url, repoPath], {
|
|
97
|
+
stdio: 'pipe',
|
|
98
|
+
});
|
|
99
|
+
if (cloneResult.status !== 0) {
|
|
100
|
+
const errorMessage =
|
|
101
|
+
cloneResult.stderr.length > 0
|
|
102
|
+
? cloneResult.stderr.toString()
|
|
103
|
+
: 'Git clone failed';
|
|
104
|
+
throw new Error(errorMessage);
|
|
105
|
+
}
|
|
91
106
|
}
|
|
92
107
|
}
|
|
93
|
-
}
|
|
94
108
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
let storeId: string;
|
|
100
|
-
if (existingStore) {
|
|
101
|
-
storeId = existingStore.id;
|
|
102
|
-
spinner.text = `${repo.name}: Store already exists`;
|
|
103
|
-
} else {
|
|
104
|
-
const result = await services.store.create({
|
|
105
|
-
name: repo.name,
|
|
106
|
-
type: 'repo',
|
|
107
|
-
path: repoPath,
|
|
108
|
-
description: repo.description,
|
|
109
|
-
tags: repo.tags,
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
if (!result.success) {
|
|
113
|
-
throw new Error(result.error instanceof Error ? result.error.message : String(result.error));
|
|
114
|
-
}
|
|
115
|
-
storeId = result.data.id;
|
|
116
|
-
}
|
|
109
|
+
// Step 2: Create store if needed
|
|
110
|
+
spinner.text = `${repo.name}: Creating store...`;
|
|
111
|
+
const existingStore = await services.store.getByIdOrName(repo.name);
|
|
117
112
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
await services.
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
let storeId: string;
|
|
114
|
+
if (existingStore) {
|
|
115
|
+
storeId = existingStore.id;
|
|
116
|
+
spinner.text = `${repo.name}: Store already exists`;
|
|
117
|
+
} else {
|
|
118
|
+
const result = await services.store.create({
|
|
119
|
+
name: repo.name,
|
|
120
|
+
type: 'repo',
|
|
121
|
+
path: repoPath,
|
|
122
|
+
description: repo.description,
|
|
123
|
+
tags: repo.tags,
|
|
128
124
|
});
|
|
129
125
|
|
|
130
|
-
if (
|
|
131
|
-
|
|
132
|
-
|
|
126
|
+
if (!result.success) {
|
|
127
|
+
throw new Error(
|
|
128
|
+
result.error instanceof Error ? result.error.message : String(result.error)
|
|
133
129
|
);
|
|
134
|
-
} else {
|
|
135
|
-
throw new Error(indexResult.error instanceof Error ? indexResult.error.message : String(indexResult.error));
|
|
136
130
|
}
|
|
131
|
+
storeId = result.data.id;
|
|
137
132
|
}
|
|
138
|
-
|
|
139
|
-
|
|
133
|
+
|
|
134
|
+
// Step 3: Index if needed
|
|
135
|
+
if (options.skipIndex !== true) {
|
|
136
|
+
spinner.text = `${repo.name}: Indexing...`;
|
|
137
|
+
const store = await services.store.getByIdOrName(storeId);
|
|
138
|
+
if (store) {
|
|
139
|
+
await services.lance.initialize(store.id);
|
|
140
|
+
const indexResult = await services.index.indexStore(store, (event) => {
|
|
141
|
+
if (event.type === 'progress') {
|
|
142
|
+
spinner.text = `${repo.name}: Indexing ${String(event.current)}/${String(event.total)} files`;
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (indexResult.success) {
|
|
147
|
+
spinner.succeed(
|
|
148
|
+
`${repo.name}: ${String(indexResult.data.documentsIndexed)} docs, ${String(indexResult.data.chunksCreated)} chunks`
|
|
149
|
+
);
|
|
150
|
+
} else {
|
|
151
|
+
throw new Error(
|
|
152
|
+
indexResult.error instanceof Error
|
|
153
|
+
? indexResult.error.message
|
|
154
|
+
: String(indexResult.error)
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
} else {
|
|
159
|
+
spinner.succeed(`${repo.name}: Ready (indexing skipped)`);
|
|
160
|
+
}
|
|
161
|
+
} catch (error) {
|
|
162
|
+
spinner.fail(
|
|
163
|
+
`${repo.name}: ${error instanceof Error ? error.message : String(error)}`
|
|
164
|
+
);
|
|
140
165
|
}
|
|
141
|
-
} catch (error) {
|
|
142
|
-
spinner.fail(`${repo.name}: ${error instanceof Error ? error.message : String(error)}`);
|
|
143
166
|
}
|
|
144
|
-
}
|
|
145
167
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
168
|
+
console.log('\nSetup complete! Use "bluera-knowledge search <query>" to search.\n');
|
|
169
|
+
} finally {
|
|
170
|
+
await destroyServices(services);
|
|
171
|
+
}
|
|
149
172
|
}
|
|
150
|
-
|
|
173
|
+
);
|
|
151
174
|
|
|
152
175
|
return setup;
|
|
153
176
|
}
|