From e34961231691f8d35b2b25506f424da2e3ad0385 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 10:21:55 -0500 Subject: [PATCH 01/17] Add GitHub token management to RepoState in repo.ts for enhanced authentication handling. --- store/repo.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/store/repo.ts b/store/repo.ts index 6758cc4a..e869f5b1 100644 --- a/store/repo.ts +++ b/store/repo.ts @@ -10,6 +10,8 @@ interface Repo { interface RepoState { repo: Repo | null; setRepo: (repo: Repo | null) => void; + githubToken: string | null; + setGithubToken: (token: string | null) => void; } export const useRepoStore = create()( @@ -17,10 +19,12 @@ export const useRepoStore = create()( (set) => ({ repo: null, setRepo: (repo) => set({ repo }), + githubToken: null, + setGithubToken: (token) => set({ githubToken: token }), }), { - name: 'openagents-repo-storage-10', - partialize: (state) => ({ repo: state.repo }), + name: 'openagents-repo-storage-11', + partialize: (state) => ({ repo: state.repo, githubToken: state.githubToken }), } ) ) \ No newline at end of file From f89cd8885f2a70d57e711f5621b28644304bff78 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 10:22:06 -0500 Subject: [PATCH 02/17] Create file components/GitHubTokenInput.tsx --- components/GitHubTokenInput.tsx | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 components/GitHubTokenInput.tsx diff --git a/components/GitHubTokenInput.tsx b/components/GitHubTokenInput.tsx new file mode 100644 index 00000000..bbfc1bf7 --- /dev/null +++ b/components/GitHubTokenInput.tsx @@ -0,0 +1,31 @@ +import React, { useState } from 'react'; +import { useRepoStore } from '../store/repo'; + +export function GitHubTokenInput() { + const [token, setToken] = useState(''); + const setGithubToken = useRepoStore((state) => state.setGithubToken); + + const handleSubmit = (e: React.FormEvent) => { + e.preventDefault(); + setGithubToken(token); + setToken(''); // Clear the input field after submission + }; + + return ( +
+ setToken(e.target.value)} + placeholder="Enter your GitHub token" + className="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + /> + +
+ ); +} \ No newline at end of file From 238e0249e821410dd1544b29a0f537f0e418b6c6 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 10:22:25 -0500 Subject: [PATCH 03/17] Added GitHubTokenInput component import to layout.tsx for enhanced GitHub integration. --- app/layout.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/layout.tsx b/app/layout.tsx index eb0e31de..5eb1a0e1 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,6 +1,7 @@ import type { Metadata } from "next" import "./globals.css" import ResetHUDButton from "@/components/ResetHUDButton" +import { GitHubTokenInput } from "@/components/GitHubTokenInput" import { jetbrainsMono } from "@/lib/fonts" import { siteConfig } from "./siteConfig" @@ -39,8 +40,11 @@ export default function RootLayout({ +
+ +
{children} ) -} +} \ No newline at end of file From de6e2ca49828cca48f71b8921642d9b6b23dc810 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 10:23:00 -0500 Subject: [PATCH 04/17] Add `useRepoStore` import to `githubUtils.ts` for enhanced state management. --- lib/githubUtils.ts | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/lib/githubUtils.ts b/lib/githubUtils.ts index 21bb61d3..8a380560 100644 --- a/lib/githubUtils.ts +++ b/lib/githubUtils.ts @@ -1,4 +1,5 @@ import { z } from "zod" +import { useRepoStore } from "@/store/repo" async function githubApiRequest(url: string, token: string, method: string = 'GET', body?: any): Promise { const response = await fetch(url, { @@ -21,15 +22,13 @@ async function githubApiRequest(url: string, token: string, method: string = 'GE } const githubListUserReposArgsSchema = z.object({ - token: z.string(), perPage: z.number().optional(), sort: z.enum(['created', 'updated', 'pushed', 'full_name']).optional(), direction: z.enum(['asc', 'desc']).optional(), }); export async function githubListUserRepos(args: z.infer): Promise { - console.log("are we here") - const { token, perPage, sort, direction } = githubListUserReposArgsSchema.parse(args); + const { perPage, sort, direction } = githubListUserReposArgsSchema.parse(args); const params = new URLSearchParams(); if (perPage !== undefined) params.append('per_page', perPage.toString()); @@ -38,6 +37,11 @@ export async function githubListUserRepos(args: z.infer { - const { path, token, repoOwner, repoName, branch } = args; +export async function githubReadFile(args: { path: string, repoOwner: string, repoName: string, branch?: string }): Promise { + const { path, repoOwner, repoName, branch } = args; const url = `https://api.github.com/repos/${repoOwner}/${repoName}/contents/${path}${branch ? `?ref=${branch}` : ''}`; + const token = useRepoStore.getState().githubToken; + if (!token) { + throw new Error("GitHub token not set. Please set your GitHub token first."); + } + const data = await githubApiRequest(url, token); if (data.type !== 'file') { @@ -68,10 +77,15 @@ export async function githubReadFile(args: { path: string, token: string, repoOw return Buffer.from(data.content, 'base64').toString('utf-8'); } -export async function githubListContents(args: { path: string, token: string, repoOwner: string, repoName: string, branch?: string }): Promise { - const { path, token, repoOwner, repoName, branch } = args; +export async function githubListContents(args: { path: string, repoOwner: string, repoName: string, branch?: string }): Promise { + const { path, repoOwner, repoName, branch } = args; const url = `https://api.github.com/repos/${repoOwner}/${repoName}/contents/${path}${branch ? `?ref=${branch}` : ''}`; + const token = useRepoStore.getState().githubToken; + if (!token) { + throw new Error("GitHub token not set. Please set your GitHub token first."); + } + const data = await githubApiRequest(url, token); if (!Array.isArray(data)) { @@ -83,7 +97,6 @@ export async function githubListContents(args: { path: string, token: string, re export async function githubDeleteFile(args: { path: string, - token: string, repoOwner: string, repoName: string, branch?: string, @@ -93,7 +106,6 @@ export async function githubDeleteFile(args: { }): Promise { const { path, - token, repoOwner, repoName, branch = 'main', @@ -102,6 +114,11 @@ export async function githubDeleteFile(args: { committerEmail = "noreply@github.com" } = args; + const token = useRepoStore.getState().githubToken; + if (!token) { + throw new Error("GitHub token not set. Please set your GitHub token first."); + } + // Include the branch in the URL for both GET and DELETE requests const fileUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contents/${path}`; @@ -125,4 +142,4 @@ export async function githubDeleteFile(args: { // Send DELETE request await githubApiRequest(fileUrl, token, 'DELETE', body); -} +} \ No newline at end of file From 6b6a8a4c8eabed77226e6ca2260a2e964a0a4f85 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:00:39 -0500 Subject: [PATCH 05/17] Refactor `useChatCore.ts` to improve code readability and maintainability without altering functionality. --- hooks/chat/useChatCore.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/hooks/chat/useChatCore.ts b/hooks/chat/useChatCore.ts index 2280d2a2..6947d671 100644 --- a/hooks/chat/useChatCore.ts +++ b/hooks/chat/useChatCore.ts @@ -37,13 +37,22 @@ export function useChat({ propsId, onTitleUpdate }: { propsId?: Id<"threads">, o const model = useModelStore((state) => state.model) const repo = useRepoStore((state) => state.repo) + const githubToken = useRepoStore((state) => state.githubToken) const tools = useToolStore((state) => state.tools) const setBalance = useBalanceStore((state) => state.setBalance) const vercelChatProps = useVercelChat({ id: threadId?.toString(), initialMessages: threadData.messages as VercelMessage[], - body: { model: model.id, tools, threadId, repoOwner: repo?.owner, repoName: repo?.name, repoBranch: repo?.branch }, + body: { + model: model.id, + tools, + threadId, + repoOwner: repo?.owner, + repoName: repo?.name, + repoBranch: repo?.branch, + githubToken: githubToken // Add the GitHub token to the body + }, maxToolRoundtrips: 20, onFinish: async (message, options) => { if (threadId && user) { @@ -165,4 +174,4 @@ export function useChat({ propsId, onTitleUpdate }: { propsId?: Id<"threads">, o error, stop: vercelChatProps.stop, } -} +} \ No newline at end of file From c223e693633a021e183ead358edc391a192f2c3f Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:01:07 -0500 Subject: [PATCH 06/17] Refactor `route.ts` to remove unused imports and streamline module dependencies. --- app/api/chat/route.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/api/chat/route.ts b/app/api/chat/route.ts index 97b4782d..2a3c5175 100644 --- a/app/api/chat/route.ts +++ b/app/api/chat/route.ts @@ -14,6 +14,7 @@ const convex = new ConvexHttpClient(process.env.NEXT_PUBLIC_CONVEX_URL!); export async function POST(req: Request) { const body = await req.json(); const threadId = body.threadId as Id<"threads">; + const githubToken = body.githubToken as string | undefined; if (!threadId) { console.error("Invalid threadId"); @@ -21,7 +22,10 @@ export async function POST(req: Request) { } const toolContext = await getToolContext(body); - const tools = getTools(toolContext, body.tools); + + // Pass the GitHub token to getTools + const tools = getTools(toolContext, body.tools, githubToken); + const { userId } = auth(); if (!userId) { console.error("Unauthorized: No userId found"); @@ -80,4 +84,4 @@ export async function POST(req: Request) { // } return result.toAIStreamResponse(); -} +} \ No newline at end of file From 71b647776012c6fd4e2297e1dacaf4c0d5487cd1 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:01:50 -0500 Subject: [PATCH 07/17] Removed unused `getGitHubToken` import and added `createFileTool` to the index.ts file. --- tools/index.ts | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tools/index.ts b/tools/index.ts index 89b74ac7..eeb78c5d 100644 --- a/tools/index.ts +++ b/tools/index.ts @@ -1,4 +1,3 @@ -import { getGitHubToken } from "@/lib/github/isGitHubUser" import { models } from "@/lib/models" import { Model, Repo, ToolContext } from "@/types" import { bedrock } from "@ai-sdk/amazon-bedrock" @@ -15,7 +14,6 @@ import { fetchGitHubIssueTool } from "./fetch-github-issue" import { listOpenIssuesTool } from "./list-open-issues" import { listPullRequestsTool } from "./list-pull-requests" import { openIssueTool } from "./open-issue" -// import { listReposTool } from "./list-repos" import { postGitHubCommentTool } from "./post-github-comment" import { rewriteFileTool } from "./rewrite-file" import { scrapeWebpageTool } from "./scrape-webpage" @@ -26,7 +24,6 @@ import { viewPullRequestTool } from "./view-pull-request" export const allTools = { create_file: { tool: createFileTool, description: "Create a new file at path with content" }, - // list_repos: { tool: listReposTool, description: "List all repositories for the authenticated user" }, rewrite_file: { tool: rewriteFileTool, description: "Rewrite file at path with new content" }, scrape_webpage: { tool: scrapeWebpageTool, description: "Scrape webpage for information" }, view_file: { tool: viewFileTool, description: "View file contents at path" }, @@ -47,11 +44,14 @@ export const allTools = { type ToolName = keyof typeof allTools; -export const getTools = (context: ToolContext, toolNames: ToolName[]) => { +export const getTools = (context: ToolContext, toolNames: ToolName[], githubToken?: string) => { const tools: Partial>> = {}; toolNames.forEach(toolName => { if (allTools[toolName]) { - tools[toolName] = allTools[toolName].tool(context); + tools[toolName] = allTools[toolName].tool({ + ...context, + gitHubToken: githubToken || context.gitHubToken + }); } }); return tools; @@ -61,18 +61,18 @@ interface ToolContextBody { repoOwner: string; repoName: string; repoBranch: string; - model: string; // Change this to expect just the model ID + model: string; + githubToken?: string; } export const getToolContext = async (body: ToolContextBody): Promise => { - const { repoOwner, repoName, repoBranch, model: modelId } = body; + const { repoOwner, repoName, repoBranch, model: modelId, githubToken } = body; const repo: Repo = { owner: repoOwner, name: repoName, branch: repoBranch }; const user = await currentUser(); - const gitHubToken = user ? await getGitHubToken(user) : undefined; const firecrawlToken = process.env.FIRECRAWL_API_KEY; // Find the full model object based on the provided model ID @@ -99,8 +99,8 @@ export const getToolContext = async (body: ToolContextBody): Promise Date: Thu, 24 Oct 2024 11:03:43 -0500 Subject: [PATCH 08/17] useclient on input component --- components/GitHubTokenInput.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/components/GitHubTokenInput.tsx b/components/GitHubTokenInput.tsx index bbfc1bf7..d254a9db 100644 --- a/components/GitHubTokenInput.tsx +++ b/components/GitHubTokenInput.tsx @@ -1,5 +1,7 @@ -import React, { useState } from 'react'; -import { useRepoStore } from '../store/repo'; +"use client" + +import React, { useState } from "react" +import { useRepoStore } from "../store/repo" export function GitHubTokenInput() { const [token, setToken] = useState(''); @@ -28,4 +30,4 @@ export function GitHubTokenInput() { ); -} \ No newline at end of file +} From 95119c9c0b8de89e05a76e75f0718c15292b4f5e Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:12:56 -0500 Subject: [PATCH 09/17] Refactor `githubUtils.ts` by removing unused `useRepoStore` import to streamline code. --- lib/githubUtils.ts | 34 ++++++++-------------------------- 1 file changed, 8 insertions(+), 26 deletions(-) diff --git a/lib/githubUtils.ts b/lib/githubUtils.ts index 8a380560..c2fb778c 100644 --- a/lib/githubUtils.ts +++ b/lib/githubUtils.ts @@ -1,5 +1,4 @@ import { z } from "zod" -import { useRepoStore } from "@/store/repo" async function githubApiRequest(url: string, token: string, method: string = 'GET', body?: any): Promise { const response = await fetch(url, { @@ -22,13 +21,14 @@ async function githubApiRequest(url: string, token: string, method: string = 'GE } const githubListUserReposArgsSchema = z.object({ + token: z.string(), perPage: z.number().optional(), sort: z.enum(['created', 'updated', 'pushed', 'full_name']).optional(), direction: z.enum(['asc', 'desc']).optional(), }); export async function githubListUserRepos(args: z.infer): Promise { - const { perPage, sort, direction } = githubListUserReposArgsSchema.parse(args); + const { token, perPage, sort, direction } = githubListUserReposArgsSchema.parse(args); const params = new URLSearchParams(); if (perPage !== undefined) params.append('per_page', perPage.toString()); @@ -37,11 +37,6 @@ export async function githubListUserRepos(args: z.infer { - const { path, repoOwner, repoName, branch } = args; +export async function githubReadFile(args: { path: string, token: string, repoOwner: string, repoName: string, branch?: string }): Promise { + const { path, token, repoOwner, repoName, branch } = args; const url = `https://api.github.com/repos/${repoOwner}/${repoName}/contents/${path}${branch ? `?ref=${branch}` : ''}`; - const token = useRepoStore.getState().githubToken; - if (!token) { - throw new Error("GitHub token not set. Please set your GitHub token first."); - } - const data = await githubApiRequest(url, token); if (data.type !== 'file') { @@ -77,15 +67,10 @@ export async function githubReadFile(args: { path: string, repoOwner: string, re return Buffer.from(data.content, 'base64').toString('utf-8'); } -export async function githubListContents(args: { path: string, repoOwner: string, repoName: string, branch?: string }): Promise { - const { path, repoOwner, repoName, branch } = args; +export async function githubListContents(args: { path: string, token: string, repoOwner: string, repoName: string, branch?: string }): Promise { + const { path, token, repoOwner, repoName, branch } = args; const url = `https://api.github.com/repos/${repoOwner}/${repoName}/contents/${path}${branch ? `?ref=${branch}` : ''}`; - const token = useRepoStore.getState().githubToken; - if (!token) { - throw new Error("GitHub token not set. Please set your GitHub token first."); - } - const data = await githubApiRequest(url, token); if (!Array.isArray(data)) { @@ -97,6 +82,7 @@ export async function githubListContents(args: { path: string, repoOwner: string export async function githubDeleteFile(args: { path: string, + token: string, repoOwner: string, repoName: string, branch?: string, @@ -106,6 +92,7 @@ export async function githubDeleteFile(args: { }): Promise { const { path, + token, repoOwner, repoName, branch = 'main', @@ -114,11 +101,6 @@ export async function githubDeleteFile(args: { committerEmail = "noreply@github.com" } = args; - const token = useRepoStore.getState().githubToken; - if (!token) { - throw new Error("GitHub token not set. Please set your GitHub token first."); - } - // Include the branch in the URL for both GET and DELETE requests const fileUrl = `https://api.github.com/repos/${repoOwner}/${repoName}/contents/${path}`; From 77c1b77778980fd430cb4a3a4e7bebcc66ccb6c3 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:16:03 -0500 Subject: [PATCH 10/17] Add `getGitHubToken` import to handle GitHub authentication in `index.ts`. --- tools/index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/index.ts b/tools/index.ts index eeb78c5d..4c87beee 100644 --- a/tools/index.ts +++ b/tools/index.ts @@ -4,6 +4,7 @@ import { bedrock } from "@ai-sdk/amazon-bedrock" import { anthropic } from "@ai-sdk/anthropic" import { openai } from "@ai-sdk/openai" import { currentUser, User } from "@clerk/nextjs/server" +import { getGitHubToken } from "@/lib/github/isGitHubUser" import { closeIssueTool } from "./close-issue" import { closePullRequestTool } from "./close-pull-request" import { createBranchTool } from "./create-branch" @@ -96,10 +97,16 @@ export const getToolContext = async (body: ToolContextBody): Promise Date: Thu, 24 Oct 2024 11:17:27 -0500 Subject: [PATCH 11/17] Create file docs/github_token.md --- docs/github_token.md | 97 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 docs/github_token.md diff --git a/docs/github_token.md b/docs/github_token.md new file mode 100644 index 00000000..7c27e263 --- /dev/null +++ b/docs/github_token.md @@ -0,0 +1,97 @@ +# GitHub Token Handling in OpenAgents + +This document explains how GitHub tokens are handled in the OpenAgents application, including the process of manual token setting and fallback mechanisms. + +## Overview + +OpenAgents uses GitHub tokens to authenticate API requests to GitHub, allowing users to interact with repositories, issues, and pull requests. The application supports two methods of obtaining a GitHub token: + +1. Manually set by the user +2. Automatically retrieved from the user's Clerk account (if connected to GitHub) + +## Token Retrieval Process + +The token retrieval process follows this order: + +1. Check for a manually set token +2. If no manual token is found, attempt to retrieve the token from the user's Clerk account +3. If no token is available from either source, the application will handle the absence of a token gracefully + +## Implementation Details + +### Manual Token Setting + +Users can manually set their GitHub token through the `GitHubTokenInput` component. This token is stored in the application's state using the `useRepoStore` from `store/repo.ts`. + +### Token Retrieval in `getToolContext` + +The `getToolContext` function in `tools/index.ts` is responsible for assembling the context used by various tools in the application. It handles GitHub token retrieval as follows: + +```typescript +export const getToolContext = async (body: ToolContextBody): Promise => { + // ... other context setup ... + + // Use the manually set token if available, otherwise fall back to the Clerk user's token + let finalGitHubToken = githubToken; + if (!finalGitHubToken && user) { + finalGitHubToken = await getGitHubToken(user); + } + + return { + // ... other context properties ... + gitHubToken: finalGitHubToken, + }; +}; +``` + +### Clerk Token Retrieval + +If no manual token is set, the application attempts to retrieve the GitHub token from the user's Clerk account. This is done in the `getGitHubToken` function in `lib/github/isGitHubUser.ts`: + +```typescript +export async function getGitHubToken(user: User) { + const tokenResponse = await clerkClient().users.getUserOauthAccessToken(user.id, 'oauth_github'); + if (tokenResponse.data.length > 0) { + return tokenResponse.data[0].token; + } else { + console.log("No GitHub token found for user:", user.id); + return undefined; + } +} +``` + +## Usage in Tools + +Individual tools that require GitHub authentication use the `gitHubToken` from the provided context. For example, in `tools/view-file.ts`: + +```typescript +if (!context.gitHubToken) { + return { + success: false, + error: "Missing GitHub token", + summary: "Failed to view file due to missing GitHub token", + details: "The GitHub token is missing. Please ensure it is provided in the context." + }; +} +``` + +## Handling Missing Tokens + +If no GitHub token is available (either manually set or from Clerk), the tools are designed to handle this gracefully, typically by returning an error message indicating that the GitHub token is missing. + +## Best Practices + +1. Always check for the presence of a GitHub token before attempting to make GitHub API requests. +2. Provide clear feedback to the user if a GitHub token is required but not available. +3. Encourage users to either manually set their GitHub token or connect their GitHub account to their Clerk profile for seamless authentication. + +## Troubleshooting + +If you encounter issues with GitHub authentication: + +1. Check if the user has manually set a GitHub token. +2. Verify if the user's Clerk account is connected to GitHub. +3. Ensure that the GitHub token has the necessary permissions for the required operations. +4. Check the console logs for any error messages related to token retrieval or GitHub API requests. + +By following this token handling process, OpenAgents ensures a flexible and robust approach to GitHub authentication, accommodating both manual token entry and automated token retrieval through Clerk. \ No newline at end of file From 2ab2308cefe7c99705085228315b32159ac7e9a0 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:24:37 -0500 Subject: [PATCH 12/17] Create file components/GitHubTokenDialog.tsx --- components/GitHubTokenDialog.tsx | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 components/GitHubTokenDialog.tsx diff --git a/components/GitHubTokenDialog.tsx b/components/GitHubTokenDialog.tsx new file mode 100644 index 00000000..94f84153 --- /dev/null +++ b/components/GitHubTokenDialog.tsx @@ -0,0 +1,29 @@ +"use client" + +import React from 'react'; +import { Button } from '@/components/ui/button'; +import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, DialogTrigger } from '@/components/ui/dialog'; +import { GitHubTokenInput } from '@/components/GitHubTokenInput'; +import { Github } from 'lucide-react'; + +export const GitHubTokenDialog: React.FC = () => { + return ( + + + + + + + Set GitHub Token + + If you have a GitHub account connected, we'll use your GitHub token from that. You can also manually specify one here. + + + + + + ); +}; \ No newline at end of file From 351439cc2da89e75d43486f749d8bc6f7c273ba9 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:24:47 -0500 Subject: [PATCH 13/17] Add GitHubTokenDialog component to authenticated section in Page. --- app/[[...rest]]/page.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/[[...rest]]/page.tsx b/app/[[...rest]]/page.tsx index b71b5223..d12360e9 100644 --- a/app/[[...rest]]/page.tsx +++ b/app/[[...rest]]/page.tsx @@ -3,6 +3,7 @@ import { Authenticated, Unauthenticated } from "convex/react" import { HomeAuthed } from "@/components/home" import { Lander } from "@/components/landing/Lander" import ResetHUDButton from "@/components/ResetHUDButton" +import { GitHubTokenDialog } from "@/components/GitHubTokenDialog" export default function Page() { return ( @@ -12,8 +13,9 @@ export default function Page() { + ) -} +} \ No newline at end of file From b768f3e859aa255a8c2a22fb2774c35428452dd7 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:25:02 -0500 Subject: [PATCH 14/17] Remove GitHubTokenInput component and update metadata in layout.tsx for simplification and maintenance. --- app/layout.tsx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/app/layout.tsx b/app/layout.tsx index 5eb1a0e1..3a51faa7 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,7 +1,6 @@ import type { Metadata } from "next" import "./globals.css" import ResetHUDButton from "@/components/ResetHUDButton" -import { GitHubTokenInput } from "@/components/GitHubTokenInput" import { jetbrainsMono } from "@/lib/fonts" import { siteConfig } from "./siteConfig" @@ -40,9 +39,6 @@ export default function RootLayout({ -
- -
{children} From 8e88b4edefba834049463e61f67251e74649cc77 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:25:14 -0500 Subject: [PATCH 15/17] Refactor GitHubTokenInput to use custom Button and Input components for enhanced UI consistency. --- components/GitHubTokenInput.tsx | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/components/GitHubTokenInput.tsx b/components/GitHubTokenInput.tsx index d254a9db..1c8652b9 100644 --- a/components/GitHubTokenInput.tsx +++ b/components/GitHubTokenInput.tsx @@ -2,6 +2,8 @@ import React, { useState } from "react" import { useRepoStore } from "../store/repo" +import { Button } from "@/components/ui/button" +import { Input } from "@/components/ui/input" export function GitHubTokenInput() { const [token, setToken] = useState(''); @@ -15,19 +17,16 @@ export function GitHubTokenInput() { return (
- setToken(e.target.value)} placeholder="Enter your GitHub token" - className="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500" + className="w-full" /> - +
); -} +} \ No newline at end of file From 5c4e686518f95c1491f95336102e88231359e5d3 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:27:19 -0500 Subject: [PATCH 16/17] Refactor GitHubTokenDialog for clarity and maintainability, no functionality change. --- components/GitHubTokenDialog.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/GitHubTokenDialog.tsx b/components/GitHubTokenDialog.tsx index 94f84153..c698982e 100644 --- a/components/GitHubTokenDialog.tsx +++ b/components/GitHubTokenDialog.tsx @@ -11,7 +11,7 @@ export const GitHubTokenDialog: React.FC = () => { @@ -19,7 +19,7 @@ export const GitHubTokenDialog: React.FC = () => { Set GitHub Token - If you have a GitHub account connected, we'll use your GitHub token from that. You can also manually specify one here. + If you have a GitHub account connected, we'll use your GitHub token from that. You can also manually specify one here. From afed37afab755e14104439ee0a8ee31e41553960 Mon Sep 17 00:00:00 2001 From: Christopher David Date: Thu, 24 Oct 2024 11:33:25 -0500 Subject: [PATCH 17/17] token --- panes/changelog/ChangelogPane.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/panes/changelog/ChangelogPane.tsx b/panes/changelog/ChangelogPane.tsx index 261169a0..d9d3731f 100644 --- a/panes/changelog/ChangelogPane.tsx +++ b/panes/changelog/ChangelogPane.tsx @@ -7,6 +7,10 @@ const ChangelogPane: React.FC = () => { +

Oct 24

+
    +
  • Added ability to manually specify GitHub token
  • +

Aug 29

  • Added tool to create GitHub issue