07 – Flows
This document outlines the core operational flows of the Cosmos package system, covering installation, uninstallation, updates, and syncing. Cosmos keeps behavior explicit and modular: CLI tools handle orchestration, while core libraries handle deterministic actions like installs and file tracking.
⬆️ Install Flow (cosmos install <star>
)
Summary:
Install a Star and its dependencies, supporting local or remote Galaxies, with optional offline mode.
Steps:
- CLI loads system
config.toml
and currentuniverse.toml
- CLI loads all cached Galaxies (repositories)
- CLI searches for the requested Star across all Galaxies
- CLI selects the matching Galaxy + Star and passes it to
install_star()
- Core checks if the Star is already installed in the Universe
- Core resolves and installs dependencies recursively:
- Skip if already installed
- Otherwise, locate the dependency and install it the same way
- Core downloads the
.tar.gz
if needed (unless in offline mode) - Core extracts the tarball to a temporary directory and runs the installation script (if any) from that location
- If there's no install script, it extracts
files/*
to theinstall_root
- Core updates
universe.toml
with installed files
⚡ Offline Mode
--offline
flag blocks any HTTP or file downloads- If required files are missing from the cache or local repo, install fails
🚜 Local vs Remote Galaxies
- Local Galaxies (e.g.
file:///
or mounted path): read directly from disk - Remote Galaxies:
- By default, use
http://
- Additional protocols like
https://
,ipfs://
require enabling optional features in the transport layer
🔍 Dependency Resolution
- Recursively installs each dependency
- Finds the first galaxy with a matching version of the required Star.
✨ Notes
- Nebulae (meta Stars) are processed the same way but do not extract files or run scripts
- Dependencies are resolved by searching Galaxies in priority order, returning the first match that satisfies the constraint.
- CLI must ensure the target Star and Galaxy are found before calling core install
- Core handles everything after that: caching, extraction, install script, tracking
- Tarballs are always extracted to a temporary directory before installation; Nova scripts execute from this temp directory and install files into
install_root
This split ensures the CLI can be customized per distro/environment, while the core logic stays portable, pure, and deterministic.
❌ Uninstall Flow (cosmos uninstall <star>
)
Summary:
Remove a Star and its files from the system.
Steps:
- Load system
config.toml
anduniverse.toml
- Check if the Star is installed
- If not found, return an error
- Delete all recorded file paths
- Remove the Star entry from
universe.toml
Notes:
- Cosmos does not track reverse dependencies
- If uninstall breaks another Star, that's on the user
- Nebulae uninstall instantly as they have no files
↩️ Update Flow (cosmos update <star>
)
Summary:
Upgrade a Star if a newer version is available in any synced Galaxy.
Steps:
- Load
universe.toml
and Galaxy cache - Compare installed version to available versions
- If newer version matches semver constraints:
- Uninstall the current version
- Install the new version via standard flow
Notes:
- If the Star is not installed, fallback to
install
- Cosmos does not automatically update all dependencies (manual per-Star)
- Future enhancement:
cosmos upgrade
to update all upgradable Stars
🧰 Sync Flow (cosmos sync
)
Summary:
Download Galaxy metadata, Stars, and (optionally) packages to prepare for installation and offline use.
Steps:
- Load
config.toml
and extract the[galaxies]
table - For each Galaxy:
- If the URL is local (
file://
, relative, or/
) → skip - If the URL is
https://
→ abort unless Cosmos was built with TLS support - Otherwise, download
meta.toml
- Depending on sync level:
--stars
: download each listedstar.toml
--full
: also download each tarball listed in itssource
field (if protocol supported)- Store all results in
{cache_dir}/galaxies/<name>/
Notes:
- Cosmos does not sync local/mounted Galaxies—they are read directly
- TLS is not enabled by default; HTTP is supported out of the box
- Additional protocols are opt-in via the transport feature system
meta.toml
must include a[stars]
table with version strings- Sync is one-shot and explicit—no background updates, no auto-indexing
These flows define the fundamental operations of Cosmos, emphasizing transparency, reproducibility, and total independence from external system dependencies.