AGENTS.md@src/gnn/cli · git:20260922.4d5ad51 · 2026-09-22 · sha256 1e2287291a202dbf
AGENTS.md@src/gnn/cli git:20260922.4d5ad51A
Immutable. This exact content never changes and is served at /api/v1/blob/1e2287291a202dbf.
# CLI Module — Agent Scaffolding ## Module Overview **Purpose**: Command-line interface and dispatch functionality for the GNN pipeline. **Pipeline Step**: Infrastructure module (not a numbered step) **Category**: Infrastructure / Development Tools **Status**: ✅ Production Ready **Version**: [pyproject.toml](../../../pyproject.toml) (canonical) **Last Updated**: 2026-09-03 The CLI module provides the `gnn` command-line tool — a unified interface to the entire GNN pipeline. It acts as a thin dispatcher, routing 18 subcommands to their respective module APIs. Public exits are `0` for success, `1` for errors, and `2` for completed commands with warnings or degraded readiness. ## Architecture - **Pattern**: Thin dispatcher (not a pipeline step) - **Entry point**: `gnn.cli:main` (registered in `pyproject.toml [project.scripts]`) - **Dependencies**: All pipeline modules (imported lazily per subcommand) ## Capabilities - **Pipeline execution** via `gnn run` with skip/only-steps, log-format, and skip-llm options - **File validation** via `gnn validate` (section, state-space, connection, dimension checks) - **JSON/YAML parsing** via `gnn parse` with format and summary modes - **Code generation** via `gnn render` (PyMDP, RxInfer, ActiveInference.jl, JAX, NumPyro, Stan, PyTorch, DisCoPy, bnlearn) - **POMDP extraction** via `gnn extract` (structured JSON of the POMDP state space, with graceful degradation when the extractor is unavailable) - **Run reproduction** via `gnn reproduce` using content-addressable hashing - **Environment checks** via `gnn preflight` and `gnn health` - **Live development** via `gnn watch` (file monitoring with 250ms debounce) - **Dependency graphs** via `gnn graph` (Mermaid/text output) - **API server** via `gnn serve --surface` (`runs` → `api/app.py`, `jobs` → `api/server.py`, `both` starts the jobs surface on port+1 in a daemon thread) - **MCP surface inspection** via `gnn mcp list` / `gnn mcp info <tool>` (lazy `gnn.mcp` registry bridge; `--json` emits the standard envelope) - **LSP server** via `gnn lsp` (canonical `gnn.lsp` pygls server when pygls is importable; `cli/lsp.py` JSON-RPC fallback) ## File Structure ``` cli/ ├── __init__.py # Main dispatcher and 18 subcommands ├── __main__.py # `python -m gnn.cli` entry point ├── commands.py # Shared command semantics (dispatcher + API parity) ├── lsp.py # GNN Language Server (stdio) ├── mcp.py # MCP tool surface for CLI subcommands ├── templates.py # Maintained template index and copy helpers ├── template_index.json # Externalized template metadata ├── template_assets/ # Packaged GNN template files ├── AGENTS.md # This file ├── README.md # Usage guide ├── SPEC.md # Module specification └── SKILL.md # Capability API ``` ## References - [README.md](README.md) — Usage guide with examples - [SPEC.md](SPEC.md) — Specification --- ## Documentation - **[README](README.md)**: Module Overview - **[AGENTS](AGENTS.md)**: Agentic Workflows - **[SPEC](SPEC.md)**: Architectural Specification - **[SKILL](SKILL.md)**: Capability API