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
|
@@ -10,11 +10,11 @@ vi.mock('../../services/index.js', () => ({
|
|
|
10
10
|
}));
|
|
11
11
|
|
|
12
12
|
vi.mock('@hono/node-server', () => ({
|
|
13
|
-
serve: vi.fn()
|
|
13
|
+
serve: vi.fn(),
|
|
14
14
|
}));
|
|
15
15
|
|
|
16
16
|
vi.mock('../../server/app.js', () => ({
|
|
17
|
-
createApp: vi.fn()
|
|
17
|
+
createApp: vi.fn(),
|
|
18
18
|
}));
|
|
19
19
|
|
|
20
20
|
describe('Serve Command - Execution Tests', () => {
|
|
@@ -40,17 +40,17 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
40
40
|
list: vi.fn(),
|
|
41
41
|
getByIdOrName: vi.fn(),
|
|
42
42
|
create: vi.fn(),
|
|
43
|
-
delete: vi.fn()
|
|
43
|
+
delete: vi.fn(),
|
|
44
44
|
},
|
|
45
45
|
lance: {
|
|
46
|
-
initialize: vi.fn()
|
|
46
|
+
initialize: vi.fn(),
|
|
47
47
|
},
|
|
48
48
|
search: {
|
|
49
|
-
search: vi.fn()
|
|
49
|
+
search: vi.fn(),
|
|
50
50
|
},
|
|
51
51
|
index: {
|
|
52
|
-
indexStore: vi.fn()
|
|
53
|
-
}
|
|
52
|
+
indexStore: vi.fn(),
|
|
53
|
+
},
|
|
54
54
|
} as unknown as ServiceContainer;
|
|
55
55
|
|
|
56
56
|
vi.mocked(createServices).mockResolvedValue(mockServices);
|
|
@@ -79,7 +79,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
79
79
|
expect(serve).toHaveBeenCalledWith({
|
|
80
80
|
fetch: expect.any(Function),
|
|
81
81
|
port: 3847,
|
|
82
|
-
hostname: '127.0.0.1'
|
|
82
|
+
hostname: '127.0.0.1',
|
|
83
83
|
});
|
|
84
84
|
});
|
|
85
85
|
|
|
@@ -94,7 +94,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
94
94
|
expect(serve).toHaveBeenCalledWith(
|
|
95
95
|
expect.objectContaining({
|
|
96
96
|
port: 8080,
|
|
97
|
-
hostname: '127.0.0.1'
|
|
97
|
+
hostname: '127.0.0.1',
|
|
98
98
|
})
|
|
99
99
|
);
|
|
100
100
|
});
|
|
@@ -110,7 +110,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
110
110
|
expect(serve).toHaveBeenCalledWith(
|
|
111
111
|
expect.objectContaining({
|
|
112
112
|
port: 3847,
|
|
113
|
-
hostname: '0.0.0.0'
|
|
113
|
+
hostname: '0.0.0.0',
|
|
114
114
|
})
|
|
115
115
|
);
|
|
116
116
|
});
|
|
@@ -126,7 +126,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
126
126
|
expect(serve).toHaveBeenCalledWith(
|
|
127
127
|
expect.objectContaining({
|
|
128
128
|
port: 9000,
|
|
129
|
-
hostname: '0.0.0.0'
|
|
129
|
+
hostname: '0.0.0.0',
|
|
130
130
|
})
|
|
131
131
|
);
|
|
132
132
|
});
|
|
@@ -141,7 +141,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
141
141
|
|
|
142
142
|
expect(serve).toHaveBeenCalledWith(
|
|
143
143
|
expect.objectContaining({
|
|
144
|
-
port: 5000
|
|
144
|
+
port: 5000,
|
|
145
145
|
})
|
|
146
146
|
);
|
|
147
147
|
});
|
|
@@ -188,7 +188,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
188
188
|
|
|
189
189
|
expect(serve).toHaveBeenCalledWith(
|
|
190
190
|
expect.objectContaining({
|
|
191
|
-
fetch: mockFetch
|
|
191
|
+
fetch: mockFetch,
|
|
192
192
|
})
|
|
193
193
|
);
|
|
194
194
|
});
|
|
@@ -200,9 +200,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
200
200
|
const actionHandler = (command as any)._actionHandler;
|
|
201
201
|
await actionHandler([]);
|
|
202
202
|
|
|
203
|
-
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
204
|
-
'Starting server on http://127.0.0.1:3847'
|
|
205
|
-
);
|
|
203
|
+
expect(consoleLogSpy).toHaveBeenCalledWith('Starting server on http://127.0.0.1:3847');
|
|
206
204
|
});
|
|
207
205
|
|
|
208
206
|
it('logs server startup with custom port', async () => {
|
|
@@ -211,9 +209,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
211
209
|
command.parseOptions(['--port', '8080']);
|
|
212
210
|
await actionHandler([]);
|
|
213
211
|
|
|
214
|
-
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
215
|
-
'Starting server on http://127.0.0.1:8080'
|
|
216
|
-
);
|
|
212
|
+
expect(consoleLogSpy).toHaveBeenCalledWith('Starting server on http://127.0.0.1:8080');
|
|
217
213
|
});
|
|
218
214
|
|
|
219
215
|
it('logs server startup with custom host', async () => {
|
|
@@ -222,9 +218,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
222
218
|
command.parseOptions(['--host', '0.0.0.0']);
|
|
223
219
|
await actionHandler([]);
|
|
224
220
|
|
|
225
|
-
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
226
|
-
'Starting server on http://0.0.0.0:3847'
|
|
227
|
-
);
|
|
221
|
+
expect(consoleLogSpy).toHaveBeenCalledWith('Starting server on http://0.0.0.0:3847');
|
|
228
222
|
});
|
|
229
223
|
|
|
230
224
|
it('logs server startup with both custom port and host', async () => {
|
|
@@ -233,9 +227,7 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
233
227
|
command.parseOptions(['--port', '9000', '--host', '192.168.1.1']);
|
|
234
228
|
await actionHandler([]);
|
|
235
229
|
|
|
236
|
-
expect(consoleLogSpy).toHaveBeenCalledWith(
|
|
237
|
-
'Starting server on http://192.168.1.1:9000'
|
|
238
|
-
);
|
|
230
|
+
expect(consoleLogSpy).toHaveBeenCalledWith('Starting server on http://192.168.1.1:9000');
|
|
239
231
|
});
|
|
240
232
|
});
|
|
241
233
|
|
|
@@ -326,4 +318,54 @@ describe('Serve Command - Execution Tests', () => {
|
|
|
326
318
|
expect(callOrder).toEqual(['createApp', 'serve']);
|
|
327
319
|
});
|
|
328
320
|
});
|
|
321
|
+
|
|
322
|
+
describe('graceful shutdown', () => {
|
|
323
|
+
it('sets up SIGINT handler', async () => {
|
|
324
|
+
const processOnSpy = vi.spyOn(process, 'on').mockImplementation(() => process);
|
|
325
|
+
|
|
326
|
+
const command = createServeCommand(getOptions);
|
|
327
|
+
const actionHandler = (command as any)._actionHandler;
|
|
328
|
+
await actionHandler([]);
|
|
329
|
+
|
|
330
|
+
expect(processOnSpy).toHaveBeenCalledWith('SIGINT', expect.any(Function));
|
|
331
|
+
processOnSpy.mockRestore();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
it('sets up SIGTERM handler', async () => {
|
|
335
|
+
const processOnSpy = vi.spyOn(process, 'on').mockImplementation(() => process);
|
|
336
|
+
|
|
337
|
+
const command = createServeCommand(getOptions);
|
|
338
|
+
const actionHandler = (command as any)._actionHandler;
|
|
339
|
+
await actionHandler([]);
|
|
340
|
+
|
|
341
|
+
expect(processOnSpy).toHaveBeenCalledWith('SIGTERM', expect.any(Function));
|
|
342
|
+
processOnSpy.mockRestore();
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
it('calls destroyServices on SIGINT', async () => {
|
|
346
|
+
const { destroyServices } = await import('../../services/index.js');
|
|
347
|
+
const processExitSpy = vi.spyOn(process, 'exit').mockImplementation(() => undefined as never);
|
|
348
|
+
let sigintHandler: (() => void) | undefined;
|
|
349
|
+
|
|
350
|
+
const processOnSpy = vi.spyOn(process, 'on').mockImplementation((event, handler) => {
|
|
351
|
+
if (event === 'SIGINT') {
|
|
352
|
+
sigintHandler = handler as () => void;
|
|
353
|
+
}
|
|
354
|
+
return process;
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
const command = createServeCommand(getOptions);
|
|
358
|
+
const actionHandler = (command as any)._actionHandler;
|
|
359
|
+
await actionHandler([]);
|
|
360
|
+
|
|
361
|
+
expect(sigintHandler).toBeDefined();
|
|
362
|
+
await sigintHandler!();
|
|
363
|
+
|
|
364
|
+
expect(destroyServices).toHaveBeenCalledWith(mockServices);
|
|
365
|
+
expect(processExitSpy).toHaveBeenCalledWith(0);
|
|
366
|
+
|
|
367
|
+
processOnSpy.mockRestore();
|
|
368
|
+
processExitSpy.mockRestore();
|
|
369
|
+
});
|
|
370
|
+
});
|
|
329
371
|
});
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
1
|
import { serve } from '@hono/node-server';
|
|
3
|
-
import {
|
|
2
|
+
import { Command } from 'commander';
|
|
4
3
|
import { createApp } from '../../server/app.js';
|
|
4
|
+
import { createServices, destroyServices } from '../../services/index.js';
|
|
5
5
|
import type { GlobalOptions } from '../program.js';
|
|
6
6
|
|
|
7
7
|
export function createServeCommand(getOptions: () => GlobalOptions): Command {
|
|
8
8
|
return new Command('serve')
|
|
9
9
|
.description('Start HTTP API server for programmatic search access')
|
|
10
10
|
.option('-p, --port <port>', 'Port to listen on (default: 3847)', '3847')
|
|
11
|
-
.option(
|
|
11
|
+
.option(
|
|
12
|
+
'--host <host>',
|
|
13
|
+
'Bind address (default: 127.0.0.1, use 0.0.0.0 for all interfaces)',
|
|
14
|
+
'127.0.0.1'
|
|
15
|
+
)
|
|
12
16
|
.action(async (options: { port?: string; host?: string }) => {
|
|
13
17
|
const globalOpts = getOptions();
|
|
14
18
|
const services = await createServices(globalOpts.config, globalOpts.dataDir);
|
|
@@ -17,6 +21,17 @@ export function createServeCommand(getOptions: () => GlobalOptions): Command {
|
|
|
17
21
|
const port = parseInt(options.port ?? '3847', 10);
|
|
18
22
|
const host = options.host ?? '127.0.0.1';
|
|
19
23
|
|
|
24
|
+
// Graceful shutdown handler
|
|
25
|
+
const shutdown = (): void => {
|
|
26
|
+
void (async (): Promise<void> => {
|
|
27
|
+
await destroyServices(services);
|
|
28
|
+
process.exit(0);
|
|
29
|
+
})();
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
process.on('SIGINT', shutdown);
|
|
33
|
+
process.on('SIGTERM', shutdown);
|
|
34
|
+
|
|
20
35
|
console.log(`Starting server on http://${host}:${String(port)}`);
|
|
21
36
|
|
|
22
37
|
serve({
|