@huaqiu/dsh-kicad 0.4.3 → 0.4.4

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.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(new URL(moduleUrl).pathname);
164
+ const here = dirname(fileURLToPath(moduleUrl));
164
165
  return resolve(here, "..", "skills", KICAD_SKILL_NAME);
165
166
  }
166
167
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huaqiu/dsh-kicad",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
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.3"
25
+ "@huaqiu/dsh-plugin-log": "0.4.4"
26
26
  },
27
27
  "files": [
28
28
  "lib",
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
- const here = dirname(new URL(moduleUrl).pathname)
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)