{
"meta": {
"agent": "planner",
"task_id": "41",
"title": "Centralize viewer URL construction and E2E_REPOS",
"created_at": "2026-04-01T12:00:00Z"
},
"inputs": [
{
"name": "issue-41",
"type": "context",
"ref": "https://github.com/AgentSDE/agent-core-control-center/issues/41",
"notes": "Centralize E2E_REPOS + viewer link logic"
},
{
"name": "agent-core-source-of-truth",
"type": "file",
"ref": "agent-core/src/artefacts/artefacts.service.ts:58-65",
"notes": "getArtefactsSubdir() with E2E_SOURCE_REPOS = ['agent-core-e2e']"
}
],
"outputs": [
{
"name": "plan",
"type": "plan",
"format": "md",
"content": "plan.md"
}
],
"files": [
{
"path": "lib/viewer.ts",
"action": "create",
"reason": "Shared helper for E2E_REPOS, VIEWER_BASE, getArtefactsSubdir, getViewerUrl"
},
{
"path": "lib/viewer.test.ts",
"action": "create",
"reason": "Unit tests for subdir selection logic"
},
{
"path": "app/pipeline/page.tsx",
"action": "modify",
"reason": "Remove duplicated viewerUrl/E2E_REPOS, import from lib/viewer"
},
{
"path": "app/pipeline/[taskId]/page.tsx",
"action": "modify",
"reason": "Remove duplicated viewerUrl/E2E_REPOS, import from lib/viewer"
},
{
"path": "app/agents/page.tsx",
"action": "modify",
"reason": "Remove duplicated viewerUrl/E2E_REPOS, import from lib/viewer"
},
{
"path": "package.json",
"action": "modify",
"reason": "Add vitest dev dependency and test script"
}
],
"steps": [
{
"id": "S1",
"summary": "Add vitest test framework and configure path alias",
"acceptance": [
"vitest is in devDependencies",
"npm test runs vitest",
"@ path alias resolves correctly in tests"
],
"depends_on": []
},
{
"id": "S2",
"summary": "Create lib/viewer.ts with centralized E2E_REPOS, getArtefactsSubdir, and getViewerUrl",
"acceptance": [
"E2E_REPOS defined once in lib/viewer.ts",
"getArtefactsSubdir returns tasks/e2e for e2e repos, tasks/production otherwise",
"getViewerUrl composes full viewer URL",
"Source-of-truth comment references agent-core ArtefactsService.getArtefactsSubdir"
],
"depends_on": []
},
{
"id": "S3",
"summary": "Add unit tests for viewer helper in lib/viewer.test.ts",
"acceptance": [
"Test asserts tasks/e2e for agent-core-e2e",
"Test asserts tasks/production for a production repo",
"Test handles owner/repo format",
"npm test passes"
],
"depends_on": [
"S1",
"S2"
]
},
{
"id": "S4",
"summary": "Refactor all three page components to use shared viewer helper",
"acceptance": [
"No local E2E_REPOS or viewerUrl definitions remain in page components",
"All viewer links use getViewerUrl from lib/viewer",
"npm run lint passes",
"npm run build passes"
],
"depends_on": [
"S2"
]
}
],
"risks": [
{
"risk": "No test framework exists yet",
"mitigation": "Add vitest with minimal config as first step"
},
{
"risk": "E2E_REPOS can drift from agent-core",
"mitigation": "Source-of-truth comment + unit tests make drift detectable"
}
],
"assumptions": [
"vitest is acceptable as the test framework (lightest option for Next.js)",
"E2E_REPOS currently only contains 'agent-core-e2e', matching agent-core"
],
"open_questions": []
}