helloagents 3.1.7 → 3.1.9
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/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +24 -0
- package/.grok-plugin/plugin.json +24 -0
- package/README.md +37 -9
- package/README_CN.md +39 -11
- package/bootstrap-lite.md +4 -5
- package/bootstrap.md +4 -5
- package/cli.mjs +2 -0
- package/gemini-extension.json +1 -1
- package/hooks/hooks-cursor.json +41 -0
- package/hooks/hooks-grok.json +98 -0
- package/install.ps1 +3 -3
- package/install.sh +3 -3
- package/package.json +5 -2
- package/scripts/advisor-state.mjs +1 -1
- package/scripts/cli-config.mjs +1 -1
- package/scripts/cli-cursor.mjs +42 -0
- package/scripts/cli-doctor.mjs +173 -3
- package/scripts/cli-grok.mjs +54 -0
- package/scripts/cli-host-detect.mjs +67 -1
- package/scripts/cli-hosts.mjs +5 -0
- package/scripts/cli-lifecycle-hosts.mjs +197 -1
- package/scripts/cli-lifecycle.mjs +3 -1
- package/scripts/cli-messages.mjs +28 -14
- package/scripts/cli-runtime-root.mjs +284 -1
- package/scripts/cli-utils.mjs +36 -0
- package/scripts/cursor-hook.mjs +193 -0
- package/scripts/guard.mjs +6 -4
- package/scripts/notify-events.mjs +2 -0
- package/scripts/notify-source.mjs +2 -0
- package/scripts/notify.mjs +3 -2
- package/scripts/plan-contract.mjs +1 -1
- package/scripts/runtime-scope.mjs +1 -1
- package/skills/commands/help/SKILL.md +11 -11
|
@@ -2,9 +2,13 @@ import { platform } from 'node:os'
|
|
|
2
2
|
|
|
3
3
|
import {
|
|
4
4
|
installClaudeStandby,
|
|
5
|
+
installCursorStandby,
|
|
5
6
|
installGeminiStandby,
|
|
7
|
+
installGrokStandby,
|
|
6
8
|
uninstallClaudeStandby,
|
|
9
|
+
uninstallCursorStandby,
|
|
7
10
|
uninstallGeminiStandby,
|
|
11
|
+
uninstallGrokStandby,
|
|
8
12
|
} from './cli-hosts.mjs'
|
|
9
13
|
import {
|
|
10
14
|
cleanupCodexGlobalResidueForStandby,
|
|
@@ -20,16 +24,28 @@ import {
|
|
|
20
24
|
} from './cli-host-detect.mjs'
|
|
21
25
|
import {
|
|
22
26
|
getClaudeMarketplaceRoot,
|
|
27
|
+
getCursorInstallRoot,
|
|
28
|
+
getCursorPluginRoot,
|
|
23
29
|
getGeminiExtensionRoot,
|
|
30
|
+
getGrokMarketplaceRoot,
|
|
24
31
|
removeClaudeMarketplaceRoot,
|
|
32
|
+
removeCursorInstallRoot,
|
|
33
|
+
removeCursorPluginRoot,
|
|
25
34
|
removeGeminiExtensionRoot,
|
|
35
|
+
removeGrokMarketplaceRoot,
|
|
26
36
|
syncClaudeMarketplaceRoot,
|
|
37
|
+
syncCursorInstallRoot,
|
|
38
|
+
syncCursorPluginRoot,
|
|
27
39
|
syncGeminiExtensionRoot,
|
|
40
|
+
syncGrokMarketplaceRoot,
|
|
28
41
|
} from './cli-runtime-root.mjs'
|
|
42
|
+
import { removeIfExists } from './cli-utils.mjs'
|
|
29
43
|
|
|
30
44
|
const CLAUDE_COMMAND = process.env.HELLOAGENTS_CLAUDE_CMD || 'claude'
|
|
31
45
|
const GEMINI_COMMAND = process.env.HELLOAGENTS_GEMINI_CMD || 'gemini'
|
|
46
|
+
const GROK_COMMAND = process.env.HELLOAGENTS_GROK_CMD || 'grok'
|
|
32
47
|
const CLAUDE_PLUGIN = 'helloagents@helloagents'
|
|
48
|
+
const GROK_PLUGIN = 'helloagents'
|
|
33
49
|
|
|
34
50
|
function normalizeCommand(command = '') {
|
|
35
51
|
return String(command || '').trim()
|
|
@@ -89,6 +105,25 @@ function preserveTrackedModeOnFailure(result = {}, trackedMode = '') {
|
|
|
89
105
|
return result
|
|
90
106
|
}
|
|
91
107
|
|
|
108
|
+
function isBenignGrokPluginMissing(result = {}) {
|
|
109
|
+
return /Plugin "helloagents" not found\./i.test(result.output || '')
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
function isBenignGrokMarketplaceMissing(result = {}) {
|
|
113
|
+
return /Marketplace source ".*" not found\./i.test(result.output || '')
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function isBenignGrokMarketplaceExists(result = {}) {
|
|
117
|
+
return /Marketplace source already configured:/i.test(result.output || '')
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
function grokCleanupStepSucceeded(result = {}, { allowMissing = false, allowAlreadyExists = false } = {}) {
|
|
121
|
+
if (result.ok) return true
|
|
122
|
+
if (allowMissing && (isBenignGrokPluginMissing(result) || isBenignGrokMarketplaceMissing(result))) return true
|
|
123
|
+
if (allowAlreadyExists && isBenignGrokMarketplaceExists(result)) return true
|
|
124
|
+
return false
|
|
125
|
+
}
|
|
126
|
+
|
|
92
127
|
function installClaudeGlobalPlugin(marketplaceRoot) {
|
|
93
128
|
const add = runHostCommand(CLAUDE_COMMAND, ['plugin', 'marketplace', 'add', marketplaceRoot])
|
|
94
129
|
if (!add.ok && add.missing) return { ok: false, output: '未找到 claude 命令' }
|
|
@@ -108,6 +143,64 @@ function removeGeminiGlobalExtension() {
|
|
|
108
143
|
return runHostCommand(GEMINI_COMMAND, ['extensions', 'uninstall', 'helloagents'])
|
|
109
144
|
}
|
|
110
145
|
|
|
146
|
+
function installCursorGlobalPlugin(runtime) {
|
|
147
|
+
try {
|
|
148
|
+
const projectionRoot = getCursorPluginRoot(runtime.home)
|
|
149
|
+
const installRoot = getCursorInstallRoot(runtime.home)
|
|
150
|
+
syncCursorPluginRoot(runtime.pkgRoot, projectionRoot)
|
|
151
|
+
removeIfExists(installRoot)
|
|
152
|
+
syncCursorInstallRoot(projectionRoot, installRoot)
|
|
153
|
+
return { ok: true, output: '' }
|
|
154
|
+
} catch (error) {
|
|
155
|
+
return {
|
|
156
|
+
ok: false,
|
|
157
|
+
output: error?.message || String(error),
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function removeCursorGlobalPlugin(runtime) {
|
|
163
|
+
try {
|
|
164
|
+
removeCursorInstallRoot(runtime.home)
|
|
165
|
+
removeCursorPluginRoot(runtime.home)
|
|
166
|
+
return { ok: true, output: '' }
|
|
167
|
+
} catch (error) {
|
|
168
|
+
return {
|
|
169
|
+
ok: false,
|
|
170
|
+
output: error?.message || String(error),
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
function installGrokGlobalPlugin(marketplaceRoot) {
|
|
176
|
+
const pluginRoot = `${marketplaceRoot}${platform() === 'win32' ? '\\' : '/'}plugins${platform() === 'win32' ? '\\' : '/'}${GROK_PLUGIN}`
|
|
177
|
+
const uninstall = runHostCommand(GROK_COMMAND, ['plugin', 'uninstall', GROK_PLUGIN, '--confirm'])
|
|
178
|
+
if (uninstall.missing) return uninstall
|
|
179
|
+
if (!grokCleanupStepSucceeded(uninstall, { allowMissing: true })) return uninstall
|
|
180
|
+
|
|
181
|
+
const removeMarketplace = runHostCommand(GROK_COMMAND, ['plugin', 'marketplace', 'remove', marketplaceRoot])
|
|
182
|
+
if (removeMarketplace.missing) return removeMarketplace
|
|
183
|
+
if (!grokCleanupStepSucceeded(removeMarketplace, { allowMissing: true })) return removeMarketplace
|
|
184
|
+
|
|
185
|
+
const addMarketplace = runHostCommand(GROK_COMMAND, ['plugin', 'marketplace', 'add', marketplaceRoot])
|
|
186
|
+
if (addMarketplace.missing) return addMarketplace
|
|
187
|
+
if (!grokCleanupStepSucceeded(addMarketplace, { allowAlreadyExists: true })) return addMarketplace
|
|
188
|
+
|
|
189
|
+
return runHostCommand(GROK_COMMAND, ['plugin', 'install', pluginRoot, '--trust'])
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
function removeGrokGlobalPlugin(marketplaceRoot) {
|
|
193
|
+
const uninstall = runHostCommand(GROK_COMMAND, ['plugin', 'uninstall', GROK_PLUGIN, '--confirm'])
|
|
194
|
+
if (uninstall.missing) return uninstall
|
|
195
|
+
if (!grokCleanupStepSucceeded(uninstall, { allowMissing: true })) return uninstall
|
|
196
|
+
|
|
197
|
+
const removeMarketplace = runHostCommand(GROK_COMMAND, ['plugin', 'marketplace', 'remove', marketplaceRoot])
|
|
198
|
+
if (removeMarketplace.missing) return removeMarketplace
|
|
199
|
+
if (!grokCleanupStepSucceeded(removeMarketplace, { allowMissing: true })) return removeMarketplace
|
|
200
|
+
|
|
201
|
+
return { ok: true, output: `${uninstall.output || ''}\n${removeMarketplace.output || ''}`.trim() }
|
|
202
|
+
}
|
|
203
|
+
|
|
111
204
|
function reportHostAction(runtime, action, host, mode, result = {}) {
|
|
112
205
|
const label = getHostLabel(host)
|
|
113
206
|
const isCleanup = action === 'cleanup' || action === 'uninstall'
|
|
@@ -161,6 +254,21 @@ function prepareGeminiStandby(previousMode) {
|
|
|
161
254
|
)
|
|
162
255
|
}
|
|
163
256
|
|
|
257
|
+
function prepareGrokStandby(runtime, previousMode) {
|
|
258
|
+
if (previousMode !== 'global') return {}
|
|
259
|
+
const marketplaceRoot = getGrokMarketplaceRoot(runtime.home)
|
|
260
|
+
return preserveTrackedModeOnFailure(
|
|
261
|
+
buildNativeResult(
|
|
262
|
+
removeGrokGlobalPlugin(marketplaceRoot),
|
|
263
|
+
'已自动移除 Grok Build 插件与 marketplace 来源',
|
|
264
|
+
'Grok Build plugin and marketplace source removed automatically',
|
|
265
|
+
`切到 standby 前无法自动移除 Grok Build 插件,请先手动执行: grok plugin uninstall ${GROK_PLUGIN} --confirm;grok plugin marketplace remove "${marketplaceRoot}"`,
|
|
266
|
+
`Could not remove the Grok Build plugin before switching to standby. Run manually: grok plugin uninstall ${GROK_PLUGIN} --confirm; grok plugin marketplace remove "${marketplaceRoot}"`,
|
|
267
|
+
),
|
|
268
|
+
'global',
|
|
269
|
+
)
|
|
270
|
+
}
|
|
271
|
+
|
|
164
272
|
function installHostStandby(runtime, host, { previousMode = '' } = {}) {
|
|
165
273
|
if (host === 'claude') {
|
|
166
274
|
const cleanupResult = prepareClaudeStandby(previousMode)
|
|
@@ -176,6 +284,25 @@ function installHostStandby(runtime, host, { previousMode = '' } = {}) {
|
|
|
176
284
|
if (detectRuntimeHostMode('gemini', runtime) !== 'global') removeGeminiExtensionRoot(runtime.home)
|
|
177
285
|
return cleanupResult
|
|
178
286
|
}
|
|
287
|
+
if (host === 'grok') {
|
|
288
|
+
const cleanupResult = prepareGrokStandby(runtime, previousMode)
|
|
289
|
+
if (cleanupResult.ok === false) return cleanupResult
|
|
290
|
+
installGrokStandby(runtime.home, runtime.pkgRoot)
|
|
291
|
+
if (detectRuntimeHostMode('grok', runtime) !== 'global') removeGrokMarketplaceRoot(runtime.home)
|
|
292
|
+
return cleanupResult
|
|
293
|
+
}
|
|
294
|
+
if (host === 'cursor') {
|
|
295
|
+
if (previousMode === 'global') {
|
|
296
|
+
const cleanupResult = removeCursorGlobalPlugin(runtime)
|
|
297
|
+
if (!cleanupResult.ok) return cleanupResult
|
|
298
|
+
}
|
|
299
|
+
installCursorStandby(runtime.home, runtime.pkgRoot)
|
|
300
|
+
if (detectRuntimeHostMode('cursor', runtime) !== 'global') {
|
|
301
|
+
removeCursorInstallRoot(runtime.home)
|
|
302
|
+
removeCursorPluginRoot(runtime.home)
|
|
303
|
+
}
|
|
304
|
+
return {}
|
|
305
|
+
}
|
|
179
306
|
if (!installCodexStandby(runtime.home, runtime.pkgRoot)) return { skipped: true }
|
|
180
307
|
cleanupCodexGlobalResidueForStandby(runtime.home)
|
|
181
308
|
return {}
|
|
@@ -208,6 +335,28 @@ function installHostGlobal(runtime, host) {
|
|
|
208
335
|
)
|
|
209
336
|
return result
|
|
210
337
|
}
|
|
338
|
+
if (host === 'grok') {
|
|
339
|
+
uninstallGrokStandby(runtime.home)
|
|
340
|
+
const marketplaceRoot = getGrokMarketplaceRoot(runtime.home)
|
|
341
|
+
syncGrokMarketplaceRoot(runtime.pkgRoot, marketplaceRoot)
|
|
342
|
+
return buildNativeResult(
|
|
343
|
+
installGrokGlobalPlugin(marketplaceRoot),
|
|
344
|
+
'已自动安装 Grok Build 原生插件;重启 Grok Build 后生效',
|
|
345
|
+
'Grok Build native plugin installed automatically; restart Grok Build to apply',
|
|
346
|
+
`Grok Build 原生插件自动安装失败,请手动执行: grok plugin marketplace add "${marketplaceRoot}";grok plugin install "${marketplaceRoot}${platform() === 'win32' ? '\\' : '/'}plugins${platform() === 'win32' ? '\\' : '/'}${GROK_PLUGIN}" --trust`,
|
|
347
|
+
`Grok Build native plugin auto-install failed. Run manually: grok plugin marketplace add "${marketplaceRoot}"; grok plugin install "${marketplaceRoot}${platform() === 'win32' ? '\\' : '/'}plugins${platform() === 'win32' ? '\\' : '/'}${GROK_PLUGIN}" --trust`,
|
|
348
|
+
)
|
|
349
|
+
}
|
|
350
|
+
if (host === 'cursor') {
|
|
351
|
+
uninstallCursorStandby(runtime.home)
|
|
352
|
+
return buildNativeResult(
|
|
353
|
+
installCursorGlobalPlugin(runtime),
|
|
354
|
+
'已自动安装 Cursor 原生本地插件;重启 Cursor 后生效',
|
|
355
|
+
'Cursor native local plugin installed automatically; restart Cursor to apply',
|
|
356
|
+
`Cursor 本地插件自动安装失败,请将 "${getCursorPluginRoot(runtime.home)}" 的内容复制到 "${getCursorInstallRoot(runtime.home)}"`,
|
|
357
|
+
`Cursor local plugin auto-install failed. Copy the contents of "${getCursorPluginRoot(runtime.home)}" into "${getCursorInstallRoot(runtime.home)}"`,
|
|
358
|
+
)
|
|
359
|
+
}
|
|
211
360
|
uninstallCodexStandby(runtime.home)
|
|
212
361
|
return installCodexGlobal(runtime.home, runtime.pkgRoot) ? {} : { skipped: true }
|
|
213
362
|
}
|
|
@@ -223,6 +372,19 @@ function cleanupHostStandby(runtime, host) {
|
|
|
223
372
|
if (detectRuntimeHostMode('gemini', runtime) !== 'global') removeGeminiExtensionRoot(runtime.home)
|
|
224
373
|
return { skipped }
|
|
225
374
|
}
|
|
375
|
+
if (host === 'grok') {
|
|
376
|
+
const skipped = !uninstallGrokStandby(runtime.home)
|
|
377
|
+
if (detectRuntimeHostMode('grok', runtime) !== 'global') removeGrokMarketplaceRoot(runtime.home)
|
|
378
|
+
return { skipped }
|
|
379
|
+
}
|
|
380
|
+
if (host === 'cursor') {
|
|
381
|
+
const skipped = !uninstallCursorStandby(runtime.home)
|
|
382
|
+
if (detectRuntimeHostMode('cursor', runtime) !== 'global') {
|
|
383
|
+
removeCursorInstallRoot(runtime.home)
|
|
384
|
+
removeCursorPluginRoot(runtime.home)
|
|
385
|
+
}
|
|
386
|
+
return { skipped }
|
|
387
|
+
}
|
|
226
388
|
const standbyCleaned = uninstallCodexStandby(runtime.home)
|
|
227
389
|
const globalResidueCleaned = uninstallCodexGlobal(runtime.home)
|
|
228
390
|
return { skipped: !(standbyCleaned || globalResidueCleaned) }
|
|
@@ -259,6 +421,32 @@ function cleanupHostGlobal(runtime, host) {
|
|
|
259
421
|
if (result.ok) removeGeminiExtensionRoot(runtime.home)
|
|
260
422
|
return result
|
|
261
423
|
}
|
|
424
|
+
if (host === 'grok') {
|
|
425
|
+
uninstallGrokStandby(runtime.home)
|
|
426
|
+
const marketplaceRoot = getGrokMarketplaceRoot(runtime.home)
|
|
427
|
+
const result = preserveTrackedModeOnFailure(
|
|
428
|
+
buildNativeResult(
|
|
429
|
+
removeGrokGlobalPlugin(marketplaceRoot),
|
|
430
|
+
'已自动移除 Grok Build 插件与 marketplace 来源',
|
|
431
|
+
'Grok Build plugin and marketplace source removed automatically',
|
|
432
|
+
`Grok Build 原生插件自动移除失败,请手动执行: grok plugin uninstall ${GROK_PLUGIN} --confirm;grok plugin marketplace remove "${marketplaceRoot}"`,
|
|
433
|
+
`Grok Build native plugin auto-remove failed. Run manually: grok plugin uninstall ${GROK_PLUGIN} --confirm; grok plugin marketplace remove "${marketplaceRoot}"`,
|
|
434
|
+
),
|
|
435
|
+
'global',
|
|
436
|
+
)
|
|
437
|
+
if (result.ok) removeGrokMarketplaceRoot(runtime.home)
|
|
438
|
+
return result
|
|
439
|
+
}
|
|
440
|
+
if (host === 'cursor') {
|
|
441
|
+
uninstallCursorStandby(runtime.home)
|
|
442
|
+
return buildNativeResult(
|
|
443
|
+
removeCursorGlobalPlugin(runtime),
|
|
444
|
+
'已自动移除 Cursor 本地插件安装目录与投影目录',
|
|
445
|
+
'Cursor local plugin install directory and projection root removed automatically',
|
|
446
|
+
`Cursor 本地插件自动移除失败,请删除 "${getCursorInstallRoot(runtime.home)}" 与 "${getCursorPluginRoot(runtime.home)}"`,
|
|
447
|
+
`Cursor local plugin auto-remove failed. Delete "${getCursorInstallRoot(runtime.home)}" and "${getCursorPluginRoot(runtime.home)}"`,
|
|
448
|
+
)
|
|
449
|
+
}
|
|
262
450
|
return { skipped: !uninstallCodexGlobal(runtime.home) }
|
|
263
451
|
}
|
|
264
452
|
|
|
@@ -270,6 +458,12 @@ function installStandby(runtime, previousModes = {}) {
|
|
|
270
458
|
const geminiResult = installHostStandby(runtime, 'gemini', { previousMode: previousModes.gemini || '' })
|
|
271
459
|
reportHostAction(runtime, 'install', 'gemini', 'standby', geminiResult)
|
|
272
460
|
results.gemini = geminiResult.skipped ? { skipped: true } : geminiResult
|
|
461
|
+
const grokResult = installHostStandby(runtime, 'grok', { previousMode: previousModes.grok || '' })
|
|
462
|
+
reportHostAction(runtime, 'install', 'grok', 'standby', grokResult)
|
|
463
|
+
results.grok = grokResult.skipped ? { skipped: true } : grokResult
|
|
464
|
+
const cursorResult = installHostStandby(runtime, 'cursor', { previousMode: previousModes.cursor || '' })
|
|
465
|
+
reportHostAction(runtime, 'install', 'cursor', 'standby', cursorResult)
|
|
466
|
+
results.cursor = cursorResult.skipped ? { skipped: true } : cursorResult
|
|
273
467
|
if (installCodexStandby(runtime.home, runtime.pkgRoot)) {
|
|
274
468
|
cleanupCodexGlobalResidueForStandby(runtime.home)
|
|
275
469
|
runtime.ok(runtime.msg('Codex CLI 已配置(standby 模式)', 'Codex CLI configured (standby mode)'))
|
|
@@ -283,7 +477,7 @@ function installStandby(runtime, previousModes = {}) {
|
|
|
283
477
|
|
|
284
478
|
function installGlobal(runtime) {
|
|
285
479
|
const results = {}
|
|
286
|
-
for (const host of ['claude', 'gemini', 'codex']) {
|
|
480
|
+
for (const host of ['claude', 'gemini', 'grok', 'cursor', 'codex']) {
|
|
287
481
|
const result = installHostGlobal(runtime, host)
|
|
288
482
|
reportHostAction(runtime, 'install', host, 'global', result)
|
|
289
483
|
results[host] = result
|
|
@@ -299,6 +493,8 @@ export function installAllHosts(runtime, mode, { previousModes = {} } = {}) {
|
|
|
299
493
|
export function uninstallAllHosts(runtime) {
|
|
300
494
|
cleanupHostGlobal(runtime, 'claude')
|
|
301
495
|
cleanupHostGlobal(runtime, 'gemini')
|
|
496
|
+
cleanupHostGlobal(runtime, 'grok')
|
|
497
|
+
cleanupHostGlobal(runtime, 'cursor')
|
|
302
498
|
uninstallCodexStandby(runtime.home)
|
|
303
499
|
uninstallCodexGlobal(runtime.home)
|
|
304
500
|
}
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import { installAllHosts, runHostLifecycle } from './cli-lifecycle-hosts.mjs'
|
|
11
11
|
import { ensureDir, safeJson, safeWrite } from './cli-utils.mjs'
|
|
12
12
|
|
|
13
|
-
export const HOSTS = ['claude', 'gemini', 'codex']
|
|
13
|
+
export const HOSTS = ['claude', 'gemini', 'grok', 'cursor', 'codex']
|
|
14
14
|
|
|
15
15
|
const runtime = {
|
|
16
16
|
home: '',
|
|
@@ -165,7 +165,9 @@ export function syncVersion() {
|
|
|
165
165
|
const packageRoot = runtime.sourceRoot || runtime.pkgRoot
|
|
166
166
|
const targets = [
|
|
167
167
|
join(packageRoot, '.claude-plugin', 'plugin.json'),
|
|
168
|
+
join(packageRoot, '.cursor-plugin', 'plugin.json'),
|
|
168
169
|
join(packageRoot, '.codex-plugin', 'plugin.json'),
|
|
170
|
+
join(packageRoot, '.grok-plugin', 'plugin.json'),
|
|
169
171
|
join(packageRoot, 'gemini-extension.json'),
|
|
170
172
|
]
|
|
171
173
|
for (const path of targets) {
|
package/scripts/cli-messages.mjs
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { existsSync } from 'node:fs'
|
|
2
2
|
import { join } from 'node:path'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
getClaudeMarketplaceRoot,
|
|
5
|
+
getCursorInstallRoot,
|
|
6
|
+
getCursorPluginRoot,
|
|
7
|
+
getGeminiExtensionRoot,
|
|
8
|
+
getGrokMarketplaceRoot,
|
|
9
|
+
} from './cli-runtime-root.mjs'
|
|
4
10
|
|
|
5
11
|
export function createMessageHelpers(isCN) {
|
|
6
12
|
const msg = (cn, en) => (isCN ? cn : en)
|
|
@@ -21,17 +27,21 @@ function codexGlobalStatus({ home, msg }) {
|
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
function pluginCommands(home) {
|
|
30
|
+
const grokMarketplaceRoot = getGrokMarketplaceRoot(home)
|
|
24
31
|
return [
|
|
25
32
|
` Claude Code: /plugin marketplace add "${getClaudeMarketplaceRoot(home)}"`,
|
|
26
33
|
' /plugin install helloagents@helloagents',
|
|
27
34
|
` Gemini CLI: gemini extensions link "${getGeminiExtensionRoot(home)}"`,
|
|
35
|
+
` Grok Build: grok plugin marketplace add "${grokMarketplaceRoot}"`,
|
|
36
|
+
` grok plugin install "${join(grokMarketplaceRoot, 'plugins', 'helloagents')}" --trust`,
|
|
37
|
+
` Cursor: copy "${getCursorPluginRoot(home)}" -> "${getCursorInstallRoot(home)}"`,
|
|
28
38
|
].join('\n')
|
|
29
39
|
}
|
|
30
40
|
|
|
31
41
|
function removeHint(msg) {
|
|
32
42
|
return msg(
|
|
33
|
-
|
|
34
|
-
|
|
43
|
+
`如已安装 Claude Code 插件,可手动移除: /plugin remove helloagents\n 如已安装 Gemini CLI 扩展,可手动移除: gemini extensions uninstall helloagents\n 如已安装 Grok Build 插件,可手动移除: grok plugin uninstall helloagents --confirm\n 如已安装 Cursor 本地插件,可手动删除: ${getCursorInstallRoot(process.env.HOME || process.env.USERPROFILE || '~')}`,
|
|
44
|
+
`If the Claude Code plugin is installed, you can remove it: /plugin remove helloagents\n If the Gemini CLI extension is installed, you can remove it: gemini extensions uninstall helloagents\n If the Grok Build plugin is installed, you can remove it: grok plugin uninstall helloagents --confirm\n If the Cursor local plugin is installed, remove: ${getCursorInstallRoot(process.env.HOME || process.env.USERPROFILE || '~')}`,
|
|
35
45
|
)
|
|
36
46
|
}
|
|
37
47
|
|
|
@@ -50,24 +60,24 @@ function renderInstallMessage(context, mode, state) {
|
|
|
50
60
|
if (mode === 'global') {
|
|
51
61
|
if (install) {
|
|
52
62
|
return msg(
|
|
53
|
-
`\n ✅ HelloAGENTS 已安装(global 模式)!\n\n Claude Code / Gemini CLI:
|
|
54
|
-
`\n ✅ HelloAGENTS installed (global mode)!\n\n Claude Code / Gemini CLI: native plugin
|
|
63
|
+
`\n ✅ HelloAGENTS 已安装(global 模式)!\n\n Claude Code / Gemini CLI / Grok Build: 已自动尝试宿主原生插件或 marketplace 安装\n Cursor: 已自动安装原生本地插件(~/.cursor/plugins/local/helloagents)\n Codex: ${codexGlobalStatus(context)}(~/.agents/plugins/marketplace.json + ~/plugins/helloagents)\n\n ${restartHint(msg)}\n\n 若宿主命令不可用,请手动执行:\n${pluginCommands(home)}\n\n 切换模式:\n helloagents --standby 标准模式(默认,非插件安装)`,
|
|
64
|
+
`\n ✅ HelloAGENTS installed (global mode)!\n\n Claude Code / Gemini CLI / Grok Build: native plugin or marketplace install attempted automatically\n Cursor: Native local plugin installed automatically (~/.cursor/plugins/local/helloagents)\n Codex: ${codexGlobalStatus(context)} (~/.agents/plugins/marketplace.json + ~/plugins/helloagents)\n\n ${restartHint(msg)}\n\n If a host command is unavailable, run manually:\n${pluginCommands(home)}\n\n Switch modes:\n helloagents --standby Standby mode (default, non-plugin install)`,
|
|
55
65
|
)
|
|
56
66
|
}
|
|
57
67
|
return msg(
|
|
58
68
|
refresh
|
|
59
|
-
? ` global 模式已刷新。\n Claude Code / Gemini
|
|
60
|
-
: ` 所有项目将自动启用完整 HelloAGENTS 规则。\n Claude Code / Gemini
|
|
69
|
+
? ` global 模式已刷新。\n Claude Code / Gemini / Grok 已自动尝试刷新宿主原生插件或 marketplace;Cursor / Codex 原生本地插件已重装并同步最新文件。\n ${restartHint(msg)}`
|
|
70
|
+
: ` 所有项目将自动启用完整 HelloAGENTS 规则。\n Claude Code / Gemini / Grok 已自动尝试安装宿主原生插件或 marketplace;Cursor / Codex 已自动安装原生本地插件。\n ${restartHint(msg)}\n\n若宿主命令不可用,请手动执行:\n${pluginCommands(home)}`,
|
|
61
71
|
refresh
|
|
62
|
-
? ` Global mode refreshed.\n Claude Code / Gemini native plugin
|
|
63
|
-
: ` All projects will use full HelloAGENTS rules.\n Claude Code / Gemini native plugin
|
|
72
|
+
? ` Global mode refreshed.\n Claude Code / Gemini / Grok native plugin or marketplace refresh was attempted automatically; Cursor / Codex native local-plugin files were reinstalled and synced.\n ${restartHint(msg)}`
|
|
73
|
+
: ` All projects will use full HelloAGENTS rules.\n Claude Code / Gemini / Grok native plugin or marketplace install was attempted automatically; Cursor / Codex now use the native local-plugin path automatically.\n ${restartHint(msg)}\n\nIf a host command is unavailable, run manually:\n${pluginCommands(home)}`,
|
|
64
74
|
)
|
|
65
75
|
}
|
|
66
76
|
|
|
67
77
|
if (install) {
|
|
68
78
|
return msg(
|
|
69
|
-
`\n ✅ HelloAGENTS 已安装(standby 模式)!\n\n Claude Code: 已自动配置(~/.claude/CLAUDE.md + hooks)\n Gemini CLI: 已自动配置(~/.gemini/GEMINI.md)\n Codex: ${codexStandbyStatus(context)}\n\n ${restartHint(msg)}\n\n standby 模式下,hello-* 技能不会自动触发。\n 在项目中使用 ~init 初始化完整项目工作流;未初始化时也可继续用 ~command 按需调用。\n\n 切换模式:\n helloagents --global 宿主级全局部署(自动尝试 Claude/Gemini
|
|
70
|
-
`\n ✅ HelloAGENTS installed (standby mode)!\n\n Claude Code: Auto-configured (~/.claude/CLAUDE.md + hooks)\n Gemini CLI: Auto-configured (~/.gemini/GEMINI.md)\n Codex: ${codexStandbyStatus(context)}\n\n ${restartHint(msg)}\n\n In standby mode, hello-* skills won't auto-trigger.\n Use ~init to initialize the full project workflow; uninitialized repos can still use ~command on demand.\n\n Switch modes:\n helloagents --global Host-wide global deployment (auto-attempts Claude/Gemini
|
|
79
|
+
`\n ✅ HelloAGENTS 已安装(standby 模式)!\n\n Claude Code: 已自动配置(~/.claude/CLAUDE.md + hooks)\n Gemini CLI: 已自动配置(~/.gemini/GEMINI.md)\n Grok Build: 已自动配置(~/.grok/AGENTS.md + hooks)\n Cursor: 已自动配置(~/.cursor/hooks.json + runtime link)\n Codex: ${codexStandbyStatus(context)}\n\n ${restartHint(msg)}\n\n standby 模式下,hello-* 技能不会自动触发。\n 在项目中使用 ~init 初始化完整项目工作流;未初始化时也可继续用 ~command 按需调用。\n\n 切换模式:\n helloagents --global 宿主级全局部署(自动尝试 Claude/Gemini/Grok 原生插件或 marketplace;Cursor/Codex 自动装原生本地插件)`,
|
|
80
|
+
`\n ✅ HelloAGENTS installed (standby mode)!\n\n Claude Code: Auto-configured (~/.claude/CLAUDE.md + hooks)\n Gemini CLI: Auto-configured (~/.gemini/GEMINI.md)\n Grok Build: Auto-configured (~/.grok/AGENTS.md + hooks)\n Cursor: Auto-configured (~/.cursor/hooks.json + runtime link)\n Codex: ${codexStandbyStatus(context)}\n\n ${restartHint(msg)}\n\n In standby mode, hello-* skills won't auto-trigger.\n Use ~init to initialize the full project workflow; uninitialized repos can still use ~command on demand.\n\n Switch modes:\n helloagents --global Host-wide global deployment (auto-attempts Claude/Gemini/Grok native plugin or marketplace installs; native local plugin auto-install for Cursor/Codex)`,
|
|
71
81
|
)
|
|
72
82
|
}
|
|
73
83
|
|
|
@@ -81,7 +91,7 @@ function renderInstallMessage(context, mode, state) {
|
|
|
81
91
|
)
|
|
82
92
|
}
|
|
83
93
|
|
|
84
|
-
function renderHelp({ pkgVersion, msg }) {
|
|
94
|
+
function renderHelp({ pkgVersion, msg, home }) {
|
|
85
95
|
return `
|
|
86
96
|
HelloAGENTS v${pkgVersion} — The orchestration kernel for AI CLIs
|
|
87
97
|
|
|
@@ -91,17 +101,19 @@ HelloAGENTS v${pkgVersion} — The orchestration kernel for AI CLIs
|
|
|
91
101
|
helloagents-js ${msg('(受管宿主配置的跨平台稳定入口)', '(cross-platform stable entrypoint for managed host configs)')}
|
|
92
102
|
|
|
93
103
|
${msg('模式切换', 'Mode switching')}:
|
|
94
|
-
helloagents --global ${msg('宿主级全局部署(自动尝试 Claude/Gemini
|
|
104
|
+
helloagents --global ${msg('宿主级全局部署(自动尝试 Claude/Gemini/Grok 原生插件或 marketplace;Cursor/Codex 自动装原生本地插件)', 'Host-wide global deployment (auto-attempts Claude/Gemini/Grok native plugin or marketplace installs; native local plugin auto-install for Cursor/Codex)')}
|
|
95
105
|
helloagents --standby ${msg('标准模式(非插件安装,hello-* 不自动触发,默认)', "Standby mode (non-plugin install, hello-* won't auto-trigger, default)")}
|
|
96
106
|
|
|
97
107
|
${msg('单 CLI 管理', 'Scoped CLI management')}:
|
|
98
108
|
helloagents install codex --standby
|
|
99
109
|
helloagents install gemini --standby
|
|
110
|
+
helloagents install grok --global
|
|
111
|
+
helloagents install cursor --global
|
|
100
112
|
helloagents install --all --global
|
|
101
113
|
helloagents update codex
|
|
102
114
|
helloagents cleanup claude --global
|
|
103
115
|
helloagents uninstall gemini
|
|
104
|
-
${msg('支持: claude | gemini | codex | --all;省略模式时优先沿用该 CLI 已记录/已检测的模式,否则回退 standby', 'Hosts: claude | gemini | codex | --all; omit mode to reuse the tracked/detected mode for that CLI, then fall back to standby')}
|
|
116
|
+
${msg('支持: claude | gemini | grok | cursor | codex | --all;省略模式时优先沿用该 CLI 已记录/已检测的模式,否则回退 standby', 'Hosts: claude | gemini | grok | cursor | codex | --all; omit mode to reuse the tracked/detected mode for that CLI, then fall back to standby')}
|
|
105
117
|
|
|
106
118
|
${msg('分支切换', 'Branch switching')}:
|
|
107
119
|
helloagents switch-branch beta
|
|
@@ -125,6 +137,8 @@ ${msg('卸载', 'Uninstall')}:
|
|
|
125
137
|
${msg('如宿主命令不可用,另需手动移除:', 'If host commands are unavailable, also remove manually:')}
|
|
126
138
|
Claude Code: /plugin remove helloagents
|
|
127
139
|
Gemini CLI: gemini extensions uninstall helloagents
|
|
140
|
+
Grok Build: grok plugin uninstall helloagents --confirm
|
|
141
|
+
Cursor: ${getCursorInstallRoot(home)}
|
|
128
142
|
`.trim()
|
|
129
143
|
}
|
|
130
144
|
|