use crate::config::{CLAUDE_ENV, Config, OPENCODE_ENV};
use crate::vm::ssh;

pub fn render(cfg: &Config) -> String {
    let mut out = String::from(
        "export PATH=\"$HOME/.local/bin:$HOME/.opencode/bin:$HOME/.cargo/bin:/usr/local/go/bin:$HOME/go/bin:$PATH\"\nexport DISPLAY=:0\nexport AGENT_BROWSER_HEADED=1\n",
    );
    for (name, secret) in [
        (CLAUDE_ENV, cfg.claude_token()),
        (OPENCODE_ENV, cfg.opencode_key()),
    ] {
        if let Some(s) = secret {
            out += &format!("export {name}={}\n", ssh::quote(&s.value));
        }
    }
    out
}
