claudekit-cli 3.36.0-dev.30 → 3.36.0-dev.31
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/bin/ck.js +21 -27
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/bin/ck.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* This is the entry point that NPM symlinks to when installing globally.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import { execSync, spawn } from "node:child_process";
|
|
9
|
+
import { execSync, spawn, spawnSync } from "node:child_process";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
import { dirname, join } from "node:path";
|
|
12
12
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -68,8 +68,11 @@ const hasBun = () => {
|
|
|
68
68
|
/**
|
|
69
69
|
* Run CLI via bun runtime. Preferred over Node.js when dist/index.js contains
|
|
70
70
|
* bun-specific imports (e.g., bun:sqlite) that the Node.js ESM loader rejects.
|
|
71
|
+
* Uses spawnSync to hand full terminal control to bun — this prevents Unicode
|
|
72
|
+
* rendering issues (garbled @clack/prompts box-drawing chars) that occur when
|
|
73
|
+
* bun runs as an async child of a Node.js parent process.
|
|
71
74
|
* @param {boolean} showWarning - Whether to show runtime info message
|
|
72
|
-
* @returns {
|
|
75
|
+
* @returns {boolean} true if bun ran successfully, false if spawn failed
|
|
73
76
|
*/
|
|
74
77
|
const runWithBun = (showWarning = false) => {
|
|
75
78
|
const distPath = join(__dirname, "..", "dist", "index.js");
|
|
@@ -79,24 +82,18 @@ const runWithBun = (showWarning = false) => {
|
|
|
79
82
|
if (showWarning) {
|
|
80
83
|
console.error("⚠️ Native binary not found, using bun runtime");
|
|
81
84
|
}
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
windowsHide: true,
|
|
86
|
-
});
|
|
87
|
-
child.on("error", () => {
|
|
88
|
-
// bun spawn failed unexpectedly — caller handles fallback
|
|
89
|
-
resolve(false);
|
|
90
|
-
});
|
|
91
|
-
child.on("exit", (code, signal) => {
|
|
92
|
-
if (signal) {
|
|
93
|
-
process.kill(process.pid, signal);
|
|
94
|
-
return;
|
|
95
|
-
}
|
|
96
|
-
process.exitCode = code || 0;
|
|
97
|
-
resolve(true);
|
|
98
|
-
});
|
|
85
|
+
const result = spawnSync("bun", [distPath, ...process.argv.slice(2)], {
|
|
86
|
+
stdio: "inherit",
|
|
87
|
+
windowsHide: true,
|
|
99
88
|
});
|
|
89
|
+
if (result.error) {
|
|
90
|
+
// bun spawn failed (e.g., ENOENT) — caller handles fallback
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (result.signal) {
|
|
94
|
+
process.kill(process.pid, result.signal);
|
|
95
|
+
}
|
|
96
|
+
process.exit(result.status || 0);
|
|
100
97
|
};
|
|
101
98
|
|
|
102
99
|
/**
|
|
@@ -167,14 +164,11 @@ const runBinary = (binaryPath) => {
|
|
|
167
164
|
|
|
168
165
|
child.on("error", async (err) => {
|
|
169
166
|
// Binary execution failed (e.g., ENOENT on Alpine/musl due to missing glibc)
|
|
170
|
-
// Fall back to bun, then Node.js
|
|
167
|
+
// Fall back to bun (exits process on success), then Node.js
|
|
171
168
|
errorOccurred = true;
|
|
172
169
|
if (hasBun()) {
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
resolve();
|
|
176
|
-
return;
|
|
177
|
-
}
|
|
170
|
+
// runWithBun calls process.exit() on success — won't return here
|
|
171
|
+
runWithBun(true);
|
|
178
172
|
}
|
|
179
173
|
try {
|
|
180
174
|
await runWithNode(true);
|
|
@@ -221,9 +215,9 @@ const runBinary = (binaryPath) => {
|
|
|
221
215
|
*/
|
|
222
216
|
const handleFallback = async (errorPrefix, showIssueLink = false) => {
|
|
223
217
|
// Prefer bun — dist/index.js may contain bun-specific imports (bun:sqlite)
|
|
218
|
+
// runWithBun calls process.exit() on success — won't return here
|
|
224
219
|
if (hasBun()) {
|
|
225
|
-
|
|
226
|
-
if (success) return;
|
|
220
|
+
runWithBun(true);
|
|
227
221
|
}
|
|
228
222
|
// Last resort: Node.js (works for stable builds without bun: imports)
|
|
229
223
|
try {
|
package/dist/index.js
CHANGED
|
@@ -56626,7 +56626,7 @@ var package_default;
|
|
|
56626
56626
|
var init_package = __esm(() => {
|
|
56627
56627
|
package_default = {
|
|
56628
56628
|
name: "claudekit-cli",
|
|
56629
|
-
version: "3.36.0-dev.
|
|
56629
|
+
version: "3.36.0-dev.31",
|
|
56630
56630
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
56631
56631
|
type: "module",
|
|
56632
56632
|
repository: {
|