Import sesssions (#9474)

Co-authored-by: Douwe Osinga <douwe@squareup.com>
This commit is contained in:
Douwe Osinga
2026-06-02 16:35:57 -04:00
committed by GitHub
parent cd12199604
commit 003252fb52
12 changed files with 1411 additions and 14 deletions
+6 -2
View File
@@ -559,9 +559,13 @@ enum SessionCommand {
)]
relays: Vec<String>,
},
#[command(about = "Import a session from JSON or an encrypted Nostr share link")]
#[command(
about = "Import a session from JSON, a Claude Code / Codex / Pi .jsonl, or an encrypted Nostr share link"
)]
Import {
#[arg(help = "Path to a JSON session export, or a goose://sessions/nostr share link")]
#[arg(
help = "Path to a goose session export, a Claude Code, Codex, or Pi .jsonl transcript, or a goose://sessions/nostr share link"
)]
input: String,
#[arg(long = "nostr", help = "Treat input as an encrypted Nostr share link")]
+9
View File
@@ -300,6 +300,15 @@ pub async fn handle_session_import(input: String, nostr: bool) -> Result<()> {
.with_context(|| format!("Failed to read session import file: {input}"))?
};
let format = goose::session::import_formats::detect_format(&json);
let label = match format {
goose::session::import_formats::ImportFormat::Goose => "goose",
goose::session::import_formats::ImportFormat::ClaudeCode => "Claude Code",
goose::session::import_formats::ImportFormat::Codex => "Codex",
goose::session::import_formats::ImportFormat::Pi => "Pi",
};
println!("Detected format: {}", label);
let session_manager = SessionManager::instance();
let session = session_manager
.import_session(&json, Some(SessionType::User))