@mistweaverco/kulala-core 0.18.1 → 0.19.0
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/cli.js +24 -10
- package/dist/index.js +10 -2
- package/dist/install-backend.js +1 -1
- package/dist/lib/downloader/index.d.ts +2 -0
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/cli.ts
|
|
4
|
-
import {
|
|
4
|
+
import { spawn } from "node:child_process";
|
|
5
5
|
|
|
6
6
|
// src/lib/downloader/index.ts
|
|
7
7
|
import fs from "node:fs";
|
|
@@ -11,7 +11,7 @@ import { chmodSync, createWriteStream } from "node:fs";
|
|
|
11
11
|
import { pipeline } from "node:stream/promises";
|
|
12
12
|
|
|
13
13
|
// src/versions/backend.ts
|
|
14
|
-
var KULALA_CORE_VERSION = "0.
|
|
14
|
+
var KULALA_CORE_VERSION = "0.19.0";
|
|
15
15
|
|
|
16
16
|
// src/lib/downloader/index.ts
|
|
17
17
|
var PACKAGE_ROOT = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -185,7 +185,7 @@ async function tryInstallBackend() {
|
|
|
185
185
|
console.error("@mistweaverco/kulala-core will attempt to download it on first use instead.");
|
|
186
186
|
}
|
|
187
187
|
}
|
|
188
|
-
|
|
188
|
+
function resolveExecutableSync() {
|
|
189
189
|
const fromEnv = process.env.KULALA_CORE_PATH;
|
|
190
190
|
if (fromEnv && fromEnv.length > 0) {
|
|
191
191
|
if (!fs.existsSync(fromEnv)) {
|
|
@@ -200,6 +200,13 @@ async function ensureInstalled() {
|
|
|
200
200
|
if (binaryExists() && versionMatches()) {
|
|
201
201
|
return getBinPath();
|
|
202
202
|
}
|
|
203
|
+
return null;
|
|
204
|
+
}
|
|
205
|
+
async function ensureInstalled() {
|
|
206
|
+
const cached = resolveExecutableSync();
|
|
207
|
+
if (cached) {
|
|
208
|
+
return cached;
|
|
209
|
+
}
|
|
203
210
|
if (binaryExists()) {
|
|
204
211
|
removeStaleBinary();
|
|
205
212
|
}
|
|
@@ -208,6 +215,7 @@ async function ensureInstalled() {
|
|
|
208
215
|
}
|
|
209
216
|
var downloader = {
|
|
210
217
|
ensureInstalled,
|
|
218
|
+
resolveExecutableSync,
|
|
211
219
|
getBinPath,
|
|
212
220
|
installBackend,
|
|
213
221
|
tryInstallBackend
|
|
@@ -215,15 +223,21 @@ var downloader = {
|
|
|
215
223
|
|
|
216
224
|
// src/cli.ts
|
|
217
225
|
async function main() {
|
|
218
|
-
const executable = await downloader.ensureInstalled();
|
|
219
|
-
const
|
|
220
|
-
stdio:
|
|
226
|
+
const executable = downloader.resolveExecutableSync() ?? await downloader.ensureInstalled();
|
|
227
|
+
const child = spawn(executable, process.argv.slice(2), {
|
|
228
|
+
stdio: [process.stdin, process.stdout, process.stderr],
|
|
221
229
|
env: process.env
|
|
222
230
|
});
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
231
|
+
await new Promise((resolve, reject) => {
|
|
232
|
+
child.on("error", reject);
|
|
233
|
+
child.on("close", (code, signal) => {
|
|
234
|
+
if (signal) {
|
|
235
|
+
process.kill(process.pid, signal);
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
process.exit(code ?? 1);
|
|
239
|
+
});
|
|
240
|
+
});
|
|
227
241
|
}
|
|
228
242
|
main().catch((error) => {
|
|
229
243
|
const message = error instanceof Error ? error.message : String(error);
|
package/dist/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { chmodSync, createWriteStream } from "node:fs";
|
|
|
9
9
|
import { pipeline } from "node:stream/promises";
|
|
10
10
|
|
|
11
11
|
// src/versions/backend.ts
|
|
12
|
-
var KULALA_CORE_VERSION = "0.
|
|
12
|
+
var KULALA_CORE_VERSION = "0.19.0";
|
|
13
13
|
|
|
14
14
|
// src/lib/downloader/index.ts
|
|
15
15
|
var PACKAGE_ROOT = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -183,7 +183,7 @@ async function tryInstallBackend() {
|
|
|
183
183
|
console.error("@mistweaverco/kulala-core will attempt to download it on first use instead.");
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
|
-
|
|
186
|
+
function resolveExecutableSync() {
|
|
187
187
|
const fromEnv = process.env.KULALA_CORE_PATH;
|
|
188
188
|
if (fromEnv && fromEnv.length > 0) {
|
|
189
189
|
if (!fs.existsSync(fromEnv)) {
|
|
@@ -198,6 +198,13 @@ async function ensureInstalled() {
|
|
|
198
198
|
if (binaryExists() && versionMatches()) {
|
|
199
199
|
return getBinPath();
|
|
200
200
|
}
|
|
201
|
+
return null;
|
|
202
|
+
}
|
|
203
|
+
async function ensureInstalled() {
|
|
204
|
+
const cached = resolveExecutableSync();
|
|
205
|
+
if (cached) {
|
|
206
|
+
return cached;
|
|
207
|
+
}
|
|
201
208
|
if (binaryExists()) {
|
|
202
209
|
removeStaleBinary();
|
|
203
210
|
}
|
|
@@ -206,6 +213,7 @@ async function ensureInstalled() {
|
|
|
206
213
|
}
|
|
207
214
|
var downloader = {
|
|
208
215
|
ensureInstalled,
|
|
216
|
+
resolveExecutableSync,
|
|
209
217
|
getBinPath,
|
|
210
218
|
installBackend,
|
|
211
219
|
tryInstallBackend
|
package/dist/install-backend.js
CHANGED
|
@@ -11,7 +11,7 @@ import { chmodSync, createWriteStream } from "node:fs";
|
|
|
11
11
|
import { pipeline } from "node:stream/promises";
|
|
12
12
|
|
|
13
13
|
// src/versions/backend.ts
|
|
14
|
-
var KULALA_CORE_VERSION = "0.
|
|
14
|
+
var KULALA_CORE_VERSION = "0.19.0";
|
|
15
15
|
|
|
16
16
|
// src/lib/downloader/index.ts
|
|
17
17
|
var PACKAGE_ROOT = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -5,9 +5,11 @@ export declare function installBackend(): Promise<void>;
|
|
|
5
5
|
* Never throws; logs a warning when download fails so first-use fallback can run.
|
|
6
6
|
*/
|
|
7
7
|
export declare function tryInstallBackend(): Promise<void>;
|
|
8
|
+
export declare function resolveExecutableSync(): string | null;
|
|
8
9
|
export declare function ensureInstalled(): Promise<string>;
|
|
9
10
|
export declare const downloader: {
|
|
10
11
|
ensureInstalled: typeof ensureInstalled;
|
|
12
|
+
resolveExecutableSync: typeof resolveExecutableSync;
|
|
11
13
|
getBinPath: typeof getBinPath;
|
|
12
14
|
installBackend: typeof installBackend;
|
|
13
15
|
tryInstallBackend: typeof tryInstallBackend;
|