8.4 KiB
8.4 KiB
Created
Created by tickets.sh create.
Plan
Read-only investigator: insomnia-cli-owner-investigator-20260531
Classification: implementation-ready
Conclusion:
- Proceed with this ticket as one implementation ticket, but implement in ordered internal phases: move
PodRuntimeCommandtoclient, maketuilibrary-callable, move product CLI/binary ownership toinsomnia, then update packaging/docs.
Current code/dependency map:
crates/tuicurrently owns the product binary target:crates/tui/Cargo.tomlhas[[bin]] name = "insomnia" path = "src/main.rs".crates/tui/src/main.rsowns top-level CLI parsing,insomnia pod ...dispatch,insomnia memory lint, and TUI launch.
crates/insomniacurrently has no binary and mostly ownsPodRuntimeCommandonly.crates/podis already library-only and exposespod::entrypoint::run_cli_from.client,pod, and tests depend oninsomniaonly forPodRuntimeCommand, creating the wrong dependency direction for the desired architecture.package.nixbuilds-p tuieven though the installed command isinsomnia.
Recommended architecture:
insomnia -> tui
insomnia -> pod
insomnia -> client
tui -> client
pod -> client
client -> no insomnia
pod -> no insomnia
tui -> no insomnia
Implementation plan:
- Move
PodRuntimeCommandfrominsomniatoclient.- Prefer
client::runtime_commandwithpub usefromclient. - Update
client,pod, and tests to useclient::PodRuntimeCommand. - Remove
insomniadependency from lower crates.
- Prefer
- Make
tuia library implementation crate.- Add
crates/tui/src/lib.rs. - Move TUI module declarations and TUI launch code behind public library API.
- Expose narrow API such as
LaunchOptions,LaunchMode,launch(...). - Keep terminal setup/teardown in
tuibecause it owns terminal behavior. - Remove product CLI parsing and
pod/memory lintdispatch fromtui.
- Add
- Make
insomniaown product CLI/binary.- Add
crates/insomnia/src/main.rs. - Move top-level CLI parser/dispatch from
tuitoinsomnia. - Route
podtopod::entrypoint::run_cli_from("insomnia pod", args). - Route
memory lintfrominsomnia, nottui. - Route normal TUI modes to
tui::launch(...)with a typed runtime command.
- Add
- Update packaging/docs.
- Remove
[[bin]] name = "insomnia"fromtui. - Make
package.nixbuild-p insomnia. - Update active docs/dev commands from
cargo run -p tui -- ...tocargo run -p insomnia -- ....
- Remove
Important constraints:
- Do not introduce
pod -> insomniaortui -> insomnia. - Do not keep compatibility for
cargo run -p tui -- .... - Do not reintroduce
insomnia-pod,INSOMNIA_POD_COMMAND, or the separateINSOMNIA_POD_RUNTIME_COMMAND; that dev override is tracked bydev-pod-runtime-command-env. - Do not change Pod protocol/profile/manifest semantics.
- Avoid broad TUI refactoring beyond making the crate library-callable.
Critical risks:
tui/src/main.rsis large and mixes CLI, terminal lifecycle, event loop, key handling, and tests. Keep changes mechanical and avoid unrelated module cleanup.- Parser tests should move to
insomnia; TUI behavior tests should remain withtui. memory_lintis headless product CLI code and should not remain routed through TUI.--helpbehavior needs explicit handling because the old parser mostly ignored unknown flags.
Validation:
cargo fmt --checkcargo check -p client -p pod -p tui -p insomniacargo test -p clientcargo test -p podcargo test -p tuicargo test -p insomnia- CLI smoke:
cargo run -p insomnia -- --helpcargo run -p insomnia -- pod --helpcargo run -p insomnia -- memory lint --helpcargo run -p insomnia -- --session not-a-uuid
- Dependency ownership checks:
cargo tree -p client -e no-dev --depth 1cargo tree -p pod -e no-dev --depth 1cargo tree -p tui -e no-dev --depth 1cargo tree -p insomnia -e no-dev --depth 1
- If packaging changed:
nix build .#insomnia./result/bin/insomnia pod --helptest -x ./result/bin/insomniatest ! -e ./result/bin/insomnia-pod
./tickets.sh doctorgit diff --checkrg "cargo run -p tui" docs README.md crates package.nix flake.nix
Review: approve
External reviewer: insomnia-cli-owner-reviewer-20260531
Reviewed implementation commits:
22d974a(cli: move product entrypoint to insomnia)37281b6(cli: reject resume with pod selection) Verdict: approve
Summary:
- Product binary and top-level CLI dispatch moved from the
tuipackage to theinsomniapackage. tuiis now a library implementation crate and no longer ownspod/memory linttop-level dispatch.PodRuntimeCommandmoved toclient, removing the wrong lower-crate dependency on the product CLI crate.podremains library-only and does not depend oninsomnia.- Packaging now builds package
insomniafor the installedbin/insomniaoutput.
Initial review blocker:
--resumecombined with--podor positional Pod name selection initially stopped erroring.
Fix:
- Commit
37281b6restored mutual exclusion:insomnia -r --pod agenterrors.insomnia --pod agent -rerrors.insomnia -r agenterrors.insomnia --multi --pod agentreports--multi and --pod are mutually exclusive.
Requirements mapping:
insomniaowns binary target and top-level CLI dispatch.tui,pod, andclientdo not depend oninsomnia.tuidoes not depend onpod.insomnia pod ...,insomnia memory lint ..., and normal TUI launch modes are preserved.- No
insomnia-pod,INSOMNIA_POD_COMMAND, orINSOMNIA_POD_RUNTIME_COMMANDwas introduced. - No Pod protocol/profile/manifest semantic change was found.
Blockers: none.
Validation adequacy:
- Coder ran Rust tests/checks, CLI smoke, dependency ownership checks, Nix build/install smoke, doctor, diff-check, and active
cargo run -p tuigrep. - Reviewer reran focused parser tests and manually confirmed conflict diagnostics through the built binary after the fix.
Closed
Moved product CLI/binary ownership from tui to insomnia.
Implementation:
- Moved
PodRuntimeCommandfrom the transitionalinsomniahelper role intoclient, so lower crates no longer depend on the product CLI crate. - Made
tuia library implementation crate and exposed launch APIs for already-parsed modes/options. - Added the
insomniapackage binary entrypoint and moved top-level CLI parsing/dispatch there. - Routed
insomnia pod ...throughpod::entrypointfrom theinsomniacrate. - Routed
insomnia memory lint ...from theinsomniacrate. - Kept normal TUI launch behavior for resume, multi-Pod dashboard, Pod name,
--pod, and--sessionmodes. - Updated packaging so
package.nixbuilds packageinsomniaand still exposes onlybin/insomnia. - Updated active development/docs references away from
cargo run -p tui -- ....
Review:
- External reviewer
insomnia-cli-owner-reviewer-20260531initially requested changes for a parser regression around--resumecombined with Pod selection. - Fix commit
37281b6restored mutual exclusion for-r --pod,--pod -r, and-r <podname>, and improved--multi --poddiagnostics. - Reviewer approved after re-review.
Validation after merge:
cargo fmt --checkcargo check -p client -p pod -p tui -p insomniacargo test -p clientcargo test -p podcargo test -p tuicargo test -p insomniacargo run -p insomnia -- --helpcargo run -p insomnia -- pod --helpcargo run -p insomnia -- memory lint --help- invalid/conflict CLI smoke tests for
--session not-a-uuid,-r --pod,--pod -r, and-r <podname> - dependency checks confirming
client,pod, andtuido not depend oninsomnia, andtuidoes not depend onpod nix build .#insomniatest -x ./result/bin/insomniatest ! -e ./result/bin/insomnia-pod./result/bin/insomnia pod --help./tickets.sh doctorgit diff --checkrg "cargo run -p tui" docs README.md crates package.nix flake.nix || trueproduced no active hits.
Notes:
- Validation emitted pre-existing dead-code warnings in
llm-worker/tuibut passed.