Documentation
¶
Overview ¶
Demonstrates WithOnFsWrite: intercept opencode's fs/write_text_file delegations and redirect them into an in-memory map rather than the real filesystem. Useful for sandboxed evaluation or auditing.
opencode only emits fs/write_text_file after an approved "ask" edit. For this example to fire the callback you need `"permission": {"edit": "ask"}` in ~/.config/opencode/config.json and a WithCanUseTool handler that approves.
go run ./examples/fs_intercept
Click to show internal directories.
Click to hide internal directories.