Public: anyone can read this; the crew can change it.
One keymap (c): runs, issues, files and the whole terminal answer the map's keys, one meaning per key at both doors #17012
Merged 47h 27m ago, live in production
keymap-c → main 0 commits
54 files
changed +387
−199
- docs/features/keymap.md
- docs/features/talk.md
- src/tui/app/app.ts
- src/tui/local/repos.ts
- src/tui/screens/answers.ts
- src/tui/screens/app_changes.ts
- src/tui/screens/boards.ts
- src/tui/screens/captain.ts
- src/tui/screens/cockpit.ts
- src/tui/screens/commits.ts
- src/tui/screens/crewhandover.ts
- src/tui/screens/dashboard.ts
- src/tui/screens/decider.ts
- src/tui/screens/deploys.ts
- src/tui/screens/drift.ts
- src/tui/screens/issue.ts
- src/tui/screens/issues.ts
- src/tui/screens/plan.ts
- src/tui/screens/pricing.ts
- src/tui/screens/prompts.ts
- src/tui/screens/pull.ts
- src/tui/screens/refs.ts
- src/tui/screens/runlog.ts
- src/tui/screens/runs.ts
- src/tui/screens/shells.ts
- src/tui/screens/talk_build.ts
- src/tui/screens/talk_chats.ts
- src/tui/screens/thoughtnotes.ts
- src/tui/screens/waves.ts
- src/tui/screens/wayback.ts
- src/tui/screens/workspace.ts
- src/web/keymap.ts
- src/web/pages/explorer.ts
- src/web/pages/thread.ts
- src/web/studio/run.ts
- test/decisions-by-doors.test.ts
- test/keymap-terminal.test.ts
- test/keymap.test.ts
- test/reviewer-lands.test.ts
- test/studio-run-page.test.ts
- test/tell-status.test.ts
- test/tui-crewhandover-open.test.ts
- test/tui-deploys-probe.test.ts
- test/tui-pricing.test.ts
- test/tui-run-cancel.test.ts
- test/tui-runlog.test.ts
- test/tui-runs-requeue.test.ts
- test/tui-runs-state.test.ts
- test/tui-steer.test.ts
- test/tui-talk-build.test.ts
- test/tui-talk-chats.test.ts
- test/tui-workflows.test.ts
- test/tui-yours-asks.test.ts
- test/web-code.test.ts
docs/features/keymap.md +3 −2
| @@ -11,12 +11,13 @@ The owner, after the bridge: "tying together all the keybinds is really what im | ||
| 11 | 11 | - **Verbs, one meaning per kind of thing:** a pull: `m` merge (asks for a second `m`), `x` close, `b` send back, `u` update, `a` approve. An issue: `a` assign, `e` sharpen, `p` park, `x` close. A run: `s` stop, `r` queue it again, `w` watch, `i` take the wheel. A figure: `-` / `+` turn it, Enter sets it. `z` undoes, `x` dismisses a card. |
| 12 | 12 | - **Never while typing:** in a box every key is the box's; Escape leaves it. |
| 13 | 13 | - **One source:** pages take a key with `keyOf(id)`, the bridge's script is handed the verbs from the map, `?` and Cmd/Ctrl K list what a page carries, and the shell's own keys are held to the map's moves. `test/keymap.test.ts` refuses a key literal outside the map, one key with two meanings on one kind of thing, and a key that fires while typing; the files not yet moved are listed there with the pull that moves them. |
| 14 | - **In the terminal** (`src/tui`) the same acts are meant to answer the same keys. Where the terminal still answers another key, the map says which and why (the run list's `x` stop, `a` queue again and `S` steer, which move with the runs pull). | |
| 14 | - **In the terminal** (`src/tui`) the same keys mean the same things, read from the same map: the run list stops on `s`, queues again on `r` and takes the wheel on `i`, and so do the run cards on the issue and pull screens; `R` reads every terminal screen again (the map's `reread`; a page on the web is live and needs none) and `/` filters or searches a list, the state filter included. Screens that had `R` for something else moved it: a pull's review is `b`, the dashboard's redirect `G`, a workspace's decisions-by `A`, a Talk build's restore `U`. For two weeks `r` on a screen that reads again on `R` says "R is refresh now", and the run list's old `x`, `S` and `a` say theirs. Where `r` is a screen's own verb on a different kind of thing (rename a branch or a chat, raise a limb, restore a forge, run a schedule now, and the rest), the screen is listed with what `r` does in `test/keymap-terminal.test.ts`, which also fails if any terminal screen binds `r` to a refresh again. | |
| 15 | - **Runs, issues and files on the web:** a run's Stop (or Cancel run) is `s` and `i` puts the caret in its steer box; on an issue `a` puts it on Assign to (a pull's `a` is approve, on its Files page); a repository's Go to file is `f`, and `t` there says so for two weeks, since `t` is Tell the crew everywhere. | |
| 15 | 16 | |
| 16 | 17 | - **Keys that moved** say where they went for two weeks, until 2026-12-15 (`OLD_KEYS` in the map), then the hints are gone: /review's `c` and `r` are now `x` (close) and `b` (send back), and a pull's verdicts `v a`, `v r`, `v c` are now `a` (approve), `b` (send back) and `c` (comment, the page's write key). Pressing the old key shows one line at the top of the page, "x is close now". |
| 17 | 18 | - **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`. |
| 18 | 19 | - **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). |
| 19 | 20 | |
| 20 | Coming, one pull each: issues and runs (and the terminal's run list, where `x`, `a` and `S` become `s`, `r` and `i`); /boards, /flow and Talk. | |
| 21 | Coming: /boards, /flow and Talk, and the pages that still bind their own keys (/next's `t` `u` `d` `l`, the space's `n`, /system's `c` and `m`), listed in the test with that pull. | |
| 21 | 22 | |
| 22 | 23 | Proof: `test/keymap.test.ts`, `test/bridge.test.ts`. |
docs/features/talk.md +2 −2
| @@ -61,7 +61,7 @@ A person has any number. `/talk` is their latest, with the list above it (newest | ||
| 61 | 61 | - **Cap:** a person holds at most 100 conversations, archived ones counted; past it New is refused (page flash, API 409 `too_many`, MCP `too_many`). Stop ends every reply the person has running, in any conversation. |
| 62 | 62 | - **API:** `GET /api/v1/conversations[?archived=1]`, `POST /api/v1/conversations {title?}`, `PATCH /api/v1/conversations/:id {title?, archived?}`; `conversation` on `POST …/messages` and `GET …/turns?conversation=` picks one. |
| 63 | 63 | - **MCP:** `say` with `action` list | new | rename | archive | restore, and `conversation` to speak in one. |
| 64 | - **Terminal:** Palette → Conversations: `n` new, `r` rename, `x` archive or restore, `a` the archived list, Enter opens one (its last 50 turns; `s` says something in it, `r` reloads); the same calls, so the web list and stream read what it writes. | |
| 64 | - **Terminal:** Palette → Conversations: `n` new, `r` rename, `x` archive or restore, `a` the archived list, Enter opens one (its last 50 turns; `s` says something in it, `R` reloads); the same calls, so the web list and stream read what it writes. | |
| 65 | 65 | - **Pin (#14564):** Pin and Unpin on the open conversation (`POST /talk/:id/pin`, owner only, same-origin) keep it at the top of the list under a quiet *Pinned* heading, newest activity first among the pinned. Archiving clears the pin and an archived conversation cannot be pinned. Terminal: `p` in Conversations. |
| 66 | 66 | - Sending to an archived conversation keeps it archived; the page says so above the composer. |
| 67 | 67 | |
| @@ -184,7 +184,7 @@ An empty conversation offers Build an app among its starters (#15734); it opens | ||
| 184 | 184 | - **Publish** merges the pull to the default branch, which deploys production; the production URL then shows as a link. Only a person publishes. |
| 185 | 185 | - **API:** `POST /api/v1/builds {prompt, template?}`, `GET /api/v1/conversations/:id/build`, `GET …/build/versions/:n/diff`, `POST …/build/restore {version}`, `POST …/build/publish`. Web forms: `POST /talk/build`, `/talk/:id/build/restore`, `/talk/:id/build/publish`. |
| 186 | 186 | - **Limits:** five builds an hour and ten unpublished at once, per person (`BUILDS_PER_HOUR`, `UNPUBLISHED_MAX`); a template must be one on offer to that person, on the API as on the page; a start that fails takes back the repository and conversation it made. |
| 187 | - **Terminal:** `:` then **Build an app**. `n` says what to build (`t` chooses the template), Enter opens a build and lists its versions newest first, Enter again shows the files that version changed, `R` restores the chosen version, `P` publishes, `r` reloads. The screen calls the same `actions/build.ts` functions as the page, so it is gated the same way (your own conversation, a writer of the repository) and what it does is what the page shows on its next read. | |
| 187 | - **Terminal:** `:` then **Build an app**. `n` says what to build (`t` chooses the template), Enter opens a build and lists its versions newest first, Enter again shows the files that version changed, `U` restores the chosen version, `P` publishes, `R` reloads. The screen calls the same `actions/build.ts` functions as the page, so it is gated the same way (your own conversation, a writer of the repository) and what it does is what the page shows on its next read. | |
| 188 | 188 | - Proof: `test/talk-build.test.ts` runs prompt, repository, v1, v2, restore v1 and publish against a scratch forge; `test/tui-talk-build.test.ts` does the same from the terminal. |
| 189 | 189 | |
| 190 | 190 | ## Your accounts elsewhere (`origins`) |
src/tui/app/app.ts +8
| @@ -11,6 +11,7 @@ | ||
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | 13 | import { defect } from "../../kernel/error.ts"; |
| 14 | import { oldKeys } from "../../web/keymap.ts"; | |
| 14 | 15 | import { MOUSE_OFF, MOUSE_ON } from "../term/ansi.ts"; |
| 15 | 16 | import type { InputEvent, KeyEvent, MouseEvent } from "../term/input.ts"; |
| 16 | 17 | import { InputDecoder } from "../term/input.ts"; |
| @@ -847,6 +848,13 @@ export class App { | ||
| 847 | 848 | // meant an editor with no undo key. |
| 848 | 849 | if (e.ctrl && e.key === "z") return; |
| 849 | 850 | |
| 851 | // A key that moved in the forge's one keymap (web/keymap.ts) says where it went, for two weeks, | |
| 852 | // on a screen where the new key works: r on a screen that refreshes on R. | |
| 853 | if (!e.ctrl && !e.alt) { | |
| 854 | const moved = oldKeys("terminal").find((o) => o.was === e.key); | |
| 855 | if (moved !== undefined && this.top().screen.keys.some((b) => b.keys.includes(moved.key))) return this.toast(moved.says); | |
| 856 | } | |
| 857 | ||
| 850 | 858 | const hit = find(this.globals, e); |
| 851 | 859 | switch (hit?.help) { |
| 852 | 860 | case "help": |
src/tui/local/repos.ts +3 −2
| @@ -10,6 +10,7 @@ | ||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | import { err, ok } from "../../kernel/result.ts"; |
| 13 | import { keyOf } from "../../web/keymap.ts"; | |
| 13 | 14 | import * as git from "../../git/local.ts"; |
| 14 | 15 | import type { Ctx, Screen } from "../app/app.ts"; |
| 15 | 16 | import { binding, type Binding } from "../app/keys.ts"; |
| @@ -91,7 +92,7 @@ export function reposScreen(local: Local, ctx: Ctx): Screen { | ||
| 91 | 92 | binding(["p"], local.api === null ? "pin (sign in)" : "pin / unpin", { |
| 92 | 93 | disabled: !has || local.api === null, |
| 93 | 94 | }), |
| 94 | binding(["r"], "refresh"), | |
| 95 | binding([keyOf("reread")], "refresh"), | |
| 95 | 96 | binding(["/"], "filter"), |
| 96 | 97 | binding(["j", "k"], "move"), |
| 97 | 98 | ]; |
| @@ -147,7 +148,7 @@ export function reposScreen(local: Local, ctx: Ctx): Screen { | ||
| 147 | 148 | ctx.push(workScreen(local, ctx, entry.repo)); |
| 148 | 149 | return true; |
| 149 | 150 | } |
| 150 | if (e.key === "r") { | |
| 151 | if (e.key === keyOf("reread")) { | |
| 151 | 152 | task.run("refresh", async () => ok(), reload); |
| 152 | 153 | return true; |
| 153 | 154 | } |
src/tui/screens/answers.ts +3 −2
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | import { answersFor, canSeeAnswers } from "../../web/studio/answers.ts"; |
| 11 | import { keyOf } from "../../web/keymap.ts"; | |
| 11 | 12 | import { CREW_WORKING } from "../../actions/ask_state_words.ts"; |
| 12 | 13 | import { tell } from "../../actions/tell.ts"; |
| 13 | 14 | import { SAY_SOMETHING_WORDS } from "../../actions/tell_words.ts"; |
| @@ -81,7 +82,7 @@ export function answersScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 81 | 82 | }; |
| 82 | 83 | const screen: Screen = { |
| 83 | 84 | title: "Your tells", |
| 84 | keys: [binding(["j", "k"], "move"), binding(["enter"], "open"), binding(["t"], "tell"), binding(["r"], "refresh")], | |
| 85 | keys: [binding(["j", "k"], "move"), binding(["enter"], "open"), binding(["t"], "tell"), binding([keyOf("reread")], "refresh")], | |
| 85 | 86 | load: async () => read(), |
| 86 | 87 | render(area, s) { |
| 87 | 88 | const c = ctx.theme.c; |
| @@ -113,7 +114,7 @@ export function answersScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 113 | 114 | more(); |
| 114 | 115 | return true; |
| 115 | 116 | } |
| 116 | if (e.key === "r") { | |
| 117 | if (e.key === keyOf("reread")) { | |
| 117 | 118 | read(); |
| 118 | 119 | ctx.invalidate(); |
| 119 | 120 | return true; |
src/tui/screens/app_changes.ts +3 −2
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { appendChange, readChanges, type ChangesRead } from "../../actions/app_changes.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import { isRoom } from "../../apps/changes.ts"; |
| 11 | 12 | import { getAppByRepo } from "../../core/apps.ts"; |
| 12 | 13 | import type { Repo } from "../../core/repos.ts"; |
| @@ -69,7 +70,7 @@ export function changesScreen(f: Session, ctx: Ctx, repo: Repo, firstRoom: strin | ||
| 69 | 70 | return [ |
| 70 | 71 | binding(["a"], "append"), |
| 71 | 72 | binding(["o"], "other room"), |
| 72 | binding(["r"], "read again"), | |
| 73 | binding([keyOf("reread")], "read again"), | |
| 73 | 74 | binding(["j", "k"], "move cursor"), |
| 74 | 75 | ]; |
| 75 | 76 | }, |
| @@ -83,7 +84,7 @@ export function changesScreen(f: Session, ctx: Ctx, repo: Repo, firstRoom: strin | ||
| 83 | 84 | key(e) { |
| 84 | 85 | if (state.key(e, got?.changes.length ?? 0)) return true; |
| 85 | 86 | if (e.ctrl || e.alt) return false; |
| 86 | if (e.key === "r") { | |
| 87 | if (e.key === keyOf("reread")) { | |
| 87 | 88 | load(); |
| 88 | 89 | return true; |
| 89 | 90 | } |
src/tui/screens/boards.ts +3 −2
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | import { formatValue } from "../../boards/chart.ts"; |
| 18 | import { keyOf } from "../../web/keymap.ts"; | |
| 18 | 19 | import { watchBoard, type Frame } from "../../boards/live_hub.ts"; |
| 19 | 20 | import { panelData, type PanelData } from "../../boards/panel_data.ts"; |
| 20 | 21 | import { RANGES, type Board } from "../../boards/store.ts"; |
| @@ -345,7 +346,7 @@ export function boardsScreen(f: Session, ctx: Ctx): Screen { | ||
| 345 | 346 | return [ |
| 346 | 347 | binding(["j", "k"], "move"), binding(["enter"], "open"), binding(["n"], "new"), binding(["c"], "copy"), |
| 347 | 348 | ...(mayEdit ? [binding(["e"], "rename"), binding(["g"], "range")] : []), |
| 348 | binding(["D"], "delete"), binding(["r"], "refresh"), | |
| 349 | binding(["D"], "delete"), binding([keyOf("reread")], "refresh"), | |
| 349 | 350 | ]; |
| 350 | 351 | }, |
| 351 | 352 | load: read, |
| @@ -393,7 +394,7 @@ export function boardsScreen(f: Session, ctx: Ctx): Screen { | ||
| 393 | 394 | else asking = row; |
| 394 | 395 | return true; |
| 395 | 396 | } |
| 396 | if (e.key === "r") { | |
| 397 | if (e.key === keyOf("reread")) { | |
| 397 | 398 | runAsync(ctx, async () => { |
| 398 | 399 | await read(); |
| 399 | 400 | ctx.invalidate(); |
src/tui/screens/captain.ts +3 −2
| @@ -10,6 +10,7 @@ | ||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | import { runRoutine } from "../../crew/routines.ts"; |
| 13 | import { keyOf } from "../../web/keymap.ts"; | |
| 13 | 14 | import { costLine, dayCost } from "../../crew/captain_cost.ts"; |
| 14 | 15 | import { addMemory, editMemory, MEMORY_TEXT_MAX, MEMORY_WORDS, removeMemory, rulesOf, type Memory } from "../../core/talk_memory.ts"; |
| 15 | 16 | import { EVERY_MAX, EVERY_MIN, listRoutines, ROUTINE_NAMES, setRoutine, type Routine } from "../../core/talk_routines.ts"; |
| @@ -78,7 +79,7 @@ export function captainScreen(f: Session, ctx: Ctx): Screen { | ||
| 78 | 79 | }; |
| 79 | 80 | const screen: Screen = { |
| 80 | 81 | title: "Captain", |
| 81 | keys: [binding(["j", "k"], "move"), binding(["a"], "add a rule"), binding(["enter"], "edit"), binding(["d"], "delete"), binding(["space"], "on/off"), binding(["p"], "post now / pause a watch"), binding(["w"], "add a watch"), binding(["e"], "end a watch now"), binding(["esc", "q"], "close")], | |
| 82 | keys: [binding(["j", "k"], "move"), binding(["a"], "add a rule"), binding(["enter"], "edit"), binding(["d"], "delete"), binding(["space"], "on/off"), binding(["p"], "post now / pause a watch"), binding(["w"], "add a watch"), binding(["e"], "end a watch now"), binding([keyOf("reread")], "refresh"), binding(["esc", "q"], "close")], | |
| 82 | 83 | load: read, |
| 83 | 84 | render(area, s) { |
| 84 | 85 | drawList(s, area, ctx.theme.c, state, captainRows(lines)); |
| @@ -147,7 +148,7 @@ export function captainScreen(f: Session, ctx: Ctx): Screen { | ||
| 147 | 148 | ctx.toast(posted.posted ? `${ROUTINE_NAMES[kind]} posted to your Captain thread in Talk.` : `${ROUTINE_NAMES[kind]}: nothing new since the last post.`, "success"); |
| 148 | 149 | await read(); |
| 149 | 150 | }); |
| 150 | } else if (e.key === "r") refresh(); | |
| 151 | } else if (e.key === keyOf("reread")) refresh(); | |
| 151 | 152 | else state.key(e, lines.length); |
| 152 | 153 | return true; |
| 153 | 154 | }, |
src/tui/screens/cockpit.ts +3 −2
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | import { actOnProposal } from "../../actions/proposals.ts"; |
| 11 | import { keyOf } from "../../web/keymap.ts"; | |
| 11 | 12 | import { decideAsk } from "../../actions/asks_decide.ts"; |
| 12 | 13 | import { cockpitFor, type Cockpit, type CockpitAction } from "../../web/studio/cockpit.ts"; |
| 13 | 14 | import type { Ctx, Screen } from "../app/app.ts"; |
| @@ -70,7 +71,7 @@ export function cockpitScreen(f: Session, ctx: Ctx): Screen { | ||
| 70 | 71 | }; |
| 71 | 72 | return { |
| 72 | 73 | title: "Cockpit", |
| 73 | keys: [binding(["j", "k"], "move"), binding(["enter"], "do"), binding(["l"], "later"), binding(["o"], "web"), binding(["r"], "refresh")], | |
| 74 | keys: [binding(["j", "k"], "move"), binding(["enter"], "do"), binding(["l"], "later"), binding(["o"], "web"), binding([keyOf("reread")], "refresh")], | |
| 74 | 75 | load: async () => read(), |
| 75 | 76 | render(area, s) { |
| 76 | 77 | const c = ctx.theme.c; |
| @@ -96,7 +97,7 @@ export function cockpitScreen(f: Session, ctx: Ctx): Screen { | ||
| 96 | 97 | } |
| 97 | 98 | return true; |
| 98 | 99 | } |
| 99 | if (e.key === "r") { | |
| 100 | if (e.key === keyOf("reread")) { | |
| 100 | 101 | read(); |
| 101 | 102 | ctx.invalidate(); |
| 102 | 103 | return true; |
src/tui/screens/commits.ts +3 −2
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { OFFER_COMMIT_WORDS, offerCommit } from "../../actions/offer_commit.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import { checkOfCommit, verdictsOfCommits } from "../../actions/runs.ts"; |
| 11 | 12 | import type { CommitCheck } from "../../checks/commit_check.ts"; |
| 12 | 13 | import type { FileDiff } from "../../git/diff.ts"; |
| @@ -116,7 +117,7 @@ export function commitsScreen( | ||
| 116 | 117 | binding(["j", "k"], "move"), |
| 117 | 118 | binding(["enter"], "open"), |
| 118 | 119 | binding(["b"], "ref"), |
| 119 | binding(["r"], "refresh"), | |
| 120 | binding([keyOf("reread")], "refresh"), | |
| 120 | 121 | ], |
| 121 | 122 | load: page, |
| 122 | 123 | render(area, s) { |
| @@ -167,7 +168,7 @@ export function commitsScreen( | ||
| 167 | 168 | ); |
| 168 | 169 | return true; |
| 169 | 170 | } |
| 170 | if (e.key === "r") { | |
| 171 | if (e.key === keyOf("reread")) { | |
| 171 | 172 | commits = []; |
| 172 | 173 | marks.clear(); |
| 173 | 174 | cursor = undefined; |
src/tui/screens/crewhandover.ts +3 −2
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { tryAgain } from "../../actions/try_again.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import { getRepo } from "../../core/repos.ts"; |
| 11 | 12 | import { crewHandover } from "../../crew/handed.ts"; |
| 12 | 13 | import type { Ctx, Screen } from "../app/app.ts"; |
| @@ -70,7 +71,7 @@ export function crewHandoverScreen(f: Session, ctx: Ctx): Screen { | ||
| 70 | 71 | binding(["j", "k"], "move cursor"), |
| 71 | 72 | binding(["enter"], "open"), |
| 72 | 73 | binding(["t"], "try the issue again"), |
| 73 | binding(["r"], "refresh"), | |
| 74 | binding([keyOf("reread")], "refresh"), | |
| 74 | 75 | ], |
| 75 | 76 | render(area, s) { |
| 76 | 77 | const c = ctx.theme.c; |
| @@ -93,7 +94,7 @@ export function crewHandoverScreen(f: Session, ctx: Ctx): Screen { | ||
| 93 | 94 | retry(); |
| 94 | 95 | return true; |
| 95 | 96 | } |
| 96 | if (e.key === "r") { | |
| 97 | if (e.key === keyOf("reread")) { | |
| 97 | 98 | read(); |
| 98 | 99 | rows = build(); |
| 99 | 100 | state.clamp(rows.length); |
src/tui/screens/dashboard.ts +5 −4
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | import { readyAsk } from "../../spawn/template_record.ts"; |
| 18 | import { keyOf } from "../../web/keymap.ts"; | |
| 18 | 19 | import { DEFAULT_WEIGHTS, frontWeights, type FrontWeights } from "../../core/front.ts"; |
| 19 | 20 | import { quietSince, exploreCount, exploreFiltered, exploreLine, isExploreLine, exploreNote, exploreSuggestion, explorePage, groupForks, parseExploreQuery, readExploreLine, whyOf, figuresOf, peopleWords, PEOPLE_ORDER_WORDS, type ExploreRow } from "../../actions/explore.ts"; |
| 20 | 21 | import { protectionNotice } from "../../kernel/protection.ts"; |
| @@ -1253,7 +1254,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1253 | 1254 | ? [binding(["b"], "give back to the crew")] |
| 1254 | 1255 | : []), |
| 1255 | 1256 | ...(focus === "onyou" && waveHere() !== undefined |
| 1256 | ? [binding(["y"], "approve wave"), binding(["R"], "redirect"), binding(["l"], "later")] | |
| 1257 | ? [binding(["y"], "approve wave"), binding(["G"], "redirect"), binding(["l"], "later")] | |
| 1257 | 1258 | : []), |
| 1258 | 1259 | ...(asideWaves.length > 0 ? [binding(["B"], "bring waves back")] : []), |
| 1259 | 1260 | ...(lastHand !== undefined ? [binding(["U"], "undo decider")] : []), |
| @@ -1297,7 +1298,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1297 | 1298 | ...(focus === "repos" && f.user !== undefined && shown().some(mayArchive) |
| 1298 | 1299 | ? [binding(["space"], "mark"), ...(markedRepos.size > 0 ? [binding(["a"], "archive marked")] : [])] |
| 1299 | 1300 | : []), |
| 1300 | binding(["r"], "refresh"), | |
| 1301 | binding([keyOf("reread")], "refresh"), | |
| 1301 | 1302 | ]; |
| 1302 | 1303 | }, |
| 1303 | 1304 | load(signal) { |
| @@ -1510,7 +1511,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1510 | 1511 | if (e.key === "h") return hideAuthor(), true; |
| 1511 | 1512 | if (e.key === "H" && item !== undefined) return hideAppForADay(), true; |
| 1512 | 1513 | if (e.key === "y") return actOnWave("approve"), true; |
| 1513 | if (e.key === "R") return redirectWave(), true; | |
| 1514 | if (e.key === "G") return redirectWave(), true; | |
| 1514 | 1515 | if (e.key === "l") return actOnWave("later"), true; |
| 1515 | 1516 | } |
| 1516 | 1517 | if (e.key === "B" && f.user && asideWaves.length > 0) return bringBackWaves(), true; |
| @@ -1641,7 +1642,7 @@ export function dashboardScreen(f: Session, ctx: Ctx): Screen { | ||
| 1641 | 1642 | ctx.push(signInScreen(f, ctx, reload)); |
| 1642 | 1643 | return true; |
| 1643 | 1644 | } |
| 1644 | if (e.key === "r") { | |
| 1645 | if (e.key === keyOf("reread")) { | |
| 1645 | 1646 | runAsync(ctx, async () => reload()); |
| 1646 | 1647 | return true; |
| 1647 | 1648 | } |
src/tui/screens/decider.ts +3 −2
| @@ -6,6 +6,7 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | import type { Database } from "bun:sqlite"; |
| 9 | import { keyOf } from "../../web/keymap.ts"; | |
| 9 | 10 | import { returnsRepos } from "../../actions/returns.ts"; |
| 10 | 11 | import { startOfTodayUtc } from "../../crew/autonomy_spend.ts"; |
| 11 | 12 | import { |
| @@ -116,7 +117,7 @@ export function deciderScreen(f: Session, ctx: Ctx, first: DeciderPile = "closed | ||
| 116 | 117 | binding(["1", "2", "3"], "closed · deferred · asked"), |
| 117 | 118 | binding(["j", "k"], "move"), |
| 118 | 119 | binding(["enter"], "open"), |
| 119 | binding(["r"], "refresh"), | |
| 120 | binding([keyOf("reread")], "refresh"), | |
| 120 | 121 | ], |
| 121 | 122 | load: async () => read(), |
| 122 | 123 | render(area, s) { |
| @@ -137,7 +138,7 @@ export function deciderScreen(f: Session, ctx: Ctx, first: DeciderPile = "closed | ||
| 137 | 138 | if (Number.isInteger(i) && i >= 0 && i < DECIDER_PILES.length) return pick(DECIDER_PILES[i]!), true; |
| 138 | 139 | if (state.key(e, rows.length)) return true; |
| 139 | 140 | if (e.key === "enter") return open(state.index), true; |
| 140 | if (e.key === "r") return read(), ctx.invalidate(), true; | |
| 141 | if (e.key === keyOf("reread")) return read(), ctx.invalidate(), true; | |
| 141 | 142 | return false; |
| 142 | 143 | }, |
| 143 | 144 | }; |
src/tui/screens/deploys.ts +7 −6
| @@ -65,6 +65,7 @@ | ||
| 65 | 65 | */ |
| 66 | 66 | |
| 67 | 67 | import { appOnboardingLine } from "../../apps/onboarding.ts"; |
| 68 | import { keyOf } from "../../web/keymap.ts"; | |
| 68 | 69 | import { |
| 69 | 70 | appPace, |
| 70 | 71 | appPreviews, |
| @@ -417,7 +418,7 @@ export function deploysScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 417 | 418 | return [ |
| 418 | 419 | binding(["j", "k"], "move"), |
| 419 | 420 | binding(["enter"], inPreviews ? "open the pull" : "open the log"), |
| 420 | binding(["r"], "refresh (the open pulls below the deploys: check, preview)"), | |
| 421 | binding([keyOf("reread")], "refresh (the open pulls below the deploys: check, preview)"), | |
| 421 | 422 | ...(inPreviews |
| 422 | 423 | ? [ |
| 423 | 424 | ...(preview !== undefined ? [binding(["D"], "redeploy preview")] : []), |
| @@ -565,7 +566,7 @@ export function deploysScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 565 | 566 | if (run !== undefined) open(run); |
| 566 | 567 | return true; |
| 567 | 568 | } |
| 568 | if (e.key === "r") { | |
| 569 | if (e.key === keyOf("reread")) { | |
| 569 | 570 | read(); |
| 570 | 571 | return true; |
| 571 | 572 | } |
| @@ -704,7 +705,7 @@ function probeScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 704 | 705 | }; |
| 705 | 706 | return { |
| 706 | 707 | title: "Probe", |
| 707 | keys: [binding(["j", "k"], "move"), binding(["r"], "knock again"), binding(["esc"], "back")], | |
| 708 | keys: [binding(["j", "k"], "move"), binding([keyOf("reread")], "knock again"), binding(["esc"], "back")], | |
| 708 | 709 | load: async () => run(), |
| 709 | 710 | render(area, s) { |
| 710 | 711 | const c = ctx.theme.c; |
| @@ -736,7 +737,7 @@ function probeScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 736 | 737 | hitList(ctx, body!, state, list.length, {}); |
| 737 | 738 | }, |
| 738 | 739 | key(e) { |
| 739 | if (e.key === "r") { | |
| 740 | if (e.key === keyOf("reread")) { | |
| 740 | 741 | if (probing.kind !== "reading") void ctx.track(run()); |
| 741 | 742 | return true; |
| 742 | 743 | } |
| @@ -954,7 +955,7 @@ export function domainsScreen(f: Session, ctx: Ctx, repo: Repo, changed: () => v | ||
| 954 | 955 | binding(["v"], "put old records back"), |
| 955 | 956 | ] |
| 956 | 957 | : []), |
| 957 | binding(["r"], "refresh"), | |
| 958 | binding([keyOf("reread")], "refresh"), | |
| 958 | 959 | binding(["esc"], "back"), |
| 959 | 960 | ]; |
| 960 | 961 | }, |
| @@ -1021,7 +1022,7 @@ export function domainsScreen(f: Session, ctx: Ctx, repo: Repo, changed: () => v | ||
| 1021 | 1022 | revert(selected); |
| 1022 | 1023 | return true; |
| 1023 | 1024 | } |
| 1024 | if (e.key === "r") { | |
| 1025 | if (e.key === keyOf("reread")) { | |
| 1025 | 1026 | read(); |
| 1026 | 1027 | return true; |
| 1027 | 1028 | } |
src/tui/screens/drift.ts +3 −2
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | import { bringUpToDate } from "../../crew/conflict_release.ts"; |
| 11 | import { keyOf } from "../../web/keymap.ts"; | |
| 11 | 12 | import { driftingPulls, readDrifts, type DriftingPull } from "../../flow/alarm_drift.ts"; |
| 12 | 13 | import { getPull } from "../../core/pulls.ts"; |
| 13 | 14 | import { mayView } from "../../core/sealed.ts"; |
| @@ -56,7 +57,7 @@ export function driftScreen(f: Session, ctx: Ctx): Screen { | ||
| 56 | 57 | }; |
| 57 | 58 | return { |
| 58 | 59 | title: "Drifting from main", |
| 59 | keys: [binding(["j", "k"], "move"), binding(["b", "enter"], "bring up to date"), binding(["r"], "read again"), binding(["esc", "q"], "close")], | |
| 60 | keys: [binding(["j", "k"], "move"), binding(["b", "enter"], "bring up to date"), binding([keyOf("reread")], "read again"), binding(["esc", "q"], "close")], | |
| 60 | 61 | load: read, |
| 61 | 62 | render(area, s) { |
| 62 | 63 | if (loaded && pulls.length === 0) { |
| @@ -68,7 +69,7 @@ export function driftScreen(f: Session, ctx: Ctx): Screen { | ||
| 68 | 69 | key(e) { |
| 69 | 70 | if (e.key === "esc" || e.key === "q") ctx.pop(); |
| 70 | 71 | else if (e.key === "b" || e.key === "enter") ask(); |
| 71 | else if (e.key === "r") runAsync(ctx, read); | |
| 72 | else if (e.key === keyOf("reread")) runAsync(ctx, read); | |
| 72 | 73 | else state.key(e, pulls.length); |
| 73 | 74 | return true; |
| 74 | 75 | }, |
src/tui/screens/issue.ts +5 −4
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | import { outsideClause } from "../../web/outside.ts"; |
| 18 | import { keyOf } from "../../web/keymap.ts"; | |
| 18 | 19 | import { putFlowFirst } from "../../actions/flow_first.ts"; |
| 19 | 20 | import { FLOW_LABEL } from "../../core/flow_label.ts"; |
| 20 | 21 | import { |
| @@ -622,7 +623,7 @@ export function issueScreen( | ||
| 622 | 623 | ? binding(["enter"], "open the run") |
| 623 | 624 | : binding(["j", "k"], "scroll"), |
| 624 | 625 | ...(focus === "crew" && repo !== undefined && maySteer(f, repo, crew.selected) |
| 625 | ? [binding(["s"], "steer")] | |
| 626 | ? [binding([keyOf("wheel")], "take the wheel")] | |
| 626 | 627 | : []), |
| 627 | 628 | ...(mayWrite() |
| 628 | 629 | ? [ |
| @@ -651,7 +652,7 @@ export function issueScreen( | ||
| 651 | 652 | ...(mayEdit() ? [binding(["e"], "edit")] : []), |
| 652 | 653 | ...liveBindings(src), |
| 653 | 654 | ]), |
| 654 | binding(["r"], "refresh"), | |
| 655 | binding([keyOf("reread")], "refresh"), | |
| 655 | 656 | ]; |
| 656 | 657 | }, |
| 657 | 658 | load(signal) { |
| @@ -845,7 +846,7 @@ export function issueScreen( | ||
| 845 | 846 | openRun(); |
| 846 | 847 | return true; |
| 847 | 848 | } |
| 848 | if (e.key === "s") { | |
| 849 | if (e.key === keyOf("wheel")) { | |
| 849 | 850 | const run = crew.selected; |
| 850 | 851 | if (run !== undefined && repo !== undefined && maySteer(f, repo, run)) |
| 851 | 852 | steerPrompt(f, ctx, screen, repo, run, () => runAsync(ctx, reload)); |
| @@ -959,7 +960,7 @@ export function issueScreen( | ||
| 959 | 960 | privateRepo(); |
| 960 | 961 | return true; |
| 961 | 962 | } |
| 962 | if (e.key === "r") { | |
| 963 | if (e.key === keyOf("reread")) { | |
| 963 | 964 | runAsync(ctx, reload); |
| 964 | 965 | return true; |
| 965 | 966 | } |
src/tui/screens/issues.ts +3 −2
| @@ -10,6 +10,7 @@ | ||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | import { openIssueThrough } from "../../actions/issues.ts"; |
| 13 | import { keyOf } from "../../web/keymap.ts"; | |
| 13 | 14 | import type { IssueKind, Label } from "../../core/issues.ts"; |
| 14 | 15 | import { getIssuesByNumbers, numberKey } from "../../core/issues.ts"; |
| 15 | 16 | import { LATER, pillarsOf, servedBy, type Pillar } from "../../core/pillars.ts"; |
| @@ -276,7 +277,7 @@ export function issuesScreen( | ||
| 276 | 277 | ...(mayWrite() ? [binding(["c"], `new ${noun}`)] : []), |
| 277 | 278 | ...(kind === "issue" && repo !== undefined ? [binding(["m"], "plan"), binding(["h"], "held")] : []), |
| 278 | 279 | binding(["/"], "search"), |
| 279 | binding(["r"], "refresh"), | |
| 280 | binding([keyOf("reread")], "refresh"), | |
| 280 | 281 | ]; |
| 281 | 282 | }, |
| 282 | 283 | load(signal) { |
| @@ -444,7 +445,7 @@ export function issuesScreen( | ||
| 444 | 445 | ); |
| 445 | 446 | return true; |
| 446 | 447 | } |
| 447 | if (e.key === "r") { | |
| 448 | if (e.key === keyOf("reread")) { | |
| 448 | 449 | cursor = undefined; |
| 449 | 450 | counted.clear(); |
| 450 | 451 | runAsync(ctx, reload); |
src/tui/screens/plan.ts +3 −2
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { FIRST_FORBIDDEN, putIssueFirst } from "../../actions/first.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import { firstMarksInRepo } from "../../core/first.ts"; |
| 11 | 12 | import { repoGraph, readyNow } from "../../core/dependencies.ts"; |
| 12 | 13 | import { pillarView } from "../../core/pillars.ts"; |
| @@ -119,7 +120,7 @@ export function planScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 119 | 120 | }; |
| 120 | 121 | return { |
| 121 | 122 | title: "Plan", |
| 122 | keys: [binding(["j", "k"], "move"), binding(["enter"], "open"), binding(["f"], "first"), binding(["r"], "refresh")], | |
| 123 | keys: [binding(["j", "k"], "move"), binding(["enter"], "open"), binding(["f"], "first"), binding([keyOf("reread")], "refresh")], | |
| 123 | 124 | load(signal) { |
| 124 | 125 | live(f, signal, { repoId: repo.id }, () => runAsync(ctx, async () => reload())); |
| 125 | 126 | reload(); |
| @@ -157,7 +158,7 @@ export function planScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 157 | 158 | } |
| 158 | 159 | return true; |
| 159 | 160 | } |
| 160 | if (e.key === "r") { | |
| 161 | if (e.key === keyOf("reread")) { | |
| 161 | 162 | reload(); |
| 162 | 163 | return true; |
| 163 | 164 | } |
src/tui/screens/pricing.ts +11 −6
| @@ -10,6 +10,7 @@ | ||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | import { deliverLink, mayView, NO_PROVIDER, placeOrder, reconcileOrder } from "../../actions/order.ts"; |
| 13 | import { keyOf } from "../../web/keymap.ts"; | |
| 13 | 14 | import { usdPerMonthWords } from "../../billing/money.ts"; |
| 14 | 15 | import { AFTER_PAYMENT_STEPS, priceLine } from "../../billing/plan_words.ts"; |
| 15 | 16 | import { receiptFacts } from "../../billing/receipt.ts"; |
| @@ -85,7 +86,7 @@ export function pricingScreen(f: Session, ctx: Ctx): Screen { | ||
| 85 | 86 | error = `${placed.error.field === "form" ? "" : `${placed.error.field}: `}${placed.error.message}`; |
| 86 | 87 | return; |
| 87 | 88 | } |
| 88 | stage = { kind: "placed", id: placed.value.id, ticket: placed.value.ticket, address: placed.value.redirect, name: name.trim(), says: "Open the address and pay; then press r." }; | |
| 89 | stage = { kind: "placed", id: placed.value.id, ticket: placed.value.ticket, address: placed.value.redirect, name: name.trim(), says: "Open the address and pay; then press R or Enter." }; | |
| 89 | 90 | }); |
| 90 | 91 | }; |
| 91 | 92 | |
| @@ -105,9 +106,9 @@ export function pricingScreen(f: Session, ctx: Ctx): Screen { | ||
| 105 | 106 | error = "That order is gone. Place it again."; |
| 106 | 107 | return; |
| 107 | 108 | } |
| 108 | if (o.state === "pending") s.says = "Not paid yet. Open the address, pay, then press r."; | |
| 109 | else if (o.state === "paid" || o.state === "spawning") s.says = `Paid. Making ${o.name}; press r again in a moment.`; | |
| 110 | else if (o.state === "making") s.says = `Paid. ${o.name} is starting on its own machine, which takes a few minutes; press r again once it answers.`; | |
| 109 | if (o.state === "pending") s.says = "Not paid yet. Open the address, pay, then press R or Enter."; | |
| 110 | else if (o.state === "paid" || o.state === "spawning") s.says = `Paid. Making ${o.name}; press R again in a moment.`; | |
| 111 | else if (o.state === "making") s.says = `Paid. ${o.name} is starting on its own machine, which takes a few minutes; press R again once it answers.`; | |
| 111 | 112 | else if (o.state === "failed") stage = { kind: "done", name: o.name, says: `Paid, but the forge could not be made: ${o.reason}. The operator has been told; keep the order id ${o.id}.` }; |
| 112 | 113 | else { |
| 113 | 114 | const r = receiptFacts(o, getPlans(f.app.db).find((p) => p.key === o.plan)?.name); |
| @@ -128,7 +129,11 @@ export function pricingScreen(f: Session, ctx: Ctx): Screen { | ||
| 128 | 129 | |
| 129 | 130 | return { |
| 130 | 131 | title: "Get a forge", |
| 131 | keys: [binding(["enter"], "order"), binding(["tab"], "next field"), binding(["up", "down"], "plan"), binding(["esc"], "back")], | |
| 132 | get keys() { | |
| 133 | return stage.kind === "placed" | |
| 134 | ? [binding(["enter", keyOf("reread")], "check the payment"), binding(["c"], "copy the address"), binding(["esc"], "back")] | |
| 135 | : [binding(["enter"], "order"), binding(["tab"], "next field"), binding(["up", "down"], "plan"), binding(["esc"], "back")]; | |
| 136 | }, | |
| 132 | 137 | render(area, s) { |
| 133 | 138 | const c = ctx.theme.c; |
| 134 | 139 | const w = Math.max(20, area.w); |
| @@ -192,7 +197,7 @@ export function pricingScreen(f: Session, ctx: Ctx): Screen { | ||
| 192 | 197 | return true; |
| 193 | 198 | } |
| 194 | 199 | if (stage.kind === "placed") { |
| 195 | if (e.key === "r" || e.key === "enter") check(); | |
| 200 | if (e.key === keyOf("reread") || e.key === "enter") check(); | |
| 196 | 201 | else if (e.key === "c") { |
| 197 | 202 | ctx.copy(stage.address); |
| 198 | 203 | ctx.toast("copied through the terminal", "success"); |
src/tui/screens/prompts.ts +3 −2
| @@ -15,6 +15,7 @@ import { | ||
| 15 | 15 | runPromptSource, |
| 16 | 16 | type PromptSourceView, |
| 17 | 17 | } from "../../actions/prompts.ts"; |
| 18 | import { keyOf } from "../../web/keymap.ts"; | |
| 18 | 19 | import { REFRESH_AFTER_DAYS } from "../../crew/prompts.ts"; |
| 19 | 20 | import type { Repo } from "../../core/repos.ts"; |
| 20 | 21 | import type { Ctx, Screen } from "../app/app.ts"; |
| @@ -155,7 +156,7 @@ export function promptsScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 155 | 156 | binding(["j", "k"], "move"), |
| 156 | 157 | ...(sources.length === 0 ? [binding(["a"], "connect Instagram")] : []), |
| 157 | 158 | ...(sources.length > 0 ? [binding(["f"], "fetch now"), binding(["d"], "remove it")] : []), |
| 158 | binding(["r"], "refresh"), | |
| 159 | binding([keyOf("reread")], "refresh"), | |
| 159 | 160 | binding(["esc"], "back"), |
| 160 | 161 | ]; |
| 161 | 162 | }, |
| @@ -188,7 +189,7 @@ export function promptsScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 188 | 189 | if (e.key === "a" && sources.length === 0) add(); |
| 189 | 190 | else if (e.key === "f" && selected !== undefined) fetchNow(selected); |
| 190 | 191 | else if (e.key === "d" && selected !== undefined) remove(selected); |
| 191 | else if (e.key === "r") read(); | |
| 192 | else if (e.key === keyOf("reread")) read(); | |
| 192 | 193 | else return false; |
| 193 | 194 | return true; |
| 194 | 195 | }, |
src/tui/screens/pull.ts +8 −7
| @@ -27,6 +27,7 @@ | ||
| 27 | 27 | */ |
| 28 | 28 | |
| 29 | 29 | import { OFFER_PULL_WORDS, offerPull, previewOfferPull } from "../../actions/offer_pull.ts"; |
| 30 | import { keyOf } from "../../web/keymap.ts"; | |
| 30 | 31 | import { offerStatusLinkFor } from "../../core/outsider_status.ts"; |
| 31 | 32 | import { outsideClause } from "../../web/outside.ts"; |
| 32 | 33 | import { mayRetryReview, RETRY_WORDS, reviewFailedToStart } from "../../web/studio/review_start.ts"; |
| @@ -1255,7 +1256,7 @@ export function pullScreen( | ||
| 1255 | 1256 | binding(["j", "k"], "move"), |
| 1256 | 1257 | binding(["enter"], "open the run"), |
| 1257 | 1258 | ...(repo !== undefined && maySteer(f, repo, crew.selected) |
| 1258 | ? [binding(["s"], "steer")] | |
| 1259 | ? [binding([keyOf("wheel")], "take the wheel")] | |
| 1259 | 1260 | : []), |
| 1260 | 1261 | ] |
| 1261 | 1262 | : [binding(["j", "k"], "scroll")]), |
| @@ -1272,7 +1273,7 @@ export function pullScreen( | ||
| 1272 | 1273 | ...(mayWrite() |
| 1273 | 1274 | ? [ |
| 1274 | 1275 | binding(["c"], tab === 1 ? "review line" : "comment"), |
| 1275 | binding(["R"], "review"), | |
| 1276 | binding(["b"], "review"), | |
| 1276 | 1277 | binding(["C"], "check again"), |
| 1277 | 1278 | ...(getPull(f.db, repo!.id, number)?.authorIsAgent === false ? [binding(["K"], "ask for review")] : []), |
| 1278 | 1279 | ...(mayVote() ? [binding(["+", "-"], "like/dislike a variant")] : []), |
| @@ -1314,10 +1315,10 @@ export function pullScreen( | ||
| 1314 | 1315 | : [ |
| 1315 | 1316 | ...liveBindings(src), |
| 1316 | 1317 | ...(mayJudge() |
| 1317 | ? [binding(["R"], "review"), binding(["m"], reviewWords.reviewerLands, { disabled: true })] | |
| 1318 | ? [binding(["b"], "review"), binding(["m"], reviewWords.reviewerLands, { disabled: true })] | |
| 1318 | 1319 | : []), |
| 1319 | 1320 | ]), |
| 1320 | binding(["r"], "refresh"), | |
| 1321 | binding([keyOf("reread")], "refresh"), | |
| 1321 | 1322 | ...(isApp ? [binding(["V"], "walk the review steps")] : []), |
| 1322 | 1323 | ...(isApp && mayWrite() ? [binding(["E"], "set the review steps")] : []), |
| 1323 | 1324 | ]; |
| @@ -1553,7 +1554,7 @@ export function pullScreen( | ||
| 1553 | 1554 | landPast(); |
| 1554 | 1555 | return true; |
| 1555 | 1556 | } |
| 1556 | if (e.key === "R" && (mayWrite() || mayJudge())) { | |
| 1557 | if (e.key === "b" && (mayWrite() || mayJudge())) { | |
| 1557 | 1558 | review(); |
| 1558 | 1559 | return true; |
| 1559 | 1560 | } |
| @@ -1687,7 +1688,7 @@ export function pullScreen( | ||
| 1687 | 1688 | openRunLog(f, ctx, repo, run); |
| 1688 | 1689 | return true; |
| 1689 | 1690 | } |
| 1690 | if (e.key === "s") { | |
| 1691 | if (e.key === keyOf("wheel")) { | |
| 1691 | 1692 | const run = crew.selected; |
| 1692 | 1693 | if (run !== undefined && repo !== undefined && maySteer(f, repo, run)) |
| 1693 | 1694 | steerPrompt(f, ctx, screen, repo, run, () => runAsync(ctx, reload)); |
| @@ -1868,7 +1869,7 @@ export function pullScreen( | ||
| 1868 | 1869 | }); |
| 1869 | 1870 | return true; |
| 1870 | 1871 | } |
| 1871 | if (e.key === "r") { | |
| 1872 | if (e.key === keyOf("reread")) { | |
| 1872 | 1873 | runAsync(ctx, reload); |
| 1873 | 1874 | return true; |
| 1874 | 1875 | } |
src/tui/screens/refs.ts +3 −2
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { createBranchSaying, deleteBranch } from "../../actions/branches.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import { NAME_THE_BRANCH } from "../../actions/branch_words.ts"; |
| 11 | 12 | import { listBranches } from "../../git/branches.ts"; |
| 12 | 13 | import type { RepoSource } from "../../view/source.ts"; |
| @@ -282,7 +283,7 @@ export function branchesScreen( | ||
| 282 | 283 | binding(["n"], "new branch", { disabled: !writable }), |
| 283 | 284 | binding(["D"], "delete", { disabled: !writable }), |
| 284 | 285 | binding(["/"], "filter"), |
| 285 | binding(["r"], "refresh"), | |
| 286 | binding([keyOf("reread")], "refresh"), | |
| 286 | 287 | ]; |
| 287 | 288 | }, |
| 288 | 289 | load: reload, |
| @@ -379,7 +380,7 @@ export function branchesScreen( | ||
| 379 | 380 | remove(row); |
| 380 | 381 | return true; |
| 381 | 382 | } |
| 382 | if (e.key === "r") { | |
| 383 | if (e.key === keyOf("reread")) { | |
| 383 | 384 | runAsync(ctx, reload); |
| 384 | 385 | return true; |
| 385 | 386 | } |
src/tui/screens/runlog.ts +3 −2
| @@ -8,6 +8,7 @@ | ||
| 8 | 8 | */ |
| 9 | 9 | |
| 10 | 10 | import { runLog, type RunLogView } from "../../actions/runs.ts"; |
| 11 | import { keyOf } from "../../web/keymap.ts"; | |
| 11 | 12 | import type { Repo } from "../../core/repos.ts"; |
| 12 | 13 | import type { Ctx, Screen } from "../app/app.ts"; |
| 13 | 14 | import { binding } from "../app/keys.ts"; |
| @@ -77,7 +78,7 @@ export function runLogScreen( | ||
| 77 | 78 | binding(["pgup", "pgdn"], "page"), |
| 78 | 79 | binding(["g", "G"], "top, end"), |
| 79 | 80 | binding(["o"], "open on the web"), |
| 80 | binding(["r"], "refresh"), | |
| 81 | binding([keyOf("reread")], "refresh"), | |
| 81 | 82 | ...(offer() ? [binding(["a"], "start now on your own account")] : []), |
| 82 | 83 | ]; |
| 83 | 84 | }, |
| @@ -220,7 +221,7 @@ export function runLogScreen( | ||
| 220 | 221 | web(); |
| 221 | 222 | return true; |
| 222 | 223 | } |
| 223 | if (e.key === "r" && !e.ctrl && !e.alt) { | |
| 224 | if (e.key === keyOf("reread") && !e.ctrl && !e.alt) { | |
| 224 | 225 | void read(); |
| 225 | 226 | return true; |
| 226 | 227 | } |
src/tui/screens/runs.ts +20 −11
| @@ -9,6 +9,7 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | import { cancelRepoRun, listRepoRuns, requeueRepoRun } from "../../actions/runs.ts"; |
| 12 | import { keyOf, oldKeys } from "../../web/keymap.ts"; | |
| 12 | 13 | import { lacks } from "../../core/roles.ts"; |
| 13 | 14 | import { canWrite, type Repo } from "../../core/repos.ts"; |
| 14 | 15 | import { taskOf } from "../../crew/dispatch.ts"; |
| @@ -131,13 +132,15 @@ export function runsScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 131 | 132 | here: () => ({ repo }), |
| 132 | 133 | get keys() { |
| 133 | 134 | return [ |
| 134 | binding(["j", "k"], "move"), | |
| 135 | // The forge's one keymap (web/keymap.ts): s stops, r queues again and i takes the wheel, as | |
| 136 | // on the web; / filters and R refreshes, as on every terminal screen. | |
| 137 | binding([keyOf("down"), keyOf("up")], "move"), | |
| 135 | 138 | binding(["enter"], "open the log"), |
| 136 | ...(cancellable() === undefined ? [] : [binding(["x"], "cancel")]), | |
| 137 | ...(maySteer(f, repo, list.selected) ? [binding(["S"], "steer")] : []), | |
| 138 | ...(requeueable() === undefined ? [] : [binding(["a"], "run again")]), | |
| 139 | binding(["s"], "state: All, Failed, Running, Succeeded (cycle)"), | |
| 140 | binding(["r"], "refresh"), | |
| 139 | ...(cancellable() === undefined ? [] : [binding([keyOf("stop")], "stop")]), | |
| 140 | ...(maySteer(f, repo, list.selected) ? [binding([keyOf("wheel")], "take the wheel")] : []), | |
| 141 | ...(requeueable() === undefined ? [] : [binding([keyOf("requeue")], "queue it again")]), | |
| 142 | binding([keyOf("search")], "state: All, Failed, Running, Succeeded (cycle)"), | |
| 143 | binding([keyOf("reread")], "refresh"), | |
| 141 | 144 | ]; |
| 142 | 145 | }, |
| 143 | 146 | load: async () => read(), |
| @@ -171,26 +174,32 @@ export function runsScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 171 | 174 | if (run !== undefined) open(run); |
| 172 | 175 | return true; |
| 173 | 176 | } |
| 174 | if (e.key === "x") { | |
| 177 | // A key that moved says where it went, for two weeks (keymap.ts OLD_KEYS). | |
| 178 | const moved = oldKeys("runs").find((o) => o.was === e.key); | |
| 179 | if (moved !== undefined) { | |
| 180 | ctx.toast(moved.says); | |
| 181 | return true; | |
| 182 | } | |
| 183 | if (e.key === keyOf("stop")) { | |
| 175 | 184 | ask(); |
| 176 | 185 | return true; |
| 177 | 186 | } |
| 178 | if (e.key === "S") { | |
| 187 | if (e.key === keyOf("wheel")) { | |
| 179 | 188 | const run = list.selected; |
| 180 | 189 | if (run !== undefined && maySteer(f, repo, run)) |
| 181 | 190 | steerPrompt(f, ctx, self, repo, run, read); |
| 182 | 191 | return true; |
| 183 | 192 | } |
| 184 | if (e.key === "a") { | |
| 193 | if (e.key === keyOf("requeue")) { | |
| 185 | 194 | askRequeue(); |
| 186 | 195 | return true; |
| 187 | 196 | } |
| 188 | if (e.key === "s") { | |
| 197 | if (e.key === keyOf("search")) { | |
| 189 | 198 | at = (at + 1) % RUN_STATE_CYCLE.length; |
| 190 | 199 | read(); |
| 191 | 200 | return true; |
| 192 | 201 | } |
| 193 | if (e.key === "r") { | |
| 202 | if (e.key === keyOf("reread")) { | |
| 194 | 203 | read(); |
| 195 | 204 | return true; |
| 196 | 205 | } |
src/tui/screens/shells.ts +3 −2
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { NO_SUCH_SHELL, STOPPED_ONE, myShells, stopIdleShells, stopShell, stoppedIdleSays, type ShellRow } from "../../machines/shell.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import type { Ctx, Screen } from "../app/app.ts"; |
| 11 | 12 | import { binding } from "../app/keys.ts"; |
| 12 | 13 | import { style } from "../term/style.ts"; |
| @@ -29,7 +30,7 @@ export function shellsScreen(f: Session, ctx: Ctx): Screen { | ||
| 29 | 30 | let sel = 0; |
| 30 | 31 | return { |
| 31 | 32 | title: "Your shells", |
| 32 | keys: [binding(["j", "k"], "pick"), binding(["s"], "stop"), binding(["i"], "stop all idle"), binding(["r"], "read again"), binding(["esc"], "close")], | |
| 33 | keys: [binding(["j", "k"], "pick"), binding(["s"], "stop"), binding(["i"], "stop all idle"), binding([keyOf("reread")], "read again"), binding(["esc"], "close")], | |
| 33 | 34 | render(area, s) { |
| 34 | 35 | const c = ctx.theme.c; |
| 35 | 36 | if (rows.length === 0) { |
| @@ -42,7 +43,7 @@ export function shellsScreen(f: Session, ctx: Ctx): Screen { | ||
| 42 | 43 | }, |
| 43 | 44 | key(e) { |
| 44 | 45 | if (e.ctrl || e.alt) return false; |
| 45 | if (e.key === "r") { | |
| 46 | if (e.key === keyOf("reread")) { | |
| 46 | 47 | rows = read(); |
| 47 | 48 | sel = Math.min(sel, Math.max(0, rows.length - 1)); |
| 48 | 49 | return true; |
src/tui/screens/talk_build.ts +4 −3
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { buildSaidWords, buildState, BUILD_WORDS, publishBuild, publishedWords, restoreVersion, startBuild, versionDiff, type BuildState } from "../../actions/build.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import { offeredTemplates } from "../../core/app_templates.ts"; |
| 11 | 12 | import { buildsOf } from "../../core/chat_build.ts"; |
| 12 | 13 | import { getRepoById } from "../../core/repos.ts"; |
| @@ -73,7 +74,7 @@ function buildScreen(f: Session, ctx: Ctx, conversationId: string, title: string | ||
| 73 | 74 | const versions = () => [...(current?.versions ?? [])].reverse(); |
| 74 | 75 | const screen: Screen = { |
| 75 | 76 | title, |
| 76 | keys: [binding(["j", "k"], "move"), binding(["enter"], "files changed"), binding(["R"], "restore"), binding(["P"], "publish"), binding(["r"], "reload"), binding(["esc"], "back")], | |
| 77 | keys: [binding(["j", "k"], "move"), binding(["enter"], "files changed"), binding(["U"], "restore"), binding(["P"], "publish"), binding([keyOf("reread")], "reload"), binding(["esc"], "back")], | |
| 77 | 78 | render(area, s) { |
| 78 | 79 | const c = ctx.theme.c; |
| 79 | 80 | const [head, body] = split(area, "v", [len(2), fill(1)]); |
| @@ -91,7 +92,7 @@ function buildScreen(f: Session, ctx: Ctx, conversationId: string, title: string | ||
| 91 | 92 | ctx.pop(); |
| 92 | 93 | return true; |
| 93 | 94 | } |
| 94 | if (e.key === "r") { | |
| 95 | if (e.key === keyOf("reread")) { | |
| 95 | 96 | load(); |
| 96 | 97 | return true; |
| 97 | 98 | } |
| @@ -100,7 +101,7 @@ function buildScreen(f: Session, ctx: Ctx, conversationId: string, title: string | ||
| 100 | 101 | ctx.push(diffScreen(f, ctx, conversationId, at.number, at.subject)); |
| 101 | 102 | return true; |
| 102 | 103 | } |
| 103 | if (e.key === "R" && at !== undefined && current?.published === false) { | |
| 104 | if (e.key === "U" && at !== undefined && current?.published === false) { | |
| 104 | 105 | ctx.push( |
| 105 | 106 | confirmScreen(ctx, screen, { |
| 106 | 107 | title: "Restore", |
src/tui/screens/talk_chats.ts +3 −2
| @@ -10,6 +10,7 @@ | ||
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | 12 | import { receiptsScreen } from "./receipts.ts"; |
| 13 | import { keyOf } from "../../web/keymap.ts"; | |
| 13 | 14 | import { conversationPlan, openSteps } from "../../core/conversation_plan.ts"; |
| 14 | 15 | import { pathRefs, refTarget } from "../../text/talk_links.ts"; |
| 15 | 16 | import { STARTER_PROMPTS, TALK_WORDS, talk } from "../../actions/talk.ts"; |
| @@ -362,7 +363,7 @@ function chatScreen(f: Session, ctx: Ctx, chat: Conversation, hit?: string): Scr | ||
| 362 | 363 | binding(["s"], "say"), |
| 363 | 364 | binding(["m"], "model"), |
| 364 | 365 | binding(["1", "2", "3"], "starter"), |
| 365 | binding(["r"], "reload"), | |
| 366 | binding([keyOf("reread")], "reload"), | |
| 366 | 367 | binding(["p"], "pane"), |
| 367 | 368 | binding(["o", "w", "l", "L"], "in the pane: repository, version, path, Live"), |
| 368 | 369 | binding(["b"], "a result's buttons"), |
| @@ -525,7 +526,7 @@ function chatScreen(f: Session, ctx: Ctx, chat: Conversation, hit?: string): Scr | ||
| 525 | 526 | ctx.pop(); |
| 526 | 527 | return true; |
| 527 | 528 | } |
| 528 | if (e.key === "r") { | |
| 529 | if (e.key === keyOf("reread")) { | |
| 529 | 530 | note = ""; |
| 530 | 531 | follow = true; |
| 531 | 532 | around = undefined; |
src/tui/screens/thoughtnotes.ts +3 −2
| @@ -9,6 +9,7 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | import { overruleNote } from "../../actions/note_overrule.ts"; |
| 12 | import { keyOf } from "../../web/keymap.ts"; | |
| 12 | 13 | import { keepThought, THOUGHT_MAX } from "../../actions/thought.ts"; |
| 13 | 14 | import { noteLine, type NotePhase } from "../../core/note_line.ts"; |
| 14 | 15 | import { thoughtStream } from "../../core/thought_stream.ts"; |
| @@ -91,7 +92,7 @@ export function notesScreen(f: Session, ctx: Ctx): Screen { | ||
| 91 | 92 | get keys() { |
| 92 | 93 | return typing |
| 93 | 94 | ? [binding(["enter"], "save"), binding(["esc"], "cancel")] |
| 94 | : [binding(["j", "k"], "move"), binding(["n"], "write a note"), binding(["b"], "overrule the planner"), binding(["r"], "refresh")]; | |
| 95 | : [binding(["j", "k"], "move"), binding(["n"], "write a note"), binding(["b"], "overrule the planner"), binding([keyOf("reread")], "refresh")]; | |
| 95 | 96 | }, |
| 96 | 97 | load: async () => read(), |
| 97 | 98 | render(area, s) { |
| @@ -119,7 +120,7 @@ export function notesScreen(f: Session, ctx: Ctx): Screen { | ||
| 119 | 120 | if (state.key(e, rows.length)) return true; |
| 120 | 121 | if (e.key === "n") typing = true; |
| 121 | 122 | else if (e.key === "b") overrule(); |
| 122 | else if (e.key === "r") read(); | |
| 123 | else if (e.key === keyOf("reread")) read(); | |
| 123 | 124 | else return false; |
| 124 | 125 | ctx.invalidate(); |
| 125 | 126 | return true; |
src/tui/screens/waves.ts +3 −2
| @@ -6,6 +6,7 @@ | ||
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | 8 | import { cutWaveFor, planCutFor } from "../../actions/cut_wave.ts"; |
| 9 | import { keyOf } from "../../web/keymap.ts"; | |
| 9 | 10 | import { canRead, getRepo } from "../../core/repos.ts"; |
| 10 | 11 | import { mayDirectCrew } from "../../crew/direct.ts"; |
| 11 | 12 | import { nearMilestones, standingLine } from "../../web/pages/milestones_near.ts"; |
| @@ -353,7 +354,7 @@ export function wavesScreen(f: Session, ctx: Ctx, src: RepoSource): Screen { | ||
| 353 | 354 | binding(["c"], "cut a wave"), |
| 354 | 355 | ...(apps.length > 0 ? [binding(["a"], "filter by app")] : []), |
| 355 | 356 | ...(askable() ? [binding(["t"], "tell the crew to write the first wave")] : []), |
| 356 | binding(["r"], "refresh"), | |
| 357 | binding([keyOf("reread")], "refresh"), | |
| 357 | 358 | ]; |
| 358 | 359 | }, |
| 359 | 360 | load: reload, |
| @@ -405,7 +406,7 @@ export function wavesScreen(f: Session, ctx: Ctx, src: RepoSource): Screen { | ||
| 405 | 406 | openAt(state.index); |
| 406 | 407 | return true; |
| 407 | 408 | } |
| 408 | if (e.key === "r") { | |
| 409 | if (e.key === keyOf("reread")) { | |
| 409 | 410 | runAsync(ctx, reload); |
| 410 | 411 | return true; |
| 411 | 412 | } |
src/tui/screens/wayback.ts +3 −2
| @@ -7,6 +7,7 @@ | ||
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | 9 | import { mintWayBack, wayBackAccounts, type Stranded } from "../../actions/edge_handover.ts"; |
| 10 | import { keyOf } from "../../web/keymap.ts"; | |
| 10 | 11 | import type { Ctx, Screen } from "../app/app.ts"; |
| 11 | 12 | import { binding } from "../app/keys.ts"; |
| 12 | 13 | import { style } from "../term/style.ts"; |
| @@ -50,7 +51,7 @@ export function wayBackScreen(f: Session, ctx: Ctx): Screen { | ||
| 50 | 51 | }; |
| 51 | 52 | return { |
| 52 | 53 | title: "Way-back links", |
| 53 | keys: [binding(["j", "k"], "move cursor"), binding(["enter"], "make the link"), binding(["r"], "refresh")], | |
| 54 | keys: [binding(["j", "k"], "move cursor"), binding(["enter"], "make the link"), binding([keyOf("reread")], "refresh")], | |
| 54 | 55 | render(area, s) { |
| 55 | 56 | const c = ctx.theme.c; |
| 56 | 57 | const [head, list] = split(area, "v", [len(1), fill(1)]); |
| @@ -71,7 +72,7 @@ export function wayBackScreen(f: Session, ctx: Ctx): Screen { | ||
| 71 | 72 | if (allowed) mint(); |
| 72 | 73 | return true; |
| 73 | 74 | } |
| 74 | if (e.key === "r") { | |
| 75 | if (e.key === keyOf("reread")) { | |
| 75 | 76 | note = ""; |
| 76 | 77 | read(); |
| 77 | 78 | return true; |
src/tui/screens/workspace.ts +6 −5
| @@ -35,6 +35,7 @@ | ||
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | 37 | import { cannotChangeWords } from "../../actions/edit_words.ts"; |
| 38 | import { keyOf } from "../../web/keymap.ts"; | |
| 38 | 39 | import { editFiles, fileAt } from "../../actions/contents.ts"; |
| 39 | 40 | import { proposeEdit, proposeEditText } from "../../actions/propose_edit.ts"; |
| 40 | 41 | import { schemaRefusal } from "../../web/render/json-schema.ts"; |
| @@ -2521,7 +2522,7 @@ export function workspaceScreen( | ||
| 2521 | 2522 | ? [binding(["a"], "your issues and the crew's answers")] |
| 2522 | 2523 | : []), |
| 2523 | 2524 | ...(repo !== undefined && admin() |
| 2524 | ? [binding(["R"], `decisions by ${(getRepoById(f.db, repo.id) ?? repo).decisionsBy} (cycle)`)] | |
| 2525 | ? [binding(["A"], `decisions by ${(getRepoById(f.db, repo.id) ?? repo).decisionsBy} (cycle)`)] | |
| 2525 | 2526 | : []), |
| 2526 | 2527 | ...liveBindings(src), |
| 2527 | 2528 | ...(liveSide?.mirroredAs === undefined |
| @@ -2559,7 +2560,7 @@ export function workspaceScreen( | ||
| 2559 | 2560 | getMirrorTarget(f.db, repo.id) !== undefined |
| 2560 | 2561 | ? [binding(["U"], "stop mirroring to the source")] |
| 2561 | 2562 | : []), |
| 2562 | binding(["r"], "refresh"), | |
| 2563 | binding([keyOf("reread")], "refresh"), | |
| 2563 | 2564 | binding( |
| 2564 | 2565 | ["E"], |
| 2565 | 2566 | hasExternalEditor() ? "open $FORGE_EDITOR" : "external editor", |
| @@ -2990,7 +2991,7 @@ export function workspaceScreen( | ||
| 2990 | 2991 | ); |
| 2991 | 2992 | return true; |
| 2992 | 2993 | } |
| 2993 | if (plain && e.key === "R" && repo !== undefined && admin()) { | |
| 2994 | if (plain && e.key === "A" && repo !== undefined && admin()) { | |
| 2994 | 2995 | // `repo` was read when the screen opened; the rule is read afresh. |
| 2995 | 2996 | const target = getRepoById(f.db, repo.id) ?? repo; |
| 2996 | 2997 | const next = |
| @@ -3006,7 +3007,7 @@ export function workspaceScreen( | ||
| 3006 | 3007 | }); |
| 3007 | 3008 | return true; |
| 3008 | 3009 | } |
| 3009 | if (plain && e.key === "r") { | |
| 3010 | if (plain && e.key === keyOf("reread")) { | |
| 3010 | 3011 | cache.clear(); |
| 3011 | 3012 | runAsync(ctx, reload); |
| 3012 | 3013 | return true; |
| @@ -3221,7 +3222,7 @@ export function workspaceScreen( | ||
| 3221 | 3222 | commit(); |
| 3222 | 3223 | return true; |
| 3223 | 3224 | } |
| 3224 | if (e.ctrl && (e.key === "f" || e.key === "r")) { | |
| 3225 | if (e.ctrl && (e.key === "f" || e.key === keyOf("reread"))) { | |
| 3225 | 3226 | t.find = e.key === "f" ? "find" : "replace"; |
| 3226 | 3227 | t.replaceField = "find"; |
| 3227 | 3228 | t.needle = ""; |
src/web/keymap.ts +16 −18
| @@ -43,7 +43,9 @@ export const MOVES = { | ||
| 43 | 43 | right: { key: "l", label: "Right", what: "Move to the column or tab on the right", kinds: any }, |
| 44 | 44 | open: { key: "Enter", label: "Open", what: "Open the focused row (o does too)", kinds: any }, |
| 45 | 45 | back: { key: "Escape", label: "Close", what: "Close what is on top, then clear the selection, then back out to the list", kinds: any }, |
| 46 | search: { key: "/", label: "Search", what: "Focus search", kinds: any }, | |
| 46 | search: { key: "/", label: "Search", what: "Search, or filter the list (a terminal list's filter too)", kinds: any }, | |
| 47 | // Read again: the terminal's refresh, named for what it does (a page is live and needs none). | |
| 48 | reread: { key: "R", label: "Refresh", what: "Read the screen again (the terminal; a page is live)", kinds: any }, | |
| 47 | 49 | help: { key: "?", label: "Help", what: "List the keys this page answers", kinds: any }, |
| 48 | 50 | palette: { key: "Mod+k", label: "Jump", what: "Jump to anywhere, or act on what is focused", kinds: any }, |
| 49 | 51 | goto: { key: ":", label: "Go to", what: "Go to a page by name", kinds: any }, |
| @@ -64,33 +66,21 @@ export const VERBS = { | ||
| 64 | 66 | assign: { key: "a", label: "Assign", what: "Give it to someone", kinds: ["issue"] }, |
| 65 | 67 | sharpen: { key: "e", label: "Sharpen", what: "Have the planner plan it again", kinds: ["issue"] }, |
| 66 | 68 | park: { key: "p", label: "Park", what: "Park it behind the Later gate", kinds: ["issue"] }, |
| 67 | stop: { | |
| 68 | key: "s", | |
| 69 | label: "Stop", | |
| 70 | what: "Stop the run", | |
| 71 | kinds: ["run"], | |
| 72 | terminal: { key: "x", reason: "the terminal's run list cycles its state filter on s; it moves to s with the runs pull" }, | |
| 73 | }, | |
| 69 | stop: { key: "s", label: "Stop", what: "Stop the run", kinds: ["run"] }, | |
| 74 | 70 | requeue: { |
| 75 | 71 | key: "r", |
| 76 | 72 | label: "Queue it again", |
| 77 | 73 | what: "Queue a stopped run again", |
| 78 | 74 | kinds: ["run"], |
| 79 | terminal: { key: "a", reason: "the terminal's run list refreshes on r; it moves to r with the runs pull" }, | |
| 80 | 75 | }, |
| 81 | 76 | watch: { key: "w", label: "Watch live", what: "Watch the run live", kinds: ["run"] }, |
| 82 | wheel: { | |
| 83 | key: "i", | |
| 84 | label: "Take the wheel", | |
| 85 | what: "Take the wheel: steer the running agent", | |
| 86 | kinds: ["run"], | |
| 87 | terminal: { key: "S", reason: "the terminal's run list steers on S; it moves to i with the runs pull" }, | |
| 88 | }, | |
| 77 | wheel: { key: "i", label: "Take the wheel", what: "Take the wheel: steer the running agent", kinds: ["run"] }, | |
| 89 | 78 | fewer: { key: "-", label: "Fewer", what: "Turn the figure down", kinds: ["figure"] }, |
| 90 | 79 | more: { key: "+", label: "More", what: "Turn the figure up", kinds: ["figure"] }, |
| 91 | 80 | set: { key: "Enter", label: "Set", what: "Set the figure to what it shows", kinds: ["figure"] }, |
| 92 | 81 | undo: { key: "z", label: "Undo", what: "Put back what was just done", kinds: ["any"] }, |
| 93 | 82 | edit: { key: "e", label: "Propose a change", what: "Propose a change to the file", kinds: ["file"] }, |
| 83 | find: { key: "f", label: "Go to file", what: "Find a file by name", kinds: ["file"] }, | |
| 94 | 84 | } as const satisfies Record<string, KeyDef>; |
| 95 | 85 | |
| 96 | 86 | /** |
| @@ -117,8 +107,11 @@ export const REPO_TABS = { | ||
| 117 | 107 | */ |
| 118 | 108 | export const OLD_KEYS_UNTIL = "2026-12-15T00:00:00Z"; |
| 119 | 109 | export interface OldKey { |
| 120 | /** Where it was: "pull" for the Files page's verdicts, "review" for /review's rows. */ | |
| 121 | readonly page: "pull" | "review"; | |
| 110 | /** | |
| 111 | * Where it was: "pull" for the Files page's verdicts, "review" for /review's rows, "files" for a | |
| 112 | * repository's files, "runs" for the terminal's run list, "terminal" for every terminal screen. | |
| 113 | */ | |
| 114 | readonly page: "pull" | "review" | "files" | "runs" | "terminal"; | |
| 122 | 115 | readonly was: string; |
| 123 | 116 | readonly now: KeyId; |
| 124 | 117 | /** The word a person reads for what the key does there, when the map's label is not it. */ |
| @@ -130,6 +123,11 @@ export const OLD_KEYS: readonly OldKey[] = [ | ||
| 130 | 123 | { page: "pull", was: "v c", now: "create", word: "comment" }, |
| 131 | 124 | { page: "review", was: "c", now: "close" }, |
| 132 | 125 | { page: "review", was: "r", now: "sendBack" }, |
| 126 | { page: "files", was: "t", now: "find" }, | |
| 127 | { page: "runs", was: "x", now: "stop" }, | |
| 128 | { page: "runs", was: "S", now: "wheel" }, | |
| 129 | { page: "runs", was: "a", now: "requeue" }, | |
| 130 | { page: "terminal", was: "r", now: "reread" }, | |
| 133 | 131 | ]; |
| 134 | 132 | |
| 135 | 133 | /** |
src/web/pages/explorer.ts +5 −2
| @@ -23,6 +23,7 @@ | ||
| 23 | 23 | */ |
| 24 | 24 | |
| 25 | 25 | import type { TreeEntry } from "../../git/read.ts"; |
| 26 | import { keyOf, oldKeys } from "../keymap.ts"; | |
| 26 | 27 | import type { RepoSource } from "../../view/source.ts"; |
| 27 | 28 | import { html, raw, when, type Html } from "../html.ts"; |
| 28 | 29 | import { icon } from "../icons.ts"; |
| @@ -270,16 +271,18 @@ export function codeMount( | ||
| 270 | 271 | |
| 271 | 272 | /** The control that opens the finder. It needs a script, so it says so. */ |
| 272 | 273 | export function finderButton(): Html { |
| 274 | const moved = oldKeys("files")[0]; | |
| 273 | 275 | return html`<button |
| 274 | 276 | class="btn js-only" |
| 275 | 277 | data-size="sm" |
| 276 | 278 | data-variant="outline" |
| 277 | 279 | type="button" |
| 278 | 280 | data-finder |
| 279 | data-shortcut="t" | |
| 281 | data-shortcut="${keyOf("find")}" | |
| 282 | ${moved === undefined ? null : html`data-was="${moved.was}" data-was-says="${moved.says}"`} | |
| 280 | 283 | title="Go to file" |
| 281 | 284 | > |
| 282 | ${icon("search")}<span class="grow">Go to file</span><kbd>t</kbd> | |
| 285 | ${icon("search")}<span class="grow">Go to file</span><kbd>${keyOf("find")}</kbd> | |
| 283 | 286 | </button>`; |
| 284 | 287 | } |
| 285 | 288 |
src/web/pages/thread.ts +2 −1
| @@ -9,6 +9,7 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | import { originError } from "../../actions/merge_words.ts"; |
| 12 | import { keyOf } from "../keymap.ts"; | |
| 12 | 13 | import { TELL_LIMIT_WORDS, TELL_TEXT_MAX } from "../../actions/tell_from.ts"; |
| 13 | 14 | import { returnTo, withReturn } from "../return_to.ts"; |
| 14 | 15 | import { mayView } from "../../core/sealed.ts"; |
| @@ -886,7 +887,7 @@ export function assigneeCard( | ||
| 886 | 887 | return card( |
| 887 | 888 | html`${current} |
| 888 | 889 | <form method="post" action="${action}" class="edit-row mt" data-now="Assigned" data-now-into="#assignee-now" data-now-from="assignee"> |
| 889 | <label class="sr-only" for="f-assignee">Assign to</label> | |
| 890 | <label class="sr-only" for="f-assignee"${issue.kind === "issue" ? html` data-shortcut="${keyOf("assign")}"` : null}>Assign to</label> | |
| 890 | 891 | <select class="input" id="f-assignee" name="assignee"> |
| 891 | 892 | <option |
| 892 | 893 | value="" |
src/web/studio/run.ts +4 −2
| @@ -9,6 +9,7 @@ | ||
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | 11 | import { offersOwnToken } from "../../actions/own_token.ts"; |
| 12 | import { keyOf } from "../keymap.ts"; | |
| 12 | 13 | import { ownTokenBox, ownTokenJs } from "../own_token.ts"; |
| 13 | 14 | import { time } from "../time_element.ts"; |
| 14 | 15 | import { wayIn } from "../../actions/blocked_words.ts"; |
| @@ -274,7 +275,7 @@ export async function runView( | ||
| 274 | 275 | () => |
| 275 | 276 | html`<div class="bar mt" id="run-cancel"> |
| 276 | 277 | <form method="post" action="${base}/runs/${run.id}/cancel"> |
| 277 | ${btn("Stop", { size: "sm", variant: "outline", icon: "square" })} | |
| 278 | ${btn("Stop", { size: "sm", variant: "outline", icon: "square", shortcut: keyOf("stop") })} | |
| 278 | 279 | </form> |
| 279 | 280 | </div>`, |
| 280 | 281 | )} |
| @@ -287,6 +288,7 @@ export async function runView( | ||
| 287 | 288 | size: "sm", |
| 288 | 289 | variant: "outline", |
| 289 | 290 | icon: "square", |
| 291 | shortcut: keyOf("stop"), | |
| 290 | 292 | })} |
| 291 | 293 | </form> |
| 292 | 294 | </div>`, |
| @@ -427,7 +429,7 @@ export async function runView( | ||
| 427 | 429 | data-api="/api/v1/repos/${repo.ownerName}/${repo.name}/runs/${run.id}/steer" |
| 428 | 430 | data-running="${run.state === "running" ? "1" : "0"}" |
| 429 | 431 | > |
| 430 | <label class="sr-only" for="steer-text" | |
| 432 | <label class="sr-only" for="steer-text" data-shortcut="${keyOf("wheel")}" | |
| 431 | 433 | >Say something to ${who}</label |
| 432 | 434 | > |
| 433 | 435 | <textarea |
test/decisions-by-doors.test.ts +3 −3
| @@ -224,10 +224,10 @@ describe("the standing rule in the terminal", () => { | ||
| 224 | 224 | await press("/"); |
| 225 | 225 | for (const ch of "svc") await press(ch); |
| 226 | 226 | await press("enter", "enter"); |
| 227 | await press("R"); | |
| 227 | await press("A"); | |
| 228 | 228 | expect(rule()).toBe("decider"); |
| 229 | 229 | expect(tui.screen.toText()).toContain("decisions here go by decider"); |
| 230 | await press("R"); | |
| 230 | await press("A"); | |
| 231 | 231 | expect(rule()).toBe("decider_tell"); |
| 232 | 232 | tui.stop(); |
| 233 | 233 | }); |
| @@ -249,7 +249,7 @@ describe("the standing rule in the terminal", () => { | ||
| 249 | 249 | }; |
| 250 | 250 | await press("/"); |
| 251 | 251 | for (const ch of "svc") await press(ch); |
| 252 | await press("enter", "enter", "R"); | |
| 252 | await press("enter", "enter", "A"); | |
| 253 | 253 | expect(rule()).toBe("me"); |
| 254 | 254 | tui.stop(); |
| 255 | 255 | }); |
test/keymap-terminal.test.ts added +84
| @@ -0,0 +1,84 @@ | ||
| 1 | /** | |
| 2 | * The terminal reads the forge's one keymap (src/web/keymap.ts): R reads any screen again (the | |
| 3 | * map's `reread`), so no screen may bind a literal r to a refresh. Where r means something of the | |
| 4 | * screen's own (a different kind of thing from a run, whose r is queue again), the screen is listed | |
| 5 | * here with what r does, so a new one is a choice, never a slip. | |
| 6 | */ | |
| 7 | import { expect, test } from "bun:test"; | |
| 8 | import { readFileSync } from "node:fs"; | |
| 9 | import { join } from "node:path"; | |
| 10 | import { keyOf } from "../src/web/keymap.ts"; | |
| 11 | ||
| 12 | const ROOT = join(import.meta.dir, ".."); | |
| 13 | ||
| 14 | /** Words that say a binding reads the screen again. */ | |
| 15 | const REREAD = /refresh|reload|read again|reread|knock again|check the payment/i; | |
| 16 | ||
| 17 | /** A literal r bound on a terminal screen, and what it is called there. */ | |
| 18 | const R_BINDING = /binding\(\[(?:"[^"]*",\s*)*"r"(?:,\s*"[^"]*")*\],\s*(["`])([^"`]*)\1/g; | |
| 19 | ||
| 20 | /** Screens where r is the screen's own verb, with what it does. */ | |
| 21 | const OWN_R: Record<string, string> = { | |
| 22 | "src/tui/local/branches.ts": "rename", | |
| 23 | "src/tui/screens/about.ts": "make … the reviewer", | |
| 24 | "src/tui/screens/account_access.ts": "reset access", | |
| 25 | "src/tui/screens/agents.ts": "roles", | |
| 26 | "src/tui/screens/autonomy.ts": "reviewer", | |
| 27 | "src/tui/screens/cloud.ts": "rotate", | |
| 28 | "src/tui/screens/conflicts.ts": "look at the crew's proposal", | |
| 29 | "src/tui/screens/dataimport.ts": "import, replace", | |
| 30 | "src/tui/screens/design.ts": "revert", | |
| 31 | "src/tui/screens/devices.ts": "revoke an app", | |
| 32 | "src/tui/screens/estimates.ts": "record an estimate", | |
| 33 | "src/tui/screens/experiments.ts": "record result", | |
| 34 | "src/tui/screens/featurefeed.ts": "run scheduled now", | |
| 35 | "src/tui/screens/feed.ts": "reply", | |
| 36 | "src/tui/screens/fleet.ts": "reverse", | |
| 37 | "src/tui/screens/flows.ts": "read upstream now", | |
| 38 | "src/tui/screens/forges.ts": "restore", | |
| 39 | "src/tui/screens/games.ts": "restart", | |
| 40 | "src/tui/screens/hooks.ts": "redeliver", | |
| 41 | "src/tui/screens/interrupted_out.ts": "try again", | |
| 42 | "src/tui/screens/limbs.ts": "raise", | |
| 43 | "src/tui/screens/mirror.ts": "retry", | |
| 44 | "src/tui/screens/needs.ts": "standing still: re-check its pulls", | |
| 45 | "src/tui/screens/orgteams.ts": "role", | |
| 46 | "src/tui/screens/outsideagents.ts": "open or close reports", | |
| 47 | "src/tui/screens/people.ts": "change a role", | |
| 48 | "src/tui/screens/pinned.ts": "roll back", | |
| 49 | "src/tui/screens/quarantine.ts": "run the review", | |
| 50 | "src/tui/screens/queuegrowth.ts": "resume past the ceiling", | |
| 51 | "src/tui/screens/resilience.ts": "run a restore drill", | |
| 52 | "src/tui/screens/schedules.ts": "run now", | |
| 53 | "src/tui/screens/stalled.ts": "unblock", | |
| 54 | "src/tui/screens/talk_chats.ts": "rename", | |
| 55 | "src/tui/screens/variants.ts": "run a branch", | |
| 56 | }; | |
| 57 | ||
| 58 | function terminalSources(): Record<string, string> { | |
| 59 | const out: Record<string, string> = {}; | |
| 60 | for (const path of new Bun.Glob("src/tui/**/*.ts").scanSync(ROOT)) out[path] = readFileSync(join(ROOT, path), "utf8"); | |
| 61 | return out; | |
| 62 | } | |
| 63 | ||
| 64 | test("no terminal screen reads itself again on r: R does, from the map", () => { | |
| 65 | expect(keyOf("reread")).toBe("R"); | |
| 66 | const offenders: string[] = []; | |
| 67 | for (const [path, text] of Object.entries(terminalSources())) | |
| 68 | for (const m of text.matchAll(R_BINDING)) if (REREAD.test(m[2]!)) offenders.push(`${path}: r "${m[2]}"`); | |
| 69 | expect(offenders).toEqual([]); | |
| 70 | }); | |
| 71 | ||
| 72 | test("every screen that binds r for its own verb is listed with what it does, and the list holds only screens that still do", () => { | |
| 73 | const sources = terminalSources(); | |
| 74 | const binding = Object.keys(sources).filter((p) => [...sources[p]!.matchAll(R_BINDING)].length > 0).sort(); | |
| 75 | expect(binding).toEqual(Object.keys(OWN_R).sort()); | |
| 76 | }); | |
| 77 | ||
| 78 | test("the scan catches the shapes a refresh on r takes", () => { | |
| 79 | const hits = (text: string) => [...text.matchAll(R_BINDING)].filter((m) => REREAD.test(m[2]!)).map((m) => m[2]); | |
| 80 | expect(hits(`binding(["r"], "refresh")`)).toEqual(["refresh"]); | |
| 81 | expect(hits(`binding(["j", "r"], "read again")`)).toEqual(["read again"]); | |
| 82 | expect(hits(`binding(["r"], "rename")`)).toEqual([]); | |
| 83 | expect(hits(`binding([keyOf("reread")], "refresh")`)).toEqual([]); | |
| 84 | }); |
test/keymap.test.ts +30 −3
| @@ -5,11 +5,12 @@ | ||
| 5 | 5 | * map's moves, no key fires while typing, and the bridge is handed its verbs from the map. |
| 6 | 6 | */ |
| 7 | 7 | import { expect, test } from "bun:test"; |
| 8 | import { finderButton } from "../src/web/pages/explorer.ts"; | |
| 8 | 9 | import { readdirSync, readFileSync, statSync } from "node:fs"; |
| 9 | 10 | import { join, relative } from "node:path"; |
| 10 | 11 | import { decideKey } from "../src/web/key_decision.ts"; |
| 11 | 12 | import { GO_PAGES } from "../src/web/go_pages.ts"; |
| 12 | import { KEYMAP, MOVES, OLD_KEYS, OLD_KEYS_UNTIL, REPO_TABS, VERBS, keyOf, oldKeys, type KeyDef, type KeyKind } from "../src/web/keymap.ts"; | |
| 13 | import { KEYMAP, MOVES, OLD_KEYS, OLD_KEYS_UNTIL, REPO_TABS, VERBS, keyOf, oldKeys, provideOldKeysClockForTest, type KeyDef, type KeyKind } from "../src/web/keymap.ts"; | |
| 13 | 14 | import { bridgeJs } from "../src/web/bridge_client.ts"; |
| 14 | 15 | import { DISMISS_KEY, NEW_ISSUE_KEY } from "../src/web/script_keys.ts"; |
| 15 | 16 | |
| @@ -20,7 +21,9 @@ const ROOT = join(import.meta.dir, ".."); | ||
| 20 | 21 | * the map. This list only shrinks; a file here that no longer has a literal must leave it. |
| 21 | 22 | */ |
| 22 | 23 | const PENDING: Record<string, string> = { |
| 23 | "src/web/pages/explorer.ts": "(c) issues and runs: t finds a file here, which Tell the crew owns everywhere else", | |
| 24 | "src/web/pages/next.ts": "(d): Top, Up, Down and Not now are t, u, d and l, which Tell, Update and Right own", | |
| 25 | "src/web/space_client.ts": "(d): n jumps the space to now", | |
| 26 | "src/web/system-live.ts": "(d): c and m pick CPU and memory, which Write and Merge own", | |
| 24 | 27 | }; |
| 25 | 28 | |
| 26 | 29 | /** |
| @@ -34,6 +37,8 @@ const LITERAL = [ | ||
| 34 | 37 | /verb\('([^']+)', '/g, |
| 35 | 38 | /\bkey: "([a-zA-Z](?: [a-zA-Z])?)",/g, |
| 36 | 39 | /\$\{key\("([^"]{1,3})", /g, |
| 40 | /\bkey === '([a-zA-Z])'/g, | |
| 41 | /, "([a-zA-Z])", back\)/g, | |
| 37 | 42 | ]; |
| 38 | 43 | |
| 39 | 44 | function sources(dir: string): string[] { |
| @@ -71,7 +76,7 @@ test("one key, one meaning: no two verbs share a key on one kind of thing, and n | ||
| 71 | 76 | const moveKeys = new Set<string>(Object.values(MOVES).map((d) => d.key)); |
| 72 | 77 | // A figure's Enter is its open: setting it to what it shows. |
| 73 | 78 | expect(verbs.filter(([id, d]) => moveKeys.has(d.key) && id !== "set").map(([id]) => id)).toEqual([]); |
| 74 | for (const [, d] of Object.entries(KEYMAP)) if ("terminal" in d) expect(d.terminal.reason.length).toBeGreaterThan(20); | |
| 79 | for (const [, d] of Object.entries(KEYMAP) as [string, KeyDef][]) if (d.terminal !== undefined) expect(d.terminal.reason.length).toBeGreaterThan(20); | |
| 75 | 80 | }); |
| 76 | 81 | |
| 77 | 82 | test("a moved key says where it went for two weeks, then nothing: the date is in code, not an alias", () => { |
| @@ -83,6 +88,8 @@ test("a moved key says where it went for two weeks, then nothing: the date is in | ||
| 83 | 88 | ]); |
| 84 | 89 | expect(oldKeys("review", before).map((o) => [o.was, o.key])).toEqual([["c", "x"], ["r", "b"]]); |
| 85 | 90 | expect(oldKeys("pull", new Date(OLD_KEYS_UNTIL))).toEqual([]); |
| 91 | expect(oldKeys("files", before)).toEqual([{ was: "t", key: "f", says: "f is go to file now" }]); | |
| 92 | expect(oldKeys("runs", before).map((o) => [o.was, o.key])).toEqual([["x", "s"], ["S", "i"], ["a", "r"]]); | |
| 86 | 93 | expect(oldKeys("review", new Date(Date.parse(OLD_KEYS_UNTIL) + 86_400_000))).toEqual([]); |
| 87 | 94 | // Two weeks from the change, not a standing alias. |
| 88 | 95 | expect(Date.parse(OLD_KEYS_UNTIL) - Date.parse("2026-12-01T00:00:00Z")).toBeLessThanOrEqual(15 * 86_400_000); |
| @@ -91,6 +98,18 @@ test("a moved key says where it went for two weeks, then nothing: the date is in | ||
| 91 | 98 | for (const o of OLD_KEYS.filter((k) => k.page === "pull")) expect(Object.values(KEYMAP).some((d) => d.key === o.was)).toBe(false); |
| 92 | 99 | }); |
| 93 | 100 | |
| 101 | test("Go to file is the keymap's f on a repository's files, and t, for two weeks, says so: t is Tell the crew everywhere", () => { | |
| 102 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 103 | const b = finderButton().text; | |
| 104 | provideOldKeysClockForTest(new Date(OLD_KEYS_UNTIL)); | |
| 105 | const after = finderButton().text; | |
| 106 | provideOldKeysClockForTest(undefined); | |
| 107 | expect(b).toContain('data-shortcut="f"'); | |
| 108 | expect(b).toContain("<kbd>f</kbd>"); | |
| 109 | expect(b).toContain('data-was="t" data-was-says="f is go to file now"'); | |
| 110 | expect(after).not.toContain("data-was="); | |
| 111 | }); | |
| 112 | ||
| 94 | 113 | test("a repository's tabs are g jumps of their own, and shadow a forge-wide one only where the map says", () => { |
| 95 | 114 | const tabs = Object.values(REPO_TABS); |
| 96 | 115 | expect(new Set(tabs).size).toBe(tabs.length); |
| @@ -104,6 +123,14 @@ test("the shell says where a moved key went, and a quick second key still finds | ||
| 104 | 123 | expect(client).toContain("seq.length === 2 && seq[0] !== 'g' ? doc.querySelector('[data-shortcut=\"' + esc(e.key) + '\"]')"); |
| 105 | 124 | }); |
| 106 | 125 | |
| 126 | test("both doors share one meaning per key: R refreshes a terminal screen, / filters or searches, r queues a run again", () => { | |
| 127 | expect([keyOf("reread"), keyOf("search"), keyOf("requeue"), keyOf("stop"), keyOf("wheel")]).toEqual(["R", "/", "r", "s", "i"]); | |
| 128 | // No terminal key differs from the web's here: the run cards on the issue and pull screens steer | |
| 129 | // on i, as the run list does. | |
| 130 | expect((Object.entries(KEYMAP) as [string, KeyDef][]).filter(([, d]) => d.terminal !== undefined).map(([id]) => id)).toEqual([]); | |
| 131 | expect(oldKeys("terminal", new Date(Date.parse(OLD_KEYS_UNTIL) - 1))).toEqual([{ was: "r", key: "R", says: "R is refresh now" }]); | |
| 132 | }); | |
| 133 | ||
| 107 | 134 | test("the g jumps the map names are go_pages.ts's", () => { |
| 108 | 135 | expect([keyOf("home"), keyOf("talk")]).toEqual(["g h", "g t"]); |
| 109 | 136 | }); |
test/reviewer-lands.test.ts +1 −1
| @@ -137,7 +137,7 @@ describe("a team reviewer reviews and a writer lands", () => { | ||
| 137 | 137 | tui.ctx.push(pullScreen(session, tui.ctx, local(session, lib), number)); |
| 138 | 138 | await settleUntil(tui, "refresh", { timeoutMs: 10_000 }); |
| 139 | 139 | if (who === "dee") { |
| 140 | tui.dispatch({ type: "key", key: "R", ctrl: false, alt: false, shift: true }); | |
| 140 | tui.dispatch({ type: "key", key: "b", ctrl: false, alt: false, shift: false }); | |
| 141 | 141 | await settleApp(tui); |
| 142 | 142 | } |
| 143 | 143 | return tui.screen.toText(); |
test/studio-run-page.test.ts +4
| @@ -160,6 +160,8 @@ describe("working: a run's own page in the studio", () => { | ||
| 160 | 160 | expect(page).toContain('data-who="scout"'); |
| 161 | 161 | expect(page).toContain('id="run-steer"'); |
| 162 | 162 | expect(page).toContain("Steer scout"); |
| 163 | // Take the wheel is the keymap's i: it puts the caret in the steer box. | |
| 164 | expect(page).toContain('<label class="sr-only" for="steer-text" data-shortcut="i"'); | |
| 163 | 165 | // Jump, live and steer draw §5's btn, bar and card (#4263). |
| 164 | 166 | for (const old of ["run-jump", "run-live", "run-steer"]) { |
| 165 | 167 | expect(page).not.toMatch(new RegExp(`class="[^"]*\\b${old}\\b`)); |
| @@ -289,6 +291,8 @@ describe("working: a run's own page in the studio", () => { | ||
| 289 | 291 | `<div class="bar mt" id="run-cancel">\\s*<form method="post" action="/alice/engine/runs/${run.id}/cancel">[\\s\\S]*?${label}[\\s\\S]*?</form>`, |
| 290 | 292 | ), |
| 291 | 293 | ); |
| 294 | // Stop is the keymap's s, on either button. | |
| 295 | expect(page).toMatch(/id="run-cancel">[\s\S]*?data-shortcut="s"[\s\S]*?<\/form>/); | |
| 292 | 296 | } |
| 293 | 297 | }); |
| 294 | 298 |
test/tell-status.test.ts +2
| @@ -257,6 +257,8 @@ describe("what became of a tell", () => { | ||
| 257 | 257 | let html = await (await fetch(`${servers.url}/alice/garden/issues/${issue.number}`, { headers: { cookie: cookie() } })).text(); |
| 258 | 258 | expect(html).toContain('data-tell-state="stalled"'); |
| 259 | 259 | expect(html).toContain('<a href="#f-assignee">Pick an assignee below</a>'); |
| 260 | // Assign is the keymap's a on an issue: it puts the caret on Assign to. | |
| 261 | expect(html).toContain('<label class="sr-only" for="f-assignee" data-shortcut="a">Assign to</label>'); | |
| 260 | 262 | // A run picks it up: the line names who and links the run. |
| 261 | 263 | run(issue, "running"); |
| 262 | 264 | const id = listRuns(app.db, repo.id, { kind: "agent", issueId: issue.id, limit: 1 })[0]!.id; |
test/tui-crewhandover-open.test.ts +12 −6
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | /** The crew hand-overs screen opens a parked-twice issue with Enter and reads again on `r`. */ |
| 2 | 2 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| 3 | import { OLD_KEYS_UNTIL, provideOldKeysClockForTest } from "../src/web/keymap.ts"; | |
| 3 | 4 | import { createUser, getUserByName } from "../src/core/users.ts"; |
| 4 | 5 | import type { Ctx } from "../src/tui/app/app.ts"; |
| 5 | 6 | import { crewHandoverScreen } from "../src/tui/screens/crewhandover.ts"; |
| @@ -52,7 +53,7 @@ beforeAll(async () => { | ||
| 52 | 53 | }); |
| 53 | 54 | afterAll(() => e.close()); |
| 54 | 55 | |
| 55 | test("Enter opens the parked issue, r reads again, a non-admin gets nothing", async () => { | |
| 56 | test("Enter opens the parked issue, R reads again, a non-admin gets nothing", async () => { | |
| 56 | 57 | const t = await crewScreen("alice"); |
| 57 | 58 | expect(t.text()).toContain("Nothing handed to the planner"); |
| 58 | 59 | await t.key("enter"); |
| @@ -64,10 +65,15 @@ test("Enter opens the parked issue, r reads again, a non-admin gets nothing", as | ||
| 64 | 65 | expect(e.ended(work, "nothing to propose")).toBe(true); |
| 65 | 66 | await tick(); |
| 66 | 67 | expect(t.text()).not.toContain("Handed to the planner: "); |
| 67 | await t.key("r"); | |
| 68 | await t.key("R"); | |
| 68 | 69 | expect(t.text()).toContain("Handed to the planner: alice/engine#" + work.number); |
| 69 | 70 | expect(t.text()).toMatch(/enter\s+open/); |
| 70 | expect(t.text()).toMatch(/r\s+refresh/); | |
| 71 | expect(t.text()).toMatch(/R\s+refresh/); | |
| 72 | // r, for two weeks, says R refreshes now (keymap.ts OLD_KEYS). | |
| 73 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 74 | await t.key("r"); | |
| 75 | provideOldKeysClockForTest(undefined); | |
| 76 | expect(t.text()).toContain("R is refresh now"); | |
| 71 | 77 | |
| 72 | 78 | await t.key("enter"); |
| 73 | 79 | expect(t.text()).toContain("Scene graph"); |
| @@ -87,7 +93,7 @@ test("Enter opens the parked issue, r reads again, a non-admin gets nothing", as | ||
| 87 | 93 | expect(pushed).toEqual([]); |
| 88 | 94 | }); |
| 89 | 95 | |
| 90 | test("Enter on the drill row opens nothing, and r clamps the cursor when the list shrinks", async () => { | |
| 96 | test("Enter on the drill row opens nothing, and R clamps the cursor when the list shrinks", async () => { | |
| 91 | 97 | const { setIssueState } = await import("../src/actions/issues.ts"); |
| 92 | 98 | const { recordDrill } = await import("../src/snapshot/drills.ts"); |
| 93 | 99 | const keep = e.issue("Keeper"); |
| @@ -120,7 +126,7 @@ test("Enter on the drill row opens nothing, and r clamps the cursor when the lis | ||
| 120 | 126 | expect(t.text()).toContain("Handed to the planner: "); |
| 121 | 127 | // Close the issue the cursor row stands past, then r: the cursor lands on a row that exists. |
| 122 | 128 | setIssueState(e.app, e.alice, e.fresh(), gone, "closed"); |
| 123 | await t.key("r"); | |
| 129 | await t.key("R"); | |
| 124 | 130 | expect((t.text().match(/Handed to the planner: /g) ?? []).length).toBe(rows - 1); |
| 125 | 131 | await t.key("k"); |
| 126 | 132 | await t.key("enter"); |
| @@ -144,7 +150,7 @@ test("t tries the parked issue again, and a non-admin's t does nothing", async ( | ||
| 144 | 150 | expect(parkedCount(e.app, e.fresh(), work.id)).toBe(2); |
| 145 | 151 | |
| 146 | 152 | const t = await crewScreen("alice"); |
| 147 | await t.key("r"); | |
| 153 | await t.key("R"); | |
| 148 | 154 | expect(t.text()).toContain("Handed to the planner: alice/engine#" + work.number); |
| 149 | 155 | expect(t.text()).toMatch(/t\s+try the issue again/); |
| 150 | 156 | await t.key("t"); |
test/tui-deploys-probe.test.ts +2 −2
| @@ -189,10 +189,10 @@ test("the knock is the MCP tool's: probeApp keeps the row it showed", async () = | ||
| 189 | 189 | expect(row.said).toContain("note.create as anon: the table says no, the app said 200"); |
| 190 | 190 | }); |
| 191 | 191 | |
| 192 | test("`r` on the probe knocks again and keeps another row", async () => { | |
| 192 | test("`R` on the probe knocks again and keeps another row", async () => { | |
| 193 | 193 | running = true; |
| 194 | 194 | const before = listProbes(forge.db, record.id).length; |
| 195 | const frames = await drive(alice, repo, ["p", "r"]); | |
| 195 | const frames = await drive(alice, repo, ["p", "R"]); | |
| 196 | 196 | expect(frames.at(-1)).toContain("GET /api/notes as anon · 200 · ok"); |
| 197 | 197 | expect(listProbes(forge.db, record.id).length).toBe(before + 2); |
| 198 | 198 | }); |
test/tui-pricing.test.ts +9 −9
| @@ -127,10 +127,10 @@ test("an order prints the checkout address, and the same ticket brings the claim | ||
| 127 | 127 | const f = await fixture(); |
| 128 | 128 | const { h, session } = await ordered(f, "203.0.113.3", "sunny-day"); |
| 129 | 129 | expect(pendingFrom(f.app.db, bucketOf("203.0.113.3"), Date.now())).toBe(1); |
| 130 | await f.press(h, "r"); | |
| 130 | await f.press(h, "R"); | |
| 131 | 131 | expect(flat(h)).toContain("Not paid yet"); |
| 132 | 132 | f.paid.add(session); |
| 133 | await f.press(h, "r"); // the reconcile is awaited by the app: the forge is made before it settles | |
| 133 | await f.press(h, "R"); // the reconcile is awaited by the app: the forge is made before it settles | |
| 134 | 134 | expect(joined(h)).toMatch(/https:\/\/sunny-day--forge\.test\/claim#/); |
| 135 | 135 | expect(f.placed()).toBe(1); |
| 136 | 136 | }); |
| @@ -143,7 +143,7 @@ test("the claim link is shown once: a screen whose order's link was already take | ||
| 143 | 143 | const id = f.orderRow("once-only")!.id; |
| 144 | 144 | await reconcileOrder(f.app, id); |
| 145 | 145 | expect((await deliverLink(f.app, getOrder(f.app.db, id)!)).kind).toBe("link"); |
| 146 | await f.press(h, "r"); | |
| 146 | await f.press(h, "R"); | |
| 147 | 147 | expect(flat(h)).toContain("The link was shown already"); |
| 148 | 148 | expect(joined(h)).not.toContain("/claim#"); |
| 149 | 149 | }); |
| @@ -152,7 +152,7 @@ test("a paid order whose forge cannot be made says so and keeps the order id", a | ||
| 152 | 152 | const f = await fixture({ placement: "full" }); |
| 153 | 153 | const { h, session } = await ordered(f, "203.0.113.7", "no-room"); |
| 154 | 154 | f.paid.add(session); |
| 155 | await f.press(h, "r"); | |
| 155 | await f.press(h, "R"); | |
| 156 | 156 | expect(flat(h)).toContain("Paid, but the forge could not be made"); |
| 157 | 157 | expect(flat(h)).toContain(f.orderRow("no-room")!.id); |
| 158 | 158 | expect(joined(h)).not.toContain("/claim#"); |
| @@ -173,7 +173,7 @@ test("a forge already taken over is told so, and no link is shown", async () => | ||
| 173 | 173 | } finally { |
| 174 | 174 | child.close(); |
| 175 | 175 | } |
| 176 | await f.press(h, "r"); | |
| 176 | await f.press(h, "R"); | |
| 177 | 177 | expect(flat(h)).toContain("is taken over"); |
| 178 | 178 | expect(joined(h)).not.toContain("/claim#"); |
| 179 | 179 | }); |
| @@ -183,7 +183,7 @@ test("a ticket that does not fit the order shows no link, and the screen says wh | ||
| 183 | 183 | const { h, session } = await ordered(f, "203.0.113.10", "not-yours"); |
| 184 | 184 | f.paid.add(session); |
| 185 | 185 | f.app.db.query("UPDATE forge_order SET ticket_hash = 'someone-elses' WHERE name = 'not-yours'").run(); |
| 186 | await f.press(h, "r"); | |
| 186 | await f.press(h, "R"); | |
| 187 | 187 | expect(flat(h)).toContain("not yours to see"); |
| 188 | 188 | expect(joined(h)).not.toContain("/claim#"); |
| 189 | 189 | expect(f.placed()).toBe(0); |
| @@ -329,7 +329,7 @@ test("the terminal prints the receipt's four facts on every ready branch, the cl | ||
| 329 | 329 | // The claim link branch. |
| 330 | 330 | const a = await ordered(f, "203.0.113.20", "receipt-link"); |
| 331 | 331 | f.paid.add(a.session); |
| 332 | await f.press(a.h, "r"); | |
| 332 | await f.press(a.h, "R"); | |
| 333 | 333 | expect(joined(a.h)).toMatch(/\/claim#/); |
| 334 | 334 | for (const t of facts("receipt-link")) expect(flat(a.h)).toContain(t); |
| 335 | 335 | // The shown-already branch. |
| @@ -338,7 +338,7 @@ test("the terminal prints the receipt's four facts on every ready branch, the cl | ||
| 338 | 338 | const id = f.orderRow("receipt-shown")!.id; |
| 339 | 339 | await reconcileOrder(f.app, id); |
| 340 | 340 | await deliverLink(f.app, getOrder(f.app.db, id)!); |
| 341 | await f.press(b.h, "r"); | |
| 341 | await f.press(b.h, "R"); | |
| 342 | 342 | expect(flat(b.h)).toContain("The link was shown already"); |
| 343 | 343 | for (const t of facts("receipt-shown")) expect(flat(b.h)).toContain(t); |
| 344 | 344 | // The claimed branch: the third forge made has an admin. |
| @@ -353,7 +353,7 @@ test("the terminal prints the receipt's four facts on every ready branch, the cl | ||
| 353 | 353 | } finally { |
| 354 | 354 | child.close(); |
| 355 | 355 | } |
| 356 | await f.press(c.h, "r"); | |
| 356 | await f.press(c.h, "R"); | |
| 357 | 357 | expect(flat(c.h)).toContain("is taken over"); |
| 358 | 358 | for (const t of facts("receipt-claimed")) expect(flat(c.h)).toContain(t); |
| 359 | 359 | }); |
test/tui-run-cancel.test.ts +25 −13
| @@ -1,5 +1,6 @@ | ||
| 1 | 1 | /** The terminal's runs list cancels a queued or running run with `x` and a confirm (#7230). */ |
| 2 | 2 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| 3 | import { OLD_KEYS_UNTIL, provideOldKeysClockForTest } from "../src/web/keymap.ts"; | |
| 3 | 4 | import { mkdtemp, rm } from "node:fs/promises"; |
| 4 | 5 | import { tmpdir } from "node:os"; |
| 5 | 6 | import { join } from "node:path"; |
| @@ -73,8 +74,8 @@ const state = (id: string) => getRun(forge.db, id)!.state; | ||
| 73 | 74 | |
| 74 | 75 | test("x asks, yes cancels the run and the row reads cancelled", async () => { |
| 75 | 76 | const h = await open(alice, queued()); |
| 76 | expect(h.hints()).toMatch(/x +cancel/); | |
| 77 | let text = await h.press("x"); | |
| 77 | expect(h.hints()).toMatch(/s +stop/); | |
| 78 | let text = await h.press("s"); | |
| 78 | 79 | expect(text).toContain("Cancel run"); |
| 79 | 80 | expect(text).toContain("deploy production"); |
| 80 | 81 | expect(state(h.runId)).toBe("queued"); |
| @@ -85,25 +86,36 @@ test("x asks, yes cancels the run and the row reads cancelled", async () => { | ||
| 85 | 86 | h.app.stop(); |
| 86 | 87 | }); |
| 87 | 88 | |
| 89 | test("x, the old key, says s is stop now for two weeks and cancels nothing", async () => { | |
| 90 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 91 | const h = await open(alice, queued()); | |
| 92 | const text = await h.press("x"); | |
| 93 | provideOldKeysClockForTest(undefined); | |
| 94 | expect(state(h.runId)).toBe("queued"); | |
| 95 | expect(text).toContain("s is stop now"); | |
| 96 | expect(text).not.toContain("Cancel run"); | |
| 97 | h.app.stop(); | |
| 98 | }); | |
| 99 | ||
| 88 | 100 | test("declining the confirm leaves the run as it was", async () => { |
| 89 | 101 | const h = await open(alice, queued()); |
| 90 | await h.press("x"); | |
| 102 | await h.press("s"); | |
| 91 | 103 | await h.press("enter"); // defaults to Keep |
| 92 | 104 | expect(state(h.runId)).toBe("queued"); |
| 93 | await h.press("x"); | |
| 105 | await h.press("s"); | |
| 94 | 106 | await h.press("esc"); |
| 95 | 107 | expect(state(h.runId)).toBe("queued"); |
| 96 | 108 | h.app.stop(); |
| 97 | 109 | }); |
| 98 | 110 | |
| 99 | test("a running run offers x cancel too", async () => { | |
| 111 | test("a running run offers s stop too", async () => { | |
| 100 | 112 | const h = await open(alice, (repo) => { |
| 101 | 113 | const run = createRun(forge.db, { repoId: repo.id, kind: "deploy", env: "production" }); |
| 102 | 114 | claimRun(forge.db, run.id); |
| 103 | 115 | return run.id; |
| 104 | 116 | }); |
| 105 | 117 | expect(getRun(forge.db, h.runId)!.state).toBe("running"); |
| 106 | await h.press("x"); | |
| 118 | await h.press("s"); | |
| 107 | 119 | await h.press("left"); |
| 108 | 120 | await h.press("enter"); |
| 109 | 121 | expect(state(h.runId)).toBe("cancelled"); |
| @@ -118,7 +130,7 @@ test("a cancelled run still ending its processes reads stopping, and cancelled o | ||
| 118 | 130 | return run.id; |
| 119 | 131 | }); |
| 120 | 132 | try { |
| 121 | await h.press("x"); | |
| 133 | await h.press("s"); | |
| 122 | 134 | await h.press("left"); |
| 123 | 135 | const text = await h.press("enter"); |
| 124 | 136 | expect(state(h.runId)).toBe("cancelled"); |
| @@ -138,17 +150,17 @@ test("x does nothing on a finished run", async () => { | ||
| 138 | 150 | finishRun(forge.db, run.id, { state: "ok", summary: "GREEN-MARK" }); |
| 139 | 151 | return run.id; |
| 140 | 152 | }); |
| 141 | expect(h.hints()).not.toMatch(/x +cancel/); | |
| 142 | const text = await h.press("x"); | |
| 153 | expect(h.hints()).not.toMatch(/s +stop/); | |
| 154 | const text = await h.press("s"); | |
| 143 | 155 | expect(text).not.toContain("Cancel run"); |
| 144 | 156 | expect(state(h.runId)).toBe("ok"); |
| 145 | 157 | h.app.stop(); |
| 146 | 158 | }); |
| 147 | 159 | |
| 148 | test("a reader is not offered x and a press changes nothing", async () => { | |
| 160 | test("a reader is not offered s and a press changes nothing", async () => { | |
| 149 | 161 | const h = await open(bob, queued()); |
| 150 | expect(h.hints()).not.toMatch(/x +cancel/); | |
| 151 | const text = await h.press("x"); | |
| 162 | expect(h.hints()).not.toMatch(/s +stop/); | |
| 163 | const text = await h.press("s"); | |
| 152 | 164 | expect(text).not.toContain("Cancel run"); |
| 153 | 165 | expect(state(h.runId)).toBe("queued"); |
| 154 | 166 | h.app.stop(); |
| @@ -156,7 +168,7 @@ test("a reader is not offered x and a press changes nothing", async () => { | ||
| 156 | 168 | |
| 157 | 169 | test("a run that finished meanwhile answers in one line", async () => { |
| 158 | 170 | const h = await open(alice, queued()); |
| 159 | await h.press("x"); | |
| 171 | await h.press("s"); | |
| 160 | 172 | claimRun(forge.db, h.runId); |
| 161 | 173 | finishRun(forge.db, h.runId, { state: "ok", summary: "done" }); |
| 162 | 174 | await h.press("left"); |
test/tui-runlog.test.ts +2 −2
| @@ -208,13 +208,13 @@ test("another run's events do not reread this one", async () => { | ||
| 208 | 208 | expect(app.screen.toText()).not.toContain("SNEAKED"); |
| 209 | 209 | }); |
| 210 | 210 | |
| 211 | test("r rereads the log, and o prints the web address", async () => { | |
| 211 | test("R rereads the log, and o prints the web address", async () => { | |
| 212 | 212 | const run = createRun(forge.db, { repoId: repo.id, kind: "agent" }); |
| 213 | 213 | claimRun(forge.db, run.id); |
| 214 | 214 | appendRunLog(dir, run.id, "before"); |
| 215 | 215 | const app = await open(alice, run.id); |
| 216 | 216 | appendFileSync(runLogPath(dir, run.id), "BEHIND-THE-LISTENER\n"); |
| 217 | await key(app, "r"); | |
| 217 | await key(app, "R"); | |
| 218 | 218 | expect(app.screen.toText()).toContain("BEHIND-THE-LISTENER"); |
| 219 | 219 | await key(app, "o"); |
| 220 | 220 | expect(app.screen.toText()).toContain(`/alice/lamp/runs/${run.id}`); |
test/tui-runs-requeue.test.ts +16 −16
| @@ -88,10 +88,10 @@ async function open(user: User, end: "failed" | "ok" | "cancelled" = "failed") { | ||
| 88 | 88 | return { app, press, hints, runs, repo, issueId: issue.value.id }; |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | test("a asks, yes queues the task again and the list shows the queued run", async () => { | |
| 91 | test("r asks, yes queues the task again and the list shows the queued run", async () => { | |
| 92 | 92 | const h = await open(alice); |
| 93 | expect(h.hints()).toMatch(/a +run again/); | |
| 94 | let text = await h.press("a"); | |
| 93 | expect(h.hints()).toMatch(/r +queue it again/); | |
| 94 | let text = await h.press("r"); | |
| 95 | 95 | expect(text).toContain("Run again"); |
| 96 | 96 | expect(text).toContain("again?"); |
| 97 | 97 | expect(h.runs()).toHaveLength(1); |
| @@ -105,52 +105,52 @@ test("a asks, yes queues the task again and the list shows the queued run", asyn | ||
| 105 | 105 | h.app.stop(); |
| 106 | 106 | }); |
| 107 | 107 | |
| 108 | test("a cancelled agent run offers a too", async () => { | |
| 108 | test("a cancelled agent run offers r too", async () => { | |
| 109 | 109 | const h = await open(alice, "cancelled"); |
| 110 | expect(h.hints()).toMatch(/a +run again/); | |
| 110 | expect(h.hints()).toMatch(/r +queue it again/); | |
| 111 | 111 | h.app.stop(); |
| 112 | 112 | }); |
| 113 | 113 | |
| 114 | 114 | test("esc and Keep change nothing", async () => { |
| 115 | 115 | const h = await open(alice); |
| 116 | await h.press("a"); | |
| 116 | await h.press("r"); | |
| 117 | 117 | await h.press("esc"); |
| 118 | 118 | expect(h.runs()).toHaveLength(1); |
| 119 | await h.press("a"); | |
| 119 | await h.press("r"); | |
| 120 | 120 | await h.press("enter"); // defaults to Keep |
| 121 | 121 | expect(h.runs()).toHaveLength(1); |
| 122 | 122 | h.app.stop(); |
| 123 | 123 | }); |
| 124 | 124 | |
| 125 | test("a succeeded run offers no a and a press changes nothing", async () => { | |
| 125 | test("a succeeded run offers no r and a press changes nothing", async () => { | |
| 126 | 126 | const h = await open(alice, "ok"); |
| 127 | expect(h.hints()).not.toMatch(/a +run again/); | |
| 128 | const text = await h.press("a"); | |
| 127 | expect(h.hints()).not.toMatch(/r +queue it again/); | |
| 128 | const text = await h.press("r"); | |
| 129 | 129 | expect(text).not.toContain("Run again"); |
| 130 | 130 | expect(h.runs()).toHaveLength(1); |
| 131 | 131 | h.app.stop(); |
| 132 | 132 | }); |
| 133 | 133 | |
| 134 | test("a reader is not offered a and a press changes nothing", async () => { | |
| 134 | test("a reader is not offered r and a press changes nothing", async () => { | |
| 135 | 135 | const h = await open(bob); |
| 136 | expect(h.hints()).not.toMatch(/a +run again/); | |
| 137 | const text = await h.press("a"); | |
| 136 | expect(h.hints()).not.toMatch(/r +queue it again/); | |
| 137 | const text = await h.press("r"); | |
| 138 | 138 | expect(text).not.toContain("Run again"); |
| 139 | 139 | expect(h.runs()).toHaveLength(1); |
| 140 | 140 | h.app.stop(); |
| 141 | 141 | }); |
| 142 | 142 | |
| 143 | test("a closed issue is not offered a", async () => { | |
| 143 | test("a closed issue is not offered r", async () => { | |
| 144 | 144 | const h = await open(alice); |
| 145 | 145 | setIssueState(forge.db, h.issueId, "closed"); |
| 146 | 146 | await h.press("r"); |
| 147 | expect(h.hints()).not.toMatch(/a +run again/); | |
| 147 | expect(h.hints()).not.toMatch(/r +queue it again/); | |
| 148 | 148 | h.app.stop(); |
| 149 | 149 | }); |
| 150 | 150 | |
| 151 | 151 | test("a refusal after the confirm shows the action's words", async () => { |
| 152 | 152 | const h = await open(alice); |
| 153 | await h.press("a"); | |
| 153 | await h.press("r"); | |
| 154 | 154 | setIssueState(forge.db, h.issueId, "closed"); |
| 155 | 155 | await h.press("left"); |
| 156 | 156 | const text = await h.press("enter"); |
test/tui-runs-state.test.ts +4 −4
| @@ -63,17 +63,17 @@ test("s cycles All, Failed, Running, Succeeded and the list follows", async () = | ||
| 63 | 63 | let text = app.screen.toText(); |
| 64 | 64 | expect(text).toContain("GREEN-MARK"); |
| 65 | 65 | expect(text).toContain("RED-MARK"); |
| 66 | text = await press("s"); | |
| 66 | text = await press("/"); | |
| 67 | 67 | expect(text).toContain("Failed"); |
| 68 | 68 | expect(text).toContain("RED-MARK"); |
| 69 | 69 | expect(text).toContain("AGENT-RED-MARK"); |
| 70 | 70 | expect(text).not.toContain("GREEN-MARK"); |
| 71 | text = await press("s"); | |
| 71 | text = await press("/"); | |
| 72 | 72 | expect(text).toContain("No running runs"); |
| 73 | text = await press("s"); | |
| 73 | text = await press("/"); | |
| 74 | 74 | expect(text).toContain("GREEN-MARK"); |
| 75 | 75 | expect(text).not.toContain("RED-MARK"); |
| 76 | text = await press("s"); | |
| 76 | text = await press("/"); | |
| 77 | 77 | expect(text).toContain("GREEN-MARK"); |
| 78 | 78 | expect(text).toContain("RED-MARK"); |
| 79 | 79 | app.stop(); |
test/tui-steer.test.ts +16 −16
| @@ -95,7 +95,7 @@ async function open(user: User, push: (session: any, ctx: any) => any) { | ||
| 95 | 95 | return { app, press, type, text: () => app.screen.toText() }; |
| 96 | 96 | } |
| 97 | 97 | |
| 98 | test("S on the runs list sends the word to the running agent and says so", async () => { | |
| 98 | test("i on the runs list (take the wheel) sends the word to the running agent and says so", async () => { | |
| 99 | 99 | const { repo, runId } = await seed(); |
| 100 | 100 | const heard: string[] = []; |
| 101 | 101 | const stop = listenForSteer(runId, (t) => { |
| @@ -103,8 +103,8 @@ test("S on the runs list sends the word to the running agent and says so", async | ||
| 103 | 103 | return true; |
| 104 | 104 | }); |
| 105 | 105 | const h = await open(alice, (s, ctx) => runsScreen(s, ctx, repo)); |
| 106 | expect(h.text()).toMatch(/S +steer/); | |
| 107 | expect(await h.press("S")).toContain("Steer the run"); | |
| 106 | expect(h.text()).toMatch(/i +take the wheel/); | |
| 107 | expect(await h.press("i")).toContain("Steer the run"); | |
| 108 | 108 | await h.type("also add a test"); |
| 109 | 109 | const text = await h.press("enter"); |
| 110 | 110 | expect(heard).toEqual(["also add a test"]); |
| @@ -116,7 +116,7 @@ test("S on the runs list sends the word to the running agent and says so", async | ||
| 116 | 116 | test("with no session listening the word goes on the conversation", async () => { |
| 117 | 117 | const { repo, issue } = await seed(); |
| 118 | 118 | const h = await open(alice, (s, ctx) => runsScreen(s, ctx, repo)); |
| 119 | await h.press("S"); | |
| 119 | await h.press("i"); | |
| 120 | 120 | await h.type("try the other door"); |
| 121 | 121 | const text = await h.press("enter"); |
| 122 | 122 | expect(text).toContain("Commented."); |
| @@ -132,7 +132,7 @@ test("empty text is refused in place and nothing is said", async () => { | ||
| 132 | 132 | return true; |
| 133 | 133 | }); |
| 134 | 134 | const h = await open(alice, (s, ctx) => runsScreen(s, ctx, repo)); |
| 135 | await h.press("S"); | |
| 135 | await h.press("i"); | |
| 136 | 136 | await h.type(" "); |
| 137 | 137 | const text = await h.press("enter"); |
| 138 | 138 | expect(text).toContain("Steer the run"); |
| @@ -145,13 +145,13 @@ test("empty text is refused in place and nothing is said", async () => { | ||
| 145 | 145 | test("a finished run is not offered steering", async () => { |
| 146 | 146 | const { repo, issue } = await seed(true); |
| 147 | 147 | const h = await open(alice, (s, ctx) => runsScreen(s, ctx, repo)); |
| 148 | expect(h.text()).not.toMatch(/S +steer/); | |
| 149 | expect(await h.press("S")).not.toContain("Steer the run"); | |
| 148 | expect(h.text()).not.toMatch(/i +take the wheel/); | |
| 149 | expect(await h.press("i")).not.toContain("Steer the run"); | |
| 150 | 150 | expect(listComments(forge.db, issue.id)).toHaveLength(0); |
| 151 | 151 | h.app.stop(); |
| 152 | 152 | }); |
| 153 | 153 | |
| 154 | test("the issue's crew card steers with s", async () => { | |
| 154 | test("the issue's crew card takes the wheel with i, as the run list does", async () => { | |
| 155 | 155 | const { repo, issue, runId } = await seed(); |
| 156 | 156 | const heard: string[] = []; |
| 157 | 157 | const stop = listenForSteer(runId, (t) => { |
| @@ -160,8 +160,8 @@ test("the issue's crew card steers with s", async () => { | ||
| 160 | 160 | }); |
| 161 | 161 | const h = await open(alice, (s, ctx) => issueScreen(s, ctx, local(s, repo), issue.number)); |
| 162 | 162 | await h.press("tab"); |
| 163 | expect(h.text()).toMatch(/s +steer/); | |
| 164 | expect(await h.press("s")).toContain("Steer the run"); | |
| 163 | expect(h.text()).toMatch(/i +take the wheel/); | |
| 164 | expect(await h.press("i")).toContain("Steer the run"); | |
| 165 | 165 | await h.type("smaller steps"); |
| 166 | 166 | expect(await h.press("enter")).toContain("Sent."); |
| 167 | 167 | expect(heard).toEqual(["smaller steps"]); |
| @@ -169,7 +169,7 @@ test("the issue's crew card steers with s", async () => { | ||
| 169 | 169 | h.app.stop(); |
| 170 | 170 | }); |
| 171 | 171 | |
| 172 | test("the pull's Crew tab steers with s", async () => { | |
| 172 | test("the pull's Crew tab takes the wheel with i, as the run list does", async () => { | |
| 173 | 173 | const repo = await makeRepo(forge, alice, { name: `pull${n++}`, visibility: "public" }); |
| 174 | 174 | if (!repo.ok) throw new Error(String(repo.error)); |
| 175 | 175 | for (const branch of ["main", "topic"]) { |
| @@ -199,8 +199,8 @@ test("the pull's Crew tab steers with s", async () => { | ||
| 199 | 199 | } |
| 200 | 200 | await h.press("tab"); |
| 201 | 201 | await h.press("tab"); |
| 202 | expect(h.text()).toMatch(/s +steer/); | |
| 203 | expect(await h.press("s")).toContain("Steer the run"); | |
| 202 | expect(h.text()).toMatch(/i +take the wheel/); | |
| 203 | expect(await h.press("i")).toContain("Steer the run"); | |
| 204 | 204 | await h.type("one file at a time"); |
| 205 | 205 | expect(await h.press("enter")).toContain("Sent."); |
| 206 | 206 | expect(heard).toEqual(["one file at a time"]); |
| @@ -217,8 +217,8 @@ test("an agent session that may write is not offered steering", async () => { | ||
| 217 | 217 | return true; |
| 218 | 218 | }); |
| 219 | 219 | const h = await open(bot, (s, ctx) => runsScreen(s, ctx, repo)); |
| 220 | expect(h.text()).not.toMatch(/S +steer/); | |
| 221 | expect(await h.press("S")).not.toContain("Steer the run"); | |
| 220 | expect(h.text()).not.toMatch(/i +take the wheel/); | |
| 221 | expect(await h.press("i")).not.toContain("Steer the run"); | |
| 222 | 222 | expect(heard).toEqual([]); |
| 223 | 223 | stop(); |
| 224 | 224 | h.app.stop(); |
| @@ -238,7 +238,7 @@ test("a refusal reads as the run page and MCP read it", async () => { | ||
| 238 | 238 | if (!writers.ok) throw new Error("team failed"); |
| 239 | 239 | addTeamMember(forge.db, writers.value, c.value.id); |
| 240 | 240 | const h = await open(c.value, (s, ctx) => runsScreen(s, ctx, repo)); |
| 241 | await h.press("S"); | |
| 241 | await h.press("i"); | |
| 242 | 242 | await h.type("hello"); |
| 243 | 243 | // Her write access goes after the prompt opened: the action refuses. |
| 244 | 244 | removeTeamMember(forge.db, writers.value, c.value.id); |
test/tui-talk-build.test.ts +2 −2
| @@ -54,7 +54,7 @@ afterAll(async () => { | ||
| 54 | 54 | await rm(dir, { recursive: true, force: true }); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | test("n starts a build, Enter opens it, Enter shows a version's files, R restores it and P publishes", async () => { | |
| 57 | test("n starts a build, Enter opens it, Enter shows a version's files, U restores it and P publishes", async () => { | |
| 58 | 58 | const listed = await drive(alice, [...open, "n", "a recipe box", "\r"]); |
| 59 | 59 | const [mine] = buildsOf(app.db, alice.id); |
| 60 | 60 | expect(mine?.title).toBe("a recipe box"); |
| @@ -71,7 +71,7 @@ test("n starts a build, Enter opens it, Enter shows a version's files, R restore | ||
| 71 | 71 | expect(await drive(alice, [...open, "\r", "\r"])).toContain("page.txt"); |
| 72 | 72 | |
| 73 | 73 | // Restore makes a new version from the chosen one; the branch keeps both. |
| 74 | await drive(alice, [...open, "\r", "R", "\r"]); | |
| 74 | await drive(alice, [...open, "\r", "U", "\r"]); | |
| 75 | 75 | expect((await versionsIn(app, repo, build)).map((v) => v.subject)).toEqual(["Add recipes", "Restore v1"]); |
| 76 | 76 | |
| 77 | 77 | // Publish merges to main, where the page reads it. |
test/tui-talk-chats.test.ts +2 −2
| @@ -311,7 +311,7 @@ describe("the terminal's conversations screen", () => { | ||
| 311 | 311 | expect(text).not.toContain("Asks ·"); |
| 312 | 312 | }); |
| 313 | 313 | |
| 314 | test("turns are read when the chat opens and on r, not on every draw", async () => { | |
| 314 | test("turns are read when the chat opens and on R, not on every draw", async () => { | |
| 315 | 315 | const made = createConversation(app.db, bob.id); |
| 316 | 316 | if (!made.ok) throw new Error(made.error); |
| 317 | 317 | appendTurn(app.db, bob.id, made.value.id, { role: "person", text: "first words" }); |
| @@ -323,7 +323,7 @@ describe("the terminal's conversations screen", () => { | ||
| 323 | 323 | terminal.feed("p"); await settleApp(tui); |
| 324 | 324 | terminal.feed("p"); await settleApp(tui); |
| 325 | 325 | expect(tui.screen.toText()).not.toContain("later words"); |
| 326 | terminal.feed("r"); await settleApp(tui); | |
| 326 | terminal.feed("R"); await settleApp(tui); | |
| 327 | 327 | expect(tui.screen.toText()).toContain("later words"); |
| 328 | 328 | tui.stop?.(); |
| 329 | 329 | }); |
test/tui-workflows.test.ts +3 −3
| @@ -263,7 +263,7 @@ describe("reviews, threads and the merge gate", () => { | ||
| 263 | 263 | try { |
| 264 | 264 | await h.settle(); |
| 265 | 265 | await openThePull(h); |
| 266 | await h.press("R"); | |
| 266 | await h.press("b"); | |
| 267 | 267 | await h.until("Review #1"); |
| 268 | 268 | const card = h.text(); |
| 269 | 269 | expect(card).toContain("request changes"); |
| @@ -281,7 +281,7 @@ describe("reviews, threads and the merge gate", () => { | ||
| 281 | 281 | try { |
| 282 | 282 | await h.settle(); |
| 283 | 283 | await openThePull(h); |
| 284 | await h.press("R"); | |
| 284 | await h.press("b"); | |
| 285 | 285 | await h.until("Review #1"); |
| 286 | 286 | // Bob is not the author, so approving is on offer and is the default. |
| 287 | 287 | expect(h.text()).toContain("approve"); |
| @@ -347,7 +347,7 @@ describe("reviews, threads and the merge gate", () => { | ||
| 347 | 347 | try { |
| 348 | 348 | await reviewer.settle(); |
| 349 | 349 | await openThePull(reviewer); |
| 350 | await reviewer.press("R"); | |
| 350 | await reviewer.press("b"); | |
| 351 | 351 | await reviewer.until("Review #1"); |
| 352 | 352 | await reviewer.press("ctrl+d"); |
| 353 | 353 | await reviewer.settle(); |
test/tui-yours-asks.test.ts +2 −2
| @@ -114,7 +114,7 @@ describe("terminal On you: the week's asks", () => { | ||
| 114 | 114 | expect(await screen(alice)).toContain(asksMeasureWords(m)); |
| 115 | 115 | }); |
| 116 | 116 | |
| 117 | test("drawing reads the ledger on load, not on every frame: a later row waits for r", async () => { | |
| 117 | test("drawing reads the ledger on load, not on every frame: a later row waits for R", async () => { | |
| 118 | 118 | const t = await open(alice); |
| 119 | 119 | try { |
| 120 | 120 | const before = t.text(); |
| @@ -123,7 +123,7 @@ describe("terminal On you: the week's asks", () => { | ||
| 123 | 123 | t.app.frame(); |
| 124 | 124 | t.app.screen.toText(); |
| 125 | 125 | expect(t.text()).toContain("4 raised"); |
| 126 | await t.key("r"); | |
| 126 | await t.key("R"); | |
| 127 | 127 | expect(t.text()).toContain("5 raised"); |
| 128 | 128 | } finally { |
| 129 | 129 | t.app.stop(); |
test/web-code.test.ts +2 −2
| @@ -320,9 +320,9 @@ describe("the code browser on the web", () => { | ||
| 320 | 320 | |
| 321 | 321 | test("the finder is offered as an enhancement with the explorer behind it", async () => { |
| 322 | 322 | const html = await text("/alice/beacon/blob/main/src/lamp.ts"); |
| 323 | // The button that needs a script says so, and carries its shortcut. | |
| 323 | // The button that needs a script says so, and carries its shortcut: the keymap's f. | |
| 324 | 324 | expect(html).toContain('class="btn js-only"'); |
| 325 | expect(html).toContain('data-shortcut="t"'); | |
| 325 | expect(html).toContain('data-shortcut="f"'); | |
| 326 | 326 | expect(html).toContain('id="finder"'); |
| 327 | 327 | // The fallback is a real, populated tree of links in the same page. |
| 328 | 328 | expect(html).toContain('class="ex-file"'); |
new above
offline