@tenux/cli 0.0.7 → 0.0.9
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/{chunk-OBVRQLAG.js → chunk-3OM63UZS.js} +13 -3
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/package.json +1 -1
|
@@ -184,6 +184,7 @@ var Relay = class {
|
|
|
184
184
|
// src/handlers/claude.ts
|
|
185
185
|
import { spawn } from "child_process";
|
|
186
186
|
import { resolve } from "path";
|
|
187
|
+
import { existsSync as existsSync2, mkdirSync as mkdirSync2 } from "fs";
|
|
187
188
|
async function handleClaudeQuery(command, supabase) {
|
|
188
189
|
const {
|
|
189
190
|
prompt,
|
|
@@ -200,9 +201,14 @@ async function handleClaudeQuery(command, supabase) {
|
|
|
200
201
|
cwd = resolved;
|
|
201
202
|
}
|
|
202
203
|
}
|
|
204
|
+
if (!existsSync2(cwd)) {
|
|
205
|
+
mkdirSync2(cwd, { recursive: true });
|
|
206
|
+
}
|
|
203
207
|
const args = [
|
|
204
208
|
"--print",
|
|
205
209
|
// non-interactive
|
|
210
|
+
"--verbose",
|
|
211
|
+
// required for stream-json with --print
|
|
206
212
|
"--output-format",
|
|
207
213
|
"stream-json"
|
|
208
214
|
// structured streaming output
|
|
@@ -215,7 +221,7 @@ async function handleClaudeQuery(command, supabase) {
|
|
|
215
221
|
const proc = spawn(claudeBin, args, {
|
|
216
222
|
cwd,
|
|
217
223
|
shell: isWindows,
|
|
218
|
-
stdio: ["
|
|
224
|
+
stdio: ["ignore", "pipe", "pipe"]
|
|
219
225
|
// env is omitted — Node inherits parent process.env automatically.
|
|
220
226
|
// Spreading env on Windows can lose system variables and cause ENOENT.
|
|
221
227
|
});
|
|
@@ -261,12 +267,15 @@ async function handleClaudeQuery(command, supabase) {
|
|
|
261
267
|
}
|
|
262
268
|
}
|
|
263
269
|
});
|
|
270
|
+
let stderrText = "";
|
|
264
271
|
proc.stderr.on("data", (chunk) => {
|
|
272
|
+
const text = chunk.toString();
|
|
273
|
+
stderrText += text;
|
|
265
274
|
batch.push({
|
|
266
275
|
command_id: command.id,
|
|
267
276
|
seq: seq++,
|
|
268
277
|
type: "stderr",
|
|
269
|
-
data: { text
|
|
278
|
+
data: { text }
|
|
270
279
|
});
|
|
271
280
|
});
|
|
272
281
|
return new Promise((promiseResolve, reject) => {
|
|
@@ -291,7 +300,8 @@ async function handleClaudeQuery(command, supabase) {
|
|
|
291
300
|
status: exitCode === 0 ? "done" : "error",
|
|
292
301
|
result: {
|
|
293
302
|
exit_code: exitCode,
|
|
294
|
-
...capturedSessionId ? { session_id: capturedSessionId } : {}
|
|
303
|
+
...capturedSessionId ? { session_id: capturedSessionId } : {},
|
|
304
|
+
...exitCode !== 0 && stderrText ? { error: stderrText.trim().slice(0, 500) } : {}
|
|
295
305
|
},
|
|
296
306
|
completed_at: (/* @__PURE__ */ new Date()).toISOString()
|
|
297
307
|
}).eq("id", command.id);
|
package/dist/cli.js
CHANGED
package/dist/index.js
CHANGED