@ninjaxtools/slopdex 0.11.0 → 0.13.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.
@@ -30,7 +30,8 @@ Then purpose descriptions can be searched:
30
30
  slopdex search-description "keep the repository index synchronized" --format summary --limit 10
31
31
  ```
32
32
 
33
- Enabling needs `OPENAI_API_KEY` in the environment.
33
+ Enabling needs `OPENAI_API_KEY` by default. Select OpenCode Zen or Go with
34
+ `--description-provider opencode` or `--description-provider opencode-go` and set `OPENCODE_API_KEY`.
34
35
 
35
36
  To select another model:
36
37
 
@@ -38,6 +39,17 @@ To select another model:
38
39
  slopdex descriptions enable --description-model <model-id>
39
40
  ```
40
41
 
42
+ List and persist a published OpenCode model without creating an index:
43
+
44
+ ```bash
45
+ slopdex models opencode-go
46
+ slopdex config model opencode-go/gpt-5.6-luna
47
+ slopdex config descriptions enable
48
+ ```
49
+
50
+ The next index-using command applies the configured description state. A bare model ID passed to
51
+ `config model` resolves automatically only when it belongs to one of Zen or Go; qualify shared IDs.
52
+
41
53
  ### Find duplicate candidates
42
54
 
43
55
  ```bash
@@ -100,6 +112,8 @@ slopdex status
100
112
  slopdex index-errors --format summary
101
113
  slopdex update-git
102
114
  slopdex update-files src/service.ts src/model.ts
115
+ slopdex reindex-files
116
+ slopdex reindex-files --callables
103
117
  slopdex delete-files src/removed.ts
104
118
  slopdex --version
105
119
  ```
@@ -108,6 +122,7 @@ slopdex --version
108
122
  - `index-errors` reads saved failures without refreshing or needing API credentials.
109
123
  - `update-git` explicitly refreshes HEAD and working-tree changes.
110
124
  - `update-files` reparses specified working-tree files after automatic refresh, even when their contents are unchanged.
125
+ - `reindex-files` regenerates stale file descriptions and embeddings. Add `--callables` to also replace callable descriptions in those files.
111
126
  - `delete-files` removes index entries after automatic refresh, not source files. Eligible files can return on later refresh.
112
127
  - `--version` prints the built package version. `--help` describes available commands/options.
113
128
 
@@ -125,7 +140,8 @@ Usage: `slopdex <command> [arguments] [options]`. Quote queries and regexes. Boo
125
140
  | `--provider <openai\|jina>` | Embedding provider; `openai`. |
126
141
  | `--model <name>` | Embedding model; OpenAI `text-embedding-3-large`, Jina `jina-embeddings-v4`. |
127
142
  | `--dimensions <number>` | Positive dimensions supported by the model; OpenAI `3072`, Jina `1024`. |
128
- | `--description-model <name>` | OpenAI description model; initially `gpt-5.6-sol`, then the persisted selection. |
143
+ | `--description-provider <openai\|opencode\|opencode-go>` | Description provider; OpenAI by default. OpenCode values require `OPENCODE_API_KEY`. |
144
+ | `--description-model <name>` | Description model; `gpt-5.6-sol` for OpenAI/Zen and `gpt-5.6-luna` for Go. |
129
145
  | `--ignore-errors` | Silence saved-diagnostic warnings without deleting records. |
130
146
  | `-h`, `--help` | Usage; no refresh. |
131
147
  | `--version` | Package version; exits without refresh or saved-diagnostic warnings. |
@@ -160,6 +176,7 @@ Explicit relative config/index paths resolve from the current directory. Source
160
176
  | `--rebuild-on-divergence` | Permit reconciliation after non-descendant history changes, such as a rebase/branch switch. |
161
177
  | `--force-reindex` | Recreate an incompatible index. Compatible indexes still use normal refresh; this is not an unconditional reparse flag. |
162
178
  | `--no-reindex` | With Git, reconcile the committed snapshot but omit working-tree overlays. Without Git, reuse a non-empty index; missing/empty indexes still populate. Not an offline mode. |
179
+ | `--callables` | With `reindex-files`, continue after the file description and regenerate every callable description in each stale file. |
163
180
 
164
181
  Use `--no-reindex` when the task calls for committed-only results or reuse of an existing non-Git index, rather than silently weakening freshness.
165
182
 
@@ -195,7 +212,7 @@ When reporting candidates, identify paths/symbols, summarize the shared behavior
195
212
 
196
213
  ### Purpose-aware scoring
197
214
 
198
- `search` uses code only; `search-description` uses purpose descriptions only. Cross-search and cohesion automatically use **50% code + 50% description similarity** when descriptions are enabled and complete. Cross-repository analysis needs completeness on both sides; otherwise all scores are code-only. Description-generator models may differ even though embedding profiles must match.
215
+ When descriptions are complete, `search`, cross-search, and cohesion average code, callable-description, and file-description similarity with equal one-third weights. `search-description` averages callable and file descriptions. Cross-repository analysis needs completeness on both sides; otherwise all scores are code-only. Stale file descriptions remain in scoring until `reindex-files` refreshes them. Description-generator models may differ even though embedding profiles must match.
199
216
 
200
217
  Thresholds and limits apply to the selected score. Text labels combined scoring; JSON includes component scores and mode/weights (`scoring` in cross-search, `parameters` in cohesion). Compare runs only with matching scoring mode, weights, embedding and description-generator profiles, threshold, neighbor count, and source/candidate filters.
201
218
 
package/README.md CHANGED
@@ -31,10 +31,21 @@ slopdex descriptions enable
31
31
  slopdex search-description "keep the repository index synchronized" --format summary --limit 10
32
32
  ```
33
33
 
34
- This requires `OPENAI_API_KEY` even when Jina supplies embeddings, and adds generation costs. See [descriptions and scoring](#descriptions-and-scoring).
34
+ The default description provider requires `OPENAI_API_KEY` even when Jina supplies embeddings. OpenCode Zen and Go use `OPENCODE_API_KEY`. Description generation can add provider costs; see [descriptions and scoring](#descriptions-and-scoring).
35
35
 
36
36
  `descriptions disable` turns off description generation while retaining cached data.
37
37
 
38
+ To choose from OpenCode's current published models and persist description settings without creating an index:
39
+
40
+ ```bash
41
+ slopdex models opencode-go
42
+ slopdex config model opencode-go/gpt-5.6-luna
43
+ slopdex config descriptions enable
44
+ ```
45
+
46
+ The next index-using command creates or refreshes the index and applies the configured description state.
47
+ You can also pass the selection separately as `slopdex config model --description-provider opencode-go --description-model gpt-5.6-luna`.
48
+
38
49
  ### Find duplicate-code candidates
39
50
 
40
51
  ```bash
@@ -88,6 +99,9 @@ Usage: `slopdex <command> [arguments] [options]`.
88
99
 
89
100
  | Command | Purpose | Output |
90
101
  | --- | --- | --- |
102
+ | `models [opencode\|opencode-go]` | Fetch valid models from the current published Zen and/or Go catalogs. | Qualified `provider/model` lines; optional JSON array |
103
+ | `config model <model\|provider/model>` | Validate a published OpenCode model and persist its provider/model selection without opening an index. Bare IDs auto-resolve only when unambiguous. | Updated setting summary; optional JSON |
104
+ | `config descriptions <enable\|disable>` | Persist whether the next index-using command should enable or disable descriptions. Does not open an index. | Updated setting summary; optional JSON |
91
105
  | `search <query>` | Search function code by meaning. Quote multiword queries. | Summary; optional JSON array |
92
106
  | `descriptions <enable\|disable>` | Enable or disable automatic purpose descriptions. Re-enabling with unchanged inputs reuses cached descriptions. | JSON statistics |
93
107
  | `search-description <query>` | Search purpose descriptions after enabling them. | Summary including description text; optional JSON array |
@@ -97,6 +111,7 @@ Usage: `slopdex <command> [arguments] [options]`.
97
111
  | `index-errors` | Read saved file/function indexing failures. | Summary; optional JSON array |
98
112
  | `update-git` | Explicitly refresh a Git snapshot, with current working-tree changes when targeting HEAD. | JSON update statistics |
99
113
  | `update-files <path...>` | After automatic refresh, explicitly reparse selected working-tree files. Paths are repository-relative or absolute within the root. | JSON update statistics |
114
+ | `reindex-files [--callables]` | Regenerate descriptions for files changed since their stored file description. By default stops after each file description; `--callables` also regenerates its callable descriptions. | JSON description statistics |
100
115
  | `delete-files <path...>` | After automatic refresh, remove paths from the index; source files are not deleted. A later refresh can restore eligible files. | JSON update statistics |
101
116
 
102
117
  Manual maintenance examples:
@@ -104,6 +119,8 @@ Manual maintenance examples:
104
119
  ```bash
105
120
  slopdex update-git
106
121
  slopdex update-files src/service.ts src/model.ts
122
+ slopdex reindex-files
123
+ slopdex reindex-files --callables
107
124
  slopdex delete-files src/removed.ts
108
125
  slopdex update-git --target HEAD --rebuild-on-divergence
109
126
  slopdex update-git --force-reindex
@@ -119,7 +136,8 @@ slopdex update-git --force-reindex
119
136
  | `--provider <openai\|jina>` | Embedding provider; `openai` by default. |
120
137
  | `--model <name>` | Embedding model; `text-embedding-3-large` for OpenAI, `jina-embeddings-v4` for Jina. |
121
138
  | `--dimensions <number>` | Positive embedding dimension count; OpenAI `3072`, Jina `1024`. Must be supported by the model. |
122
- | `--description-model <name>` | OpenAI description model; `gpt-5.6-sol` initially, then the persisted model unless overridden. |
139
+ | `--description-provider <openai\|opencode\|opencode-go>` | Description provider; OpenAI by default. OpenCode values use Zen or Go with `OPENCODE_API_KEY`. |
140
+ | `--description-model <name>` | Description model; `gpt-5.6-sol` for OpenAI/Zen and `gpt-5.6-luna` for Go, then the persisted model unless overridden. Published OpenCode models use their documented protocol. |
123
141
  | `--ignore-errors` | Silence warnings about saved indexing errors; records remain available. |
124
142
  | `-h`, `--help` | Show CLI usage without refreshing. |
125
143
  | `--version` | Print the package version and exit. |
@@ -208,13 +226,17 @@ For automation, pass `--format json`: query searches and diagnostics return JSON
208
226
 
209
227
  ### Descriptions and scoring
210
228
 
211
- Descriptions are optional and disabled initially. `descriptions enable` persists the selected description model and keeps descriptions current on later updates, including file-context and path changes. Use `slopdex descriptions enable --description-model <model-id>` to change it, or `slopdex descriptions disable` to stop automatic updates and description-based searching/scoring while retaining cached descriptions. `status` exposes `descriptionsEnabled`, `descriptionCount`, and `descriptionProfile`.
229
+ Descriptions are optional and disabled initially. `descriptions enable` persists the selected provider and model and keeps callable descriptions current on later updates. Use `slopdex descriptions enable --description-provider opencode-go` for OpenCode Go, or combine `--description-provider` and `--description-model` to change both. `slopdex descriptions disable` stops automatic updates and description-based searching/scoring while retaining cached descriptions. `status` exposes callable/file description counts, stale file-description count, enabled state, and profile.
230
+
231
+ Descriptions are generated in source order through one conversation per file. Instructions and complete file source form a stable prefix; Slopdex asks for the overall file description first, then each callable request and answer extends that conversation. This allows supported providers to reuse their prompt cache instead of receiving a separate duplicated file context for every callable.
232
+
233
+ Ordinary updates preserve an existing file description even when its source changes, while still refreshing callable descriptions. `slopdex reindex-files` explicitly regenerates stale file descriptions and their embeddings; add `--callables` to continue through and replace every callable description in those files.
212
234
 
213
235
  Tree-sitter extraction, generated descriptions, and document/query vectors are content-addressed in the same SQLite database. Each validated result is committed immediately, independently of the final logical index update. If indexing is interrupted or a later provider call fails, rerunning reuses every completed result whose profile, operation, input, and source context hash still match.
214
236
 
215
- `search` always searches code; `search-description` always searches purpose descriptions. When all callables have enabled descriptions, cross-search and cohesion automatically use **50% code similarity + 50% description similarity**. Cross-repository analysis needs complete descriptions on both sides; otherwise the entire analysis uses code-only scores. Thresholds and neighbor limits apply to the selected score.
237
+ With complete descriptions, `search`, cross-search, and cohesion average **one-third code similarity + one-third callable-description similarity + one-third file-description similarity**. `search-description` averages callable and file descriptions without code. Cross-repository analysis needs complete descriptions on both sides; otherwise the entire analysis uses code-only scores. Stale file descriptions remain searchable until explicitly reindexed. Thresholds and neighbor limits apply to the selected score.
216
238
 
217
- Text output labels combined scores. JSON exposes `codeSimilarity`, `descriptionSimilarity`, and scoring mode/weights (`scoring` for cross-search, `parameters` for cohesion). Compare runs only with matching scoring mode, weights, embedding and description-generator profiles, threshold, neighbor count, and source/candidate filters.
239
+ Text output labels combined scores. JSON exposes `codeSimilarity`, `descriptionSimilarity`, `fileDescriptionSimilarity`, and scoring mode/weights (`scoring` for cross-search, `parameters` for cohesion). Compare runs only with matching scoring mode, weights, embedding and description-generator profiles, threshold, neighbor count, and source/candidate filters.
218
240
 
219
241
  ### Exclusions
220
242
 
@@ -232,13 +254,14 @@ Use the recovery flag named in the error: `--rebuild-on-divergence` for Git hist
232
254
 
233
255
  ## Configuration
234
256
 
235
- Optional file: `<root>/.slopdex/config.json`. Example using Jina (requires `JINA_API_KEY`):
257
+ Optional file: `<root>/.slopdex/config.json`. Example using Jina embeddings and OpenCode Go descriptions (requires `JINA_API_KEY`, plus `OPENCODE_API_KEY` when descriptions are enabled):
236
258
 
237
259
  ```json
238
260
  {
239
261
  "provider": "jina",
240
262
  "model": "jina-embeddings-v4",
241
263
  "dimensions": 1024,
264
+ "descriptionProvider": "opencode-go",
242
265
  "exclude": ["**/fixtures/**"]
243
266
  }
244
267
  ```
@@ -246,14 +269,16 @@ Optional file: `<root>/.slopdex/config.json`. Example using Jina (requires `JINA
246
269
  | Property | Purpose / default |
247
270
  | --- | --- |
248
271
  | `provider`, `model`, `dimensions` | Embedding settings; defaults are listed in the CLI table. |
249
- | `descriptionModel` | Description model; initially `gpt-5.6-sol`. |
272
+ | `descriptionProvider` | Description provider: `openai`, `opencode` (Zen), or `opencode-go`; defaults to `openai`. |
273
+ | `descriptionModel` | Description model; provider default unless explicitly set. |
274
+ | `descriptionsEnabled` | When true or false, the next index-using command applies that enabled state during its normal refresh. Unset leaves persisted index state unchanged. |
250
275
  | `indexPath` | Index location; `<root>/.slopdex/index.sqlite`. |
251
276
  | `include` | Repository-relative glob array; empty/unset includes all supported eligible files. |
252
277
  | `exclude` | Additional repository-relative exclusion globs. |
253
278
  | `maxFileSize` | Maximum source-file size in bytes; positive integer, default `1048576`. |
254
279
  | `embeddingBatchSize` | Embedding inputs per batch; positive integer, default `32`. |
255
280
 
256
- Keep keys in the environment (`OPENAI_API_KEY`, `JINA_API_KEY`). Changing the embedding profile requires rebuilding with `--force-reindex`.
281
+ Keep keys in the environment (`OPENAI_API_KEY`, `JINA_API_KEY`, `OPENCODE_API_KEY`). Changing the embedding profile requires rebuilding with `--force-reindex`.
257
282
 
258
283
  ## Development
259
284