Skip to content

Add GitHub Copilot extension - #21225

Merged
raycastbot merged 3 commits into
raycast:mainfrom
timrogers:timrogers/github-copilot
Aug 28, 2025
Merged

raycastbot merged 3 commits into
raycast:mainfrom
timrogers:timrogers/github-copilot

Conversation

@timrogers

@timrogers timrogers commented Aug 28, 2025 •

Copy link
Copy Markdown
Contributor

Checklist

@raycastbot raycastbot added the new extension Label for PRs with new extensions label Aug 28, 2025
@raycastbot

ghost commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

Congratulations on your new Raycast extension! 🚀

Due to our current reduced availability during summer, the initial review may take up to 10-15 business days.

Once the PR is approved and merged, the extension will be available on our Store.

@pernielsentikaer pernielsentikaer self-assigned this Aug 28, 2025

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR introduces a new GitHub Copilot extension for Raycast that integrates with GitHub's Copilot coding agent feature. The extension provides two main commands: "Create Task" allows users to delegate coding tasks to GitHub Copilot by specifying a repository, branch, and task description, while "View Tasks" displays ongoing and completed Copilot agent sessions with their associated pull requests.

The extension follows standard Raycast patterns with OAuth authentication for GitHub API access, form-based task creation with repository and branch selection dropdowns, and a list-based interface for tracking task progress. The implementation includes comprehensive service layers for interacting with GitHub's REST and GraphQL APIs, as well as direct integration with GitHub's Copilot API at api.githubcopilot.com. The extension uses custom hooks for repository search, branch management, and session data fetching, with proper caching and loading state management throughout.

The architecture includes proper error handling via showFailureToast, OAuth integration using both OAuth.PKCEClient and OAuthService, and follows Raycast's established patterns for GitHub integrations. The extension targets users with GitHub Copilot Pro, Business, or Enterprise access who want to manage their AI coding tasks directly from Raycast's interface.

PR Description Notes:

  • Several checklist items remain unchecked, indicating the extension may not have completed all preparation steps
  • The PR description doesn't provide details about the extension's functionality or implementation approach

Important Files Changed

File Changes
Filename Score Overview
extensions/github-copilot/CHANGELOG.md 2/5 Uses hardcoded date instead of required {PR_MERGE_DATE} template string
extensions/github-copilot/src/components/PullRequestWithAgentSessionsItem.tsx 2/5 Unsafe array access to sessions[0] without bounds checking could cause runtime errors
extensions/github-copilot/src/utils.tsx 2/5 Direct array access without null checks and potentially confusing color choices
extensions/github-copilot/src/hooks/useRepositorySearch.ts 3/5 Complex search query construction logic that could generate malformed queries
extensions/github-copilot/src/services/copilot.ts 3/5 Uses potentially unsafe global ID generation and direct MessagePack encoding
extensions/github-copilot/src/view-tasks.tsx 3/5 Well-structured component following Raycast patterns with proper OAuth integration
extensions/github-copilot/src/create-task.tsx 4/5 Comprehensive form implementation with proper validation and error handling
extensions/github-copilot/src/hooks/useBranches.ts 4/5 Complex but well-implemented branch management with smart caching and ordering
extensions/github-copilot/src/components/RepositoryDropdown.tsx 4/5 Well-designed dropdown with UX enhancements like recently used repositories
extensions/github-copilot/src/services/branches.ts 4/5 Clean service implementation with proper error handling, though with unused pagination fields
extensions/github-copilot/src/services/repositories.ts 4/5 Well-structured repository service functions with proper error handling
extensions/github-copilot/src/lib/github-client.ts 4/5 Straightforward error handling utility with user-friendly messages
extensions/github-copilot/src/lib/oauth.ts 4/5 OAuth implementation using dual client pattern with proper Octokit integration
extensions/github-copilot/LICENSE.md 4/5 Standard MIT license with appropriate copyright holder
extensions/github-copilot/README.md 4/5 Clear documentation with minor typos, includes proper screenshots
extensions/github-copilot/src/hooks/usePullRequestsWithAgentSessions.ts 4/5 Well-implemented hook with mode switching for development and production
extensions/github-copilot/src/components/index.tsx 5/5 Simple barrel export file with no issues
extensions/github-copilot/tsconfig.json 5/5 Standard and appropriate TypeScript configuration
extensions/github-copilot/.prettierrc 5/5 Correctly configured Prettier settings following Raycast standards

Confidence score: 2/5

  • This PR has several critical issues that could cause runtime errors and doesn't follow required repository standards
  • Score lowered due to unsafe array access patterns, incorrect CHANGELOG format, and potential runtime crashes
  • Pay special attention to CHANGELOG.md, PullRequestWithAgentSessionsItem.tsx, and utils.tsx files which need fixes before merging

19 files reviewed, 13 comments

Edit Code Review Bot Settings | Greptile


### Requirements

- **Access to [GitHub Copilot coding agent](https://docs.github.com/en/enterprise-cloud@latest/copilot/concepts/coding-agent/coding-agent)**, available for Copilot Pro, Pro+, Business and Enterpise users. If you're a Business or Enterprise subscriber, an administrator will have to [enable](https://docs.github.com/en/enterprise-cloud@latest/copilot/concepts/coding-agent/enable-coding-agent) the feature.

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

syntax: 'Enterpise' is misspelled, should be 'Enterprise'

Suggested change
- **Access to [GitHub Copilot coding agent](https://docs.github.com/en/enterprise-cloud@latest/copilot/concepts/coding-agent/coding-agent)**, available for Copilot Pro, Pro+, Business and Enterpise users. If you're a Business or Enterprise subscriber, an administrator will have to [enable](https://docs.github.com/en/enterprise-cloud@latest/copilot/concepts/coding-agent/enable-coding-agent) the feature.
- **Access to [GitHub Copilot coding agent](https://docs.github.com/en/enterprise-cloud@latest/copilot/concepts/coding-agent/coding-agent)**, available for Copilot Pro, Pro+, Business and Enterprise users. If you're a Business or Enterprise subscriber, an administrator will have to [enable](https://docs.github.com/en/enterprise-cloud@latest/copilot/concepts/coding-agent/enable-coding-agent) the feature.

if (event.type === "PushEvent" && event.repo) {
const repoKey = event.repo.name;
if (!repositories.has(repoKey)) {
const [owner, name] = event.repo.name.split("/");

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Potential runtime error if event.repo.name doesn't contain a slash. Add validation: const parts = event.repo.name.split('/'); if (parts.length !== 2) continue;

const octokit = getOctokit();

try {
const [owner, repo] = nwo.split("/");

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Same issue - nwo.split('/') could fail if format is invalid. Add validation for proper owner/repo format.

Suggested change
const [owner, repo] = nwo.split("/");
const parts = nwo.split("/");
if (parts.length !== 2) {
throw new Error(`Invalid repository format: ${nwo}`);
}
const [owner, repo] = parts;

export const fetchRepositoryDefaultBranch = async (nwo: string): Promise<string | null> => {
if (!nwo) return null;

const [owner, repo] = nwo.split("/");

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Same validation needed here for nwo.split('/').

Suggested change
const [owner, repo] = nwo.split("/");
const parts = nwo.split("/");
if (parts.length !== 2) {
throw new Error(`Invalid repository format: ${nwo}`);
}
const [owner, repo] = parts;

Comment on lines +98 to +100
} catch (error) {
console.error(error);
}

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Error handling only logs to console. Consider using showFailureToast from @raycast/utils for better user feedback.

Comment on lines +15 to +22
refs(refPrefix: "refs/heads/", first: 100) {
nodes {
name
}
pageInfo {
hasNextPage
endCursor
}

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: GraphQL query fetches pagination info but doesn't use it, limiting results to 100 branches. Consider implementing pagination or removing unused fields

import { PullRequestWithAgentSessions, AgentSessionState } from "./services/copilot";

export function getIcon(pullRequestWithAgentSessions: PullRequestWithAgentSessions) {
if (pullRequestWithAgentSessions.sessions[0].state === AgentSessionState.QUEUED) {

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Accessing sessions[0] without checking if sessions array exists or has elements could cause runtime errors

Suggested change
if (pullRequestWithAgentSessions.sessions[0].state === AgentSessionState.QUEUED) {
if (pullRequestWithAgentSessions.sessions?.[0]?.state === AgentSessionState.QUEUED) {

export function useSearchRepositories(opts: { searchQuery?: string; organizations?: string[] }) {
return useCachedPromise(
async (searchQuery?: string, organizations?: string[]) => {
let searchText = `sort:pushed_at:desc sort:updated-desc`;

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Having two sort parameters (sort:pushed_at:desc sort:updated-desc) may cause issues. GitHub search typically expects a single sort parameter.

if (searchQuery) {
const [owner, repo] = searchQuery.includes("/") ? searchQuery.split("/") : [undefined, undefined];
if (owner) {
searchText += ` user:${owner} ${repo}`;

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: If repo is undefined when splitting owner/repo, this will add undefined to the search query, potentially causing malformed queries.

Suggested change
searchText += ` user:${owner} ${repo}`;
searchText += ` user:${owner}${repo ? ` ${repo}` : ''}`;

Comment on lines +65 to +69
showToast({
style: Toast.Style.Failure,
title: "Failed to load branches",
message: error.message,
});

ghost Aug 28, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Could be simplified with showFailureToast from @raycast/utils

Suggested change
showToast({
style: Toast.Style.Failure,
title: "Failed to load branches",
message: error.message,
});
showFailureToast(error, {
title: "Failed to load branches",
});

@raycastbot
raycastbot merged commit ec154b4 into raycast:main Aug 28, 2025
@github-actions

ghost commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

@raycastbot

ghost commented Aug 28, 2025

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new extension Label for PRs with new extensions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants