Skip to content

feat: add deterministic MCP context CLI#199

Merged
ProfRandom92 merged 3 commits into
mainfrom
feat/mcp-context-cli
May 22, 2026
Merged

feat: add deterministic MCP context CLI#199
ProfRandom92 merged 3 commits into
mainfrom
feat/mcp-context-cli

Conversation

@ProfRandom92
Copy link
Copy Markdown
Owner

Summary

Adds a minimal deterministic CLI/tool entrypoint for the MCP context layer and repo-local Codex workflow skill docs.

This introduces:

  • scripts/mcp_context_cli.py
  • deterministic JSON output mode
  • compact human-readable prompt-context output
  • validation output support
  • focused CLI determinism tests
  • documentation for CLI usage
  • repo-local Codex workflow skill docs under docs/codex_skills/

Scope

This is intentionally not:

  • an MCP server
  • an autonomous agent runtime
  • a tool execution runtime
  • a background service
  • semantic scoring
  • embedding-based memory
  • vector search
  • external API integration

Validation

  • python -m compileall -q src/comptext_v7/mcp
  • pytest tests/test_mcp_context_layer.py -q

Notes

The CLI is the first practical interface layer on top of the deterministic MCP context primitives. It keeps output deterministic, replay-safe, and fixture-bound while enabling local/client usage without adding runtime orchestration.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces several new 'Skill' documentation files to define workflows for artifact validation, documentation positioning, Git PR management, and MCP context layer development. Additionally, it adds a new CLI tool in scripts/mcp_context_cli.py for generating deterministic MCP context-layer outputs, along with updated documentation and new tests. Feedback was provided to enhance the CLI's error handling by explicitly catching JSON decoding errors and utilizing repository-relative paths in error messages.

Comment thread scripts/mcp_context_cli.py Outdated
Comment on lines +20 to +27
def _load_json(path: Path) -> dict[str, Any]:
try:
payload = json.loads(path.read_text(encoding="utf-8"))
except FileNotFoundError as exc:
raise RuntimeError(f"missing required fixture file: {path.as_posix()}") from exc
if not isinstance(payload, dict):
raise RuntimeError(f"fixture file must contain a JSON object: {path.as_posix()}")
return payload
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The _load_json function should handle json.JSONDecodeError and use repo-relative paths in error messages to align with the repository's general rules for JSON processing.

Suggested change
def _load_json(path: Path) -> dict[str, Any]:
try:
payload = json.loads(path.read_text(encoding="utf-8"))
except FileNotFoundError as exc:
raise RuntimeError(f"missing required fixture file: {path.as_posix()}") from exc
if not isinstance(payload, dict):
raise RuntimeError(f"fixture file must contain a JSON object: {path.as_posix()}")
return payload
def _load_json(path: Path) -> dict[str, Any]:
rel_path = _repo_relative(path)
try:
payload = json.loads(path.read_text(encoding="utf-8"))
except FileNotFoundError as exc:
raise RuntimeError(f"missing required fixture file: {rel_path}") from exc
except json.JSONDecodeError as exc:
raise RuntimeError(f"failed to decode JSON in fixture file: {rel_path}") from exc
if not isinstance(payload, dict):
raise RuntimeError(f"fixture file must contain a JSON object: {rel_path}")
return payload
References
  1. JSON loading should handle both FileNotFoundError and JSONDecodeError by raising a RuntimeError with a repo-relative path, and validate the payload type.

@ProfRandom92 ProfRandom92 merged commit c604d67 into main May 22, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant