A simple OpenCode Plugin to block access to .env files.
On Linux, save env-protection.ts to ~/.config/opencode/plugin/env-protection.ts.
import type { Plugin } from "@opencode-ai/plugin"
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");
}
},
},
},
};
};dkarter ~Advanced Version
Here's an version of terminal bell for people on terminal emulators that don't support an audible terminal bell like alacritty