gm-cc 2.0.75 → 2.0.77
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +26 -0
- package/cli.js +217 -90
- package/hooks/pre-tool-use-hook.js +1 -11
- package/hooks/prompt-submit-hook.js +1 -1
- package/hooks/session-start-hook.js +7 -34
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"name": "AnEntrypoint"
|
|
5
5
|
},
|
|
6
6
|
"description": "State machine agent with hooks, skills, and automated git enforcement",
|
|
7
|
-
"version": "2.0.
|
|
7
|
+
"version": "2.0.77",
|
|
8
8
|
"metadata": {
|
|
9
9
|
"description": "State machine agent with hooks, skills, and automated git enforcement"
|
|
10
10
|
},
|
package/README.md
CHANGED
|
@@ -50,6 +50,32 @@ After running `bun x gm-cc@latest`, your project will have:
|
|
|
50
50
|
|
|
51
51
|
Each hook runs automatically at the appropriate session event. No manual trigger needed.
|
|
52
52
|
|
|
53
|
+
### Project Provisioning (Explicit Installation)
|
|
54
|
+
|
|
55
|
+
To explicitly add all gm-cc hooks, agents, and skills to an existing project:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
bun x gm-cc@latest -- -p
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or with a global installation:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
gm-cc -p
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
This creates a project-local `.claude/settings.json` that configures hooks to use `${CLAUDE_PROJECT_DIR}` for project-specific environments. Useful for:
|
|
68
|
+
- Explicitly provisioning gm-cc to an existing project
|
|
69
|
+
- Overriding global plugin settings for a specific project
|
|
70
|
+
- Team workflows requiring consistent project-level configuration
|
|
71
|
+
|
|
72
|
+
The `-p` flag copies:
|
|
73
|
+
- All hooks to `.claude/hooks/`
|
|
74
|
+
- All agents to `.claude/agents/`
|
|
75
|
+
- All skills to `.claude/skills/`
|
|
76
|
+
- MCP configuration to `.claude/.mcp.json`
|
|
77
|
+
- Project-specific hook settings to `.claude/settings.json`
|
|
78
|
+
|
|
53
79
|
## File Installation (Manual Setup)
|
|
54
80
|
|
|
55
81
|
If you prefer manual file management, clone the repository and copy files directly:
|
package/cli.js
CHANGED
|
@@ -3,100 +3,227 @@ const fs = require('fs');
|
|
|
3
3
|
const path = require('path');
|
|
4
4
|
const os = require('os');
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
fs.
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
6
|
+
const args = process.argv.slice(2);
|
|
7
|
+
const isProvision = args.includes('-p') || args.includes('--provision');
|
|
8
|
+
|
|
9
|
+
if (isProvision) {
|
|
10
|
+
provisionProject();
|
|
11
|
+
} else {
|
|
12
|
+
installGlobally();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
function provisionProject() {
|
|
16
|
+
const projectDir = process.cwd();
|
|
17
|
+
const claudeDir = path.join(projectDir, '.claude');
|
|
18
|
+
const srcDir = __dirname;
|
|
19
|
+
|
|
20
|
+
console.log('Provisioning gm-cc to current project...');
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
const filesToCopy = [
|
|
24
|
+
'agents',
|
|
25
|
+
'hooks',
|
|
26
|
+
'skills',
|
|
27
|
+
'.mcp.json'
|
|
28
|
+
];
|
|
29
|
+
|
|
30
|
+
function copyRecursive(src, dst) {
|
|
31
|
+
if (!fs.existsSync(src)) return;
|
|
32
|
+
if (fs.statSync(src).isDirectory()) {
|
|
33
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
34
|
+
fs.readdirSync(src).forEach(f => copyRecursive(path.join(src, f), path.join(dst, f)));
|
|
35
|
+
} else {
|
|
36
|
+
fs.copyFileSync(src, dst);
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
|
-
}
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
filesToCopy.forEach(name => copyRecursive(path.join(srcDir, name), path.join(claudeDir, name)));
|
|
40
41
|
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
// Update .gitignore to exclude .gm-stop-verified
|
|
43
|
+
const gitignorePath = path.join(projectDir, '.gitignore');
|
|
44
|
+
const gitignoreEntry = '.gm-stop-verified';
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
46
|
+
let gitignoreContent = '';
|
|
47
|
+
if (fs.existsSync(gitignorePath)) {
|
|
48
|
+
gitignoreContent = fs.readFileSync(gitignorePath, 'utf-8');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!gitignoreContent.includes(gitignoreEntry)) {
|
|
52
|
+
if (gitignoreContent && !gitignoreContent.endsWith('\n')) {
|
|
53
|
+
gitignoreContent += '\n';
|
|
54
|
+
}
|
|
55
|
+
gitignoreContent += gitignoreEntry + '\n';
|
|
56
|
+
fs.writeFileSync(gitignorePath, gitignoreContent, 'utf-8');
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Generate project-specific settings.json with hook configuration
|
|
60
|
+
const settingsPath = path.join(claudeDir, 'settings.json');
|
|
61
|
+
let settings = {};
|
|
62
|
+
if (fs.existsSync(settingsPath)) {
|
|
63
|
+
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8')); } catch (e) {}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// Configure hooks to use project-local paths with ${CLAUDE_PROJECT_DIR}
|
|
67
|
+
if (!settings.hooks) settings.hooks = {};
|
|
68
|
+
settings.hooks.PreToolUse = [{
|
|
69
|
+
matcher: '*',
|
|
70
|
+
hooks: [{
|
|
71
|
+
type: 'command',
|
|
72
|
+
command: 'node ${CLAUDE_PROJECT_DIR}/.claude/hooks/pre-tool-use-hook.js',
|
|
73
|
+
timeout: 3600
|
|
74
|
+
}]
|
|
75
|
+
}];
|
|
76
|
+
settings.hooks.SessionStart = [{
|
|
77
|
+
matcher: '*',
|
|
78
|
+
hooks: [{
|
|
79
|
+
type: 'command',
|
|
80
|
+
command: 'node ${CLAUDE_PROJECT_DIR}/.claude/hooks/session-start-hook.js',
|
|
81
|
+
timeout: 180000
|
|
82
|
+
}]
|
|
83
|
+
}];
|
|
84
|
+
settings.hooks.UserPromptSubmit = [{
|
|
85
|
+
matcher: '*',
|
|
86
|
+
hooks: [{
|
|
87
|
+
type: 'command',
|
|
88
|
+
command: 'node ${CLAUDE_PROJECT_DIR}/.claude/hooks/prompt-submit-hook.js',
|
|
89
|
+
timeout: 60000
|
|
90
|
+
}]
|
|
91
|
+
}];
|
|
92
|
+
settings.hooks.Stop = [{
|
|
93
|
+
matcher: '*',
|
|
94
|
+
hooks: [
|
|
95
|
+
{
|
|
96
|
+
type: 'command',
|
|
97
|
+
command: 'node ${CLAUDE_PROJECT_DIR}/.claude/hooks/stop-hook.js',
|
|
98
|
+
timeout: 300000
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
type: 'command',
|
|
102
|
+
command: 'node ${CLAUDE_PROJECT_DIR}/.claude/hooks/stop-hook-git.js',
|
|
103
|
+
timeout: 60000
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
}];
|
|
107
|
+
|
|
108
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
109
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');
|
|
110
|
+
|
|
111
|
+
console.log('✓ Hooks copied to .claude/hooks/');
|
|
112
|
+
console.log('✓ Agents copied to .claude/agents/');
|
|
113
|
+
console.log('✓ Skills copied to .claude/skills/');
|
|
114
|
+
console.log('✓ MCP configuration written to .claude/.mcp.json');
|
|
115
|
+
console.log('✓ Hook configuration written to .claude/settings.json');
|
|
116
|
+
console.log('✓ .gitignore updated');
|
|
117
|
+
console.log('');
|
|
118
|
+
console.log('Provisioning complete! Your project now has:');
|
|
119
|
+
console.log(' • All gm-cc hooks in .claude/hooks/');
|
|
120
|
+
console.log(' • All agents in .claude/agents/');
|
|
121
|
+
console.log(' • All skills in .claude/skills/');
|
|
122
|
+
console.log(' • Hook configuration in .claude/settings.json');
|
|
123
|
+
console.log('');
|
|
124
|
+
console.log('Restart Claude Code to activate the hooks.');
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.error('Provisioning failed:', e.message);
|
|
127
|
+
process.exit(1);
|
|
68
128
|
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
function installGlobally() {
|
|
132
|
+
const homeDir = process.env.HOME || process.env.USERPROFILE || os.homedir();
|
|
133
|
+
const claudeDir = path.join(homeDir, '.claude');
|
|
134
|
+
const pluginsDir = path.join(claudeDir, 'plugins');
|
|
135
|
+
const destDir = path.join(pluginsDir, 'gm-cc');
|
|
136
|
+
|
|
137
|
+
const srcDir = __dirname;
|
|
138
|
+
const isUpgrade = fs.existsSync(destDir);
|
|
139
|
+
|
|
140
|
+
console.log(isUpgrade ? 'Upgrading gm-cc plugin...' : 'Installing gm-cc plugin...');
|
|
141
|
+
|
|
142
|
+
try {
|
|
143
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
144
|
+
|
|
145
|
+
const filesToCopy = [
|
|
146
|
+
'agents',
|
|
147
|
+
'hooks',
|
|
148
|
+
'skills',
|
|
149
|
+
'.mcp.json',
|
|
150
|
+
'.claude-plugin',
|
|
151
|
+
'README.md',
|
|
152
|
+
'CLAUDE.md'
|
|
153
|
+
];
|
|
154
|
+
|
|
155
|
+
function copyRecursive(src, dst) {
|
|
156
|
+
if (!fs.existsSync(src)) return;
|
|
157
|
+
if (fs.statSync(src).isDirectory()) {
|
|
158
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
159
|
+
fs.readdirSync(src).forEach(f => copyRecursive(path.join(src, f), path.join(dst, f)));
|
|
160
|
+
} else {
|
|
161
|
+
fs.copyFileSync(src, dst);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
filesToCopy.forEach(name => copyRecursive(path.join(srcDir, name), path.join(destDir, name)));
|
|
166
|
+
|
|
167
|
+
// Remove stale root-level plugin.json (moved to .claude-plugin/plugin.json)
|
|
168
|
+
const stalePluginJson = path.join(destDir, 'plugin.json');
|
|
169
|
+
if (fs.existsSync(stalePluginJson)) fs.unlinkSync(stalePluginJson);
|
|
170
|
+
|
|
171
|
+
// Register in settings.json (enabledPlugins only, no hook injection)
|
|
172
|
+
const settingsPath = path.join(claudeDir, 'settings.json');
|
|
173
|
+
let settings = {};
|
|
174
|
+
if (fs.existsSync(settingsPath)) {
|
|
175
|
+
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf-8')); } catch (e) {}
|
|
176
|
+
}
|
|
177
|
+
if (!settings.enabledPlugins) settings.enabledPlugins = {};
|
|
178
|
+
settings.enabledPlugins['gm@gm-cc'] = true;
|
|
179
|
+
// Remove stale hook entries (handled by plugin hooks.json)
|
|
180
|
+
if (settings.hooks) delete settings.hooks;
|
|
181
|
+
// Register marketplace so Claude Code resolves gm@gm-cc locally
|
|
182
|
+
if (!settings.extraKnownMarketplaces) settings.extraKnownMarketplaces = {};
|
|
183
|
+
settings.extraKnownMarketplaces['gm-cc'] = { source: { source: 'directory', path: destDir } };
|
|
184
|
+
fs.mkdirSync(claudeDir, { recursive: true });
|
|
185
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2), 'utf-8');
|
|
186
|
+
console.log('✓ Plugin registered in ~/.claude/settings.json');
|
|
187
|
+
|
|
188
|
+
// Write installed_plugins.json so Claude Code loads from local cache
|
|
189
|
+
const pluginVersion = require('./package.json').version;
|
|
190
|
+
const installedPluginsPath = path.join(pluginsDir, 'installed_plugins.json');
|
|
191
|
+
let installedPlugins = { version: 2, plugins: {} };
|
|
192
|
+
if (fs.existsSync(installedPluginsPath)) {
|
|
193
|
+
try { installedPlugins = JSON.parse(fs.readFileSync(installedPluginsPath, 'utf-8')); } catch (e) {}
|
|
194
|
+
}
|
|
195
|
+
if (!installedPlugins.plugins || Array.isArray(installedPlugins.plugins)) installedPlugins.plugins = {};
|
|
196
|
+
const now = new Date().toISOString();
|
|
197
|
+
const existing = Array.isArray(installedPlugins.plugins['gm@gm-cc']) ? installedPlugins.plugins['gm@gm-cc'][0] : null;
|
|
198
|
+
// Also write cache dir so Claude Code finds it without network fetch
|
|
199
|
+
const cacheDir = path.join(pluginsDir, 'cache', 'gm-cc', 'gm', pluginVersion);
|
|
200
|
+
const filesToCache = ['agents', 'hooks', 'skills', '.mcp.json', '.claude-plugin', 'README.md', 'CLAUDE.md'];
|
|
201
|
+
function copyRecursiveCache(src, dst) {
|
|
202
|
+
if (!fs.existsSync(src)) return;
|
|
203
|
+
if (fs.statSync(src).isDirectory()) {
|
|
204
|
+
fs.mkdirSync(dst, { recursive: true });
|
|
205
|
+
fs.readdirSync(src).forEach(f => copyRecursiveCache(path.join(src, f), path.join(dst, f)));
|
|
206
|
+
} else { fs.copyFileSync(src, dst); }
|
|
207
|
+
}
|
|
208
|
+
fs.mkdirSync(cacheDir, { recursive: true });
|
|
209
|
+
filesToCache.forEach(name => copyRecursiveCache(path.join(destDir, name), path.join(cacheDir, name)));
|
|
210
|
+
// Remove stale root-level plugin.json from cache (moved to .claude-plugin/plugin.json)
|
|
211
|
+
const staleCachePluginJson = path.join(cacheDir, 'plugin.json');
|
|
212
|
+
if (fs.existsSync(staleCachePluginJson)) fs.unlinkSync(staleCachePluginJson);
|
|
213
|
+
installedPlugins.plugins['gm@gm-cc'] = [{
|
|
214
|
+
scope: 'user',
|
|
215
|
+
installPath: cacheDir,
|
|
216
|
+
version: pluginVersion,
|
|
217
|
+
installedAt: existing?.installedAt || now,
|
|
218
|
+
lastUpdated: now
|
|
219
|
+
}];
|
|
220
|
+
fs.writeFileSync(installedPluginsPath, JSON.stringify(installedPlugins, null, 2), 'utf-8');
|
|
221
|
+
console.log('✓ Plugin registered in installed_plugins.json');
|
|
222
|
+
|
|
223
|
+
console.log(`✓ gm-cc ${isUpgrade ? 'upgraded' : 'installed'} to ${destDir}`);
|
|
224
|
+
console.log('Restart Claude Code to activate the gm plugin.');
|
|
225
|
+
} catch (e) {
|
|
226
|
+
console.error('Installation failed:', e.message);
|
|
227
|
+
process.exit(1);
|
|
81
228
|
}
|
|
82
|
-
fs.mkdirSync(cacheDir, { recursive: true });
|
|
83
|
-
filesToCache.forEach(name => copyRecursiveCache(path.join(destDir, name), path.join(cacheDir, name)));
|
|
84
|
-
// Remove stale root-level plugin.json from cache (moved to .claude-plugin/plugin.json)
|
|
85
|
-
const staleCachePluginJson = path.join(cacheDir, 'plugin.json');
|
|
86
|
-
if (fs.existsSync(staleCachePluginJson)) fs.unlinkSync(staleCachePluginJson);
|
|
87
|
-
installedPlugins.plugins['gm@gm-cc'] = [{
|
|
88
|
-
scope: 'user',
|
|
89
|
-
installPath: cacheDir,
|
|
90
|
-
version: pluginVersion,
|
|
91
|
-
installedAt: existing?.installedAt || now,
|
|
92
|
-
lastUpdated: now
|
|
93
|
-
}];
|
|
94
|
-
fs.writeFileSync(installedPluginsPath, JSON.stringify(installedPlugins, null, 2), 'utf-8');
|
|
95
|
-
console.log('✓ Plugin registered in installed_plugins.json');
|
|
96
|
-
|
|
97
|
-
console.log(`✓ gm-cc ${isUpgrade ? 'upgraded' : 'installed'} to ${destDir}`);
|
|
98
|
-
console.log('Restart Claude Code to activate the gm plugin.');
|
|
99
|
-
} catch (e) {
|
|
100
|
-
console.error('Installation failed:', e.message);
|
|
101
|
-
process.exit(1);
|
|
102
229
|
}
|
|
@@ -76,22 +76,12 @@ try {
|
|
|
76
76
|
if (isGemini) {
|
|
77
77
|
console.log(JSON.stringify({ decision: 'deny', reason: result.reason }));
|
|
78
78
|
} else {
|
|
79
|
-
console.log(JSON.stringify({
|
|
79
|
+
console.log(JSON.stringify({ decision: 'block', reason: result.reason }));
|
|
80
80
|
}
|
|
81
81
|
process.exit(0);
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
if (isGemini) {
|
|
85
|
-
console.log(JSON.stringify({ decision: 'allow' }));
|
|
86
|
-
} else {
|
|
87
|
-
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'allow' } }));
|
|
88
|
-
}
|
|
89
84
|
process.exit(0);
|
|
90
85
|
} catch (error) {
|
|
91
|
-
if (isGemini) {
|
|
92
|
-
console.log(JSON.stringify({ decision: 'allow' }));
|
|
93
|
-
} else {
|
|
94
|
-
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'allow' } }));
|
|
95
|
-
}
|
|
96
86
|
process.exit(0);
|
|
97
87
|
}
|
|
@@ -65,7 +65,7 @@ const emit = (additionalContext) => {
|
|
|
65
65
|
} else if (isOpenCode) {
|
|
66
66
|
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'message.updated', additionalContext } }, null, 2));
|
|
67
67
|
} else {
|
|
68
|
-
console.log(JSON.stringify({
|
|
68
|
+
console.log(JSON.stringify({ additionalContext }, null, 2));
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
71
|
|
|
@@ -4,7 +4,7 @@ const fs = require('fs');
|
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const { execSync } = require('child_process');
|
|
6
6
|
|
|
7
|
-
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.GEMINI_PROJECT_DIR || process.env.OC_PLUGIN_ROOT || process.env.KILO_PLUGIN_ROOT;
|
|
7
|
+
const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.GEMINI_PROJECT_DIR || process.env.OC_PLUGIN_ROOT || process.env.KILO_PLUGIN_ROOT || path.join(__dirname, '..');
|
|
8
8
|
const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.OC_PROJECT_DIR || process.env.KILO_PROJECT_DIR;
|
|
9
9
|
|
|
10
10
|
const ensureGitignore = () => {
|
|
@@ -116,26 +116,11 @@ When exploring unfamiliar code, finding similar patterns, understanding integrat
|
|
|
116
116
|
const isKilo = process.env.KILO_PLUGIN_ROOT !== undefined;
|
|
117
117
|
|
|
118
118
|
if (isGemini) {
|
|
119
|
-
|
|
120
|
-
systemMessage: additionalContext
|
|
121
|
-
};
|
|
122
|
-
console.log(JSON.stringify(result, null, 2));
|
|
119
|
+
console.log(JSON.stringify({ systemMessage: additionalContext }, null, 2));
|
|
123
120
|
} else if (isOpenCode || isKilo) {
|
|
124
|
-
|
|
125
|
-
hookSpecificOutput: {
|
|
126
|
-
hookEventName: 'session.created',
|
|
127
|
-
additionalContext
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
console.log(JSON.stringify(result, null, 2));
|
|
121
|
+
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'session.created', additionalContext } }, null, 2));
|
|
131
122
|
} else {
|
|
132
|
-
|
|
133
|
-
hookSpecificOutput: {
|
|
134
|
-
hookEventName: 'SessionStart',
|
|
135
|
-
additionalContext
|
|
136
|
-
}
|
|
137
|
-
};
|
|
138
|
-
console.log(JSON.stringify(result, null, 2));
|
|
123
|
+
console.log(JSON.stringify({ additionalContext }, null, 2));
|
|
139
124
|
}
|
|
140
125
|
} catch (error) {
|
|
141
126
|
const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
|
|
@@ -143,23 +128,11 @@ When exploring unfamiliar code, finding similar patterns, understanding integrat
|
|
|
143
128
|
const isKilo = process.env.KILO_PLUGIN_ROOT !== undefined;
|
|
144
129
|
|
|
145
130
|
if (isGemini) {
|
|
146
|
-
console.log(JSON.stringify({
|
|
147
|
-
systemMessage: `Error executing hook: ${error.message}`
|
|
148
|
-
}, null, 2));
|
|
131
|
+
console.log(JSON.stringify({ systemMessage: `Error executing hook: ${error.message}` }, null, 2));
|
|
149
132
|
} else if (isOpenCode || isKilo) {
|
|
150
|
-
console.log(JSON.stringify({
|
|
151
|
-
hookSpecificOutput: {
|
|
152
|
-
hookEventName: 'session.created',
|
|
153
|
-
additionalContext: `Error executing hook: ${error.message}`
|
|
154
|
-
}
|
|
155
|
-
}, null, 2));
|
|
133
|
+
console.log(JSON.stringify({ hookSpecificOutput: { hookEventName: 'session.created', additionalContext: `Error executing hook: ${error.message}` } }, null, 2));
|
|
156
134
|
} else {
|
|
157
|
-
console.log(JSON.stringify({
|
|
158
|
-
hookSpecificOutput: {
|
|
159
|
-
hookEventName: 'SessionStart',
|
|
160
|
-
additionalContext: `Error executing hook: ${error.message}`
|
|
161
|
-
}
|
|
162
|
-
}, null, 2));
|
|
135
|
+
console.log(JSON.stringify({ additionalContext: `Error executing hook: ${error.message}` }, null, 2));
|
|
163
136
|
}
|
|
164
137
|
process.exit(0);
|
|
165
138
|
}
|