aico-cli 2.0.77 → 2.1.1
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/bin/cli/cli.js +3061 -2910
- package/bin/cli/package.json +1 -1
- package/bin/cli/sdk-tools.d.ts +15 -4
- package/dist/chunks/simple-config.mjs +96 -22
- package/package.json +2 -2
package/bin/cli/package.json
CHANGED
package/bin/cli/sdk-tools.d.ts
CHANGED
|
@@ -26,7 +26,8 @@ export type ToolInputSchemas =
|
|
|
26
26
|
| TodoWriteInput
|
|
27
27
|
| WebFetchInput
|
|
28
28
|
| WebSearchInput
|
|
29
|
-
| AskUserQuestionInput
|
|
29
|
+
| AskUserQuestionInput
|
|
30
|
+
| ConfigInput;
|
|
30
31
|
|
|
31
32
|
export interface AgentInput {
|
|
32
33
|
/**
|
|
@@ -50,7 +51,7 @@ export interface AgentInput {
|
|
|
50
51
|
*/
|
|
51
52
|
resume?: string;
|
|
52
53
|
/**
|
|
53
|
-
* Set to true to run this agent in the background.
|
|
54
|
+
* Set to true to run this agent in the background. The tool result will include an output_file path - use Read tool or Bash tail to check on output.
|
|
54
55
|
*/
|
|
55
56
|
run_in_background?: boolean;
|
|
56
57
|
}
|
|
@@ -95,11 +96,11 @@ export interface TaskOutputInput {
|
|
|
95
96
|
/**
|
|
96
97
|
* Whether to wait for completion
|
|
97
98
|
*/
|
|
98
|
-
block
|
|
99
|
+
block: boolean;
|
|
99
100
|
/**
|
|
100
101
|
* Max wait time in ms
|
|
101
102
|
*/
|
|
102
|
-
timeout
|
|
103
|
+
timeout: number;
|
|
103
104
|
}
|
|
104
105
|
export interface ExitPlanModeInput {
|
|
105
106
|
[k: string]: unknown;
|
|
@@ -1484,3 +1485,13 @@ export interface AskUserQuestionInput {
|
|
|
1484
1485
|
[k: string]: string;
|
|
1485
1486
|
};
|
|
1486
1487
|
}
|
|
1488
|
+
export interface ConfigInput {
|
|
1489
|
+
/**
|
|
1490
|
+
* The setting key (e.g., "theme", "model", "permissions.defaultMode")
|
|
1491
|
+
*/
|
|
1492
|
+
setting: string;
|
|
1493
|
+
/**
|
|
1494
|
+
* The new value. Omit to get current value.
|
|
1495
|
+
*/
|
|
1496
|
+
value?: string | boolean | number;
|
|
1497
|
+
}
|
|
@@ -14,7 +14,7 @@ import { join, dirname, basename } from 'pathe';
|
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
15
|
import { EventEmitter } from 'node:events';
|
|
16
16
|
|
|
17
|
-
const version = "2.
|
|
17
|
+
const version = "2.1.1";
|
|
18
18
|
|
|
19
19
|
function displayBanner(subtitle) {
|
|
20
20
|
const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
|
|
@@ -4230,10 +4230,16 @@ async function configureCcrWithPreset(preset, _scriptLang) {
|
|
|
4230
4230
|
async function restartAndCheckCcrStatus(_scriptLang) {
|
|
4231
4231
|
try {
|
|
4232
4232
|
console.log(ansis.cyan("\u91CD\u542F CCR"));
|
|
4233
|
-
await execAsync$2("ccr restart", {
|
|
4233
|
+
await execAsync$2("ccr restart", {
|
|
4234
|
+
encoding: "buffer",
|
|
4235
|
+
maxBuffer: 10 * 1024 * 1024
|
|
4236
|
+
});
|
|
4234
4237
|
console.log(ansis.green("\u2714 CCR \u91CD\u542F\u6210\u529F"));
|
|
4235
4238
|
console.log(ansis.cyan("\u68C0\u67E5 CCR \u72B6\u6001"));
|
|
4236
|
-
const { stdout } = await execAsync$2("ccr status", {
|
|
4239
|
+
const { stdout } = await execAsync$2("ccr status", {
|
|
4240
|
+
encoding: "buffer",
|
|
4241
|
+
maxBuffer: 10 * 1024 * 1024
|
|
4242
|
+
});
|
|
4237
4243
|
const statusOut = Buffer.isBuffer(stdout) ? stdout.toString("utf8").replace(/\0/g, "") : String(stdout);
|
|
4238
4244
|
console.log(ansis.gray(statusOut));
|
|
4239
4245
|
} catch (error) {
|
|
@@ -4273,6 +4279,11 @@ async function setupCcrConfiguration(scriptLang = "zh-CN") {
|
|
|
4273
4279
|
const existingConfig = readCcrConfig();
|
|
4274
4280
|
if (existingConfig) {
|
|
4275
4281
|
await configureCcrProxy(existingConfig);
|
|
4282
|
+
console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
|
|
4283
|
+
console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
|
|
4284
|
+
console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
|
|
4285
|
+
console.log(ansis.gray(" CCR \u5DF2\u914D\u7F6E\uFF0C\u53EF\u76F4\u63A5\u4F7F\u7528"));
|
|
4286
|
+
console.log(ansis.cyan(" \u{1F4A1} \u5982\u9700\u91CD\u65B0\u914D\u7F6E\uFF0C\u8BF7\u8FD0\u884C: ccr ui\n"));
|
|
4276
4287
|
return true;
|
|
4277
4288
|
}
|
|
4278
4289
|
const preset = await selectCcrPreset(scriptLang);
|
|
@@ -6026,10 +6037,13 @@ class InstallationComposer {
|
|
|
6026
6037
|
await this.executor.executeBatch(companySteps, configOptions);
|
|
6027
6038
|
const configInstaller = new ConfigInstaller(this.context);
|
|
6028
6039
|
await configInstaller.applyCompanyConfig();
|
|
6029
|
-
updateClaudeConfigEnv(
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6040
|
+
updateClaudeConfigEnv(
|
|
6041
|
+
{
|
|
6042
|
+
ANTHROPIC_BASE_URL: "http://11.0.166.23:13456",
|
|
6043
|
+
ANTHROPIC_AUTH_TOKEN: "sk-4730d06849b5fea00f551bd60a0902e1"
|
|
6044
|
+
},
|
|
6045
|
+
"claude"
|
|
6046
|
+
);
|
|
6033
6047
|
await this.installToTarget("codebuddy", companySteps, configOptions, {
|
|
6034
6048
|
ANTHROPIC_BASE_URL: "http://11.0.166.23:13456",
|
|
6035
6049
|
ANTHROPIC_AUTH_TOKEN: "sk-4730d06849b5fea00f551bd60a0902e1"
|
|
@@ -6053,26 +6067,47 @@ class InstallationComposer {
|
|
|
6053
6067
|
spinner.start("\u6B63\u5728\u5B89\u88C5\u4E2A\u4EBA\u914D\u7F6E...");
|
|
6054
6068
|
try {
|
|
6055
6069
|
await run("npm install -g tsx");
|
|
6056
|
-
const
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6070
|
+
const ccrInstaller = new CCRInstaller(this.context);
|
|
6071
|
+
const ccrStatus = await ccrInstaller.checkStatus();
|
|
6072
|
+
let installationSteps;
|
|
6073
|
+
let shouldStartCcrUI = false;
|
|
6074
|
+
if (ccrStatus.isInstalled && ccrStatus.hasCorrectPackage) {
|
|
6075
|
+
console.log(ansis.green("\u2714 \u68C0\u6D4B\u5230CCR\u5DF2\u5B89\u88C5\uFF0C\u8DF3\u8FC7CCR\u5B89\u88C5\u6B65\u9AA4"));
|
|
6076
|
+
installationSteps = [
|
|
6077
|
+
INSTALLER_NAMES.CONFIG,
|
|
6078
|
+
INSTALLER_NAMES.CCOMETIX_LINE,
|
|
6079
|
+
INSTALLER_NAMES.MCP
|
|
6080
|
+
];
|
|
6081
|
+
} else {
|
|
6082
|
+
console.log(ansis.cyan("\u{1F4E6} \u68C0\u6D4B\u5230CCR\u672A\u5B89\u88C5\uFF0C\u5C06\u8FDB\u884C\u5B89\u88C5"));
|
|
6083
|
+
installationSteps = [
|
|
6084
|
+
INSTALLER_NAMES.CCR,
|
|
6085
|
+
INSTALLER_NAMES.CONFIG,
|
|
6086
|
+
INSTALLER_NAMES.CCOMETIX_LINE,
|
|
6087
|
+
INSTALLER_NAMES.MCP
|
|
6088
|
+
];
|
|
6089
|
+
shouldStartCcrUI = true;
|
|
6090
|
+
}
|
|
6062
6091
|
const configOptions = {
|
|
6063
6092
|
...options,
|
|
6064
6093
|
silent: true,
|
|
6065
6094
|
// 静默模式
|
|
6066
6095
|
force: true
|
|
6067
6096
|
};
|
|
6068
|
-
const results = await this.executor.executeBatch(
|
|
6069
|
-
|
|
6097
|
+
const results = await this.executor.executeBatch(
|
|
6098
|
+
installationSteps,
|
|
6099
|
+
configOptions
|
|
6100
|
+
);
|
|
6101
|
+
if (results[INSTALLER_NAMES.CCR]?.success || ccrStatus.isInstalled) {
|
|
6070
6102
|
await this.configureCCRForPersonal(true);
|
|
6071
6103
|
}
|
|
6072
|
-
updateClaudeConfigEnv(
|
|
6073
|
-
|
|
6074
|
-
|
|
6075
|
-
|
|
6104
|
+
updateClaudeConfigEnv(
|
|
6105
|
+
{
|
|
6106
|
+
ANTHROPIC_BASE_URL: "http://127.0.0.1:3456",
|
|
6107
|
+
ANTHROPIC_AUTH_TOKEN: "sk-aico-x-ccr"
|
|
6108
|
+
},
|
|
6109
|
+
"claude"
|
|
6110
|
+
);
|
|
6076
6111
|
const codebuddySteps = [
|
|
6077
6112
|
INSTALLER_NAMES.CONFIG,
|
|
6078
6113
|
INSTALLER_NAMES.CCOMETIX_LINE,
|
|
@@ -6082,6 +6117,9 @@ class InstallationComposer {
|
|
|
6082
6117
|
ANTHROPIC_BASE_URL: "http://127.0.0.1:3456",
|
|
6083
6118
|
ANTHROPIC_AUTH_TOKEN: "sk-aico-x-ccr"
|
|
6084
6119
|
});
|
|
6120
|
+
if (shouldStartCcrUI && results[INSTALLER_NAMES.CCR]?.success) {
|
|
6121
|
+
await this.startCcrUIAndShowInfo();
|
|
6122
|
+
}
|
|
6085
6123
|
this.installCodebuddyCodeSilently();
|
|
6086
6124
|
this.updateGlobalConfig(true);
|
|
6087
6125
|
spinner.succeed("\u4E2A\u4EBA\u914D\u7F6E\u5B89\u88C5\u5B8C\u6210");
|
|
@@ -6105,7 +6143,9 @@ class InstallationComposer {
|
|
|
6105
6143
|
* 不阻塞主流程,静默处理失败
|
|
6106
6144
|
*/
|
|
6107
6145
|
installCodebuddyCodeSilently() {
|
|
6108
|
-
run(
|
|
6146
|
+
run(
|
|
6147
|
+
"npm install -g @anthropic-ai/claude-code @anthropic-ai/claude-code@beta @anthropic-ai/claude-code@canary @anthropic-ai/claude-code@dev @anthropic-ai/claude-code@next @tencent-ai/codebuddy-code"
|
|
6148
|
+
).then(() => {
|
|
6109
6149
|
}).catch(() => {
|
|
6110
6150
|
});
|
|
6111
6151
|
}
|
|
@@ -6141,6 +6181,36 @@ class InstallationComposer {
|
|
|
6141
6181
|
*/
|
|
6142
6182
|
async configureCCRForPersonal(silent = false) {
|
|
6143
6183
|
}
|
|
6184
|
+
/**
|
|
6185
|
+
* 启动CCR UI并显示连接信息
|
|
6186
|
+
*/
|
|
6187
|
+
async startCcrUIAndShowInfo() {
|
|
6188
|
+
try {
|
|
6189
|
+
console.log(ansis.cyan("\n\u{1F680} \u6B63\u5728\u542F\u52A8 CCR UI..."));
|
|
6190
|
+
const ccrInstaller = new CCRInstaller(this.context);
|
|
6191
|
+
const result = await ccrInstaller.startUI(true);
|
|
6192
|
+
if (result.success) {
|
|
6193
|
+
console.log(ansis.green("\u2714 CCR UI \u542F\u52A8\u6210\u529F"));
|
|
6194
|
+
console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
|
|
6195
|
+
console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
|
|
6196
|
+
console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
|
|
6197
|
+
console.log(ansis.gray(" \u4F7F\u7528\u6B64 API \u5BC6\u94A5\u767B\u5F55 CCR UI \u8FDB\u884C\u914D\u7F6E"));
|
|
6198
|
+
console.log(ansis.cyan(" \u{1F4A1} \u8BF7\u5728\u6D4F\u89C8\u5668\u4E2D\u8BBF\u95EE\u4E0A\u8FF0\u5730\u5740\u8FDB\u884C\u914D\u7F6E\n"));
|
|
6199
|
+
} else {
|
|
6200
|
+
console.log(ansis.yellow("\u26A0 CCR UI \u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C: ccr ui"));
|
|
6201
|
+
console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
|
|
6202
|
+
console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
|
|
6203
|
+
console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
|
|
6204
|
+
console.log(ansis.gray(" \u4F7F\u7528\u6B64 API \u5BC6\u94A5\u767B\u5F55 CCR UI \u8FDB\u884C\u914D\u7F6E\n"));
|
|
6205
|
+
}
|
|
6206
|
+
} catch (error) {
|
|
6207
|
+
console.log(ansis.yellow("\u26A0 CCR UI \u542F\u52A8\u5931\u8D25\uFF0C\u8BF7\u624B\u52A8\u8FD0\u884C: ccr ui"));
|
|
6208
|
+
console.log(ansis.bold.cyan("\n\u{1F4CC} CCR \u8FDE\u63A5\u4FE1\u606F:"));
|
|
6209
|
+
console.log(ansis.bold.green(" \u{1F310} CCR \u5730\u5740: http://127.0.0.1:3456"));
|
|
6210
|
+
console.log(ansis.bold.green(" \u{1F511} API \u5BC6\u94A5: sk-aico-x-ccr"));
|
|
6211
|
+
console.log(ansis.gray(" \u4F7F\u7528\u6B64 API \u5BC6\u94A5\u767B\u5F55 CCR UI \u8FDB\u884C\u914D\u7F6E\n"));
|
|
6212
|
+
}
|
|
6213
|
+
}
|
|
6144
6214
|
/**
|
|
6145
6215
|
* 更新全局配置
|
|
6146
6216
|
*/
|
|
@@ -6182,8 +6252,12 @@ class InstallationComposer {
|
|
|
6182
6252
|
}
|
|
6183
6253
|
}
|
|
6184
6254
|
}
|
|
6185
|
-
console.log(
|
|
6186
|
-
|
|
6255
|
+
console.log(
|
|
6256
|
+
ansis.cyan(
|
|
6257
|
+
`
|
|
6258
|
+
\u603B\u8BA1: ${successCount + failureCount} \u9879\uFF0C\u6210\u529F ${successCount}\uFF0C\u5931\u8D25 ${failureCount}`
|
|
6259
|
+
)
|
|
6260
|
+
);
|
|
6187
6261
|
if (failureCount === 0) {
|
|
6188
6262
|
console.log(ansis.green("\u{1F389} \u914D\u7F6E\u5B8C\u6210\uFF01"));
|
|
6189
6263
|
} else {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "aico-cli",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.1",
|
|
4
4
|
"packageManager": "pnpm@9.15.9",
|
|
5
5
|
"description": "AI CLI",
|
|
6
6
|
"repository": {
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"hooks:clean": "rimraf templates/hooks/dist templates/hooks/*.js templates/hooks/*.d.ts templates/hooks/*.js.map"
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@anthropic-ai/claude-code": "^2.
|
|
44
|
+
"@anthropic-ai/claude-code": "^2.1.1",
|
|
45
45
|
"ansis": "^3.17.0",
|
|
46
46
|
"cac": "^6.7.14",
|
|
47
47
|
"dayjs": "^1.11.13",
|