Skip to content

Commit 5268467

Browse files
qdrivenclaude
andcommitted
docs: rewrite README, init docmd, restructure docs (Refs: #7, #8)
- Rewrite README.md with project purpose, tech stack, architecture, CLI cheatsheet, build instructions, and docs index - Fix all monolize → spark references in docs/usage/*.md (7 files) - Init docmd config (docmd.config.js) with sky theme, SPA layout, search/mermaid/llms plugins - Add GitHub Actions workflow for GitHub Pages deployment - Restructure docs/ (move analysis/, add features/spec/tips dirs) - Update CLAUDE.md with corrected module name and command hierarchy - Add node_modules/, site/, package-lock.json to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5d8d9aa commit 5268467

35 files changed

+494
-225
lines changed

.github-task-workflow.active-issue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6
1+
8

.github/workflows/docs.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Deploy Docs to GitHub Pages
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'docs/**'
8+
- 'docmd.config.js'
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
concurrency:
17+
group: pages
18+
cancel-in-progress: false
19+
20+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
30+
- name: Install dependencies
31+
run: npm install
32+
33+
- name: Build docs
34+
run: npx docmd build
35+
36+
- name: Upload artifact
37+
uses: actions/upload-pages-artifact@v3
38+
with:
39+
path: site
40+
41+
deploy:
42+
needs: build
43+
runs-on: ubuntu-latest
44+
environment:
45+
name: github-pages
46+
url: ${{ steps.deployment.outputs.page_url }}
47+
steps:
48+
- name: Deploy to GitHub Pages
49+
id: deployment
50+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,7 @@ go.sum
44
spark
55
__pycache__/
66
**/__pycache__/
7-
.github-task-workflow.active-issue
7+
.github-task-workflow.active-issue
8+
node_modules/
9+
site/
10+
package-lock.json

CLAUDE.md

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
55
## Build & Test Commands
66

77
```bash
8-
make build # Build for current OS (outputs ./spark)
8+
make build # Build for current OS + install to ~/.local/bin/spark
99
make build-linux # Cross-compile for Linux amd64
1010
make build-darwin # Cross-compile for macOS amd64
1111
make test # Run all unit tests (go test ./... -v)
@@ -21,40 +21,54 @@ go test ./internal/git/... -v -run TestFunctionName
2121

2222
## Architecture
2323

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

2626
### Code Structure
2727

2828
- **`main.go`** → calls `cmd.Execute()`
29-
- **`cmd/`** — Cobra command definitions. `root.go` loads config from `~/.spark.yaml`. Subdirectories `cmd/git/` and `cmd/magic/` group related commands.
29+
- **`cmd/`** — Cobra command definitions. `root.go` loads config from `~/.spark.yaml` and auto-migrates from legacy `~/.monolize.yaml`. Subdirectories group commands:
30+
- `cmd/git/` — Git repo management commands
31+
- `cmd/magic/` — System utility commands (DNS flush, mirror switching)
32+
- `cmd/script/` — Script management commands
33+
- `cmd/agent.go`, `cmd/agent_profile.go`, `cmd/task.go` — Top-level commands in the root `cmd/` package
3034
- **`internal/`** — Business logic, separated by domain:
31-
- `agent/` — AI agent config management (Claude Code, Codex, Kimi, GLM)
35+
- `agent/` — AI agent config management (Claude Code, Codex, Kimi, GLM) and profile templates
3236
- `config/` — Configuration loading and management
33-
- `git/` — Core Git operations (update, create, sync)
37+
- `git/` — Core Git operations (find repos, update, remote management, URL conversion)
38+
- `github/` — GitHub API interactions (list org repos, parse org URLs)
3439
- `mono/` — Mono-repo creation and submodule management
35-
- `task/` — Task dispatch/sync and GitHub repo creation
36-
- `tui/` — Shared terminal UI components (spinner, dialogs)
40+
- `script/` — Script discovery (from config and `scripts/` dir) and execution
41+
- `task/` — Task init/dispatch/sync, feature CRUD, and implementation via `kimi` CLI
42+
- `tui/` — Shared terminal UI components (spinner, dialogs, selector)
3743
- **`docs/usage/`** — Usage documentation per command
3844

3945
### Command Hierarchy
4046

4147
```
4248
spark
43-
├── git [update|create|sync|gitcode|config|url|clone-org]
44-
├── agent [list|view|edit|use|current] + agent profile [list|add|edit]
45-
├── task [list|dispatch|sync]
46-
└── magic [dns]
49+
├── git [update|create|sync|gitcode|config|url|clone-org|update-org-status]
50+
├── agent [list|view|edit|reset] + agent profile [list|add|edit]
51+
├── task [list|init|dispatch|sync|create|delete|impl]
52+
├── script [list|run]
53+
└── magic [flush-dns|pip|go|node] # Mirror source switching + DNS
4754
```
4855

56+
### Key Patterns
57+
58+
- **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.
59+
- **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.
60+
- **Script sources**: Scripts can come from `~/.spark.yaml` (`spark.scripts` or top-level `scripts`) or from a `scripts/` directory. Config scripts take precedence.
61+
4962
### Config
5063

51-
User config at `~/.spark.yaml` (see `.spark.yaml.example`). Key sections: `repo-path` (list of directories to scan), `git` (default username/email), `task_dir`, `github_owner`, `work_dir`.
64+
User config at `~/.spark.yaml`. Key sections: `repo-path` (list of directories to scan), `git` (default username/email), `task_dir`, `github_owner`, `work_dir`, `spark.scripts`.
5265

5366
## Development Conventions
5467

5568
- Follow standard Go conventions; no comments unless explicitly requested
5669
- New features require BDD-style tests using Ginkgo/Gomega
5770
- Test files use `_test.go` suffix, live alongside source in `internal/`
71+
- Test suite files (`*_suite_test.go`) register the Ginkgo test runner for each package
5872
- Keep `Makefile` as the single source of truth for build/test commands
5973
- New commands should have usage docs in `docs/usage/`
6074
- The UI language is primarily Chinese (documentation, user-facing messages)

0 commit comments

Comments
 (0)