ccg-workflow 1.7.87 → 1.7.89
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/dist/cli.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, a as i18n, s as showMainMenu, i as init, E as configMcp, F as version } from './shared/ccg-workflow.
|
|
4
|
+
import { z as diagnoseMcpConfig, A as isWindows, B as readClaudeCodeConfig, C as fixWindowsMcpConfig, D as writeClaudeCodeConfig, r as readCcgConfig, b as initI18n, a as i18n, s as showMainMenu, i as init, E as configMcp, F as version } from './shared/ccg-workflow.BF0FhMt8.mjs';
|
|
5
5
|
import 'inquirer';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:util';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.
|
|
1
|
+
export { c as changeLanguage, x as checkForUpdates, y as compareVersions, d as createDefaultConfig, e as createDefaultRouting, g as getCcgDir, f as getConfigPath, t as getCurrentVersion, v as getLatestVersion, j as getWorkflowById, h as getWorkflowConfigs, a as i18n, i as init, b as initI18n, l as installAceTool, m as installAceToolRs, k as installWorkflows, p as migrateToV1_4_0, q as needsMigration, r as readCcgConfig, s as showMainMenu, o as uninstallAceTool, n as uninstallWorkflows, u as update, w as writeCcgConfig } from './shared/ccg-workflow.BF0FhMt8.mjs';
|
|
2
2
|
import 'ansis';
|
|
3
3
|
import 'inquirer';
|
|
4
4
|
import 'node:child_process';
|
|
@@ -10,7 +10,7 @@ import { parse, stringify } from 'smol-toml';
|
|
|
10
10
|
import i18next from 'i18next';
|
|
11
11
|
import ora from 'ora';
|
|
12
12
|
|
|
13
|
-
const version = "1.7.
|
|
13
|
+
const version = "1.7.89";
|
|
14
14
|
|
|
15
15
|
function cmd(id, order, category, name, nameEn, description, descriptionEn, cmdOverride) {
|
|
16
16
|
return {
|
|
@@ -2460,72 +2460,40 @@ async function needsMigration() {
|
|
|
2460
2460
|
return hasOldCcgDir || hasOldPromptsDir || hasOldConfigFile;
|
|
2461
2461
|
}
|
|
2462
2462
|
|
|
2463
|
-
async function checkJqAvailable() {
|
|
2464
|
-
try {
|
|
2465
|
-
const { execSync } = await import('node:child_process');
|
|
2466
|
-
execSync("jq --version", { stdio: "pipe" });
|
|
2467
|
-
return true;
|
|
2468
|
-
} catch {
|
|
2469
|
-
return false;
|
|
2470
|
-
}
|
|
2471
|
-
}
|
|
2472
2463
|
async function installHook(settingsPath) {
|
|
2473
2464
|
let settings = {};
|
|
2474
2465
|
if (await fs.pathExists(settingsPath)) {
|
|
2475
2466
|
settings = await fs.readJSON(settingsPath);
|
|
2476
2467
|
}
|
|
2477
|
-
if (
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
delete settings.hooks;
|
|
2488
|
-
}
|
|
2489
|
-
}
|
|
2490
|
-
if (!settings.permissions)
|
|
2491
|
-
settings.permissions = {};
|
|
2492
|
-
if (!settings.permissions.allow)
|
|
2493
|
-
settings.permissions.allow = [];
|
|
2494
|
-
const permEntry = "Bash(codeagent-wrapper*)";
|
|
2495
|
-
if (!settings.permissions.allow.includes(permEntry)) {
|
|
2496
|
-
settings.permissions.allow.push(permEntry);
|
|
2468
|
+
if (settings.hooks?.PreToolUse) {
|
|
2469
|
+
const hookIdx = settings.hooks.PreToolUse.findIndex(
|
|
2470
|
+
(h) => h.matcher === "Bash" && h.hooks?.some((hh) => hh.command?.includes("codeagent-wrapper"))
|
|
2471
|
+
);
|
|
2472
|
+
if (hookIdx >= 0) {
|
|
2473
|
+
settings.hooks.PreToolUse.splice(hookIdx, 1);
|
|
2474
|
+
if (settings.hooks.PreToolUse.length === 0)
|
|
2475
|
+
delete settings.hooks.PreToolUse;
|
|
2476
|
+
if (settings.hooks && Object.keys(settings.hooks).length === 0)
|
|
2477
|
+
delete settings.hooks;
|
|
2497
2478
|
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
settings.hooks.PreToolUse = [];
|
|
2505
|
-
const newCommand = `jq -r '.tool_input.command' 2>/dev/null | grep -q 'codeagent-wrapper' && echo '{"hookSpecificOutput": {"hookEventName": "PreToolUse", "permissionDecision": "allow", "permissionDecisionReason": "codeagent-wrapper auto-approved"}}' || true`;
|
|
2506
|
-
const existingIdx = settings.hooks.PreToolUse.findIndex(
|
|
2507
|
-
(h) => h.matcher === "Bash" && h.hooks?.some((hh) => hh.command?.includes("codeagent-wrapper"))
|
|
2508
|
-
);
|
|
2509
|
-
if (existingIdx >= 0) {
|
|
2510
|
-
const oldCmd = settings.hooks.PreToolUse[existingIdx]?.hooks?.[0]?.command || "";
|
|
2511
|
-
if (oldCmd.includes("exit 1")) {
|
|
2512
|
-
settings.hooks.PreToolUse[existingIdx].hooks[0].command = newCommand;
|
|
2513
|
-
await fs.writeJSON(settingsPath, settings, { spaces: 2 });
|
|
2479
|
+
}
|
|
2480
|
+
if (settings.permissions?.allow) {
|
|
2481
|
+
const oldEntry = "Bash(codeagent-wrapper*)";
|
|
2482
|
+
const oldIdx = settings.permissions.allow.indexOf(oldEntry);
|
|
2483
|
+
if (oldIdx >= 0) {
|
|
2484
|
+
settings.permissions.allow.splice(oldIdx, 1);
|
|
2514
2485
|
}
|
|
2515
|
-
} else {
|
|
2516
|
-
settings.hooks.PreToolUse.push({
|
|
2517
|
-
matcher: "Bash",
|
|
2518
|
-
hooks: [
|
|
2519
|
-
{
|
|
2520
|
-
type: "command",
|
|
2521
|
-
command: newCommand,
|
|
2522
|
-
timeout: 1
|
|
2523
|
-
}
|
|
2524
|
-
]
|
|
2525
|
-
});
|
|
2526
|
-
await fs.writeJSON(settingsPath, settings, { spaces: 2 });
|
|
2527
2486
|
}
|
|
2528
|
-
|
|
2487
|
+
if (!settings.permissions)
|
|
2488
|
+
settings.permissions = {};
|
|
2489
|
+
if (!settings.permissions.allow)
|
|
2490
|
+
settings.permissions.allow = [];
|
|
2491
|
+
const permEntry = "Bash(*codeagent-wrapper*)";
|
|
2492
|
+
if (!settings.permissions.allow.includes(permEntry)) {
|
|
2493
|
+
settings.permissions.allow.push(permEntry);
|
|
2494
|
+
}
|
|
2495
|
+
await fs.writeJSON(settingsPath, settings, { spaces: 2 });
|
|
2496
|
+
return "permission";
|
|
2529
2497
|
}
|
|
2530
2498
|
async function appendGrokSearchPrompt() {
|
|
2531
2499
|
const rulesDir = join(homedir(), ".claude", "rules");
|
|
@@ -3070,13 +3038,9 @@ async function init(options = {}) {
|
|
|
3070
3038
|
console.log();
|
|
3071
3039
|
console.log(` ${ansis.green("\u2713")} API ${ansis.gray(`\u2192 ${settingsPath}`)}`);
|
|
3072
3040
|
}
|
|
3073
|
-
|
|
3041
|
+
await installHook(settingsPath);
|
|
3074
3042
|
console.log();
|
|
3075
|
-
|
|
3076
|
-
console.log(` ${ansis.green("\u2713")} ${i18n.t("init:hooks.installed")} ${ansis.gray("(permissions.allow)")}`);
|
|
3077
|
-
} else {
|
|
3078
|
-
console.log(` ${ansis.green("\u2713")} ${i18n.t("init:hooks.installed")}`);
|
|
3079
|
-
}
|
|
3043
|
+
console.log(` ${ansis.green("\u2713")} ${i18n.t("init:hooks.installed")} ${ansis.gray("(permissions.allow)")}`);
|
|
3080
3044
|
if (wantGrokSearch && (tavilyKey || firecrawlKey || grokApiUrl || grokApiKey)) {
|
|
3081
3045
|
spinner.text = i18n.t("init:grok.installing");
|
|
3082
3046
|
const grokResult = await installGrokSearchMcp({
|
|
@@ -3129,17 +3093,6 @@ async function init(options = {}) {
|
|
|
3129
3093
|
console.log(ansis.gray(` ${geminiSyncResult.message}`));
|
|
3130
3094
|
}
|
|
3131
3095
|
}
|
|
3132
|
-
if (hookMethod === "hook") {
|
|
3133
|
-
const hasJq = await checkJqAvailable();
|
|
3134
|
-
if (!hasJq) {
|
|
3135
|
-
console.log();
|
|
3136
|
-
console.log(ansis.yellow(` \u26A0 ${i18n.t("init:hooks.jqNotFound")}`));
|
|
3137
|
-
console.log();
|
|
3138
|
-
console.log(ansis.cyan(` \u{1F4D6} ${i18n.t("init:hooks.jqInstallHint")}:`));
|
|
3139
|
-
console.log(ansis.gray(` ${i18n.t("init:hooks.jqMac")}`));
|
|
3140
|
-
console.log(ansis.gray(` ${i18n.t("init:hooks.jqLinux")}`));
|
|
3141
|
-
}
|
|
3142
|
-
}
|
|
3143
3096
|
console.log();
|
|
3144
3097
|
console.log(ansis.cyan(` ${i18n.t("init:installedCommands")}`));
|
|
3145
3098
|
result.installedCommands.forEach((cmd) => {
|
|
@@ -3277,23 +3230,41 @@ const __filename$1 = fileURLToPath(import.meta.url);
|
|
|
3277
3230
|
const __dirname$1 = dirname(__filename$1);
|
|
3278
3231
|
function findPackageRoot(startDir) {
|
|
3279
3232
|
let dir = startDir;
|
|
3280
|
-
|
|
3233
|
+
while (true) {
|
|
3281
3234
|
if (fs.existsSync(join(dir, "package.json"))) {
|
|
3282
3235
|
return dir;
|
|
3283
3236
|
}
|
|
3284
|
-
|
|
3237
|
+
const parentDir = dirname(dir);
|
|
3238
|
+
if (parentDir === dir) {
|
|
3239
|
+
return dir;
|
|
3240
|
+
}
|
|
3241
|
+
dir = parentDir;
|
|
3285
3242
|
}
|
|
3286
|
-
return startDir;
|
|
3287
3243
|
}
|
|
3288
3244
|
const PACKAGE_ROOT = findPackageRoot(__dirname$1);
|
|
3289
|
-
async function
|
|
3245
|
+
async function readPackageVersion(pkgPath) {
|
|
3290
3246
|
try {
|
|
3291
|
-
|
|
3247
|
+
if (!await fs.pathExists(pkgPath)) {
|
|
3248
|
+
return null;
|
|
3249
|
+
}
|
|
3292
3250
|
const pkg = await fs.readJSON(pkgPath);
|
|
3293
|
-
return pkg.version ||
|
|
3251
|
+
return pkg.version || null;
|
|
3294
3252
|
} catch {
|
|
3295
|
-
return
|
|
3253
|
+
return null;
|
|
3254
|
+
}
|
|
3255
|
+
}
|
|
3256
|
+
async function getCurrentVersion() {
|
|
3257
|
+
const relativePkgPath = fileURLToPath(new URL("../../package.json", import.meta.url));
|
|
3258
|
+
const relativeVersion = await readPackageVersion(relativePkgPath);
|
|
3259
|
+
if (relativeVersion) {
|
|
3260
|
+
return relativeVersion;
|
|
3261
|
+
}
|
|
3262
|
+
const rootPkgPath = join(PACKAGE_ROOT, "package.json");
|
|
3263
|
+
const rootVersion = await readPackageVersion(rootPkgPath);
|
|
3264
|
+
if (rootVersion) {
|
|
3265
|
+
return rootVersion;
|
|
3296
3266
|
}
|
|
3267
|
+
return process.env.npm_package_version || "0.0.0";
|
|
3297
3268
|
}
|
|
3298
3269
|
async function getLatestVersion(packageName = "ccg-workflow") {
|
|
3299
3270
|
try {
|
package/package.json
CHANGED
|
@@ -62,11 +62,11 @@ description: '初始化 OpenSpec (OPSX) 环境 + 验证多模型 MCP 工具'
|
|
|
62
62
|
- **工作目录**:`{{WORKDIR}}` 替换为目标工作目录的绝对路径。如果用户通过 `/add-dir` 添加了多个工作区,先确定任务相关的工作区。
|
|
63
63
|
- Test Codex backend:
|
|
64
64
|
```bash
|
|
65
|
-
~/.claude/bin/codeagent-wrapper --backend codex - "{{WORKDIR}}"
|
|
65
|
+
echo "echo test" | ~/.claude/bin/codeagent-wrapper --backend codex - "{{WORKDIR}}"
|
|
66
66
|
```
|
|
67
67
|
- Test Gemini backend:
|
|
68
68
|
```bash
|
|
69
|
-
~/.claude/bin/codeagent-wrapper --backend gemini --gemini-model gemini-3.1-pro-preview - "{{WORKDIR}}"
|
|
69
|
+
echo "echo test" | ~/.claude/bin/codeagent-wrapper --backend gemini --gemini-model gemini-3.1-pro-preview - "{{WORKDIR}}"
|
|
70
70
|
```
|
|
71
71
|
- For each unavailable tool, display warning with installation instructions.
|
|
72
72
|
|