@ninjaxtools/slopdex 0.24.0 → 0.27.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/README.md +42 -25
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -22,7 +22,7 @@ The main supported functions are
|
|
|
22
22
|
- `slopdex map [PATH]...`
|
|
23
23
|
<br/>show a map/skeleton of the code structure
|
|
24
24
|
|
|
25
|
-
`search` does a vector
|
|
25
|
+
`search` does a vector search of code, configuration and markup files, and, when enabled, generated code descriptions.
|
|
26
26
|
|
|
27
27
|
`cross-search` also does a vector search but compares all functions with each other (scope can be limited with additional options) and helps with finding duplicated code, or code that is not necessarily duplicated but spread out across the codebase (with `--cohesion`).
|
|
28
28
|
|
|
@@ -56,7 +56,7 @@ $ slopdex search "validate an authenticated session"
|
|
|
56
56
|
...
|
|
57
57
|
```
|
|
58
58
|
|
|
59
|
-
The index tracks the current
|
|
59
|
+
The index tracks the current Git commit and is created or updated on every command that uses it. Index data is stored in the current user's cache folder and project settings are stored in `.slopdex/config.json` (add `.slopdex` to `.gitignore`). See also [cache configuration](docs/reference.md#shared-provider-artifacts).
|
|
60
60
|
|
|
61
61
|
### Code map/skeleton
|
|
62
62
|
|
|
@@ -70,7 +70,7 @@ $ slopdex map -g '*.md' -e '^Guide\.Setup' -i --format json
|
|
|
70
70
|
$ slopdex map --no-reindex
|
|
71
71
|
```
|
|
72
72
|
|
|
73
|
-
The `map` command can be used to generate a source code skeleton that strips most of the code implementation but retains
|
|
73
|
+
The `map` command can be used to generate a source code skeleton that strips most of the code implementation but retains structurally useful information that can act as an index into the source code, which improves context usage.
|
|
74
74
|
|
|
75
75
|
See the [selector reference](docs/reference.md#shared-selectors).
|
|
76
76
|
|
|
@@ -80,9 +80,15 @@ By default all available indexes are searched and ranked together.
|
|
|
80
80
|
|
|
81
81
|
```console
|
|
82
82
|
$ slopdex search "keep the repository index synchronized"
|
|
83
|
-
|
|
84
|
-
0.
|
|
85
|
-
|
|
83
|
+
*** src/engine.rs
|
|
84
|
+
@@ 914-1082 @@ score=0.4284
|
|
85
|
+
impl Engine
|
|
86
|
+
pub fn search(&self, query: &str, kind: &str, options: &Value) -> Result<Vec<Value>>
|
|
87
|
+
|
|
88
|
+
*** src/engine.rs
|
|
89
|
+
@@ 376-409 @@ score=0.4200
|
|
90
|
+
impl Engine
|
|
91
|
+
pub fn map(&self, options: &Value) -> Result<Vec<Value>>
|
|
86
92
|
...
|
|
87
93
|
```
|
|
88
94
|
|
|
@@ -120,7 +126,7 @@ $ slopdex config fallback-model opencode-go/muse-spark-1.3-contributor
|
|
|
120
126
|
|
|
121
127
|
The fallback-model is used if the main model reports an error, and if the fallback-model reports an error the main model is tried again.
|
|
122
128
|
|
|
123
|
-
File and function descriptions are cached. Function
|
|
129
|
+
File and function descriptions are cached by source and description context, so renaming a file can reuse its descriptions. Function changes or a changed file-description context can require new callable descriptions. File descriptions after edits can be refreshed explicitly with `reindex-files`.
|
|
124
130
|
|
|
125
131
|
### Interactive Config
|
|
126
132
|
|
|
@@ -138,18 +144,27 @@ The intention of the `describe` command is to use a low-cost model to summarise
|
|
|
138
144
|
$ slopdex describe "I want to implement a new rpc endpoint"
|
|
139
145
|
```
|
|
140
146
|
|
|
141
|
-
|
|
147
|
+
The LLM receives expanded text search results with indexed code from callers and callees up to two edges away by default; it does not receive whole-file source.
|
|
142
148
|
|
|
143
149
|
### Find duplicate code
|
|
144
150
|
|
|
145
151
|
Compare functions across files, exclude short wrappers, and group matches into clusters:
|
|
146
152
|
|
|
147
153
|
```console
|
|
148
|
-
$ slopdex cross-search --cross-file-only --
|
|
149
|
-
Cluster 1
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
$ slopdex cross-search --cross-file-only --lines 4 --threshold 0.9
|
|
155
|
+
Cluster 1 · 3 functions · similarity 0.9124-0.9568
|
|
156
|
+
|
|
157
|
+
*** src/auth/session.ts
|
|
158
|
+
@@ 18-29 @@
|
|
159
|
+
export function validateSession(token: string): Session
|
|
160
|
+
|
|
161
|
+
*** src/http/middleware.ts
|
|
162
|
+
@@ 42-57 @@
|
|
163
|
+
export function authenticate(req: Request): Session
|
|
164
|
+
|
|
165
|
+
*** src/users/user-service.ts
|
|
166
|
+
@@ 27-48 @@ UserService.authenticate
|
|
167
|
+
authenticate(token: string): Session
|
|
153
168
|
...
|
|
154
169
|
```
|
|
155
170
|
|
|
@@ -160,11 +175,13 @@ Clusters join matches transitively, so a low threshold can connect many groups
|
|
|
160
175
|
into one large cluster. Use `0.9` for stricter duplicate detection, or explicitly
|
|
161
176
|
pass `--threshold 0.3` for the pre-rewrite default.
|
|
162
177
|
|
|
163
|
-
You can use threshold ranges as well
|
|
178
|
+
You can use threshold and line-count ranges as well. Range starts are inclusive
|
|
179
|
+
and ends are exclusive, so `--lines 4-20` selects functions with 4 through 19
|
|
180
|
+
lines:
|
|
164
181
|
|
|
165
182
|
```console
|
|
166
|
-
$ slopdex cross-search --cross-file-only --
|
|
167
|
-
$ slopdex cross-search --cross-file-only --
|
|
183
|
+
$ slopdex cross-search --cross-file-only --lines 4 --threshold 0.9
|
|
184
|
+
$ slopdex cross-search --cross-file-only --lines 4-20 --threshold 0.85-0.9
|
|
168
185
|
```
|
|
169
186
|
|
|
170
187
|
### Restrict functions used in the cross-search
|
|
@@ -172,7 +189,7 @@ $ slopdex cross-search --cross-file-only --min-lines 4 --threshold 0.85-0.9
|
|
|
172
189
|
Only use uncommitted working-tree functions as sources:
|
|
173
190
|
|
|
174
191
|
```console
|
|
175
|
-
$ slopdex cross-search --uncommitted --cross-file-only --
|
|
192
|
+
$ slopdex cross-search --uncommitted --cross-file-only --lines 4 --threshold 0.9
|
|
176
193
|
```
|
|
177
194
|
|
|
178
195
|
Only use functions changed since origin/main as sources:
|
|
@@ -196,17 +213,15 @@ $ slopdex cross-search --cross-file-only --cohesion --threshold 0.8
|
|
|
196
213
|
```
|
|
197
214
|
### Use with agents
|
|
198
215
|
|
|
199
|
-
Just put this in your `AGENTS.md` file, no skill
|
|
216
|
+
Just put this in your `AGENTS.md` file and adjust as desired, no skill necessary:
|
|
200
217
|
|
|
201
218
|
```
|
|
202
|
-
- use `slopdex map -g <glob> <files or directories...>` to obtain a compact structural code skeleton, and then perform targeted reads
|
|
203
|
-
- use semantic code search to find code with: `slopdex search "
|
|
204
|
-
- when reviewing uncommitted code avoid introducing duplicates by looking for related matches: `slopdex cross-search --uncommitted --threshold 0.8`
|
|
205
|
-
-
|
|
219
|
+
- use `slopdex map -g "<glob>" -i -e "<regex>" <files or directories...>` to obtain a compact structural code skeleton, and then perform targeted reads using the line numbers for implementation details. To filter for specific symbols, use `-e`. To only include specific kinds of symbols use `-k` with `imports`, `fns`, `consts`, `types`, or `classes`.
|
|
220
|
+
- use semantic code search to find code with: `slopdex search "<query>" --threshold 0.5`; vary the search query if you get no results
|
|
221
|
+
- when reviewing uncommitted code avoid introducing duplicates by looking for related matches: `slopdex cross-search --uncommitted --cross-file-only --threshold 0.8`
|
|
222
|
+
- when tasked to do advanced codebase analysis, use `slopdex --help` first to see all options
|
|
206
223
|
```
|
|
207
224
|
|
|
208
|
-
Any other use, like doing a full `cross-search` is probably better done interactively with the agent, in which case you can just ask the agent to run `slopdex --help` to get usage information.
|
|
209
|
-
|
|
210
225
|
### Reranking
|
|
211
226
|
|
|
212
227
|
Optionally a second-stage reranker can be enabled for all query-search commands:
|
|
@@ -223,10 +238,12 @@ $ slopdex config reranker cohere
|
|
|
223
238
|
```console
|
|
224
239
|
$ slopdex cross-search \
|
|
225
240
|
--target-root /path/to/other/repo \
|
|
226
|
-
--target-index /path/to/other/
|
|
241
|
+
--target-index /path/to/other/index.sqlite \
|
|
227
242
|
--threshold 0.9
|
|
228
243
|
```
|
|
229
244
|
|
|
245
|
+
Pass the target's `indexPath` from `slopdex --root /path/to/other/repo --format json status` (or a custom `--index` path) as `--target-index`.
|
|
246
|
+
|
|
230
247
|
### Inspect index health
|
|
231
248
|
|
|
232
249
|
If some functions can't be indexed a warning is printed. Index errors can be investigated and fixed with the `index-errors` command to ensure the index is complete.
|
package/npm-shrinkwrap.json
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"hasInstallScript": true,
|
|
20
20
|
"license": "MIT",
|
|
21
21
|
"name": "@ninjaxtools/slopdex",
|
|
22
|
-
"version": "0.
|
|
22
|
+
"version": "0.27.0"
|
|
23
23
|
},
|
|
24
24
|
"node_modules/detect-libc": {
|
|
25
25
|
"engines": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
}
|
|
49
49
|
},
|
|
50
50
|
"requires": true,
|
|
51
|
-
"version": "0.
|
|
51
|
+
"version": "0.27.0"
|
|
52
52
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"artifactDownloadUrls": [
|
|
3
|
-
"https://github.com/ninjaxtools/slopdex/releases/download/v0.
|
|
3
|
+
"https://github.com/ninjaxtools/slopdex/releases/download/v0.27.0"
|
|
4
4
|
],
|
|
5
5
|
"bin": {
|
|
6
6
|
"slopdex": "run-slopdex.js"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"zipExt": ".tar.xz"
|
|
81
81
|
}
|
|
82
82
|
},
|
|
83
|
-
"version": "0.
|
|
83
|
+
"version": "0.27.0",
|
|
84
84
|
"volta": {
|
|
85
85
|
"node": "18.14.1",
|
|
86
86
|
"npm": "9.5.0"
|