Public: anyone can read this; the crew can change it.
The terminal gives up g: read again is R, each screen's own g a letter of its verb #17200
Merged 41h 22m ago, live in production
slice4a → main 0 commits 4 threads · 4 unresolved
45 files
changed +310
−111
- docs/features/ask-to-reach.md
- docs/features/boards-live.md
- docs/features/bottleneck.md
- docs/features/bring.md
- docs/features/check-slots.md
- docs/features/crew-devices.md
- docs/features/forge-origin.md
- docs/features/fork-flows.md
- docs/features/go-jumps.md
- docs/features/jobs.md
- docs/features/keymap.md
- docs/features/large-files.md
- docs/features/move-machine.md
- docs/features/security-osv.md
- src/tui/screens/about.ts
- src/tui/screens/autonomy.ts
- src/tui/screens/boards.ts
- src/tui/screens/bottleneck.ts
- src/tui/screens/crewdevices.ts
- src/tui/screens/dataset.ts
- src/tui/screens/dependencies.ts
- src/tui/screens/egress.ts
- src/tui/screens/forges.ts
- src/tui/screens/forkflows.ts
- src/tui/screens/games.ts
- src/tui/screens/hostreach.ts
- src/tui/screens/inventory.ts
- src/tui/screens/issue.ts
- src/tui/screens/jobs.ts
- src/tui/screens/largefiles.ts
- src/tui/screens/moved_key.ts
- src/tui/screens/system.ts
- src/web/keymap.ts
- test/egress-admin.test.ts
- test/keymap-terminal.test.ts
- test/keymap.test.ts
- test/move-machine-doors.test.ts
- test/tui-autonomy.test.ts
- test/tui-boards-rename.test.ts
- test/tui-crew-devices.test.ts
- test/tui-egress.test.ts
- test/tui-games.test.ts
- test/tui-issue-goahead.test.ts
- test/tui-origin-follow.test.ts
- test/tui-system.test.ts
docs/features/ask-to-reach.md +1 −1
| @@ -21,7 +21,7 @@ The pasted token waits with the ask, sealed like a connected account's token: fi | ||
| 21 | 21 | - **Home.** The line that says what needs you reads "ben-test asks to reach git.example.com to connect an origin (2 minutes ago)" with **Allow** and **Not now**. |
| 22 | 22 | - **Forges** (`/forges`). The ask is the first row under the forge's name, with **Allow**, **Allow for every hosted forge** and **Not now**. A grant reads "May also reach git.example.com" with **Remove this name**. |
| 23 | 23 | - **Settings, Hosted forges** (`/settings/hosted-forges#reach`). One sentence with a switch: "Hosted forges may reach the public git hosts (GitHub, GitLab, Codeberg, Bitbucket) and each other." Then "and also:", the names every hosted forge may reach, with a box to add one. Then "and for one forge only:", each forge's own grants and asks. The row that used to hold the switch on Settings, Usage, Capacity now points here. |
| 24 | - **In the terminal.** Open the palette (ctrl-k), "What hosted forges may reach": `a` allows for that forge, `e` for every hosted forge, `n` puts the ask aside, `x` takes a grant back, `g` reads again. | |
| 24 | - **In the terminal.** Open the palette (ctrl-k), "What hosted forges may reach": `a` allows for that forge, `e` for every hosted forge, `n` puts the ask aside, `x` takes a grant back, `R` reads again. | |
| 25 | 25 | |
| 26 | 26 | **A grant applies at once and restarts nothing.** The gate asks for the list on every connection (`childGate`, `src/spawn/child_reach.ts`), so Allow opens, and Remove or the switch closes, a forge that is running. |
| 27 | 27 |
docs/features/boards-live.md +1 −1
| @@ -16,4 +16,4 @@ The stream is `src/web/pages/boards-stream.ts`, which sends the frames and carri | ||
| 16 | 16 | |
| 17 | 17 | ## The view bar (#3695) |
| 18 | 18 | |
| 19 | At the top of a board: the time range (1h, 6h, 24h, 7d, 30d, All) and Live / Paused. Each is a link to the same board with `?range=` or `?live=` in the address, so a view is shared as a link and nothing is saved; "Back to the saved view" drops it. The range and refresh the board's file keeps are saved under "Board" at the bottom. The stream takes the same `?range=`. Compare to previous, custom ranges and variables are not built yet. In the terminal the same view is two keys on the board screen (`src/tui/screens/boards.ts`): `v` steps the range (1h, 6h, 24h, 7d, 30d, All) and `l` flips Live and Paused; the line under the title says "a view, not saved" and nothing is written. `g` still edits the saved range. | |
| 19 | At the top of a board: the time range (1h, 6h, 24h, 7d, 30d, All) and Live / Paused. Each is a link to the same board with `?range=` or `?live=` in the address, so a view is shared as a link and nothing is saved; "Back to the saved view" drops it. The range and refresh the board's file keeps are saved under "Board" at the bottom. The stream takes the same `?range=`. Compare to previous, custom ranges and variables are not built yet. In the terminal the same view is two keys on the board screen (`src/tui/screens/boards.ts`): `v` steps the range (1h, 6h, 24h, 7d, 30d, All) and `l` flips Live and Paused; the line under the title says "a view, not saved" and nothing is written. `t` still edits the saved range. |
docs/features/bottleneck.md +1 −1
| @@ -35,7 +35,7 @@ it. Two doors, one reading (`readBottleneck`): | ||
| 35 | 35 | on the page, in the terminal and in the MCP `bottleneck` reading (`host`: `{label, value}` rows, `ops`: |
| 36 | 36 | `{day, kind, who, what, why}`); the morning paper says how many came since its last line. |
| 37 | 37 | - **In the terminal** (admins, as the page): the palette's *Where the bottleneck is* shows the sentence, |
| 38 | a line a row, what the host is tuned to and the changes; `j`/`k` scroll, `g` reads again, `esc` goes back. | |
| 38 | a line a row, what the host is tuned to and the changes; `j`/`k` scroll, `R` reads again, `esc` goes back. | |
| 39 | 39 | |
| 40 | 40 | Code: `src/system/bottleneck.ts`, `src/system/ops_log.ts`, `src/system/host_tuning.ts`, `src/web/pages/bottleneck.ts`, |
| 41 | 41 | `src/tui/screens/bottleneck.ts`. |
docs/features/bring.md +1 −1
| @@ -54,5 +54,5 @@ most recently pushed first; the rest say "Not read yet" and are read on a later | ||
| 54 | 54 | visit. What was read is kept until the repository is pushed. |
| 55 | 55 | |
| 56 | 56 | - Terminal: the palette's "What is left to bring over"; `b` brings the row in, |
| 57 | `n` starts a new forge, `g` reads again. | |
| 57 | `n` starts a new forge, `R` reads again. | |
| 58 | 58 | - MCP: the `origins` tool, `action: inventory`, `id` an origin: the same rows. |
docs/features/check-slots.md +1 −1
| @@ -7,7 +7,7 @@ row: How many pull checks each repository is guaranteed at once | ||
| 7 | 7 | Every repository is guaranteed some of the forge's check slots (`checks.concurrency`) for its pull checks: 1 by default, more where one repository does most of the work (the forge's own, say 5 of 8). Within its slots a pull's check starts as soon as one is free. Above them a repository borrows a free slot only when more are free than the other waiting repositories are still owed, so an app with one pull waiting gets its slot at the next one that frees, and an idle forge lends every slot. Nothing running is ever stopped to make room; the longest a small app waits is one check. Main's checks, a rebase's check and the verify lane never wait on a grant. |
| 8 | 8 | |
| 9 | 9 | - **Settings** (`src/web/pages/settings.ts`, `#check-slots`): the repository's slots, how many of its pull checks run now and how many wait; shown while it has pull checks running or waiting, once its slots were set, or from /boards' link (`?check-slots`). Its admin may lower them; raising them is a site admin's. The grants above 1 together leave at least one slot for every app at 1 (on 8 slots: 5 for the forge, or 4 and 3, never 4 and 4). |
| 10 | - **The terminal** (`src/tui/screens/autonomy.ts`): the Autonomy screen says the slots and what runs now; `g` sets them. | |
| 10 | - **The terminal** (`src/tui/screens/autonomy.ts`): the Autonomy screen says the slots and what runs now; `C` sets them. | |
| 11 | 11 | - **Boards** (`src/web/pages/boards-slots.ts`): "Check slots by repository", shown while any pull check runs or waits, lists each such repository: used of its grant, borrowed, waiting. |
| 12 | 12 | - **A held check's log** says why, once: "queued, held: trevato/forge at its grant of 5; tess/app's 1 is reserved". |
| 13 | 13 |
docs/features/crew-devices.md +1 −1
| @@ -27,7 +27,7 @@ refused every change (`forbidden`, as on the pages); the forge's conversation ag | ||
| 27 | 27 | `add`, `grant` and `remove` before any of it runs. |
| 28 | 28 | |
| 29 | 29 | Both doors: Settings › Devices (`src/web/pages/crew_devices.ts`) and the terminal screen (`src/tui/screens/crewdevices.ts`, |
| 30 | palette entry *Devices* in a repository you administer: `a` lists, `g` grants, `x` unlists, `s` flips to the sessions) | |
| 30 | palette entry *Devices* in a repository you administer: `a` lists, `G` grants, `x` unlists, `s` flips to the sessions) | |
| 31 | 31 | use the same actions. A repository admin lists, unlists and reads; only a site admin grants; anyone else sees nothing. |
| 32 | 32 | Each write is an event, so an open page or screen follows. |
| 33 | 33 |
docs/features/forge-origin.md +1 −1
| @@ -28,7 +28,7 @@ Not yet, in order: follow upstream between forges with a pull back, and the one- | ||
| 28 | 28 | |
| 29 | 29 | ## Follow the forge it came from (#16069) |
| 30 | 30 | |
| 31 | A repository brought across with a connected origin (`migrate`) keeps the address it came from and the origin whose credential reads it. Under its head an admin sees the state ("Brought from <host>/<owner>/<name>; new commits there are not shown here") and one **Follow** button that opens a question and, answered, turns the upstream follow on (`src/origins/follow.ts`, `src/web/pages/origin-follow.ts`, `POST /:owner/:name/follow-origin`, which needs the confirming field); the same place says **Stop following** once it is on. The terminal's About screen (`src/tui/screens/about.ts`) has the same press on `g`, behind a confirm, through the same `setOriginFollow`, so a web viewer sees it live. A new commit on the source's default branch then shows as "N commits behind" at the next check (every 30 minutes, or "Check upstream now"), as a pack's follow does. The credential is the origin's, handed to git through the environment at check time, never argv or config; it is sent only to the origin's own https address (a test may allow a loopback address over http with `credentialOverLoopback`; production never does). | |
| 31 | A repository brought across with a connected origin (`migrate`) keeps the address it came from and the origin whose credential reads it. Under its head an admin sees the state ("Brought from <host>/<owner>/<name>; new commits there are not shown here") and one **Follow** button that opens a question and, answered, turns the upstream follow on (`src/origins/follow.ts`, `src/web/pages/origin-follow.ts`, `POST /:owner/:name/follow-origin`, which needs the confirming field); the same place says **Stop following** once it is on. The terminal's About screen (`src/tui/screens/about.ts`) has the same press on `F`, behind a confirm, through the same `setOriginFollow`, so a web viewer sees it live. A new commit on the source's default branch then shows as "N commits behind" at the next check (every 30 minutes, or "Check upstream now"), as a pack's follow does. The credential is the origin's, handed to git through the environment at check time, never argv or config; it is sent only to the origin's own https address (a test may allow a loopback address over http with `credentialOverLoopback`; production never does). | |
| 32 | 32 | |
| 33 | 33 | Both presses write a `repo.origin_follow` event for the admins' history. An origin that needs signing in again (or was disconnected) stops the follow at its next check and says so on the repository and in the check history; the offer then points to Origins until it is signed in. A mirror (a repository that syncs with its origin) is not offered this: its sweep already takes what is new. Test: `test/forge-origin-follow.test.ts`, two forges. |
| 34 | 34 |
docs/features/fork-flows.md +1 −1
| @@ -17,6 +17,6 @@ A fork you may not read is never named. | ||
| 17 | 17 | - Web: `/forks/flows` (signed in), linked from `/family` (signed in) and from a repository's forks page; `/forges` has no room for it. Source: `src/web/pages/fork-flows.ts`. |
| 18 | 18 | - API: `GET /api/v1/forks/flows` returns `{ follows, sent, offered }`. |
| 19 | 19 | - MCP: the tool `fork_flows`, with no arguments, returns the same. |
| 20 | - Terminal: the palette entry "Fork flows" (`src/tui/screens/forkflows.ts`); `g` reads again. | |
| 20 | - Terminal: the palette entry "Fork flows" (`src/tui/screens/forkflows.ts`); `R` reads again. | |
| 21 | 21 | |
| 22 | 22 | All four read `forkFlows` in `src/core/fork_flows.ts`. |
docs/features/go-jumps.md +1 −1
| @@ -20,4 +20,4 @@ Press `g`, then a letter within one second, from any page outside a field. Modif | ||
| 20 | 20 | - `g h`, `g q` and `g t` are the chords the top bar already wore (its hover hints show them), so they now work from anywhere and the sheet names them like the rest. |
| 21 | 21 | - Test: `test/keys-goto.test.ts` runs the real keys script against a fake document: stranger and user, the 1 s timeout, Ctrl/Meta, and a field. |
| 22 | 22 | |
| 23 | **Terminal:** none added. Terminal screens are reached by their own menus and print their keys in their footer line; `g` there already means "top" in lists or an action on a screen, so a global `g` chord would collide. | |
| 23 | **Terminal:** no screen binds `g` for an action of its own any more (each moved to a letter of its verb, and the old `g` says where it went until 2026-12-15, `docs/features/keymap.md`). Lists still take `g` as their top until the terminal's own `g` jumps arrive and take `g g` for the top. |
docs/features/jobs.md +1 −1
| @@ -9,7 +9,7 @@ A job is code that waits (`sleep`, `waitFor`) without a process, survives restar | ||
| 9 | 9 | 1. In a new app, open a note signed in and press **Remind me tomorrow** (`POST /notes/:id/remind`): a run of the `remind` job starts, loads the note, and waits a day for the note to be removed. |
| 10 | 10 | 2. Open the app on the forge: while the run holds a timer, its page has **Jobs → See the job runs** (`/:owner/:name/app/jobs`). The row says `waiting for removed:<id>, until <time> at the latest`. **Cancel** stops it; a failed run offers **Retry from the failed step**. |
| 11 | 11 | 3. The same from a script: `curl -H "authorization: Bearer $TOKEN" $FORGE_URL/api/v1/repos/<owner>/<name>/jobs`, `curl -X POST …/jobs/<run>/cancel`; the `app_deploy` MCP tool does it with `action: "jobs"`, `"cancel_job"` or `"retry_job"` (`name` is the run id). |
| 12 | 4. The terminal: with the app's repository open, the palette offers **Job runs** (a writer's, while the app holds a job timer); `c` cancels the run under the cursor, `t` retries a failed one, `g` reads again (`src/tui/screens/jobs.ts`). | |
| 12 | 4. The terminal: with the app's repository open, the palette offers **Job runs** (a writer's, while the app holds a job timer); `c` cancels the run under the cursor, `t` retries a failed one, `R` reads again (`src/tui/screens/jobs.ts`). | |
| 13 | 13 | 5. A run that fails for good (a step out of retries, or a changed job) asks the owner once. |
| 14 | 14 | |
| 15 | 15 | Where the code is: the runtime `src/jobs.ts` in the app template (`templates/app-template.json`; its tests, `src/jobs.test.ts`, run by `test/template-jobs.test.ts`), the forge's rows and steering `src/actions/jobs.ts`, `src/http/api/jobs.ts`, `src/web/studio/jobs.ts`, the no-retry answer in `src/apps/timer_fire.ts`, and the ask in `scheduleLines` (`src/actions/schedules.ts`). Tests: `test/jobs-doors.test.ts`. |
docs/features/keymap.md +15
| @@ -21,4 +21,19 @@ The owner, after the bridge: "tying together all the keybinds is really what im | ||
| 21 | 21 | - **Ranked lists, the space and /system:** /next's rows move with `T` top, `K` up, `J` down and `p` not now, on the page and in the terminal's Next up, where `P` pauses the planner; the space's canvas zooms with `+` and `-`, fits with `0`, jumps to now with `n` and steps bodies with `]` and `[`; /system's process table toggles CPU and memory with `S`, which each sort button carries as its hint. The terminal's cockpit puts a card off with `p` (later, the keymap's park), not `l`. Their old keys (`t` `u` `d` `l`, `c` `m`, the cockpit's `l`) say the new one until 2026-12-15. |
| 22 | 22 | - **/boards, /flow and Talk** bind no keys of their own: they answer the shell's moves and nothing fires while typing in Talk's box. The test now has no page left that chooses a key. |
| 23 | 23 | |
| 24 | ## The terminal gives up g | |
| 25 | ||
| 26 | No terminal screen takes `g` for a verb of its own, so `g` can start a jump there as it does on the web (`test/keymap-terminal.test.ts` holds it). "Read again" is `R` (the map's `reread`). Each screen's own `g` took a letter of its verb: | |
| 27 | ||
| 28 | - boards: `t` range; | |
| 29 | - an issue: `y` go ahead; | |
| 30 | - about: `F` follow where it came from; | |
| 31 | - egress: `a` grant, as an app's secrets grant (`x` takes either back); | |
| 32 | - games, crew devices: `G` grant (their `a` was taken); | |
| 33 | - autonomy: `C` check slots; | |
| 34 | - forges: `M` move to a machine; | |
| 35 | - System: `T` telemetry. | |
| 36 | ||
| 37 | The old `g` says where each went until 2026-12-15 (`src/tui/screens/moved_key.ts`). A list's own `g`/`G` (top, end) stays until the jump arrives and takes `g g` for the top. | |
| 38 | ||
| 24 | 39 | Proof: `test/keymap.test.ts`, `test/bridge.test.ts`. |
docs/features/large-files.md +1 −1
| @@ -9,7 +9,7 @@ A blob over the policy size (10 MB; set `FORGE_LARGE_BLOB_BYTES` to a whole numb | ||
| 9 | 9 | ## See them |
| 10 | 10 | |
| 11 | 11 | - Page: `/<owner>/<name>/large` reads the list the offload job saved after the last push (no scan on a request) and lists each blob, largest first: its path on the default branch, its size, its object id, and where it lives (`git`, or `git and store`). |
| 12 | - Terminal: open a repository, then the palette's "Large files" (`src/tui/screens/largefiles.ts`); `g` reads again. | |
| 12 | - Terminal: open a repository, then the palette's "Large files" (`src/tui/screens/largefiles.ts`); `R` reads again. | |
| 13 | 13 | |
| 14 | 14 | ## Download one |
| 15 | 15 |
docs/features/move-machine.md +1 −1
| @@ -17,7 +17,7 @@ really was. | ||
| 17 | 17 | It shows the plan (one sentence with the budget), asks, and then shows the |
| 18 | 18 | receipt. A forge that is on a machine also offers **Restore**, previewed with |
| 19 | 19 | the copy's time and what is lost. |
| 20 | - **Terminal, Forges screen**: `g` picks the forge, then the machine, shows | |
| 20 | - **Terminal, Forges screen**: `M` picks the forge, then the machine, shows | |
| 21 | 21 | the same plan on a confirm, and toasts the same receipt; `v` is the restore |
| 22 | 22 | from the newest copy, the same way (`src/tui/screens/forges.ts`). |
| 23 | 23 | - **MCP**: `forges` with `{ action: "move", forge, to }` previews; with |
docs/features/security-osv.md +1 −1
| @@ -8,7 +8,7 @@ row: "Dependency scan: a repository's lockfile against OSV advisories" | ||
| 8 | 8 | |
| 9 | 9 | **More feeds (#17141).** The same refresh also reads GHSA (`api.github.com/advisories`, reviewed npm advisories for the pins the forge holds, written into the mirror as OSV documents; an id OSV already supplied is kept) and rates any mirrored advisory that has a CVE id and no severity from NVD (`services.nvd.nist.gov`), then CVE.org (`cveawg.mitre.org`), by CVSS. NVD and CVE.org rate; they do not find, as they name no npm versions. Each CVE is asked about once, and at most 10 per pass. Both hosts are in `egress`; a gate refusal is reported in the gate's words. Anyone who can read the dependency scan (API or terminal) sees these findings; there is no separate page. Not built: a CISA KEV flag, GitHub token for a higher rate, paging past 100 GHSA hits per 25 pins. |
| 10 | 10 | |
| 11 | **Terminal:** open a repository, then the palette entry "Dependencies" (`src/tui/screens/dependencies.ts`): one row per finding, `g` reads again. It shows what the API shows, to whoever can read the repository, through the same cache and rate limit. | |
| 11 | **Terminal:** open a repository, then the palette entry "Dependencies" (`src/tui/screens/dependencies.ts`): one row per finding, `R` reads again. It shows what the API shows, to whoever can read the repository, through the same cache and rate limit. | |
| 12 | 12 | |
| 13 | 13 | **Load.** The report is held by commit oid and the mirror's stamp, so a repeat read costs a lookup; a client address may read 20 times a minute and the forge 300 (429 with `Retry-After` beyond), and one read takes at most 20 lockfiles and 30 MB. |
| 14 | 14 |
src/tui/screens/about.ts +4 −2
| @@ -15,6 +15,7 @@ | ||
| 15 | 15 | * card is an OSC 8 hyperlink besides. |
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | import { movedKey } from "./moved_key.ts"; | |
| 18 | 19 | import { ARCHIVE_DETAIL, RESTORE_DETAIL, archiveTitle, restoreTitle } from "../../core/archive-words.ts"; |
| 19 | 20 | import { sourcesScreen } from "./sources.ts"; |
| 20 | 21 | import type { Database } from "bun:sqlite"; |
| @@ -276,7 +277,7 @@ export function aboutScreen( | ||
| 276 | 277 | ] |
| 277 | 278 | : []), |
| 278 | 279 | ...(brought() !== undefined |
| 279 | ? [binding(["g"], brought()?.following ? "stop following where it came from" : "follow where it came from")] | |
| 280 | ? [binding(["F"], brought()?.following ? "stop following where it came from" : "follow where it came from")] | |
| 280 | 281 | : []), |
| 281 | 282 | ...(may() && repo?.origin === null ? [binding(["s"], "followed sources")] : []), |
| 282 | 283 | // Who can read it is a person's, an admin's call (#8008). |
| @@ -730,7 +731,8 @@ export function aboutScreen( | ||
| 730 | 731 | return true; |
| 731 | 732 | } |
| 732 | 733 | const offer = brought(); |
| 733 | if (e.key === "g" && repo !== undefined && offer !== undefined) { | |
| 734 | if (repo !== undefined && offer !== undefined && movedKey(ctx, e, "g", "F follows now")) return true; | |
| 735 | if (e.key === "F" && repo !== undefined && offer !== undefined) { | |
| 734 | 736 | const at = repo; |
| 735 | 737 | const on = !offer.following; |
| 736 | 738 | ctx.push( |
src/tui/screens/autonomy.ts +4 −2
| @@ -14,6 +14,7 @@ | ||
| 14 | 14 | * Anyone else gets no palette entry and, if the screen is reached, no values. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | import { movedKey } from "./moved_key.ts"; | |
| 17 | 18 | import { mayRaiseCeiling, raiseCrewCeiling } from "../../actions/crew_ceiling.ts"; |
| 18 | 19 | import { checkPool, setCheckSlots } from "../../actions/check_slots.ts"; |
| 19 | 20 | import { pullChecksOf } from "../../checks/check_slots.ts"; |
| @@ -128,7 +129,7 @@ export function autonomyScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 128 | 129 | title: "Autonomy", |
| 129 | 130 | get keys() { |
| 130 | 131 | return mayChange() |
| 131 | ? [binding(["m"], "mode"), binding(["p"], "planner"), binding(["s"], "builder"), binding(["r"], "reviewer"), binding(["o"], "polish share"), binding(["g"], "check slots"), ...(mayRaiseCeiling(f.app, f.user) ? [binding(["c"], "raise ceiling")] : [])] | |
| 132 | ? [binding(["m"], "mode"), binding(["p"], "planner"), binding(["s"], "builder"), binding(["r"], "reviewer"), binding(["o"], "polish share"), binding(["C"], "check slots"), ...(mayRaiseCeiling(f.app, f.user) ? [binding(["c"], "raise ceiling")] : [])] | |
| 132 | 133 | : []; |
| 133 | 134 | }, |
| 134 | 135 | render(area, s) { |
| @@ -217,7 +218,8 @@ export function autonomyScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 217 | 218 | ); |
| 218 | 219 | return true; |
| 219 | 220 | } |
| 220 | if (e.key === "g") { | |
| 221 | if (movedKey(ctx, e, "g", "C sets the check slots now")) return true; | |
| 222 | if (e.key === "C") { | |
| 221 | 223 | ask("Check slots", "pull checks guaranteed at once, 1 or more", "1 or more", String(current().checkSlots), (raw) => { |
| 222 | 224 | const n = /^\d{1,2}$/.test(raw) ? Number(raw) : Number.NaN; |
| 223 | 225 | const set = setCheckSlots(f.app, f.user, current(), n); |
src/tui/screens/boards.ts +6 −4
| @@ -3,7 +3,7 @@ | ||
| 3 | 3 | * keeps, then one board's panels as text. It reads through the same |
| 4 | 4 | * `listAllBoards` and `showBoard` the page and the API do, so the gate is the |
| 5 | 5 | * action's (an agent or anyone else is told nothing); the palette offers the |
| 6 | * door only to that person. `n` makes a board, `c` copies the marked one, `e` renames it and `g` | |
| 6 | * door only to that person. `n` makes a board, `c` copies the marked one, `e` renames it and `t` | |
| 7 | 7 | * sets its range (`changeBoard`; `home` still jumps to the top), and `D` deletes it after `y/n` |
| 8 | 8 | * (`actions/boards.ts`, as the page does). Otherwise reading, but for pins: a chart is not drawn, a |
| 9 | 9 | * panel is said as its title, chart, size and the query that feeds it, then what `panelData` reads |
| @@ -14,6 +14,7 @@ | ||
| 14 | 14 | * so a panel that moved says how many points and its latest value (`liveWords`). |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | import { movedKey } from "./moved_key.ts"; | |
| 17 | 18 | import { formatValue } from "../../boards/chart.ts"; |
| 18 | 19 | import { keyOf } from "../../web/keymap.ts"; |
| 19 | 20 | import { watchBoard, type Frame } from "../../boards/live_hub.ts"; |
| @@ -345,7 +346,7 @@ export function boardsScreen(f: Session, ctx: Ctx): Screen { | ||
| 345 | 346 | get keys() { |
| 346 | 347 | return [ |
| 347 | 348 | binding(["j", "k"], "move"), binding(["enter"], "open"), binding(["n"], "new"), binding(["c"], "copy"), |
| 348 | ...(mayEdit ? [binding(["e"], "rename"), binding(["g"], "range")] : []), | |
| 349 | ...(mayEdit ? [binding(["e"], "rename"), binding(["t"], "range")] : []), | |
| 349 | 350 | binding(["D"], "delete"), binding([keyOf("reread")], "refresh"), |
| 350 | 351 | ]; |
| 351 | 352 | }, |
| @@ -375,8 +376,9 @@ export function boardsScreen(f: Session, ctx: Ctx): Screen { | ||
| 375 | 376 | } |
| 376 | 377 | return true; |
| 377 | 378 | } |
| 378 | // Before the list's own keys: `g` would jump to the top. | |
| 379 | if (mayEdit && (e.key === "e" || e.key === "g")) { | |
| 379 | // Before the list's own keys: `t` sets the range (`g` until 12-15 says so). | |
| 380 | if (mayEdit && movedKey(ctx, e, "g", "t sets the range now")) return true; | |
| 381 | if (mayEdit && (e.key === "e" || e.key === "t")) { | |
| 380 | 382 | const row = rows[state.index]; |
| 381 | 383 | if (row !== undefined) edit(row, e.key === "e" ? "title" : "range"); |
| 382 | 384 | return true; |
src/tui/screens/bottleneck.ts +3 −2
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | * (`readBottleneck`). Gated as the page is: a forge admin who is a person. Read-only. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { keyOf } from "../../web/keymap.ts"; | |
| 7 | 8 | import { telemetryReader } from "../../actions/telemetry.ts"; |
| 8 | 9 | import { readBottleneck, type Bottleneck } from "../../system/bottleneck.ts"; |
| 9 | 10 | import { live } from "../../system/live.ts"; |
| @@ -42,7 +43,7 @@ export function bottleneckScreen(session: Session, ctx: Ctx): Screen { | ||
| 42 | 43 | let lines = bottleneckLines(session); |
| 43 | 44 | return { |
| 44 | 45 | title: "Where the bottleneck is", |
| 45 | keys: [binding(["j", "k"], "scroll"), binding(["g"], "read again"), binding(["esc", "q"], "back")], | |
| 46 | keys: [binding(["j", "k"], "scroll"), binding([keyOf("reread")], "read again"), binding(["esc", "q"], "back")], | |
| 46 | 47 | render(area, s) { |
| 47 | 48 | const c = ctx.theme.c; |
| 48 | 49 | drawLines(s, area, c, scroll, lines.map((text) => [{ text, style: style(text.startsWith(" ") ? c.mutedFg : c.fg, c.bg) }])); |
| @@ -50,7 +51,7 @@ export function bottleneckScreen(session: Session, ctx: Ctx): Screen { | ||
| 50 | 51 | }, |
| 51 | 52 | key(e) { |
| 52 | 53 | if (scroll.key(e, lines.length)) return true; |
| 53 | if (e.key === "g") { | |
| 54 | if (e.key === keyOf("reread")) { | |
| 54 | 55 | lines = bottleneckLines(session); |
| 55 | 56 | return true; |
| 56 | 57 | } |
src/tui/screens/crewdevices.ts +7 −5
| @@ -3,12 +3,13 @@ | ||
| 3 | 3 | * block (`web/pages/crew_devices.ts`) from the same actions |
| 4 | 4 | * (`actions/crew_devices.ts`), gated the same way. A repository's admin sees |
| 5 | 5 | * the devices and the sessions and may list (`a`) and unlist (`x`) one; only a |
| 6 | * site admin may grant (`g`), pinning the host key the device shows; anyone | |
| 6 | * site admin may grant (`G`), pinning the host key the device shows; anyone | |
| 7 | 7 | * else sees nothing. `s` flips between the devices and the sessions the crew |
| 8 | 8 | * made. Each write is an event on the bus, so the open settings page redraws |
| 9 | 9 | * and this screen follows a write made there. |
| 10 | 10 | */ |
| 11 | 11 | |
| 12 | import { movedKey } from "./moved_key.ts"; | |
| 12 | 13 | import { |
| 13 | 14 | addCrewDevice, |
| 14 | 15 | devicesView, |
| @@ -73,7 +74,7 @@ export function crewDevicesScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 73 | 74 | binding(["j", "k"], "move cursor"), |
| 74 | 75 | binding(["s"], showSessions ? "devices" : "sessions"), |
| 75 | 76 | ...(may ? [binding(["a"], "list a device"), binding(["x"], "unlist")] : []), |
| 76 | ...(may && view().canGrant ? [binding(["g"], "grant")] : []), | |
| 77 | ...(may && view().canGrant ? [binding(["G"], "grant")] : []), | |
| 77 | 78 | ]; |
| 78 | 79 | }, |
| 79 | 80 | async load(signal) { |
| @@ -89,7 +90,7 @@ export function crewDevicesScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 89 | 90 | : showSessions |
| 90 | 91 | ? "ssh sessions the crew reported: their own note, not an audit. s shows the devices." |
| 91 | 92 | : v.canGrant |
| 92 | ? "Devices a run may ssh to. a lists one, g grants it, x unlists." | |
| 93 | ? "Devices a run may ssh to. a lists one, G grants it, x unlists." | |
| 93 | 94 | : "Devices a run may reach. a lists one, x unlists. Only a site admin grants."; |
| 94 | 95 | s.text(head!.x, head!.y, truncate(note, head!.w), style(c.mutedFg, c.bg), head!.x + head!.w); |
| 95 | 96 | drawList(s, list!, c, state, rows()); |
| @@ -98,7 +99,8 @@ export function crewDevicesScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 98 | 99 | const all = view(); |
| 99 | 100 | const count = showSessions ? all.sessions.length : all.devices.length; |
| 100 | 101 | if (e.ctrl || e.alt) return false; |
| 101 | if (e.key !== "s" && e.key !== "a" && e.key !== "x" && e.key !== "g") return state.key(e, count); | |
| 102 | if (movedKey(ctx, e, "g", "G grants now")) return true; | |
| 103 | if (e.key !== "s" && e.key !== "a" && e.key !== "x" && e.key !== "G") return state.key(e, count); | |
| 102 | 104 | if (e.key === "s") { |
| 103 | 105 | showSessions = !showSessions; |
| 104 | 106 | state.clamp(showSessions ? all.sessions.length : all.devices.length); |
| @@ -133,7 +135,7 @@ export function crewDevicesScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 133 | 135 | } |
| 134 | 136 | const at = showSessions ? undefined : all.devices[state.index]; |
| 135 | 137 | if (at === undefined) return true; |
| 136 | if (e.key === "g") { | |
| 138 | if (e.key === "G") { | |
| 137 | 139 | if (!all.canGrant) { |
| 138 | 140 | ctx.toast(ERRORS["forbidden"]!, "danger"); |
| 139 | 141 | return true; |
src/tui/screens/dataset.ts +3 −2
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | * them. Gated as the page is: a forge admin who is a person. Read-only. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { keyOf } from "../../web/keymap.ts"; | |
| 7 | 8 | import { datasetAnswers, lastExport } from "../../actions/dataset.ts"; |
| 8 | 9 | import { datasetStats } from "../../core/dataset.ts"; |
| 9 | 10 | import type { Ctx, Screen } from "../app/app.ts"; |
| @@ -39,7 +40,7 @@ export function datasetScreen(session: Session, ctx: Ctx): Screen { | ||
| 39 | 40 | let lines = datasetLines(session); |
| 40 | 41 | return { |
| 41 | 42 | title: "Dataset", |
| 42 | keys: [binding(["j", "k"], "scroll"), binding(["g"], "read again"), binding(["esc", "q"], "back")], | |
| 43 | keys: [binding(["j", "k"], "scroll"), binding([keyOf("reread")], "read again"), binding(["esc", "q"], "back")], | |
| 43 | 44 | render(area, s) { |
| 44 | 45 | const c = ctx.theme.c; |
| 45 | 46 | drawLines(s, area, c, scroll, lines.map((text) => [{ text, style: style(text.startsWith(" ") ? c.mutedFg : c.fg, c.bg) }])); |
| @@ -47,7 +48,7 @@ export function datasetScreen(session: Session, ctx: Ctx): Screen { | ||
| 47 | 48 | }, |
| 48 | 49 | key(e) { |
| 49 | 50 | if (scroll.key(e, lines.length)) return true; |
| 50 | if (e.key === "g") { | |
| 51 | if (e.key === keyOf("reread")) { | |
| 51 | 52 | lines = datasetLines(session); |
| 52 | 53 | return true; |
| 53 | 54 | } |
src/tui/screens/dependencies.ts +4 −3
| @@ -2,9 +2,10 @@ | ||
| 2 | 2 | * A repository's dependency findings, in the terminal (#6004): the report behind |
| 3 | 3 | * `GET /api/v1/repos/:owner/:name/dependencies` (`security/report_cache.ts`, so the API and this |
| 4 | 4 | * screen share one cached read and one rate limit), gated the same way — anyone who can read the |
| 5 | * repository sees it. `g` reads again. | |
| 5 | * repository sees it. `R` reads again (the keymap's reread). | |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | import { keyOf } from "../../web/keymap.ts"; | |
| 8 | 9 | import { requireReader } from "../../actions/access.ts"; |
| 9 | 10 | import type { Repo } from "../../core/repos.ts"; |
| 10 | 11 | import { repoDir } from "../../git/repos.ts"; |
| @@ -48,7 +49,7 @@ export function dependenciesScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 48 | 49 | const again = (): void => void read().catch(() => (note = "The lockfiles could not be read.")).finally(() => ctx.invalidate()); |
| 49 | 50 | return { |
| 50 | 51 | title: `${repo.ownerName}/${repo.name} — Dependencies`, |
| 51 | keys: [binding(["j", "k"], "move cursor"), binding(["g"], "read again")], | |
| 52 | keys: [binding(["j", "k"], "move cursor"), binding([keyOf("reread")], "read again")], | |
| 52 | 53 | async load() { |
| 53 | 54 | again(); |
| 54 | 55 | }, |
| @@ -60,7 +61,7 @@ export function dependenciesScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 60 | 61 | }, |
| 61 | 62 | key(e) { |
| 62 | 63 | if (state.key(e, report?.findings.length ?? 0)) return true; |
| 63 | if (e.ctrl || e.alt || e.key !== "g") return false; | |
| 64 | if (e.ctrl || e.alt || e.key !== keyOf("reread")) return false; | |
| 64 | 65 | again(); |
| 65 | 66 | return true; |
| 66 | 67 | }, |
src/tui/screens/egress.ts +6 −4
| @@ -1,10 +1,11 @@ | ||
| 1 | 1 | /** |
| 2 | 2 | * An app's private destinations in the terminal, a site admin's: the list the |
| 3 | * settings page shows, with `g` to grant the one under the cursor once `y` | |
| 3 | * settings page shows, with `a` to grant the one under the cursor once `y` | |
| 4 | 4 | * confirms it (a grant widens the boundary) and `x` to revoke it once `y` |
| 5 | 5 | * confirms that too. The actions decide who may; anyone else is offered nothing. |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | import { movedKey } from "./moved_key.ts"; | |
| 8 | 9 | import { |
| 9 | 10 | egressView, |
| 10 | 11 | grantAppEgress, |
| @@ -58,7 +59,7 @@ export function egressScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 58 | 59 | title: "Private egress", |
| 59 | 60 | get keys() { |
| 60 | 61 | return [ |
| 61 | ...(canChange ? [binding(["g"], "grant"), binding(["x"], "revoke")] : []), | |
| 62 | ...(canChange ? [binding(["a"], "grant"), binding(["x"], "revoke")] : []), | |
| 62 | 63 | binding(["j", "k"], "move cursor"), |
| 63 | 64 | ]; |
| 64 | 65 | }, |
| @@ -74,7 +75,8 @@ export function egressScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 74 | 75 | }, |
| 75 | 76 | key(e) { |
| 76 | 77 | const row = canChange ? rows[state.index] : undefined; |
| 77 | if (e.key === "g" && row !== undefined) { | |
| 78 | if (row !== undefined && movedKey(ctx, e, "g", "a grants now")) return true; | |
| 79 | if (e.key === "a" && row !== undefined) { | |
| 78 | 80 | if (row.granted) return true; |
| 79 | 81 | const { destination } = row; |
| 80 | 82 | ctx.push( |
| @@ -97,7 +99,7 @@ export function egressScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 97 | 99 | ctx.push( |
| 98 | 100 | confirmScreen(ctx, screen, { |
| 99 | 101 | title: `Stop ${repo.ownerName}/${repo.name} reaching ${destination}?`, |
| 100 | body: ["The app's outbound traffic to it is refused until g grants it again."], | |
| 102 | body: ["The app's outbound traffic to it is refused until a grants it again."], | |
| 101 | 103 | actions: [{ label: "Revoke", variant: "danger" }, { label: "Cancel", variant: "ghost" }], |
| 102 | 104 | yesNo: true, |
| 103 | 105 | width: 78, |
src/tui/screens/forges.ts +4 −2
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | * claim link; that stays on the page. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { movedKey } from "./moved_key.ts"; | |
| 7 | 8 | import type { Ctx, Screen } from "../app/app.ts"; |
| 8 | 9 | import { binding } from "../app/keys.ts"; |
| 9 | 10 | import { rowActivityWords, sentWords } from "../../spawn/client_words.ts"; |
| @@ -390,7 +391,7 @@ export function forgesScreen(ctx: Ctx, rows: readonly ClientRow[], session?: Ses | ||
| 390 | 391 | }; |
| 391 | 392 | const screen: Screen = { |
| 392 | 393 | title: "Forges you sent", |
| 393 | keys: [binding(["s"], "stop"), binding(["a"], "archive"), binding(["r"], "restore"), binding(["x"], "remove"), binding(["n"], "new link"), binding(["l"], "end a link"), binding(["u"], "undo an ended link"), binding(["o"], "own code or this forge's"), binding(["m"], "move"), binding(["g"], "move to a machine"), binding(["v"], "restore from the newest copy"), binding(["e"], "upgrade a shared forge"), binding(["h"], "machines' heartbeats"), binding(["w"], "raise to xlarge"), binding(["f"], "state"), binding(["/"], "search"), binding(["c"], "csv"), binding(["esc"], "close")], | |
| 394 | keys: [binding(["s"], "stop"), binding(["a"], "archive"), binding(["r"], "restore"), binding(["x"], "remove"), binding(["n"], "new link"), binding(["l"], "end a link"), binding(["u"], "undo an ended link"), binding(["o"], "own code or this forge's"), binding(["m"], "move"), binding(["M"], "move to a machine"), binding(["v"], "restore from the newest copy"), binding(["e"], "upgrade a shared forge"), binding(["h"], "machines' heartbeats"), binding(["w"], "raise to xlarge"), binding(["f"], "state"), binding(["/"], "search"), binding(["c"], "csv"), binding(["esc"], "close")], | |
| 394 | 395 | render(area, s) { |
| 395 | 396 | const c = ctx.theme.c; |
| 396 | 397 | const w = Math.min(100, Math.max(30, area.w - 6)); |
| @@ -454,7 +455,8 @@ export function forgesScreen(ctx: Ctx, rows: readonly ClientRow[], session?: Ses | ||
| 454 | 455 | }), |
| 455 | 456 | ); |
| 456 | 457 | } else if (e.key === "m") sandboxOne(); |
| 457 | else if (e.key === "g") machineOne(false); | |
| 458 | else if (e.key === "M") machineOne(false); | |
| 459 | else if (e.key === "g") movedKey(ctx, e, "g", "M moves it to a machine now"); | |
| 458 | 460 | else if (e.key === "v") machineOne(true); |
| 459 | 461 | else if (e.key === "e") upgradeOne(); |
| 460 | 462 | else if (e.key === "h") machinesSeen(); |
src/tui/screens/forkflows.ts +3 −2
| @@ -4,6 +4,7 @@ | ||
| 4 | 4 | * behind /forks/flows, GET /api/v1/forks/flows and MCP `fork_flows` (#17056); stored state only. |
| 5 | 5 | */ |
| 6 | 6 | |
| 7 | import { keyOf } from "../../web/keymap.ts"; | |
| 7 | 8 | import { agoWords } from "../../actions/follow_words.ts"; |
| 8 | 9 | import { EMPTY_WORDS } from "../../core/empty_words.ts"; |
| 9 | 10 | import { forkFlows, type ForkFlows } from "../../core/fork_flows.ts"; |
| @@ -29,7 +30,7 @@ export function forkFlowsScreen(f: Session, ctx: Ctx): Screen { | ||
| 29 | 30 | let shown = rows(); |
| 30 | 31 | const screen: Screen = { |
| 31 | 32 | title: "Fork flows", |
| 32 | keys: [binding(["j", "k"], "move cursor"), binding(["g"], "read again")], | |
| 33 | keys: [binding(["j", "k"], "move cursor"), binding([keyOf("reread")], "read again")], | |
| 33 | 34 | render(area, s) { |
| 34 | 35 | const c = ctx.theme.c; |
| 35 | 36 | const [, body] = split(area, "v", [len(1), fill(1)]); |
| @@ -41,7 +42,7 @@ export function forkFlowsScreen(f: Session, ctx: Ctx): Screen { | ||
| 41 | 42 | }, |
| 42 | 43 | key(e) { |
| 43 | 44 | if (state.key(e, shown.length)) return true; |
| 44 | if (e.ctrl || e.alt || e.key !== "g") return false; | |
| 45 | if (e.ctrl || e.alt || e.key !== keyOf("reread")) return false; | |
| 45 | 46 | shown = rows(); |
| 46 | 47 | state.clamp(shown.length); |
| 47 | 48 | ctx.invalidate(); |
src/tui/screens/games.ts +10 −6
| @@ -5,9 +5,10 @@ | ||
| 5 | 5 | * opens a service as /games/<box>/<service> does: its console (the log tail, and `:` queues an |
| 6 | 6 | * rcon command), its env (`e` sets or clears a key, committed through `commitServiceEnv`) and its |
| 7 | 7 | * plugins (`a` adds a Modrinth slug or a URL through `addPlugin`; uploading a jar is the page's |
| 8 | * alone). `g` opens the box's grants, which an owner sets with `a`, through `grant`. | |
| 8 | * alone). `G` opens the box's grants, which an owner sets with `a` there, through `grant`. | |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | import { movedKey } from "./moved_key.ts"; | |
| 11 | 12 | import { emptyText } from "../../core/empty_words.ts"; |
| 12 | 13 | import { boxStatus, boxStatusShared } from "../../games/diag.ts"; |
| 13 | 14 | import { getUserByName } from "../../core/users.ts"; |
| @@ -51,7 +52,7 @@ export function gamesScreen(f: Session, ctx: Ctx): Screen { | ||
| 51 | 52 | keys: [ |
| 52 | 53 | binding(["j", "k"], "move cursor"), |
| 53 | 54 | binding(["enter"], "console, env, plugins"), |
| 54 | binding(["g"], "grants"), | |
| 55 | binding(["G"], "grants"), | |
| 55 | 56 | binding(["s"], "start"), |
| 56 | 57 | binding(["x"], "stop"), |
| 57 | 58 | binding(["r"], "restart"), |
| @@ -87,16 +88,19 @@ export function gamesScreen(f: Session, ctx: Ctx): Screen { | ||
| 87 | 88 | }, |
| 88 | 89 | key(e) { |
| 89 | 90 | const all = rows(); |
| 91 | // Before the list's own keys, which would take g and G as top and end. | |
| 92 | const here = all[state.index]; | |
| 93 | if (here !== undefined && movedKey(ctx, e, "g", "G opens the grants now")) return true; | |
| 94 | if (here !== undefined && !e.ctrl && !e.alt && e.key === "G") { | |
| 95 | ctx.push(gameGrantsScreen(f, ctx, here.box)); | |
| 96 | return true; | |
| 97 | } | |
| 90 | 98 | if (state.key(e, all.length)) return true; |
| 91 | 99 | const at = all[state.index]; |
| 92 | 100 | if (at !== undefined && !e.ctrl && !e.alt && e.key === "enter") { |
| 93 | 101 | ctx.push(gameServiceScreen(f, ctx, at.box, at.service.name)); |
| 94 | 102 | return true; |
| 95 | 103 | } |
| 96 | if (at !== undefined && !e.ctrl && !e.alt && e.key === "g") { | |
| 97 | ctx.push(gameGrantsScreen(f, ctx, at.box)); | |
| 98 | return true; | |
| 99 | } | |
| 100 | 104 | const kind: CommandKind | undefined = e.key === "s" ? "start" : e.key === "x" ? "stop" : e.key === "r" ? "restart" : undefined; |
| 101 | 105 | if (kind === undefined || at === undefined || e.ctrl || e.alt) return false; |
| 102 | 106 | if (!mayDo(roleOn(f.app.db, f.user, at.box.id, at.service.name), "operator")) note = `You are not an operator of ${at.service.name}.`; |
src/tui/screens/hostreach.ts +4 −3
| @@ -5,9 +5,10 @@ | ||
| 5 | 5 | * ask: `a` allows it for that forge, `e` for every hosted forge, `n` puts it |
| 6 | 6 | * aside. On a grant: `x` takes it back. Each write is an event and applies to |
| 7 | 7 | * a running forge at once; the screen reads again after its own writes and |
| 8 | * with `g`. | |
| 8 | * with `R` (the keymap's reread). | |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | import { keyOf } from "../../web/keymap.ts"; | |
| 11 | 12 | import { |
| 12 | 13 | allowReach, |
| 13 | 14 | putAsideReach, |
| @@ -103,7 +104,7 @@ export function hostReachScreen(f: Session, ctx: Ctx): Screen { | ||
| 103 | 104 | binding(["e"], "allow for every forge"), |
| 104 | 105 | binding(["n"], "not now"), |
| 105 | 106 | binding(["x"], "take a grant back"), |
| 106 | binding(["g"], "read again"), | |
| 107 | binding([keyOf("reread")], "read again"), | |
| 107 | 108 | ], |
| 108 | 109 | async load() { |
| 109 | 110 | await read(); |
| @@ -135,7 +136,7 @@ export function hostReachScreen(f: Session, ctx: Ctx): Screen { | ||
| 135 | 136 | const lines = view === undefined ? [] : reachLines(view); |
| 136 | 137 | if (state.key(e, lines.length)) return true; |
| 137 | 138 | if (e.ctrl || e.alt) return false; |
| 138 | if (e.key === "g") { | |
| 139 | if (e.key === keyOf("reread")) { | |
| 139 | 140 | void read(); |
| 140 | 141 | return true; |
| 141 | 142 | } |
src/tui/screens/inventory.ts +3 −2
| @@ -6,6 +6,7 @@ | ||
| 6 | 6 | * `o` opens it here once it is. Offered to whoever is signed in, as the page. |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | import { keyOf } from "../../web/keymap.ts"; | |
| 9 | 10 | import { holds, inventoryOfOrigins, type InventoryItem } from "../../actions/inventory.ts"; |
| 10 | 11 | import { listUserOrigins } from "../../actions/origins.ts"; |
| 11 | 12 | import { STATE_WORDS } from "../../origins/inventory.ts"; |
| @@ -45,7 +46,7 @@ export function inventoryScreen(f: Session, ctx: Ctx): Screen { | ||
| 45 | 46 | |
| 46 | 47 | return { |
| 47 | 48 | title: "What is left to bring over", |
| 48 | keys: [binding(["j", "k"], "move cursor"), binding(["b"], "bring in"), binding(["n"], "new forge"), binding(["g"], "read again")], | |
| 49 | keys: [binding(["j", "k"], "move cursor"), binding(["b"], "bring in"), binding(["n"], "new forge"), binding([keyOf("reread")], "read again")], | |
| 49 | 50 | render(area, s) { |
| 50 | 51 | const c = ctx.theme.c; |
| 51 | 52 | const [head, body] = split(area, "v", [len(1), fill(1)]); |
| @@ -66,7 +67,7 @@ export function inventoryScreen(f: Session, ctx: Ctx): Screen { | ||
| 66 | 67 | key(e) { |
| 67 | 68 | if (state.key(e, items.length)) return true; |
| 68 | 69 | if (e.ctrl || e.alt) return false; |
| 69 | if (e.key === "g") { | |
| 70 | if (e.key === keyOf("reread")) { | |
| 70 | 71 | load(); |
| 71 | 72 | return true; |
| 72 | 73 | } |
src/tui/screens/issue.ts +6 −4
| @@ -14,6 +14,7 @@ | ||
| 14 | 14 | * hook needed. |
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | import { movedKey } from "./moved_key.ts"; | |
| 17 | 18 | import { outsideClause } from "../../web/outside.ts"; |
| 18 | 19 | import { keyOf } from "../../web/keymap.ts"; |
| 19 | 20 | import { putFlowFirst } from "../../actions/flow_first.ts"; |
| @@ -212,7 +213,7 @@ export function issueScreen( | ||
| 212 | 213 | /** The text `e` opened the editor with; set while the composer edits, not comments. */ |
| 213 | 214 | let editing: string | undefined; |
| 214 | 215 | const mayWrite = (): boolean => src.capabilities.write && repo !== undefined; |
| 215 | /** `g` is a person's: the crew parked the issue and may not unpark itself. */ | |
| 216 | /** `y` (go ahead) is a person's: the crew parked the issue and may not unpark itself. */ | |
| 216 | 217 | const mayGoAhead = (): boolean => |
| 217 | 218 | mayWrite() && |
| 218 | 219 | held.length > 0 && |
| @@ -431,7 +432,7 @@ export function issueScreen( | ||
| 431 | 432 | }); |
| 432 | 433 | }; |
| 433 | 434 | |
| 434 | /** `g` — say the issue may go ahead without its dropped or split blockers. */ | |
| 435 | /** `y` — say the issue may go ahead without its dropped or split blockers. */ | |
| 435 | 436 | const goAhead = (): void => { |
| 436 | 437 | const at = row(); |
| 437 | 438 | if (at?.issue === undefined || held.length === 0) return; |
| @@ -638,7 +639,7 @@ export function issueScreen( | ||
| 638 | 639 | }), |
| 639 | 640 | binding(["l"], "labels"), |
| 640 | 641 | binding(["t"], "teams"), |
| 641 | ...(mayGoAhead() ? [binding(["g"], "go ahead")] : []), | |
| 642 | ...(mayGoAhead() ? [binding(["y"], "go ahead")] : []), | |
| 642 | 643 | binding(["w"], "waits for"), |
| 643 | 644 | binding(["S"], issueRow?.sealed === true ? "unseal" : "seal"), |
| 644 | 645 | ...(issueRow?.sealed === true |
| @@ -944,7 +945,8 @@ export function issueScreen( | ||
| 944 | 945 | ); |
| 945 | 946 | return true; |
| 946 | 947 | } |
| 947 | if (e.key === "g" && mayGoAhead()) { | |
| 948 | if (mayGoAhead() && movedKey(ctx, e, "g", "y goes ahead now")) return true; | |
| 949 | if (e.key === "y" && mayGoAhead()) { | |
| 948 | 950 | goAhead(); |
| 949 | 951 | return true; |
| 950 | 952 | } |
src/tui/screens/jobs.ts +5 −4
| @@ -4,10 +4,11 @@ | ||
| 4 | 4 | * same way: a writer reads and steers. The runs live in the app itself, so |
| 5 | 5 | * the screen asks it (waking it) on open and after each write, and keeps the |
| 6 | 6 | * answer; `c` cancels the run under the cursor, `t` retries a failed one from |
| 7 | * its failed step, `g` reads again. A write is an event on the bus, so an | |
| 7 | * its failed step, `R` reads again. A write is an event on the bus, so an | |
| 8 | 8 | * open web page redraws. |
| 9 | 9 | */ |
| 10 | 10 | |
| 11 | import { keyOf } from "../../web/keymap.ts"; | |
| 11 | 12 | import { requireWriter } from "../../actions/access.ts"; |
| 12 | 13 | import { JOB_WORDS, jobRows, jobTimers, steerJob, type JobError, type JobRunRow } from "../../actions/jobs.ts"; |
| 13 | 14 | import type { Repo } from "../../core/repos.ts"; |
| @@ -34,7 +35,7 @@ export function jobsScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 34 | 35 | const read = async (): Promise<void> => { |
| 35 | 36 | const got = await jobRows(f.app, f.user, repo); |
| 36 | 37 | rows = got.ok ? got.value : []; |
| 37 | note = got.ok ? (rows.length === 0 ? "This app has no job runs." : "c cancels an unfinished run, t retries a failed one, g reads again.") : JOB_TUI_WORDS[got.error]; | |
| 38 | note = got.ok ? (rows.length === 0 ? "This app has no job runs." : "c cancels an unfinished run, t retries a failed one, R reads again.") : JOB_TUI_WORDS[got.error]; | |
| 38 | 39 | ctx.invalidate(); |
| 39 | 40 | }; |
| 40 | 41 | const steer = async (action: "cancel" | "retry"): Promise<void> => { |
| @@ -46,7 +47,7 @@ export function jobsScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 46 | 47 | }; |
| 47 | 48 | return { |
| 48 | 49 | title: `${repo.ownerName}/${repo.name} — Job runs`, |
| 49 | keys: [binding(["j", "k"], "move cursor"), binding(["c"], "cancel"), binding(["t"], "retry from the failed step"), binding(["g"], "read again")], | |
| 50 | keys: [binding(["j", "k"], "move cursor"), binding(["c"], "cancel"), binding(["t"], "retry from the failed step"), binding([keyOf("reread")], "read again")], | |
| 50 | 51 | async load() { |
| 51 | 52 | await read(); |
| 52 | 53 | }, |
| @@ -64,7 +65,7 @@ export function jobsScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 64 | 65 | key(e) { |
| 65 | 66 | if (state.key(e, rows.length)) return true; |
| 66 | 67 | if (e.ctrl || e.alt) return false; |
| 67 | if (e.key === "g") void read(); | |
| 68 | if (e.key === keyOf("reread")) void read(); | |
| 68 | 69 | else if (e.key === "c") void steer("cancel"); |
| 69 | 70 | else if (e.key === "t") void steer("retry"); |
| 70 | 71 | else return false; |
src/tui/screens/largefiles.ts +3 −2
| @@ -2,6 +2,7 @@ | ||
| 2 | 2 | * A repository's large files in the terminal (#4490): the /:owner/:name/large page's rows, from |
| 3 | 3 | * the same read (`blob/large.ts`, `largeFiles`). Whoever may read the repository sees it. |
| 4 | 4 | */ |
| 5 | import { keyOf } from "../../web/keymap.ts"; | |
| 5 | 6 | import { largeFiles, type LargeFile } from "../../blob/large.ts"; |
| 6 | 7 | import { canRead, type Repo } from "../../core/repos.ts"; |
| 7 | 8 | import { fileSize } from "../../web/ui.ts"; |
| @@ -33,12 +34,12 @@ export function largeFilesScreen(f: Session, ctx: Ctx, repo: Repo): Screen { | ||
| 33 | 34 | load(); |
| 34 | 35 | return { |
| 35 | 36 | title: `${repo.ownerName}/${repo.name} — Large files`, |
| 36 | keys: [binding(["j", "k"], "move cursor"), binding(["g"], "read again")], | |
| 37 | keys: [binding(["j", "k"], "move cursor"), binding([keyOf("reread")], "read again")], | |
| 37 | 38 | render(area, s) { |
| 38 | 39 | drawList(s, area, ctx.theme.c, state, loaded ? rows : []); |
| 39 | 40 | }, |
| 40 | 41 | key(e) { |
| 41 | if (e.key === "g") { | |
| 42 | if (e.key === keyOf("reread")) { | |
| 42 | 43 | load(); |
| 43 | 44 | return true; |
| 44 | 45 | } |
src/tui/screens/moved_key.ts added +19
| @@ -0,0 +1,19 @@ | ||
| 1 | /** | |
| 2 | * A key a terminal screen gave up says where it went, for two weeks (`web/keymap.ts` | |
| 3 | * OLD_KEYS_UNTIL), as the keymap's own moved keys do: pressing the old one shows the new one and | |
| 4 | * does nothing else. | |
| 5 | * | |
| 6 | * Screens give up `g` alone so that `g` can start a jump, as it does on the web: "read again" | |
| 7 | * went to `R` (the map's `reread`, hinted by the app for every screen that refreshes on it), and | |
| 8 | * each screen's own `g` went to a letter of its verb. | |
| 9 | */ | |
| 10 | import { oldKeysHinted } from "../../web/keymap.ts"; | |
| 11 | import type { Ctx } from "../app/app.ts"; | |
| 12 | import type { KeyEvent } from "../term/input.ts"; | |
| 13 | ||
| 14 | /** True, after saying `says`, when `e` is the key `was` and the hint's date has not passed. */ | |
| 15 | export function movedKey(ctx: Ctx, e: KeyEvent, was: string, says: string): boolean { | |
| 16 | if (e.ctrl || e.alt || e.key !== was || !oldKeysHinted()) return false; | |
| 17 | ctx.toast(says); | |
| 18 | return true; | |
| 19 | } |
src/tui/screens/system.ts +4 −2
| @@ -33,6 +33,7 @@ | ||
| 33 | 33 | * what is off, from the last reading, gated as the rest. |
| 34 | 34 | */ |
| 35 | 35 | |
| 36 | import { movedKey } from "./moved_key.ts"; | |
| 36 | 37 | import type { Ctx, Screen } from "../app/app.ts"; |
| 37 | 38 | import type { SystemView } from "../../system/view.ts"; |
| 38 | 39 | import { rolloutLine, type ForgeHealth } from "../../kernel/guard.ts"; |
| @@ -442,7 +443,7 @@ export function systemScreen(ctx: Ctx, lines: readonly string[], session: Sessio | ||
| 442 | 443 | }; |
| 443 | 444 | const screen: Screen = { |
| 444 | 445 | title: "System", |
| 445 | keys: [binding(["h"], "window"), ...(reads ? [binding(["d"], "database size")] : []), ...(mayReadAtlas(session?.user) ? [binding(["a"], "tables")] : []), ...(offered ? [binding(["g"], "grant or take back telemetry")] : []), ...(canSeeMemory(session.user) ? [binding(["x"], "explore series")] : []), binding(["enter", "esc", "q"], "close")], | |
| 446 | keys: [binding(["h"], "window"), ...(reads ? [binding(["d"], "database size")] : []), ...(mayReadAtlas(session?.user) ? [binding(["a"], "tables")] : []), ...(offered ? [binding(["T"], "grant or take back telemetry")] : []), ...(canSeeMemory(session.user) ? [binding(["x"], "explore series")] : []), binding(["enter", "esc", "q"], "close")], | |
| 446 | 447 | render(area, s) { |
| 447 | 448 | const features = featuresLines(session); |
| 448 | 449 | // Never waits on the walk: the last measurement, a new one started behind it when stale. |
| @@ -481,7 +482,8 @@ export function systemScreen(ctx: Ctx, lines: readonly string[], session: Sessio | ||
| 481 | 482 | if (e.key === "h") { |
| 482 | 483 | span = (span + 1) % WINDOWS.length; |
| 483 | 484 | history = historyLines(session, WINDOWS[span]!); |
| 484 | } else if (e.key === "g") askGrant(); | |
| 485 | } else if (e.key === "T") askGrant(); | |
| 486 | else if (e.key === "g") movedKey(ctx, e, "g", "T grants or takes back telemetry now"); | |
| 485 | 487 | else if (e.key === "x" && canSeeMemory(session.user)) later(ctx, () => seriesScreen(session, ctx)); |
| 486 | 488 | else if (e.key === "d" && reads) later(ctx, () => dbSizeScreen(session, ctx)); |
| 487 | 489 | else if (e.key === "a" && mayReadAtlas(session.user)) later(ctx, () => abstractionsScreen(session, ctx)); |
src/web/keymap.ts +9
| @@ -139,6 +139,7 @@ export const OLD_KEYS: readonly OldKey[] = [ | ||
| 139 | 139 | { page: "runs", was: "S", now: "wheel" }, |
| 140 | 140 | { page: "runs", was: "a", now: "requeue" }, |
| 141 | 141 | { page: "terminal", was: "r", now: "reread" }, |
| 142 | { page: "terminal", was: "g", now: "reread" }, | |
| 142 | 143 | { page: "next", was: "t", now: "top" }, |
| 143 | 144 | { page: "next", was: "u", now: "raise" }, |
| 144 | 145 | { page: "next", was: "d", now: "lower" }, |
| @@ -158,6 +159,14 @@ export function oldKeys(page: OldKey["page"], now: Date = oldKeysClock ?? new Da | ||
| 158 | 159 | } |
| 159 | 160 | |
| 160 | 161 | let oldKeysClock: Date | undefined; |
| 162 | /** | |
| 163 | * Whether a moved key is still hinted: before {@link OLD_KEYS_UNTIL}, on the same clock as {@link | |
| 164 | * oldKeys}. | |
| 165 | */ | |
| 166 | export function oldKeysHinted(now: Date = oldKeysClock ?? new Date()): boolean { | |
| 167 | return now.getTime() < Date.parse(OLD_KEYS_UNTIL); | |
| 168 | } | |
| 169 | ||
| 161 | 170 | /** |
| 162 | 171 | * A test's clock for {@link oldKeys} on served pages, so a hint test means the same on any date; |
| 163 | 172 | * undefined reads the clock again. |
test/egress-admin.test.ts +1 −1
| @@ -97,7 +97,7 @@ describe("egress grants in the terminal", () => { | ||
| 97 | 97 | await h.openAbout(); |
| 98 | 98 | await h.press("e"); |
| 99 | 99 | await settleUntil(h.tui, "asked for, not granted"); |
| 100 | await h.press("g"); | |
| 100 | await h.press("a"); | |
| 101 | 101 | await settleUntil(h.tui, "reach"); |
| 102 | 102 | expect(grants()).toEqual([]); |
| 103 | 103 | await h.press("y"); |
test/keymap-terminal.test.ts +42 −1
| @@ -7,7 +7,8 @@ | ||
| 7 | 7 | import { expect, test } from "bun:test"; |
| 8 | 8 | import { readFileSync } from "node:fs"; |
| 9 | 9 | import { join } from "node:path"; |
| 10 | import { keyOf } from "../src/web/keymap.ts"; | |
| 10 | import { keyOf, OLD_KEYS_UNTIL, provideOldKeysClockForTest } from "../src/web/keymap.ts"; | |
| 11 | import { movedKey } from "../src/tui/screens/moved_key.ts"; | |
| 11 | 12 | |
| 12 | 13 | const ROOT = join(import.meta.dir, ".."); |
| 13 | 14 | |
| @@ -87,3 +88,43 @@ test("the scan catches the shapes a refresh on r takes", () => { | ||
| 87 | 88 | expect(hits(`binding(["r"], "rename")`)).toEqual([]); |
| 88 | 89 | expect(hits(`binding([keyOf("reread")], "refresh")`)).toEqual([]); |
| 89 | 90 | }); |
| 91 | ||
| 92 | /** A terminal binding that takes g by itself, with what it is called. */ | |
| 93 | const G_BINDING = /binding\(\[(?:"[^"]*",\s*)*"g"(?:,\s*"[^"]*")*\],\s*(["`])([^"`]*)\1/g; | |
| 94 | ||
| 95 | /** | |
| 96 | * A handler that reads the key g itself (`e.key === "g"`). Not a moved key's hint (`movedKey`), a | |
| 97 | * chord with Ctrl (`e.ctrl &&`), or the lists' own top, which reads g with Home until the | |
| 98 | * terminal's jumps take `g g` for it. | |
| 99 | */ | |
| 100 | const G_HANDLER = /^.*e\.key\s*===\s*"g".*$/gm; | |
| 101 | const G_ALLOWED = /movedKey|e\.ctrl\s*&&|"home"/; | |
| 102 | ||
| 103 | test("no terminal screen takes g for a verb of its own: g is to start a jump, as on the web", () => { | |
| 104 | const sources = terminalSources(); | |
| 105 | const taken: string[] = []; | |
| 106 | for (const [path, text] of Object.entries(sources)) | |
| 107 | for (const m of text.matchAll(G_HANDLER)) { | |
| 108 | if (G_ALLOWED.test(m[0])) continue; | |
| 109 | const line = text.slice(0, m.index).split("\n").length; | |
| 110 | taken.push(`${path}:${line}: reads the key g: read again is ${keyOf("reread")}; any other verb takes a letter of its own`); | |
| 111 | } | |
| 112 | for (const [path, text] of Object.entries(sources)) | |
| 113 | for (const m of text.matchAll(G_BINDING)) | |
| 114 | // The lists' own top and end (g, G) stay until the jump arrives and takes g g for the top. | |
| 115 | if (m[2] !== "top, end") taken.push(`${path}: g "${m[2]}": read again is ${keyOf("reread")}; any other verb takes a letter of its own`); | |
| 116 | expect(taken).toEqual([]); | |
| 117 | }); | |
| 118 | ||
| 119 | test("a screen's moved g says where it went until the date, and nothing after", () => { | |
| 120 | const said: string[] = []; | |
| 121 | const ctx = { toast: (t: string) => void said.push(t) } as unknown as Parameters<typeof movedKey>[0]; | |
| 122 | const key = (k: string) => ({ key: k, ctrl: false, alt: false, shift: false }) as Parameters<typeof movedKey>[1]; | |
| 123 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 1)); | |
| 124 | expect(movedKey(ctx, key("g"), "g", "G grants now")).toBe(true); | |
| 125 | expect(movedKey(ctx, key("G"), "g", "G grants now")).toBe(false); | |
| 126 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL))); | |
| 127 | expect(movedKey(ctx, key("g"), "g", "G grants now")).toBe(false); | |
| 128 | provideOldKeysClockForTest(undefined); | |
| 129 | expect(said).toEqual(["G grants now"]); | |
| 130 | }); |
test/keymap.test.ts +5 −1
| @@ -143,7 +143,11 @@ test("both doors share one meaning per key: R refreshes a terminal screen, / fil | ||
| 143 | 143 | // No terminal key differs from the web's: Next up's not now is p too, and its planner pause is P. |
| 144 | 144 | expect((Object.entries(KEYMAP) as [string, KeyDef][]).filter(([, d]) => d.terminal !== undefined).map(([id]) => id)).toEqual([]); |
| 145 | 145 | expect([keyOf("park"), keyOf("pausePlanner")]).toEqual(["p", "P"]); |
| 146 | expect(oldKeys("terminal", new Date(Date.parse(OLD_KEYS_UNTIL) - 1))).toEqual([{ was: "r", key: "R", says: "R is refresh now" }]); | |
| 146 | // g read again too, on the screens that took g for it (slice 4a): g is to start a jump. | |
| 147 | expect(oldKeys("terminal", new Date(Date.parse(OLD_KEYS_UNTIL) - 1))).toEqual([ | |
| 148 | { was: "r", key: "R", says: "R is refresh now" }, | |
| 149 | { was: "g", key: "R", says: "R is refresh now" }, | |
| 150 | ]); | |
| 147 | 151 | }); |
| 148 | 152 | |
| 149 | 153 | test("the g jumps the map names are go_pages.ts's", () => { |
test/move-machine-doors.test.ts +2 −2
| @@ -104,7 +104,7 @@ test("a cross-origin post does not move anything", async () => { | ||
| 104 | 104 | expect(routeOf(app, "gamma")).toBeUndefined(); |
| 105 | 105 | }); |
| 106 | 106 | |
| 107 | test("the terminal's Forges screen drives the same plan and move on g", async () => { | |
| 107 | test("the terminal's Forges screen drives the same plan and move on M", async () => { | |
| 108 | 108 | forge("epsilon"); |
| 109 | 109 | const alice = app.db.query<{ id: string }, []>("SELECT id FROM user WHERE username = 'alice'").get()!; |
| 110 | 110 | const user = getUserById(app.db, alice.id)!; |
| @@ -115,7 +115,7 @@ test("the terminal's Forges screen drives the same plan and move on g", async () | ||
| 115 | 115 | tui.push(forgesScreen(tui.ctx, await clientRows(app), session)); |
| 116 | 116 | await settleApp(tui); |
| 117 | 117 | const press = async (key: string): Promise<string> => (terminal.feed(key), await settleApp(tui), tui.screen.toText()); |
| 118 | expect(await press("g")).toContain("Move which forge to another machine?"); | |
| 118 | expect(await press("M")).toContain("Move which forge to another machine?"); | |
| 119 | 119 | // The picker's rows are alpha, beta, epsilon, gamma: epsilon is the third. |
| 120 | 120 | await press("\x1b[B"); |
| 121 | 121 | await press("\x1b[B"); |
test/tui-autonomy.test.ts +2 −2
| @@ -314,14 +314,14 @@ describe("autonomy in the terminal", () => { | ||
| 314 | 314 | const h = boot(ada); |
| 315 | 315 | await h.open(); |
| 316 | 316 | expect(h.text()).toContain("Checks 1 at once guaranteed, of the forge's 8"); |
| 317 | await h.press("g"); | |
| 317 | await h.press("C"); | |
| 318 | 318 | for (let i = 0; i < 4; i++) await h.press("backspace"); |
| 319 | 319 | await h.type("2"); |
| 320 | 320 | await h.press("enter"); |
| 321 | 321 | expect(saved().checkSlots).toBe(2); |
| 322 | 322 | expect(h.text()).toContain("Checks 2 at once guaranteed"); |
| 323 | 323 | // More than the pool leaves for the others is refused with the page's sentence. |
| 324 | await h.press("g"); | |
| 324 | await h.press("C"); | |
| 325 | 325 | for (let i = 0; i < 4; i++) await h.press("backspace"); |
| 326 | 326 | await h.type("99"); |
| 327 | 327 | await h.press("enter"); |
test/tui-boards-rename.test.ts +6 −6
| @@ -1,5 +1,5 @@ | ||
| 1 | 1 | /** |
| 2 | * `e` renames and `g` sets the range of the marked board on the Boards list | |
| 2 | * `e` renames and `t` sets the range of the marked board on the Boards list | |
| 3 | 3 | * (#8033), through the action the board page uses; nobody but an admin person |
| 4 | 4 | * is offered either key. |
| 5 | 5 | */ |
| @@ -106,16 +106,16 @@ describe("tui boards: rename and range", () => { | ||
| 106 | 106 | expect((await board()).title).toBe("Weekly runs"); |
| 107 | 107 | }); |
| 108 | 108 | |
| 109 | test("g is prefilled with the range and changes it, keeping the refresh", async () => { | |
| 109 | test("t is prefilled with the range and changes it, keeping the refresh", async () => { | |
| 110 | 110 | await writeBoard(app, carol, "runs", { title: "Weekly runs", range: "7d", refresh: "1m", panels: (await board()).panels }); |
| 111 | const opened = await screenText(carol, "g"); | |
| 111 | const opened = await screenText(carol, "t"); | |
| 112 | 112 | expect(opened).toContain("Board range"); |
| 113 | 113 | expect(opened).toContain("7d"); |
| 114 | expect(await screenText(carol, "g" + BACK + BACK + "24h\r")).toContain("range changed"); | |
| 114 | expect(await screenText(carol, "t" + BACK + BACK + "24h\r")).toContain("range changed"); | |
| 115 | 115 | const now = await board(); |
| 116 | 116 | expect(now.range).toBe("24h"); |
| 117 | 117 | expect(now.refresh).toBe("1m"); |
| 118 | expect(await screenText(carol, "g" + BACK.repeat(3) + "2w\r")).toContain("That was refused"); | |
| 118 | expect(await screenText(carol, "t" + BACK.repeat(3) + "2w\r")).toContain("That was refused"); | |
| 119 | 119 | expect((await board()).range).toBe("24h"); |
| 120 | 120 | }); |
| 121 | 121 | |
| @@ -125,7 +125,7 @@ describe("tui boards: rename and range", () => { | ||
| 125 | 125 | for (const who of [bob, bot, undefined]) { |
| 126 | 126 | const text = await screenText(who); |
| 127 | 127 | expect(text).not.toContain("e rename"); |
| 128 | expect(text).not.toContain("g range"); | |
| 128 | expect(text).not.toContain("t range"); | |
| 129 | 129 | await screenText(who, "eZ\r"); |
| 130 | 130 | await screenText(who, "gx\r"); |
| 131 | 131 | } |
test/tui-crew-devices.test.ts +4 −4
| @@ -78,7 +78,7 @@ test("a repository admin lists, reads and unlists, with no grant key; the web pa | ||
| 78 | 78 | const { tui, session } = open(cy); |
| 79 | 79 | await settleApp(tui); |
| 80 | 80 | expect(tui.screen.toText()).toContain("a site admin grants"); |
| 81 | expect(tui.screen.toText()).not.toContain("g grants"); | |
| 81 | expect(tui.screen.toText()).not.toContain("G grants"); | |
| 82 | 82 | tui.dispatch(key("a")); |
| 83 | 83 | await settleApp(tui); |
| 84 | 84 | type(tui, PI); |
| @@ -95,7 +95,7 @@ test("a repository admin lists, reads and unlists, with no grant key; the web pa | ||
| 95 | 95 | expect(await (await fetch(`${servers.url}/cy/arm/settings/devices`, { headers: { cookie: adaCookie } })).text()).toContain("100.89.95.68:22"); |
| 96 | 96 | |
| 97 | 97 | // g does nothing for a repository admin who is no site admin. |
| 98 | tui.dispatch(key("g")); | |
| 98 | tui.dispatch(key("G")); | |
| 99 | 99 | await settleApp(tui); |
| 100 | 100 | expect(devicesView(app, cy, repo).ok && (devicesView(app, cy, repo) as { value: { devices: { granted: boolean }[] } }).value.devices[0]!.granted).toBe(false); |
| 101 | 101 | expect(events).not.toContain("crew.device.granted"); |
| @@ -118,8 +118,8 @@ test("a site admin grants from the terminal with a pasted host key, and it is an | ||
| 118 | 118 | const off = app.bus.subscribe((e) => events.push(e.kind)); |
| 119 | 119 | const { tui } = open(ada); |
| 120 | 120 | await settleApp(tui); |
| 121 | expect(tui.screen.toText()).toContain("g grants"); | |
| 122 | tui.dispatch(key("g")); | |
| 121 | expect(tui.screen.toText()).toContain("G grants"); | |
| 122 | tui.dispatch(key("G")); | |
| 123 | 123 | await settleApp(tui); |
| 124 | 124 | tui.dispatch({ type: "paste", text: HOST_KEY }); |
| 125 | 125 | tui.dispatch(key("enter")); |
test/tui-egress.test.ts +26 −8
| @@ -138,14 +138,14 @@ describe("private destinations in the terminal", () => { | ||
| 138 | 138 | expect(h.text()).toContain(ARM); |
| 139 | 139 | expect(h.text()).toContain(CAMERA); |
| 140 | 140 | expect(h.text()).toContain("asked for, not granted"); |
| 141 | await h.press("g"); | |
| 141 | await h.press("a"); | |
| 142 | 142 | expect(h.text()).toContain(`Let acme/arm reach ${ARM}?`); |
| 143 | 143 | expect(grants()).toEqual([]); |
| 144 | 144 | await h.press("y"); |
| 145 | 145 | expect(grants()).toEqual([ARM]); |
| 146 | 146 | expect(h.text()).toContain(`${ARM} is granted.`); |
| 147 | // Already granted: `g` asks nothing and grants nothing again. | |
| 148 | await h.press("g"); | |
| 147 | // Already granted: `a` asks nothing and grants nothing again. | |
| 148 | await h.press("a"); | |
| 149 | 149 | expect(h.text()).not.toContain(`Let acme/arm reach ${ARM}?`); |
| 150 | 150 | expect(h.text()).toContain("granted by ada"); |
| 151 | 151 | expect(changes().map((e) => e.kind)).toEqual(["app.egress.granted"]); |
| @@ -162,13 +162,13 @@ describe("private destinations in the terminal", () => { | ||
| 162 | 162 | const h = boot(ada); |
| 163 | 163 | await h.toAbout(); |
| 164 | 164 | await h.press("e"); |
| 165 | await h.press("g"); | |
| 165 | await h.press("a"); | |
| 166 | 166 | await h.press("y"); |
| 167 | 167 | expect(grants()).toEqual([ARM]); |
| 168 | 168 | const before = changes().length; |
| 169 | 169 | await h.press("x"); |
| 170 | 170 | expect(h.text()).toContain(`Stop acme/arm reaching ${ARM}?`); |
| 171 | expect(h.text()).toContain("refused until g grants it again."); | |
| 171 | expect(h.text()).toContain("refused until a grants it again."); | |
| 172 | 172 | await h.press("n"); |
| 173 | 173 | expect(h.text()).not.toContain(`Stop acme/arm reaching ${ARM}?`); |
| 174 | 174 | await h.press("x"); |
| @@ -182,12 +182,30 @@ describe("private destinations in the terminal", () => { | ||
| 182 | 182 | h.stop(); |
| 183 | 183 | }); |
| 184 | 184 | |
| 185 | test("a site admin who presses g then n grants nothing", async () => { | |
| 185 | test("the old g, before its date, says a grants now and does nothing else: no prompt, no grant", async () => { | |
| 186 | const { OLD_KEYS_UNTIL, provideOldKeysClockForTest } = await import("../src/web/keymap.ts"); | |
| 187 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 188 | const before = changes().length; | |
| 189 | const h = boot(ada); | |
| 190 | try { | |
| 191 | await h.toAbout(); | |
| 192 | await h.press("e"); | |
| 193 | await h.press("g"); | |
| 194 | expect(h.text()).toContain("a grants now"); | |
| 195 | expect(h.text()).not.toContain(`Let acme/arm reach ${ARM}?`); | |
| 196 | expect(changes().length).toBe(before); | |
| 197 | } finally { | |
| 198 | provideOldKeysClockForTest(undefined); | |
| 199 | h.stop(); | |
| 200 | } | |
| 201 | }); | |
| 202 | ||
| 203 | test("a site admin who presses a then n grants nothing", async () => { | |
| 186 | 204 | const before = changes().length; |
| 187 | 205 | const h = boot(ada); |
| 188 | 206 | await h.toAbout(); |
| 189 | 207 | await h.press("e"); |
| 190 | await h.press("g"); | |
| 208 | await h.press("a"); | |
| 191 | 209 | expect(h.text()).toContain(`Let acme/arm reach ${ARM}?`); |
| 192 | 210 | expect(h.text()).toContain("The app's outbound traffic to it is allowed until you revoke it with x."); |
| 193 | 211 | await h.press("n"); |
| @@ -196,7 +214,7 @@ describe("private destinations in the terminal", () => { | ||
| 196 | 214 | expect(changes().length).toBe(before); |
| 197 | 215 | const view = await egressView(forge, ada, repo); |
| 198 | 216 | expect(view.ok && view.value.rows.find((r) => r.destination === ARM)?.granted).toBe(false); |
| 199 | await h.press("g"); | |
| 217 | await h.press("a"); | |
| 200 | 218 | expect(h.text()).toContain(`Let acme/arm reach ${ARM}?`); |
| 201 | 219 | await h.press("esc"); |
| 202 | 220 | expect(h.text()).not.toContain(`Let acme/arm reach ${ARM}?`); |
test/tui-games.test.ts +18 −2
| @@ -2,7 +2,7 @@ | ||
| 2 | 2 | * Games in the terminal, both doors (review of #16913): from the Games screen, `enter` opens a |
| 3 | 3 | * service's console (its log tail, and `:` queues an rcon command), env (`e` commits a key through |
| 4 | 4 | * the page's own `commitServiceEnv`, refusals in its words) and plugins (`a` adds a Modrinth slug |
| 5 | * through `addPlugin`; a jar upload is the page's alone, and the screen says so), and `g` opens the | |
| 5 | * through `addPlugin`; a jar upload is the page's alone, and the screen says so), and `G` opens the | |
| 6 | 6 | * box's grants, which only an owner sets. |
| 7 | 7 | */ |
| 8 | 8 | import { afterAll, beforeAll, expect, test } from "bun:test"; |
| @@ -15,7 +15,7 @@ import { createUser, getUserByName, type User } from "../src/core/users.ts"; | ||
| 15 | 15 | import { readCompose, serviceEnv } from "../src/games/compose.ts"; |
| 16 | 16 | import { boxNamed, createGameBox, grantsOf, recentCommands, recordSync } from "../src/games/store.ts"; |
| 17 | 17 | import { createForgeApp } from "../src/tui/forge.ts"; |
| 18 | import { gameGrantsScreen, gameServiceScreen } from "../src/tui/screens/games.ts"; | |
| 18 | import { gameGrantsScreen, gameServiceScreen, gamesScreen } from "../src/tui/screens/games.ts"; | |
| 19 | 19 | import { headlessTerminal } from "../src/tui/term/terminal.ts"; |
| 20 | 20 | import { quietLogs } from "./helpers/globals.ts"; |
| 21 | 21 | import { settleApp, settleUntil } from "./helpers/tui.ts"; |
| @@ -149,3 +149,19 @@ test("grants: listed to the box's owner, set by them; a member who is not an own | ||
| 149 | 149 | expect(tui.screen.toText()).toContain("bob is operator of hub."); |
| 150 | 150 | tui.stop?.(); |
| 151 | 151 | }); |
| 152 | ||
| 153 | test("on the games list, the old g, before its date, says G opens the grants and opens nothing, ahead of the list's own top", async () => { | |
| 154 | const { OLD_KEYS_UNTIL, provideOldKeysClockForTest } = await import("../src/web/keymap.ts"); | |
| 155 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 156 | const { tui, session, type } = drive(alice); | |
| 157 | try { | |
| 158 | tui.ctx.push(gamesScreen(session, tui.ctx)); | |
| 159 | await settleApp(tui); | |
| 160 | await type("g"); | |
| 161 | expect(tui.screen.toText()).toContain("G opens the grants now"); | |
| 162 | expect(tui.screen.toText()).not.toContain("Only an owner of this box sets grants."); | |
| 163 | } finally { | |
| 164 | provideOldKeysClockForTest(undefined); | |
| 165 | tui.stop?.(); | |
| 166 | } | |
| 167 | }); |
test/tui-issue-goahead.test.ts +23 −7
| @@ -123,7 +123,7 @@ describe("go ahead in the terminal", () => { | ||
| 123 | 123 | try { |
| 124 | 124 | await openWaiting(h); |
| 125 | 125 | expect(h.text()).not.toContain("go ahead"); |
| 126 | await h.press("g"); | |
| 126 | await h.press("y"); | |
| 127 | 127 | expect(heldBlockers(forge.db, waiting.id)).toHaveLength(1); |
| 128 | 128 | } finally { |
| 129 | 129 | h.app.stop(); |
| @@ -136,7 +136,7 @@ describe("go ahead in the terminal", () => { | ||
| 136 | 136 | await openWaiting(h); |
| 137 | 137 | expect(h.text()).toContain(`#${blocker.number} (dropped)`); |
| 138 | 138 | expect(h.text()).not.toContain("go ahead"); |
| 139 | await h.press("g"); | |
| 139 | await h.press("y"); | |
| 140 | 140 | expect(h.text()).not.toContain("Let it go ahead?"); |
| 141 | 141 | expect(heldBlockers(forge.db, waiting.id)).toHaveLength(1); |
| 142 | 142 | } finally { |
| @@ -150,7 +150,7 @@ describe("go ahead in the terminal", () => { | ||
| 150 | 150 | await openWaiting(h); |
| 151 | 151 | expect(h.text()).toContain(`#${blocker.number} (dropped)`); |
| 152 | 152 | expect(h.text()).not.toContain("go ahead"); |
| 153 | await h.press("g"); | |
| 153 | await h.press("y"); | |
| 154 | 154 | expect(h.text()).not.toContain("Let it go ahead?"); |
| 155 | 155 | expect(heldBlockers(forge.db, waiting.id)).toHaveLength(1); |
| 156 | 156 | } finally { |
| @@ -158,11 +158,27 @@ describe("go ahead in the terminal", () => { | ||
| 158 | 158 | } |
| 159 | 159 | }); |
| 160 | 160 | |
| 161 | test("the old g, before its date, says y goes ahead now and asks nothing", async () => { | |
| 162 | const { OLD_KEYS_UNTIL, provideOldKeysClockForTest } = await import("../src/web/keymap.ts"); | |
| 163 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 164 | const h = boot(alice); | |
| 165 | try { | |
| 166 | await openWaiting(h); | |
| 167 | await h.press("g"); | |
| 168 | expect(h.text()).toContain("y goes ahead now"); | |
| 169 | expect(h.text()).not.toContain("Let it go ahead?"); | |
| 170 | expect(heldBlockers(forge.db, waiting.id)).toHaveLength(1); | |
| 171 | } finally { | |
| 172 | provideOldKeysClockForTest(undefined); | |
| 173 | h.app.stop(); | |
| 174 | } | |
| 175 | }); | |
| 176 | ||
| 161 | 177 | test("enter on the default choice cancels and leaves the wait", async () => { |
| 162 | 178 | const h = boot(alice); |
| 163 | 179 | try { |
| 164 | 180 | await openWaiting(h); |
| 165 | await h.press("g"); | |
| 181 | await h.press("y"); | |
| 166 | 182 | await settleUntil(h.app, "Let it go ahead?"); |
| 167 | 183 | await h.press("enter"); |
| 168 | 184 | expect(heldBlockers(forge.db, waiting.id)).toHaveLength(1); |
| @@ -178,7 +194,7 @@ describe("go ahead in the terminal", () => { | ||
| 178 | 194 | await openWaiting(h); |
| 179 | 195 | expect(h.text()).toContain(`#${blocker.number} (dropped)`); |
| 180 | 196 | expect(h.text()).toContain("go ahead"); |
| 181 | await h.press("g"); | |
| 197 | await h.press("y"); | |
| 182 | 198 | await settleUntil(h.app, "Let it go ahead?"); |
| 183 | 199 | await h.press("left", "enter"); |
| 184 | 200 | await settleUntil(h.app, "may go ahead"); |
| @@ -194,7 +210,7 @@ describe("go ahead in the terminal", () => { | ||
| 194 | 210 | try { |
| 195 | 211 | await openWaiting(h); |
| 196 | 212 | expect(h.text()).not.toContain("closed without being done"); |
| 197 | await h.press("g"); | |
| 213 | await h.press("y"); | |
| 198 | 214 | expect(h.text()).not.toContain("Let it go ahead?"); |
| 199 | 215 | } finally { |
| 200 | 216 | h.app.stop(); |
| @@ -205,7 +221,7 @@ describe("go ahead in the terminal", () => { | ||
| 205 | 221 | const h = boot(alice); |
| 206 | 222 | try { |
| 207 | 223 | await openWaiting(h, "pending", many.number); |
| 208 | await h.press("g"); | |
| 224 | await h.press("y"); | |
| 209 | 225 | await settleUntil(h.app, "Go ahead without"); |
| 210 | 226 | await h.press("enter"); |
| 211 | 227 | await settleUntil(h.app, "Let it go ahead?"); |
test/tui-origin-follow.test.ts +24 −7
| @@ -37,10 +37,11 @@ const ok = <T>(r: { ok: true; value: T } | { ok: false; error: unknown }): T => | ||
| 37 | 37 | |
| 38 | 38 | function card(user: User) { |
| 39 | 39 | const pushed: Screen[] = []; |
| 40 | const said: string[] = []; | |
| 40 | 41 | const ctx = { |
| 41 | 42 | theme: theme("dark"), |
| 42 | 43 | invalidate() {}, |
| 43 | toast() {}, | |
| 44 | toast: (text: string) => void said.push(text), | |
| 44 | 45 | push: (s: Screen) => pushed.push(s), |
| 45 | 46 | pop() {}, |
| 46 | 47 | copy() {}, |
| @@ -50,6 +51,7 @@ function card(user: User) { | ||
| 50 | 51 | const screen = aboutScreen(f, ctx, { render() {} } as unknown as Screen, src, undefined, "main"); |
| 51 | 52 | return { |
| 52 | 53 | pushed, |
| 54 | said, | |
| 53 | 55 | offered: (key: string) => screen.keys.some((b) => b.keys.includes(key)), |
| 54 | 56 | press: (key: string) => screen.key!(pressed(key)), |
| 55 | 57 | }; |
| @@ -81,10 +83,10 @@ afterAll(async () => { | ||
| 81 | 83 | await rm(dir, { recursive: true, force: true, maxRetries: 5 }); |
| 82 | 84 | }); |
| 83 | 85 | |
| 84 | test("the admin who brought it is offered `g`, and only the confirm follows", () => { | |
| 86 | test("the admin who brought it is offered `F`, and only the confirm follows", () => { | |
| 85 | 87 | const c = card(alice); |
| 86 | expect(c.offered("g")).toBe(true); | |
| 87 | expect(c.press("g")).toBe(true); | |
| 88 | expect(c.offered("F")).toBe(true); | |
| 89 | expect(c.press("F")).toBe(true); | |
| 88 | 90 | expect(getFollow(app.db, repo.id)?.enabled).toBe(false); |
| 89 | 91 | const confirm = c.pushed[0]!; |
| 90 | 92 | expect(confirm.title).toBe("Follow where it came from"); |
| @@ -94,12 +96,27 @@ test("the admin who brought it is offered `g`, and only the confirm follows", () | ||
| 94 | 96 | confirm.key!(pressed("right")); |
| 95 | 97 | confirm.key!(pressed("enter")); |
| 96 | 98 | expect(getFollow(app.db, repo.id)?.enabled).toBe(true); |
| 97 | expect(card(alice).offered("g")).toBe(true); | |
| 99 | expect(card(alice).offered("F")).toBe(true); | |
| 98 | 100 | }); |
| 99 | 101 | |
| 100 | 102 | test("someone who did not bring it is offered nothing", () => { |
| 101 | 103 | const c = card(carol); |
| 102 | expect(c.offered("g")).toBe(false); | |
| 103 | c.press("g"); | |
| 104 | expect(c.offered("F")).toBe(false); | |
| 105 | c.press("F"); | |
| 104 | 106 | expect(c.pushed).toEqual([]); |
| 105 | 107 | }); |
| 108 | ||
| 109 | test("the old g, before its date, says F follows now and asks nothing", async () => { | |
| 110 | const { OLD_KEYS_UNTIL, provideOldKeysClockForTest } = await import("../src/web/keymap.ts"); | |
| 111 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 112 | try { | |
| 113 | const c = card(alice); | |
| 114 | const before = getFollow(app.db, repo.id)?.enabled; | |
| 115 | expect(c.press("g")).toBe(true); | |
| 116 | expect(c.said).toEqual(["F follows now"]); | |
| 117 | expect(c.pushed).toEqual([]); | |
| 118 | expect(getFollow(app.db, repo.id)?.enabled).toBe(before); | |
| 119 | } finally { | |
| 120 | provideOldKeysClockForTest(undefined); | |
| 121 | } | |
| 122 | }); |
test/tui-system.test.ts +22 −6
| @@ -330,22 +330,38 @@ describe("tui system telemetry grant", () => { | ||
| 330 | 330 | return { tui, press }; |
| 331 | 331 | }; |
| 332 | 332 | |
| 333 | test("the old g, before its date, says T and asks nothing", async () => { | |
| 334 | const { OLD_KEYS_UNTIL, provideOldKeysClockForTest } = await import("../src/web/keymap.ts"); | |
| 335 | provideOldKeysClockForTest(new Date(Date.parse(OLD_KEYS_UNTIL) - 86_400_000)); | |
| 336 | const h = boot(carol); | |
| 337 | try { | |
| 338 | await settleApp(h.tui); | |
| 339 | await h.press("g"); | |
| 340 | expect(h.tui.screen.toText()).toContain("T grants or takes back telemetry now"); | |
| 341 | expect(h.tui.screen.toText()).not.toContain("telemetry:read? y/n"); | |
| 342 | expect(hasGrant(app.db, bot.id)).toBe(false); | |
| 343 | } finally { | |
| 344 | provideOldKeysClockForTest(undefined); | |
| 345 | h.tui.stop?.(); | |
| 346 | } | |
| 347 | }); | |
| 348 | ||
| 333 | 349 | test("an admin grants and takes back after a confirm", async () => { |
| 334 | 350 | const h = boot(carol); |
| 335 | 351 | await settleApp(h.tui); |
| 336 | 352 | expect(h.tui.screen.toText()).toContain("telemetry:read held by: no agent"); |
| 337 | await h.press("g"); | |
| 353 | await h.press("T"); | |
| 338 | 354 | await h.press("enter"); |
| 339 | 355 | expect(h.tui.screen.toText()).toContain("grant sysbot telemetry:read? y/n"); |
| 340 | 356 | await h.press("left", "enter"); |
| 341 | 357 | expect(hasGrant(app.db, bot.id)).toBe(true); |
| 342 | 358 | expect(h.tui.screen.toText()).toContain("telemetry:read held by: sysbot"); |
| 343 | await h.press("g"); | |
| 359 | await h.press("T"); | |
| 344 | 360 | await h.press("enter"); |
| 345 | 361 | expect(h.tui.screen.toText()).toContain("take back sysbot telemetry:read? y/n"); |
| 346 | 362 | await h.press("enter"); |
| 347 | 363 | expect(hasGrant(app.db, bot.id)).toBe(true); |
| 348 | await h.press("g"); | |
| 364 | await h.press("T"); | |
| 349 | 365 | await h.press("enter"); |
| 350 | 366 | await h.press("left", "enter"); |
| 351 | 367 | expect(hasGrant(app.db, bot.id)).toBe(false); |
| @@ -356,7 +372,7 @@ describe("tui system telemetry grant", () => { | ||
| 356 | 372 | const h = boot(bob); |
| 357 | 373 | await settleApp(h.tui); |
| 358 | 374 | expect(h.tui.screen.toText()).not.toContain("telemetry:read"); |
| 359 | await h.press("g"); | |
| 375 | await h.press("T"); | |
| 360 | 376 | expect(h.tui.screen.toText()).toContain("telemetry:read is a forge admin's to grant"); |
| 361 | 377 | expect(h.tui.screen.toText()).not.toContain("Grant telemetry:read to"); |
| 362 | 378 | expect(h.tui.screen.toText()).toContain("CPU"); |
| @@ -365,14 +381,14 @@ describe("tui system telemetry grant", () => { | ||
| 365 | 381 | h.tui.stop?.(); |
| 366 | 382 | }); |
| 367 | 383 | |
| 368 | test("the System command passes the session, so the admin has the line and g", async () => { | |
| 384 | test("the System command passes the session, so the admin has the line and T", async () => { | |
| 369 | 385 | const { app: tui, session } = createForgeApp(app, identity(carol), { terminal: headlessTerminal(120, 70), exitHooks: false }); |
| 370 | 386 | tui.start(); |
| 371 | 387 | const system = forgeCommands(session)(tui.ctx).find((c) => c.id === "system"); |
| 372 | 388 | system!.run(); |
| 373 | 389 | await settleApp(tui); |
| 374 | 390 | expect(tui.screen.toText()).toContain("telemetry:read held by:"); |
| 375 | tui.dispatch({ type: "key", key: "g", ctrl: false, alt: false, shift: false }); | |
| 391 | tui.dispatch({ type: "key", key: "T", ctrl: false, alt: false, shift: false }); | |
| 376 | 392 | await settleApp(tui); |
| 377 | 393 | expect(tui.screen.toText()).toContain("Grant telemetry:read to"); |
| 378 | 394 | tui.stop?.(); |
new above
offline
The file's header comment (line 6) still says
gsets the range; make itt. Same for the other screen headers listed in the review body.