on main help sign in
feat: added mounts in config file
b3ac485robcholz
docs/tasks.md+1−1
@@ -45,7 +45,7 @@
458. [ ] setup cli commands.
458. [ ] setup cli commands.
46 1. [x] Organize all the params.
46 1. [x] Organize all the params.
47 2. [x] Remove old cli.
47 2. [x] Remove old cli.
48− 3. [ ] add an actual config file.
48+ 3. [x] add an actual config file.
49 4. [ ] set up the cli.
49 4. [ ] set up the cli.
509. [ ] fix ui overlap, and consistency issue.
509. [ ] fix ui overlap, and consistency issue.
5110. [ ] intensive integration test.
5110. [ ] intensive integration test.
src/config.rs+19−1
@@ -41,7 +41,7 @@ impl Default for BoxConfig {
41 Self {
41 Self {
42 cpu_count: default_cpu_count(),
42 cpu_count: default_cpu_count(),
43 ram_mb: default_ram_mb(),
43 ram_mb: default_ram_mb(),
44− mounts: Vec::new(),
44+ mounts: default_mounts(),
45 }
45 }
46 }
46 }
47}
47}
@@ -71,6 +71,24 @@ fn default_auto_shutdown_ms() -> u64 {
71 DEFAULT_AUTO_SHUTDOWN_MS
71 DEFAULT_AUTO_SHUTDOWN_MS
72}
72}
73
73
74+fn default_mounts() -> Vec<String> {
75+ let home = match std::env::var("HOME") {
76+ Ok(home) => PathBuf::from(home),
77+ Err(_) => return Vec::new(),
78+ };
79+
80+ let mut mounts = Vec::new();
81+ let codex_host = home.join(".codex");
82+ if codex_host.exists() {
83+ mounts.push("~/.codex:/usr/local/codex:read-write".to_string());
84+ }
85+ let claude_host = home.join(".claude");
86+ if claude_host.exists() {
87+ mounts.push("~/.claude:/usr/local/claude:read-write".to_string());
88+ }
89+ mounts
90+}
91+
74pub fn config_path(project_root: &Path) -> PathBuf {
92pub fn config_path(project_root: &Path) -> PathBuf {
75 project_root.join(CONFIG_FILENAME)
93 project_root.join(CONFIG_FILENAME)
76}
94}
src/vm.rs+14−12
@@ -83,7 +83,7 @@ impl DirectoryShare {
83 if parts.len() < 2 || parts.len() > 3 {
83 if parts.len() < 2 || parts.len() > 3 {
84 return Err(format!("Invalid mount spec: {spec}").into());
84 return Err(format!("Invalid mount spec: {spec}").into());
85 }
85 }
86− let host = PathBuf::from(parts[0]);
86+ let host = expand_tilde_path(parts[0]);
87 let guest = PathBuf::from(parts[1]);
87 let guest = PathBuf::from(parts[1]);
88 let read_only = if parts.len() == 3 {
88 let read_only = if parts.len() == 3 {
89 match parts[2] {
89 match parts[2] {
@@ -117,6 +117,19 @@ impl DirectoryShare {
117 }
117 }
118}
118}
119
119
120+fn expand_tilde_path(value: &str) -> PathBuf {
121+ if let Some(stripped) = value.strip_prefix("~/") {
122+ if let Ok(home) = env::var("HOME") {
123+ return PathBuf::from(home).join(stripped);
124+ }
125+ } else if value == "~" {
126+ if let Ok(home) = env::var("HOME") {
127+ return PathBuf::from(home);
128+ }
129+ }
130+ PathBuf::from(value)
131+}
132+
120pub struct VmArg {
133pub struct VmArg {
121 pub cpu_count: usize,
134 pub cpu_count: usize,
122 pub ram_bytes: u64,
135 pub ram_bytes: u64,
@@ -206,17 +219,6 @@ where
206 );
219 );
207
220
208 directory_shares.push(mise_directory_share);
221 directory_shares.push(mise_directory_share);
209−
210− // Add default shares, if they exist
211− for share in [
212− DirectoryShare::new(home.join(".codex"), "/usr/local/codex".into(), false),
213− DirectoryShare::new(home.join(".claude"), "/usr/local/claude".into(), false),
214− ]
215− .into_iter()
216− .flatten()
217− {
218− directory_shares.push(share)
219− }
220 }
222 }
221
223
222 directory_shares.extend(extra_directory_shares);
224 directory_shares.extend(extra_directory_shares);
vibebox.toml+4−1
@@ -1,7 +1,10 @@
1[box]
1[box]
2cpu_count = 2
2cpu_count = 2
3ram_mb = 2048
3ram_mb = 2048
4−mounts = []
4+mounts = [
5+ "~/.codex:/usr/local/codex:read-write",
6+ "~/.claude:/usr/local/claude:read-write",
7+]
5
8
6[supervisor]
9[supervisor]
7auto_shutdown_ms = 20000
10auto_shutdown_ms = 20000