lakonai 1.2.0 → 1.2.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/package.json +1 -1
- package/src/install/claude-hook.js +16 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lakonai",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "lakonai — save AI context tokens. Filters & compresses CLI output (git, ls, grep, find, test runners, lint/build, docker/kubectl/aws) before it reaches Claude Code, Codex, Cursor, Windsurf, Cline or Gemini — and learns to filter new commands automatically the more you use it.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
@@ -83,6 +83,19 @@ function entryHasHook(entry, basename) {
|
|
|
83
83
|
return entry.hooks.some((h) => h && typeof h.command === 'string' && h.command.includes(basename));
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
// Build the hook command string for settings.json.
|
|
87
|
+
// On Windows, Claude Code executes "command" hooks through bash (Git Bash),
|
|
88
|
+
// which strips backslashes ("C:\Users\...\x.js" -> "C:Users...x.js" -> command
|
|
89
|
+
// not found) and cannot exec a .js by path. Use `node` with a forward-slash
|
|
90
|
+
// path, which works in bash and node accepts on Windows. On POSIX the executable
|
|
91
|
+
// hook file (shebang + chmod 0755) runs directly.
|
|
92
|
+
function hookCommand(dest) {
|
|
93
|
+
if (process.platform === 'win32') {
|
|
94
|
+
return `node "${dest.split(path.sep).join('/')}"`;
|
|
95
|
+
}
|
|
96
|
+
return dest;
|
|
97
|
+
}
|
|
98
|
+
|
|
86
99
|
function mergeHook(data, hookDef, dest) {
|
|
87
100
|
/* istanbul ignore next */
|
|
88
101
|
const eventKey = hookDef.event || 'PreToolUse';
|
|
@@ -95,12 +108,12 @@ function mergeHook(data, hookDef, dest) {
|
|
|
95
108
|
if (!entryHasHook(existing, hookDef.basename)) {
|
|
96
109
|
/* istanbul ignore next */
|
|
97
110
|
existing.hooks = existing.hooks || [];
|
|
98
|
-
existing.hooks.push({ type: 'command', command: dest });
|
|
111
|
+
existing.hooks.push({ type: 'command', command: hookCommand(dest) });
|
|
99
112
|
}
|
|
100
113
|
} else {
|
|
101
114
|
data.hooks[eventKey].push({
|
|
102
115
|
matcher: hookDef.matcher,
|
|
103
|
-
hooks: [{ type: 'command', command: dest }],
|
|
116
|
+
hooks: [{ type: 'command', command: hookCommand(dest) }],
|
|
104
117
|
});
|
|
105
118
|
}
|
|
106
119
|
} else {
|
|
@@ -109,7 +122,7 @@ function mergeHook(data, hookDef, dest) {
|
|
|
109
122
|
);
|
|
110
123
|
if (!existing) {
|
|
111
124
|
data.hooks[eventKey].push({
|
|
112
|
-
hooks: [{ type: 'command', command: dest }],
|
|
125
|
+
hooks: [{ type: 'command', command: hookCommand(dest) }],
|
|
113
126
|
});
|
|
114
127
|
}
|
|
115
128
|
}
|