ccjk 10.1.0 → 10.3.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/README.md +28 -0
- package/dist/chunks/agent-teams.mjs +1 -1
- 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/{shared/ccjk.Br91zBIG.mjs → chunks/banner.mjs} +52 -3
- package/dist/chunks/boost.mjs +2 -2
- 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 +11 -10
- package/dist/chunks/ccu.mjs +1 -1
- package/dist/chunks/check-updates.mjs +4 -3
- package/dist/chunks/claude-code-config-manager.mjs +8 -7
- package/dist/chunks/claude-code-incremental-manager.mjs +3 -2
- package/dist/chunks/claude-config.mjs +3 -3
- package/dist/chunks/claude-wrapper.mjs +2 -2
- package/dist/chunks/codex-config-switch.mjs +3 -2
- package/dist/chunks/codex-provider-manager.mjs +3 -2
- package/dist/chunks/codex-uninstaller.mjs +2 -2
- package/dist/chunks/codex.mjs +5 -5
- package/dist/chunks/commands.mjs +88 -391
- package/dist/chunks/commands2.mjs +391 -88
- package/dist/chunks/completion.mjs +1 -1
- package/dist/chunks/config-consolidator.mjs +2 -2
- package/dist/chunks/config-switch.mjs +4 -3
- package/dist/chunks/config.mjs +6 -98
- package/dist/chunks/config2.mjs +411 -400
- package/dist/chunks/config3.mjs +401 -410
- package/dist/chunks/constants.mjs +1 -1
- package/dist/chunks/context.mjs +283 -1
- package/dist/chunks/dashboard.mjs +365 -0
- package/dist/chunks/doctor.mjs +4 -4
- package/dist/chunks/features.mjs +12 -11
- package/dist/chunks/fs-operations.mjs +1 -1
- package/dist/chunks/health-alerts.mjs +304 -0
- package/dist/chunks/health-check.mjs +532 -0
- package/dist/chunks/index.mjs +10 -177
- package/dist/chunks/index2.mjs +168 -1162
- package/dist/chunks/index3.mjs +1076 -910
- package/dist/chunks/index4.mjs +947 -137
- package/dist/chunks/index5.mjs +167 -635
- package/dist/chunks/index6.mjs +663 -0
- package/dist/chunks/init.mjs +19 -19
- package/dist/chunks/installer.mjs +649 -147
- package/dist/chunks/installer2.mjs +147 -649
- package/dist/chunks/interview.mjs +2 -2
- package/dist/chunks/marketplace.mjs +1 -1
- package/dist/chunks/mcp.mjs +5 -4
- package/dist/chunks/menu.mjs +22 -9
- package/dist/chunks/metrics-display.mjs +152 -0
- package/dist/chunks/migrator.mjs +1 -1
- 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 +1 -1
- package/dist/chunks/permission-manager.mjs +2 -2
- package/dist/chunks/permissions.mjs +1 -1
- package/dist/chunks/persistence-manager.mjs +781 -0
- package/dist/chunks/persistence.mjs +667 -0
- 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-actions.mjs +321 -0
- package/dist/chunks/quick-provider.mjs +2 -0
- package/dist/chunks/quick-setup.mjs +9 -8
- package/dist/chunks/silent-updater.mjs +1 -1
- package/dist/chunks/simple-config.mjs +3 -8
- 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/slash-commands.mjs +208 -0
- package/dist/chunks/smart-defaults.mjs +1 -1
- package/dist/chunks/startup.mjs +1 -1
- package/dist/chunks/stats.mjs +1 -1
- package/dist/chunks/status.mjs +31 -2
- package/dist/chunks/team.mjs +1 -1
- package/dist/chunks/thinking.mjs +2 -2
- package/dist/chunks/uninstall.mjs +5 -5
- package/dist/chunks/update.mjs +8 -7
- 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/zero-config.mjs +359 -0
- package/dist/cli.mjs +212 -21
- package/dist/i18n/locales/en/cli.json +14 -1
- package/dist/i18n/locales/en/common.json +27 -0
- package/dist/i18n/locales/en/configuration.json +33 -0
- package/dist/i18n/locales/en/context.json +54 -1
- package/dist/i18n/locales/en/dashboard.json +78 -0
- package/dist/i18n/locales/en/persistence.json +127 -0
- package/dist/i18n/locales/en/quick-actions.json +78 -0
- package/dist/i18n/locales/zh-CN/cli.json +14 -1
- package/dist/i18n/locales/zh-CN/common.json +27 -0
- package/dist/i18n/locales/zh-CN/configuration.json +33 -0
- package/dist/i18n/locales/zh-CN/context.json +54 -1
- package/dist/i18n/locales/zh-CN/dashboard.json +78 -0
- package/dist/i18n/locales/zh-CN/persistence.json +127 -0
- package/dist/i18n/locales/zh-CN/quick-actions.json +78 -0
- package/dist/index.mjs +3 -2
- package/dist/shared/{ccjk.DE91nClQ.mjs → ccjk.BKoi8-Hy.mjs} +1 -1
- package/dist/shared/ccjk.BiCrMV5O.mjs +94 -0
- package/dist/shared/{ccjk.Dpw86UX0.mjs → ccjk.CxtuJxaS.mjs} +1 -1
- package/dist/shared/{ccjk.ClzTOz9n.mjs → ccjk.DB2UYcq0.mjs} +5 -5
- package/dist/shared/{ccjk.CmsW23FN.mjs → ccjk.DVBW2wxp.mjs} +4 -3
- package/dist/shared/{ccjk.Bndhan7G.mjs → ccjk.DfwJOEok.mjs} +1 -1
- package/dist/shared/{ccjk.DvIrK0wz.mjs → ccjk.DrMygfCF.mjs} +1 -1
- package/package.json +19 -19
package/dist/chunks/commands.mjs
CHANGED
|
@@ -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 './index2.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 };
|