opencode-codebase-index 0.2.5 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-codebase-index",
3
- "version": "0.2.5",
3
+ "version": "0.3.0",
4
4
  "description": "Semantic codebase indexing and search for OpenCode - find code by meaning, not just keywords",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
package/skill/SKILL.md CHANGED
@@ -32,6 +32,10 @@ Find code by describing what it does in natural language.
32
32
  **Parameters:**
33
33
  - `query` (required): Natural language description
34
34
  - `limit` (optional): Maximum results (default: 10)
35
+ - `chunkType` (optional): Filter by code type
36
+ - `directory` (optional): Filter by directory path
37
+ - `fileType` (optional): Filter by file extension
38
+ - `contextLines` (optional): Extra lines before/after each match
35
39
 
36
40
  **Returns:** Focused list of 5-10 most relevant files/chunks with scores.
37
41
 
@@ -41,6 +45,7 @@ Create or update the semantic index. Required before first search.
41
45
  **Parameters:**
42
46
  - `force` (optional): Reindex from scratch (default: false)
43
47
  - `estimateOnly` (optional): Show cost estimate without indexing
48
+ - `verbose` (optional): Show skipped files and parse failures
44
49
 
45
50
  **Note:** Incremental indexing is fast (~50ms) when files haven't changed.
46
51
 
@@ -48,7 +53,89 @@ Create or update the semantic index. Required before first search.
48
53
  Check if the codebase is indexed and ready for search.
49
54
 
50
55
  ### `index_health_check`
51
- Remove stale entries from deleted files.
56
+ Remove stale entries from deleted files and orphaned embeddings.
57
+
58
+ ## Search Filters
59
+
60
+ ### Filter by Chunk Type (`chunkType`)
61
+
62
+ Narrow results to specific code constructs:
63
+
64
+ | Value | Finds |
65
+ |-------|-------|
66
+ | `function` | Functions, arrow functions |
67
+ | `class` | Class definitions |
68
+ | `method` | Class methods |
69
+ | `interface` | TypeScript interfaces |
70
+ | `type` | Type aliases |
71
+ | `enum` | Enumerations |
72
+ | `struct` | Rust/Go structs |
73
+ | `impl` | Rust impl blocks |
74
+ | `trait` | Rust traits |
75
+ | `module` | Module definitions |
76
+
77
+ **Examples:**
78
+ ```
79
+ codebase_search(query="validation logic", chunkType="function")
80
+ codebase_search(query="data models", chunkType="interface")
81
+ codebase_search(query="user entity", chunkType="class")
82
+ ```
83
+
84
+ ### Filter by Directory (`directory`)
85
+
86
+ Scope search to specific paths:
87
+
88
+ ```
89
+ codebase_search(query="API routes", directory="src/api")
90
+ codebase_search(query="test helpers", directory="tests")
91
+ codebase_search(query="database queries", directory="src/db")
92
+ ```
93
+
94
+ ### Filter by File Type (`fileType`)
95
+
96
+ Limit to specific languages:
97
+
98
+ ```
99
+ codebase_search(query="config parsing", fileType="ts")
100
+ codebase_search(query="build scripts", fileType="py")
101
+ codebase_search(query="data structures", fileType="rs")
102
+ ```
103
+
104
+ ### Combining Filters
105
+
106
+ Filters can be combined for precise results:
107
+
108
+ ```
109
+ codebase_search(
110
+ query="validation",
111
+ chunkType="function",
112
+ directory="src/utils",
113
+ fileType="ts"
114
+ )
115
+ ```
116
+
117
+ ## Hybrid Weight Tuning
118
+
119
+ The `hybridWeight` config option (0.0-1.0) balances semantic vs keyword search:
120
+
121
+ | Value | Behavior | Best For |
122
+ |-------|----------|----------|
123
+ | `0.0` | Pure semantic | Conceptual queries, unfamiliar code |
124
+ | `0.5` | Balanced (default) | General use |
125
+ | `1.0` | Pure keyword (BM25) | When you know specific terms |
126
+
127
+ Configure in `.opencode/codebase-index.json`:
128
+ ```json
129
+ {
130
+ "search": {
131
+ "hybridWeight": 0.3
132
+ }
133
+ }
134
+ ```
135
+
136
+ **When to adjust:**
137
+ - Lower (0.2-0.4): Exploratory queries, finding related code
138
+ - Higher (0.6-0.8): When query contains specific identifiers
52
139
 
53
140
  ## Query Writing Tips
54
141
 
@@ -75,6 +162,13 @@ Bad: "401" (literal keyword, use grep)
75
162
  5. grep "SessionStore" → once you know the class name
76
163
  ```
77
164
 
165
+ ### Finding all functions in a module
166
+ ```
167
+ 1. codebase_search(query="utility helpers", directory="src/utils", chunkType="function")
168
+ 2. Review results to understand available utilities
169
+ 3. grep specific function name for all usages
170
+ ```
171
+
78
172
  ### Finding implementation for a feature
79
173
  ```
80
174
  1. codebase_search("image upload and processing") → find relevant files
@@ -89,3 +183,9 @@ Bad: "401" (literal keyword, use grep)
89
183
  2. codebase_search("retry logic for API calls") → find retry mechanisms
90
184
  3. grep "PaymentError" → find specific error class
91
185
  ```
186
+
187
+ ### Finding TypeScript interfaces
188
+ ```
189
+ 1. codebase_search(query="user data", chunkType="interface") → find User interfaces
190
+ 2. codebase_search(query="API response", chunkType="type") → find response types
191
+ ```