|
| 1 | +# CODEANY.md |
| 2 | + |
| 3 | +## Project Overview |
| 4 | + |
| 5 | +Codeany is an open-source AI-powered terminal agent, written in Go with Bubble Tea TUI. It aims to be a full-featured replacement for Claude Code with no proprietary code. |
| 6 | + |
| 7 | +## Architecture |
| 8 | + |
| 9 | +- **Runtime**: Go 1.23+, single binary |
| 10 | +- **TUI**: Bubble Tea + Lipgloss + Glamour (markdown) |
| 11 | +- **Agent SDK**: github.com/codeany-ai/open-agent-sdk-go (local dev via go.work) |
| 12 | +- **Build**: `go build -o codeany ./cmd/codeany/` or `make build` |
| 13 | + |
| 14 | +### Directory Structure |
| 15 | + |
| 16 | +``` |
| 17 | +cmd/codeany/main.go Entry point, version ldflags |
| 18 | +internal/ |
| 19 | + cli/root.go Cobra CLI, flags, update/upgrade |
| 20 | + config/config.go Config loading (JSON+YAML+env) |
| 21 | + config/permissions.go Permission rules persistence |
| 22 | + memory/memory.go Memory system (MEMORY.md + files) |
| 23 | + pipe/pipe.go Non-interactive pipe mode |
| 24 | + plugins/plugins.go Plugin loading from ~/.codeany/plugins/ |
| 25 | + session/session.go Session save/restore/resume |
| 26 | + skills/skills.go Skill loading from .codeany/skills/ |
| 27 | + slash/slash.go Command registry + routing + autocomplete |
| 28 | + slash/commands.go All command implementations |
| 29 | + team/team.go Team management + mailbox |
| 30 | + theme/theme.go Colors and styles |
| 31 | + theme/spinners.go Spinner verb list |
| 32 | + tui/model.go Main Bubble Tea model (TUI core) |
| 33 | + tui/input.go Input component (textarea + history) |
| 34 | + tui/render.go Message/tool rendering |
| 35 | + version/version.go Build-time version info |
| 36 | + worktree/worktree.go Git worktree isolation |
| 37 | +``` |
| 38 | + |
| 39 | +### Config Directory: ~/.codeany/ |
| 40 | + |
| 41 | +``` |
| 42 | +settings.json Main config (model, permissions, MCP, hooks) |
| 43 | +config.yaml YAML config (alternative/legacy) |
| 44 | +permissions.json Persisted permission rules |
| 45 | +memory/ Memory files |
| 46 | +sessions/ Session history + conversation logs |
| 47 | +skills/ User skills |
| 48 | +plugins/ User plugins |
| 49 | +teams/ Team configs + mailboxes |
| 50 | +worktrees/ Git worktree metadata |
| 51 | +``` |
| 52 | + |
| 53 | +## Commands |
| 54 | + |
| 55 | +```bash |
| 56 | +# Build |
| 57 | +make build # or: go build -o codeany ./cmd/codeany/ |
| 58 | +make install # go install with ldflags |
| 59 | +make vet # go vet ./... |
| 60 | +make dist # cross-compile 6 platforms |
| 61 | + |
| 62 | +# Dev |
| 63 | +go run ./cmd/codeany # run directly |
| 64 | +echo "test" | go run ./cmd/codeany -p -y # pipe mode test |
| 65 | +``` |
| 66 | + |
| 67 | +## Key Design Decisions |
| 68 | + |
| 69 | +- SDK at open-agent-sdk-go provides: agent loop, tools, MCP, permissions, hooks, cost tracking |
| 70 | +- Codeany adds: TUI, slash commands, skills, plugins, teams, sessions, config management |
| 71 | +- go.work used for local dev linking to SDK; go.mod uses published version for CI |
| 72 | +- All slash commands must be registered in BOTH AllCommands() (for autocomplete) and Handle() (for routing) |
| 73 | +- Permission callback in model.go is the single source of truth for tool approval |
| 74 | +- Hooks from config are converted to SDK HookFn functions via shell execution |
| 75 | + |
| 76 | +## Reference: Claude Code |
| 77 | + |
| 78 | +The original Claude Code is at ~/code/open-claude-code (TypeScript/Ink). |
| 79 | +When improving codeany, scan that codebase for feature parity. |
| 80 | +Key areas to compare: src/commands.ts, src/tools/, src/components/, src/screens/ |
0 commit comments