aico-cli 0.2.4 → 0.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/feature-checker.mjs +2 -2
- package/dist/chunks/simple-config.mjs +206 -64
- package/dist/cli.mjs +5 -5
- package/dist/index.d.mts +16 -2
- package/dist/index.d.ts +16 -2
- package/dist/index.mjs +2 -2
- package/dist/shared/{aico-cli.C9hv-Gol.mjs → aico-cli.CWSSz8Hk.mjs} +1 -1
- package/package.json +1 -1
- package/templates/CLAUDE.md +2 -71
- package/templates/agents/aico/requirement/PLATFORM_COMPATIBILITY.md +219 -0
- package/templates/agents/aico/requirement/crossplatform-utils.sh +307 -0
- package/templates/agents/aico/requirement/requirement-functions-crossplatform.sh +472 -0
- package/templates/agents/aico/requirement/requirement-identifier.md +286 -156
- package/templates/agents/aico/requirement/requirement-launcher.sh +146 -0
- package/templates/agents/aico/requirement/task-executor.md +100 -34
- package/templates/commands/aico/requirement.md +7 -1
- package/templates/personality.md +120 -235
- package/templates/base.md +0 -51
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs';
|
|
2
2
|
import { join } from 'pathe';
|
|
3
|
-
import { S as SETTINGS_FILE,
|
|
4
|
-
import { i as isClaudeCodeInstalled } from '../shared/aico-cli.
|
|
3
|
+
import { S as SETTINGS_FILE, I as readJsonConfig, C as CLAUDE_DIR } from './simple-config.mjs';
|
|
4
|
+
import { i as isClaudeCodeInstalled } from '../shared/aico-cli.CWSSz8Hk.mjs';
|
|
5
5
|
import 'ansis';
|
|
6
6
|
import 'inquirer';
|
|
7
7
|
import 'tinyexec';
|
|
@@ -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,
|
|
5
|
+
import { existsSync, readFileSync, writeFileSync, mkdirSync, copyFileSync, readdirSync, statSync, unlinkSync, rmSync } 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,10 +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 } from 'pathe';
|
|
13
|
+
import { join, dirname, basename } from 'pathe';
|
|
14
14
|
import { fileURLToPath } from 'node:url';
|
|
15
15
|
|
|
16
|
-
const version = "0.2.
|
|
16
|
+
const version = "0.2.5";
|
|
17
17
|
|
|
18
18
|
function displayBanner(subtitle) {
|
|
19
19
|
const defaultSubtitle = "\u4E00\u952E\u914D\u7F6E\u4F60\u7684\u5F00\u53D1\u73AF\u5883";
|
|
@@ -3386,6 +3386,13 @@ function isDirectory(path) {
|
|
|
3386
3386
|
return false;
|
|
3387
3387
|
}
|
|
3388
3388
|
}
|
|
3389
|
+
function isFile(path) {
|
|
3390
|
+
try {
|
|
3391
|
+
return getStats(path).isFile();
|
|
3392
|
+
} catch {
|
|
3393
|
+
return false;
|
|
3394
|
+
}
|
|
3395
|
+
}
|
|
3389
3396
|
function copyDir(src, dest, options = {}) {
|
|
3390
3397
|
const { filter, overwrite = true } = options;
|
|
3391
3398
|
if (!exists(src)) {
|
|
@@ -3394,8 +3401,8 @@ function copyDir(src, dest, options = {}) {
|
|
|
3394
3401
|
ensureDir(dest);
|
|
3395
3402
|
const entries = readDir(src);
|
|
3396
3403
|
for (const entry of entries) {
|
|
3397
|
-
const srcPath =
|
|
3398
|
-
const destPath =
|
|
3404
|
+
const srcPath = `${src}/${entry}`;
|
|
3405
|
+
const destPath = `${dest}/${entry}`;
|
|
3399
3406
|
const stats = getStats(srcPath);
|
|
3400
3407
|
if (filter && !filter(srcPath, stats)) {
|
|
3401
3408
|
continue;
|
|
@@ -3410,6 +3417,32 @@ function copyDir(src, dest, options = {}) {
|
|
|
3410
3417
|
}
|
|
3411
3418
|
}
|
|
3412
3419
|
}
|
|
3420
|
+
function removeFile(path) {
|
|
3421
|
+
try {
|
|
3422
|
+
if (exists(path) && isFile(path)) {
|
|
3423
|
+
unlinkSync(path);
|
|
3424
|
+
}
|
|
3425
|
+
} catch (error) {
|
|
3426
|
+
throw new FileSystemError(
|
|
3427
|
+
`Failed to remove file: ${path}`,
|
|
3428
|
+
path,
|
|
3429
|
+
error
|
|
3430
|
+
);
|
|
3431
|
+
}
|
|
3432
|
+
}
|
|
3433
|
+
function removeDir(path) {
|
|
3434
|
+
try {
|
|
3435
|
+
if (exists(path) && isDirectory(path)) {
|
|
3436
|
+
rmSync(path, { recursive: true, force: true });
|
|
3437
|
+
}
|
|
3438
|
+
} catch (error) {
|
|
3439
|
+
throw new FileSystemError(
|
|
3440
|
+
`Failed to remove directory: ${path}`,
|
|
3441
|
+
path,
|
|
3442
|
+
error
|
|
3443
|
+
);
|
|
3444
|
+
}
|
|
3445
|
+
}
|
|
3413
3446
|
|
|
3414
3447
|
const messages = {
|
|
3415
3448
|
// 菜单相关
|
|
@@ -4637,6 +4670,130 @@ function copyConfigFiles(lang, onlyMd = false) {
|
|
|
4637
4670
|
copyFile(claudeMdSource, claudeMdDest);
|
|
4638
4671
|
}
|
|
4639
4672
|
}
|
|
4673
|
+
const DEFAULT_FILE_COPY_CONFIGS = [
|
|
4674
|
+
{
|
|
4675
|
+
source: "templates/agents",
|
|
4676
|
+
destination: join(CLAUDE_DIR, "agents"),
|
|
4677
|
+
type: "directory",
|
|
4678
|
+
options: {
|
|
4679
|
+
mergeStrategy: "copy",
|
|
4680
|
+
backupBeforeCopy: true,
|
|
4681
|
+
deleteBeforeCopy: true
|
|
4682
|
+
}
|
|
4683
|
+
},
|
|
4684
|
+
{
|
|
4685
|
+
source: "templates/commands",
|
|
4686
|
+
destination: join(CLAUDE_DIR, "commands"),
|
|
4687
|
+
type: "directory",
|
|
4688
|
+
options: {
|
|
4689
|
+
mergeStrategy: "copy",
|
|
4690
|
+
backupBeforeCopy: true,
|
|
4691
|
+
deleteBeforeCopy: true
|
|
4692
|
+
}
|
|
4693
|
+
},
|
|
4694
|
+
{
|
|
4695
|
+
source: "templates/personality.md",
|
|
4696
|
+
destination: join(CLAUDE_DIR, "personality.md"),
|
|
4697
|
+
type: "file",
|
|
4698
|
+
options: {
|
|
4699
|
+
mergeStrategy: "copy",
|
|
4700
|
+
backupBeforeCopy: true,
|
|
4701
|
+
deleteBeforeCopy: true
|
|
4702
|
+
}
|
|
4703
|
+
},
|
|
4704
|
+
{
|
|
4705
|
+
source: "templates/language.md",
|
|
4706
|
+
destination: join(CLAUDE_DIR, "language.md"),
|
|
4707
|
+
type: "file",
|
|
4708
|
+
options: {
|
|
4709
|
+
mergeStrategy: "copy",
|
|
4710
|
+
backupBeforeCopy: true,
|
|
4711
|
+
deleteBeforeCopy: true
|
|
4712
|
+
}
|
|
4713
|
+
},
|
|
4714
|
+
{
|
|
4715
|
+
source: "templates/CLAUDE.md",
|
|
4716
|
+
destination: join(CLAUDE_DIR, "CLAUDE.md"),
|
|
4717
|
+
type: "file",
|
|
4718
|
+
options: {
|
|
4719
|
+
mergeStrategy: "copy",
|
|
4720
|
+
backupBeforeCopy: true,
|
|
4721
|
+
deleteBeforeCopy: true
|
|
4722
|
+
}
|
|
4723
|
+
},
|
|
4724
|
+
{
|
|
4725
|
+
source: "templates/settings.json",
|
|
4726
|
+
destination: join(CLAUDE_DIR, "settings.json"),
|
|
4727
|
+
type: "file",
|
|
4728
|
+
options: {
|
|
4729
|
+
mergeStrategy: "merge",
|
|
4730
|
+
backupBeforeCopy: true,
|
|
4731
|
+
deleteBeforeCopy: true
|
|
4732
|
+
}
|
|
4733
|
+
}
|
|
4734
|
+
];
|
|
4735
|
+
function copyConfigFilesWithConfig(configs = DEFAULT_FILE_COPY_CONFIGS) {
|
|
4736
|
+
const currentFilePath = fileURLToPath(import.meta.url);
|
|
4737
|
+
const distDir = dirname(dirname(currentFilePath));
|
|
4738
|
+
const rootDir = dirname(distDir);
|
|
4739
|
+
for (const config of configs) {
|
|
4740
|
+
const sourcePath = join(rootDir, config.source);
|
|
4741
|
+
const destPath = config.destination;
|
|
4742
|
+
if (!exists(sourcePath)) {
|
|
4743
|
+
console.warn(`\u6E90\u6587\u4EF6\u4E0D\u5B58\u5728: ${sourcePath}`);
|
|
4744
|
+
continue;
|
|
4745
|
+
}
|
|
4746
|
+
if (config.type === "file") {
|
|
4747
|
+
handleFileCopy(sourcePath, destPath, config.options);
|
|
4748
|
+
} else if (config.type === "directory") {
|
|
4749
|
+
handleDirectoryCopy(sourcePath, destPath, config.options);
|
|
4750
|
+
}
|
|
4751
|
+
}
|
|
4752
|
+
}
|
|
4753
|
+
function handleFileCopy(sourcePath, destPath, options) {
|
|
4754
|
+
const destExists = exists(destPath);
|
|
4755
|
+
if (options?.backupBeforeCopy && destExists) {
|
|
4756
|
+
const backupDir = join(CLAUDE_DIR, "backup", "latest");
|
|
4757
|
+
ensureDir(backupDir);
|
|
4758
|
+
const backupPath = join(backupDir, basename(destPath));
|
|
4759
|
+
copyFile(destPath, backupPath);
|
|
4760
|
+
}
|
|
4761
|
+
if (options?.deleteBeforeCopy && destExists) {
|
|
4762
|
+
removeFile(destPath);
|
|
4763
|
+
}
|
|
4764
|
+
if (options?.mergeStrategy === "skip-if-exists" && destExists) {
|
|
4765
|
+
return;
|
|
4766
|
+
}
|
|
4767
|
+
if (options?.mergeStrategy === "merge" && destExists) {
|
|
4768
|
+
if (sourcePath.endsWith(".json")) {
|
|
4769
|
+
mergeSettingsFile(sourcePath, destPath);
|
|
4770
|
+
} else {
|
|
4771
|
+
copyFile(sourcePath, destPath);
|
|
4772
|
+
}
|
|
4773
|
+
} else {
|
|
4774
|
+
copyFile(sourcePath, destPath);
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
function handleDirectoryCopy(sourcePath, destPath, options) {
|
|
4778
|
+
const destExists = exists(destPath);
|
|
4779
|
+
if (options?.backupBeforeCopy && destExists) {
|
|
4780
|
+
const backupDir = join(CLAUDE_DIR, "backup", "latest");
|
|
4781
|
+
ensureDir(backupDir);
|
|
4782
|
+
const backupPath = join(backupDir, basename(destPath));
|
|
4783
|
+
copyDir(destPath, backupPath, {
|
|
4784
|
+
overwrite: true,
|
|
4785
|
+
filter: options?.filter
|
|
4786
|
+
});
|
|
4787
|
+
}
|
|
4788
|
+
if (options?.deleteBeforeCopy && destExists) {
|
|
4789
|
+
removeDir(destPath);
|
|
4790
|
+
}
|
|
4791
|
+
ensureDir(destPath);
|
|
4792
|
+
copyDir(sourcePath, destPath, {
|
|
4793
|
+
overwrite: options?.overwrite ?? true,
|
|
4794
|
+
filter: options?.filter
|
|
4795
|
+
});
|
|
4796
|
+
}
|
|
4640
4797
|
function copyClaudeMemoryFiles(lang, rootDir) {
|
|
4641
4798
|
const memorySourceDir = join(rootDir, "templates");
|
|
4642
4799
|
if (!exists(memorySourceDir)) {
|
|
@@ -4771,34 +4928,14 @@ function applyAiLanguageDirective(aiOutputLang) {
|
|
|
4771
4928
|
writeFile(languageFile, directive);
|
|
4772
4929
|
}
|
|
4773
4930
|
|
|
4774
|
-
function getPackageRoot() {
|
|
4775
|
-
let currentDir = process.cwd();
|
|
4776
|
-
let attempts = 0;
|
|
4777
|
-
const maxAttempts = 10;
|
|
4778
|
-
while (attempts < maxAttempts) {
|
|
4779
|
-
const claudeDir = join(currentDir, ".claude");
|
|
4780
|
-
const packageJson = join(currentDir, "package.json");
|
|
4781
|
-
if (exists(claudeDir) && exists(packageJson)) {
|
|
4782
|
-
return currentDir;
|
|
4783
|
-
}
|
|
4784
|
-
const parentDir = dirname(currentDir);
|
|
4785
|
-
if (parentDir === currentDir) {
|
|
4786
|
-
break;
|
|
4787
|
-
}
|
|
4788
|
-
currentDir = parentDir;
|
|
4789
|
-
attempts++;
|
|
4790
|
-
}
|
|
4791
|
-
return process.cwd();
|
|
4792
|
-
}
|
|
4793
|
-
|
|
4794
4931
|
class ConfigInstaller extends AbstractInstaller {
|
|
4795
4932
|
name = "Config";
|
|
4933
|
+
fileCopyConfigs = DEFAULT_FILE_COPY_CONFIGS;
|
|
4796
4934
|
async checkStatus() {
|
|
4797
4935
|
const settingsInstalled = existsSync(SETTINGS_FILE);
|
|
4798
4936
|
const personalityInstalled = existsSync(join(CLAUDE_DIR, "personality.md"));
|
|
4799
|
-
const baseInstalled = existsSync(join(CLAUDE_DIR, "base.md"));
|
|
4800
4937
|
const languageInstalled = existsSync(join(CLAUDE_DIR, "language.md"));
|
|
4801
|
-
return { isInstalled: settingsInstalled && personalityInstalled &&
|
|
4938
|
+
return { isInstalled: settingsInstalled && personalityInstalled && languageInstalled };
|
|
4802
4939
|
}
|
|
4803
4940
|
async install(options = {}) {
|
|
4804
4941
|
try {
|
|
@@ -4813,9 +4950,7 @@ class ConfigInstaller extends AbstractInstaller {
|
|
|
4813
4950
|
this.log(`\u5907\u4EFD\u6210\u529F: ${backupPath}`, "info");
|
|
4814
4951
|
}
|
|
4815
4952
|
}
|
|
4816
|
-
|
|
4817
|
-
await this.copyAiPersonalityFiles();
|
|
4818
|
-
await this.copyTemplateFiles();
|
|
4953
|
+
this.copyConfigFilesWithOptions(options);
|
|
4819
4954
|
const apiConfig = options.configData?.apiConfig;
|
|
4820
4955
|
if (apiConfig) {
|
|
4821
4956
|
const configuredApi = configureApi(apiConfig);
|
|
@@ -4831,6 +4966,31 @@ class ConfigInstaller extends AbstractInstaller {
|
|
|
4831
4966
|
return this.handleError(error, "\u914D\u7F6E\u5B89\u88C5");
|
|
4832
4967
|
}
|
|
4833
4968
|
}
|
|
4969
|
+
/**
|
|
4970
|
+
* 使用可配置的文件复制机制
|
|
4971
|
+
*/
|
|
4972
|
+
copyConfigFilesWithOptions(options) {
|
|
4973
|
+
const customConfigs = [
|
|
4974
|
+
...this.fileCopyConfigs,
|
|
4975
|
+
{
|
|
4976
|
+
source: "templates",
|
|
4977
|
+
destination: CLAUDE_DIR,
|
|
4978
|
+
type: "directory",
|
|
4979
|
+
options: {
|
|
4980
|
+
filter: (path) => !path.includes("/backup"),
|
|
4981
|
+
mergeStrategy: "copy"
|
|
4982
|
+
}
|
|
4983
|
+
}
|
|
4984
|
+
];
|
|
4985
|
+
if (options.onlyMdFiles) {
|
|
4986
|
+
const filteredConfigs = customConfigs.filter(
|
|
4987
|
+
(config) => config.source.endsWith(".md") || config.type === "directory"
|
|
4988
|
+
);
|
|
4989
|
+
copyConfigFilesWithConfig(filteredConfigs);
|
|
4990
|
+
} else {
|
|
4991
|
+
copyConfigFilesWithConfig(customConfigs);
|
|
4992
|
+
}
|
|
4993
|
+
}
|
|
4834
4994
|
/**
|
|
4835
4995
|
* 应用公司预设配置
|
|
4836
4996
|
*/
|
|
@@ -4869,43 +5029,25 @@ class ConfigInstaller extends AbstractInstaller {
|
|
|
4869
5029
|
}
|
|
4870
5030
|
}
|
|
4871
5031
|
/**
|
|
4872
|
-
*
|
|
4873
|
-
*
|
|
5032
|
+
* 设置文件复制配置
|
|
5033
|
+
* 允许外部调整需要复制的文件和目录
|
|
4874
5034
|
*/
|
|
4875
|
-
|
|
4876
|
-
|
|
4877
|
-
const filesToCopy = [
|
|
4878
|
-
"personality.md",
|
|
4879
|
-
"base.md",
|
|
4880
|
-
"language.md",
|
|
4881
|
-
"CLAUDE.md"
|
|
4882
|
-
];
|
|
4883
|
-
for (const file of filesToCopy) {
|
|
4884
|
-
const src = join(sourceDir, file);
|
|
4885
|
-
const dest = join(CLAUDE_DIR, file);
|
|
4886
|
-
if (exists(src)) {
|
|
4887
|
-
copyFile(src, dest);
|
|
4888
|
-
}
|
|
4889
|
-
}
|
|
5035
|
+
setFileCopyConfigs(configs) {
|
|
5036
|
+
this.fileCopyConfigs = configs;
|
|
4890
5037
|
}
|
|
4891
5038
|
/**
|
|
4892
|
-
*
|
|
4893
|
-
*
|
|
5039
|
+
* 添加文件复制配置
|
|
5040
|
+
* 支持增量添加配置项
|
|
4894
5041
|
*/
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4899
|
-
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
|
|
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");
|
|
4908
|
-
}
|
|
5042
|
+
addFileCopyConfig(config) {
|
|
5043
|
+
this.fileCopyConfigs.push(config);
|
|
5044
|
+
}
|
|
5045
|
+
/**
|
|
5046
|
+
* 清空文件复制配置
|
|
5047
|
+
* 允许完全自定义配置
|
|
5048
|
+
*/
|
|
5049
|
+
clearFileCopyConfigs() {
|
|
5050
|
+
this.fileCopyConfigs = [];
|
|
4909
5051
|
}
|
|
4910
5052
|
}
|
|
4911
5053
|
|
|
@@ -5418,4 +5560,4 @@ async function openSettingsJson() {
|
|
|
5418
5560
|
}
|
|
5419
5561
|
}
|
|
5420
5562
|
|
|
5421
|
-
export { AICO_CONFIG_FILE as A,
|
|
5563
|
+
export { AICO_CONFIG_FILE as A, backupMcpConfig as B, CLAUDE_DIR as C, DEFAULT_FILE_COPY_CONFIGS as D, mergeMcpServers as E, buildMcpServerConfig as F, fixWindowsMcpConfig as G, addCompletedOnboarding as H, readJsonConfig as I, isTermux as J, messages as K, LEGACY_AICO_CONFIG_FILE as L, MCP_SERVICES as M, getTermuxPrefix as N, createEscapablePrompt as O, displayBannerWithInfo as P, executeWithEscapeSupport as Q, handleExitPromptError as R, SETTINGS_FILE as S, handleGeneralError as T, EscapeKeyPressed as U, displayBanner as V, version as W, ConfigCheckerInstaller as X, InstallerExecutor as Y, init$1 as Z, 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, copyConfigFilesWithConfig as q, configureApi as r, mergeConfigs as s, mergeSettingsFile as t, updateDefaultModel as u, getExistingApiConfig as v, applyAiLanguageDirective as w, getMcpConfigPath as x, readMcpConfig as y, writeMcpConfig as z };
|
package/dist/cli.mjs
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import cac from 'cac';
|
|
3
3
|
import ansis from 'ansis';
|
|
4
|
-
import {
|
|
4
|
+
import { O as createEscapablePrompt, P as displayBannerWithInfo, i as init, Q as executeWithEscapeSupport, R as handleExitPromptError, T as handleGeneralError, U as EscapeKeyPressed, V as displayBanner, W as version, X as ConfigCheckerInstaller, Y as InstallerExecutor } from './chunks/simple-config.mjs';
|
|
5
5
|
import inquirer$1 from 'inquirer';
|
|
6
6
|
import { spawn, exec as exec$1 } from 'node:child_process';
|
|
7
7
|
import 'tinyexec';
|
|
8
8
|
import 'node:os';
|
|
9
9
|
import 'node:fs';
|
|
10
10
|
import 'pathe';
|
|
11
|
-
import 'node:url';
|
|
12
11
|
import 'node:path';
|
|
13
12
|
import { exec } from 'child_process';
|
|
14
13
|
import { promisify } from 'util';
|
|
15
14
|
import { promisify as promisify$1 } from 'node:util';
|
|
16
15
|
import 'ora';
|
|
17
16
|
import 'dayjs';
|
|
17
|
+
import 'node:url';
|
|
18
18
|
|
|
19
19
|
const inquirer = {
|
|
20
20
|
...inquirer$1,
|
|
@@ -341,7 +341,7 @@ function setupCommands(cli) {
|
|
|
341
341
|
} else if (options.update) {
|
|
342
342
|
await update({});
|
|
343
343
|
} else if (options.company) {
|
|
344
|
-
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.Z; });
|
|
345
345
|
await init2({
|
|
346
346
|
apiType: "auth_token",
|
|
347
347
|
force: options.force,
|
|
@@ -349,7 +349,7 @@ function setupCommands(cli) {
|
|
|
349
349
|
skipPrompt: true
|
|
350
350
|
});
|
|
351
351
|
} else if (options.personal) {
|
|
352
|
-
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.Z; });
|
|
353
353
|
await init2({
|
|
354
354
|
apiType: "ccr_proxy",
|
|
355
355
|
force: options.force,
|
|
@@ -383,7 +383,7 @@ async function startCodeEditor() {
|
|
|
383
383
|
}
|
|
384
384
|
} else {
|
|
385
385
|
console.log(ansis.yellow("\u26A0\uFE0F \u672A\u68C0\u6D4B\u5230\u914D\u7F6E\uFF0C\u5C06\u5148\u6267\u884C\u521D\u59CB\u5316\u914D\u7F6E..."));
|
|
386
|
-
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.Z; });
|
|
387
387
|
await init2({ skipBanner: true, skipPrompt: true });
|
|
388
388
|
}
|
|
389
389
|
await startClaudeCodeEditor();
|
package/dist/index.d.mts
CHANGED
|
@@ -85,6 +85,20 @@ interface ApiConfig {
|
|
|
85
85
|
declare function ensureClaudeDir(): void;
|
|
86
86
|
declare function backupExistingConfig(): string | null;
|
|
87
87
|
declare function copyConfigFiles(lang: SupportedLang, onlyMd?: boolean): void;
|
|
88
|
+
interface FileCopyConfig {
|
|
89
|
+
source: string;
|
|
90
|
+
destination: string;
|
|
91
|
+
type: 'file' | 'directory';
|
|
92
|
+
options?: {
|
|
93
|
+
overwrite?: boolean;
|
|
94
|
+
filter?: (path: string) => boolean;
|
|
95
|
+
mergeStrategy?: 'copy' | 'merge' | 'skip-if-exists';
|
|
96
|
+
backupBeforeCopy?: boolean;
|
|
97
|
+
deleteBeforeCopy?: boolean;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
declare const DEFAULT_FILE_COPY_CONFIGS: FileCopyConfig[];
|
|
101
|
+
declare function copyConfigFilesWithConfig(configs?: FileCopyConfig[]): void;
|
|
88
102
|
declare function configureApi(apiConfig: ApiConfig | null): ApiConfig | null;
|
|
89
103
|
declare function mergeConfigs(sourceFile: string, targetFile: string): void;
|
|
90
104
|
declare function updateDefaultModel(model: 'opus' | 'sonnet'): void;
|
|
@@ -132,5 +146,5 @@ declare function cleanupPermissions(templatePermissions: string[], userPermissio
|
|
|
132
146
|
*/
|
|
133
147
|
declare function mergeAndCleanPermissions(templatePermissions: string[] | undefined, userPermissions: string[] | undefined): string[];
|
|
134
148
|
|
|
135
|
-
export { AICO_CONFIG_FILE, AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, LANG_LABELS, LEGACY_AICO_CONFIG_FILE, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, installClaudeCodeSilently, isClaudeCodeInstalled, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
|
|
136
|
-
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, McpServerConfig, McpService, SupportedLang };
|
|
149
|
+
export { AICO_CONFIG_FILE, AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, DEFAULT_FILE_COPY_CONFIGS, LANG_LABELS, LEGACY_AICO_CONFIG_FILE, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, copyConfigFilesWithConfig, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, installClaudeCodeSilently, isClaudeCodeInstalled, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
|
|
150
|
+
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, FileCopyConfig, McpServerConfig, McpService, SupportedLang };
|
package/dist/index.d.ts
CHANGED
|
@@ -85,6 +85,20 @@ interface ApiConfig {
|
|
|
85
85
|
declare function ensureClaudeDir(): void;
|
|
86
86
|
declare function backupExistingConfig(): string | null;
|
|
87
87
|
declare function copyConfigFiles(lang: SupportedLang, onlyMd?: boolean): void;
|
|
88
|
+
interface FileCopyConfig {
|
|
89
|
+
source: string;
|
|
90
|
+
destination: string;
|
|
91
|
+
type: 'file' | 'directory';
|
|
92
|
+
options?: {
|
|
93
|
+
overwrite?: boolean;
|
|
94
|
+
filter?: (path: string) => boolean;
|
|
95
|
+
mergeStrategy?: 'copy' | 'merge' | 'skip-if-exists';
|
|
96
|
+
backupBeforeCopy?: boolean;
|
|
97
|
+
deleteBeforeCopy?: boolean;
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
declare const DEFAULT_FILE_COPY_CONFIGS: FileCopyConfig[];
|
|
101
|
+
declare function copyConfigFilesWithConfig(configs?: FileCopyConfig[]): void;
|
|
88
102
|
declare function configureApi(apiConfig: ApiConfig | null): ApiConfig | null;
|
|
89
103
|
declare function mergeConfigs(sourceFile: string, targetFile: string): void;
|
|
90
104
|
declare function updateDefaultModel(model: 'opus' | 'sonnet'): void;
|
|
@@ -132,5 +146,5 @@ declare function cleanupPermissions(templatePermissions: string[], userPermissio
|
|
|
132
146
|
*/
|
|
133
147
|
declare function mergeAndCleanPermissions(templatePermissions: string[] | undefined, userPermissions: string[] | undefined): string[];
|
|
134
148
|
|
|
135
|
-
export { AICO_CONFIG_FILE, AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, LANG_LABELS, LEGACY_AICO_CONFIG_FILE, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, installClaudeCodeSilently, isClaudeCodeInstalled, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
|
|
136
|
-
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, McpServerConfig, McpService, SupportedLang };
|
|
149
|
+
export { AICO_CONFIG_FILE, AI_OUTPUT_LANGUAGES, CLAUDE_DIR, CLAUDE_MD_FILE, ClAUDE_CONFIG_FILE, DEFAULT_FILE_COPY_CONFIGS, LANG_LABELS, LEGACY_AICO_CONFIG_FILE, MCP_SERVICES, SETTINGS_FILE, SUPPORTED_LANGS, addCompletedOnboarding, applyAiLanguageDirective, backupExistingConfig, backupMcpConfig, buildMcpServerConfig, cleanupPermissions, commandExists, configureApi, copyConfigFiles, copyConfigFilesWithConfig, ensureClaudeDir, fixWindowsMcpConfig, getExistingApiConfig, getMcpConfigPath, getPlatform, importRecommendedEnv, importRecommendedPermissions, init, installClaudeCode, installClaudeCodeSilently, isClaudeCodeInstalled, mergeAndCleanPermissions, mergeConfigs, mergeMcpServers, mergeSettingsFile, openSettingsJson, readMcpConfig, updateDefaultModel, writeMcpConfig };
|
|
150
|
+
export type { AiOutputLanguage, ApiConfig, ClaudeConfiguration, FileCopyConfig, McpServerConfig, McpService, SupportedLang };
|
package/dist/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { A as AICO_CONFIG_FILE, k as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, j as LANG_LABELS, L as LEGACY_AICO_CONFIG_FILE, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS,
|
|
2
|
-
export { a as installClaudeCode, b as installClaudeCodeSilently, i as isClaudeCodeInstalled } from './shared/aico-cli.
|
|
1
|
+
export { A as AICO_CONFIG_FILE, k as AI_OUTPUT_LANGUAGES, C as CLAUDE_DIR, e as CLAUDE_MD_FILE, f as ClAUDE_CONFIG_FILE, D as DEFAULT_FILE_COPY_CONFIGS, j as LANG_LABELS, L as LEGACY_AICO_CONFIG_FILE, M as MCP_SERVICES, S as SETTINGS_FILE, h as SUPPORTED_LANGS, H as addCompletedOnboarding, w as applyAiLanguageDirective, n as backupExistingConfig, B as backupMcpConfig, F as buildMcpServerConfig, d as cleanupPermissions, c as commandExists, r as configureApi, p as copyConfigFiles, q as copyConfigFilesWithConfig, l as ensureClaudeDir, G as fixWindowsMcpConfig, v as getExistingApiConfig, x as getMcpConfigPath, g as getPlatform, a as importRecommendedEnv, b as importRecommendedPermissions, i as init, m as mergeAndCleanPermissions, s as mergeConfigs, E as mergeMcpServers, t as mergeSettingsFile, o as openSettingsJson, y as readMcpConfig, u as updateDefaultModel, z as writeMcpConfig } from './chunks/simple-config.mjs';
|
|
2
|
+
export { a as installClaudeCode, b as installClaudeCodeSilently, i as isClaudeCodeInstalled } from './shared/aico-cli.CWSSz8Hk.mjs';
|
|
3
3
|
import 'ansis';
|
|
4
4
|
import 'inquirer';
|
|
5
5
|
import 'tinyexec';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { exec } from 'tinyexec';
|
|
2
2
|
import ansis from 'ansis';
|
|
3
|
-
import { c as commandExists,
|
|
3
|
+
import { c as commandExists, J as isTermux, K as messages, N as getTermuxPrefix } from '../chunks/simple-config.mjs';
|
|
4
4
|
|
|
5
5
|
async function isClaudeCodeInstalled() {
|
|
6
6
|
return await commandExists("claude");
|
package/package.json
CHANGED
package/templates/CLAUDE.md
CHANGED
|
@@ -1,71 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
## 模块职责
|
|
4
|
-
- AI工作流模板与配置文件模板库
|
|
5
|
-
- 提供标准化的配置模板和工作流定义
|
|
6
|
-
- 支持多种AI场景的配置模板
|
|
7
|
-
|
|
8
|
-
## 模板分类
|
|
9
|
-
|
|
10
|
-
### AI智能体模板 (agents/)
|
|
11
|
-
- **规划智能体**: `agents/aico/plan/`
|
|
12
|
-
- `init-architect.md` - 架构师初始化模板
|
|
13
|
-
- `planner.md` - 规划器模板
|
|
14
|
-
- `ui-ux-designer.md` - UI/UX设计师模板
|
|
15
|
-
- `get-current-datetime.md` - 时间获取模板
|
|
16
|
-
- **需求智能体**: `agents/aico/requirement/`
|
|
17
|
-
- `requirement-identifier.md` - 需求识别器
|
|
18
|
-
- `requirement-aligner.md` - 需求对齐器
|
|
19
|
-
- `task-executor.md` - 任务执行器
|
|
20
|
-
- `task-executor-validator.md` - 任务执行验证器
|
|
21
|
-
- `task-splitter-validator.md` - 任务拆分验证器
|
|
22
|
-
|
|
23
|
-
### 命令模板 (commands/)
|
|
24
|
-
- **AICO命令**: `commands/aico/`
|
|
25
|
-
- `init-project.md` - 项目初始化模板
|
|
26
|
-
- `workflow.md` - 工作流模板
|
|
27
|
-
- `requirement.md` - 需求处理模板
|
|
28
|
-
|
|
29
|
-
### 基础配置模板
|
|
30
|
-
- `base.md` - 基础配置模板
|
|
31
|
-
- `language.md` - 语言配置模板
|
|
32
|
-
- `personality.md` - AI个性配置模板
|
|
33
|
-
- `settings.json` - 设置文件模板
|
|
34
|
-
|
|
35
|
-
## 模板使用
|
|
36
|
-
- **安装时使用**: 通过安装器将模板复制到用户目录
|
|
37
|
-
- **配置生成**: 根据模板生成具体的配置文件
|
|
38
|
-
- **动态替换**: 支持变量替换和个性化配置
|
|
39
|
-
|
|
40
|
-
## 模板规范
|
|
41
|
-
- **Markdown格式**: 大部分模板使用Markdown格式
|
|
42
|
-
- **JSON配置**: 配置文件使用JSON格式
|
|
43
|
-
- **变量占位符**: 使用特定的占位符语法进行变量替换
|
|
44
|
-
- **注释说明**: 包含详细的配置说明和使用指南
|
|
45
|
-
|
|
46
|
-
## 测试与质量
|
|
47
|
-
- **模板验证**: 确保模板语法正确性和完整性
|
|
48
|
-
- **变量检查**: 验证所有占位符都有对应的替换逻辑
|
|
49
|
-
- **格式校验**: 使用工具验证JSON和Markdown格式
|
|
50
|
-
|
|
51
|
-
## 常见问题 (FAQ)
|
|
52
|
-
- Q: 如何添加新的模板?
|
|
53
|
-
A: 在合适的分类目录下创建模板文件,确保有相应的安装器支持
|
|
54
|
-
- Q: 模板中的变量如何替换?
|
|
55
|
-
A: 通过安装器中的模板处理逻辑进行变量替换
|
|
56
|
-
- Q: 模板更新后如何生效?
|
|
57
|
-
A: 用户需要重新运行安装命令或更新命令
|
|
58
|
-
|
|
59
|
-
## 相关文件清单(主要)
|
|
60
|
-
- `agents/aico/plan/init-architect.md` - 架构师模板
|
|
61
|
-
- `agents/aico/plan/planner.md` - 规划器模板
|
|
62
|
-
- `agents/aico/requirement/requirement-identifier.md` - 需求识别模板
|
|
63
|
-
- `commands/aico/init-project.md` - 项目初始化模板
|
|
64
|
-
- `base.md` - 基础配置模板
|
|
65
|
-
- `language.md` - 语言配置模板
|
|
66
|
-
- `personality.md` - 个性配置模板
|
|
67
|
-
- `settings.json` - 设置文件模板
|
|
68
|
-
|
|
69
|
-
## 变更记录 (Changelog)
|
|
70
|
-
- 2025-09-14: 初始模板模块文档
|
|
71
|
-
- 2025-09-19: 完善模板分类和文档结构
|
|
1
|
+
@language.md
|
|
2
|
+
@personality.md
|