ccjk 2.2.2 → 2.2.5
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/auto-updater.mjs +37 -3
- package/dist/chunks/ccjk-config.mjs +77 -13
- package/dist/chunks/ccr.mjs +8 -11
- package/dist/chunks/ccu.mjs +4 -4
- package/dist/chunks/check-updates.mjs +5 -8
- package/dist/chunks/claude-code-config-manager.mjs +8 -11
- package/dist/chunks/claude-code-incremental-manager.mjs +4 -7
- package/dist/chunks/codex.mjs +496 -17
- package/dist/chunks/commands.mjs +392 -89
- package/dist/chunks/commands2.mjs +109 -0
- package/dist/chunks/config-consolidator.mjs +2 -2
- package/dist/chunks/config-switch.mjs +5 -8
- package/dist/chunks/doctor.mjs +6 -6
- package/dist/chunks/features.mjs +654 -35
- package/dist/chunks/help.mjs +339 -0
- package/dist/chunks/index.mjs +323 -10
- package/dist/chunks/index2.mjs +3 -3
- package/dist/chunks/index3.mjs +1171 -0
- package/dist/chunks/init.mjs +22 -25
- package/dist/chunks/installer.mjs +178 -0
- package/dist/chunks/interview.mjs +6 -6
- package/dist/chunks/mcp-performance.mjs +82 -2
- package/dist/chunks/mcp.mjs +500 -0
- package/dist/chunks/menu.mjs +10 -10
- package/dist/chunks/notification.mjs +5 -5
- package/dist/chunks/onboarding.mjs +6 -6
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/platform.mjs +10 -10
- package/dist/chunks/prompts.mjs +7 -8
- package/dist/chunks/session.mjs +2 -2
- package/dist/chunks/skills-sync.mjs +2 -2
- package/dist/chunks/uninstall.mjs +4 -5
- package/dist/chunks/update.mjs +5 -8
- package/dist/chunks/upgrade-manager.mjs +2 -2
- package/dist/{shared/ccjk.Cy-RH2qV.mjs → chunks/version-checker.mjs} +373 -30
- package/dist/cli.mjs +293 -53
- package/dist/i18n/locales/en/agentBrowser.json +79 -0
- package/dist/i18n/locales/en/mcp.json +2 -4
- package/dist/i18n/locales/en/updater.json +5 -2
- package/dist/i18n/locales/zh/agentBrowser.json +79 -0
- package/dist/i18n/locales/zh-CN/common.json +1 -1
- package/dist/i18n/locales/zh-CN/mcp.json +2 -4
- package/dist/i18n/locales/zh-CN/updater.json +5 -2
- package/dist/index.d.mts +8 -584
- package/dist/index.d.ts +8 -584
- package/dist/index.mjs +10 -14
- package/dist/shared/{ccjk.DJM5aVQJ.mjs → ccjk.ByTIGCUC.mjs} +3 -3
- package/dist/shared/{ccjk.qYAnUMuy.mjs → ccjk.CGTmRqsu.mjs} +2 -3
- package/dist/shared/{ccjk.CUdzQluX.mjs → ccjk.CURU8gbR.mjs} +1 -1
- package/dist/{chunks/mcp-market.mjs → shared/ccjk.D-RZS4E2.mjs} +6 -65
- package/dist/shared/{ccjk.B7169qud.mjs → ccjk.tB4-Y4Qb.mjs} +3 -3
- package/package.json +4 -1
- package/templates/common/skills/en/agent-browser.md +258 -0
- package/templates/common/skills/zh-CN/agent-browser.md +260 -0
- package/dist/chunks/claude-config.mjs +0 -228
- package/dist/chunks/features2.mjs +0 -661
- package/dist/chunks/json-config.mjs +0 -59
- package/dist/chunks/mcp-doctor.mjs +0 -160
- package/dist/chunks/mcp-profile.mjs +0 -220
- package/dist/chunks/mcp-release.mjs +0 -138
- package/dist/chunks/shencha.mjs +0 -320
- package/dist/chunks/tools.mjs +0 -169
- package/dist/shared/ccjk.COdsoe-Y.mjs +0 -64
- package/dist/shared/ccjk.DwDtZ5cK.mjs +0 -266
- package/dist/shared/ccjk.n_AtlHzB.mjs +0 -186
package/dist/chunks/init.mjs
CHANGED
|
@@ -1,34 +1,31 @@
|
|
|
1
1
|
import * as nodeFs from 'node:fs';
|
|
2
2
|
import { existsSync, copyFileSync, mkdirSync } from 'node:fs';
|
|
3
|
-
import
|
|
3
|
+
import process__default from 'node:process';
|
|
4
4
|
import ansis from 'ansis';
|
|
5
5
|
import inquirer from 'inquirer';
|
|
6
6
|
import { version } from './package.mjs';
|
|
7
|
-
import {
|
|
8
|
-
import { m as modifyApiConfigPartially, c as configureApiCompletely, s as selectAndInstallWorkflows, a as configureOutputStyle, f as formatApiKeyDisplay, W as WORKFLOW_CONFIG_BASE } from '../shared/ccjk.
|
|
7
|
+
import { s as setPrimaryApiKey, l as addCompletedOnboarding, $ as backupExistingConfig, aa as promptApiConfigurationAction, N as runCodexFullInit, _ as ensureClaudeDir, a7 as getExistingApiConfig, a9 as switchToOfficialLogin, a0 as copyConfigFiles, a8 as applyAiLanguageDirective, a1 as configureApi, ac as selectMcpServices, h as backupMcpConfig, ad as getMcpServices, j as buildMcpServerConfig, e as readMcpConfig, i as mergeMcpServers, k as fixWindowsMcpConfig, f as writeMcpConfig, ab as MCP_SERVICE_CONFIGS } from './codex.mjs';
|
|
8
|
+
import { m as modifyApiConfigPartially, c as configureApiCompletely, s as selectAndInstallWorkflows, a as configureOutputStyle, f as formatApiKeyDisplay, W as WORKFLOW_CONFIG_BASE } from '../shared/ccjk.CGTmRqsu.mjs';
|
|
9
9
|
import { SETTINGS_FILE, DEFAULT_CODE_TOOL_TYPE, CODE_TOOL_BANNERS, API_DEFAULT_URL } from './constants.mjs';
|
|
10
10
|
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
11
11
|
import { a as displayBannerWithInfo, p as padToDisplayWidth } from '../shared/ccjk.BhKlRJ0h.mjs';
|
|
12
|
-
import { readZcfConfig, updateZcfConfig } from './ccjk-config.mjs';
|
|
12
|
+
import { r as readJsonConfig, w as writeJsonConfig, a as readZcfConfig, u as updateZcfConfig } from './ccjk-config.mjs';
|
|
13
13
|
import { exec } from 'node:child_process';
|
|
14
14
|
import { homedir } from 'node:os';
|
|
15
15
|
import { promisify } from 'node:util';
|
|
16
16
|
import dayjs from 'dayjs';
|
|
17
17
|
import { join } from 'pathe';
|
|
18
|
-
import { s as setPrimaryApiKey, c as addCompletedOnboarding, b as backupMcpConfig, a as buildMcpServerConfig, r as readMcpConfig, m as mergeMcpServers, f as fixWindowsMcpConfig, w as writeMcpConfig } from './claude-config.mjs';
|
|
19
|
-
import { P as backupExistingConfig, _ as promptApiConfigurationAction, B as runCodexFullInit, O as ensureClaudeDir, X as getExistingApiConfig, Z as switchToOfficialLogin, Q as copyConfigFiles, Y as applyAiLanguageDirective, R as configureApi, $ as selectMcpServices } from './codex.mjs';
|
|
20
|
-
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
21
18
|
import { p as promptBoolean, a as addNumbersToChoices } from '../shared/ccjk.DhBeLRzf.mjs';
|
|
22
19
|
import { updateCcr, updateClaudeCode } from './auto-updater.mjs';
|
|
23
20
|
import { wrapCommandWithSudo, isWindows, findCommandPath, getPlatform, getHomebrewCommandPaths, isTermux, getTermuxPrefix, isWSL, getWSLInfo, commandExists, getRecommendedInstallMethods } from './platform.mjs';
|
|
24
|
-
import { r as resolveCodeType } from '../shared/ccjk.
|
|
21
|
+
import { r as resolveCodeType } from '../shared/ccjk.CURU8gbR.mjs';
|
|
25
22
|
import { exists } from './fs-operations.mjs';
|
|
26
|
-
import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.
|
|
23
|
+
import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.tB4-Y4Qb.mjs';
|
|
27
24
|
import ora from 'ora';
|
|
28
25
|
import { exec as exec$1 } from 'tinyexec';
|
|
29
26
|
import { resolveAiOutputLanguage } from './prompts.mjs';
|
|
30
27
|
import { readFile } from 'node:fs/promises';
|
|
31
|
-
import {
|
|
28
|
+
import { checkClaudeCodeVersionAndPrompt } from './version-checker.mjs';
|
|
32
29
|
|
|
33
30
|
const PROVIDER_PRESETS_URL = "https://pub-0dc3e1677e894f07bbea11b17a29e032.r2.dev/providers.json";
|
|
34
31
|
async function fetchProviderPresets() {
|
|
@@ -352,7 +349,7 @@ async function restartAndCheckCcrStatus() {
|
|
|
352
349
|
console.log(ansis.gray(stdout));
|
|
353
350
|
} catch (error) {
|
|
354
351
|
console.error(ansis.red(`${i18n.t("ccr:ccrRestartFailed")}:`), error.message || error);
|
|
355
|
-
if (
|
|
352
|
+
if (process__default.env.DEBUG) {
|
|
356
353
|
console.error("Full error:", error);
|
|
357
354
|
}
|
|
358
355
|
}
|
|
@@ -409,7 +406,7 @@ async function setupCcrConfiguration() {
|
|
|
409
406
|
console.log(ansis.yellow(`${i18n.t("ccr:keepingExistingConfig")}`));
|
|
410
407
|
await configureCcrProxy(existingConfig);
|
|
411
408
|
try {
|
|
412
|
-
const { manageApiKeyApproval } = await import('./
|
|
409
|
+
const { manageApiKeyApproval } = await import('./codex.mjs').then(function (n) { return n.ag; });
|
|
413
410
|
const apiKey = existingConfig.APIKEY || "sk-ccjk-x-ccr";
|
|
414
411
|
manageApiKeyApproval(apiKey);
|
|
415
412
|
console.log(ansis.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
|
|
@@ -443,7 +440,7 @@ async function setupCcrConfiguration() {
|
|
|
443
440
|
console.error(ansis.red(i18n.t("errors:failedToSetOnboarding")), error);
|
|
444
441
|
}
|
|
445
442
|
try {
|
|
446
|
-
const { manageApiKeyApproval } = await import('./
|
|
443
|
+
const { manageApiKeyApproval } = await import('./codex.mjs').then(function (n) { return n.ag; });
|
|
447
444
|
const apiKey = config.APIKEY || "sk-ccjk-x-ccr";
|
|
448
445
|
manageApiKeyApproval(apiKey);
|
|
449
446
|
console.log(ansis.green(`\u2714 ${i18n.t("ccr:apiKeyApprovalSuccess")}`));
|
|
@@ -808,7 +805,7 @@ async function isLocalClaudeCodeInstalled() {
|
|
|
808
805
|
async function getInstallMethodFromConfig(codeType) {
|
|
809
806
|
try {
|
|
810
807
|
if (codeType === "claude-code") {
|
|
811
|
-
const { readMcpConfig } = await import('./
|
|
808
|
+
const { readMcpConfig } = await import('./codex.mjs').then(function (n) { return n.ag; });
|
|
812
809
|
const config = readMcpConfig();
|
|
813
810
|
return config?.installMethod || null;
|
|
814
811
|
}
|
|
@@ -922,7 +919,7 @@ async function uninstallCodeTool(codeType) {
|
|
|
922
919
|
async function setInstallMethod(method, codeType = "claude-code") {
|
|
923
920
|
try {
|
|
924
921
|
if (codeType === "claude-code") {
|
|
925
|
-
const { readMcpConfig, writeMcpConfig } = await import('./
|
|
922
|
+
const { readMcpConfig, writeMcpConfig } = await import('./codex.mjs').then(function (n) { return n.ag; });
|
|
926
923
|
let config = readMcpConfig();
|
|
927
924
|
if (!config) {
|
|
928
925
|
config = { mcpServers: {} };
|
|
@@ -1187,7 +1184,7 @@ async function verifyInstallation(codeType) {
|
|
|
1187
1184
|
for (const path of linuxPaths) {
|
|
1188
1185
|
if (exists(path)) {
|
|
1189
1186
|
const version = await detectInstalledVersion(codeType);
|
|
1190
|
-
const needsPathUpdate = path.includes(".local/bin") && !
|
|
1187
|
+
const needsPathUpdate = path.includes(".local/bin") && !process__default.env.PATH?.includes(".local/bin");
|
|
1191
1188
|
return {
|
|
1192
1189
|
success: true,
|
|
1193
1190
|
commandPath: path,
|
|
@@ -1779,7 +1776,7 @@ async function init(options = {}) {
|
|
|
1779
1776
|
});
|
|
1780
1777
|
if (!apiChoice) {
|
|
1781
1778
|
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
1782
|
-
|
|
1779
|
+
process__default.exit(0);
|
|
1783
1780
|
}
|
|
1784
1781
|
return await configureApiCompletely(apiChoice);
|
|
1785
1782
|
}
|
|
@@ -1816,7 +1813,7 @@ async function init(options = {}) {
|
|
|
1816
1813
|
}
|
|
1817
1814
|
if (codeToolType === "codex") {
|
|
1818
1815
|
if (options.skipPrompt)
|
|
1819
|
-
|
|
1816
|
+
process__default.env.CCJK_CODEX_SKIP_PROMPT_SINGLE_BACKUP = "true";
|
|
1820
1817
|
const hasApiConfigs = Boolean(options.apiConfigs || options.apiConfigsFile);
|
|
1821
1818
|
const apiMode = hasApiConfigs ? "skip" : options.apiType === "auth_token" ? "official" : options.apiType === "api_key" ? "custom" : options.apiType === "skip" ? "skip" : options.skipPrompt ? "skip" : void 0;
|
|
1822
1819
|
const customApiConfig = !hasApiConfigs && options.apiType === "api_key" && options.apiKey ? {
|
|
@@ -1911,7 +1908,7 @@ async function init(options = {}) {
|
|
|
1911
1908
|
});
|
|
1912
1909
|
if (!userAction) {
|
|
1913
1910
|
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
1914
|
-
|
|
1911
|
+
process__default.exit(0);
|
|
1915
1912
|
}
|
|
1916
1913
|
action = userAction;
|
|
1917
1914
|
if (action === "skip") {
|
|
@@ -2021,7 +2018,7 @@ async function init(options = {}) {
|
|
|
2021
2018
|
break;
|
|
2022
2019
|
default:
|
|
2023
2020
|
console.log(ansis.yellow(i18n.t("common:cancelled")));
|
|
2024
|
-
|
|
2021
|
+
process__default.exit(0);
|
|
2025
2022
|
}
|
|
2026
2023
|
}
|
|
2027
2024
|
}
|
|
@@ -2072,7 +2069,7 @@ async function init(options = {}) {
|
|
|
2072
2069
|
const hasModelParams = options.apiModel || options.apiHaikuModel || options.apiSonnetModel || options.apiOpusModel;
|
|
2073
2070
|
if (hasModelParams && action !== "docs-only" && codeToolType === "claude-code") {
|
|
2074
2071
|
if (options.skipPrompt) {
|
|
2075
|
-
const { updateCustomModel } = await import('./codex.mjs').then(function (n) { return n.
|
|
2072
|
+
const { updateCustomModel } = await import('./codex.mjs').then(function (n) { return n.ah; });
|
|
2076
2073
|
updateCustomModel(
|
|
2077
2074
|
options.apiModel || void 0,
|
|
2078
2075
|
options.apiHaikuModel || void 0,
|
|
@@ -2112,7 +2109,7 @@ async function init(options = {}) {
|
|
|
2112
2109
|
} else {
|
|
2113
2110
|
selectedServices = await selectMcpServices();
|
|
2114
2111
|
if (selectedServices === void 0) {
|
|
2115
|
-
|
|
2112
|
+
process__default.exit(0);
|
|
2116
2113
|
}
|
|
2117
2114
|
}
|
|
2118
2115
|
if (selectedServices.length > 0) {
|
|
@@ -2163,7 +2160,7 @@ async function init(options = {}) {
|
|
|
2163
2160
|
try {
|
|
2164
2161
|
writeMcpConfig(mergedConfig);
|
|
2165
2162
|
console.log(ansis.green(`\u2714 ${i18n.t("mcp:mcpConfigSuccess")}`));
|
|
2166
|
-
const { checkMcpPerformance, formatPerformanceWarning } = await import('./mcp-performance.mjs');
|
|
2163
|
+
const { checkMcpPerformance, formatPerformanceWarning } = await import('./mcp-performance.mjs').then(function (n) { return n.e; });
|
|
2167
2164
|
const serviceCount = Object.keys(newServers).length;
|
|
2168
2165
|
const perfWarning = checkMcpPerformance(serviceCount);
|
|
2169
2166
|
if (perfWarning) {
|
|
@@ -2345,7 +2342,7 @@ async function handleClaudeCodeConfigs(configs) {
|
|
|
2345
2342
|
await ClaudeCodeConfigManager.syncCcrProfile();
|
|
2346
2343
|
}
|
|
2347
2344
|
async function handleCodexConfigs(configs) {
|
|
2348
|
-
const { addProviderToExisting } = await import('./index.mjs').then(function (n) { return n.
|
|
2345
|
+
const { addProviderToExisting } = await import('./index.mjs').then(function (n) { return n.aF; });
|
|
2349
2346
|
const addedProviderIds = [];
|
|
2350
2347
|
for (const config of configs) {
|
|
2351
2348
|
try {
|
|
@@ -2366,7 +2363,7 @@ async function handleCodexConfigs(configs) {
|
|
|
2366
2363
|
}
|
|
2367
2364
|
const defaultConfig = configs.find((c) => c.default);
|
|
2368
2365
|
if (defaultConfig) {
|
|
2369
|
-
const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.
|
|
2366
|
+
const { switchCodexProvider } = await import('./codex.mjs').then(function (n) { return n.ai; });
|
|
2370
2367
|
const displayName = defaultConfig.name || defaultConfig.provider || "custom";
|
|
2371
2368
|
const providerId = displayName.toLowerCase().replace(/[^a-z0-9]/g, "-");
|
|
2372
2369
|
if (addedProviderIds.includes(providerId)) {
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
|
|
6
|
+
const { bold, cyan, gray, green, red, yellow } = chalk;
|
|
7
|
+
const INSTALL_DIR = join(homedir(), ".agent-browser");
|
|
8
|
+
const BIN_PATH = join(INSTALL_DIR, "bin", "agent-browser");
|
|
9
|
+
function getInstallPath() {
|
|
10
|
+
return INSTALL_DIR;
|
|
11
|
+
}
|
|
12
|
+
async function checkAgentBrowserInstalled() {
|
|
13
|
+
try {
|
|
14
|
+
const { execSync } = await import('node:child_process');
|
|
15
|
+
execSync("which agent-browser 2>/dev/null || where agent-browser 2>nul", {
|
|
16
|
+
encoding: "utf-8",
|
|
17
|
+
stdio: "pipe"
|
|
18
|
+
});
|
|
19
|
+
return true;
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
if (existsSync(BIN_PATH)) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const { execSync } = await import('node:child_process');
|
|
27
|
+
execSync("npx --yes @anthropic-ai/agent-browser --version 2>/dev/null", {
|
|
28
|
+
encoding: "utf-8",
|
|
29
|
+
stdio: "pipe",
|
|
30
|
+
timeout: 1e4
|
|
31
|
+
});
|
|
32
|
+
return true;
|
|
33
|
+
} catch {
|
|
34
|
+
}
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
async function installAgentBrowser(options = {}) {
|
|
38
|
+
console.log(`
|
|
39
|
+
${bold(cyan("Installing Agent Browser..."))}
|
|
40
|
+
`);
|
|
41
|
+
if (!options.force) {
|
|
42
|
+
const installed = await checkAgentBrowserInstalled();
|
|
43
|
+
if (installed) {
|
|
44
|
+
console.log(`${green("\u2713")} Agent Browser is already installed`);
|
|
45
|
+
console.log(` ${gray("Use --force to reinstall")}
|
|
46
|
+
`);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const { execSync } = await import('node:child_process');
|
|
51
|
+
const { mkdirSync } = await import('node:fs');
|
|
52
|
+
try {
|
|
53
|
+
mkdirSync(INSTALL_DIR, { recursive: true });
|
|
54
|
+
console.log(`${cyan("Step 1/3:")} Installing via npm...`);
|
|
55
|
+
try {
|
|
56
|
+
execSync("npm install -g @anthropic-ai/agent-browser 2>&1", {
|
|
57
|
+
encoding: "utf-8",
|
|
58
|
+
stdio: options.verbose ? "inherit" : "pipe"
|
|
59
|
+
});
|
|
60
|
+
console.log(` ${green("\u2713")} npm package installed globally`);
|
|
61
|
+
} catch {
|
|
62
|
+
console.log(` ${yellow("!")} Global install failed, trying local install...`);
|
|
63
|
+
execSync(`npm install @anthropic-ai/agent-browser --prefix "${INSTALL_DIR}" 2>&1`, {
|
|
64
|
+
encoding: "utf-8",
|
|
65
|
+
stdio: options.verbose ? "inherit" : "pipe"
|
|
66
|
+
});
|
|
67
|
+
console.log(` ${green("\u2713")} npm package installed locally`);
|
|
68
|
+
}
|
|
69
|
+
console.log(`
|
|
70
|
+
${cyan("Step 2/3:")} Installing Playwright browsers...`);
|
|
71
|
+
try {
|
|
72
|
+
execSync("npx playwright install chromium 2>&1", {
|
|
73
|
+
encoding: "utf-8",
|
|
74
|
+
stdio: options.verbose ? "inherit" : "pipe",
|
|
75
|
+
timeout: 3e5
|
|
76
|
+
// 5 minutes
|
|
77
|
+
});
|
|
78
|
+
console.log(` ${green("\u2713")} Chromium browser installed`);
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.log(` ${yellow("!")} Playwright browser installation may have issues`);
|
|
81
|
+
if (options.verbose && error instanceof Error) {
|
|
82
|
+
console.log(` ${gray(error.message)}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
console.log(`
|
|
86
|
+
${cyan("Step 3/3:")} Verifying installation...`);
|
|
87
|
+
const verified = await checkAgentBrowserInstalled();
|
|
88
|
+
if (verified) {
|
|
89
|
+
console.log(` ${green("\u2713")} Installation verified`);
|
|
90
|
+
console.log(`
|
|
91
|
+
${green("\u2713")} ${bold("Agent Browser installed successfully!")}
|
|
92
|
+
`);
|
|
93
|
+
showQuickStart();
|
|
94
|
+
return true;
|
|
95
|
+
} else {
|
|
96
|
+
console.log(` ${red("\u2717")} Verification failed`);
|
|
97
|
+
console.log(`
|
|
98
|
+
${yellow("Try manual installation:")}`);
|
|
99
|
+
console.log(` npm install -g @anthropic-ai/agent-browser`);
|
|
100
|
+
console.log(` npx playwright install chromium
|
|
101
|
+
`);
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
} catch (error) {
|
|
105
|
+
console.error(`
|
|
106
|
+
${red("\u2717")} Installation failed`);
|
|
107
|
+
if (error instanceof Error) {
|
|
108
|
+
console.error(` ${gray("Error:")} ${error.message}`);
|
|
109
|
+
}
|
|
110
|
+
console.log(`
|
|
111
|
+
${yellow("Manual installation:")}`);
|
|
112
|
+
console.log(` ${cyan("1.")} npm install -g @anthropic-ai/agent-browser`);
|
|
113
|
+
console.log(` ${cyan("2.")} npx playwright install chromium`);
|
|
114
|
+
console.log(` ${cyan("3.")} agent-browser --version
|
|
115
|
+
`);
|
|
116
|
+
return false;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
async function uninstallAgentBrowser(options = {}) {
|
|
120
|
+
console.log(`
|
|
121
|
+
${bold(cyan("Uninstalling Agent Browser..."))}
|
|
122
|
+
`);
|
|
123
|
+
const { execSync } = await import('node:child_process');
|
|
124
|
+
const { rmSync } = await import('node:fs');
|
|
125
|
+
try {
|
|
126
|
+
console.log(`${cyan("Step 1/2:")} Removing npm package...`);
|
|
127
|
+
try {
|
|
128
|
+
execSync("npm uninstall -g @anthropic-ai/agent-browser 2>&1", {
|
|
129
|
+
encoding: "utf-8",
|
|
130
|
+
stdio: options.verbose ? "inherit" : "pipe"
|
|
131
|
+
});
|
|
132
|
+
console.log(` ${green("\u2713")} Global package removed`);
|
|
133
|
+
} catch {
|
|
134
|
+
console.log(` ${gray("-")} No global package found`);
|
|
135
|
+
}
|
|
136
|
+
console.log(`
|
|
137
|
+
${cyan("Step 2/2:")} Cleaning up local files...`);
|
|
138
|
+
if (existsSync(INSTALL_DIR)) {
|
|
139
|
+
rmSync(INSTALL_DIR, { recursive: true, force: true });
|
|
140
|
+
console.log(` ${green("\u2713")} Local files removed`);
|
|
141
|
+
} else {
|
|
142
|
+
console.log(` ${gray("-")} No local files found`);
|
|
143
|
+
}
|
|
144
|
+
console.log(`
|
|
145
|
+
${green("\u2713")} ${bold("Agent Browser uninstalled successfully!")}
|
|
146
|
+
`);
|
|
147
|
+
return true;
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error(`
|
|
150
|
+
${red("\u2717")} Uninstallation failed`);
|
|
151
|
+
if (error instanceof Error) {
|
|
152
|
+
console.error(` ${gray("Error:")} ${error.message}`);
|
|
153
|
+
}
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
function showQuickStart() {
|
|
158
|
+
console.log(`${yellow("Quick Start:")}`);
|
|
159
|
+
console.log(` ${gray("# Open a webpage")}`);
|
|
160
|
+
console.log(` ${cyan("agent-browser open https://example.com")}`);
|
|
161
|
+
console.log();
|
|
162
|
+
console.log(` ${gray("# Get interactive elements")}`);
|
|
163
|
+
console.log(` ${cyan("agent-browser snapshot -i")}`);
|
|
164
|
+
console.log();
|
|
165
|
+
console.log(` ${gray("# Click an element by ref")}`);
|
|
166
|
+
console.log(` ${cyan("agent-browser click @e1")}`);
|
|
167
|
+
console.log();
|
|
168
|
+
console.log(` ${gray("# Take a screenshot")}`);
|
|
169
|
+
console.log(` ${cyan("agent-browser screenshot page.png")}`);
|
|
170
|
+
console.log();
|
|
171
|
+
console.log(` ${gray("# Close the browser")}`);
|
|
172
|
+
console.log(` ${cyan("agent-browser close")}`);
|
|
173
|
+
console.log();
|
|
174
|
+
console.log(`${gray("For full documentation, run")} ${cyan("/browser")} ${gray("in Claude Code")}`);
|
|
175
|
+
console.log();
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export { checkAgentBrowserInstalled, getInstallPath, installAgentBrowser, uninstallAgentBrowser };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { writeFile, mkdir, readFile } from 'node:fs/promises';
|
|
3
3
|
import { resolve, dirname, join } from 'node:path';
|
|
4
|
-
import
|
|
4
|
+
import process__default from 'node:process';
|
|
5
5
|
import ansis from 'ansis';
|
|
6
6
|
import inquirer from 'inquirer';
|
|
7
7
|
import { i18n } from './index2.mjs';
|
|
8
|
-
import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.
|
|
8
|
+
import { h as handleExitPromptError, a as handleGeneralError } from '../shared/ccjk.tB4-Y4Qb.mjs';
|
|
9
9
|
import { randomUUID } from 'node:crypto';
|
|
10
10
|
import 'node:url';
|
|
11
11
|
import 'i18next';
|
|
@@ -2322,7 +2322,7 @@ function displayInterviewBanner(compact = false) {
|
|
|
2322
2322
|
}
|
|
2323
2323
|
async function detectProjectType() {
|
|
2324
2324
|
const { existsSync: existsSync2 } = await import('node:fs');
|
|
2325
|
-
const cwd =
|
|
2325
|
+
const cwd = process__default.cwd();
|
|
2326
2326
|
const indicators = {
|
|
2327
2327
|
saas: ["prisma", "drizzle", "stripe", "auth", "subscription"].some(
|
|
2328
2328
|
(dir) => existsSync2(join(cwd, dir)) || existsSync2(join(cwd, "src", dir))
|
|
@@ -2676,7 +2676,7 @@ async function interview(options = {}) {
|
|
|
2676
2676
|
INTERVIEW_TEMPLATES.forEach((t) => console.log(ansis.gray(` - ${t.id}`)));
|
|
2677
2677
|
return;
|
|
2678
2678
|
}
|
|
2679
|
-
const absoluteSpecFile = resolve(
|
|
2679
|
+
const absoluteSpecFile = resolve(process__default.cwd(), specFile);
|
|
2680
2680
|
console.log("");
|
|
2681
2681
|
console.log(ansis.gray("\u2500".repeat(50)));
|
|
2682
2682
|
console.log(` ${ansis.gray("Template:")} ${ansis.white(template.name[lang])}`);
|
|
@@ -2758,7 +2758,7 @@ async function resumeInterview(sessionFile, options = {}) {
|
|
|
2758
2758
|
const { readdir, stat } = await import('node:fs/promises');
|
|
2759
2759
|
const { homedir } = await import('node:os');
|
|
2760
2760
|
const searchDirs = [
|
|
2761
|
-
|
|
2761
|
+
process__default.cwd(),
|
|
2762
2762
|
join(homedir(), ".ccjk", "sessions")
|
|
2763
2763
|
];
|
|
2764
2764
|
const sessions = [];
|
|
@@ -2884,7 +2884,7 @@ async function listInterviewSessions() {
|
|
|
2884
2884
|
console.log(ansis.cyan.bold(" Saved Interview Sessions:"));
|
|
2885
2885
|
console.log("");
|
|
2886
2886
|
const searchDirs = [
|
|
2887
|
-
|
|
2887
|
+
process__default.cwd(),
|
|
2888
2888
|
join(homedir(), ".ccjk", "sessions")
|
|
2889
2889
|
];
|
|
2890
2890
|
let foundAny = false;
|
|
@@ -1,4 +1,75 @@
|
|
|
1
|
-
|
|
1
|
+
const MCP_TIER_DEFAULTS = {
|
|
2
|
+
core: {
|
|
3
|
+
tier: "core",
|
|
4
|
+
autoStart: true,
|
|
5
|
+
idleTimeout: void 0,
|
|
6
|
+
// Never timeout
|
|
7
|
+
description: "Essential services, always available"
|
|
8
|
+
},
|
|
9
|
+
ondemand: {
|
|
10
|
+
tier: "ondemand",
|
|
11
|
+
autoStart: false,
|
|
12
|
+
idleTimeout: 300,
|
|
13
|
+
// 5 minutes
|
|
14
|
+
description: "Loaded when needed, auto-released after idle"
|
|
15
|
+
},
|
|
16
|
+
scenario: {
|
|
17
|
+
tier: "scenario",
|
|
18
|
+
autoStart: false,
|
|
19
|
+
idleTimeout: 600,
|
|
20
|
+
// 10 minutes
|
|
21
|
+
description: "Loaded for specific scenarios"
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const MCP_SERVICE_TIERS = {
|
|
25
|
+
// Core services - high frequency, essential
|
|
26
|
+
"context7": "core",
|
|
27
|
+
"open-websearch": "core",
|
|
28
|
+
// On-demand services - medium frequency
|
|
29
|
+
"mcp-deepwiki": "ondemand",
|
|
30
|
+
"Playwright": "ondemand",
|
|
31
|
+
"puppeteer": "ondemand",
|
|
32
|
+
"filesystem": "ondemand",
|
|
33
|
+
"memory": "ondemand",
|
|
34
|
+
"sequential-thinking": "ondemand",
|
|
35
|
+
"fetch": "ondemand",
|
|
36
|
+
// Scenario services - low frequency, specific use cases
|
|
37
|
+
"sqlite": "scenario",
|
|
38
|
+
"spec-workflow": "scenario",
|
|
39
|
+
"serena": "scenario"
|
|
40
|
+
};
|
|
41
|
+
function getMcpTierConfig(serviceId) {
|
|
42
|
+
const tier = MCP_SERVICE_TIERS[serviceId] || "ondemand";
|
|
43
|
+
return MCP_TIER_DEFAULTS[tier];
|
|
44
|
+
}
|
|
45
|
+
function getServicesByTier(tier) {
|
|
46
|
+
return Object.entries(MCP_SERVICE_TIERS).filter(([_, t]) => t === tier).map(([id]) => id);
|
|
47
|
+
}
|
|
48
|
+
function isCoreService(serviceId) {
|
|
49
|
+
return MCP_SERVICE_TIERS[serviceId] === "core";
|
|
50
|
+
}
|
|
51
|
+
const MCP_PERFORMANCE_THRESHOLDS = {
|
|
52
|
+
/** Warning threshold for number of services */
|
|
53
|
+
warningCount: 5,
|
|
54
|
+
/** Critical threshold for number of services */
|
|
55
|
+
criticalCount: 8,
|
|
56
|
+
/** Maximum recommended services */
|
|
57
|
+
maxRecommended: 6,
|
|
58
|
+
/** Estimated memory per service (MB) */
|
|
59
|
+
estimatedMemoryPerService: 50,
|
|
60
|
+
/** Estimated CPU overhead per service (%) */
|
|
61
|
+
estimatedCpuPerService: 5
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const mcpTiers = {
|
|
65
|
+
__proto__: null,
|
|
66
|
+
MCP_PERFORMANCE_THRESHOLDS: MCP_PERFORMANCE_THRESHOLDS,
|
|
67
|
+
MCP_SERVICE_TIERS: MCP_SERVICE_TIERS,
|
|
68
|
+
MCP_TIER_DEFAULTS: MCP_TIER_DEFAULTS,
|
|
69
|
+
getMcpTierConfig: getMcpTierConfig,
|
|
70
|
+
getServicesByTier: getServicesByTier,
|
|
71
|
+
isCoreService: isCoreService
|
|
72
|
+
};
|
|
2
73
|
|
|
3
74
|
function checkMcpPerformance(serviceCount) {
|
|
4
75
|
const { warningCount, criticalCount, estimatedMemoryPerService, estimatedCpuPerService } = MCP_PERFORMANCE_THRESHOLDS;
|
|
@@ -107,4 +178,13 @@ function formatPerformanceWarning(warning, lang = "en") {
|
|
|
107
178
|
return lines.join("\n");
|
|
108
179
|
}
|
|
109
180
|
|
|
110
|
-
|
|
181
|
+
const mcpPerformance = {
|
|
182
|
+
__proto__: null,
|
|
183
|
+
analyzeServices: analyzeServices,
|
|
184
|
+
calculateResourceUsage: calculateResourceUsage,
|
|
185
|
+
checkMcpPerformance: checkMcpPerformance,
|
|
186
|
+
formatPerformanceWarning: formatPerformanceWarning,
|
|
187
|
+
getOptimizationSuggestions: getOptimizationSuggestions
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
export { MCP_SERVICE_TIERS as M, calculateResourceUsage as a, getOptimizationSuggestions as b, checkMcpPerformance as c, getMcpTierConfig as d, mcpPerformance as e, formatPerformanceWarning as f, getServicesByTier as g, isCoreService as i, mcpTiers as m };
|