539 lines
15 KiB
TypeScript
539 lines
15 KiB
TypeScript
import type { DashboardSession, DashboardStats } from "./types";
|
|
|
|
/**
|
|
* Mock data for the dashboard.
|
|
* Covers all attention zones: urgent, action, warning, ok, done.
|
|
*
|
|
* TODO: Remove this file when wiring to real data sources. These fixtures
|
|
* are imported by API routes and pages, so they end up in the server bundle.
|
|
* Consider moving to __fixtures__/ or gating behind an env check once
|
|
* real SessionManager integration is in place.
|
|
*/
|
|
|
|
const now = new Date();
|
|
const ago = (minutes: number) => new Date(now.getTime() - minutes * 60000).toISOString();
|
|
|
|
export const mockSessions: DashboardSession[] = [
|
|
// URGENT: needs human input — agent is blocked asking a question
|
|
{
|
|
id: "backend-3",
|
|
projectId: "my-app",
|
|
status: "needs_input",
|
|
activity: "waiting_input",
|
|
branch: "feat/INT-1280-auth-refactor",
|
|
issueId: "INT-1280",
|
|
summary: "Refactoring authentication to use JWT — blocked on key rotation strategy",
|
|
createdAt: ago(180),
|
|
lastActivityAt: ago(2),
|
|
pr: {
|
|
number: 421,
|
|
url: "https://github.com/acme/my-app/pull/421",
|
|
title: "feat: refactor auth to use JWT with key rotation",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1280-auth-refactor",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 342,
|
|
deletions: 187,
|
|
ciStatus: "passing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed", url: "https://github.com/acme/my-app/actions/runs/1" },
|
|
{ name: "test", status: "passed", url: "https://github.com/acme/my-app/actions/runs/2" },
|
|
{ name: "lint", status: "passed", url: "https://github.com/acme/my-app/actions/runs/3" },
|
|
],
|
|
reviewDecision: "pending",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: true,
|
|
approved: false,
|
|
noConflicts: true,
|
|
blockers: ["Needs review"],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// URGENT: CI failing
|
|
{
|
|
id: "backend-5",
|
|
projectId: "my-app",
|
|
status: "ci_failed",
|
|
activity: "idle",
|
|
branch: "feat/INT-1295-rate-limiting",
|
|
issueId: "INT-1295",
|
|
summary: "Adding rate limiting middleware — CI failing on integration tests",
|
|
createdAt: ago(120),
|
|
lastActivityAt: ago(15),
|
|
pr: {
|
|
number: 428,
|
|
url: "https://github.com/acme/my-app/pull/428",
|
|
title: "feat: add rate limiting middleware with Redis backend",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1295-rate-limiting",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 567,
|
|
deletions: 23,
|
|
ciStatus: "failing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed", url: "https://github.com/acme/my-app/actions/runs/10" },
|
|
{
|
|
name: "unit-tests",
|
|
status: "passed",
|
|
url: "https://github.com/acme/my-app/actions/runs/11",
|
|
},
|
|
{
|
|
name: "integration-tests",
|
|
status: "failed",
|
|
url: "https://github.com/acme/my-app/actions/runs/12",
|
|
},
|
|
{ name: "lint", status: "passed", url: "https://github.com/acme/my-app/actions/runs/13" },
|
|
],
|
|
reviewDecision: "none",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: false,
|
|
approved: false,
|
|
noConflicts: true,
|
|
blockers: ["CI checks failing", "Needs review"],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// URGENT: changes requested + unresolved comments
|
|
{
|
|
id: "frontend-2",
|
|
projectId: "my-app",
|
|
status: "changes_requested",
|
|
activity: "idle",
|
|
branch: "feat/INT-1301-search-ui",
|
|
issueId: "INT-1301",
|
|
summary: "Implementing search UI — changes requested by reviewer",
|
|
createdAt: ago(300),
|
|
lastActivityAt: ago(45),
|
|
pr: {
|
|
number: 415,
|
|
url: "https://github.com/acme/my-app/pull/415",
|
|
title: "feat: add full-text search with autocomplete",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1301-search-ui",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 891,
|
|
deletions: 156,
|
|
ciStatus: "passing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed" },
|
|
{ name: "test", status: "passed" },
|
|
{ name: "lint", status: "passed" },
|
|
{ name: "e2e", status: "passed" },
|
|
],
|
|
reviewDecision: "changes_requested",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: true,
|
|
approved: false,
|
|
noConflicts: true,
|
|
blockers: ["Changes requested"],
|
|
},
|
|
unresolvedThreads: 3,
|
|
unresolvedComments: [
|
|
{
|
|
url: "https://github.com/acme/my-app/pull/415#discussion_r1",
|
|
path: "src/components/Search.tsx",
|
|
author: "reviewer1",
|
|
body: "This should debounce the API calls",
|
|
},
|
|
{
|
|
url: "https://github.com/acme/my-app/pull/415#discussion_r2",
|
|
path: "src/hooks/useSearch.ts",
|
|
author: "reviewer1",
|
|
body: "Missing error handling for network failures",
|
|
},
|
|
{
|
|
url: "https://github.com/acme/my-app/pull/415#discussion_r3",
|
|
path: "src/components/SearchResults.tsx",
|
|
author: "reviewer2",
|
|
body: "Accessibility: needs aria-live region for results",
|
|
},
|
|
],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// ACTION: ready to merge
|
|
{
|
|
id: "backend-7",
|
|
projectId: "my-app",
|
|
status: "mergeable",
|
|
activity: "idle",
|
|
branch: "feat/INT-1310-health-check",
|
|
issueId: "INT-1310",
|
|
summary: "Added health check endpoint with dependency status",
|
|
createdAt: ago(90),
|
|
lastActivityAt: ago(30),
|
|
pr: {
|
|
number: 432,
|
|
url: "https://github.com/acme/my-app/pull/432",
|
|
title: "feat: add /health endpoint with dependency checks",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1310-health-check",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 145,
|
|
deletions: 8,
|
|
ciStatus: "passing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed" },
|
|
{ name: "test", status: "passed" },
|
|
{ name: "lint", status: "passed" },
|
|
],
|
|
reviewDecision: "approved",
|
|
mergeability: {
|
|
mergeable: true,
|
|
ciPassing: true,
|
|
approved: true,
|
|
noConflicts: true,
|
|
blockers: [],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// ACTION: ready to merge (another one)
|
|
{
|
|
id: "frontend-4",
|
|
projectId: "my-app",
|
|
status: "mergeable",
|
|
activity: "idle",
|
|
branch: "fix/INT-1315-date-picker",
|
|
issueId: "INT-1315",
|
|
summary: "Fixed date picker timezone handling",
|
|
createdAt: ago(60),
|
|
lastActivityAt: ago(20),
|
|
pr: {
|
|
number: 435,
|
|
url: "https://github.com/acme/my-app/pull/435",
|
|
title: "fix: date picker timezone conversion for UTC users",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "fix/INT-1315-date-picker",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 47,
|
|
deletions: 12,
|
|
ciStatus: "passing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed" },
|
|
{ name: "test", status: "passed" },
|
|
{ name: "lint", status: "passed" },
|
|
],
|
|
reviewDecision: "approved",
|
|
mergeability: {
|
|
mergeable: true,
|
|
ciPassing: true,
|
|
approved: true,
|
|
noConflicts: true,
|
|
blockers: [],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// WARNING: PR open, needs review
|
|
{
|
|
id: "backend-8",
|
|
projectId: "my-app",
|
|
status: "review_pending",
|
|
activity: "idle",
|
|
branch: "feat/INT-1318-websocket",
|
|
issueId: "INT-1318",
|
|
summary: "WebSocket support for real-time notifications",
|
|
createdAt: ago(240),
|
|
lastActivityAt: ago(60),
|
|
pr: {
|
|
number: 430,
|
|
url: "https://github.com/acme/my-app/pull/430",
|
|
title: "feat: WebSocket server for real-time push notifications",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1318-websocket",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 723,
|
|
deletions: 45,
|
|
ciStatus: "passing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed" },
|
|
{ name: "test", status: "passed" },
|
|
{ name: "lint", status: "passed" },
|
|
{ name: "integration-tests", status: "passed" },
|
|
],
|
|
reviewDecision: "pending",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: true,
|
|
approved: false,
|
|
noConflicts: true,
|
|
blockers: ["Needs review"],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// WARNING: CI pending
|
|
{
|
|
id: "frontend-5",
|
|
projectId: "my-app",
|
|
status: "pr_open",
|
|
activity: "idle",
|
|
branch: "feat/INT-1322-dark-mode",
|
|
issueId: "INT-1322",
|
|
summary: "Implementing dark mode theme toggle",
|
|
createdAt: ago(45),
|
|
lastActivityAt: ago(10),
|
|
pr: {
|
|
number: 438,
|
|
url: "https://github.com/acme/my-app/pull/438",
|
|
title: "feat: dark mode with system preference detection",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1322-dark-mode",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 312,
|
|
deletions: 89,
|
|
ciStatus: "pending",
|
|
ciChecks: [
|
|
{ name: "build", status: "running" },
|
|
{ name: "test", status: "pending" },
|
|
{ name: "lint", status: "passed" },
|
|
],
|
|
reviewDecision: "none",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: false,
|
|
approved: false,
|
|
noConflicts: true,
|
|
blockers: ["CI checks pending", "Needs review"],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// OK: actively working
|
|
{
|
|
id: "backend-9",
|
|
projectId: "my-app",
|
|
status: "working",
|
|
activity: "active",
|
|
branch: "feat/INT-1325-caching",
|
|
issueId: "INT-1325",
|
|
summary: "Implementing Redis caching layer for API responses",
|
|
createdAt: ago(30),
|
|
lastActivityAt: ago(0),
|
|
pr: null,
|
|
metadata: {},
|
|
},
|
|
|
|
// OK: actively working with PR
|
|
{
|
|
id: "frontend-6",
|
|
projectId: "my-app",
|
|
status: "working",
|
|
activity: "active",
|
|
branch: "feat/INT-1328-notifications",
|
|
issueId: "INT-1328",
|
|
summary: "Building notification center component",
|
|
createdAt: ago(55),
|
|
lastActivityAt: ago(0),
|
|
pr: {
|
|
number: 440,
|
|
url: "https://github.com/acme/my-app/pull/440",
|
|
title: "feat: notification center with mark-as-read",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1328-notifications",
|
|
baseBranch: "main",
|
|
isDraft: true,
|
|
state: "open",
|
|
additions: 234,
|
|
deletions: 0,
|
|
ciStatus: "pending",
|
|
ciChecks: [
|
|
{ name: "build", status: "running" },
|
|
{ name: "test", status: "pending" },
|
|
],
|
|
reviewDecision: "none",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: false,
|
|
approved: false,
|
|
noConflicts: true,
|
|
blockers: ["Draft PR", "CI pending"],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// OK: actively working — has merge conflict on PR
|
|
{
|
|
id: "backend-11",
|
|
projectId: "my-app",
|
|
status: "working",
|
|
activity: "active",
|
|
branch: "feat/INT-1335-email-templates",
|
|
issueId: "INT-1335",
|
|
summary: "Implementing email template engine with MJML",
|
|
createdAt: ago(100),
|
|
lastActivityAt: ago(1),
|
|
pr: {
|
|
number: 442,
|
|
url: "https://github.com/acme/my-app/pull/442",
|
|
title: "feat: email template engine with MJML support",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1335-email-templates",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "open",
|
|
additions: 489,
|
|
deletions: 32,
|
|
ciStatus: "passing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed", url: "https://github.com/acme/my-app/actions/runs/20" },
|
|
{ name: "test", status: "passed", url: "https://github.com/acme/my-app/actions/runs/21" },
|
|
{ name: "lint", status: "passed", url: "https://github.com/acme/my-app/actions/runs/22" },
|
|
],
|
|
reviewDecision: "pending",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: true,
|
|
approved: false,
|
|
noConflicts: false,
|
|
blockers: ["Merge conflict", "Needs review"],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// OK: spawning
|
|
{
|
|
id: "backend-10",
|
|
projectId: "my-app",
|
|
status: "spawning",
|
|
activity: "active",
|
|
branch: null,
|
|
issueId: "INT-1330",
|
|
summary: "Setting up workspace for database migration task",
|
|
createdAt: ago(1),
|
|
lastActivityAt: ago(0),
|
|
pr: null,
|
|
metadata: {},
|
|
},
|
|
|
|
// DONE: merged
|
|
{
|
|
id: "backend-1",
|
|
projectId: "my-app",
|
|
status: "merged",
|
|
activity: "exited",
|
|
branch: "feat/INT-1260-logging",
|
|
issueId: "INT-1260",
|
|
summary: "Structured logging with correlation IDs",
|
|
createdAt: ago(480),
|
|
lastActivityAt: ago(120),
|
|
pr: {
|
|
number: 410,
|
|
url: "https://github.com/acme/my-app/pull/410",
|
|
title: "feat: structured logging with request correlation",
|
|
owner: "acme",
|
|
repo: "my-app",
|
|
branch: "feat/INT-1260-logging",
|
|
baseBranch: "main",
|
|
isDraft: false,
|
|
state: "merged",
|
|
additions: 456,
|
|
deletions: 234,
|
|
ciStatus: "passing",
|
|
ciChecks: [
|
|
{ name: "build", status: "passed" },
|
|
{ name: "test", status: "passed" },
|
|
],
|
|
reviewDecision: "approved",
|
|
mergeability: {
|
|
mergeable: false,
|
|
ciPassing: true,
|
|
approved: true,
|
|
noConflicts: true,
|
|
blockers: [],
|
|
},
|
|
unresolvedThreads: 0,
|
|
unresolvedComments: [],
|
|
},
|
|
metadata: {},
|
|
},
|
|
|
|
// DONE: killed
|
|
{
|
|
id: "frontend-1",
|
|
projectId: "my-app",
|
|
status: "killed",
|
|
activity: "exited",
|
|
branch: "feat/INT-1270-table",
|
|
issueId: "INT-1270",
|
|
summary: "Data table component (superseded by INT-1301)",
|
|
createdAt: ago(600),
|
|
lastActivityAt: ago(300),
|
|
pr: null,
|
|
metadata: {},
|
|
},
|
|
];
|
|
|
|
export function getMockStats(): DashboardStats {
|
|
const sessions = mockSessions;
|
|
return {
|
|
totalSessions: sessions.length,
|
|
workingSessions: sessions.filter((s) => s.activity === "active").length,
|
|
openPRs: sessions.filter((s) => s.pr?.state === "open").length,
|
|
needsReview: sessions.filter(
|
|
(s) =>
|
|
s.pr &&
|
|
!s.pr.isDraft &&
|
|
(s.pr.reviewDecision === "pending" || s.pr.reviewDecision === "none"),
|
|
).length,
|
|
};
|
|
}
|
|
|
|
export function getMockSession(id: string): DashboardSession | null {
|
|
return mockSessions.find((s) => s.id === id) ?? null;
|
|
}
|