@kvell007/embed-labs-cli 0.1.0-alpha.76 → 0.1.0-alpha.78
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/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1567,7 +1567,7 @@ async function installOpenCodePlugin(parsed, context) {
|
|
|
1567
1567
|
}
|
|
1568
1568
|
await mkdir(join(targetRoot, "plugins"), { recursive: true });
|
|
1569
1569
|
const packagePath = await prepareOpenCodePackageForInstall(targetRoot, source.data.packagePath);
|
|
1570
|
-
const npmResult = await runLocalProcess(
|
|
1570
|
+
const npmResult = await runLocalProcess(await resolveNpmExecutable(), [
|
|
1571
1571
|
"install",
|
|
1572
1572
|
"--prefix",
|
|
1573
1573
|
targetRoot,
|
|
@@ -1649,7 +1649,7 @@ async function resolveOpenCodePluginSource(context) {
|
|
|
1649
1649
|
remediation: "Run from the Embed-Labs-Cloud repo root or pass --release-dir pointing to a plugin release directory."
|
|
1650
1650
|
});
|
|
1651
1651
|
}
|
|
1652
|
-
const packed = await runLocalProcess(
|
|
1652
|
+
const packed = await runLocalProcess(await resolveNpmExecutable(), ["pack", packagePath, "--pack-destination", context.tempDir, "--json"]);
|
|
1653
1653
|
if (packed.code !== 0) {
|
|
1654
1654
|
return fail("opencode_plugin_pack_failed", "npm pack failed while preparing the OpenCode plugin source package.", {
|
|
1655
1655
|
details: {
|
|
@@ -1980,6 +1980,10 @@ async function resolveExecutableOnPath(name) {
|
|
|
1980
1980
|
}
|
|
1981
1981
|
return undefined;
|
|
1982
1982
|
}
|
|
1983
|
+
async function resolveNpmExecutable() {
|
|
1984
|
+
const candidate = process.platform === "win32" ? "npm.cmd" : "npm";
|
|
1985
|
+
return await resolveExecutableOnPath(candidate) ?? candidate;
|
|
1986
|
+
}
|
|
1983
1987
|
async function resolveBridgeLauncher() {
|
|
1984
1988
|
const explicitBinary = process.env.EMBED_LOCAL_BRIDGE_BINARY?.trim();
|
|
1985
1989
|
if (explicitBinary) {
|
|
@@ -2079,19 +2083,27 @@ async function pathExists(pathValue) {
|
|
|
2079
2083
|
}
|
|
2080
2084
|
async function runLocalProcess(command, args) {
|
|
2081
2085
|
return await new Promise((resolveProcess) => {
|
|
2082
|
-
|
|
2083
|
-
|
|
2084
|
-
|
|
2085
|
-
|
|
2086
|
-
|
|
2086
|
+
let child;
|
|
2087
|
+
try {
|
|
2088
|
+
child = spawn(command, args, {
|
|
2089
|
+
cwd: process.cwd(),
|
|
2090
|
+
env: process.env,
|
|
2091
|
+
shell: process.platform === "win32",
|
|
2092
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
2093
|
+
});
|
|
2094
|
+
}
|
|
2095
|
+
catch (error) {
|
|
2096
|
+
resolveProcess({ code: 127, stdout: "", stderr: error instanceof Error ? error.message : String(error) });
|
|
2097
|
+
return;
|
|
2098
|
+
}
|
|
2087
2099
|
let stdout = "";
|
|
2088
2100
|
let stderr = "";
|
|
2089
|
-
child.stdout
|
|
2090
|
-
child.stderr
|
|
2091
|
-
child.stdout
|
|
2101
|
+
child.stdout?.setEncoding("utf8");
|
|
2102
|
+
child.stderr?.setEncoding("utf8");
|
|
2103
|
+
child.stdout?.on("data", (chunk) => {
|
|
2092
2104
|
stdout += chunk;
|
|
2093
2105
|
});
|
|
2094
|
-
child.stderr
|
|
2106
|
+
child.stderr?.on("data", (chunk) => {
|
|
2095
2107
|
stderr += chunk;
|
|
2096
2108
|
});
|
|
2097
2109
|
child.on("error", (error) => {
|