You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: prevent plugin from hanging when opened in home directory
Add requireProjectMarker config option (default: true) that checks for
project markers (.git, package.json, Cargo.toml, etc.) before enabling
file watching and auto-indexing. This prevents the plugin from trying
to watch/index large non-project directories like the home directory.
- Add hasProjectMarker() utility to detect project directories
- Guard file watcher and auto-indexing with project marker check
- Log warning when skipping due to missing project marker
- Add tests for hasProjectMarker function
- Update README, AGENTS.md, and TROUBLESHOOTING.md with new option
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -246,7 +246,8 @@ Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-inde
246
246
"semanticOnly": false,
247
247
"autoGc": true,
248
248
"gcIntervalDays": 7,
249
-
"gcOrphanThreshold": 100
249
+
"gcOrphanThreshold": 100,
250
+
"requireProjectMarker": true
250
251
},
251
252
"search": {
252
253
"maxResults": 20,
@@ -279,6 +280,7 @@ Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-inde
279
280
|`autoGc`|`true`| Automatically run garbage collection to remove orphaned embeddings/chunks |
280
281
|`gcIntervalDays`|`7`| Run GC on initialization if last GC was more than N days ago |
281
282
|`gcOrphanThreshold`|`100`| Run GC after indexing if orphan count exceeds this threshold |
283
+
|`requireProjectMarker`|`true`| Require a project marker (`.git`, `package.json`, etc.) to enable file watching and auto-indexing. Prevents accidentally indexing large directories like home. Set to `false` to index any directory. |
282
284
|**search**|||
283
285
|`maxResults`|`20`| Maximum results to return |
284
286
|`minScore`|`0.1`| Minimum similarity score (0-1). Lower = more results |
-[Index Corruption / Stale Results](#index-corruption--stale-results)
@@ -14,6 +15,54 @@ Common issues and solutions for opencode-codebase-index.
14
15
15
16
---
16
17
18
+
## OpenCode Hangs in Home Directory
19
+
20
+
**Symptoms:**
21
+
- OpenCode becomes unresponsive when opened in home directory (`~`)
22
+
- New session starts but nothing happens when typing
23
+
- High CPU or memory usage
24
+
25
+
**Cause:** The plugin's file watcher attempts to watch the entire home directory, which contains hundreds of thousands of files.
26
+
27
+
**Solutions:**
28
+
29
+
### Default Behavior (v0.4.1+)
30
+
The plugin now requires a project marker (`.git`, `package.json`, `Cargo.toml`, etc.) by default. If no marker is found, file watching and auto-indexing are disabled. You'll see this warning:
31
+
```
32
+
[codebase-index] Skipping file watching and auto-indexing: no project marker found
33
+
```
34
+
35
+
### If You Need to Index a Non-Project Directory
36
+
Set `requireProjectMarker` to `false` in your config:
37
+
```json
38
+
{
39
+
"indexing": {
40
+
"requireProjectMarker": false
41
+
}
42
+
}
43
+
```
44
+
45
+
**Warning:** Only do this for specific directories you intend to index. Never disable this for your home directory.
46
+
47
+
### Recognized Project Markers
48
+
The plugin looks for any of these files/directories:
49
+
-`.git`
50
+
-`package.json`
51
+
-`Cargo.toml`
52
+
-`go.mod`
53
+
-`pyproject.toml`
54
+
-`setup.py`
55
+
-`requirements.txt`
56
+
-`Gemfile`
57
+
-`composer.json`
58
+
-`pom.xml`
59
+
-`build.gradle`
60
+
-`CMakeLists.txt`
61
+
-`Makefile`
62
+
-`.opencode`
63
+
64
+
---
65
+
17
66
## No Embedding Provider Available
18
67
19
68
**Error message:**
@@ -342,6 +391,7 @@ If none of these solutions work:
342
391
343
392
| Problem | Quick Fix |
344
393
|---------|-----------|
394
+
| Hangs in home dir | Update to v0.4.1+ (auto-detects non-project dirs) |
345
395
| No provider |`export OPENAI_API_KEY=...` or use Ollama |
346
396
| Rate limited | Switch to Ollama for large codebases |
347
397
| Stale results |`rm -rf .opencode/index/` and re-index |
0 commit comments