@ninjaxtools/slopdex 0.29.0 → 0.31.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 +45 -15
- package/npm-shrinkwrap.json +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -52,31 +52,47 @@ Vector search requires an embedding-provider API key from OpenAI or Jina.
|
|
|
52
52
|
|
|
53
53
|
```console
|
|
54
54
|
$ export OPENAI_API_KEY="your-api-key"
|
|
55
|
+
$ slopdex update
|
|
55
56
|
$ slopdex search "validate an authenticated session"
|
|
56
57
|
...
|
|
57
58
|
```
|
|
58
59
|
|
|
59
|
-
The index tracks the current Git commit and is
|
|
60
|
+
The index is created with the `update` command and tracks the current Git commit and is refreshed with the latest changes before it is used. Index data is stored in the current user's global 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
61
|
|
|
61
62
|
### Code map/skeleton
|
|
62
63
|
|
|
63
|
-
`slopdex map`
|
|
64
|
+
`slopdex map` works locally without a provider or API key.
|
|
64
65
|
|
|
65
66
|
```console
|
|
66
67
|
$ slopdex map src docs
|
|
67
68
|
$ slopdex map src -g '*.rs' -k fns -e 'refresh|search'
|
|
68
69
|
$ slopdex map src --private
|
|
69
70
|
$ slopdex map -g '*.md' -e '^Guide\.Setup' -i --format json
|
|
71
|
+
$ slopdex map docs --detail expanded
|
|
70
72
|
$ slopdex map --no-reindex
|
|
73
|
+
$ slopdex map src -q 'validate session' -q 'authenticate user' -k fns
|
|
74
|
+
$ slopdex map docs -q 'installation' --symbol-threshold 0.6 --detail expanded
|
|
71
75
|
```
|
|
72
76
|
|
|
73
77
|
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
78
|
|
|
79
|
+
Symbols can be filtered by using `-e <regex>` or `-q <symbol>` (OR). The `-q` filter uses vector search
|
|
80
|
+
and will be ignored if an index doesn't exist.
|
|
81
|
+
|
|
82
|
+
Use `--detail expanded` to to show full code or markdown of matched symbols.
|
|
83
|
+
|
|
75
84
|
See the [selector reference](docs/reference.md#shared-selectors).
|
|
76
85
|
|
|
86
|
+
> [!NOTE]
|
|
87
|
+
> Add this to your `AGENTS.md` to let the agent use the map command to explore the codebase:
|
|
88
|
+
>
|
|
89
|
+
> ```text
|
|
90
|
+
> - Start discovery with one scoped `slopdex map -g "<glob>" -i -e "<term|term>" -q "<short symbol concept>" --private --callers 2 --callees 2 <paths...>`. Use known paths or `.`. Immediately read plausible implementation ranges and follow calls in source; grep for usages or missing links. Map again only for unknown declaration locations. Batch reads; skip repeated inventories and setup/help.
|
|
91
|
+
> ```
|
|
92
|
+
|
|
77
93
|
### Search
|
|
78
94
|
|
|
79
|
-
By default
|
|
95
|
+
By default code/docs and generated descriptions, are searched and ranked together.
|
|
80
96
|
|
|
81
97
|
```console
|
|
82
98
|
$ slopdex search "keep the repository index synchronized"
|
|
@@ -97,9 +113,20 @@ To search code/docs individually:
|
|
|
97
113
|
```console
|
|
98
114
|
$ slopdex search-code "configure the embedding provider"
|
|
99
115
|
$ slopdex search-md "configure the embedding provider"
|
|
116
|
+
$ slopdex search-code 'reject expired credentials' -q 'validate session' --symbol-threshold 0.6
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
Symbol index is searched with either `search-symbols` or `--symbols`:
|
|
120
|
+
|
|
121
|
+
```console
|
|
122
|
+
$ slopdex search-symbols 'validate session' --threshold 0.6 --limit 20
|
|
123
|
+
$ slopdex search 'installation' --symbols -g '*.md' --detail expanded
|
|
124
|
+
$ slopdex search 'validate session' --code --symbols
|
|
125
|
+
$ slopdex search-symbols 'read settings' -q 'configuration' --symbol-threshold 0.7
|
|
100
126
|
```
|
|
101
127
|
|
|
102
|
-
You can also enable optional description generation which will automatically generate file and
|
|
128
|
+
You can also enable optional description generation which will automatically generate file and
|
|
129
|
+
function descriptions with a configured LLM provider and include them in the search.
|
|
103
130
|
|
|
104
131
|
I use OpenCode Go usually with DeepSeek or Muse Spark, which are fairly good low-cost models. If you
|
|
105
132
|
sign up for OpenCode Go through [this link](https://opencode.ai/go?ref=RAR3Z744DZ), we both receive
|
|
@@ -129,6 +156,13 @@ The fallback-model is used if the main model reports an error, and if the fallba
|
|
|
129
156
|
|
|
130
157
|
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 `index reindex-files`.
|
|
131
158
|
|
|
159
|
+
> [!NOTE]
|
|
160
|
+
> Add this to your `AGENTS.md` to use semantic code search with your agent:
|
|
161
|
+
>
|
|
162
|
+
> ```text
|
|
163
|
+
> - use semantic code search to find code with: `slopdex search "<query>" --threshold 0.3 --limit 20`; vary the search query if you get no results
|
|
164
|
+
> ```
|
|
165
|
+
|
|
132
166
|
### Interactive Config
|
|
133
167
|
|
|
134
168
|
To configure all configurable settings interactively run:
|
|
@@ -145,7 +179,7 @@ The intention of the `describe` command is to use a low-cost model to summarise
|
|
|
145
179
|
$ slopdex describe "I want to implement a new rpc endpoint"
|
|
146
180
|
```
|
|
147
181
|
|
|
148
|
-
|
|
182
|
+
First a `search` is performed with `--detail expanded` and `--expanded-callers 2` and `--expanded-callees 2` which expands generated descriptions and function implementations in the result, which is then given to an LLM which is asked to interpret the result, and the final output will be the result of the LLM interpretation as well as the `compact` results from the earlier search. This provides a tailored description for the specific query based on the `expanded` search results as well as the `compact` version of those results.
|
|
149
183
|
|
|
150
184
|
### Find duplicate code
|
|
151
185
|
|
|
@@ -170,6 +204,12 @@ lines:
|
|
|
170
204
|
$ slopdex cross-search --cross-file-only --lines 4 --threshold 0.9
|
|
171
205
|
$ slopdex cross-search --cross-file-only --lines 4-20 --threshold 0.85-0.9
|
|
172
206
|
```
|
|
207
|
+
> [!NOTE]
|
|
208
|
+
> Add this to your `AGENTS.md` to detect and refactor duplicate code before it is committed:
|
|
209
|
+
>
|
|
210
|
+
> ```text
|
|
211
|
+
> - when reviewing uncommitted determine if similar code elsewhere warrants a refactor: `slopdex cross-search --uncommitted --cross-file-only --threshold 0.8`
|
|
212
|
+
> ```
|
|
173
213
|
|
|
174
214
|
### Restrict functions used in the cross-search
|
|
175
215
|
|
|
@@ -198,16 +238,6 @@ When code is similar but not actually duplicated, then `--cohesion` can help fin
|
|
|
198
238
|
```console
|
|
199
239
|
$ slopdex cross-search --cross-file-only --cohesion --threshold 0.8
|
|
200
240
|
```
|
|
201
|
-
### Use with agents
|
|
202
|
-
|
|
203
|
-
Just put this in your `AGENTS.md` file and adjust as desired, no skill necessary:
|
|
204
|
-
|
|
205
|
-
```
|
|
206
|
-
- 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`.
|
|
207
|
-
- use semantic code search to find code with: `slopdex search "<query>" --threshold 0.5`; vary the search query if you get no results
|
|
208
|
-
- when reviewing uncommitted determine if similar code elsewhere warrants a refactor: `slopdex cross-search --uncommitted --cross-file-only --threshold 0.8`
|
|
209
|
-
- when tasked to do advanced codebase analysis, use `slopdex --help` first to see all options
|
|
210
|
-
```
|
|
211
241
|
|
|
212
242
|
### Reranking
|
|
213
243
|
|
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.31.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.31.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.31.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.31.0",
|
|
84
84
|
"volta": {
|
|
85
85
|
"node": "18.14.1",
|
|
86
86
|
"npm": "9.5.0"
|