dsh-code-index 0.10.1 → 0.10.2
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/CHANGELOG.md +8 -2
- package/README.md +12 -10
- package/README.zh.md +12 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/scripts/release-smoke.mjs +41 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-code-index",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"description": "Edit-ready Context Packs for DSH agents: bounded source excerpts, changes, related tests, and inclusion evidence — local-first.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -219,6 +219,23 @@ try {
|
|
|
219
219
|
writeFileSync(path.join(arkRoot, 'Broken.ets'), '@Component\nstruct Broken { build() {')
|
|
220
220
|
assert.match(await invoke('code_index', { repoRoot: arkRoot }), /index incomplete:/)
|
|
221
221
|
|
|
222
|
+
// Issue #5: exercise actual installed Rust signatures, not source imports.
|
|
223
|
+
const rustRoot = path.join(smokeDir, 'rust-repo')
|
|
224
|
+
mkdirSync(path.join(rustRoot, '.git'), { recursive: true })
|
|
225
|
+
writeFileSync(path.join(rustRoot, 'repro.rs'), [
|
|
226
|
+
'pub struct PublicOne { pub field: u32 }',
|
|
227
|
+
'struct PrivateOne { field: u32 }',
|
|
228
|
+
'pub enum PublicEnum { A }',
|
|
229
|
+
'enum PrivateEnum { A }',
|
|
230
|
+
'pub trait PublicTrait { fn run(&self); }',
|
|
231
|
+
'trait PrivateTrait { fn run(&self); }',
|
|
232
|
+
'pub fn public_function(a: u32) -> u32 { a }',
|
|
233
|
+
'fn private_function(a: u32) -> u32 { a }',
|
|
234
|
+
'pub(crate) struct CrateOnly;',
|
|
235
|
+
'pub(in crate) enum Restricted { A }',
|
|
236
|
+
'fn caller() { let value = PublicOne { field: public_function(1) }; }',
|
|
237
|
+
].join('\n'))
|
|
238
|
+
|
|
222
239
|
for (const dispose of disposers.reverse()) dispose()
|
|
223
240
|
|
|
224
241
|
const compactRegistered = []
|
|
@@ -272,6 +289,30 @@ try {
|
|
|
272
289
|
assert.equal(typeof result.value, outputFormat === 'pack' ? 'object' : 'string')
|
|
273
290
|
if (outputFormat === 'pack') assert.ok(JSON.stringify(result.value).length <= 5000)
|
|
274
291
|
}
|
|
292
|
+
await nativeInvoke('code_index', { action: 'build', repoRoot: rustRoot })
|
|
293
|
+
const rustSymbols = await nativeInvoke('code_symbols', { repoRoot: rustRoot })
|
|
294
|
+
assert.ok(rustSymbols.value.some(symbol => symbol.name === 'CrateOnly' && symbol.signature === 'CrateOnly' && !symbol.exported))
|
|
295
|
+
assert.ok(rustSymbols.value.some(symbol => symbol.name === 'Restricted' && symbol.signature === 'Restricted' && !symbol.exported))
|
|
296
|
+
const rustMap = await nativeInvoke('code_map', { repoRoot: rustRoot })
|
|
297
|
+
for (const name of ['PublicOne', 'PublicEnum', 'PublicTrait']) {
|
|
298
|
+
const search = await nativeInvoke('code_search', { query: name, repoRoot: rustRoot })
|
|
299
|
+
assert.equal(search.value[0]?.name, name)
|
|
300
|
+
assert.equal(search.value[0]?.signature, name)
|
|
301
|
+
assert.match(JSON.stringify(search.content), new RegExp(name))
|
|
302
|
+
assert.match(rustMap.value, new RegExp(name))
|
|
303
|
+
const refs = await nativeInvoke('code_refs', { symbol: name, repoRoot: rustRoot })
|
|
304
|
+
assert.match(refs.value, new RegExp(`${name} — repro.rs:`))
|
|
305
|
+
assert.match(refs.value, /callers \(0\)/) // no invented struct-literal/type-use edges
|
|
306
|
+
}
|
|
307
|
+
const rustFunction = await nativeInvoke('code_refs', { symbol: 'public_function', repoRoot: rustRoot })
|
|
308
|
+
assert.match(rustFunction.value, /callers \(1\)/)
|
|
309
|
+
for (const outputFormat of ['text', 'pack']) {
|
|
310
|
+
const result = await nativeInvoke('code_context', {
|
|
311
|
+
task: 'Explain PublicOne', repoRoot: rustRoot, outputFormat, budgetChars: 5000,
|
|
312
|
+
})
|
|
313
|
+
assert.match(JSON.stringify(result.content), /PublicOne/)
|
|
314
|
+
if (outputFormat === 'pack') assert.ok(result.value.items.some(item => item.name === 'PublicOne' && item.code?.includes('pub struct PublicOne')))
|
|
315
|
+
}
|
|
275
316
|
} finally {
|
|
276
317
|
for (const dispose of nativeDisposers.reverse()) dispose()
|
|
277
318
|
await nativeContext.fiber.dispose()
|