Centralize viewer URL construction and E2E_REPOS#
Problem#
E2E_REPOS, VIEWER_BASE, and the viewerUrl() function were duplicated in three page components, making them a silent drift risk with agent-core's canonical E2E_SOURCE_REPOS list.
Task / Link#
Closes #41
Changes#
- Added
lib/viewer.tswith sharedE2E_REPOS,VIEWER_BASE,getArtefactsSubdir(), andgetViewerUrl()helpers; doc comment referencesagent-coreas source of truth - Added
lib/viewer.test.tswith 6 unit tests covering e2e/production subdir selection and full URL shape - Added
vitestas dev dependency with atestscript - Refactored
app/pipeline/page.tsx,app/pipeline/[taskId]/page.tsx, andapp/agents/page.tsxto importgetViewerUrlfromlib/viewer(removed all local duplicates)
Notes#
E2E_REPOS is still a manual mirror of agent-core's E2E_SOURCE_REPOS. The source-of-truth comment and unit tests make drift detectable at review/CI time.
Testing#
npm test— 6/6 vitest unit tests passnpm run lint— no ESLint warnings or errorsnpm run build— compiles successfully