dsh-code 0.6.0 → 0.7.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.
package/README.en.md CHANGED
@@ -37,11 +37,13 @@ The interface follows familiar terminal conventions, while runtime behavior cont
37
37
  Requires Node `^22.19 || >=24`, the preview `dsh` CLI, and `DEEPSEEK_API_KEY`.
38
38
 
39
39
  ```sh
40
- npm install -g @deepseek-ai/dsh@next dsh-code
40
+ npm install -g @deepseek-ai/dsh dsh-code
41
41
  npm install -g pnpm
42
- dsh plugin --profile cli add dsh-code
42
+ dsh plugin --profile cli add dsh-code@0.7.0
43
43
  ```
44
44
 
45
+ > Note: pnpm ignores packages published less than 24 hours ago, so pin `dsh-code@0.7.0` on the release day; the version can be omitted afterwards. npm installs are not affected.
46
+
45
47
  Available launch commands:
46
48
 
47
49
  ```sh
package/README.md CHANGED
@@ -37,11 +37,13 @@ DSH-Code 保留这套结构,并补充适合编码任务的终端工作流。
37
37
  需要 Node `^22.19 || >=24`、预览版 `dsh` CLI,以及 `DEEPSEEK_API_KEY`。
38
38
 
39
39
  ```sh
40
- npm install -g @deepseek-ai/dsh@next dsh-code
40
+ npm install -g @deepseek-ai/dsh dsh-code
41
41
  npm install -g pnpm
42
- dsh plugin --profile cli add dsh-code
42
+ dsh plugin --profile cli add dsh-code@0.7.0
43
43
  ```
44
44
 
45
+ > 提示:pnpm 会忽略发布不足 24 小时的包,因此发布首日请使用精确版本 `dsh-code@0.7.0`;24 小时后可省略版本号。npm 安装不受此限制。
46
+
45
47
  可用的启动指令:
46
48
  ```sh
47
49
  deepseek
package/bin/deepseek.mjs CHANGED
@@ -1,8 +1,9 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { spawn } from 'node:child_process'
4
- import { existsSync, realpathSync } from 'node:fs'
4
+ import { existsSync, readFileSync, realpathSync } from 'node:fs'
5
5
  import { createRequire } from 'node:module'
6
+ import { homedir } from 'node:os'
6
7
  import { join, resolve } from 'node:path'
7
8
  import { fileURLToPath, pathToFileURL } from 'node:url'
8
9
 
@@ -11,6 +12,30 @@ const packageRequire = createRequire(import.meta.url)
11
12
  /** Arguments required to boot DSH-Code's conventional profile. */
12
13
  export const profileArgs = (args = []) => ['--profile', 'cli', ...args]
13
14
 
15
+ /** The conventional cli profile directory under the DSH home. */
16
+ export function cliProfileDir(home = homedir()) {
17
+ return join(home, '.dsh', 'profiles', 'cli')
18
+ }
19
+
20
+ /**
21
+ * Whether the cli profile already mounts dsh-code. A bare profile composes
22
+ * dsh-base alone and keeps the process alive with no TUI runner — the alias
23
+ * must fail loudly with the missing step instead of hanging.
24
+ */
25
+ export function profileHasDshCode(profileDir = cliProfileDir(), fileExists = existsSync, readFile = readFileSync) {
26
+ const manifest = join(profileDir, 'package.json')
27
+ if (!fileExists(manifest)) return false
28
+ try {
29
+ const raw = JSON.parse(readFile(manifest, 'utf8'))
30
+ const bundles = raw?.dsh?.profile?.bundles
31
+ const dependencies = raw?.dependencies
32
+ return (Array.isArray(bundles) && bundles.includes('dsh-code'))
33
+ || (typeof dependencies === 'object' && dependencies !== null && 'dsh-code' in dependencies)
34
+ } catch {
35
+ return false
36
+ }
37
+ }
38
+
14
39
  /** Npm global-prefix roots that may contain DSH when this launcher is globally linked to a checkout. */
15
40
  export function globalDshRoots() {
16
41
  return [...new Set([
@@ -43,10 +68,20 @@ export function dshCommand(args, {
43
68
  }
44
69
 
45
70
  /** Launch the installed DSH CLI while preserving its exit status and stdio. */
46
- export function launchDsh(args = process.argv.slice(2), spawnProcess = spawn, resolveCommand = dshCommand) {
71
+ export function launchDsh(
72
+ args = process.argv.slice(2),
73
+ spawnProcess = spawn,
74
+ resolveCommand = dshCommand,
75
+ isProfileReady = profileHasDshCode,
76
+ ) {
77
+ if (!isProfileReady()) {
78
+ console.error('dsh-code: the cli profile does not mount dsh-code yet. Run: dsh plugin --profile cli add dsh-code')
79
+ process.exitCode = 1
80
+ return undefined
81
+ }
47
82
  const command = resolveCommand(args)
48
83
  if (command === undefined) {
49
- console.error('dsh-code: @deepseek-ai/dsh must be installed globally beside dsh-code; run: npm install -g @deepseek-ai/dsh@next dsh-code')
84
+ console.error('dsh-code: @deepseek-ai/dsh must be installed globally beside dsh-code; run: npm install -g @deepseek-ai/dsh dsh-code')
50
85
  process.exitCode = 1
51
86
  return undefined
52
87
  }