@devxiyang/agent-skill 0.0.8 → 0.1.1
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/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/node/SKILL.md +173 -0
- package/skills/node/references/install.md +63 -0
- package/skills/python/SKILL.md +14 -0
- package/skills/shell/SKILL.md +93 -2
- package/skills/vcs/SKILL.md +207 -0
- package/dist/copy.test.d.ts +0 -2
- package/dist/copy.test.d.ts.map +0 -1
- package/dist/copy.test.js +0 -66
- package/dist/copy.test.js.map +0 -1
- package/dist/discovery/discovery.test.d.ts +0 -2
- package/dist/discovery/discovery.test.d.ts.map +0 -1
- package/dist/discovery/discovery.test.js +0 -128
- package/dist/discovery/discovery.test.js.map +0 -1
- package/dist/discovery/frontmatter.test.d.ts +0 -2
- package/dist/discovery/frontmatter.test.d.ts.map +0 -1
- package/dist/discovery/frontmatter.test.js +0 -39
- package/dist/discovery/frontmatter.test.js.map +0 -1
- package/skills/git/SKILL.md +0 -166
- package/skills/github/SKILL.md +0 -112
- package/skills/jq/SKILL.md +0 -109
- package/skills/jq/references/install.md +0 -38
- package/skills/weather/SKILL.md +0 -50
- package/skills/web/SKILL.md +0 -139
- package/skills/web/references/install.md +0 -51
- /package/skills/{weather/references/install.md → shell/references/install-curl.md} +0 -0
- /package/skills/{github/references/install.md → vcs/references/install-gh.md} +0 -0
- /package/skills/{git/references/install.md → vcs/references/install-git.md} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ export type { SkillEntry, SkillRoot, SkillScope, SkillMissingReason, SkillMissin
|
|
|
2
2
|
export type { SkillValidator } from './validator.js';
|
|
3
3
|
export { SkillDiscovery, parseFrontmatter } from './discovery/index.js';
|
|
4
4
|
export type { SkillFrontmatter } from './discovery/index.js';
|
|
5
|
-
export { builtinSkillsRoot } from './builtin.js';
|
|
6
5
|
export { defaultValidator } from './validators/index.js';
|
|
7
6
|
export { copySkills } from './copy.js';
|
|
8
7
|
export type { CopySkillsOptions, CopySkillsResult } from './copy.js';
|
|
8
|
+
export { builtinSkillsRoot } from './builtin.js';
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAChH,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAChH,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxE,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AACvC,YAAY,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { SkillDiscovery, parseFrontmatter } from './discovery/index.js';
|
|
2
|
-
export { builtinSkillsRoot } from './builtin.js';
|
|
3
2
|
export { defaultValidator } from './validators/index.js';
|
|
4
3
|
export { copySkills } from './copy.js';
|
|
4
|
+
export { builtinSkillsRoot } from './builtin.js';
|
|
5
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExE,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: node
|
|
3
|
+
description: Run Node.js scripts, manage packages with npm/npx, and use common built-in module patterns. Use for scripting, web tooling, automation, and general JavaScript/TypeScript development.
|
|
4
|
+
requires: bin:node
|
|
5
|
+
tags: node,javascript,typescript,scripting
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Node Skill
|
|
9
|
+
|
|
10
|
+
## Preflight
|
|
11
|
+
|
|
12
|
+
Verify Node.js is available before proceeding:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
node --version
|
|
16
|
+
npm --version
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
If missing, load `references/install.md` for installation instructions.
|
|
20
|
+
|
|
21
|
+
## Running scripts
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
node script.js
|
|
25
|
+
node script.js arg1 arg2
|
|
26
|
+
node -e "console.log('hello')"
|
|
27
|
+
|
|
28
|
+
# TypeScript (via tsx, no compile step)
|
|
29
|
+
npx tsx script.ts
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Package management
|
|
33
|
+
|
|
34
|
+
### npm
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install
|
|
38
|
+
npm install express
|
|
39
|
+
npm install -D typescript
|
|
40
|
+
npm uninstall lodash
|
|
41
|
+
npm list --depth=0
|
|
42
|
+
npm outdated
|
|
43
|
+
npm update
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### npx (run without installing)
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
npx tsx script.ts
|
|
50
|
+
npx prettier --write .
|
|
51
|
+
npx eslint src/
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Common built-in patterns
|
|
55
|
+
|
|
56
|
+
### File I/O (fs/promises)
|
|
57
|
+
|
|
58
|
+
```js
|
|
59
|
+
import { readFile, writeFile, readdir } from 'node:fs/promises';
|
|
60
|
+
import { join } from 'node:path';
|
|
61
|
+
|
|
62
|
+
const text = await readFile('data.txt', 'utf8');
|
|
63
|
+
await writeFile('out.txt', 'content');
|
|
64
|
+
|
|
65
|
+
// Iterate files
|
|
66
|
+
const files = await readdir('src');
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### JSON
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
// Parse
|
|
73
|
+
const data = JSON.parse(text);
|
|
74
|
+
|
|
75
|
+
// Serialize
|
|
76
|
+
const json = JSON.stringify(data, null, 2);
|
|
77
|
+
await writeFile('out.json', json);
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### HTTP requests (built-in fetch)
|
|
81
|
+
|
|
82
|
+
```js
|
|
83
|
+
// Node 18+ has fetch built-in
|
|
84
|
+
const res = await fetch('https://api.example.com/data');
|
|
85
|
+
const data = await res.json();
|
|
86
|
+
|
|
87
|
+
// POST JSON
|
|
88
|
+
const res = await fetch('https://api.example.com/items', {
|
|
89
|
+
method: 'POST',
|
|
90
|
+
headers: { 'Content-Type': 'application/json' },
|
|
91
|
+
body: JSON.stringify({ name: 'foo' }),
|
|
92
|
+
});
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Child process
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
import { execSync, exec } from 'node:child_process';
|
|
99
|
+
import { promisify } from 'node:util';
|
|
100
|
+
|
|
101
|
+
// Sync
|
|
102
|
+
const output = execSync('git status', { encoding: 'utf8' });
|
|
103
|
+
|
|
104
|
+
// Async
|
|
105
|
+
const execAsync = promisify(exec);
|
|
106
|
+
const { stdout, stderr } = await execAsync('npm test');
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### Argument parsing
|
|
110
|
+
|
|
111
|
+
```js
|
|
112
|
+
// Built-in (Node 18.3+)
|
|
113
|
+
import { parseArgs } from 'node:util';
|
|
114
|
+
|
|
115
|
+
const { values, positionals } = parseArgs({
|
|
116
|
+
args: process.argv.slice(2),
|
|
117
|
+
options: {
|
|
118
|
+
output: { type: 'string', short: 'o', default: 'out.txt' },
|
|
119
|
+
verbose: { type: 'boolean', short: 'v' },
|
|
120
|
+
},
|
|
121
|
+
allowPositionals: true,
|
|
122
|
+
});
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Environment variables
|
|
126
|
+
|
|
127
|
+
```js
|
|
128
|
+
const token = process.env.API_TOKEN;
|
|
129
|
+
if (!token) throw new Error('API_TOKEN is required');
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## TypeScript
|
|
133
|
+
|
|
134
|
+
Prefer `tsx` for running `.ts` files directly without a build step:
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
npx tsx script.ts
|
|
138
|
+
|
|
139
|
+
# Or install globally
|
|
140
|
+
npm install -g tsx
|
|
141
|
+
tsx script.ts
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
For projects with `tsconfig.json`, check `compilerOptions.target` and `module` before running.
|
|
145
|
+
|
|
146
|
+
## ESM vs CJS
|
|
147
|
+
|
|
148
|
+
```js
|
|
149
|
+
// ESM (package.json has "type": "module", or file is .mjs)
|
|
150
|
+
import { readFile } from 'node:fs/promises';
|
|
151
|
+
export function helper() {}
|
|
152
|
+
|
|
153
|
+
// CJS (default, or file is .cjs)
|
|
154
|
+
const { readFile } = require('fs').promises;
|
|
155
|
+
module.exports = { helper };
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Check `"type"` in `package.json` to know which mode applies.
|
|
159
|
+
|
|
160
|
+
## Destructive Operations
|
|
161
|
+
|
|
162
|
+
Always confirm with the user before running any of the following:
|
|
163
|
+
|
|
164
|
+
| Command / Pattern | Risk |
|
|
165
|
+
|-------------------|------|
|
|
166
|
+
| `npm publish` | Publishes package to the public registry; cannot be fully unpublished |
|
|
167
|
+
| `npm unpublish` | Removes a published package version (restricted after 72h) |
|
|
168
|
+
| `fs.rm(path, { recursive: true })` / `fs.rmdir` recursive | Deletes directory tree permanently |
|
|
169
|
+
| `fs.writeFile` / `fs.truncate` on existing files | Silently overwrites file content |
|
|
170
|
+
| `execSync('rm -rf ...')` inside scripts | Shell deletion triggered from Node code |
|
|
171
|
+
| `npx <unknown-package>` | Executes remote code; verify package name and source first |
|
|
172
|
+
|
|
173
|
+
Before executing, state what files or registry resources will be affected, and ask for explicit confirmation.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Installing Node.js
|
|
2
|
+
|
|
3
|
+
## macOS
|
|
4
|
+
|
|
5
|
+
Using nvm (recommended — manages multiple versions):
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
|
9
|
+
nvm install --lts
|
|
10
|
+
nvm use --lts
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
If you have Homebrew:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
brew install node
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Windows
|
|
20
|
+
|
|
21
|
+
Download the installer from https://nodejs.org/en/download — pick the LTS release and run the `.msi` installer. Check "Add to PATH" during installation.
|
|
22
|
+
|
|
23
|
+
If winget is available:
|
|
24
|
+
|
|
25
|
+
```powershell
|
|
26
|
+
winget install OpenJS.NodeJS.LTS
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or use nvm-windows:
|
|
30
|
+
|
|
31
|
+
```powershell
|
|
32
|
+
winget install CoreyButler.NVMforWindows
|
|
33
|
+
nvm install lts
|
|
34
|
+
nvm use lts
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Linux
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
# Debian/Ubuntu — via NodeSource
|
|
41
|
+
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
|
|
42
|
+
sudo apt install nodejs
|
|
43
|
+
|
|
44
|
+
# Fedora
|
|
45
|
+
sudo dnf install nodejs
|
|
46
|
+
|
|
47
|
+
# Arch
|
|
48
|
+
sudo pacman -S nodejs npm
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Using nvm (all platforms):
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
|
|
55
|
+
nvm install --lts
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Verify
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
node --version
|
|
62
|
+
npm --version
|
|
63
|
+
```
|
package/skills/python/SKILL.md
CHANGED
|
@@ -149,3 +149,17 @@ parser.add_argument("--output", "-o", default="out.txt")
|
|
|
149
149
|
parser.add_argument("--verbose", "-v", action="store_true")
|
|
150
150
|
args = parser.parse_args()
|
|
151
151
|
```
|
|
152
|
+
|
|
153
|
+
## Destructive Operations
|
|
154
|
+
|
|
155
|
+
Always confirm with the user before running any of the following:
|
|
156
|
+
|
|
157
|
+
| Pattern | Risk |
|
|
158
|
+
|---------|------|
|
|
159
|
+
| `shutil.rmtree(path)` | Recursively deletes entire directory tree permanently |
|
|
160
|
+
| `os.remove(path)` in a loop or with glob | Bulk file deletion, easy to match unintended files |
|
|
161
|
+
| `open(path, 'w')` on an existing file | Silently overwrites and truncates file content |
|
|
162
|
+
| `Path.write_text` / `Path.write_bytes` on existing file | Same as above |
|
|
163
|
+
| `subprocess.run(['rm', '-rf', ...])` | Shell deletion triggered from Python code |
|
|
164
|
+
|
|
165
|
+
Before executing, show the user the exact path or pattern that will be affected, and ask for explicit confirmation.
|
package/skills/shell/SKILL.md
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: shell
|
|
3
|
-
description: Write and run shell scripts. Use for automation, file operations, pipelines, and
|
|
4
|
-
|
|
3
|
+
description: Write and run shell scripts, and make HTTP requests with curl. Use for automation, file operations, pipelines, system tasks, fetching web pages, and calling REST APIs. Covers bash/zsh (macOS/Linux) and PowerShell (Windows).
|
|
4
|
+
requires: bin:curl
|
|
5
|
+
tags: shell,cli,web,http
|
|
5
6
|
---
|
|
6
7
|
|
|
7
8
|
# Shell Skill
|
|
@@ -216,3 +217,93 @@ Get-ChildItem -Recurse -Filter "*.tmp" | Remove-Item
|
|
|
216
217
|
# Search in files
|
|
217
218
|
Select-String -Path "src\*.ts" -Pattern "TODO"
|
|
218
219
|
```
|
|
220
|
+
|
|
221
|
+
---
|
|
222
|
+
|
|
223
|
+
## HTTP / curl
|
|
224
|
+
|
|
225
|
+
Verify curl is available:
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
curl --version
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
If missing, load `references/install-curl.md`.
|
|
232
|
+
|
|
233
|
+
### Fetch a web page
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
curl -sL "https://example.com"
|
|
237
|
+
```
|
|
238
|
+
|
|
239
|
+
### REST API calls
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
# GET
|
|
243
|
+
curl -s "https://api.example.com/users" | jq .
|
|
244
|
+
|
|
245
|
+
# POST JSON
|
|
246
|
+
curl -s -X POST "https://api.example.com/items" \
|
|
247
|
+
-H "Content-Type: application/json" \
|
|
248
|
+
-d '{"name": "foo"}'
|
|
249
|
+
|
|
250
|
+
# PUT / DELETE
|
|
251
|
+
curl -s -X PUT "https://api.example.com/items/1" \
|
|
252
|
+
-H "Content-Type: application/json" \
|
|
253
|
+
-d '{"name": "bar"}'
|
|
254
|
+
curl -s -X DELETE "https://api.example.com/items/1"
|
|
255
|
+
|
|
256
|
+
# Auth header
|
|
257
|
+
curl -s "https://api.example.com/data" \
|
|
258
|
+
-H "Authorization: Bearer $TOKEN"
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Form data & file upload
|
|
262
|
+
|
|
263
|
+
```bash
|
|
264
|
+
curl -s -X POST "https://example.com/login" \
|
|
265
|
+
-d "username=alice&password=secret"
|
|
266
|
+
|
|
267
|
+
curl -s -X POST "https://example.com/upload" \
|
|
268
|
+
-F "file=@/path/to/file.pdf" \
|
|
269
|
+
-F "description=My file"
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
### Download a file
|
|
273
|
+
|
|
274
|
+
```bash
|
|
275
|
+
curl -sL "https://example.com/file.zip" -o /tmp/file.zip
|
|
276
|
+
curl -C - -L "https://example.com/large.zip" -o /tmp/large.zip # resume
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
### Inspect response
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
curl -sI "https://example.com" # headers only
|
|
283
|
+
curl -sD - "https://example.com" # headers + body
|
|
284
|
+
curl -s -o /dev/null -w "%{http_code}" "https://example.com" # status code
|
|
285
|
+
```
|
|
286
|
+
|
|
287
|
+
### Tips
|
|
288
|
+
|
|
289
|
+
- `-s` silences progress, `-L` follows redirects, `-v` debugs
|
|
290
|
+
- `--max-time 10` sets timeout, `--compressed` enables gzip
|
|
291
|
+
- `-sk` skips certificate check (testing only)
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## Destructive Operations
|
|
296
|
+
|
|
297
|
+
Always confirm with the user before running any of the following:
|
|
298
|
+
|
|
299
|
+
| Command | Risk |
|
|
300
|
+
|---------|------|
|
|
301
|
+
| `rm -rf <path>` | Recursively deletes files/directories with no recovery |
|
|
302
|
+
| `find ... -delete` / `find ... -exec rm` | Bulk file deletion, easy to match unintended paths |
|
|
303
|
+
| `> file` (output redirect, not `>>`) | Silently overwrites and truncates existing file |
|
|
304
|
+
| `truncate -s 0 file` | Empties file contents permanently |
|
|
305
|
+
| `dd if=... of=...` | Overwrites device or file at block level |
|
|
306
|
+
| `mkfs` / `fdisk` / `diskutil eraseDisk` | Formats and wipes entire disk partition |
|
|
307
|
+
| `Get-ChildItem ... \| Remove-Item -Recurse` (PowerShell) | Recursive deletion |
|
|
308
|
+
|
|
309
|
+
Before executing, show the user the exact path or glob that will be affected, and ask for explicit confirmation.
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vcs
|
|
3
|
+
description: Version control and GitHub collaboration — local git operations (branching, committing, merging, rebasing, history) and GitHub interactions via gh CLI (PRs, issues, releases, CI, code review).
|
|
4
|
+
requires: bin:git
|
|
5
|
+
tags: vcs,git,github
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# VCS Skill
|
|
9
|
+
|
|
10
|
+
## Preflight
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
git --version
|
|
14
|
+
gh --version # optional, needed for GitHub operations
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
If git is missing, load `references/install-git.md`.
|
|
18
|
+
If gh is missing, load `references/install-gh.md`.
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Git — Common workflow
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
git status
|
|
26
|
+
git diff
|
|
27
|
+
git add <files>
|
|
28
|
+
git commit -m "message"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Branching
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
git checkout -b feature/name
|
|
35
|
+
git switch main
|
|
36
|
+
git branch -d feature/name
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Inspecting history
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
git log --oneline -20
|
|
43
|
+
git log --oneline --graph --all
|
|
44
|
+
git show <commit>
|
|
45
|
+
git diff main...HEAD
|
|
46
|
+
git blame <file>
|
|
47
|
+
git blame -L 10,20 <file>
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Cherry-pick
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git cherry-pick <commit>
|
|
54
|
+
git cherry-pick <from>..<to>
|
|
55
|
+
git cherry-pick -n <commit> # stage only, no commit
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Tags
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
git tag -a v1.0.0 -m "Release 1.0.0"
|
|
62
|
+
git tag
|
|
63
|
+
git push origin --tags
|
|
64
|
+
git tag -d v1.0.0
|
|
65
|
+
git push origin :refs/tags/v1.0.0
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Undoing changes
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git restore --staged <file> # unstage
|
|
72
|
+
git reset --soft HEAD~1 # undo last commit, keep changes staged
|
|
73
|
+
git rebase -i HEAD~3 # edit recent commits interactively
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Stashing
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
git stash push -m "description"
|
|
80
|
+
git stash list
|
|
81
|
+
git stash pop
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Merging & rebasing
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
git merge feature/name
|
|
88
|
+
git rebase main
|
|
89
|
+
git rebase --abort
|
|
90
|
+
git merge --abort
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Conflict resolution
|
|
94
|
+
|
|
95
|
+
1. Open conflicting files, look for `<<<<<<<` markers
|
|
96
|
+
2. Edit to desired state
|
|
97
|
+
3. `git add <resolved-file>`
|
|
98
|
+
4. `git rebase --continue` or `git merge --continue`
|
|
99
|
+
|
|
100
|
+
## Worktrees
|
|
101
|
+
|
|
102
|
+
```bash
|
|
103
|
+
git worktree add ../project-fix fix/some-bug
|
|
104
|
+
git worktree add -b feature/new ../project-feature main
|
|
105
|
+
git worktree list
|
|
106
|
+
git worktree remove ../project-fix
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Bisect
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
git bisect start
|
|
113
|
+
git bisect bad
|
|
114
|
+
git bisect good <commit>
|
|
115
|
+
# mark each checkout as good/bad until found
|
|
116
|
+
git bisect reset
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Remotes
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
git remote -v
|
|
123
|
+
git fetch origin
|
|
124
|
+
git pull --rebase
|
|
125
|
+
git push -u origin HEAD
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## GitHub (gh CLI)
|
|
131
|
+
|
|
132
|
+
Always specify `--repo owner/repo` when not inside a git directory.
|
|
133
|
+
|
|
134
|
+
## Pull Requests
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
gh pr list --repo owner/repo
|
|
138
|
+
gh pr view <number> --repo owner/repo
|
|
139
|
+
gh pr checks <number> --repo owner/repo
|
|
140
|
+
gh run view <run-id> --repo owner/repo --log-failed
|
|
141
|
+
gh pr merge <number> --repo owner/repo --squash
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Code review
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
gh pr review <number> --approve --repo owner/repo
|
|
148
|
+
gh pr review <number> --request-changes --body "Please fix X" --repo owner/repo
|
|
149
|
+
gh pr review <number> --comment --body "Looks good overall" --repo owner/repo
|
|
150
|
+
|
|
151
|
+
# Inline comment via API
|
|
152
|
+
gh api repos/owner/repo/pulls/<number>/comments \
|
|
153
|
+
--method POST \
|
|
154
|
+
--field body="Comment text" \
|
|
155
|
+
--field commit_id="<sha>" \
|
|
156
|
+
--field path="src/file.ts" \
|
|
157
|
+
--field line=42
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Issues
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
gh issue list --repo owner/repo --state open
|
|
164
|
+
gh issue view <number> --repo owner/repo
|
|
165
|
+
gh issue create --title "Title" --body "Body" --repo owner/repo
|
|
166
|
+
gh issue comment <number> --body "Comment" --repo owner/repo
|
|
167
|
+
gh issue close <number> --repo owner/repo
|
|
168
|
+
gh issue reopen <number> --repo owner/repo
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
## Releases
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
gh release list --repo owner/repo
|
|
175
|
+
gh release create v1.0.0 --repo owner/repo --title "v1.0.0" --notes "Release notes"
|
|
176
|
+
gh release upload v1.0.0 dist/app.zip --repo owner/repo
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
## API & JSON output
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
gh api repos/owner/repo/pulls/55 --jq '.title, .state, .user.login'
|
|
183
|
+
gh issue list --repo owner/repo --json number,title --jq '.[] | "\(.number): \(.title)"'
|
|
184
|
+
gh pr list --repo owner/repo --json number,title,author --jq '.[] | "\(.number): \(.title) by \(.author.login)"'
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Destructive Operations
|
|
190
|
+
|
|
191
|
+
Always confirm with the user before running any of the following:
|
|
192
|
+
|
|
193
|
+
| Command | Risk |
|
|
194
|
+
|---------|------|
|
|
195
|
+
| `git reset --hard` | Discards all uncommitted changes permanently |
|
|
196
|
+
| `git push --force` / `git push -f` | Overwrites remote history, affects all collaborators |
|
|
197
|
+
| `git branch -D <branch>` | Force-deletes branch regardless of merge status |
|
|
198
|
+
| `git clean -f` / `git clean -fd` | Deletes untracked files/directories permanently |
|
|
199
|
+
| `git rebase -i` on pushed commits | Rewrites shared history |
|
|
200
|
+
| `git restore <file>` | Discards working tree changes for that file |
|
|
201
|
+
| `gh pr merge` | Merges and closes PR; hard to revert cleanly |
|
|
202
|
+
| `gh release delete` | Permanently deletes a release and its assets |
|
|
203
|
+
| `gh issue delete` | Permanently deletes an issue |
|
|
204
|
+
| `gh repo delete` | Permanently deletes the entire repository |
|
|
205
|
+
| `gh api --method DELETE ...` | Any DELETE API call is irreversible |
|
|
206
|
+
|
|
207
|
+
Before executing, tell the user exactly what will be lost and ask for explicit confirmation.
|
package/dist/copy.test.d.ts
DELETED
package/dist/copy.test.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy.test.d.ts","sourceRoot":"","sources":["../src/copy.test.ts"],"names":[],"mappings":""}
|
package/dist/copy.test.js
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
|
-
import fs from 'node:fs/promises';
|
|
3
|
-
import path from 'node:path';
|
|
4
|
-
import os from 'node:os';
|
|
5
|
-
import { copySkills } from './copy.js';
|
|
6
|
-
let tmpDir;
|
|
7
|
-
let srcRoot;
|
|
8
|
-
beforeAll(async () => {
|
|
9
|
-
tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), 'agent-skill-copy-test-'));
|
|
10
|
-
srcRoot = path.join(tmpDir, 'src');
|
|
11
|
-
// Create fixture skills
|
|
12
|
-
for (const name of ['git', 'github', 'web']) {
|
|
13
|
-
const dir = path.join(srcRoot, name);
|
|
14
|
-
await fs.mkdir(dir, { recursive: true });
|
|
15
|
-
await fs.writeFile(path.join(dir, 'SKILL.md'), `---\nname: ${name}\n---\n`);
|
|
16
|
-
}
|
|
17
|
-
// A dir without SKILL.md (should be ignored)
|
|
18
|
-
await fs.mkdir(path.join(srcRoot, 'not-a-skill'), { recursive: true });
|
|
19
|
-
});
|
|
20
|
-
afterAll(async () => {
|
|
21
|
-
await fs.rm(tmpDir, { recursive: true, force: true });
|
|
22
|
-
});
|
|
23
|
-
describe('copySkills', () => {
|
|
24
|
-
it('copies all skills to target', async () => {
|
|
25
|
-
const to = path.join(tmpDir, 'dest-all');
|
|
26
|
-
const result = await copySkills({ from: srcRoot, to });
|
|
27
|
-
expect(result.copied.sort()).toEqual(['git', 'github', 'web']);
|
|
28
|
-
expect(result.skipped).toEqual([]);
|
|
29
|
-
for (const name of result.copied) {
|
|
30
|
-
const skillMd = path.join(to, name, 'SKILL.md');
|
|
31
|
-
await expect(fs.access(skillMd)).resolves.toBeUndefined();
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
it('filters by skill names', async () => {
|
|
35
|
-
const to = path.join(tmpDir, 'dest-filter');
|
|
36
|
-
const result = await copySkills({ from: srcRoot, to, skills: ['git', 'web'] });
|
|
37
|
-
expect(result.copied.sort()).toEqual(['git', 'web']);
|
|
38
|
-
expect(result.skipped).toEqual([]);
|
|
39
|
-
await expect(fs.access(path.join(to, 'github'))).rejects.toThrow();
|
|
40
|
-
});
|
|
41
|
-
it('skips existing skills by default', async () => {
|
|
42
|
-
const to = path.join(tmpDir, 'dest-skip');
|
|
43
|
-
await copySkills({ from: srcRoot, to });
|
|
44
|
-
const result = await copySkills({ from: srcRoot, to });
|
|
45
|
-
expect(result.copied).toEqual([]);
|
|
46
|
-
expect(result.skipped.sort()).toEqual(['git', 'github', 'web']);
|
|
47
|
-
});
|
|
48
|
-
it('overwrites existing skills when overwrite: true', async () => {
|
|
49
|
-
const to = path.join(tmpDir, 'dest-overwrite');
|
|
50
|
-
await copySkills({ from: srcRoot, to });
|
|
51
|
-
const result = await copySkills({ from: srcRoot, to, overwrite: true });
|
|
52
|
-
expect(result.copied.sort()).toEqual(['git', 'github', 'web']);
|
|
53
|
-
expect(result.skipped).toEqual([]);
|
|
54
|
-
});
|
|
55
|
-
it('ignores directories without SKILL.md', async () => {
|
|
56
|
-
const to = path.join(tmpDir, 'dest-no-skill-md');
|
|
57
|
-
const result = await copySkills({ from: srcRoot, to });
|
|
58
|
-
expect(result.copied).not.toContain('not-a-skill');
|
|
59
|
-
});
|
|
60
|
-
it('creates target directory if it does not exist', async () => {
|
|
61
|
-
const to = path.join(tmpDir, 'new', 'nested', 'dest');
|
|
62
|
-
await copySkills({ from: srcRoot, to });
|
|
63
|
-
await expect(fs.access(to)).resolves.toBeUndefined();
|
|
64
|
-
});
|
|
65
|
-
});
|
|
66
|
-
//# sourceMappingURL=copy.test.js.map
|
package/dist/copy.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy.test.js","sourceRoot":"","sources":["../src/copy.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACnE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAC;AAEvC,IAAI,MAAc,CAAC;AACnB,IAAI,OAAe,CAAC;AAEpB,SAAS,CAAC,KAAK,IAAI,EAAE;IACnB,MAAM,GAAG,MAAM,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,EAAE,wBAAwB,CAAC,CAAC,CAAC;IAC5E,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAEnC,wBAAwB;IACxB,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