dsh-code-index 0.9.1 → 0.10.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.
@@ -0,0 +1,43 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026-present richerfu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
23
+ The MIT License (MIT)
24
+
25
+ Copyright (c) 2017 Max Brunsfeld
26
+
27
+ Permission is hereby granted, free of charge, to any person obtaining a copy
28
+ of this software and associated documentation files (the "Software"), to deal
29
+ in the Software without restriction, including without limitation the rights
30
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
31
+ copies of the Software, and to permit persons to whom the Software is
32
+ furnished to do so, subject to the following conditions:
33
+
34
+ The above copyright notice and this permission notice shall be included in all
35
+ copies or substantial portions of the Software.
36
+
37
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
38
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
39
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
40
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
41
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
42
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
43
+ SOFTWARE.
@@ -0,0 +1,25 @@
1
+ # ArkTS grammar asset
2
+
3
+ `tree-sitter-arkts.wasm` and `ARKTS-LICENSE` are copied unchanged from the
4
+ published **harmony-contrib/tree-sitter-arkts 0.3.0** npm archive, not compiled
5
+ from an unpinned branch. MIT notices for richerfu and Max Brunsfeld are retained.
6
+
7
+ - Source: https://github.com/harmony-contrib/tree-sitter-arkts
8
+ - npm: https://registry.npmjs.org/tree-sitter-arkts/-/tree-sitter-arkts-0.3.0.tgz
9
+ - Registry `gitHead`: `9a97c1e6ac93bc07732c15050a0e560bc63c8d78`
10
+ - Archive SHA1: `a02e2d883821af6036e1f9efc80f3f1e65227652`
11
+ - Archive integrity: `sha512-3mY013x1rWm8LLeuPp+kFLrl4vbQCfTEferO3GUwUhKHbQHzIT2ppjGARI3vNXIsuvQy/J8xJt2cIOlpfphlXQ==`
12
+ - WASM SHA256: `a5fbf24b2eeab43cf60e9fcdbde99e9089f7ceae43134d24e1d5cc166d285446`
13
+ - Size: 2,430,659 bytes; grammar ABI: 14.
14
+
15
+ Upstream publication regenerates with Tree-sitter CLI 0.24.4 / ABI 14 and builds
16
+ WASM with `tree-sitter build --wasm`. The upstream pipeline permits WASM build
17
+ failure; this specific archive was checked to contain the binary above. The
18
+ plugin vendors only this binary and license, and never imports upstream Node
19
+ bindings or runs `node-gyp-build`. No native compilation or network fetch occurs
20
+ when installing/loading the plugin. The package `files` list includes this directory.
21
+
22
+ To recover the exact asset, download the pinned archive, verify its integrity,
23
+ extract `package/tree-sitter-arkts.wasm` and `package/LICENSE`, then verify the
24
+ binary hash. `tests/arkts.spec.ts` checks the hash and actual runtime parsing;
25
+ `release:smoke` checks installed archive contents and `.ets` extraction.
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-code-index",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
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",
@@ -16,6 +16,7 @@
16
16
  "./package.json": "./package.json"
17
17
  },
18
18
  "files": [
19
+ "grammars",
19
20
  "dist",
20
21
  "scripts",
21
22
  "cordis.patch.yml",
@@ -63,10 +63,14 @@ function parseJsonArrayOutput(output, command) {
63
63
  throw new Error(`${command} did not return a JSON array`)
64
64
  }
65
65
 
66
- const packed = parseJsonArrayOutput(run(npm, ['pack', '--ignore-scripts', '--json'], root), 'npm pack')
67
- assert.equal(packed.length, 1, 'npm pack must produce exactly one artifact')
68
- const tarball = path.resolve(root, packed[0].filename)
69
- const listed = new Set(packed[0].files.map((file) => file.path))
66
+ // A release gate can reuse one immutable candidate across Node versions.
67
+ const suppliedTarball = process.argv[2] ? path.resolve(process.argv[2]) : null
68
+ const packed = suppliedTarball ? null : parseJsonArrayOutput(run(npm, ['pack', '--ignore-scripts', '--json'], root), 'npm pack')
69
+ if (packed) assert.equal(packed.length, 1, 'npm pack must produce exactly one artifact')
70
+ const tarball = suppliedTarball ?? path.resolve(root, packed[0].filename)
71
+ const listed = suppliedTarball
72
+ ? new Set(run('tar', ['-tzf', tarball], root).trim().split(/\r?\n/).map(file => file.replace(/^package\//, '')))
73
+ : new Set(packed[0].files.map((file) => file.path))
70
74
  const expectedFiles = [
71
75
  'package.json',
72
76
  'README.md',
@@ -77,6 +81,9 @@ const expectedFiles = [
77
81
  'dist/index.js',
78
82
  'dist/index.d.ts',
79
83
  'dist/client.js',
84
+ 'grammars/tree-sitter-arkts.wasm',
85
+ 'grammars/ARKTS-LICENSE',
86
+ 'grammars/README.md',
80
87
  'scripts/fix-wsl-links.mjs',
81
88
  'scripts/release-smoke.mjs',
82
89
  ]
@@ -181,6 +188,32 @@ try {
181
188
  rmSync(freshSource)
182
189
  assert.deepEqual(await invoke('code_search', { query: 'FRESH_MARKER_fn', repoRoot: whitelistRoot }), [])
183
190
 
191
+ // ArkTS must work from the actual installed package, without native grammar
192
+ // bindings or the source checkout. Keep the fixture tiny and mixed ETS/TS.
193
+ const arkRoot = path.join(smokeDir, 'arkts-repo')
194
+ mkdirSync(path.join(arkRoot, '.git'), { recursive: true })
195
+ writeFileSync(path.join(arkRoot, 'logic.ts'), 'export function label() { return "package ArkTS" }\n')
196
+ const card = '@ComponentV2\nexport struct PackageCard {\n @Local count: number = 0;\n build() { Column() { Text(label()) } }\n}\n'
197
+ writeFileSync(path.join(arkRoot, 'Card.ets'), "import { label } from './logic'\n" + card)
198
+ const arkIndex = await plugin.buildIndex(arkRoot)
199
+ assert.equal(arkIndex.files.length, 2)
200
+ assert.ok(arkIndex.files.every(file => file.diagnostic.status === 'parsed'))
201
+ assert.equal(arkIndex.files.find(file => file.path === 'Card.ets').lang, 'arkts')
202
+ assert.equal((await invoke('code_search', { query: 'PackageCard', repoRoot: arkRoot }))[0]?.file, 'Card.ets')
203
+ const arkPack = await invoke('code_context', { task: 'Explain PackageCard in Card.ets', repoRoot: arkRoot, outputFormat: 'pack', budgetChars: 5000 })
204
+ assert.ok(arkPack.items.some(item => item.name === 'PackageCard' && item.code?.includes('@ComponentV2')))
205
+ assert.ok(JSON.stringify(arkPack).length <= 5000)
206
+ assert.ok(arkPack.items.some(item => item.name === 'label' && item.provenance === 'explicit-import-binding'))
207
+ const arkFresh = path.join(arkRoot, 'Fresh.ets')
208
+ writeFileSync(arkFresh, 'export function ARK_PACKAGE_ADDED() {}\n')
209
+ assert.equal((await invoke('code_search', { query: 'ARK_PACKAGE_ADDED', repoRoot: arkRoot }))[0]?.name, 'ARK_PACKAGE_ADDED')
210
+ writeFileSync(arkFresh, 'export function ARK_PACKAGE_EDITED() {}\n')
211
+ assert.equal((await invoke('code_search', { query: 'ARK_PACKAGE_EDITED', repoRoot: arkRoot }))[0]?.name, 'ARK_PACKAGE_EDITED')
212
+ rmSync(arkFresh)
213
+ assert.deepEqual(await invoke('code_search', { query: 'ARK_PACKAGE_EDITED', repoRoot: arkRoot }), [])
214
+ writeFileSync(path.join(arkRoot, 'Broken.ets'), '@Component\nstruct Broken { build() {')
215
+ assert.match(await invoke('code_index', { repoRoot: arkRoot }), /index incomplete:/)
216
+
184
217
  for (const dispose of disposers.reverse()) dispose()
185
218
 
186
219
  const compactRegistered = []
@@ -206,5 +239,5 @@ try {
206
239
  console.log(`release smoke passed for ${packageJson.name}@${packageJson.version}`)
207
240
  } finally {
208
241
  rmSync(smokeDir, { recursive: true, force: true })
209
- rmSync(tarball, { force: true })
242
+ if (!suppliedTarball) rmSync(tarball, { force: true })
210
243
  }