@phren/cli 0.3.70 → 0.3.71
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.
|
@@ -27,16 +27,41 @@ const GUTTER = /^(\s*)│(?: |$)/;
|
|
|
27
27
|
* with its "Esc to cancel" footer or the review's Submit/Cancel rows. */
|
|
28
28
|
export function claudeQuestionDialog(text) {
|
|
29
29
|
const lines = joinDialogFooters(text.split(/\r?\n/));
|
|
30
|
-
let bar = -1;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
30
|
+
let bar = -1, barEnd = -1, tabBar = "";
|
|
31
|
+
// A narrow pane soft-wraps the tab bar. Reading only its last physical
|
|
32
|
+
// row either loses tabs (a false set mismatch) or misses the dialog when
|
|
33
|
+
// that row contains only Submit. Keep the complete last bar and start
|
|
34
|
+
// the body after all of its physical rows.
|
|
35
|
+
for (let end = lines.length - 1; end >= 0 && bar < 0; end--) {
|
|
36
|
+
let candidates = [];
|
|
37
|
+
for (let start = end; start >= 0; start--) {
|
|
38
|
+
const line = lines[start];
|
|
39
|
+
if (!line.trim() || /^─+$/.test(line.trim()))
|
|
40
|
+
break;
|
|
41
|
+
// Terminal cell counts cannot reliably recover a wrap boundary (emoji
|
|
42
|
+
// sequences vary by terminal), and a capture drops the space a row
|
|
43
|
+
// wrapped after. Keep both joins of each wrap, no space first, while
|
|
44
|
+
// they still end in the Submit suffix; a complete bar wins over one
|
|
45
|
+
// that only has the suffix.
|
|
46
|
+
const joins = candidates.length ? candidates.flatMap(value => [line + value, line + " " + value]) : [line];
|
|
47
|
+
const viable = joins.filter(value => TAB_BAR.test(value) || /✔\s+Submit\s*(?:→\s*)?$/.test(value));
|
|
48
|
+
candidates = (viable.length ? viable : joins.slice(0, 1)).slice(0, 16);
|
|
49
|
+
const complete = candidates.find(value => TAB_BAR.test(value) && /[☐☒]/.test(value));
|
|
50
|
+
if (complete) {
|
|
51
|
+
bar = start;
|
|
52
|
+
barEnd = end;
|
|
53
|
+
tabBar = complete;
|
|
54
|
+
}
|
|
55
|
+
// The leading arrow is the start of this bar. A checkbox in earlier
|
|
56
|
+
// output belongs to that output, even when there is no blank row.
|
|
57
|
+
if (/^\s*←/.test(line))
|
|
58
|
+
break;
|
|
35
59
|
}
|
|
60
|
+
}
|
|
36
61
|
if (bar < 0)
|
|
37
62
|
return undefined;
|
|
38
|
-
const tabs = [...
|
|
39
|
-
const body = lines.slice(
|
|
63
|
+
const tabs = [...tabBar.matchAll(/[☐☒]\s+([^☐☒✔→]+?)(?=\s{2,}|\s*[☐☒✔→]|\s*$)/g)].map(match => match[1].trim());
|
|
64
|
+
const body = lines.slice(barEnd + 1);
|
|
40
65
|
const tail = body.map(line => line.trim()).filter(line => line && !/^─+$/.test(line));
|
|
41
66
|
if (!/^(?:Enter to .*Esc to cancel|2\. Cancel)$/.test(tail.at(-1) ?? ""))
|
|
42
67
|
return undefined;
|
package/dist/bridge-hook.mjs
CHANGED
|
@@ -26236,14 +26236,27 @@ var init_terminal_dialog_text = __esm({
|
|
|
26236
26236
|
// src/bridge/claude-question-dialog.ts
|
|
26237
26237
|
function claudeQuestionDialog(text6) {
|
|
26238
26238
|
const lines = joinDialogFooters(text6.split(/\r?\n/));
|
|
26239
|
-
let bar = -1;
|
|
26240
|
-
for (let
|
|
26241
|
-
|
|
26242
|
-
|
|
26239
|
+
let bar = -1, barEnd = -1, tabBar = "";
|
|
26240
|
+
for (let end = lines.length - 1; end >= 0 && bar < 0; end--) {
|
|
26241
|
+
let candidates = [];
|
|
26242
|
+
for (let start = end; start >= 0; start--) {
|
|
26243
|
+
const line = lines[start];
|
|
26244
|
+
if (!line.trim() || /^─+$/.test(line.trim())) break;
|
|
26245
|
+
const joins = candidates.length ? candidates.flatMap((value2) => [line + value2, line + " " + value2]) : [line];
|
|
26246
|
+
const viable = joins.filter((value2) => TAB_BAR.test(value2) || /✔\s+Submit\s*(?:→\s*)?$/.test(value2));
|
|
26247
|
+
candidates = (viable.length ? viable : joins.slice(0, 1)).slice(0, 16);
|
|
26248
|
+
const complete = candidates.find((value2) => TAB_BAR.test(value2) && /[☐☒]/.test(value2));
|
|
26249
|
+
if (complete) {
|
|
26250
|
+
bar = start;
|
|
26251
|
+
barEnd = end;
|
|
26252
|
+
tabBar = complete;
|
|
26253
|
+
}
|
|
26254
|
+
if (/^\s*←/.test(line)) break;
|
|
26255
|
+
}
|
|
26243
26256
|
}
|
|
26244
26257
|
if (bar < 0) return void 0;
|
|
26245
|
-
const tabs = [...
|
|
26246
|
-
const body2 = lines.slice(
|
|
26258
|
+
const tabs = [...tabBar.matchAll(/[☐☒]\s+([^☐☒✔→]+?)(?=\s{2,}|\s*[☐☒✔→]|\s*$)/g)].map((match) => match[1].trim());
|
|
26259
|
+
const body2 = lines.slice(barEnd + 1);
|
|
26247
26260
|
const tail3 = body2.map((line) => line.trim()).filter((line) => line && !/^─+$/.test(line));
|
|
26248
26261
|
if (!/^(?:Enter to .*Esc to cancel|2\. Cancel)$/.test(tail3.at(-1) ?? "")) return void 0;
|
|
26249
26262
|
if (lines.slice(0, bar).filter((line) => /^\s*```/.test(line)).length % 2) return void 0;
|
|
@@ -38520,7 +38533,7 @@ var init_package_metadata = __esm({
|
|
|
38520
38533
|
__dirname = path35.dirname(fileURLToPath2(import.meta.url));
|
|
38521
38534
|
ROOT = path35.join(__dirname, "..");
|
|
38522
38535
|
PACKAGE_JSON_PATH = path35.join(ROOT, "package.json");
|
|
38523
|
-
BUNDLED_VERSION = true ? "0.3.
|
|
38536
|
+
BUNDLED_VERSION = true ? "0.3.71" : "0.0.0";
|
|
38524
38537
|
PACKAGE_JSON = readPackageJson();
|
|
38525
38538
|
PACKAGE_NAME = PACKAGE_JSON.name || "phren";
|
|
38526
38539
|
VERSION = PACKAGE_JSON.version || BUNDLED_VERSION;
|
|
@@ -88273,7 +88286,7 @@ async function main() {
|
|
|
88273
88286
|
return askpass2(args[1]);
|
|
88274
88287
|
}
|
|
88275
88288
|
const { runBridge: runBridge2 } = await Promise.resolve().then(() => (init_command(), command_exports));
|
|
88276
|
-
return runBridge2(args, "0.3.
|
|
88289
|
+
return runBridge2(args, "0.3.71");
|
|
88277
88290
|
}
|
|
88278
88291
|
main().then((code) => {
|
|
88279
88292
|
process.exitCode = code;
|