xtrm-tools 2.1.20 → 2.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -709
- package/cli/package.json +1 -1
- package/config/pi/extensions/beads.ts +185 -0
- package/config/pi/extensions/core/adapter.ts +45 -0
- package/config/pi/extensions/core/index.ts +3 -0
- package/config/pi/extensions/core/logger.ts +45 -0
- package/config/pi/extensions/core/runner.ts +71 -0
- package/config/pi/extensions/custom-footer.ts +19 -53
- package/config/pi/extensions/main-guard-post-push.ts +44 -0
- package/config/pi/extensions/main-guard.ts +126 -0
- package/config/pi/extensions/quality-gates.ts +67 -0
- package/config/pi/extensions/service-skills.ts +88 -0
- package/config/pi/extensions/xtrm-loader.ts +89 -0
- package/hooks/README.md +35 -310
- package/package.json +1 -1
- package/config/pi/extensions/git-guard.ts +0 -45
- package/config/pi/extensions/safe-guard.ts +0 -46
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* oh-pi Safe Guard Extension
|
|
3
|
-
*
|
|
4
|
-
* Combines destructive command confirmation + protected paths in one extension.
|
|
5
|
-
*/
|
|
6
|
-
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
7
|
-
|
|
8
|
-
export const DANGEROUS_PATTERNS = [
|
|
9
|
-
/\brm\s+(-[a-zA-Z]*f[a-zA-Z]*\s+|.*-rf\b|.*--force\b)/,
|
|
10
|
-
/\bsudo\s+rm\b/,
|
|
11
|
-
/\b(DROP|TRUNCATE|DELETE\s+FROM)\b/i,
|
|
12
|
-
/\bchmod\s+777\b/,
|
|
13
|
-
/\bmkfs\b/,
|
|
14
|
-
/\bdd\s+if=/,
|
|
15
|
-
/>\s*\/dev\/sd[a-z]/,
|
|
16
|
-
];
|
|
17
|
-
|
|
18
|
-
export const PROTECTED_PATHS = [".env", ".git/", "node_modules/", ".pi/", "id_rsa", ".ssh/"];
|
|
19
|
-
|
|
20
|
-
export default function (pi: ExtensionAPI) {
|
|
21
|
-
pi.on("tool_call", async (event, ctx) => {
|
|
22
|
-
// Check bash commands for dangerous patterns
|
|
23
|
-
if (event.toolName === "bash") {
|
|
24
|
-
const cmd = (event.input as { command?: string }).command ?? "";
|
|
25
|
-
const match = DANGEROUS_PATTERNS.find((p) => p.test(cmd));
|
|
26
|
-
if (match && ctx.hasUI) {
|
|
27
|
-
const ok = await ctx.ui.confirm("⚠️ Dangerous Command", `Execute: ${cmd}?`);
|
|
28
|
-
if (!ok) return { block: true, reason: "Blocked by user" };
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Check write/edit for protected paths
|
|
33
|
-
if (event.toolName === "write" || event.toolName === "edit") {
|
|
34
|
-
const path = (event.input as { path?: string }).path ?? "";
|
|
35
|
-
const hit = PROTECTED_PATHS.find((p) => path.includes(p));
|
|
36
|
-
if (hit) {
|
|
37
|
-
if (ctx.hasUI) {
|
|
38
|
-
const ok = await ctx.ui.confirm("🛡️ Protected Path", `Allow write to ${path}?`);
|
|
39
|
-
if (!ok) return { block: true, reason: `Protected path: ${hit}` };
|
|
40
|
-
} else {
|
|
41
|
-
return { block: true, reason: `Protected path: ${hit}` };
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
}
|