cli: spawn pods through insomnia pod

This commit is contained in:
2026-05-31 14:20:00 +09:00
parent de3f64f41d
commit 4f622b8e32
12 changed files with 212 additions and 43 deletions
+1 -1
View File
@@ -65,7 +65,7 @@ enum Mode {
profile: Option<String>,
},
/// `insomnia <name>` / `insomnia --pod <name>`: attach to a live Pod by name if
/// possible; otherwise launch `insomnia-pod --pod <name>` so the pod process
/// possible; otherwise launch the Pod runtime command with `--pod <name>` so it
/// resumes from name-keyed state or creates a fresh same-name Pod.
PodName {
pod_name: String,
+2 -2
View File
@@ -2,7 +2,7 @@
//!
//! Reads live Pod allocations from the runtime registry and stopped Pod state
//! from the pod-store name-keyed metadata. Picking a live row attaches to
//! its socket; picking a stopped row restores via `insomnia-pod --pod <name>`.
//! its socket; picking a stopped row restores via the Pod runtime command.
use std::io;
use std::path::PathBuf;
@@ -65,7 +65,7 @@ impl From<session_store::StoreError> for PickerError {
pub enum PickerOutcome {
/// User picked a Pod. `socket_override` is set for live rows when the
/// runtime registry knows the exact socket path; stopped rows leave it
/// empty so the caller restores with `insomnia-pod --pod <name>`.
/// empty so the caller restores by spawning the Pod runtime command.
Picked {
pod_name: String,
socket_override: Option<PathBuf>,
+4 -4
View File
@@ -3,7 +3,7 @@
//! Rendered at the user's current cursor position when `insomnia` is invoked
//! with no positional argument. Discovers `.insomnia/profiles.toml` profile
//! choices plus bundled profiles, defaults to the builtin profile, prompts for
//! the Pod's name, and on confirmation launches the `insomnia-pod` binary as an
//! the Pod's name, and on confirmation launches the Pod runtime command as an
//! independent process. Once the process reports its socket via the
//! `INSOMNIA-READY` stderr line, the dialog hands control back so main can
//! switch the terminal to alternate-screen mode.
@@ -72,7 +72,7 @@ type InlineTerminal = Terminal<CrosstermBackend<io::Stdout>>;
/// Source session for a resume run. `None` = fresh spawn (current
/// behaviour); `Some(id)` swaps the dialog into "Resume Pod" mode and
/// passes `--session <id>` to the spawned `insomnia-pod` child.
/// passes `--session <id>` to the spawned Pod runtime child.
pub async fn run(
resume_from: Option<SegmentId>,
profile: Option<String>,
@@ -162,7 +162,7 @@ pub async fn run(
}
}
/// Launch `insomnia-pod --pod <name>` without opening the name dialog. The child Pod
/// Launch a Pod runtime command with `--pod <name>` without opening the name dialog. The child Pod
/// resolves persisted Pod metadata if present, or creates a fresh same-name Pod
/// from the default profile.
pub async fn run_pod_name(pod_name: String) -> Result<SpawnOutcome, SpawnError> {
@@ -415,7 +415,7 @@ struct Form {
/// When true, launch the child with `--pod <name>` so the pod process
/// resolves name-keyed state before falling back to fresh creation.
resume_by_pod_name: bool,
/// Optional profile choices passed to `insomnia-pod --profile` for
/// Optional profile choices passed with `--profile` for
/// fresh spawns. This is not used for resume/attach flows because those must
/// restore Pod state rather than re-evaluate a profile source.
profile_choices: Vec<ProfileChoice>,