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 +1 -1
- package/bin/install-progress.js +37 -27
- package/package.json +2 -2
package/README.md
CHANGED
package/bin/install-progress.js
CHANGED
|
@@ -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
|
|
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) {
|
|
@@ -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
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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.
|
|
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.
|
|
16
|
+
"@kvell007/embed-labs-cli": "0.1.0-alpha.114"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public",
|