<commit_before># "Open Shell" integration

GitHub Desktop supports launching an available shell found on the user's
machine, to work with Git repositories outside of Desktop.

### My favourite shell XYZ isn't supported!

This is the checklist of things that it needs to support:

 - Desktop can check it exists on the user's machine
 - Desktop is able to launch it using the operating system's APIs
 - It has a stable interface (command line arguments) that doesn't change
   between updates

If you think your shell satisfies all these requirements please read on to
understand how Desktop integrates with each OS, and if you're still keen to
integrate this please fork and contribute a pull request for the team to
review.

## Windows

The source for the Windows shell integration is found in [`app/src/lib/shells/win32.ts`](https://github.com/desktop/desktop/blob/development/app/src/lib/shells/win32.ts).

These shells are currently supported:

 - Command Prompt (cmd)
 - PowerShell
 - [PowerShell Core](https://github.com/powershell/powershell/)
 - [Hyper](https://hyper.sh/)
 - Git Bash (from [Git for Windows](https://git-for-windows.github.io/))
 - [Cygwin](https://www.cygwin.com/)
 - [WSL](https://docs.microsoft.com/en-us/windows/wsl/about)
 - [Windows Terminal](https://github.com/microsoft/terminal)

These are defined in an enum at the top of the file:

```ts
export enum Shell {
  Cmd = 'Command Prompt',
  PowerShell = 'PowerShell',
  PowerShellCore = 'PowerShell Core',
  Hyper = 'Hyper',
  GitBash = 'Git Bash',
  Cygwin = 'Cygwin',
  WSL = 'WSL',
  WindowTerminal = 'Windows Terminal',
}
```

To add another shell, add a new key to the `Shell` enum with a friendly name
for the value. You will need to add code in this module to find your shell, and I'll
use **Git Bash** as a reference for the rest of the process.

### Step 1: Find the shell executable

The `getAvailableShells()` method is used to find each shell, as some may not
be present on the user's machine.

This is the example for how we resolve if Git Bash is installed.

```ts
  const gitBashPath = await findGitBash()
  if (gitBashPath != null) {<commit_msg>Update shell-integration.md<commit_after># "Open Shell" integration

GitHub Desktop supports launching an available shell found on the user's
machine, to work with Git repositories outside of Desktop.

### My favourite shell XYZ isn't supported!

This is the checklist of things that it needs to support:

 - Desktop can check it exists on the user's machine
 - Desktop is able to launch it using the operating system's APIs
 - It has a stable interface (command line arguments) that doesn't change
   between updates

If you think your shell satisfies all these requirements please read on to
understand how Desktop integrates with each OS, and if you're still keen to
integrate this please fork and contribute a pull request for the team to
review.

## Windows

The source for the Windows shell integration is found in [`app/src/lib/shells/win32.ts`](https://github.com/desktop/desktop/blob/development/app/src/lib/shells/win32.ts).

These shells are currently supported:

 - Command Prompt (cmd)
 - PowerShell
 - [PowerShell Core](https://github.com/powershell/powershell/)
 - [Hyper](https://hyper.sh/)
 - Git Bash (from [Git for Windows](https://git-for-windows.github.io/))
 - [Cygwin](https://www.cygwin.com/)
 - [WSL](https://docs.microsoft.com/en-us/windows/wsl/about) (beta)
 - [Windows Terminal](https://github.com/microsoft/terminal)

These are defined in an enum at the top of the file:

```ts
export enum Shell {
  Cmd = 'Command Prompt',
  PowerShell = 'PowerShell',
  PowerShellCore = 'PowerShell Core',
  Hyper = 'Hyper',
  GitBash = 'Git Bash',
  Cygwin = 'Cygwin',
  WSL = 'WSL',
  WindowTerminal = 'Windows Terminal',
}
```

To add another shell, add a new key to the `Shell` enum with a friendly name
for the value. You will need to add code in this module to find your shell, and I'll
use **Git Bash** as a reference for the rest of the process.

### Step 1: Find the shell executable

The `getAvailableShells()` method is used to find each shell, as some may not
be present on the user's machine.

This is the example for how we resolve if Git Bash is installed.

```ts
  const gitBashPath = await findGitBash()
  if (gitBashPath != null) {
{'fraction_non_alphanumeric': 0.0975609756097561, 'fraction_numerical': 0.0023228803716608595, 'mean_word_length': 4.03625730994152, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 14, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5545610', 'n_tokens_mistral': 1326, 'n_tokens_neox': 1214, 'n_words': 554}