@pi-archimedes/ask 1.3.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/README.md +28 -0
- package/package.json +31 -0
- package/src/cursor.ts +20 -0
- package/src/dialog.ts +664 -0
- package/src/index.ts +442 -0
- package/src/note.ts +102 -0
- package/src/picker.ts +308 -0
- package/src/selection.ts +99 -0
- package/src/wrap.ts +33 -0
package/README.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# @pi-archimedes/ask
|
|
2
|
+
|
|
3
|
+
Structured question tool with tabbed multi-question flow and inline note editing.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pi install @pi-archimedes/ask
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
- Tabbed multi-question flow with submit review
|
|
14
|
+
- Single-question picker with instant submit
|
|
15
|
+
- Inline note editing per option
|
|
16
|
+
- Markdown context descriptions
|
|
17
|
+
- Automatic "Other (type your own)" handling
|
|
18
|
+
- Subagent support — subagents can call `ask` and the question appears in the parent's TUI (bidirectional IPC, no temp files)
|
|
19
|
+
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
## Dependencies
|
|
23
|
+
|
|
24
|
+
Depends on [`@pi-archimedes/core`](../core) for the shared event bus used to relay subagent questions.
|
|
25
|
+
|
|
26
|
+
## Settings
|
|
27
|
+
|
|
28
|
+
No settings yet.
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@pi-archimedes/ask",
|
|
3
|
+
"version": "1.3.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"pi-package"
|
|
7
|
+
],
|
|
8
|
+
"description": "Structured question tool with tabbed multi-question flow and inline note editing",
|
|
9
|
+
"files": [
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"main": "./src/index.ts",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@pi-archimedes/core": "1.3.0"
|
|
15
|
+
},
|
|
16
|
+
"peerDependencies": {
|
|
17
|
+
"@earendil-works/pi-coding-agent": ">=0.1.0",
|
|
18
|
+
"@earendil-works/pi-tui": ">=0.1.0",
|
|
19
|
+
"typebox": ">=1.1.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"typebox": "^1.1.38",
|
|
23
|
+
"typescript": "^6.0.0"
|
|
24
|
+
},
|
|
25
|
+
"pi": {
|
|
26
|
+
"extensions": [
|
|
27
|
+
"./src/index.ts"
|
|
28
|
+
],
|
|
29
|
+
"image": "https://raw.githubusercontent.com/danielcherubini/pi-archimedes/main/docs/images/ask-subagent.png"
|
|
30
|
+
}
|
|
31
|
+
}
|
package/src/cursor.ts
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface CursorReadableEditor {
|
|
2
|
+
getLines(): string[];
|
|
3
|
+
getCursor(): { line: number; col: number };
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function getLinearCursorIndexFromEditor(editor: CursorReadableEditor): number {
|
|
7
|
+
const lines = editor.getLines();
|
|
8
|
+
const cursor = editor.getCursor();
|
|
9
|
+
if (lines.length === 0) return 0;
|
|
10
|
+
|
|
11
|
+
const safeLineIndex = Math.max(0, Math.min(cursor.line, lines.length - 1));
|
|
12
|
+
const safeColumnIndex = Math.max(0, Math.min(cursor.col, lines[safeLineIndex]?.length ?? 0));
|
|
13
|
+
let linearCursorIndex = safeColumnIndex;
|
|
14
|
+
|
|
15
|
+
for (let lineIndex = 0; lineIndex < safeLineIndex; lineIndex++) {
|
|
16
|
+
linearCursorIndex += (lines[lineIndex]?.length ?? 0) + 1;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return linearCursorIndex;
|
|
20
|
+
}
|