embedlabs 0.1.0-alpha.112 → 0.1.0-alpha.114

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.112`.
10
+ This package forwards to `@kvell007/embed-labs-cli@0.1.0-alpha.114`.
@@ -2,7 +2,7 @@
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()}`;
@@ -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) {
@@ -124,20 +136,18 @@ function isEmbedLabsShim(filePath) {
124
136
  }
125
137
 
126
138
  function installCommandShim() {
127
- const prefix = process.env.npm_config_prefix;
128
- if (!prefix) {
129
- return;
130
- }
131
139
  cleanupOldCommandShims();
132
- if (platform() === "win32") {
133
- const target = join(prefix, "embedlabs.cmd");
134
- writeFileSync(target, windowsCmdShim(), "utf8");
135
- return;
140
+ for (const prefix of installPrefixes()) {
141
+ if (platform() === "win32") {
142
+ const target = join(prefix, "embedlabs.cmd");
143
+ writeFileSync(target, windowsCmdShim(), "utf8");
144
+ continue;
145
+ }
146
+ const target = join(prefix, "bin", "embedlabs");
147
+ mkdirSync(dirname(target), { recursive: true });
148
+ writeFileSync(target, unixShellShim(), "utf8");
149
+ chmodSync(target, 0o755);
136
150
  }
137
- const target = join(prefix, "bin", "embedlabs");
138
- mkdirSync(dirname(target), { recursive: true });
139
- writeFileSync(target, unixShellShim(), "utf8");
140
- chmodSync(target, 0o755);
141
151
  }
142
152
 
143
153
  function windowsCmdShim() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "embedlabs",
3
- "version": "0.1.0-alpha.112",
3
+ "version": "0.1.0-alpha.114",
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.112"
16
+ "@kvell007/embed-labs-cli": "0.1.0-alpha.114"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public",