@goodfoot/agent-hooks 1.0.3 → 1.0.5
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/dist/agents/codex/scaffold.js +23 -5
- package/dist/cli.js +1 -1
- package/dist/scaffold.js +1 -1
- package/package.json +1 -1
|
@@ -55,7 +55,7 @@ function generatePackageJson(projectName, outputPath) {
|
|
|
55
55
|
typecheck: "tsc --noEmit",
|
|
56
56
|
},
|
|
57
57
|
dependencies: {
|
|
58
|
-
[PACKAGE_NAME]: "^1.0.
|
|
58
|
+
[PACKAGE_NAME]: "^1.0.5",
|
|
59
59
|
},
|
|
60
60
|
devDependencies: {
|
|
61
61
|
"@biomejs/biome": "2.4.9",
|
|
@@ -96,6 +96,16 @@ function generateBiomeConfig() {
|
|
|
96
96
|
"rules": {
|
|
97
97
|
"recommended": true
|
|
98
98
|
}
|
|
99
|
+
},
|
|
100
|
+
"assist": {
|
|
101
|
+
"actions": {
|
|
102
|
+
"source": {
|
|
103
|
+
"organizeImports": "on"
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
"files": {
|
|
108
|
+
"includes": ["src/**/*.ts", "test/**/*.ts", "*.ts"]
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
111
|
`;
|
|
@@ -134,7 +144,11 @@ function generateHookSource(eventName) {
|
|
|
134
144
|
return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
|
|
135
145
|
|
|
136
146
|
export default ${factory}({ matcher: "Bash" }, (input) => {
|
|
137
|
-
|
|
147
|
+
// Codex does not give tool_input a fixed schema, so it's typed "unknown" —
|
|
148
|
+
// narrow before reading a field off it.
|
|
149
|
+
const toolInput = input.tool_input as { command?: unknown };
|
|
150
|
+
const command = typeof toolInput.command === "string" ? toolInput.command : "";
|
|
151
|
+
if (command.includes("rm -rf")) {
|
|
138
152
|
return ${output}({
|
|
139
153
|
systemMessage: "Blocked dangerous shell command.",
|
|
140
154
|
permissionDecision: "deny",
|
|
@@ -147,8 +161,12 @@ export default ${factory}({ matcher: "Bash" }, (input) => {
|
|
|
147
161
|
return `import { ${importItems} } from "${CODEX_IMPORT_SPECIFIER}";
|
|
148
162
|
|
|
149
163
|
export default ${factory}({ matcher: "Bash" }, (input) => {
|
|
164
|
+
// Codex does not give tool_input a fixed schema, so it's typed "unknown" —
|
|
165
|
+
// narrow before reading a field off it.
|
|
166
|
+
const toolInput = input.tool_input as { command?: unknown };
|
|
167
|
+
const command = typeof toolInput.command === "string" ? toolInput.command : "<unknown>";
|
|
150
168
|
return ${output}({
|
|
151
|
-
additionalContext: \`Observed Bash command: \${
|
|
169
|
+
additionalContext: \`Observed Bash command: \${command}\`,
|
|
152
170
|
});
|
|
153
171
|
});
|
|
154
172
|
`;
|
|
@@ -238,8 +256,8 @@ export default ${factory}({ matcher: "manual" }, () => {
|
|
|
238
256
|
}
|
|
239
257
|
function generateHookTest(eventName) {
|
|
240
258
|
const filename = toKebabCase(eventName);
|
|
241
|
-
return `import
|
|
242
|
-
import
|
|
259
|
+
return `import { describe, expect, it } from "vitest";
|
|
260
|
+
import hook from "../src/${filename}.js";
|
|
243
261
|
|
|
244
262
|
describe("${eventName} hook", () => {
|
|
245
263
|
it("exports a ${eventName} hook", () => {
|
package/dist/cli.js
CHANGED
|
@@ -26,7 +26,7 @@ import { scaffoldProject } from "./scaffold.js";
|
|
|
26
26
|
// ============================================================================
|
|
27
27
|
// Constants
|
|
28
28
|
// ============================================================================
|
|
29
|
-
const VERSION = "1.0.
|
|
29
|
+
const VERSION = "1.0.5";
|
|
30
30
|
const DEFAULT_ESBUILD_LOADERS = {
|
|
31
31
|
".md": "text",
|
|
32
32
|
};
|
package/dist/scaffold.js
CHANGED
|
@@ -131,7 +131,7 @@ function generatePackageJson(projectName, outputPath) {
|
|
|
131
131
|
typecheck: "tsc --noEmit",
|
|
132
132
|
},
|
|
133
133
|
dependencies: {
|
|
134
|
-
"@goodfoot/agent-hooks": "^1.0.
|
|
134
|
+
"@goodfoot/agent-hooks": "^1.0.5",
|
|
135
135
|
},
|
|
136
136
|
devDependencies: {
|
|
137
137
|
"@biomejs/biome": "2.4.16",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodfoot/agent-hooks",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.5",
|
|
4
4
|
"description": "Unified agent hooks library: shared core runtime with per-agent entry points for Claude Code, Codex, and Antigravity",
|
|
5
5
|
"homepage": "https://github.com/goodfoot-io/marketplace/tree/main/packages/agent-hooks",
|
|
6
6
|
"repository": {
|