Skip to content

Add GitHub Copilot CLI host adapter (manifest + hooks config) on the prepared core #24

Description

@ivklgn

Problem

The portable core is fully prepared for GitHub Copilot CLI, but the adapter files that enroll it as a host do not exist yet — the plugin cannot be installed or used from Copilot CLI. This issue adds the adapter on top of the prepared core; the goal is that Copilot works exactly like the existing hosts (Claude Code / Cursor / Codex) on the same core.

What already exists (do NOT re-implement or refactor)

Core readiness landed on dev (see .archcore/plugin/host-expansion-core-readiness.plan.md):

  • plugins/archcore/bin/lib/normalize-stdin.sh — all Copilot branches are in place: native camelCase detection fallback (toolName/toolArgs/hookEventName), field extraction from the escaped toolArgs string, deny semantics (archcore_hook_block emits {"permissionDecision":"deny",...} + exit 0 — on Copilot exit 2 is only a warning and does NOT block), info helpers emit top-level {"additionalContext":"..."}.
  • plugins/archcore/bin/session-start — copilot arm (top-level additionalContext), .plugin/plugin.json install-dir guard, passes copilot as the host arg to archcore hooks.
  • test/fixtures/stdin/copilot/ — provisional native fixtures (+ README marking exactly what is provisional until real payload captures).
  • Tests: exact-output pins for every copilot branch, negative misroute guards, test/structure/host-coverage-matrix.bats (enrollment guard), test/structure/host-logic-locality.bats, test/unit/output-helpers-matrix.bats.

Decisions are final and recorded in .archcore/plugin/ — do not re-litigate:

  • copilot-adapter-design.adr.md — native adapter files (dedicated manifest + hooks config), subdir install archcore-ai/plugin:plugins/archcore, Copilot CLI only scope.
  • copilot-host-support.rnd.md — verified contract facts (manifest discovery order, hook payload shape, deny semantics, env vars).
  • host-adapter-contract.spec.md — adapter obligations; adapters are pure config, no logic outside bin/.

Expected result

A Copilot CLI session with the plugin installed behaves like the shipped hosts: session-start injects .archcore context, direct Write/Edit to .archcore/*.md is denied with the redirect-to-MCP message, MCP document tools work, post-tool validation/cascade info arrives.

Proposed approach

  • plugins/archcore/.plugin/plugin.json — manifest with explicit paths: "hooks": "./hooks/copilot.hooks.json" (critical: default discovery would otherwise pick up Claude's hooks/hooks.json), "mcpServers": "./.mcp.json", "skills": "./skills/", "agents": "./agents/".
  • plugins/archcore/hooks/copilot.hooks.json — camelCase events: sessionStartbin/session-start; preToolUse matcher create|edit|str_replace_editor|apply_patchbin/check-archcore-write + bin/check-code-alignment; postToolUse entries (self-filtering by ARCHCORE_TOOL_NAME, cursor afterMCPExecution pattern). Commands via "${COPILOT_PLUGIN_ROOT}"/bin/.... Every entry carries "env": {"ARCHCORE_HOST": "copilot"} — deterministic detection; the stdin heuristic is fallback only.
  • Makefile — add both new JSON files to JSON_FILES.
  • test/structure/copilot-plugin.bats (manifest validity, hooks path, version parity with .claude-plugin/plugin.json) + enroll a copilot row in test/structure/host-coverage-matrix.bats (the enrollment guard fails CI until you do).
  • Smoke validation (maintainer-owned release gate): install via archcore-ai/plugin:plugins/archcore in a scratch project, capture real hook payloads, replace the provisional fixtures, confirm deny-JSON actually blocks (and exit 2 does not). Contingencies A/B/C are pre-planned in host-expansion-core-readiness.plan.md — none require core refactoring.

Acceptance criteria

  • Live Copilot CLI: write guard denies, MCP tools work, session-start context arrives.
  • All existing exact-output pins for claude-code/cursor/codex stay green untouched (shipped hosts byte-identical — enforced by host-logic-locality.bats and the pin tests).
  • make test, make lint, make check-json green; provisional fixtures replaced with real captures.

Dependencies

  • needs-cli: the Go CLI must accept archcore hooks copilot session-start. Today an unknown host degrades silently (guard still works, context load does not) — needs a companion issue in the CLI repo.

References

.archcore/plugin/copilot-adapter-design.adr.md, copilot-host-support.rnd.md, host-adapter-contract.spec.md, host-expansion-core-readiness.plan.md, test/fixtures/stdin/copilot/README.md.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:hooksPreToolUse/PostToolUse/SessionStart hooksneeds-cliDepends on the separate Archcore CLI (Go) repopriority:P2Valuable follow-upsize:M1-3 days

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions