dsh-code-index 0.5.0 → 0.6.1

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "dsh-code-index",
3
- "version": "0.5.0",
4
- "description": "Semantic repo index for DeepSeek Harness — tree-sitter symbol index, code search, and a bounded ranked repo map injected into agent context.",
3
+ "version": "0.6.1",
4
+ "description": "Structural context engine for DSH — tree-sitter symbol index, ranked search, repo map, call graph, and change-aware context.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -18,7 +18,8 @@
18
18
  "files": [
19
19
  "dist",
20
20
  "scripts",
21
- "cordis.patch.yml"
21
+ "cordis.patch.yml",
22
+ "CHANGELOG.md"
22
23
  ],
23
24
  "scripts": {
24
25
  "build": "tsup && tsup --config tsup.client.config.ts",
@@ -26,6 +27,7 @@
26
27
  "dev:client": "tsup --config tsup.client.config.ts --watch",
27
28
  "test": "vitest run",
28
29
  "typecheck": "tsc --noEmit",
30
+ "release:smoke": "node scripts/release-smoke.mjs",
29
31
  "fix:wsl-links": "node scripts/fix-wsl-links.mjs",
30
32
  "prepare": "tsup && tsup --config tsup.client.config.ts",
31
33
  "prepublishOnly": "tsup && tsup --config tsup.client.config.ts"
File without changes
@@ -0,0 +1,111 @@
1
+ import assert from 'node:assert/strict'
2
+ import { execFileSync } from 'node:child_process'
3
+ import { mkdtempSync, readFileSync, rmSync } from 'node:fs'
4
+ import os from 'node:os'
5
+ import path from 'node:path'
6
+ import { fileURLToPath, pathToFileURL } from 'node:url'
7
+
8
+ const root = path.resolve(fileURLToPath(new URL('..', import.meta.url)))
9
+ const packageJson = JSON.parse(readFileSync(path.join(root, 'package.json'), 'utf8'))
10
+ const npm = 'npm'
11
+
12
+ function shellQuote(value) {
13
+ return /[\s"]/.test(value) ? `"${value.replace(/"/g, '\\"')}"` : value
14
+ }
15
+
16
+ function run(command, args, cwd) {
17
+ const invocation = [command, ...args].map(shellQuote).join(' ')
18
+ const commandArgs = process.platform === 'win32'
19
+ ? ['/d', '/s', '/c', invocation]
20
+ : args
21
+ const executable = process.platform === 'win32' ? process.env.ComSpec ?? 'cmd.exe' : command
22
+ const executableArgs = process.platform === 'win32' ? commandArgs : args
23
+ return execFileSync(executable, executableArgs, {
24
+ cwd,
25
+ encoding: 'utf8',
26
+ stdio: ['ignore', 'pipe', 'inherit'],
27
+ })
28
+ }
29
+
30
+ const packed = JSON.parse(run(npm, ['pack', '--ignore-scripts', '--json'], root))
31
+ assert.equal(packed.length, 1, 'npm pack must produce exactly one artifact')
32
+ const tarball = path.resolve(root, packed[0].filename)
33
+ const listed = new Set(packed[0].files.map((file) => file.path))
34
+ const expectedFiles = [
35
+ 'package.json',
36
+ 'README.md',
37
+ 'README.zh.md',
38
+ 'CHANGELOG.md',
39
+ 'LICENSE',
40
+ 'cordis.patch.yml',
41
+ 'dist/index.js',
42
+ 'dist/client.js',
43
+ 'scripts/fix-wsl-links.mjs',
44
+ 'scripts/release-smoke.mjs',
45
+ ]
46
+ for (const file of expectedFiles) assert.ok(listed.has(file), `tarball is missing ${file}`)
47
+
48
+ const smokeDir = mkdtempSync(path.join(os.tmpdir(), 'dsh-code-index-release-'))
49
+ try {
50
+ run(npm, ['init', '--yes'], smokeDir)
51
+ run(npm, ['install', '--ignore-scripts', '--no-save', tarball], smokeDir)
52
+
53
+ const installedPackage = JSON.parse(
54
+ readFileSync(path.join(smokeDir, 'node_modules', packageJson.name, 'package.json'), 'utf8'),
55
+ )
56
+ assert.equal(installedPackage.version, packageJson.version)
57
+ assert.equal(installedPackage.main, './dist/index.js')
58
+ assert.equal(installedPackage.exports['.'].default, './dist/index.js')
59
+ assert.match(installedPackage.engines.node, />=22/)
60
+ assert.equal(installedPackage.license, 'MIT')
61
+
62
+ const plugin = await import(
63
+ pathToFileURL(path.join(smokeDir, 'node_modules', packageJson.name, 'dist', 'index.js')).href,
64
+ )
65
+ const registered = []
66
+ const disposers = []
67
+ const ctx = {
68
+ effect(effect) {
69
+ const disposer = effect()
70
+ if (typeof disposer === 'function') disposers.push(disposer)
71
+ },
72
+ tools: {
73
+ register(tool) {
74
+ registered.push(tool.name)
75
+ return () => {}
76
+ },
77
+ },
78
+ systemPrompt: { section: () => () => {} },
79
+ }
80
+ plugin.apply(ctx, { autoInject: false, codeHealth: true })
81
+ assert.deepEqual(registered, [
82
+ 'code_index',
83
+ 'code_symbols',
84
+ 'code_search',
85
+ 'code_map',
86
+ 'code_refs',
87
+ 'code_change_context',
88
+ 'code_health',
89
+ ])
90
+
91
+ const exec = { agent: { session: { header: { cwd: root } } } }
92
+ const tools = new Map(plugin.tools.map((tool) => [tool.name, tool]))
93
+ const invoke = (name, args) => tools.get(name).execute(args, exec)
94
+ const status = await invoke('code_index', { action: 'build', repoRoot: root })
95
+ assert.match(status, /files indexed:/)
96
+ assert.ok(Array.isArray(await invoke('code_symbols', { limit: 2, repoRoot: root })))
97
+ assert.ok(Array.isArray(await invoke('code_search', { query: 'buildIndex', repoRoot: root })))
98
+ assert.match(await invoke('code_map', { repoRoot: root }), /repo map|no indexable symbols/)
99
+ assert.match(await invoke('code_refs', { symbol: 'buildIndex', repoRoot: root }), /definitions:|no definition/)
100
+ assert.match(
101
+ await invoke('code_change_context', { files: ['src/index.ts'], repoRoot: root }),
102
+ /CHANGED:/,
103
+ )
104
+ assert.match(await invoke('code_health', { repoRoot: root }), /repo health/)
105
+
106
+ for (const dispose of disposers.reverse()) dispose()
107
+ console.log(`release smoke passed for ${packageJson.name}@${packageJson.version}`)
108
+ } finally {
109
+ rmSync(smokeDir, { recursive: true, force: true })
110
+ rmSync(tarball, { force: true })
111
+ }