detached e7439ba

feat(tui): skip IaC caches (.terraform, .terragrunt-cache, ...) in recursive @-search

Add Terraform/Terragrunt/Pulumi/Serverless/CDK provider and module
caches to the recursive walk skip list. These hold copies of
downloaded providers and generated module trees that would otherwise
dominate the entry budget with non-source files.
commit
e7439baaa6878d1b9c0821c266907254fdad430c
author
Raymond Gasper · · 2026-06-09 19:48 UTC
parent
7ac6034
signature
unsigned
2 files · +42 -0
M packages/agent/modes/file_suggest.go +9 -0
@@ -36,6 +36,15 @@ var recursiveSkipDirs = map[string]bool{
3636 ".idea": true,
3737 ".vscode": true,
3838 "__pycache__": true,
39+ // Infrastructure-as-code provider/module caches. These hold copies
40+ // of downloaded providers and generated module trees and can grow
41+ // to hundreds of MB or deeply nested duplicates of the source.
42+ ".terraform": true,
43+ ".terragrunt-cache": true,
44+ ".terraform.d": true,
45+ ".pulumi": true,
46+ ".serverless": true,
47+ "cdk.out": true,
3948 }
4049
4150 // fileSuggester provides an @-triggered file/directory picker popup.
@@ -36,6 +36,15 @@ var recursiveSkipDirs = map[string]bool{
36 ".idea": true,36 ".idea": true,
37 ".vscode": true,37 ".vscode": true,
38 "__pycache__": true,38 "__pycache__": true,
39+ // Infrastructure-as-code provider/module caches. These hold copies
40+ // of downloaded providers and generated module trees and can grow
41+ // to hundreds of MB or deeply nested duplicates of the source.
42+ ".terraform": true,
43+ ".terragrunt-cache": true,
44+ ".terraform.d": true,
45+ ".pulumi": true,
46+ ".serverless": true,
47+ "cdk.out": true,
39 }48 }
40 49
41 // fileSuggester provides an @-triggered file/directory picker popup.50 // fileSuggester provides an @-triggered file/directory picker popup.
M packages/agent/modes/file_suggest_test.go +33 -0
@@ -171,6 +171,39 @@ func TestFileSuggesterRecursiveSkipsHeavyDirs(t *testing.T) {
171171 }
172172 }
173173
174+// TestFileSuggesterRecursiveSkipsIaCCaches ensures infrastructure-as-
175+// code provider/module caches are pruned so a recursive walk doesn't
176+// drown in copies of downloaded providers or generated modules.
177+func TestFileSuggesterRecursiveSkipsIaCCaches(t *testing.T) {
178+ tmp := t.TempDir()
179+ for _, dir := range []string{".terraform", ".terragrunt-cache", "cdk.out"} {
180+ nested := filepath.Join(tmp, dir, "deep")
181+ if err := os.MkdirAll(nested, 0o755); err != nil {
182+ t.Fatal(err)
183+ }
184+ if err := os.WriteFile(filepath.Join(nested, "junk.tf"), []byte("x"), 0o644); err != nil {
185+ t.Fatal(err)
186+ }
187+ }
188+ if err := os.WriteFile(filepath.Join(tmp, "main.tf"), []byte("x"), 0o644); err != nil {
189+ t.Fatal(err)
190+ }
191+ s := newFileSuggester()
192+ s.SetCWD(tmp)
193+ s.SetRecursive(true)
194+
195+ for _, e := range s.scan() {
196+ for _, skip := range []string{".terraform", ".terragrunt-cache", "cdk.out"} {
197+ if e.rel == skip || strings.HasPrefix(e.rel, skip+string(filepath.Separator)) {
198+ t.Fatalf("recursive scan descended into %s: %#v", skip, e)
199+ }
200+ }
201+ }
202+ if !containsEntry(s.scan(), "main.tf", false) {
203+ t.Fatal("recursive scan missing main.tf")
204+ }
205+}
206+
174207 // TestFileSuggesterToggleResetsCache verifies SetRecursive drops the
175208 // cached scan so the next matches() reflects the new mode.
176209 func TestFileSuggesterToggleResetsCache(t *testing.T) {
@@ -171,6 +171,39 @@ func TestFileSuggesterRecursiveSkipsHeavyDirs(t *testing.T) {
171 }171 }
172 }172 }
173 173
174+// TestFileSuggesterRecursiveSkipsIaCCaches ensures infrastructure-as-
175+// code provider/module caches are pruned so a recursive walk doesn't
176+// drown in copies of downloaded providers or generated modules.
177+func TestFileSuggesterRecursiveSkipsIaCCaches(t *testing.T) {
178+ tmp := t.TempDir()
179+ for _, dir := range []string{".terraform", ".terragrunt-cache", "cdk.out"} {
180+ nested := filepath.Join(tmp, dir, "deep")
181+ if err := os.MkdirAll(nested, 0o755); err != nil {
182+ t.Fatal(err)
183+ }
184+ if err := os.WriteFile(filepath.Join(nested, "junk.tf"), []byte("x"), 0o644); err != nil {
185+ t.Fatal(err)
186+ }
187+ }
188+ if err := os.WriteFile(filepath.Join(tmp, "main.tf"), []byte("x"), 0o644); err != nil {
189+ t.Fatal(err)
190+ }
191+ s := newFileSuggester()
192+ s.SetCWD(tmp)
193+ s.SetRecursive(true)
194+
195+ for _, e := range s.scan() {
196+ for _, skip := range []string{".terraform", ".terragrunt-cache", "cdk.out"} {
197+ if e.rel == skip || strings.HasPrefix(e.rel, skip+string(filepath.Separator)) {
198+ t.Fatalf("recursive scan descended into %s: %#v", skip, e)
199+ }
200+ }
201+ }
202+ if !containsEntry(s.scan(), "main.tf", false) {
203+ t.Fatal("recursive scan missing main.tf")
204+ }
205+}
206+
174 // TestFileSuggesterToggleResetsCache verifies SetRecursive drops the207 // TestFileSuggesterToggleResetsCache verifies SetRecursive drops the
175 // cached scan so the next matches() reflects the new mode.208 // cached scan so the next matches() reflects the new mode.
176 func TestFileSuggesterToggleResetsCache(t *testing.T) {209 func TestFileSuggesterToggleResetsCache(t *testing.T) {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close