@dsh-gis/dsh-opengis-skill 0.2.0 → 0.4.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.
Files changed (126) hide show
  1. package/CHANGELOG.md +126 -1
  2. package/README.md +51 -25
  3. package/adaptations/brutile.md +6 -6
  4. package/adaptations/cesiumjs.md +6 -6
  5. package/adaptations/common.md +20 -13
  6. package/adaptations/deck-gl.md +6 -6
  7. package/adaptations/duckdb-spatial.md +6 -6
  8. package/adaptations/gdal-api.md +6 -6
  9. package/adaptations/gdal.md +6 -6
  10. package/adaptations/geolibre.md +6 -6
  11. package/adaptations/geometry-api-java.md +6 -6
  12. package/adaptations/geometry-api-net.md +6 -6
  13. package/adaptations/geonode.md +6 -6
  14. package/adaptations/geopandas.md +6 -6
  15. package/adaptations/geopipe-agent.md +6 -6
  16. package/adaptations/geos.md +8 -0
  17. package/adaptations/geoserver-cloud.md +6 -6
  18. package/adaptations/geoserver-rest-api.md +6 -6
  19. package/adaptations/geoserver.md +6 -6
  20. package/adaptations/geotools.md +6 -6
  21. package/adaptations/grass-gis.md +6 -6
  22. package/adaptations/jts.md +6 -6
  23. package/adaptations/kepler-gl.md +6 -6
  24. package/adaptations/leaflet.md +6 -6
  25. package/adaptations/mapbox-gl-js.md +6 -6
  26. package/adaptations/maplibre-gl-js.md +8 -0
  27. package/adaptations/maplibre-native.md +8 -0
  28. package/adaptations/mapserver.md +6 -6
  29. package/adaptations/mapsui.md +6 -6
  30. package/adaptations/nettopologysuite.md +6 -6
  31. package/adaptations/opendronemap.md +8 -0
  32. package/adaptations/opengis-all.md +7 -6
  33. package/adaptations/opengis-daf.md +7 -6
  34. package/adaptations/opengis-utils-for-java.md +6 -6
  35. package/adaptations/opengis-utils-for-net.md +6 -6
  36. package/adaptations/openlayers.md +6 -6
  37. package/adaptations/pdal.md +6 -6
  38. package/adaptations/postgis.md +6 -6
  39. package/adaptations/proj.md +6 -6
  40. package/adaptations/projnet4geoapi.md +6 -6
  41. package/adaptations/pyqgis.md +6 -6
  42. package/adaptations/qgis-process.md +6 -6
  43. package/adaptations/qgis-server.md +6 -6
  44. package/adaptations/shapely.md +6 -6
  45. package/adaptations/sharpmap.md +6 -6
  46. package/adaptations/spatialite.md +6 -6
  47. package/adaptations/stac-cog-titiler.md +8 -0
  48. package/adaptations/whitebox-tools.md +6 -6
  49. package/assets/brutile/SKILL.md +6 -12
  50. package/assets/cesiumjs/SKILL.md +14 -18
  51. package/assets/deck-gl/SKILL.md +9 -15
  52. package/assets/duckdb-spatial/SKILL.md +41 -25
  53. package/assets/gdal/SKILL.md +11 -18
  54. package/assets/gdal/reference/raster-tools.md +14 -0
  55. package/assets/gdal/reference/vector-tools.md +5 -0
  56. package/assets/gdal-api/SKILL.md +8 -16
  57. package/assets/gdal-api/reference/raster-api.md +7 -0
  58. package/assets/gdal-api/reference/vector-api.md +9 -0
  59. package/assets/geolibre/SKILL.md +11 -17
  60. package/assets/geometry-api-java/SKILL.md +5 -10
  61. package/assets/geometry-api-net/SKILL.md +5 -11
  62. package/assets/geometry-api-net/reference/geometry-types.md +5 -0
  63. package/assets/geonode/SKILL.md +8 -15
  64. package/assets/geopandas/SKILL.md +46 -17
  65. package/assets/geopandas/reference/core-api.md +55 -0
  66. package/assets/geopipe-agent/SKILL.md +7 -14
  67. package/assets/geopipe-agent/reference/steps-reference.md +12 -0
  68. package/assets/geopipe-agent/reference/workflows.md +8 -0
  69. package/assets/geos/SKILL.md +372 -0
  70. package/assets/geoserver/SKILL.md +6 -13
  71. package/assets/geoserver-cloud/SKILL.md +12 -21
  72. package/assets/geoserver-rest-api/SKILL.md +5 -12
  73. package/assets/geoserver-rest-api/reference/endpoints.md +16 -0
  74. package/assets/geotools/SKILL.md +5 -12
  75. package/assets/geotools/reference/raster-rendering.md +5 -0
  76. package/assets/geotools/reference/vector-io.md +7 -0
  77. package/assets/grass-gis/SKILL.md +36 -18
  78. package/assets/jts/SKILL.md +5 -12
  79. package/assets/jts/reference/geometry-operations.md +13 -0
  80. package/assets/kepler-gl/SKILL.md +10 -16
  81. package/assets/leaflet/SKILL.md +19 -23
  82. package/assets/mapbox-gl-js/SKILL.md +11 -16
  83. package/assets/maplibre-gl-js/SKILL.md +478 -0
  84. package/assets/maplibre-native/SKILL.md +383 -0
  85. package/assets/mapserver/SKILL.md +12 -16
  86. package/assets/mapsui/SKILL.md +29 -18
  87. package/assets/nettopologysuite/SKILL.md +5 -11
  88. package/assets/opendronemap/SKILL.md +309 -0
  89. package/assets/opengis-all/SKILL.md +14 -19
  90. package/assets/opengis-all/reference/data-stages.md +7 -0
  91. package/assets/opengis-all/reference/workflow-cheatsheets.md +7 -0
  92. package/assets/opengis-daf/SKILL.md +5 -13
  93. package/assets/opengis-utils-for-java/SKILL.md +7 -11
  94. package/assets/opengis-utils-for-java/reference/common-tasks.md +4 -0
  95. package/assets/opengis-utils-for-net/SKILL.md +5 -10
  96. package/assets/opengis-utils-for-net/reference/code-patterns.md +4 -0
  97. package/assets/opengis-utils-for-net/reference/util-classes.md +10 -0
  98. package/assets/openlayers/SKILL.md +16 -20
  99. package/assets/pdal/SKILL.md +15 -13
  100. package/assets/postgis/SKILL.md +21 -26
  101. package/assets/proj/SKILL.md +5 -12
  102. package/assets/projnet4geoapi/SKILL.md +6 -12
  103. package/assets/pyqgis/SKILL.md +5 -10
  104. package/assets/pyqgis/reference/processing-rendering.md +6 -0
  105. package/assets/pyqgis/reference/vector-raster-layers.md +6 -0
  106. package/assets/qgis-process/SKILL.md +5 -12
  107. package/assets/qgis-process/reference/algorithm-cheatsheet.md +6 -0
  108. package/assets/qgis-server/SKILL.md +7 -13
  109. package/assets/shapely/SKILL.md +29 -14
  110. package/assets/shapely/reference/operations-reference.md +42 -0
  111. package/assets/sharpmap/SKILL.md +5 -11
  112. package/assets/spatialite/SKILL.md +15 -16
  113. package/assets/stac-cog-titiler/SKILL.md +420 -0
  114. package/assets/whitebox-tools/SKILL.md +28 -19
  115. package/lib/adaptations.d.ts +18 -0
  116. package/lib/adaptations.js +164 -7
  117. package/lib/catalog.d.ts +7 -1
  118. package/lib/catalog.js +9 -1
  119. package/lib/index.d.ts +9 -0
  120. package/lib/index.js +48 -3
  121. package/lib/skill-file.d.ts +12 -0
  122. package/lib/skill-file.js +107 -16
  123. package/locale/en.json +1 -1
  124. package/locale/zh.json +1 -1
  125. package/package.json +8 -3
  126. package/upstream.json +74 -64
@@ -9,6 +9,18 @@
9
9
  * "<skill>.md" carries the skill-specific notes. The provider appends both to
10
10
  * the upstream body when a skill is loaded.
11
11
  *
12
+ * The tool lists below are split by availability, not by usefulness:
13
+ *
14
+ * - "CORE_TOOLS" ship with every supported DeepSeek Harness build, so guidance
15
+ * may rely on them. A per-skill file must cite at least two of them, and the
16
+ * shared file at least eight, which is what stops the layer from decaying
17
+ * into tool-agnostic advice the upstream bodies already carry.
18
+ * - "OPTIONAL_TOOLS" come from optional plugins (Agent Teams, desktop control,
19
+ * scheduled tasks, workspace dependency introspection). Guidance may name
20
+ * them, but must phrase them as a capability the session may or may not
21
+ * expose and keep a fallback, because a bare citation would break in a
22
+ * session without that plugin.
23
+ *
12
24
  * Every function here is pure Node built-ins and takes the adaptation root as
13
25
  * an argument, so the plugin, the validation script, and the tests share one
14
26
  * implementation. No DeepSeek Harness imports.
@@ -38,11 +50,86 @@ export const SKILL_SEPARATOR = "\n\n---\n\n";
38
50
  /** Labels every per-skill guidance must keep, in this order. */
39
51
  export const REQUIRED_LABELS = ["加载与引用", "执行环境", "先探测版本", "验证产物", "风险与权限"];
40
52
 
53
+ /**
54
+ * Labels whose bullet must carry a concrete command or tool in backticks.
55
+ *
56
+ * "先探测版本" without a probe command and "验证产物" without a check command
57
+ * are the two ways this layer most easily degenerates into an assertion: the
58
+ * model reads "check the result" and reports success without checking.
59
+ */
60
+ export const CONCRETE_LABELS = ["先探测版本", "验证产物"];
61
+
62
+ /**
63
+ * DeepSeek Harness tools that every supported build exposes. Guidance may
64
+ * depend on these unconditionally.
65
+ */
66
+ export const CORE_TOOLS = Object.freeze([
67
+ "skill",
68
+ "ops_bash",
69
+ "pwsh",
70
+ "run_code",
71
+ "read",
72
+ "grep",
73
+ "glob",
74
+ "write",
75
+ "edit",
76
+ "read_image",
77
+ "present",
78
+ "todo_write",
79
+ "subagent",
80
+ "ask_user_question",
81
+ "job_output",
82
+ "job_kill",
83
+ "job_list",
84
+ "web_fetch",
85
+ "web_search",
86
+ "working_directory",
87
+ "load_workspace_dependencies"
88
+ ]);
89
+
90
+ /**
91
+ * DeepSeek Harness tools that arrive with an optional plugin: Agent Teams,
92
+ * desktop control, scheduled tasks, derived "subagent" branches, and MCP
93
+ * resource reads. Guidance may name them, but only together with the fallback
94
+ * that applies when the session does not expose them.
95
+ */
96
+ export const OPTIONAL_TOOLS = Object.freeze([
97
+ "spawn_teammate",
98
+ "send_message",
99
+ "wait_agent",
100
+ "team_task_create",
101
+ "team_task_list",
102
+ "team_task_get",
103
+ "team_task_update",
104
+ "subagent_fork",
105
+ "windows_desktop",
106
+ "schedule_create",
107
+ "schedule_list",
108
+ "schedule_edit",
109
+ "list_mcp_resources",
110
+ "read_mcp_resource"
111
+ ]);
112
+
113
+ /** Every tool name the guidance may cite; the union of both lists. */
114
+ export const DSH_TOOLS = Object.freeze([...CORE_TOOLS, ...OPTIONAL_TOOLS]);
115
+
116
+ /** Minimum distinct core DSH tools one per-skill guidance must cite. */
117
+ const SKILL_MIN_CORE_TOOLS = 2;
118
+
119
+ /** Minimum distinct core DSH tools the shared guidance must cite. */
120
+ const COMMON_MIN_CORE_TOOLS = 8;
121
+
41
122
  /** Minimum bullets in the shared guidance. */
42
- const COMMON_MIN_BULLETS = 8;
123
+ const COMMON_MIN_BULLETS = 14;
124
+
125
+ /** Minimum characters in the shared guidance. */
126
+ const COMMON_MIN_CHARACTERS = 2600;
127
+
128
+ /** Maximum characters in the shared guidance. */
129
+ const COMMON_MAX_CHARACTERS = 9000;
43
130
 
44
131
  /** Minimum characters in one per-skill guidance file. */
45
- const SKILL_MIN_CHARACTERS = 240;
132
+ const SKILL_MIN_CHARACTERS = 900;
46
133
 
47
134
  /** Maximum characters in one per-skill guidance file. */
48
135
  const SKILL_MAX_CHARACTERS = 4000;
@@ -185,12 +272,61 @@ export function composeSkillContent(base, adaptation, common) {
185
272
  return base.trimEnd() + SKILL_SEPARATOR + adaptation.trim() + "\n\n" + common.trim() + "\n";
186
273
  }
187
274
 
275
+ /**
276
+ * List the distinct DeepSeek Harness tool names cited in backticks.
277
+ *
278
+ * Only the identifiers declared in DSH_TOOLS count, so prose that happens to
279
+ * mention "read a file" does not satisfy the harness-specificity requirement.
280
+ *
281
+ * @param text - the normalized adaptation text.
282
+ * @returns the distinct tool names found, in first-citation order.
283
+ */
284
+ export function citedTools(text) {
285
+ const found = [];
286
+ for (const match of text.matchAll(/`([a-z][a-z0-9_]*)`/gu)) {
287
+ const name = match[1];
288
+ if (DSH_TOOLS.includes(name) && !found.includes(name)) found.push(name);
289
+ }
290
+ return found;
291
+ }
292
+
293
+ /**
294
+ * List the distinct core tool names cited in backticks.
295
+ *
296
+ * The minimums are counted on this list: a file that only names optional-plugin
297
+ * capabilities would be useless in a session where those plugins are off.
298
+ *
299
+ * @param text - the normalized adaptation text.
300
+ * @returns the distinct core tool names found, in first-citation order.
301
+ */
302
+ export function citedCoreTools(text) {
303
+ return citedTools(text).filter((name) => CORE_TOOLS.includes(name));
304
+ }
305
+
306
+ /**
307
+ * Extract the body of one "- **label**:…" bullet.
308
+ *
309
+ * @param text - the normalized adaptation text.
310
+ * @param label - the label between the asterisks.
311
+ * @returns the bullet body after the label, or undefined when the bullet is missing.
312
+ */
313
+ function bulletBody(text, label) {
314
+ const marker = "- **" + label + "**";
315
+ const start = text.indexOf(marker);
316
+ if (start === -1) return undefined;
317
+ const rest = text.slice(start + marker.length);
318
+ const next = rest.indexOf("\n- **");
319
+ return next === -1 ? rest : rest.slice(0, next);
320
+ }
321
+
188
322
  /**
189
323
  * Report every problem with one per-skill adaptation file.
190
324
  *
191
- * The checks keep the 40 files comparable: each one states how to load it,
192
- * where the commands run, how to probe the installed version, how to verify
193
- * the artifact, and which operations need the user's consent.
325
+ * The checks keep the per-skill files comparable: each one states how to load
326
+ * it, where the commands run, how to probe the installed version, how to verify
327
+ * the artifact, and which operations need the user's consent. The probe and
328
+ * verification bullets must carry a concrete command or tool, and the file must
329
+ * cite core harness tools rather than only optional-plugin capabilities.
194
330
  *
195
331
  * @param name - kebab-case skill name, used in every message.
196
332
  * @param text - the normalized adaptation text.
@@ -206,10 +342,28 @@ export function adaptationProblems(name, text) {
206
342
  if (text.length > SKILL_MAX_CHARACTERS) problems.push(label + ": " + text.length + " characters exceeds the " + SKILL_MAX_CHARACTERS + "-character budget");
207
343
  const bullets = text.split("\n").filter((line) => line.startsWith("- **"));
208
344
  if (bullets.length < REQUIRED_LABELS.length) problems.push(label + ": needs at least " + REQUIRED_LABELS.length + ' bullets of the form "- **label**:…"');
345
+ const positions = [];
209
346
  for (const required of REQUIRED_LABELS) {
210
- if (!text.includes("- **" + required + "**")) problems.push(label + ': missing the "' + required + '" bullet');
347
+ const index = text.indexOf("- **" + required + "**");
348
+ if (index === -1) problems.push(label + ': missing the "' + required + '" bullet');
349
+ else positions.push(index);
350
+ }
351
+ for (let index = 1; index < positions.length; index += 1) {
352
+ if (positions[index] < positions[index - 1]) {
353
+ problems.push(label + ": required bullets must keep the order " + REQUIRED_LABELS.join(" → "));
354
+ break;
355
+ }
211
356
  }
212
357
  if (!/`[^`]+`/u.test(text)) problems.push(label + ": must name at least one concrete command or tool in backticks");
358
+ for (const required of CONCRETE_LABELS) {
359
+ const body = bulletBody(text, required);
360
+ if (body === undefined) continue;
361
+ if (!/`[^`]+`/u.test(body)) problems.push(label + ': "' + required + '" must cite a concrete command or tool in backticks, not just prose');
362
+ }
363
+ const tools = citedCoreTools(text);
364
+ if (tools.length < SKILL_MIN_CORE_TOOLS) {
365
+ problems.push(label + ": cites " + tools.length + " core DeepSeek Harness tool(s), needs at least " + SKILL_MIN_CORE_TOOLS + " (one of " + CORE_TOOLS.slice(0, 6).join("/") + "/…); optional-plugin tools do not count");
366
+ }
213
367
  if (UNFINISHED.test(text)) problems.push(label + ": still contains an unfinished marker (TODO/FIXME/TBD/待补充/占位)");
214
368
  return problems;
215
369
  }
@@ -226,9 +380,12 @@ export function commonProblems(text) {
226
380
  if (text.includes("\r")) problems.push(label + ": contains CR bytes; adaptations must use LF");
227
381
  if (!text.startsWith(COMMON_HEADING)) problems.push(label + ': must start with "' + COMMON_HEADING + '"');
228
382
  if (/^# /mu.test(text)) problems.push(label + ": must not carry a top-level heading");
229
- if (text.length < 600) problems.push(label + ": " + text.length + " characters is too short for the shared guidance");
383
+ if (text.length < COMMON_MIN_CHARACTERS) problems.push(label + ": " + text.length + " characters is too short for the shared guidance (minimum " + COMMON_MIN_CHARACTERS + ")");
384
+ if (text.length > COMMON_MAX_CHARACTERS) problems.push(label + ": " + text.length + " characters exceeds the " + COMMON_MAX_CHARACTERS + "-character budget");
230
385
  const bullets = text.split("\n").filter((line) => line.startsWith("- **"));
231
386
  if (bullets.length < COMMON_MIN_BULLETS) problems.push(label + ": needs at least " + COMMON_MIN_BULLETS + ' bullets of the form "- **label**:…"');
387
+ const tools = citedCoreTools(text);
388
+ if (tools.length < COMMON_MIN_CORE_TOOLS) problems.push(label + ": cites " + tools.length + " core DeepSeek Harness tool(s), needs at least " + COMMON_MIN_CORE_TOOLS);
232
389
  if (UNFINISHED.test(text)) problems.push(label + ": still contains an unfinished marker (TODO/FIXME/TBD/待补充/占位)");
233
390
  return problems;
234
391
  }
package/lib/catalog.d.ts CHANGED
@@ -4,6 +4,12 @@ export interface SkillEntry {
4
4
  name: string;
5
5
  /** Required routing description. */
6
6
  description: string;
7
+ /** SPDX-style license declared by the frontmatter, when present. */
8
+ license?: string;
9
+ /** Nested "metadata" block: category plus the parsed tag list. */
10
+ metadata: { category?: string; tags: string[] };
11
+ /** Top-level frontmatter fields in source order. */
12
+ frontmatterFields: string[];
7
13
  /** Absolute skill directory. */
8
14
  directory: string;
9
15
  /** Absolute path to SKILL.md. */
@@ -16,7 +22,7 @@ export declare const SKILL_FILE: "SKILL.md";
16
22
  /** Read one skill directory, or undefined when it has no SKILL.md. */
17
23
  export declare function readSkillEntry(directory: string, expectedName?: string): SkillEntry | undefined;
18
24
 
19
- /** Read every skill directory under one asset root, sorted by name. */
25
+ /** Read every skill directory under one asset root. */
20
26
  export declare function readSkillCatalog(assetRoot: string): SkillEntry[];
21
27
 
22
28
  /** Render one skill directory as a registry resource base. */
package/lib/catalog.js CHANGED
@@ -40,7 +40,15 @@ export function readSkillEntry(directory, expectedName) {
40
40
  if (expectedName !== undefined && parsed.name !== expectedName) {
41
41
  throw new Error(path + ' declares "' + parsed.name + '" but its directory is "' + expectedName + '"');
42
42
  }
43
- return { name: parsed.name, description: parsed.description, directory, path };
43
+ return {
44
+ name: parsed.name,
45
+ description: parsed.description,
46
+ license: parsed.license,
47
+ metadata: parsed.metadata,
48
+ frontmatterFields: parsed.frontmatterFields,
49
+ directory,
50
+ path
51
+ };
44
52
  }
45
53
 
46
54
  /**
package/lib/index.d.ts CHANGED
@@ -16,6 +16,14 @@ export interface OpenGisResourceBase {
16
16
  path: string;
17
17
  }
18
18
 
19
+ /** Upstream routing metadata carried on a candidate (never on a definition). */
20
+ export interface OpenGisSkillMetadata {
21
+ /** Upstream category directory, always "gis" for this pack. */
22
+ category?: string;
23
+ /** Parsed upstream metadata.tags. */
24
+ tags: string[];
25
+ }
26
+
19
27
  /** One skill summary returned by the provider catalog. */
20
28
  export interface OpenGisSkillCandidate {
21
29
  name: string;
@@ -27,6 +35,7 @@ export interface OpenGisSkillCandidate {
27
35
  locator: string;
28
36
  path: string;
29
37
  resourceBase: OpenGisResourceBase;
38
+ metadata: OpenGisSkillMetadata;
30
39
  }
31
40
 
32
41
  /** One loaded skill body returned by the provider; "content" also carries the DSH guidance. */
package/lib/index.js CHANGED
@@ -44,6 +44,47 @@ const inject = ["skills"];
44
44
  /** The invocation policy every bundled skill uses: model and user may load it. */
45
45
  const INVOCATION = { modelInvocable: true, userInvocable: true };
46
46
 
47
+ /**
48
+ * Cached shared-guidance read.
49
+ *
50
+ * "common.md" is appended to every loaded skill and never changes while the
51
+ * process runs, so it is read once and reused. Only a successful read is
52
+ * cached: a transient failure must not poison the provider for the rest of the
53
+ * session, and a caller-supplied abort signal must not cancel a shared read
54
+ * that other callers are waiting on.
55
+ */
56
+ let commonContent;
57
+
58
+ /**
59
+ * Read the shared DSH guidance, memoizing the successful result.
60
+ *
61
+ * @returns the normalized guidance text.
62
+ */
63
+ function sharedGuidance() {
64
+ if (commonContent === undefined) {
65
+ commonContent = readCommon(ADAPTATION_ROOT).catch((cause) => {
66
+ commonContent = undefined;
67
+ throw cause;
68
+ });
69
+ }
70
+ return commonContent;
71
+ }
72
+
73
+ /**
74
+ * Build the candidate metadata from the parsed upstream frontmatter.
75
+ *
76
+ * "category" is omitted when upstream does not declare one, so consumers never
77
+ * see an explicit undefined; "tags" is always an array so a consumer can map
78
+ * over it without a guard.
79
+ *
80
+ * @param metadata - the parsed frontmatter metadata, when the skill has any.
81
+ * @returns the metadata object carried on the candidate.
82
+ */
83
+ function candidateMetadata(metadata) {
84
+ const tags = Array.isArray(metadata?.tags) ? metadata.tags : [];
85
+ return metadata?.category === undefined ? { tags } : { category: metadata.category, tags };
86
+ }
87
+
47
88
  /**
48
89
  * Read and validate the packaged skill catalog, annotating asset failures with
49
90
  * the plugin name so a broken installation is diagnosable from the host log.
@@ -79,7 +120,11 @@ function apply(ctx) {
79
120
  rank: RANK,
80
121
  locator: skill.path,
81
122
  path: skill.path,
82
- resourceBase: resourceBaseOf(skill.directory)
123
+ resourceBase: resourceBaseOf(skill.directory),
124
+ // The registry keeps upstream routing metadata on the candidate only;
125
+ // a definition is a summary and must not carry it. Absent values are
126
+ // omitted rather than emitted as undefined keys.
127
+ metadata: candidateMetadata(skill.metadata)
83
128
  }));
84
129
  const provider = {
85
130
  name: PROVIDER_NAME,
@@ -90,7 +135,7 @@ function apply(ctx) {
90
135
  const [raw, adaptation, common] = await Promise.all([
91
136
  readFile(skill.path, { encoding: "utf8", signal: options?.signal }),
92
137
  readAdaptation(ADAPTATION_ROOT, skill.name, options?.signal),
93
- readCommon(ADAPTATION_ROOT, options?.signal)
138
+ sharedGuidance()
94
139
  ]);
95
140
  let parsed;
96
141
  try {
@@ -116,4 +161,4 @@ function apply(ctx) {
116
161
  ctx.skills.registerProvider(() => provider);
117
162
  }
118
163
 
119
- export { apply, inject, name };
164
+ export { apply, inject, name };
@@ -6,8 +6,20 @@ export interface ParsedSkillFile {
6
6
  description: string;
7
7
  /** Instruction body with the YAML frontmatter removed. */
8
8
  content: string;
9
+ /** SPDX-style license declared by the frontmatter, when present. */
10
+ license?: string;
11
+ /** Nested "metadata" block: category plus the parsed tag list. */
12
+ metadata: { category?: string; tags: string[] };
13
+ /** Top-level frontmatter fields in source order. */
14
+ frontmatterFields: string[];
9
15
  }
10
16
 
17
+ /** Top-level fields the Agent Skills specification allows. */
18
+ export declare const LEGAL_FIELDS: readonly string[];
19
+
20
+ /** Nested "metadata" keys the packaged snapshot relies on. */
21
+ export declare const LEGAL_METADATA_FIELDS: readonly string[];
22
+
11
23
  /** Report whether a value is a valid kebab-case skill name. */
12
24
  export declare function isSkillName(value: unknown): value is string;
13
25
 
package/lib/skill-file.js CHANGED
@@ -2,13 +2,17 @@
2
2
  * Minimal SKILL.md frontmatter reader shared by the plugin, the sync script,
3
3
  * and the validation script.
4
4
  *
5
- * Vendored opengis-skills files keep "name" and "description" on single lines,
6
- * so only scalar fields are read; list fields such as "tags" are ignored.
7
- * Multi-line block scalars are rejected instead of being silently truncated.
8
- * Double-quoted scalars support the common YAML escape sequences; a value whose
9
- * inner quotes were left unescaped upstream (invalid YAML, but unambiguous in
10
- * practice) is read between the outermost quotes so the vendored snapshot does
11
- * not have to be rewritten.
5
+ * Upstream migrated every skill to the six fields of the Agent Skills open
6
+ * specification: "name", "description", "license", "metadata" (a nested map
7
+ * with "category" and "tags"), plus the optional "compatibility" and
8
+ * "allowed-tools". The reader therefore understands one level of nesting and
9
+ * reports the top-level field order, so the validation script can prove the
10
+ * vendored snapshot still uses only legal fields.
11
+ *
12
+ * Scalar handling stays tolerant on purpose: upstream writes long descriptions
13
+ * with literal inner quotes (invalid YAML, but unambiguous in practice), and
14
+ * the vendored snapshot must stay byte-identical to the upstream git blob.
15
+ * Block scalars are still rejected instead of being silently truncated.
12
16
  *
13
17
  * @module @dsh-gis/dsh-opengis-skill/skill-file
14
18
  */
@@ -22,6 +26,15 @@ const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/u;
22
26
  /** One "key: value" scalar line inside the frontmatter block. */
23
27
  const FIELD = /^([A-Za-z][A-Za-z0-9_-]*):[ \t]*(.*)$/u;
24
28
 
29
+ /** One "key:" line that opens a nested block, for example "metadata:". */
30
+ const NESTED = /^([A-Za-z][A-Za-z0-9_-]*):[ \t]*$/u;
31
+
32
+ /** One nested " key: value" line inside a block opened by NESTED. */
33
+ const NESTED_FIELD = /^[ \t]+([A-Za-z][A-Za-z0-9_-]*):[ \t]*(.*)$/u;
34
+
35
+ /** One nested sequence item inside a block opened by NESTED. */
36
+ const NESTED_ITEM = /^[ \t]+-[ \t]+(.*)$/u;
37
+
25
38
  /** A complete single-line double-quoted YAML scalar. */
26
39
  const DOUBLE_QUOTED = /^"((?:[^"\\]|\\.)*)"$/u;
27
40
 
@@ -31,6 +44,12 @@ const SINGLE_QUOTED = /^'((?:[^']|'')*)'$/u;
31
44
  /** One double-quoted escape sequence: \uXXXX, \UXXXXXXXX, \xXX, or \c. */
32
45
  const DOUBLE_QUOTED_ESCAPE = /\\(u[0-9A-Fa-f]{4}|U[0-9A-Fa-f]{8}|x[0-9A-Fa-f]{2}|[\s\S])/gu;
33
46
 
47
+ /** The top-level fields the Agent Skills specification allows. */
48
+ export const LEGAL_FIELDS = Object.freeze(["name", "description", "license", "metadata", "compatibility", "allowed-tools"]);
49
+
50
+ /** The nested "metadata" keys the packaged snapshot relies on. */
51
+ export const LEGAL_METADATA_FIELDS = Object.freeze(["category", "tags"]);
52
+
34
53
  /** The one-character YAML escape sequences this reader understands. */
35
54
  const SIMPLE_ESCAPES = new Map([
36
55
  ["0", "\0"],
@@ -57,7 +76,9 @@ const SIMPLE_ESCAPES = new Map([
57
76
  *
58
77
  * @param raw - the complete file contents.
59
78
  * @param path - the file path, used in error messages.
60
- * @returns the validated name and description plus the body without frontmatter.
79
+ * @returns the validated name and description, the optional license and
80
+ * metadata (category plus tags), the top-level field order, and the body
81
+ * without frontmatter.
61
82
  * @throws when the frontmatter, the name, or the description is missing or malformed.
62
83
  */
63
84
  export function parseSkillFile(raw, path) {
@@ -65,17 +86,87 @@ export function parseSkillFile(raw, path) {
65
86
  const text = raw.charCodeAt(0) === 0xfeff ? raw.slice(1) : raw;
66
87
  const match = FRONTMATTER.exec(text);
67
88
  if (match === null) throw new Error(path + ": missing YAML frontmatter");
68
- const fields = new Map();
69
- for (const line of match[1].split(/\r?\n/u)) {
70
- const entry = FIELD.exec(line);
71
- if (entry === null) continue;
72
- fields.set(entry[1], parseScalar(entry[2].trim(), path + ': "' + entry[1] + '"'));
73
- }
89
+ const { fields, nested, keys } = readFields(match[1], path);
74
90
  const name = fields.get("name");
75
91
  const description = fields.get("description");
76
92
  if (!isSkillName(name)) throw new Error(path + ': "name" must be kebab-case, got ' + JSON.stringify(name));
77
93
  if (typeof description !== "string" || description.length === 0) throw new Error(path + ': "description" is required');
78
- return { name, description, content: normalizeBody(text.slice(match[0].length)) };
94
+ const license = fields.get("license");
95
+ const frontmatter = { fields: keys, metadata: readMetadata(nested.get("metadata"), path) };
96
+ return {
97
+ name,
98
+ description,
99
+ content: normalizeBody(text.slice(match[0].length)),
100
+ license: typeof license === "string" && license.length > 0 ? license : undefined,
101
+ metadata: frontmatter.metadata,
102
+ frontmatterFields: frontmatter.fields
103
+ };
104
+ }
105
+
106
+ /**
107
+ * Read the top-level scalars and the nested blocks of one frontmatter block.
108
+ *
109
+ * A nested block is opened by a "key:" line with no value; its children must
110
+ * be indented "key: value" scalars or "- item" sequence entries.
111
+ *
112
+ * @param block - the text between the frontmatter markers.
113
+ * @param path - the file path, used in error messages.
114
+ * @returns the top-level scalar map and the nested block map.
115
+ * @throws when a nested block is malformed.
116
+ */
117
+ function readFields(block, path) {
118
+ const fields = new Map();
119
+ const nested = new Map();
120
+ const keys = [];
121
+ let open = null;
122
+ for (const line of block.split(/\r?\n/u)) {
123
+ const nestedItem = NESTED_ITEM.exec(line);
124
+ if (nestedItem !== null) {
125
+ if (open === null) throw new Error(path + ": sequence item outside a nested block");
126
+ open.items.push(parseScalar(nestedItem[1].trim(), path + ': "' + open.key + '"'));
127
+ continue;
128
+ }
129
+ const nestedField = NESTED_FIELD.exec(line);
130
+ if (nestedField !== null) {
131
+ if (open === null) throw new Error(path + ': indented field "' + nestedField[1] + '" outside a nested block');
132
+ open.values.set(nestedField[1], parseScalar(nestedField[2].trim(), path + ': "' + open.key + '.' + nestedField[1] + '"'));
133
+ continue;
134
+ }
135
+ if (/^[ \t]*-[ \t]/u.test(line) || /^-[ \t]/u.test(line)) throw new Error(path + ": sequence item outside a nested block");
136
+ const entry = FIELD.exec(line);
137
+ if (entry === null) continue;
138
+ const value = entry[2].trim();
139
+ keys.push(entry[1]);
140
+ if (value.length === 0) {
141
+ open = { key: entry[1], values: new Map(), items: [] };
142
+ nested.set(entry[1], open);
143
+ continue;
144
+ }
145
+ open = null;
146
+ fields.set(entry[1], parseScalar(value, path + ': "' + entry[1] + '"'));
147
+ }
148
+ return { fields, nested, keys };
149
+ }
150
+
151
+ /**
152
+ * Normalize one nested "metadata" block into the registry metadata object.
153
+ *
154
+ * @param block - the nested block, or undefined when "metadata:" is absent.
155
+ * @param path - the file path, used in error messages.
156
+ * @returns the metadata object; always an empty object when the block is absent.
157
+ */
158
+ function readMetadata(block, path) {
159
+ if (block === undefined) return { tags: [] };
160
+ const metadata = {};
161
+ for (const [key, value] of block.values) metadata[key] = value;
162
+ if (block.items.length > 0) metadata.tags = block.items;
163
+ if (typeof metadata.tags === "string") {
164
+ metadata.tags = metadata.tags.split(/\s*,\s*/u).filter((tag) => tag.length > 0);
165
+ } else if (metadata.tags === undefined) {
166
+ metadata.tags = [];
167
+ }
168
+ if (!Array.isArray(metadata.tags)) throw new Error(path + ': "metadata.tags" must be a comma-separated string or a sequence');
169
+ return metadata;
79
170
  }
80
171
 
81
172
  /**
@@ -170,4 +261,4 @@ function decodeDoubleQuoted(body, subject, lenient) {
170
261
  if (lenient) return match;
171
262
  throw new Error(subject + ': unsupported escape sequence "\\' + escape + '"');
172
263
  });
173
- }
264
+ }
package/locale/en.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "OpenGIS Skills",
4
- "description": "40 GIS skills from opengis-skills (GDAL, QGIS, GeoServer, PostGIS, DuckDB Spatial, JTS, CesiumJS, OpenLayers and more), loaded on demand with DeepSeek Harness execution guidance."
4
+ "description": "45 GIS skills from opengis-skills (GDAL, QGIS, GeoServer, PostGIS, DuckDB Spatial, JTS, GEOS, CesiumJS, OpenLayers, MapLibre, OpenDroneMap, STAC/COG and more) loaded on demand, each extended with a DeepSeek Harness execution layer: tool mapping, background jobs, artifact verification and consent gates."
5
5
  }
6
6
  }
package/locale/zh.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "meta": {
3
3
  "title": "OpenGIS 技能包",
4
- "description": "来自 opengis-skills 的 40 个 GIS 技能:GDAL、QGIS、GeoServer、PostGIS、DuckDB Spatial、JTS、CesiumJS、OpenLayers 等,按需加载并附带 DeepSeek Harness 执行指引。"
4
+ "description": "来自 opengis-skills 的 45 个 GIS 技能:GDAL、QGIS、GeoServer、PostGIS、DuckDB Spatial、JTS、GEOS、CesiumJS、OpenLayers、MapLibre、OpenDroneMap、STAC/COG 等。正文与参考资料按需加载,并附带 DeepSeek Harness 执行层(工具映射、后台作业、产物验证、权限确认)。"
5
5
  }
6
6
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dsh-gis/dsh-opengis-skill",
3
- "version": "0.2.0",
4
- "description": "OpenGIS skill pack for DeepSeek Harness: the 40 gis/ skills from opengis-skills (GDAL, QGIS, GeoServer, PostGIS, DuckDB Spatial, JTS, CesiumJS, OpenLayers and more), loaded on demand with a DeepSeek Harness adaptation layer.",
3
+ "version": "0.4.0",
4
+ "description": "OpenGIS skill pack for DeepSeek Harness: the 45 gis/ skills from opengis-skills, vendored byte-for-byte and loaded on demand, plus a DeepSeek Harness execution layer (tool mapping, background jobs, verification, consent, upstream routing metadata) appended at load time.",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",
@@ -77,6 +77,11 @@
77
77
  "qgis",
78
78
  "pyqgis",
79
79
  "geoserver",
80
+ "geos",
81
+ "maplibre-gl-js",
82
+ "maplibre-native",
83
+ "opendronemap",
84
+ "stac-cog-titiler",
80
85
  "mapserver",
81
86
  "postgis",
82
87
  "proj",
@@ -104,4 +109,4 @@
104
109
  "access": "public",
105
110
  "registry": "https://registry.npmjs.org/"
106
111
  }
107
- }
112
+ }