@rooode/dsh-suite 0.1.5 → 0.1.7
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/bin/cli.js +99 -6
- package/package.json +4 -3
package/bin/cli.js
CHANGED
|
@@ -19,16 +19,66 @@ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
|
19
19
|
|
|
20
20
|
const rawArgs = process.argv.slice(2);
|
|
21
21
|
|
|
22
|
+
function getPluginVersion(pluginName) {
|
|
23
|
+
const pluginShortName = pluginName.split('/')[1] || pluginName;
|
|
24
|
+
const candidates = [
|
|
25
|
+
() => {
|
|
26
|
+
const pkgUrl = import.meta.resolve(`${pluginName}/package.json`);
|
|
27
|
+
return JSON.parse(fs.readFileSync(fileURLToPath(pkgUrl), 'utf-8')).version;
|
|
28
|
+
},
|
|
29
|
+
() => {
|
|
30
|
+
const p = path.join(rootDir, 'node_modules', '@rooode', pluginShortName, 'package.json');
|
|
31
|
+
return JSON.parse(fs.readFileSync(p, 'utf-8')).version;
|
|
32
|
+
},
|
|
33
|
+
() => {
|
|
34
|
+
const p = path.resolve(rootDir, '..', pluginShortName, 'package.json');
|
|
35
|
+
return JSON.parse(fs.readFileSync(p, 'utf-8')).version;
|
|
36
|
+
},
|
|
37
|
+
() => {
|
|
38
|
+
const p = path.resolve(rootDir, '..', '@rooode', pluginShortName, 'package.json');
|
|
39
|
+
return JSON.parse(fs.readFileSync(p, 'utf-8')).version;
|
|
40
|
+
},
|
|
41
|
+
() => {
|
|
42
|
+
const userHome = process.env.USERPROFILE || process.env.HOME || '';
|
|
43
|
+
const p = path.join(userHome, '.dsh', 'profiles', 'web', 'node_modules', '@rooode', pluginShortName, 'package.json');
|
|
44
|
+
return JSON.parse(fs.readFileSync(p, 'utf-8')).version;
|
|
45
|
+
},
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
for (const cand of candidates) {
|
|
49
|
+
try {
|
|
50
|
+
const v = cand();
|
|
51
|
+
if (v) return `v${v}`;
|
|
52
|
+
} catch (e) {}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const declared = pkg.dependencies?.[pluginName];
|
|
56
|
+
if (declared) return declared.replace(/^[\^~]/, 'v');
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function formatPluginLine(icon, name, desc, colorCode) {
|
|
61
|
+
const ver = getPluginVersion(name);
|
|
62
|
+
const tag = `[${name}] (${ver})`;
|
|
63
|
+
const paddedTag = tag.padEnd(41, ' ');
|
|
64
|
+
return ` \x1b[${colorCode}${icon} ${paddedTag}\x1b[0m ${desc}`;
|
|
65
|
+
}
|
|
66
|
+
|
|
22
67
|
function printBanner() {
|
|
68
|
+
const lineAuto = formatPluginLine('⚡', '@rooode/dsh-plugin-automation', '24/7 Node 服务端常驻自动化与调度中心', '33m');
|
|
69
|
+
const lineGit = formatPluginLine('🗂️', '@rooode/dsh-plugin-git', 'WebStorm 风格 Git 提交与双栏 Diff 对比', '35m');
|
|
70
|
+
const linePrev = formatPluginLine('📝', '@rooode/dsh-plugin-preview', '多标签代码/文档预览与工作空间文件树', '34m');
|
|
71
|
+
const lineQk = formatPluginLine('📌', '@rooode/dsh-plugin-quickbar', '输入框上方工作空间快捷指令栏', '32m');
|
|
72
|
+
|
|
23
73
|
console.log(`
|
|
24
74
|
\x1b[36m===============================================================================\x1b[0m
|
|
25
75
|
\x1b[1m\x1b[32m🚀 DeepSeek Harness All-in-One Suite\x1b[0m \x1b[90m(v${pkg.version})\x1b[0m
|
|
26
76
|
\x1b[90mPackage: @rooode/dsh-suite | Powered by Cordis & DSH\x1b[0m
|
|
27
77
|
\x1b[36m===============================================================================\x1b[0m
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
78
|
+
${lineAuto}
|
|
79
|
+
${lineGit}
|
|
80
|
+
${linePrev}
|
|
81
|
+
${lineQk}
|
|
32
82
|
\x1b[36m-------------------------------------------------------------------------------\x1b[0m
|
|
33
83
|
`);
|
|
34
84
|
}
|
|
@@ -39,9 +89,52 @@ function quoteArg(arg) {
|
|
|
39
89
|
return JSON.stringify(arg);
|
|
40
90
|
}
|
|
41
91
|
|
|
92
|
+
function findDshEntry() {
|
|
93
|
+
// 1. Try import.meta.resolve
|
|
94
|
+
try {
|
|
95
|
+
const dshPkgUrl = import.meta.resolve('@deepseek-ai/dsh/package.json');
|
|
96
|
+
if (dshPkgUrl) {
|
|
97
|
+
const dshDir = path.dirname(fileURLToPath(dshPkgUrl));
|
|
98
|
+
const binJs = path.join(dshDir, 'lib', 'bin.js');
|
|
99
|
+
if (fs.existsSync(binJs)) {
|
|
100
|
+
return { type: 'node', path: binJs };
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
} catch (e) {}
|
|
104
|
+
|
|
105
|
+
// 2. Try candidate local, workspace, and global node_modules paths
|
|
106
|
+
const globalNpmDir = process.env.APPDATA ? path.join(process.env.APPDATA, 'npm', 'node_modules') : '';
|
|
107
|
+
const candidates = [
|
|
108
|
+
path.join(rootDir, 'node_modules', '@deepseek-ai', 'dsh', 'lib', 'bin.js'),
|
|
109
|
+
path.resolve(rootDir, '..', 'node_modules', '@deepseek-ai', 'dsh', 'lib', 'bin.js'),
|
|
110
|
+
path.resolve(rootDir, '..', 'deepseek-harness', 'apps', 'cli', 'lib', 'bin.js'),
|
|
111
|
+
globalNpmDir ? path.join(globalNpmDir, '@deepseek-ai', 'dsh', 'lib', 'bin.js') : '',
|
|
112
|
+
'/usr/local/lib/node_modules/@deepseek-ai/dsh/lib/bin.js',
|
|
113
|
+
'/usr/lib/node_modules/@deepseek-ai/dsh/lib/bin.js',
|
|
114
|
+
].filter(Boolean);
|
|
115
|
+
|
|
116
|
+
for (const cand of candidates) {
|
|
117
|
+
if (fs.existsSync(cand)) {
|
|
118
|
+
return { type: 'node', path: cand };
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// 3. Fallback to npx
|
|
123
|
+
return { type: 'npx' };
|
|
124
|
+
}
|
|
125
|
+
|
|
42
126
|
function execDsh(args) {
|
|
43
|
-
|
|
44
|
-
const
|
|
127
|
+
const cleanArgs = args[0] === '@deepseek-ai/dsh' ? args.slice(1) : args;
|
|
128
|
+
const dsh = findDshEntry();
|
|
129
|
+
|
|
130
|
+
if (dsh.type === 'node') {
|
|
131
|
+
return spawn(process.execPath, [dsh.path, ...cleanArgs], {
|
|
132
|
+
stdio: 'inherit',
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Fallback to npx with -y to prevent interactive hanging
|
|
137
|
+
const fullCommand = ['npx', '-y', '@deepseek-ai/dsh', ...cleanArgs.map(quoteArg)].join(' ');
|
|
45
138
|
return spawn(fullCommand, {
|
|
46
139
|
stdio: 'inherit',
|
|
47
140
|
shell: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rooode/dsh-suite",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"description": "DeepSeek Harness 一键全功能增强套件 (自动化调度 + WebStorm Git 提交对比 + 代码文档多标签预览 + 对话快捷栏)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -41,10 +41,11 @@
|
|
|
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
|
-
"@rooode/dsh-plugin-preview": "^0.1.
|
|
47
|
-
"@rooode/dsh-plugin-quickbar": "^0.1.
|
|
47
|
+
"@rooode/dsh-plugin-preview": "^0.1.10",
|
|
48
|
+
"@rooode/dsh-plugin-quickbar": "^0.1.4"
|
|
48
49
|
},
|
|
49
50
|
"dsh": {
|
|
50
51
|
"bundle": {
|