mirror of
https://github.com/github/spec-kit.git
synced 2026-07-03 12:28:06 +08:00
Add util for windows sub-process (#2598)
* Add util for windows sub-process * Use platform-aware Copilot executable in subprocess calls * Update test_workflows.py
This commit is contained in:
@@ -24,6 +24,16 @@ from ..base import IntegrationBase, IntegrationOption, SkillsIntegration
|
||||
from ..manifest import IntegrationManifest
|
||||
|
||||
|
||||
def _copilot_executable() -> str:
|
||||
"""Return the executable name for Copilot CLI on this platform.
|
||||
|
||||
On Windows, subprocess invocation is reliable with `copilot.cmd`.
|
||||
"""
|
||||
if os.name == "nt":
|
||||
return "copilot.cmd"
|
||||
return "copilot"
|
||||
|
||||
|
||||
def _allow_all() -> bool:
|
||||
"""Return True if the Copilot CLI should run with full permissions.
|
||||
|
||||
@@ -138,7 +148,7 @@ class CopilotIntegration(IntegrationBase):
|
||||
# Controlled by SPECKIT_COPILOT_ALLOW_ALL_TOOLS env var
|
||||
# (default: enabled). The deprecated SPECKIT_ALLOW_ALL_TOOLS
|
||||
# is also honoured as a fallback.
|
||||
args = ["copilot", "-p", prompt]
|
||||
args = [_copilot_executable(), "-p", prompt]
|
||||
if _allow_all():
|
||||
args.append("--yolo")
|
||||
if model:
|
||||
@@ -206,7 +216,7 @@ class CopilotIntegration(IntegrationBase):
|
||||
agent_name = f"speckit.{stem}"
|
||||
prompt = args or ""
|
||||
|
||||
cli_args = ["copilot", "-p", prompt]
|
||||
cli_args = [_copilot_executable(), "-p", prompt]
|
||||
if not skills_mode:
|
||||
cli_args.extend(["--agent", agent_name])
|
||||
if _allow_all():
|
||||
|
||||
@@ -13,6 +13,7 @@ Covers:
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from pathlib import Path
|
||||
@@ -373,7 +374,8 @@ class TestBuildExecArgs:
|
||||
from specify_cli.integrations.copilot import CopilotIntegration
|
||||
impl = CopilotIntegration()
|
||||
args = impl.build_exec_args("do stuff", model="claude-sonnet-4-20250514")
|
||||
assert args[0] == "copilot"
|
||||
expected_exec = "copilot.cmd" if os.name == "nt" else "copilot"
|
||||
assert args[0] == expected_exec
|
||||
assert "-p" in args
|
||||
assert "--yolo" in args
|
||||
assert "--model" in args
|
||||
|
||||
Reference in New Issue
Block a user