Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions .cursor/rules/kcore-console-tui.mdc
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
description: Standards for the Rust Ratatui appliance console
globs: crates/kcore-console/**/*.rs,modules/kcore-branding.nix,packaging/systemd/kcore-console.service,docs/appliance-console.md,docs/user/appliance-console.md
alwaysApply: false
---

# kcore Console TUI

The local appliance console is a Rust TUI in `crates/kcore-console` using
Ratatui with the crossterm backend. Keep it product-grade and read-only:

- Production mode must never expose a shell. `q`, `Esc`, and `Ctrl+C` must not
exit in default mode; only `--dev` may exit interactively.
- Inventory collection must not block rendering. Use a worker/thread/channel or
another non-blocking path for NIC, disk, API, and diagnostics refresh.
- Treat missing host data as normal. Display `—` instead of panicking or leaving
empty cells for unavailable sysfs, `ip`, `lsblk`, API, or systemd data.
- Keep UI code separate from collection code: `ui/` renders `AppState`;
`inventory/` reads Linux/API state; `app.rs` owns navigation and selection.
- Use Ratatui widgets (`Block`, `Paragraph`, `Table`, `Tabs`, `List`, `Gauge`
when useful) and keep the visual language dark, clean, and appliance-like.
- If changing `modules/kcore-branding.nix`, verify gettys and `autovt@` remain
disabled so `tty2`-`tty6` cannot show login prompts.
- Add or update focused tests for parsing, formatting, navigation, and
production-vs-dev exit policy whenever behavior changes.

Before shipping a console change, run at least:

```bash
nix develop -c cargo fmt
nix develop -c cargo test -p kcore-console
nix develop -c cargo clippy -p kcore-console --all-targets -- --deny warnings
nix build .#kcore-console
```
Comment on lines +27 to +34

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Add the workspace test gate to the shipping checklist.

This checklist only runs cargo test -p kcore-console, so a console change can still satisfy the local steps while breaking another crate in the workspace.

Proposed fix
 ```bash
 nix develop -c cargo fmt
+nix develop -c cargo test --workspace
 nix develop -c cargo test -p kcore-console
 nix develop -c cargo clippy -p kcore-console --all-targets -- --deny warnings
 nix build .#kcore-console
</details>

As per coding guidelines "Run `cargo test --workspace` before committing to ensure all tests pass".

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @.cursor/rules/kcore-console-tui.mdc around lines 27 - 34, Add the workspace
test gate to the shipping checklist by inserting a step to run the full
workspace tests before the package-specific test; specifically, add "nix develop
-c cargo test --workspace" just before the existing "nix develop -c cargo test
-p kcore-console" line in the checklist so that the workspace-wide tests run
prior to the package-level test.


</details>

<!-- fingerprinting:phantom:medusa:grasshopper:8198686e-9684-49a1-b55c-f46c8a0b0a5f -->

<!-- d98c2f50 -->

<!-- This is an auto-generated comment by CodeRabbit -->

Loading
Loading