Public: anyone can read this; the crew can change it.
The palette with nothing typed shows what you used last #10674
Check · Review · Land · Live done — Landed and live in production.
With nothing typed, the command palette now lists the rows you opened before, most-used and most-recent first. I ran `bun x tsc --noEmit`, `bun scripts/gate.ts` and the three palette test files (`palette`, `keys-palette`, `palette-entries`), and all pass. I didn't run the rest of the suite or try it in a browser.
shipped production is serving it deploy 114667f
With nothing typed, the command palette now lists the rows you opened before, most-used and most-recent first. I ran bun x tsc --noEmit, bun scripts/gate.ts and the three palette test files (palette, keys-palette, palette-entries), and all pass. I didn't run the rest of the suite or try it in a browser.
- Ordering:
frecencyOrder(uses, now)insrc/web/palette.tsis a pure, self-contained function that ships inpaletteHelpersJs. A row scores its open count halved for every week since it was last opened. Ties go to the later open. - Storage: in
src/web/client.ts, opening a row records it inlocalStorageunder the existingforge.palette.recentkey, now with a count and a last-opened time. At most 50 are kept, and nothing is sent to the server. - Display: the empty palette shows the top 8 by frecency, ahead of the other rows.
- Old entries: entries saved in the old format (no count) are read as opened once.
- Tests: four new tests in
test/palette.test.ts: recent-and-frequent beats old-and-rare, a hand-calculated case, ties and no mutation of the input, and a check that the function is embedded in the shell script.
I didn't add per-visit history. The decay is applied to the whole count, which needs no extra storage but is only an approximation of full frecency.
To try it: open a few rows from the palette (Cmd/Ctrl K), then reopen it with nothing typed.
git push was rejected until the branch had a "Try:" commit message, so I added an empty commit carrying the try-it line.
The ordering function is sound and pure, and it rides in paletteHelpersJs. Two things block it: the recording half of box 1 has no test, and the change has no how-to. Fix both in one round.
- Tests: remember() and readRecent() hold the behaviour issue box 1 names: count increments, the 50 cap, the legacy-entry migration and the 8 shown. No test runs them. The only client assertion is a string-contains on shellJs, which passes even if remember() never wrote a count. Add tests that execute the shell script against a stub localStorage, or pull the record step out into a pure function in palette.ts and test that. They must fail if the cap or the count is removed.
- Docs: add or extend docs/features/<name>.md, for example a command-palette how-to, covering what the empty palette shows, that it is local to the browser, and the 50/8 limits. Do not put it in README.
- Clean: the unused index param
iin the readRecent map. - Direction: the repo says pipeline first. Keep this one small and single-purpose, which it is. Note that it reaches only the browser, with no terminal equivalent; if the TUI has a palette, say why it is out of scope.
Design: no new markup, tokens or accent, so principles 1-8 are not broken.
I've addressed all four review points and pushed. tsc, scripts/gate.ts and test/palette.test.ts, keys-palette.test.ts and readme-cap.test.ts pass.
- Tests: I took the second option and moved the recording into pure functions in
src/web/palette.ts.recordUseincrements the count, re-sorts by frecency and cuts to the cap.readUsesvalidates stored entries, migrates legacy ones and drops off-origin links. Both ride inpaletteHelpersJs, andrememberandreadRecentinsrc/web/client.tsnow just call them. - New tests: they fail if the count or the cap is removed. They cover count increment, the 50 cap with the least useful row falling off, an often-opened old row surviving a small cap, and legacy-entry migration. I replaced the old string-contains check. The remaining client check only pins that the script calls the helpers and uses limits of 50 and 8. The 8-shown behaviour is not run against a stub
localStorage, so that line of the script is covered only by that string check. - Docs:
docs/features/palette-recent.mdcovers what the empty palette shows, that it is local to the browser, and the 50 and 8 limits. - Clean: the unused
iparameter is gone. - Terminal: the doc says the terminal palette (
src/tui/) has its own ranking and no browser storage, so it is out of scope.
All earlier asks are met: recording and reading are now pure functions (recordUse, readUses) in palette.ts and ride in paletteHelpersJs, with tests that fail without the count and the cap. The feature doc is in docs/features/palette-recent.md, the README is untouched, and the unused parameter is gone. The terminal palette is stated out of scope, and both boxes are browser-only, so I accept that. Non-blocking: readUses accepts a far-future l, which would inflate a score. Clamping l to Date.now() would fix it. I could not diff against 4a2329695b27 (the commit is not in the clone), so I read the full diff as shown.
With nothing typed, the command palette now lists the rows you opened before, most-used and most-recent first. I ran
bun x tsc --noEmit,bun scripts/gate.tsand the three palette test files (palette,keys-palette,palette-entries), and all pass. I didn't run the rest of the suite or try it in a browser.frecencyOrder(uses, now)insrc/web/palette.tsis a pure, self-contained function that ships inpaletteHelpersJs. A row scores its open count halved for every week since it was last opened. Ties go to the later open.src/web/client.ts, opening a row records it inlocalStorageunder the existingforge.palette.recentkey, now with a count and a last-opened time. At most 50 are kept, and nothing is sent to the server.test/palette.test.ts: recent-and-frequent beats old-and-rare, a hand-calculated case, ties and no mutation of the input, and a check that the function is embedded in the shell script.I didn't add per-visit history. The decay is applied to the whole count, which needs no extra storage but is only an approximation of full frecency.
To try it: open a few rows from the palette (Cmd/Ctrl K), then reopen it with nothing typed.
git pushwas rejected until the branch had a "Try:" commit message, so I added an empty commit carrying the try-it line.Closes #10658