ππΌββοΈ The blackboard for coding agents - agentic development environment for claude code, codex, cursor, opencode, grok and more.
Rust adeai-agentsclaudeclaude-codecodexcursorgeminigrokopencodespec-driven-developmentvibe-codingvim
initial commit
fynnfluegged761be2b9853
diff --git a/.gitignore b/.gitignoreindex ad67955..a9a11c4 100644--- a/.gitignore+++ b/.gitignore@@ -1,21 +1,21 @@-# Generated by Cargo-# will have compiled files and executables-debug-target+# Build artifacts+/target/+debug/+release/-# These are backup files generated by rustfmt-**/*.rs.bk+# IDE+.idea/+.vscode/+*.swp+*.swo+*~-# MSVC Windows builds of rustc generate these, which store debugging information-*.pdb+# OS+.DS_Store+Thumbs.db-# Generated by cargo mutants-# Contains mutation testing data-**/mutants.out*/+# Local agtx data (per-project)+.agtx/-# RustRover-# JetBrains specific template is maintained in a separate JetBrains.gitignore that can-# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore-# and can be added to the global gitignore or merged into this file. For a more nuclear-# option (not recommended) you can uncomment the following to ignore the entire idea folder.-#.idea/+# Logs+*.logdiff --git a/CLAUDE.md b/CLAUDE.mdnew file mode 100644index 0000000..851e2dc--- /dev/null+++ b/CLAUDE.md@@ -0,0 +1,138 @@+# AGTX - Terminal Kanban for Coding Agents++A terminal-native kanban board for managing multiple coding agent sessions (Claude Code, Aider, etc.) with isolated git worktrees.++## Quick Start++```bash+# Build+cargo build --release++# Run in a git project directory+./target/release/agtx++# Or run in dashboard mode+./target/release/agtx -g+```++## Architecture++```+src/+βββ main.rs # Entry point, CLI arg parsing, AppMode enum+βββ tui/+β βββ mod.rs # Re-exports+β βββ app.rs # Main App struct, event loop, rendering (largest file)+β βββ board.rs # BoardState - kanban column/row navigation+β βββ input.rs # InputMode enum for UI states+βββ db/+β βββ mod.rs # Re-exports+β βββ schema.rs # Database struct, SQLite operations+β βββ models.rs # Task, Project, TaskStatus, AgentStatus enums+βββ tmux/+β βββ mod.rs # Tmux server "agents", session management+βββ git/+β βββ mod.rs # is_git_repo helper+β βββ worktree.rs # Git worktree create/remove/list+βββ agent/+β βββ mod.rs # Agent definitions, detection, spawn args+βββ config/+ βββ mod.rs # GlobalConfig, ProjectConfig, MergedConfig+```++## Key Concepts++### Task Workflow+```+Backlog β Planning β Running β Review β Done+ β β β+ worktree Claude PR opens+ created starts+```++- **Planning**: Creates git worktree at `.agtx/worktrees/{slug}`, starts Claude Code session+- **Running**: Claude is implementing (tmux session active)+- **Review**: PR is opened, awaiting review. Can move back to Running for changes+- **Done**: PR merged, cleanup worktree/branch/tmux session++### Database Storage+All databases stored centrally (not in project directories):+- macOS: `~/Library/Application Support/agtx/`+- Linux: `~/.config/agtx/`++Structure:+- `index.db` - Global project index+- `projects/{hash}.db` - Per-project task database (hash of project path)++### Tmux Architecture+- All agent sessions run in tmux server named `agents` (`tmux -L agents`)+- Session naming: `task-{id}--{project}--{slug}`+- Separate from user's regular tmux sessions++## Keyboard Shortcuts (Board Mode)++| Key | Action |+|-----|--------|+| `h/l` | Move between columns |+| `j/k` | Move between tasks |+| `o` | Create new task |+| `Enter` | Open task shell popup |+| `i` | Edit task |+| `d` | Delete task |+| `m` | Move task right (advance workflow) |+| `/` | Search tasks |+| `e` | Toggle project sidebar |+| `q` | Quit |++## Code Patterns++### Ratatui TUI+- Uses `crossterm` backend+- State separated from terminal for borrow checker: `App { terminal, state: AppState }`+- Drawing functions are static: `fn draw_*(state: &AppState, frame: &mut Frame, area: Rect)`++### Error Handling+- Use `anyhow::Result` for all fallible functions+- Use `.context()` for adding context to errors+- Gracefully handle missing tmux sessions/worktrees++### Database+- SQLite via `rusqlite` with `bundled` feature+- Migrations via `ALTER TABLE ... ADD COLUMN` (ignores errors if column exists)+- DateTime stored as RFC3339 strings++## Building++```bash+cargo build --release+```++Dependencies require:+- Rust 1.70++- SQLite (bundled via rusqlite)+- tmux (runtime dependency)+- git (runtime dependency)++## Testing++```bash+cargo test+```++## Common Tasks++### Adding a new task field+1. Add field to `Task` struct in `src/db/models.rs`+2. Add column to schema and migration in `src/db/schema.rs`+3. Update `create_task`, `update_task`, `task_from_row` in schema.rs+4. Update UI rendering in `src/tui/app.rs`++### Adding a new agent+1. Add to `known_agents()` in `src/agent/mod.rs`+2. Add spawn args handling in `build_spawn_args()`+3. Add resume args if supported in `build_resume_args()`++### Adding a keyboard shortcut+1. Find the appropriate `handle_*_key` function in `src/tui/app.rs`+2. Add match arm for the new key+3. Update help/footer text if visible to userdiff --git a/Cargo.lock b/Cargo.locknew file mode 100644index 0000000..eca9a00--- /dev/null+++ b/Cargo.lock@@ -0,0 +1,2038 @@+# This file is automatically @generated by Cargo.+# It is not intended for manual editing.+version = 4++[[package]]+name = "agtx"+version = "0.1.0"+dependencies = [+ "anyhow",+ "chrono",+ "crossterm",+ "directories",+ "ratatui",+ "rusqlite",+ "serde",+ "serde_json",+ "tempfile",+ "thiserror 2.0.18",+ "tokio",+ "toml",+ "uuid",+ "which",+]++[[package]]+name = "aho-corasick"+version = "1.1.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301"+dependencies = [+ "memchr",+]++[[package]]+name = "allocator-api2"+version = "0.2.21"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"++[[package]]+name = "android_system_properties"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311"+dependencies = [+ "libc",+]++[[package]]+name = "anyhow"+version = "1.0.101"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f0e0fee31ef5ed1ba1316088939cea399010ed7731dba877ed44aeb407a75ea"++[[package]]+name = "atomic"+version = "0.6.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a89cbf775b137e9b968e67227ef7f775587cde3fd31b0d8599dbd0f598a48340"+dependencies = [+ "bytemuck",+]++[[package]]+name = "autocfg"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"++[[package]]+name = "base64"+version = "0.22.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6"++[[package]]+name = "bit-set"+version = "0.5.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1"+dependencies = [+ "bit-vec",+]++[[package]]+name = "bit-vec"+version = "0.6.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb"++[[package]]+name = "bitflags"+version = "1.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"++[[package]]+name = "bitflags"+version = "2.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "812e12b5285cc515a9c72a5c1d3b6d46a19dac5acfef5265968c166106e31dd3"++[[package]]+name = "block-buffer"+version = "0.10.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71"+dependencies = [+ "generic-array",+]++[[package]]+name = "bumpalo"+version = "3.19.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5dd9dc738b7a8311c7ade152424974d8115f2cdad61e8dab8dac9f2362298510"++[[package]]+name = "bytemuck"+version = "1.25.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c8efb64bd706a16a1bdde310ae86b351e4d21550d98d056f22f8a7f7a2183fec"++[[package]]+name = "bytes"+version = "1.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33"++[[package]]+name = "castaway"+version = "0.2.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dec551ab6e7578819132c713a93c022a05d60159dc86e7a7050223577484c55a"+dependencies = [+ "rustversion",+]++[[package]]+name = "cc"+version = "1.2.55"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "47b26a0954ae34af09b50f0de26458fa95369a0d478d8236d3f93082b219bd29"+dependencies = [+ "find-msvc-tools",+ "shlex",+]++[[package]]+name = "cfg-if"+version = "1.0.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801"++[[package]]+name = "cfg_aliases"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724"++[[package]]+name = "chrono"+version = "0.4.43"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118"+dependencies = [+ "iana-time-zone",+ "js-sys",+ "num-traits",+ "serde",+ "wasm-bindgen",+ "windows-link",+]++[[package]]+name = "compact_str"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3fdb1325a1cece981e8a296ab8f0f9b63ae357bd0784a9faaf548cc7b480707a"+dependencies = [+ "castaway",+ "cfg-if",+ "itoa",+ "rustversion",+ "ryu",+ "static_assertions",+]++[[package]]+name = "convert_case"+version = "0.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "633458d4ef8c78b72454de2d54fd6ab2e60f9e02be22f3c6104cdc8a4e0fceb9"+dependencies = [+ "unicode-segmentation",+]++[[package]]+name = "core-foundation-sys"+version = "0.8.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b"++[[package]]+name = "cpufeatures"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280"+dependencies = [+ "libc",+]++[[package]]+name = "crossterm"+version = "0.29.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d8b9f2e4c67f833b660cdb0a3523065869fb35570177239812ed4c905aeff87b"+dependencies = [+ "bitflags 2.10.0",+ "crossterm_winapi",+ "derive_more",+ "document-features",+ "mio",+ "parking_lot",+ "rustix",+ "signal-hook",+ "signal-hook-mio",+ "winapi",+]++[[package]]+name = "crossterm_winapi"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "acdd7c62a3665c7f6830a51635d9ac9b23ed385797f70a83bb8bafe9c572ab2b"+dependencies = [+ "winapi",+]++[[package]]+name = "crypto-common"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a"+dependencies = [+ "generic-array",+ "typenum",+]++[[package]]+name = "csscolorparser"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "eb2a7d3066da2de787b7f032c736763eb7ae5d355f81a68bab2675a96008b0bf"+dependencies = [+ "lab",+ "phf",+]++[[package]]+name = "darling"+version = "0.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "25ae13da2f202d56bd7f91c25fba009e7717a1e4a1cc98a76d844b65ae912e9d"+dependencies = [+ "darling_core",+ "darling_macro",+]++[[package]]+name = "darling_core"+version = "0.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9865a50f7c335f53564bb694ef660825eb8610e0a53d3e11bf1b0d3df31e03b0"+dependencies = [+ "ident_case",+ "proc-macro2",+ "quote",+ "strsim",+ "syn 2.0.114",+]++[[package]]+name = "darling_macro"+version = "0.23.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac3984ec7bd6cfa798e62b4a642426a5be0e68f9401cfc2a01e3fa9ea2fcdb8d"+dependencies = [+ "darling_core",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "deltae"+version = "0.3.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5729f5117e208430e437df2f4843f5e5952997175992d1414f94c57d61e270b4"++[[package]]+name = "deranged"+version = "0.5.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587"+dependencies = [+ "powerfmt",+]++[[package]]+name = "derive_more"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134"+dependencies = [+ "derive_more-impl",+]++[[package]]+name = "derive_more-impl"+version = "2.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb"+dependencies = [+ "convert_case",+ "proc-macro2",+ "quote",+ "rustc_version",+ "syn 2.0.114",+]++[[package]]+name = "digest"+version = "0.10.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292"+dependencies = [+ "block-buffer",+ "crypto-common",+]++[[package]]+name = "directories"+version = "6.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d"+dependencies = [+ "dirs-sys",+]++[[package]]+name = "dirs-sys"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab"+dependencies = [+ "libc",+ "option-ext",+ "redox_users",+ "windows-sys 0.61.2",+]++[[package]]+name = "document-features"+version = "0.2.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4b8a88685455ed29a21542a33abd9cb6510b6b129abadabdcef0f4c55bc8f61"+dependencies = [+ "litrs",+]++[[package]]+name = "either"+version = "1.15.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719"++[[package]]+name = "env_home"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c7f84e12ccf0a7ddc17a6c41c93326024c42920d7ee630d04950e6926645c0fe"++[[package]]+name = "equivalent"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f"++[[package]]+name = "errno"+version = "0.3.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"+dependencies = [+ "libc",+ "windows-sys 0.61.2",+]++[[package]]+name = "euclid"+version = "0.22.13"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df61bf483e837f88d5c2291dcf55c67be7e676b3a51acc48db3a7b163b91ed63"+dependencies = [+ "num-traits",+]++[[package]]+name = "fallible-iterator"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2acce4a10f12dc2fb14a218589d4f1f62ef011b2d0cc4b3cb1bba8e94da14649"++[[package]]+name = "fallible-streaming-iterator"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7360491ce676a36bf9bb3c56c1aa791658183a54d2744120f27285738d90465a"++[[package]]+name = "fancy-regex"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b95f7c0680e4142284cf8b22c14a476e87d61b004a3a0861872b32ef7ead40a2"+dependencies = [+ "bit-set",+ "regex",+]++[[package]]+name = "fastrand"+version = "2.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be"++[[package]]+name = "filedescriptor"+version = "0.8.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e40758ed24c9b2eeb76c35fb0aebc66c626084edd827e07e1552279814c6682d"+dependencies = [+ "libc",+ "thiserror 1.0.69",+ "winapi",+]++[[package]]+name = "find-msvc-tools"+version = "0.1.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582"++[[package]]+name = "finl_unicode"+version = "1.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9844ddc3a6e533d62bba727eb6c28b5d360921d5175e9ff0f1e621a5c590a4d5"++[[package]]+name = "fixedbitset"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80"++[[package]]+name = "fnv"+version = "1.0.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1"++[[package]]+name = "foldhash"+version = "0.1.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2"++[[package]]+name = "foldhash"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb"++[[package]]+name = "generic-array"+version = "0.14.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a"+dependencies = [+ "typenum",+ "version_check",+]++[[package]]+name = "getrandom"+version = "0.2.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0"+dependencies = [+ "cfg-if",+ "libc",+ "wasi",+]++[[package]]+name = "getrandom"+version = "0.3.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd"+dependencies = [+ "cfg-if",+ "libc",+ "r-efi",+ "wasip2",+]++[[package]]+name = "hashbrown"+version = "0.15.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1"+dependencies = [+ "foldhash 0.1.5",+]++[[package]]+name = "hashbrown"+version = "0.16.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100"+dependencies = [+ "allocator-api2",+ "equivalent",+ "foldhash 0.2.0",+]++[[package]]+name = "hashlink"+version = "0.10.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7382cf6263419f2d8df38c55d7da83da5c18aef87fc7a7fc1fb1e344edfe14c1"+dependencies = [+ "hashbrown 0.15.5",+]++[[package]]+name = "heck"+version = "0.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea"++[[package]]+name = "hex"+version = "0.4.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70"++[[package]]+name = "iana-time-zone"+version = "0.1.65"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470"+dependencies = [+ "android_system_properties",+ "core-foundation-sys",+ "iana-time-zone-haiku",+ "js-sys",+ "log",+ "wasm-bindgen",+ "windows-core",+]++[[package]]+name = "iana-time-zone-haiku"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f"+dependencies = [+ "cc",+]++[[package]]+name = "ident_case"+version = "1.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"++[[package]]+name = "indexmap"+version = "2.13.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017"+dependencies = [+ "equivalent",+ "hashbrown 0.16.1",+]++[[package]]+name = "indoc"+version = "2.0.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"+dependencies = [+ "rustversion",+]++[[package]]+name = "instability"+version = "0.3.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "357b7205c6cd18dd2c86ed312d1e70add149aea98e7ef72b9fdf0270e555c11d"+dependencies = [+ "darling",+ "indoc",+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "itertools"+version = "0.14.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285"+dependencies = [+ "either",+]++[[package]]+name = "itoa"+version = "1.0.17"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2"++[[package]]+name = "js-sys"+version = "0.3.85"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3"+dependencies = [+ "once_cell",+ "wasm-bindgen",+]++[[package]]+name = "kasuari"+version = "0.4.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fe90c1150662e858c7d5f945089b7517b0a80d8bf7ba4b1b5ffc984e7230a5b"+dependencies = [+ "hashbrown 0.16.1",+ "portable-atomic",+ "thiserror 2.0.18",+]++[[package]]+name = "lab"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bf36173d4167ed999940f804952e6b08197cae5ad5d572eb4db150ce8ad5d58f"++[[package]]+name = "lazy_static"+version = "1.5.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"++[[package]]+name = "libc"+version = "0.2.180"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bcc35a38544a891a5f7c865aca548a982ccb3b8650a5b06d0fd33a10283c56fc"++[[package]]+name = "libredox"+version = "0.1.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3d0b95e02c851351f877147b7deea7b1afb1df71b63aa5f8270716e0c5720616"+dependencies = [+ "bitflags 2.10.0",+ "libc",+]++[[package]]+name = "libsqlite3-sys"+version = "0.32.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fbb8270bb4060bd76c6e96f20c52d80620f1d82a3470885694e41e0f81ef6fe7"+dependencies = [+ "cc",+ "pkg-config",+ "vcpkg",+]++[[package]]+name = "line-clipping"+version = "0.3.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f4de44e98ddbf09375cbf4d17714d18f39195f4f4894e8524501726fd9a8a4a"+dependencies = [+ "bitflags 2.10.0",+]++[[package]]+name = "linux-raw-sys"+version = "0.11.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039"++[[package]]+name = "litrs"+version = "1.0.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "11d3d7f243d5c5a8b9bb5d6dd2b1602c0cb0b9db1621bafc7ed66e35ff9fe092"++[[package]]+name = "lock_api"+version = "0.4.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965"+dependencies = [+ "scopeguard",+]++[[package]]+name = "log"+version = "0.4.29"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897"++[[package]]+name = "lru"+version = "0.16.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a1dc47f592c06f33f8e3aea9591776ec7c9f9e4124778ff8a3c3b87159f7e593"+dependencies = [+ "hashbrown 0.16.1",+]++[[package]]+name = "mac_address"+version = "1.1.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c0aeb26bf5e836cc1c341c8106051b573f1766dfa05aa87f0b98be5e51b02303"+dependencies = [+ "nix",+ "winapi",+]++[[package]]+name = "memchr"+version = "2.8.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79"++[[package]]+name = "memmem"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a64a92489e2744ce060c349162be1c5f33c6969234104dbd99ddb5feb08b8c15"++[[package]]+name = "memoffset"+version = "0.9.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a"+dependencies = [+ "autocfg",+]++[[package]]+name = "minimal-lexical"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"++[[package]]+name = "mio"+version = "1.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc"+dependencies = [+ "libc",+ "log",+ "wasi",+ "windows-sys 0.61.2",+]++[[package]]+name = "nix"+version = "0.29.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "71e2746dc3a24dd78b3cfcb7be93368c6de9963d30f43a6a73998a9cf4b17b46"+dependencies = [+ "bitflags 2.10.0",+ "cfg-if",+ "cfg_aliases",+ "libc",+ "memoffset",+]++[[package]]+name = "nom"+version = "7.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"+dependencies = [+ "memchr",+ "minimal-lexical",+]++[[package]]+name = "num-conv"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050"++[[package]]+name = "num-derive"+version = "0.4.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "num-traits"+version = "0.2.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841"+dependencies = [+ "autocfg",+]++[[package]]+name = "num_threads"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c7398b9c8b70908f6371f47ed36737907c87c52af34c268fed0bf0ceb92ead9"+dependencies = [+ "libc",+]++[[package]]+name = "once_cell"+version = "1.21.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d"++[[package]]+name = "option-ext"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d"++[[package]]+name = "ordered-float"+version = "4.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7bb71e1b3fa6ca1c61f383464aaf2bb0e2f8e772a1f01d486832464de363b951"+dependencies = [+ "num-traits",+]++[[package]]+name = "parking_lot"+version = "0.12.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a"+dependencies = [+ "lock_api",+ "parking_lot_core",+]++[[package]]+name = "parking_lot_core"+version = "0.9.12"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1"+dependencies = [+ "cfg-if",+ "libc",+ "redox_syscall",+ "smallvec",+ "windows-link",+]++[[package]]+name = "pest"+version = "2.8.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662"+dependencies = [+ "memchr",+ "ucd-trie",+]++[[package]]+name = "pest_derive"+version = "2.8.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77"+dependencies = [+ "pest",+ "pest_generator",+]++[[package]]+name = "pest_generator"+version = "2.8.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f"+dependencies = [+ "pest",+ "pest_meta",+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "pest_meta"+version = "2.8.6"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220"+dependencies = [+ "pest",+ "sha2",+]++[[package]]+name = "phf"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078"+dependencies = [+ "phf_macros",+ "phf_shared",+]++[[package]]+name = "phf_codegen"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a"+dependencies = [+ "phf_generator",+ "phf_shared",+]++[[package]]+name = "phf_generator"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d"+dependencies = [+ "phf_shared",+ "rand",+]++[[package]]+name = "phf_macros"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216"+dependencies = [+ "phf_generator",+ "phf_shared",+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "phf_shared"+version = "0.11.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5"+dependencies = [+ "siphasher",+]++[[package]]+name = "pin-project-lite"+version = "0.2.16"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b"++[[package]]+name = "pkg-config"+version = "0.3.32"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c"++[[package]]+name = "portable-atomic"+version = "1.13.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c33a9471896f1c69cecef8d20cbe2f7accd12527ce60845ff44c153bb2a21b49"++[[package]]+name = "powerfmt"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391"++[[package]]+name = "proc-macro2"+version = "1.0.106"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "quote"+version = "1.0.44"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4"+dependencies = [+ "proc-macro2",+]++[[package]]+name = "r-efi"+version = "5.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f"++[[package]]+name = "rand"+version = "0.8.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"+dependencies = [+ "rand_core",+]++[[package]]+name = "rand_core"+version = "0.6.4"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"++[[package]]+name = "ratatui"+version = "0.30.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d1ce67fb8ba4446454d1c8dbaeda0557ff5e94d39d5e5ed7f10a65eb4c8266bc"+dependencies = [+ "instability",+ "ratatui-core",+ "ratatui-crossterm",+ "ratatui-macros",+ "ratatui-termwiz",+ "ratatui-widgets",+]++[[package]]+name = "ratatui-core"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5ef8dea09a92caaf73bff7adb70b76162e5937524058a7e5bff37869cbbec293"+dependencies = [+ "bitflags 2.10.0",+ "compact_str",+ "hashbrown 0.16.1",+ "indoc",+ "itertools",+ "kasuari",+ "lru",+ "strum",+ "thiserror 2.0.18",+ "unicode-segmentation",+ "unicode-truncate",+ "unicode-width",+]++[[package]]+name = "ratatui-crossterm"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "577c9b9f652b4c121fb25c6a391dd06406d3b092ba68827e6d2f09550edc54b3"+dependencies = [+ "cfg-if",+ "crossterm",+ "instability",+ "ratatui-core",+]++[[package]]+name = "ratatui-macros"+version = "0.7.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7f1342a13e83e4bb9d0b793d0ea762be633f9582048c892ae9041ef39c936f4"+dependencies = [+ "ratatui-core",+ "ratatui-widgets",+]++[[package]]+name = "ratatui-termwiz"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0f76fe0bd0ed4295f0321b1676732e2454024c15a35d01904ddb315afd3d545c"+dependencies = [+ "ratatui-core",+ "termwiz",+]++[[package]]+name = "ratatui-widgets"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7dbfa023cd4e604c2553483820c5fe8aa9d71a42eea5aa77c6e7f35756612db"+dependencies = [+ "bitflags 2.10.0",+ "hashbrown 0.16.1",+ "indoc",+ "instability",+ "itertools",+ "line-clipping",+ "ratatui-core",+ "strum",+ "time",+ "unicode-segmentation",+ "unicode-width",+]++[[package]]+name = "redox_syscall"+version = "0.5.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d"+dependencies = [+ "bitflags 2.10.0",+]++[[package]]+name = "redox_users"+version = "0.5.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a4e608c6638b9c18977b00b475ac1f28d14e84b27d8d42f70e0bf1e3dec127ac"+dependencies = [+ "getrandom 0.2.17",+ "libredox",+ "thiserror 2.0.18",+]++[[package]]+name = "regex"+version = "1.12.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-automata",+ "regex-syntax",+]++[[package]]+name = "regex-automata"+version = "0.4.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f"+dependencies = [+ "aho-corasick",+ "memchr",+ "regex-syntax",+]++[[package]]+name = "regex-syntax"+version = "0.8.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a96887878f22d7bad8a3b6dc5b7440e0ada9a245242924394987b21cf2210a4c"++[[package]]+name = "rusqlite"+version = "0.34.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "37e34486da88d8e051c7c0e23c3f15fd806ea8546260aa2fec247e97242ec143"+dependencies = [+ "bitflags 2.10.0",+ "fallible-iterator",+ "fallible-streaming-iterator",+ "hashlink",+ "libsqlite3-sys",+ "smallvec",+]++[[package]]+name = "rustc_version"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92"+dependencies = [+ "semver",+]++[[package]]+name = "rustix"+version = "1.1.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34"+dependencies = [+ "bitflags 2.10.0",+ "errno",+ "libc",+ "linux-raw-sys",+ "windows-sys 0.61.2",+]++[[package]]+name = "rustversion"+version = "1.0.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d"++[[package]]+name = "ryu"+version = "1.0.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a50f4cf475b65d88e057964e0e9bb1f0aa9bbb2036dc65c64596b42932536984"++[[package]]+name = "scopeguard"+version = "1.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49"++[[package]]+name = "semver"+version = "1.0.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2"++[[package]]+name = "serde"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e"+dependencies = [+ "serde_core",+ "serde_derive",+]++[[package]]+name = "serde_core"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad"+dependencies = [+ "serde_derive",+]++[[package]]+name = "serde_derive"+version = "1.0.228"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "serde_json"+version = "1.0.149"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86"+dependencies = [+ "itoa",+ "memchr",+ "serde",+ "serde_core",+ "zmij",+]++[[package]]+name = "serde_spanned"+version = "0.6.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3"+dependencies = [+ "serde",+]++[[package]]+name = "sha2"+version = "0.10.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283"+dependencies = [+ "cfg-if",+ "cpufeatures",+ "digest",+]++[[package]]+name = "shlex"+version = "1.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64"++[[package]]+name = "signal-hook"+version = "0.3.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"+dependencies = [+ "libc",+ "signal-hook-registry",+]++[[package]]+name = "signal-hook-mio"+version = "0.2.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b75a19a7a740b25bc7944bdee6172368f988763b744e3d4dfe753f6b4ece40cc"+dependencies = [+ "libc",+ "mio",+ "signal-hook",+]++[[package]]+name = "signal-hook-registry"+version = "1.4.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b"+dependencies = [+ "errno",+ "libc",+]++[[package]]+name = "siphasher"+version = "1.0.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e"++[[package]]+name = "smallvec"+version = "1.15.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"++[[package]]+name = "socket2"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0"+dependencies = [+ "libc",+ "windows-sys 0.60.2",+]++[[package]]+name = "static_assertions"+version = "1.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f"++[[package]]+name = "strsim"+version = "0.11.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f"++[[package]]+name = "strum"+version = "0.27.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af23d6f6c1a224baef9d3f61e287d2761385a5b88fdab4eb4c6f11aeb54c4bcf"+dependencies = [+ "strum_macros",+]++[[package]]+name = "strum_macros"+version = "0.27.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7695ce3845ea4b33927c055a39dc438a45b059f7c1b3d91d38d10355fb8cbca7"+dependencies = [+ "heck",+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "syn"+version = "1.0.109"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "syn"+version = "2.0.114"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a"+dependencies = [+ "proc-macro2",+ "quote",+ "unicode-ident",+]++[[package]]+name = "tempfile"+version = "3.24.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "655da9c7eb6305c55742045d5a8d2037996d61d8de95806335c7c86ce0f82e9c"+dependencies = [+ "fastrand",+ "getrandom 0.3.4",+ "once_cell",+ "rustix",+ "windows-sys 0.61.2",+]++[[package]]+name = "terminfo"+version = "0.9.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d4ea810f0692f9f51b382fff5893887bb4580f5fa246fde546e0b13e7fcee662"+dependencies = [+ "fnv",+ "nom",+ "phf",+ "phf_codegen",+]++[[package]]+name = "termios"+version = "0.3.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "411c5bf740737c7918b8b1fe232dca4dc9f8e754b8ad5e20966814001ed0ac6b"+dependencies = [+ "libc",+]++[[package]]+name = "termwiz"+version = "0.23.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4676b37242ccbd1aabf56edb093a4827dc49086c0ffd764a5705899e0f35f8f7"+dependencies = [+ "anyhow",+ "base64",+ "bitflags 2.10.0",+ "fancy-regex",+ "filedescriptor",+ "finl_unicode",+ "fixedbitset",+ "hex",+ "lazy_static",+ "libc",+ "log",+ "memmem",+ "nix",+ "num-derive",+ "num-traits",+ "ordered-float",+ "pest",+ "pest_derive",+ "phf",+ "sha2",+ "signal-hook",+ "siphasher",+ "terminfo",+ "termios",+ "thiserror 1.0.69",+ "ucd-trie",+ "unicode-segmentation",+ "vtparse",+ "wezterm-bidi",+ "wezterm-blob-leases",+ "wezterm-color-types",+ "wezterm-dynamic",+ "wezterm-input-types",+ "winapi",+]++[[package]]+name = "thiserror"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52"+dependencies = [+ "thiserror-impl 1.0.69",+]++[[package]]+name = "thiserror"+version = "2.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4"+dependencies = [+ "thiserror-impl 2.0.18",+]++[[package]]+name = "thiserror-impl"+version = "1.0.69"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "thiserror-impl"+version = "2.0.18"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "time"+version = "0.3.47"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c"+dependencies = [+ "deranged",+ "libc",+ "num-conv",+ "num_threads",+ "powerfmt",+ "serde_core",+ "time-core",+]++[[package]]+name = "time-core"+version = "0.1.8"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca"++[[package]]+name = "tokio"+version = "1.49.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86"+dependencies = [+ "bytes",+ "libc",+ "mio",+ "parking_lot",+ "pin-project-lite",+ "signal-hook-registry",+ "socket2",+ "tokio-macros",+ "windows-sys 0.61.2",+]++[[package]]+name = "tokio-macros"+version = "2.6.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "toml"+version = "0.8.23"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362"+dependencies = [+ "serde",+ "serde_spanned",+ "toml_datetime",+ "toml_edit",+]++[[package]]+name = "toml_datetime"+version = "0.6.11"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c"+dependencies = [+ "serde",+]++[[package]]+name = "toml_edit"+version = "0.22.27"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a"+dependencies = [+ "indexmap",+ "serde",+ "serde_spanned",+ "toml_datetime",+ "toml_write",+ "winnow",+]++[[package]]+name = "toml_write"+version = "0.1.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801"++[[package]]+name = "typenum"+version = "1.19.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"++[[package]]+name = "ucd-trie"+version = "0.1.7"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971"++[[package]]+name = "unicode-ident"+version = "1.0.22"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9312f7c4f6ff9069b165498234ce8be658059c6728633667c526e27dc2cf1df5"++[[package]]+name = "unicode-segmentation"+version = "1.12.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493"++[[package]]+name = "unicode-truncate"+version = "2.0.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "16b380a1238663e5f8a691f9039c73e1cdae598a30e9855f541d29b08b53e9a5"+dependencies = [+ "itertools",+ "unicode-segmentation",+ "unicode-width",+]++[[package]]+name = "unicode-width"+version = "0.2.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd"++[[package]]+name = "utf8parse"+version = "0.2.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821"++[[package]]+name = "uuid"+version = "1.20.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ee48d38b119b0cd71fe4141b30f5ba9c7c5d9f4e7a3a8b4a674e4b6ef789976f"+dependencies = [+ "atomic",+ "getrandom 0.3.4",+ "js-sys",+ "wasm-bindgen",+]++[[package]]+name = "vcpkg"+version = "0.2.15"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426"++[[package]]+name = "version_check"+version = "0.9.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"++[[package]]+name = "vtparse"+version = "0.6.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "6d9b2acfb050df409c972a37d3b8e08cdea3bddb0c09db9d53137e504cfabed0"+dependencies = [+ "utf8parse",+]++[[package]]+name = "wasi"+version = "0.11.1+wasi-snapshot-preview1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"++[[package]]+name = "wasip2"+version = "1.0.2+wasi-0.2.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5"+dependencies = [+ "wit-bindgen",+]++[[package]]+name = "wasm-bindgen"+version = "0.2.108"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566"+dependencies = [+ "cfg-if",+ "once_cell",+ "rustversion",+ "wasm-bindgen-macro",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-macro"+version = "0.2.108"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608"+dependencies = [+ "quote",+ "wasm-bindgen-macro-support",+]++[[package]]+name = "wasm-bindgen-macro-support"+version = "0.2.108"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55"+dependencies = [+ "bumpalo",+ "proc-macro2",+ "quote",+ "syn 2.0.114",+ "wasm-bindgen-shared",+]++[[package]]+name = "wasm-bindgen-shared"+version = "0.2.108"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12"+dependencies = [+ "unicode-ident",+]++[[package]]+name = "wezterm-bidi"+version = "0.2.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0c0a6e355560527dd2d1cf7890652f4f09bb3433b6aadade4c9b5ed76de5f3ec"+dependencies = [+ "log",+ "wezterm-dynamic",+]++[[package]]+name = "wezterm-blob-leases"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "692daff6d93d94e29e4114544ef6d5c942a7ed998b37abdc19b17136ea428eb7"+dependencies = [+ "getrandom 0.3.4",+ "mac_address",+ "sha2",+ "thiserror 1.0.69",+ "uuid",+]++[[package]]+name = "wezterm-color-types"+version = "0.3.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7de81ef35c9010270d63772bebef2f2d6d1f2d20a983d27505ac850b8c4b4296"+dependencies = [+ "csscolorparser",+ "deltae",+ "lazy_static",+ "wezterm-dynamic",+]++[[package]]+name = "wezterm-dynamic"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5f2ab60e120fd6eaa68d9567f3226e876684639d22a4219b313ff69ec0ccd5ac"+dependencies = [+ "log",+ "ordered-float",+ "strsim",+ "thiserror 1.0.69",+ "wezterm-dynamic-derive",+]++[[package]]+name = "wezterm-dynamic-derive"+version = "0.1.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "46c0cf2d539c645b448eaffec9ec494b8b19bd5077d9e58cb1ae7efece8d575b"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 1.0.109",+]++[[package]]+name = "wezterm-input-types"+version = "0.1.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7012add459f951456ec9d6c7e6fc340b1ce15d6fc9629f8c42853412c029e57e"+dependencies = [+ "bitflags 1.3.2",+ "euclid",+ "lazy_static",+ "serde",+ "wezterm-dynamic",+]++[[package]]+name = "which"+version = "7.0.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "24d643ce3fd3e5b54854602a080f34fb10ab75e0b813ee32d00ca2b44fa74762"+dependencies = [+ "either",+ "env_home",+ "rustix",+ "winsafe",+]++[[package]]+name = "winapi"+version = "0.3.9"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"+dependencies = [+ "winapi-i686-pc-windows-gnu",+ "winapi-x86_64-pc-windows-gnu",+]++[[package]]+name = "winapi-i686-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"++[[package]]+name = "winapi-x86_64-pc-windows-gnu"+version = "0.4.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"++[[package]]+name = "windows-core"+version = "0.62.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb"+dependencies = [+ "windows-implement",+ "windows-interface",+ "windows-link",+ "windows-result",+ "windows-strings",+]++[[package]]+name = "windows-implement"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "windows-interface"+version = "0.59.3"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358"+dependencies = [+ "proc-macro2",+ "quote",+ "syn 2.0.114",+]++[[package]]+name = "windows-link"+version = "0.2.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5"++[[package]]+name = "windows-result"+version = "0.4.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5"+dependencies = [+ "windows-link",+]++[[package]]+name = "windows-strings"+version = "0.5.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091"+dependencies = [+ "windows-link",+]++[[package]]+name = "windows-sys"+version = "0.60.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb"+dependencies = [+ "windows-targets",+]++[[package]]+name = "windows-sys"+version = "0.61.2"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc"+dependencies = [+ "windows-link",+]++[[package]]+name = "windows-targets"+version = "0.53.5"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"+dependencies = [+ "windows-link",+ "windows_aarch64_gnullvm",+ "windows_aarch64_msvc",+ "windows_i686_gnu",+ "windows_i686_gnullvm",+ "windows_i686_msvc",+ "windows_x86_64_gnu",+ "windows_x86_64_gnullvm",+ "windows_x86_64_msvc",+]++[[package]]+name = "windows_aarch64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"++[[package]]+name = "windows_aarch64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"++[[package]]+name = "windows_i686_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"++[[package]]+name = "windows_i686_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"++[[package]]+name = "windows_i686_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"++[[package]]+name = "windows_x86_64_gnu"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"++[[package]]+name = "windows_x86_64_gnullvm"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"++[[package]]+name = "windows_x86_64_msvc"+version = "0.53.1"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650"++[[package]]+name = "winnow"+version = "0.7.14"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829"+dependencies = [+ "memchr",+]++[[package]]+name = "winsafe"+version = "0.0.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d135d17ab770252ad95e9a872d365cf3090e3be864a34ab46f48555993efc904"++[[package]]+name = "wit-bindgen"+version = "0.51.0"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5"++[[package]]+name = "zmij"+version = "1.0.19"+source = "registry+https://github.com/rust-lang/crates.io-index"+checksum = "3ff05f8caa9038894637571ae6b9e29466c1f4f829d26c9b28f869a29cbe3445"diff --git a/Cargo.toml b/Cargo.tomlnew file mode 100644index 0000000..5e71e33--- /dev/null+++ b/Cargo.toml@@ -0,0 +1,39 @@+[package]+name = "agtx"+version = "0.1.0"+edition = "2021"+description = "Terminal-native kanban board for managing coding agents"+authors = ["agtx contributors"]+license = "MIT"+repository = "https://github.com/yourusername/agtx"+keywords = ["tui", "tmux", "agents", "kanban", "claude"]+categories = ["command-line-utilities", "development-tools"]++[dependencies]+# TUI+ratatui = "0.30"+crossterm = "0.29"++# Async runtime+tokio = { version = "1.44", features = ["full"] }++# Database+rusqlite = { version = "0.34", features = ["bundled"] }++# Serialization+serde = { version = "1.0", features = ["derive"] }+serde_json = "1.0"+toml = "0.8"++# Utilities+anyhow = "1.0"+thiserror = "2.0"+which = "7.0"+directories = "6.0"+chrono = { version = "0.4", features = ["serde"] }+uuid = { version = "1.16", features = ["v4"] }++++[dev-dependencies]+tempfile = "3"diff --git a/src/agent/mod.rs b/src/agent/mod.rsnew file mode 100644index 0000000..c86f466--- /dev/null+++ b/src/agent/mod.rs@@ -0,0 +1,138 @@+use anyhow::Result;+use serde::{Deserialize, Serialize};++/// Known coding agents that agtx can work with+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct Agent {+ pub name: String,+ pub command: String,+ pub args: Vec<String>,+ pub description: String,+}++impl Agent {+ pub fn new(name: &str, command: &str, description: &str) -> Self {+ Self {+ name: name.to_string(),+ command: command.to_string(),+ args: vec![],+ description: description.to_string(),+ }+ }++ /// Check if this agent is installed on the system+ pub fn is_available(&self) -> bool {+ which::which(&self.command).is_ok()+ }+}++/// Get the list of known agents+pub fn known_agents() -> Vec<Agent> {+ vec![+ Agent::new("claude", "claude", "Anthropic's Claude Code CLI"),+ Agent::new("aider", "aider", "AI pair programming in your terminal"),+ Agent::new("codex", "codex", "OpenAI's Codex CLI"),+ Agent::new("gh-copilot", "gh", "GitHub Copilot CLI"),+ Agent::new("mentat", "mentat", "Open source coding assistant"),+ Agent::new("q", "q", "Amazon Q Developer CLI"),+ ]+}++/// Detect which agents are available on the system+pub fn detect_available_agents() -> Vec<Agent> {+ known_agents()+ .into_iter()+ .filter(|a| a.is_available())+ .collect()+}++/// Get a specific agent by name+pub fn get_agent(name: &str) -> Option<Agent> {+ known_agents().into_iter().find(|a| a.name == name)+}++/// Find the default agent (first available from preference order)+pub fn default_agent() -> Option<Agent> {+ let preference_order = ["claude", "aider", "codex", "gh-copilot", "mentat", "q"];++ for name in preference_order {+ if let Some(agent) = get_agent(name) {+ if agent.is_available() {+ return Some(agent);+ }+ }+ }++ None+}++/// Agent availability status for display+#[derive(Debug)]+pub struct AgentStatus {+ pub agent: Agent,+ pub available: bool,+}++/// Get status of all known agents+pub fn all_agent_status() -> Vec<AgentStatus> {+ known_agents()+ .into_iter()+ .map(|agent| {+ let available = agent.is_available();+ AgentStatus { agent, available }+ })+ .collect()+}++/// Build the command arguments for spawning an agent+pub fn build_spawn_args(agent: &Agent, prompt: &str, task_id: &str) -> Vec<String> {+ let mut args = agent.args.clone();++ match agent.name.as_str() {+ "claude" => {+ // Claude Code supports session persistence+ args.extend(["--session".to_string(), task_id.to_string()]);+ args.push(prompt.to_string());+ }+ "aider" => {+ // Aider uses --message for the initial prompt+ args.extend(["--message".to_string(), prompt.to_string()]);+ }+ "gh-copilot" => {+ // GitHub Copilot needs subcommand+ args.extend(["copilot".to_string(), "suggest".to_string()]);+ args.push(prompt.to_string());+ }+ _ => {+ // Default: just pass the prompt+ args.push(prompt.to_string());+ }+ }++ args+}++/// Build command for resuming an agent session+pub fn build_resume_args(agent: &Agent, task_id: &str) -> Result<Vec<String>> {+ let mut args = agent.args.clone();++ match agent.name.as_str() {+ "claude" => {+ // Claude Code supports --resume+ args.extend([+ "--resume".to_string(),+ "--session".to_string(),+ task_id.to_string(),+ ]);+ }+ "aider" => {+ // Aider auto-resumes from .aider.chat.history.md in the directory+ // No special flags needed+ }+ _ => {+ anyhow::bail!("Agent '{}' does not support session resumption", agent.name);+ }+ }++ Ok(args)+}diff --git a/src/config/mod.rs b/src/config/mod.rsnew file mode 100644index 0000000..2a2dd99--- /dev/null+++ b/src/config/mod.rs@@ -0,0 +1,243 @@+use anyhow::{Context, Result};+use serde::{Deserialize, Serialize};+use std::path::{Path, PathBuf};++/// Global configuration (stored in ~/.config/agtx/)+#[derive(Debug, Clone, Serialize, Deserialize, Default)]+pub struct GlobalConfig {+ /// Default agent for new tasks+ #[serde(default = "default_agent")]+ pub default_agent: String,++ /// Worktree settings+ #[serde(default)]+ pub worktree: WorktreeConfig,++ /// UI theme/colors+ #[serde(default)]+ pub theme: ThemeConfig,+}++/// Theme configuration with hex colors+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct ThemeConfig {+ /// Border color for selected elements (hex, e.g. "#FFFF00")+ #[serde(default = "default_color_selected")]+ pub color_selected: String,++ /// Border color for normal/unselected elements (hex, e.g. "#00FFFF")+ #[serde(default = "default_color_normal")]+ pub color_normal: String,++ /// Border color for dimmed/inactive elements (hex, e.g. "#666666")+ #[serde(default = "default_color_dimmed")]+ pub color_dimmed: String,++ /// Text color for titles (hex, e.g. "#FFFFFF")+ #[serde(default = "default_color_text")]+ pub color_text: String,++ /// Accent color for highlights (hex, e.g. "#00FFFF")+ #[serde(default = "default_color_accent")]+ pub color_accent: String,+}++impl Default for ThemeConfig {+ fn default() -> Self {+ Self {+ color_selected: default_color_selected(),+ color_normal: default_color_normal(),+ color_dimmed: default_color_dimmed(),+ color_text: default_color_text(),+ color_accent: default_color_accent(),+ }+ }+}++fn default_color_selected() -> String {+ "#FFFF99".to_string() // Light yellow+}++fn default_color_normal() -> String {+ "#00FFFF".to_string() // Cyan+}++fn default_color_dimmed() -> String {+ "#666666".to_string() // Dark gray+}++fn default_color_text() -> String {+ "#FFFFFF".to_string() // White+}++fn default_color_accent() -> String {+ "#00FFFF".to_string() // Cyan+}++impl ThemeConfig {+ /// Parse a hex color string to RGB tuple+ pub fn parse_hex(hex: &str) -> Option<(u8, u8, u8)> {+ let hex = hex.trim_start_matches('#');+ if hex.len() != 6 {+ return None;+ }+ let r = u8::from_str_radix(&hex[0..2], 16).ok()?;+ let g = u8::from_str_radix(&hex[2..4], 16).ok()?;+ let b = u8::from_str_radix(&hex[4..6], 16).ok()?;+ Some((r, g, b))+ }+}++fn default_agent() -> String {+ "claude".to_string()+}++/// Worktree configuration+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct WorktreeConfig {+ /// Whether to use git worktrees for task isolation+ #[serde(default = "default_true")]+ pub enabled: bool,++ /// Automatically clean up worktrees after merge/reject+ #[serde(default = "default_true")]+ pub auto_cleanup: bool,++ /// Base branch to create worktrees from+ #[serde(default = "default_base_branch")]+ pub base_branch: String,+}++impl Default for WorktreeConfig {+ fn default() -> Self {+ Self {+ enabled: true,+ auto_cleanup: true,+ base_branch: "main".to_string(),+ }+ }+}++fn default_true() -> bool {+ true+}++fn default_base_branch() -> String {+ "main".to_string()+}++/// Project-specific configuration (stored in .agtx/config.toml)+#[derive(Debug, Clone, Serialize, Deserialize, Default)]+pub struct ProjectConfig {+ /// Override default agent for this project+ pub default_agent: Option<String>,++ /// Override base branch for this project+ pub base_branch: Option<String>,++ /// GitHub URL for this project+ pub github_url: Option<String>,+}++impl GlobalConfig {+ /// Load global config from default location+ pub fn load() -> Result<Self> {+ let config_path = Self::config_path()?;++ if config_path.exists() {+ let content = std::fs::read_to_string(&config_path)+ .with_context(|| format!("Failed to read config from {:?}", config_path))?;+ toml::from_str(&content).context("Failed to parse global config")+ } else {+ Ok(Self::default())+ }+ }++ /// Save global config to default location+ pub fn save(&self) -> Result<()> {+ let config_path = Self::config_path()?;++ if let Some(parent) = config_path.parent() {+ std::fs::create_dir_all(parent)?;+ }++ let content = toml::to_string_pretty(self)?;+ std::fs::write(&config_path, content)?;++ Ok(())+ }++ /// Get the path to the global config file+ pub fn config_path() -> Result<PathBuf> {+ let dirs = directories::ProjectDirs::from("", "", "agtx")+ .context("Could not determine config directory")?;+ Ok(dirs.config_dir().join("config.toml"))+ }++ /// Get the path to the global data directory+ pub fn data_dir() -> Result<PathBuf> {+ let dirs = directories::ProjectDirs::from("", "", "agtx")+ .context("Could not determine data directory")?;+ Ok(dirs.data_dir().to_path_buf())+ }+}++impl ProjectConfig {+ /// Load project config from a project directory+ pub fn load(project_path: &Path) -> Result<Self> {+ let config_path = project_path.join(".agtx").join("config.toml");++ if config_path.exists() {+ let content = std::fs::read_to_string(&config_path)+ .with_context(|| format!("Failed to read config from {:?}", config_path))?;+ toml::from_str(&content).context("Failed to parse project config")+ } else {+ Ok(Self::default())+ }+ }++ /// Save project config+ pub fn save(&self, project_path: &Path) -> Result<()> {+ let config_path = project_path.join(".agtx").join("config.toml");++ if let Some(parent) = config_path.parent() {+ std::fs::create_dir_all(parent)?;+ }++ let content = toml::to_string_pretty(self)?;+ std::fs::write(&config_path, content)?;++ Ok(())+ }+}++/// Merged configuration (global + project)+#[derive(Debug, Clone)]+pub struct MergedConfig {+ pub default_agent: String,+ pub worktree_enabled: bool,+ pub auto_cleanup: bool,+ pub base_branch: String,+ pub github_url: Option<String>,+ pub theme: ThemeConfig,+}++impl MergedConfig {+ /// Create merged config from global and project configs+ pub fn merge(global: &GlobalConfig, project: &ProjectConfig) -> Self {+ Self {+ default_agent: project+ .default_agent+ .clone()+ .unwrap_or_else(|| global.default_agent.clone()),+ worktree_enabled: global.worktree.enabled,+ auto_cleanup: global.worktree.auto_cleanup,+ base_branch: project+ .base_branch+ .clone()+ .unwrap_or_else(|| global.worktree.base_branch.clone()),+ github_url: project.github_url.clone(),+ theme: global.theme.clone(),+ }+ }+}diff --git a/src/db/mod.rs b/src/db/mod.rsnew file mode 100644index 0000000..6295941--- /dev/null+++ b/src/db/mod.rs@@ -0,0 +1,5 @@+mod models;+mod schema;++pub use models::*;+pub use schema::Database;diff --git a/src/db/models.rs b/src/db/models.rsnew file mode 100644index 0000000..9c0820b--- /dev/null+++ b/src/db/models.rs@@ -0,0 +1,151 @@+use chrono::{DateTime, Utc};+use serde::{Deserialize, Serialize};++/// Task status in the kanban board+#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+pub enum TaskStatus {+ Backlog,+ Planning,+ Running,+ Review,+ Done,+}++impl TaskStatus {+ pub fn as_str(&self) -> &'static str {+ match self {+ TaskStatus::Backlog => "backlog",+ TaskStatus::Planning => "planning",+ TaskStatus::Running => "running",+ TaskStatus::Review => "review",+ TaskStatus::Done => "done",+ }+ }++ pub fn from_str(s: &str) -> Option<Self> {+ match s {+ "backlog" => Some(TaskStatus::Backlog),+ "planning" => Some(TaskStatus::Planning),+ "running" => Some(TaskStatus::Running),+ "review" => Some(TaskStatus::Review),+ "done" => Some(TaskStatus::Done),+ _ => None,+ }+ }++ pub fn columns() -> &'static [TaskStatus] {+ &[+ TaskStatus::Backlog,+ TaskStatus::Planning,+ TaskStatus::Running,+ TaskStatus::Review,+ TaskStatus::Done,+ ]+ }+}++/// A task on the kanban board+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct Task {+ pub id: String,+ pub title: String,+ pub description: Option<String>,+ pub status: TaskStatus,+ pub agent: String,+ pub project_id: String,+ pub session_name: Option<String>,+ pub worktree_path: Option<String>,+ pub branch_name: Option<String>,+ pub pr_number: Option<i32>,+ pub pr_url: Option<String>,+ pub created_at: DateTime<Utc>,+ pub updated_at: DateTime<Utc>,+}++impl Task {+ pub fn new(title: impl Into<String>, agent: impl Into<String>, project_id: impl Into<String>) -> Self {+ let id = uuid::Uuid::new_v4().to_string();+ let now = Utc::now();+ Self {+ id,+ title: title.into(),+ description: None,+ status: TaskStatus::Backlog,+ agent: agent.into(),+ project_id: project_id.into(),+ session_name: None,+ worktree_path: None,+ branch_name: None,+ pr_number: None,+ pr_url: None,+ created_at: now,+ updated_at: now,+ }+ }++ /// Generate tmux session name: task-{id}--{project}--{slug}+ pub fn generate_session_name(&self, project_name: &str) -> String {+ let slug = self+ .title+ .to_lowercase()+ .chars()+ .map(|c| if c.is_alphanumeric() { c } else { '-' })+ .collect::<String>();+ let slug = slug.trim_matches('-');+ // Truncate slug to keep session name reasonable+ let slug: String = slug.chars().take(20).collect();+ format!("task-{}--{}--{}", &self.id[..8], project_name, slug)+ }+}++/// A project tracked by agtx+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct Project {+ pub id: String,+ pub name: String,+ pub path: String,+ pub github_url: Option<String>,+ pub default_agent: Option<String>,+ pub last_opened: DateTime<Utc>,+}++impl Project {+ pub fn new(name: impl Into<String>, path: impl Into<String>) -> Self {+ Self {+ id: uuid::Uuid::new_v4().to_string(),+ name: name.into(),+ path: path.into(),+ github_url: None,+ default_agent: None,+ last_opened: Utc::now(),+ }+ }+}++/// Represents a running agent session+#[derive(Debug, Clone, Serialize, Deserialize)]+pub struct RunningAgent {+ pub session_name: String,+ pub project_id: String,+ pub task_id: String,+ pub agent_name: String,+ pub started_at: DateTime<Utc>,+ pub status: AgentStatus,+}++#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]+pub enum AgentStatus {+ Running,+ Waiting,+ Completed,+}++impl AgentStatus {+ pub fn as_str(&self) -> &'static str {+ match self {+ AgentStatus::Running => "running",+ AgentStatus::Waiting => "waiting",+ AgentStatus::Completed => "completed",+ }+ }+}diff --git a/src/db/schema.rs b/src/db/schema.rsnew file mode 100644index 0000000..9677bba--- /dev/null+++ b/src/db/schema.rs@@ -0,0 +1,306 @@+use anyhow::{Context, Result};+use rusqlite::{params, Connection};+use std::path::Path;++use super::models::{Project, Task, TaskStatus};++/// Database wrapper for SQLite operations+pub struct Database {+ conn: Connection,+}++impl Database {+ /// Open or create a project database (stored centrally in config dir)+ pub fn open_project(project_path: &Path) -> Result<Self> {+ let config_dir = directories::ProjectDirs::from("", "", "agtx")+ .context("Could not determine config directory")?;++ // Create a stable ID from the project path using a hash+ let path_str = project_path.to_string_lossy();+ let path_hash = Self::hash_path(&path_str);++ let db_path = config_dir+ .config_dir()+ .join("projects")+ .join(format!("{}.db", path_hash));++ // Ensure projects directory exists+ if let Some(parent) = db_path.parent() {+ std::fs::create_dir_all(parent)?;+ }++ let conn = Connection::open(&db_path)+ .with_context(|| format!("Failed to open database at {:?}", db_path))?;++ let db = Self { conn };+ db.init_project_schema()?;+ Ok(db)+ }++ /// Create a stable hash from a path string for database filename+ fn hash_path(path: &str) -> String {+ use std::collections::hash_map::DefaultHasher;+ use std::hash::{Hash, Hasher};++ let mut hasher = DefaultHasher::new();+ path.hash(&mut hasher);+ format!("{:016x}", hasher.finish())+ }++ /// Open or create the global index database+ pub fn open_global() -> Result<Self> {+ let config_dir = directories::ProjectDirs::from("", "", "agtx")+ .context("Could not determine config directory")?;+ let db_path = config_dir.config_dir().join("index.db");++ // Ensure config directory exists+ if let Some(parent) = db_path.parent() {+ std::fs::create_dir_all(parent)?;+ }++ let conn = Connection::open(&db_path)+ .with_context(|| format!("Failed to open global database at {:?}", db_path))?;++ let db = Self { conn };+ db.init_global_schema()?;+ Ok(db)+ }++ fn init_project_schema(&self) -> Result<()> {+ self.conn.execute_batch(+ r#"+ CREATE TABLE IF NOT EXISTS tasks (+ id TEXT PRIMARY KEY,+ title TEXT NOT NULL,+ description TEXT,+ status TEXT NOT NULL DEFAULT 'backlog',+ agent TEXT NOT NULL,+ project_id TEXT NOT NULL,+ session_name TEXT,+ worktree_path TEXT,+ branch_name TEXT,+ pr_number INTEGER,+ pr_url TEXT,+ created_at TEXT NOT NULL,+ updated_at TEXT NOT NULL+ );++ CREATE INDEX IF NOT EXISTS idx_tasks_status ON tasks(status);+ CREATE INDEX IF NOT EXISTS idx_tasks_project ON tasks(project_id);+ "#,+ )?;++ // Migration: add new columns if they don't exist+ let _ = self.conn.execute("ALTER TABLE tasks ADD COLUMN branch_name TEXT", []);+ let _ = self.conn.execute("ALTER TABLE tasks ADD COLUMN pr_number INTEGER", []);+ let _ = self.conn.execute("ALTER TABLE tasks ADD COLUMN pr_url TEXT", []);++ Ok(())+ }++ fn init_global_schema(&self) -> Result<()> {+ self.conn.execute_batch(+ r#"+ CREATE TABLE IF NOT EXISTS projects (+ id TEXT PRIMARY KEY,+ name TEXT NOT NULL,+ path TEXT NOT NULL UNIQUE,+ github_url TEXT,+ default_agent TEXT,+ last_opened TEXT NOT NULL+ );++ CREATE TABLE IF NOT EXISTS running_agents (+ session_name TEXT PRIMARY KEY,+ project_id TEXT NOT NULL,+ task_id TEXT NOT NULL,+ agent_name TEXT NOT NULL,+ started_at TEXT NOT NULL,+ status TEXT NOT NULL,+ FOREIGN KEY (project_id) REFERENCES projects(id)+ );++ CREATE INDEX IF NOT EXISTS idx_running_project ON running_agents(project_id);+ "#,+ )?;+ Ok(())+ }++ // === Task Operations ===++ pub fn create_task(&self, task: &Task) -> Result<()> {+ self.conn.execute(+ r#"+ INSERT INTO tasks (id, title, description, status, agent, project_id, session_name, worktree_path, branch_name, pr_number, pr_url, created_at, updated_at)+ VALUES (?1, ?2, ?3, ?4, ?5, ?6, ?7, ?8, ?9, ?10, ?11, ?12, ?13)+ "#,+ params![+ task.id,+ task.title,+ task.description,+ task.status.as_str(),+ task.agent,+ task.project_id,+ task.session_name,+ task.worktree_path,+ task.branch_name,+ task.pr_number,+ task.pr_url,+ task.created_at.to_rfc3339(),+ task.updated_at.to_rfc3339(),+ ],+ )?;+ Ok(())+ }++ pub fn update_task(&self, task: &Task) -> Result<()> {+ self.conn.execute(+ r#"+ UPDATE tasks SET+ title = ?2,+ description = ?3,+ status = ?4,+ agent = ?5,+ session_name = ?6,+ worktree_path = ?7,+ branch_name = ?8,+ pr_number = ?9,+ pr_url = ?10,+ updated_at = ?11+ WHERE id = ?1+ "#,+ params![+ task.id,+ task.title,+ task.description,+ task.status.as_str(),+ task.agent,+ task.session_name,+ task.worktree_path,+ task.branch_name,+ task.pr_number,+ task.pr_url,+ task.updated_at.to_rfc3339(),+ ],+ )?;+ Ok(())+ }++ pub fn delete_task(&self, task_id: &str) -> Result<()> {+ self.conn+ .execute("DELETE FROM tasks WHERE id = ?1", params![task_id])?;+ Ok(())+ }++ fn task_from_row(row: &rusqlite::Row) -> rusqlite::Result<Task> {+ Ok(Task {+ id: row.get("id")?,+ title: row.get("title")?,+ description: row.get("description")?,+ status: TaskStatus::from_str(&row.get::<_, String>("status")?)+ .unwrap_or(TaskStatus::Backlog),+ agent: row.get("agent")?,+ project_id: row.get("project_id")?,+ session_name: row.get("session_name")?,+ worktree_path: row.get("worktree_path")?,+ branch_name: row.get("branch_name").ok().flatten(),+ pr_number: row.get("pr_number").ok().flatten(),+ pr_url: row.get("pr_url").ok().flatten(),+ created_at: chrono::DateTime::parse_from_rfc3339(&row.get::<_, String>("created_at")?)+ .map(|dt| dt.with_timezone(&chrono::Utc))+ .unwrap_or_else(|_| chrono::Utc::now()),+ updated_at: chrono::DateTime::parse_from_rfc3339(&row.get::<_, String>("updated_at")?)+ .map(|dt| dt.with_timezone(&chrono::Utc))+ .unwrap_or_else(|_| chrono::Utc::now()),+ })+ }++ pub fn get_task(&self, task_id: &str) -> Result<Option<Task>> {+ let mut stmt = self+ .conn+ .prepare("SELECT * FROM tasks WHERE id = ?1")?;++ let task = stmt+ .query_row(params![task_id], Self::task_from_row)+ .ok();++ Ok(task)+ }++ pub fn get_tasks_by_status(&self, status: TaskStatus) -> Result<Vec<Task>> {+ let mut stmt = self+ .conn+ .prepare("SELECT * FROM tasks WHERE status = ?1 ORDER BY created_at")?;++ let tasks = stmt+ .query_map(params![status.as_str()], Self::task_from_row)?+ .filter_map(|r| r.ok())+ .collect();++ Ok(tasks)+ }++ pub fn get_all_tasks(&self) -> Result<Vec<Task>> {+ let mut stmt = self+ .conn+ .prepare("SELECT * FROM tasks ORDER BY created_at")?;++ let tasks = stmt+ .query_map([], Self::task_from_row)?+ .filter_map(|r| r.ok())+ .collect();++ Ok(tasks)+ }++ // === Project Operations (for global db) ===++ pub fn upsert_project(&self, project: &Project) -> Result<()> {+ self.conn.execute(+ r#"+ INSERT INTO projects (id, name, path, github_url, default_agent, last_opened)+ VALUES (?1, ?2, ?3, ?4, ?5, ?6)+ ON CONFLICT(path) DO UPDATE SET+ name = excluded.name,+ github_url = excluded.github_url,+ default_agent = excluded.default_agent,+ last_opened = excluded.last_opened+ "#,+ params![+ project.id,+ project.name,+ project.path,+ project.github_url,+ project.default_agent,+ project.last_opened.to_rfc3339(),+ ],+ )?;+ Ok(())+ }++ pub fn get_all_projects(&self) -> Result<Vec<Project>> {+ let mut stmt = self+ .conn+ .prepare("SELECT * FROM projects ORDER BY last_opened DESC")?;++ let projects = stmt+ .query_map([], |row| {+ Ok(Project {+ id: row.get("id")?,+ name: row.get("name")?,+ path: row.get("path")?,+ github_url: row.get("github_url")?,+ default_agent: row.get("default_agent")?,+ last_opened: chrono::DateTime::parse_from_rfc3339(+ &row.get::<_, String>("last_opened")?,+ )+ .map(|dt| dt.with_timezone(&chrono::Utc))+ .unwrap_or_else(|_| chrono::Utc::now()),+ })+ })?+ .filter_map(|r| r.ok())+ .collect();++ Ok(projects)+ }+}diff --git a/src/git/mod.rs b/src/git/mod.rsnew file mode 100644index 0000000..91ea143--- /dev/null+++ b/src/git/mod.rs@@ -0,0 +1,96 @@+mod worktree;++pub use worktree::*;++use anyhow::{Context, Result};+use std::path::Path;+use std::process::Command;++/// Check if a path is inside a git repository+pub fn is_git_repo(path: &Path) -> bool {+ Command::new("git")+ .current_dir(path)+ .args(["rev-parse", "--git-dir"])+ .output()+ .map(|o| o.status.success())+ .unwrap_or(false)+}++/// Get the root directory of the git repository+pub fn repo_root(path: &Path) -> Result<std::path::PathBuf> {+ let output = Command::new("git")+ .current_dir(path)+ .args(["rev-parse", "--show-toplevel"])+ .output()+ .context("Failed to get git root")?;++ let root = String::from_utf8_lossy(&output.stdout)+ .trim()+ .to_string();++ Ok(std::path::PathBuf::from(root))+}++/// Get current branch name+pub fn current_branch(path: &Path) -> Result<String> {+ let output = Command::new("git")+ .current_dir(path)+ .args(["rev-parse", "--abbrev-ref", "HEAD"])+ .output()+ .context("Failed to get current branch")?;++ Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())+}++/// Get the diff between two branches (stat format)+pub fn diff_stat(path: &Path, base: &str, target: &str) -> Result<String> {+ let output = Command::new("git")+ .current_dir(path)+ .args(["diff", base, target, "--stat"])+ .output()+ .context("Failed to get diff")?;++ Ok(String::from_utf8_lossy(&output.stdout).to_string())+}++/// Get the full diff between two branches+pub fn diff_full(path: &Path, base: &str, target: &str) -> Result<String> {+ let output = Command::new("git")+ .current_dir(path)+ .args(["diff", base, target])+ .output()+ .context("Failed to get diff")?;++ Ok(String::from_utf8_lossy(&output.stdout).to_string())+}++/// Merge a branch into the current branch+pub fn merge_branch(path: &Path, branch: &str, message: &str) -> Result<()> {+ let output = Command::new("git")+ .current_dir(path)+ .args(["merge", branch, "--no-ff", "-m", message])+ .output()+ .context("Failed to merge branch")?;++ if !output.status.success() {+ anyhow::bail!(+ "Merge failed: {}",+ String::from_utf8_lossy(&output.stderr)+ );+ }++ Ok(())+}++/// Delete a branch+pub fn delete_branch(path: &Path, branch: &str, force: bool) -> Result<()> {+ let flag = if force { "-D" } else { "-d" };++ Command::new("git")+ .current_dir(path)+ .args(["branch", flag, branch])+ .output()+ .context("Failed to delete branch")?;++ Ok(())+}diff --git a/src/git/worktree.rs b/src/git/worktree.rsnew file mode 100644index 0000000..b4698e4--- /dev/null+++ b/src/git/worktree.rs@@ -0,0 +1,199 @@+use anyhow::{Context, Result};+use std::path::{Path, PathBuf};+use std::process::Command;++/// Directory name for agtx data within a project+const AGTX_DIR: &str = ".agtx";+const WORKTREES_DIR: &str = "worktrees";++/// Create a new git worktree for a task from the main branch+pub fn create_worktree(project_path: &Path, task_slug: &str) -> Result<PathBuf> {+ let worktree_path = project_path+ .join(AGTX_DIR)+ .join(WORKTREES_DIR)+ .join(task_slug);++ // Ensure parent directory exists+ if let Some(parent) = worktree_path.parent() {+ std::fs::create_dir_all(parent)?;+ }++ // Detect the main branch (main or master)+ let main_branch = detect_main_branch(project_path)?;++ // Create worktree with a new branch based on main+ let branch_name = format!("task/{}", task_slug);+ let output = Command::new("git")+ .current_dir(project_path)+ .args(["worktree", "add"])+ .arg(&worktree_path)+ .args(["-b", &branch_name, &main_branch])+ .output()+ .context("Failed to create git worktree")?;++ if !output.status.success() {+ anyhow::bail!(+ "Failed to create worktree: {}",+ String::from_utf8_lossy(&output.stderr)+ );+ }++ Ok(worktree_path)+}++/// Detect the main branch name (main or master)+fn detect_main_branch(project_path: &Path) -> Result<String> {+ // Check if 'main' exists+ let output = Command::new("git")+ .current_dir(project_path)+ .args(["rev-parse", "--verify", "main"])+ .output()+ .context("Failed to check for main branch")?;++ if output.status.success() {+ return Ok("main".to_string());+ }++ // Check if 'master' exists+ let output = Command::new("git")+ .current_dir(project_path)+ .args(["rev-parse", "--verify", "master"])+ .output()+ .context("Failed to check for master branch")?;++ if output.status.success() {+ return Ok("master".to_string());+ }++ // Fallback: get the current branch+ let output = Command::new("git")+ .current_dir(project_path)+ .args(["rev-parse", "--abbrev-ref", "HEAD"])+ .output()+ .context("Failed to get current branch")?;++ Ok(String::from_utf8_lossy(&output.stdout).trim().to_string())+}++/// Remove a git worktree+pub fn remove_worktree(project_path: &Path, task_id: &str) -> Result<()> {+ let worktree_path = project_path+ .join(AGTX_DIR)+ .join(WORKTREES_DIR)+ .join(task_id);++ // Remove the worktree+ let output = Command::new("git")+ .current_dir(project_path)+ .args(["worktree", "remove"])+ .arg(&worktree_path)+ .args(["--force"]) // Force in case of uncommitted changes+ .output()+ .context("Failed to remove git worktree")?;++ if !output.status.success() {+ // Try to prune if remove failed+ Command::new("git")+ .current_dir(project_path)+ .args(["worktree", "prune"])+ .output()?;+ }++ Ok(())+}++/// List all worktrees for a project+pub fn list_worktrees(project_path: &Path) -> Result<Vec<WorktreeInfo>> {+ let output = Command::new("git")+ .current_dir(project_path)+ .args(["worktree", "list", "--porcelain"])+ .output()+ .context("Failed to list git worktrees")?;++ let stdout = String::from_utf8_lossy(&output.stdout);+ let mut worktrees = Vec::new();+ let mut current: Option<WorktreeInfo> = None;++ for line in stdout.lines() {+ if line.starts_with("worktree ") {+ if let Some(wt) = current.take() {+ worktrees.push(wt);+ }+ current = Some(WorktreeInfo {+ path: PathBuf::from(line.strip_prefix("worktree ").unwrap()),+ branch: None,+ is_bare: false,+ });+ } else if line.starts_with("branch ") {+ if let Some(ref mut wt) = current {+ wt.branch = Some(+ line.strip_prefix("branch refs/heads/")+ .unwrap_or(line.strip_prefix("branch ").unwrap())+ .to_string(),+ );+ }+ } else if line == "bare" {+ if let Some(ref mut wt) = current {+ wt.is_bare = true;+ }+ }+ }++ if let Some(wt) = current {+ worktrees.push(wt);+ }++ Ok(worktrees)+}++/// Get the worktree path for a task+pub fn worktree_path(project_path: &Path, task_id: &str) -> PathBuf {+ project_path+ .join(AGTX_DIR)+ .join(WORKTREES_DIR)+ .join(task_id)+}++/// Check if a worktree exists for a task+pub fn worktree_exists(project_path: &Path, task_id: &str) -> bool {+ worktree_path(project_path, task_id).exists()+}++/// Information about a git worktree+#[derive(Debug, Clone)]+pub struct WorktreeInfo {+ pub path: PathBuf,+ pub branch: Option<String>,+ pub is_bare: bool,+}++impl WorktreeInfo {+ /// Extract task ID from worktree path if it's an agtx worktree+ pub fn task_id(&self) -> Option<&str> {+ self.path+ .file_name()+ .and_then(|n| n.to_str())+ .filter(|_| {+ self.path+ .parent()+ .and_then(|p| p.file_name())+ .map(|n| n == WORKTREES_DIR)+ .unwrap_or(false)+ })+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_worktree_path() {+ let project = PathBuf::from("/home/user/project");+ let path = worktree_path(&project, "task-123");+ assert_eq!(+ path,+ PathBuf::from("/home/user/project/.agtx/worktrees/task-123")+ );+ }+}diff --git a/src/main.rs b/src/main.rsnew file mode 100644index 0000000..0dd8b37--- /dev/null+++ b/src/main.rs@@ -0,0 +1,42 @@+mod agent;+mod config;+mod db;+mod git;+mod tmux;+mod tui;++use anyhow::Result;+use std::path::PathBuf;++#[tokio::main]+async fn main() -> Result<()> {+ // Parse command line arguments+ let args: Vec<String> = std::env::args().collect();++ let mode = match args.get(1).map(|s| s.as_str()) {+ Some("-g") => AppMode::Dashboard,+ Some(".") => AppMode::Project(std::env::current_dir()?),+ Some(path) => AppMode::Project(PathBuf::from(path)),+ None => {+ // Default: if in git repo, use project mode; otherwise dashboard+ let current_dir = std::env::current_dir()?;+ if git::is_git_repo(¤t_dir) {+ AppMode::Project(current_dir)+ } else {+ AppMode::Dashboard+ }+ }+ };++ // Initialize and run the app+ let mut app = tui::App::new(mode)?;+ app.run().await?;++ Ok(())+}++#[derive(Debug, Clone)]+pub enum AppMode {+ Dashboard,+ Project(PathBuf),+}diff --git a/src/tmux/mod.rs b/src/tmux/mod.rsnew file mode 100644index 0000000..cef8505--- /dev/null+++ b/src/tmux/mod.rs@@ -0,0 +1,174 @@+use anyhow::{Context, Result};+use std::process::Command;++/// The tmux server name for agent sessions+pub const AGENT_SERVER: &str = "agents";++/// Spawn a new agent session in the agents tmux server+pub fn spawn_session(+ session_name: &str,+ working_dir: &str,+ agent_command: &str,+ args: &[&str],+) -> Result<()> {+ // Build the full shell command to run in the session+ // We need to properly escape/quote for shell execution+ let mut shell_command = agent_command.to_string();+ for arg in args {+ shell_command.push(' ');+ // Always single-quote arguments to preserve them exactly+ shell_command.push('\'');+ // Escape any single quotes in the argument+ shell_command.push_str(&arg.replace('\'', "'\"'\"'"));+ shell_command.push('\'');+ }++ let output = Command::new("tmux")+ .args(["-L", AGENT_SERVER])+ .args(["new-session", "-d"])+ .args(["-s", session_name])+ .args(["-c", working_dir])+ .args(["sh", "-c", &shell_command])+ .output()+ .context("Failed to spawn tmux session")?;++ if !output.status.success() {+ let stderr = String::from_utf8_lossy(&output.stderr);+ anyhow::bail!("tmux new-session failed: {}", stderr);+ }++ Ok(())+}++/// List all sessions on the agents server+pub fn list_sessions() -> Result<Vec<SessionInfo>> {+ let output = Command::new("tmux")+ .args(["-L", AGENT_SERVER])+ .args([+ "list-sessions",+ "-F",+ "#{session_name}\t#{session_activity}\t#{session_created}",+ ])+ .output()+ .context("Failed to list tmux sessions")?;++ if !output.status.success() {+ // No server running or no sessions - that's fine+ return Ok(vec![]);+ }++ let sessions = String::from_utf8_lossy(&output.stdout)+ .lines()+ .filter_map(|line| {+ let parts: Vec<&str> = line.split('\t').collect();+ if parts.len() >= 3 {+ Some(SessionInfo {+ name: parts[0].to_string(),+ last_activity: parts[1].parse().unwrap_or(0),+ created: parts[2].parse().unwrap_or(0),+ })+ } else {+ None+ }+ })+ .collect();++ Ok(sessions)+}++/// Check if a specific session exists+pub fn session_exists(session_name: &str) -> Result<bool> {+ let output = Command::new("tmux")+ .args(["-L", AGENT_SERVER])+ .args(["has-session", "-t", session_name])+ .output()+ .context("Failed to check tmux session")?;++ Ok(output.status.success())+}++/// Capture the last N lines of output from a session's pane+pub fn capture_pane(session_name: &str, lines: i32) -> Result<String> {+ let output = Command::new("tmux")+ .args(["-L", AGENT_SERVER])+ .args(["capture-pane", "-t", session_name, "-p"])+ .args(["-S", &(-lines).to_string()])+ .output()+ .context("Failed to capture tmux pane")?;++ Ok(String::from_utf8_lossy(&output.stdout).to_string())+}++/// Send keys to a session+pub fn send_keys(session_name: &str, keys: &str) -> Result<()> {+ Command::new("tmux")+ .args(["-L", AGENT_SERVER])+ .args(["send-keys", "-t", session_name, keys, "Enter"])+ .output()+ .context("Failed to send keys to tmux session")?;++ Ok(())+}++/// Attach directly to an agent session+/// This blocks until the user detaches (Ctrl-b d) or the session ends+/// Works regardless of whether user is inside tmux or not+pub fn attach_session(session_name: &str) -> Result<()> {+ Command::new("tmux")+ .args(["-L", AGENT_SERVER])+ .args(["attach", "-t", session_name])+ .status()+ .context("Failed to attach to tmux session")?;++ Ok(())+}++/// Kill a session+pub fn kill_session(session_name: &str) -> Result<()> {+ Command::new("tmux")+ .args(["-L", AGENT_SERVER])+ .args(["kill-session", "-t", session_name])+ .output()+ .context("Failed to kill tmux session")?;++ Ok(())+}++/// Information about a tmux session+#[derive(Debug, Clone)]+pub struct SessionInfo {+ pub name: String,+ pub last_activity: u64,+ pub created: u64,+}++impl SessionInfo {+ /// Parse task ID from session name (task-{id}--{project}--{slug})+ pub fn task_id(&self) -> Option<&str> {+ self.name+ .strip_prefix("task-")+ .and_then(|s| s.split("--").next())+ }++ /// Parse project name from session name+ pub fn project_name(&self) -> Option<&str> {+ self.name.split("--").nth(1)+ }+}++#[cfg(test)]+mod tests {+ use super::*;++ #[test]+ fn test_session_info_parsing() {+ let info = SessionInfo {+ name: "task-abc12345--my-project--fix-auth".to_string(),+ last_activity: 0,+ created: 0,+ };++ assert_eq!(info.task_id(), Some("abc12345"));+ assert_eq!(info.project_name(), Some("my-project"));+ }+}diff --git a/src/tui/app.rs b/src/tui/app.rsnew file mode 100644index 0000000..fa0dab7--- /dev/null+++ b/src/tui/app.rs@@ -0,0 +1,2204 @@+use anyhow::Result;+use crossterm::{+ event::{self, Event, KeyCode, KeyEventKind},+ execute,+ terminal::{disable_raw_mode, enable_raw_mode, EnterAlternateScreen, LeaveAlternateScreen},+};+use ratatui::{prelude::*, widgets::*};+use std::io::{self, Stdout};+use std::path::{Path, PathBuf};++use crate::agent;+use crate::config::{GlobalConfig, MergedConfig, ProjectConfig, ThemeConfig};+use crate::db::{Database, Task, TaskStatus};+use crate::git;+use crate::tmux;+use crate::AppMode;++use super::board::BoardState;+use super::input::InputMode;++/// Helper to convert hex color string to ratatui Color+fn hex_to_color(hex: &str) -> Color {+ ThemeConfig::parse_hex(hex)+ .map(|(r, g, b)| Color::Rgb(r, g, b))+ .unwrap_or(Color::White)+}++type Terminal = ratatui::Terminal<CrosstermBackend<Stdout>>;++/// Application state (separate from terminal for borrow checker)+struct AppState {+ mode: AppMode,+ should_quit: bool,+ board: BoardState,+ input_mode: InputMode,+ input_buffer: String,+ // For task creation/editing+ pending_task_title: String,+ editing_task_id: Option<String>, // Some(id) when editing, None when creating+ db: Option<Database>,+ #[allow(dead_code)]+ global_db: Database,+ config: MergedConfig,+ project_path: Option<PathBuf>,+ project_name: String,+ available_agents: Vec<agent::Agent>,+ // Sidebar+ sidebar_visible: bool,+ sidebar_focused: bool,+ projects: Vec<ProjectInfo>,+ selected_project: usize,+ // Dashboard state+ show_project_list: bool,+ // Task shell popup+ shell_popup: Option<ShellPopup>,+ // File search dropdown+ file_search: Option<FileSearchState>,+ // Task search popup+ task_search: Option<TaskSearchState>,+ // PR creation confirmation popup+ pr_confirm_popup: Option<PrConfirmPopup>,+ // Moving Review back to Running+ review_to_running_task_id: Option<String>,+}++/// State for task search popup+#[derive(Debug, Clone)]+struct TaskSearchState {+ query: String,+ matches: Vec<(String, String, TaskStatus)>, // (id, title, status)+ selected: usize,+}++/// State for PR creation confirmation popup+#[derive(Debug, Clone)]+struct PrConfirmPopup {+ task_id: String,+ pr_title: String,+ pr_body: String,+ editing_title: bool, // true = editing title, false = editing body+ generating: bool, // true while Claude is generating description+}++/// State for the shell popup that shows a detached tmux window+#[derive(Debug, Clone)]+struct ShellPopup {+ task_title: String,+ window_name: String,+ scroll_offset: i32, // Negative means scroll up (see more history)+}++/// Info about a project for the sidebar+#[derive(Debug, Clone)]+struct ProjectInfo {+ name: String,+ path: String,+}++/// State for file search dropdown+#[derive(Debug, Clone)]+struct FileSearchState {+ pattern: String,+ matches: Vec<String>,+ selected: usize,+ start_pos: usize, // Position in input_buffer where # was typed+}++pub struct App {+ terminal: Terminal,+ state: AppState,+}++impl App {+ pub fn new(mode: AppMode) -> Result<Self> {+ // Setup terminal+ enable_raw_mode()?;+ let mut stdout = io::stdout();+ execute!(stdout, EnterAlternateScreen)?;+ let backend = CrosstermBackend::new(stdout);+ let terminal = Terminal::new(backend)?;++ // Load configs+ let global_config = GlobalConfig::load().unwrap_or_default();+ let global_db = Database::open_global()?;++ // Detect available agents+ let available_agents = agent::detect_available_agents();++ // Setup based on mode+ let (db, project_path, project_name, project_config) = match &mode {+ AppMode::Dashboard => (None, None, "Dashboard".to_string(), ProjectConfig::default()),+ AppMode::Project(path) => {+ let canonical = path.canonicalize().unwrap_or_else(|_| path.clone());+ let name = canonical+ .file_name()+ .and_then(|n| n.to_str())+ .unwrap_or("unknown")+ .to_string();+ let project_config = ProjectConfig::load(&canonical).unwrap_or_default();+ let db = Database::open_project(&canonical)?;++ // Register project in global database+ let project = crate::db::Project::new(&name, canonical.to_string_lossy());+ global_db.upsert_project(&project)?;++ // Ensure tmux session exists for this project+ ensure_project_tmux_session(&name, &canonical);++ (Some(db), Some(canonical), name, project_config)+ }+ };++ let config = MergedConfig::merge(&global_config, &project_config);++ let mut app = Self {+ terminal,+ state: AppState {+ mode,+ should_quit: false,+ board: BoardState::new(),+ input_mode: InputMode::Normal,+ input_buffer: String::new(),+ pending_task_title: String::new(),+ editing_task_id: None,+ db,+ global_db,+ config,+ project_path,+ project_name: project_name.clone(),+ available_agents,+ sidebar_visible: true,+ sidebar_focused: false,+ projects: vec![],+ selected_project: 0,+ show_project_list: false,+ shell_popup: None,+ file_search: None,+ task_search: None,+ pr_confirm_popup: None,+ review_to_running_task_id: None,+ },+ };++ // Load tasks if in project mode+ app.refresh_tasks()?;+ // Load projects from global database+ app.refresh_projects()?;++ Ok(app)+ }++ pub async fn run(&mut self) -> Result<()> {+ while !self.state.should_quit {+ self.draw()?;++ if event::poll(std::time::Duration::from_millis(100))? {+ if let Event::Key(key) = event::read()? {+ if key.kind == KeyEventKind::Press {+ self.handle_key(key)?;+ }+ }+ }++ // Periodically refresh session status+ self.refresh_sessions()?;+ }++ Ok(())+ }++ fn draw(&mut self) -> Result<()> {+ let state = &self.state;+ self.terminal.draw(|frame| {+ let area = frame.area();++ match &state.mode {+ AppMode::Dashboard => Self::draw_dashboard(state, frame, area),+ AppMode::Project(_) => Self::draw_board(state, frame, area),+ }+ })?;++ Ok(())+ }++ fn draw_board(state: &AppState, frame: &mut Frame, area: Rect) {+ // Main layout with optional sidebar+ let main_chunks = if state.sidebar_visible {+ Layout::default()+ .direction(Direction::Horizontal)+ .constraints([+ Constraint::Length(25), // Sidebar+ Constraint::Min(0), // Main content+ ])+ .split(area)+ } else {+ // No sidebar - use full area+ Layout::default()+ .direction(Direction::Horizontal)+ .constraints([Constraint::Min(0)])+ .split(area)+ };++ // Draw sidebar if visible+ if state.sidebar_visible {+ Self::draw_sidebar(state, frame, main_chunks[0]);+ }++ let content_area = if state.sidebar_visible {+ main_chunks[1]+ } else {+ main_chunks[0]+ };++ // Main layout: header, board, footer+ let chunks = Layout::default()+ .direction(Direction::Vertical)+ .constraints([+ Constraint::Length(3), // Header+ Constraint::Min(0), // Board+ Constraint::Length(3), // Footer+ ])+ .split(content_area);++ // Header+ let header = Paragraph::new(format!(" {} ", state.project_name))+ .style(Style::default().fg(Color::Cyan).bold())+ .block(Block::default().borders(Borders::ALL));+ frame.render_widget(header, chunks[0]);++ // Board columns (5 columns: Backlog, Planning, Running, Review, Done)+ let columns = Layout::default()+ .direction(Direction::Horizontal)+ .constraints([+ Constraint::Percentage(20),+ Constraint::Percentage(20),+ Constraint::Percentage(20),+ Constraint::Percentage(20),+ Constraint::Percentage(20),+ ])+ .split(chunks[1]);++ for (i, status) in TaskStatus::columns().iter().enumerate() {+ let tasks: Vec<&Task> = state.board.tasks.iter().filter(|t| t.status == *status).collect();++ let is_selected_column = state.board.selected_column == i;++ let title = format!(" {} ({}) ", status.as_str(), tasks.len());+ let border_style = if is_selected_column {+ Style::default().fg(hex_to_color(&state.config.theme.color_selected))+ } else {+ Style::default().fg(hex_to_color(&state.config.theme.color_normal))+ };++ // Calculate card height (title + preview lines + borders)+ let card_height: u16 = 10; // 1 title + 7 preview lines + 2 borders+ let max_visible_cards = (columns[i].height.saturating_sub(2) / card_height) as usize;++ // Calculate scroll offset to keep selected task visible+ let scroll_offset = if is_selected_column && tasks.len() > max_visible_cards {+ let selected = state.board.selected_row;+ if selected >= max_visible_cards {+ selected - max_visible_cards + 1+ } else {+ 0+ }+ } else {+ 0+ };++ // Check if we need a scrollbar+ let needs_scrollbar = tasks.len() > max_visible_cards;+ let content_width = if needs_scrollbar {+ columns[i].width.saturating_sub(3) // Leave room for scrollbar+ } else {+ columns[i].width.saturating_sub(2)+ };++ // Draw column border+ let column_block = Block::default()+ .title(title)+ .borders(Borders::ALL)+ .border_style(border_style);+ let inner_area = column_block.inner(columns[i]);+ frame.render_widget(column_block, columns[i]);++ // Render task cards with scroll offset+ let visible_tasks: Vec<_> = tasks.iter().skip(scroll_offset).take(max_visible_cards).collect();+ for (j, task) in visible_tasks.iter().enumerate() {+ let actual_index = scroll_offset + j;+ let is_selected = is_selected_column && state.board.selected_row == actual_index;++ let card_area = Rect {+ x: inner_area.x,+ y: inner_area.y + (j as u16 * card_height),+ width: if needs_scrollbar { inner_area.width.saturating_sub(1) } else { inner_area.width },+ height: card_height.min(inner_area.height.saturating_sub(j as u16 * card_height)),+ };++ if card_area.height < 3 {+ break;+ }++ Self::draw_task_card(frame, task, card_area, is_selected, &state.config.theme);+ }++ // Draw scrollbar if needed+ if needs_scrollbar {+ let scrollbar_area = Rect {+ x: inner_area.x + inner_area.width - 1,+ y: inner_area.y,+ width: 1,+ height: inner_area.height,+ };++ let total_tasks = tasks.len();+ let scrollbar_height = inner_area.height as usize;+ let thumb_height = (max_visible_cards * scrollbar_height / total_tasks).max(1);+ let thumb_pos = (scroll_offset * scrollbar_height / total_tasks).min(scrollbar_height - thumb_height);++ for y in 0..scrollbar_height {+ let char = if y >= thumb_pos && y < thumb_pos + thumb_height {+ "β"+ } else {+ "β"+ };+ let style = Style::default().fg(Color::DarkGray);+ frame.render_widget(+ Paragraph::new(char).style(style),+ Rect {+ x: scrollbar_area.x,+ y: scrollbar_area.y + y as u16,+ width: 1,+ height: 1,+ },+ );+ }+ }+ }++ // Footer with help+ let footer_text = match state.input_mode {+ InputMode::Normal => {+ if state.sidebar_focused {+ " [j/k] navigate [Enter] open [l] board [e] hide sidebar [q] quit "+ } else {+ " [o] new [/] search [Enter] open [d] del [m] move [r] resume [e] sidebar [q] quit"+ }+ }+ InputMode::InputTitle => " Enter task title... [Esc] cancel [Enter] next ",+ InputMode::InputDescription => " Enter prompt for agent... [Esc] cancel [\\+Enter] newline [Enter] save ",+ };++ let footer = Paragraph::new(footer_text)+ .style(Style::default().fg(Color::DarkGray))+ .block(Block::default().borders(Borders::ALL));+ frame.render_widget(footer, chunks[2]);++ // Input overlay if in input mode+ if state.input_mode == InputMode::InputTitle || state.input_mode == InputMode::InputDescription {+ let input_area = centered_rect(50, 40, area);+ frame.render_widget(Clear, input_area);++ let is_editing = state.editing_task_id.is_some();+ let (title, label) = match state.input_mode {+ InputMode::InputTitle => {+ if is_editing { (" Edit Task ", "Title: ") } else { (" New Task ", "Title: ") }+ }+ InputMode::InputDescription => {+ if is_editing { (" Edit Task ", "Prompt: ") } else { (" New Task ", "Prompt: ") }+ }+ _ => ("", ""),+ };++ // Show title if we're on description step+ let content = if state.input_mode == InputMode::InputDescription {+ format!(+ "Title: {}\n\n{}{}β",+ state.pending_task_title,+ label,+ state.input_buffer+ )+ } else {+ format!("{}{}β", label, state.input_buffer)+ };++ let input = Paragraph::new(content)+ .style(Style::default().fg(Color::Yellow))+ .wrap(Wrap { trim: false })+ .block(+ Block::default()+ .title(title)+ .borders(Borders::ALL)+ .border_style(Style::default().fg(Color::Yellow)),+ );+ frame.render_widget(input, input_area);++ // File search dropdown+ if let Some(ref search) = state.file_search {+ if !search.matches.is_empty() {+ let dropdown_height = (search.matches.len() as u16 + 2).min(12);+ let dropdown_area = Rect {+ x: input_area.x + 2,+ y: input_area.y + input_area.height,+ width: input_area.width.saturating_sub(4),+ height: dropdown_height,+ };++ // Make sure dropdown doesn't go off screen+ let dropdown_area = if dropdown_area.y + dropdown_area.height > area.height {+ Rect {+ y: input_area.y.saturating_sub(dropdown_height),+ ..dropdown_area+ }+ } else {+ dropdown_area+ };++ frame.render_widget(Clear, dropdown_area);++ let items: Vec<ListItem> = search.matches+ .iter()+ .enumerate()+ .map(|(i, path)| {+ let style = if i == search.selected {+ Style::default().bg(Color::Yellow).fg(Color::Black)+ } else {+ Style::default().fg(Color::White)+ };+ ListItem::new(format!(" {} ", path)).style(style)+ })+ .collect();++ let list = List::new(items)+ .block(+ Block::default()+ .title(" Files [ββ] select [Tab/Enter] insert [Esc] cancel ")+ .borders(Borders::ALL)+ .border_style(Style::default().fg(Color::Cyan)),+ );+ frame.render_widget(list, dropdown_area);+ }+ }+ }++ // Shell popup overlay+ if let Some(popup) = &state.shell_popup {+ let popup_area = centered_rect(75, 75, area);+ frame.render_widget(Clear, popup_area);++ // Capture tmux pane content with more history+ let pane_content = capture_tmux_pane_with_history(&popup.window_name, 500);++ // Layout: header, content, footer+ let popup_chunks = Layout::default()+ .direction(Direction::Vertical)+ .constraints([+ Constraint::Length(1), // Title bar+ Constraint::Min(0), // Shell content+ Constraint::Length(1), // Footer+ ])+ .split(popup_area);++ // Title bar+ let title = format!(" {} ", popup.task_title);+ let title_bar = Paragraph::new(title)+ .style(Style::default().fg(Color::Black).bg(Color::Cyan));+ frame.render_widget(title_bar, popup_chunks[0]);++ // Shell content - parse ANSI escape sequences for colors+ let styled_lines = parse_ansi_to_lines(&pane_content);+ let visible_height = popup_chunks[1].height.saturating_sub(2) as usize;++ // Apply scroll offset+ let total_lines = styled_lines.len();+ let start_line = if popup.scroll_offset < 0 {+ // Scrolling up into history+ total_lines.saturating_sub(visible_height).saturating_sub((-popup.scroll_offset) as usize)+ } else {+ // At bottom (current)+ total_lines.saturating_sub(visible_height)+ };++ let visible_lines: Vec<Line> = styled_lines+ .into_iter()+ .skip(start_line)+ .take(visible_height)+ .collect();++ let content = Paragraph::new(visible_lines)+ .block(+ Block::default()+ .borders(Borders::LEFT | Borders::RIGHT)+ .border_style(Style::default().fg(Color::Cyan)),+ );+ frame.render_widget(content, popup_chunks[1]);++ // Footer with scroll indicator+ let scroll_indicator = if popup.scroll_offset < 0 {+ format!(" [ββ/jk] scroll [g] bottom [Esc] close | Line {} ", start_line + 1)+ } else {+ " [ββ/jk] scroll [Esc] close | At bottom ".to_string()+ };+ let footer = Paragraph::new(scroll_indicator)+ .style(Style::default().fg(Color::Black).bg(Color::DarkGray));+ frame.render_widget(footer, popup_chunks[2]);+ }++ // Task search popup+ if let Some(ref search) = state.task_search {+ let popup_area = centered_rect(50, 50, area);+ frame.render_widget(Clear, popup_area);++ let popup_chunks = Layout::default()+ .direction(Direction::Vertical)+ .constraints([+ Constraint::Length(3), // Search input+ Constraint::Min(0), // Results+ ])+ .split(popup_area);++ // Search input+ let input = Paragraph::new(format!(" π {}β", search.query))+ .style(Style::default().fg(Color::Yellow))+ .block(+ Block::default()+ .title(" Search Tasks ")+ .borders(Borders::ALL)+ .border_style(Style::default().fg(Color::Yellow)),+ );+ frame.render_widget(input, popup_chunks[0]);++ // Results list+ let items: Vec<ListItem> = search.matches+ .iter()+ .enumerate()+ .map(|(i, (_, title, status))| {+ let is_selected = i == search.selected;+ let style = if is_selected {+ Style::default().bg(Color::Yellow).fg(Color::Black)+ } else {+ Style::default().fg(Color::White)+ };++ let status_icon = match status {+ TaskStatus::Backlog => "π",+ TaskStatus::Planning => "π",+ TaskStatus::Running => "β‘",+ TaskStatus::Review => "π",+ TaskStatus::Done => "β ",+ };++ ListItem::new(format!(" {} {} ", status_icon, title)).style(style)+ })+ .collect();++ let list = List::new(items)+ .block(+ Block::default()+ .title(" [ββ] select [Enter] jump [Esc] cancel ")+ .borders(Borders::ALL)+ .border_style(Style::default().fg(Color::DarkGray)),+ );+ frame.render_widget(list, popup_chunks[1]);+ }++ // PR confirmation popup+ if let Some(ref popup) = state.pr_confirm_popup {+ let popup_area = centered_rect(60, 60, area);+ frame.render_widget(Clear, popup_area);++ let popup_chunks = Layout::default()+ .direction(Direction::Vertical)+ .constraints([+ Constraint::Length(3), // Title input+ Constraint::Min(0), // Body input+ Constraint::Length(1), // Help line+ ])+ .margin(1)+ .split(popup_area);++ // Main border+ let main_block = Block::default()+ .title(" Create Pull Request ")+ .borders(Borders::ALL)+ .border_style(Style::default().fg(Color::Green));+ frame.render_widget(main_block, popup_area);++ // Title input+ let title_style = if popup.editing_title {+ Style::default().fg(Color::Yellow)+ } else {+ Style::default().fg(Color::White)+ };+ let title_border = if popup.editing_title {+ Style::default().fg(Color::Yellow)+ } else {+ Style::default().fg(Color::DarkGray)+ };+ let title_cursor = if popup.editing_title { "β" } else { "" };+ let title_input = Paragraph::new(format!("{}{}", popup.pr_title, title_cursor))+ .style(title_style)+ .block(+ Block::default()+ .title(" Title ")+ .borders(Borders::ALL)+ .border_style(title_border),+ );+ frame.render_widget(title_input, popup_chunks[0]);++ // Body input+ let body_style = if !popup.editing_title {+ Style::default().fg(Color::Yellow)+ } else {+ Style::default().fg(Color::White)+ };+ let body_border = if !popup.editing_title {+ Style::default().fg(Color::Yellow)+ } else {+ Style::default().fg(Color::DarkGray)+ };+ let body_cursor = if !popup.editing_title { "β" } else { "" };+ let body_input = Paragraph::new(format!("{}{}", popup.pr_body, body_cursor))+ .style(body_style)+ .wrap(Wrap { trim: false })+ .block(+ Block::default()+ .title(" Description ")+ .borders(Borders::ALL)+ .border_style(body_border),+ );+ frame.render_widget(body_input, popup_chunks[1]);++ // Help line+ let help = Paragraph::new(" [Tab] switch field [Ctrl+Enter] create PR [Esc] cancel ")+ .style(Style::default().fg(Color::DarkGray));+ frame.render_widget(help, popup_chunks[2]);+ }+ }++ fn draw_task_card(frame: &mut Frame, task: &Task, area: Rect, is_selected: bool, theme: &ThemeConfig) {+ let border_style = if is_selected {+ Style::default().fg(hex_to_color(&theme.color_selected))+ } else {+ Style::default().fg(hex_to_color(&theme.color_normal))+ };++ let title_style = if is_selected {+ Style::default().fg(hex_to_color(&theme.color_selected)).bold()+ } else {+ Style::default().fg(hex_to_color(&theme.color_text)).bold()+ };++ // Truncate title to fit+ let max_title_len = area.width.saturating_sub(4) as usize;+ let title: String = if task.title.len() > max_title_len {+ format!("{}...", &task.title[..max_title_len.saturating_sub(3)])+ } else {+ task.title.clone()+ };++ let card_block = Block::default()+ .borders(Borders::ALL)+ .border_style(border_style);+ let inner = card_block.inner(area);+ frame.render_widget(card_block, area);++ // Title line+ let title_line = Paragraph::new(title).style(title_style);+ let title_area = Rect {+ x: inner.x,+ y: inner.y,+ width: inner.width,+ height: 1,+ };+ frame.render_widget(title_line, title_area);++ // Preview area (below title)+ if inner.height > 1 {+ let preview_area = Rect {+ x: inner.x,+ y: inner.y + 1,+ width: inner.width,+ height: inner.height.saturating_sub(1),+ };++ if let Some(session_name) = &task.session_name {+ // Capture tmux pane content for preview+ let pane_content = capture_tmux_pane(session_name);+ let lines = parse_ansi_to_lines(&pane_content);++ // Skip last 5 lines (input prompt area) and take lines that fit+ let skip_last = 5;+ let max_width = preview_area.width as usize;+ let preview_lines: Vec<Line> = lines+ .into_iter()+ .rev()+ .skip(skip_last)+ .take(preview_area.height as usize)+ .map(|line| {+ // Truncate each line to fit the preview width+ let text: String = line.spans.iter().map(|s| s.content.as_ref()).collect();+ if text.len() > max_width {+ Line::from(format!("{}β¦", &text[..max_width.saturating_sub(1)]))+ } else {+ line+ }+ })+ .collect::<Vec<_>>()+ .into_iter()+ .rev()+ .collect();++ let preview = Paragraph::new(preview_lines)+ .style(Style::default().fg(Color::DarkGray));+ frame.render_widget(preview, preview_area);+ } else {+ // No session - show description preview or placeholder+ let preview_text = task.description.as_deref().unwrap_or("No agent session");++ // Truncate description to fit preview area+ let max_chars = (preview_area.width as usize) * (preview_area.height as usize);+ let truncated: String = if preview_text.len() > max_chars {+ format!("{}...", &preview_text.chars().take(max_chars.saturating_sub(3)).collect::<String>())+ } else {+ preview_text.to_string()+ };++ let preview = Paragraph::new(truncated)+ .style(Style::default().fg(Color::DarkGray).italic())+ .wrap(Wrap { trim: true });+ frame.render_widget(preview, preview_area);+ }+ }+ }++ fn draw_sidebar(state: &AppState, frame: &mut Frame, area: Rect) {+ // Show projects from database+ let current_path = state.project_path.as_ref().map(|p| p.to_string_lossy().to_string());++ let items: Vec<ListItem> = state+ .projects+ .iter()+ .enumerate()+ .map(|(i, project)| {+ let is_selected = i == state.selected_project && state.sidebar_focused;+ let is_current = current_path.as_ref() == Some(&project.path);++ let style = if is_selected {+ Style::default().bg(Color::Yellow).fg(Color::Black)+ } else if is_current {+ Style::default().fg(Color::Cyan)+ } else {+ Style::default()+ };++ let marker = if is_current { " β" } else { "" };+ ListItem::new(format!(" {}{}", project.name, marker)).style(style)+ })+ .collect();++ let title = format!(" π Projects ({}) ", state.projects.len());+ let border_color = if state.sidebar_focused {+ hex_to_color(&state.config.theme.color_selected)+ } else {+ hex_to_color(&state.config.theme.color_normal)+ };+ let list = List::new(items).block(+ Block::default()+ .title(title)+ .borders(Borders::ALL)+ .border_style(Style::default().fg(border_color)),+ );++ frame.render_widget(list, area);+ }++ fn draw_dashboard(state: &AppState, frame: &mut Frame, area: Rect) {+ let chunks = Layout::default()+ .direction(Direction::Vertical)+ .constraints([+ Constraint::Length(3),+ Constraint::Min(0),+ Constraint::Length(3),+ ])+ .split(area);++ // Header+ let header = Paragraph::new(" agtx Dashboard ")+ .style(Style::default().fg(Color::Cyan).bold())+ .block(Block::default().borders(Borders::ALL));+ frame.render_widget(header, chunks[0]);++ // Content area split: message + options/project list+ let content_chunks = Layout::default()+ .direction(Direction::Vertical)+ .constraints([+ Constraint::Length(5), // Message+ Constraint::Min(0), // Project list or options+ ])+ .split(chunks[1]);++ // Message+ let message = Paragraph::new("\n No project found in current directory.\n")+ .style(Style::default().fg(Color::Yellow))+ .block(Block::default().borders(Borders::ALL).border_style(Style::default().fg(Color::DarkGray)));+ frame.render_widget(message, content_chunks[0]);++ // Project list or options+ if state.show_project_list && !state.projects.is_empty() {+ // Show project list+ let items: Vec<ListItem> = state+ .projects+ .iter()+ .enumerate()+ .map(|(i, project)| {+ let is_selected = i == state.selected_project;+ let style = if is_selected {+ Style::default().bg(Color::DarkGray).fg(Color::White)+ } else {+ Style::default()+ };+ ListItem::new(format!(" {}", project.name)).style(style)+ })+ .collect();++ let list = List::new(items).block(+ Block::default()+ .title(" Projects [j/k] navigate [Enter] open [Esc] back ")+ .borders(Borders::ALL)+ .border_style(Style::default().fg(Color::Yellow)),+ );+ frame.render_widget(list, content_chunks[1]);+ } else {+ // Show options+ let options = Paragraph::new(+ "\n [p] Open existing project\n [n] Create new project in current directory\n",+ )+ .block(Block::default().title(" Options ").borders(Borders::ALL).border_style(Style::default().fg(Color::DarkGray)));+ frame.render_widget(options, content_chunks[1]);+ }++ // Footer+ let footer = Paragraph::new(" [p] projects [n] new project [q] quit ")+ .style(Style::default().fg(Color::DarkGray))+ .block(Block::default().borders(Borders::ALL));+ frame.render_widget(footer, chunks[2]);+ }++ fn handle_key(&mut self, key: crossterm::event::KeyEvent) -> Result<()> {+ // Handle PR confirmation popup if open+ if self.state.pr_confirm_popup.is_some() {+ return self.handle_pr_confirm_key(key);+ }++ // Handle task search popup if open+ if self.state.task_search.is_some() {+ return self.handle_task_search_key(key);+ }++ // Handle shell popup if open+ if self.state.shell_popup.is_some() {+ return self.handle_shell_popup_key(key);+ }++ // Handle based on mode (Dashboard vs Project)+ match &self.state.mode {+ AppMode::Dashboard => self.handle_dashboard_key(key.code),+ AppMode::Project(_) => {+ match self.state.input_mode {+ InputMode::Normal => self.handle_normal_key(key.code),+ InputMode::InputTitle => self.handle_title_input(key.code),+ InputMode::InputDescription => self.handle_description_input(key),+ }+ }+ }+ }++ fn handle_pr_confirm_key(&mut self, key: crossterm::event::KeyEvent) -> Result<()> {+ use crossterm::event::KeyModifiers;++ if let Some(ref mut popup) = self.state.pr_confirm_popup {+ match key.code {+ KeyCode::Esc => {+ self.state.pr_confirm_popup = None;+ }+ KeyCode::Tab => {+ // Switch between title and body editing+ popup.editing_title = !popup.editing_title;+ }+ KeyCode::Enter => {+ if popup.editing_title {+ // Move to body editing+ popup.editing_title = false;+ } else if key.modifiers.contains(KeyModifiers::CONTROL) {+ // Ctrl+Enter: Submit and create PR+ let task_id = popup.task_id.clone();+ let pr_title = popup.pr_title.clone();+ let pr_body = popup.pr_body.clone();+ self.state.pr_confirm_popup = None;+ self.create_pr_and_move_to_review_with_content(&task_id, &pr_title, &pr_body)?;+ } else {+ // Regular Enter in body: add newline+ popup.pr_body.push('\n');+ }+ }+ KeyCode::Backspace => {+ if popup.editing_title {+ popup.pr_title.pop();+ } else {+ popup.pr_body.pop();+ }+ }+ KeyCode::Char(c) => {+ if popup.editing_title {+ popup.pr_title.push(c);+ } else {+ popup.pr_body.push(c);+ }+ }+ _ => {}+ }+ }+ Ok(())+ }++ fn create_pr_and_move_to_review_with_content(&mut self, task_id: &str, pr_title: &str, pr_body: &str) -> Result<()> {+ if let (Some(db), Some(project_path)) = (&self.state.db, self.state.project_path.clone()) {+ if let Some(mut task) = db.get_task(task_id)? {+ // Kill tmux window first+ if let Some(session_name) = &task.session_name {+ let _ = std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["kill-window", "-t", session_name])+ .output();+ }+ task.session_name = None;++ // Create PR with provided title and body+ match create_pr_with_content(&task, &project_path, pr_title, pr_body) {+ Ok((pr_number, pr_url)) => {+ task.pr_number = Some(pr_number);+ task.pr_url = Some(pr_url);+ }+ Err(e) => {+ // TODO: Show error to user+ eprintln!("Failed to create PR: {}", e);+ }+ }++ // Move to Review+ task.status = TaskStatus::Review;+ task.updated_at = chrono::Utc::now();+ db.update_task(&task)?;+ self.refresh_tasks()?;+ }+ }+ Ok(())+ }++ fn handle_task_search_key(&mut self, key: crossterm::event::KeyEvent) -> Result<()> {+ use crossterm::event::KeyModifiers;++ let should_close = match key.code {+ KeyCode::Esc => {+ self.state.task_search = None;+ true+ }+ KeyCode::Enter => {+ // Jump to selected task+ if let Some(ref search) = self.state.task_search {+ if let Some((task_id, _, status)) = search.matches.get(search.selected).cloned() {+ // Find column index for this status+ let col_idx = TaskStatus::columns().iter().position(|s| *s == status).unwrap_or(0);+ self.state.board.selected_column = col_idx;++ // Find row index for this task+ let tasks_in_col: Vec<_> = self.state.board.tasks.iter()+ .filter(|t| t.status == status)+ .collect();+ if let Some(row_idx) = tasks_in_col.iter().position(|t| t.id == task_id) {+ self.state.board.selected_row = row_idx;+ }+ }+ }+ self.state.task_search = None;+ true+ }+ KeyCode::Up | KeyCode::BackTab => {+ if let Some(ref mut search) = self.state.task_search {+ if search.selected > 0 {+ search.selected -= 1;+ }+ }+ false+ }+ KeyCode::Down | KeyCode::Tab => {+ if let Some(ref mut search) = self.state.task_search {+ if search.selected < search.matches.len().saturating_sub(1) {+ search.selected += 1;+ }+ }+ false+ }+ KeyCode::Char('k') if key.modifiers.contains(KeyModifiers::CONTROL) => {+ if let Some(ref mut search) = self.state.task_search {+ if search.selected > 0 {+ search.selected -= 1;+ }+ }+ false+ }+ KeyCode::Char('j') if key.modifiers.contains(KeyModifiers::CONTROL) => {+ if let Some(ref mut search) = self.state.task_search {+ if search.selected < search.matches.len().saturating_sub(1) {+ search.selected += 1;+ }+ }+ false+ }+ KeyCode::Backspace => {+ if let Some(ref mut search) = self.state.task_search {+ search.query.pop();+ }+ let query = self.state.task_search.as_ref().map(|s| s.query.clone()).unwrap_or_default();+ let matches = self.get_all_task_matches(&query);+ if let Some(ref mut search) = self.state.task_search {+ search.matches = matches;+ search.selected = 0;+ }+ false+ }+ KeyCode::Char(c) => {+ if let Some(ref mut search) = self.state.task_search {+ search.query.push(c);+ }+ let query = self.state.task_search.as_ref().map(|s| s.query.clone()).unwrap_or_default();+ let matches = self.get_all_task_matches(&query);+ if let Some(ref mut search) = self.state.task_search {+ search.matches = matches;+ search.selected = 0;+ }+ false+ }+ _ => false,+ };++ if should_close {+ self.state.task_search = None;+ }++ Ok(())+ }++ fn get_all_task_matches(&self, query: &str) -> Vec<(String, String, TaskStatus)> {+ let query_lower = query.to_lowercase();++ let mut matches: Vec<(String, String, TaskStatus, i32)> = self.state.board.tasks+ .iter()+ .filter_map(|task| {+ let title_lower = task.title.to_lowercase();+ let score = if query.is_empty() {+ 1+ } else {+ fuzzy_score(&title_lower, &query_lower)+ };++ if score > 0 {+ Some((task.id.clone(), task.title.clone(), task.status, score))+ } else {+ None+ }+ })+ .collect();++ // Sort by score (higher is better)+ matches.sort_by(|a, b| b.3.cmp(&a.3));++ matches.into_iter()+ .take(10)+ .map(|(id, title, status, _)| (id, title, status))+ .collect()+ }++ fn handle_shell_popup_key(&mut self, key: crossterm::event::KeyEvent) -> Result<()> {+ use crossterm::event::KeyModifiers;++ if let Some(ref mut popup) = self.state.shell_popup {+ let window_name = popup.window_name.clone();+ let has_ctrl = key.modifiers.contains(KeyModifiers::CONTROL);++ match key.code {+ KeyCode::Esc => {+ // Close popup+ self.state.shell_popup = None;+ }+ // Scroll with Ctrl+k or Ctrl+Up+ KeyCode::Char('k') | KeyCode::Up if has_ctrl => {+ popup.scroll_offset -= 5;+ }+ // Scroll with Ctrl+j or Ctrl+Down+ KeyCode::Char('j') | KeyCode::Down if has_ctrl => {+ popup.scroll_offset = (popup.scroll_offset + 5).min(0);+ }+ KeyCode::PageUp => {+ popup.scroll_offset -= 20;+ }+ KeyCode::PageDown => {+ popup.scroll_offset = (popup.scroll_offset + 20).min(0);+ }+ // Ctrl+g = go to bottom (current)+ KeyCode::Char('g') if has_ctrl => {+ popup.scroll_offset = 0;+ }+ _ => {+ // Forward all other keys to tmux window+ send_key_to_tmux(&window_name, key.code);+ }+ }+ }+ Ok(())+ }++ fn handle_dashboard_key(&mut self, key: KeyCode) -> Result<()> {+ match key {+ KeyCode::Char('q') => self.state.should_quit = true,+ _ => {}+ }+ Ok(())+ }++ fn handle_normal_key(&mut self, key: KeyCode) -> Result<()> {+ // Handle sidebar navigation if focused+ if self.state.sidebar_focused && self.state.sidebar_visible {+ match key {+ KeyCode::Char('q') => self.state.should_quit = true,+ KeyCode::Char('e') => {+ // Toggle sidebar visibility+ self.state.sidebar_visible = false;+ self.state.sidebar_focused = false;+ }+ KeyCode::Char('l') | KeyCode::Right | KeyCode::Esc => {+ // Move focus back to board+ self.state.sidebar_focused = false;+ }+ KeyCode::Char('j') | KeyCode::Down => {+ if self.state.selected_project < self.state.projects.len().saturating_sub(1) {+ self.state.selected_project += 1;+ // Switch to project immediately on cursor move+ if let Some(project) = self.state.projects.get(self.state.selected_project).cloned() {+ self.switch_to_project_keep_sidebar(&project)?;+ }+ }+ }+ KeyCode::Char('k') | KeyCode::Up => {+ if self.state.selected_project > 0 {+ self.state.selected_project -= 1;+ // Switch to project immediately on cursor move+ if let Some(project) = self.state.projects.get(self.state.selected_project).cloned() {+ self.switch_to_project_keep_sidebar(&project)?;+ }+ }+ }+ KeyCode::Enter => {+ // Enter focuses the board (sidebar stays visible)+ self.state.sidebar_focused = false;+ }+ _ => {}+ }+ return Ok(());+ }++ // Handle board navigation+ match key {+ KeyCode::Char('q') => self.state.should_quit = true,+ KeyCode::Char('e') => {+ // Toggle sidebar visibility+ self.state.sidebar_visible = !self.state.sidebar_visible;+ if self.state.sidebar_visible {+ self.refresh_projects()?;+ }+ }+ KeyCode::Char('h') | KeyCode::Left => {+ // Move to sidebar only if visible AND in first column (Backlog)+ if self.state.sidebar_visible && self.state.board.selected_column == 0 {+ self.state.sidebar_focused = true;+ self.refresh_projects()?;+ } else {+ self.state.board.move_left();+ }+ }+ KeyCode::Char('l') | KeyCode::Right => self.state.board.move_right(),+ KeyCode::Char('j') | KeyCode::Down => self.state.board.move_down(),+ KeyCode::Char('k') | KeyCode::Up => self.state.board.move_up(),+ KeyCode::Char('o') => {+ // New task+ self.state.input_mode = InputMode::InputTitle;+ self.state.input_buffer.clear();+ self.state.pending_task_title.clear();+ self.state.editing_task_id = None;+ }+ KeyCode::Enter => {+ // If in Backlog, edit the task; otherwise open shell popup+ if let Some(task) = self.state.board.selected_task() {+ if task.status == TaskStatus::Backlog {+ // Edit task+ self.state.editing_task_id = Some(task.id.clone());+ self.state.input_buffer = task.title.clone();+ self.state.pending_task_title.clear();+ self.state.input_mode = InputMode::InputTitle;+ } else if task.session_name.is_some() {+ // Open shell popup+ self.open_selected_task()?;+ }+ }+ }+ KeyCode::Char('d') => self.delete_selected_task()?,+ KeyCode::Char('m') => self.move_task_right()?,+ KeyCode::Char('r') => {+ // Move Review task back to Running (for PR changes)+ if let Some(task) = self.state.board.selected_task() {+ if task.status == TaskStatus::Review {+ let task_id = task.id.clone();+ self.move_review_to_running(&task_id)?;+ }+ }+ }+ KeyCode::Char('/') => {+ // Open task search+ self.state.task_search = Some(TaskSearchState {+ query: String::new(),+ matches: self.get_all_task_matches(""),+ selected: 0,+ });+ }+ _ => {}+ }+ Ok(())+ }++ fn handle_title_input(&mut self, key: KeyCode) -> Result<()> {+ match key {+ KeyCode::Esc => {+ self.state.input_mode = InputMode::Normal;+ self.state.input_buffer.clear();+ self.state.pending_task_title.clear();+ self.state.editing_task_id = None;+ }+ KeyCode::Enter => {+ if !self.state.input_buffer.is_empty() {+ // Save title and move to description input+ self.state.pending_task_title = self.state.input_buffer.clone();++ // If editing, pre-fill description+ if let Some(task_id) = &self.state.editing_task_id {+ if let Some(db) = &self.state.db {+ if let Ok(Some(task)) = db.get_task(task_id) {+ self.state.input_buffer = task.description.unwrap_or_default();+ } else {+ self.state.input_buffer.clear();+ }+ } else {+ self.state.input_buffer.clear();+ }+ } else {+ self.state.input_buffer.clear();+ }++ self.state.input_mode = InputMode::InputDescription;+ }+ }+ KeyCode::Backspace => {+ self.state.input_buffer.pop();+ }+ KeyCode::Char(c) => {+ self.state.input_buffer.push(c);+ }+ _ => {}+ }+ Ok(())+ }++ fn handle_description_input(&mut self, key: crossterm::event::KeyEvent) -> Result<()> {+ // Handle file search mode if active+ if let Some(ref mut search) = self.state.file_search {+ match key.code {+ KeyCode::Esc => {+ // Cancel file search+ self.state.file_search = None;+ }+ KeyCode::Enter | KeyCode::Tab => {+ // Select current match+ if let Some(selected_file) = search.matches.get(search.selected).cloned() {+ // Remove the #pattern from input and insert the file path+ self.state.input_buffer.truncate(search.start_pos);+ self.state.input_buffer.push_str(&selected_file);+ }+ self.state.file_search = None;+ }+ KeyCode::Up | KeyCode::Char('k') => {+ if search.selected > 0 {+ search.selected -= 1;+ }+ }+ KeyCode::Down | KeyCode::Char('j') => {+ if search.selected < search.matches.len().saturating_sub(1) {+ search.selected += 1;+ }+ }+ KeyCode::Backspace => {+ if search.pattern.is_empty() {+ // Cancel search if pattern is empty+ self.state.input_buffer.pop(); // Remove the #+ self.state.file_search = None;+ } else {+ search.pattern.pop();+ self.state.input_buffer.pop();+ self.update_file_search_matches();+ }+ }+ KeyCode::Char(c) => {+ search.pattern.push(c);+ self.state.input_buffer.push(c);+ self.update_file_search_matches();+ }+ _ => {}+ }+ return Ok(());+ }++ match key.code {+ KeyCode::Esc => {+ self.state.input_mode = InputMode::Normal;+ self.state.input_buffer.clear();+ self.state.pending_task_title.clear();+ self.state.editing_task_id = None;+ }+ KeyCode::Enter => {+ // Check if line ends with backslash for line continuation+ if self.state.input_buffer.ends_with('\\') {+ // Remove backslash and insert newline+ self.state.input_buffer.pop();+ self.state.input_buffer.push('\n');+ } else {+ // Save task (create or update)+ self.save_task()?;+ self.state.input_mode = InputMode::Normal;+ self.state.input_buffer.clear();+ self.state.pending_task_title.clear();+ self.state.editing_task_id = None;+ }+ }+ KeyCode::Backspace => {+ self.state.input_buffer.pop();+ }+ KeyCode::Char('#') => {+ // Start file search+ let start_pos = self.state.input_buffer.len();+ self.state.input_buffer.push('#');+ self.state.file_search = Some(FileSearchState {+ pattern: String::new(),+ matches: vec![],+ selected: 0,+ start_pos,+ });+ self.update_file_search_matches();+ }+ KeyCode::Char(c) => {+ self.state.input_buffer.push(c);+ }+ _ => {}+ }+ Ok(())+ }++ fn update_file_search_matches(&mut self) {+ if let (Some(ref mut search), Some(ref project_path)) = (&mut self.state.file_search, &self.state.project_path) {+ let pattern = &search.pattern;+ search.matches = fuzzy_find_files(project_path, pattern, 10);+ search.selected = 0;+ }+ }++ fn save_task(&mut self) -> Result<()> {+ if let Some(db) = &self.state.db {+ if let Some(task_id) = &self.state.editing_task_id {+ // Editing existing task+ if let Some(mut task) = db.get_task(task_id)? {+ task.title = self.state.pending_task_title.clone();+ task.description = if self.state.input_buffer.is_empty() {+ None+ } else {+ Some(self.state.input_buffer.clone())+ };+ task.updated_at = chrono::Utc::now();+ db.update_task(&task)?;+ }+ } else {+ // Creating new task+ let project_id = self.state.project_name.clone();+ let agent = self.state.config.default_agent.clone();++ let mut task = Task::new(&self.state.pending_task_title, agent, project_id);+ if !self.state.input_buffer.is_empty() {+ task.description = Some(self.state.input_buffer.clone());+ }+ // Task starts in Backlog without tmux window+ db.create_task(&task)?;+ }+ self.refresh_tasks()?;+ }+ Ok(())+ }++ fn delete_selected_task(&mut self) -> Result<()> {+ if let Some(task) = self.state.board.selected_task() {+ if let Some(db) = &self.state.db {+ db.delete_task(&task.id)?;+ self.refresh_tasks()?;+ }+ }+ Ok(())+ }++ fn move_task_right(&mut self) -> Result<()> {+ if let (Some(task), Some(project_path)) = (+ self.state.board.selected_task_mut(),+ self.state.project_path.clone(),+ ) {+ let current_status = task.status;+ let next_status = match current_status {+ TaskStatus::Backlog => Some(TaskStatus::Planning),+ TaskStatus::Planning => Some(TaskStatus::Running),+ TaskStatus::Running => Some(TaskStatus::Review),+ TaskStatus::Review => Some(TaskStatus::Done),+ TaskStatus::Done => None,+ };++ if let Some(new_status) = next_status {+ // Create worktree and tmux window when moving from Backlog to Planning+ if current_status == TaskStatus::Backlog && new_status == TaskStatus::Planning {+ // Sanitize title for worktree/window name+ let title_slug: String = task.title+ .chars()+ .map(|c| if c.is_alphanumeric() || c == '-' || c == '_' { c } else { '-' })+ .take(30)+ .collect();+ let title_slug = title_slug.trim_matches('-').to_string();+ let window_name = format!("task-{}", title_slug);+ let target = format!("{}:{}", self.state.project_name, window_name);++ // Create git worktree from main branch+ let worktree_path = git::create_worktree(&project_path, &title_slug)?;+ let worktree_path_str = worktree_path.to_string_lossy().to_string();++ // Build the prompt from task title and description+ let prompt = if let Some(desc) = &task.description {+ format!("{}\n\n{}", task.title, desc)+ } else {+ task.title.clone()+ };++ // Escape single quotes in prompt for shell+ let escaped_prompt = prompt.replace('\'', "'\"'\"'");++ // Create tmux window and start Claude Code with initial prompt+ let claude_cmd = format!("claude --dangerously-skip-permissions '{}'", escaped_prompt);++ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["new-window", "-d", "-t", &self.state.project_name, "-n", &window_name])+ .args(["-c", &worktree_path_str])+ .args(["sh", "-c", &claude_cmd])+ .output()?;++ // Wait briefly for Claude to start and show the bypass warning+ std::thread::sleep(std::time::Duration::from_millis(500));++ // Send "2" to select "Yes, I accept" and Enter to confirm+ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["send-keys", "-t", &target, "2"])+ .output()?;+ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["send-keys", "-t", &target, "Enter"])+ .output()?;++ task.session_name = Some(target);+ task.worktree_path = Some(worktree_path_str);+ task.branch_name = Some(format!("task/{}", title_slug));+ }++ // When moving from Planning to Running, approve the plan to start implementation+ if current_status == TaskStatus::Planning && new_status == TaskStatus::Running {+ if let Some(session_name) = &task.session_name {+ // Send Enter to approve the plan and start implementing+ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["send-keys", "-t", session_name, "Enter"])+ .output()?;+ }+ }++ // When moving from Running to Review: Show PR confirmation popup+ if current_status == TaskStatus::Running && new_status == TaskStatus::Review {+ let task_id = task.id.clone();+ let task_title = task.title.clone();+ let worktree_path = task.worktree_path.clone();+ let branch_name = task.branch_name.clone();++ // Generate PR description using Claude+ let (pr_title, pr_body) = generate_pr_description(+ &task_title,+ worktree_path.as_deref(),+ branch_name.as_deref(),+ );++ // Store task info and show popup+ self.state.pr_confirm_popup = Some(PrConfirmPopup {+ task_id,+ pr_title,+ pr_body,+ editing_title: true,+ generating: false,+ });+ // Don't move yet - wait for popup confirmation+ return Ok(());+ }++ // When moving from Review to Done: Check if PR is merged+ if current_status == TaskStatus::Review && new_status == TaskStatus::Done {+ if let Some(pr_number) = task.pr_number {+ if !is_pr_merged(pr_number, &project_path)? {+ // PR not merged yet - can't move to Done+ // TODO: Show error message+ return Ok(());+ }+ // PR is merged - cleanup resources+ // Kill tmux window if exists+ if let Some(session_name) = &task.session_name {+ let _ = std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["kill-window", "-t", session_name])+ .output();+ }++ // Remove worktree if exists+ if let Some(worktree) = &task.worktree_path {+ let _ = std::process::Command::new("git")+ .current_dir(&project_path)+ .args(["worktree", "remove", "--force", worktree])+ .output();+ }++ // Delete local branch if exists+ if let Some(branch) = &task.branch_name {+ let _ = std::process::Command::new("git")+ .current_dir(&project_path)+ .args(["branch", "-D", branch])+ .output();+ }++ task.session_name = None;+ task.worktree_path = None;+ } else {+ // No PR - can't move to Done without PR being merged+ return Ok(());+ }+ }++ task.status = new_status;+ task.updated_at = chrono::Utc::now();++ if let Some(db) = &self.state.db {+ db.update_task(task)?;+ }+ }+ }+ self.refresh_tasks()?;+ Ok(())+ }++ /// Move task from Review back to Running (only allowed transition backwards)+ fn move_review_to_running(&mut self, task_id: &str) -> Result<()> {+ if let (Some(db), Some(project_path)) = (&self.state.db, &self.state.project_path) {+ if let Some(mut task) = db.get_task(task_id)? {+ if task.status != TaskStatus::Review {+ return Ok(());+ }++ // Re-spawn tmux window in existing worktree+ if let (Some(worktree_path), Some(branch_name)) = (&task.worktree_path, &task.branch_name) {+ let title_slug: String = task.title+ .chars()+ .map(|c| if c.is_alphanumeric() || c == '-' || c == '_' { c } else { '-' })+ .take(30)+ .collect();+ let title_slug = title_slug.trim_matches('-').to_string();+ let window_name = format!("task-{}", title_slug);+ let target = format!("{}:{}", self.state.project_name, window_name);++ // Build prompt with PR feedback context+ let prompt = format!(+ "Continue working on: {}\n\nPR #{} needs changes. Please address the feedback.",+ task.title,+ task.pr_number.unwrap_or(0)+ );+ let escaped_prompt = prompt.replace('\'', "'\"'\"'");++ // Create tmux window in the existing worktree+ let claude_cmd = format!("claude --dangerously-skip-permissions '{}'", escaped_prompt);++ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["new-window", "-d", "-t", &self.state.project_name, "-n", &window_name])+ .args(["-c", worktree_path])+ .args(["sh", "-c", &claude_cmd])+ .output()?;++ // Wait briefly for Claude to start and show the bypass warning+ std::thread::sleep(std::time::Duration::from_millis(500));++ // Send "2" to select "Yes, I accept" and Enter to confirm+ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["send-keys", "-t", &target, "2"])+ .output()?;+ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["send-keys", "-t", &target, "Enter"])+ .output()?;++ task.session_name = Some(target);+ }++ task.status = TaskStatus::Running;+ task.updated_at = chrono::Utc::now();+ db.update_task(&task)?;+ self.refresh_tasks()?;+ }+ }+ Ok(())+ }++ fn open_selected_task(&mut self) -> Result<()> {+ if let Some(task) = self.state.board.selected_task() {+ if let Some(window_name) = &task.session_name.clone() {+ // Open shell popup to view/control the detached tmux window+ self.state.shell_popup = Some(ShellPopup {+ task_title: task.title.clone(),+ window_name: window_name.clone(),+ scroll_offset: 0,+ });+ }+ }+ Ok(())+ }++ fn refresh_tasks(&mut self) -> Result<()> {+ if let Some(db) = &self.state.db {+ self.state.board.tasks = db.get_all_tasks()?;+ }+ Ok(())+ }++ fn refresh_projects(&mut self) -> Result<()> {+ // Load projects from global database+ let db_projects = self.state.global_db.get_all_projects()?;++ self.state.projects = db_projects+ .into_iter()+ .map(|p| ProjectInfo {+ name: p.name,+ path: p.path,+ })+ .collect();++ // Sort alphabetically by name (case-insensitive)+ self.state+ .projects+ .sort_by(|a, b| a.name.to_lowercase().cmp(&b.name.to_lowercase()));++ // Find current project in list and select it+ if let Some(project_path) = &self.state.project_path {+ let current_path = project_path.to_string_lossy();+ if let Some(pos) = self.state.projects.iter().position(|p| p.path == current_path) {+ self.state.selected_project = pos;+ }+ }++ Ok(())+ }++ fn refresh_sessions(&mut self) -> Result<()> {+ // TODO: Periodically check tmux sessions and update task status+ Ok(())+ }++ fn switch_to_project(&mut self, project: &ProjectInfo) -> Result<()> {+ self.switch_to_project_keep_sidebar(project)?;+ // Unfocus sidebar+ self.state.sidebar_focused = false;+ Ok(())+ }++ fn switch_to_project_keep_sidebar(&mut self, project: &ProjectInfo) -> Result<()> {+ let project_path = PathBuf::from(&project.path);++ // Check if project path exists+ if !project_path.exists() {+ // Skip non-existent projects silently+ return Ok(());+ }++ // Update current project+ self.state.project_name = project.name.clone();+ self.state.project_path = Some(project_path.clone());++ // Open project database (create if needed)+ match Database::open_project(&project_path) {+ Ok(db) => self.state.db = Some(db),+ Err(_) => {+ // If we can't open the db, skip this project+ return Ok(());+ }+ }++ // Update last_opened in global db+ let proj = crate::db::Project::new(&project.name, &project.path);+ let _ = self.state.global_db.upsert_project(&proj);++ // Ensure tmux session exists+ ensure_project_tmux_session(&project.name, &project_path);++ // Reload tasks for new project+ self.refresh_tasks()?;++ Ok(())+ }+}++impl Drop for App {+ fn drop(&mut self) {+ let _ = disable_raw_mode();+ let _ = execute!(self.terminal.backend_mut(), LeaveAlternateScreen);+ }+}++/// Ensure tmux session exists for a project+fn ensure_project_tmux_session(project_name: &str, project_path: &Path) {+ // Check if session already exists+ let session_exists = std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["has-session", "-t", project_name])+ .output()+ .map(|o| o.status.success())+ .unwrap_or(false);++ if !session_exists {+ // Create detached session for this project+ let _ = std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["new-session", "-d", "-s", project_name])+ .args(["-c", &project_path.to_string_lossy().to_string()])+ .output();+ }+}++/// Helper function to create a centered rect+fn centered_rect(percent_x: u16, percent_y: u16, r: Rect) -> Rect {+ let popup_layout = Layout::default()+ .direction(Direction::Vertical)+ .constraints([+ Constraint::Percentage((100 - percent_y) / 2),+ Constraint::Percentage(percent_y),+ Constraint::Percentage((100 - percent_y) / 2),+ ])+ .split(r);++ Layout::default()+ .direction(Direction::Horizontal)+ .constraints([+ Constraint::Percentage((100 - percent_x) / 2),+ Constraint::Percentage(percent_x),+ Constraint::Percentage((100 - percent_x) / 2),+ ])+ .split(popup_layout[1])[1]+}++/// Capture content from a tmux pane (with ANSI escape sequences)+fn capture_tmux_pane(window_name: &str) -> Vec<u8> {+ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["capture-pane", "-t", window_name, "-p", "-e"])+ .output()+ .map(|o| o.stdout)+ .unwrap_or_default()+}++/// Capture content from a tmux pane with history (with ANSI escape sequences)+fn capture_tmux_pane_with_history(window_name: &str, history_lines: i32) -> Vec<u8> {+ std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["capture-pane", "-t", window_name, "-p", "-e"])+ .args(["-S", &(-history_lines).to_string()])+ .output()+ .map(|o| o.stdout)+ .unwrap_or_default()+}++/// Check if a PR is merged+fn is_pr_merged(pr_number: i32, project_path: &Path) -> Result<bool> {+ let output = std::process::Command::new("gh")+ .current_dir(project_path)+ .args(["pr", "view", &pr_number.to_string(), "--json", "state"])+ .output()?;++ if !output.status.success() {+ return Ok(false);+ }++ let stdout = String::from_utf8_lossy(&output.stdout);+ Ok(stdout.contains("MERGED"))+}++/// Generate PR title and description using Claude+fn generate_pr_description(task_title: &str, worktree_path: Option<&str>, branch_name: Option<&str>) -> (String, String) {+ // Default values+ let default_title = task_title.to_string();+ let mut default_body = String::new();++ // Try to get git diff for context+ if let Some(worktree) = worktree_path {+ // Get diff from main+ let diff_output = std::process::Command::new("git")+ .current_dir(worktree)+ .args(["diff", "main", "--stat"])+ .output();++ if let Ok(output) = diff_output {+ let diff_stat = String::from_utf8_lossy(&output.stdout);+ if !diff_stat.is_empty() {+ default_body.push_str("## Changes\n```\n");+ default_body.push_str(&diff_stat);+ default_body.push_str("```\n");+ }+ }++ // Try to use Claude to generate a better description+ let prompt = format!(+ "Generate a concise PR description for these changes. Task: '{}'. Output only the description, no markdown code blocks around it. Keep it brief (2-3 sentences max).",+ task_title+ );++ let claude_output = std::process::Command::new("claude")+ .current_dir(worktree)+ .args(["--print", &prompt])+ .output();++ if let Ok(output) = claude_output {+ if output.status.success() {+ let generated = String::from_utf8_lossy(&output.stdout).trim().to_string();+ if !generated.is_empty() {+ default_body = format!("{}\n\n{}", generated, default_body);+ }+ }+ }+ }++ (default_title, default_body)+}++/// Create a PR with provided title and body, return (pr_number, pr_url)+fn create_pr_with_content(task: &Task, project_path: &Path, pr_title: &str, pr_body: &str) -> Result<(i32, String)> {+ // First push the branch+ if let Some(branch) = &task.branch_name {+ let worktree = task.worktree_path.as_deref().unwrap_or(".");+ std::process::Command::new("git")+ .current_dir(worktree)+ .args(["push", "-u", "origin", branch])+ .output()?;+ }++ // Create PR+ let output = std::process::Command::new("gh")+ .current_dir(project_path)+ .args([+ "pr", "create",+ "--title", pr_title,+ "--body", pr_body,+ "--head", task.branch_name.as_deref().unwrap_or(""),+ ])+ .output()?;++ if !output.status.success() {+ let stderr = String::from_utf8_lossy(&output.stderr);+ anyhow::bail!("Failed to create PR: {}", stderr);+ }++ let pr_url = String::from_utf8_lossy(&output.stdout).trim().to_string();++ // Get PR number from URL+ let pr_number = pr_url+ .split('/')+ .last()+ .and_then(|s| s.parse::<i32>().ok())+ .unwrap_or(0);++ Ok((pr_number, pr_url))+}++/// Send a key to a tmux pane+fn send_key_to_tmux(window_name: &str, key: KeyCode) {+ let key_str = match key {+ KeyCode::Char(c) => c.to_string(),+ KeyCode::Enter => "Enter".to_string(),+ KeyCode::Backspace => "BSpace".to_string(),+ KeyCode::Tab => "Tab".to_string(),+ KeyCode::Up => "Up".to_string(),+ KeyCode::Down => "Down".to_string(),+ KeyCode::Left => "Left".to_string(),+ KeyCode::Right => "Right".to_string(),+ KeyCode::Home => "Home".to_string(),+ KeyCode::End => "End".to_string(),+ KeyCode::PageUp => "PageUp".to_string(),+ KeyCode::PageDown => "PageDown".to_string(),+ KeyCode::Delete => "DC".to_string(),+ KeyCode::Insert => "IC".to_string(),+ KeyCode::F(n) => format!("F{}", n),+ _ => return,+ };++ let _ = std::process::Command::new("tmux")+ .args(["-L", tmux::AGENT_SERVER])+ .args(["send-keys", "-t", window_name, &key_str])+ .output();+}++/// Parse ANSI escape sequences to ratatui Lines with colors+fn parse_ansi_to_lines(bytes: &[u8]) -> Vec<Line<'static>> {+ let text = String::from_utf8_lossy(bytes);+ let mut lines: Vec<Line<'static>> = Vec::new();+ let mut current_style = Style::default();++ for line_str in text.lines() {+ let mut spans: Vec<Span<'static>> = Vec::new();+ let mut current_text = String::new();+ let mut chars = line_str.chars().peekable();++ while let Some(c) = chars.next() {+ if c == '\x1b' {+ // Start of escape sequence+ if !current_text.is_empty() {+ spans.push(Span::styled(current_text.clone(), current_style));+ current_text.clear();+ }++ // Parse escape sequence+ if chars.peek() == Some(&'[') {+ chars.next(); // consume '['+ let mut seq = String::new();+ while let Some(&ch) = chars.peek() {+ if ch.is_ascii_digit() || ch == ';' {+ seq.push(chars.next().unwrap());+ } else {+ break;+ }+ }+ // Get the final character+ if let Some(final_char) = chars.next() {+ if final_char == 'm' {+ // SGR sequence - parse color codes+ current_style = parse_sgr(&seq, current_style);+ }+ }+ }+ } else {+ current_text.push(c);+ }+ }++ if !current_text.is_empty() {+ spans.push(Span::styled(current_text, current_style));+ }++ if spans.is_empty() {+ lines.push(Line::from(""));+ } else {+ lines.push(Line::from(spans));+ }+ }++ lines+}++/// Parse SGR (Select Graphic Rendition) codes+fn parse_sgr(seq: &str, mut style: Style) -> Style {+ if seq.is_empty() {+ return Style::default();+ }++ let codes: Vec<u8> = seq+ .split(';')+ .filter_map(|s| s.parse().ok())+ .collect();++ let mut i = 0;+ while i < codes.len() {+ match codes[i] {+ 0 => style = Style::default(),+ 1 => style = style.bold(),+ 2 => style = style.dim(),+ 3 => style = style.italic(),+ 4 => style = style.underlined(),+ 7 => style = style.reversed(),+ // Foreground colors+ 30 => style = style.fg(Color::Black),+ 31 => style = style.fg(Color::Red),+ 32 => style = style.fg(Color::Green),+ 33 => style = style.fg(Color::Yellow),+ 34 => style = style.fg(Color::Blue),+ 35 => style = style.fg(Color::Magenta),+ 36 => style = style.fg(Color::Cyan),+ 37 => style = style.fg(Color::Gray),+ 39 => style = style.fg(Color::Reset),+ 90 => style = style.fg(Color::DarkGray),+ 91 => style = style.fg(Color::LightRed),+ 92 => style = style.fg(Color::LightYellow),+ 93 => style = style.fg(Color::LightYellow),+ 94 => style = style.fg(Color::LightBlue),+ 95 => style = style.fg(Color::LightMagenta),+ 96 => style = style.fg(Color::LightCyan),+ 97 => style = style.fg(Color::White),+ // Background colors+ 40 => style = style.bg(Color::Black),+ 41 => style = style.bg(Color::Red),+ 42 => style = style.bg(Color::Green),+ 43 => style = style.bg(Color::Yellow),+ 44 => style = style.bg(Color::Blue),+ 45 => style = style.bg(Color::Magenta),+ 46 => style = style.bg(Color::Cyan),+ 47 => style = style.bg(Color::Gray),+ 49 => style = style.bg(Color::Reset),+ 100 => style = style.bg(Color::DarkGray),+ 101 => style = style.bg(Color::LightRed),+ 102 => style = style.bg(Color::LightYellow),+ 103 => style = style.bg(Color::LightYellow),+ 104 => style = style.bg(Color::LightBlue),+ 105 => style = style.bg(Color::LightMagenta),+ 106 => style = style.bg(Color::LightCyan),+ 107 => style = style.bg(Color::White),+ // 256-color mode: 38;5;n or 48;5;n+ 38 if i + 2 < codes.len() && codes[i + 1] == 5 => {+ style = style.fg(Color::Indexed(codes[i + 2]));+ i += 2;+ }+ 48 if i + 2 < codes.len() && codes[i + 1] == 5 => {+ style = style.bg(Color::Indexed(codes[i + 2]));+ i += 2;+ }+ // RGB mode: 38;2;r;g;b or 48;2;r;g;b+ 38 if i + 4 < codes.len() && codes[i + 1] == 2 => {+ style = style.fg(Color::Rgb(codes[i + 2], codes[i + 3], codes[i + 4]));+ i += 4;+ }+ 48 if i + 4 < codes.len() && codes[i + 1] == 2 => {+ style = style.bg(Color::Rgb(codes[i + 2], codes[i + 3], codes[i + 4]));+ i += 4;+ }+ _ => {}+ }+ i += 1;+ }++ style+}++/// Fuzzy find files in a directory (respects .gitignore)+fn fuzzy_find_files(project_path: &Path, pattern: &str, max_results: usize) -> Vec<String> {+ use std::process::Command;++ // Use git ls-files to get tracked files (respects .gitignore)+ let output = Command::new("git")+ .current_dir(project_path)+ .args(["ls-files", "--cached", "--others", "--exclude-standard"])+ .output();++ if let Ok(output) = output {+ let stdout = String::from_utf8_lossy(&output.stdout);+ let files: Vec<String> = stdout.lines().map(String::from).collect();++ if pattern.is_empty() {+ // Show first N files when pattern is empty+ return files.into_iter().take(max_results).collect();+ }++ let pattern_lower = pattern.to_lowercase();+ let mut matches: Vec<(String, i32)> = files+ .into_iter()+ .filter_map(|path| {+ let path_lower = path.to_lowercase();++ // Simple fuzzy matching: check if all pattern chars appear in order+ let score = fuzzy_score(&path_lower, &pattern_lower);+ if score > 0 {+ Some((path, score))+ } else {+ None+ }+ })+ .collect();++ // Sort by score (higher is better)+ matches.sort_by(|a, b| b.1.cmp(&a.1));++ return matches.into_iter().take(max_results).map(|(path, _)| path).collect();+ }++ vec![]+}++/// Calculate fuzzy match score (higher is better, 0 means no match)+fn fuzzy_score(haystack: &str, needle: &str) -> i32 {+ if needle.is_empty() {+ return 1;+ }++ let mut score = 0;+ let mut needle_chars = needle.chars().peekable();+ let mut prev_matched = false;+ let mut prev_was_separator = true;++ for c in haystack.chars() {+ let is_separator = c == '/' || c == '_' || c == '-' || c == '.';++ if let Some(&nc) = needle_chars.peek() {+ if c == nc {+ needle_chars.next();+ score += 1;++ // Bonus for matching after separator (start of word)+ if prev_was_separator {+ score += 5;+ }+ // Bonus for consecutive matches+ if prev_matched {+ score += 3;+ }+ prev_matched = true;+ } else {+ prev_matched = false;+ }+ }++ prev_was_separator = is_separator;+ }++ // Only return score if all needle chars were found+ if needle_chars.peek().is_none() {+ score+ } else {+ 0+ }+}diff --git a/src/tui/board.rs b/src/tui/board.rsnew file mode 100644index 0000000..993574e--- /dev/null+++ b/src/tui/board.rs@@ -0,0 +1,98 @@+use crate::db::{Task, TaskStatus};++/// State for the kanban board view+#[derive(Debug)]+pub struct BoardState {+ pub tasks: Vec<Task>,+ pub selected_column: usize,+ pub selected_row: usize,+}++impl BoardState {+ pub fn new() -> Self {+ Self {+ tasks: vec![],+ selected_column: 0,+ selected_row: 0,+ }+ }++ /// Get tasks in a specific column+ pub fn tasks_in_column(&self, column: usize) -> Vec<&Task> {+ let status = TaskStatus::columns().get(column).copied();+ match status {+ Some(s) => self.tasks.iter().filter(|t| t.status == s).collect(),+ None => vec![],+ }+ }++ /// Get the currently selected task (immutable)+ pub fn selected_task(&self) -> Option<&Task> {+ let column_tasks = self.tasks_in_column(self.selected_column);+ column_tasks.get(self.selected_row).copied()+ }++ /// Get the currently selected task (mutable)+ pub fn selected_task_mut(&mut self) -> Option<&mut Task> {+ let status = TaskStatus::columns()+ .get(self.selected_column)+ .copied()?;++ let mut matching_indices: Vec<usize> = self+ .tasks+ .iter()+ .enumerate()+ .filter(|(_, t)| t.status == status)+ .map(|(i, _)| i)+ .collect();++ matching_indices.get(self.selected_row).and_then(|&idx| self.tasks.get_mut(idx))+ }++ /// Move selection left+ pub fn move_left(&mut self) {+ if self.selected_column > 0 {+ self.selected_column -= 1;+ self.clamp_row();+ }+ }++ /// Move selection right+ pub fn move_right(&mut self) {+ if self.selected_column < TaskStatus::columns().len() - 1 {+ self.selected_column += 1;+ self.clamp_row();+ }+ }++ /// Move selection up+ pub fn move_up(&mut self) {+ if self.selected_row > 0 {+ self.selected_row -= 1;+ }+ }++ /// Move selection down+ pub fn move_down(&mut self) {+ let column_count = self.tasks_in_column(self.selected_column).len();+ if self.selected_row < column_count.saturating_sub(1) {+ self.selected_row += 1;+ }+ }++ /// Ensure selected_row is valid for current column+ fn clamp_row(&mut self) {+ let column_count = self.tasks_in_column(self.selected_column).len();+ if column_count == 0 {+ self.selected_row = 0;+ } else if self.selected_row >= column_count {+ self.selected_row = column_count - 1;+ }+ }+}++impl Default for BoardState {+ fn default() -> Self {+ Self::new()+ }+}diff --git a/src/tui/input.rs b/src/tui/input.rsnew file mode 100644index 0000000..9735651--- /dev/null+++ b/src/tui/input.rs@@ -0,0 +1,16 @@+/// Input mode for the TUI+#[derive(Debug, Clone, Copy, PartialEq, Eq)]+pub enum InputMode {+ /// Normal mode - navigating the board+ Normal,+ /// Entering task title+ InputTitle,+ /// Entering task description/prompt+ InputDescription,+}++impl Default for InputMode {+ fn default() -> Self {+ Self::Normal+ }+}diff --git a/src/tui/mod.rs b/src/tui/mod.rsnew file mode 100644index 0000000..e3dd033--- /dev/null+++ b/src/tui/mod.rs@@ -0,0 +1,5 @@+mod app;+mod board;+mod input;++pub use app::App;