@geminixiang/pi-simplify 0.0.8 → 0.0.9
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 +12 -0
- package/package.json +1 -1
- package/selector.ts +52 -39
- package/workflow.ts +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,18 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.0.9] - 2026-05-27
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- Support simplifying specific folders and files as snapshot reviews.
|
|
14
|
+
- Add a preset selector for choosing uncommitted changes or folder snapshot mode.
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
- Respect configured selection keybindings in simplify TUI selectors.
|
|
19
|
+
- Keep release tags and GitHub release titles v-prefixed.
|
|
20
|
+
|
|
9
21
|
## [0.0.8] - 2026-05-25
|
|
10
22
|
|
|
11
23
|
### Added
|
package/package.json
CHANGED
package/selector.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { getSelectListTheme, type ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
|
|
2
1
|
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from "@earendil-works/pi-tui";
|
|
2
|
+
getSelectListTheme,
|
|
3
|
+
keyHint,
|
|
4
|
+
rawKeyHint,
|
|
5
|
+
type ExtensionCommandContext,
|
|
6
|
+
} from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import { matchesKey, SelectList, wrapTextWithAnsi, type SelectItem } from "@earendil-works/pi-tui";
|
|
9
8
|
|
|
10
9
|
import type { Action, SimplifyResult } from "./types.js";
|
|
11
10
|
|
|
@@ -64,7 +63,7 @@ export async function showCandidateSelector(
|
|
|
64
63
|
Math.min(selectedIndex - Math.floor(maxVisible / 2), selectableItems.length - maxVisible),
|
|
65
64
|
);
|
|
66
65
|
|
|
67
|
-
const result = await ctx.ui.custom<SimplifyResult[]>((tui, theme,
|
|
66
|
+
const result = await ctx.ui.custom<SimplifyResult[]>((tui, theme, keybindings, done) => {
|
|
68
67
|
const updateListLabel = (index: number) => {
|
|
69
68
|
const item = listItems[index];
|
|
70
69
|
const { candidate } = selectableItems[index];
|
|
@@ -82,6 +81,34 @@ export async function showCandidateSelector(
|
|
|
82
81
|
};
|
|
83
82
|
selectList.onCancel = () => done([]);
|
|
84
83
|
|
|
84
|
+
const submitSelection = () => {
|
|
85
|
+
done(Array.from(selectedSet).map((i) => selectableItems[i].candidate));
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const cancelSelection = () => {
|
|
89
|
+
done([]);
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const toggleCurrent = () => {
|
|
93
|
+
if (selectedSet.has(cursorPos)) {
|
|
94
|
+
selectedSet.delete(cursorPos);
|
|
95
|
+
} else {
|
|
96
|
+
selectedSet.add(cursorPos);
|
|
97
|
+
}
|
|
98
|
+
updateListLabel(cursorPos);
|
|
99
|
+
tui.requestRender();
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
const toggleAll = () => {
|
|
103
|
+
if (selectedSet.size === selectableItems.length) {
|
|
104
|
+
selectedSet.clear();
|
|
105
|
+
} else {
|
|
106
|
+
for (let i = 0; i < selectableItems.length; i++) selectedSet.add(i);
|
|
107
|
+
}
|
|
108
|
+
updateAllListLabels();
|
|
109
|
+
tui.requestRender();
|
|
110
|
+
};
|
|
111
|
+
|
|
85
112
|
return {
|
|
86
113
|
render(width: number) {
|
|
87
114
|
selectList.setSelectedIndex(cursorPos);
|
|
@@ -119,14 +146,23 @@ export async function showCandidateSelector(
|
|
|
119
146
|
);
|
|
120
147
|
lines.push(theme.fg("muted", `${detailPrefix}Kind: ${current.category}`));
|
|
121
148
|
lines.push(theme.fg("muted", `${detailPrefix}Fix: ${ACTION_LABEL[current.action]}`));
|
|
122
|
-
lines.push(
|
|
149
|
+
lines.push(
|
|
150
|
+
theme.fg("borderMuted", `${detailIndent}└─ ${rawKeyHint("space", "selects this fix")}`),
|
|
151
|
+
);
|
|
123
152
|
}
|
|
124
153
|
|
|
125
154
|
lines.push("");
|
|
126
155
|
lines.push(
|
|
127
156
|
theme.fg(
|
|
128
157
|
"muted",
|
|
129
|
-
|
|
158
|
+
[
|
|
159
|
+
`Selected: ${selectedSet.size}`,
|
|
160
|
+
rawKeyHint("↑↓", "navigate"),
|
|
161
|
+
rawKeyHint("space", "toggle"),
|
|
162
|
+
rawKeyHint("a", "select all"),
|
|
163
|
+
keyHint("tui.select.confirm", "confirm"),
|
|
164
|
+
keyHint("tui.select.cancel", "cancel"),
|
|
165
|
+
].join(" • "),
|
|
130
166
|
),
|
|
131
167
|
);
|
|
132
168
|
return lines;
|
|
@@ -135,35 +171,12 @@ export async function showCandidateSelector(
|
|
|
135
171
|
selectList.invalidate();
|
|
136
172
|
},
|
|
137
173
|
handleInput(data: string) {
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (matchesKey(data,
|
|
144
|
-
done([]);
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
if (matchesKey(data, Key.space)) {
|
|
148
|
-
if (selectedSet.has(cursorPos)) {
|
|
149
|
-
selectedSet.delete(cursorPos);
|
|
150
|
-
} else {
|
|
151
|
-
selectedSet.add(cursorPos);
|
|
152
|
-
}
|
|
153
|
-
updateListLabel(cursorPos);
|
|
154
|
-
tui.requestRender();
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
if (matchesKey(data, "a")) {
|
|
158
|
-
if (selectedSet.size === selectableItems.length) {
|
|
159
|
-
selectedSet.clear();
|
|
160
|
-
} else {
|
|
161
|
-
for (let i = 0; i < selectableItems.length; i++) selectedSet.add(i);
|
|
162
|
-
}
|
|
163
|
-
updateAllListLabels();
|
|
164
|
-
tui.requestRender();
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
174
|
+
if (keybindings.matches(data, "tui.select.confirm")) return submitSelection();
|
|
175
|
+
if (keybindings.matches(data, "tui.select.cancel")) return cancelSelection();
|
|
176
|
+
|
|
177
|
+
// Extra shortcuts: these selector-specific actions are not registered pi keybinding ids.
|
|
178
|
+
if (matchesKey(data, "space")) return toggleCurrent();
|
|
179
|
+
if (matchesKey(data, "a")) return toggleAll();
|
|
167
180
|
|
|
168
181
|
const previousCursorPos = cursorPos;
|
|
169
182
|
selectList.handleInput(data);
|
package/workflow.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
defineTool,
|
|
3
3
|
DynamicBorder,
|
|
4
|
+
keyHint,
|
|
4
5
|
type ExtensionAPI,
|
|
5
6
|
type ExtensionCommandContext,
|
|
6
7
|
} from "@earendil-works/pi-coding-agent";
|
|
@@ -205,7 +206,11 @@ async function showSimplifyTargetSelector(
|
|
|
205
206
|
selectList.onCancel = () => done(null);
|
|
206
207
|
|
|
207
208
|
container.addChild(selectList);
|
|
208
|
-
container.addChild(
|
|
209
|
+
container.addChild(
|
|
210
|
+
new Text(
|
|
211
|
+
`${keyHint("tui.select.confirm", "confirm")} ${keyHint("tui.select.cancel", "cancel")}`,
|
|
212
|
+
),
|
|
213
|
+
);
|
|
209
214
|
container.addChild(new DynamicBorder((str) => theme.fg("accent", str)));
|
|
210
215
|
|
|
211
216
|
return {
|