@hunyed15/codecgc 0.1.3 → 0.1.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hunyed15/codecgc",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Claude-hosted multi-model workflow product shell for CodeCGC.",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -136,19 +136,20 @@ def build_mcp_first_command_template(
136
136
  f"description: {description}",
137
137
  f"argument-hint: \"{argument_hint}\"",
138
138
  "---",
139
- f"Prefer the `{primary_tool}` MCP tool as the primary execution path.",
139
+ f"优先使用 `{primary_tool}` MCP 工具作为主执行路径。",
140
+ "内部思考语言可自行选择,但面向用户的最终回复默认使用中文。",
140
141
  "",
141
- "Execution rules:",
142
+ "执行规则:",
142
143
  ]
143
144
  lines.extend(f"- {item}" for item in direct_rules)
144
145
  if missing_rules:
145
146
  lines.append("")
146
- lines.append("Missing parameter rules:")
147
+ lines.append("缺少参数时:")
147
148
  lines.extend(f"- {item}" for item in missing_rules)
148
149
  lines.append("")
149
- lines.append("Fallback rule:")
150
- lines.append(f"- Only fall back to Bash + `{fallback_command}` CLI when the MCP tool path is unavailable or the user explicitly wants CLI behavior.")
151
- lines.append("- Summarize the result briefly for the user.")
150
+ lines.append("回退规则:")
151
+ lines.append(f"- 只有在 MCP 工具路径不可用,或用户明确要求走 CLI 时,才回退到 Bash + `{fallback_command}`。")
152
+ lines.append("- 向用户用中文简要总结结果。")
152
153
  return filename, "\n".join(lines) + "\n"
153
154
 
154
155
 
@@ -157,190 +158,190 @@ def build_custom_command_templates(bin_dir: Path) -> dict[str, str]:
157
158
  [
158
159
  build_mcp_first_command_template(
159
160
  filename="cgc.md",
160
- description="Run CodeCGC in the current project",
161
- argument_hint="[request or flags]",
161
+ description="在当前项目中运行 CodeCGC",
162
+ argument_hint="[需求或参数]",
162
163
  primary_tool="codecgc.entry",
163
164
  direct_rules=[
164
- "If the user supplied a natural-language request, pass it to `codecgc.entry`.",
165
- "If the user is asking to continue recent work, use `codecgc.continue`.",
166
- "If the user is asking what to do next, use `codecgc.explain`.",
165
+ "如果用户提供的是自然语言需求,传给 `codecgc.entry`。",
166
+ "如果用户想继续最近的工作,使用 `codecgc.continue`。",
167
+ "如果用户想知道下一步做什么,使用 `codecgc.explain`。",
167
168
  ],
168
169
  fallback_command="cgc",
169
170
  ),
170
171
  build_mcp_first_command_template(
171
172
  filename="cgc-install.md",
172
- description="Install or sync CodeCGC integration for the current project or user Claude profile",
173
- argument_hint="[flags]",
173
+ description="为当前项目或 Claude 用户目录安装/同步 CodeCGC 集成",
174
+ argument_hint="[参数]",
174
175
  primary_tool="codecgc.install",
175
176
  direct_rules=[
176
- "Map install flags to `codecgc.install` fields such as `mode`, `workspace`, and `user_root`.",
177
- "If the user did not supply flags, use the default install mode.",
177
+ "把安装参数映射到 `codecgc.install` `mode`、`workspace`、`user_root` 等字段。",
178
+ "如果用户没有提供参数,就使用默认安装模式。",
178
179
  ],
179
180
  fallback_command="cgc-install",
180
181
  ),
181
182
  build_mcp_first_command_template(
182
183
  filename="cgc-status.md",
183
- description="Check CodeCGC integration status",
184
- argument_hint="[flags]",
184
+ description="检查 CodeCGC 集成状态",
185
+ argument_hint="[参数]",
185
186
  primary_tool="codecgc.status",
186
187
  direct_rules=[
187
- "Use `codecgc.status` for installation readiness checks.",
188
- "Map `workspace` when the user explicitly provides a target project directory.",
188
+ "使用 `codecgc.status` 检查安装与集成就绪状态。",
189
+ "如果用户明确给出目标项目目录,映射 `workspace`。",
189
190
  ],
190
191
  fallback_command="cgc-status",
191
192
  ),
192
193
  build_mcp_first_command_template(
193
194
  filename="cgc-doctor.md",
194
- description="Run CodeCGC doctor checks",
195
- argument_hint="[flags]",
195
+ description="运行 CodeCGC 自检",
196
+ argument_hint="[参数]",
196
197
  primary_tool="codecgc.doctor",
197
198
  direct_rules=[
198
- "Use `codecgc.doctor` for runtime and integration health checks.",
199
- "Map `workspace` when the user explicitly provides a target project directory.",
199
+ "使用 `codecgc.doctor` 检查运行时与集成健康状态。",
200
+ "如果用户明确给出目标项目目录,映射 `workspace`。",
200
201
  ],
201
202
  fallback_command="cgc-doctor",
202
203
  ),
203
204
  build_mcp_first_command_template(
204
205
  filename="cgc-plan.md",
205
- description="Plan or repair a CodeCGC workflow",
206
- argument_hint="[structured planning flags]",
206
+ description="规划或修复一个 CodeCGC 工作流",
207
+ argument_hint="[结构化规划参数]",
207
208
  primary_tool="codecgc.plan",
208
209
  direct_rules=[
209
- "Extract `flow`, `slug`, and `summary` before calling the tool.",
210
- "Map any provided `target_paths`, `kind`, and planning fields such as `goal`, `acceptance`, `risk`, and issue-specific fields.",
210
+ "调用前提取 `flow`、`slug` `summary`。",
211
+ "映射用户提供的 `target_paths`、`kind`,以及 `goal`、`acceptance`、`risk` 等规划字段和 issue 专属字段。",
211
212
  ],
212
213
  missing_rules=[
213
- "If `flow` is missing, ask whether this is a `feature` or `issue` workflow.",
214
- "If `slug` is missing, ask for a stable workflow slug.",
215
- "If `summary` is missing, ask for a short planning summary.",
214
+ "如果缺少 `flow`,询问这是 `feature` 还是 `issue` 工作流。",
215
+ "如果缺少 `slug`,询问稳定的工作流 slug",
216
+ "如果缺少 `summary`,询问一个简短规划摘要。",
216
217
  ],
217
218
  fallback_command="cgc-plan",
218
219
  ),
219
220
  build_mcp_first_command_template(
220
221
  filename="cgc-build.md",
221
- description="Execute a CodeCGC feature build step",
222
- argument_hint="[flags]",
222
+ description="执行 CodeCGC 功能开发步骤",
223
+ argument_hint="[参数]",
223
224
  primary_tool="codecgc.build",
224
225
  direct_rules=[
225
- "Extract `slug` before calling the tool.",
226
- "Map optional execution fields such as `step_number`, `checklist_file`, `audit_root`, `timeout_seconds`, `session_id`, and `dry_run`.",
226
+ "调用前提取 `slug`。",
227
+ "映射可选执行字段,如 `step_number`、`checklist_file`、`audit_root`、`timeout_seconds`、`session_id`、`dry_run`。",
227
228
  ],
228
229
  missing_rules=[
229
- "If `slug` is missing, ask for the target feature workflow slug.",
230
+ "如果缺少 `slug`,询问目标功能工作流的 slug",
230
231
  ],
231
232
  fallback_command="cgc-build",
232
233
  ),
233
234
  build_mcp_first_command_template(
234
235
  filename="cgc-fix.md",
235
- description="Execute a CodeCGC issue fix step",
236
- argument_hint="[flags]",
236
+ description="执行 CodeCGC 问题修复步骤",
237
+ argument_hint="[参数]",
237
238
  primary_tool="codecgc.fix",
238
239
  direct_rules=[
239
- "Extract `slug` before calling the tool.",
240
- "Map optional execution fields such as `step_number`, `checklist_file`, `audit_root`, `timeout_seconds`, `session_id`, and `dry_run`.",
240
+ "调用前提取 `slug`。",
241
+ "映射可选执行字段,如 `step_number`、`checklist_file`、`audit_root`、`timeout_seconds`、`session_id`、`dry_run`。",
241
242
  ],
242
243
  missing_rules=[
243
- "If `slug` is missing, ask for the target issue workflow slug.",
244
+ "如果缺少 `slug`,询问目标问题工作流的 slug",
244
245
  ],
245
246
  fallback_command="cgc-fix",
246
247
  ),
247
248
  build_mcp_first_command_template(
248
249
  filename="cgc-test.md",
249
- description="Execute a CodeCGC test step",
250
- argument_hint="[flags]",
250
+ description="执行 CodeCGC 测试步骤",
251
+ argument_hint="[参数]",
251
252
  primary_tool="codecgc.test",
252
253
  direct_rules=[
253
- "Extract `flow` and `slug` before calling the tool.",
254
- "Map optional execution fields such as `step_number`, `checklist_file`, `audit_root`, `timeout_seconds`, `session_id`, and `dry_run`.",
254
+ "调用前提取 `flow` `slug`。",
255
+ "映射可选执行字段,如 `step_number`、`checklist_file`、`audit_root`、`timeout_seconds`、`session_id`、`dry_run`。",
255
256
  ],
256
257
  missing_rules=[
257
- "If `flow` is missing, ask whether the test belongs to a `feature` or `issue` workflow.",
258
- "If `slug` is missing, ask for the target workflow slug.",
258
+ "如果缺少 `flow`,询问该测试属于 `feature` 还是 `issue` 工作流。",
259
+ "如果缺少 `slug`,询问目标工作流 slug",
259
260
  ],
260
261
  fallback_command="cgc-test",
261
262
  ),
262
263
  build_mcp_first_command_template(
263
264
  filename="cgc-review.md",
264
- description="Review a CodeCGC execution audit",
265
- argument_hint="[flags]",
265
+ description="审核一份 CodeCGC 执行审计结果",
266
+ argument_hint="[参数]",
266
267
  primary_tool="codecgc.review",
267
268
  direct_rules=[
268
- "Extract `audit_file` and `decision` before calling the tool.",
269
- "Map optional `risk`, `next_step`, and `force` fields when they are explicitly provided.",
269
+ "调用前提取 `audit_file` `decision`。",
270
+ "如果用户明确提供,映射可选字段 `risk`、`next_step`、`force`。",
270
271
  ],
271
272
  missing_rules=[
272
- "If `audit_file` is missing, ask for the audit JSON path.",
273
- "If `decision` is missing, ask whether the review is `accepted` or `changes-requested`.",
273
+ "如果缺少 `audit_file`,询问审计 JSON 路径。",
274
+ "如果缺少 `decision`,询问审核结论是 `accepted` 还是 `changes-requested`。",
274
275
  ],
275
276
  fallback_command="cgc-review",
276
277
  ),
277
278
  build_mcp_first_command_template(
278
279
  filename="cgc-route.md",
279
- description="Route a CodeCGC workflow to the next recommended command",
280
- argument_hint="[flags]",
280
+ description=" CodeCGC 工作流推荐下一条命令",
281
+ argument_hint="[参数]",
281
282
  primary_tool="codecgc.route",
282
283
  direct_rules=[
283
- "Extract `flow` and `slug` before calling the tool.",
284
- "Use this command when the user already knows the target workflow and wants the next recommended action.",
284
+ "调用前提取 `flow` `slug`。",
285
+ "当用户已经知道目标工作流,只想得到下一步推荐动作时,使用这个命令。",
285
286
  ],
286
287
  missing_rules=[
287
- "If `flow` is missing, ask whether the workflow is `feature` or `issue`.",
288
- "If `slug` is missing, ask for the workflow slug.",
288
+ "如果缺少 `flow`,询问工作流是 `feature` 还是 `issue`。",
289
+ "如果缺少 `slug`,询问工作流 slug",
289
290
  ],
290
291
  fallback_command="cgc-route",
291
292
  ),
292
293
  build_mcp_first_command_template(
293
294
  filename="cgc-history.md",
294
- description="Read recent CodeCGC workflow history",
295
- argument_hint="[flags]",
295
+ description="查看最近的 CodeCGC 工作流历史",
296
+ argument_hint="[参数]",
296
297
  primary_tool="codecgc.history",
297
298
  direct_rules=[
298
- "Map optional history filters such as `flow`, `status`, `last`, and `include_fixtures`.",
299
- "If no filters are provided, use the default history query.",
299
+ "映射可选历史筛选字段,如 `flow`、`status`、`last`、`include_fixtures`。",
300
+ "如果没有提供筛选条件,就使用默认历史查询。",
300
301
  ],
301
302
  fallback_command="cgc-history",
302
303
  ),
303
304
  build_mcp_first_command_template(
304
305
  filename="cgc-package-audit.md",
305
- description="Audit the CodeCGC package runtime contents",
306
- argument_hint="[flags]",
306
+ description="审计 CodeCGC 发布包运行时内容",
307
+ argument_hint="[参数]",
307
308
  primary_tool="codecgc.package_audit",
308
309
  direct_rules=[
309
- "Map `format` when the user explicitly requests `summary` or `json`.",
310
- "Use this command for publish/runtime completeness checks.",
310
+ "当用户明确要求 `summary` `json` 时,映射 `format`。",
311
+ "该命令用于发布包和运行时完整性检查。",
311
312
  ],
312
313
  fallback_command="cgc-package-audit",
313
314
  ),
314
315
  build_mcp_first_command_template(
315
316
  filename="cgc-external-audit.md",
316
- description="Audit external MCP capability registration and observation",
317
- argument_hint="[flags]",
317
+ description="审计外部 MCP 能力注册与接入状态",
318
+ argument_hint="[参数]",
318
319
  primary_tool="codecgc.external_audit",
319
320
  direct_rules=[
320
- "Map optional `workspace` and `format` fields.",
321
- "Use this command for external capability policy and registration checks.",
321
+ "映射可选字段 `workspace` `format`。",
322
+ "该命令用于外部能力策略与注册检查。",
322
323
  ],
323
324
  fallback_command="cgc-external-audit",
324
325
  ),
325
326
  build_mcp_first_command_template(
326
327
  filename="cgc-release-readiness.md",
327
- description="Run CodeCGC release readiness checks",
328
- argument_hint="[flags]",
328
+ description="运行 CodeCGC 发布就绪检查",
329
+ argument_hint="[参数]",
329
330
  primary_tool="codecgc.release_readiness",
330
331
  direct_rules=[
331
- "Map optional `workspace` and `format` fields.",
332
- "Use this command for combined release, maintenance, and ops checks.",
332
+ "映射可选字段 `workspace` `format`。",
333
+ "该命令用于联合检查发布、维护和运维就绪状态。",
333
334
  ],
334
335
  fallback_command="cgc-release-readiness",
335
336
  ),
336
337
  build_mcp_first_command_template(
337
338
  filename="cgc-lifecycle.md",
338
- description="Audit CodeCGC lifecycle coverage",
339
- argument_hint="[flags]",
339
+ description="审计 CodeCGC 生命周期覆盖情况",
340
+ argument_hint="[参数]",
340
341
  primary_tool="codecgc.lifecycle",
341
342
  direct_rules=[
342
- "Map `format` when the user explicitly requests `summary` or `json`.",
343
- "Use this command to inspect roadmap/workflow/execution lifecycle coverage.",
343
+ "当用户明确要求 `summary` `json` 时,映射 `format`。",
344
+ "该命令用于检查 roadmapworkflowexecution 的生命周期覆盖情况。",
344
345
  ],
345
346
  fallback_command="cgc-lifecycle",
346
347
  ),
@@ -919,6 +920,17 @@ def build_local_editable_install_command(python_command: str) -> str:
919
920
  )
920
921
 
921
922
 
923
+ def format_bool_zh(value: Any) -> str:
924
+ return "是" if bool(value) else "否"
925
+
926
+
927
+ def format_list_zh(items: Any, empty_text: str = "无") -> str:
928
+ if not isinstance(items, list):
929
+ return empty_text
930
+ values = [str(item).strip() for item in items if str(item).strip()]
931
+ return "、".join(values) if values else empty_text
932
+
933
+
922
934
  def classify_doctor_failures(
923
935
  checks: list[dict[str, Any]],
924
936
  configured_python_command: str,
@@ -1232,12 +1244,12 @@ def main() -> int:
1232
1244
  lines = [
1233
1245
  f"- 工作区: {result.get('workspace', '')}",
1234
1246
  f"- 范围: {summary.get('scope', '')}",
1235
- f"- 项目级就绪: {'是' if summary.get('project_ready') else '否'}",
1236
- f"- 用户级就绪: {'是' if summary.get('user_ready') else '否'}",
1247
+ f"- 项目级就绪: {format_bool_zh(summary.get('project_ready'))}",
1248
+ f"- 用户级就绪: {format_bool_zh(summary.get('user_ready'))}",
1237
1249
  f"- 策略: {summary.get('default_policy', '')}",
1238
1250
  f"- 摘要: {summary.get('human_summary', '')}",
1239
- f"- 项目缺失项: {', '.join(project.get('missing_or_outdated', [])) or '无'}",
1240
- f"- 用户缺失项: {', '.join(user.get('missing_or_outdated', [])) or '无'}",
1251
+ f"- 项目级缺失项: {format_list_zh(project.get('missing_or_outdated', []))}",
1252
+ f"- 用户级缺失项: {format_list_zh(user.get('missing_or_outdated', []))}",
1241
1253
  ]
1242
1254
  recommended_project = str(summary.get("recommended_project_command", "")).strip()
1243
1255
  recommended_user = str(summary.get("recommended_user_command", "")).strip()
@@ -1252,11 +1264,11 @@ def main() -> int:
1252
1264
  lines = [
1253
1265
  f"- 工作区: {result.get('workspace', '')}",
1254
1266
  f"- 范围: {summary.get('scope', '')}",
1255
- f"- 就绪: {'是' if summary.get('ready') else '否'}",
1267
+ f"- 就绪: {format_bool_zh(summary.get('ready'))}",
1256
1268
  f"- 摘要: {summary.get('human_summary', '')}",
1257
1269
  ]
1258
1270
  failed_checks = summary.get("failed_checks", [])
1259
- lines.append(f"- 失败检查项: {', '.join(str(item) for item in failed_checks) or '无'}")
1271
+ lines.append(f"- 失败检查项: {format_list_zh(failed_checks)}")
1260
1272
  failure_categories = summary.get("failure_categories", [])
1261
1273
  for item in failure_categories:
1262
1274
  if not isinstance(item, dict):
@@ -1273,7 +1285,7 @@ def main() -> int:
1273
1285
  fix_command = str(summary.get("recommended_fix_command", "")).strip()
1274
1286
  runtime_fix_command = str(summary.get("recommended_runtime_fix_command", "")).strip()
1275
1287
  next_actions = [item for item in [runtime_fix_command, fix_command] if item]
1276
- print(render_summary_block("CodeCGC Doctor", lines, next_actions))
1288
+ print(render_summary_block("CodeCGC 自检", lines, next_actions))
1277
1289
  return 0 if result.get("success") else 1
1278
1290
 
1279
1291
  if args.format == "summary" and args.mode in {"local", "user-dry-run", "user"}: