@xynogen/pix-optimizer 1.1.3 → 1.1.6

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/src/rtk.ts CHANGED
@@ -93,7 +93,7 @@ export function applyRtkRewrite(
93
93
 
94
94
  const RTK_SYSTEM_PROMPT = `# RTK — token-optimized command wrapper
95
95
 
96
- Prefix shell commands with \`rtk\` (e.g. \`rtk git status\`). RTK compacts output for git, gh, cargo, npm/pnpm/yarn/bun, tsc, lint, vitest/jest/playwright, docker, kubectl, ls, grep, find, prisma — and passes anything else through unchanged, so it's always safe.
96
+ Prefix shell commands with \`rtk\` (e.g. \`rtk git status\`). RTK compacts output for git, gh, cargo, npm/pnpm/yarn/bun, tsc, lint, vitest/jest/playwright, docker, kubectl, ls, grep, prisma — and passes anything else through unchanged, so it's always safe.
97
97
 
98
98
  Prefix EVERY segment in a chain, not just the first:
99
99
  \`rtk git add . && rtk git commit -m "msg" && rtk git push\`
@@ -106,7 +106,6 @@ const RTK_COMMANDS = new Set([
106
106
  "gh",
107
107
  "ls",
108
108
  "tree",
109
- "find",
110
109
  "grep",
111
110
  "cat",
112
111
  "head",
@@ -301,32 +300,19 @@ export function rtk(
301
300
  syncStatus(ctx);
302
301
  });
303
302
 
304
- // -- Subcommand handler (dispatched by the merged /opt router) --
303
+ // -- Overlay value handler (called by the /optimizer overlay) --
305
304
 
306
305
  async function run(
307
- args: string,
306
+ value: string,
308
307
  ctx: ExtensionCommandContext,
309
308
  ): Promise<void> {
310
- const arg = args.trim().toLowerCase();
311
- if (arg === "on") enabled = true;
312
- else if (arg === "off") enabled = false;
313
- else enabled = !enabled; // bare toggles
309
+ enabled = value === "on";
314
310
 
315
311
  await checkRtkAvailability();
316
312
  syncStatus(ctx);
317
313
  ctx.ui.notify(`RTK rewriting ${enabled ? "on" : "off"}.`, "info");
318
314
  }
319
315
 
320
- function complete(prefix: string) {
321
- const items = [
322
- { value: "on", label: "on", description: "Force RTK rewriting on" },
323
- { value: "off", label: "off", description: "Force RTK rewriting off" },
324
- ];
325
- const n = prefix.trim().toLowerCase();
326
- const filtered = items.filter((i) => i.value.startsWith(n));
327
- return filtered.length > 0 ? filtered : null;
328
- }
329
-
330
316
  // Rewrite bash commands to add rtk prefix.
331
317
  //
332
318
  // The SDK fires a single `tool_call` event for every tool. The bash variant
@@ -374,8 +360,9 @@ export function rtk(
374
360
 
375
361
  return {
376
362
  name: "rtk",
377
- help: "rtk [on|off] — prefix shell commands with rtk (token-optimized)",
363
+ help: "rtk — prefix shell commands with rtk (token-optimized)",
364
+ values: ["off", "on"],
365
+ current: () => (enabled ? "on" : "off"),
378
366
  run,
379
- complete,
380
367
  };
381
368
  }
package/src/status.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * status.ts — shared status-bar indicator for the optimizer suite.
3
3
  *
4
- * caveman / rtk / json each toggle independently, but they're all the same
4
+ * caveman / rtk / toon / ponytail each toggle independently, but they're all the same
5
5
  * class of thing (token-optimization tools), so they share ONE status cell
6
6
  * instead of three. Each tool reports its on/off state into a single registry;
7
7
  * the cell renders only the icons whose tool is currently enabled, in a fixed
@@ -18,26 +18,22 @@ import type {
18
18
  ThemeColor,
19
19
  } from "@earendil-works/pi-coding-agent";
20
20
 
21
- /** Argument-completion item shape used by the merged /opt command. */
22
- export interface CompletionItem {
23
- value: string;
24
- label: string;
25
- description: string;
26
- }
27
-
28
21
  /**
29
- * Each optimizer tool (caveman/rtk/json) exposes a handle so the single `/opt`
30
- * router can dispatch subcommands to it without knowing its internals.
22
+ * Each optimizer tool (caveman/rtk/toon/ponytail) exposes a handle so the
23
+ * single `/optimizer` overlay can render one row per tool and apply value
24
+ * changes without knowing the tool's internals.
31
25
  */
32
26
  export interface OptimizerHandle {
33
- /** Subcommand name, e.g. "caveman" / "rtk" / "toon". */
27
+ /** Tool name, e.g. "caveman" / "rtk" / "toon". */
34
28
  name: OptimizerTool;
35
- /** One-line help shown by `/opt` with no args. */
29
+ /** One-line summary shown in the overlay row. */
36
30
  help: string;
37
- /** Handle `/opt <name> <args>`. `args` is everything after the name. */
38
- run(args: string, ctx: ExtensionCommandContext): Promise<void> | void;
39
- /** Completions for the second token (`/opt <name> <prefix>`). */
40
- complete(prefix: string): CompletionItem[] | null;
31
+ /** Cyclable values for this tool's overlay row, in display order. */
32
+ values: readonly string[];
33
+ /** Current value string (must be one of `values`). */
34
+ current(): string;
35
+ /** Apply a chosen value (persists + repaints status). `value` is one of `values`. */
36
+ run(value: string, ctx: ExtensionCommandContext): Promise<void> | void;
41
37
  }
42
38
 
43
39
  /** Stable status-bar key shared by every optimizer tool. */
@@ -94,6 +90,11 @@ export function renderStatus(
94
90
  export class OptimizerStatus {
95
91
  private states: Partial<Record<OptimizerTool, boolean>> = {};
96
92
 
93
+ /** Current enabled state for one tool (undefined until first set). */
94
+ get(tool: OptimizerTool): boolean | undefined {
95
+ return this.states[tool];
96
+ }
97
+
97
98
  /** Update one tool's enabled state and repaint the shared cell. */
98
99
  set(
99
100
  tool: OptimizerTool,