-
Notifications
You must be signed in to change notification settings - Fork 8
feat: Sprint Management Dashboard - Bounty #14 #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhaog100
wants to merge
2
commits into
ubiquity-os:main
Choose a base branch
from
zhaog100:feat/sprint-dashboard
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,13 @@ | ||
| # GitHub OAuth | ||
| GITHUB_ID=your_github_oauth_app_id | ||
| GITHUB_SECRET=your_github_oauth_app_secret | ||
| NEXTAUTH_URL=http://localhost:3000 | ||
| NEXTAUTH_SECRET=generate_with_openssl_rand_base64_32 | ||
|
|
||
| # AI Sprint Planning (optional — uses OpenAI-compatible API) | ||
| OPENAI_API_KEY=sk-... | ||
| OPENAI_BASE_URL=https://api.openai.com/v1 | ||
|
|
||
| # Metrics defaults | ||
| ENG_MANAGER_HOURLY_RATE=75 | ||
| MINUTES_PER_MANUAL_ASSIGNMENT=5 |
This file contains hidden or 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,105 @@ | ||
| # Sprint Management Dashboard | ||
|
|
||
| AI-powered sprint planning tool for engineering teams. Automate task assignment, save hours of manual work every sprint. | ||
|
|
||
| ## Features | ||
|
|
||
| 1. **Landing Page** — Marketing conversion page with "Sign in with GitHub" OAuth | ||
| 2. **Sprint Dashboard** — Calendar view with team member task assignments | ||
| 3. **Priority System** — Tinder-like swipe interface for task prioritization (low / high / urgent) | ||
| 4. **AI Sprint Planning** — Auto-assign tasks based on team skills, labels, and availability | ||
| 5. **Metrics** — Time & cost savings calculator (minutes saved, hours saved, $ saved) | ||
| 6. **Task Import** — Bulk import open issues from GitHub organization repos | ||
|
|
||
| ## Tech Stack | ||
|
|
||
| - **Framework**: Next.js 14 (App Router) + TypeScript | ||
| - **Styling**: Tailwind CSS | ||
| - **Auth**: NextAuth.js (GitHub OAuth) | ||
| - **GitHub API**: Octokit | ||
| - **AI**: OpenAI-compatible API (optional, falls back to heuristic) | ||
|
|
||
| ## Quick Start | ||
|
|
||
| ```bash | ||
| # 1. Install dependencies | ||
| cd dashboard | ||
| npm install | ||
|
|
||
| # 2. Copy environment config | ||
| cp .env.example .env.local | ||
|
|
||
| # 3. Configure GitHub OAuth | ||
| # Create an OAuth app at https://github.com/settings/developers | ||
| # Set GITHUB_ID and GITHUB_SECRET in .env.local | ||
|
|
||
| # 4. (Optional) Configure AI for smart sprint planning | ||
| # Set OPENAI_API_KEY in .env.local | ||
|
|
||
| # 5. Run dev server | ||
| npm run dev | ||
| # Open http://localhost:3000 | ||
| ``` | ||
|
|
||
| ## Environment Variables | ||
|
|
||
| | Variable | Required | Description | | ||
| |---|---|---| | ||
| | `GITHUB_ID` | ✅ | GitHub OAuth App Client ID | | ||
| | `GITHUB_SECRET` | ✅ | GitHub OAuth App Client Secret | | ||
| | `NEXTAUTH_URL` | ✅ | Base URL (e.g. `http://localhost:3000`) | | ||
| | `NEXTAUTH_SECRET` | ✅ | Random secret for JWT signing | | ||
| | `OPENAI_API_KEY` | ❌ | For AI-powered sprint planning | | ||
| | `OPENAI_BASE_URL` | ❌ | Custom OpenAI-compatible endpoint | | ||
| | `ENG_MANAGER_HOURLY_RATE` | ❌ | Default: $75/hr | | ||
| | `MINUTES_PER_MANUAL_ASSIGNMENT` | ❌ | Default: 5 min | | ||
|
|
||
| ## Usage | ||
|
|
||
| 1. **Sign in** with your GitHub account on the landing page | ||
| 2. **Import tasks** — Enter a GitHub org name and token to scan repos and import open issues | ||
| 3. **Prioritize** — Use the swipe interface to set task priority (low / high / urgent) | ||
| 4. **Plan sprint** — Click "AI Plan Sprint" to auto-assign tasks to team members | ||
| 5. **View calendar** — See the sprint schedule with tasks distributed across the week | ||
| 6. **Track savings** — Check the Metrics tab for time/cost savings | ||
|
|
||
| ## API Routes | ||
|
|
||
| | Endpoint | Method | Description | | ||
| |---|---|---| | ||
| | `/api/auth/[...nextauth]` | GET/POST | NextAuth.js GitHub OAuth | | ||
| | `/api/org/sync` | POST | Sync repos & issues from a GitHub org | | ||
| | `/api/sprint/plan` | POST | Generate AI sprint assignments | | ||
| | `/api/metrics` | POST | Calculate time/cost savings metrics | | ||
|
|
||
| ## Architecture | ||
|
|
||
| ``` | ||
| dashboard/ | ||
| ├── src/ | ||
| │ ├── app/ | ||
| │ │ ├── page.tsx # Landing page | ||
| │ │ ├── layout.tsx # Root layout | ||
| │ │ ├── globals.css # Global styles | ||
| │ │ ├── dashboard/ | ||
| │ │ │ └── page.tsx # Sprint dashboard | ||
| │ │ └── api/ | ||
| │ │ ├── auth/[...nextauth]/route.ts # OAuth | ||
| │ │ ├── org/sync/route.ts # GitHub sync | ||
| │ │ ├── sprint/plan/route.ts # AI planning | ||
| │ │ └── metrics/route.ts # Metrics calc | ||
| │ └── components/ | ||
| │ ├── CalendarView.tsx # Weekly calendar grid | ||
| │ ├── PrioritySwiper.tsx # Swipe prioritization | ||
| │ ├── MetricsPanel.tsx # Savings dashboard | ||
| │ └── TaskImport.tsx # GitHub import panel | ||
| ├── package.json | ||
| ├── next.config.js | ||
| ├── tailwind.config.ts | ||
| ├── tsconfig.json | ||
| └── .env.example | ||
| ``` | ||
|
|
||
| ## License | ||
|
|
||
| MIT |
This file contains hidden or 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,13 @@ | ||
| /** @type {import('next').NextConfig} */ | ||
| const nextConfig = { | ||
| images: { | ||
| remotePatterns: [ | ||
| { | ||
| protocol: "https", | ||
| hostname: "avatars.githubusercontent.com", | ||
| }, | ||
| ], | ||
| }, | ||
| }; | ||
|
|
||
| module.exports = nextConfig; |
This file contains hidden or 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,30 @@ | ||
| { | ||
| "name": "sprint-dashboard", | ||
| "version": "0.1.0", | ||
| "private": true, | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "build": "next build", | ||
| "start": "next start", | ||
| "lint": "next lint" | ||
| }, | ||
| "dependencies": { | ||
| "next": "14.2.3", | ||
| "react": "^18.3.1", | ||
| "react-dom": "^18.3.1", | ||
| "next-auth": "^4.24.7", | ||
| "octokit": "^4.0.2", | ||
| "openai": "^4.52.0" | ||
| }, | ||
| "devDependencies": { | ||
| "@types/node": "^20.14.2", | ||
| "@types/react": "^18.3.3", | ||
| "@types/react-dom": "^18.3.0", | ||
| "typescript": "^5.4.5", | ||
| "tailwindcss": "^3.4.4", | ||
| "postcss": "^8.4.38", | ||
| "autoprefixer": "^10.4.19", | ||
| "eslint": "^8.57.0", | ||
| "eslint-config-next": "14.2.3" | ||
| } | ||
| } |
This file contains hidden or 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,33 @@ | ||
| import NextAuth, { type NextAuthOptions } from "next-auth"; | ||
| import GithubProvider from "next-auth/providers/github"; | ||
|
|
||
| if (!process.env.GITHUB_ID) throw new Error("Missing GITHUB_ID env var"); | ||
| if (!process.env.GITHUB_SECRET) throw new Error("Missing GITHUB_SECRET env var"); | ||
|
|
||
| export const authOptions: NextAuthOptions = { | ||
| providers: [ | ||
| GithubProvider({ | ||
| clientId: process.env.GITHUB_ID, | ||
| clientSecret: process.env.GITHUB_SECRET, | ||
| }), | ||
| ], | ||
| callbacks: { | ||
| async jwt({ token, account }) { | ||
| if (account) { | ||
| token.accessToken = account.access_token; | ||
| } | ||
| return token; | ||
| }, | ||
| async session({ session, token }) { | ||
| // Keep OAuth tokens server-only; do not expose to client | ||
| return session; | ||
| }, | ||
| }, | ||
| pages: { | ||
| signIn: "/", | ||
| error: "/", | ||
| }, | ||
| }; | ||
|
|
||
| const handler = NextAuth(authOptions); | ||
| export { handler as GET, handler as POST }; | ||
This file contains hidden or 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,71 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
|
|
||
| /** | ||
| * POST /api/metrics | ||
| * Body: { totalTasks: number, assignedByAI: number } | ||
| * | ||
| * Calculates time & cost savings from automated sprint assignment. | ||
| */ | ||
| export async function POST(req: NextRequest) { | ||
| let body: { totalTasks: number; assignedByAI: number }; | ||
| try { | ||
| body = await req.json(); | ||
| } catch { | ||
| return NextResponse.json({ error: "Invalid JSON body" }, { status: 400 }); | ||
| } | ||
|
|
||
| const { totalTasks, assignedByAI } = body; | ||
|
|
||
| if ( | ||
| typeof totalTasks !== "number" || | ||
| typeof assignedByAI !== "number" || | ||
| !Number.isFinite(totalTasks) || | ||
| !Number.isFinite(assignedByAI) || | ||
| totalTasks < 0 || | ||
| assignedByAI < 0 || | ||
| assignedByAI > totalTasks | ||
| ) { | ||
| return NextResponse.json( | ||
| { error: "totalTasks and assignedByAI must be non-negative finite numbers with assignedByAI <= totalTasks" }, | ||
| { status: 400 } | ||
| ); | ||
| } | ||
|
|
||
| const minutesPerTask = Number(process.env.MINUTES_PER_MANUAL_ASSIGNMENT) || 5; | ||
| const hourlyRate = Number(process.env.ENG_MANAGER_HOURLY_RATE) || 75; | ||
|
|
||
| const manualMinutes = totalTasks * minutesPerTask; | ||
| const aiMinutes = (totalTasks - assignedByAI) * minutesPerTask; | ||
| const minutesSaved = manualMinutes - aiMinutes; | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| const hoursSaved = minutesSaved / 60; | ||
| const dollarsSaved = Math.round(hoursSaved * hourlyRate); | ||
|
|
||
| // Scale projection: what if the backlog grows? | ||
| const projections = [50, 100, 250, 500, 1000].map((size) => { | ||
| const h = (size * minutesPerTask) / 60; | ||
| return { | ||
| backlogSize: size, | ||
| manualHours: h, | ||
| aiHours: Math.round(h * 0.1 * 10) / 10, // AI reduces assignment time by ~90% | ||
| savings: Math.round(h * 0.9 * hourlyRate), | ||
| }; | ||
| }); | ||
|
|
||
| return NextResponse.json({ | ||
| baseline: { | ||
| totalTasks, | ||
| assignedByAI, | ||
| assignedManually: totalTasks - assignedByAI, | ||
| }, | ||
| savings: { | ||
| minutesSaved, | ||
| hoursSaved: Math.round(hoursSaved * 100) / 100, | ||
| dollarsSaved, | ||
| }, | ||
| assumptions: { | ||
| minutesPerManualAssignment: minutesPerTask, | ||
| engManagerHourlyRate: hourlyRate, | ||
| }, | ||
| projections, | ||
| }); | ||
| } | ||
This file contains hidden or 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,95 @@ | ||
| import { NextRequest, NextResponse } from "next/server"; | ||
| import { Octokit } from "octokit"; | ||
|
|
||
| /** | ||
| * POST /api/org/sync | ||
| * Body: { org: string, accessToken: string } | ||
| * Scrapes all repos + open issues from a GitHub org and returns them. | ||
| */ | ||
| export async function POST(req: NextRequest) { | ||
| let body: { org?: string; accessToken?: string }; | ||
| try { | ||
| body = await req.json(); | ||
| } catch { | ||
| return NextResponse.json({ error: "Invalid JSON body" }, { status: 400 }); | ||
| } | ||
|
|
||
| const { org, accessToken } = body; | ||
|
|
||
| if (!org || !accessToken) { | ||
| return NextResponse.json({ error: "org and accessToken are required" }, { status: 400 }); | ||
| } | ||
|
|
||
| const octokit = new Octokit({ auth: accessToken }); | ||
|
|
||
| try { | ||
| // Fetch org repos (paginated) | ||
| const repos = await octokit.paginate(octokit.rest.repos.listForOrg, { | ||
| org, | ||
| per_page: 100, | ||
| sort: "updated", | ||
| }); | ||
|
|
||
| // Fetch open issues for each repo (top 30 per repo to stay within rate limits) | ||
| const tasks: Task[] = []; | ||
| const failedRepos: string[] = []; | ||
| for (const repo of repos) { | ||
| try { | ||
| const { data: issues } = await octokit.rest.issues.listForRepo({ | ||
| owner: org, | ||
| repo: repo.name, | ||
| state: "open", | ||
| per_page: 30, | ||
| }); | ||
|
|
||
| for (const issue of issues) { | ||
| // Skip pull requests (they show up in the issues endpoint) | ||
| if (issue.pull_request) continue; | ||
|
|
||
| tasks.push({ | ||
| id: issue.id, | ||
| number: issue.number, | ||
| title: issue.title, | ||
| body: issue.body ?? "", | ||
| url: issue.html_url, | ||
| repo: repo.name, | ||
| labels: issue.labels.map((l: any) => (typeof l === "string" ? l : l.name)), | ||
| assignee: issue.assignee?.login ?? null, | ||
| createdAt: issue.created_at, | ||
| updatedAt: issue.updated_at, | ||
| }); | ||
| } | ||
| } catch { | ||
| failedRepos.push(repo.name); | ||
| } | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| } | ||
|
|
||
| return NextResponse.json({ | ||
| org, | ||
| repoCount: repos.length, | ||
| tasks, | ||
| warnings: failedRepos.length | ||
| ? { failedRepos, failedCount: failedRepos.length } | ||
| : undefined, | ||
| syncedAt: new Date().toISOString(), | ||
| }); | ||
| } catch (error: any) { | ||
| return NextResponse.json( | ||
| { error: error.message ?? "Failed to sync org" }, | ||
| { status: 500 } | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| export interface Task { | ||
| id: number; | ||
| number: number; | ||
| title: string; | ||
| body: string; | ||
| url: string; | ||
| repo: string; | ||
| labels: string[]; | ||
| assignee: string | null; | ||
| createdAt: string; | ||
| updatedAt: string; | ||
| } | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.