@mrpatronz/nexusflow 2.13.0 → 2.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/core/work-guidance.d.ts +4 -4
  2. package/dist/gui/assets/{AgentsPage-DpHlroWm.js → AgentsPage-CJMUiowX.js} +1 -1
  3. package/dist/gui/assets/DashboardPage-CPMjNCSd.js +1 -0
  4. package/dist/gui/assets/{GettingStartedPage-Y4ixhR8B.js → GettingStartedPage-vdPpxxX3.js} +1 -1
  5. package/dist/gui/assets/{MonacoDiffAdapter-CGXPlqCv.js → MonacoDiffAdapter-p1QUAz5J.js} +1 -1
  6. package/dist/gui/assets/ProjectsPage-vy3814fL.js +1 -0
  7. package/dist/gui/assets/{ScaffoldRepoInline-tpk7a07z.js → ScaffoldRepoInline-C0aEuaen.js} +1 -1
  8. package/dist/gui/assets/{SettingsPage-BEozi7bF.js → SettingsPage-CjrpeCko.js} +1 -1
  9. package/dist/gui/assets/{SkillsPage-M1iYmQWO.js → SkillsPage-BRczkn37.js} +4 -4
  10. package/dist/gui/assets/StartWorkPage-Bb8nNYOL.js +1 -0
  11. package/dist/gui/assets/{StrategiesPage-CXsVcMW7.js → StrategiesPage-BYoYlyl3.js} +2 -2
  12. package/dist/gui/assets/WorkroomsPage-C2QVQ1jm.js +4 -0
  13. package/dist/gui/assets/WorkspacesPage-BuQTcejb.js +16 -0
  14. package/dist/gui/assets/{alert-dialog-B6jzcNCC.js → alert-dialog-BQTrpDEB.js} +1 -1
  15. package/dist/gui/assets/index-D-sx2qJG.js +78 -0
  16. package/dist/gui/assets/index-n0pVdSJ7.css +2 -0
  17. package/dist/gui/assets/status-CKOvrZ16.js +1 -0
  18. package/dist/gui/assets/{tabs-PHbAf5Cq.js → tabs-ClWne-mz.js} +1 -1
  19. package/dist/gui/assets/{vsc-CY5HXJ8W.js → vsc-EOWFTqft.js} +1 -1
  20. package/dist/gui/index.html +3 -2
  21. package/dist/server.d.ts.map +1 -1
  22. package/dist/server.js +14 -1
  23. package/dist/server.js.map +1 -1
  24. package/dist/terminal/manager.d.ts +57 -0
  25. package/dist/terminal/manager.d.ts.map +1 -0
  26. package/dist/terminal/manager.js +256 -0
  27. package/dist/terminal/manager.js.map +1 -0
  28. package/dist/terminal/native.d.ts +6 -0
  29. package/dist/terminal/native.d.ts.map +1 -0
  30. package/dist/terminal/native.js +30 -0
  31. package/dist/terminal/native.js.map +1 -0
  32. package/dist/terminal/routes.d.ts +17 -0
  33. package/dist/terminal/routes.d.ts.map +1 -0
  34. package/dist/terminal/routes.js +207 -0
  35. package/dist/terminal/routes.js.map +1 -0
  36. package/dist/terminal/smoke.d.ts +2 -0
  37. package/dist/terminal/smoke.d.ts.map +1 -0
  38. package/dist/terminal/smoke.js +30 -0
  39. package/dist/terminal/smoke.js.map +1 -0
  40. package/dist/terminal/targets.d.ts +49 -0
  41. package/dist/terminal/targets.d.ts.map +1 -0
  42. package/dist/terminal/targets.js +94 -0
  43. package/dist/terminal/targets.js.map +1 -0
  44. package/dist/types.d.ts +5 -0
  45. package/dist/types.d.ts.map +1 -1
  46. package/dist/utils/session-finder.d.ts +1 -0
  47. package/dist/utils/session-finder.d.ts.map +1 -1
  48. package/dist/utils/session-finder.js +66 -27
  49. package/dist/utils/session-finder.js.map +1 -1
  50. package/dist/utils/terminal-launch.d.ts.map +1 -1
  51. package/dist/utils/terminal-launch.js +5 -1
  52. package/dist/utils/terminal-launch.js.map +1 -1
  53. package/package.json +4 -1
  54. package/dist/gui/assets/DashboardPage-BN0FQixO.js +0 -1
  55. package/dist/gui/assets/ProjectsPage-i8Egpjps.js +0 -1
  56. package/dist/gui/assets/StartWorkPage-DUC8e-My.js +0 -1
  57. package/dist/gui/assets/WorkroomsPage-DypyfzgM.js +0 -4
  58. package/dist/gui/assets/WorkspacesPage-aSR6TyA2.js +0 -16
  59. package/dist/gui/assets/index-BRvfvR0q.js +0 -57
  60. package/dist/gui/assets/index-C4GcVl9Z.css +0 -2
@@ -41,8 +41,8 @@ declare const guidanceSchema: z.ZodObject<{
41
41
  rewrite: "rewrite";
42
42
  }>;
43
43
  size: z.ZodEnum<{
44
- small: "small";
45
44
  epic: "epic";
45
+ small: "small";
46
46
  standard: "standard";
47
47
  }>;
48
48
  assignment: z.ZodObject<{
@@ -87,6 +87,7 @@ declare const guidanceSchema: z.ZodObject<{
87
87
  export type WorkDocument = z.infer<typeof documentSchema>;
88
88
  export type WorkGuidance = z.infer<typeof guidanceSchema>;
89
89
  export declare const guidanceUpdateSchema: z.ZodObject<{
90
+ revision: z.ZodNumber;
90
91
  assignment: z.ZodObject<{
91
92
  stage: z.ZodDefault<z.ZodEnum<{
92
93
  investigate: "investigate";
@@ -101,7 +102,6 @@ export declare const guidanceUpdateSchema: z.ZodObject<{
101
102
  stopCondition: z.ZodDefault<z.ZodString>;
102
103
  milestoneId: z.ZodOptional<z.ZodString>;
103
104
  }, z.core.$strip>;
104
- revision: z.ZodNumber;
105
105
  workType: z.ZodEnum<{
106
106
  bug: "bug";
107
107
  feature: "feature";
@@ -110,8 +110,8 @@ export declare const guidanceUpdateSchema: z.ZodObject<{
110
110
  rewrite: "rewrite";
111
111
  }>;
112
112
  size: z.ZodEnum<{
113
- small: "small";
114
113
  epic: "epic";
114
+ small: "small";
115
115
  standard: "standard";
116
116
  }>;
117
117
  }, z.core.$strip>;
@@ -154,7 +154,7 @@ export declare function getWorkContext(workspacePath: string): Promise<{
154
154
  version: 1;
155
155
  revision: number;
156
156
  workType: "bug" | "feature" | "performance" | "refactor" | "rewrite";
157
- size: "small" | "epic" | "standard";
157
+ size: "epic" | "small" | "standard";
158
158
  assignment: {
159
159
  stage: "investigate" | "design" | "implement" | "verify" | "review" | "release";
160
160
  objective: string;
@@ -1,3 +1,3 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{n as r,t as i}from"./badge-BObbahyU.js";import{h as a,m as o,t as s}from"./button-BrcP8Wxx.js";import{t as ee}from"./trash-2-BrrLX4tD.js";import{An as c,B as te,Cn as ne,E as re,Ln as ie,O as ae,P as oe,Y as se,_ as l,a as u,d as ce,f as d,h as f,i as le,in as ue,lt as de,m as p,n as m,o as h,p as g,r as _,t as v,ut as fe,v as y,vn as pe,xn as b,zn as x}from"./index-BRvfvR0q.js";import{a as me,i as he,n as ge,o as S,r as _e,s as ve,t as ye}from"./alert-dialog-B6jzcNCC.js";import{t as be}from"./card-BMggHY3n.js";import{t as C}from"./label-C610MHwq.js";var xe=a(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),w=e(t(),1),T=n(),E={id:``,name:``,category:`general`,description:``,developerInstructions:``};function D(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function O({showToast:e}){let[t,n]=(0,w.useState)(`global`),[a,O]=(0,w.useState)(``),[Se,k]=(0,w.useState)(!1),[A,j]=(0,w.useState)(!1),[M,N]=(0,w.useState)(null),[P,F]=(0,w.useState)(E),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(null),{data:H=[],isLoading:Ce,isError:we}=re(),{data:U=[]}=fe(),W=de(t===`global`?``:t),G=se(),K=te(),q=oe(),J=ae(),Y=t!==`global`,Te=U.find(e=>e.id===t),X=!Y||Te?.assistants?.includes(`codex`),Z=Y&&X&&!W.isLoading&&!W.isError&&!!W.data;(0,w.useEffect)(()=>{if(!Y){z(null);return}W.data&&z([...W.data.enabledAgents??[]])},[Y,t,W.data]);let Q=(0,w.useMemo)(()=>{let e=a.trim().toLowerCase();return e?H.filter(t=>[t.name,t.description,t.category].some(t=>t.toLowerCase().includes(e))):H},[H,a]),Ee=new Set(R??W.data?.enabledAgents??[]);function $(){N(null),F(E),k(!0)}function De(e){N(e.id),F({id:e.id,name:e.name,category:e.category,description:e.description,developerInstructions:e.developerInstructions,model:e.model,modelReasoningEffort:e.modelReasoningEffort,sandboxMode:e.sandboxMode}),k(!0)}async function Oe(){try{let t=M??D(P.name);await G.mutateAsync({...P,id:t,name:t}),k(!1),e?.(`Codex agent saved`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent`,`error`)}}async function ke(){try{await K.mutateAsync({toml:I,category:`general`}),j(!1),L(``),e?.(`Codex agent imported`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to import agent`,`error`)}}async function Ae(){if(B)try{await q.mutateAsync(B.id),V(null),e?.(`Agent deleted from the personal catalog`,`info`)}catch(t){e?.(t instanceof Error?t.message:`Failed to delete agent`,`error`)}}function je(e){if(!Z||R===null)return;let t=new Set(R);t.has(e)?t.delete(e):t.add(e),z([...t])}async function Me(){if(!(!W.data||R===null))try{await J.mutateAsync({workspaceId:t,expectedRevision:W.data.revision??0,enabledSkills:W.data.enabledSkills,enabledAgents:R,enabledCategories:W.data.enabledCategories??[]}),e?.(`Agent selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent selection`,`error`)}}return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-border px-6 py-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(`div`,{className:`rounded-lg bg-primary/10 p-2 text-primary`,children:(0,T.jsx)(x,{className:`h-5 w-5`})}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Codex Agent Library`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create and reuse project-scoped Codex custom agents.`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(s,{render:(0,T.jsx)(ue,{to:`/skills`}),variant:`outline`,size:`sm`,children:`Skills`}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-muted/50 px-3 py-1.5`,children:[(0,T.jsx)(c,{className:`h-4 w-4 text-muted-foreground`}),(0,T.jsx)(C,{htmlFor:`agent-scope`,className:`text-xs text-muted-foreground`,children:`Scope`}),(0,T.jsxs)(`select`,{id:`agent-scope`,value:t,onChange:e=>n(e.target.value),className:`cursor-pointer bg-transparent text-xs font-semibold text-foreground focus:outline-none`,children:[(0,T.jsx)(`option`,{value:`global`,children:`Personal catalog`}),U.map(e=>(0,T.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),Y?(0,T.jsx)(s,{size:`sm`,onClick:Me,disabled:!Z||J.isPending,children:J.isPending?`Saving…`:`Save selection`}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>j(!0),children:[(0,T.jsx)(xe,{className:`mr-1.5 h-4 w-4`}),`Import TOML`]}),(0,T.jsxs)(s,{size:`sm`,onClick:$,children:[(0,T.jsx)(b,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]})]})]}),(0,T.jsx)(`div`,{className:`border-b border-border/60 bg-muted/20 px-6 py-3`,children:(0,T.jsxs)(`div`,{className:`relative max-w-md`,children:[(0,T.jsx)(pe,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,T.jsx)(r,{value:a,onChange:e=>O(e.target.value),placeholder:`Search agents…`,className:`pl-9`})]})}),(0,T.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto p-6`,children:Ce||Y&&W.isLoading?(0,T.jsx)(`div`,{className:`flex justify-center p-12`,children:(0,T.jsx)(ce,{})}):we||Y&&W.isError?(0,T.jsx)(v,{className:`border border-dashed py-12`,children:(0,T.jsxs)(_,{children:[(0,T.jsx)(u,{children:`Resources could not be loaded`}),(0,T.jsx)(m,{children:`Assignment controls remain disabled to protect the saved selection.`})]})}):Y&&!X?(0,T.jsx)(v,{className:`border border-dashed py-12`,children:(0,T.jsxs)(_,{children:[(0,T.jsx)(u,{children:`Codex is not enabled for this workspace`}),(0,T.jsx)(m,{children:`Add Codex to the workspace before assigning Codex-native agents.`})]})}):Q.length===0?(0,T.jsxs)(v,{className:`border border-dashed py-12`,children:[(0,T.jsx)(le,{children:(0,T.jsx)(x,{className:`h-8 w-8 text-muted-foreground`})}),(0,T.jsxs)(_,{children:[(0,T.jsx)(u,{children:`No Codex agents found`}),(0,T.jsx)(m,{children:`Create an agent or import a native TOML definition.`})]}),!Y&&(0,T.jsxs)(s,{size:`sm`,onClick:$,children:[(0,T.jsx)(b,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]}):(0,T.jsx)(`div`,{className:`mx-auto grid max-w-6xl grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:Q.map(e=>{let t=Ee.has(e.id);return(0,T.jsxs)(be,{className:o(`flex flex-col gap-4 p-4`,Y&&!t&&`opacity-60`),children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,T.jsx)(i,{variant:`outline`,children:`Codex`})]}),(0,T.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description})]}),Y?(0,T.jsxs)(s,{variant:t?`default`:`outline`,size:`sm`,onClick:()=>je(e.id),disabled:!Z,children:[(0,T.jsx)(ie,{className:o(`mr-1 h-3.5 w-3.5`,!t&&`opacity-0`)}),t?`Enabled`:`Disabled`]}):(0,T.jsxs)(`div`,{className:`flex gap-1`,children:[(0,T.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":`Edit ${e.name}`,onClick:()=>De(e),children:(0,T.jsx)(ne,{className:`h-4 w-4`})}),(0,T.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,onClick:()=>V(e),children:(0,T.jsx)(ee,{className:`h-4 w-4`})})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[e.sandboxMode&&(0,T.jsx)(i,{variant:`secondary`,children:e.sandboxMode}),e.modelReasoningEffort&&(0,T.jsx)(i,{variant:`secondary`,children:e.modelReasoningEffort}),e.model&&(0,T.jsx)(i,{variant:`secondary`,children:e.model})]})]},e.id)})})}),(0,T.jsx)(d,{open:Se,onOpenChange:k,children:(0,T.jsxs)(l,{className:`max-w-2xl`,children:[(0,T.jsxs)(f,{children:[(0,T.jsx)(y,{children:M?`Edit Codex agent`:`Create Codex agent`}),(0,T.jsx)(g,{children:`Only the current stable native fields are managed. Omitted settings inherit from Codex.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-name`,children:`Name`}),(0,T.jsx)(r,{id:`agent-name`,value:P.name,disabled:!!M,onChange:e=>F({...P,name:D(e.target.value)}),placeholder:`code-reviewer`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-description`,children:`Description`}),(0,T.jsx)(r,{id:`agent-description`,value:P.description,onChange:e=>F({...P,description:e.target.value}),placeholder:`Use when reviewing a fixed diff for correctness and security.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-instructions`,children:`Developer instructions`}),(0,T.jsx)(h,{id:`agent-instructions`,value:P.developerInstructions,onChange:e=>F({...P,developerInstructions:e.target.value}),className:`min-h-48 font-mono`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-model`,children:`Model override`}),(0,T.jsx)(r,{id:`agent-model`,value:P.model??``,onChange:e=>F({...P,model:e.target.value||void 0}),placeholder:`Inherit`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-effort`,children:`Reasoning`}),(0,T.jsxs)(`select`,{id:`agent-effort`,value:P.modelReasoningEffort??``,onChange:e=>F({...P,modelReasoningEffort:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`low`,children:`Low`}),(0,T.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,T.jsx)(`option`,{value:`high`,children:`High`}),(0,T.jsx)(`option`,{value:`xhigh`,children:`XHigh`}),(0,T.jsx)(`option`,{value:`max`,children:`Max`}),(0,T.jsx)(`option`,{value:`ultra`,children:`Ultra`})]})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-sandbox`,children:`Sandbox`}),(0,T.jsxs)(`select`,{id:`agent-sandbox`,value:P.sandboxMode??``,onChange:e=>F({...P,sandboxMode:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`read-only`,children:`Read only`}),(0,T.jsx)(`option`,{value:`workspace-write`,children:`Workspace write`})]})]})]})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(s,{variant:`outline`,onClick:()=>k(!1),children:`Cancel`}),(0,T.jsx)(s,{onClick:Oe,disabled:G.isPending||!P.name||!P.description||!P.developerInstructions,children:G.isPending?`Saving…`:`Save agent`})]})]})}),(0,T.jsx)(d,{open:A,onOpenChange:j,children:(0,T.jsxs)(l,{className:`max-w-2xl`,children:[(0,T.jsxs)(f,{children:[(0,T.jsx)(y,{children:`Import Codex agent TOML`}),(0,T.jsx)(g,{children:`The import accepts the required native fields and supported model, reasoning, and sandbox overrides.`})]}),(0,T.jsx)(h,{value:I,onChange:e=>L(e.target.value),className:`min-h-72 font-mono`,placeholder:`name = "reviewer"
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{n as r,t as i}from"./badge-BObbahyU.js";import{h as a,m as o,t as s}from"./button-BrcP8Wxx.js";import{t as ee}from"./trash-2-BrrLX4tD.js";import{A as c,Dn as te,H as ne,I as re,Jt as ie,O as ae,Z as oe,_ as l,a as u,b as d,cn as se,dn as f,dt as ce,ft as le,g as p,h as m,i as ue,kn as h,m as g,n as _,o as v,p as de,pn as fe,r as y,t as b,xn as pe,y as x}from"./index-D-sx2qJG.js";import{a as me,i as he,n as ge,o as S,r as _e,s as ve,t as ye}from"./alert-dialog-BQTrpDEB.js";import{t as be}from"./card-BMggHY3n.js";import{t as C}from"./label-C610MHwq.js";var xe=a(`file-up`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`m15 15-3-3-3 3`,key:`15xj92`}]]),w=e(t(),1),T=n(),E={id:``,name:``,category:`general`,description:``,developerInstructions:``};function D(e){return e.toLowerCase().trim().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)}function O({showToast:e}){let[t,n]=(0,w.useState)(`global`),[a,O]=(0,w.useState)(``),[Se,k]=(0,w.useState)(!1),[A,j]=(0,w.useState)(!1),[M,N]=(0,w.useState)(null),[P,F]=(0,w.useState)(E),[I,L]=(0,w.useState)(``),[R,z]=(0,w.useState)(null),[B,V]=(0,w.useState)(null),{data:H=[],isLoading:Ce,isError:we}=ae(),{data:U=[]}=le(),W=ce(t===`global`?``:t),G=oe(),K=ne(),q=re(),J=c(),Y=t!==`global`,Te=U.find(e=>e.id===t),X=!Y||Te?.assistants?.includes(`codex`),Z=Y&&X&&!W.isLoading&&!W.isError&&!!W.data;(0,w.useEffect)(()=>{if(!Y){z(null);return}W.data&&z([...W.data.enabledAgents??[]])},[Y,t,W.data]);let Q=(0,w.useMemo)(()=>{let e=a.trim().toLowerCase();return e?H.filter(t=>[t.name,t.description,t.category].some(t=>t.toLowerCase().includes(e))):H},[H,a]),Ee=new Set(R??W.data?.enabledAgents??[]);function $(){N(null),F(E),k(!0)}function De(e){N(e.id),F({id:e.id,name:e.name,category:e.category,description:e.description,developerInstructions:e.developerInstructions,model:e.model,modelReasoningEffort:e.modelReasoningEffort,sandboxMode:e.sandboxMode}),k(!0)}async function Oe(){try{let t=M??D(P.name);await G.mutateAsync({...P,id:t,name:t}),k(!1),e?.(`Codex agent saved`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent`,`error`)}}async function ke(){try{await K.mutateAsync({toml:I,category:`general`}),j(!1),L(``),e?.(`Codex agent imported`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to import agent`,`error`)}}async function Ae(){if(B)try{await q.mutateAsync(B.id),V(null),e?.(`Agent deleted from the personal catalog`,`info`)}catch(t){e?.(t instanceof Error?t.message:`Failed to delete agent`,`error`)}}function je(e){if(!Z||R===null)return;let t=new Set(R);t.has(e)?t.delete(e):t.add(e),z([...t])}async function Me(){if(!(!W.data||R===null))try{await J.mutateAsync({workspaceId:t,expectedRevision:W.data.revision??0,enabledSkills:W.data.enabledSkills,enabledAgents:R,enabledCategories:W.data.enabledCategories??[]}),e?.(`Agent selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save agent selection`,`error`)}}return(0,T.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,children:[(0,T.jsxs)(`header`,{className:`flex flex-wrap items-center justify-between gap-4 border-b border-border px-6 py-5`,children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,T.jsx)(`div`,{className:`rounded-lg bg-primary/10 p-2 text-primary`,children:(0,T.jsx)(h,{className:`h-5 w-5`})}),(0,T.jsxs)(`div`,{children:[(0,T.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Codex Agent Library`}),(0,T.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create and reuse project-scoped Codex custom agents.`})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,T.jsx)(s,{render:(0,T.jsx)(ie,{to:`/skills`}),variant:`outline`,size:`sm`,children:`Skills`}),(0,T.jsxs)(`div`,{className:`flex items-center gap-2 rounded-lg border border-border bg-muted/50 px-3 py-1.5`,children:[(0,T.jsx)(pe,{className:`h-4 w-4 text-muted-foreground`}),(0,T.jsx)(C,{htmlFor:`agent-scope`,className:`text-xs text-muted-foreground`,children:`Scope`}),(0,T.jsxs)(`select`,{id:`agent-scope`,value:t,onChange:e=>n(e.target.value),className:`cursor-pointer bg-transparent text-xs font-semibold text-foreground focus:outline-none`,children:[(0,T.jsx)(`option`,{value:`global`,children:`Personal catalog`}),U.map(e=>(0,T.jsx)(`option`,{value:e.id,children:e.id},e.id))]})]}),Y?(0,T.jsx)(s,{size:`sm`,onClick:Me,disabled:!Z||J.isPending,children:J.isPending?`Saving…`:`Save selection`}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>j(!0),children:[(0,T.jsx)(xe,{className:`mr-1.5 h-4 w-4`}),`Import TOML`]}),(0,T.jsxs)(s,{size:`sm`,onClick:$,children:[(0,T.jsx)(f,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]})]})]}),(0,T.jsx)(`div`,{className:`border-b border-border/60 bg-muted/20 px-6 py-3`,children:(0,T.jsxs)(`div`,{className:`relative max-w-md`,children:[(0,T.jsx)(se,{className:`absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground`}),(0,T.jsx)(r,{value:a,onChange:e=>O(e.target.value),placeholder:`Search agents…`,className:`pl-9`})]})}),(0,T.jsx)(`main`,{className:`min-h-0 flex-1 overflow-auto p-6`,children:Ce||Y&&W.isLoading?(0,T.jsx)(`div`,{className:`flex justify-center p-12`,children:(0,T.jsx)(de,{})}):we||Y&&W.isError?(0,T.jsx)(b,{className:`border border-dashed py-12`,children:(0,T.jsxs)(y,{children:[(0,T.jsx)(u,{children:`Resources could not be loaded`}),(0,T.jsx)(_,{children:`Assignment controls remain disabled to protect the saved selection.`})]})}):Y&&!X?(0,T.jsx)(b,{className:`border border-dashed py-12`,children:(0,T.jsxs)(y,{children:[(0,T.jsx)(u,{children:`Codex is not enabled for this workspace`}),(0,T.jsx)(_,{children:`Add Codex to the workspace before assigning Codex-native agents.`})]})}):Q.length===0?(0,T.jsxs)(b,{className:`border border-dashed py-12`,children:[(0,T.jsx)(ue,{children:(0,T.jsx)(h,{className:`h-8 w-8 text-muted-foreground`})}),(0,T.jsxs)(y,{children:[(0,T.jsx)(u,{children:`No Codex agents found`}),(0,T.jsx)(_,{children:`Create an agent or import a native TOML definition.`})]}),!Y&&(0,T.jsxs)(s,{size:`sm`,onClick:$,children:[(0,T.jsx)(f,{className:`mr-1.5 h-4 w-4`}),`New agent`]})]}):(0,T.jsx)(`div`,{className:`mx-auto grid max-w-6xl grid-cols-1 gap-4 md:grid-cols-2 xl:grid-cols-3`,children:Q.map(e=>{let t=Ee.has(e.id);return(0,T.jsxs)(be,{className:o(`flex flex-col gap-4 p-4`,Y&&!t&&`opacity-60`),children:[(0,T.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,T.jsxs)(`div`,{children:[(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(`h2`,{className:`font-semibold`,children:e.name}),(0,T.jsx)(i,{variant:`outline`,children:`Codex`})]}),(0,T.jsx)(`p`,{className:`mt-2 text-sm text-muted-foreground`,children:e.description})]}),Y?(0,T.jsxs)(s,{variant:t?`default`:`outline`,size:`sm`,onClick:()=>je(e.id),disabled:!Z,children:[(0,T.jsx)(te,{className:o(`mr-1 h-3.5 w-3.5`,!t&&`opacity-0`)}),t?`Enabled`:`Disabled`]}):(0,T.jsxs)(`div`,{className:`flex gap-1`,children:[(0,T.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":`Edit ${e.name}`,onClick:()=>De(e),children:(0,T.jsx)(fe,{className:`h-4 w-4`})}),(0,T.jsx)(s,{variant:`ghost`,size:`icon`,"aria-label":`Delete ${e.name}`,onClick:()=>V(e),children:(0,T.jsx)(ee,{className:`h-4 w-4`})})]})]}),(0,T.jsxs)(`div`,{className:`flex flex-wrap gap-2 text-xs text-muted-foreground`,children:[e.sandboxMode&&(0,T.jsx)(i,{variant:`secondary`,children:e.sandboxMode}),e.modelReasoningEffort&&(0,T.jsx)(i,{variant:`secondary`,children:e.modelReasoningEffort}),e.model&&(0,T.jsx)(i,{variant:`secondary`,children:e.model})]})]},e.id)})})}),(0,T.jsx)(g,{open:Se,onOpenChange:k,children:(0,T.jsxs)(x,{className:`max-w-2xl`,children:[(0,T.jsxs)(l,{children:[(0,T.jsx)(d,{children:M?`Edit Codex agent`:`Create Codex agent`}),(0,T.jsx)(m,{children:`Only the current stable native fields are managed. Omitted settings inherit from Codex.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-4 py-2`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-name`,children:`Name`}),(0,T.jsx)(r,{id:`agent-name`,value:P.name,disabled:!!M,onChange:e=>F({...P,name:D(e.target.value)}),placeholder:`code-reviewer`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-description`,children:`Description`}),(0,T.jsx)(r,{id:`agent-description`,value:P.description,onChange:e=>F({...P,description:e.target.value}),placeholder:`Use when reviewing a fixed diff for correctness and security.`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-instructions`,children:`Developer instructions`}),(0,T.jsx)(v,{id:`agent-instructions`,value:P.developerInstructions,onChange:e=>F({...P,developerInstructions:e.target.value}),className:`min-h-48 font-mono`})]}),(0,T.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-model`,children:`Model override`}),(0,T.jsx)(r,{id:`agent-model`,value:P.model??``,onChange:e=>F({...P,model:e.target.value||void 0}),placeholder:`Inherit`})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-effort`,children:`Reasoning`}),(0,T.jsxs)(`select`,{id:`agent-effort`,value:P.modelReasoningEffort??``,onChange:e=>F({...P,modelReasoningEffort:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`low`,children:`Low`}),(0,T.jsx)(`option`,{value:`medium`,children:`Medium`}),(0,T.jsx)(`option`,{value:`high`,children:`High`}),(0,T.jsx)(`option`,{value:`xhigh`,children:`XHigh`}),(0,T.jsx)(`option`,{value:`max`,children:`Max`}),(0,T.jsx)(`option`,{value:`ultra`,children:`Ultra`})]})]}),(0,T.jsxs)(`div`,{className:`grid gap-2`,children:[(0,T.jsx)(C,{htmlFor:`agent-sandbox`,children:`Sandbox`}),(0,T.jsxs)(`select`,{id:`agent-sandbox`,value:P.sandboxMode??``,onChange:e=>F({...P,sandboxMode:e.target.value||void 0}),className:`h-9 rounded-md border border-input bg-background px-3 text-sm`,children:[(0,T.jsx)(`option`,{value:``,children:`Inherit`}),(0,T.jsx)(`option`,{value:`read-only`,children:`Read only`}),(0,T.jsx)(`option`,{value:`workspace-write`,children:`Workspace write`})]})]})]})]}),(0,T.jsxs)(p,{children:[(0,T.jsx)(s,{variant:`outline`,onClick:()=>k(!1),children:`Cancel`}),(0,T.jsx)(s,{onClick:Oe,disabled:G.isPending||!P.name||!P.description||!P.developerInstructions,children:G.isPending?`Saving…`:`Save agent`})]})]})}),(0,T.jsx)(g,{open:A,onOpenChange:j,children:(0,T.jsxs)(x,{className:`max-w-2xl`,children:[(0,T.jsxs)(l,{children:[(0,T.jsx)(d,{children:`Import Codex agent TOML`}),(0,T.jsx)(m,{children:`The import accepts the required native fields and supported model, reasoning, and sandbox overrides.`})]}),(0,T.jsx)(v,{value:I,onChange:e=>L(e.target.value),className:`min-h-72 font-mono`,placeholder:`name = "reviewer"
2
2
  description = "Use for code review."
3
3
  developer_instructions = "Review the fixed diff."`}),(0,T.jsxs)(p,{children:[(0,T.jsx)(s,{variant:`outline`,onClick:()=>j(!1),children:`Cancel`}),(0,T.jsx)(s,{onClick:ke,disabled:K.isPending||!I.trim(),children:K.isPending?`Importing…`:`Import agent`})]})]})}),(0,T.jsx)(ye,{open:B!==null,onOpenChange:e=>!e&&V(null),children:(0,T.jsxs)(S,{children:[(0,T.jsxs)(me,{children:[(0,T.jsxs)(ve,{children:[`Delete “`,B?.name,`”?`]}),(0,T.jsx)(_e,{children:`This removes the agent from the personal catalog. Existing workspace copies remain until the workspace is refreshed.`})]}),(0,T.jsxs)(he,{children:[(0,T.jsx)(ge,{render:(0,T.jsx)(s,{variant:`outline`,children:`Cancel`})}),(0,T.jsx)(s,{variant:`destructive`,onClick:Ae,disabled:q.isPending,children:q.isPending?`Deleting…`:`Delete agent`})]})]})})]})}export{O as AgentsPage};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{h as r,m as i,t as a}from"./button-BrcP8Wxx.js";import{t as o}from"./code-xml-DHWUQOSO.js";import{a as s,g as c,i as l,m as u,n as d,r as ee,s as f}from"./status-CKOvrZ16.js";import{t as te}from"./brand-hHByyyzq.js";import{Mn as p,On as m,Pn as h,U as g,Yt as _,a as v,an as y,bn as b,cn as x,dn as S,f as ne,i as C,k as w,mt as T,n as re,nn as E,p as D,r as O,st as k,t as A,vt as ie,xn as j}from"./index-D-sx2qJG.js";import{t as M}from"./card-BMggHY3n.js";var ae=r(`file-diff`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M9 10h6`,key:`9gxzsh`}],[`path`,{d:`M12 13V7`,key:`h0r20n`}],[`path`,{d:`M9 17h6`,key:`r8uit2`}]]),N=e(t(),1),P=n(),F=[{id:`antigravity`,name:`Google Antigravity`,shortName:`Antigravity`,cliCommand:`agy`,icon:(0,P.jsx)(l,{className:`size-4`}),getOptions:({aiDetected:e,launchTargets:t})=>[{id:`antigravity-cli`,label:`CLI in Terminal`,shortLabel:`CLI`,type:`cli`,command:`agy`,isAvailable:e.antigravity??!1,unavailableReason:`CLI "agy" not found on PATH`,icon:(0,P.jsx)(E,{size:12})},{id:`antigravity-ide`,label:`Antigravity IDE Workspace`,shortLabel:`IDE`,type:`editor`,targetId:`antigravity`,isAvailable:t.find(e=>e.id===`antigravity`)?.available??!1,unavailableReason:`Antigravity IDE not installed`,icon:(0,P.jsx)(o,{size:12})}]},{id:`claude`,name:`Claude Code`,shortName:`Claude`,cliCommand:`claude`,icon:(0,P.jsx)(`span`,{className:`grid size-5 place-items-center rounded bg-[#D97757] text-white shadow-2xs`,children:(0,P.jsx)(s,{className:`size-3`})}),getOptions:({aiDetected:e,launchTargets:t})=>[{id:`claude-cli`,label:`CLI in Terminal`,shortLabel:`CLI`,type:`cli`,command:`claude`,isAvailable:e.claude??!1,unavailableReason:`CLI "claude" not found on PATH`,icon:(0,P.jsx)(E,{size:12})},{id:`claude-desktop`,label:`Claude Desktop App`,shortLabel:`App`,type:`app`,targetId:`claude-desktop`,isAvailable:t.find(e=>e.id===`claude-desktop`)?.available??!1,unavailableReason:`Claude Desktop not detected`,icon:(0,P.jsx)(c,{size:12})}]},{id:`codex`,name:`OpenAI Codex`,shortName:`Codex`,cliCommand:`codex`,icon:(0,P.jsx)(`span`,{className:`grid size-5 place-items-center rounded bg-foreground text-background shadow-2xs`,children:(0,P.jsx)(u,{className:`size-3`})}),getOptions:({aiDetected:e,launchTargets:t})=>[{id:`codex-cli`,label:`CLI in Terminal`,shortLabel:`CLI`,type:`cli`,command:`codex`,isAvailable:e.codex??!1,unavailableReason:`CLI "codex" not found on PATH`,icon:(0,P.jsx)(E,{size:12})},{id:`codex-desktop`,label:`Codex Desktop App`,shortLabel:`App`,type:`app`,targetId:`codex-desktop`,isAvailable:t.find(e=>e.id===`codex-desktop`)?.available??!1,unavailableReason:`Codex Desktop not detected`,icon:(0,P.jsx)(c,{size:12})}]},{id:`copilot`,name:`GitHub Copilot`,shortName:`Copilot`,cliCommand:`copilot`,icon:(0,P.jsx)(`span`,{className:`grid size-5 place-items-center rounded bg-gradient-to-tr from-purple-600 via-indigo-500 to-blue-600 text-white shadow-2xs`,children:(0,P.jsx)(f,{className:`size-3`})}),getOptions:({aiDetected:e,launchTargets:t})=>[{id:`copilot-cli`,label:`Copilot CLI in Terminal`,shortLabel:`CLI`,type:`cli`,command:`copilot`,isAvailable:e.copilot??!1,icon:(0,P.jsx)(E,{size:12})},{id:`copilot-vscode`,label:`VS Code with Copilot`,shortLabel:`VS Code`,type:`editor`,targetId:`vscode`,isAvailable:t.find(e=>e.id===`vscode`)?.available??!1,unavailableReason:`VS Code not detected`,icon:(0,P.jsx)(o,{size:12})}]}];function I({workspaces:e,workspaceStatuses:t,workspacesLoading:n=!1,onOpenWorkspace:r,onNewWorkspace:o,showToast:s}){let c=w(),l=k(),u=g(),[f,E]=(0,N.useState)(``),[I,L]=(0,N.useState)(!1),[R,z]=(0,N.useState)(``),B=e.find(e=>e.branchName===R)??e[0],V=e.filter(e=>`${e.branchName} ${e.description??``} ${e.repos.join(` `)}`.toLowerCase().includes(f.trim().toLowerCase())&&(!I||(t[e.branchName]?.changedFiles??0)>0)),[H,U]=(0,N.useState)(null),W=e.flatMap(e=>t[e.branchName]?[t[e.branchName]]:[]),G=W.reduce((e,t)=>e+(t.changedFiles||0),0),K=W.filter(e=>e.changedFiles>0).length,q=e.filter(e=>(e.mode??`worktree`)===`worktree`).length,oe=e.filter(e=>e.mode===`in-place`).length,J=(0,N.useMemo)(()=>{let t=new Map;return e.forEach(e=>{(e.repos||[]).forEach(e=>{let n=d(e),r=t.get(e);r?r.count+=1:t.set(e,{name:n,path:e,count:1})})}),Array.from(t.values())},[e]),Y=(0,N.useMemo)(()=>{let e={};return(c.data??[]).forEach(t=>{e[t.name]=t.detected}),e},[c.data]),X=(0,N.useMemo)(()=>l.data??[],[l.data]),Z=(0,N.useMemo)(()=>F.map(e=>{let t=e.getOptions({aiDetected:Y,launchTargets:X}),n=t.filter(e=>e.isAvailable),r=n[0]||t[0],i=n.length>0,a=`Not found`,o=`neutral`;return n.length>1?(a=`${n.map(e=>e.shortLabel).join(` & `)} Ready`,o=`success`):n.length===1&&(a=`${n[0].shortLabel} Ready`,o=`success`),{harness:e,allOptions:t,availableOptions:n,primaryOption:r,isAnyAvailable:i,statusLabel:a,statusTone:o}}),[Y,X]),se=async(e,t)=>{if(H)return;let n=B;if(!n){s?.(`No active workspace available to launch harness in.`,`error`);return}let r=`${e.id}:${t.id}`;U(r);try{t.type===`cli`?(await u.mutateAsync({workspaceId:n.branchName,assistant:e.id,command:t.command}),s?.(`Opened ${e.name} inside ContextSpace for ${n.branchName}`,`success`)):t.targetId&&(await T(`/api/workspace/${encodeURIComponent(n.branchName)}/launch`,{method:`POST`,body:JSON.stringify({targetId:t.targetId})}),s?.(`Opened ${n.branchName} in ${e.name} (${t.label})`,`success`))}catch(t){s?.(`Failed to launch ${e.name}: ${t instanceof Error?t.message:String(t)}`,`error`)}finally{U(null)}},Q=_(),{customTitles:$}=ie();return(0,P.jsxs)(`div`,{className:`mx-auto max-w-7xl space-y-6 pb-12 animate-fade-in`,children:[(0,P.jsxs)(`header`,{className:`flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-border/80 pb-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-mono text-muted-foreground mb-1`,children:[(0,P.jsx)(h,{size:14,className:`text-primary`}),(0,P.jsx)(`span`,{children:te}),(0,P.jsx)(`span`,{className:`opacity-40`,children:`/`}),(0,P.jsx)(`span`,{className:`text-foreground font-semibold`,children:`Cockpit Overview`})]}),(0,P.jsx)(`h1`,{className:`text-xl font-bold tracking-tight text-foreground`,children:`Multi-Worktree Process & Review Station`})]}),(0,P.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,P.jsxs)(a,{onClick:o,size:`sm`,className:`h-8 gap-1.5 px-3.5 bg-primary text-primary-foreground font-semibold hover:bg-primary/90 shadow-xs cursor-pointer text-xs`,children:[(0,P.jsx)(S,{size:14}),` New Worktree`]})})]}),(0,P.jsx)(`div`,{className:`grid grid-cols-2 gap-3 lg:grid-cols-4`,children:[{label:`Active Worktrees`,value:n?`—`:e.length,detail:`${q} isolated · ${oe} host`,icon:j},{label:`Review Queue`,value:W.length?G:`—`,detail:`${K} worktrees with diffs`,icon:b,isDirty:G>0},{label:`Tracked Repos`,value:n?`—`:J.length,detail:`Connected on local host`,icon:m},{label:`AI Assistants`,value:c.isLoading||l.isLoading?`—`:Z.filter(e=>e.isAnyAvailable).length,detail:`Antigravity, Claude, Codex`,icon:y}].map(({label:e,value:t,detail:n,icon:r,isDirty:a})=>(0,P.jsxs)(M,{className:`bg-card border border-border p-3.5 rounded-xl shadow-xs transition-colors hover:border-border/80`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 text-xs text-muted-foreground`,children:[(0,P.jsx)(`span`,{className:`font-medium`,children:e}),(0,P.jsx)(r,{size:14,className:a?`text-amber-400`:`text-primary`})]}),(0,P.jsx)(`div`,{className:i(`my-1.5 text-2xl font-bold tracking-tight tabular-nums`,a?`text-amber-400`:`text-foreground`),children:t}),(0,P.jsx)(`p`,{className:`text-[11px] text-muted-foreground font-mono`,children:n})]},e))}),(0,P.jsxs)(`div`,{className:`grid items-start gap-6 xl:grid-cols-[minmax(0,1fr)_320px]`,children:[(0,P.jsxs)(`section`,{className:`min-w-0`,"aria-labelledby":`workspaces-heading`,children:[(0,P.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center justify-between gap-3`,children:[(0,P.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,P.jsxs)(`span`,{id:`workspaces-heading`,className:`text-sm font-bold text-foreground`,children:[`Workspaces (`,V.length,`)`]})}),(0,P.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,P.jsxs)(`div`,{className:`relative`,children:[(0,P.jsx)(x,{size:13,className:`absolute left-2.5 top-2.5 text-muted-foreground pointer-events-none`}),(0,P.jsx)(`input`,{"aria-label":`Search workspaces`,value:f,onChange:e=>E(e.target.value),placeholder:`Filter worktrees or repos…`,className:`h-8 w-48 sm:w-64 rounded-lg border border-input bg-card pl-8 pr-3 text-xs outline-none focus:border-primary transition-colors text-foreground`})]}),(0,P.jsxs)(a,{variant:I?`secondary`:`outline`,size:`xs`,className:`h-8 rounded-lg text-xs font-medium cursor-pointer`,"aria-pressed":I,onClick:()=>L(!I),children:[(0,P.jsx)(b,{size:13}),` Diffs only`]})]})]}),n?(0,P.jsx)(M,{className:`p-10 border border-border bg-card`,children:(0,P.jsx)(D,{"aria-label":`Loading workspaces`,className:`mx-auto size-5 text-primary`})}):e.length?V.length?(0,P.jsx)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:V.map(e=>{let n=t[e.branchName],o=e.mode===`in-place`||!n?null:ee(n.syncStatus),s=(n?.changedFiles??0)>0,c=$[e.branchName]?.title||e.description||e.branchName,l=!!$[e.branchName]?.title;return(0,P.jsxs)(`div`,{className:`group rounded-xl border border-border bg-card p-4 transition-all hover:border-primary/50 flex flex-col justify-between gap-3 shadow-xs`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsxs)(`div`,{className:`flex items-start justify-between gap-2 mb-1.5`,children:[(0,P.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(`h3`,{className:`font-bold text-sm text-foreground truncate cursor-pointer hover:text-primary transition-colors`,onClick:()=>r(e.branchName),title:c,children:c})}),(0,P.jsx)(`span`,{className:i(`shrink-0 px-2 py-0.5 rounded text-[10px] font-mono font-semibold uppercase tracking-wider border`,e.mode===`in-place`?`border-border bg-secondary text-muted-foreground`:`border-emerald-500/25 bg-emerald-500/10 text-emerald-400`),children:e.mode===`in-place`?`in-place`:`isolated`})]}),(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 font-mono text-[11px] text-muted-foreground truncate mb-2`,children:[(0,P.jsx)(b,{size:12,className:`text-primary shrink-0`}),(0,P.jsx)(`span`,{className:`truncate font-semibold text-foreground/80`,children:e.branchName}),l&&e.description&&(0,P.jsxs)(`span`,{className:`text-[10px] text-muted-foreground/70 truncate`,children:[`(`,e.description,`)`]})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap items-center gap-1.5 mb-2.5`,children:e.repos.map(e=>(0,P.jsx)(`span`,{className:`rounded border border-border/60 bg-secondary/60 px-1.5 py-0.5 font-mono text-[10px] text-muted-foreground`,children:d(e)},e))}),(0,P.jsxs)(`div`,{className:`flex items-center gap-2 text-xs font-mono`,children:[s?(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5 text-amber-400 font-semibold`,children:[(0,P.jsx)(`span`,{className:`size-2 rounded-full bg-amber-400 animate-pulse shrink-0`}),n?.changedFiles,` modified files`]}):(0,P.jsxs)(`span`,{className:`flex items-center gap-1.5 text-emerald-400 font-medium`,children:[(0,P.jsx)(`span`,{className:`size-1.5 rounded-full bg-emerald-400 shrink-0`}),`Clean worktree`]}),o&&(0,P.jsxs)(`span`,{className:`text-muted-foreground text-[10px]`,children:[`• `,o.label]})]})]}),(0,P.jsxs)(`div`,{className:`border-t border-border/70 pt-3 flex items-center justify-between gap-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5`,children:[s&&(0,P.jsxs)(a,{size:`xs`,onClick:()=>Q(`/workspaces/${encodeURIComponent(e.branchName)}/changes`),className:`h-7 gap-1 px-2.5 bg-primary text-primary-foreground font-semibold text-xs hover:bg-primary/90 cursor-pointer`,title:`Open Monaco Diff Review`,children:[(0,P.jsx)(ae,{size:12}),` Review Diffs`]}),(0,P.jsx)(a,{size:`xs`,variant:`outline`,onClick:()=>r(e.branchName),className:`h-7 text-xs border-border hover:bg-accent cursor-pointer`,children:`Cockpit`})]}),(0,P.jsxs)(`button`,{type:`button`,onClick:()=>Q(`/workspaces/${encodeURIComponent(e.branchName)}/plan`),className:`text-[11px] text-muted-foreground hover:text-primary transition-colors flex items-center gap-1 cursor-pointer`,children:[`Plan `,(0,P.jsx)(p,{size:11})]})]})]},e.id)})}):(0,P.jsxs)(M,{className:`rounded-xl border border-border bg-card p-8 text-center`,children:[(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`No worktrees match your filter.`}),(0,P.jsx)(a,{variant:`ghost`,size:`xs`,className:`mt-2`,onClick:()=>{E(``),L(!1)},children:`Clear filter`})]}):(0,P.jsx)(M,{className:`rounded-xl border border-dashed border-border bg-card/50 p-8`,children:(0,P.jsxs)(A,{children:[(0,P.jsxs)(O,{children:[(0,P.jsx)(C,{variant:`icon`,children:(0,P.jsx)(j,{})}),(0,P.jsx)(v,{children:`No active worktrees`}),(0,P.jsx)(re,{children:`Create a worktree to start working on isolated features with dynamic plan steps.`})]}),(0,P.jsxs)(a,{onClick:o,className:`mt-4 bg-primary text-primary-foreground`,children:[(0,P.jsx)(S,{size:14}),` Create First Worktree`]})]})})]}),(0,P.jsxs)(`aside`,{className:`rounded-xl border border-border bg-card p-4 shadow-xs`,"aria-labelledby":`assistants-heading`,children:[(0,P.jsxs)(`div`,{className:`mb-4`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-1.5 text-[10px] font-mono font-bold uppercase tracking-wider text-primary mb-1`,children:[(0,P.jsx)(y,{size:12}),` AI Launch Station`]}),(0,P.jsx)(`h2`,{id:`assistants-heading`,className:`text-sm font-bold tracking-tight text-foreground`,children:`External Coding Harnesses`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Launch agents directly into the target worktree.`})]}),(0,P.jsx)(`label`,{className:`block text-[10px] font-mono uppercase font-bold text-muted-foreground mb-1.5`,htmlFor:`launch-workspace`,children:`Target Worktree`}),(0,P.jsxs)(`select`,{id:`launch-workspace`,value:B?.branchName??``,onChange:e=>z(e.target.value),disabled:!e.length||!!H,className:`mb-4 h-8 w-full rounded-md border border-input bg-secondary px-2 font-mono text-xs text-foreground focus-visible:outline-ring`,children:[!e.length&&(0,P.jsx)(`option`,{value:``,children:`Create a workspace first`}),e.map(e=>(0,P.jsx)(`option`,{value:e.branchName,children:$[e.branchName]?.title?`${$[e.branchName]?.title} (${e.branchName})`:e.branchName},e.id))]}),(0,P.jsx)(`div`,{className:`divide-y divide-border/60`,children:Z.map(({harness:e,availableOptions:t,isAnyAvailable:n,statusTone:r})=>(0,P.jsxs)(`div`,{className:`py-3 first:pt-0 last:pb-0`,children:[(0,P.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[e.icon,(0,P.jsx)(`h3`,{className:`text-xs font-semibold text-foreground`,children:e.name})]}),(0,P.jsx)(ne,{tone:r,children:c.isLoading||l.isLoading?`Checking`:c.isError||l.isError?`Check failed`:n?`Ready`:`Not detected`})]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:t.map(t=>(0,P.jsxs)(a,{variant:`outline`,size:`xs`,disabled:!!H||!B,onClick:()=>void se(e,t),title:`Launch ${e.name} in ${B?.branchName??`workspace`}`,className:`h-7 text-xs border-border hover:bg-accent cursor-pointer`,children:[H===`${e.id}:${t.id}`?(0,P.jsx)(D,{className:`size-3`}):t.icon,t.shortLabel,(0,P.jsx)(p,{size:10})]},t.id))})]},e.id))})]})]}),J.length>0&&(0,P.jsxs)(`section`,{className:`border-t border-border pt-4`,children:[(0,P.jsxs)(`div`,{className:`mb-2.5 flex items-center gap-2 text-xs font-mono font-medium text-muted-foreground`,children:[(0,P.jsx)(m,{size:13,className:`text-primary`}),` Tracked Repositories`]}),(0,P.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:J.map(e=>(0,P.jsxs)(`button`,{type:`button`,onClick:()=>{E(e.path),L(!1)},title:e.path,className:`flex items-center gap-2 rounded-lg border border-border bg-card px-3 py-1.5 font-mono text-xs transition-colors hover:border-primary/50 text-foreground cursor-pointer`,children:[(0,P.jsx)(j,{size:12,className:`text-primary`}),(0,P.jsx)(`span`,{children:e.name}),(0,P.jsxs)(`span`,{className:`rounded bg-secondary px-1.5 py-0.2 text-[10px] text-muted-foreground`,children:[e.count,` `,e.count===1?`worktree`:`worktrees`]})]},e.path))})]})]})}export{I as DashboardPage};
@@ -1 +1 @@
1
- import{t as e}from"./jsx-runtime-DE3RlOCf.js";import{t}from"./button-BrcP8Wxx.js";import{t as n}from"./circle-plus-D0tjHKM4.js";import{t as r}from"./brand-hHByyyzq.js";import{gn as i}from"./index-BRvfvR0q.js";var a=e();function o({config:e,onCreateWorkspace:o,onModifySettings:s}){return(0,a.jsxs)(`div`,{className:`max-w-4xl mx-auto animate-fade-in`,children:[(0,a.jsxs)(`header`,{className:`mb-10`,children:[(0,a.jsx)(`div`,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/10 text-primary border border-primary/20 text-xs font-semibold uppercase tracking-wider mb-4`,children:`Getting Started Guide`}),(0,a.jsxs)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground mb-2`,children:[`Welcome to `,r]}),(0,a.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[r,` orchestrates multi-repository developer environments. It combines isolated Git worktrees, automatic code analyzer sweeps, and background process running into a single dashboard.`]})]}),(0,a.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8 mb-10`,children:[(0,a.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm space-y-6`,children:[(0,a.jsxs)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:[r,` Workflows`]}),(0,a.jsxs)(`div`,{className:`flex gap-4`,children:[(0,a.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`1`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Configure Folders`}),(0,a.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Specify your Development folder (where repositories live) and Workspaces folder. These are currently set to:`,(0,a.jsx)(`code`,{className:`block mt-1 text-[10px] text-primary break-all`,children:e.devDir||`Not Configured`})]})]})]}),(0,a.jsxs)(`div`,{className:`flex gap-4`,children:[(0,a.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`2`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Build Workspaces`}),(0,a.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Choose repositories and feature branch. `,r,` checks out dependencies under a unified workspace directory using Git Worktrees, keeping original projects clean.`]})]})]}),(0,a.jsxs)(`div`,{className:`flex gap-4`,children:[(0,a.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`3`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Align AI Context`}),(0,a.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[r,` writes files like `,(0,a.jsx)(`code`,{children:`CLAUDE.md`}),`, `,(0,a.jsx)(`code`,{children:`.cursorrules`}),`, `,(0,a.jsx)(`code`,{children:`AGENTS.md`}),` prompting the LLM to inspect project relations and list key assumptions and questions before coding.`]})]})]})]}),(0,a.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm flex flex-col justify-between`,children:[(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:`Current Configuration`}),(0,a.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Dev Folder:`}),(0,a.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.devDir})]}),(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Workspaces Folder:`}),(0,a.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.workspacesDir})]}),(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Preferred AI:`}),(0,a.jsx)(`span`,{className:`text-primary font-semibold uppercase`,children:e.defaultAssistant||`None`})]}),(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Scan Depth:`}),(0,a.jsxs)(`span`,{className:`text-foreground font-semibold`,children:[e.scanDepth,` levels`]})]})]})]}),(0,a.jsxs)(`div`,{className:`pt-6 border-t border-border flex flex-col gap-2`,children:[(0,a.jsxs)(t,{className:`w-full gap-2`,onClick:o,children:[(0,a.jsx)(n,{size:14}),` Create a Workspace`]}),(0,a.jsxs)(t,{variant:`outline`,className:`w-full gap-2`,onClick:s,children:[(0,a.jsx)(i,{size:14,className:`text-muted-foreground`}),` Modify Settings`]})]})]})]})]})}export{o as GettingStartedPage};
1
+ import{t as e}from"./jsx-runtime-DE3RlOCf.js";import{t}from"./button-BrcP8Wxx.js";import{t as n}from"./circle-plus-D0tjHKM4.js";import{t as r}from"./brand-hHByyyzq.js";import{on as i}from"./index-D-sx2qJG.js";var a=e();function o({config:e,onCreateWorkspace:o,onModifySettings:s}){return(0,a.jsxs)(`div`,{className:`max-w-4xl mx-auto animate-fade-in`,children:[(0,a.jsxs)(`header`,{className:`mb-10`,children:[(0,a.jsx)(`div`,{className:`inline-flex items-center gap-1.5 px-3 py-1 rounded-full bg-primary/10 text-primary border border-primary/20 text-xs font-semibold uppercase tracking-wider mb-4`,children:`Getting Started Guide`}),(0,a.jsxs)(`h1`,{className:`text-3xl font-bold tracking-tight text-foreground mb-2`,children:[`Welcome to `,r]}),(0,a.jsxs)(`p`,{className:`text-sm text-muted-foreground`,children:[r,` orchestrates multi-repository developer environments. It combines isolated Git worktrees, automatic code analyzer sweeps, and background process running into a single dashboard.`]})]}),(0,a.jsxs)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 gap-8 mb-10`,children:[(0,a.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm space-y-6`,children:[(0,a.jsxs)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:[r,` Workflows`]}),(0,a.jsxs)(`div`,{className:`flex gap-4`,children:[(0,a.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`1`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Configure Folders`}),(0,a.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Specify your Development folder (where repositories live) and Workspaces folder. These are currently set to:`,(0,a.jsx)(`code`,{className:`block mt-1 text-[10px] text-primary break-all`,children:e.devDir||`Not Configured`})]})]})]}),(0,a.jsxs)(`div`,{className:`flex gap-4`,children:[(0,a.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`2`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Build Workspaces`}),(0,a.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[`Choose repositories and feature branch. `,r,` checks out dependencies under a unified workspace directory using Git Worktrees, keeping original projects clean.`]})]})]}),(0,a.jsxs)(`div`,{className:`flex gap-4`,children:[(0,a.jsx)(`div`,{className:`flex size-8 shrink-0 items-center justify-center rounded-full bg-primary/10 border border-primary/20 text-primary font-bold text-sm`,children:`3`}),(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Align AI Context`}),(0,a.jsxs)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:[r,` writes files like `,(0,a.jsx)(`code`,{children:`CLAUDE.md`}),`, `,(0,a.jsx)(`code`,{children:`.cursorrules`}),`, `,(0,a.jsx)(`code`,{children:`AGENTS.md`}),` prompting the LLM to inspect project relations and list key assumptions and questions before coding.`]})]})]})]}),(0,a.jsxs)(`div`,{className:`bg-card border border-border rounded-xl p-6 shadow-sm flex flex-col justify-between`,children:[(0,a.jsxs)(`div`,{children:[(0,a.jsx)(`h2`,{className:`text-lg font-semibold text-foreground mb-4`,children:`Current Configuration`}),(0,a.jsxs)(`div`,{className:`space-y-3 text-xs`,children:[(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Dev Folder:`}),(0,a.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.devDir})]}),(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Workspaces Folder:`}),(0,a.jsx)(`span`,{className:`text-foreground font-mono text-[10px] truncate max-w-[200px]`,children:e.workspacesDir})]}),(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5 border-b border-border`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Preferred AI:`}),(0,a.jsx)(`span`,{className:`text-primary font-semibold uppercase`,children:e.defaultAssistant||`None`})]}),(0,a.jsxs)(`div`,{className:`flex justify-between py-1.5`,children:[(0,a.jsx)(`span`,{className:`text-muted-foreground`,children:`Scan Depth:`}),(0,a.jsxs)(`span`,{className:`text-foreground font-semibold`,children:[e.scanDepth,` levels`]})]})]})]}),(0,a.jsxs)(`div`,{className:`pt-6 border-t border-border flex flex-col gap-2`,children:[(0,a.jsxs)(t,{className:`w-full gap-2`,onClick:o,children:[(0,a.jsx)(n,{size:14}),` Create a Workspace`]}),(0,a.jsxs)(t,{variant:`outline`,className:`w-full gap-2`,onClick:s,children:[(0,a.jsx)(i,{size:14,className:`text-muted-foreground`}),` Modify Settings`]})]})]})]})]})}export{o as GettingStartedPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{a as r,i,n as a,r as o,t as s}from"./monaco-DLwhzYMT.js";import{a as c,i as l,n as u,r as d,t as f}from"./WorkspacesPage-aSR6TyA2.js";var p=e(t(),1);a({id:`json`,extensions:[`.json`,`.bowerrc`,`.jshintrc`,`.jscsrc`,`.eslintrc`,`.babelrc`],aliases:[`JSON`,`json`],mimetypes:[`application/json`],loader:()=>Promise.resolve({conf:{comments:!1,brackets:[[`{`,`}`],[`[`,`]`]],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`"`,close:`"`}],surroundingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`"`,close:`"`}]},language:{defaultToken:``,tokenPostfix:`.json`,tokenizer:{root:[[/"([^"\\]|\\.)*"\s*(?=:)/,`type.identifier`],[/"([^"\\]|\\.)*"/,`string`],[/-?\d+(\.\d+)?([eE][+-]?\d+)?/,`number`],[/\b(true|false|null)\b/,`keyword`],[/[{}[\],]/,`delimiter`],{include:`@whitespace`}],whitespace:[[/\s+/,`white`]]}}})});var m={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,md:`markdown`,markdown:`markdown`,py:`python`,rs:`rust`,go:`go`,sh:`shell`,bash:`shell`,zsh:`shell`,ps1:`powershell`,yml:`yaml`,yaml:`yaml`,sql:`sql`,xml:`xml`,svg:`xml`,diff:`diff`,patch:`diff`,dockerfile:`dockerfile`,toml:`ini`,java:`java`,c:`c`,cpp:`cpp`,cs:`csharp`,rb:`ruby`,php:`php`};function h(e){if(!e)return`plaintext`;let t=e.split(`?`)[0].split(`#`)[0].split(/[/\\]/).pop()?.toLowerCase()||``;return t===`dockerfile`?`dockerfile`:t===`package.json`||t===`tsconfig.json`?`json`:m[t.split(`.`).pop()||``]||`plaintext`}var g=!1;function _(){g||typeof window>`u`||(window.MonacoEnvironment={getWorker(){return new s}},g=!0)}var v={ES3:0,ES5:1,ES2015:2,ES2016:3,ES2017:4,ES2018:5,ES2019:6,ES2020:7,ESNext:99,JSON:100,Latest:99},y={None:0,CommonJS:1,AMD:2,UMD:3,System:4,ES2015:5,ESNext:99},b={Classic:1,NodeJs:2},x={None:0,Preserve:1,React:2,ReactNative:3,ReactJSX:4,ReactJSXDev:5},S=class{_compilerOptions;_diagnosticsOptions;_modeConfiguration;constructor(e={},t={},n={}){this._compilerOptions=e,this._diagnosticsOptions=t,this._modeConfiguration=n}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions={...this._compilerOptions,...e||{}}}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions={...this._diagnosticsOptions,...e||{}}}getModeConfiguration(){return this._modeConfiguration}setModeConfiguration(e){this._modeConfiguration={...this._modeConfiguration,...e||{}}}},C=new S({allowNonTsExtensions:!0,target:v.ESNext},{noSemanticValidation:!0,noSyntaxValidation:!0},{}),w=new S({allowNonTsExtensions:!0,allowJs:!0,target:v.ESNext},{noSemanticValidation:!0,noSyntaxValidation:!0},{}),T=!1;function E(){if(T)return;let e={target:v.ESNext,moduleResolution:b.NodeJs,module:y.ESNext,jsx:x.ReactJSX,allowNonTsExtensions:!0,allowJs:!0,noEmit:!0};C.setCompilerOptions(e),w.setCompilerOptions(e);let t={completionItems:!1,hovers:!1,documentSymbols:!1,definitions:!1,references:!1,documentHighlights:!1,rename:!1,diagnostics:!1,documentRangeFormattingEdits:!1,signatureHelp:!1,onTypeFormattingEdits:!1,codeActions:!1,inlayHints:!1};if(C.setModeConfiguration(t),w.setModeConfiguration(t),C.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),w.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),typeof window<`u`){let e=window;e.monaco=e.monaco||{},e.monaco.languages=e.monaco.languages||{},e.monaco.languages.typescript={typescriptDefaults:C,javascriptDefaults:w,ScriptTarget:v,ModuleResolutionKind:b,ModuleKind:y,JsxEmit:x}}T=!0}var D=n();_(),E(),f(r);var O=({filePath:e,repoName:t=`workspace`,originalContent:n,modifiedContent:a,viewMode:s,ignoreWhitespace:f,height:m=480,targetLine:g,jumpNonce:_,onOpenFile:v,onLineSelect:y})=>{let b=(0,p.useRef)(null),x=(0,p.useRef)(null),S=(0,p.useRef)(null),C=(0,p.useRef)({original:null,modified:null});return(0,p.useEffect)(()=>{if(!x.current||!g||g<=0)return;let e=x.current.getModifiedEditor();e.revealLineInCenter(g),e.setPosition({lineNumber:g,column:1}),e.focus(),S.current||=e.createDecorationsCollection(),S.current.set([{range:new o(g,1,g,1),options:{isWholeLine:!0,className:`bg-primary/20 border-l-2 border-primary`}}])},[g,_]),(0,p.useEffect)(()=>{if(!b.current)return;let o=h(e),p=l(t,e,r),m=u(t,e,r),_=d(p,n,o,r)||i.createModel(n,o),S=d(m,a,o,r)||i.createModel(a,o);C.current={original:_,modified:S};let w=null;v&&(w=c(v,r));let T=document.documentElement.classList.contains(`dark`)||document.documentElement.getAttribute(`data-theme`)!==`light`,E=null,D=null,O=null;try{E=i.createDiffEditor(b.current,{readOnly:!0,renderSideBySide:s===`side-by-side`,ignoreTrimWhitespace:f,hideUnchangedRegions:{enabled:!1},renderIndicators:!0,originalEditable:!1,automaticLayout:!0,scrollBeyondLastLine:!1,minimap:{enabled:!0,maxColumn:60},scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8,alwaysConsumeMouseWheel:!1},lineNumbersMinChars:3,fontSize:12,fontFamily:`'JetBrains Mono', Consolas, Menlo, monospace`,theme:T?`vs-dark`:`vs`,contextmenu:!0}),E.setModel({original:_,modified:S}),x.current=E;let e=E.getModifiedEditor();D=e.onDidChangeCursorPosition(e=>{y?.(e.position.lineNumber)}),O=E.onDidUpdateDiff(()=>{g&&g>0&&(e.revealLineInCenter(g),e.setPosition({lineNumber:g,column:1}))}),g&&g>0&&(e.revealLineInCenter(g),e.setPosition({lineNumber:g,column:1}))}catch(e){console.error(`[MonacoDiffAdapter] Error initializing diff editor:`,e)}return()=>{O?.dispose(),D?.dispose(),w?.dispose(),E?.dispose(),x.current=null}},[e,t,n,a,s,f,v,y,g]),(0,D.jsx)(`div`,{ref:b,style:{height:typeof m==`number`?`${m}px`:m},className:`w-full rounded-lg overflow-hidden border border-border/70 bg-background`})};export{O as MonacoDiffAdapter};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{a as r,i,n as a,r as o,t as s}from"./monaco-DLwhzYMT.js";import{a as c,i as l,n as u,r as d,t as f}from"./WorkspacesPage-BuQTcejb.js";var p=e(t(),1);a({id:`json`,extensions:[`.json`,`.bowerrc`,`.jshintrc`,`.jscsrc`,`.eslintrc`,`.babelrc`],aliases:[`JSON`,`json`],mimetypes:[`application/json`],loader:()=>Promise.resolve({conf:{comments:!1,brackets:[[`{`,`}`],[`[`,`]`]],autoClosingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`"`,close:`"`}],surroundingPairs:[{open:`{`,close:`}`},{open:`[`,close:`]`},{open:`"`,close:`"`}]},language:{defaultToken:``,tokenPostfix:`.json`,tokenizer:{root:[[/"([^"\\]|\\.)*"\s*(?=:)/,`type.identifier`],[/"([^"\\]|\\.)*"/,`string`],[/-?\d+(\.\d+)?([eE][+-]?\d+)?/,`number`],[/\b(true|false|null)\b/,`keyword`],[/[{}[\],]/,`delimiter`],{include:`@whitespace`}],whitespace:[[/\s+/,`white`]]}}})});var m={ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,html:`html`,htm:`html`,css:`css`,scss:`scss`,less:`less`,md:`markdown`,markdown:`markdown`,py:`python`,rs:`rust`,go:`go`,sh:`shell`,bash:`shell`,zsh:`shell`,ps1:`powershell`,yml:`yaml`,yaml:`yaml`,sql:`sql`,xml:`xml`,svg:`xml`,diff:`diff`,patch:`diff`,dockerfile:`dockerfile`,toml:`ini`,java:`java`,c:`c`,cpp:`cpp`,cs:`csharp`,rb:`ruby`,php:`php`};function h(e){if(!e)return`plaintext`;let t=e.split(`?`)[0].split(`#`)[0].split(/[/\\]/).pop()?.toLowerCase()||``;return t===`dockerfile`?`dockerfile`:t===`package.json`||t===`tsconfig.json`?`json`:m[t.split(`.`).pop()||``]||`plaintext`}var g=!1;function _(){g||typeof window>`u`||(window.MonacoEnvironment={getWorker(){return new s}},g=!0)}var v={ES3:0,ES5:1,ES2015:2,ES2016:3,ES2017:4,ES2018:5,ES2019:6,ES2020:7,ESNext:99,JSON:100,Latest:99},y={None:0,CommonJS:1,AMD:2,UMD:3,System:4,ES2015:5,ESNext:99},b={Classic:1,NodeJs:2},x={None:0,Preserve:1,React:2,ReactNative:3,ReactJSX:4,ReactJSXDev:5},S=class{_compilerOptions;_diagnosticsOptions;_modeConfiguration;constructor(e={},t={},n={}){this._compilerOptions=e,this._diagnosticsOptions=t,this._modeConfiguration=n}getCompilerOptions(){return this._compilerOptions}setCompilerOptions(e){this._compilerOptions={...this._compilerOptions,...e||{}}}getDiagnosticsOptions(){return this._diagnosticsOptions}setDiagnosticsOptions(e){this._diagnosticsOptions={...this._diagnosticsOptions,...e||{}}}getModeConfiguration(){return this._modeConfiguration}setModeConfiguration(e){this._modeConfiguration={...this._modeConfiguration,...e||{}}}},C=new S({allowNonTsExtensions:!0,target:v.ESNext},{noSemanticValidation:!0,noSyntaxValidation:!0},{}),w=new S({allowNonTsExtensions:!0,allowJs:!0,target:v.ESNext},{noSemanticValidation:!0,noSyntaxValidation:!0},{}),T=!1;function E(){if(T)return;let e={target:v.ESNext,moduleResolution:b.NodeJs,module:y.ESNext,jsx:x.ReactJSX,allowNonTsExtensions:!0,allowJs:!0,noEmit:!0};C.setCompilerOptions(e),w.setCompilerOptions(e);let t={completionItems:!1,hovers:!1,documentSymbols:!1,definitions:!1,references:!1,documentHighlights:!1,rename:!1,diagnostics:!1,documentRangeFormattingEdits:!1,signatureHelp:!1,onTypeFormattingEdits:!1,codeActions:!1,inlayHints:!1};if(C.setModeConfiguration(t),w.setModeConfiguration(t),C.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),w.setDiagnosticsOptions({noSemanticValidation:!0,noSyntaxValidation:!0}),typeof window<`u`){let e=window;e.monaco=e.monaco||{},e.monaco.languages=e.monaco.languages||{},e.monaco.languages.typescript={typescriptDefaults:C,javascriptDefaults:w,ScriptTarget:v,ModuleResolutionKind:b,ModuleKind:y,JsxEmit:x}}T=!0}var D=n();_(),E(),f(r);var O=({filePath:e,repoName:t=`workspace`,originalContent:n,modifiedContent:a,viewMode:s,ignoreWhitespace:f,height:m=480,targetLine:g,jumpNonce:_,onOpenFile:v,onLineSelect:y})=>{let b=(0,p.useRef)(null),x=(0,p.useRef)(null),S=(0,p.useRef)(null),C=(0,p.useRef)({original:null,modified:null});return(0,p.useEffect)(()=>{if(!x.current||!g||g<=0)return;let e=x.current.getModifiedEditor();e.revealLineInCenter(g),e.setPosition({lineNumber:g,column:1}),e.focus(),S.current||=e.createDecorationsCollection(),S.current.set([{range:new o(g,1,g,1),options:{isWholeLine:!0,className:`bg-primary/20 border-l-2 border-primary`}}])},[g,_]),(0,p.useEffect)(()=>{if(!b.current)return;let o=h(e),p=l(t,e,r),m=u(t,e,r),_=d(p,n,o,r)||i.createModel(n,o),S=d(m,a,o,r)||i.createModel(a,o);C.current={original:_,modified:S};let w=null;v&&(w=c(v,r));let T=document.documentElement.classList.contains(`dark`)||document.documentElement.getAttribute(`data-theme`)!==`light`,E=null,D=null,O=null;try{E=i.createDiffEditor(b.current,{readOnly:!0,renderSideBySide:s===`side-by-side`,ignoreTrimWhitespace:f,hideUnchangedRegions:{enabled:!1},renderIndicators:!0,originalEditable:!1,automaticLayout:!0,scrollBeyondLastLine:!1,minimap:{enabled:!0,maxColumn:60},scrollbar:{verticalScrollbarSize:8,horizontalScrollbarSize:8,alwaysConsumeMouseWheel:!1},lineNumbersMinChars:3,fontSize:12,fontFamily:`'JetBrains Mono', Consolas, Menlo, monospace`,theme:T?`vs-dark`:`vs`,contextmenu:!0}),E.setModel({original:_,modified:S}),x.current=E;let e=E.getModifiedEditor();D=e.onDidChangeCursorPosition(e=>{y?.(e.position.lineNumber)}),O=E.onDidUpdateDiff(()=>{g&&g>0&&(e.revealLineInCenter(g),e.setPosition({lineNumber:g,column:1}))}),g&&g>0&&(e.revealLineInCenter(g),e.setPosition({lineNumber:g,column:1}))}catch(e){console.error(`[MonacoDiffAdapter] Error initializing diff editor:`,e)}return()=>{O?.dispose(),D?.dispose(),w?.dispose(),E?.dispose(),x.current=null}},[e,t,n,a,s,f,v,y,g]),(0,D.jsx)(`div`,{ref:b,style:{height:typeof m==`number`?`${m}px`:m},className:`w-full rounded-lg overflow-hidden border border-border/70 bg-background`})};export{O as MonacoDiffAdapter};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{n as r,t as i}from"./badge-BObbahyU.js";import{t as a}from"./button-BrcP8Wxx.js";import{n as o,t as s}from"./ScaffoldRepoInline-C0aEuaen.js";import{t as c}from"./trash-2-BrrLX4tD.js";import{G as l,N as u,R as d,Y as f,Yt as p,_ as m,a as h,at as g,b as _,dn as v,fn as y,ft as b,g as x,h as S,i as ee,m as C,n as w,p as T,pn as E,r as D,t as O,v as k,xn as A,y as j}from"./index-D-sx2qJG.js";import{a as M,i as N,n as P,o as F,r as I,s as L,t as te}from"./alert-dialog-BQTrpDEB.js";var R=e(t(),1),z=n(),B={editingId:null,name:``,description:``,repoPaths:[]};function V(){let e=p(),t=l(),n=f(),V=b(),H=u(),U=g(),W=d(),[G,K]=(0,R.useState)(null),[q,J]=(0,R.useState)(null),[Y,X]=(0,R.useState)(null),Z=(0,R.useMemo)(()=>{let e={};for(let t of V.data??[])t.projectId&&(e[t.projectId]=(e[t.projectId]??0)+1);return e},[V.data]),Q=()=>{J(null),K(B)},ne=e=>{J(null),K({editingId:e.id,name:e.name,description:e.description??``,repoPaths:e.repos.map(e=>e.path)})},re=e=>{K(t=>t&&{...t,repoPaths:t.repoPaths.includes(e.path)?t.repoPaths.filter(t=>t!==e.path):[...t.repoPaths,e.path]})},ie=async()=>{if(G){J(null);try{G.editingId?await U.mutateAsync({id:G.editingId,name:G.name,description:G.description||null,repos:G.repoPaths}):await H.mutateAsync({name:G.name,description:G.description||void 0,repos:G.repoPaths}),K(null)}catch(e){J(e instanceof Error?e.message:String(e))}}},ae=async()=>{if(Y)try{await W.mutateAsync(Y.id)}finally{X(null)}},oe=!!(G&&G.name.trim()&&G.repoPaths.length>0),$=H.isPending||U.isPending;return(0,z.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,z.jsxs)(`header`,{className:`mb-6 flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-border/70 pb-4`,children:[(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`h1`,{className:`text-xl font-bold tracking-tight text-foreground`,children:`Projects`}),(0,z.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Named groups of repositories you start work from. Registered once, reused for every feature workspace.`})]}),(0,z.jsxs)(a,{onClick:Q,className:`gap-1.5 shadow-sm`,children:[(0,z.jsx)(v,{size:15}),` New project`]})]}),t.isLoading?(0,z.jsx)(`div`,{className:`flex justify-center py-20`,children:(0,z.jsx)(T,{className:`size-6`})}):(t.data??[]).length===0?(0,z.jsxs)(O,{className:`border border-border border-dashed`,children:[(0,z.jsxs)(D,{children:[(0,z.jsx)(ee,{variant:`icon`,children:(0,z.jsx)(A,{})}),(0,z.jsx)(h,{children:`No projects yet`}),(0,z.jsx)(w,{children:`Register your first project to start work without re-picking repositories every time.`})]}),(0,z.jsxs)(a,{onClick:Q,children:[(0,z.jsx)(v,{}),` New project`]})]}):(0,z.jsx)(`ul`,{className:`flex flex-col gap-3`,children:(t.data??[]).map(t=>(0,z.jsx)(`li`,{className:`rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-4 transition-all duration-200 hover:border-primary/40 hover:shadow-xs`,children:(0,z.jsxs)(`div`,{className:`flex items-start justify-between gap-4`,children:[(0,z.jsxs)(`div`,{className:`min-w-0`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(`h2`,{className:`truncate text-sm font-semibold`,children:t.name}),(Z[t.id]??0)>0&&(0,z.jsxs)(i,{variant:`secondary`,children:[Z[t.id],` workspace`,Z[t.id]===1?``:`s`]})]}),t.description&&(0,z.jsx)(`p`,{className:`mt-0.5 truncate text-sm text-muted-foreground`,children:t.description}),(0,z.jsx)(`ul`,{className:`mt-2 flex flex-col gap-0.5`,children:t.repos.map(e=>(0,z.jsxs)(`li`,{className:`truncate font-mono text-xs text-muted-foreground`,children:[e.path,(0,z.jsxs)(`span`,{className:`ml-2 text-muted-foreground/60`,children:[`[`,e.defaultBranch,`]`]})]},e.path))})]}),(0,z.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1.5`,children:[(0,z.jsxs)(a,{size:`sm`,onClick:()=>e(`/new?project=${encodeURIComponent(t.id)}`),children:[(0,z.jsx)(y,{}),` Start work`]}),(0,z.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Edit ${t.name}`,onClick:()=>ne(t),children:(0,z.jsx)(E,{})}),(0,z.jsx)(a,{size:`icon-sm`,variant:`ghost`,"aria-label":`Remove ${t.name}`,onClick:()=>X(t),children:(0,z.jsx)(c,{})})]})]})},t.id))}),(0,z.jsx)(C,{open:G!==null,onOpenChange:e=>!e&&K(null),children:(0,z.jsxs)(j,{className:`max-w-lg`,children:[(0,z.jsxs)(m,{children:[(0,z.jsx)(_,{children:G?.editingId?`Edit project`:`New project`}),(0,z.jsx)(S,{children:`A project is a reusable group of source repositories. Removing one later never touches disk.`})]}),(0,z.jsxs)(k,{className:`space-y-4`,children:[(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Name`}),(0,z.jsx)(r,{value:G?.name??``,onChange:e=>K(t=>t&&{...t,name:e.target.value}),placeholder:`e.g. Acme Billing`,autoFocus:!0})]}),(0,z.jsxs)(`label`,{className:`block`,children:[(0,z.jsxs)(`span`,{className:`mb-1 block text-sm font-medium`,children:[`Description `,(0,z.jsx)(`span`,{className:`font-normal text-muted-foreground`,children:`(optional)`})]}),(0,z.jsx)(r,{value:G?.description??``,onChange:e=>K(t=>t&&{...t,description:e.target.value}),placeholder:`What this group of repos is for`})]}),(0,z.jsxs)(`div`,{children:[(0,z.jsx)(`span`,{className:`mb-1 block text-sm font-medium`,children:`Repositories`}),(0,z.jsx)(o,{repos:n.data??[],selectedPaths:G?.repoPaths??[],onToggle:re,loading:n.isLoading,emptyHint:`No repositories found in your dev directory.`}),(0,z.jsx)(s,{onCreated:e=>K(t=>t&&{...t,repoPaths:[...t.repoPaths,e.path]})})]}),q&&(0,z.jsx)(`p`,{className:`text-sm text-destructive-foreground`,children:q})]}),(0,z.jsxs)(x,{children:[(0,z.jsx)(a,{variant:`outline`,onClick:()=>K(null),children:`Cancel`}),(0,z.jsxs)(a,{onClick:ie,disabled:!oe||$,children:[$?(0,z.jsx)(T,{}):null,G?.editingId?`Save changes`:`Create project`]})]})]})}),(0,z.jsx)(te,{open:Y!==null,onOpenChange:e=>!e&&X(null),children:(0,z.jsxs)(F,{children:[(0,z.jsxs)(M,{children:[(0,z.jsxs)(L,{children:[`Remove “`,Y?.name,`”?`]}),(0,z.jsx)(I,{children:`This only removes the project from the registry — repositories and workspaces on disk are not touched.`})]}),(0,z.jsxs)(N,{children:[(0,z.jsx)(P,{render:(0,z.jsx)(a,{variant:`outline`,children:`Cancel`})}),(0,z.jsxs)(a,{variant:`destructive`,onClick:ae,disabled:W.isPending,children:[W.isPending?(0,z.jsx)(T,{}):null,`Remove project`]})]})]})})]})}export{V as ProjectsPage};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{En as r,Jn as i,Kt as a,Ln as o,Wt as s,Xt as c,Yt as l,_n as u,bt as d,c as ee,i as f,l as p,n as m,nn as h,o as g,rn as te,s as ne,sn as re,xt as ie}from"./badge-BObbahyU.js";import{c as ae,d as oe,f as se,h as ce,i as le,l as ue,m as _,o as de,p as fe,t as v}from"./button-BrcP8Wxx.js";import{t as pe}from"./useValueChanged-DfJmRF2P.js";import{t as me}from"./useAriaLabelledBy-DAWGcnTk.js";import{M as he,d as y,u as b,vn as ge}from"./index-BRvfvR0q.js";var x=ce(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),S=e(t(),1),C=S.createContext({disabled:!1});function _e(){return S.useContext(C)}function ve(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function ye(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...p}}var w=S.createContext(void 0);function be(){return S.useContext(w)}var xe=S.createContext(void 0);function T(){let e=S.useContext(xe);if(e===void 0)throw Error(fe(14));return e}var E=n(),Se=`data-parent`,Ce=S.forwardRef(function(e,t){let{checked:n,className:i,defaultChecked:a=!1,"aria-labelledby":s,disabled:p=!1,form:m,id:ce,indeterminate:_=!1,inputRef:fe,name:v,onCheckedChange:he,parent:y=!1,readOnly:b=!1,render:ge,required:x=!1,uncheckedValue:C,value:w,nativeButton:T=!1,style:Ce,...D}=e,{clearErrors:O}=ne(),{disabled:k,name:A,setDirty:we,setFilled:j,setFocused:M,setTouched:Te,state:N,validationMode:Ee,validityData:De,validation:Oe}=ee(),ke=_e(),{labelId:Ae,controlId:je,registerControlId:P,getDescriptionProps:F}=g(),I=be(),L=I?.allValues===void 0?void 0:I.parent,R=L!==void 0,z=k||ke.disabled||I?.disabled||p,B=A??v,V=w??B,Me=c(),Ne=c(),H=ce||je;R&&(y?H=Ne:V===void 0?H||=Ne:H=`${L.id}-${V}`);let U={};R&&(y?U=L.getParentProps():V!==void 0&&(U=L.getChildProps(V)));let{checked:Pe=n,indeterminate:Fe=_,onCheckedChange:Ie,...Le}=U,W=I?.value,G=S.useRef(null),K=se(()=>Symbol()),q=S.useRef(!1),{getButtonProps:Re,buttonRef:ze}=h({disabled:z,native:T}),J=I?.validation??Oe,[Y,Be]=r({controlled:V!==void 0&&W!==void 0&&!y?W.includes(V):Pe,default:a,name:`Checkbox`,state:`checked`}),X=R?!!Pe:Y,Z=R&&Fe||_;re(()=>{P!==ue&&(q.current=!0,P(K.current,H))},[H,P,K]),S.useEffect(()=>{let e=K.current;return()=>{!q.current||P===ue||(q.current=!1,P(e,void 0))}},[P,K]),f(G,Me,Y,void 0,!I&&!z,v);let Q=S.useRef(null),Ve=J.registerInput,He=I?V:void 0,Ue=S.useCallback(e=>Ve(e,{controlRef:G,value:He}),[Ve,He]),We=oe(fe,Q,y?void 0:Ue),Ge=me(s,Ae,Q,!T,H??void 0);re(()=>{Q.current&&(Q.current.indeterminate=Z,Y&&j(!0))},[Y,Z,j]),pe(Y,()=>{I||(O(B),j(Y),we(Y!==De.initialValue),J.change(Y))});let Ke=de({checked:Y,disabled:z,form:m,name:y?void 0:B,id:T?void 0:H??void 0,required:x,ref:We,style:B?ie:d,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(b){e.preventDefault();return}let t=e.currentTarget.checked,n=l(o,e.nativeEvent);if(he?.(t,n),!n.isCanceled&&(Ie?.(t,n),!n.isCanceled&&(Be(t),V!==void 0&&I!==void 0&&!y&&!R))){let e=t?[...I.value,V]:I.value.filter(e=>e!==V);I.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){G.current?.focus()}},w===void 0?ae:{value:(I?Y&&w:w)||``},F,e=>J.getValidationProps(z,e));S.useEffect(()=>{if(!L||V===void 0)return;let e=L.disabledStatesRef.current;return e.set(V,z),()=>{e.delete(V)}},[L,z,V]);let $=S.useMemo(()=>({...N,checked:X,disabled:z,readOnly:b,required:x,indeterminate:Z}),[N,X,z,b,x,Z]),qe=ye($),Je=le(`span`,e,{state:$,ref:[ze,G,t],props:[{id:T?H??void 0:Me,role:`checkbox`,"aria-checked":Z?`mixed`:X,"aria-readonly":b||void 0,"aria-required":x||void 0,"aria-labelledby":Ge,[Se]:y?``:void 0,onFocus(){z||M(!0)},onBlur(){let e=Q.current;e&&(Te(!0),M(!1),Ee===`onBlur`&&J.commit(I?W:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),u(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||ve(t)?.click()})},onClick(e){if(b||z)return;e.preventDefault();let t=Q.current;t&&te(t,e)}},D,Le,Re,F,e=>J.getValidationProps(z,e)],stateAttributesMapping:qe});return(0,E.jsxs)(xe.Provider,{value:$,children:[Je,!Y&&!I&&B&&!y&&C!==void 0&&(0,E.jsx)(`input`,{type:`hidden`,form:m,name:B,value:C,disabled:z}),(0,E.jsx)(`input`,{...Ke,suppressHydrationWarning:!0})]})}),D=S.forwardRef(function(e,t){let{render:n,className:r,style:o,keepMounted:c=!1,...l}=e,u=T(),d=u.checked||u.indeterminate,{mounted:ee,transitionStatus:f,setMounted:p}=a(d),m=S.useRef(null),h={...u,transitionStatus:f};s({open:d,ref:m,onComplete(){d||p(!1)}});let g={...ye(u),...i},te=c||ee,ne=le(`span`,e,{ref:[t,m],state:h,stateAttributesMapping:g,props:l});return te?ne:null});function O({className:e,...t}){return(0,E.jsx)(Ce,{className:_(`relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none`,e),"data-slot":`checkbox`,...t,children:(0,E.jsx)(D,{className:`-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground`,"data-slot":`checkbox-indicator`,render:(e,t)=>(0,E.jsx)(`span`,{...e,children:t.indeterminate?(0,E.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,E.jsx)(`path`,{d:`M5.252 12h13.496`})}):(0,E.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,E.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})})})})}function k({repos:e,selectedPaths:t,onToggle:n,loading:r,emptyHint:i,className:a,freshnessMap:o}){let[s,c]=(0,S.useState)(``),l=(0,S.useMemo)(()=>{let t=s.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,s]);return(0,E.jsxs)(`div`,{className:_(`flex flex-col gap-2`,a),children:[(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(ge,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,E.jsx)(m,{value:s,onChange:e=>c(e.target.value),placeholder:`Filter repositories…`,className:`pl-8`,"aria-label":`Filter repositories`})]}),(0,E.jsx)(`div`,{className:`max-h-56 overflow-y-auto rounded-lg border border-border`,children:r?(0,E.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Scanning for repositories…`}):l.length===0?(0,E.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:i??`No repositories found.`}):(0,E.jsx)(`ul`,{className:`divide-y divide-border`,children:l.map(e=>{let r=t.includes(e.path),i=o?.[e.path];return(0,E.jsx)(`li`,{children:(0,E.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 px-3 py-2 hover:bg-accent`,children:[(0,E.jsx)(O,{checked:r,onCheckedChange:()=>n(e),"aria-label":e.name}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,E.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[i&&(0,E.jsx)(b,{tone:i.status===`up-to-date`?`success`:i.status===`behind`?`warning`:i.status===`diverged`?`danger`:i.status===`ahead`?`info`:`neutral`,title:i.message,children:i.status===`behind`?`↓ ${i.behind} behind`:i.status===`up-to-date`?`Up to date`:i.status===`diverged`?`Diverged`:i.status===`ahead`?`↑ ${i.ahead} ahead`:`Local`}),(0,E.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]})]})},e.path)})})})]})}function A({onCreated:e}){let[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),s=he(),c=async()=>{o(null);try{let{repo:t}=await s.mutateAsync(r.trim());i(``),n(!1),e(t)}catch(e){o(e instanceof Error?e.message:String(e))}};return t?(0,E.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(m,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&r.trim()&&c(),placeholder:`new-repo-name`,className:`h-7 font-mono text-xs`,"aria-label":`New repository name`,autoFocus:!0}),(0,E.jsxs)(v,{size:`xs`,onClick:c,disabled:!r.trim()||s.isPending,children:[s.isPending?(0,E.jsx)(y,{}):null,`Create`]}),(0,E.jsx)(v,{size:`xs`,variant:`ghost`,onClick:()=>{n(!1),o(null)},children:`Cancel`})]}),a&&(0,E.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:a})]}):(0,E.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`mt-1.5 inline-flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,E.jsx)(x,{className:`size-3.5`}),` Scaffold a brand-new repository`]})}export{k as n,O as r,A as t};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{En as r,Jn as i,Kt as a,Ln as o,Wt as s,Xt as c,Yt as l,_n as u,bt as d,c as ee,i as f,l as p,n as m,nn as h,o as g,rn as te,s as ne,sn as re,xt as ie}from"./badge-BObbahyU.js";import{c as ae,d as oe,f as se,h as ce,i as le,l as ue,m as _,o as de,p as fe,t as v}from"./button-BrcP8Wxx.js";import{t as pe}from"./useValueChanged-DfJmRF2P.js";import{t as me}from"./useAriaLabelledBy-DAWGcnTk.js";import{P as he,cn as y,f as b,p as ge}from"./index-D-sx2qJG.js";var x=ce(`folder-plus`,[[`path`,{d:`M12 10v6`,key:`1bos4e`}],[`path`,{d:`M9 13h6`,key:`1uhe8q`}],[`path`,{d:`M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z`,key:`1kt360`}]]),S=e(t(),1),C=S.createContext({disabled:!1});function _e(){return S.useContext(C)}function ve(e){if(!e)return null;for(let t of e.elements){let e=t.tagName;if(e===`BUTTON`||e===`INPUT`){let e=t;if(e.type===`submit`)return e}}return null}function ye(e){return{checked(t){return e.indeterminate?{}:t?{"data-checked":``}:{"data-unchecked":``}},...p}}var w=S.createContext(void 0);function be(){return S.useContext(w)}var xe=S.createContext(void 0);function T(){let e=S.useContext(xe);if(e===void 0)throw Error(fe(14));return e}var E=n(),Se=`data-parent`,Ce=S.forwardRef(function(e,t){let{checked:n,className:i,defaultChecked:a=!1,"aria-labelledby":s,disabled:p=!1,form:m,id:ce,indeterminate:_=!1,inputRef:fe,name:v,onCheckedChange:he,parent:y=!1,readOnly:b=!1,render:ge,required:x=!1,uncheckedValue:C,value:w,nativeButton:T=!1,style:Ce,...D}=e,{clearErrors:O}=ne(),{disabled:k,name:A,setDirty:we,setFilled:j,setFocused:M,setTouched:Te,state:N,validationMode:Ee,validityData:De,validation:Oe}=ee(),ke=_e(),{labelId:Ae,controlId:je,registerControlId:P,getDescriptionProps:F}=g(),I=be(),L=I?.allValues===void 0?void 0:I.parent,R=L!==void 0,z=k||ke.disabled||I?.disabled||p,B=A??v,V=w??B,Me=c(),Ne=c(),H=ce||je;R&&(y?H=Ne:V===void 0?H||=Ne:H=`${L.id}-${V}`);let U={};R&&(y?U=L.getParentProps():V!==void 0&&(U=L.getChildProps(V)));let{checked:Pe=n,indeterminate:Fe=_,onCheckedChange:Ie,...Le}=U,W=I?.value,G=S.useRef(null),K=se(()=>Symbol()),q=S.useRef(!1),{getButtonProps:Re,buttonRef:ze}=h({disabled:z,native:T}),J=I?.validation??Oe,[Y,Be]=r({controlled:V!==void 0&&W!==void 0&&!y?W.includes(V):Pe,default:a,name:`Checkbox`,state:`checked`}),X=R?!!Pe:Y,Z=R&&Fe||_;re(()=>{P!==ue&&(q.current=!0,P(K.current,H))},[H,P,K]),S.useEffect(()=>{let e=K.current;return()=>{!q.current||P===ue||(q.current=!1,P(e,void 0))}},[P,K]),f(G,Me,Y,void 0,!I&&!z,v);let Q=S.useRef(null),Ve=J.registerInput,He=I?V:void 0,Ue=S.useCallback(e=>Ve(e,{controlRef:G,value:He}),[Ve,He]),We=oe(fe,Q,y?void 0:Ue),Ge=me(s,Ae,Q,!T,H??void 0);re(()=>{Q.current&&(Q.current.indeterminate=Z,Y&&j(!0))},[Y,Z,j]),pe(Y,()=>{I||(O(B),j(Y),we(Y!==De.initialValue),J.change(Y))});let Ke=de({checked:Y,disabled:z,form:m,name:y?void 0:B,id:T?void 0:H??void 0,required:x,ref:We,style:B?ie:d,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(b){e.preventDefault();return}let t=e.currentTarget.checked,n=l(o,e.nativeEvent);if(he?.(t,n),!n.isCanceled&&(Ie?.(t,n),!n.isCanceled&&(Be(t),V!==void 0&&I!==void 0&&!y&&!R))){let e=t?[...I.value,V]:I.value.filter(e=>e!==V);I.setValue(e,n)}},onClick(e){e.stopPropagation()},onFocus(){G.current?.focus()}},w===void 0?ae:{value:(I?Y&&w:w)||``},F,e=>J.getValidationProps(z,e));S.useEffect(()=>{if(!L||V===void 0)return;let e=L.disabledStatesRef.current;return e.set(V,z),()=>{e.delete(V)}},[L,z,V]);let $=S.useMemo(()=>({...N,checked:X,disabled:z,readOnly:b,required:x,indeterminate:Z}),[N,X,z,b,x,Z]),qe=ye($),Je=le(`span`,e,{state:$,ref:[ze,G,t],props:[{id:T?H??void 0:Me,role:`checkbox`,"aria-checked":Z?`mixed`:X,"aria-readonly":b||void 0,"aria-required":x||void 0,"aria-labelledby":Ge,[Se]:y?``:void 0,onFocus(){z||M(!0)},onBlur(){let e=Q.current;e&&(Te(!0),M(!1),Ee===`onBlur`&&J.commit(I?W:e.checked))},onKeyDown(e){if(e.key!==`Enter`||(e.preventBaseUIHandler(),e.defaultPrevented))return;let t=Q.current?.form??null,n=e.currentTarget,r=e.nativeEvent,i=e.preventDefault,a=r.preventDefault,o=!1;e.preventDefault=()=>{o=!0,i.call(e)},r.preventDefault=()=>{o=!0,a.call(r)},a.call(r),u(n).queueMicrotask(()=>{e.preventDefault=i,r.preventDefault=a,o||ve(t)?.click()})},onClick(e){if(b||z)return;e.preventDefault();let t=Q.current;t&&te(t,e)}},D,Le,Re,F,e=>J.getValidationProps(z,e)],stateAttributesMapping:qe});return(0,E.jsxs)(xe.Provider,{value:$,children:[Je,!Y&&!I&&B&&!y&&C!==void 0&&(0,E.jsx)(`input`,{type:`hidden`,form:m,name:B,value:C,disabled:z}),(0,E.jsx)(`input`,{...Ke,suppressHydrationWarning:!0})]})}),D=S.forwardRef(function(e,t){let{render:n,className:r,style:o,keepMounted:c=!1,...l}=e,u=T(),d=u.checked||u.indeterminate,{mounted:ee,transitionStatus:f,setMounted:p}=a(d),m=S.useRef(null),h={...u,transitionStatus:f};s({open:d,ref:m,onComplete(){d||p(!1)}});let g={...ye(u),...i},te=c||ee,ne=le(`span`,e,{ref:[t,m],state:h,stateAttributesMapping:g,props:l});return te?ne:null});function O({className:e,...t}){return(0,E.jsx)(Ce,{className:_(`relative inline-flex size-4.5 shrink-0 items-center justify-center rounded-[.25rem] border border-input bg-background not-dark:bg-clip-padding shadow-xs/5 outline-none ring-ring transition-shadow before:pointer-events-none before:absolute before:inset-0 before:rounded-[3px] not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_1px_--theme(--color-black/4%)] focus-visible:ring-2 focus-visible:ring-offset-1 focus-visible:ring-offset-background aria-invalid:border-destructive/36 focus-visible:aria-invalid:border-destructive/64 focus-visible:aria-invalid:ring-destructive/48 data-disabled:opacity-64 sm:size-4 dark:not-data-checked:bg-input/32 dark:aria-invalid:ring-destructive/24 dark:not-data-disabled:not-data-checked:not-aria-invalid:before:shadow-[0_-1px_--theme(--color-white/6%)] [[data-disabled],[data-checked],[aria-invalid]]:shadow-none`,e),"data-slot":`checkbox`,...t,children:(0,E.jsx)(D,{className:`-inset-px absolute flex items-center justify-center rounded-[.25rem] text-primary-foreground data-unchecked:hidden data-checked:bg-primary data-indeterminate:text-foreground`,"data-slot":`checkbox-indicator`,render:(e,t)=>(0,E.jsx)(`span`,{...e,children:t.indeterminate?(0,E.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,E.jsx)(`path`,{d:`M5.252 12h13.496`})}):(0,E.jsx)(`svg`,{className:`size-3.5 sm:size-3`,fill:`none`,height:`24`,stroke:`currentColor`,strokeLinecap:`round`,strokeLinejoin:`round`,strokeWidth:`3`,viewBox:`0 0 24 24`,width:`24`,xmlns:`http://www.w3.org/2000/svg`,children:(0,E.jsx)(`path`,{d:`M5.252 12.7 10.2 18.63 18.748 5.37`})})})})})}function k({repos:e,selectedPaths:t,onToggle:n,loading:r,emptyHint:i,className:a,freshnessMap:o}){let[s,c]=(0,S.useState)(``),l=(0,S.useMemo)(()=>{let t=s.trim().toLowerCase();return t?e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)):e},[e,s]);return(0,E.jsxs)(`div`,{className:_(`flex flex-col gap-2`,a),children:[(0,E.jsxs)(`div`,{className:`relative`,children:[(0,E.jsx)(y,{className:`absolute top-1/2 left-2.5 size-4 -translate-y-1/2 text-muted-foreground`}),(0,E.jsx)(m,{value:s,onChange:e=>c(e.target.value),placeholder:`Filter repositories…`,className:`pl-8`,"aria-label":`Filter repositories`})]}),(0,E.jsx)(`div`,{className:`max-h-56 overflow-y-auto rounded-lg border border-border`,children:r?(0,E.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:`Scanning for repositories…`}):l.length===0?(0,E.jsx)(`p`,{className:`p-3 text-sm text-muted-foreground`,children:i??`No repositories found.`}):(0,E.jsx)(`ul`,{className:`divide-y divide-border`,children:l.map(e=>{let r=t.includes(e.path),i=o?.[e.path];return(0,E.jsx)(`li`,{children:(0,E.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-3 px-3 py-2 hover:bg-accent`,children:[(0,E.jsx)(O,{checked:r,onCheckedChange:()=>n(e),"aria-label":e.name}),(0,E.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,E.jsx)(`span`,{className:`block truncate text-sm font-medium`,children:e.name}),(0,E.jsx)(`span`,{className:`block truncate font-mono text-xs text-muted-foreground`,children:e.path})]}),(0,E.jsxs)(`div`,{className:`flex shrink-0 items-center gap-2`,children:[i&&(0,E.jsx)(b,{tone:i.status===`up-to-date`?`success`:i.status===`behind`?`warning`:i.status===`diverged`?`danger`:i.status===`ahead`?`info`:`neutral`,title:i.message,children:i.status===`behind`?`↓ ${i.behind} behind`:i.status===`up-to-date`?`Up to date`:i.status===`diverged`?`Diverged`:i.status===`ahead`?`↑ ${i.ahead} ahead`:`Local`}),(0,E.jsx)(`span`,{className:`font-mono text-xs text-muted-foreground`,children:e.defaultBranch})]})]})},e.path)})})})]})}function A({onCreated:e}){let[t,n]=(0,S.useState)(!1),[r,i]=(0,S.useState)(``),[a,o]=(0,S.useState)(null),s=he(),c=async()=>{o(null);try{let{repo:t}=await s.mutateAsync(r.trim());i(``),n(!1),e(t)}catch(e){o(e instanceof Error?e.message:String(e))}};return t?(0,E.jsxs)(`div`,{className:`mt-1.5 flex flex-col gap-1.5`,children:[(0,E.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,E.jsx)(m,{value:r,onChange:e=>i(e.target.value),onKeyDown:e=>e.key===`Enter`&&r.trim()&&c(),placeholder:`new-repo-name`,className:`h-7 font-mono text-xs`,"aria-label":`New repository name`,autoFocus:!0}),(0,E.jsxs)(v,{size:`xs`,onClick:c,disabled:!r.trim()||s.isPending,children:[s.isPending?(0,E.jsx)(ge,{}):null,`Create`]}),(0,E.jsx)(v,{size:`xs`,variant:`ghost`,onClick:()=>{n(!1),o(null)},children:`Cancel`})]}),a&&(0,E.jsx)(`p`,{className:`text-xs text-destructive-foreground`,children:a})]}):(0,E.jsxs)(`button`,{type:`button`,onClick:()=>n(!0),className:`mt-1.5 inline-flex cursor-pointer items-center gap-1.5 text-xs text-muted-foreground hover:text-foreground`,children:[(0,E.jsx)(x,{className:`size-3.5`}),` Scaffold a brand-new repository`]})}export{k as n,O as r,A as t};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{En as r,Ln as i,Xt as a,Yt as o,a as s,bt as c,c as l,i as u,l as d,n as f,nn as p,o as m,rn as h,s as ee,sn as te,t as g,xt as ne}from"./badge-BObbahyU.js";import{c as re,d as ie,i as _,m as v,p as y,t as b}from"./button-BrcP8Wxx.js";import{t as ae}from"./useValueChanged-DfJmRF2P.js";import{t as oe}from"./useAriaLabelledBy-DAWGcnTk.js";import{C as x,Ln as S,Pt as C,S as w,b as T,bn as E,d as D,dn as O,w as k,x as A}from"./index-BRvfvR0q.js";import{t as j}from"./card-BMggHY3n.js";import{t as M}from"./label-C610MHwq.js";import{t as N}from"./alert-CHAmIFAx.js";var P=n();function F({className:e,orientation:t=`horizontal`,...n}){return(0,P.jsx)(C,{className:v(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch`,e),"data-slot":`separator`,orientation:t,...n})}var I=e(t(),1),L=I.createContext(void 0);function R(){let e=I.useContext(L);if(e===void 0)throw Error(y(63));return e}var z={...d,checked(e){return e?{"data-checked":``}:{"data-unchecked":``}}},B=I.forwardRef(function(e,t){let{checked:n,className:d,defaultChecked:f,"aria-labelledby":g,form:v,id:y,inputRef:b,name:x,nativeButton:S=!1,onCheckedChange:C,readOnly:w=!1,required:T=!1,disabled:E=!1,render:D,uncheckedValue:O,value:k,style:A,...j}=e,{clearErrors:M}=ee(),{state:N,setTouched:F,setDirty:R,validityData:B,setFilled:V,setFocused:H,validationMode:U,disabled:se,name:ce,validation:W}=l(),{labelId:le}=m(),G=se||E,K=ce??x,q=I.useRef(null),ue=ie(q,b,W.inputRef),J=I.useRef(null),Y=a(),X=s({id:y,implicit:!1,controlRef:J}),Z=S?void 0:X,[Q,de]=r({controlled:n,default:!!f,name:`Switch`,state:`checked`});u(J,Y,Q,void 0,!G,x),te(()=>{q.current&&V(q.current.checked)},[V]),ae(Q,()=>{M(K),R(Q!==B.initialValue),V(Q),W.change(Q)});let{getButtonProps:fe,buttonRef:pe}=p({disabled:G,native:S}),me=oe(g,le,q,!S,Z),he={id:S?X:Y,role:`switch`,"aria-checked":Q,"aria-readonly":w||void 0,"aria-required":T||void 0,"aria-labelledby":me,onFocus(){G||H(!0)},onBlur(){let e=q.current;!e||G||(F(!0),H(!1),U===`onBlur`&&W.commit(e.checked))},onClick(e){if(w||G)return;e.preventDefault();let t=q.current;t&&h(t,e)}},ge={...W.getValidationProps(G),checked:Q,disabled:G,form:v,id:Z,name:K,required:T,style:K?ne:c,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:ue,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(w){e.preventDefault();return}let t=e.currentTarget.checked,n=o(i,e.nativeEvent);C?.(t,n),!n.isCanceled&&de(t)},onClick(e){e.stopPropagation()},onFocus(){J.current?.focus()},...k===void 0?re:{value:k}},$=I.useMemo(()=>({...N,checked:Q,disabled:G,readOnly:w,required:T}),[N,Q,G,w,T]),_e=_(`span`,e,{state:$,ref:[t,J,pe],props:[he,j,fe,e=>W.getValidationProps(G,e)],stateAttributesMapping:z});return(0,P.jsxs)(L.Provider,{value:$,children:[_e,!Q&&K&&O!==void 0&&(0,P.jsx)(`input`,{type:`hidden`,form:v,name:K,value:O,disabled:G}),(0,P.jsx)(`input`,{...ge,suppressHydrationWarning:!0})]})}),V=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=R();return _(`span`,e,{state:o,ref:t,stateAttributesMapping:z,props:a})});function H({className:e,...t}){return(0,P.jsx)(B,{className:v(`inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 cursor-pointer items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]`,e),"data-slot":`switch`,...t,children:(0,P.jsx)(V,{className:v(`pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]`),"data-slot":`switch-thumb`})})}function U({config:e,setConfig:t,saveStatus:n,editors:r,adapters:i,saveAppConfig:a,isSettingsFormValid:o,toolsStatus:s,toolsLoading:c,updatingToolId:l,fetchToolsStatus:u,handleUpdateTool:d}){if(!e)return null;let p=r.find(t=>t.command===e.defaultEditor),m=i.find(t=>t.name===(e.storageProvider||`local`));return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,P.jsxs)(`header`,{className:`mb-6 border-b border-border/70 pb-4`,children:[(0,P.jsx)(`h1`,{className:`text-xl font-bold tracking-tight text-foreground`,children:`Global Settings`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Configure your local development directories, AI search parameters, storage adapters, and editor defaults.`})]}),n===`success`&&(0,P.jsxs)(N,{variant:`success`,className:`mb-6`,children:[(0,P.jsx)(S,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,P.jsxs)(N,{variant:`error`,className:`mb-6`,children:[(0,P.jsx)(O,{size:18}),` Error: Could not save configuration details to disk.`]}),(0,P.jsx)(j,{className:`mb-6 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-6 shadow-xs`,children:(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-devDir`,className:`text-sm`,children:`Development Directory`}),(0,P.jsx)(f,{type:`text`,id:`settings-devDir`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where your git projects are scanned.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-workspacesDir`,className:`text-sm`,children:`Workspaces Directory`}),(0,P.jsx)(f,{type:`text`,id:`settings-workspacesDir`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where unified worktree environments are spun up.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-scanDepth`,className:`text-sm`,children:`Repo Search Depth`}),(0,P.jsx)(f,{type:`number`,min:1,max:5,id:`settings-scanDepth`,value:e.scanDepth,onChange:n=>t({...e,scanDepth:parseInt(n.target.value,10)})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Max directory levels deep the system will traverse for git repos.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:`Default Assistant`}),(0,P.jsxs)(T,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,P.jsx)(x,{"aria-label":`Default Assistant`,children:(0,P.jsx)(k,{children:e.defaultAssistant===`claude`?`Claude Code`:e.defaultAssistant===`antigravity`?`Antigravity`:e.defaultAssistant===`codex`?`Codex`:e.defaultAssistant===`copilot`?`GitHub Copilot`:e.defaultAssistant===`cursor`?`Cursor`:`None (Prompt me)`})}),(0,P.jsxs)(w,{alignItemWithTrigger:!1,children:[(0,P.jsx)(A,{value:``,children:`None (Prompt me)`}),(0,P.jsx)(A,{value:`claude`,children:`Claude Code`}),(0,P.jsx)(A,{value:`antigravity`,children:`Antigravity`}),(0,P.jsx)(A,{value:`codex`,children:`Codex`}),(0,P.jsx)(A,{value:`copilot`,children:`GitHub Copilot`}),(0,P.jsx)(A,{value:`cursor`,children:`Cursor`})]})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred workspace context manager.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:`Preferred Editor`}),(0,P.jsxs)(T,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,P.jsx)(x,{"aria-label":`Preferred Editor`,children:(0,P.jsx)(k,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,P.jsxs)(w,{alignItemWithTrigger:!1,children:[(0,P.jsx)(A,{value:``,children:`No preference`}),r.map(e=>(0,P.jsxs)(A,{value:e.command,children:[e.name,` `,e.detected?`(Detected)`:`(Not found)`]},e.command))]})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Shown first in the “Open with…” workspace chooser.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 md:col-span-2`,children:[(0,P.jsx)(F,{className:`mt-1`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Workspace Storage Settings`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose where maps, plans, and knowledge files are stored.`})]}),(0,P.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,P.jsxs)(T,{value:e.storageProvider||`local`,onValueChange:n=>{if(typeof n!=`string`)return;let r=n,a={...e,storageProvider:r},o=i.find(e=>e.name===r);o?.configFields?.length&&(a.adapterConfig||={},a.adapterConfig[r]||(a.adapterConfig[r]={}),o.configFields.forEach(e=>{a.adapterConfig[r][e.key]===void 0&&e.default!==void 0&&(a.adapterConfig[r][e.key]=e.default)})),t(a)},children:[(0,P.jsx)(x,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,P.jsx)(k,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,P.jsx)(w,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,P.jsx)(A,{value:e.name,children:e.displayName},e.name)):(0,P.jsx)(A,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m?.description||`Choose where to store maps, plans, and knowledge files. Centralized vault keeps repositories 100% clean and allows Obsidian integration.`})]}),(()=>{let n=e.storageProvider||`local`,r=i.find(e=>e.name===n);return r?.configFields?.length?(0,P.jsxs)(`div`,{className:`flex max-w-md flex-col gap-4 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,P.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[r.displayName,` Settings`]}),r.configFields.map(r=>{let i=e.adapterConfig?.[n]?.[r.key]??r.default??``,a=i=>{let a={...e.adapterConfig||{},[n]:{...e.adapterConfig?.[n]||{},[r.key]:i}};t({...e,adapterConfig:a})};return r.type===`boolean`?(0,P.jsxs)(M,{className:`flex cursor-pointer items-start gap-3 text-sm`,children:[(0,P.jsx)(H,{checked:!!i,onCheckedChange:e=>a(e)}),(0,P.jsxs)(`span`,{className:`flex flex-col`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r.label}),r.description&&(0,P.jsx)(`span`,{className:`mt-0.5 text-xs leading-normal text-muted-foreground`,children:r.description})]})]},r.key):(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:r.label}),(0,P.jsx)(f,{type:r.type===`number`?`number`:`text`,value:i,onChange:e=>{let t=r.type===`number`?Number(e.target.value):e.target.value;a(t)}}),r.description&&(0,P.jsx)(`span`,{className:`text-xs leading-normal text-muted-foreground`,children:r.description})]},r.key)})]}):null})()]})]})}),(0,P.jsxs)(j,{className:`mt-6 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-6 shadow-xs`,children:[(0,P.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`AI Toolchain Updates`}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Monitor and update the CLI packages and assistants in your workflow.`})]}),(0,P.jsxs)(b,{variant:`outline`,size:`sm`,onClick:()=>u(!0),disabled:c,children:[c?(0,P.jsx)(D,{className:`size-3`}):(0,P.jsx)(E,{size:13}),c?`Checking...`:`Check Now`]})]}),c&&s.length===0?(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,P.jsx)(D,{className:`size-6`}),(0,P.jsx)(`span`,{className:`text-xs`,children:`Fetching registry version details...`})]}):s.length===0?(0,P.jsx)(`p`,{className:`py-4 text-xs text-muted-foreground`,children:`No toolchain information available.`}):(0,P.jsx)(`div`,{className:`space-y-4`,children:s.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[e.name,(0,P.jsx)(g,{variant:e.installed?`success`:`secondary`,size:`sm`,children:e.installed?`Installed`:`Not Installed`})]}),(0,P.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,P.jsxs)(`span`,{children:[`Installed version: `,(0,P.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.currentVersion})]}),e.installed&&(0,P.jsxs)(`span`,{children:[`Latest: `,(0,P.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.latestVersion})]})]}),(0,P.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.updateCmd})]}),(0,P.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:e.updateAvailable?(0,P.jsx)(b,{size:`sm`,onClick:()=>d(e.id),disabled:l!==null,children:l===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsxs)(g,{variant:`success`,className:`gap-1.5`,children:[(0,P.jsx)(S,{size:12}),` Up to Date`]}),(0,P.jsx)(b,{variant:`outline`,size:`sm`,onClick:()=>d(e.id),disabled:l!==null,children:l===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Reinstalling...`]}):`Reinstall`})]}):(0,P.jsx)(b,{variant:`outline`,size:`sm`,onClick:()=>d(e.id),disabled:l!==null,children:l===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Installing...`]}):`Install CLI`})})]},e.id))})]}),(0,P.jsx)(`div`,{className:`mb-10 flex justify-end pt-4`,children:(0,P.jsxs)(b,{onClick:()=>a(e),disabled:!o,children:[(0,P.jsx)(S,{size:16}),` Save Configuration`]})})]})}export{U as SettingsPage};
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{En as r,Ln as i,Xt as a,Yt as o,a as s,bt as c,c as l,i as u,l as d,n as f,nn as p,o as m,rn as ee,s as te,sn as ne,t as h,xt as re}from"./badge-BObbahyU.js";import{c as ie,d as ae,i as g,m as _,p as v,t as y}from"./button-BrcP8Wxx.js";import{t as oe}from"./useValueChanged-DfJmRF2P.js";import{t as b}from"./useAriaLabelledBy-DAWGcnTk.js";import{C as x,Dn as S,E as C,It as w,S as T,T as E,p as D,tn as O,un as k,w as A}from"./index-D-sx2qJG.js";import{t as j}from"./card-BMggHY3n.js";import{t as M}from"./label-C610MHwq.js";import{t as N}from"./alert-CHAmIFAx.js";var P=n();function F({className:e,orientation:t=`horizontal`,...n}){return(0,P.jsx)(w,{className:_(`shrink-0 bg-border data-[orientation=horizontal]:h-px data-[orientation=horizontal]:w-full data-[orientation=vertical]:w-px data-[orientation=vertical]:not-[[class^='h-']]:not-[[class*='_h-']]:self-stretch`,e),"data-slot":`separator`,orientation:t,...n})}var I=e(t(),1),L=I.createContext(void 0);function R(){let e=I.useContext(L);if(e===void 0)throw Error(v(63));return e}var z={...d,checked(e){return e?{"data-checked":``}:{"data-unchecked":``}}},B=I.forwardRef(function(e,t){let{checked:n,className:d,defaultChecked:f,"aria-labelledby":h,form:_,id:v,inputRef:y,name:x,nativeButton:S=!1,onCheckedChange:C,readOnly:w=!1,required:T=!1,disabled:E=!1,render:D,uncheckedValue:O,value:k,style:A,...j}=e,{clearErrors:M}=te(),{state:N,setTouched:F,setDirty:R,validityData:B,setFilled:V,setFocused:H,validationMode:U,disabled:se,name:ce,validation:W}=l(),{labelId:le}=m(),G=se||E,K=ce??x,q=I.useRef(null),ue=ae(q,y,W.inputRef),J=I.useRef(null),Y=a(),X=s({id:v,implicit:!1,controlRef:J}),Z=S?void 0:X,[Q,de]=r({controlled:n,default:!!f,name:`Switch`,state:`checked`});u(J,Y,Q,void 0,!G,x),ne(()=>{q.current&&V(q.current.checked)},[V]),oe(Q,()=>{M(K),R(Q!==B.initialValue),V(Q),W.change(Q)});let{getButtonProps:fe,buttonRef:pe}=p({disabled:G,native:S}),me=b(h,le,q,!S,Z),he={id:S?X:Y,role:`switch`,"aria-checked":Q,"aria-readonly":w||void 0,"aria-required":T||void 0,"aria-labelledby":me,onFocus(){G||H(!0)},onBlur(){let e=q.current;!e||G||(F(!0),H(!1),U===`onBlur`&&W.commit(e.checked))},onClick(e){if(w||G)return;e.preventDefault();let t=q.current;t&&ee(t,e)}},ge={...W.getValidationProps(G),checked:Q,disabled:G,form:_,id:Z,name:K,required:T,style:K?re:c,tabIndex:-1,type:`checkbox`,"aria-hidden":!0,ref:ue,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(w){e.preventDefault();return}let t=e.currentTarget.checked,n=o(i,e.nativeEvent);C?.(t,n),!n.isCanceled&&de(t)},onClick(e){e.stopPropagation()},onFocus(){J.current?.focus()},...k===void 0?ie:{value:k}},$=I.useMemo(()=>({...N,checked:Q,disabled:G,readOnly:w,required:T}),[N,Q,G,w,T]),_e=g(`span`,e,{state:$,ref:[t,J,pe],props:[he,j,fe,e=>W.getValidationProps(G,e)],stateAttributesMapping:z});return(0,P.jsxs)(L.Provider,{value:$,children:[_e,!Q&&K&&O!==void 0&&(0,P.jsx)(`input`,{type:`hidden`,form:_,name:K,value:O,disabled:G}),(0,P.jsx)(`input`,{...ge,suppressHydrationWarning:!0})]})}),V=I.forwardRef(function(e,t){let{render:n,className:r,style:i,...a}=e,o=R();return g(`span`,e,{state:o,ref:t,stateAttributesMapping:z,props:a})});function H({className:e,...t}){return(0,P.jsx)(B,{className:_(`inline-flex h-[calc(var(--thumb-size)+2px)] w-[calc(var(--thumb-size)*2-2px)] shrink-0 cursor-pointer items-center rounded-full p-px outline-none transition-[background-color,box-shadow] duration-200 [--thumb-size:--spacing(5)] focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background data-checked:bg-primary data-unchecked:bg-input data-disabled:cursor-not-allowed data-disabled:opacity-64 sm:[--thumb-size:--spacing(4)]`,e),"data-slot":`switch`,...t,children:(0,P.jsx)(V,{className:_(`pointer-events-none block aspect-square h-full origin-left in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:not-data-disabled:scale-x-110 in-[[role=switch]:active,[data-slot=label]:active,[data-slot=field-label]:active]:rounded-[var(--thumb-size)/calc(var(--thumb-size)*1.1)] rounded-(--thumb-size) bg-background shadow-sm/5 will-change-transform [transition:translate_.15s,border-radius_.15s,scale_.1s_.1s,transform-origin_.15s] data-checked:origin-[var(--thumb-size)_50%] data-checked:translate-x-[calc(var(--thumb-size)-4px)]`),"data-slot":`switch-thumb`})})}function U({config:e,setConfig:t,saveStatus:n,editors:r,adapters:i,saveAppConfig:a,isSettingsFormValid:o,toolsStatus:s,toolsLoading:c,updatingToolId:l,fetchToolsStatus:u,handleUpdateTool:d}){if(!e)return null;let p=r.find(t=>t.command===e.defaultEditor),m=i.find(t=>t.name===(e.storageProvider||`local`));return(0,P.jsxs)(`div`,{className:`mx-auto max-w-4xl animate-fade-in`,children:[(0,P.jsxs)(`header`,{className:`mb-6 border-b border-border/70 pb-4`,children:[(0,P.jsx)(`h1`,{className:`text-xl font-bold tracking-tight text-foreground`,children:`Global Settings`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Configure your local development directories, AI search parameters, storage adapters, and editor defaults.`})]}),n===`success`&&(0,P.jsxs)(N,{variant:`success`,className:`mb-6`,children:[(0,P.jsx)(S,{size:18}),` Settings successfully saved and updated!`]}),n===`error`&&(0,P.jsxs)(N,{variant:`error`,className:`mb-6`,children:[(0,P.jsx)(O,{size:18}),` Error: Could not save configuration details to disk.`]}),(0,P.jsx)(j,{className:`mb-6 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-6 shadow-xs`,children:(0,P.jsxs)(`div`,{className:`grid grid-cols-1 gap-6 md:grid-cols-2`,children:[(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-devDir`,className:`text-sm`,children:`Development Directory`}),(0,P.jsx)(f,{type:`text`,id:`settings-devDir`,value:e.devDir,onChange:n=>t({...e,devDir:n.target.value})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where your git projects are scanned.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-workspacesDir`,className:`text-sm`,children:`Workspaces Directory`}),(0,P.jsx)(f,{type:`text`,id:`settings-workspacesDir`,value:e.workspacesDir,onChange:n=>t({...e,workspacesDir:n.target.value})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Directory where unified worktree environments are spun up.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`settings-scanDepth`,className:`text-sm`,children:`Repo Search Depth`}),(0,P.jsx)(f,{type:`number`,min:1,max:5,id:`settings-scanDepth`,value:e.scanDepth,onChange:n=>t({...e,scanDepth:parseInt(n.target.value,10)})}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Max directory levels deep the system will traverse for git repos.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:`Default Assistant`}),(0,P.jsxs)(T,{value:e.defaultAssistant||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultAssistant:n||null}),children:[(0,P.jsx)(E,{"aria-label":`Default Assistant`,children:(0,P.jsx)(C,{children:e.defaultAssistant===`claude`?`Claude Code`:e.defaultAssistant===`antigravity`?`Antigravity`:e.defaultAssistant===`codex`?`Codex`:e.defaultAssistant===`copilot`?`GitHub Copilot`:e.defaultAssistant===`cursor`?`Cursor`:`None (Prompt me)`})}),(0,P.jsxs)(A,{alignItemWithTrigger:!1,children:[(0,P.jsx)(x,{value:``,children:`None (Prompt me)`}),(0,P.jsx)(x,{value:`claude`,children:`Claude Code`}),(0,P.jsx)(x,{value:`antigravity`,children:`Antigravity`}),(0,P.jsx)(x,{value:`codex`,children:`Codex`}),(0,P.jsx)(x,{value:`copilot`,children:`GitHub Copilot`}),(0,P.jsx)(x,{value:`cursor`,children:`Cursor`})]})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Your preferred workspace context manager.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:`Preferred Editor`}),(0,P.jsxs)(T,{value:e.defaultEditor||``,onValueChange:n=>typeof n==`string`&&t({...e,defaultEditor:n||null}),children:[(0,P.jsx)(E,{"aria-label":`Preferred Editor`,children:(0,P.jsx)(C,{children:p?`${p.name} ${p.detected?`(Detected)`:`(Not found)`}`:`No preference`})}),(0,P.jsxs)(A,{alignItemWithTrigger:!1,children:[(0,P.jsx)(x,{value:``,children:`No preference`}),r.map(e=>(0,P.jsxs)(x,{value:e.command,children:[e.name,` `,e.detected?`(Detected)`:`(Not found)`]},e.command))]})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:`Shown first in the “Open with…” workspace chooser.`})]}),(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 md:col-span-2`,children:[(0,P.jsx)(F,{className:`mt-1`}),(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-sm font-semibold text-foreground`,children:`Workspace Storage Settings`}),(0,P.jsx)(`p`,{className:`mt-1 text-xs text-muted-foreground`,children:`Choose where maps, plans, and knowledge files are stored.`})]}),(0,P.jsxs)(`div`,{className:`flex max-w-md flex-col gap-1.5`,children:[(0,P.jsx)(M,{htmlFor:`storageProvider`,className:`text-sm`,children:`Storage Provider`}),(0,P.jsxs)(T,{value:e.storageProvider||`local`,onValueChange:n=>{if(typeof n!=`string`)return;let r=n,a={...e,storageProvider:r},o=i.find(e=>e.name===r);o?.configFields?.length&&(a.adapterConfig||={},a.adapterConfig[r]||(a.adapterConfig[r]={}),o.configFields.forEach(e=>{a.adapterConfig[r][e.key]===void 0&&e.default!==void 0&&(a.adapterConfig[r][e.key]=e.default)})),t(a)},children:[(0,P.jsx)(E,{id:`storageProvider`,"aria-label":`Storage Provider`,children:(0,P.jsx)(C,{children:m?.displayName??`Local Workspace (Folders)`})}),(0,P.jsx)(A,{alignItemWithTrigger:!1,children:i.length>0?i.map(e=>(0,P.jsx)(x,{value:e.name,children:e.displayName},e.name)):(0,P.jsx)(x,{value:`local`,children:`Local Workspace (Folders)`})})]}),(0,P.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:m?.description||`Choose where to store maps, plans, and knowledge files. Centralized vault keeps repositories 100% clean and allows Obsidian integration.`})]}),(()=>{let n=e.storageProvider||`local`,r=i.find(e=>e.name===n);return r?.configFields?.length?(0,P.jsxs)(`div`,{className:`flex max-w-md flex-col gap-4 rounded-xl border border-border bg-muted/40 p-4`,children:[(0,P.jsxs)(`h4`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:[r.displayName,` Settings`]}),r.configFields.map(r=>{let i=e.adapterConfig?.[n]?.[r.key]??r.default??``,a=i=>{let a={...e.adapterConfig||{},[n]:{...e.adapterConfig?.[n]||{},[r.key]:i}};t({...e,adapterConfig:a})};return r.type===`boolean`?(0,P.jsxs)(M,{className:`flex cursor-pointer items-start gap-3 text-sm`,children:[(0,P.jsx)(H,{checked:!!i,onCheckedChange:e=>a(e)}),(0,P.jsxs)(`span`,{className:`flex flex-col`,children:[(0,P.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:r.label}),r.description&&(0,P.jsx)(`span`,{className:`mt-0.5 text-xs leading-normal text-muted-foreground`,children:r.description})]})]},r.key):(0,P.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,P.jsx)(M,{className:`text-sm`,children:r.label}),(0,P.jsx)(f,{type:r.type===`number`?`number`:`text`,value:i,onChange:e=>{let t=r.type===`number`?Number(e.target.value):e.target.value;a(t)}}),r.description&&(0,P.jsx)(`span`,{className:`text-xs leading-normal text-muted-foreground`,children:r.description})]},r.key)})]}):null})()]})]})}),(0,P.jsxs)(j,{className:`mt-6 rounded-xl border border-border/80 bg-card/70 backdrop-blur-md p-6 shadow-xs`,children:[(0,P.jsxs)(`div`,{className:`mb-6 flex items-start justify-between gap-4`,children:[(0,P.jsxs)(`div`,{children:[(0,P.jsx)(`h3`,{className:`text-lg font-semibold text-foreground`,children:`AI Toolchain Updates`}),(0,P.jsx)(`p`,{className:`mt-1 text-sm text-muted-foreground`,children:`Monitor and update the CLI packages and assistants in your workflow.`})]}),(0,P.jsxs)(y,{variant:`outline`,size:`sm`,onClick:()=>u(!0),disabled:c,children:[c?(0,P.jsx)(D,{className:`size-3`}):(0,P.jsx)(k,{size:13}),c?`Checking...`:`Check Now`]})]}),c&&s.length===0?(0,P.jsxs)(`div`,{className:`flex flex-col items-center justify-center gap-2 py-8 text-muted-foreground`,children:[(0,P.jsx)(D,{className:`size-6`}),(0,P.jsx)(`span`,{className:`text-xs`,children:`Fetching registry version details...`})]}):s.length===0?(0,P.jsx)(`p`,{className:`py-4 text-xs text-muted-foreground`,children:`No toolchain information available.`}):(0,P.jsx)(`div`,{className:`space-y-4`,children:s.map(e=>(0,P.jsxs)(`div`,{className:`flex flex-col gap-4 rounded-xl border border-border bg-muted/30 p-4 sm:flex-row sm:items-center sm:justify-between`,children:[(0,P.jsxs)(`div`,{className:`min-w-0`,children:[(0,P.jsxs)(`h4`,{className:`flex items-center gap-2 text-sm font-semibold text-foreground`,children:[e.name,(0,P.jsx)(h,{variant:e.installed?`success`:`secondary`,size:`sm`,children:e.installed?`Installed`:`Not Installed`})]}),(0,P.jsxs)(`div`,{className:`mt-1.5 flex flex-wrap items-center gap-x-4 gap-y-1 text-xs text-muted-foreground`,children:[(0,P.jsxs)(`span`,{children:[`Installed version: `,(0,P.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.currentVersion})]}),e.installed&&(0,P.jsxs)(`span`,{children:[`Latest: `,(0,P.jsx)(`code`,{className:`font-mono text-[10px] text-foreground`,children:e.latestVersion})]})]}),(0,P.jsx)(`p`,{className:`mt-1 font-mono text-[10px] text-muted-foreground`,children:e.updateCmd})]}),(0,P.jsx)(`div`,{className:`flex shrink-0 items-center gap-3`,children:e.updateAvailable?(0,P.jsx)(y,{size:`sm`,onClick:()=>d(e.id),disabled:l!==null,children:l===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Updating...`]}):`Update Tool`}):e.installed?(0,P.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,P.jsxs)(h,{variant:`success`,className:`gap-1.5`,children:[(0,P.jsx)(S,{size:12}),` Up to Date`]}),(0,P.jsx)(y,{variant:`outline`,size:`sm`,onClick:()=>d(e.id),disabled:l!==null,children:l===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Reinstalling...`]}):`Reinstall`})]}):(0,P.jsx)(y,{variant:`outline`,size:`sm`,onClick:()=>d(e.id),disabled:l!==null,children:l===e.id?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(D,{className:`size-3`}),` Installing...`]}):`Install CLI`})})]},e.id))})]}),(0,P.jsx)(`div`,{className:`mb-10 flex justify-end pt-4`,children:(0,P.jsxs)(y,{onClick:()=>a(e),disabled:!o,children:[(0,P.jsx)(S,{size:16}),` Save Configuration`]})})]})}export{U as SettingsPage};
@@ -1,7 +1,7 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{n as r,t as i}from"./badge-BObbahyU.js";import{h as a,m as o,t as s}from"./button-BrcP8Wxx.js";import{t as ee}from"./chevron-down-Dy03VL1q.js";import{t as c}from"./code-xml-DHWUQOSO.js";import{a as l,i as te,n as ne,o as re,r as ie,s as ae,t as oe}from"./square-check-big-DpHMT26q.js";import{n as se,t as u}from"./shield-check-C5I2LDCK.js";import{t as d}from"./trash-2-BrrLX4tD.js";import{An as ce,In as le,L as ue,Ln as de,Mn as f,O as fe,On as p,Q as pe,R as me,Rn as m,Z as he,_ as h,a as ge,cn as _e,d as ve,et as ye,f as g,fn as be,h as _,hn as xe,i as Se,in as Ce,lt as we,m as v,mn as Te,n as Ee,nt as De,o as Oe,p as y,r as ke,sn as b,t as Ae,ut as je,v as x,vn as Me,xn as Ne,yt as Pe,z as Fe}from"./index-BRvfvR0q.js";import{t as Ie}from"./card-BMggHY3n.js";import{t as S}from"./label-C610MHwq.js";var Le=a(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Re=a(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),ze=a(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),C=e(t(),1),w=n(),T={"git-pull-request":te,"flask-conical":l,package:ie,database:ae,"shield-check":u,terminal:be,zap:b,cpu:f,layers:p,boxes:m,code:c},Be=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function E({showToast:e}){let[t,n]=(0,C.useState)(`global`),[a,l]=(0,C.useState)(``),[te,ie]=(0,C.useState)({}),[ae,u]=(0,C.useState)(!1),[f,p]=(0,C.useState)(null),[be,b]=(0,C.useState)(!1),[E,D]=(0,C.useState)(null),[Ve,He]=(0,C.useState)(!1),[O,k]=(0,C.useState)(`edit`),[A,j]=(0,C.useState)(`global`),[M,N]=(0,C.useState)(``),[Ue,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(null),[We,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(null),[Ge,Ke]=(0,C.useState)(null),[qe,B]=(0,C.useState)(null),{data:V=[],isLoading:Je}=ye(),{data:H=[],isLoading:Ye}=De(t===`global`?void 0:t),{data:U=[]}=je(),{data:Xe=[]}=Fe(),{data:W,isLoading:Ze,isError:Qe}=we(t===`global`?``:t),[G,K]=(0,C.useState)(null),$e=Array.from(new Set(Xe.flatMap(e=>[e.id,...e.tags||[]]).concat([`git`,`pr`,`testing`,`security`,`performance`,`database`,`ci-cd`,`frontend`,`backend`]).filter(Boolean))).slice(0,24),et=pe(),tt=me(),q=he(),nt=ue(),J=fe(),Y=t!==`global`,X=new Set(G??W?.enabledSkills??[]),Z=!Y||!Ze&&!Qe&&!!W;(0,C.useEffect)(()=>{if(!Y){K(null);return}W&&K([...W.enabledSkills])},[Y,t,W]);let rt=e=>{ie(t=>({...t,[e]:!t[e]}))},Q=H.filter(e=>{if(!a.trim())return!0;let t=a.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),it=V.reduce((e,t)=>(e[t.id]=Q.filter(e=>e.category===t.id),e),{}),at=Q.filter(e=>!e.category||!V.some(t=>t.id===e.category)),ot=e=>{p(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),u(!0)},st=async()=>{if(!(!f||!f.name?.trim()))try{await et.mutateAsync({id:f.id,name:f.name.trim(),description:f.description,icon:f.icon,color:f.color}),e?.(`Category saved successfully`,`success`),u(!1),p(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},ct=(e,t)=>{t.stopPropagation(),z({type:`category`,id:e.id,title:e.name}),L(!0)},$=(e,n)=>{let r=e?.scope??(Y?`workspace`:`global`);j(r),N(Y?t:U[0]?.id||``),D(e||{name:``,title:``,category:n||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
1
+ import{r as e}from"./rolldown-runtime-hePW80VL.js";import{n as t,t as n}from"./jsx-runtime-DE3RlOCf.js";import{n as r,t as i}from"./badge-BObbahyU.js";import{h as a,m as o,t as s}from"./button-BrcP8Wxx.js";import{t as ee}from"./chevron-down-Dy03VL1q.js";import{t as c}from"./code-xml-DHWUQOSO.js";import{a as l,i as te,n as ne,o as re,r as ie,s as ae,t as oe}from"./square-check-big-DpHMT26q.js";import{n as se,t as u}from"./shield-check-C5I2LDCK.js";import{t as d}from"./trash-2-BrrLX4tD.js";import{$ as ce,A as le,B as ue,Dn as de,En as fe,Jt as pe,On as f,Qt as me,Sn as p,V as he,Zt as m,_ as h,a as ge,an as _e,b as g,cn as ve,dn as ye,dt as be,et as xe,ft as Se,g as _,h as v,i as Ce,in as we,it as Te,m as y,n as Ee,nn as De,nt as Oe,o as ke,p as Ae,r as je,t as Me,xn as Ne,xt as Pe,y as b,yn as x,z as Fe}from"./index-D-sx2qJG.js";import{t as Ie}from"./card-BMggHY3n.js";import{t as S}from"./label-C610MHwq.js";var Le=a(`arrow-right-left`,[[`path`,{d:`m16 3 4 4-4 4`,key:`1x1c3m`}],[`path`,{d:`M20 7H4`,key:`zbl0bi`}],[`path`,{d:`m8 21-4-4 4-4`,key:`h9nckh`}],[`path`,{d:`M4 17h16`,key:`g4d7ey`}]]),Re=a(`grip-vertical`,[[`circle`,{cx:`9`,cy:`12`,r:`1`,key:`1vctgf`}],[`circle`,{cx:`9`,cy:`5`,r:`1`,key:`hp0tcf`}],[`circle`,{cx:`9`,cy:`19`,r:`1`,key:`fkjjf6`}],[`circle`,{cx:`15`,cy:`12`,r:`1`,key:`1tmaij`}],[`circle`,{cx:`15`,cy:`5`,r:`1`,key:`19l28e`}],[`circle`,{cx:`15`,cy:`19`,r:`1`,key:`f4zoj3`}]]),ze=a(`wrench`,[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]),C=e(t(),1),w=n(),T={"git-pull-request":te,"flask-conical":l,package:ie,database:ae,"shield-check":u,terminal:De,zap:m,cpu:p,layers:x,boxes:f,code:c},Be=[{label:`Blue`,value:`#3b82f6`},{label:`Green`,value:`#10b981`},{label:`Purple`,value:`#8b5cf6`},{label:`Amber`,value:`#f59e0b`},{label:`Red`,value:`#ef4444`},{label:`Cyan`,value:`#06b6d4`},{label:`Pink`,value:`#ec4899`},{label:`Emerald`,value:`#059669`}];function E({showToast:e}){let[t,n]=(0,C.useState)(`global`),[a,l]=(0,C.useState)(``),[te,ie]=(0,C.useState)({}),[ae,u]=(0,C.useState)(!1),[p,m]=(0,C.useState)(null),[De,x]=(0,C.useState)(!1),[E,D]=(0,C.useState)(null),[Ve,He]=(0,C.useState)(!1),[O,k]=(0,C.useState)(`edit`),[A,j]=(0,C.useState)(`global`),[M,N]=(0,C.useState)(``),[Ue,P]=(0,C.useState)(!1),[F,I]=(0,C.useState)(null),[We,L]=(0,C.useState)(!1),[R,z]=(0,C.useState)(null),[Ge,Ke]=(0,C.useState)(null),[qe,B]=(0,C.useState)(null),{data:V=[],isLoading:Je}=Oe(),{data:H=[],isLoading:Ye}=Te(t===`global`?void 0:t),{data:U=[]}=Se(),{data:Xe=[]}=he(),{data:W,isLoading:Ze,isError:Qe}=be(t===`global`?``:t),[G,K]=(0,C.useState)(null),$e=Array.from(new Set(Xe.flatMap(e=>[e.id,...e.tags||[]]).concat([`git`,`pr`,`testing`,`security`,`performance`,`database`,`ci-cd`,`frontend`,`backend`]).filter(Boolean))).slice(0,24),et=xe(),tt=ue(),q=ce(),nt=Fe(),J=le(),Y=t!==`global`,X=new Set(G??W?.enabledSkills??[]),Z=!Y||!Ze&&!Qe&&!!W;(0,C.useEffect)(()=>{if(!Y){K(null);return}W&&K([...W.enabledSkills])},[Y,t,W]);let rt=e=>{ie(t=>({...t,[e]:!t[e]}))},Q=H.filter(e=>{if(!a.trim())return!0;let t=a.toLowerCase();return e.title?.toLowerCase().includes(t)||e.name.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.tags?.some(e=>e.toLowerCase().includes(t))}),it=V.reduce((e,t)=>(e[t.id]=Q.filter(e=>e.category===t.id),e),{}),at=Q.filter(e=>!e.category||!V.some(t=>t.id===e.category)),ot=e=>{m(e||{name:``,description:``,icon:`boxes`,color:`#3b82f6`,custom:!0}),u(!0)},st=async()=>{if(!(!p||!p.name?.trim()))try{await et.mutateAsync({id:p.id,name:p.name.trim(),description:p.description,icon:p.icon,color:p.color}),e?.(`Category saved successfully`,`success`),u(!1),m(null)}catch(t){e?.(`Failed to save category`,`error`),console.error(t)}},ct=(e,t)=>{t.stopPropagation(),z({type:`category`,id:e.id,title:e.name}),L(!0)},$=(e,n)=>{let r=e?.scope??(Y?`workspace`:`global`);j(r),N(Y?t:U[0]?.id||``),D(e||{name:``,title:``,category:n||(V[0]?.id??`pull-requests`),description:``,tags:[],allowedTools:[],content:`# Skill Title
2
2
 
3
3
  Instructions and playbook for the AI assistant.
4
- `,custom:!0,scope:r}),He(!!e),k(`edit`),b(!0)};(0,C.useEffect)(()=>{!M&&U.length>0&&N(U[0].id)},[U,M]);let lt=e=>{if(!E)return;let t={...E,title:e};!Ve&&!E.id&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),D(t)},ut=async()=>{if(!E||!E.name?.trim()||!E.description?.trim()||!E.content?.trim()){e?.(`Skill name, trigger description, and content are required`,`error`);return}if(A===`workspace`&&!M){e?.(`Please select a target workspace for workspace-local skill`,`error`);return}try{await q.mutateAsync({id:E.id,name:E.name.trim(),title:E.title||E.name,category:E.category||`general`,description:E.description||``,tags:E.tags||[],allowedTools:E.allowedTools||[],content:E.content,scope:A,workspaceId:A===`workspace`?M:void 0}),e?.(A===`workspace`?`Workspace skill saved successfully in .agents/skills/`:`Global skill package saved successfully`,`success`),b(!1),D(null)}catch(t){e?.(t?.message||`Failed to save skill`,`error`),console.error(t)}},dt=(e,n)=>{n.stopPropagation();let r=e.scope===`workspace`||A===`workspace`?t===`global`?M||void 0:t:void 0;z({type:`skill`,id:e.id,title:e.title||e.name,workspaceId:r}),L(!0)},ft=async()=>{if(R)try{R.type===`category`?(await tt.mutateAsync(R.id),e?.(`Category deleted`,`info`)):(await nt.mutateAsync({id:R.id,workspaceId:R.workspaceId}),e?.(`Skill package deleted`,`info`)),L(!1),z(null)}catch(t){e?.(t?.message||`Failed to delete item`,`error`),console.error(t)}},pt=e=>{if(!Y||!Z||G===null)return;let t=new Set(G);t.has(e)?t.delete(e):t.add(e),K(Array.from(t))},mt=()=>{if(!E||E.custom!==!1)return;let e=`${E.name}-copy`;D({...E,id:void 0,name:e,title:`${E.title||E.name} Copy`,allowedTools:[],custom:!0,sourcePath:void 0,references:void 0,scripts:void 0}),He(!0)},ht=(e,t)=>{if(!Y||!Z||G===null)return;let n=it[e]||[],r=new Set(G);for(let e of n)t?r.add(e.id):r.delete(e.id);K(Array.from(r))},gt=async()=>{if(!(!W||G===null||!Y))try{await J.mutateAsync({workspaceId:t,expectedRevision:W.revision??0,enabledSkills:G,enabledAgents:W.enabledAgents??[],enabledCategories:V.map(e=>e.id)}),e?.(`Skill selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save skill selection`,`error`)}},_t=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`,Ke(t)},vt=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,qe!==t&&B(t)},yt=()=>{B(null)},bt=async(t,n)=>{t.preventDefault(),B(null);let r=t.dataTransfer.getData(`text/plain`)||Ge;if(Ke(null),!r)return;let i=H.find(e=>e.id===r);!i||!i.custom||Y||i.category===n||(await q.mutateAsync({id:i.id,name:i.name,title:i.title,description:i.description,tags:i.tags,allowedTools:i.allowedTools,content:i.content,category:n}),e?.(`Skill re-categorized`,`success`))},xt=(e,t)=>{t.stopPropagation(),I(e),P(!0)},St=async t=>{if(!F||F.category===t){P(!1),I(null);return}await q.mutateAsync({id:F.id,name:F.name,title:F.title,description:F.description,tags:F.tags,allowedTools:F.allowedTools,content:F.content,category:t}),e?.(`Skill moved to category`,`success`),P(!1),I(null)};return(0,w.jsxs)(`div`,{className:`flex-1 flex flex-col h-full overflow-hidden bg-background text-foreground`,children:[(0,w.jsxs)(`div`,{className:`p-6 border-b border-border flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-card/40 backdrop-blur-sm`,children:[(0,w.jsx)(`div`,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,w.jsx)(m,{className:`h-6 w-6`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Skill Library`}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create, organize, and assign reusable Agent Skill packages.`})]})]})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,w.jsx)(s,{render:(0,w.jsx)(Ce,{to:`/agents`}),variant:`outline`,size:`sm`,children:`Codex Agents`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-1.5 border border-border`,children:[(0,w.jsx)(ce,{className:`h-4 w-4 text-muted-foreground`}),(0,w.jsx)(S,{htmlFor:`skill-scope`,className:`text-xs font-medium text-muted-foreground`,children:`Scope:`}),(0,w.jsxs)(`select`,{id:`skill-scope`,value:t,onChange:e=>n(e.target.value),className:`bg-transparent text-xs font-semibold focus:outline-none cursor-pointer text-foreground`,children:[(0,w.jsx)(`option`,{value:`global`,className:`bg-popover text-popover-foreground`,children:`🌐 Global Skills Catalog`}),U.map(e=>(0,w.jsxs)(`option`,{value:e.id,className:`bg-popover text-popover-foreground`,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))]})]}),!Y&&(0,w.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>ot(),className:`flex items-center gap-1.5`,children:[(0,w.jsx)(Ne,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`New Category`})]}),Y&&(0,w.jsx)(s,{size:`sm`,onClick:gt,disabled:!Z||J.isPending||G===null,children:J.isPending?`Saving…`:`Save selection`}),(0,w.jsxs)(s,{variant:`default`,size:`sm`,onClick:()=>$(),className:`flex items-center gap-1.5`,children:[(0,w.jsx)(xe,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`New Skill`})]})]})]}),(0,w.jsxs)(`div`,{className:`px-6 py-3 border-b border-border/60 bg-muted/20 flex items-center justify-between gap-4`,children:[(0,w.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,w.jsx)(Me,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,w.jsx)(r,{value:a,onChange:e=>l(e.target.value),placeholder:`Search skills by keyword, tag, or tool...`,className:`pl-9 pr-8 h-9 text-xs`}),a&&(0,w.jsx)(`button`,{onClick:()=>l(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,w.jsx)(_e,{className:`h-3.5 w-3.5`})})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`span`,{children:[`Showing `,(0,w.jsx)(`strong`,{className:`text-foreground`,children:Q.length}),` of`,` `,(0,w.jsx)(`strong`,{className:`text-foreground`,children:H.length}),` skills`]}),Y&&(0,w.jsxs)(i,{variant:`secondary`,className:`text-[10px] uppercase font-mono`,children:[`Workspace Mode (`,X.size,` active)`]})]})]}),(0,w.jsx)(Pe,{className:`flex-1 p-6`,children:Je||Ye||Y&&Ze?(0,w.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,w.jsx)(ve,{}),(0,w.jsx)(`span`,{className:`text-sm`,children:`Loading skills catalog...`})]}):Y&&Qe?(0,w.jsx)(Ae,{className:`py-12 border border-dashed rounded-xl`,children:(0,w.jsxs)(ke,{children:[(0,w.jsx)(ge,{children:`Workspace resources could not be loaded`}),(0,w.jsx)(Ee,{children:`Assignment controls are disabled so an existing selection cannot be overwritten.`})]})}):Q.length===0&&a?(0,w.jsxs)(Ae,{className:`py-12 border border-dashed rounded-xl`,children:[(0,w.jsx)(Se,{children:(0,w.jsx)(Me,{className:`h-8 w-8 text-muted-foreground/60`})}),(0,w.jsxs)(ke,{children:[(0,w.jsx)(ge,{children:`No matching skills found`}),(0,w.jsxs)(Ee,{children:[`No skills matched your search query "`,a,`".`]})]}),(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>l(``),children:`Clear Search`})]}):(0,w.jsxs)(`div`,{className:`space-y-6 max-w-7xl mx-auto pb-12`,children:[V.map(e=>{let t=T[e.icon||`boxes`]||m,n=it[e.id]||[],r=!!te[e.id],a=qe===e.id,c=n.length>0&&n.every(e=>X.has(e.id));return(0,w.jsxs)(`div`,{onDragOver:t=>vt(t,e.id),onDragLeave:yt,onDrop:t=>bt(t,e.id),className:o(`border rounded-xl transition-all duration-150 overflow-hidden bg-card/60`,a?`border-primary ring-2 ring-primary/20 bg-primary/5`:`border-border`),children:[(0,w.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>rt(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),rt(e.id))},className:`p-4 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors border-b border-border/40 select-none`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`p-2 rounded-lg text-white shadow-sm flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,w.jsx)(t,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`h2`,{className:`font-semibold text-sm tracking-tight`,children:e.name}),(0,w.jsxs)(i,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[n.length,` `,n.length===1?`skill`:`skills`]}),e.isTemplate&&!e.custom&&(0,w.jsx)(i,{variant:`secondary`,className:`text-[9px] px-1 py-0 uppercase`,children:`Template`})]}),e.description&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[Y&&n.length>0&&(0,w.jsxs)(s,{variant:`ghost`,size:`xs`,onClick:()=>ht(e.id,!c),className:`h-7 text-xs mr-2 text-muted-foreground hover:text-foreground`,title:c?`Deselect all in category`:`Select all in category`,children:[c?(0,w.jsx)(oe,{className:`h-3.5 w-3.5 mr-1 text-primary`}):(0,w.jsx)(Te,{className:`h-3.5 w-3.5 mr-1`}),(0,w.jsx)(`span`,{children:c?`Deselect All`:`Select All`})]}),!Y&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:()=>$(void 0,e.id),title:`Add skill to this category`,children:(0,w.jsx)(Ne,{className:`h-3.5 w-3.5`})}),!Y&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:()=>ot(e),title:`Edit category`,children:(0,w.jsx)(ne,{className:`h-3 w-3`})}),!Y&&e.custom&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>ct(e,t),title:`Delete category`,className:`text-destructive hover:text-destructive`,children:(0,w.jsx)(d,{className:`h-3 w-3`})}),(0,w.jsx)(`div`,{className:`p-1 text-muted-foreground`,children:r?(0,w.jsx)(le,{className:`h-4 w-4`}):(0,w.jsx)(ee,{className:`h-4 w-4`})})]})]}),!r&&(0,w.jsx)(`div`,{className:`p-4 bg-background/50`,children:n.length===0?(0,w.jsxs)(`div`,{className:`border border-dashed border-border/80 rounded-lg p-6 text-center text-xs text-muted-foreground`,children:[`No skills in this category.`,!Y&&(0,w.jsxs)(w.Fragment,{children:[` `,`Drag a custom skill here, or click`,` `,(0,w.jsx)(`button`,{onClick:()=>$(void 0,e.id),className:`text-primary underline font-medium`,children:`+ Add Skill`})]})]}):(0,w.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:n.map(e=>{let t=X.has(e.id);return(0,w.jsxs)(Ie,{draggable:!Y&&!!e.custom,onDragStart:t=>{!Y&&e.custom&&_t(t,e.id)},onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:o(`group relative cursor-pointer hover:border-primary/60 transition-all p-3.5 flex flex-col justify-between select-none shadow-sm`,Y&&!t&&`opacity-60 bg-muted/20`,Ge===e.id&&`opacity-40 border-dashed`),children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground group-hover:text-foreground cursor-grab active:cursor-grabbing`,title:`Drag to reorder or re-categorize`,"aria-label":`Drag handle`,children:[(0,w.jsx)(Re,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:e.title||e.name})]}),Y?(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(i,{variant:`outline`,className:o(`text-[9px] font-mono px-1 py-0.2 uppercase`,e.scope===`workspace`?`border-amber-500/40 text-amber-300 bg-amber-500/10`:`border-blue-500/40 text-blue-300 bg-blue-500/10`),children:e.scope===`workspace`?`Workspace`:`Global`}),(0,w.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),pt(e.id)},disabled:!Z||J.isPending,className:o(`h-5 px-2 rounded-md flex items-center gap-1 text-[10px] font-semibold transition-colors`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),children:[(0,w.jsx)(de,{className:o(`h-3 w-3`,!t&&`opacity-0`)}),(0,w.jsx)(`span`,{children:t?`Enabled`:`Disabled`})]})]}):(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(i,{variant:`outline`,className:o(`text-[9px] font-mono px-1 py-0.2 uppercase`,e.scope===`workspace`?`border-amber-500/40 text-amber-300 bg-amber-500/10`:`border-blue-500/40 text-blue-300 bg-blue-500/10`),children:e.scope===`workspace`?`Workspace`:`Global`}),(0,w.jsx)(i,{variant:`outline`,className:`text-[10px] font-mono`,children:e.custom?`Custom`:`Template`})]})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-3 leading-relaxed`,children:e.description||`No description provided.`})]}),(0,w.jsxs)(`div`,{className:`pt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags?.slice(0,3).map(e=>(0,w.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)),e.allowedTools&&e.allowedTools.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,w.jsx)(ze,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[!Y&&e.custom&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>xt(e,t),title:`Move to another category`,className:`h-6 w-6 text-muted-foreground hover:text-foreground`,children:(0,w.jsx)(Le,{className:`h-3 w-3`})}),e.custom&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>dt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive cursor-pointer`,children:(0,w.jsx)(d,{className:`h-3 w-3`})})]})]})]},e.id)})})})]},e.id)}),at.length>0&&(0,w.jsxs)(`div`,{className:`border border-border/80 rounded-xl overflow-hidden bg-card/60`,children:[(0,w.jsx)(`div`,{className:`p-4 bg-muted/30 border-b border-border/40 flex items-center justify-between`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(m,{className:`h-4 w-4 text-muted-foreground`}),(0,w.jsx)(`h2`,{className:`font-semibold text-sm`,children:`Uncategorized Skills`}),(0,w.jsx)(i,{variant:`outline`,className:`text-[10px]`,children:at.length})]})}),(0,w.jsx)(`div`,{className:`p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:at.map(e=>(0,w.jsxs)(Ie,{onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:`p-3.5 cursor-pointer hover:border-primary/60 flex flex-col justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,w.jsx)(`div`,{className:`font-mono text-xs font-bold`,children:e.title||e.name}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(i,{variant:`outline`,className:o(`text-[9px] font-mono px-1 py-0.2 uppercase`,e.scope===`workspace`?`border-amber-500/40 text-amber-300 bg-amber-500/10`:`border-blue-500/40 text-blue-300 bg-blue-500/10`),children:e.scope===`workspace`?`Workspace`:`Global`}),Y&&(0,w.jsx)(s,{size:`xs`,variant:X.has(e.id)?`default`:`outline`,disabled:!Z||J.isPending,onClick:t=>{t.stopPropagation(),pt(e.id)},children:X.has(e.id)?`Enabled`:`Disabled`})]})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,w.jsxs)(`div`,{className:`pt-2 mt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags&&e.tags.length>0?e.tags.slice(0,3).map(e=>(0,w.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)):(0,w.jsx)(`span`,{className:`text-[10px] text-muted-foreground italic`,children:`No tags`}),e.allowedTools&&e.allowedTools.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,w.jsx)(ze,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),e.custom&&(0,w.jsx)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>dt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive cursor-pointer`,children:(0,w.jsx)(d,{className:`h-3 w-3`})})})]})]},e.id))})]})]})}),(0,w.jsx)(g,{open:ae,onOpenChange:u,children:(0,w.jsxs)(h,{className:`sm:max-w-lg`,children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(x,{children:f?.id?`Edit Skill Category`:`Create Skill Category`}),(0,w.jsx)(y,{children:`Categories group related procedural skills and agent tools into clean visual boxes.`})]}),(0,w.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`cat-name`,className:`text-xs font-medium`,children:`Category Name`}),(0,w.jsx)(r,{id:`cat-name`,value:f?.name||``,onChange:e=>p(t=>t?{...t,name:e.target.value}:null),placeholder:`e.g. Pull Requests & Review`,className:`mt-1 text-xs`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`cat-desc`,className:`text-xs font-medium`,children:`Description`}),(0,w.jsx)(r,{id:`cat-desc`,value:f?.description||``,onChange:e=>p(t=>t?{...t,description:e.target.value}:null),placeholder:`Brief summary of what skills belong in this box...`,className:`mt-1 text-xs`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{className:`text-xs font-medium`,children:`Icon`}),(0,w.jsx)(`div`,{className:`grid grid-cols-6 gap-2 mt-1.5`,children:Object.keys(T).map(e=>{let t=T[e],n=(f?.icon||`boxes`)===e;return(0,w.jsx)(`button`,{type:`button`,onClick:()=>p(t=>t?{...t,icon:e}:null),className:o(`p-2.5 rounded-lg border flex items-center justify-center transition-colors`,n?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted text-muted-foreground`),children:(0,w.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{className:`text-xs font-medium`,children:`Color Accent`}),(0,w.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5 flex-wrap`,children:Be.map(e=>{let t=f?.color===e.value;return(0,w.jsx)(`button`,{type:`button`,"aria-label":`Select color ${e.label}`,onClick:()=>p(t=>t?{...t,color:e.value}:null),className:o(`w-7 h-7 rounded-full transition-transform flex items-center justify-center shadow-sm`,t?`scale-110 ring-2 ring-primary ring-offset-2`:`hover:scale-105`),style:{backgroundColor:e.value},children:t&&(0,w.jsx)(de,{className:`h-3.5 w-3.5 text-white`})},e.value)})})]})]}),(0,w.jsxs)(v,{children:[(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>u(!1),children:`Cancel`}),(0,w.jsx)(s,{variant:`default`,size:`sm`,onClick:st,disabled:!f?.name?.trim(),children:`Save Category`})]})]})}),(0,w.jsx)(g,{open:be,onOpenChange:b,children:(0,w.jsxs)(h,{className:`max-w-[96vw] sm:max-w-5xl lg:max-w-6xl xl:max-w-7xl h-[90vh] max-h-[92vh] flex flex-col p-6`,children:[(0,w.jsx)(_,{className:`pb-3 border-b border-border/70 shrink-0`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(x,{className:`text-base font-bold flex items-center gap-2`,children:[(0,w.jsx)(xe,{className:`h-4 w-4 text-primary`}),(0,w.jsx)(`span`,{children:E?.id?`Edit Skill Package`:`Create New Skill`})]}),(0,w.jsx)(y,{className:`text-xs text-muted-foreground mt-0.5`,children:`Configure SKILL.md metadata triggers and markdown playbook instructions.`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/60 p-1 rounded-lg border border-border text-xs`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>k(`edit`),className:o(`px-3 py-1.5 rounded-md flex items-center gap-1.5 font-medium transition-colors cursor-pointer`,O===`edit`?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,w.jsx)(se,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`Edit`})]}),(0,w.jsxs)(`button`,{type:`button`,onClick:()=>k(`preview`),className:o(`px-3 py-1.5 rounded-md flex items-center gap-1.5 font-medium transition-colors cursor-pointer`,O===`preview`?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,w.jsx)(re,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`Preview`})]})]})]})}),(0,w.jsxs)(`div`,{className:`flex-1 min-h-0 py-4 flex flex-col lg:flex-row gap-6 overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`lg:w-[420px] xl:w-[460px] shrink-0 flex flex-col gap-4 overflow-y-auto pr-2 pb-2`,children:[(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,w.jsx)(r,{id:`skill-title`,value:E?.title||``,onChange:e=>lt(e.target.value),placeholder:`e.g. Pull Request Reviewer`,className:`mt-1 text-xs`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,w.jsx)(r,{id:`skill-name`,value:E?.name||``,disabled:!!E?.id,onChange:e=>{He(!0),D(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. pr-review-toolkit`,className:`mt-1 text-xs font-mono`})]})]}),(0,w.jsxs)(`div`,{className:`p-3 rounded-lg border border-border/80 bg-muted/20 space-y-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(S,{className:`text-xs font-semibold text-foreground flex items-center gap-1.5`,children:[(0,w.jsx)(m,{className:`h-3.5 w-3.5 text-primary`}),(0,w.jsx)(`span`,{children:`Skill Scope`})]}),(0,w.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:A===`global`?`Machine-wide catalog`:`Project-specific (.agents/skills/)`})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>j(`global`),className:o(`flex items-center justify-center gap-2 p-2 rounded-lg border text-xs font-medium transition-all cursor-pointer`,A===`global`?`border-blue-500/50 bg-blue-500/15 text-blue-300 font-semibold shadow-xs`:`border-border/60 bg-card/60 text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:(0,w.jsx)(`span`,{children:`🌐 Global Catalog`})}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>j(`workspace`),className:o(`flex items-center justify-center gap-2 p-2 rounded-lg border text-xs font-medium transition-all cursor-pointer`,A===`workspace`?`border-amber-500/50 bg-amber-500/15 text-amber-300 font-semibold shadow-xs`:`border-border/60 bg-card/60 text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:(0,w.jsx)(`span`,{children:`📁 Workspace-Local`})})]}),A===`workspace`&&(0,w.jsxs)(`div`,{className:`pt-1`,children:[(0,w.jsx)(S,{htmlFor:`target-ws`,className:`text-[11px] font-medium text-muted-foreground`,children:`Target Workspace:`}),U.length>0?(0,w.jsx)(`select`,{id:`target-ws`,value:M,onChange:e=>N(e.target.value),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-primary text-foreground`,children:U.map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))}):(0,w.jsx)(`div`,{className:`mt-1 text-xs text-destructive italic`,children:`No active workspaces found. Please create a workspace first.`})]})]}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-cat`,className:`text-xs font-medium`,children:`Category Box`}),(0,w.jsx)(`select`,{id:`skill-cat`,value:E?.category||``,onChange:e=>D(t=>t?{...t,category:e.target.value}:null),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary`,children:V.map(e=>(0,w.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(S,{htmlFor:`skill-tags`,className:`text-xs font-medium`,children:`Tags & Domain Categories`}),(0,w.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Click chips below to toggle`})]}),(0,w.jsx)(r,{id:`skill-tags`,value:E?.tags?.join(`, `)||``,onChange:e=>D(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. nexusflow, core, cli, testing`,className:`mt-1 text-xs font-mono`})]}),$e.length>0&&(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Quick Tag Assignment:`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1 max-h-24 overflow-y-auto pr-1`,children:$e.map(e=>{let t=E?.tags?.includes(e);return(0,w.jsxs)(`button`,{type:`button`,onClick:()=>{D(n=>{if(!n)return null;let r=n.tags||[],i=t?r.filter(t=>t!==e):[...r,e];return{...n,tags:i}})},className:o(`px-2 py-0.5 rounded-md text-[11px] font-mono transition-colors cursor-pointer border`,t?`bg-primary/20 text-primary border-primary/40 font-semibold shadow-xs`:`bg-muted/40 text-muted-foreground border-border/60 hover:bg-muted hover:text-foreground`),children:[`#`,e]},e)})})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (for AI Autonomous Discovery)`}),(0,w.jsx)(Oe,{id:`skill-desc`,rows:3,value:E?.description||``,onChange:e=>D(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when reviewing PR diffs or when user asks for a PR audit...`,className:`mt-1 text-xs leading-relaxed resize-none`})]})]}),(0,w.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-[380px] lg:min-h-0 border-t lg:border-t-0 lg:border-l border-border/70 pt-4 lg:pt-0 lg:pl-6`,children:O===`edit`?(0,w.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 h-full`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between pb-2 shrink-0`,children:[(0,w.jsxs)(S,{htmlFor:`skill-content`,className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,w.jsx)(c,{className:`h-3.5 w-3.5 text-primary`}),(0,w.jsx)(`span`,{children:`Playbook Instructions (Markdown)`})]}),(0,w.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[(E?.content||``).split(`
5
- `).length,` lines · `,(E?.content||``).length,` characters`]})]}),(0,w.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-2 leading-relaxed`,children:[`Frontmatter (`,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`name`}),`,`,` `,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`description`}),`,`,` `,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`tags`}),`) is managed in the Metadata panel on the left and auto-injected into`,` `,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`SKILL.md`}),` on save.`]}),(0,w.jsx)(Oe,{id:`skill-content`,value:E?.content||``,onChange:e=>D(t=>t?{...t,content:e.target.value}:null),placeholder:`# Playbook Title
4
+ `,custom:!0,scope:r}),He(!!e),k(`edit`),x(!0)};(0,C.useEffect)(()=>{!M&&U.length>0&&N(U[0].id)},[U,M]);let lt=e=>{if(!E)return;let t={...E,title:e};!Ve&&!E.id&&(t.name=e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-+|-+$/g,``)),D(t)},ut=async()=>{if(!E||!E.name?.trim()||!E.description?.trim()||!E.content?.trim()){e?.(`Skill name, trigger description, and content are required`,`error`);return}if(A===`workspace`&&!M){e?.(`Please select a target workspace for workspace-local skill`,`error`);return}try{await q.mutateAsync({id:E.id,name:E.name.trim(),title:E.title||E.name,category:E.category||`general`,description:E.description||``,tags:E.tags||[],allowedTools:E.allowedTools||[],content:E.content,scope:A,workspaceId:A===`workspace`?M:void 0}),e?.(A===`workspace`?`Workspace skill saved successfully in .agents/skills/`:`Global skill package saved successfully`,`success`),x(!1),D(null)}catch(t){e?.(t?.message||`Failed to save skill`,`error`),console.error(t)}},dt=(e,n)=>{n.stopPropagation();let r=e.scope===`workspace`||A===`workspace`?t===`global`?M||void 0:t:void 0;z({type:`skill`,id:e.id,title:e.title||e.name,workspaceId:r}),L(!0)},ft=async()=>{if(R)try{R.type===`category`?(await tt.mutateAsync(R.id),e?.(`Category deleted`,`info`)):(await nt.mutateAsync({id:R.id,workspaceId:R.workspaceId}),e?.(`Skill package deleted`,`info`)),L(!1),z(null)}catch(t){e?.(t?.message||`Failed to delete item`,`error`),console.error(t)}},pt=e=>{if(!Y||!Z||G===null)return;let t=new Set(G);t.has(e)?t.delete(e):t.add(e),K(Array.from(t))},mt=()=>{if(!E||E.custom!==!1)return;let e=`${E.name}-copy`;D({...E,id:void 0,name:e,title:`${E.title||E.name} Copy`,allowedTools:[],custom:!0,sourcePath:void 0,references:void 0,scripts:void 0}),He(!0)},ht=(e,t)=>{if(!Y||!Z||G===null)return;let n=it[e]||[],r=new Set(G);for(let e of n)t?r.add(e.id):r.delete(e.id);K(Array.from(r))},gt=async()=>{if(!(!W||G===null||!Y))try{await J.mutateAsync({workspaceId:t,expectedRevision:W.revision??0,enabledSkills:G,enabledAgents:W.enabledAgents??[],enabledCategories:V.map(e=>e.id)}),e?.(`Skill selection saved. Refresh the workspace to apply it.`,`success`)}catch(t){e?.(t instanceof Error?t.message:`Failed to save skill selection`,`error`)}},_t=(e,t)=>{e.dataTransfer.setData(`text/plain`,t),e.dataTransfer.effectAllowed=`move`,Ke(t)},vt=(e,t)=>{e.preventDefault(),e.dataTransfer.dropEffect=`move`,qe!==t&&B(t)},yt=()=>{B(null)},bt=async(t,n)=>{t.preventDefault(),B(null);let r=t.dataTransfer.getData(`text/plain`)||Ge;if(Ke(null),!r)return;let i=H.find(e=>e.id===r);!i||!i.custom||Y||i.category===n||(await q.mutateAsync({id:i.id,name:i.name,title:i.title,description:i.description,tags:i.tags,allowedTools:i.allowedTools,content:i.content,category:n}),e?.(`Skill re-categorized`,`success`))},xt=(e,t)=>{t.stopPropagation(),I(e),P(!0)},St=async t=>{if(!F||F.category===t){P(!1),I(null);return}await q.mutateAsync({id:F.id,name:F.name,title:F.title,description:F.description,tags:F.tags,allowedTools:F.allowedTools,content:F.content,category:t}),e?.(`Skill moved to category`,`success`),P(!1),I(null)};return(0,w.jsxs)(`div`,{className:`flex-1 flex flex-col h-full overflow-hidden bg-background text-foreground`,children:[(0,w.jsxs)(`div`,{className:`p-6 border-b border-border flex flex-col sm:flex-row sm:items-center justify-between gap-4 bg-card/40 backdrop-blur-sm`,children:[(0,w.jsx)(`div`,{children:(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`p-2 rounded-xl bg-primary/10 text-primary`,children:(0,w.jsx)(f,{className:`h-6 w-6`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`h1`,{className:`text-xl font-bold tracking-tight`,children:`Skill Library`}),(0,w.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Create, organize, and assign reusable Agent Skill packages.`})]})]})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-3 flex-wrap`,children:[(0,w.jsx)(s,{render:(0,w.jsx)(pe,{to:`/agents`}),variant:`outline`,size:`sm`,children:`Codex Agents`}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 bg-muted/50 rounded-lg px-3 py-1.5 border border-border`,children:[(0,w.jsx)(Ne,{className:`h-4 w-4 text-muted-foreground`}),(0,w.jsx)(S,{htmlFor:`skill-scope`,className:`text-xs font-medium text-muted-foreground`,children:`Scope:`}),(0,w.jsxs)(`select`,{id:`skill-scope`,value:t,onChange:e=>n(e.target.value),className:`bg-transparent text-xs font-semibold focus:outline-none cursor-pointer text-foreground`,children:[(0,w.jsx)(`option`,{value:`global`,className:`bg-popover text-popover-foreground`,children:`🌐 Global Skills Catalog`}),U.map(e=>(0,w.jsxs)(`option`,{value:e.id,className:`bg-popover text-popover-foreground`,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))]})]}),!Y&&(0,w.jsxs)(s,{variant:`outline`,size:`sm`,onClick:()=>ot(),className:`flex items-center gap-1.5`,children:[(0,w.jsx)(ye,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`New Category`})]}),Y&&(0,w.jsx)(s,{size:`sm`,onClick:gt,disabled:!Z||J.isPending||G===null,children:J.isPending?`Saving…`:`Save selection`}),(0,w.jsxs)(s,{variant:`default`,size:`sm`,onClick:()=>$(),className:`flex items-center gap-1.5`,children:[(0,w.jsx)(_e,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`New Skill`})]})]})]}),(0,w.jsxs)(`div`,{className:`px-6 py-3 border-b border-border/60 bg-muted/20 flex items-center justify-between gap-4`,children:[(0,w.jsxs)(`div`,{className:`relative flex-1 max-w-md`,children:[(0,w.jsx)(ve,{className:`absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground`}),(0,w.jsx)(r,{value:a,onChange:e=>l(e.target.value),placeholder:`Search skills by keyword, tag, or tool...`,className:`pl-9 pr-8 h-9 text-xs`}),a&&(0,w.jsx)(`button`,{onClick:()=>l(``),className:`absolute right-2.5 top-1/2 -translate-y-1/2 text-muted-foreground hover:text-foreground`,children:(0,w.jsx)(me,{className:`h-3.5 w-3.5`})})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-muted-foreground`,children:[(0,w.jsxs)(`span`,{children:[`Showing `,(0,w.jsx)(`strong`,{className:`text-foreground`,children:Q.length}),` of`,` `,(0,w.jsx)(`strong`,{className:`text-foreground`,children:H.length}),` skills`]}),Y&&(0,w.jsxs)(i,{variant:`secondary`,className:`text-[10px] uppercase font-mono`,children:[`Workspace Mode (`,X.size,` active)`]})]})]}),(0,w.jsx)(Pe,{className:`flex-1 p-6`,children:Je||Ye||Y&&Ze?(0,w.jsxs)(`div`,{className:`flex items-center justify-center p-12 gap-3 text-muted-foreground`,children:[(0,w.jsx)(Ae,{}),(0,w.jsx)(`span`,{className:`text-sm`,children:`Loading skills catalog...`})]}):Y&&Qe?(0,w.jsx)(Me,{className:`py-12 border border-dashed rounded-xl`,children:(0,w.jsxs)(je,{children:[(0,w.jsx)(ge,{children:`Workspace resources could not be loaded`}),(0,w.jsx)(Ee,{children:`Assignment controls are disabled so an existing selection cannot be overwritten.`})]})}):Q.length===0&&a?(0,w.jsxs)(Me,{className:`py-12 border border-dashed rounded-xl`,children:[(0,w.jsx)(Ce,{children:(0,w.jsx)(ve,{className:`h-8 w-8 text-muted-foreground/60`})}),(0,w.jsxs)(je,{children:[(0,w.jsx)(ge,{children:`No matching skills found`}),(0,w.jsxs)(Ee,{children:[`No skills matched your search query "`,a,`".`]})]}),(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>l(``),children:`Clear Search`})]}):(0,w.jsxs)(`div`,{className:`space-y-6 max-w-7xl mx-auto pb-12`,children:[V.map(e=>{let t=T[e.icon||`boxes`]||f,n=it[e.id]||[],r=!!te[e.id],a=qe===e.id,c=n.length>0&&n.every(e=>X.has(e.id));return(0,w.jsxs)(`div`,{onDragOver:t=>vt(t,e.id),onDragLeave:yt,onDrop:t=>bt(t,e.id),className:o(`border rounded-xl transition-all duration-150 overflow-hidden bg-card/60`,a?`border-primary ring-2 ring-primary/20 bg-primary/5`:`border-border`),children:[(0,w.jsxs)(`div`,{role:`button`,tabIndex:0,"aria-expanded":!r,onClick:()=>rt(e.id),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),rt(e.id))},className:`p-4 flex items-center justify-between cursor-pointer hover:bg-muted/40 transition-colors border-b border-border/40 select-none`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`p-2 rounded-lg text-white shadow-sm flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,w.jsx)(t,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(`h2`,{className:`font-semibold text-sm tracking-tight`,children:e.name}),(0,w.jsxs)(i,{variant:`outline`,className:`text-[10px] px-1.5 py-0`,children:[n.length,` `,n.length===1?`skill`:`skills`]}),e.isTemplate&&!e.custom&&(0,w.jsx)(i,{variant:`secondary`,className:`text-[9px] px-1 py-0 uppercase`,children:`Template`})]}),e.description&&(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground mt-0.5`,children:e.description})]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[Y&&n.length>0&&(0,w.jsxs)(s,{variant:`ghost`,size:`xs`,onClick:()=>ht(e.id,!c),className:`h-7 text-xs mr-2 text-muted-foreground hover:text-foreground`,title:c?`Deselect all in category`:`Select all in category`,children:[c?(0,w.jsx)(oe,{className:`h-3.5 w-3.5 mr-1 text-primary`}):(0,w.jsx)(we,{className:`h-3.5 w-3.5 mr-1`}),(0,w.jsx)(`span`,{children:c?`Deselect All`:`Select All`})]}),!Y&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:()=>$(void 0,e.id),title:`Add skill to this category`,children:(0,w.jsx)(ye,{className:`h-3.5 w-3.5`})}),!Y&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:()=>ot(e),title:`Edit category`,children:(0,w.jsx)(ne,{className:`h-3 w-3`})}),!Y&&e.custom&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>ct(e,t),title:`Delete category`,className:`text-destructive hover:text-destructive`,children:(0,w.jsx)(d,{className:`h-3 w-3`})}),(0,w.jsx)(`div`,{className:`p-1 text-muted-foreground`,children:r?(0,w.jsx)(fe,{className:`h-4 w-4`}):(0,w.jsx)(ee,{className:`h-4 w-4`})})]})]}),!r&&(0,w.jsx)(`div`,{className:`p-4 bg-background/50`,children:n.length===0?(0,w.jsxs)(`div`,{className:`border border-dashed border-border/80 rounded-lg p-6 text-center text-xs text-muted-foreground`,children:[`No skills in this category.`,!Y&&(0,w.jsxs)(w.Fragment,{children:[` `,`Drag a custom skill here, or click`,` `,(0,w.jsx)(`button`,{onClick:()=>$(void 0,e.id),className:`text-primary underline font-medium`,children:`+ Add Skill`})]})]}):(0,w.jsx)(`div`,{className:`grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:n.map(e=>{let t=X.has(e.id);return(0,w.jsxs)(Ie,{draggable:!Y&&!!e.custom,onDragStart:t=>{!Y&&e.custom&&_t(t,e.id)},onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:o(`group relative cursor-pointer hover:border-primary/60 transition-all p-3.5 flex flex-col justify-between select-none shadow-sm`,Y&&!t&&`opacity-60 bg-muted/20`,Ge===e.id&&`opacity-40 border-dashed`),children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between gap-2 mb-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 text-muted-foreground group-hover:text-foreground cursor-grab active:cursor-grabbing`,title:`Drag to reorder or re-categorize`,"aria-label":`Drag handle`,children:[(0,w.jsx)(Re,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{className:`font-mono text-xs font-bold text-foreground`,children:e.title||e.name})]}),Y?(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(i,{variant:`outline`,className:o(`text-[9px] font-mono px-1 py-0.2 uppercase`,e.scope===`workspace`?`border-amber-500/40 text-amber-300 bg-amber-500/10`:`border-blue-500/40 text-blue-300 bg-blue-500/10`),children:e.scope===`workspace`?`Workspace`:`Global`}),(0,w.jsxs)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),pt(e.id)},disabled:!Z||J.isPending,className:o(`h-5 px-2 rounded-md flex items-center gap-1 text-[10px] font-semibold transition-colors`,t?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground hover:bg-muted/80`),children:[(0,w.jsx)(de,{className:o(`h-3 w-3`,!t&&`opacity-0`)}),(0,w.jsx)(`span`,{children:t?`Enabled`:`Disabled`})]})]}):(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(i,{variant:`outline`,className:o(`text-[9px] font-mono px-1 py-0.2 uppercase`,e.scope===`workspace`?`border-amber-500/40 text-amber-300 bg-amber-500/10`:`border-blue-500/40 text-blue-300 bg-blue-500/10`),children:e.scope===`workspace`?`Workspace`:`Global`}),(0,w.jsx)(i,{variant:`outline`,className:`text-[10px] font-mono`,children:e.custom?`Custom`:`Template`})]})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2 mb-3 leading-relaxed`,children:e.description||`No description provided.`})]}),(0,w.jsxs)(`div`,{className:`pt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags?.slice(0,3).map(e=>(0,w.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)),e.allowedTools&&e.allowedTools.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,w.jsx)(ze,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:[!Y&&e.custom&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>xt(e,t),title:`Move to another category`,className:`h-6 w-6 text-muted-foreground hover:text-foreground`,children:(0,w.jsx)(Le,{className:`h-3 w-3`})}),e.custom&&(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>dt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive cursor-pointer`,children:(0,w.jsx)(d,{className:`h-3 w-3`})})]})]})]},e.id)})})})]},e.id)}),at.length>0&&(0,w.jsxs)(`div`,{className:`border border-border/80 rounded-xl overflow-hidden bg-card/60`,children:[(0,w.jsx)(`div`,{className:`p-4 bg-muted/30 border-b border-border/40 flex items-center justify-between`,children:(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(f,{className:`h-4 w-4 text-muted-foreground`}),(0,w.jsx)(`h2`,{className:`font-semibold text-sm`,children:`Uncategorized Skills`}),(0,w.jsx)(i,{variant:`outline`,className:`text-[10px]`,children:at.length})]})}),(0,w.jsx)(`div`,{className:`p-4 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-3.5`,children:at.map(e=>(0,w.jsxs)(Ie,{onClick:()=>$(e),role:`button`,tabIndex:0,onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),$(e))},className:`p-3.5 cursor-pointer hover:border-primary/60 flex flex-col justify-between`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`mb-1 flex items-center justify-between gap-2`,children:[(0,w.jsx)(`div`,{className:`font-mono text-xs font-bold`,children:e.title||e.name}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,w.jsx)(i,{variant:`outline`,className:o(`text-[9px] font-mono px-1 py-0.2 uppercase`,e.scope===`workspace`?`border-amber-500/40 text-amber-300 bg-amber-500/10`:`border-blue-500/40 text-blue-300 bg-blue-500/10`),children:e.scope===`workspace`?`Workspace`:`Global`}),Y&&(0,w.jsx)(s,{size:`xs`,variant:X.has(e.id)?`default`:`outline`,disabled:!Z||J.isPending,onClick:t=>{t.stopPropagation(),pt(e.id)},children:X.has(e.id)?`Enabled`:`Disabled`})]})]}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground line-clamp-2`,children:e.description})]}),(0,w.jsxs)(`div`,{className:`pt-2 mt-2 border-t border-border/40 flex items-center justify-between gap-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-1.5 flex-wrap overflow-hidden`,children:[e.tags&&e.tags.length>0?e.tags.slice(0,3).map(e=>(0,w.jsxs)(`span`,{className:`text-[10px] font-mono bg-muted px-1.5 py-0.5 rounded text-muted-foreground`,children:[`#`,e]},e)):(0,w.jsx)(`span`,{className:`text-[10px] text-muted-foreground italic`,children:`No tags`}),e.allowedTools&&e.allowedTools.length>0&&(0,w.jsxs)(`span`,{className:`text-[10px] text-muted-foreground flex items-center gap-0.5 font-mono`,children:[(0,w.jsx)(ze,{className:`h-2.5 w-2.5`}),e.allowedTools.length]})]}),e.custom&&(0,w.jsx)(`div`,{className:`flex items-center gap-1`,onClick:e=>e.stopPropagation(),children:(0,w.jsx)(s,{variant:`ghost`,size:`icon-xs`,onClick:t=>dt(e,t),title:`Delete skill`,className:`h-6 w-6 text-destructive hover:text-destructive cursor-pointer`,children:(0,w.jsx)(d,{className:`h-3 w-3`})})})]})]},e.id))})]})]})}),(0,w.jsx)(y,{open:ae,onOpenChange:u,children:(0,w.jsxs)(b,{className:`sm:max-w-lg`,children:[(0,w.jsxs)(h,{children:[(0,w.jsx)(g,{children:p?.id?`Edit Skill Category`:`Create Skill Category`}),(0,w.jsx)(v,{children:`Categories group related procedural skills and agent tools into clean visual boxes.`})]}),(0,w.jsxs)(`div`,{className:`space-y-4 py-2`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`cat-name`,className:`text-xs font-medium`,children:`Category Name`}),(0,w.jsx)(r,{id:`cat-name`,value:p?.name||``,onChange:e=>m(t=>t?{...t,name:e.target.value}:null),placeholder:`e.g. Pull Requests & Review`,className:`mt-1 text-xs`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`cat-desc`,className:`text-xs font-medium`,children:`Description`}),(0,w.jsx)(r,{id:`cat-desc`,value:p?.description||``,onChange:e=>m(t=>t?{...t,description:e.target.value}:null),placeholder:`Brief summary of what skills belong in this box...`,className:`mt-1 text-xs`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{className:`text-xs font-medium`,children:`Icon`}),(0,w.jsx)(`div`,{className:`grid grid-cols-6 gap-2 mt-1.5`,children:Object.keys(T).map(e=>{let t=T[e],n=(p?.icon||`boxes`)===e;return(0,w.jsx)(`button`,{type:`button`,onClick:()=>m(t=>t?{...t,icon:e}:null),className:o(`p-2.5 rounded-lg border flex items-center justify-center transition-colors`,n?`border-primary bg-primary/10 text-primary`:`border-border hover:bg-muted text-muted-foreground`),children:(0,w.jsx)(t,{className:`h-4 w-4`})},e)})})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{className:`text-xs font-medium`,children:`Color Accent`}),(0,w.jsx)(`div`,{className:`flex items-center gap-2 mt-1.5 flex-wrap`,children:Be.map(e=>{let t=p?.color===e.value;return(0,w.jsx)(`button`,{type:`button`,"aria-label":`Select color ${e.label}`,onClick:()=>m(t=>t?{...t,color:e.value}:null),className:o(`w-7 h-7 rounded-full transition-transform flex items-center justify-center shadow-sm`,t?`scale-110 ring-2 ring-primary ring-offset-2`:`hover:scale-105`),style:{backgroundColor:e.value},children:t&&(0,w.jsx)(de,{className:`h-3.5 w-3.5 text-white`})},e.value)})})]})]}),(0,w.jsxs)(_,{children:[(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>u(!1),children:`Cancel`}),(0,w.jsx)(s,{variant:`default`,size:`sm`,onClick:st,disabled:!p?.name?.trim(),children:`Save Category`})]})]})}),(0,w.jsx)(y,{open:De,onOpenChange:x,children:(0,w.jsxs)(b,{className:`max-w-[96vw] sm:max-w-5xl lg:max-w-6xl xl:max-w-7xl h-[90vh] max-h-[92vh] flex flex-col p-6`,children:[(0,w.jsx)(h,{className:`pb-3 border-b border-border/70 shrink-0`,children:(0,w.jsxs)(`div`,{className:`flex items-center justify-between pr-8`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(g,{className:`text-base font-bold flex items-center gap-2`,children:[(0,w.jsx)(_e,{className:`h-4 w-4 text-primary`}),(0,w.jsx)(`span`,{children:E?.id?`Edit Skill Package`:`Create New Skill`})]}),(0,w.jsx)(v,{className:`text-xs text-muted-foreground mt-0.5`,children:`Configure SKILL.md metadata triggers and markdown playbook instructions.`})]}),(0,w.jsxs)(`div`,{className:`flex items-center gap-1 bg-muted/60 p-1 rounded-lg border border-border text-xs`,children:[(0,w.jsxs)(`button`,{type:`button`,onClick:()=>k(`edit`),className:o(`px-3 py-1.5 rounded-md flex items-center gap-1.5 font-medium transition-colors cursor-pointer`,O===`edit`?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,w.jsx)(se,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`Edit`})]}),(0,w.jsxs)(`button`,{type:`button`,onClick:()=>k(`preview`),className:o(`px-3 py-1.5 rounded-md flex items-center gap-1.5 font-medium transition-colors cursor-pointer`,O===`preview`?`bg-background text-foreground shadow-xs`:`text-muted-foreground hover:text-foreground`),children:[(0,w.jsx)(re,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`Preview`})]})]})]})}),(0,w.jsxs)(`div`,{className:`flex-1 min-h-0 py-4 flex flex-col lg:flex-row gap-6 overflow-hidden`,children:[(0,w.jsxs)(`div`,{className:`lg:w-[420px] xl:w-[460px] shrink-0 flex flex-col gap-4 overflow-y-auto pr-2 pb-2`,children:[(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-title`,className:`text-xs font-medium`,children:`Display Title`}),(0,w.jsx)(r,{id:`skill-title`,value:E?.title||``,onChange:e=>lt(e.target.value),placeholder:`e.g. Pull Request Reviewer`,className:`mt-1 text-xs`})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-name`,className:`text-xs font-medium`,children:`Identifier (Slug)`}),(0,w.jsx)(r,{id:`skill-name`,value:E?.name||``,disabled:!!E?.id,onChange:e=>{He(!0),D(t=>t?{...t,name:e.target.value}:null)},placeholder:`e.g. pr-review-toolkit`,className:`mt-1 text-xs font-mono`})]})]}),(0,w.jsxs)(`div`,{className:`p-3 rounded-lg border border-border/80 bg-muted/20 space-y-2`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsxs)(S,{className:`text-xs font-semibold text-foreground flex items-center gap-1.5`,children:[(0,w.jsx)(f,{className:`h-3.5 w-3.5 text-primary`}),(0,w.jsx)(`span`,{children:`Skill Scope`})]}),(0,w.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:A===`global`?`Machine-wide catalog`:`Project-specific (.agents/skills/)`})]}),(0,w.jsxs)(`div`,{className:`grid grid-cols-2 gap-2`,children:[(0,w.jsx)(`button`,{type:`button`,onClick:()=>j(`global`),className:o(`flex items-center justify-center gap-2 p-2 rounded-lg border text-xs font-medium transition-all cursor-pointer`,A===`global`?`border-blue-500/50 bg-blue-500/15 text-blue-300 font-semibold shadow-xs`:`border-border/60 bg-card/60 text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:(0,w.jsx)(`span`,{children:`🌐 Global Catalog`})}),(0,w.jsx)(`button`,{type:`button`,onClick:()=>j(`workspace`),className:o(`flex items-center justify-center gap-2 p-2 rounded-lg border text-xs font-medium transition-all cursor-pointer`,A===`workspace`?`border-amber-500/50 bg-amber-500/15 text-amber-300 font-semibold shadow-xs`:`border-border/60 bg-card/60 text-muted-foreground hover:bg-muted/60 hover:text-foreground`),children:(0,w.jsx)(`span`,{children:`📁 Workspace-Local`})})]}),A===`workspace`&&(0,w.jsxs)(`div`,{className:`pt-1`,children:[(0,w.jsx)(S,{htmlFor:`target-ws`,className:`text-[11px] font-medium text-muted-foreground`,children:`Target Workspace:`}),U.length>0?(0,w.jsx)(`select`,{id:`target-ws`,value:M,onChange:e=>N(e.target.value),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-1.5 text-xs focus:outline-none focus:ring-1 focus:ring-primary text-foreground`,children:U.map(e=>(0,w.jsxs)(`option`,{value:e.id,children:[`📁 `,e.id,` (`,e.branchName,`)`]},e.id))}):(0,w.jsx)(`div`,{className:`mt-1 text-xs text-destructive italic`,children:`No active workspaces found. Please create a workspace first.`})]})]}),(0,w.jsxs)(`div`,{className:`space-y-3`,children:[(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-cat`,className:`text-xs font-medium`,children:`Category Box`}),(0,w.jsx)(`select`,{id:`skill-cat`,value:E?.category||``,onChange:e=>D(t=>t?{...t,category:e.target.value}:null),className:`mt-1 w-full bg-background border border-border rounded-md px-3 py-2 text-xs focus:outline-none focus:ring-1 focus:ring-primary`,children:V.map(e=>(0,w.jsx)(`option`,{value:e.id,children:e.name},e.id))})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,w.jsx)(S,{htmlFor:`skill-tags`,className:`text-xs font-medium`,children:`Tags & Domain Categories`}),(0,w.jsx)(`span`,{className:`text-[10px] text-muted-foreground`,children:`Click chips below to toggle`})]}),(0,w.jsx)(r,{id:`skill-tags`,value:E?.tags?.join(`, `)||``,onChange:e=>D(t=>t?{...t,tags:e.target.value.split(`,`).map(e=>e.trim()).filter(Boolean)}:null),placeholder:`e.g. nexusflow, core, cli, testing`,className:`mt-1 text-xs font-mono`})]}),$e.length>0&&(0,w.jsxs)(`div`,{className:`space-y-1`,children:[(0,w.jsx)(`span`,{className:`text-[11px] text-muted-foreground`,children:`Quick Tag Assignment:`}),(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1 max-h-24 overflow-y-auto pr-1`,children:$e.map(e=>{let t=E?.tags?.includes(e);return(0,w.jsxs)(`button`,{type:`button`,onClick:()=>{D(n=>{if(!n)return null;let r=n.tags||[],i=t?r.filter(t=>t!==e):[...r,e];return{...n,tags:i}})},className:o(`px-2 py-0.5 rounded-md text-[11px] font-mono transition-colors cursor-pointer border`,t?`bg-primary/20 text-primary border-primary/40 font-semibold shadow-xs`:`bg-muted/40 text-muted-foreground border-border/60 hover:bg-muted hover:text-foreground`),children:[`#`,e]},e)})})]})]}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(S,{htmlFor:`skill-desc`,className:`text-xs font-medium`,children:`Trigger Description (for AI Autonomous Discovery)`}),(0,w.jsx)(ke,{id:`skill-desc`,rows:3,value:E?.description||``,onChange:e=>D(t=>t?{...t,description:e.target.value}:null),placeholder:`e.g. Use when reviewing PR diffs or when user asks for a PR audit...`,className:`mt-1 text-xs leading-relaxed resize-none`})]})]}),(0,w.jsx)(`div`,{className:`flex-1 min-w-0 flex flex-col min-h-[380px] lg:min-h-0 border-t lg:border-t-0 lg:border-l border-border/70 pt-4 lg:pt-0 lg:pl-6`,children:O===`edit`?(0,w.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 h-full`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between pb-2 shrink-0`,children:[(0,w.jsxs)(S,{htmlFor:`skill-content`,className:`text-xs font-semibold flex items-center gap-1.5`,children:[(0,w.jsx)(c,{className:`h-3.5 w-3.5 text-primary`}),(0,w.jsx)(`span`,{children:`Playbook Instructions (Markdown)`})]}),(0,w.jsxs)(`span`,{className:`text-[10px] text-muted-foreground font-mono`,children:[(E?.content||``).split(`
5
+ `).length,` lines · `,(E?.content||``).length,` characters`]})]}),(0,w.jsxs)(`p`,{className:`text-xs text-muted-foreground mb-2 leading-relaxed`,children:[`Frontmatter (`,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`name`}),`,`,` `,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`description`}),`,`,` `,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`tags`}),`) is managed in the Metadata panel on the left and auto-injected into`,` `,(0,w.jsx)(`code`,{className:`font-mono text-[11px] bg-muted/60 px-1 py-0.5 rounded text-foreground`,children:`SKILL.md`}),` on save.`]}),(0,w.jsx)(ke,{id:`skill-content`,value:E?.content||``,onChange:e=>D(t=>t?{...t,content:e.target.value}:null),placeholder:`# Playbook Title
6
6
 
7
- Detailed instructions for the AI assistant...`,className:`flex-1 w-full min-h-[360px] lg:min-h-full font-mono text-xs leading-relaxed resize-none focus:ring-1 focus:ring-primary`})]}):(0,w.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 h-full`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between pb-2 shrink-0`,children:[(0,w.jsxs)(`span`,{className:`text-xs font-semibold flex items-center gap-1.5 text-foreground`,children:[(0,w.jsx)(re,{className:`h-3.5 w-3.5 text-primary`}),(0,w.jsx)(`span`,{children:`Documentation Preview`})]}),(0,w.jsx)(i,{variant:`outline`,className:`text-[10px] font-mono`,children:`SKILL.md`})]}),(0,w.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-5 border rounded-lg bg-card/40 prose prose-sm dark:prose-invert max-w-none`,children:[(0,w.jsxs)(`div`,{className:`mb-4 pb-3 border-b border-border/70`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-bold m-0 text-foreground`,children:E?.title||E?.name}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground m-0 mt-1`,children:E?.description}),E?.tags&&E.tags.length>0&&(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2.5`,children:E.tags.map(e=>(0,w.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-muted text-[11px] font-mono text-muted-foreground`,children:[`#`,e]},e))})]}),(0,w.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap font-sans bg-transparent p-0 border-0 leading-relaxed`,children:E?.content||`*(No playbook markdown provided)*`})]})]})})]}),(0,w.jsxs)(v,{className:`mt-4 pt-3 border-t flex items-center justify-between sm:justify-between w-full`,children:[(0,w.jsx)(`div`,{children:E?.id&&E?.custom&&(0,w.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,onClick:e=>{let t=E;b(!1),dt(t,e)},className:`text-destructive hover:bg-destructive/10 border-destructive/30 text-xs gap-1.5`,children:[(0,w.jsx)(d,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`Delete Skill`})]})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>b(!1),children:`Cancel`}),(0,w.jsx)(s,{variant:`default`,size:`sm`,onClick:E?.custom===!1?mt:ut,disabled:!E?.name?.trim()||!E?.description?.trim()||!E?.content?.trim(),children:E?.custom===!1?`Create editable copy`:`Save Skill`})]})]})]})}),(0,w.jsx)(g,{open:Ue,onOpenChange:P,children:(0,w.jsxs)(h,{className:`sm:max-w-md`,children:[(0,w.jsxs)(_,{children:[(0,w.jsx)(x,{children:`Move Skill to Category`}),(0,w.jsxs)(y,{children:[`Select the destination category box for "`,F?.title||F?.name,`".`]})]}),(0,w.jsx)(`div`,{className:`space-y-2 py-2`,children:V.map(e=>{let t=T[e.icon||`boxes`]||m,n=F?.category===e.id;return(0,w.jsxs)(`button`,{type:`button`,onClick:()=>St(e.id),className:o(`w-full p-3 rounded-lg border text-left flex items-center justify-between transition-colors`,n?`border-primary bg-primary/10`:`border-border hover:bg-muted/50 text-foreground`),children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`p-1.5 rounded text-white flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,w.jsx)(t,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`font-semibold text-xs`,children:e.name}),e.description&&(0,w.jsx)(`div`,{className:`text-[11px] text-muted-foreground line-clamp-1`,children:e.description})]})]}),n&&(0,w.jsx)(i,{variant:`secondary`,className:`text-[10px]`,children:`Current`})]},e.id)})}),(0,w.jsx)(v,{children:(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>P(!1),children:`Cancel`})})]})}),(0,w.jsx)(g,{open:We,onOpenChange:L,children:(0,w.jsxs)(h,{className:`sm:max-w-md`,children:[(0,w.jsxs)(_,{children:[(0,w.jsxs)(x,{className:`text-destructive`,children:[`Delete `,R?.type===`category`?`Category`:R?.workspaceId?`Workspace Skill`:`Global Skill`]}),(0,w.jsxs)(y,{children:[`Are you sure you want to delete "`,R?.title,`"`,R?.workspaceId?` from workspace "${R.workspaceId}"`:``,`? This action cannot be undone.`]})]}),(0,w.jsxs)(v,{className:`mt-4`,children:[(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>L(!1),children:`Cancel`}),(0,w.jsx)(s,{variant:`destructive`,size:`sm`,onClick:ft,children:`Delete Permanently`})]})]})})]})}export{E as SkillsPage};
7
+ Detailed instructions for the AI assistant...`,className:`flex-1 w-full min-h-[360px] lg:min-h-full font-mono text-xs leading-relaxed resize-none focus:ring-1 focus:ring-primary`})]}):(0,w.jsxs)(`div`,{className:`flex flex-col flex-1 min-h-0 h-full`,children:[(0,w.jsxs)(`div`,{className:`flex items-center justify-between pb-2 shrink-0`,children:[(0,w.jsxs)(`span`,{className:`text-xs font-semibold flex items-center gap-1.5 text-foreground`,children:[(0,w.jsx)(re,{className:`h-3.5 w-3.5 text-primary`}),(0,w.jsx)(`span`,{children:`Documentation Preview`})]}),(0,w.jsx)(i,{variant:`outline`,className:`text-[10px] font-mono`,children:`SKILL.md`})]}),(0,w.jsxs)(`div`,{className:`flex-1 overflow-y-auto p-5 border rounded-lg bg-card/40 prose prose-sm dark:prose-invert max-w-none`,children:[(0,w.jsxs)(`div`,{className:`mb-4 pb-3 border-b border-border/70`,children:[(0,w.jsx)(`h2`,{className:`text-lg font-bold m-0 text-foreground`,children:E?.title||E?.name}),(0,w.jsx)(`p`,{className:`text-xs text-muted-foreground m-0 mt-1`,children:E?.description}),E?.tags&&E.tags.length>0&&(0,w.jsx)(`div`,{className:`flex flex-wrap gap-1 mt-2.5`,children:E.tags.map(e=>(0,w.jsxs)(`span`,{className:`px-2 py-0.5 rounded bg-muted text-[11px] font-mono text-muted-foreground`,children:[`#`,e]},e))})]}),(0,w.jsx)(`pre`,{className:`text-xs whitespace-pre-wrap font-sans bg-transparent p-0 border-0 leading-relaxed`,children:E?.content||`*(No playbook markdown provided)*`})]})]})})]}),(0,w.jsxs)(_,{className:`mt-4 pt-3 border-t flex items-center justify-between sm:justify-between w-full`,children:[(0,w.jsx)(`div`,{children:E?.id&&E?.custom&&(0,w.jsxs)(s,{type:`button`,variant:`outline`,size:`sm`,onClick:e=>{let t=E;x(!1),dt(t,e)},className:`text-destructive hover:bg-destructive/10 border-destructive/30 text-xs gap-1.5`,children:[(0,w.jsx)(d,{className:`h-3.5 w-3.5`}),(0,w.jsx)(`span`,{children:`Delete Skill`})]})}),(0,w.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>x(!1),children:`Cancel`}),(0,w.jsx)(s,{variant:`default`,size:`sm`,onClick:E?.custom===!1?mt:ut,disabled:!E?.name?.trim()||!E?.description?.trim()||!E?.content?.trim(),children:E?.custom===!1?`Create editable copy`:`Save Skill`})]})]})]})}),(0,w.jsx)(y,{open:Ue,onOpenChange:P,children:(0,w.jsxs)(b,{className:`sm:max-w-md`,children:[(0,w.jsxs)(h,{children:[(0,w.jsx)(g,{children:`Move Skill to Category`}),(0,w.jsxs)(v,{children:[`Select the destination category box for "`,F?.title||F?.name,`".`]})]}),(0,w.jsx)(`div`,{className:`space-y-2 py-2`,children:V.map(e=>{let t=T[e.icon||`boxes`]||f,n=F?.category===e.id;return(0,w.jsxs)(`button`,{type:`button`,onClick:()=>St(e.id),className:o(`w-full p-3 rounded-lg border text-left flex items-center justify-between transition-colors`,n?`border-primary bg-primary/10`:`border-border hover:bg-muted/50 text-foreground`),children:[(0,w.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,w.jsx)(`div`,{className:`p-1.5 rounded text-white flex items-center justify-center`,style:{backgroundColor:e.color||`#3b82f6`},children:(0,w.jsx)(t,{className:`h-4 w-4`})}),(0,w.jsxs)(`div`,{children:[(0,w.jsx)(`div`,{className:`font-semibold text-xs`,children:e.name}),e.description&&(0,w.jsx)(`div`,{className:`text-[11px] text-muted-foreground line-clamp-1`,children:e.description})]})]}),n&&(0,w.jsx)(i,{variant:`secondary`,className:`text-[10px]`,children:`Current`})]},e.id)})}),(0,w.jsx)(_,{children:(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>P(!1),children:`Cancel`})})]})}),(0,w.jsx)(y,{open:We,onOpenChange:L,children:(0,w.jsxs)(b,{className:`sm:max-w-md`,children:[(0,w.jsxs)(h,{children:[(0,w.jsxs)(g,{className:`text-destructive`,children:[`Delete `,R?.type===`category`?`Category`:R?.workspaceId?`Workspace Skill`:`Global Skill`]}),(0,w.jsxs)(v,{children:[`Are you sure you want to delete "`,R?.title,`"`,R?.workspaceId?` from workspace "${R.workspaceId}"`:``,`? This action cannot be undone.`]})]}),(0,w.jsxs)(_,{className:`mt-4`,children:[(0,w.jsx)(s,{variant:`outline`,size:`sm`,onClick:()=>L(!1),children:`Cancel`}),(0,w.jsx)(s,{variant:`destructive`,size:`sm`,onClick:ft,children:`Delete Permanently`})]})]})})]})}export{E as SkillsPage};