pi-toggle-skills 0.1.6 → 0.1.7
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/toggle-skills.ts +28 -0
package/package.json
CHANGED
package/toggle-skills.ts
CHANGED
|
@@ -180,6 +180,34 @@ async function showToggleSelector(
|
|
|
180
180
|
return;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
if (ctx.mode !== "tui") {
|
|
184
|
+
if (!ctx.hasUI) {
|
|
185
|
+
ctx.ui.notify("/toggle-skills requires a UI (TUI or GUI).", "error");
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
const items = currentSkills.map((s) => `${s.name}: ${s.disabled ? "disabled" : "enabled"}`);
|
|
189
|
+
const pick = await ctx.ui.select("Toggle skill \u2014 pick a skill to flip", items);
|
|
190
|
+
if (pick === undefined) return;
|
|
191
|
+
const idx = items.indexOf(pick);
|
|
192
|
+
if (idx < 0) return;
|
|
193
|
+
const skill = currentSkills[idx];
|
|
194
|
+
if (!skill) return;
|
|
195
|
+
const newDisabled = !skill.disabled;
|
|
196
|
+
const written = applyChanges(currentSkills, [{ filePath: skill.filePath, newDisabled }]);
|
|
197
|
+
if (written.length === 0) {
|
|
198
|
+
ctx.ui.notify("No files were written. Check file permissions.", "warning");
|
|
199
|
+
return;
|
|
200
|
+
}
|
|
201
|
+
setSkills(
|
|
202
|
+
currentSkills.map((s) => (s.filePath === skill.filePath ? { ...s, disabled: newDisabled } : s)),
|
|
203
|
+
);
|
|
204
|
+
ctx.ui.notify(
|
|
205
|
+
`Skill ${skill.name} ${newDisabled ? "disabled" : "enabled"}. /reload to take effect. Run /toggle-skills again for more.`,
|
|
206
|
+
"info",
|
|
207
|
+
);
|
|
208
|
+
return;
|
|
209
|
+
}
|
|
210
|
+
|
|
183
211
|
const result = await ctx.ui.custom<ToggleSkillSelectorResult>(
|
|
184
212
|
(tui, theme, _kb, done) => {
|
|
185
213
|
const selector = new ToggleSkillSelectorComponent(
|