@lovelybunch/api 1.0.71 → 1.0.72-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/jobs/job-scheduler.js +17 -0
- package/dist/lib/slack/slack-service.d.ts +89 -0
- package/dist/lib/slack/slack-service.js +504 -0
- package/dist/routes/api/v1/git/index.js +17 -0
- package/dist/routes/api/v1/proposals/[id]/route.js +9 -0
- package/dist/routes/api/v1/proposals/route.js +8 -0
- package/dist/routes/api/v1/resources/generate/route.js +24 -3
- package/dist/routes/api/v1/slack/index.d.ts +3 -0
- package/dist/routes/api/v1/slack/index.js +15 -0
- package/dist/routes/api/v1/slack/route.d.ts +122 -0
- package/dist/routes/api/v1/slack/route.js +189 -0
- package/dist/server-with-static.js +2 -0
- package/dist/server.js +2 -0
- package/package.json +5 -4
- package/static/assets/{AgentDetailPage-CZ2tz-Ol.js → AgentDetailPage-CS4l_2nY.js} +1 -1
- package/static/assets/{AgentEditPage-BiAoWU1z.js → AgentEditPage-mvchfGaI.js} +1 -1
- package/static/assets/{AgentsPage-D_HMA-40.js → AgentsPage-D4JsS7kC.js} +1 -1
- package/static/assets/{AgentsSettingsPage-C5ZsOVSL.js → AgentsSettingsPage-CPZm3ECa.js} +1 -1
- package/static/assets/{ApiKeysSettingsPage-C7Xlzj-X.js → ApiKeysSettingsPage-BmGRl-Cr.js} +1 -1
- package/static/assets/{ArchitectureEditPage-B9nVQn0B.js → ArchitectureEditPage-CyAu4lkT.js} +1 -1
- package/static/assets/{ArchitecturePage-CChIC6Qa.js → ArchitecturePage-BEVC5igc.js} +1 -1
- package/static/assets/{AuthSettingsPage-CaeV2cQ4.js → AuthSettingsPage-BfxPusvb.js} +1 -1
- package/static/assets/{CallbackPage-DmeStBSx.js → CallbackPage-C7QN2xcl.js} +1 -1
- package/static/assets/{CodePage-BtKkipWC.js → CodePage-DoP5IiuI.js} +1 -1
- package/static/assets/{CollapsibleSection-Cb80fCCb.js → CollapsibleSection-DpcF5jIr.js} +1 -1
- package/static/assets/{DashboardPage-DdApq_B-.js → DashboardPage-D0EoXiL2.js} +1 -1
- package/static/assets/{GitPage-D2aJfzTq.js → GitPage-DVCWmjb1.js} +1 -1
- package/static/assets/{GitSettingsPage-Bz17VWrK.js → GitSettingsPage-CA-NVPgC.js} +1 -1
- package/static/assets/{IdentityPage-O7o2b4JB.js → IdentityPage-yBi2meP8.js} +1 -1
- package/static/assets/{ImplementationStepsEditor-BkJjQBc-.js → ImplementationStepsEditor-CdFjqsQp.js} +1 -1
- package/static/assets/{IntegrationsSettingsPage-brFTXUBL.js → IntegrationsSettingsPage-4NWwhHlm.js} +1 -1
- package/static/assets/{KnowledgeDetailPage-e5OpRrZ2.js → KnowledgeDetailPage-mBBrz-_N.js} +1 -1
- package/static/assets/{KnowledgeEditPage-DgyPoIJv.js → KnowledgeEditPage-DqTY1Y3C.js} +1 -1
- package/static/assets/{KnowledgePage-Ck_FeruK.js → KnowledgePage-DonVTg_6.js} +1 -1
- package/static/assets/{LoginPage-IqcnIlMj.js → LoginPage-DFpCcG6v.js} +1 -1
- package/static/assets/{McpSettingsPage-KJBLTelP.js → McpSettingsPage-jXN9kO3i.js} +1 -1
- package/static/assets/{NewAgentPage-DLIvDpeZ.js → NewAgentPage-BNojru16.js} +1 -1
- package/static/assets/{NewKnowledgePage-xBm9PTKB.js → NewKnowledgePage-D93ERPBo.js} +1 -1
- package/static/assets/{NewProposalPage-BlocVyGv.js → NewProposalPage-BBmHfu-z.js} +1 -1
- package/static/assets/NotificationsSettingsPage-D6oOIvep.js +1 -0
- package/static/assets/{ProjectEditPage-BlA-908F.js → ProjectEditPage-kXy3gxS3.js} +1 -1
- package/static/assets/{ProjectPage-Dj-tc-ZE.js → ProjectPage-D3vvfNxI.js} +1 -1
- package/static/assets/{PromptsSettingsPage-BvU01T7L.js → PromptsSettingsPage-BNQrbBn5.js} +1 -1
- package/static/assets/{ProposalDetailPage-_8Wn6NJt.js → ProposalDetailPage-CMgZUcxP.js} +1 -1
- package/static/assets/{ProposalEditPage-BbbWkAuu.js → ProposalEditPage-Bn_1OJ11.js} +1 -1
- package/static/assets/{ProposalsPage-erDBdH7Z.js → ProposalsPage-CysWDXyl.js} +1 -1
- package/static/assets/ResourcesPage-QD68AoOk.js +71 -0
- package/static/assets/{RulesSettingsPage-DurFFm98.js → RulesSettingsPage-DQvhq7o0.js} +1 -1
- package/static/assets/{SchedulePage-BAnM4Lu5.js → SchedulePage-CghrKKJB.js} +1 -1
- package/static/assets/{SourceInput-7lTShZ6_.js → SourceInput-BU8xQMbc.js} +1 -1
- package/static/assets/{TagInput-2_jYxO52.js → TagInput-C1XF1z9l.js} +1 -1
- package/static/assets/{TerminalPage-CRVEtFXr.js → TerminalPage-BfNa9oLV.js} +1 -1
- package/static/assets/{TerminalSessionPage-BjvQegW1.js → TerminalSessionPage-BkuO3Dlc.js} +3 -8
- package/static/assets/{UserPreferencesPage-C5ueVUwG.js → UserPreferencesPage-DWsDPJWa.js} +1 -1
- package/static/assets/{UserSettingsPage-DhOu8xZ3.js → UserSettingsPage-Czyu--ZE.js} +1 -1
- package/static/assets/{UtilitiesPage-olcchfEX.js → UtilitiesPage-BL3r6jt4.js} +1 -1
- package/static/assets/{alert-bP1PxakB.js → alert-yDv7BoVY.js} +1 -1
- package/static/assets/{arrow-down-BoBPr1Sn.js → arrow-down-B6mDQzhv.js} +1 -1
- package/static/assets/{arrow-left-orDiJ2Pw.js → arrow-left-oYBMYRNP.js} +1 -1
- package/static/assets/{arrow-up-CCloQpeV.js → arrow-up-BtNT59gW.js} +1 -1
- package/static/assets/{badge-D7styiB7.js → badge-A8sRXZ1m.js} +1 -1
- package/static/assets/{browser-modal-n0MeSpgA.js → browser-modal-DcxLC6CX.js} +1 -1
- package/static/assets/{calendar-w3geg78-.js → calendar-C6_Zaz3s.js} +1 -1
- package/static/assets/{card-pzUJtmwJ.js → card-Brl-P7qu.js} +1 -1
- package/static/assets/{chevron-left-B6nXpDLi.js → chevron-left-BsJmB9OE.js} +1 -1
- package/static/assets/{circle-alert-BcFpY-ZU.js → circle-alert-BYXOF-Yd.js} +1 -1
- package/static/assets/{circle-check-HRharHjy.js → circle-check-BISWYf84.js} +1 -1
- package/static/assets/{circle-check-big-B2CFEks4.js → circle-check-big-GdURlCCT.js} +1 -1
- package/static/assets/{circle-play-CfrNAC9J.js → circle-play-D14kkelg.js} +1 -1
- package/static/assets/{circle-x-CNn7_0Ew.js → circle-x-CWvfwx75.js} +1 -1
- package/static/assets/{clipboard-LaXihY2m.js → clipboard-CQ1MeyX5.js} +1 -1
- package/static/assets/{clock-By2Dd4u0.js → clock-C7sCX_DE.js} +1 -1
- package/static/assets/{download--HiFU7TR.js → download-BjE8JxlU.js} +1 -1
- package/static/assets/{eye-DorygWtP.js → eye-2hl27c7R.js} +1 -1
- package/static/assets/{folder-git-2-B8bjLoxc.js → folder-git-2-BBlVIDmr.js} +1 -1
- package/static/assets/index-BJVvhEWY.css +2 -0
- package/static/assets/{index-BfJaT17z.js → index-D_2ZhRwL.js} +91 -86
- package/static/assets/{label-CTlQtJaU.js → label-DA737D6X.js} +1 -1
- package/static/assets/{markdown-editor-BOcltq2r.js → markdown-editor-BhYm394v.js} +1 -1
- package/static/assets/message-square-DV1_7h3v.js +6 -0
- package/static/assets/{pause-D33aM-oa.js → pause-DS_ZgX9w.js} +1 -1
- package/static/assets/{play-B6IdXHPj.js → play-Cgu7MRJC.js} +1 -1
- package/static/assets/{plus-DhYjijTS.js → plus-RZwwEJRO.js} +1 -1
- package/static/assets/{radio-group-B-Rc5x_L.js → radio-group-CzZoufFM.js} +1 -1
- package/static/assets/{refresh-cw-BuuX9h4Z.js → refresh-cw-BJ2GIM1Z.js} +1 -1
- package/static/assets/{search-BiMN-o92.js → search-B2ODQzPd.js} +1 -1
- package/static/assets/{switch-vSV_roZ2.js → switch-AdqXRjK1.js} +1 -1
- package/static/assets/{tabs-ChuwGq16.js → tabs-DnIPixK3.js} +1 -1
- package/static/assets/{tag-DERlGH35.js → tag-C4UgL0Z_.js} +1 -1
- package/static/assets/{terminal-preview-BFedy4-J.js → terminal-preview-PYoJzFpP.js} +1 -1
- package/static/assets/{use-terminal-qzkum-B5.js → use-terminal-qsHkIOJb.js} +1 -1
- package/static/assets/{zap-DwFz_ltU.js → zap-CpNZOBUL.js} +1 -1
- package/static/index.html +2 -2
- package/static/assets/ResourcesPage-B1uF-EA-.js +0 -71
- package/static/assets/index-B5SwW-PH.css +0 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as S,H as y,r,j as e,B as j,n as E,a2 as T,L,I as b,A as I}from"./index-
|
|
1
|
+
import{u as S,H as y,r,j as e,B as j,n as E,a2 as T,L,I as b,A as I}from"./index-D_2ZhRwL.js";import{C as i,b as c,c as l,a as d}from"./card-Brl-P7qu.js";import{L as m}from"./label-DA737D6X.js";import{M as A}from"./markdown-editor-BhYm394v.js";import{T as B}from"./TagInput-C1XF1z9l.js";import{S as P}from"./SourceInput-BU8xQMbc.js";import{A as M}from"./arrow-left-oYBMYRNP.js";import"./badge-A8sRXZ1m.js";import"./plus-RZwwEJRO.js";function J(){const g=S(),{toast:s}=y(),[u,x]=r.useState(!1),[n,f]=r.useState(""),[a,v]=r.useState(""),[h,w]=r.useState([]),[p,C]=r.useState([]),k=async()=>{if(!n.trim()){s({title:"Error",description:"Please provide a title for the knowledge document",variant:"destructive"});return}if(!a.trim()){s({title:"Error",description:"Please provide content for the knowledge document",variant:"destructive"});return}x(!0);try{const o=await(await fetch(`${I}/api/v1/context/knowledge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:n.trim(),content:a.trim(),metadata:{tags:h,sources:p}})})).json();if(o.success){s({title:"Success",description:"Knowledge document created successfully"});const N=o.document.filename.replace(".md","");g(`/context/knowledge/${N}`)}else s({title:"Error",description:o.error||"Failed to create knowledge document",variant:"destructive"})}catch(t){console.error("Error creating document:",t),s({title:"Error",description:"Failed to create knowledge document",variant:"destructive"})}finally{x(!1)}};return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h1",{className:"text-3xl font-bold",children:"Create Knowledge Document"})}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(j,{onClick:k,disabled:u||!n.trim()||!a.trim(),size:"sm",children:[u?e.jsx(E,{className:"w-4 h-4 animate-spin"}):e.jsx(T,{className:"w-4 h-4"}),"Create Document"]}),e.jsx(j,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(L,{to:"/context/knowledge",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(M,{className:"h-4 w-4"})})})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Basic Information"})}),e.jsx(d,{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(m,{htmlFor:"title",children:"Title *"}),e.jsx(b,{id:"title",value:n,onChange:t=>f(t.target.value),placeholder:"Enter document title...",className:"text-lg"})]})})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Metadata"})}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{children:[e.jsx(m,{children:"Tags"}),e.jsx(B,{tags:h,onChange:w,placeholder:"Add a tag"})]}),e.jsxs("div",{children:[e.jsx(m,{children:"Sources"}),e.jsx(P,{sources:p,onChange:C})]})]})]}),e.jsxs(i,{children:[e.jsx(c,{children:e.jsx(l,{children:"Content *"})}),e.jsx(d,{children:e.jsx(A,{value:a,onChange:t=>v(t||""),placeholder:`Enter your knowledge content in Markdown...
|
|
2
2
|
|
|
3
3
|
You can use:
|
|
4
4
|
- **Bold text**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as Q,H as G,m as Y,r as n,A as E,j as e,B as j,L as F,v as P,w as k,x as L,y as I,z as r,I as y,a2 as J,M as X,O as Z,P as ee,Q as te,R as se,U as ae,V as ie,W as ne}from"./index-
|
|
1
|
+
import{u as Q,H as G,m as Y,r as n,A as E,j as e,B as j,L as F,v as P,w as k,x as L,y as I,z as r,I as y,a2 as J,M as X,O as Z,P as ee,Q as te,R as se,U as ae,V as ie,W as ne}from"./index-D_2ZhRwL.js";import{C as re,b as oe,c as le,a as ce}from"./card-Brl-P7qu.js";import{L as h}from"./label-DA737D6X.js";import{M as de}from"./markdown-editor-BhYm394v.js";import{C as he}from"./CollapsibleSection-DpcF5jIr.js";import{I as ue,L as me}from"./ImplementationStepsEditor-CdFjqsQp.js";import{T as pe}from"./TagInput-C1XF1z9l.js";import{A as ge}from"./arrow-left-oYBMYRNP.js";import"./plus-RZwwEJRO.js";import"./badge-A8sRXZ1m.js";const v={feature:{name:"New Feature",content:`## Problem Statement
|
|
2
2
|
Describe the problem this new feature addresses.
|
|
3
3
|
|
|
4
4
|
## Proposed Solution
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r,H as Q,A as m,j as e,a1 as w,B as v,I as G,a2 as W,v as Y,w as Z,x as ee,y as se,z as te,bi as ae,bj as ne}from"./index-D_2ZhRwL.js";import{C as T,b as E,c as F,d as B,a as I}from"./card-Brl-P7qu.js";import{L as c}from"./label-DA737D6X.js";import{S as h}from"./switch-AdqXRjK1.js";import{M as ie}from"./message-square-DV1_7h3v.js";import{C as re}from"./circle-check-BISWYf84.js";import{C as D}from"./circle-x-CWvfwx75.js";import{R as H}from"./refresh-cw-BJ2GIM1Z.js";const y={enabled:!1,channelId:"",channelName:"",notifications:{proposals:{created:!0,statusChange:!0},jobs:{completed:!0,failed:!0},git:{push:!1,merge:!0}},hasBotToken:!1,hasSigningSecret:!1};function ue(){const[t,k]=r.useState(y),[u,O]=r.useState(""),[f,P]=r.useState(""),[l,j]=r.useState({data:[],error:null,loading:!1}),[V,$]=r.useState(!0),[A,g]=r.useState(!1),[L,U]=r.useState(!1),[J,z]=r.useState(!1),[o,M]=r.useState(null),[b,N]=r.useState(null),{toast:i}=Q(),R=r.useCallback(async()=>{$(!0);try{const a=await(await fetch(`${m}/api/v1/slack/config`)).json();if(a.success)k({...y,...a.data});else throw new Error(a.error||"Failed to load Slack configuration")}catch(s){console.error("Failed to load Slack config:",s),i({title:"Error",description:"Failed to load Slack configuration",variant:"destructive"})}finally{$(!1)}},[i]),_=r.useCallback(async()=>{U(!0),N(null);try{const a=await(await fetch(`${m}/api/v1/slack/test`,{method:"POST"})).json();a.success?(N({success:!0,teamName:a.teamName}),i({title:"Connected",description:`Connected to workspace: ${a.teamName}`})):(N({success:!1,error:a.error}),i({title:"Connection failed",description:a.error||"Failed to connect",variant:"destructive"}))}catch(s){N({success:!1,error:s.message}),i({title:"Error",description:s.message||"Connection test failed",variant:"destructive"})}finally{U(!1)}},[i]),S=r.useCallback(async()=>{j(s=>({...s,loading:!0,error:null}));try{const a=await(await fetch(`${m}/api/v1/slack/channels`)).json();if(a.success)j({data:a.data||[],error:null,loading:!1});else{const n=a.error||"Failed to load channels";j({data:[],error:n,loading:!1})}}catch(s){console.error("Failed to load Slack channels:",s),j({data:[],error:s.message||"Failed to load channels",loading:!1})}},[]),q=async()=>{g(!0);try{const s={};if(u&&u!=="***"&&(s.botToken=u),f&&f!=="***"&&(s.signingSecret=f),Object.keys(s).length===0){i({title:"No changes",description:"Enter new tokens to save"}),g(!1);return}const n=await(await fetch(`${m}/api/v1/slack/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();if(n.success)k({...y,...n.data}),O(""),P(""),i({title:"Saved",description:"Slack tokens saved successfully"}),await _();else throw new Error(n.error||"Failed to save tokens")}catch(s){i({title:"Error",description:s.message||"Failed to save tokens",variant:"destructive"})}finally{g(!1)}},C=async s=>{g(!0);try{const n=await(await fetch(`${m}/api/v1/slack/config`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)})).json();if(n.success)k({...y,...n.data}),i({title:"Saved",description:"Configuration updated"});else throw new Error(n.error||"Failed to save configuration")}catch(a){i({title:"Error",description:a.message||"Failed to save",variant:"destructive"})}finally{g(!1)}},X=async()=>{z(!0);try{const a=await(await fetch(`${m}/api/v1/slack/notify`,{method:"POST"})).json();if(a.success)i({title:"Sent",description:"Test notification sent to Slack"});else throw new Error(a.error||"Failed to send notification")}catch(s){i({title:"Error",description:s.message||"Failed to send test notification",variant:"destructive"})}finally{z(!1)}},x=(s,a,n)=>{const K={...t.notifications,[s]:{...t.notifications[s],[a]:n}};C({notifications:K})},p=async s=>{M(s);try{const n=await(await fetch(`${m}/api/v1/slack/notify/example`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({type:s})})).json();if(n.success)i({title:"Sent",description:`Example notification sent to ${t.channelName}`});else throw new Error(n.error||"Failed to send example notification")}catch(a){i({title:"Error",description:a.message||"Failed to send example notification",variant:"destructive"})}finally{M(null)}};if(r.useEffect(()=>{R()},[R]),r.useEffect(()=>{t.hasBotToken&&S()},[t.hasBotToken,S]),V)return e.jsx("div",{children:"Loading..."});const d=!!t.channelId;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"Notifications"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Configure Slack notifications for Coconut events."})]}),e.jsx(w,{}),e.jsxs(T,{children:[e.jsxs(E,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ie,{className:"h-5 w-5"}),e.jsx(F,{children:"Slack Connection"})]}),e.jsx(B,{children:"Connect your Slack workspace to receive notifications from Coconut."})]}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center justify-between rounded border bg-muted/30 px-3 py-2",children:[e.jsx("div",{className:"flex items-center gap-2",children:t.hasBotToken?b?.success?e.jsxs(e.Fragment,{children:[e.jsx(re,{className:"h-4 w-4 text-green-600"}),e.jsxs("span",{className:"text-sm font-medium text-green-600",children:["Connected to ",b.teamName]})]}):b?.error?e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"h-4 w-4 text-red-600"}),e.jsx("span",{className:"text-sm text-red-600",children:b.error})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"h-4 w-4 rounded-full bg-yellow-500"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Token configured - click Test to verify"})]}):e.jsxs(e.Fragment,{children:[e.jsx(D,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"text-sm text-muted-foreground",children:"Not connected"})]})}),e.jsxs(v,{variant:"outline",size:"sm",onClick:_,disabled:L||!t.hasBotToken,children:[e.jsx(H,{className:`h-4 w-4 mr-2 ${L?"animate-spin":""}`}),"Test"]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"botToken",children:"Bot User OAuth Token"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(G,{id:"botToken",type:"password",placeholder:t.hasBotToken?"••••••••••••••••":"xoxb-...",value:u,onChange:s=>O(s.target.value),className:"flex-1"})}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Find this in your Slack app settings under OAuth & Permissions. The token should start with ",e.jsx("code",{className:"text-xs bg-muted px-1 rounded",children:"xoxb-"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{htmlFor:"signingSecret",children:"Signing Secret"}),e.jsx("div",{className:"flex gap-2",children:e.jsx(G,{id:"signingSecret",type:"password",placeholder:t.hasSigningSecret?"••••••••••••••••":"Enter signing secret",value:f,onChange:s=>P(s.target.value),className:"flex-1"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Find this in your Slack app settings under Basic Information → App Credentials."})]}),e.jsx("div",{className:"flex justify-end",children:e.jsxs(v,{onClick:q,disabled:A||!u&&!f,children:[e.jsx(W,{className:"h-4 w-4 mr-2"}),A?"Saving...":"Save Tokens"]})}),e.jsxs("div",{className:"rounded border bg-muted/50 p-4 space-y-2",children:[e.jsx("div",{className:"text-sm font-medium",children:"Setup Instructions"}),e.jsxs("ol",{className:"text-xs text-muted-foreground space-y-1 list-decimal list-inside",children:[e.jsxs("li",{children:["Go to ",e.jsx("a",{href:"https://api.slack.com/apps",target:"_blank",rel:"noopener noreferrer",className:"text-primary hover:underline",children:"api.slack.com/apps"})," and select your app"]}),e.jsxs("li",{children:['Under "OAuth & Permissions", add these Bot Token Scopes:',e.jsxs("ul",{className:"ml-4 mt-1 space-y-0.5",children:[e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"chat:write"})," - Send messages"]}),e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"channels:read"})," - List public channels"]}),e.jsxs("li",{children:[e.jsx("code",{className:"text-xs bg-background px-1 rounded",children:"groups:read"})," - List private channels (optional)"]})]})]}),e.jsx("li",{children:"Install the app to your workspace and copy the Bot User OAuth Token"}),e.jsx("li",{children:'Under "Basic Information", copy the Signing Secret'})]})]})]})]}),e.jsxs(T,{children:[e.jsxs(E,{children:[e.jsx(F,{children:"Notification Channel"}),e.jsx(B,{children:"Select the Slack channel where notifications will be posted."})]}),e.jsxs(I,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(c,{children:"Channel"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsxs(Y,{value:t.channelId,onValueChange:s=>{const a=l.data.find(n=>n.id===s);C({channelId:s,channelName:a?`#${a.name}`:""})},disabled:!t.hasBotToken||l.loading||!!l.error,children:[e.jsx(Z,{className:"flex-1",children:e.jsx(ee,{placeholder:l.loading?"Loading channels...":l.error?"Unable to load channels":"Select a channel"})}),e.jsx(se,{children:l.data.map(s=>e.jsxs(te,{value:s.id,children:[s.isPrivate?"🔒":"#"," ",s.name,!s.isMember&&" (bot not member)"]},s.id))})]}),e.jsx(v,{variant:"outline",size:"icon",onClick:S,disabled:l.loading||!t.hasBotToken,children:e.jsx(H,{className:`h-4 w-4 ${l.loading?"animate-spin":""}`})})]}),l.error&&e.jsxs("div",{className:"rounded border border-red-200 bg-red-50 p-3 text-xs text-red-700 dark:border-red-900 dark:bg-red-950 dark:text-red-200",children:[e.jsx("span",{className:"font-medium",children:"Error loading channels:"})," ",l.error]}),t.channelName&&!l.error&&e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Currently set to: ",e.jsx("span",{className:"font-medium",children:t.channelName})]}),!t.hasBotToken&&e.jsx("p",{className:"text-xs text-amber-600",children:"Configure your Bot Token above to select a channel."})]}),d&&e.jsxs("div",{className:"flex items-center justify-between pt-2 border-t",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Send a test notification to verify the setup"}),e.jsxs(v,{variant:"outline",size:"sm",onClick:X,disabled:J||!t.enabled,children:[e.jsx(ae,{className:"h-4 w-4 mr-2"}),J?"Sending...":"Send Test"]})]})]})]}),e.jsxs(T,{children:[e.jsxs(E,{children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(ne,{className:"h-5 w-5"}),e.jsx(F,{children:"Notification Types"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(c,{htmlFor:"notifications-enabled",className:"text-sm font-normal",children:"Enable notifications"}),e.jsx(h,{id:"notifications-enabled",checked:t.enabled,onCheckedChange:s=>C({enabled:s}),disabled:!t.hasBotToken||!d})]})]}),e.jsx(B,{children:"Choose which events trigger Slack notifications."})]}),e.jsxs(I,{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Proposals"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"proposals-created",className:"text-sm font-normal",children:"New proposal created"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>p("proposal.created"),disabled:!d||o==="proposal.created",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="proposal.created"?"Sending...":"Send Example"}),e.jsx(h,{id:"proposals-created",checked:t.notifications.proposals.created,onCheckedChange:s=>x("proposals","created",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"proposals-status",className:"text-sm font-normal",children:"Proposal status changed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>p("proposal.statusChange"),disabled:!d||o==="proposal.statusChange",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="proposal.statusChange"?"Sending...":"Send Example"}),e.jsx(h,{id:"proposals-status",checked:t.notifications.proposals.statusChange,onCheckedChange:s=>x("proposals","statusChange",s),disabled:!t.enabled})]})]})]})]}),e.jsx(w,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Scheduled Jobs"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"jobs-completed",className:"text-sm font-normal",children:"Job completed successfully"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>p("job.completed"),disabled:!d||o==="job.completed",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="job.completed"?"Sending...":"Send Example"}),e.jsx(h,{id:"jobs-completed",checked:t.notifications.jobs.completed,onCheckedChange:s=>x("jobs","completed",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"jobs-failed",className:"text-sm font-normal",children:"Job failed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>p("job.failed"),disabled:!d||o==="job.failed",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="job.failed"?"Sending...":"Send Example"}),e.jsx(h,{id:"jobs-failed",checked:t.notifications.jobs.failed,onCheckedChange:s=>x("jobs","failed",s),disabled:!t.enabled})]})]})]})]}),e.jsx(w,{}),e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"text-sm font-medium",children:"Git Operations"}),e.jsxs("div",{className:"space-y-3 ml-4",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"git-push",className:"text-sm font-normal",children:"Code pushed"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>p("git.push"),disabled:!d||o==="git.push",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="git.push"?"Sending...":"Send Example"}),e.jsx(h,{id:"git-push",checked:t.notifications.git.push,onCheckedChange:s=>x("git","push",s),disabled:!t.enabled})]})]}),e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(c,{htmlFor:"git-merge",className:"text-sm font-normal",children:"Branch merged"}),e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("button",{type:"button",onClick:()=>p("git.merge"),disabled:!d||o==="git.merge",className:"text-xs text-primary hover:underline disabled:opacity-50 disabled:no-underline",children:o==="git.merge"?"Sending...":"Send Example"}),e.jsx(h,{id:"git-merge",checked:t.notifications.git.merge,onCheckedChange:s=>x("git","merge",s),disabled:!t.enabled})]})]})]})]}),!t.enabled&&t.hasBotToken&&d&&e.jsx("div",{className:"rounded border border-amber-200 bg-amber-50 p-3 text-xs text-amber-700 dark:border-amber-900 dark:bg-amber-950 dark:text-amber-200",children:"Enable notifications above to start receiving Slack messages for these events."})]})]})]})}export{ue as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u as L,H as I,r as i,A as S,j as e,B as C,L as M,a2 as A,I as p,v as B,w as D,x as T,y as O,z as j}from"./index-
|
|
1
|
+
import{u as L,H as I,r as i,A as S,j as e,B as C,L as M,a2 as A,I as p,v as B,w as D,x as T,y as O,z as j}from"./index-D_2ZhRwL.js";import{C as m,a as x,b,c as P}from"./card-Brl-P7qu.js";import{L as l}from"./label-DA737D6X.js";import{M as V}from"./markdown-editor-BhYm394v.js";import{A as W}from"./arrow-left-oYBMYRNP.js";import{C as z}from"./circle-check-big-GdURlCCT.js";function K(){const E=L(),{toast:d}=I(),[a,v]=i.useState({project:{name:"",description:"",website:"",version:"1.0.0",stage:"development"}}),[u,g]=i.useState(""),[F,f]=i.useState(!0),[y,w]=i.useState(!1);i.useEffect(()=>{fetch(`${S}/api/v1/context/project`).then(t=>t.json()).then(t=>{if(t.success){const s=t.document;v({project:{name:s.metadata.project?.name||"",description:s.metadata.project?.description||"",website:s.metadata.project?.website||s.metadata.project?.repository||"",version:s.metadata.project?.version||"1.0.0",stage:s.metadata.project?.stage||"development"}}),g(s.content.trim())}f(!1)}).catch(t=>{console.error("Failed to load context:",t),d({title:"Error",description:"Failed to load project context",variant:"destructive"}),f(!1)})},[d]);const k=async()=>{w(!0);try{const s={project:Object.fromEntries(Object.entries(a.project).map(([o,r])=>[o,typeof r=="string"?r.trim():r]))},n=await(await fetch(`${S}/api/v1/context/project`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:u,metadata:s})})).json();if(n.success)d({title:"Success",description:"Project context saved successfully",action:e.jsx(z,{className:"h-4 w-4"})}),E("/context/project");else throw new Error(n.error||"Failed to save context")}catch(t){console.error("Save error:",t),d({title:"Error",description:"Failed to save project context",variant:"destructive"})}finally{w(!1)}},c=(t,s)=>{v(N=>{const n={...N},o=t.split(".");let r=n;for(let h=0;h<o.length-1;h++)r=r[o[h]];return r[o[o.length-1]]=s,n})};return F?e.jsx("div",{className:"space-y-6",children:e.jsx(m,{children:e.jsx(x,{className:"pt-6",children:e.jsx("div",{className:"text-center",children:e.jsx("p",{children:"Loading..."})})})})}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Edit Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Edit project information and documentation"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(C,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(M,{to:"/context/project",children:[e.jsx(W,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Back"})]})}),e.jsxs(C,{size:"sm",onClick:k,disabled:y,children:[e.jsx(A,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:y?"Saving...":"Save"})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Project Information"})}),e.jsxs(x,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-name",children:"Project Name"}),e.jsx(p,{id:"project-name",value:a.project.name,onChange:t=>c("project.name",t.target.value),placeholder:"My Awesome Project"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-version",children:"Version"}),e.jsx(p,{id:"project-version",value:a.project.version,onChange:t=>c("project.version",t.target.value),placeholder:"1.0.0"})]})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-description",children:"Description"}),e.jsx(p,{id:"project-description",value:a.project.description,onChange:t=>c("project.description",t.target.value),placeholder:"Brief description of what this project does"})]}),e.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-website",children:"Website"}),e.jsx(p,{id:"project-website",value:a.project.website,onChange:t=>c("project.website",t.target.value),placeholder:"https://yourproject.com"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(l,{htmlFor:"project-stage",children:"Development Stage"}),e.jsxs(B,{value:a.project.stage,onValueChange:t=>c("project.stage",t),children:[e.jsx(D,{children:e.jsx(T,{placeholder:"Select stage"})}),e.jsxs(O,{children:[e.jsx(j,{value:"prototype",children:"Prototype"}),e.jsx(j,{value:"development",children:"Development"}),e.jsx(j,{value:"mvp",children:"MVP"}),e.jsx(j,{value:"production",children:"Production"})]})]})]})]})]})]}),e.jsxs(m,{children:[e.jsx(b,{children:e.jsx(P,{children:"Documentation"})}),e.jsx(x,{children:e.jsx(V,{value:u,onChange:t=>g(t||""),placeholder:`Write your project documentation in markdown...
|
|
2
2
|
|
|
3
3
|
## What is this project?
|
|
4
4
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{H as w,r,A as y,j as e,n as C,g as b,B as n,az as P,ay as k,L as E,J as L,aA as z,av as B}from"./index-
|
|
1
|
+
import{H as w,r,A as y,j as e,n as C,g as b,B as n,az as P,ay as k,L as E,J as L,aA as z,av as B}from"./index-D_2ZhRwL.js";import{C as c,a as i,b as p,c as D}from"./card-Brl-P7qu.js";import{B as x}from"./badge-A8sRXZ1m.js";import{c as F}from"./clipboard-B9ndUJKl.js";function T(){const{toast:d}=w(),[o,h]=r.useState(null),[j,u]=r.useState(!0),[f,l]=r.useState(!1);r.useEffect(()=>{fetch(`${y}/api/v1/context/project`).then(s=>{if(s.ok)return s.json();throw new Error("Not found")}).then(s=>{s.success?(h(s.document),l(!0)):l(!1)}).catch(()=>{l(!1)}).finally(()=>{u(!1)})},[]);const v=async()=>{const s=".nut/context/project.md";try{await F(s),d({title:"Copied!",description:`Path ${s} copied to clipboard`})}catch(m){console.error("Failed to copy path:",m),d({title:"Error",description:"Failed to copy path to clipboard",variant:"destructive"})}},N=()=>{const s=new CustomEvent("discuss-in-chat",{detail:{type:"context",id:"project-md",filename:"project.md",name:"project.md",path:".nut/context/project.md"}});window.dispatchEvent(s)};if(j)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"flex items-center justify-center",children:[e.jsx(C,{className:"h-8 w-8 animate-spin text-muted-foreground"}),e.jsx("span",{className:"ml-2 text-muted-foreground",children:"Loading Project Overview..."})]})})})});if(!f||!o)return e.jsx("div",{className:"space-y-6",children:e.jsx(c,{children:e.jsx(i,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx(b,{className:"mx-auto h-12 w-12 text-muted-foreground"}),e.jsx("h3",{className:"mt-4 text-lg font-semibold",children:"No Project Overview Found"}),e.jsxs("p",{className:"mt-2 text-sm text-muted-foreground",children:["Run ",e.jsx("code",{className:"bg-muted px-2 py-1 rounded",children:"coconut init"})," to create the project overview."]})]})})})});const t=o.metadata,a=t.project?.website||t.project?.repository,g=a?(s=>{try{return new URL(s.startsWith("http")?s:`https://${s}`).host.replace(/^www\./,"")}catch{return s.replace(/^https?:\/\//,"")}})(a):null;return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-bold tracking-tight",children:"Project Overview"}),e.jsx("p",{className:"text-muted-foreground",children:"Core project information and configuration"})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsxs(n,{variant:"outline",size:"sm",onClick:N,children:[e.jsx(P,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Discuss"})]}),e.jsxs(n,{variant:"outline",size:"sm",onClick:v,children:[e.jsx(k,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Copy Path"})]}),e.jsx(n,{size:"sm",asChild:!0,children:e.jsxs(E,{to:"/context/project/edit",children:[e.jsx(L,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})})]})]}),t&&e.jsx("div",{className:"grid grid-cols-1 gap-4",children:e.jsxs(c,{children:[e.jsx(p,{className:"pb-3",children:e.jsx(D,{className:"text-lg font-semibold",children:"Project Info"})}),e.jsxs(i,{className:"space-y-3",children:[e.jsxs("div",{className:"min-w-0 space-y-1",children:[e.jsx("p",{className:"text-sm font-medium truncate",children:t.project?.name||"Unnamed Project"}),t.project?.description&&e.jsx("p",{className:"text-sm text-muted-foreground leading-relaxed",children:t.project.description})]}),e.jsxs("div",{className:"flex flex-wrap items-center gap-2",children:[a&&e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs("a",{href:a,target:"_blank",rel:"noopener noreferrer",children:[e.jsx(z,{className:"w-3 h-3 mr-2"}),g||"Website"]})}),e.jsxs("div",{className:"flex gap-2 ml-auto",children:[t.project?.version&&e.jsxs(x,{variant:"secondary",children:["v",t.project.version]}),t.project?.stage&&e.jsx(x,{variant:t.project.stage==="mvp"?"default":"secondary",children:t.project.stage})]})]})]})]})}),e.jsxs(c,{children:[e.jsx(p,{}),e.jsx(i,{children:e.jsx("div",{className:"prose prose-sm max-w-none dark:prose-invert",children:e.jsx(B,{children:o.content||"No content available"})})})]})]})}export{T as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e,a1 as p,B as r,J as h,ai as j,T as u,I as l,v as g,w as f,x as v,y as N,z as y}from"./index-
|
|
1
|
+
import{j as e,a1 as p,B as r,J as h,ai as j,T as u,I as l,v as g,w as f,x as v,y as N,z as y}from"./index-D_2ZhRwL.js";import{C as t,b as i,c as n,d as c,a as d}from"./card-Brl-P7qu.js";import{L as a}from"./label-DA737D6X.js";import{B as o}from"./badge-A8sRXZ1m.js";import{P as w}from"./plus-RZwwEJRO.js";import{E as b}from"./eye-2hl27c7R.js";import{D as C}from"./download-BjE8JxlU.js";function E(){const m=[{id:"1",name:"Code Review Assistant",description:"Prompt for AI agents to perform thorough code reviews",category:"Code Review",usage:"cursor-cli, claude-code",lastUpdated:"2 days ago",active:!0},{id:"2",name:"Architecture Advisor",description:"System prompt for architectural decision guidance",category:"Architecture",usage:"gemini-cli, claude-code",lastUpdated:"1 week ago",active:!0},{id:"3",name:"Bug Analysis Expert",description:"Specialized prompt for debugging and error analysis",category:"Debugging",usage:"cursor-cli",lastUpdated:"3 days ago",active:!1},{id:"4",name:"Documentation Generator",description:"Prompt for generating comprehensive code documentation",category:"Documentation",usage:"github-copilot, claude-code",lastUpdated:"5 days ago",active:!0}],x=["Code Review","Architecture","Debugging","Documentation","Testing","Refactoring","Security","Performance"];return e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-lg font-medium",children:"System Prompts"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Manage system prompts used by AI agents and integrations for consistent behavior."})]}),e.jsx(p,{}),e.jsxs(t,{children:[e.jsx(i,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx(n,{children:"Prompt Library"}),e.jsx(c,{children:"Pre-configured prompts for different AI agents and use cases."})]}),e.jsxs(r,{size:"sm",children:[e.jsx(w,{className:"h-4 w-4 mr-2"}),"New Prompt"]})]})}),e.jsx(d,{children:e.jsx("div",{className:"space-y-4",children:m.map(s=>e.jsxs("div",{className:"flex items-center justify-between p-4 border rounded-lg",children:[e.jsxs("div",{className:"flex-1",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx("h4",{className:"font-medium",children:s.name}),e.jsx(o,{variant:s.active?"default":"secondary",children:s.active?"Active":"Inactive"}),e.jsx(o,{variant:"outline",children:s.category})]}),e.jsx("p",{className:"text-sm text-muted-foreground mt-1",children:s.description}),e.jsxs("div",{className:"flex items-center space-x-4 mt-2",children:[e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Used by: ",s.usage]}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Updated: ",s.lastUpdated]})]})]}),e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(b,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(h,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(j,{className:"h-4 w-4"})}),e.jsx(r,{variant:"outline",size:"sm",children:e.jsx(u,{className:"h-4 w-4"})})]})]},s.id))})})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Create New Prompt"}),e.jsx(c,{children:"Design a new system prompt for your AI agents and integrations."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-2 gap-4",children:[e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptName",children:"Prompt Name"}),e.jsx(l,{id:"promptName",placeholder:"Enter prompt name"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptCategory",children:"Category"}),e.jsxs(g,{children:[e.jsx(f,{children:e.jsx(v,{placeholder:"Select category"})}),e.jsx(N,{children:x.map(s=>e.jsx(y,{value:s.toLowerCase(),children:s},s))})]})]})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptDescription",children:"Description"}),e.jsx(l,{id:"promptDescription",placeholder:"Brief description of the prompt's purpose"})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"targetIntegrations",children:"Target Integrations"}),e.jsx("div",{className:"flex flex-wrap gap-2 mt-2",children:["cursor-cli","claude-code","gemini-cli","github-copilot"].map(s=>e.jsxs("label",{className:"flex items-center space-x-2",children:[e.jsx("input",{type:"checkbox",className:"rounded"}),e.jsx("span",{className:"text-sm",children:s})]},s))})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptContent",children:"Prompt Content"}),e.jsx("textarea",{id:"promptContent",className:"w-full min-h-[200px] p-3 border rounded-md font-mono text-sm",placeholder:"You are an expert code reviewer. Your task is to..."})]}),e.jsxs("div",{children:[e.jsx(a,{htmlFor:"promptVariables",children:"Variables (JSON format)"}),e.jsx("textarea",{id:"promptVariables",className:"w-full min-h-[100px] p-3 border rounded-md font-mono text-sm",placeholder:'{"language": "typescript", "framework": "react", "style": "functional"}'})]}),e.jsxs("div",{className:"flex justify-end space-x-2",children:[e.jsx(r,{variant:"outline",children:"Preview"}),e.jsx(r,{variant:"outline",children:"Save as Draft"}),e.jsx(r,{children:"Save & Activate"})]})]})]}),e.jsxs(t,{children:[e.jsxs(i,{children:[e.jsx(n,{children:"Prompt Templates"}),e.jsx(c,{children:"Import and export prompt templates for sharing across teams."})]}),e.jsxs(d,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center space-x-2",children:[e.jsxs(r,{variant:"outline",size:"sm",children:[e.jsx(C,{className:"h-4 w-4 mr-2"}),"Import Template"]}),e.jsx(r,{variant:"outline",size:"sm",children:"Export All Prompts"}),e.jsx(r,{variant:"outline",size:"sm",children:"Export Selected"})]}),e.jsx("div",{className:"p-4 border-2 border-dashed rounded-lg text-center",children:e.jsx("p",{className:"text-sm text-muted-foreground",children:"Drag and drop prompt template files here, or click to browse"})})]})]})]})}export{E as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as re,u as ne,r as l,H as le,j as e,B as n,L as h,J as ie,M as oe,N as ce,T as de,O as me,P as he,Q as xe,R as pe,U as ue,V as je,W as fe,Y as I,Z as F,k as ge,D as R,_ as B,a as z,b as H,d as V,e as J,v as ve,w as Ne,x as Ce,y as ye,z as c,$ as M,a0 as we,a1 as Se,A as g}from"./index-BfJaT17z.js";import{c as be}from"./clipboard-B9ndUJKl.js";import{C as d,b as x,a as m,c as u,d as _}from"./card-pzUJtmwJ.js";import{B as p}from"./badge-D7styiB7.js";import{L as q}from"./label-CTlQtJaU.js";import{A as S}from"./arrow-left-orDiJ2Pw.js";import{C as De,a as Ae}from"./clipboard-LaXihY2m.js";import{D as Pe}from"./download--HiFU7TR.js";import{C as ke}from"./calendar-w3geg78-.js";import{C as Ee}from"./clock-By2Dd4u0.js";function Q(r){switch(r){case"approved":case"code-complete":return"default";case"in-review":return"secondary";case"rejected":return"destructive";default:return"outline"}}function W(r){switch(r){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function He(){const{id:r}=re(),Y=ne(),[s,v]=l.useState(null),[Z,b]=l.useState(!0),[N,D]=l.useState(null),[A,P]=l.useState(!1),[k,E]=l.useState(!1),[T,$]=l.useState(!1),[j,C]=l.useState(""),[G,y]=l.useState(!1),[K,w]=l.useState(!1),[f,U]=l.useState("draft"),[X,L]=l.useState(!1),{toast:O}=le();l.useEffect(()=>{async function t(){if(r)try{b(!0);const o=await(await fetch(`${g}/api/v1/proposals/${r}`)).json();o.success?v(o.data):D(o.error?.message||"Failed to fetch proposal")}catch(a){D(a instanceof Error?a.message:"Unknown error")}finally{b(!1)}}t()},[r]);const ee=async()=>{if(r){P(!0);try{const a=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"DELETE"})).json();a.success?Y("/proposals"):alert(a.error?.message||"Failed to delete proposal")}catch(t){alert(`Error deleting proposal: ${t instanceof Error?t.message:"Unknown error"}`)}finally{P(!1)}}},se=async()=>{if(!(!s||!r||f===s.status)){E(!0);try{const a=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:f})})).json();a.success?(v(a.data),y(!1)):alert(a.error?.message||"Failed to update status")}catch(t){alert(`Error updating status: ${t instanceof Error?t.message:"Unknown error"}`)}finally{E(!1)}}},te=async()=>{if(!(!s||!r||!j.trim())){$(!0);try{const t={id:`comment-${Date.now()}`,text:j,author:"current-user",timestamp:new Date().toISOString()},a=[...s.metadata.comments||[],t],i=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:a})})).json();i.success?(v(i.data),C(""),w(!1)):alert(i.error?.message||"Failed to add comment")}catch(t){alert(`Error adding comment: ${t instanceof Error?t.message:"Unknown error"}`)}finally{$(!1)}}},ae=()=>{if(!s)return;const t={...s,exportedAt:new Date().toISOString()},a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=`proposal-${s.id}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)};return Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]}):N||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The proposal with ID "',r,'" could not be found.']}),e.jsx(n,{asChild:!0,className:"mt-4",children:e.jsx(h,{to:"/proposals",children:"Back to Proposals"})})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.intent}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(h,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(h,{to:`/proposals/${r}/edit`,children:[e.jsx(ie,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(oe,{children:[e.jsx(ce,{asChild:!0,children:e.jsxs(n,{variant:"destructive",size:"sm",disabled:A,children:[e.jsx(de,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:A?"Deleting...":"Delete"})]})}),e.jsxs(me,{children:[e.jsxs(he,{children:[e.jsx(xe,{children:"Are you absolutely sure?"}),e.jsxs(pe,{children:["This action cannot be undone. This will permanently delete the change proposal",e.jsxs("span",{className:"font-semibold",children:[' "',s.intent,'"']})," and remove it from the system."]})]}),e.jsxs(ue,{children:[e.jsx(je,{children:"Cancel"}),e.jsx(fe,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Proposal"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const t=`.nut/proposals/${s.id}.md`;try{await be(t),L(!0),O({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>L(!1),2e3)}catch(a){console.error("Failed to copy path:",a),O({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/proposals/${s.id}.md`}),X?e.jsx(De,{className:"h-3.5 w-3.5"}):e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(u,{children:"Proposal Details"}),e.jsxs("div",{className:"flex gap-2",children:[s.metadata.priority&&e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority}),e.jsx(p,{variant:Q(s.status),children:s.status})]})]})}),e.jsx(m,{className:"space-y-4",children:s.content?e.jsx(I,{children:s.content}):e.jsx("p",{className:"text-muted-foreground",children:"No detailed content available for this proposal."})})]}),s.planSteps&&s.planSteps.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Implementation Steps"}),e.jsxs(_,{children:[s.planSteps.length," step",s.planSteps.length!==1?"s":""," planned"]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-3",children:s.planSteps.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium",children:a+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:t.description}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:e.jsx(p,{variant:"outline",className:"text-xs",children:t.status})})]})]},t.id))})})]}),s.metadata.comments&&s.metadata.comments.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Comments"}),e.jsxs(_,{children:[s.metadata.comments.length," comment",s.metadata.comments.length!==1?"s":""]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-4",children:s.metadata.comments.map((t,a)=>e.jsxs("div",{className:"border-l-2 border-muted pl-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(F,{className:"h-3 w-3"}),e.jsx("span",{children:t.author}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(t.timestamp).toLocaleString()})]}),e.jsx(I,{className:"prose-sm prose-p:mb-2 prose-ul:my-2 prose-ol:my-2",children:t.text})]},t.id||a))})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Proposal Actions"})}),e.jsxs(m,{className:"space-y-2",children:[e.jsx(n,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(h,{to:`/terminal/${r}`,children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Prepare Coding Agent"]})}),e.jsxs(R,{open:G,onOpenChange:y,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",onClick:()=>U(s?.status||"draft"),children:"Change Status"})}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Change Proposal Status"}),e.jsx(J,{children:"Update the status of this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"status",children:"Status"}),e.jsxs(ve,{value:f,onValueChange:t=>U(t),children:[e.jsx(Ne,{children:e.jsx(Ce,{placeholder:"Select status"})}),e.jsxs(ye,{children:[e.jsx(c,{value:"draft",children:"Draft"}),e.jsx(c,{value:"proposed",children:"Proposed"}),e.jsx(c,{value:"in-review",children:"In Review"}),e.jsx(c,{value:"approved",children:"Approved"}),e.jsx(c,{value:"code-complete",children:"Code Complete"}),e.jsx(c,{value:"merged",children:"Merged"}),e.jsx(c,{value:"rejected",children:"Rejected"})]})]})]})}),e.jsxs(M,{children:[e.jsx(n,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(n,{onClick:se,disabled:k||f===s?.status,children:k?"Updating...":"Update Status"})]})]})]}),e.jsxs(R,{open:K,onOpenChange:w,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",children:"Add Comment"})}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Add Comment"}),e.jsx(J,{children:"Add a comment to this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"comment",children:"Comment"}),e.jsx(we,{id:"comment",placeholder:"Enter your comment...",value:j,onChange:t=>C(t.target.value),rows:4})]})}),e.jsxs(M,{children:[e.jsx(n,{variant:"outline",onClick:()=>{w(!1),C("")},children:"Cancel"}),e.jsx(n,{onClick:te,disabled:T||!j.trim(),children:T?"Adding...":"Add Comment"})]})]})]}),e.jsxs(n,{variant:"outline",className:"w-full justify-start",onClick:ae,children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"}),"Export"]})]})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Information"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Author:"}),e.jsx("span",{children:s.author.name})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Created:"}),e.jsx("span",{children:new Date(s.metadata.createdAt).toLocaleDateString()})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ee,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Updated:"}),e.jsx("span",{children:new Date(s.metadata.updatedAt).toLocaleDateString()})]}),e.jsx(Se,{}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Status:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:Q(s.status),children:s.status})})]}),s.metadata.priority&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Priority:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority})})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:s.metadata.tags.map(t=>e.jsx(p,{variant:"outline",className:"text-xs",children:t},t))})]})]})]})]})]})]})}export{He as default};
|
|
1
|
+
import{E as re,u as ne,r as l,H as le,j as e,B as n,L as h,J as ie,M as oe,N as ce,T as de,O as me,P as he,Q as xe,R as pe,U as ue,V as je,W as fe,Y as I,Z as F,k as ge,D as R,_ as B,a as z,b as H,d as V,e as J,v as ve,w as Ne,x as Ce,y as ye,z as c,$ as M,a0 as we,a1 as Se,A as g}from"./index-D_2ZhRwL.js";import{c as be}from"./clipboard-B9ndUJKl.js";import{C as d,b as x,a as m,c as u,d as _}from"./card-Brl-P7qu.js";import{B as p}from"./badge-A8sRXZ1m.js";import{L as q}from"./label-DA737D6X.js";import{A as S}from"./arrow-left-oYBMYRNP.js";import{C as De,a as Ae}from"./clipboard-CQ1MeyX5.js";import{D as Pe}from"./download-BjE8JxlU.js";import{C as ke}from"./calendar-C6_Zaz3s.js";import{C as Ee}from"./clock-C7sCX_DE.js";function Q(r){switch(r){case"approved":case"code-complete":return"default";case"in-review":return"secondary";case"rejected":return"destructive";default:return"outline"}}function W(r){switch(r){case"high":case"critical":return"destructive";case"medium":return"secondary";default:return"outline"}}function He(){const{id:r}=re(),Y=ne(),[s,v]=l.useState(null),[Z,b]=l.useState(!0),[N,D]=l.useState(null),[A,P]=l.useState(!1),[k,E]=l.useState(!1),[T,$]=l.useState(!1),[j,C]=l.useState(""),[G,y]=l.useState(!1),[K,w]=l.useState(!1),[f,U]=l.useState("draft"),[X,L]=l.useState(!1),{toast:O}=le();l.useEffect(()=>{async function t(){if(r)try{b(!0);const o=await(await fetch(`${g}/api/v1/proposals/${r}`)).json();o.success?v(o.data):D(o.error?.message||"Failed to fetch proposal")}catch(a){D(a instanceof Error?a.message:"Unknown error")}finally{b(!1)}}t()},[r]);const ee=async()=>{if(r){P(!0);try{const a=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"DELETE"})).json();a.success?Y("/proposals"):alert(a.error?.message||"Failed to delete proposal")}catch(t){alert(`Error deleting proposal: ${t instanceof Error?t.message:"Unknown error"}`)}finally{P(!1)}}},se=async()=>{if(!(!s||!r||f===s.status)){E(!0);try{const a=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:f})})).json();a.success?(v(a.data),y(!1)):alert(a.error?.message||"Failed to update status")}catch(t){alert(`Error updating status: ${t instanceof Error?t.message:"Unknown error"}`)}finally{E(!1)}}},te=async()=>{if(!(!s||!r||!j.trim())){$(!0);try{const t={id:`comment-${Date.now()}`,text:j,author:"current-user",timestamp:new Date().toISOString()},a=[...s.metadata.comments||[],t],i=await(await fetch(`${g}/api/v1/proposals/${r}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({comments:a})})).json();i.success?(v(i.data),C(""),w(!1)):alert(i.error?.message||"Failed to add comment")}catch(t){alert(`Error adding comment: ${t instanceof Error?t.message:"Unknown error"}`)}finally{$(!1)}}},ae=()=>{if(!s)return;const t={...s,exportedAt:new Date().toISOString()},a=new Blob([JSON.stringify(t,null,2)],{type:"application/json"}),o=URL.createObjectURL(a),i=document.createElement("a");i.href=o,i.download=`proposal-${s.id}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)};return Z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-8 bg-muted rounded w-3/4 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-1/2 animate-pulse"})]})}),e.jsx(m,{children:e.jsxs("div",{className:"space-y-3",children:[e.jsx("div",{className:"h-4 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-5/6 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-4/6 animate-pulse"})]})})]})]}):N||!s?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(h,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})})})]}),e.jsx(d,{children:e.jsx(m,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:N||"Proposal not found"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:['The proposal with ID "',r,'" could not be found.']}),e.jsx(n,{asChild:!0,className:"mt-4",children:e.jsx(h,{to:"/proposals",children:"Back to Proposals"})})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-1",children:[e.jsxs("div",{className:"flex items-start justify-between gap-4",children:[e.jsx("h1",{className:"text-xl sm:text-2xl font-bold tracking-tight min-w-0",children:s.intent}),e.jsxs("div",{className:"flex items-center gap-2 flex-shrink-0",children:[e.jsx(n,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(h,{to:"/proposals",className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(S,{className:"h-4 w-4"})})}),e.jsx(n,{variant:"outline",size:"sm",asChild:!0,children:e.jsxs(h,{to:`/proposals/${r}/edit`,children:[e.jsx(ie,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:"Edit"})]})}),e.jsxs(oe,{children:[e.jsx(ce,{asChild:!0,children:e.jsxs(n,{variant:"destructive",size:"sm",disabled:A,children:[e.jsx(de,{className:"h-4 w-4 sm:mr-2"}),e.jsx("span",{className:"hidden sm:inline",children:A?"Deleting...":"Delete"})]})}),e.jsxs(me,{children:[e.jsxs(he,{children:[e.jsx(xe,{children:"Are you absolutely sure?"}),e.jsxs(pe,{children:["This action cannot be undone. This will permanently delete the change proposal",e.jsxs("span",{className:"font-semibold",children:[' "',s.intent,'"']})," and remove it from the system."]})]}),e.jsxs(ue,{children:[e.jsx(je,{children:"Cancel"}),e.jsx(fe,{onClick:ee,className:"bg-destructive text-destructive-foreground hover:bg-destructive/90",children:"Delete Proposal"})]})]})]})]})]}),e.jsxs("button",{type:"button",onClick:async()=>{const t=`.nut/proposals/${s.id}.md`;try{await be(t),L(!0),O({title:"Copied!",description:`${t} copied to clipboard`}),setTimeout(()=>L(!1),2e3)}catch(a){console.error("Failed to copy path:",a),O({title:"Error",description:"Failed to copy to clipboard",variant:"destructive"})}},className:"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors font-mono",children:[e.jsx("span",{children:`.nut/proposals/${s.id}.md`}),X?e.jsx(De,{className:"h-3.5 w-3.5"}):e.jsx(Ae,{className:"h-3.5 w-3.5"})]})]}),e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2 space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx(u,{children:"Proposal Details"}),e.jsxs("div",{className:"flex gap-2",children:[s.metadata.priority&&e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority}),e.jsx(p,{variant:Q(s.status),children:s.status})]})]})}),e.jsx(m,{className:"space-y-4",children:s.content?e.jsx(I,{children:s.content}):e.jsx("p",{className:"text-muted-foreground",children:"No detailed content available for this proposal."})})]}),s.planSteps&&s.planSteps.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Implementation Steps"}),e.jsxs(_,{children:[s.planSteps.length," step",s.planSteps.length!==1?"s":""," planned"]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-3",children:s.planSteps.map((t,a)=>e.jsxs("div",{className:"flex items-start gap-3",children:[e.jsx("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-muted text-xs font-medium",children:a+1}),e.jsxs("div",{className:"flex-1",children:[e.jsx("p",{className:"font-medium",children:t.description}),e.jsx("div",{className:"mt-2 flex flex-wrap items-center gap-2 text-xs text-muted-foreground",children:e.jsx(p,{variant:"outline",className:"text-xs",children:t.status})})]})]},t.id))})})]}),s.metadata.comments&&s.metadata.comments.length>0&&e.jsxs(d,{children:[e.jsxs(x,{children:[e.jsx(u,{children:"Comments"}),e.jsxs(_,{children:[s.metadata.comments.length," comment",s.metadata.comments.length!==1?"s":""]})]}),e.jsx(m,{children:e.jsx("div",{className:"space-y-4",children:s.metadata.comments.map((t,a)=>e.jsxs("div",{className:"border-l-2 border-muted pl-4 space-y-2",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",children:[e.jsx(F,{className:"h-3 w-3"}),e.jsx("span",{children:t.author}),e.jsx("span",{children:"•"}),e.jsx("span",{children:new Date(t.timestamp).toLocaleString()})]}),e.jsx(I,{className:"prose-sm prose-p:mb-2 prose-ul:my-2 prose-ol:my-2",children:t.text})]},t.id||a))})})]})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Proposal Actions"})}),e.jsxs(m,{className:"space-y-2",children:[e.jsx(n,{variant:"default",className:"w-full justify-start",asChild:!0,children:e.jsxs(h,{to:`/terminal/${r}`,children:[e.jsx(ge,{className:"h-4 w-4 mr-2"}),"Prepare Coding Agent"]})}),e.jsxs(R,{open:G,onOpenChange:y,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",onClick:()=>U(s?.status||"draft"),children:"Change Status"})}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Change Proposal Status"}),e.jsx(J,{children:"Update the status of this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"status",children:"Status"}),e.jsxs(ve,{value:f,onValueChange:t=>U(t),children:[e.jsx(Ne,{children:e.jsx(Ce,{placeholder:"Select status"})}),e.jsxs(ye,{children:[e.jsx(c,{value:"draft",children:"Draft"}),e.jsx(c,{value:"proposed",children:"Proposed"}),e.jsx(c,{value:"in-review",children:"In Review"}),e.jsx(c,{value:"approved",children:"Approved"}),e.jsx(c,{value:"code-complete",children:"Code Complete"}),e.jsx(c,{value:"merged",children:"Merged"}),e.jsx(c,{value:"rejected",children:"Rejected"})]})]})]})}),e.jsxs(M,{children:[e.jsx(n,{variant:"outline",onClick:()=>y(!1),children:"Cancel"}),e.jsx(n,{onClick:se,disabled:k||f===s?.status,children:k?"Updating...":"Update Status"})]})]})]}),e.jsxs(R,{open:K,onOpenChange:w,children:[e.jsx(B,{asChild:!0,children:e.jsx(n,{variant:"outline",className:"w-full justify-start",children:"Add Comment"})}),e.jsxs(z,{children:[e.jsxs(H,{children:[e.jsx(V,{children:"Add Comment"}),e.jsx(J,{children:"Add a comment to this change proposal."})]}),e.jsx("div",{className:"space-y-4",children:e.jsxs("div",{children:[e.jsx(q,{htmlFor:"comment",children:"Comment"}),e.jsx(we,{id:"comment",placeholder:"Enter your comment...",value:j,onChange:t=>C(t.target.value),rows:4})]})}),e.jsxs(M,{children:[e.jsx(n,{variant:"outline",onClick:()=>{w(!1),C("")},children:"Cancel"}),e.jsx(n,{onClick:te,disabled:T||!j.trim(),children:T?"Adding...":"Add Comment"})]})]})]}),e.jsxs(n,{variant:"outline",className:"w-full justify-start",onClick:ae,children:[e.jsx(Pe,{className:"h-4 w-4 mr-2"}),"Export"]})]})]}),e.jsxs(d,{children:[e.jsx(x,{children:e.jsx(u,{children:"Information"})}),e.jsxs(m,{className:"space-y-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(F,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Author:"}),e.jsx("span",{children:s.author.name})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(ke,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Created:"}),e.jsx("span",{children:new Date(s.metadata.createdAt).toLocaleDateString()})]}),e.jsxs("div",{className:"flex items-center gap-2 text-sm",children:[e.jsx(Ee,{className:"h-4 w-4 text-muted-foreground"}),e.jsx("span",{className:"font-medium",children:"Updated:"}),e.jsx("span",{children:new Date(s.metadata.updatedAt).toLocaleDateString()})]}),e.jsx(Se,{}),e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Status:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:Q(s.status),children:s.status})})]}),s.metadata.priority&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Priority:"}),e.jsx("div",{className:"mt-1",children:e.jsx(p,{variant:W(s.metadata.priority),children:s.metadata.priority})})]}),s.metadata.tags&&s.metadata.tags.length>0&&e.jsxs("div",{children:[e.jsx("span",{className:"font-medium text-sm",children:"Tags:"}),e.jsx("div",{className:"flex flex-wrap gap-1 mt-1",children:s.metadata.tags.map(t=>e.jsx(p,{variant:"outline",className:"text-xs",children:t},t))})]})]})]})]})]})]})}export{He as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{E as M,u as R,H as U,r as o,A as I,j as e,B as m,L as x,I as O,v as L,w as T,x as k,y as D,z as r,X as V,a2 as _}from"./index-
|
|
1
|
+
import{E as M,u as R,H as U,r as o,A as I,j as e,B as m,L as x,I as O,v as L,w as T,x as k,y as D,z as r,X as V,a2 as _}from"./index-D_2ZhRwL.js";import{L as j}from"./label-DA737D6X.js";import{C as f,b as F,a as v,c as q,d as J}from"./card-Brl-P7qu.js";import{M as K}from"./markdown-editor-BhYm394v.js";import{C as W}from"./CollapsibleSection-DpcF5jIr.js";import{I as X,L as G}from"./ImplementationStepsEditor-CdFjqsQp.js";import{T as Q}from"./TagInput-C1XF1z9l.js";import{A as N}from"./arrow-left-oYBMYRNP.js";import"./plus-RZwwEJRO.js";import"./badge-A8sRXZ1m.js";function oe(){const{id:i}=M(),$=R(),{toast:y}=U(),[z,S]=o.useState(!0),[h,w]=o.useState(!1),[C,b]=o.useState(null),[n,d]=o.useState({intent:"",description:"",priority:"medium",status:"draft",author:{id:"current-user",name:"Current User",email:"user@example.com"}}),[p,E]=o.useState([]),[P,A]=o.useState([]);o.useEffect(()=>{i&&B()},[i]);const B=async()=>{try{S(!0);const t=await fetch(`${I}/api/v1/proposals/${i}`),s=await t.json();if(s.success||s.data||t.ok){const a=s.data||s;d({intent:a.intent||"",description:a.content||"",priority:a.metadata?.priority||"medium",status:a.status||"draft",author:{id:a.author?.id||"current-user",name:a.author?.name||"Current User",email:a.author?.email||"user@example.com"}});const g=Array.isArray(a.planSteps)?a.planSteps:[];E(g.map((c,u)=>({id:c.id||`step-${u+1}`,description:c.description||"",status:c.status||"pending"}))),A(a.metadata?.tags||[])}else b(s.error?.message||"Failed to fetch proposal")}catch(t){b(t instanceof Error?t.message:"An error occurred")}finally{S(!1)}},H=async t=>{t.preventDefault(),w(!0);try{const s=p.map(l=>({id:l.id,description:l.description.trim(),status:l.status})).filter(l=>l.description.length>0),a=P.map(l=>l.trim()).filter(l=>l.length>0),g={intent:n.intent,status:n.status,planSteps:s,metadata:{priority:n.priority,tags:a},content:n.description},c=await fetch(`${I}/api/v1/proposals/${i}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(g)}),u=await c.json();if(u.success||c.ok)y({title:"Success",description:"Proposal updated successfully."}),$(`/proposals/${i}`);else throw new Error(u.error?.message||"Failed to update proposal")}catch(s){y({title:"Error",description:`Failed to update proposal: ${s instanceof Error?s.message:"An error occurred"}`,variant:"destructive"})}finally{w(!1)}};return z?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Proposal"}),e.jsx("p",{className:"text-muted-foreground",children:"Loading proposal data..."})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:`/proposals/${i}`,className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsxs(f,{children:[e.jsx(F,{children:e.jsxs("div",{className:"space-y-2",children:[e.jsx("div",{className:"h-6 bg-muted rounded w-1/2 animate-pulse"}),e.jsx("div",{className:"h-4 bg-muted rounded w-3/4 animate-pulse"})]})}),e.jsx(v,{children:e.jsxs("div",{className:"space-y-4",children:[e.jsx("div",{className:"h-10 bg-muted rounded animate-pulse"}),e.jsx("div",{className:"h-64 bg-muted rounded animate-pulse"})]})})]})]}):C?e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("div",{children:e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,className:"px-2 hover:bg-transparent",children:e.jsx(x,{to:"/proposals",className:"flex items-center text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx(f,{children:e.jsx(v,{className:"pt-6",children:e.jsxs("div",{className:"text-center",children:[e.jsx("h3",{className:"text-lg font-semibold text-destructive",children:"Error"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:C})]})})})]}):e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-2xl font-bold tracking-tight",children:"Edit Proposal"}),e.jsxs("p",{className:"text-muted-foreground",children:["Editing ",i]})]}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsx(m,{variant:"ghost",size:"sm",asChild:!0,children:e.jsx(x,{to:`/proposals/${i}`,className:"flex items-center gap-1 text-muted-foreground hover:text-foreground transition-colors",children:e.jsx(N,{className:"h-4 w-4"})})})})]}),e.jsx("form",{onSubmit:H,children:e.jsxs(f,{children:[e.jsxs(F,{children:[e.jsx(q,{children:"Proposal Details"}),e.jsx(J,{children:"Update the information for your change proposal"})]}),e.jsxs(v,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"intent",children:"Intent *"}),e.jsx(O,{id:"intent",placeholder:"Brief description of what you want to change",value:n.intent,onChange:t=>d(s=>({...s,intent:t.target.value})),required:!0})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"description",children:"Description"}),e.jsx(K,{value:n.description,onChange:t=>d(s=>({...s,description:t||""})),placeholder:"Write your proposal description in markdown...",height:400})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"status",children:"Status"}),e.jsxs(L,{value:n.status,onValueChange:t=>d(s=>({...s,status:t})),children:[e.jsx(T,{children:e.jsx(k,{placeholder:"Select status"})}),e.jsxs(D,{children:[e.jsx(r,{value:"draft",children:"Draft"}),e.jsx(r,{value:"proposed",children:"Proposed"}),e.jsx(r,{value:"in-review",children:"In Review"}),e.jsx(r,{value:"approved",children:"Approved"}),e.jsx(r,{value:"code-complete",children:"Code Complete"}),e.jsx(r,{value:"rejected",children:"Rejected"}),e.jsx(r,{value:"merged",children:"Merged"})]})]})]}),e.jsx(W,{defaultOpen:!0,icon:e.jsx(G,{className:"h-4 w-4"}),title:"Optional Implementation Detail",children:e.jsxs("div",{className:"space-y-6",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(j,{htmlFor:"priority",children:"Priority"}),e.jsxs(L,{value:n.priority,onValueChange:t=>d(s=>({...s,priority:t})),children:[e.jsx(T,{children:e.jsx(k,{placeholder:"Select priority"})}),e.jsxs(D,{children:[e.jsx(r,{value:"low",children:"Low"}),e.jsx(r,{value:"medium",children:"Medium"}),e.jsx(r,{value:"high",children:"High"}),e.jsx(r,{value:"critical",children:"Critical"})]})]})]}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{className:"flex items-baseline justify-between gap-4",children:[e.jsxs("div",{children:[e.jsx("p",{className:"text-sm font-medium",children:"Implementation Steps"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Keep the implementation plan accurate as work progresses."})]}),p.length>0&&e.jsxs("span",{className:"text-xs text-muted-foreground",children:[p.length," step",p.length===1?"":"s"]})]}),e.jsx(X,{steps:p,onChange:E,disabled:h})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx("p",{className:"text-sm font-medium",children:"Tags"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:"Tags power filtering and discovery across the proposal list."}),e.jsx(Q,{tags:P,onChange:A,disabled:h,placeholder:"Add a tag (e.g. backend, rollout)"})]})]})}),e.jsxs("div",{className:"flex justify-end gap-2",children:[e.jsx(m,{type:"button",variant:"outline",asChild:!0,children:e.jsxs(x,{to:`/proposals/${i}`,children:[e.jsx(V,{className:"mr-2 h-4 w-4"}),"Cancel"]})}),e.jsx(m,{type:"submit",disabled:h||!n.intent,children:h?e.jsx(e.Fragment,{children:"Saving..."}):e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"mr-2 h-4 w-4"}),"Save Changes"]})})]})]})]})})]})}export{oe as ProposalEditPage};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as xe,o as _e,u as Ie,l as Le,r as j,j as t,B as V,L as Y,I as Re,X,K as Pe,p as Oe,q as $e,s as Te,v as ie,w as ae,x as ce,y as ue,z as w,G as Ke,A as ze}from"./index-
|
|
1
|
+
import{c as xe,o as _e,u as Ie,l as Le,r as j,j as t,B as V,L as Y,I as Re,X,K as Pe,p as Oe,q as $e,s as Te,v as ie,w as ae,x as ce,y as ue,z as w,G as Ke,A as ze}from"./index-D_2ZhRwL.js";import{C as J,b as Ve,a as Z,c as We}from"./card-Brl-P7qu.js";import{B as q}from"./badge-A8sRXZ1m.js";import{P as ee}from"./plus-RZwwEJRO.js";import{S as Ue}from"./search-B2ODQzPd.js";/**
|
|
2
2
|
* @license lucide-react v0.542.0 - ISC
|
|
3
3
|
*
|
|
4
4
|
* This source code is licensed under the ISC license.
|