noninteractive 0.3.18 → 0.3.19
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/noninteractive.js +16 -12
- package/package.json +1 -1
package/bin/noninteractive.js
CHANGED
|
@@ -347,7 +347,7 @@ var init_daemon = __esm(() => {
|
|
|
347
347
|
var require_package = __commonJS((exports, module) => {
|
|
348
348
|
module.exports = {
|
|
349
349
|
name: "noninteractive",
|
|
350
|
-
version: "0.3.
|
|
350
|
+
version: "0.3.19",
|
|
351
351
|
type: "module",
|
|
352
352
|
bin: {
|
|
353
353
|
noninteractive: "./bin/noninteractive.js"
|
|
@@ -443,15 +443,16 @@ usage: npx noninteractive <tool> [args...]
|
|
|
443
443
|
|
|
444
444
|
commands:
|
|
445
445
|
<tool> [args...] start a session (runs npx <tool> in a PTY)
|
|
446
|
-
send <session> <text> [--wait]
|
|
446
|
+
send <session> <text> [--no-wait] send keystrokes and return output (--no-wait to fire-and-forget)
|
|
447
447
|
read <session> [--wait] [--timeout N] read terminal output (--wait blocks until new output)
|
|
448
448
|
stop <session> stop a session
|
|
449
449
|
list show active sessions
|
|
450
450
|
start <cmd> [args...] explicit start (for non-npx commands)
|
|
451
451
|
|
|
452
452
|
flags:
|
|
453
|
-
--wait
|
|
454
|
-
--
|
|
453
|
+
--no-wait fire-and-forget mode for send (don't wait for output)
|
|
454
|
+
--wait, -w block until new output appears (for read)
|
|
455
|
+
--timeout <ms> max wait time in ms (default: 30000)
|
|
455
456
|
--no-open don't auto-open URLs in browser (still shown in output)
|
|
456
457
|
|
|
457
458
|
the session name is auto-derived from the tool (e.g. "workos" \u2192 session "workos").
|
|
@@ -460,9 +461,9 @@ text is sent exactly as-is \u2014 no auto-appended enter. use $'\\r' for Enter,
|
|
|
460
461
|
|
|
461
462
|
example workflow:
|
|
462
463
|
npx noninteractive workos # starts "npx workos", session = "workos"
|
|
463
|
-
npx noninteractive send workos $'\\r'
|
|
464
|
-
npx noninteractive send workos $'y\\r'
|
|
465
|
-
npx noninteractive send workos $'\\x1b[B\\r'
|
|
464
|
+
npx noninteractive send workos $'\\r' # press Enter, returns output
|
|
465
|
+
npx noninteractive send workos $'y\\r' # type "y" + Enter, returns output
|
|
466
|
+
npx noninteractive send workos $'\\x1b[B\\r' # arrow down + Enter, returns output
|
|
466
467
|
npx noninteractive read workos --wait # wait for new output (e.g. OAuth callback)
|
|
467
468
|
npx noninteractive stop workos # done, stop the session
|
|
468
469
|
|
|
@@ -601,7 +602,7 @@ make sure the command exists. examples:`);
|
|
|
601
602
|
} else {
|
|
602
603
|
console.log(`
|
|
603
604
|
[session '${name}' started \u2014 read the output above, then use:]`);
|
|
604
|
-
console.log(` npx noninteractive send ${name} "<text>"
|
|
605
|
+
console.log(` npx noninteractive send ${name} "<text>" # send and get response`);
|
|
605
606
|
console.log(` npx noninteractive read ${name} --wait # wait for new output`);
|
|
606
607
|
console.log(` npx noninteractive stop ${name} # stop the session`);
|
|
607
608
|
}
|
|
@@ -619,7 +620,7 @@ make sure the command exists. examples:`);
|
|
|
619
620
|
} catch {}
|
|
620
621
|
}
|
|
621
622
|
console.log(`[session '${name}' started but no output yet \u2014 use:]`);
|
|
622
|
-
console.log(` npx noninteractive send ${name} "<text>"
|
|
623
|
+
console.log(` npx noninteractive send ${name} "<text>" # send and get response`);
|
|
623
624
|
console.log(` npx noninteractive read ${name} --wait # wait for new output`);
|
|
624
625
|
console.log(` npx noninteractive stop ${name} # stop the session`);
|
|
625
626
|
}
|
|
@@ -640,6 +641,8 @@ async function read(name, wait, timeout, noOpen = false) {
|
|
|
640
641
|
[exited ${res.exitCode}]`);
|
|
641
642
|
}
|
|
642
643
|
async function send(name, text, wait, timeout, noOpen = false) {
|
|
644
|
+
if (text === "")
|
|
645
|
+
text = "\r";
|
|
643
646
|
const sock = socketPath(name);
|
|
644
647
|
if (wait) {
|
|
645
648
|
const res = await sendMessage(sock, { action: "sendread", data: text, timeout }, timeout + 5000);
|
|
@@ -721,12 +724,13 @@ example: npx noninteractive read vercel --wait`);
|
|
|
721
724
|
const name = positional[0];
|
|
722
725
|
const text = positional[1];
|
|
723
726
|
if (!name || text === undefined) {
|
|
724
|
-
console.error(`usage: noninteractive send <session> <text> [--wait] [--timeout <ms>]
|
|
727
|
+
console.error(`usage: noninteractive send <session> <text> [--no-wait] [--timeout <ms>]
|
|
725
728
|
|
|
726
|
-
example: npx noninteractive send workos ""
|
|
729
|
+
example: npx noninteractive send workos ""`);
|
|
727
730
|
process.exit(1);
|
|
728
731
|
}
|
|
729
|
-
const
|
|
732
|
+
const noWait = sendArgs.includes("--no-wait") || sendArgs.includes("--silent");
|
|
733
|
+
const wait = !noWait || cmd === "sendread" || sendArgs.includes("-w") || sendArgs.includes("--wait");
|
|
730
734
|
const timeoutIdx = sendArgs.indexOf("--timeout");
|
|
731
735
|
const timeout = timeoutIdx !== -1 ? Number(sendArgs[timeoutIdx + 1]) : 30000;
|
|
732
736
|
return send(name, text, wait, timeout, noOpen);
|