@hasna/hooks 0.10.9 → 0.11.1
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 +48 -0
- package/bin/hooks-mcp.js +354 -184
- package/bin/index.js +2879 -2638
- package/bin/native-readiness-entry.js +355 -0
- package/bin/native-safety-entry.js +7 -2
- package/bin/serve.js +9 -9
- package/dist/index.js +514 -296
- package/dist/lib/codex-safety-check.d.ts +2 -1
- package/dist/lib/codex-safety-trust.d.ts +40 -8
- package/dist/lib/installer.d.ts +11 -0
- package/dist/lib/native-readiness-command.d.ts +14 -0
- package/dist/lib/native-safety-registration.d.ts +38 -7
- package/dist/lib/readiness-process.d.ts +20 -0
- package/dist/native-readiness.d.ts +68 -0
- package/dist/native-readiness.js +328 -0
- package/dist/sdk/index.js +1 -1
- package/hooks/hook-trash-guard/src/binary.ts +6 -2
- package/hooks/native-readiness-entry.ts +31 -0
- package/package.json +7 -2
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { handleReadinessSessionStart, isReadinessProvider, readinessSessionStartOutput } from "../src/native-readiness";
|
|
2
|
+
|
|
3
|
+
// This dedicated bundle never loads the generic Hooks registry or credentials.
|
|
4
|
+
// The native command verifies its bytes before evaluating this CommonJS entry.
|
|
5
|
+
async function main() {
|
|
6
|
+
const provider = process.argv[2];
|
|
7
|
+
if (!isReadinessProvider(provider)) {
|
|
8
|
+
process.stderr.write("Trash readiness needs attention (unsupported provider).\n");
|
|
9
|
+
process.exitCode = 1; return;
|
|
10
|
+
}
|
|
11
|
+
const invalid = () => readinessSessionStartOutput({ schema: "hasna.hooks.trash-readiness-result/v1",
|
|
12
|
+
provider, ready: false, code: "input_invalid", nativeAdoptionVerified: false });
|
|
13
|
+
try {
|
|
14
|
+
const input = await new Promise<Buffer>((accept, reject) => {
|
|
15
|
+
const chunks: Buffer[] = []; let size = 0;
|
|
16
|
+
const finish = (error?: Error) => {
|
|
17
|
+
clearTimeout(timer); process.stdin.pause(); process.stdin.removeAllListeners("data");
|
|
18
|
+
process.stdin.removeAllListeners("end"); process.stdin.removeAllListeners("error");
|
|
19
|
+
error ? reject(error) : accept(Buffer.concat(chunks));
|
|
20
|
+
};
|
|
21
|
+
const timer = setTimeout(() => finish(new Error()), 1000);
|
|
22
|
+
process.stdin.on("data", chunk => {
|
|
23
|
+
const bytes = Buffer.from(chunk); size += bytes.length;
|
|
24
|
+
if (size > 65_536) finish(new Error()); else chunks.push(bytes);
|
|
25
|
+
});
|
|
26
|
+
process.stdin.once("end", () => finish()); process.stdin.once("error", () => finish(new Error()));
|
|
27
|
+
});
|
|
28
|
+
process.stdout.write(JSON.stringify(await handleReadinessSessionStart(provider, JSON.parse(input.toString("utf8")))) + "\n");
|
|
29
|
+
} catch { process.stdout.write(JSON.stringify(invalid()) + "\n"); }
|
|
30
|
+
}
|
|
31
|
+
void main();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/hooks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.1",
|
|
4
4
|
"description": "Open source hooks library for AI coding agents - Install safety, quality, and automation hooks with a single command",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -24,6 +24,10 @@
|
|
|
24
24
|
"./native-safety": {
|
|
25
25
|
"types": "./dist/native-safety.d.ts",
|
|
26
26
|
"import": "./dist/native-safety.js"
|
|
27
|
+
},
|
|
28
|
+
"./native-readiness": {
|
|
29
|
+
"types": "./dist/native-readiness.d.ts",
|
|
30
|
+
"import": "./dist/native-readiness.js"
|
|
27
31
|
}
|
|
28
32
|
},
|
|
29
33
|
"main": "./dist/index.js",
|
|
@@ -41,7 +45,8 @@
|
|
|
41
45
|
"postinstall": "node scripts/ensure-profiles-dir.mjs",
|
|
42
46
|
"scan:artifact": "bun scripts/artifact-scan.ts",
|
|
43
47
|
"prepack": "bun run build && bun run scan:artifact",
|
|
44
|
-
"build:native-safety": "bun build ./hooks/native-safety-entry.ts --outdir ./bin --target bun --define import.meta.main=false && bun build ./src/native-safety.ts --outdir ./dist --target bun"
|
|
48
|
+
"build:native-safety": "bun build ./hooks/native-safety-entry.ts --outdir ./bin --target bun --define import.meta.main=false && bun build ./src/native-safety.ts --outdir ./dist --target bun && bun run build:native-readiness",
|
|
49
|
+
"build:native-readiness": "bun build ./hooks/native-readiness-entry.ts --outdir ./bin --target node --format=cjs && bun build ./src/native-readiness.ts --outdir ./dist --target bun"
|
|
45
50
|
},
|
|
46
51
|
"keywords": [
|
|
47
52
|
"claude-code",
|