GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — rework llm · kozer/opencode@afd9ad0

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .gitignore
  • README.md
  • cmd
    • root.go
  • go.mod
  • go.sum
  • internal
    • app
      • services.go
    • config
      • config.go
      • config_test.go
    • db
      • connect.go
      • db.go
      • messages.sql.go
      • migrations
        • 000001_initial.up.sql
      • models.go
      • querier.go
      • sessions.sql.go
      • sql
        • messages.sql
        • sessions.sql
    • llm
      • agent
        • agent-tool.go
        • agent.go
        • coder.go
        • mcp-tools.go
        • task.go
        • title.go
      • llm.go
      • models
        • models.go
      • prompt
        • coder.go
        • task.go
        • title.go
      • provider
        • anthropic.go
        • gemini.go
        • openai.go
        • provider.go
      • tools
        • agent.go
        • bash.go
        • bash_test.go
        • edit.go
        • glob.go
        • grep.go
        • ls.go
        • ls_test.go
        • shell
          • shell.go
        • tools.go
        • view.go
        • write.go
        • write_test.go
    • message
      • message.go
    • permission
      • permission.go
    • session
      • session.go
    • tui
      • components
        • core
          • dialog.go
          • status.go
        • dialog
          • permission.go
          • quit.go
        • messages
          • message.go
        • repl
          • editor.go
          • messages.go
          • sessions.go
      • page
        • init.go
      • styles
        • icons.go
        • markdown.go
        • styles.go
      • tui.go

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.gitignore‎

Copy file name to clipboardExpand all lines: .gitignore
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ debug.log
4242
.env.local
4343

4444
.termai
45+
46+
.termai.json
Collapse file

‎README.md‎

Copy file name to clipboard
+94-7Lines changed: 94 additions & 7 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,100 @@
11
# TermAI
22

3-
**⚠️ WORK IN PROGRESS ⚠️**
3+
A powerful terminal-based AI assistant for developers, providing intelligent coding assistance directly in your terminal.
44

5-
This project is currently under active development.
5+
[![TermAI Demo](https://asciinema.org/a/dtc4nJyGSZX79HRUmFLY3gmoy.svg)](https://asciinema.org/a/dtc4nJyGSZX79HRUmFLY3gmoy)
66

7-
## Current Progress
7+
## Overview
88

9-
- Initial CLI setup
10-
- Basic functionality implementation
11-
- Working on core features
9+
TermAI is a Go-based CLI application that brings AI assistance to your terminal. It provides a TUI (Terminal User Interface) for interacting with various AI models to help with coding tasks, debugging, and more.
1210

13-
More details coming soon.
11+
## Features
12+
13+
- **Interactive TUI**: Built with [Bubble Tea](https://github.com/charmbracelet/bubbletea) for a smooth terminal experience
14+
- **Multiple AI Providers**: Support for OpenAI, Anthropic Claude, and Google Gemini models
15+
- **Session Management**: Save and manage multiple conversation sessions
16+
- **Tool Integration**: AI can execute commands, search files, and modify code
17+
- **Vim-like Editor**: Integrated editor with Vim keybindings for text input
18+
- **Persistent Storage**: SQLite database for storing conversations and sessions
19+
20+
## Installation
21+
22+
```bash
23+
# Coming soon
24+
go install github.com/kujtimiihoxha/termai@latest
25+
```
26+
27+
## Configuration
28+
29+
TermAI looks for configuration in the following locations:
30+
31+
- `$HOME/.termai.json`
32+
- `$XDG_CONFIG_HOME/termai/.termai.json`
33+
- `./.termai.json` (local directory)
34+
35+
You can also use environment variables:
36+
37+
- `ANTHROPIC_API_KEY`: For Claude models
38+
- `OPENAI_API_KEY`: For OpenAI models
39+
- `GEMINI_API_KEY`: For Google Gemini models
40+
41+
## Usage
42+
43+
```bash
44+
# Start TermAI
45+
termai
46+
47+
# Start with debug logging
48+
termai -d
49+
```
50+
51+
### Keyboard Shortcuts
52+
53+
- `L`: View logs
54+
- `N`: Create new session
55+
- `Esc`: Close current view
56+
- `Backspace`: Go back
57+
- `Ctrl+C` or `q`: Quit
58+
- `?`: Toggle help
59+
60+
## Architecture
61+
62+
TermAI is built with a modular architecture:
63+
64+
- **cmd**: Command-line interface using Cobra
65+
- **internal/app**: Core application services
66+
- **internal/config**: Configuration management
67+
- **internal/db**: Database operations and migrations
68+
- **internal/llm**: LLM providers and tools integration
69+
- **internal/tui**: Terminal UI components and layouts
70+
- **internal/logging**: Logging infrastructure
71+
- **internal/message**: Message handling
72+
- **internal/session**: Session management
73+
74+
## Development
75+
76+
### Prerequisites
77+
78+
- Go 1.23.5 or higher
79+
80+
### Building from Source
81+
82+
```bash
83+
# Clone the repository
84+
git clone https://github.com/kujtimiihoxha/termai.git
85+
cd termai
86+
87+
# Build
88+
go build -o termai
89+
90+
# Run
91+
./termai
92+
```
93+
94+
## License
95+
96+
[License information coming soon]
97+
98+
## Contributing
99+
100+
[Contribution guidelines coming soon]
Collapse file

‎cmd/root.go‎

Copy file name to clipboardExpand all lines: cmd/root.go
+7-49Lines changed: 7 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ import (
77

88
tea "github.com/charmbracelet/bubbletea"
99
"github.com/kujtimiihoxha/termai/internal/app"
10+
"github.com/kujtimiihoxha/termai/internal/config"
1011
"github.com/kujtimiihoxha/termai/internal/db"
11-
"github.com/kujtimiihoxha/termai/internal/llm/models"
12+
"github.com/kujtimiihoxha/termai/internal/llm/agent"
1213
"github.com/kujtimiihoxha/termai/internal/tui"
1314
zone "github.com/lrstanley/bubblezone"
1415
"github.com/spf13/cobra"
15-
"github.com/spf13/viper"
1616
)
1717

1818
var rootCmd = &cobra.Command{
@@ -25,11 +25,10 @@ var rootCmd = &cobra.Command{
2525
return nil
2626
}
2727
debug, _ := cmd.Flags().GetBool("debug")
28-
viper.Set("debug", debug)
29-
if debug {
30-
viper.Set("log.level", "debug")
28+
err := config.Load(debug)
29+
if err != nil {
30+
return err
3131
}
32-
3332
conn, err := db.Connect()
3433
if err != nil {
3534
return err
@@ -49,6 +48,8 @@ var rootCmd = &cobra.Command{
4948
defer unsub()
5049

5150
go func() {
51+
// Set this up once
52+
agent.GetMcpTools(ctx)
5253
for msg := range ch {
5354
tui.Send(msg)
5455
}
@@ -95,16 +96,6 @@ func setupSubscriptions(app *app.App) (chan tea.Msg, func()) {
9596
wg.Done()
9697
}()
9798
}
98-
{
99-
sub := app.LLM.Subscribe(ctx)
100-
wg.Add(1)
101-
go func() {
102-
for ev := range sub {
103-
ch <- ev
104-
}
105-
wg.Done()
106-
}()
107-
}
10899
{
109100
sub := app.Permissions.Subscribe(ctx)
110101
wg.Add(1)
@@ -129,40 +120,7 @@ func Execute() {
129120
}
130121
}
131122

132-
func loadConfig() {
133-
viper.SetConfigName(".termai")
134-
viper.SetConfigType("yaml")
135-
viper.AddConfigPath("$HOME")
136-
viper.AddConfigPath("$XDG_CONFIG_HOME/termai")
137-
viper.AddConfigPath(".")
138-
viper.SetEnvPrefix("TERMAI")
139-
// SET DEFAULTS
140-
viper.SetDefault("log.level", "info")
141-
viper.SetDefault("data.dir", ".termai")
142-
143-
// LLM
144-
viper.SetDefault("models.big", string(models.DefaultBigModel))
145-
viper.SetDefault("models.small", string(models.DefaultLittleModel))
146-
147-
viper.SetDefault("providers.openai.key", os.Getenv("OPENAI_API_KEY"))
148-
viper.SetDefault("providers.anthropic.key", os.Getenv("ANTHROPIC_API_KEY"))
149-
viper.SetDefault("providers.groq.key", os.Getenv("GROQ_API_KEY"))
150-
viper.SetDefault("providers.common.max_tokens", 4000)
151-
152-
viper.SetDefault("agents.default", "coder")
153-
154-
viper.ReadInConfig()
155-
156-
workdir, err := os.Getwd()
157-
if err != nil {
158-
panic(err)
159-
}
160-
viper.Set("wd", workdir)
161-
}
162-
163123
func init() {
164-
loadConfig()
165-
166124
rootCmd.Flags().BoolP("help", "h", false, "Help")
167125
rootCmd.Flags().BoolP("debug", "d", false, "Help")
168126
}
Collapse file

‎go.mod‎

Copy file name to clipboardExpand all lines: go.mod
+39-47Lines changed: 39 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -3,99 +3,78 @@ module github.com/kujtimiihoxha/termai
33
go 1.23.5
44

55
require (
6+
github.com/anthropics/anthropic-sdk-go v0.2.0-beta.2
67
github.com/bmatcuk/doublestar/v4 v4.8.1
78
github.com/catppuccin/go v0.3.0
89
github.com/charmbracelet/bubbles v0.20.0
910
github.com/charmbracelet/bubbletea v1.3.4
1011
github.com/charmbracelet/glamour v0.9.1
1112
github.com/charmbracelet/huh v0.6.0
1213
github.com/charmbracelet/lipgloss v1.1.0
13-
github.com/cloudwego/eino v0.3.17
14-
github.com/cloudwego/eino-ext/components/model/claude v0.0.0-20250320062631-616205c32186
15-
github.com/cloudwego/eino-ext/components/model/openai v0.0.0-20250320062631-616205c32186
1614
github.com/go-logfmt/logfmt v0.6.0
1715
github.com/golang-migrate/migrate/v4 v4.18.2
16+
github.com/google/generative-ai-go v0.19.0
1817
github.com/google/uuid v1.6.0
19-
github.com/kujtimiihoxha/vimtea v0.0.3-0.20250317175717-9d8ba9c69840
18+
github.com/kujtimiihoxha/vimtea v0.0.3-0.20250329221256-a250e98498f9
2019
github.com/lrstanley/bubblezone v0.0.0-20250315020633-c249a3fe1231
20+
github.com/mark3labs/mcp-go v0.17.0
2121
github.com/mattn/go-runewidth v0.0.16
2222
github.com/mattn/go-sqlite3 v1.14.24
2323
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6
2424
github.com/muesli/reflow v0.3.0
2525
github.com/muesli/termenv v0.16.0
26+
github.com/openai/openai-go v0.1.0-beta.2
2627
github.com/sergi/go-diff v1.3.1
2728
github.com/spf13/cobra v1.9.1
2829
github.com/spf13/viper v1.20.0
30+
github.com/stretchr/testify v1.10.0
2931
golang.org/x/exp v0.0.0-20230713183714-613f0c0eb8a1
32+
google.golang.org/api v0.215.0
3033
)
3134

3235
require (
36+
cloud.google.com/go v0.116.0 // indirect
37+
cloud.google.com/go/ai v0.8.0 // indirect
38+
cloud.google.com/go/auth v0.13.0 // indirect
39+
cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect
40+
cloud.google.com/go/compute/metadata v0.6.0 // indirect
41+
cloud.google.com/go/longrunning v0.5.7 // indirect
3342
github.com/alecthomas/chroma/v2 v2.15.0 // indirect
34-
github.com/anthropics/anthropic-sdk-go v0.2.0-alpha.8 // indirect
3543
github.com/atotto/clipboard v0.1.4 // indirect
36-
github.com/aws/aws-sdk-go-v2 v1.33.0 // indirect
37-
github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.6.3 // indirect
38-
github.com/aws/aws-sdk-go-v2/config v1.29.1 // indirect
39-
github.com/aws/aws-sdk-go-v2/credentials v1.17.54 // indirect
40-
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.24 // indirect
41-
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.28 // indirect
42-
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.28 // indirect
43-
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect
44-
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect
45-
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.9 // indirect
46-
github.com/aws/aws-sdk-go-v2/service/sso v1.24.11 // indirect
47-
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.10 // indirect
48-
github.com/aws/aws-sdk-go-v2/service/sts v1.33.9 // indirect
49-
github.com/aws/smithy-go v1.22.1 // indirect
5044
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
5145
github.com/aymerick/douceur v0.2.0 // indirect
52-
github.com/bytedance/sonic v1.12.2 // indirect
53-
github.com/bytedance/sonic/loader v0.2.0 // indirect
5446
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
5547
github.com/charmbracelet/x/ansi v0.8.0 // indirect
5648
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
5749
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
5850
github.com/charmbracelet/x/term v0.2.1 // indirect
59-
github.com/cloudwego/base64x v0.1.4 // indirect
60-
github.com/cloudwego/eino-ext/libs/acl/openai v0.0.0-20250305023926-469de0301955 // indirect
61-
github.com/cloudwego/iasm v0.2.0 // indirect
51+
github.com/davecgh/go-spew v1.1.1 // indirect
6252
github.com/dlclark/regexp2 v1.11.4 // indirect
6353
github.com/dustin/go-humanize v1.0.1 // indirect
6454
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
55+
github.com/felixge/httpsnoop v1.0.4 // indirect
6556
github.com/fsnotify/fsnotify v1.8.0 // indirect
66-
github.com/getkin/kin-openapi v0.118.0 // indirect
67-
github.com/go-openapi/jsonpointer v0.19.5 // indirect
68-
github.com/go-openapi/swag v0.19.5 // indirect
57+
github.com/go-logr/logr v1.4.2 // indirect
58+
github.com/go-logr/stdr v1.2.2 // indirect
6959
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
70-
github.com/goph/emperror v0.17.2 // indirect
60+
github.com/google/s2a-go v0.1.8 // indirect
61+
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
62+
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
7163
github.com/gorilla/css v1.0.1 // indirect
7264
github.com/hashicorp/errwrap v1.1.0 // indirect
7365
github.com/hashicorp/go-multierror v1.1.1 // indirect
7466
github.com/inconshreveable/mousetrap v1.1.0 // indirect
75-
github.com/invopop/yaml v0.1.0 // indirect
76-
github.com/josharian/intern v1.0.0 // indirect
77-
github.com/json-iterator/go v1.1.12 // indirect
78-
github.com/klauspost/cpuid/v2 v2.0.9 // indirect
7967
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
80-
github.com/mailru/easyjson v0.7.7 // indirect
8168
github.com/mattn/go-isatty v0.0.20 // indirect
8269
github.com/mattn/go-localereader v0.0.1 // indirect
8370
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
8471
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
85-
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
86-
github.com/modern-go/reflect2 v1.0.2 // indirect
87-
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
8872
github.com/muesli/cancelreader v0.2.2 // indirect
89-
github.com/nikolalohinski/gonja v1.5.3 // indirect
9073
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
91-
github.com/perimeterx/marshmallow v1.1.4 // indirect
92-
github.com/pkg/errors v0.9.1 // indirect
74+
github.com/pmezard/go-difflib v1.0.0 // indirect
9375
github.com/rivo/uniseg v0.4.7 // indirect
9476
github.com/sagikazarmark/locafero v0.7.0 // indirect
9577
github.com/sahilm/fuzzy v0.1.1 // indirect
96-
github.com/sashabaranov/go-openai v1.32.5 // indirect
97-
github.com/sirupsen/logrus v1.9.3 // indirect
98-
github.com/slongfield/pyfmt v0.0.0-20220222012616-ea85ff4c361f // indirect
9978
github.com/sourcegraph/conc v0.3.0 // indirect
10079
github.com/spf13/afero v1.12.0 // indirect
10180
github.com/spf13/cast v1.7.1 // indirect
@@ -105,19 +84,32 @@ require (
10584
github.com/tidwall/match v1.1.1 // indirect
10685
github.com/tidwall/pretty v1.2.1 // indirect
10786
github.com/tidwall/sjson v1.2.5 // indirect
108-
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
10987
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
110-
github.com/yargevad/filepathx v1.0.0 // indirect
88+
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
11189
github.com/yuin/goldmark v1.7.8 // indirect
11290
github.com/yuin/goldmark-emoji v1.0.5 // indirect
91+
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.54.0 // indirect
92+
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.54.0 // indirect
93+
go.opentelemetry.io/otel v1.29.0 // indirect
94+
go.opentelemetry.io/otel/metric v1.29.0 // indirect
95+
go.opentelemetry.io/otel/trace v1.29.0 // indirect
11396
go.uber.org/atomic v1.9.0 // indirect
11497
go.uber.org/multierr v1.9.0 // indirect
115-
golang.org/x/arch v0.11.0 // indirect
116-
golang.org/x/net v0.33.0 // indirect
98+
golang.design/x/clipboard v0.7.0 // indirect
99+
golang.org/x/crypto v0.33.0 // indirect
100+
golang.org/x/exp/shiny v0.0.0-20250305212735-054e65f0b394 // indirect
101+
golang.org/x/image v0.14.0 // indirect
102+
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect
103+
golang.org/x/net v0.34.0 // indirect
104+
golang.org/x/oauth2 v0.25.0 // indirect
117105
golang.org/x/sync v0.12.0 // indirect
118106
golang.org/x/sys v0.31.0 // indirect
119107
golang.org/x/term v0.30.0 // indirect
120108
golang.org/x/text v0.23.0 // indirect
121-
gopkg.in/yaml.v2 v2.4.0 // indirect
109+
golang.org/x/time v0.8.0 // indirect
110+
google.golang.org/genproto/googleapis/api v0.0.0-20241209162323-e6fa225c2576 // indirect
111+
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
112+
google.golang.org/grpc v1.67.3 // indirect
113+
google.golang.org/protobuf v1.36.1 // indirect
122114
gopkg.in/yaml.v3 v3.0.1 // indirect
123115
)

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.