Expand description
CLI layer — clap definitions + command dispatch.
Each subcommand is a separate module. The CLI layer:
- Parses args into typed commands
- Locates
.agents/root (walk up from cwd, or--rootflag) - Calls library functions
- Formats output (human-readable by default,
--jsonfor machine) - Maps
MarsErrorto exit codes and stderr messages
Modules§
- add
mars add <source>— add or update a source, then sync.- cache
mars cache— manage the global source cache.- check
mars check [PATH]— validate a source package before publishing.- doctor
mars doctor— validate state consistency.- init
mars init [TARGET] [--link DIR...]— scaffold a mars-managed directory withmars.toml.- link
mars link <dir>— symlink agents/ and skills/ into another directory.- list
mars list— show available agents and skills.- outdated
mars outdated— show available updates without applying.- output
- Shared output formatting for CLI commands.
- override_
cmd mars override— set a local dev override for a source.- remove
mars remove <source>— remove a source from config and prune its items.- rename
mars rename— rename a managed item.- repair
mars repair— rebuild state from lock + sources.- resolve_
cmd mars resolve— mark conflicts as resolved after user fixes them.- sync
mars sync— resolve + install (make reality match config).- upgrade
mars upgrade— upgrade sources to newest versions within constraints.- why
mars why <name>— explain why an item is installed.
Structs§
- Cli
- mars — agent package manager for .agents/
- Mars
Context - Resolved context for a mars command — both the managed root and its parent project root.
Enums§
Constants§
- TOOL_
DIRS - Tool-specific directories that commonly need linking.
Root detection searches these in addition to WELL_KNOWN.
mars linkwarns if the target isn’t in TOOL_DIRS or WELL_KNOWN. - WELL_
KNOWN - Directories where mars manages mars.toml as the primary root.
These are the default target for
mars init.
Functions§
- dispatch
- Dispatch a parsed CLI command to the appropriate handler and map errors to the final exit code.
- find_
agents_ root - Find the mars-managed root by walking up from cwd, or use
--rootflag. - is_
symlink - Check if a path is a symlink (uses symlink_metadata, doesn’t follow).