An open API service indexing awesome lists of open source software.

https://github.com/bommerts/copilotclicontextmenu

Windows 11 Explorer shell extension that adds 'Open GitHub Copilot CLI' to the top-level right-click context menu. Launches copilot --yolo as administrator in the selected folder. Built as a COM DLL (IExplorerCommand) with MSIX sparse packaging. Includes a single-file Inno Setup installer.
https://github.com/bommerts/copilotclicontextmenu

context-menu copilot-cli explorer github-copilot msix shell-extension windows-11

Last synced: about 1 month ago
JSON representation

Windows 11 Explorer shell extension that adds 'Open GitHub Copilot CLI' to the top-level right-click context menu. Launches copilot --yolo as administrator in the selected folder. Built as a COM DLL (IExplorerCommand) with MSIX sparse packaging. Includes a single-file Inno Setup installer.

Awesome Lists containing this project

README

          

# Copilot CLI Context Menu for Windows 11

Adds **"Open GitHub Copilot CLI"** to the Windows 11 **top-level** right-click
context menu in Explorer. No need to click "Show more options".

Clicking the entry opens an **elevated** PowerShell window in the selected
folder with Copilot CLI running in **yolo mode** (`--yolo`, all permissions
enabled).

![Screenshot](cli.png)

## How It Works

| Action | Result |
|--------|--------|
| Right-click **inside** a folder (background) | Opens Copilot CLI in that folder |
| Right-click **on** a folder | Opens Copilot CLI in the clicked folder |

## Prerequisites

- **Windows 11** (21H2+)
- **PowerShell 7+**: [Install](https://aka.ms/powershell)
- **GitHub Copilot CLI**: `winget install GitHub.Copilot` or `npm install -g @github/copilot`

---

## Quick Install (Recommended)

**Just want it to work? Download and run the installer. No build tools needed.**

1. Download **[CopilotCLIContextMenu-Setup.exe](https://github.com/bommerts/CopilotCLIContextMenu/releases/latest/download/CopilotCLIContextMenu-Setup.exe)**
from the [Releases](https://github.com/bommerts/CopilotCLIContextMenu/releases) page
2. Run it as **Administrator**
3. Click through the setup wizard
4. Right-click in any folder. **"Open GitHub Copilot CLI"** is in the
top-level context menu

The installer handles everything automatically:
- Installs a code-signing certificate into Trusted People
- Deploys the signed MSIX sparse package
- Registers the COM shell extension with Explorer

To **uninstall**, use **Add or Remove Programs** in Windows Settings. It
cleanly removes the COM registration, MSIX package, and certificate.

---

## Build From Source

If you prefer to build it yourself, or want to modify the code, follow these
steps. This requires Visual Studio and the Windows SDK.

### Additional Prerequisites

- **Visual Studio 2022** with:
- "Desktop development with C++" workload
- ".NET desktop development" workload → "Windows app development tools" component
- **Inno Setup 6** (optional, only if you want to rebuild the installer)

### 1. Create a code-signing certificate

```powershell
# Run as Administrator
.\scripts\Create-Certificate.ps1
```

This generates a self-signed certificate. Install it into Trusted People:

```powershell
Import-Certificate -FilePath certificates\CopilotCLIContextMenu.cer `
-CertStoreLocation Cert:\LocalMachine\TrustedPeople
```

### 2. Configure Visual Studio to sign with your certificate

In Visual Studio, right-click the **Package** project → Properties → Signing,
and select the certificate you just created. Alternatively, set the
`PackageCertificateThumbprint` in `Package.wapproj`.

### 3. Build the solution

Open `CopilotCliContextMenu.sln` in Visual Studio 2022 and build
**Release | x64** (or **ARM64** for ARM devices).

### 4. Deploy the MSIX package

The packaging project produces an `.msix` file. Either:

- **Right-click → Deploy** the Package project in Visual Studio, or
- Use PowerShell:
```powershell
Add-AppxPackage -Path .\Package\AppPackages\*.msix
```

### 5. Register the shell extension

```powershell
# Run as Administrator
.\scripts\Register-ShellExtension.ps1
```

### 6. Test it

Right-click inside any folder in Explorer. You should see **"Open GitHub
Copilot CLI"** in the top-level context menu.

### Uninstall (manual build)

```powershell
# Run as Administrator
.\scripts\Register-ShellExtension.ps1 -Unregister

# Remove the MSIX package
Get-AppxPackage CopilotCLIContextMenu | Remove-AppxPackage
```

### Developer Mode Alternative

If you don't want to deal with certificates during development, enable
[Windows Developer Mode](https://learn.microsoft.com/en-us/windows/apps/get-started/enable-your-device-for-development)
and install the package with:

```powershell
Add-AppxPackage -Register .\Package\Package.appxmanifest -AllowUnsigned
```

---

## Architecture

```
CopilotCLIContextMenu/
├── CopilotCliContextMenu.sln
├── ShellExtension/ # COM DLL (IExplorerCommand)
│ ├── CopilotCommand.cpp/h # Menu title, icon, and Invoke()
│ ├── CopilotCommandFactory.* # IClassFactory
│ ├── dllmain.cpp # DllGetClassObject / DllCanUnloadNow
│ ├── guid.h/cpp # COM CLSIDs
│ ├── framework.h # Common headers
│ └── exports.def # DLL exports
├── Stub/ # No-op .exe (MSIX requirement)
├── Package/ # MSIX sparse package
│ ├── Package.appxmanifest # COM + context menu declarations
│ └── Images/ # Package icons
├── installer.iss # Inno Setup script
└── scripts/
├── Create-Certificate.ps1 # Self-signed cert for signing
├── Register-ShellExtension.ps1 # Manual COM DLL registration
├── PostInstall.ps1 # Called by installer
└── PreUninstall.ps1 # Called by uninstaller
```

## Why This Is So Complex

Windows 11's modern context menu only shows entries from shell extensions that:

1. Implement `IExplorerCommand` (not the legacy `IContextMenu`)
2. Are packaged in an MSIX package with `desktop4:FileExplorerContextMenus`
3. Are registered as a COM server in the manifest
4. The package is signed with a trusted certificate

Simple registry entries (the Windows 10 approach) only appear under "Show more
options" on Windows 11. This project satisfies all four requirements so the
entry appears in the **top-level** context menu.

## Credits

Architecture inspired by [spakov/GenericShellEx](https://github.com/spakov/GenericShellEx) (MIT).

## License

MIT