ccjk 12.3.5 → 13.3.3
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/chunks/api-cli.mjs +1 -1
- package/dist/chunks/api.mjs +2 -2
- package/dist/chunks/auto-fix.mjs +148 -0
- package/dist/chunks/auto-upgrade.mjs +150 -0
- package/dist/chunks/ccjk-agents.mjs +1 -2
- package/dist/chunks/ccjk-all.mjs +5 -6
- package/dist/chunks/ccjk-hooks.mjs +4 -5
- package/dist/chunks/ccjk-mcp.mjs +6 -7
- package/dist/chunks/ccjk-setup.mjs +1 -2
- package/dist/chunks/ccjk-skills.mjs +5 -6
- package/dist/chunks/ccr.mjs +1 -2
- package/dist/chunks/commands2.mjs +11 -3
- package/dist/chunks/index14.mjs +6 -5
- package/dist/chunks/index2.mjs +2 -2
- package/dist/chunks/installer2.mjs +74 -150
- package/dist/chunks/intent-engine.mjs +142 -0
- package/dist/chunks/menu-hierarchical.mjs +1 -2
- package/dist/chunks/menu.mjs +15 -0
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/smart-guide.mjs +8 -8
- package/dist/chunks/upgrade.mjs +34 -0
- package/dist/cli.mjs +39 -12
- package/dist/i18n/locales/en/agentBrowser.json +1 -0
- package/dist/i18n/locales/en/configuration.json +4 -4
- package/dist/i18n/locales/zh-CN/agentBrowser.json +1 -0
- package/dist/i18n/locales/zh-CN/configuration.json +4 -4
- package/dist/index.d.mts +211 -125
- package/dist/index.d.ts +211 -125
- package/dist/index.mjs +6 -3
- package/dist/shared/{ccjk.CtXhbEqb.mjs → ccjk.CqdbaXqU.mjs} +1 -1
- package/dist/shared/{ccjk.DfXjf8EC.mjs → ccjk.Cwa_FiTX.mjs} +1 -1
- package/dist/shared/{ccjk.hrRv8G6j.mjs → ccjk.DHXfsrwn.mjs} +1502 -3
- package/dist/shared/{ccjk.CL4Yat0G.mjs → ccjk.DopKzo3z.mjs} +3 -1
- package/dist/templates/claude-code/common/settings.json +0 -1
- package/package.json +1 -1
- package/templates/claude-code/common/settings.json +0 -1
- package/dist/shared/ccjk.UIvifqNE.mjs +0 -1486
|
@@ -1,179 +1,103 @@
|
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
1
3
|
import a from './index3.mjs';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { join } from 'node:path';
|
|
4
|
+
import { ensureI18nInitialized, i18n } from './index6.mjs';
|
|
5
|
+
import { w as wrapCommandWithSudo } from './platform.mjs';
|
|
5
6
|
import '../shared/ccjk.BAGoDD49.mjs';
|
|
7
|
+
import 'node:fs';
|
|
8
|
+
import 'node:process';
|
|
9
|
+
import 'node:url';
|
|
10
|
+
import '../shared/ccjk.bQ7Dh1g4.mjs';
|
|
11
|
+
import 'node:os';
|
|
12
|
+
import './main.mjs';
|
|
13
|
+
import 'module';
|
|
14
|
+
import 'node:path';
|
|
15
|
+
import 'node:stream';
|
|
16
|
+
import 'node:readline';
|
|
6
17
|
|
|
7
|
-
const
|
|
8
|
-
const INSTALL_DIR = join(homedir(), ".agent-browser");
|
|
9
|
-
const BIN_PATH = join(INSTALL_DIR, "bin", "agent-browser");
|
|
10
|
-
function getInstallPath() {
|
|
11
|
-
return INSTALL_DIR;
|
|
12
|
-
}
|
|
18
|
+
const execAsync = promisify(exec);
|
|
13
19
|
async function checkAgentBrowserInstalled() {
|
|
14
20
|
try {
|
|
15
|
-
|
|
16
|
-
execSync("which agent-browser 2>/dev/null || where agent-browser 2>nul", {
|
|
17
|
-
encoding: "utf-8",
|
|
18
|
-
stdio: "pipe"
|
|
19
|
-
});
|
|
21
|
+
await execAsync("agent-browser --version");
|
|
20
22
|
return true;
|
|
21
23
|
} catch {
|
|
24
|
+
return false;
|
|
22
25
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
+
}
|
|
27
|
+
async function getAgentBrowserStatus() {
|
|
28
|
+
let isInstalled = false;
|
|
29
|
+
let version = null;
|
|
30
|
+
let hasBrowser = false;
|
|
26
31
|
try {
|
|
27
|
-
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
timeout: 1e4
|
|
32
|
-
});
|
|
33
|
-
return true;
|
|
32
|
+
const { stdout } = await execAsync("agent-browser --version");
|
|
33
|
+
isInstalled = true;
|
|
34
|
+
const match = stdout.match(/(\d+\.\d+\.\d+)/);
|
|
35
|
+
version = match ? match[1] : null;
|
|
34
36
|
} catch {
|
|
37
|
+
try {
|
|
38
|
+
await execAsync("which agent-browser");
|
|
39
|
+
isInstalled = true;
|
|
40
|
+
} catch {
|
|
41
|
+
isInstalled = false;
|
|
42
|
+
}
|
|
35
43
|
}
|
|
36
|
-
|
|
44
|
+
hasBrowser = isInstalled;
|
|
45
|
+
return {
|
|
46
|
+
isInstalled,
|
|
47
|
+
version,
|
|
48
|
+
hasBrowser
|
|
49
|
+
};
|
|
37
50
|
}
|
|
38
|
-
async function installAgentBrowser(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
if (installed) {
|
|
45
|
-
console.log(`${green("\u2713")} Agent Browser is already installed`);
|
|
46
|
-
console.log(` ${gray("Use --force to reinstall")}
|
|
47
|
-
`);
|
|
48
|
-
return true;
|
|
49
|
-
}
|
|
51
|
+
async function installAgentBrowser() {
|
|
52
|
+
ensureI18nInitialized();
|
|
53
|
+
const isInstalled = await checkAgentBrowserInstalled();
|
|
54
|
+
if (isInstalled) {
|
|
55
|
+
console.log(a.green(`\u2714 ${i18n.t("agentBrowser:alreadyInstalled", { version: "installed" })}`));
|
|
56
|
+
return true;
|
|
50
57
|
}
|
|
51
|
-
|
|
52
|
-
const { mkdirSync } = await import('node:fs');
|
|
58
|
+
console.log(a.green(`\u{1F4E6} ${i18n.t("agentBrowser:installing")}`));
|
|
53
59
|
try {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
encoding: "utf-8",
|
|
59
|
-
stdio: options.verbose ? "inherit" : "pipe"
|
|
60
|
-
});
|
|
61
|
-
console.log(` ${green("\u2713")} npm package installed globally`);
|
|
62
|
-
} catch {
|
|
63
|
-
console.log(` ${yellow("!")} Global install failed, trying local install...`);
|
|
64
|
-
execSync(`npm install agent-browser --prefix "${INSTALL_DIR}" 2>&1`, {
|
|
65
|
-
encoding: "utf-8",
|
|
66
|
-
stdio: options.verbose ? "inherit" : "pipe"
|
|
67
|
-
});
|
|
68
|
-
console.log(` ${green("\u2713")} npm package installed locally`);
|
|
69
|
-
}
|
|
70
|
-
console.log(`
|
|
71
|
-
${cyan("Step 2/3:")} Installing Playwright browsers...`);
|
|
72
|
-
try {
|
|
73
|
-
execSync("npx playwright install chromium 2>&1", {
|
|
74
|
-
encoding: "utf-8",
|
|
75
|
-
stdio: options.verbose ? "inherit" : "pipe",
|
|
76
|
-
timeout: 3e5
|
|
77
|
-
// 5 minutes
|
|
78
|
-
});
|
|
79
|
-
console.log(` ${green("\u2713")} Chromium browser installed`);
|
|
80
|
-
} catch (error) {
|
|
81
|
-
console.log(` ${yellow("!")} Playwright browser installation may have issues`);
|
|
82
|
-
if (options.verbose && error instanceof Error) {
|
|
83
|
-
console.log(` ${gray(error.message)}`);
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
console.log(`
|
|
87
|
-
${cyan("Step 3/3:")} Verifying installation...`);
|
|
88
|
-
const verified = await checkAgentBrowserInstalled();
|
|
89
|
-
if (verified) {
|
|
90
|
-
console.log(` ${green("\u2713")} Installation verified`);
|
|
91
|
-
console.log(`
|
|
92
|
-
${green("\u2713")} ${bold("Agent Browser installed successfully!")}
|
|
93
|
-
`);
|
|
94
|
-
showQuickStart();
|
|
95
|
-
return true;
|
|
96
|
-
} else {
|
|
97
|
-
console.log(` ${red("\u2717")} Verification failed`);
|
|
98
|
-
console.log(`
|
|
99
|
-
${yellow("Try manual installation:")}`);
|
|
100
|
-
console.log(` npm install -g agent-browser`);
|
|
101
|
-
console.log(` npx playwright install chromium
|
|
102
|
-
`);
|
|
103
|
-
return false;
|
|
60
|
+
const installArgs = ["install", "-g", "agent-browser"];
|
|
61
|
+
const { command, args, usedSudo } = wrapCommandWithSudo("npm", installArgs);
|
|
62
|
+
if (usedSudo) {
|
|
63
|
+
console.log(a.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
|
|
104
64
|
}
|
|
65
|
+
await execAsync([command, ...args].join(" "), { timeout: 12e4 });
|
|
66
|
+
console.log(a.green(`\u2714 ${i18n.t("agentBrowser:installSuccess")}`));
|
|
67
|
+
console.log(a.gray(`\u2139 ${i18n.t("agentBrowser:browserAutoInstall")}`));
|
|
68
|
+
return true;
|
|
105
69
|
} catch (error) {
|
|
106
|
-
console.error(`
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
console.error(` ${gray("Error:")} ${error.message}`);
|
|
70
|
+
console.error(a.red(`\u2716 ${i18n.t("agentBrowser:installFailed")}`));
|
|
71
|
+
if (error.message) {
|
|
72
|
+
console.error(a.gray(error.message));
|
|
110
73
|
}
|
|
111
|
-
console.log(`
|
|
112
|
-
${yellow("Manual installation:")}`);
|
|
113
|
-
console.log(` ${cyan("1.")} npm install -g agent-browser`);
|
|
114
|
-
console.log(` ${cyan("2.")} npx playwright install chromium`);
|
|
115
|
-
console.log(` ${cyan("3.")} agent-browser --version
|
|
116
|
-
`);
|
|
117
74
|
return false;
|
|
118
75
|
}
|
|
119
76
|
}
|
|
120
|
-
async function uninstallAgentBrowser(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
77
|
+
async function uninstallAgentBrowser() {
|
|
78
|
+
ensureI18nInitialized();
|
|
79
|
+
const status = await getAgentBrowserStatus();
|
|
80
|
+
if (!status.isInstalled) {
|
|
81
|
+
console.log(a.yellow(`\u2139 ${i18n.t("agentBrowser:notInstalled")}`));
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
console.log(a.green(`\u{1F5D1}\uFE0F ${i18n.t("agentBrowser:uninstalling")}`));
|
|
126
85
|
try {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
stdio: options.verbose ? "inherit" : "pipe"
|
|
132
|
-
});
|
|
133
|
-
console.log(` ${green("\u2713")} Global package removed`);
|
|
134
|
-
} catch {
|
|
135
|
-
console.log(` ${gray("-")} No global package found`);
|
|
86
|
+
const uninstallArgs = ["uninstall", "-g", "agent-browser"];
|
|
87
|
+
const { command, args, usedSudo } = wrapCommandWithSudo("npm", uninstallArgs);
|
|
88
|
+
if (usedSudo) {
|
|
89
|
+
console.log(a.yellow(`\u2139 ${i18n.t("installation:usingSudo")}`));
|
|
136
90
|
}
|
|
137
|
-
|
|
138
|
-
${
|
|
139
|
-
if (existsSync(INSTALL_DIR)) {
|
|
140
|
-
rmSync(INSTALL_DIR, { recursive: true, force: true });
|
|
141
|
-
console.log(` ${green("\u2713")} Local files removed`);
|
|
142
|
-
} else {
|
|
143
|
-
console.log(` ${gray("-")} No local files found`);
|
|
144
|
-
}
|
|
145
|
-
console.log(`
|
|
146
|
-
${green("\u2713")} ${bold("Agent Browser uninstalled successfully!")}
|
|
147
|
-
`);
|
|
91
|
+
await execAsync([command, ...args].join(" "), { timeout: 6e4 });
|
|
92
|
+
console.log(a.green(`\u2714 ${i18n.t("agentBrowser:uninstallSuccess")}`));
|
|
148
93
|
return true;
|
|
149
94
|
} catch (error) {
|
|
150
|
-
console.error(`
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
console.error(` ${gray("Error:")} ${error.message}`);
|
|
95
|
+
console.error(a.red(`\u2716 ${i18n.t("agentBrowser:uninstallFailed")}`));
|
|
96
|
+
if (error.message) {
|
|
97
|
+
console.error(a.gray(error.message));
|
|
154
98
|
}
|
|
155
99
|
return false;
|
|
156
100
|
}
|
|
157
101
|
}
|
|
158
|
-
function showQuickStart() {
|
|
159
|
-
console.log(`${yellow("Quick Start:")}`);
|
|
160
|
-
console.log(` ${gray("# Open a webpage")}`);
|
|
161
|
-
console.log(` ${cyan("agent-browser open https://example.com")}`);
|
|
162
|
-
console.log();
|
|
163
|
-
console.log(` ${gray("# Get interactive elements")}`);
|
|
164
|
-
console.log(` ${cyan("agent-browser snapshot -i")}`);
|
|
165
|
-
console.log();
|
|
166
|
-
console.log(` ${gray("# Click an element by ref")}`);
|
|
167
|
-
console.log(` ${cyan("agent-browser click @e1")}`);
|
|
168
|
-
console.log();
|
|
169
|
-
console.log(` ${gray("# Take a screenshot")}`);
|
|
170
|
-
console.log(` ${cyan("agent-browser screenshot page.png")}`);
|
|
171
|
-
console.log();
|
|
172
|
-
console.log(` ${gray("# Close the browser")}`);
|
|
173
|
-
console.log(` ${cyan("agent-browser close")}`);
|
|
174
|
-
console.log();
|
|
175
|
-
console.log(`${gray("For full documentation, run")} ${cyan("/browser")} ${gray("in Claude Code")}`);
|
|
176
|
-
console.log();
|
|
177
|
-
}
|
|
178
102
|
|
|
179
|
-
export { checkAgentBrowserInstalled,
|
|
103
|
+
export { checkAgentBrowserInstalled, getAgentBrowserStatus, installAgentBrowser, uninstallAgentBrowser };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import process__default from 'node:process';
|
|
2
|
+
|
|
3
|
+
const INTENT_RULES = [
|
|
4
|
+
{
|
|
5
|
+
keywords: ["commit", "\u63D0\u4EA4", "\u63D0\u4EA4\u4EE3\u7801", "git commit", "\u4FDD\u5B58\u66F4\u6539"],
|
|
6
|
+
skill: "commit",
|
|
7
|
+
confidence: 0.9,
|
|
8
|
+
description: "Smart commit with AI-generated messages"
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
keywords: ["github", "gh", "pr", "pull request", "merge request", "\u5408\u5E76\u8BF7\u6C42"],
|
|
12
|
+
skill: "github",
|
|
13
|
+
confidence: 0.85,
|
|
14
|
+
description: "GitHub operations"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
keywords: ["review", "\u5BA1\u67E5", "code review", "\u4EE3\u7801\u5BA1\u67E5", "\u68C0\u67E5\u4EE3\u7801"],
|
|
18
|
+
skill: "review",
|
|
19
|
+
confidence: 0.85,
|
|
20
|
+
description: "Code review"
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
keywords: ["test", "\u6D4B\u8BD5", "run test", "\u8FD0\u884C\u6D4B\u8BD5", "testing"],
|
|
24
|
+
skill: "test",
|
|
25
|
+
confidence: 0.8,
|
|
26
|
+
description: "Run tests"
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
keywords: ["doc", "\u6587\u6863", "documentation", "\u751F\u6210\u6587\u6863", "generate doc"],
|
|
30
|
+
skill: "doc",
|
|
31
|
+
confidence: 0.8,
|
|
32
|
+
description: "Generate documentation"
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
keywords: ["deploy", "\u90E8\u7F72", "deployment", "\u53D1\u5E03", "release"],
|
|
36
|
+
skill: "deploy",
|
|
37
|
+
confidence: 0.85,
|
|
38
|
+
description: "Deploy application"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
keywords: ["fix", "\u4FEE\u590D", "bug", "debug", "\u8C03\u8BD5", "error", "\u9519\u8BEF"],
|
|
42
|
+
skill: "fix",
|
|
43
|
+
confidence: 0.75,
|
|
44
|
+
description: "Fix bugs and errors"
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
keywords: ["refactor", "\u91CD\u6784", "optimize", "\u4F18\u5316", "improve", "\u6539\u8FDB"],
|
|
48
|
+
skill: "refactor",
|
|
49
|
+
confidence: 0.75,
|
|
50
|
+
description: "Refactor code"
|
|
51
|
+
}
|
|
52
|
+
];
|
|
53
|
+
function recognizeIntent(input) {
|
|
54
|
+
const normalizedInput = input.toLowerCase().trim();
|
|
55
|
+
let bestMatch = null;
|
|
56
|
+
let highestScore = 0;
|
|
57
|
+
for (const rule of INTENT_RULES) {
|
|
58
|
+
const matchedKeywords = [];
|
|
59
|
+
let score = 0;
|
|
60
|
+
for (const keyword of rule.keywords) {
|
|
61
|
+
if (normalizedInput.includes(keyword.toLowerCase())) {
|
|
62
|
+
matchedKeywords.push(keyword);
|
|
63
|
+
if (normalizedInput === keyword.toLowerCase()) {
|
|
64
|
+
score += 1;
|
|
65
|
+
} else {
|
|
66
|
+
score += 0.5;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const confidence = score / rule.keywords.length;
|
|
71
|
+
if (confidence >= rule.confidence && score > highestScore) {
|
|
72
|
+
highestScore = score;
|
|
73
|
+
bestMatch = {
|
|
74
|
+
skill: rule.skill,
|
|
75
|
+
confidence,
|
|
76
|
+
description: rule.description,
|
|
77
|
+
matchedKeywords
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return bestMatch;
|
|
82
|
+
}
|
|
83
|
+
function shouldTriggerSkill(args) {
|
|
84
|
+
if (args.length > 0 && args[0].startsWith("/")) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const knownCommands = [
|
|
88
|
+
"init",
|
|
89
|
+
"update",
|
|
90
|
+
"doctor",
|
|
91
|
+
"help",
|
|
92
|
+
"mcp",
|
|
93
|
+
"skill",
|
|
94
|
+
"agent",
|
|
95
|
+
"hook",
|
|
96
|
+
"memory",
|
|
97
|
+
"quick-setup",
|
|
98
|
+
"config",
|
|
99
|
+
"template",
|
|
100
|
+
"brain",
|
|
101
|
+
"session"
|
|
102
|
+
];
|
|
103
|
+
if (args.length > 0 && knownCommands.includes(args[0])) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
const input = args.join(" ");
|
|
107
|
+
return recognizeIntent(input);
|
|
108
|
+
}
|
|
109
|
+
async function executeSkill(skillName, originalArgs) {
|
|
110
|
+
try {
|
|
111
|
+
const { executeSlashCommand } = await import('./slash-commands.mjs');
|
|
112
|
+
const skillCommand = `/${skillName}`;
|
|
113
|
+
const handled = await executeSlashCommand(skillCommand);
|
|
114
|
+
return handled;
|
|
115
|
+
} catch (error) {
|
|
116
|
+
console.error(`Failed to execute skill "${skillName}":`, error);
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
async function handleIntentRecognition() {
|
|
121
|
+
const args = process__default.argv.slice(2);
|
|
122
|
+
const intent = shouldTriggerSkill(args);
|
|
123
|
+
if (!intent) {
|
|
124
|
+
return false;
|
|
125
|
+
}
|
|
126
|
+
if (intent.confidence >= 0.9) {
|
|
127
|
+
console.log(`\u{1F3AF} Detected intent: ${intent.description}`);
|
|
128
|
+
console.log(` Executing skill: /${intent.skill}
|
|
129
|
+
`);
|
|
130
|
+
return await executeSkill(intent.skill);
|
|
131
|
+
}
|
|
132
|
+
if (intent.confidence >= 0.7) {
|
|
133
|
+
console.log(`\u{1F914} Did you mean: /${intent.skill} (${intent.description})?`);
|
|
134
|
+
console.log(` Matched keywords: ${intent.matchedKeywords.join(", ")}`);
|
|
135
|
+
console.log(` Confidence: ${(intent.confidence * 100).toFixed(0)}%
|
|
136
|
+
`);
|
|
137
|
+
return await executeSkill(intent.skill);
|
|
138
|
+
}
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export { executeSkill, handleIntentRecognition, recognizeIntent, shouldTriggerSkill };
|
|
@@ -60,8 +60,7 @@ import '../shared/ccjk.dYDLfmph.mjs';
|
|
|
60
60
|
import './simple-config.mjs';
|
|
61
61
|
import './commands.mjs';
|
|
62
62
|
import './ccjk-agents.mjs';
|
|
63
|
-
import '../shared/ccjk.
|
|
64
|
-
import '../shared/ccjk.hrRv8G6j.mjs';
|
|
63
|
+
import '../shared/ccjk.DHXfsrwn.mjs';
|
|
65
64
|
import './index9.mjs';
|
|
66
65
|
import 'tinyglobby';
|
|
67
66
|
import '../shared/ccjk.CfKKcvWy.mjs';
|
package/dist/chunks/menu.mjs
CHANGED
|
@@ -32,6 +32,19 @@ async function handleCancellation() {
|
|
|
32
32
|
ensureI18nInitialized();
|
|
33
33
|
console.log(a.yellow(i18n.t("common:cancelled")));
|
|
34
34
|
}
|
|
35
|
+
async function ensureModelConfigPriority() {
|
|
36
|
+
const { readJsonConfig, writeJsonConfig } = await import('./json-config.mjs');
|
|
37
|
+
const { SETTINGS_FILE } = await import('./constants.mjs');
|
|
38
|
+
const settings = readJsonConfig(SETTINGS_FILE);
|
|
39
|
+
if (!settings) return;
|
|
40
|
+
const hasCustomModels = Boolean(
|
|
41
|
+
settings.env?.ANTHROPIC_MODEL || settings.env?.ANTHROPIC_DEFAULT_HAIKU_MODEL || settings.env?.ANTHROPIC_DEFAULT_SONNET_MODEL || settings.env?.ANTHROPIC_DEFAULT_OPUS_MODEL
|
|
42
|
+
);
|
|
43
|
+
if (hasCustomModels && settings.model) {
|
|
44
|
+
delete settings.model;
|
|
45
|
+
writeJsonConfig(SETTINGS_FILE, settings);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
35
48
|
async function handleOfficialLoginMode() {
|
|
36
49
|
ensureI18nInitialized();
|
|
37
50
|
const success = switchToOfficialLogin();
|
|
@@ -164,6 +177,7 @@ async function configureApiFeature() {
|
|
|
164
177
|
])
|
|
165
178
|
});
|
|
166
179
|
if (!mode || mode === "skip") {
|
|
180
|
+
await ensureModelConfigPriority();
|
|
167
181
|
await handleCancellation();
|
|
168
182
|
return;
|
|
169
183
|
}
|
|
@@ -184,6 +198,7 @@ async function configureApiFeature() {
|
|
|
184
198
|
await handleCancellation();
|
|
185
199
|
break;
|
|
186
200
|
}
|
|
201
|
+
await ensureModelConfigPriority();
|
|
187
202
|
}
|
|
188
203
|
async function configureMcpFeature() {
|
|
189
204
|
ensureI18nInitialized();
|
package/dist/chunks/package.mjs
CHANGED
|
@@ -13,7 +13,7 @@ const QUICK_ACTIONS = [
|
|
|
13
13
|
descriptionZh: "\u81EA\u52A8\u751F\u6210 commit \u6D88\u606F",
|
|
14
14
|
command: "/commit",
|
|
15
15
|
autoActivate: true,
|
|
16
|
-
triggers: ["commit", "git", "push", "save", "\u63D0\u4EA4", "\u4FDD\u5B58"]
|
|
16
|
+
triggers: ["commit", "git", "push", "save", "stage", "add", "\u63D0\u4EA4", "\u4FDD\u5B58", "\u4E0A\u4F20", "\u63A8\u9001", "\u53D1\u5E03"]
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
id: 2,
|
|
@@ -24,7 +24,7 @@ const QUICK_ACTIONS = [
|
|
|
24
24
|
descriptionZh: "\u6DF1\u5EA6\u4E24\u9636\u6BB5\u4EE3\u7801\u5BA1\u67E5",
|
|
25
25
|
command: "/review",
|
|
26
26
|
autoActivate: true,
|
|
27
|
-
triggers: ["review", "check", "pr", "merge", "\u5BA1\u67E5", "\u68C0\u67E5", "\u5408\u5E76"]
|
|
27
|
+
triggers: ["review", "check", "pr", "merge", "inspect", "audit", "look", "\u5BA1\u67E5", "\u68C0\u67E5", "\u5408\u5E76", "\u770B\u770B", "\u68C0\u89C6", "\u8BC4\u5BA1"]
|
|
28
28
|
},
|
|
29
29
|
{
|
|
30
30
|
id: 3,
|
|
@@ -35,7 +35,7 @@ const QUICK_ACTIONS = [
|
|
|
35
35
|
descriptionZh: "TDD \u5DE5\u4F5C\u6D41",
|
|
36
36
|
command: "/tdd",
|
|
37
37
|
autoActivate: true,
|
|
38
|
-
triggers: ["test", "tdd", "unit", "spec", "\u6D4B\u8BD5", "\u5355\u5143\u6D4B\u8BD5"]
|
|
38
|
+
triggers: ["test", "tdd", "unit", "spec", "testing", "jest", "vitest", "\u6D4B\u8BD5", "\u5355\u5143\u6D4B\u8BD5", "\u5199\u6D4B\u8BD5", "\u52A0\u6D4B\u8BD5"]
|
|
39
39
|
},
|
|
40
40
|
{
|
|
41
41
|
id: 4,
|
|
@@ -46,7 +46,7 @@ const QUICK_ACTIONS = [
|
|
|
46
46
|
descriptionZh: "6\u6B65\u5F00\u53D1\u6D41\u7A0B",
|
|
47
47
|
command: "/workflow",
|
|
48
48
|
autoActivate: true,
|
|
49
|
-
triggers: ["plan", "feature", "implement", "build", "create", "\u89C4\u5212", "\u529F\u80FD", "\u5B9E\u73B0", "\u521B\u5EFA"]
|
|
49
|
+
triggers: ["plan", "feature", "implement", "build", "create", "develop", "make", "add", "\u89C4\u5212", "\u529F\u80FD", "\u5B9E\u73B0", "\u521B\u5EFA", "\u8BA1\u5212", "\u68B3\u7406", "\u601D\u8003", "\u6700\u5F3A\u5927\u8111", "\u5F00\u53D1", "\u505A", "\u52A0", "\u65B0\u589E", "\u6DFB\u52A0"]
|
|
50
50
|
},
|
|
51
51
|
{
|
|
52
52
|
id: 5,
|
|
@@ -57,7 +57,7 @@ const QUICK_ACTIONS = [
|
|
|
57
57
|
descriptionZh: "\u7CFB\u7EDF\u6027\u8C03\u8BD5",
|
|
58
58
|
command: "/debug",
|
|
59
59
|
autoActivate: true,
|
|
60
|
-
triggers: ["debug", "bug", "error", "fix", "issue", "problem", "\u8C03\u8BD5", "\u9519\u8BEF", "\u4FEE\u590D", "\u95EE\u9898"]
|
|
60
|
+
triggers: ["debug", "bug", "error", "fix", "issue", "problem", "broken", "crash", "fail", "\u8C03\u8BD5", "\u9519\u8BEF", "\u4FEE\u590D", "\u95EE\u9898", "\u62A5\u9519", "\u5D29\u6E83", "\u51FA\u9519", "\u4E0D\u884C", "\u574F\u4E86"]
|
|
61
61
|
},
|
|
62
62
|
{
|
|
63
63
|
id: 6,
|
|
@@ -68,7 +68,7 @@ const QUICK_ACTIONS = [
|
|
|
68
68
|
descriptionZh: "\u63A2\u7D22\u60F3\u6CD5\u548C\u65B9\u6848",
|
|
69
69
|
command: "/brainstorm",
|
|
70
70
|
autoActivate: true,
|
|
71
|
-
triggers: ["brainstorm", "idea", "design", "think", "explore", "\u5934\u8111\u98CE\u66B4", "\u60F3\u6CD5", "\u8BBE\u8BA1", "\u63A2\u7D22"]
|
|
71
|
+
triggers: ["brainstorm", "idea", "design", "think", "explore", "concept", "solution", "approach", "\u5934\u8111\u98CE\u66B4", "\u60F3\u6CD5", "\u8BBE\u8BA1", "\u63A2\u7D22", "\u601D\u8003", "\u65B9\u6848", "\u6784\u601D", "\u8BA8\u8BBA", "\u5982\u4F55"]
|
|
72
72
|
},
|
|
73
73
|
{
|
|
74
74
|
id: 7,
|
|
@@ -79,7 +79,7 @@ const QUICK_ACTIONS = [
|
|
|
79
79
|
descriptionZh: "\u8D28\u91CF\u9A8C\u8BC1",
|
|
80
80
|
command: "/verify",
|
|
81
81
|
autoActivate: true,
|
|
82
|
-
triggers: ["verify", "validate", "quality", "deploy", "\u9A8C\u8BC1", "\u8D28\u91CF", "\u90E8\u7F72"]
|
|
82
|
+
triggers: ["verify", "validate", "quality", "deploy", "release", "production", "\u9A8C\u8BC1", "\u8D28\u91CF", "\u90E8\u7F72", "\u53D1\u5E03", "\u4E0A\u7EBF", "\u751F\u4EA7"]
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
id: 8,
|
|
@@ -90,7 +90,7 @@ const QUICK_ACTIONS = [
|
|
|
90
90
|
descriptionZh: "\u751F\u6210\u6587\u6863",
|
|
91
91
|
command: "/docs",
|
|
92
92
|
autoActivate: false,
|
|
93
|
-
triggers: ["doc", "docs", "readme", "documentation", "\u6587\u6863", "\u8BF4\u660E"]
|
|
93
|
+
triggers: ["doc", "docs", "readme", "documentation", "comment", "explain", "\u6587\u6863", "\u8BF4\u660E", "\u6CE8\u91CA", "\u89E3\u91CA", "\u5199\u6587\u6863"]
|
|
94
94
|
}
|
|
95
95
|
];
|
|
96
96
|
function generateQuickActionsPanel(lang = "en") {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { checkForUpdates, performUpgrade } from './auto-upgrade.mjs';
|
|
2
|
+
import 'node:child_process';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
import 'node:path';
|
|
5
|
+
import 'node:os';
|
|
6
|
+
|
|
7
|
+
async function upgrade() {
|
|
8
|
+
console.log("\u{1F50D} Checking for updates...\n");
|
|
9
|
+
const versionInfo = await checkForUpdates();
|
|
10
|
+
if (!versionInfo.hasUpdate) {
|
|
11
|
+
console.log("\u2705 You are already on the latest version!");
|
|
12
|
+
console.log(` Current version: v${versionInfo.current}
|
|
13
|
+
`);
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
console.log("\u{1F4E6} Update available:");
|
|
17
|
+
console.log(` Current: v${versionInfo.current}`);
|
|
18
|
+
console.log(` Latest: v${versionInfo.latest} (${versionInfo.updateType} update)
|
|
19
|
+
`);
|
|
20
|
+
const { default: prompts } = await import('prompts');
|
|
21
|
+
const { confirm } = await prompts({
|
|
22
|
+
type: "confirm",
|
|
23
|
+
name: "confirm",
|
|
24
|
+
message: "Do you want to upgrade now?",
|
|
25
|
+
initial: true
|
|
26
|
+
});
|
|
27
|
+
if (!confirm) {
|
|
28
|
+
console.log("\n\u23ED\uFE0F Upgrade cancelled.\n");
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
await performUpgrade();
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { upgrade };
|
package/dist/cli.mjs
CHANGED
|
@@ -83,6 +83,18 @@ const COMMANDS = [
|
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
85
|
},
|
|
86
|
+
{
|
|
87
|
+
name: "upgrade",
|
|
88
|
+
description: "Upgrade CCJK to the latest version",
|
|
89
|
+
tier: "core",
|
|
90
|
+
options: [],
|
|
91
|
+
loader: async () => {
|
|
92
|
+
const { upgrade } = await import('./chunks/upgrade.mjs');
|
|
93
|
+
return async () => {
|
|
94
|
+
await upgrade();
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
},
|
|
86
98
|
{
|
|
87
99
|
name: "doctor",
|
|
88
100
|
description: "Run environment health check",
|
|
@@ -257,10 +269,10 @@ const COMMANDS = [
|
|
|
257
269
|
const argsArr = args;
|
|
258
270
|
if (actionStr === "install") {
|
|
259
271
|
const { installAgentBrowser } = await import('./chunks/installer2.mjs');
|
|
260
|
-
await installAgentBrowser(
|
|
272
|
+
await installAgentBrowser();
|
|
261
273
|
} else if (actionStr === "uninstall") {
|
|
262
274
|
const { uninstallAgentBrowser } = await import('./chunks/installer2.mjs');
|
|
263
|
-
await uninstallAgentBrowser(
|
|
275
|
+
await uninstallAgentBrowser();
|
|
264
276
|
} else if (actionStr === "status") {
|
|
265
277
|
const { agentBrowserStatus } = await import('./chunks/commands2.mjs');
|
|
266
278
|
await agentBrowserStatus(options);
|
|
@@ -2001,10 +2013,6 @@ async function registerSpecialCommands(cli) {
|
|
|
2001
2013
|
console.warn('\n\u26A0\uFE0F versions \u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 "ccjk system versions" \u66FF\u4EE3\n');
|
|
2002
2014
|
console.log("\u{1F4A1} \u65B0\u547D\u4EE4\uFF1Accjk system versions\n");
|
|
2003
2015
|
});
|
|
2004
|
-
cli.command("upgrade", '[DEPRECATED] Use "ccjk system upgrade"').action(async () => {
|
|
2005
|
-
console.warn('\n\u26A0\uFE0F upgrade \u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 "ccjk system upgrade" \u66FF\u4EE3\n');
|
|
2006
|
-
console.log("\u{1F4A1} \u65B0\u547D\u4EE4\uFF1Accjk system upgrade\n");
|
|
2007
|
-
});
|
|
2008
2016
|
cli.command("permissions", '[DEPRECATED] Use "ccjk system permissions"').action(async () => {
|
|
2009
2017
|
console.warn('\n\u26A0\uFE0F permissions \u5DF2\u5E9F\u5F03\uFF0C\u8BF7\u4F7F\u7528 "ccjk system permissions" \u66FF\u4EE3\n');
|
|
2010
2018
|
console.log("\u{1F4A1} \u65B0\u547D\u4EE4\uFF1Accjk system permissions\n");
|
|
@@ -2175,18 +2183,37 @@ async function runLazyCli() {
|
|
|
2175
2183
|
await autoInitBrainHooks();
|
|
2176
2184
|
} catch {
|
|
2177
2185
|
}
|
|
2186
|
+
try {
|
|
2187
|
+
const { runAutoFixOnStartup } = await import('./chunks/auto-fix.mjs');
|
|
2188
|
+
await runAutoFixOnStartup();
|
|
2189
|
+
} catch {
|
|
2190
|
+
}
|
|
2191
|
+
try {
|
|
2192
|
+
const { autoCheckUpdates } = await import('./chunks/auto-upgrade.mjs');
|
|
2193
|
+
autoCheckUpdates(true);
|
|
2194
|
+
} catch {
|
|
2195
|
+
}
|
|
2178
2196
|
const handled = await tryQuickProviderLaunch();
|
|
2179
2197
|
if (handled) {
|
|
2180
2198
|
spinner?.stop();
|
|
2181
2199
|
return;
|
|
2182
2200
|
}
|
|
2183
2201
|
const args = process__default.argv.slice(2);
|
|
2184
|
-
if (args.length > 0
|
|
2185
|
-
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2202
|
+
if (args.length > 0) {
|
|
2203
|
+
if (args[0].startsWith("/")) {
|
|
2204
|
+
spinner?.stop();
|
|
2205
|
+
const { executeSlashCommand } = await import('./chunks/slash-commands.mjs');
|
|
2206
|
+
const slashHandled = await executeSlashCommand(args.join(" "));
|
|
2207
|
+
if (slashHandled) {
|
|
2208
|
+
return;
|
|
2209
|
+
}
|
|
2210
|
+
} else {
|
|
2211
|
+
const { handleIntentRecognition } = await import('./chunks/intent-engine.mjs');
|
|
2212
|
+
const intentHandled = await handleIntentRecognition();
|
|
2213
|
+
if (intentHandled) {
|
|
2214
|
+
spinner?.stop();
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2190
2217
|
}
|
|
2191
2218
|
}
|
|
2192
2219
|
const cac = (await import('./chunks/index10.mjs')).default;
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"installingBrowser": "Installing Chromium browser...",
|
|
24
24
|
"browserInstallSuccess": "Chromium browser installed successfully!",
|
|
25
25
|
"browserInstallFailed": "Failed to install Chromium browser",
|
|
26
|
+
"browserAutoInstall": "Browser will be installed automatically on first use",
|
|
26
27
|
"alreadyInstalled": "agent-browser is already installed (v{{version}})",
|
|
27
28
|
"notInstalled": "agent-browser is not installed",
|
|
28
29
|
"browserNotInstalled": "Chromium browser is not installed",
|
|
@@ -15,10 +15,10 @@
|
|
|
15
15
|
"currentModel": "Current model",
|
|
16
16
|
"defaultModelOption": "Default - Let Claude Code choose",
|
|
17
17
|
"defaultStyle": "Default style",
|
|
18
|
-
"enterHaikuModel": "
|
|
19
|
-
"enterSonnetModel": "
|
|
20
|
-
"enterOpusModel": "
|
|
21
|
-
"enterPrimaryModel": "
|
|
18
|
+
"enterHaikuModel": "[Optional] Haiku model (empty to skip)",
|
|
19
|
+
"enterSonnetModel": "[Optional] Sonnet model (empty to skip)",
|
|
20
|
+
"enterOpusModel": "[Optional] Opus model (empty to skip)",
|
|
21
|
+
"enterPrimaryModel": "[Optional] Primary model (empty=adaptive, filled=locked)",
|
|
22
22
|
"envImportSuccess": "Environment variables imported",
|
|
23
23
|
"envImportFailed": "Environment variables import failed",
|
|
24
24
|
"existingConfig": "Existing config detected. How to proceed?",
|