pi-toggle-skills 0.1.6 → 0.1.8

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-toggle-skills",
3
- "version": "0.1.6",
3
+ "version": "0.1.8",
4
4
  "description": "Toggle skill visibility in pi's system prompt — flip disable-model-invocation on skills via an interactive TUI",
5
5
  "type": "module",
6
6
  "author": "Tom X Nguyen",
@@ -24,6 +24,8 @@ import {
24
24
  matchesKey,
25
25
  Spacer,
26
26
  Text,
27
+ truncateToWidth,
28
+ wrapTextWithAnsi,
27
29
  } from "@earendil-works/pi-tui";
28
30
  import type { Theme } from "@earendil-works/pi-coding-agent";
29
31
  import { DynamicBorder, keyText } from "@earendil-works/pi-coding-agent";
@@ -117,11 +119,20 @@ export class ToggleSkillSelectorComponent implements Component {
117
119
 
118
120
  lines.push(...new DynamicBorder((s) => this.theme.fg("accent", s)).render(width));
119
121
  lines.push("");
120
- lines.push(this.theme.fg("accent", this.theme.bold("Toggle Skill Visibility")));
121
122
  lines.push(
122
- this.theme.fg(
123
- "muted",
124
- `Toggle disable-model-invocation on skills. Hidden skills won't appear in the system prompt.`,
123
+ truncateToWidth(
124
+ this.theme.fg("accent", this.theme.bold("Toggle Skill Visibility")),
125
+ width,
126
+ "",
127
+ ),
128
+ );
129
+ lines.push(
130
+ ...wrapTextWithAnsi(
131
+ this.theme.fg(
132
+ "muted",
133
+ `Toggle disable-model-invocation on skills. Hidden skills won't appear in the system prompt.`,
134
+ ),
135
+ width,
125
136
  ),
126
137
  );
127
138
  lines.push("");
@@ -132,7 +143,7 @@ export class ToggleSkillSelectorComponent implements Component {
132
143
  lines.push(...this.footerText.render(width));
133
144
  lines.push(...new DynamicBorder((s) => this.theme.fg("accent", s)).render(width));
134
145
 
135
- return lines;
146
+ return lines.map((line) => truncateToWidth(line, width, ""));
136
147
  }
137
148
 
138
149
  handleInput(data: string): void {
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(