Skip to content

Commit 42017fe

Browse files
committed
update docs
1 parent 606f4a7 commit 42017fe

12 files changed

Lines changed: 353 additions & 3 deletions

File tree

AGENTS.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@
1212
4. **Git 用户配置** - 配置仓库的 Git 用户信息
1313
5. **任务管理** - 任务分发、同步和 GitHub 仓库创建
1414
6. **Gitcode 远程管理** - 为仓库添加 Gitcode 远程地址
15+
7. **系统工具** - DNS 缓存刷新、包管理器镜像源切换、项目目录清理
16+
8. **文档管理** - 初始化文档结构和 docmd 站点配置
17+
9. **进程诊断** - 检查进程或端口为何在运行(witr)
1518

1619
## 技术栈
1720

@@ -94,6 +97,7 @@ spark git url # 获取仓库 URL
9497
spark git init # 初始化仓库并创建 GitHub 远程
9598
spark git batch-clone # 克隆用户/组织所有仓库
9699
spark git issues # 从 Markdown 文档/任务创建 GitHub Issue
100+
spark git push-all # 提交并推送所有仓库的更改
97101
```
98102

99103
#### `spark git update`
@@ -251,6 +255,18 @@ spark git update-org-status variableway --skip-push # 跳过 git push
251255
- 只更新指定的 section,保留其他所有内容不变
252256
- 自动克隆、修改、提交并推送更改
253257

258+
#### `spark git push-all`
259+
扫描指定目录中的所有 Git 仓库,自动提交并推送所有更改。
260+
261+
```bash
262+
spark git push-all # 推送所有更改
263+
spark git push-all -p ~/workspace # 指定目录
264+
```
265+
266+
- 跳过非 GitHub 仓库和无更改的仓库
267+
- 自动 `git add -A``git commit``git push`
268+
- 遇到冲突时提示并继续处理下一个仓库
269+
254270
### 脚本管理
255271

256272
#### `spark script`
@@ -364,6 +380,88 @@ tasks/
364380
365381
详细文档: [docs/usage/task.md](docs/usage/task.md)
366382
383+
### 系统工具
384+
385+
#### `spark magic`
386+
系统实用工具命令组。
387+
388+
```bash
389+
spark magic flush-dns # 刷新 DNS 缓存
390+
spark magic clean # 清理 node_modules 和 .venv
391+
spark magic pip list # 列出 pip 镜像源
392+
spark magic pip use tsinghua # 切换 pip 镜像源
393+
spark magic pip current # 查看当前 pip 源
394+
spark magic go list # 列出 Go module proxy
395+
spark magic go use goproxy # 切换 Go proxy
396+
spark magic go current # 查看当前 Go proxy
397+
spark magic node list # 列出 npm registry
398+
spark magic node use taobao # 切换 npm registry
399+
spark magic node current # 查看当前 npm registry
400+
```
401+
402+
#### `spark magic flush-dns`
403+
刷新系统 DNS 缓存,支持 macOS、Windows、Linux。
404+
405+
#### `spark magic clean`
406+
递归清理项目目录中的 `node_modules``.venv`
407+
408+
```bash
409+
spark magic clean # 清理两者
410+
spark magic clean -m node # 只清理 node_modules
411+
spark magic clean -m python # 只清理 .venv
412+
```
413+
414+
| 选项 | 说明 |
415+
|------|------|
416+
| `-m, --mode` | 清理模式:`node``python`(默认两者) |
417+
418+
### 文档管理
419+
420+
#### `spark docs`
421+
文档管理命令组。
422+
423+
```bash
424+
spark docs init # 创建文档目录结构
425+
spark docs site # 初始化 docmd 站点配置
426+
```
427+
428+
#### `spark docs init`
429+
创建标准文档目录结构(`analysis/``features/``index.md``quick-start/``README.md``spec/``tips/``usage/`)。
430+
431+
#### `spark docs site`
432+
初始化 docmd 文档站点配置,自动从 git remote 检测项目名称和 GitHub Pages URL,生成 `docmd.config.js`
433+
434+
### 进程诊断
435+
436+
#### `spark witr`
437+
进程诊断工具(Why Is This Running),检查进程或端口为何在运行。
438+
439+
```bash
440+
spark witr nginx # 按名称检查进程
441+
spark witr --pid 1234 # 按 PID 检查
442+
spark witr --port 8080 # 按端口查找进程
443+
spark witr --file /path/to/lock # 查找占用文件的进程
444+
spark witr --container redis # 检查容器
445+
spark witr nginx --tree # 显示进程树
446+
spark witr nginx --env # 显示环境变量
447+
spark witr nginx --json # JSON 输出
448+
```
449+
450+
| 选项 | 说明 |
451+
|------|------|
452+
| `--pid` | 按 PID 查找(可多次使用) |
453+
| `--port` / `-o` | 按端口查找(可多次使用) |
454+
| `--file` / `-f` | 按文件查找(可多次使用) |
455+
| `--container` / `-c` | 按容器查找(可多次使用) |
456+
| `--tree` / `-t` | 显示进程祖先树 |
457+
| `--env` | 显示环境变量 |
458+
| `--json` | JSON 格式输出 |
459+
| `--short` / `-s` | 简短输出 |
460+
| `--warnings` | 仅显示警告 |
461+
| `--verbose` | 扩展信息 |
462+
| `--exact` / `-x` | 精确匹配 |
463+
| `--no-color` | 禁用颜色 |
464+
367465
## Spark Skills
368466

369467
个人 Skill 集合仓库,用于增强 spark-cli 的功能。

docs/README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ go test ./internal/git/... -v -run TestFunctionName
7979
| `spark git batch-clone <account> [--ssh] [--include] [--exclude] [-o <dir>]` | Clone all repos from GitHub org/user |
8080
| `spark git update-org-status <org> [--dry-run] [--update-dot-github] [--section <name>]` | Update org README with repo list |
8181
| `spark git issues [-r <owner/repo>] (-d <dir> \| -f <file>) [--dry-run] [-l <labels>]` | Create GitHub issues from markdown docs/tasks |
82+
| `spark git push-all [-p <path>]` | Commit and push all changes in repositories |
8283

8384
---
8485

@@ -103,6 +104,7 @@ Flags: `--task-dir`, `--owner`, `--work-dir`, `--tui`
103104
| Command | Description |
104105
|---------|-------------|
105106
| `spark magic flush-dns` | Flush DNS cache (macOS/Windows/Linux) |
107+
| `spark magic clean [-m node\|python]` | Clean node_modules and .venv directories |
106108

107109
#### Mirror Switching (list / use / current)
108110

@@ -123,6 +125,20 @@ Flags: `--task-dir`, `--owner`, `--work-dir`, `--tui`
123125

124126
Scripts sourced from `~/.spark.yaml` (`spark.scripts`) and `scripts/` directory.
125127

128+
---
129+
130+
### spark witr — Process Inspector
131+
132+
| Command | Description |
133+
|---------|-------------|
134+
| `spark witr [process name...]` | Inspect why a process or port is running |
135+
| `spark witr --pid <pid>` | Look up by PID |
136+
| `spark witr --port <port>` | Find process by port |
137+
| `spark witr --file <path>` | Find process holding file open |
138+
| `spark witr --container <name>` | Inspect container |
139+
140+
Flags: `--tree`, `--env`, `--json`, `--short`, `--warnings`, `--verbose`, `--exact`, `--no-color`
141+
126142
## Configuration
127143

128144
Config file: `~/.spark.yaml`

docs/features/git.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,17 @@ spark git issues -f tasks/issues/task-bug-fix.md -r variableway/spark-cli
101101
spark git issues -f tasks/issues/task-bug-fix.md --dry-run
102102
```
103103

104+
### 批量推送更改
105+
106+
扫描所有 GitHub 仓库,自动提交并推送未提交的更改。
107+
108+
```bash
109+
spark git push-all -p ~/workspace
110+
```
111+
112+
- 跳过非 GitHub 仓库和无更改的仓库
113+
- 遇到错误继续处理下一个仓库
114+
104115
## 使用参数
105116

106117
| 参数 | 说明 |

docs/features/magic.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,16 @@ spark magic node current # 查看当前 registry
7474
| `huawei` | 华为云 |
7575
| `ustc` | 中国科技大学 |
7676

77+
### 项目目录清理
78+
79+
递归清理 `node_modules``.venv` 目录,释放磁盘空间。
80+
81+
```bash
82+
spark magic clean # 清理两者
83+
spark magic clean -m node # 只清理 node_modules
84+
spark magic clean -m python # 只清理 .venv
85+
```
86+
7787
## 使用参数
7888

7989
三个镜像切换命令(pip/go/node)共享相同的子命令结构:

docs/index.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ go test ./internal/git/... -v -run TestFunctionName
8484
| `spark git batch-clone <account> [--ssh] [--include] [--exclude] [-o <dir>]` | Clone all repos from GitHub org/user |
8585
| `spark git update-org-status <org> [--dry-run] [--update-dot-github] [--section <name>]` | Update org README with repo list |
8686
| `spark git issues [-r <owner/repo>] (-d <dir> \| -f <file>) [--dry-run] [-l <labels>]` | Create GitHub issues from markdown docs/tasks |
87+
| `spark git push-all [-p <path>]` | Commit and push all changes in repositories |
8788

8889
---
8990

@@ -108,6 +109,7 @@ Flags: `--task-dir`, `--owner`, `--work-dir`, `--tui`
108109
| Command | Description |
109110
|---------|-------------|
110111
| `spark magic flush-dns` | Flush DNS cache (macOS/Windows/Linux) |
112+
| `spark magic clean [-m node\|python]` | Clean node_modules and .venv directories |
111113

112114
#### Mirror Switching (list / use / current)
113115

@@ -128,6 +130,20 @@ Flags: `--task-dir`, `--owner`, `--work-dir`, `--tui`
128130

129131
Scripts sourced from `~/.spark.yaml` (`spark.scripts`) and `scripts/` directory.
130132

133+
---
134+
135+
### spark witr — Process Inspector
136+
137+
| Command | Description |
138+
|---------|-------------|
139+
| `spark witr [process name...]` | Inspect why a process or port is running |
140+
| `spark witr --pid <pid>` | Look up by PID |
141+
| `spark witr --port <port>` | Find process by port |
142+
| `spark witr --file <path>` | Find process holding file open |
143+
| `spark witr --container <name>` | Inspect container |
144+
145+
Flags: `--tree`, `--env`, `--json`, `--short`, `--warnings`, `--verbose`, `--exact`, `--no-color`
146+
131147
## Configuration
132148

133149
Config file: `~/.spark.yaml`

docs/quick-start/getting-started.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ spark git update -p ~/workspace # 更新所有仓库
3232
spark git init --owner variableway # 初始化仓库并创建 GitHub 远程
3333
spark git submodule add -p /path/to/repos # 添加仓库为子模块
3434
spark git batch-clone variableway -o ./repos # 克隆组织仓库
35+
spark git push-all -p ~/workspace # 推送所有仓库的更改
3536
```
3637

3738
### 镜像源切换
@@ -40,6 +41,7 @@ spark git batch-clone variableway -o ./repos # 克隆组织仓库
4041
spark magic pip use tsinghua # Python → 清华源
4142
spark magic go use goproxy # Go → goproxy.cn
4243
spark magic node use taobao # Node → 淘宝源
44+
spark magic clean # 清理 node_modules 和 .venv
4345
```
4446

4547
### 任务管理
@@ -59,6 +61,14 @@ spark docs site # 初始化 docmd 站点
5961
docmd dev # 本地预览文档
6062
```
6163

64+
### 进程诊断
65+
66+
```bash
67+
spark witr nginx # 检查 nginx 进程
68+
spark witr --port 8080 # 查找占用 8080 端口的进程
69+
spark witr --pid 1234 # 按 PID 检查进程
70+
```
71+
6272
## 下一步
6373

6474
- [完整使用指南](../usage/usage.md)

docs/spec/git.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,3 +258,25 @@ spark git update-org-status <org-name-or-url> [--dry-run] [--update-dot-github]
258258
| 参数 | 类型 | 必填 | 说明 |
259259
|------|------|------|------|
260260
| `org-name-or-url` | string || 组织名或 URL |
261+
262+
---
263+
264+
## spark git push-all
265+
266+
扫描目录中的所有 Git 仓库,自动提交并推送所有更改。
267+
268+
```
269+
spark git push-all [-p <path>]
270+
```
271+
272+
| 标志 | 类型 | 默认值 | 必填 | 说明 |
273+
|------|------|--------|------|------|
274+
| `-p, --path` | stringSlice | `["."]` || 包含 Git 仓库的目录路径 |
275+
276+
无参数。
277+
278+
**行为**
279+
- 跳过非 GitHub 仓库
280+
- 跳过无更改的仓库
281+
- 自动 `git add -A``git commit``git push`
282+
- 遇到错误打印提示并继续下一个仓库

docs/spec/magic.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,24 @@ spark magic node current
141141
```
142142

143143
无标志,无参数。
144+
145+
---
146+
147+
## spark magic clean
148+
149+
递归清理项目目录中的 `node_modules``.venv`
150+
151+
```
152+
spark magic clean [-m <mode>]
153+
```
154+
155+
| 标志 | 类型 | 默认值 | 必填 | 说明 |
156+
|------|------|--------|------|------|
157+
| `-m, --mode` | string | `""` || 清理模式:`node``python`(默认两者) |
158+
159+
无参数。
160+
161+
**行为**
162+
- 扫描 `--path` 指定的目录(默认当前目录)
163+
- 自动跳过 `.git` 目录
164+
- 列出所有被清理的目录

docs/usage/git.md

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ spark git url [repo-path] # 查看远程 URL
1919
spark git batch-clone <account> [-o <dir>] # 克隆用户/组织所有仓库
2020
spark git update-org-status <org> [--dry-run] # 更新组织 README
2121
spark git issues [-r <owner/repo>] (-d <dir> | -f <file>) # 从文档/任务创建 Issue
22+
spark git push-all # 提交并推送所有仓库的更改
2223
```
2324

2425
---
@@ -69,7 +70,7 @@ spark git submodule add ./spark-cli # 将指定目录作为子
6970

7071
| 标志 | 简写 | 默认值 | 说明 |
7172
|------|------|--------|------|
72-
| `-n, --name` | string | repo 名 | | 子模块路径名称(远程模式) |
73+
| `-n, --name` | string | repo 名 | 子模块路径名称(远程模式) |
7374

7475
```bash
7576
# 添加远程仓库(使用默认路径名)
@@ -315,6 +316,27 @@ spark git issues -f tasks/issues/task-bug-fix.md -r variableway/spark-cli
315316
spark git issues -f tasks/issues/task-bug-fix.md --dry-run
316317
```
317318

319+
## spark git push-all
320+
321+
扫描指定目录中的所有 Git 仓库,自动提交并推送所有更改。
322+
323+
| 标志 | 默认值 | 说明 |
324+
|------|--------|------|
325+
| `-p, --path` | `.` | 包含 Git 仓库的目录路径(可多次指定) |
326+
327+
```bash
328+
spark git push-all # 推送所有仓库的更改
329+
spark git push-all -p ~/workspace # 指定目录
330+
```
331+
332+
**行为**:
333+
- 跳过非 GitHub 仓库
334+
- 跳过无更改的仓库
335+
- 自动 `git add -A` → `git commit` → `git push`
336+
- 遇到冲突时提示并继续处理下一个仓库
337+
338+
---
339+
318340
## 相关命令
319341

320342
- [任务管理](./task.md)

docs/usage/magic.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
```bash
88
spark magic flush-dns # 刷新 DNS 缓存
9+
spark magic clean [-m node|python] # 清理 node_modules 和 .venv
910

1011
# 镜像源切换(pip / go / node 通用子命令)
1112
spark magic <pip|go|node> list # 列出可用镜像
@@ -30,6 +31,27 @@ spark magic flush-dns
3031

3132
---
3233

34+
## spark magic clean
35+
36+
递归清理项目目录中的 `node_modules``.venv` 目录。
37+
38+
```bash
39+
spark magic clean # 清理两者
40+
spark magic clean -m node # 只清理 node_modules
41+
spark magic clean -m python # 只清理 .venv
42+
```
43+
44+
| 标志 | 简写 | 默认值 | 说明 |
45+
|------|------|--------|------|
46+
| `-m, --mode` | | | 清理模式:`node``python`(默认两者) |
47+
48+
**行为**
49+
- 扫描 `--path` 指定的目录(默认当前目录)
50+
- 自动跳过 `.git` 目录
51+
- 列出所有被清理的目录
52+
53+
---
54+
3355
## spark magic pip
3456

3557
管理 Python pip 镜像源。

0 commit comments

Comments
 (0)