Extract coding-agent probes to shared module#76
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactor the
setupcommand's subprocess wrapper and artifact presence checks into a new sharedcoding_agentmodule so thatdoctorcan 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 fromcoding_agentto 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: Usescoding_agent.missing_components()to report what setup artifacts are actually missing instead of always suggestingassembly 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 themissing_components()logic.tests/test_doctor.py: Updated to mockcoding_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: Addedaai_cli.coding_agentas a source module to the architecture contract.Implementation details
run()wrapper usesstdin=subprocess.DEVNULLto fail fast on prompts (instead of hanging), captures output, and convertsTimeoutExpiredto a clean exit code 124 with a descriptive error message.mcp_present()shells out toclaude mcp get, while skill checks look forSKILL.mdfiles 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