Skip to content

CLI

dotagents.cli

dotagents CLI: init / context / env / overlays / build-pyz built-in subcommands, plus any user or overlay command modules discovered from a cmds directory (D76/D84).

dotagents bundles NO command module of its own (D85). link/sync used to ship in _overlay/dotagents/cmds/; they are now link-project/sync-project, shipped -- together with their logic -- by the opt-in private-sync overlay, so plain dotagents carries no private-sync workflow. The bundled cmds DIR still exists and is still laid down by init: it is the user's documented drop-in point for their own commands. leak-check is likewise not in the repo: it enforces personal plan-naming conventions, so it lives in the user's private .agents/dotagents/cmds/ as a discovered command module (D84).

The per-command classes live in sibling modules (cli/init.py, cli/overlays.py, ...); this package base holds the shared helpers (in cli/_common.py, re-exported here), the Dotagents(LoggingArgs, Cli) umbrella, main() (the install.py shim + python -m dotagents entrypoint), _discover (command-source resolution), and _repoint_zipapp_sources (the zipapp source-extraction shim). (install.py at the repo root is the entrypoint shim, unrelated to the removed install subcommand -- init now lays down the base + optional --bin-dir wrappers, D82.)

Dispatch (D76): main() routes through duho.app, not duho.main, so command discovery runs. Command MODULES are discovered from the bundled _overlay/dotagents/cmds/ dir (empty by default since D85, but still a source), from each installed overlay's <overlay-root>/cmds/ -- this is how the private-sync overlay supplies link-project/sync-project -- and from a per-scope cmds dir (one get_file_paths Contract-A walk, _cmds_dirs). app's DEFAULT dispatch is used (dotagents has no fan-out): a plain (LoggingArgs, Cmd) class command dispatches through app exactly as it did through main -- app calls the class's __call__.

_compose_block and _package_data_dir are re-exported at package level because other package modules import them as dotagents.cli._compose_block / dotagents.cli._package_data_dir (see _overlays.py, _scope.py). DotAgentsArgs is re-exported the same way, but for a different audience: an overlay-shipped command module (which always runs inside a real dotagents process) is meant to from dotagents.cli import DotAgentsArgs.

AGENTS_DIR_ENV = 'AGENTS_HOME' module-attribute

AGENTS_DIR_ENV_LEGACY = 'DOTAGENTS_AGENTS_DIR' module-attribute

CMDS_PATH_ENV = 'AGENTS_CMDS_PATH' module-attribute

CMDS_PATH_ENV_LEGACY = 'DOTAGENTS_CMDS_PATH' module-attribute

Dotagents

Bases: LoggingArgs, Cli

Umbrella CLI for installing and building the dotagents config.

cmdspath = [] class-attribute instance-attribute

Extra directory to discover command modules from (repeatable).

__call__()

Source code in src/dotagents/cli/__init__.py
145
146
147
148
149
150
def __call__(self) -> int:
    self._logger_.info(
        "pick a subcommand, e.g. `init`, `overlays`, `context`, `env`, "
        "`build-pyz`"
    )
    return 0

main(argv=None)

Source code in src/dotagents/cli/__init__.py
344
345
346
347
348
349
350
351
352
353
354
def main(argv=None) -> int:
    _repoint_zipapp_sources()
    # `duho.app` (not `duho.main`) so command discovery runs. Default dispatch:
    # dotagents has no fan-out, so `app` calls each command's `__call__` exactly
    # as `duho.main` did. `commands=` is the resolved built-ins + discovered set.
    return duho.app(
        Dotagents,
        commands=_discover(argv),
        argv=argv,
        name="dotagents",
    )