Skip to content

Commit 1608313

Browse files
author
catlog22
committed
feat: Refactor CLI tool configuration management and introduce skill context loader
- Updated `claude-cli-tools.ts` to support new model configurations and migration from older versions. - Added `getPredefinedModels` and `getAllPredefinedModels` functions for better model management. - Deprecated `cli-config-manager.ts` in favor of `claude-cli-tools.ts`, maintaining backward compatibility. - Introduced `skill-context-loader.ts` to handle skill context loading based on user prompts and keywords. - Enhanced tool configuration functions to include secondary models and improved migration logic. - Updated index file to register the new skill context loader tool.
1 parent 2c11392 commit 1608313

11 files changed

Lines changed: 1956 additions & 417 deletions

File tree

.claude/cli-tools.json

Lines changed: 31 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,53 @@
11
{
2-
"$schema": "./cli-tools.schema.json",
3-
"version": "2.0.0",
2+
"version": "3.0.0",
3+
"models": {
4+
"gemini": ["gemini-2.5-pro", "gemini-2.5-flash" ],
5+
"qwen": ["coder-model", "vision-model" ],
6+
"codex": ["gpt-5.2"],
7+
"claude": ["sonnet", "opus", "haiku"],
8+
"opencode": [
9+
"opencode/glm-4.7-free",
10+
"opencode/gpt-5-nano",
11+
"opencode/grok-code",
12+
"opencode/minimax-m2.1-free",
13+
"anthropic/claude-sonnet-4-20250514",
14+
"anthropic/claude-opus-4-20250514",
15+
"openai/gpt-4.1",
16+
"openai/o3",
17+
"google/gemini-2.5-pro",
18+
"google/gemini-2.5-flash"
19+
]
20+
},
421
"tools": {
522
"gemini": {
623
"enabled": true,
7-
"isBuiltin": true,
8-
"command": "gemini",
9-
"description": "Google AI for code analysis",
24+
"primaryModel": "gemini-2.5-pro",
25+
"secondaryModel": "gemini-2.5-flash",
1026
"tags": []
1127
},
1228
"qwen": {
1329
"enabled": true,
14-
"isBuiltin": true,
15-
"command": "qwen",
16-
"description": "Alibaba AI assistant",
30+
"primaryModel": "coder-model",
31+
"secondaryModel": "coder-model",
1732
"tags": []
1833
},
1934
"codex": {
2035
"enabled": true,
21-
"isBuiltin": true,
22-
"command": "codex",
23-
"description": "OpenAI code generation",
36+
"primaryModel": "gpt-5.2",
37+
"secondaryModel": "gpt-5.2",
2438
"tags": []
2539
},
2640
"claude": {
2741
"enabled": true,
28-
"isBuiltin": true,
29-
"command": "claude",
30-
"description": "Anthropic AI assistant",
42+
"primaryModel": "sonnet",
43+
"secondaryModel": "haiku",
3144
"tags": []
3245
},
3346
"opencode": {
3447
"enabled": true,
35-
"isBuiltin": true,
36-
"command": "opencode",
37-
"description": "OpenCode AI assistant",
3848
"primaryModel": "opencode/glm-4.7-free",
39-
"tags": []
49+
"secondaryModel": "opencode/glm-4.7-free",
50+
"tags": ["分析"]
4051
}
4152
},
4253
"customEndpoints": [
@@ -46,5 +57,6 @@
4657
"enabled": true,
4758
"tags": []
4859
}
49-
]
60+
],
61+
"$schema": "./cli-tools.schema.json"
5062
}

ccw/src/commands/tool.ts

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,23 @@ async function execAction(toolName: string | undefined, jsonParams: string | und
159159
// Execute tool
160160
const result = await executeTool(toolName, params);
161161

162-
// Always output JSON
163-
console.log(JSON.stringify(result, null, 2));
162+
// Output raw result value for hooks, or JSON on error
163+
if (result.success && result.result !== undefined) {
164+
// For string results, output directly (useful for hooks)
165+
if (typeof result.result === 'string') {
166+
if (result.result) {
167+
console.log(result.result);
168+
}
169+
// Empty string = silent (no output)
170+
} else {
171+
// For object results, output JSON
172+
console.log(JSON.stringify(result.result, null, 2));
173+
}
174+
} else if (!result.success) {
175+
// Error case - output full JSON for debugging
176+
console.error(JSON.stringify(result, null, 2));
177+
process.exit(1);
178+
}
164179
}
165180

166181
/**

0 commit comments

Comments
 (0)