xonecas.io
62159
Sy

symb / commit 3e1eeb5

feat: project scaffold

xonecas2026-02-11 3e1eeb538bb1488ff0dd87ab0e9eb8add8de18b3 parent 7c4b6b9

10 files changed

.gitignore+41−0
@@ -0,0 +1,41 @@
1+# Binaries
2+bin/
3+*.exe
4+*.exe~
5+*.dll
6+*.so
7+*.dylib
8+
9+# Test binary, built with `go test -c`
10+*.test
11+
12+# Output of the go coverage tool
13+*.out
14+coverage.out
15+
16+# Go workspace file
17+go.work
18+go.work.sum
19+
20+# Dependency directories
21+vendor/
22+
23+# IDE specific files
24+.vscode/
25+.idea/
26+*.swp
27+*.swo
28+*~
29+
30+# OS specific files
31+.DS_Store
32+Thumbs.db
33+
34+# Config files with secrets (keep template)
35+config.local.toml
36+*.env
37+.env.local
38+
39+# Debug files
40+debug
41+__debug_bin
.golangci.yml+45−0
@@ -0,0 +1,45 @@
1+run:
2+ timeout: 5m
3+ go: '1.23'
4+
5+linters:
6+ enable:
7+ - errcheck # Check for unchecked errors
8+ - gosimple # Simplify code
9+ - govet # Vet examines Go source code
10+ - ineffassign # Detect ineffectual assignments
11+ - staticcheck # Static analysis
12+ - unused # Check for unused constants, variables, functions
13+ - gofmt # Check formatting
14+ - goimports # Check imports
15+ - misspell # Check for commonly misspelled words
16+ - revive # Fast, configurable, extensible linter
17+ - stylecheck # Replacement for golint
18+ - unconvert # Remove unnecessary type conversions
19+ - unparam # Report unused function parameters
20+ - goconst # Find repeated strings that could be constants
21+ - gocyclo # Check cyclomatic complexity
22+ - dupl # Check for duplicate code
23+ - godot # Check if comments end in a period
24+ - gosec # Security problems
25+
26+linters-settings:
27+ gocyclo:
28+ min-complexity: 15
29+
30+ dupl:
31+ threshold: 100
32+
33+ goconst:
34+ min-len: 3
35+ min-occurrences: 3
36+
37+issues:
38+ exclude-rules:
39+ # Exclude some linters from running on tests files
40+ - path: _test\.go
41+ linters:
42+ - gocyclo
43+ - errcheck
44+ - dupl
45+ - gosec
AGENTS.md+8−0
@@ -0,0 +1,8 @@
1+**ALWAYS USE YAGNI**
2+
3+**DON'T WASTE TOKENS**
4+
5+- No one cares about your fancy documentation, stop wasting tokens. The user will ask when he wants documentation written.
6+- Short answers only, the user will ask for more details if he wants.
7+
8+**DON'T EDIT DESIGN.md**
DESIGN.md+22−4
@@ -9,7 +9,7 @@ A TUI from the future. We want feature parity with a GUI editor: mouse selection
99 ## Minimum viable product:
1010
1111 - Agentic UI:
12- - Support for highlighted code snippets. Git diffs and shell outputs. (Mini editor components?)
12+ - Support for clicking file references/diffs/snippets to open in Editor side.
1313 - Optional Human-in-the-middle LLM tool call loop (with configurable permissions in global config)
1414 - Auto Context, LLM is aware of file/project in question probably via tree-sitter?
1515 - AGENTS.md support
@@ -23,7 +23,7 @@ A TUI from the future. We want feature parity with a GUI editor: mouse selection
2323
2424 - LLM Tools:
2525 - Run in sandboxed version of the working directory to allow multiple agents working on the same file. Use git to merge sandboxed changes to real repo.
26- - Grep, Read, Write: optimized for code changes (LSP and linting checks after each edit). These appear in agentic UI as a diff. Clicking on it takes us to that edit in the editor tab.
26+ - Grep, Read, Write: optimized for code changes (LSP and linting checks after each edit). These appear in agentic UI as a diff message (not actual diff). Clicking on it takes us to that edit in the editor tab.
2727 - Undo: Either perform an intelligent step back or use git to reset.
2828 - Subagent tool: Performs a single task based on prompt.
2929 - Mutation tools create a new branch worktress for the sandboxed environment. Perform the mutation. Once the user approves the mutation or tells the agent to merge, a git merge happens.
@@ -71,7 +71,7 @@ A TUI from the future. We want feature parity with a GUI editor: mouse selection
7171
7272 - True ELM architecture (no exceptions ever).
7373 - Strict project structure with separation of concern by internal modules.
74-- Go (see https://github.com/tj/go-tea) For ELM architecture in TUI app.
74+- Go (see https://github.com/tj/go-tea) For ELM architecture in TUI app (documentation).
7575 - BubbleTea:
7676 - Base library for TUI, use their bubbles, and all of the ecosystem.
7777 - Golden files based testing for the TUI.
@@ -108,4 +108,22 @@ State Management. You have three asynchronous "gods" to serve:
108108 3. LLM Agent (Thinking/Tools) -> Slow (seconds).
109109
110110 BubbleTea's ELM architecture (Update() loop) is perfect for this if you keep the heavy lifting (LLM/LSP) in separate Go routines that send messages back to the main thread. If you block the main thread, the UI will freeze.
111-Confidence Level: High for a prototype. The ecosystem is ready.
111+Confidence Level: High for a prototype. The ecosystem is ready.
112+
113+## MVP Phases:
114+
115+1. Phase 1: Basic TUI with editor + agent pane (no LSP, no git sandbox)
116+ - File viewer with syntax highlighting
117+ - Agent conversation with tool calls (Read/Write/Grep)
118+ - Simple diff preview before applying
119+2. Phase 2: Git integration
120+ - Show git status in editor
121+ - Ctrl+g for diffs
122+ - Agent commits to real repo (no sandbox yet)
123+3. Phase 3: LSP integration
124+ - Start with diagnostics only
125+ - Add go-to-definition later
126+4. Phase 4: Advanced features
127+ - Sandboxed worktrees
128+ - Sub-agents
129+ - Context optimization with tree-sitter
Makefile+35−0
@@ -0,0 +1,35 @@
1+.PHONY: build run test lint clean install dev
2+
3+# Build the binary
4+build:
5+ go build -o bin/smith ./cmd/smith
6+
7+# Run the application
8+run:
9+ go run ./cmd/smith
10+
11+# Run tests
12+test:
13+ go test -v -race -coverprofile=coverage.out ./...
14+
15+# Run linter
16+lint:
17+ golangci-lint run
18+
19+# Clean build artifacts
20+clean:
21+ rm -rf bin/
22+ rm -f coverage.out
23+
24+# Install dependencies
25+install:
26+ go mod download
27+ go mod tidy
28+
29+# Development mode (with hot reload if you add air later)
30+dev: install
31+ go run ./cmd/smith
32+
33+# Show coverage
34+coverage: test
35+ go tool cover -html=coverage.out
cmd/smith/main.go+24−0
@@ -0,0 +1,24 @@
1+package main
2+
3+import (
4+ "fmt"
5+ "os"
6+
7+ tea "github.com/charmbracelet/bubbletea"
8+ "github.com/xonecas/smith/internal/tui"
9+)
10+
11+func main() {
12+ // Create the BubbleTea program
13+ p := tea.NewProgram(
14+ tui.New(),
15+ tea.WithAltScreen(), // Use alternate screen buffer
16+ tea.WithMouseCellMotion(), // Enable mouse support
17+ )
18+
19+ // Run the program
20+ if _, err := p.Run(); err != nil {
21+ fmt.Printf("Error running smith: %v\n", err)
22+ os.Exit(1)
23+ }
24+}
config.toml+19−0
@@ -0,0 +1,19 @@
1+# Smith Configuration File
2+
3+[llm]
4+provider = "ollama" # Options: "ollama", "opencode-zen"
5+model = "llama3.2"
6+base_url = "http://localhost:11434"
7+api_key = ""
8+
9+[editor]
10+tab_size = 4
11+show_line_nums = true
12+syntax_theme = "monokai"
13+
14+[git]
15+enable_sandbox = false # Enable git worktree sandboxing (experimental)
16+
17+[ui]
18+theme = "matrix"
19+split_ratio = 0.5 # Editor:Agent pane split ratio (0.0-1.0)
go.mod+25−0
@@ -0,0 +1,25 @@
1+module github.com/xonecas/smith
2+
3+go 1.25.6
4+
5+require (
6+ github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
7+ github.com/charmbracelet/bubbletea v1.3.10 // indirect
8+ github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
9+ github.com/charmbracelet/lipgloss v1.1.0 // indirect
10+ github.com/charmbracelet/x/ansi v0.10.1 // indirect
11+ github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
12+ github.com/charmbracelet/x/term v0.2.1 // indirect
13+ github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
14+ github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
15+ github.com/mattn/go-isatty v0.0.20 // indirect
16+ github.com/mattn/go-localereader v0.0.1 // indirect
17+ github.com/mattn/go-runewidth v0.0.16 // indirect
18+ github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
19+ github.com/muesli/cancelreader v0.2.2 // indirect
20+ github.com/muesli/termenv v0.16.0 // indirect
21+ github.com/rivo/uniseg v0.4.7 // indirect
22+ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
23+ golang.org/x/sys v0.36.0 // indirect
24+ golang.org/x/text v0.3.8 // indirect
25+)
go.sum+41−0
@@ -0,0 +1,41 @@
1+github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k=
2+github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8=
3+github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
4+github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
5+github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
6+github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
7+github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
8+github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
9+github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ=
10+github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
11+github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
12+github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
13+github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
14+github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
15+github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f h1:Y/CXytFA4m6baUTXGLOoWe4PQhGxaX0KpnayAqC48p4=
16+github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f/go.mod h1:vw97MGsxSvLiUE2X8qFplwetxpGLQrlU1Q9AUEIzCaM=
17+github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
18+github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
19+github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
20+github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
21+github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
22+github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
23+github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
24+github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
25+github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
26+github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo=
27+github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA=
28+github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo=
29+github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc=
30+github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
31+github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
32+github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
33+github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88=
34+github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
35+github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
36+golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
37+golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
38+golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k=
39+golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
40+golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
41+golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
internal/tui/tui.go+51−0
@@ -0,0 +1,51 @@
1+package tui
2+
3+import (
4+ tea "github.com/charmbracelet/bubbletea"
5+)
6+
7+// Model is the application model
8+type Model struct {
9+ width int
10+ height int
11+}
12+
13+// New creates a new TUI model
14+func New() Model {
15+ return Model{}
16+}
17+
18+// Init initializes the TUI (required by BubbleTea)
19+func (m Model) Init() tea.Cmd {
20+ return nil
21+}
22+
23+// Update handles messages and updates state (required by BubbleTea)
24+func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
25+ switch msg := msg.(type) {
26+ case tea.KeyMsg:
27+ switch msg.String() {
28+ case "ctrl+c", "q":
29+ return m, tea.Quit
30+ }
31+
32+ case tea.WindowSizeMsg:
33+ m.width = msg.Width
34+ m.height = msg.Height
35+ }
36+
37+ return m, nil
38+}
39+
40+// View renders the UI (required by BubbleTea)
41+func (m Model) View() string {
42+ if m.width == 0 {
43+ return "Initializing..."
44+ }
45+
46+ return "╭─────────────────────────────────────┬────────────────────────────────────╮\n" +
47+ "│ Editor Pane │ Agent Smith │\n" +
48+ "│ │ │\n" +
49+ "│ Press q or Ctrl+C to quit │ │\n" +
50+ "╰─────────────────────────────────────┴────────────────────────────────────╯\n"
51+}