@hasna/hooks 0.2.15 → 0.2.17
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/bin/index.js +788 -105
- package/package.json +3 -2
- package/hooks/hook-agentmessages/bin/cli.ts +0 -125
- package/hooks/hook-checkdocs/bun.lock +0 -25
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/hooks",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.17",
|
|
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": {
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"typescript": "^5"
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@hasna/cloud": "
|
|
46
|
+
"@hasna/cloud": "0.1.24",
|
|
47
|
+
"@hasna/events": "^0.1.6",
|
|
47
48
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
48
49
|
"chalk": "^5.3.0",
|
|
49
50
|
"commander": "^12.1.0",
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
/**
|
|
3
|
-
* CLI for hook-agentmessages
|
|
4
|
-
*
|
|
5
|
-
* Usage:
|
|
6
|
-
* hook-agentmessages install - Install hooks into Claude Code
|
|
7
|
-
* hook-agentmessages uninstall - Remove hooks from Claude Code
|
|
8
|
-
* hook-agentmessages status - Show hook status
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { homedir } from 'os';
|
|
12
|
-
import { join } from 'path';
|
|
13
|
-
|
|
14
|
-
const CLAUDE_SETTINGS_FILE = join(homedir(), '.claude', 'settings.json');
|
|
15
|
-
|
|
16
|
-
const args = process.argv.slice(2);
|
|
17
|
-
const command = args[0];
|
|
18
|
-
|
|
19
|
-
async function showStatus() {
|
|
20
|
-
console.log('hook-agentmessages status\n');
|
|
21
|
-
|
|
22
|
-
// Check if hooks are installed
|
|
23
|
-
try {
|
|
24
|
-
const file = Bun.file(CLAUDE_SETTINGS_FILE);
|
|
25
|
-
if (await file.exists()) {
|
|
26
|
-
const settings = await file.json();
|
|
27
|
-
|
|
28
|
-
if (settings.hooks) {
|
|
29
|
-
let installed = false;
|
|
30
|
-
|
|
31
|
-
if (settings.hooks.SessionStart) {
|
|
32
|
-
const hasHook = settings.hooks.SessionStart.some((h: any) =>
|
|
33
|
-
h.hooks?.some((hook: any) => hook.command?.includes('hook-agentmessages'))
|
|
34
|
-
);
|
|
35
|
-
if (hasHook) {
|
|
36
|
-
console.log(' SessionStart hook: installed');
|
|
37
|
-
installed = true;
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (settings.hooks.Stop) {
|
|
42
|
-
const hasHook = settings.hooks.Stop.some((h: any) =>
|
|
43
|
-
h.hooks?.some((hook: any) => hook.command?.includes('hook-agentmessages'))
|
|
44
|
-
);
|
|
45
|
-
if (hasHook) {
|
|
46
|
-
console.log(' Stop hook: installed');
|
|
47
|
-
installed = true;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
if (!installed) {
|
|
52
|
-
console.log(' No hook-agentmessages hooks installed');
|
|
53
|
-
}
|
|
54
|
-
} else {
|
|
55
|
-
console.log(' No hooks configured in Claude Code');
|
|
56
|
-
}
|
|
57
|
-
} else {
|
|
58
|
-
console.log(' Claude Code settings not found');
|
|
59
|
-
}
|
|
60
|
-
} catch (err) {
|
|
61
|
-
console.log(' Error reading settings:', (err as Error).message);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Check service-message status
|
|
65
|
-
const serviceDir = join(homedir(), '.service', 'service-message');
|
|
66
|
-
const configFile = Bun.file(join(serviceDir, 'config.json'));
|
|
67
|
-
|
|
68
|
-
console.log('\nservice-message integration:');
|
|
69
|
-
if (await configFile.exists()) {
|
|
70
|
-
const config = await configFile.json();
|
|
71
|
-
console.log(` Agent ID: ${config.agentId || 'not set'}`);
|
|
72
|
-
console.log(` Data dir: ${serviceDir}`);
|
|
73
|
-
} else {
|
|
74
|
-
console.log(' Not configured');
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
function showHelp() {
|
|
79
|
-
console.log(`
|
|
80
|
-
hook-agentmessages - Claude Code hook for service-message integration
|
|
81
|
-
|
|
82
|
-
Usage:
|
|
83
|
-
hook-agentmessages <command>
|
|
84
|
-
|
|
85
|
-
Commands:
|
|
86
|
-
install Install hooks into Claude Code settings
|
|
87
|
-
uninstall Remove hooks from Claude Code settings
|
|
88
|
-
status Show current hook status
|
|
89
|
-
|
|
90
|
-
Examples:
|
|
91
|
-
hook-agentmessages install
|
|
92
|
-
hook-agentmessages status
|
|
93
|
-
`);
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
async function main() {
|
|
97
|
-
if (!command || command === '--help' || command === '-h') {
|
|
98
|
-
showHelp();
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
switch (command) {
|
|
103
|
-
case 'install':
|
|
104
|
-
await import('../src/install.ts');
|
|
105
|
-
break;
|
|
106
|
-
|
|
107
|
-
case 'uninstall':
|
|
108
|
-
await import('../src/uninstall.ts');
|
|
109
|
-
break;
|
|
110
|
-
|
|
111
|
-
case 'status':
|
|
112
|
-
await showStatus();
|
|
113
|
-
break;
|
|
114
|
-
|
|
115
|
-
default:
|
|
116
|
-
console.error(`Unknown command: ${command}`);
|
|
117
|
-
showHelp();
|
|
118
|
-
process.exit(1);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
main().catch((err) => {
|
|
123
|
-
console.error('Error:', err.message);
|
|
124
|
-
process.exit(1);
|
|
125
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"lockfileVersion": 1,
|
|
3
|
-
"configVersion": 1,
|
|
4
|
-
"workspaces": {
|
|
5
|
-
"": {
|
|
6
|
-
"name": "@hasnaxyz/hook-checkfiles",
|
|
7
|
-
"devDependencies": {
|
|
8
|
-
"@types/bun": "^1.3.8",
|
|
9
|
-
"@types/node": "^20",
|
|
10
|
-
"typescript": "^5.0.0",
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
"packages": {
|
|
15
|
-
"@types/bun": ["@types/bun@1.3.8", "", { "dependencies": { "bun-types": "1.3.8" } }, "sha512-3LvWJ2q5GerAXYxO2mffLTqOzEu5qnhEAlh48Vnu8WQfnmSwbgagjGZV6BoHKJztENYEDn6QmVd949W4uESRJA=="],
|
|
16
|
-
|
|
17
|
-
"@types/node": ["@types/node@20.19.30", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-WJtwWJu7UdlvzEAUm484QNg5eAoq5QR08KDNx7g45Usrs2NtOPiX8ugDqmKdXkyL03rBqU5dYNYVQetEpBHq2g=="],
|
|
18
|
-
|
|
19
|
-
"bun-types": ["bun-types@1.3.8", "", { "dependencies": { "@types/node": "*" } }, "sha512-fL99nxdOWvV4LqjmC+8Q9kW3M4QTtTR1eePs94v5ctGqU8OeceWrSUaRw3JYb7tU3FkMIAjkueehrHPPPGKi5Q=="],
|
|
20
|
-
|
|
21
|
-
"typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
|
|
22
|
-
|
|
23
|
-
"undici-types": ["undici-types@6.21.0", "", {}, "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ=="],
|
|
24
|
-
}
|
|
25
|
-
}
|