gm-codex 2.0.103 → 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.
package/cli.js CHANGED
@@ -16,13 +16,7 @@ console.log(isUpgrade ? 'Upgrading gm-codex...' : 'Installing gm-codex...');
16
16
  try {
17
17
  fs.mkdirSync(destDir, { recursive: true });
18
18
 
19
- const filesToCopy = [
20
- ['agents', 'agents'],
21
- ['hooks', 'hooks'],
22
- ['.mcp.json', '.mcp.json'],
23
- ['plugin.json', 'plugin.json'],
24
- ['README.md', 'README.md']
25
- ];
19
+ const filesToCopy = [["agents","agents"],["hooks","hooks"],[".mcp.json",".mcp.json"],["plugin.json","plugin.json"],["README.md","README.md"]];
26
20
 
27
21
  function copyRecursive(src, dst) {
28
22
  if (!fs.existsSync(src)) return;
@@ -36,9 +30,14 @@ try {
36
30
 
37
31
  filesToCopy.forEach(([src, dst]) => copyRecursive(path.join(srcDir, src), path.join(destDir, dst)));
38
32
 
39
- const destPath = process.platform === 'win32'
40
- ? destDir.replace(/\\/g, '/')
41
- : destDir;
33
+ const { execSync } = require('child_process');
34
+ try {
35
+ execSync('bunx skills add AnEntrypoint/plugforge --full-depth --all --global --yes', { stdio: 'inherit' });
36
+ } catch (e) {
37
+ console.warn('Warning: skills install failed (non-fatal):', e.message);
38
+ }
39
+
40
+ const destPath = process.platform === 'win32' ? destDir.replace(/\\/g, '/') : destDir;
42
41
  console.log(`✓ gm-codex ${isUpgrade ? 'upgraded' : 'installed'} to ${destPath}`);
43
42
  console.log('Restart Codex to activate.');
44
43
  } catch (e) {
package/hooks/hooks.json CHANGED
@@ -13,14 +13,14 @@
13
13
  ]
14
14
  }
15
15
  ],
16
- "PostToolUse": [
16
+ "SessionStart": [
17
17
  {
18
18
  "matcher": "*",
19
19
  "hooks": [
20
20
  {
21
21
  "type": "command",
22
- "command": "node ${CODEX_PLUGIN_ROOT}/hooks/post-tool-use-hook.js",
23
- "timeout": 30000
22
+ "command": "node ${CODEX_PLUGIN_ROOT}/hooks/session-start-hook.js",
23
+ "timeout": 10000
24
24
  }
25
25
  ]
26
26
  }
@@ -32,7 +32,7 @@
32
32
  {
33
33
  "type": "command",
34
34
  "command": "node ${CODEX_PLUGIN_ROOT}/hooks/prompt-submit-hook.js",
35
- "timeout": 180000
35
+ "timeout": 3600
36
36
  }
37
37
  ]
38
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/install.js CHANGED
@@ -7,64 +7,34 @@ function isInsideNodeModules() {
7
7
  }
8
8
 
9
9
  function getProjectRoot() {
10
- if (!isInsideNodeModules()) {
11
- return null;
12
- }
13
-
10
+ if (!isInsideNodeModules()) return null;
14
11
  let current = __dirname;
15
12
  while (current !== path.dirname(current)) {
16
13
  current = path.dirname(current);
17
- const parent = path.dirname(current);
18
- if (path.basename(current) === 'node_modules') {
19
- return parent;
20
- }
14
+ if (path.basename(current) === 'node_modules') return path.dirname(current);
21
15
  }
22
16
  return null;
23
17
  }
24
18
 
25
19
  function safeCopyDirectory(src, dst) {
26
20
  try {
27
- if (!fs.existsSync(src)) {
28
- return false;
29
- }
30
-
21
+ if (!fs.existsSync(src)) return false;
31
22
  fs.mkdirSync(dst, { recursive: true });
32
- const entries = fs.readdirSync(src, { withFileTypes: true });
33
-
34
- entries.forEach(entry => {
35
- const srcPath = path.join(src, entry.name);
36
- const dstPath = path.join(dst, entry.name);
37
-
38
- if (entry.isDirectory()) {
39
- safeCopyDirectory(srcPath, dstPath);
40
- } else if (entry.isFile()) {
41
- const content = fs.readFileSync(srcPath, 'utf-8');
42
- const dstDir = path.dirname(dstPath);
43
- if (!fs.existsSync(dstDir)) {
44
- fs.mkdirSync(dstDir, { recursive: true });
45
- }
46
- fs.writeFileSync(dstPath, content, 'utf-8');
47
- }
23
+ fs.readdirSync(src, { withFileTypes: true }).forEach(entry => {
24
+ const s = path.join(src, entry.name), d = path.join(dst, entry.name);
25
+ if (entry.isDirectory()) safeCopyDirectory(s, d);
26
+ else { fs.mkdirSync(path.dirname(d), { recursive: true }); fs.writeFileSync(d, fs.readFileSync(s, 'utf-8'), 'utf-8'); }
48
27
  });
49
28
  return true;
50
- } catch (err) {
51
- return false;
52
- }
29
+ } catch (e) { return false; }
53
30
  }
54
31
 
55
32
  function install() {
56
- if (!isInsideNodeModules()) {
57
- return;
58
- }
59
-
33
+ if (!isInsideNodeModules()) return;
60
34
  const projectRoot = getProjectRoot();
61
- if (!projectRoot) {
62
- return;
63
- }
64
-
35
+ if (!projectRoot) return;
65
36
  const codexDir = path.join(projectRoot, '.codex', 'plugins', 'gm');
66
37
  const sourceDir = __dirname;
67
-
68
38
  safeCopyDirectory(path.join(sourceDir, 'agents'), path.join(codexDir, 'agents'));
69
39
  safeCopyDirectory(path.join(sourceDir, 'hooks'), path.join(codexDir, 'hooks'));
70
40
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-codex",
3
- "version": "2.0.103",
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",
@@ -26,24 +26,17 @@
26
26
  "files": [
27
27
  "hooks/",
28
28
  "agents/",
29
- "skills/",
30
- "scripts/",
31
29
  ".github/",
32
30
  "README.md",
33
31
  "CLAUDE.md",
34
32
  ".mcp.json",
35
33
  "plugin.json",
36
34
  "cli.js",
37
- "install.js",
38
35
  "pre-tool-use-hook.js",
39
36
  "session-start-hook.js",
40
37
  "prompt-submit-hook.js",
41
38
  "stop-hook.js",
42
- "stop-hook-git.js",
43
- "LICENSE",
44
- ".gitignore",
45
- ".editorconfig",
46
- "CONTRIBUTING.md"
39
+ "stop-hook-git.js"
47
40
  ],
48
41
  "keywords": [
49
42
  "codex",
@@ -52,8 +45,5 @@
52
45
  "mcp",
53
46
  "automation",
54
47
  "gm"
55
- ],
56
- "scripts": {
57
- "postinstall": "node scripts/postinstall.js"
58
- }
48
+ ]
59
49
  }
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.103",
3
+ "version": "2.0.105",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": {
6
6
  "name": "AnEntrypoint",
package/.editorconfig DELETED
@@ -1,12 +0,0 @@
1
- root = true
2
-
3
- [*]
4
- indent_style = space
5
- indent_size = 2
6
- end_of_line = lf
7
- charset = utf-8
8
- trim_trailing_whitespace = true
9
- insert_final_newline = true
10
-
11
- [*.md]
12
- trim_trailing_whitespace = false
package/.gitignore DELETED
@@ -1,13 +0,0 @@
1
- node_modules/
2
- *.log
3
- *.swp
4
- *.swo
5
- .DS_Store
6
- dist/
7
- build/
8
- *.tmp
9
- .env
10
- .env.local
11
- .vscode/
12
- .idea/
13
- *.iml
package/CONTRIBUTING.md DELETED
@@ -1,26 +0,0 @@
1
- # Contributing
2
-
3
- Please ensure all code follows the conventions established in this project.
4
-
5
- ## Before Committing
6
-
7
- Run the build to verify everything is working:
8
-
9
- ```bash
10
- npm run build plugforge-starter [output-dir]
11
- ```
12
-
13
- ## Platform Conventions
14
-
15
- - Each platform adapter in `platforms/` extends PlatformAdapter or CLIAdapter
16
- - File generation logic goes in `createFileStructure()`
17
- - Use TemplateBuilder methods for shared generation logic
18
- - Skills are auto-discovered from plugforge-starter/skills/
19
-
20
- ## Testing
21
-
22
- Build all 9 platform outputs:
23
-
24
- ```bash
25
- node cli.js plugforge-starter /tmp/test-build
26
- ```
@@ -1,143 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- /**
4
- * Post-tool-use hook: Eager linting report
5
- *
6
- * If linting is available (eslint, prettier, etc.), run it on modified files.
7
- * If linting issues found, report them to agent immediately.
8
- * If no issues or no linter available, silent (do nothing).
9
- */
10
-
11
- const { execSync } = require('child_process');
12
- const fs = require('fs');
13
- const path = require('path');
14
-
15
- const cwd = process.cwd();
16
-
17
- /**
18
- * Detect available linters and run them
19
- * Returns array of issue reports
20
- */
21
- function runLinters() {
22
- const issues = [];
23
-
24
- // Detect ESLint
25
- try {
26
- if (fs.existsSync(path.join(cwd, '.eslintrc.json')) ||
27
- fs.existsSync(path.join(cwd, '.eslintrc.js')) ||
28
- fs.existsSync(path.join(cwd, 'eslint.config.js')) ||
29
- hasPackageDependency('eslint')) {
30
- const eslintOutput = execSync('npx eslint . --format=json 2>/dev/null || true', {
31
- cwd,
32
- encoding: 'utf-8',
33
- maxBuffer: 10 * 1024 * 1024
34
- }).trim();
35
-
36
- if (eslintOutput) {
37
- try {
38
- const results = JSON.parse(eslintOutput);
39
- const filtered = results.filter(r => r.messages?.length > 0);
40
- if (filtered.length > 0) {
41
- issues.push({
42
- tool: 'ESLint',
43
- issues: filtered
44
- });
45
- }
46
- } catch (e) {
47
- // JSON parse failed, skip
48
- }
49
- }
50
- }
51
- } catch (e) {
52
- // ESLint not available, continue
53
- }
54
-
55
- // Detect Prettier
56
- try {
57
- if (fs.existsSync(path.join(cwd, '.prettierrc')) ||
58
- fs.existsSync(path.join(cwd, '.prettierrc.json')) ||
59
- fs.existsSync(path.join(cwd, 'prettier.config.js')) ||
60
- hasPackageDependency('prettier')) {
61
- const prettierOutput = execSync('npx prettier . --check 2>&1 || true', {
62
- cwd,
63
- encoding: 'utf-8',
64
- maxBuffer: 10 * 1024 * 1024
65
- }).trim();
66
-
67
- if (prettierOutput && !prettierOutput.includes('All matched files use Prettier code style')) {
68
- issues.push({
69
- tool: 'Prettier',
70
- output: prettierOutput
71
- });
72
- }
73
- }
74
- } catch (e) {
75
- // Prettier not available, continue
76
- }
77
-
78
- return issues;
79
- }
80
-
81
- /**
82
- * Check if package has a dependency (in package.json)
83
- */
84
- function hasPackageDependency(pkg) {
85
- try {
86
- const pkgPath = path.join(cwd, 'package.json');
87
- if (fs.existsSync(pkgPath)) {
88
- const content = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
89
- return !!(
90
- content.dependencies?.[pkg] ||
91
- content.devDependencies?.[pkg] ||
92
- content.optionalDependencies?.[pkg]
93
- );
94
- }
95
- } catch (e) {
96
- return false;
97
- }
98
- return false;
99
- }
100
-
101
- /**
102
- * Format and report linting issues
103
- */
104
- function reportIssues(issues) {
105
- if (!issues || issues.length === 0) {
106
- return; // Silent if no issues
107
- }
108
-
109
- let report = '\n⚠️ LINTING ISSUES DETECTED:\n\n';
110
-
111
- issues.forEach(({ tool, issues: eslintIssues, output }) => {
112
- report += `## ${tool}\n`;
113
-
114
- if (eslintIssues) {
115
- // ESLint format
116
- eslintIssues.forEach(file => {
117
- if (file.messages.length > 0) {
118
- report += `\n**${file.filePath}**\n`;
119
- file.messages.forEach(msg => {
120
- const severity = msg.severity === 2 ? '❌ ERROR' : '⚠️ WARN';
121
- report += ` ${severity} (${msg.line}:${msg.column}) ${msg.message} [${msg.ruleId}]\n`;
122
- });
123
- }
124
- });
125
- } else if (output) {
126
- // Prettier format
127
- report += `\n${output}\n`;
128
- }
129
-
130
- report += '\n';
131
- });
132
-
133
- report += 'Fix these issues before marking work complete.\n';
134
- console.log(report);
135
- }
136
-
137
- // Main
138
- try {
139
- const issues = runLinters();
140
- reportIssues(issues);
141
- } catch (e) {
142
- // Silent on errors - don't break the workflow
143
- }