on main help sign in
feat: added mounts in config file
commitb3ac485ccf9325e1cf64649b727a0bdfed7613a5 authorrobcholz <84130577+robcholz@users.noreply.github.com> dateSat 7 Feb 2026, 15:41 (8 months ago) parent57798d2
4 files changed+38−15
docs/tasks.md+1−1 src/config.rs+19−1 src/vm.rs+14−12 vibebox.toml+4−1
docs/tasks.md+1−1
@@ -45,7 +45,7 @@
45458. [ ] setup cli commands.
4646 1. [x] Organize all the params.
4747 2. [x] Remove old cli.
48− 3. [ ] add an actual config file.
48+ 3. [x] add an actual config file.
4949 4. [ ] set up the cli.
50509. [ ] fix ui overlap, and consistency issue.
515110. [ ] intensive integration test.
src/config.rs+19−1
@@ -41,7 +41,7 @@ impl Default for BoxConfig {
4141 Self {
4242 cpu_count: default_cpu_count(),
4343 ram_mb: default_ram_mb(),
44− mounts: Vec::new(),
44+ mounts: default_mounts(),
4545 }
4646 }
4747}
@@ -71,6 +71,24 @@ fn default_auto_shutdown_ms() -> u64 {
7171 DEFAULT_AUTO_SHUTDOWN_MS
7272}
7373
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+
7492pub fn config_path(project_root: &Path) -> PathBuf {
7593 project_root.join(CONFIG_FILENAME)
7694}
src/vm.rs+14−12
@@ -83,7 +83,7 @@ impl DirectoryShare {
8383 if parts.len() < 2 || parts.len() > 3 {
8484 return Err(format!("Invalid mount spec: {spec}").into());
8585 }
86− let host = PathBuf::from(parts[0]);
86+ let host = expand_tilde_path(parts[0]);
8787 let guest = PathBuf::from(parts[1]);
8888 let read_only = if parts.len() == 3 {
8989 match parts[2] {
@@ -117,6 +117,19 @@ impl DirectoryShare {
117117 }
118118}
119119
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+
120133pub struct VmArg {
121134 pub cpu_count: usize,
122135 pub ram_bytes: u64,
@@ -206,17 +219,6 @@ where
206219 );
207220
208221 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− }
220222 }
221223
222224 directory_shares.extend(extra_directory_shares);
vibebox.toml+4−1
@@ -1,7 +1,10 @@
11[box]
22cpu_count = 2
33ram_mb = 2048
4−mounts = []
4+mounts = [
5+ "~/.codex:/usr/local/codex:read-write",
6+ "~/.claude:/usr/local/claude:read-write",
7+]
58
69[supervisor]
710auto_shutdown_ms = 20000