key_routing_screen
key_routing_screen
¶
Screens for managing vault SSH keys and their project links.
Two views over the same many-to-many relationship between deploy keys and projects:
KeyRoutingScreen— the routing matrix (keys × projects), where the operator wires and unwires links directly. A list-mode fallback (a key list beside a project checklist) covers terminals too narrow for the grid.KeyInventoryScreen— the key catalog: mint a new key for a project, inspect a key's fingerprint and the projects it serves, or delete it everywhere.
Both drive the verbs in
terok.lib.api.ssh_routing and share a
common base for the load → mutate → reload cycle. They are reusable outside
terok-tui: KeyRoutingApp
runs the matrix as a standalone Textual app, mirroring terok clearance.
KeyRoutingScreen()
¶
Bases: _BaseRoutingScreen
The routing matrix plus a master-detail list fallback.
Start in matrix mode.
Source code in src/terok/tui/key_routing_screen.py
BINDINGS = [_modal_binding('escape', 'dismiss_screen', 'Back'), _modal_binding('q', 'dismiss_screen', 'Back'), _modal_binding('m', 'toggle_mode', 'Matrix / list'), _modal_binding('n', 'pick_project_to_mint', 'Mint key'), _modal_binding('p', 'show_cursor_public_key', 'Public key'), _modal_binding('f', 'set_cursor_default', 'Make default'), _modal_binding('c', 'rename_cursor_key', 'Rename key'), _modal_binding('d', 'delete_cursor_key', 'Delete key'), _modal_binding('i', 'show_inventory', 'Inventory'), _modal_binding('r', 'reload', 'Refresh'), _modal_binding('h', 'focus_keys', 'Keys pane'), _modal_binding('l', 'focus_projects', 'Projects pane')]
class-attribute
instance-attribute
¶
CSS = '\n KeyRoutingScreen { layout: vertical; background: $background; }\n #kr-header { height: 1; background: $primary; color: $text; padding: 0 1; }\n #kr-hint { height: auto; color: $text-muted; padding: 0 1; }\n #kr-list { height: 1fr; }\n #kr-keys { width: 40%; border: round $primary; }\n #kr-projects { width: 1fr; border: round $primary; }\n '
class-attribute
instance-attribute
¶
compose()
¶
Header, the matrix, and the (initially hidden) list-mode panes.
Source code in src/terok/tui/key_routing_screen.py
on_mount()
¶
Load routing, show the matrix, hide the list panes.
on_routing_matrix_cell_toggled(event)
¶
Wire a link, or unwire one (confirming a last link).
Source code in src/terok/tui/key_routing_screen.py
on_routing_matrix_mint_requested(event)
¶
on_list_view_highlighted(event)
¶
Repopulate the project checklist for the highlighted key.
Source code in src/terok/tui/key_routing_screen.py
on_selection_list_selection_toggled(event)
¶
Translate a checklist tick into a link, a clear into an unlink.
Source code in src/terok/tui/key_routing_screen.py
action_toggle_mode()
¶
Swap between the matrix grid and the list panes.
Source code in src/terok/tui/key_routing_screen.py
action_focus_keys()
¶
action_focus_projects()
¶
action_pick_project_to_mint()
¶
action_rename_cursor_key()
¶
action_show_cursor_public_key()
¶
Show the public key under the matrix cursor or list highlight.
action_set_cursor_default()
¶
Offer the selected linked key first for the highlighted project.
Source code in src/terok/tui/key_routing_screen.py
action_delete_cursor_key()
¶
action_show_inventory()
¶
KeyInventoryScreen()
¶
Bases: _BaseRoutingScreen
A catalog of every vault key — mint, inspect, and delete.
Source code in src/terok/tui/key_routing_screen.py
BINDINGS = [_modal_binding('escape', 'dismiss_screen', 'Back'), _modal_binding('q', 'dismiss_screen', 'Back'), _modal_binding('n', 'mint', 'Mint key'), _modal_binding('p', 'show_public_key', 'Public key'), _modal_binding('c', 'rename', 'Rename key'), _modal_binding('d', 'delete', 'Delete key'), _modal_binding('r', 'reload', 'Refresh')]
class-attribute
instance-attribute
¶
CSS = '\n KeyInventoryScreen { layout: vertical; background: $background; }\n #ki-header { height: auto; background: $primary; color: $text; padding: 0 1; }\n #ki-list { height: 1fr; border: round $primary; }\n '
class-attribute
instance-attribute
¶
compose()
¶
Header plus the scrollable key list.
Source code in src/terok/tui/key_routing_screen.py
on_mount()
¶
action_mint()
¶
action_rename()
¶
Rename the highlighted key's comment.
action_show_public_key()
¶
Show the highlighted key's public line for copying.
action_delete()
¶
Delete the highlighted key everywhere.
KeyRoutingApp
¶
Bases: App[None]
Standalone Textual app that opens only the routing matrix.
Lets another tool — or python -m — drive the key↔project matrix
without the rest of terok-tui, the same way terok clearance
ships ClearanceScreen.