Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
6 changes: 1 addition & 5 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,7 @@
* *clash-policy* Policy language: parsing, IR, compilation, and evaluation (extracted from `clash` to break circular dep with `clash-lsp`)
* *clash_starlark* Starlark policy evaluator — compiles `.star` files to JSON policy format
* *clash-plugin* Claude Code plugin (hooks.json, .claude-plugin definitions)
* *clash-gemini-ext* Gemini CLI extension package
* *clash-codex* Codex CLI hook configuration
* *clash-amazonq* Amazon Q CLI agent hook configuration
* *clash-opencode* OpenCode TypeScript plugin
* *clash-copilot* Copilot CLI hook configuration
* *clash/src/agent_templates* Embedded per-agent install assets (Gemini extension, Codex/Amazon Q/Copilot hooks, OpenCode plugin) — shipped inside the `clash` binary and written out by `clash init --agent <name>`
* *clash_notify* Helper crate for extended notifications outside of the terminal
* *claude_settings* Helper crate for interacting with a user's ".claude" settings directories
* *clash-brush-parser* Shell command parser
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
13 changes: 6 additions & 7 deletions clash/src/cmd/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,12 @@ const HOOK_CMD_PREFIX: &str = "clash hook";

/// Embedded agent plugin files — compiled into the binary so `clash init --agent <name>`
/// can install them without needing the source repo.
const OPENCODE_PLUGIN_TS: &str = include_str!("../../clash-opencode/plugin.ts");
const COPILOT_HOOKS_JSON: &str =
include_str!("../../clash-copilot/.github/hooks/pre-tool-use.json");
const CODEX_HOOKS_TOML: &str = include_str!("../../clash-codex/hooks.toml");
const AMAZONQ_AGENT_JSON: &str = include_str!("../../clash-amazonq/agent.json");
const GEMINI_EXTENSION_JSON: &str = include_str!("../../clash-gemini-ext/gemini-extension.json");
const GEMINI_HOOKS_JSON: &str = include_str!("../../clash-gemini-ext/hooks/hooks.json");
const OPENCODE_PLUGIN_TS: &str = include_str!("../agent_templates/opencode/plugin.ts");
const COPILOT_HOOKS_JSON: &str = include_str!("../agent_templates/copilot/pre-tool-use.json");
const CODEX_HOOKS_TOML: &str = include_str!("../agent_templates/codex/hooks.toml");
const AMAZONQ_AGENT_JSON: &str = include_str!("../agent_templates/amazonq/agent.json");
const GEMINI_EXTENSION_JSON: &str = include_str!("../agent_templates/gemini/gemini-extension.json");
const GEMINI_HOOKS_JSON: &str = include_str!("../agent_templates/gemini/hooks.json");

/// Initialize clash at the chosen scope.
///
Expand Down
2 changes: 1 addition & 1 deletion clash/src/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ pub fn handle_session_start(
/// This text is returned as `additional_context` in the SessionStart hook response,
/// giving Claude the knowledge it needs to use clash skills and manage policies.
fn clash_session_context() -> &'static str {
include_str!("../docs/session-context.md")
include_str!("session-context.md")
}

/// Check sandbox support, init session, and symlink — shared by both paths.
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions docs/multi-agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ Clash supports 6 coding agents: Claude Code, Gemini CLI, Codex CLI, Amazon Q CLI

## Supported Agents

| Agent | Hook Command | Extension Package |
|-------|-------------|-------------------|
| Agent | Hook Command | Install Assets |
|-------|-------------|----------------|
| Claude Code | `clash hook pre-tool-use` (default) | `clash-plugin/` |
| Gemini CLI | `clash hook --agent gemini pre-tool-use` | `clash-gemini-ext/` |
| Codex CLI | `clash hook --agent codex pre-tool-use` | `clash-codex/` |
| Amazon Q CLI | `clash hook --agent amazonq pre-tool-use` | `clash-amazonq/` |
| OpenCode | `clash hook --agent opencode pre-tool-use` | `clash-opencode/` |
| Copilot CLI | `clash hook --agent copilot pre-tool-use` | `clash-copilot/` |
| Gemini CLI | `clash hook --agent gemini pre-tool-use` | `clash/src/agent_templates/gemini/` |
| Codex CLI | `clash hook --agent codex pre-tool-use` | `clash/src/agent_templates/codex/` |
| Amazon Q CLI | `clash hook --agent amazonq pre-tool-use` | `clash/src/agent_templates/amazonq/` |
| OpenCode | `clash hook --agent opencode pre-tool-use` | `clash/src/agent_templates/opencode/` |
| Copilot CLI | `clash hook --agent copilot pre-tool-use` | `clash/src/agent_templates/copilot/` |

## Setup

Expand Down
Loading