Demo 17 - GitHub Copilot CLI
This starter demonstrates an end-to-end JavaScript coding task from the
terminal. TicketQueue loads successfully, but two methods intentionally throw
Not implemented. The tests and TASK.md define the expected behavior.
Prerequisites
- Node.js 18 or later
- PowerShell 6+ on Windows
- An active GitHub Copilot subscription with Copilot CLI enabled
-
GitHub Copilot CLI installed:
winget install GitHub.Copilot
The tests use Node’s built-in test runner, so no package installation is needed. Before presenting, run this from the demo folder to confirm that the starter fails only because the two methods are unfinished:
npm test
Live demo
-
Start Copilot CLI in the demo folder:
cd Javascript\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 @issueDesk.js. 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 Node.js 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 npm test 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 Node.js commands needed for this task.
-
Run a shell command directly from the Copilot prompt:
!git diff -- issueDesk.js issueDesk.test.jsThe
!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 Javascript/17-github-copilot-cli
git clean -fd Javascript/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.