# Package: dirigent_zed

Zed editor integration for Dirigent -- detection, agent discovery, binary resolution.

## Quick Facts
- **Type**: Library
- **Main Entry**: src/lib.rs
- **Dependencies**: dirigent_config, dirs, serde, serde_json, thiserror, tracing
- **Status**: Initial implementation

## Purpose

Detects Zed editor installations on the current system, discovers configured
ACP agents from Zed's `settings.json`, and resolves downloaded binary paths
from the Zed data directory.

## Key Types

- `ZedChannel` -- Release channel enum (Stable, Preview, Nightly, Dev)
- `ZedAgent` -- Discovered agent with name, type, binary path, env overrides
- `AgentServerType` -- Registry, Custom, or Extension
- `ZedInstallation` -- Detected installation with channel, paths, and agents

## Module Organization

- **`paths.rs`** -- Platform path resolution for Zed config/data directories
- **`agents.rs`** -- Agent discovery from settings.json, JSONC stripping, binary resolution
- **`detection.rs`** -- High-level installation detection combining paths and agents

## Platform Paths

| Platform | Config Dir | Data Dir |
|----------|-----------|----------|
| Linux | `$XDG_CONFIG_HOME/zed` | `$XDG_DATA_HOME/zed` |
| macOS | `~/.config/zed` | `~/Library/Application Support/Zed` |
| Windows | `%APPDATA%\Zed` | `%LOCALAPPDATA%\Zed` |

## Usage

```rust
let installations = dirigent_zed::detect_installations();
for inst in &installations {
    for agent in &inst.agents {
        if let Some(ref binary) = agent.binary_path {
            println!("{}: {}", agent.name, binary.display());
        }
    }
}
```

## Testing

```bash
cargo test -p dirigent_zed
```

## Related Packages

- **dirigent_config** -- Dirigent's own path resolution (dependency)
- **dirigent_core** -- Will consume this crate for Zed connector integration (future)

## Research

See `docs/research/zed-integration.md` for detailed platform paths and detection strategies.
