@marcfargas/skills 0.2.1 → 0.3.0
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/LICENSE-CC0 +118 -0
- package/README.md +8 -1
- package/package.json +6 -2
- package/process/pm2/SKILL.md +240 -0
- package/terminal/vhs/SKILL.md +89 -1
package/LICENSE-CC0
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
CC0 1.0 Universal
|
|
2
|
+
|
|
3
|
+
Statement of Purpose
|
|
4
|
+
|
|
5
|
+
The laws of most jurisdictions throughout the world automatically confer
|
|
6
|
+
exclusive Copyright and Related Rights (defined below) upon the creator and
|
|
7
|
+
subsequent owner(s) (each and all, an "owner") of an original work of
|
|
8
|
+
authorship and/or a database (each, a "Work").
|
|
9
|
+
|
|
10
|
+
Certain owners wish to permanently relinquish those rights to a Work for the
|
|
11
|
+
purpose of contributing to a commons of creative, cultural and scientific
|
|
12
|
+
works ("Commons") that the public can reliably and without fear of later
|
|
13
|
+
claims of infringement build upon, modify, incorporate in other works, reuse
|
|
14
|
+
and redistribute as freely as possible in any form whatsoever and for any
|
|
15
|
+
purposes, including without limitation commercial purposes. These owners may
|
|
16
|
+
contribute to the Commons to promote the ideal of a free culture and the
|
|
17
|
+
further production of creative, cultural and scientific works, or to gain
|
|
18
|
+
reputation or greater distribution for their Work in part through the use and
|
|
19
|
+
efforts of others.
|
|
20
|
+
|
|
21
|
+
For these and/or other purposes and motivations, and without any expectation
|
|
22
|
+
of additional consideration or compensation, the person associating CC0 with a
|
|
23
|
+
Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
|
|
24
|
+
and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
|
|
25
|
+
and publicly distribute the Work under its terms, with knowledge of his or her
|
|
26
|
+
Copyright and Related Rights in the Work and the meaning and intended legal
|
|
27
|
+
effect of CC0 on those rights.
|
|
28
|
+
|
|
29
|
+
1. Copyright and Related Rights. A Work made available under CC0 may be
|
|
30
|
+
protected by copyright and related or neighboring rights ("Copyright and
|
|
31
|
+
Related Rights"). Copyright and Related Rights include, but are not limited
|
|
32
|
+
to, the following:
|
|
33
|
+
|
|
34
|
+
i. the right to reproduce, adapt, distribute, perform, display, communicate,
|
|
35
|
+
and translate a Work;
|
|
36
|
+
|
|
37
|
+
ii. moral rights retained by the original author(s) and/or performer(s);
|
|
38
|
+
|
|
39
|
+
iii. publicity and privacy rights pertaining to a person's image or likeness
|
|
40
|
+
depicted in a Work;
|
|
41
|
+
|
|
42
|
+
iv. rights protecting against unfair competition in regards to a Work,
|
|
43
|
+
subject to the limitations in paragraph 4(a), below;
|
|
44
|
+
|
|
45
|
+
v. rights protecting the extraction, dissemination, use and reuse of data in
|
|
46
|
+
a Work;
|
|
47
|
+
|
|
48
|
+
vi. database rights (such as those arising under Directive 96/9/EC of the
|
|
49
|
+
European Parliament and of the Council of 11 March 1996 on the legal
|
|
50
|
+
protection of databases, and under any national implementation thereof,
|
|
51
|
+
including any amended or successor version of such directive); and
|
|
52
|
+
|
|
53
|
+
vii. other similar, equivalent or corresponding rights throughout the world
|
|
54
|
+
based on applicable law or treaty, and any national implementations
|
|
55
|
+
thereof.
|
|
56
|
+
|
|
57
|
+
2. Waiver. To the greatest extent permitted by, but not in contravention of,
|
|
58
|
+
applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
|
|
59
|
+
unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
|
|
60
|
+
and Related Rights and associated claims and causes of action, whether now
|
|
61
|
+
known or unknown (including existing as well as future claims and causes of
|
|
62
|
+
action), in the Work (i) in all territories worldwide, (ii) for the maximum
|
|
63
|
+
duration provided by applicable law or treaty (including future time
|
|
64
|
+
extensions), (iii) in any current or future medium and for any number of
|
|
65
|
+
copies, and (iv) for any purpose whatsoever, including without limitation
|
|
66
|
+
commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
|
|
67
|
+
the Waiver for the benefit of each member of the public at large and to the
|
|
68
|
+
detriment of Affirmer's heirs and successors, fully intending that such Waiver
|
|
69
|
+
shall not be subject to revocation, rescission, cancellation, termination, or
|
|
70
|
+
any other legal or equitable action to disrupt the quiet enjoyment of the Work
|
|
71
|
+
by the public as contemplated by Affirmer's express Statement of Purpose.
|
|
72
|
+
|
|
73
|
+
3. Public License Fallback. Should any part of the Waiver for any reason be
|
|
74
|
+
judged legally invalid or ineffective under applicable law, then the Waiver
|
|
75
|
+
shall be preserved to the maximum extent permitted taking into account
|
|
76
|
+
Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
|
|
77
|
+
is so judged Affirmer hereby grants to each affected person a royalty-free,
|
|
78
|
+
non transferable, non sublicensable, non exclusive, irrevocable and
|
|
79
|
+
unconditional license to exercise Affirmer's Copyright and Related Rights in
|
|
80
|
+
the Work (i) in all territories worldwide, (ii) for the maximum duration
|
|
81
|
+
provided by applicable law or treaty (including future time extensions), (iii)
|
|
82
|
+
in any current or future medium and for any number of copies, and (iv) for any
|
|
83
|
+
purpose whatsoever, including without limitation commercial, advertising or
|
|
84
|
+
promotional purposes (the "License"). The License shall be deemed effective as
|
|
85
|
+
of the date CC0 was applied by Affirmer to the Work. Should any part of the
|
|
86
|
+
License for any reason be judged legally invalid or ineffective under
|
|
87
|
+
applicable law, such partial invalidity or ineffectiveness shall not invalidate
|
|
88
|
+
the remainder of the License, and in such case Affirmer hereby affirms that he
|
|
89
|
+
or she will not (i) exercise any of his or her remaining Copyright and Related
|
|
90
|
+
Rights in the Work or (ii) assert any associated claims and causes of action
|
|
91
|
+
with respect to the Work, in either case contrary to Affirmer's express
|
|
92
|
+
Statement of Purpose.
|
|
93
|
+
|
|
94
|
+
4. Limitations and Disclaimers.
|
|
95
|
+
|
|
96
|
+
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
|
97
|
+
surrendered, licensed or otherwise affected by this document.
|
|
98
|
+
|
|
99
|
+
b. Affirmer offers the Work as-is and makes no representations or warranties
|
|
100
|
+
of any kind concerning the Work, express, implied, statutory or otherwise,
|
|
101
|
+
including without limitation warranties of title, merchantability, fitness
|
|
102
|
+
for a particular purpose, non infringement, or the absence of latent or
|
|
103
|
+
other defects, accuracy, or the present or absence of errors, whether or
|
|
104
|
+
not discoverable, all to the greatest extent permissible under applicable
|
|
105
|
+
law.
|
|
106
|
+
|
|
107
|
+
c. Affirmer disclaims responsibility for clearing rights of other persons
|
|
108
|
+
that may apply to the Work or any use thereof, including without limitation
|
|
109
|
+
any person's Copyright and Related Rights in the Work. Further, Affirmer
|
|
110
|
+
disclaims responsibility for obtaining any necessary consents, permissions
|
|
111
|
+
or other rights required for any use of the Work.
|
|
112
|
+
|
|
113
|
+
d. Affirmer understands and acknowledges that Creative Commons is not a party
|
|
114
|
+
to this document and has no duty or obligation with respect to this CC0 or
|
|
115
|
+
use of the Work.
|
|
116
|
+
|
|
117
|
+
For more information, please see
|
|
118
|
+
<http://creativecommons.org/publicdomain/zero/1.0/>
|
package/README.md
CHANGED
|
@@ -7,6 +7,7 @@ Reusable skills for AI coding agents. Works with [pi](https://github.com/marioze
|
|
|
7
7
|
| Category | Skill | Description |
|
|
8
8
|
|----------|-------|-------------|
|
|
9
9
|
| ☁️ Google Cloud | [gcloud](google-cloud/gcloud/) | GCP CLI with agent safety model — hub + 7 reference files |
|
|
10
|
+
| ⚙️ Process | [pm2](process/pm2/) | Process management — keep services alive, auto-restart, monitoring, ecosystem configs |
|
|
10
11
|
| 🚀 Release | [pre-release](release/pre-release/) | Pre-release checklist + AI-written changesets via @changesets/cli |
|
|
11
12
|
| 🔍 Search | [web-search](search/web-search/) | Web search + content extraction via [ddgs](https://github.com/deedy5/ddgs) — no API keys |
|
|
12
13
|
| 🎬 Terminal | [vhs](terminal/vhs/) | Record terminal sessions as GIF/MP4 with [VHS](https://github.com/charmbracelet/vhs) |
|
|
@@ -70,6 +71,8 @@ Skills use a **hub + spoke** architecture. The SKILL.md hub is ~140 lines — ju
|
|
|
70
71
|
skills/
|
|
71
72
|
├── google-cloud/
|
|
72
73
|
│ └── gcloud/ # 8 files, ~1100 lines total
|
|
74
|
+
├── process/
|
|
75
|
+
│ └── pm2/ # 1 file
|
|
73
76
|
├── release/
|
|
74
77
|
│ └── pre-release/ # 1 file
|
|
75
78
|
├── search/
|
|
@@ -126,4 +129,8 @@ Building high-quality, multi-model-reviewed agent skills takes serious token bud
|
|
|
126
129
|
|
|
127
130
|
## License
|
|
128
131
|
|
|
129
|
-
MIT
|
|
132
|
+
**Code** (scripts, tooling): [MIT](./LICENSE)
|
|
133
|
+
|
|
134
|
+
**Skill content** (`**/SKILL.md` and reference docs): [CC0 1.0 Universal](./LICENSE-CC0) — public domain, no attribution required.
|
|
135
|
+
|
|
136
|
+
Why CC0 for skills: Skill docs are consumed by AI agents and freely incorporated into any workflow. Attribution requirements create friction in agent contexts where provenance tracking is impractical.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marcfargas/skills",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Reusable AI agent skills for pi, Claude Code, Cursor, and any Agent Skills compatible agent",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Marc Fargas <marc@marcfargas.com>",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"ai-agent",
|
|
15
15
|
"skills",
|
|
16
16
|
"gcloud",
|
|
17
|
+
"pm2",
|
|
17
18
|
"pre-release",
|
|
18
19
|
"vhs",
|
|
19
20
|
"web-search"
|
|
@@ -21,6 +22,7 @@
|
|
|
21
22
|
"pi": {
|
|
22
23
|
"skills": [
|
|
23
24
|
"google-cloud",
|
|
25
|
+
"process",
|
|
24
26
|
"release",
|
|
25
27
|
"search",
|
|
26
28
|
"terminal"
|
|
@@ -37,10 +39,12 @@
|
|
|
37
39
|
},
|
|
38
40
|
"files": [
|
|
39
41
|
"google-cloud/",
|
|
42
|
+
"process/",
|
|
40
43
|
"release/",
|
|
41
44
|
"search/",
|
|
42
45
|
"terminal/",
|
|
43
46
|
"README.md",
|
|
44
|
-
"LICENSE"
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"LICENSE-CC0"
|
|
45
49
|
]
|
|
46
50
|
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pm2
|
|
3
|
+
description: >-
|
|
4
|
+
Process management with PM2 — start, stop, restart, monitor long-running
|
|
5
|
+
processes. Use when: keeping services alive, auto-restart on crash, managing
|
|
6
|
+
daemon processes, ecosystem configs, log management, startup scripts, process
|
|
7
|
+
monitoring. Triggers: pm2, process manager, keep alive, daemon, auto-restart,
|
|
8
|
+
ecosystem config, process monitoring.
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# PM2 — Process Manager
|
|
12
|
+
|
|
13
|
+
PM2 keeps processes alive, restarts them on crash, and provides monitoring/logging.
|
|
14
|
+
Use for long-running services, persistent agents, background workers.
|
|
15
|
+
|
|
16
|
+
> **Not for detached terminals** — use [holdpty](https://github.com/marcfargas/holdpty) when you need PTY output, attach/view, or interactive sessions.
|
|
17
|
+
> **Not for ephemeral tasks** — use `pi -p > file &` for quick fire-and-forget agent runs.
|
|
18
|
+
|
|
19
|
+
## Quick Reference
|
|
20
|
+
|
|
21
|
+
### Start a process
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Simple
|
|
25
|
+
pm2 start server.js --name myapp
|
|
26
|
+
|
|
27
|
+
# With interpreter
|
|
28
|
+
pm2 start script.py --interpreter python3 --name worker
|
|
29
|
+
|
|
30
|
+
# With arguments (use -- to separate pm2 args from script args)
|
|
31
|
+
pm2 start app.js --name api -- --port 3000 --env production
|
|
32
|
+
|
|
33
|
+
# From ecosystem file
|
|
34
|
+
pm2 start ecosystem.config.cjs
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Manage processes
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
pm2 list # List all processes (table)
|
|
41
|
+
pm2 jlist # List as JSON (for scripting)
|
|
42
|
+
pm2 info <name|id> # Detailed process info
|
|
43
|
+
pm2 restart <name|id|all> # Restart
|
|
44
|
+
pm2 stop <name|id|all> # Stop (keeps in list)
|
|
45
|
+
pm2 delete <name|id|all> # Stop + remove from list
|
|
46
|
+
pm2 restart <name> --update-env # Restart with refreshed env vars
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Logs
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
pm2 logs # Tail all logs
|
|
53
|
+
pm2 logs <name> --lines 50 # Tail specific process, last 50 lines
|
|
54
|
+
pm2 flush # Clear all log files
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Log files location: `~/.pm2/logs/<name>-out.log` and `<name>-error.log`.
|
|
58
|
+
|
|
59
|
+
### Monitoring
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
pm2 monit # Real-time TUI: CPU, memory, logs
|
|
63
|
+
pm2 dash # Dashboard with monitoring + logs
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Ecosystem Config
|
|
67
|
+
|
|
68
|
+
For reproducible multi-process setups, use an `ecosystem.config.cjs` file:
|
|
69
|
+
|
|
70
|
+
```javascript
|
|
71
|
+
// ecosystem.config.cjs
|
|
72
|
+
module.exports = {
|
|
73
|
+
apps: [
|
|
74
|
+
{
|
|
75
|
+
name: "api",
|
|
76
|
+
script: "dist/server.js",
|
|
77
|
+
instances: 2, // cluster mode
|
|
78
|
+
exec_mode: "cluster",
|
|
79
|
+
env: {
|
|
80
|
+
NODE_ENV: "production",
|
|
81
|
+
PORT: 3000,
|
|
82
|
+
},
|
|
83
|
+
max_memory_restart: "500M",
|
|
84
|
+
log_date_format: "YYYY-MM-DD HH:mm:ss",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: "worker",
|
|
88
|
+
script: "dist/worker.js",
|
|
89
|
+
autorestart: true,
|
|
90
|
+
max_restarts: 10,
|
|
91
|
+
restart_delay: 5000,
|
|
92
|
+
exp_backoff_restart_delay: 100, // exponential backoff
|
|
93
|
+
watch: false,
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
};
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
pm2 start ecosystem.config.cjs # Start all apps
|
|
101
|
+
pm2 start ecosystem.config.cjs --only api # Start specific app
|
|
102
|
+
pm2 restart ecosystem.config.cjs # Restart all
|
|
103
|
+
pm2 delete ecosystem.config.cjs # Stop + remove all
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Useful ecosystem options
|
|
107
|
+
|
|
108
|
+
| Option | Type | Description |
|
|
109
|
+
|--------|------|-------------|
|
|
110
|
+
| `script` | string | Script to run (required) |
|
|
111
|
+
| `interpreter` | string | Override interpreter (default: `node`) |
|
|
112
|
+
| `args` | string or string[] | Script arguments |
|
|
113
|
+
| `cwd` | string | Working directory |
|
|
114
|
+
| `instances` | number | Number of instances (cluster mode) |
|
|
115
|
+
| `exec_mode` | string | `"fork"` (default) or `"cluster"` |
|
|
116
|
+
| `autorestart` | boolean | Auto-restart on exit (default: `true`) |
|
|
117
|
+
| `max_restarts` | number | Max consecutive restarts before stopping |
|
|
118
|
+
| `restart_delay` | number | Delay between restarts (ms) |
|
|
119
|
+
| `exp_backoff_restart_delay` | number | Exponential backoff base (ms) |
|
|
120
|
+
| `max_memory_restart` | string | Restart if memory exceeds (e.g. `"500M"`) |
|
|
121
|
+
| `cron_restart` | string | Cron-based restart schedule |
|
|
122
|
+
| `watch` | boolean or string[] | Watch for file changes |
|
|
123
|
+
| `ignore_watch` | string[] | Paths to ignore when watching |
|
|
124
|
+
| `env` | object | Environment variables |
|
|
125
|
+
| `log_date_format` | string | Timestamp format for logs |
|
|
126
|
+
| `error_file` | string | Custom stderr log path |
|
|
127
|
+
| `out_file` | string | Custom stdout log path |
|
|
128
|
+
| `merge_logs` | boolean | Merge cluster instance logs |
|
|
129
|
+
| `stop_exit_codes` | number[] | Exit codes that skip auto-restart |
|
|
130
|
+
|
|
131
|
+
## Persistence
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
pm2 save # Save current process list
|
|
135
|
+
pm2 resurrect # Restore saved process list
|
|
136
|
+
pm2 startup # Generate OS startup script (auto-start on boot)
|
|
137
|
+
pm2 unstartup # Remove startup script
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
After `pm2 startup`, run the command it outputs (may need admin/sudo).
|
|
141
|
+
Then `pm2 save` to snapshot current processes — they'll auto-start on reboot.
|
|
142
|
+
|
|
143
|
+
## Windows Gotchas
|
|
144
|
+
|
|
145
|
+
### `.cmd` wrapper resolution
|
|
146
|
+
|
|
147
|
+
PM2 tries to run `.cmd` files as Node.js scripts. **Never start a `.cmd` shim directly** with PM2.
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# ❌ WRONG — resolves to pi.cmd, crashes
|
|
151
|
+
pm2 start pi -- -p "prompt"
|
|
152
|
+
|
|
153
|
+
# ✅ CORRECT — point to the actual .js entry point
|
|
154
|
+
pm2 start /path/to/cli.js --interpreter node -- -p "prompt"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
For npm-installed CLIs, find the real script:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Find where the .cmd shim points
|
|
161
|
+
cat "$(which pi)" | head -5
|
|
162
|
+
# → Look for the .js path, then use that with --interpreter node
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
In ecosystem configs, always use the resolved `.js` path:
|
|
166
|
+
|
|
167
|
+
```javascript
|
|
168
|
+
module.exports = {
|
|
169
|
+
apps: [{
|
|
170
|
+
name: "my-agent",
|
|
171
|
+
// Resolve the actual cli.js, not the .cmd wrapper
|
|
172
|
+
script: "C:\\path\\to\\node_modules\\package\\dist\\cli.js",
|
|
173
|
+
interpreter: "node",
|
|
174
|
+
args: ["--mode", "json"],
|
|
175
|
+
}],
|
|
176
|
+
};
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Log paths
|
|
180
|
+
|
|
181
|
+
PM2 stores logs at `~/.pm2/logs/`. On Windows this is typically `C:\Users\<user>\.pm2\logs\`.
|
|
182
|
+
|
|
183
|
+
### Daemon
|
|
184
|
+
|
|
185
|
+
PM2 daemon runs as a background Node.js process. `pm2 kill` stops the daemon and all managed processes. `pm2 ping` checks if the daemon is running.
|
|
186
|
+
|
|
187
|
+
## Agent Patterns
|
|
188
|
+
|
|
189
|
+
### Launch a pi agent as a persistent service
|
|
190
|
+
|
|
191
|
+
First, find the actual `cli.js` path (see Windows Gotchas above):
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
# Find pi's real entry point
|
|
195
|
+
cat "$(which pi)" | head -5
|
|
196
|
+
# e.g. → /path/to/node_modules/@mariozechner/pi-coding-agent/dist/cli.js
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
```javascript
|
|
200
|
+
// ecosystem.config.cjs
|
|
201
|
+
module.exports = {
|
|
202
|
+
apps: [{
|
|
203
|
+
name: "my-agent",
|
|
204
|
+
// Use the resolved cli.js path — NOT the .cmd wrapper
|
|
205
|
+
script: "/path/to/node_modules/@mariozechner/pi-coding-agent/dist/cli.js",
|
|
206
|
+
interpreter: "node",
|
|
207
|
+
args: ["--mode", "json", "--cwd", "/path/to/project"],
|
|
208
|
+
autorestart: true,
|
|
209
|
+
max_restarts: 10,
|
|
210
|
+
restart_delay: 5000,
|
|
211
|
+
}],
|
|
212
|
+
};
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
> **Note**: `pi -p` to non-TTY only outputs final text. Use `--mode json` for full event streaming to PM2 logs.
|
|
216
|
+
|
|
217
|
+
### Check process health from an agent
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Structured output for parsing
|
|
221
|
+
pm2 jlist | node -e "
|
|
222
|
+
const d = JSON.parse(require('fs').readFileSync('/dev/stdin','utf8'));
|
|
223
|
+
d.forEach(p => console.log(p.name, p.pm2_env.status, 'restarts:', p.pm2_env.restart_time));
|
|
224
|
+
"
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
### Rotate logs
|
|
228
|
+
|
|
229
|
+
```bash
|
|
230
|
+
pm2 install pm2-logrotate # Install log rotation module
|
|
231
|
+
pm2 set pm2-logrotate:max_size 10M
|
|
232
|
+
pm2 set pm2-logrotate:retain 5
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
## When NOT to Use PM2
|
|
236
|
+
|
|
237
|
+
- **Detached terminal sessions** → use [holdpty](https://github.com/marcfargas/holdpty) (PTY output, attach/view)
|
|
238
|
+
- **Ephemeral agent runs** → use `pi -p > file &` (fire-and-forget with output capture)
|
|
239
|
+
- **Containers** → the container runtime manages lifecycle; PM2 inside Docker is usually redundant
|
|
240
|
+
- **Systemd environments** → use systemd service units natively on Linux
|
package/terminal/vhs/SKILL.md
CHANGED
|
@@ -106,13 +106,23 @@ Require git # Fail if git not in PATH
|
|
|
106
106
|
Require node
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
+
## Windows: Use `Set Shell "cmd"`
|
|
110
|
+
|
|
111
|
+
VHS's default `bash` resolves to WSL bash on Windows — a separate environment with no access to Windows-installed tools (node, scoop packages, etc.). **Always use `cmd`** on Windows:
|
|
112
|
+
|
|
113
|
+
```tape
|
|
114
|
+
Set Shell "cmd"
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
This gives VHS the full Windows PATH so all installed CLIs work.
|
|
118
|
+
|
|
109
119
|
## Recommended Defaults
|
|
110
120
|
|
|
111
121
|
For README demos and documentation:
|
|
112
122
|
|
|
113
123
|
```tape
|
|
114
124
|
Output demo.gif
|
|
115
|
-
Set Shell "bash"
|
|
125
|
+
Set Shell "cmd" # Windows — use "bash" on Linux/macOS
|
|
116
126
|
Set FontSize 14
|
|
117
127
|
Set Width 1100
|
|
118
128
|
Set Height 600
|
|
@@ -211,6 +221,82 @@ vhs record > my-session.tape
|
|
|
211
221
|
vhs my-session.tape
|
|
212
222
|
```
|
|
213
223
|
|
|
224
|
+
### Recording TUI apps with holdpty
|
|
225
|
+
|
|
226
|
+
Use [holdpty](https://github.com/marcfargas/holdpty) to record full-color TUI applications — apps that need a real PTY for colors, take time to start, or are already running. holdpty provides the PTY, VHS captures the output.
|
|
227
|
+
|
|
228
|
+
**Why this matters:**
|
|
229
|
+
- TUI apps (pi, htop, k9s, lazygit) need a real PTY for colors and layout
|
|
230
|
+
- Slow-starting apps (AI agents, servers) can be ready before recording begins
|
|
231
|
+
- Already-running processes can be recorded on demand for monitoring/sharing
|
|
232
|
+
|
|
233
|
+
**The pattern:**
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Step 1: Launch the app in holdpty (or it's already running)
|
|
237
|
+
holdpty launch --bg --name demo -- my-tui-app
|
|
238
|
+
|
|
239
|
+
# Step 2: Wait for it to be ready (or it already is)
|
|
240
|
+
sleep 5
|
|
241
|
+
|
|
242
|
+
# Step 3: Record with VHS
|
|
243
|
+
vhs record-demo.tape
|
|
244
|
+
|
|
245
|
+
# Step 4: Clean up (or leave it running)
|
|
246
|
+
holdpty stop demo
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
**Tape file — attach to a running session:**
|
|
250
|
+
|
|
251
|
+
```tape
|
|
252
|
+
Output demo.gif
|
|
253
|
+
Output demo.mp4
|
|
254
|
+
Set Shell "cmd"
|
|
255
|
+
Set FontSize 14
|
|
256
|
+
Set Width 1200
|
|
257
|
+
Set Height 700
|
|
258
|
+
Set Theme "Dracula"
|
|
259
|
+
Set Padding 15
|
|
260
|
+
Set WindowBar "Colorful"
|
|
261
|
+
Set BorderRadius 8
|
|
262
|
+
|
|
263
|
+
# Attach to the running holdpty session
|
|
264
|
+
Type "holdpty attach demo"
|
|
265
|
+
Enter
|
|
266
|
+
Sleep 2s
|
|
267
|
+
|
|
268
|
+
# Interact with the app (VHS types, app responds with full TUI)
|
|
269
|
+
Type "your input here"
|
|
270
|
+
Enter
|
|
271
|
+
Sleep 15s
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
**Tape file — view-only snapshot of a running process:**
|
|
275
|
+
|
|
276
|
+
```tape
|
|
277
|
+
Output snapshot.gif
|
|
278
|
+
Set Shell "cmd"
|
|
279
|
+
Set FontSize 14
|
|
280
|
+
Set Width 1200
|
|
281
|
+
Set Height 700
|
|
282
|
+
Set Theme "Dracula"
|
|
283
|
+
Set Padding 15
|
|
284
|
+
|
|
285
|
+
# View is read-only — just captures current output
|
|
286
|
+
Type "holdpty view demo"
|
|
287
|
+
Enter
|
|
288
|
+
Sleep 10s
|
|
289
|
+
Ctrl+C
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
**Use cases:**
|
|
293
|
+
- **README demos** — launch app, let it start, record the interesting part
|
|
294
|
+
- **Monitoring snapshots** — capture what a running service looks like right now
|
|
295
|
+
- **Bug reports** — record a live reproduction with full colors
|
|
296
|
+
- **Agent recordings** — capture an AI agent working with its full TUI (thinking indicators, tool calls, colored output)
|
|
297
|
+
|
|
298
|
+
> On Windows, use `node.exe <path/to/cli.js>` instead of CLI names when launching via holdpty — see the [holdpty skill](https://github.com/marcfargas/holdpty) for the `.cmd` wrapper gotcha.
|
|
299
|
+
|
|
214
300
|
## Themes
|
|
215
301
|
|
|
216
302
|
Popular themes for demos:
|
|
@@ -241,8 +327,10 @@ List all: `vhs themes`
|
|
|
241
327
|
|
|
242
328
|
## Gotchas
|
|
243
329
|
|
|
330
|
+
- **Windows: `Set Shell "bash"` uses WSL** — VHS resolves `bash` to WSL bash, not Git Bash. Use `Set Shell "cmd"` to get the full Windows PATH. Custom shell paths (`Set Shell "C:/path/to/bash.exe"`) are rejected.
|
|
244
331
|
- **No shell expansion in Type** — `Type "echo $HOME"` types the literal string; variable expansion happens when bash executes it, not in the tape
|
|
245
332
|
- **Quoting** — avoid nested quotes in Type. Use wrapper scripts for complex commands
|
|
246
333
|
- **Windows paths** — use forward slashes in Type strings (`C:/dev/...` not `C:\dev\...`)
|
|
247
334
|
- **Long recordings** — GIFs get huge fast. Keep demos under 30 seconds. Use `Set PlaybackSpeed 2.0` to compress
|
|
248
335
|
- **Terminal size** — if output wraps weird, increase Width or reduce FontSize
|
|
336
|
+
- **TUI apps without holdpty** — apps that need a real PTY for colors (pi, htop, lazygit) will render without colors if launched directly from VHS. Use the holdpty pattern above.
|