diff --git a/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/artifacts/.gitkeep b/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/artifacts/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/item.md b/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/item.md new file mode 100644 index 00000000..5791a5c2 --- /dev/null +++ b/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/item.md @@ -0,0 +1,55 @@ +--- +id: 20260531-045034-spawn-through-insomnia-pod-subcommand +slug: spawn-through-insomnia-pod-subcommand +title: CLI: spawn Pods through insomnia pod runtime +status: open +kind: task +priority: P2 +labels: [cli, pod, client, nix] +created_at: 2026-05-31T04:50:34Z +updated_at: 2026-05-31T04:51:14Z +assignee: null +legacy_ticket: null +--- + +## Background + +Parent/umbrella ticket: `single-binary-insomnia-cli`. + +`insomnia-pod-subcommand-runtime` added `insomnia pod ...` as a Pod runtime entrypoint while keeping the old `insomnia-pod` binary as a temporary thin wrapper. Internal Pod spawning and restore paths still default to invoking `insomnia-pod` as an executable-only command. + +The next single-binary migration step is to make internal callers able to spawn Pod runtime processes via `program + prefix_args`, and then switch the default runtime command to the current `insomnia` executable with `pod` as the prefix argument. + +## Requirements + +- Introduce a typed Pod runtime command representation instead of shell-string parsing. + - Example shape: `{ program: PathBuf, prefix_args: Vec }`. + - The default command from the `insomnia` binary should be `current_exe()` + `pod` prefix args. + - Preserve an explicit override mechanism for development/debugging, but do not parse arbitrary shell command strings. +- Switch internal spawn/restore paths that currently call `insomnia-pod` to use the typed runtime command: + - TUI/create/restore paths in `client`/`tui` if applicable; + - `SpawnPod` child creation; + - `RestorePod` / discovery restore flows. +- Preserve detached process behavior and the `INSOMNIA-READY` stderr handshake. +- Preserve devshell/Nix behavior enough that local development still works. + - If `insomnia-pod` is still needed for devshell wrapping in this step, document exactly why and leave removal to the next ticket. +- Keep `insomnia-pod` installed output/package removal out of this ticket unless the migration is already complete and validation is straightforward. +- Do not rename the `tui` package/crate. +- Do not merge Pod controller into the TUI process. + +## Non-goals + +- Removing `insomnia-pod` from Nix/package outputs as the primary goal. That is the next cleanup once runtime spawning no longer depends on it. +- Changing Pod runtime flags or profile/manifest semantics. +- Changing Pod protocol. +- Large CLI UX redesign. + +## Acceptance criteria + +- Internal default Pod runtime spawn/restore commands use `insomnia pod ...` through a typed `program + prefix_args` representation. +- `INSOMNIA_POD_COMMAND` or any equivalent override remains safe and documented, or is replaced by a typed override with clear behavior. +- Existing Pod spawning/restore tests pass, with focused tests proving prefix args are included in the spawned command. +- `insomnia pod --help` and existing `insomnia-pod --help` continue to work while the temporary wrapper remains. +- `SpawnPod` and `RestorePod` behavior is unchanged from the user/tool perspective. +- Follow-up for removing `insomnia-pod` packaging is recorded if not completed here. +- `cargo fmt --check`, focused client/pod/tui tests, `cargo check -p client -p pod -p tui`, `./tickets.sh doctor`, and `git diff --check` pass. diff --git a/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/thread.md b/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/thread.md new file mode 100644 index 00000000..810284ce --- /dev/null +++ b/work-items/open/20260531-045034-spawn-through-insomnia-pod-subcommand/thread.md @@ -0,0 +1,23 @@ + + +## Created + +Created by tickets.sh create. + +--- + + + +## Plan + +Implementation plan: + +1. Find all internal `insomnia-pod` executable resolution paths (`client::spawn_pod`, `SpawnPod`, `RestorePod`/discovery, tests/dev helpers). +2. Introduce a typed runtime command structure with `program` and `prefix_args`, avoiding shell-string parsing. +3. Make the default runtime command for callers running from `insomnia` use `current_exe()` + `pod` prefix args. +4. Preserve explicit override behavior for development/debugging; if the existing env var cannot safely support prefix args, keep it as executable-only and document that it bypasses the unified default. +5. Update tests to assert prefix args are included and existing spawn/restore behavior is unchanged. +6. Leave Nix/package removal of `insomnia-pod` to a follow-up unless this change proves complete and low-risk. + + +---