vibebusiness 1.2.98 → 1.2.99

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 (67) hide show
  1. package/.next/standalone/.env +1 -1
  2. package/.next/standalone/.next/BUILD_ID +1 -1
  3. package/.next/standalone/.next/app-build-manifest.json +38 -38
  4. package/.next/standalone/.next/app-path-routes-manifest.json +1 -1
  5. package/.next/standalone/.next/build-manifest.json +2 -2
  6. package/.next/standalone/.next/prerender-manifest.json +1 -1
  7. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  8. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  9. package/.next/standalone/.next/server/app/_not-found.rsc +1 -1
  10. package/.next/standalone/.next/server/app/briefing/page_client-reference-manifest.js +1 -1
  11. package/.next/standalone/.next/server/app/goals/[id]/page_client-reference-manifest.js +1 -1
  12. package/.next/standalone/.next/server/app/goals/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/hypotheses/[id]/page_client-reference-manifest.js +1 -1
  14. package/.next/standalone/.next/server/app/hypotheses/page_client-reference-manifest.js +1 -1
  15. package/.next/standalone/.next/server/app/ideas/[id]/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/index.html +1 -1
  17. package/.next/standalone/.next/server/app/index.rsc +1 -1
  18. package/.next/standalone/.next/server/app/kanban/page_client-reference-manifest.js +1 -1
  19. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  20. package/.next/standalone/.next/server/app/roadmap/[id]/page_client-reference-manifest.js +1 -1
  21. package/.next/standalone/.next/server/app/roadmap/investors/page_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/roadmap/page_client-reference-manifest.js +1 -1
  23. package/.next/standalone/.next/server/app/roadmap/public/page_client-reference-manifest.js +1 -1
  24. package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  25. package/.next/standalone/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  26. package/.next/standalone/.next/server/app/settings.html +1 -1
  27. package/.next/standalone/.next/server/app/settings.rsc +1 -1
  28. package/.next/standalone/.next/server/app/social/page_client-reference-manifest.js +1 -1
  29. package/.next/standalone/.next/server/app/social.html +1 -1
  30. package/.next/standalone/.next/server/app/social.rsc +2 -2
  31. package/.next/standalone/.next/server/app/updates/[id]/page_client-reference-manifest.js +1 -1
  32. package/.next/standalone/.next/server/app/updates/new/page_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/updates/new.html +1 -1
  34. package/.next/standalone/.next/server/app/updates/new.rsc +2 -2
  35. package/.next/standalone/.next/server/app/updates/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/app-paths-manifest.json +21 -21
  37. package/.next/standalone/.next/server/pages/404.html +1 -1
  38. package/.next/standalone/.next/server/pages/500.html +1 -1
  39. package/.next/standalone/.next/server/server-reference-manifest.json +1 -1
  40. package/.next/standalone/package.json +1 -1
  41. package/.next/static/chunks/147-b00f2ac2bbec93ae.js +1 -0
  42. package/.next/static/chunks/159-4ce492ccac6de8f7.js +1 -0
  43. package/.next/static/chunks/47-eba0f8b4f9b17641.js +1 -0
  44. package/.next/static/chunks/879-7fbd95e93ddc4636.js +1 -0
  45. package/.next/static/chunks/app/briefing/page-683aba0c52e910d7.js +1 -0
  46. package/.next/static/chunks/app/goals/[id]/page-40818dc7e710eeda.js +1 -0
  47. package/.next/static/chunks/app/ideas/[id]/page-5f33e0ecf590ddec.js +1 -0
  48. package/.next/static/chunks/app/roadmap/[id]/page-9ba8a537e30c633c.js +1 -0
  49. package/.next/static/chunks/app/social/page-21daeca0cf8af46b.js +1 -0
  50. package/.next/static/chunks/app/updates/new/page-ac5b966024ce0ddc.js +1 -0
  51. package/README.md +9 -1
  52. package/dist/bin/vibebusiness.js +37 -7
  53. package/dist/scripts/build.js +69 -28
  54. package/dist/scripts/init.js +35 -1
  55. package/package.json +1 -1
  56. package/.next/static/chunks/147-271b001e9a7f5e6c.js +0 -1
  57. package/.next/static/chunks/159-82cfa8b54cbd2c11.js +0 -1
  58. package/.next/static/chunks/47-bab84ed5cfb8fd9d.js +0 -1
  59. package/.next/static/chunks/879-ae588e66e8e0b1d0.js +0 -1
  60. package/.next/static/chunks/app/briefing/page-a38c83adfb5ef570.js +0 -1
  61. package/.next/static/chunks/app/goals/[id]/page-ce4e225f25e7294d.js +0 -1
  62. package/.next/static/chunks/app/ideas/[id]/page-6b28cf279c62a569.js +0 -1
  63. package/.next/static/chunks/app/roadmap/[id]/page-381809badf3910a3.js +0 -1
  64. package/.next/static/chunks/app/social/page-2d71af5da2476063.js +0 -1
  65. package/.next/static/chunks/app/updates/new/page-0acea8b7d66043a5.js +0 -1
  66. /package/.next/static/{hDE9OjFmVd4cqq7fFCfq_ → V849Md7GaY51HIOKjnH8f}/_buildManifest.js +0 -0
  67. /package/.next/static/{hDE9OjFmVd4cqq7fFCfq_ → V849Md7GaY51HIOKjnH8f}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[945],{4340:function(e,t,s){Promise.resolve().then(s.bind(s,8935))},8935:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return Z}});var a=s(7437),l=s(2265),r=s(9376),i=s(7648),n=s(525),c=s(6865),d=s(3085),x=s(2934),o=s(7168),h=s(2660),m=s(8896),u=s(505),p=s(5846),j=s(6362),g=s(1994),N=s(1259),f=s(104),b=s(1047),v=s(9397),y=s(6153),w=s(281);function k(e){let{kpis:t,goalId:s,onUpdateKPI:r}=e,[i,c]=(0,l.useState)(null),[x,o]=(0,l.useState)(null),[h,m]=(0,l.useState)(""),[u,p]=(0,l.useState)(!1),j=async e=>{if(!r||!h.trim())return;let t=parseFloat(h);if(!isNaN(t)){p(!0);try{await r(e,t),o(null),m("")}catch(e){console.error("Failed to update KPI:",e)}finally{p(!1)}}};return(0,a.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 overflow-hidden",children:(0,a.jsxs)("table",{className:"w-full",children:[(0,a.jsx)("thead",{className:"bg-slate-50 border-b border-slate-200",children:(0,a.jsxs)("tr",{children:[(0,a.jsx)("th",{className:"text-left text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3",children:"KPI"}),(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-24",children:"Trend"}),(0,a.jsx)("th",{className:"text-right text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-24",children:"Current"}),(0,a.jsx)("th",{className:"text-right text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-24",children:"Target"}),(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-20",children:"Progress"}),(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-16",children:"Source"}),r&&(0,a.jsx)("th",{className:"text-center text-xs font-medium text-slate-500 uppercase tracking-wider px-4 py-3 w-16",children:"Action"})]})}),(0,a.jsx)("tbody",{className:"divide-y divide-slate-100",children:t.map(e=>{let t=function(e){if(e.history.length<2)return{icon:b.Z,color:"text-slate-400",label:"No trend"};let t=e.history[0].value,s=e.history[e.history.length-1].value,a="higher_is_better"===e.direction?s>t:s<t;return t===s?{icon:b.Z,color:"text-slate-400",label:"Stable"}:a?{icon:n.Z,color:"text-emerald-500",label:"Improving"}:{icon:d.Z,color:"text-red-500",label:"Declining"}}(e),s=null===e.current_value||null===e.target_value?null:"higher_is_better"===e.direction?e.current_value/e.target_value*100:e.current_value<=e.target_value?100:e.target_value/e.current_value*100,l=t.icon,p=i===e.id,N=x===e.id;return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("tr",{className:(0,g.Z)("hover:bg-slate-50 cursor-pointer transition-colors",p&&"bg-slate-50"),onClick:()=>c(p?null:e.id),children:[(0,a.jsx)("td",{className:"px-4 py-3",children:(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("div",{className:"w-16 h-8",children:(0,a.jsx)(w.Z,{kpi:e,height:32,width:64})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900",children:e.name}),(0,a.jsx)("p",{className:"text-xs text-slate-500 line-clamp-1",children:e.description})]})]})}),(0,a.jsx)("td",{className:"px-4 py-3 text-center",children:(0,a.jsx)("span",{className:(0,g.Z)("inline-flex items-center gap-1",t.color),title:t.label,children:(0,a.jsx)(l,{className:"w-4 h-4"})})}),(0,a.jsx)("td",{className:"px-4 py-3 text-right",children:(0,a.jsx)("span",{className:"text-sm font-medium text-slate-900",children:null!==e.current_value?"".concat(e.current_value).concat(e.unit):"--"})}),(0,a.jsx)("td",{className:"px-4 py-3 text-right",children:(0,a.jsx)("span",{className:"text-sm text-slate-500",children:null!==e.target_value?"".concat(e.target_value).concat(e.unit):"--"})}),(0,a.jsx)("td",{className:"px-4 py-3",children:null!==s?(0,a.jsx)("div",{className:"flex items-center justify-center",children:(0,a.jsx)("div",{className:"w-12 h-1.5 bg-slate-100 rounded-full overflow-hidden",children:(0,a.jsx)("div",{className:(0,g.Z)("h-full rounded-full",s>=100?"bg-emerald-500":s>=70?"bg-amber-500":"bg-red-500"),style:{width:"".concat(Math.min(s,100),"%")}})})}):(0,a.jsx)("span",{className:"text-xs text-slate-400 text-center block",children:"--"})}),(0,a.jsx)("td",{className:"px-4 py-3 text-center",children:(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded","manual"===e.source?"bg-slate-100 text-slate-600":"bg-blue-50 text-blue-600"),children:y.en[e.source]})}),r&&(0,a.jsx)("td",{className:"px-4 py-3 text-center",onClick:e=>e.stopPropagation(),children:"manual"===e.source&&(0,a.jsx)("button",{onClick:t=>{var s;t.stopPropagation(),o(e.id),m((null===(s=e.current_value)||void 0===s?void 0:s.toString())||"")},className:"p-1 text-slate-400 hover:text-emerald-600 transition-colors",title:"Add value",children:(0,a.jsx)(v.Z,{className:"w-4 h-4"})})})]},e.id),p&&(0,a.jsx)("tr",{children:(0,a.jsxs)("td",{colSpan:r?7:6,className:"px-4 py-4 bg-slate-50",children:[(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-xs font-medium text-slate-500 uppercase mb-2",children:"History"}),e.history.length>0?(0,a.jsx)("div",{className:"h-32 bg-white rounded border border-slate-200 p-2",children:(0,a.jsx)(w.Z,{kpi:e,height:112,showTarget:!0})}):(0,a.jsx)("div",{className:"h-32 bg-white rounded border border-slate-200 flex items-center justify-center text-sm text-slate-400",children:"No historical data"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-xs font-medium text-slate-500 uppercase mb-2",children:"Details"}),(0,a.jsxs)("dl",{className:"space-y-2 text-sm",children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"Direction"}),(0,a.jsx)("dd",{className:"text-slate-900",children:"higher_is_better"===e.direction?"Higher is better":"Lower is better"})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"Data points"}),(0,a.jsx)("dd",{className:"text-slate-900",children:e.history.length})]}),e.history.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"First recorded"}),(0,a.jsx)("dd",{className:"text-slate-900",children:e.history[0].date})]}),(0,a.jsxs)("div",{className:"flex justify-between",children:[(0,a.jsx)("dt",{className:"text-slate-500",children:"Last updated"}),(0,a.jsx)("dd",{className:"text-slate-900",children:e.history[e.history.length-1].date})]})]})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("h4",{className:"text-xs font-medium text-slate-500 uppercase mb-1",children:"Query"}),(0,a.jsx)("pre",{className:"text-xs text-slate-600 bg-white p-2 rounded border border-slate-200 overflow-x-auto",children:e.query})]})]})]}),N&&"manual"===e.source&&r&&(0,a.jsxs)("div",{className:"mt-4 pt-4 border-t border-slate-200 flex items-center gap-3",children:[(0,a.jsx)("label",{className:"text-sm text-slate-600",children:"Add new value:"}),(0,a.jsx)("input",{type:"number",value:h,onChange:e=>m(e.target.value),className:"w-24 px-2 py-1 text-sm border border-slate-300 rounded focus:ring-2 focus:ring-emerald-500 focus:border-emerald-500",placeholder:"Value",step:"any"}),(0,a.jsx)("span",{className:"text-sm text-slate-500",children:e.unit}),(0,a.jsx)("button",{onClick:()=>j(e.id),disabled:u||!h.trim(),className:"px-3 py-1 text-sm bg-emerald-600 text-white rounded hover:bg-emerald-700 disabled:opacity-50 disabled:cursor-not-allowed",children:u?"Saving...":"Save"}),(0,a.jsx)("button",{onClick:()=>{o(null),m("")},className:"px-3 py-1 text-sm text-slate-600 hover:text-slate-900",children:"Cancel"})]})]})},"".concat(e.id,"-expanded"))]})})})]})})}function _(e){let{status:t}=e;switch(t){case"on_track":return(0,a.jsx)(n.Z,{className:"w-5 h-5"});case"at_risk":return(0,a.jsx)(c.Z,{className:"w-5 h-5"});case"behind":return(0,a.jsx)(d.Z,{className:"w-5 h-5"});case"achieved":return(0,a.jsx)(x.Z,{className:"w-5 h-5"})}}function Z(e){let{params:t}=e;(0,r.useRouter)();let{id:s}=t,[n,c]=(0,l.useState)(null),[d,x]=(0,l.useState)([]),[b,v]=(0,l.useState)(!0),[w,Z]=(0,l.useState)(!1),[S,C]=(0,l.useState)(null),P=async()=>{try{let e=await fetch("/api/goals/".concat(s)),t=await e.json();if(!t.success){C(t.error||"Failed to load goal");return}if(c(t.data),t.data.related_ideas.length>0){let e=await fetch("/api/ideas"),s=await e.json();if(s.success){let e=s.data.filter(e=>t.data.related_ideas.includes(e.id));x(e)}}}catch(e){C("Failed to load goal"),console.error("Error fetching goal:",e)}finally{v(!1)}};(0,l.useEffect)(()=>{P()},[s]);let I=async(e,t)=>{try{let a=await fetch("/api/goals/".concat(s,"/kpis"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({kpi_id:e,action:"add_history",value:t})}),l=await a.json();if(l.success)await P();else throw Error(l.error)}catch(e){throw console.error("Failed to update KPI:",e),e}},T=async e=>{try{let t=await fetch("/api/goals/".concat(s),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e})}),a=await t.json();a.success&&c(a.data)}catch(e){console.error("Failed to update status:",e)}},F=async()=>{Z(!0);try{let e=await fetch("/api/kpis/refresh",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({goal_id:s})}),t=await e.json();t.success||console.error("KPI refresh failed:",t.error),await P()}catch(e){console.error("Error refreshing KPIs:",e)}finally{Z(!1)}};return b?(0,a.jsx)(N.default,{children:(0,a.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,a.jsx)(o.Z,{className:"w-8 h-8 text-slate-400 animate-spin"})})}):S||!n?(0,a.jsx)(N.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(i.default,{href:"/goals",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Goals"})]}),(0,a.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 text-center",children:(0,a.jsx)("p",{className:"text-red-600",children:S||"Goal not found"})})]})}):(0,a.jsx)(N.default,{children:(0,a.jsxs)("div",{className:"p-6",children:[(0,a.jsxs)(i.default,{href:"/goals",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,a.jsx)(h.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Goals"})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-4",children:[(0,a.jsx)("div",{className:"w-14 h-14 bg-emerald-100 rounded-xl flex items-center justify-center flex-shrink-0",children:(0,a.jsx)(m.Z,{className:"w-7 h-7 text-emerald-600"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-2 py-0.5 rounded-full",y.l5[n.category]),children:y.kT[n.category]})}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-1",children:n.title}),(0,a.jsx)("p",{className:"text-slate-500",children:n.description})]})]}),(0,a.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,a.jsxs)("span",{className:(0,g.Z)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border",y.i2[n.status]),children:[(0,a.jsx)(_,{status:n.status}),(0,a.jsx)("span",{children:y.tV[n.status]})]}),(0,a.jsxs)("select",{value:n.status,onChange:e=>T(e.target.value),className:"text-xs border border-slate-200 rounded px-2 py-1 text-slate-600",children:[(0,a.jsx)("option",{value:"on_track",children:"On Track"}),(0,a.jsx)("option",{value:"at_risk",children:"At Risk"}),(0,a.jsx)("option",{value:"behind",children:"Behind"}),(0,a.jsx)("option",{value:"achieved",children:"Achieved"})]})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-6 text-sm text-slate-500 mb-6",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(u.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Deadline: ",(0,a.jsx)("span",{className:"font-medium text-slate-700",children:n.deadline})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(p.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:[n.related_ideas.length," linked ideas"]})]})]}),(0,a.jsx)(f.Z,{current:n.current_value,target:n.target_value,unit:n.target_unit,status:n.status})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"lg:col-span-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Key Performance Indicators (",n.kpis.length,")"]}),(0,a.jsxs)("button",{onClick:F,disabled:w,className:"inline-flex items-center gap-2 px-3 py-1.5 text-sm text-slate-600 hover:text-slate-900 border border-slate-200 rounded-lg hover:bg-slate-50 disabled:opacity-50",children:[(0,a.jsx)(o.Z,{className:(0,g.Z)("w-4 h-4",w&&"animate-spin")}),(0,a.jsx)("span",{children:w?"Refreshing...":"Refresh KPIs"})]})]}),n.kpis.length>0?(0,a.jsx)(k,{kpis:n.kpis,goalId:n.id,onUpdateKPI:I}):(0,a.jsx)("div",{className:"bg-white rounded-lg border border-slate-200 p-8 text-center",children:(0,a.jsx)("p",{className:"text-slate-500",children:"No KPIs defined for this goal."})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Related Ideas"}),d.length>0?(0,a.jsx)("div",{className:"space-y-3",children:d.map(e=>(0,a.jsxs)(i.default,{href:"/ideas/".concat(e.id),className:"block bg-white rounded-lg border border-slate-200 p-4 hover:border-emerald-300 hover:shadow-sm transition-all",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-900 mb-1",children:e.title}),(0,a.jsx)("p",{className:"text-xs text-slate-500 line-clamp-2",children:e.summary})]}),(0,a.jsx)(j.Z,{className:"w-4 h-4 text-slate-400 flex-shrink-0"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2 mt-2",children:[(0,a.jsx)("span",{className:(0,g.Z)("text-xs px-1.5 py-0.5 rounded","shipped"===e.stage?"bg-green-100 text-green-700":"in_progress"===e.stage?"bg-violet-100 text-violet-700":"bg-slate-100 text-slate-600"),children:e.stage.replace("_"," ")}),e.expected_impact&&(0,a.jsx)("span",{className:"text-xs text-slate-400",children:e.expected_impact})]})]},e.id))}):(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 text-center",children:[(0,a.jsx)(p.Z,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-3",children:"No ideas linked to this goal yet."}),(0,a.jsx)(i.default,{href:"/",className:"text-sm text-emerald-600 hover:text-emerald-700",children:"Browse Ideas"})]}),(0,a.jsxs)("div",{className:"mt-6 bg-slate-50 rounded-lg border border-slate-200 p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-700 mb-2",children:"Tip: Link Ideas to Goals"}),(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"When approving ideas, link them to this goal to track which improvements support your business objectives. Ideas linked to goals are prioritized in the analysis process."})]})]})]}),(0,a.jsxs)("div",{className:"mt-6 text-xs text-slate-400",children:[(0,a.jsxs)("p",{children:["Created: ",new Date(n.created_at).toLocaleString()]}),(0,a.jsxs)("p",{children:["Last updated: ",new Date(n.updated_at).toLocaleString()]})]})]})})}}},function(e){e.O(0,[972,879,619,971,117,744],function(){return e(e.s=4340)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[594],{1264:function(e,t,s){Promise.resolve().then(s.bind(s,1259)),Promise.resolve().then(s.bind(s,9534))},1259:function(e,t,s){"use strict";s.d(t,{default:function(){return j}});var a=s(7437),r=s(7648),l=s(9376),n=s(5929),i=s(5466),c=s(2048),d=s(8896),o=s(8220),m=s(2718),x=s(5621),h=s(8728),u=s(2222),p=s(2023),b=s(1994);let g=[{href:"/briefing",label:"Briefing",icon:(0,a.jsx)(n.Z,{size:18})},{href:"/kanban",label:"Dashboard",icon:(0,a.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,a.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,a.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,a.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,a.jsx)(m.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,a.jsx)(x.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,a.jsx)(h.Z,{className:"w-5 h-5"})}];function j(e){let{children:t}=e,s=(0,l.usePathname)();return(0,a.jsxs)("div",{className:"min-h-screen flex",children:[(0,a.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,a.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,a.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)(u.Z,{className:"w-6 h-6 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:"AI Product Manager"})]})]})}),(0,a.jsx)("nav",{className:"flex-1 p-4",children:(0,a.jsx)("ul",{className:"space-y-1",children:g.map(e=>{let t=s.startsWith(e.href);return(0,a.jsx)("li",{children:(0,a.jsxs)(r.default,{href:e.href,className:(0,b.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]})},e.href)})})}),(0,a.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(p.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,a.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},9534:function(e,t,s){"use strict";s.d(t,{default:function(){return ec}});var a=s(7437),r=s(7648),l=s(2265),n=s(519),i=s(1817),c=s(2934),d=s(9388),o=s(5554),m=s(6865),x=s(875),h=s(407),u=s(1723),p=s(1947),b=s(221),g=s(5368),j=s(1047),f=s(4286),N=s(1102),v=s(3113),w=s(2735),_=s(2660),y=s(505),Z=s(1239),S=s(525),k=s(8736),C=s(3781),R=s(6362),I=s(5846),P=s(8896),D=s(933),A=s(1994),F=s(6153),T=s(9376),M=s(1671),q=s(9227),E=s(3276),G=s(7829),O=s(9076),z=s(6076);let L={primary:"btn-primary",secondary:"btn-secondary",danger:"btn-danger",warning:"bg-amber-500 text-white hover:bg-amber-600 focus:ring-amber-500"};function U(e){let{ideaId:t,currentStage:s}=e,r=(0,T.useRouter)(),[n,c]=(0,l.useState)(!1),[o,m]=(0,l.useState)(null),[x,h]=(0,l.useState)(null),[p,b]=(0,l.useState)(""),g=function(e){switch(e){case"inbox":return[{toStage:"under_review",label:"Start Review",icon:(0,a.jsx)(u.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"rejected",label:"Reject",icon:(0,a.jsx)(d.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"under_review":return[{toStage:"approved",label:"Approve",icon:(0,a.jsx)(M.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"deferred",label:"Defer",icon:(0,a.jsx)(q.Z,{className:"w-4 h-4"}),variant:"warning",requiresComment:!0},{toStage:"rejected",label:"Reject",icon:(0,a.jsx)(d.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"approved":return[{toStage:"in_progress",label:"Start Implementation",icon:(0,a.jsx)(E.Z,{className:"w-4 h-4"}),variant:"primary",triggerImplementation:!0},{toStage:"deferred",label:"Defer",icon:(0,a.jsx)(q.Z,{className:"w-4 h-4"}),variant:"warning",requiresComment:!0}];case"in_progress":return[{toStage:"testing",label:"Move to Testing",icon:(0,a.jsx)(G.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"approved",label:"Back to Approved",icon:(0,a.jsx)(O.Z,{className:"w-4 h-4"}),variant:"secondary"}];case"testing":return[{toStage:"shipped",label:"Ship It!",icon:(0,a.jsx)(z.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"in_progress",label:"Back to In Progress",icon:(0,a.jsx)(O.Z,{className:"w-4 h-4"}),variant:"secondary"}];case"shipped":return[{toStage:"rolled_back",label:"Roll Back",icon:(0,a.jsx)(O.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"deferred":return[{toStage:"under_review",label:"Reopen Review",icon:(0,a.jsx)(u.Z,{className:"w-4 h-4"}),variant:"primary"},{toStage:"rejected",label:"Reject",icon:(0,a.jsx)(d.Z,{className:"w-4 h-4"}),variant:"danger",requiresComment:!0}];case"rejected":case"rolled_back":return[{toStage:"inbox",label:"Reopen",icon:(0,a.jsx)(O.Z,{className:"w-4 h-4"}),variant:"secondary"}];default:return[]}}(s),j=async(e,s)=>{c(!0),m(e);try{(await fetch("/api/ideas/".concat(t,"/transition"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({to_stage:e,comment:s})})).ok&&r.refresh()}catch(e){console.error("Failed to transition stage:",e)}finally{c(!1),m(null),h(null),b("")}},f=async()=>{c(!0),m("in_progress");try{let e=await fetch("/api/ideas/".concat(t,"/implement"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})}),s=await e.json();s.success?r.refresh():(console.error("Failed to start implementation:",s.error),alert(s.error||"Failed to start implementation"))}catch(e){console.error("Failed to start implementation:",e),alert("Failed to start implementation")}finally{c(!1),m(null)}},N=e=>{e.triggerImplementation?f():e.requiresComment?h(e):j(e.toStage)};return 0===g.length?null:(0,a.jsxs)("div",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"text-sm text-slate-500",children:["Current stage: ",(0,a.jsx)("span",{className:"font-medium text-slate-700",children:F.yb[s]})]}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:g.map(e=>(0,a.jsxs)("button",{onClick:()=>N(e),disabled:n,className:(0,A.Z)("btn gap-2",L[e.variant],n&&"opacity-75"),children:[o===e.toStage?(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}):e.icon,(0,a.jsx)("span",{children:e.label})]},e.toStage))}),x&&(0,a.jsx)("div",{className:"fixed inset-0 bg-black/50 flex items-center justify-center z-50",children:(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-xl p-6 w-full max-w-md animate-slide-in",children:[(0,a.jsx)("h3",{className:"text-lg font-semibold text-slate-900 mb-2",children:x.label}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mb-4",children:"Please provide a reason for this action."}),(0,a.jsx)("textarea",{value:p,onChange:e=>b(e.target.value),placeholder:"Enter your comment...",className:"textarea h-24 mb-4",autoFocus:!0}),(0,a.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,a.jsx)("button",{onClick:()=>{h(null),b("")},className:"btn btn-secondary",disabled:n,children:"Cancel"}),(0,a.jsxs)("button",{onClick:()=>j(x.toStage,p),disabled:n||!p.trim(),className:(0,A.Z)("btn gap-2",L[x.variant]),children:[n?(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}):x.icon,(0,a.jsx)("span",{children:"Confirm"})]})]})]})})]})}var V=s(2222),B=s(2369),H=s(4743);function W(e){let{ideaId:t,comments:s}=e,r=(0,T.useRouter)(),[n,c]=(0,l.useState)(""),[d,o]=(0,l.useState)(!1),m=async e=>{if(e.preventDefault(),n.trim()&&!d){o(!0);try{(await fetch("/api/ideas/".concat(t,"/comments"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({author:"human",author_name:"Founder",content:n.trim()})})).ok&&(c(""),r.refresh())}catch(e){console.error("Failed to add comment:",e)}finally{o(!1)}}};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"font-semibold text-slate-900",children:"Discussion"}),(0,a.jsx)("div",{className:"space-y-3",children:0===s.length?(0,a.jsx)("p",{className:"text-sm text-slate-400 italic",children:"No comments yet"}):s.map(e=>(0,a.jsxs)("div",{className:(0,A.Z)("comment-bubble",e.author),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:["ai"===e.author?(0,a.jsx)("div",{className:"w-6 h-6 bg-emerald-100 rounded-full flex items-center justify-center",children:(0,a.jsx)(V.Z,{className:"w-3.5 h-3.5 text-emerald-600"})}):(0,a.jsx)("div",{className:"w-6 h-6 bg-blue-100 rounded-full flex items-center justify-center",children:(0,a.jsx)(B.Z,{className:"w-3.5 h-3.5 text-blue-600"})}),(0,a.jsx)("span",{className:"text-sm font-medium text-slate-700",children:e.author_name}),(0,a.jsx)("span",{className:"text-xs text-slate-400",children:new Date(e.created_at).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})})]}),(0,a.jsx)("p",{className:"text-sm text-slate-600 whitespace-pre-wrap",children:e.content})]},e.id))}),(0,a.jsxs)("form",{onSubmit:m,className:"flex gap-2",children:[(0,a.jsx)("input",{type:"text",value:n,onChange:e=>c(e.target.value),placeholder:"Add a comment...",className:"input flex-1",disabled:d}),(0,a.jsx)("button",{type:"submit",disabled:!n.trim()||d,className:"btn btn-primary",children:d?(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}):(0,a.jsx)(H.Z,{className:"w-4 h-4"})})]})]})}var J=s(7168),X=s(401),K=s(8867);let Q={cloning:{label:"Cloning repository...",color:"text-blue-600"},branching:{label:"Creating branch...",color:"text-blue-600"},decomposing:{label:"Decomposing into sub-tasks...",color:"text-amber-600"},implementing:{label:"Implementing changes...",color:"text-violet-600"},testing:{label:"Running tests...",color:"text-cyan-600"},creating_pr:{label:"Creating PR...",color:"text-cyan-600"},completed:{label:"Completed",color:"text-emerald-600"},failed:{label:"Failed",color:"text-red-600"}};function $(e){let{ideaId:t,onComplete:s}=e,[r,n]=(0,l.useState)(null),[c,o]=(0,l.useState)(!0),[m,x]=(0,l.useState)(!1),[h,u]=(0,l.useState)(!1),p=async()=>{try{let e=await fetch("/api/ideas/".concat(t,"/implement")),a=await e.json();a.success&&a.data?(n(a.data),("completed"===a.data.status||"failed"===a.data.status)&&(null==s||s())):n(null)}catch(e){console.error("Failed to fetch implementation status:",e)}finally{o(!1)}};if((0,l.useEffect)(()=>{p();let e=setInterval(()=>{r&&"completed"!==r.status&&"failed"!==r.status&&p()},3e3);return()=>clearInterval(e)},[t]),(0,l.useEffect)(()=>{if(r&&("completed"===r.status||"failed"===r.status))return;let e=setInterval(p,3e3);return()=>clearInterval(e)},[null==r?void 0:r.status]),c)return(0,a.jsxs)("div",{className:"flex items-center gap-2 text-slate-500",children:[(0,a.jsx)(i.Z,{className:"w-4 h-4 animate-spin"}),(0,a.jsx)("span",{className:"text-sm",children:"Loading..."})]});if(!r)return null;let g=Q[r.status]||{label:r.status,color:"text-slate-600"},j=!["completed","failed"].includes(r.status);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("h3",{className:"font-semibold text-slate-900 flex items-center gap-2",children:[(0,a.jsx)(b.Z,{className:"w-4 h-4"}),"Implementation Progress"]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[j?(0,a.jsx)(i.Z,{className:(0,A.Z)("w-5 h-5 animate-spin",g.color)}):"completed"===r.status?(0,a.jsx)(M.Z,{className:"w-5 h-5 text-emerald-600"}):(0,a.jsx)(d.Z,{className:"w-5 h-5 text-red-600"}),(0,a.jsx)("span",{className:(0,A.Z)("font-medium",g.color),children:g.label}),j&&(0,a.jsx)("button",{onClick:p,className:"p-1 text-slate-400 hover:text-slate-600",title:"Refresh",children:(0,a.jsx)(J.Z,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"p-3 bg-slate-50 rounded-lg border border-slate-200",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,a.jsx)(C.Z,{className:"w-4 h-4 text-slate-500"}),(0,a.jsx)("code",{className:"flex-1 bg-slate-200 px-2 py-0.5 rounded font-mono text-xs",children:r.branch_name}),(0,a.jsx)("button",{onClick:()=>{(null==r?void 0:r.branch_name)&&(navigator.clipboard.writeText(r.branch_name),u(!0),setTimeout(()=>u(!1),2e3))},className:"p-1 text-slate-400 hover:text-slate-600",title:"Copy branch name",children:h?(0,a.jsx)(X.Z,{className:"w-4 h-4 text-emerald-600"}):(0,a.jsx)(K.Z,{className:"w-4 h-4"})})]}),(0,a.jsxs)("div",{className:"mt-2 text-xs text-slate-500",children:["Repo: ",r.repo_name," • Workspace: ",r.workspace_path]}),r.pr_url&&(0,a.jsxs)("a",{href:r.pr_url,target:"_blank",rel:"noopener noreferrer",className:"mt-2 flex items-center gap-1 text-sm text-blue-600 hover:underline",children:[(0,a.jsx)("span",{children:"View Pull Request"}),(0,a.jsx)(R.Z,{className:"w-3 h-3"})]})]}),r.error_message&&(0,a.jsx)("div",{className:"p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:r.error_message}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("button",{onClick:()=>x(!m),className:"text-sm text-slate-500 hover:text-slate-700",children:[m?"Hide":"Show"," logs (",r.logs.length,")"]}),m&&(0,a.jsx)("div",{className:"mt-2 p-3 bg-slate-900 rounded-lg max-h-64 overflow-y-auto",children:(0,a.jsx)("pre",{className:"text-xs text-slate-300 font-mono whitespace-pre-wrap",children:r.logs.join("\n")})})]})]})}function Y(e){return new Date(e).toLocaleDateString("en-US",{year:"numeric",month:"long",day:"numeric",hour:"numeric",minute:"2-digit"})}function ee(e){let{title:t,icon:s,children:r}=e;return(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 font-semibold text-slate-900",children:[s,(0,a.jsx)("span",{children:t})]}),(0,a.jsx)("div",{className:"text-sm text-slate-600",children:r})]})}function et(e){let{status:t}=e;switch(t){case"pending":return(0,a.jsx)(n.Z,{className:"w-4 h-4 text-slate-400"});case"in_progress":return(0,a.jsx)(i.Z,{className:"w-4 h-4 text-violet-500 animate-spin"});case"completed":return(0,a.jsx)(c.Z,{className:"w-4 h-4 text-emerald-500"});case"failed":return(0,a.jsx)(d.Z,{className:"w-4 h-4 text-red-500"})}}function es(e){return e?new Date(e).toLocaleString("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"}):""}function ea(e){let{failureType:t}=e;if(!t)return null;let s={timeout:{text:"timeout",className:"bg-orange-100 text-orange-700"},error:{text:"error",className:"bg-red-100 text-red-700"},tests_failed:{text:"tests failed",className:"bg-amber-100 text-amber-700"}}[t];return(0,a.jsx)("span",{className:(0,A.Z)("text-xs px-1.5 py-0.5 rounded font-medium",s.className),children:s.text})}function er(e){let{subTasks:t}=e,[s,r]=(0,l.useState)(null);if(0===t.length)return null;let n=t.filter(e=>"completed"===e.status).length,i=t.filter(e=>"failed"===e.status).length,c=Math.round(n/t.length*100);return(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsxs)(ee,{title:"Sub-Tasks",icon:(0,a.jsx)(o.Z,{className:"w-4 h-4 text-violet-500"}),children:[(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-xs mb-1",children:[(0,a.jsxs)("span",{className:"text-slate-500",children:[n,"/",t.length," done",i>0&&(0,a.jsxs)("span",{className:"text-red-500 ml-1",children:["(",i," failed)"]})]}),(0,a.jsxs)("span",{className:"text-slate-500",children:[c,"%"]})]}),(0,a.jsx)("div",{className:"w-full bg-slate-200 rounded-full h-2",children:(0,a.jsx)("div",{className:(0,A.Z)("h-2 rounded-full transition-all",i>0?"bg-red-500":"bg-emerald-500"),style:{width:"".concat(c,"%")}})})]}),(0,a.jsx)("ul",{className:"space-y-2",children:t.map(e=>{let t=s===e.id;return(0,a.jsxs)("li",{className:"border border-slate-100 rounded-lg",children:[(0,a.jsxs)("button",{onClick:()=>r(t?null:e.id),className:"w-full flex items-center gap-2 p-2 text-left hover:bg-slate-50 rounded-lg",children:[(0,a.jsx)(et,{status:e.status}),(0,a.jsx)("span",{className:(0,A.Z)("flex-1 text-sm","completed"===e.status&&"line-through text-slate-400","failed"===e.status&&"text-red-600"),children:e.title}),"failed"===e.status&&e.failure_type&&(0,a.jsx)(ea,{failureType:e.failure_type}),e.has_uncommitted_changes&&(0,a.jsx)("span",{title:"Uncommitted changes in workspace",children:(0,a.jsx)(m.Z,{className:"w-3.5 h-3.5 text-amber-500"})}),t?(0,a.jsx)(x.Z,{className:"w-3 h-3 text-slate-400"}):(0,a.jsx)(h.Z,{className:"w-3 h-3 text-slate-400"})]}),t&&(0,a.jsxs)("div",{className:"px-8 pb-3 space-y-3",children:[(0,a.jsx)("p",{className:"text-xs text-slate-600 whitespace-pre-wrap",children:e.description}),(e.duration_ms||e.lines_added||e.lines_removed)&&(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 text-xs text-slate-500",children:[e.duration_ms&&(0,a.jsxs)("span",{className:"flex items-center gap-1",children:[(0,a.jsx)(u.Z,{className:"w-3 h-3"}),function(e){if(!e)return"";let t=Math.floor(e/1e3),s=Math.floor(t/60),a=Math.floor(s/60);return a>0?"".concat(a,"h ").concat(s%60,"m"):s>0?"".concat(s,"m ").concat(t%60,"s"):"".concat(t,"s")}(e.duration_ms)]}),(e.lines_added||e.lines_removed)&&(0,a.jsxs)("span",{className:"flex items-center gap-1 font-mono",children:[(0,a.jsx)(p.Z,{className:"w-3 h-3"}),(0,a.jsxs)("span",{className:"text-emerald-600",children:["+",e.lines_added||0]}),(0,a.jsxs)("span",{className:"text-red-600",children:["-",e.lines_removed||0]})]})]}),e.files_changed&&e.files_changed.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("span",{className:"text-xs font-medium text-emerald-600 flex items-center gap-1",children:[(0,a.jsx)(p.Z,{className:"w-3 h-3"}),"Files Changed:"]}),(0,a.jsx)("ul",{className:"mt-1",children:e.files_changed.map(e=>(0,a.jsx)("li",{className:"text-xs text-slate-600 font-mono",children:e},e))})]}),e.files_to_modify.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500",children:"Planned Files:"}),(0,a.jsx)("ul",{className:"mt-1",children:e.files_to_modify.map(e=>(0,a.jsx)("li",{className:"text-xs text-slate-400 font-mono",children:e},e))})]}),e.error_message&&(0,a.jsx)("div",{className:"p-2 bg-red-50 border border-red-200 rounded text-xs text-red-700 whitespace-pre-wrap",children:e.error_message}),e.output_snippet&&(0,a.jsxs)("details",{className:"group",children:[(0,a.jsxs)("summary",{className:"text-xs font-medium text-slate-500 cursor-pointer flex items-center gap-1",children:[(0,a.jsx)(b.Z,{className:"w-3 h-3"}),"Output",(0,a.jsx)(h.Z,{className:"w-3 h-3 group-open:rotate-90 transition-transform"})]}),(0,a.jsx)("pre",{className:"mt-1 p-2 bg-slate-50 border border-slate-200 rounded text-xs text-slate-600 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:e.output_snippet})]}),e.has_uncommitted_changes&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2 bg-amber-50 border border-amber-200 rounded text-xs text-amber-700",children:[(0,a.jsx)(m.Z,{className:"w-3.5 h-3.5"}),"Uncommitted changes in workspace"]}),e.commit_hash&&(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:["Commit: ",(0,a.jsx)("code",{className:"bg-slate-100 px-1 rounded",children:e.commit_hash.slice(0,8)})]}),(e.started_at||e.completed_at)&&(0,a.jsxs)("div",{className:"text-xs text-slate-400",children:[e.started_at&&(0,a.jsxs)("span",{children:["Started: ",es(e.started_at)]}),e.completed_at&&(0,a.jsxs)("span",{className:"ml-3",children:["Finished: ",es(e.completed_at)]})]})]})]},e.id)})})]})})}function el(e){let{status:t}=e;switch(t){case"met":return(0,a.jsx)(c.Z,{className:"w-4 h-4 text-emerald-500"});case"partially_met":return(0,a.jsx)(m.Z,{className:"w-4 h-4 text-amber-500"});case"not_met":return(0,a.jsx)(d.Z,{className:"w-4 h-4 text-red-500"});case"no_data":return(0,a.jsx)(g.Z,{className:"w-4 h-4 text-slate-400"});default:return(0,a.jsx)(j.Z,{className:"w-4 h-4 text-slate-400"})}}function en(e){let{verification:t}=e;return(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsxs)(ee,{title:"Post-Ship Verification",icon:(0,a.jsx)(f.Z,{className:"w-4 h-4 text-emerald-500"}),children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 mb-3",children:[(0,a.jsx)("span",{className:(0,A.Z)("text-xs font-medium px-2 py-1 rounded",F.aR[t.status]),children:F.Wb[t.status]}),t.confidence&&(0,a.jsxs)("span",{className:"text-xs text-slate-500",children:["Confidence: ",t.confidence]})]}),t.summary&&(0,a.jsx)("p",{className:"text-sm text-slate-700 mb-4",children:t.summary}),t.requires_human_review&&(0,a.jsxs)("div",{className:"flex items-center gap-2 p-2 mb-4 bg-amber-50 border border-amber-200 rounded text-xs text-amber-700",children:[(0,a.jsx)(N.Z,{className:"w-3.5 h-3.5 flex-shrink-0"}),(0,a.jsxs)("span",{children:["Requires human review: ",t.human_review_reason||"Review needed"]})]}),t.metric_evaluations.length>0&&(0,a.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500 uppercase",children:"Metric Results"}),(0,a.jsx)("ul",{className:"space-y-1.5",children:t.metric_evaluations.map((e,t)=>(0,a.jsxs)("li",{className:"flex items-start gap-2",children:[(0,a.jsx)(el,{status:e.status}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsx)("p",{className:"text-xs text-slate-700",children:e.metric}),(0,a.jsx)("p",{className:"text-xs text-slate-500 mt-0.5",children:e.evidence})]})]},t))})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-4 text-xs text-slate-400 pt-3 border-t border-slate-100",children:[t.first_evaluated_at&&(0,a.jsxs)("span",{children:["First evaluated: ",Y(t.first_evaluated_at)]}),t.evaluation_count>0&&(0,a.jsxs)("span",{children:["Evaluations: ",t.evaluation_count]}),t.next_evaluation_after&&(0,a.jsxs)("span",{children:["Next check: ",new Date(t.next_evaluation_after).toLocaleDateString("en-US",{month:"short",day:"numeric",year:"numeric"})]})]}),t.follow_up_idea_ids.length>0&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-100",children:[(0,a.jsx)("span",{className:"text-xs font-medium text-slate-500",children:"Follow-up ideas:"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-1",children:t.follow_up_idea_ids.map(e=>(0,a.jsx)(r.default,{href:"/ideas/".concat(e),className:"text-xs text-blue-600 hover:underline bg-blue-50 px-1.5 py-0.5 rounded",children:e},e))})]})]})})}function ei(e){let{ideaId:t}=e,[s,r]=(0,l.useState)(!1),n="/api/ideas/".concat(t,"/card");return((0,l.useEffect)(()=>{fetch(n,{method:"HEAD"}).then(e=>{e.ok&&r(!0)}).catch(()=>{})},[n]),s)?(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(ee,{title:"Ship Card",icon:(0,a.jsx)(v.Z,{className:"w-4 h-4 text-violet-500"}),children:(0,a.jsxs)("div",{className:"mt-2",children:[(0,a.jsx)("img",{src:n,alt:"Ship announcement card",className:"w-full rounded-lg border border-slate-200"}),(0,a.jsxs)("a",{href:n,download:"".concat(t,"-card.png"),className:"inline-flex items-center gap-1.5 mt-3 text-xs text-slate-500 hover:text-slate-700",children:[(0,a.jsx)(w.Z,{className:"w-3.5 h-3.5"}),"Download PNG"]})]})})}):null}function ec(e){let{idea:t,linkedGoal:s}=e;return(0,a.jsxs)("div",{className:"max-w-4xl mx-auto p-6",children:[(0,a.jsxs)(r.default,{href:"/",className:"inline-flex items-center gap-2 text-sm text-slate-500 hover:text-slate-700 mb-6",children:[(0,a.jsx)(_.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Back to Dashboard"})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6 mb-6",children:[(0,a.jsx)("div",{className:"flex items-start justify-between mb-4",children:(0,a.jsxs)("div",{className:"flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2 mb-3",children:[(0,a.jsx)("span",{className:(0,A.Z)("priority-badge",F.Gs[t.priority]),children:F.rF[t.priority]}),(0,a.jsx)("span",{className:(0,A.Z)("category-badge",F.pG[t.category]),children:F.Hs[t.category]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("div",{className:(0,A.Z)("stage-indicator",F.lv[t.stage])}),(0,a.jsx)("span",{className:"text-xs text-slate-500",children:F.yb[t.stage]})]})]}),(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-2",children:t.title}),(0,a.jsx)("p",{className:"text-slate-600",children:t.summary})]})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-6 text-sm text-slate-500 pt-4 border-t border-slate-100",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(y.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Created ",Y(t.created_at)]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Z.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Effort: ",F.bi[t.effort]]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(S.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Impact: ",F.bi[t.impact]]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(k.Z,{className:"w-4 h-4"}),(0,a.jsxs)("span",{children:["Source: ",F.Vr[t.source.type]]})]})]}),t.tags.length>0&&(0,a.jsx)("div",{className:"flex flex-wrap gap-2 mt-4",children:t.tags.map(e=>(0,a.jsx)("span",{className:"px-2 py-1 bg-slate-100 text-slate-600 text-xs rounded",children:e},e))}),t.implementation.branch_name&&(0,a.jsx)("div",{className:"mt-4 p-3 bg-slate-50 rounded-lg border border-slate-200",children:(0,a.jsxs)("div",{className:"flex items-center gap-4 text-sm",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 text-slate-600",children:[(0,a.jsx)(C.Z,{className:"w-4 h-4"}),(0,a.jsx)("code",{className:"bg-slate-200 px-2 py-0.5 rounded",children:t.implementation.branch_name})]}),t.implementation.pr_url&&(0,a.jsxs)("a",{href:t.implementation.pr_url,target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-1 text-blue-600 hover:underline",children:[(0,a.jsx)("span",{children:"View PR"}),(0,a.jsx)(R.Z,{className:"w-3 h-3"})]})]})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-3 gap-6",children:[(0,a.jsxs)("div",{className:"lg:col-span-2 space-y-6",children:[(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(ee,{title:"Context",icon:(0,a.jsx)(I.Z,{className:"w-4 h-4 text-amber-500"}),children:(0,a.jsx)("p",{className:"whitespace-pre-wrap",children:t.context})})}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(ee,{title:"Rationale",icon:(0,a.jsx)(P.Z,{className:"w-4 h-4 text-blue-500"}),children:(0,a.jsx)("p",{className:"whitespace-pre-wrap",children:t.rationale})})}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(ee,{title:"Implementation Plan",icon:(0,a.jsx)(D.Z,{className:"w-4 h-4 text-emerald-500"}),children:(0,a.jsx)("div",{className:"whitespace-pre-wrap",children:t.implementation_plan})})}),t.implementation.sub_tasks&&t.implementation.sub_tasks.length>0&&(0,a.jsx)(er,{subTasks:t.implementation.sub_tasks}),"shipped"===t.stage&&t.verification&&(0,a.jsx)(en,{verification:t.verification}),"shipped"===t.stage&&(0,a.jsx)(ei,{ideaId:t.id}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(ee,{title:"Success Metrics",icon:(0,a.jsx)(S.Z,{className:"w-4 h-4 text-violet-500"}),children:(0,a.jsx)("ul",{className:"list-disc list-inside space-y-1",children:t.success_metrics.map((e,t)=>(0,a.jsx)("li",{children:e},t))})})})]}),(0,a.jsxs)("div",{className:"space-y-6",children:[(s||t.expected_impact)&&(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:[(0,a.jsxs)("h3",{className:"flex items-center gap-2 font-semibold text-slate-900 mb-3",children:[(0,a.jsx)(P.Z,{className:"w-4 h-4 text-emerald-500"}),(0,a.jsx)("span",{children:"Goal Alignment"})]}),s?(0,a.jsxs)(r.default,{href:"/goals/".concat(s.id),className:"block p-3 bg-emerald-50 border border-emerald-200 rounded-lg hover:border-emerald-300 transition-colors",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,a.jsx)("span",{className:"text-sm font-medium text-emerald-800",children:s.title}),(0,a.jsx)(R.Z,{className:"w-3 h-3 text-emerald-600"})]}),(0,a.jsx)("p",{className:"text-xs text-emerald-600 line-clamp-2",children:s.description})]}):t.goal_id?(0,a.jsxs)("p",{className:"text-sm text-slate-500",children:["Linked to goal: ",(0,a.jsx)("code",{className:"text-xs bg-slate-100 px-1 rounded",children:t.goal_id})]}):null,t.expected_impact&&(0,a.jsxs)("div",{className:"mt-3 pt-3 border-t border-slate-100",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500 uppercase font-medium mb-1",children:"Expected Impact"}),(0,a.jsx)("p",{className:"text-sm text-slate-700",children:t.expected_impact})]})]}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(U,{ideaId:t.id,currentStage:t.stage})}),["in_progress","testing","shipped","rolled_back"].includes(t.stage)&&(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)($,{ideaId:t.id})}),(0,a.jsx)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:(0,a.jsx)(W,{ideaId:t.id,comments:t.comments})}),t.source.files_analyzed&&t.source.files_analyzed.length>0&&(0,a.jsxs)("div",{className:"bg-white rounded-lg shadow-sm border border-slate-200 p-6",children:[(0,a.jsx)("h3",{className:"font-semibold text-slate-900 mb-3",children:"Files Analyzed"}),(0,a.jsx)("ul",{className:"space-y-1",children:t.source.files_analyzed.map((e,t)=>(0,a.jsx)("li",{className:"text-xs text-slate-500 font-mono truncate",children:e},t))})]})]})]})]})}},6153:function(e,t,s){"use strict";s.d(t,{G:function(){return i},GK:function(){return Z},Gs:function(){return o},Hs:function(){return a},PN:function(){return u},PW:function(){return _},Q_:function(){return p},R$:function(){return v},Vr:function(){return m},Wb:function(){return h},aR:function(){return x},bi:function(){return c},en:function(){return N},i2:function(){return f},kT:function(){return b},l5:function(){return g},lE:function(){return w},lv:function(){return n},pG:function(){return r},rF:function(){return d},tV:function(){return j},tl:function(){return y},xP:function(){return S},yb:function(){return l}});let a={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},l={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},n={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],c={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},d={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},m={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",growth_distribution:"Growth Distribution",manual:"Manual"},x={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},h={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},u={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},p={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},b={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},g={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},j={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},f={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},N={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},v={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},w={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},_={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},y={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},Z={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},S={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[972,47,971,117,744],function(){return e(e.s=1264)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[25],{5794:function(e,t,a){Promise.resolve().then(a.bind(a,47))},9205:function(e,t,a){"use strict";a.d(t,{Z:function(){return d}});var s=a(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),a=0;a<e;a++)t[a]=arguments[a];return t.filter((e,t,a)=>!!e&&a.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,s.forwardRef)((e,t)=>{let{color:a="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:d,className:c="",children:o,iconNode:u,...h}=e;return(0,s.createElement)("svg",{ref:t,...l,width:r,height:r,stroke:a,strokeWidth:d?24*Number(i)/Number(r):i,className:n("lucide",c),...h},[...u.map(e=>{let[t,a]=e;return(0,s.createElement)(t,a)}),...Array.isArray(o)?o:[o]])}),d=(e,t)=>{let a=(0,s.forwardRef)((a,l)=>{let{className:d,...c}=a;return(0,s.createElement)(i,{ref:l,iconNode:t,className:n("lucide-".concat(r(e)),d),...c})});return a.displayName="".concat(e),a}},2660:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},2222:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Bot",[["path",{d:"M12 8V4H8",key:"hb8ula"}],["rect",{width:"16",height:"12",x:"4",y:"8",rx:"2",key:"enze0r"}],["path",{d:"M2 14h2",key:"vft8re"}],["path",{d:"M20 14h2",key:"4cs60a"}],["path",{d:"M15 13v2",key:"1xurst"}],["path",{d:"M9 13v2",key:"rq6x2g"}]])},505:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},6362:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("ExternalLink",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},8220:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("FlaskConical",[["path",{d:"M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2",key:"pzvekw"}],["path",{d:"M8.5 2h7",key:"csnxdl"}],["path",{d:"M7 16h10",key:"wp8him"}]])},5621:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("History",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]])},5466:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("LayoutDashboard",[["rect",{width:"7",height:"9",x:"3",y:"3",rx:"1",key:"10lvy0"}],["rect",{width:"7",height:"5",x:"14",y:"3",rx:"1",key:"16une8"}],["rect",{width:"7",height:"9",x:"14",y:"12",rx:"1",key:"1hutg5"}],["rect",{width:"7",height:"5",x:"3",y:"16",rx:"1",key:"ldoo1y"}]])},5846:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]])},2048:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Map",[["path",{d:"M14.106 5.553a2 2 0 0 0 1.788 0l3.659-1.83A1 1 0 0 1 21 4.619v12.764a1 1 0 0 1-.553.894l-4.553 2.277a2 2 0 0 1-1.788 0l-4.212-2.106a2 2 0 0 0-1.788 0l-3.659 1.83A1 1 0 0 1 3 19.381V6.618a1 1 0 0 1 .553-.894l4.553-2.277a2 2 0 0 1 1.788 0z",key:"169xi5"}],["path",{d:"M15 5.764v15",key:"1pn4in"}],["path",{d:"M9 3.236v15",key:"1uimfh"}]])},2718:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("MessageCircle",[["path",{d:"M7.9 20A9 9 0 1 0 4 16.1L2 22Z",key:"vv11sd"}]])},8728:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Settings",[["path",{d:"M12.22 2h-.44a2 2 0 0 0-2 2v.18a2 2 0 0 1-1 1.73l-.43.25a2 2 0 0 1-2 0l-.15-.08a2 2 0 0 0-2.73.73l-.22.38a2 2 0 0 0 .73 2.73l.15.1a2 2 0 0 1 1 1.72v.51a2 2 0 0 1-1 1.74l-.15.09a2 2 0 0 0-.73 2.73l.22.38a2 2 0 0 0 2.73.73l.15-.08a2 2 0 0 1 2 0l.43.25a2 2 0 0 1 1 1.73V20a2 2 0 0 0 2 2h.44a2 2 0 0 0 2-2v-.18a2 2 0 0 1 1-1.73l.43-.25a2 2 0 0 1 2 0l.15.08a2 2 0 0 0 2.73-.73l.22-.39a2 2 0 0 0-.73-2.73l-.15-.08a2 2 0 0 1-1-1.74v-.5a2 2 0 0 1 1-1.74l.15-.09a2 2 0 0 0 .73-2.73l-.22-.38a2 2 0 0 0-2.73-.73l-.15.08a2 2 0 0 1-2 0l-.43-.25a2 2 0 0 1-1-1.73V4a2 2 0 0 0-2-2z",key:"1qme2f"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}]])},2023:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},5929:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Sun",[["circle",{cx:"12",cy:"12",r:"4",key:"4exip2"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"m4.93 4.93 1.41 1.41",key:"149t6j"}],["path",{d:"m17.66 17.66 1.41 1.41",key:"ptbguv"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"m6.34 17.66-1.41 1.41",key:"1m8zz5"}],["path",{d:"m19.07 4.93-1.41 1.41",key:"1shlcs"}]])},8896:function(e,t,a){"use strict";a.d(t,{Z:function(){return s}});let s=(0,a(9205).Z)("Target",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"12",r:"6",key:"1vlfrh"}],["circle",{cx:"12",cy:"12",r:"2",key:"1c9p78"}]])},7648:function(e,t,a){"use strict";a.d(t,{default:function(){return r.a}});var s=a(2972),r=a.n(s)},9376:function(e,t,a){"use strict";var s=a(5475);a.o(s,"usePathname")&&a.d(t,{usePathname:function(){return s.usePathname}}),a.o(s,"useRouter")&&a.d(t,{useRouter:function(){return s.useRouter}})},47:function(e,t,a){"use strict";a.r(t),a.d(t,{default:function(){return m}});var s=a(7437),r=a(2265),n=a(7648),l=a(2660);let i=(0,a(9205).Z)("Layers",[["path",{d:"m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z",key:"8b97xw"}],["path",{d:"m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65",key:"dd6zsq"}],["path",{d:"m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65",key:"ep9fru"}]]);var d=a(5846),c=a(8896),o=a(505),u=a(6362),h=a(1994),x=a(1259),p=a(6153);function m(e){let{params:t}=e,{id:a}=t,[m,g]=(0,r.useState)(null),[f,b]=(0,r.useState)([]),[v,y]=(0,r.useState)(null),[j,w]=(0,r.useState)(!0),[k,N]=(0,r.useState)(null);(0,r.useEffect)(()=>{!async function(){try{let e=await fetch("/api/epics/".concat(a)),t=await e.json();if(!t.success){N(t.error||"Failed to load epic");return}if(g(t.data),t.data.idea_ids.length>0){let e=await fetch("/api/ideas"),a=await e.json();if(a.success){let e=t.data.idea_ids.map(e=>a.data.find(t=>t.id===e)).filter(Boolean);b(e)}}if(t.data.goal_id){let e=await fetch("/api/goals/".concat(t.data.goal_id)),a=await e.json();a.success&&y(a.data)}}catch(e){N("Failed to load epic"),console.error("Error fetching epic:",e)}finally{w(!1)}}()},[a]);let Z=async e=>{try{let t=await fetch("/api/epics/".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({status:e,status_override:!0})}),s=await t.json();s.success&&g(s.data)}catch(e){console.error("Failed to update status:",e)}};return j?(0,s.jsx)(x.default,{children:(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsx)("div",{className:"w-8 h-8 border-4 border-slate-200 border-t-blue-500 rounded-full animate-spin"})})}):k||!m?(0,s.jsx)(x.default,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)(n.default,{href:"/roadmap",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,s.jsx)(l.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Back to Roadmap"})]}),(0,s.jsx)("div",{className:"bg-red-50 border border-red-200 rounded-lg p-6 text-center",children:(0,s.jsx)("p",{className:"text-red-600",children:k||"Epic not found"})})]})}):(0,s.jsx)(x.default,{children:(0,s.jsxs)("div",{className:"p-6",children:[(0,s.jsxs)(n.default,{href:"/roadmap",className:"inline-flex items-center gap-2 text-slate-600 hover:text-slate-900 mb-6",children:[(0,s.jsx)(l.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Back to Roadmap"})]}),(0,s.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6 mb-6",children:[(0,s.jsxs)("div",{className:"flex items-start justify-between mb-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-4",children:[(0,s.jsx)("div",{className:"w-14 h-14 bg-blue-100 rounded-xl flex items-center justify-center flex-shrink-0",children:(0,s.jsx)(i,{className:"w-7 h-7 text-blue-600"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-1",children:(0,s.jsx)("span",{className:(0,h.Z)("text-xs px-2 py-0.5 rounded-full",p.pG[m.category]),children:p.Hs[m.category]})}),(0,s.jsx)("h1",{className:"text-2xl font-bold text-slate-900 mb-1",children:m.title}),(0,s.jsx)("p",{className:"text-slate-500",children:m.description})]})]}),(0,s.jsxs)("div",{className:"flex flex-col items-end gap-2",children:[(0,s.jsx)("span",{className:(0,h.Z)("inline-flex items-center gap-1.5 px-3 py-1.5 rounded-full text-sm font-medium border",p.xP[m.status]),children:p.GK[m.status]}),(0,s.jsxs)("select",{value:m.status,onChange:e=>Z(e.target.value),className:"text-xs border border-slate-200 rounded px-2 py-1 text-slate-600",children:[(0,s.jsx)("option",{value:"planned",children:"Planned"}),(0,s.jsx)("option",{value:"active",children:"Active"}),(0,s.jsx)("option",{value:"completed",children:"Completed"}),(0,s.jsx)("option",{value:"paused",children:"Paused"})]})]})]}),(0,s.jsxs)("div",{className:"flex items-center gap-6 text-sm text-slate-500 mb-4",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(d.Z,{className:"w-4 h-4"}),(0,s.jsxs)("span",{children:[m.idea_ids.length," ideas"]})]}),v&&(0,s.jsxs)(n.default,{href:"/goals/".concat(v.id),className:"flex items-center gap-2 text-emerald-600 hover:text-emerald-700",children:[(0,s.jsx)(c.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:v.title})]})]}),(0,s.jsxs)("div",{className:"flex items-start gap-4 mb-4",children:[(0,s.jsx)(o.Z,{className:"w-4 h-4 text-slate-400 mt-2"}),(0,s.jsxs)("div",{className:"flex items-center gap-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-slate-500 mb-1",children:"Target Start"}),(0,s.jsx)("input",{type:"date",value:m.target_start||"",onChange:async e=>{let t=e.target.value||null;try{let e=await fetch("/api/epics/".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_start:t})}),s=await e.json();s.success&&g(s.data)}catch(e){console.error("Failed to update target_start:",e)}},className:"text-sm border border-slate-200 rounded px-2 py-1 text-slate-700"}),!m.target_start&&(0,s.jsx)("span",{className:"text-[10px] text-slate-400 block mt-0.5",children:"auto-estimated"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs text-slate-500 mb-1",children:"Target End"}),(0,s.jsx)("input",{type:"date",value:m.target_end||"",onChange:async e=>{let t=e.target.value||null;try{let e=await fetch("/api/epics/".concat(a),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({target_end:t})}),s=await e.json();s.success&&g(s.data)}catch(e){console.error("Failed to update target_end:",e)}},className:"text-sm border border-slate-200 rounded px-2 py-1 text-slate-700"}),!m.target_end&&(0,s.jsx)("span",{className:"text-[10px] text-slate-400 block mt-0.5",children:"auto-estimated"})]})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,s.jsxs)("span",{className:"text-xs text-slate-500",children:[m.progress.shipped_count,"/",m.progress.total_ideas," ideas shipped"]}),(0,s.jsxs)("span",{className:"text-xs font-medium text-slate-700",children:[m.progress.progress_pct,"%"]})]}),(0,s.jsx)("div",{className:"relative h-2 bg-slate-100 rounded-full overflow-hidden",children:(0,s.jsx)("div",{className:(0,h.Z)("absolute left-0 top-0 h-full rounded-full transition-all duration-500","completed"===m.status?"bg-emerald-500":"active"===m.status?"bg-blue-500":"bg-slate-300"),style:{width:"".concat(m.progress.progress_pct,"%")}})}),m.progress.effort_total>0&&(0,s.jsxs)("p",{className:"text-xs text-slate-400 mt-1",children:["Effort: ",m.progress.effort_completed,"/",m.progress.effort_total," points completed"]})]})]}),(0,s.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200",children:[(0,s.jsx)("div",{className:"px-6 py-4 border-b border-slate-200",children:(0,s.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Ideas (",f.length,")"]})}),f.length>0?(0,s.jsx)("div",{className:"divide-y divide-slate-100",children:f.map((e,t)=>(0,s.jsxs)(n.default,{href:"/ideas/".concat(e.id),className:"flex items-center gap-4 px-6 py-3 hover:bg-slate-50 transition-colors",children:[(0,s.jsx)("span",{className:"text-xs text-slate-400 w-6 text-center",children:t+1}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("h3",{className:"text-sm font-medium text-slate-900 truncate",children:e.title}),(0,s.jsx)("p",{className:"text-xs text-slate-500 truncate",children:e.summary})]}),(0,s.jsx)("span",{className:(0,h.Z)("text-xs px-2 py-0.5 rounded-full text-white",p.lv[e.stage]),children:p.yb[e.stage]}),(0,s.jsx)("span",{className:"text-xs text-slate-400 w-8 text-center",children:p.bi[e.effort]}),(0,s.jsx)(u.Z,{className:"w-4 h-4 text-slate-300 flex-shrink-0"})]},e.id))}):(0,s.jsxs)("div",{className:"p-8 text-center",children:[(0,s.jsx)(d.Z,{className:"w-8 h-8 text-slate-300 mx-auto mb-2"}),(0,s.jsx)("p",{className:"text-sm text-slate-500",children:"No ideas in this epic yet. Add ideas via the API."})]})]}),(0,s.jsxs)("div",{className:"mt-6 text-xs text-slate-400",children:[(0,s.jsxs)("p",{children:["Created: ",new Date(m.created_at).toLocaleString()]}),(0,s.jsxs)("p",{children:["Last updated: ",new Date(m.updated_at).toLocaleString()]})]})]})})}},1259:function(e,t,a){"use strict";a.d(t,{default:function(){return b}});var s=a(7437),r=a(7648),n=a(9376),l=a(5929),i=a(5466),d=a(2048),c=a(8896),o=a(8220),u=a(2718),h=a(5621),x=a(8728),p=a(2222),m=a(2023),g=a(1994);let f=[{href:"/briefing",label:"Briefing",icon:(0,s.jsx)(l.Z,{size:18})},{href:"/kanban",label:"Dashboard",icon:(0,s.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,s.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,s.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,s.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,s.jsx)(u.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,s.jsx)(h.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,s.jsx)(x.Z,{className:"w-5 h-5"})}];function b(e){let{children:t}=e,a=(0,n.usePathname)();return(0,s.jsxs)("div",{className:"min-h-screen flex",children:[(0,s.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,s.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,s.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,s.jsx)(p.Z,{className:"w-6 h-6 text-white"})}),(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,s.jsx)("p",{className:"text-xs text-slate-400",children:"AI Product Manager"})]})]})}),(0,s.jsx)("nav",{className:"flex-1 p-4",children:(0,s.jsx)("ul",{className:"space-y-1",children:f.map(e=>{let t=a.startsWith(e.href);return(0,s.jsx)("li",{children:(0,s.jsxs)(r.default,{href:e.href,className:(0,g.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,s.jsx)("span",{children:e.label})]})},e.href)})})}),(0,s.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,s.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,s.jsx)(m.Z,{className:"w-4 h-4"}),(0,s.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,s.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},6153:function(e,t,a){"use strict";a.d(t,{G:function(){return i},GK:function(){return Z},Gs:function(){return o},Hs:function(){return s},PN:function(){return p},PW:function(){return k},Q_:function(){return m},R$:function(){return j},Vr:function(){return u},Wb:function(){return x},aR:function(){return h},bi:function(){return d},en:function(){return y},i2:function(){return v},kT:function(){return g},l5:function(){return f},lE:function(){return w},lv:function(){return l},pG:function(){return r},rF:function(){return c},tV:function(){return b},tl:function(){return N},xP:function(){return _},yb:function(){return n}});let s={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},n={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},l={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],d={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},u={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",growth_distribution:"Growth Distribution",manual:"Manual"},h={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},x={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},p={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},m={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},g={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},f={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},b={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},v={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},y={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},j={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},w={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},k={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},N={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},Z={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},_={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}},1994:function(e,t,a){"use strict";t.Z=function(){for(var e,t,a=0,s="",r=arguments.length;a<r;a++)(e=arguments[a])&&(t=function e(t){var a,s,r="";if("string"==typeof t||"number"==typeof t)r+=t;else if("object"==typeof t){if(Array.isArray(t)){var n=t.length;for(a=0;a<n;a++)t[a]&&(s=e(t[a]))&&(r&&(r+=" "),r+=s)}else for(s in t)t[s]&&(r&&(r+=" "),r+=s)}return r}(e))&&(s&&(s+=" "),s+=t);return s}}},function(e){e.O(0,[972,971,117,744],function(){return e(e.s=5794)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[674],{9830:function(e,t,s){Promise.resolve().then(s.bind(s,4687))},4687:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return C}});var a=s(7437),r=s(2265),l=s(9397),n=s(7168),i=s(9322),d=s(6399),c=s(4743),o=s(1259),x=s(505),m=s(2489),h=s(401),u=s(2135),b=s(875),g=s(6362),p=s(2208),f=s(8997),j=s(1178),N=s(2718),w=s(525),v=s(1239),y=s(5675),_=s(8930),k=s(1994),S=s(6153);function Z(e){let{draft:t,onPublish:s,onEdit:l,onDiscard:n}=e,[i,d]=(0,r.useState)(!1),[o,Z]=(0,r.useState)(t.text),[C,P]=(0,r.useState)(!1),[E,A]=(0,r.useState)(!1),T=i?o.length:t.text.length,R=T>280,D="draft"===t.status;async function I(){P(!0);try{await s(t.id)}finally{P(!1)}}async function F(){if(!R&&o.trim()){P(!0);try{await l(t.id,o),d(!1)}finally{P(!1)}}}async function L(){P(!0);try{await n(t.id)}finally{P(!1)}}return(0,a.jsxs)("div",{className:(0,k.Z)("border rounded-lg p-4 transition-colors",D?"bg-white border-slate-200":"bg-slate-50 border-slate-100"),children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:(0,k.Z)("text-xs px-2 py-0.5 rounded-full font-medium",S.Q_[t.source]),children:S.PN[t.source]}),t.is_thread&&t.thread_tweets&&(0,a.jsxs)("span",{className:"text-xs px-2 py-0.5 rounded-full font-medium bg-indigo-50 text-indigo-600 border border-indigo-200",children:[t.thread_tweets.length," tweets"]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[t.scheduled_date&&(0,a.jsxs)("span",{className:"text-xs text-slate-500 flex items-center gap-1",children:[(0,a.jsx)(x.Z,{className:"w-3 h-3"}),new Date(t.scheduled_date+"T00:00:00").toLocaleDateString("en-US",{weekday:"short",month:"short",day:"numeric"})]}),(0,a.jsx)("span",{className:"text-xs text-slate-400",children:new Date(t.created_at).toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})})]})]}),i?(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("textarea",{value:o,onChange:e=>Z(e.target.value),className:"w-full border border-slate-300 rounded-md p-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-blue-500",rows:4,maxLength:300}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-1",children:[(0,a.jsxs)("span",{className:(0,k.Z)("text-xs",R?"text-red-500 font-medium":"text-slate-400"),children:[T,"/280"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsxs)("button",{onClick:()=>{d(!1),Z(t.text)},className:"text-xs text-slate-500 hover:text-slate-700 flex items-center gap-1",disabled:C,children:[(0,a.jsx)(m.Z,{className:"w-3 h-3"})," Cancel"]}),(0,a.jsxs)("button",{onClick:F,className:"text-xs text-blue-600 hover:text-blue-800 flex items-center gap-1 disabled:opacity-50",disabled:C||R||!o.trim(),children:[(0,a.jsx)(h.Z,{className:"w-3 h-3"})," Save"]})]})]})]}):(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("p",{className:"text-sm text-slate-800 whitespace-pre-wrap leading-relaxed",children:t.text}),D&&!t.is_thread&&(0,a.jsx)("div",{className:"mt-1",children:(0,a.jsxs)("span",{className:(0,k.Z)("text-xs",T>260?"text-amber-500":"text-slate-400"),children:[T,"/280"]})}),t.is_thread&&t.thread_tweets&&t.thread_tweets.length>1&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsxs)("button",{onClick:()=>A(!E),className:"text-xs text-indigo-600 hover:text-indigo-800 flex items-center gap-1 transition-colors",children:[E?(0,a.jsx)(u.Z,{className:"w-3 h-3"}):(0,a.jsx)(b.Z,{className:"w-3 h-3"}),E?"Collapse thread":"Show all ".concat(t.thread_tweets.length," tweets")]}),E&&(0,a.jsx)("div",{className:"mt-2 space-y-2 border-l-2 border-indigo-200 pl-3",children:t.thread_tweets.slice(1).map((e,t)=>(0,a.jsxs)("div",{className:"text-sm text-slate-700 whitespace-pre-wrap leading-relaxed",children:[(0,a.jsxs)("span",{className:"text-xs font-medium text-indigo-400 mr-1",children:[t+2,"/"]}),e]},t))})]})]}),"published"===t.status&&t.tweet_url&&(0,a.jsxs)("div",{className:"mb-3 space-y-2",children:[(0,a.jsxs)("a",{href:t.tweet_url,target:"_blank",rel:"noopener noreferrer",className:"text-xs text-blue-500 hover:text-blue-700 flex items-center gap-1",children:[(0,a.jsx)(g.Z,{className:"w-3 h-3"}),"View on X"]}),t.engagement_history&&t.engagement_history.length>0&&(()=>{let e=t.engagement_history[t.engagement_history.length-1],s=100*e.engagement_rate;return(0,a.jsxs)("div",{className:"flex flex-wrap gap-3 text-xs text-slate-500 pt-1",children:[(0,a.jsxs)("span",{className:"flex items-center gap-1",title:"Impressions",children:[(0,a.jsx)(p.Z,{className:"w-3 h-3"}),e.impressions.toLocaleString()]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",title:"Likes",children:[(0,a.jsx)(f.Z,{className:"w-3 h-3"}),e.likes]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",title:"Bookmarks (10x algorithm weight)",children:[(0,a.jsx)(j.Z,{className:"w-3 h-3"}),e.bookmarks]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",title:"Replies",children:[(0,a.jsx)(N.Z,{className:"w-3 h-3"}),e.replies]}),(0,a.jsxs)("span",{className:"flex items-center gap-1",title:"Retweets",children:[(0,a.jsx)(w.Z,{className:"w-3 h-3"}),e.retweets]}),(0,a.jsxs)("span",{className:(0,k.Z)("flex items-center gap-1 font-medium",s>=2?"text-emerald-600":s>=1?"text-amber-600":"text-red-500"),title:"Engagement rate",children:[(0,a.jsx)(v.Z,{className:"w-3 h-3"}),s.toFixed(2),"%"]})]})})(),t.self_reply_id&&(0,a.jsxs)("span",{className:"text-xs text-emerald-600 flex items-center gap-1",children:[(0,a.jsx)(v.Z,{className:"w-3 h-3"}),"Algorithm boost active (self-reply)"]})]}),D&&!i&&(0,a.jsxs)("div",{className:"flex items-center gap-2 pt-3 border-t border-slate-100",children:[(0,a.jsxs)("button",{onClick:I,className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-900 text-white text-xs rounded-md hover:bg-slate-800 disabled:opacity-50 transition-colors",disabled:C,children:[(0,a.jsx)(c.Z,{className:"w-3 h-3"}),C?"Publishing...":"Publish"]}),(0,a.jsxs)("button",{onClick:()=>d(!0),className:"flex items-center gap-1.5 px-3 py-1.5 border border-slate-200 text-slate-600 text-xs rounded-md hover:bg-slate-50 disabled:opacity-50 transition-colors",disabled:C,children:[(0,a.jsx)(y.Z,{className:"w-3 h-3"}),"Edit"]}),(0,a.jsxs)("button",{onClick:L,className:"flex items-center gap-1.5 px-3 py-1.5 text-red-500 text-xs rounded-md hover:bg-red-50 disabled:opacity-50 transition-colors ml-auto",disabled:C,children:[(0,a.jsx)(_.Z,{className:"w-3 h-3"}),"Discard"]})]})]})}function C(){var e;let[t,s]=(0,r.useState)(null),[x,m]=(0,r.useState)(!0),[h,u]=(0,r.useState)(null),[b,g]=(0,r.useState)(!1),[p,f]=(0,r.useState)(""),[j,N]=(0,r.useState)(!1),w=(0,r.useCallback)(async()=>{try{let e=await fetch("/api/social"),t=await e.json();t.success?(s(t.data),u(null)):u(t.error||"Failed to load social data")}catch(e){u("Failed to connect to server")}finally{m(!1)}},[]);async function v(e){let t=await fetch("/api/social/".concat(e,"/publish"),{method:"POST"}),s=await t.json();if(!s.success){alert(s.error||"Failed to publish");return}await w()}async function y(e,t){let s=await fetch("/api/social/".concat(e),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:t})}),a=await s.json();if(!a.success){alert(a.error||"Failed to update");return}await w()}async function _(e){let t=await fetch("/api/social/".concat(e),{method:"DELETE"}),s=await t.json();if(!s.success){alert(s.error||"Failed to discard");return}await w()}async function k(){if(p.trim()&&!(p.length>280)){N(!0);try{let e=await fetch("/api/social",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({text:p})}),t=await e.json();t.success?(f(""),g(!1),await w()):alert(t.error||"Failed to create draft")}finally{N(!1)}}}(0,r.useEffect)(()=>{w()},[w]);let S=(null==t?void 0:t.drafts.filter(e=>"draft"===e.status))||[],C=(null==t?void 0:t.drafts.filter(e=>"published"===e.status).sort((e,t)=>(t.published_at||"").localeCompare(e.published_at||"")))||[];return(0,a.jsx)(o.default,{children:(0,a.jsxs)("div",{className:"p-6 max-w-3xl mx-auto",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-2xl font-bold text-slate-900",children:"Social Media"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mt-1",children:"Review and publish tweet drafts for your build-in-public journey."})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)("button",{onClick:()=>g(!0),className:"flex items-center gap-1.5 px-3 py-2 bg-slate-900 text-white text-sm rounded-lg hover:bg-slate-800 transition-colors",children:[(0,a.jsx)(l.Z,{className:"w-4 h-4"}),"New Draft"]}),(0,a.jsx)("button",{onClick:()=>{m(!0),w()},className:"p-2 text-slate-400 hover:text-slate-600 transition-colors",title:"Refresh",children:(0,a.jsx)(n.Z,{className:"w-4 h-4 ".concat(x?"animate-spin":"")})})]})]}),t&&!t.metrics.credentials_valid&&(0,a.jsxs)("div",{className:"mb-6 p-4 bg-amber-50 border border-amber-200 rounded-lg flex items-start gap-3",children:[(0,a.jsx)(i.Z,{className:"w-5 h-5 text-amber-500 mt-0.5 flex-shrink-0"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-sm font-medium text-amber-800",children:"X/Twitter not connected"}),(0,a.jsxs)("p",{className:"text-xs text-amber-600 mt-1",children:["Add X_API_KEY, X_API_SECRET, X_ACCESS_TOKEN, and X_ACCESS_SECRET to your .env file, then run the ",(0,a.jsx)("code",{className:"bg-amber-100 px-1 rounded",children:"social-setup-x"})," task."]})]})]}),t&&t.metrics.credentials_valid&&(0,a.jsxs)("div",{className:"mb-6 grid grid-cols-4 gap-4",children:[(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Account"}),(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:t.metrics.username||"—"})]}),(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Followers"}),(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:null!==(e=t.metrics.followers_count)&&void 0!==e?e:"—"})]}),(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsxs)("p",{className:"text-xs text-slate-500 flex items-center justify-center gap-1",children:[(0,a.jsx)(d.Z,{className:"w-3 h-3"})," Streak"]}),(0,a.jsxs)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:[t.metrics.post_streak_days," day",1!==t.metrics.post_streak_days?"s":""]})]}),(0,a.jsxs)("div",{className:"bg-white border border-slate-200 rounded-lg p-3 text-center",children:[(0,a.jsx)("p",{className:"text-xs text-slate-500",children:"Total Posts"}),(0,a.jsx)("p",{className:"text-sm font-medium text-slate-900 mt-1",children:t.metrics.total_posts})]})]}),b&&(0,a.jsxs)("div",{className:"mb-6 bg-white border border-slate-200 rounded-lg p-4",children:[(0,a.jsx)("h3",{className:"text-sm font-medium text-slate-900 mb-2",children:"Compose Tweet"}),(0,a.jsx)("textarea",{value:p,onChange:e=>f(e.target.value),className:"w-full border border-slate-300 rounded-md p-3 text-sm resize-none focus:outline-none focus:ring-2 focus:ring-blue-500",rows:4,placeholder:"What's happening with your product?",maxLength:300,autoFocus:!0}),(0,a.jsxs)("div",{className:"flex items-center justify-between mt-2",children:[(0,a.jsxs)("span",{className:"text-xs ".concat(p.length>280?"text-red-500 font-medium":"text-slate-400"),children:[p.length,"/280"]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>{g(!1),f("")},className:"px-3 py-1.5 text-sm text-slate-500 hover:text-slate-700",children:"Cancel"}),(0,a.jsxs)("button",{onClick:k,className:"flex items-center gap-1.5 px-3 py-1.5 bg-slate-900 text-white text-sm rounded-md hover:bg-slate-800 disabled:opacity-50 transition-colors",disabled:j||!p.trim()||p.length>280,children:[(0,a.jsx)(c.Z,{className:"w-3 h-3"}),"Save Draft"]})]})]})]}),x&&!t&&(0,a.jsxs)("div",{className:"text-center py-12",children:[(0,a.jsx)(n.Z,{className:"w-6 h-6 animate-spin text-slate-400 mx-auto"}),(0,a.jsx)("p",{className:"text-sm text-slate-500 mt-2",children:"Loading drafts..."})]}),h&&(0,a.jsx)("div",{className:"text-center py-12",children:(0,a.jsx)("p",{className:"text-sm text-red-500",children:h})}),t&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4",children:(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Drafts (",S.length,")"]})}),0===S.length?(0,a.jsx)("div",{className:"text-center py-8 bg-slate-50 rounded-lg border border-dashed border-slate-200",children:(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"No pending drafts. The heartbeat will generate drafts as you ship features and hit milestones."})}):(0,a.jsx)("div",{className:"space-y-3 mb-8",children:S.map(e=>(0,a.jsx)(Z,{draft:e,onPublish:v,onEdit:y,onDiscard:_},e.id))}),C.length>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"mb-4 mt-8",children:(0,a.jsxs)("h2",{className:"text-lg font-semibold text-slate-900",children:["Published (",C.length,")"]})}),(0,a.jsx)("div",{className:"space-y-3",children:C.map(e=>(0,a.jsx)(Z,{draft:e,onPublish:v,onEdit:y,onDiscard:_},e.id))})]})]})]})})}},1259:function(e,t,s){"use strict";s.d(t,{default:function(){return f}});var a=s(7437),r=s(7648),l=s(9376),n=s(5929),i=s(5466),d=s(2048),c=s(8896),o=s(8220),x=s(2718),m=s(5621),h=s(8728),u=s(2222),b=s(2023),g=s(1994);let p=[{href:"/briefing",label:"Briefing",icon:(0,a.jsx)(n.Z,{size:18})},{href:"/kanban",label:"Dashboard",icon:(0,a.jsx)(i.Z,{className:"w-5 h-5"})},{href:"/roadmap",label:"Roadmap",icon:(0,a.jsx)(d.Z,{className:"w-5 h-5"})},{href:"/goals",label:"Goals",icon:(0,a.jsx)(c.Z,{className:"w-5 h-5"})},{href:"/hypotheses",label:"Hypotheses",icon:(0,a.jsx)(o.Z,{className:"w-5 h-5"})},{href:"/social",label:"Social",icon:(0,a.jsx)(x.Z,{className:"w-5 h-5"})},{href:"/sessions",label:"Sessions",icon:(0,a.jsx)(m.Z,{className:"w-5 h-5"})},{href:"/settings",label:"Settings",icon:(0,a.jsx)(h.Z,{className:"w-5 h-5"})}];function f(e){let{children:t}=e,s=(0,l.usePathname)();return(0,a.jsxs)("div",{className:"min-h-screen flex",children:[(0,a.jsxs)("aside",{className:"w-64 bg-slate-900 text-white flex flex-col",children:[(0,a.jsx)("div",{className:"p-4 border-b border-slate-700",children:(0,a.jsxs)(r.default,{href:"/",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-10 h-10 bg-emerald-500 rounded-lg flex items-center justify-center",children:(0,a.jsx)(u.Z,{className:"w-6 h-6 text-white"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"font-bold text-lg leading-tight",children:"Analyst"}),(0,a.jsx)("p",{className:"text-xs text-slate-400",children:"AI Product Manager"})]})]})}),(0,a.jsx)("nav",{className:"flex-1 p-4",children:(0,a.jsx)("ul",{className:"space-y-1",children:p.map(e=>{let t=s.startsWith(e.href);return(0,a.jsx)("li",{children:(0,a.jsxs)(r.default,{href:e.href,className:(0,g.Z)("flex items-center gap-3 px-3 py-2 rounded-lg transition-colors",t?"bg-slate-800 text-white":"text-slate-400 hover:text-white hover:bg-slate-800"),children:[e.icon,(0,a.jsx)("span",{children:e.label})]})},e.href)})})}),(0,a.jsx)("div",{className:"p-4 border-t border-slate-700",children:(0,a.jsxs)("div",{className:"flex items-center gap-2 text-xs text-slate-500",children:[(0,a.jsx)(b.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Powered by Claude"})]})})]}),(0,a.jsx)("main",{className:"flex-1 overflow-auto",children:t})]})}},6153:function(e,t,s){"use strict";s.d(t,{G:function(){return i},GK:function(){return k},Gs:function(){return o},Hs:function(){return a},PN:function(){return u},PW:function(){return y},Q_:function(){return b},R$:function(){return w},Vr:function(){return x},Wb:function(){return h},aR:function(){return m},bi:function(){return d},en:function(){return N},i2:function(){return j},kT:function(){return g},l5:function(){return p},lE:function(){return v},lv:function(){return n},pG:function(){return r},rF:function(){return c},tV:function(){return f},tl:function(){return _},xP:function(){return S},yb:function(){return l}});let a={product:"Product",ux_design:"UX/Design",growth:"Growth",performance:"Performance",tech_debt:"Tech Debt",security:"Security",infrastructure:"Infrastructure",content:"Content",analytics:"Analytics",integration:"Integration"},r={product:"bg-blue-100 text-blue-800",ux_design:"bg-purple-100 text-purple-800",growth:"bg-green-100 text-green-800",performance:"bg-orange-100 text-orange-800",tech_debt:"bg-yellow-100 text-yellow-800",security:"bg-red-100 text-red-800",infrastructure:"bg-gray-100 text-gray-800",content:"bg-pink-100 text-pink-800",analytics:"bg-cyan-100 text-cyan-800",integration:"bg-indigo-100 text-indigo-800"},l={inbox:"Inbox",under_review:"Under Review",approved:"Approved",in_progress:"In Progress",testing:"Testing",shipped:"Shipped",deferred:"Deferred",rejected:"Rejected",rolled_back:"Rolled Back"},n={inbox:"bg-amber-500",under_review:"bg-blue-500",approved:"bg-emerald-500",in_progress:"bg-violet-500",testing:"bg-cyan-500",shipped:"bg-green-500",deferred:"bg-gray-500",rejected:"bg-red-500",rolled_back:"bg-orange-500"},i=["inbox","under_review","approved","in_progress","testing","shipped"],d={xs:"XS",s:"S",m:"M",l:"L",xl:"XL"},c={critical:"Critical",high:"High",medium:"Medium",low:"Low"},o={critical:"bg-red-100 text-red-800 border-red-300",high:"bg-orange-100 text-orange-800 border-orange-300",medium:"bg-yellow-100 text-yellow-800 border-yellow-300",low:"bg-gray-100 text-gray-800 border-gray-300"},x={codebase_analysis:"Codebase Analysis",metrics_review:"Metrics Review",market_research:"Market Research",seo_audit:"SEO Audit",growth_distribution:"Growth Distribution",manual:"Manual"},m={pending:"bg-slate-100 text-slate-700",validated:"bg-emerald-100 text-emerald-800",needs_investigation:"bg-amber-100 text-amber-800",inconclusive:"bg-slate-100 text-slate-600",invalidated:"bg-red-100 text-red-800"},h={pending:"Pending",validated:"Validated",needs_investigation:"Needs Investigation",inconclusive:"Inconclusive",invalidated:"Invalidated"},u={ship:"Ship",update:"Update",milestone:"Milestone",digest:"Digest",manual:"Manual",thread:"Thread",insight:"Insight"},b={ship:"bg-green-100 text-green-800",update:"bg-blue-100 text-blue-800",milestone:"bg-amber-100 text-amber-800",digest:"bg-purple-100 text-purple-800",manual:"bg-slate-100 text-slate-800",thread:"bg-indigo-100 text-indigo-800",insight:"bg-cyan-100 text-cyan-800"},g={acquisition:"Acquisition",activation:"Activation",retention:"Retention",revenue:"Revenue",referral:"Referral"},p={acquisition:"bg-blue-100 text-blue-800",activation:"bg-emerald-100 text-emerald-800",retention:"bg-purple-100 text-purple-800",revenue:"bg-amber-100 text-amber-800",referral:"bg-pink-100 text-pink-800"},f={on_track:"On Track",at_risk:"At Risk",behind:"Behind",achieved:"Achieved"},j={on_track:"bg-emerald-100 text-emerald-800 border-emerald-300",at_risk:"bg-amber-100 text-amber-800 border-amber-300",behind:"bg-red-100 text-red-800 border-red-300",achieved:"bg-blue-100 text-blue-800 border-blue-300"},N={manual:"Manual",rest_api:"REST API",posthog:"PostHog",firestore:"Firestore",stripe:"Stripe",whatsapp:"WhatsApp"},w={stated:"Stated",testing:"Testing",validated:"Validated",invalidated:"Invalidated",deferred:"Deferred"},v={stated:"bg-slate-100 text-slate-800 border-slate-300",testing:"bg-amber-100 text-amber-800 border-amber-300",validated:"bg-emerald-100 text-emerald-800 border-emerald-300",invalidated:"bg-red-100 text-red-800 border-red-300",deferred:"bg-slate-100 text-slate-500 border-slate-200"},y={acquisition:"Acquisition",engagement:"Engagement",conversion:"Conversion",monetization:"Monetization"},_={acquisition:"bg-blue-100 text-blue-800",engagement:"bg-purple-100 text-purple-800",conversion:"bg-amber-100 text-amber-800",monetization:"bg-emerald-100 text-emerald-800"},k={planned:"Planned",active:"Active",completed:"Completed",paused:"Paused"},S={planned:"bg-slate-100 text-slate-700 border-slate-300",active:"bg-blue-100 text-blue-800 border-blue-300",completed:"bg-emerald-100 text-emerald-800 border-emerald-300",paused:"bg-amber-100 text-amber-800 border-amber-300"}}},function(e){e.O(0,[972,159,971,117,744],function(){return e(e.s=9830)}),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[940],{3410:function(e,t,s){Promise.resolve().then(s.bind(s,9525))},9205:function(e,t,s){"use strict";s.d(t,{Z:function(){return c}});var a=s(2265);let r=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),n=function(){for(var e=arguments.length,t=Array(e),s=0;s<e;s++)t[s]=arguments[s];return t.filter((e,t,s)=>!!e&&s.indexOf(e)===t).join(" ")};var l={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,a.forwardRef)((e,t)=>{let{color:s="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:c,className:d="",children:o,iconNode:m,...h}=e;return(0,a.createElement)("svg",{ref:t,...l,width:r,height:r,stroke:s,strokeWidth:c?24*Number(i)/Number(r):i,className:n("lucide",d),...h},[...m.map(e=>{let[t,s]=e;return(0,a.createElement)(t,s)}),...Array.isArray(o)?o:[o]])}),c=(e,t)=>{let s=(0,a.forwardRef)((s,l)=>{let{className:c,...d}=s;return(0,a.createElement)(i,{ref:l,iconNode:t,className:n("lucide-".concat(r(e)),c),...d})});return s.displayName="".concat(e),s}},2660:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("ArrowLeft",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]])},505:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Calendar",[["path",{d:"M8 2v4",key:"1cmpym"}],["path",{d:"M16 2v4",key:"4m81vk"}],["rect",{width:"18",height:"18",x:"3",y:"4",rx:"2",key:"1hopcy"}],["path",{d:"M3 10h18",key:"8toen8"}]])},401:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},8867:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]])},2735:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Download",[["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}],["polyline",{points:"7 10 12 15 17 10",key:"2ggqvy"}],["line",{x1:"12",x2:"12",y1:"15",y2:"3",key:"1vk2je"}]])},8736:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("FileText",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M14 2v4a2 2 0 0 0 2 2h4",key:"tnqrlb"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},2023:function(e,t,s){"use strict";s.d(t,{Z:function(){return a}});let a=(0,s(9205).Z)("Sparkles",[["path",{d:"M9.937 15.5A2 2 0 0 0 8.5 14.063l-6.135-1.582a.5.5 0 0 1 0-.962L8.5 9.936A2 2 0 0 0 9.937 8.5l1.582-6.135a.5.5 0 0 1 .963 0L14.063 8.5A2 2 0 0 0 15.5 9.937l6.135 1.581a.5.5 0 0 1 0 .964L15.5 14.063a2 2 0 0 0-1.437 1.437l-1.582 6.135a.5.5 0 0 1-.963 0z",key:"4pj2yx"}],["path",{d:"M20 3v4",key:"1olli1"}],["path",{d:"M22 5h-4",key:"1gvqau"}],["path",{d:"M4 17v2",key:"vumght"}],["path",{d:"M5 18H3",key:"zchphs"}]])},7648:function(e,t,s){"use strict";s.d(t,{default:function(){return r.a}});var a=s(2972),r=s.n(a)},9376:function(e,t,s){"use strict";var a=s(5475);s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}})},9525:function(e,t,s){"use strict";s.r(t),s.d(t,{default:function(){return u}});var a=s(7437),r=s(2265),n=s(2660),l=s(505),i=s(2023),c=s(8736),d=s(401),o=s(8867),m=s(2735),h=s(7648),x=s(9376);function u(){let e=(0,x.useRouter)(),[t,s]=(0,r.useState)(!1),[u,p]=(0,r.useState)("last_30"),[g,j]=(0,r.useState)(!0),[f,b]=(0,r.useState)(null),[y,w]=(0,r.useState)(!1),[N,v]=(0,r.useState)(null),k=async()=>{s(!0),v(null);try{let e=await fetch("/api/investor-updates/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dateRange:u,includeAI:g})});if(!e.ok){let t=(await e.json()).error||"Failed to generate update";console.error("API error:",t),v(t);return}let t=await e.json();b(t)}catch(e){console.error("Error generating update:",e),v(e instanceof Error?e.message:"Network error. Please try again.")}finally{s(!1)}},Z=async()=>{f&&(await navigator.clipboard.writeText(f.markdown),w(!0),setTimeout(()=>w(!1),2e3))};return(0,a.jsxs)("div",{className:"min-h-screen bg-slate-50",children:[(0,a.jsx)("div",{className:"bg-white border-b border-slate-200 px-6 py-4",children:(0,a.jsx)("div",{className:"max-w-7xl mx-auto flex items-center justify-between",children:(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)(h.default,{href:"/updates",className:"text-slate-600 hover:text-slate-900 transition-colors",children:(0,a.jsx)(n.Z,{className:"w-5 h-5"})}),(0,a.jsxs)("div",{children:[(0,a.jsx)("h1",{className:"text-xl font-bold text-slate-900",children:"Generate Investor Update"}),(0,a.jsx)("p",{className:"text-sm text-slate-500",children:"Create a compelling monthly update with AI narrative"})]})]})})}),(0,a.jsx)("div",{className:"max-w-7xl mx-auto p-6",children:(0,a.jsxs)("div",{className:"grid grid-cols-1 lg:grid-cols-2 gap-6",children:[(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Configuration"}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("label",{className:"block text-sm font-medium text-slate-700 mb-2",children:[(0,a.jsx)(l.Z,{className:"w-4 h-4 inline mr-1"}),"Time Period"]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"radio",name:"dateRange",value:"last_30",checked:"last_30"===u,onChange:e=>p(e.target.value),className:"w-4 h-4 text-emerald-600"}),(0,a.jsx)("span",{className:"text-sm text-slate-700",children:"Last 30 Days (Monthly)"})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"radio",name:"dateRange",value:"last_90",checked:"last_90"===u,onChange:e=>p(e.target.value),className:"w-4 h-4 text-emerald-600"}),(0,a.jsx)("span",{className:"text-sm text-slate-700",children:"Last 90 Days (Quarterly)"})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer opacity-50",children:[(0,a.jsx)("input",{type:"radio",name:"dateRange",value:"custom",disabled:!0,className:"w-4 h-4 text-emerald-600"}),(0,a.jsx)("span",{className:"text-sm text-slate-700",children:"Custom Range (Coming Soon)"})]})]})]}),(0,a.jsxs)("div",{className:"mb-6",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,a.jsx)("input",{type:"checkbox",checked:g,onChange:e=>j(e.target.checked),className:"w-4 h-4 text-emerald-600 rounded"}),(0,a.jsx)(i.Z,{className:"w-4 h-4 text-emerald-500"}),(0,a.jsx)("span",{className:"text-sm font-medium text-slate-700",children:"Include AI Narrative (Recommended)"})]}),(0,a.jsx)("p",{className:"text-xs text-slate-500 ml-6 mt-1",children:"Generates executive summary, strategic context, and asks rationale"})]}),N&&(0,a.jsxs)("div",{className:"mb-4 p-4 bg-red-50 border border-red-200 rounded-lg",children:[(0,a.jsx)("p",{className:"text-sm text-red-700 font-medium",children:"Error"}),(0,a.jsx)("p",{className:"text-xs text-red-600 mt-1",children:N})]}),(0,a.jsx)("button",{onClick:k,disabled:t,className:"w-full flex items-center justify-center gap-2 px-4 py-3 bg-emerald-600 text-white rounded-lg hover:bg-emerald-700 transition-colors disabled:bg-slate-300 disabled:cursor-not-allowed",children:t?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"w-4 h-4 border-2 border-white border-t-transparent rounded-full animate-spin"}),(0,a.jsx)("span",{children:"Generating..."})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(i.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Generate Update"})]})}),(0,a.jsxs)("div",{className:"mt-6 p-4 bg-blue-50 border border-blue-200 rounded-lg",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-blue-900 mb-2",children:"What's included:"}),(0,a.jsxs)("ul",{className:"text-xs text-blue-700 space-y-1",children:[(0,a.jsx)("li",{children:"• Completed epics and shipped features"}),(0,a.jsx)("li",{children:"• Goal metrics with month-over-month growth"}),(0,a.jsx)("li",{children:"• Upcoming roadmap with strategic priorities"}),(0,a.jsx)("li",{children:"• Strategic insights from MEMORY.md"}),(0,a.jsx)("li",{children:"• AI-generated narrative (if enabled)"})]})]})]}),(0,a.jsxs)("div",{className:"bg-white rounded-lg border border-slate-200 p-6",children:[(0,a.jsx)("h2",{className:"text-lg font-semibold text-slate-900 mb-4",children:"Preview"}),f?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-4",children:[(0,a.jsx)("button",{onClick:Z,className:"flex items-center gap-1 px-3 py-2 text-sm bg-slate-100 hover:bg-slate-200 rounded-lg transition-colors",children:y?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(d.Z,{className:"w-4 h-4 text-emerald-600"}),(0,a.jsx)("span",{children:"Copied!"})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(o.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Copy Markdown"})]})}),(0,a.jsxs)("button",{onClick:()=>{if(!f)return;let e=new Blob([f.markdown],{type:"text/markdown"}),t=URL.createObjectURL(e),s=document.createElement("a");s.href=t,s.download="investor-update-".concat(new Date().toISOString().split("T")[0],".md"),s.click(),URL.revokeObjectURL(t)},className:"flex items-center gap-1 px-3 py-2 text-sm bg-slate-100 hover:bg-slate-200 rounded-lg transition-colors",children:[(0,a.jsx)(m.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Download"})]}),(0,a.jsxs)("button",{onClick:()=>{f&&e.push("/updates/".concat(f.id))},className:"flex items-center gap-1 px-3 py-2 text-sm bg-emerald-600 text-white hover:bg-emerald-700 rounded-lg transition-colors ml-auto",children:[(0,a.jsx)(c.Z,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"View Details"})]})]}),(0,a.jsx)("div",{className:"prose prose-sm max-w-none overflow-auto max-h-[600px] p-4 bg-slate-50 rounded-lg border border-slate-200",children:(0,a.jsx)("pre",{className:"whitespace-pre-wrap text-xs font-mono",children:f.markdown})})]}):(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center h-64 text-center",children:[(0,a.jsx)(c.Z,{className:"w-12 h-12 text-slate-300 mb-4"}),(0,a.jsxs)("p",{className:"text-sm text-slate-500",children:["Configure your update and click Generate",(0,a.jsx)("br",{}),"to see a preview here"]})]})]})]})})]})}}},function(e){e.O(0,[972,971,117,744],function(){return e(e.s=3410)}),_N_E=e.O()}]);
package/README.md CHANGED
@@ -13,7 +13,13 @@ Requires Node.js 18+.
13
13
  ## Quick Start
14
14
 
15
15
  ```bash
16
- # Go to your project directory
16
+ # Build a new AI-powered app from a one-sentence idea (interactive)
17
+ vibebusiness build
18
+
19
+ # Or jump straight in with your idea
20
+ vibebusiness build --idea="AI recipe generator"
21
+
22
+ # Or go to your existing project directory and set up the analyst
17
23
  cd ~/my-project
18
24
 
19
25
  # Interactive setup wizard (configures AI provider, license, repos)
@@ -44,6 +50,8 @@ vibebusiness heartbeat --session --duration=60 --interval=5
44
50
  | `vibebusiness heartbeat --session --duration=60 --interval=5` | Run for 60 min, heartbeat every 5 min |
45
51
  | `vibebusiness analyze --type=<type>` | Run codebase analysis (quick, deep, metrics, seo, research) |
46
52
  | `vibebusiness analyze --type=research --topic="..."` | Run deep research on a specific topic |
53
+ | `vibebusiness build` | Build a full AI-powered app from a one-sentence idea (interactive) |
54
+ | `vibebusiness build --idea="..."` | Build app from a specific idea |
47
55
  | `vibebusiness implement --idea=<id>` | Implement an approved idea |
48
56
  | `vibebusiness status` | Show current status and idea counts |
49
57
  | `vibebusiness telemetry --enable\|--disable` | Manage anonymous telemetry |
@@ -965,15 +965,44 @@ function cmdImplement(args) {
965
965
  printBanner();
966
966
  runScript("implement.ts", args);
967
967
  }
968
- function cmdBuild(args) {
968
+ async function cmdBuild(args) {
969
969
  printBanner();
970
- const ideaVal = args.find((a) => a.startsWith("--idea="))?.split("=").slice(1).join("=");
970
+ const EXAMPLE_IDEAS = [
971
+ "AI-powered startup pitch generator",
972
+ "Personal finance tracker with spending insights",
973
+ "Recipe generator from ingredients in your fridge",
974
+ "Job interview prep tool with AI coaching",
975
+ "Real estate deal analyzer for investors"
976
+ ];
977
+ let ideaVal = args.find((a) => a.startsWith("--idea="))?.split("=").slice(1).join("=");
978
+ const finalArgs = [...args];
971
979
  if (!ideaVal) {
972
- console.error(' Usage: vibebusiness build --idea="..." [--target=./output] [--model=sonnet]\n');
973
- process.exit(1);
980
+ console.log("\n What should we build?\n");
981
+ console.log(" Example ideas:");
982
+ EXAMPLE_IDEAS.forEach((idea, i) => console.log(` ${i + 1}. ${idea}`));
983
+ console.log("\n Pick a number or describe your own idea:");
984
+ const { createInterface: createInterface2 } = require("readline");
985
+ const rl = createInterface2({ input: process.stdin, output: process.stdout });
986
+ const answer = await new Promise((resolve2) => {
987
+ rl.question(" > ", (a) => {
988
+ rl.close();
989
+ resolve2(a.trim());
990
+ });
991
+ });
992
+ if (!answer) {
993
+ console.error('\n Usage: vibebusiness build --idea="..." [--target=./output] [--model=sonnet]\n');
994
+ process.exit(1);
995
+ }
996
+ const idx = parseInt(answer, 10) - 1;
997
+ ideaVal = idx >= 0 && idx < EXAMPLE_IDEAS.length ? EXAMPLE_IDEAS[idx] : answer;
998
+ finalArgs.push(`--idea=${ideaVal}`);
999
+ }
1000
+ if (!finalArgs.find((a) => a.startsWith("--target="))) {
1001
+ const slug = ideaVal.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "").slice(0, 50);
1002
+ finalArgs.push(`--target=./${slug}`);
974
1003
  }
975
1004
  console.log(" Building project from scratch...\n");
976
- runScript("build.ts", args);
1005
+ runScript("build.ts", finalArgs);
977
1006
  }
978
1007
  async function cmdStatus() {
979
1008
  printBanner();
@@ -1166,7 +1195,8 @@ function cmdHelp() {
1166
1195
  run <task-id> Run a specific skill task directly
1167
1196
  analyze --type=<type> Run codebase analysis (quick|deep|metrics|seo|research)
1168
1197
  implement --idea=<id> Implement an approved idea
1169
- build --idea="..." [--target] Build a project from scratch from an idea
1198
+ build [--idea="..."] Build a full AI-powered app from a one-sentence idea
1199
+ vibebusiness build --idea="AI recipe generator"
1170
1200
  provider Show AI provider status and capabilities
1171
1201
  provider setup Set up or change your API key
1172
1202
  provider validate Validate stored API key
@@ -1245,7 +1275,7 @@ async function main() {
1245
1275
  break;
1246
1276
  case "build":
1247
1277
  trackEvent("command_run", { command: "build" });
1248
- cmdBuild(commandArgs);
1278
+ await cmdBuild(commandArgs);
1249
1279
  break;
1250
1280
  case "suggest-epics":
1251
1281
  trackEvent("command_run", { command: "suggest-epics", dryRun: commandArgs.includes("--dry-run") });
@@ -69,35 +69,68 @@ function scaffold(dir) {
69
69
  execInherit('git -c commit.gpgsign=false commit -m "Initial scaffold from create-next-app"', dir);
70
70
  log("Scaffold complete \u2014 initial commit created.");
71
71
  }
72
- function buildDecompositionPrompt(ideaDescription) {
72
+ function buildVisionPrompt(rawIdea) {
73
+ return `You are a world-class product designer. Someone gave you this one-line idea:
74
+
75
+ "${rawIdea}"
76
+
77
+ Your job: envision the BEST possible version of this as a web experience.
78
+
79
+ Think about:
80
+ 1. What is the core user flow? (What does the user do, step by step?)
81
+ 2. What would make this genuinely impressive \u2014 not just functional, but "wow"?
82
+ 3. If AI is involved, how should AI actually be used? (Don't just build a form that renders user input \u2014 make AI do the heavy lifting: generate content, make decisions, produce outputs the user couldn't easily create themselves)
83
+ 4. What's the minimal input the user should provide vs what should be auto-generated or intelligently defaulted?
84
+ 5. What would make someone screenshot this and share it?
85
+
86
+ Output a detailed product specification:
87
+ - Title and one-line description of what this does
88
+ - Core user flow (step by step, from landing to final output)
89
+ - Key pages/screens and what each contains
90
+ - Where AI adds value (what does AI generate, suggest, or automate?)
91
+ - Visual style direction
92
+ - The "wow moment" \u2014 the single thing that makes this special
93
+
94
+ Keep it to ~500 words. Be specific and opinionated \u2014 make strong choices, don't hedge.`;
95
+ }
96
+ async function envision(rawIdea, cwd) {
97
+ log("Envisioning the product...");
98
+ const prompt = buildVisionPrompt(rawIdea);
99
+ const vision = await runClaude(cwd, prompt, 12e4);
100
+ log("Product vision complete.");
101
+ return vision.trim();
102
+ }
103
+ function buildDecompositionPrompt(rawIdea, visionSpec) {
73
104
  return `You are decomposing a brand-new web application into small, implementable sub-tasks for an AI coding agent.
74
105
 
75
- ## Project Idea
76
- ${ideaDescription}
106
+ ## Product Vision
107
+ ${visionSpec}
108
+
109
+ ## Original Idea
110
+ ${rawIdea}
77
111
 
78
112
  ## Existing Project Structure
79
- This is a fresh create-next-app project with TypeScript and Tailwind CSS. Key files:
113
+ This is a fresh create-next-app project with TypeScript and Tailwind CSS (v4). Key files:
80
114
  - src/app/page.tsx (home page)
81
115
  - src/app/layout.tsx (root layout)
82
116
  - src/app/globals.css (global styles with Tailwind)
83
- - tailwind.config.ts
84
117
  - package.json
85
118
  - tsconfig.json
86
119
 
87
120
  ## Rules
88
121
 
89
- 1. Each sub-task should create or modify 2-4 files maximum
90
- 2. Order by dependency: data types/utilities first, then components, then pages, then polish
91
- 3. Maximum 10 sub-tasks
92
- 4. Each sub-task must have SPECIFIC instructions: exact file paths, component names, props, styling classes
93
- 5. The FIRST sub-task should create shared types, utilities, or data models
94
- 6. Include responsive Tailwind CSS styling in every component task
95
- 7. The final sub-task should be visual polish: animations, transitions, responsive refinements
96
- 8. Focus on visual impressiveness: dark gradients, smooth animations, professional typography
97
- 9. Do NOT include test-writing sub-tasks (we want to maximize visual output)
98
- 10. Every component should be production-quality \u2014 not placeholder or skeleton code
99
- 11. Use only built-in Next.js features and Tailwind \u2014 do NOT add npm dependencies unless absolutely necessary
100
- 12. If you need icons, use simple SVG inline or emoji \u2014 do NOT add icon libraries
122
+ 1. Each sub-task should create or modify 1-3 files maximum
123
+ 2. Order by dependency: types/utils first, then components, then pages, then wiring/polish
124
+ 3. Aim for 7-10 sub-tasks. Each should be completable in under 5 minutes by an AI agent
125
+ 4. Each sub-task description should be 3-8 sentences \u2014 describe WHAT to build and the visual style, but do NOT spell out every CSS class. The AI agent is skilled at Tailwind and will choose appropriate classes
126
+ 5. The FIRST sub-task should create shared TypeScript types, constants, and utility functions
127
+ 6. The SECOND sub-task should set up global styles (dark theme CSS variables, custom animations) and update layout.tsx metadata
128
+ 7. Focus on visual impressiveness: dark gradients, smooth animations, professional typography
129
+ 8. Do NOT include test-writing sub-tasks
130
+ 9. Every component should be production-quality \u2014 not placeholder or skeleton code
131
+ 10. Use only built-in Next.js features and Tailwind \u2014 do NOT add npm dependencies
132
+ 11. If you need icons, use inline SVG or emoji \u2014 do NOT add icon libraries
133
+ 12. IMPORTANT: Keep descriptions concise. Do NOT list every CSS class or HTML attribute. Describe the component's purpose, layout structure, and visual style at a high level. Trust the AI agent to implement the details.
101
134
 
102
135
  Respond with JSON only (no markdown code blocks, just raw JSON):
103
136
  {
@@ -105,15 +138,15 @@ Respond with JSON only (no markdown code blocks, just raw JSON):
105
138
  {
106
139
  "id": "st-001",
107
140
  "title": "Short descriptive title",
108
- "description": "Detailed instructions for Claude Code: what files to create/modify, what components to build, specific Tailwind classes, exact implementation details.",
141
+ "description": "Concise instructions: what files to create, component purpose, layout structure, visual style. 3-8 sentences max.",
109
142
  "files_to_modify": ["src/path/to/file.tsx"]
110
143
  }
111
144
  ]
112
145
  }`;
113
146
  }
114
- async function decompose(ideaDescription, cwd) {
147
+ async function decompose(rawIdea, visionSpec, cwd) {
115
148
  log("Decomposing idea into sub-tasks...");
116
- const prompt = buildDecompositionPrompt(ideaDescription);
149
+ const prompt = buildDecompositionPrompt(rawIdea, visionSpec);
117
150
  const output = await runClaude(cwd, prompt, 6e5);
118
151
  let jsonStr = output.trim();
119
152
  const fenceMatch = jsonStr.match(/```(?:json)?\s*([\s\S]*?)```/);
@@ -138,11 +171,11 @@ async function decompose(ideaDescription, cwd) {
138
171
  return [];
139
172
  }
140
173
  }
141
- function buildSubTaskPrompt(task, ideaDescription, taskIndex, totalTasks) {
174
+ function buildSubTaskPrompt(task, visionSpec, taskIndex, totalTasks) {
142
175
  return `You are building a web application from scratch. This is sub-task ${taskIndex + 1} of ${totalTasks}.
143
176
 
144
- ## Overall Project
145
- ${ideaDescription}
177
+ ## Product Vision
178
+ ${visionSpec}
146
179
 
147
180
  ## Your Current Sub-Task: ${task.title}
148
181
 
@@ -159,7 +192,7 @@ ${task.files_to_modify.map((f) => `- ${f}`).join("\n")}
159
192
  - Do NOT install new npm packages unless explicitly told to
160
193
  - Make sure the code compiles without TypeScript errors`;
161
194
  }
162
- function runClaude(cwd, prompt, timeoutMs = 3e5) {
195
+ function runClaude(cwd, prompt, timeoutMs = 6e5) {
163
196
  const claudeArgs = [
164
197
  "--print",
165
198
  "--dangerously-skip-permissions",
@@ -230,10 +263,10 @@ function runClaude(cwd, prompt, timeoutMs = 3e5) {
230
263
  });
231
264
  });
232
265
  }
233
- async function executeSubTask(task, ideaDescription, index, total, cwd) {
266
+ async function executeSubTask(task, visionSpec, index, total, cwd) {
234
267
  log(`
235
268
  --- Sub-task ${index + 1}/${total}: ${task.title} ---`);
236
- const prompt = buildSubTaskPrompt(task, ideaDescription, index, total);
269
+ const prompt = buildSubTaskPrompt(task, visionSpec, index, total);
237
270
  try {
238
271
  await runClaude(cwd, prompt);
239
272
  try {
@@ -288,7 +321,15 @@ async function main() {
288
321
  log(`Target: ${targetDir}`);
289
322
  log(`Model: ${model}`);
290
323
  scaffold(targetDir);
291
- const subTasks = await decompose(idea, targetDir);
324
+ const vision = await envision(idea, targetDir);
325
+ console.log(`
326
+ \u250C\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510
327
+ \u2502 Product Vision \u2502
328
+ \u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
329
+ `);
330
+ console.log(vision);
331
+ console.log();
332
+ const subTasks = await decompose(idea, vision, targetDir);
292
333
  if (subTasks.length === 0) {
293
334
  log("No sub-tasks generated. Aborting.");
294
335
  process.exit(1);
@@ -296,7 +337,7 @@ async function main() {
296
337
  let completed = 0;
297
338
  let failed = 0;
298
339
  for (let i = 0; i < subTasks.length; i++) {
299
- const ok = await executeSubTask(subTasks[i], idea, i, subTasks.length, targetDir);
340
+ const ok = await executeSubTask(subTasks[i], vision, i, subTasks.length, targetDir);
300
341
  if (ok) completed++;
301
342
  else failed++;
302
343
  }