embedlabs 0.1.0-alpha.113 → 0.1.0-alpha.115

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 CHANGED
@@ -7,4 +7,4 @@ npm install -g embedlabs@alpha
7
7
  embedlabs --help
8
8
  ```
9
9
 
10
- This package forwards to `@kvell007/embed-labs-cli@0.1.0-alpha.113`.
10
+ This package forwards to `@kvell007/embed-labs-cli@0.1.0-alpha.115`.
@@ -2,14 +2,14 @@
2
2
  import { spawnSync } from "node:child_process";
3
3
  import { chmodSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
4
4
  import { arch, platform } from "node:os";
5
- import { basename, dirname, join } from "node:path";
5
+ import { basename, dirname, join, resolve } from "node:path";
6
6
 
7
7
  const phase = process.argv[2] ?? "postinstall";
8
8
  const target = `${platform()}-${arch()}`;
9
9
  if (phase === "preinstall") {
10
10
  cleanupWindowsInstallState();
11
11
  } else {
12
- installCommandShim();
12
+ verifyInstallState();
13
13
  }
14
14
  const steps = phase === "preinstall"
15
15
  ? [
@@ -81,23 +81,35 @@ function deleteLegacyBridgeScheduledTask() {
81
81
  }
82
82
 
83
83
  function cleanupOldCommandShims() {
84
- const prefix = process.env.npm_config_prefix;
85
- if (!prefix) {
86
- return;
87
- }
88
- for (const candidate of commandShimCandidates(prefix)) {
89
- const filePath = join(prefix, candidate);
90
- if (!existsSync(filePath) || !isEmbedLabsShim(filePath)) {
91
- continue;
84
+ for (const prefix of installPrefixes()) {
85
+ for (const candidate of commandShimCandidates(prefix)) {
86
+ const filePath = join(prefix, candidate);
87
+ if (!existsSync(filePath) || !isEmbedLabsShim(filePath)) {
88
+ continue;
89
+ }
90
+ try {
91
+ rmSync(filePath, { force: true });
92
+ writeProgress(3, `install: removed stale command shim (${basename(filePath)})`);
93
+ } catch (error) {
94
+ const message = error instanceof Error ? error.message : String(error);
95
+ throw new Error(`stale EmbedLabs command shim is locked: ${filePath}; close running terminals or processes and retry npm install. ${message}`);
96
+ }
92
97
  }
93
- try {
94
- rmSync(filePath, { force: true });
95
- writeProgress(3, `install: removed stale command shim (${basename(filePath)})`);
96
- } catch (error) {
97
- const message = error instanceof Error ? error.message : String(error);
98
- throw new Error(`stale EmbedLabs command shim is locked: ${filePath}; close running terminals or processes and retry npm install. ${message}`);
98
+ }
99
+ }
100
+
101
+ function installPrefixes() {
102
+ const prefixes = new Set();
103
+ for (const candidate of [
104
+ process.env.npm_config_prefix,
105
+ process.env.PREFIX,
106
+ dirname(dirname(process.execPath))
107
+ ]) {
108
+ if (candidate) {
109
+ prefixes.add(resolve(candidate));
99
110
  }
100
111
  }
112
+ return [...prefixes];
101
113
  }
102
114
 
103
115
  function commandShimCandidates(prefix) {
@@ -123,21 +135,10 @@ function isEmbedLabsShim(filePath) {
123
135
  }
124
136
  }
125
137
 
126
- function installCommandShim() {
127
- const prefix = process.env.npm_config_prefix;
128
- if (!prefix) {
129
- return;
130
- }
131
- cleanupOldCommandShims();
132
- if (platform() === "win32") {
133
- const target = join(prefix, "embedlabs.cmd");
134
- writeFileSync(target, windowsCmdShim(), "utf8");
135
- return;
136
- }
137
- const target = join(prefix, "bin", "embedlabs");
138
- mkdirSync(dirname(target), { recursive: true });
139
- writeFileSync(target, unixShellShim(), "utf8");
140
- chmodSync(target, 0o755);
138
+ function verifyInstallState() {
139
+ // npm owns final bin-link creation. The package only removes stale legacy
140
+ // shims during preinstall; writing the command shim here can overwrite the
141
+ // package's own bin file when npm lifecycle prefixes differ by platform.
141
142
  }
142
143
 
143
144
  function windowsCmdShim() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "embedlabs",
3
- "version": "0.1.0-alpha.113",
3
+ "version": "0.1.0-alpha.115",
4
4
  "description": "EmbedLabs CLI alias package for local-first embedded agent testing.",
5
5
  "private": false,
6
6
  "type": "module",
@@ -13,7 +13,7 @@
13
13
  "README.md"
14
14
  ],
15
15
  "dependencies": {
16
- "@kvell007/embed-labs-cli": "0.1.0-alpha.113"
16
+ "@kvell007/embed-labs-cli": "0.1.0-alpha.115"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public",