@d3ara1n/pi-ask-user 2.1.0 → 2.1.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.
Files changed (4) hide show
  1. package/README.md +44 -32
  2. package/package.json +3 -2
  3. package/preview.png +0 -0
  4. package/src/index.ts +1368 -1267
package/README.md CHANGED
@@ -4,17 +4,26 @@ A collapsible **ask-user** tool for [pi](https://github.com/earendil-works/pi).
4
4
 
5
5
  ## Why
6
6
 
7
- Most ask-user tools render a panel that covers the transcript, so you **can't
8
- scroll the conversation** to read the analysis that should inform your choice.
9
- You end up choosing blind.
10
-
11
- This tool fixes that by **not** using a screen overlay. The panel renders into
12
- pi's bottom `editorContainer` slot (the same path `ctx.ui.select()` /
13
- `ctx.ui.input()` take), so the transcript stays visible **above** the panel and
14
- remains scrollable via the terminal's native scrollback — mouse wheel,
15
- `Shift+PgUp`, `Cmd+↑`. This works because pi's TUI never enters alt-screen and
16
- never tracks the mouse, so every rendered chat line lives in the terminal
17
- buffer and can be scrolled back at any time, no focus gymnastics needed.
7
+ Most ask-user tools render the panel as a **screen overlay** that covers the
8
+ transcript, so you can't read the analysis that should inform your choice
9
+ you choose blind.
10
+
11
+ This tool uses `overlay: false` instead. The panel renders into pi's bottom
12
+ `editorContainer` slot (the same path `ctx.ui.select()` / `ctx.ui.input()`
13
+ take), so the transcript stays visible **above** the panel while you decide.
14
+
15
+ ### Scrolling, and the `pi-powerline-footer` caveat
16
+
17
+ Native pi writes every chat line to the terminal's normal scrollback (mouse
18
+ wheel / `Shift+PgUp` / `Cmd+↑`), so the transcript above the panel is always
19
+ scrollable.
20
+
21
+ [`pi-powerline-footer`](https://github.com/nicobailon/pi-powerline-footer)
22
+ changes that — once it's loaded the native scrollback stops working, so an
23
+ **overlay**-type ask-user panel is a dead end: it covers a transcript you
24
+ then can't scroll back through. This tool's `overlay: false` keeps the
25
+ transcript in the content area, so it stays visible and usable even
26
+ alongside `pi-powerline-footer` — exactly the case where overlay tools break.
18
27
 
19
28
  - **Collapse** (`Ctrl+\`) shrinks the panel to a single status row, leaving
20
29
  even more of the transcript on screen while you decide.
@@ -79,12 +88,12 @@ Moving `↑`/`↓` only moves the cursor; selection is committed separately.
79
88
  ### Custom input ("Type something.")
80
89
 
81
90
  Every question always shows a "Type something." row (this cannot be turned off),
82
- so the user is never locked into the provided options. Press `Enter` on it to
91
+ so the user is never locked into the provided options. Press `Space` on it to
83
92
  open a text editor:
84
93
 
85
94
  - After submitting, the row displays the committed text with a filled glyph
86
95
  (`◉ ✎ your text`).
87
- - Press `Enter` again to re-edit it — the editor **prefills** the committed
96
+ - Press `Space` again to re-edit it — the editor **prefills** the committed
88
97
  text so you can tweak it.
89
98
  - `Esc` discards the edit (the original answer is kept); `Enter` confirms the
90
99
  change (the answer is updated).
@@ -144,32 +153,31 @@ when too long; skipped questions show `(skipped)`). Each question entry spans
144
153
  two rows (header + answer), followed by a trailing **note entry**:
145
154
 
146
155
  ```
147
- ▸ 1. Which layout?
148
- Sidebar
149
- 2. Which database?
150
- Postgres
156
+ ▸ 1. Which layout?
157
+ Sidebar
158
+ 2. Which database?
159
+ Postgres
151
160
 
152
- ✎ Note to assistant
153
- (optional — Tab to add a note)
161
+ ✎ Note to assistant
162
+ (optional — Space to add a note)
154
163
  ```
155
164
 
156
- Each title carries a fixed-width marker (`1.`/`2.`… for questions, `✎ ` for
165
+ Each title carries a fixed-width marker (`1.`/`2.`… for questions, `✎` for
157
166
  the note) so every title aligns; the body is indented one level deeper to keep
158
167
  header vs content visually distinct. An empty line sets the note apart from
159
168
  the Q&A list above it.
160
169
 
161
- Each title carries a fixed-width marker (`1.`/`2.`… for questions, `✎ ` for
162
- the note) so every title aligns; the body is indented one level deeper to keep
163
- header vs content visually distinct.
164
-
165
170
  - `↑`/`↓` — move the cursor between entries (questions + the note)
166
171
  - `PgUp`/`PgDn` — scroll by page (when there are more entries than rows)
167
- - `Tab` — edit the focused entry: a question (returns to review after) or the
168
- note (opens a free-form editor)
172
+ - `Space` — edit the focused entry: a question (jumps to its tab; returns to
173
+ review afterwards) or the note (opens a free-form editor)
174
+ - `Tab`/`→` — advance to the next tab (cycles back to the first question after
175
+ the review); `Shift+Tab`/`←` go back
169
176
  - `Enter` — confirm and submit all answers. `Enter` is always "submit" on the
170
177
  review screen, never "edit" — this deliberately differs from the question
171
- screens (where `Enter` edits/advances) so you can never submit by
172
- double-tapping `Enter` while trying to edit something. Use `Tab` to edit.
178
+ screens (where `Space` edits and `Enter` confirms/advances) so you can never
179
+ submit by double-tapping `Enter` while trying to edit something. Use `Space`
180
+ to edit.
173
181
  - `Esc` — cancel
174
182
 
175
183
  ### Note to assistant
@@ -178,7 +186,7 @@ The review screen ends with a **note** entry — a free-form message the user
178
186
  can attach for the assistant, about anything *beyond* the specific questions
179
187
  (overall direction, pacing, priorities, a correction to the premise, …).
180
188
 
181
- - Move the cursor to the note row and press `Tab` to open the editor.
189
+ - Move the cursor to the note row and press `Space` to open the editor.
182
190
  - `Enter` saves the note (empty = no note); `Esc` returns to the review without
183
191
  saving (the in-progress draft is kept).
184
192
  - The note is **out-of-band**: it is not part of `questions`/`options` and the
@@ -230,14 +238,18 @@ format, which could break when a custom answer contained a colon or newline.
230
238
  | Key | Action |
231
239
  |-----|--------|
232
240
  | `↑` `↓` / `PgUp` `PgDn` | Move cursor / scroll options |
233
- | `Space` | Commit selection (single: select-only; multi: toggle) |
234
- | `Enter` | Confirm & advance (single) / commit checked (multi) / enter custom input |
241
+ | `Space` | The "interact" key: select (single) / toggle (multi) / **edit** (open custom input, edit the focused review entry, or open the note) |
242
+ | `Enter` | Confirm & advance (single) / commit checked (multi). Never enters edit mode — that's `Space` |
235
243
  | `Tab` / `Shift+Tab` | Next / previous question, **cycling** (last → first). Option list only — not hijacked inside the editor |
236
244
  | `→` / `←` | Next / previous question, but **stop at the boundary** (no cycle) — safer than Tab when there are many questions |
237
245
  | `Esc` | Cancel (or exit custom-input editor without saving) |
238
246
  | `Ctrl+\` | Collapse / expand the panel |
239
247
 
240
- ## Install
248
+ ## Dependencies
249
+
250
+ None.
251
+
252
+ ## Installation
241
253
 
242
254
  Add to `~/.pi/agent/settings.json`:
243
255
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d3ara1n/pi-ask-user",
3
- "version": "2.1.0",
3
+ "version": "2.1.2",
4
4
  "type": "module",
5
5
  "description": "Ask-user tool for pi — renders in the bottom editor slot (not a screen overlay), so the transcript stays visible and scrollable above the panel while you decide",
6
6
  "main": "src/index.ts",
@@ -23,7 +23,8 @@
23
23
  "pi": {
24
24
  "extensions": [
25
25
  "./src/index.ts"
26
- ]
26
+ ],
27
+ "image": "https://raw.githubusercontent.com/d3ara1n/pi-extensions/main/packages/pi-ask-user/preview.png"
27
28
  },
28
29
  "repository": {
29
30
  "type": "git",
package/preview.png ADDED
Binary file