Expand description
Starlark policy evaluator for Clash.
Evaluates .star policy files and compiles them to JSON PolicyDocument format.
This crate has no dependency on the clash crate — it outputs a JSON string
that the existing compile pipeline consumes.
Re-exports§
pub use test_support::TestModule;pub use test_support::eval_policy_source_for_test;pub use test_support::load_starlark_source_for_test;
Modules§
- codegen
- Starlark code generation and round-trip editing.
- eval_
context - Evaluation context — accumulates registrations from top-level calls.
- settings_
compat - Classification logic for converting Claude Code permission strings into Starlark policy dicts.
- stdlib
- Embedded prebuilt Starlark sandbox files.
- test_
support - Test helpers for evaluating Starlark sources outside the full
policy()/sandbox()registration pipeline.
Macros§
- kwargs
- Build a kwargs vec with automatic
Exprwrapping viaInto<Expr>. - match_
tree - Build a
when({...})expression from a nested tree literal.
Structs§
- Eval
Output - Output from evaluating a
.starpolicy file. - Symbol
Span - A top-level symbol definition: name + (0-indexed) line/column span.
Functions§
- evaluate
- Evaluate a Starlark policy source and return a JSON policy document.
- parse_
source - Parse a Starlark source file and return the AST, or a
starlark::Erroron syntax failure. - top_
level_ symbols - Walk the top-level statements of a parsed AST and return every top-level assignment
target name and
defname together with their source spans.