Demo 17 - GitHub Copilot CLI
This starter demonstrates an end-to-end Python coding task from the terminal.
TicketQueue imports successfully, but two methods intentionally raise
NotImplementedError. The tests and TASK.md define the expected behavior.
Prerequisites
- Python 3.12 or later
- pytest (
python -m pip install pytest) - PowerShell 6+ on Windows
- An active GitHub Copilot subscription with Copilot CLI enabled
-
GitHub Copilot CLI installed:
winget install GitHub.Copilot
Before presenting, run this from the demo folder to confirm that the starter fails only because the two methods are unfinished:
python -m pytest -q
Live demo
-
Start Copilot CLI in the demo folder:
cd Python\17-github-copilot-cli copilotExplain the trust prompt: Copilot can read, edit, and run files below the trusted directory. Choose session-only trust for a training machine.
-
If needed, authenticate with
/login. Enter?to show available commands, then use/modelto show that the model can be selected without leaving the terminal. -
Demonstrate explicit file context without making changes:
Explain @TASK.md and @issue_desk.py. Identify the unfinished behavior and the tests that should prove it. Do not edit files yet. -
Press Shift+Tab to enter plan mode, then prompt:
Plan the smallest implementation that satisfies @TASK.md and the existing pytest tests. Include the validation commands you will run.Review the proposed approach before any code changes. Press Shift+Tab again to return to the normal interactive mode.
-
Ask Copilot to complete the task:
Implement the approved plan. Keep the public API unchanged, add tests only for uncovered edge cases, and run pytest when finished.Pause at the first tool request. Explain one-time approval, approval for the rest of the session, and rejection with feedback. Approve only the specific file edits and Python commands needed for this task.
-
Run a shell command directly from the Copilot prompt:
!git diff -- issue_desk.py test_issue_desk.pyThe
!prefix runs a shell command without a model request. Then ask:Review this diff against @TASK.md. Report correctness issues and missing test cases before suggesting any additional edits. -
Show session controls with
/contextand/usage, then exit. Resume the latest session later with:copilot --continue
Reset after the demo
From the repository root, restore the starter implementation and remove any extra files Copilot created:
git restore Python/17-github-copilot-cli
git clean -fd Python/17-github-copilot-cli
Review untracked files before using git clean on a shared working tree.
Talking points
- Copilot CLI is the coding agent in a terminal, not the legacy
gh copilotcommand for command suggestions. @pathmakes file context explicit; plan mode separates design from editing.- Tool approval keeps file changes and command execution under human control.
- Agentic work must end with executable validation, not a plausible-looking diff.
!command, session resume, context usage, and model selection keep the workflow terminal-native.