ccjk 13.6.7 → 14.0.1

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 (51) hide show
  1. package/dist/chunks/api-cli.mjs +4 -2
  2. package/dist/chunks/api-config-selector.mjs +2 -4
  3. package/dist/chunks/auto-fix.mjs +3 -1
  4. package/dist/chunks/ccjk-all.mjs +5 -2
  5. package/dist/chunks/ccjk-mcp.mjs +5 -2
  6. package/dist/chunks/ccjk-setup.mjs +4 -1
  7. package/dist/chunks/ccr.mjs +5 -8
  8. package/dist/chunks/check-updates.mjs +1 -4
  9. package/dist/chunks/claude-code-incremental-manager.mjs +4 -6
  10. package/dist/chunks/code-type-resolver.mjs +878 -0
  11. package/dist/chunks/codex-config-switch.mjs +0 -1
  12. package/dist/chunks/codex-provider-manager.mjs +0 -1
  13. package/dist/chunks/codex.mjs +2 -2
  14. package/dist/chunks/config-switch.mjs +2 -4
  15. package/dist/chunks/config.mjs +1144 -5
  16. package/dist/chunks/config2.mjs +6 -4
  17. package/dist/chunks/config3.mjs +4 -2
  18. package/dist/chunks/doctor.mjs +1 -1
  19. package/dist/chunks/evolution.mjs +47 -27
  20. package/dist/chunks/features.mjs +2 -3
  21. package/dist/chunks/index10.mjs +115 -12
  22. package/dist/chunks/init.mjs +44 -17
  23. package/dist/chunks/installer.mjs +2 -2
  24. package/dist/chunks/mcp-cli.mjs +18 -19
  25. package/dist/chunks/mcp.mjs +6 -7
  26. package/dist/chunks/package.mjs +1 -1
  27. package/dist/chunks/platform.mjs +1 -1
  28. package/dist/chunks/quick-setup.mjs +2 -5
  29. package/dist/chunks/slash-commands.mjs +1 -1
  30. package/dist/chunks/status.mjs +63 -16
  31. package/dist/chunks/uninstall.mjs +1 -3
  32. package/dist/chunks/update.mjs +4 -5
  33. package/dist/cli.mjs +58 -17
  34. package/dist/i18n/locales/en/configuration.json +6 -2
  35. package/dist/i18n/locales/en/menu.json +7 -0
  36. package/dist/i18n/locales/zh-CN/configuration.json +6 -2
  37. package/dist/i18n/locales/zh-CN/menu.json +7 -0
  38. package/dist/index.d.mts +64 -17
  39. package/dist/index.d.ts +64 -17
  40. package/dist/index.mjs +12 -720
  41. package/dist/shared/{ccjk.DHaUdzX3.mjs → ccjk.B6VCKdyy.mjs} +2 -2
  42. package/dist/shared/ccjk.BO45TPXJ.mjs +807 -0
  43. package/dist/shared/{ccjk.B4aXNclK.mjs → ccjk.CVjfbEIj.mjs} +1 -1
  44. package/dist/shared/{ccjk.Dz0ssUQx.mjs → ccjk.Dh6Be-ef.mjs} +1 -1
  45. package/package.json +1 -1
  46. package/dist/chunks/claude-code-config-manager.mjs +0 -811
  47. package/dist/chunks/claude-config.mjs +0 -286
  48. package/dist/chunks/intent-engine.mjs +0 -142
  49. package/dist/chunks/smart-defaults.mjs +0 -425
  50. package/dist/shared/ccjk.DJuyfrlL.mjs +0 -348
  51. package/dist/shared/ccjk.yYQMbHH3.mjs +0 -115
@@ -0,0 +1,807 @@
1
+ import { exec } from 'node:child_process';
2
+ import { promises } from 'node:fs';
3
+ import * as os from 'node:os';
4
+ import * as path from 'node:path';
5
+ import { promisify } from 'node:util';
6
+
7
+ const execAsync = promisify(exec);
8
+ class BaseCodeTool {
9
+ config;
10
+ configPath;
11
+ constructor(initialConfig) {
12
+ this.config = {
13
+ name: this.getMetadata().name,
14
+ ...initialConfig
15
+ };
16
+ this.configPath = this.getDefaultConfigPath();
17
+ }
18
+ /**
19
+ * Get the default configuration path for this tool
20
+ */
21
+ getDefaultConfigPath() {
22
+ const homeDir = os.homedir();
23
+ const configDir = path.join(homeDir, ".ccjk", "tools");
24
+ return path.join(configDir, `${this.getMetadata().name}.json`);
25
+ }
26
+ /**
27
+ * Check if the tool is installed
28
+ */
29
+ async isInstalled() {
30
+ try {
31
+ const command = this.getInstallCheckCommand();
32
+ const { stdout, stderr } = await execAsync(command);
33
+ const version = this.parseVersion(stdout || stderr);
34
+ return {
35
+ installed: true,
36
+ version,
37
+ path: await this.findToolPath()
38
+ };
39
+ } catch (error) {
40
+ return {
41
+ installed: false,
42
+ error: error instanceof Error ? error.message : "Unknown error"
43
+ };
44
+ }
45
+ }
46
+ /**
47
+ * Install the tool
48
+ */
49
+ async install() {
50
+ try {
51
+ const command = this.getInstallCommand();
52
+ const { stdout, stderr } = await execAsync(command);
53
+ return {
54
+ success: true,
55
+ output: stdout || stderr,
56
+ exitCode: 0
57
+ };
58
+ } catch (error) {
59
+ return {
60
+ success: false,
61
+ error: error instanceof Error ? error.message : "Installation failed",
62
+ exitCode: 1
63
+ };
64
+ }
65
+ }
66
+ /**
67
+ * Uninstall the tool
68
+ */
69
+ async uninstall() {
70
+ try {
71
+ const command = this.getUninstallCommand();
72
+ const { stdout, stderr } = await execAsync(command);
73
+ await this.removeConfigFile();
74
+ return {
75
+ success: true,
76
+ output: stdout || stderr,
77
+ exitCode: 0
78
+ };
79
+ } catch (error) {
80
+ return {
81
+ success: false,
82
+ error: error instanceof Error ? error.message : "Uninstallation failed",
83
+ exitCode: 1
84
+ };
85
+ }
86
+ }
87
+ /**
88
+ * Get current configuration
89
+ */
90
+ async getConfig() {
91
+ try {
92
+ await this.loadConfig();
93
+ return { ...this.config };
94
+ } catch (_error) {
95
+ return { ...this.config };
96
+ }
97
+ }
98
+ /**
99
+ * Update configuration
100
+ */
101
+ async updateConfig(updates) {
102
+ this.config = {
103
+ ...this.config,
104
+ ...updates
105
+ };
106
+ await this.saveConfig();
107
+ }
108
+ /**
109
+ * Configure the tool with full config
110
+ */
111
+ async configure(config) {
112
+ const isValid = await this.validateConfig(config);
113
+ if (!isValid) {
114
+ throw new Error("Invalid configuration");
115
+ }
116
+ this.config = { ...config };
117
+ await this.saveConfig();
118
+ }
119
+ /**
120
+ * Validate configuration
121
+ */
122
+ async validateConfig(config) {
123
+ if (!config.name) {
124
+ return false;
125
+ }
126
+ return true;
127
+ }
128
+ /**
129
+ * Execute a command with the tool
130
+ */
131
+ async execute(command, args = []) {
132
+ try {
133
+ const fullCommand = this.buildCommand(command, args);
134
+ const { stdout, stderr } = await execAsync(fullCommand, {
135
+ env: { ...process.env, ...this.config.env }
136
+ });
137
+ return {
138
+ success: true,
139
+ output: stdout || stderr,
140
+ exitCode: 0
141
+ };
142
+ } catch (error) {
143
+ return {
144
+ success: false,
145
+ error: error.message || "Execution failed",
146
+ exitCode: error.code || 1
147
+ };
148
+ }
149
+ }
150
+ /**
151
+ * Get tool version
152
+ */
153
+ async getVersion() {
154
+ const status = await this.isInstalled();
155
+ return status.version;
156
+ }
157
+ /**
158
+ * Reset tool to default configuration
159
+ */
160
+ async reset() {
161
+ this.config = {
162
+ name: this.getMetadata().name
163
+ };
164
+ await this.removeConfigFile();
165
+ }
166
+ /**
167
+ * Load configuration from file
168
+ */
169
+ async loadConfig() {
170
+ try {
171
+ const data = await promises.readFile(this.configPath, "utf-8");
172
+ const loadedConfig = JSON.parse(data);
173
+ this.config = { ...this.config, ...loadedConfig };
174
+ } catch (_error) {
175
+ }
176
+ }
177
+ /**
178
+ * Save configuration to file
179
+ */
180
+ async saveConfig() {
181
+ try {
182
+ const configDir = path.dirname(this.configPath);
183
+ await promises.mkdir(configDir, { recursive: true });
184
+ await promises.writeFile(this.configPath, JSON.stringify(this.config, null, 2));
185
+ } catch (error) {
186
+ throw new Error(`Failed to save configuration: ${error}`);
187
+ }
188
+ }
189
+ /**
190
+ * Remove configuration file
191
+ */
192
+ async removeConfigFile() {
193
+ try {
194
+ await promises.unlink(this.configPath);
195
+ } catch (_error) {
196
+ }
197
+ }
198
+ /**
199
+ * Build command string from command and arguments
200
+ */
201
+ buildCommand(command, args) {
202
+ const escapedArgs = args.map((arg) => {
203
+ return arg.includes(" ") ? `"${arg}"` : arg;
204
+ });
205
+ return [command, ...escapedArgs].join(" ");
206
+ }
207
+ /**
208
+ * Parse version from command output
209
+ */
210
+ parseVersion(output) {
211
+ const patterns = [
212
+ /version\s+(\d+\.\d+\.\d+)/i,
213
+ /v?(\d+\.\d+\.\d+)/,
214
+ /(\d+\.\d+\.\d+)/
215
+ ];
216
+ for (const pattern of patterns) {
217
+ const match = output.match(pattern);
218
+ if (match) {
219
+ return match[1];
220
+ }
221
+ }
222
+ return void 0;
223
+ }
224
+ /**
225
+ * Find the tool's installation path
226
+ */
227
+ async findToolPath() {
228
+ try {
229
+ const { stdout } = await execAsync(`which ${this.getMetadata().name}`);
230
+ return stdout.trim();
231
+ } catch (_error) {
232
+ return void 0;
233
+ }
234
+ }
235
+ /**
236
+ * Create default capabilities object
237
+ */
238
+ createDefaultCapabilities() {
239
+ return {
240
+ supportsChat: false,
241
+ supportsFileEdit: false,
242
+ supportsCodeGen: false,
243
+ supportsReview: false,
244
+ supportsTesting: false,
245
+ supportsDebugging: false
246
+ };
247
+ }
248
+ }
249
+
250
+ class AiderTool extends BaseCodeTool {
251
+ getMetadata() {
252
+ return {
253
+ name: "aider",
254
+ displayName: "Aider",
255
+ description: "AI pair programming in your terminal",
256
+ version: "1.0.0",
257
+ homepage: "https://aider.chat",
258
+ documentation: "https://aider.chat/docs",
259
+ capabilities: {
260
+ supportsChat: true,
261
+ supportsFileEdit: true,
262
+ supportsCodeGen: true,
263
+ supportsReview: true,
264
+ supportsTesting: false,
265
+ supportsDebugging: true
266
+ }
267
+ };
268
+ }
269
+ getInstallCheckCommand() {
270
+ return "aider --version";
271
+ }
272
+ getInstallCommand() {
273
+ return "pip install aider-chat";
274
+ }
275
+ getUninstallCommand() {
276
+ return "pip uninstall -y aider-chat";
277
+ }
278
+ /**
279
+ * Start a chat session
280
+ */
281
+ async chat(prompt) {
282
+ return this.execute("aider", ["--message", prompt]);
283
+ }
284
+ /**
285
+ * Continue a chat session
286
+ */
287
+ async continueChat(message) {
288
+ return this.execute("aider", ["--message", message]);
289
+ }
290
+ /**
291
+ * End chat session
292
+ */
293
+ async endChat() {
294
+ await this.execute("aider", ["--exit"]);
295
+ }
296
+ /**
297
+ * Edit a file
298
+ */
299
+ async editFile(filePath, instructions) {
300
+ return this.execute("aider", [filePath, "--message", instructions]);
301
+ }
302
+ /**
303
+ * Edit multiple files
304
+ */
305
+ async editFiles(files, instructions) {
306
+ return this.execute("aider", [...files, "--message", instructions]);
307
+ }
308
+ }
309
+
310
+ class ClaudeCodeTool extends BaseCodeTool {
311
+ getMetadata() {
312
+ return {
313
+ name: "claude-code",
314
+ displayName: "Claude Code",
315
+ description: "Anthropic's official CLI tool for Claude AI",
316
+ version: "1.0.0",
317
+ homepage: "https://claude.ai",
318
+ documentation: "https://docs.anthropic.com/claude/docs",
319
+ capabilities: {
320
+ supportsChat: true,
321
+ supportsFileEdit: true,
322
+ supportsCodeGen: true,
323
+ supportsReview: true,
324
+ supportsTesting: true,
325
+ supportsDebugging: true
326
+ },
327
+ runtime: {
328
+ runtime: "claude-code",
329
+ ownership: "host-native",
330
+ configBackend: "claude-family",
331
+ native: {
332
+ agentLoop: true,
333
+ planTask: true,
334
+ subagents: true,
335
+ slashCommands: true,
336
+ mcp: true,
337
+ permissions: true,
338
+ memory: true,
339
+ ideIntegration: true,
340
+ worktree: true,
341
+ statusline: true
342
+ },
343
+ managedByCcjk: {
344
+ providerProfiles: false,
345
+ modelRouting: true,
346
+ configSync: true,
347
+ permissionRepair: true,
348
+ mcpBundles: true,
349
+ doctor: true
350
+ }
351
+ }
352
+ };
353
+ }
354
+ getInstallCheckCommand() {
355
+ return "claude --version";
356
+ }
357
+ getInstallCommand() {
358
+ return "npm install -g @anthropic-ai/claude-code";
359
+ }
360
+ getUninstallCommand() {
361
+ return "npm uninstall -g @anthropic-ai/claude-code";
362
+ }
363
+ /**
364
+ * Start a chat session
365
+ */
366
+ async chat(prompt) {
367
+ return this.execute("claude", ["chat", prompt]);
368
+ }
369
+ /**
370
+ * Continue a chat session
371
+ */
372
+ async continueChat(message) {
373
+ return this.execute("claude", ["continue", message]);
374
+ }
375
+ /**
376
+ * End chat session
377
+ */
378
+ async endChat() {
379
+ await this.execute("claude", ["exit"]);
380
+ }
381
+ /**
382
+ * Edit a file
383
+ */
384
+ async editFile(filePath, instructions) {
385
+ return this.execute("claude", ["edit", filePath, "--instructions", instructions]);
386
+ }
387
+ /**
388
+ * Edit multiple files
389
+ */
390
+ async editFiles(files, instructions) {
391
+ const fileArgs = files.flatMap((f) => ["--file", f]);
392
+ return this.execute("claude", ["edit", ...fileArgs, "--instructions", instructions]);
393
+ }
394
+ /**
395
+ * Generate code
396
+ */
397
+ async generateCode(prompt, outputPath) {
398
+ const args = ["generate", prompt];
399
+ if (outputPath) {
400
+ args.push("--output", outputPath);
401
+ }
402
+ return this.execute("claude", args);
403
+ }
404
+ }
405
+
406
+ class ClineTool extends BaseCodeTool {
407
+ getMetadata() {
408
+ return {
409
+ name: "cline",
410
+ displayName: "Cline",
411
+ description: "Autonomous coding agent for VS Code",
412
+ version: "1.0.0",
413
+ homepage: "https://github.com/cline/cline",
414
+ documentation: "https://github.com/cline/cline/wiki",
415
+ capabilities: {
416
+ supportsChat: true,
417
+ supportsFileEdit: true,
418
+ supportsCodeGen: true,
419
+ supportsReview: true,
420
+ supportsTesting: true,
421
+ supportsDebugging: true
422
+ }
423
+ };
424
+ }
425
+ getInstallCheckCommand() {
426
+ return "cline --version";
427
+ }
428
+ getInstallCommand() {
429
+ return "npm install -g cline";
430
+ }
431
+ getUninstallCommand() {
432
+ return "npm uninstall -g cline";
433
+ }
434
+ /**
435
+ * Start a chat session
436
+ */
437
+ async chat(prompt) {
438
+ return this.execute("cline", ["chat", prompt]);
439
+ }
440
+ /**
441
+ * Continue a chat session
442
+ */
443
+ async continueChat(message) {
444
+ return this.execute("cline", ["continue", message]);
445
+ }
446
+ /**
447
+ * End chat session
448
+ */
449
+ async endChat() {
450
+ await this.execute("cline", ["exit"]);
451
+ }
452
+ /**
453
+ * Edit a file
454
+ */
455
+ async editFile(filePath, instructions) {
456
+ return this.execute("cline", ["edit", filePath, "--instructions", instructions]);
457
+ }
458
+ /**
459
+ * Edit multiple files
460
+ */
461
+ async editFiles(files, instructions) {
462
+ const fileArgs = files.flatMap((f) => ["--file", f]);
463
+ return this.execute("cline", ["edit", ...fileArgs, "--instructions", instructions]);
464
+ }
465
+ /**
466
+ * Generate code
467
+ */
468
+ async generateCode(prompt, outputPath) {
469
+ const args = ["generate", prompt];
470
+ if (outputPath) {
471
+ args.push("--output", outputPath);
472
+ }
473
+ return this.execute("cline", args);
474
+ }
475
+ }
476
+
477
+ class CodexTool extends BaseCodeTool {
478
+ getMetadata() {
479
+ return {
480
+ name: "codex",
481
+ displayName: "OpenAI Codex",
482
+ description: "OpenAI's code generation model",
483
+ version: "1.0.0",
484
+ homepage: "https://openai.com/codex",
485
+ documentation: "https://platform.openai.com/docs",
486
+ capabilities: {
487
+ supportsChat: true,
488
+ supportsFileEdit: false,
489
+ supportsCodeGen: true,
490
+ supportsReview: false,
491
+ supportsTesting: false,
492
+ supportsDebugging: false
493
+ },
494
+ runtime: {
495
+ runtime: "codex",
496
+ ownership: "host-native",
497
+ configBackend: "tool-specific",
498
+ native: {
499
+ agentLoop: true,
500
+ planTask: true,
501
+ subagents: true,
502
+ slashCommands: true,
503
+ mcp: true,
504
+ permissions: true,
505
+ memory: true,
506
+ ideIntegration: true,
507
+ worktree: true,
508
+ statusline: false
509
+ },
510
+ managedByCcjk: {
511
+ providerProfiles: false,
512
+ modelRouting: true,
513
+ configSync: true,
514
+ permissionRepair: true,
515
+ mcpBundles: true,
516
+ doctor: true
517
+ }
518
+ }
519
+ };
520
+ }
521
+ getInstallCheckCommand() {
522
+ return "codex --version";
523
+ }
524
+ getInstallCommand() {
525
+ return "pip install openai-codex";
526
+ }
527
+ getUninstallCommand() {
528
+ return "pip uninstall -y openai-codex";
529
+ }
530
+ /**
531
+ * Generate code
532
+ */
533
+ async generateCode(prompt, outputPath) {
534
+ const args = ["generate", prompt];
535
+ if (outputPath) {
536
+ args.push("--output", outputPath);
537
+ }
538
+ return this.execute("codex", args);
539
+ }
540
+ }
541
+
542
+ class ContinueTool extends BaseCodeTool {
543
+ getMetadata() {
544
+ return {
545
+ name: "continue",
546
+ displayName: "Continue",
547
+ description: "Open-source autopilot for software development",
548
+ version: "1.0.0",
549
+ homepage: "https://continue.dev",
550
+ documentation: "https://continue.dev/docs",
551
+ capabilities: {
552
+ supportsChat: true,
553
+ supportsFileEdit: true,
554
+ supportsCodeGen: true,
555
+ supportsReview: true,
556
+ supportsTesting: true,
557
+ supportsDebugging: true
558
+ }
559
+ };
560
+ }
561
+ getInstallCheckCommand() {
562
+ return "continue --version";
563
+ }
564
+ getInstallCommand() {
565
+ return "npm install -g continue";
566
+ }
567
+ getUninstallCommand() {
568
+ return "npm uninstall -g continue";
569
+ }
570
+ /**
571
+ * Start a chat session
572
+ */
573
+ async chat(prompt) {
574
+ return this.execute("continue", ["chat", prompt]);
575
+ }
576
+ /**
577
+ * Continue a chat session
578
+ */
579
+ async continueChat(message) {
580
+ return this.execute("continue", ["chat", message]);
581
+ }
582
+ /**
583
+ * End chat session
584
+ */
585
+ async endChat() {
586
+ await this.execute("continue", ["exit"]);
587
+ }
588
+ /**
589
+ * Generate code
590
+ */
591
+ async generateCode(prompt, outputPath) {
592
+ const args = ["generate", prompt];
593
+ if (outputPath) {
594
+ args.push("--output", outputPath);
595
+ }
596
+ return this.execute("continue", args);
597
+ }
598
+ }
599
+
600
+ class CursorTool extends BaseCodeTool {
601
+ getMetadata() {
602
+ return {
603
+ name: "cursor",
604
+ displayName: "Cursor",
605
+ description: "AI-first code editor",
606
+ version: "1.0.0",
607
+ homepage: "https://cursor.sh",
608
+ documentation: "https://cursor.sh/docs",
609
+ capabilities: {
610
+ supportsChat: true,
611
+ supportsFileEdit: true,
612
+ supportsCodeGen: true,
613
+ supportsReview: true,
614
+ supportsTesting: true,
615
+ supportsDebugging: true
616
+ }
617
+ };
618
+ }
619
+ getInstallCheckCommand() {
620
+ return "cursor --version";
621
+ }
622
+ getInstallCommand() {
623
+ return 'echo "Please download Cursor from https://cursor.sh"';
624
+ }
625
+ getUninstallCommand() {
626
+ return 'echo "Please uninstall Cursor manually"';
627
+ }
628
+ /**
629
+ * Start a chat session
630
+ */
631
+ async chat(prompt) {
632
+ return this.execute("cursor", ["chat", prompt]);
633
+ }
634
+ /**
635
+ * Continue a chat session
636
+ */
637
+ async continueChat(message) {
638
+ return this.execute("cursor", ["chat", message]);
639
+ }
640
+ /**
641
+ * End chat session
642
+ */
643
+ async endChat() {
644
+ await this.execute("cursor", ["exit"]);
645
+ }
646
+ /**
647
+ * Edit a file
648
+ */
649
+ async editFile(filePath, instructions) {
650
+ return this.execute("cursor", ["edit", filePath, "--instructions", instructions]);
651
+ }
652
+ /**
653
+ * Edit multiple files
654
+ */
655
+ async editFiles(files, instructions) {
656
+ const fileArgs = files.flatMap((f) => ["--file", f]);
657
+ return this.execute("cursor", ["edit", ...fileArgs, "--instructions", instructions]);
658
+ }
659
+ /**
660
+ * Generate code
661
+ */
662
+ async generateCode(prompt, outputPath) {
663
+ const args = ["generate", prompt];
664
+ if (outputPath) {
665
+ args.push("--output", outputPath);
666
+ }
667
+ return this.execute("cursor", args);
668
+ }
669
+ }
670
+
671
+ class ToolRegistry {
672
+ static instance;
673
+ tools;
674
+ toolClasses;
675
+ constructor() {
676
+ this.tools = /* @__PURE__ */ new Map();
677
+ this.toolClasses = /* @__PURE__ */ new Map();
678
+ }
679
+ /**
680
+ * Get singleton instance
681
+ */
682
+ static getInstance() {
683
+ if (!ToolRegistry.instance) {
684
+ ToolRegistry.instance = new ToolRegistry();
685
+ }
686
+ return ToolRegistry.instance;
687
+ }
688
+ /**
689
+ * Register a tool class
690
+ */
691
+ registerToolClass(name, toolClass) {
692
+ this.toolClasses.set(name.toLowerCase(), toolClass);
693
+ }
694
+ /**
695
+ * Register a tool instance
696
+ */
697
+ registerTool(tool) {
698
+ const metadata = tool.getMetadata();
699
+ this.tools.set(metadata.name.toLowerCase(), tool);
700
+ }
701
+ /**
702
+ * Get a tool instance by name
703
+ */
704
+ getTool(name) {
705
+ const normalizedName = name.toLowerCase();
706
+ if (this.tools.has(normalizedName)) {
707
+ return this.tools.get(normalizedName);
708
+ }
709
+ const ToolClass = this.toolClasses.get(normalizedName);
710
+ if (ToolClass) {
711
+ const tool = new ToolClass();
712
+ this.tools.set(normalizedName, tool);
713
+ return tool;
714
+ }
715
+ return void 0;
716
+ }
717
+ /**
718
+ * Get all registered tool names
719
+ */
720
+ getToolNames() {
721
+ return Array.from(this.toolClasses.keys());
722
+ }
723
+ /**
724
+ * Get all tool instances
725
+ */
726
+ getAllTools() {
727
+ return Array.from(this.tools.values());
728
+ }
729
+ /**
730
+ * Check if a tool is registered
731
+ */
732
+ hasTool(name) {
733
+ return this.toolClasses.has(name.toLowerCase());
734
+ }
735
+ /**
736
+ * Unregister a tool
737
+ */
738
+ unregisterTool(name) {
739
+ const normalizedName = name.toLowerCase();
740
+ this.tools.delete(normalizedName);
741
+ this.toolClasses.delete(normalizedName);
742
+ }
743
+ /**
744
+ * Clear all registered tools
745
+ */
746
+ clear() {
747
+ this.tools.clear();
748
+ this.toolClasses.clear();
749
+ }
750
+ /**
751
+ * Get metadata for all registered tools
752
+ */
753
+ async getAllMetadata() {
754
+ const metadata = [];
755
+ for (const name of this.toolClasses.keys()) {
756
+ const tool = this.getTool(name);
757
+ if (tool) {
758
+ metadata.push(tool.getMetadata());
759
+ }
760
+ }
761
+ return metadata;
762
+ }
763
+ }
764
+ function getRegistry() {
765
+ return ToolRegistry.getInstance();
766
+ }
767
+
768
+ const RUNTIME_CAPABILITY_FALLBACKS = {
769
+ myclaude: {
770
+ runtime: "myclaude",
771
+ ownership: "hybrid",
772
+ configBackend: "claude-family",
773
+ native: {
774
+ agentLoop: true,
775
+ planTask: true,
776
+ subagents: true,
777
+ slashCommands: true,
778
+ mcp: true,
779
+ permissions: true,
780
+ memory: true,
781
+ ideIntegration: true,
782
+ worktree: true,
783
+ statusline: true
784
+ },
785
+ managedByCcjk: {
786
+ providerProfiles: true,
787
+ modelRouting: true,
788
+ configSync: true,
789
+ permissionRepair: true,
790
+ mcpBundles: true,
791
+ doctor: true
792
+ }
793
+ }
794
+ };
795
+ const registry = ToolRegistry.getInstance();
796
+ registry.registerToolClass("claude-code", ClaudeCodeTool);
797
+ registry.registerToolClass("codex", CodexTool);
798
+ registry.registerToolClass("aider", AiderTool);
799
+ registry.registerToolClass("continue", ContinueTool);
800
+ registry.registerToolClass("cline", ClineTool);
801
+ registry.registerToolClass("cursor", CursorTool);
802
+ function getRuntimeCapabilityDescriptor(name) {
803
+ const normalizedName = name.toLowerCase();
804
+ return registry.getTool(normalizedName)?.getMetadata().runtime || RUNTIME_CAPABILITY_FALLBACKS[normalizedName];
805
+ }
806
+
807
+ export { AiderTool as A, BaseCodeTool as B, ClaudeCodeTool as C, ToolRegistry as T, getRegistry as a, ClineTool as b, CodexTool as c, ContinueTool as d, CursorTool as e, getRuntimeCapabilityDescriptor as g };