@ia-ccun/code-agent-cli 0.0.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/README.md +211 -0
- package/bin/cli.js +83 -0
- package/config/agent/APPEND_SYSTEM.md +48 -0
- package/config/agent/SYSTEM.md +33 -0
- package/config/agent/bin/fd +0 -0
- package/config/agent/extensions/context.ts +578 -0
- package/config/agent/extensions/custom-footer.ts +170 -0
- package/config/agent/extensions/custom.ts +289 -0
- package/config/agent/extensions/review.ts +1281 -0
- package/config/agent/extensions/working-msg.ts +96 -0
- package/config/agent/help.md +364 -0
- package/config/agent/models.json +56 -0
- package/config/agent/prompts/feat.md +106 -0
- package/config/agent/prompts/git-commit.md +159 -0
- package/config/agent/prompts/git-rollback.md +91 -0
- package/config/agent/prompts/git-worktree.md +277 -0
- package/config/agent/prompts/help.md +10 -0
- package/config/agent/prompts/init-project.md +53 -0
- package/config/agent/prompts/workflow.md +194 -0
- package/config/agent/settings.json +7 -0
- package/config/agent/skills/code-review/SKILL.md +50 -0
- package/config/agent/skills/commit/SKILL.md +51 -0
- package/config/agent/skills/csv-data-summarizer/SKILL.md +149 -0
- package/config/agent/skills/csv-data-summarizer/analyze.py +182 -0
- package/config/agent/skills/csv-data-summarizer/examples/showcase_financial_pl_data.csv +46 -0
- package/config/agent/skills/csv-data-summarizer/requirements.txt +4 -0
- package/config/agent/skills/csv-data-summarizer/resources/sample.csv +22 -0
- package/config/agent/skills/find-skills/SKILL.md +133 -0
- package/config/agent/skills/frontend-design/LICENSE.txt +177 -0
- package/config/agent/skills/frontend-design/SKILL.md +42 -0
- package/config/agent/skills/github/SKILL.md +47 -0
- package/config/agent/skills/hello/SKILL.md +23 -0
- package/config/agent/skills/librarian/SKILL.md +195 -0
- package/config/agent/skills/markdown-to-html/SKILL.md +62 -0
- package/config/agent/skills/pr/SKILL.md +56 -0
- package/config/agent/skills/refactor/SKILL.md +37 -0
- package/config/agent/skills/skill-creator/LICENSE.txt +202 -0
- package/config/agent/skills/skill-creator/SKILL.md +356 -0
- package/config/agent/skills/skill-creator/references/output-patterns.md +82 -0
- package/config/agent/skills/skill-creator/references/workflows.md +28 -0
- package/config/agent/skills/skill-creator/scripts/init_skill.py +303 -0
- package/config/agent/skills/skill-creator/scripts/package_skill.py +110 -0
- package/config/agent/skills/skill-creator/scripts/quick_validate.py +95 -0
- package/config/agent/skills/ui-ux-pro-max/SKILL.md +264 -0
- package/config/agent/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/config/agent/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/config/agent/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/config/agent/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/config/agent/skills/ui-ux-pro-max/data/prompts.csv +24 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/config/agent/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/config/agent/skills/ui-ux-pro-max/data/styles.csv +59 -0
- package/config/agent/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/config/agent/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/config/agent/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-312.pyc +0 -0
- package/config/agent/skills/ui-ux-pro-max/scripts/analyze.py +434 -0
- package/config/agent/skills/ui-ux-pro-max/scripts/core.py +238 -0
- package/config/agent/skills/ui-ux-pro-max/scripts/search.py +61 -0
- package/config/agent/skills/unit-test/SKILL.md +115 -0
- package/config/agent/themes/catppuccin-mocha.json +99 -0
- package/config.json +6 -0
- package/dist/banner.d.ts +10 -0
- package/dist/banner.d.ts.map +1 -0
- package/dist/banner.js +32 -0
- package/dist/banner.js.map +1 -0
- package/dist/config-loader.d.ts +17 -0
- package/dist/config-loader.d.ts.map +1 -0
- package/dist/config-loader.js +60 -0
- package/dist/config-loader.js.map +1 -0
- package/dist/config.d.ts +23 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +12 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/package.json +69 -0
- package/scripts/postinstall.js +197 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI Code Agent CLI 配置文件
|
|
3
|
+
*
|
|
4
|
+
* 可在此配置应用名称、Banner、主题色等
|
|
5
|
+
*/
|
|
6
|
+
export interface AppConfig {
|
|
7
|
+
/** 应用名称 (命令行显示) */
|
|
8
|
+
name: string;
|
|
9
|
+
/** 启动Banner (留空则不显示) */
|
|
10
|
+
banner: string;
|
|
11
|
+
/** 主题色 (hex格式) */
|
|
12
|
+
themeColor: string;
|
|
13
|
+
/** 配置目录 (默认 ~/.aicode-cli) */
|
|
14
|
+
configDir: string;
|
|
15
|
+
/** 自定义 Skills 目录 */
|
|
16
|
+
skillsDir?: string;
|
|
17
|
+
/** 自定义 Prompt Templates 目录 */
|
|
18
|
+
promptsDir?: string;
|
|
19
|
+
/** 自定义 Extensions 目录 */
|
|
20
|
+
extensionsDir?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare const defaultConfig: AppConfig;
|
|
23
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,WAAW,SAAS;IACxB,mBAAmB;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,wBAAwB;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,oBAAoB;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8BAA8B;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,wBAAwB;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,aAAa,EAAE,SAK3B,CAAC"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAmBH,MAAM,CAAC,MAAM,aAAa,GAAc;IACtC,IAAI,EAAE,YAAY;IAClB,MAAM,EAAE,aAAa,EAAG,QAAQ;IAChC,UAAU,EAAE,SAAS;IACrB,SAAS,EAAE,aAAa;CACzB,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aicode-cli
|
|
3
|
+
* AI Coding Agent CLI
|
|
4
|
+
*
|
|
5
|
+
* 基于 @mariozechner/pi-coding-agent 的封装
|
|
6
|
+
*/
|
|
7
|
+
export * from '@mariozechner/pi-coding-agent';
|
|
8
|
+
export { defaultConfig, type AppConfig } from './config.js';
|
|
9
|
+
export { getConfig, getConfigDir, loadConfig } from './config-loader.js';
|
|
10
|
+
export { defaultBanner, generateBanner } from './banner.js';
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,+BAA+B,CAAC;AAG9C,OAAO,EAAE,aAAa,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGzE,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* aicode-cli
|
|
3
|
+
* AI Coding Agent CLI
|
|
4
|
+
*
|
|
5
|
+
* 基于 @mariozechner/pi-coding-agent 的封装
|
|
6
|
+
*/
|
|
7
|
+
// 重新导出 pi-coding-agent 的核心功能
|
|
8
|
+
export * from '@mariozechner/pi-coding-agent';
|
|
9
|
+
// 导出配置相关
|
|
10
|
+
export { defaultConfig } from './config.js';
|
|
11
|
+
export { getConfig, getConfigDir, loadConfig } from './config-loader.js';
|
|
12
|
+
// 导出 Banner
|
|
13
|
+
export { defaultBanner, generateBanner } from './banner.js';
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,6BAA6B;AAC7B,cAAc,+BAA+B,CAAC;AAE9C,SAAS;AACT,OAAO,EAAE,aAAa,EAAkB,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEzE,YAAY;AACZ,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ia-ccun/code-agent-cli",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "AI Coding Agent CLI - 基于OpenClaw🦞底层Agent原理实现的的编码智能体。",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"aicode-cli": "./bin/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"preferGlobal": true,
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"dist",
|
|
20
|
+
"bin",
|
|
21
|
+
"scripts",
|
|
22
|
+
"config",
|
|
23
|
+
"config.json"
|
|
24
|
+
],
|
|
25
|
+
"scripts": {
|
|
26
|
+
"clean": "shx rm -rf dist",
|
|
27
|
+
"build": "tsc",
|
|
28
|
+
"dev": "tsc --watch",
|
|
29
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
30
|
+
"postinstall": "node scripts/postinstall.js",
|
|
31
|
+
"test": "echo \"Tests skipped\" && exit 0",
|
|
32
|
+
"release": "npm version patch && npm pack",
|
|
33
|
+
"webui:build": "cd webui/server && npm run build",
|
|
34
|
+
"webui:dev": "cd webui/server && npm run dev",
|
|
35
|
+
"webui": "npm run webui:build && node webui/server/dist/index.js"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"@mariozechner/pi-agent-core": "0.57.1",
|
|
39
|
+
"@mariozechner/pi-ai": "0.57.1",
|
|
40
|
+
"@mariozechner/pi-coding-agent": "0.57.1",
|
|
41
|
+
"@mariozechner/pi-tui": "0.57.1"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@types/node": "^22.10.0",
|
|
45
|
+
"shx": "^0.4.0",
|
|
46
|
+
"typescript": "^5.7.2"
|
|
47
|
+
},
|
|
48
|
+
"keywords": [
|
|
49
|
+
"ia-ccun",
|
|
50
|
+
"aicode-cli",
|
|
51
|
+
"coding-agent",
|
|
52
|
+
"ai",
|
|
53
|
+
"llm",
|
|
54
|
+
"cli"
|
|
55
|
+
],
|
|
56
|
+
"author": "xujianjiang",
|
|
57
|
+
"license": "MIT",
|
|
58
|
+
"piConfig": {
|
|
59
|
+
"name": "aicode-cli",
|
|
60
|
+
"configDir": ".aicode-cli"
|
|
61
|
+
},
|
|
62
|
+
"engines": {
|
|
63
|
+
"node": ">=20.0.0"
|
|
64
|
+
},
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "gitee",
|
|
67
|
+
"url": "https://gitee.com/qingfeng0512/code-agent-cli"
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// Post-install script for aicode-cli
|
|
4
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, copyFileSync, readdirSync, statSync } from 'fs';
|
|
5
|
+
import { execSync } from 'child_process';
|
|
6
|
+
import { join, dirname, relative } from 'path';
|
|
7
|
+
import { homedir } from 'os';
|
|
8
|
+
import { fileURLToPath } from 'url';
|
|
9
|
+
|
|
10
|
+
// Get __dirname equivalent for ES modules
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = dirname(__filename);
|
|
13
|
+
|
|
14
|
+
console.log('\n🚀 Setting up aicode-cli...');
|
|
15
|
+
|
|
16
|
+
// Get the current user's home directory
|
|
17
|
+
const homeDir = homedir();
|
|
18
|
+
const aicodeCliDir = join(homeDir, '.aicode-cli');
|
|
19
|
+
const piDir = join(homeDir, '.pi');
|
|
20
|
+
|
|
21
|
+
// ============================================================================
|
|
22
|
+
// Fix pi-coding-agent APP_NAME
|
|
23
|
+
// ============================================================================
|
|
24
|
+
const piAgentPackageJson = join(__dirname, '..', 'node_modules', '@mariozechner', 'pi-coding-agent', 'package.json');
|
|
25
|
+
if (existsSync(piAgentPackageJson)) {
|
|
26
|
+
try {
|
|
27
|
+
const piPkg = JSON.parse(readFileSync(piAgentPackageJson, 'utf-8'));
|
|
28
|
+
if (!piPkg.piConfig) {
|
|
29
|
+
piPkg.piConfig = {};
|
|
30
|
+
}
|
|
31
|
+
const oldName = piPkg.piConfig.name || 'pi';
|
|
32
|
+
piPkg.piConfig.name = 'aicode-cli';
|
|
33
|
+
piPkg.piConfig.configDir = '.aicode-cli';
|
|
34
|
+
writeFileSync(piAgentPackageJson, JSON.stringify(piPkg, null, 2) + '\n');
|
|
35
|
+
console.log(`✓ Updated pi-coding-agent app name: ${oldName} -> aicode-cli`);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
console.log(`⚠ Could not update pi-coding-agent config: ${e.message}`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// Fix pi-coding-agent cli.js process.title
|
|
42
|
+
const piAgentCliJs = join(__dirname, '..', 'node_modules', '@mariozechner', 'pi-coding-agent', 'dist', 'cli.js');
|
|
43
|
+
if (existsSync(piAgentCliJs)) {
|
|
44
|
+
try {
|
|
45
|
+
let cliContent = readFileSync(piAgentCliJs, 'utf-8');
|
|
46
|
+
if (cliContent.includes('process.title = "pi"')) {
|
|
47
|
+
cliContent = cliContent.replace(/process\.title = "pi"/g, 'process.title = "aicode-cli"');
|
|
48
|
+
writeFileSync(piAgentCliJs, cliContent);
|
|
49
|
+
console.log(`✓ Updated pi-coding-agent process.title`);
|
|
50
|
+
}
|
|
51
|
+
} catch (e) {
|
|
52
|
+
console.log(`⚠ Could not update pi-coding-agent cli.js: ${e.message}`);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Fix pi-coding-agent config.js APP_NAME default
|
|
57
|
+
const piAgentConfigJs = join(__dirname, '..', 'node_modules', '@mariozechner', 'pi-coding-agent', 'dist', 'config.js');
|
|
58
|
+
if (existsSync(piAgentConfigJs)) {
|
|
59
|
+
try {
|
|
60
|
+
let configContent = readFileSync(piAgentConfigJs, 'utf-8');
|
|
61
|
+
if (configContent.includes('pkg.piConfig?.name || "pi"')) {
|
|
62
|
+
configContent = configContent.replace(/pkg\.piConfig\?\.name \|\| "pi"/g, 'pkg.piConfig?.name || "aicode-cli"');
|
|
63
|
+
writeFileSync(piAgentConfigJs, configContent);
|
|
64
|
+
console.log(`✓ Updated pi-coding-agent config.js APP_NAME`);
|
|
65
|
+
}
|
|
66
|
+
} catch (e) {
|
|
67
|
+
console.log(`⚠ Could not update pi-coding-agent config.js: ${e.message}`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// Ensure .aicode-cli directory exists
|
|
72
|
+
if (!existsSync(aicodeCliDir)) {
|
|
73
|
+
mkdirSync(aicodeCliDir, { recursive: true });
|
|
74
|
+
console.log(`✓ Created directory: ${aicodeCliDir}`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// Create agent subdirectory
|
|
78
|
+
const agentDir = join(aicodeCliDir, 'agent');
|
|
79
|
+
if (!existsSync(agentDir)) {
|
|
80
|
+
mkdirSync(agentDir, { recursive: true });
|
|
81
|
+
console.log(`✓ Created directory: ${agentDir}`);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Function to copy directory recursively (only copy if destination doesn't exist)
|
|
85
|
+
function copyDirRecursive(src, dest) {
|
|
86
|
+
const exists = existsSync(src);
|
|
87
|
+
const stats = exists && statSync(src);
|
|
88
|
+
const isDirectory = exists && stats.isDirectory();
|
|
89
|
+
|
|
90
|
+
if (isDirectory) {
|
|
91
|
+
// Create directory if it doesn't exist
|
|
92
|
+
if (!existsSync(dest)) {
|
|
93
|
+
mkdirSync(dest, { recursive: true });
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
const files = readdirSync(src);
|
|
97
|
+
files.forEach(function(file) {
|
|
98
|
+
const srcPath = join(src, file);
|
|
99
|
+
const destPath = join(dest, file);
|
|
100
|
+
copyDirRecursive(srcPath, destPath);
|
|
101
|
+
});
|
|
102
|
+
} else {
|
|
103
|
+
// Only copy if source exists AND destination doesn't exist (preserve user files)
|
|
104
|
+
if (exists && !existsSync(dest)) {
|
|
105
|
+
// Ensure parent directory exists
|
|
106
|
+
const parentDir = dirname(dest);
|
|
107
|
+
if (!existsSync(parentDir)) {
|
|
108
|
+
mkdirSync(parentDir, { recursive: true });
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
copyFileSync(src, dest);
|
|
112
|
+
console.log(` + Added: ${relative(agentDir, dest)}`);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Copy config.json if it doesn't exist
|
|
118
|
+
const packageConfigFile = join(__dirname, '..', 'config.json');
|
|
119
|
+
const userConfigFile = join(aicodeCliDir, 'config.json');
|
|
120
|
+
if (existsSync(packageConfigFile) && !existsSync(userConfigFile)) {
|
|
121
|
+
console.log(`📁 Copying config.json from ${packageConfigFile} to ${userConfigFile}`);
|
|
122
|
+
copyFileSync(packageConfigFile, userConfigFile);
|
|
123
|
+
console.log('✓ config.json copied successfully');
|
|
124
|
+
} else if (!existsSync(packageConfigFile)) {
|
|
125
|
+
console.log('⚠ config.json not found in package');
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// Copy config/agent contents to ~/.aicode-cli/agent only if they don't exist (preserve user customizations)
|
|
129
|
+
const packageConfigDir = join(__dirname, '..', 'config', 'agent');
|
|
130
|
+
if (existsSync(packageConfigDir)) {
|
|
131
|
+
console.log(`📁 Syncing default config files to ${agentDir} (preserving user customizations)`);
|
|
132
|
+
|
|
133
|
+
// Copy directory recursively (only if destination doesn't exist)
|
|
134
|
+
copyDirRecursive(packageConfigDir, agentDir);
|
|
135
|
+
console.log('✓ Default config files synced successfully');
|
|
136
|
+
|
|
137
|
+
// Check for extensions
|
|
138
|
+
const extensionsDir = join(agentDir, 'extensions');
|
|
139
|
+
if (existsSync(extensionsDir)) {
|
|
140
|
+
try {
|
|
141
|
+
const extFiles = readdirSync(extensionsDir).filter(f => f.endsWith('.ts'));
|
|
142
|
+
if (extFiles.length > 0) {
|
|
143
|
+
console.log(`✓ Found ${extFiles.length} extension(s): ${extFiles.join(', ')}`);
|
|
144
|
+
}
|
|
145
|
+
} catch (e) {
|
|
146
|
+
// ignore
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
} else {
|
|
150
|
+
console.log('⚠ Configuration directory not found in package');
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Create symlink ~/.pi linking to ~/.aicode-cli (if not exists)
|
|
154
|
+
try {
|
|
155
|
+
if (!existsSync(piDir)) {
|
|
156
|
+
// Create symbolic link using shell command (works on all platforms)
|
|
157
|
+
execSync(`ln -s "${aicodeCliDir}" "${piDir}"`, { stdio: 'pipe' });
|
|
158
|
+
console.log(`✓ Created symbolic link: ${piDir} -> ${aicodeCliDir}`);
|
|
159
|
+
} else {
|
|
160
|
+
console.log(`✓ ${piDir} already exists`);
|
|
161
|
+
}
|
|
162
|
+
} catch (e) {
|
|
163
|
+
if (e.message.includes('File exists')) {
|
|
164
|
+
console.log(`✓ Symbolic link already exists: ${piDir}`);
|
|
165
|
+
} else {
|
|
166
|
+
console.log(`⚠ Could not create symbolic link: ${e.message}`);
|
|
167
|
+
console.log('\n📌 To fix this, please run manually:');
|
|
168
|
+
console.log(' ln -s ~/.aicode-cli ~/.pi');
|
|
169
|
+
console.log('\n (If ~/.pi exists, run: rm -rf ~/.pi && ln -s ~/.aicode-cli ~/.pi)');
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// Check if models.json exists
|
|
174
|
+
const modelsPath = join(agentDir, 'models.json');
|
|
175
|
+
if (existsSync(modelsPath)) {
|
|
176
|
+
try {
|
|
177
|
+
const models = JSON.parse(readFileSync(modelsPath, 'utf8'));
|
|
178
|
+
const modelCount = Object.keys(models).length;
|
|
179
|
+
if (modelCount > 0) {
|
|
180
|
+
console.log(`✓ Found ${modelCount} configured model(s):`);
|
|
181
|
+
console.log(` - ${Object.keys(models).join(', ')}`);
|
|
182
|
+
} else {
|
|
183
|
+
console.log(`✓ Config file exists but no models configured`);
|
|
184
|
+
}
|
|
185
|
+
} catch (e) {
|
|
186
|
+
console.log(`⚠ Error reading models.json: ${e.message}`);
|
|
187
|
+
}
|
|
188
|
+
} else {
|
|
189
|
+
console.log(`⚠ No models.json found at ${modelsPath}`);
|
|
190
|
+
console.log('\n📌 To configure models, create ~/.aicode-cli/agent/models.json');
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
console.log('\n✨ Setup complete!');
|
|
194
|
+
console.log('📝 Configuration files are in ~/.aicode-cli/');
|
|
195
|
+
console.log('🔗 ~/.pi is linked to ~/.aicode-cli (ensuring model configs work)');
|
|
196
|
+
console.log('🚀 Run with: aicode-cli');
|
|
197
|
+
console.log('\n📖 For more information, see: https://www.npmjs.com/package/@ia-ccun/code-agent-cli');
|