-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
803 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. | ||
|
||
# dependencies | ||
/node_modules | ||
/.pnp | ||
.pnp.js | ||
.yarn/install-state.gz | ||
|
||
# testing | ||
/coverage | ||
|
||
# next.js | ||
/.next/ | ||
/out/ | ||
|
||
# production | ||
/build | ||
|
||
# misc | ||
.DS_Store | ||
*.pem | ||
|
||
# debug | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# local env files | ||
.env*.local | ||
|
||
# vercel | ||
.vercel | ||
|
||
# typescript | ||
*.tsbuildinfo | ||
next-env.d.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app). | ||
|
||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
# or | ||
pnpm dev | ||
# or | ||
bun dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. | ||
|
||
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file. | ||
|
||
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font. | ||
|
||
## Learn More | ||
|
||
To learn more about Next.js, take a look at the following resources: | ||
|
||
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API. | ||
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial. | ||
|
||
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome! | ||
|
||
## Deploy on Vercel | ||
|
||
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js. | ||
|
||
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"$schema": "https://ui.shadcn.com/schema.json", | ||
"style": "default", | ||
"rsc": true, | ||
"tsx": true, | ||
"tailwind": { | ||
"config": "tailwind.config.ts", | ||
"css": "app/globals.css", | ||
"baseColor": "slate", | ||
"cssVariables": true | ||
}, | ||
"aliases": { | ||
"components": "@/components", | ||
"utils": "@/lib/utils" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = {} | ||
|
||
module.exports = nextConfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
{ | ||
"name": "sum-pr", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "next dev", | ||
"build": "next build", | ||
"start": "next start", | ||
"lint": "next lint" | ||
}, | ||
"dependencies": { | ||
"@radix-ui/react-avatar": "^1.0.4", | ||
"@radix-ui/react-label": "^2.0.2", | ||
"@radix-ui/react-slot": "^1.0.2", | ||
"class-variance-authority": "^0.7.0", | ||
"clsx": "^2.0.0", | ||
"lucide-react": "^0.294.0", | ||
"next": "14.0.3", | ||
"react": "^18", | ||
"react-dom": "^18", | ||
"tailwind-merge": "^2.1.0", | ||
"tailwindcss-animate": "^1.0.7", | ||
"@opensdks/core": "workspace:*", | ||
"@opensdks/sdk-github": "workspace:*", | ||
"@opensdks/sdk-openai": "workspace:*" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^20", | ||
"@types/react": "^18", | ||
"@types/react-dom": "^18", | ||
"autoprefixer": "^10.0.1", | ||
"eslint": "^8", | ||
"eslint-config-next": "14.0.3", | ||
"postcss": "^8", | ||
"tailwindcss": "^3.3.0", | ||
"typescript": "^5" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
plugins: { | ||
tailwindcss: {}, | ||
autoprefixer: {}, | ||
}, | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
@layer base { | ||
:root { | ||
--background: 0 0% 100%; | ||
--foreground: 222.2 84% 4.9%; | ||
|
||
--card: 0 0% 100%; | ||
--card-foreground: 222.2 84% 4.9%; | ||
|
||
--popover: 0 0% 100%; | ||
--popover-foreground: 222.2 84% 4.9%; | ||
|
||
--primary: 222.2 47.4% 11.2%; | ||
--primary-foreground: 210 40% 98%; | ||
|
||
--secondary: 210 40% 96.1%; | ||
--secondary-foreground: 222.2 47.4% 11.2%; | ||
|
||
--muted: 210 40% 96.1%; | ||
--muted-foreground: 215.4 16.3% 46.9%; | ||
|
||
--accent: 210 40% 96.1%; | ||
--accent-foreground: 222.2 47.4% 11.2%; | ||
|
||
--destructive: 0 84.2% 60.2%; | ||
--destructive-foreground: 210 40% 98%; | ||
|
||
--border: 214.3 31.8% 91.4%; | ||
--input: 214.3 31.8% 91.4%; | ||
--ring: 222.2 84% 4.9%; | ||
|
||
--radius: 0.5rem; | ||
} | ||
|
||
.dark { | ||
--background: 222.2 84% 4.9%; | ||
--foreground: 210 40% 98%; | ||
|
||
--card: 222.2 84% 4.9%; | ||
--card-foreground: 210 40% 98%; | ||
|
||
--popover: 222.2 84% 4.9%; | ||
--popover-foreground: 210 40% 98%; | ||
|
||
--primary: 210 40% 98%; | ||
--primary-foreground: 222.2 47.4% 11.2%; | ||
|
||
--secondary: 217.2 32.6% 17.5%; | ||
--secondary-foreground: 210 40% 98%; | ||
|
||
--muted: 217.2 32.6% 17.5%; | ||
--muted-foreground: 215 20.2% 65.1%; | ||
|
||
--accent: 217.2 32.6% 17.5%; | ||
--accent-foreground: 210 40% 98%; | ||
|
||
--destructive: 0 62.8% 30.6%; | ||
--destructive-foreground: 210 40% 98%; | ||
|
||
--border: 217.2 32.6% 17.5%; | ||
--input: 217.2 32.6% 17.5%; | ||
--ring: 212.7 26.8% 83.9%; | ||
} | ||
} | ||
|
||
.border-border { | ||
border-color: hsl(var(--border)); | ||
} | ||
|
||
@layer base { | ||
* { | ||
@apply border-border; | ||
} | ||
body { | ||
@apply bg-background text-foreground; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Metadata } from 'next' | ||
import { Inter } from 'next/font/google' | ||
import './globals.css' | ||
|
||
const inter = Inter({ subsets: ['latin'] }) | ||
|
||
export const metadata: Metadata = { | ||
title: 'Create Next App', | ||
description: 'Generated by create next app', | ||
} | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode | ||
}) { | ||
return ( | ||
<html lang="en"> | ||
<body className={inter.className}>{children}</body> | ||
</html> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
'use client' | ||
|
||
/** | ||
* v0 by Vercel. | ||
* @see https://v0.dev/t/yL79BMw9qDt | ||
*/ | ||
import Link from 'next/link' | ||
Check failure on line 7 in examples/sum-pr/src/app/page.tsx GitHub Actions / Run type checks, lint, and tests
|
||
import {ChangeEvent, useState} from 'react' | ||
import {initSDK} from '@opensdks/core' | ||
import {githubSdkDef} from '@opensdks/sdk-github' | ||
import {openaiSdkDef} from '@opensdks/sdk-openai' | ||
import CommitsList from '@/components/CommitsList' | ||
// shadcn imports | ||
import {Button} from '@/components/ui/button' | ||
import { | ||
Card, | ||
CardContent, | ||
CardDescription, | ||
CardHeader, | ||
CardTitle, | ||
} from '@/components/ui/card' | ||
import {Input} from '@/components/ui/input' | ||
import {Label} from '@/components/ui/label' | ||
|
||
const apiKey = process.env['OPENAI_API_KEY'] | ||
|
||
export const github = initSDK(githubSdkDef, { | ||
headers: { | ||
Authorization: `Bearer ${process.env['GITHUB_TOKEN']}`, | ||
'X-GitHub-Api-Version': '2022-11-28', | ||
}, | ||
}) | ||
|
||
export const openai = initSDK(openaiSdkDef, { | ||
// headers: { | ||
// 'Content-Type': 'application/json', | ||
// Authorization: `Bearer ${apiKey}`, | ||
// }, | ||
}) | ||
|
||
export default function Component() { | ||
const [prLink, setPrLink] = useState('') | ||
const [commits, setCommits] = useState([]) | ||
const [summary, setSummary] = useState('') | ||
|
||
const handlePRLinkChange = (event: ChangeEvent<HTMLInputElement>) => { | ||
setPrLink(event.target.value) | ||
} | ||
|
||
const fetchCommits = async () => { | ||
const prUrl = new URL(prLink) | ||
const pathParts = prUrl.pathname.split('/') // Splitting the pathname to extract owner, repo, and PR number | ||
const owner = pathParts[1] | ||
const repo = pathParts[2] | ||
const prNumber = pathParts[4] | ||
// "/repos/{owner}/{repo}/pulls/{pull_number}/comments" | ||
try { | ||
const response = await github.GET( | ||
'/repos/{owner}/{repo}/pulls/{pull_number}/commits', | ||
{ | ||
params: { | ||
path: {owner, repo, pull_number: Number(prNumber)}, | ||
}, | ||
}, | ||
) | ||
setCommits(response.data as never) | ||
} catch (err) { | ||
console.error('Error fetching commits:', err) | ||
} | ||
} | ||
|
||
return ( | ||
<div className="flex flex-col w-full min-h-screen p-10"> | ||
<div className="max-w-3xl mx-auto"> | ||
<h1 className="text-3xl font-bold mb-6">GitHub PR Summary</h1> | ||
<p className="text-gray-500 dark:text-gray-400 mb-6"> | ||
Enter a GitHub PR link to view a summary of the commits. | ||
</p> | ||
<div className="space-y-4"> | ||
<div className="space-y-2"> | ||
<Label htmlFor="pr-link">Pull Request Link</Label> | ||
<Input | ||
id="pr-link" | ||
placeholder="https://github.com/user/repo/pull/123" | ||
value={prLink} | ||
onChange={handlePRLinkChange} | ||
required | ||
/> | ||
</div> | ||
<Button | ||
className="w-full bg-primary text-primary-foreground hover:bg-primary/90" | ||
type="submit" | ||
onClick={fetchCommits}> | ||
Analyze | ||
</Button> | ||
</div> | ||
<Card className="mt-8"> | ||
<CardHeader> | ||
<CardTitle className="text-xl">Summarized Commits</CardTitle> | ||
<CardDescription> | ||
A brief summary of all commits generated by OpenAI | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent> | ||
<p className="text-gray-500 dark:text-gray-400 text-sm"> | ||
OpenAI generated commit summary goes here... | ||
</p> | ||
</CardContent> | ||
</Card> | ||
<Card className="mt-8"> | ||
<CardHeader> | ||
<CardTitle className="text-xl">Commits Summary</CardTitle> | ||
<CardDescription> | ||
List of commits for the provided GitHub PR | ||
</CardDescription> | ||
</CardHeader> | ||
<CardContent> | ||
<CommitsList commits={commits} /> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
</div> | ||
) | ||
} |
Oops, something went wrong.
98958ac
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
opensdks – ./
opensdks-git-main-venice.vercel.app
opensdks-venice.vercel.app
opensdks.org
opensdks.vercel.app