Skip to content

Commit 8fa9f11

Browse files
docs-botgithub-actions[bot]hubwriter
authored
docs: update copilot-cli content from source docs (#60663)
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: hubwriter <hubwriter@github.com>
1 parent 8d835e1 commit 8fa9f11

File tree

2 files changed

+320
-3
lines changed

2 files changed

+320
-3
lines changed

content/copilot/reference/copilot-cli-reference/cli-command-reference.md

Lines changed: 319 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,323 @@ Prompt hooks auto-submit text as if the user typed it. They are only supported o
415415
| `errorOccurred` | An error occurs during execution. | No |
416416
| `notification` | Fires asynchronously when the CLI emits a system notification (shell completion, agent completion or idle, permission prompts, elicitation dialogs). Fire-and-forget: never blocks the session. Supports `matcher` regex on `notification_type`. | Optional — can inject `additionalContext` into the session. |
417417

418+
### Hook event input payloads
419+
420+
Each hook event delivers a JSON payload to the hook handler. Two payload formats are supported, selected by the event name used in the hook configuration:
421+
422+
* **camelCase format** — Configure the event name in camelCase (for example, `sessionStart`). Fields use camelCase.
423+
* **{% data variables.product.prodname_vscode_shortname %} compatible format** — Configure the event name in PascalCase (for example, `SessionStart`). Fields use snake_case to match the {% data variables.product.prodname_vscode_shortname %} {% data variables.product.prodname_copilot_short %} extension format.
424+
425+
#### `sessionStart` / `SessionStart`
426+
427+
**camelCase input:**
428+
429+
```typescript
430+
{
431+
sessionId: string;
432+
timestamp: number; // Unix timestamp in milliseconds
433+
cwd: string;
434+
source: "startup" | "resume" | "new";
435+
initialPrompt?: string;
436+
}
437+
```
438+
439+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
440+
441+
```typescript
442+
{
443+
hook_event_name: "SessionStart";
444+
session_id: string;
445+
timestamp: string; // ISO 8601 timestamp
446+
cwd: string;
447+
source: "startup" | "resume" | "new";
448+
initial_prompt?: string;
449+
}
450+
```
451+
452+
#### `sessionEnd` / `SessionEnd`
453+
454+
**camelCase input:**
455+
456+
```typescript
457+
{
458+
sessionId: string;
459+
timestamp: number;
460+
cwd: string;
461+
reason: "complete" | "error" | "abort" | "timeout" | "user_exit";
462+
}
463+
```
464+
465+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
466+
467+
```typescript
468+
{
469+
hook_event_name: "SessionEnd";
470+
session_id: string;
471+
timestamp: string; // ISO 8601 timestamp
472+
cwd: string;
473+
reason: "complete" | "error" | "abort" | "timeout" | "user_exit";
474+
}
475+
```
476+
477+
#### `userPromptSubmitted` / `UserPromptSubmit`
478+
479+
**camelCase input:**
480+
481+
```typescript
482+
{
483+
sessionId: string;
484+
timestamp: number;
485+
cwd: string;
486+
prompt: string;
487+
}
488+
```
489+
490+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
491+
492+
```typescript
493+
{
494+
hook_event_name: "UserPromptSubmit";
495+
session_id: string;
496+
timestamp: string; // ISO 8601 timestamp
497+
cwd: string;
498+
prompt: string;
499+
}
500+
```
501+
502+
#### `preToolUse` / `PreToolUse`
503+
504+
**camelCase input:**
505+
506+
```typescript
507+
{
508+
sessionId: string;
509+
timestamp: number;
510+
cwd: string;
511+
toolName: string;
512+
toolArgs: unknown;
513+
}
514+
```
515+
516+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
517+
518+
When configured with the PascalCase event name `PreToolUse`, the payload uses snake_case field names to match the {% data variables.product.prodname_vscode_shortname %} {% data variables.product.prodname_copilot_short %} extension format:
519+
520+
```typescript
521+
{
522+
hook_event_name: "PreToolUse";
523+
session_id: string;
524+
timestamp: string; // ISO 8601 timestamp
525+
cwd: string;
526+
tool_name: string;
527+
tool_input: unknown; // Tool arguments (parsed from JSON string when possible)
528+
}
529+
```
530+
531+
#### `postToolUse` / `PostToolUse`
532+
533+
**camelCase input:**
534+
535+
```typescript
536+
{
537+
sessionId: string;
538+
timestamp: number;
539+
cwd: string;
540+
toolName: string;
541+
toolArgs: unknown;
542+
toolResult: {
543+
resultType: "success";
544+
textResultForLlm: string;
545+
}
546+
}
547+
```
548+
549+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
550+
551+
```typescript
552+
{
553+
hook_event_name: "PostToolUse";
554+
session_id: string;
555+
timestamp: string; // ISO 8601 timestamp
556+
cwd: string;
557+
tool_name: string;
558+
tool_input: unknown;
559+
tool_result: {
560+
result_type: "success" | "failure" | "denied" | "error";
561+
text_result_for_llm: string;
562+
}
563+
}
564+
```
565+
566+
#### `postToolUseFailure` / `PostToolUseFailure`
567+
568+
**camelCase input:**
569+
570+
```typescript
571+
{
572+
sessionId: string;
573+
timestamp: number;
574+
cwd: string;
575+
toolName: string;
576+
toolArgs: unknown;
577+
error: string;
578+
}
579+
```
580+
581+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
582+
583+
```typescript
584+
{
585+
hook_event_name: "PostToolUseFailure";
586+
session_id: string;
587+
timestamp: string; // ISO 8601 timestamp
588+
cwd: string;
589+
tool_name: string;
590+
tool_input: unknown;
591+
error: string;
592+
}
593+
```
594+
595+
#### `agentStop` / `Stop`
596+
597+
**camelCase input:**
598+
599+
```typescript
600+
{
601+
sessionId: string;
602+
timestamp: number;
603+
cwd: string;
604+
transcriptPath: string;
605+
stopReason: "end_turn";
606+
}
607+
```
608+
609+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
610+
611+
```typescript
612+
{
613+
hook_event_name: "Stop";
614+
session_id: string;
615+
timestamp: string; // ISO 8601 timestamp
616+
cwd: string;
617+
transcript_path: string;
618+
stop_reason: "end_turn";
619+
}
620+
```
621+
622+
#### `subagentStart`
623+
624+
**Input:**
625+
626+
```typescript
627+
{
628+
sessionId: string;
629+
timestamp: number;
630+
cwd: string;
631+
transcriptPath: string;
632+
agentName: string;
633+
agentDisplayName?: string;
634+
agentDescription?: string;
635+
}
636+
```
637+
638+
#### `subagentStop` / `SubagentStop`
639+
640+
**camelCase input:**
641+
642+
```typescript
643+
{
644+
sessionId: string;
645+
timestamp: number;
646+
cwd: string;
647+
transcriptPath: string;
648+
agentName: string;
649+
agentDisplayName?: string;
650+
stopReason: "end_turn";
651+
}
652+
```
653+
654+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
655+
656+
```typescript
657+
{
658+
hook_event_name: "SubagentStop";
659+
session_id: string;
660+
timestamp: string; // ISO 8601 timestamp
661+
cwd: string;
662+
transcript_path: string;
663+
agent_name: string;
664+
agent_display_name?: string;
665+
stop_reason: "end_turn";
666+
}
667+
```
668+
669+
#### `errorOccurred` / `ErrorOccurred`
670+
671+
**camelCase input:**
672+
673+
```typescript
674+
{
675+
sessionId: string;
676+
timestamp: number;
677+
cwd: string;
678+
error: {
679+
message: string;
680+
name: string;
681+
stack?: string;
682+
};
683+
errorContext: "model_call" | "tool_execution" | "system" | "user_input";
684+
recoverable: boolean;
685+
}
686+
```
687+
688+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
689+
690+
```typescript
691+
{
692+
hook_event_name: "ErrorOccurred";
693+
session_id: string;
694+
timestamp: string; // ISO 8601 timestamp
695+
cwd: string;
696+
error: {
697+
message: string;
698+
name: string;
699+
stack?: string;
700+
};
701+
error_context: "model_call" | "tool_execution" | "system" | "user_input";
702+
recoverable: boolean;
703+
}
704+
```
705+
706+
#### `preCompact` / `PreCompact`
707+
708+
**camelCase input:**
709+
710+
```typescript
711+
{
712+
sessionId: string;
713+
timestamp: number;
714+
cwd: string;
715+
transcriptPath: string;
716+
trigger: "manual" | "auto";
717+
customInstructions: string;
718+
}
719+
```
720+
721+
**{% data variables.product.prodname_vscode_shortname %} compatible input:**
722+
723+
```typescript
724+
{
725+
hook_event_name: "PreCompact";
726+
session_id: string;
727+
timestamp: string; // ISO 8601 timestamp
728+
cwd: string;
729+
transcript_path: string;
730+
trigger: "manual" | "auto";
731+
custom_instructions: string;
732+
}
733+
```
734+
418735
### `preToolUse` decision control
419736

420737
The `preToolUse` hook can control tool execution by writing a JSON object to stdout.
@@ -628,7 +945,7 @@ Custom agents are specialized AI agents defined in Markdown files. The filename
628945
| Agent | Default model | Description |
629946
|-------|--------------|-------------|
630947
| `code-review` | claude-sonnet-4.5 | High signal-to-noise code review. Analyzes diffs for bugs, security issues, and logic errors. |
631-
| `critic` | complementary model | Adversarial feedback on proposals, designs, and implementations. Identifies weak points and suggests improvements. Experimental—requires `--experimental`. |
948+
| `critic` | complementary model | Rubber-duck adversarial feedback on proposals, designs, and implementations. Identifies weak points and suggests improvements. Available for Claude models. Experimental—requires `--experimental`. |
632949
| `explore` | claude-haiku-4.5 | Fast codebase exploration. Searches files, reads code, and answers questions. Returns focused answers under 300 words. Safe to run in parallel. |
633950
| `general-purpose` | claude-sonnet-4.5 | Full-capability agent for complex multi-step tasks. Runs in a separate context window. |
634951
| `research` | claude-sonnet-4.6 | Deep research agent. Generates a report based on information in your codebase, in relevant repositories, and on the web. |
@@ -847,7 +1164,7 @@ Feature flags enable functionality that is not yet generally available. Enable f
8471164

8481165
| Flag | Tier | Description |
8491166
|------|------|-------------|
850-
| `CRITIC_AGENT` | experimental | Critic subagent for adversarial feedback on code and designs (Claude and GPT models) |
1167+
| `RUBBER_DUCK_AGENT` | experimental | Rubber-duck subagent for adversarial feedback on code and designs (available for Claude models) |
8511168
| `BACKGROUND_SESSIONS` | experimental | Multiple concurrent sessions with background management |
8521169
| `MULTI_TURN_AGENTS` | experimental | Multi-turn subagent message passing via `write_agent` |
8531170
| `EXTENSIONS` | experimental | Programmatic extensions with custom tools and hooks |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
e566c239b96a15dd2d7e2e32b67668227e21f417
1+
ed524424679cf44e46cf94e5beb5b8aa9974b554

0 commit comments

Comments
 (0)