Skip to content

Commit e4116c7

Browse files
halfaipgclaude
andcommitted
feat: release pipeline — goreleaser, install script, README
- Add .goreleaser.yml for cross-platform builds (linux/darwin/windows × amd64/arm64) - Add GitHub Actions release workflow (triggers on tag push, runs tests first) - Add curl-able install.sh that detects OS/arch and downloads the right binary - Add README with install instructions, env vars, features, tool reference - Add MIT license - Add --version flag (set by goreleaser ldflags) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fe97b82 commit e4116c7

7 files changed

Lines changed: 306 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- uses: actions/setup-go@v5
20+
with:
21+
go-version: "1.24"
22+
23+
- name: Run tests
24+
run: go test -v ./...
25+
26+
- uses: goreleaser/goreleaser-action@v6
27+
with:
28+
version: "~> v2"
29+
args: release --clean
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Binary
2-
codebase
2+
/codebase
3+
/codebase.exe
4+
5+
# Goreleaser
6+
dist/
37

48
# Environment
59
.env

.goreleaser.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 2
2+
3+
project_name: codebase
4+
5+
builds:
6+
- main: .
7+
binary: codebase
8+
env:
9+
- CGO_ENABLED=0
10+
goos:
11+
- linux
12+
- darwin
13+
- windows
14+
goarch:
15+
- amd64
16+
- arm64
17+
ldflags:
18+
- -s -w -X main.version={{.Version}} -X main.commit={{.ShortCommit}}
19+
20+
archives:
21+
- format: tar.gz
22+
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
23+
format_overrides:
24+
- goos: windows
25+
format: zip
26+
27+
checksum:
28+
name_template: "checksums.txt"
29+
30+
changelog:
31+
sort: asc
32+
filters:
33+
exclude:
34+
- "^docs:"
35+
- "^test:"
36+
- "^ci:"
37+
38+
release:
39+
github:
40+
owner: codebase-foundation
41+
name: codebase-cli
42+
draft: false
43+
prerelease: auto
44+
name_template: "v{{ .Version }}"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2026 Codebase Foundation
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,124 @@
1+
# Codebase CLI
2+
3+
AI coding agent that runs in your terminal. Reads your project, writes code, runs commands — using any OpenAI-compatible LLM.
4+
5+
## Install
6+
7+
```sh
8+
curl -sSL https://raw.githubusercontent.com/codebase-foundation/codebase-cli/main/install.sh | sh
9+
```
10+
11+
Or with Go:
12+
13+
```sh
14+
go install github.com/codebase-foundation/cli@latest
15+
```
16+
17+
Or build from source:
18+
19+
```sh
20+
git clone https://github.com/codebase-foundation/codebase-cli.git
21+
cd codebase-cli
22+
go build -o codebase .
23+
```
24+
25+
## Quick Start
26+
27+
```sh
28+
export OPENAI_API_KEY=sk-...
29+
cd your-project
30+
codebase
31+
```
32+
33+
Works with any OpenAI-compatible API:
34+
35+
```sh
36+
# Groq
37+
export OPENAI_BASE_URL=https://api.groq.com/openai/v1
38+
export OPENAI_API_KEY=gsk-...
39+
export OPENAI_MODEL=llama-3.3-70b-versatile
40+
41+
# Ollama (local)
42+
export OPENAI_BASE_URL=http://localhost:11434/v1
43+
export OPENAI_API_KEY=ollama
44+
export OPENAI_MODEL=qwen2.5-coder:32b
45+
46+
# Any OpenAI-compatible endpoint
47+
export OPENAI_BASE_URL=https://your-provider.com/v1
48+
export OPENAI_API_KEY=your-key
49+
export OPENAI_MODEL=your-model
50+
51+
codebase
52+
```
53+
54+
## Tools
55+
56+
The agent has 9 built-in tools:
57+
58+
| Tool | Description |
59+
|------|-------------|
60+
| `read_file` | Read file contents with line numbers |
61+
| `write_file` | Create or overwrite files |
62+
| `edit_file` | Surgical find-and-replace |
63+
| `multi_edit` | Batch edits across multiple files |
64+
| `list_files` | Directory listing and glob search |
65+
| `search_files` | Regex search across codebase (ripgrep) |
66+
| `web_search` | Search the web (Tavily, Brave, SearXNG, or DuckDuckGo) |
67+
| `dispatch_agent` | Spawn a read-only research subagent |
68+
| `shell` | Run any shell command |
69+
70+
Read-only tools run in parallel automatically.
71+
72+
## Web Search
73+
74+
Web search works out of the box with DuckDuckGo (no API key needed). For better results, configure a provider:
75+
76+
```sh
77+
# Tavily (recommended for AI agents)
78+
export TAVILY_API_KEY=tvly-...
79+
80+
# Brave Search
81+
export BRAVE_API_KEY=BSA...
82+
83+
# Self-hosted SearXNG
84+
export SEARXNG_URL=https://your-searxng-instance.com
85+
```
86+
87+
## Glue Models (Optional)
88+
89+
Route cheap tasks (intent classification, titles, narration) to a separate fast/small model while keeping your main agent on a smarter model:
90+
91+
```sh
92+
export GLUE_API_KEY=gsk-...
93+
export GLUE_BASE_URL=https://api.groq.com/openai/v1
94+
export GLUE_FAST_MODEL=llama-3.1-8b-instant
95+
export GLUE_SMART_MODEL=llama-3.3-70b-versatile
96+
```
97+
98+
If not set, glue falls back to your main `OPENAI_*` config.
99+
100+
## Features
101+
102+
- **Demoscene boot screen** — plasma, 3D cube, sine scroller, chiptune audio
103+
- **Streaming responses** — real-time token output as the model thinks
104+
- **Agentic loop** — multi-turn tool use with automatic continuation
105+
- **Parallel tool execution** — read-only tools run concurrently
106+
- **Conversation compaction** — automatic context management for long sessions
107+
- **Session persistence** — resume where you left off
108+
- **Project awareness** — reads AGENTS.md/CLAUDE.md/CODEX.md for project instructions
109+
- **Planning mode** — Glue-driven Q&A for complex tasks before building
110+
- **Intent routing** — chat, clarify, plan, or build based on your message
111+
- **Subagent dispatch** — spawn isolated research agents for deep dives
112+
113+
## Flags
114+
115+
```
116+
-model LLM model name (default: gpt-4o)
117+
-base-url OpenAI-compatible API base URL
118+
-dir Working directory (default: current directory)
119+
-version Print version and exit
120+
```
121+
122+
## License
123+
124+
MIT

install.sh

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# Codebase CLI installer
5+
# Usage: curl -sSL https://raw.githubusercontent.com/codebase-foundation/codebase-cli/main/install.sh | sh
6+
7+
REPO="codebase-foundation/codebase-cli"
8+
BINARY="codebase"
9+
INSTALL_DIR="${INSTALL_DIR:-/usr/local/bin}"
10+
11+
# Detect OS
12+
OS="$(uname -s | tr '[:upper:]' '[:lower:]')"
13+
case "$OS" in
14+
linux) OS="linux" ;;
15+
darwin) OS="darwin" ;;
16+
*) echo "Unsupported OS: $OS"; exit 1 ;;
17+
esac
18+
19+
# Detect architecture
20+
ARCH="$(uname -m)"
21+
case "$ARCH" in
22+
x86_64|amd64) ARCH="amd64" ;;
23+
aarch64|arm64) ARCH="arm64" ;;
24+
*) echo "Unsupported architecture: $ARCH"; exit 1 ;;
25+
esac
26+
27+
# Get latest release tag
28+
echo "Finding latest release..."
29+
TAG=$(curl -sSf "https://api.github.com/repos/${REPO}/releases/latest" | grep '"tag_name"' | head -1 | cut -d'"' -f4)
30+
if [ -z "$TAG" ]; then
31+
echo "Error: Could not find latest release. Check https://github.com/${REPO}/releases"
32+
exit 1
33+
fi
34+
echo "Latest version: $TAG"
35+
36+
# Download
37+
ARCHIVE="${BINARY}_${OS}_${ARCH}.tar.gz"
38+
URL="https://github.com/${REPO}/releases/download/${TAG}/${ARCHIVE}"
39+
40+
echo "Downloading ${URL}..."
41+
TMP=$(mktemp -d)
42+
trap 'rm -rf "$TMP"' EXIT
43+
44+
curl -sSfL "$URL" -o "${TMP}/${ARCHIVE}"
45+
tar -xzf "${TMP}/${ARCHIVE}" -C "$TMP"
46+
47+
# Install
48+
if [ -w "$INSTALL_DIR" ]; then
49+
mv "${TMP}/${BINARY}" "${INSTALL_DIR}/${BINARY}"
50+
else
51+
echo "Installing to ${INSTALL_DIR} (requires sudo)..."
52+
sudo mv "${TMP}/${BINARY}" "${INSTALL_DIR}/${BINARY}"
53+
fi
54+
55+
chmod +x "${INSTALL_DIR}/${BINARY}"
56+
57+
echo ""
58+
echo "Installed ${BINARY} ${TAG} to ${INSTALL_DIR}/${BINARY}"
59+
echo ""
60+
echo "Quick start:"
61+
echo " export OPENAI_API_KEY=sk-..."
62+
echo " cd your-project"
63+
echo " codebase"
64+
echo ""
65+
echo "Or use any OpenAI-compatible provider:"
66+
echo " export OPENAI_BASE_URL=https://api.groq.com/openai/v1"
67+
echo " export OPENAI_API_KEY=gsk-..."
68+
echo " export OPENAI_MODEL=llama-3.3-70b-versatile"
69+
echo " codebase"

main.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ import (
99
tea "github.com/charmbracelet/bubbletea"
1010
)
1111

12+
// Set by goreleaser ldflags
13+
var (
14+
version = "dev"
15+
commit = "none"
16+
)
17+
1218
// ──────────────────────────────────────────────────────────────
1319
// Configuration
1420
// ──────────────────────────────────────────────────────────────
@@ -31,8 +37,14 @@ func loadConfig() (*Config, error) {
3137
model := flag.String("model", "", "LLM model name (default: gpt-4o)")
3238
dir := flag.String("dir", "", "Working directory (default: current dir)")
3339
baseURL := flag.String("base-url", "", "OpenAI-compatible API base URL")
40+
showVersion := flag.Bool("version", false, "Print version and exit")
3441
flag.Parse()
3542

43+
if *showVersion {
44+
fmt.Printf("codebase %s (%s)\n", version, commit)
45+
os.Exit(0)
46+
}
47+
3648
cfg := &Config{}
3749

3850
// API key (required)

0 commit comments

Comments
 (0)