docs: refresh AGENTS.md for app/ module split and updated test counts
CI / ci (windows-latest) (push) Has been cancelled
CI / ci (ubuntu-latest) (push) Failing after 49m21s
CI / ci (windows-latest) (push) Has been cancelled
CI / ci (ubuntu-latest) (push) Failing after 49m21s
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -76,7 +76,15 @@ All ten modules are declared `pub` in `lib.rs` and re-exported as `log_viewer_co
|
|||||||
## TUI Architecture
|
## TUI Architecture
|
||||||
|
|
||||||
- **`main.rs`** — clap CLI (`files: Vec<String>`), `TerminalGuard` RAII for raw mode + alternate screen. **CRITICAL**: `Drop` does not run on `std::process::exit` or `panic = "abort"` — never call `process::exit` inside the guarded scope; return `Err` and use `?` instead. Event loop: poll indexer → poll watcher → draw → poll keys, 100ms timeout.
|
- **`main.rs`** — clap CLI (`files: Vec<String>`), `TerminalGuard` RAII for raw mode + alternate screen. **CRITICAL**: `Drop` does not run on `std::process::exit` or `panic = "abort"` — never call `process::exit` inside the guarded scope; return `Err` and use `?` instead. Event loop: poll indexer → poll watcher → draw → poll keys, 100ms timeout.
|
||||||
- **`app.rs`** — `App` struct (~4000 lines including ~135 inline tests, test mod starts at `#[cfg(test)] mod tests`). `AppLoadingState: Empty | Loading { reader, estimated_lines, progress_percent } | Ready { reader } | Error(String)`. `AppMode: Normal | Settings`. Viewport cache for scroll. All key handling.
|
- **`app/`** — module directory (split from the former monolithic `app.rs`). `mod.rs` (~3000 lines, inline `tests` mod at `#[cfg(test)] mod tests`) holds the `App` struct, `AppLoadingState: Empty | Loading { reader, estimated_lines, progress_percent } | Ready { reader } | Error(String)`, `AppMode: Normal | Settings`, `ViewportRenderRow`, and the main impl blocks. Per-concern helpers are split into submodules:
|
||||||
|
- `input.rs` — `handle_key` + Normal-mode key dispatch
|
||||||
|
- `settings.rs` — Settings-mode key dispatch (←/→ color cycle, j/k level select, Enter/Esc)
|
||||||
|
- `scroll.rs` — line/half/full-page scroll + VHI-aware sub-offset walk
|
||||||
|
- `viewport.rs` — viewport computation helpers
|
||||||
|
- `viewport_cache.rs` — on-demand viewport-sized render cache
|
||||||
|
- `loading.rs` — loading-state polling/progress helpers
|
||||||
|
- `watcher.rs` — file-watcher event polling + reload/reindex glue
|
||||||
|
- `query.rs` — query helpers
|
||||||
- **`ui.rs`** — ratatui rendering: title bar, content area, status bar, settings popup
|
- **`ui.rs`** — ratatui rendering: title bar, content area, status bar, settings popup
|
||||||
- **`color.rs`** — `LogLevel` → ratatui `Color` via `ColorConfig`
|
- **`color.rs`** — `LogLevel` → ratatui `Color` via `ColorConfig`
|
||||||
|
|
||||||
@@ -88,9 +96,9 @@ j/k scroll, Ctrl+d/u half-page, Ctrl+f/b full-page, G/gg jump end/top, Tab toggl
|
|||||||
|
|
||||||
All tests are inline (`#[cfg(test)] mod tests` blocks). No `tests/` directories, no integration tests, no async tests.
|
All tests are inline (`#[cfg(test)] mod tests` blocks). No `tests/` directories, no integration tests, no async tests.
|
||||||
|
|
||||||
- **~450 tests total**: core 251, tui 136, bench 63, gui 0
|
- **~470 tests total**: core 262, tui 142, bench 63, gui 0
|
||||||
- Temp-file helpers vary per module — check the local `tests` mod before assuming an API:
|
- Temp-file helpers vary per module — check the local `tests` mod before assuming an API:
|
||||||
- `make_temp_file(content) -> PathBuf` — `tui/app.rs`, `tui/ui.rs`
|
- `make_temp_file(content) -> PathBuf` — `tui/app/mod.rs`, `tui/ui.rs`
|
||||||
- `make_test_file(lines) -> NamedTempFile` — `core/io/index_cache.rs`
|
- `make_test_file(lines) -> NamedTempFile` — `core/io/index_cache.rs`
|
||||||
- `make_file(data) -> NamedTempFile` — `core/io/read_cache.rs`
|
- `make_file(data) -> NamedTempFile` — `core/io/read_cache.rs`
|
||||||
- `struct TempFile { ... }` — `core/io/line_sampler.rs`
|
- `struct TempFile { ... }` — `core/io/line_sampler.rs`
|
||||||
|
|||||||
Reference in New Issue
Block a user