Skip to content

feat: Luau and Lua config support with hooks and documentation#25

Open
siriuslatte wants to merge 10 commits into
devfrom
feat/luau-configuration
Open

feat: Luau and Lua config support with hooks and documentation#25
siriuslatte wants to merge 10 commits into
devfrom
feat/luau-configuration

Conversation

@siriuslatte

Copy link
Copy Markdown
Owner

This pull request adds first-class support for using Luau or Lua scripts as project configuration files in Lithos, alongside the existing YAML and JSON formats. It updates the documentation, discovery logic, and configuration loading to recognize and execute .luau and .lua files using the Lune runtime, enabling dynamic configs and lifecycle hooks. The documentation is expanded with usage instructions, examples, and caveats for editor support, and a new example project demonstrates the feature.

Luau/Lua Configuration Support:

  • Added support for .luau and .lua files as valid Lithos config formats, updating config discovery to prefer YAML/JSON over Luau/Lua, and Luau over Lua. The loader now invokes the Lune runtime to evaluate these files and extract the config table, including support for synchronous and future hook functions. [1] [2] [3] [4] [5] [6]

Documentation Updates:

  • Expanded the configuration documentation to cover scripting with Luau/Lua, including file discovery precedence, Lune installation, usage of hooks, runtime validation, and editor support. [1] [2] [3] [4] [5]

Examples:

  • Added a new example project (examples/projects/luau-config) showcasing a Luau-based config with helpers, loops, and a hook, and updated the examples index. [1] [2] [3]

UI/Docs Minor Improvements:

  • Updated the config format tabs component to persist the selected tab using a storage key.

Other:

  • Minor cleanup of theme settings in the configuration docs meta file.

Lithos can now load Luau and Lua project configs through the Lune runtime. Discovery checks lithos.yml, lithos.yaml, lithos.json, lithos.luau, lithos.lua, then legacy mantle.* files; explicit .luau and .lua paths are honored. Evaluation runs in a Lune subprocess via a self-cleaning wrapper script, decodes the returned table from JSON, and surfaces runtime, shape, and schema errors with the offending config path.
Luau project tables may now expose an onConfigLoaded function alongside config, which the Lune wrapper invokes synchronously and whose return value (when a table) replaces the decoded config. Other on*-prefixed callbacks are reported back to Lithos as registered hooks so future deploy lifecycle steps can route into them.
Adds a Luau-and-Lua section to the configuration page covering Lune installation, the return-table contract, repetition-reducing helpers, and the onConfigLoaded hook. Adds an examples/projects/luau-config sample that exercises the same ideas end-to-end.
Extends the YAML-to-tabs remark plugin (in both docs/site and docs/packages/lib) to emit a third Luau tab alongside YAML and JSON, generated from the parsed YAML value as a Luau return-table literal with idiomatic key formatting. Switches the existing inline luau fences to lang=lua so shiki highlights them.
Pass storageKey to nextra Tabs so picking the Luau (or JSON) tab on any Lithos config example carries across pages, since SSR only renders the active tab panel. Adds a 'What about Luau and Lua?' subsection explaining that the JSON schema validates the runtime-evaluated Luau table and recommending luau-lsp for in-file authoring support.
Walks the YAML AST to map every input line to a key path, then re-emits JSON and Luau with per-path line tracking so a YAML `{4,6-7,10}` highlight becomes the equivalent `{5,7-8,13}` in the JSON and Luau tabs. Previously the meta was copied verbatim, which placed the highlight bar on the wrong rows.
Drops the content-based fallback in shouldTransform so partial YAML snippets (without a `filename=` meta) stay plain YAML instead of being converted into JSON/Luau tabs. Fixes the environments page where small illustrative snippets were rendering as full config tabs out of step with the surrounding prose.
The `layout: 'full'` setting in the reference page meta also strips the Nextra breadcrumb, leaving its top area visibly inconsistent with the rest of the docs. Switch to the default layout while keeping the TOC hidden so the breadcrumb returns and the page header matches every other docs page.
@siriuslatte siriuslatte self-assigned this May 23, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Docs preview: https://siriuslatte.github.io/lithos/previews/pr-25

This preview is rebuilt from the current full PR diff against dev.

@siriuslatte

Copy link
Copy Markdown
Owner Author

I have yet to test this even further.

@siriuslatte siriuslatte linked an issue May 23, 2026 that may be closed by this pull request
@siriuslatte siriuslatte added this to the v0.4.0-beta.2 milestone May 23, 2026
Bumps the lithos crate, foreman example, and README install snippet from 0.4.0 to 0.4.0-beta.2, and records a changelog entry covering Luau project configs (Lune-based evaluator + on* hooks) and the new YAML/JSON/Luau docs tabs.
… templates

Updates the migrating-from-mantle Foreman snippet, the home page version badge, and the bug-report issue template placeholder to match the bumped crate version.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(config): support Lua and Luau-backed project configs

1 participant