gm-gc 2.0.46 → 2.0.48
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/agents/gm.md +32 -0
- package/gemini-extension.json +1 -1
- package/package.json +1 -1
- package/skills/process-management/SKILL.md +187 -0
package/agents/gm.md
CHANGED
|
@@ -226,6 +226,38 @@ Never report work complete while uncommitted changes exist. Never leave unpushed
|
|
|
226
226
|
|
|
227
227
|
This policy applies to ALL platforms (Claude Code, Gemini CLI, OpenCode, Kilo CLI, Codex, and all IDE extensions). Platform-specific git enforcement hooks will verify compliance, but the responsibility lies with you to execute the commit and push before completion.
|
|
228
228
|
|
|
229
|
+
## CHARTER 9: PROCESS MANAGEMENT
|
|
230
|
+
|
|
231
|
+
Scope: Runtime process execution. Governs how all applications are started, monitored, and cleaned up.
|
|
232
|
+
|
|
233
|
+
**ALL APPLICATIONS MUST RUN VIA PM2.** Direct invocations (node, bun, python, npx) are forbidden for any process that produces output or has a lifecycle. This applies to servers, workers, agents, and background services.
|
|
234
|
+
|
|
235
|
+
**PRE-START CHECK (MANDATORY)**: Before starting any process, execute `pm2 jlist`. If the process exists with `online` status: observe it with `pm2 logs <name>`. If `stopped`: restart it. Only start new if not found. Never create duplicate processes.
|
|
236
|
+
|
|
237
|
+
**Standard configuration** — all PM2 processes must use:
|
|
238
|
+
- `autorestart: false` — no crash recovery, explicit control only
|
|
239
|
+
- `watch: ["src", "config"]` — file-change restarts scoped to source directories
|
|
240
|
+
- `ignore_watch: ["node_modules", ".git", "logs", "*.log"]` — never watch these
|
|
241
|
+
- `watch_delay: 1000` — debounce rapid multi-file changes
|
|
242
|
+
|
|
243
|
+
**Cross-platform requirements**:
|
|
244
|
+
- Windows: cannot spawn `.cmd` shims — use `interpreter: "cmd", interpreter_args: "/c"` for npm scripts; resolve actual `.js` path for globally installed CLIs
|
|
245
|
+
- WSL watching `/mnt/c/...` paths: set `watch_options: { usePolling: true, interval: 1000 }`
|
|
246
|
+
- Windows 11+: `spawn wmic ENOENT` in daemon logs is cosmetic — app processes work; fix with `npm install -g pm2@latest`
|
|
247
|
+
- Linux watch exhaustion: `echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p`
|
|
248
|
+
|
|
249
|
+
**Log monitoring**:
|
|
250
|
+
```bash
|
|
251
|
+
pm2 logs <name> # stream live output
|
|
252
|
+
pm2 logs <name> --lines 100 # last N lines then stream
|
|
253
|
+
pm2 logs <name> --err # errors only
|
|
254
|
+
pm2 logs <name> --nostream --lines 200 # dump without follow
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**Lifecycle cleanup**: When work is complete, always run `pm2 delete <name>`. Never leave orphaned processes. `pm2 stop` on a watched process is not sufficient — use `pm2 delete`.
|
|
258
|
+
|
|
259
|
+
See `process-management` skill for full reference, ecosystem config templates, and Windows/Linux specifics.
|
|
260
|
+
|
|
229
261
|
## CONSTRAINTS
|
|
230
262
|
|
|
231
263
|
Scope: Global prohibitions and mandates applying across all charters. Precedence cascade: CONSTRAINTS > charter-specific rules > prior habits or examples. When conflict arises, higher-precedence source wins and lower source must be revised.
|
package/gemini-extension.json
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,187 @@
|
|
|
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
|
+
### Windows 11+ wmic Error
|
|
172
|
+
|
|
173
|
+
PM2 uses `wmic` for process stats — removed in Windows 11+.
|
|
174
|
+
Symptom: `Error: spawn wmic ENOENT` in `~/.pm2/pm2.log`.
|
|
175
|
+
Fix: `npm install -g pm2@latest`. App processes continue working despite the error.
|
|
176
|
+
|
|
177
|
+
### Persistence on Reboot
|
|
178
|
+
|
|
179
|
+
| Platform | Method |
|
|
180
|
+
|---|---|
|
|
181
|
+
| Linux | `pm2 startup && pm2 save` (auto-detects systemd/upstart/openrc) |
|
|
182
|
+
| Windows | [pm2-installer](https://github.com/jessety/pm2-installer) (Windows Service) |
|
|
183
|
+
|
|
184
|
+
```bash
|
|
185
|
+
pm2 save # snapshot current process list to ~/.pm2/dump.pm2
|
|
186
|
+
pm2 resurrect # restore saved list after manual daemon restart
|
|
187
|
+
```
|