pi-ask-lite 0.1.2 → 0.1.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/README.md +75 -41
- package/package.json +1 -1
- package/src/ui.ts +4 -4
package/README.md
CHANGED
|
@@ -4,7 +4,12 @@
|
|
|
4
4
|
|
|
5
5
|
A tiny, pleasant Markdown ask tool for Pi.
|
|
6
6
|
|
|
7
|
-
`pi-ask-lite`
|
|
7
|
+
`pi-ask-lite` is for both sides of an agent question:
|
|
8
|
+
|
|
9
|
+
- **Users** get a small terminal prompt when Pi needs a decision.
|
|
10
|
+
- **Agents** get a deliberately slim tool surface: one tool, one Markdown string, answer out.
|
|
11
|
+
|
|
12
|
+
No option arrays. No mode flags. No UI schema to construct. The Markdown prompt is the interface.
|
|
8
13
|
|
|
9
14
|
## Install
|
|
10
15
|
|
|
@@ -12,21 +17,40 @@ A tiny, pleasant Markdown ask tool for Pi.
|
|
|
12
17
|
pi install npm:pi-ask-lite
|
|
13
18
|
```
|
|
14
19
|
|
|
15
|
-
##
|
|
20
|
+
## For users
|
|
21
|
+
|
|
22
|
+
Sometimes Pi needs input from you: choose one option, select several items, confirm a plan, or write a short answer.
|
|
23
|
+
|
|
24
|
+
`pi-ask-lite` turns that moment into a focused terminal UI instead of a long chat question. You can select options, edit the proposed answer, or write your own response.
|
|
25
|
+
|
|
26
|
+
Keyboard controls:
|
|
27
|
+
|
|
28
|
+
- `Space` selects or toggles the focused option.
|
|
29
|
+
- `Shift+Space` selects or toggles and marks the answer for editing.
|
|
30
|
+
- `Enter` sends a valid selection, or opens the selected answer as an editable draft when edit mode is active.
|
|
31
|
+
- `Esc` / `Ctrl+C` opens an empty free-text editor.
|
|
32
|
+
|
|
33
|
+
Direct selections return the selected Markdown structure. Free-text answers and edited drafts are returned unchanged.
|
|
34
|
+
|
|
35
|
+
## For agents
|
|
16
36
|
|
|
17
|
-
|
|
37
|
+
`pi-ask-lite` registers one tool: `ask`.
|
|
18
38
|
|
|
19
|
-
|
|
39
|
+
Input:
|
|
20
40
|
|
|
21
41
|
```ts
|
|
22
42
|
{
|
|
23
|
-
markdown: string
|
|
43
|
+
markdown: string;
|
|
24
44
|
}
|
|
25
45
|
```
|
|
26
46
|
|
|
47
|
+
Pass one complete Markdown prompt. The user answers in the UI. The tool returns the final answer as Markdown/text.
|
|
48
|
+
|
|
49
|
+
Use `ask` when you need a real user decision and want the interaction to stay simple. Write the question in Markdown; use the lightweight conventions below for choices.
|
|
50
|
+
|
|
27
51
|
## Example
|
|
28
52
|
|
|
29
|
-
|
|
53
|
+
Prompt:
|
|
30
54
|
|
|
31
55
|
```md
|
|
32
56
|
Choose what to do next:
|
|
@@ -39,67 +63,73 @@ Choose what to do next:
|
|
|
39
63
|
- Make a small polish pass
|
|
40
64
|
```
|
|
41
65
|
|
|
42
|
-
|
|
66
|
+
Returned answer:
|
|
67
|
+
|
|
68
|
+
```md
|
|
69
|
+
- Run one more smoke test
|
|
70
|
+
```
|
|
43
71
|
|
|
44
|
-
## Markdown
|
|
72
|
+
## Markdown conventions
|
|
45
73
|
|
|
46
74
|
Use normal Markdown for explanation and a few lightweight conventions for choices.
|
|
47
75
|
|
|
48
|
-
|
|
76
|
+
### Context
|
|
77
|
+
|
|
78
|
+
Use `*` for non-interactive context bullets:
|
|
49
79
|
|
|
50
80
|
```md
|
|
51
81
|
Given:
|
|
52
82
|
|
|
53
|
-
*
|
|
54
|
-
*
|
|
83
|
+
* The implementation is complete.
|
|
84
|
+
* Checks passed locally.
|
|
55
85
|
```
|
|
56
86
|
|
|
57
|
-
Single choice
|
|
87
|
+
### Single choice
|
|
88
|
+
|
|
89
|
+
Use plain list items:
|
|
58
90
|
|
|
59
91
|
```md
|
|
60
|
-
-
|
|
61
|
-
-
|
|
92
|
+
- Release now
|
|
93
|
+
- Run one more smoke test
|
|
94
|
+
- Make a small polish pass
|
|
62
95
|
```
|
|
63
96
|
|
|
64
|
-
Multi choice
|
|
97
|
+
### Multi choice
|
|
98
|
+
|
|
99
|
+
Use unchecked task items:
|
|
65
100
|
|
|
66
101
|
```md
|
|
67
|
-
- [ ]
|
|
68
|
-
- [ ]
|
|
102
|
+
- [ ] Tests
|
|
103
|
+
- [ ] Docs
|
|
104
|
+
- [ ] Release notes
|
|
69
105
|
```
|
|
70
106
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
```md
|
|
74
|
-
## Color
|
|
75
|
-
- Red
|
|
76
|
-
- Blue
|
|
107
|
+
Do not preselect options with `- [x]`. Express recommendations in normal Markdown text instead.
|
|
77
108
|
|
|
78
|
-
|
|
79
|
-
- Small
|
|
80
|
-
- Large
|
|
81
|
-
```
|
|
109
|
+
### Independent groups
|
|
82
110
|
|
|
83
|
-
|
|
111
|
+
Use headings to split independent required groups:
|
|
84
112
|
|
|
85
113
|
```md
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Do not preselect options with `- [x]` in prompts. Express recommendations in normal Markdown text or emphasis instead.
|
|
114
|
+
## Target
|
|
115
|
+
- Production
|
|
116
|
+
- Staging
|
|
92
117
|
|
|
93
|
-
##
|
|
118
|
+
## Action
|
|
119
|
+
- Deploy
|
|
120
|
+
- Dry run
|
|
121
|
+
```
|
|
94
122
|
|
|
95
|
-
|
|
123
|
+
### Dependent subchoices
|
|
96
124
|
|
|
97
|
-
|
|
98
|
-
- `Shift+Space` selects/toggles and marks the answer for draft editing.
|
|
99
|
-
- `Enter` sends a valid selection, or opens the selected Markdown as an editable draft when draft mode is active.
|
|
100
|
-
- `Esc` / `Ctrl+C` opens an empty free-text editor.
|
|
125
|
+
Indent child options below their parent:
|
|
101
126
|
|
|
102
|
-
|
|
127
|
+
```md
|
|
128
|
+
- [ ] Publish
|
|
129
|
+
- npm only
|
|
130
|
+
- npm and GitHub release
|
|
131
|
+
- [ ] Do not publish yet
|
|
132
|
+
```
|
|
103
133
|
|
|
104
134
|
## Development
|
|
105
135
|
|
|
@@ -116,3 +146,7 @@ npm run check
|
|
|
116
146
|
npm test
|
|
117
147
|
npm run pack:dry
|
|
118
148
|
```
|
|
149
|
+
|
|
150
|
+
## License
|
|
151
|
+
|
|
152
|
+
MIT
|
package/package.json
CHANGED
package/src/ui.ts
CHANGED
|
@@ -147,7 +147,7 @@ export async function runAskUi(ctx: ExtensionContext, document: AskDocument): Pr
|
|
|
147
147
|
|
|
148
148
|
add(theme.fg("accent", "─".repeat(width)));
|
|
149
149
|
add(theme.fg("accent", " Ask User"));
|
|
150
|
-
add(theme.fg("dim", editMode ? "
|
|
150
|
+
add(theme.fg("dim", editMode ? " Free text/draft: Enter sends • Esc returns to selection" : " ↑↓ move • Space select • Shift+Space draft • Enter send • Esc free text"));
|
|
151
151
|
lines.push("");
|
|
152
152
|
|
|
153
153
|
const bodyRows = renderDocumentRows(document, state, focusedId, {
|
|
@@ -159,7 +159,7 @@ export async function runAskUi(ctx: ExtensionContext, document: AskDocument): Pr
|
|
|
159
159
|
});
|
|
160
160
|
|
|
161
161
|
if (editMode) {
|
|
162
|
-
bodyRows.push({ text: "" }, { text: theme.fg("muted", "
|
|
162
|
+
bodyRows.push({ text: "" }, { text: theme.fg("muted", "Answer:") });
|
|
163
163
|
for (const editorLine of editor.render(Math.max(10, width - 2))) {
|
|
164
164
|
bodyRows.push({ text: ` ${editorLine}` });
|
|
165
165
|
}
|
|
@@ -177,10 +177,10 @@ export async function runAskUi(ctx: ExtensionContext, document: AskDocument): Pr
|
|
|
177
177
|
}
|
|
178
178
|
|
|
179
179
|
const visibleRows = bodyRows.slice(scrollOffset, scrollOffset + maxBodyLines);
|
|
180
|
-
if (scrollOffset > 0) add(theme.fg("dim", `… ${scrollOffset}
|
|
180
|
+
if (scrollOffset > 0) add(theme.fg("dim", `… ${scrollOffset} lines above`));
|
|
181
181
|
for (const row of visibleRows) add(row.text);
|
|
182
182
|
if (scrollOffset + maxBodyLines < bodyRows.length) {
|
|
183
|
-
add(theme.fg("dim", `… ${bodyRows.length - scrollOffset - maxBodyLines}
|
|
183
|
+
add(theme.fg("dim", `… ${bodyRows.length - scrollOffset - maxBodyLines} lines below`));
|
|
184
184
|
}
|
|
185
185
|
|
|
186
186
|
lines.push("");
|