@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 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 candidates = [path.join(projectRoot, ".opencode", "vectorizer.yaml")]
153
-
152
+ const configPath = path.join(projectRoot, ".opencode", "vectorizer.yaml")
154
153
  let content: string | null = null
155
- for (const configPath of candidates) {
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
- // try next
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
@@ -16,5 +16,4 @@ const UsethisSearchPlugin: Plugin = async (ctx) => {
16
16
  }
17
17
  }
18
18
 
19
- export default UsethisSearchPlugin;
20
- export { UsethisSearchPlugin };
19
+ export default UsethisSearchPlugin;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfanion/usethis_search",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "OpenCode plugin: semantic search + code index management",
5
5
  "type": "module",
6
6
  "main": "./index.ts",