Skip to content

Commit 8664526

Browse files
committed
Update docs
1 parent 3298975 commit 8664526

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/coding-agent/docs/extensions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -535,12 +535,12 @@ pi.on("tool_call", async (event, ctx) => {
535535

536536
#### before_bash_exec
537537

538-
Fired before a bash command executes (tool calls and user `!`/`!!`). Use it to rewrite commands or override execution settings.
538+
Fired before a bash command executes (tool calls and user `!`/`!!`). Use it to rewrite commands or override execution settings. You can also block execution by returning `{ block: true, reason?: string }`. For follow-up hints based on output, pair this with `tool_result`.
539539

540540
```typescript
541541
pi.on("before_bash_exec", async (event) => {
542542
if (event.command.includes("rm -rf")) {
543-
return { command: "echo blocked" };
543+
return { block: true, reason: "Blocked by policy" };
544544
}
545545

546546
if (event.source === "tool") {
@@ -560,7 +560,7 @@ Return a `BashExecOverrides` object to override fields, or return `{ block: true
560560

561561
#### tool_result
562562

563-
Fired after tool executes. **Can modify result.**
563+
Fired after tool executes. **Can modify result.** Use this to post-process outputs (for example, append hints or redact secrets) before the result is sent to the model.
564564

565565
```typescript
566566
import { isBashToolResult } from "@mariozechner/pi-coding-agent";

0 commit comments

Comments
 (0)