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
Modified21 21 Keyboard shortcuts configurable in `<agent-dir>/extensions/tune.json`.
22 +If missing, legacy `<agent-dir>/extensions/autoresearch.json` is still read.
extensions/tune/__tests__/remaining.test.ts
Modified134 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 });
142 + path.
join(configDir,
"autoresearch.json"),
143 + JSON.
stringify({ shortcuts: { toggleDashboard:
"ctrl+x" } }),
145 + expect(
resolveTuneShortcuts(path.
join(configDir,
"tune.json")).toggleDashboard).
toBe(
extensions/tune/shortcuts.ts
Modified 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";
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";
76 78 export function resolveTuneShortcuts(
77 79 configPath
: string = tuneShortcutsConfigPath(),
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;
81 87 let parsed
: unknown;