|
| | cli (ctx, root_dir, allow_outside_project, strict_config, log_output) |
| | lint (ctx, args) |
| | format (ctx, args) |
| | new (ctx, path, force, test, dry_run, verbose) |
| | scaffold (name, dry_run, no_venv, with_claude) |
| | docs (ctx, sphinx_mode, doxygen_mode, all_mode, clean_mode, dry_run) |
| bool | _pytest_missing (str combined_output) |
| None | _run_pytest (Path project_root, tuple args, bool json_mode=False) |
| Path|None | _map_source_to_test (Path source, Path project_root) |
| | test (ctx, json_mode, changed, args) |
| | export_source (ctx, verbose, clean, single_dir, allow_outside_project, warn_secrets, block_secrets, diff_ref, path) |
| | export_skeleton (ctx, json_mode, verbose, single_dir, no_diagnostics, clean, allow_outside_project, path) |
| | clean (ctx, path, dry_run, allow_outside_project) |
| | health (ctx, json_mode, verbose, test_timeout) |
| | deps (ctx, args) |
| | install_hooks_cmd (ctx, force) |
| | typecheck (ctx, json_mode, args) |
| | diag (ctx) |
| | diag_validate_config (ctx, bool strict) |
| | diag_list_domains (ctx) |
| | diag_set_level (ctx, domain, level, bool dry_run) |
| | diag_restore (ctx) |
| | diag_migrate_config (ctx, Path|None config_path, bool dry_run) |
| | install_mcp (ctx, host, dry_run) |
Purpose
-------
Provide the main command-line interface for the OCT (Option C Tools) ecosystem.
Responsibilities
----------------
- Define top-level commands: oct lint, oct format, oct new, oct scaffold, oct docs,
oct test, oct export-source, oct clean, oct health.
- Delegate work to the appropriate OCT modules.
- Scaffold new Option C projects with a correct ``oc_diagnostics/debug_config.json``
pre-configured for use with ``oc_diagnostics``.
- Set up Sphinx documentation templates in ``docs/``.
- Ensure consistent behavior across all projects.
Diagnostics
-----------
Domain: OCT-CLI
Levels:
L2 — lifecycle
L3 — semantic details
L4 — deep tracing
Contracts
---------
- Must be installed as the console entry point for the OCT package.
- Must not contain business logic; only dispatching.
- Scaffolded ``debug_config.json`` must be a valid ``oc_diagnostics`` configuration.
Dependencies
------------
- oct (package version)
- oct.core.project_root (project root detection)
- oct.linter.oct_lint (linter command implementation)
- oct.formatter.oct_format (formatter command implementation)
- oct.health.oct_health (health dashboard command)
- oct.generator.new_python_file (new file scaffolding)
- oct.diag.oct_diag (diagnostics config commands)
- oct.deps.oct_deps (dependency graph command)
- oct.hooks.oct_hooks (pre-commit hooks generator)
- oct.typecheck.oct_typecheck (type-checking wrapper)
- click (CLI framework)
| None oct.cli._run_pytest |
( |
Path | project_root, |
|
|
tuple | args, |
|
|
bool | json_mode = False ) |
|
protected |
Run pytest in *project_root* and exit on failure.
When *json_mode* is True, captures pytest output, parses the summary
line, and emits a machine-readable JSON object to stdout:
``{"tool": "test", "passed": N, "failed": N, "errors": N,
"warnings": N, "output": "...", "exit_code": N}``
OI-511: pytest is now declared in the ``[project.optional-dependencies].test``
extra rather than as a runtime dependency; if ``python -m pytest`` reports
it is not importable, emit the install hint above and exit 1.
Definition at line 498 of file cli.py.