app-anything GitHub

Architecture

app-anything is a compiler that turns one web project into packages and artifacts for several platforms. Its structure is a single idea carried through: one description of the app, many mechanical renderings.

The layers

kernel      value objects, events, ports, the catalog — no domain knowledge
spec        the manifest format, capabilities, targets, contracts (data)
project     loading, merging, detection — turning a directory into data
checks      rules over facts; static and dynamic phases
host        the runtime contract's host side: sessions, probe, supervision
runtimes    providers that make `runtime:` requirements concrete
pack        the pipeline that builds a `.aapkg`
creators    plugins that render a package for one platform (outside the core)
operations  the twelve verbs (`init`, `check`, `pack`, …)
adapters    CLI and MCP: argument translation only
sdk         the public surface for plugin authors

Dependencies point strictly downward (import-linter keeps the twelve contracts honest in CI), and the two flows through the system are:

init:   files → detectors → manifest (proposals, human-confirmed)
build:  manifest → checks → package → creator → artifacts

Three mechanisms do the work

Mark-and-collect registration. Decorators attach a mark; the catalog is assembled by walking the builtin modules plus entry points, then frozen. No module-level registries, no import-order games, and tests can build a catalog from exactly the pieces they need.

Dataclass reflection. The manifest is described once as frozen dataclasses with field metadata; decoding, encoding, JSON schemas, CLI arguments and documentation pages are all derived from it. A field cannot exist in code and be missing from the docs — the freshness test would fail.

Ports as protocols. Everything the environment provides — process launching, HTTP, the clock, the environment, the toolchain — sits behind tiny protocols in the kernel. The dynamic checks and the host run against real ports; tests inject fakes that script failures. No layer above the kernel imports a subprocess or a socket directly.

Where decisions live

Rules of the system are data in the catalogue (severity, phase, applicability), not branches in code. Platform knowledge lives in creators. Runtime knowledge lives in providers. The core knows the contract — ports, health, tokens, stdin EOF, sandboxes — and almost nothing else. This is why the same core serves a web site and a Tauri bundle without configuration.

Rendered from docs/explanation/architecture.md on main.