Skip to main content

cc_switch_lib/cli/commands/
internal.rs

1use std::path::PathBuf;
2
3use clap::Subcommand;
4
5use crate::error::AppError;
6use crate::services::ProviderService;
7use crate::store::AppState;
8
9#[derive(Subcommand)]
10pub enum InternalCommand {
11    /// Persist Codex files written during `cc-switch start codex`.
12    CaptureCodexTemp {
13        provider_id: String,
14        codex_home: PathBuf,
15    },
16}
17
18pub fn execute(cmd: InternalCommand) -> Result<(), AppError> {
19    match cmd {
20        InternalCommand::CaptureCodexTemp {
21            provider_id,
22            codex_home,
23        } => {
24            let state = AppState::try_new()?;
25            ProviderService::capture_codex_temp_launch_snapshot(&state, &provider_id, &codex_home)
26        }
27    }
28}