@lay111/dsh-plugin-google 1.0.1 → 1.0.3
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/setup.js +19 -94
- package/package.json +1 -1
package/bin/setup.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import path from 'node:path';
|
|
4
4
|
import os from 'node:os';
|
|
5
|
-
import { spawnSync } from 'node:child_process';
|
|
6
5
|
import { fileURLToPath } from 'node:url';
|
|
7
6
|
import { startGoogleOAuthLogin, getActiveAccount } from '../src/auth.js';
|
|
8
7
|
|
|
@@ -11,24 +10,20 @@ const PLUGIN_ROOT = path.resolve(__dirname, '..');
|
|
|
11
10
|
|
|
12
11
|
const HOME = os.homedir();
|
|
13
12
|
const DSH_HOME = path.join(HOME, '.dsh');
|
|
14
|
-
const DSH_TUI_HOME = path.join(HOME, '.dsh-tui');
|
|
15
13
|
const LOCAL_BIN = path.join(HOME, '.local', 'bin');
|
|
16
14
|
|
|
17
15
|
console.log(`
|
|
18
16
|
╭──────────────────────────────────────────────────────────╮
|
|
19
17
|
│ DeepSeek Harness · Google Antigravity One-Click Setup │
|
|
20
|
-
│
|
|
18
|
+
│ 为 DSH 全局注入 Google Antigravity Pro & 满血模型矩阵 │
|
|
21
19
|
╰──────────────────────────────────────────────────────────╯
|
|
22
20
|
`);
|
|
23
21
|
|
|
24
22
|
// 1. Ensure required directories
|
|
25
23
|
fs.mkdirSync(DSH_HOME, { recursive: true });
|
|
26
|
-
fs.mkdirSync(DSH_TUI_HOME, { recursive: true });
|
|
27
24
|
fs.mkdirSync(LOCAL_BIN, { recursive: true });
|
|
28
|
-
fs.mkdirSync(path.join(DSH_HOME, 'profiles', 'dsh-tui'), { recursive: true });
|
|
29
|
-
fs.mkdirSync(path.join(DSH_HOME, 'profiles', 'web'), { recursive: true });
|
|
30
25
|
|
|
31
|
-
console.log('📦 [1/
|
|
26
|
+
console.log('📦 [1/3] 配置全局 DSH 默认模型 (Gemini 3.7 Flash High)...');
|
|
32
27
|
// 2. Configure ~/.dsh/settings.yaml
|
|
33
28
|
const settingsPath = path.join(DSH_HOME, 'settings.yaml');
|
|
34
29
|
const settingsContent = `agent-default-model:
|
|
@@ -37,88 +32,16 @@ const settingsContent = `agent-default-model:
|
|
|
37
32
|
`;
|
|
38
33
|
fs.writeFileSync(settingsPath, settingsContent, 'utf-8');
|
|
39
34
|
|
|
40
|
-
console.log('
|
|
41
|
-
// 3. Configure
|
|
42
|
-
const
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- id: dsh-tui
|
|
47
|
-
name: '@deepseek-harness-tui/dsh-tui'
|
|
48
|
-
config:
|
|
49
|
-
provider: antigravity
|
|
50
|
-
model: gemini-3.7-flash
|
|
51
|
-
fullscreen: true
|
|
52
|
-
`;
|
|
53
|
-
fs.writeFileSync(tuiPatchPath, tuiPatchContent, 'utf-8');
|
|
54
|
-
|
|
55
|
-
const tuiPkgPath = path.join(DSH_HOME, 'profiles', 'dsh-tui', 'package.json');
|
|
56
|
-
if (!fs.existsSync(tuiPkgPath)) {
|
|
57
|
-
fs.writeFileSync(
|
|
58
|
-
tuiPkgPath,
|
|
59
|
-
JSON.stringify(
|
|
60
|
-
{
|
|
61
|
-
name: 'dsh-profile-dsh-tui',
|
|
62
|
-
private: true,
|
|
63
|
-
dependencies: { '@deepseek-harness-tui/dsh-tui': '^0.9.3' },
|
|
64
|
-
dsh: { profile: { bundles: ['@deepseek-ai/dsh-base', '@deepseek-harness-tui/dsh-tui'] } },
|
|
65
|
-
},
|
|
66
|
-
null,
|
|
67
|
-
2,
|
|
68
|
-
),
|
|
69
|
-
'utf-8',
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// 4. Configure Web Profile
|
|
74
|
-
const webPatchPath = path.join(DSH_HOME, 'profiles', 'web', 'cordis.patch.yml');
|
|
75
|
-
const webPatchContent = `- id: dsh-antigravity
|
|
76
|
-
name: ${PLUGIN_ROOT}
|
|
35
|
+
console.log('🧩 [2/3] 全局挂载 Google 原生插件至所有 DSH Profile (Web/CLI/TUI/Headless)...');
|
|
36
|
+
// 3. Configure Global ~/.dsh/cordis.patch.yml (Applied to ALL DSH profiles automatically)
|
|
37
|
+
const globalPatchPath = path.join(DSH_HOME, 'cordis.patch.yml');
|
|
38
|
+
const globalPatchContent = `- insert:
|
|
39
|
+
- id: dsh-antigravity
|
|
40
|
+
name: ${PLUGIN_ROOT}
|
|
77
41
|
`;
|
|
78
|
-
fs.writeFileSync(
|
|
79
|
-
|
|
80
|
-
const webPkgPath = path.join(DSH_HOME, 'profiles', 'web', 'package.json');
|
|
81
|
-
if (!fs.existsSync(webPkgPath)) {
|
|
82
|
-
fs.writeFileSync(
|
|
83
|
-
webPkgPath,
|
|
84
|
-
JSON.stringify(
|
|
85
|
-
{
|
|
86
|
-
name: 'dsh-profile-web',
|
|
87
|
-
private: true,
|
|
88
|
-
dsh: { profile: { bundles: ['@deepseek-ai/dsh-base', '@deepseek-ai/dsh-web-app'] } },
|
|
89
|
-
},
|
|
90
|
-
null,
|
|
91
|
-
2,
|
|
92
|
-
),
|
|
93
|
-
'utf-8',
|
|
94
|
-
);
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// 5. Configure ~/.dsh-tui preferences
|
|
98
|
-
fs.writeFileSync(
|
|
99
|
-
path.join(DSH_TUI_HOME, 'model.json'),
|
|
100
|
-
JSON.stringify({ provider: 'antigravity', model: 'gemini-3.7-flash' }, null, 2),
|
|
101
|
-
'utf-8',
|
|
102
|
-
);
|
|
103
|
-
fs.writeFileSync(
|
|
104
|
-
path.join(DSH_TUI_HOME, 'model-recents.json'),
|
|
105
|
-
JSON.stringify({ models: [{ provider: 'antigravity', id: 'gemini-3.7-flash' }] }, null, 2),
|
|
106
|
-
'utf-8',
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
console.log('🔗 [3/4] 注册全局快捷命令 (dst / dsh-google-auth)...');
|
|
110
|
-
const tuiBin = path.join(DSH_HOME, 'profiles', 'dsh-tui', 'node_modules', '@deepseek-harness-tui', 'dsh-tui', 'bin', 'dsh-tui.js');
|
|
111
|
-
if (fs.existsSync(tuiBin)) {
|
|
112
|
-
try {
|
|
113
|
-
fs.unlinkSync(path.join(LOCAL_BIN, 'dst'));
|
|
114
|
-
fs.unlinkSync(path.join(LOCAL_BIN, 'dsh-tui'));
|
|
115
|
-
} catch {}
|
|
116
|
-
try {
|
|
117
|
-
fs.symlinkSync(tuiBin, path.join(LOCAL_BIN, 'dst'));
|
|
118
|
-
fs.symlinkSync(tuiBin, path.join(LOCAL_BIN, 'dsh-tui'));
|
|
119
|
-
} catch {}
|
|
120
|
-
}
|
|
42
|
+
fs.writeFileSync(globalPatchPath, globalPatchContent, 'utf-8');
|
|
121
43
|
|
|
44
|
+
// Link dsh-google-auth to PATH
|
|
122
45
|
try {
|
|
123
46
|
fs.unlinkSync(path.join(LOCAL_BIN, 'dsh-google-auth'));
|
|
124
47
|
} catch {}
|
|
@@ -126,23 +49,25 @@ try {
|
|
|
126
49
|
fs.symlinkSync(path.join(PLUGIN_ROOT, 'bin', 'auth-cli.js'), path.join(LOCAL_BIN, 'dsh-google-auth'));
|
|
127
50
|
} catch {}
|
|
128
51
|
|
|
129
|
-
console.log('🔑 [
|
|
52
|
+
console.log('🔑 [3/3] 检查 Google 账号登录状态...');
|
|
130
53
|
const active = getActiveAccount();
|
|
131
54
|
|
|
132
55
|
async function runLogin() {
|
|
133
56
|
if (active) {
|
|
134
57
|
console.log(`\n✓ 当前已登录账号: ${active.email} (项目: ${active.projectId})`);
|
|
135
|
-
console.log(`\n🎉
|
|
136
|
-
console.log(` 👉
|
|
137
|
-
console.log(` 👉 本地 Web 浏览器模式:
|
|
58
|
+
console.log(`\n🎉 安装完成!DSH 任意形态现已全局支持 Google 满血模型:`);
|
|
59
|
+
console.log(` 👉 命令行一问一答 (Headless): dsh --profile headless "你的任务"`);
|
|
60
|
+
console.log(` 👉 本地 Web 浏览器模式: dsh web`);
|
|
61
|
+
console.log(` 👉 终端交互模式 (TUI): dst / dsh --profile dsh-tui\n`);
|
|
138
62
|
} else {
|
|
139
63
|
console.log(`\n未检测到已登录的 Google 账号,正在为你唤起浏览器授权登录...`);
|
|
140
64
|
try {
|
|
141
65
|
const account = await startGoogleOAuthLogin();
|
|
142
66
|
console.log(`\n🎉 登录成功: ${account.email}!`);
|
|
143
|
-
console.log(`\n🎉
|
|
144
|
-
console.log(` 👉
|
|
145
|
-
console.log(` 👉 本地 Web 浏览器模式:
|
|
67
|
+
console.log(`\n🎉 全局配置已就绪!你可以使用任意 DSH 模式:`);
|
|
68
|
+
console.log(` 👉 命令行一问一答 (Headless): dsh --profile headless "你的任务"`);
|
|
69
|
+
console.log(` 👉 本地 Web 浏览器模式: dsh web`);
|
|
70
|
+
console.log(` 👉 终端交互模式 (TUI): dst / dsh --profile dsh-tui\n`);
|
|
146
71
|
} catch (err) {
|
|
147
72
|
console.log(`\n若浏览器未自动完成,可随时在终端运行 dsh-google-auth login 手动完成登录。`);
|
|
148
73
|
}
|