pi
This commit is contained in:
@@ -1,18 +0,0 @@
|
||||
import type { Plugin } from "@opencode-ai/plugin";
|
||||
|
||||
const GIT_PATTERN = /(?:^|[;&|]\s*|&&\s*|\|\|\s*|\$\(\s*|`\s*)git\s/;
|
||||
|
||||
export const BlockGitPlugin: Plugin = async () => {
|
||||
return {
|
||||
"tool.execute.before": async (input, output) => {
|
||||
if (input.tool === "bash") {
|
||||
const command = output.args.command as string;
|
||||
if (GIT_PATTERN.test(command)) {
|
||||
throw new Error(
|
||||
"This project uses jj, only use `jj` commands, not `git`.",
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,19 +0,0 @@
|
||||
import type { Plugin } from "@opencode-ai/plugin";
|
||||
|
||||
const SCRIPTING_PATTERN =
|
||||
/(?:^|[;&|]\s*|&&\s*|\|\|\s*|\$\(\s*|`\s*)(?:python[23]?|perl|ruby|php|lua|bash\s+-c|sh\s+-c)\s/;
|
||||
|
||||
export const BlockScriptingPlugin: Plugin = async () => {
|
||||
return {
|
||||
"tool.execute.before": async (input, output) => {
|
||||
if (input.tool === "bash") {
|
||||
const command = output.args.command as string;
|
||||
if (SCRIPTING_PATTERN.test(command)) {
|
||||
throw new Error(
|
||||
"Do not use python, perl, ruby, php, lua, or inline bash/sh for scripting. Use `nu -c` instead.",
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
@@ -1,16 +0,0 @@
|
||||
import type { Plugin } from "@opencode-ai/plugin";
|
||||
|
||||
export const DirenvPlugin: Plugin = async ({ $ }) => {
|
||||
return {
|
||||
"shell.env": async (input, output) => {
|
||||
try {
|
||||
const exported = await $`direnv export json`
|
||||
.cwd(input.cwd)
|
||||
.quiet()
|
||||
.json();
|
||||
|
||||
Object.assign(output.env, exported);
|
||||
} catch {}
|
||||
},
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user