pi-diet 0.1.2 → 0.1.4

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.
Files changed (3) hide show
  1. package/README.md +4 -3
  2. package/index.ts +15 -5
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -44,9 +44,10 @@ Early MVP, but validated against a real Pi session for oversized bash output.
44
44
 
45
45
  ## Commands
46
46
 
47
- - `/diet-pi status`
48
- - `/diet-pi on`
49
- - `/diet-pi off`
47
+ - `/diet` toggles on/off
48
+ - `/diet status`
49
+ - `/diet on`
50
+ - `/diet off`
50
51
 
51
52
  ## Example
52
53
 
package/index.ts CHANGED
@@ -10,16 +10,26 @@ export default function dietPi(pi: ExtensionAPI) {
10
10
  return `pi-diet ${settings.enabled ? "on" : "off"} · threshold=${settings.thresholdChars} · head=${settings.headChars} · tail=${settings.tailChars}`;
11
11
  }
12
12
 
13
+ function footerStatusText(): string {
14
+ return `diet:${settings.enabled ? "on" : "off"}`;
15
+ }
16
+
13
17
  function refreshStatus(ctx: { hasUI: boolean; ui: { setStatus: (key: string, text: string | undefined) => void } }) {
14
18
  if (!ctx.hasUI) return;
15
- ctx.ui.setStatus(STATUS_KEY, statusText());
19
+ ctx.ui.setStatus(STATUS_KEY, footerStatusText());
16
20
  }
17
21
 
18
- pi.registerCommand("diet-pi", {
19
- description: "Control pi-diet result compaction: status | on | off",
22
+ pi.registerCommand("diet", {
23
+ description: "Control pi-diet result compaction: toggle by default, or use status | on | off",
20
24
  handler: async (args, ctx) => {
21
25
  const action = args.trim().toLowerCase();
22
- if (!action || action === "status") {
26
+ if (!action) {
27
+ settings = { ...settings, enabled: !settings.enabled };
28
+ ctx.ui.notify(`pi-diet ${settings.enabled ? "enabled" : "disabled"}`, "info");
29
+ refreshStatus(ctx);
30
+ return;
31
+ }
32
+ if (action === "status") {
23
33
  ctx.ui.notify(statusText(), "info");
24
34
  refreshStatus(ctx);
25
35
  return;
@@ -36,7 +46,7 @@ export default function dietPi(pi: ExtensionAPI) {
36
46
  refreshStatus(ctx);
37
47
  return;
38
48
  }
39
- ctx.ui.notify("Usage: /diet-pi status|on|off", "warning");
49
+ ctx.ui.notify("Usage: /diet | /diet status|on|off", "warning");
40
50
  },
41
51
  });
42
52
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-diet",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "private": false,
5
5
  "description": "Compact oversized Pi tool results with transparent previews and spill files.",
6
6
  "type": "module",