Skip to content

feat: add GitHub Copilot CLI as new provider#122

Merged
bfly123 merged 2 commits intobfly123:mainfrom
LeoLin990405:feat/copilot-cli-provider
Mar 10, 2026
Merged

feat: add GitHub Copilot CLI as new provider#122
bfly123 merged 2 commits intobfly123:mainfrom
LeoLin990405:feat/copilot-cli-provider

Conversation

@LeoLin990405
Copy link
Contributor

@LeoLin990405 LeoLin990405 commented Mar 10, 2026

Summary / 概要

Adds GitHub Copilot CLI (gh copilot) as a new CCB provider, addressing #118.

为 CCB 添加 GitHub Copilot CLI (gh copilot) 作为新的 AI 提供者,解决 #118

Naming Convention / 命名约定

Item Value Rationale
Provider key copilot Matches the CLI tool
Prefix hask From "gH copilot" — avoids collisions with existing prefixes
Specs HASKD_SPEC / HASK_CLIENT_SPEC Standard pattern
CLI scripts bin/hask, bin/hpend, bin/hping Standard pattern
Session file .copilot-session In .ccb/ project dir

New Files (7) / 新增文件

  • lib/haskd_session.py — Session management (simplified from Droid, no JSONL binding)
  • lib/haskd_protocol.py — CCB protocol helpers (wrap_copilot_prompt, extract_reply_for_req)
  • lib/copilot_comm.py — Pane-log reader and communicator (ANSI stripping, marker detection)
  • lib/askd/adapters/copilot.py — Unified daemon adapter (CopilotAdapter)
  • bin/hask — Send message to Copilot (sync CLI)
  • bin/hpend — View latest Copilot reply
  • bin/hping — Test Copilot connectivity

Modified Files (6) / 修改文件

  • lib/providers.py — Added HASKD_SPEC and HASK_CLIENT_SPEC
  • lib/askd/adapters/__init__.py — Export CopilotAdapter
  • bin/askd — Register copilot adapter
  • bin/ask — Add copilot to provider dispatch tables
  • install.sh — Add new scripts to SCRIPTS_TO_LINK
  • test/stubs/provider_stub.py — Add copilot stub

Design Decisions / 设计决策

  1. Pane-log communicationgh copilot has no JSONL session logs; reads from tmux pipe-pane log with ANSI stripping
  2. Same CCB protocol — Uses standard CCB_REQ_ID/CCB_DONE markers
  3. Simplified session — No external session binding needed (unlike Droid)
  4. Pattern compliance — Follows Droid adapter pattern exactly

Test Plan / 测试计划

  • All 13 files pass Python syntax check (python3 -c "compile(open(f).read(), f, 'exec')")
  • Adapter import: from askd.adapters.copilot import CopilotAdapter
  • bin/askd recognizes copilot in provider list
  • install.sh includes new scripts
  • Manual test with gh copilot (requires active Copilot subscription)
  • Existing test suite passes without regressions (112 passed, 0 failed)

Closes #118

Add `gh copilot` support as a new CCB provider with prefix `hask`,
following the existing Droid provider pattern. Uses pane-log based
communication since Copilot has no structured JSONL session logs.

New files:
- lib/haskd_session.py - session management
- lib/haskd_protocol.py - CCB protocol helpers
- lib/copilot_comm.py - pane-log reader and communicator
- lib/askd/adapters/copilot.py - unified daemon adapter
- bin/hask, bin/hpend, bin/hping - CLI scripts

Modified: providers.py, askd, ask, install.sh, adapters/__init__.py,
provider_stub.py

Closes bfly123#118
- Remove unused import (safe_write_session) and attribute (marker_prefix)
- Add emoji prefixes to error/success messages for consistency with Droid
- Fix type: ignore by using assert for type narrowing
- Isolate copilot stub session path to avoid data pollution with Droid
@bfly123 bfly123 merged commit 36e6f7b into bfly123:main Mar 10, 2026
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.

Feature Request: Add GitHub Copilot CLI support

2 participants