Skip to content
Draft
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .beads/issues.jsonl

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ categories = ["command-line-utilities", "config", "development-tools"]
authors = ["d0"]

[dependencies]
harness-locate = "0.3.1"
skills-locate = "0.2.1"
harness-locate = { git = "https://github.com/edlsh/harness-barn", branch = "feat/add-crush-harness" }
skills-locate = { git = "https://github.com/edlsh/harness-barn", branch = "feat/add-crush-harness" }


# CLI
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Bridle

Unified configuration manager for AI coding assistants. Manage profiles, install skills/agents/commands, and switch configurations across Claude Code, OpenCode, Goose, and Amp.
Unified configuration manager for AI coding assistants. Manage profiles, install skills/agents/commands, and switch configurations across Claude Code, OpenCode, Goose, Amp, and Crush.

> [!WARNING]
> If you're on a version before 0.2.2, please update immediately. Older versions had a critical bug that could cause data loss during profile switches.
Expand Down Expand Up @@ -55,16 +55,16 @@ bridle install owner/repo

**Why this matters:** A skill written for Claude Code uses `~/.claude/skills/`. The same skill on OpenCode lives at `~/.config/opencode/skill/`. MCPs follow different JSON/YAML schemas. Bridle handles all these differences for you.

| Component | Claude Code | OpenCode | Goose |
| --------- | ----------- | -------- | ----- |
| Skills | `~/.claude/skills/` | `~/.config/opencode/skill/` | `~/.config/goose/skills/` |
| Agents | `~/.claude/plugins/*/agents/` | `~/.config/opencode/agent/` | — |
| Commands | `~/.claude/plugins/*/commands/` | `~/.config/opencode/command/` | — |
| MCPs | `~/.claude/.mcp.json` | `opencode.jsonc` | `config.yaml` |
| Component | Claude Code | OpenCode | Goose | Crush |
| --------- | ----------- | -------- | ----- | ----- |
| Skills | `~/.claude/skills/` | `~/.config/opencode/skill/` | `~/.config/goose/skills/` | `~/.config/crush/skills/` |
| Agents | `~/.claude/plugins/*/agents/` | `~/.config/opencode/agent/` | — | — |
| Commands | `~/.claude/plugins/*/commands/` | `~/.config/opencode/command/` | — | — |
| MCPs | `~/.claude/.mcp.json` | `opencode.jsonc` | `config.yaml` | `crush.json` |

## Core Concepts

**Harnesses** are AI coding assistants: `claude`, `opencode`, `goose`, `amp`
**Harnesses** are AI coding assistants: `claude`, `opencode`, `goose`, `amp`, `crush`

**Profiles** are saved configurations. Each harness can have multiple profiles (e.g., `work`, `personal`, `minimal`). Bridle copies the active profile's config into the harness's config directory when you switch.

Expand Down Expand Up @@ -139,6 +139,7 @@ view = "Dashboard" # Will add more later :P
| OpenCode | `~/.config/opencode/` | Full support |
| Goose | `~/.config/goose/` | Full support |
| Amp | `~/.amp/` | Experimental (ish) |
| Crush | `~/.config/crush/` | Full support (skills + MCP) |

## Honorable Mentions
- Thank you Melvyn for [pointing out my stupidity](https://x.com/melvynxdev/status/2007312037920289275?s=20)
Expand Down
4 changes: 2 additions & 2 deletions src/cli/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub enum Commands {

/// Uninstall components from a profile.
Uninstall {
/// Harness name (claude-code, opencode, goose).
/// Harness name (claude-code, opencode, goose, amp-code, crush).
harness: String,
/// Profile name.
profile: String,
Expand Down Expand Up @@ -60,7 +60,7 @@ pub enum ConfigCommands {
pub enum ProfileCommands {
/// List profiles for a harness.
List {
/// Harness name (claude-code, opencode, goose).
/// Harness name (claude-code, opencode, goose, amp-code, crush).
harness: String,
},

Expand Down
2 changes: 2 additions & 0 deletions src/cli/install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ fn parse_harness_kind(id: &str) -> Option<HarnessKind> {
"opencode" | "oc" => Some(HarnessKind::OpenCode),
"goose" => Some(HarnessKind::Goose),
"amp-code" | "amp" | "ampcode" => Some(HarnessKind::AmpCode),
"crush" => Some(HarnessKind::Crush),
_ => None,
}
}
Expand Down Expand Up @@ -404,6 +405,7 @@ fn select_targets(selected: &SelectedComponents) -> Result<Vec<InstallTarget>> {
HarnessKind::ClaudeCode,
HarnessKind::Goose,
HarnessKind::AmpCode,
HarnessKind::Crush,
];

let mut groups: Vec<TargetGroup> = Vec::new();
Expand Down
1 change: 1 addition & 0 deletions src/cli/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ fn resolve_harness(name: &str) -> Result<Harness> {
"opencode" | "oc" => HarnessKind::OpenCode,
"goose" => HarnessKind::Goose,
"amp-code" | "amp" | "ampcode" => HarnessKind::AmpCode,
"crush" => HarnessKind::Crush,
_ => return Err(Error::UnknownHarness(name.to_string())),
};
Ok(Harness::new(kind))
Expand Down
26 changes: 26 additions & 0 deletions src/config/manager/extraction/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ pub fn extract_model(harness: &dyn HarnessConfig, profile_path: &Path) -> Option
"claude-code" => extract_model_claude_code(profile_path),
"goose" => extract_model_goose(profile_path),
"amp-code" => extract_model_ampcode(profile_path),
"crush" => extract_model_crush(profile_path),
_ => None,
}
}
Expand Down Expand Up @@ -352,6 +353,31 @@ fn extract_model_ampcode(profile_path: &Path) -> Option<String> {
.map(String::from)
}

fn extract_model_crush(profile_path: &Path) -> Option<String> {
let config_path = profile_path.join("crush.json");
let content = std::fs::read_to_string(&config_path).ok()?;
let parsed: serde_json::Value = serde_json::from_str(&content).ok()?;

parsed
.get("model")
.and_then(|v| v.as_str())
.or_else(|| {
parsed
.get("models")
.and_then(|m| m.get("large"))
.and_then(|m| m.get("model"))
.and_then(|v| v.as_str())
})
.or_else(|| {
parsed
.get("models")
.and_then(|m| m.get("small"))
.and_then(|m| m.get("model"))
.and_then(|v| v.as_str())
})
.map(String::from)
}

fn dir_name_from_path(path: &Path) -> &str {
path.file_name()
.and_then(|n| n.to_str())
Expand Down
41 changes: 23 additions & 18 deletions src/config/manager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ mod tests {
};
use super::*;
use std::fs;
use std::sync::{Mutex, MutexGuard, OnceLock};
use tempfile::TempDir;

struct MockHarness {
Expand Down Expand Up @@ -348,17 +349,21 @@ mod tests {
}
}

fn setup_test_env(temp: &TempDir) {
fn setup_test_env(temp: &TempDir) -> MutexGuard<'static, ()> {
static ENV_LOCK: OnceLock<Mutex<()>> = OnceLock::new();
let lock = ENV_LOCK.get_or_init(|| Mutex::new(())).lock().unwrap();

let bridle_config_dir = temp.path().join("bridle_config");
fs::create_dir_all(&bridle_config_dir).unwrap();
// SAFETY: Tests run single-threaded (--test-threads=1), no concurrent env access
unsafe { std::env::set_var("BRIDLE_CONFIG_DIR", &bridle_config_dir) };

lock
}

#[test]
fn switch_profile_preserves_edits() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -431,7 +436,7 @@ mod tests {
#[test]
fn switch_profile_restores_mcp_config() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
let mcp_file = temp.path().join(".mcp.json");
Expand Down Expand Up @@ -468,7 +473,7 @@ mod tests {
#[test]
fn switch_preserves_unknown_files() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -592,7 +597,7 @@ mod tests {
#[test]
fn switch_saves_new_directories_to_old_profile() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -629,7 +634,7 @@ mod tests {
#[test]
fn deep_nesting_survives_multiple_round_trips() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -676,7 +681,7 @@ mod tests {
#[test]
fn wide_directory_structure_preserved() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -799,7 +804,7 @@ mod tests {
#[test]
fn switch_profile_does_not_leak_skills_to_other_profiles() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -868,7 +873,7 @@ mod tests {
#[test]
fn switch_to_empty_profile_clears_harness_resources() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -926,7 +931,7 @@ mod tests {
#[test]
fn switch_profile_does_not_leak_agents() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -984,7 +989,7 @@ mod tests {
#[test]
fn switch_profile_does_not_leak_commands() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -1038,7 +1043,7 @@ mod tests {
#[test]
fn switch_profile_does_not_leak_multiple_resource_types() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -1123,7 +1128,7 @@ mod tests {
#[test]
fn switch_profile_isolation_opencode_style() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -1180,7 +1185,7 @@ mod tests {
#[test]
fn switch_profile_isolation_claude_style() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -1233,7 +1238,7 @@ mod tests {
#[test]
fn switch_profile_isolation_goose_style() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
fs::create_dir_all(&live_config).unwrap();
Expand Down Expand Up @@ -1284,7 +1289,7 @@ mod tests {
#[test]
fn comprehensive_resource_leak_verification() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
let mcp_config = temp.path().join("mcp.json");
Expand Down Expand Up @@ -1484,7 +1489,7 @@ mod tests {
#[test]
fn mcp_config_does_not_leak_between_profiles() {
let temp = TempDir::new().unwrap();
setup_test_env(&temp);
let _env_lock = setup_test_env(&temp);
let profiles_dir = temp.path().join("profiles");
let live_config = temp.path().join("live_config");
let mcp_config = temp.path().join("mcp.json");
Expand Down
2 changes: 1 addition & 1 deletion src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ pub enum Error {
InvalidProfileName(String),

/// Unknown harness name.
#[error("unknown harness: {0}\nValid options: claude-code, opencode, goose, amp-code")]
#[error("unknown harness: {0}\nValid options: claude-code, opencode, goose, amp-code, crush")]
UnknownHarness(String),

/// Command failed.
Expand Down
1 change: 1 addition & 0 deletions src/harness/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ impl HarnessConfig for harness_locate::Harness {
harness_locate::HarnessKind::OpenCode => "opencode",
harness_locate::HarnessKind::Goose => "goose",
harness_locate::HarnessKind::AmpCode => "amp-code",
harness_locate::HarnessKind::Crush => "crush",
_ => "unknown",
}
}
Expand Down
1 change: 1 addition & 0 deletions src/install/installer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ fn parse_harness_kind(id: &str) -> Option<HarnessKind> {
"opencode" | "oc" => Some(HarnessKind::OpenCode),
"goose" => Some(HarnessKind::Goose),
"amp-code" | "amp" | "ampcode" => Some(HarnessKind::AmpCode),
"crush" => Some(HarnessKind::Crush),
_ => None,
}
}
Expand Down
1 change: 1 addition & 0 deletions src/install/mcp_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ fn get_mcp_key(kind: HarnessKind) -> &'static str {
match kind {
HarnessKind::ClaudeCode => "mcpServers",
HarnessKind::OpenCode => "mcp",
HarnessKind::Crush => "mcp",
HarnessKind::Goose => "extensions",
HarnessKind::AmpCode => "amp.mcpServers",
_ => "mcpServers",
Expand Down
Loading