@dsh-gis/dsh-opengis-skill 0.1.0 → 0.1.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.
Files changed (37) hide show
  1. package/.editorconfig +19 -0
  2. package/CHANGELOG.md +96 -0
  3. package/LICENSE +21 -21
  4. package/README.md +91 -30
  5. package/THIRD_PARTY_NOTICES.md +37 -10
  6. package/assets/gdal/reference/raster-tools.md +538 -538
  7. package/assets/gdal/reference/vector-tools.md +149 -149
  8. package/assets/gdal-api/reference/raster-api.md +424 -424
  9. package/assets/gdal-api/reference/vector-api.md +724 -724
  10. package/assets/geometry-api-net/reference/geometry-types.md +243 -243
  11. package/assets/geopandas/reference/core-api.md +221 -221
  12. package/assets/geotools/reference/raster-rendering.md +108 -108
  13. package/assets/geotools/reference/vector-io.md +149 -149
  14. package/assets/jts/reference/geometry-operations.md +303 -303
  15. package/assets/mapsui/SKILL.md +283 -283
  16. package/assets/opengis-all/reference/data-stages.md +608 -608
  17. package/assets/opengis-all/reference/workflow-cheatsheets.md +324 -324
  18. package/assets/opengis-utils-for-java/reference/common-tasks.md +384 -384
  19. package/assets/opengis-utils-for-net/reference/code-patterns.md +124 -124
  20. package/assets/opengis-utils-for-net/reference/util-classes.md +291 -291
  21. package/assets/pyqgis/reference/processing-rendering.md +292 -292
  22. package/assets/pyqgis/reference/vector-raster-layers.md +318 -318
  23. package/assets/qgis-process/SKILL.md +414 -414
  24. package/assets/qgis-process/reference/algorithm-cheatsheet.md +194 -194
  25. package/assets/shapely/reference/operations-reference.md +199 -199
  26. package/cordis.patch.yml +6 -3
  27. package/lib/catalog.d.ts +50 -0
  28. package/lib/catalog.js +238 -0
  29. package/lib/index.d.ts +47 -6
  30. package/lib/index.js +32 -44
  31. package/lib/markdown-links.d.ts +11 -0
  32. package/lib/markdown-links.js +103 -0
  33. package/lib/skill-file.js +104 -17
  34. package/locale/en.json +1 -1
  35. package/locale/zh.json +1 -1
  36. package/package.json +11 -5
  37. package/upstream.json +64 -2
package/.editorconfig ADDED
@@ -0,0 +1,19 @@
1
+ # Editor defaults for the repository. Mirrors the LF normalization in
2
+ # .gitattributes; editors that support EditorConfig apply these automatically.
3
+ root = true
4
+
5
+ [*]
6
+ charset = utf-8
7
+ end_of_line = lf
8
+ insert_final_newline = true
9
+ trim_trailing_whitespace = true
10
+
11
+ [*.{js,mjs}]
12
+ indent_style = tab
13
+
14
+ [*.{json,jsonc,yaml,yml,md}]
15
+ indent_style = space
16
+ indent_size = 2
17
+
18
+ [*.md]
19
+ trim_trailing_whitespace = false
package/CHANGELOG.md ADDED
@@ -0,0 +1,96 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [0.1.2] - 2026-10-19
9
+
10
+ ### Added
11
+
12
+ - Tests for the frontmatter parser, the catalog builder, Markdown link resolution,
13
+ and the sync/validate scripts, plus expanded provider coverage in `test/plugin.test.mjs`.
14
+ - A SHA-256 integrity manifest in `upstream.json` (`schemaVersion: 1`,
15
+ `hashAlgorithm: "sha256"`, `files` keyed by the POSIX path relative to `assets/`),
16
+ so validation no longer needs an upstream checkout.
17
+ - Generated README sections: the skill count and skill table are rendered from the
18
+ vendored assets and verified by `npm run validate`.
19
+ - `.editorconfig` and this changelog.
20
+
21
+ ### Changed
22
+
23
+ - Compatibility: `engines.dsh` widened to `>=0.2.0-rc.2 <0.3.0-0`. The registry API
24
+ and candidate/definition contract of `@deepseek-ai/dsh-skill` are byte-identical
25
+ between 0.2.0-rc.2 and 0.2.1-rc.2, and 0.2.0-rc.2 already supports
26
+ `dsh.bundle.patch`, locale and icon metadata, so the old `>=0.2.1-rc.2` gate
27
+ needlessly blocked users on the npm-latest DSH 0.2.0-rc.2.
28
+ - Runtime hardening: canonical provider registration via
29
+ `ctx.skills.registerProvider(() => provider)` (the returned disposer is owned by
30
+ the calling fiber, so no extra `ctx.effect` wrapper), a strict BOM-tolerant
31
+ frontmatter parser, a clear error when the asset root is missing, and
32
+ forward-slash `resourceBase` paths on Windows.
33
+ - Tooling hardening: two-way `sync:check` (drift plus upstream additions/removals),
34
+ SHA-256 manifest verification, generated README count/table verification,
35
+ validation of every relative Markdown link in the repository docs and assets,
36
+ and CRLF detection.
37
+ - CI: the test matrix now covers Ubuntu (Node 22/24) and Windows (Node 24), and a
38
+ new `sync` job verifies the vendored snapshot against the pinned upstream commit.
39
+ - `npm run check` (`validate && test`) added; `prepublishOnly` now runs it.
40
+ - Docs refreshed: README rewritten without hardcoded skill counts, with an English
41
+ summary, a compatibility note, install/uninstall/update notes, upstream integrity
42
+ docs and a troubleshooting section; package description and locale metadata
43
+ updated.
44
+
45
+ ### Fixed
46
+
47
+ - `SKILL.md` files with a UTF-8 BOM are parsed correctly; frontmatter parsing is
48
+ strict and reports unterminated quotes or block scalars instead of silently
49
+ ignoring them.
50
+ - A missing `assets/` directory now fails with a clear error that names the expected
51
+ asset root instead of an opaque `ENOENT`.
52
+ - `resourceBase` paths are emitted with forward slashes on Windows, so relative
53
+ references resolve consistently across platforms.
54
+ - Stale hardcoded skill counts removed from the README, locale metadata and the npm
55
+ description; count and table are generated from the vendored assets.
56
+ - CRLF line endings in vendored assets are detected and reported by validation.
57
+ - Sync refuses a `--from` directory that is not itself a git checkout root, so an
58
+ enclosing repository's HEAD can no longer be recorded as forged upstream
59
+ provenance; the manifest commit is now mandatory and validated.
60
+ - Sync rejects `gis/` directories without `SKILL.md` and stray files at the
61
+ `assets/` root instead of silently dropping or blessing them.
62
+ - Stray files at the `assets/` root are pruned by sync and rejected by
63
+ validation, so `assets/` publishes only skill directories.
64
+ - CI actions are pinned to release commit SHAs, and the external upstream
65
+ checkout disables persisted credentials.
66
+ - Validation checks the bundle row structurally, the locale file grammar, and the
67
+ engine range shape instead of accepting any non-empty string.
68
+
69
+ ## [0.1.1] - 2026-10-19
70
+
71
+ ### Fixed
72
+
73
+ - Vendored skill assets are written with LF bytes regardless of the source
74
+ checkout's line endings, so the snapshot matches the upstream git blob on every
75
+ platform.
76
+ - Corrected the release documentation shipped with 0.1.0.
77
+
78
+ ## [0.1.0] - 2026-10-19
79
+
80
+ ### Added
81
+
82
+ - Initial public release: a DeepSeek Harness bundle and plugin that vendors the
83
+ `gis/` skills of opengis-skills and registers one skill provider (`opengis`) on
84
+ `ctx.skills`.
85
+ - Bundled assets under `assets/<skill>/` (`SKILL.md` plus `reference/*.md`), bundle
86
+ wiring (`cordis.patch.yml`), locale metadata, icon, and npm packaging.
87
+ - Source-repository tooling: `npm run sync` / `npm run sync:check`, `npm run
88
+ validate`, `npm test`, and GitHub Actions CI.
89
+
90
+ ## [0.0.0-stage] - 2026-10-19
91
+
92
+ ### Added
93
+
94
+ - First staging release: bundle/plugin skeleton, vendored skill assets, locale and
95
+ icon metadata, and the initial sync/validate/test scripts for installation
96
+ checks.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 tj
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.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 tj
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.
package/README.md CHANGED
@@ -1,17 +1,36 @@
1
1
  # @dsh-gis/dsh-opengis-skill
2
2
 
3
- DeepSeek Harness 的 **OpenGIS 技能包插件**:把 [opengis-skills](https://github.com/znlgis/opengis-skills) 中 **gis/ 分类的 32 个 GIS 技能**打包成可安装、可启停的 DSH bundle。会话技能目录只列出名称与描述,技能正文与参考资料按需加载。
3
+ > **English summary** — A DeepSeek Harness bundle that packages the `gis/` skills of
4
+ > [opengis-skills](https://github.com/znlgis/opengis-skills) as installable, toggleable skills.
5
+ > The session catalog lists names and descriptions only; skill bodies and their
6
+ > `reference/*.md` files are loaded on demand. Zero runtime dependencies: every asset
7
+ > ships inside the npm package.
8
+ >
9
+ > Compatibility: DeepSeek Harness `>=0.2.0-rc.2 <0.3.0-0`; Node.js `>=22` for development
10
+ > only. MIT licensed.
11
+
12
+ DeepSeek Harness 的 **OpenGIS 技能包插件**:把 [opengis-skills](https://github.com/znlgis/opengis-skills) 中 `gis/` 分类的 GIS 技能打包成可安装、可启停的 DSH bundle。会话技能目录只列出名称与描述,技能正文与参考资料按需加载。
4
13
 
5
14
  ## 特性
6
15
 
7
- - **32 个 GIS 技能**:GDAL、GDAL API、QGIS(qgis_process / PyQGIS / QGIS Server)、GeoServer(含 REST API 与 Cloud)、MapServer、PostGIS、PROJ、PDAL、GRASS GIS、JTS、NetTopologySuite、Esri Geometry API(Java/.NET)、Shapely、GeoPandas、GeoPipeAgent、OpenGisDAF、CesiumJS、OpenLayers、Leaflet、Mapbox GL JS、deck.gl、SharpMap、Mapsui、GeoTools、OpenGIS Utils(Java/.NET)、opengis-all 全流程索引。
16
+ - **覆盖 GIS 全链路**:GDAL、GDAL API、QGIS(qgis_process / PyQGIS / QGIS Server)、GeoServer(含 REST API 与 Cloud)、MapServer、PostGIS、PROJ、PDAL、GRASS GIS、JTS、NetTopologySuite、Esri Geometry API(Java/.NET)、Shapely、GeoPandas、GeoPipeAgent、OpenGisDAF、CesiumJS、OpenLayers、Leaflet、Mapbox GL JS、deck.gl、SharpMap、Mapsui、GeoTools、OpenGIS Utils(Java/.NET),以及 `opengis-all` 全流程索引。
8
17
  - **按需加载**:注册的是 skill provider(`ctx.skills.registerProvider`),发现阶段只读 frontmatter;正文每次加载时读取,参考资料(`reference/*.md`)通过技能目录(resource base)相对解析。
9
- - **零运行时依赖**:只用 Node 内置模块,npm 包内自带全部资产(约 640 KB),不 import DSH 内部包。
10
- - **可同步上游**:`npm run sync` 从 opengis-skills 检出复制资产,记录上游 commit 到 `upstream.json`,并重新生成本文下方技能表。
18
+ - **零运行时依赖**:只用 Node 内置模块,不 import DSH 内部包;全部资产随 npm 包分发,整个包解包后约 670 KiB。
19
+ - **可同步上游**:`npm run sync` 从 opengis-skills 检出复制资产,记录上游 commit 与每个文件的 SHA-256 到 `upstream.json`,并重新生成本文下方技能清单。
11
20
  - **可启停**:单包同时是 bundle 与插件(`dsh.bundle.patch` 插入自身行),在 Plugins 里启用/停用即可。
12
21
 
22
+ ## 兼容性
23
+
24
+ - **DeepSeek Harness**:`>=0.2.0-rc.2 <0.3.0-0`(`package.json` 的 `engines.dsh`)。本包通过 Host 提供的 `ctx.skills` 注册 provider,遵循 `@deepseek-ai/dsh-skill` 的 registry API 与 candidate/definition 契约;该契约在 0.2.0-rc.2 与 0.2.1-rc.2 之间字节一致,`dsh.bundle.patch`、locale 与图标元数据在 0.2.0-rc.2 已经可用。
25
+ - **Node.js**:`>=22`(`engines.node`)。仅开发脚本与测试需要,插件本身运行在 DSH 内。
26
+ - **运行时依赖**:无。`dependencies` 为空,只使用 Node 内置模块,不 import DSH 内部包。
27
+
13
28
  ## 技能清单
14
29
 
30
+ <!-- skills:count:start -->
31
+ 共 **32** 个技能,描述取自上游 frontmatter。
32
+ <!-- skills:count:end -->
33
+
15
34
  <!-- skills:start -->
16
35
  | Skill | Description (upstream frontmatter) |
17
36
  | --- | --- |
@@ -53,9 +72,10 @@ DeepSeek Harness 的 **OpenGIS 技能包插件**:把 [opengis-skills](https://
53
72
 
54
73
  ### 方式一:Plugins 界面(本地目录,适合开发)
55
74
 
56
- 1. 打开 DSH 的 **Plugins / 插件** 页面,选择安装 bundle(安装本地包目录)。
57
- 2. 目标填本仓库的绝对路径,例如 `D:\self\code\dsh-opengis-skill`。
58
- 3. 在列表中找到 **OpenGIS 技能包** 并启用。
75
+ 1. 在 DSH 中打开 **Plugins / 插件** 页面,选择安装 bundle(本地目录方式)。
76
+ 2. 目标填**包根目录**的绝对路径,也就是包含 `package.json` 的目录,例如本仓库 `D:\self\code\dsh-opengis-skill`。
77
+ 3. 安装后在列表中找到 **OpenGIS 技能包** 并启用;记录写入当前所选 profile 的插件配置。
78
+ 4. 本地目录方式直接引用源码目录,改动会随重载生效,适合开发与试用;正式使用建议走下面的 npm 方式,便于升级与版本校验。
59
79
 
60
80
  ### 方式二:npm
61
81
 
@@ -63,11 +83,19 @@ DeepSeek Harness 的 **OpenGIS 技能包插件**:把 [opengis-skills](https://
63
83
  dsh plugin --profile <profile> add @dsh-gis/dsh-opengis-skill
64
84
  ```
65
85
 
66
- 安装后在 Plugins 页面启用该 bundle。desktop profile 由 Electron 应用独占,推荐直接用 Plugins 界面操作;安装、升级或启停之后,需要新会话(或重启 dsh)才会出现最新的技能目录。
86
+ 安装后在 Plugins 页面启用该 bundle。卸载:
87
+
88
+ ```bash
89
+ dsh plugin --profile <profile> remove @dsh-gis/dsh-opengis-skill
90
+ ```
91
+
92
+ - desktop profile 由 Electron 应用独占,推荐直接使用 Plugins 界面操作。
93
+ - 安装、升级或启停之后,需要重载/重启 dsh,并**新开会话**,技能目录才会反映最新状态(bundle 与技能目录在会话启动时装配)。
94
+ - 升级到新版本后同样需要重载 + 新会话;本地目录方式改动 `package.json` 或 `assets/` 后也一样。
67
95
 
68
96
  ## 使用
69
97
 
70
- - 技能目录会列出 32 个技能的名称与描述;模型用 `skill("gdal")` 之类的调用加载,用户也可以在输入框直接输入 `/gdal`。
98
+ - 技能目录只列出每个技能的名称与描述;模型用 `skill("gdal")` 之类的调用加载,用户也可以在输入框直接输入 `/gdal`。
71
99
  - 常用入口:
72
100
  - `opengis-all` — 端到端 GIS 流程索引(GDAL → 处理 → GeoServer → 可视化);
73
101
  - `gdal` / `gdal-api` — 命令行与编程式栅格/矢量处理;
@@ -75,10 +103,12 @@ dsh plugin --profile <profile> add @dsh-gis/dsh-opengis-skill
75
103
  - `geoserver` + `geoserver-rest-api` — 发布与管理 OGC 服务;
76
104
  - `postgis` — 空间数据库;`proj` — 坐标转换;
77
105
  - `openlayers` / `cesiumjs` / `deck-gl` — Web 2D/3D 可视化。
78
- - 加载结果会给出该技能的 Base directory;正文中的 `reference/*.md` 与 `../<其他技能>/SKILL.md` 相对链接都据此解析(资源随包全量分发)。
106
+ - 加载结果会给出该技能的 **Base directory**;正文中的 `reference/*.md` 与 `../<其他技能>/SKILL.md` 相对链接都据此解析。因为全部技能资产随同一个包一起分发,跨技能链接不需要额外安装或配置。
79
107
 
80
108
  ## 上游同步
81
109
 
110
+ > 本节只适用于**本仓库的源码开发**。`scripts/` 与 `test/` 不在 npm 发布包内(`package.json` 的 `files` 未包含它们),安装用户无需执行这些命令。
111
+
82
112
  ```bash
83
113
  # 默认从 ../opengis-skills 读取,也可用 --from 或 OPENGIS_SKILLS_DIR 指定
84
114
  npm run sync -- --from ../opengis-skills
@@ -87,45 +117,76 @@ npm run sync -- --from ../opengis-skills
87
117
  npm run sync:check -- --from ../opengis-skills
88
118
  ```
89
119
 
90
- 同步脚本会:逐文件复制 `gis/<skill>/`(不含任何改写)、校验 frontmatter(name 必须为 kebab-case 且与目录同名)、清理上游已删除的技能目录、更新 `upstream.json`(仓库地址、commit、同步时间、技能清单)以及本文的技能表。
120
+ 同步脚本会:逐文件复制 `gis/<skill>/`(文本统一为 LF,保证与上游 git blob 跨平台字节一致)、校验 frontmatter(name 必须为 kebab-case 且与目录同名)、清理上游已删除的技能目录、更新 `upstream.json`,并重新生成 README 中的技能数量与技能表(生成区域由 `<!-- skills:count:* -->` 与 `<!-- skills:* -->` 标记界定)。`sync:check` 做双向比较:既检查已同步文件是否漂移,也检查上游新增/删除的技能是否遗漏。
121
+
122
+ 为避免伪造来源,`npm run sync` 要求 `--from` 指向 opengis-skills 的 **git 检出根目录**:脚本用 `git rev-parse --show-toplevel` 校验该目录就是仓库根,避免把外层仓库的 HEAD 误记成上游 commit;无法证明 commit 时同步直接失败。上游 `gis/` 下若出现没有 `SKILL.md` 的目录,同步会报错而不是静默跳过(否则上游改名会静默丢技能);`gis/` 根目录的普通文件(上游分类索引 `gis/SKILL.md` 等)不参与同步,也不会被当作技能打包。
123
+
124
+ `upstream.json` 同时是一份完整性清单:`schemaVersion` 为 `1`,`hashAlgorithm` 为 `"sha256"`,`files` 以相对 `assets/` 的 POSIX 路径为键、对应文件的 SHA-256 摘要为值。`npm run validate` 会重新计算并比对全部摘要,因此**不依赖上游 checkout** 也能发现资产被手改、缺失或未列入清单的情况;CI 的 `sync` 任务再用固定 commit 的上游检出做一次 `sync:check`,确保快照与上游一致。
91
125
 
92
126
  ## 开发
93
127
 
128
+ 需要 Node.js 22+。
129
+
94
130
  ```bash
95
- npm test # Node 内置测试运行器,覆盖 provider 目录/加载/链接
96
- npm run validate # 资产、元数据、bundle 接线与打包校验
131
+ npm run check # validate + test,发布前必跑(也是 prepublishOnly)
132
+ npm run validate # 资产、元数据、bundle 接线、完整性清单与断链校验
133
+ npm test # Node 内置测试运行器
97
134
  npm pack --dry-run # 查看实际发布内容
98
135
  ```
99
136
 
137
+ 编辑器默认值见 [.editorconfig](./.editorconfig)(UTF-8、LF、最终换行;JS/MJS 用 Tab,JSON/YAML/Markdown 用 2 空格;Markdown 保留行尾空格)。版本变更记录见 [CHANGELOG.md](./CHANGELOG.md)。
138
+
100
139
  ### 目录结构
101
140
 
102
141
  ```text
103
142
  dsh-opengis-skill/
104
- ├── package.json # dsh.bundle.patch、engines、files、icons/locales 导出
105
- ├── cordis.patch.yml # bundle 层:把 opengis-skill provider 行插入 Host
143
+ ├── package.json # dsh.bundle.patch、engines、files、图标/本地化导出
144
+ ├── cordis.patch.yml # bundle 层:把 opengis-skill provider 行插入 Host
106
145
  ├── lib/
107
- │ ├── index.js # provider 插件(扫描 assets、注册 ctx.skills)
108
- │ ├── skill-file.js # SKILL.md frontmatter 解析(插件/脚本/测试共用)
109
- │ └── *.d.ts # 手写类型声明
110
- ├── assets/<skill>/ # 32 个技能资产(SKILL.md + reference/*.md,随上游同步)
111
- ├── locale/{en,zh}.json # Plugins 里显示的标题与描述
112
- ├── icon.svg # bundle 图标
113
- ├── scripts/ # 同步与校验脚本
114
- ├── test/plugin.test.mjs # 单元测试
115
- └── upstream.json # 上游仓库、commit、同步时间与技能清单
146
+ │ ├── index.js # provider 插件(注册 ctx.skills、list/get)
147
+ │ ├── catalog.js # 扫描 assets/ 构建技能目录、生成 README 区域
148
+ │ ├── markdown-links.js # Markdown 相对链接解析与断链校验
149
+ │ ├── skill-file.js # SKILL.md frontmatter 解析(插件/脚本/测试共用)
150
+ │ └── *.d.ts # 手写类型声明
151
+ ├── assets/<skill>/ # 技能资产(SKILL.md + reference/*.md,随上游同步)
152
+ ├── locale/{en,zh}.json # Plugins 里显示的标题与描述
153
+ ├── icon.svg # bundle 图标
154
+ ├── scripts/
155
+ │ ├── sync-opengis-skills.mjs # 上游同步(assets/、upstream.json、README 生成区域)
156
+ │ └── validate-skills.mjs # 发布前校验(自包含,无需上游 checkout)
157
+ ├── test/
158
+ │ ├── plugin.test.mjs # provider 目录/加载/链接
159
+ │ ├── skill-file.test.mjs # frontmatter 解析
160
+ │ ├── catalog.test.mjs # 目录构建与 README 生成区域
161
+ │ ├── markdown-links.test.mjs # 相对链接解析与断链检测
162
+ │ └── scripts.test.mjs # 同步/校验脚本(临时目录夹具)
163
+ ├── .editorconfig # 编辑器默认值
164
+ ├── CHANGELOG.md # 版本变更记录
165
+ ├── README.md
166
+ └── upstream.json # 上游仓库、commit、同步时间、技能清单与 SHA-256 清单
116
167
  ```
117
168
 
118
169
  ### 设计说明
119
170
 
120
- - `apply` 时扫描 `assets/*/SKILL.md`,解析并校验名称与描述,然后 `ctx.effect(() => ctx.skills.registerProvider(...))`;provider 名为 `opengis`,候选 rank 为 600(与官方内置技能包一致),模型与用户均可调用。
121
- - 目录(list)只含元数据;正文(get)每次重新读盘,因此编辑资产后重新加载插件即可生效,无需清缓存。插件不注册工具、不注入提示段、不写会话状态。
122
- - 相对链接不做改写:包内是全量 32 个技能目录,`reference/*.md` 与 `../<skill>/SKILL.md` 都能解析;如果将来裁剪技能,`npm run validate` 会报断链。
171
+ - **规范注册**:`apply` 时调用 `ctx.skills.registerProvider(() => provider)`;返回的 disposer 由调用方 fiber 拥有,卸载时自动清理,因此**不需要**再套一层 `ctx.effect(...)`。
172
+ - provider 名为 `opengis`,`source` 为 `opengis`,候选 rank 为 600(即 `BUNDLED_SKILL_RANK`,与官方内置技能包一致),`invocation` 为模型与用户均可调用。
173
+ - `list` 只返回元数据(名称、描述、rank、source、`locator`/`path`、`resourceBase`);`get` 每次重新读盘并解析正文,因此编辑资产后重新加载插件即可生效,无需清缓存。插件不注册工具、不注入提示段、不写会话状态。
174
+ - **运行时加固**:frontmatter 解析严格且容忍 UTF-8 BOM(`name` 必须为 kebab-case、`description` 必填,未闭合引号或块标量会报可读错误);`assets/` 缺失时报错会指明期望的资产根目录;`resourceBase` 在 Windows 上也统一输出为正斜杠,跨平台链接一致。
175
+ - 相对链接不做改写:包内是全量技能目录,`reference/*.md` 与 `../<skill>/SKILL.md` 都能解析;`npm run validate` 会扫描全部 Markdown 相对链接,断链或越出 `assets/` 都会失败。
176
+
177
+ ## 故障排查
178
+
179
+ - **技能目录没有出现**:确认 bundle 已在 Plugins 中启用;安装、升级或启停后需要重载/重启 dsh 并新开会话。若用本地目录方式,确认填的是包含 `package.json` 的包根目录。
180
+ - **加载技能失败**:错误信息会带出具体资产路径(例如 `.../assets/gdal/SKILL.md` 的 frontmatter 问题);按提示修复,或从上游重新同步,不要手工编辑 `assets/`。
181
+ - **本地验证**:`npm run validate` 检查资产、元数据、bundle 接线、完整性清单与链接;`npm test` 跑单元测试;发布前统一用 `npm run check`。
182
+ - **同名技能冲突**:技能注册表按 rank、再按注册顺序决定同名技能的解析优先级;本包 rank 为 600。若其他 provider 也提供了同名技能,检查是否有另一份 OpenGIS 技能包或自定义技能被同时启用。
183
+ - **不要手改 `assets/`**:它是上游快照,手工修改会导致 SHA-256 完整性校验与同步检查失败;需要改内容时先改上游,再 `npm run sync` 重新生成。
123
184
 
124
185
  ## 与 @dsh-gis 其他插件的关系
125
186
 
126
- - ```dsh-gis/dsh-gis`:GIS 工具与地图界面(inspect/query/CRS/OGC/UI)。
127
- - ```dsh-gis/dsh-prompt-gis`:一段 GIS system-prompt 与两个内联技能(`gis-inspect-first`、`gis-query-patterns`)。
128
- - 本包:纯知识型技能包(32 个 GIS 技能),不提供工具,可与上述插件同时安装。
187
+ - `@dsh-gis/dsh-gis`:GIS 工具与地图界面(inspect/query/CRS/OGC/UI)。
188
+ - `@dsh-gis/dsh-prompt-gis`:一段 GIS system-prompt 与两个内联技能(`gis-inspect-first`、`gis-query-patterns`)。
189
+ - 本包:纯知识型技能包,不提供工具,可与上述插件同时安装。
129
190
 
130
191
  ## 许可
131
192
 
@@ -2,21 +2,48 @@
2
2
 
3
3
  ## opengis-skills
4
4
 
5
- The skill instructions under `assets/` are copied verbatim from the
5
+ The skill instructions under `assets/` are copied from the
6
6
  [opengis-skills](https://github.com/znlgis/opengis-skills) repository
7
7
  (`gis/` category), which is licensed under the MIT License:
8
8
 
9
- > MIT License
10
- >
11
- > Copyright (c) 2024-2026 znlgis
9
+ ```text
10
+ MIT License
11
+
12
+ Copyright (c) 2024-2026 znlgis
13
+
14
+ Permission is hereby granted, free of charge, to any person obtaining a copy
15
+ of this software and associated documentation files (the "Software"), to deal
16
+ in the Software without restriction, including without limitation the rights
17
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
18
+ copies of the Software, and to permit persons to whom the Software is
19
+ furnished to do so, subject to the following conditions:
20
+
21
+ The above copyright notice and this permission notice shall be included in all
22
+ copies or substantial portions of the Software.
23
+
24
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
25
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
26
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
27
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
28
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
29
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
30
+ SOFTWARE.
31
+ ```
12
32
 
13
33
  The exact upstream commit, sync time, and the list of vendored skills are
14
- recorded in [`upstream.json`](./upstream.json); the copy is performed by
15
- [`scripts/sync-opengis-skills.mjs`](./scripts/sync-opengis-skills.mjs). The
16
- skills are documentation: each one describes an independent open-source project
17
- (GDAL, QGIS, GeoServer, PostGIS, JTS, CesiumJS, OpenLayers, and others) and
18
- links to that project's own repository, documentation, and license. Those
19
- projects keep their own licenses; nothing in this package re-licenses them.
34
+ recorded in [`upstream.json`](./upstream.json), together with a SHA-256
35
+ integrity manifest of the snapshot: `schemaVersion` 1, `hashAlgorithm`
36
+ `sha256`, and a `files` map from every vendored file's POSIX path (relative
37
+ to `assets/`) to its digest. `npm run validate` recomputes those digests and
38
+ fails when the vendored bytes drift from the recorded manifest. The copy is
39
+ performed by `scripts/sync-opengis-skills.mjs`, which lives in the source
40
+ repository (<https://github.com/znlgis/dsh-opengis-skill>) and is not part of
41
+ the published package. Text files are vendored with LF line endings so the
42
+ snapshot matches the upstream git blob on every platform. The skills are
43
+ documentation: each one describes an independent open-source project (GDAL,
44
+ QGIS, GeoServer, PostGIS, JTS, CesiumJS, OpenLayers, and others) and links to
45
+ that project's own repository, documentation, and license. Those projects
46
+ keep their own licenses; nothing in this package re-licenses them.
20
47
 
21
48
  ## DeepSeek Harness
22
49