feat: add VS Code and VS Code Insiders install buttons

- Fix VS Code install URL format to match README links
- Add separate buttons for VS Code and VS Code Insiders
- Support install links for agents, prompts, and instructions
- Add VS Code icon SVG to buttons
This commit is contained in:
Aaron Powell
2026-01-28 19:45:22 +11:00
parent 63f2080694
commit d0bcc226ba
4 changed files with 49 additions and 16 deletions

View File

@@ -1,5 +1,5 @@
{ {
"generated": "2026-01-28T06:07:56.175Z", "generated": "2026-01-28T08:38:48.985Z",
"counts": { "counts": {
"agents": 140, "agents": 140,
"prompts": 134, "prompts": 134,

View File

@@ -15,10 +15,16 @@
Copy Copy
</button> </button>
<a id="install-btn" class="btn btn-primary" target="_blank" rel="noopener" title="Install to VS Code"> <a id="install-btn" class="btn btn-primary" target="_blank" rel="noopener" title="Install to VS Code">
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"> <svg viewBox="0 0 100 100" width="16" height="16" fill="currentColor">
<path d="M7.25 1a.75.75 0 0 1 .75.75V11h6.25a.75.75 0 0 1 0 1.5H8v6.25a.75.75 0 0 1-1.5 0V12.5H.25a.75.75 0 0 1 0-1.5H6.5V1.75A.75.75 0 0 1 7.25 1Z" transform="scale(0.8) translate(2, 2)"/> <path d="M95.436 26.986L75.282 15.768a6.04 6.04 0 0 0-6.895.876L28.78 51.927 11.912 39.151a4.03 4.03 0 0 0-5.154.387l-5.36 4.878a4.03 4.03 0 0 0-.003 5.947l14.646 13.396-14.646 13.396a4.03 4.03 0 0 0 .003 5.947l5.36 4.878a4.03 4.03 0 0 0 5.154.387L28.78 74.59l39.607 35.283a6.04 6.04 0 0 0 6.895.876l20.154-11.218a6.04 6.04 0 0 0 3.127-5.288V32.274a6.04 6.04 0 0 0-3.127-5.288zM75.015 73.428L46.339 51.927l28.676-21.5z" transform="scale(0.16)"/>
</svg> </svg>
Install VS Code
</a>
<a id="install-insiders-btn" class="btn btn-secondary" target="_blank" rel="noopener" title="Install to VS Code Insiders">
<svg viewBox="0 0 100 100" width="16" height="16" fill="currentColor">
<path d="M95.436 26.986L75.282 15.768a6.04 6.04 0 0 0-6.895.876L28.78 51.927 11.912 39.151a4.03 4.03 0 0 0-5.154.387l-5.36 4.878a4.03 4.03 0 0 0-.003 5.947l14.646 13.396-14.646 13.396a4.03 4.03 0 0 0 .003 5.947l5.36 4.878a4.03 4.03 0 0 0 5.154.387L28.78 74.59l39.607 35.283a6.04 6.04 0 0 0 6.895.876l20.154-11.218a6.04 6.04 0 0 0 3.127-5.288V32.274a6.04 6.04 0 0 0-3.127-5.288zM75.015 73.428L46.339 51.927l28.676-21.5z" transform="scale(0.16)"/>
</svg>
Insiders
</a> </a>
<button id="close-modal" class="btn btn-icon" title="Close"> <button id="close-modal" class="btn btn-icon" title="Close">
<svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor"> <svg viewBox="0 0 16 16" width="16" height="16" fill="currentColor">

View File

@@ -46,7 +46,8 @@ export async function openFileModal(filePath: string, type: string): Promise<voi
const modal = document.getElementById('file-modal'); const modal = document.getElementById('file-modal');
const title = document.getElementById('modal-title'); const title = document.getElementById('modal-title');
const contentEl = document.getElementById('modal-content')?.querySelector('code'); const contentEl = document.getElementById('modal-content')?.querySelector('code');
const installBtn = document.getElementById('install-vscode-btn') as HTMLAnchorElement | null; const installBtn = document.getElementById('install-btn') as HTMLAnchorElement | null;
const installInsidersBtn = document.getElementById('install-insiders-btn') as HTMLAnchorElement | null;
if (!modal || !title || !contentEl) return; if (!modal || !title || !contentEl) return;
@@ -58,14 +59,23 @@ export async function openFileModal(filePath: string, type: string): Promise<voi
contentEl.textContent = 'Loading...'; contentEl.textContent = 'Loading...';
modal.classList.remove('hidden'); modal.classList.remove('hidden');
// Setup install button // Setup install buttons (VS Code and VS Code Insiders)
const installUrl = getVSCodeInstallUrl(type, filePath); const installUrl = getVSCodeInstallUrl(type, filePath, false);
const installInsidersUrl = getVSCodeInstallUrl(type, filePath, true);
if (installUrl && installBtn) { if (installUrl && installBtn) {
installBtn.href = installUrl; installBtn.href = installUrl;
installBtn.style.display = 'inline-flex'; installBtn.style.display = 'inline-flex';
} else if (installBtn) { } else if (installBtn) {
installBtn.style.display = 'none'; installBtn.style.display = 'none';
} }
if (installInsidersUrl && installInsidersBtn) {
installInsidersBtn.href = installInsidersUrl;
installInsidersBtn.style.display = 'inline-flex';
} else if (installInsidersBtn) {
installInsidersBtn.style.display = 'none';
}
// Fetch and display content // Fetch and display content
const fileContent = await fetchFileContent(filePath); const fileContent = await fetchFileContent(filePath);

View File

@@ -5,11 +5,20 @@
const REPO_BASE_URL = 'https://raw.githubusercontent.com/github/awesome-copilot/main'; const REPO_BASE_URL = 'https://raw.githubusercontent.com/github/awesome-copilot/main';
const REPO_GITHUB_URL = 'https://github.com/github/awesome-copilot/blob/main'; const REPO_GITHUB_URL = 'https://github.com/github/awesome-copilot/blob/main';
// VS Code install URL template // VS Code install URL configurations
const VSCODE_INSTALL_URLS: Record<string, string> = { const VSCODE_INSTALL_CONFIG: Record<string, { baseUrl: string; scheme: string }> = {
instructions: 'https://aka.ms/awesome-copilot/install/instructions', instructions: {
prompt: 'https://aka.ms/awesome-copilot/install/prompt', baseUrl: 'https://aka.ms/awesome-copilot/install/instructions',
agent: 'https://aka.ms/awesome-copilot/install/agent', scheme: 'chat-instructions'
},
prompt: {
baseUrl: 'https://aka.ms/awesome-copilot/install/prompt',
scheme: 'chat-prompt'
},
agent: {
baseUrl: 'https://aka.ms/awesome-copilot/install/agent',
scheme: 'chat-agent'
},
}; };
/** /**
@@ -76,11 +85,19 @@ export async function copyToClipboard(text: string): Promise<boolean> {
/** /**
* Generate VS Code install URL * Generate VS Code install URL
* @param type - Resource type (agent, prompt, instructions)
* @param filePath - Path to the file
* @param insiders - Whether to use VS Code Insiders
*/ */
export function getVSCodeInstallUrl(type: string, filePath: string): string | null { export function getVSCodeInstallUrl(type: string, filePath: string, insiders = false): string | null {
const baseUrl = VSCODE_INSTALL_URLS[type]; const config = VSCODE_INSTALL_CONFIG[type];
if (!baseUrl) return null; if (!config) return null;
return `${baseUrl}?url=${encodeURIComponent(`${REPO_BASE_URL}/${filePath}`)}`;
const rawUrl = `${REPO_BASE_URL}/${filePath}`;
const vscodeScheme = insiders ? 'vscode-insiders' : 'vscode';
const innerUrl = `${vscodeScheme}:${config.scheme}/install?url=${encodeURIComponent(rawUrl)}`;
return `${config.baseUrl}?url=${encodeURIComponent(innerUrl)}`;
} }
/** /**