ccjk 10.2.0 → 11.1.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/auto-init.mjs +7585 -0
- package/dist/chunks/ccr.mjs +2 -1
- package/dist/chunks/check-updates.mjs +1 -0
- package/dist/chunks/claude-code-config-manager.mjs +1 -0
- package/dist/chunks/claude-code-incremental-manager.mjs +2 -1
- package/dist/chunks/codex-config-switch.mjs +1 -0
- package/dist/chunks/codex-provider-manager.mjs +1 -0
- package/dist/chunks/config-switch.mjs +1 -0
- package/dist/chunks/config.mjs +2 -94
- package/dist/chunks/config2.mjs +1 -0
- package/dist/chunks/config3.mjs +1 -0
- package/dist/chunks/evolution.mjs +383 -0
- package/dist/chunks/features.mjs +2 -1
- package/dist/chunks/init.mjs +1 -1
- package/dist/chunks/mcp.mjs +1 -0
- package/dist/chunks/menu.mjs +7 -1
- package/dist/chunks/package.mjs +1 -1
- package/dist/chunks/quick-provider.mjs +3 -0
- package/dist/chunks/quick-setup.mjs +2 -1
- package/dist/chunks/remote.mjs +166 -0
- package/dist/chunks/simple-config.mjs +1 -6
- package/dist/chunks/update.mjs +2 -1
- package/dist/chunks/zero-config.mjs +359 -0
- package/dist/cli.mjs +107 -0
- package/dist/i18n/locales/en/configuration.json +33 -0
- package/dist/i18n/locales/en/evolution.json +54 -0
- package/dist/i18n/locales/en/remote.json +39 -0
- package/dist/i18n/locales/zh-CN/configuration.json +33 -0
- package/dist/i18n/locales/zh-CN/evolution.json +54 -0
- package/dist/i18n/locales/zh-CN/remote.json +39 -0
- package/dist/index.mjs +3 -73
- package/dist/shared/ccjk.BiCrMV5O.mjs +94 -0
- package/dist/shared/ccjk.Cu_R2MbQ.mjs +75 -0
- package/dist/shared/{ccjk.IbImMVWM.mjs → ccjk.DVBW2wxp.mjs} +2 -1
- package/package.json +7 -1
package/dist/chunks/ccr.mjs
CHANGED
|
@@ -27,6 +27,7 @@ import './json-config.mjs';
|
|
|
27
27
|
import './config.mjs';
|
|
28
28
|
import './claude-config.mjs';
|
|
29
29
|
import './platform.mjs';
|
|
30
|
+
import '../shared/ccjk.BiCrMV5O.mjs';
|
|
30
31
|
import '../shared/ccjk.BFQ7yr5S.mjs';
|
|
31
32
|
import './prompts.mjs';
|
|
32
33
|
import '../shared/ccjk.DHbrGcgg.mjs';
|
|
@@ -39,7 +40,7 @@ import './features.mjs';
|
|
|
39
40
|
import './config2.mjs';
|
|
40
41
|
import 'node:util';
|
|
41
42
|
import './init.mjs';
|
|
42
|
-
import '../shared/ccjk.
|
|
43
|
+
import '../shared/ccjk.DVBW2wxp.mjs';
|
|
43
44
|
import './auto-updater.mjs';
|
|
44
45
|
import './version-checker.mjs';
|
|
45
46
|
import 'node:path';
|
|
@@ -4,7 +4,7 @@ import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
|
4
4
|
import { ClaudeCodeConfigManager } from './claude-code-config-manager.mjs';
|
|
5
5
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
6
6
|
import { p as promptBoolean } from '../shared/ccjk.DHbrGcgg.mjs';
|
|
7
|
-
import { v as validateApiKey } from '../shared/ccjk.
|
|
7
|
+
import { v as validateApiKey } from '../shared/ccjk.DVBW2wxp.mjs';
|
|
8
8
|
import 'node:fs';
|
|
9
9
|
import 'node:process';
|
|
10
10
|
import 'node:url';
|
|
@@ -24,6 +24,7 @@ import './config.mjs';
|
|
|
24
24
|
import './claude-config.mjs';
|
|
25
25
|
import './platform.mjs';
|
|
26
26
|
import 'tinyexec';
|
|
27
|
+
import '../shared/ccjk.BiCrMV5O.mjs';
|
|
27
28
|
import 'inquirer-toggle';
|
|
28
29
|
|
|
29
30
|
function getAuthTypeLabel(authType) {
|
package/dist/chunks/config.mjs
CHANGED
|
@@ -8,6 +8,7 @@ import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
|
8
8
|
import { s as setPrimaryApiKey, c as addCompletedOnboarding, d as deepMerge } from './claude-config.mjs';
|
|
9
9
|
import { exists, ensureDir, copyDir, writeFileAtomic, copyFile } from './fs-operations.mjs';
|
|
10
10
|
import { readJsonConfig, writeJsonConfig } from './json-config.mjs';
|
|
11
|
+
import { m as mergeAndCleanPermissions } from '../shared/ccjk.BiCrMV5O.mjs';
|
|
11
12
|
|
|
12
13
|
const MODEL_ENV_KEYS = [
|
|
13
14
|
"ANTHROPIC_MODEL",
|
|
@@ -23,99 +24,6 @@ function clearModelEnv(env) {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
|
|
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
|
-
}
|
|
75
|
-
function isCoveredByWildcard(perm, wildcardPerm) {
|
|
76
|
-
const wildcardMatch = wildcardPerm.match(/^(\w+)\((.+)\)$/);
|
|
77
|
-
if (!wildcardMatch) return false;
|
|
78
|
-
const [, tool, wildcardArg] = wildcardMatch;
|
|
79
|
-
if (!wildcardArg.includes("*")) return false;
|
|
80
|
-
const permMatch = perm.match(/^(\w+)\((.+)\)$/);
|
|
81
|
-
if (!permMatch) return false;
|
|
82
|
-
const [, permTool, permArg] = permMatch;
|
|
83
|
-
if (tool !== permTool) return false;
|
|
84
|
-
const regexStr = wildcardArg.replace(/[.+?^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".+");
|
|
85
|
-
return new RegExp(`^${regexStr}$`).test(permArg);
|
|
86
|
-
}
|
|
87
|
-
function mergeAndCleanPermissions(templatePermissions, userPermissions) {
|
|
88
|
-
const template = templatePermissions || [];
|
|
89
|
-
const user = userPermissions || [];
|
|
90
|
-
const result = [...template];
|
|
91
|
-
for (const perm of user) {
|
|
92
|
-
if (result.includes(perm)) {
|
|
93
|
-
continue;
|
|
94
|
-
}
|
|
95
|
-
if (!isValidPermission(perm)) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
if (DANGEROUS_BASH_PATTERNS.has(perm)) {
|
|
99
|
-
continue;
|
|
100
|
-
}
|
|
101
|
-
let isRedundant = false;
|
|
102
|
-
for (const templatePerm of template) {
|
|
103
|
-
if (perm.startsWith(`${templatePerm}(`)) {
|
|
104
|
-
isRedundant = true;
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
if (isCoveredByWildcard(perm, templatePerm)) {
|
|
108
|
-
isRedundant = true;
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (!isRedundant) {
|
|
113
|
-
result.push(perm);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return result;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
27
|
function ensureClaudeDir() {
|
|
120
28
|
ensureDir(CLAUDE_DIR);
|
|
121
29
|
}
|
|
@@ -468,4 +376,4 @@ const config = {
|
|
|
468
376
|
updateDefaultModel: updateDefaultModel
|
|
469
377
|
};
|
|
470
378
|
|
|
471
|
-
export { applyAiLanguageDirective as a, backupExistingConfig as b, copyConfigFiles as c, updateDefaultModel as d, getExistingApiConfig as e, configureApi as f, getExistingModelConfig as g, clearModelEnv as h, ensureClaudeDir as i, config as j,
|
|
379
|
+
export { applyAiLanguageDirective as a, backupExistingConfig as b, copyConfigFiles as c, updateDefaultModel as d, getExistingApiConfig as e, configureApi as f, getExistingModelConfig as g, clearModelEnv as h, ensureClaudeDir as i, config as j, promptApiConfigurationAction as p, switchToOfficialLogin as s, updateCustomModel as u };
|
package/dist/chunks/config2.mjs
CHANGED
|
@@ -21,6 +21,7 @@ import 'tinyexec';
|
|
|
21
21
|
import './fs-operations.mjs';
|
|
22
22
|
import 'node:crypto';
|
|
23
23
|
import 'node:fs/promises';
|
|
24
|
+
import '../shared/ccjk.BiCrMV5O.mjs';
|
|
24
25
|
import 'inquirer-toggle';
|
|
25
26
|
|
|
26
27
|
const PROVIDER_PRESETS_URL = "https://pub-0dc3e1677e894f07bbea11b17a29e032.r2.dev/providers.json";
|
package/dist/chunks/config3.mjs
CHANGED
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
import ansis from 'ansis';
|
|
2
|
+
import { i18n } from './index2.mjs';
|
|
3
|
+
import 'node:fs';
|
|
4
|
+
import 'node:process';
|
|
5
|
+
import 'node:url';
|
|
6
|
+
import 'i18next';
|
|
7
|
+
import 'i18next-fs-backend';
|
|
8
|
+
import 'pathe';
|
|
9
|
+
|
|
10
|
+
class A2AClient {
|
|
11
|
+
baseUrl;
|
|
12
|
+
token = null;
|
|
13
|
+
agentId = null;
|
|
14
|
+
constructor(baseUrl = "http://localhost:3005") {
|
|
15
|
+
this.baseUrl = baseUrl;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Register agent (hello)
|
|
19
|
+
*/
|
|
20
|
+
async hello(agent) {
|
|
21
|
+
const response = await this.request("/a2a/hello", {
|
|
22
|
+
method: "POST",
|
|
23
|
+
body: { type: "hello", agent }
|
|
24
|
+
});
|
|
25
|
+
this.token = response.token;
|
|
26
|
+
this.agentId = response.agentId;
|
|
27
|
+
return response;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Publish a gene
|
|
31
|
+
*/
|
|
32
|
+
async publish(gene, proof) {
|
|
33
|
+
this.ensureAuthenticated();
|
|
34
|
+
return this.request("/a2a/publish", {
|
|
35
|
+
method: "POST",
|
|
36
|
+
body: { type: "publish", gene, proof },
|
|
37
|
+
auth: true
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Fetch genes
|
|
42
|
+
*/
|
|
43
|
+
async fetch(query, limit) {
|
|
44
|
+
this.ensureAuthenticated();
|
|
45
|
+
const response = await this.request("/a2a/fetch", {
|
|
46
|
+
method: "POST",
|
|
47
|
+
body: { type: "fetch", query, limit },
|
|
48
|
+
auth: true
|
|
49
|
+
});
|
|
50
|
+
return response.genes;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Report usage result
|
|
54
|
+
*/
|
|
55
|
+
async report(geneId, result) {
|
|
56
|
+
this.ensureAuthenticated();
|
|
57
|
+
return this.request("/a2a/report", {
|
|
58
|
+
method: "POST",
|
|
59
|
+
body: { type: "report", geneId, result },
|
|
60
|
+
auth: true
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Request decision
|
|
65
|
+
*/
|
|
66
|
+
async decision(problem, options, context) {
|
|
67
|
+
this.ensureAuthenticated();
|
|
68
|
+
return this.request("/a2a/decision", {
|
|
69
|
+
method: "POST",
|
|
70
|
+
body: { type: "decision", problem, options, context },
|
|
71
|
+
auth: true
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Revoke a gene
|
|
76
|
+
*/
|
|
77
|
+
async revoke(geneId, reason) {
|
|
78
|
+
this.ensureAuthenticated();
|
|
79
|
+
await this.request(`/a2a/genes/${geneId}`, {
|
|
80
|
+
method: "DELETE",
|
|
81
|
+
body: { reason },
|
|
82
|
+
auth: true
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Get agent ID
|
|
87
|
+
*/
|
|
88
|
+
getAgentId() {
|
|
89
|
+
return this.agentId;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Check if authenticated
|
|
93
|
+
*/
|
|
94
|
+
isAuthenticated() {
|
|
95
|
+
return this.token !== null;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Internal request wrapper
|
|
99
|
+
*/
|
|
100
|
+
async request(path, options) {
|
|
101
|
+
const url = `${this.baseUrl}${path}`;
|
|
102
|
+
const headers = {
|
|
103
|
+
"Content-Type": "application/json"
|
|
104
|
+
};
|
|
105
|
+
if (options.auth && this.token) {
|
|
106
|
+
headers["Authorization"] = `Bearer ${this.token}`;
|
|
107
|
+
}
|
|
108
|
+
const response = await globalThis.fetch(url, {
|
|
109
|
+
method: options.method,
|
|
110
|
+
headers,
|
|
111
|
+
body: options.body ? JSON.stringify(options.body) : void 0
|
|
112
|
+
});
|
|
113
|
+
if (!response.ok) {
|
|
114
|
+
const error = await response.json().catch(() => ({ error: response.statusText }));
|
|
115
|
+
throw new Error(error.error || `Request failed: ${response.statusText}`);
|
|
116
|
+
}
|
|
117
|
+
return response.json();
|
|
118
|
+
}
|
|
119
|
+
ensureAuthenticated() {
|
|
120
|
+
if (!this.token) {
|
|
121
|
+
throw new Error("Not authenticated. Call hello() first.");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const PROTOCOL_CACHE_TTL_MS = 10 * 60 * 1e3;
|
|
127
|
+
const HEALTH_PATH = "/health";
|
|
128
|
+
const API_CANDIDATES = [
|
|
129
|
+
"https://remote-api.claudehome.cn",
|
|
130
|
+
"http://remote-api.claudehome.cn"
|
|
131
|
+
];
|
|
132
|
+
let protocolCache = null;
|
|
133
|
+
async function resolveRemoteApiBaseUrl(timeoutMs = 5e3) {
|
|
134
|
+
const now = Date.now();
|
|
135
|
+
if (protocolCache && protocolCache.expiresAt > now) {
|
|
136
|
+
return protocolCache.baseUrl;
|
|
137
|
+
}
|
|
138
|
+
for (const baseUrl of API_CANDIDATES) {
|
|
139
|
+
const ok = await probeHealth(baseUrl, timeoutMs);
|
|
140
|
+
if (ok) {
|
|
141
|
+
protocolCache = {
|
|
142
|
+
baseUrl,
|
|
143
|
+
expiresAt: now + PROTOCOL_CACHE_TTL_MS
|
|
144
|
+
};
|
|
145
|
+
return baseUrl;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
throw new Error("Remote API unavailable");
|
|
149
|
+
}
|
|
150
|
+
async function probeHealth(baseUrl, timeoutMs) {
|
|
151
|
+
const controller = new AbortController();
|
|
152
|
+
const timeoutId = setTimeout(() => controller.abort(), timeoutMs);
|
|
153
|
+
try {
|
|
154
|
+
const response = await fetch(`${baseUrl}${HEALTH_PATH}`, {
|
|
155
|
+
method: "GET",
|
|
156
|
+
signal: controller.signal
|
|
157
|
+
});
|
|
158
|
+
if (!response.ok) {
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
161
|
+
const data = await response.json().catch(() => null);
|
|
162
|
+
return data?.status === "ok";
|
|
163
|
+
} catch {
|
|
164
|
+
return false;
|
|
165
|
+
} finally {
|
|
166
|
+
clearTimeout(timeoutId);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
async function handleEvolutionCommand(action, args, options) {
|
|
171
|
+
try {
|
|
172
|
+
const resolvedBaseUrl = await resolveRemoteApiBaseUrl();
|
|
173
|
+
const client = new A2AClient(resolvedBaseUrl);
|
|
174
|
+
switch (action) {
|
|
175
|
+
case "top":
|
|
176
|
+
await showTopCapabilities(client, options);
|
|
177
|
+
break;
|
|
178
|
+
case "search":
|
|
179
|
+
await searchSolutions(client, args[0], options);
|
|
180
|
+
break;
|
|
181
|
+
case "show":
|
|
182
|
+
await showGeneDetails(client, args[0]);
|
|
183
|
+
break;
|
|
184
|
+
case "stats":
|
|
185
|
+
await showStats(client);
|
|
186
|
+
break;
|
|
187
|
+
default:
|
|
188
|
+
await showTopCapabilities(client, { limit: "30", minGdi: "70" });
|
|
189
|
+
}
|
|
190
|
+
} catch (error) {
|
|
191
|
+
const failedMsg = i18n.t("evolution:failed", "Failed");
|
|
192
|
+
console.error(ansis.red("\u274C " + failedMsg + ":"), error.message);
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async function showTopCapabilities(client, options) {
|
|
197
|
+
const connectingMsg = i18n.t("evolution:connecting", "Connecting to Evolution Layer...");
|
|
198
|
+
console.log(ansis.blue("\u{1F517} " + connectingMsg));
|
|
199
|
+
await client.hello({
|
|
200
|
+
id: "claude-code-cli",
|
|
201
|
+
name: "claude-code",
|
|
202
|
+
version: "1.0.0",
|
|
203
|
+
capabilities: ["fetch", "report"]
|
|
204
|
+
});
|
|
205
|
+
const fetchingMsg = i18n.t("evolution:fetching", "Fetching top capabilities...");
|
|
206
|
+
console.log(ansis.blue("\u{1F4CA} " + fetchingMsg));
|
|
207
|
+
const genes = await client.fetch(
|
|
208
|
+
{
|
|
209
|
+
signature: "*",
|
|
210
|
+
context: [],
|
|
211
|
+
minGDI: Number.parseInt(options.minGdi || "70")
|
|
212
|
+
},
|
|
213
|
+
Number.parseInt(options.limit || "30")
|
|
214
|
+
);
|
|
215
|
+
const foundMsg = i18n.t("evolution:found", "Found {{count}} capabilities", { count: genes.length });
|
|
216
|
+
console.log(ansis.green("\n\u2705 " + foundMsg + "\n"));
|
|
217
|
+
if (genes.length === 0) {
|
|
218
|
+
const noResultsMsg = i18n.t("evolution:noResults", "No capabilities found");
|
|
219
|
+
console.log(ansis.yellow(noResultsMsg));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
genes.forEach((gene, index) => {
|
|
223
|
+
console.log(ansis.bold(`${index + 1}. ${gene.id.substring(0, 8)}`));
|
|
224
|
+
const problemLabel = ansis.cyan(i18n.t("evolution:problem", "Problem"));
|
|
225
|
+
console.log(" " + problemLabel + ": " + gene.problem.signature);
|
|
226
|
+
const solutionLabel = ansis.yellow(i18n.t("evolution:solution", "Solution"));
|
|
227
|
+
console.log(" " + solutionLabel + ": " + gene.solution.strategy);
|
|
228
|
+
console.log(" " + ansis.green("GDI") + ": " + gene.quality.gdi.toFixed(1));
|
|
229
|
+
const usedLabel = ansis.gray(i18n.t("evolution:used", "Used"));
|
|
230
|
+
const timesLabel = i18n.t("evolution:times", "times");
|
|
231
|
+
console.log(" " + usedLabel + ": " + gene.quality.usageCount + " " + timesLabel);
|
|
232
|
+
const successLabel = ansis.gray(i18n.t("evolution:success", "Success"));
|
|
233
|
+
const successRate = (gene.quality.successRate * 100).toFixed(1);
|
|
234
|
+
console.log(" " + successLabel + ": " + successRate + "%");
|
|
235
|
+
console.log();
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
async function searchSolutions(client, query, options) {
|
|
239
|
+
const searchingMsg = i18n.t("evolution:searching", "Searching for: {{query}}", { query });
|
|
240
|
+
console.log(ansis.blue("\u{1F50D} " + searchingMsg));
|
|
241
|
+
await client.hello({
|
|
242
|
+
id: "claude-code-cli",
|
|
243
|
+
name: "claude-code",
|
|
244
|
+
version: "1.0.0",
|
|
245
|
+
capabilities: ["fetch", "report"]
|
|
246
|
+
});
|
|
247
|
+
const genes = await client.fetch(
|
|
248
|
+
{
|
|
249
|
+
signature: query,
|
|
250
|
+
context: [],
|
|
251
|
+
minGDI: Number.parseInt(options.minGdi || "60")
|
|
252
|
+
},
|
|
253
|
+
Number.parseInt(options.limit || "10")
|
|
254
|
+
);
|
|
255
|
+
if (genes.length === 0) {
|
|
256
|
+
const noSolutionsMsg = i18n.t("evolution:noSolutions", "No solutions found");
|
|
257
|
+
console.log(ansis.yellow("\n" + noSolutionsMsg));
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
const foundMsg = i18n.t("evolution:foundSolutions", "Found {{count}} solutions", { count: genes.length });
|
|
261
|
+
console.log(ansis.green("\n\u2705 " + foundMsg + "\n"));
|
|
262
|
+
genes.forEach((gene, index) => {
|
|
263
|
+
console.log(ansis.bold(`${index + 1}. ${gene.problem.signature}`));
|
|
264
|
+
console.log(" " + gene.solution.strategy);
|
|
265
|
+
const usedLabel = i18n.t("evolution:used", "Used");
|
|
266
|
+
console.log(" GDI: " + gene.quality.gdi.toFixed(1) + " | " + usedLabel + ": " + gene.quality.usageCount + "x");
|
|
267
|
+
if (gene.problem.context.length > 0) {
|
|
268
|
+
const contextLabel = ansis.gray(i18n.t("evolution:context", "Context"));
|
|
269
|
+
console.log(" " + contextLabel + ": " + gene.problem.context.join(", "));
|
|
270
|
+
}
|
|
271
|
+
console.log();
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
async function showGeneDetails(client, geneId) {
|
|
275
|
+
await client.hello({
|
|
276
|
+
id: "claude-code-cli",
|
|
277
|
+
name: "claude-code",
|
|
278
|
+
version: "1.0.0",
|
|
279
|
+
capabilities: ["fetch", "report"]
|
|
280
|
+
});
|
|
281
|
+
const genes = await client.fetch({ signature: "*", context: [] });
|
|
282
|
+
const gene = genes.find((g) => g.id.startsWith(geneId));
|
|
283
|
+
if (!gene) {
|
|
284
|
+
const notFoundMsg = i18n.t("evolution:geneNotFound", "Gene not found");
|
|
285
|
+
console.log(ansis.red(notFoundMsg));
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
displayGene(gene);
|
|
289
|
+
}
|
|
290
|
+
async function showStats(client) {
|
|
291
|
+
const fetchingMsg = i18n.t("evolution:fetchingStats", "Fetching statistics...");
|
|
292
|
+
console.log(ansis.blue("\u{1F4CA} " + fetchingMsg));
|
|
293
|
+
await client.hello({
|
|
294
|
+
id: "claude-code-cli",
|
|
295
|
+
name: "claude-code",
|
|
296
|
+
version: "1.0.0",
|
|
297
|
+
capabilities: ["fetch", "report"]
|
|
298
|
+
});
|
|
299
|
+
const allGenes = await client.fetch({ signature: "*", context: [] }, 1e3);
|
|
300
|
+
const totalGenes = allGenes.length;
|
|
301
|
+
const avgGDI = allGenes.reduce((sum, g) => sum + g.quality.gdi, 0) / totalGenes;
|
|
302
|
+
const totalUsage = allGenes.reduce((sum, g) => sum + g.quality.usageCount, 0);
|
|
303
|
+
const avgSuccessRate = allGenes.reduce((sum, g) => sum + g.quality.successRate, 0) / totalGenes;
|
|
304
|
+
const typeCount = allGenes.reduce((acc, g) => {
|
|
305
|
+
acc[g.type] = (acc[g.type] || 0) + 1;
|
|
306
|
+
return acc;
|
|
307
|
+
}, {});
|
|
308
|
+
console.log(ansis.bold("\n\u{1F4C8} Evolution Layer Statistics\n"));
|
|
309
|
+
const totalLabel = ansis.cyan(i18n.t("evolution:totalGenes", "Total Genes"));
|
|
310
|
+
console.log(totalLabel + ": " + totalGenes);
|
|
311
|
+
const avgGdiLabel = ansis.cyan(i18n.t("evolution:avgGDI", "Average GDI"));
|
|
312
|
+
console.log(avgGdiLabel + ": " + avgGDI.toFixed(1));
|
|
313
|
+
const totalUsageLabel = ansis.cyan(i18n.t("evolution:totalUsage", "Total Usage"));
|
|
314
|
+
console.log(totalUsageLabel + ": " + totalUsage);
|
|
315
|
+
const avgSuccessLabel = ansis.cyan(i18n.t("evolution:avgSuccess", "Average Success Rate"));
|
|
316
|
+
console.log(avgSuccessLabel + ": " + (avgSuccessRate * 100).toFixed(1) + "%");
|
|
317
|
+
console.log();
|
|
318
|
+
const byTypeLabel = i18n.t("evolution:byType", "By Type");
|
|
319
|
+
console.log(ansis.bold(byTypeLabel + ":"));
|
|
320
|
+
Object.entries(typeCount).forEach(([type, count]) => {
|
|
321
|
+
console.log(" " + type + ": " + count);
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
function displayGene(gene) {
|
|
325
|
+
const detailsLabel = i18n.t("evolution:geneDetails", "Gene Details");
|
|
326
|
+
console.log(ansis.bold("\n\u{1F4E6} " + detailsLabel + "\n"));
|
|
327
|
+
console.log(ansis.cyan("ID") + ": " + gene.id);
|
|
328
|
+
const typeLabel = i18n.t("evolution:type", "Type");
|
|
329
|
+
console.log(ansis.cyan(typeLabel) + ": " + gene.type);
|
|
330
|
+
console.log(ansis.cyan("SHA256") + ": " + gene.sha256);
|
|
331
|
+
console.log();
|
|
332
|
+
const problemLabel = i18n.t("evolution:problem", "Problem");
|
|
333
|
+
console.log(ansis.bold(problemLabel + ":"));
|
|
334
|
+
const sigLabel = i18n.t("evolution:signature", "Signature");
|
|
335
|
+
console.log(" " + sigLabel + ": " + gene.problem.signature);
|
|
336
|
+
if (gene.problem.context.length > 0) {
|
|
337
|
+
const contextLabel = i18n.t("evolution:context", "Context");
|
|
338
|
+
console.log(" " + contextLabel + ": " + gene.problem.context.join(", "));
|
|
339
|
+
}
|
|
340
|
+
console.log();
|
|
341
|
+
const solutionLabel = i18n.t("evolution:solution", "Solution");
|
|
342
|
+
console.log(ansis.bold(solutionLabel + ":"));
|
|
343
|
+
const strategyLabel = i18n.t("evolution:strategy", "Strategy");
|
|
344
|
+
console.log(" " + strategyLabel + ": " + gene.solution.strategy);
|
|
345
|
+
if (gene.solution.code) {
|
|
346
|
+
const codeLabel = i18n.t("evolution:code", "Code");
|
|
347
|
+
console.log(" " + codeLabel + ":");
|
|
348
|
+
const codeLines = gene.solution.code.split("\n").map((line) => " " + line).join("\n");
|
|
349
|
+
console.log(ansis.gray(codeLines));
|
|
350
|
+
}
|
|
351
|
+
if (gene.solution.steps.length > 0) {
|
|
352
|
+
const stepsLabel = i18n.t("evolution:steps", "Steps");
|
|
353
|
+
console.log(" " + stepsLabel + ":");
|
|
354
|
+
gene.solution.steps.forEach((step, i) => {
|
|
355
|
+
console.log(" " + (i + 1) + ". " + step);
|
|
356
|
+
});
|
|
357
|
+
}
|
|
358
|
+
console.log();
|
|
359
|
+
const qualityLabel = i18n.t("evolution:quality", "Quality");
|
|
360
|
+
console.log(ansis.bold(qualityLabel + ":"));
|
|
361
|
+
console.log(" GDI: " + gene.quality.gdi.toFixed(1));
|
|
362
|
+
const successRateLabel = i18n.t("evolution:successRate", "Success Rate");
|
|
363
|
+
console.log(" " + successRateLabel + ": " + (gene.quality.successRate * 100).toFixed(1) + "%");
|
|
364
|
+
const usageCountLabel = i18n.t("evolution:usageCount", "Usage Count");
|
|
365
|
+
console.log(" " + usageCountLabel + ": " + gene.quality.usageCount);
|
|
366
|
+
const avgTimeLabel = i18n.t("evolution:avgTime", "Average Time");
|
|
367
|
+
console.log(" " + avgTimeLabel + ": " + gene.quality.avgTime + "s");
|
|
368
|
+
if (gene.metadata) {
|
|
369
|
+
console.log();
|
|
370
|
+
const metadataLabel = i18n.t("evolution:metadata", "Metadata");
|
|
371
|
+
console.log(ansis.bold(metadataLabel + ":"));
|
|
372
|
+
const authorLabel = i18n.t("evolution:author", "Author");
|
|
373
|
+
console.log(" " + authorLabel + ": " + (gene.metadata.author || "-"));
|
|
374
|
+
const createdLabel = i18n.t("evolution:createdAt", "Created At");
|
|
375
|
+
console.log(" " + createdLabel + ": " + (gene.metadata.createdAt || "-"));
|
|
376
|
+
if (gene.metadata.tags && gene.metadata.tags.length > 0) {
|
|
377
|
+
const tagsLabel = i18n.t("evolution:tags", "Tags");
|
|
378
|
+
console.log(" " + tagsLabel + ": " + gene.metadata.tags.join(", "));
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
export { handleEvolutionCommand };
|
package/dist/chunks/features.mjs
CHANGED
|
@@ -12,7 +12,7 @@ import { setupCcrConfiguration } from './config2.mjs';
|
|
|
12
12
|
import { a as isCcrInstalled, b as installCcr } from './init.mjs';
|
|
13
13
|
import { r as readMcpConfig, f as fixWindowsMcpConfig, w as writeMcpConfig, b as backupMcpConfig, a as buildMcpServerConfig, m as mergeMcpServers } from './claude-config.mjs';
|
|
14
14
|
import { a as applyAiLanguageDirective, g as getExistingModelConfig, u as updateCustomModel, d as updateDefaultModel, e as getExistingApiConfig, p as promptApiConfigurationAction, f as configureApi, s as switchToOfficialLogin } from './config.mjs';
|
|
15
|
-
import { c as configureOutputStyle, a as modifyApiConfigPartially, v as validateApiKey, f as formatApiKeyDisplay } from '../shared/ccjk.
|
|
15
|
+
import { c as configureOutputStyle, a as modifyApiConfigPartially, v as validateApiKey, f as formatApiKeyDisplay } from '../shared/ccjk.DVBW2wxp.mjs';
|
|
16
16
|
import { i as isWindows } from './platform.mjs';
|
|
17
17
|
import { a as addNumbersToChoices } from '../shared/ccjk.BFQ7yr5S.mjs';
|
|
18
18
|
import { openSettingsJson, importRecommendedPermissions, importRecommendedEnv } from './simple-config.mjs';
|
|
@@ -43,6 +43,7 @@ import '../shared/ccjk.DKojSRzw.mjs';
|
|
|
43
43
|
import '../shared/ccjk.DrMygfCF.mjs';
|
|
44
44
|
import './installer.mjs';
|
|
45
45
|
import '../shared/ccjk.BKoi8-Hy.mjs';
|
|
46
|
+
import '../shared/ccjk.BiCrMV5O.mjs';
|
|
46
47
|
import 'inquirer-toggle';
|
|
47
48
|
|
|
48
49
|
async function handleCancellation() {
|
package/dist/chunks/init.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import ansis from 'ansis';
|
|
|
4
4
|
import inquirer from 'inquirer';
|
|
5
5
|
import { version } from './package.mjs';
|
|
6
6
|
import { m as runCodexFullInit, d as selectMcpServices, g as getMcpServices, M as MCP_SERVICE_CONFIGS } from './codex.mjs';
|
|
7
|
-
import { a as modifyApiConfigPartially, b as configureApiCompletely, n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, c as configureOutputStyle, f as formatApiKeyDisplay, W as WORKFLOW_CONFIG_BASE } from '../shared/ccjk.
|
|
7
|
+
import { a as modifyApiConfigPartially, b as configureApiCompletely, n as needsMigration, m as migrateSettingsForTokenRetrieval, d as displayMigrationResult, p as promptMigration, s as selectAndInstallWorkflows, c as configureOutputStyle, f as formatApiKeyDisplay, W as WORKFLOW_CONFIG_BASE } from '../shared/ccjk.DVBW2wxp.mjs';
|
|
8
8
|
import { SETTINGS_FILE, DEFAULT_CODE_TOOL_TYPE, CODE_TOOL_BANNERS, API_DEFAULT_URL } from './constants.mjs';
|
|
9
9
|
import { ensureI18nInitialized, i18n } from './index2.mjs';
|
|
10
10
|
import { displayBannerWithInfo, padToDisplayWidth } from './banner.mjs';
|
package/dist/chunks/mcp.mjs
CHANGED
package/dist/chunks/menu.mjs
CHANGED
|
@@ -363,6 +363,7 @@ async function showSimplifiedMenu() {
|
|
|
363
363
|
console.log(` ${ansis.green("5.")} ${isZh ? "\u914D\u7F6E\u9ED8\u8BA4\u6A21\u578B" : "Configure Default Model"} ${ansis.dim(isZh ? "- \u8BBE\u7F6E\u9ED8\u8BA4\u6A21\u578B\uFF08opus/sonnet/sonnet 1m/\u81EA\u5B9A\u4E49\uFF09" : "- Set default model (opus/sonnet/sonnet 1m/custom)")}`);
|
|
364
364
|
console.log(` ${ansis.green("6.")} ${isZh ? "\u914D\u7F6E Claude \u5168\u5C40\u8BB0\u5FC6" : "Configure Claude Memory"} ${ansis.dim(isZh ? "- \u914D\u7F6E AI \u8F93\u51FA\u8BED\u8A00\u548C\u8F93\u51FA\u98CE\u683C" : "- Configure AI output language and style")}`);
|
|
365
365
|
console.log(` ${ansis.green("7.")} ${isZh ? "\u5BFC\u5165\u63A8\u8350\u73AF\u5883\u53D8\u91CF\u548C\u6743\u9650\u914D\u7F6E" : "Import Recommended Env & Permissions"} ${ansis.dim(isZh ? "- \u5BFC\u5165\u9690\u79C1\u4FDD\u62A4\u73AF\u5883\u53D8\u91CF\u548C\u7CFB\u7EDF\u6743\u9650\u914D\u7F6E" : "- Import privacy env vars and system permissions")}`);
|
|
366
|
+
console.log(` ${ansis.green("8.")} ${isZh ? "\u96F6\u914D\u7F6E\u6743\u9650\u9884\u8BBE" : "Zero-Config Permission Presets"} ${ansis.dim(isZh ? "- \u4E00\u952E\u5E94\u7528\u6743\u9650\u9884\u8BBE\uFF08\u6700\u5927/\u5F00\u53D1\u8005/\u5B89\u5168\uFF09" : "- One-click permission presets (max/dev/safe)")}`);
|
|
366
367
|
console.log("");
|
|
367
368
|
console.log(ansis.dim(` --------- ${isZh ? "\u5176\u4ED6\u5DE5\u5177" : "Other Tools"} ----------`));
|
|
368
369
|
console.log(` ${ansis.green("K.")} ${isZh ? "Skills \u7BA1\u7406" : "Skills Manager"} ${ansis.dim(isZh ? "- \u5B89\u88C5/\u66F4\u65B0/\u5220\u9664\u5DE5\u4F5C\u6D41\u6280\u80FD" : "- Install/update/remove workflow skills")}`);
|
|
@@ -387,7 +388,7 @@ async function showSimplifiedMenu() {
|
|
|
387
388
|
message: isZh ? "\u8BF7\u8F93\u5165\u9009\u9879:" : "Enter option:",
|
|
388
389
|
validate: (value) => {
|
|
389
390
|
const normalized2 = normalizeMenuInput(value);
|
|
390
|
-
const valid = ["0", "1", "2", "3", "4", "5", "6", "7", "k", "m", "a", "p", "r", "b", "s", "-", "+", "d", "h", "q"];
|
|
391
|
+
const valid = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "k", "m", "a", "p", "r", "b", "s", "-", "+", "d", "h", "q"];
|
|
391
392
|
return valid.includes(normalized2) || (isZh ? "\u8BF7\u8F93\u5165\u6709\u6548\u9009\u9879" : "Please enter a valid option");
|
|
392
393
|
}
|
|
393
394
|
});
|
|
@@ -426,6 +427,11 @@ async function showSimplifiedMenu() {
|
|
|
426
427
|
await configureEnvPermissionFeature();
|
|
427
428
|
break;
|
|
428
429
|
}
|
|
430
|
+
case "8": {
|
|
431
|
+
const { zeroConfig } = await import('./zero-config.mjs');
|
|
432
|
+
await zeroConfig();
|
|
433
|
+
break;
|
|
434
|
+
}
|
|
429
435
|
// --------- 其他工具 ----------
|
|
430
436
|
case "k": {
|
|
431
437
|
await ccjkSkills({});
|
package/dist/chunks/package.mjs
CHANGED