Răsfoiți Sursa

docs: fix bad example (#1913)

Aiden Cline 6 luni în urmă
părinte
comite
bb4b24a05f
1 a modificat fișierele cu 3 adăugiri și 7 ștergeri
  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"
 export const EnvProtection = async ({ client, $ }) => {
   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")
       }
     }
   }