Browse Source

docs: fix bad example (#1913)

Aiden Cline 6 months ago
parent
commit
bb4b24a05f
1 changed files with 3 additions and 7 deletions
  1. 3 7
      packages/web/src/content/docs/docs/plugins.mdx

+ 3 - 7
packages/web/src/content/docs/docs/plugins.mdx

@@ -93,13 +93,9 @@ Prevent opencode from reading `.env` files:
 ```javascript title=".opencode/plugin/env-protection.js"
 ```javascript title=".opencode/plugin/env-protection.js"
 export const EnvProtection = async ({ client, $ }) => {
 export const EnvProtection = async ({ client, $ }) => {
   return {
   return {
-    tool: {
-      execute: {
-        before: async (input, output) => {
-          if (input.tool === "read" && output.args.filePath.includes(".env")) {
-            throw new Error("Do not read .env files")
-          }
-        }
+    "tool.execute.before": async (input, output) => {
+      if (input.tool === "read" && output.args.filePath.includes(".env")) {
+        throw new Error("Do not read .env files")
       }
       }
     }
     }
   }
   }