@trim21/personal-pi-extensions 0.0.293 → 0.0.294
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/package.json +1 -1
- package/src/lib/ui.ts +8 -7
- package/src/opencode/question.ts +2 -2
package/package.json
CHANGED
package/src/lib/ui.ts
CHANGED
|
@@ -53,19 +53,20 @@ export async function selectWithOptionalInput(
|
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
|
|
57
|
-
const
|
|
56
|
+
/** 已选 / 未选 的符号标记:打勾方框 / 空方框 */
|
|
57
|
+
const CHECKED_PREFIX = "☑: ";
|
|
58
|
+
const UNCHECKED_PREFIX = "☐: ";
|
|
58
59
|
|
|
59
60
|
/**
|
|
60
61
|
* Toggle-style multi-select loop built on `ui.select`.
|
|
61
62
|
*
|
|
62
63
|
* Every round lists ALL `entries` — already-selected ones render with a
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
64
|
+
* `☑: ` marker, the rest with `☐: ` — so re-selecting an entry unchecks it.
|
|
65
|
+
* Picking an entry with `inputPrompt` opens an input dialog and, when
|
|
66
|
+
* non-empty, adds the typed text and ends the loop. Picking `doneLabel` (or
|
|
67
|
+
* dismissing the dialog) ends the loop and returns the selected labels in
|
|
67
68
|
* selection order. Display text is mapped back to the original label via an
|
|
68
|
-
* explicit table so a `
|
|
69
|
+
* explicit table so a `☐: ` / `☑: ` prefix inside a label is unambiguous.
|
|
69
70
|
*/
|
|
70
71
|
export async function selectMultiple(
|
|
71
72
|
title: string,
|
package/src/opencode/question.ts
CHANGED
|
@@ -5,13 +5,13 @@
|
|
|
5
5
|
* https://github.com/anomalyco/opencode/blob/999be62662/packages/opencode/src/tool/question.ts
|
|
6
6
|
* 与 opencode 的差异:opencode 输出 title "Asked N question(s)",这里未设置;
|
|
7
7
|
* 多选交互是平台差异(opencode 用 checkbox,这里循环 ctx.ui.select 勾选,
|
|
8
|
-
* 已选项显示
|
|
8
|
+
* 已选项显示 `☑: ` 前缀,再次选择即反选,最后选「✓ Done」提交)。
|
|
9
9
|
*
|
|
10
10
|
* 参数与语义和 opencode 的 `question` 工具一致:
|
|
11
11
|
* questions 数组,每项含 question / header / options / multiple:
|
|
12
12
|
* - options 每项为 label / description
|
|
13
13
|
* - 单选(默认):用户在选项里选一个,也可选「Type your own answer.」自由输入
|
|
14
|
-
* - 多选(multiple: true):循环用 ui.select
|
|
14
|
+
* - 多选(multiple: true):循环用 ui.select 勾选/反选(☑ 标记已选),直到「✓ Done」
|
|
15
15
|
* - 每个问题返回一个 label 数组(Answer = string[]),跳过的为空数组
|
|
16
16
|
* - 输出与 opencode 一致:
|
|
17
17
|
* User has answered your questions: "q"="a", "q2"="Unanswered"...
|