@mjasnikovs/pi-task 0.14.13 → 0.14.14
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/task/question-box.js +10 -5
- package/package.json +1 -1
|
@@ -17,8 +17,12 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { getKeybindings, visibleWidth, wrapTextWithAnsi } from '@earendil-works/pi-tui';
|
|
19
19
|
// ─── Constants ───────────────────────────────────────────────────────────────
|
|
20
|
-
/** Left gutter: two columns reserved for the
|
|
20
|
+
/** Left gutter: two columns reserved for the cursor bar so boxes stay aligned. */
|
|
21
21
|
const GUTTER = 2;
|
|
22
|
+
/** Cap the dialog at a readable column count. Without this the boxes stretch the
|
|
23
|
+
* full terminal width on wide/ultrawide screens — long question lines become
|
|
24
|
+
* hard to scan and short answers leave a huge empty right margin inside the box. */
|
|
25
|
+
const MAX_CONTENT_WIDTH = 96;
|
|
22
26
|
const RECOMMENDED_TAG = 'RECOMMENDED';
|
|
23
27
|
/** Smallest box that still fits "┌─ RECOMMENDED ─┐". Below this we drop the tag. */
|
|
24
28
|
const TAG_MIN_BOX_WIDTH = visibleWidth(`┌─ ${RECOMMENDED_TAG} ─┐`);
|
|
@@ -49,9 +53,10 @@ function renderCard(card, selected, boxWidth, c) {
|
|
|
49
53
|
const bodyLines = wrapTextWithAnsi(card.label, innerWidth);
|
|
50
54
|
const body = (bodyLines.length > 0 ? bodyLines : ['']).map(line => borderFn('│ ') + padTo(line, innerWidth) + borderFn(' │'));
|
|
51
55
|
const bottom = borderFn(`└${dash(boxWidth - 2)}┘`);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
56
|
+
// A full-height accent bar in the gutter marks the selected card — far more
|
|
57
|
+
// visible than a single "▸" glyph on the top border alone.
|
|
58
|
+
const cursor = selected ? c.arrow('▌') + ' ' : ' ';
|
|
59
|
+
return [cursor + top, ...body.map(b => cursor + b), cursor + bottom];
|
|
55
60
|
}
|
|
56
61
|
/**
|
|
57
62
|
* Lay the whole dialog out for `width` columns: a QUESTION label + wrapped
|
|
@@ -59,7 +64,7 @@ function renderCard(card, selected, boxWidth, c) {
|
|
|
59
64
|
* highlighted with an accent border and "▸" arrow), and a key-hint footer.
|
|
60
65
|
*/
|
|
61
66
|
export function renderQuestionBox(width, question, cards, selected, c, hintText = HINT_TEXT) {
|
|
62
|
-
const W = Math.max(width, 12);
|
|
67
|
+
const W = Math.min(Math.max(width, 12), MAX_CONTENT_WIDTH);
|
|
63
68
|
const boxWidth = Math.max(6, W - GUTTER);
|
|
64
69
|
const out = [''];
|
|
65
70
|
out.push(' ' + c.questionLabel(QUESTION_LABEL));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mjasnikovs/pi-task",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.14",
|
|
4
4
|
"description": "Deterministic spec-orchestration for local models, with a bundled real-time remote web view and web/docs/fetch/worker subagent tools.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|