gm-cc 2.0.130 → 2.0.132

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.
@@ -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.130",
7
+ "version": "2.0.132",
8
8
  "metadata": {
9
9
  "description": "State machine agent with hooks, skills, and automated git enforcement"
10
10
  },
package/agents/gm.md CHANGED
@@ -105,12 +105,14 @@ All execution via `dev` skill or `agent-browser` skill. Every hypothesis proven
105
105
 
106
106
  **CODESEARCH EFFICIENCY TIP**: Multiple semantic queries cost <$0.01 total and take <1 second each. Use `code-search` skill liberally — it's designed for this. Try:"What does this function do?" → "Where is error handling implemented?" → "Show database connection setup" → each returns ranked file locations.
107
107
 
108
- **BASH WHITELIST** (only acceptable bash uses):
109
- - `git` commands (status, add, commit, push, pull, log, diff)
110
- - `npm publish`, `npm pack`, `npm install -g`
111
- - `docker` commands
112
- - Starting/stopping system services
113
- - Everything else `dev` skill
108
+ **BASH WHITELIST** environment blocks all bash except:
109
+ - `git` version control only
110
+ - `bun x gm-exec` all other shell/code execution:
111
+ - `bun x gm-exec bash --cwd=<dir> <cmd>` — run shell commands
112
+ - `bun x gm-exec exec [--lang=<lang>] [--cwd=<dir>] <code>` — execute code (nodejs default)
113
+ - `bun x gm-exec status <task_id>` — poll background task
114
+ - `bun x gm-exec close <task_id>` — delete background task
115
+ - Everything else → `dev` skill (which uses gm-exec internally)
114
116
 
115
117
  ## CHARTER 3: GROUND TRUTH
116
118
 
@@ -278,7 +280,7 @@ TOOL_INVARIANTS = {
278
280
  overview: `code-search` skill,
279
281
  process_lifecycle: `process-management` skill (PM2 mandatory for all servers/workers/daemons),
280
282
  planning: `planning` skill (mandatory in PLAN phase before any execution),
281
- bash: ONLY git/npm-publish/docker/system-services,
283
+ bash: ONLY git (version control) or `bun x gm-exec` (all other execution),
282
284
  no_direct_tool_abuse: true
283
285
  }
284
286
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm-cc",
3
- "version": "2.0.130",
3
+ "version": "2.0.132",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": "AnEntrypoint",
6
6
  "license": "MIT",
package/plugin.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gm",
3
- "version": "2.0.130",
3
+ "version": "2.0.132",
4
4
  "description": "State machine agent with hooks, skills, and automated git enforcement",
5
5
  "author": {
6
6
  "name": "AnEntrypoint",
@@ -1,48 +0,0 @@
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
@@ -1,207 +0,0 @@
1
- ---
2
- name: process-management
3
- description: >-
4
- PM2 process management for all running applications. Enforces: pre-check for
5
- running processes before start, watch enabled, autorestart disabled, lifecycle
6
- cleanup when done. Use for all servers, workers, agents, background processes.
7
- Triggers: start server, run application, background process, pm2, keep alive,
8
- process manager, daemon, monitor logs.
9
- ---
10
-
11
- # Process Management — PM2
12
-
13
- All applications MUST run through PM2. Direct invocations (node, bun, python) are forbidden for any process that produces output or has a lifecycle.
14
-
15
- ## Installation (First Time Only)
16
-
17
- Check if PM2 is installed:
18
-
19
- ```bash
20
- pm2 --version
21
- ```
22
-
23
- If command not found, install globally:
24
-
25
- ```bash
26
- npm install -g pm2
27
- ```
28
-
29
- Verify installation:
30
-
31
- ```bash
32
- pm2 --version # should print version number
33
- pm2 ping # should respond "pong"
34
- ```
35
-
36
- ## Pre-Start Check (MANDATORY)
37
-
38
- Before starting any process, check what is already running:
39
-
40
- ```bash
41
- pm2 jlist
42
- ```
43
-
44
- - `online` → already running, use `pm2 logs <name>` to observe
45
- - `stopped` → use `pm2 restart <name>`
46
- - Not in list → proceed to start
47
-
48
- Never start a duplicate process. Always check first.
49
-
50
- ## Start a Process
51
-
52
- ```bash
53
- # CLI (quick)
54
- pm2 start app.js --name myapp --watch --no-autorestart
55
-
56
- # With interpreter
57
- pm2 start script.py --interpreter python3 --name worker --watch --no-autorestart
58
-
59
- # From ecosystem config (preferred for reproducibility)
60
- pm2 start ecosystem.config.cjs
61
- ```
62
-
63
- ## Ecosystem Config (Standard Template)
64
-
65
- `autorestart: false` — process stops on crash, no automatic recovery
66
- `watch: true` — restarts on file changes in watched directories only
67
-
68
- ```javascript
69
- // ecosystem.config.cjs
70
- module.exports = {
71
- apps: [{
72
- name: "myapp",
73
- script: "src/index.js",
74
- watch: ["src", "config"],
75
- watch_delay: 1000,
76
- autorestart: false,
77
- ignore_watch: [
78
- "node_modules",
79
- ".git",
80
- "logs",
81
- "*.log",
82
- ".pm2",
83
- "public",
84
- "uploads"
85
- ],
86
- watch_options: {
87
- followSymlinks: false,
88
- usePolling: false
89
- },
90
- log_date_format: "YYYY-MM-DD HH:mm:ss",
91
- out_file: "./logs/out.log",
92
- error_file: "./logs/error.log"
93
- }]
94
- };
95
- ```
96
-
97
- ## Log Viewing
98
-
99
- ```bash
100
- pm2 logs <name> # stream live (Ctrl+C to stop)
101
- pm2 logs <name> --lines 100 # last 100 lines then stream
102
- pm2 logs <name> --err # errors only
103
- pm2 logs <name> --out # stdout only
104
- pm2 logs <name> --nostream --lines 200 # dump without follow
105
- pm2 logs --json # structured JSON output
106
- pm2 flush # clear all log files
107
- ```
108
-
109
- Log files: `~/.pm2/logs/<name>-out.log` / `<name>-error.log`
110
- Windows path: `C:\Users\<user>\.pm2\logs\`
111
-
112
- ## Lifecycle Management
113
-
114
- ```bash
115
- pm2 list # view all processes and status
116
- pm2 jlist # JSON output for scripting
117
- pm2 info <name> # detailed process info
118
- pm2 stop <name> # stop (keeps in list)
119
- pm2 restart <name> # restart
120
- pm2 delete <name> # stop + remove from list
121
- pm2 delete all # remove all processes
122
- pm2 ping # check if PM2 daemon is alive
123
- ```
124
-
125
- **When work is complete: always `pm2 delete <name>` to clean up orphaned processes.**
126
-
127
- Stopping a watched process: `pm2 stop` while watch is active restarts on next file change.
128
- To fully halt: `pm2 delete <name>` (removes it entirely).
129
-
130
- ## Windows vs Linux
131
-
132
- ### File Watching
133
-
134
- | Environment | Config |
135
- |---|---|
136
- | Linux native | `usePolling: false` (inotify kernel events) |
137
- | WSL watching `/mnt/c/...` | `usePolling: true, interval: 1000` |
138
- | Windows native | `usePolling: false` (ReadDirectoryChangesW) |
139
- | Network / NFS / Docker volumes | `usePolling: true, interval: 1000` |
140
-
141
- Linux inotify exhaustion fix (symptom: watch silently stops working):
142
- ```bash
143
- echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
144
- ```
145
-
146
- ### Windows: npm Scripts and .cmd Wrappers
147
-
148
- PM2 cannot spawn `.cmd` shims (npm, npx, etc.) directly — they require `cmd.exe`.
149
-
150
- ```javascript
151
- // ecosystem.config.cjs — Windows npm script
152
- {
153
- name: "myapp",
154
- script: "npm",
155
- args: "start",
156
- interpreter: "cmd",
157
- interpreter_args: "/c"
158
- }
159
- ```
160
-
161
- For globally installed CLIs, find the real `.js` entry point:
162
- ```bash
163
- # Linux/macOS
164
- cat "$(which myapp)" | head -5
165
-
166
- # Windows PowerShell
167
- Get-Command myapp | Select-Object -ExpandProperty Source
168
- ```
169
- Point `script` at the resolved `.js` file — never at the `.cmd` wrapper.
170
-
171
- ### Terminal Suppression on Windows (CRITICAL)
172
-
173
- All code that spawns subprocesses MUST use `windowsHide: true` to prevent popup windows.
174
-
175
- ```javascript
176
- // ❌ WRONG - will show popup windows on Windows
177
- spawn('node', ['script.js']);
178
-
179
- // ✅ CORRECT - hides windows, safe for all platforms
180
- spawn('node', ['script.js'], { windowsHide: true });
181
- ```
182
-
183
- Applies to all subprocess execution:
184
- - `child_process.spawn()` → `{ windowsHide: true }`
185
- - `child_process.exec()` → `{ windowsHide: true }`
186
- - `child_process.execFile()` → `{ windowsHide: true }`
187
- - `child_process.fork()` → `{ silent: true }` (alternative for fork)
188
-
189
- PM2-started processes automatically hide windows. Code-spawned subprocesses must explicitly set this. Forgetting creates visible popups during automation—unacceptable UX.
190
-
191
- ### Windows 11+ wmic Error
192
-
193
- PM2 uses `wmic` for process stats — removed in Windows 11+.
194
- Symptom: `Error: spawn wmic ENOENT` in `~/.pm2/pm2.log`.
195
- Fix: `npm install -g pm2@latest`. App processes continue working despite the error.
196
-
197
- ### Persistence on Reboot
198
-
199
- | Platform | Method |
200
- |---|---|
201
- | Linux | `pm2 startup && pm2 save` (auto-detects systemd/upstart/openrc) |
202
- | Windows | [pm2-installer](https://github.com/jessety/pm2-installer) (Windows Service) |
203
-
204
- ```bash
205
- pm2 save # snapshot current process list to ~/.pm2/dump.pm2
206
- pm2 resurrect # restore saved list after manual daemon restart
207
- ```