You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CLAUDE.md
+26-12Lines changed: 26 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
5
5
## Build & Test Commands
6
6
7
7
```bash
8
-
make build # Build for current OS (outputs ./spark)
8
+
make build # Build for current OS + install to ~/.local/bin/spark
9
9
make build-linux # Cross-compile for Linux amd64
10
10
make build-darwin # Cross-compile for macOS amd64
11
11
make test# Run all unit tests (go test ./... -v)
@@ -21,40 +21,54 @@ go test ./internal/git/... -v -run TestFunctionName
21
21
22
22
## Architecture
23
23
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).
25
25
26
26
### Code Structure
27
27
28
28
-**`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
30
34
-**`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
└── magic [flush-dns|pip|go|node] # Mirror source switching + DNS
47
54
```
48
55
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
+
49
62
### Config
50
63
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`.
52
65
53
66
## Development Conventions
54
67
55
68
- Follow standard Go conventions; no comments unless explicitly requested
56
69
- New features require BDD-style tests using Ginkgo/Gomega
57
70
- 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
58
72
- Keep `Makefile` as the single source of truth for build/test commands
59
73
- New commands should have usage docs in `docs/usage/`
60
74
- The UI language is primarily Chinese (documentation, user-facing messages)
0 commit comments