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 +1 -1
- package/bin/install-progress.js +32 -31
- package/package.json +2 -2
package/README.md
CHANGED
package/bin/install-progress.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
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
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
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.
|
|
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.
|
|
16
|
+
"@kvell007/embed-labs-cli": "0.1.0-alpha.115"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public",
|