Public: anyone can read this; the crew can change it.

One keymap: not now is p in the terminal's Next up too, and /system's sort buttons carry S #17153

opened this

Merged 34h 54m ago, live in production

keymap-e → main 0 commits

  • Merged. keymap-e was merged into main as c1c75da.

Review

Sign in to review this change.
9 files changed +30 −29
docs/features/keymap.md +1 −1
@@ -18,7 +18,7 @@ The owner, after the bridge: "tying together all the keybinds is really what im
1818 - **A repository's tabs** are its own `g` jumps (`REPO_TABS`): `g c` code, `g i` issues, `g p` pulls, `g a` map, `g m` commits, `g b` branches, `g f` forks, `g r` runs, `g s` settings. Inside a repository `g f` and `g s` are its own, by design; the forge-wide Front page and Settings are a step away through `:` and Cmd/Ctrl K. A file's Propose a change is `e`.
1919 - **A quick second key** finds its button: `j` then `m` within a second merges, as `m` alone does (never after `g`, whose letter is a jump).
2020
21 - **Ranked lists, the space and /system:** /next's rows move with `T` top, `K` up, `J` down and `p` not now (the terminal's Next up keeps `l` for not now, since `p` pauses its planner); the space's canvas zooms with `+` and `-`, fits with `0`, jumps to now with `n` and steps bodies with `]` and `[`; /system's process table toggles CPU and memory with `S`. The terminal's cockpit puts a card off with `p` (later, the keymap's park), not `l`. Their old keys (`t` `u` `d` `l`, `c` `m`, the cockpit's `l`) say the new one until 2026-12-15.
21 - **Ranked lists, the space and /system:** /next's rows move with `T` top, `K` up, `J` down and `p` not now, on the page and in the terminal's Next up, where `P` pauses the planner; the space's canvas zooms with `+` and `-`, fits with `0`, jumps to now with `n` and steps bodies with `]` and `[`; /system's process table toggles CPU and memory with `S`, which each sort button carries as its hint. The terminal's cockpit puts a card off with `p` (later, the keymap's park), not `l`. Their old keys (`t` `u` `d` `l`, `c` `m`, the cockpit's `l`) say the new one until 2026-12-15.
2222 - **/boards, /flow and Talk** bind no keys of their own: they answer the shell's moves and nothing fires while typing in Talk's box. The test now has no page left that chooses a key.
2323
2424 Proof: `test/keymap.test.ts`, `test/bridge.test.ts`.
docs/features/next-up.md +2 −2
@@ -15,9 +15,9 @@ row: Next up
1515 - **MCP:** `next_up { app, issue?, to?, all? }` reads the list, or moves one issue with the same words.
1616 - A rank is cleared when the issue closes. Dependencies order within the list and are shown, never edited here.
1717
18 **Terminal:** the palette's "Next up in a repository" opens the same list; `T`, `K`, `J` and `l` are Top, Up, Down and Not now on the row under the cursor (`l`, not `p`, since `p` pauses the planner there; the keymap says so), through the same action as the page and MCP. A reader sees the order and the keys do nothing; a move made anywhere reorders an open screen live. At most 200 issues are ranked; a move past that is refused and says so.
18 **Terminal:** the palette's "Next up in a repository" opens the same list; `T`, `K`, `J` and `p` are Top, Up, Down and Not now on the row under the cursor, as on the page, and `P` pauses the planner (until 2026-12-15 the old `t`, `u`, `d` and `l` say the new key), through the same action as the page and MCP. A reader sees the order and the keys do nothing; a move made anywhere reorders an open screen live. At most 200 issues are ranked; a move past that is refused and says so.
1919
20 **Filter (#11867):** a plain GET form above the list narrows `/next` to one pillar (`?pillar=P7` or `Later`, typed in a box) and/or a word (`?q=cache`, matched without regard to case, shown as typed, at most 80 characters). A filter only hides rows: each keeps its real place in the whole ranking, the cut line stays where the whole list puts it (drawn only between shown rows), and a move made under a filter moves in the whole order and returns to the same filter. A line says "N of M shown", and that the week's capacity bar is left out while filtered. An unknown or malformed pillar shows an empty list that says so. **Terminal:** `/` asks for a pillar and/or a word (`P7 cache`); an empty answer clears it; ranks, `T` `K` `J` (top, up, down) and `l` (not now; `p` pauses the planner on this screen) and the header count behave as on the page.
20 **Filter (#11867):** a plain GET form above the list narrows `/next` to one pillar (`?pillar=P7` or `Later`, typed in a box) and/or a word (`?q=cache`, matched without regard to case, shown as typed, at most 80 characters). A filter only hides rows: each keeps its real place in the whole ranking, the cut line stays where the whole list puts it (drawn only between shown rows), and a move made under a filter moves in the whole order and returns to the same filter. A line says "N of M shown", and that the week's capacity bar is left out while filtered. An unknown or malformed pillar shows an empty list that says so. **Terminal:** `/` asks for a pillar and/or a word (`P7 cache`); an empty answer clears it; ranks, `T` `K` `J` `p` (top, up, down, not now) and the header count behave as on the page.
2121
2222 **The chapter line (#12681):** under the title, once the repository has chapters, `Ranked for <open chapter>: <progress sentence>` (linked), or "No chapter is open" with a link to draft one; a repository that never drafted a chapter shows no line. **Terminal:** the screen prints the same line under the title, from the same function (`chapterLineParts` in `core/chapters.ts`), wrapped to the width and never cut (#13254, #12991).
2323
src/tui/screens/next.ts +8 −9
@@ -13,7 +13,7 @@
1313 */
1414
1515 import { rankedWords, rankIssue, stepTo, type Place, placeOf } from "../../actions/next.ts";
16 import { keyOf, oldKeys, VERBS } from "../../web/keymap.ts";
16 import { keyOf, oldKeys } from "../../web/keymap.ts";
1717 import { listChapters, itemsOf, chapterLineWords, chapterNames } from "../../core/chapters.ts";
1818 import { takeOrder } from "../../crew/take_order.ts";
1919 import { nextAll, type NextGroup } from "../../core/next_all.ts";
@@ -215,7 +215,6 @@ export function nextScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
215215 };
216216 });
217217
218 const NOT_NOW = VERBS.park.terminal.key;
219218 const screen: Screen = {
220219 title: "Next up",
221220 get keys() {
@@ -223,17 +222,17 @@ export function nextScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
223222 return [
224223 binding(["j", "k"], "move cursor"),
225224 binding(["enter"], "open"),
226 // The forge's one keymap (web/keymap.ts): T, K and J as on the page; not now is l here,
227 // since p pauses the planner on this screen (the map says so).
225 // The forge's one keymap (web/keymap.ts): T, K, J and p as on the page; P pauses the
226 // planner.
228227 binding([keyOf("top")], "top", { disabled: !on || rows.indexOf(current()!) === 0 }),
229228 binding([keyOf("raise")], "up", { disabled: !on || rows.indexOf(current()!) === 0 }),
230229 binding([keyOf("lower")], "down", { disabled: !on || rows.indexOf(current()!) >= rows.length - 1 }),
231 binding([NOT_NOW], "not now", { disabled: !on }),
230 binding([keyOf("park")], "not now", { disabled: !on }),
232231 binding(["x"], "tick", { disabled: !on }),
233232 binding(["s"], "snooze", { disabled: !may() || ticked.size === 0 }),
234233 binding(["z"], "undo", { disabled: !may() || lastBatch.length === 0 }),
235234 binding(["/"], "filter"),
236 ...(owns() && growing !== undefined ? [binding(["p"], growing.until === null ? "pause planner" : "planner on")] : []),
235 ...(owns() && growing !== undefined ? [binding([keyOf("pausePlanner")], growing.until === null ? "pause planner" : "planner on")] : []),
237236 ];
238237 },
239238 load(signal) {
@@ -264,7 +263,7 @@ export function nextScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
264263 if (e.ctrl || e.alt) return false;
265264 // The old t, u and d say where they went, for two weeks (keymap.ts OLD_KEYS); l is still not
266265 // now.
267 const moved = oldKeys("next").find((o) => o.was === e.key && o.was !== NOT_NOW);
266 const moved = oldKeys("next").find((o) => o.was === e.key);
268267 if (moved !== undefined) ctx.toast(moved.says);
269268 else if (e.key === "enter") open();
270269 else if (e.key === keyOf("top")) rank({ to: "top" });
@@ -274,8 +273,8 @@ export function nextScreen(f: Session, ctx: Ctx, repo: Repo): Screen {
274273 else if (e.key === "s") batch(false);
275274 else if (e.key === "z") batch(true);
276275 else if (e.key === "/") ask();
277 else if (e.key === "p") pause();
278 else if (e.key === NOT_NOW) rank({ to: "not_now" });
276 else if (e.key === keyOf("pausePlanner")) pause();
277 else if (e.key === keyOf("park")) rank({ to: "not_now" });
279278 else return false;
280279 return true;
281280 },
src/web/keymap.ts +2 −7
@@ -65,13 +65,8 @@ export const VERBS = {
6565 approve: { key: "a", label: "Approve", what: "Approve it", kinds: ["pull"] },
6666 assign: { key: "a", label: "Assign", what: "Give it to someone", kinds: ["issue"] },
6767 sharpen: { key: "e", label: "Sharpen", what: "Have the planner plan it again", kinds: ["issue"] },
68 park: {
69 key: "p",
70 label: "Park",
71 what: "Park it behind the Later gate",
72 kinds: ["issue", "rank"],
73 terminal: { key: "l", reason: "the terminal's Next up screen pauses the planner on p for the repository's owner, a key that screen has had since before the map" },
74 },
68 park: { key: "p", label: "Park", what: "Park it behind the Later gate", kinds: ["issue", "rank"] },
69 pausePlanner: { key: "P", label: "Pause the planner", what: "Pause the planner, or turn it on again", kinds: ["rank"] },
7570 top: { key: "T", label: "Top", what: "Move it to the top of the list", kinds: ["rank"] },
7671 raise: { key: "K", label: "Up", what: "Move it one place up (Alt+↑ too)", kinds: ["rank"] },
7772 lower: { key: "J", label: "Down", what: "Move it one place down (Alt+↓ too)", kinds: ["rank"] },
src/web/pages/system.ts +3 −3
@@ -71,7 +71,7 @@ import { streamLag } from "../../snapshot/stream.ts";
7171 import { streamSentences, type StreamSentence } from "../../snapshot/stream_words.ts";
7272 import { stalePullsSection } from "./maintenance.ts";
7373 import { shapeWords } from "../../engine/mode.ts";
74 import { badge, btn, chartBox, disclosure, meter, pill, row, time } from "../ui.ts";
74 import { badge, btn, chartBox, disclosure, meter, pill, row, time, hintAttr } from "../ui.ts";
7575 import { EMPTY_WORDS, emptyLine, emptyList } from "../empty_words.ts";
7676 import { LARGEST_DIRS, largestDirs, type LargestDirs } from "../../system/largest_dirs.ts";
7777 import { DB_FILE_CAP, DB_GROWTH_MAX, TOP, dbSize, dbSizeNeed, type DbSize } from "../../system/db_size.ts";
@@ -830,8 +830,8 @@ export async function systemPage(ctx: Ctx, patterns: () => readonly string[]): P
830830 ${largestDirsSection(largestUnder)}
831831 ${dbSizeSection(dbNow)}
832832 <section class="settings-block"><h2>Processes</h2>
833 <div class="js-only small muted">Sort by <button class="btn" data-size="sm" type="button" data-sort="cpu" aria-pressed="true">CPU</button>
834 <button class="btn" data-size="sm" type="button" data-sort="mem" aria-pressed="false">memory</button> <kbd>${keyOf("sort")}</kbd> toggles</div>
833 <div class="js-only small muted">Sort by <button class="btn" data-size="sm" type="button" data-sort="cpu" aria-pressed="true" ${hintAttr(keyOf("sort"), "Sort by CPU")}>CPU</button>
834 <button class="btn" data-size="sm" type="button" data-sort="mem" aria-pressed="false" ${hintAttr(keyOf("sort"), "Sort by memory")}>memory</button> <kbd>${keyOf("sort")}</kbd> toggles</div>
835835 <div id="sys-procs" data-live-hold>${at("sys-procs")}</div></section>
836836 ${routeUseSection(timePhase(ctx.request, "routes", () => {
837837 return leastUsed(routeUsage(ctx.app.db, patterns(), new Date()));
test/keymap.test.ts +3 −2
@@ -140,8 +140,9 @@ test("the shell says where a moved key went, and a quick second key still finds
140140
141141 test("both doors share one meaning per key: R refreshes a terminal screen, / filters or searches, r queues a run again", () => {
142142 expect([keyOf("reread"), keyOf("search"), keyOf("requeue"), keyOf("stop"), keyOf("wheel")]).toEqual(["R", "/", "r", "s", "i"]);
143 // The only terminal key that differs is listed with why: not now on the Next up screen.
144 expect((Object.entries(KEYMAP) as [string, KeyDef][]).filter(([, d]) => d.terminal !== undefined).map(([id]) => id)).toEqual(["park"]);
143 // No terminal key differs from the web's: Next up's not now is p too, and its planner pause is P.
144 expect((Object.entries(KEYMAP) as [string, KeyDef][]).filter(([, d]) => d.terminal !== undefined).map(([id]) => id)).toEqual([]);
145 expect([keyOf("park"), keyOf("pausePlanner")]).toEqual(["p", "P"]);
145146 expect(oldKeys("terminal", new Date(Date.parse(OLD_KEYS_UNTIL) - 1))).toEqual([{ was: "r", key: "R", says: "R is refresh now" }]);
146147 });
147148
test/system-btop.test.ts +6
@@ -4,6 +4,8 @@
44 * crew / app, all from one seeded sample.
55 */
66 import { describe, expect, test } from "bun:test";
7 import { keyOf } from "../src/web/keymap.ts";
8 import { hintAttr } from "../src/web/ui.ts";
79 import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
810 import { tmpdir } from "node:os";
911 import { join } from "node:path";
@@ -134,6 +136,10 @@ describe("/system as btop", () => {
134136 expect(r["mem"]).toContain('aria-label="swap 512 MiB / 1.0 GiB"');
135137 const page = await Bun.file("src/web/pages/system.ts").text();
136138 expect(page).toMatch(/class="js-only[^"]*">Sort by[\s\S]*data-sort="mem"/);
139 // Each sort button carries its key, so S is found without reading the text beside it.
140 expect(page).toContain('data-sort="cpu" aria-pressed="true" ${hintAttr(keyOf("sort"), "Sort by CPU")}');
141 expect(page).toContain('data-sort="mem" aria-pressed="false" ${hintAttr(keyOf("sort"), "Sort by memory")}');
142 expect(hintAttr(keyOf("sort"), "Sort by CPU").text).toBe('data-hint="Sort by CPU · S" aria-keyshortcuts="S"');
137143 });
138144
139145 test("the sort puts kinds in order and the biggest first by CPU or memory, ties staying put", () => {
test/tui-next-growth.test.ts +3 −3
@@ -73,10 +73,10 @@ test("the owner sees the line, pauses with p, and switches on with p again", asy
7373 await h.toNext();
7474 expect(h.text()).toContain("This week: 2 issues opened (2 by owner), 0 closed. 2 open (2 issues, 0 pulls). The planner is on.");
7575 expect(h.text()).toContain("pause planner");
76 await h.press("p");
76 await h.press("P");
7777 expect(pausedUntil(forge.db, repo.id, new Date())).not.toBeNull();
7878 expect(h.text()).toContain("The planner is paused until you switch it on.");
79 await h.press("p");
79 await h.press("P");
8080 expect(pausedUntil(forge.db, repo.id, new Date())).toBeNull();
8181 expect(h.text()).toContain("The planner is on.");
8282 h.stop();
@@ -87,7 +87,7 @@ test("a reader sees the line and p does nothing", async () => {
8787 await h.toNext();
8888 expect(h.text()).toContain("This week: 2 issues opened");
8989 expect(h.text()).not.toContain("pause planner");
90 await h.press("p");
90 await h.press("P");
9191 expect(pausedUntil(forge.db, repo.id, new Date())).toBeNull();
9292 h.stop();
9393 });
test/tui-next-up.test.ts +2 −2
@@ -127,7 +127,7 @@ describe("next up in the terminal", () => {
127127
128128 // Not now puts the row behind the Later gate.
129129 const first = order()[0]!;
130 await h.press("l");
130 await h.press("p");
131131 expect(order()).not.toContain(first);
132132 expect(nextUp(forge.db, repo).notNow.map((r) => r.issue.number)).toContain(first);
133133
@@ -189,7 +189,7 @@ describe("next up in the terminal", () => {
189189 await h.toNext("alice/plan");
190190 expect(h.text()).toContain("you can read this order, not change it");
191191 const before = order();
192 await h.press("j", "T", "l", "J");
192 await h.press("j", "T", "p", "J");
193193 expect(order()).toEqual(before);
194194 h.stop();
195195 });

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs