MCPcopy Index your code
hub / github.com/cloudflare/saffron

github.com/cloudflare/saffron @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
257 symbols 494 edges 19 files 38 documented · 15% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

saffron is a cron parser used as part of the backend for Cron Triggers in Cloudflare Workers. It provides APIs for the complete stack, allowing us to use the same parser everywhere. It's made in two parts:

  1. The parser, which is responsible for reading cron expressions into an easy to understand format, which can be simplified with the compiler, or described with CronExpr::describe.

  2. The compiler, which simplifies expressions into their most compact form. This compact form can check if a chrono date time is contained in a given expression in constant time, no matter the size of the original expression. It can also be used to get future times that match efficiently as an iterator.

The project itself is divided into 4 Rust workspace members:

  1. saffron - the parser itself
  2. saffron-c - the C API used internally by the Workers API
  3. saffron-web - the web API used on the dash in the browser
  4. saffron-worker - the Rust Worker which provides the validate/describe endpoint in the dash API on the edge as a fallback if WASM can't be used in the browser

Extension points exported contracts — how you extend this code

ExprValue (Interface)
A trait implemented for expression values that defines a MIN value and a MAX value. [8 implementers]
saffron/src/parse.rs
Sealed (Interface)
(no doc) [8 implementers]
saffron/src/lib.rs
TimePattern (Interface)
(no doc) [5 implementers]
saffron/src/lib.rs
Language (Interface)
A language formatting configuration [2 implementers]
saffron/src/describe/mod.rs

Core symbols most depended-on inside this repo

assert
called by 25
saffron/src/describe/english.rs
check_does_contain
called by 18
saffron/src/lib.rs
normalize
called by 12
saffron/src/parse.rs
assert
called by 11
saffron/src/lib.rs
status
called by 11
saffron-worker/worker/worker.js
free
called by 11
saffron-web/pkg/saffron.js
into_iter
called by 9
saffron/src/parse.rs
tail_ors_exprs
called by 9
saffron/src/parse.rs

Shape

Function 117
Method 87
Class 41
Enum 8
Interface 4

Languages

Rust89%
TypeScript10%
C++1%

Modules by API surface

saffron/src/lib.rs82 symbols
saffron/src/parse.rs79 symbols
saffron/src/describe/english.rs20 symbols
saffron-web/pkg/saffron.js17 symbols
saffron-worker/src/lib.rs14 symbols
saffron-c/src/lib.rs14 symbols
saffron-web/src/lib.rs12 symbols
saffron/src/describe/mod.rs5 symbols
saffron-worker/worker/worker.js5 symbols
saffron-web/pkg/saffron.d.ts4 symbols
saffron-c/include/saffron.h2 symbols
saffron/examples/future-times.rs1 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add saffron \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact