Skip to main content

SHEET 06 OF 41

/DOC/:SLUG

PART:
03 DOCUMENTATION
CIRCULATION:
PUBLIC
SOURCE:
pages/Doc/[...Slug].astro
AS OF:
2026-12-02

Maintain is the build orchestrator for Land, providing shell scripts for debug and release builds, GritQL queries for automated refactoring, and a turbo.json task graph - it does not need to be recompiled when changed.

/Elements

Maintain

Maintain is the build orchestrator for Land, providing shell scripts for debug and release builds, GritQL queries for automated refactoring, and a turbo.json task graph - it does not need to be recompiled when changed.

PUBLISHED ELEMENTS Source/Content/doc/maintain.md UNAVAILABLE UNAVAILABLE ARCHITECTURE 5

STATUS UNAVAILABLE NEXT OPEN THE ELEMENT'S MANUAL - IT DESCRIBES THE THING THE CAPTURE WOULD HAVE SHOWN.

# PLATE_01 / MAINTAIN

FIGURE: The capture this record's evidence would show: blueprint in high contrast line work.

This element has no evidence manifest in the build, so there is no capture to describe. The record above still prints its working - form, boundary, dependencies, manual and trace - and none of those fields is a picture.

SUBJECT:
BLUEPRINT IN HIGH CONTRAST LINE WORK
MANIFEST:
UNAVAILABLE
STATE:
UNAVAILABLE
PLATE:
UNAVAILABLE

SOURCE: SOURCE/CONTENT/ELEMENT/WORKING.TS

Maintain is the build orchestrator for the Land project. It coordinates shell scripts, a Rust CLI with embedded Rhai scripting, and a Turborepo task graph to produce deterministic builds across all Land elements. Unlike Mountain, Cocoon, or Rest, Maintain does not need to be recompiled when its source changes - it is a build wrapper, not a compiled artifact that runs inside the editor.

What Maintain provides

Capability Description
Shell script entry points Debug/Build.sh, Release/Build.sh, SignBundle.sh - the commands developers and CI run
Rhai scripting engine Embedded rhai interpreter for flexible build logic and custom automation without shell portability concerns
TOML / JSON5 editing Type-safe, non-lossy editing of Cargo.toml and package.json files via toml_edit and json5
turbo.json task graph Defines globalEnv, task dependencies, and parallel execution across all Land packages
GritQL queries Automated refactoring patterns for bulk code transformations across the codebase
CI/CD configuration Pipeline definitions for building and signing on each supported platform

Architecture

Maintain is a Rust binary and library. The CLI layer accepts subcommands and delegates to the Rhai scripting engine or direct build functions. Configuration editing is performed through toml_edit and json5 for structured, non-lossy modifications to project configuration files.

Mermaid diagram

Modules

Maintain’s source is four top-level modules, each with its own CLI and function set:

Module Role
Source/Build/ The build pipeline: CLI, group definitions, dispatch, process spawning, TOML/JSON5 editing, Rhai scripts
Source/Run/ The run pipeline: start an element or the editor from a built tree
Source/Eliminate/ The elimination pass: transform and prune generated configuration across elements
Source/Architecture.rs Emits the workspace’s architecture description

Source/main.rs dispatches to those four; Source/Library.rs is the library root. The file-level table - every submodule with its purpose - is Maintain - Deep Dive’s subject.

Data Flow

Mermaid diagram

Integration Points

Connecting Element Direction Mechanism Description
Mountain Build target cargo build subprocess Maintain compiles Mountain as part of the debug/release build group
Air Build target cargo build subprocess Air daemon compiled alongside Mountain
Echo Build target cargo build subprocess Echo scheduler compiled as a dependency of Mountain
Rest Build target cargo build subprocess Rest compiler binary built for use by Output
SideCar Build target cargo build subprocess SideCar Download tool compiled and run as part of setup
Output Build trigger pnpm run prepublishOnly subprocess Maintain triggers TypeScript builds via pnpm
Wind / Sky Build trigger pnpm run prepublishOnly subprocess Frontend packages built through Turborepo via Maintain

Configuration

Option CLI Flag Description
Build mode debug / release subcommand Controls --release flag and optimization level
Target triple --target Rust target triple for cross-compilation
Element filter --element Build only a specific element rather than the full group
Script path --script Override the default Rhai build configuration script
Verbosity --verbose Enable detailed subprocess output logging

Shell scripts

The primary entry points are shell scripts in Element/Maintain/:

Script Purpose
Debug.sh Full debug build of all elements
Debug/Build.sh Debug build: sets up env vars, runs tauri build --profile debug-electron, then calls SignBundle.sh
Debug/Run.sh Launches the built debug binary with Trace, Record, and other dev env vars
Debug/Wind.sh Builds and watches only the Wind TypeScript service layer
Debug/All.sh Debug all components including frontend
Release.sh Optimized release build with all elements
Script/SignBundle.sh Ad-hoc re-sign of the .app bundle using xattr -cr and codesign
Dev-Mountain.sh Hot-reload development mode for Mountain only
Profile.sh Release build with profiling instrumentation enabled

Why Maintain does not need rebuild

Maintain’s shell scripts are plain sh - they run directly on any POSIX system without compilation. The Rust Maintain binary is a build helper CLI that is compiled once and cached; it does not run inside the editor at runtime. Changes to the shell scripts take effect immediately on the next invocation. Changes to turbo.json take effect on the next pnpm command. Only changes to the Rust source under Source/Build/ require cargo build -p Maintain.

Important

Never run cargo build -p Maintain as part of a normal development loop. The shell scripts invoke the pre-built binary. Maintain is rebuilt only when its own Rust source is intentionally modified.

GritQL queries

Maintain ships a set of GritQL pattern files for automated refactoring. GritQL is a structural search-and-replace language for code that operates on ASTs rather than text. Land uses these queries for:

  • Bulk renames of TypeScript identifiers across all packages
  • Migration of import paths when element structure changes
  • Enforcement of naming conventions (PascalCase filenames, single default export)
  • Updating generated code when templates change

GritQL queries are stored under Element/Maintain/Query/ and can be run against any element in the workspace.

turbo.json task graph

The turbo.json at the workspace root defines:

  • globalEnv - all PascalCase env vars (BundleLevel, HotReload, Watch, TierIPC, etc.) that Turborepo passes through to child tasks
  • Task dependencies - which packages must build before others (e.g. Output must build before Sky)
  • Parallel execution - tasks with no declared dependencies run concurrently across CPU cores
  • Cache keys - inputs that, when changed, invalidate the Turborepo cache for a task

pnpm workspace management

Maintain works within the pnpm workspace defined at Land/package.json. All TypeScript packages use the workspace: protocol for cross-package dependencies. Maintain’s Source/Build/JsonEdit.rs handles non-lossy edits to package.json files when version bumps are required - it uses the json5 crate to preserve comments and formatting that JSON.parse / JSON.stringify would destroy.

Rust CLI

The Maintain Rust binary provides subcommands for cases where shell scripts are insufficient:

# Debug build of a specific element
Maintain debug --element Mountain

# Release build for a specific target triple
Maintain release --target aarch64-apple-darwin

# Override the Rhai build script
Maintain debug --script Custom/Build.rhai

# Verbose subprocess output
Maintain release --verbose

The CLI is built on clap and delegates to either the Rhai scripting engine or direct build functions depending on the subcommand.

Source files

File Role
Source/Library.rs Entry point, wires CLI, logging, and error handling
Source/Build/CLI.rs clap-based CLI with debug, release, profile, dev subcommands
Source/Build/Fn.rs Core build function dispatch: clean, compile, link, post-process
Source/Build/Process.rs Child process spawning with stdout/stderr capture and exit code handling
Source/Build/TomlEdit.rs Non-lossy TOML editing for Cargo.toml version bumps and dependency changes
Source/Build/JsonEdit.rs JSON5-aware editing for package.json files
Source/Build/Rhai/ScriptRunner.rs Rhai script execution with Land API bindings
Source/Build/Rhai/ConfigLoader.rs Rhai build configuration script loading
Source/Build/GetTauriTargetTriple.rs Platform detection for SideCar binary selection

The record this page documents, as the site files it: the six facts the claim is checked against, and the three files the manual names to check it.

WORKING, 06

FORM:
BUILD ORCHESTRATOR
WRITTEN IN:
RUST RHAI
BOUNDARY:
COMMAND LINE
DEPENDS ON:
CARGO TAURI
EVIDENCE:
UNAVAILABLE NO MANIFEST IN THE BUILD

# TRACE / MAINTAIN 03 STEPS

  1. 01 Debug/Build.sh THE BUILD ENTRY
  2. 02 Debug/Run.sh THE RUN ENTRY
  3. 03 Debug/All.sh EVERY PROFILE

SOURCE: /DOC/DEEP-DIVE-MAINTAIN

Elements, 17 PAGES, page 7 of 17

THE LAYER'S INDEX

NEXT: /BLOG 04 BLOG

NOTES FROM THE BUILD, NEWEST FIRST

〈06〉 /DOC/:SLUG 41 SHEETS AS OF: 2026-12-02