"use client"; import { useState } from "react"; import { Link, useParams } from "react-router-dom"; import { Card, CardContent } from "@/components/ui/card"; import { Badge } from "@/components/ui/badge"; import { Search, ShieldAlert, Code2, Palette, Workflow, CheckCircle2, AlertTriangle, } from "lucide-react"; import { Input } from "@/components/ui/input"; import { cn } from "@/shared/lib/utils"; import { useProject } from "@/shared/contexts/ProjectContext"; import { PageHeader } from "@/components/ui/PageHeader"; const MemoryRules = () => { const { projectId } = useParams(); const { projects, contextPacks } = useProject(); const project = projects.find(p => p.id === projectId); const rules = project?.memoryRules ?? []; const [search, setSearch] = useState(""); const visibleRules = rules.filter((rule) => `${rule.title} ${rule.description} ${rule.category}`.toLowerCase().includes(search.trim().toLowerCase())); const activePack = project?.activeContextPackId ? contextPacks.find((pack) => pack.id === project.activeContextPackId) : undefined; return (
{rule.description}
Severity: {rule.severity ?? rule.priority} • {rule.linkedFeatureIds?.length ? "linked features" : "no linked features"}
Include in active context pack:{" "} {(rule.includeInContextPacks ?? []).includes(activePack?.id ?? "") ? "yes" : "no"} {activePack ? ( open context packs ) : null}
{rules.length ? "Try a broader search." : "Create rules through the database-backed Memory API or Review Queue conversion flow."}