MCP Server 2.0 (#452)
* MCP Server 2.0 - Updated application version from 2.23.14 to 2.24.0 in package.json. - MCP Server improved with new features - Migrated functionality from Dev Tools to MCP Server - Improved getMonitoringProvider not to crash application when misconfigured
This commit is contained in:
committed by
GitHub
parent
059408a70a
commit
f3ac595d06
@@ -0,0 +1,235 @@
|
||||
'use client';
|
||||
|
||||
import { CalendarIcon, FileTextIcon, UsersIcon } from 'lucide-react';
|
||||
|
||||
import { Badge } from '@kit/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
|
||||
import { Progress } from '@kit/ui/progress';
|
||||
import { Separator } from '@kit/ui/separator';
|
||||
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@kit/ui/tabs';
|
||||
|
||||
import { UserStoryDisplay } from '../../_components/user-story-display';
|
||||
import type { PRDData } from '../../_lib/server/prd-page.loader';
|
||||
|
||||
interface PRDDetailViewProps {
|
||||
filename: string;
|
||||
prd: PRDData;
|
||||
}
|
||||
|
||||
export function PRDDetailView({ filename, prd }: PRDDetailViewProps) {
|
||||
return (
|
||||
<div className="space-y-6 p-4">
|
||||
{/* Header */}
|
||||
<div className="flex items-center gap-4">
|
||||
<div>
|
||||
<div className="flex items-center gap-3">
|
||||
<FileTextIcon className="h-5 w-5" />
|
||||
<h1 className="text-2xl font-bold">{prd.introduction.title}</h1>
|
||||
</div>
|
||||
<div className="text-muted-foreground flex items-center gap-4 text-sm">
|
||||
<span className="flex items-center gap-1">
|
||||
<CalendarIcon className="h-3 w-3" />
|
||||
Updated {prd.metadata.lastUpdated}
|
||||
</span>
|
||||
<span>{filename}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Progress Overview */}
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2 text-lg">
|
||||
Progress Overview
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="flex items-center justify-between">
|
||||
<span className="text-sm font-medium">Overall Progress</span>
|
||||
<span className="text-sm font-medium">{prd.progress.overall}%</span>
|
||||
</div>
|
||||
<Progress value={prd.progress.overall} className="h-3" />
|
||||
<div className="text-muted-foreground flex justify-between text-sm">
|
||||
<span>
|
||||
{prd.progress.completed} of {prd.progress.total} user stories
|
||||
completed
|
||||
</span>
|
||||
<span>{prd.progress.total - prd.progress.completed} remaining</span>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{/* Main Content */}
|
||||
<Tabs defaultValue="overview" className="space-y-6">
|
||||
<TabsList className="grid w-full grid-cols-4">
|
||||
<TabsTrigger value="overview">Overview</TabsTrigger>
|
||||
<TabsTrigger value="requirements">Requirements</TabsTrigger>
|
||||
<TabsTrigger value="user-stories">
|
||||
User Stories ({prd.userStories.length})
|
||||
</TabsTrigger>
|
||||
<TabsTrigger value="metadata">Metadata</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="overview" className="space-y-6">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Project Overview</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div>
|
||||
<h4 className="mb-2 font-medium">Description</h4>
|
||||
<p className="text-muted-foreground">
|
||||
{prd.introduction.overview}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
<div>
|
||||
<h4 className="mb-2 font-medium">Problem Statement</h4>
|
||||
<p className="text-muted-foreground">
|
||||
{prd.problemStatement.problem}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
<div>
|
||||
<h4 className="mb-2 font-medium">Market Opportunity</h4>
|
||||
<p className="text-muted-foreground">
|
||||
{prd.problemStatement.marketOpportunity}
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="requirements" className="space-y-6">
|
||||
<div className="grid gap-6 md:grid-cols-2">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<UsersIcon className="h-4 w-4" />
|
||||
Target Users
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ul className="space-y-2">
|
||||
{prd.problemStatement.targetUsers?.map(
|
||||
(user, index: number) => (
|
||||
<li key={index} className="flex items-center gap-2">
|
||||
<span className="text-muted-foreground">•</span>
|
||||
<span>{user}</span>
|
||||
</li>
|
||||
),
|
||||
)}
|
||||
</ul>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Key Features</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ul className="space-y-2">
|
||||
{prd.solutionOverview.keyFeatures?.map((feature, index) => (
|
||||
<li key={index} className="flex items-center gap-2">
|
||||
<span className="text-muted-foreground">•</span>
|
||||
<span>{feature}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="md:col-span-2">
|
||||
<CardHeader>
|
||||
<CardTitle>Solution Description</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<p className="text-muted-foreground">
|
||||
{prd.solutionOverview.description}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
<Card className="md:col-span-2">
|
||||
<CardHeader>
|
||||
<CardTitle>Success Metrics</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ul className="space-y-2">
|
||||
{prd.solutionOverview.successMetrics?.map((metric, index) => (
|
||||
<li key={index} className="flex items-center gap-2">
|
||||
<span className="text-muted-foreground">•</span>
|
||||
<span>{metric}</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="user-stories">
|
||||
<UserStoryDisplay userStories={prd.userStories} />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="metadata" className="space-y-6">
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>Metadata</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-4">
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<div>
|
||||
<h4 className="mb-1 font-medium">Last Updated</h4>
|
||||
<p className="text-muted-foreground">
|
||||
{prd.metadata.lastUpdated}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="mb-1 font-medium">Version</h4>
|
||||
<p className="text-muted-foreground">
|
||||
{prd.metadata.version}
|
||||
</p>
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="mb-1 font-medium">Filename</h4>
|
||||
<p className="text-muted-foreground">{filename}</p>
|
||||
</div>
|
||||
<div>
|
||||
<h4 className="mb-1 font-medium">Total User Stories</h4>
|
||||
<p className="text-muted-foreground">{prd.progress.total}</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Separator />
|
||||
|
||||
<div>
|
||||
<h4 className="mb-2 font-medium">Progress Breakdown</h4>
|
||||
<div className="grid gap-2 text-sm">
|
||||
<div className="flex justify-between">
|
||||
<span>Completed Stories:</span>
|
||||
<Badge variant="default">{prd.progress.completed}</Badge>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Remaining Stories:</span>
|
||||
<Badge variant="secondary">
|
||||
{prd.progress.total - prd.progress.completed}
|
||||
</Badge>
|
||||
</div>
|
||||
<div className="flex justify-between">
|
||||
<span>Overall Progress:</span>
|
||||
<Badge variant="outline">{prd.progress.overall}%</Badge>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
44
apps/dev-tool/app/prds/[filename]/page.tsx
Normal file
44
apps/dev-tool/app/prds/[filename]/page.tsx
Normal file
@@ -0,0 +1,44 @@
|
||||
import { Metadata } from 'next';
|
||||
|
||||
import { notFound } from 'next/navigation';
|
||||
|
||||
import { loadPRDPageData } from '../_lib/server/prd-page.loader';
|
||||
import { PRDDetailView } from './_components/prd-detail-view';
|
||||
|
||||
interface PRDPageProps {
|
||||
params: Promise<{
|
||||
filename: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export async function generateMetadata({
|
||||
params,
|
||||
}: PRDPageProps): Promise<Metadata> {
|
||||
const { filename } = await params;
|
||||
|
||||
try {
|
||||
const prd = await loadPRDPageData(filename);
|
||||
|
||||
return {
|
||||
title: `${prd.introduction.title} - PRD`,
|
||||
description: prd.introduction.overview,
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
title: 'PRD Not Found',
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
export default async function PRDPage({ params }: PRDPageProps) {
|
||||
const { filename } = await params;
|
||||
|
||||
try {
|
||||
const prd = await loadPRDPageData(filename);
|
||||
|
||||
return <PRDDetailView filename={filename} prd={prd} />;
|
||||
} catch (error) {
|
||||
console.error('Failed to load PRD:', error);
|
||||
notFound();
|
||||
}
|
||||
}
|
||||
125
apps/dev-tool/app/prds/_components/prds-list-interface.tsx
Normal file
125
apps/dev-tool/app/prds/_components/prds-list-interface.tsx
Normal file
@@ -0,0 +1,125 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
|
||||
import Link from 'next/link';
|
||||
|
||||
import { CalendarIcon, FileTextIcon, SearchIcon } from 'lucide-react';
|
||||
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
|
||||
import { Input } from '@kit/ui/input';
|
||||
import { Progress } from '@kit/ui/progress';
|
||||
|
||||
interface PRDSummary {
|
||||
filename: string;
|
||||
title: string;
|
||||
lastUpdated: string;
|
||||
progress: number;
|
||||
totalStories: number;
|
||||
completedStories: number;
|
||||
}
|
||||
|
||||
interface PRDsListInterfaceProps {
|
||||
initialPrds: PRDSummary[];
|
||||
}
|
||||
|
||||
export function PRDsListInterface({ initialPrds }: PRDsListInterfaceProps) {
|
||||
const [searchTerm, setSearchTerm] = useState('');
|
||||
|
||||
const filteredPrds = initialPrds.filter(
|
||||
(prd) =>
|
||||
prd.title.toLowerCase().includes(searchTerm.toLowerCase()) ||
|
||||
prd.filename.toLowerCase().includes(searchTerm.toLowerCase()),
|
||||
);
|
||||
|
||||
return (
|
||||
<div className="space-y-6 p-4">
|
||||
{/* Header */}
|
||||
<div className="flex items-center justify-between">
|
||||
<div>
|
||||
<div className="flex items-center gap-3">
|
||||
<FileTextIcon className="h-6 w-6" />
|
||||
<h1 className="text-2xl font-bold">
|
||||
Product Requirements Documents
|
||||
</h1>
|
||||
</div>
|
||||
<p className="text-muted-foreground">
|
||||
Browse and view all PRDs in your project
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Search */}
|
||||
<div className="flex w-full flex-col gap-4">
|
||||
<div className="relative max-w-md">
|
||||
<SearchIcon className="text-muted-foreground absolute top-1/2 left-3 h-4 w-4 -translate-y-1/2" />
|
||||
<Input
|
||||
placeholder="Search PRDs by title or filename..."
|
||||
value={searchTerm}
|
||||
onChange={(e) => setSearchTerm(e.target.value)}
|
||||
className="pl-10"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* PRD Grid */}
|
||||
{filteredPrds.length === 0 ? (
|
||||
<Card>
|
||||
<CardContent className="flex h-32 items-center justify-center">
|
||||
<div className="text-center">
|
||||
<FileTextIcon className="text-muted-foreground mx-auto h-8 w-8" />
|
||||
<p className="text-muted-foreground mt-2">
|
||||
{searchTerm ? 'No PRDs match your search' : 'No PRDs found'}
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
) : (
|
||||
<div className="grid gap-4 md:grid-cols-2 lg:grid-cols-3">
|
||||
{filteredPrds.map((prd) => (
|
||||
<Link
|
||||
key={prd.filename}
|
||||
href={`/prds/${prd.filename}`}
|
||||
className="block"
|
||||
>
|
||||
<Card className="cursor-pointer transition-shadow hover:shadow-md">
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="flex items-start gap-2 text-sm">
|
||||
<FileTextIcon className="text-muted-foreground mt-0.5 h-4 w-4" />
|
||||
<span className="line-clamp-2">{prd.title}</span>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent className="space-y-3">
|
||||
{/* Progress */}
|
||||
<div className="space-y-2">
|
||||
<div className="text-muted-foreground flex justify-between text-xs">
|
||||
<span>Progress</span>
|
||||
<span>
|
||||
{prd.completedStories}/{prd.totalStories} stories
|
||||
</span>
|
||||
</div>
|
||||
<Progress value={prd.progress} className="h-2" />
|
||||
<div className="text-right text-xs font-medium">
|
||||
{prd.progress}%
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{/* Metadata */}
|
||||
<div className="text-muted-foreground flex items-center gap-1 text-xs">
|
||||
<CalendarIcon className="h-3 w-3" />
|
||||
<span>Updated {prd.lastUpdated}</span>
|
||||
</div>
|
||||
|
||||
{/* Filename */}
|
||||
<div className="text-muted-foreground text-xs">
|
||||
{prd.filename}
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</Link>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
172
apps/dev-tool/app/prds/_components/user-story-display.tsx
Normal file
172
apps/dev-tool/app/prds/_components/user-story-display.tsx
Normal file
@@ -0,0 +1,172 @@
|
||||
'use client';
|
||||
|
||||
import {
|
||||
CheckCircleIcon,
|
||||
CircleIcon,
|
||||
ClockIcon,
|
||||
EyeIcon,
|
||||
PlayIcon,
|
||||
XCircleIcon,
|
||||
} from 'lucide-react';
|
||||
|
||||
import { Badge } from '@kit/ui/badge';
|
||||
import { Card, CardContent, CardHeader, CardTitle } from '@kit/ui/card';
|
||||
import { Separator } from '@kit/ui/separator';
|
||||
import { cn } from '@kit/ui/utils';
|
||||
|
||||
interface CustomPhase {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
color: string;
|
||||
order: number;
|
||||
userStoryIds: string[];
|
||||
}
|
||||
|
||||
interface UserStory {
|
||||
id: string;
|
||||
title: string;
|
||||
userStory: string;
|
||||
businessValue: string;
|
||||
acceptanceCriteria: string[];
|
||||
priority: 'P0' | 'P1' | 'P2' | 'P3';
|
||||
status:
|
||||
| 'not_started'
|
||||
| 'research'
|
||||
| 'in_progress'
|
||||
| 'review'
|
||||
| 'completed'
|
||||
| 'blocked';
|
||||
notes?: string;
|
||||
estimatedComplexity?: string;
|
||||
dependencies?: string[];
|
||||
completedAt?: string;
|
||||
}
|
||||
|
||||
interface UserStoryDisplayReadOnlyProps {
|
||||
userStories: UserStory[];
|
||||
customPhases?: CustomPhase[];
|
||||
}
|
||||
|
||||
const priorityLabels = {
|
||||
P0: { label: 'Critical', color: 'destructive' as const },
|
||||
P1: { label: 'High', color: 'default' as const },
|
||||
P2: { label: 'Medium', color: 'secondary' as const },
|
||||
P3: { label: 'Low', color: 'outline' as const },
|
||||
};
|
||||
|
||||
const statusIcons = {
|
||||
not_started: CircleIcon,
|
||||
research: EyeIcon,
|
||||
in_progress: PlayIcon,
|
||||
review: ClockIcon,
|
||||
completed: CheckCircleIcon,
|
||||
blocked: XCircleIcon,
|
||||
};
|
||||
|
||||
const statusLabels = {
|
||||
not_started: 'Not Started',
|
||||
research: 'Research',
|
||||
in_progress: 'In Progress',
|
||||
review: 'Review',
|
||||
completed: 'Completed',
|
||||
blocked: 'Blocked',
|
||||
};
|
||||
|
||||
const statusColors = {
|
||||
not_started: 'text-muted-foreground',
|
||||
research: 'text-blue-600',
|
||||
in_progress: 'text-yellow-600',
|
||||
review: 'text-purple-600',
|
||||
completed: 'text-green-600',
|
||||
blocked: 'text-red-600',
|
||||
};
|
||||
|
||||
export function UserStoryDisplay({
|
||||
userStories,
|
||||
}: UserStoryDisplayReadOnlyProps) {
|
||||
const renderUserStory = (story: UserStory) => {
|
||||
return (
|
||||
<Card key={story.id}>
|
||||
<CardHeader className="pb-3">
|
||||
<CardTitle className="flex items-start gap-4 text-sm">
|
||||
<span className="line-clamp-2">
|
||||
{story.id} - {story.title}
|
||||
</span>
|
||||
|
||||
<div className="flex items-center gap-2">
|
||||
<Badge className={statusColors[story.status]} variant={'outline'}>
|
||||
{statusLabels[story.status]}
|
||||
</Badge>
|
||||
</div>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className="space-y-3">
|
||||
<p className="text-muted-foreground line-clamp-2 text-sm">
|
||||
{story.businessValue}
|
||||
</p>
|
||||
|
||||
<div className="flex items-center justify-between text-xs">
|
||||
<span className="text-muted-foreground">
|
||||
{story.acceptanceCriteria.length} criteria
|
||||
</span>
|
||||
</div>
|
||||
|
||||
{/* Acceptance Criteria */}
|
||||
{story.acceptanceCriteria.length > 0 && (
|
||||
<div className="space-y-1">
|
||||
<h5 className="text-xs font-medium">Acceptance Criteria:</h5>
|
||||
<ul className="space-y-1">
|
||||
{story.acceptanceCriteria.map((criterion, index) => (
|
||||
<li key={index} className="flex items-start gap-1 text-xs">
|
||||
<span className="text-muted-foreground">•</span>
|
||||
<span className="text-muted-foreground line-clamp-1">
|
||||
{criterion}
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{/* Header */}
|
||||
<div>
|
||||
<h3 className="text-lg font-semibold">User Stories</h3>
|
||||
|
||||
<p className="text-muted-foreground text-sm">
|
||||
View user stories and track progress
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-col gap-4">
|
||||
{userStories.map(renderUserStory)}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<Separator />
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{userStories.length === 0 && (
|
||||
<Card>
|
||||
<CardContent className="flex h-32 items-center justify-center">
|
||||
<div className="text-center">
|
||||
<CircleIcon className="text-muted-foreground mx-auto h-8 w-8" />
|
||||
<p className="text-muted-foreground mt-2">
|
||||
No user stories yet
|
||||
</p>
|
||||
</div>
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
35
apps/dev-tool/app/prds/_lib/schemas/create-prd.schema.ts
Normal file
35
apps/dev-tool/app/prds/_lib/schemas/create-prd.schema.ts
Normal file
@@ -0,0 +1,35 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const CreatePRDSchema = z.object({
|
||||
title: z
|
||||
.string()
|
||||
.min(1, 'Title is required')
|
||||
.max(200, 'Title must be less than 200 characters'),
|
||||
overview: z
|
||||
.string()
|
||||
.min(1, 'Overview is required')
|
||||
.max(1000, 'Overview must be less than 1000 characters'),
|
||||
problemStatement: z
|
||||
.string()
|
||||
.min(1, 'Problem statement is required')
|
||||
.max(1000, 'Problem statement must be less than 1000 characters'),
|
||||
marketOpportunity: z
|
||||
.string()
|
||||
.min(1, 'Market opportunity is required')
|
||||
.max(1000, 'Market opportunity must be less than 1000 characters'),
|
||||
targetUsers: z
|
||||
.array(z.string().min(1, 'Target user cannot be empty'))
|
||||
.min(1, 'At least one target user is required'),
|
||||
solutionDescription: z
|
||||
.string()
|
||||
.min(1, 'Solution description is required')
|
||||
.max(1000, 'Solution description must be less than 1000 characters'),
|
||||
keyFeatures: z
|
||||
.array(z.string().min(1, 'Feature cannot be empty'))
|
||||
.min(1, 'At least one key feature is required'),
|
||||
successMetrics: z
|
||||
.array(z.string().min(1, 'Metric cannot be empty'))
|
||||
.min(1, 'At least one success metric is required'),
|
||||
});
|
||||
|
||||
export type CreatePRDData = z.infer<typeof CreatePRDSchema>;
|
||||
48
apps/dev-tool/app/prds/_lib/server/prd-loader.ts
Normal file
48
apps/dev-tool/app/prds/_lib/server/prd-loader.ts
Normal file
@@ -0,0 +1,48 @@
|
||||
import { relative } from 'node:path';
|
||||
|
||||
import { PRDManager } from '@kit/mcp-server/prd-manager';
|
||||
|
||||
interface PRDSummary {
|
||||
filename: string;
|
||||
title: string;
|
||||
lastUpdated: string;
|
||||
progress: number;
|
||||
totalStories: number;
|
||||
completedStories: number;
|
||||
}
|
||||
|
||||
export async function loadPRDs(): Promise<PRDSummary[]> {
|
||||
try {
|
||||
PRDManager.setRootPath(relative(process.cwd(), '../..'));
|
||||
|
||||
// Use the actual PRDManager to list PRDs
|
||||
const prdFiles = await PRDManager.listPRDs();
|
||||
|
||||
const prdSummaries: PRDSummary[] = [];
|
||||
|
||||
// Load each PRD to get its details
|
||||
for (const filename of prdFiles) {
|
||||
try {
|
||||
const content = await PRDManager.getPRDContent(filename);
|
||||
const prd = JSON.parse(content);
|
||||
|
||||
prdSummaries.push({
|
||||
filename,
|
||||
title: prd.introduction.title,
|
||||
lastUpdated: prd.metadata.lastUpdated,
|
||||
progress: prd.progress.overall,
|
||||
totalStories: prd.progress.total,
|
||||
completedStories: prd.progress.completed,
|
||||
});
|
||||
} catch (prdError) {
|
||||
console.error(`Failed to load PRD ${filename}:`, prdError);
|
||||
// Continue with other PRDs even if one fails
|
||||
}
|
||||
}
|
||||
|
||||
return prdSummaries;
|
||||
} catch (error) {
|
||||
console.error('Failed to load PRDs:', error);
|
||||
return [];
|
||||
}
|
||||
}
|
||||
78
apps/dev-tool/app/prds/_lib/server/prd-page.loader.ts
Normal file
78
apps/dev-tool/app/prds/_lib/server/prd-page.loader.ts
Normal file
@@ -0,0 +1,78 @@
|
||||
import 'server-only';
|
||||
|
||||
import { relative } from 'node:path';
|
||||
|
||||
import { PRDManager } from '@kit/mcp-server/prd-manager';
|
||||
|
||||
export interface CustomPhase {
|
||||
id: string;
|
||||
name: string;
|
||||
description: string;
|
||||
color: string;
|
||||
order: number;
|
||||
userStoryIds: string[];
|
||||
}
|
||||
|
||||
export interface PRDData {
|
||||
introduction: {
|
||||
title: string;
|
||||
overview: string;
|
||||
lastUpdated: string;
|
||||
};
|
||||
problemStatement: {
|
||||
problem: string;
|
||||
marketOpportunity: string;
|
||||
targetUsers: string[];
|
||||
};
|
||||
solutionOverview: {
|
||||
description: string;
|
||||
keyFeatures: string[];
|
||||
successMetrics: string[];
|
||||
};
|
||||
userStories: Array<{
|
||||
id: string;
|
||||
title: string;
|
||||
userStory: string;
|
||||
businessValue: string;
|
||||
acceptanceCriteria: string[];
|
||||
priority: 'P0' | 'P1' | 'P2' | 'P3';
|
||||
status:
|
||||
| 'not_started'
|
||||
| 'research'
|
||||
| 'in_progress'
|
||||
| 'review'
|
||||
| 'completed'
|
||||
| 'blocked';
|
||||
notes?: string;
|
||||
estimatedComplexity?: string;
|
||||
dependencies?: string[];
|
||||
completedAt?: string;
|
||||
}>;
|
||||
customPhases?: CustomPhase[];
|
||||
metadata: {
|
||||
version: string;
|
||||
created: string;
|
||||
lastUpdated: string;
|
||||
approver: string;
|
||||
};
|
||||
progress: {
|
||||
overall: number;
|
||||
completed: number;
|
||||
total: number;
|
||||
blocked: number;
|
||||
};
|
||||
}
|
||||
|
||||
export async function loadPRDPageData(filename: string): Promise<PRDData> {
|
||||
try {
|
||||
PRDManager.setRootPath(relative(process.cwd(), '../..'));
|
||||
|
||||
const content = await PRDManager.getPRDContent(filename);
|
||||
|
||||
return JSON.parse(content) as PRDData;
|
||||
} catch (error) {
|
||||
console.error(`Failed to load PRD ${filename}:`, error);
|
||||
|
||||
throw new Error(`PRD not found: ${filename}`);
|
||||
}
|
||||
}
|
||||
16
apps/dev-tool/app/prds/page.tsx
Normal file
16
apps/dev-tool/app/prds/page.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import { Metadata } from 'next';
|
||||
|
||||
import { PRDsListInterface } from './_components/prds-list-interface';
|
||||
import { loadPRDs } from './_lib/server/prd-loader';
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: 'PRDs - MCP Server',
|
||||
description: 'Browse and view all Product Requirements Documents',
|
||||
};
|
||||
|
||||
export default async function PRDsPage() {
|
||||
// Load PRDs on the server side
|
||||
const initialPrds = await loadPRDs();
|
||||
|
||||
return <PRDsListInterface initialPrds={initialPrds} />;
|
||||
}
|
||||
Reference in New Issue
Block a user