@marcfargas/skills 0.2.0 → 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 +1 -1
- package/LICENSE-CC0 +118 -0
- package/README.md +43 -13
- package/package.json +11 -3
- package/process/pm2/SKILL.md +240 -0
- package/search/web-search/SKILL.md +107 -0
- package/search/web-search/content.js +86 -0
- package/search/web-search/package-lock.json +617 -0
- package/search/web-search/package.json +13 -0
- package/search/web-search/search.js +215 -0
- package/terminal/vhs/SKILL.md +89 -1
package/LICENSE
CHANGED
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,7 +7,9 @@ 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 |
|
|
12
|
+
| 🔍 Search | [web-search](search/web-search/) | Web search + content extraction via [ddgs](https://github.com/deedy5/ddgs) — no API keys |
|
|
11
13
|
| 🎬 Terminal | [vhs](terminal/vhs/) | Record terminal sessions as GIF/MP4 with [VHS](https://github.com/charmbracelet/vhs) |
|
|
12
14
|
|
|
13
15
|
## Install
|
|
@@ -42,13 +44,26 @@ Copy the skill directory into your agent's skill folder:
|
|
|
42
44
|
cp -r google-cloud/gcloud ~/.claude/skills/gcloud
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
##
|
|
47
|
+
## How We Build Skills
|
|
46
48
|
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
3
|
|
50
|
-
|
|
51
|
-
|
|
49
|
+
### Multi-Model Review
|
|
50
|
+
|
|
51
|
+
Every skill is reviewed by **3+ models** (Claude, Gemini, GPT) before publishing — structure, agent usability, safety, and real-world scenario testing. If an agent can misinterpret an instruction, we find out before you do.
|
|
52
|
+
|
|
53
|
+
### Safety Classification
|
|
54
|
+
|
|
55
|
+
Every operation is classified: **READ** / **WRITE** / **DESTRUCTIVE** / **EXPENSIVE** / **FORBIDDEN**. Destructive and expensive operations are gated — the agent must confirm before executing, and costs are flagged upfront.
|
|
56
|
+
|
|
57
|
+
### Progressive Discovery
|
|
58
|
+
|
|
59
|
+
Skills use a **hub + spoke** architecture. The SKILL.md hub is ~140 lines — just enough to match the right skill and know what's available. Detailed per-topic reference files are loaded on demand, keeping your context window lean.
|
|
60
|
+
|
|
61
|
+
### Also
|
|
62
|
+
|
|
63
|
+
- **Agent-native** — `--format=json` everywhere, idempotent patterns, structured error handling
|
|
64
|
+
- **Portable** — no hardcoded paths, no personal config, works on any machine
|
|
65
|
+
- **Spec-compliant** — validated against the [Agent Skills specification](https://agentskills.io/specification) using [skills-ref](https://github.com/agentskills/agentskills) in CI
|
|
66
|
+
- **Continuous validation** — `agentskills validate` on every push ([validate.yml](.github/workflows/validate.yml)), [pre-release checklist](release/pre-release/) with AI-written changesets, [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers) with provenance
|
|
52
67
|
|
|
53
68
|
## Structure
|
|
54
69
|
|
|
@@ -56,21 +71,26 @@ cp -r google-cloud/gcloud ~/.claude/skills/gcloud
|
|
|
56
71
|
skills/
|
|
57
72
|
├── google-cloud/
|
|
58
73
|
│ └── gcloud/ # 8 files, ~1100 lines total
|
|
74
|
+
├── process/
|
|
75
|
+
│ └── pm2/ # 1 file
|
|
59
76
|
├── release/
|
|
60
77
|
│ └── pre-release/ # 1 file
|
|
78
|
+
├── search/
|
|
79
|
+
│ └── web-search/ # SKILL.md + search.js + content.js
|
|
61
80
|
├── terminal/
|
|
62
81
|
│ └── vhs/ # 1 file
|
|
63
82
|
└── README.md
|
|
64
83
|
```
|
|
65
84
|
|
|
66
|
-
## External Skills
|
|
85
|
+
## External Skills
|
|
67
86
|
|
|
68
|
-
Some skills
|
|
87
|
+
Some skills live in their own repositories — install them directly or via their npm packages:
|
|
69
88
|
|
|
70
|
-
| Skill |
|
|
71
|
-
|
|
72
|
-
|
|
|
73
|
-
|
|
|
89
|
+
| Skill | Description | Install |
|
|
90
|
+
|-------|-------------|---------|
|
|
91
|
+
| [go-easy](https://github.com/marcfargas/go-easy) | Gmail, Drive, Calendar for AI agents — `npx go-gmail`, `npx go-drive`, `npx go-calendar` | `npx skills add marcfargas/go-easy` |
|
|
92
|
+
| [holdpty](https://github.com/marcfargas/holdpty) | Detached PTY sessions — launch, attach, view, record terminal processes | `npx skills add marcfargas/holdpty` |
|
|
93
|
+
| [odoo](https://github.com/marcfargas/odoo-toolbox) | Odoo ERP integration — connect, introspect, automate | `npx skills add marcfargas/odoo-toolbox` |
|
|
74
94
|
|
|
75
95
|
## Contributing
|
|
76
96
|
|
|
@@ -101,6 +121,16 @@ agentskills to-prompt path/to/skill-a path/to/skill-b
|
|
|
101
121
|
|
|
102
122
|
CI runs `agentskills validate` on every push — see [`.github/workflows/validate.yml`](.github/workflows/validate.yml).
|
|
103
123
|
|
|
124
|
+
## Sponsor
|
|
125
|
+
|
|
126
|
+
Building high-quality, multi-model-reviewed agent skills takes serious token budget. If these skills save you time, consider sponsoring:
|
|
127
|
+
|
|
128
|
+
[](https://github.com/sponsors/marcfargas)
|
|
129
|
+
|
|
104
130
|
## License
|
|
105
131
|
|
|
106
|
-
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,12 +14,17 @@
|
|
|
14
14
|
"ai-agent",
|
|
15
15
|
"skills",
|
|
16
16
|
"gcloud",
|
|
17
|
-
"
|
|
17
|
+
"pm2",
|
|
18
|
+
"pre-release",
|
|
19
|
+
"vhs",
|
|
20
|
+
"web-search"
|
|
18
21
|
],
|
|
19
22
|
"pi": {
|
|
20
23
|
"skills": [
|
|
21
24
|
"google-cloud",
|
|
25
|
+
"process",
|
|
22
26
|
"release",
|
|
27
|
+
"search",
|
|
23
28
|
"terminal"
|
|
24
29
|
]
|
|
25
30
|
},
|
|
@@ -34,9 +39,12 @@
|
|
|
34
39
|
},
|
|
35
40
|
"files": [
|
|
36
41
|
"google-cloud/",
|
|
42
|
+
"process/",
|
|
37
43
|
"release/",
|
|
44
|
+
"search/",
|
|
38
45
|
"terminal/",
|
|
39
46
|
"README.md",
|
|
40
|
-
"LICENSE"
|
|
47
|
+
"LICENSE",
|
|
48
|
+
"LICENSE-CC0"
|
|
41
49
|
]
|
|
42
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
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: web-search
|
|
3
|
+
description: >-
|
|
4
|
+
Web search and content extraction using ddgs (multi-engine metasearch). No API keys required.
|
|
5
|
+
Use when: searching documentation, facts, current information, news, fetching web content.
|
|
6
|
+
Triggers: search the web, look up, find information, web search, news search, fetch page.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Web Search
|
|
10
|
+
|
|
11
|
+
Web search and content extraction using [ddgs](https://github.com/deedy5/ddgs) — a multi-engine metasearch CLI.
|
|
12
|
+
No API keys, no signup, no browser required.
|
|
13
|
+
|
|
14
|
+
## Setup
|
|
15
|
+
|
|
16
|
+
Install ddgs (run once):
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
uv tool install ddgs
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Install Node.js dependencies for content extraction (run once):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
cd {baseDir}
|
|
26
|
+
npm install
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Search
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
{baseDir}/search.js "query" # Basic search (5 results)
|
|
33
|
+
{baseDir}/search.js "query" -n 10 # More results
|
|
34
|
+
{baseDir}/search.js "query" --content # Include page content as markdown
|
|
35
|
+
{baseDir}/search.js "query" -t w # Results from last week
|
|
36
|
+
{baseDir}/search.js "query" -t m # Results from last month
|
|
37
|
+
{baseDir}/search.js "query" -r es-es # Results in Spanish
|
|
38
|
+
{baseDir}/search.js "query" -b google # Use Google backend
|
|
39
|
+
{baseDir}/search.js "query" -n 3 --content # Combined options
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Options
|
|
43
|
+
|
|
44
|
+
- `-n <num>` — Number of results (default: 5)
|
|
45
|
+
- `--content` — Fetch and include page content as markdown
|
|
46
|
+
- `-r <region>` — Region code: `us-en`, `es-es`, `de-de`, `fr-fr`, etc. (default: none)
|
|
47
|
+
- `-t <timelimit>` — Filter by time: `d` (day), `w` (week), `m` (month), `y` (year)
|
|
48
|
+
- `-b <backend>` — Search backend: `auto`, `all`, `bing`, `brave`, `duckduckgo`, `google`, `mojeek`, `yandex`, `yahoo`, `wikipedia` (default: auto)
|
|
49
|
+
|
|
50
|
+
## News Search
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
{baseDir}/search.js --news "query" # News search
|
|
54
|
+
{baseDir}/search.js --news "query" -n 10 -t w # News from last week
|
|
55
|
+
{baseDir}/search.js --news "query" --content # News with full article content
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
News backends: `auto`, `all`, `bing`, `duckduckgo`, `yahoo`
|
|
59
|
+
|
|
60
|
+
## Extract Page Content
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
{baseDir}/content.js https://example.com/article
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
Fetches a URL and extracts readable content as markdown.
|
|
67
|
+
|
|
68
|
+
## Output Format
|
|
69
|
+
|
|
70
|
+
### Text search
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
--- Result 1 ---
|
|
74
|
+
Title: Page Title
|
|
75
|
+
Link: https://example.com/page
|
|
76
|
+
Snippet: Description from search results
|
|
77
|
+
Content: (if --content flag used)
|
|
78
|
+
Markdown content extracted from the page...
|
|
79
|
+
|
|
80
|
+
--- Result 2 ---
|
|
81
|
+
...
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### News search
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
--- Result 1 ---
|
|
88
|
+
Title: Article Title
|
|
89
|
+
Link: https://news.example.com/article
|
|
90
|
+
Date: 2026-02-08T10:18:00+00:00
|
|
91
|
+
Source: Reuters
|
|
92
|
+
Snippet: Article summary...
|
|
93
|
+
Content: (if --content flag used)
|
|
94
|
+
Full article as markdown...
|
|
95
|
+
|
|
96
|
+
--- Result 2 ---
|
|
97
|
+
...
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
## When to Use
|
|
101
|
+
|
|
102
|
+
- Searching for documentation or API references
|
|
103
|
+
- Looking up facts or current information
|
|
104
|
+
- News search for recent events
|
|
105
|
+
- Fetching content from specific URLs
|
|
106
|
+
- Any task requiring web search without interactive browsing
|
|
107
|
+
- When no API key is available (unlike Brave Search)
|