bluera-knowledge 0.9.32 → 0.9.36
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 +70 -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 +97 -71
- 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 +28 -30
- package/src/workers/background-worker.test.ts +54 -40
- package/src/workers/background-worker.ts +76 -60
- package/src/workers/pid-file.test.ts +167 -0
- package/src/workers/pid-file.ts +82 -0
- 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 +6 -5
- 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
|
@@ -11,15 +11,15 @@ vi.mock('../../services/index.js', () => ({
|
|
|
11
11
|
}));
|
|
12
12
|
|
|
13
13
|
vi.mock('node:child_process', () => ({
|
|
14
|
-
spawnSync: vi.fn(() => ({ status: 0, stdout: Buffer.from(''), stderr: Buffer.from('') }))
|
|
14
|
+
spawnSync: vi.fn(() => ({ status: 0, stdout: Buffer.from(''), stderr: Buffer.from('') })),
|
|
15
15
|
}));
|
|
16
16
|
|
|
17
17
|
vi.mock('node:fs', () => ({
|
|
18
|
-
existsSync: vi.fn()
|
|
18
|
+
existsSync: vi.fn(),
|
|
19
19
|
}));
|
|
20
20
|
|
|
21
21
|
vi.mock('node:fs/promises', () => ({
|
|
22
|
-
mkdir: vi.fn()
|
|
22
|
+
mkdir: vi.fn(),
|
|
23
23
|
}));
|
|
24
24
|
|
|
25
25
|
vi.mock('ora', () => ({
|
|
@@ -27,8 +27,8 @@ vi.mock('ora', () => ({
|
|
|
27
27
|
start: vi.fn().mockReturnThis(),
|
|
28
28
|
succeed: vi.fn().mockReturnThis(),
|
|
29
29
|
fail: vi.fn().mockReturnThis(),
|
|
30
|
-
text: ''
|
|
31
|
-
}))
|
|
30
|
+
text: '',
|
|
31
|
+
})),
|
|
32
32
|
}));
|
|
33
33
|
|
|
34
34
|
describe('Setup Command - Execution Tests', () => {
|
|
@@ -54,14 +54,14 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
54
54
|
list: vi.fn(),
|
|
55
55
|
getByIdOrName: vi.fn(),
|
|
56
56
|
create: vi.fn(),
|
|
57
|
-
delete: vi.fn()
|
|
57
|
+
delete: vi.fn(),
|
|
58
58
|
},
|
|
59
59
|
lance: {
|
|
60
|
-
initialize: vi.fn()
|
|
60
|
+
initialize: vi.fn(),
|
|
61
61
|
},
|
|
62
62
|
index: {
|
|
63
|
-
indexStore: vi.fn()
|
|
64
|
-
}
|
|
63
|
+
indexStore: vi.fn(),
|
|
64
|
+
},
|
|
65
65
|
} as unknown as ServiceContainer;
|
|
66
66
|
|
|
67
67
|
vi.mocked(createServices).mockResolvedValue(mockServices);
|
|
@@ -80,7 +80,7 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
80
80
|
describe('repos subcommand - list mode', () => {
|
|
81
81
|
it('lists all default repositories without cloning', async () => {
|
|
82
82
|
const command = createSetupCommand(getOptions);
|
|
83
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
83
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
84
84
|
|
|
85
85
|
expect(reposCmd).toBeDefined();
|
|
86
86
|
|
|
@@ -99,7 +99,7 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
99
99
|
|
|
100
100
|
it('displays repository details in list mode', async () => {
|
|
101
101
|
const command = createSetupCommand(getOptions);
|
|
102
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
102
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
103
103
|
|
|
104
104
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
105
105
|
reposCmd.parseOptions(['--list']);
|
|
@@ -109,8 +109,12 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
109
109
|
for (const repo of DEFAULT_REPOS) {
|
|
110
110
|
expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining(repo.name));
|
|
111
111
|
expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining(`URL: ${repo.url}`));
|
|
112
|
-
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
113
|
-
|
|
112
|
+
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
113
|
+
expect.stringContaining(`Description: ${repo.description}`)
|
|
114
|
+
);
|
|
115
|
+
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
116
|
+
expect.stringContaining(`Tags: ${repo.tags.join(', ')}`)
|
|
117
|
+
);
|
|
114
118
|
}
|
|
115
119
|
});
|
|
116
120
|
});
|
|
@@ -123,7 +127,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
123
127
|
|
|
124
128
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
125
129
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
126
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
130
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
131
|
+
status: 0,
|
|
132
|
+
stdout: Buffer.from(''),
|
|
133
|
+
stderr: Buffer.from(''),
|
|
134
|
+
});
|
|
127
135
|
|
|
128
136
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
129
137
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -134,16 +142,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
134
142
|
type: 'repo',
|
|
135
143
|
path: '/tmp/claude-code',
|
|
136
144
|
createdAt: new Date(),
|
|
137
|
-
updatedAt: new Date()
|
|
138
|
-
}
|
|
145
|
+
updatedAt: new Date(),
|
|
146
|
+
},
|
|
139
147
|
});
|
|
140
148
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
141
149
|
success: true,
|
|
142
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
150
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
143
151
|
});
|
|
144
152
|
|
|
145
153
|
const command = createSetupCommand(getOptions);
|
|
146
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
154
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
147
155
|
|
|
148
156
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
149
157
|
reposCmd.parseOptions(['--only', 'claude-code']);
|
|
@@ -159,7 +167,7 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
159
167
|
|
|
160
168
|
it('exits with error when no repos match filter', async () => {
|
|
161
169
|
const command = createSetupCommand(getOptions);
|
|
162
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
170
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
163
171
|
|
|
164
172
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
165
173
|
reposCmd.parseOptions(['--only', 'nonexistent-repo']);
|
|
@@ -176,7 +184,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
176
184
|
|
|
177
185
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
178
186
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
179
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
187
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
188
|
+
status: 0,
|
|
189
|
+
stdout: Buffer.from(''),
|
|
190
|
+
stderr: Buffer.from(''),
|
|
191
|
+
});
|
|
180
192
|
|
|
181
193
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
182
194
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -187,16 +199,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
187
199
|
type: 'repo',
|
|
188
200
|
path: '/tmp/test',
|
|
189
201
|
createdAt: new Date(),
|
|
190
|
-
updatedAt: new Date()
|
|
191
|
-
}
|
|
202
|
+
updatedAt: new Date(),
|
|
203
|
+
},
|
|
192
204
|
});
|
|
193
205
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
194
206
|
success: true,
|
|
195
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
207
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
196
208
|
});
|
|
197
209
|
|
|
198
210
|
const command = createSetupCommand(getOptions);
|
|
199
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
211
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
200
212
|
|
|
201
213
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
202
214
|
reposCmd.parseOptions(['--only', 'docs,sdk']);
|
|
@@ -216,7 +228,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
216
228
|
|
|
217
229
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
218
230
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
219
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
231
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
232
|
+
status: 0,
|
|
233
|
+
stdout: Buffer.from(''),
|
|
234
|
+
stderr: Buffer.from(''),
|
|
235
|
+
});
|
|
220
236
|
|
|
221
237
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
222
238
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -227,16 +243,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
227
243
|
type: 'repo',
|
|
228
244
|
path: '/tmp/repos/claude-code-docs',
|
|
229
245
|
createdAt: new Date(),
|
|
230
|
-
updatedAt: new Date()
|
|
231
|
-
}
|
|
246
|
+
updatedAt: new Date(),
|
|
247
|
+
},
|
|
232
248
|
});
|
|
233
249
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
234
250
|
success: true,
|
|
235
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
251
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
236
252
|
});
|
|
237
253
|
|
|
238
254
|
const command = createSetupCommand(getOptions);
|
|
239
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
255
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
240
256
|
|
|
241
257
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
242
258
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -257,7 +273,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
257
273
|
|
|
258
274
|
vi.mocked(existsSync).mockReturnValue(true);
|
|
259
275
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
260
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
276
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
277
|
+
status: 0,
|
|
278
|
+
stdout: Buffer.from(''),
|
|
279
|
+
stderr: Buffer.from(''),
|
|
280
|
+
});
|
|
261
281
|
|
|
262
282
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
263
283
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -268,16 +288,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
268
288
|
type: 'repo',
|
|
269
289
|
path: '/tmp/repos/claude-code-docs',
|
|
270
290
|
createdAt: new Date(),
|
|
271
|
-
updatedAt: new Date()
|
|
272
|
-
}
|
|
291
|
+
updatedAt: new Date(),
|
|
292
|
+
},
|
|
273
293
|
});
|
|
274
294
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
275
295
|
success: true,
|
|
276
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
296
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
277
297
|
});
|
|
278
298
|
|
|
279
299
|
const command = createSetupCommand(getOptions);
|
|
280
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
300
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
281
301
|
|
|
282
302
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
283
303
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -287,7 +307,7 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
287
307
|
'git',
|
|
288
308
|
['pull', '--ff-only'],
|
|
289
309
|
expect.objectContaining({
|
|
290
|
-
stdio: 'pipe'
|
|
310
|
+
stdio: 'pipe',
|
|
291
311
|
})
|
|
292
312
|
);
|
|
293
313
|
});
|
|
@@ -301,7 +321,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
301
321
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
302
322
|
|
|
303
323
|
// Pull fails (non-zero status) but shouldn't stop execution
|
|
304
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
324
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
325
|
+
status: 1,
|
|
326
|
+
stdout: Buffer.from(''),
|
|
327
|
+
stderr: Buffer.from('Pull failed'),
|
|
328
|
+
});
|
|
305
329
|
|
|
306
330
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
307
331
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -312,16 +336,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
312
336
|
type: 'repo',
|
|
313
337
|
path: '/tmp/repos/claude-code-docs',
|
|
314
338
|
createdAt: new Date(),
|
|
315
|
-
updatedAt: new Date()
|
|
316
|
-
}
|
|
339
|
+
updatedAt: new Date(),
|
|
340
|
+
},
|
|
317
341
|
});
|
|
318
342
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
319
343
|
success: true,
|
|
320
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
344
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
321
345
|
});
|
|
322
346
|
|
|
323
347
|
const command = createSetupCommand(getOptions);
|
|
324
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
348
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
325
349
|
|
|
326
350
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
327
351
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -340,12 +364,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
340
364
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
341
365
|
|
|
342
366
|
// Clone fails with empty stderr - should use fallback message
|
|
343
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
367
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
368
|
+
status: 1,
|
|
369
|
+
stdout: Buffer.from(''),
|
|
370
|
+
stderr: Buffer.from(''),
|
|
371
|
+
});
|
|
344
372
|
|
|
345
373
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
346
374
|
|
|
347
375
|
const command = createSetupCommand(getOptions);
|
|
348
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
376
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
349
377
|
|
|
350
378
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
351
379
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -365,7 +393,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
365
393
|
|
|
366
394
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
367
395
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
368
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
396
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
397
|
+
status: 0,
|
|
398
|
+
stdout: Buffer.from(''),
|
|
399
|
+
stderr: Buffer.from(''),
|
|
400
|
+
});
|
|
369
401
|
|
|
370
402
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
371
403
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -376,16 +408,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
376
408
|
type: 'repo',
|
|
377
409
|
path: '/tmp/repos/claude-code-docs',
|
|
378
410
|
createdAt: new Date(),
|
|
379
|
-
updatedAt: new Date()
|
|
380
|
-
}
|
|
411
|
+
updatedAt: new Date(),
|
|
412
|
+
},
|
|
381
413
|
});
|
|
382
414
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
383
415
|
success: true,
|
|
384
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
416
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
385
417
|
});
|
|
386
418
|
|
|
387
419
|
const command = createSetupCommand(getOptions);
|
|
388
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
420
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
389
421
|
|
|
390
422
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
391
423
|
reposCmd.parseOptions(['--only', 'claude-code-docs', '--skip-clone']);
|
|
@@ -404,7 +436,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
404
436
|
|
|
405
437
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
406
438
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
407
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
439
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
440
|
+
status: 0,
|
|
441
|
+
stdout: Buffer.from(''),
|
|
442
|
+
stderr: Buffer.from(''),
|
|
443
|
+
});
|
|
408
444
|
|
|
409
445
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
410
446
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -415,28 +451,28 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
415
451
|
type: 'repo',
|
|
416
452
|
path: '/tmp/repos/claude-code-docs',
|
|
417
453
|
createdAt: new Date(),
|
|
418
|
-
updatedAt: new Date()
|
|
419
|
-
}
|
|
454
|
+
updatedAt: new Date(),
|
|
455
|
+
},
|
|
420
456
|
});
|
|
421
457
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
422
458
|
success: true,
|
|
423
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
459
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
424
460
|
});
|
|
425
461
|
|
|
426
462
|
const command = createSetupCommand(getOptions);
|
|
427
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
463
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
428
464
|
|
|
429
465
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
430
466
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
431
467
|
await actionHandler([]);
|
|
432
468
|
|
|
433
|
-
const repo = DEFAULT_REPOS.find(r => r.name === 'claude-code-docs')!;
|
|
469
|
+
const repo = DEFAULT_REPOS.find((r) => r.name === 'claude-code-docs')!;
|
|
434
470
|
expect(mockServices.store.create).toHaveBeenCalledWith({
|
|
435
471
|
name: repo.name,
|
|
436
472
|
type: 'repo',
|
|
437
473
|
path: expect.stringContaining('claude-code-docs'),
|
|
438
474
|
description: repo.description,
|
|
439
|
-
tags: repo.tags
|
|
475
|
+
tags: repo.tags,
|
|
440
476
|
});
|
|
441
477
|
});
|
|
442
478
|
|
|
@@ -447,7 +483,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
447
483
|
|
|
448
484
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
449
485
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
450
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
486
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
487
|
+
status: 0,
|
|
488
|
+
stdout: Buffer.from(''),
|
|
489
|
+
stderr: Buffer.from(''),
|
|
490
|
+
});
|
|
451
491
|
|
|
452
492
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue({
|
|
453
493
|
id: 'existing-store',
|
|
@@ -455,15 +495,15 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
455
495
|
type: 'repo',
|
|
456
496
|
path: '/tmp/repos/claude-code-docs',
|
|
457
497
|
createdAt: new Date(),
|
|
458
|
-
updatedAt: new Date()
|
|
498
|
+
updatedAt: new Date(),
|
|
459
499
|
});
|
|
460
500
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
461
501
|
success: true,
|
|
462
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
502
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
463
503
|
});
|
|
464
504
|
|
|
465
505
|
const command = createSetupCommand(getOptions);
|
|
466
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
506
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
467
507
|
|
|
468
508
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
469
509
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -481,16 +521,20 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
481
521
|
|
|
482
522
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
483
523
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
484
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
524
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
525
|
+
status: 0,
|
|
526
|
+
stdout: Buffer.from(''),
|
|
527
|
+
stderr: Buffer.from(''),
|
|
528
|
+
});
|
|
485
529
|
|
|
486
530
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
487
531
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
488
532
|
success: false,
|
|
489
|
-
error: new Error('Store creation failed')
|
|
533
|
+
error: new Error('Store creation failed'),
|
|
490
534
|
});
|
|
491
535
|
|
|
492
536
|
const command = createSetupCommand(getOptions);
|
|
493
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
537
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
494
538
|
|
|
495
539
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
496
540
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -512,17 +556,22 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
512
556
|
|
|
513
557
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
514
558
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
515
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
559
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
560
|
+
status: 0,
|
|
561
|
+
stdout: Buffer.from(''),
|
|
562
|
+
stderr: Buffer.from(''),
|
|
563
|
+
});
|
|
516
564
|
|
|
517
565
|
vi.mocked(mockServices.store.getByIdOrName)
|
|
518
566
|
.mockResolvedValueOnce(undefined) // First call - check if store exists
|
|
519
|
-
.mockResolvedValueOnce({
|
|
567
|
+
.mockResolvedValueOnce({
|
|
568
|
+
// Second call - get store for indexing
|
|
520
569
|
id: 'store-1',
|
|
521
570
|
name: 'claude-code-docs',
|
|
522
571
|
type: 'repo',
|
|
523
572
|
path: '/tmp/repos/claude-code-docs',
|
|
524
573
|
createdAt: new Date(),
|
|
525
|
-
updatedAt: new Date()
|
|
574
|
+
updatedAt: new Date(),
|
|
526
575
|
});
|
|
527
576
|
|
|
528
577
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -533,17 +582,17 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
533
582
|
type: 'repo',
|
|
534
583
|
path: '/tmp/repos/claude-code-docs',
|
|
535
584
|
createdAt: new Date(),
|
|
536
|
-
updatedAt: new Date()
|
|
537
|
-
}
|
|
585
|
+
updatedAt: new Date(),
|
|
586
|
+
},
|
|
538
587
|
});
|
|
539
588
|
|
|
540
589
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
541
590
|
success: true,
|
|
542
|
-
data: { documentsIndexed: 25, chunksCreated: 100, timeMs: 2000 }
|
|
591
|
+
data: { documentsIndexed: 25, chunksCreated: 100, timeMs: 2000 },
|
|
543
592
|
});
|
|
544
593
|
|
|
545
594
|
const command = createSetupCommand(getOptions);
|
|
546
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
595
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
547
596
|
|
|
548
597
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
549
598
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -560,7 +609,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
560
609
|
|
|
561
610
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
562
611
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
563
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
612
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
613
|
+
status: 0,
|
|
614
|
+
stdout: Buffer.from(''),
|
|
615
|
+
stderr: Buffer.from(''),
|
|
616
|
+
});
|
|
564
617
|
|
|
565
618
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
566
619
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -571,12 +624,12 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
571
624
|
type: 'repo',
|
|
572
625
|
path: '/tmp/repos/claude-code-docs',
|
|
573
626
|
createdAt: new Date(),
|
|
574
|
-
updatedAt: new Date()
|
|
575
|
-
}
|
|
627
|
+
updatedAt: new Date(),
|
|
628
|
+
},
|
|
576
629
|
});
|
|
577
630
|
|
|
578
631
|
const command = createSetupCommand(getOptions);
|
|
579
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
632
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
580
633
|
|
|
581
634
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
582
635
|
reposCmd.parseOptions(['--only', 'claude-code-docs', '--skip-index']);
|
|
@@ -597,7 +650,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
597
650
|
|
|
598
651
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
599
652
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
600
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
653
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
654
|
+
status: 0,
|
|
655
|
+
stdout: Buffer.from(''),
|
|
656
|
+
stderr: Buffer.from(''),
|
|
657
|
+
});
|
|
601
658
|
|
|
602
659
|
vi.mocked(mockServices.store.getByIdOrName)
|
|
603
660
|
.mockResolvedValueOnce(undefined)
|
|
@@ -607,7 +664,7 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
607
664
|
type: 'repo',
|
|
608
665
|
path: '/tmp/repos/claude-code-docs',
|
|
609
666
|
createdAt: new Date(),
|
|
610
|
-
updatedAt: new Date()
|
|
667
|
+
updatedAt: new Date(),
|
|
611
668
|
});
|
|
612
669
|
|
|
613
670
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -618,17 +675,17 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
618
675
|
type: 'repo',
|
|
619
676
|
path: '/tmp/repos/claude-code-docs',
|
|
620
677
|
createdAt: new Date(),
|
|
621
|
-
updatedAt: new Date()
|
|
622
|
-
}
|
|
678
|
+
updatedAt: new Date(),
|
|
679
|
+
},
|
|
623
680
|
});
|
|
624
681
|
|
|
625
682
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
626
683
|
success: false,
|
|
627
|
-
error: new Error('Indexing failed')
|
|
684
|
+
error: new Error('Indexing failed'),
|
|
628
685
|
});
|
|
629
686
|
|
|
630
687
|
const command = createSetupCommand(getOptions);
|
|
631
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
688
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
632
689
|
|
|
633
690
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
634
691
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -647,7 +704,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
647
704
|
|
|
648
705
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
649
706
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
650
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
707
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
708
|
+
status: 0,
|
|
709
|
+
stdout: Buffer.from(''),
|
|
710
|
+
stderr: Buffer.from(''),
|
|
711
|
+
});
|
|
651
712
|
|
|
652
713
|
vi.mocked(mockServices.store.getByIdOrName)
|
|
653
714
|
.mockResolvedValueOnce(undefined)
|
|
@@ -657,7 +718,7 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
657
718
|
type: 'repo',
|
|
658
719
|
path: '/tmp/repos/claude-code-docs',
|
|
659
720
|
createdAt: new Date(),
|
|
660
|
-
updatedAt: new Date()
|
|
721
|
+
updatedAt: new Date(),
|
|
661
722
|
});
|
|
662
723
|
|
|
663
724
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -668,8 +729,8 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
668
729
|
type: 'repo',
|
|
669
730
|
path: '/tmp/repos/claude-code-docs',
|
|
670
731
|
createdAt: new Date(),
|
|
671
|
-
updatedAt: new Date()
|
|
672
|
-
}
|
|
732
|
+
updatedAt: new Date(),
|
|
733
|
+
},
|
|
673
734
|
});
|
|
674
735
|
|
|
675
736
|
vi.mocked(mockServices.index.indexStore).mockImplementation(async (store, onProgress) => {
|
|
@@ -680,12 +741,12 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
680
741
|
}
|
|
681
742
|
return {
|
|
682
743
|
success: true,
|
|
683
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
744
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
684
745
|
};
|
|
685
746
|
});
|
|
686
747
|
|
|
687
748
|
const command = createSetupCommand(getOptions);
|
|
688
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
749
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
689
750
|
|
|
690
751
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
691
752
|
reposCmd.parseOptions(['--only', 'claude-code-docs']);
|
|
@@ -709,7 +770,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
709
770
|
|
|
710
771
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
711
772
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
712
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
773
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
774
|
+
status: 0,
|
|
775
|
+
stdout: Buffer.from(''),
|
|
776
|
+
stderr: Buffer.from(''),
|
|
777
|
+
});
|
|
713
778
|
|
|
714
779
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
715
780
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -720,16 +785,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
720
785
|
type: 'repo',
|
|
721
786
|
path: '/tmp/test',
|
|
722
787
|
createdAt: new Date(),
|
|
723
|
-
updatedAt: new Date()
|
|
724
|
-
}
|
|
788
|
+
updatedAt: new Date(),
|
|
789
|
+
},
|
|
725
790
|
});
|
|
726
791
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
727
792
|
success: true,
|
|
728
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
793
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
729
794
|
});
|
|
730
795
|
|
|
731
796
|
const command = createSetupCommand(getOptions);
|
|
732
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
797
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
733
798
|
|
|
734
799
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
735
800
|
reposCmd.parseOptions(['--only', 'claude-code', '--repos-dir', '/custom/path']);
|
|
@@ -745,7 +810,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
745
810
|
|
|
746
811
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
747
812
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
748
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
813
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
814
|
+
status: 0,
|
|
815
|
+
stdout: Buffer.from(''),
|
|
816
|
+
stderr: Buffer.from(''),
|
|
817
|
+
});
|
|
749
818
|
|
|
750
819
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
751
820
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -756,16 +825,16 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
756
825
|
type: 'repo',
|
|
757
826
|
path: '/custom/path/test',
|
|
758
827
|
createdAt: new Date(),
|
|
759
|
-
updatedAt: new Date()
|
|
760
|
-
}
|
|
828
|
+
updatedAt: new Date(),
|
|
829
|
+
},
|
|
761
830
|
});
|
|
762
831
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
763
832
|
success: true,
|
|
764
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
833
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
765
834
|
});
|
|
766
835
|
|
|
767
836
|
const command = createSetupCommand(getOptions);
|
|
768
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
837
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
769
838
|
|
|
770
839
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
771
840
|
reposCmd.parseOptions(['--only', 'claude-code', '--repos-dir', '/custom/path']);
|
|
@@ -773,7 +842,7 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
773
842
|
|
|
774
843
|
expect(mockServices.store.create).toHaveBeenCalledWith(
|
|
775
844
|
expect.objectContaining({
|
|
776
|
-
path: expect.stringContaining('/custom/path')
|
|
845
|
+
path: expect.stringContaining('/custom/path'),
|
|
777
846
|
})
|
|
778
847
|
);
|
|
779
848
|
});
|
|
@@ -787,7 +856,11 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
787
856
|
|
|
788
857
|
vi.mocked(existsSync).mockReturnValue(false);
|
|
789
858
|
vi.mocked(mkdir).mockResolvedValue(undefined);
|
|
790
|
-
vi.mocked(spawnSync).mockReturnValue({
|
|
859
|
+
vi.mocked(spawnSync).mockReturnValue({
|
|
860
|
+
status: 0,
|
|
861
|
+
stdout: Buffer.from(''),
|
|
862
|
+
stderr: Buffer.from(''),
|
|
863
|
+
});
|
|
791
864
|
|
|
792
865
|
vi.mocked(mockServices.store.getByIdOrName).mockResolvedValue(undefined);
|
|
793
866
|
vi.mocked(mockServices.store.create).mockResolvedValue({
|
|
@@ -798,23 +871,25 @@ describe('Setup Command - Execution Tests', () => {
|
|
|
798
871
|
type: 'repo',
|
|
799
872
|
path: '/tmp/test',
|
|
800
873
|
createdAt: new Date(),
|
|
801
|
-
updatedAt: new Date()
|
|
802
|
-
}
|
|
874
|
+
updatedAt: new Date(),
|
|
875
|
+
},
|
|
803
876
|
});
|
|
804
877
|
vi.mocked(mockServices.index.indexStore).mockResolvedValue({
|
|
805
878
|
success: true,
|
|
806
|
-
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 }
|
|
879
|
+
data: { documentsIndexed: 10, chunksCreated: 50, timeMs: 1000 },
|
|
807
880
|
});
|
|
808
881
|
|
|
809
882
|
const command = createSetupCommand(getOptions);
|
|
810
|
-
const reposCmd = command.commands.find(c => c.name() === 'repos');
|
|
883
|
+
const reposCmd = command.commands.find((c) => c.name() === 'repos');
|
|
811
884
|
|
|
812
885
|
const actionHandler = (reposCmd as any)._actionHandler;
|
|
813
886
|
reposCmd.parseOptions(['--only', 'claude-code']);
|
|
814
887
|
await actionHandler([]);
|
|
815
888
|
|
|
816
889
|
expect(consoleLogSpy).toHaveBeenCalledWith(expect.stringContaining('Setup complete'));
|
|
817
|
-
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
890
|
+
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
891
|
+
expect.stringContaining('bluera-knowledge search')
|
|
892
|
+
);
|
|
818
893
|
});
|
|
819
894
|
});
|
|
820
895
|
});
|