@ninjaxtools/slopdex 0.9.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 +29 -72
- package/README.md +38 -58
- package/dist/cli.js +460 -300
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +42 -40
- package/dist/index.js +351 -230
- package/dist/index.js.map +1 -1
- package/docs/implementation.md +24 -20
- package/package.json +1 -1
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: slopdex
|
|
3
|
-
description:
|
|
3
|
+
description: Semantic code search, find duplicate-function candidates, analyze physical code cohesion
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Slopdex operator guide for agents
|
|
7
7
|
|
|
8
|
-
Slopdex
|
|
9
|
-
|
|
10
|
-
## Choose the command that answers the task
|
|
11
|
-
|
|
12
|
-
Run the requested operation directly. Do not precede it with status, help, version, executable lookup, or credential probes unless those are the user's task or needed to diagnose a reported failure. Missing indexes initialize automatically.
|
|
8
|
+
Slopdex does semantic code search, finds similar-code candidates, and identifies related functions stored far apart.
|
|
13
9
|
|
|
14
10
|
### Find code by meaning
|
|
15
11
|
|
|
@@ -18,32 +14,37 @@ slopdex search "validate an authenticated session" --format summary --limit 10
|
|
|
18
14
|
slopdex search "persist user data" -e 'save|persist' --format summary --limit 5
|
|
19
15
|
```
|
|
20
16
|
|
|
21
|
-
Describe behavior rather than guessing a symbol name. `-e`
|
|
17
|
+
Describe behavior rather than guessing a symbol name. `-e` is a regex that restricts which symbols (functions) are searched.
|
|
22
18
|
|
|
23
19
|
### Search function purpose
|
|
24
20
|
|
|
21
|
+
Code purpose-description generation needs to be enabled once:
|
|
22
|
+
|
|
25
23
|
```bash
|
|
26
|
-
slopdex
|
|
27
|
-
slopdex search-summary "keep the repository index synchronized" --format summary --limit 10
|
|
24
|
+
slopdex descriptions enable # only needed once
|
|
28
25
|
```
|
|
29
26
|
|
|
30
|
-
|
|
27
|
+
Then purpose descriptions can be searched:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
slopdex search-description "keep the repository index synchronized" --format summary --limit 10
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Enabling needs `OPENAI_API_KEY` in the environment.
|
|
31
34
|
|
|
32
35
|
To select another model:
|
|
33
36
|
|
|
34
37
|
```bash
|
|
35
|
-
slopdex
|
|
38
|
+
slopdex descriptions enable --description-model <model-id>
|
|
36
39
|
```
|
|
37
40
|
|
|
38
|
-
The model persists for future updates. Do not enable summaries as a routine prerequisite for ordinary code search or duplicate discovery.
|
|
39
|
-
|
|
40
41
|
### Find duplicate candidates
|
|
41
42
|
|
|
42
43
|
```bash
|
|
43
44
|
slopdex cross-search --cross-file-only --min-lines 4 --threshold 0.9 --limit 5
|
|
44
45
|
```
|
|
45
46
|
|
|
46
|
-
The default output is connected clusters. This excludes same-file matches and short functions.
|
|
47
|
+
The default output is connected clusters. This excludes same-file matches and short functions. For source-by-source matches, add `--format summary`.
|
|
47
48
|
|
|
48
49
|
Broaden discovery through adjacent score bands when needed:
|
|
49
50
|
|
|
@@ -52,7 +53,7 @@ slopdex cross-search --cross-file-only --min-lines 4 --threshold 0.85-0.9 --limi
|
|
|
52
53
|
slopdex cross-search --cross-file-only --min-lines 4 --threshold 0.8-0.85 --limit 5
|
|
53
54
|
```
|
|
54
55
|
|
|
55
|
-
Ranges include the lower bound and exclude the upper bound. Use `--min-lines 1` when one-line wrappers are relevant.
|
|
56
|
+
Ranges include the lower bound and exclude the upper bound. Use `--min-lines 1` when one-line wrappers are relevant.
|
|
56
57
|
|
|
57
58
|
### Review changes or a module
|
|
58
59
|
|
|
@@ -70,7 +71,7 @@ slopdex cross-search --source-path src -e 'validate' \
|
|
|
70
71
|
--cross-file-only --min-lines 4 --threshold 0.9
|
|
71
72
|
```
|
|
72
73
|
|
|
73
|
-
Here a source must have changed since the commit and belong to an uncommitted file, within the selected path/name scope. `--regex` is
|
|
74
|
+
Here a source must have changed since the commit and belong to an uncommitted file, within the selected path/name scope. `--regex` is an alias for `-e/--regexp`.
|
|
74
75
|
|
|
75
76
|
### Review physical cohesion
|
|
76
77
|
|
|
@@ -79,7 +80,7 @@ slopdex cohesion --threshold 0.8 --neighbors 20 --limit 50 --format summary
|
|
|
79
80
|
slopdex cohesion --source-path src/services --threshold 0.8 --format summary
|
|
80
81
|
```
|
|
81
82
|
|
|
82
|
-
Ranks related functions by semantic affinity and file/folder separation.
|
|
83
|
+
Ranks related functions by semantic affinity and file/folder separation. add `--include-source` only when full callable bodies are needed.
|
|
83
84
|
|
|
84
85
|
### Compare repositories
|
|
85
86
|
|
|
@@ -90,7 +91,7 @@ slopdex cross-search \
|
|
|
90
91
|
--threshold 0.9 --format summary
|
|
91
92
|
```
|
|
92
93
|
|
|
93
|
-
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.
|
|
94
95
|
|
|
95
96
|
### Inspect or maintain the index
|
|
96
97
|
|
|
@@ -124,7 +125,7 @@ Usage: `slopdex <command> [arguments] [options]`. Quote queries and regexes. Boo
|
|
|
124
125
|
| `--provider <openai\|jina>` | Embedding provider; `openai`. |
|
|
125
126
|
| `--model <name>` | Embedding model; OpenAI `text-embedding-3-large`, Jina `jina-embeddings-v4`. |
|
|
126
127
|
| `--dimensions <number>` | Positive dimensions supported by the model; OpenAI `3072`, Jina `1024`. |
|
|
127
|
-
| `--
|
|
128
|
+
| `--description-model <name>` | OpenAI description model; initially `gpt-5.6-sol`, then the persisted selection. |
|
|
128
129
|
| `--ignore-errors` | Silence saved-diagnostic warnings without deleting records. |
|
|
129
130
|
| `-h`, `--help` | Usage; no refresh. |
|
|
130
131
|
| `--version` | Package version; exits without refresh or saved-diagnostic warnings. |
|
|
@@ -135,11 +136,10 @@ Explicit relative config/index paths resolve from the current directory. Source
|
|
|
135
136
|
|
|
136
137
|
| Argument | Applies to / behavior |
|
|
137
138
|
| --- | --- |
|
|
138
|
-
| `--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`. |
|
|
139
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)`. |
|
|
140
141
|
| `--format <json\|summary\|clusters>` | Both query searches, cross-search, cohesion, index-errors. `clusters` only supports cross-search; output defaults below. |
|
|
141
|
-
| `-e <regex>`, `--regexp <regex>` |
|
|
142
|
-
| `--regex <regex>` | Cross-search/cohesion: filter both source and candidate qualified names. |
|
|
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. |
|
|
143
143
|
| `--min-lines <number>` | Cross-search/cohesion: positive source/candidate length minimum, default `2`. |
|
|
144
144
|
| `--source-path <path>` | Cross-search/cohesion: source file or recursive directory within the root. |
|
|
145
145
|
| `--changed-since <commit>` | Cross-search/cohesion: added, modified, or moved functions since an ancestor of the indexed Git checkpoint, including working-tree changes. Requires Git. |
|
|
@@ -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-summary` | JSON array
|
|
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
|
-
| `cohesion` |
|
|
175
|
-
| `index-errors` | JSON array |
|
|
176
|
-
| `status`, update commands, `
|
|
174
|
+
| `cohesion` | `summary` | One JSON report |
|
|
175
|
+
| `index-errors` | `summary` | JSON array |
|
|
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,47 +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.
|
|
221
|
-
|
|
222
|
-
## Operational properties
|
|
223
|
-
|
|
224
|
-
- Requires Node.js 24+. Install with `npm install -g @ninjaxtools/slopdex` if installation is the task.
|
|
225
|
-
- Run from the repository root or pass `--root`. The default local index is `.slopdex/index.sqlite`; add `.slopdex/` to `.gitignore`.
|
|
226
|
-
- Most commands, including `status`, refresh before operating. With Git, the default is HEAD plus current working-tree changes; the checkpoint records the committed base. Without Git, refresh scans the working tree and warns. `index-errors`, help, and version do not refresh.
|
|
227
|
-
- Source filters narrow analysis, not the preceding refresh. Indexing and summary generation can make many API calls; unchanged inputs reuse cached results.
|
|
228
|
-
- Embedding keys are `OPENAI_API_KEY` or `JINA_API_KEY`; other than diagnostics/help/version, CLI commands require the configured embedding key even for cached analyses. Summaries also require OpenAI credentials when generation is needed.
|
|
229
|
-
- Function source and queries go to the embedding provider. Enabled summary generation sends repository name, path, callable source, and file context to OpenAI, and summary text to the embedding provider. Results and diagnostics remain in the local index. Never expose key values in tool calls, output, or commits.
|
|
230
|
-
- Coverage: Python `.py/.pyw`; JavaScript `.js/.mjs/.cjs/.jsx`; TypeScript `.ts/.mts/.cts/.tsx`; Rust `.rs`; Go `.go`; Java `.java`; C `.c/.h`. Named callables with bodies, including supported bound closures and nested functions, are indexed. Anonymous callbacks, bodyless declarations, macro expansion, and runtime relationships are outside coverage.
|
|
231
|
-
- Root/nested `.gitignore` rules apply even to tracked files and without Git. Current overlays use current rules; committed-only snapshots use committed rules. Refresh removes newly ignored files; explicit updates reject ignored paths.
|
|
232
|
-
- Dependency/build directories are excluded: `.git`, `.slopdex`, `node_modules`, `dist`, `build`, `coverage`, `vendor`, `generated`, `.venv`, `venv`, `__pycache__`, `.tox`, `.mypy_cache`, `.pytest_cache`, `target`. Config/ignore exceptions cannot override built-in exclusions or an ignored parent directory.
|
|
233
|
-
|
|
234
|
-
### Optional configuration
|
|
235
|
-
|
|
236
|
-
`<root>/.slopdex/config.json`:
|
|
237
|
-
|
|
238
|
-
```json
|
|
239
|
-
{
|
|
240
|
-
"provider": "jina",
|
|
241
|
-
"model": "jina-embeddings-v4",
|
|
242
|
-
"dimensions": 1024,
|
|
243
|
-
"exclude": ["**/fixtures/**"]
|
|
244
|
-
}
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
Supported properties: `provider`, `model`, `dimensions`, `summaryModel`, `indexPath`, `include`, `exclude`, `maxFileSize`, `embeddingBatchSize`. Includes/excludes are repository-relative globs; an empty include list permits all eligible supported files. `maxFileSize` defaults to `1048576` bytes; `embeddingBatchSize` to `32`; both are positive integers. Keep credentials in the environment. Embedding-profile changes require `--force-reindex`.
|
|
248
|
-
|
|
249
|
-
## Failures and incomplete coverage
|
|
250
|
-
|
|
251
|
-
Parse, extraction, read, and file-size failures are saved while healthy functions remain searchable. Inspect `slopdex index-errors --format summary`; JSON adds locations, recovered names, source, and snapshot provenance. `status` reports `indexingErrorCount` and `failedFileCount`, and `functionCount` counts searchable callables.
|
|
252
|
-
|
|
253
|
-
Saved errors warn on stderr, including on cached runs and target indexes. `--ignore-errors` only silences the warning. Updates retry failed files; successful indexing, deletion, or exclusion clears records. Mention relevant incomplete coverage when interpreting results.
|
|
254
|
-
|
|
255
|
-
Preserve the exact command and error when an operation fails. Fix the reported cause instead of retrying equivalent initialization commands:
|
|
256
|
-
|
|
257
|
-
- Missing credentials or provider/configuration errors: report the actionable message without displaying keys.
|
|
258
|
-
- Divergent checkpoint: use `--rebuild-on-divergence` when proceeding with the requested snapshot.
|
|
259
|
-
- Incompatible index: `--force-reindex` recreates it with the requested profile.
|
|
260
|
-
- Source changed during indexing: rerun after edits settle.
|
|
261
|
-
- Bare runtime errors such as `Invalid argument`: report the failure and diagnose the runtime/tool rather than trying unrelated refresh commands.
|
|
262
|
-
|
|
263
|
-
Exit codes: `0` success, `2` argument/domain errors, `1` other failures or missing command. Use help to resolve capability questions and version to report the installed package version when needed.
|
|
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
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
# slopdex
|
|
2
2
|
|
|
3
|
-
Search functions by meaning, find duplicate-code candidates, and locate related functions spread across a codebase.
|
|
3
|
+
Search functions by meaning, find duplicate-code candidates, and locate related functions spread across a codebase.
|
|
4
4
|
|
|
5
5
|
## Start here
|
|
6
6
|
|
|
7
|
-
Requires
|
|
7
|
+
Requires an embedding-provider API key. Install, set your key, and run commands from the repository you want to analyze (or pass `--root /path/to/repo`):
|
|
8
|
+
|
|
9
|
+
Coding agents should start with the bundled [Slopdex agent skill](.agents/skills/slopdex/SKILL.md).
|
|
8
10
|
|
|
9
11
|
```bash
|
|
10
12
|
npm install -g @ninjaxtools/slopdex
|
|
@@ -12,22 +14,26 @@ export OPENAI_API_KEY="your-api-key"
|
|
|
12
14
|
slopdex search "validate an authenticated session" --format summary --limit 10
|
|
13
15
|
```
|
|
14
16
|
|
|
15
|
-
The first command creates the index automatically. Later commands refresh it before searching.
|
|
17
|
+
The first command creates the index automatically. Later commands refresh it before searching.
|
|
18
|
+
|
|
19
|
+
Add `.slopdex/` to your repository's `.gitignore`.
|
|
16
20
|
|
|
17
|
-
###
|
|
21
|
+
### Search code
|
|
18
22
|
|
|
19
23
|
```bash
|
|
20
24
|
slopdex search "keep the repository index synchronized" --format summary --limit 10
|
|
21
25
|
```
|
|
22
26
|
|
|
23
|
-
|
|
27
|
+
To search generated descriptions of each function's role instead:
|
|
24
28
|
|
|
25
29
|
```bash
|
|
26
|
-
slopdex
|
|
27
|
-
slopdex search-
|
|
30
|
+
slopdex descriptions enable
|
|
31
|
+
slopdex search-description "keep the repository index synchronized" --format summary --limit 10
|
|
28
32
|
```
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
This requires `OPENAI_API_KEY` even when Jina supplies embeddings, and adds generation costs. See [descriptions and scoring](#descriptions-and-scoring).
|
|
35
|
+
|
|
36
|
+
`descriptions disable` turns off description generation while retaining cached data.
|
|
31
37
|
|
|
32
38
|
### Find duplicate-code candidates
|
|
33
39
|
|
|
@@ -35,7 +41,7 @@ slopdex search-summary "keep the repository index synchronized" --format summary
|
|
|
35
41
|
slopdex cross-search --cross-file-only --min-lines 4 --threshold 0.9 --limit 5
|
|
36
42
|
```
|
|
37
43
|
|
|
38
|
-
Compare functions across files, exclude short wrappers, and group strong matches into clusters. `--limit 5` selects up to five neighbors **per source function**, not five clusters.
|
|
44
|
+
Compare functions across files, exclude short wrappers, and group strong matches into clusters. `--limit 5` selects up to five neighbors **per source function**, not five clusters.
|
|
39
45
|
|
|
40
46
|
### Review changed code or one module
|
|
41
47
|
|
|
@@ -45,7 +51,7 @@ slopdex cross-search --changed-since origin/main --format summary --threshold 0.
|
|
|
45
51
|
slopdex cross-search --source-path src/services -e '^UserService\.' --format summary --threshold 0.9
|
|
46
52
|
```
|
|
47
53
|
|
|
48
|
-
These select source functions while keeping the full eligible index available for matches. The same source filters work with `cohesion`.
|
|
54
|
+
These select source functions while keeping the full eligible index available for matches. The same source filters work with `cohesion`.
|
|
49
55
|
|
|
50
56
|
### Find related code stored far apart
|
|
51
57
|
|
|
@@ -53,7 +59,7 @@ These select source functions while keeping the full eligible index available fo
|
|
|
53
59
|
slopdex cohesion --threshold 0.8 --neighbors 20 --limit 50 --format summary
|
|
54
60
|
```
|
|
55
61
|
|
|
56
|
-
Ranks semantically related pairs by their physical separation.
|
|
62
|
+
Ranks semantically related pairs by their physical separation.
|
|
57
63
|
|
|
58
64
|
### Compare repositories
|
|
59
65
|
|
|
@@ -64,7 +70,7 @@ slopdex cross-search \
|
|
|
64
70
|
--threshold 0.9 --format summary
|
|
65
71
|
```
|
|
66
72
|
|
|
67
|
-
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.
|
|
68
74
|
|
|
69
75
|
### Inspect index health
|
|
70
76
|
|
|
@@ -82,13 +88,13 @@ Usage: `slopdex <command> [arguments] [options]`.
|
|
|
82
88
|
|
|
83
89
|
| Command | Purpose | Output |
|
|
84
90
|
| --- | --- | --- |
|
|
85
|
-
| `search <query>` | Search function code by meaning. Quote multiword queries. |
|
|
86
|
-
| `
|
|
87
|
-
| `search-
|
|
91
|
+
| `search <query>` | Search function code by meaning. Quote multiword queries. | Summary; optional JSON array |
|
|
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 |
|
|
88
94
|
| `cross-search` | Find neighbors for each selected function in this or another index. | `clusters` by default; optional `summary` or JSONL |
|
|
89
|
-
| `cohesion` | Analyze semantic relationships versus file/folder separation. |
|
|
95
|
+
| `cohesion` | Analyze semantic relationships versus file/folder separation. | Summary; optional JSON report |
|
|
90
96
|
| `status` | Refresh and show index metadata, counts, and profiles. | JSON object |
|
|
91
|
-
| `index-errors` | Read saved file/function indexing failures. |
|
|
97
|
+
| `index-errors` | Read saved file/function indexing failures. | Summary; optional JSON array |
|
|
92
98
|
| `update-git` | Explicitly refresh a Git snapshot, with current working-tree changes when targeting HEAD. | JSON update statistics |
|
|
93
99
|
| `update-files <path...>` | After automatic refresh, explicitly reparse selected working-tree files. Paths are repository-relative or absolute within the root. | JSON update statistics |
|
|
94
100
|
| `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 |
|
|
@@ -103,10 +109,6 @@ slopdex update-git --target HEAD --rebuild-on-divergence
|
|
|
103
109
|
slopdex update-git --force-reindex
|
|
104
110
|
```
|
|
105
111
|
|
|
106
|
-
## Command-line arguments
|
|
107
|
-
|
|
108
|
-
Options are command-specific where indicated. Boolean flags default to off.
|
|
109
|
-
|
|
110
112
|
### Location, providers, and diagnostics
|
|
111
113
|
|
|
112
114
|
| Argument | Meaning / default |
|
|
@@ -117,12 +119,12 @@ Options are command-specific where indicated. Boolean flags default to off.
|
|
|
117
119
|
| `--provider <openai\|jina>` | Embedding provider; `openai` by default. |
|
|
118
120
|
| `--model <name>` | Embedding model; `text-embedding-3-large` for OpenAI, `jina-embeddings-v4` for Jina. |
|
|
119
121
|
| `--dimensions <number>` | Positive embedding dimension count; OpenAI `3072`, Jina `1024`. Must be supported by the model. |
|
|
120
|
-
| `--
|
|
122
|
+
| `--description-model <name>` | OpenAI description model; `gpt-5.6-sol` initially, then the persisted model unless overridden. |
|
|
121
123
|
| `--ignore-errors` | Silence warnings about saved indexing errors; records remain available. |
|
|
122
124
|
| `-h`, `--help` | Show CLI usage without refreshing. |
|
|
123
125
|
| `--version` | Print the package version and exit. |
|
|
124
126
|
|
|
125
|
-
Explicit relative config and index paths resolve from the current directory, not `--root`.
|
|
127
|
+
Explicit relative config and index paths resolve from the current directory, not `--root`.
|
|
126
128
|
|
|
127
129
|
### Search and analysis
|
|
128
130
|
|
|
@@ -131,8 +133,7 @@ Explicit relative config and index paths resolve from the current directory, not
|
|
|
131
133
|
| `--limit <number>` | Both query searches, cross-search, cohesion | Positive integer. Query matches: `10`; cross-search neighbors per source: `5`; cohesion reported pairs and file rows: `50`. |
|
|
132
134
|
| `--threshold <number\|min-max>` | Both query searches, cross-search, cohesion | Minimum similarity, or range with inclusive minimum and exclusive maximum. Default `-1` for query/cross-search, `0.8` for cohesion. Cohesion minimum must be at least `-1` and below `1`. |
|
|
133
135
|
| `--format <json\|summary\|clusters>` | Both query searches, cross-search, cohesion, index-errors | Output format; see the commands table. `clusters` is only for cross-search. |
|
|
134
|
-
| `-e <regex>`, `--regexp <regex>` | Both query searches, cross-search, cohesion |
|
|
135
|
-
| `--regex <regex>` | Cross-search, cohesion | Filter **both** source and candidate qualified names. |
|
|
136
|
+
| `-e <regex>`, `--regexp <regex>`, `--regex <regex>` | Both query searches, cross-search, cohesion | Equivalent case-sensitive JavaScript regex options over qualified names. Query searches: filter results before limiting. Analysis: filter sources only. |
|
|
136
137
|
| `--min-lines <number>` | Cross-search, cohesion | Minimum source and candidate callable length; positive integer, default `2`. Use `1` to include one-line wrappers. |
|
|
137
138
|
| `--source-path <path>` | Cross-search, cohesion | Select sources in a file or recursive directory, relative to the repository root (or absolute within it). |
|
|
138
139
|
| `--changed-since <commit>` | Cross-search, cohesion | Select added, modified, or moved functions relative to an ancestor of the indexed Git checkpoint, including working-tree changes. Requires Git. |
|
|
@@ -145,8 +146,6 @@ Explicit relative config and index paths resolve from the current directory, not
|
|
|
145
146
|
| `--target-index <path>` | Cross-search | Second index file; requires `--target-root`. |
|
|
146
147
|
| `--target-config <path>` | Cross-search | Target config; defaults to `<target-root>/.slopdex/config.json`. Requires both target options. |
|
|
147
148
|
|
|
148
|
-
Source restrictions intersect: with both Git filters, a function must have changed since the commit **and** belong to an uncommitted file. `-e`, `--source-path`, and Git filters do not restrict candidates; `--regex` and `--min-lines` do.
|
|
149
|
-
|
|
150
149
|
Review adjacent similarity bands without repeating boundary matches:
|
|
151
150
|
|
|
152
151
|
```bash
|
|
@@ -201,41 +200,23 @@ Cohesion: 184 functions analyzed, 37 semantic edges
|
|
|
201
200
|
| `sourceTestPair` | A source/test relationship inferred from paths; separation may be intentional. |
|
|
202
201
|
| `externalAffinityRatio` | In JSON file reports, the share of observed affinity outside that file's folder. |
|
|
203
202
|
|
|
204
|
-
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.
|
|
205
204
|
|
|
206
|
-
For automation, 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.
|
|
207
206
|
|
|
208
207
|
## System behavior
|
|
209
208
|
|
|
210
|
-
###
|
|
211
|
-
|
|
212
|
-
- Indexing, search, analysis, `use-summaries`, and `status` automatically refresh. With Git, results normally reflect HEAD plus staged, unstaged, and untracked working-tree contents. `gitCheckpoint` records the committed base, not the overlay.
|
|
213
|
-
- Without Git, commands warn and scan the working tree. `--no-reindex` has the limited behavior described above.
|
|
214
|
-
- `index-errors`, help, and version do not refresh. Other commands require the configured embedding key, even when cached data supplies the analysis.
|
|
215
|
-
- Function source and search queries go to the embedding provider. Source metadata, vectors, diagnostics, and enabled summaries stay in the local index. Summary generation also sends repository name, path, callable source, and surrounding file context to OpenAI; summary text goes to the embedding provider.
|
|
216
|
-
- Unchanged embedding and summary inputs reuse cached results. Initial indexing and enabling summaries can make many API calls. Source filters reduce analysis work, not the preceding index refresh.
|
|
217
|
-
|
|
218
|
-
### Summaries and scoring
|
|
209
|
+
### Descriptions and scoring
|
|
219
210
|
|
|
220
|
-
|
|
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`.
|
|
221
212
|
|
|
222
|
-
|
|
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.
|
|
223
214
|
|
|
224
|
-
|
|
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.
|
|
225
216
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
| Language | File extensions |
|
|
229
|
-
| --- | --- |
|
|
230
|
-
| Python | `.py`, `.pyw` |
|
|
231
|
-
| JavaScript / JSX | `.js`, `.mjs`, `.cjs`, `.jsx` |
|
|
232
|
-
| TypeScript / TSX | `.ts`, `.mts`, `.cts`, `.tsx` |
|
|
233
|
-
| Rust | `.rs` |
|
|
234
|
-
| Go | `.go` |
|
|
235
|
-
| Java | `.java` |
|
|
236
|
-
| C | `.c`, `.h` |
|
|
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.
|
|
237
218
|
|
|
238
|
-
|
|
219
|
+
### Exclusions
|
|
239
220
|
|
|
240
221
|
Root and nested `.gitignore` rules apply even to tracked files and without Git. Working-tree refreshes use current rules; committed-only snapshots use the target commit's rules. Refresh removes newly excluded files and discovers newly eligible ones. Explicit `update-files` rejects ignored files.
|
|
241
222
|
|
|
@@ -247,7 +228,7 @@ Parse, extraction, read, and file-size failures are saved while healthy callable
|
|
|
247
228
|
|
|
248
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.
|
|
249
230
|
|
|
250
|
-
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).
|
|
251
232
|
|
|
252
233
|
## Configuration
|
|
253
234
|
|
|
@@ -265,7 +246,7 @@ Optional file: `<root>/.slopdex/config.json`. Example using Jina (requires `JINA
|
|
|
265
246
|
| Property | Purpose / default |
|
|
266
247
|
| --- | --- |
|
|
267
248
|
| `provider`, `model`, `dimensions` | Embedding settings; defaults are listed in the CLI table. |
|
|
268
|
-
| `
|
|
249
|
+
| `descriptionModel` | Description model; initially `gpt-5.6-sol`. |
|
|
269
250
|
| `indexPath` | Index location; `<root>/.slopdex/index.sqlite`. |
|
|
270
251
|
| `include` | Repository-relative glob array; empty/unset includes all supported eligible files. |
|
|
271
252
|
| `exclude` | Additional repository-relative exclusion globs. |
|
|
@@ -274,7 +255,6 @@ Optional file: `<root>/.slopdex/config.json`. Example using Jina (requires `JINA
|
|
|
274
255
|
|
|
275
256
|
Keep keys in the environment (`OPENAI_API_KEY`, `JINA_API_KEY`). Changing the embedding profile requires rebuilding with `--force-reindex`.
|
|
276
257
|
|
|
277
|
-
##
|
|
258
|
+
## Development
|
|
278
259
|
|
|
279
|
-
- [
|
|
280
|
-
- [Implementation and library API](docs/implementation.md): internals, programmatic usage, build, and development checks.
|
|
260
|
+
- [Implementation and library API](docs/implementation.md)
|