Skip to content
This repository was archived by the owner on May 20, 2026. It is now read-only.

Commit 46dd45a

Browse files
committed
Fixed Go
1 parent 820f5df commit 46dd45a

3 files changed

Lines changed: 123 additions & 9 deletions

File tree

go.mod

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,11 @@ require modernc.org/sqlite v1.34.5
77
require (
88
github.com/dustin/go-humanize v1.0.1 // indirect
99
github.com/google/uuid v1.6.0 // indirect
10-
github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect
1110
github.com/mattn/go-isatty v0.0.20 // indirect
1211
github.com/ncruces/go-strftime v0.1.9 // indirect
1312
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
14-
golang.org/x/exp v0.0.0-20241108190413-2d47ceb2692f // indirect
15-
golang.org/x/sys v0.28.0 // indirect
16-
modernc.org/gc/v3 v3.0.0-20241004144649-1bbe3f2e0e17 // indirect
17-
modernc.org/libc v1.61.6 // indirect
18-
modernc.org/mathutil v1.7.1 // indirect
19-
modernc.org/memory v1.8.1 // indirect
20-
modernc.org/strutil v1.2.1 // indirect
21-
modernc.org/token v1.1.0 // indirect
13+
golang.org/x/sys v0.22.0 // indirect
14+
modernc.org/libc v1.55.3 // indirect
15+
modernc.org/mathutil v1.6.0 // indirect
16+
modernc.org/memory v1.8.0 // indirect
2217
)

go.sum

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
2+
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
3+
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd h1:gbpYu9NMq8jhDVbvlGkMFWCjLFlqqEZjEmObmhUy6Vo=
4+
github.com/google/pprof v0.0.0-20240409012703-83162a5b38cd/go.mod h1:kf6iHlnVGwgKolg33glAes7Yg/8iWP8ukqeldJSO7jw=
5+
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
6+
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
7+
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
8+
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
9+
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
10+
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
11+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
12+
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
13+
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
14+
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
15+
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
16+
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
17+
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
18+
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
19+
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
20+
modernc.org/cc/v4 v4.21.4 h1:3Be/Rdo1fpr8GrQ7IVw9OHtplU4gWbb+wNgeoBMmGLQ=
21+
modernc.org/cc/v4 v4.21.4/go.mod h1:HM7VJTZbUCR3rV8EYBi9wxnJ0ZBRiGE5OeGXNA0IsLQ=
22+
modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y=
23+
modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s=
24+
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
25+
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
26+
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
27+
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
28+
modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
29+
modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
30+
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
31+
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
32+
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
33+
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
34+
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
35+
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
36+
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
37+
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
38+
modernc.org/sqlite v1.34.5 h1:Bb6SR13/fjp15jt70CL4f18JIN7p7dnMExd+UFnF15g=
39+
modernc.org/sqlite v1.34.5/go.mod h1:YLuNmX9NKs8wRNK2ko1LW1NGYcc9FkBO69JOt1AR9JE=
40+
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
41+
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
42+
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
43+
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=

paths.go

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"runtime"
88
"sort"
99
"strings"
10+
"time"
1011
)
1112

1213
// Paths holds all the filesystem paths Antigravity uses
@@ -91,3 +92,78 @@ func discoverConversations(dir string) ([]ConvFile, error) {
9192
})
9293
return convs, nil
9394
}
95+
96+
// AnnotationStats holds annotation health info
97+
type AnnotationStats struct {
98+
Ghosts int
99+
Orphans int
100+
OrphanIDs []string
101+
}
102+
103+
func checkAnnotations(annDir string, convs []ConvFile) AnnotationStats {
104+
stats := AnnotationStats{}
105+
if annDir == "" {
106+
return stats
107+
}
108+
annIDs := map[string]bool{}
109+
files, err := os.ReadDir(annDir)
110+
if err != nil {
111+
return stats
112+
}
113+
for _, f := range files {
114+
if strings.HasSuffix(f.Name(), ".pbtxt") {
115+
annIDs[strings.TrimSuffix(f.Name(), ".pbtxt")] = true
116+
}
117+
}
118+
convIDs := map[string]bool{}
119+
for _, c := range convs {
120+
convIDs[c.ID] = true
121+
}
122+
for id := range annIDs {
123+
if !convIDs[id] {
124+
stats.Ghosts++
125+
}
126+
}
127+
for id := range convIDs {
128+
if !annIDs[id] {
129+
stats.Orphans++
130+
stats.OrphanIDs = append(stats.OrphanIDs, id)
131+
}
132+
}
133+
return stats
134+
}
135+
136+
func cleanTempFiles(dir string) int {
137+
files, _ := os.ReadDir(dir)
138+
cleaned := 0
139+
for _, f := range files {
140+
if strings.HasSuffix(f.Name(), ".tmp") {
141+
os.Remove(filepath.Join(dir, f.Name()))
142+
cleaned++
143+
}
144+
}
145+
return cleaned
146+
}
147+
148+
func createMissingAnnotations(annDir string, orphanIDs []string, convDir string) int {
149+
if annDir == "" {
150+
return 0
151+
}
152+
created := 0
153+
for _, id := range orphanIDs {
154+
path := filepath.Join(annDir, id+".pbtxt")
155+
if _, err := os.Stat(path); err == nil {
156+
continue
157+
}
158+
pbPath := filepath.Join(convDir, id+".pb")
159+
info, err := os.Stat(pbPath)
160+
mtime := time.Now()
161+
if err == nil {
162+
mtime = info.ModTime()
163+
}
164+
content := fmt.Sprintf("last_user_view_time:{seconds:%d nanos:0}\n", mtime.Unix())
165+
os.WriteFile(path, []byte(content), 0644)
166+
created++
167+
}
168+
return created
169+
}

0 commit comments

Comments
 (0)