pi-interview 0.6.1 → 0.8.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 CHANGED
@@ -27,7 +27,7 @@ Restart pi to load the extension.
27
27
  - **Pre-selection**: Recommended options show a "Recommended" badge and are pre-checked on load
28
28
  - **Conviction & Weight**: Control recommendation strength (`conviction`) and visual prominence (`weight`)
29
29
  - **"Other" Option**: Single/multi select questions support custom text input
30
- - **Per-Question Attachments**: Attach images to any question via button, paste, or drag & drop
30
+ - **Per-Question Attachments**: Attach images to any question via button or drag & drop
31
31
  - **Keyboard Navigation**: Full keyboard support with arrow keys, Tab, Enter
32
32
  - **Auto-save**: Responses saved to localStorage, restored on reload
33
33
  - **Session Timeout**: Configurable timeout with countdown badge, refreshes on activity
@@ -36,9 +36,11 @@ Restart pi to load the extension.
36
36
  - **Session Recovery**: Abandoned/timed-out interviews save questions for later retry
37
37
  - **Save Snapshots**: Save interview state to HTML for later review or revival
38
38
  - **Session Status Bar**: Shows project path, git branch, and session ID for identification
39
- - **Image Support**: Drag & drop anywhere on question, file picker, paste image or path
39
+ - **Image Support**: Drag & drop anywhere on question, file picker, or paste a path into the dedicated path field
40
40
  - **Path Normalization**: Handles shell-escaped paths (`\ `) and macOS screenshot filenames (narrow no-break space before AM/PM)
41
- - **Generate & Review Options**: Single/multi-select questions show "✦ Generate more" (appends new choices) and "↻ Review options" (reviews options and rewrites the question for clarity) buttons powered by an LLM
41
+ - **Generate & Review Options**: Single/multi-select questions, including rich-option questions with inline content blocks, show "✦ Generate more" (appends new choices) and "↻ Review options" (reviews options and rewrites the question for clarity) buttons powered by an LLM
42
+ - **Ask About an Option**: Single/multi options, including rich options with inline content blocks, can open an inline assistant panel with prompt chips, freeform follow-up questions, provider/model overrides under Advanced, and actions like pinning analysis or applying a suggested rewrite
43
+ - **Option Clarifications**: Plain string single/multi options can reveal a separate inline `Optional clarification...` field when selected, letting users attach a short note to a choice without using `Ask`
42
44
  - **Tool Discoverability (pi v0.59+)**: Registers a `promptSnippet` so `interview` remains eligible for inclusion in pi's default `Available tools` prompt section
43
45
  - **Themes**: Built-in default + optional light/dark + custom theme CSS
44
46
 
@@ -139,26 +141,26 @@ await interview({
139
141
  | `id` | string | Unique identifier |
140
142
  | `type` | string | `single`, `multi`, `text`, `image`, or `info` |
141
143
  | `question` | string | Question text |
142
- | `options` | string[] or object[] | Choices (required for single/multi). Can be strings or `{ label, code? }` objects |
144
+ | `options` | string[] or object[] | Choices (required for single/multi). Can be strings or `{ label, content? }` objects |
143
145
  | `recommended` | string or string[] | Shows "Recommended" badge and pre-selects option(s) |
144
146
  | `conviction` | string | `"strong"` or `"slight"`. Slight opts out of pre-selection. Requires `recommended` |
145
147
  | `weight` | string | `"critical"` (prominent card) or `"minor"` (compact card) |
146
148
  | `context` | string | Help text shown below question |
147
- | `codeBlock` | object | Code block displayed below question text |
149
+ | `content` | object | Content block displayed below question text (`lang: "md"|"markdown"` previews Markdown by default) |
148
150
  | `media` | object or object[] | Media content: image, chart, mermaid, table, or html |
149
151
 
150
- ### Code Blocks
152
+ ### Content Blocks
151
153
 
152
- Questions and options can include code blocks for displaying code snippets, diffs, and file references.
154
+ Questions and options can include `content` blocks for code snippets, diffs, and Markdown.
153
155
 
154
- **Question-level code block** (displayed above options):
156
+ **Question-level code content** (displayed above options):
155
157
  ```json
156
158
  {
157
159
  "id": "review",
158
160
  "type": "single",
159
161
  "question": "Review this implementation",
160
- "codeBlock": {
161
- "code": "function add(a, b) {\n return a + b;\n}",
162
+ "content": {
163
+ "source": "function add(a, b) {\n return a + b;\n}",
162
164
  "lang": "ts",
163
165
  "file": "src/math.ts",
164
166
  "lines": "10-12",
@@ -168,44 +170,59 @@ Questions and options can include code blocks for displaying code snippets, diff
168
170
  }
169
171
  ```
170
172
 
171
- **Options with code blocks**:
173
+ **Options with content blocks**:
172
174
  ```json
173
175
  {
174
176
  "options": [
175
177
  {
176
178
  "label": "Use async/await",
177
- "code": { "code": "const data = await fetch(url);", "lang": "ts" }
179
+ "content": { "source": "const data = await fetch(url);", "lang": "ts" }
178
180
  },
179
181
  {
180
182
  "label": "Use promises",
181
- "code": { "code": "fetch(url).then(data => ...);", "lang": "ts" }
183
+ "content": { "source": "fetch(url).then(data => ...);", "lang": "ts" }
182
184
  },
183
185
  "Keep current implementation"
184
186
  ]
185
187
  }
186
188
  ```
187
189
 
188
- **Diff display** (set `lang: "diff"`):
190
+ **Diff display** (`lang: "diff"`):
189
191
  ```json
190
192
  {
191
- "codeBlock": {
192
- "code": "--- a/file.ts\n+++ b/file.ts\n@@ -1,3 +1,4 @@\n const x = 1;\n+const y = 2;\n const z = 3;",
193
+ "content": {
194
+ "source": "--- a/file.ts\n+++ b/file.ts\n@@ -1,3 +1,4 @@\n const x = 1;\n+const y = 2;\n const z = 3;",
193
195
  "lang": "diff",
194
196
  "file": "src/file.ts"
195
197
  }
196
198
  }
197
199
  ```
198
200
 
199
- | CodeBlock Field | Type | Description |
200
- |-----------------|------|-------------|
201
- | `code` | string | The code content (required) |
202
- | `lang` | string | Language for display (e.g., "ts", "diff") |
203
- | `file` | string | File path to display in header |
204
- | `lines` | string | Line range to display (e.g., "10-25") |
205
- | `highlights` | number[] | Line numbers to highlight |
206
- | `title` | string | Optional title above code |
201
+ **Markdown preview by default** (`lang: "md"` or `"markdown"`):
202
+ ```json
203
+ {
204
+ "content": {
205
+ "source": "# Release notes\n\n- Added preview mode\n- Fixed wrapping",
206
+ "lang": "md"
207
+ }
208
+ }
209
+ ```
207
210
 
208
- Line numbers are shown when `file` or `lines` is specified. Diff syntax (`+`/`-` lines) is automatically styled when `lang` is "diff".
211
+ Set `showSource: true` on Markdown content to show raw Markdown instead of preview.
212
+
213
+ | Content Field | Type | Description |
214
+ |---------------|------|-------------|
215
+ | `source` | string | Content text (required) |
216
+ | `lang` | string | Language hint (e.g., `ts`, `diff`, `md`) |
217
+ | `file` | string | File path shown in the header |
218
+ | `lines` | string | Line range shown in the header (code content only) |
219
+ | `highlights` | number[] | Line highlights (code content only) |
220
+ | `title` | string | Optional title above content |
221
+ | `showSource` | boolean | Markdown only: `true` forces raw source instead of preview |
222
+
223
+ Rules:
224
+ - `lang: "md"` or `"markdown"`: preview by default, `showSource: true` shows raw source.
225
+ - Any other `lang`: renders as raw source; `showSource` is not allowed.
209
226
 
210
227
  ### Info Panels
211
228