@pi9/ask 0.1.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Chase Cummings
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,92 @@
1
+ # @pi9/ask
2
+
3
+ Ask adds interactive questions to [Pi](https://github.com/earendil-works/pi-mono), turning moments when Pi needs your input into clear, keyboard-driven choices with descriptions, previews, comments, and freeform responses.
4
+
5
+ ## Feature overview
6
+
7
+ - **Answer revisions** — Reopen an Ask entry from `/tree` and continue with a new answer.
8
+ - **Lean tool definition** — A highly optimized description and schema minimize prompt overhead while staying compatible across providers.
9
+ - **Rich previews** — Inspect Markdown previews before choosing.
10
+ - **Multi-select** — Choose any number of options, then submit them together.
11
+ - **Comments and custom responses** — Add context to a choice or write your own response.
12
+ - **Responsive layout** — Use side-by-side previews on wide terminals and stacked, scrollable content in smaller ones.
13
+ - **Keyboard-first controls** — Navigate with Pi keybindings or familiar **j/k** shortcuts.
14
+ - **Timeouts and RPC support** — Set response deadlines and answer through either the TUI or an RPC client.
15
+
16
+ ## Install
17
+
18
+ ```bash
19
+ pi install npm:@pi9/ask
20
+ ```
21
+
22
+ ## In action
23
+
24
+ ### Make a quick choice
25
+
26
+ Choose from a focused list and see your answer directly in the conversation.
27
+
28
+ ![A single-choice question with Developer tools selected and the answer shown inline](media/single-select.png)
29
+
30
+ ### Preview the result
31
+
32
+ Options can include Markdown previews, making it easy to compare proposed output before deciding.
33
+
34
+ ![A project picker showing a live CLI task tracker preview beside the options](media/option-preview.png)
35
+
36
+ ### Select more than one
37
+
38
+ Multi-select questions combine checkboxes, descriptions, previews, optional freeform input, and an explicit Submit action.
39
+
40
+ ![A multi-select productivity app question with three features selected and a notes preview](media/multi-select.png)
41
+
42
+ ### Revise an earlier answer
43
+
44
+ Open an Ask entry from `/tree` to answer it again and continue the conversation from your revised choice.
45
+
46
+ ![A Pi session tree showing several revised answers to the same favorite-season question](media/replay.png)
47
+
48
+ ## Controls
49
+
50
+ Ask temporarily replaces the editor with a question. It follows your configured Pi selection keybindings and also supports **j/k** for navigation.
51
+
52
+ | Key | Action |
53
+ | --- | --- |
54
+ | **↑/↓** or **j/k** | Move between options |
55
+ | **Enter** or **Space** | Select an option, toggle a checkbox, or activate the highlighted response or Submit row |
56
+ | **c** | Add or edit a comment on the highlighted option |
57
+ | **Escape** | Discard the current draft, or cancel from the option list |
58
+ | **Ctrl+C** | Cancel from anywhere |
59
+
60
+ Comments let you qualify a selection without writing a separate message. When a question allows a custom response, highlight **Type a response…** and press **Enter** or **Space** to open the editor.
61
+
62
+ ## Advanced behavior
63
+
64
+ ### Responsive previews
65
+
66
+ Previews appear beside the options in terminals at least 88 columns wide and stack below them in narrower layouts. They support Markdown and update as you move between options. While you edit a comment or freeform response, the preview is hidden to leave more room for writing.
67
+
68
+ ### Long questions
69
+
70
+ Ask adapts to the available terminal height rather than growing beyond the screen. When content overflows, `↑`, `↓`, and `↕` indicators show that more is available above, below, or in both directions. **Page Up** and **Page Down** move through longer lists quickly.
71
+
72
+ ### Revising answers from `/tree`
73
+
74
+ In TUI mode, select a standalone Ask entry in `/tree` to reopen the original question, including its descriptions and previews. Submitting a new answer updates that entry and immediately continues the conversation. Pressing **Escape** cancels the revision without changing anything.
75
+
76
+ Answers and revisions follow the active session branch, so alternate branches can retain different choices.
77
+
78
+ ### Timeouts
79
+
80
+ Set `PI9_ASK_TIMEOUT_MS` to apply a default response deadline in milliseconds:
81
+
82
+ ```bash
83
+ PI9_ASK_TIMEOUT_MS=30000 pi
84
+ ```
85
+
86
+ Set it to `0` to disable the default timeout. A question-specific deadline takes precedence when present. The deadline covers the complete interaction, including comments and freeform editing; expiry is reported separately from cancellation.
87
+
88
+ ### RPC mode
89
+
90
+ Ask also works in Pi's RPC mode through standard selection and input dialogs. Multi-select answers use comma-separated option numbers, and comments are collected in follow-up dialogs. The richer live checkbox and preview interface is available only in the TUI.
91
+
92
+ Ask requires an interactive TUI or RPC client and remains inactive when no user interface is available.
package/package.json ADDED
@@ -0,0 +1,66 @@
1
+ {
2
+ "name": "@pi9/ask",
3
+ "version": "0.1.0",
4
+ "description": "Preview-rich, replayable Pi questions with multi-select and comments.",
5
+ "license": "MIT",
6
+ "author": "Chase Cummings <chaseecummings@gmail.com>",
7
+ "type": "module",
8
+ "main": "src/index.ts",
9
+ "types": "src/index.ts",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "git+https://github.com/Chase-C/pi9.git",
13
+ "directory": "packages/ask"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/Chase-C/pi9/issues"
17
+ },
18
+ "homepage": "https://github.com/Chase-C/pi9/tree/main/packages/ask#readme",
19
+ "files": [
20
+ "src",
21
+ "README.md",
22
+ "LICENSE"
23
+ ],
24
+ "keywords": [
25
+ "pi",
26
+ "pi-extension",
27
+ "pi-package",
28
+ "pi9",
29
+ "ask"
30
+ ],
31
+ "engines": {
32
+ "node": ">=22.0.0"
33
+ },
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "scripts": {
38
+ "typecheck": "tsc",
39
+ "test": "vitest run",
40
+ "test:watch": "vitest",
41
+ "release": "node ../../scripts/release.mjs ask",
42
+ "release:patch": "node ../../scripts/release.mjs ask patch",
43
+ "release:minor": "node ../../scripts/release.mjs ask minor",
44
+ "release:major": "node ../../scripts/release.mjs ask major",
45
+ "prepublishOnly": "npm run typecheck && npm test"
46
+ },
47
+ "pi": {
48
+ "extensions": [
49
+ "./src/index.ts"
50
+ ],
51
+ "skills": [],
52
+ "prompts": []
53
+ },
54
+ "peerDependencies": {
55
+ "@earendil-works/pi-coding-agent": "*",
56
+ "@earendil-works/pi-tui": "*",
57
+ "typebox": "*"
58
+ },
59
+ "devDependencies": {
60
+ "@earendil-works/pi-coding-agent": "^0.80.6",
61
+ "@earendil-works/pi-tui": "^0.80.6",
62
+ "typebox": "^1.0.55",
63
+ "typescript": "~6.0.3",
64
+ "vitest": "^4.1.6"
65
+ }
66
+ }