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 — add initial git support · strager/opencode@bd2ec29

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .gitignore
  • README.md
  • cmd
    • diff
      • main.go
    • git
      • main.go
    • root.go
  • go.mod
  • go.sum
  • internal
    • assets
      • diff/themes
        • dark.json
      • embed.go
      • write.go
    • git
      • diff.go
    • llm
      • agent
        • agent.go
      • tools
        • bash.go
        • edit.go
        • edit_test.go
        • file.go
        • tools.go
        • write.go
    • tui/components/dialog
      • permission.go
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.gitignore‎

Copy file name to clipboardExpand all lines: .gitignore
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,4 @@ debug.log
4343

4444
.termai
4545

46+
internal/assets/diff/index.mjs
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+13Lines changed: 13 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,26 @@ TermAI is built with a modular architecture:
102102
git clone https://github.com/kujtimiihoxha/termai.git
103103
cd termai
104104

105+
# Build the diff script first
106+
go run cmd/diff/main.go
107+
105108
# Build
106109
go build -o termai
107110

108111
# Run
109112
./termai
110113
```
111114

115+
### Important: Building the Diff Script
116+
117+
Before building or running the application, you must first build the diff script by running:
118+
119+
```bash
120+
go run cmd/diff/main.go
121+
```
122+
123+
This command generates the necessary JavaScript file (`index.mjs`) used by the diff functionality in the application.
124+
112125
## Acknowledgments
113126

114127
TermAI builds upon the work of several open source projects and developers:
Collapse file

‎cmd/diff/main.go‎

Copy file name to clipboard
+102Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
package main
2+
3+
import (
4+
"fmt"
5+
"io"
6+
"os"
7+
"os/exec"
8+
"path/filepath"
9+
)
10+
11+
func main() {
12+
// Create a temporary directory
13+
tempDir, err := os.MkdirTemp("", "git-split-diffs")
14+
if err != nil {
15+
fmt.Printf("Error creating temp directory: %v\n", err)
16+
os.Exit(1)
17+
}
18+
defer func() {
19+
fmt.Printf("Cleaning up temporary directory: %s\n", tempDir)
20+
os.RemoveAll(tempDir)
21+
}()
22+
fmt.Printf("Created temporary directory: %s\n", tempDir)
23+
24+
// Clone the repository with minimum depth
25+
fmt.Println("Cloning git-split-diffs repository with minimum depth...")
26+
cmd := exec.Command("git", "clone", "--depth=1", "https://github.com/kujtimiihoxha/git-split-diffs", tempDir)
27+
cmd.Stdout = os.Stdout
28+
cmd.Stderr = os.Stderr
29+
if err := cmd.Run(); err != nil {
30+
fmt.Printf("Error cloning repository: %v\n", err)
31+
os.Exit(1)
32+
}
33+
34+
// Run npm install
35+
fmt.Println("Running npm install...")
36+
cmdNpmInstall := exec.Command("npm", "install")
37+
cmdNpmInstall.Dir = tempDir
38+
cmdNpmInstall.Stdout = os.Stdout
39+
cmdNpmInstall.Stderr = os.Stderr
40+
if err := cmdNpmInstall.Run(); err != nil {
41+
fmt.Printf("Error running npm install: %v\n", err)
42+
os.Exit(1)
43+
}
44+
45+
// Run npm run build
46+
fmt.Println("Running npm run build...")
47+
cmdNpmBuild := exec.Command("npm", "run", "build")
48+
cmdNpmBuild.Dir = tempDir
49+
cmdNpmBuild.Stdout = os.Stdout
50+
cmdNpmBuild.Stderr = os.Stderr
51+
if err := cmdNpmBuild.Run(); err != nil {
52+
fmt.Printf("Error running npm run build: %v\n", err)
53+
os.Exit(1)
54+
}
55+
56+
destDir := filepath.Join(".", "internal", "assets", "diff")
57+
destFile := filepath.Join(destDir, "index.mjs")
58+
59+
// Make sure the destination directory exists
60+
if err := os.MkdirAll(destDir, 0o755); err != nil {
61+
fmt.Printf("Error creating destination directory: %v\n", err)
62+
os.Exit(1)
63+
}
64+
65+
// Copy the file
66+
srcFile := filepath.Join(tempDir, "build", "index.mjs")
67+
fmt.Printf("Copying %s to %s\n", srcFile, destFile)
68+
if err := copyFile(srcFile, destFile); err != nil {
69+
fmt.Printf("Error copying file: %v\n", err)
70+
os.Exit(1)
71+
}
72+
73+
fmt.Println("Successfully completed the process!")
74+
}
75+
76+
// copyFile copies a file from src to dst
77+
func copyFile(src, dst string) error {
78+
sourceFile, err := os.Open(src)
79+
if err != nil {
80+
return err
81+
}
82+
defer sourceFile.Close()
83+
84+
destFile, err := os.Create(dst)
85+
if err != nil {
86+
return err
87+
}
88+
defer destFile.Close()
89+
90+
_, err = io.Copy(destFile, sourceFile)
91+
if err != nil {
92+
return err
93+
}
94+
95+
// Make sure the file is written to disk
96+
err = destFile.Sync()
97+
if err != nil {
98+
return err
99+
}
100+
101+
return nil
102+
}
Collapse file

‎cmd/git/main.go‎

Copy file name to clipboard
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
package main
2+
3+
func main() {
4+
}
Collapse file

‎cmd/root.go‎

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

99
tea "github.com/charmbracelet/bubbletea"
1010
"github.com/kujtimiihoxha/termai/internal/app"
11+
"github.com/kujtimiihoxha/termai/internal/assets"
1112
"github.com/kujtimiihoxha/termai/internal/config"
1213
"github.com/kujtimiihoxha/termai/internal/db"
1314
"github.com/kujtimiihoxha/termai/internal/llm/agent"
@@ -28,6 +29,9 @@ var rootCmd = &cobra.Command{
2829
}
2930
debug, _ := cmd.Flags().GetBool("debug")
3031
err := config.Load(debug)
32+
if err != nil {
33+
return err
34+
}
3135
cfg := config.Get()
3236
defaultLevel := slog.LevelInfo
3337
if cfg.Debug {
@@ -38,9 +42,11 @@ var rootCmd = &cobra.Command{
3842
}))
3943
slog.SetDefault(logger)
4044

45+
err = assets.WriteAssets()
4146
if err != nil {
4247
return err
4348
}
49+
4450
conn, err := db.Connect()
4551
if err != nil {
4652
return err
Collapse file

‎go.mod‎

Copy file name to clipboardExpand all lines: go.mod
+16-4Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ require (
1717
github.com/charmbracelet/lipgloss v1.1.0
1818
github.com/charmbracelet/x/ansi v0.8.0
1919
github.com/fsnotify/fsnotify v1.8.0
20+
github.com/go-git/go-git/v5 v5.15.0
2021
github.com/go-logfmt/logfmt v0.6.0
2122
github.com/golang-migrate/migrate/v4 v4.18.2
2223
github.com/google/generative-ai-go v0.19.0
@@ -45,6 +46,9 @@ require (
4546
cloud.google.com/go/auth/oauth2adapt v0.2.6 // indirect
4647
cloud.google.com/go/compute/metadata v0.6.0 // indirect
4748
cloud.google.com/go/longrunning v0.5.7 // indirect
49+
dario.cat/mergo v1.0.0 // indirect
50+
github.com/Microsoft/go-winio v0.6.2 // indirect
51+
github.com/ProtonMail/go-crypto v1.1.6 // indirect
4852
github.com/alecthomas/chroma/v2 v2.15.0 // indirect
4953
github.com/andybalholm/cascadia v1.3.2 // indirect
5054
github.com/atotto/clipboard v0.1.4 // indirect
@@ -68,34 +72,42 @@ require (
6872
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd // indirect
6973
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
7074
github.com/charmbracelet/x/term v0.2.1 // indirect
75+
github.com/cloudflare/circl v1.6.1 // indirect
76+
github.com/cyphar/filepath-securejoin v0.4.1 // indirect
7177
github.com/davecgh/go-spew v1.1.1 // indirect
7278
github.com/dlclark/regexp2 v1.11.4 // indirect
7379
github.com/dustin/go-humanize v1.0.1 // indirect
80+
github.com/emirpasic/gods v1.18.1 // indirect
7481
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
7582
github.com/felixge/httpsnoop v1.0.4 // indirect
83+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
84+
github.com/go-git/go-billy/v5 v5.6.2 // indirect
7685
github.com/go-logr/logr v1.4.2 // indirect
7786
github.com/go-logr/stdr v1.2.2 // indirect
7887
github.com/go-viper/mapstructure/v2 v2.2.1 // indirect
79-
github.com/google/go-cmp v0.7.0 // indirect
88+
github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect
8089
github.com/google/s2a-go v0.1.8 // indirect
8190
github.com/googleapis/enterprise-certificate-proxy v0.3.4 // indirect
8291
github.com/googleapis/gax-go/v2 v2.14.1 // indirect
8392
github.com/gorilla/css v1.0.1 // indirect
8493
github.com/hashicorp/errwrap v1.1.0 // indirect
8594
github.com/hashicorp/go-multierror v1.1.1 // indirect
8695
github.com/inconshreveable/mousetrap v1.1.0 // indirect
96+
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
97+
github.com/kevinburke/ssh_config v1.2.0 // indirect
8798
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
8899
github.com/mattn/go-isatty v0.0.20 // indirect
89100
github.com/mattn/go-localereader v0.0.1 // indirect
90101
github.com/microcosm-cc/bluemonday v1.0.27 // indirect
91102
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
92103
github.com/muesli/cancelreader v0.2.2 // indirect
93104
github.com/pelletier/go-toml/v2 v2.2.3 // indirect
105+
github.com/pjbgf/sha1cd v0.3.2 // indirect
94106
github.com/pmezard/go-difflib v1.0.0 // indirect
95107
github.com/rivo/uniseg v0.4.7 // indirect
96-
github.com/rogpeppe/go-internal v1.14.1 // indirect
97108
github.com/sagikazarmark/locafero v0.7.0 // indirect
98109
github.com/sahilm/fuzzy v0.1.1 // indirect
110+
github.com/skeema/knownhosts v1.3.1 // indirect
99111
github.com/sourcegraph/conc v0.3.0 // indirect
100112
github.com/spf13/afero v1.12.0 // indirect
101113
github.com/spf13/cast v1.7.1 // indirect
@@ -105,6 +117,7 @@ require (
105117
github.com/tidwall/match v1.1.1 // indirect
106118
github.com/tidwall/pretty v1.2.1 // indirect
107119
github.com/tidwall/sjson v1.2.5 // indirect
120+
github.com/xanzy/ssh-agent v0.3.3 // indirect
108121
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
109122
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
110123
github.com/yuin/goldmark v1.7.8 // indirect
@@ -118,7 +131,6 @@ require (
118131
go.uber.org/multierr v1.9.0 // indirect
119132
golang.design/x/clipboard v0.7.0 // indirect
120133
golang.org/x/crypto v0.37.0 // indirect
121-
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
122134
golang.org/x/exp/shiny v0.0.0-20250305212735-054e65f0b394 // indirect
123135
golang.org/x/image v0.14.0 // indirect
124136
golang.org/x/mobile v0.0.0-20231127183840-76ac6878050a // indirect
@@ -132,6 +144,6 @@ require (
132144
google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect
133145
google.golang.org/grpc v1.67.3 // indirect
134146
google.golang.org/protobuf v1.36.1 // indirect
135-
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
147+
gopkg.in/warnings.v0 v0.1.2 // indirect
136148
gopkg.in/yaml.v3 v3.0.1 // indirect
137149
)

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.