@dendelion/paper-camp 0.15.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/app/assets/{index-DKjtMMrA.js → index-0BzPyUVh.js} +2 -2
  2. package/dist/app/assets/{index-DKjtMMrA.js.map → index-0BzPyUVh.js.map} +1 -1
  3. package/dist/app/assets/{index-BSp1FE97.js → index-BiDION9V.js} +2 -2
  4. package/dist/app/assets/{index-BSp1FE97.js.map → index-BiDION9V.js.map} +1 -1
  5. package/dist/app/assets/{index-Bo0V9-3F.js → index-Bz4Df_iX.js} +2 -2
  6. package/dist/app/assets/{index-Bo0V9-3F.js.map → index-Bz4Df_iX.js.map} +1 -1
  7. package/dist/app/assets/{index-Bi4fur5H.js → index-C6vBW0wx.js} +2 -2
  8. package/dist/app/assets/{index-Bi4fur5H.js.map → index-C6vBW0wx.js.map} +1 -1
  9. package/dist/app/assets/{index-BTyua-6D.js → index-CGtPCj1V.js} +2 -2
  10. package/dist/app/assets/{index-BTyua-6D.js.map → index-CGtPCj1V.js.map} +1 -1
  11. package/dist/app/assets/{index-2ahHj0hk.js → index-Cm3hzD0z.js} +2 -2
  12. package/dist/app/assets/{index-2ahHj0hk.js.map → index-Cm3hzD0z.js.map} +1 -1
  13. package/dist/app/assets/{index-Cz9HEIaO.js → index-Dtdlcmro.js} +2 -2
  14. package/dist/app/assets/{index-Cz9HEIaO.js.map → index-Dtdlcmro.js.map} +1 -1
  15. package/dist/app/assets/main-Ba3mXsWY.js +207 -0
  16. package/dist/app/assets/main-Ba3mXsWY.js.map +1 -0
  17. package/dist/app/assets/main-CIoBIAYG.css +1 -0
  18. package/dist/app/assets/{sidebar-section-BHLbvk_X.js → sidebar-section-B3aJWLXB.js} +2 -2
  19. package/dist/app/assets/{sidebar-section-BHLbvk_X.js.map → sidebar-section-B3aJWLXB.js.map} +1 -1
  20. package/dist/app/index.html +2 -2
  21. package/dist/app/toolbar.js +5486 -5348
  22. package/dist/app/toolbar.js.map +1 -1
  23. package/dist/chunks/{parked-questions.BoAnCnQA.js → parked-questions.DZYZgrSZ.js} +1119 -1096
  24. package/dist/chunks/parked-questions.DZYZgrSZ.js.map +1 -0
  25. package/dist/cli/index.js +851 -838
  26. package/dist/cli/index.js.map +1 -1
  27. package/dist/core/git-log.d.ts +6 -0
  28. package/dist/core/git-log.d.ts.map +1 -0
  29. package/dist/core/git-log.test.d.ts +2 -0
  30. package/dist/core/git-log.test.d.ts.map +1 -0
  31. package/dist/core/git-pr/branch.d.ts.map +1 -1
  32. package/dist/core/index.js +79 -78
  33. package/dist/core/parse/parser.d.ts +1 -0
  34. package/dist/core/parse/parser.d.ts.map +1 -1
  35. package/dist/core/readers.d.ts +1 -1
  36. package/dist/core/readers.d.ts.map +1 -1
  37. package/dist/core/status/status.d.ts +1 -1
  38. package/dist/core/status/status.d.ts.map +1 -1
  39. package/dist/core/trail.d.ts +2 -2
  40. package/dist/core/trail.d.ts.map +1 -1
  41. package/dist/types/index.d.ts +2 -2
  42. package/dist/types/index.d.ts.map +1 -1
  43. package/dist/types/index.js +8 -8
  44. package/dist/types/index.js.map +1 -1
  45. package/dist/vite/index.d.ts +1 -1
  46. package/dist/vite/index.d.ts.map +1 -1
  47. package/dist/vite/index.js +49 -30
  48. package/dist/vite/index.js.map +1 -1
  49. package/dist/vite/proxy.d.ts +3 -1
  50. package/dist/vite/proxy.d.ts.map +1 -1
  51. package/package.json +2 -2
  52. package/dist/app/assets/main-BW24wv9K.js +0 -207
  53. package/dist/app/assets/main-BW24wv9K.js.map +0 -1
  54. package/dist/app/assets/main-C-ynmROL.css +0 -1
  55. package/dist/chunks/parked-questions.BoAnCnQA.js.map +0 -1
@@ -1,2 +1,2 @@
1
- import{r as o,j as e,P as x,R as c,T as d,N as m,w as j}from"./main-BW24wv9K.js";import{c as i}from"./tokens-C3C44lLs.js";const p=async()=>{const s=await fetch("/api/stats");if(!s.ok)throw new Error(`Failed to fetch stats: ${s.status}`);return s.json()},h=["open",...d],u={...m,open:"Open"},f=s=>`${Math.round(s*100)}%`,n=({title:s,children:t})=>e.jsx("div",{className:"flex-[1_1_260px] max-w-[360px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(j,{size:"small",texture:"kraft",className:"h-full",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:s}),t]})})}),a=({label:s,value:t})=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"opacity-70",children:s}),e.jsx("span",{className:"font-semibold",children:t})]}),v=({comments:s})=>e.jsxs(n,{title:"Comment ratio",children:[e.jsx(c,{value:s.ratio*100,color:i.accentSlate}),e.jsx(a,{label:"Ratio",value:f(s.ratio)}),e.jsx(a,{label:"Comment lines",value:s.commentLines}),e.jsx(a,{label:"Source lines",value:s.sourceLines})]}),N=({testCoveragePct:s})=>e.jsx(n,{title:"Test coverage",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"Run `pnpm test` to generate a coverage report."}):e.jsxs(e.Fragment,{children:[e.jsx(c,{value:s,color:i.accentGreen}),e.jsx(a,{label:"Line coverage",value:`${Math.round(s)}%`})]})}),S=({sourceLines:s,testLines:t})=>e.jsxs(n,{title:"Codebase size",children:[e.jsx(a,{label:"Source lines",value:s}),e.jsx(a,{label:"Test lines",value:t})]}),g=({entitiesByStatus:s})=>e.jsxs(n,{title:"Entities by status",children:[h.filter(t=>s[t]).map(t=>e.jsx(a,{label:u[t],value:s[t]},t)),Object.keys(s).length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No entities yet."})]}),b=({openQuestions:s,decisions:t})=>e.jsxs(n,{title:"Notes",children:[e.jsx(a,{label:"Open questions",value:s}),e.jsx(a,{label:"Decisions",value:t})]}),y=({tasksPerWeek:s})=>{const t=Math.max(1,...s.map(l=>l.count));return e.jsxs(n,{title:"Tasks per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No tasks run yet."}),s.map(l=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(a,{label:l.week,value:l.count}),e.jsx(c,{value:l.count,max:t,color:i.accentAmber,height:4})]},l.week))]})},C=()=>{const[s,t]=o.useState(null),[l,r]=o.useState(!1);return o.useEffect(()=>{p().then(t).catch(()=>r(!0))},[]),e.jsxs("div",{children:[e.jsx(x,{children:"Stats"}),e.jsx("p",{className:"opacity-50 mb-6",children:"A read-only look at project health — every number here is informational, none of them gate anything."}),l&&e.jsx("p",{className:"opacity-50",children:"Couldn't load stats."}),!l&&!s&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5",children:[e.jsx(v,{comments:s.comments}),e.jsx(N,{testCoveragePct:s.testCoveragePct}),e.jsx(S,{sourceLines:s.comments.sourceLines,testLines:s.testLines}),e.jsx(g,{entitiesByStatus:s.entitiesByStatus}),e.jsx(b,{openQuestions:s.openQuestions,decisions:s.decisions}),e.jsx(y,{tasksPerWeek:s.tasksPerWeek})]}),e.jsxs("p",{className:"opacity-[0.4] text-2xs mt-6",children:["Generated ",new Date(s.generatedAt).toLocaleString()]})]})]})};export{C as StatsPage};
2
- //# sourceMappingURL=index-DKjtMMrA.js.map
1
+ import{r as o,j as e,P as x,R as c,T as d,N as m,w as j}from"./main-Ba3mXsWY.js";import{c as i}from"./tokens-C3C44lLs.js";const p=async()=>{const s=await fetch("/api/stats");if(!s.ok)throw new Error(`Failed to fetch stats: ${s.status}`);return s.json()},h=["open",...d],u={...m,open:"Open"},f=s=>`${Math.round(s*100)}%`,n=({title:s,children:t})=>e.jsx("div",{className:"flex-[1_1_260px] max-w-[360px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(j,{size:"small",texture:"kraft",className:"h-full",children:e.jsxs("div",{className:"flex flex-col gap-3",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:s}),t]})})}),a=({label:s,value:t})=>e.jsxs("div",{className:"flex items-center justify-between gap-2",children:[e.jsx("span",{className:"opacity-70",children:s}),e.jsx("span",{className:"font-semibold",children:t})]}),v=({comments:s})=>e.jsxs(n,{title:"Comment ratio",children:[e.jsx(c,{value:s.ratio*100,color:i.accentSlate}),e.jsx(a,{label:"Ratio",value:f(s.ratio)}),e.jsx(a,{label:"Comment lines",value:s.commentLines}),e.jsx(a,{label:"Source lines",value:s.sourceLines})]}),N=({testCoveragePct:s})=>e.jsx(n,{title:"Test coverage",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"Run `pnpm test` to generate a coverage report."}):e.jsxs(e.Fragment,{children:[e.jsx(c,{value:s,color:i.accentGreen}),e.jsx(a,{label:"Line coverage",value:`${Math.round(s)}%`})]})}),S=({sourceLines:s,testLines:t})=>e.jsxs(n,{title:"Codebase size",children:[e.jsx(a,{label:"Source lines",value:s}),e.jsx(a,{label:"Test lines",value:t})]}),g=({entitiesByStatus:s})=>e.jsxs(n,{title:"Entities by status",children:[h.filter(t=>s[t]).map(t=>e.jsx(a,{label:u[t],value:s[t]},t)),Object.keys(s).length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No entities yet."})]}),b=({openQuestions:s,decisions:t})=>e.jsxs(n,{title:"Notes",children:[e.jsx(a,{label:"Open questions",value:s}),e.jsx(a,{label:"Decisions",value:t})]}),y=({tasksPerWeek:s})=>{const t=Math.max(1,...s.map(l=>l.count));return e.jsxs(n,{title:"Tasks per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No tasks run yet."}),s.map(l=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(a,{label:l.week,value:l.count}),e.jsx(c,{value:l.count,max:t,color:i.accentAmber,height:4})]},l.week))]})},C=()=>{const[s,t]=o.useState(null),[l,r]=o.useState(!1);return o.useEffect(()=>{p().then(t).catch(()=>r(!0))},[]),e.jsxs("div",{children:[e.jsx(x,{children:"Stats"}),e.jsx("p",{className:"opacity-50 mb-6",children:"A read-only look at project health — every number here is informational, none of them gate anything."}),l&&e.jsx("p",{className:"opacity-50",children:"Couldn't load stats."}),!l&&!s&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),s&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5",children:[e.jsx(v,{comments:s.comments}),e.jsx(N,{testCoveragePct:s.testCoveragePct}),e.jsx(S,{sourceLines:s.comments.sourceLines,testLines:s.testLines}),e.jsx(g,{entitiesByStatus:s.entitiesByStatus}),e.jsx(b,{openQuestions:s.openQuestions,decisions:s.decisions}),e.jsx(y,{tasksPerWeek:s.tasksPerWeek})]}),e.jsxs("p",{className:"opacity-[0.4] text-2xs mt-6",children:["Generated ",new Date(s.generatedAt).toLocaleString()]})]})]})};export{C as StatsPage};
2
+ //# sourceMappingURL=index-0BzPyUVh.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-DKjtMMrA.js","sources":["../../../src/app/services/content/stats-api.ts","../../../src/app/features/stats/stats-page.tsx"],"sourcesContent":["import type { ProjectStats } from '@/types/index';\n\nexport const fetchStats = async () => {\n const res = await fetch('/api/stats');\n if (!res.ok) throw new Error(`Failed to fetch stats: ${res.status}`);\n return res.json() as Promise<ProjectStats>;\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { STATUS_LABEL } from '@/app/features/plans/constants';\nimport { fetchStats } from '@/app/services/content';\nimport { color } from '@/app/styles/tokens';\nimport { type EntityStatus, PLAN_STATUSES, type ProjectStats } from '@/types/index';\nimport { Card, Progress } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nconst ENTITY_STATUS_ORDER: EntityStatus[] = ['open', ...PLAN_STATUSES];\n\nconst ENTITY_STATUS_LABEL: Record<EntityStatus, string> = { ...STATUS_LABEL, open: 'Open' };\n\nconst pct = (value: number) => `${Math.round(value * 100)}%`;\n\nconst StatCard = ({ title, children }: { title: string; children: React.ReactNode }) => (\n <div className=\"flex-[1_1_260px] max-w-[360px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\">\n <Card size=\"small\" texture=\"kraft\" className=\"h-full\">\n <div className=\"flex flex-col gap-3\">\n <span className=\"font-handwritten text-xs font-semibold opacity-[0.55]\">{title}</span>\n {children}\n </div>\n </Card>\n </div>\n);\n\nconst StatRow = ({ label, value }: { label: string; value: React.ReactNode }) => (\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"opacity-70\">{label}</span>\n <span className=\"font-semibold\">{value}</span>\n </div>\n);\n\nconst CommentRatioCard = ({ comments }: { comments: ProjectStats['comments'] }) => (\n <StatCard title=\"Comment ratio\">\n <Progress value={comments.ratio * 100} color={color.accentSlate} />\n <StatRow label=\"Ratio\" value={pct(comments.ratio)} />\n <StatRow label=\"Comment lines\" value={comments.commentLines} />\n <StatRow label=\"Source lines\" value={comments.sourceLines} />\n </StatCard>\n);\n\nconst TestCoverageCard = ({ testCoveragePct }: { testCoveragePct: number | null }) => (\n <StatCard title=\"Test coverage\">\n {testCoveragePct === null ? (\n <p className=\"opacity-50 m-0\">Run `pnpm test` to generate a coverage report.</p>\n ) : (\n <>\n <Progress value={testCoveragePct} color={color.accentGreen} />\n <StatRow label=\"Line coverage\" value={`${Math.round(testCoveragePct)}%`} />\n </>\n )}\n </StatCard>\n);\n\nconst CodebaseSizeCard = ({\n sourceLines,\n testLines,\n}: { sourceLines: number; testLines: number }) => (\n <StatCard title=\"Codebase size\">\n <StatRow label=\"Source lines\" value={sourceLines} />\n <StatRow label=\"Test lines\" value={testLines} />\n </StatCard>\n);\n\nconst EntitiesByStatusCard = ({\n entitiesByStatus,\n}: { entitiesByStatus: ProjectStats['entitiesByStatus'] }) => (\n <StatCard title=\"Entities by status\">\n {ENTITY_STATUS_ORDER.filter((status) => entitiesByStatus[status]).map((status) => (\n <StatRow key={status} label={ENTITY_STATUS_LABEL[status]} value={entitiesByStatus[status]} />\n ))}\n {Object.keys(entitiesByStatus).length === 0 && (\n <p className=\"opacity-50 m-0\">No entities yet.</p>\n )}\n </StatCard>\n);\n\nconst NotesCard = ({ openQuestions, decisions }: { openQuestions: number; decisions: number }) => (\n <StatCard title=\"Notes\">\n <StatRow label=\"Open questions\" value={openQuestions} />\n <StatRow label=\"Decisions\" value={decisions} />\n </StatCard>\n);\n\nconst TasksPerWeekCard = ({ tasksPerWeek }: { tasksPerWeek: ProjectStats['tasksPerWeek'] }) => {\n const max = Math.max(1, ...tasksPerWeek.map((w) => w.count));\n return (\n <StatCard title=\"Tasks per week\">\n {tasksPerWeek.length === 0 && <p className=\"opacity-50 m-0\">No tasks run yet.</p>}\n {tasksPerWeek.map((week) => (\n <div key={week.week} className=\"flex flex-col gap-1\">\n <StatRow label={week.week} value={week.count} />\n <Progress value={week.count} max={max} color={color.accentAmber} height={4} />\n </div>\n ))}\n </StatCard>\n );\n};\n\nexport const StatsPage = () => {\n const [stats, setStats] = useState<ProjectStats | null>(null);\n const [loadFailed, setLoadFailed] = useState(false);\n\n useEffect(() => {\n fetchStats()\n .then(setStats)\n .catch(() => setLoadFailed(true));\n }, []);\n\n return (\n <div>\n <PageTitle>Stats</PageTitle>\n <p className=\"opacity-50 mb-6\">\n A read-only look at project health — every number here is informational, none of them gate\n anything.\n </p>\n {loadFailed && <p className=\"opacity-50\">Couldn't load stats.</p>}\n {!loadFailed && !stats && <p className=\"opacity-50\">Loading…</p>}\n {stats && (\n <>\n <div className=\"flex flex-wrap items-start gap-2.5\">\n <CommentRatioCard comments={stats.comments} />\n <TestCoverageCard testCoveragePct={stats.testCoveragePct} />\n <CodebaseSizeCard\n sourceLines={stats.comments.sourceLines}\n testLines={stats.testLines}\n />\n <EntitiesByStatusCard entitiesByStatus={stats.entitiesByStatus} />\n <NotesCard openQuestions={stats.openQuestions} decisions={stats.decisions} />\n <TasksPerWeekCard tasksPerWeek={stats.tasksPerWeek} />\n </div>\n <p className=\"opacity-[0.4] text-2xs mt-6\">\n Generated {new Date(stats.generatedAt).toLocaleString()}\n </p>\n </>\n )}\n </div>\n );\n};\n"],"names":["fetchStats","res","ENTITY_STATUS_ORDER","PLAN_STATUSES","ENTITY_STATUS_LABEL","STATUS_LABEL","pct","value","StatCard","title","children","jsx","Card","jsxs","StatRow","label","CommentRatioCard","comments","Progress","color","TestCoverageCard","testCoveragePct","Fragment","CodebaseSizeCard","sourceLines","testLines","EntitiesByStatusCard","entitiesByStatus","status","NotesCard","openQuestions","decisions","TasksPerWeekCard","tasksPerWeek","max","w","week","StatsPage","stats","setStats","useState","loadFailed","setLoadFailed","useEffect","PageTitle"],"mappings":"0HAEO,MAAMA,EAAa,SAAY,CACpC,MAAMC,EAAM,MAAM,MAAM,YAAY,EACpC,GAAI,CAACA,EAAI,GAAI,MAAM,IAAI,MAAM,0BAA0BA,EAAI,MAAM,EAAE,EACnE,OAAOA,EAAI,KAAA,CACb,ECEMC,EAAsC,CAAC,OAAQ,GAAGC,CAAa,EAE/DC,EAAoD,CAAE,GAAGC,EAAc,KAAM,MAAA,EAE7EC,EAAOC,GAAkB,GAAG,KAAK,MAAMA,EAAQ,GAAG,CAAC,IAEnDC,EAAW,CAAC,CAAE,MAAAC,EAAO,SAAAC,KACzBC,EAAAA,IAAC,OAAI,UAAU,oFACb,eAACC,EAAA,CAAK,KAAK,QAAQ,QAAQ,QAAQ,UAAU,SAC3C,SAAAC,EAAAA,KAAC,MAAA,CAAI,UAAU,sBACb,SAAA,CAAAF,EAAAA,IAAC,OAAA,CAAK,UAAU,wDAAyD,SAAAF,EAAM,EAC9EC,CAAA,CAAA,CACH,EACF,EACF,EAGII,EAAU,CAAC,CAAE,MAAAC,EAAO,MAAAR,KACxBM,OAAC,MAAA,CAAI,UAAU,0CACb,SAAA,CAAAF,EAAAA,IAAC,OAAA,CAAK,UAAU,aAAc,SAAAI,EAAM,EACpCJ,EAAAA,IAAC,OAAA,CAAK,UAAU,gBAAiB,SAAAJ,CAAA,CAAM,CAAA,EACzC,EAGIS,EAAmB,CAAC,CAAE,SAAAC,KAC1BJ,EAAAA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,EACC8B,GAAc9B,EAAAA,IAAC,IAAA,CAAE,UAAU,aAAa,SAAA,uBAAoB,EAC5D,CAAC8B,GAAc,CAACH,SAAU,IAAA,CAAE,UAAU,aAAa,SAAA,WAAQ,EAC3DA,GACCzB,EAAAA,KAAAS,WAAA,CACE,SAAA,CAAAT,EAAAA,KAAC,MAAA,CAAI,UAAU,qCACb,SAAA,CAAAF,EAAAA,IAACK,EAAA,CAAiB,SAAUsB,EAAM,QAAA,CAAU,EAC5C3B,EAAAA,IAACS,EAAA,CAAiB,gBAAiBkB,EAAM,eAAA,CAAiB,EAC1D3B,EAAAA,IAACY,EAAA,CACC,YAAae,EAAM,SAAS,YAC5B,UAAWA,EAAM,SAAA,CAAA,EAEnB3B,EAAAA,IAACe,EAAA,CAAqB,iBAAkBY,EAAM,gBAAA,CAAkB,QAC/DT,EAAA,CAAU,cAAeS,EAAM,cAAe,UAAWA,EAAM,UAAW,EAC3E3B,EAAAA,IAACqB,EAAA,CAAiB,aAAcM,EAAM,YAAA,CAAc,CAAA,EACtD,EACAzB,EAAAA,KAAC,IAAA,CAAE,UAAU,8BAA8B,SAAA,CAAA,aAC9B,IAAI,KAAKyB,EAAM,WAAW,EAAE,eAAA,CAAe,CAAA,CACxD,CAAA,CAAA,CACF,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"index-0BzPyUVh.js","sources":["../../../src/app/services/content/stats-api.ts","../../../src/app/features/stats/stats-page.tsx"],"sourcesContent":["import type { ProjectStats } from '@/types/index';\n\nexport const fetchStats = async () => {\n const res = await fetch('/api/stats');\n if (!res.ok) throw new Error(`Failed to fetch stats: ${res.status}`);\n return res.json() as Promise<ProjectStats>;\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { STATUS_LABEL } from '@/app/features/plans/constants';\nimport { fetchStats } from '@/app/services/content';\nimport { color } from '@/app/styles/tokens';\nimport { type EntityStatus, PLAN_STATUSES, type ProjectStats } from '@/types/index';\nimport { Card, Progress } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nconst ENTITY_STATUS_ORDER: EntityStatus[] = ['open', ...PLAN_STATUSES];\n\nconst ENTITY_STATUS_LABEL: Record<EntityStatus, string> = { ...STATUS_LABEL, open: 'Open' };\n\nconst pct = (value: number) => `${Math.round(value * 100)}%`;\n\nconst StatCard = ({ title, children }: { title: string; children: React.ReactNode }) => (\n <div className=\"flex-[1_1_260px] max-w-[360px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\">\n <Card size=\"small\" texture=\"kraft\" className=\"h-full\">\n <div className=\"flex flex-col gap-3\">\n <span className=\"font-handwritten text-xs font-semibold opacity-[0.55]\">{title}</span>\n {children}\n </div>\n </Card>\n </div>\n);\n\nconst StatRow = ({ label, value }: { label: string; value: React.ReactNode }) => (\n <div className=\"flex items-center justify-between gap-2\">\n <span className=\"opacity-70\">{label}</span>\n <span className=\"font-semibold\">{value}</span>\n </div>\n);\n\nconst CommentRatioCard = ({ comments }: { comments: ProjectStats['comments'] }) => (\n <StatCard title=\"Comment ratio\">\n <Progress value={comments.ratio * 100} color={color.accentSlate} />\n <StatRow label=\"Ratio\" value={pct(comments.ratio)} />\n <StatRow label=\"Comment lines\" value={comments.commentLines} />\n <StatRow label=\"Source lines\" value={comments.sourceLines} />\n </StatCard>\n);\n\nconst TestCoverageCard = ({ testCoveragePct }: { testCoveragePct: number | null }) => (\n <StatCard title=\"Test coverage\">\n {testCoveragePct === null ? (\n <p className=\"opacity-50 m-0\">Run `pnpm test` to generate a coverage report.</p>\n ) : (\n <>\n <Progress value={testCoveragePct} color={color.accentGreen} />\n <StatRow label=\"Line coverage\" value={`${Math.round(testCoveragePct)}%`} />\n </>\n )}\n </StatCard>\n);\n\nconst CodebaseSizeCard = ({\n sourceLines,\n testLines,\n}: { sourceLines: number; testLines: number }) => (\n <StatCard title=\"Codebase size\">\n <StatRow label=\"Source lines\" value={sourceLines} />\n <StatRow label=\"Test lines\" value={testLines} />\n </StatCard>\n);\n\nconst EntitiesByStatusCard = ({\n entitiesByStatus,\n}: { entitiesByStatus: ProjectStats['entitiesByStatus'] }) => (\n <StatCard title=\"Entities by status\">\n {ENTITY_STATUS_ORDER.filter((status) => entitiesByStatus[status]).map((status) => (\n <StatRow key={status} label={ENTITY_STATUS_LABEL[status]} value={entitiesByStatus[status]} />\n ))}\n {Object.keys(entitiesByStatus).length === 0 && (\n <p className=\"opacity-50 m-0\">No entities yet.</p>\n )}\n </StatCard>\n);\n\nconst NotesCard = ({ openQuestions, decisions }: { openQuestions: number; decisions: number }) => (\n <StatCard title=\"Notes\">\n <StatRow label=\"Open questions\" value={openQuestions} />\n <StatRow label=\"Decisions\" value={decisions} />\n </StatCard>\n);\n\nconst TasksPerWeekCard = ({ tasksPerWeek }: { tasksPerWeek: ProjectStats['tasksPerWeek'] }) => {\n const max = Math.max(1, ...tasksPerWeek.map((w) => w.count));\n return (\n <StatCard title=\"Tasks per week\">\n {tasksPerWeek.length === 0 && <p className=\"opacity-50 m-0\">No tasks run yet.</p>}\n {tasksPerWeek.map((week) => (\n <div key={week.week} className=\"flex flex-col gap-1\">\n <StatRow label={week.week} value={week.count} />\n <Progress value={week.count} max={max} color={color.accentAmber} height={4} />\n </div>\n ))}\n </StatCard>\n );\n};\n\nexport const StatsPage = () => {\n const [stats, setStats] = useState<ProjectStats | null>(null);\n const [loadFailed, setLoadFailed] = useState(false);\n\n useEffect(() => {\n fetchStats()\n .then(setStats)\n .catch(() => setLoadFailed(true));\n }, []);\n\n return (\n <div>\n <PageTitle>Stats</PageTitle>\n <p className=\"opacity-50 mb-6\">\n A read-only look at project health — every number here is informational, none of them gate\n anything.\n </p>\n {loadFailed && <p className=\"opacity-50\">Couldn't load stats.</p>}\n {!loadFailed && !stats && <p className=\"opacity-50\">Loading…</p>}\n {stats && (\n <>\n <div className=\"flex flex-wrap items-start gap-2.5\">\n <CommentRatioCard comments={stats.comments} />\n <TestCoverageCard testCoveragePct={stats.testCoveragePct} />\n <CodebaseSizeCard\n sourceLines={stats.comments.sourceLines}\n testLines={stats.testLines}\n />\n <EntitiesByStatusCard entitiesByStatus={stats.entitiesByStatus} />\n <NotesCard openQuestions={stats.openQuestions} decisions={stats.decisions} />\n <TasksPerWeekCard tasksPerWeek={stats.tasksPerWeek} />\n </div>\n <p className=\"opacity-[0.4] text-2xs mt-6\">\n Generated {new Date(stats.generatedAt).toLocaleString()}\n </p>\n </>\n )}\n </div>\n );\n};\n"],"names":["fetchStats","res","ENTITY_STATUS_ORDER","PLAN_STATUSES","ENTITY_STATUS_LABEL","STATUS_LABEL","pct","value","StatCard","title","children","jsx","Card","jsxs","StatRow","label","CommentRatioCard","comments","Progress","color","TestCoverageCard","testCoveragePct","Fragment","CodebaseSizeCard","sourceLines","testLines","EntitiesByStatusCard","entitiesByStatus","status","NotesCard","openQuestions","decisions","TasksPerWeekCard","tasksPerWeek","max","w","week","StatsPage","stats","setStats","useState","loadFailed","setLoadFailed","useEffect","PageTitle"],"mappings":"0HAEO,MAAMA,EAAa,SAAY,CACpC,MAAMC,EAAM,MAAM,MAAM,YAAY,EACpC,GAAI,CAACA,EAAI,GAAI,MAAM,IAAI,MAAM,0BAA0BA,EAAI,MAAM,EAAE,EACnE,OAAOA,EAAI,KAAA,CACb,ECEMC,EAAsC,CAAC,OAAQ,GAAGC,CAAa,EAE/DC,EAAoD,CAAE,GAAGC,EAAc,KAAM,MAAA,EAE7EC,EAAOC,GAAkB,GAAG,KAAK,MAAMA,EAAQ,GAAG,CAAC,IAEnDC,EAAW,CAAC,CAAE,MAAAC,EAAO,SAAAC,KACzBC,EAAAA,IAAC,OAAI,UAAU,oFACb,eAACC,EAAA,CAAK,KAAK,QAAQ,QAAQ,QAAQ,UAAU,SAC3C,SAAAC,EAAAA,KAAC,MAAA,CAAI,UAAU,sBACb,SAAA,CAAAF,EAAAA,IAAC,OAAA,CAAK,UAAU,wDAAyD,SAAAF,EAAM,EAC9EC,CAAA,CAAA,CACH,EACF,EACF,EAGII,EAAU,CAAC,CAAE,MAAAC,EAAO,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,UAAU,IAAM,CACd3C,EAAA,EACG,KAAKuC,CAAQ,EACb,MAAM,IAAMG,EAAc,EAAI,CAAC,CACpC,EAAG,CAAA,CAAE,SAGF,MAAA,CACC,SAAA,CAAA/B,EAAAA,IAACiC,GAAU,SAAA,OAAA,CAAK,EAChBjC,EAAAA,IAAC,IAAA,CAAE,UAAU,kBAAkB,SAAA,uGAG/B,EACC8B,GAAc9B,EAAAA,IAAC,IAAA,CAAE,UAAU,aAAa,SAAA,uBAAoB,EAC5D,CAAC8B,GAAc,CAACH,SAAU,IAAA,CAAE,UAAU,aAAa,SAAA,WAAQ,EAC3DA,GACCzB,EAAAA,KAAAS,WAAA,CACE,SAAA,CAAAT,EAAAA,KAAC,MAAA,CAAI,UAAU,qCACb,SAAA,CAAAF,EAAAA,IAACK,EAAA,CAAiB,SAAUsB,EAAM,QAAA,CAAU,EAC5C3B,EAAAA,IAACS,EAAA,CAAiB,gBAAiBkB,EAAM,eAAA,CAAiB,EAC1D3B,EAAAA,IAACY,EAAA,CACC,YAAae,EAAM,SAAS,YAC5B,UAAWA,EAAM,SAAA,CAAA,EAEnB3B,EAAAA,IAACe,EAAA,CAAqB,iBAAkBY,EAAM,gBAAA,CAAkB,QAC/DT,EAAA,CAAU,cAAeS,EAAM,cAAe,UAAWA,EAAM,UAAW,EAC3E3B,EAAAA,IAACqB,EAAA,CAAiB,aAAcM,EAAM,YAAA,CAAc,CAAA,EACtD,EACAzB,EAAAA,KAAC,IAAA,CAAE,UAAU,8BAA8B,SAAA,CAAA,aAC9B,IAAI,KAAKyB,EAAM,WAAW,EAAE,eAAA,CAAe,CAAA,CACxD,CAAA,CAAA,CACF,CAAA,EAEJ,CAEJ"}
@@ -1,6 +1,6 @@
1
- import{j as e,w as m,U as h,i as f,a as j,r as d,Q as u,y as g}from"./main-BW24wv9K.js";function N(s){if(!s)return[];const t=(s.endsWith(`
1
+ import{j as e,w as m,U as h,i as f,a as j,r as d,Q as u,y as g}from"./main-Ba3mXsWY.js";function N(s){if(!s)return[];const t=(s.endsWith(`
2
2
  `)?s.slice(0,-1):s).split(`
3
3
  `),a=[];let l=null;for(const i of t){if(i.startsWith("@@ ")){l={header:i,lines:[]},a.push(l);continue}l&&(i.startsWith("+")?l.lines.push({type:"add",text:i.slice(1)}):i.startsWith("-")?l.lines.push({type:"remove",text:i.slice(1)}):l.lines.push({type:"context",text:i.startsWith(" ")?i.slice(1):i}))}return a}function w(s){return s?[{header:"",lines:(s.endsWith(`
4
4
  `)?s.slice(0,-1):s).split(`
5
5
  `).map(a=>({type:"add",text:a}))}]:[]}const v={add:"bg-watercolor-green/[18%] text-watercolor-green-dark",remove:"bg-watercolor-rose/[18%] text-watercolor-rose-dark",context:""},b={add:"+",remove:"-",context:" "},k=({additions:s,deletions:t})=>e.jsxs("span",{className:"inline-flex shrink-0 gap-2 font-mono text-2xs",children:[e.jsxs("span",{className:"text-watercolor-green-dark",children:["+",s]}),e.jsxs("span",{className:"text-watercolor-rose-dark",children:["-",t]})]}),C=({entry:s})=>e.jsxs("div",{className:"flex w-full min-w-0 items-center justify-between gap-3",children:[e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs",children:s.renameSource?`${s.renameSource} → ${s.path}`:s.path}),e.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[s.staged&&e.jsx(h,{size:"small",children:"staged"}),!s.binary&&e.jsx(k,{additions:s.additions,deletions:s.deletions})]})]}),S=({entry:s})=>{if(s.binary)return e.jsx("p",{className:"m-0 opacity-60",children:"Binary file not shown."});if(s.contentKind==="too-large")return e.jsx("p",{className:"m-0 opacity-60",children:"File too large to preview."});const t=s.contentKind==="raw"?w(s.patch):N(s.patch);return t.length===0?s.renameSource?e.jsx("p",{className:"m-0 opacity-60",children:s.additions===0&&s.deletions===0?"Renamed, no content changes.":"Renamed with unrelated content — diff omitted."}):e.jsx("p",{className:"m-0 opacity-60",children:"No changes to preview."}):e.jsx("div",{className:"flex flex-col gap-3",children:t.map((a,l)=>e.jsxs("div",{children:[a.header&&e.jsx("div",{className:"mb-1 font-mono text-2xs opacity-50",children:a.header}),e.jsx("pre",{className:"m-0 overflow-x-auto font-mono text-2xs",children:a.lines.map((i,c)=>e.jsxs("span",{className:`block ${v[i.type]}`,children:[b[i.type],i.text]},`${i.type}-${c}`))})]},`${a.header}-${l}`))})},F=({entry:s,sectionRef:t})=>e.jsx("div",{ref:t,className:"scroll-mt-4",children:e.jsxs(m,{children:[e.jsx("div",{className:"mb-3",children:e.jsx(C,{entry:s})}),e.jsx(S,{entry:s})]})}),$=({additions:s,deletions:t})=>e.jsxs("span",{className:"inline-flex gap-2 font-mono text-2xs",children:[e.jsxs("span",{className:"text-watercolor-green-dark",children:["+",s]}),e.jsxs("span",{className:"text-watercolor-rose-dark",children:["-",t]})]}),R=({files:s,onSelect:t})=>e.jsx("div",{className:"sticky top-4 flex w-[288px] shrink-0 flex-col gap-1 max-h-page overflow-y-auto",children:s.map(a=>e.jsx(f,{size:"small",onClick:()=>t(a.path),action:e.jsxs("span",{className:"flex items-center gap-2",children:[a.staged&&e.jsx(h,{size:"small",children:"staged"}),!a.binary&&e.jsx($,{additions:a.additions,deletions:a.deletions})]}),children:e.jsx("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs",children:a.path})},a.path))}),L=()=>{const s=j(),[t,a]=d.useState(null),[l,i]=d.useState(!1),c=d.useRef(new Map);d.useEffect(()=>{u().then(a).catch(()=>i(!0))},[]);const x=e.jsx("div",{className:"mb-4",children:e.jsx(g,{items:[{id:"plans",label:"Plans",onClick:()=>s({to:"/"})},{id:"changes",label:"Changes"}]})}),r="min-h-page";if(l)return e.jsxs("div",{children:[x,e.jsx("div",{className:r,children:e.jsx("p",{className:"opacity-50",children:"Couldn't load the working-tree diff."})})]});if(!t)return e.jsxs("div",{children:[x,e.jsx("div",{className:r,children:e.jsx("p",{className:"opacity-50",children:"Loading…"})})]});const p=n=>{var o;(o=c.current.get(n))==null||o.scrollIntoView({behavior:"smooth",block:"start"})};return e.jsxs("div",{children:[x,t.length===0?e.jsx("div",{className:r,children:e.jsx("p",{className:"opacity-50",children:"No changed files."})}):e.jsxs("div",{className:`flex items-start gap-6 ${r}`,children:[e.jsx(R,{files:t,onSelect:p}),e.jsx("div",{className:"flex min-w-0 flex-1 flex-col gap-6",children:t.map(n=>e.jsx(F,{entry:n,sectionRef:o=>{o?c.current.set(n.path,o):c.current.delete(n.path)}},n.path))})]})]})};export{L as DiffPage};
6
- //# sourceMappingURL=index-BSp1FE97.js.map
6
+ //# sourceMappingURL=index-BiDION9V.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-BSp1FE97.js","sources":["../../../src/app/utils/parse-diff.ts","../../../src/app/features/diff/file-diff-card.tsx","../../../src/app/features/diff/file-list-sidebar.tsx","../../../src/app/features/diff/diff-page.tsx"],"sourcesContent":["export type DiffLineType = 'add' | 'remove' | 'context';\n\nexport interface DiffLine {\n type: DiffLineType;\n text: string;\n}\n\nexport interface DiffHunk {\n header: string;\n lines: DiffLine[];\n}\n\n// Parses a unified diff (git.ts getWorkingDiff, contentKind: 'diff'). A real diff\n// with no hunks (pure rename, mode-only change) is just the preamble, so it yields [].\nexport function parsePatch(patch: string): DiffHunk[] {\n if (!patch) return [];\n const lines = (patch.endsWith('\\n') ? patch.slice(0, -1) : patch).split('\\n');\n\n const hunks: DiffHunk[] = [];\n let current: DiffHunk | null = null;\n for (const line of lines) {\n if (line.startsWith('@@ ')) {\n current = { header: line, lines: [] };\n hunks.push(current);\n continue;\n }\n if (!current) continue; // preamble: diff --git / index / --- / +++\n if (line.startsWith('+')) current.lines.push({ type: 'add', text: line.slice(1) });\n else if (line.startsWith('-')) current.lines.push({ type: 'remove', text: line.slice(1) });\n else current.lines.push({ type: 'context', text: line.startsWith(' ') ? line.slice(1) : line });\n }\n return hunks;\n}\n\n// Untracked files store raw content, not a diff (git.ts getWorkingDiff, contentKind:\n// 'raw') — synthesize a single all-added hunk so the renderer only has one shape to draw.\nexport function rawContentHunks(content: string): DiffHunk[] {\n if (!content) return [];\n const lines = (content.endsWith('\\n') ? content.slice(0, -1) : content).split('\\n');\n return [{ header: '', lines: lines.map((text) => ({ type: 'add', text })) }];\n}\n","import { type DiffLineType, parsePatch, rawContentHunks } from '@/app/utils/parse-diff';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\n\nconst LINE_CLASS: Record<DiffLineType, string> = {\n add: 'bg-watercolor-green/[18%] text-watercolor-green-dark',\n remove: 'bg-watercolor-rose/[18%] text-watercolor-rose-dark',\n context: '',\n};\n\nconst LINE_PREFIX: Record<DiffLineType, string> = { add: '+', remove: '-', context: ' ' };\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex shrink-0 gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface CardTitleProps {\n entry: FileDiffEntry;\n}\n\nconst CardTitle = ({ entry }: CardTitleProps) => (\n <div className=\"flex w-full min-w-0 items-center justify-between gap-3\">\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs\">\n {entry.renameSource ? `${entry.renameSource} → ${entry.path}` : entry.path}\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && <CountBadge additions={entry.additions} deletions={entry.deletions} />}\n </span>\n </div>\n);\n\ninterface DiffBodyProps {\n entry: FileDiffEntry;\n}\n\nconst DiffBody = ({ entry }: DiffBodyProps) => {\n if (entry.binary) {\n return <p className=\"m-0 opacity-60\">Binary file not shown.</p>;\n }\n if (entry.contentKind === 'too-large') {\n return <p className=\"m-0 opacity-60\">File too large to preview.</p>;\n }\n const hunks =\n entry.contentKind === 'raw' ? rawContentHunks(entry.patch) : parsePatch(entry.patch);\n if (hunks.length === 0) {\n if (entry.renameSource) {\n return (\n <p className=\"m-0 opacity-60\">\n {entry.additions === 0 && entry.deletions === 0\n ? 'Renamed, no content changes.'\n : 'Renamed with unrelated content — diff omitted.'}\n </p>\n );\n }\n return <p className=\"m-0 opacity-60\">No changes to preview.</p>;\n }\n return (\n <div className=\"flex flex-col gap-3\">\n {hunks.map((hunk, i) => (\n <div key={`${hunk.header}-${i}`}>\n {hunk.header && <div className=\"mb-1 font-mono text-2xs opacity-50\">{hunk.header}</div>}\n {/* paper-ui's CodeBlock has no per-line add/remove styling. */}\n <pre className=\"m-0 overflow-x-auto font-mono text-2xs\">\n {hunk.lines.map((line, j) => (\n <span key={`${line.type}-${j}`} className={`block ${LINE_CLASS[line.type]}`}>\n {LINE_PREFIX[line.type]}\n {line.text}\n </span>\n ))}\n </pre>\n </div>\n ))}\n </div>\n );\n};\n\ninterface FileDiffSectionProps {\n entry: FileDiffEntry;\n sectionRef: (el: HTMLDivElement | null) => void;\n}\n\nexport const FileDiffSection = ({ entry, sectionRef }: FileDiffSectionProps) => (\n <div ref={sectionRef} className=\"scroll-mt-4\">\n <Card>\n <div className=\"mb-3\">\n <CardTitle entry={entry} />\n </div>\n <DiffBody entry={entry} />\n </Card>\n </div>\n);\n","import type { FileDiffEntry } from '@/types/index';\nimport { ListItem, Stamp } from '@dendelion/paper-ui';\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface FileListSidebarProps {\n files: FileDiffEntry[];\n onSelect: (path: string) => void;\n}\n\nexport const FileListSidebar = ({ files, onSelect }: FileListSidebarProps) => (\n <div className=\"sticky top-4 flex w-[288px] shrink-0 flex-col gap-1 max-h-page overflow-y-auto\">\n {files.map((entry) => (\n <ListItem\n key={entry.path}\n size=\"small\"\n onClick={() => onSelect(entry.path)}\n action={\n <span className=\"flex items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && (\n <CountBadge additions={entry.additions} deletions={entry.deletions} />\n )}\n </span>\n }\n >\n <span className=\"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs\">\n {entry.path}\n </span>\n </ListItem>\n ))}\n </div>\n);\n","import { fetchFileDiffs } from '@/app/services/git-api';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Breadcrumb } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { FileDiffSection } from './file-diff-card';\nimport { FileListSidebar } from './file-list-sidebar';\n\nexport const DiffPage = () => {\n const navigate = useNavigate();\n const [files, setFiles] = useState<FileDiffEntry[] | null>(null);\n const [loadFailed, setLoadFailed] = useState(false);\n const sectionRefs = useRef(new Map<string, HTMLDivElement>());\n\n useEffect(() => {\n fetchFileDiffs()\n .then(setFiles)\n .catch(() => setLoadFailed(true));\n }, []);\n\n const breadcrumb = (\n <div className=\"mb-4\">\n <Breadcrumb\n items={[\n { id: 'plans', label: 'Plans', onClick: () => navigate({ to: '/' }) },\n { id: 'changes', label: 'Changes' },\n ]}\n />\n </div>\n );\n\n const contentClass = 'min-h-page';\n\n if (loadFailed) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Couldn't load the working-tree diff.</p>\n </div>\n </div>\n );\n }\n\n if (!files) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n </div>\n );\n }\n\n const scrollToFile = (path: string) => {\n sectionRefs.current.get(path)?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n };\n\n return (\n <div>\n {breadcrumb}\n {files.length === 0 ? (\n <div className={contentClass}>\n <p className=\"opacity-50\">No changed files.</p>\n </div>\n ) : (\n <div className={`flex items-start gap-6 ${contentClass}`}>\n <FileListSidebar files={files} onSelect={scrollToFile} />\n <div className=\"flex min-w-0 flex-1 flex-col gap-6\">\n {files.map((entry) => (\n <FileDiffSection\n key={entry.path}\n entry={entry}\n sectionRef={(el) => {\n if (el) sectionRefs.current.set(entry.path, el);\n else sectionRefs.current.delete(entry.path);\n }}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n );\n};\n"],"names":["parsePatch","patch","lines","hunks","current","line","rawContentHunks","content","text","LINE_CLASS","LINE_PREFIX","CountBadge","additions","deletions","jsxs","CardTitle","entry","jsx","Stamp","DiffBody","hunk","i","j","FileDiffSection","sectionRef","Card","FileListSidebar","files","onSelect","ListItem","DiffPage","navigate","useNavigate","setFiles","useState","loadFailed","setLoadFailed","sectionRefs","useRef","useEffect","fetchFileDiffs","breadcrumb","Breadcrumb","contentClass","scrollToFile","path","_a","el"],"mappings":"wFAcO,SAASA,EAAWC,EAA2B,CACpD,GAAI,CAACA,EAAO,MAAO,CAAA,EACnB,MAAMC,GAASD,EAAM,SAAS;AAAA,CAAI,EAAIA,EAAM,MAAM,EAAG,EAAE,EAAIA,GAAO,MAAM;AAAA,CAAI,EAEtEE,EAAoB,CAAA,EAC1B,IAAIC,EAA2B,KAC/B,UAAWC,KAAQH,EAAO,CACxB,GAAIG,EAAK,WAAW,KAAK,EAAG,CAC1BD,EAAU,CAAE,OAAQC,EAAM,MAAO,CAAA,CAAC,EAClCF,EAAM,KAAKC,CAAO,EAClB,QACF,CACKA,IACDC,EAAK,WAAW,GAAG,IAAW,MAAM,KAAK,CAAE,KAAM,MAAO,KAAMA,EAAK,MAAM,CAAC,EAAG,EACxEA,EAAK,WAAW,GAAG,IAAW,MAAM,KAAK,CAAE,KAAM,SAAU,KAAMA,EAAK,MAAM,CAAC,EAAG,IAC5E,MAAM,KAAK,CAAE,KAAM,UAAW,KAAMA,EAAK,WAAW,GAAG,EAAIA,EAAK,MAAM,CAAC,EAAIA,EAAM,EAChG,CACA,OAAOF,CACT,CAIO,SAASG,EAA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AA,EAClE,CAAE,GAAI,UAAW,MAAO,SAAA,CAAU,CACpC,CAAA,EAEJ,EAGIY,EAAe,aAErB,GAAIR,EACF,cACG,MAAA,CACE,SAAA,CAAAM,EACDxB,EAAAA,IAAC,OAAI,UAAW0B,EACd,eAAC,IAAA,CAAE,UAAU,aAAa,SAAA,sCAAA,CAAoC,CAAA,CAChE,CAAA,EACF,EAIJ,GAAI,CAAChB,EACH,cACG,MAAA,CACE,SAAA,CAAAc,EACDxB,EAAAA,IAAC,OAAI,UAAW0B,EACd,eAAC,IAAA,CAAE,UAAU,aAAa,SAAA,UAAA,CAAQ,CAAA,CACpC,CAAA,EACF,EAIJ,MAAMC,EAAgBC,GAAiB,QACrCC,EAAAT,EAAY,QAAQ,IAAIQ,CAAI,IAA5B,MAAAC,EAA+B,eAAe,CAAE,SAAU,SAAU,MAAO,SAC7E,EAEA,cACG,MAAA,CACE,SAAA,CAAAL,EACAd,EAAM,SAAW,QACf,MAAA,CAAI,UAAWgB,EACd,SAAA1B,MAAC,IAAA,CAAE,UAAU,aAAa,SAAA,mBAAA,CAAiB,EAC7C,EAEAH,EAAAA,KAAC,OAAI,UAAW,0BAA0B6B,CAAY,GACpD,SAAA,CAAA1B,EAAAA,IAACS,EAAA,CAAgB,MAAAC,EAAc,SAAUiB,CAAA,CAAc,QACtD,MAAA,CAAI,UAAU,qCACZ,SAAAjB,EAAM,IAAKX,GACVC,EAAAA,IAACM,EAAA,CAEC,MAAAP,EACA,WAAa+B,GAAO,CACdA,EAAIV,EAAY,QAAQ,IAAIrB,EAAM,KAAM+B,CAAE,EACzCV,EAAY,QAAQ,OAAOrB,EAAM,IAAI,CAC5C,CAAA,EALKA,EAAM,IAAA,CAOd,CAAA,CACH,CAAA,CAAA,CACF,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"index-BiDION9V.js","sources":["../../../src/app/utils/parse-diff.ts","../../../src/app/features/diff/file-diff-card.tsx","../../../src/app/features/diff/file-list-sidebar.tsx","../../../src/app/features/diff/diff-page.tsx"],"sourcesContent":["export type DiffLineType = 'add' | 'remove' | 'context';\n\nexport interface DiffLine {\n type: DiffLineType;\n text: string;\n}\n\nexport interface DiffHunk {\n header: string;\n lines: DiffLine[];\n}\n\n// Parses a unified diff (git.ts getWorkingDiff, contentKind: 'diff'). A real diff\n// with no hunks (pure rename, mode-only change) is just the preamble, so it yields [].\nexport function parsePatch(patch: string): DiffHunk[] {\n if (!patch) return [];\n const lines = (patch.endsWith('\\n') ? patch.slice(0, -1) : patch).split('\\n');\n\n const hunks: DiffHunk[] = [];\n let current: DiffHunk | null = null;\n for (const line of lines) {\n if (line.startsWith('@@ ')) {\n current = { header: line, lines: [] };\n hunks.push(current);\n continue;\n }\n if (!current) continue; // preamble: diff --git / index / --- / +++\n if (line.startsWith('+')) current.lines.push({ type: 'add', text: line.slice(1) });\n else if (line.startsWith('-')) current.lines.push({ type: 'remove', text: line.slice(1) });\n else current.lines.push({ type: 'context', text: line.startsWith(' ') ? line.slice(1) : line });\n }\n return hunks;\n}\n\n// Untracked files store raw content, not a diff (git.ts getWorkingDiff, contentKind:\n// 'raw') — synthesize a single all-added hunk so the renderer only has one shape to draw.\nexport function rawContentHunks(content: string): DiffHunk[] {\n if (!content) return [];\n const lines = (content.endsWith('\\n') ? content.slice(0, -1) : content).split('\\n');\n return [{ header: '', lines: lines.map((text) => ({ type: 'add', text })) }];\n}\n","import { type DiffLineType, parsePatch, rawContentHunks } from '@/app/utils/parse-diff';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\n\nconst LINE_CLASS: Record<DiffLineType, string> = {\n add: 'bg-watercolor-green/[18%] text-watercolor-green-dark',\n remove: 'bg-watercolor-rose/[18%] text-watercolor-rose-dark',\n context: '',\n};\n\nconst LINE_PREFIX: Record<DiffLineType, string> = { add: '+', remove: '-', context: ' ' };\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex shrink-0 gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface CardTitleProps {\n entry: FileDiffEntry;\n}\n\nconst CardTitle = ({ entry }: CardTitleProps) => (\n <div className=\"flex w-full min-w-0 items-center justify-between gap-3\">\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap font-mono text-xs\">\n {entry.renameSource ? `${entry.renameSource} → ${entry.path}` : entry.path}\n </span>\n <span className=\"flex shrink-0 items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && <CountBadge additions={entry.additions} deletions={entry.deletions} />}\n </span>\n </div>\n);\n\ninterface DiffBodyProps {\n entry: FileDiffEntry;\n}\n\nconst DiffBody = ({ entry }: DiffBodyProps) => {\n if (entry.binary) {\n return <p className=\"m-0 opacity-60\">Binary file not shown.</p>;\n }\n if (entry.contentKind === 'too-large') {\n return <p className=\"m-0 opacity-60\">File too large to preview.</p>;\n }\n const hunks =\n entry.contentKind === 'raw' ? rawContentHunks(entry.patch) : parsePatch(entry.patch);\n if (hunks.length === 0) {\n if (entry.renameSource) {\n return (\n <p className=\"m-0 opacity-60\">\n {entry.additions === 0 && entry.deletions === 0\n ? 'Renamed, no content changes.'\n : 'Renamed with unrelated content — diff omitted.'}\n </p>\n );\n }\n return <p className=\"m-0 opacity-60\">No changes to preview.</p>;\n }\n return (\n <div className=\"flex flex-col gap-3\">\n {hunks.map((hunk, i) => (\n <div key={`${hunk.header}-${i}`}>\n {hunk.header && <div className=\"mb-1 font-mono text-2xs opacity-50\">{hunk.header}</div>}\n {/* paper-ui's CodeBlock has no per-line add/remove styling. */}\n <pre className=\"m-0 overflow-x-auto font-mono text-2xs\">\n {hunk.lines.map((line, j) => (\n <span key={`${line.type}-${j}`} className={`block ${LINE_CLASS[line.type]}`}>\n {LINE_PREFIX[line.type]}\n {line.text}\n </span>\n ))}\n </pre>\n </div>\n ))}\n </div>\n );\n};\n\ninterface FileDiffSectionProps {\n entry: FileDiffEntry;\n sectionRef: (el: HTMLDivElement | null) => void;\n}\n\nexport const FileDiffSection = ({ entry, sectionRef }: FileDiffSectionProps) => (\n <div ref={sectionRef} className=\"scroll-mt-4\">\n <Card>\n <div className=\"mb-3\">\n <CardTitle entry={entry} />\n </div>\n <DiffBody entry={entry} />\n </Card>\n </div>\n);\n","import type { FileDiffEntry } from '@/types/index';\nimport { ListItem, Stamp } from '@dendelion/paper-ui';\n\ninterface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nconst CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex gap-2 font-mono text-2xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n\ninterface FileListSidebarProps {\n files: FileDiffEntry[];\n onSelect: (path: string) => void;\n}\n\nexport const FileListSidebar = ({ files, onSelect }: FileListSidebarProps) => (\n <div className=\"sticky top-4 flex w-[288px] shrink-0 flex-col gap-1 max-h-page overflow-y-auto\">\n {files.map((entry) => (\n <ListItem\n key={entry.path}\n size=\"small\"\n onClick={() => onSelect(entry.path)}\n action={\n <span className=\"flex items-center gap-2\">\n {entry.staged && <Stamp size=\"small\">staged</Stamp>}\n {!entry.binary && (\n <CountBadge additions={entry.additions} deletions={entry.deletions} />\n )}\n </span>\n }\n >\n <span className=\"block overflow-hidden text-ellipsis whitespace-nowrap font-mono text-2xs\">\n {entry.path}\n </span>\n </ListItem>\n ))}\n </div>\n);\n","import { fetchFileDiffs } from '@/app/services/git-api';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Breadcrumb } from '@dendelion/paper-ui';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { FileDiffSection } from './file-diff-card';\nimport { FileListSidebar } from './file-list-sidebar';\n\nexport const DiffPage = () => {\n const navigate = useNavigate();\n const [files, setFiles] = useState<FileDiffEntry[] | null>(null);\n const [loadFailed, setLoadFailed] = useState(false);\n const sectionRefs = useRef(new Map<string, HTMLDivElement>());\n\n useEffect(() => {\n fetchFileDiffs()\n .then(setFiles)\n .catch(() => setLoadFailed(true));\n }, []);\n\n const breadcrumb = (\n <div className=\"mb-4\">\n <Breadcrumb\n items={[\n { id: 'plans', label: 'Plans', onClick: () => navigate({ to: '/' }) },\n { id: 'changes', label: 'Changes' },\n ]}\n />\n </div>\n );\n\n const contentClass = 'min-h-page';\n\n if (loadFailed) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Couldn't load the working-tree diff.</p>\n </div>\n </div>\n );\n }\n\n if (!files) {\n return (\n <div>\n {breadcrumb}\n <div className={contentClass}>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n </div>\n );\n }\n\n const scrollToFile = (path: string) => {\n sectionRefs.current.get(path)?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n };\n\n return (\n <div>\n {breadcrumb}\n {files.length === 0 ? (\n <div className={contentClass}>\n <p className=\"opacity-50\">No changed files.</p>\n </div>\n ) : (\n <div className={`flex items-start gap-6 ${contentClass}`}>\n <FileListSidebar files={files} onSelect={scrollToFile} />\n <div className=\"flex min-w-0 flex-1 flex-col gap-6\">\n {files.map((entry) => (\n <FileDiffSection\n key={entry.path}\n entry={entry}\n sectionRef={(el) => {\n if (el) sectionRefs.current.set(entry.path, el);\n else sectionRefs.current.delete(entry.path);\n }}\n />\n ))}\n </div>\n </div>\n )}\n </div>\n );\n};\n"],"names":["parsePatch","patch","lines","hunks","current","line","rawContentHunks","content","text","LINE_CLASS","LINE_PREFIX","CountBadge","additions","deletions","jsxs","CardTitle","entry","jsx","Stamp","DiffBody","hunk","i","j","FileDiffSection","sectionRef","Card","FileListSidebar","files","onSelect","ListItem","DiffPage","navigate","useNavigate","setFiles","useState","loadFailed","setLoadFailed","sectionRefs","useRef","useEffect","fetchFileDiffs","breadcrumb","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B,eAAe,CAAE,SAAU,SAAU,MAAO,SAC7E,EAEA,cACG,MAAA,CACE,SAAA,CAAAL,EACAd,EAAM,SAAW,QACf,MAAA,CAAI,UAAWgB,EACd,SAAA1B,MAAC,IAAA,CAAE,UAAU,aAAa,SAAA,mBAAA,CAAiB,EAC7C,EAEAH,EAAAA,KAAC,OAAI,UAAW,0BAA0B6B,CAAY,GACpD,SAAA,CAAA1B,EAAAA,IAACS,EAAA,CAAgB,MAAAC,EAAc,SAAUiB,CAAA,CAAc,QACtD,MAAA,CAAI,UAAU,qCACZ,SAAAjB,EAAM,IAAKX,GACVC,EAAAA,IAACM,EAAA,CAEC,MAAAP,EACA,WAAa+B,GAAO,CACdA,EAAIV,EAAY,QAAQ,IAAIrB,EAAM,KAAM+B,CAAE,EACzCV,EAAY,QAAQ,OAAOrB,EAAM,IAAI,CAC5C,CAAA,EALKA,EAAM,IAAA,CAOd,CAAA,CACH,CAAA,CAAA,CACF,CAAA,EAEJ,CAEJ"}
@@ -1,2 +1,2 @@
1
- import{k as N,r as h,W as k,j as e,X as g,Y as v,Z as I,_ as w,J as P,u as p,a as C,P as E}from"./main-BW24wv9K.js";const j=n=>Number.isFinite(n)?n<=0?"today":n===1?"1 day ago":`${n} days ago`:"age unknown",T=({question:n,plan:x,expanded:a,onToggle:u,onOpen:t,reload:y})=>{const{toast:l}=N(),[i,m]=h.useState(""),{sending:o,send:s,undo:d,undoing:r,undoEdit:b}=k(x,{reload:y,notify:l}),c=async()=>{i.trim()&&await s(i.trim())&&m("")};return e.jsxs("div",{className:"border-b border-black/10 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2.5",children:[e.jsx("button",{type:"button",onClick:t,"aria-label":`Open ${n.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(g,{id:n.entityId})}),e.jsx("button",{type:"button",onClick:u,"aria-expanded":a,className:"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer",children:n.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(n.ageDays)})]}),a&&e.jsxs("div",{className:"flex flex-col gap-3 pb-4",children:[e.jsx(v,{messages:x.thread??[],undo:d,undoing:r,onUndo:b}),e.jsx(I,{value:i,onChange:f=>m(f.target.value),"aria-label":`Reply to ${n.entityTitle}`,placeholder:"Reply to resolve and resume…",rows:2,disabled:o}),e.jsxs("div",{className:"flex justify-end items-center gap-3",children:[e.jsx("span",{className:o?"visible":"invisible",children:e.jsx(w,{size:"small",label:"Agent replying…"})}),e.jsx(P,{size:"small",onClick:c,disabled:o||!i.trim(),children:"Reply"})]})]})]})},R=()=>{const[n,x]=h.useState(null),a=p(s=>s.parkedQuestions),u=p(s=>s.parkedQuestionsError!==null),t=p(s=>s.plans),y=p(s=>s.loadPlans),l=p(s=>s.loadParkedQuestions),i=C();h.useEffect(()=>{l()},[l]);const m=async()=>{await Promise.all([y(),l()])},o=s=>{t!=null&&t.entries.some(d=>d.title===s)?i({to:"/plans/$planId",params:{planId:encodeURIComponent(s)}}):i({to:"/ideas/$ideaId",params:{ideaId:encodeURIComponent(s)}})};return e.jsxs("div",{children:[e.jsx(E,{children:"Inbox"}),e.jsx("p",{className:"opacity-50 mb-6",children:"Every open agent question, oldest first — parked decisions waiting on a human."}),u&&e.jsx("p",{className:"opacity-50",children:"Couldn't load parked questions."}),!u&&!a&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),a&&a.length===0&&e.jsx("p",{className:"opacity-50",children:"Nothing parked — every agent question has an answer."}),a&&a.length>0&&e.jsx("div",{className:"flex flex-col",children:a.map((s,d)=>{const r=`${s.entityId}-${d}`,b=t==null?void 0:t.entries.find(c=>c.id===s.entityId);return b?e.jsx(T,{question:s,plan:b,expanded:n===r,onToggle:()=>x(c=>c===r?null:r),onOpen:()=>o(s.entityTitle),reload:m},r):e.jsxs("div",{className:"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0",children:[e.jsx("button",{type:"button",onClick:()=>o(s.entityTitle),"aria-label":`Open ${s.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(g,{id:s.entityId})}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:s.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(s.ageDays)})]},r)})})]})};export{R as InboxPage};
2
- //# sourceMappingURL=index-Bo0V9-3F.js.map
1
+ import{k as N,r as h,W as k,j as e,X as g,Y as v,Z as I,_ as w,J as P,u as p,a as C,P as E}from"./main-Ba3mXsWY.js";const j=n=>Number.isFinite(n)?n<=0?"today":n===1?"1 day ago":`${n} days ago`:"age unknown",T=({question:n,plan:x,expanded:a,onToggle:u,onOpen:t,reload:y})=>{const{toast:l}=N(),[i,m]=h.useState(""),{sending:o,send:s,undo:d,undoing:r,undoEdit:b}=k(x,{reload:y,notify:l}),c=async()=>{i.trim()&&await s(i.trim())&&m("")};return e.jsxs("div",{className:"border-b border-black/10 last:border-b-0",children:[e.jsxs("div",{className:"flex items-center gap-3 py-2.5",children:[e.jsx("button",{type:"button",onClick:t,"aria-label":`Open ${n.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(g,{id:n.entityId})}),e.jsx("button",{type:"button",onClick:u,"aria-expanded":a,className:"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer",children:n.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(n.ageDays)})]}),a&&e.jsxs("div",{className:"flex flex-col gap-3 pb-4",children:[e.jsx(v,{messages:x.thread??[],undo:d,undoing:r,onUndo:b}),e.jsx(I,{value:i,onChange:f=>m(f.target.value),"aria-label":`Reply to ${n.entityTitle}`,placeholder:"Reply to resolve and resume…",rows:2,disabled:o}),e.jsxs("div",{className:"flex justify-end items-center gap-3",children:[e.jsx("span",{className:o?"visible":"invisible",children:e.jsx(w,{size:"small",label:"Agent replying…"})}),e.jsx(P,{size:"small",onClick:c,disabled:o||!i.trim(),children:"Reply"})]})]})]})},R=()=>{const[n,x]=h.useState(null),a=p(s=>s.parkedQuestions),u=p(s=>s.parkedQuestionsError!==null),t=p(s=>s.plans),y=p(s=>s.loadPlans),l=p(s=>s.loadParkedQuestions),i=C();h.useEffect(()=>{l()},[l]);const m=async()=>{await Promise.all([y(),l()])},o=s=>{t!=null&&t.entries.some(d=>d.title===s)?i({to:"/plans/$planId",params:{planId:encodeURIComponent(s)}}):i({to:"/ideas/$ideaId",params:{ideaId:encodeURIComponent(s)}})};return e.jsxs("div",{children:[e.jsx(E,{children:"Inbox"}),e.jsx("p",{className:"opacity-50 mb-6",children:"Every open agent question, oldest first — parked decisions waiting on a human."}),u&&e.jsx("p",{className:"opacity-50",children:"Couldn't load parked questions."}),!u&&!a&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),a&&a.length===0&&e.jsx("p",{className:"opacity-50",children:"Nothing parked — every agent question has an answer."}),a&&a.length>0&&e.jsx("div",{className:"flex flex-col",children:a.map((s,d)=>{const r=`${s.entityId}-${d}`,b=t==null?void 0:t.entries.find(c=>c.id===s.entityId);return b?e.jsx(T,{question:s,plan:b,expanded:n===r,onToggle:()=>x(c=>c===r?null:r),onOpen:()=>o(s.entityTitle),reload:m},r):e.jsxs("div",{className:"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0",children:[e.jsx("button",{type:"button",onClick:()=>o(s.entityTitle),"aria-label":`Open ${s.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(g,{id:s.entityId})}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:s.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(s.ageDays)})]},r)})})]})};export{R as InboxPage};
2
+ //# sourceMappingURL=index-Bz4Df_iX.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Bo0V9-3F.js","sources":["../../../src/app/features/inbox/helpers.ts","../../../src/app/features/inbox/question-row.tsx","../../../src/app/features/inbox/inbox-page.tsx"],"sourcesContent":["export const formatAge = (ageDays: number): string => {\n if (!Number.isFinite(ageDays)) return 'age unknown';\n if (ageDays <= 0) return 'today';\n return ageDays === 1 ? '1 day ago' : `${ageDays} days ago`;\n};\n","import { FeedbackThread, PlanIdStamp } from '@/app/features/plans/components';\nimport { useSendFeedbackMessage } from '@/app/features/plans/hooks';\nimport type { ParkedQuestion, PlanEntry } from '@/types/index';\nimport { Button, Spinner, Textarea, useToast } from '@dendelion/paper-ui';\nimport { useState } from 'react';\nimport { formatAge } from './helpers';\n\ninterface QuestionRowProps {\n question: ParkedQuestion;\n plan: PlanEntry;\n expanded: boolean;\n onToggle: () => void;\n onOpen: () => void;\n reload: () => Promise<void>;\n}\n\nexport const QuestionRow = ({\n question,\n plan,\n expanded,\n onToggle,\n onOpen,\n reload,\n}: QuestionRowProps) => {\n const { toast } = useToast();\n const [input, setInput] = useState('');\n const { sending, send, undo, undoing, undoEdit } = useSendFeedbackMessage(plan, {\n reload,\n notify: toast,\n });\n\n const handleSend = async () => {\n if (!input.trim()) return;\n if (await send(input.trim())) setInput('');\n };\n\n return (\n <div className=\"border-b border-black/10 last:border-b-0\">\n <div className=\"flex items-center gap-3 py-2.5\">\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${question.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={question.entityId} />\n </button>\n <button\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className=\"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer\"\n >\n {question.text}\n </button>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">{formatAge(question.ageDays)}</span>\n </div>\n {expanded && (\n <div className=\"flex flex-col gap-3 pb-4\">\n <FeedbackThread\n messages={plan.thread ?? []}\n undo={undo}\n undoing={undoing}\n onUndo={undoEdit}\n />\n <Textarea\n value={input}\n onChange={(e) => setInput(e.target.value)}\n aria-label={`Reply to ${question.entityTitle}`}\n placeholder=\"Reply to resolve and resume…\"\n rows={2}\n disabled={sending}\n />\n <div className=\"flex justify-end items-center gap-3\">\n <span className={sending ? 'visible' : 'invisible'}>\n <Spinner size=\"small\" label=\"Agent replying…\" />\n </span>\n <Button size=\"small\" onClick={handleSend} disabled={sending || !input.trim()}>\n Reply\n </Button>\n </div>\n </div>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { PlanIdStamp } from '@/app/features/plans/components';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useEffect, useState } from 'react';\nimport { formatAge } from './helpers';\nimport { QuestionRow } from './question-row';\n\nexport const InboxPage = () => {\n const [expandedKey, setExpandedKey] = useState<string | null>(null);\n const questions = useAppStore((s) => s.parkedQuestions);\n const loadFailed = useAppStore((s) => s.parkedQuestionsError !== null);\n const plans = useAppStore((s) => s.plans);\n const loadPlans = useAppStore((s) => s.loadPlans);\n const loadParkedQuestions = useAppStore((s) => s.loadParkedQuestions);\n const navigate = useNavigate();\n\n useEffect(() => {\n loadParkedQuestions();\n }, [loadParkedQuestions]);\n\n const reload = async () => {\n await Promise.all([loadPlans(), loadParkedQuestions()]);\n };\n\n const openEntity = (title: string) => {\n if (plans?.entries.some((p) => p.title === title)) {\n navigate({ to: '/plans/$planId', params: { planId: encodeURIComponent(title) } });\n } else {\n navigate({ to: '/ideas/$ideaId', params: { ideaId: encodeURIComponent(title) } });\n }\n };\n\n return (\n <div>\n <PageTitle>Inbox</PageTitle>\n <p className=\"opacity-50 mb-6\">\n Every open agent question, oldest first — parked decisions waiting on a human.\n </p>\n {loadFailed && <p className=\"opacity-50\">Couldn't load parked questions.</p>}\n {!loadFailed && !questions && <p className=\"opacity-50\">Loading…</p>}\n {questions && questions.length === 0 && (\n <p className=\"opacity-50\">Nothing parked — every agent question has an answer.</p>\n )}\n {questions && questions.length > 0 && (\n <div className=\"flex flex-col\">\n {questions.map((q, i) => {\n const key = `${q.entityId}-${i}`;\n const plan = plans?.entries.find((p) => p.id === q.entityId);\n if (!plan) {\n return (\n <div\n key={key}\n className=\"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0\"\n >\n <button\n type=\"button\"\n onClick={() => openEntity(q.entityTitle)}\n aria-label={`Open ${q.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={q.entityId} />\n </button>\n <span className=\"flex-1 min-w-0 truncate\">{q.text}</span>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">\n {formatAge(q.ageDays)}\n </span>\n </div>\n );\n }\n return (\n <QuestionRow\n key={key}\n question={q}\n plan={plan}\n expanded={expandedKey === key}\n onToggle={() => setExpandedKey((cur) => (cur === key ? null : key))}\n onOpen={() => openEntity(q.entityTitle)}\n reload={reload}\n />\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"names":["formatAge","ageDays","QuestionRow","question","plan","expanded","onToggle","onOpen","reload","toast","useToast","input","setInput","useState","sending","send","undo","undoing","undoEdit","useSendFeedbackMessage","handleSend","jsxs","jsx","PlanIdStamp","FeedbackThread","Textarea","e","Spinner","Button","InboxPage","expandedKey","setExpandedKey","questions","useAppStore","loadFailed","plans","loadPlans","loadParkedQuestions","navigate","useNavigate","useEffect","openEntity","title","p","PageTitle","q","i","key","cur"],"mappings":"oHAAO,MAAMA,EAAaC,GACnB,OAAO,SAASA,CAAO,EACxBA,GAAW,EAAU,QAClBA,IAAY,EAAI,YAAc,GAAGA,CAAO,YAFT,cCe3BC,EAAc,CAAC,CAC1B,SAAAC,EACA,KAAAC,EACA,SAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,CACF,IAAwB,CACtB,KAAM,CAAE,MAAAC,CAAA,EAAUC,EAAA,EACZ,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAAE,QAAAC,EAAS,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,CAAA,EAAaC,EAAuBf,EAAM,CAC9E,OAAAI,EACA,OAAQC,CAAA,CACT,EAEKW,EAAa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AC,GACxB1C,EAAO+B,GAAA,YAAAA,EAAO,QAAQ,KAAMQ,GAAMA,EAAE,KAAOE,EAAE,UACnD,OAAKzC,EAsBHkB,EAAAA,IAACpB,EAAA,CAEC,SAAU2C,EACV,KAAAzC,EACA,SAAU0B,IAAgBiB,EAC1B,SAAU,IAAMhB,EAAgBiB,GAASA,IAAQD,EAAM,KAAOA,CAAI,EAClE,OAAQ,IAAMN,EAAWI,EAAE,WAAW,EACtC,OAAArC,CAAA,EANKuC,CAAA,EArBL1B,EAAAA,KAAC,MAAA,CAEC,UAAU,0EAEV,SAAA,CAAAC,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,QAAS,IAAMmB,EAAWI,EAAE,WAAW,EACvC,aAAY,QAAQA,EAAE,WAAW,GACjC,UAAU,gDAEV,SAAAvB,EAAAA,IAACC,EAAA,CAAY,GAAIsB,EAAE,QAAA,CAAU,CAAA,CAAA,EAE/BvB,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA2B,WAAE,KAAK,QACjD,OAAA,CAAK,UAAU,uCACb,SAAAtB,EAAU6C,EAAE,OAAO,CAAA,CACtB,CAAA,CAAA,EAdKE,CAAA,CA6Bb,CAAC,CAAA,CACH,CAAA,EAEJ,CAEJ"}
1
+ {"version":3,"file":"index-Bz4Df_iX.js","sources":["../../../src/app/features/inbox/helpers.ts","../../../src/app/features/inbox/question-row.tsx","../../../src/app/features/inbox/inbox-page.tsx"],"sourcesContent":["export const formatAge = (ageDays: number): string => {\n if (!Number.isFinite(ageDays)) return 'age unknown';\n if (ageDays <= 0) return 'today';\n return ageDays === 1 ? '1 day ago' : `${ageDays} days ago`;\n};\n","import { FeedbackThread, PlanIdStamp } from '@/app/features/plans/components';\nimport { useSendFeedbackMessage } from '@/app/features/plans/hooks';\nimport type { ParkedQuestion, PlanEntry } from '@/types/index';\nimport { Button, Spinner, Textarea, useToast } from '@dendelion/paper-ui';\nimport { useState } from 'react';\nimport { formatAge } from './helpers';\n\ninterface QuestionRowProps {\n question: ParkedQuestion;\n plan: PlanEntry;\n expanded: boolean;\n onToggle: () => void;\n onOpen: () => void;\n reload: () => Promise<void>;\n}\n\nexport const QuestionRow = ({\n question,\n plan,\n expanded,\n onToggle,\n onOpen,\n reload,\n}: QuestionRowProps) => {\n const { toast } = useToast();\n const [input, setInput] = useState('');\n const { sending, send, undo, undoing, undoEdit } = useSendFeedbackMessage(plan, {\n reload,\n notify: toast,\n });\n\n const handleSend = async () => {\n if (!input.trim()) return;\n if (await send(input.trim())) setInput('');\n };\n\n return (\n <div className=\"border-b border-black/10 last:border-b-0\">\n <div className=\"flex items-center gap-3 py-2.5\">\n <button\n type=\"button\"\n onClick={onOpen}\n aria-label={`Open ${question.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={question.entityId} />\n </button>\n <button\n type=\"button\"\n onClick={onToggle}\n aria-expanded={expanded}\n className=\"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer\"\n >\n {question.text}\n </button>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">{formatAge(question.ageDays)}</span>\n </div>\n {expanded && (\n <div className=\"flex flex-col gap-3 pb-4\">\n <FeedbackThread\n messages={plan.thread ?? []}\n undo={undo}\n undoing={undoing}\n onUndo={undoEdit}\n />\n <Textarea\n value={input}\n onChange={(e) => setInput(e.target.value)}\n aria-label={`Reply to ${question.entityTitle}`}\n placeholder=\"Reply to resolve and resume…\"\n rows={2}\n disabled={sending}\n />\n <div className=\"flex justify-end items-center gap-3\">\n <span className={sending ? 'visible' : 'invisible'}>\n <Spinner size=\"small\" label=\"Agent replying…\" />\n </span>\n <Button size=\"small\" onClick={handleSend} disabled={sending || !input.trim()}>\n Reply\n </Button>\n </div>\n </div>\n )}\n </div>\n );\n};\n","import { PageTitle } from '@/app/components/page-title';\nimport { PlanIdStamp } from '@/app/features/plans/components';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { useNavigate } from '@tanstack/react-router';\nimport { useEffect, useState } from 'react';\nimport { formatAge } from './helpers';\nimport { QuestionRow } from './question-row';\n\nexport const InboxPage = () => {\n const [expandedKey, setExpandedKey] = useState<string | null>(null);\n const questions = useAppStore((s) => s.parkedQuestions);\n const loadFailed = useAppStore((s) => s.parkedQuestionsError !== null);\n const plans = useAppStore((s) => s.plans);\n const loadPlans = useAppStore((s) => s.loadPlans);\n const loadParkedQuestions = useAppStore((s) => s.loadParkedQuestions);\n const navigate = useNavigate();\n\n useEffect(() => {\n loadParkedQuestions();\n }, [loadParkedQuestions]);\n\n const reload = async () => {\n await Promise.all([loadPlans(), loadParkedQuestions()]);\n };\n\n const openEntity = (title: string) => {\n if (plans?.entries.some((p) => p.title === title)) {\n navigate({ to: '/plans/$planId', params: { planId: encodeURIComponent(title) } });\n } else {\n navigate({ to: '/ideas/$ideaId', params: { ideaId: encodeURIComponent(title) } });\n }\n };\n\n return (\n <div>\n <PageTitle>Inbox</PageTitle>\n <p className=\"opacity-50 mb-6\">\n Every open agent question, oldest first — parked decisions waiting on a human.\n </p>\n {loadFailed && <p className=\"opacity-50\">Couldn't load parked questions.</p>}\n {!loadFailed && !questions && <p className=\"opacity-50\">Loading…</p>}\n {questions && questions.length === 0 && (\n <p className=\"opacity-50\">Nothing parked — every agent question has an answer.</p>\n )}\n {questions && questions.length > 0 && (\n <div className=\"flex flex-col\">\n {questions.map((q, i) => {\n const key = `${q.entityId}-${i}`;\n const plan = plans?.entries.find((p) => p.id === q.entityId);\n if (!plan) {\n return (\n <div\n key={key}\n className=\"flex items-center gap-3 py-2.5 border-b border-black/10 last:border-b-0\"\n >\n <button\n type=\"button\"\n onClick={() => openEntity(q.entityTitle)}\n aria-label={`Open ${q.entityTitle}`}\n className=\"bg-transparent border-none p-0 cursor-pointer\"\n >\n <PlanIdStamp id={q.entityId} />\n </button>\n <span className=\"flex-1 min-w-0 truncate\">{q.text}</span>\n <span className=\"opacity-50 text-xs whitespace-nowrap\">\n {formatAge(q.ageDays)}\n </span>\n </div>\n );\n }\n return (\n <QuestionRow\n key={key}\n question={q}\n plan={plan}\n expanded={expandedKey === key}\n onToggle={() => setExpandedKey((cur) => (cur === key ? null : key))}\n onOpen={() => openEntity(q.entityTitle)}\n reload={reload}\n />\n );\n })}\n </div>\n )}\n </div>\n );\n};\n"],"names":["formatAge","ageDays","QuestionRow","question","plan","expanded","onToggle","onOpen","reload","toast","useToast","input","setInput","useState","sending","send","undo","undoing","undoEdit","useSendFeedbackMessage","handleSend","jsxs","jsx","PlanIdStamp","FeedbackThread","Textarea","e","Spinner","Button","InboxPage","expandedKey","setExpandedKey","questions","useAppStore","loadFailed","plans","loadPlans","loadParkedQuestions","navigate","useNavigate","useEffect","openEntity","title","p","PageTitle","q","i","key","cur"],"mappings":"oHAAO,MAAMA,EAAaC,GACnB,OAAO,SAASA,CAAO,EACxBA,GAAW,EAAU,QAClBA,IAAY,EAAI,YAAc,GAAGA,CAAO,YAFT,cCe3BC,EAAc,CAAC,CAC1B,SAAAC,EACA,KAAAC,EACA,SAAAC,EACA,SAAAC,EACA,OAAAC,EACA,OAAAC,CACF,IAAwB,CACtB,KAAM,CAAE,MAAAC,CAAA,EAAUC,EAAA,EACZ,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAS,EAAE,EAC/B,CAAE,QAAAC,EAAS,KAAAC,EAAM,KAAAC,EAAM,QAAAC,EAAS,SAAAC,CAAA,EAAaC,EAAuBf,EAAM,CAC9E,OAAAI,EACA,OAAQC,CAAA,CACT,EAEKW,EAAa,SAAY,CACxBT,EAAM,QACP,MAAMI,EAAKJ,EAAM,MAAM,KAAY,EAAE,CAC3C,EAEA,OACEU,EAAAA,KAAC,MAAA,CAAI,UAAU,2CACb,SAAA,CAAAA,EAAAA,KAAC,MAAA,CAAI,UAAU,iCACb,SAAA,CAAAC,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,QAASf,EACT,aAAY,QAAQJ,EAAS,WAAW,GACxC,UAAU,gDAEV,SAAAmB,EAAAA,IAACC,EAAA,CAAY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AA,EArBL1B,EAAAA,KAAC,MAAA,CAEC,UAAU,0EAEV,SAAA,CAAAC,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,QAAS,IAAMmB,EAAWI,EAAE,WAAW,EACvC,aAAY,QAAQA,EAAE,WAAW,GACjC,UAAU,gDAEV,SAAAvB,EAAAA,IAACC,EAAA,CAAY,GAAIsB,EAAE,QAAA,CAAU,CAAA,CAAA,EAE/BvB,EAAAA,IAAC,OAAA,CAAK,UAAU,0BAA2B,WAAE,KAAK,QACjD,OAAA,CAAK,UAAU,uCACb,SAAAtB,EAAU6C,EAAE,OAAO,CAAA,CACtB,CAAA,CAAA,EAdKE,CAAA,CA6Bb,CAAC,CAAA,CACH,CAAA,EAEJ,CAEJ"}
@@ -1,4 +1,4 @@
1
- import{u as S,m as L,r as d,k as T,j as e,E as z,v as D,J as v,F as O,G as M,a as B,B as U,H as C,P as E,M as $,w as _,U as y,S as b,I as V,o as I,K as F,g as G,L as H,N as q}from"./main-BW24wv9K.js";import{O as fe}from"./main-BW24wv9K.js";const w="__no-subject__",K=({horizonTitle:a,item:s,candidateName:t,onClose:r,onPromoted:l})=>{const c=S(n=>n.promoteRoadmapItem),o=S(n=>n.launchIdeaExtend),{subjects:f,available:p}=L(),[h,u]=d.useState(w),[j,g]=d.useState(!1),[x,N]=d.useState(null),{toast:R}=T();d.useEffect(()=>{s&&(u(t?s.name:w),g(!1),N(null))},[s,t]);const k=async()=>{if(!(!s||!a)){g(!0),N(null);try{const n=await c(a,s,h===w?void 0:h,t??void 0),i=S.getState().ideaEntries.find(m=>m.id===n);if(i)try{await o(n,O(i,a))}catch(m){R({title:"Idea created, but the refine agent failed to launch",description:M(m.message),variant:"error"})}l(),r()}catch(n){N(n.message)}finally{g(!1)}}};return e.jsx(z,{open:s!==null,onClose:r,title:t??(s==null?void 0:s.name)??"",size:"small",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[!t&&e.jsx("p",{className:"m-0 opacity-80",children:s==null?void 0:s.description}),e.jsx("div",{children:e.jsx(D,{size:"small",value:h,onChange:u,disabled:j||!p,options:[{value:w,label:"No subject"},...!p&&h!==w?[{value:h,label:h}]:[],...f.map(n=>({value:n,label:n}))]})}),x&&e.jsx("p",{className:"m-0 text-watercolor-rose-dark text-sm",children:x}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",onClick:r,disabled:j,children:"Cancel"}),e.jsx(v,{type:"button",variant:"primary",onClick:k,disabled:j,children:j?"Promoting…":"Promote to idea"})]})]})})},J=a=>({shipped:a.filter(s=>s.status==="done").length,queued:a.filter(s=>s.status!=="done"&&s.status!=="dropped").length}),A="font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0",W="text-2xs font-normal px-1 py-0 opacity-50",Z=({size:a=14})=>e.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),Q=({name:a,onPromote:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex-1",children:a}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:s,children:"Promote to idea"})]})}),X=({onAdd:a})=>{const[s,t]=d.useState(""),[r,l]=d.useState(!1),c=async()=>{if(s.trim()){l(!0);try{await a(s.trim()),t("")}finally{l(!1)}}};return e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{size:"small",value:s,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&c()},placeholder:"Add option…",disabled:r,className:"flex-1"}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:c,disabled:r||!s.trim(),children:"Add"})]})},Y=({onAdd:a})=>{const[s,t]=d.useState(!1),[r,l]=d.useState(""),[c,o]=d.useState(""),[f,p]=d.useState(!1),h=async()=>{if(r.trim()){p(!0);try{await a(r.trim(),c.trim()),l(""),o(""),t(!1)}finally{p(!1)}}};return s?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(I,{size:"small",value:r,onChange:u=>l(u.target.value),placeholder:"Item name…",disabled:f,autoFocus:!0}),e.jsx(I,{size:"small",value:c,onChange:u=>o(u.target.value),onKeyDown:u=>{u.key==="Enter"&&h()},placeholder:"Description…",disabled:f}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!1),disabled:f,children:"Cancel"}),e.jsx(v,{type:"button",size:"small",onClick:h,disabled:f||!r.trim(),children:"Add"})]})]}):e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!0),children:"+ Add item"})},ee=(a,s)=>`${a} ${s}${a===1?"":"s"}`,ae=({link:a})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(G,{content:`${ee(a.taskRuns,"task run")}${a.released?" · released":""}`,children:e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:a.id})}),a.pr&&e.jsx(H,{pr:a.pr})]}),se=({plan:a,onOpen:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-3 w-full bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left",children:[e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:a.title}),e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:q[a.status]})]})}),te=({item:a,graduated:s,highlighted:t,onPromote:r,onPromoteCandidate:l,onAddCandidate:c,onViewGraduated:o,onOpenGraduated:f})=>{const[p,h]=d.useState(t),u=a.candidates.length>0,{shipped:j,queued:g}=J(s);return e.jsxs("div",{className:`flex flex-col gap-1 ${t?"roadmap-item-highlighted outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":""}`,children:[e.jsx(_,{size:"small",texture:"canvas",className:"plan-row-card",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button","aria-expanded":p,"aria-label":p?"Collapse item":"Expand item",onClick:()=>h(x=>!x),className:`inline-flex items-center bg-transparent border-none cursor-pointer opacity-50 p-0 ${p?"rotate-90":""}`,children:e.jsx(Z,{})}),e.jsx("span",{className:"font-semibold flex-1",children:a.name}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:r,children:"Promote to idea"})]}),e.jsx("span",{className:`text-sm opacity-70 ${p?"":"line-clamp-2"}`,children:a.description}),e.jsxs("div",{className:"flex items-center gap-1",children:[(g>0||j>0)&&e.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 bg-transparent border-none p-0 cursor-pointer",children:[g>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[g," in queue"]}),j>0&&e.jsxs(y,{size:"small",fillColor:b.done.fill,textColor:b.done.text,children:[j," shipped"]})]}),u&&e.jsxs(y,{size:"small",fillColor:"rgba(0, 0, 0, 0.06)",textColor:"rgba(0, 0, 0, 0.55)",children:[a.candidates.length," candidate",a.candidates.length===1?"":"s"]}),a.rollup.total>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[a.rollup.done,"/",a.rollup.total," done"]})]}),a.links.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:a.links.map(x=>e.jsx(ae,{link:x},x.id))})]})}),p&&e.jsxs("div",{className:"flex flex-col gap-1 pl-6",children:[a.candidates.map(x=>e.jsx(Q,{name:x,onPromote:()=>l(x)},x)),s.map(x=>e.jsx(se,{plan:x,onOpen:()=>f(x.title)},x.title)),e.jsx(X,{onAdd:c})]})]})},le=({goal:a})=>{const[s,t]=d.useState(!1),[r,...l]=a.split(/\n{2,}/),c=l.length>0;return e.jsxs("div",{className:"mb-6 pb-4 border-b border-black/[8%]",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:"The goal"}),e.jsxs("div",{className:"font-display-luminari text-lg leading-[1.4] mt-2",children:[e.jsx("div",{className:s?void 0:"line-clamp-1",children:e.jsx($,{children:r})}),s&&c&&e.jsx($,{children:l.join(`
1
+ import{u as S,m as L,r as d,k as T,j as e,E as z,v as D,J as v,F as O,G as M,a as B,B as U,H as C,P as E,M as $,w as _,U as y,S as b,I as V,o as I,K as F,g as G,L as H,N as q}from"./main-Ba3mXsWY.js";import{O as fe}from"./main-Ba3mXsWY.js";const w="__no-subject__",K=({horizonTitle:a,item:s,candidateName:t,onClose:r,onPromoted:l})=>{const c=S(n=>n.promoteRoadmapItem),o=S(n=>n.launchIdeaExtend),{subjects:f,available:p}=L(),[h,u]=d.useState(w),[j,g]=d.useState(!1),[x,N]=d.useState(null),{toast:R}=T();d.useEffect(()=>{s&&(u(t?s.name:w),g(!1),N(null))},[s,t]);const k=async()=>{if(!(!s||!a)){g(!0),N(null);try{const n=await c(a,s,h===w?void 0:h,t??void 0),i=S.getState().ideaEntries.find(m=>m.id===n);if(i)try{await o(n,O(i,a))}catch(m){R({title:"Idea created, but the refine agent failed to launch",description:M(m.message),variant:"error"})}l(),r()}catch(n){N(n.message)}finally{g(!1)}}};return e.jsx(z,{open:s!==null,onClose:r,title:t??(s==null?void 0:s.name)??"",size:"small",children:e.jsxs("div",{className:"flex flex-col gap-4",children:[!t&&e.jsx("p",{className:"m-0 opacity-80",children:s==null?void 0:s.description}),e.jsx("div",{children:e.jsx(D,{size:"small",value:h,onChange:u,disabled:j||!p,options:[{value:w,label:"No subject"},...!p&&h!==w?[{value:h,label:h}]:[],...f.map(n=>({value:n,label:n}))]})}),x&&e.jsx("p",{className:"m-0 text-watercolor-rose-dark text-sm",children:x}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",onClick:r,disabled:j,children:"Cancel"}),e.jsx(v,{type:"button",variant:"primary",onClick:k,disabled:j,children:j?"Promoting…":"Promote to idea"})]})]})})},J=a=>({shipped:a.filter(s=>s.status==="done").length,queued:a.filter(s=>s.status!=="done"&&s.status!=="dropped").length}),A="font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0",W="text-2xs font-normal px-1 py-0 opacity-50",Z=({size:a=14})=>e.jsx("svg",{width:a,height:a,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),Q=({name:a,onPromote:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("span",{className:"flex-1",children:a}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:s,children:"Promote to idea"})]})}),X=({onAdd:a})=>{const[s,t]=d.useState(""),[r,l]=d.useState(!1),c=async()=>{if(s.trim()){l(!0);try{await a(s.trim()),t("")}finally{l(!1)}}};return e.jsxs("div",{className:"flex gap-2",children:[e.jsx(I,{size:"small",value:s,onChange:o=>t(o.target.value),onKeyDown:o=>{o.key==="Enter"&&c()},placeholder:"Add option…",disabled:r,className:"flex-1"}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:c,disabled:r||!s.trim(),children:"Add"})]})},Y=({onAdd:a})=>{const[s,t]=d.useState(!1),[r,l]=d.useState(""),[c,o]=d.useState(""),[f,p]=d.useState(!1),h=async()=>{if(r.trim()){p(!0);try{await a(r.trim(),c.trim()),l(""),o(""),t(!1)}finally{p(!1)}}};return s?e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(I,{size:"small",value:r,onChange:u=>l(u.target.value),placeholder:"Item name…",disabled:f,autoFocus:!0}),e.jsx(I,{size:"small",value:c,onChange:u=>o(u.target.value),onKeyDown:u=>{u.key==="Enter"&&h()},placeholder:"Description…",disabled:f}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!1),disabled:f,children:"Cancel"}),e.jsx(v,{type:"button",size:"small",onClick:h,disabled:f||!r.trim(),children:"Add"})]})]}):e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:()=>t(!0),children:"+ Add item"})},ee=(a,s)=>`${a} ${s}${a===1?"":"s"}`,ae=({link:a})=>e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx(G,{content:`${ee(a.taskRuns,"task run")}${a.released?" · released":""}`,children:e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:a.id})}),a.pr&&e.jsx(H,{pr:a.pr})]}),se=({plan:a,onOpen:s})=>e.jsx(_,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("button",{type:"button",onClick:s,className:"flex items-center gap-3 w-full bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left",children:[e.jsx("span",{className:"flex-1 overflow-hidden text-ellipsis whitespace-nowrap",children:a.title}),e.jsx(y,{size:"small",fillColor:b[a.status].fill,textColor:b[a.status].text,children:q[a.status]})]})}),te=({item:a,graduated:s,highlighted:t,onPromote:r,onPromoteCandidate:l,onAddCandidate:c,onViewGraduated:o,onOpenGraduated:f})=>{const[p,h]=d.useState(t),u=a.candidates.length>0,{shipped:j,queued:g}=J(s);return e.jsxs("div",{className:`flex flex-col gap-1 ${t?"roadmap-item-highlighted outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":""}`,children:[e.jsx(_,{size:"small",texture:"canvas",className:"plan-row-card",children:e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("button",{type:"button","aria-expanded":p,"aria-label":p?"Collapse item":"Expand item",onClick:()=>h(x=>!x),className:`inline-flex items-center bg-transparent border-none cursor-pointer opacity-50 p-0 ${p?"rotate-90":""}`,children:e.jsx(Z,{})}),e.jsx("span",{className:"font-semibold flex-1",children:a.name}),e.jsx(v,{type:"button",variant:"ghost",size:"small",onClick:r,children:"Promote to idea"})]}),e.jsx("span",{className:`text-sm opacity-70 ${p?"":"line-clamp-2"}`,children:a.description}),e.jsxs("div",{className:"flex items-center gap-1",children:[(g>0||j>0)&&e.jsxs("button",{type:"button",onClick:o,className:"flex items-center gap-1 bg-transparent border-none p-0 cursor-pointer",children:[g>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[g," in queue"]}),j>0&&e.jsxs(y,{size:"small",fillColor:b.done.fill,textColor:b.done.text,children:[j," shipped"]})]}),u&&e.jsxs(y,{size:"small",fillColor:"rgba(0, 0, 0, 0.06)",textColor:"rgba(0, 0, 0, 0.55)",children:[a.candidates.length," candidate",a.candidates.length===1?"":"s"]}),a.rollup.total>0&&e.jsxs(y,{size:"small",fillColor:b.planned.fill,textColor:b.planned.text,children:[a.rollup.done,"/",a.rollup.total," done"]})]}),a.links.length>0&&e.jsx("div",{className:"flex items-center gap-1 flex-wrap",children:a.links.map(x=>e.jsx(ae,{link:x},x.id))})]})}),p&&e.jsxs("div",{className:"flex flex-col gap-1 pl-6",children:[a.candidates.map(x=>e.jsx(Q,{name:x,onPromote:()=>l(x)},x)),s.map(x=>e.jsx(se,{plan:x,onOpen:()=>f(x.title)},x.title)),e.jsx(X,{onAdd:c})]})]})},le=({goal:a})=>{const[s,t]=d.useState(!1),[r,...l]=a.split(/\n{2,}/),c=l.length>0;return e.jsxs("div",{className:"mb-6 pb-4 border-b border-black/[8%]",children:[e.jsx("span",{className:"font-handwritten text-xs font-semibold opacity-[0.55]",children:"The goal"}),e.jsxs("div",{className:"font-display-luminari text-lg leading-[1.4] mt-2",children:[e.jsx("div",{className:s?void 0:"line-clamp-1",children:e.jsx($,{children:r})}),s&&c&&e.jsx($,{children:l.join(`
2
2
 
3
3
  `)})]}),c&&e.jsx("button",{type:"button",onClick:()=>t(o=>!o),className:"bg-transparent border-none p-0 mt-2 cursor-pointer text-2xs opacity-[0.65] underline",children:s?"Show less":"Show more"})]})},ne=[{id:"tree",label:"Outline"},{id:"map",label:"Board"},{id:"timeline",label:"Timeline"}],re=({mode:a,onChange:s})=>e.jsx("nav",{"aria-label":"Roadmap view",className:"flex gap-1 mb-4",children:ne.map(t=>e.jsx(v,{type:"button",variant:"ghost",size:"small",isActive:a===t.id,"aria-pressed":a===t.id,onClick:()=>s(t.id),children:t.label},t.id))}),P=({items:a,graduatedByItem:s})=>{const t=a.filter(l=>s(l).length>0).length,r=a.length-t;return e.jsxs("div",{className:W,children:[t," graduated · ",r," charted"]})},oe={created:"bg-watercolor-slate","task-run":"bg-watercolor-amber"},ie=({events:a,rangeStart:s,rangeEnd:t})=>{const r=t-s||1;return e.jsx("div",{className:"relative h-8 mx-1 border-b border-black/10",children:a.map((l,c)=>e.jsx("button",{type:"button",className:`absolute top-1/2 w-2.5 h-2.5 p-0 border-none rounded-full -translate-x-1/2 -translate-y-1/2 cursor-pointer ${oe[l.kind]}`,style:{left:`${(Date.parse(l.date)-s)/r*100}%`},title:`${l.itemName} — ${l.label} (${l.date})`,"aria-label":`${l.itemName} — ${l.label} (${l.date})`},`${l.entityId}-${l.kind}-${c}`))})},de=({item:a})=>{const s=a.rollup.total>0?Math.round(a.rollup.done/a.rollup.total*100):0;return e.jsxs("div",{className:"flex flex-col gap-1 py-2 px-2.5",children:[e.jsx("div",{className:"font-semibold text-sm",children:a.name}),e.jsx("div",{className:"h-1.5 rounded-full bg-black/[0.08] overflow-hidden",children:e.jsx("div",{className:`h-full rounded-full ${a.rollup.total>0?"bg-watercolor-green":"bg-transparent"}`,style:{width:`${s}%`}})}),e.jsx("div",{className:"text-2xs opacity-50",children:a.rollup.total>0?`${a.rollup.done}/${a.rollup.total} done`:"not started"})]})},ce=({roadmap:a,graduatedByItem:s})=>e.jsx("div",{className:"flex flex-col gap-6",children:a.horizons.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("div",{className:A,children:t.title}),e.jsx(P,{items:t.items,graduatedByItem:s})]}),e.jsx("div",{className:"flex flex-wrap items-start gap-2.5",children:t.items.map(r=>e.jsx("div",{className:"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(de,{item:r})},r.name))})]},t.title))}),xe=({roadmap:a})=>{if(a.events.length===0)return e.jsx("p",{className:"opacity-50",children:"No dated events yet."});const s=a.events.map(l=>Date.parse(l.date)),t=Math.min(...s),r=Math.max(...s);return e.jsxs("div",{className:"flex flex-col gap-6",children:[a.horizons.map(l=>{const c=a.events.filter(o=>o.horizonTitle===l.title);return e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx("div",{className:A,children:l.title}),c.length===0?e.jsx("div",{className:"text-2xs font-normal px-1 py-0 opacity-40",children:"No events yet"}):e.jsx(ie,{events:c,rangeStart:t,rangeEnd:r})]},l.title)}),e.jsxs("div",{className:"flex justify-between text-2xs opacity-50",children:[e.jsx("span",{children:new Date(t).toLocaleDateString()}),e.jsx("span",{children:new Date(r).toLocaleDateString()})]})]})},me=()=>{const[a,s]=d.useState(null),[t,r]=d.useState(!0),[l,c]=d.useState(!1),[o,f]=d.useState(null),[p,h]=d.useState("tree"),u=S(n=>n.plans),j=B(),{item:g}=U({from:"/roadmap"}),x=d.useRef(null);if(d.useEffect(()=>{C().then(s).catch(()=>c(!0)).finally(()=>r(!1))},[]),d.useEffect(()=>{var i;if(!g||t)return;const n=(i=x.current)==null?void 0:i.querySelector(".roadmap-item-highlighted");n==null||n.scrollIntoView({behavior:"smooth",block:"center"})},[g,t]),t)return e.jsxs("div",{children:[e.jsx(E,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"Loading…"})]});if(l)return e.jsxs("div",{children:[e.jsx(E,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"Couldn't load the roadmap — the server may need a restart to pick up new routes."})]});if(!a||a.horizons.length===0)return e.jsxs("div",{children:[e.jsx(E,{children:"Roadmap"}),e.jsx("p",{className:"opacity-50",children:"No `ROADMAP.md` found at the project root."})]});const N=n=>(u==null?void 0:u.entries.filter(i=>i.subject===n.name))??[],R=async(n,i,m)=>{await F(n,i,m),s(await C())},k=async(n,i,m)=>{await V(n,i,m),s(await C())};return e.jsxs("div",{ref:x,children:[e.jsx(le,{goal:a.goal}),e.jsx(re,{mode:p,onChange:h}),p==="tree"&&e.jsx("div",{className:"flex flex-col gap-6",children:a.horizons.map(n=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2",children:[e.jsx("div",{className:A,children:n.title}),e.jsx(P,{items:n.items,graduatedByItem:N})]}),e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5",children:[n.items.map(i=>e.jsx("div",{className:"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(te,{item:i,graduated:N(i),highlighted:i.name===g,onPromote:()=>f({horizonTitle:n.title,item:i}),onPromoteCandidate:m=>f({horizonTitle:n.title,item:i,candidateName:m}),onAddCandidate:m=>k(n.title,i.name,m),onViewGraduated:()=>j({to:"/",search:{subject:i.name}}),onOpenGraduated:m=>j({to:"/plans/$planId",params:{planId:encodeURIComponent(m)}})})},i.name)),e.jsx("div",{className:"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none",children:e.jsx(Y,{onAdd:(i,m)=>R(n.title,i,m)})})]})]},n.title))}),p==="map"&&e.jsx(ce,{roadmap:a,graduatedByItem:N}),p==="timeline"&&e.jsx(xe,{roadmap:a}),e.jsx(K,{horizonTitle:(o==null?void 0:o.horizonTitle)??null,item:(o==null?void 0:o.item)??null,candidateName:o==null?void 0:o.candidateName,onClose:()=>f(null),onPromoted:()=>C().then(s)})]})};export{me as RoadmapPage,fe as useRoadmapItemNames};
4
- //# sourceMappingURL=index-Bi4fur5H.js.map
4
+ //# sourceMappingURL=index-C6vBW0wx.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index-Bi4fur5H.js","sources":["../../../src/app/features/roadmap/promote-roadmap-item-modal.tsx","../../../src/app/features/roadmap/roadmap-page.tsx"],"sourcesContent":["import { buildRoadmapPromotePrompt } from '@/app/features/plans/prompts';\nimport { useSubjectVocabulary } from '@/app/hooks/use-subject-vocabulary';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { oneLineErrorSummary } from '@/app/utils/error-summary';\nimport type { RoadmapItem } from '@/types/index';\nimport { Button, Modal, Select, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nconst NO_SUBJECT = '__no-subject__';\n\ninterface PromoteRoadmapItemModalProps {\n horizonTitle: string | null;\n item: RoadmapItem | null;\n candidateName?: string | null;\n onClose: () => void;\n onPromoted: () => void;\n}\n\nexport const PromoteRoadmapItemModal = ({\n horizonTitle,\n item,\n candidateName,\n onClose,\n onPromoted,\n}: PromoteRoadmapItemModalProps) => {\n const promoteRoadmapItem = useAppStore((s) => s.promoteRoadmapItem);\n const launchIdeaExtend = useAppStore((s) => s.launchIdeaExtend);\n const { subjects, available: subjectsAvailable } = useSubjectVocabulary();\n const [subject, setSubject] = useState(NO_SUBJECT);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const { toast } = useToast();\n\n useEffect(() => {\n if (item) {\n // A candidate defaults to its parent item's name — the \"big bet becomes a\n // Subject\" rule — but the picker still lets the user override it.\n setSubject(candidateName ? item.name : NO_SUBJECT);\n setLoading(false);\n setError(null);\n }\n }, [item, candidateName]);\n\n const handlePromote = async () => {\n if (!item || !horizonTitle) return;\n setLoading(true);\n setError(null);\n try {\n const id = await promoteRoadmapItem(\n horizonTitle,\n item,\n subject === NO_SUBJECT ? undefined : subject,\n candidateName ?? undefined,\n );\n const idea = useAppStore.getState().ideaEntries.find((e) => e.id === id);\n if (idea) {\n try {\n await launchIdeaExtend(id, buildRoadmapPromotePrompt(idea, horizonTitle));\n } catch (err) {\n // The idea was created either way — a failed refine launch just means\n // no background research ran, not that the promotion itself failed.\n toast({\n title: 'Idea created, but the refine agent failed to launch',\n description: oneLineErrorSummary((err as Error).message),\n variant: 'error',\n });\n }\n }\n onPromoted();\n onClose();\n } catch (err) {\n setError((err as Error).message);\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Modal\n open={item !== null}\n onClose={onClose}\n title={candidateName ?? item?.name ?? ''}\n size=\"small\"\n >\n <div className=\"flex flex-col gap-4\">\n {!candidateName && <p className=\"m-0 opacity-80\">{item?.description}</p>}\n <div>\n <Select\n size=\"small\"\n value={subject}\n onChange={setSubject}\n disabled={loading || !subjectsAvailable}\n options={[\n { value: NO_SUBJECT, label: 'No subject' },\n ...(!subjectsAvailable && subject !== NO_SUBJECT\n ? [{ value: subject, label: subject }]\n : []),\n ...subjects.map((s) => ({ value: s, label: s })),\n ]}\n />\n </div>\n {error && <p className=\"m-0 text-watercolor-rose-dark text-sm\">{error}</p>}\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose} disabled={loading}>\n Cancel\n </Button>\n <Button type=\"button\" variant=\"primary\" onClick={handlePromote} disabled={loading}>\n {loading ? 'Promoting…' : 'Promote to idea'}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","import { Markdown } from '@/app/components/markdown';\nimport { PageTitle } from '@/app/components/page-title';\nimport { PrBadge } from '@/app/features/plans/components/pr-badge';\nimport { STATUS_LABEL, STATUS_STAMP } from '@/app/features/plans/constants';\nimport { addRoadmapCandidate, addRoadmapItem, fetchRoadmap } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport type {\n PlanEntry,\n ResolvedRoadmap,\n ResolvedRoadmapItem,\n RoadmapEvent,\n RoadmapEventKind,\n RoadmapLink,\n} from '@/types/index';\nimport { Button, Card, Input, Stamp, Tooltip } from '@dendelion/paper-ui';\nimport { useNavigate, useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { PromoteRoadmapItemModal } from './promote-roadmap-item-modal';\n\nconst graduationCounts = (graduated: PlanEntry[]) => ({\n shipped: graduated.filter((p) => p.status === 'done').length,\n queued: graduated.filter((p) => p.status !== 'done' && p.status !== 'dropped').length,\n});\n\nconst HORIZON_HEADER_CLASSES =\n 'font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0';\n\nconst HORIZON_PULSE_CLASSES = 'text-2xs font-normal px-1 py-0 opacity-50';\n\nconst ChevronRightIcon = ({ size = 14 }: { size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\nconst CandidateRow = ({\n name,\n onPromote,\n}: {\n name: string;\n onPromote: () => void;\n}) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className=\"flex items-center gap-3\">\n <span className=\"flex-1\">{name}</span>\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={onPromote}>\n Promote to idea\n </Button>\n </div>\n </Card>\n);\n\nconst AddCandidateForm = ({ onAdd }: { onAdd: (name: string) => Promise<void> }) => {\n const [name, setName] = useState('');\n const [saving, setSaving] = useState(false);\n\n const handleAdd = async () => {\n if (!name.trim()) return;\n setSaving(true);\n try {\n await onAdd(name.trim());\n setName('');\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <div className=\"flex gap-2\">\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Add option…\"\n disabled={saving}\n className=\"flex-1\"\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={handleAdd}\n disabled={saving || !name.trim()}\n >\n Add\n </Button>\n </div>\n );\n};\n\nconst AddItemForm = ({\n onAdd,\n}: {\n onAdd: (name: string, description: string) => Promise<void>;\n}) => {\n const [open, setOpen] = useState(false);\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n const [saving, setSaving] = useState(false);\n\n const handleAdd = async () => {\n if (!name.trim()) return;\n setSaving(true);\n try {\n await onAdd(name.trim(), description.trim());\n setName('');\n setDescription('');\n setOpen(false);\n } finally {\n setSaving(false);\n }\n };\n\n if (!open) {\n return (\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={() => setOpen(true)}>\n + Add item\n </Button>\n );\n }\n\n return (\n <div className=\"flex flex-col gap-2\">\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder=\"Item name…\"\n disabled={saving}\n autoFocus\n />\n <Input\n size=\"small\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Description…\"\n disabled={saving}\n />\n <div className=\"flex justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={() => setOpen(false)}\n disabled={saving}\n >\n Cancel\n </Button>\n <Button type=\"button\" size=\"small\" onClick={handleAdd} disabled={saving || !name.trim()}>\n Add\n </Button>\n </div>\n </div>\n );\n};\n\nconst plural = (count: number, noun: string) => `${count} ${noun}${count === 1 ? '' : 's'}`;\n\nconst RoadmapLinkTrail = ({ link }: { link: RoadmapLink }) => (\n <div className=\"flex items-center gap-1\">\n <Tooltip content={`${plural(link.taskRuns, 'task run')}${link.released ? ' · released' : ''}`}>\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP[link.status].fill}\n textColor={STATUS_STAMP[link.status].text}\n >\n {link.id}\n </Stamp>\n </Tooltip>\n {link.pr && <PrBadge pr={link.pr} />}\n </div>\n);\n\nconst GraduatedRow = ({ plan, onOpen }: { plan: PlanEntry; onOpen: () => void }) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"flex items-center gap-3 w-full bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left\"\n >\n <span className=\"flex-1 overflow-hidden text-ellipsis whitespace-nowrap\">{plan.title}</span>\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP[plan.status].fill}\n textColor={STATUS_STAMP[plan.status].text}\n >\n {STATUS_LABEL[plan.status]}\n </Stamp>\n </button>\n </Card>\n);\n\nconst RoadmapItemRow = ({\n item,\n graduated,\n highlighted,\n onPromote,\n onPromoteCandidate,\n onAddCandidate,\n onViewGraduated,\n onOpenGraduated,\n}: {\n item: ResolvedRoadmapItem;\n graduated: PlanEntry[];\n highlighted: boolean;\n onPromote: () => void;\n onPromoteCandidate: (candidateName: string) => void;\n onAddCandidate: (name: string) => Promise<void>;\n onViewGraduated: () => void;\n onOpenGraduated: (title: string) => void;\n}) => {\n const [expanded, setExpanded] = useState(highlighted);\n const hasCandidates = item.candidates.length > 0;\n const { shipped, queued } = graduationCounts(graduated);\n\n return (\n <div\n className={`flex flex-col gap-1 ${highlighted ? 'roadmap-item-highlighted outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]' : ''}`}\n >\n <Card size=\"small\" texture=\"canvas\" className=\"plan-row-card\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-2\">\n {/* Raw <button>: icon-only toggle, paper-ui Button doesn't offer this compact chrome. */}\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-label={expanded ? 'Collapse item' : 'Expand item'}\n onClick={() => setExpanded((v) => !v)}\n className={`inline-flex items-center bg-transparent border-none cursor-pointer opacity-50 p-0 ${expanded ? 'rotate-90' : ''}`}\n >\n <ChevronRightIcon />\n </button>\n <span className=\"font-semibold flex-1\">{item.name}</span>\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={onPromote}>\n Promote to idea\n </Button>\n </div>\n <span className={`text-sm opacity-70 ${expanded ? '' : 'line-clamp-2'}`}>\n {item.description}\n </span>\n <div className=\"flex items-center gap-1\">\n {(queued > 0 || shipped > 0) && (\n <button\n type=\"button\"\n onClick={onViewGraduated}\n className=\"flex items-center gap-1 bg-transparent border-none p-0 cursor-pointer\"\n >\n {queued > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.planned.fill}\n textColor={STATUS_STAMP.planned.text}\n >\n {queued} in queue\n </Stamp>\n )}\n {shipped > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.done.fill}\n textColor={STATUS_STAMP.done.text}\n >\n {shipped} shipped\n </Stamp>\n )}\n </button>\n )}\n {hasCandidates && (\n <Stamp size=\"small\" fillColor=\"rgba(0, 0, 0, 0.06)\" textColor=\"rgba(0, 0, 0, 0.55)\">\n {item.candidates.length} candidate{item.candidates.length === 1 ? '' : 's'}\n </Stamp>\n )}\n {item.rollup.total > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.planned.fill}\n textColor={STATUS_STAMP.planned.text}\n >\n {item.rollup.done}/{item.rollup.total} done\n </Stamp>\n )}\n </div>\n {item.links.length > 0 && (\n <div className=\"flex items-center gap-1 flex-wrap\">\n {item.links.map((link) => (\n <RoadmapLinkTrail key={link.id} link={link} />\n ))}\n </div>\n )}\n </div>\n </Card>\n {expanded && (\n <div className=\"flex flex-col gap-1 pl-6\">\n {item.candidates.map((candidateName) => (\n <CandidateRow\n key={candidateName}\n name={candidateName}\n onPromote={() => onPromoteCandidate(candidateName)}\n />\n ))}\n {graduated.map((plan) => (\n <GraduatedRow key={plan.title} plan={plan} onOpen={() => onOpenGraduated(plan.title)} />\n ))}\n <AddCandidateForm onAdd={onAddCandidate} />\n </div>\n )}\n </div>\n );\n};\n\nconst GoalBanner = ({ goal }: { goal: string }) => {\n const [expanded, setExpanded] = useState(false);\n const [firstParagraph, ...restParagraphs] = goal.split(/\\n{2,}/);\n const hasMore = restParagraphs.length > 0;\n\n return (\n <div className=\"mb-6 pb-4 border-b border-black/[8%]\">\n <span className=\"font-handwritten text-xs font-semibold opacity-[0.55]\">The goal</span>\n <div className=\"font-display-luminari text-lg leading-[1.4] mt-2\">\n <div className={expanded ? undefined : 'line-clamp-1'}>\n <Markdown>{firstParagraph}</Markdown>\n </div>\n {expanded && hasMore && <Markdown>{restParagraphs.join('\\n\\n')}</Markdown>}\n </div>\n {hasMore && (\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"bg-transparent border-none p-0 mt-2 cursor-pointer text-2xs opacity-[0.65] underline\"\n >\n {expanded ? 'Show less' : 'Show more'}\n </button>\n )}\n </div>\n );\n};\n\ntype RoadmapViewMode = 'tree' | 'map' | 'timeline';\n\nconst VIEW_MODES: { id: RoadmapViewMode; label: string }[] = [\n { id: 'tree', label: 'Outline' },\n { id: 'map', label: 'Board' },\n { id: 'timeline', label: 'Timeline' },\n];\n\nconst RoadmapViewModeSwitch = ({\n mode,\n onChange,\n}: {\n mode: RoadmapViewMode;\n onChange: (mode: RoadmapViewMode) => void;\n}) => (\n <nav aria-label=\"Roadmap view\" className=\"flex gap-1 mb-4\">\n {VIEW_MODES.map((viewMode) => (\n <Button\n key={viewMode.id}\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n isActive={mode === viewMode.id}\n aria-pressed={mode === viewMode.id}\n onClick={() => onChange(viewMode.id)}\n >\n {viewMode.label}\n </Button>\n ))}\n </nav>\n);\n\nconst HorizonPulse = ({\n items,\n graduatedByItem,\n}: {\n items: ResolvedRoadmapItem[];\n graduatedByItem: (item: ResolvedRoadmapItem) => PlanEntry[];\n}) => {\n const graduated = items.filter((item) => graduatedByItem(item).length > 0).length;\n const charted = items.length - graduated;\n return (\n <div className={HORIZON_PULSE_CLASSES}>\n {graduated} graduated · {charted} charted\n </div>\n );\n};\n\nconst EVENT_KIND_COLOR: Record<RoadmapEventKind, string> = {\n created: 'bg-watercolor-slate',\n 'task-run': 'bg-watercolor-amber',\n};\n\nconst RoadmapTimelineTrack = ({\n events,\n rangeStart,\n rangeEnd,\n}: {\n events: RoadmapEvent[];\n rangeStart: number;\n rangeEnd: number;\n}) => {\n const span = rangeEnd - rangeStart || 1;\n return (\n <div className=\"relative h-8 mx-1 border-b border-black/10\">\n {events.map((event, i) => (\n <button\n type=\"button\"\n key={`${event.entityId}-${event.kind}-${i}`}\n className={`absolute top-1/2 w-2.5 h-2.5 p-0 border-none rounded-full -translate-x-1/2 -translate-y-1/2 cursor-pointer ${EVENT_KIND_COLOR[event.kind]}`}\n style={{\n left: `${((Date.parse(event.date) - rangeStart) / span) * 100}%`,\n }}\n title={`${event.itemName} — ${event.label} (${event.date})`}\n aria-label={`${event.itemName} — ${event.label} (${event.date})`}\n />\n ))}\n </div>\n );\n};\n\nconst RoadmapMapItem = ({ item }: { item: ResolvedRoadmapItem }) => {\n const percent =\n item.rollup.total > 0 ? Math.round((item.rollup.done / item.rollup.total) * 100) : 0;\n return (\n <div className=\"flex flex-col gap-1 py-2 px-2.5\">\n <div className=\"font-semibold text-sm\">{item.name}</div>\n <div className=\"h-1.5 rounded-full bg-black/[0.08] overflow-hidden\">\n <div\n className={`h-full rounded-full ${item.rollup.total > 0 ? 'bg-watercolor-green' : 'bg-transparent'}`}\n style={{\n width: `${percent}%`,\n }}\n />\n </div>\n <div className=\"text-2xs opacity-50\">\n {item.rollup.total > 0 ? `${item.rollup.done}/${item.rollup.total} done` : 'not started'}\n </div>\n </div>\n );\n};\n\nconst RoadmapMap = ({\n roadmap,\n graduatedByItem,\n}: {\n roadmap: ResolvedRoadmap;\n graduatedByItem: (item: ResolvedRoadmapItem) => PlanEntry[];\n}) => (\n <div className=\"flex flex-col gap-6\">\n {roadmap.horizons.map((horizon) => (\n <div key={horizon.title} className=\"flex flex-col gap-1\">\n <div className=\"flex items-baseline gap-2\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n <HorizonPulse items={horizon.items} graduatedByItem={graduatedByItem} />\n </div>\n <div className=\"flex flex-wrap items-start gap-2.5\">\n {horizon.items.map((item) => (\n <div\n key={item.name}\n className=\"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\"\n >\n <RoadmapMapItem item={item} />\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n);\n\nconst RoadmapTimeline = ({ roadmap }: { roadmap: ResolvedRoadmap }) => {\n if (roadmap.events.length === 0) {\n return <p className=\"opacity-50\">No dated events yet.</p>;\n }\n\n const dates = roadmap.events.map((event) => Date.parse(event.date));\n const rangeStart = Math.min(...dates);\n const rangeEnd = Math.max(...dates);\n\n return (\n <div className=\"flex flex-col gap-6\">\n {roadmap.horizons.map((horizon) => {\n const events = roadmap.events.filter((event) => event.horizonTitle === horizon.title);\n return (\n <div key={horizon.title} className=\"flex flex-col gap-1\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n {events.length === 0 ? (\n <div className=\"text-2xs font-normal px-1 py-0 opacity-40\">No events yet</div>\n ) : (\n <RoadmapTimelineTrack events={events} rangeStart={rangeStart} rangeEnd={rangeEnd} />\n )}\n </div>\n );\n })}\n <div className=\"flex justify-between text-2xs opacity-50\">\n <span>{new Date(rangeStart).toLocaleDateString()}</span>\n <span>{new Date(rangeEnd).toLocaleDateString()}</span>\n </div>\n </div>\n );\n};\n\nexport const RoadmapPage = () => {\n const [roadmap, setRoadmap] = useState<ResolvedRoadmap | null>(null);\n const [loading, setLoading] = useState(true);\n const [loadFailed, setLoadFailed] = useState(false);\n const [promoting, setPromoting] = useState<{\n horizonTitle: string;\n item: ResolvedRoadmapItem;\n candidateName?: string;\n } | null>(null);\n const [viewMode, setViewMode] = useState<RoadmapViewMode>('tree');\n const plans = useAppStore((s) => s.plans);\n const navigate = useNavigate();\n const { item: highlightedItem } = useSearch({ from: '/roadmap' });\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n fetchRoadmap()\n .then(setRoadmap)\n .catch(() => setLoadFailed(true))\n .finally(() => setLoading(false));\n }, []);\n\n useEffect(() => {\n if (!highlightedItem || loading) return;\n const row = containerRef.current?.querySelector('.roadmap-item-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [highlightedItem, loading]);\n\n if (loading) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n );\n }\n\n if (loadFailed) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">\n Couldn't load the roadmap — the server may need a restart to pick up new routes.\n </p>\n </div>\n );\n }\n\n if (!roadmap || roadmap.horizons.length === 0) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">No `ROADMAP.md` found at the project root.</p>\n </div>\n );\n }\n\n const graduatedByItem = (item: ResolvedRoadmapItem) =>\n plans?.entries.filter((p) => p.subject === item.name) ?? [];\n\n const handleAddItem = async (horizonTitle: string, name: string, description: string) => {\n await addRoadmapItem(horizonTitle, name, description);\n setRoadmap(await fetchRoadmap());\n };\n\n const handleAddCandidate = async (horizonTitle: string, itemName: string, name: string) => {\n await addRoadmapCandidate(horizonTitle, itemName, name);\n setRoadmap(await fetchRoadmap());\n };\n\n return (\n <div ref={containerRef}>\n <GoalBanner goal={roadmap.goal} />\n <RoadmapViewModeSwitch mode={viewMode} onChange={setViewMode} />\n {viewMode === 'tree' && (\n <div className=\"flex flex-col gap-6\">\n {roadmap.horizons.map((horizon) => (\n <div key={horizon.title} className=\"flex flex-col gap-1\">\n <div className=\"flex items-baseline gap-2\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n <HorizonPulse items={horizon.items} graduatedByItem={graduatedByItem} />\n </div>\n <div className=\"flex flex-wrap items-start gap-2.5\">\n {horizon.items.map((item) => (\n <div\n key={item.name}\n className=\"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\"\n >\n <RoadmapItemRow\n item={item}\n graduated={graduatedByItem(item)}\n highlighted={item.name === highlightedItem}\n onPromote={() => setPromoting({ horizonTitle: horizon.title, item })}\n onPromoteCandidate={(candidateName) =>\n setPromoting({ horizonTitle: horizon.title, item, candidateName })\n }\n onAddCandidate={(name) => handleAddCandidate(horizon.title, item.name, name)}\n onViewGraduated={() => navigate({ to: '/', search: { subject: item.name } })}\n onOpenGraduated={(title) =>\n navigate({\n to: '/plans/$planId',\n params: { planId: encodeURIComponent(title) },\n })\n }\n />\n </div>\n ))}\n <div className=\"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\">\n <AddItemForm\n onAdd={(name, description) => handleAddItem(horizon.title, name, description)}\n />\n </div>\n </div>\n </div>\n ))}\n </div>\n )}\n {viewMode === 'map' && <RoadmapMap roadmap={roadmap} graduatedByItem={graduatedByItem} />}\n {viewMode === 'timeline' && <RoadmapTimeline roadmap={roadmap} />}\n <PromoteRoadmapItemModal\n horizonTitle={promoting?.horizonTitle ?? null}\n item={promoting?.item ?? null}\n candidateName={promoting?.candidateName}\n onClose={() => setPromoting(null)}\n onPromoted={() => fetchRoadmap().then(setRoadmap)}\n />\n </div>\n );\n};\n"],"names":["NO_SUBJECT","PromoteRoadmapItemModal","horizonTitle","item","candidateName","onClose","onPromoted","promoteRoadmapItem","useAppStore","s","launchIdeaExtend","subjects","subjectsAvailable","useSubjectVocabulary","subject","setSubject","useState","loading","setLoading","error","setError","toast","useToast","useEffect","handlePromote","id","idea","e","buildRoadmapPromotePrompt","err","oneLineErrorSummary","jsx","Modal","jsxs","Select","Button","graduationCounts","graduated","p","HORIZON_HEADER_CLASSES","HORIZON_PULSE_CLASSES","ChevronRightIcon","size","CandidateRow","name","onPromote","Card","AddCandidateForm","onAdd","setName","saving","setSaving","handleAdd","Input","AddItemForm","open","setOpen","description","setDescription","plural","count","noun","RoadmapLinkTrail","link","Tooltip","Stamp","STATUS_STAMP","PrBadge","GraduatedRow","plan","onOpen","STATUS_LABEL","RoadmapItemRow","highlighted","onPromoteCandidate","onAddCandidate","onViewGraduated","onOpenGraduated","expanded","setExpanded","hasCandidates","shipped","queued","v","GoalBanner","goal","firstParagraph","restParagraphs","hasMore","Markdown","VIEW_MODES","RoadmapViewModeSwitch","mode","onChange","viewMode","HorizonPulse","items","graduatedByItem","charted","EVENT_KIND_COLOR","RoadmapTimelineTrack","events","rangeStart","rangeEnd","span","event","i","RoadmapMapItem","percent","RoadmapMap","roadmap","horizon","RoadmapTimeline","dates","RoadmapPage","setRoadmap","loadFailed","setLoadFailed","promoting","setPromoting","setViewMode","plans","navigate","useNavigate","highlightedItem","useSearch","containerRef","useRef","fetchRoadmap","row","_a","PageTitle","handleAddItem","addRoadmapItem","handleAddCandidate","itemName","addRoadmapCandidate","title"],"mappings":"gPAQA,MAAMA,EAAa,iBAUNC,EAA0B,CAAC,CACtC,aAAAC,EACA,KAAAC,EACA,cAAAC,EACA,QAAAC,EACA,WAAAC,CACF,IAAoC,CAClC,MAAMC,EAAqBC,EAAaC,GAAMA,EAAE,kBAAkB,EAC5DC,EAAmBF,EAAaC,GAAMA,EAAE,gBAAgB,EACxD,CAAE,SAAAE,EAAU,UAAWC,CAAA,EAAsBC,EAAA,EAC7C,CAACC,EAASC,CAAU,EAAIC,EAAAA,SAAShB,CAAU,EAC3C,CAACiB,EAASC,CAAU,EAAIF,EAAAA,SAAS,EAAK,EACtC,CAACG,EAAOC,CAAQ,EAAIJ,EAAAA,SAAwB,IAAI,EAChD,CAAE,MAAAK,CAAA,EAAUC,EAAA,EAElBC,EAAAA,UAAU,IAAM,CACVpB,IAGFY,EAAWX,EAAgBD,EAAK,KAAOH,CAAU,EACjDkB,EAAW,EAAK,EAChBE,EAAS,IAAI,EAEjB,EAAG,CAACjB,EAAMC,CAAa,CAAC,EAExB,MAAMoB,EAAgB,SAAY,CAChC,GAAI,GAACrB,GAAQ,CAACD,GACd,CAAAgB,EAAW,EAAI,EACfE,EAAS,IAAI,EACb,GAAI,CACF,MAAMK,EAAK,MAAMlB,EACfL,EACAC,EACAW,IAAYd,EAAa,OAAYc,EACrCV,GAAiB,MAAA,EAEbsB,EAAOlB,EAAY,SAAA,EAAW,YAAY,KAAMmB,GAAMA,EAAE,KAAOF,CA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vH,EAAK,IAAA,EAAQ,EAC3E,gBAAkBsI,GAChBf,EAAS,CACP,GAAI,iBACJ,OAAQ,CAAE,OAAQ,mBAAmBe,CAAK,CAAA,CAAE,CAC7C,CAAA,CAAA,CAEL,EAnBKtI,EAAK,IAAA,CAqBb,EACD4B,EAAAA,IAAC,MAAA,CAAI,UAAU,oFACb,SAAAA,EAAAA,IAACuB,EAAA,CACC,MAAO,CAACV,EAAMa,IAAgB2E,EAAcrB,EAAQ,MAAOnE,EAAMa,CAAW,CAAA,CAAA,CAC9E,CACF,CAAA,CAAA,CACF,CAAA,CAAA,EAnCQsD,EAAQ,KAoClB,CACD,EACH,EAEDjB,IAAa,OAAS/D,EAAAA,IAAC8E,GAAA,CAAW,QAAAC,EAAkB,gBAAAb,EAAkC,EACtFH,IAAa,YAAc/D,EAAAA,IAACiF,GAAA,CAAgB,QAAAF,CAAA,CAAkB,EAC/D/E,EAAAA,IAAC9B,EAAA,CACC,cAAcqH,GAAA,YAAAA,EAAW,eAAgB,KACzC,MAAMA,GAAA,YAAAA,EAAW,OAAQ,KACzB,cAAeA,GAAA,YAAAA,EAAW,cAC1B,QAAS,IAAMC,EAAa,IAAI,EAChC,WAAY,IAAMS,IAAe,KAAKb,CAAU,CAAA,CAAA,CAClD,EACF,CAEJ"}
1
+ {"version":3,"file":"index-C6vBW0wx.js","sources":["../../../src/app/features/roadmap/promote-roadmap-item-modal.tsx","../../../src/app/features/roadmap/roadmap-page.tsx"],"sourcesContent":["import { buildRoadmapPromotePrompt } from '@/app/features/plans/prompts';\nimport { useSubjectVocabulary } from '@/app/hooks/use-subject-vocabulary';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { oneLineErrorSummary } from '@/app/utils/error-summary';\nimport type { RoadmapItem } from '@/types/index';\nimport { Button, Modal, Select, useToast } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nconst NO_SUBJECT = '__no-subject__';\n\ninterface PromoteRoadmapItemModalProps {\n horizonTitle: string | null;\n item: RoadmapItem | null;\n candidateName?: string | null;\n onClose: () => void;\n onPromoted: () => void;\n}\n\nexport const PromoteRoadmapItemModal = ({\n horizonTitle,\n item,\n candidateName,\n onClose,\n onPromoted,\n}: PromoteRoadmapItemModalProps) => {\n const promoteRoadmapItem = useAppStore((s) => s.promoteRoadmapItem);\n const launchIdeaExtend = useAppStore((s) => s.launchIdeaExtend);\n const { subjects, available: subjectsAvailable } = useSubjectVocabulary();\n const [subject, setSubject] = useState(NO_SUBJECT);\n const [loading, setLoading] = useState(false);\n const [error, setError] = useState<string | null>(null);\n const { toast } = useToast();\n\n useEffect(() => {\n if (item) {\n // A candidate defaults to its parent item's name — the \"big bet becomes a\n // Subject\" rule — but the picker still lets the user override it.\n setSubject(candidateName ? item.name : NO_SUBJECT);\n setLoading(false);\n setError(null);\n }\n }, [item, candidateName]);\n\n const handlePromote = async () => {\n if (!item || !horizonTitle) return;\n setLoading(true);\n setError(null);\n try {\n const id = await promoteRoadmapItem(\n horizonTitle,\n item,\n subject === NO_SUBJECT ? undefined : subject,\n candidateName ?? undefined,\n );\n const idea = useAppStore.getState().ideaEntries.find((e) => e.id === id);\n if (idea) {\n try {\n await launchIdeaExtend(id, buildRoadmapPromotePrompt(idea, horizonTitle));\n } catch (err) {\n // The idea was created either way — a failed refine launch just means\n // no background research ran, not that the promotion itself failed.\n toast({\n title: 'Idea created, but the refine agent failed to launch',\n description: oneLineErrorSummary((err as Error).message),\n variant: 'error',\n });\n }\n }\n onPromoted();\n onClose();\n } catch (err) {\n setError((err as Error).message);\n } finally {\n setLoading(false);\n }\n };\n\n return (\n <Modal\n open={item !== null}\n onClose={onClose}\n title={candidateName ?? item?.name ?? ''}\n size=\"small\"\n >\n <div className=\"flex flex-col gap-4\">\n {!candidateName && <p className=\"m-0 opacity-80\">{item?.description}</p>}\n <div>\n <Select\n size=\"small\"\n value={subject}\n onChange={setSubject}\n disabled={loading || !subjectsAvailable}\n options={[\n { value: NO_SUBJECT, label: 'No subject' },\n ...(!subjectsAvailable && subject !== NO_SUBJECT\n ? [{ value: subject, label: subject }]\n : []),\n ...subjects.map((s) => ({ value: s, label: s })),\n ]}\n />\n </div>\n {error && <p className=\"m-0 text-watercolor-rose-dark text-sm\">{error}</p>}\n <div className=\"flex justify-end gap-2\">\n <Button type=\"button\" variant=\"ghost\" onClick={onClose} disabled={loading}>\n Cancel\n </Button>\n <Button type=\"button\" variant=\"primary\" onClick={handlePromote} disabled={loading}>\n {loading ? 'Promoting…' : 'Promote to idea'}\n </Button>\n </div>\n </div>\n </Modal>\n );\n};\n","import { Markdown } from '@/app/components/markdown';\nimport { PageTitle } from '@/app/components/page-title';\nimport { PrBadge } from '@/app/features/plans/components/pr-badge';\nimport { STATUS_LABEL, STATUS_STAMP } from '@/app/features/plans/constants';\nimport { addRoadmapCandidate, addRoadmapItem, fetchRoadmap } from '@/app/services/content/docs-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport type {\n PlanEntry,\n ResolvedRoadmap,\n ResolvedRoadmapItem,\n RoadmapEvent,\n RoadmapEventKind,\n RoadmapLink,\n} from '@/types/index';\nimport { Button, Card, Input, Stamp, Tooltip } from '@dendelion/paper-ui';\nimport { useNavigate, useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef, useState } from 'react';\nimport { PromoteRoadmapItemModal } from './promote-roadmap-item-modal';\n\nconst graduationCounts = (graduated: PlanEntry[]) => ({\n shipped: graduated.filter((p) => p.status === 'done').length,\n queued: graduated.filter((p) => p.status !== 'done' && p.status !== 'dropped').length,\n});\n\nconst HORIZON_HEADER_CLASSES =\n 'font-handwritten text-md font-semibold opacity-70 leading-none pt-2 px-1 pb-0';\n\nconst HORIZON_PULSE_CLASSES = 'text-2xs font-normal px-1 py-0 opacity-50';\n\nconst ChevronRightIcon = ({ size = 14 }: { size?: number }) => (\n <svg\n width={size}\n height={size}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"2\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n aria-hidden=\"true\"\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\nconst CandidateRow = ({\n name,\n onPromote,\n}: {\n name: string;\n onPromote: () => void;\n}) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className=\"flex items-center gap-3\">\n <span className=\"flex-1\">{name}</span>\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={onPromote}>\n Promote to idea\n </Button>\n </div>\n </Card>\n);\n\nconst AddCandidateForm = ({ onAdd }: { onAdd: (name: string) => Promise<void> }) => {\n const [name, setName] = useState('');\n const [saving, setSaving] = useState(false);\n\n const handleAdd = async () => {\n if (!name.trim()) return;\n setSaving(true);\n try {\n await onAdd(name.trim());\n setName('');\n } finally {\n setSaving(false);\n }\n };\n\n return (\n <div className=\"flex gap-2\">\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Add option…\"\n disabled={saving}\n className=\"flex-1\"\n />\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={handleAdd}\n disabled={saving || !name.trim()}\n >\n Add\n </Button>\n </div>\n );\n};\n\nconst AddItemForm = ({\n onAdd,\n}: {\n onAdd: (name: string, description: string) => Promise<void>;\n}) => {\n const [open, setOpen] = useState(false);\n const [name, setName] = useState('');\n const [description, setDescription] = useState('');\n const [saving, setSaving] = useState(false);\n\n const handleAdd = async () => {\n if (!name.trim()) return;\n setSaving(true);\n try {\n await onAdd(name.trim(), description.trim());\n setName('');\n setDescription('');\n setOpen(false);\n } finally {\n setSaving(false);\n }\n };\n\n if (!open) {\n return (\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={() => setOpen(true)}>\n + Add item\n </Button>\n );\n }\n\n return (\n <div className=\"flex flex-col gap-2\">\n <Input\n size=\"small\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n placeholder=\"Item name…\"\n disabled={saving}\n autoFocus\n />\n <Input\n size=\"small\"\n value={description}\n onChange={(e) => setDescription(e.target.value)}\n onKeyDown={(e) => {\n if (e.key === 'Enter') handleAdd();\n }}\n placeholder=\"Description…\"\n disabled={saving}\n />\n <div className=\"flex justify-end gap-2\">\n <Button\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n onClick={() => setOpen(false)}\n disabled={saving}\n >\n Cancel\n </Button>\n <Button type=\"button\" size=\"small\" onClick={handleAdd} disabled={saving || !name.trim()}>\n Add\n </Button>\n </div>\n </div>\n );\n};\n\nconst plural = (count: number, noun: string) => `${count} ${noun}${count === 1 ? '' : 's'}`;\n\nconst RoadmapLinkTrail = ({ link }: { link: RoadmapLink }) => (\n <div className=\"flex items-center gap-1\">\n <Tooltip content={`${plural(link.taskRuns, 'task run')}${link.released ? ' · released' : ''}`}>\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP[link.status].fill}\n textColor={STATUS_STAMP[link.status].text}\n >\n {link.id}\n </Stamp>\n </Tooltip>\n {link.pr && <PrBadge pr={link.pr} />}\n </div>\n);\n\nconst GraduatedRow = ({ plan, onOpen }: { plan: PlanEntry; onOpen: () => void }) => (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <button\n type=\"button\"\n onClick={onOpen}\n className=\"flex items-center gap-3 w-full bg-transparent border-none p-0 cursor-pointer [font:inherit] text-inherit text-left\"\n >\n <span className=\"flex-1 overflow-hidden text-ellipsis whitespace-nowrap\">{plan.title}</span>\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP[plan.status].fill}\n textColor={STATUS_STAMP[plan.status].text}\n >\n {STATUS_LABEL[plan.status]}\n </Stamp>\n </button>\n </Card>\n);\n\nconst RoadmapItemRow = ({\n item,\n graduated,\n highlighted,\n onPromote,\n onPromoteCandidate,\n onAddCandidate,\n onViewGraduated,\n onOpenGraduated,\n}: {\n item: ResolvedRoadmapItem;\n graduated: PlanEntry[];\n highlighted: boolean;\n onPromote: () => void;\n onPromoteCandidate: (candidateName: string) => void;\n onAddCandidate: (name: string) => Promise<void>;\n onViewGraduated: () => void;\n onOpenGraduated: (title: string) => void;\n}) => {\n const [expanded, setExpanded] = useState(highlighted);\n const hasCandidates = item.candidates.length > 0;\n const { shipped, queued } = graduationCounts(graduated);\n\n return (\n <div\n className={`flex flex-col gap-1 ${highlighted ? 'roadmap-item-highlighted outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]' : ''}`}\n >\n <Card size=\"small\" texture=\"canvas\" className=\"plan-row-card\">\n <div className=\"flex flex-col gap-1\">\n <div className=\"flex items-center gap-2\">\n {/* Raw <button>: icon-only toggle, paper-ui Button doesn't offer this compact chrome. */}\n <button\n type=\"button\"\n aria-expanded={expanded}\n aria-label={expanded ? 'Collapse item' : 'Expand item'}\n onClick={() => setExpanded((v) => !v)}\n className={`inline-flex items-center bg-transparent border-none cursor-pointer opacity-50 p-0 ${expanded ? 'rotate-90' : ''}`}\n >\n <ChevronRightIcon />\n </button>\n <span className=\"font-semibold flex-1\">{item.name}</span>\n <Button type=\"button\" variant=\"ghost\" size=\"small\" onClick={onPromote}>\n Promote to idea\n </Button>\n </div>\n <span className={`text-sm opacity-70 ${expanded ? '' : 'line-clamp-2'}`}>\n {item.description}\n </span>\n <div className=\"flex items-center gap-1\">\n {(queued > 0 || shipped > 0) && (\n <button\n type=\"button\"\n onClick={onViewGraduated}\n className=\"flex items-center gap-1 bg-transparent border-none p-0 cursor-pointer\"\n >\n {queued > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.planned.fill}\n textColor={STATUS_STAMP.planned.text}\n >\n {queued} in queue\n </Stamp>\n )}\n {shipped > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.done.fill}\n textColor={STATUS_STAMP.done.text}\n >\n {shipped} shipped\n </Stamp>\n )}\n </button>\n )}\n {hasCandidates && (\n <Stamp size=\"small\" fillColor=\"rgba(0, 0, 0, 0.06)\" textColor=\"rgba(0, 0, 0, 0.55)\">\n {item.candidates.length} candidate{item.candidates.length === 1 ? '' : 's'}\n </Stamp>\n )}\n {item.rollup.total > 0 && (\n <Stamp\n size=\"small\"\n fillColor={STATUS_STAMP.planned.fill}\n textColor={STATUS_STAMP.planned.text}\n >\n {item.rollup.done}/{item.rollup.total} done\n </Stamp>\n )}\n </div>\n {item.links.length > 0 && (\n <div className=\"flex items-center gap-1 flex-wrap\">\n {item.links.map((link) => (\n <RoadmapLinkTrail key={link.id} link={link} />\n ))}\n </div>\n )}\n </div>\n </Card>\n {expanded && (\n <div className=\"flex flex-col gap-1 pl-6\">\n {item.candidates.map((candidateName) => (\n <CandidateRow\n key={candidateName}\n name={candidateName}\n onPromote={() => onPromoteCandidate(candidateName)}\n />\n ))}\n {graduated.map((plan) => (\n <GraduatedRow key={plan.title} plan={plan} onOpen={() => onOpenGraduated(plan.title)} />\n ))}\n <AddCandidateForm onAdd={onAddCandidate} />\n </div>\n )}\n </div>\n );\n};\n\nconst GoalBanner = ({ goal }: { goal: string }) => {\n const [expanded, setExpanded] = useState(false);\n const [firstParagraph, ...restParagraphs] = goal.split(/\\n{2,}/);\n const hasMore = restParagraphs.length > 0;\n\n return (\n <div className=\"mb-6 pb-4 border-b border-black/[8%]\">\n <span className=\"font-handwritten text-xs font-semibold opacity-[0.55]\">The goal</span>\n <div className=\"font-display-luminari text-lg leading-[1.4] mt-2\">\n <div className={expanded ? undefined : 'line-clamp-1'}>\n <Markdown>{firstParagraph}</Markdown>\n </div>\n {expanded && hasMore && <Markdown>{restParagraphs.join('\\n\\n')}</Markdown>}\n </div>\n {hasMore && (\n <button\n type=\"button\"\n onClick={() => setExpanded((v) => !v)}\n className=\"bg-transparent border-none p-0 mt-2 cursor-pointer text-2xs opacity-[0.65] underline\"\n >\n {expanded ? 'Show less' : 'Show more'}\n </button>\n )}\n </div>\n );\n};\n\ntype RoadmapViewMode = 'tree' | 'map' | 'timeline';\n\nconst VIEW_MODES: { id: RoadmapViewMode; label: string }[] = [\n { id: 'tree', label: 'Outline' },\n { id: 'map', label: 'Board' },\n { id: 'timeline', label: 'Timeline' },\n];\n\nconst RoadmapViewModeSwitch = ({\n mode,\n onChange,\n}: {\n mode: RoadmapViewMode;\n onChange: (mode: RoadmapViewMode) => void;\n}) => (\n <nav aria-label=\"Roadmap view\" className=\"flex gap-1 mb-4\">\n {VIEW_MODES.map((viewMode) => (\n <Button\n key={viewMode.id}\n type=\"button\"\n variant=\"ghost\"\n size=\"small\"\n isActive={mode === viewMode.id}\n aria-pressed={mode === viewMode.id}\n onClick={() => onChange(viewMode.id)}\n >\n {viewMode.label}\n </Button>\n ))}\n </nav>\n);\n\nconst HorizonPulse = ({\n items,\n graduatedByItem,\n}: {\n items: ResolvedRoadmapItem[];\n graduatedByItem: (item: ResolvedRoadmapItem) => PlanEntry[];\n}) => {\n const graduated = items.filter((item) => graduatedByItem(item).length > 0).length;\n const charted = items.length - graduated;\n return (\n <div className={HORIZON_PULSE_CLASSES}>\n {graduated} graduated · {charted} charted\n </div>\n );\n};\n\nconst EVENT_KIND_COLOR: Record<RoadmapEventKind, string> = {\n created: 'bg-watercolor-slate',\n 'task-run': 'bg-watercolor-amber',\n};\n\nconst RoadmapTimelineTrack = ({\n events,\n rangeStart,\n rangeEnd,\n}: {\n events: RoadmapEvent[];\n rangeStart: number;\n rangeEnd: number;\n}) => {\n const span = rangeEnd - rangeStart || 1;\n return (\n <div className=\"relative h-8 mx-1 border-b border-black/10\">\n {events.map((event, i) => (\n <button\n type=\"button\"\n key={`${event.entityId}-${event.kind}-${i}`}\n className={`absolute top-1/2 w-2.5 h-2.5 p-0 border-none rounded-full -translate-x-1/2 -translate-y-1/2 cursor-pointer ${EVENT_KIND_COLOR[event.kind]}`}\n style={{\n left: `${((Date.parse(event.date) - rangeStart) / span) * 100}%`,\n }}\n title={`${event.itemName} — ${event.label} (${event.date})`}\n aria-label={`${event.itemName} — ${event.label} (${event.date})`}\n />\n ))}\n </div>\n );\n};\n\nconst RoadmapMapItem = ({ item }: { item: ResolvedRoadmapItem }) => {\n const percent =\n item.rollup.total > 0 ? Math.round((item.rollup.done / item.rollup.total) * 100) : 0;\n return (\n <div className=\"flex flex-col gap-1 py-2 px-2.5\">\n <div className=\"font-semibold text-sm\">{item.name}</div>\n <div className=\"h-1.5 rounded-full bg-black/[0.08] overflow-hidden\">\n <div\n className={`h-full rounded-full ${item.rollup.total > 0 ? 'bg-watercolor-green' : 'bg-transparent'}`}\n style={{\n width: `${percent}%`,\n }}\n />\n </div>\n <div className=\"text-2xs opacity-50\">\n {item.rollup.total > 0 ? `${item.rollup.done}/${item.rollup.total} done` : 'not started'}\n </div>\n </div>\n );\n};\n\nconst RoadmapMap = ({\n roadmap,\n graduatedByItem,\n}: {\n roadmap: ResolvedRoadmap;\n graduatedByItem: (item: ResolvedRoadmapItem) => PlanEntry[];\n}) => (\n <div className=\"flex flex-col gap-6\">\n {roadmap.horizons.map((horizon) => (\n <div key={horizon.title} className=\"flex flex-col gap-1\">\n <div className=\"flex items-baseline gap-2\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n <HorizonPulse items={horizon.items} graduatedByItem={graduatedByItem} />\n </div>\n <div className=\"flex flex-wrap items-start gap-2.5\">\n {horizon.items.map((item) => (\n <div\n key={item.name}\n className=\"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\"\n >\n <RoadmapMapItem item={item} />\n </div>\n ))}\n </div>\n </div>\n ))}\n </div>\n);\n\nconst RoadmapTimeline = ({ roadmap }: { roadmap: ResolvedRoadmap }) => {\n if (roadmap.events.length === 0) {\n return <p className=\"opacity-50\">No dated events yet.</p>;\n }\n\n const dates = roadmap.events.map((event) => Date.parse(event.date));\n const rangeStart = Math.min(...dates);\n const rangeEnd = Math.max(...dates);\n\n return (\n <div className=\"flex flex-col gap-6\">\n {roadmap.horizons.map((horizon) => {\n const events = roadmap.events.filter((event) => event.horizonTitle === horizon.title);\n return (\n <div key={horizon.title} className=\"flex flex-col gap-1\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n {events.length === 0 ? (\n <div className=\"text-2xs font-normal px-1 py-0 opacity-40\">No events yet</div>\n ) : (\n <RoadmapTimelineTrack events={events} rangeStart={rangeStart} rangeEnd={rangeEnd} />\n )}\n </div>\n );\n })}\n <div className=\"flex justify-between text-2xs opacity-50\">\n <span>{new Date(rangeStart).toLocaleDateString()}</span>\n <span>{new Date(rangeEnd).toLocaleDateString()}</span>\n </div>\n </div>\n );\n};\n\nexport const RoadmapPage = () => {\n const [roadmap, setRoadmap] = useState<ResolvedRoadmap | null>(null);\n const [loading, setLoading] = useState(true);\n const [loadFailed, setLoadFailed] = useState(false);\n const [promoting, setPromoting] = useState<{\n horizonTitle: string;\n item: ResolvedRoadmapItem;\n candidateName?: string;\n } | null>(null);\n const [viewMode, setViewMode] = useState<RoadmapViewMode>('tree');\n const plans = useAppStore((s) => s.plans);\n const navigate = useNavigate();\n const { item: highlightedItem } = useSearch({ from: '/roadmap' });\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n fetchRoadmap()\n .then(setRoadmap)\n .catch(() => setLoadFailed(true))\n .finally(() => setLoading(false));\n }, []);\n\n useEffect(() => {\n if (!highlightedItem || loading) return;\n const row = containerRef.current?.querySelector('.roadmap-item-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [highlightedItem, loading]);\n\n if (loading) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">Loading…</p>\n </div>\n );\n }\n\n if (loadFailed) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">\n Couldn't load the roadmap — the server may need a restart to pick up new routes.\n </p>\n </div>\n );\n }\n\n if (!roadmap || roadmap.horizons.length === 0) {\n return (\n <div>\n <PageTitle>Roadmap</PageTitle>\n <p className=\"opacity-50\">No `ROADMAP.md` found at the project root.</p>\n </div>\n );\n }\n\n const graduatedByItem = (item: ResolvedRoadmapItem) =>\n plans?.entries.filter((p) => p.subject === item.name) ?? [];\n\n const handleAddItem = async (horizonTitle: string, name: string, description: string) => {\n await addRoadmapItem(horizonTitle, name, description);\n setRoadmap(await fetchRoadmap());\n };\n\n const handleAddCandidate = async (horizonTitle: string, itemName: string, name: string) => {\n await addRoadmapCandidate(horizonTitle, itemName, name);\n setRoadmap(await fetchRoadmap());\n };\n\n return (\n <div ref={containerRef}>\n <GoalBanner goal={roadmap.goal} />\n <RoadmapViewModeSwitch mode={viewMode} onChange={setViewMode} />\n {viewMode === 'tree' && (\n <div className=\"flex flex-col gap-6\">\n {roadmap.horizons.map((horizon) => (\n <div key={horizon.title} className=\"flex flex-col gap-1\">\n <div className=\"flex items-baseline gap-2\">\n <div className={HORIZON_HEADER_CLASSES}>{horizon.title}</div>\n <HorizonPulse items={horizon.items} graduatedByItem={graduatedByItem} />\n </div>\n <div className=\"flex flex-wrap items-start gap-2.5\">\n {horizon.items.map((item) => (\n <div\n key={item.name}\n className=\"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\"\n >\n <RoadmapItemRow\n item={item}\n graduated={graduatedByItem(item)}\n highlighted={item.name === highlightedItem}\n onPromote={() => setPromoting({ horizonTitle: horizon.title, item })}\n onPromoteCandidate={(candidateName) =>\n setPromoting({ horizonTitle: horizon.title, item, candidateName })\n }\n onAddCandidate={(name) => handleAddCandidate(horizon.title, item.name, name)}\n onViewGraduated={() => navigate({ to: '/', search: { subject: item.name } })}\n onOpenGraduated={(title) =>\n navigate({\n to: '/plans/$planId',\n params: { planId: encodeURIComponent(title) },\n })\n }\n />\n </div>\n ))}\n <div className=\"flex-[1_1_240px] max-w-[320px] max-[480px]:flex-[1_1_100%] max-[480px]:max-w-none\">\n <AddItemForm\n onAdd={(name, description) => handleAddItem(horizon.title, name, description)}\n />\n </div>\n </div>\n </div>\n ))}\n </div>\n )}\n {viewMode === 'map' && <RoadmapMap roadmap={roadmap} graduatedByItem={graduatedByItem} />}\n {viewMode === 'timeline' && <RoadmapTimeline roadmap={roadmap} />}\n <PromoteRoadmapItemModal\n horizonTitle={promoting?.horizonTitle ?? null}\n item={promoting?.item ?? null}\n candidateName={promoting?.candidateName}\n onClose={() => setPromoting(null)}\n onPromoted={() => fetchRoadmap().then(setRoadmap)}\n />\n </div>\n );\n};\n"],"names":["NO_SUBJECT","PromoteRoadmapItemModal","horizonTitle","item","candidateName","onClose","onPromoted","promoteRoadmapItem","useAppStore","s","launchIdeaExtend","subjects","subjectsAvailable","useSubjectVocabulary","subject","setSubject","useState","loading","setLoading","error","setError","toast","useToast","useEffect","handlePromote","id","idea","e","buildRoadmapPromotePrompt","err","oneLineErrorSummary","jsx","Modal","jsxs","Select","Button","graduationCounts","graduated","p","HORIZON_HEADER_CLASSES","HORIZON_PULSE_CLASSES","ChevronRightIcon","size","CandidateRow","name","onPromote","Card","AddCandidateForm","onAdd","setName","saving","setSaving","handleAdd","Input","AddItemForm","open","setOpen","description","setDescription","plural","count","noun","RoadmapLinkTrail","link","Tooltip","Stamp","STATUS_STAMP","PrBadge","GraduatedRow","plan","onOpen","STATUS_LABEL","RoadmapItemRow","highlighted","onPromoteCandidate","onAddCandidate","onViewGraduated","onOpenGraduated","expanded","setExpanded","hasCandidates","shipped","queued","v","GoalBanner","goal","firstParagraph","restParagraphs","hasMore","Markdown","VIEW_MODES","RoadmapViewModeSwitch","mode","onChange","viewMode","HorizonPulse","items","graduatedByItem","charted","EVENT_KIND_COLOR","RoadmapTimelineTrack","events","rangeStart","rangeEnd","span","event","i","RoadmapMapItem","percent","RoadmapMap","roadmap","horizon","RoadmapTimeline","dates","RoadmapPage","setRoadmap","loadFailed","setLoadFailed","promoting","setPromoting","setViewMode","plans","navigate","useNavigate","highlightedItem","useSearch","containerRef","useRef","fetchRoadmap","row","_a","PageTitle","handleAddItem","addRoadmapItem","handleAddCandidate","itemName","addRoadmapCandidate","title"],"mappings":"gPAQA,MAAMA,EAAa,iBAUNC,EAA0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CQsD,EAAQ,KAoClB,CACD,EACH,EAEDjB,IAAa,OAAS/D,EAAAA,IAAC8E,GAAA,CAAW,QAAAC,EAAkB,gBAAAb,EAAkC,EACtFH,IAAa,YAAc/D,EAAAA,IAACiF,GAAA,CAAgB,QAAAF,CAAA,CAAkB,EAC/D/E,EAAAA,IAAC9B,EAAA,CACC,cAAcqH,GAAA,YAAAA,EAAW,eAAgB,KACzC,MAAMA,GAAA,YAAAA,EAAW,OAAQ,KACzB,cAAeA,GAAA,YAAAA,EAAW,cAC1B,QAAS,IAAMC,EAAa,IAAI,EAChC,WAAY,IAAMS,IAAe,KAAKb,CAAU,CAAA,CAAA,CAClD,EACF,CAEJ"}
@@ -1,3 +1,3 @@
1
- import{u as h,B as v,r,j as e,P as L,w as u,z as y,U as S,C as A,J as T}from"./main-BW24wv9K.js";import{c as f}from"./tokens-C3C44lLs.js";const b={phase:"Phase run",audit:"Audit","batch-reconcile":"Batch reconcile","run-all":"Run all phases",draft:"Draft",extend:"Extend",suggest:"Suggest ideas","commit-suggest":"Commit suggest","overlap-check":"Overlap check",prioritise:"Prioritise queue",sync:"Sync",reconcile:"Reconcile","fix-review":"Fix review","resolve-conflict":"Resolve conflict",feedback:"Feedback reply"},m=s=>String(s).padStart(2,"0"),_=s=>{const a=new Date(s);return`${a.getFullYear()}-${m(a.getMonth()+1)}-${m(a.getDate())}`},D=s=>new Date(s).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),k=s=>{const a=new Date(s);return`${m(a.getHours())}:${m(a.getMinutes())}:${m(a.getSeconds())}`},p="text-sm font-semibold whitespace-nowrap overflow-hidden",N="grid grid-cols-[20px_116px_minmax(0,1fr)_88px_150px_72px] gap-2.5 items-center max-lg:grid-cols-[20px_116px_minmax(0,1fr)_88px_72px] max-[480px]:grid-cols-1 max-[480px]:gap-1",C=({id:s})=>{const[a,c]=r.useState(null),[l,i]=r.useState(!1),[o,x]=r.useState(0);r.useEffect(()=>{let n=!1,d;c(null),i(!1);const g=j=>{A(s).then(w=>{n||c(w.lines??[])}).catch(()=>{if(!n){if(j>0){d=setTimeout(()=>g(j-1),700);return}i(!0),c([])}})};return g(3),()=>{n=!0,d&&clearTimeout(d)}},[s,o]);const t=e.jsx(T,{variant:"ghost",size:"small",onClick:()=>x(n=>n+1),children:"Retry"});return a===null?e.jsx("p",{className:"opacity-50 m-0",children:"Loading…"}):l?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"Couldn't load this task's output."}),t]}):a.length===0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"No output recorded."}),t]}):e.jsx("pre",{className:"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap",children:a.join(`
1
+ import{u as h,B as v,r,j as e,P as L,w as u,z as y,U as S,C as A,J as T}from"./main-Ba3mXsWY.js";import{c as f}from"./tokens-C3C44lLs.js";const b={phase:"Phase run",audit:"Audit","batch-reconcile":"Batch reconcile","run-all":"Run all phases",draft:"Draft",extend:"Extend",suggest:"Suggest ideas","commit-suggest":"Commit suggest","overlap-check":"Overlap check",prioritise:"Prioritise queue",sync:"Sync",reconcile:"Reconcile","fix-review":"Fix review","resolve-conflict":"Resolve conflict",feedback:"Feedback reply"},m=s=>String(s).padStart(2,"0"),_=s=>{const a=new Date(s);return`${a.getFullYear()}-${m(a.getMonth()+1)}-${m(a.getDate())}`},D=s=>new Date(s).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),k=s=>{const a=new Date(s);return`${m(a.getHours())}:${m(a.getMinutes())}:${m(a.getSeconds())}`},p="text-sm font-semibold whitespace-nowrap overflow-hidden",N="grid grid-cols-[20px_116px_minmax(0,1fr)_88px_150px_72px] gap-2.5 items-center max-lg:grid-cols-[20px_116px_minmax(0,1fr)_88px_72px] max-[480px]:grid-cols-1 max-[480px]:gap-1",C=({id:s})=>{const[a,c]=r.useState(null),[l,i]=r.useState(!1),[o,x]=r.useState(0);r.useEffect(()=>{let n=!1,d;c(null),i(!1);const g=j=>{A(s).then(w=>{n||c(w.lines??[])}).catch(()=>{if(!n){if(j>0){d=setTimeout(()=>g(j-1),700);return}i(!0),c([])}})};return g(3),()=>{n=!0,d&&clearTimeout(d)}},[s,o]);const t=e.jsx(T,{variant:"ghost",size:"small",onClick:()=>x(n=>n+1),children:"Retry"});return a===null?e.jsx("p",{className:"opacity-50 m-0",children:"Loading…"}):l?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"Couldn't load this task's output."}),t]}):a.length===0?e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("p",{className:"opacity-50 m-0",children:"No output recorded."}),t]}):e.jsx("pre",{className:"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap",children:a.join(`
2
2
  `)})},E=({size:s=14,className:a})=>e.jsx("svg",{width:s,height:s,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",className:a,children:e.jsx("polyline",{points:"9 18 15 12 9 6"})}),R=({entry:s,highlighted:a})=>{const[c,l]=r.useState(a);r.useEffect(()=>{a&&l(!0)},[a]);const i=()=>l(o=>!o);return e.jsxs("div",{className:a?"task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] outline-[rgba(200,154,90,0.5)]":"flex flex-col gap-1 rounded-[10px]",children:[e.jsx("div",{role:"button",tabIndex:0,"aria-expanded":c,onClick:i,onKeyDown:o=>{(o.key==="Enter"||o.key===" ")&&(o.preventDefault(),i())},className:"group cursor-pointer rounded-[10px]",children:e.jsx(u,{size:"small",texture:"canvas",className:"plan-row-card",children:e.jsxs("div",{className:N,children:[e.jsx("span",{className:"inline-flex items-center opacity-50",children:e.jsx(E,{className:"transition-transform duration-150 ease-out group-aria-expanded:rotate-90"})}),e.jsx("span",{className:"font-semibold whitespace-nowrap overflow-hidden",children:b[s.taskKind]??s.taskKind}),e.jsx("span",{className:"overflow-hidden text-ellipsis whitespace-nowrap opacity-70",children:s.planTitle}),e.jsx("span",{className:"text-sm opacity-50 whitespace-nowrap",children:y[s.agentId]}),e.jsxs("span",{className:"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap",children:[k(s.startedAt),"–",k(s.endedAt)]}),e.jsx("div",{className:"flex items-center",children:e.jsx(S,{size:"small",fillColor:s.outcome==="done"?"rgba(143, 185, 150, 0.25)":s.outcome==="superseded"?"rgba(212, 163, 115, 0.25)":"rgba(201, 139, 139, 0.25)",textColor:s.outcome==="done"?f.accentGreenDark:s.outcome==="superseded"?f.accentAmberDark:f.accentRoseDark,children:s.outcome})})]})})}),c&&e.jsxs(u,{size:"small",texture:"kraft",className:"plan-row-card",children:[s.outcome==="error"&&s.reason&&e.jsx("p",{className:"m-0 mb-2 text-sm text-state-danger",children:s.reason}),e.jsx(C,{id:s.id})]})]})},K=()=>{const s=h(t=>t.taskLog),a=h(t=>t.taskLogLoading),c=h(t=>t.loadTaskLog),{taskId:l}=v({from:"/tasks"}),i=r.useRef(null);r.useEffect(()=>{c()},[c]),r.useEffect(()=>{var n;if(!l)return;const t=(n=i.current)==null?void 0:n.querySelector(".task-row-highlighted");t==null||t.scrollIntoView({behavior:"smooth",block:"center"})},[l]);const o=[...s].sort((t,n)=>n.endedAt.localeCompare(t.endedAt)),x=[];for(const t of o){const n=_(t.endedAt),d=x.at(-1);(d==null?void 0:d.key)===n?d.entries.push(t):x.push({key:n,entries:[t]})}return e.jsxs("div",{ref:i,children:[e.jsx(L,{children:"Tasks"}),a&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),!a&&o.length===0&&e.jsx("p",{className:"opacity-50",children:"No tasks have run yet."}),!a&&o.length>0&&e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(u,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsxs("div",{className:N,children:[e.jsx("span",{}),e.jsx("span",{className:`${p} opacity-60`,children:"Task"}),e.jsx("span",{className:`${p} opacity-60`,children:"Plan"}),e.jsx("span",{className:`${p} opacity-60`,children:"Agent"}),e.jsx("span",{className:`max-lg:hidden ${p} opacity-60`,children:"Time"}),e.jsx("span",{className:`${p} opacity-60`,children:"Outcome"})]})}),x.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(u,{size:"small",texture:"kraft",className:"plan-row-card",children:e.jsx("span",{className:`${p} opacity-75`,children:D(t.entries[0].endedAt)})}),t.entries.map(n=>e.jsx(R,{entry:n,highlighted:n.id===l},n.id))]},t.key))]})]})};export{K as TasksPage};
3
- //# sourceMappingURL=index-BTyua-6D.js.map
3
+ //# sourceMappingURL=index-CGtPCj1V.js.map