bluera-knowledge 0.9.25 → 0.9.30
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/commands/commit.md +4 -7
- package/.claude/hooks/post-edit-check.sh +21 -24
- package/.claude/skills/atomic-commits/SKILL.md +6 -0
- package/.claude-plugin/plugin.json +1 -1
- package/.env.example +4 -0
- package/.husky/pre-push +12 -2
- package/.versionrc.json +0 -4
- package/CHANGELOG.md +76 -0
- package/README.md +55 -20
- package/bun.lock +35 -1
- package/commands/crawl.md +2 -0
- package/dist/{chunk-BICFAWMN.js → chunk-DNOIM7BO.js} +73 -8
- package/dist/chunk-DNOIM7BO.js.map +1 -0
- package/dist/{chunk-5QMHZUC4.js → chunk-NJUMU4X2.js} +462 -105
- package/dist/chunk-NJUMU4X2.js.map +1 -0
- package/dist/{chunk-J7J6LXOJ.js → chunk-SZNTYLYT.js} +106 -41
- package/dist/chunk-SZNTYLYT.js.map +1 -0
- package/dist/index.js +65 -25
- package/dist/index.js.map +1 -1
- package/dist/mcp/server.js +2 -2
- package/dist/workers/background-worker-cli.js +2 -2
- package/eslint.config.js +1 -1
- package/package.json +3 -1
- package/src/analysis/ast-parser.test.ts +46 -0
- package/src/cli/commands/crawl.test.ts +99 -12
- package/src/cli/commands/crawl.ts +76 -24
- package/src/crawl/article-converter.ts +36 -1
- package/src/crawl/bridge.ts +18 -7
- package/src/crawl/intelligent-crawler.ts +45 -4
- package/src/db/embeddings.test.ts +16 -0
- package/src/logging/index.ts +29 -0
- package/src/logging/logger.test.ts +75 -0
- package/src/logging/logger.ts +147 -0
- package/src/logging/payload.test.ts +152 -0
- package/src/logging/payload.ts +121 -0
- package/src/mcp/handlers/search.handler.test.ts +28 -9
- package/src/mcp/handlers/search.handler.ts +69 -29
- package/src/mcp/handlers/store.handler.test.ts +1 -0
- package/src/mcp/server.ts +44 -16
- package/src/services/chunking.service.ts +23 -0
- package/src/services/index.service.test.ts +921 -1
- package/src/services/index.service.ts +76 -1
- package/src/services/index.ts +10 -1
- package/src/services/search.service.test.ts +573 -21
- package/src/services/search.service.ts +257 -105
- package/src/services/snippet.service.ts +28 -3
- package/src/services/token.service.test.ts +45 -0
- package/src/services/token.service.ts +33 -0
- package/src/types/result.test.ts +10 -0
- package/src/workers/spawn-worker.test.ts +19 -21
- package/tests/integration/cli-consistency.test.ts +1 -4
- package/vitest.config.ts +4 -0
- package/dist/chunk-5QMHZUC4.js.map +0 -1
- package/dist/chunk-BICFAWMN.js.map +0 -1
- package/dist/chunk-J7J6LXOJ.js.map +0 -1
- package/scripts/readme-version-updater.cjs +0 -18
|
@@ -22,27 +22,26 @@ describe('spawnBackgroundWorker', () => {
|
|
|
22
22
|
it('should use tsx in development mode (src folder)', () => {
|
|
23
23
|
spawnBackgroundWorker('test-job', '/test/data');
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
const command =
|
|
27
|
-
const args = callArgs?.[1];
|
|
25
|
+
expect(mockSpawn).toHaveBeenCalledTimes(1);
|
|
26
|
+
const [command, args] = mockSpawn.mock.calls[0] as [string, string[], object];
|
|
28
27
|
|
|
29
28
|
// In development (src folder), should use npx tsx
|
|
30
29
|
expect(command).toBe('npx');
|
|
31
|
-
expect(args
|
|
30
|
+
expect(args[0]).toBe('tsx');
|
|
32
31
|
});
|
|
33
32
|
|
|
34
33
|
it('should spawn a background worker process', () => {
|
|
35
34
|
spawnBackgroundWorker('test-job-id', '/test/data/dir');
|
|
36
35
|
|
|
37
|
-
expect(mockSpawn).
|
|
38
|
-
expect(mockUnref).
|
|
36
|
+
expect(mockSpawn).toHaveBeenCalledTimes(1);
|
|
37
|
+
expect(mockUnref).toHaveBeenCalledTimes(1);
|
|
39
38
|
});
|
|
40
39
|
|
|
41
40
|
it('should pass job ID as argument', () => {
|
|
42
41
|
spawnBackgroundWorker('my-job-123', '/test/data/dir');
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
const args =
|
|
43
|
+
expect(mockSpawn).toHaveBeenCalledTimes(1);
|
|
44
|
+
const [, args] = mockSpawn.mock.calls[0] as [string, string[], object];
|
|
46
45
|
|
|
47
46
|
expect(args).toContain('my-job-123');
|
|
48
47
|
});
|
|
@@ -50,8 +49,8 @@ describe('spawnBackgroundWorker', () => {
|
|
|
50
49
|
it('should spawn detached process with ignored stdio', () => {
|
|
51
50
|
spawnBackgroundWorker('test-job', '/test/data/dir');
|
|
52
51
|
|
|
53
|
-
|
|
54
|
-
const options =
|
|
52
|
+
expect(mockSpawn).toHaveBeenCalledTimes(1);
|
|
53
|
+
const [, , options] = mockSpawn.mock.calls[0] as [string, string[], { detached: boolean; stdio: string }];
|
|
55
54
|
|
|
56
55
|
expect(options).toMatchObject({
|
|
57
56
|
detached: true,
|
|
@@ -63,10 +62,10 @@ describe('spawnBackgroundWorker', () => {
|
|
|
63
62
|
const dataDir = '/custom/data/directory';
|
|
64
63
|
spawnBackgroundWorker('test-job', dataDir);
|
|
65
64
|
|
|
66
|
-
|
|
67
|
-
const options =
|
|
65
|
+
expect(mockSpawn).toHaveBeenCalledTimes(1);
|
|
66
|
+
const [, , options] = mockSpawn.mock.calls[0] as [string, string[], { env: Record<string, string> }];
|
|
68
67
|
|
|
69
|
-
expect(options
|
|
68
|
+
expect(options.env).toMatchObject({
|
|
70
69
|
...process.env,
|
|
71
70
|
BLUERA_DATA_DIR: dataDir
|
|
72
71
|
});
|
|
@@ -76,10 +75,10 @@ describe('spawnBackgroundWorker', () => {
|
|
|
76
75
|
const testDataDir = '.bluera/bluera-knowledge/data';
|
|
77
76
|
spawnBackgroundWorker('job-456', testDataDir);
|
|
78
77
|
|
|
79
|
-
|
|
80
|
-
const options =
|
|
78
|
+
expect(mockSpawn).toHaveBeenCalledTimes(1);
|
|
79
|
+
const [, , options] = mockSpawn.mock.calls[0] as [string, string[], { env: Record<string, string> }];
|
|
81
80
|
|
|
82
|
-
expect(options
|
|
81
|
+
expect(options.env.BLUERA_DATA_DIR).toBe(testDataDir);
|
|
83
82
|
});
|
|
84
83
|
});
|
|
85
84
|
|
|
@@ -116,13 +115,12 @@ describe('spawnBackgroundWorker (production mode)', () => {
|
|
|
116
115
|
|
|
117
116
|
spawnProd('test-job', '/test/data');
|
|
118
117
|
|
|
119
|
-
|
|
120
|
-
const command =
|
|
121
|
-
const args = callArgs?.[1];
|
|
118
|
+
expect(mockSpawnProd).toHaveBeenCalledTimes(1);
|
|
119
|
+
const [command, args] = mockSpawnProd.mock.calls[0] as [string, string[]];
|
|
122
120
|
|
|
123
121
|
// In production (dist folder), should use Node.js directly
|
|
124
122
|
expect(command).toBe(process.execPath);
|
|
125
|
-
expect(args
|
|
126
|
-
expect(args
|
|
123
|
+
expect(args[0]).toContain('background-worker-cli.js');
|
|
124
|
+
expect(args[1]).toBe('test-job');
|
|
127
125
|
});
|
|
128
126
|
});
|
|
@@ -231,10 +231,7 @@ describe('CLI Consistency', () => {
|
|
|
231
231
|
expect(result.stderr).toMatch(/^Error: Store not found: nonexistent/m);
|
|
232
232
|
});
|
|
233
233
|
|
|
234
|
-
|
|
235
|
-
const result = runCli('crawl https://example.com nonexistent');
|
|
236
|
-
expect(result.stderr).toMatch(/^Error: /m);
|
|
237
|
-
});
|
|
234
|
+
// Note: crawl auto-creates stores when not found, so no error test needed
|
|
238
235
|
});
|
|
239
236
|
|
|
240
237
|
describe('store delete Confirmation', () => {
|
package/vitest.config.ts
CHANGED
|
@@ -19,6 +19,8 @@ export default defineConfig({
|
|
|
19
19
|
'src/crawl/bridge.test.ts',
|
|
20
20
|
'src/plugin/git-clone.test.ts',
|
|
21
21
|
'src/services/project-root.service.test.ts',
|
|
22
|
+
'src/workers/spawn-worker.test.ts',
|
|
23
|
+
'src/logging/payload.test.ts',
|
|
22
24
|
],
|
|
23
25
|
// Use forks pool for onnxruntime-node compatibility
|
|
24
26
|
pool: 'forks',
|
|
@@ -38,6 +40,8 @@ export default defineConfig({
|
|
|
38
40
|
'src/crawl/bridge.test.ts',
|
|
39
41
|
'src/plugin/git-clone.test.ts',
|
|
40
42
|
'src/services/project-root.service.test.ts',
|
|
43
|
+
'src/workers/spawn-worker.test.ts',
|
|
44
|
+
'src/logging/payload.test.ts',
|
|
41
45
|
],
|
|
42
46
|
// Use forks pool for onnxruntime-node compatibility
|
|
43
47
|
pool: 'forks',
|