@threadbase-sh/streamer 1.70.3 → 1.70.4
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/cli.cjs +16 -4
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +15 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/services/questions/detectQuestionFromScreen.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -107551,6 +107551,13 @@ var init_detectPermissionGate = __esm({
|
|
|
107551
107551
|
});
|
|
107552
107552
|
|
|
107553
107553
|
// src/services/questions/detectQuestionFromScreen.ts
|
|
107554
|
+
function stripStateMarker(label) {
|
|
107555
|
+
if (KNOWN_STATE_MARKER_RE.test(label)) {
|
|
107556
|
+
return { label: label.replace(KNOWN_STATE_MARKER_RE, ""), marked: true };
|
|
107557
|
+
}
|
|
107558
|
+
if (UNKNOWN_STATE_MARKER_RE.test(label)) return { label, marked: true };
|
|
107559
|
+
return { label, marked: false };
|
|
107560
|
+
}
|
|
107554
107561
|
function stripBoxGutter(line) {
|
|
107555
107562
|
return line.replace(/^\s*[│|]\s?/, "").replace(/\s*[│|]\s*$/, "");
|
|
107556
107563
|
}
|
|
@@ -107565,6 +107572,7 @@ function detectQuestionFromScreen(lines) {
|
|
|
107565
107572
|
if (footerIdx === -1) return null;
|
|
107566
107573
|
const options = [];
|
|
107567
107574
|
let firstOptionIdx = -1;
|
|
107575
|
+
let sawStateMarker = false;
|
|
107568
107576
|
for (let i = footerIdx - 1; i >= 0; i--) {
|
|
107569
107577
|
const line = lines[i];
|
|
107570
107578
|
const inner = stripBoxGutter(line);
|
|
@@ -107578,8 +107586,10 @@ function detectQuestionFromScreen(lines) {
|
|
|
107578
107586
|
if (options.length > 0 && QUESTION_RE.test(trimmed) && !OPTION_RE2.test(inner)) break;
|
|
107579
107587
|
const m2 = OPTION_RE2.exec(inner);
|
|
107580
107588
|
if (m2) {
|
|
107581
|
-
const
|
|
107582
|
-
if (PERMISSION_LABEL_RE.test(
|
|
107589
|
+
const rendered = m2[2].trim();
|
|
107590
|
+
if (PERMISSION_LABEL_RE.test(rendered)) return null;
|
|
107591
|
+
const { label, marked } = stripStateMarker(rendered);
|
|
107592
|
+
if (marked) sawStateMarker = true;
|
|
107583
107593
|
options.unshift({ label, description: "" });
|
|
107584
107594
|
firstOptionIdx = i;
|
|
107585
107595
|
}
|
|
@@ -107598,7 +107608,7 @@ function detectQuestionFromScreen(lines) {
|
|
|
107598
107608
|
}
|
|
107599
107609
|
if (!question) return null;
|
|
107600
107610
|
return {
|
|
107601
|
-
questions: [{ question, header: "", multiSelect:
|
|
107611
|
+
questions: [{ question, header: "", multiSelect: sawStateMarker, options }]
|
|
107602
107612
|
};
|
|
107603
107613
|
}
|
|
107604
107614
|
function isQuestionMenuOnScreen(lines) {
|
|
@@ -107607,7 +107617,7 @@ function isQuestionMenuOnScreen(lines) {
|
|
|
107607
107617
|
function questionContentKey(questions) {
|
|
107608
107618
|
return questions.map((q2) => `${q2.question} ${q2.options.map((o) => o.label).join(",")}`).join("::");
|
|
107609
107619
|
}
|
|
107610
|
-
var ASK_FOOTER_RE, ESC_FOOTER_RE, OPTION_RE2, QUESTION_RE, BOX_ONLY_RE2, PERMISSION_LABEL_RE;
|
|
107620
|
+
var ASK_FOOTER_RE, ESC_FOOTER_RE, OPTION_RE2, QUESTION_RE, BOX_ONLY_RE2, PERMISSION_LABEL_RE, KNOWN_STATE_MARKER_RE, UNKNOWN_STATE_MARKER_RE;
|
|
107611
107621
|
var init_detectQuestionFromScreen = __esm({
|
|
107612
107622
|
"src/services/questions/detectQuestionFromScreen.ts"() {
|
|
107613
107623
|
"use strict";
|
|
@@ -107617,6 +107627,8 @@ var init_detectQuestionFromScreen = __esm({
|
|
|
107617
107627
|
QUESTION_RE = /\?\s*$/;
|
|
107618
107628
|
BOX_ONLY_RE2 = /^[\s│─┌┐└┘├┤┬┴┼╭╮╰╯╱╲=_-]+$/;
|
|
107619
107629
|
PERMISSION_LABEL_RE = /^(Yes|No)\b/i;
|
|
107630
|
+
KNOWN_STATE_MARKER_RE = /^(?:\[(?:[ xX*]|✓|✔)\]|[☐☑☒])\s*/;
|
|
107631
|
+
UNKNOWN_STATE_MARKER_RE = /^(?:\[[^\]]{0,3}\]|\([^)]{0,3}\))\s*/;
|
|
107620
107632
|
}
|
|
107621
107633
|
});
|
|
107622
107634
|
|