@rooode/dsh-suite 0.1.5 → 0.1.6

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 (2) hide show
  1. package/bin/cli.js +45 -2
  2. package/package.json +2 -1
package/bin/cli.js CHANGED
@@ -39,9 +39,52 @@ function quoteArg(arg) {
39
39
  return JSON.stringify(arg);
40
40
  }
41
41
 
42
+ function findDshEntry() {
43
+ // 1. Try import.meta.resolve
44
+ try {
45
+ const dshPkgUrl = import.meta.resolve('@deepseek-ai/dsh/package.json');
46
+ if (dshPkgUrl) {
47
+ const dshDir = path.dirname(fileURLToPath(dshPkgUrl));
48
+ const binJs = path.join(dshDir, 'lib', 'bin.js');
49
+ if (fs.existsSync(binJs)) {
50
+ return { type: 'node', path: binJs };
51
+ }
52
+ }
53
+ } catch (e) {}
54
+
55
+ // 2. Try candidate local, workspace, and global node_modules paths
56
+ const globalNpmDir = process.env.APPDATA ? path.join(process.env.APPDATA, 'npm', 'node_modules') : '';
57
+ const candidates = [
58
+ path.join(rootDir, 'node_modules', '@deepseek-ai', 'dsh', 'lib', 'bin.js'),
59
+ path.resolve(rootDir, '..', 'node_modules', '@deepseek-ai', 'dsh', 'lib', 'bin.js'),
60
+ path.resolve(rootDir, '..', 'deepseek-harness', 'apps', 'cli', 'lib', 'bin.js'),
61
+ globalNpmDir ? path.join(globalNpmDir, '@deepseek-ai', 'dsh', 'lib', 'bin.js') : '',
62
+ '/usr/local/lib/node_modules/@deepseek-ai/dsh/lib/bin.js',
63
+ '/usr/lib/node_modules/@deepseek-ai/dsh/lib/bin.js',
64
+ ].filter(Boolean);
65
+
66
+ for (const cand of candidates) {
67
+ if (fs.existsSync(cand)) {
68
+ return { type: 'node', path: cand };
69
+ }
70
+ }
71
+
72
+ // 3. Fallback to npx
73
+ return { type: 'npx' };
74
+ }
75
+
42
76
  function execDsh(args) {
43
- // 增加 -y 避免首次运行时 npx 弹出交互提示阻塞
44
- const fullCommand = ['npx', '-y', ...args.map(quoteArg)].join(' ');
77
+ const cleanArgs = args[0] === '@deepseek-ai/dsh' ? args.slice(1) : args;
78
+ const dsh = findDshEntry();
79
+
80
+ if (dsh.type === 'node') {
81
+ return spawn(process.execPath, [dsh.path, ...cleanArgs], {
82
+ stdio: 'inherit',
83
+ });
84
+ }
85
+
86
+ // Fallback to npx with -y to prevent interactive hanging
87
+ const fullCommand = ['npx', '-y', '@deepseek-ai/dsh', ...cleanArgs.map(quoteArg)].join(' ');
45
88
  return spawn(fullCommand, {
46
89
  stdio: 'inherit',
47
90
  shell: true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rooode/dsh-suite",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "DeepSeek Harness 一键全功能增强套件 (自动化调度 + WebStorm Git 提交对比 + 代码文档多标签预览 + 对话快捷栏)",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -41,6 +41,7 @@
41
41
  "author": "rooode",
42
42
  "license": "MIT",
43
43
  "dependencies": {
44
+ "@deepseek-ai/dsh": "^0.1.1-rc.2",
44
45
  "@rooode/dsh-plugin-automation": "^0.2.2",
45
46
  "@rooode/dsh-plugin-git": "^0.1.2",
46
47
  "@rooode/dsh-plugin-preview": "^0.1.9",