@zhushanwen/pi-ask-user 0.0.1
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 +22 -0
- package/index.ts +1 -0
- package/package.json +45 -0
- package/src/__tests__/component.test.ts +784 -0
- package/src/__tests__/e2e-harness.ts +95 -0
- package/src/__tests__/e2e.test.ts +184 -0
- package/src/__tests__/fixtures.ts +68 -0
- package/src/__tests__/index.test.ts +479 -0
- package/src/__tests__/question-view.test.ts +357 -0
- package/src/__tests__/submit-view.test.ts +192 -0
- package/src/__tests__/types.test.ts +71 -0
- package/src/__tests__/validate.test.ts +124 -0
- package/src/component.ts +473 -0
- package/src/index.ts +229 -0
- package/src/question-view.ts +317 -0
- package/src/submit-view.ts +114 -0
- package/src/types.ts +128 -0
- package/src/validate.ts +61 -0
package/README.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# @zhushanwen/pi-ask-user
|
|
2
|
+
|
|
3
|
+
Inline adaptive `ask_user` tool for Pi coding agent. Single question (no tabs) or 1-4 questions (tab view + submit). Split-pane Markdown preview on wide terminals, inline free-text editor, optional comments.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi install npm:@zhushanwen/pi-ask-user
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Tool
|
|
12
|
+
|
|
13
|
+
`ask_user` — structured clarifying questions with 2-4 options each. Users can always pick "Other" for free-text input. Supports `multiSelect` and optional per-question comments.
|
|
14
|
+
|
|
15
|
+
## Features
|
|
16
|
+
|
|
17
|
+
- **Adaptive layout**: single question → no tab bar; 1-4 questions → tabbed view + Submit tab
|
|
18
|
+
- **Split-pane preview** (≥84 cols): option list left, selected option details right
|
|
19
|
+
- **Inline free-text editor**: select "Other" → Enter → type custom answer
|
|
20
|
+
- **Optional comments**: `allowComment: true` → after selection, prompt for a comment
|
|
21
|
+
- **Multi-select**: `multiSelect: true` → toggle checkboxes, Enter to confirm
|
|
22
|
+
- **Headless-safe**: disables the tool and returns `isError` when no UI available
|
package/index.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from "./src/index.ts";
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@zhushanwen/pi-ask-user",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "Inline adaptive ask_user tool for Pi — single/multi-question structured input with split-pane preview, inline editor, and optional comments.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "index.ts",
|
|
7
|
+
"pi": {
|
|
8
|
+
"extensions": [
|
|
9
|
+
"./index.ts"
|
|
10
|
+
]
|
|
11
|
+
},
|
|
12
|
+
"keywords": [
|
|
13
|
+
"pi-package",
|
|
14
|
+
"pi",
|
|
15
|
+
"pi-coding-agent",
|
|
16
|
+
"extension",
|
|
17
|
+
"ask",
|
|
18
|
+
"ask_user",
|
|
19
|
+
"interactive"
|
|
20
|
+
],
|
|
21
|
+
"license": "MIT",
|
|
22
|
+
"files": [
|
|
23
|
+
"index.ts",
|
|
24
|
+
"src/",
|
|
25
|
+
"README.md"
|
|
26
|
+
],
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "^24.0.0",
|
|
29
|
+
"vitest": "^4.1.8"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
33
|
+
"@mariozechner/pi-tui": "*",
|
|
34
|
+
"@sinclair/typebox": "*"
|
|
35
|
+
},
|
|
36
|
+
"peerDependenciesMeta": {
|
|
37
|
+
"@mariozechner/pi-tui": {
|
|
38
|
+
"optional": true
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
"scripts": {
|
|
42
|
+
"typecheck": "npx tsc --noEmit",
|
|
43
|
+
"test": "vitest run"
|
|
44
|
+
}
|
|
45
|
+
}
|