@xiaozhi-client/cli 1.9.4-beta.5

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 (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +98 -0
  3. package/fix-imports.js +32 -0
  4. package/package.json +26 -0
  5. package/project.json +75 -0
  6. package/src/Constants.ts +105 -0
  7. package/src/Container.ts +212 -0
  8. package/src/Types.ts +79 -0
  9. package/src/commands/CommandHandlerFactory.ts +98 -0
  10. package/src/commands/ConfigCommandHandler.ts +279 -0
  11. package/src/commands/EndpointCommandHandler.ts +158 -0
  12. package/src/commands/McpCommandHandler.ts +778 -0
  13. package/src/commands/ProjectCommandHandler.ts +254 -0
  14. package/src/commands/ServiceCommandHandler.ts +182 -0
  15. package/src/commands/__tests__/CommandHandlerFactory.test.ts +323 -0
  16. package/src/commands/__tests__/CommandRegistry.test.ts +287 -0
  17. package/src/commands/__tests__/ConfigCommandHandler.test.ts +844 -0
  18. package/src/commands/__tests__/EndpointCommandHandler.test.ts +426 -0
  19. package/src/commands/__tests__/McpCommandHandler.test.ts +753 -0
  20. package/src/commands/__tests__/ProjectCommandHandler.test.ts +230 -0
  21. package/src/commands/__tests__/ServiceCommands.integration.test.ts +408 -0
  22. package/src/commands/index.ts +351 -0
  23. package/src/errors/ErrorHandlers.ts +141 -0
  24. package/src/errors/ErrorMessages.ts +121 -0
  25. package/src/errors/__tests__/index.test.ts +186 -0
  26. package/src/errors/index.ts +163 -0
  27. package/src/global.d.ts +19 -0
  28. package/src/index.ts +53 -0
  29. package/src/interfaces/Command.ts +128 -0
  30. package/src/interfaces/CommandTypes.ts +95 -0
  31. package/src/interfaces/Config.ts +25 -0
  32. package/src/interfaces/Service.ts +99 -0
  33. package/src/services/DaemonManager.ts +318 -0
  34. package/src/services/ProcessManager.ts +235 -0
  35. package/src/services/ServiceManager.ts +319 -0
  36. package/src/services/TemplateManager.ts +382 -0
  37. package/src/services/__tests__/DaemonManager.test.ts +378 -0
  38. package/src/services/__tests__/DaemonMode.integration.test.ts +321 -0
  39. package/src/services/__tests__/ProcessManager.test.ts +296 -0
  40. package/src/services/__tests__/ServiceManager.test.ts +774 -0
  41. package/src/services/__tests__/TemplateManager.test.ts +337 -0
  42. package/src/types/backend.d.ts +48 -0
  43. package/src/utils/FileUtils.ts +320 -0
  44. package/src/utils/FormatUtils.ts +198 -0
  45. package/src/utils/PathUtils.ts +255 -0
  46. package/src/utils/PlatformUtils.ts +217 -0
  47. package/src/utils/Validation.ts +274 -0
  48. package/src/utils/VersionUtils.ts +141 -0
  49. package/src/utils/__tests__/FileUtils.test.ts +728 -0
  50. package/src/utils/__tests__/FormatUtils.test.ts +243 -0
  51. package/src/utils/__tests__/PathUtils.test.ts +1165 -0
  52. package/src/utils/__tests__/PlatformUtils.test.ts +723 -0
  53. package/src/utils/__tests__/Validation.test.ts +560 -0
  54. package/src/utils/__tests__/VersionUtils.test.ts +410 -0
  55. package/tsconfig.json +32 -0
  56. package/tsconfig.tsbuildinfo +1 -0
  57. package/tsup.config.ts +107 -0
  58. package/vitest.config.ts +97 -0
@@ -0,0 +1,410 @@
1
+ /**
2
+ * 版本管理工具单元测试
3
+ */
4
+
5
+ import fs from "node:fs";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
9
+ import { FileError } from "../../errors/index";
10
+ import { VersionUtils } from "../VersionUtils";
11
+
12
+ // Mock fileURLToPath
13
+ vi.mock("node:url");
14
+ const mockedFileURLToPath = vi.mocked(fileURLToPath);
15
+
16
+ // Mock path module
17
+ vi.mock("node:path");
18
+ const mockedPath = vi.mocked(path);
19
+
20
+ // Mock fs module
21
+ vi.mock("node:fs");
22
+ const mockedFs = vi.mocked(fs);
23
+
24
+ describe("VersionUtils", () => {
25
+ beforeEach(() => {
26
+ vi.clearAllMocks();
27
+ // Clear static cache
28
+ VersionUtils.clearCache();
29
+ });
30
+
31
+ afterEach(() => {
32
+ vi.restoreAllMocks();
33
+ });
34
+
35
+ describe("获取版本号", () => {
36
+ it("缓存可用时应返回缓存的版本号", () => {
37
+ // Set cache directly
38
+ VersionUtils.clearCache();
39
+ (VersionUtils as any).cachedVersion = "1.0.0";
40
+
41
+ const result = VersionUtils.getVersion();
42
+
43
+ expect(result).toBe("1.0.0");
44
+ expect(mockedFs.existsSync).not.toHaveBeenCalled();
45
+ });
46
+
47
+ it("应从dist目录中的package.json读取版本号", () => {
48
+ const mockPackageJson = { version: "1.2.3", name: "test-package" };
49
+
50
+ // Mock fileURLToPath
51
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
52
+
53
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
54
+ mockedPath.join
55
+ .mockReturnValueOnce("/dist/cli/utils/package.json")
56
+ .mockReturnValueOnce("/dist/cli/package.json")
57
+ .mockReturnValueOnce("/package.json")
58
+ .mockReturnValueOnce("/../package.json");
59
+
60
+ mockedFs.existsSync.mockImplementation((filePath) => {
61
+ return filePath === "/dist/cli/utils/package.json";
62
+ });
63
+
64
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
65
+
66
+ const result = VersionUtils.getVersion();
67
+
68
+ expect(result).toBe("1.2.3");
69
+ expect(mockedFs.existsSync).toHaveBeenCalledWith(
70
+ "/dist/cli/utils/package.json"
71
+ );
72
+ expect(mockedFs.readFileSync).toHaveBeenCalledWith(
73
+ "/dist/cli/utils/package.json",
74
+ "utf8"
75
+ );
76
+ });
77
+
78
+ it("当前目录中未找到时应从父级package.json读取版本号", () => {
79
+ const mockPackageJson = { version: "2.0.0", name: "test-package" };
80
+
81
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
82
+
83
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
84
+ mockedPath.join
85
+ .mockReturnValueOnce("/dist/cli/utils/package.json")
86
+ .mockReturnValueOnce("/dist/cli/package.json")
87
+ .mockReturnValueOnce("/package.json")
88
+ .mockReturnValueOnce("/../package.json");
89
+
90
+ mockedFs.existsSync.mockImplementation((filePath) => {
91
+ return filePath === "/package.json";
92
+ });
93
+
94
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
95
+
96
+ const result = VersionUtils.getVersion();
97
+
98
+ expect(result).toBe("2.0.0");
99
+ expect(mockedFs.existsSync).toHaveBeenCalledTimes(3);
100
+ expect(mockedFs.readFileSync).toHaveBeenCalledWith(
101
+ "/package.json",
102
+ "utf8"
103
+ );
104
+ });
105
+
106
+ it("未找到package.json时应返回 'unknown'", () => {
107
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
108
+
109
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
110
+ mockedPath.join
111
+ .mockReturnValueOnce("/dist/cli/utils/package.json")
112
+ .mockReturnValueOnce("/dist/cli/package.json")
113
+ .mockReturnValueOnce("/package.json")
114
+ .mockReturnValueOnce("/../package.json");
115
+
116
+ mockedFs.existsSync.mockReturnValue(false);
117
+
118
+ const result = VersionUtils.getVersion();
119
+
120
+ expect(result).toBe("unknown");
121
+ });
122
+
123
+ it("package.json没有版本字段时应返回 'unknown'", () => {
124
+ const mockPackageJson = { name: "test-package" };
125
+
126
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
127
+
128
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
129
+ mockedPath.join.mockReturnValue("/dist/cli/utils/package.json");
130
+
131
+ mockedFs.existsSync.mockReturnValue(true);
132
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
133
+
134
+ const result = VersionUtils.getVersion();
135
+
136
+ expect(result).toBe("unknown");
137
+ });
138
+
139
+ it("读取package.json失败时应返回 'unknown'", () => {
140
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
141
+
142
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
143
+ mockedPath.join.mockReturnValue("/dist/cli/utils/package.json");
144
+
145
+ mockedFs.existsSync.mockReturnValue(true);
146
+ mockedFs.readFileSync.mockImplementation(() => {
147
+ throw new Error("Read error");
148
+ });
149
+
150
+ const result = VersionUtils.getVersion();
151
+
152
+ expect(result).toBe("unknown");
153
+ });
154
+
155
+ it("首次成功读取后应缓存版本号", () => {
156
+ const mockPackageJson = { version: "1.0.0", name: "test-package" };
157
+
158
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
159
+
160
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
161
+ mockedPath.join.mockReturnValue("/dist/cli/utils/package.json");
162
+
163
+ mockedFs.existsSync.mockReturnValue(true);
164
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
165
+
166
+ // First call
167
+ const result1 = VersionUtils.getVersion();
168
+ expect(result1).toBe("1.0.0");
169
+ expect(mockedFs.readFileSync).toHaveBeenCalledTimes(1);
170
+
171
+ // Second call should use cache
172
+ const result2 = VersionUtils.getVersion();
173
+ expect(result2).toBe("1.0.0");
174
+ expect(mockedFs.readFileSync).toHaveBeenCalledTimes(1); // No additional calls
175
+ });
176
+ });
177
+
178
+ describe("获取版本信息", () => {
179
+ it("应从package.json返回完整的版本信息", () => {
180
+ const mockPackageJson = {
181
+ version: "1.2.3",
182
+ name: "xiaozhi-client",
183
+ description: "A test package",
184
+ author: "Test Author",
185
+ };
186
+
187
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
188
+
189
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
190
+ mockedPath.join
191
+ .mockReturnValueOnce("/dist/cli/utils/package.json")
192
+ .mockReturnValueOnce("/dist/cli/package.json")
193
+ .mockReturnValueOnce("/package.json")
194
+ .mockReturnValueOnce("/../package.json");
195
+
196
+ mockedFs.existsSync.mockReturnValue(true);
197
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
198
+
199
+ const result = VersionUtils.getVersionInfo();
200
+
201
+ expect(result).toEqual({
202
+ version: "1.2.3",
203
+ name: "xiaozhi-client",
204
+ description: "A test package",
205
+ author: "Test Author",
206
+ });
207
+ });
208
+
209
+ it("应处理信息最少的package.json", () => {
210
+ const mockPackageJson = { version: "1.0.0" };
211
+
212
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
213
+
214
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
215
+ mockedPath.join.mockReturnValue("/dist/cli/utils/package.json");
216
+
217
+ mockedFs.existsSync.mockReturnValue(true);
218
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
219
+
220
+ const result = VersionUtils.getVersionInfo();
221
+
222
+ expect(result).toEqual({
223
+ version: "1.0.0",
224
+ name: undefined,
225
+ description: undefined,
226
+ author: undefined,
227
+ });
228
+ });
229
+
230
+ it("未找到package.json时应返回默认版本信息", () => {
231
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
232
+
233
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
234
+ mockedPath.join
235
+ .mockReturnValueOnce("/dist/cli/utils/package.json")
236
+ .mockReturnValueOnce("/dist/cli/package.json")
237
+ .mockReturnValueOnce("/package.json")
238
+ .mockReturnValueOnce("/../package.json");
239
+
240
+ mockedFs.existsSync.mockReturnValue(false);
241
+
242
+ const result = VersionUtils.getVersionInfo();
243
+
244
+ expect(result).toEqual({ version: "unknown" });
245
+ });
246
+
247
+ it("读取失败时应抛出文件错误", () => {
248
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
249
+
250
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
251
+ mockedPath.join.mockReturnValue("/dist/cli/utils/package.json");
252
+
253
+ mockedFs.existsSync.mockReturnValue(true);
254
+ mockedFs.readFileSync.mockImplementation(() => {
255
+ throw new Error("Read error");
256
+ });
257
+
258
+ expect(() => VersionUtils.getVersionInfo()).toThrow(FileError);
259
+ expect(() => VersionUtils.getVersionInfo()).toThrow("无法读取版本信息");
260
+ });
261
+ });
262
+
263
+ describe("比较版本号", () => {
264
+ it("当version1大于version2时应返回1", () => {
265
+ expect(VersionUtils.compareVersions("2.0.0", "1.0.0")).toBe(1);
266
+ expect(VersionUtils.compareVersions("1.1.0", "1.0.0")).toBe(1);
267
+ expect(VersionUtils.compareVersions("1.0.1", "1.0.0")).toBe(1);
268
+ });
269
+
270
+ it("当version1小于version2时应返回-1", () => {
271
+ expect(VersionUtils.compareVersions("1.0.0", "2.0.0")).toBe(-1);
272
+ expect(VersionUtils.compareVersions("1.0.0", "1.1.0")).toBe(-1);
273
+ expect(VersionUtils.compareVersions("1.0.0", "1.0.1")).toBe(-1);
274
+ });
275
+
276
+ it("版本号相等时应返回0", () => {
277
+ expect(VersionUtils.compareVersions("1.0.0", "1.0.0")).toBe(0);
278
+ expect(VersionUtils.compareVersions("2.1.3", "2.1.3")).toBe(0);
279
+ });
280
+
281
+ it("应处理不同部分数量的版本号", () => {
282
+ expect(VersionUtils.compareVersions("1.0", "1.0.0")).toBe(0);
283
+ expect(VersionUtils.compareVersions("1.0.0", "1.0")).toBe(0);
284
+ expect(VersionUtils.compareVersions("1.0.0.1", "1.0.0")).toBe(1);
285
+ expect(VersionUtils.compareVersions("1.0.0", "1.0.0.1")).toBe(-1);
286
+ });
287
+
288
+ it("应处理带预发布标识符的版本号", () => {
289
+ // The current implementation ignores pre-release identifiers and just compares numeric parts
290
+ expect(VersionUtils.compareVersions("1.0.0-alpha", "1.0.0")).toBe(0);
291
+ expect(VersionUtils.compareVersions("1.0.0", "1.0.0-alpha")).toBe(0);
292
+ });
293
+
294
+ it("应处理带构建元数据的版本号", () => {
295
+ // The current implementation doesn't properly handle build metadata
296
+ // "1.0.0+build.1" becomes ["1", "0", "0+build", "1"] and "0+build" becomes NaN
297
+ expect(VersionUtils.compareVersions("1.0.0+build.1", "1.0.0")).toBe(1);
298
+ expect(VersionUtils.compareVersions("1.0.0", "1.0.0+build.1")).toBe(-1);
299
+ });
300
+ });
301
+
302
+ describe("验证版本号有效性", () => {
303
+ it("应接受有效的语义化版本号", () => {
304
+ expect(VersionUtils.isValidVersion("1.0.0")).toBe(true);
305
+ expect(VersionUtils.isValidVersion("0.0.1")).toBe(true);
306
+ expect(VersionUtils.isValidVersion("10.20.30")).toBe(true);
307
+ expect(VersionUtils.isValidVersion("1.0.0-alpha")).toBe(true);
308
+ expect(VersionUtils.isValidVersion("1.0.0-alpha.1")).toBe(true);
309
+ expect(VersionUtils.isValidVersion("1.0.0-0.3.7")).toBe(true);
310
+ expect(VersionUtils.isValidVersion("1.0.0-x.7.z.92")).toBe(true);
311
+ // Note: Build metadata is not supported by current regex
312
+ expect(VersionUtils.isValidVersion("1.0.0-alpha+001")).toBe(false);
313
+ expect(VersionUtils.isValidVersion("1.0.0+20130313144700")).toBe(false);
314
+ expect(VersionUtils.isValidVersion("1.0.0-beta+exp.sha.5114f85")).toBe(
315
+ false
316
+ );
317
+ });
318
+
319
+ it("应拒绝无效的语义化版本号", () => {
320
+ expect(VersionUtils.isValidVersion("1")).toBe(false);
321
+ expect(VersionUtils.isValidVersion("1.0")).toBe(false);
322
+ expect(VersionUtils.isValidVersion("1.0.0.0")).toBe(false);
323
+ expect(VersionUtils.isValidVersion("v1.0.0")).toBe(false);
324
+ expect(VersionUtils.isValidVersion("1.0.0-")).toBe(false);
325
+ // The current regex actually accepts "1.0.0-.." because it matches the pattern
326
+ expect(VersionUtils.isValidVersion("1.0.0-..")).toBe(true);
327
+ expect(VersionUtils.isValidVersion("1.0.0-alpha..")).toBe(true);
328
+ expect(VersionUtils.isValidVersion("1.0.0-alpha-beta")).toBe(true);
329
+ expect(VersionUtils.isValidVersion("")).toBe(false);
330
+ expect(VersionUtils.isValidVersion("not.a.version")).toBe(false);
331
+ expect(VersionUtils.isValidVersion("1.0.0.1")).toBe(false);
332
+ });
333
+ });
334
+
335
+ describe("清除缓存", () => {
336
+ it("应清除缓存的版本号", () => {
337
+ // Set cache first
338
+ (VersionUtils as any).cachedVersion = "1.0.0";
339
+
340
+ VersionUtils.clearCache();
341
+
342
+ expect((VersionUtils as any).cachedVersion).toBeNull();
343
+ });
344
+
345
+ it("应处理null缓存", () => {
346
+ // Ensure cache is null
347
+ VersionUtils.clearCache();
348
+
349
+ // Should not throw
350
+ VersionUtils.clearCache();
351
+
352
+ expect((VersionUtils as any).cachedVersion).toBeNull();
353
+ });
354
+ });
355
+
356
+ describe("集成测试", () => {
357
+ it("清除缓存后应正常工作", () => {
358
+ const mockPackageJson = { version: "1.0.0" };
359
+
360
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
361
+
362
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
363
+ mockedPath.join.mockReturnValue("/dist/cli/utils/package.json");
364
+
365
+ mockedFs.existsSync.mockReturnValue(true);
366
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
367
+
368
+ // First call
369
+ const result1 = VersionUtils.getVersion();
370
+ expect(result1).toBe("1.0.0");
371
+
372
+ // Clear cache
373
+ VersionUtils.clearCache();
374
+
375
+ // Should read file again
376
+ const result2 = VersionUtils.getVersion();
377
+ expect(result2).toBe("1.0.0");
378
+ expect(mockedFs.readFileSync).toHaveBeenCalledTimes(2);
379
+ });
380
+
381
+ it("应正确处理多次路径尝试", () => {
382
+ const mockPackageJson = { version: "2.0.0" };
383
+
384
+ mockedFileURLToPath.mockReturnValue("/dist/cli/utils/VersionUtils.js");
385
+
386
+ mockedPath.dirname.mockReturnValue("/dist/cli/utils");
387
+ mockedPath.join
388
+ .mockReturnValueOnce("/dist/cli/utils/package.json")
389
+ .mockReturnValueOnce("/dist/cli/package.json")
390
+ .mockReturnValueOnce("/package.json")
391
+ .mockReturnValueOnce("/../package.json");
392
+
393
+ // Simulate finding package.json in the third attempt
394
+ mockedFs.existsSync.mockImplementation((filePath) => {
395
+ return filePath === "/package.json";
396
+ });
397
+
398
+ mockedFs.readFileSync.mockReturnValue(JSON.stringify(mockPackageJson));
399
+
400
+ const result = VersionUtils.getVersion();
401
+
402
+ expect(result).toBe("2.0.0");
403
+ expect(mockedFs.existsSync).toHaveBeenCalledTimes(3);
404
+ expect(mockedFs.readFileSync).toHaveBeenCalledWith(
405
+ "/package.json",
406
+ "utf8"
407
+ );
408
+ });
409
+ });
410
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ESNext",
5
+ "moduleResolution": "bundler",
6
+ "lib": ["ES2022"],
7
+ "strict": false,
8
+ "esModuleInterop": true,
9
+ "skipLibCheck": true,
10
+ "forceConsistentCasingInFileNames": true,
11
+ "resolveJsonModule": true,
12
+ "allowSyntheticDefaultImports": true,
13
+ "noEmit": true,
14
+ "baseUrl": ".",
15
+ "moduleSuffixes": [".ts", ".js"],
16
+ "paths": {
17
+ "@/*": ["src/*"],
18
+ "@cli/commands": ["src/commands"],
19
+ "@cli/commands/*": ["src/commands/*"],
20
+ "@cli/services": ["src/services"],
21
+ "@cli/services/*": ["src/services/*"],
22
+ "@cli/utils": ["src/utils"],
23
+ "@cli/utils/*": ["src/utils/*"],
24
+ "@cli/errors": ["src/errors"],
25
+ "@cli/errors/*": ["src/errors/*"],
26
+ "@cli/interfaces": ["src/interfaces"],
27
+ "@cli/interfaces/*": ["src/interfaces/*"]
28
+ }
29
+ },
30
+ "include": ["src/**/*.ts"],
31
+ "exclude": ["node_modules", "dist", "**/*.test.ts", "**/*.spec.ts"]
32
+ }
@@ -0,0 +1 @@
1
+ {"fileNames":["../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es5.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.dom.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.webworker.importscripts.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.scripthost.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.core.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.collection.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.generator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.iterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.proxy.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.reflect.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.array.include.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2016.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.arraybuffer.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2018.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.symbol.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2019.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.bigint.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.date.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2020.number.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.promise.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.weakref.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2021.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.array.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.error.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.intl.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.object.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.string.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.regexp.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.decorators.legacy.d.ts","../../node_modules/.pnpm/typescript@5.9.3/node_modules/typescript/lib/lib.es2022.full.d.ts","./src/constants.ts","./src/container.ts","./src/types.ts","./src/global.d.ts","./src/index.ts","./src/commands/commandhandlerfactory.ts","./src/commands/configcommandhandler.ts","./src/commands/endpointcommandhandler.ts","./src/commands/mcpcommandhandler.ts","./src/commands/projectcommandhandler.ts","./src/commands/servicecommandhandler.ts","./src/commands/index.ts","./src/errors/errorhandlers.ts","./src/errors/errormessages.ts","./src/errors/index.ts","./src/interfaces/command.ts","./src/interfaces/commandtypes.ts","./src/interfaces/config.ts","./src/interfaces/service.ts","./src/services/daemonmanager.ts","./src/services/processmanager.ts","./src/services/servicemanager.ts","./src/services/templatemanager.ts","./src/types/backend.d.ts","./src/utils/fileutils.ts","./src/utils/formatutils.ts","./src/utils/pathutils.ts","./src/utils/platformutils.ts","./src/utils/validation.ts","./src/utils/versionutils.ts"],"fileIdsList":[[87]],"fileInfos":[{"version":"c430d44666289dae81f30fa7b2edebf186ecc91a2d4c71266ea6ae76388792e1","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"45b7ab580deca34ae9729e97c13cfd999df04416a79116c3bfb483804f85ded4","signature":false,"impliedFormat":1},{"version":"3facaf05f0c5fc569c5649dd359892c98a85557e3e0c847964caeb67076f4d75","signature":false,"impliedFormat":1},{"version":"e44bb8bbac7f10ecc786703fe0a6a4b952189f908707980ba8f3c8975a760962","signature":false,"impliedFormat":1},{"version":"5e1c4c362065a6b95ff952c0eab010f04dcd2c3494e813b493ecfd4fcb9fc0d8","signature":false,"impliedFormat":1},{"version":"68d73b4a11549f9c0b7d352d10e91e5dca8faa3322bfb77b661839c42b1ddec7","signature":false,"impliedFormat":1},{"version":"5efce4fc3c29ea84e8928f97adec086e3dc876365e0982cc8479a07954a3efd4","signature":false,"impliedFormat":1},{"version":"feecb1be483ed332fad555aff858affd90a48ab19ba7272ee084704eb7167569","signature":false,"impliedFormat":1},{"version":"ee7bad0c15b58988daa84371e0b89d313b762ab83cb5b31b8a2d1162e8eb41c2","signature":false,"impliedFormat":1},{"version":"080941d9f9ff9307f7e27a83bcd888b7c8270716c39af943532438932ec1d0b9","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2e80ee7a49e8ac312cc11b77f1475804bee36b3b2bc896bead8b6e1266befb43","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"d7a3c8b952931daebdfc7a2897c53c0a1c73624593fa070e46bd537e64dcd20a","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"80e18897e5884b6723488d4f5652167e7bb5024f946743134ecc4aa4ee731f89","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"cd034f499c6cdca722b60c04b5b1b78e058487a7085a8e0d6fb50809947ee573","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"c57796738e7f83dbc4b8e65132f11a377649c00dd3eee333f672b8f0a6bea671","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"dc2df20b1bcdc8c2d34af4926e2c3ab15ffe1160a63e58b7e09833f616efff44","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"515d0b7b9bea2e31ea4ec968e9edd2c39d3eebf4a2d5cbd04e88639819ae3b71","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"0559b1f683ac7505ae451f9a96ce4c3c92bdc71411651ca6ddb0e88baaaad6a3","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"0dc1e7ceda9b8b9b455c3a2d67b0412feab00bd2f66656cd8850e8831b08b537","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ce691fb9e5c64efb9547083e4a34091bcbe5bdb41027e310ebba8f7d96a98671","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8d697a2a929a5fcb38b7a65594020fcef05ec1630804a33748829c5ff53640d0","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"4ff2a353abf8a80ee399af572debb8faab2d33ad38c4b4474cff7f26e7653b8d","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"fb0f136d372979348d59b3f5020b4cdb81b5504192b1cacff5d1fbba29378aa1","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"d15bea3d62cbbdb9797079416b8ac375ae99162a7fba5de2c6c505446486ac0a","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"68d18b664c9d32a7336a70235958b8997ebc1c3b8505f4f1ae2b7e7753b87618","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"eb3d66c8327153d8fa7dd03f9c58d351107fe824c79e9b56b462935176cdf12a","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"38f0219c9e23c915ef9790ab1d680440d95419ad264816fa15009a8851e79119","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"69ab18c3b76cd9b1be3d188eaf8bba06112ebbe2f47f6c322b5105a6fbc45a2e","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"a680117f487a4d2f30ea46f1b4b7f58bef1480456e18ba53ee85c2746eeca012","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"2f11ff796926e0832f9ae148008138ad583bd181899ab7dd768a2666700b1893","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"4de680d5bb41c17f7f68e0419412ca23c98d5749dcaaea1896172f06435891fc","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"954296b30da6d508a104a3a0b5d96b76495c709785c1d11610908e63481ee667","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"ac9538681b19688c8eae65811b329d3744af679e0bdfa5d842d0e32524c73e1c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"0a969edff4bd52585473d24995c5ef223f6652d6ef46193309b3921d65dd4376","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"9e9fbd7030c440b33d021da145d3232984c8bb7916f277e8ffd3dc2e3eae2bdb","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"811ec78f7fefcabbda4bfa93b3eb67d9ae166ef95f9bff989d964061cbf81a0c","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"717937616a17072082152a2ef351cb51f98802fb4b2fdabd32399843875974ca","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"d7e7d9b7b50e5f22c915b525acc5a49a7a6584cf8f62d0569e557c5cfc4b2ac2","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"71c37f4c9543f31dfced6c7840e068c5a5aacb7b89111a4364b1d5276b852557","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"576711e016cf4f1804676043e6a0a5414252560eb57de9faceee34d79798c850","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"89c1b1281ba7b8a96efc676b11b264de7a8374c5ea1e6617f11880a13fc56dc6","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"74f7fa2d027d5b33eb0471c8e82a6c87216223181ec31247c357a3e8e2fddc5b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"d6d7ae4d1f1f3772e2a3cde568ed08991a8ae34a080ff1151af28b7f798e22ca","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"063600664504610fe3e99b717a1223f8b1900087fab0b4cad1496a114744f8df","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"934019d7e3c81950f9a8426d093458b65d5aff2c7c1511233c0fd5b941e608ab","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"52ada8e0b6e0482b728070b7639ee42e83a9b1c22d205992756fe020fd9f4a47","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3bdefe1bfd4d6dee0e26f928f93ccc128f1b64d5d501ff4a8cf3c6371200e5e6","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"59fb2c069260b4ba00b5643b907ef5d5341b167e7d1dbf58dfd895658bda2867","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"639e512c0dfc3fad96a84caad71b8834d66329a1f28dc95e3946c9b58176c73a","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"368af93f74c9c932edd84c58883e736c9e3d53cec1fe24c0b0ff451f529ceab1","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"af3dd424cf267428f30ccfc376f47a2c0114546b55c44d8c0f1d57d841e28d74","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"995c005ab91a498455ea8dfb63aa9f83fa2ea793c3d8aa344be4a1678d06d399","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"959d36cddf5e7d572a65045b876f2956c973a586da58e5d26cde519184fd9b8a","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"965f36eae237dd74e6cca203a43e9ca801ce38824ead814728a2807b1910117d","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3925a6c820dcb1a06506c90b1577db1fdbf7705d65b62b99dce4be75c637e26b","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"0a3d63ef2b853447ec4f749d3f368ce642264246e02911fcb1590d8c161b8005","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8cdf8847677ac7d20486e54dd3fcf09eda95812ac8ace44b4418da1bbbab6eb8","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8444af78980e3b20b49324f4a16ba35024fef3ee069a0eb67616ea6ca821c47a","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3287d9d085fbd618c3971944b65b4be57859f5415f495b33a6adc994edd2f004","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"b4b67b1a91182421f5df999988c690f14d813b9850b40acd06ed44691f6727ad","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"8e7f8264d0fb4c5339605a15daadb037bf238c10b654bb3eee14208f860a32ea","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"782dec38049b92d4e85c1585fbea5474a219c6984a35b004963b00beb1aab538","signature":false,"affectsGlobalScope":true,"impliedFormat":1},{"version":"3cbad9a1ba4453443026ed38e4b8be018abb26565fa7c944376463ad9df07c41","signature":false,"impliedFormat":1},{"version":"225493ce6f255af5792317141c39f3ee79a3ac73deaff24a46673940ed0d71f3","signature":false},{"version":"edf88c2fdc48ac5c0a49c46e3caa2346e9ad7412f445d94faf8cfc3c83110bb4","signature":false},{"version":"1d5921a19f87e56ce121987469677aa0c6c7a1caf0a665ab96ddc50127078c13","signature":false},{"version":"7d5542e0d45af35e87fec4db417110fc8d12bb9c5bb2d31684e47e4d616d978a","signature":false,"affectsGlobalScope":true},{"version":"3f44de34379f3f1d4233c1aaf5f331519e2af5d7968fda0184b3d120488caf4b","signature":false},{"version":"2004d274b78ff173b28440507386dcda7d1cbe8bed6353e83fb953bcf073c4db","signature":false},{"version":"5fe857fd7819470d5df4928774b91c4770563d6073161155e5c85a0b797aca6e","signature":false},{"version":"f3a9433aa74a280ab32089fed091ea01aeb6531211c00778b021d9ce036046c0","signature":false},{"version":"b84da68fe047fd400257d7568a1a9c1bf6d961ba2618b952544f5fe1a6ce8299","signature":false},{"version":"590ea670327c9e07f36162ddd89003ff3ba51cc4e2a7f7277bb036e453337a12","signature":false},{"version":"eefb1eff310441267c4d7c3f09727b0490f04b10a65d24ad91e607c36d65e335","signature":false},{"version":"c0d37e156772d119364cc35e7a4757c8475f5d5d00cda57f8d46c360fc692032","signature":false},{"version":"639b142d63487f9cabfe0f4498de27f813072819c18770110a73f68307fc2a6d","signature":false},{"version":"44c04cf403266d8f98c78b3aba267aa24cb7547848f72ca81a387690eefe0ead","signature":false},{"version":"b3ea234660a7a6cd37285435391940f0c79760c0860884a0c5e0e3b1d2c490c6","signature":false},{"version":"b18ad31753c5e73c567ccb2a1d584dde721506050cac1639c3362d7803761c3c","signature":false},{"version":"eb5e3abe4cbdb8bc5b5f180022a9cacc416efa02f5a0923088500bea45d0e246","signature":false},{"version":"e39dd08f9dc8209c6aa508bc38bef70579bf536894382b8c85a699460cbbb936","signature":false},{"version":"2628151ce4cb788d30e6763a0ae93997d7e637494f108dd11c819a13f95608a3","signature":false},{"version":"dbe01e4bb680a4ccceae931b308a3c801f293a343329d2172c73300dd7500940","signature":false},{"version":"c99351633c15feaed2edf31e5ca17f2c97fc99610445a4944127227c1f2f35af","signature":false},{"version":"90343f3161a7d7cf5987da7935481f26a66f4b96ec069900fa8fad05719cf028","signature":false},{"version":"0ae91c16dccd2043ebf4724c3d71337d57bd546a385abb94c5855cfdfb409f12","signature":false},{"version":"0eee8f1ea3f8a6afb2c76a3020190a712da7eab6726bc66e0756ee96e6287bd3","signature":false},{"version":"32df78942a21392b71b01b4f9e91ca0675480bc37762bfc45ad3913d0ab916e4","signature":false},{"version":"8463c1378e3ef322a9375fb5ca088cc6dab5231d6f477708162bd34bfc22bd76","signature":false},{"version":"4e3c09ebf6f9afaf4dfdcbbb669b7a7bc7a4146d510acce673a2f97b1436328b","signature":false},{"version":"06165fbd83b39c1cbc1424e20ceee8110bbe406078f4c5e57076ecd0a9c45ec2","signature":false},{"version":"abe434db820cb8a7ad25e205821f45f4c9c0dbb85fea647b044e8c855bbd7f51","signature":false},{"version":"a2c30a6edfc8ad77e1c3b192d4868d7841891d477047c98ba0921a1735a0d33f","signature":false}],"root":[[64,93]],"options":{"allowJs":true,"allowSyntheticDefaultImports":true,"composite":true,"esModuleInterop":true,"module":99,"noFallthroughCasesInSwitch":true,"noImplicitAny":true,"noImplicitOverride":true,"noImplicitReturns":true,"rootDir":"./src","skipLibCheck":true,"strict":true,"strictFunctionTypes":true,"strictNullChecks":true,"target":9,"useUnknownInCatchVariables":true},"referencedMap":[[72,1],[74,1],[65,1],[80,1],[83,1],[85,1]],"changeFileSet":[61,62,12,10,11,16,15,2,17,18,19,20,21,22,23,24,3,25,26,4,27,31,28,29,30,32,33,34,5,35,36,37,38,6,42,39,40,41,43,7,44,49,50,45,46,47,48,8,54,51,52,53,55,9,56,63,57,58,60,59,1,14,13,69,70,71,75,72,73,74,64,65,76,77,78,67,68,79,80,81,82,83,84,85,86,66,87,88,89,90,91,92,93],"version":"5.9.3"}
package/tsup.config.ts ADDED
@@ -0,0 +1,107 @@
1
+ import { readFileSync, writeFileSync } from "node:fs";
2
+ import { resolve } from "node:path";
3
+ import { defineConfig } from "tsup";
4
+
5
+ export default defineConfig({
6
+ entry: {
7
+ index: "src/index.ts",
8
+ },
9
+ format: ["esm"],
10
+ target: "node18",
11
+ outDir: "../../dist/cli",
12
+ clean: true,
13
+ sourcemap: true,
14
+ dts: false,
15
+ minify: process.env.NODE_ENV === "production",
16
+ splitting: false,
17
+ bundle: true,
18
+ keepNames: true,
19
+ platform: "node",
20
+ esbuildOptions: (options) => {
21
+ options.resolveExtensions = [".ts", ".js", ".json"];
22
+ // 使用 esbuild 的别名机制
23
+ // 由于 esbuild 的 alias 不支持通配符,我们需要注入多个具体的别名
24
+ },
25
+ external: [
26
+ // Node.js 内置模块
27
+ "ws",
28
+ "child_process",
29
+ "fs",
30
+ "path",
31
+ "url",
32
+ "process",
33
+ "dotenv",
34
+ "os",
35
+ "stream",
36
+ "events",
37
+ "util",
38
+ "crypto",
39
+ "http",
40
+ "https",
41
+ // 依赖的外部包(不打包)
42
+ "commander",
43
+ "chalk",
44
+ "consola",
45
+ "ora",
46
+ "express",
47
+ "cli-table3",
48
+ // @xiaozhi-client/config 包(运行时从 dist/config 读取)
49
+ "@xiaozhi-client/config",
50
+ "@xiaozhi-client/config.js",
51
+ // Backend 模块(运行时从 dist/backend 读取)
52
+ "@root/WebServer",
53
+ "@root/WebServer.js",
54
+ ],
55
+ outExtension: () => ({
56
+ js: ".js",
57
+ }),
58
+ onSuccess: async () => {
59
+ // 构建后处理:修复导入路径
60
+ const filePath = resolve("../../dist/cli/index.js");
61
+ let content = readFileSync(filePath, "utf-8");
62
+
63
+ // 替换 @xiaozhi-client/config 和 @root/* 为指向正确位置的相对路径
64
+ content = content
65
+ .replace(
66
+ /from\s*["']@xiaozhi-client\/config\.js["']/g,
67
+ 'from "../config/index.js"'
68
+ )
69
+ .replace(
70
+ /from\s*["']@xiaozhi-client\/config["']/g,
71
+ 'from "../config/index.js"'
72
+ )
73
+ .replace(
74
+ /from\s*["']@root\/WebServer\.js["']/g,
75
+ 'from "../backend/WebServer.js"'
76
+ )
77
+ .replace(
78
+ /from\s*["']@root\/WebServer["']/g,
79
+ 'from "../backend/WebServer.js"'
80
+ )
81
+ // 替换动态导入中的 @root/WebServer.js
82
+ .replace(
83
+ /import\(["']@root\/WebServer\.js["']\)/g,
84
+ 'import("../backend/WebServer.js")'
85
+ )
86
+ .replace(
87
+ /import\(["']@root\/WebServer["']\)/g,
88
+ 'import("../backend/WebServer.js")'
89
+ );
90
+
91
+ writeFileSync(filePath, content);
92
+ console.log("✅ 已修复 dist/cli/index.js 中的导入路径");
93
+
94
+ // 同步根 package.json 版本到与 CLI 包一致
95
+ const cliPkgPath = resolve("../../packages/cli/package.json");
96
+ const rootPkgPath = resolve("../../package.json");
97
+
98
+ const cliPkg = JSON.parse(readFileSync(cliPkgPath, "utf-8"));
99
+ const rootPkg = JSON.parse(readFileSync(rootPkgPath, "utf-8"));
100
+
101
+ if (cliPkg.version !== rootPkg.version) {
102
+ rootPkg.version = cliPkg.version;
103
+ writeFileSync(rootPkgPath, JSON.stringify(rootPkg, null, 2) + "\n");
104
+ console.log(`✅ 已同步根 package.json 版本到 ${cliPkg.version}`);
105
+ }
106
+ },
107
+ });