/ architecture

Architecture

Two ecosystems in one repository: the zero CLI framework and the signed APT repository, both deployed to GitHub Pages.

Overview

Install flow

  1. Installer installs dependencies (tput git glow gh rg jq bat curl).
  2. Creates Zero-Termux directories; clones the repo (or updates it).
  3. Symlinks $PREFIX/bin/zero.
  4. Writes the APT sources line + installs the GPG key; runs apt update.
  5. Saves configuration; prints summary.

CLI framework

Dispatch

zero/bin/zero resolves symlinks, loads the environment, and dispatches to zero/cli/commands/<cmd>.sh, which exports <cmd>_main. Shared utilities live in zero/utils/ (bootstrap/import, env, colors, log, version).

Modules → tools

zero/modules/<cat>.sh defines the category installers; zero/tools/<cat>/<tool>/install.sh exports install_/update_/reinstall_/uninstall_<tool>. The ai category imports an aggregate all.sh.

Commands: full reference · Module catalog: modules.

APT repository & signing

  1. build-repo.yml runs scripts/build/build-repo.sh: builds each packages/* dir with dpkg-deb, indexes with termux-apt-repo, signs Release (→ InRelease) with the ed25519 key in GitHub secrets.
  2. The workflow assembles _site: site/* at root, repo/* under /repo, assets/zero-termux.gpg at root.
  3. peaceiris/actions-gh-pages deploys to gh-pages; pages.yml deploys site-only changes with keep_files: true so /repo survives.
  4. Both deploy workflows share the zero-termux-pages concurrency group — site and repo deploys never collide.

Directory layout

zero/                          CLI framework (bash, no runtime deps)
  bin/zero                     entry point
  cli/commands/<cmd>.sh        one file per command
  modules/<cat>.sh             category install/update/uninstall logic
  tools/<cat>/<tool>/          per-tool installers + README.md
  utils/                       bootstrap, env, colors, log, version
packages/<name>/DEBIAN/        package definitions (control + lifecycle)
scripts/
  build/build-repo.sh          dpkg-deb + termux-apt-repo + gpg sign
  validation/                  CI validators
  version-check/               rolling-version drift reporter
  maintenance/                 weekly scheduled checks
  site/generate-data.py        regenerates site/data/*.json
site/                          website (multi-page, data-driven)
  data/*.json                  generated from the repo
assets/                        PACKAGES.md + zero-termux.gpg (public key)
.github/workflows/             build-repo, test, pages, maintenance
install.sh                     unified installer

Data flow for the website

The site is data-driven: python3 scripts/site/generate-data.py scans zero/cli/commands, zero/tools/*/*, packages/*/DEBIAN/control (and the category map in assets/PACKAGES.md) and writes site/data/{meta,commands,modules,packages,search}.json. The explorer pages fetch those JSON files at runtime and search.json powers the site search. Changing tools or packages means regenerating the JSON — CI fails if the site is out of date.