rechrome 1.11.0 → 1.11.2
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/package.json +1 -1
- package/rech.js +12 -5
- package/rech.ts +12 -5
package/package.json
CHANGED
package/rech.js
CHANGED
|
@@ -661,10 +661,11 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
661
661
|
(info.user_name ?? "").toLowerCase().includes(opts.profile!.toLowerCase())
|
|
662
662
|
) ?? null;
|
|
663
663
|
}
|
|
664
|
-
if (
|
|
665
|
-
console.log(
|
|
666
|
-
return available[0]
|
|
664
|
+
if (available.length === 1) {
|
|
665
|
+
console.log(` Only one profile available — selecting: ${available[0][1].user_name || available[0][0]}`);
|
|
666
|
+
return available[0];
|
|
667
667
|
}
|
|
668
|
+
if (!isTTY) console.log(" [agent] Provide profile number on next stdin line, or rerun with --profile <num|email>");
|
|
668
669
|
const answer = await ask("\n Profile number: ");
|
|
669
670
|
const idx = parseInt(answer.trim()) - 1;
|
|
670
671
|
if (isNaN(idx) || idx < 0 || idx >= available.length) return null;
|
|
@@ -677,11 +678,17 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
677
678
|
while (true) {
|
|
678
679
|
const found = await findInstalledExtension(profileDir);
|
|
679
680
|
if (found) { extId = found.id; break; }
|
|
681
|
+
console.log(`\n Extension not found in profile: ${profileDisplay}`);
|
|
682
|
+
console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
|
|
683
|
+
// Non-TTY (agent/pipe) can't install an extension interactively, and `ask` doesn't block on an exhausted stdin queue —
|
|
684
|
+
// looping here would spawn `open` per iteration until the OS runs out of resources. Fail fast instead.
|
|
685
|
+
if (!isTTY) {
|
|
686
|
+
console.error(` Non-TTY: cannot install extension interactively — aborting`);
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
680
689
|
const setupHtmlPath = join(RECH_HOME_DIR, "setup.html");
|
|
681
690
|
mkdirSync(RECH_HOME_DIR, { recursive: true });
|
|
682
691
|
await Bun.write(setupHtmlPath, buildSetupHtml(EXTENSION_DIST_DIR, profileDisplay));
|
|
683
|
-
console.log(`\n Extension not found in profile: ${profileDisplay}`);
|
|
684
|
-
console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
|
|
685
692
|
console.log(`\n Opening install guide in your browser...`);
|
|
686
693
|
Bun.spawn(["open", setupHtmlPath], { stdout: "ignore", stderr: "ignore" });
|
|
687
694
|
await ask("\n Press Enter after loading the extension to retry...");
|
package/rech.ts
CHANGED
|
@@ -661,10 +661,11 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
661
661
|
(info.user_name ?? "").toLowerCase().includes(opts.profile!.toLowerCase())
|
|
662
662
|
) ?? null;
|
|
663
663
|
}
|
|
664
|
-
if (
|
|
665
|
-
console.log(
|
|
666
|
-
return available[0]
|
|
664
|
+
if (available.length === 1) {
|
|
665
|
+
console.log(` Only one profile available — selecting: ${available[0][1].user_name || available[0][0]}`);
|
|
666
|
+
return available[0];
|
|
667
667
|
}
|
|
668
|
+
if (!isTTY) console.log(" [agent] Provide profile number on next stdin line, or rerun with --profile <num|email>");
|
|
668
669
|
const answer = await ask("\n Profile number: ");
|
|
669
670
|
const idx = parseInt(answer.trim()) - 1;
|
|
670
671
|
if (isNaN(idx) || idx < 0 || idx >= available.length) return null;
|
|
@@ -677,11 +678,17 @@ async function setup(opts: { profile?: string } = {}): Promise<void> {
|
|
|
677
678
|
while (true) {
|
|
678
679
|
const found = await findInstalledExtension(profileDir);
|
|
679
680
|
if (found) { extId = found.id; break; }
|
|
681
|
+
console.log(`\n Extension not found in profile: ${profileDisplay}`);
|
|
682
|
+
console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
|
|
683
|
+
// Non-TTY (agent/pipe) can't install an extension interactively, and `ask` doesn't block on an exhausted stdin queue —
|
|
684
|
+
// looping here would spawn `open` per iteration until the OS runs out of resources. Fail fast instead.
|
|
685
|
+
if (!isTTY) {
|
|
686
|
+
console.error(` Non-TTY: cannot install extension interactively — aborting`);
|
|
687
|
+
return null;
|
|
688
|
+
}
|
|
680
689
|
const setupHtmlPath = join(RECH_HOME_DIR, "setup.html");
|
|
681
690
|
mkdirSync(RECH_HOME_DIR, { recursive: true });
|
|
682
691
|
await Bun.write(setupHtmlPath, buildSetupHtml(EXTENSION_DIST_DIR, profileDisplay));
|
|
683
|
-
console.log(`\n Extension not found in profile: ${profileDisplay}`);
|
|
684
|
-
console.log(` Extension dist: ${EXTENSION_DIST_DIR}`);
|
|
685
692
|
console.log(`\n Opening install guide in your browser...`);
|
|
686
693
|
Bun.spawn(["open", setupHtmlPath], { stdout: "ignore", stderr: "ignore" });
|
|
687
694
|
await ask("\n Press Enter after loading the extension to retry...");
|