Skip to content

feat: support SPECKIT_INTEGRATION_<KEY>_EXECUTABLE env var#2743

Merged
mnriem merged 5 commits into
mainfrom
copilot/support-speckit-integration-executable-env-var
May 29, 2026
Merged

feat: support SPECKIT_INTEGRATION_<KEY>_EXECUTABLE env var#2743
mnriem merged 5 commits into
mainfrom
copilot/support-speckit-integration-executable-env-var

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 28, 2026

Operators had no way to override the CLI binary path for an integration without modifying integration configuration, making it difficult to pin a specific version or use a non-standard install location.

Changes

IntegrationBase._resolve_executable() (new method)

  • Reads SPECKIT_INTEGRATION_<KEY>_EXECUTABLE; key is uppercased with hyphens→underscores (e.g. kiro-cliSPECKIT_INTEGRATION_KIRO_CLI_EXECUTABLE)
  • Whitespace-only/unset → falls back to self.key (no behaviour change for existing users)

All build_exec_args() implementations updated to call self._resolve_executable() as the first argv token:

  • Base classes: MarkdownIntegration, TomlIntegration, SkillsIntegration
  • Override integrations: CodexIntegration, DevinIntegration, OpencodeIntegration, HermesIntegration, AgyIntegration

CopilotIntegration overrides _resolve_executable() to check the env var first, then fall back to the platform-specific default (copilot.cmd on Windows, copilot elsewhere). dispatch_command() is updated alongside build_exec_args().

Example

# Use a specific claude binary without changing any config
SPECKIT_INTEGRATION_CLAUDE_EXECUTABLE=/opt/claude-beta/bin/claude speckit run ...

# Works for hyphenated keys too
SPECKIT_INTEGRATION_KIRO_CLI_EXECUTABLE=/usr/local/bin/kiro-cli speckit run ...

SPECKIT_INTEGRATION_<KEY>_EXECUTABLE and SPECKIT_INTEGRATION_<KEY>_EXTRA_ARGS are independent and can be used simultaneously.

Copilot AI self-assigned this May 28, 2026
Copilot AI review requested due to automatic review settings May 28, 2026 19:24
Copilot AI review requested due to automatic review settings May 28, 2026 19:24
Adds `IntegrationBase._resolve_executable()` which reads
`SPECKIT_INTEGRATION_<KEY>_EXECUTABLE` (hyphens→underscores, uppercased)
and falls back to `self.key` when unset or whitespace-only.

All concrete `build_exec_args()` implementations now call
`self._resolve_executable()` instead of hard-coding `self.key` or
`"agy"` as the first argv token:
- MarkdownIntegration, TomlIntegration, SkillsIntegration (base classes)
- CodexIntegration, DevinIntegration, OpencodeIntegration, HermesIntegration, AgyIntegration
- CopilotIntegration (overrides `_resolve_executable()` to fall back to
  the platform-specific `_copilot_executable()` default; also updates
  `dispatch_command()` to use `_resolve_executable()`)

Tests added to tests/integrations/test_extra_args.py covering:
- default (unset) falls back to key
- env var replaces first argv token
- whitespace-only env var is a no-op
- key hyphen→underscore normalisation
- cross-integration scoping (wrong key ignored)
- all override integrations (Codex, Devin, Opencode, Copilot)
- Copilot dispatch_command path
- EXECUTABLE and EXTRA_ARGS can be set simultaneously

See issue #2596."
Copilot AI requested review from Copilot and removed request for Copilot May 28, 2026 19:31
Copilot AI requested review from Copilot and removed request for Copilot May 28, 2026 19:33
Copilot AI changed the title [WIP] Add support for SPECKIT_INTEGRATION_EXECUTABLE env var to override executable feat: support SPECKIT_INTEGRATION_<KEY>_EXECUTABLE env var May 28, 2026
Copilot finished work on behalf of mnriem May 28, 2026 19:33
Copilot AI requested a review from mnriem May 28, 2026 19:33
@mnriem mnriem marked this pull request as ready for review May 28, 2026 21:24
Copilot AI review requested due to automatic review settings May 28, 2026 21:24
@mnriem mnriem requested review from Copilot and removed request for Copilot May 28, 2026 21:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an operator-facing escape hatch to override which CLI binary an integration uses (without changing integration config), by introducing a shared IntegrationBase._resolve_executable() that reads SPECKIT_INTEGRATION_<KEY>_EXECUTABLE and wiring it into integration argv construction (with a Copilot-specific override to preserve copilot.cmd behavior on Windows).

Changes:

  • Introduce IntegrationBase._resolve_executable() to resolve the executable from SPECKIT_INTEGRATION_<KEY>_EXECUTABLE (with hyphen→underscore normalization) and fall back to self.key for backward compatibility.
  • Update base and overridden build_exec_args() implementations to use _resolve_executable() as argv[0]; update CopilotIntegration.dispatch_command() similarly, with Copilot overriding _resolve_executable() to preserve platform defaults.
  • Extend the existing env-var test suite to cover the new executable override behavior alongside extra-args behavior.
Show a summary per file
File Description
tests/integrations/test_extra_args.py Expands tests to cover *_EXECUTABLE override and updates env cleanup/docstrings.
src/specify_cli/integrations/base.py Adds _resolve_executable() and wires it into shared base build_exec_args() implementations.
src/specify_cli/integrations/codex/init.py Uses _resolve_executable() for argv[0] in Codex override.
src/specify_cli/integrations/devin/init.py Uses _resolve_executable() for argv[0] in Devin override.
src/specify_cli/integrations/opencode/init.py Uses _resolve_executable() for argv[0] in Opencode override.
src/specify_cli/integrations/hermes/init.py Uses _resolve_executable() for argv[0] in Hermes override.
src/specify_cli/integrations/copilot/init.py Adds Copilot-specific _resolve_executable() and updates build/dispatch argv[0] usage.
src/specify_cli/integrations/agy/init.py Uses _resolve_executable() for argv[0] in Agy override.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 8/8 changed files
  • Comments generated: 2

Comment thread tests/integrations/test_extra_args.py Outdated
Comment thread tests/integrations/test_extra_args.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 1

Comment thread src/specify_cli/integrations/codex/__init__.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 8/8 changed files
  • Comments generated: 0 new

@mnriem mnriem merged commit b4e5a1c into main May 29, 2026
13 checks passed
@mnriem mnriem deleted the copilot/support-speckit-integration-executable-env-var branch May 29, 2026 15:19
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.

Support SPECKIT_INTEGRATION_<KEY>_EXECUTABLE env var to override agent subprocess executable

3 participants