@ninjaxtools/slopdex 0.10.0 → 0.11.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/.agents/skills/slopdex/SKILL.md +13 -13
- package/README.md +18 -16
- package/dist/cli.js +409 -282
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +40 -40
- package/dist/index.js +329 -234
- package/dist/index.js.map +1 -1
- package/docs/implementation.md +20 -18
- package/package.json +1 -1
|
@@ -18,16 +18,16 @@ Describe behavior rather than guessing a symbol name. `-e` is a regex that restr
|
|
|
18
18
|
|
|
19
19
|
### Search function purpose
|
|
20
20
|
|
|
21
|
-
Code purpose-
|
|
21
|
+
Code purpose-description generation needs to be enabled once:
|
|
22
22
|
|
|
23
23
|
```bash
|
|
24
|
-
slopdex
|
|
24
|
+
slopdex descriptions enable # only needed once
|
|
25
25
|
```
|
|
26
26
|
|
|
27
|
-
Then purpose
|
|
27
|
+
Then purpose descriptions can be searched:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
slopdex search-
|
|
30
|
+
slopdex search-description "keep the repository index synchronized" --format summary --limit 10
|
|
31
31
|
```
|
|
32
32
|
|
|
33
33
|
Enabling needs `OPENAI_API_KEY` in the environment.
|
|
@@ -35,7 +35,7 @@ Enabling needs `OPENAI_API_KEY` in the environment.
|
|
|
35
35
|
To select another model:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
slopdex
|
|
38
|
+
slopdex descriptions enable --description-model <model-id>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
### Find duplicate candidates
|
|
@@ -91,7 +91,7 @@ slopdex cross-search \
|
|
|
91
91
|
--threshold 0.9 --format summary
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
-
Both target options are required. Both indexes refresh and must have identical embedding profiles. The target refresh uses the source command's embedding provider and the target's file-selection/
|
|
94
|
+
Both target options are required. Both indexes refresh and must have identical embedding profiles. The target refresh uses the source command's embedding provider and the target's file-selection/description configuration. Use `--target-config <path>` for a custom target config.
|
|
95
95
|
|
|
96
96
|
### Inspect or maintain the index
|
|
97
97
|
|
|
@@ -125,7 +125,7 @@ Usage: `slopdex <command> [arguments] [options]`. Quote queries and regexes. Boo
|
|
|
125
125
|
| `--provider <openai\|jina>` | Embedding provider; `openai`. |
|
|
126
126
|
| `--model <name>` | Embedding model; OpenAI `text-embedding-3-large`, Jina `jina-embeddings-v4`. |
|
|
127
127
|
| `--dimensions <number>` | Positive dimensions supported by the model; OpenAI `3072`, Jina `1024`. |
|
|
128
|
-
| `--
|
|
128
|
+
| `--description-model <name>` | OpenAI description model; initially `gpt-5.6-sol`, then the persisted selection. |
|
|
129
129
|
| `--ignore-errors` | Silence saved-diagnostic warnings without deleting records. |
|
|
130
130
|
| `-h`, `--help` | Usage; no refresh. |
|
|
131
131
|
| `--version` | Package version; exits without refresh or saved-diagnostic warnings. |
|
|
@@ -136,7 +136,7 @@ Explicit relative config/index paths resolve from the current directory. Source
|
|
|
136
136
|
|
|
137
137
|
| Argument | Applies to / behavior |
|
|
138
138
|
| --- | --- |
|
|
139
|
-
| `--limit <number>` | Positive integer. `search`/`search-
|
|
139
|
+
| `--limit <number>` | Positive integer. `search`/`search-description`: matches, default `10`. Cross-search: neighbors per source, default `5`. Cohesion: reported pairs and file rows, default `50`. |
|
|
140
140
|
| `--threshold <number\|min-max>` | Both query searches and analyses. Inclusive minimum or half-open range. Default `-1` for query/cross-search; `0.8` for cohesion. Cohesion minimum must be in `[-1, 1)`. |
|
|
141
141
|
| `--format <json\|summary\|clusters>` | Both query searches, cross-search, cohesion, index-errors. `clusters` only supports cross-search; output defaults below. |
|
|
142
142
|
| `-e <regex>`, `--regexp <regex>`, `--regex <regex>` | Equivalent case-sensitive JavaScript regex options on qualified names. Query searches filter results before limiting; cross-search/cohesion filter sources only. |
|
|
@@ -169,11 +169,11 @@ Use `--no-reindex` when the task calls for committed-only results or reuse of an
|
|
|
169
169
|
|
|
170
170
|
| Command | Default | Alternatives |
|
|
171
171
|
| --- | --- | --- |
|
|
172
|
-
| `search`, `search-
|
|
172
|
+
| `search`, `search-description` | `summary` | JSON array; purpose search includes generated description text |
|
|
173
173
|
| `cross-search` | `clusters` | `summary`, or `json` for JSONL with one row per matched source |
|
|
174
174
|
| `cohesion` | `summary` | One JSON report |
|
|
175
175
|
| `index-errors` | `summary` | JSON array |
|
|
176
|
-
| `status`, update commands, `
|
|
176
|
+
| `status`, update commands, `descriptions` | JSON object | — |
|
|
177
177
|
|
|
178
178
|
Prefer summary output for compact source review, clusters for duplicate families, and JSON/JSONL for structured processing. Stdout carries results; stderr carries notices and warnings. Cross-search omits sources without emitted matches. Empty output means no findings under the chosen coverage/filters, not proof that no similar code exists.
|
|
179
179
|
|
|
@@ -195,9 +195,9 @@ When reporting candidates, identify paths/symbols, summarize the shared behavior
|
|
|
195
195
|
|
|
196
196
|
### Purpose-aware scoring
|
|
197
197
|
|
|
198
|
-
`search` uses code only; `search-
|
|
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.
|
|
199
199
|
|
|
200
|
-
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
|
|
200
|
+
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
201
|
|
|
202
202
|
### Cohesion
|
|
203
203
|
|
|
@@ -217,4 +217,4 @@ Cohesion: 184 functions analyzed, 37 semantic edges
|
|
|
217
217
|
- **Reciprocal:** both functions selected each other as neighbors. JSON `null` means an endpoint was not evaluated because of source filtering.
|
|
218
218
|
- **JSON details:** `semanticWeight` reflects similarity above threshold; `separationWeight` reflects distance; `sourceTestPair` flags a path-inferred source/test relationship; file `externalAffinityRatio` measures affinity outside that file's folder.
|
|
219
219
|
|
|
220
|
-
The example merits reviewing separated authentication responsibilities, while accounting for intentional layering. There is no universal pass/fail threshold. Use comparable runs to evaluate changes. Filtered reports describe selected sources, not the full repository.
|
|
220
|
+
The example merits reviewing separated authentication responsibilities, while accounting for intentional layering. There is no universal pass/fail threshold. Use comparable runs to evaluate changes. Filtered reports describe selected sources, not the full repository. Cohesion metrics use all qualifying edges; pairs/files are limited, and groups use reported pairs.
|
package/README.md
CHANGED
|
@@ -27,13 +27,13 @@ slopdex search "keep the repository index synchronized" --format summary --limit
|
|
|
27
27
|
To search generated descriptions of each function's role instead:
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
slopdex
|
|
31
|
-
slopdex search-
|
|
30
|
+
slopdex descriptions enable
|
|
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 [
|
|
34
|
+
This requires `OPENAI_API_KEY` even when Jina supplies embeddings, and adds generation 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
38
|
### Find duplicate-code candidates
|
|
39
39
|
|
|
@@ -70,7 +70,7 @@ slopdex cross-search \
|
|
|
70
70
|
--threshold 0.9 --format summary
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
Both indexes refresh automatically and must use identical embedding profiles. The target is refreshed with the source command's embedding provider; target configuration supplies file-selection and
|
|
73
|
+
Both indexes refresh automatically and must use identical embedding profiles. The target is refreshed with the source command's embedding provider; target configuration supplies file-selection and description settings. Use `--target-config` for a non-default target config.
|
|
74
74
|
|
|
75
75
|
### Inspect index health
|
|
76
76
|
|
|
@@ -89,8 +89,8 @@ Usage: `slopdex <command> [arguments] [options]`.
|
|
|
89
89
|
| Command | Purpose | Output |
|
|
90
90
|
| --- | --- | --- |
|
|
91
91
|
| `search <query>` | Search function code by meaning. Quote multiword queries. | Summary; optional JSON array |
|
|
92
|
-
| `
|
|
93
|
-
| `search-
|
|
92
|
+
| `descriptions <enable\|disable>` | Enable or disable automatic purpose descriptions. Re-enabling with unchanged inputs reuses cached descriptions. | JSON statistics |
|
|
93
|
+
| `search-description <query>` | Search purpose descriptions after enabling them. | Summary including description text; optional JSON array |
|
|
94
94
|
| `cross-search` | Find neighbors for each selected function in this or another index. | `clusters` by default; optional `summary` or JSONL |
|
|
95
95
|
| `cohesion` | Analyze semantic relationships versus file/folder separation. | Summary; optional JSON report |
|
|
96
96
|
| `status` | Refresh and show index metadata, counts, and profiles. | JSON object |
|
|
@@ -119,7 +119,7 @@ slopdex update-git --force-reindex
|
|
|
119
119
|
| `--provider <openai\|jina>` | Embedding provider; `openai` by default. |
|
|
120
120
|
| `--model <name>` | Embedding model; `text-embedding-3-large` for OpenAI, `jina-embeddings-v4` for Jina. |
|
|
121
121
|
| `--dimensions <number>` | Positive embedding dimension count; OpenAI `3072`, Jina `1024`. Must be supported by the model. |
|
|
122
|
-
| `--
|
|
122
|
+
| `--description-model <name>` | OpenAI description model; `gpt-5.6-sol` initially, then the persisted model unless overridden. |
|
|
123
123
|
| `--ignore-errors` | Silence warnings about saved indexing errors; records remain available. |
|
|
124
124
|
| `-h`, `--help` | Show CLI usage without refreshing. |
|
|
125
125
|
| `--version` | Print the package version and exit. |
|
|
@@ -200,19 +200,21 @@ Cohesion: 184 functions analyzed, 37 semantic edges
|
|
|
200
200
|
| `sourceTestPair` | A source/test relationship inferred from paths; separation may be intentional. |
|
|
201
201
|
| `externalAffinityRatio` | In JSON file reports, the share of observed affinity outside that file's folder. |
|
|
202
202
|
|
|
203
|
-
The example suggests reviewing separated authentication responsibilities. It does not establish that they belong in one module. There is no universal cohesion pass threshold. Filtered reports describe selected sources, not the entire repository.
|
|
203
|
+
The example suggests reviewing separated authentication responsibilities. It does not establish that they belong in one module. There is no universal cohesion pass threshold. Filtered reports describe selected sources, not the entire repository. Cohesion metrics cover all qualifying edges; reported pairs/files are limited, and groups are built from reported pairs.
|
|
204
204
|
|
|
205
|
-
For automation, pass `--format json`: query searches and diagnostics return JSON arrays; cross-search returns **JSONL**, one row per matched source; cohesion returns one JSON object containing `repository`, `parameters`, `
|
|
205
|
+
For automation, pass `--format json`: query searches and diagnostics return JSON arrays; cross-search returns **JSONL**, one row per matched source; cohesion returns one JSON object containing `repository`, `parameters`, `metrics`, `pairs`, `files`, and `groups`. Results go to stdout; notices and warnings go to stderr.
|
|
206
206
|
|
|
207
207
|
## System behavior
|
|
208
208
|
|
|
209
|
-
###
|
|
209
|
+
### Descriptions and scoring
|
|
210
210
|
|
|
211
|
-
|
|
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`.
|
|
212
212
|
|
|
213
|
-
|
|
213
|
+
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
214
|
|
|
215
|
-
|
|
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.
|
|
216
|
+
|
|
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.
|
|
216
218
|
|
|
217
219
|
### Exclusions
|
|
218
220
|
|
|
@@ -226,7 +228,7 @@ Parse, extraction, read, and file-size failures are saved while healthy callable
|
|
|
226
228
|
|
|
227
229
|
Saved failures trigger stderr warnings, including on cached runs, help, and cross-search targets. `--ignore-errors` silences warnings without clearing records. Updates retry failed files; successful indexing, deletion, or exclusion clears their diagnostics. Version output bypasses diagnostics.
|
|
228
230
|
|
|
229
|
-
Use the recovery flag named in the error: `--rebuild-on-divergence` for Git history changes, `--force-reindex` for incompatible indexes. For provider/authentication failures, fix the reported configuration. For source-change-during-indexing errors, rerun after edits settle. Exit status is `0` on success, `2` for argument/domain errors, and `1` for other failures (or invocation without a command).
|
|
231
|
+
Use the recovery flag named in the error: `--rebuild-on-divergence` for Git history changes, `--force-reindex` for incompatible indexes. Schema versions before 5 require `--force-reindex`; schema-5 rebuilds preserve reusable artifact caches. For provider/authentication failures, fix the reported configuration and rerun. For source-change-during-indexing errors, rerun after edits settle. Exit status is `0` on success, `2` for argument/domain errors, and `1` for other failures (or invocation without a command).
|
|
230
232
|
|
|
231
233
|
## Configuration
|
|
232
234
|
|
|
@@ -244,7 +246,7 @@ Optional file: `<root>/.slopdex/config.json`. Example using Jina (requires `JINA
|
|
|
244
246
|
| Property | Purpose / default |
|
|
245
247
|
| --- | --- |
|
|
246
248
|
| `provider`, `model`, `dimensions` | Embedding settings; defaults are listed in the CLI table. |
|
|
247
|
-
| `
|
|
249
|
+
| `descriptionModel` | Description model; initially `gpt-5.6-sol`. |
|
|
248
250
|
| `indexPath` | Index location; `<root>/.slopdex/index.sqlite`. |
|
|
249
251
|
| `include` | Repository-relative glob array; empty/unset includes all supported eligible files. |
|
|
250
252
|
| `exclude` | Additional repository-relative exclusion globs. |
|