use anyhow::Result;
use clap::Args;
use std::path::PathBuf;
#[derive(Args, Debug)]
pub struct InceptArgs {
#[arg(short, long)]
input: Option<String>,
#[arg(short, long)]
project: Option<PathBuf>,
}
pub fn run(args: InceptArgs) -> Result<()> {
eprintln!(
"warning: `path incept` is deprecated; use `path export claude --project <dir>` instead"
);
let input = match args.input {
Some(s) => s,
None => {
use std::io::Read;
let mut buf = String::new();
std::io::stdin()
.read_to_string(&mut buf)
.map_err(|e| anyhow::anyhow!("Failed to read stdin: {}", e))?;
let mut f = tempfile::NamedTempFile::new()?;
std::io::Write::write_all(&mut f, buf.as_bytes())?;
let (_file, path) = f.keep()?;
path.to_string_lossy().to_string()
}
};
let project = args
.project
.unwrap_or_else(|| std::env::current_dir().expect("cwd"));
crate::cmd_export::run(crate::cmd_export::ExportTarget::Claude {
input,
project: Some(project),
output: None,
})
}