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.
Files changed (196) hide show
  1. package/.claude/hooks/post-edit-check.sh +5 -3
  2. package/.claude/skills/atomic-commits/SKILL.md +3 -1
  3. package/.husky/pre-commit +3 -2
  4. package/.prettierrc +9 -0
  5. package/.versionrc.json +1 -1
  6. package/CHANGELOG.md +33 -0
  7. package/CLAUDE.md +6 -0
  8. package/README.md +25 -13
  9. package/bun.lock +277 -33
  10. package/dist/{chunk-L2YVNC63.js → chunk-6FHWC36B.js} +9 -1
  11. package/dist/chunk-6FHWC36B.js.map +1 -0
  12. package/dist/{chunk-RST4XGRL.js → chunk-DC7CGSGT.js} +288 -241
  13. package/dist/chunk-DC7CGSGT.js.map +1 -0
  14. package/dist/{chunk-6PBP5DVD.js → chunk-WFNPNAAP.js} +3212 -3054
  15. package/dist/chunk-WFNPNAAP.js.map +1 -0
  16. package/dist/{chunk-WT2DAEO7.js → chunk-Z2KKVH45.js} +548 -482
  17. package/dist/chunk-Z2KKVH45.js.map +1 -0
  18. package/dist/index.js +871 -758
  19. package/dist/index.js.map +1 -1
  20. package/dist/mcp/server.js +3 -3
  21. package/dist/watch.service-BJV3TI3F.js +7 -0
  22. package/dist/workers/background-worker-cli.js +46 -45
  23. package/dist/workers/background-worker-cli.js.map +1 -1
  24. package/eslint.config.js +43 -1
  25. package/package.json +18 -11
  26. package/plugin.json +8 -0
  27. package/python/requirements.txt +1 -1
  28. package/src/analysis/ast-parser.test.ts +12 -11
  29. package/src/analysis/ast-parser.ts +28 -22
  30. package/src/analysis/code-graph.test.ts +52 -62
  31. package/src/analysis/code-graph.ts +9 -13
  32. package/src/analysis/dependency-usage-analyzer.test.ts +91 -271
  33. package/src/analysis/dependency-usage-analyzer.ts +52 -24
  34. package/src/analysis/go-ast-parser.test.ts +22 -22
  35. package/src/analysis/go-ast-parser.ts +18 -25
  36. package/src/analysis/parser-factory.test.ts +9 -9
  37. package/src/analysis/parser-factory.ts +3 -3
  38. package/src/analysis/python-ast-parser.test.ts +27 -27
  39. package/src/analysis/python-ast-parser.ts +2 -2
  40. package/src/analysis/repo-url-resolver.test.ts +82 -82
  41. package/src/analysis/rust-ast-parser.test.ts +19 -19
  42. package/src/analysis/rust-ast-parser.ts +17 -27
  43. package/src/analysis/tree-sitter-parser.test.ts +3 -3
  44. package/src/analysis/tree-sitter-parser.ts +10 -16
  45. package/src/cli/commands/crawl.test.ts +40 -24
  46. package/src/cli/commands/crawl.ts +186 -166
  47. package/src/cli/commands/index-cmd.test.ts +90 -90
  48. package/src/cli/commands/index-cmd.ts +52 -36
  49. package/src/cli/commands/mcp.test.ts +6 -6
  50. package/src/cli/commands/mcp.ts +2 -2
  51. package/src/cli/commands/plugin-api.test.ts +16 -18
  52. package/src/cli/commands/plugin-api.ts +9 -6
  53. package/src/cli/commands/search.test.ts +16 -7
  54. package/src/cli/commands/search.ts +124 -87
  55. package/src/cli/commands/serve.test.ts +67 -25
  56. package/src/cli/commands/serve.ts +18 -3
  57. package/src/cli/commands/setup.test.ts +176 -101
  58. package/src/cli/commands/setup.ts +140 -117
  59. package/src/cli/commands/store.test.ts +82 -53
  60. package/src/cli/commands/store.ts +56 -37
  61. package/src/cli/program.ts +2 -2
  62. package/src/crawl/article-converter.test.ts +4 -1
  63. package/src/crawl/article-converter.ts +46 -31
  64. package/src/crawl/bridge.test.ts +240 -132
  65. package/src/crawl/bridge.ts +87 -30
  66. package/src/crawl/claude-client.test.ts +124 -56
  67. package/src/crawl/claude-client.ts +7 -15
  68. package/src/crawl/intelligent-crawler.test.ts +65 -22
  69. package/src/crawl/intelligent-crawler.ts +86 -53
  70. package/src/crawl/markdown-utils.ts +1 -4
  71. package/src/db/embeddings.ts +4 -6
  72. package/src/db/lance.test.ts +4 -4
  73. package/src/db/lance.ts +16 -12
  74. package/src/index.ts +26 -17
  75. package/src/logging/index.ts +1 -5
  76. package/src/logging/logger.ts +3 -5
  77. package/src/logging/payload.test.ts +1 -1
  78. package/src/logging/payload.ts +3 -5
  79. package/src/mcp/commands/index.ts +2 -2
  80. package/src/mcp/commands/job.commands.ts +12 -18
  81. package/src/mcp/commands/meta.commands.ts +13 -13
  82. package/src/mcp/commands/registry.ts +5 -8
  83. package/src/mcp/commands/store.commands.ts +19 -19
  84. package/src/mcp/handlers/execute.handler.test.ts +10 -10
  85. package/src/mcp/handlers/execute.handler.ts +4 -5
  86. package/src/mcp/handlers/index.ts +10 -14
  87. package/src/mcp/handlers/job.handler.test.ts +10 -10
  88. package/src/mcp/handlers/job.handler.ts +22 -25
  89. package/src/mcp/handlers/search.handler.test.ts +36 -65
  90. package/src/mcp/handlers/search.handler.ts +135 -104
  91. package/src/mcp/handlers/store.handler.test.ts +41 -52
  92. package/src/mcp/handlers/store.handler.ts +108 -88
  93. package/src/mcp/schemas/index.test.ts +73 -68
  94. package/src/mcp/schemas/index.ts +18 -12
  95. package/src/mcp/server.test.ts +1 -1
  96. package/src/mcp/server.ts +59 -46
  97. package/src/plugin/commands.test.ts +230 -95
  98. package/src/plugin/commands.ts +24 -25
  99. package/src/plugin/dependency-analyzer.test.ts +52 -52
  100. package/src/plugin/dependency-analyzer.ts +85 -22
  101. package/src/plugin/git-clone.test.ts +24 -13
  102. package/src/plugin/git-clone.ts +3 -7
  103. package/src/server/app.test.ts +109 -109
  104. package/src/server/app.ts +32 -23
  105. package/src/server/index.test.ts +64 -66
  106. package/src/services/chunking.service.test.ts +32 -32
  107. package/src/services/chunking.service.ts +16 -9
  108. package/src/services/code-graph.service.test.ts +30 -36
  109. package/src/services/code-graph.service.ts +24 -10
  110. package/src/services/code-unit.service.test.ts +55 -11
  111. package/src/services/code-unit.service.ts +85 -11
  112. package/src/services/config.service.test.ts +37 -18
  113. package/src/services/config.service.ts +30 -7
  114. package/src/services/index.service.test.ts +49 -18
  115. package/src/services/index.service.ts +98 -48
  116. package/src/services/index.ts +6 -9
  117. package/src/services/job.service.test.ts +22 -22
  118. package/src/services/job.service.ts +18 -18
  119. package/src/services/project-root.service.test.ts +1 -3
  120. package/src/services/search.service.test.ts +248 -120
  121. package/src/services/search.service.ts +286 -156
  122. package/src/services/services.test.ts +1 -1
  123. package/src/services/snippet.service.test.ts +14 -6
  124. package/src/services/snippet.service.ts +7 -5
  125. package/src/services/store.service.test.ts +68 -29
  126. package/src/services/store.service.ts +41 -12
  127. package/src/services/watch.service.test.ts +34 -14
  128. package/src/services/watch.service.ts +11 -1
  129. package/src/types/brands.test.ts +3 -1
  130. package/src/types/index.ts +2 -13
  131. package/src/types/search.ts +10 -8
  132. package/src/utils/type-guards.test.ts +20 -15
  133. package/src/utils/type-guards.ts +1 -1
  134. package/src/workers/background-worker-cli.ts +2 -2
  135. package/src/workers/background-worker.test.ts +54 -40
  136. package/src/workers/background-worker.ts +76 -60
  137. package/src/workers/spawn-worker.test.ts +22 -10
  138. package/src/workers/spawn-worker.ts +6 -6
  139. package/tests/analysis/ast-parser.test.ts +3 -3
  140. package/tests/analysis/code-graph.test.ts +5 -5
  141. package/tests/fixtures/code-snippets/api/error-handling.ts +4 -15
  142. package/tests/fixtures/code-snippets/api/rest-controller.ts +3 -9
  143. package/tests/fixtures/code-snippets/auth/jwt-auth.ts +5 -21
  144. package/tests/fixtures/code-snippets/auth/oauth-flow.ts +4 -4
  145. package/tests/fixtures/code-snippets/database/repository-pattern.ts +11 -3
  146. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/aws-lambda/handler.ts +2 -2
  147. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-pages/handler.ts +1 -1
  148. package/tests/fixtures/corpus/oss-repos/hono/src/adapter/cloudflare-workers/serve-static.ts +2 -2
  149. package/tests/fixtures/corpus/oss-repos/hono/src/client/client.ts +2 -2
  150. package/tests/fixtures/corpus/oss-repos/hono/src/client/types.ts +22 -20
  151. package/tests/fixtures/corpus/oss-repos/hono/src/context.ts +13 -10
  152. package/tests/fixtures/corpus/oss-repos/hono/src/helper/accepts/accepts.ts +10 -7
  153. package/tests/fixtures/corpus/oss-repos/hono/src/helper/adapter/index.ts +2 -2
  154. package/tests/fixtures/corpus/oss-repos/hono/src/helper/css/index.ts +1 -1
  155. package/tests/fixtures/corpus/oss-repos/hono/src/helper/factory/index.ts +16 -16
  156. package/tests/fixtures/corpus/oss-repos/hono/src/helper/ssg/ssg.ts +2 -2
  157. package/tests/fixtures/corpus/oss-repos/hono/src/hono-base.ts +3 -3
  158. package/tests/fixtures/corpus/oss-repos/hono/src/hono.ts +1 -1
  159. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/css.ts +2 -2
  160. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/intrinsic-element/components.ts +1 -1
  161. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/dom/render.ts +7 -7
  162. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/hooks/index.ts +3 -3
  163. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/intrinsic-element/components.ts +1 -1
  164. package/tests/fixtures/corpus/oss-repos/hono/src/jsx/utils.ts +6 -6
  165. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/jsx-renderer/index.ts +3 -3
  166. package/tests/fixtures/corpus/oss-repos/hono/src/middleware/serve-static/index.ts +1 -1
  167. package/tests/fixtures/corpus/oss-repos/hono/src/preset/quick.ts +1 -1
  168. package/tests/fixtures/corpus/oss-repos/hono/src/preset/tiny.ts +1 -1
  169. package/tests/fixtures/corpus/oss-repos/hono/src/router/pattern-router/router.ts +2 -2
  170. package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/node.ts +4 -4
  171. package/tests/fixtures/corpus/oss-repos/hono/src/router/reg-exp-router/router.ts +1 -1
  172. package/tests/fixtures/corpus/oss-repos/hono/src/router/trie-router/node.ts +1 -1
  173. package/tests/fixtures/corpus/oss-repos/hono/src/types.ts +166 -169
  174. package/tests/fixtures/corpus/oss-repos/hono/src/utils/body.ts +8 -8
  175. package/tests/fixtures/corpus/oss-repos/hono/src/utils/color.ts +3 -3
  176. package/tests/fixtures/corpus/oss-repos/hono/src/utils/cookie.ts +2 -2
  177. package/tests/fixtures/corpus/oss-repos/hono/src/utils/encode.ts +2 -2
  178. package/tests/fixtures/corpus/oss-repos/hono/src/utils/types.ts +30 -33
  179. package/tests/fixtures/corpus/oss-repos/hono/src/validator/validator.ts +2 -2
  180. package/tests/fixtures/test-server.ts +3 -2
  181. package/tests/helpers/performance-metrics.ts +8 -25
  182. package/tests/helpers/search-relevance.ts +14 -69
  183. package/tests/integration/cli-consistency.test.ts +5 -4
  184. package/tests/integration/python-bridge.test.ts +13 -3
  185. package/tests/mcp/server.test.ts +1 -1
  186. package/tests/services/code-unit.service.test.ts +48 -0
  187. package/tests/services/job.service.test.ts +124 -0
  188. package/tests/services/search.progressive-context.test.ts +2 -2
  189. package/.claude-plugin/plugin.json +0 -13
  190. package/dist/chunk-6PBP5DVD.js.map +0 -1
  191. package/dist/chunk-L2YVNC63.js.map +0 -1
  192. package/dist/chunk-RST4XGRL.js.map +0 -1
  193. package/dist/chunk-WT2DAEO7.js.map +0 -1
  194. package/dist/watch.service-YAIKKDCF.js +0 -7
  195. package/skills/atomic-commits/SKILL.md +0 -77
  196. /package/dist/{watch.service-YAIKKDCF.js.map → watch.service-BJV3TI3F.js.map} +0 -0
@@ -22,8 +22,4 @@ export {
22
22
  type LogLevel,
23
23
  } from './logger.js';
24
24
 
25
- export {
26
- summarizePayload,
27
- truncateForLog,
28
- type PayloadSummary,
29
- } from './payload.js';
25
+ export { summarizePayload, truncateForLog, type PayloadSummary } from './payload.js';
@@ -8,10 +8,10 @@
8
8
  * - Child loggers per module for context
9
9
  */
10
10
 
11
- import pino, { type Logger, type LoggerOptions } from 'pino';
12
- import { homedir } from 'node:os';
13
11
  import { mkdirSync, existsSync } from 'node:fs';
12
+ import { homedir } from 'node:os';
14
13
  import { join } from 'node:path';
14
+ import pino, { type Logger, type LoggerOptions } from 'pino';
15
15
 
16
16
  /** Valid log levels */
17
17
  export type LogLevel = 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'fatal';
@@ -47,9 +47,7 @@ function getLogLevel(): LogLevel {
47
47
  }
48
48
 
49
49
  if (!isValidLogLevel(level)) {
50
- throw new Error(
51
- `Invalid LOG_LEVEL: "${level}". Valid values: ${VALID_LEVELS.join(', ')}`
52
- );
50
+ throw new Error(`Invalid LOG_LEVEL: "${level}". Valid values: ${VALID_LEVELS.join(', ')}`);
53
51
  }
54
52
 
55
53
  return level;
@@ -6,7 +6,7 @@ import { tmpdir } from 'node:os';
6
6
  // Mock logger module before importing payload
7
7
  vi.mock('./logger.js', () => ({
8
8
  getLogDirectory: vi.fn(),
9
- isLevelEnabled: vi.fn()
9
+ isLevelEnabled: vi.fn(),
10
10
  }));
11
11
 
12
12
  import { summarizePayload, truncateForLog } from './payload.js';
@@ -6,9 +6,9 @@
6
6
  * - Optionally dumping full content to separate files at trace level
7
7
  */
8
8
 
9
+ import { createHash } from 'node:crypto';
9
10
  import { writeFileSync, mkdirSync, existsSync } from 'node:fs';
10
11
  import { join } from 'node:path';
11
- import { createHash } from 'node:crypto';
12
12
  import { getLogDirectory, isLevelEnabled } from './logger.js';
13
13
 
14
14
  /** Maximum characters for log preview */
@@ -40,9 +40,7 @@ function getPayloadDir(): string {
40
40
 
41
41
  /** Generate a safe filename from an identifier */
42
42
  function safeFilename(identifier: string): string {
43
- return identifier
44
- .replace(/[^a-zA-Z0-9-]/g, '_')
45
- .substring(0, 50);
43
+ return identifier.replace(/[^a-zA-Z0-9-]/g, '_').substring(0, 50);
46
44
  }
47
45
 
48
46
  /**
@@ -117,5 +115,5 @@ export function truncateForLog(content: string, maxLength: number = MAX_PREVIEW_
117
115
  if (content.length <= maxLength) {
118
116
  return content;
119
117
  }
120
- return content.substring(0, maxLength) + '... [truncated]';
118
+ return `${content.substring(0, maxLength)}... [truncated]`;
121
119
  }
@@ -5,10 +5,10 @@
5
5
  * Import this module to ensure all commands are available.
6
6
  */
7
7
 
8
- import { commandRegistry } from './registry.js';
9
- import { storeCommands } from './store.commands.js';
10
8
  import { jobCommands } from './job.commands.js';
11
9
  import { metaCommands } from './meta.commands.js';
10
+ import { commandRegistry } from './registry.js';
11
+ import { storeCommands } from './store.commands.js';
12
12
 
13
13
  // Register all commands
14
14
  commandRegistry.registerAll(storeCommands);
@@ -1,15 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import { handleCheckJobStatus, handleListJobs, handleCancelJob } from '../handlers/job.handler.js';
2
3
  import type { CommandDefinition } from './registry.js';
3
- import type {
4
- CheckJobStatusArgs,
5
- ListJobsArgs,
6
- CancelJobArgs
7
- } from '../schemas/index.js';
8
- import {
9
- handleCheckJobStatus,
10
- handleListJobs,
11
- handleCancelJob
12
- } from '../handlers/job.handler.js';
4
+ import type { CheckJobStatusArgs, ListJobsArgs, CancelJobArgs } from '../schemas/index.js';
13
5
 
14
6
  /**
15
7
  * Job management commands for the execute meta-tool
@@ -28,27 +20,29 @@ export const jobCommands: CommandDefinition[] = [
28
20
  description: 'List all background jobs',
29
21
  argsSchema: z.object({
30
22
  activeOnly: z.boolean().optional().describe('Only show active jobs'),
31
- status: z.enum(['pending', 'running', 'completed', 'failed', 'cancelled'])
23
+ status: z
24
+ .enum(['pending', 'running', 'completed', 'failed', 'cancelled'])
32
25
  .optional()
33
- .describe('Filter by job status')
26
+ .describe('Filter by job status'),
34
27
  }),
35
- handler: (args, context) => handleListJobs(args as unknown as ListJobsArgs, context)
28
+ handler: (args, context) => handleListJobs(args as unknown as ListJobsArgs, context),
36
29
  },
37
30
  {
38
31
  name: 'job:status',
39
32
  description: 'Check the status of a specific background job',
40
33
  argsSchema: z.object({
41
- jobId: z.string().min(1).describe('Job ID to check')
34
+ jobId: z.string().min(1).describe('Job ID to check'),
42
35
  }),
43
- handler: (args, context) => handleCheckJobStatus(args as unknown as CheckJobStatusArgs, context)
36
+ handler: (args, context) =>
37
+ handleCheckJobStatus(args as unknown as CheckJobStatusArgs, context),
44
38
  },
45
39
  {
46
40
  name: 'job:cancel',
47
41
  description: 'Cancel a running or pending background job',
48
42
  argsSchema: z.object({
49
- jobId: z.string().min(1).describe('Job ID to cancel')
43
+ jobId: z.string().min(1).describe('Job ID to cancel'),
50
44
  }),
51
- handler: (args, context) => handleCancelJob(args as unknown as CancelJobArgs, context)
52
- }
45
+ handler: (args, context) => handleCancelJob(args as unknown as CancelJobArgs, context),
46
+ },
53
47
  ];
54
48
  /* eslint-enable @typescript-eslint/consistent-type-assertions */
@@ -1,7 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import { commandRegistry, generateHelp } from './registry.js';
2
3
  import type { CommandDefinition } from './registry.js';
3
4
  import type { ToolResponse } from '../types.js';
4
- import { commandRegistry, generateHelp } from './registry.js';
5
5
 
6
6
  /**
7
7
  * Meta commands for introspection and help
@@ -15,26 +15,26 @@ export const metaCommands: CommandDefinition[] = [
15
15
  description: 'List all available commands',
16
16
  handler: (): Promise<ToolResponse> => {
17
17
  const commands = commandRegistry.all();
18
- const commandList = commands.map(cmd => ({
18
+ const commandList = commands.map((cmd) => ({
19
19
  name: cmd.name,
20
- description: cmd.description
20
+ description: cmd.description,
21
21
  }));
22
22
 
23
23
  return Promise.resolve({
24
24
  content: [
25
25
  {
26
26
  type: 'text' as const,
27
- text: JSON.stringify({ commands: commandList }, null, 2)
28
- }
29
- ]
27
+ text: JSON.stringify({ commands: commandList }, null, 2),
28
+ },
29
+ ],
30
30
  });
31
- }
31
+ },
32
32
  },
33
33
  {
34
34
  name: 'help',
35
35
  description: 'Show help for a specific command or list all commands',
36
36
  argsSchema: z.object({
37
- command: z.string().optional().describe('Command name to get help for')
37
+ command: z.string().optional().describe('Command name to get help for'),
38
38
  }),
39
39
  handler: (args: Record<string, unknown>): Promise<ToolResponse> => {
40
40
  // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
@@ -45,10 +45,10 @@ export const metaCommands: CommandDefinition[] = [
45
45
  content: [
46
46
  {
47
47
  type: 'text' as const,
48
- text: helpText
49
- }
50
- ]
48
+ text: helpText,
49
+ },
50
+ ],
51
51
  });
52
- }
53
- }
52
+ },
53
+ },
54
54
  ];
@@ -121,9 +121,10 @@ export async function executeCommand(
121
121
 
122
122
  // Validate args if schema provided (Zod parse returns unknown, safe to cast after validation)
123
123
  /* eslint-disable @typescript-eslint/consistent-type-assertions */
124
- const validatedArgs: Record<string, unknown> = command.argsSchema !== undefined
125
- ? (command.argsSchema.parse(args) as Record<string, unknown>)
126
- : args;
124
+ const validatedArgs: Record<string, unknown> =
125
+ command.argsSchema !== undefined
126
+ ? (command.argsSchema.parse(args) as Record<string, unknown>)
127
+ : args;
127
128
  /* eslint-enable @typescript-eslint/consistent-type-assertions */
128
129
 
129
130
  return command.handler(validatedArgs, context);
@@ -139,11 +140,7 @@ export function generateHelp(commandName?: string): string {
139
140
  throw new Error(`Unknown command: ${commandName}`);
140
141
  }
141
142
 
142
- const lines = [
143
- `Command: ${command.name}`,
144
- `Description: ${command.description}`,
145
- ''
146
- ];
143
+ const lines = [`Command: ${command.name}`, `Description: ${command.description}`, ''];
147
144
 
148
145
  if (command.argsSchema !== undefined) {
149
146
  lines.push('Arguments:');
@@ -1,19 +1,19 @@
1
1
  import { z } from 'zod';
2
+ import {
3
+ handleListStores,
4
+ handleGetStoreInfo,
5
+ handleCreateStore,
6
+ handleIndexStore,
7
+ handleDeleteStore,
8
+ } from '../handlers/store.handler.js';
2
9
  import type { CommandDefinition } from './registry.js';
3
10
  import type {
4
11
  ListStoresArgs,
5
12
  GetStoreInfoArgs,
6
13
  CreateStoreArgs,
7
14
  IndexStoreArgs,
8
- DeleteStoreArgs
15
+ DeleteStoreArgs,
9
16
  } from '../schemas/index.js';
10
- import {
11
- handleListStores,
12
- handleGetStoreInfo,
13
- handleCreateStore,
14
- handleIndexStore,
15
- handleDeleteStore
16
- } from '../handlers/store.handler.js';
17
17
 
18
18
  /**
19
19
  * Store management commands for the execute meta-tool
@@ -31,17 +31,17 @@ export const storeCommands: CommandDefinition[] = [
31
31
  name: 'stores',
32
32
  description: 'List all indexed knowledge stores',
33
33
  argsSchema: z.object({
34
- type: z.enum(['file', 'repo', 'web']).optional().describe('Filter by store type')
34
+ type: z.enum(['file', 'repo', 'web']).optional().describe('Filter by store type'),
35
35
  }),
36
- handler: (args, context) => handleListStores(args as unknown as ListStoresArgs, context)
36
+ handler: (args, context) => handleListStores(args as unknown as ListStoresArgs, context),
37
37
  },
38
38
  {
39
39
  name: 'store:info',
40
40
  description: 'Get detailed information about a specific store',
41
41
  argsSchema: z.object({
42
- store: z.string().min(1).describe('Store name or ID')
42
+ store: z.string().min(1).describe('Store name or ID'),
43
43
  }),
44
- handler: (args, context) => handleGetStoreInfo(args as unknown as GetStoreInfoArgs, context)
44
+ handler: (args, context) => handleGetStoreInfo(args as unknown as GetStoreInfoArgs, context),
45
45
  },
46
46
  {
47
47
  name: 'store:create',
@@ -51,25 +51,25 @@ export const storeCommands: CommandDefinition[] = [
51
51
  type: z.enum(['file', 'repo']).describe('Store type'),
52
52
  source: z.string().min(1).describe('Git URL or local path'),
53
53
  branch: z.string().optional().describe('Git branch (for repo type)'),
54
- description: z.string().optional().describe('Store description')
54
+ description: z.string().optional().describe('Store description'),
55
55
  }),
56
- handler: (args, context) => handleCreateStore(args as unknown as CreateStoreArgs, context)
56
+ handler: (args, context) => handleCreateStore(args as unknown as CreateStoreArgs, context),
57
57
  },
58
58
  {
59
59
  name: 'store:index',
60
60
  description: 'Re-index a knowledge store to update search data',
61
61
  argsSchema: z.object({
62
- store: z.string().min(1).describe('Store name or ID')
62
+ store: z.string().min(1).describe('Store name or ID'),
63
63
  }),
64
- handler: (args, context) => handleIndexStore(args as unknown as IndexStoreArgs, context)
64
+ handler: (args, context) => handleIndexStore(args as unknown as IndexStoreArgs, context),
65
65
  },
66
66
  {
67
67
  name: 'store:delete',
68
68
  description: 'Delete a knowledge store and all associated data',
69
69
  argsSchema: z.object({
70
- store: z.string().min(1).describe('Store name or ID')
70
+ store: z.string().min(1).describe('Store name or ID'),
71
71
  }),
72
- handler: (args, context) => handleDeleteStore(args as unknown as DeleteStoreArgs, context)
73
- }
72
+ handler: (args, context) => handleDeleteStore(args as unknown as DeleteStoreArgs, context),
73
+ },
74
74
  ];
75
75
  /* eslint-enable @typescript-eslint/consistent-type-assertions */
@@ -19,13 +19,13 @@ describe('execute.handler', () => {
19
19
  list: async () => [],
20
20
  getByIdOrName: async () => undefined,
21
21
  create: async () => ({ success: false, error: { message: 'Not implemented in test' } }),
22
- delete: async () => ({ success: false, error: { message: 'Not implemented in test' } })
22
+ delete: async () => ({ success: false, error: { message: 'Not implemented in test' } }),
23
23
  },
24
24
  lance: {
25
- deleteStore: async () => {}
26
- }
25
+ deleteStore: async () => {},
26
+ },
27
27
  } as unknown as HandlerContext['services'],
28
- options: { dataDir: tempDir }
28
+ options: { dataDir: tempDir },
29
29
  };
30
30
  });
31
31
 
@@ -88,7 +88,7 @@ describe('execute.handler', () => {
88
88
  it('should handle "store:info" command', async () => {
89
89
  const args: ExecuteArgs = {
90
90
  command: 'store:info',
91
- args: { store: 'nonexistent' }
91
+ args: { store: 'nonexistent' },
92
92
  };
93
93
 
94
94
  // Should throw since store doesn't exist
@@ -113,12 +113,12 @@ describe('execute.handler', () => {
113
113
  const job = jobService.createJob({
114
114
  type: 'index',
115
115
  details: { storeId: 'test-store' },
116
- message: 'Testing...'
116
+ message: 'Testing...',
117
117
  });
118
118
 
119
119
  const args: ExecuteArgs = {
120
120
  command: 'job:status',
121
- args: { jobId: job.id }
121
+ args: { jobId: job.id },
122
122
  };
123
123
  const result = await handleExecute(args, mockContext);
124
124
 
@@ -134,12 +134,12 @@ describe('execute.handler', () => {
134
134
  const job = jobService.createJob({
135
135
  type: 'index',
136
136
  details: { storeId: 'test-store' },
137
- message: 'Testing...'
137
+ message: 'Testing...',
138
138
  });
139
139
 
140
140
  const args: ExecuteArgs = {
141
141
  command: 'job:cancel',
142
- args: { jobId: job.id }
142
+ args: { jobId: job.id },
143
143
  };
144
144
  const result = await handleExecute(args, mockContext);
145
145
 
@@ -168,7 +168,7 @@ describe('execute.handler', () => {
168
168
  it('should throw for help on unknown command', async () => {
169
169
  const args: ExecuteArgs = {
170
170
  command: 'help',
171
- args: { command: 'nonexistent' }
171
+ args: { command: 'nonexistent' },
172
172
  };
173
173
 
174
174
  await expect(handleExecute(args, mockContext)).rejects.toThrow(
@@ -1,9 +1,8 @@
1
- import type { ToolHandler, ToolResponse } from '../types.js';
2
- import type { ExecuteArgs } from '../schemas/index.js';
3
- import { ExecuteArgsSchema } from '../schemas/index.js';
4
- // Import commands module to register all commands
5
- import '../commands/index.js';
1
+ // Import commands module - side effect registers all commands, then use executeCommand
6
2
  import { executeCommand } from '../commands/index.js';
3
+ import { ExecuteArgsSchema } from '../schemas/index.js';
4
+ import type { ExecuteArgs } from '../schemas/index.js';
5
+ import type { ToolHandler, ToolResponse } from '../types.js';
7
6
 
8
7
  /**
9
8
  * Handle execute requests
@@ -1,13 +1,7 @@
1
1
  import { z } from 'zod';
2
+ import { handleSearch, handleGetFullContext } from './search.handler.js';
3
+ import { SearchArgsSchema, GetFullContextArgsSchema } from '../schemas/index.js';
2
4
  import type { ToolHandler } from '../types.js';
3
- import {
4
- SearchArgsSchema,
5
- GetFullContextArgsSchema
6
- } from '../schemas/index.js';
7
- import {
8
- handleSearch,
9
- handleGetFullContext
10
- } from './search.handler.js';
11
5
 
12
6
  /**
13
7
  * Tool definition with schema and handler
@@ -16,7 +10,7 @@ export interface ToolDefinition {
16
10
  name: string;
17
11
  description: string;
18
12
  schema: z.ZodType;
19
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
13
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any -- heterogeneous tool registry requires any; schema provides runtime type safety via Zod validation
20
14
  handler: ToolHandler<any>;
21
15
  }
22
16
 
@@ -30,14 +24,16 @@ export interface ToolDefinition {
30
24
  export const tools: ToolDefinition[] = [
31
25
  {
32
26
  name: 'search',
33
- description: 'Search all indexed knowledge stores with pattern detection and AI-optimized results. Returns structured code units with progressive context layers.',
27
+ description:
28
+ 'Search all indexed knowledge stores with pattern detection and AI-optimized results. Returns structured code units with progressive context layers.',
34
29
  schema: SearchArgsSchema,
35
- handler: handleSearch
30
+ handler: handleSearch,
36
31
  },
37
32
  {
38
33
  name: 'get_full_context',
39
- description: 'Get complete code and context for a specific search result by ID. Use this after search to get full implementation details.',
34
+ description:
35
+ 'Get complete code and context for a specific search result by ID. Use this after search to get full implementation details.',
40
36
  schema: GetFullContextArgsSchema,
41
- handler: handleGetFullContext
42
- }
37
+ handler: handleGetFullContext,
38
+ },
43
39
  ];
@@ -15,7 +15,7 @@ describe('job.handler', () => {
15
15
  tempDir = mkdtempSync(join(tmpdir(), 'job-handler-test-'));
16
16
  mockContext = {
17
17
  services: {} as any,
18
- options: { dataDir: tempDir }
18
+ options: { dataDir: tempDir },
19
19
  };
20
20
  });
21
21
 
@@ -29,7 +29,7 @@ describe('job.handler', () => {
29
29
  const job = jobService.createJob({
30
30
  type: 'index',
31
31
  details: { storeId: 'test-store' },
32
- message: 'Indexing...'
32
+ message: 'Indexing...',
33
33
  });
34
34
 
35
35
  const args: CheckJobStatusArgs = { jobId: job.id };
@@ -71,12 +71,12 @@ describe('job.handler', () => {
71
71
  jobService.createJob({
72
72
  type: 'index',
73
73
  details: { storeId: 'store1' },
74
- message: 'Indexing store1'
74
+ message: 'Indexing store1',
75
75
  });
76
76
  jobService.createJob({
77
77
  type: 'clone',
78
78
  details: { url: 'https://example.com' },
79
- message: 'Cloning repo'
79
+ message: 'Cloning repo',
80
80
  });
81
81
 
82
82
  const args: ListJobsArgs = {};
@@ -92,12 +92,12 @@ describe('job.handler', () => {
92
92
  const job1 = jobService.createJob({
93
93
  type: 'index',
94
94
  details: { storeId: 'store1' },
95
- message: 'Indexing'
95
+ message: 'Indexing',
96
96
  });
97
97
  jobService.createJob({
98
98
  type: 'clone',
99
99
  details: { url: 'https://example.com' },
100
- message: 'Cloning'
100
+ message: 'Cloning',
101
101
  });
102
102
 
103
103
  // Update job1 status
@@ -116,12 +116,12 @@ describe('job.handler', () => {
116
116
  const job1 = jobService.createJob({
117
117
  type: 'index',
118
118
  details: { storeId: 'store1' },
119
- message: 'Indexing'
119
+ message: 'Indexing',
120
120
  });
121
121
  jobService.createJob({
122
122
  type: 'clone',
123
123
  details: { url: 'https://example.com' },
124
- message: 'Cloning'
124
+ message: 'Cloning',
125
125
  });
126
126
 
127
127
  jobService.updateJob(job1.id, { status: 'completed' });
@@ -141,7 +141,7 @@ describe('job.handler', () => {
141
141
  const job = jobService.createJob({
142
142
  type: 'index',
143
143
  details: { storeId: 'test-store' },
144
- message: 'Indexing...'
144
+ message: 'Indexing...',
145
145
  });
146
146
 
147
147
  const args: CancelJobArgs = { jobId: job.id };
@@ -170,7 +170,7 @@ describe('job.handler', () => {
170
170
  const job = jobService.createJob({
171
171
  type: 'index',
172
172
  details: { storeId: 'test-store' },
173
- message: 'Indexing...'
173
+ message: 'Indexing...',
174
174
  });
175
175
 
176
176
  jobService.updateJob(job.id, { status: 'completed' });
@@ -1,15 +1,11 @@
1
- import type { ToolHandler, ToolResponse } from '../types.js';
2
- import type {
3
- CheckJobStatusArgs,
4
- ListJobsArgs,
5
- CancelJobArgs
6
- } from '../schemas/index.js';
1
+ import { JobService } from '../../services/job.service.js';
7
2
  import {
8
3
  CheckJobStatusArgsSchema,
9
4
  ListJobsArgsSchema,
10
- CancelJobArgsSchema
5
+ CancelJobArgsSchema,
11
6
  } from '../schemas/index.js';
12
- import { JobService } from '../../services/job.service.js';
7
+ import type { CheckJobStatusArgs, ListJobsArgs, CancelJobArgs } from '../schemas/index.js';
8
+ import type { ToolHandler, ToolResponse } from '../types.js';
13
9
 
14
10
  /**
15
11
  * Handle check_job_status requests
@@ -36,9 +32,9 @@ export const handleCheckJobStatus: ToolHandler<CheckJobStatusArgs> = (
36
32
  content: [
37
33
  {
38
34
  type: 'text',
39
- text: JSON.stringify(job, null, 2)
40
- }
41
- ]
35
+ text: JSON.stringify(job, null, 2),
36
+ },
37
+ ],
42
38
  });
43
39
  };
44
40
 
@@ -47,10 +43,7 @@ export const handleCheckJobStatus: ToolHandler<CheckJobStatusArgs> = (
47
43
  *
48
44
  * Lists all jobs with optional filtering by status or active status.
49
45
  */
50
- export const handleListJobs: ToolHandler<ListJobsArgs> = (
51
- args,
52
- context
53
- ): Promise<ToolResponse> => {
46
+ export const handleListJobs: ToolHandler<ListJobsArgs> = (args, context): Promise<ToolResponse> => {
54
47
  // Validate arguments with Zod
55
48
  const validated = ListJobsArgsSchema.parse(args);
56
49
 
@@ -71,9 +64,9 @@ export const handleListJobs: ToolHandler<ListJobsArgs> = (
71
64
  content: [
72
65
  {
73
66
  type: 'text',
74
- text: JSON.stringify({ jobs }, null, 2)
75
- }
76
- ]
67
+ text: JSON.stringify({ jobs }, null, 2),
68
+ },
69
+ ],
77
70
  });
78
71
  };
79
72
 
@@ -105,12 +98,16 @@ export const handleCancelJob: ToolHandler<CancelJobArgs> = (
105
98
  content: [
106
99
  {
107
100
  type: 'text',
108
- text: JSON.stringify({
109
- success: true,
110
- job,
111
- message: 'Job cancelled successfully'
112
- }, null, 2)
113
- }
114
- ]
101
+ text: JSON.stringify(
102
+ {
103
+ success: true,
104
+ job,
105
+ message: 'Job cancelled successfully',
106
+ },
107
+ null,
108
+ 2
109
+ ),
110
+ },
111
+ ],
115
112
  });
116
113
  };