diff --git a/adapters/ai/copilot.sh b/adapters/ai/copilot.sh new file mode 100644 index 0000000..16608af --- /dev/null +++ b/adapters/ai/copilot.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# GitHub Copilot CLI adapter + +# Check if GitHub Copilot CLI is available +ai_can_start() { + command -v copilot >/dev/null 2>&1 +} + +# Start GitHub Copilot CLI in a directory +# Usage: ai_start path [args...] +ai_start() { + local path="$1" + shift + + if ! ai_can_start; then + log_error "GitHub Copilot CLI not found." + log_info "Install with: npm install -g @github/copilot" + log_info "Or: brew install copilot-cli" + log_info "See https://github.com/github/copilot-cli for more information" + return 1 + fi + + if [ ! -d "$path" ]; then + log_error "Directory not found: $path" + return 1 + fi + + # Change to the directory and run copilot with any additional arguments + (cd "$path" && copilot "$@") +} diff --git a/bin/gtr b/bin/gtr index ea28d08..a997da3 100755 --- a/bin/gtr +++ b/bin/gtr @@ -1119,7 +1119,7 @@ load_ai_adapter() { if ! command -v "$cmd_name" >/dev/null 2>&1; then log_error "AI tool '$ai_tool' not found" - log_info "Built-in adapters: aider, claude, codex, continue, cursor, gemini, opencode" + log_info "Built-in adapters: aider, claude, codex, continue, copilot, cursor, gemini, opencode" log_info "Or use any AI tool command available in your PATH (e.g., bunx, gpt)" exit 1 fi @@ -1293,7 +1293,7 @@ CONFIGURATION OPTIONS: atom, none gtr.ai.default Default AI tool Options: aider, claude, codex, continue, - cursor, gemini, opencode, none + copilot, cursor, gemini, opencode, none gtr.copy.include Files to copy (multi-valued) gtr.copy.exclude Files to exclude (multi-valued) gtr.copy.includeDirs Directories to copy (multi-valued) diff --git a/completions/_git-gtr b/completions/_git-gtr index 73df9f9..d56a35a 100644 --- a/completions/_git-gtr +++ b/completions/_git-gtr @@ -86,7 +86,7 @@ _git-gtr() { _arguments '--editor[Editor to use]:editor:(cursor vscode zed idea pycharm webstorm vim nvim emacs sublime nano atom none)' ;; ai) - _arguments '--ai[AI tool to use]:tool:(aider claude codex continue cursor gemini opencode none)' + _arguments '--ai[AI tool to use]:tool:(aider claude codex continue copilot cursor gemini opencode none)' ;; rm) _arguments \