fix: add VS Code Copilot Chat deep links (#1198)
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, it } from 'vitest';
|
||||
import { buildUrl, codePlatforms } from '../cli/platforms';
|
||||
|
||||
describe('platform URL builder', () => {
|
||||
it('builds VS Code Copilot Chat deep links with encoded prompts', () => {
|
||||
const vscode = codePlatforms.find((platform) => platform.id === 'vscode');
|
||||
const insiders = codePlatforms.find((platform) => platform.id === 'vscode-insiders');
|
||||
|
||||
expect(vscode).toBeDefined();
|
||||
expect(insiders).toBeDefined();
|
||||
expect(vscode?.baseUrl).toBe('vscode://GitHub.Copilot-Chat/chat');
|
||||
expect(insiders?.baseUrl).toBe('vscode-insiders://GitHub.Copilot-Chat/chat');
|
||||
|
||||
expect(buildUrl('vscode', vscode!.baseUrl, 'Review this code & explain it')).toBe(
|
||||
'vscode://GitHub.Copilot-Chat/chat?prompt=Review%20this%20code%20%26%20explain%20it',
|
||||
);
|
||||
expect(buildUrl('vscode-insiders', insiders!.baseUrl, '/fix failing tests')).toBe(
|
||||
'vscode-insiders://GitHub.Copilot-Chat/chat?prompt=%2Ffix%20failing%20tests',
|
||||
);
|
||||
});
|
||||
});
|
||||
@@ -25,8 +25,8 @@ export const videoPlatforms: Platform[] = [
|
||||
|
||||
export const codePlatforms: Platform[] = [
|
||||
{ id: "windsurf", name: "Windsurf", baseUrl: "windsurf://", isDeeplink: true, supportsQuerystring: false, sponsor: true },
|
||||
{ id: "vscode", name: "VS Code", baseUrl: "vscode://", isDeeplink: true, supportsQuerystring: false },
|
||||
{ id: "vscode-insiders", name: "VS Code Insiders", baseUrl: "vscode-insiders://", isDeeplink: true, supportsQuerystring: false },
|
||||
{ id: "vscode", name: "VS Code", baseUrl: "vscode://GitHub.Copilot-Chat/chat", isDeeplink: true },
|
||||
{ id: "vscode-insiders", name: "VS Code Insiders", baseUrl: "vscode-insiders://GitHub.Copilot-Chat/chat", isDeeplink: true },
|
||||
{ id: "cursor", name: "Cursor", baseUrl: "cursor://anysphere.cursor-deeplink/prompt", isDeeplink: true },
|
||||
{ id: "goose", name: "Goose", baseUrl: "goose://recipe", isDeeplink: true },
|
||||
{ id: "github-copilot", name: "GitHub Copilot Chat", baseUrl: "https://github.com/copilot" },
|
||||
@@ -71,6 +71,9 @@ export function buildUrl(
|
||||
switch (platformId) {
|
||||
case "cursor":
|
||||
return `${baseUrl}?text=${encoded}`;
|
||||
case "vscode":
|
||||
case "vscode-insiders":
|
||||
return `${baseUrl}?prompt=${encoded}`;
|
||||
case "goose": {
|
||||
const config = JSON.stringify({
|
||||
version: "1.0.0",
|
||||
|
||||
@@ -175,15 +175,15 @@ export const codePlatforms: Platform[] = [
|
||||
{
|
||||
id: "vscode",
|
||||
name: "VS Code",
|
||||
baseUrl: "vscode://",
|
||||
supportsQuerystring: false,
|
||||
baseUrl: "vscode://GitHub.Copilot-Chat/chat",
|
||||
supportsQuerystring: true,
|
||||
isDeeplink: true,
|
||||
},
|
||||
{
|
||||
id: "vscode-insiders",
|
||||
name: "VS Code Insiders",
|
||||
baseUrl: "vscode-insiders://",
|
||||
supportsQuerystring: false,
|
||||
baseUrl: "vscode-insiders://GitHub.Copilot-Chat/chat",
|
||||
supportsQuerystring: true,
|
||||
isDeeplink: true,
|
||||
},
|
||||
{
|
||||
@@ -243,6 +243,9 @@ export function buildUrl(
|
||||
// IDE deeplinks
|
||||
case "cursor":
|
||||
return `${baseUrl}?text=${encoded}`;
|
||||
case "vscode":
|
||||
case "vscode-insiders":
|
||||
return `${baseUrl}?prompt=${encoded}`;
|
||||
case "goose":
|
||||
case "goose-chat": {
|
||||
const config = JSON.stringify({
|
||||
|
||||
@@ -79,8 +79,8 @@ const videoPlatforms: Platform[] = [
|
||||
const codePlatforms: Platform[] = [
|
||||
{ id: "commandcode", name: "Command Code", baseUrl: "https://commandcode.ai/?utm_source=prompts.chat", supportsQuerystring: false, sponsor: true },
|
||||
{ id: "windsurf", name: "Windsurf", baseUrl: "windsurf://", isDeeplink: true, supportsQuerystring: false, sponsor: true },
|
||||
{ id: "vscode", name: "VS Code", baseUrl: "vscode://", isDeeplink: true, supportsQuerystring: false },
|
||||
{ id: "vscode-insiders", name: "VS Code Insiders", baseUrl: "vscode-insiders://", isDeeplink: true, supportsQuerystring: false },
|
||||
{ id: "vscode", name: "VS Code", baseUrl: "vscode://GitHub.Copilot-Chat/chat", isDeeplink: true },
|
||||
{ id: "vscode-insiders", name: "VS Code Insiders", baseUrl: "vscode-insiders://GitHub.Copilot-Chat/chat", isDeeplink: true },
|
||||
{ id: "cursor", name: "Cursor", baseUrl: "cursor://anysphere.cursor-deeplink/prompt", isDeeplink: true },
|
||||
{ id: "goose", name: "Goose", baseUrl: "goose://recipe", isDeeplink: true },
|
||||
{
|
||||
@@ -136,6 +136,9 @@ function buildUrl(platformId: string, baseUrl: string, promptText: string, promp
|
||||
// IDE deeplinks
|
||||
case "cursor":
|
||||
return `${baseUrl}?text=${encoded}`;
|
||||
case "vscode":
|
||||
case "vscode-insiders":
|
||||
return `${baseUrl}?prompt=${encoded}`;
|
||||
case "goose": {
|
||||
const config = JSON.stringify({
|
||||
version: "1.0.0",
|
||||
|
||||
Reference in New Issue
Block a user