@open-mercato/cezar 0.16.1 → 0.16.2-pr1594.3452
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/core/opencode-server-runner.d.ts +2 -0
- package/dist/core/opencode-server-runner.js +28 -2
- package/dist/core/opencode-server-runner.js.map +1 -1
- package/dist/core/provider-auth.js +5 -0
- package/dist/core/provider-auth.js.map +1 -1
- package/dist/workflows/run.d.ts +3 -2
- package/dist/workflows/run.js +15 -5
- package/dist/workflows/run.js.map +1 -1
- package/package.json +3 -3
- package/web/dist/assets/{agent-task-pickers-B5I-IyLy.js → agent-task-pickers-DEW3Vgdv.js} +1 -1
- package/web/dist/assets/{automations-route-BXxP0xWu.js → automations-route-Cx7mzYhD.js} +1 -1
- package/web/dist/assets/{compare-variants-BWaSra3R.js → compare-variants-B6ja1M4D.js} +1 -1
- package/web/dist/assets/{dashboard-i4GP_SB1.js → dashboard-ClEGBFFq.js} +1 -1
- package/web/dist/assets/{github-uQ7k7SEK.js → github-CELdSmld.js} +1 -1
- package/web/dist/assets/{index-Cse8uyXO.js → index-BBND6Sg3.js} +3 -3
- package/web/dist/assets/{repo-git-CxAx2JBB.js → repo-git-Bj0PBOjX.js} +1 -1
- package/web/dist/assets/{skills-B1z9gRg4.js → skills-BgCN1gTp.js} +1 -1
- package/web/dist/assets/{task-graph-fkOtF8MX.js → task-graph-DI2fn5M8.js} +1 -1
- package/web/dist/assets/{task-workspace-DA3mFwL9.js → task-workspace-B8Fpho3e.js} +2 -2
- package/web/dist/assets/{tracker-wxG0l2wk.js → tracker-Cqdpt9RN.js} +1 -1
- package/web/dist/assets/{workflow-graph-Bo72pTbt.js → workflow-graph-l7O50dsV.js} +1 -1
- package/web/dist/index.html +1 -1
- package/dist/telemetry-service.json +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,Sa as i,Yn as a,_i as o,at as s,ct as c,fr as l,it as u,j as d,lt as f,ot as p,r as m,ut as h,ya as g}from"./queries-CI0EmEcH.js";import{F as _,i as v,r as y,t as b}from"./button-Clwd6u4_.js";import{c as x,f as S,t as C,w}from"./project-router-DZsR9P9C.js";import{t as T}from"./use-desktop-BNN3U2y9.js";import{a as ee,c as te,i as ne,l as E,o as re,r as ie,t as ae,u as oe}from"./file-preview-iucr8WDo.js";import{t as D}from"./arrow-left-BELOeFyX.js";import{n as O,t as k}from"./file-1a6_DhLG.js";import{t as se}from"./check-Dt8U0Zvm.js";import{t as ce}from"./chevron-right-VbYrJ_st.js";import{c as A,d as j,f as le,o as ue,p as M,s as N,t as de,u as P}from"./git-toolbar-DU5Ca6RI.js";import{n as F}from"./upload-J0hBTVF7.js";import{n as fe,t as I}from"./triangle-alert-BqI_9MkV.js";import{t as pe}from"./plus-CBVm02wz.js";import{t as L}from"./search-x-CuinYQnl.js";import{t as R}from"./input-DIWTlsx6.js";import{t as z}from"./diff-stat-CiWUpWY0.js";import{t as B}from"./centered-state-nM7v9xtl.js";import{a as me}from"./index-Cse8uyXO.js";import{t as he}from"./markdown-BzqT8I8y.js";import{t as V}from"./diff-CJKocK17.js";import{t as H}from"./commit-list-xMdmPYbz.js";var ge=_(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),U=e(t(),1),W=n();function _e(){let e=c(),t=f();if(!e.data)return null;let n=e.data,r=e=>t.mutate(e,{onSuccess:e=>S(e.message),onError:e=>S(e.message,{tone:`danger`})}),i=t.isPending,a=t.variables;return(0,W.jsxs)(`div`,{"data-slot":`repo-sync`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,children:[n.upstream?(0,W.jsxs)(`span`,{"data-slot":`repo-upstream`,className:`truncate font-mono text-soft-foreground`,title:`Upstream`,children:[`→ `,n.upstream]}):n.branch?(0,W.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`not published`}):(0,W.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`detached HEAD`}),n.upstream?(0,W.jsx)(K,{ahead:n.ahead,behind:n.behind}):n.outgoing.length>0?(0,W.jsx)(K,{ahead:n.outgoing.length,behind:null}):null,(0,W.jsx)(`span`,{"data-slot":`repo-fetched`,className:`hidden text-soft-foreground sm:inline`,children:n.lastFetchedAt?`fetched ${ye(n.lastFetchedAt)}`:`never fetched`}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,W.jsx)(G,{which:`fetch`,label:`Fetch`,busy:i,pending:a,onClick:r,disabled:!n.pushRemote,children:(0,W.jsx)(P,{"aria-hidden":`true`,className:y(i&&a===`fetch`&&`animate-spin`)})}),n.upstream?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(G,{which:`pull`,label:`Pull`,busy:i,pending:a,onClick:r,disabled:!n.behind,children:(0,W.jsx)(oe,{"aria-hidden":`true`})}),(0,W.jsx)(G,{which:`push`,label:`Push`,busy:i,pending:a,onClick:r,disabled:!n.ahead,children:(0,W.jsx)(O,{"aria-hidden":`true`})}),(0,W.jsx)(G,{which:`sync`,label:`Sync`,busy:i,pending:a,onClick:r,disabled:!n.ahead&&!n.behind,variant:`outline`,children:(0,W.jsx)(P,{"aria-hidden":`true`,className:y(i&&a===`sync`&&`animate-spin`)})})]}):n.branch&&n.pushRemote?(0,W.jsx)(G,{which:`push`,label:`Publish branch`,busy:i,pending:a,onClick:r,variant:`outline`,children:(0,W.jsx)(ge,{"aria-hidden":`true`})}):null]})]})}function G({which:e,label:t,busy:n,pending:r,onClick:i,disabled:a,variant:o=`ghost`,children:s}){return(0,W.jsxs)(b,{variant:o,size:`sm`,"data-action":`repo-${e}`,"aria-busy":n&&r===e,disabled:n||a,onClick:()=>i(e),children:[s,t]})}function K({ahead:e,behind:t}){return e===null&&t===null?null:!e&&!t?(0,W.jsx)(`span`,{"data-slot":`sync-counts`,className:`text-soft-foreground`,children:`in sync`}):(0,W.jsxs)(`span`,{"data-slot":`sync-counts`,className:`flex items-center gap-1 font-mono`,children:[e?(0,W.jsxs)(`span`,{"data-sync":`ahead`,title:`${e} to push`,className:`text-primary`,children:[`↑`,e]}):null,t?(0,W.jsxs)(`span`,{"data-sync":`behind`,title:`${t} to pull`,className:`text-warning`,children:[`↓`,t]}):null]})}function ve({name:e,sync:t}){if(!t)return null;let n=t.branches.find(t=>t.name===e),r=n?n.gone?`upstream gone`:n.upstream?null:`local only`:`remote only`;return(0,W.jsx)(`span`,{"data-slot":`branch-tracking`,className:`flex shrink-0 items-center gap-1 text-[11px]`,children:r?(0,W.jsx)(`span`,{className:`text-soft-foreground`,children:r}):(0,W.jsx)(K,{ahead:n.ahead,behind:n.behind})})}function ye(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} min ago`;let r=Math.round(n/60);return r<24?`${r} h ago`:`${Math.round(r/24)} d ago`}function be({repo:e,info:t}){let n=d(),r=c(),a=i(),s=e=>S(e.message,{tone:`danger`}),u=g({mutationFn:e=>l({name:e}),onSuccess:async e=>{S(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:m.repo}),a.invalidateQueries({queryKey:m.health})]),a.setQueryData(m.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(m.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=g({mutationFn:e=>o({baseBranch:e}),onSuccess:e=>{S(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),a.invalidateQueries({queryKey:m.repo})},onError:s}),[p,h]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),x=_.trim().toLowerCase(),C=x?e.branches.filter(e=>e.toLowerCase().includes(x)):e.branches;return(0,W.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,W.jsx)(R,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:_,onChange:e=>v(e.target.value),className:`mt-2 max-w-xl`}),(0,W.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[C.map(n=>{let i=n===t.branch,a=e.checkedOutElsewhere?.[n];return(0,W.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":n,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,W.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-xs`,i&&`font-semibold`),children:n}),(0,W.jsx)(ve,{name:n,sync:r.data}),i?(0,W.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:[(0,W.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`current`]}):a?(0,W.jsx)(`span`,{"data-slot":`branch-elsewhere`,title:`Checked out in ${a}`,className:`ml-auto shrink-0 text-[11px] text-soft-foreground`,children:`in another worktree`}):(0,W.jsx)(b,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:u.isPending,onClick:()=>u.mutate(n),children:`Switch`})]},n)}),C.length===0?(0,W.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,_.trim(),`”.`]}):null]}),(0,W.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=p.trim();t&&u.mutate(t,{onSuccess:()=>h(``)})},children:[(0,W.jsx)(R,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:p,onChange:e=>h(e.target.value)}),(0,W.jsxs)(b,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!p.trim()||u.isPending,children:[(0,W.jsx)(pe,{"aria-hidden":`true`}),`Create`]})]})]}),(0,W.jsxs)(`div`,{className:`max-w-md`,children:[(0,W.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,W.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:f.isPending,onChange:e=>f.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,W.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}),(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,W.jsx)(xe,{}):null]})}function xe(){let e=r({limit:20});return(0,W.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,W.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,W.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,W.jsx)(Se,{pr:e},e.number))}):(0,W.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function Se({pr:e}){let t=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,W.jsx)(Ce,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,W.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:v(e.url)?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:y(n,`hover:bg-muted`),children:t}):(0,W.jsx)(`span`,{className:n,children:t})})}function Ce({checks:e}){return(0,W.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:y(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function we(){let e=s(),t=T(),[n,r]=(0,U.useState)(`unified`),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(null),f=(0,U.useRef)(null),p=e.isError&&e.error instanceof a&&e.error.status===409,m=e.data?.files??[],h=(0,U.useMemo)(()=>ne(m),[m]),g=(0,U.useMemo)(()=>m.some(he),[m]),_=t?n:`unified`,v=!t||i;return(0,W.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,W.jsx)(de,{stat:e.data.stat}):null,(0,W.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,W.jsx)(N,{mode:n,wrap:i,preview:c,onModeChange:r,onWrapChange:o,onPreviewChange:g?l:void 0})})]}),e.isPending?(0,W.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,W.jsx)(B,{icon:p?(0,W.jsx)(M,{}):(0,W.jsx)(I,{}),tone:p?`neutral`:`danger`,heading:`h2`,title:p?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):m.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(M,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:[--diff-sticky-top:7rem] md:px-6 md:py-0`,children:[(0,W.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`hidden w-60 shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,children:(0,W.jsx)(re,{root:h,selected:u,onSelect:e=>{d(e),f.current?.scrollToPath(e)}})}),(0,W.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":t?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,W.jsx)(V,{files:m,viewRef:f,mode:_,wrap:v,preview:t&&g&&c,className:`min-w-0 md:py-4`})})]})]})}function Te({log:e}){let{sha:t}=w(),n=c().data;if(t)return(0,W.jsx)(Ee,{sha:t});let r=new Set(n?.outgoing??[]),i=n?.incoming??[],a=(e,t)=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`,...t?{sync:t}:{}}),o=i.length>0?(0,W.jsxs)(`section`,{"data-slot":`repo-incoming`,className:`border-b border-border`,children:[(0,W.jsxs)(`h2`,{className:`px-4 pt-3 text-[11px] font-medium text-muted-foreground md:px-6`,children:[`Incoming from `,n?.upstream,` · `,i.length]}),(0,W.jsx)(H,{slot:`repo-incoming-commits`,commits:i.map(e=>a(e,`incoming`))})]}):null;return e.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,W.jsxs)(W.Fragment,{children:[o,(0,W.jsx)(H,{slot:`repo-commits`,commits:e.map(e=>a(e,r.has(e.hash)?`outgoing`:void 0))})]})}function Ee({sha:e}){let t=p(e),n=T(),[r,i]=(0,U.useState)(`unified`),[o,s]=(0,U.useState)(!1),c=t.isError&&t.error instanceof a&&t.error.status===409,l=n?r:`unified`,u=!n||o;return(0,W.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,W.jsx)(b,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,W.jsxs)(C,{to:`/git/commits`,children:[(0,W.jsx)(D,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,W.jsx)(z,{stat:t.data.stat}):null,(0,W.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,W.jsx)(N,{mode:r,wrap:o,onModeChange:i,onWrapChange:s})})]}),t.isPending?(0,W.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,W.jsx)(B,{icon:c?(0,W.jsx)(L,{}):(0,W.jsx)(I,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,W.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,W.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,W.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,W.jsx)(V,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function q(e,t){let n=0;for(let r of t){if(n=e.indexOf(r,n),n===-1)return!1;n+=r.length}return!0}function De(e,t,n){let r=t.trim().toLowerCase();if(r===``)return{results:[...e],total:e.length};let i=[];for(let t of e){let e=t.toLowerCase();if(!q(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:q(n,r)})}return i.sort((e,t)=>e.basenameMatch===t.basenameMatch?e.path.length===t.path.length?e.path.localeCompare(t.path):e.path.length-t.path.length:e.basenameMatch?-1:1),{results:i.slice(0,n).map(e=>e.path),total:i.length}}var Oe=200;function ke({selected:e,onSelect:t}){let n=h(),r=n.isError&&n.error instanceof a&&n.error.status===409,i=n.data?.paths??[];return n.isPending?(0,W.jsx)(J,{children:(0,W.jsx)(`p`,{"data-slot":`repo-files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`})}):n.isError?(0,W.jsx)(J,{children:(0,W.jsx)(B,{icon:r?(0,W.jsx)(E,{}):(0,W.jsx)(I,{}),tone:r?`neutral`:`danger`,heading:`h2`,title:r?`No files to browse`:`Could not load the files`,subtitle:n.error.message})}):i.length===0?(0,W.jsx)(J,{children:(0,W.jsx)(B,{icon:(0,W.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`No files yet`,subtitle:`Nothing is tracked in this repository. Files show up here once git knows about them.`})}):(0,W.jsxs)(J,{children:[n.data.truncated?(0,W.jsxs)(`p`,{"data-slot":`repo-files-truncated`,role:`status`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground md:px-6`,children:[`Showing the first `,i.length.toLocaleString(),` files; this repository has more. The tree and the filter cover only what is loaded.`]}):null,(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,W.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:y(`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:block md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,e!==null&&`hidden`),children:(0,W.jsx)(Z,{paths:i,selected:e,onSelect:t})}),(0,W.jsxs)(`div`,{className:y(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`repo-files-back`,onClick:()=>t(null),className:`mb-2 flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground md:hidden`,children:[(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,W.jsx)(ae,{source:{kind:`repo`},path:e})]})]})]})}function J({children:e}){return(0,W.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function Y(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function X(e,t,n){let r=[];for(let i of e.dirs){let e=t.has(i.path);r.push({kind:`dir`,path:i.path,name:i.name,level:n,open:e}),e&&r.push(...X(i,t,n+1))}for(let t of e.files)r.push({kind:`file`,path:t.path,name:t.name,level:n,label:t.name});return r}function Z({paths:e,selected:t,onSelect:n}){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(()=>new Set(Y(t))),[s,c]=(0,U.useState)(t),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=Y(t);e.length!==0&&o(t=>{if(e.every(e=>t.has(e)))return t;let n=new Set(t);for(let t of e)n.add(t);return n})},[t]);let u=r.trim()!==``,d=(0,U.useMemo)(()=>De(e,r,Oe),[e,r]),f=(0,U.useMemo)(()=>ee(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,U.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):X(f,a,0),[u,d.results,f,a]),m=p.find(e=>e.path===s)??p[0],h=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,W.jsxs)(`div`,{"data-slot":`repo-files-browser`,className:`flex min-w-0 flex-col gap-2`,onKeyDown:e=>{e.key!==`/`||e.target===l.current||(e.preventDefault(),l.current?.focus())},children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,W.jsx)(`input`,{id:`repo-files-filter`,ref:l,"data-slot":`repo-files-filter`,type:`search`,value:r,placeholder:`Filter files… (/)`,"aria-controls":`repo-files-tree`,autoComplete:`off`,spellCheck:!1,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(``))},className:`w-full rounded-sm border border-border bg-background px-2 py-1 text-xs placeholder:text-soft-foreground focus:border-foreground focus:outline-none`}),(0,W.jsx)(`p`,{"data-slot":`repo-files-count`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:u?`${d.total} files match ${r.trim()}`:`${e.length} files`})]}),u&&d.total===0?(0,W.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[`No file matches `,(0,W.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,W.jsx)(`div`,{id:`repo-files-tree`,"data-slot":`repo-files-tree`,"data-filtering":u?`true`:void 0,role:`tree`,"aria-label":`Repository files`,"aria-activedescendant":m?Q(m.path):void 0,onKeyDown:e=>{let t=p.findIndex(e=>e.path===m?.path),r=e=>{let t=p[Math.max(0,Math.min(p.length-1,e))];t&&c(t.path)},i=p[t];if(e.key===`ArrowDown`)e.preventDefault(),r(t+1);else if(e.key===`ArrowUp`)e.preventDefault(),r(t-1);else if(e.key===`ArrowRight`&&i?.kind===`dir`)e.preventDefault(),i.open?r(t+1):h(i.path);else if(e.key===`ArrowLeft`&&i!==void 0)if(e.preventDefault(),i.kind===`dir`&&i.open)h(i.path);else for(let e=t-1;e>=0;--e){let t=p[e];if(t.level<i.level){c(t.path);break}}else(e.key===`Enter`||e.key===` `)&&i!==void 0&&(e.preventDefault(),i.kind===`file`?n(i.path):h(i.path))},className:`min-w-0 text-[13px]`,children:p.map(e=>e.kind===`dir`?(0,W.jsx)(Ae,{row:e,focused:e.path===m?.path,onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,W.jsx)(je,{row:e,active:e.path===t,focused:e.path===m?.path,onSelect:()=>{c(e.path),n(e.path)}},e.path))}),u&&d.total>d.results.length?(0,W.jsxs)(`p`,{"data-slot":`repo-files-more`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[(d.total-d.results.length).toLocaleString(),` more — refine the filter.`]}):null]})}var Q=e=>`repo-file-row-${e}`,$=(e,t)=>({paddingLeft:`${t+e*14}px`});function Ae({row:e,focused:t,onToggle:n}){return(0,W.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-expanded":e.open,"aria-level":e.level+1,"data-slot":`repo-files-dir`,"data-path":e.path,"data-state":e.open?`open`:`closed`,tabIndex:t?0:-1,onClick:n,className:`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground focus:bg-muted focus:outline-none`,style:$(e.level,6),children:[(0,W.jsx)(ce,{"aria-hidden":`true`,className:y(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,W.jsx)(le,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function je({row:e,active:t,focused:n,onSelect:r}){let i=ie(e.path)?te:k;return(0,W.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-level":e.level+1,"aria-selected":t,"aria-current":t?`true`:void 0,"data-slot":`repo-files-file`,"data-path":e.path,tabIndex:n?0:-1,onClick:r,className:y(`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted focus:outline-none`,t?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:$(e.level,24),children:[(0,W.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function Me({tab:e}){let t=u();if(t.isPending)return(0,W.jsx)(me,{});if(t.isError)return(0,W.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(B,{icon:(0,W.jsx)(I,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,W.jsx)(Ne,{repo:t.data,info:n,tab:e}):(0,W.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(B,{icon:(0,W.jsx)(j,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`The cockpit is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Ne({repo:e,info:t,tab:n}){return(0,W.jsxs)(`div`,{"data-route":`repo-git`,className:y(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,W.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,W.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,W.jsx)(ue,{branch:t.branch}),t.remote?(0,W.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,W.jsx)(`div`,{className:`mt-1.5`,children:(0,W.jsx)(_e,{})}),(0,W.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,W.jsx)(A,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,W.jsx)(A,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,W.jsx)(A,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,W.jsx)(A,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,W.jsx)(we,{}):n===`commits`?(0,W.jsx)(Te,{log:e.log}):n===`files`?(0,W.jsx)(Pe,{}):(0,W.jsx)(be,{repo:e,info:t})]})}function Pe(){let e=w(),t=x();return(0,W.jsx)(ke,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${Fe(e)}`,{replace:!0})})}function Fe(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{Me as RepoGitRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{C as r,Sa as i,Yn as a,_i as o,at as s,ct as c,fr as l,it as u,j as d,lt as f,ot as p,r as m,ut as h,ya as g}from"./queries-CI0EmEcH.js";import{F as _,i as v,r as y,t as b}from"./button-Clwd6u4_.js";import{c as x,f as S,t as C,w}from"./project-router-DZsR9P9C.js";import{t as T}from"./use-desktop-BNN3U2y9.js";import{a as ee,c as te,i as ne,l as E,o as re,r as ie,t as ae,u as oe}from"./file-preview-iucr8WDo.js";import{t as D}from"./arrow-left-BELOeFyX.js";import{n as O,t as k}from"./file-1a6_DhLG.js";import{t as se}from"./check-Dt8U0Zvm.js";import{t as ce}from"./chevron-right-VbYrJ_st.js";import{c as A,d as j,f as le,o as ue,p as M,s as N,t as de,u as P}from"./git-toolbar-DU5Ca6RI.js";import{n as F}from"./upload-J0hBTVF7.js";import{n as fe,t as I}from"./triangle-alert-BqI_9MkV.js";import{t as pe}from"./plus-CBVm02wz.js";import{t as L}from"./search-x-CuinYQnl.js";import{t as R}from"./input-DIWTlsx6.js";import{t as z}from"./diff-stat-CiWUpWY0.js";import{t as B}from"./centered-state-nM7v9xtl.js";import{a as me}from"./index-BBND6Sg3.js";import{t as he}from"./markdown-BzqT8I8y.js";import{t as V}from"./diff-CJKocK17.js";import{t as H}from"./commit-list-xMdmPYbz.js";var ge=_(`cloud-upload`,[[`path`,{d:`M12 13v8`,key:`1l5pq0`}],[`path`,{d:`M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242`,key:`1pljnt`}],[`path`,{d:`m8 17 4-4 4 4`,key:`1quai1`}]]),U=e(t(),1),W=n();function _e(){let e=c(),t=f();if(!e.data)return null;let n=e.data,r=e=>t.mutate(e,{onSuccess:e=>S(e.message),onError:e=>S(e.message,{tone:`danger`})}),i=t.isPending,a=t.variables;return(0,W.jsxs)(`div`,{"data-slot":`repo-sync`,className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-[11px]`,children:[n.upstream?(0,W.jsxs)(`span`,{"data-slot":`repo-upstream`,className:`truncate font-mono text-soft-foreground`,title:`Upstream`,children:[`→ `,n.upstream]}):n.branch?(0,W.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`not published`}):(0,W.jsx)(`span`,{"data-slot":`repo-upstream`,className:`text-soft-foreground`,children:`detached HEAD`}),n.upstream?(0,W.jsx)(K,{ahead:n.ahead,behind:n.behind}):n.outgoing.length>0?(0,W.jsx)(K,{ahead:n.outgoing.length,behind:null}):null,(0,W.jsx)(`span`,{"data-slot":`repo-fetched`,className:`hidden text-soft-foreground sm:inline`,children:n.lastFetchedAt?`fetched ${ye(n.lastFetchedAt)}`:`never fetched`}),(0,W.jsxs)(`div`,{className:`ml-auto flex items-center gap-1`,children:[(0,W.jsx)(G,{which:`fetch`,label:`Fetch`,busy:i,pending:a,onClick:r,disabled:!n.pushRemote,children:(0,W.jsx)(P,{"aria-hidden":`true`,className:y(i&&a===`fetch`&&`animate-spin`)})}),n.upstream?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(G,{which:`pull`,label:`Pull`,busy:i,pending:a,onClick:r,disabled:!n.behind,children:(0,W.jsx)(oe,{"aria-hidden":`true`})}),(0,W.jsx)(G,{which:`push`,label:`Push`,busy:i,pending:a,onClick:r,disabled:!n.ahead,children:(0,W.jsx)(O,{"aria-hidden":`true`})}),(0,W.jsx)(G,{which:`sync`,label:`Sync`,busy:i,pending:a,onClick:r,disabled:!n.ahead&&!n.behind,variant:`outline`,children:(0,W.jsx)(P,{"aria-hidden":`true`,className:y(i&&a===`sync`&&`animate-spin`)})})]}):n.branch&&n.pushRemote?(0,W.jsx)(G,{which:`push`,label:`Publish branch`,busy:i,pending:a,onClick:r,variant:`outline`,children:(0,W.jsx)(ge,{"aria-hidden":`true`})}):null]})]})}function G({which:e,label:t,busy:n,pending:r,onClick:i,disabled:a,variant:o=`ghost`,children:s}){return(0,W.jsxs)(b,{variant:o,size:`sm`,"data-action":`repo-${e}`,"aria-busy":n&&r===e,disabled:n||a,onClick:()=>i(e),children:[s,t]})}function K({ahead:e,behind:t}){return e===null&&t===null?null:!e&&!t?(0,W.jsx)(`span`,{"data-slot":`sync-counts`,className:`text-soft-foreground`,children:`in sync`}):(0,W.jsxs)(`span`,{"data-slot":`sync-counts`,className:`flex items-center gap-1 font-mono`,children:[e?(0,W.jsxs)(`span`,{"data-sync":`ahead`,title:`${e} to push`,className:`text-primary`,children:[`↑`,e]}):null,t?(0,W.jsxs)(`span`,{"data-sync":`behind`,title:`${t} to pull`,className:`text-warning`,children:[`↓`,t]}):null]})}function ve({name:e,sync:t}){if(!t)return null;let n=t.branches.find(t=>t.name===e),r=n?n.gone?`upstream gone`:n.upstream?null:`local only`:`remote only`;return(0,W.jsx)(`span`,{"data-slot":`branch-tracking`,className:`flex shrink-0 items-center gap-1 text-[11px]`,children:r?(0,W.jsx)(`span`,{className:`text-soft-foreground`,children:r}):(0,W.jsx)(K,{ahead:n.ahead,behind:n.behind})})}function ye(e){let t=Math.max(0,Math.round((Date.now()-Date.parse(e))/1e3));if(t<60)return`just now`;let n=Math.round(t/60);if(n<60)return`${n} min ago`;let r=Math.round(n/60);return r<24?`${r} h ago`:`${Math.round(r/24)} d ago`}function be({repo:e,info:t}){let n=d(),r=c(),a=i(),s=e=>S(e.message,{tone:`danger`}),u=g({mutationFn:e=>l({name:e}),onSuccess:async e=>{S(e.created?`Created and switched to ${e.branch}`:`Switched to ${e.branch}`),await Promise.all([a.invalidateQueries({queryKey:m.repo}),a.invalidateQueries({queryKey:m.health})]),a.setQueryData(m.repo,t=>t?.info?{...t,info:{...t.info,branch:e.branch}}:t),a.setQueryData(m.health,n=>n?.repo?.root===t.root?{...n,repo:{...n.repo,branch:e.branch}}:n)},onError:s}),f=g({mutationFn:e=>o({baseBranch:e}),onSuccess:e=>{S(e.baseBranch?`Agents now branch from ${e.baseBranch}`:`Agents now fork from the checked-out branch`),a.invalidateQueries({queryKey:m.repo})},onError:s}),[p,h]=(0,U.useState)(``),[_,v]=(0,U.useState)(``),x=_.trim().toLowerCase(),C=x?e.branches.filter(e=>e.toLowerCase().includes(x)):e.branches;return(0,W.jsxs)(`section`,{"data-slot":`repo-branches`,className:`flex flex-col gap-6 px-4 py-4 md:px-6`,children:[(0,W.jsxs)(`div`,{children:[(0,W.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Branches`}),(0,W.jsx)(R,{"aria-label":`Filter branches`,placeholder:`Filter branches…`,value:_,onChange:e=>v(e.target.value),className:`mt-2 max-w-xl`}),(0,W.jsxs)(`ul`,{"data-slot":`repo-branch-list`,className:`mt-2 flex max-w-xl flex-col divide-y divide-border`,children:[C.map(n=>{let i=n===t.branch,a=e.checkedOutElsewhere?.[n];return(0,W.jsxs)(`li`,{"data-slot":`branch-row`,"data-branch":n,className:`flex min-h-9 items-center gap-2 py-1`,children:[(0,W.jsx)(j,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-xs`,i&&`font-semibold`),children:n}),(0,W.jsx)(ve,{name:n,sync:r.data}),i?(0,W.jsxs)(`span`,{"data-slot":`branch-current`,className:`flex shrink-0 items-center gap-1 rounded-sm bg-muted px-1.5 py-px text-[10px] font-medium text-muted-foreground`,children:[(0,W.jsx)(se,{"aria-hidden":`true`,className:`size-3`}),`current`]}):a?(0,W.jsx)(`span`,{"data-slot":`branch-elsewhere`,title:`Checked out in ${a}`,className:`ml-auto shrink-0 text-[11px] text-soft-foreground`,children:`in another worktree`}):(0,W.jsx)(b,{variant:`ghost`,size:`sm`,"data-action":`switch-branch`,className:`ml-auto`,disabled:u.isPending,onClick:()=>u.mutate(n),children:`Switch`})]},n)}),C.length===0?(0,W.jsxs)(`li`,{"data-slot":`branch-empty`,className:`py-3 text-xs text-soft-foreground`,children:[`No branches match “`,_.trim(),`”.`]}):null]}),(0,W.jsxs)(`form`,{"data-slot":`branch-create`,className:`mt-3 flex max-w-md items-center gap-2`,onSubmit:e=>{e.preventDefault();let t=p.trim();t&&u.mutate(t,{onSuccess:()=>h(``)})},children:[(0,W.jsx)(R,{"aria-label":`New branch name`,placeholder:`new-branch-name`,value:p,onChange:e=>h(e.target.value)}),(0,W.jsxs)(b,{type:`submit`,variant:`outline`,size:`sm`,"data-action":`create-branch`,disabled:!p.trim()||u.isPending,children:[(0,W.jsx)(pe,{"aria-hidden":`true`}),`Create`]})]})]}),(0,W.jsxs)(`div`,{className:`max-w-md`,children:[(0,W.jsx)(`label`,{htmlFor:`base-branch-picker`,className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Agents’ base branch`}),(0,W.jsxs)(`select`,{id:`base-branch-picker`,"data-slot":`base-branch-picker`,value:e.baseBranch??``,disabled:f.isPending,onChange:e=>f.mutate(e.target.value===``?null:e.target.value),className:`mt-1.5 block w-full rounded-md border border-input bg-card px-3 py-1.5 text-sm shadow-xs outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:opacity-50`,children:[(0,W.jsx)(`option`,{value:``,children:`follow checked-out branch (default)`}),e.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}),(0,W.jsx)(`p`,{className:`mt-1 text-[11px] text-soft-foreground`,children:`New task worktrees branch from this.`})]}),n.data?.forge?.available?(0,W.jsx)(xe,{}):null]})}function xe(){let e=r({limit:20});return(0,W.jsxs)(`div`,{"data-slot":`repo-prs`,className:`max-w-xl`,children:[(0,W.jsx)(`h2`,{className:`text-xs font-semibold tracking-wide text-soft-foreground uppercase`,children:`Open pull requests`}),e.isPending?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`Loading pull requests…`}):e.isError?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:e.error.message}):e.data.available?e.data.prs.length===0?(0,W.jsx)(`p`,{className:`mt-2 text-xs text-soft-foreground`,children:`No open pull requests.`}):(0,W.jsx)(`ul`,{className:`mt-2 flex flex-col divide-y divide-border`,children:e.data.prs.map(e=>(0,W.jsx)(Se,{pr:e},e.number))}):(0,W.jsx)(`p`,{"data-slot":`repo-prs-unavailable`,className:`mt-2 text-xs text-soft-foreground`,children:e.data.reason??`The forge is unreachable right now.`})]})}function Se({pr:e}){let t=(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(fe,{"aria-hidden":`true`,className:`size-3.5 shrink-0 text-muted-foreground`}),(0,W.jsxs)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:[`#`,e.number]}),(0,W.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,children:e.title}),e.checks?(0,W.jsx)(Ce,{checks:e.checks}):null]}),n=`flex min-w-0 items-center gap-2 rounded-sm px-1.5 py-2`;return(0,W.jsx)(`li`,{"data-slot":`pr-row`,"data-number":e.number,children:v(e.url)?(0,W.jsx)(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,className:y(n,`hover:bg-muted`),children:t}):(0,W.jsx)(`span`,{className:n,children:t})})}function Ce({checks:e}){return(0,W.jsx)(`span`,{"data-slot":`pr-checks`,"data-checks":e,className:y(`shrink-0 text-[10px] font-medium`,e===`passing`&&`text-success`,e===`failing`&&`text-danger`,e===`pending`&&`text-muted-foreground`),children:e})}function we(){let e=s(),t=T(),[n,r]=(0,U.useState)(`unified`),[i,o]=(0,U.useState)(!1),[c,l]=(0,U.useState)(!1),[u,d]=(0,U.useState)(null),f=(0,U.useRef)(null),p=e.isError&&e.error instanceof a&&e.error.status===409,m=e.data?.files??[],h=(0,U.useMemo)(()=>ne(m),[m]),g=(0,U.useMemo)(()=>m.some(he),[m]),_=t?n:`unified`,v=!t||i;return(0,W.jsxs)(`section`,{"data-slot":`repo-changes`,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{"data-slot":`repo-changes-toolbar`,className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,W.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Uncommitted changes`}),e.data?(0,W.jsx)(de,{stat:e.data.stat}):null,(0,W.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,W.jsx)(N,{mode:n,wrap:i,preview:c,onModeChange:r,onWrapChange:o,onPreviewChange:g?l:void 0})})]}),e.isPending?(0,W.jsx)(`p`,{"data-slot":`changes-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading changes…`}):e.isError?(0,W.jsx)(B,{icon:p?(0,W.jsx)(M,{}):(0,W.jsx)(I,{}),tone:p?`neutral`:`danger`,heading:`h2`,title:p?`No changes to show`:`Could not load the changes`,subtitle:e.error.message}):m.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(M,{}),tone:`neutral`,heading:`h2`,title:`Working tree clean`,subtitle:`No uncommitted changes in the main working tree. Edits show up here as they happen.`}):(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 gap-5 px-4 py-4 max-md:[--diff-sticky-top:7rem] md:px-6 md:py-0`,children:[(0,W.jsx)(`aside`,{"data-slot":`changes-tree-pane`,className:`hidden w-60 shrink-0 overflow-y-auto overscroll-contain py-4 md:block lg:w-72`,children:(0,W.jsx)(re,{root:h,selected:u,onSelect:e=>{d(e),f.current?.scrollToPath(e)}})}),(0,W.jsx)(`div`,{"data-slot":`diff-pane`,"data-diff-scroller":t?``:void 0,className:`min-w-0 flex-1 md:overflow-y-auto md:overscroll-contain`,children:(0,W.jsx)(V,{files:m,viewRef:f,mode:_,wrap:v,preview:t&&g&&c,className:`min-w-0 md:py-4`})})]})]})}function Te({log:e}){let{sha:t}=w(),n=c().data;if(t)return(0,W.jsx)(Ee,{sha:t});let r=new Set(n?.outgoing??[]),i=n?.incoming??[],a=(e,t)=>({sha:e.hash,shaLabel:e.hash,subject:e.subject,author:e.author,when:e.when,href:`/git/commits/${e.hash}`,...t?{sync:t}:{}}),o=i.length>0?(0,W.jsxs)(`section`,{"data-slot":`repo-incoming`,className:`border-b border-border`,children:[(0,W.jsxs)(`h2`,{className:`px-4 pt-3 text-[11px] font-medium text-muted-foreground md:px-6`,children:[`Incoming from `,n?.upstream,` · `,i.length]}),(0,W.jsx)(H,{slot:`repo-incoming-commits`,commits:i.map(e=>a(e,`incoming`))})]}):null;return e.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No commits yet`,subtitle:`The log is empty — this repository has no commits to show.`}):(0,W.jsxs)(W.Fragment,{children:[o,(0,W.jsx)(H,{slot:`repo-commits`,commits:e.map(e=>a(e,r.has(e.hash)?`outgoing`:void 0))})]})}function Ee({sha:e}){let t=p(e),n=T(),[r,i]=(0,U.useState)(`unified`),[o,s]=(0,U.useState)(!1),c=t.isError&&t.error instanceof a&&t.error.status===409,l=n?r:`unified`,u=!n||o;return(0,W.jsxs)(`section`,{"data-slot":`repo-commit`,"data-sha":e,className:`flex min-h-0 flex-1 flex-col`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2.5 gap-y-1.5 border-b border-border px-4 py-2 md:px-6`,children:[(0,W.jsx)(b,{asChild:!0,variant:`ghost`,size:`sm`,"data-slot":`commit-back`,children:(0,W.jsxs)(C,{to:`/git/commits`,children:[(0,W.jsx)(D,{"aria-hidden":`true`}),`All commits`]})}),t.data?(0,W.jsx)(z,{stat:t.data.stat}):null,(0,W.jsx)(`span`,{className:`ml-auto hidden items-center gap-1 md:flex`,children:(0,W.jsx)(N,{mode:r,wrap:o,onModeChange:i,onWrapChange:s})})]}),t.isPending?(0,W.jsx)(`p`,{"data-slot":`commit-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading commit…`}):t.isError?(0,W.jsx)(B,{icon:c?(0,W.jsx)(L,{}):(0,W.jsx)(I,{}),tone:c?`neutral`:`danger`,heading:`h2`,title:c?`Commit not found`:`Could not load the commit`,subtitle:t.error.message}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{"data-slot":`commit-meta`,className:`border-b border-border px-4 py-3 md:px-6`,children:[(0,W.jsx)(`h2`,{className:`text-sm font-semibold`,children:t.data.subject}),(0,W.jsxs)(`p`,{className:`mt-0.5 text-[11px] text-soft-foreground`,children:[t.data.author,` · `,t.data.when,` ·`,` `,(0,W.jsx)(`span`,{className:`font-mono select-all`,children:t.data.sha})]})]}),t.data.files.length===0?(0,W.jsx)(B,{icon:(0,W.jsx)(F,{}),tone:`neutral`,heading:`h2`,title:`No file changes`,subtitle:`This commit carries no diff of its own — a merge commit's changes live on the commits it merged.`}):(0,W.jsx)(`div`,{className:`px-4 py-4 [--diff-sticky-top:7rem] md:px-6`,children:(0,W.jsx)(V,{files:t.data.files,mode:l,wrap:u,className:`min-w-0`})})]})]})}function q(e,t){let n=0;for(let r of t){if(n=e.indexOf(r,n),n===-1)return!1;n+=r.length}return!0}function De(e,t,n){let r=t.trim().toLowerCase();if(r===``)return{results:[...e],total:e.length};let i=[];for(let t of e){let e=t.toLowerCase();if(!q(e,r))continue;let n=e.slice(e.lastIndexOf(`/`)+1);i.push({path:t,basenameMatch:q(n,r)})}return i.sort((e,t)=>e.basenameMatch===t.basenameMatch?e.path.length===t.path.length?e.path.localeCompare(t.path):e.path.length-t.path.length:e.basenameMatch?-1:1),{results:i.slice(0,n).map(e=>e.path),total:i.length}}var Oe=200;function ke({selected:e,onSelect:t}){let n=h(),r=n.isError&&n.error instanceof a&&n.error.status===409,i=n.data?.paths??[];return n.isPending?(0,W.jsx)(J,{children:(0,W.jsx)(`p`,{"data-slot":`repo-files-loading`,className:`px-4 py-6 text-center text-xs text-soft-foreground md:px-6`,children:`Loading files…`})}):n.isError?(0,W.jsx)(J,{children:(0,W.jsx)(B,{icon:r?(0,W.jsx)(E,{}):(0,W.jsx)(I,{}),tone:r?`neutral`:`danger`,heading:`h2`,title:r?`No files to browse`:`Could not load the files`,subtitle:n.error.message})}):i.length===0?(0,W.jsx)(J,{children:(0,W.jsx)(B,{icon:(0,W.jsx)(E,{}),tone:`neutral`,heading:`h2`,title:`No files yet`,subtitle:`Nothing is tracked in this repository. Files show up here once git knows about them.`})}):(0,W.jsxs)(J,{children:[n.data.truncated?(0,W.jsxs)(`p`,{"data-slot":`repo-files-truncated`,role:`status`,className:`border-b border-border bg-muted/40 px-4 py-2 text-xs text-muted-foreground md:px-6`,children:[`Showing the first `,i.length.toLocaleString(),` files; this repository has more. The tree and the filter cover only what is loaded.`]}):null,(0,W.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-stretch gap-5 px-4 py-4 [--diff-sticky-top:7rem] md:flex-row md:items-start md:px-6`,children:[(0,W.jsx)(`aside`,{"data-slot":`repo-files-tree-pane`,className:y(`w-full shrink-0 md:sticky md:top-[var(--diff-sticky-top)] md:block md:max-h-[calc(100dvh_-_var(--diff-sticky-top)_-_1rem)] md:w-60 md:overflow-y-auto md:overscroll-contain lg:w-72`,e!==null&&`hidden`),children:(0,W.jsx)(Z,{paths:i,selected:e,onSelect:t})}),(0,W.jsxs)(`div`,{className:y(`min-w-0 flex-1`,e===null&&`hidden md:block`),children:[e===null?null:(0,W.jsxs)(`button`,{type:`button`,"data-slot":`repo-files-back`,onClick:()=>t(null),className:`mb-2 flex items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground md:hidden`,children:[(0,W.jsx)(D,{"aria-hidden":`true`,className:`size-3.5`}),`Back to the file tree`]}),(0,W.jsx)(ae,{source:{kind:`repo`},path:e})]})]})]})}function J({children:e}){return(0,W.jsx)(`section`,{"data-slot":`repo-files`,className:`flex min-h-0 flex-1 flex-col`,children:e})}function Y(e){if(e===null)return[];let t=e.split(`/`);return t.slice(0,-1).map((e,n)=>t.slice(0,n+1).join(`/`))}function X(e,t,n){let r=[];for(let i of e.dirs){let e=t.has(i.path);r.push({kind:`dir`,path:i.path,name:i.name,level:n,open:e}),e&&r.push(...X(i,t,n+1))}for(let t of e.files)r.push({kind:`file`,path:t.path,name:t.name,level:n,label:t.name});return r}function Z({paths:e,selected:t,onSelect:n}){let[r,i]=(0,U.useState)(``),[a,o]=(0,U.useState)(()=>new Set(Y(t))),[s,c]=(0,U.useState)(t),l=(0,U.useRef)(null);(0,U.useEffect)(()=>{let e=Y(t);e.length!==0&&o(t=>{if(e.every(e=>t.has(e)))return t;let n=new Set(t);for(let t of e)n.add(t);return n})},[t]);let u=r.trim()!==``,d=(0,U.useMemo)(()=>De(e,r,Oe),[e,r]),f=(0,U.useMemo)(()=>ee(e,(e,t)=>({kind:`file`,name:t,path:e})),[e]),p=(0,U.useMemo)(()=>u?d.results.map(e=>({kind:`file`,path:e,name:e.slice(e.lastIndexOf(`/`)+1),level:0,label:e})):X(f,a,0),[u,d.results,f,a]),m=p.find(e=>e.path===s)??p[0],h=e=>o(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n});return(0,W.jsxs)(`div`,{"data-slot":`repo-files-browser`,className:`flex min-w-0 flex-col gap-2`,onKeyDown:e=>{e.key!==`/`||e.target===l.current||(e.preventDefault(),l.current?.focus())},children:[(0,W.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,W.jsx)(`label`,{htmlFor:`repo-files-filter`,className:`sr-only`,children:`Filter repository files`}),(0,W.jsx)(`input`,{id:`repo-files-filter`,ref:l,"data-slot":`repo-files-filter`,type:`search`,value:r,placeholder:`Filter files… (/)`,"aria-controls":`repo-files-tree`,autoComplete:`off`,spellCheck:!1,onChange:e=>i(e.target.value),onKeyDown:e=>{e.key===`Escape`&&(e.preventDefault(),i(``))},className:`w-full rounded-sm border border-border bg-background px-2 py-1 text-xs placeholder:text-soft-foreground focus:border-foreground focus:outline-none`}),(0,W.jsx)(`p`,{"data-slot":`repo-files-count`,role:`status`,"aria-live":`polite`,className:`sr-only`,children:u?`${d.total} files match ${r.trim()}`:`${e.length} files`})]}),u&&d.total===0?(0,W.jsxs)(`p`,{"data-slot":`repo-files-no-match`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[`No file matches `,(0,W.jsx)(`span`,{className:`font-mono`,children:r.trim()}),`.`]}):(0,W.jsx)(`div`,{id:`repo-files-tree`,"data-slot":`repo-files-tree`,"data-filtering":u?`true`:void 0,role:`tree`,"aria-label":`Repository files`,"aria-activedescendant":m?Q(m.path):void 0,onKeyDown:e=>{let t=p.findIndex(e=>e.path===m?.path),r=e=>{let t=p[Math.max(0,Math.min(p.length-1,e))];t&&c(t.path)},i=p[t];if(e.key===`ArrowDown`)e.preventDefault(),r(t+1);else if(e.key===`ArrowUp`)e.preventDefault(),r(t-1);else if(e.key===`ArrowRight`&&i?.kind===`dir`)e.preventDefault(),i.open?r(t+1):h(i.path);else if(e.key===`ArrowLeft`&&i!==void 0)if(e.preventDefault(),i.kind===`dir`&&i.open)h(i.path);else for(let e=t-1;e>=0;--e){let t=p[e];if(t.level<i.level){c(t.path);break}}else(e.key===`Enter`||e.key===` `)&&i!==void 0&&(e.preventDefault(),i.kind===`file`?n(i.path):h(i.path))},className:`min-w-0 text-[13px]`,children:p.map(e=>e.kind===`dir`?(0,W.jsx)(Ae,{row:e,focused:e.path===m?.path,onToggle:()=>{c(e.path),h(e.path)}},e.path):(0,W.jsx)(je,{row:e,active:e.path===t,focused:e.path===m?.path,onSelect:()=>{c(e.path),n(e.path)}},e.path))}),u&&d.total>d.results.length?(0,W.jsxs)(`p`,{"data-slot":`repo-files-more`,className:`px-1.5 py-1 text-xs text-soft-foreground`,children:[(d.total-d.results.length).toLocaleString(),` more — refine the filter.`]}):null]})}var Q=e=>`repo-file-row-${e}`,$=(e,t)=>({paddingLeft:`${t+e*14}px`});function Ae({row:e,focused:t,onToggle:n}){return(0,W.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-expanded":e.open,"aria-level":e.level+1,"data-slot":`repo-files-dir`,"data-path":e.path,"data-state":e.open?`open`:`closed`,tabIndex:t?0:-1,onClick:n,className:`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left text-muted-foreground hover:bg-muted hover:text-foreground focus:bg-muted focus:outline-none`,style:$(e.level,6),children:[(0,W.jsx)(ce,{"aria-hidden":`true`,className:y(`size-3.5 shrink-0 transition-transform`,e.open&&`rotate-90`)}),(0,W.jsx)(le,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate font-medium`,children:e.name})]})}function je({row:e,active:t,focused:n,onSelect:r}){let i=ie(e.path)?te:k;return(0,W.jsxs)(`div`,{id:Q(e.path),role:`treeitem`,"aria-level":e.level+1,"aria-selected":t,"aria-current":t?`true`:void 0,"data-slot":`repo-files-file`,"data-path":e.path,tabIndex:n?0:-1,onClick:r,className:y(`flex w-full min-w-0 cursor-pointer items-center gap-1.5 rounded-sm px-1.5 py-1 text-left hover:bg-muted focus:outline-none`,t?`bg-muted font-medium text-foreground`:`text-muted-foreground hover:text-foreground`),style:$(e.level,24),children:[(0,W.jsx)(i,{"aria-hidden":`true`,className:`size-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`min-w-0 truncate`,title:e.label,children:e.label})]})}function Me({tab:e}){let t=u();if(t.isPending)return(0,W.jsx)(me,{});if(t.isError)return(0,W.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(B,{icon:(0,W.jsx)(I,{}),tone:`danger`,title:`Could not load the repository`,subtitle:t.error.message})});let n=t.data.info;return n?(0,W.jsx)(Ne,{repo:t.data,info:n,tab:e}):(0,W.jsx)(`div`,{"data-route":`repo-git`,className:`flex min-h-full flex-col`,children:(0,W.jsx)(B,{icon:(0,W.jsx)(j,{}),tone:`neutral`,title:`Not a git repository`,subtitle:`The cockpit is running outside a git repository — start it inside one to browse changes, commits and branches.`})})}function Ne({repo:e,info:t,tab:n}){return(0,W.jsxs)(`div`,{"data-route":`repo-git`,className:y(`flex min-h-full flex-col`,n===`changes`&&`md:h-full`),children:[(0,W.jsxs)(`header`,{"data-slot":`repo-header`,className:`sticky top-0 z-20 border-b border-border bg-background/95 px-4 pt-3 backdrop-blur md:px-6`,children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2.5`,children:[(0,W.jsx)(`h1`,{className:`text-lg font-semibold`,children:`Git`}),(0,W.jsx)(ue,{branch:t.branch}),t.remote?(0,W.jsx)(`span`,{"data-slot":`repo-remote`,className:`hidden min-w-0 truncate text-[11px] text-soft-foreground md:inline`,children:t.remote}):null]}),(0,W.jsx)(`div`,{className:`mt-1.5`,children:(0,W.jsx)(_e,{})}),(0,W.jsxs)(`div`,{"data-slot":`repo-tabs`,className:`mt-2.5 flex items-end gap-1`,children:[(0,W.jsx)(A,{to:`/git`,active:n===`changes`,children:`Changes`}),(0,W.jsx)(A,{to:`/git/commits`,active:n===`commits`,children:`Commits`}),(0,W.jsx)(A,{to:`/git/branches`,active:n===`branches`,children:`Branches`}),(0,W.jsx)(A,{to:`/git/files`,active:n===`files`,children:`Files`})]})]}),n===`changes`?(0,W.jsx)(we,{}):n===`commits`?(0,W.jsx)(Te,{log:e.log}):n===`files`?(0,W.jsx)(Pe,{}):(0,W.jsx)(be,{repo:e,info:t})]})}function Pe(){let e=w(),t=x();return(0,W.jsx)(ke,{selected:e[`*`]!==void 0&&e[`*`]!==``?e[`*`]:null,onSelect:e=>t(e===null?`/git/files`:`/git/files/${Fe(e)}`,{replace:!0})})}function Fe(e){return e.split(`/`).map(encodeURIComponent).join(`/`)}export{Me as RepoGitRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Di as r,N as i,Nt as a,Pt as o,Qn as s,Qt as c,Sa as l,Ut as u,Yn as d,or as f,pr as p,qr as m,qt as h,r as g,xi as _,ya as v}from"./queries-CI0EmEcH.js";import{r as y,t as b}from"./button-Clwd6u4_.js";import{T as x,c as S,f as C,s as w,t as T}from"./project-router-DZsR9P9C.js";import{_ as E,f as D,g as O,h as k,m as A,p as j}from"./reference-chip-DnemrSPW.js";import{N as M,bn as N,fn as P,gn as F}from"./git-tab-loading-BfC2ir8N.js";import{t as I}from"./arrow-left-BELOeFyX.js";import{F as L,H as R,M as z,N as B}from"./worktree-lifecycle-operation-DOTiqQFx.js";import{t as V}from"./circle-check-DnEaQ9Rj.js";import{u as H}from"./git-toolbar-DU5Ca6RI.js";import{t as ee}from"./triangle-alert-BqI_9MkV.js";import{t as te}from"./input-DIWTlsx6.js";import{t as U}from"./centered-state-nM7v9xtl.js";import{D as W,l as G,s as ne}from"./index-Cse8uyXO.js";var K=e(t(),1),q=n(),J=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function Y({children:e}){return(0,q.jsx)(`span`,{className:`font-mono`,children:e})}function X(){return(0,q.jsx)(q.Fragment,{children:J.map((e,t)=>(0,q.jsxs)(`span`,{children:[t>0?t===J.length-1?`, or `:`, `:``,(0,q.jsx)(Y,{children:e})]},e))})}function re(){return(0,q.jsxs)(q.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,q.jsx)(X,{}),` (agent mirrors like`,` `,(0,q.jsx)(Y,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,q.jsx)(Y,{children:`name`}),`,`,` `,(0,q.jsx)(Y,{children:`description`}),`. Global (`,(0,q.jsx)(Y,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}var ie=2e3,ae=5*6e4;async function oe(e,t,n={}){let{apply:r=s,read:i=m,wait:a=e=>new Promise(t=>setTimeout(t,e)),now:o=Date.now,onDropped:c=F}=n;try{return await r(e)}catch(n){if(!(n instanceof d)||n.status!==0&&n.status!==409)throw n;let r=e=>{n.status===0&&c(e)},s=o()+ae;for(;;){let c;try{c=await i(e)}catch{throw r(`unreachable`),n}if(c.status!==`updating`){if(c.updatedAt&&c.updatedAt!==t)return r(`recovered`),c;throw r(`not_applied`),n}if(o()>=s)throw r(`timed_out`),n;await a(ie)}}}function Z(e){return e===`project`?`Project installation`:`Global installation`}function se({projectId:e,state:t,loadError:n}){let r=l(),i=S(),a=(0,K.useRef)(0),[o,s]=(0,K.useState)(!1),u=v({mutationFn:()=>p({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{P(`skills_import`),s(!1),i(M(e))},onError:e=>C(e.message,{tone:`danger`})}),d=(t,n)=>{n.seq===a.current&&(r.setQueryData(c.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:g.skills}),C(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),s(!0)))},m=(e,t)=>{t.seq===a.current&&C(e.message,{tone:`danger`})},h=v({mutationFn:t=>f(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>m(e,t)}),_=v({mutationFn:t=>oe(e,t.previousUpdatedAt).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>m(e,t)}),x=e=>{let n=++a.current;e===`apply`?_.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):h.mutate({action:e,seq:n})},w=t?.scopes??[],T=w.filter(e=>e.skills.length>0),N=T.length>0,F=t?.status===`error`,I=N&&(t?.available||F),L=_.isPending||t?.status===`updating`,R=w.filter(e=>e.status===`error`||e.status===`unavailable`),z=w.filter(e=>e.updatedAt&&!R.includes(e)),B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`&&!N?B=t.needsUpgradeNotes?`Skill files were updated.`:`No installed Open Mercato skills are tracked for updates.`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,T.length>0?(0,q.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:T.map(e=>(0,q.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,R.length>0?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,R.map(e=>Z(e.scope)).join(`, `),z.length?`; updated: `+z.map(e=>Z(e.scope)).join(`, `):``,`.`]}):null]}),I?(0,q.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:L,onClick:()=>x(`apply`),children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3.5`,L&&`motion-safe:animate-spin`)}),L?`Updating…`:F?`Retry`:`Update now`]}):t?.status===`current`?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,q.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,q.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,q.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,q.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,q.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,q.jsx)(D,{open:o,onOpenChange:e=>u.isPending?void 0:s(e),children:(0,q.jsxs)(j,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,q.jsxs)(O,{children:[(0,q.jsx)(E,{children:`Apply the upgrade notes now?`}),(0,q.jsxs)(A,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,q.jsxs)(k,{children:[(0,q.jsx)(b,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>s(!1),children:`No`}),(0,q.jsx)(b,{type:`button`,disabled:u.isPending,onClick:()=>u.mutate(),children:u.isPending?`Starting…`:`Yes, start session`})]})]})})]})}function Q(e,t){let n=e?.importedSkills;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&!!e):[...t]}function $(e,t,n,r,i=!1){let a=e.source===`ai`||e.source===`cezar`||e.source===`agents`||e.source===`global`,o=e.source===`team`&&(t.has(e.name)||i);if(!(!a&&!o))return{ariaLabel:a?`${e.name} is always enabled`:`${e.enabled?`Disable`:`Enable`} ${e.name}`,checked:a||e.enabled,disabled:a||n||i,onCheckedChange:()=>r(e.name)}}function ce(){return(0,q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,q.jsx)(le,{})]})}function le(){let e=w()??``,t=o(e,!!e),n=a(),s=h(),c=i(),[d]=x(),[f,p]=(0,K.useState)(``),m=l(),S=u(),E=c.data??[],D=(0,K.useMemo)(()=>E.map(e=>e.name),[E]),O=(0,K.useMemo)(()=>new Set(D),[D]),k=(0,K.useMemo)(()=>new Set(Q(S.data,D)),[S.data,D]),A=(0,K.useRef)(Promise.resolve()),j=(0,K.useRef)(0),M=(0,K.useCallback)(t=>{let n=g.uiState,r=g.skills,i=m.getQueryData(n),a=Q(i,D),o=a.includes(t)?a.filter(e=>e!==t):[...a,t];m.setQueryData(n,{...i,importedSkills:o});let s=++j.current;A.current=A.current.then(async()=>{try{let t=await _({importedSkills:o},e);if(s!==j.current)return;m.setQueryData(n,t),m.invalidateQueries({queryKey:r})}catch(e){if(s!==j.current)return;C(e instanceof Error?e.message:String(e),{tone:`danger`}),m.invalidateQueries({queryKey:n})}})},[D,e,m]),P=v({mutationFn:()=>r(),onSuccess:e=>{m.setQueryData(g.skills,e),C(`Team skills refreshed.`)},onError:e=>C(e.message,{tone:`danger`})});if(n.isError)return(0,q.jsx)(U,{icon:(0,q.jsx)(ee,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:n.error.message});let F=L(n.data??[]),B=new Set(F.map(e=>e.name)),V=L([...F.map(e=>({...e,enabled:e.source===`team`&&O.has(e.name)?k.has(e.name):!0})),...E.filter(e=>!B.has(e.name)).map(e=>({...e,enabled:k.has(e.name)}))].sort((e,t)=>e.name.localeCompare(t.name))),W=d.get(`skill`),G=V.find(e=>e.name===W)??(W===null?V.find(e=>e.enabled):null)??null,J=G?.name??null,Y=G?$(G,O,S.isPending,M,c.isError):void 0,X=z(V,f);return(0,q.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,q.jsxs)(`section`,{"data-slot":`skills-list`,className:y(`w-full flex-col border-border md:flex md:w-96 md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,W===null||!G?`flex`:`hidden md:flex`),children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,q.jsx)(te,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:f,onChange:e=>p(e.target.value),className:`h-8 text-[13px]`}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:P.isPending,onClick:()=>P.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3`,P.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),e?(0,q.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,q.jsx)(se,{projectId:e,state:t.data,loadError:t.error})}):null,c.isError?(0,q.jsxs)(`div`,{"data-slot":`skills-importable-error`,role:`alert`,className:`mx-3 mb-2 flex shrink-0 items-center justify-between gap-3 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[(0,q.jsxs)(`p`,{className:`min-w-0`,children:[`Could not load the Open Mercato skills catalog. Team skills may be missing until it loads.`,` `,c.error.message]}),(0,q.jsx)(b,{type:`button`,"data-action":`skills-importable-retry`,variant:`ghost`,size:`sm`,disabled:c.isFetching,onClick:()=>void c.refetch(),children:`Retry`})]}):null,(0,q.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 pb-2`,children:n.isPending?(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):X.length>0?X.map(e=>(0,q.jsx)(ue,{skill:e,active:J===e.name,activation:$(e,O,S.isPending,M,c.isError)},e.name)):(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:V.length>0?`(no skills match)`:(0,q.jsx)(re,{})})})]}),(0,q.jsx)(`section`,{"data-slot":`skills-detail`,className:y(`min-w-0 flex-1 flex-col`,W===null||!G?`hidden md:flex`:`flex`),children:(0,q.jsx)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:G?(0,q.jsxs)(q.Fragment,{children:[W===null?null:(0,q.jsxs)(T,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,q.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),(0,q.jsx)(ne,{skill:G,enabled:G.enabled,activation:Y,usedBy:R(s.data?.workflows??[],G.name)})]}):n.isPending?null:(0,q.jsx)(U,{icon:(0,q.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})})})]})}function ue({skill:e,active:t,activation:n}){let r=B(e),i=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-[13px]`,e.enabled?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,q.jsx)(G,{source:e.source,teamRepo:e.team?.repo,className:`ml-auto`})]}),e.description?(0,q.jsx)(`span`,{className:`line-clamp-2 text-xs text-soft-foreground`,children:e.description}):null]});return(0,q.jsxs)(`li`,{className:y(`flex min-w-0 items-start gap-0 rounded-md transition-colors hover:bg-muted`,t&&`bg-muted`),children:[n?(0,q.jsx)(W,{"data-slot":`skill-activation`,"aria-label":n.ariaLabel,checked:n.checked,disabled:n.disabled,onCheckedChange:n.onCheckedChange,size:`sm`,className:`mt-2.5 ml-2 shrink-0`}):null,(0,q.jsx)(T,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":r?`true`:void 0,"data-enabled":e.enabled?`true`:`false`,"aria-current":t?`page`:void 0,className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2.5 py-2`,children:i})]})}export{ce as SkillsRoute};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{Di as r,N as i,Nt as a,Pt as o,Qn as s,Qt as c,Sa as l,Ut as u,Yn as d,or as f,pr as p,qr as m,qt as h,r as g,xi as _,ya as v}from"./queries-CI0EmEcH.js";import{r as y,t as b}from"./button-Clwd6u4_.js";import{T as x,c as S,f as C,s as w,t as T}from"./project-router-DZsR9P9C.js";import{_ as E,f as D,g as O,h as k,m as A,p as j}from"./reference-chip-DnemrSPW.js";import{N as M,bn as N,fn as P,gn as F}from"./git-tab-loading-BfC2ir8N.js";import{t as I}from"./arrow-left-BELOeFyX.js";import{F as L,H as R,M as z,N as B}from"./worktree-lifecycle-operation-DOTiqQFx.js";import{t as V}from"./circle-check-DnEaQ9Rj.js";import{u as H}from"./git-toolbar-DU5Ca6RI.js";import{t as ee}from"./triangle-alert-BqI_9MkV.js";import{t as te}from"./input-DIWTlsx6.js";import{t as U}from"./centered-state-nM7v9xtl.js";import{D as W,l as G,s as ne}from"./index-BBND6Sg3.js";var K=e(t(),1),q=n(),J=[`.ai/cezar/skills/`,`.ai/skills/`,`.agents/skills/`];function Y({children:e}){return(0,q.jsx)(`span`,{className:`font-mono`,children:e})}function X(){return(0,q.jsx)(q.Fragment,{children:J.map((e,t)=>(0,q.jsxs)(`span`,{children:[t>0?t===J.length-1?`, or `:`, `:``,(0,q.jsx)(Y,{children:e})]},e))})}function re(){return(0,q.jsxs)(q.Fragment,{children:[`No skills yet. Drop Markdown files into `,(0,q.jsx)(X,{}),` (agent mirrors like`,` `,(0,q.jsx)(Y,{children:`.claude/skills/`}),` work too) — optional frontmatter: `,(0,q.jsx)(Y,{children:`name`}),`,`,` `,(0,q.jsx)(Y,{children:`description`}),`. Global (`,(0,q.jsx)(Y,{children:`~/.agents/skills`}),`) and team-repo skills appear here too — try Refresh.`]})}var ie=2e3,ae=5*6e4;async function oe(e,t,n={}){let{apply:r=s,read:i=m,wait:a=e=>new Promise(t=>setTimeout(t,e)),now:o=Date.now,onDropped:c=F}=n;try{return await r(e)}catch(n){if(!(n instanceof d)||n.status!==0&&n.status!==409)throw n;let r=e=>{n.status===0&&c(e)},s=o()+ae;for(;;){let c;try{c=await i(e)}catch{throw r(`unreachable`),n}if(c.status!==`updating`){if(c.updatedAt&&c.updatedAt!==t)return r(`recovered`),c;throw r(`not_applied`),n}if(o()>=s)throw r(`timed_out`),n;await a(ie)}}}function Z(e){return e===`project`?`Project installation`:`Global installation`}function se({projectId:e,state:t,loadError:n}){let r=l(),i=S(),a=(0,K.useRef)(0),[o,s]=(0,K.useState)(!1),u=v({mutationFn:()=>p({task:`Apply the upgrade notes after updating the installed Open Mercato skills.`,steps:[{id:`apply-upgrade-notes`,name:`Apply upgrade notes`,skill:`om-apply-upgrade-notes`,prompt:`{{task}}`}]}),onSuccess:e=>{P(`skills_import`),s(!1),i(M(e))},onError:e=>C(e.message,{tone:`danger`})}),d=(t,n)=>{n.seq===a.current&&(r.setQueryData(c.skillsUpdate(e),t),n.action===`apply`&&t.updatedAt&&t.updatedAt!==n.previousUpdatedAt&&(r.invalidateQueries({queryKey:g.skills}),C(t.status===`error`?`Some skill updates failed.`:`Open Mercato skills updated.`),s(!0)))},m=(e,t)=>{t.seq===a.current&&C(e.message,{tone:`danger`})},h=v({mutationFn:t=>f(e).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>m(e,t)}),_=v({mutationFn:t=>oe(e,t.previousUpdatedAt).then(e=>({result:e,request:t})),onSuccess:({result:e,request:t})=>d(e,t),onError:(e,t)=>m(e,t)}),x=e=>{let n=++a.current;e===`apply`?_.mutate({action:e,seq:n,previousUpdatedAt:t?.updatedAt??null}):h.mutate({action:e,seq:n})},w=t?.scopes??[],T=w.filter(e=>e.skills.length>0),N=T.length>0,F=t?.status===`error`,I=N&&(t?.available||F),L=_.isPending||t?.status===`updating`,R=w.filter(e=>e.status===`error`||e.status===`unavailable`),z=w.filter(e=>e.updatedAt&&!R.includes(e)),B=`Checking installed Open Mercato skills…`;return n?B=`Update status is unavailable right now.`:t?.status===`available`?B=`An update is available for your installed Open Mercato skills.`:t?.status===`updating`?B=`Updating installed Open Mercato skills…`:t?.status===`current`&&!N?B=t.needsUpgradeNotes?`Skill files were updated.`:`No installed Open Mercato skills are tracked for updates.`:t?.status===`current`?B=`Installed Open Mercato skills are up to date.`:t?.status===`unavailable`?B=t.scopes.find(e=>e.reason)?.reason??`Automatic updates are unavailable.`:t?.status===`error`&&(B=`The update did not finish for every installation.`),(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`section`,{"data-slot":`skills-update-card`,"aria-live":`polite`,className:`rounded-lg border border-border bg-muted/30 p-3`,children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between`,children:[(0,q.jsxs)(`div`,{className:`min-w-0`,children:[(0,q.jsx)(`p`,{className:`text-[13px] font-medium text-foreground`,children:B}),t?.checkedAt?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-soft-foreground`,children:[`Last checked `,new Date(t.checkedAt).toLocaleString(),`.`]}):null,T.length>0?(0,q.jsx)(`ul`,{className:`mt-1 text-xs text-soft-foreground`,children:T.map(e=>(0,q.jsxs)(`li`,{children:[Z(e.scope),` · `,e.skills.length,` tracked`]},e.scope))}):null,R.length>0?(0,q.jsxs)(`p`,{className:`mt-1 text-xs text-destructive`,children:[`Failed: `,R.map(e=>Z(e.scope)).join(`, `),z.length?`; updated: `+z.map(e=>Z(e.scope)).join(`, `):``,`.`]}):null]}),I?(0,q.jsxs)(b,{"data-action":`skills-update-apply`,size:`sm`,disabled:L,onClick:()=>x(`apply`),children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3.5`,L&&`motion-safe:animate-spin`)}),L?`Updating…`:F?`Retry`:`Update now`]}):t?.status===`current`?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Check again`}):t?.status===`unavailable`||n?(0,q.jsx)(b,{"data-action":`skills-update-check`,variant:`outline`,size:`sm`,disabled:h.isPending,onClick:()=>x(`check`),children:`Retry check`}):null]}),t?.status===`unavailable`||n?(0,q.jsxs)(`div`,{className:`mt-2 text-xs text-soft-foreground`,children:[`Manual examples: `,(0,q.jsx)(`code`,{children:`npx skills update -p`}),` · `,(0,q.jsx)(`code`,{children:`npx skills update -g`}),`. These broad commands may update other tracked sources.`]}):null,t?.needsUpgradeNotes?(0,q.jsxs)(`div`,{"data-slot":`skills-upgrade-notes`,className:`mt-3 flex gap-2 rounded-md border border-primary/30 bg-background p-2.5 text-xs text-foreground`,children:[(0,q.jsx)(V,{"aria-hidden":`true`,className:`mt-0.5 size-3.5 shrink-0 text-primary`}),(0,q.jsxs)(`span`,{children:[`Skill files were updated. Run `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` in each configured repository to apply descriptor migrations while preserving local edits.`]})]}):null]}),(0,q.jsx)(D,{open:o,onOpenChange:e=>u.isPending?void 0:s(e),children:(0,q.jsxs)(j,{"data-slot":`skills-upgrade-notes-dialog`,showCloseButton:!1,children:[(0,q.jsxs)(O,{children:[(0,q.jsx)(E,{children:`Apply the upgrade notes now?`}),(0,q.jsxs)(A,{children:[`The skill files were updated successfully. Start a new session with`,` `,(0,q.jsx)(`code`,{children:`/om-apply-upgrade-notes`}),` to sync repository descriptors while preserving local edits?`]})]}),(0,q.jsxs)(k,{children:[(0,q.jsx)(b,{type:`button`,variant:`outline`,disabled:u.isPending,onClick:()=>s(!1),children:`No`}),(0,q.jsx)(b,{type:`button`,disabled:u.isPending,onClick:()=>u.mutate(),children:u.isPending?`Starting…`:`Yes, start session`})]})]})})]})}function Q(e,t){let n=e?.importedSkills;return Array.isArray(n)?n.filter(e=>typeof e==`string`&&!!e):[...t]}function $(e,t,n,r,i=!1){let a=e.source===`ai`||e.source===`cezar`||e.source===`agents`||e.source===`global`,o=e.source===`team`&&(t.has(e.name)||i);if(!(!a&&!o))return{ariaLabel:a?`${e.name} is always enabled`:`${e.enabled?`Disable`:`Enable`} ${e.name}`,checked:a||e.enabled,disabled:a||n||i,onCheckedChange:()=>r(e.name)}}function ce(){return(0,q.jsxs)(`div`,{"data-route":`skills`,className:`flex min-h-full flex-col`,children:[(0,q.jsxs)(`header`,{className:`sticky top-0 z-10 hidden h-14 shrink-0 items-center gap-3 border-b border-border bg-background px-5 md:flex`,children:[(0,q.jsx)(`h1`,{className:`text-base font-semibold`,children:`Skills`}),(0,q.jsx)(`p`,{className:`text-[13px] text-muted-foreground`,children:`Markdown playbooks agents can follow.`})]}),(0,q.jsx)(le,{})]})}function le(){let e=w()??``,t=o(e,!!e),n=a(),s=h(),c=i(),[d]=x(),[f,p]=(0,K.useState)(``),m=l(),S=u(),E=c.data??[],D=(0,K.useMemo)(()=>E.map(e=>e.name),[E]),O=(0,K.useMemo)(()=>new Set(D),[D]),k=(0,K.useMemo)(()=>new Set(Q(S.data,D)),[S.data,D]),A=(0,K.useRef)(Promise.resolve()),j=(0,K.useRef)(0),M=(0,K.useCallback)(t=>{let n=g.uiState,r=g.skills,i=m.getQueryData(n),a=Q(i,D),o=a.includes(t)?a.filter(e=>e!==t):[...a,t];m.setQueryData(n,{...i,importedSkills:o});let s=++j.current;A.current=A.current.then(async()=>{try{let t=await _({importedSkills:o},e);if(s!==j.current)return;m.setQueryData(n,t),m.invalidateQueries({queryKey:r})}catch(e){if(s!==j.current)return;C(e instanceof Error?e.message:String(e),{tone:`danger`}),m.invalidateQueries({queryKey:n})}})},[D,e,m]),P=v({mutationFn:()=>r(),onSuccess:e=>{m.setQueryData(g.skills,e),C(`Team skills refreshed.`)},onError:e=>C(e.message,{tone:`danger`})});if(n.isError)return(0,q.jsx)(U,{icon:(0,q.jsx)(ee,{}),tone:`danger`,heading:`h2`,title:`Could not load skills`,subtitle:n.error.message});let F=L(n.data??[]),B=new Set(F.map(e=>e.name)),V=L([...F.map(e=>({...e,enabled:e.source===`team`&&O.has(e.name)?k.has(e.name):!0})),...E.filter(e=>!B.has(e.name)).map(e=>({...e,enabled:k.has(e.name)}))].sort((e,t)=>e.name.localeCompare(t.name))),W=d.get(`skill`),G=V.find(e=>e.name===W)??(W===null?V.find(e=>e.enabled):null)??null,J=G?.name??null,Y=G?$(G,O,S.isPending,M,c.isError):void 0,X=z(V,f);return(0,q.jsxs)(`div`,{"data-slot":`skills-section`,className:`flex min-h-full flex-1 items-stretch`,children:[(0,q.jsxs)(`section`,{"data-slot":`skills-list`,className:y(`w-full flex-col border-border md:flex md:w-96 md:shrink-0 md:border-r`,`md:sticky md:top-14 md:max-h-[calc(100dvh-(var(--spacing)*14))]`,W===null||!G?`flex`:`hidden md:flex`),children:[(0,q.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2 p-3 pb-2`,children:[(0,q.jsx)(te,{"data-slot":`skills-filter`,placeholder:`Filter skills…`,"aria-label":`Filter skills`,value:f,onChange:e=>p(e.target.value),className:`h-8 text-[13px]`}),(0,q.jsxs)(`button`,{type:`button`,"data-slot":`skills-refresh`,title:`git fetch the team skills repos`,disabled:P.isPending,onClick:()=>P.mutate(),className:`flex h-8 shrink-0 items-center gap-1.5 rounded-md border border-border bg-card px-2.5 text-xs font-medium text-muted-foreground transition-colors hover:bg-muted hover:text-foreground disabled:opacity-55`,children:[(0,q.jsx)(H,{"aria-hidden":`true`,className:y(`size-3`,P.isPending&&`motion-safe:animate-spin`)}),`Refresh`]})]}),e?(0,q.jsx)(`div`,{className:`shrink-0 px-3 pb-2`,children:(0,q.jsx)(se,{projectId:e,state:t.data,loadError:t.error})}):null,c.isError?(0,q.jsxs)(`div`,{"data-slot":`skills-importable-error`,role:`alert`,className:`mx-3 mb-2 flex shrink-0 items-center justify-between gap-3 rounded-md border border-danger/20 bg-danger/10 px-3 py-2 text-xs text-danger`,children:[(0,q.jsxs)(`p`,{className:`min-w-0`,children:[`Could not load the Open Mercato skills catalog. Team skills may be missing until it loads.`,` `,c.error.message]}),(0,q.jsx)(b,{type:`button`,"data-action":`skills-importable-retry`,variant:`ghost`,size:`sm`,disabled:c.isFetching,onClick:()=>void c.refetch(),children:`Retry`})]}):null,(0,q.jsx)(`ul`,{"data-slot":`skill-rows`,className:`min-h-0 flex-1 space-y-1 overflow-y-auto px-2 pb-2`,children:n.isPending?(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-[13px] text-soft-foreground`,children:`Loading…`}):X.length>0?X.map(e=>(0,q.jsx)(ue,{skill:e,active:J===e.name,activation:$(e,O,S.isPending,M,c.isError)},e.name)):(0,q.jsx)(`li`,{className:`px-2.5 py-2 text-xs leading-relaxed text-soft-foreground`,children:V.length>0?`(no skills match)`:(0,q.jsx)(re,{})})})]}),(0,q.jsx)(`section`,{"data-slot":`skills-detail`,className:y(`min-w-0 flex-1 flex-col`,W===null||!G?`hidden md:flex`:`flex`),children:(0,q.jsx)(`div`,{className:`min-w-0 flex-1 px-4 py-4 md:px-7 md:py-5`,children:G?(0,q.jsxs)(q.Fragment,{children:[W===null?null:(0,q.jsxs)(T,{to:`/skills`,"data-slot":`skills-back`,className:`mb-3 inline-flex items-center gap-1.5 text-xs font-medium text-muted-foreground hover:text-foreground md:hidden`,children:[(0,q.jsx)(I,{"aria-hidden":`true`,className:`size-3.5`}),`Back to skills`]}),(0,q.jsx)(ne,{skill:G,enabled:G.enabled,activation:Y,usedBy:R(s.data?.workflows??[],G.name)})]}):n.isPending?null:(0,q.jsx)(U,{icon:(0,q.jsx)(N,{}),tone:`neutral`,heading:`h2`,title:`No skill selected`,subtitle:`Pick a skill from the catalog.`})})})]})}function ue({skill:e,active:t,activation:n}){let r=B(e),i=(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,q.jsx)(`span`,{className:y(`min-w-0 truncate font-mono text-[13px]`,e.enabled?`font-semibold text-foreground`:`font-medium text-muted-foreground`),children:e.name}),(0,q.jsx)(G,{source:e.source,teamRepo:e.team?.repo,className:`ml-auto`})]}),e.description?(0,q.jsx)(`span`,{className:`line-clamp-2 text-xs text-soft-foreground`,children:e.description}):null]});return(0,q.jsxs)(`li`,{className:y(`flex min-w-0 items-start gap-0 rounded-md transition-colors hover:bg-muted`,t&&`bg-muted`),children:[n?(0,q.jsx)(W,{"data-slot":`skill-activation`,"aria-label":n.ariaLabel,checked:n.checked,disabled:n.disabled,onCheckedChange:n.onCheckedChange,size:`sm`,className:`mt-2.5 ml-2 shrink-0`}):null,(0,q.jsx)(T,{to:`/skills?skill=${encodeURIComponent(e.name)}`,"data-slot":`skill-row`,"data-skill":e.name,"data-project":r?`true`:void 0,"data-enabled":e.enabled?`true`:`false`,"aria-current":t?`page`:void 0,className:`flex min-w-0 flex-1 flex-col gap-0.5 px-2.5 py-2`,children:i})]})}export{ce as SkillsRoute};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{ft as r}from"./queries-CI0EmEcH.js";import{t as i}from"./project-router-DZsR9P9C.js";import{r as a}from"./git-tab-loading-BfC2ir8N.js";import{n as o}from"./textarea-ewNKsXDa.js";import{n as s}from"./terminal-F3ZJ5fI8.js";import{t as c}from"./centered-state-nM7v9xtl.js";import{FloatingPanel as l,a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w}from"./workflow-graph-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-QTnfLwEv.js";import{i as t,t as n}from"./react-runtime-CCIEwYL0.js";import{ft as r}from"./queries-CI0EmEcH.js";import{t as i}from"./project-router-DZsR9P9C.js";import{r as a}from"./git-tab-loading-BfC2ir8N.js";import{n as o}from"./textarea-ewNKsXDa.js";import{n as s}from"./terminal-F3ZJ5fI8.js";import{t as c}from"./centered-state-nM7v9xtl.js";import{FloatingPanel as l,a as u,c as d,d as f,f as p,h as m,i as h,l as g,m as _,n as v,o as y,p as b,r as x,s as S,t as C,u as w}from"./workflow-graph-l7O50dsV.js";var T=e(t(),1),E=n();function D({data:e}){let{node:t,state:n,childRunId:r}=e;return r?(0,E.jsx)(O,{node:t,state:n,childRunId:r}):(0,E.jsx)(C,{node:t,connectable:!1,status:n.status,loopCount:n.loopCount,iterations:n.iterations,costUsd:n.costUsd})}function O({node:e,state:t,childRunId:n}){let i=r(n).data,a=i&&i.steps.length>1?i.steps.map(e=>({id:e.id,name:e.name??e.id,status:e.status})):void 0;return(0,E.jsx)(C,{node:e,connectable:!1,status:t.status,costUsd:i?.costUsd??t.costUsd,inner:a,subtaskTo:`/tasks/${n}/graph`})}var k={live:D};function A({run:e,embedded:t=!1}){let n=e.workflowDef,r=(0,T.useMemo)(()=>n?u(n):null,[n]),i=(0,T.useMemo)(()=>r?g(r,e):null,[r,e]),[s,C]=(0,T.useState)(null),D=r?.nodes.find(e=>e.id===s),O=(0,T.useMemo)(()=>r&&i?r.nodes.map(t=>({id:t.id,type:`live`,position:r.layout?.[t.id]??{x:0,y:0},draggable:!1,connectable:!1,data:{node:t,state:i.nodes.get(t.id)??{status:`pending`},...j(e,t.id)}})):[],[r,i]),A=(0,T.useMemo)(()=>r?y(r):new Set,[r]),N=(0,T.useMemo)(()=>r?v(r,A):new Map,[r,A]),P=(0,T.useMemo)(()=>!r||!i?[]:r.nodes.flatMap(e=>d(e).flatMap(t=>{let n=w(r,e.id,t);if(!n)return[];let a=`${e.id}.${t}->${n}`,o=i.edges.get(a)??0,s=A.has(`${e.id}.${t}->${n}`),c=(r.layout?.[n]?.x??0)<=(r.layout?.[e.id]?.x??0),l=x({tone:S(e,t),back:s,emphasis:o?`taken`:`dim`});return[{id:a,source:e.id,sourceHandle:t,target:n,type:s||c||N.has(a)?`lane`:`default`,...N.has(a)?{data:{lane:N.get(a)}}:{},label:o>1?`×${o}`:void 0,style:l,markerEnd:{type:m.ArrowClosed,color:l.stroke,width:14,height:14},labelStyle:{fill:`var(--muted-foreground)`,fontSize:10,fontWeight:600},labelBgStyle:{fill:`var(--background)`}}]})),[r,i,A,N]);return(0,E.jsxs)(`div`,{"data-route":`task-graph`,className:`flex h-full min-h-0 flex-col`,children:[t?null:(0,E.jsx)(a,{run:e,tab:`graph`}),r?(0,E.jsxs)(`div`,{className:`relative min-h-[420px] flex-1`,children:[(0,E.jsxs)(_,{nodes:O,edges:P,nodeTypes:k,edgeTypes:h,nodesDraggable:!1,nodesConnectable:!1,elementsSelectable:!1,onNodeClick:(e,t)=>C(t.id),onPaneClick:()=>C(null),fitView:!0,fitViewOptions:{padding:.2,maxZoom:1.2},minZoom:.2,colorMode:`system`,proOptions:{hideAttribution:!0},children:[(0,E.jsx)(f,{variant:p.Dots,gap:18,size:1}),(0,E.jsx)(b,{showInteractive:!1})]}),D&&i?(0,E.jsx)(l,{side:`right`,label:`Node details`,title:D.name??D.id,onClose:()=>C(null),children:(0,E.jsx)(M,{state:i.nodes.get(D.id)??{status:`pending`},outputs:e.graphState?.outputs?.[D.id],childRunId:j(e,D.id).childRunId,loopMax:D.type===`loop`?D.max:void 0})}):null]}):(0,E.jsx)(c,{icon:(0,E.jsx)(o,{}),tone:`neutral`,title:`No workflow graph`,subtitle:`This task has no stored workflow definition to draw.`})]})}function j(e,t){let n=e.graphState?.outputs?.[t]?.runId;return typeof n==`string`&&n?{childRunId:n}:{}}function M({state:e,outputs:t,loopMax:n,childRunId:r}){let a=[[`status`,e.status===`reached`?`passed through`:e.status]];e.iterations&&a.push([`runs`,String(e.iterations)]),e.costUsd&&a.push([`cost`,`$${e.costUsd.toFixed(2)}`]),e.loopCount!==void 0&&a.push([`iterations`,`${e.loopCount}${n?` / ${n}`:``}`]);let o=Object.entries(t??{}).filter(([,e])=>e!==``);return(0,E.jsxs)(`div`,{className:`space-y-4 p-4 text-[12px]`,children:[(0,E.jsx)(`dl`,{className:`grid grid-cols-[auto_1fr] gap-x-3 gap-y-1`,children:a.map(([e,t])=>(0,E.jsxs)(`div`,{className:`contents`,children:[(0,E.jsx)(`dt`,{className:`text-muted-foreground`,children:e}),(0,E.jsx)(`dd`,{children:t})]},e))}),r?(0,E.jsxs)(i,{to:`/tasks/${r}`,className:`inline-flex items-center gap-1 text-primary hover:underline`,children:[`Open the subtask `,(0,E.jsx)(s,{className:`size-3`})]}):null,(0,E.jsxs)(`div`,{children:[(0,E.jsx)(`div`,{className:`mb-1 text-[11px] text-muted-foreground uppercase`,children:`Outputs`}),o.length===0?(0,E.jsx)(`p`,{className:`text-[11px] text-muted-foreground`,children:`Nothing yet — outputs appear once the node has run.`}):o.map(([e,t])=>(0,E.jsxs)(`div`,{className:`mb-2`,children:[(0,E.jsx)(`code`,{className:`text-[11px] text-muted-foreground`,children:e}),(0,E.jsx)(`pre`,{className:`mt-0.5 max-h-48 overflow-auto rounded-md bg-muted/40 p-2 text-[11px] whitespace-pre-wrap`,children:String(t)})]},e))]})]})}export{A as TaskGraphView};
|