@ia-ccun/code-agent-cli 0.0.54 → 0.0.55

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 CHANGED
@@ -8,30 +8,19 @@
8
8
  // 设置终端标题
9
9
  process.title = "aicode-cli";
10
10
 
11
- // 防御 CWD 被删: 在所有 import 之前 chdir (node ESM 解析 import 时会读 cwd)
12
- // 不 import os.homedir() 因为那需要模块解析, 此时 cwd 还没改
13
- // 用 process.env.PWD 优先 (用户启动目录) → HOME fallback (防 PWD 缺失 ENOENT)
14
- // 先 PWD 试 (用户启动目录), 失败 fallback HOME (cwd 被删时 PWD 也指向已删目录, chdir 会抛 ENOENT)
15
- // catch 后再退一步: HOME 也失败则 chdir 到 / (绝对保证不会 ENOENT)
16
- try {
17
- process.chdir(process.env.PWD);
18
- } catch {
19
- try {
20
- process.chdir(process.env.HOME || "/");
21
- } catch {
22
- try {
23
- process.chdir("/");
24
- } catch {}
25
- }
26
- }
27
-
28
11
  import { spawn } from "child_process";
29
12
  import { fileURLToPath } from "url";
30
13
  import { dirname, join } from "path";
31
14
  import { existsSync, readFileSync, writeFileSync } from "fs";
32
15
  import { getConfig, getConfigDir, loadConfig } from "../dist/config-loader.js";
16
+ import { homedir } from "node:os";
33
17
 
18
+ // 防御 cwd 被删: chdir 到 PWD env (用户启动目录) 或 home, 防 ENOENT
34
19
  const __filename = fileURLToPath(import.meta.url);
20
+ try {
21
+ process.chdir(process.env.PWD || homedir());
22
+ } catch {}
23
+
35
24
  const __dirname = dirname(__filename);
36
25
 
37
26
  // 获取本地版本号
@@ -168,7 +157,6 @@ replaceCLIVersionPlaceholder();
168
157
  const localVersion = getLocalVersion();
169
158
  process.env.AICODE_CLI_VERSION = localVersion || "";
170
159
 
171
-
172
160
  async function checkForUpdates() {
173
161
  try {
174
162
  const { execFileSync } = await import("child_process");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ia-ccun/code-agent-cli",
3
- "version": "0.0.54",
3
+ "version": "0.0.55",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -1 +1 @@
1
- 72167
1
+ 2818
@@ -1 +1 @@
1
- /Users/jianjiang/.aicode-regression-72044-1696000
1
+ /Users/jianjiang/.aicode-regression-2703-8359000