Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
100,256 changes: 100,256 additions & 0 deletions copilot/js/cl100k_base.tiktoken

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
1,356 changes: 685 additions & 671 deletions copilot/js/main.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions copilot/js/main.js.map

Large diffs are not rendered by default.

199,998 changes: 199,998 additions & 0 deletions copilot/js/o200k_base.tiktoken

Large diffs are not rendered by default.

44 changes: 44 additions & 0 deletions copilot/js/policy-templates/darwin/IDEGitHubCopilot.mobileconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PayloadContent</key>
<array>
<dict>
<key>PayloadDisplayName</key>
<string>GitHub Copilot Policy</string>
<key>PayloadIdentifier</key>
<string>IDEGitHubCopilot</string>
<key>PayloadType</key>
<string>IDEGitHubCopilot</string>
<key>PayloadUUID</key>
<string>12345678-1234-1234-1234-123456789012</string>
<key>PayloadVersion</key>
<integer>1</integer>
<key>PayloadEnabled</key>
<true/>
<key>mcp.contributionPoint.enabled</key>
<false/>
</dict>
</array>

<key>PayloadDescription</key>
<string>Configures GitHub Copilot policies for IDEs</string>
<key>PayloadDisplayName</key>
<string>GitHub Copilot Policy</string>
<key>PayloadIdentifier</key>
<string>IDEGitHubCopilot</string>
<key>PayloadOrganization</key>
<string>Microsoft Corporation</string>
<key>PayloadRemovalDisallowed</key>
<false/>
<key>PayloadScope</key>
<string>System</string>
<key>PayloadType</key>
<string>Configuration</string>
<key>PayloadUUID</key>
<string>87654321-4321-4321-4321-210987654321</string>
<key>PayloadVersion</key>
<integer>1</integer>
</dict>
</plist>
117 changes: 117 additions & 0 deletions copilot/js/policy-templates/darwin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
# GitHub Copilot macOS Policy Configuration

This directory contains policy templates for configuring GitHub Copilot behavior on macOS systems using Apple Configuration Profiles.

## Overview

The `IDEGitHubCopilot.mobileconfig` file is a macOS Configuration Profile that allows administrators to manage GitHub Copilot policies across their organization. This profile defines settings that control extension behavior, particularly for MCP (Model Context Protocol) servers.

## Available Policies

| Policy Name | Description | Type | Default |
|-------------|-------------|------|---------|
| mcp.contributionPoint.enabled | Controls whether extension-contributed MCP servers are enabled | Boolean | true |

## Installation Methods

### Method 1: Configuration Profile Installation (Recommended for Administrators)

The `IDEGitHubCopilot.mobileconfig` file provides the easiest way to deploy GitHub Copilot policies across multiple macOS systems.

#### Step 1: Locate the Configuration Profile
Find the `IDEGitHubCopilot.mobileconfig` file in this directory.

#### Step 2: Install the Configuration Profile
1. **Double-click** the `IDEGitHubCopilot.mobileconfig` file
2. macOS will open **System Settings** (or **System Preferences** on older versions)
3. You'll see a dialog asking if you want to install the profile
4. Click **Install** to proceed
5. Enter your administrator password when prompted
6. The profile will be installed **system-wide**

#### Step 3: Verify Installation
1. Open **System Settings** → **Privacy & Security** → **Profiles**
2. You should see "GitHub Copilot Policy" in the list of installed profiles
3. Click on it to view the configured settings

#### Step 4: Modify Policy Settings
To change the `mcp.contributionPoint.enabled` setting:

1. Open **System Settings** → **Privacy & Security** → **Profiles**
2. Select the "GitHub Copilot Policy" profile
3. Click **Edit** or **Configure**
4. Find the `mcp.contributionPoint.enabled` setting
5. Toggle it to:
- **true** (checked) - Enable extension-contributed MCP servers
- **false** (unchecked) - Disable extension-contributed MCP servers
6. Click **Save** or **Apply**

### Method 2: Command Line Installation (Alternative)

You can also install the configuration profile using the command line:

```bash
# Install the profile
sudo profiles -I -F IDEGitHubCopilot.mobileconfig

# Verify installation
profiles -P

# Remove the profile (if needed)
sudo profiles -R -p IDEGitHubCopilot
```

### Method 3: MDM Deployment (Enterprise)

For enterprise environments, the `IDEGitHubCopilot.mobileconfig` file can be deployed through Mobile Device Management (MDM) solutions like:

- Apple Business Manager
- Jamf Pro
- Microsoft Intune
- VMware Workspace ONE

Simply upload the `IDEGitHubCopilot.mobileconfig` file to your MDM solution and deploy it to your target devices.

## Verification

You can verify the current settings with:

```bash
# Check managed preferences
defaults read /Library/Managed\ Preferences/IDEGitHubCopilot 2>/dev/null || echo "No managed settings found"
```

## How It Works

The GitHub Copilot extension uses the `GroupPolicyWatcher` class to monitor policy changes. When policies are updated:

1. The policy watcher detects the change
2. Updates the internal policy state
3. Sends an LSP notification to the client
4. The client adjusts its behavior based on the new policy settings

The extension checks for policies in `/Library/Managed Preferences/IDEGitHubCopilot.plist` (MDM managed)

## Troubleshooting

### Policy changes aren't being detected
1. Verify the configuration profile is properly installed in System Settings
2. Make sure the policy file has the correct name and structure
3. Restart IDE to ensure the policy watcher is reinitialized
4. Check the extension logs for policy-related messages

### Configuration Profile won't install
1. Ensure you have administrator privileges
2. Check that the `.mobileconfig` file isn't corrupted
3. Try installing via command line: `sudo profiles -I -F IDEGitHubCopilot.mobileconfig`

### Settings don't take effect
1. Verify the policy is correctly configured in System Settings
2. Restart IDE completely
3. Check that no user-level settings are overriding system policies

## References

- [VS Code Enterprise Setup - Configuration Profiles on macOS](https://code.visualstudio.com/docs/setup/enterprise#_configuration-profiles-on-macos)
- [Apple Configuration Profile Reference](https://developer.apple.com/documentation/devicemanagement/configuring_multiple_devices_using_profiles)
- [macOS defaults command reference](https://ss64.com/osx/defaults.html)
36 changes: 36 additions & 0 deletions copilot/js/policy-templates/win32/IDEGitHubCopilot.admx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Administrative Template for GitHub Copilot IDE Integration
This template defines Group Policy settings for GitHub Copilot in IDE environments.
-->
<policyDefinitions xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" revision="1.0" schemaVersion="1.0" xmlns="http://schemas.microsoft.com/GroupPolicy/2006/07/PolicyDefinitions">
<policyNamespaces>
<target prefix="ideGitHubCopilot" namespace="Microsoft.Policies.IDEGitHubCopilot" />
<using prefix="windows" namespace="Microsoft.Policies.Windows" />
</policyNamespaces>

<supersededAdm fileName="" />

<resources minRequiredRevision="1.0" />

<categories>
<category name="Cat_IDEGitHubCopilot" displayName="$(string.Cat_IDEGitHubCopilot)" explainText="$(string.Cat_IDEGitHubCopilot_Explain)" />
<category name="Cat_IDEGitHubCopilot_MCP" displayName="$(string.Cat_IDEGitHubCopilot_MCP)" explainText="$(string.Cat_IDEGitHubCopilot_MCP_Explain)">
<parentCategory ref="Cat_IDEGitHubCopilot" />
</category>
</categories>

<policies>
<!-- Enable Extension-Contributed MCP Servers Policy -->
<policy name="McpContributionPointEnabled" class="Both" displayName="$(string.McpContributionPointEnabled)" explainText="$(string.McpContributionPointEnabled_Explain)" key="SOFTWARE\Policies\Microsoft\IDEGitHubCopilot" valueName="mcp.contributionPoint.enabled">
<parentCategory ref="Cat_IDEGitHubCopilot_MCP" />
<supportedOn ref="windows:SUPPORTED_Windows_10_0" />
<enabledValue>
<decimal value="1" />
</enabledValue>
<disabledValue>
<decimal value="0" />
</disabledValue>
</policy>
</policies>
</policyDefinitions>
124 changes: 124 additions & 0 deletions copilot/js/policy-templates/win32/Install-PolicyTemplates.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
#Requires -RunAsAdministrator

<#
.SYNOPSIS
Installs GitHub Copilot Group Policy Administrative Templates

.DESCRIPTION
This script copies the GitHub Copilot ADMX and ADML files to the Windows PolicyDefinitions
directory to enable Group Policy management of GitHub Copilot settings.

The script must be run from the win32 directory containing the template files.

.PARAMETER Uninstall
Remove the GitHub Copilot policy templates instead of installing them

.EXAMPLE
.\Install-PolicyTemplates.ps1
Installs the GitHub Copilot policy templates

.EXAMPLE
.\Install-PolicyTemplates.ps1 -Uninstall
Removes the GitHub Copilot policy templates
#>

param(
[switch]$Uninstall
)

$ErrorActionPreference = "Stop"

# Paths
$PolicyDefinitionsPath = "$env:WINDIR\PolicyDefinitions"
$ScriptPath = Split-Path -Parent $MyInvocation.MyCommand.Path
$SourceADMX = Join-Path $ScriptPath "IDEGitHubCopilot.admx"
$SourceADML = Join-Path $ScriptPath "en-US\IDEGitHubCopilot.adml"
$TargetADMX = Join-Path $PolicyDefinitionsPath "IDEGitHubCopilot.admx"
$TargetADMLDir = Join-Path $PolicyDefinitionsPath "en-US"
$TargetADML = Join-Path $TargetADMLDir "IDEGitHubCopilot.adml"

function Test-AdminRights {
$currentUser = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentUser)
return $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
}

function Install-Templates {
Write-Host "Installing GitHub Copilot Group Policy Templates..." -ForegroundColor Green

# Verify source files exist
if (-not (Test-Path $SourceADMX)) {
throw "ADMX file not found: $SourceADMX"
}

if (-not (Test-Path $SourceADML)) {
throw "ADML file not found: $SourceADML"
}

# Verify PolicyDefinitions directory exists
if (-not (Test-Path $PolicyDefinitionsPath)) {
throw "PolicyDefinitions directory not found: $PolicyDefinitionsPath"
}

# Copy ADMX file
Write-Host "Copying ADMX file to $TargetADMX"
Copy-Item $SourceADMX $TargetADMX -Force

# Ensure en-US directory exists
if (-not (Test-Path $TargetADMLDir)) {
Write-Host "Creating directory: $TargetADMLDir"
New-Item -Path $TargetADMLDir -ItemType Directory -Force | Out-Null
}

# Copy ADML file
Write-Host "Copying ADML file to $TargetADML"
Copy-Item $SourceADML $TargetADML -Force

Write-Host "GitHub Copilot Group Policy Templates installed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "To use the templates:"
Write-Host "1. Run 'gpupdate /force' to refresh Group Policy"
Write-Host "2. Open Group Policy Editor (gpedit.msc)"
Write-Host "3. Navigate to Administrative Templates > GitHub Copilot"
}

function Uninstall-Templates {
Write-Host "Removing GitHub Copilot Group Policy Templates..." -ForegroundColor Yellow

# Remove ADMX file
if (Test-Path $TargetADMX) {
Write-Host "Removing ADMX file: $TargetADMX"
Remove-Item $TargetADMX -Force
} else {
Write-Host "ADMX file not found: $TargetADMX"
}

# Remove ADML file
if (Test-Path $TargetADML) {
Write-Host "Removing ADML file: $TargetADML"
Remove-Item $TargetADML -Force
} else {
Write-Host "ADML file not found: $TargetADML"
}

Write-Host "GitHub Copilot Group Policy Templates removed successfully!" -ForegroundColor Green
Write-Host "Run 'gpupdate /force' to refresh Group Policy"
}

# Main execution
try {
# Check for administrator rights
if (-not (Test-AdminRights)) {
throw "This script requires administrator privileges. Please run PowerShell as Administrator."
}

if ($Uninstall) {
Uninstall-Templates
} else {
Install-Templates
}

} catch {
Write-Error "Error: $($_.Exception.Message)"
exit 1
}
Loading