Skip to content

Extract coding-agent probes to shared module#76

Merged
alexkroman merged 5 commits into
mainfrom
claude/focused-pasteur-6qp37g
Jun 11, 2026
Merged

Extract coding-agent probes to shared module#76
alexkroman merged 5 commits into
mainfrom
claude/focused-pasteur-6qp37g

Conversation

@alexkroman

Copy link
Copy Markdown
Collaborator

Summary

Refactor the setup command's subprocess wrapper and artifact presence checks into a new shared coding_agent module so that doctor can reuse them without creating a circular dependency between command modules.

Changes

  • New module aai_cli/coding_agent.py: Centralizes subprocess execution (run()), artifact location helpers (skills_root(), skill_dir(), cli_skill_dir()), and presence probes (mcp_present(), skill_installed(), cli_skill_installed(), missing_components()). Also defines shared constants (MCP_NAME, SKILL_NAME, CLI_SKILL_NAME).

  • aai_cli/commands/setup.py: Imports and aliases the shared functions/constants from coding_agent to keep call sites stable. Removes the now-redundant local implementations of _run(), _skills_root(), _mcp_present(), _skill_dir(), _skill_installed(), _cli_skill_dir(), and _cli_skill_installed().

  • aai_cli/commands/doctor.py: Uses coding_agent.missing_components() to report what setup artifacts are actually missing instead of always suggesting assembly setup install. The check now distinguishes between "fully installed" (reports success) and "partially installed" (names the missing pieces).

  • tests/test_coding_agent.py: New comprehensive test suite covering subprocess defaults, timeout handling, skill location resolution, presence probes, and the missing_components() logic.

  • tests/test_doctor.py: Updated to mock coding_agent.missing_components() in the healthy fixture (keeping the suite hermetic), and added regression tests for the new doctor output when setup is fully or partially complete.

  • .importlinter: Added aai_cli.coding_agent as a source module to the architecture contract.

Implementation details

  • The run() wrapper uses stdin=subprocess.DEVNULL to fail fast on prompts (instead of hanging), captures output, and converts TimeoutExpired to a clean exit code 124 with a descriptive error message.
  • Presence checks are independent: mcp_present() shells out to claude mcp get, while skill checks look for SKILL.md files on disk.
  • missing_components() returns a list of human-readable names for absent artifacts, enabling doctor to give actionable feedback about what's not yet installed.

https://claude.ai/code/session_01V26vhHZeP6FsmWt3Dhi6Dp

The coding-agent check only looked for the claude/npx binaries and always
suggested 'assembly setup install', even right after setup reported every
artifact as already installed.

Move the presence probes (docs MCP registered via 'claude mcp get', skills
on disk under the agent's skills root) out of commands/setup.py into a new
core module aai_cli/coding_agent.py — command modules are import-linter
independent, so doctor couldn't reach them in setup. Doctor now reports
"docs MCP + skills installed." when setup is complete, and otherwise names
exactly which artifacts 'assembly setup install' would add.

https://claude.ai/code/session_01V26vhHZeP6FsmWt3Dhi6Dp
@alexkroman alexkroman enabled auto-merge (squash) June 11, 2026 22:34
@alexkroman alexkroman merged commit cf0b499 into main Jun 11, 2026
8 checks passed
@alexkroman alexkroman deleted the claude/focused-pasteur-6qp37g branch June 11, 2026 22:51
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.

2 participants