1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//! Clash library — permission enforcement for Claude Code.
//!
//! This crate provides the core building blocks for evaluating tool permissions,
//! enforcing sandbox policies, and integrating with Claude Code's hook system.
//!
//! # Modules
//!
//! - [`hooks`] — Input/output types for the Claude Code hook protocol.
//! - [`permissions`] — Policy-based permission evaluation for tool invocations.
//! - [`policy`] — Policy language, compilation, and evaluation engine (re-exported from `clash-policy`).
//! - [`handlers`] — Pre-built hook handlers that wire permissions, notifications,
//! and session validation together.
//! - [`settings`] — Loading and resolving clash configuration and policy files.
//! - [`policy_loader`] — Policy file discovery, Starlark evaluation, and compilation.
//! - [`sandbox`] — Platform-specific (Linux/macOS) sandbox enforcement backends.
//! - [`audit`] — Structured audit logging of policy decisions.
//! - [`notifications`] — Desktop notifications and Zulip integration.
//!
//! # Example
//!
//! ```no_run
//! use clash::hooks::ToolUseHookInput;
//! use clash::permissions::check_permission;
//! use clash::settings::ClashSettings;
//!
//! let settings = ClashSettings::load_or_create().unwrap();
//! let input = ToolUseHookInput::from_reader(std::io::stdin().lock()).unwrap();
//! let output = check_permission(&input, &settings).unwrap();
//! output.write_stdout().unwrap();
//! ```
pub use clash_policy as policy;