Files
mygo/AGENTS.md
Huxley e8a0c48658 Initialize project skeleton with CLI and documentation
Add initial project structure including:
- Go module with Cobra CLI dependency
- Root command and main entrypoint
- Basic documentation (README, AGENTS.md, architecture, decisions,
  development, roadmap)
- Configuration example and gitignore
- Tool version management with mise
- Comprehensive project rules and conventions
2026-04-25 17:18:16 +00:00

55 lines
1.9 KiB
Markdown

# AGENTS.md — MyGO Backend
## Project Essentials
- Module: `github.com/dhao2001/mygo`, Go 1.26.2
- WebDisk (cloud drive) backend; roadmap in `docs/roadmap.md`
- CLI framework: `github.com/spf13/cobra`
- Go version pinned in `mise.toml`
## Agent Workflow
1. Read the task
2. Read relevant `docs/` files for context
3. Explore existing code before writing new code
4. Implement following the conventions below
5. Verify: `go vet ./... && go test ./...`
6. Update `docs/roadmap.md`, `docs/decisions.md`, or `docs/architecture.md` if anything changed
## Go Conventions
- **Format**: `go fmt ./...` before every commit
- **Imports**: stdlib / third-party / internal, blank-line separated
- **Errors**: wrap with `fmt.Errorf("context: %w", err)`
- **Context**: first param in I/O, storage, lifecycle funcs
- **Exported names**: doc-commented
- **`init()`**: only in cobra cmd files for flag registration
- **`cmd/`** is thin; business logic goes in `internal/`
## Documentation
| File | Read Before | Update After |
|------|-------------|--------------|
| `docs/architecture.md` | Adding new packages | Adding new packages |
| `docs/decisions.md` | Making technical decisions | Making technical decisions |
| `docs/roadmap.md` | Every task | Completing a feature |
| `docs/development.md` | Build/test/debug setup | Changing workflow |
## Commands
```bash
go build ./... # build all packages
go test ./... # all tests
go vet ./... # static analysis
go fmt ./... # format
go mod tidy # clean deps after add/remove
```
## DO / DON'T
- DO put business logic in `internal/`, keep `cmd/` thin
- DO write all code, comments, and documentation in English
- DON'T read `go.sum` entirely into context — use `grep` or other tools to search specific patterns if needed
- DON'T skip `go vet ./...` before finishing work
- DON'T commit without explicit user request