Embed Dockerfile and compose.yml in the binary
Uses include_str! at compile time, writes to XDG cache at runtime.
Binary is now self-contained — no source tree needed at install location.

Assisted-by: Claude Opus 4.6 via pi
change wloyplxowyzutnouymyoworurnvnoyoq
commit f211f6d80477565233cc33a1e5d37cd19d59bde4
author Alpha Chen <alpha@kejadlen.dev>
date
parent xrtnxnzw
diff --git a/src/main.rs b/src/main.rs
index fe88fb6..69ed2a4 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,3 +1,4 @@
+use std::fs;
 use std::path::PathBuf;
 use std::process::{Command, ExitCode, Stdio};
 
@@ -6,6 +7,9 @@ use color_eyre::eyre::{Context, Result, bail};
 use tracing::{error, info};
 use tracing_subscriber::{EnvFilter, fmt, prelude::*};
 
+const COMPOSE_YML: &str = include_str!("../compose.yml");
+const DOCKERFILE: &str = include_str!("../Dockerfile");
+
 #[derive(Parser)]
 #[command(about = "Run a pi coding agent in a containerized environment")]
 struct Cli {
@@ -45,7 +49,16 @@ fn run() -> Result<()> {
     info!(data = %pi_data_dir.display(), "pi data directory");
     info!(workspace = %workspace.display(), "starting agent");
 
-    let compose_file = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("compose.yml");
+    // Write embedded files to XDG cache so docker compose can find them
+    let cache_dir = xdg
+        .create_cache_directory("")
+        .wrap_err("failed to create cache directory")?;
+    fs::write(cache_dir.join("compose.yml"), COMPOSE_YML)
+        .wrap_err("failed to write compose.yml")?;
+    fs::write(cache_dir.join("Dockerfile"), DOCKERFILE)
+        .wrap_err("failed to write Dockerfile")?;
+
+    let compose_file = cache_dir.join("compose.yml");
 
     let docker_compose = |args: &[&str]| -> Result<Command> {
         let mut cmd = Command::new("docker");