ccjk 9.5.6 → 9.7.0
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/agent.mjs +1 -1
- package/dist/chunks/api-providers.mjs +1 -1
- package/dist/chunks/api.mjs +3 -3
- package/dist/chunks/auto-bootstrap.mjs +1 -1
- package/dist/chunks/auto-updater.mjs +1 -1
- package/dist/chunks/boost.mjs +160 -0
- package/dist/chunks/ccjk-agents.mjs +1 -1
- package/dist/chunks/ccjk-all.mjs +1 -1
- package/dist/chunks/ccjk-config.mjs +1 -1
- package/dist/chunks/ccjk-hooks.mjs +1 -1
- package/dist/chunks/ccjk-mcp.mjs +2 -2
- package/dist/chunks/ccjk-setup.mjs +1 -1
- package/dist/chunks/ccjk-skills.mjs +1 -1
- package/dist/chunks/ccr.mjs +25 -30
- package/dist/chunks/ccu.mjs +1 -1
- package/dist/chunks/check-updates.mjs +3 -4
- package/dist/chunks/claude-code-config-manager.mjs +7 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +2 -2
- package/dist/chunks/claude-config.mjs +4 -4
- package/dist/chunks/claude-wrapper.mjs +2 -2
- package/dist/chunks/codex-config-switch.mjs +4 -5
- package/dist/chunks/codex-provider-manager.mjs +2 -3
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/codex.mjs +207 -6
- package/dist/chunks/commands.mjs +391 -88
- package/dist/chunks/commands2.mjs +88 -391
- package/dist/chunks/completion.mjs +1 -1
- package/dist/chunks/config-consolidator.mjs +2 -2
- package/dist/chunks/config-switch.mjs +3 -4
- package/dist/chunks/config.mjs +78 -7
- package/dist/chunks/config2.mjs +400 -410
- package/dist/chunks/config3.mjs +410 -400
- package/dist/chunks/constants.mjs +1 -1
- package/dist/chunks/doctor.mjs +4 -4
- package/dist/chunks/features.mjs +24 -17
- package/dist/chunks/index.mjs +178 -7
- package/dist/chunks/index2.mjs +1162 -169
- package/dist/chunks/index3.mjs +910 -1076
- package/dist/chunks/index4.mjs +137 -947
- package/dist/chunks/index5.mjs +635 -167
- package/dist/chunks/init.mjs +141 -99
- package/dist/chunks/installer.mjs +147 -649
- package/dist/chunks/installer2.mjs +649 -147
- package/dist/chunks/interview.mjs +2 -2
- package/dist/chunks/marketplace.mjs +1 -1
- package/dist/chunks/mcp.mjs +1058 -17
- package/dist/chunks/menu.mjs +147 -56
- package/dist/chunks/monitor.mjs +2 -2
- package/dist/chunks/notification.mjs +1 -1
- package/dist/chunks/onboarding.mjs +2 -2
- package/dist/chunks/package.mjs +2 -210
- package/dist/chunks/permission-manager.mjs +2 -2
- package/dist/chunks/permissions.mjs +1 -1
- package/dist/chunks/platform.mjs +1 -1
- package/dist/chunks/plugin.mjs +1 -1
- package/dist/chunks/prompts.mjs +1 -1
- package/dist/chunks/providers.mjs +1 -1
- package/dist/chunks/quick-setup.mjs +16 -20
- package/dist/chunks/silent-updater.mjs +1 -1
- package/dist/chunks/simple-config.mjs +2 -2
- package/dist/chunks/skill.mjs +1 -1
- package/dist/chunks/skills-sync.mjs +1 -1
- package/dist/chunks/skills.mjs +1 -1
- package/dist/chunks/startup.mjs +1 -1
- package/dist/chunks/stats.mjs +1 -1
- package/dist/chunks/status.mjs +159 -0
- package/dist/chunks/team.mjs +1 -1
- package/dist/chunks/thinking.mjs +2 -2
- package/dist/chunks/uninstall.mjs +6 -6
- package/dist/chunks/update.mjs +6 -9
- package/dist/chunks/upgrade-manager.mjs +2 -2
- package/dist/chunks/version-checker.mjs +3 -3
- package/dist/chunks/vim.mjs +1 -1
- package/dist/chunks/workflows.mjs +616 -215
- package/dist/cli.mjs +70 -121
- package/dist/index.d.mts +17 -1482
- package/dist/index.d.ts +17 -1482
- package/dist/index.mjs +950 -4740
- package/dist/shared/{ccjk.zCqdxT2Y.mjs → ccjk.Br91zBIG.mjs} +2 -2
- package/dist/shared/ccjk.CSkyCZIM.mjs +638 -0
- package/dist/shared/{ccjk.BKoi8-Hy.mjs → ccjk.DE91nClQ.mjs} +1 -1
- package/dist/shared/{ccjk.f40us0yY.mjs → ccjk.DvIrK0wz.mjs} +2 -2
- package/dist/shared/ccjk.LsPZ2PYo.mjs +1048 -0
- package/dist/shared/{ccjk.DRweXU5F.mjs → ccjk.q1koQxEE.mjs} +2 -2
- package/package.json +1 -1
- package/templates/claude-code/common/settings.json +15 -111
- package/dist/chunks/api-adapter.mjs +0 -180
- package/dist/chunks/cli.mjs +0 -2227
- package/dist/chunks/context-menu.mjs +0 -913
- package/dist/chunks/hooks-sync.mjs +0 -1627
- package/dist/chunks/index6.mjs +0 -663
- package/dist/chunks/mcp-market.mjs +0 -1077
- package/dist/chunks/mcp-server.mjs +0 -776
- package/dist/chunks/project-detector.mjs +0 -131
- package/dist/chunks/provider-registry.mjs +0 -92
- package/dist/chunks/setup-wizard.mjs +0 -362
- package/dist/chunks/tools.mjs +0 -143
- package/dist/chunks/workflows2.mjs +0 -633
- package/dist/shared/ccjk.BM_HZogn.mjs +0 -347
- package/dist/shared/ccjk.BaEp4UHQ.mjs +0 -75
- package/dist/shared/ccjk.CS0ybJCf.mjs +0 -490
- package/dist/shared/ccjk.CZgIwikC.mjs +0 -209
- package/dist/shared/ccjk.tO8zeFh1.mjs +0 -397
|
@@ -1,412 +1,109 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { exec } from 'node:child_process';
|
|
2
|
+
import { promisify } from 'node:util';
|
|
2
3
|
import ansis from 'ansis';
|
|
3
|
-
import {
|
|
4
|
+
import { ensureI18nInitialized, i18n } from './index.mjs';
|
|
4
5
|
import 'node:fs';
|
|
5
|
-
import 'node:
|
|
6
|
-
import 'node:
|
|
6
|
+
import 'node:process';
|
|
7
|
+
import 'node:url';
|
|
8
|
+
import 'i18next';
|
|
9
|
+
import 'i18next-fs-backend';
|
|
10
|
+
import 'pathe';
|
|
7
11
|
|
|
8
|
-
const
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
browser: "chromium",
|
|
19
|
-
...options
|
|
20
|
-
};
|
|
12
|
+
const execAsync = promisify(exec);
|
|
13
|
+
async function runCcrUi(apiKey) {
|
|
14
|
+
ensureI18nInitialized();
|
|
15
|
+
console.log(ansis.green(`
|
|
16
|
+
\u{1F5A5}\uFE0F ${i18n.t("ccr:startingCcrUi")}`));
|
|
17
|
+
if (apiKey) {
|
|
18
|
+
console.log(ansis.bold.green(`
|
|
19
|
+
\u{1F511} ${i18n.t("ccr:ccrUiApiKey") || "CCR UI API Key"}: ${apiKey}`));
|
|
20
|
+
console.log(ansis.gray(` ${i18n.t("ccr:ccrUiApiKeyHint") || "Use this API key to login to CCR UI"}
|
|
21
|
+
`));
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
if (
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
try {
|
|
33
|
-
const { execSync } = await import('node:child_process');
|
|
34
|
-
this.sessionId = `session-${Date.now()}`;
|
|
35
|
-
const headlessFlag = this.options.headless ? "" : "--headed";
|
|
36
|
-
execSync(`agent-browser start ${headlessFlag} 2>/dev/null || true`, {
|
|
37
|
-
encoding: "utf-8",
|
|
38
|
-
stdio: "pipe"
|
|
39
|
-
});
|
|
40
|
-
this.isRunning = true;
|
|
41
|
-
if (this.options.verbose) {
|
|
42
|
-
console.log(`${green$1("\u2713")} Browser session started: ${this.sessionId}`);
|
|
43
|
-
}
|
|
44
|
-
} catch (error) {
|
|
45
|
-
this.isRunning = false;
|
|
46
|
-
throw new Error(`Failed to start browser session: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
/**
|
|
50
|
-
* 导航到 URL
|
|
51
|
-
*/
|
|
52
|
-
async navigate(url) {
|
|
53
|
-
this.ensureRunning();
|
|
54
|
-
try {
|
|
55
|
-
const { execSync } = await import('node:child_process');
|
|
56
|
-
const fullUrl = url.startsWith("http") ? url : `https://${url}`;
|
|
57
|
-
execSync(`agent-browser open "${fullUrl}"`, {
|
|
58
|
-
encoding: "utf-8",
|
|
59
|
-
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
60
|
-
timeout: this.options.timeout
|
|
61
|
-
});
|
|
62
|
-
if (this.options.verbose) {
|
|
63
|
-
console.log(`${green$1("\u2713")} Navigated to: ${fullUrl}`);
|
|
64
|
-
}
|
|
65
|
-
} catch (error) {
|
|
66
|
-
throw new Error(`Failed to navigate: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* 获取页面快照
|
|
71
|
-
*/
|
|
72
|
-
async snapshot(options = {}) {
|
|
73
|
-
this.ensureRunning();
|
|
74
|
-
try {
|
|
75
|
-
const { execSync } = await import('node:child_process');
|
|
76
|
-
const flags = [];
|
|
77
|
-
if (options.interactive)
|
|
78
|
-
flags.push("-i");
|
|
79
|
-
if (options.compact)
|
|
80
|
-
flags.push("-c");
|
|
81
|
-
if (options.depth)
|
|
82
|
-
flags.push(`-d ${options.depth}`);
|
|
83
|
-
if (options.json)
|
|
84
|
-
flags.push("--json");
|
|
85
|
-
const result = execSync(`agent-browser snapshot ${flags.join(" ")}`, {
|
|
86
|
-
encoding: "utf-8",
|
|
87
|
-
timeout: this.options.timeout
|
|
88
|
-
});
|
|
89
|
-
return result.trim();
|
|
90
|
-
} catch (error) {
|
|
91
|
-
throw new Error(`Failed to get snapshot: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* 点击元素
|
|
96
|
-
*/
|
|
97
|
-
async click(ref) {
|
|
98
|
-
this.ensureRunning();
|
|
99
|
-
try {
|
|
100
|
-
const { execSync } = await import('node:child_process');
|
|
101
|
-
const refId = ref.startsWith("@") ? ref : `@${ref}`;
|
|
102
|
-
execSync(`agent-browser click ${refId}`, {
|
|
103
|
-
encoding: "utf-8",
|
|
104
|
-
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
105
|
-
timeout: this.options.timeout
|
|
106
|
-
});
|
|
107
|
-
if (this.options.verbose) {
|
|
108
|
-
console.log(`${green$1("\u2713")} Clicked: ${refId}`);
|
|
109
|
-
}
|
|
110
|
-
} catch (error) {
|
|
111
|
-
throw new Error(`Failed to click: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* 填充输入框
|
|
116
|
-
*/
|
|
117
|
-
async fill(ref, text) {
|
|
118
|
-
this.ensureRunning();
|
|
119
|
-
try {
|
|
120
|
-
const { execSync } = await import('node:child_process');
|
|
121
|
-
const refId = ref.startsWith("@") ? ref : `@${ref}`;
|
|
122
|
-
execSync(`agent-browser fill ${refId} "${text.replace(/"/g, '\\"')}"`, {
|
|
123
|
-
encoding: "utf-8",
|
|
124
|
-
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
125
|
-
timeout: this.options.timeout
|
|
126
|
-
});
|
|
127
|
-
if (this.options.verbose) {
|
|
128
|
-
console.log(`${green$1("\u2713")} Filled ${refId}: ${text}`);
|
|
129
|
-
}
|
|
130
|
-
} catch (error) {
|
|
131
|
-
throw new Error(`Failed to fill: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
/**
|
|
135
|
-
* 获取元素文本
|
|
136
|
-
*/
|
|
137
|
-
async getText(ref) {
|
|
138
|
-
this.ensureRunning();
|
|
139
|
-
try {
|
|
140
|
-
const { execSync } = await import('node:child_process');
|
|
141
|
-
const refId = ref.startsWith("@") ? ref : `@${ref}`;
|
|
142
|
-
const result = execSync(`agent-browser get text ${refId}`, {
|
|
143
|
-
encoding: "utf-8",
|
|
144
|
-
timeout: this.options.timeout
|
|
145
|
-
});
|
|
146
|
-
return result.trim();
|
|
147
|
-
} catch (error) {
|
|
148
|
-
throw new Error(`Failed to get text: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
/**
|
|
152
|
-
* 截图
|
|
153
|
-
*/
|
|
154
|
-
async screenshot(path, fullPage = false) {
|
|
155
|
-
this.ensureRunning();
|
|
156
|
-
try {
|
|
157
|
-
const { execSync } = await import('node:child_process');
|
|
158
|
-
const flags = [];
|
|
159
|
-
if (fullPage)
|
|
160
|
-
flags.push("--full");
|
|
161
|
-
if (path)
|
|
162
|
-
flags.push(path);
|
|
163
|
-
const result = execSync(`agent-browser screenshot ${flags.join(" ")}`, {
|
|
164
|
-
encoding: "utf-8",
|
|
165
|
-
timeout: this.options.timeout
|
|
166
|
-
});
|
|
167
|
-
if (this.options.verbose) {
|
|
168
|
-
console.log(`${green$1("\u2713")} Screenshot saved: ${path || "screenshot.png"}`);
|
|
169
|
-
}
|
|
170
|
-
return result.trim();
|
|
171
|
-
} catch (error) {
|
|
172
|
-
throw new Error(`Failed to take screenshot: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* 等待
|
|
177
|
-
*/
|
|
178
|
-
async wait(condition) {
|
|
179
|
-
this.ensureRunning();
|
|
180
|
-
try {
|
|
181
|
-
const { execSync } = await import('node:child_process');
|
|
182
|
-
let cmd;
|
|
183
|
-
if (typeof condition === "number") {
|
|
184
|
-
cmd = `agent-browser wait ${condition}`;
|
|
185
|
-
} else if (condition.startsWith("@")) {
|
|
186
|
-
cmd = `agent-browser wait ${condition}`;
|
|
187
|
-
} else {
|
|
188
|
-
cmd = `agent-browser wait --text "${condition}"`;
|
|
189
|
-
}
|
|
190
|
-
execSync(cmd, {
|
|
191
|
-
encoding: "utf-8",
|
|
192
|
-
stdio: this.options.verbose ? "inherit" : "pipe",
|
|
193
|
-
timeout: this.options.timeout
|
|
194
|
-
});
|
|
195
|
-
} catch (error) {
|
|
196
|
-
throw new Error(`Failed to wait: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* 关闭会话
|
|
201
|
-
*/
|
|
202
|
-
async close() {
|
|
203
|
-
if (!this.isRunning) {
|
|
204
|
-
return;
|
|
205
|
-
}
|
|
206
|
-
try {
|
|
207
|
-
const { execSync } = await import('node:child_process');
|
|
208
|
-
execSync("agent-browser close 2>/dev/null || true", {
|
|
209
|
-
encoding: "utf-8",
|
|
210
|
-
stdio: "pipe"
|
|
211
|
-
});
|
|
212
|
-
this.isRunning = false;
|
|
213
|
-
this.sessionId = null;
|
|
214
|
-
if (this.options.verbose) {
|
|
215
|
-
console.log(`${green$1("\u2713")} Browser session closed`);
|
|
216
|
-
}
|
|
217
|
-
} catch {
|
|
218
|
-
this.isRunning = false;
|
|
219
|
-
this.sessionId = null;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* 获取会话状态
|
|
224
|
-
*/
|
|
225
|
-
getStatus() {
|
|
226
|
-
return {
|
|
227
|
-
running: this.isRunning,
|
|
228
|
-
sessionId: this.sessionId
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
/**
|
|
232
|
-
* 确保会话正在运行
|
|
233
|
-
*/
|
|
234
|
-
ensureRunning() {
|
|
235
|
-
if (!this.isRunning) {
|
|
236
|
-
throw new Error("Browser session is not running. Call start() first.");
|
|
237
|
-
}
|
|
23
|
+
try {
|
|
24
|
+
const { stdout, stderr } = await execAsync("ccr ui");
|
|
25
|
+
if (stdout)
|
|
26
|
+
console.log(stdout);
|
|
27
|
+
if (stderr)
|
|
28
|
+
console.error(ansis.yellow(stderr));
|
|
29
|
+
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrUiStarted")}`));
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(ansis.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
32
|
+
throw error;
|
|
238
33
|
}
|
|
239
34
|
}
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
${cyan("config")} Configure browser settings
|
|
257
|
-
|
|
258
|
-
${yellow("Examples:")}
|
|
259
|
-
${gray("# Install Agent Browser")}
|
|
260
|
-
ccjk browser install
|
|
261
|
-
|
|
262
|
-
${gray("# Check status")}
|
|
263
|
-
ccjk browser status
|
|
264
|
-
|
|
265
|
-
${gray("# Start a session with URL")}
|
|
266
|
-
ccjk browser start https://example.com
|
|
267
|
-
|
|
268
|
-
${yellow("Quick Start:")}
|
|
269
|
-
${gray("After installation, use these commands directly:")}
|
|
270
|
-
agent-browser open <url> ${gray("# Navigate to URL")}
|
|
271
|
-
agent-browser snapshot -i ${gray("# Get interactive elements")}
|
|
272
|
-
agent-browser click @e1 ${gray("# Click by ref")}
|
|
273
|
-
agent-browser fill @e2 "text" ${gray("# Fill input")}
|
|
274
|
-
agent-browser screenshot ${gray("# Take screenshot")}
|
|
275
|
-
agent-browser close ${gray("# Close browser")}
|
|
276
|
-
|
|
277
|
-
${yellow("Documentation:")}
|
|
278
|
-
Run ${cyan("/browser")} in Claude Code for full skill documentation
|
|
279
|
-
`);
|
|
280
|
-
}
|
|
281
|
-
async function agentBrowserStatus(options) {
|
|
282
|
-
console.log(`
|
|
283
|
-
${bold(cyan("Agent Browser Status"))}
|
|
284
|
-
`);
|
|
285
|
-
const installed = await checkAgentBrowserInstalled();
|
|
286
|
-
const installPath = getInstallPath();
|
|
287
|
-
if (installed) {
|
|
288
|
-
console.log(` ${green("\u2713")} Agent Browser is ${green("installed")}`);
|
|
289
|
-
console.log(` ${gray("Path:")} ${installPath}`);
|
|
290
|
-
try {
|
|
291
|
-
const { execSync } = await import('node:child_process');
|
|
292
|
-
const version = execSync('agent-browser --version 2>/dev/null || echo "unknown"', {
|
|
293
|
-
encoding: "utf-8"
|
|
294
|
-
}).trim();
|
|
295
|
-
console.log(` ${gray("Version:")} ${version}`);
|
|
296
|
-
} catch {
|
|
297
|
-
console.log(` ${gray("Version:")} ${yellow("unknown")}`);
|
|
298
|
-
}
|
|
299
|
-
try {
|
|
300
|
-
const { execSync } = await import('node:child_process');
|
|
301
|
-
execSync("npx playwright --version 2>/dev/null", { encoding: "utf-8" });
|
|
302
|
-
console.log(` ${green("\u2713")} Playwright browsers available`);
|
|
303
|
-
} catch {
|
|
304
|
-
console.log(` ${yellow("!")} Playwright browsers may need installation`);
|
|
305
|
-
console.log(` ${gray("Run:")} npx playwright install chromium`);
|
|
306
|
-
}
|
|
307
|
-
} else {
|
|
308
|
-
console.log(` ${red("\u2717")} Agent Browser is ${red("not installed")}`);
|
|
309
|
-
console.log(`
|
|
310
|
-
${gray("To install, run:")}`);
|
|
311
|
-
console.log(` ${cyan("ccjk browser install")}`);
|
|
312
|
-
}
|
|
313
|
-
if (options.verbose) {
|
|
314
|
-
console.log(`
|
|
315
|
-
${gray("Debug Info:")}`);
|
|
316
|
-
console.log(` ${gray("Install path:")} ${installPath}`);
|
|
317
|
-
console.log(` ${gray("Platform:")} ${process__default.platform}`);
|
|
318
|
-
console.log(` ${gray("Arch:")} ${process__default.arch}`);
|
|
35
|
+
async function runCcrStatus() {
|
|
36
|
+
ensureI18nInitialized();
|
|
37
|
+
console.log(ansis.green(`
|
|
38
|
+
\u{1F4CA} ${i18n.t("ccr:checkingCcrStatus")}`));
|
|
39
|
+
try {
|
|
40
|
+
const { stdout, stderr } = await execAsync("ccr status");
|
|
41
|
+
if (stdout) {
|
|
42
|
+
console.log(`
|
|
43
|
+
${ansis.bold(i18n.t("ccr:ccrStatusTitle"))}`);
|
|
44
|
+
console.log(stdout);
|
|
45
|
+
}
|
|
46
|
+
if (stderr)
|
|
47
|
+
console.error(ansis.yellow(stderr));
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error(ansis.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
50
|
+
throw error;
|
|
319
51
|
}
|
|
320
|
-
console.log();
|
|
321
52
|
}
|
|
322
|
-
async function
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
${red("\u2717")} Agent Browser is not installed`);
|
|
327
|
-
console.log(` ${gray("Run:")} ${cyan("ccjk browser install")} ${gray("first")}
|
|
328
|
-
`);
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
console.log(`
|
|
332
|
-
${cyan("Starting browser session...")}
|
|
333
|
-
`);
|
|
53
|
+
async function runCcrRestart() {
|
|
54
|
+
ensureI18nInitialized();
|
|
55
|
+
console.log(ansis.green(`
|
|
56
|
+
\u{1F504} ${i18n.t("ccr:restartingCcr")}`));
|
|
334
57
|
try {
|
|
335
|
-
const
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
console.log(`${gray("Navigating to:")} ${url}`);
|
|
342
|
-
await session.navigate(url);
|
|
343
|
-
}
|
|
344
|
-
console.log(`
|
|
345
|
-
${green("\u2713")} Browser session started`);
|
|
346
|
-
console.log(`
|
|
347
|
-
${yellow("Available commands:")}`);
|
|
348
|
-
console.log(` agent-browser snapshot -i ${gray("# Get interactive elements")}`);
|
|
349
|
-
console.log(` agent-browser click @e1 ${gray("# Click element")}`);
|
|
350
|
-
console.log(` agent-browser close ${gray("# Close session")}`);
|
|
351
|
-
console.log();
|
|
58
|
+
const { stdout, stderr } = await execAsync("ccr restart");
|
|
59
|
+
if (stdout)
|
|
60
|
+
console.log(stdout);
|
|
61
|
+
if (stderr)
|
|
62
|
+
console.error(ansis.yellow(stderr));
|
|
63
|
+
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrRestarted")}`));
|
|
352
64
|
} catch (error) {
|
|
353
|
-
console.error(`
|
|
354
|
-
|
|
355
|
-
if (options.verbose && error instanceof Error) {
|
|
356
|
-
console.error(` ${gray("Error:")} ${error.message}`);
|
|
357
|
-
}
|
|
358
|
-
console.log(`
|
|
359
|
-
${gray("Try running:")} ${cyan("ccjk browser install")} ${gray("to reinstall")}
|
|
360
|
-
`);
|
|
65
|
+
console.error(ansis.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
66
|
+
throw error;
|
|
361
67
|
}
|
|
362
68
|
}
|
|
363
|
-
async function
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
`);
|
|
69
|
+
async function runCcrStart() {
|
|
70
|
+
ensureI18nInitialized();
|
|
71
|
+
console.log(ansis.green(`
|
|
72
|
+
\u25B6\uFE0F ${i18n.t("ccr:startingCcr")}`));
|
|
367
73
|
try {
|
|
368
|
-
const {
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
74
|
+
const { stdout, stderr } = await execAsync("ccr start");
|
|
75
|
+
if (stdout)
|
|
76
|
+
console.log(stdout);
|
|
77
|
+
if (stderr)
|
|
78
|
+
console.error(ansis.yellow(stderr));
|
|
79
|
+
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrStarted")}`));
|
|
372
80
|
} catch (error) {
|
|
373
|
-
if (
|
|
374
|
-
console.log(
|
|
375
|
-
|
|
81
|
+
if (error.stdout && error.stdout.includes("Loaded JSON config from:")) {
|
|
82
|
+
console.log(error.stdout);
|
|
83
|
+
if (error.stderr)
|
|
84
|
+
console.error(ansis.yellow(error.stderr));
|
|
85
|
+
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrStarted")}`));
|
|
376
86
|
} else {
|
|
377
|
-
console.
|
|
378
|
-
|
|
87
|
+
console.error(ansis.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
88
|
+
throw error;
|
|
379
89
|
}
|
|
380
90
|
}
|
|
381
91
|
}
|
|
382
|
-
async function
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
`);
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
console.log(` ${gray("Timeout:")} 30000ms`);
|
|
397
|
-
console.log(`
|
|
398
|
-
${yellow("Configuration Options:")}`);
|
|
399
|
-
console.log(` ${gray("Environment variables:")}`);
|
|
400
|
-
console.log(` AGENT_BROWSER_HEADLESS=false ${gray("# Show browser window")}`);
|
|
401
|
-
console.log(` AGENT_BROWSER_TIMEOUT=60000 ${gray("# Set timeout in ms")}`);
|
|
402
|
-
console.log(` AGENT_BROWSER_BROWSER=firefox ${gray("# Use Firefox")}`);
|
|
403
|
-
if (options.verbose) {
|
|
404
|
-
console.log(`
|
|
405
|
-
${gray("Advanced:")}`);
|
|
406
|
-
console.log(` ${gray("Config file:")} ~/.agent-browser/config.json`);
|
|
407
|
-
console.log(` ${gray("Session dir:")} ~/.agent-browser/sessions/`);
|
|
92
|
+
async function runCcrStop() {
|
|
93
|
+
ensureI18nInitialized();
|
|
94
|
+
console.log(ansis.green(`
|
|
95
|
+
\u23F9\uFE0F ${i18n.t("ccr:stoppingCcr")}`));
|
|
96
|
+
try {
|
|
97
|
+
const { stdout, stderr } = await execAsync("ccr stop");
|
|
98
|
+
if (stdout)
|
|
99
|
+
console.log(stdout);
|
|
100
|
+
if (stderr)
|
|
101
|
+
console.error(ansis.yellow(stderr));
|
|
102
|
+
console.log(ansis.green(`\u2714 ${i18n.t("ccr:ccrStopped")}`));
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error(ansis.red(`\u2716 ${i18n.t("ccr:ccrCommandFailed")}: ${error instanceof Error ? error.message : String(error)}`));
|
|
105
|
+
throw error;
|
|
408
106
|
}
|
|
409
|
-
console.log();
|
|
410
107
|
}
|
|
411
108
|
|
|
412
|
-
export {
|
|
109
|
+
export { runCcrRestart, runCcrStart, runCcrStatus, runCcrStop, runCcrUi };
|
|
@@ -2,7 +2,7 @@ import { existsSync, mkdirSync, writeFileSync } from 'node:fs';
|
|
|
2
2
|
import { homedir } from 'node:os';
|
|
3
3
|
import { join } from 'node:path';
|
|
4
4
|
import ansis from 'ansis';
|
|
5
|
-
import { i18n } from './
|
|
5
|
+
import { i18n } from './index.mjs';
|
|
6
6
|
import 'node:process';
|
|
7
7
|
import 'node:url';
|
|
8
8
|
import 'i18next';
|
|
@@ -5,8 +5,8 @@ import ansis from 'ansis';
|
|
|
5
5
|
import dayjs from 'dayjs';
|
|
6
6
|
import { join } from 'pathe';
|
|
7
7
|
import { SETTINGS_FILE, ClAUDE_CONFIG_FILE, CLAUDE_VSC_CONFIG_FILE } from './constants.mjs';
|
|
8
|
-
import { S as STATUS } from '../shared/ccjk.
|
|
9
|
-
import './
|
|
8
|
+
import { S as STATUS } from '../shared/ccjk.Br91zBIG.mjs';
|
|
9
|
+
import './index.mjs';
|
|
10
10
|
import 'node:url';
|
|
11
11
|
import 'i18next';
|
|
12
12
|
import 'i18next-fs-backend';
|
|
@@ -2,11 +2,11 @@ import process__default from 'node:process';
|
|
|
2
2
|
import ansis from 'ansis';
|
|
3
3
|
import inquirer from 'inquirer';
|
|
4
4
|
import { resolveCodeToolType, isCodeToolType, DEFAULT_CODE_TOOL_TYPE } from './constants.mjs';
|
|
5
|
-
import { ensureI18nInitialized, i18n } from './
|
|
5
|
+
import { ensureI18nInitialized, i18n } from './index.mjs';
|
|
6
6
|
import { readZcfConfig } from './ccjk-config.mjs';
|
|
7
7
|
import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { e as switchCodexProvider, l as listCodexProviders, r as readCodexConfig, f as switchToOfficialLogin, h as switchToProvider } from './codex.mjs';
|
|
9
|
+
import { a as handleGeneralError } from '../shared/ccjk.DvIrK0wz.mjs';
|
|
10
10
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
11
11
|
import 'node:os';
|
|
12
12
|
import 'pathe';
|
|
@@ -30,7 +30,6 @@ import './prompts.mjs';
|
|
|
30
30
|
import './package.mjs';
|
|
31
31
|
import '../shared/ccjk.DHbrGcgg.mjs';
|
|
32
32
|
import 'inquirer-toggle';
|
|
33
|
-
import '../shared/ccjk.CZgIwikC.mjs';
|
|
34
33
|
import 'node:child_process';
|
|
35
34
|
|
|
36
35
|
async function configSwitchCommand(options) {
|
package/dist/chunks/config.mjs
CHANGED
|
@@ -4,8 +4,8 @@ import dayjs from 'dayjs';
|
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import { join, dirname } from 'pathe';
|
|
6
6
|
import { SETTINGS_FILE, CLAUDE_VSC_CONFIG_FILE, CLAUDE_DIR, AI_OUTPUT_LANGUAGES } from './constants.mjs';
|
|
7
|
-
import { ensureI18nInitialized, i18n } from './
|
|
8
|
-
import {
|
|
7
|
+
import { ensureI18nInitialized, i18n } from './index.mjs';
|
|
8
|
+
import { s as setPrimaryApiKey, c as addCompletedOnboarding, d as deepMerge } from './claude-config.mjs';
|
|
9
9
|
import { ensureDir, exists, copyDir, writeFileAtomic, copyFile } from './fs-operations.mjs';
|
|
10
10
|
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
11
11
|
|
|
@@ -23,6 +23,55 @@ function clearModelEnv(env) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
const INVALID_PERMISSION_NAMES = /* @__PURE__ */ new Set([
|
|
27
|
+
"AllowEdit",
|
|
28
|
+
"AllowWrite",
|
|
29
|
+
"AllowRead",
|
|
30
|
+
"AllowExec",
|
|
31
|
+
"AllowCreateProcess",
|
|
32
|
+
"AllowKillProcess",
|
|
33
|
+
"AllowNetworkAccess",
|
|
34
|
+
"AllowFileSystemAccess",
|
|
35
|
+
"AllowShellAccess",
|
|
36
|
+
"AllowHttpAccess"
|
|
37
|
+
]);
|
|
38
|
+
const DANGEROUS_BASH_PATTERNS = /* @__PURE__ */ new Set([
|
|
39
|
+
"Bash(passwd *)",
|
|
40
|
+
"Bash(reboot *)",
|
|
41
|
+
"Bash(shutdown *)",
|
|
42
|
+
"Bash(halt *)",
|
|
43
|
+
"Bash(poweroff *)",
|
|
44
|
+
"Bash(init *)",
|
|
45
|
+
"Bash(telinit *)",
|
|
46
|
+
"Bash(rm *)",
|
|
47
|
+
"Bash(kill *)",
|
|
48
|
+
"Bash(pkill *)",
|
|
49
|
+
"Bash(killall *)",
|
|
50
|
+
"Bash(su *)",
|
|
51
|
+
"Bash(sudo *)",
|
|
52
|
+
"Bash(visudo *)",
|
|
53
|
+
"Bash(useradd *)",
|
|
54
|
+
"Bash(userdel *)",
|
|
55
|
+
"Bash(usermod *)",
|
|
56
|
+
"Bash(groupadd *)",
|
|
57
|
+
"Bash(groupdel *)",
|
|
58
|
+
"Bash(groupmod *)",
|
|
59
|
+
"Bash(modprobe *)",
|
|
60
|
+
"Bash(insmod *)",
|
|
61
|
+
"Bash(rmmod *)"
|
|
62
|
+
]);
|
|
63
|
+
function isValidPermission(perm) {
|
|
64
|
+
if (INVALID_PERMISSION_NAMES.has(perm)) {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
if (["mcp__.*", "mcp__*", "mcp__(*)"].includes(perm)) {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
if (/^[a-z]/.test(perm) && !perm.startsWith("mcp__")) {
|
|
71
|
+
return false;
|
|
72
|
+
}
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
26
75
|
function mergeAndCleanPermissions(templatePermissions, userPermissions) {
|
|
27
76
|
const template = templatePermissions || [];
|
|
28
77
|
const user = userPermissions || [];
|
|
@@ -31,10 +80,10 @@ function mergeAndCleanPermissions(templatePermissions, userPermissions) {
|
|
|
31
80
|
if (result.includes(perm)) {
|
|
32
81
|
continue;
|
|
33
82
|
}
|
|
34
|
-
if (
|
|
83
|
+
if (!isValidPermission(perm)) {
|
|
35
84
|
continue;
|
|
36
85
|
}
|
|
37
|
-
if (
|
|
86
|
+
if (DANGEROUS_BASH_PATTERNS.has(perm)) {
|
|
38
87
|
continue;
|
|
39
88
|
}
|
|
40
89
|
let isRedundant = false;
|
|
@@ -96,10 +145,12 @@ function getDefaultSettings() {
|
|
|
96
145
|
function configureApi(apiConfig) {
|
|
97
146
|
if (!apiConfig)
|
|
98
147
|
return null;
|
|
99
|
-
let settings = getDefaultSettings();
|
|
100
148
|
const existingSettings = readJsonConfig(SETTINGS_FILE);
|
|
149
|
+
let settings;
|
|
101
150
|
if (existingSettings) {
|
|
102
|
-
settings =
|
|
151
|
+
settings = existingSettings;
|
|
152
|
+
} else {
|
|
153
|
+
settings = getDefaultSettings();
|
|
103
154
|
}
|
|
104
155
|
if (!settings.env) {
|
|
105
156
|
settings.env = {};
|
|
@@ -128,6 +179,26 @@ function configureApi(apiConfig) {
|
|
|
128
179
|
} catch (error) {
|
|
129
180
|
console.error("Failed to set onboarding flag", error);
|
|
130
181
|
}
|
|
182
|
+
const verification = readJsonConfig(SETTINGS_FILE);
|
|
183
|
+
if (verification?.env) {
|
|
184
|
+
const envKey = apiConfig.authType === "api_key" ? "ANTHROPIC_API_KEY" : "ANTHROPIC_AUTH_TOKEN";
|
|
185
|
+
if (verification.env[envKey] !== apiConfig.key) {
|
|
186
|
+
console.error(ansis.red("\u26A0 API config write verification failed \u2014 retrying..."));
|
|
187
|
+
const freshSettings = readJsonConfig(SETTINGS_FILE) || settings;
|
|
188
|
+
if (!freshSettings.env) freshSettings.env = {};
|
|
189
|
+
if (apiConfig.authType === "api_key") {
|
|
190
|
+
freshSettings.env.ANTHROPIC_API_KEY = apiConfig.key;
|
|
191
|
+
delete freshSettings.env.ANTHROPIC_AUTH_TOKEN;
|
|
192
|
+
} else if (apiConfig.authType === "auth_token") {
|
|
193
|
+
freshSettings.env.ANTHROPIC_AUTH_TOKEN = apiConfig.key;
|
|
194
|
+
delete freshSettings.env.ANTHROPIC_API_KEY;
|
|
195
|
+
}
|
|
196
|
+
if (apiConfig.url) {
|
|
197
|
+
freshSettings.env.ANTHROPIC_BASE_URL = apiConfig.url;
|
|
198
|
+
}
|
|
199
|
+
writeJsonConfig(SETTINGS_FILE, freshSettings);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
131
202
|
return apiConfig;
|
|
132
203
|
}
|
|
133
204
|
function configureHooks(hooks) {
|
|
@@ -381,4 +452,4 @@ const config = {
|
|
|
381
452
|
updateDefaultModel: updateDefaultModel
|
|
382
453
|
};
|
|
383
454
|
|
|
384
|
-
export {
|
|
455
|
+
export { copyConfigFiles as a, backupExistingConfig as b, config as c, applyAiLanguageDirective as d, ensureClaudeDir as e, configureApi as f, getExistingApiConfig as g, getExistingModelConfig as h, updateDefaultModel as i, clearModelEnv as j, mergeAndCleanPermissions as m, promptApiConfigurationAction as p, switchToOfficialLogin as s, updateCustomModel as u };
|