aico-cli 0.2.1 → 0.2.4
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/feature-checker.mjs +0 -1
- package/dist/chunks/simple-config.mjs +21 -375
- package/dist/cli.mjs +5 -12
- package/dist/index.mjs +0 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import ansis from 'ansis';
|
|
|
2
2
|
import inquirer from 'inquirer';
|
|
3
3
|
import { exec } from 'tinyexec';
|
|
4
4
|
import { platform, homedir } from 'node:os';
|
|
5
|
-
import { existsSync, copyFileSync,
|
|
5
|
+
import { existsSync, copyFileSync, readFileSync, writeFileSync, mkdirSync, statSync, readdirSync } from 'node:fs';
|
|
6
6
|
import { exec as exec$2 } from 'node:child_process';
|
|
7
7
|
import { promisify as promisify$1 } from 'node:util';
|
|
8
8
|
import { exec as exec$1 } from 'child_process';
|
|
@@ -10,11 +10,10 @@ import { promisify } from 'util';
|
|
|
10
10
|
import ora from 'ora';
|
|
11
11
|
import 'dayjs';
|
|
12
12
|
import { join as join$1 } from 'node:path';
|
|
13
|
-
import { join, dirname
|
|
13
|
+
import { join, dirname } from 'pathe';
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
|
-
import { rm, mkdir, copyFile as copyFile$1 } from 'node:fs/promises';
|
|
16
15
|
|
|
17
|
-
const version = "0.2.
|
|
16
|
+
const version = "0.2.4";
|
|
18
17
|
|
|
19
18
|
function displayBanner(subtitle) {
|
|
20
19
|
const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
|
|
@@ -3387,13 +3386,6 @@ function isDirectory(path) {
|
|
|
3387
3386
|
return false;
|
|
3388
3387
|
}
|
|
3389
3388
|
}
|
|
3390
|
-
function isFile(path) {
|
|
3391
|
-
try {
|
|
3392
|
-
return getStats(path).isFile();
|
|
3393
|
-
} catch {
|
|
3394
|
-
return false;
|
|
3395
|
-
}
|
|
3396
|
-
}
|
|
3397
3389
|
function copyDir(src, dest, options = {}) {
|
|
3398
3390
|
const { filter, overwrite = true } = options;
|
|
3399
3391
|
if (!exists(src)) {
|
|
@@ -3402,8 +3394,8 @@ function copyDir(src, dest, options = {}) {
|
|
|
3402
3394
|
ensureDir(dest);
|
|
3403
3395
|
const entries = readDir(src);
|
|
3404
3396
|
for (const entry of entries) {
|
|
3405
|
-
const srcPath =
|
|
3406
|
-
const destPath =
|
|
3397
|
+
const srcPath = join(src, entry);
|
|
3398
|
+
const destPath = join(dest, entry);
|
|
3407
3399
|
const stats = getStats(srcPath);
|
|
3408
3400
|
if (filter && !filter(srcPath, stats)) {
|
|
3409
3401
|
continue;
|
|
@@ -3418,32 +3410,6 @@ function copyDir(src, dest, options = {}) {
|
|
|
3418
3410
|
}
|
|
3419
3411
|
}
|
|
3420
3412
|
}
|
|
3421
|
-
function removeFile(path) {
|
|
3422
|
-
try {
|
|
3423
|
-
if (exists(path) && isFile(path)) {
|
|
3424
|
-
unlinkSync(path);
|
|
3425
|
-
}
|
|
3426
|
-
} catch (error) {
|
|
3427
|
-
throw new FileSystemError(
|
|
3428
|
-
`Failed to remove file: ${path}`,
|
|
3429
|
-
path,
|
|
3430
|
-
error
|
|
3431
|
-
);
|
|
3432
|
-
}
|
|
3433
|
-
}
|
|
3434
|
-
function removeDir(path) {
|
|
3435
|
-
try {
|
|
3436
|
-
if (exists(path) && isDirectory(path)) {
|
|
3437
|
-
rmSync(path, { recursive: true, force: true });
|
|
3438
|
-
}
|
|
3439
|
-
} catch (error) {
|
|
3440
|
-
throw new FileSystemError(
|
|
3441
|
-
`Failed to remove directory: ${path}`,
|
|
3442
|
-
path,
|
|
3443
|
-
error
|
|
3444
|
-
);
|
|
3445
|
-
}
|
|
3446
|
-
}
|
|
3447
3413
|
|
|
3448
3414
|
const messages = {
|
|
3449
3415
|
// 菜单相关
|
|
@@ -4849,10 +4815,7 @@ class ConfigInstaller extends AbstractInstaller {
|
|
|
4849
4815
|
}
|
|
4850
4816
|
copyConfigFiles("zh-CN", false);
|
|
4851
4817
|
await this.copyAiPersonalityFiles();
|
|
4852
|
-
|
|
4853
|
-
if (!workflowResult.success) {
|
|
4854
|
-
this.log(`\u5DE5\u4F5C\u6D41\u5B89\u88C5\u5931\u8D25: ${workflowResult.message}`, "warning");
|
|
4855
|
-
}
|
|
4818
|
+
await this.copyTemplateFiles();
|
|
4856
4819
|
const apiConfig = options.configData?.apiConfig;
|
|
4857
4820
|
if (apiConfig) {
|
|
4858
4821
|
const configuredApi = configureApi(apiConfig);
|
|
@@ -4926,133 +4889,22 @@ class ConfigInstaller extends AbstractInstaller {
|
|
|
4926
4889
|
}
|
|
4927
4890
|
}
|
|
4928
4891
|
/**
|
|
4929
|
-
*
|
|
4930
|
-
*
|
|
4931
|
-
*/
|
|
4932
|
-
async installWorkflows() {
|
|
4933
|
-
try {
|
|
4934
|
-
this.log("\u5F00\u59CB\u5B89\u88C5\u5DE5\u4F5C\u6D41\u6587\u4EF6...", "info");
|
|
4935
|
-
const sourceDir = join(getPackageRoot(), "templates");
|
|
4936
|
-
const agentsDir = join(sourceDir, "agents");
|
|
4937
|
-
if (exists(agentsDir) && isDirectory(agentsDir)) {
|
|
4938
|
-
const destAgentsDir = join(CLAUDE_DIR, "agents");
|
|
4939
|
-
copyDir(agentsDir, destAgentsDir, { overwrite: true });
|
|
4940
|
-
this.log("\u5DF2\u590D\u5236: agents/ \u76EE\u5F55", "info");
|
|
4941
|
-
}
|
|
4942
|
-
const commandsDir = join(sourceDir, "commands");
|
|
4943
|
-
if (exists(commandsDir) && isDirectory(commandsDir)) {
|
|
4944
|
-
const destCommandsDir = join(CLAUDE_DIR, "commands");
|
|
4945
|
-
copyDir(commandsDir, destCommandsDir, { overwrite: true });
|
|
4946
|
-
this.log("\u5DF2\u590D\u5236: commands/ \u76EE\u5F55", "info");
|
|
4947
|
-
}
|
|
4948
|
-
this.log("\u5DE5\u4F5C\u6D41\u6587\u4EF6\u5B89\u88C5\u5B8C\u6210", "success");
|
|
4949
|
-
return this.createSuccessResult("\u5DE5\u4F5C\u6D41\u6587\u4EF6\u5B89\u88C5\u5B8C\u6210");
|
|
4950
|
-
} catch (error) {
|
|
4951
|
-
return this.handleError(error, "\u5DE5\u4F5C\u6D41\u6587\u4EF6\u5B89\u88C5");
|
|
4952
|
-
}
|
|
4953
|
-
}
|
|
4954
|
-
/**
|
|
4955
|
-
* 安装所有工作流
|
|
4956
|
-
*/
|
|
4957
|
-
async installAllWorkflows() {
|
|
4958
|
-
return await this.installWorkflows();
|
|
4959
|
-
}
|
|
4960
|
-
/**
|
|
4961
|
-
* 复制 agents 和 commands 目录
|
|
4962
|
-
* 遵循先备份、再清空、最后复制的流程
|
|
4892
|
+
* 复制模板文件(agents和commands目录)
|
|
4893
|
+
* 确保完整的目录结构被复制
|
|
4963
4894
|
*/
|
|
4964
|
-
async
|
|
4965
|
-
const
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
const
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
await this.cleanDirectory(destSubDir);
|
|
4972
|
-
copyDir(sourceSubDir, destSubDir, { overwrite: true });
|
|
4973
|
-
this.log(`\u5DF2\u590D\u5236 ${dirName} \u76EE\u5F55`, "success");
|
|
4974
|
-
}
|
|
4895
|
+
async copyTemplateFiles() {
|
|
4896
|
+
const sourceDir = join(getPackageRoot(), "templates");
|
|
4897
|
+
const agentsDir = join(sourceDir, "agents");
|
|
4898
|
+
if (exists(agentsDir) && isDirectory(agentsDir)) {
|
|
4899
|
+
const destAgentsDir = join(CLAUDE_DIR, "agents");
|
|
4900
|
+
copyDir(agentsDir, destAgentsDir, { overwrite: true });
|
|
4901
|
+
this.log("\u5DF2\u590D\u5236: agents/ \u76EE\u5F55\u53CA\u5176\u6240\u6709\u5185\u5BB9", "success");
|
|
4975
4902
|
}
|
|
4976
|
-
|
|
4977
|
-
|
|
4978
|
-
|
|
4979
|
-
|
|
4980
|
-
|
|
4981
|
-
if (!exists(sourceDir)) {
|
|
4982
|
-
return;
|
|
4983
|
-
}
|
|
4984
|
-
const backupBaseDir = join(CLAUDE_DIR, "backup");
|
|
4985
|
-
const backupDir = join(backupBaseDir, dirName);
|
|
4986
|
-
ensureDir(backupDir);
|
|
4987
|
-
copyDir(sourceDir, backupDir, { overwrite: true });
|
|
4988
|
-
this.log(`\u5DF2\u5907\u4EFD ${dirName} \u76EE\u5F55\u5230: ${backupDir}`, "info");
|
|
4989
|
-
}
|
|
4990
|
-
/**
|
|
4991
|
-
* 清空目录内容(Windows兼容版本)
|
|
4992
|
-
*/
|
|
4993
|
-
async cleanDirectory(dirPath) {
|
|
4994
|
-
if (!exists(dirPath)) {
|
|
4995
|
-
ensureDir(dirPath);
|
|
4996
|
-
return;
|
|
4997
|
-
}
|
|
4998
|
-
try {
|
|
4999
|
-
const tempBackupDir = join(CLAUDE_DIR, ".temp-clean");
|
|
5000
|
-
const tempDir = join(tempBackupDir, `clean-${Date.now()}`);
|
|
5001
|
-
ensureDir(tempDir);
|
|
5002
|
-
const files = readDir(dirPath);
|
|
5003
|
-
if (files && files.length > 0) {
|
|
5004
|
-
for (const file of files) {
|
|
5005
|
-
const filePath = join(dirPath, file);
|
|
5006
|
-
try {
|
|
5007
|
-
if (isDirectory(filePath)) {
|
|
5008
|
-
removeDir(filePath);
|
|
5009
|
-
} else {
|
|
5010
|
-
removeFile(filePath);
|
|
5011
|
-
}
|
|
5012
|
-
} catch (error) {
|
|
5013
|
-
if (process.platform === "win32") {
|
|
5014
|
-
const tempFile = join(tempDir, file);
|
|
5015
|
-
try {
|
|
5016
|
-
renameSync(filePath, tempFile);
|
|
5017
|
-
this.log(`Windows\u517C\u5BB9\u5904\u7406: \u5DF2\u79FB\u52A8\u6587\u4EF6 ${file}`, "info");
|
|
5018
|
-
} catch (renameError) {
|
|
5019
|
-
this.log(`\u65E0\u6CD5\u79FB\u52A8\u6587\u4EF6 ${file}: ${renameError}`, "warning");
|
|
5020
|
-
}
|
|
5021
|
-
}
|
|
5022
|
-
}
|
|
5023
|
-
}
|
|
5024
|
-
}
|
|
5025
|
-
if (exists(tempDir)) {
|
|
5026
|
-
try {
|
|
5027
|
-
removeDir(tempDir);
|
|
5028
|
-
} catch (tempError) {
|
|
5029
|
-
this.log(`\u65E0\u6CD5\u6E05\u7406\u4E34\u65F6\u6587\u4EF6: ${tempError}`, "warning");
|
|
5030
|
-
}
|
|
5031
|
-
}
|
|
5032
|
-
this.log(`\u5DF2\u6E05\u7A7A ${dirPath} \u76EE\u5F55`, "info");
|
|
5033
|
-
} catch (error) {
|
|
5034
|
-
this.log(`\u6E05\u7A7A\u76EE\u5F55\u5931\u8D25: ${error}`, "warning");
|
|
5035
|
-
if (process.platform === "win32") {
|
|
5036
|
-
try {
|
|
5037
|
-
const dirName = basename(dirPath);
|
|
5038
|
-
const parentDir = dirname(dirPath);
|
|
5039
|
-
const backupDir = join(parentDir, `${dirName}.backup.${Date.now()}`);
|
|
5040
|
-
if (exists(dirPath)) {
|
|
5041
|
-
renameSync(dirPath, backupDir);
|
|
5042
|
-
ensureDir(dirPath);
|
|
5043
|
-
setTimeout(() => {
|
|
5044
|
-
try {
|
|
5045
|
-
removeDir(backupDir);
|
|
5046
|
-
} catch (backupError) {
|
|
5047
|
-
this.log(`\u65E0\u6CD5\u5220\u9664\u5907\u4EFD\u76EE\u5F55: ${backupError}`, "warning");
|
|
5048
|
-
}
|
|
5049
|
-
}, 1e3);
|
|
5050
|
-
this.log(`\u4F7F\u7528Windows\u5907\u9009\u65B9\u6848\u6E05\u7A7A\u76EE\u5F55: ${dirPath}`, "info");
|
|
5051
|
-
}
|
|
5052
|
-
} catch (fallbackError) {
|
|
5053
|
-
this.log(`Windows\u5907\u9009\u65B9\u6848\u4E5F\u5931\u8D25: ${fallbackError}`, "error");
|
|
5054
|
-
}
|
|
5055
|
-
}
|
|
4903
|
+
const commandsDir = join(sourceDir, "commands");
|
|
4904
|
+
if (exists(commandsDir) && isDirectory(commandsDir)) {
|
|
4905
|
+
const destCommandsDir = join(CLAUDE_DIR, "commands");
|
|
4906
|
+
copyDir(commandsDir, destCommandsDir, { overwrite: true });
|
|
4907
|
+
this.log("\u5DF2\u590D\u5236: commands/ \u76EE\u5F55\u53CA\u5176\u6240\u6709\u5185\u5BB9", "success");
|
|
5056
4908
|
}
|
|
5057
4909
|
}
|
|
5058
4910
|
}
|
|
@@ -5218,206 +5070,6 @@ const INSTALLER_NAMES = {
|
|
|
5218
5070
|
CONFIG_CHECKER: "config-checker"
|
|
5219
5071
|
};
|
|
5220
5072
|
|
|
5221
|
-
const WORKFLOW_CONFIGS = [
|
|
5222
|
-
{
|
|
5223
|
-
id: "sixStepsWorkflow",
|
|
5224
|
-
nameKey: "workflowOption.sixStepsWorkflow",
|
|
5225
|
-
descriptionKey: "workflowDescription.sixStepsWorkflow",
|
|
5226
|
-
defaultSelected: true,
|
|
5227
|
-
order: 1,
|
|
5228
|
-
commands: ["workflow.md"],
|
|
5229
|
-
agents: [],
|
|
5230
|
-
autoInstallAgents: false,
|
|
5231
|
-
category: "sixStep",
|
|
5232
|
-
outputDir: "workflow"
|
|
5233
|
-
},
|
|
5234
|
-
{
|
|
5235
|
-
id: "featPlanUx",
|
|
5236
|
-
nameKey: "workflowOption.featPlanUx",
|
|
5237
|
-
descriptionKey: "workflowDescription.featPlanUx",
|
|
5238
|
-
defaultSelected: true,
|
|
5239
|
-
order: 2,
|
|
5240
|
-
commands: ["feat.md"],
|
|
5241
|
-
agents: [
|
|
5242
|
-
{ id: "planner", filename: "planner.md", required: true },
|
|
5243
|
-
{ id: "ui-ux-designer", filename: "ui-ux-designer.md", required: true }
|
|
5244
|
-
],
|
|
5245
|
-
autoInstallAgents: true,
|
|
5246
|
-
category: "plan",
|
|
5247
|
-
outputDir: "feat"
|
|
5248
|
-
},
|
|
5249
|
-
{
|
|
5250
|
-
id: "bmadWorkflow",
|
|
5251
|
-
nameKey: "workflowOption.bmadWorkflow",
|
|
5252
|
-
descriptionKey: "workflowDescription.bmadWorkflow",
|
|
5253
|
-
defaultSelected: false,
|
|
5254
|
-
order: 3,
|
|
5255
|
-
commands: ["bmad-init.md"],
|
|
5256
|
-
agents: [],
|
|
5257
|
-
autoInstallAgents: false,
|
|
5258
|
-
category: "bmad",
|
|
5259
|
-
outputDir: "bmad"
|
|
5260
|
-
},
|
|
5261
|
-
{
|
|
5262
|
-
id: "gitWorkflow",
|
|
5263
|
-
nameKey: "workflowOption.gitWorkflow",
|
|
5264
|
-
descriptionKey: "workflowDescription.gitWorkflow",
|
|
5265
|
-
defaultSelected: false,
|
|
5266
|
-
order: 4,
|
|
5267
|
-
commands: ["git-commit.md", "git-rollback.md", "git-cleanBranches.md", "git-worktree.md"],
|
|
5268
|
-
agents: [],
|
|
5269
|
-
autoInstallAgents: false,
|
|
5270
|
-
category: "git",
|
|
5271
|
-
outputDir: "git"
|
|
5272
|
-
}
|
|
5273
|
-
];
|
|
5274
|
-
function getWorkflowConfig(workflowId) {
|
|
5275
|
-
return WORKFLOW_CONFIGS.find((config) => config.id === workflowId);
|
|
5276
|
-
}
|
|
5277
|
-
function getOrderedWorkflows() {
|
|
5278
|
-
return [...WORKFLOW_CONFIGS].sort((a, b) => a.order - b.order);
|
|
5279
|
-
}
|
|
5280
|
-
|
|
5281
|
-
function getRootDir() {
|
|
5282
|
-
const currentFilePath = fileURLToPath(import.meta.url);
|
|
5283
|
-
const distDir = dirname(dirname(currentFilePath));
|
|
5284
|
-
return dirname(distDir);
|
|
5285
|
-
}
|
|
5286
|
-
async function selectAndInstallWorkflows(configLang, scriptLang, preselectedWorkflows) {
|
|
5287
|
-
const workflows = getOrderedWorkflows();
|
|
5288
|
-
workflows.map((workflow) => {
|
|
5289
|
-
const nameKey = workflow.id;
|
|
5290
|
-
const name = messages.workflow.selectWorkflowType[nameKey] || workflow.id;
|
|
5291
|
-
return {
|
|
5292
|
-
name,
|
|
5293
|
-
value: workflow.id,
|
|
5294
|
-
checked: workflow.defaultSelected
|
|
5295
|
-
};
|
|
5296
|
-
});
|
|
5297
|
-
let selectedWorkflows;
|
|
5298
|
-
if (preselectedWorkflows) {
|
|
5299
|
-
selectedWorkflows = preselectedWorkflows;
|
|
5300
|
-
} else {
|
|
5301
|
-
selectedWorkflows = workflows.map((w) => w.id);
|
|
5302
|
-
}
|
|
5303
|
-
if (!selectedWorkflows || selectedWorkflows.length === 0) {
|
|
5304
|
-
console.log(ansis.yellow(messages.common.cancelled));
|
|
5305
|
-
return;
|
|
5306
|
-
}
|
|
5307
|
-
await cleanupOldVersionFiles();
|
|
5308
|
-
for (const workflowId of selectedWorkflows) {
|
|
5309
|
-
const config = getWorkflowConfig(workflowId);
|
|
5310
|
-
if (config) {
|
|
5311
|
-
await installWorkflowWithDependencies(config, configLang);
|
|
5312
|
-
}
|
|
5313
|
-
}
|
|
5314
|
-
}
|
|
5315
|
-
async function installWorkflowWithDependencies(config, configLang, scriptLang) {
|
|
5316
|
-
const rootDir = getRootDir();
|
|
5317
|
-
const result = {
|
|
5318
|
-
workflow: config.id,
|
|
5319
|
-
success: true,
|
|
5320
|
-
installedCommands: [],
|
|
5321
|
-
installedAgents: [],
|
|
5322
|
-
errors: []
|
|
5323
|
-
};
|
|
5324
|
-
const workflowName = messages.workflow.selectWorkflowType[config.id] || config.id;
|
|
5325
|
-
console.log(ansis.cyan(`
|
|
5326
|
-
\u{1F4E6} ${messages.workflow.installing}: ${workflowName}...`));
|
|
5327
|
-
const commandsDir = join(CLAUDE_DIR, "commands", "aico");
|
|
5328
|
-
if (!existsSync(commandsDir)) {
|
|
5329
|
-
await mkdir(commandsDir, { recursive: true });
|
|
5330
|
-
}
|
|
5331
|
-
for (const commandFile of config.commands) {
|
|
5332
|
-
const commandSource = join(rootDir, "templates", configLang, "workflow", config.category, "commands", commandFile);
|
|
5333
|
-
const destFileName = commandFile;
|
|
5334
|
-
const commandDest = join(commandsDir, destFileName);
|
|
5335
|
-
if (existsSync(commandSource)) {
|
|
5336
|
-
try {
|
|
5337
|
-
await copyFile$1(commandSource, commandDest);
|
|
5338
|
-
result.installedCommands.push(destFileName);
|
|
5339
|
-
console.log(ansis.gray(` \u2714 ${messages.workflow.installedCommand}: aico/${destFileName}`));
|
|
5340
|
-
} catch (error) {
|
|
5341
|
-
const errorMsg = `${messages.workflow.failedToInstallCommand} ${commandFile}: ${error}`;
|
|
5342
|
-
result.errors?.push(errorMsg);
|
|
5343
|
-
console.error(ansis.red(` \u2717 ${errorMsg}`));
|
|
5344
|
-
result.success = false;
|
|
5345
|
-
}
|
|
5346
|
-
}
|
|
5347
|
-
}
|
|
5348
|
-
if (config.autoInstallAgents && config.agents.length > 0) {
|
|
5349
|
-
const agentsCategoryDir = join(CLAUDE_DIR, "agents", "aico", config.category);
|
|
5350
|
-
if (!existsSync(agentsCategoryDir)) {
|
|
5351
|
-
await mkdir(agentsCategoryDir, { recursive: true });
|
|
5352
|
-
}
|
|
5353
|
-
for (const agent of config.agents) {
|
|
5354
|
-
const agentSource = join(rootDir, "templates", configLang, "workflow", config.category, "agents", agent.filename);
|
|
5355
|
-
const agentDest = join(agentsCategoryDir, agent.filename);
|
|
5356
|
-
if (existsSync(agentSource)) {
|
|
5357
|
-
try {
|
|
5358
|
-
await copyFile$1(agentSource, agentDest);
|
|
5359
|
-
result.installedAgents.push(agent.filename);
|
|
5360
|
-
console.log(ansis.gray(` \u2714 ${messages.workflow.installedAgent}: aico/${config.category}/${agent.filename}`));
|
|
5361
|
-
} catch (error) {
|
|
5362
|
-
const errorMsg = `${messages.workflow.failedToInstallAgent} ${agent.filename}: ${error}`;
|
|
5363
|
-
result.errors?.push(errorMsg);
|
|
5364
|
-
console.error(ansis.red(` \u2717 ${errorMsg}`));
|
|
5365
|
-
if (agent.required) {
|
|
5366
|
-
result.success = false;
|
|
5367
|
-
}
|
|
5368
|
-
}
|
|
5369
|
-
}
|
|
5370
|
-
}
|
|
5371
|
-
}
|
|
5372
|
-
if (result.success) {
|
|
5373
|
-
console.log(ansis.green(`\u2714 ${workflowName} ${messages.workflow.installSuccess}`));
|
|
5374
|
-
if (config.id === "bmadWorkflow") {
|
|
5375
|
-
console.log(ansis.cyan(`
|
|
5376
|
-
${messages.workflow.bmadInitPrompt}`));
|
|
5377
|
-
}
|
|
5378
|
-
} else {
|
|
5379
|
-
console.log(ansis.red(`\u2717 ${workflowName} ${messages.workflow.installFailed}`));
|
|
5380
|
-
}
|
|
5381
|
-
return result;
|
|
5382
|
-
}
|
|
5383
|
-
async function cleanupOldVersionFiles(scriptLang) {
|
|
5384
|
-
console.log(ansis.cyan(`
|
|
5385
|
-
\u{1F9F9} ${messages.workflow.cleaningOldFiles || "Cleaning up old version files"}...`));
|
|
5386
|
-
const oldCommandFiles = [
|
|
5387
|
-
join(CLAUDE_DIR, "commands", "workflow.md"),
|
|
5388
|
-
join(CLAUDE_DIR, "commands", "feat.md")
|
|
5389
|
-
];
|
|
5390
|
-
const oldAgentFiles = [
|
|
5391
|
-
join(CLAUDE_DIR, "agents", "planner.md"),
|
|
5392
|
-
join(CLAUDE_DIR, "agents", "ui-ux-designer.md")
|
|
5393
|
-
];
|
|
5394
|
-
for (const file of oldCommandFiles) {
|
|
5395
|
-
if (existsSync(file)) {
|
|
5396
|
-
try {
|
|
5397
|
-
await rm(file, { force: true });
|
|
5398
|
-
console.log(ansis.gray(` \u2714 ${messages.workflow.removedOldFile || "Removed old file"}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
5399
|
-
} catch (error) {
|
|
5400
|
-
console.error(ansis.yellow(` \u26A0 ${messages.workflow.failedToRemoveFile || "Failed to remove"}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
5401
|
-
}
|
|
5402
|
-
}
|
|
5403
|
-
}
|
|
5404
|
-
for (const file of oldAgentFiles) {
|
|
5405
|
-
if (existsSync(file)) {
|
|
5406
|
-
try {
|
|
5407
|
-
await rm(file, { force: true });
|
|
5408
|
-
console.log(ansis.gray(` \u2714 ${messages.workflow.removedOldFile || "Removed old file"}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
5409
|
-
} catch (error) {
|
|
5410
|
-
console.error(ansis.yellow(` \u26A0 ${messages.workflow.failedToRemoveFile || "Failed to remove"}: ${file.replace(CLAUDE_DIR, "~/.claude")}`));
|
|
5411
|
-
}
|
|
5412
|
-
}
|
|
5413
|
-
}
|
|
5414
|
-
}
|
|
5415
|
-
|
|
5416
|
-
const workflowInstaller = {
|
|
5417
|
-
__proto__: null,
|
|
5418
|
-
selectAndInstallWorkflows: selectAndInstallWorkflows
|
|
5419
|
-
};
|
|
5420
|
-
|
|
5421
5073
|
class InstallationComposer {
|
|
5422
5074
|
executor;
|
|
5423
5075
|
context;
|
|
@@ -5492,8 +5144,6 @@ class InstallationComposer {
|
|
|
5492
5144
|
const companyResults = await this.executor.executeBatch(companySteps, configOptions);
|
|
5493
5145
|
const configInstaller = new ConfigInstaller(this.context);
|
|
5494
5146
|
await configInstaller.applyCompanyConfig();
|
|
5495
|
-
console.log(ansis.cyan("\n\u{1F4E6} \u5B89\u88C5\u5DE5\u4F5C\u6D41\u6A21\u677F..."));
|
|
5496
|
-
await selectAndInstallWorkflows("zh-CN");
|
|
5497
5147
|
this.updateGlobalConfig();
|
|
5498
5148
|
this.printResults({ ...results, ...companyResults }, "\u516C\u53F8\u914D\u7F6E");
|
|
5499
5149
|
} else {
|
|
@@ -5507,8 +5157,6 @@ class InstallationComposer {
|
|
|
5507
5157
|
const companyResults = await this.executor.executeBatch(companySteps, configOptions);
|
|
5508
5158
|
const configInstaller = new ConfigInstaller(this.context);
|
|
5509
5159
|
await configInstaller.applyCompanyConfig();
|
|
5510
|
-
console.log(ansis.cyan("\n\u{1F4E6} \u5B89\u88C5\u5DE5\u4F5C\u6D41\u6A21\u677F..."));
|
|
5511
|
-
await selectAndInstallWorkflows("zh-CN");
|
|
5512
5160
|
this.updateGlobalConfig();
|
|
5513
5161
|
this.printResults({ ...results, ...companyResults }, "\u516C\u53F8\u914D\u7F6E");
|
|
5514
5162
|
}
|
|
@@ -5535,8 +5183,6 @@ class InstallationComposer {
|
|
|
5535
5183
|
if (results[INSTALLER_NAMES.CCR]?.success) {
|
|
5536
5184
|
await this.configureCCRForPersonal();
|
|
5537
5185
|
}
|
|
5538
|
-
console.log(ansis.cyan("\n\u{1F4E6} \u5B89\u88C5\u5DE5\u4F5C\u6D41\u6A21\u677F..."));
|
|
5539
|
-
await selectAndInstallWorkflows("zh-CN");
|
|
5540
5186
|
this.updateGlobalConfig();
|
|
5541
5187
|
this.printResults(results, "\u4E2A\u4EBA\u914D\u7F6E");
|
|
5542
5188
|
}
|
|
@@ -5772,4 +5418,4 @@ async function openSettingsJson() {
|
|
|
5772
5418
|
}
|
|
5773
5419
|
}
|
|
5774
5420
|
|
|
5775
|
-
export { AICO_CONFIG_FILE as A, mergeMcpServers as B, CLAUDE_DIR as C, buildMcpServerConfig as D, fixWindowsMcpConfig as E, addCompletedOnboarding as F, readJsonConfig as G, isTermux as H, messages as I, getTermuxPrefix as J, createEscapablePrompt as K, LEGACY_AICO_CONFIG_FILE as L, MCP_SERVICES as M, displayBannerWithInfo as N, executeWithEscapeSupport as O, handleExitPromptError as P, handleGeneralError as Q, EscapeKeyPressed as R, SETTINGS_FILE as S, displayBanner as T, version as U, ConfigCheckerInstaller as V, InstallerExecutor as W,
|
|
5421
|
+
export { AICO_CONFIG_FILE as A, mergeMcpServers as B, CLAUDE_DIR as C, buildMcpServerConfig as D, fixWindowsMcpConfig as E, addCompletedOnboarding as F, readJsonConfig as G, isTermux as H, messages as I, getTermuxPrefix as J, createEscapablePrompt as K, LEGACY_AICO_CONFIG_FILE as L, MCP_SERVICES as M, displayBannerWithInfo as N, executeWithEscapeSupport as O, handleExitPromptError as P, handleGeneralError as Q, EscapeKeyPressed as R, SETTINGS_FILE as S, displayBanner as T, version as U, ConfigCheckerInstaller as V, InstallerExecutor as W, init$1 as X, importRecommendedEnv as a, importRecommendedPermissions as b, commandExists as c, cleanupPermissions as d, CLAUDE_MD_FILE as e, ClAUDE_CONFIG_FILE as f, getPlatform as g, SUPPORTED_LANGS as h, init as i, LANG_LABELS as j, AI_OUTPUT_LANGUAGES as k, ensureClaudeDir as l, mergeAndCleanPermissions as m, backupExistingConfig as n, openSettingsJson as o, copyConfigFiles as p, configureApi as q, mergeConfigs as r, mergeSettingsFile as s, getExistingApiConfig as t, updateDefaultModel as u, applyAiLanguageDirective as v, getMcpConfigPath as w, readMcpConfig as x, writeMcpConfig as y, backupMcpConfig as z };
|
package/dist/cli.mjs
CHANGED
|
@@ -9,7 +9,6 @@ import 'node:os';
|
|
|
9
9
|
import 'node:fs';
|
|
10
10
|
import 'pathe';
|
|
11
11
|
import 'node:url';
|
|
12
|
-
import 'node:fs/promises';
|
|
13
12
|
import 'node:path';
|
|
14
13
|
import { exec } from 'child_process';
|
|
15
14
|
import { promisify } from 'util';
|
|
@@ -342,7 +341,7 @@ function setupCommands(cli) {
|
|
|
342
341
|
} else if (options.update) {
|
|
343
342
|
await update({});
|
|
344
343
|
} else if (options.company) {
|
|
345
|
-
const { init: init2 } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
344
|
+
const { init: init2 } = await import('./chunks/simple-config.mjs').then(function (n) { return n.X; });
|
|
346
345
|
await init2({
|
|
347
346
|
apiType: "auth_token",
|
|
348
347
|
force: options.force,
|
|
@@ -350,7 +349,7 @@ function setupCommands(cli) {
|
|
|
350
349
|
skipPrompt: true
|
|
351
350
|
});
|
|
352
351
|
} else if (options.personal) {
|
|
353
|
-
const { init: init2 } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
352
|
+
const { init: init2 } = await import('./chunks/simple-config.mjs').then(function (n) { return n.X; });
|
|
354
353
|
await init2({
|
|
355
354
|
apiType: "ccr_proxy",
|
|
356
355
|
force: options.force,
|
|
@@ -384,7 +383,7 @@ async function startCodeEditor() {
|
|
|
384
383
|
}
|
|
385
384
|
} else {
|
|
386
385
|
console.log(ansis.yellow("\u26A0\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\uFF0C\u5C06\u5148\u6267\u884C\u521D\u59CB\u5316\u914D\u7F6E..."));
|
|
387
|
-
const { init: init2 } = await import('./chunks/simple-config.mjs').then(function (n) { return n.
|
|
386
|
+
const { init: init2 } = await import('./chunks/simple-config.mjs').then(function (n) { return n.X; });
|
|
388
387
|
await init2({ skipBanner: true, skipPrompt: true });
|
|
389
388
|
}
|
|
390
389
|
await startClaudeCodeEditor();
|
|
@@ -428,15 +427,9 @@ async function installMissingFeatures(context, _featureStatus, missingFeatures)
|
|
|
428
427
|
// workflow 和 aiPersonality 需要特殊处理,不能映射到 config-checker
|
|
429
428
|
};
|
|
430
429
|
for (const featureName of missingFeatures) {
|
|
431
|
-
if (featureName === "
|
|
430
|
+
if (featureName === "aiPersonality") {
|
|
432
431
|
console.log(ansis.blue(`\u{1F4E6} \u5B89\u88C5\u529F\u80FD: ${featureName}...`));
|
|
433
|
-
|
|
434
|
-
const { selectAndInstallWorkflows } = await import('./chunks/simple-config.mjs').then(function (n) { return n.X; });
|
|
435
|
-
await selectAndInstallWorkflows("zh-CN", "zh-CN");
|
|
436
|
-
console.log(ansis.green(`\u2705 ${featureName} \u5B89\u88C5\u6210\u529F`));
|
|
437
|
-
} catch (error) {
|
|
438
|
-
console.log(ansis.yellow(`\u26A0\uFE0F ${featureName} \u5B89\u88C5\u5931\u8D25: ${error instanceof Error ? error.message : String(error)}`));
|
|
439
|
-
}
|
|
432
|
+
console.log(ansis.green(`\u2705 ${featureName} \u5B89\u88C5\u6210\u529F`));
|
|
440
433
|
} else {
|
|
441
434
|
const installerName = featureToInstallerMap[featureName];
|
|
442
435
|
if (installerName) {
|
package/dist/index.mjs
CHANGED