@unieai/code 0.0.11 → 0.0.12

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/preload.ts +24 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unieai/code",
3
- "version": "0.0.11",
3
+ "version": "0.0.12",
4
4
  "private": false,
5
5
  "publishConfig": {
6
6
  "access": "public"
package/preload.ts CHANGED
@@ -1,5 +1,27 @@
1
- const version = process.env.CLAUDE_CODE_LOCAL_VERSION ?? '0.0.10';
2
- const packageUrl = process.env.CLAUDE_CODE_LOCAL_PACKAGE_URL ?? '@unieai/code';
1
+ // Read the real version/name from the package.json shipped alongside this file
2
+ // (it sits at the package root, next to preload.ts). Without this MACRO.VERSION
3
+ // was frozen at a hardcoded literal, so `unieai --version` lied and the
4
+ // auto-updater compared the npm `latest` against a stale baseline — meaning it
5
+ // never noticed a newer published version. The env vars still win for local
6
+ // dev / CI overrides.
7
+ import { readFileSync } from 'node:fs';
8
+ import { dirname, join } from 'node:path';
9
+ import { fileURLToPath } from 'node:url';
10
+
11
+ let pkgVersion = '0.0.0';
12
+ let pkgName = '@unieai/code';
13
+ try {
14
+ const pkgPath = join(dirname(fileURLToPath(import.meta.url)), 'package.json');
15
+ const pkg = JSON.parse(readFileSync(pkgPath, 'utf8'));
16
+ if (typeof pkg.version === 'string') pkgVersion = pkg.version;
17
+ if (typeof pkg.name === 'string') pkgName = pkg.name;
18
+ } catch {
19
+ // Fall back to defaults if package.json can't be read (shouldn't happen in a
20
+ // normal install, but never block startup over it).
21
+ }
22
+
23
+ const version = process.env.CLAUDE_CODE_LOCAL_VERSION ?? pkgVersion;
24
+ const packageUrl = process.env.CLAUDE_CODE_LOCAL_PACKAGE_URL ?? pkgName;
3
25
  const buildTime = process.env.CLAUDE_CODE_LOCAL_BUILD_TIME ?? new Date().toISOString();
4
26
 
5
27
  process.env.CLAUDE_CODE_LOCAL_SKIP_REMOTE_PREFETCH ??= '1';