gm-copilot-cli 2.0.104 → 2.0.105

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: gm
3
- version: 2.0.104
3
+ version: 2.0.105
4
4
  description: State machine agent with hooks, skills, and automated git enforcement
5
5
  author: AnEntrypoint
6
6
  repository: https://github.com/AnEntrypoint/gm-copilot-cli
package/hooks/hooks.json CHANGED
@@ -13,6 +13,18 @@
13
13
  ]
14
14
  }
15
15
  ],
16
+ "session:start": [
17
+ {
18
+ "matcher": "*",
19
+ "hooks": [
20
+ {
21
+ "type": "command",
22
+ "command": "node ${COPILOT_EXTENSION_DIR}/hooks/session-start-hook.js",
23
+ "timeout": 10000
24
+ }
25
+ ]
26
+ }
27
+ ],
16
28
  "prompt:submit": [
17
29
  {
18
30
  "matcher": "*",
@@ -20,7 +32,7 @@
20
32
  {
21
33
  "type": "command",
22
34
  "command": "node ${COPILOT_EXTENSION_DIR}/hooks/prompt-submit-hook.js",
23
- "timeout": 180000
35
+ "timeout": 3600
24
36
  }
25
37
  ]
26
38
  }
@@ -24,7 +24,7 @@ const run = () => {
24
24
  if (writeTools.includes(tool_name)) {
25
25
  const file_path = tool_input?.file_path || '';
26
26
  const ext = path.extname(file_path);
27
- const inSkillsDir = file_path.includes('/skills/');
27
+ const inSkillsDir = file_path.includes('/skills/') || file_path.includes('\\skills\\');
28
28
  const base = path.basename(file_path).toLowerCase();
29
29
  if ((ext === '.md' || ext === '.txt' || base.startsWith('features_list')) &&
30
30
  !base.startsWith('claude') && !base.startsWith('readme') && !inSkillsDir) {
@@ -59,7 +59,7 @@ const run = () => {
59
59
  const command = (tool_input?.command || '').trim();
60
60
  const allowed = /^(git |gh |npm |npx |bun |node |python |python3 |ruby |go |deno |tsx |ts-node |docker |sudo systemctl|systemctl |pm2 |cd |agent-browser )/.test(command);
61
61
  if (!allowed) {
62
- return { block: true, reason: 'Bash only allows: git, gh, node, python, bun, npx, ruby, go, deno, docker, npm, systemctl, pm2, cd, agent-browser. Write all logic as code and execute it via Bash (e.g. node -e "...", python -c "...", bun -e "..."). Use Read/Write/Edit for file ops. Use code-search skill for exploration.' };
62
+ return { block: true, reason: 'Bash only allows: git, gh, node, python, bun, npx, ruby, go, deno, docker, npm, systemctl, pm2, cd. Write all logic as code and execute it via Bash (e.g. node -e "...", python -c "...", bun -e "..."). Use Read/Write/Edit for file ops. Use code-search skill for exploration.' };
63
63
  }
64
64
  }
65
65
 
@@ -30,7 +30,6 @@ const ensureGitignore = () => {
30
30
  }
31
31
  };
32
32
 
33
-
34
33
  const getBaseContext = (resetMsg = '') => {
35
34
  let ctx = 'use gm agent';
36
35
  if (resetMsg) ctx += ' - ' + resetMsg;
@@ -0,0 +1,171 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require('fs');
4
+ const path = require('path');
5
+ const { execSync } = require('child_process');
6
+
7
+ const pluginRoot = process.env.CLAUDE_PLUGIN_ROOT || process.env.GEMINI_PROJECT_DIR || process.env.OC_PLUGIN_ROOT;
8
+ const projectDir = process.env.CLAUDE_PROJECT_DIR || process.env.GEMINI_PROJECT_DIR || process.env.OC_PROJECT_DIR;
9
+
10
+ const ensureGitignore = () => {
11
+ if (!projectDir) return;
12
+ const gitignorePath = path.join(projectDir, '.gitignore');
13
+ const entry = '.gm-stop-verified';
14
+ try {
15
+ let content = '';
16
+ if (fs.existsSync(gitignorePath)) {
17
+ content = fs.readFileSync(gitignorePath, 'utf-8');
18
+ }
19
+ if (!content.split('\n').some(line => line.trim() === entry)) {
20
+ const newContent = content.endsWith('\n') || content === ''
21
+ ? content + entry + '\n'
22
+ : content + '\n' + entry + '\n';
23
+ fs.writeFileSync(gitignorePath, newContent);
24
+ }
25
+ } catch (e) {
26
+ // Silently fail - not critical
27
+ }
28
+ };
29
+
30
+ ensureGitignore();
31
+
32
+ try {
33
+ let outputs = [];
34
+
35
+ // 1. Read ./start.md
36
+ if (pluginRoot) {
37
+ const startMdPath = path.join(pluginRoot, '/agents/gm.md');
38
+ try {
39
+ const startMdContent = fs.readFileSync(startMdPath, 'utf-8');
40
+ outputs.push(startMdContent);
41
+ } catch (e) {
42
+ // File may not exist in this context
43
+ }
44
+ }
45
+
46
+ // 2. Add semantic code-search explanation
47
+ const codeSearchContext = `## 🔍 Semantic Code Search Now Available
48
+
49
+ Your prompts will trigger **semantic code search** - intelligent, intent-based exploration of your codebase.
50
+
51
+ ### How It Works
52
+ Describe what you need in plain language, and the search understands your intent:
53
+ - "Find authentication validation" → locates auth checks, guards, permission logic
54
+ - "Where is database initialization?" → finds connection setup, migrations, schemas
55
+ - "Show error handling patterns" → discovers try/catch patterns, error boundaries
56
+
57
+ NOT syntax-based regex matching - truly semantic understanding across files.
58
+
59
+ ### Example
60
+ Instead of regex patterns, simply describe your intent:
61
+ "Find where API authorization is checked"
62
+
63
+ The search will find permission validations, role checks, authentication guards - however they're implemented.
64
+
65
+ ### When to Use Code Search
66
+ When exploring unfamiliar code, finding similar patterns, understanding integrations, or locating feature implementations across your codebase.`;
67
+ outputs.push(codeSearchContext);
68
+
69
+ // 3. Run mcp-thorns (bun x with npx fallback)
70
+ if (projectDir && fs.existsSync(projectDir)) {
71
+ try {
72
+ let thornOutput;
73
+ try {
74
+ thornOutput = execSync(`bun x mcp-thorns@latest`, {
75
+ encoding: 'utf-8',
76
+ stdio: ['pipe', 'pipe', 'pipe'],
77
+ cwd: projectDir,
78
+ timeout: 180000,
79
+ killSignal: 'SIGTERM'
80
+ });
81
+ } catch (bunErr) {
82
+ if (bunErr.killed && bunErr.signal === 'SIGTERM') {
83
+ thornOutput = '=== mcp-thorns ===\nSkipped (3min timeout)';
84
+ } else {
85
+ try {
86
+ thornOutput = execSync(`npx -y mcp-thorns@latest`, {
87
+ encoding: 'utf-8',
88
+ stdio: ['pipe', 'pipe', 'pipe'],
89
+ cwd: projectDir,
90
+ timeout: 180000,
91
+ killSignal: 'SIGTERM'
92
+ });
93
+ } catch (npxErr) {
94
+ if (npxErr.killed && npxErr.signal === 'SIGTERM') {
95
+ thornOutput = '=== mcp-thorns ===\nSkipped (3min timeout)';
96
+ } else {
97
+ thornOutput = `=== mcp-thorns ===\nSkipped (error: ${bunErr.message.split('\n')[0]})`;
98
+ }
99
+ }
100
+ }
101
+ }
102
+ outputs.push(`=== This is your initial insight of the repository, look at every possible aspect of this for initial opinionation and to offset the need for code exploration ===\n${thornOutput}`);
103
+ } catch (e) {
104
+ if (e.killed && e.signal === 'SIGTERM') {
105
+ outputs.push(`=== mcp-thorns ===\nSkipped (3min timeout)`);
106
+ } else {
107
+ outputs.push(`=== mcp-thorns ===\nSkipped (error: ${e.message.split('\n')[0]})`);
108
+ }
109
+ }
110
+ }
111
+ outputs.push('Use gm as a philosophy to coordinate all plans and the gm subagent to create and execute all plans');
112
+ const additionalContext = outputs.join('\n\n');
113
+
114
+ const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
115
+ const isOpenCode = process.env.OC_PLUGIN_ROOT !== undefined;
116
+
117
+ if (isGemini) {
118
+ const result = {
119
+ systemMessage: additionalContext
120
+ };
121
+ console.log(JSON.stringify(result, null, 2));
122
+ } else if (isOpenCode) {
123
+ const result = {
124
+ hookSpecificOutput: {
125
+ hookEventName: 'session.created',
126
+ additionalContext
127
+ }
128
+ };
129
+ console.log(JSON.stringify(result, null, 2));
130
+ } else {
131
+ const result = {
132
+ hookSpecificOutput: {
133
+ hookEventName: 'SessionStart',
134
+ additionalContext
135
+ }
136
+ };
137
+ console.log(JSON.stringify(result, null, 2));
138
+ }
139
+ } catch (error) {
140
+ const isGemini = process.env.GEMINI_PROJECT_DIR !== undefined;
141
+ const isOpenCode = process.env.OC_PLUGIN_ROOT !== undefined;
142
+
143
+ if (isGemini) {
144
+ console.log(JSON.stringify({
145
+ systemMessage: `Error executing hook: ${error.message}`
146
+ }, null, 2));
147
+ } else if (isOpenCode) {
148
+ console.log(JSON.stringify({
149
+ hookSpecificOutput: {
150
+ hookEventName: 'session.created',
151
+ additionalContext: `Error executing hook: ${error.message}`
152
+ }
153
+ }, null, 2));
154
+ } else {
155
+ console.log(JSON.stringify({
156
+ hookSpecificOutput: {
157
+ hookEventName: 'SessionStart',
158
+ additionalContext: `Error executing hook: ${error.message}`
159
+ }
160
+ }, null, 2));
161
+ }
162
+ process.exit(0);
163
+ }
164
+
165
+
166
+
167
+
168
+
169
+
170
+
171
+
package/manifest.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  name: gm
2
- version: 2.0.104
2
+ version: 2.0.105
3
3
  description: State machine agent with hooks, skills, and automated git enforcement
4
4
  author: AnEntrypoint
5
5
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-copilot-cli",
3
- "version": "2.0.104",
3
+ "version": "2.0.105",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
@@ -28,7 +28,6 @@
28
28
  "agents/",
29
29
  "hooks/",
30
30
  "skills/",
31
- "scripts/",
32
31
  ".github/",
33
32
  "copilot-profile.md",
34
33
  "tools.json",
@@ -36,8 +35,5 @@
36
35
  ".mcp.json",
37
36
  "README.md",
38
37
  "COPILOT.md"
39
- ],
40
- "scripts": {
41
- "postinstall": "node scripts/postinstall.js"
42
- }
38
+ ]
43
39
  }
@@ -0,0 +1,48 @@
1
+ ---
2
+ name: dev
3
+ description: Execute code and shell commands. Use for all code execution, file operations, running scripts, testing hypotheses, and any task that requires running code. Replaces plugin:gm:dev and mcp-glootie.
4
+ allowed-tools: Bash
5
+ ---
6
+
7
+ # Code Execution with dev
8
+
9
+ Execute code directly using the Bash tool. No wrapper, no persistent files, no cleanup needed beyond what the code itself creates.
10
+
11
+ ## Run code inline
12
+
13
+ ```bash
14
+ # JavaScript / TypeScript
15
+ bun -e "const fs = require('fs'); console.log(fs.readdirSync('.'))"
16
+ bun -e "import { readFileSync } from 'fs'; console.log(readFileSync('package.json', 'utf-8'))"
17
+
18
+ # Run a file
19
+ bun run script.ts
20
+ node script.js
21
+
22
+ # Python
23
+ python -c "import json; print(json.dumps({'ok': True}))"
24
+
25
+ # Shell
26
+ bash -c "ls -la && cat package.json"
27
+ ```
28
+
29
+ ## File operations (inline, no temp files)
30
+
31
+ ```bash
32
+ # Read
33
+ bun -e "console.log(require('fs').readFileSync('path/to/file', 'utf-8'))"
34
+
35
+ # Write
36
+ bun -e "require('fs').writeFileSync('out.json', JSON.stringify({x:1}, null, 2))"
37
+
38
+ # Stat / exists
39
+ bun -e "const fs=require('fs'); console.log(fs.existsSync('file.txt'), fs.statSync?.('.')?.size)"
40
+ ```
41
+
42
+ ## Rules
43
+
44
+ - Each run under 15 seconds
45
+ - Pack every related hypothesis into one run — never one idea per run
46
+ - No persistent temp files; if a temp file is needed, delete it in the same command
47
+ - No spawn/exec/fork inside executed code
48
+ - Use `bun` over `node` when available