anyagent-bridge 0.8.1 → 0.9.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/bin/anyagent-bridge.js +1 -0
- package/bin/setup.js +9 -5
- package/package.json +1 -1
package/bin/anyagent-bridge.js
CHANGED
|
@@ -29,6 +29,7 @@ function printHelp() {
|
|
|
29
29
|
'Usage:',
|
|
30
30
|
' anyagent-bridge [options]',
|
|
31
31
|
' anyagent-bridge setup Guided, first-timer setup (recommended to start).',
|
|
32
|
+
' anyagent-bridge setup --yes Same, non-interactive (accept defaults; for automation).',
|
|
32
33
|
'',
|
|
33
34
|
'Options:',
|
|
34
35
|
' -p, --port <n> Port to listen on (default 3001).',
|
package/bin/setup.js
CHANGED
|
@@ -58,11 +58,15 @@ function firstLanIPv4() {
|
|
|
58
58
|
return null;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
//
|
|
61
|
+
// `--yes` / `-y`: run non-interactively, accept all defaults (this computer, no agent
|
|
62
|
+
// auto-install). For automation / AI-driven setup, or any non-TTY environment.
|
|
63
|
+
const AUTO = process.argv.includes('--yes') || process.argv.includes('-y');
|
|
64
|
+
|
|
65
|
+
// ── interactive prompt (degrades gracefully without a TTY or with --yes) ──────────
|
|
62
66
|
let rl = null;
|
|
63
67
|
function ask(question, choices) {
|
|
64
68
|
return new Promise((resolve) => {
|
|
65
|
-
if (!process.stdin.isTTY) { resolve(choices ? choices[0].key : ''); return; }
|
|
69
|
+
if (AUTO || !process.stdin.isTTY) { resolve(choices ? choices[0].key : ''); return; }
|
|
66
70
|
if (!rl) rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
67
71
|
rl.question(question, (answer) => resolve(answer.trim()));
|
|
68
72
|
});
|
|
@@ -72,8 +76,8 @@ async function pick(title, choices) {
|
|
|
72
76
|
out();
|
|
73
77
|
out(bold(title));
|
|
74
78
|
for (const ch of choices) out(` ${cyan(ch.key)}) ${ch.label}${ch.hint ? dim(' — ' + ch.hint) : ''}`);
|
|
75
|
-
if (!process.stdin.isTTY) {
|
|
76
|
-
out(dim(' (
|
|
79
|
+
if (AUTO || !process.stdin.isTTY) {
|
|
80
|
+
out(dim(' (non-interactive — using option ' + choices[0].key + ')'));
|
|
77
81
|
return choices[0];
|
|
78
82
|
}
|
|
79
83
|
for (;;) {
|
|
@@ -85,7 +89,7 @@ async function pick(title, choices) {
|
|
|
85
89
|
}
|
|
86
90
|
|
|
87
91
|
async function confirm(question, def = true) {
|
|
88
|
-
if (!process.stdin.isTTY) return def;
|
|
92
|
+
if (AUTO || !process.stdin.isTTY) return def;
|
|
89
93
|
const a = (await ask(`${question} ${dim(def ? '[Y/n]' : '[y/N]')} `)).toLowerCase();
|
|
90
94
|
if (!a) return def;
|
|
91
95
|
return a.startsWith('y');
|