pi-next-steps 1.1.0 → 1.1.5
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/CHANGELOG.md +7 -14
- package/next-steps.ts +71 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
## 1.1.
|
|
4
|
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
- Initial release.
|
|
11
|
-
- `next_steps` tool with options, multi, rec, risky, subtitles, alternates, carry.
|
|
12
|
-
- `/ns` and `/nextsteps` commands.
|
|
13
|
-
- Settings file support.
|
|
14
|
-
- Carry-forward queue, steer on click, alternate groups.
|
|
15
|
-
- Auto-classification (best-effort).
|
|
16
|
-
- System-prompt guidance.
|
|
3
|
+
## 1.1.5 — 2026-11-16
|
|
4
|
+
|
|
5
|
+
- Interactive multi-select: next_steps now renders a picker (space toggle,
|
|
6
|
+
enter/tab confirm) instead of requiring /ns.
|
|
7
|
+
- Recommended and risky tags shown as star RECOMMENDED / triangle RISKY at the
|
|
8
|
+
end of each option.
|
|
9
|
+
- Risky warning symbol changed from emoji to glyph.
|
package/next-steps.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* steerOnClick (bool, default false), accentRecommended (bool, default true).
|
|
11
11
|
*/
|
|
12
12
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
13
|
+
import { matchesKey } from "@earendil-works/pi-tui";
|
|
13
14
|
import { existsSync, readFileSync, writeFileSync, mkdirSync } from "node:fs";
|
|
14
15
|
import { join } from "node:path";
|
|
15
16
|
|
|
@@ -206,14 +207,79 @@ When a reply naturally ends with a choice or "say the word and I'll...", call th
|
|
|
206
207
|
const n = i + 1;
|
|
207
208
|
const tags = [
|
|
208
209
|
settings.accentRecommended && recSet.has(String(n)) ? "★" : "",
|
|
209
|
-
settings.markRisky && riskySet.has(String(n)) ? "
|
|
210
|
+
settings.markRisky && riskySet.has(String(n)) ? "▲" : "",
|
|
210
211
|
].filter(Boolean).join(" ");
|
|
211
212
|
const sub = state!.subtitles[i] ? ` — ${state!.subtitles[i]}` : "";
|
|
212
213
|
return `${n}. ${tags ? tags + " " : ""}${o}${sub}`;
|
|
213
214
|
});
|
|
214
|
-
|
|
215
|
+
// Render an interactive choice right away instead of forcing /ns.
|
|
216
|
+
const choiceLabels = state.options.map((o, i) => {
|
|
217
|
+
const n = i + 1;
|
|
218
|
+
const recTag = settings.accentRecommended && recSet.has(String(n)) ? " ★ RECOMMENDED" : "";
|
|
219
|
+
const riskyTag = settings.markRisky && riskySet.has(String(n)) ? " ▲ RISKY" : "";
|
|
220
|
+
const sub = state!.subtitles[i] ? ` — ${state!.subtitles[i]}` : "";
|
|
221
|
+
return `${o}${sub}${recTag}${riskyTag}`;
|
|
222
|
+
});
|
|
223
|
+
try {
|
|
224
|
+
const selected = new Set<number>();
|
|
225
|
+
const result = await ctx.ui.custom<number[] | null>((tui, theme, _kb, done) => {
|
|
226
|
+
let cursor = 0;
|
|
227
|
+
const component = {
|
|
228
|
+
focused: true,
|
|
229
|
+
render(_width: number): string[] {
|
|
230
|
+
const lines: string[] = [];
|
|
231
|
+
lines.push(theme.fg("accent", "Next steps (space toggle, enter confirm):"));
|
|
232
|
+
for (let i = 0; i < choiceLabels.length; i++) {
|
|
233
|
+
const check = selected.has(i) ? "[x]" : "[ ]";
|
|
234
|
+
const prefix = i === cursor ? theme.fg("accent", "> ") : " ";
|
|
235
|
+
lines.push(`${prefix}${check} ${choiceLabels[i]}`);
|
|
236
|
+
}
|
|
237
|
+
lines.push(theme.fg("dim", "space toggle · ↑↓ move · enter/tab confirm · esc cancel"));
|
|
238
|
+
return lines;
|
|
239
|
+
},
|
|
240
|
+
invalidate() {},
|
|
241
|
+
handleInput(data: string) {
|
|
242
|
+
if (matchesKey(data, "up") || matchesKey(data, "k")) {
|
|
243
|
+
cursor = (cursor - 1 + choiceLabels.length) % choiceLabels.length;
|
|
244
|
+
tui.requestRender();
|
|
245
|
+
} else if (matchesKey(data, "down") || matchesKey(data, "j")) {
|
|
246
|
+
cursor = (cursor + 1) % choiceLabels.length;
|
|
247
|
+
tui.requestRender();
|
|
248
|
+
} else if (matchesKey(data, "space")) {
|
|
249
|
+
if (selected.has(cursor)) selected.delete(cursor);
|
|
250
|
+
else selected.add(cursor);
|
|
251
|
+
tui.requestRender();
|
|
252
|
+
} else if (matchesKey(data, "enter") || matchesKey(data, "tab")) {
|
|
253
|
+
done(Array.from(selected).sort((a, b) => a - b));
|
|
254
|
+
} else if (matchesKey(data, "escape") || matchesKey(data, "ctrl+c")) {
|
|
255
|
+
done(null);
|
|
256
|
+
}
|
|
257
|
+
},
|
|
258
|
+
};
|
|
259
|
+
return component;
|
|
260
|
+
});
|
|
261
|
+
if (result && result.length > 0) {
|
|
262
|
+
const chosen = result.map((n) => state!.options[n]);
|
|
263
|
+
const message = chosen.length === 1 ? chosen[0] : chosen.map((c) => `- ${c}`).join("\n");
|
|
264
|
+
if (ctx.isIdle()) {
|
|
265
|
+
pi.sendUserMessage(message);
|
|
266
|
+
} else if (settings.steerOnClick) {
|
|
267
|
+
pi.sendUserMessage(message, { deliverAs: "steer" });
|
|
268
|
+
} else {
|
|
269
|
+
pi.sendUserMessage(message, { deliverAs: "followUp" });
|
|
270
|
+
}
|
|
271
|
+
if (queue.length > 0) queue.shift();
|
|
272
|
+
ctx.ui.notify(`Sent ${chosen.length} step(s)`, "info");
|
|
273
|
+
} else if (result !== null) {
|
|
274
|
+
// empty selection (enter with nothing toggled) — send nothing
|
|
275
|
+
ctx.ui.notify("No selection", "info");
|
|
276
|
+
}
|
|
277
|
+
} catch {
|
|
278
|
+
// Non-interactive mode or UI unavailable; fall back to /ns.
|
|
279
|
+
}
|
|
280
|
+
ctx.ui.notify(`Next steps registered.`, "info");
|
|
215
281
|
return {
|
|
216
|
-
content: [{ type: "text", text: `Registered ${opts.length} next steps:\n${lines.join("\n")}
|
|
282
|
+
content: [{ type: "text", text: `Registered ${opts.length} next steps:\n${lines.join("\n")}` }],
|
|
217
283
|
};
|
|
218
284
|
},
|
|
219
285
|
});
|
|
@@ -244,12 +310,12 @@ When a reply naturally ends with a choice or "say the word and I'll...", call th
|
|
|
244
310
|
const n = i + 1;
|
|
245
311
|
const tags = [
|
|
246
312
|
settings.accentRecommended && recSet.has(String(n)) ? "★" : "",
|
|
247
|
-
settings.markRisky && riskySet.has(String(n)) ? "
|
|
313
|
+
settings.markRisky && riskySet.has(String(n)) ? "▲" : "",
|
|
248
314
|
].filter(Boolean).join(" ");
|
|
249
315
|
return `${n}. ${tags ? tags + " " : ""}${o}`;
|
|
250
316
|
});
|
|
251
317
|
const input = await ctx.ui.input(
|
|
252
|
-
"Next steps (
|
|
318
|
+
"Next steps: type indices (e.g. 1,3) then Enter",
|
|
253
319
|
labels.join(" | "),
|
|
254
320
|
);
|
|
255
321
|
if (!input) {
|