@legna-lnc/legnacode 1.1.7 → 1.1.8

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  All notable changes to LegnaCode CLI will be documented in this file.
4
4
 
5
+ ## [1.1.7] - 2026-04-03
6
+
7
+ ### Fixed
8
+
9
+ - **彻底修复 Windows external module 报错** — 清空编译 external 列表,所有 stubs 模块(`@ant/*`、`@anthropic-ai/*`、native napi)全部打包进二进制,不再依赖运行时外部模块
10
+
5
11
  ## [1.1.6] - 2026-04-03
6
12
 
7
13
  ### Fixed
package/README.md CHANGED
@@ -10,6 +10,7 @@ LegnaCode 是一个基于 Anthropic Claude 的智能终端编程助手,让你
10
10
 
11
11
  | 版本 | 日期 | 摘要 |
12
12
  |------|------|------|
13
+ | [1.1.7](./CHANGELOG.md#117---2026-04-03) | 2026-04-03 | 彻底修复 Windows external module 报错,清空 external 列表 |
13
14
  | [1.1.6](./CHANGELOG.md#116---2026-04-03) | 2026-04-03 | 修复 Windows external module 报错、全平台发版流程自动化、版本号统一 |
14
15
  | [1.1.5](./CHANGELOG.md#115---2026-04-03) | 2026-04-03 | WebUI 管理面板 (`legna admin`)、双目录管理、配置迁移、npm 全平台发布 |
15
16
  | [1.0.9](./CHANGELOG.md#109---2026-04-03) | 2026-04-03 | i18n 多语言补全、内置精美状态栏、配置自动迁移 |
package/npm/bin/legna.cjs CHANGED
@@ -26,31 +26,56 @@ if (!pkg) {
26
26
  }
27
27
 
28
28
  var binName = process.platform === "win32" ? "legna.exe" : "bin/legna";
29
- var bin = null;
30
29
 
31
- // Strategy 1: require.resolve (standard npm nested node_modules)
32
- try {
33
- bin = path.resolve(require.resolve(pkg + "/package.json"), "..", binName);
34
- } catch (e) {}
30
+ function findBin() {
31
+ // Strategy 1: require.resolve (standard npm nested node_modules)
32
+ try {
33
+ var p = path.resolve(require.resolve(pkg + "/package.json"), "..", binName);
34
+ if (fs.existsSync(p)) return p;
35
+ } catch (e) {}
35
36
 
36
- // Strategy 2: sibling in global node_modules (npm global flat layout)
37
- if (!bin || !fs.existsSync(bin)) {
38
- var globalFlat = path.resolve(__dirname, "..", "..", pkg.replace("@legna-lnc/", "@legna-lnc" + path.sep), binName);
39
- if (fs.existsSync(globalFlat)) bin = globalFlat;
40
- }
37
+ // Strategy 2: sibling in global node_modules (npm global flat layout)
38
+ // __dirname = .../node_modules/@legna-lnc/legnacode/npm/bin
39
+ // target = .../node_modules/@legna-lnc/legnacode-<platform>/...
40
+ var scopeDir = path.resolve(__dirname, "..", "..", "..");
41
+ var pkgName = pkg.split("/")[1]; // e.g. "legnacode-win32-x64"
42
+ var flat = path.resolve(scopeDir, pkgName, binName);
43
+ if (fs.existsSync(flat)) return flat;
41
44
 
42
- // Strategy 3: nested node_modules inside our own package
43
- if (!bin || !fs.existsSync(bin)) {
45
+ // Strategy 3: nested node_modules inside our own package
44
46
  var nested = path.resolve(__dirname, "..", "..", "node_modules", pkg, binName);
45
- if (fs.existsSync(nested)) bin = nested;
47
+ if (fs.existsSync(nested)) return nested;
48
+
49
+ return null;
46
50
  }
47
51
 
48
- if (!bin || !fs.existsSync(bin)) {
49
- console.error(
50
- "legna: could not find platform package " + pkg + "\n" +
51
- "Try: npm install -g " + pkg
52
+ var bin = findBin();
53
+
54
+ // Strategy 4: auto-install the platform package if missing
55
+ if (!bin) {
56
+ var version = "1.1.7";
57
+ try {
58
+ var ourPkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, "..", "..", "package.json"), "utf-8"));
59
+ version = ourPkg.version || version;
60
+ } catch (e) {}
61
+
62
+ console.error("legna: platform package " + pkg + " not found, installing...");
63
+ var install = childProcess.spawnSync(
64
+ "npm", ["install", "-g", pkg + "@" + version],
65
+ { stdio: "inherit", shell: true }
52
66
  );
53
- process.exit(1);
67
+
68
+ if (install.status === 0) {
69
+ bin = findBin();
70
+ }
71
+
72
+ if (!bin) {
73
+ console.error(
74
+ "legna: could not find or install platform package " + pkg + "\n" +
75
+ "Try manually: npm install -g " + pkg + "@" + version
76
+ );
77
+ process.exit(1);
78
+ }
54
79
  }
55
80
 
56
81
  var result = childProcess.spawnSync(bin, process.argv.slice(2), {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@legna-lnc/legnacode",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "LegnaCode — legna.lnc's official CLI for coding assistance",
5
5
  "type": "module",
6
6
  "bin": {
@@ -141,10 +141,10 @@
141
141
  "bun": ">=1.2.0"
142
142
  },
143
143
  "optionalDependencies": {
144
- "@legna-lnc/legnacode-darwin-arm64": "1.1.7",
145
- "@legna-lnc/legnacode-darwin-x64": "1.1.7",
146
- "@legna-lnc/legnacode-linux-x64": "1.1.7",
147
- "@legna-lnc/legnacode-linux-arm64": "1.1.7",
148
- "@legna-lnc/legnacode-win32-x64": "1.1.7"
144
+ "@legna-lnc/legnacode-darwin-arm64": "1.1.8",
145
+ "@legna-lnc/legnacode-darwin-x64": "1.1.8",
146
+ "@legna-lnc/legnacode-linux-x64": "1.1.8",
147
+ "@legna-lnc/legnacode-linux-arm64": "1.1.8",
148
+ "@legna-lnc/legnacode-win32-x64": "1.1.8"
149
149
  }
150
150
  }