deepseek-cli-mode 1.0.1 → 1.0.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.2 — runtime discovery fixes
4
+
5
+ - `resolveDshBin()` now also looks for `@deepseek-ai/dsh` next to this package (same `node_modules`) and in the
6
+ `node_modules` of every directory on `PATH`. This fixes "cannot find @deepseek-ai/dsh" when dsh is installed under a
7
+ custom npm prefix (including Windows drive-relative prefixes such as `E:\root\.npm-global`).
8
+ - The not-found message now explains the Windows drive-relative `prefix=/root/.npm-global` pitfall and points at
9
+ `npm root -g`.
10
+
3
11
  ## 1.0.1 — security fixes
4
12
 
5
13
  Fixes from an independent security audit (Cloudflare `security-audit` skill, quick profile).
package/bin/deepseek.js CHANGED
@@ -12,7 +12,7 @@ import { spawn, spawnSync } from "node:child_process";
12
12
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
13
13
  import { createRequire } from "node:module";
14
14
  import { homedir } from "node:os";
15
- import { dirname, join, resolve } from "node:path";
15
+ import { dirname, delimiter, join, resolve } from "node:path";
16
16
  import { fileURLToPath } from "node:url";
17
17
 
18
18
  const here = dirname(fileURLToPath(import.meta.url));
@@ -81,6 +81,9 @@ Requires a local install of @deepseek-ai/dsh (npm i -g @deepseek-ai/dsh).`);
81
81
  function resolveDshBin() {
82
82
  const candidates = [
83
83
  process.env.DSH_CLI_DSH_BIN,
84
+ // Sibling install: dsh next to this package in the same node_modules.
85
+ // This is the normal layout when both were installed with one npm prefix.
86
+ join(root, "..", "@deepseek-ai", "dsh", "lib", "bin.js"),
84
87
  // Same global prefix as this node binary (npm default layout).
85
88
  join(dirname(process.execPath), "node_modules", "@deepseek-ai", "dsh", "lib", "bin.js"),
86
89
  // Common global prefixes.
@@ -96,6 +99,14 @@ function resolveDshBin() {
96
99
  candidates.push(join(process.cwd(), "node_modules", "@deepseek-ai", "dsh", "lib", "bin.js"));
97
100
  }
98
101
  for (const candidate of candidates) if (existsSync(candidate)) return candidate;
102
+ // npm's own bin directories are on PATH; check their sibling node_modules.
103
+ // This covers custom prefixes (and Windows drive-relative prefixes) that the
104
+ // fixed candidates above cannot know about.
105
+ for (const dir of String(process.env.PATH ?? "").split(delimiter)) {
106
+ if (dir === "") continue;
107
+ const candidate = join(dir, "node_modules", "@deepseek-ai", "dsh", "lib", "bin.js");
108
+ if (existsSync(candidate)) return candidate;
109
+ }
99
110
  // Resolve only from this package's own module graph (never from cwd).
100
111
  try {
101
112
  return requireFromHere.resolve("@deepseek-ai/dsh/lib/bin.js");
@@ -204,8 +215,10 @@ const dshBin = resolveDshBin();
204
215
  if (dshBin === undefined) {
205
216
  console.error(
206
217
  "deepseek: cannot find @deepseek-ai/dsh.\n" +
207
- " Install it once: npm i -g @deepseek-ai/dsh\n" +
208
- " Or point DSH_CLI_DSH_BIN at .../@deepseek-ai/dsh/lib/bin.js"
218
+ " Install it once in the same npm prefix as this CLI: npm i -g @deepseek-ai/dsh\n" +
219
+ " Or point DSH_CLI_DSH_BIN at .../@deepseek-ai/dsh/lib/bin.js\n" +
220
+ " If it is installed but not found, check `npm root -g` (a POSIX-style npm prefix such as\n" +
221
+ " /root/.npm-global resolves per drive on Windows; use C:\\... instead)."
209
222
  );
210
223
  process.exit(1);
211
224
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepseek-cli-mode",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "Terminal (CLI) mode for DeepSeek Harness — an interactive, Claude Code-style coding agent for your shell.",
5
5
  "type": "module",
6
6
  "main": "index.js",