repositories / pi-ext

pi-ext

bugabingas pi extensions

owned by bugabinga

Add legacy autoresearch.json shortcut fallback for tune with focused coverage

8981e14a0bda97b3af26b188eaaf146a96eca1de

Oliver Jan Krylow <oliver@bugabinga.net> ·

unsigned

Browse filesCompare with HEAD

Result: {"status":"keep","wall_time":500,"tests_passed":46,"failures":0}

Changed files (3)

extensions/tune/README.md

Modified
20 20 Settings:
21 21 Keyboard shortcuts configurable in `<agent-dir>/extensions/tune.json`.
22 +If missing, legacy `<agent-dir>/extensions/autoresearch.json` is still read.
23 24 ## Hooks

extensions/tune/__tests__/remaining.test.ts

Modified
134 134 expect(s.toggleDashboard).toBe("ctrl+shift+t");
135 135 expect(s.fullscreenDashboard).toBe("ctrl+shift+f");
138 + it("falls back to legacy autoresearch.json", () => {
139 + const configDir = path.join(MIGRATION_TESTDIR, "extensions");
140 + fs.mkdirSync(configDir, { recursive: true });
141 + fs.writeFileSync(
142 + path.join(configDir, "autoresearch.json"),
143 + JSON.stringify({ shortcuts: { toggleDashboard: "ctrl+x" } }),
144 + );
145 + expect(resolveTuneShortcuts(path.join(configDir, "tune.json")).toggleDashboard).toBe(
146 + "ctrl+x",
147 + );
148 + });
139 151 // ── 5. HOOK PATHS ─────────────────────────────────────────────────────

extensions/tune/shortcuts.ts

Modified
3 3 * Keyboard shortcut configuration for tune dashboard.
5 5 * Config file: <agent-dir>/extensions/tune.json
6 + * Fallback: <agent-dir>/extensions/autoresearch.json
6 7 * Keys: shortcuts.toggleDashboard, shortcuts.fullscreenDashboard
9 10 import { existsSync, readFileSync } from "node:fs";
10 -import { join } from "node:path";
11 +import { dirname, join } from "node:path";
11 12 import { getAgentDir } from "@earendil-works/pi-coding-agent";
13 14 // ── Constants ─────────────────────────────────────────────────────────────
15 16 export const DEFAULT_FULLSCREEN_DASHBOARD_SHORTCUT = "ctrl+shift+f";
17 18 const CONFIG_FILE_NAME = "tune.json";
19 +const LEGACY_CONFIG_FILE_NAME = "autoresearch.json";
19 21 // ── Types ─────────────────────────────────────────────────────────────────
76 78 export function resolveTuneShortcuts(
77 79 configPath: string = tuneShortcutsConfigPath(),
78 80 ): TuneShortcuts {
79 - if (!existsSync(configPath)) return defaultTuneShortcuts();
81 + if (!existsSync(configPath)) {
82 + const legacyPath = join(dirname(configPath), LEGACY_CONFIG_FILE_NAME);
83 + if (!existsSync(legacyPath)) return defaultTuneShortcuts();
84 + configPath = legacyPath;
85 + }
81 87 let parsed: unknown;
82 88 try {