Expand description
SDK app-kind detection + external (Rust/C++/Python) build/run dispatch. App-kind detection and build/run dispatch for SDK-authored apps.
lumenc’s CLI historically assumed every app directory was a pure-markup
app (main.lmn + lumen.toml) driven by the built-in runtime. The Rust,
C++, and Python SDKs bypass the CLI entirely today: a Rust app is a cargo
bin depending on the lumenui crate, a C++ app is a CMake project linking
liblumen, and a Python app is a script importing lumen.
This module closes that gap. [detect] inspects an app directory and
classifies it as [AppKind::Markup], [AppKind::Rust], [AppKind::Cpp],
or [AppKind::Python]. The CLI (lumenc run / lumenc build) resolves the
kind - an optional [app] kind override in lumen.toml wins, otherwise
auto-detection decides - and reroutes non-markup apps to their native
toolchain (cargo, cmake, the Python interpreter) instead of the markup
runtime.
§Detection precedence
SDK project markers take precedence over the markup fallback, because SDK
app directories also carry main.lmn / lumen.toml for the runtime to
load at boot. The order is Rust, then C++, then Python, then Markup:
- Rust -
Cargo.tomlwhose dependency tables namelumenuiorlumen. - C++ - a
CMakeLists.txt, or any.cpp/.cc/.cxxthat includes alumenheader. - Python - any
.pythat importslumen, or apyproject.tomlmentioninglumen. - Markup - the fallback (
main.lmn+ optionalmain.css).
Structs§
- Command
Spec - A single external process to spawn: program, args, working directory, and
extra environment. Kept as plain data (rather than a live
Command) so the dispatch tables are cheap to unit-test by asserting on argv / cwd.
Enums§
- AppKind
- How a Lumen app directory is authored. Drives the CLI’s build/run reroute.
- Mode
- Whether the CLI is dispatching a
runor abuild.
Functions§
- build_
app_ external - Reroute
lumenc build <dir>to the SDK app’s native toolchain. - detect
- Classify the app directory by inspecting its files. See the module docs for the precedence rules and heuristics.
- dispatch
- Build the external command sequence for
kindinmode, run fromdir. - python_
entry - Locate the Python entry script in
dir. Prefers conventional names, then falls back to the sole.pythat importslumen. - resolve
- Resolve the effective kind for
dir: an explicit override (fromlumen.toml’s[app] kind) always wins; otherwisedetectdecides. - run_
app_ external - Reroute
lumenc run <dir>to the SDK app’s native toolchain. - rust_
dynamic_ env - The environment a Rust app is compiled in so that it links the shared Lumen engine instead of compiling a copy of it into itself.