xtrm-tools 2.2.0 → 2.3.0
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 +13 -6
- package/cli/dist/index.cjs +971 -917
- package/cli/dist/index.cjs.map +1 -1
- package/cli/package.json +1 -1
- package/config/pi/extensions/beads.ts +9 -5
- package/config/pi/extensions/service-skills.ts +17 -9
- package/config/pi/install-schema.json +2 -1
- package/package.json +1 -1
package/cli/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type { ExtensionAPI
|
|
1
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
2
2
|
import { isToolCallEventType, isBashToolResult } from "@mariozechner/pi-coding-agent";
|
|
3
|
-
import * as path from "node:path";
|
|
4
3
|
import { SubprocessRunner, EventAdapter, Logger } from "./core/lib";
|
|
5
4
|
|
|
6
5
|
const logger = new Logger({ namespace: "beads" });
|
|
@@ -115,14 +114,19 @@ export default function (pi: ExtensionAPI) {
|
|
|
115
114
|
return undefined;
|
|
116
115
|
});
|
|
117
116
|
|
|
118
|
-
// Dual safety net:
|
|
117
|
+
// Dual safety net: warn about unclosed claims when session ends (non-blocking)
|
|
119
118
|
const notifySessionEnd = async (ctx: any) => {
|
|
120
119
|
const cwd = getCwd(ctx);
|
|
121
120
|
if (!EventAdapter.isBeadsProject(cwd)) return;
|
|
122
121
|
const sessionId = getSessionId(ctx);
|
|
123
122
|
const claim = await getSessionClaim(sessionId, cwd);
|
|
124
|
-
if (claim
|
|
125
|
-
|
|
123
|
+
if (!claim) return;
|
|
124
|
+
|
|
125
|
+
const message = `Beads: session ending with active claim [${claim}]`;
|
|
126
|
+
if (ctx.hasUI) {
|
|
127
|
+
ctx.ui.notify(message, "warning");
|
|
128
|
+
} else {
|
|
129
|
+
logger.warn(message);
|
|
126
130
|
}
|
|
127
131
|
};
|
|
128
132
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
import type { ExtensionAPI
|
|
2
|
-
import {
|
|
3
|
-
import { SubprocessRunner, Logger } from "./core/lib";
|
|
1
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
2
|
+
import { SubprocessRunner } from "./core/lib";
|
|
4
3
|
import * as path from "node:path";
|
|
5
4
|
import * as fs from "node:fs";
|
|
6
5
|
|
|
7
|
-
const logger = new Logger({ namespace: "service-skills" });
|
|
8
|
-
|
|
9
6
|
export default function (pi: ExtensionAPI) {
|
|
10
7
|
const getCwd = (ctx: any) => ctx.cwd || process.cwd();
|
|
11
8
|
|
|
@@ -27,23 +24,33 @@ export default function (pi: ExtensionAPI) {
|
|
|
27
24
|
});
|
|
28
25
|
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
const toClaudeToolName = (toolName: string): string => {
|
|
28
|
+
if (toolName === "bash") return "Bash";
|
|
29
|
+
if (toolName === "read_file") return "Read";
|
|
30
|
+
if (toolName === "write" || toolName === "create_text_file") return "Write";
|
|
31
|
+
if (toolName === "edit" || toolName === "replace_content" || toolName === "replace_lines" || toolName === "insert_at_line" || toolName === "delete_lines") return "Edit";
|
|
32
|
+
if (toolName === "search_for_pattern") return "Grep";
|
|
33
|
+
if (toolName === "find_file" || toolName === "list_dir") return "Glob";
|
|
34
|
+
return toolName;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
// 2. Drift Detection (skill activation is before_agent_start only — not per-tool)
|
|
31
38
|
pi.on("tool_result", async (event, ctx) => {
|
|
32
39
|
const cwd = getCwd(ctx);
|
|
33
40
|
const driftDetectorPath = path.join(cwd, ".claude", "skills", "updating-service-skills", "scripts", "drift_detector.py");
|
|
34
41
|
if (!fs.existsSync(driftDetectorPath)) return undefined;
|
|
35
42
|
|
|
36
43
|
const hookInput = JSON.stringify({
|
|
37
|
-
tool_name: event.toolName
|
|
44
|
+
tool_name: toClaudeToolName(event.toolName),
|
|
38
45
|
tool_input: event.input,
|
|
39
|
-
cwd
|
|
46
|
+
cwd,
|
|
40
47
|
});
|
|
41
48
|
|
|
42
49
|
const result = await SubprocessRunner.run("python3", [driftDetectorPath], {
|
|
43
50
|
cwd,
|
|
44
51
|
input: hookInput,
|
|
45
52
|
env: { ...process.env, CLAUDE_PROJECT_DIR: cwd },
|
|
46
|
-
timeoutMs: 10000
|
|
53
|
+
timeoutMs: 10000,
|
|
47
54
|
});
|
|
48
55
|
|
|
49
56
|
if (result.code === 0 && result.stdout.trim()) {
|
|
@@ -51,6 +58,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
51
58
|
newContent.push({ type: "text", text: "\n\n" + result.stdout.trim() });
|
|
52
59
|
return { content: newContent };
|
|
53
60
|
}
|
|
61
|
+
|
|
54
62
|
return undefined;
|
|
55
63
|
});
|
|
56
64
|
}
|