Skip to content

Commit 4de1b73

Browse files
committed
update docs
1 parent 9565996 commit 4de1b73

10 files changed

Lines changed: 87 additions & 69 deletions

File tree

CLAUDE.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ go test ./internal/git/... -v -run TestFunctionName
2121

2222
## Architecture
2323

24-
Spark is a Go CLI tool (`module spark`, binary `spark`) for managing multiple Git repositories, AI agent configs, scripts, and task workflows. Built with **Cobra** (CLI), **Viper** (config), **PTerm** + **Bubble Tea** (TUI), tested with **Ginkgo/Gomega** (BDD).
24+
Spark is a Go CLI tool (`module spark`, binary `spark`) for managing multiple Git repositories, scripts, and task workflows. Built with **Cobra** (CLI), **Viper** (config), **PTerm** + **Bubble Tea** (TUI), tested with **Ginkgo/Gomega** (BDD).
2525

2626
### Code Structure
2727

@@ -30,33 +30,32 @@ Spark is a Go CLI tool (`module spark`, binary `spark`) for managing multiple Gi
3030
- `cmd/git/` — Git repo management commands
3131
- `cmd/magic/` — System utility commands (DNS flush, mirror switching)
3232
- `cmd/script/` — Script management commands
33-
- `cmd/agent.go`, `cmd/agent_profile.go`, `cmd/task.go` — Top-level commands in the root `cmd/` package
33+
- `cmd/task.go` — Top-level task commands in the root `cmd/` package
3434
- **`internal/`** — Business logic, separated by domain:
35-
- `agent/` — AI agent config management (Claude Code, Codex, Kimi, GLM) and profile templates
35+
- `agent/` — AI agent config management module (currently command entry disabled)
3636
- `config/` — Configuration loading and management
3737
- `git/` — Core Git operations (find repos, update, remote management, URL conversion)
3838
- `github/` — GitHub API interactions (list org repos, parse org URLs)
3939
- `mono/` — Mono-repo creation and submodule management
4040
- `script/` — Script discovery (from config and `scripts/` dir) and execution
41-
- `task/` — Task init/dispatch/sync, feature CRUD, and implementation via `kimi` CLI
41+
- `task/` — Task init/dispatch/sync, issue CRUD, and implementation via `kimi` CLI
4242
- `tui/` — Shared terminal UI components (spinner, dialogs, selector)
4343
- **`docs/usage/`** — Usage documentation per command
4444

4545
### Command Hierarchy
4646

4747
```
4848
spark
49-
├── git [update|mono|gitcode|config|url|batch-clone|update-org-status]
49+
├── git [update|mono|gitcode|config|url|batch-clone|issues|update-org-status]
5050
│ └── mono [add|sync]
51-
├── agent [list|view|edit|reset] + agent profile [list|add|edit]
5251
├── task [list|init|dispatch|sync|create|delete|impl]
5352
├── script [list|run]
5453
└── magic [flush-dns|pip|go|node] # Mirror source switching + DNS
5554
```
5655

5756
### Key Patterns
5857

59-
- **TUI mode**: `task`, `agent`, and other commands accept `--tui` flag for interactive mode with Bubble Tea selectors and PTerm spinners. CLI mode is the default.
58+
- **TUI mode**: `task` and other commands accept `--tui` flag for interactive mode with Bubble Tea selectors and PTerm spinners. CLI mode is the default.
6059
- **Config binding**: Flags are bound to Viper via `viper.BindPFlag()` in `init()` functions. Config keys use snake_case in YAML but camelCase in struct tags.
6160
- **Script sources**: Scripts can come from `~/.spark.yaml` (`spark.scripts` or top-level `scripts`) or from a `scripts/` directory. Config scripts take precedence.
6261

README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ main.go → cmd.Execute()
3535
│ ├── github/ GitHub API interactions
3636
│ ├── mono/ Mono-repo & submodule management
3737
│ ├── script/ Script discovery & execution
38-
│ ├── task/ Task dispatch/sync/feature CRUD
38+
│ ├── task/ Task dispatch/sync/issue CRUD
3939
│ └── tui/ Shared terminal UI components
4040
├── docs/ Documentation (docmd)
4141
└── scripts/ User-defined automation scripts
@@ -81,6 +81,7 @@ go test ./internal/git/... -v -run TestFunctionName
8181
| `spark git url [repo-path]` | Get remote URL of repository |
8282
| `spark git batch-clone <account> [--ssh] [--include] [--exclude] [-o <dir>]` | Clone all repos from GitHub org/user |
8383
| `spark git update-org-status <org> [--dry-run] [--update-dot-github] [--section <name>]` | Update org README with repo list |
84+
| `spark git issues [-r <owner/repo>] (-d <dir> \| -f <file>) [--dry-run] [-l <labels>]` | Create GitHub issues from markdown docs/tasks |
8485

8586
---
8687

@@ -108,10 +109,10 @@ Supported agents: `claude-code`, `codex`, `kimi`, `glm`
108109
| Command | Description |
109110
|---------|-------------|
110111
| `spark task init` | Initialize task directory structure |
111-
| `spark task list` | List all tasks and features |
112-
| `spark task create <name> [--content <text>]` | Create feature file |
113-
| `spark task delete <name> [--force]` | Delete feature file |
114-
| `spark task impl <name>` | Implement feature via kimi CLI |
112+
| `spark task list` | List all tasks and issues |
113+
| `spark task create <name> [--content <text>]` | Create issue file |
114+
| `spark task delete <name> [--force]` | Delete issue file |
115+
| `spark task impl <name>` | Implement issue via kimi CLI |
115116
| `spark task dispatch [name] [--dest <path>]` | Dispatch task to workspace |
116117
| `spark task sync [name] [--work-path <path>]` | Sync task back |
117118

docs/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ main.go → cmd.Execute()
3535
│ ├── github/ GitHub API interactions
3636
│ ├── mono/ Mono-repo & submodule management
3737
│ ├── script/ Script discovery & execution
38-
│ ├── task/ Task dispatch/sync/feature CRUD
38+
│ ├── task/ Task dispatch/sync/issue CRUD
3939
│ └── tui/ Shared terminal UI components
4040
├── docs/ Documentation (docmd)
4141
└── scripts/ User-defined automation scripts
@@ -81,6 +81,7 @@ go test ./internal/git/... -v -run TestFunctionName
8181
| `spark git url [repo-path]` | Get remote URL of repository |
8282
| `spark git batch-clone <account> [--ssh] [--include] [--exclude] [-o <dir>]` | Clone all repos from GitHub org/user |
8383
| `spark git update-org-status <org> [--dry-run] [--update-dot-github] [--section <name>]` | Update org README with repo list |
84+
| `spark git issues [-r <owner/repo>] (-d <dir> \| -f <file>) [--dry-run] [-l <labels>]` | Create GitHub issues from markdown docs/tasks |
8485

8586
---
8687

@@ -108,10 +109,10 @@ Supported agents: `claude-code`, `codex`, `kimi`, `glm`
108109
| Command | Description |
109110
|---------|-------------|
110111
| `spark task init` | Initialize task directory structure |
111-
| `spark task list` | List all tasks and features |
112-
| `spark task create <name> [--content <text>]` | Create feature file |
113-
| `spark task delete <name> [--force]` | Delete feature file |
114-
| `spark task impl <name>` | Implement feature via kimi CLI |
112+
| `spark task list` | List all tasks and issues |
113+
| `spark task create <name> [--content <text>]` | Create issue file |
114+
| `spark task delete <name> [--force]` | Delete issue file |
115+
| `spark task impl <name>` | Implement issue via kimi CLI |
115116
| `spark task dispatch [name] [--dest <path>]` | Dispatch task to workspace |
116117
| `spark task sync [name] [--work-path <path>]` | Sync task back |
117118

docs/features/git.md

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,22 @@ spark git batch-clone jackwener -o ./repos
5353
spark git update-org-status variableway --update-dot-github
5454
```
5555

56-
### 批量创建 Issue
56+
### Markdown 创建 Issue
5757

58-
从文件夹中的 Markdown 文档批量创建 GitHub Issue。每个文档对应一个 Issue,标题自动提取自文档的首行标题。
58+
统一使用 `spark git issues` 命令创建 GitHub Issue,支持两种输入模式:
59+
60+
- 目录模式:读取目录下所有 Markdown 文件,每个文件创建一个 Issue
61+
- 任务模式:读取单个任务文件,按 `# Task <id>` / `## Task <id>` 分段创建多个 Issue
5962

6063
```bash
61-
# 从文档创建 Issue
62-
spark git batch-issue variableway/spark-cli -d ./docs
64+
# 目录模式
65+
spark git issues -d ./docs -r variableway/spark-cli
6366

64-
# 预览模式
65-
spark git batch-issue owner/repo -d ./issues --dry-run
67+
# 任务模式
68+
spark git issues -f tasks/features/task-bug-fix.md -r variableway/spark-cli
6669

67-
# 添加标签
68-
spark git batch-issue owner/repo -d ./docs --label "documentation"
70+
# 自动识别当前仓库 + 预览
71+
spark git issues -f tasks/features/task-bug-fix.md --dry-run
6972
```
7073

7174
## 使用参数
@@ -78,11 +81,16 @@ spark git batch-issue owner/repo -d ./docs --label "documentation"
7881
| `-o, --output` | 输出路径 |
7982
| `--ssh` | 使用 SSH 克隆(batch-clone) |
8083
| `--include` / `--exclude` | 包含/排除匹配模式(batch-clone) |
84+
| `-r, --repo` | 目标仓库(未指定时自动从当前仓库解析) |
85+
| `-d, --dir` | 文档目录(目录模式) |
86+
| `-f, --file` | 任务文件(任务模式) |
87+
| `-l, --labels` | Issue 标签(逗号分隔) |
88+
| `--dry-run` | 仅预览,不创建 Issue |
8189

8290
## 依赖
8391

8492
- `git` 命令行工具
85-
- `gh` CLI(batch-clone、update-org-status 需要 GitHub API 访问)
93+
- `gh` CLI(issues、batch-clone、update-org-status 需要 GitHub API 访问)
8694

8795
## 相关文档
8896

docs/features/task.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@
88

99
### 任务初始化
1010

11-
在项目中创建标准的任务目录结构(`tasks/features/`)。
11+
在项目中创建标准的任务目录结构(`tasks/issues/`)。
1212

1313
```bash
1414
spark task init
1515
```
1616

1717
### 特性文件管理
1818

19-
创建、列出、删除特性描述文件。特性文件是 Markdown 格式的任务描述。
19+
创建、列出、删除 issue 描述文件。issue 文件是 Markdown 格式的任务描述。
2020

2121
```bash
22-
spark task create my-feature # 创建
22+
spark task create my-feature # 创建 issue
2323
spark task create my-feature --content "描述" # 带内容创建
2424
spark task list # 列出
2525
spark task delete my-feature # 删除
2626
```
2727

2828
### AI 实现
2929

30-
通过 `kimi` CLI 自动实现特性描述中的任务
30+
通过 `kimi` CLI 自动实现 issue 描述中的任务
3131

3232
```bash
3333
spark task impl my-feature
@@ -51,7 +51,7 @@ spark task sync my-feature
5151
```
5252
create → impl → dispatch → (开发) → sync
5353
↑ ↓
54-
└────── tasks/features/*.md ←─────────┘
54+
└────── tasks/issues/*.md ←───────────┘
5555
```
5656

5757
## 使用参数

docs/index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ main.go → cmd.Execute()
4040
│ ├── github/ GitHub API interactions
4141
│ ├── mono/ Mono-repo & submodule management
4242
│ ├── script/ Script discovery & execution
43-
│ ├── task/ Task dispatch/sync/feature CRUD
43+
│ ├── task/ Task dispatch/sync/issue CRUD
4444
│ └── tui/ Shared terminal UI components
4545
├── docs/ Documentation (docmd)
4646
└── scripts/ User-defined automation scripts
@@ -86,6 +86,7 @@ go test ./internal/git/... -v -run TestFunctionName
8686
| `spark git url [repo-path]` | Get remote URL of repository |
8787
| `spark git batch-clone <account> [--ssh] [--include] [--exclude] [-o <dir>]` | Clone all repos from GitHub org/user |
8888
| `spark git update-org-status <org> [--dry-run] [--update-dot-github] [--section <name>]` | Update org README with repo list |
89+
| `spark git issues [-r <owner/repo>] (-d <dir> \| -f <file>) [--dry-run] [-l <labels>]` | Create GitHub issues from markdown docs/tasks |
8990

9091
---
9192

@@ -113,10 +114,10 @@ Supported agents: `claude-code`, `codex`, `kimi`, `glm`
113114
| Command | Description |
114115
|---------|-------------|
115116
| `spark task init` | Initialize task directory structure |
116-
| `spark task list` | List all tasks and features |
117-
| `spark task create <name> [--content <text>]` | Create feature file |
118-
| `spark task delete <name> [--force]` | Delete feature file |
119-
| `spark task impl <name>` | Implement feature via kimi CLI |
117+
| `spark task list` | List all tasks and issues |
118+
| `spark task create <name> [--content <text>]` | Create issue file |
119+
| `spark task delete <name> [--force]` | Delete issue file |
120+
| `spark task impl <name>` | Implement issue via kimi CLI |
120121
| `spark task dispatch [name] [--dest <path>]` | Dispatch task to workspace |
121122
| `spark task sync [name] [--work-path <path>]` | Sync task back |
122123

docs/quick-start/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ spark agent use my-profile # 应用到当前项目
5454

5555
```bash
5656
spark task init # 初始化任务目录
57-
spark task create my-feature # 创建特性文件
57+
spark task create my-feature # 创建 issue 文件
5858
spark task dispatch my-feature # 分发到工作目录
5959
spark task sync my-feature # 同步回任务目录
6060
```

docs/spec/task.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spark task [--task-dir <dir>] [--owner <owner>] [--work-dir <dir>] [--tui]
1919

2020
## spark task init
2121

22-
初始化任务目录结构,创建 `tasks/features/` 等目录。
22+
初始化任务目录结构,创建 `tasks/issues/` 等目录,并生成 `tasks/example-issue.md`
2323

2424
```
2525
spark task init
@@ -47,7 +47,7 @@ spark task list [--task-dir <dir>]
4747

4848
## spark task create
4949

50-
`tasks/features/` 下创建新的特性文件。文件名中的空格自动转为 `-`
50+
`tasks/issues/` 下创建新的 issue 文件。文件名中的空格和下划线自动转为 `-`
5151

5252
```
5353
spark task create <feature-name> [--content <text>]
@@ -59,13 +59,13 @@ spark task create <feature-name> [--content <text>]
5959

6060
| 参数 | 类型 | 必填 | 说明 |
6161
|------|------|------|------|
62-
| `feature-name` | string || 特性名称(作为文件名) |
62+
| `feature-name` | string || issue 名称(作为文件名) |
6363

6464
---
6565

6666
## spark task delete
6767

68-
删除特性文件
68+
删除 issue 文件
6969

7070
```
7171
spark task delete <feature-name> [--force]
@@ -77,21 +77,21 @@ spark task delete <feature-name> [--force]
7777

7878
| 参数 | 类型 | 必填 | 说明 |
7979
|------|------|------|------|
80-
| `feature-name` | string || 特性名称 |
80+
| `feature-name` | string || issue 名称 |
8181

8282
---
8383

8484
## spark task impl
8585

86-
使用 `kimi` CLI 实现特性
86+
使用 `kimi` CLI 实现 issue
8787

8888
```
8989
spark task impl <feature-name>
9090
```
9191

9292
| 参数 | 类型 | 必填 | 说明 |
9393
|------|------|------|------|
94-
| `feature-name` | string || 特性名称 |
94+
| `feature-name` | string || issue 名称 |
9595

9696
无标志(除父命令 `--tui`)。
9797

docs/usage/git.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ spark git config [--username --email] # 配置 Git 用户
1414
spark git url [repo-path] # 查看远程 URL
1515
spark git batch-clone <account> [-o <dir>] # 克隆用户/组织所有仓库
1616
spark git update-org-status <org> [--dry-run] # 更新组织 README
17-
spark git batch-issue <repo> [-d <docs-dir>] # 从文档批量创建 Issue
17+
spark git issues [-r <owner/repo>] (-d <dir> | -f <file>) # 从文档/任务创建 Issue
1818
```
1919

2020
---
@@ -171,24 +171,32 @@ spark git update-org-status variableway --section "My Projects"
171171

172172
---
173173

174-
## spark git batch-issue
174+
## spark git issues
175175

176-
从文件夹中的 Markdown 文档批量创建 GitHub Issue。每个文档对应一个 Issue。
176+
从 Markdown 文档创建 GitHub Issue,支持两种模式:
177+
178+
- 目录模式:`-d` 指定目录,目录下每个 `.md` 文件创建一个 Issue
179+
- 任务模式:`-f` 指定单文件,按 `# Task <id>``## Task <id>` 分段创建多个 Issue
180+
181+
仓库参数可通过 `-r` 显式指定;未指定时自动从当前仓库 `origin` 解析 `owner/repo`
177182

178183
| 标志 | 简写 | 默认值 | 说明 |
179184
|------|------|--------|------|
180-
| `--docs` | `-d` | `.` | 包含 Markdown 文档的目录 |
181-
| `--dry-run` | | `false` | 预览不创建 |
182-
| `--label` | `-l` | | 为所有 Issue 添加标签(逗号分隔) |
183-
184-
**标题规则**
185-
- 优先使用文档中的第一个 `# 标题`
186-
- 无标题时使用文件名(去掉 `.md` 后缀)
185+
| `--repo` | `-r` | 自动检测 | 目标仓库(`owner/repo`|
186+
| `--dir` | `-d` | | Markdown 目录(目录模式) |
187+
| `--file` | `-f` | | 任务文件(任务模式) |
188+
| `--labels` | `-l` | | 为所有 Issue 添加标签(逗号分隔) |
189+
| `--dry-run` | | `false` | 预览,不创建 Issue |
187190

188191
```bash
189-
spark git batch-issue variableway/spark-cli -d ./docs
190-
spark git batch-issue owner/repo -d ./issues --dry-run
191-
spark git batch-issue owner/repo -d ./docs --label "documentation,enhancement"
192+
# 目录模式:每个 Markdown 文件创建一个 Issue
193+
spark git issues -d ./docs -r variableway/spark-cli
194+
195+
# 任务模式:从任务文件按 Task 段落创建 Issue
196+
spark git issues -f tasks/features/task-bug-fix.md -r variableway/spark-cli
197+
198+
# 自动从当前仓库解析 owner/repo
199+
spark git issues -f tasks/features/task-bug-fix.md --dry-run
192200
```
193201

194202
## 相关命令

0 commit comments

Comments
 (0)