feat: add @context attribute for context-based output splitting#77
feat: add @context attribute for context-based output splitting#77keithharvey wants to merge 5 commits intorhys-vdw:mainfrom
Conversation
Use lua-doc-extractors @context feature to group output files into synced, unsynced and shared, see rhys-vdw/lua-doc-extractor#77
Use lua-doc-extractors @context feature to group output files into synced, unsynced and shared, see rhys-vdw/lua-doc-extractor#77
Use lua-doc-extractors @context feature to group output files into synced, unsynced and shared, see rhys-vdw/lua-doc-extractor#77
|
Ok so a couple changes to the generation today. I was just throwing everything not-context'ed into shared, which led to shared being out of control huge. So I changed it to preserve the file mapping for anything without a specified context. That keeps shared smol. This is more of a hybrid approach but keeps us non-breaking. Verified the Recoil CI working https://github.com/keithharvey/RecoilEngine/actions/runs/23181438332/job/67357579048 |
Use lua-doc-extractors @context feature to group output files into synced, unsynced and shared, see rhys-vdw/lua-doc-extractor#77
Use lua-doc-extractors @context feature to group output files into synced, unsynced and shared, see rhys-vdw/lua-doc-extractor#77
Use lua-doc-extractors @context feature to group output files into synced, unsynced and shared, see rhys-vdw/lua-doc-extractor#77
|
@rhys-vdw So I took another look at this after our discord conversation, then refactored the output layer. No more explicit "shared" handling in the CLI. It's internal to the bucket naming now. The CLI just gets a flat I also pulled |
Use lua-doc-extractor's @context attribute to partition Lua API documentation into synced, unsynced, and shared output files. Tables appearing in multiple contexts (e.g. Spring) are remapped to context-specific classes (SpringSynced, SpringUnsynced) that inherit from a shared base (SpringShared). Also adds CI support for overriding lua-doc-extractor repo/branch via workflow_dispatch inputs and repository variables. Depends on: rhys-vdw/lua-doc-extractor#77 Made-with: Cursor
Use lua-doc-extractor's @context attribute to partition Lua API documentation into synced, unsynced, and shared output files. Tables appearing in multiple contexts (e.g. Spring) are remapped to context-specific classes (SpringSynced, SpringUnsynced) that inherit from a shared base (SpringShared). Also adds CI support for overriding lua-doc-extractor repo/branch via workflow_dispatch inputs and repository variables. Depends on: rhys-vdw/lua-doc-extractor#77
Use lua-doc-extractor's @context attribute to partition Lua API documentation into synced, unsynced, and shared output files. Tables appearing in multiple contexts (e.g. Spring) are remapped to context-specific classes (SpringSynced, SpringUnsynced) that inherit from a shared base (SpringShared). Also adds CI support for overriding lua-doc-extractor repo/branch via workflow_dispatch inputs and repository variables. Depends on: rhys-vdw/lua-doc-extractor#77
Use lua-doc-extractor's @context attribute to partition Lua API documentation into synced, unsynced, and shared output files. Tables appearing in multiple contexts (e.g. Spring) are remapped to context-specific classes (SpringSynced, SpringUnsynced) that inherit from a shared base (SpringShared). Also adds CI support for overriding lua-doc-extractor repo/branch via workflow_dispatch inputs and repository variables. Depends on: rhys-vdw/lua-doc-extractor#77
Allow doc comments to declare @context tags (e.g. synced, unsynced) that partition the generated Lua library into mutually exclusive output files per context. Functions tagged with multiple contexts are placed into a shared base type, and EmmyLua class inheritance is generated so that context-specific types extend the shared one. Table names are only remapped when their members span more than one context bucket.
shared was out of control big
So I took another look at this and refactored the output layer. No more explicit shared handling in the CLI — it's internal to the bucket naming now. The CLI just gets a flat from , and is a merge step on that same list, not a separate code path. Single write loop, no branching. I also pulled into a generic backed by a constant — so is just the first entry. Future file-level meta attrs just add to the constant and get the validation for free (must be first doc, only one per file). Plus combinatorial tests for 3 contexts covering all subset combinations.
Realized that my AST was producing Shared for all shared functions, and that was accuate. We dont want devs to have to memorize whats in SpringShared and whats in SpringSynced, we want callers to be unambiguous and 1:1
Use lua-doc-extractor's @context attribute to partition Lua API documentation into synced, unsynced, and shared output files. Tables appearing in multiple contexts (e.g. Spring) are remapped to context-specific classes (SpringSynced, SpringUnsynced) that inherit from a shared base (SpringShared). Also adds CI support for overriding lua-doc-extractor repo/branch via workflow_dispatch inputs and repository variables. Depends on: rhys-vdw/lua-doc-extractor#77

Summary
Allow doc comments to declare
@contexttags (e.g. synced, unsynced) that partition the generated Lua library into mutually exclusive output files per context. Functions tagged with multiple contexts are placed into a shared base type, and EmmyLua class inheritance is generated so that context-specific types extend the shared one. Table names are only remapped when their members span more than one context bucket.Motivation
The Recoil engine exposes a single
Springtable in Lua, but different contexts (synced vs unsynced) have access to different subsets of functions. These options allow generatingSpringSyncedandSpringUnsyncedtype libraries from the same C++ sources without duplicating shared helper types that already exist in the per-file output.Enabled Recoil PR
beyond-all-reason/RecoilEngine#2799
Note on Backward Comparability
If you don't add
contexts, no projection happens and file structure is maintained.LLM Disclosure
Prompt was pretty detailed but Opus 4.6 typed most of this one. I read the specs too. I think it checks out.