Skip to content

Add cli_executable property to IntegrationBase for agents whose executable differs from their key#3748

Open
dhruv-15-03 wants to merge 1 commit into
github:mainfrom
dhruv-15-03:feat/2558-cli-executable-detection
Open

Add cli_executable property to IntegrationBase for agents whose executable differs from their key#3748
dhruv-15-03 wants to merge 1 commit into
github:mainfrom
dhruv-15-03:feat/2558-cli-executable-detection

Conversation

@dhruv-15-03

Copy link
Copy Markdown
Contributor

Summary

Adds a cli_executable property + is_cli_available() method to IntegrationBase so integrations whose runtime executable differs from their key (e.g. RovoDev: key=rovodev, executable acli) have a documented, non-hacky extension point, instead of requiring hardcoded special cases in check_tool().

Closes #2558.

Changes

  • integrations/base.py: new cli_executable property (delegates to the existing _resolve_executable() hook - honors self.key and the SPECKIT_INTEGRATION_<KEY>_EXECUTABLE env override) and is_cli_available() method (default: shutil.which(self.cli_executable) is not None).
  • _utils.py: check_tool() now delegates to get_integration(tool).is_cli_available() (lazy import to avoid a circular dependency) when the tool is a registered integration, removing the hardcoded claude / kiro-cli / rovodev branches. Falls back to plain shutil.which(tool) for unregistered tools (git, code, etc). CLAUDE_LOCAL_PATH / CLAUDE_NPM_LOCAL_PATH constants stay in _utils.py for backward compatibility with existing test patches.
  • ClaudeIntegration: overrides is_cli_available() to check the two known local install paths first, falling back to super().is_cli_available() (PATH check).
  • KiroCliIntegration: overrides is_cli_available() to accept both kiro-cli and the legacy kiro binary name.
  • RovodevIntegration: no code change needed - its existing _resolve_executable() override (returns acli) is picked up automatically by the new cli_executable property.
  • AGENTS.md: documents the new override mechanism (with the RovoDev example) and updates Common Pitfalls Add John Lam as contributor and release badge #1 to point at this escape hatch instead of implying every CLI integration needs key == executable.
  • Tests: new TestCliExecutableDetection in tests/integrations/test_base.py (default resolution, env-var override, is_cli_available() true/false, and using cli_executable rather than key for detection - mirroring RovoDev). All 9 existing tests/test_check_tool.py cases pass unmodified against the refactored check_tool().

Deliberate scope decision

The two workflow-step CLI-dispatch sites (workflows/steps/command/__init__.py, workflows/steps/prompt/__init__.py) are intentionally left unchanged. They already resolve differing executables correctly via an existing impl.key -> exec_args[0] fallback, and tests/test_workflows.py has 15+ cases patching shutil.which at those specific module paths. Migrating them to is_cli_available() would require rewriting most of those patches for no behavioral gain (they already work), so I have deferred that to a fast-follow rather than risk regressions in the workflow engine's test suite as part of this change. Happy to do that migration in a follow-up PR if maintainers would prefer it bundled.

Testing

  • pytest tests/test_check_tool.py tests/integrations/ - 160 passed, 1 skipped
  • Full suite: 4943 passed, 449 skipped, 58 failed - all 58 failures are pre-existing, unrelated symlink-permission tests (bundler/manifest/workflow path-traversal guards) that fail in this Windows sandbox because creating symlinks requires elevated privileges here; none touch files changed in this PR.
  • ruff check clean on all changed files.

AI disclosure

This PR was authored autonomously by an AI coding agent (GitHub Copilot, Claude Sonnet 5) operating under my supervision via the dhruv-15-03 account, per this repo's disclosure guidelines in AGENTS.md.

…table differs from their key

Closes github#2558.

- Add cli_executable property and is_cli_available() method to
  IntegrationBase. cli_executable delegates to the existing
  _resolve_executable() hook (key, or SPECKIT_INTEGRATION_<KEY>_EXECUTABLE
  override); is_cli_available() defaults to shutil.which(cli_executable).
- Refactor check_tool() in _utils.py to delegate to
  get_integration(tool).is_cli_available() when the tool is a registered
  integration, removing the hardcoded claude/kiro-cli/rovodev special cases.
  Falls back to a plain shutil.which(tool) for unregistered tools (git,
  code, etc).
- Override is_cli_available() in ClaudeIntegration (checks local
  install paths before falling back to PATH) and KiroCliIntegration
  (accepts both kiro-cli and legacy kiro binary names). RovoDev needs no
  change: its existing _resolve_executable() override already returns
  �cli, so cli_executable picks it up automatically.
- Scope note: the two workflow-step CLI-dispatch sites
  (workflows/steps/command, workflows/steps/prompt) are intentionally left
  unchanged in this PR. They already handle differing executables via an
  existing impl.key / exec_args[0] fallback, and tests/test_workflows.py
  has 15+ test cases patching shutil.which at those specific module paths;
  migrating them to is_cli_available() is deferred to a fast-follow to
  avoid unrelated test churn here.
- Document the new override mechanism in AGENTS.md, with the pitfall
  fully explained (RovoDev's key=rovodev vs executable=acli).
- Add TestCliExecutableDetection to tests/integrations/test_base.py
  covering default resolution, env-var override, and is_cli_available()
  true/false paths.

All 9 existing tests/test_check_tool.py cases and 160+ integration tests
pass unmodified.

Assisted-by: GitHub Copilot (model: claude-sonnet-5, autonomous)
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
@dhruv-15-03
dhruv-15-03 requested a review from mnriem as a code owner July 26, 2026 07:02
Copilot AI review requested due to automatic review settings July 26, 2026 07:02

Copilot AI left a comment

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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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.

Add cli_executable property to IntegrationBase for agents whose executable differs from their key

2 participants