• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

stacklok / toolhive-studio / 21260606032

22 Jan 2026 06:42PM UTC coverage: 52.783% (-0.5%) from 53.264%
21260606032

Pull #1513

github

web-flow
Merge ea2e08afa into 408218d23
Pull Request #1513: feat(cli): add CLI alignment flow

2257 of 4486 branches covered (50.31%)

Branch coverage included in aggregate %.

204 of 417 new or added lines in 9 files covered. (48.92%)

203 existing lines in 4 files now uncovered.

3557 of 6529 relevant lines covered (54.48%)

122.36 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/main/src/cli/dialogs.ts
1
/**
2
 * CLI Alignment Dialogs (THV-0020)
3
 */
4

5
import { dialog } from 'electron'
6
import { getUninstallInstructions } from './constants'
7
import type { ExternalCliInfo } from './types'
8
import log from '../logger'
9

10
export function showExternalCliDialog(cli: ExternalCliInfo): 'quit' {
NEW
11
  const instructions = getUninstallInstructions(cli.source)
×
NEW
12
  const versionInfo = cli.version ? ` (version ${cli.version})` : ''
×
13
  const sourceLabel =
NEW
14
    cli.source === 'homebrew'
×
15
      ? 'Homebrew'
16
      : cli.source === 'winget'
×
17
        ? 'Winget'
18
        : 'Manual installation'
19

NEW
20
  log.info(`Showing external CLI dialog for: ${cli.path}`)
×
21

NEW
22
  dialog.showMessageBoxSync({
×
23
    type: 'error',
24
    title: 'External ToolHive CLI Detected',
25
    message: 'ToolHive Studio cannot run while an external CLI is installed.',
26
    detail: [
27
      `Found: ${cli.path}${versionInfo}`,
28
      `Source: ${sourceLabel}`,
29
      '',
30
      'ToolHive Studio manages its own CLI installation to ensure version compatibility.',
31
      'Please uninstall the external CLI and restart ToolHive Studio.',
32
      '',
33
      instructions,
34
    ].join('\n'),
35
    buttons: ['Quit'],
36
    defaultId: 0,
37
    noLink: true,
38
  })
39

NEW
40
  return 'quit'
×
41
}
42

43
export function showSymlinkBrokenDialog(target: string): boolean {
NEW
44
  log.info(`Showing symlink broken dialog for target: ${target}`)
×
45

NEW
46
  const result = dialog.showMessageBoxSync({
×
47
    type: 'warning',
48
    title: 'CLI Installation Needs Repair',
49
    message: 'The ToolHive CLI symlink is broken.',
50
    detail: [
51
      `The CLI was pointing to: ${target}`,
52
      '',
53
      'This can happen if ToolHive Studio was moved or updated.',
54
      '',
55
      'Would you like to repair the CLI installation?',
56
    ].join('\n'),
57
    buttons: ['Repair', 'Quit'],
58
    defaultId: 0,
59
    cancelId: 1,
60
    noLink: true,
61
  })
62

NEW
63
  return result === 0
×
64
}
65

66
export function showSymlinkTamperedDialog(target: string): boolean {
NEW
67
  log.info(`Showing symlink tampered dialog for target: ${target}`)
×
68

NEW
69
  const result = dialog.showMessageBoxSync({
×
70
    type: 'warning',
71
    title: 'CLI Installation Modified',
72
    message: 'The ToolHive CLI has been modified externally.',
73
    detail: [
74
      `The CLI is currently pointing to: ${target}`,
75
      '',
76
      'This is not the bundled CLI from ToolHive Studio.',
77
      'This could cause version compatibility issues.',
78
      '',
79
      'Would you like to restore the correct CLI installation?',
80
    ].join('\n'),
81
    buttons: ['Restore', 'Quit'],
82
    defaultId: 0,
83
    cancelId: 1,
84
    noLink: true,
85
  })
86

NEW
87
  return result === 0
×
88
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc