|
Option C Tools
|
Classes | |
| class | ToolExecutor |
Variables | |
| dict | _ARGV_BUILDERS |
Purpose
-------
Tool Executor (Layer 4, inner logic) for the ``oct-mcp`` six-layer
pipeline. Maps validated tool arguments to ``oct`` CLI argv lists and
delegates execution to :class:`oct.mcp.sandbox.SandboxExecutor`.
Responsibilities
----------------
- Provide one ``_build_argv_<tool>()`` function per Phase 5A tool that
converts a validated Pydantic model to an ``["oct", subcommand, ...]``
argv list.
- Provide :class:`ToolExecutor` which wires together the Pydantic model
dict and the sandbox.
- Never import oct internals directly — always call the ``oct`` CLI as
a subprocess (blueprint §5.5 isolation principle, design decision D3).
Diagnostics
-----------
Domain: MCP
Levels:
L2 — lifecycle: tool execution
L3 — argv details
L4 — deep trace
Contracts
---------
- This module does not import ``click`` or the MCP SDK.
- ``_build_argv_*()`` functions accept a ``dict`` (from
``model.model_dump()``) and return a ``list[str]``. They never raise
for valid validated input.
- :meth:`ToolExecutor.execute` never raises — it returns
:class:`~oct.mcp.sandbox.SandboxResult` directly from the sandbox.
|
protected |
Build argv for ``oct clean``.
Definition at line 264 of file executor.py.
|
protected |
Build argv for ``oct deps``. OI-502: no longer emits ``--check``; that flag is not accepted by the CLI. Pin auditing is instead available via ``--audit-pins`` (not modelled here yet).
Definition at line 106 of file executor.py.
|
protected |
Build argv for ``oct diag <subcommand>``. OI-502: no longer emits ``--json``; no diag subcommand currently accepts that flag (``validate-config`` may grow one via OI-534, at which point this builder will conditionally re-emit it).
Definition at line 145 of file executor.py.
|
protected |
Build argv for ``oct docs``.
Definition at line 210 of file executor.py.
|
protected |
Build argv for ``oct export-source``.
Definition at line 226 of file executor.py.
|
protected |
Build argv for ``oct format``. Uses ``--dry-run`` unless ``apply=True`` AND ``confirm=True``. The safety gate enforces this rule upstream; the argv builder also checks ``_dry_run_override`` (set by execute_write()) as a redundant guard.
Definition at line 185 of file executor.py.
|
protected |
Build argv for ``oct git changelog``.
Definition at line 318 of file executor.py.
|
protected |
Build argv for ``oct git check``.
Definition at line 167 of file executor.py.
|
protected |
Build argv for ``oct git commit``. Note: ``--no-verify`` is intentionally omitted — bypassing hooks is never permitted via MCP (design decision D-5B-6).
Definition at line 283 of file executor.py.
|
protected |
Build argv for ``oct git hooks install``.
Definition at line 298 of file executor.py.
|
protected |
Build argv for ``oct git init``.
Definition at line 306 of file executor.py.
|
protected |
Build argv for ``oct git status``.
Definition at line 157 of file executor.py.
|
protected |
Build argv for ``oct health``.
Definition at line 83 of file executor.py.
|
protected |
Build argv for ``oct install-hooks`` (deprecated; calls git hooks install).
Definition at line 275 of file executor.py.
|
protected |
Build argv for ``oct lint``.
Definition at line 63 of file executor.py.
|
protected |
Build argv for ``oct new``.
Definition at line 240 of file executor.py.
|
protected |
Build argv for ``oct scaffold``.
Definition at line 255 of file executor.py.
|
protected |
Build argv for ``oct export-skeleton``. OI-502: no longer emits ``--output-dir``; that flag is not accepted by the CLI. The output destination is derived by the CLI from the project root.
Definition at line 93 of file executor.py.
|
protected |
Build argv for ``oct test``. OI-502: no longer emits ``--jobs``; the CLI does not accept it and the ``jobs`` field was removed from :class:`OctTestArgs`.
Definition at line 119 of file executor.py.
|
protected |
Build argv for ``oct typecheck``.
Definition at line 135 of file executor.py.
|
protected |
|
protected |
Definition at line 338 of file executor.py.