ccg-ros2-workflow 1.0.0 → 1.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.
- package/bin/cli.js +98 -5
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -9,6 +9,7 @@ const CLAUDE_DIR = path.join(process.env.HOME, '.claude');
|
|
|
9
9
|
const CCG_DIR = path.join(CLAUDE_DIR, '.ccg');
|
|
10
10
|
const COMMANDS_DIR = path.join(CLAUDE_DIR, 'commands', 'ccg');
|
|
11
11
|
const BIN_DIR = path.join(CLAUDE_DIR, 'bin');
|
|
12
|
+
const MCP_CONFIG_PATH = path.join(CLAUDE_DIR, 'mcp_servers.json');
|
|
12
13
|
const SRC_DIR = path.join(__dirname, '..', 'src');
|
|
13
14
|
|
|
14
15
|
const rl = readline.createInterface({
|
|
@@ -63,10 +64,11 @@ async function main() {
|
|
|
63
64
|
console.log('\n请选择操作:');
|
|
64
65
|
console.log('1. 安装工作流');
|
|
65
66
|
console.log('2. 配置 API 密钥');
|
|
66
|
-
console.log('3.
|
|
67
|
-
console.log('4.
|
|
67
|
+
console.log('3. 配置 ace-tool MCP');
|
|
68
|
+
console.log('4. 卸载工作流');
|
|
69
|
+
console.log('5. 退出');
|
|
68
70
|
|
|
69
|
-
const choice = await question('\n请输入选项 (1-
|
|
71
|
+
const choice = await question('\n请输入选项 (1-5): ');
|
|
70
72
|
|
|
71
73
|
switch (choice) {
|
|
72
74
|
case '1':
|
|
@@ -76,6 +78,9 @@ async function main() {
|
|
|
76
78
|
await configureApiKeys();
|
|
77
79
|
break;
|
|
78
80
|
case '3':
|
|
81
|
+
await configureMCP();
|
|
82
|
+
break;
|
|
83
|
+
case '4':
|
|
79
84
|
await uninstall();
|
|
80
85
|
break;
|
|
81
86
|
default:
|
|
@@ -129,10 +134,16 @@ async function install() {
|
|
|
129
134
|
});
|
|
130
135
|
});
|
|
131
136
|
|
|
132
|
-
console.log('\n✅
|
|
137
|
+
console.log('\n✅ 工作流安装完成!\n');
|
|
138
|
+
|
|
139
|
+
// 询问是否配置 MCP
|
|
140
|
+
const configMcp = await question('是否配置 ace-tool MCP?(推荐,提供代码上下文) (Y/n): ');
|
|
141
|
+
if (configMcp.toLowerCase() !== 'n') {
|
|
142
|
+
await configureMCP();
|
|
143
|
+
}
|
|
133
144
|
|
|
134
145
|
// 询问是否配置 API
|
|
135
|
-
const configApi = await question('
|
|
146
|
+
const configApi = await question('\n是否配置 API 密钥? (Y/n): ');
|
|
136
147
|
if (configApi.toLowerCase() !== 'n') {
|
|
137
148
|
await configureApiKeys();
|
|
138
149
|
}
|
|
@@ -140,6 +151,68 @@ async function install() {
|
|
|
140
151
|
console.log('\n📖 使用方法:');
|
|
141
152
|
console.log(' 在 Claude Code 中使用 /ccg:workflow <任务描述>');
|
|
142
153
|
console.log(' 查看所有命令:/ccg:<Tab>');
|
|
154
|
+
console.log('\n⚠️ 请重启终端或 Claude Code 使配置生效');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
async function configureMCP() {
|
|
158
|
+
console.log('\n🔧 配置 ace-tool MCP\n');
|
|
159
|
+
console.log('ace-tool 是 Augment Code 的代码上下文引擎');
|
|
160
|
+
console.log('它能让 AI 自动理解你的项目结构和代码\n');
|
|
161
|
+
|
|
162
|
+
// 检查是否已安装 ace-tool
|
|
163
|
+
let aceToolInstalled = false;
|
|
164
|
+
try {
|
|
165
|
+
execSync('which ace-tool', { stdio: 'ignore' });
|
|
166
|
+
aceToolInstalled = true;
|
|
167
|
+
console.log('✅ 检测到 ace-tool 已安装\n');
|
|
168
|
+
} catch {
|
|
169
|
+
console.log('⚠️ 未检测到 ace-tool\n');
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
if (!aceToolInstalled) {
|
|
173
|
+
console.log('安装 ace-tool 的方式:');
|
|
174
|
+
console.log('1. 访问 https://augmentcode.com/ 注册账号');
|
|
175
|
+
console.log('2. 按照官方指引安装 ace-tool CLI\n');
|
|
176
|
+
|
|
177
|
+
const proceed = await question('是否继续配置 MCP?(可以稍后安装 ace-tool) (Y/n): ');
|
|
178
|
+
if (proceed.toLowerCase() === 'n') {
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
// 读取或创建 MCP 配置
|
|
184
|
+
let mcpConfig = {};
|
|
185
|
+
if (fs.existsSync(MCP_CONFIG_PATH)) {
|
|
186
|
+
try {
|
|
187
|
+
mcpConfig = JSON.parse(fs.readFileSync(MCP_CONFIG_PATH, 'utf8'));
|
|
188
|
+
console.log('检测到已有 MCP 配置,将添加 ace-tool\n');
|
|
189
|
+
} catch {
|
|
190
|
+
mcpConfig = {};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
// 添加 ace-tool 配置
|
|
195
|
+
mcpConfig['ace-tool'] = {
|
|
196
|
+
command: 'ace-tool',
|
|
197
|
+
args: ['mcp'],
|
|
198
|
+
env: {}
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
// 写入配置
|
|
202
|
+
fs.mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
203
|
+
fs.writeFileSync(MCP_CONFIG_PATH, JSON.stringify(mcpConfig, null, 2));
|
|
204
|
+
|
|
205
|
+
console.log('✅ MCP 配置已写入: ~/.claude/mcp_servers.json\n');
|
|
206
|
+
console.log('配置内容:');
|
|
207
|
+
console.log(JSON.stringify(mcpConfig['ace-tool'], null, 2));
|
|
208
|
+
|
|
209
|
+
console.log('\n📌 后续步骤:');
|
|
210
|
+
console.log('1. 确保已安装 ace-tool CLI');
|
|
211
|
+
console.log('2. 运行 ace-tool login 登录 Augment 账号');
|
|
212
|
+
console.log('3. 重启 Claude Code 使 MCP 生效');
|
|
213
|
+
console.log('\n使用方式:');
|
|
214
|
+
console.log(' 在 workflow 中自动调用 mcp__ace-tool__search_context');
|
|
215
|
+
console.log(' 或手动调用 mcp__ace-tool__enhance_prompt');
|
|
143
216
|
}
|
|
144
217
|
|
|
145
218
|
async function configureApiKeys() {
|
|
@@ -205,6 +278,26 @@ async function uninstall() {
|
|
|
205
278
|
console.log(`已删除: ${wrapperPath}`);
|
|
206
279
|
}
|
|
207
280
|
|
|
281
|
+
// 询问是否删除 MCP 配置
|
|
282
|
+
if (fs.existsSync(MCP_CONFIG_PATH)) {
|
|
283
|
+
const removeMcp = await question('是否删除 MCP 配置? (y/N): ');
|
|
284
|
+
if (removeMcp.toLowerCase() === 'y') {
|
|
285
|
+
try {
|
|
286
|
+
let mcpConfig = JSON.parse(fs.readFileSync(MCP_CONFIG_PATH, 'utf8'));
|
|
287
|
+
delete mcpConfig['ace-tool'];
|
|
288
|
+
if (Object.keys(mcpConfig).length === 0) {
|
|
289
|
+
fs.unlinkSync(MCP_CONFIG_PATH);
|
|
290
|
+
console.log('已删除: ~/.claude/mcp_servers.json');
|
|
291
|
+
} else {
|
|
292
|
+
fs.writeFileSync(MCP_CONFIG_PATH, JSON.stringify(mcpConfig, null, 2));
|
|
293
|
+
console.log('已从 MCP 配置中移除 ace-tool');
|
|
294
|
+
}
|
|
295
|
+
} catch {
|
|
296
|
+
// ignore
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
|
|
208
301
|
console.log('\n✅ 卸载完成');
|
|
209
302
|
console.log('注意: 环境变量需要手动从 ~/.zshrc 或 ~/.bashrc 中删除');
|
|
210
303
|
}
|
package/package.json
CHANGED