{
  "schema": "leumas.docs.page/1",
  "id": "adapter:domain/cron-expressions",
  "slug": "adapters/domain/cron-expressions",
  "kind": "capabilities",
  "bucket": "package",
  "title": "cron-expressions",
  "name": "Cron Expressions",
  "eyebrow": null,
  "chip": null,
  "summary": "Cron expression toolkit for standard 5-field crontab syntax (minute hour day-of-month month day-of-week): parse an expression into structured fields with expanded value sets (parse), explain any cron...",
  "keywords": [
    "cron-expressions",
    "5-field",
    "crontab",
    "day-of-week",
    "dayofmonth",
    "dayofweek",
    "nextruns",
    "ready-made"
  ],
  "audience": "both",
  "funnel": {
    "product": null,
    "cta": null
  },
  "body": "# cron-expressions\n\nToolkit for **standard 5-field crontab syntax** — `minute hour day-of-month month day-of-week`. Parse,\nexplain, build, validate, and compute the next N run times of any cron expression. Deterministic\nscheduler math, pure ESM, zero dependencies.\n\n## Tools\n\n| Tool | Purpose |\n|---|---|\n| `parse` | Cron (or `@`-macro) → structured fields + expanded value sets. |\n| `explain` | Cron → one plain-English sentence. Optional LLM enrichment via `options.enrich`. |\n| `describe` | Fields + English + the next 3 run times in one call. |\n| `build` | `{ minute, hour, dayOfMonth, month, dayOfWeek }` spec → a valid cron string. |\n| `nextRuns` | The next N future run times as ISO timestamps (`count`, `from`, `tz`). |\n| `validate` | Check an expression; returns `{ valid, errors, normalized }` (never throws). |\n| `common` | Ready-made presets (`@daily`, every-15-minutes, weekdays-9am, business-hours, …). |\n\n## Supported syntax\n\n`*` any, `a-b` ranges, `a/n` and `a-b/n` steps, `a,b,c` lists, month/weekday **names**\n(`JAN`, `SUN`, `MON-FRI`), Sunday as `0` or `7`, and `@`-macros: `@hourly @daily @weekly @monthly\n@yearly` (`@reboot` is recognized but has no scheduled time). Follows the Vixie-cron rule: when both\nday-of-month and day-of-week are restricted, a run matches if **either** matches.\n\n## Usage\n\n```js\nimport cron from './index.js';\n\ncron.adapters.parse({ cron: '*/15 9-17 * * MON-FRI' });\nawait cron.adapters.explain({ cron: '0 9 * * 1-5' });        // \"At 09:00, on weekdays (Monday–Friday).\"\ncron.adapters.build({ spec: { minute: 0, hour: 9, dayOfWeek: '1-5' } }); // \"0 9 * * 1-5\"\ncron.adapters.nextRuns({ cron: '0 0 1 * *', count: 3 });     // next 3 first-of-month midnights (UTC)\ncron.adapters.validate({ cron: '99 * * * *' });              // { valid:false, errors:[...] }\ncron.adapters.common({ options: { filter: 'week' } });\n```\n\n## Hybrid intelligence\n\nThe entire scheduler (field expansion + next-run search) is deterministic and offline. `explain` and\n`describe` additionally support an optional LLM path (`options.enrich: true`) that rewrites the\nbaseline English into a friendlier sentence, silently falling back to the built-in phrasing when no\nmodel is reachable. Results are tagged `{ mode: 'heuristic' | 'llm' }`. No tool ever requires a model.\n\n## DRY boundary\n\nThe existing **`cron`** pack parses human *intervals* (`\"5m\"` → milliseconds) and fires scheduled HTTP\nactions. This pack is *crontab syntax* — a different grammar entirely. No overlap. Only cross-pack\nimport: `../_shared/llm.js`.\n",
  "source": {
    "path": "shared/engines/adapters/domain/cron-expressions/README.md",
    "blobSha": "",
    "commit": "",
    "committedAt": "",
    "provenance": "no-git",
    "bytes": 2758,
    "hash": "594fbaa140e56e7fe5aac72d0044a7a8bb21c7c5"
  },
  "urls": {
    "html": "/p/adapters/domain/cron-expressions",
    "json": "/docs/adapters/domain/cron-expressions.json",
    "md": "/docs/adapters/domain/cron-expressions.md"
  },
  "links": {
    "composes": [],
    "usedBy": [],
    "product": [],
    "howTo": [],
    "skills": []
  }
}
