Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/CRISTOP-bot/cris-os-v2/llms.txt

Use this file to discover all available pages before exploring further.

LCP (Lightweight CrisOS Packager) ships in two forms: a Python 3 CLI (tools/lcp.py) for host-side package management during development, and an in-kernel C implementation (src/lcp.c) accessible via the lcp shell command at runtime. Both modes share the same package metadata format and the same five packages in the default main repository, so workflows familiar from one mode translate directly to the other.

Architecture

Host CLI (tools/lcp.py)

Full-featured Python 3 tool. Manages a persistent state directory at ~/.lcp/, supports remote and local repositories, version comparison, dependency resolution, and a package cache. Runs entirely on your development machine — no OS boot required.

In-Kernel (src/lcp.c)

Lightweight C implementation compiled directly into the CrisOS kernel. Reads lcp_repo.txt from the CRFS rootfs at boot, parses packages into an in-memory table, and exposes the lcp shell command. State is volatile — it resets on every reboot.

Host CLI storage

The host CLI keeps all persistent data under ~/.lcp/:
PathPurpose
~/.lcp/repos.jsonList of configured repositories (name, URL, enabled flag)
~/.lcp/installed.jsonInstalled package records and held packages
~/.lcp/cache/Per-repo cached index files downloaded by lcp update

In-kernel repo loading

At boot, lcp_init() attempts to open lcp_repo.txt from the VFS. If the file is found and parses correctly, it becomes the live package database. If the file is missing or malformed, the kernel falls back to a hardcoded copy of the same five packages compiled into src/lcp.c. The in-kernel implementation supports up to 16 packages, 8 dependencies per package, and 8 files per package.

Package format

JSON (host CLI)

The host CLI reads and caches repository indexes as JSON. Each package entry in lcp_main_repo.json contains:
FieldTypeDescription
namestringUnique package identifier
versionstringSemantic version string (e.g. 1.0.0)
descriptionstringShort human-readable description
archstringTarget architecture (always i386 for CrisOS v2)
maintainerstringPackage author or team
licensestringSPDX license identifier
dependenciesarrayNames of required packages
filesarrayRelative paths installed by the package
sizeintegerPackage size in bytes
Example entry from tools/lcp_main_repo.json:
{
  "name": "nano-cris",
  "version": "1.0.0",
  "description": "Editor de texto simple para CrisOS.",
  "arch": "i386",
  "maintainer": "Cristopher",
  "license": "MIT",
  "dependencies": ["libc", "termcap"],
  "files": ["bin/nano-cris", "share/nano-cris/help.txt"],
  "size": 32000
}

Text format (in-kernel lcp_repo.txt)

The in-kernel parser reads a plain-text format where each package is a block of key:value lines separated by ---:
name:nano-cris
version:1.0.0
description:Editor de texto simple para CrisOS
arch:i386
maintainer:Cristopher
license:MIT
dependencies:libc,termcap
files:bin/nano-cris,share/nano-cris/help.txt
size:32000
repo:main
---
name:editor-lite
version:0.5.0
...

Available packages

PackageVersionDescriptionLicenseDependencies
editor-lite0.5.0Lightweight text editor for CrisOSMIT
nano-cris1.0.0Simple text editor for CrisOSMITlibc, termcap
textpad0.9.1Terminal-based text editor for CrisOSApache-2.0libc
libc1.0.0Minimal standard library for CrisOSMIT
termcap1.2.3Terminal compatibility library for CrisOSBSD-2-Clause

Host CLI usage

Run python tools/lcp.py <command> [args] from the repository root. All commands require tools/lcp_main_repo.json to be present alongside lcp.py (the default main repo uses a file: URL that resolves relative to the script directory).
python tools/lcp.py help
python tools/lcp.py help install
Prints the general command reference, or detailed help for a specific command.
python tools/lcp.py search editor
python tools/lcp.py search libc
Searches package names and descriptions across all enabled repositories. Results are printed one per line.
python tools/lcp.py info nano-cris
Prints name, version, description, size, dependencies, repository, author, and license for the named package.
python tools/lcp.py install nano-cris
Resolves the full dependency graph and installs each package in topological order. Use --force to reinstall an already-installed package. Use --no-deps to install only the named package without pulling in dependencies. Use --root <path> to install into a directory other than the current working directory.
python tools/lcp.py remove nano-cris
Removes a package and deletes its tracked files. Refuses to remove a package that other installed packages depend on. With --purge, also deletes etc/<package>.conf if present.
python tools/lcp.py update
Downloads (or re-reads) the index for every enabled repository and writes the result to ~/.lcp/cache/<name>.json. Run this before install or upgrade to pick up new package versions.
python tools/lcp.py upgrade
Compares installed versions against the cached repository index and reinstalls any package where a newer version is available.
python tools/lcp.py list
python tools/lcp.py list --installed
python tools/lcp.py files nano-cris
Prints each file path that was written when the package was installed, one per line.
python tools/lcp.py depends nano-cris
Prints the direct dependency list for a package, whether or not it is currently installed. Reads from the cached repository index if the package is not installed.
python tools/lcp.py verify nano-cris
Walks the file list recorded at install time and reports any files that are missing from disk. Exits with code 5 (EXIT_INSTALL_FAIL) if any files are missing.
python tools/lcp.py clean
Deletes all files under ~/.lcp/cache/. Run lcp update afterwards to rebuild the cache from scratch.

Repository management

1

List configured repositories

python tools/lcp.py repo list
Prints each repository’s name, URL, and enabled/disabled status.
2

Add a repository

python tools/lcp.py repo add myrepo https://example.com/packages/index.json
Appends a new entry to ~/.lcp/repos.json. Run lcp update to populate the cache.
3

Enable or disable a repository

python tools/lcp.py repo enable myrepo
python tools/lcp.py repo disable myrepo
Disabled repositories are skipped during update, search, and install.
4

Remove a repository

python tools/lcp.py repo remove myrepo
Removes the entry from ~/.lcp/repos.json. Does not uninstall packages that came from it.
The default repository is named main and points to the local JSON file:
DEFAULT_REPOS = [
    {
        'name': 'main',
        'url': f'file:{SCRIPT_DIR / "lcp_main_repo.json"}',
        'enabled': True,
    }
]
The default repo URL uses a file: scheme pointing to tools/lcp_main_repo.json relative to the script directory. To use a remote repository, add it with python tools/lcp.py repo add <name> https://... and run python tools/lcp.py update to cache its index.

Exit codes

CodeConstantMeaning
0EXIT_SUCCESSOperation completed successfully
1EXIT_ERRORGeneric error
2EXIT_INVALID_COMMANDUnknown or malformed command
3EXIT_NOT_FOUNDPackage not found in any repository or installed database
4EXIT_DEP_MISSINGOne or more dependencies could not be resolved
5EXIT_INSTALL_FAILInstall write failed, remove blocked by dependents, or verify found missing files
6EXIT_PERMISSIONSInsufficient filesystem permissions
7EXIT_REPO_DOWNRepository fetch failed (network or file not found)
8EXIT_ALREADY_INSTALLEDPackage is already installed (use --force to override)
9EXIT_CORRUPTRepository index or installed database is malformed

In-kernel lcp command

Inside a running CrisOS v2 shell, the lcp command is dispatched to lcp_handle_command() in src/lcp.c. The in-kernel implementation exposes the following subcommands, as dispatched in lcp_handle_command():
CommandDescription
lcp helpPrint available commands
lcp listList installed packages (default)
lcp list --availableList all packages from the repo
lcp list --installedList only installed packages
lcp search <term>Case-insensitive search across names and descriptions
lcp info <pkg>Show metadata for a package
lcp install <pkg>Mark a package as installed; auto-installs dependencies
lcp install --no-deps <pkg>Install without resolving dependencies
lcp remove <pkg>Mark a package as uninstalled
lcp remove --purge <pkg>Remove and note purge of configuration
lcp updateRe-parse lcp_repo.txt from the VFS
lcp upgrade [pkg]Mark installed packages as upgraded
lcp files <pkg>List files associated with a package
lcp depends <pkg>Print dependencies for a package
lcp verify <pkg>Confirm package is installed and healthy
The in-kernel lcp install command marks packages as installed in the kernel’s in-memory table only. It does not write files to disk or persist state across reboots. To permanently add packages to the rootfs, use the host CLI and rebuild the image with make iso.

Build docs developers (and LLMs) love