claudekit-cli 3.36.0-dev.30 → 3.36.0-dev.32
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 +5 -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
|
@@ -41746,6 +41746,10 @@ class PathResolver {
|
|
|
41746
41746
|
if (testHome) {
|
|
41747
41747
|
return join12(testHome, ".claude");
|
|
41748
41748
|
}
|
|
41749
|
+
const claudeConfigDir = process.env.CLAUDE_CONFIG_DIR;
|
|
41750
|
+
if (claudeConfigDir) {
|
|
41751
|
+
return claudeConfigDir;
|
|
41752
|
+
}
|
|
41749
41753
|
return join12(homedir10(), ".claude");
|
|
41750
41754
|
}
|
|
41751
41755
|
static getClaudeKitDir() {
|
|
@@ -56626,7 +56630,7 @@ var package_default;
|
|
|
56626
56630
|
var init_package = __esm(() => {
|
|
56627
56631
|
package_default = {
|
|
56628
56632
|
name: "claudekit-cli",
|
|
56629
|
-
version: "3.36.0-dev.
|
|
56633
|
+
version: "3.36.0-dev.32",
|
|
56630
56634
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
56631
56635
|
type: "module",
|
|
56632
56636
|
repository: {
|