@dendelion/paper-camp 0.25.0 → 0.26.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.
- package/dist/app/assets/{index-81fEepOO.js → index-CqDZ80wA.js} +2 -2
- package/dist/app/assets/{index-81fEepOO.js.map → index-CqDZ80wA.js.map} +1 -1
- package/dist/app/assets/{index-cCrMJylm.js → index-DAhfAB9y.js} +2 -2
- package/dist/app/assets/{index-cCrMJylm.js.map → index-DAhfAB9y.js.map} +1 -1
- package/dist/app/assets/index-DYGnWiFG.js +2 -0
- package/dist/app/assets/index-DYGnWiFG.js.map +1 -0
- package/dist/app/assets/{index-BVj9hjpY.js → index-DuhmLhzz.js} +2 -2
- package/dist/app/assets/{index-BVj9hjpY.js.map → index-DuhmLhzz.js.map} +1 -1
- package/dist/app/assets/{index-DdZYRgzN.js → index-HixYRYWW.js} +2 -2
- package/dist/app/assets/{index-DdZYRgzN.js.map → index-HixYRYWW.js.map} +1 -1
- package/dist/app/assets/{index-BJqS77OS.js → index-VoRTCwB6.js} +2 -2
- package/dist/app/assets/{index-BJqS77OS.js.map → index-VoRTCwB6.js.map} +1 -1
- package/dist/app/assets/{index-BBvcyiG4.js → index-X5ikcKAy.js} +2 -2
- package/dist/app/assets/{index-BBvcyiG4.js.map → index-X5ikcKAy.js.map} +1 -1
- package/dist/app/assets/{index-15mPrQq0.js → index-sqaNs4DX.js} +2 -2
- package/dist/app/assets/{index-15mPrQq0.js.map → index-sqaNs4DX.js.map} +1 -1
- package/dist/app/assets/main-BZd2c99C.css +1 -0
- package/dist/app/assets/{main-CpTKYLW_.js → main-Ceiva0Al.js} +123 -123
- package/dist/app/assets/main-Ceiva0Al.js.map +1 -0
- package/dist/app/assets/{sidebar-section-DsDt34HB.js → sidebar-section-CW3WaioH.js} +2 -2
- package/dist/app/assets/{sidebar-section-DsDt34HB.js.map → sidebar-section-CW3WaioH.js.map} +1 -1
- package/dist/app/index.html +2 -2
- package/dist/app/toolbar.js +865 -846
- package/dist/app/toolbar.js.map +1 -1
- package/dist/chunks/{machine-registry.BdaWfuyz.js → machine-registry.DF3kTKHr.js} +2 -2
- package/dist/chunks/{machine-registry.BdaWfuyz.js.map → machine-registry.DF3kTKHr.js.map} +1 -1
- package/dist/cli/index.js +7758 -7653
- package/dist/cli/index.js.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/rate-limit.d.ts +8 -0
- package/dist/core/rate-limit.d.ts.map +1 -1
- package/dist/core/stats.d.ts +2 -2
- package/dist/core/stats.d.ts.map +1 -1
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/app/assets/index-CbsAL0YR.js +0 -2
- package/dist/app/assets/index-CbsAL0YR.js.map +0 -1
- package/dist/app/assets/main-CpTKYLW_.js.map +0 -1
- package/dist/app/assets/main-iyjvjZKW.css +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{u as h,a9 as y,r as x,aa as D,j as s,J as k,$ as C,g as v,ab as L,C as $,ac as N,ad as S,Z as A,ae as E,af as T,B as R,ag as I,ah as _,p as G,G as M,ai as U,w as O,P as z,aj as B,ak as H}from"./main-
|
|
1
|
+
import{u as h,a9 as y,r as x,aa as D,j as s,J as k,$ as C,g as v,ab as L,C as $,ac as N,ad as S,Z as A,ae as E,af as T,B as R,ag as I,ah as _,p as G,G as M,ai as U,w as O,P as z,aj as B,ak as H}from"./main-Ceiva0Al.js";const W=({state:e,filesEmpty:a})=>{const t=h(f=>f.status),{checks:i}=y(),{qualityStatus:l,testStatus:o,consistencyStatus:c}=x.useMemo(()=>D(t,i),[t,i]),n=[l==="fail"&&"Quality",o==="fail"&&"Tests",c==="fail"&&"Consistency"].filter(f=>f!==!1),m=s.jsx(k,{size:"small",disabled:a||!e.commitTitle.trim()||e.committing||e.commitInFlight,onClick:e.handleCommit,children:e.committing||e.commitInFlight?"Committing…":e.stagedCount>0?`Commit ${e.stagedCount} staged`:"Commit"});return n.length===0?m:s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(C,{content:`${n.join(", ")} failing`,children:s.jsx(v,{size:"small",variant:"warning",children:"!"})}),m]})},K="__git__",q=()=>!0,J=e=>L(e,{formKey:K,matchesSuggestionTask:q});function b(e){const a=e.lastIndexOf("/");return a===-1?{dir:"",base:e}:{dir:e.slice(0,a+1),base:e.slice(a+1)}}function Q(e){const a=new Map;for(const t of e){const{dir:i}=b(t.path),l=i||"./",o=a.get(l);o?o.push(t):a.set(l,[t])}return[...a].map(([t,i])=>({dir:t,entries:i}))}const V=()=>{const e=h(d=>d.diffFiles),a=h(d=>d.activeDiffPath),t=h(d=>d.loadDiffFiles),i=h(d=>d.expandDiffPath),[l,o]=x.useState(new Set),[c,n]=x.useState(!1),{toast:m}=$(),f=x.useMemo(()=>Q(e??[]),[e]),r=(e??[]).length>0&&(e??[]).every(d=>d.staged);return{files:e,activePath:a,expandDiffPath:i,groups:f,pending:l,bulkPending:c,allStaged:r,toggleAll:async()=>{const d=(e??[]).filter(j=>j.staged===r);n(!0);try{const p=(await Promise.allSettled(d.map(u=>r?S(u.path):N(u.path)))).filter(u=>u.status==="rejected").length;p>0&&m({title:r?"Unstage failed":"Stage failed",description:`${p} of ${d.length} file(s) could not be updated.`,variant:"error"})}finally{await t(),n(!1)}},toggleStaged:async(d,j)=>{o(p=>new Set(p).add(d.path));try{await(j?N(d.path):S(d.path)),await t()}catch(p){m({title:j?"Stage failed":"Unstage failed",description:A(p.message),variant:"error"})}finally{o(p=>{const u=new Set(p);return u.delete(d.path),u})}}}},X=()=>{const e=h(n=>n.diffFiles),a=h(n=>n.diffLoadFailed),t=h(n=>n.loadDiffFiles),i=h(n=>n.setActiveDiffPath),l=x.useRef(null),o=x.useMemo(()=>(e==null?void 0:e.map(n=>({path:n.path,staged:n.staged})))??[],[e]),c=J(o);return x.useEffect(()=>{t()},[t]),x.useEffect(()=>{let n;const m=E(r=>{r.message==="changed"&&(n&&clearTimeout(n),n=setTimeout(t,250))}),f=()=>t();return window.addEventListener("focus",f),()=>{n&&clearTimeout(n),window.removeEventListener("focus",f),m()}},[t]),x.useEffect(()=>{const n=l.current;if(!n)return;const m=Array.from(n.querySelectorAll("[data-diff-path]"));if(m.length===0)return;const f=new Set,r=new IntersectionObserver(g=>{for(const d of g)d.isIntersecting?f.add(d.target):f.delete(d.target);const w=m.find(d=>f.has(d));w&&i(w.dataset.diffPath??null)},{rootMargin:"0px 0px -70% 0px"});for(const g of m)r.observe(g);return()=>r.disconnect()},[e,i]),{files:e,loadFailed:a,loadDiffFiles:t,sectionsRef:l,commitForm:c}},F=({additions:e,deletions:a})=>s.jsxs("span",{className:"inline-flex shrink-0 gap-1.5 font-mono text-3xs",children:[s.jsxs("span",{className:"text-watercolor-green-dark",children:["+",e]}),s.jsxs("span",{className:"text-watercolor-rose-dark",children:["-",a]})]}),Y=({path:e,prefix:a,className:t=""})=>{const{dir:i,base:l}=b(e),o=`${a??""}${i}`;return s.jsxs("span",{className:`flex min-w-0 items-center font-mono ${t}`,children:[o&&s.jsx("span",{className:"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap opacity-50",children:o}),s.jsx("span",{className:"shrink-0 whitespace-nowrap",children:l})]})},Z={success:"text-watercolor-green-dark",info:"text-watercolor-blue-dark",error:"text-watercolor-rose-dark",warning:"text-watercolor-amber-dark",neutral:"text-watercolor-slate-dark"},ee={A:{letter:"A",label:"Added",variant:"success"},M:{letter:"M",label:"Modified",variant:"info"},D:{letter:"D",label:"Deleted",variant:"error"},R:{letter:"R",label:"Renamed",variant:"info"},C:{letter:"C",label:"Copied",variant:"info"},U:{letter:"U",label:"Conflicted",variant:"warning"}},se=e=>{if(e==="??")return{letter:"??",label:"Untracked",variant:"neutral"};const[a,t]=e,i=a!==" "&&a!=="?"?a:t;return ee[i]??{letter:i??"?",label:i??"Unknown",variant:"neutral"}},P=({status:e,compact:a=!1})=>{const t=se(e);return a?s.jsx("span",{title:t.label,className:`w-4 shrink-0 text-center font-mono text-3xs font-semibold leading-none ${Z[t.variant]??""}`,children:t.letter}):s.jsx("span",{title:t.label,children:s.jsx(v,{size:"small",variant:t.variant,children:t.letter})})},te=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function ae(e){if(!e)return[];const a=(e.endsWith(`
|
|
2
2
|
`)?e.slice(0,-1):e).split(`
|
|
3
3
|
`),t=[];let i=null,l=0,o=0;for(const c of a){const n=c.match(te);if(n){i={header:c,lines:[]},t.push(i),l=Number(n[1]),o=Number(n[2]);continue}i&&(c.startsWith("\\")||(c.startsWith("+")?(i.lines.push({type:"add",text:c.slice(1),oldLine:null,newLine:o}),o++):c.startsWith("-")?(i.lines.push({type:"remove",text:c.slice(1),oldLine:l,newLine:null}),l++):(i.lines.push({type:"context",text:c.startsWith(" ")?c.slice(1):c,oldLine:l,newLine:o}),l++,o++)))}return t}function ie(e){return e?[{header:"",lines:(e.endsWith(`
|
|
4
4
|
`)?e.slice(0,-1):e).split(`
|
|
5
5
|
`).map((t,i)=>({type:"add",text:t,oldLine:null,newLine:i+1}))}]:[]}const ne=60,le={add:"bg-watercolor-green/[18%] text-watercolor-green-dark",remove:"bg-watercolor-rose/[18%] text-watercolor-rose-dark",context:""},oe={add:"+",remove:"-",context:" "},ce=({entry:e})=>s.jsxs("div",{className:"flex w-full min-w-0 items-center gap-3",children:[s.jsx(P,{status:e.status}),s.jsx(Y,{path:e.path,prefix:e.renameSource?`${e.renameSource} → `:void 0,className:"min-w-0 flex-1 text-xs"}),s.jsxs("span",{className:"flex shrink-0 items-center gap-2",children:[e.staged&&s.jsx(v,{size:"small",children:"staged"}),!e.binary&&s.jsx(F,{additions:e.additions,deletions:e.deletions})]})]}),re=({entry:e})=>{if(e.binary)return s.jsx("p",{className:"m-0 opacity-60",children:"Binary file not shown."});if(e.contentKind==="too-large")return s.jsx("p",{className:"m-0 opacity-60",children:"File too large to preview."});const a=e.contentKind==="raw"?ie(e.patch):ae(e.patch);return a.length===0?e.renameSource?s.jsx("p",{className:"m-0 opacity-60",children:e.additions===0&&e.deletions===0?"Renamed, no content changes.":"Renamed with unrelated content — diff omitted."}):s.jsx("p",{className:"m-0 opacity-60",children:"No changes to preview."}):s.jsx("div",{className:"flex min-w-0 max-w-full flex-col gap-3",children:a.map((t,i)=>s.jsxs("div",{className:"min-w-0 max-w-full",children:[t.header&&s.jsx("div",{className:"mb-1 font-mono text-2xs opacity-50",children:t.header}),s.jsx("pre",{className:"m-0 min-w-0 max-w-full overflow-x-auto font-mono text-2xs leading-normal",children:t.lines.map((l,o)=>s.jsxs("span",{className:`flex ${le[l.type]}`,children:[s.jsxs("span",{className:"inline-flex shrink-0 select-none gap-2 pr-2 opacity-40","aria-hidden":"true",children:[s.jsx("span",{className:"w-8 text-right",children:l.oldLine??""}),s.jsx("span",{className:"w-8 text-right",children:l.newLine??""})]}),s.jsxs("span",{children:[oe[l.type],l.text]})]},`${l.type}-${o}`))})]},`${t.header}-${i}`))})},de=({entry:e})=>{const a=h(c=>c.manuallyExpandedDiffPaths.has(e.path)),t=h(c=>c.manuallyCollapsedDiffPaths.has(e.path)),i=h(c=>c.setDiffCollapsed),l=t||!a&&e.additions+e.deletions>ne,o=e.renameSource?`${e.renameSource} → ${e.path}`:e.path;return s.jsxs("div",{"data-diff-path":e.path,className:"min-w-0 max-w-full scroll-mt-4",children:[s.jsx("h2",{className:"sr-only",children:o}),s.jsx(T,{title:s.jsx(ce,{entry:e}),expanded:!l,onToggle:()=>i(e.path,!l),children:s.jsx(re,{entry:e})})]})},fe="font-handwritten text-xs font-semibold leading-none opacity-[0.45]",me=(e,a)=>{a(e),requestAnimationFrame(()=>{var t;(t=document.querySelector(`[data-diff-path="${CSS.escape(e)}"]`))==null||t.scrollIntoView({behavior:"smooth",block:"start"})})},he=e=>{const[a,t]=e;return a!==" "&&a!=="?"&&t!==" "&&t!=="?"},pe=()=>{const{files:e,activePath:a,expandDiffPath:t,groups:i,pending:l,bulkPending:o,allStaged:c,toggleAll:n,toggleStaged:m}=V();return!e||e.length===0?null:s.jsxs("nav",{"aria-label":"Changed files",className:"flex flex-col",children:[s.jsxs("div",{className:`${fe} flex h-[32px] items-end justify-between pb-1`,children:[s.jsx("span",{children:"Changed files"}),s.jsx(C,{content:c?"Unstage every file":"Stage every file",children:s.jsx(R,{variant:"ghost",size:"tiny",className:"-mb-1",disabled:o,label:c?"Unstage all files":"Stage all files",onClick:n,icon:s.jsx(I,{})})})]}),s.jsx("ul",{className:"m-0 flex list-none flex-col p-0",children:i.map(f=>s.jsxs("li",{children:[s.jsx("div",{className:"flex h-[32px] items-end overflow-hidden text-ellipsis whitespace-nowrap pb-1 font-mono text-3xs leading-none opacity-50",title:f.dir,children:f.dir}),s.jsx("ul",{className:"m-0 flex list-none flex-col p-0",children:f.entries.map(r=>s.jsxs("li",{className:"pc-git-file-row flex h-[32px] min-w-0 items-end gap-1.5 pb-1",children:[s.jsx(_,{checked:r.staged,indeterminate:he(r.status),disabled:l.has(r.path),onChange:g=>m(r,g.target.checked),"aria-label":r.staged?`Unstage ${r.path}`:`Stage ${r.path}`}),s.jsx(P,{status:r.status,compact:!0}),s.jsx(G,{size:"small",active:r.path===a,onClick:()=>me(r.path,t),className:"min-w-0 flex-1 items-end py-0 text-3xs",action:!r.binary&&s.jsx(F,{additions:r.additions,deletions:r.deletions}),children:s.jsx("span",{className:"block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-3xs",title:r.path,children:b(r.path).base})})]},r.path))})]},f.dir))})]})},ue=()=>{const{files:e,loadFailed:a,loadDiffFiles:t,sectionsRef:i,commitForm:l}=X(),o="min-h-page",c=s.jsxs("div",{className:"mb-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-2",children:[s.jsx(z,{className:"!mb-0",children:"Git"}),s.jsxs("div",{className:"flex items-center gap-2",children:[s.jsx(B,{}),s.jsx(H,{})]})]});return a?s.jsxs("div",{children:[c,s.jsxs("div",{className:`${o} flex flex-col items-start gap-3`,children:[s.jsx("p",{className:"opacity-50 m-0",children:"Couldn't load the working-tree diff."}),s.jsx(k,{variant:"secondary",size:"small",onClick:t,children:"Retry"})]})]}):e?s.jsxs("div",{children:[c,e.length===0?s.jsx("div",{className:o,children:s.jsx("p",{className:"opacity-50",children:"No changed files."})}):s.jsxs(s.Fragment,{children:[s.jsxs("div",{className:"sticky top-0 z-10 mb-4 flex items-center gap-2 py-2",children:[s.jsx("div",{className:"flex-1",children:s.jsx(U,{state:l,filesEmpty:!1})}),s.jsx(W,{state:l,filesEmpty:!1})]}),s.jsx("div",{ref:i,className:`flex min-w-0 flex-col gap-6 ${o}`,children:e.map((n,m)=>s.jsxs(x.Fragment,{children:[m>0&&s.jsx(O,{}),s.jsx(de,{entry:n})]},n.path))})]})]}):s.jsxs("div",{children:[c,s.jsx("div",{className:o,children:s.jsx(M,{label:"Loading the working-tree diff…"})})]})};export{pe as GitFileList,ue as GitPage};
|
|
6
|
-
//# sourceMappingURL=index-
|
|
6
|
+
//# sourceMappingURL=index-CqDZ80wA.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-81fEepOO.js","sources":["../../../src/app/features/git/actions/git-commit-button.tsx","../../../src/app/features/git/hooks/use-git-commit-form.ts","../../../src/app/utils/path-display.ts","../../../src/app/features/git/hooks/use-git-file-list.ts","../../../src/app/features/git/hooks/use-git-page.ts","../../../src/app/features/git/components/count-badge.tsx","../../../src/app/features/git/components/file-path.tsx","../../../src/app/features/git/components/git-status-marker.tsx","../../../src/app/utils/parse-diff.ts","../../../src/app/features/git/views/file-diff-section.tsx","../../../src/app/features/git/views/git-file-list.tsx","../../../src/app/features/git/git-page.tsx"],"sourcesContent":["import type { GitCommitFormState } from '@/app/features/git/hooks';\nimport { useDeskChecks } from '@/app/hooks/use-desk-checks';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { deriveCheckStatuses } from '@/app/utils/check-status';\nimport { Button, Stamp, Tooltip } from '@dendelion/paper-ui';\nimport { useMemo } from 'react';\n\ninterface GitCommitButtonProps {\n state: GitCommitFormState;\n filesEmpty: boolean;\n}\n\n// Never Fix (plan-scoped, and the git page never has one) — a failing check is a warning instead.\nexport const GitCommitButton = ({ state, filesEmpty }: GitCommitButtonProps) => {\n const status = useAppStore((s) => s.status);\n const { checks: deskChecks } = useDeskChecks();\n const { qualityStatus, testStatus, consistencyStatus } = useMemo(\n () => deriveCheckStatuses(status, deskChecks),\n [status, deskChecks],\n );\n const failingChecks = [\n qualityStatus === 'fail' && 'Quality',\n testStatus === 'fail' && 'Tests',\n consistencyStatus === 'fail' && 'Consistency',\n ].filter((label): label is Exclude<typeof label, false> => label !== false);\n\n const commitButton = (\n <Button\n size=\"small\"\n disabled={filesEmpty || !state.commitTitle.trim() || state.committing || state.commitInFlight}\n onClick={state.handleCommit}\n >\n {state.committing || state.commitInFlight\n ? 'Committing…'\n : state.stagedCount > 0\n ? `Commit ${state.stagedCount} staged`\n : 'Commit'}\n </Button>\n );\n\n if (failingChecks.length === 0) return commitButton;\n\n return (\n <div className=\"flex items-center gap-2\">\n <Tooltip content={`${failingChecks.join(', ')} failing`}>\n <Stamp size=\"small\" variant=\"warning\">\n !\n </Stamp>\n </Tooltip>\n {commitButton}\n </div>\n );\n};\n","import { type CommitFormFile, useCommitForm } from '@/app/hooks/use-commit-form';\n\n// Stable across renders — keeps drafts saved under the git page's key from being orphaned.\nconst GIT_PAGE_FORM_KEY = '__git__';\n\nconst matchAnySuggestionTask = () => true;\n\n// No plan on the git page, so this is bare commit mechanics — no phase recording, no Fix.\nexport const useGitCommitForm = (files: CommitFormFile[]) =>\n useCommitForm(files, {\n formKey: GIT_PAGE_FORM_KEY,\n matchesSuggestionTask: matchAnySuggestionTask,\n });\n\nexport type GitCommitFormState = ReturnType<typeof useGitCommitForm>;\n","export interface SplitPath {\n dir: string;\n base: string;\n}\n\nexport function splitPathForDisplay(path: string): SplitPath {\n const slash = path.lastIndexOf('/');\n return slash === -1\n ? { dir: '', base: path }\n : { dir: path.slice(0, slash + 1), base: path.slice(slash + 1) };\n}\n","import { stagePath, unstagePath } from '@/app/services/git-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { oneLineErrorSummary } from '@/app/utils/error-summary';\nimport { splitPathForDisplay } from '@/app/utils/path-display';\nimport type { FileDiffEntry } from '@/types/index';\nimport { useToast } from '@dendelion/paper-ui';\nimport { useMemo, useState } from 'react';\n\nfunction groupByFolder(files: FileDiffEntry[]): { dir: string; entries: FileDiffEntry[] }[] {\n const groups = new Map<string, FileDiffEntry[]>();\n for (const entry of files) {\n const { dir } = splitPathForDisplay(entry.path);\n const key = dir || './';\n const bucket = groups.get(key);\n if (bucket) bucket.push(entry);\n else groups.set(key, [entry]);\n }\n return [...groups].map(([dir, entries]) => ({ dir, entries }));\n}\n\nexport const useGitFileList = () => {\n const files = useAppStore((s) => s.diffFiles);\n const activePath = useAppStore((s) => s.activeDiffPath);\n const loadDiffFiles = useAppStore((s) => s.loadDiffFiles);\n const expandDiffPath = useAppStore((s) => s.expandDiffPath);\n const [pending, setPending] = useState<Set<string>>(new Set());\n const [bulkPending, setBulkPending] = useState(false);\n const { toast } = useToast();\n const groups = useMemo(() => groupByFolder(files ?? []), [files]);\n const allStaged = (files ?? []).length > 0 && (files ?? []).every((f) => f.staged);\n\n // No bulk endpoint: fans out over per-path calls and reloads once at the end, so a\n // partial failure still reports and whatever landed shows up in that single reload.\n const toggleAll = async () => {\n const targets = (files ?? []).filter((f) => f.staged === allStaged);\n setBulkPending(true);\n try {\n const results = await Promise.allSettled(\n targets.map((f) => (allStaged ? unstagePath(f.path) : stagePath(f.path))),\n );\n const failed = results.filter((r) => r.status === 'rejected').length;\n if (failed > 0) {\n toast({\n title: allStaged ? 'Unstage failed' : 'Stage failed',\n description: `${failed} of ${targets.length} file(s) could not be updated.`,\n variant: 'error',\n });\n }\n } finally {\n await loadDiffFiles();\n setBulkPending(false);\n }\n };\n\n const toggleStaged = async (entry: FileDiffEntry, next: boolean) => {\n setPending((prev) => new Set(prev).add(entry.path));\n try {\n await (next ? stagePath(entry.path) : unstagePath(entry.path));\n await loadDiffFiles();\n } catch (err) {\n toast({\n title: next ? 'Stage failed' : 'Unstage failed',\n description: oneLineErrorSummary((err as Error).message),\n variant: 'error',\n });\n } finally {\n setPending((prev) => {\n const updated = new Set(prev);\n updated.delete(entry.path);\n return updated;\n });\n }\n };\n\n return {\n files,\n activePath,\n expandDiffPath,\n groups,\n pending,\n bulkPending,\n allStaged,\n toggleAll,\n toggleStaged,\n };\n};\n","import { useGitCommitForm } from '@/app/features/git/hooks/use-git-commit-form';\nimport { subscribeToActivityStream } from '@/app/services/activity-stream';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { useEffect, useMemo, useRef } from 'react';\n\nexport const useGitPage = () => {\n const files = useAppStore((s) => s.diffFiles);\n const loadFailed = useAppStore((s) => s.diffLoadFailed);\n const loadDiffFiles = useAppStore((s) => s.loadDiffFiles);\n const setActiveDiffPath = useAppStore((s) => s.setActiveDiffPath);\n const sectionsRef = useRef<HTMLDivElement>(null);\n const commitFiles = useMemo(\n () => files?.map((entry) => ({ path: entry.path, staged: entry.staged })) ?? [],\n [files],\n );\n const commitForm = useGitCommitForm(commitFiles);\n\n useEffect(() => {\n loadDiffFiles();\n }, [loadDiffFiles]);\n\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const unsubscribe = subscribeToActivityStream((payload) => {\n if (payload.message !== 'changed') return;\n if (timer) clearTimeout(timer);\n timer = setTimeout(loadDiffFiles, 250);\n });\n const onFocus = () => loadDiffFiles();\n window.addEventListener('focus', onFocus);\n return () => {\n if (timer) clearTimeout(timer);\n window.removeEventListener('focus', onFocus);\n unsubscribe();\n };\n }, [loadDiffFiles]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: files is the trigger to rebuild the observer, not a value read in the body.\n useEffect(() => {\n const root = sectionsRef.current;\n if (!root) return;\n const sections = Array.from(root.querySelectorAll<HTMLElement>('[data-diff-path]'));\n if (sections.length === 0) return;\n const visible = new Set<HTMLElement>();\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) visible.add(entry.target as HTMLElement);\n else visible.delete(entry.target as HTMLElement);\n }\n const topmost = sections.find((el) => visible.has(el));\n if (topmost) setActiveDiffPath(topmost.dataset.diffPath ?? null);\n },\n { rootMargin: '0px 0px -70% 0px' },\n );\n for (const el of sections) observer.observe(el);\n return () => observer.disconnect();\n }, [files, setActiveDiffPath]);\n\n return {\n files,\n loadFailed,\n loadDiffFiles,\n sectionsRef,\n commitForm,\n };\n};\n\nexport type GitPageState = ReturnType<typeof useGitPage>;\n","interface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nexport const CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex shrink-0 gap-1.5 font-mono text-3xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n","import { splitPathForDisplay } from '@/app/utils/path-display';\n\ninterface FilePathProps {\n path: string;\n prefix?: string;\n className?: string;\n}\n\nexport const FilePath = ({ path, prefix, className = '' }: FilePathProps) => {\n const { dir, base } = splitPathForDisplay(path);\n const dimmed = `${prefix ?? ''}${dir}`;\n return (\n <span className={`flex min-w-0 items-center font-mono ${className}`}>\n {dimmed && (\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap opacity-50\">\n {dimmed}\n </span>\n )}\n <span className=\"shrink-0 whitespace-nowrap\">{base}</span>\n </span>\n );\n};\n","import { Stamp, type StampVariant } from '@dendelion/paper-ui';\n\ninterface StatusInfo {\n letter: string;\n label: string;\n variant: StampVariant;\n}\n\n// Compact rows can't spare the ~39px a Stamp's blob costs for one letter; the colour\n// alone carries the same meaning in a fraction of the width.\nconst COMPACT_COLOR: Record<StampVariant, string> = {\n success: 'text-watercolor-green-dark',\n info: 'text-watercolor-blue-dark',\n error: 'text-watercolor-rose-dark',\n warning: 'text-watercolor-amber-dark',\n neutral: 'text-watercolor-slate-dark',\n};\n\nconst STATUS_INFO: Record<string, StatusInfo> = {\n A: { letter: 'A', label: 'Added', variant: 'success' },\n M: { letter: 'M', label: 'Modified', variant: 'info' },\n D: { letter: 'D', label: 'Deleted', variant: 'error' },\n R: { letter: 'R', label: 'Renamed', variant: 'info' },\n C: { letter: 'C', label: 'Copied', variant: 'info' },\n U: { letter: 'U', label: 'Conflicted', variant: 'warning' },\n};\n\n// Git's porcelain code is two characters: index status then worktree status.\n// The index one wins when both are set — it's the state that would actually commit.\nexport const gitStatusInfo = (status: string): StatusInfo => {\n if (status === '??') return { letter: '??', label: 'Untracked', variant: 'neutral' };\n const [x, y] = status;\n const code = x !== ' ' && x !== '?' ? x : y;\n return STATUS_INFO[code] ?? { letter: code ?? '?', label: code ?? 'Unknown', variant: 'neutral' };\n};\n\ninterface GitStatusMarkerProps {\n status: string;\n compact?: boolean;\n}\n\nexport const GitStatusMarker = ({ status, compact = false }: GitStatusMarkerProps) => {\n const info = gitStatusInfo(status);\n if (compact) {\n return (\n <span\n title={info.label}\n className={`w-4 shrink-0 text-center font-mono text-3xs font-semibold leading-none ${COMPACT_COLOR[info.variant] ?? ''}`}\n >\n {info.letter}\n </span>\n );\n }\n return (\n <span title={info.label}>\n <Stamp size=\"small\" variant={info.variant}>\n {info.letter}\n </Stamp>\n </span>\n );\n};\n","export type DiffLineType = 'add' | 'remove' | 'context';\n\nexport interface DiffLine {\n type: DiffLineType;\n text: string;\n oldLine: number | null;\n newLine: number | null;\n}\n\nexport interface DiffHunk {\n header: string;\n lines: DiffLine[];\n}\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/;\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 let oldLine = 0;\n let newLine = 0;\n for (const line of lines) {\n const header = line.match(HUNK_HEADER);\n if (header) {\n current = { header: line, lines: [] };\n hunks.push(current);\n oldLine = Number(header[1]);\n newLine = Number(header[2]);\n continue;\n }\n if (!current) continue; // preamble: diff --git / index / --- / +++\n if (line.startsWith('\\\\')) continue; // \"\\"\n if (line.startsWith('+')) {\n current.lines.push({ type: 'add', text: line.slice(1), oldLine: null, newLine });\n newLine++;\n } else if (line.startsWith('-')) {\n current.lines.push({ type: 'remove', text: line.slice(1), oldLine, newLine: null });\n oldLine++;\n } else {\n current.lines.push({\n type: 'context',\n text: line.startsWith(' ') ? line.slice(1) : line,\n oldLine,\n newLine,\n });\n oldLine++;\n newLine++;\n }\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 [\n {\n header: '',\n lines: lines.map((text, i) => ({ type: 'add', text, oldLine: null, newLine: i + 1 })),\n },\n ];\n}\n","import { CountBadge, FilePath, GitStatusMarker } from '@/app/features/git/components';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { type DiffLineType, parsePatch, rawContentHunks } from '@/app/utils/parse-diff';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Accordion, Stamp } from '@dendelion/paper-ui';\n\nconst COLLAPSE_LINE_THRESHOLD = 60;\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 FileHeaderProps {\n entry: FileDiffEntry;\n}\n\nconst FileHeader = ({ entry }: FileHeaderProps) => (\n <div className=\"flex w-full min-w-0 items-center gap-3\">\n <GitStatusMarker status={entry.status} />\n <FilePath\n path={entry.path}\n prefix={entry.renameSource ? `${entry.renameSource} → ` : undefined}\n className=\"min-w-0 flex-1 text-xs\"\n />\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 min-w-0 max-w-full flex-col gap-3\">\n {hunks.map((hunk, i) => (\n <div key={`${hunk.header}-${i}`} className=\"min-w-0 max-w-full\">\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 min-w-0 max-w-full overflow-x-auto font-mono text-2xs leading-normal\">\n {hunk.lines.map((line, j) => (\n <span key={`${line.type}-${j}`} className={`flex ${LINE_CLASS[line.type]}`}>\n <span\n className=\"inline-flex shrink-0 select-none gap-2 pr-2 opacity-40\"\n aria-hidden=\"true\"\n >\n <span className=\"w-8 text-right\">{line.oldLine ?? ''}</span>\n <span className=\"w-8 text-right\">{line.newLine ?? ''}</span>\n </span>\n <span>\n {LINE_PREFIX[line.type]}\n {line.text}\n </span>\n </span>\n ))}\n </pre>\n </div>\n ))}\n </div>\n );\n};\n\ninterface FileDiffSectionProps {\n entry: FileDiffEntry;\n}\n\nexport const FileDiffSection = ({ entry }: FileDiffSectionProps) => {\n const manuallyExpanded = useAppStore((s) => s.manuallyExpandedDiffPaths.has(entry.path));\n const manuallyCollapsed = useAppStore((s) => s.manuallyCollapsedDiffPaths.has(entry.path));\n const setDiffCollapsed = useAppStore((s) => s.setDiffCollapsed);\n const collapsed =\n manuallyCollapsed ||\n (!manuallyExpanded && entry.additions + entry.deletions > COLLAPSE_LINE_THRESHOLD);\n\n const headingText = entry.renameSource ? `${entry.renameSource} → ${entry.path}` : entry.path;\n\n return (\n <div data-diff-path={entry.path} className=\"min-w-0 max-w-full scroll-mt-4\">\n <h2 className=\"sr-only\">{headingText}</h2>\n <Accordion\n title={<FileHeader entry={entry} />}\n expanded={!collapsed}\n onToggle={() => setDiffCollapsed(entry.path, !collapsed)}\n >\n <DiffBody entry={entry} />\n </Accordion>\n </div>\n );\n};\n","import { CheckAllIcon } from '@/app/components/icons';\nimport { CountBadge, GitStatusMarker } from '@/app/features/git/components';\nimport { useGitFileList } from '@/app/features/git/hooks';\nimport { splitPathForDisplay } from '@/app/utils/path-display';\nimport { Checkbox, IconButton, ListItem, Tooltip } from '@dendelion/paper-ui';\n\nconst sectionLabelClass = 'font-handwritten text-xs font-semibold leading-none opacity-[0.45]';\n\nconst scrollToFile = (path: string, expandDiffPath: (path: string) => void) => {\n expandDiffPath(path);\n requestAnimationFrame(() => {\n document\n .querySelector(`[data-diff-path=\"${CSS.escape(path)}\"]`)\n ?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n });\n};\n\n// Both status characters set (and neither '?', which pairs up for untracked) means\n// part of the file is staged and part isn't — git can't be checked or unchecked.\nconst isPartiallyStaged = (status: string) => {\n const [x, y] = status;\n return x !== ' ' && x !== '?' && y !== ' ' && y !== '?';\n};\n\nexport const GitFileList = () => {\n const {\n files,\n activePath,\n expandDiffPath,\n groups,\n pending,\n bulkPending,\n allStaged,\n toggleAll,\n toggleStaged,\n } = useGitFileList();\n\n if (!files || files.length === 0) return null;\n\n return (\n <nav aria-label=\"Changed files\" className=\"flex flex-col\">\n <div className={`${sectionLabelClass} flex h-[32px] items-end justify-between pb-1`}>\n <span>Changed files</span>\n <Tooltip content={allStaged ? 'Unstage every file' : 'Stage every file'}>\n <IconButton\n variant=\"ghost\"\n size=\"tiny\"\n className=\"-mb-1\"\n disabled={bulkPending}\n label={allStaged ? 'Unstage all files' : 'Stage all files'}\n onClick={toggleAll}\n icon={<CheckAllIcon />}\n />\n </Tooltip>\n </div>\n {/* Every row is exactly one 32px cell so the list tracks the ruled background. */}\n <ul className=\"m-0 flex list-none flex-col p-0\">\n {groups.map((group) => (\n <li key={group.dir}>\n <div\n className=\"flex h-[32px] items-end overflow-hidden text-ellipsis whitespace-nowrap pb-1 font-mono text-3xs leading-none opacity-50\"\n title={group.dir}\n >\n {group.dir}\n </div>\n <ul className=\"m-0 flex list-none flex-col p-0\">\n {group.entries.map((entry) => (\n <li\n key={entry.path}\n className=\"pc-git-file-row flex h-[32px] min-w-0 items-end gap-1.5 pb-1\"\n >\n <Checkbox\n checked={entry.staged}\n indeterminate={isPartiallyStaged(entry.status)}\n disabled={pending.has(entry.path)}\n onChange={(e) => toggleStaged(entry, e.target.checked)}\n aria-label={entry.staged ? `Unstage ${entry.path}` : `Stage ${entry.path}`}\n />\n <GitStatusMarker status={entry.status} compact />\n <ListItem\n size=\"small\"\n active={entry.path === activePath}\n onClick={() => scrollToFile(entry.path, expandDiffPath)}\n className=\"min-w-0 flex-1 items-end py-0 text-3xs\"\n action={\n !entry.binary && (\n <CountBadge additions={entry.additions} deletions={entry.deletions} />\n )\n }\n >\n <span\n className=\"block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-3xs\"\n title={entry.path}\n >\n {splitPathForDisplay(entry.path).base}\n </span>\n </ListItem>\n </li>\n ))}\n </ul>\n </li>\n ))}\n </ul>\n </nav>\n );\n};\n","import { CommitMessageFields, GitStashSurface, GitSyncActions } from '@/app/components';\nimport { PageTitle } from '@/app/components/page-title';\nimport { GitCommitButton } from '@/app/features/git/actions';\nimport { useGitPage } from '@/app/features/git/hooks';\nimport { FileDiffSection } from '@/app/features/git/views';\nimport { Button, Divider, Spinner } from '@dendelion/paper-ui';\nimport { Fragment } from 'react';\n\nexport const GitPage = () => {\n const { files, loadFailed, loadDiffFiles, sectionsRef, commitForm } = useGitPage();\n\n const contentClass = 'min-h-page';\n\n const header = (\n <div className=\"mb-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-2\">\n <PageTitle className=\"!mb-0\">Git</PageTitle>\n <div className=\"flex items-center gap-2\">\n <GitSyncActions />\n <GitStashSurface />\n </div>\n </div>\n );\n\n if (loadFailed) {\n return (\n <div>\n {header}\n <div className={`${contentClass} flex flex-col items-start gap-3`}>\n <p className=\"opacity-50 m-0\">Couldn't load the working-tree diff.</p>\n <Button variant=\"secondary\" size=\"small\" onClick={loadDiffFiles}>\n Retry\n </Button>\n </div>\n </div>\n );\n }\n\n if (!files) {\n return (\n <div>\n {header}\n <div className={contentClass}>\n <Spinner label=\"Loading the working-tree diff…\" />\n </div>\n </div>\n );\n }\n\n return (\n <div>\n {header}\n {files.length === 0 ? (\n <div className={contentClass}>\n <p className=\"opacity-50\">No changed files.</p>\n </div>\n ) : (\n <>\n <div className=\"sticky top-0 z-10 mb-4 flex items-center gap-2 py-2\">\n <div className=\"flex-1\">\n <CommitMessageFields state={commitForm} filesEmpty={false} />\n </div>\n <GitCommitButton state={commitForm} filesEmpty={false} />\n </div>\n <div ref={sectionsRef} className={`flex min-w-0 flex-col gap-6 ${contentClass}`}>\n {files.map((entry, idx) => (\n <Fragment key={entry.path}>\n {idx > 0 && <Divider />}\n <FileDiffSection entry={entry} />\n </Fragment>\n ))}\n </div>\n </>\n )}\n </div>\n );\n};\n"],"names":["GitCommitButton","state","filesEmpty","status","useAppStore","s","deskChecks","useDeskChecks","qualityStatus","testStatus","consistencyStatus","useMemo","deriveCheckStatuses","failingChecks","label","commitButton","jsx","Button","jsxs","Tooltip","Stamp","GIT_PAGE_FORM_KEY","matchAnySuggestionTask","useGitCommitForm","files","useCommitForm","splitPathForDisplay","path","slash","groupByFolder","groups","entry","dir","key","bucket","entries","useGitFileList","activePath","loadDiffFiles","expandDiffPath","pending","setPending","useState","bulkPending","setBulkPending","toast","useToast","allStaged","f","targets","failed","unstagePath","stagePath","r","next","prev","err","oneLineErrorSummary","updated","useGitPage","loadFailed","setActiveDiffPath","sectionsRef","useRef","commitFiles","commitForm","useEffect","timer","unsubscribe","subscribeToActivityStream","payload","onFocus","root","sections","visible","observer","topmost","el","CountBadge","additions","deletions","FilePath","prefix","className","base","dimmed","COMPACT_COLOR","STATUS_INFO","gitStatusInfo","x","y","code","GitStatusMarker","compact","info","HUNK_HEADER","parsePatch","patch","lines","hunks","current","oldLine","newLine","line","header","rawContentHunks","content","text","COLLAPSE_LINE_THRESHOLD","LINE_CLASS","LINE_PREFIX","FileHeader","DiffBody","hunk","j","FileDiffSection","manuallyExpanded","manuallyCollapsed","setDiffCollapsed","collapsed","headingText","Accordion","sectionLabelClass","scrollToFile","_a","isPartiallyStaged","GitFileList","toggleAll","toggleStaged","IconButton","CheckAllIcon","group","Checkbox","e","ListItem","GitPage","contentClass","PageTitle","GitSyncActions","GitStashSurface","Fragment","CommitMessageFields","idx","Divider","Spinner"],"mappings":"2NAaO,MAAMA,EAAkB,CAAC,CAAE,MAAAC,EAAO,WAAAC,KAAuC,CAC9E,MAAMC,EAASC,EAAaC,GAAMA,EAAE,MAAM,EACpC,CAAE,OAAQC,CAAA,EAAeC,EAAA,EACzB,CAAE,cAAAC,EAAe,WAAAC,EAAY,kBAAAC,CAAA,EAAsBC,EAAAA,QACvD,IAAMC,EAAoBT,EAAQG,CAAU,EAC5C,CAACH,EAAQG,CAAU,CAAA,EAEfO,EAAgB,CACp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,IAAI,CAACO,EAAO+G,IACjB5H,OAAC0H,EAAAA,SAAA,CACE,SAAA,CAAAE,EAAM,SAAMC,EAAA,CAAA,CAAQ,EACrB/H,MAACmG,IAAgB,MAAApF,CAAA,CAAc,CAAA,GAFlBA,EAAM,IAGrB,CACD,CAAA,CACH,CAAA,CAAA,CACF,CAAA,EAEJ,SAlCG,MAAA,CACE,SAAA,CAAAyE,EACDxF,EAAAA,IAAC,OAAI,UAAWwH,EACd,eAACQ,EAAA,CAAQ,MAAM,iCAAiC,CAAA,CAClD,CAAA,EACF,CA+BN"}
|
|
1
|
+
{"version":3,"file":"index-CqDZ80wA.js","sources":["../../../src/app/features/git/actions/git-commit-button.tsx","../../../src/app/features/git/hooks/use-git-commit-form.ts","../../../src/app/utils/path-display.ts","../../../src/app/features/git/hooks/use-git-file-list.ts","../../../src/app/features/git/hooks/use-git-page.ts","../../../src/app/features/git/components/count-badge.tsx","../../../src/app/features/git/components/file-path.tsx","../../../src/app/features/git/components/git-status-marker.tsx","../../../src/app/utils/parse-diff.ts","../../../src/app/features/git/views/file-diff-section.tsx","../../../src/app/features/git/views/git-file-list.tsx","../../../src/app/features/git/git-page.tsx"],"sourcesContent":["import type { GitCommitFormState } from '@/app/features/git/hooks';\nimport { useDeskChecks } from '@/app/hooks/use-desk-checks';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { deriveCheckStatuses } from '@/app/utils/check-status';\nimport { Button, Stamp, Tooltip } from '@dendelion/paper-ui';\nimport { useMemo } from 'react';\n\ninterface GitCommitButtonProps {\n state: GitCommitFormState;\n filesEmpty: boolean;\n}\n\n// Never Fix (plan-scoped, and the git page never has one) — a failing check is a warning instead.\nexport const GitCommitButton = ({ state, filesEmpty }: GitCommitButtonProps) => {\n const status = useAppStore((s) => s.status);\n const { checks: deskChecks } = useDeskChecks();\n const { qualityStatus, testStatus, consistencyStatus } = useMemo(\n () => deriveCheckStatuses(status, deskChecks),\n [status, deskChecks],\n );\n const failingChecks = [\n qualityStatus === 'fail' && 'Quality',\n testStatus === 'fail' && 'Tests',\n consistencyStatus === 'fail' && 'Consistency',\n ].filter((label): label is Exclude<typeof label, false> => label !== false);\n\n const commitButton = (\n <Button\n size=\"small\"\n disabled={filesEmpty || !state.commitTitle.trim() || state.committing || state.commitInFlight}\n onClick={state.handleCommit}\n >\n {state.committing || state.commitInFlight\n ? 'Committing…'\n : state.stagedCount > 0\n ? `Commit ${state.stagedCount} staged`\n : 'Commit'}\n </Button>\n );\n\n if (failingChecks.length === 0) return commitButton;\n\n return (\n <div className=\"flex items-center gap-2\">\n <Tooltip content={`${failingChecks.join(', ')} failing`}>\n <Stamp size=\"small\" variant=\"warning\">\n !\n </Stamp>\n </Tooltip>\n {commitButton}\n </div>\n );\n};\n","import { type CommitFormFile, useCommitForm } from '@/app/hooks/use-commit-form';\n\n// Stable across renders — keeps drafts saved under the git page's key from being orphaned.\nconst GIT_PAGE_FORM_KEY = '__git__';\n\nconst matchAnySuggestionTask = () => true;\n\n// No plan on the git page, so this is bare commit mechanics — no phase recording, no Fix.\nexport const useGitCommitForm = (files: CommitFormFile[]) =>\n useCommitForm(files, {\n formKey: GIT_PAGE_FORM_KEY,\n matchesSuggestionTask: matchAnySuggestionTask,\n });\n\nexport type GitCommitFormState = ReturnType<typeof useGitCommitForm>;\n","export interface SplitPath {\n dir: string;\n base: string;\n}\n\nexport function splitPathForDisplay(path: string): SplitPath {\n const slash = path.lastIndexOf('/');\n return slash === -1\n ? { dir: '', base: path }\n : { dir: path.slice(0, slash + 1), base: path.slice(slash + 1) };\n}\n","import { stagePath, unstagePath } from '@/app/services/git-api';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { oneLineErrorSummary } from '@/app/utils/error-summary';\nimport { splitPathForDisplay } from '@/app/utils/path-display';\nimport type { FileDiffEntry } from '@/types/index';\nimport { useToast } from '@dendelion/paper-ui';\nimport { useMemo, useState } from 'react';\n\nfunction groupByFolder(files: FileDiffEntry[]): { dir: string; entries: FileDiffEntry[] }[] {\n const groups = new Map<string, FileDiffEntry[]>();\n for (const entry of files) {\n const { dir } = splitPathForDisplay(entry.path);\n const key = dir || './';\n const bucket = groups.get(key);\n if (bucket) bucket.push(entry);\n else groups.set(key, [entry]);\n }\n return [...groups].map(([dir, entries]) => ({ dir, entries }));\n}\n\nexport const useGitFileList = () => {\n const files = useAppStore((s) => s.diffFiles);\n const activePath = useAppStore((s) => s.activeDiffPath);\n const loadDiffFiles = useAppStore((s) => s.loadDiffFiles);\n const expandDiffPath = useAppStore((s) => s.expandDiffPath);\n const [pending, setPending] = useState<Set<string>>(new Set());\n const [bulkPending, setBulkPending] = useState(false);\n const { toast } = useToast();\n const groups = useMemo(() => groupByFolder(files ?? []), [files]);\n const allStaged = (files ?? []).length > 0 && (files ?? []).every((f) => f.staged);\n\n // No bulk endpoint: fans out over per-path calls and reloads once at the end, so a\n // partial failure still reports and whatever landed shows up in that single reload.\n const toggleAll = async () => {\n const targets = (files ?? []).filter((f) => f.staged === allStaged);\n setBulkPending(true);\n try {\n const results = await Promise.allSettled(\n targets.map((f) => (allStaged ? unstagePath(f.path) : stagePath(f.path))),\n );\n const failed = results.filter((r) => r.status === 'rejected').length;\n if (failed > 0) {\n toast({\n title: allStaged ? 'Unstage failed' : 'Stage failed',\n description: `${failed} of ${targets.length} file(s) could not be updated.`,\n variant: 'error',\n });\n }\n } finally {\n await loadDiffFiles();\n setBulkPending(false);\n }\n };\n\n const toggleStaged = async (entry: FileDiffEntry, next: boolean) => {\n setPending((prev) => new Set(prev).add(entry.path));\n try {\n await (next ? stagePath(entry.path) : unstagePath(entry.path));\n await loadDiffFiles();\n } catch (err) {\n toast({\n title: next ? 'Stage failed' : 'Unstage failed',\n description: oneLineErrorSummary((err as Error).message),\n variant: 'error',\n });\n } finally {\n setPending((prev) => {\n const updated = new Set(prev);\n updated.delete(entry.path);\n return updated;\n });\n }\n };\n\n return {\n files,\n activePath,\n expandDiffPath,\n groups,\n pending,\n bulkPending,\n allStaged,\n toggleAll,\n toggleStaged,\n };\n};\n","import { useGitCommitForm } from '@/app/features/git/hooks/use-git-commit-form';\nimport { subscribeToActivityStream } from '@/app/services/activity-stream';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { useEffect, useMemo, useRef } from 'react';\n\nexport const useGitPage = () => {\n const files = useAppStore((s) => s.diffFiles);\n const loadFailed = useAppStore((s) => s.diffLoadFailed);\n const loadDiffFiles = useAppStore((s) => s.loadDiffFiles);\n const setActiveDiffPath = useAppStore((s) => s.setActiveDiffPath);\n const sectionsRef = useRef<HTMLDivElement>(null);\n const commitFiles = useMemo(\n () => files?.map((entry) => ({ path: entry.path, staged: entry.staged })) ?? [],\n [files],\n );\n const commitForm = useGitCommitForm(commitFiles);\n\n useEffect(() => {\n loadDiffFiles();\n }, [loadDiffFiles]);\n\n useEffect(() => {\n let timer: ReturnType<typeof setTimeout> | undefined;\n const unsubscribe = subscribeToActivityStream((payload) => {\n if (payload.message !== 'changed') return;\n if (timer) clearTimeout(timer);\n timer = setTimeout(loadDiffFiles, 250);\n });\n const onFocus = () => loadDiffFiles();\n window.addEventListener('focus', onFocus);\n return () => {\n if (timer) clearTimeout(timer);\n window.removeEventListener('focus', onFocus);\n unsubscribe();\n };\n }, [loadDiffFiles]);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: files is the trigger to rebuild the observer, not a value read in the body.\n useEffect(() => {\n const root = sectionsRef.current;\n if (!root) return;\n const sections = Array.from(root.querySelectorAll<HTMLElement>('[data-diff-path]'));\n if (sections.length === 0) return;\n const visible = new Set<HTMLElement>();\n const observer = new IntersectionObserver(\n (entries) => {\n for (const entry of entries) {\n if (entry.isIntersecting) visible.add(entry.target as HTMLElement);\n else visible.delete(entry.target as HTMLElement);\n }\n const topmost = sections.find((el) => visible.has(el));\n if (topmost) setActiveDiffPath(topmost.dataset.diffPath ?? null);\n },\n { rootMargin: '0px 0px -70% 0px' },\n );\n for (const el of sections) observer.observe(el);\n return () => observer.disconnect();\n }, [files, setActiveDiffPath]);\n\n return {\n files,\n loadFailed,\n loadDiffFiles,\n sectionsRef,\n commitForm,\n };\n};\n\nexport type GitPageState = ReturnType<typeof useGitPage>;\n","interface CountBadgeProps {\n additions: number;\n deletions: number;\n}\n\nexport const CountBadge = ({ additions, deletions }: CountBadgeProps) => (\n <span className=\"inline-flex shrink-0 gap-1.5 font-mono text-3xs\">\n <span className=\"text-watercolor-green-dark\">+{additions}</span>\n <span className=\"text-watercolor-rose-dark\">-{deletions}</span>\n </span>\n);\n","import { splitPathForDisplay } from '@/app/utils/path-display';\n\ninterface FilePathProps {\n path: string;\n prefix?: string;\n className?: string;\n}\n\nexport const FilePath = ({ path, prefix, className = '' }: FilePathProps) => {\n const { dir, base } = splitPathForDisplay(path);\n const dimmed = `${prefix ?? ''}${dir}`;\n return (\n <span className={`flex min-w-0 items-center font-mono ${className}`}>\n {dimmed && (\n <span className=\"min-w-0 overflow-hidden text-ellipsis whitespace-nowrap opacity-50\">\n {dimmed}\n </span>\n )}\n <span className=\"shrink-0 whitespace-nowrap\">{base}</span>\n </span>\n );\n};\n","import { Stamp, type StampVariant } from '@dendelion/paper-ui';\n\ninterface StatusInfo {\n letter: string;\n label: string;\n variant: StampVariant;\n}\n\n// Compact rows can't spare the ~39px a Stamp's blob costs for one letter; the colour\n// alone carries the same meaning in a fraction of the width.\nconst COMPACT_COLOR: Record<StampVariant, string> = {\n success: 'text-watercolor-green-dark',\n info: 'text-watercolor-blue-dark',\n error: 'text-watercolor-rose-dark',\n warning: 'text-watercolor-amber-dark',\n neutral: 'text-watercolor-slate-dark',\n};\n\nconst STATUS_INFO: Record<string, StatusInfo> = {\n A: { letter: 'A', label: 'Added', variant: 'success' },\n M: { letter: 'M', label: 'Modified', variant: 'info' },\n D: { letter: 'D', label: 'Deleted', variant: 'error' },\n R: { letter: 'R', label: 'Renamed', variant: 'info' },\n C: { letter: 'C', label: 'Copied', variant: 'info' },\n U: { letter: 'U', label: 'Conflicted', variant: 'warning' },\n};\n\n// Git's porcelain code is two characters: index status then worktree status.\n// The index one wins when both are set — it's the state that would actually commit.\nexport const gitStatusInfo = (status: string): StatusInfo => {\n if (status === '??') return { letter: '??', label: 'Untracked', variant: 'neutral' };\n const [x, y] = status;\n const code = x !== ' ' && x !== '?' ? x : y;\n return STATUS_INFO[code] ?? { letter: code ?? '?', label: code ?? 'Unknown', variant: 'neutral' };\n};\n\ninterface GitStatusMarkerProps {\n status: string;\n compact?: boolean;\n}\n\nexport const GitStatusMarker = ({ status, compact = false }: GitStatusMarkerProps) => {\n const info = gitStatusInfo(status);\n if (compact) {\n return (\n <span\n title={info.label}\n className={`w-4 shrink-0 text-center font-mono text-3xs font-semibold leading-none ${COMPACT_COLOR[info.variant] ?? ''}`}\n >\n {info.letter}\n </span>\n );\n }\n return (\n <span title={info.label}>\n <Stamp size=\"small\" variant={info.variant}>\n {info.letter}\n </Stamp>\n </span>\n );\n};\n","export type DiffLineType = 'add' | 'remove' | 'context';\n\nexport interface DiffLine {\n type: DiffLineType;\n text: string;\n oldLine: number | null;\n newLine: number | null;\n}\n\nexport interface DiffHunk {\n header: string;\n lines: DiffLine[];\n}\n\nconst HUNK_HEADER = /^@@ -(\\d+)(?:,\\d+)? \\+(\\d+)(?:,\\d+)? @@/;\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 let oldLine = 0;\n let newLine = 0;\n for (const line of lines) {\n const header = line.match(HUNK_HEADER);\n if (header) {\n current = { header: line, lines: [] };\n hunks.push(current);\n oldLine = Number(header[1]);\n newLine = Number(header[2]);\n continue;\n }\n if (!current) continue; // preamble: diff --git / index / --- / +++\n if (line.startsWith('\\\\')) continue; // \"\\"\n if (line.startsWith('+')) {\n current.lines.push({ type: 'add', text: line.slice(1), oldLine: null, newLine });\n newLine++;\n } else if (line.startsWith('-')) {\n current.lines.push({ type: 'remove', text: line.slice(1), oldLine, newLine: null });\n oldLine++;\n } else {\n current.lines.push({\n type: 'context',\n text: line.startsWith(' ') ? line.slice(1) : line,\n oldLine,\n newLine,\n });\n oldLine++;\n newLine++;\n }\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 [\n {\n header: '',\n lines: lines.map((text, i) => ({ type: 'add', text, oldLine: null, newLine: i + 1 })),\n },\n ];\n}\n","import { CountBadge, FilePath, GitStatusMarker } from '@/app/features/git/components';\nimport { useAppStore } from '@/app/stores/app-store';\nimport { type DiffLineType, parsePatch, rawContentHunks } from '@/app/utils/parse-diff';\nimport type { FileDiffEntry } from '@/types/index';\nimport { Accordion, Stamp } from '@dendelion/paper-ui';\n\nconst COLLAPSE_LINE_THRESHOLD = 60;\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 FileHeaderProps {\n entry: FileDiffEntry;\n}\n\nconst FileHeader = ({ entry }: FileHeaderProps) => (\n <div className=\"flex w-full min-w-0 items-center gap-3\">\n <GitStatusMarker status={entry.status} />\n <FilePath\n path={entry.path}\n prefix={entry.renameSource ? `${entry.renameSource} → ` : undefined}\n className=\"min-w-0 flex-1 text-xs\"\n />\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 min-w-0 max-w-full flex-col gap-3\">\n {hunks.map((hunk, i) => (\n <div key={`${hunk.header}-${i}`} className=\"min-w-0 max-w-full\">\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 min-w-0 max-w-full overflow-x-auto font-mono text-2xs leading-normal\">\n {hunk.lines.map((line, j) => (\n <span key={`${line.type}-${j}`} className={`flex ${LINE_CLASS[line.type]}`}>\n <span\n className=\"inline-flex shrink-0 select-none gap-2 pr-2 opacity-40\"\n aria-hidden=\"true\"\n >\n <span className=\"w-8 text-right\">{line.oldLine ?? ''}</span>\n <span className=\"w-8 text-right\">{line.newLine ?? ''}</span>\n </span>\n <span>\n {LINE_PREFIX[line.type]}\n {line.text}\n </span>\n </span>\n ))}\n </pre>\n </div>\n ))}\n </div>\n );\n};\n\ninterface FileDiffSectionProps {\n entry: FileDiffEntry;\n}\n\nexport const FileDiffSection = ({ entry }: FileDiffSectionProps) => {\n const manuallyExpanded = useAppStore((s) => s.manuallyExpandedDiffPaths.has(entry.path));\n const manuallyCollapsed = useAppStore((s) => s.manuallyCollapsedDiffPaths.has(entry.path));\n const setDiffCollapsed = useAppStore((s) => s.setDiffCollapsed);\n const collapsed =\n manuallyCollapsed ||\n (!manuallyExpanded && entry.additions + entry.deletions > COLLAPSE_LINE_THRESHOLD);\n\n const headingText = entry.renameSource ? `${entry.renameSource} → ${entry.path}` : entry.path;\n\n return (\n <div data-diff-path={entry.path} className=\"min-w-0 max-w-full scroll-mt-4\">\n <h2 className=\"sr-only\">{headingText}</h2>\n <Accordion\n title={<FileHeader entry={entry} />}\n expanded={!collapsed}\n onToggle={() => setDiffCollapsed(entry.path, !collapsed)}\n >\n <DiffBody entry={entry} />\n </Accordion>\n </div>\n );\n};\n","import { CheckAllIcon } from '@/app/components/icons';\nimport { CountBadge, GitStatusMarker } from '@/app/features/git/components';\nimport { useGitFileList } from '@/app/features/git/hooks';\nimport { splitPathForDisplay } from '@/app/utils/path-display';\nimport { Checkbox, IconButton, ListItem, Tooltip } from '@dendelion/paper-ui';\n\nconst sectionLabelClass = 'font-handwritten text-xs font-semibold leading-none opacity-[0.45]';\n\nconst scrollToFile = (path: string, expandDiffPath: (path: string) => void) => {\n expandDiffPath(path);\n requestAnimationFrame(() => {\n document\n .querySelector(`[data-diff-path=\"${CSS.escape(path)}\"]`)\n ?.scrollIntoView({ behavior: 'smooth', block: 'start' });\n });\n};\n\n// Both status characters set (and neither '?', which pairs up for untracked) means\n// part of the file is staged and part isn't — git can't be checked or unchecked.\nconst isPartiallyStaged = (status: string) => {\n const [x, y] = status;\n return x !== ' ' && x !== '?' && y !== ' ' && y !== '?';\n};\n\nexport const GitFileList = () => {\n const {\n files,\n activePath,\n expandDiffPath,\n groups,\n pending,\n bulkPending,\n allStaged,\n toggleAll,\n toggleStaged,\n } = useGitFileList();\n\n if (!files || files.length === 0) return null;\n\n return (\n <nav aria-label=\"Changed files\" className=\"flex flex-col\">\n <div className={`${sectionLabelClass} flex h-[32px] items-end justify-between pb-1`}>\n <span>Changed files</span>\n <Tooltip content={allStaged ? 'Unstage every file' : 'Stage every file'}>\n <IconButton\n variant=\"ghost\"\n size=\"tiny\"\n className=\"-mb-1\"\n disabled={bulkPending}\n label={allStaged ? 'Unstage all files' : 'Stage all files'}\n onClick={toggleAll}\n icon={<CheckAllIcon />}\n />\n </Tooltip>\n </div>\n {/* Every row is exactly one 32px cell so the list tracks the ruled background. */}\n <ul className=\"m-0 flex list-none flex-col p-0\">\n {groups.map((group) => (\n <li key={group.dir}>\n <div\n className=\"flex h-[32px] items-end overflow-hidden text-ellipsis whitespace-nowrap pb-1 font-mono text-3xs leading-none opacity-50\"\n title={group.dir}\n >\n {group.dir}\n </div>\n <ul className=\"m-0 flex list-none flex-col p-0\">\n {group.entries.map((entry) => (\n <li\n key={entry.path}\n className=\"pc-git-file-row flex h-[32px] min-w-0 items-end gap-1.5 pb-1\"\n >\n <Checkbox\n checked={entry.staged}\n indeterminate={isPartiallyStaged(entry.status)}\n disabled={pending.has(entry.path)}\n onChange={(e) => toggleStaged(entry, e.target.checked)}\n aria-label={entry.staged ? `Unstage ${entry.path}` : `Stage ${entry.path}`}\n />\n <GitStatusMarker status={entry.status} compact />\n <ListItem\n size=\"small\"\n active={entry.path === activePath}\n onClick={() => scrollToFile(entry.path, expandDiffPath)}\n className=\"min-w-0 flex-1 items-end py-0 text-3xs\"\n action={\n !entry.binary && (\n <CountBadge additions={entry.additions} deletions={entry.deletions} />\n )\n }\n >\n <span\n className=\"block min-w-0 overflow-hidden text-ellipsis whitespace-nowrap font-mono text-3xs\"\n title={entry.path}\n >\n {splitPathForDisplay(entry.path).base}\n </span>\n </ListItem>\n </li>\n ))}\n </ul>\n </li>\n ))}\n </ul>\n </nav>\n );\n};\n","import { CommitMessageFields, GitStashSurface, GitSyncActions } from '@/app/components';\nimport { PageTitle } from '@/app/components/page-title';\nimport { GitCommitButton } from '@/app/features/git/actions';\nimport { useGitPage } from '@/app/features/git/hooks';\nimport { FileDiffSection } from '@/app/features/git/views';\nimport { Button, Divider, Spinner } from '@dendelion/paper-ui';\nimport { Fragment } from 'react';\n\nexport const GitPage = () => {\n const { files, loadFailed, loadDiffFiles, sectionsRef, commitForm } = useGitPage();\n\n const contentClass = 'min-h-page';\n\n const header = (\n <div className=\"mb-4 flex flex-wrap items-center justify-between gap-x-4 gap-y-2\">\n <PageTitle className=\"!mb-0\">Git</PageTitle>\n <div className=\"flex items-center gap-2\">\n <GitSyncActions />\n <GitStashSurface />\n </div>\n </div>\n );\n\n if (loadFailed) {\n return (\n <div>\n {header}\n <div className={`${contentClass} flex flex-col items-start gap-3`}>\n <p className=\"opacity-50 m-0\">Couldn't load the working-tree diff.</p>\n <Button variant=\"secondary\" size=\"small\" onClick={loadDiffFiles}>\n Retry\n </Button>\n </div>\n </div>\n );\n }\n\n if (!files) {\n return (\n <div>\n {header}\n <div className={contentClass}>\n <Spinner label=\"Loading the working-tree diff…\" />\n </div>\n </div>\n );\n }\n\n return (\n <div>\n {header}\n {files.length === 0 ? (\n <div className={contentClass}>\n <p className=\"opacity-50\">No changed files.</p>\n </div>\n ) : (\n <>\n <div className=\"sticky top-0 z-10 mb-4 flex items-center gap-2 py-2\">\n <div className=\"flex-1\">\n <CommitMessageFields state={commitForm} filesEmpty={false} />\n </div>\n <GitCommitButton state={commitForm} filesEmpty={false} />\n </div>\n <div ref={sectionsRef} className={`flex min-w-0 flex-col gap-6 ${contentClass}`}>\n {files.map((entry, idx) => (\n <Fragment key={entry.path}>\n {idx > 0 && <Divider />}\n <FileDiffSection entry={entry} />\n </Fragment>\n ))}\n </div>\n </>\n )}\n </div>\n );\n};\n"],"names":["GitCommitButton","state","filesEmpty","status","useAppStore","s","deskChecks","useDeskChecks","qualityStatus","testStatus","consistencyStatus","useMemo","deriveCheckStatuses","failingChecks","label","commitButton","jsx","Button","jsxs","Tooltip","Stamp","GIT_PAGE_FORM_KEY","matchAnySuggestionTask","useGitCommitForm","files","useCommitForm","splitPathForDisplay","path","slash","groupByFolder","groups","entry","dir","key","bucket","entries","useGitFileList","activePath","loadDiffFiles","expandDiffPath","pending","setPending","useState","bulkPending","setBulkPending","toast","useToast","allStaged","f","targets","failed","unstagePath","stagePath","r","next","prev","err","oneLineErrorSummary","updated","useGitPage","loadFailed","setActiveDiffPath","sectionsRef","useRef","commitFiles","commitForm","useEffect","timer","unsubscribe","subscribeToActivityStream","payload","onFocus","root","sections","visible","observer","topmost","el","CountBadge","additions","deletions","FilePath","prefix","className","base","dimmed","COMPACT_COLOR","STATUS_INFO","gitStatusInfo","x","y","code","GitStatusMarker","compact","info","HUNK_HEADER","parsePatch","patch","lines","hunks","current","oldLine","newLine","line","header","rawContentHunks","content","text","COLLAPSE_LINE_THRESHOLD","LINE_CLASS","LINE_PREFIX","FileHeader","DiffBody","hunk","j","FileDiffSection","manuallyExpanded","manuallyCollapsed","setDiffCollapsed","collapsed","headingText","Accordion","sectionLabelClass","scrollToFile","_a","isPartiallyStaged","GitFileList","toggleAll","toggleStaged","IconButton","CheckAllIcon","group","Checkbox","e","ListItem","GitPage","contentClass","PageTitle","GitSyncActions","GitStashSurface","Fragment","CommitMessageFields","idx","Divider","Spinner"],"mappings":"2NAaO,MAAMA,EAAkB,CAAC,CAAE,MAAAC,EAAO,WAAAC,KAAuC,CAC9E,MAAMC,EAASC,EAAaC,GAAMA,EAAE,MAAM,EACpC,CAAE,OAAQC,CAAA,EAAeC,EAAA,EACzB,CAAE,cAAAC,EAAe,WAAAC,EAAY,kBAAAC,CAAA,EAAsBC,EAAAA,QACvD,IAAMC,EAAoBT,EAAQG,CAAU,EAC5C,CAACH,EAAQG,CAAU,CAAA,EAEfO,EAAgB,CACpBL,IAAkB,QAAU,UAC5BC,IAAe,QAAU,QACzBC,IAAsB,QAAU,aAAA,EAChC,OAAQI,GAAiDA,IAAU,EAAK,EAEpEC,EACJC,EAAAA,IAACC,EAAA,CACC,KAAK,QACL,SAAUf,GAAc,CAACD,EAAM,YAAY,KAAA,GAAUA,EAAM,YAAcA,EAAM,eAC/E,QAASA,EAAM,aAEd,SAAAA,EAAM,YAAcA,EAAM,eACvB,cACAA,EAAM,YAAc,EAClB,UAAUA,EAAM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AAQ,MAAM,iCAAiC,CAAA,CAClD,CAAA,EACF,CA+BN"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{u as h,N as v,r as i,j as e,O as L,J as y,R as u,z as S,g as T,K as f,P as A}from"./main-
|
|
1
|
+
import{u as h,N as v,r as i,j as e,O as L,J as y,R as u,z as S,g as T,K as f,P as A}from"./main-Ceiva0Al.js";const m=s=>String(s).padStart(2,"0"),_=s=>{const a=new Date(s);return`${a.getFullYear()}-${m(a.getMonth()+1)}-${m(a.getDate())}`},b=s=>new Date(s).toLocaleDateString(void 0,{weekday:"long",year:"numeric",month:"long",day:"numeric"}),j=s=>{const a=new Date(s);return`${m(a.getHours())}:${m(a.getMinutes())}:${m(a.getSeconds())}`},R=()=>{const s=h(t=>t.taskLog),a=h(t=>t.taskLogLoading),n=h(t=>t.loadTaskLog),{taskId:o}=v({from:"/tasks"}),l=i.useRef(null);i.useEffect(()=>{n()},[n]),i.useEffect(()=>{var c;if(!o)return;const t=(c=l.current)==null?void 0:c.querySelector(".task-row-highlighted");t==null||t.scrollIntoView({behavior:"smooth",block:"center"})},[o]);const r=[...s].sort((t,c)=>c.endedAt.localeCompare(t.endedAt)),x=[];for(const t of r){const c=_(t.endedAt),d=x.at(-1);(d==null?void 0:d.key)===c?d.entries.push(t):x.push({key:c,entries:[t]})}return{taskLogLoading:a,groups:x,taskId:o,containerRef:l}},D="outline-[rgba(200,154,90,0.5)]",E={done:"rgba(143, 185, 150, 0.25)",superseded:"rgba(212, 163, 115, 0.25)",error:"rgba(201, 139, 139, 0.25)"},I=({id:s})=>{const[a,n]=i.useState(null),[o,l]=i.useState(!1),[r,x]=i.useState(0);i.useEffect(()=>{let c=!1,d;n(null),l(!1);const g=k=>{L(s).then(w=>{c||n(w.lines??[])}).catch(()=>{if(!c){if(k>0){d=setTimeout(()=>g(k-1),700);return}l(!0),n([])}})};return g(3),()=>{c=!0,d&&clearTimeout(d)}},[s,r]);const t=e.jsx(y,{variant:"ghost",size:"small",onClick:()=>x(c=>c+1),children:"Retry"});return a===null?e.jsx("p",{className:"opacity-50 m-0",children:"Loading…"}):o?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
|
`)})},C={phase:"Phase run",audit:"Audit","batch-reconcile":"Batch reconcile","batch-draft":"Batch draft","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","pr-review":"PR review","issue-fix":"Issue fix","desk-discovery":"Desk discovery"},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",$=({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"})}),K=({entry:s,highlighted:a})=>{const[n,o]=i.useState(a);i.useEffect(()=>{a&&o(!0)},[a]);const l=()=>o(r=>!r);return e.jsxs("div",{className:a?`task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] ${D}`:"flex flex-col gap-1 rounded-[10px]",children:[e.jsx("div",{role:"button",tabIndex:0,"aria-expanded":n,onClick:l,onKeyDown:r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),l())},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($,{className:"group-aria-expanded:rotate-90"})}),e.jsx("span",{className:"font-semibold whitespace-nowrap overflow-hidden",children:C[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:S[s.agentId]}),e.jsxs("span",{className:"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap",children:[j(s.startedAt),"–",j(s.endedAt)]}),e.jsx("div",{className:"flex items-center",children:e.jsx(T,{size:"small",fillColor:E[s.outcome],textColor:s.outcome==="done"?f.accentGreenDark:s.outcome==="superseded"?f.accentAmberDark:f.accentRoseDark,children:s.outcome})})]})})}),n&&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(I,{id:s.id})]})]})},p="text-sm font-semibold whitespace-nowrap overflow-hidden",P=({groups:s,highlightedId:a})=>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"})]})}),s.map(n=>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:b(n.entries[0].endedAt)})}),n.entries.map(o=>e.jsx(K,{entry:o,highlighted:o.id===a},o.id))]},n.key))]}),z=()=>{const{taskLogLoading:s,groups:a,taskId:n,containerRef:o}=R();return e.jsxs("div",{ref:o,children:[e.jsx(A,{children:"Tasks"}),s&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),!s&&a.length===0&&e.jsx("p",{className:"opacity-50",children:"No tasks have run yet."}),!s&&a.length>0&&e.jsx(P,{groups:a,highlightedId:n})]})};export{z as TasksPage};
|
|
3
|
-
//# sourceMappingURL=index-
|
|
3
|
+
//# sourceMappingURL=index-DAhfAB9y.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-cCrMJylm.js","sources":["../../../src/app/features/tasks/helpers/format-task-log.ts","../../../src/app/features/tasks/hooks/use-tasks-page.ts","../../../src/app/features/tasks/constants.ts","../../../src/app/features/tasks/views/task-log-lines.tsx","../../../src/app/features/tasks/views/task-row.tsx","../../../src/app/features/tasks/views/task-list.tsx","../../../src/app/features/tasks/tasks-page.tsx"],"sourcesContent":["import type { TaskLogEntry } from '@/types/index';\n\nexport interface TaskGroup {\n key: string;\n entries: TaskLogEntry[];\n}\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nexport const dayKey = (iso: string) => {\n const d = new Date(iso);\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n};\n\nexport const formatDayHeader = (iso: string) =>\n new Date(iso).toLocaleDateString(undefined, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n\nexport const formatTime = (iso: string) => {\n const d = new Date(iso);\n return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;\n};\n","import { useAppStore } from '@/app/stores/app-store';\nimport { useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef } from 'react';\nimport { type TaskGroup, dayKey } from '../helpers';\n\nexport const useTasksPage = () => {\n const taskLog = useAppStore((s) => s.taskLog);\n const taskLogLoading = useAppStore((s) => s.taskLogLoading);\n const loadTaskLog = useAppStore((s) => s.loadTaskLog);\n const { taskId } = useSearch({ from: '/tasks' });\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n loadTaskLog();\n }, [loadTaskLog]);\n\n useEffect(() => {\n if (!taskId) return;\n const row = containerRef.current?.querySelector('.task-row-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [taskId]);\n\n const sorted = [...taskLog].sort((a, b) => b.endedAt.localeCompare(a.endedAt));\n\n const groups: TaskGroup[] = [];\n for (const entry of sorted) {\n const key = dayKey(entry.endedAt);\n const group = groups.at(-1);\n if (group?.key === key) group.entries.push(entry);\n else groups.push({ key, entries: [entry] });\n }\n\n return { taskLogLoading, groups, taskId, containerRef };\n};\n","import type { TaskLogEntry } from '@/types/index';\n\nexport const HIGHLIGHT_OUTLINE_CLASS = 'outline-[rgba(200,154,90,0.5)]';\n\nexport const TASK_OUTCOME_STAMP_FILL: Record<TaskLogEntry['outcome'], string> = {\n done: 'rgba(143, 185, 150, 0.25)',\n superseded: 'rgba(212, 163, 115, 0.25)',\n error: 'rgba(201, 139, 139, 0.25)',\n};\n","import { fetchTaskLogLines } from '@/app/services/content/docs-api';\nimport { Button } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nexport interface TaskLogLinesProps {\n id: string;\n}\n\nexport const TaskLogLines = ({ id }: TaskLogLinesProps) => {\n const [lines, setLines] = useState<string[] | null>(null);\n const [failed, setFailed] = useState(false);\n const [attempt, setAttempt] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: attempt is the retry trigger (re-runs the fetch), not a value read in the body.\n useEffect(() => {\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n setLines(null);\n setFailed(false);\n // Auto-retry first (dev server briefly drops requests on hot reload); manual Retry only if it stays down.\n const load = (remaining: number) => {\n fetchTaskLogLines(id)\n .then((data) => {\n if (cancelled) return;\n setLines(data.lines ?? []);\n })\n .catch(() => {\n if (cancelled) return;\n if (remaining > 0) {\n timer = setTimeout(() => load(remaining - 1), 700);\n return;\n }\n setFailed(true);\n setLines([]);\n });\n };\n load(3);\n return () => {\n cancelled = true;\n if (timer) clearTimeout(timer);\n };\n }, [id, attempt]);\n\n const retry = (\n <Button variant=\"ghost\" size=\"small\" onClick={() => setAttempt((n) => n + 1)}>\n Retry\n </Button>\n );\n\n if (lines === null) return <p className=\"opacity-50 m-0\">Loading…</p>;\n if (failed)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">Couldn't load this task's output.</p>\n {retry}\n </div>\n );\n if (lines.length === 0)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">No output recorded.</p>\n {retry}\n </div>\n );\n return (\n <pre className=\"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap\">\n {lines.join('\\n')}\n </pre>\n );\n};\n","import { color } from '@/app/styles/tokens';\nimport { AGENT_LABELS, type TaskKind, type TaskLogEntry } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\nimport { HIGHLIGHT_OUTLINE_CLASS, TASK_OUTCOME_STAMP_FILL } from '../constants';\nimport { formatTime } from '../helpers';\nimport { TaskLogLines } from './task-log-lines';\n\nconst TASK_KIND_LABELS: Record<TaskKind, string> = {\n phase: 'Phase run',\n audit: 'Audit',\n 'batch-reconcile': 'Batch reconcile',\n 'batch-draft': 'Batch draft',\n 'run-all': 'Run all phases',\n draft: 'Draft',\n extend: 'Extend',\n suggest: 'Suggest ideas',\n 'commit-suggest': 'Commit suggest',\n 'overlap-check': 'Overlap check',\n prioritise: 'Prioritise queue',\n sync: 'Sync',\n reconcile: 'Reconcile',\n 'fix-review': 'Fix review',\n 'resolve-conflict': 'Resolve conflict',\n feedback: 'Feedback reply',\n 'pr-review': 'PR review',\n 'issue-fix': 'Issue fix',\n 'desk-discovery': 'Desk discovery',\n};\n\nexport const TASK_ROWS_GRID_CLASS =\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';\n\nconst ChevronRightIcon = ({ size = 14, className }: { size?: number; className?: string }) => (\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 className={className}\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\nexport interface TaskRowProps {\n entry: TaskLogEntry;\n highlighted: boolean;\n}\n\nexport const TaskRow = ({ entry, highlighted }: TaskRowProps) => {\n const [expanded, setExpanded] = useState(highlighted);\n useEffect(() => {\n if (highlighted) setExpanded(true);\n }, [highlighted]);\n const toggle = () => setExpanded((v) => !v);\n\n return (\n <div\n className={\n highlighted\n ? `task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] ${HIGHLIGHT_OUTLINE_CLASS}`\n : 'flex flex-col gap-1 rounded-[10px]'\n }\n >\n {/* biome-ignore lint/a11y/useSemanticElements: the clickable row wraps a Card whose block layout a native <button> would break; keyboard toggling is wired on the div. */}\n <div\n role=\"button\"\n tabIndex={0}\n aria-expanded={expanded}\n onClick={toggle}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n toggle();\n }\n }}\n className=\"group cursor-pointer rounded-[10px]\"\n >\n <Card size=\"small\" texture=\"canvas\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span className=\"inline-flex items-center opacity-50\">\n <ChevronRightIcon className=\"group-aria-expanded:rotate-90\" />\n </span>\n <span className=\"font-semibold whitespace-nowrap overflow-hidden\">\n {TASK_KIND_LABELS[entry.taskKind] ?? entry.taskKind}\n </span>\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap opacity-70\">\n {entry.planTitle}\n </span>\n <span className=\"text-sm opacity-50 whitespace-nowrap\">\n {AGENT_LABELS[entry.agentId]}\n </span>\n <span className=\"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap\">\n {formatTime(entry.startedAt)}–{formatTime(entry.endedAt)}\n </span>\n <div className=\"flex items-center\">\n <Stamp\n size=\"small\"\n fillColor={TASK_OUTCOME_STAMP_FILL[entry.outcome]}\n textColor={\n entry.outcome === 'done'\n ? color.accentGreenDark\n : entry.outcome === 'superseded'\n ? color.accentAmberDark\n : color.accentRoseDark\n }\n >\n {entry.outcome}\n </Stamp>\n </div>\n </div>\n </Card>\n </div>\n {expanded && (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n {entry.outcome === 'error' && entry.reason && (\n <p className=\"m-0 mb-2 text-sm text-state-danger\">{entry.reason}</p>\n )}\n <TaskLogLines id={entry.id} />\n </Card>\n )}\n </div>\n );\n};\n","import { Card } from '@dendelion/paper-ui';\nimport { type TaskGroup, formatDayHeader } from '../helpers';\nimport { TASK_ROWS_GRID_CLASS, TaskRow } from './task-row';\n\nconst headerLabelClassName = 'text-sm font-semibold whitespace-nowrap overflow-hidden';\n\nexport interface TaskListProps {\n groups: TaskGroup[];\n highlightedId: string | undefined;\n}\n\nexport const TaskList = ({ groups, highlightedId }: TaskListProps) => (\n <div className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span />\n <span className={`${headerLabelClassName} opacity-60`}>Task</span>\n <span className={`${headerLabelClassName} opacity-60`}>Plan</span>\n <span className={`${headerLabelClassName} opacity-60`}>Agent</span>\n <span className={`max-lg:hidden ${headerLabelClassName} opacity-60`}>Time</span>\n <span className={`${headerLabelClassName} opacity-60`}>Outcome</span>\n </div>\n </Card>\n {groups.map((group) => (\n <div key={group.key} className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <span className={`${headerLabelClassName} opacity-75`}>\n {formatDayHeader(group.entries[0].endedAt)}\n </span>\n </Card>\n {group.entries.map((entry) => (\n <TaskRow key={entry.id} entry={entry} highlighted={entry.id === highlightedId} />\n ))}\n </div>\n ))}\n </div>\n);\n","import { PageTitle } from '@/app/components/page-title';\nimport { useTasksPage } from './hooks';\nimport { TaskList } from './views';\n\nexport const TasksPage = () => {\n const { taskLogLoading, groups, taskId, containerRef } = useTasksPage();\n\n return (\n <div ref={containerRef}>\n <PageTitle>Tasks</PageTitle>\n {taskLogLoading && <p className=\"opacity-50\">Loading…</p>}\n {!taskLogLoading && groups.length === 0 && (\n <p className=\"opacity-50\">No tasks have run yet.</p>\n )}\n {!taskLogLoading && groups.length > 0 && <TaskList groups={groups} highlightedId={taskId} />}\n </div>\n );\n};\n"],"names":["pad","n","dayKey","iso","d","formatDayHeader","formatTime","useTasksPage","taskLog","useAppStore","s","taskLogLoading","loadTaskLog","taskId","useSearch","containerRef","useRef","useEffect","row","_a","sorted","a","b","groups","entry","key","group","HIGHLIGHT_OUTLINE_CLASS","TASK_OUTCOME_STAMP_FILL","TaskLogLines","id","lines","setLines","useState","failed","setFailed","attempt","setAttempt","cancelled","timer","load","remaining","fetchTaskLogLines","data","retry","jsx","Button","jsxs","TASK_KIND_LABELS","TASK_ROWS_GRID_CLASS","ChevronRightIcon","size","className","TaskRow","highlighted","expanded","setExpanded","toggle","v","e","Card","AGENT_LABELS","Stamp","color","headerLabelClassName","TaskList","highlightedId","TasksPage","PageTitle"],"mappings":"6GAOA,MAAMA,EAAOC,GAAc,OAAOA,CAAC,EAAE,SAAS,EAAG,GAAG,EAEvCC,EAAUC,GAAgB,CACrC,MAAMC,EAAI,IAAI,KAAKD,CAAG,EACtB,MAAO,GAAGC,EAAE,YAAA,CAAa,IAAIJ,EAAII,EAAE,SAAA,EAAa,CAAC,CAAC,IAAIJ,EAAII,EAAE,QAAA,CAAS,CAAC,EACxE,EAEaC,EAAmBF,GAC9B,IAAI,KAAKA,CAAG,EAAE,mBAAmB,OAAW,CAC1C,QAAS,OACT,KAAM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MAACoB,EAAA,CAAS,OAAA1C,EAAgB,cAAeV,CAAA,CAAQ,CAAA,EAC5F,CAEJ"}
|
|
1
|
+
{"version":3,"file":"index-DAhfAB9y.js","sources":["../../../src/app/features/tasks/helpers/format-task-log.ts","../../../src/app/features/tasks/hooks/use-tasks-page.ts","../../../src/app/features/tasks/constants.ts","../../../src/app/features/tasks/views/task-log-lines.tsx","../../../src/app/features/tasks/views/task-row.tsx","../../../src/app/features/tasks/views/task-list.tsx","../../../src/app/features/tasks/tasks-page.tsx"],"sourcesContent":["import type { TaskLogEntry } from '@/types/index';\n\nexport interface TaskGroup {\n key: string;\n entries: TaskLogEntry[];\n}\n\nconst pad = (n: number) => String(n).padStart(2, '0');\n\nexport const dayKey = (iso: string) => {\n const d = new Date(iso);\n return `${d.getFullYear()}-${pad(d.getMonth() + 1)}-${pad(d.getDate())}`;\n};\n\nexport const formatDayHeader = (iso: string) =>\n new Date(iso).toLocaleDateString(undefined, {\n weekday: 'long',\n year: 'numeric',\n month: 'long',\n day: 'numeric',\n });\n\nexport const formatTime = (iso: string) => {\n const d = new Date(iso);\n return `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;\n};\n","import { useAppStore } from '@/app/stores/app-store';\nimport { useSearch } from '@tanstack/react-router';\nimport { useEffect, useRef } from 'react';\nimport { type TaskGroup, dayKey } from '../helpers';\n\nexport const useTasksPage = () => {\n const taskLog = useAppStore((s) => s.taskLog);\n const taskLogLoading = useAppStore((s) => s.taskLogLoading);\n const loadTaskLog = useAppStore((s) => s.loadTaskLog);\n const { taskId } = useSearch({ from: '/tasks' });\n const containerRef = useRef<HTMLDivElement>(null);\n\n useEffect(() => {\n loadTaskLog();\n }, [loadTaskLog]);\n\n useEffect(() => {\n if (!taskId) return;\n const row = containerRef.current?.querySelector('.task-row-highlighted');\n row?.scrollIntoView({ behavior: 'smooth', block: 'center' });\n }, [taskId]);\n\n const sorted = [...taskLog].sort((a, b) => b.endedAt.localeCompare(a.endedAt));\n\n const groups: TaskGroup[] = [];\n for (const entry of sorted) {\n const key = dayKey(entry.endedAt);\n const group = groups.at(-1);\n if (group?.key === key) group.entries.push(entry);\n else groups.push({ key, entries: [entry] });\n }\n\n return { taskLogLoading, groups, taskId, containerRef };\n};\n","import type { TaskLogEntry } from '@/types/index';\n\nexport const HIGHLIGHT_OUTLINE_CLASS = 'outline-[rgba(200,154,90,0.5)]';\n\nexport const TASK_OUTCOME_STAMP_FILL: Record<TaskLogEntry['outcome'], string> = {\n done: 'rgba(143, 185, 150, 0.25)',\n superseded: 'rgba(212, 163, 115, 0.25)',\n error: 'rgba(201, 139, 139, 0.25)',\n};\n","import { fetchTaskLogLines } from '@/app/services/content/docs-api';\nimport { Button } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\n\nexport interface TaskLogLinesProps {\n id: string;\n}\n\nexport const TaskLogLines = ({ id }: TaskLogLinesProps) => {\n const [lines, setLines] = useState<string[] | null>(null);\n const [failed, setFailed] = useState(false);\n const [attempt, setAttempt] = useState(0);\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: attempt is the retry trigger (re-runs the fetch), not a value read in the body.\n useEffect(() => {\n let cancelled = false;\n let timer: ReturnType<typeof setTimeout> | undefined;\n setLines(null);\n setFailed(false);\n // Auto-retry first (dev server briefly drops requests on hot reload); manual Retry only if it stays down.\n const load = (remaining: number) => {\n fetchTaskLogLines(id)\n .then((data) => {\n if (cancelled) return;\n setLines(data.lines ?? []);\n })\n .catch(() => {\n if (cancelled) return;\n if (remaining > 0) {\n timer = setTimeout(() => load(remaining - 1), 700);\n return;\n }\n setFailed(true);\n setLines([]);\n });\n };\n load(3);\n return () => {\n cancelled = true;\n if (timer) clearTimeout(timer);\n };\n }, [id, attempt]);\n\n const retry = (\n <Button variant=\"ghost\" size=\"small\" onClick={() => setAttempt((n) => n + 1)}>\n Retry\n </Button>\n );\n\n if (lines === null) return <p className=\"opacity-50 m-0\">Loading…</p>;\n if (failed)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">Couldn't load this task's output.</p>\n {retry}\n </div>\n );\n if (lines.length === 0)\n return (\n <div className=\"flex items-center gap-2\">\n <p className=\"opacity-50 m-0\">No output recorded.</p>\n {retry}\n </div>\n );\n return (\n <pre className=\"font-mono text-xs m-0 max-h-[320px] overflow-y-auto whitespace-pre-wrap\">\n {lines.join('\\n')}\n </pre>\n );\n};\n","import { color } from '@/app/styles/tokens';\nimport { AGENT_LABELS, type TaskKind, type TaskLogEntry } from '@/types/index';\nimport { Card, Stamp } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\nimport { HIGHLIGHT_OUTLINE_CLASS, TASK_OUTCOME_STAMP_FILL } from '../constants';\nimport { formatTime } from '../helpers';\nimport { TaskLogLines } from './task-log-lines';\n\nconst TASK_KIND_LABELS: Record<TaskKind, string> = {\n phase: 'Phase run',\n audit: 'Audit',\n 'batch-reconcile': 'Batch reconcile',\n 'batch-draft': 'Batch draft',\n 'run-all': 'Run all phases',\n draft: 'Draft',\n extend: 'Extend',\n suggest: 'Suggest ideas',\n 'commit-suggest': 'Commit suggest',\n 'overlap-check': 'Overlap check',\n prioritise: 'Prioritise queue',\n sync: 'Sync',\n reconcile: 'Reconcile',\n 'fix-review': 'Fix review',\n 'resolve-conflict': 'Resolve conflict',\n feedback: 'Feedback reply',\n 'pr-review': 'PR review',\n 'issue-fix': 'Issue fix',\n 'desk-discovery': 'Desk discovery',\n};\n\nexport const TASK_ROWS_GRID_CLASS =\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';\n\nconst ChevronRightIcon = ({ size = 14, className }: { size?: number; className?: string }) => (\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 className={className}\n >\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n);\n\nexport interface TaskRowProps {\n entry: TaskLogEntry;\n highlighted: boolean;\n}\n\nexport const TaskRow = ({ entry, highlighted }: TaskRowProps) => {\n const [expanded, setExpanded] = useState(highlighted);\n useEffect(() => {\n if (highlighted) setExpanded(true);\n }, [highlighted]);\n const toggle = () => setExpanded((v) => !v);\n\n return (\n <div\n className={\n highlighted\n ? `task-row-highlighted flex flex-col gap-1 rounded-[10px] outline outline-2 outline-offset-[-2px] ${HIGHLIGHT_OUTLINE_CLASS}`\n : 'flex flex-col gap-1 rounded-[10px]'\n }\n >\n {/* biome-ignore lint/a11y/useSemanticElements: the clickable row wraps a Card whose block layout a native <button> would break; keyboard toggling is wired on the div. */}\n <div\n role=\"button\"\n tabIndex={0}\n aria-expanded={expanded}\n onClick={toggle}\n onKeyDown={(e) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault();\n toggle();\n }\n }}\n className=\"group cursor-pointer rounded-[10px]\"\n >\n <Card size=\"small\" texture=\"canvas\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span className=\"inline-flex items-center opacity-50\">\n <ChevronRightIcon className=\"group-aria-expanded:rotate-90\" />\n </span>\n <span className=\"font-semibold whitespace-nowrap overflow-hidden\">\n {TASK_KIND_LABELS[entry.taskKind] ?? entry.taskKind}\n </span>\n <span className=\"overflow-hidden text-ellipsis whitespace-nowrap opacity-70\">\n {entry.planTitle}\n </span>\n <span className=\"text-sm opacity-50 whitespace-nowrap\">\n {AGENT_LABELS[entry.agentId]}\n </span>\n <span className=\"max-lg:hidden font-mono text-xs opacity-[0.55] whitespace-nowrap\">\n {formatTime(entry.startedAt)}–{formatTime(entry.endedAt)}\n </span>\n <div className=\"flex items-center\">\n <Stamp\n size=\"small\"\n fillColor={TASK_OUTCOME_STAMP_FILL[entry.outcome]}\n textColor={\n entry.outcome === 'done'\n ? color.accentGreenDark\n : entry.outcome === 'superseded'\n ? color.accentAmberDark\n : color.accentRoseDark\n }\n >\n {entry.outcome}\n </Stamp>\n </div>\n </div>\n </Card>\n </div>\n {expanded && (\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n {entry.outcome === 'error' && entry.reason && (\n <p className=\"m-0 mb-2 text-sm text-state-danger\">{entry.reason}</p>\n )}\n <TaskLogLines id={entry.id} />\n </Card>\n )}\n </div>\n );\n};\n","import { Card } from '@dendelion/paper-ui';\nimport { type TaskGroup, formatDayHeader } from '../helpers';\nimport { TASK_ROWS_GRID_CLASS, TaskRow } from './task-row';\n\nconst headerLabelClassName = 'text-sm font-semibold whitespace-nowrap overflow-hidden';\n\nexport interface TaskListProps {\n groups: TaskGroup[];\n highlightedId: string | undefined;\n}\n\nexport const TaskList = ({ groups, highlightedId }: TaskListProps) => (\n <div className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <div className={TASK_ROWS_GRID_CLASS}>\n <span />\n <span className={`${headerLabelClassName} opacity-60`}>Task</span>\n <span className={`${headerLabelClassName} opacity-60`}>Plan</span>\n <span className={`${headerLabelClassName} opacity-60`}>Agent</span>\n <span className={`max-lg:hidden ${headerLabelClassName} opacity-60`}>Time</span>\n <span className={`${headerLabelClassName} opacity-60`}>Outcome</span>\n </div>\n </Card>\n {groups.map((group) => (\n <div key={group.key} className=\"flex flex-col gap-1\">\n <Card size=\"small\" texture=\"kraft\" className=\"plan-row-card\">\n <span className={`${headerLabelClassName} opacity-75`}>\n {formatDayHeader(group.entries[0].endedAt)}\n </span>\n </Card>\n {group.entries.map((entry) => (\n <TaskRow key={entry.id} entry={entry} highlighted={entry.id === highlightedId} />\n ))}\n </div>\n ))}\n </div>\n);\n","import { PageTitle } from '@/app/components/page-title';\nimport { useTasksPage } from './hooks';\nimport { TaskList } from './views';\n\nexport const TasksPage = () => {\n const { taskLogLoading, groups, taskId, containerRef } = useTasksPage();\n\n return (\n <div ref={containerRef}>\n <PageTitle>Tasks</PageTitle>\n {taskLogLoading && <p className=\"opacity-50\">Loading…</p>}\n {!taskLogLoading && groups.length === 0 && (\n <p className=\"opacity-50\">No tasks have run yet.</p>\n )}\n {!taskLogLoading && groups.length > 0 && <TaskList groups={groups} highlightedId={taskId} />}\n </div>\n );\n};\n"],"names":["pad","n","dayKey","iso","d","formatDayHeader","formatTime","useTasksPage","taskLog","useAppStore","s","taskLogLoading","loadTaskLog","taskId","useSearch","containerRef","useRef","useEffect","row","_a","sorted","a","b","groups","entry","key","group","HIGHLIGHT_OUTLINE_CLASS","TASK_OUTCOME_STAMP_FILL","TaskLogLines","id","lines","setLines","useState","failed","setFailed","attempt","setAttempt","cancelled","timer","load","remaining","fetchTaskLogLines","data","retry","jsx","Button","jsxs","TASK_KIND_LABELS","TASK_ROWS_GRID_CLASS","ChevronRightIcon","size","className","TaskRow","highlighted","expanded","setExpanded","toggle","v","e","Card","AGENT_LABELS","Stamp","color","headerLabelClassName","TaskList","highlightedId","TasksPage","PageTitle"],"mappings":"6GAOA,MAAMA,EAAOC,GAAc,OAAOA,CAAC,EAAE,SAAS,EAAG,GAAG,EAEvCC,EAAUC,GAAgB,CACrC,MAAMC,EAAI,IAAI,KAAKD,CAAG,EACtB,MAAO,GAAGC,EAAE,YAAA,CAAa,IAAIJ,EAAII,EAAE,SAAA,EAAa,CAAC,CAAC,IAAIJ,EAAII,EAAE,QAAA,CAAS,CAAC,EACxE,EAEaC,EAAmBF,GAC9B,IAAI,KAAKA,CAAG,EAAE,mBAAmB,OAAW,CAC1C,QAAS,OACT,KAAM,UACN,MAAO,OACP,IAAK,SACP,CAAC,EAEUG,EAAcH,GAAgB,CACzC,MAAMC,EAAI,IAAI,KAAKD,CAAG,EACtB,MAAO,GAAGH,EAAII,EAAE,SAAA,CAAU,CAAC,IAAIJ,EAAII,EAAE,WAAA,CAAY,CAAC,IAAIJ,EAAII,EAAE,WAAA,CAAY,CAAC,EAC3E,ECpBaG,EAAe,IAAM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ats"));if(!s.ok)throw new Error(`Failed to fetch stats: ${s.status}`);return s.json()},C=()=>{const[s,a]=r.useState(null),[t,o]=r.useState(!1);return r.useEffect(()=>{T().then(a).catch(()=>o(!0))},[]),{stats:s,loadFailed:t}},w=["open",...v],A={...f,open:"Open"},L={allowed:"success",warning:"warning",rejected:"error"},l=({title:s,children:a})=>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(N,{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}),a]})})}),n=({label:s,value:a})=>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:a})]}),M=[{key:"five_hour",label:"5-hour limit"},{key:"seven_day",label:"Weekly"}],E=({capacity:s})=>{const[a,t]=r.useState(()=>Date.now());return r.useEffect(()=>{const o=setInterval(()=>t(Date.now()),3e4);return()=>clearInterval(o)},[]),e.jsx(l,{title:"Claude capacity",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"No agent run has reported capacity yet."}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(p,{size:"small",variant:L[y(s.snapshot.status)],children:s.snapshot.status}),s.snapshot.overage&&e.jsx(p,{size:"small",variant:"warning",children:"overage"})]}),M.map(({key:o,label:h})=>{var u;const i=(u=s.snapshot.unifiedWindows)==null?void 0:u[o];if(!i)return null;const j=i.resetsAt===void 0?"":` · resets ${new Date(S(i.resetsAt)).toLocaleTimeString()}`;return e.jsx(n,{label:h,value:`${Math.round(i.utilization*100)}% used${j}`},o)}),e.jsxs("span",{className:"text-2xs opacity-50",children:["as of last agent run,"," ",m(Math.max(0,a-Date.parse(s.capturedAt)))," ago"]})]})})},k=({sourceLines:s,testLines:a})=>e.jsxs(l,{title:"Codebase size",children:[e.jsx(n,{label:"Source lines",value:s}),e.jsx(n,{label:"Test lines",value:a})]}),_=s=>`${Math.round(s*100)}%`,D=({comments:s})=>e.jsxs(l,{title:"Comment ratio",children:[e.jsx(x,{value:s.ratio*100,color:d.accentSlate}),e.jsx(n,{label:"Ratio",value:_(s.ratio)}),e.jsx(n,{label:"Comment lines",value:s.commentLines}),e.jsx(n,{label:"Source lines",value:s.sourceLines})]}),P=({entitiesByStatus:s})=>e.jsxs(l,{title:"Entities by status",children:[w.filter(a=>s[a]).map(a=>e.jsx(n,{label:A[a],value:s[a]},a)),Object.keys(s).length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No entities yet."})]}),I=({medianPhaseDurationMs:s})=>e.jsx(l,{title:"Median phase duration",children:s===null?e.jsx("p",{className:"opacity-50 m-0",children:"No phase runs recorded yet."}):e.jsx(n,{label:"Median",value:m(s)})}),R=({mostExpensiveIdeas:s})=>e.jsxs(l,{title:"Most expensive ideas",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No usage recorded yet."}),s.map(a=>e.jsxs("div",{className:"flex flex-col gap-0.5",children:[e.jsx(n,{label:a.planId,value:`${c(a.inputTokens)} in · ${c(a.outputTokens)} out`}),e.jsx("span",{className:"text-2xs opacity-50 truncate",children:a.planTitle})]},a.planId))]}),$=({openQuestions:s,decisions:a})=>e.jsxs(l,{title:"Notes",children:[e.jsx(n,{label:"Open questions",value:s}),e.jsx(n,{label:"Decisions",value:a})]}),F=({tasksPerWeek:s})=>{const a=Math.max(1,...s.map(t=>t.count));return e.jsxs(l,{title:"Tasks per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No tasks run yet."}),s.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(n,{label:t.week,value:t.count}),e.jsx(x,{value:t.count,max:a,color:d.accentAmber,height:4})]},t.week))]})},U=({testCoveragePct:s})=>e.jsx(l,{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(x,{value:s,color:d.accentGreen}),e.jsx(n,{label:"Line coverage",value:`${Math.round(s)}%`})]})}),W=({usagePerWeek:s})=>{const a=Math.max(1,...s.map(t=>t.agentMinutes));return e.jsxs(l,{title:"Usage per week",children:[s.length===0&&e.jsx("p",{className:"opacity-50 m-0",children:"No usage recorded yet."}),s.map(t=>e.jsxs("div",{className:"flex flex-col gap-1",children:[e.jsx(n,{label:t.week,value:`${t.agentMinutes}m`}),e.jsx(x,{value:t.agentMinutes,max:a,color:d.accentAmber,height:4}),e.jsxs("span",{className:"text-2xs opacity-50",children:[c(t.inputTokens)," in · ",c(t.outputTokens)," out"]})]},t.week))]})},z=({stats:s})=>e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-wrap items-start gap-2.5",children:[e.jsx(D,{comments:s.comments}),e.jsx(U,{testCoveragePct:s.testCoveragePct}),e.jsx(k,{sourceLines:s.comments.sourceLines,testLines:s.testLines}),e.jsx(P,{entitiesByStatus:s.entitiesByStatus}),e.jsx($,{openQuestions:s.openQuestions,decisions:s.decisions}),e.jsx(F,{tasksPerWeek:s.tasksPerWeek}),e.jsx(W,{usagePerWeek:s.usagePerWeek}),e.jsx(I,{medianPhaseDurationMs:s.medianPhaseDurationMs}),e.jsx(R,{mostExpensiveIdeas:s.mostExpensiveIdeas}),e.jsx(E,{capacity:s.capacity})]}),e.jsxs("p",{className:"opacity-[0.4] text-2xs mt-6",children:["Generated ",new Date(s.generatedAt).toLocaleString()]})]}),B=()=>{const{stats:s,loadFailed:a}=C();return e.jsxs("div",{children:[e.jsx(b,{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."}),a&&e.jsx("p",{className:"opacity-50",children:"Couldn't load stats."}),!a&&!s&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),s&&e.jsx(z,{stats:s})]})};export{B as StatsPage};
|
|
2
|
+
//# sourceMappingURL=index-DYGnWiFG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DYGnWiFG.js","sources":["../../../src/app/services/content/stats-api.ts","../../../src/app/features/stats/hooks/use-stats-page.ts","../../../src/app/features/stats/constants.ts","../../../src/app/features/stats/views/stat-card.tsx","../../../src/app/features/stats/views/claude-capacity-card.tsx","../../../src/app/features/stats/views/codebase-size-card.tsx","../../../src/app/features/stats/helpers/format-stats.ts","../../../src/app/features/stats/views/comment-ratio-card.tsx","../../../src/app/features/stats/views/entities-by-status-card.tsx","../../../src/app/features/stats/views/median-phase-duration-card.tsx","../../../src/app/features/stats/views/most-expensive-ideas-card.tsx","../../../src/app/features/stats/views/notes-card.tsx","../../../src/app/features/stats/views/tasks-per-week-card.tsx","../../../src/app/features/stats/views/test-coverage-card.tsx","../../../src/app/features/stats/views/usage-per-week-card.tsx","../../../src/app/features/stats/views/stats-grid.tsx","../../../src/app/features/stats/stats-page.tsx"],"sourcesContent":["import type { ProjectStats } from '@/types/index';\nimport { apiUrl } from '../api-base';\n\nexport const fetchStats = async () => {\n const res = await fetch(apiUrl('/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 { fetchStats } from '@/app/services/content';\nimport type { ProjectStats } from '@/types/index';\nimport { useEffect, useState } from 'react';\n\nexport const useStatsPage = () => {\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 { stats, loadFailed };\n};\n","import { STATUS_LABEL } from '@/app/features/plans/constants';\nimport { type EntityStatus, PLAN_STATUSES } from '@/types/index';\n\nexport const ENTITY_STATUS_ORDER: EntityStatus[] = ['open', ...PLAN_STATUSES];\n\nexport const ENTITY_STATUS_LABEL: Record<EntityStatus, string> = { ...STATUS_LABEL, open: 'Open' };\n\nexport const CAPACITY_STAMP = {\n allowed: 'success',\n warning: 'warning',\n rejected: 'error',\n} as const;\n","import { Card } from '@dendelion/paper-ui';\nimport type { ReactNode } from 'react';\n\nexport interface StatCardProps {\n title: string;\n children: ReactNode;\n}\n\nexport const StatCard = ({ title, children }: StatCardProps) => (\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\nexport interface StatRowProps {\n label: string;\n value: ReactNode;\n}\n\nexport const StatRow = ({ label, value }: StatRowProps) => (\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","import { formatDuration } from '@/core/phase-run';\nimport { capacityLevel, resetsAtMs } from '@/core/rate-limit';\nimport type { ProjectStats } from '@/types/index';\nimport type { RateLimitWindowKey } from '@/types/index';\nimport { Stamp } from '@dendelion/paper-ui';\nimport { useEffect, useState } from 'react';\nimport { CAPACITY_STAMP } from '../constants';\nimport { StatCard, StatRow } from './stat-card';\n\nconst WINDOW_ROWS: { key: RateLimitWindowKey; label: string }[] = [\n { key: 'five_hour', label: '5-hour limit' },\n { key: 'seven_day', label: 'Weekly' },\n];\n\nexport interface ClaudeCapacityCardProps {\n capacity: ProjectStats['capacity'];\n}\n\nexport const ClaudeCapacityCard = ({ capacity }: ClaudeCapacityCardProps) => {\n const [now, setNow] = useState(() => Date.now());\n useEffect(() => {\n const id = setInterval(() => setNow(Date.now()), 30_000);\n return () => clearInterval(id);\n }, []);\n return (\n <StatCard title=\"Claude capacity\">\n {capacity === null ? (\n <p className=\"opacity-50 m-0\">No agent run has reported capacity yet.</p>\n ) : (\n <>\n <div className=\"flex items-center gap-2\">\n <Stamp size=\"small\" variant={CAPACITY_STAMP[capacityLevel(capacity.snapshot.status)]}>\n {capacity.snapshot.status}\n </Stamp>\n {capacity.snapshot.overage && (\n <Stamp size=\"small\" variant=\"warning\">\n overage\n </Stamp>\n )}\n </div>\n {WINDOW_ROWS.map(({ key, label }) => {\n const window = capacity.snapshot.unifiedWindows?.[key];\n if (!window) return null;\n const resets =\n window.resetsAt === undefined\n ? ''\n : ` · resets ${new Date(resetsAtMs(window.resetsAt)).toLocaleTimeString()}`;\n return (\n <StatRow\n key={key}\n label={label}\n value={`${Math.round(window.utilization * 100)}% used${resets}`}\n />\n );\n })}\n <span className=\"text-2xs opacity-50\">\n as of last agent run,{' '}\n {formatDuration(Math.max(0, now - Date.parse(capacity.capturedAt)))} ago\n </span>\n </>\n )}\n </StatCard>\n );\n};\n","import { StatCard, StatRow } from './stat-card';\n\nexport interface CodebaseSizeCardProps {\n sourceLines: number;\n testLines: number;\n}\n\nexport const CodebaseSizeCard = ({ sourceLines, testLines }: CodebaseSizeCardProps) => (\n <StatCard title=\"Codebase size\">\n <StatRow label=\"Source lines\" value={sourceLines} />\n <StatRow label=\"Test lines\" value={testLines} />\n </StatCard>\n);\n","export const pct = (value: number) => `${Math.round(value * 100)}%`;\n","import { color } from '@/app/styles/tokens';\nimport type { ProjectStats } from '@/types/index';\nimport { Progress } from '@dendelion/paper-ui';\nimport { pct } from '../helpers';\nimport { StatCard, StatRow } from './stat-card';\n\nexport interface CommentRatioCardProps {\n comments: ProjectStats['comments'];\n}\n\nexport const CommentRatioCard = ({ comments }: CommentRatioCardProps) => (\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","import type { ProjectStats } from '@/types/index';\nimport { ENTITY_STATUS_LABEL, ENTITY_STATUS_ORDER } from '../constants';\nimport { StatCard, StatRow } from './stat-card';\n\nexport interface EntitiesByStatusCardProps {\n entitiesByStatus: ProjectStats['entitiesByStatus'];\n}\n\nexport const EntitiesByStatusCard = ({ entitiesByStatus }: EntitiesByStatusCardProps) => (\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","import { formatDuration } from '@/core/phase-run';\nimport { StatCard, StatRow } from './stat-card';\n\nexport interface MedianPhaseDurationCardProps {\n medianPhaseDurationMs: number | null;\n}\n\nexport const MedianPhaseDurationCard = ({\n medianPhaseDurationMs,\n}: MedianPhaseDurationCardProps) => (\n <StatCard title=\"Median phase duration\">\n {medianPhaseDurationMs === null ? (\n <p className=\"opacity-50 m-0\">No phase runs recorded yet.</p>\n ) : (\n <StatRow label=\"Median\" value={formatDuration(medianPhaseDurationMs)} />\n )}\n </StatCard>\n);\n","import { formatTokens } from '@/core/phase-run';\nimport type { ProjectStats } from '@/types/index';\nimport { StatCard, StatRow } from './stat-card';\n\nexport interface MostExpensiveIdeasCardProps {\n mostExpensiveIdeas: ProjectStats['mostExpensiveIdeas'];\n}\n\nexport const MostExpensiveIdeasCard = ({ mostExpensiveIdeas }: MostExpensiveIdeasCardProps) => (\n <StatCard title=\"Most expensive ideas\">\n {mostExpensiveIdeas.length === 0 && <p className=\"opacity-50 m-0\">No usage recorded yet.</p>}\n {mostExpensiveIdeas.map((idea) => (\n <div key={idea.planId} className=\"flex flex-col gap-0.5\">\n <StatRow\n label={idea.planId}\n value={`${formatTokens(idea.inputTokens)} in · ${formatTokens(idea.outputTokens)} out`}\n />\n <span className=\"text-2xs opacity-50 truncate\">{idea.planTitle}</span>\n </div>\n ))}\n </StatCard>\n);\n","import { StatCard, StatRow } from './stat-card';\n\nexport interface NotesCardProps {\n openQuestions: number;\n decisions: number;\n}\n\nexport const NotesCard = ({ openQuestions, decisions }: NotesCardProps) => (\n <StatCard title=\"Notes\">\n <StatRow label=\"Open questions\" value={openQuestions} />\n <StatRow label=\"Decisions\" value={decisions} />\n </StatCard>\n);\n","import { color } from '@/app/styles/tokens';\nimport type { ProjectStats } from '@/types/index';\nimport { Progress } from '@dendelion/paper-ui';\nimport { StatCard, StatRow } from './stat-card';\n\nexport interface TasksPerWeekCardProps {\n tasksPerWeek: ProjectStats['tasksPerWeek'];\n}\n\nexport const TasksPerWeekCard = ({ tasksPerWeek }: TasksPerWeekCardProps) => {\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","import { color } from '@/app/styles/tokens';\nimport { Progress } from '@dendelion/paper-ui';\nimport { StatCard, StatRow } from './stat-card';\n\nexport interface TestCoverageCardProps {\n testCoveragePct: number | null;\n}\n\nexport const TestCoverageCard = ({ testCoveragePct }: TestCoverageCardProps) => (\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","import { color } from '@/app/styles/tokens';\nimport { formatTokens } from '@/core/phase-run';\nimport type { ProjectStats } from '@/types/index';\nimport { Progress } from '@dendelion/paper-ui';\nimport { StatCard, StatRow } from './stat-card';\n\nexport interface UsagePerWeekCardProps {\n usagePerWeek: ProjectStats['usagePerWeek'];\n}\n\nexport const UsagePerWeekCard = ({ usagePerWeek }: UsagePerWeekCardProps) => {\n const max = Math.max(1, ...usagePerWeek.map((w) => w.agentMinutes));\n return (\n <StatCard title=\"Usage per week\">\n {usagePerWeek.length === 0 && <p className=\"opacity-50 m-0\">No usage recorded yet.</p>}\n {usagePerWeek.map((week) => (\n <div key={week.week} className=\"flex flex-col gap-1\">\n <StatRow label={week.week} value={`${week.agentMinutes}m`} />\n <Progress value={week.agentMinutes} max={max} color={color.accentAmber} height={4} />\n <span className=\"text-2xs opacity-50\">\n {formatTokens(week.inputTokens)} in · {formatTokens(week.outputTokens)} out\n </span>\n </div>\n ))}\n </StatCard>\n );\n};\n","import type { ProjectStats } from '@/types/index';\nimport { ClaudeCapacityCard } from './claude-capacity-card';\nimport { CodebaseSizeCard } from './codebase-size-card';\nimport { CommentRatioCard } from './comment-ratio-card';\nimport { EntitiesByStatusCard } from './entities-by-status-card';\nimport { MedianPhaseDurationCard } from './median-phase-duration-card';\nimport { MostExpensiveIdeasCard } from './most-expensive-ideas-card';\nimport { NotesCard } from './notes-card';\nimport { TasksPerWeekCard } from './tasks-per-week-card';\nimport { TestCoverageCard } from './test-coverage-card';\nimport { UsagePerWeekCard } from './usage-per-week-card';\n\nexport interface StatsGridProps {\n stats: ProjectStats;\n}\n\nexport const StatsGrid = ({ stats }: StatsGridProps) => (\n <>\n <div className=\"flex flex-wrap items-start gap-2.5\">\n <CommentRatioCard comments={stats.comments} />\n <TestCoverageCard testCoveragePct={stats.testCoveragePct} />\n <CodebaseSizeCard sourceLines={stats.comments.sourceLines} testLines={stats.testLines} />\n <EntitiesByStatusCard entitiesByStatus={stats.entitiesByStatus} />\n <NotesCard openQuestions={stats.openQuestions} decisions={stats.decisions} />\n <TasksPerWeekCard tasksPerWeek={stats.tasksPerWeek} />\n <UsagePerWeekCard usagePerWeek={stats.usagePerWeek} />\n <MedianPhaseDurationCard medianPhaseDurationMs={stats.medianPhaseDurationMs} />\n <MostExpensiveIdeasCard mostExpensiveIdeas={stats.mostExpensiveIdeas} />\n <ClaudeCapacityCard capacity={stats.capacity} />\n </div>\n <p className=\"opacity-[0.4] text-2xs mt-6\">\n Generated {new Date(stats.generatedAt).toLocaleString()}\n </p>\n </>\n);\n","import { PageTitle } from '@/app/components/page-title';\nimport { useStatsPage } from './hooks';\nimport { StatsGrid } from './views';\n\nexport const StatsPage = () => {\n const { stats, loadFailed } = useStatsPage();\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 && <StatsGrid stats={stats} />}\n </div>\n );\n};\n"],"names":["fetchStats","res","apiUrl","useStatsPage","stats","setStats","useState","loadFailed","setLoadFailed","useEffect","ENTITY_STATUS_ORDER","PLAN_STATUSES","ENTITY_STATUS_LABEL","STATUS_LABEL","CAPACITY_STAMP","StatCard","title","children","jsx","Card","jsxs","StatRow","label","value","WINDOW_ROWS","ClaudeCapacityCard","capacity","now","setNow","id","Fragment","Stamp","capacityLevel","key","window","_a","resets","resetsAtMs","formatDuration","CodebaseSizeCard","sourceLines","testLines","pct","CommentRatioCard","comments","Progress","color","EntitiesByStatusCard","entitiesByStatus","status","MedianPhaseDurationCard","medianPhaseDurationMs","MostExpensiveIdeasCard","mostExpensiveIdeas","idea","formatTokens","NotesCard","openQuestions","decisions","TasksPerWeekCard","tasksPerWeek","max","w","week","TestCoverageCard","testCoveragePct","UsagePerWeekCard","usagePerWeek","StatsGrid","StatsPage","PageTitle"],"mappings":"oIAGO,MAAMA,EAAa,SAAY,CACpC,MAAMC,EAAM,MAAM,MAAMC,EAAO,YAAY,CAAC,EAC5C,GAAI,CAACD,EAAI,GAAI,MAAM,IAAI,MAAM,0BAA0BA,EAAI,MAAM,EAAE,EACnE,OAAOA,EAAI,KAAA,CACb,ECHaE,EAAe,IAAM,CAChC,KAAM,CAACC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al as h,C as w,am as v,an as E,ao as I,ap as C,aq as D,G as R,J as $,ar as P,P as T}from"./main-
|
|
2
|
-
//# sourceMappingURL=index-
|
|
1
|
+
import{r as d,u as c,Q as k,j as e,al as h,C as w,am as v,an as E,ao as I,ap as C,aq as D,G as R,J as $,ar as P,P as T}from"./main-Ceiva0Al.js";function S(t){return Math.floor((Date.now()-Date.parse(t))/864e5)}function K(t){return t.kind==="question"?t.ageDays:S(t.date)}const j=t=>Number.isFinite(t)?t<=0?"today":t===1?"1 day ago":`${t} days ago`:"age unknown",L=()=>{const[t,i]=d.useState(null),n=c(s=>s.notifications),p=c(s=>s.notificationsError!==null),x=c(s=>s.plans),u=c(s=>s.loadPlans),o=c(s=>s.loadNotifications),a=c(s=>s.markRead),l=k();return d.useEffect(()=>{o()},[o]),d.useEffect(()=>{if(n)for(const s of n)s.kind!=="question"&&!s.read&&a(s.id)},[n,a]),{notifications:n,loadFailed:p,plans:x,expandedKey:t,setExpandedKey:i,openEntity:l,reload:async()=>{await Promise.all([u(),o()])}}},A={completed:"Completed",reply:"Reply"},F=({notification:t,ageDays:i,onOpen:n})=>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:n,"aria-label":`Open ${t.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(h,{id:t.entityId})}),e.jsx("span",{className:"text-xs uppercase tracking-wide opacity-40 whitespace-nowrap",children:A[t.kind]}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:t.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(i)})]}),O=({question:t,plan:i,expanded:n,onToggle:p,onOpen:x,reload:u})=>{const{toast:o}=w(),[a,l]=d.useState(""),{sending:r,send:s,undo:b,undoing:y,undoEdit:g}=v(i,{reload:u,notify:o}),m=`question-reply:${t.entityId}`;d.useEffect(()=>{const f=E(m);f&&l(f)},[m]),d.useEffect(()=>{a&&I(m,a)},[m,a]);const N=async()=>{a.trim()&&await s(a.trim())&&(l(""),P(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:x,"aria-label":`Open ${t.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(h,{id:t.entityId})}),e.jsx("button",{type:"button",onClick:p,"aria-expanded":n,className:"flex-1 min-w-0 truncate text-left bg-transparent border-none p-0 cursor-pointer",children:t.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(t.ageDays)})]}),n&&e.jsxs("div",{className:"flex flex-col gap-3 pb-4",children:[e.jsx(C,{messages:i.thread??[],undo:b,undoing:y,onUndo:g}),e.jsx(D,{value:a,onChange:f=>l(f.target.value),"aria-label":`Reply to ${t.entityTitle}`,placeholder:"Reply to resolve and resume…",rows:2,disabled:r}),e.jsxs("div",{className:"flex justify-end items-center gap-3",children:[e.jsx("span",{className:r?"visible":"invisible",children:e.jsx(R,{size:"small",label:"Agent replying…"})}),e.jsx($,{size:"small",onClick:N,disabled:r||!a.trim(),children:"Reply"})]})]})]})},z=()=>{const{notifications:t,loadFailed:i,plans:n,expandedKey:p,setExpandedKey:x,openEntity:u,reload:o}=L();return e.jsxs("div",{children:[e.jsx(T,{children:"Inbox"}),e.jsx("p",{className:"opacity-50 mb-6",children:"Every parked question, completed run, and agent reply, oldest first."}),i&&e.jsx("p",{className:"opacity-50",children:"Couldn't load notifications."}),!i&&!t&&e.jsx("p",{className:"opacity-50",children:"Loading…"}),t&&t.length===0&&e.jsx("p",{className:"opacity-50",children:"Nothing here — no parked questions or recent activity."}),t&&t.length>0&&e.jsx("div",{className:"flex flex-col",children:t.map((a,l)=>{const r=`${a.entityId}-${a.kind}-${l}`,s=()=>u(a.entityId,a.entityTitle);if(a.kind!=="question")return e.jsx(F,{notification:a,ageDays:K(a),onOpen:s},r);const b=n==null?void 0:n.entries.find(y=>y.id===a.entityId);return b?e.jsx(O,{question:a,plan:b,expanded:p===r,onToggle:()=>x(y=>y===r?null:r),onOpen:s,reload:o},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:s,"aria-label":`Open ${a.entityTitle}`,className:"bg-transparent border-none p-0 cursor-pointer",children:e.jsx(h,{id:a.entityId})}),e.jsx("span",{className:"flex-1 min-w-0 truncate",children:a.text}),e.jsx("span",{className:"opacity-50 text-xs whitespace-nowrap",children:j(a.ageDays)})]},r)})})]})};export{z as InboxPage};
|
|
2
|
+
//# sourceMappingURL=index-DuhmLhzz.js.map
|