diff --git a/crates/berth-api/src/types.rs b/crates/berth-api/src/types.rs index b6c3e73..31acab0 100644 --- a/crates/berth-api/src/types.rs +++ b/crates/berth-api/src/types.rs @@ -588,7 +588,7 @@ pub struct Action { pub label: String, #[serde(default)] pub help: String, - /// The group of the page it is listed in; `System` when empty. + /// The group of the page it is listed in; `Host` when empty. #[serde(default)] pub group: String, #[serde(default)] diff --git a/crates/berth-core/src/host_type.rs b/crates/berth-core/src/host_type.rs index b8b2de1..28426f3 100644 --- a/crates/berth-core/src/host_type.rs +++ b/crates/berth-core/src/host_type.rs @@ -280,7 +280,7 @@ pub fn rename_action() -> Action { name: "rename".into(), label: "Rename".into(), help: "Give the host another name in berth. Its profile, passwords, host keys, machine record, messages and jobs go with it. The machine itself stays as it is and keeps running, and so does its hostname unless hostname says otherwise.".into(), - group: "Set-Up".into(), + group: "Host".into(), role: Role::Admin, arguments: vec![ berth_api::Argument { diff --git a/crates/berth-tui/src/host.rs b/crates/berth-tui/src/host.rs index 84af691..2d6908e 100644 --- a/crates/berth-tui/src/host.rs +++ b/crates/berth-tui/src/host.rs @@ -638,9 +638,12 @@ pub fn groups(host: &HostView, terminal_user: &str) -> Vec<(String, Vec<(String, .map(|group| (group.title, group.rows)) .collect(); let terminal = (format!(" ▸ Terminal · as {terminal_user}"), Pick::Terminal); - match groups.iter_mut().find(|(title, _)| title == "System") { + match groups + .iter_mut() + .find(|(title, _)| title == page::HOST_GROUP) + { Some((_, rows)) => rows.insert(1.min(rows.len()), terminal), - None => groups.insert(0, ("System".to_owned(), vec![terminal])), + None => groups.insert(0, (page::HOST_GROUP.to_owned(), vec![terminal])), } if !host.sessions.is_empty() { let rows = host diff --git a/crates/berth-tui/src/page.rs b/crates/berth-tui/src/page.rs index 3ad4aad..5b43b36 100644 --- a/crates/berth-tui/src/page.rs +++ b/crates/berth-tui/src/page.rs @@ -36,12 +36,16 @@ pub struct Group { /// The group an action is listed in. pub fn group_of(action: &Action) -> &str { - match action.group.is_empty() { - true => "System", - false => &action.group, + match action.group.as_str() { + // A controller applied by an earlier berth says System for these. + "" | "System" => HOST_GROUP, + group => group, } } +/// The group of what a host does that belongs to no other group. +pub const HOST_GROUP: &str = "Host"; + /// What a row says of an action that cannot run now; its help says why. pub const UNAVAILABLE: &str = " · not now"; diff --git a/docs/content/docs/(guide)/extend/writing-plugins.mdx b/docs/content/docs/(guide)/extend/writing-plugins.mdx index bdf3c02..7d010ee 100644 --- a/docs/content/docs/(guide)/extend/writing-plugins.mdx +++ b/docs/content/docs/(guide)/extend/writing-plugins.mdx @@ -115,7 +115,7 @@ An action becomes an action of the host's controller named `PLUGIN:ACTION`. Appl arguments: { type: 'Argument[]', description: 'Values asked for before it runs: {name, label, required, default, choices}.' }, confirm: { type: 'string', description: 'A sentence to confirm before it runs, for something that cannot be taken back.' }, terminal: { type: 'boolean', default: 'false', description: 'For a command that asks something or shows a link to follow, such as a sign-in.' }, - group: { type: 'string', description: 'The overview group: System, Access, Sync, Sign-In, or your own. Default: a group named after the plugin.' }, + group: { type: 'string', description: 'The overview group: Host, Power, Access, Sync, Sign-In, or your own. Default: a group named after the plugin.' }, extends: { type: 'string | string[]', description: 'Run as a step after status, smoke, update, secrets or sign-in:status instead of having a row of its own.' }, }} /> diff --git a/docs/content/docs/(guide)/index.mdx b/docs/content/docs/(guide)/index.mdx index 4210de1..311636c 100644 --- a/docs/content/docs/(guide)/index.mdx +++ b/docs/content/docs/(guide)/index.mdx @@ -8,7 +8,7 @@ import { Cloud, Container, Server, Usb } from 'lucide-react'; berth sets up Ubuntu 26.04 amd64 machines for coding agents and manages them from your own computer. Each machine, a *host*, gets a desktop you can watch from the browser and the agents you choose. berth's terminal UI has a page per host for status, sign-ins, updates and secrets. - + ## On each host diff --git a/docs/content/docs/(guide)/use/overview.mdx b/docs/content/docs/(guide)/use/overview.mdx index c694454..f7fe0ba 100644 --- a/docs/content/docs/(guide)/use/overview.mdx +++ b/docs/content/docs/(guide)/use/overview.mdx @@ -6,7 +6,7 @@ icon: LayoutDashboard Opening an installed host shows its overview, with the connection at the top and the host's actions in groups below. The host's controller reports its own actions, and the list changes with what is installed there. - + The line under the title is the host's load, CPU, memory, disk and uptime. Under **Connection**, a line says the host's [type](/docs/use/types), and what the host itself was seen to be when that differs. diff --git a/docs/openapi/berth.openapi.json b/docs/openapi/berth.openapi.json index 22f070f..b372b2b 100644 --- a/docs/openapi/berth.openapi.json +++ b/docs/openapi/berth.openapi.json @@ -131,7 +131,7 @@ ] }, "group": { - "description": "The group of the page it is listed in; `System` when empty.", + "description": "The group of the page it is listed in; `Host` when empty.", "type": "string" }, "help": { diff --git a/docs/openapi/berth.operations.json b/docs/openapi/berth.operations.json index 1c0d200..374d396 100644 --- a/docs/openapi/berth.operations.json +++ b/docs/openapi/berth.operations.json @@ -131,7 +131,7 @@ ] }, "group": { - "description": "The group of the page it is listed in; `System` when empty.", + "description": "The group of the page it is listed in; `Host` when empty.", "type": "string" }, "help": { diff --git a/provision/ansible/roles/devbox/vars/main.yml b/provision/ansible/roles/devbox/vars/main.yml index 0dcaf87..647bd6a 100644 --- a/provision/ansible/roles/devbox/vars/main.yml +++ b/provision/ansible/roles/devbox/vars/main.yml @@ -5,30 +5,30 @@ devbox_task_dir: /usr/local/lib/berth/tasks devbox_core_tasks: - name: status label: Status - group: System + group: Host user: root help: Provisioning state, services, graphics renderer, disk space and failed units, followed by the access links and what the plugins of this host report. run: "{{ devbox_task_dir }}/status.sh" - name: smoke label: Self-Test - group: System + group: Host user: agent agent: true help: "Run devbox-smoke as the agent: graphics, browser, office tools and the coding agents. The plugins of this host add their own checks." run: devbox-smoke - - name: update - label: Update - group: System - user: root - help: apt update and dist-upgrade on the host, then what the plugins of this host keep up to date. Says whether a reboot is needed afterwards. - run: "{{ devbox_task_dir }}/update.sh" - name: reboot label: Reboot - group: System + group: Power user: root confirm: Restart the host? Everything running on it ends, sessions included. help: Restart the host. run: "{{ devbox_task_dir }}/reboot.sh" + - name: update + label: Update + group: Sync + user: root + help: apt update and dist-upgrade on the host, then what the plugins of this host keep up to date. Says whether a reboot is needed afterwards. + run: "{{ devbox_task_dir }}/update.sh" - name: access label: Access links and desktop password group: Access @@ -66,23 +66,23 @@ devbox_core_tasks: devbox_controller_tasks: - name: status label: Status - group: System + group: Host user: root help: The host, how long it has been up, the state of SSH and berthd, disk space and failed units. run: "{{ devbox_task_dir }}/status.sh controller" - - name: update - label: Update - group: System - user: root - help: apt update and dist-upgrade on the host. Says whether a reboot is needed afterwards. - run: "{{ devbox_task_dir }}/update.sh" - name: reboot label: Reboot - group: System + group: Power user: root confirm: Restart the host? Everything running on it ends, sessions included. help: Restart the host. run: "{{ devbox_task_dir }}/reboot.sh" + - name: update + label: Update + group: Sync + user: root + help: apt update and dist-upgrade on the host. Says whether a reboot is needed afterwards. + run: "{{ devbox_task_dir }}/update.sh" - name: secrets label: Secrets and registry logins group: Sync @@ -96,23 +96,23 @@ devbox_controller_tasks: devbox_node_tasks: - name: status label: Status - group: System + group: Host user: root help: The node, how long it has been up, the state of SSH, berthd, the firewall and the tailnet, disk space and failed units, followed by what its features report. run: "{{ devbox_task_dir }}/status.sh node" - - name: update - label: Update - group: System - user: root - help: apt update and dist-upgrade on the node, then what its features keep up to date. Says whether a reboot is needed afterwards. - run: "{{ devbox_task_dir }}/update.sh" - name: reboot label: Reboot - group: System + group: Power user: root confirm: Restart the node? Everything running on it ends, sessions and the machines it hosts included. help: Restart the node. run: "{{ devbox_task_dir }}/reboot.sh" + - name: update + label: Update + group: Sync + user: root + help: apt update and dist-upgrade on the node, then what its features keep up to date. Says whether a reboot is needed afterwards. + run: "{{ devbox_task_dir }}/update.sh" - name: secrets label: Secrets and registry logins group: Sync diff --git a/tests/e2e/e2e_host.py b/tests/e2e/e2e_host.py index ae4e7b0..6debeb6 100644 --- a/tests/e2e/e2e_host.py +++ b/tests/e2e/e2e_host.py @@ -15,8 +15,8 @@ def setUpClass(cls): def test_tasks_are_listed_by_group(self): listed = json.loads(self.station.berth('action', 'list', HOST, '-o', 'json').stdout) - groups = {action['group'] or 'System' for action in listed} - self.assertLessEqual({'System', 'Sync', 'Sign-In'}, groups) + groups = {action['group'] or 'Host' for action in listed} + self.assertLessEqual({'Host', 'Power', 'Sync', 'Sign-In'}, groups) secrets = next(action for action in listed if action['name'] == 'secrets') self.assertEqual(secrets['label'], 'Secrets and registry logins') self.assertRegex(self.station.berth('action', 'list', HOST).stdout, r'(?m)^secrets\s+') diff --git a/tests/test_environment.py b/tests/test_environment.py index c772119..30fee07 100644 --- a/tests/test_environment.py +++ b/tests/test_environment.py @@ -146,7 +146,7 @@ def test_shipped_plugins_make_valid_tasks(self): def test_core_tasks_name_installed_scripts(self): tasks = yaml.safe_load((ROLE / 'vars/main.yml').read_text())['devbox_core_tasks'] names = [task['name'] for task in tasks] - self.assertEqual(names, ['status', 'smoke', 'update', 'reboot', 'access', 'publish', 'pair', + self.assertEqual(names, ['status', 'smoke', 'reboot', 'update', 'access', 'publish', 'pair', 'secrets', 'sign-in:status']) for task in tasks: with self.subTest(task=task['name']): diff --git a/tests/test_node.py b/tests/test_node.py index 48fd8b6..b97cee2 100644 --- a/tests/test_node.py +++ b/tests/test_node.py @@ -119,7 +119,7 @@ def test_a_node_is_not_applied_over_a_workstation(self): def test_the_actions_of_a_node_run_what_it_installs(self): actions = {task['name']: task for task in yaml.safe_load((ROLE / 'vars/main.yml').read_text())['devbox_node_tasks']} - self.assertEqual(list(actions), ['status', 'update', 'reboot', 'secrets', 'upgrade-server']) + self.assertEqual(list(actions), ['status', 'reboot', 'update', 'secrets', 'upgrade-server']) self.assertTrue(actions['status']['run'].endswith('/status.sh node')) self.assertIn('if [[ ${1:-} == node ]]', (ROLE / 'files/tasks/status.sh').read_text()) upgrade = actions['upgrade-server']