@comfanion/usethis_search 0.1.2 → 0.1.4
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/file-indexer.ts +11 -10
- package/index.ts +1 -2
- package/package.json +1 -1
package/file-indexer.ts
CHANGED
|
@@ -149,23 +149,24 @@ const pendingFiles: Map<string, { indexName: string; timestamp: number }> = new
|
|
|
149
149
|
|
|
150
150
|
async function loadConfig(projectRoot: string): Promise<VectorizerConfig> {
|
|
151
151
|
try {
|
|
152
|
-
const
|
|
153
|
-
|
|
152
|
+
const configPath = path.join(projectRoot, ".opencode", "vectorizer.yaml")
|
|
154
153
|
let content: string | null = null
|
|
155
|
-
|
|
154
|
+
|
|
155
|
+
try {
|
|
156
|
+
content = await fs.readFile(configPath, "utf8")
|
|
157
|
+
} catch {
|
|
158
|
+
// File missing, trigger creation via indexer and try again
|
|
159
|
+
debug("vectorizer.yaml missing, triggering auto-creation...")
|
|
160
|
+
const tempIndexer = new CodebaseIndexer(projectRoot, "code")
|
|
161
|
+
// @ts-ignore - accessing internal method for config creation
|
|
162
|
+
await tempIndexer.init()
|
|
156
163
|
try {
|
|
157
164
|
content = await fs.readFile(configPath, "utf8")
|
|
158
|
-
break
|
|
159
165
|
} catch {
|
|
160
|
-
|
|
166
|
+
return DEFAULT_CONFIG
|
|
161
167
|
}
|
|
162
168
|
}
|
|
163
169
|
|
|
164
|
-
if (!content) {
|
|
165
|
-
debug("No vectorizer config file found, using defaults")
|
|
166
|
-
return DEFAULT_CONFIG
|
|
167
|
-
}
|
|
168
|
-
|
|
169
170
|
const vectorizerMatch = content.match(/vectorizer:\s*\n([\s\S]*?)(?=\n[a-zA-Z_\-]+:|$)/i)
|
|
170
171
|
if (!vectorizerMatch) {
|
|
171
172
|
debug("No vectorizer section, using defaults")
|
package/index.ts
CHANGED