credit.cli._common#

Shared helpers used across all CLI submodules.

Attributes#

Functions#

_prompt(→ str)

Print a prompt and return stripped input, or default if empty.

_prompt_bool(→ bool)

_setup_logging(→ None)

_repo_root(→ str)

Absolute path to the miles-credit repo root.

_find_torchrun(→ str)

Return the path to torchrun, preferring the active conda env.

_is_ncar_system(→ bool)

Return True if running on a known NCAR HPC system (Casper or Derecho).

_agent_read_file(→ str)

_agent_list_files(→ str)

_agent_bash(→ str)

_dispatch_tool(→ str)

Module Contents#

credit.cli._common.logger#
credit.cli._common._PBS_DEFAULTS#
credit.cli._common._prompt(prompt: str, default=None) str#

Print a prompt and return stripped input, or default if empty.

credit.cli._common._prompt_bool(prompt: str, default: bool = True) bool#
credit.cli._common._setup_logging(level: int = logging.INFO) None#
credit.cli._common._repo_root() str#

Absolute path to the miles-credit repo root.

credit.cli._common._find_torchrun() str#

Return the path to torchrun, preferring the active conda env.

credit.cli._common._is_ncar_system() bool#

Return True if running on a known NCAR HPC system (Casper or Derecho).

credit.cli._common._agent_read_file(path: str, tail: int = 400) str#
credit.cli._common._agent_list_files(pattern: str) str#
credit.cli._common._AGENT_BASH_BLOCKLIST = ('rm ', 'rmdir', 'mv ', 'cp ', '> ', '>>', 'tee ', 'dd ', 'mkfs', 'chmod', 'chown', 'curl',...#
credit.cli._common._agent_bash(command: str) str#
credit.cli._common._dispatch_tool(name: str, tool_input: dict) str#