@huaqiu/dsh-kicad 0.4.3 → 0.4.5
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/lib/index.d.mts +6 -0
- package/lib/index.mjs +3 -1
- package/package.json +2 -2
- package/src/index.ts +7 -0
- package/src/paths.ts +7 -1
package/lib/index.d.mts
CHANGED
|
@@ -230,6 +230,12 @@ interface SkillRegistration {
|
|
|
230
230
|
description: string;
|
|
231
231
|
/** Full SKILL.md body. */
|
|
232
232
|
content: string;
|
|
233
|
+
/**
|
|
234
|
+
* Discovery source. The DSH registry requires it on every loaded skill and
|
|
235
|
+
* rejects a missing value with "source must be a string" at load time.
|
|
236
|
+
* `'runtime'` is the registry-owned source for plugin-bundled skills.
|
|
237
|
+
*/
|
|
238
|
+
source: 'runtime';
|
|
233
239
|
/** Where `references/` and `scripts/` live for progressive disclosure. */
|
|
234
240
|
resourceBase: {
|
|
235
241
|
kind: 'directory';
|
package/lib/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getLogger } from "@huaqiu/dsh-plugin-log";
|
|
2
2
|
import { existsSync, readFileSync } from "node:fs";
|
|
3
3
|
import { dirname, join, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
4
5
|
import { defineTool } from "@deepseek-ai/dsh-tools";
|
|
5
6
|
import { spawn } from "node:child_process";
|
|
6
7
|
const DEFAULT_TIMEOUT_MS = 3e4;
|
|
@@ -160,7 +161,7 @@ function resolveSkillDir(moduleUrl, override) {
|
|
|
160
161
|
if (override && override.trim().length > 0) return resolve(override);
|
|
161
162
|
const envOverride = process.env["DSH_KICAD_SKILLS_DIR"];
|
|
162
163
|
if (envOverride && envOverride.trim().length > 0) return resolve(envOverride);
|
|
163
|
-
const here = dirname(
|
|
164
|
+
const here = dirname(fileURLToPath(moduleUrl));
|
|
164
165
|
return resolve(here, "..", "skills", KICAD_SKILL_NAME);
|
|
165
166
|
}
|
|
166
167
|
/**
|
|
@@ -963,6 +964,7 @@ function apply(ctx, config = {}) {
|
|
|
963
964
|
name: skill.name,
|
|
964
965
|
description: skill.description,
|
|
965
966
|
content: skill.content,
|
|
967
|
+
source: "runtime",
|
|
966
968
|
resourceBase: {
|
|
967
969
|
kind: "directory",
|
|
968
970
|
path: skill.dir
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huaqiu/dsh-kicad",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.mjs",
|
|
6
6
|
"types": "./lib/index.d.mts",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"@deepseek-ai/dsh-tools": "^0.1.0-rc.0"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@huaqiu/dsh-plugin-log": "0.4.
|
|
25
|
+
"@huaqiu/dsh-plugin-log": "0.4.5"
|
|
26
26
|
},
|
|
27
27
|
"files": [
|
|
28
28
|
"lib",
|
package/src/index.ts
CHANGED
|
@@ -79,6 +79,12 @@ export interface SkillRegistration {
|
|
|
79
79
|
description: string
|
|
80
80
|
/** Full SKILL.md body. */
|
|
81
81
|
content: string
|
|
82
|
+
/**
|
|
83
|
+
* Discovery source. The DSH registry requires it on every loaded skill and
|
|
84
|
+
* rejects a missing value with "source must be a string" at load time.
|
|
85
|
+
* `'runtime'` is the registry-owned source for plugin-bundled skills.
|
|
86
|
+
*/
|
|
87
|
+
source: 'runtime'
|
|
82
88
|
/** Where `references/` and `scripts/` live for progressive disclosure. */
|
|
83
89
|
resourceBase: { kind: 'directory'; path: string }
|
|
84
90
|
}
|
|
@@ -244,6 +250,7 @@ export function apply(ctx: Context, config: KicadConfigInput = {}): () => void {
|
|
|
244
250
|
name: skill.name,
|
|
245
251
|
description: skill.description,
|
|
246
252
|
content: skill.content,
|
|
253
|
+
source: 'runtime',
|
|
247
254
|
resourceBase: { kind: 'directory', path: skill.dir },
|
|
248
255
|
}),
|
|
249
256
|
)
|
package/src/paths.ts
CHANGED
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { existsSync } from 'node:fs'
|
|
19
19
|
import { dirname, join, resolve } from 'node:path'
|
|
20
|
+
import { fileURLToPath } from 'node:url'
|
|
20
21
|
|
|
21
22
|
import { KICAD_SKILL_NAME } from './scripts.js'
|
|
22
23
|
|
|
@@ -35,7 +36,12 @@ export function resolveSkillDir(moduleUrl: string, override?: string): string {
|
|
|
35
36
|
const envOverride = process.env['DSH_KICAD_SKILLS_DIR']
|
|
36
37
|
if (envOverride && envOverride.trim().length > 0) return resolve(envOverride)
|
|
37
38
|
|
|
38
|
-
|
|
39
|
+
// `new URL(moduleUrl).pathname` keeps a leading slash on Windows
|
|
40
|
+
// (`/C:/Users/...`), which `resolve()` then roots at the drive root and turns
|
|
41
|
+
// into `C:\C:\Users\...` — a doubled drive prefix. `fileURLToPath` decodes the
|
|
42
|
+
// file URL into a native path on every platform, so it is the correct input
|
|
43
|
+
// for `dirname`/`resolve`.
|
|
44
|
+
const here = dirname(fileURLToPath(moduleUrl))
|
|
39
45
|
// One level up is right for both `lib/` (built) and `src/` (vitest) because
|
|
40
46
|
// both sit directly under the package root next to `skills/`.
|
|
41
47
|
return resolve(here, '..', 'skills', KICAD_SKILL_NAME)
|