Skip to content

Commit ad69d44

Browse files
hubwriterSiaraMistCopilot
authored
Copilot CLI best practices clarification (#59458)
Co-authored-by: Siara <108543037+SiaraMist@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 8af3482 commit ad69d44

File tree

1 file changed

+54
-15
lines changed

1 file changed

+54
-15
lines changed

content/copilot/how-tos/copilot-cli/cli-best-practices.md

Lines changed: 54 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ For best results on complex tasks:
199199

200200
**Session storage location:**
201201

202-
```copilot
202+
```text
203203
~/.copilot/session-state/{session-id}/
204204
├── events.jsonl # Full session history
205205
├── workspace.yaml # Metadata
@@ -213,17 +213,38 @@ For best results on complex tasks:
213213
214214
### Session management commands
215215

216-
```bash
217-
# View session info
216+
To view information about the current CLI session, enter:
217+
218+
```copilot
218219
/session
220+
```
221+
222+
To view a list of any session checkpoints, enter:
219223

220-
# View checkpoint history
224+
```copilot
221225
/session checkpoints
226+
```
227+
228+
> [!NOTE]
229+
> A checkpoint is created when session context is compacted, and allows you to view the summary context that {% data variables.product.prodname_copilot_short %} created.
230+
231+
To view the details of a specific checkpoint, enter:
222232

223-
# View files in session
233+
```copilot
234+
/session checkpoints NUMBER
235+
```
236+
237+
where NUMBER specifies the checkpoint you want to display.
238+
239+
To view any temporary files that have been created during the current session—for example, artifacts created by {% data variables.product.prodname_copilot_short %} that shouldn't be saved to the repository—enter:
240+
241+
```copilot
224242
/session files
243+
```
244+
245+
To view the current plan (if {% data variables.product.prodname_copilot_short %} has generated one), enter:
225246

226-
# View current plan
247+
```copilot
227248
/session plan
228249
```
229250

@@ -317,7 +338,6 @@ Pair with {% data variables.copilot.copilot_cli_short %} to develop tests.
317338
* `/plan Migrate all class components to functional components with hooks`
318339

319340
Then answer the questions {% data variables.product.prodname_copilot_short %} asks. Review the plan it creates, and ask {% data variables.product.prodname_copilot_short %} to make changes if necessary. When you are happy with the plan you can prompt:
320-
321341
`Implement this plan`
322342

323343
## 6. Advanced patterns
@@ -352,13 +372,13 @@ copilot
352372

353373
**View and manage allowed directories:**
354374

355-
```bash
375+
```copilot
356376
/list-dirs
357377
```
358378

359379
**Example workflow: coordinated API changes**
360380

361-
```bash
381+
```copilot
362382
I need to update the user authentication API. The changes span:
363383
364384
- @/Users/me/projects/api-gateway (routing changes)
@@ -379,7 +399,7 @@ This multi-repository capability enables:
379399

380400
{% data variables.product.prodname_copilot_short %} can work with visual references. Simply **drag and drop** images directly into the CLI input, or reference image files:
381401

382-
```bash
402+
```copilot
383403
Implement this design: @mockup.png
384404
Match the layout and spacing exactly
385405
```
@@ -388,7 +408,7 @@ Match the layout and spacing exactly
388408

389409
For large-scale changes:
390410

391-
```bash
411+
```copilot
392412
Run the linter and write all errors to `migration-checklist.md` as a checklist.
393413
Then fix each issue one by one, checking them off as you go.
394414
```
@@ -424,16 +444,35 @@ Track metrics like:
424444
* Code review feedback cycles
425445
* Test coverage improvements
426446

427-
### Getting help
447+
## Getting help
448+
449+
From the command line, you can display help by using the command: `copilot -h`.
450+
451+
For help on various topics enter:
428452

429453
```bash
430-
# In-CLI help
454+
copilot help TOPIC
455+
```
456+
457+
where `TOPIC` can be one of: `config`, `commands`, `environment`, `logging`, or `permissions`.
458+
459+
### Within the CLI
460+
461+
For help within the CLI, enter:
462+
463+
```copilot
431464
/help
465+
```
432466

433-
# View usage statistics
467+
To view usage statistics, enter:
468+
469+
```copilot
434470
/usage
471+
```
435472

436-
# Submit feedback
473+
To submit private feedback to {% data variables.product.github %} about {% data variables.copilot.copilot_cli_short %}, raise a bug report, or submit a feature request, enter:
474+
475+
```copilot
437476
/feedback
438477
```
439478

0 commit comments

Comments
 (0)