Skip to main content

Crate clash_starlark

Crate clash_starlark 

Source
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 Expr wrapping via Into<Expr>.
match_tree
Build a when({...}) expression from a nested tree literal.

Structs§

EvalOutput
Output from evaluating a .star policy file.
SymbolSpan
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::Error on syntax failure.
top_level_symbols
Walk the top-level statements of a parsed AST and return every top-level assignment target name and def name together with their source spans.