dsh-code-index 0.9.0 → 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.
package/CHANGELOG.md CHANGED
@@ -2,7 +2,32 @@
2
2
 
3
3
  All notable changes to dsh-code-index are documented here.
4
4
 
5
- ## 0.9.0 — Edit-ready Context Packs (unreleased)
5
+ ## 0.10.0 — ArkTS & Reliable Code Context (stable candidate, unreleased)
6
+
7
+ - Add dedicated `.ets` parsing using pinned harmony-contrib/tree-sitter-arkts
8
+ 0.3.0 / ABI-14 WASM bundled with MIT notices; no native grammar installation.
9
+ - Extract component structs, methods, fields, decorators and TS-style business
10
+ declarations with stable qualified IDs and decorator-inclusive source ranges.
11
+ Integrate mixed ETS/TS imports, tools, Git changes and Context Packs.
12
+ - Avoid UI built-in/attribute false relationships: UI calls need local or explicit
13
+ bindings; decorators/leading-dot modifiers are metadata. Keep default imports
14
+ import-scoped and ambiguous ETS/TS stems unresolved. No state/rerender graph.
15
+ - Record lightweight parsed/partial/failed diagnostics and bounded issue locations;
16
+ omit unreliable ArkTS declarations, report index gaps, and rebuild schema-2 caches.
17
+ - Add 15 ArkTS regression tests and pinned official sources (seven Browser files,
18
+ all 15 `@Local` documentation snippets). Node 22.23.3 and 24.19.0 each pass
19
+ 235 tests, typecheck, server/client builds and real package-consumer smoke.
20
+ See `RELEASE_EVIDENCE_v0.10.0.md` for actual methods and Desktop results.
21
+ - v0.9.1 remains the published stable version. No v0.10 tag, npm publication,
22
+ GitHub Release or main push has been performed.
23
+
24
+ ## 0.9.1 — Gitignore directory whitelist fix (2026-10-10)
25
+
26
+ - Fix Gitignore directory whitelist rules (`!dir/`) silently excluding source trees: directory probes now retain their trailing slash in both the scanner and watcher. Thanks to @bbskye5008 for the detailed report and reproduction in [Issue #2](https://github.com/lemonxiny55/dsh-code-index/issues/2).
27
+ - Apply nested `.gitignore` precedence consistently, while preserving Git's rule that files inside an ignored parent directory cannot be re-included. Add regressions for source/context retrieval, affected tests, and external add/change/delete freshness.
28
+ - Verified on Node 22/24 and with a real DSH Desktop Agent using the packaged candidate. See `RELEASE_EVIDENCE_v0.9.1.md` for methods, results and publication status.
29
+
30
+ ## 0.9.0 — Edit-ready Context Packs (2026-10-05)
6
31
 
7
32
  - `code_context` now includes bounded, whole-line source excerpts for primary declarations, strong callers/callees, imports, likely tests and changes. Overlapping current/base ranges are deduplicated independently. Large declarations degrade to changed-line windows, then signature-only metadata.
8
33
  - One final ContextPack DTO selects candidates before presentation; both text and serialized pack respect the normalized hard character budget. Default canonical output stays a string; explicit `outputFormat: pack` enables structured output.
@@ -11,7 +36,8 @@ All notable changes to dsh-code-index are documented here.
11
36
  - Deterministic camel/snake, filename/path/signature terms, bounded graph neighborhoods, and clean-tree test seeds improve task selection. No BM25 or architecture rewrite.
12
37
  - Added executable context-quality contracts for task recall, source evidence, noise exclusion, budget, isolation, worktrees, freshness, overlap and classification.
13
38
  - Development target moves to matching DSH/dsh-tools `0.2.0-rc.2`. Full/compact surfaces, v0.8 configuration, Node 22/24, local-first behavior, and text calls remain supported. Public declaration files are now included in the package.
14
- - Synced English/Chinese product docs and added a reproducible 30-second recording of real local tool calls. Web Context Card is deferred pending real Agent/replay/navigation validation; no Card screenshot or benchmark claim is made.
39
+ - Synced English/Chinese product docs and added a reproducible 30-second recording of real local tool calls. Web Context Card is deferred; Card replay/navigation remain unverified. No Card screenshot or benchmark claim is made.
40
+ - Final DSH Desktop `0.2.0-rc.2` real Agent verification passed: default text and explicit pack calls, bounded source/reasons/provenance, related tests, change classification and external freshness. The npm package was published manually on 2026-10-05.
15
41
 
16
42
  See `RELEASE_EVIDENCE_v0.9.0.md` for verified checks and release boundaries.
17
43
 
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  English | [中文](README.zh.md)
7
7
 
8
- **v0.9.0 — Edit-ready Context Packs**
8
+ **v0.10.0 stable candidate — ArkTS & Reliable Code Context**
9
9
 
10
10
  Give your [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) agent the bounded source context it needs to start a code task. One `code_context` call selects primary declarations, strong callers/callees, imports, current changes, and likely tests, with exact source ranges and reasons for inclusion. When evidence is missing, the pack says so.
11
11
 
@@ -14,7 +14,11 @@ Give your [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) ag
14
14
  - **Evidence you can inspect:** inclusion reasons are separate from `exact` / `import-scoped` / `name-only` relationship provenance. No probability or confidence estimate is invented.
15
15
  - **Local and current:** isolated repo/worktree indexes, external add/change/delete freshness, no external indexing API key. Existing full/compact surfaces and v0.8 configuration remain supported.
16
16
 
17
- This checkout contains the v0.9 release candidate. It has not been published; an npm install still receives the latest published version. See [release evidence](RELEASE_EVIDENCE_v0.9.0.md).
17
+ v0.9.1 is published on npm and fixes Gitignore directory whitelist rules that silently omitted source trees. The packaged candidate passed real Agent verification in DSH Desktop `0.2.0-rc.2`. See [release evidence](RELEASE_EVIDENCE_v0.9.1.md).
18
+
19
+ This branch prepares the unpublished `0.10.0` stable candidate; npm `latest` remains v0.9.1.
20
+ ArkTS `.ets` files now use a pinned, bundled MIT grammar rather than the TS
21
+ parser. See [ArkTS PoC](ARKTS_POC_v0.10.0.md) and [v0.10 evidence](RELEASE_EVIDENCE_v0.10.0.md).
18
22
 
19
23
  ## On this page
20
24
 
@@ -30,16 +34,14 @@ This checkout contains the v0.9 release candidate. It has not been published; an
30
34
 
31
35
  ## Quick start
32
36
 
33
- Requires Node 22/24 and a matching DSH `0.2.0-rc.2` host group. For this unreleased checkout, build and install locally from the repository root:
37
+ Requires Node 22/24 and a matching DSH `0.2.0-rc.2` host group. Install the published version into a Web profile:
34
38
 
35
39
  ```sh
36
- pnpm install
37
- pnpm build
38
- npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add .
40
+ npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add dsh-code-index@0.9.1
39
41
  npx @deepseek-ai/dsh@0.2.0-rc.2 web
40
42
  ```
41
43
 
42
- Use the published-package command in [Install](#install) only when you intend to install the registry version, with its matching host.
44
+ For local development, run `pnpm install` and `pnpm build` at the repository root, then use `plugin --profile web add .`. See [Install](#install) for profile options.
43
45
 
44
46
  ## Project isolation and live updates
45
47
 
@@ -54,22 +56,19 @@ Each Git worktree gets its own index and change state. The plugin watches projec
54
56
 
55
57
  ## See it in action
56
58
 
57
- [30-second recorded demo](assets/context-pack-demo.html) · [terminal recording](assets/context-pack-demo.cast)
59
+ **42 seconds in DSH Desktop: why did loading `' input '` produce `'INPUT'`?**
58
60
 
59
- Download the HTML replay and open it locally, or play the cast with an asciinema-compatible player. Reproduce with `pnpm build`, then `node scripts/context-pack-demo.mjs`. The recording uses actual local tool calls in a tiny Git repository; it does not claim an Agent task-success or performance benchmark.
61
+ ![Actual DSH Desktop Agent calling code_context, with a bilingual task and explanation](assets/desktop-agent-v090.gif)
60
62
 
61
- `code_context({ task: "Explain loadConfig", budgetChars: 5000 })` returns source immediately. An excerpt from the recorded call:
63
+ One real `code_context` call returned `loadConfig` at `src/config.ts:1–3`, its callers, Git additions/modifications/deletions, and a likely test, with inclusion reasons and relationship provenance: **2347/5000 characters**. The Agent used that context to identify `.toUpperCase()` as the cause.
62
64
 
63
- ```text
64
- primary: loadConfig src/config.ts:1-3 [current]
65
- Reason: task names this symbol
66
- Source (complete):
67
- export function loadConfig(input: string) {
68
- return input.trim()
69
- }
70
- ```
65
+ This is **actual desktop footage recorded on 2026-10-08**, using the installed v0.9.0 plugin and a tiny demonstration repository. Only DSH is shown; waiting was cut and audio removed. No files were edited or tests run. The clip is not a latency measurement or a claim that a fix/tests succeeded. [MP4](assets/desktop-agent-v090.mp4) · [Recording notes and provenance](assets/desktop-agent-v090.md) · [Actual tool-card evidence](assets/desktop-agent-v090.evidence.json).
66
+
67
+ The earlier [bilingual terminal replay](assets/agent-context-demo.md) remains available as a separate, clearly labeled replay of audited 2026-10-05 Agent records. It also shows external-edit freshness and a 500-character signature-only fallback.
68
+
69
+ Try asking: **“Use code_context to locate a config-loading bug, show the relevant source and callers, and identify likely tests.”** Tell us what helped or what context was missing in the [DSH discussion](https://github.com/deepseek-ai/deepseek-harness/discussions/5623).
71
70
 
72
- The demo then makes an external edit, shows added/modified/deleted declarations with separate current/base source, and requests a 500-character pack. Web Context Card is deferred until real Agent execution, replay, and file navigation can be verified on the matching RC. The existing text presentation remains usable.
71
+ The earlier [30-second local tool demo](assets/context-pack-demo.html) remains available and can be reproduced with `pnpm build`, then `node scripts/context-pack-demo.mjs`. Web Context Card remains deferred; Card replay and file navigation have not been verified.
73
72
 
74
73
  ## Tools
75
74
 
@@ -90,19 +89,19 @@ Plus an optional **auto-injected system prompt section** (`code-index:repo-map`,
90
89
 
91
90
  Requires `dsh` (any install path — npx, npm, or source) and Node ≥ 22.
92
91
 
93
- The development compatibility target is `@deepseek-ai/dsh@0.2.0-rc.2` / `@deepseek-ai/dsh-tools@0.2.0-rc.2` (Node 22 and 24 CI matrix). The DSH plugin surface is still a preview API, so upstream changes may require compatibility updates.
92
+ The verified compatibility target is `@deepseek-ai/dsh@0.2.0-rc.2` / `@deepseek-ai/dsh-tools@0.2.0-rc.2` (Node 22 and 24 verification matrix). The DSH plugin surface is still a preview API, so upstream changes may require compatibility updates.
94
93
 
95
94
  v0.9 requires the matching `0.2.0-rc.2` tool runtime; the peer pin prevents fresh npm installs from selecting the older registry `latest` tag. Upgrade the host group together. The text/config/tool-surface compatibility above does not promise support for older DSH APIs.
96
95
 
97
96
  ```sh
98
97
  # from npm (prebuilt)
99
- npx @deepseek-ai/dsh plugin --profile web add dsh-code-index
98
+ npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add dsh-code-index@0.9.0
100
99
 
101
100
  # or from a directory containing this checkout
102
- npx @deepseek-ai/dsh plugin --profile web add ./dsh-code-index
101
+ npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add ./dsh-code-index
103
102
  ```
104
103
 
105
- Restart the Web UI (`npx @deepseek-ai/dsh web`) — startup logs confirm each tool:
104
+ Restart the Web UI (`npx @deepseek-ai/dsh@0.2.0-rc.2 web`) — startup logs confirm each tool:
106
105
 
107
106
  ```
108
107
  [dsh-code-index] plugin loaded
@@ -178,7 +177,38 @@ Options are passed as the plugin row's `config` in the profile patch (or default
178
177
 
179
178
  ## Supported languages
180
179
 
181
- TypeScript, JavaScript, Python, Go, Rust, Java, C++ and C (`.ts .tsx .mts .cts .js .jsx .mjs .cjs .py .pyi .go .rs .java .cpp .cc .cxx .c++ .hpp .hxx .hh .h .ipp .tpp .inl .c`) via tree-sitter WASM — pure parsing, no native build. The symbol provider seam (`src/extract.ts` + grammars) is where other languages/embeddings plug in later. C/C++ symbol extraction resolves names through the declarator chain (templates, qualified `ns::name` definitions, in-class methods), and `#include "…"` specifiers feed the repo-map reference graph.
180
+ ArkTS, TypeScript, JavaScript, Python, Go, Rust, Java, C++ and C (`.ets .ts .tsx .mts .cts .js .jsx .mjs .cjs .py .pyi .go .rs .java .cpp .cc .cxx .c++ .hpp .hxx .hh .h .ipp .tpp .inl .c`) via tree-sitter WASM — pure parsing, no native build. The symbol provider seam (`src/extract.ts` + grammars) is where other languages/embeddings plug in later. C/C++ symbol extraction resolves names through the declarator chain (templates, qualified `ns::name` definitions, in-class methods), and `#include "…"` specifiers feed the repo-map reference graph.
181
+
182
+ ### ArkTS scope and limits
183
+
184
+ - Components declared with `struct` appear as `kind: class`, signature `struct Name`.
185
+ Methods, fields, global functions, classes/interfaces/types/enums and module
186
+ variables have stable qualified IDs, owners and source line ranges. Decorators
187
+ (`@Component`, `@ComponentV2`, `@State`, `@Local`, `@Builder`, etc.) are retained
188
+ as metadata and included in the definition's source range.
189
+ - `build()` and nested declarative UI blocks parse as ArkTS. Local components and
190
+ explicit ETS/TS imports feed symbols, search, map, references, change context
191
+ and Context Packs. `@Extend` metadata and UI attribute chains are excluded from
192
+ call relationships. Bare capitalized calls in UI bodies have no global-name or
193
+ imported-module fallback; unbound SDK components cannot acquire unrelated
194
+ same-named project targets. Ordinary callback/business calls retain existing
195
+ provenance. `code_refs` uses binding-aware candidates for ArkTS call sites.
196
+ - Relative mixed ETS/TS imports work when the target is statically unique.
197
+ Extensionless stems with both ETS and another source file stay unresolved.
198
+ Default imports remain `import-scoped`; no HAR/oh-package/module alias, SDK
199
+ typing, re-export chain, state-update or UI rerender semantics are inferred.
200
+ Unbound/global custom UI components may therefore have no relationship edge.
201
+ Syntax acceptance does not prove valid ArkTS or HarmonyOS runtime behavior.
202
+ - Each indexed file records `parsed`, `partial`, or `failed` syntax/read status,
203
+ ERROR/MISSING counts and at most three issue locations. Unreliable ArkTS
204
+ declarations are omitted rather than assigned misleading IDs. `code_index`
205
+ reports a bounded incomplete-index summary, and Context Packs/change context
206
+ carry gaps within their existing budgets. `parsed` means syntax extraction
207
+ completed, not that the index contains every semantic reference. Cache schema
208
+ 3 rebuilds older caches automatically; source bodies remain unpersisted.
209
+ - Grammar: [harmony-contrib 0.3.0](https://github.com/harmony-contrib/tree-sitter-arkts),
210
+ ABI 14, unchanged npm WASM bundled with its MIT notices. Consumer installation
211
+ requires no native ArkTS addon. [Asset provenance](grammars/README.md).
182
212
 
183
213
  ## How it works
184
214
 
package/README.zh.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [English](README.md) | 中文
4
4
 
5
- **v0.9.0 — Edit-ready Context Packs**
5
+ **v0.10.0 稳定候选 — ArkTS & Reliable Code Context**
6
6
 
7
7
  让 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) Agent 用一次 `code_context` 调用拿到开始处理任务所需的有界源码上下文:主要声明、强相关 caller/callee、imports、当前变化和相关测试。每个关键 item 都有入选理由,源码有准确行号;证据不足时明确说明缺口。
8
8
 
@@ -11,7 +11,11 @@
11
11
  - **可检查的证据:**入选 reason 与关系的 `exact` / `import-scoped` / `name-only` provenance 分开,不编造概率或 confidence。
12
12
  - **本地、隔离、实时:**repo/worktree 独立,外部增改删自动刷新,不需要外部索引 API key;保留 full/compact surface 和 v0.8 配置。
13
13
 
14
- 当前 checkout 是 v0.9 发布候选,尚未发布;npm 安装得到的仍是最新已发布版本。验证边界见[release evidence](RELEASE_EVIDENCE_v0.9.0.md)。
14
+ v0.9.1 已发布到 npm,修复了 Gitignore 目录白名单规则静默遗漏源码的问题。打包候选产物已通过 DSH Desktop `0.2.0-rc.2` 真实 Agent 验证。验证边界见[release evidence](RELEASE_EVIDENCE_v0.9.1.md)。
15
+
16
+ 本分支准备尚未发布的 `0.10.0` 稳定候选,npm `latest` 仍是已发布的 v0.9.1。
17
+ `.ets` 现在使用锁定版本、随包附带 MIT 许可证的 ArkTS grammar,独立于 TS parser。
18
+ 见 [ArkTS PoC](ARKTS_POC_v0.10.0.md) 和 [v0.10 验证证据](RELEASE_EVIDENCE_v0.10.0.md)。
15
19
 
16
20
  ## 本页导航
17
21
 
@@ -27,16 +31,14 @@
27
31
 
28
32
  ## 快速开始
29
33
 
30
- 需要 Node 22/24 与匹配的 DSH `0.2.0-rc.2` 宿主版本组。当前版本尚未发布,在仓库根目录构建并本地安装:
34
+ 需要 Node 22/24 与匹配的 DSH `0.2.0-rc.2` 宿主版本组。将已发布版本安装到 Web profile:
31
35
 
32
36
  ```sh
33
- pnpm install
34
- pnpm build
35
- npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add .
37
+ npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add dsh-code-index@0.9.1
36
38
  npx @deepseek-ai/dsh@0.2.0-rc.2 web
37
39
  ```
38
40
 
39
- 只有想安装 registry 已发布版本时,才使用[安装说明](#安装)中的 npm 包命令,并匹配该版本的宿主。
41
+ 本地开发时,在仓库根目录运行 `pnpm install`、`pnpm build`,然后使用 `plugin --profile web add .`。其他 profile 选项见[安装说明](#安装)。
40
42
 
41
43
  ## 项目隔离与实时更新
42
44
 
@@ -51,22 +53,19 @@ npx @deepseek-ai/dsh@0.2.0-rc.2 web
51
53
 
52
54
  ## 实际效果
53
55
 
54
- [30 秒真实调用回放](assets/context-pack-demo.html) · [终端录制](assets/context-pack-demo.cast)
56
+ **42 秒真实 DSH 桌面演示:加载 `' input '` 为什么变成了 `'INPUT'`?**
55
57
 
56
- 下载 HTML 后本地打开,或使用兼容 asciinema 的播放器。复现方式:`pnpm build`,再运行 `node scripts/context-pack-demo.mjs`。录制内容是在小型 Git 仓库中的实际本地工具调用,不代表 Agent 任务成功率或性能 benchmark。
58
+ ![真实 DSH Desktop Agent 调用 code_context,含中英文任务与解释](assets/desktop-agent-v090.gif)
57
59
 
58
- `code_context({ task: "Explain loadConfig", budgetChars: 5000 })` 直接返回源码。以下摘自实际录制输出:
60
+ 一次真实 `code_context` 调用返回 `src/config.ts:1–3` 的 `loadConfig`、调用方、Git 增改删和相关测试线索,附入选理由与关系来源,共 **2347/5000 字符**。Agent 据此定位到改变大小写的 `.toUpperCase()`。
59
61
 
60
- ```text
61
- primary: loadConfig src/config.ts:1-3 [current]
62
- Reason: task names this symbol
63
- Source (complete):
64
- export function loadConfig(input: string) {
65
- return input.trim()
66
- }
67
- ```
62
+ 这是 **2026-10-08 新录制的真实桌面画面**,使用已安装的 v0.9.0 与一个小演示仓库。只展示 DSH,剪去等待并移除音轨;没有修改文件或运行测试,不代表实际耗时,也不宣称修复或测试成功。[MP4 视频](assets/desktop-agent-v090.mp4) · [录制与来源说明](assets/desktop-agent-v090.md) · [实际工具卡片证据](assets/desktop-agent-v090.evidence.json)。
63
+
64
+ 先前的[中英终端回放](assets/agent-context-demo.md)继续保留,单独标明来自 2026-10-05 的真实 Agent 记录,补充展示外部编辑刷新及 500 字符下的签名降级。
65
+
66
+ 可以先试一句:**“用 code_context 定位一个配置加载 Bug,给出相关源码、调用者和可能受影响的测试。”** 欢迎在 [DSH Discussion](https://github.com/deepseek-ai/deepseek-harness/discussions/5623) 分享哪些上下文有帮助、哪些被漏掉。
68
67
 
69
- 随后 demo 从外部修改文件,展示 added/modified/deleted 及独立的 current/base 源码,再请求 500 字符预算。Web Context Card 延期,等待匹配 RC 上真实 Agent 调用、replay 和文件跳转验证;既有文本展示继续可用。
68
+ 早期的 [30 秒本地工具演示](assets/context-pack-demo.html) 仍然保留,可用 `pnpm build` 后运行 `node scripts/context-pack-demo.mjs` 复现。Web Context Card 继续延期,Card replay 和文件跳转尚未验证。
70
69
 
71
70
  ## 工具一览
72
71
 
@@ -93,13 +92,13 @@ v0.9 要求匹配的 `0.2.0-rc.2` tools runtime;精确 peer pin 防止 npm 新
93
92
 
94
93
  ```sh
95
94
  # 从 npm(预编译)
96
- npx @deepseek-ai/dsh plugin --profile web add dsh-code-index
95
+ npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add dsh-code-index@0.9.0
97
96
 
98
97
  # 或从包含本仓库检查副本的目录
99
- npx @deepseek-ai/dsh plugin --profile web add ./dsh-code-index
98
+ npx @deepseek-ai/dsh@0.2.0-rc.2 plugin --profile web add ./dsh-code-index
100
99
  ```
101
100
 
102
- 重启 Web UI(`npx @deepseek-ai/dsh web`)——启动日志会确认每个工具:
101
+ 重启 Web UI(`npx @deepseek-ai/dsh@0.2.0-rc.2 web`)——启动日志会确认每个工具:
103
102
 
104
103
  ```
105
104
  [dsh-code-index] plugin loaded
@@ -175,7 +174,30 @@ Git 变化使用固定的 baseline commit 判定 added/modified/deleted,保留
175
174
 
176
175
  ## 支持的语言
177
176
 
178
- TypeScript、JavaScript、Python、Go、Rust、Java、C++、C(`.ts .tsx .mts .cts .js .jsx .mjs .cjs .py .pyi .go .rs .java .cpp .cc .cxx .c++ .hpp .hxx .hh .h .ipp .tpp .inl .c`),通过 tree-sitter WASM 解析——纯解析,无需原生编译。符号提供方的接缝(`src/extract.ts` + 语法文件)预留了后续接入其他语言/嵌入检索的位置。C/C++ 符号提取通过 declarator 链解析名字(模板、`ns::name` 限定定义、类内方法),`#include "…"` 会接入 repo map 的引用图。
177
+ ArkTS、TypeScript、JavaScript、Python、Go、Rust、Java、C++、C(`.ets .ts .tsx .mts .cts .js .jsx .mjs .cjs .py .pyi .go .rs .java .cpp .cc .cxx .c++ .hpp .hxx .hh .h .ipp .tpp .inl .c`),通过 tree-sitter WASM 解析——纯解析,无需原生编译。符号提供方的接缝(`src/extract.ts` + 语法文件)预留了后续接入其他语言/嵌入检索的位置。C/C++ 符号提取通过 declarator 链解析名字(模板、`ns::name` 限定定义、类内方法),`#include "…"` 会接入 repo map 的引用图。
178
+
179
+ ### ArkTS 功能与限制
180
+
181
+ - `struct` 组件使用现有 `kind: class`,签名为 `struct Name`。方法、字段、全局函数、
182
+ class/interface/type/enum 和模块变量保留稳定的限定 ID、所属作用域和源码行号。
183
+ `@Component`、`@ComponentV2`、`@State`、`@Local`、`@Builder` 等装饰器保留为元数据,
184
+ 装饰器所在行纳入定义源码范围。
185
+ - 能解析 `build()` 和嵌套声明式 UI;本地组件、显式 ETS/TS import 接入符号、搜索、地图、
186
+ 引用、变更上下文和 Context Pack。`@Extend` 元数据及 UI 属性链不会被当作业务调用关系。
187
+ UI 块内大写裸调用不使用全仓库同名或仅导入模块的回退,避免给无绑定的 SDK 组件关联
188
+ 无关项目符号。普通 callback/业务调用沿用已有 provenance;ArkTS 的 `code_refs` 使用
189
+ 按绑定解析的候选关系。
190
+ - 唯一可确定目标的相对 ETS/TS import 可解析;同一无扩展名路径同时存在 ETS 和其他源码
191
+ 时不猜测。默认 import 保留 `import-scoped`,不推断 HAR/oh-package/模块别名、SDK 类型、
192
+ re-export 链、状态更新或 UI 重渲染语义。无显式绑定的全局自定义 UI 组件可能没有关系边。
193
+ 语法解析通过不等于 ArkTS 编译通过或鸿蒙运行时行为已验证。
194
+ - 每个索引文件记录 `parsed` / `partial` / `failed`、ERROR/MISSING 数量和最多三处位置。
195
+ 不可靠的 ArkTS 声明会被省略,避免错误的范围或所属作用域。`code_index` 提供有限的
196
+ 索引不完整摘要,Context Pack 和变更上下文在原有预算内保留缺口。`parsed` 只表示语法
197
+ 提取完成,不承诺完整语义引用。缓存 schema 3 自动重建旧缓存,仍不持久化源码正文。
198
+ - grammar 使用 [harmony-contrib 0.3.0](https://github.com/harmony-contrib/tree-sitter-arkts),
199
+ ABI 14,未经修改的 npm WASM 与 MIT 声明随包发布,消费端无需原生 ArkTS addon。
200
+ 见 [WASM 来源](grammars/README.md)。
179
201
 
180
202
  ## 工作原理
181
203
 
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ import Schema from '@deepseek-ai/schemastery';
3
3
 
4
4
  /** Shared data model for dsh-code-index. */
5
5
  /** On-disk cache layout version. Bump when persisted graph/symbol shapes change. */
6
- declare const REPO_INDEX_SCHEMA_VERSION: 2;
6
+ declare const REPO_INDEX_SCHEMA_VERSION: 3;
7
7
  type SymbolKind = 'function' | 'method' | 'class' | 'interface' | 'type' | 'enum' | 'variable' | 'field' | 'import' | 'module';
8
8
  /** Stable, file-qualified symbol identity: `sym:v1:<file>#<scope>/<segment>`. */
9
9
  type SymbolId = string;
@@ -16,6 +16,8 @@ interface SymbolScopePart {
16
16
  ordinal: number;
17
17
  }
18
18
  interface SymbolInfo {
19
+ /** ArkTS decorators as written; their source lines belong to the definition. */
20
+ decorators?: string[];
19
21
  /** Stable qualified id; unique within a RepoIndex. */
20
22
  id: SymbolId;
21
23
  /** Symbol name (identifier / type id / member name). */
@@ -53,6 +55,8 @@ interface ImportInfo {
53
55
  }
54
56
  /** One call site: callee name, line, and enclosing function ('' = module level). */
55
57
  interface CallInfo {
58
+ /** ArkUI syntax requires an explicit/local binding; no global name guessing. */
59
+ context?: 'arkui';
56
60
  /** Callee name as written (identifier, member/property, or qualified tail). */
57
61
  name: string;
58
62
  /** 1-based line of the call expression. */
@@ -65,6 +69,8 @@ interface CallInfo {
65
69
  qualifier: string | null;
66
70
  }
67
71
  interface IndexedFile {
72
+ /** Syntax/read completeness, not a typecheck or HarmonyOS runtime verdict. */
73
+ diagnostic?: ParseDiagnostic;
68
74
  /** Repo-relative path (forward-slash). */
69
75
  path: string;
70
76
  lang: string;
@@ -79,6 +85,16 @@ interface IndexedFile {
79
85
  * Optional because caches written before call-graph support lack it. */
80
86
  calls?: CallInfo[];
81
87
  }
88
+ interface ParseDiagnostic {
89
+ status: 'parsed' | 'partial' | 'failed';
90
+ errorCount: number;
91
+ missingCount: number;
92
+ issues: Array<{
93
+ kind: 'ERROR' | 'MISSING';
94
+ line: number;
95
+ }>;
96
+ reason?: 'source-unavailable' | 'parser-failed';
97
+ }
82
98
  interface RepoIndex {
83
99
  /** Persisted layout version; see {@link REPO_INDEX_SCHEMA_VERSION}. */
84
100
  schemaVersion: typeof REPO_INDEX_SCHEMA_VERSION;
@@ -122,14 +138,14 @@ declare function findRepoRoot(startDir: string, maxLevels?: number): Promise<str
122
138
  * Parses a source text with a per-language grammar (web-tree-sitter WASM,
123
139
  * static grammars from tree-sitter-wasms) and returns flat SymbolInfo rows.
124
140
  *
125
- * NOTE on the dependency pin: web-tree-sitter must stay at ^0.20.x — newer
126
- * releases expect dylinked grammar wasm, while tree-sitter-wasms ships
127
- * static builds. Verified working pair: web-tree-sitter@0.20.8 + tree-sitter-wasms@0.1.13.
141
+ * web-tree-sitter 0.25 loads the existing tree-sitter-wasms grammars and the
142
+ * pinned ArkTS ABI-14 asset. See grammars/README.md for provenance.
128
143
  */
129
144
 
130
- type LanguageId = 'typescript' | 'javascript' | 'python' | 'go' | 'rust' | 'java' | 'cpp' | 'c';
145
+ type LanguageId = 'arkts' | 'typescript' | 'javascript' | 'python' | 'go' | 'rust' | 'java' | 'cpp' | 'c';
131
146
  declare function languageForFile(filePath: string): LanguageId | null;
132
147
  interface ExtractedFile {
148
+ diagnostic: ParseDiagnostic;
133
149
  symbols: SymbolInfo[];
134
150
  /** Derived compatibility view of {@link importDetails} specifiers. */
135
151
  imports: string[];
@@ -171,6 +187,9 @@ declare function defaultCachePath(root: string, cacheDir?: string): string;
171
187
  declare function loadIndex(cachePath: string): Promise<RepoIndex | null>;
172
188
  declare function saveIndex(cachePath: string, index: RepoIndex): Promise<void>;
173
189
 
190
+ /** One summary and at most three file locations. No source or exception dump. */
191
+ declare function indexIntegrityWarnings(index: RepoIndex): string[];
192
+
174
193
  /** Pure search / filter logic over a RepoIndex — unit-testable, no IO. */
175
194
 
176
195
  interface SymbolFilter {
@@ -631,4 +650,4 @@ declare const name = "dsh-code-index";
631
650
  declare const inject: readonly ["tools", "systemPrompt"];
632
651
  declare function apply(ctx: MinimalContext, pluginConfig?: PluginConfig): void;
633
652
 
634
- export { type AffectedTest, CACHE_DIR_NAME, type ChangeContextInput, type ChangeContextOptions, type ChangeContextResult, type ChangeKind, type ChangedSymbol, type CodeChangeContextArgs, Config, type ContextFile, type ContextOptions, type ContextPack, type ContextPackItem, type ContextRelationship, type ContextRoute, type ContextSymbol, type ContextTaskKind, DEFAULT_EXCLUDED_DIRS, type DiffHunk, type FileChange, type ImpactHop, type ImpactRow, type ImportDependent, type IndexOptions, type IndexedFile, type RepoIndex, SUPPORTED_EXTS, type SymbolInfo, type SymbolKind, type SymbolPath, type TaskContextResult, type UnmappedChange, apply, buildChangeContext, buildIndex, buildIndexWithCache, buildModuleGraph, buildSymbolTable, buildTaskContext, callerCounts, changeContextInputFromArgs, defaultCachePath, extractAll, extractSymbols, findCycles, findOrphanModules, findRepoRoot, inject, languageForFile, loadIndex, name, parseFileToSymbols, parseUnifiedDiff, rankRepoMap, readGitFileAtRef, readWorkingTreeDiff, renderChangeContext, renderContextPack, renderHit, renderRepoMap, renderTaskContext, routeTask, saveIndex, scanRepo, scoreFile, searchSymbols, symbolCount, symbolRefs, tools };
653
+ export { type AffectedTest, CACHE_DIR_NAME, type ChangeContextInput, type ChangeContextOptions, type ChangeContextResult, type ChangeKind, type ChangedSymbol, type CodeChangeContextArgs, Config, type ContextFile, type ContextOptions, type ContextPack, type ContextPackItem, type ContextRelationship, type ContextRoute, type ContextSymbol, type ContextTaskKind, DEFAULT_EXCLUDED_DIRS, type DiffHunk, type FileChange, type ImpactHop, type ImpactRow, type ImportDependent, type IndexOptions, type IndexedFile, type ParseDiagnostic, type RepoIndex, SUPPORTED_EXTS, type SymbolInfo, type SymbolKind, type SymbolPath, type TaskContextResult, type UnmappedChange, apply, buildChangeContext, buildIndex, buildIndexWithCache, buildModuleGraph, buildSymbolTable, buildTaskContext, callerCounts, changeContextInputFromArgs, defaultCachePath, extractAll, extractSymbols, findCycles, findOrphanModules, findRepoRoot, indexIntegrityWarnings, inject, languageForFile, loadIndex, name, parseFileToSymbols, parseUnifiedDiff, rankRepoMap, readGitFileAtRef, readWorkingTreeDiff, renderChangeContext, renderContextPack, renderHit, renderRepoMap, renderTaskContext, routeTask, saveIndex, scanRepo, scoreFile, searchSymbols, symbolCount, symbolRefs, tools };