@ia-ccun/code-agent-cli 0.0.51 → 0.0.52
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.js +11 -10
- package/config/agent/extensions/aicode-advisor.ts +707 -0
- package/config/agent/extensions/aicode-btw.ts +2273 -0
- package/config/agent/extensions/aicode-plan.ts +903 -0
- package/config/agent/extensions/aicode-tips.ts +1 -2
- package/config/agent/extensions/bash-check.ts +1 -1
- package/config/agent/extensions/context-monitor.ts +1 -1
- package/config/agent/extensions/context.ts +3 -3
- package/config/agent/extensions/custom-footer.ts +22 -4
- package/config/agent/extensions/custom.ts +24 -20
- package/config/agent/extensions/error-monitor.ts +1 -1
- package/config/agent/extensions/goal.ts +450 -0
- package/config/agent/extensions/msg-debug.ts +49 -10
- package/config/agent/extensions/review.ts +3 -3
- package/config/agent/extensions/working-msg.ts +2 -2
- package/config/agent/help.md +25 -0
- package/config/agent/settings.json +0 -2
- package/dist/banner.d.ts +5 -1
- package/dist/banner.d.ts.map +1 -1
- package/dist/banner.js +106 -7
- package/dist/banner.js.map +1 -1
- package/dist/config-loader.d.ts +2 -0
- package/dist/config-loader.d.ts.map +1 -1
- package/dist/config-loader.js +81 -7
- package/dist/config-loader.js.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/security-logger.d.ts +69 -0
- package/dist/security-logger.d.ts.map +1 -0
- package/dist/security-logger.js +178 -0
- package/dist/security-logger.js.map +1 -0
- package/package.json +17 -6
- package/scripts/postinstall.js +130 -50
package/bin/cli.js
CHANGED
|
@@ -136,6 +136,10 @@ function replaceCLIVersionPlaceholder() {
|
|
|
136
136
|
// 执行占位符替换
|
|
137
137
|
replaceCLIVersionPlaceholder();
|
|
138
138
|
|
|
139
|
+
// 提前获取版本号(用于 banner 显示)
|
|
140
|
+
const localVersion = getLocalVersion();
|
|
141
|
+
process.env.AICODE_CLI_VERSION = localVersion || '';
|
|
142
|
+
|
|
139
143
|
// 显示 Banner
|
|
140
144
|
if (config.banner === '__default__' || config.banner !== '') {
|
|
141
145
|
console.log(generateBanner(config.themeColor));
|
|
@@ -144,7 +148,7 @@ if (config.banner === '__default__' || config.banner !== '') {
|
|
|
144
148
|
// 检查新版本
|
|
145
149
|
async function checkForUpdates() {
|
|
146
150
|
try {
|
|
147
|
-
const {
|
|
151
|
+
const { execFileSync } = await import('child_process');
|
|
148
152
|
// 读取本地版本 - 向上查找 package.json
|
|
149
153
|
let rootDir = __dirname;
|
|
150
154
|
let localVersion = null;
|
|
@@ -158,9 +162,9 @@ async function checkForUpdates() {
|
|
|
158
162
|
}
|
|
159
163
|
if (!localVersion) return;
|
|
160
164
|
|
|
161
|
-
//
|
|
162
|
-
const registry =
|
|
163
|
-
const latestVersion =
|
|
165
|
+
// 🔒 Security: Use execFileSync instead of execSync to prevent command injection
|
|
166
|
+
const registry = execFileSync('npm', ['config', 'get', 'registry'], { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
167
|
+
const latestVersion = execFileSync('npm', ['view', '@ia-ccun/code-agent-cli', 'version', '--registry=' + registry], { encoding: 'utf8', stdio: 'pipe' }).trim();
|
|
164
168
|
|
|
165
169
|
// 比较版本号
|
|
166
170
|
const localParts = localVersion.split('.').map(Number);
|
|
@@ -175,7 +179,8 @@ async function checkForUpdates() {
|
|
|
175
179
|
try {
|
|
176
180
|
const cacheDir = join(process.env.HOME || process.env.USERPROFILE, '.aicode-cli');
|
|
177
181
|
if (!existsSync(cacheDir)) {
|
|
178
|
-
|
|
182
|
+
// 🔒 Security: Use execFileSync for mkdir instead of execSync
|
|
183
|
+
execFileSync('mkdir', ['-p', cacheDir], { stdio: 'pipe' });
|
|
179
184
|
}
|
|
180
185
|
const cacheData = {
|
|
181
186
|
localVersion,
|
|
@@ -193,13 +198,9 @@ async function checkForUpdates() {
|
|
|
193
198
|
}
|
|
194
199
|
checkForUpdates();
|
|
195
200
|
|
|
196
|
-
|
|
197
|
-
const piAgentPathUrl = new URL('../node_modules/@mariozechner/pi-coding-agent/dist/cli.js', import.meta.url);
|
|
201
|
+
const piAgentPathUrl = new URL('../node_modules/@earendil-works/pi-coding-agent/dist/cli.js', import.meta.url);
|
|
198
202
|
const piAgentPath = fileURLToPath(piAgentPathUrl); // 解码中文路径
|
|
199
203
|
|
|
200
|
-
// 获取本地版本号
|
|
201
|
-
const localVersion = getLocalVersion();
|
|
202
|
-
|
|
203
204
|
// 获取版本缓存文件路径
|
|
204
205
|
const versionCachePath = getVersionCachePath();
|
|
205
206
|
|