Skip to main content

Module app_kind

Module app_kind 

Source
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:

  1. Rust - Cargo.toml whose dependency tables name lumenui or lumen.
  2. C++ - a CMakeLists.txt, or any .cpp/.cc/.cxx that includes a lumen header.
  3. Python - any .py that imports lumen, or a pyproject.toml mentioning lumen.
  4. Markup - the fallback (main.lmn + optional main.css).

Structs§

CommandSpec
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 run or a build.

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 kind in mode, run from dir.
python_entry
Locate the Python entry script in dir. Prefers conventional names, then falls back to the sole .py that imports lumen.
resolve
Resolve the effective kind for dir: an explicit override (from lumen.toml’s [app] kind) always wins; otherwise detect decides.
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.