Skip to main content

Module cli

Module cli 

Source
Expand description

CLI layer — clap definitions + command dispatch.

Each subcommand is a separate module. The CLI layer:

  • Parses args into typed commands
  • Locates project root (walk up from cwd, or --root flag)
  • Calls library functions
  • Formats output (human-readable by default, --json for machine)
  • Maps MarsError to exit codes and stderr messages

Re-exports§

pub use crate::types::MarsContext;

Modules§

add
mars add <dependency> — add or update a dependency, then sync.
adopt
mars adopt <path> — move unmanaged target content into .mars-src/, 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.
export
mars export — produce a JSON representation of the compile plan.
init
mars init [TARGET] [--link DIR...] — scaffold a mars project.
link
mars link <target> — add a managed target directory.
list
mars list — show available agents and skills.
models
CLI handlers for mars models subcommands.
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 <dependency> — remove a dependency from config and prune its items.
rename
mars rename — rename a managed item.
repair
mars repair — rebuild state from lock + dependencies.
resolve_cmd
mars resolve — mark conflicts as resolved after user fixes them.
sync
mars sync — resolve + install (make reality match config).
target
Shared target-name validation for link, unlink, and init commands.
unlink
mars unlink <target> — remove a managed target directory.
upgrade
mars upgrade — upgrade dependencies to newest versions.
validate
mars validate — dry-run compiler that reports diagnostics without writing.
version
mars version <bump|X.Y.Z> [--push] — bump package version, commit, and tag.
why
mars why <name> — explain why an item is installed.

Structs§

Cli
mars — agent package manager for agent and skill packages.

Enums§

Command

Constants§

TOOL_DIRS
Tool-specific directories that commonly need linking. mars link warns if the target isn’t in TOOL_DIRS or WELL_KNOWN.
WELL_KNOWN
Deprecated generic output directories still recognized for migration hints.

Functions§

dispatch
Dispatch a parsed CLI command to the appropriate handler and map errors to the final exit code.
find_agents_root
Find mars project root by walking up from start path to filesystem root.
is_symlink
Check if a path is a symlink (uses symlink_metadata, doesn’t follow).