Lab 088: Copilot CLI: The Agent in Your TerminalΒΆ
Free-first design
Complete the guided exercise with Copilot Free or the included simulation. Paid features are optional and explicitly labeled.
AI Credit impact
Low for guided work; medium/high for agentic or repeated runs. Prefer automatic model selection, plan before acting, keep context focused, and avoid unnecessary parallel sessions.
What You'll LearnΒΆ
- Install and authenticate the current Copilot CLI
- Use interactive and programmatic workflows
- Configure agents, hooks, MCP, and approvals
- Apply command and policy safety checks
GH-300 alignmentΒΆ
Use Copilot features (25β30%). This mapping follows the GH-300 curriculum snapshot dated 2026-08-07. The official outline may retain older product wording such as βCopilot Editsβ; this lab teaches the current product experience and calls out that difference.
Concept MapΒΆ
sequenceDiagram
participant U as User
participant C as Copilot CLI
participant T as Terminal/MCP
U->>C: bounded task
C->>U: plan + approval request
U-->>C: approve safe scope
C->>T: command/tool call
T-->>C: explicit result
C-->>U: diff + validation
Hands-on ExerciseΒΆ
Step 1: Install the current CLIΒΆ
Use the official package (npm install -g @github/copilot), WinGet, Homebrew, or the release binary. The retired gh copilot extension is not this product.
Step 2: Start with a read-only promptΒΆ
Ask the CLI to explain the repository and propose a validation command. Inspect its plan and every requested permission.
Step 3: Add controlled automationΒΆ
Create a custom agent for documentation quality, a pre-command hook that blocks secret-printing commands, and one read-only MCP tool.
Step 4: Exercise programmatic modeΒΆ
Produce machine-readable output for a bounded task. Fail the workflow if the CLI proposes an unapproved write or destructive command.
Supporting kitΒΆ
The site build generates stable PDF and ZIP downloads. The ZIP contains the lab guide and every supporting file declared for this lab.