Skip to content

Commit d9ff2ea

Browse files
committed
various cli updates
Signed-off-by: Yujong Lee <yujonglee.dev@gmail.com>
1 parent 18f9c01 commit d9ff2ea

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2754
-1577
lines changed

AGENTS.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,27 @@ TinyBase as the primary data store (schema at `packages/store/src/tinybase.ts`),
3131
- Use `cn` from `@hypr/utils` for conditional classNames. Always pass an array, split by logical grouping.
3232
- Use `motion/react` instead of `framer-motion`.
3333

34+
## CLI TUI Command Architecture
35+
36+
Each TUI command in `apps/cli/src/commands/` follows this layout:
37+
38+
```
39+
commands/<name>/
40+
mod.rs -- Screen impl, Args, run() [glue]
41+
app.rs -- App, dispatch(Action)->Vec<Effect> [pure state machine]
42+
action.rs -- Action enum [input events]
43+
effect.rs -- Effect enum [output commands]
44+
runtime.rs -- Runtime, RuntimeEvent [async I/O]
45+
ui.rs -- draw(frame, app) [rendering]
46+
```
47+
48+
Naming rules:
49+
- Types drop the command prefix: `App`, `Action`, `Effect`, `Runtime`, `RuntimeEvent`
50+
- `app.rs``app/mod.rs` with private submodules when state is complex
51+
- `ui.rs``ui/mod.rs` with sub-files when rendering is complex
52+
- `action.rs`/`effect.rs` are siblings of `mod.rs`, never nested inside `app/`
53+
- `app.rs` contains no rendering logic, no API calls, no async code
54+
3455
## Misc
3556

3657
- Do not create summary docs or example code files unless requested.

Cargo.lock

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ hypr-cactus = { path = "crates/cactus", package = "cactus" }
6363
hypr-cactus-model = { path = "crates/cactus-model", package = "cactus-model" }
6464
hypr-calendar-interface = { path = "crates/calendar-interface", package = "calendar-interface" }
6565
hypr-chatwoot = { path = "crates/chatwoot", package = "chatwoot" }
66+
hypr-cli-tui = { path = "crates/cli-tui", package = "cli-tui" }
6667
hypr-data = { path = "crates/data", package = "data" }
6768
hypr-db-core = { path = "crates/db-core", package = "db-core" }
6869
hypr-db-parser = { path = "crates/db-parser", package = "db-parser" }

apps/cli/Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ path = "src/main.rs"
1515
hypr-api-env = { workspace = true }
1616
hypr-audio = { workspace = true }
1717
hypr-audio-actual = { workspace = true }
18+
hypr-audio-mock = { workspace = true, optional = true }
1819
hypr-audio-utils = { workspace = true }
20+
hypr-cli-tui = { workspace = true }
1921
hypr-file = { workspace = true }
2022
hypr-fs-sync-core = { workspace = true }
2123
hypr-language = { workspace = true }
@@ -61,3 +63,6 @@ tokio = { workspace = true, features = ["rt-multi-thread", "macros", "signal", "
6163
tokio-stream = { workspace = true }
6264
url = { workspace = true }
6365
uuid = { workspace = true, features = ["v4"] }
66+
67+
[features]
68+
mock-audio = ["dep:hypr-audio-mock"]

apps/cli/src/commands/auth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const AUTH_URL: &str = "https://char.com/auth";
44

55
pub fn run() -> CliResult<()> {
66
if let Err(e) = open::that(AUTH_URL) {
7-
return Err(CliError::external_action_failed(
7+
return Err(CliError::operation_failed(
88
"open auth page",
99
format!("{e}\nPlease visit: {AUTH_URL}"),
1010
));

0 commit comments

Comments
 (0)