Files
Claude-Code-Workflow/ccw/frontend/src/router.tsx
catlog22 964292ebdb feat: Add comprehensive tests for contentPattern and glob pattern matching
- Implemented final verification tests for contentPattern to validate behavior with empty strings, dangerous patterns, and normal patterns.
- Created glob pattern matching tests to verify regex conversion and matching functionality.
- Developed infinite loop risk tests using Worker threads to isolate potential blocking operations.
- Introduced optimized contentPattern tests to validate improvements in the findMatches function.
- Added verification tests to assess the effectiveness of contentPattern optimizations.
- Conducted safety tests for contentPattern to identify edge cases and potential vulnerabilities.
- Implemented unrestricted loop tests to analyze infinite loop risks without match limits.
- Developed tests for zero-width pattern detection logic to ensure proper handling of dangerous regex patterns.
2026-02-09 11:13:01 +08:00

233 lines
5.2 KiB
TypeScript

// ========================================
// Router Configuration
// ========================================
// React Router v6 configuration with all dashboard routes
import { createBrowserRouter, RouteObject, Navigate } from 'react-router-dom';
import { AppShell } from '@/components/layout';
import {
HomePage,
SessionsPage,
FixSessionPage,
ProjectOverviewPage,
SessionDetailPage,
HistoryPage,
OrchestratorPage,
LoopMonitorPage,
IssueHubPage,
IssueManagerPage,
QueuePage,
DiscoveryPage,
SkillsManagerPage,
CommandsManagerPage,
MemoryPage,
SettingsPage,
HelpPage,
NotFoundPage,
LiteTasksPage,
// LiteTaskDetailPage removed - now using TaskDrawer instead
ReviewSessionPage,
McpManagerPage,
EndpointsPage,
InstallationsPage,
HookManagerPage,
RulesManagerPage,
PromptHistoryPage,
ExplorerPage,
GraphExplorerPage,
CodexLensManagerPage,
ApiSettingsPage,
CliViewerPage,
TeamPage,
} from '@/pages';
/**
* Route configuration for the dashboard
* All routes are wrapped in AppShell layout
*/
const routes: RouteObject[] = [
{
path: '/',
element: <AppShell />,
children: [
{
index: true,
element: <HomePage />,
},
{
path: 'sessions',
element: <SessionsPage />,
},
{
path: 'sessions/:sessionId',
element: <SessionDetailPage />,
},
{
path: 'sessions/:sessionId/fix',
element: <FixSessionPage />,
},
{
path: 'sessions/:sessionId/review',
element: <ReviewSessionPage />,
},
{
path: 'lite-tasks',
element: <LiteTasksPage />,
},
// /lite-tasks/:sessionId route removed - now using TaskDrawer
{
path: 'project',
element: <ProjectOverviewPage />,
},
{
path: 'history',
element: <HistoryPage />,
},
{
path: 'orchestrator',
element: <OrchestratorPage />,
},
{
path: 'loops',
element: <LoopMonitorPage />,
},
{
path: 'cli-viewer',
element: <CliViewerPage />,
},
{
path: 'issues',
element: <IssueHubPage />,
},
// Legacy routes - redirect to hub with tab parameter
{
path: 'issues/queue',
element: <Navigate to="/issues?tab=queue" replace />,
},
{
path: 'issues/discovery',
element: <Navigate to="/issues?tab=discovery" replace />,
},
{
path: 'skills',
element: <SkillsManagerPage />,
},
{
path: 'commands',
element: <CommandsManagerPage />,
},
{
path: 'memory',
element: <MemoryPage />,
},
{
path: 'prompts',
element: <PromptHistoryPage />,
},
{
path: 'settings',
element: <SettingsPage />,
},
{
path: 'settings/mcp',
element: <McpManagerPage />,
},
{
path: 'settings/endpoints',
element: <EndpointsPage />,
},
{
path: 'settings/installations',
element: <InstallationsPage />,
},
{
path: 'settings/rules',
element: <RulesManagerPage />,
},
{
path: 'settings/codexlens',
element: <CodexLensManagerPage />,
},
{
path: 'api-settings',
element: <ApiSettingsPage />,
},
{
path: 'help',
element: <HelpPage />,
},
{
path: 'hooks',
element: <HookManagerPage />,
},
{
path: 'explorer',
element: <ExplorerPage />,
},
{
path: 'graph',
element: <GraphExplorerPage />,
},
{
path: 'teams',
element: <TeamPage />,
},
// Catch-all route for 404
{
path: '*',
element: <NotFoundPage />,
},
],
},
];
/**
* Create the browser router instance
* Uses basename from Vite's BASE_URL environment variable
*/
const basename = import.meta.env.BASE_URL?.replace(/\/$/, '') || '';
export const router = createBrowserRouter(routes, {
basename,
});
/**
* Export route paths for type-safe navigation
*/
export const ROUTES = {
HOME: '/',
SESSIONS: '/sessions',
SESSION_DETAIL: '/sessions/:sessionId',
FIX_SESSION: '/sessions/:sessionId/fix',
REVIEW_SESSION: '/sessions/:sessionId/review',
LITE_TASKS: '/lite-tasks',
// LITE_TASK_DETAIL removed - now using TaskDrawer
PROJECT: '/project',
HISTORY: '/history',
ORCHESTRATOR: '/orchestrator',
LOOPS: '/loops',
CLI_VIEWER: '/cli-viewer',
ISSUES: '/issues',
// Legacy issue routes - use ISSUES with ?tab parameter instead
ISSUE_QUEUE: '/issues?tab=queue',
ISSUE_DISCOVERY: '/issues?tab=discovery',
SKILLS: '/skills',
COMMANDS: '/commands',
MEMORY: '/memory',
PROMPT_HISTORY: '/prompts',
SETTINGS: '/settings',
HOOKS_MANAGER: '/hooks',
MCP_MANAGER: '/settings/mcp',
ENDPOINTS: '/settings/endpoints',
INSTALLATIONS: '/settings/installations',
SETTINGS_RULES: '/settings/rules',
CODEXLENS_MANAGER: '/settings/codexlens',
API_SETTINGS: '/api-settings',
HELP: '/help',
EXPLORER: '/explorer',
GRAPH: '/graph',
TEAMS: '/teams',
} as const;
export type RoutePath = (typeof ROUTES)[keyof typeof ROUTES];