vibedoc 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +23 -18
- package/.next/app-path-routes-manifest.json +1 -1
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.js +1 -1
- package/.next/prerender-manifest.json +1 -1
- package/.next/server/app/(app)/activity/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/board/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/docs/page.js +1 -1
- package/.next/server/app/(app)/docs/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/memory/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/(app)/setup/page.js +2 -1
- package/.next/server/app/(app)/setup/page.js.nft.json +1 -1
- package/.next/server/app/(app)/setup/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +1 -1
- package/.next/server/app/activity.html +1 -1
- package/.next/server/app/activity.rsc +2 -2
- package/.next/server/app/api/mcp/route.js +10 -100
- package/.next/server/app/api/mcp/route.js.nft.json +1 -1
- package/.next/server/app/api/setup/generate/route.js +23 -84
- package/.next/server/app/api/setup/generate/route.js.nft.json +1 -1
- package/.next/server/app/board.html +1 -1
- package/.next/server/app/board.rsc +2 -2
- package/.next/server/app/docs.html +1 -1
- package/.next/server/app/docs.rsc +3 -3
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +1 -1
- package/.next/server/app/memory.html +1 -1
- package/.next/server/app/memory.rsc +2 -2
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +2 -2
- package/.next/server/app/setup.html +1 -1
- package/.next/server/app/setup.rsc +3 -3
- package/.next/server/app-paths-manifest.json +9 -9
- package/.next/server/chunks/118.js +2107 -0
- package/.next/server/chunks/191.js +2107 -91
- package/.next/server/middleware-build-manifest.js +1 -1
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/pages-manifest.json +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/2401-65366c9431a3dcca.js +16 -0
- package/.next/static/chunks/5179-76391417caead0bc.js +1 -0
- package/.next/static/chunks/6441-8a1066f99fe4fead.js +1 -0
- package/.next/static/chunks/app/(app)/docs/{page-17670ed46c3594e6.js → page-f5615cefbd3d1c64.js} +1 -1
- package/.next/static/chunks/app/(app)/{layout-34b4046ccf919d3f.js → layout-ef459e6f184dba6b.js} +1 -1
- package/.next/static/chunks/app/(app)/setup/page-a47e3a9a44666f50.js +1 -0
- package/.next/static/css/48c54dd7bfa2411e.css +5 -0
- package/README.md +33 -26
- package/bin/vibedoc.js +66 -39
- package/package.json +1 -1
- package/.next/static/chunks/845-0e3438196b5ef62c.js +0 -1
- package/.next/static/chunks/app/(app)/setup/page-9fd82b10016eca64.js +0 -16
- package/.next/static/css/615004f0fff77145.css +0 -5
- /package/.next/static/{r-2w-yCd6mM7TOOETgGaA → SozubT4AiNYJ3ynkRV0zo}/_buildManifest.js +0 -0
- /package/.next/static/{r-2w-yCd6mM7TOOETgGaA → SozubT4AiNYJ3ynkRV0zo}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-78c92fac7aa8fdd8.js"],devFiles:[],ampDevFiles:[],lowPriorityFiles:["static/
|
|
1
|
+
self.__BUILD_MANIFEST={polyfillFiles:["static/chunks/polyfills-78c92fac7aa8fdd8.js"],devFiles:[],ampDevFiles:[],lowPriorityFiles:["static/SozubT4AiNYJ3ynkRV0zo/_buildManifest.js","static/SozubT4AiNYJ3ynkRV0zo/_ssgManifest.js"],rootMainFiles:["static/chunks/webpack-648d3cb0a281bce5.js","static/chunks/94c12b52-436125ce5f9c910a.js","static/chunks/6842-aed3c9b445ee77d1.js","static/chunks/main-app-02ed5dd91baaafdc.js"],pages:{"/_app":["static/chunks/webpack-648d3cb0a281bce5.js","static/chunks/framework-20afca218c33ed8b.js","static/chunks/main-6224705d81e790a3.js","static/chunks/pages/_app-db7a259df1c8778b.js"],"/_error":["static/chunks/webpack-648d3cb0a281bce5.js","static/chunks/framework-20afca218c33ed8b.js","static/chunks/main-6224705d81e790a3.js","static/chunks/pages/_error-76163253f7e717d4.js"]},ampFirstPages:[]};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html lang="en" class="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/
|
|
1
|
+
<!DOCTYPE html><html lang="en" class="dark"><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width, initial-scale=1"/><link rel="stylesheet" href="/_next/static/css/48c54dd7bfa2411e.css" data-precedence="next"/><link rel="preload" as="script" fetchPriority="low" href="/_next/static/chunks/webpack-648d3cb0a281bce5.js"/><script src="/_next/static/chunks/94c12b52-436125ce5f9c910a.js" async=""></script><script src="/_next/static/chunks/6842-aed3c9b445ee77d1.js" async=""></script><script src="/_next/static/chunks/main-app-02ed5dd91baaafdc.js" async=""></script><meta name="robots" content="noindex"/><title>404: This page could not be found.</title><title>VibeDoc</title><meta name="description" content="Project intelligence for AI-assisted development"/><script src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js" noModule=""></script></head><body class="bg-bg text-txt min-h-screen"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding:0 23px 0 0;font-size:24px;font-weight:500;vertical-align:top;line-height:49px">404</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:49px;margin:0">This page could not be found.</h2></div></div></div><script src="/_next/static/chunks/webpack-648d3cb0a281bce5.js" async=""></script><script>(self.__next_f=self.__next_f||[]).push([0]);self.__next_f.push([2,null])</script><script>self.__next_f.push([1,"1:HL[\"/_next/static/css/48c54dd7bfa2411e.css\",\"style\"]\n"])</script><script>self.__next_f.push([1,"2:I[9148,[],\"\"]\n4:I[36731,[],\"\"]\n5:I[52923,[],\"\"]\nb:I[31304,[],\"\"]\n6:{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"}\n7:{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"}\n8:{\"display\":\"inline-block\"}\n9:{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0}\nc:[]\n"])</script><script>self.__next_f.push([1,"0:[[[\"$\",\"link\",\"0\",{\"rel\":\"stylesheet\",\"href\":\"/_next/static/css/48c54dd7bfa2411e.css\",\"precedence\":\"next\",\"crossOrigin\":\"$undefined\"}]],[\"$\",\"$L2\",null,{\"buildId\":\"SozubT4AiNYJ3ynkRV0zo\",\"assetPrefix\":\"\",\"initialCanonicalUrl\":\"/_not-found\",\"initialTree\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{}]}]},\"$undefined\",\"$undefined\",true],\"initialSeedData\":[\"\",{\"children\":[\"/_not-found\",{\"children\":[\"__PAGE__\",{},[[\"$L3\",[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":{\"fontFamily\":\"system-ui,\\\"Segoe UI\\\",Roboto,Helvetica,Arial,sans-serif,\\\"Apple Color Emoji\\\",\\\"Segoe UI Emoji\\\"\",\"height\":\"100vh\",\"textAlign\":\"center\",\"display\":\"flex\",\"flexDirection\":\"column\",\"alignItems\":\"center\",\"justifyContent\":\"center\"},\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":{\"display\":\"inline-block\",\"margin\":\"0 20px 0 0\",\"padding\":\"0 23px 0 0\",\"fontSize\":24,\"fontWeight\":500,\"verticalAlign\":\"top\",\"lineHeight\":\"49px\"},\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":{\"display\":\"inline-block\"},\"children\":[\"$\",\"h2\",null,{\"style\":{\"fontSize\":14,\"fontWeight\":400,\"lineHeight\":\"49px\",\"margin\":0},\"children\":\"This page could not be found.\"}]}]]}]}]]],null],null]},[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\",\"/_not-found\",\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":\"$undefined\",\"notFoundStyles\":\"$undefined\",\"styles\":null}],null]},[[\"$\",\"html\",null,{\"lang\":\"en\",\"className\":\"dark\",\"children\":[\"$\",\"body\",null,{\"className\":\"bg-bg text-txt min-h-screen\",\"children\":[\"$\",\"$L4\",null,{\"parallelRouterKey\":\"children\",\"segmentPath\":[\"children\"],\"error\":\"$undefined\",\"errorStyles\":\"$undefined\",\"errorScripts\":\"$undefined\",\"template\":[\"$\",\"$L5\",null,{}],\"templateStyles\":\"$undefined\",\"templateScripts\":\"$undefined\",\"notFound\":[[\"$\",\"title\",null,{\"children\":\"404: This page could not be found.\"}],[\"$\",\"div\",null,{\"style\":\"$6\",\"children\":[\"$\",\"div\",null,{\"children\":[[\"$\",\"style\",null,{\"dangerouslySetInnerHTML\":{\"__html\":\"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}\"}}],[\"$\",\"h1\",null,{\"className\":\"next-error-h1\",\"style\":\"$7\",\"children\":\"404\"}],[\"$\",\"div\",null,{\"style\":\"$8\",\"children\":[\"$\",\"h2\",null,{\"style\":\"$9\",\"children\":\"This page could not be found.\"}]}]]}]}]],\"notFoundStyles\":[],\"styles\":null}]}]}],null],null],\"couldBeIntercepted\":false,\"initialHead\":[[\"$\",\"meta\",null,{\"name\":\"robots\",\"content\":\"noindex\"}],\"$La\"],\"globalErrorComponent\":\"$b\",\"missingSlots\":\"$Wc\"}]]\n"])</script><script>self.__next_f.push([1,"a:[[\"$\",\"meta\",\"0\",{\"name\":\"viewport\",\"content\":\"width=device-width, initial-scale=1\"}],[\"$\",\"meta\",\"1\",{\"charSet\":\"utf-8\"}],[\"$\",\"title\",\"2\",{\"children\":\"VibeDoc\"}],[\"$\",\"meta\",\"3\",{\"name\":\"description\",\"content\":\"Project intelligence for AI-assisted development\"}]]\n3:null\n"])</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>500: Internal Server Error</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-648d3cb0a281bce5.js" defer=""></script><script src="/_next/static/chunks/framework-20afca218c33ed8b.js" defer=""></script><script src="/_next/static/chunks/main-6224705d81e790a3.js" defer=""></script><script src="/_next/static/chunks/pages/_app-db7a259df1c8778b.js" defer=""></script><script src="/_next/static/chunks/pages/_error-76163253f7e717d4.js" defer=""></script><script src="/_next/static/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8"/><meta name="viewport" content="width=device-width"/><title>500: Internal Server Error</title><meta name="next-head-count" content="3"/><noscript data-n-css=""></noscript><script defer="" nomodule="" src="/_next/static/chunks/polyfills-78c92fac7aa8fdd8.js"></script><script src="/_next/static/chunks/webpack-648d3cb0a281bce5.js" defer=""></script><script src="/_next/static/chunks/framework-20afca218c33ed8b.js" defer=""></script><script src="/_next/static/chunks/main-6224705d81e790a3.js" defer=""></script><script src="/_next/static/chunks/pages/_app-db7a259df1c8778b.js" defer=""></script><script src="/_next/static/chunks/pages/_error-76163253f7e717d4.js" defer=""></script><script src="/_next/static/SozubT4AiNYJ3ynkRV0zo/_buildManifest.js" defer=""></script><script src="/_next/static/SozubT4AiNYJ3ynkRV0zo/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"SozubT4AiNYJ3ynkRV0zo","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"/
|
|
1
|
+
{"/_app":"pages/_app.js","/_error":"pages/_error.js","/_document":"pages/_document.js","/404":"pages/404.html"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
self.__RSC_SERVER_MANIFEST="{\"node\":{},\"edge\":{},\"encryptionKey\":\"
|
|
1
|
+
self.__RSC_SERVER_MANIFEST="{\"node\":{},\"edge\":{},\"encryptionKey\":\"gl2DGbzj4DC+MRAhYWATKJ8Tb0eAGvYJCXZHnPYSk64=\"}"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{},"edge":{},"encryptionKey":"
|
|
1
|
+
{"node":{},"edge":{},"encryptionKey":"gl2DGbzj4DC+MRAhYWATKJ8Tb0eAGvYJCXZHnPYSk64="}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2401],{98009:function(e,t,r){r.d(t,{Z:function(){return l}});var n=r(31229);/**
|
|
2
|
+
* @license lucide-react v0.575.0 - ISC
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the ISC license.
|
|
5
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/let a=function(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim()},c=e=>e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase(),h=e=>e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase()),i=e=>{let t=h(e);return t.charAt(0).toUpperCase()+t.slice(1)};/**
|
|
7
|
+
* @license lucide-react v0.575.0 - ISC
|
|
8
|
+
*
|
|
9
|
+
* This source code is licensed under the ISC license.
|
|
10
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
11
|
+
*/var d={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"};/**
|
|
12
|
+
* @license lucide-react v0.575.0 - ISC
|
|
13
|
+
*
|
|
14
|
+
* This source code is licensed under the ISC license.
|
|
15
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
16
|
+
*/let y=e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0;return!1},u=(0,n.forwardRef)((e,t)=>{let{color:r="currentColor",size:c=24,strokeWidth:h=2,absoluteStrokeWidth:i,className:u="",children:l,iconNode:o,...k}=e;return(0,n.createElement)("svg",{ref:t,...d,width:c,height:c,stroke:r,strokeWidth:i?24*Number(h)/Number(c):h,className:a("lucide",u),...!l&&!y(k)&&{"aria-hidden":"true"},...k},[...o.map(e=>{let[t,r]=e;return(0,n.createElement)(t,r)}),...Array.isArray(l)?l:[l]])}),l=(e,t)=>{let r=(0,n.forwardRef)((r,h)=>{let{className:d,...y}=r;return(0,n.createElement)(u,{ref:h,iconNode:t,className:a("lucide-".concat(c(i(e))),"lucide-".concat(e),d),...y})});return r.displayName=i(e),r}},94297:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("book-open",[["path",{d:"M12 7v14",key:"1akyts"}],["path",{d:"M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z",key:"ruj8y"}]])},56622:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).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"}]])},63542:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("building-2",[["path",{d:"M10 12h4",key:"a56b0p"}],["path",{d:"M10 8h4",key:"1sr2af"}],["path",{d:"M14 21v-3a2 2 0 0 0-4 0v3",key:"1rgiei"}],["path",{d:"M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2",key:"secmi2"}],["path",{d:"M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16",key:"16ra0t"}]])},26422:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).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"}]])},20508:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("check",[["path",{d:"M20 6 9 17l-5-5",key:"1gmf2c"}]])},62778:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("chevron-down",[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]])},50533:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},12794:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])},9232:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("circle-alert",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["line",{x1:"12",x2:"12",y1:"8",y2:"12",key:"1pkeuh"}],["line",{x1:"12",x2:"12.01",y1:"16",y2:"16",key:"4dfq90"}]])},27881:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("code-xml",[["path",{d:"m18 16 4-4-4-4",key:"1inbqp"}],["path",{d:"m6 8-4 4 4 4",key:"15zrgr"}],["path",{d:"m14.5 4-5 16",key:"e7oirm"}]])},93762:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("database",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 5V19A9 3 0 0 0 21 19V5",key:"1wlel7"}],["path",{d:"M3 12A9 3 0 0 0 21 12",key:"mv7ke4"}]])},21263:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},28260:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("git-branch",[["path",{d:"M15 6a9 9 0 0 0-9 9V3",key:"1cii5b"}],["circle",{cx:"18",cy:"6",r:"3",key:"1h7g24"}],["circle",{cx:"6",cy:"18",r:"3",key:"fqmcym"}]])},73473:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("list",[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]])},78764:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("loader-circle",[["path",{d:"M21 12a9 9 0 1 1-6.219-8.56",key:"13zald"}]])},76877:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},72036:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},81463:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("shield",[["path",{d:"M20 13c0 5-3.5 7.5-7.66 8.95a1 1 0 0 1-.67-.01C7.5 20.5 4 18 4 13V6a1 1 0 0 1 1-1c2 0 4.5-1.2 6.24-2.72a1.17 1.17 0 0 1 1.52 0C14.51 3.81 17 5 19 5a1 1 0 0 1 1 1z",key:"oel41y"}]])},10241:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]])},4864:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("triangle-alert",[["path",{d:"m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",key:"wmoenq"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},8892:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["path",{d:"M16 3.128a4 4 0 0 1 0 7.744",key:"16gr8j"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}]])},42217:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("workflow",[["rect",{width:"8",height:"8",x:"3",y:"3",rx:"2",key:"by2w9f"}],["path",{d:"M7 11v4a2 2 0 0 0 2 2h4",key:"xkn7yn"}],["rect",{width:"8",height:"8",x:"13",y:"13",rx:"2",key:"1cgmvn"}]])},46850:function(e,t,r){r.d(t,{Z:function(){return n}});let n=(0,r(98009).Z)("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]])}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5179],{13191:function(n,e,t){t.d(e,{I:function(){return r}});var i=t(59533),o=t(31229),s=t(52284);let r=o.forwardRef((n,e)=>{let{className:t,type:o,...r}=n;return(0,i.jsx)("input",{type:o,className:(0,s.cn)("flex h-10 w-full rounded-md border border-slate-200 bg-white px-3 py-2 text-base ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium file:text-slate-950 placeholder:text-slate-500 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm dark:border-slate-800 dark:bg-slate-950 dark:ring-offset-slate-950 dark:file:text-slate-50 dark:placeholder:text-slate-400 dark:focus-visible:ring-slate-300",t),ref:e,...r})});r.displayName="Input"},11180:function(n,e,t){t.d(e,{q:function(){return a},w:function(){return c}});var i=t(59533),o=t(31229),s=t(61250);let r=(0,o.createContext)(null);function a(){let n=(0,o.useContext)(r);if(!n)throw Error("useApp must be used inside AppProvider");return n}function c(n){let{children:e}=n,t=(0,s.useRouter)(),[a,c]=(0,o.useState)([]),[d,l]=(0,o.useState)(""),[u,p]=(0,o.useState)(null),[m,h]=(0,o.useState)(null),[g,f]=(0,o.useState)([]),[y,v]=(0,o.useState)(!0),[b,E]=(0,o.useState)(!1),[C,R]=(0,o.useState)(null),A=(0,o.useRef)(null),k=d?"?root=".concat(encodeURIComponent(d)):"",P=(0,o.useCallback)(async n=>{let e=n||d;if(!e)return;let t="?root=".concat(encodeURIComponent(e));try{let[n,e,i]=await Promise.all([fetch("/api/summary".concat(t)).then(n=>n.json()),fetch("/api/tasks".concat(t)).then(n=>n.json()),fetch("/api/activity".concat(t,"&limit=30")).then(n=>n.json())]);p(n),h(e.board),f(Array.isArray(i)?i:[])}catch(n){}v(!1)},[d]);(0,o.useEffect)(()=>{fetch("/api/projects").then(n=>n.json()).then(n=>{c(n),n.length>0?(l(n[0].root),P(n[0].root)):v(!1)}).catch(()=>v(!1))},[]),(0,o.useEffect)(()=>{if(!d)return;let n=new EventSource("/api/events");return A.current=n,n.onmessage=n=>{try{let e=JSON.parse(n.data);if("connected"===e.type)return;E(!0),setTimeout(()=>E(!1),2e3),["task_updated","decision_logged","memory_updated","session_start"].includes(e.type)&&P()}catch(n){}},()=>{n.close()}},[d,P]);let w=(0,o.useCallback)(async(n,e)=>{h(t=>{let i;if(!t)return t;let o=structuredClone(t);for(let t of Object.keys(o)){let s=o[t].findIndex(e=>e.id===n);-1!==s&&(i={...o[t][s],status:e},o[t]=o[t].filter(e=>e.id!==n))}return i&&o[e]&&(o[e]=[i,...o[e]]),o});try{await fetch("/api/tasks".concat(k),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({taskId:n,status:e,actor:"human"})}),P()}catch(n){P()}},[k,P]),S=(0,o.useCallback)(async n=>{let e=await fetch("/api/docs".concat(k,"&read=").concat(encodeURIComponent(n)));R(await e.json()),t.push("/docs")},[k,t]);return(0,i.jsx)(r.Provider,{value:{projects:a,activeProject:d,summary:u,board:m,activity:g,liveIndicator:b,loading:y,selectedDoc:C,setSelectedDoc:R,rootParam:k,onProjectChange:function(n){l(n),P(n)},refresh:P,moveTask:w,openDoc:S},children:e})}},61193:function(n,e,t){t.d(e,{x:function(){return o}});let i=new Date().toISOString().split("T")[0],o=[{id:"claude-md",name:"CLAUDE.md",description:"AI agent instructions for Claude Code",defaultPath:"CLAUDE.md",category:"ai-agent",content:"# {{PROJECT_NAME}} — Agent Instructions\n\n## What this is\n{{DESCRIPTION}}\n\n## Stack\n{{TECH_STACK}}\n\n## Project type\n{{PROJECT_TYPE}}\n\n## Commands\n```bash\n# Install dependencies\n{{PACKAGE_MANAGER}} install\n\n# Start development\nnpm run dev\n\n# Build for production\nnpm run build\n\n# Run tests\nnpm test\n```\n\n## Architecture\n- Primary language: {{PRIMARY_LANGUAGE}}\n- Deployment: {{DEPLOYMENT_PLATFORM}}\n- Key directories: `src/`, `docs/`, `tests/`\n- See `docs/architecture/overview.md` for full details\n\n## Read before coding\n- @docs/architecture/overview.md\n- @CONTRIBUTING.md\n\n## Key conventions\n{{CONVENTIONS}}\n\n## Key features\n{{KEY_FEATURES}}\n\n## Non-negotiables\n- Always run `npm run build` before marking a task done — build must pass\n- Never use localStorage — causes SSR/client mismatch\n- Never commit secrets or credentials\n- Maintain test coverage\n- Follow security best practices\n\n## Code style\n- Follow existing patterns before introducing new abstractions\n- Keep modules small and focused\n- Write tests for business logic\n- Prefer explicit over implicit\n"},{id:"agents-md",name:"AGENTS.md",description:"AI agent instructions (multi-agent / OpenAI)",defaultPath:"AGENTS.md",category:"ai-agent",content:"# {{PROJECT_NAME}} — Agent Instructions\n\n## Overview\n{{DESCRIPTION}}\n\n## Stack\n{{TECH_STACK}}\n\n## Commands\n```bash\nnpm install\nnpm run dev\nnpm run build\nnpm test\n```\n\n## Key conventions\n{{CONVENTIONS}}\n\n## Non-negotiables\n- Follow existing code patterns\n- Write tests for new features\n- Never commit secrets or credentials\n"},{id:"gemini-md",name:"GEMINI.md",description:"AI agent instructions for Gemini CLI",defaultPath:"GEMINI.md",category:"ai-agent",content:"# {{PROJECT_NAME}} — Gemini Agent Instructions\n\n## What this is\n{{DESCRIPTION}}\n\n## Stack\n{{TECH_STACK}}\n\n## Commands\n```bash\n# Install dependencies\nnpm install\n\n# Start development\nnpm run dev\n\n# Build for production\nnpm run build\n\n# Run tests\nnpm test\n```\n\n## Key conventions\n{{CONVENTIONS}}\n\n## Non-negotiables\n- Follow existing code patterns\n- Write tests for new features\n- Never commit secrets or credentials\n"},{id:"cursorrules",name:".cursorrules",description:"Cursor IDE rules for AI assistance",defaultPath:".cursorrules",category:"ai-agent",content:"# {{PROJECT_NAME}} — Cursor Rules\n\n## Project overview\n{{DESCRIPTION}}\n\n## Tech stack\n{{TECH_STACK}}\n\n## Code style\n- Use {{TECH_STACK}} conventions\n- Follow existing patterns in the codebase\n- Prefer explicit over implicit\n- Keep functions small and focused\n\n## Conventions\n{{CONVENTIONS}}\n\n## What NOT to do\n- Don't introduce new dependencies without discussion\n- Don't break existing tests\n- Don't commit secrets or credentials\n- Don't over-engineer simple solutions\n"},{id:"windsurfrules",name:".windsurfrules",description:"Windsurf IDE rules for AI assistance",defaultPath:".windsurfrules",category:"ai-agent",content:"# {{PROJECT_NAME}} — Windsurf Rules\n\n## Project overview\n{{DESCRIPTION}}\n\n## Tech stack\n{{TECH_STACK}}\n\n## Code style\n- Follow existing patterns in the codebase\n- Prefer explicit over implicit\n- Keep functions small and focused\n\n## Conventions\n{{CONVENTIONS}}\n\n## Non-negotiables\n- Don't introduce breaking changes\n- Don't commit secrets or credentials\n- Maintain test coverage\n"},{id:"copilot-instructions",name:"Copilot Instructions",description:"GitHub Copilot custom instructions",defaultPath:".github/copilot-instructions.md",category:"ai-agent",content:"# GitHub Copilot Instructions — {{PROJECT_NAME}}\n\n## Project overview\n{{DESCRIPTION}}\n\n## Tech stack\n{{TECH_STACK}}\n\n## Coding conventions\n{{CONVENTIONS}}\n\n## Key features\n{{KEY_FEATURES}}\n\n## Style guidelines\n- Follow existing patterns before creating new abstractions\n- Write descriptive variable and function names\n- Add comments for non-obvious logic only\n- Keep functions focused on a single responsibility\n\n## Testing\n- Write tests for all new functionality\n- Maintain existing test coverage\n- Use the project's established testing patterns\n"},{id:"contributing",name:"CONTRIBUTING.md",description:"Contribution guidelines",defaultPath:"CONTRIBUTING.md",category:"github",content:'# Contributing to {{PROJECT_NAME}}\n\nThank you for your interest in contributing!\n\n## Getting started\n\n1. Fork the repository\n2. Clone your fork: `git clone {{REPO_URL}}`\n3. Create a feature branch: `git checkout -b feat/your-feature`\n4. Make your changes\n5. Submit a pull request\n\n## Branch naming\n\n| Type | Pattern | Example |\n|------|---------|---------|\n| Feature | `feat/<description>` | `feat/user-auth` |\n| Fix | `fix/<description>` | `fix/login-crash` |\n| Chore | `chore/<description>` | `chore/update-deps` |\n| Docs | `docs/<description>` | `docs/api-guide` |\n| Refactor | `refactor/<description>` | `refactor/auth-module` |\n| Release | `release/<version>` | `release/v1.2.0` |\n\n## Commit conventions\n\nWe use [Conventional Commits](https://conventionalcommits.org):\n\n| Type | When to use |\n|------|------------|\n| `feat` | New feature |\n| `fix` | Bug fix |\n| `docs` | Documentation only |\n| `refactor` | Code change that\'s neither fix nor feature |\n| `test` | Adding or updating tests |\n| `chore` | Build process, dependencies, tooling |\n| `perf` | Performance improvement |\n| `ci` | CI/CD changes |\n\nExamples:\n```\nfeat: add user authentication\nfix: resolve login redirect issue\ndocs: update API reference\nchore: upgrade dependencies\nfeat!: redesign auth API (breaking change — note the !)\n```\n\n## PR size guidance\n\n| Size | Lines changed | Guidance |\n|------|--------------|---------|\n| Small | < 400 lines | Ideal — fast to review |\n| Medium | 400–800 lines | Acceptable — add extra context in description |\n| Large | > 800 lines | Needs discussion before opening — split if possible |\n\nLarge PRs slow down the team and increase the chance of missed issues. When in doubt, split.\n\n## Pull request process\n\n1. Fill out the PR template completely\n2. Ensure all CI checks pass\n3. Request review from at least one maintainer\n4. Address all review comments\n5. Squash commits before merge\n\n## Code review checklist\n\n**Author:**\n- [ ] Self-reviewed the diff before requesting review\n- [ ] PR description explains the "why", not just the "what"\n- [ ] Tests added/updated and passing\n- [ ] No secrets or credentials in code\n- [ ] Breaking changes noted in PR description\n\n**Reviewer:**\n- [ ] Code is correct and handles edge cases\n- [ ] No obvious performance issues\n- [ ] Tests are meaningful (not just coverage padding)\n- [ ] Naming is clear and consistent with the codebase\n- [ ] Documentation updated if public API changed\n\n## Code style\n{{CONVENTIONS}}\n\n## Reporting bugs\n\nOpen an issue with:\n- Description of the bug\n- Steps to reproduce\n- Expected vs actual behavior\n- Environment details\n'},{id:"security",name:"SECURITY.md",description:"Security policy and vulnerability reporting",defaultPath:"SECURITY.md",category:"github",content:"# Security Policy — {{PROJECT_NAME}}\n\n## Supported versions\n\n| Version | Supported |\n|---------|-----------|\n| latest | ✅ |\n| < 1.0 | ❌ |\n\n## Reporting a vulnerability\n\n**Please do not report security vulnerabilities through public GitHub issues.**\n\nTo report a security issue, email: **security@example.com**\n\nYou may optionally encrypt your report using our PGP key (key ID: `0x00000000`, available on keys.openpgp.org).\n\nInclude:\n- Description of the vulnerability\n- Steps to reproduce\n- Potential impact\n- Any suggested mitigations\n\nYou will receive a response within **48 hours**. We will:\n1. Confirm receipt of your report\n2. Investigate and assess the issue\n3. Release a fix or mitigation\n4. Credit you in the release notes (unless you prefer anonymity)\n\n## Vulnerability SLAs\n\n| Severity | Fix SLA |\n|----------|---------|\n| Critical | 48 hours |\n| High | 7 days |\n| Medium | 30 days |\n| Low | 90 days |\n\nDependabot alerts for **critical** vulnerabilities must be resolved within 48 hours. Run `npm audit` in CI on every PR.\n\n## Secrets rotation schedule\n\n| Secret | Rotation | Owner |\n|--------|----------|-------|\n| JWT signing key | Every 90 days | Platform team |\n| Database passwords | Every 180 days | Platform team |\n| API keys (third-party) | On staff change | Security team |\n| Deploy tokens | Every 90 days | DevOps |\n\n## OWASP Top 10 checklist\n\n- [ ] **A01 Broken Access Control** — Enforce authorization on every endpoint; deny by default\n- [ ] **A02 Cryptographic Failures** — Use TLS everywhere; never store plaintext secrets; use bcrypt/argon2 for passwords\n- [ ] **A03 Injection** — Use parameterized queries; validate and sanitize all input\n- [ ] **A04 Insecure Design** — Threat model new features; use principle of least privilege\n- [ ] **A05 Security Misconfiguration** — Harden defaults; disable unused features; set security headers\n- [ ] **A06 Vulnerable Components** — Run `npm audit` in CI; automate with Dependabot\n- [ ] **A07 Auth Failures** — Implement MFA; lock accounts after failed attempts; use secure session management\n- [ ] **A08 Software Integrity Failures** — Verify checksums; use lockfiles; pin CI action versions\n- [ ] **A09 Logging Failures** — Log auth events, access failures; never log secrets or PII\n- [ ] **A10 SSRF** — Validate and allowlist URLs for any server-side requests\n\n## Security best practices\n\nWhen contributing to this project:\n- Never commit secrets, tokens, or credentials\n- Use environment variables for all sensitive configuration\n- Validate and sanitize all user input\n- Follow the principle of least privilege\n- Keep dependencies up to date\n"},{id:"pr-template",name:"PR Template",description:"Pull request template",defaultPath:".github/pull_request_template.md",category:"github",content:"## Description\n\n<!-- Briefly describe the changes and why they were made -->\n\n## Type of change\n\n- [ ] Bug fix (non-breaking change that fixes an issue)\n- [ ] New feature (non-breaking change that adds functionality)\n- [ ] Breaking change (fix or feature that would cause existing functionality to change)\n- [ ] Documentation update\n- [ ] Refactor / code cleanup\n- [ ] Dependency update\n\n## Related issues\n\nCloses #\n\n## How to test\n\n1.\n2.\n3.\n\n## Screenshots / recordings\n\n<!-- If applicable, add screenshots or screen recordings -->\n\n## Checklist\n\n- [ ] My code follows the project's style guidelines\n- [ ] I have performed a self-review of my changes\n- [ ] I have added tests that prove my fix or feature works\n- [ ] New and existing unit tests pass locally\n- [ ] I have updated documentation if needed\n- [ ] No secrets or credentials are included\n"},{id:"bug-report",name:"Bug Report Template",description:"GitHub issue template for bugs",defaultPath:".github/ISSUE_TEMPLATE/bug_report.md",category:"github",content:"---\nname: Bug report\nabout: Create a report to help us improve\nlabels: bug\n---\n\n## Describe the bug\n\nA clear and concise description of what the bug is.\n\n## Steps to reproduce\n\n1. Go to '...'\n2. Click on '...'\n3. See error\n\n## Expected behavior\n\nA clear and concise description of what you expected to happen.\n\n## Actual behavior\n\nWhat actually happened.\n\n## Screenshots\n\nIf applicable, add screenshots to help explain your problem.\n\n## Environment\n\n- OS: [e.g. macOS 14]\n- Browser: [e.g. Chrome 120]\n- Version: [e.g. 1.2.3]\n- Node.js: [e.g. 20.x]\n\n## Additional context\n\nAdd any other context about the problem here.\n"},{id:"feature-request",name:"Feature Request Template",description:"GitHub issue template for features",defaultPath:".github/ISSUE_TEMPLATE/feature_request.md",category:"github",content:"---\nname: Feature request\nabout: Suggest an idea for this project\nlabels: enhancement\n---\n\n## Problem\n\nIs your feature request related to a problem? Please describe.\nA clear and concise description of what the problem is.\n\n## Proposed solution\n\nA clear and concise description of what you want to happen.\n\n## Alternatives considered\n\nA clear and concise description of any alternative solutions or features you've considered.\n\n## Implementation notes\n\nAny thoughts on how this might be implemented?\n\n## Additional context\n\nAdd any other context, mockups, or screenshots about the feature request here.\n"},{id:"changelog",name:"CHANGELOG.md",description:"Keep a Changelog format",defaultPath:"CHANGELOG.md",category:"process",content:"# Changelog — {{PROJECT_NAME}}\n\nAll notable changes to this project will be documented in this file.\n\nThe format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),\nand this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).\n\n## [Unreleased]\n\n### Added\n-\n\n### Changed\n-\n\n### Fixed\n-\n\n### Removed\n-\n\n## [1.0.0] — {{DATE}}\n\n### Added\n- Initial release\n"},{id:"deployment",name:"DEPLOYMENT.md",description:"Deployment guide and procedures",defaultPath:"DEPLOYMENT.md",category:"process",content:"# Deployment Guide — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Environments\n\n| Environment | URL | Branch | Auto-deploy |\n|-------------|-----|--------|-------------|\n| Production | | `main` | No |\n| Staging | | `develop` | Yes |\n| Preview | | PRs | Yes |\n\n## Prerequisites\n\n- Access to deployment platform\n- Environment variables configured (see `.env.example`)\n- CI/CD pipeline passing\n\n## Deploy to production\n\n```bash\n# 1. Ensure tests pass\nnpm test\n\n# 2. Build and verify\nnpm run build\n\n# 3. Merge to main\ngit checkout main && git merge develop\n\n# 4. Tag the release\ngit tag v1.x.x && git push --tags\n```\n\n## Environment variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| | Yes | |\n\n## Rollback procedure\n\n1. Identify the last stable release tag\n2. `git checkout <tag>`\n3. Redeploy the previous version\n4. Verify the rollback with smoke tests\n\n## Smoke tests\n\nAfter every deploy, verify:\n- [ ] App loads at production URL\n- [ ] Auth flow works\n- [ ] Core features functional\n- [ ] No error spikes in monitoring\n\n## Contacts\n\n| Role | Contact |\n|------|---------|\n| On-call | |\n| Release manager | |\n"},{id:"testing",name:"TESTING.md",description:"Testing strategy and guide",defaultPath:"TESTING.md",category:"process",content:"# Testing Guide — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Test pyramid\n\n```\n /\\\n /E2E\\ 10% — Critical user flows only\n /------\\\n /Integr. \\ 20% — API, DB, service boundaries\n /----------\\\n / Unit \\ 70% — Functions, logic, utilities\n /______________\\\n```\n\n## Test strategy\n\n| Layer | Type | Tool | Coverage target |\n|-------|------|------|----------------|\n| Unit | Functions/logic | {{TEST_FRAMEWORK}} | 80%+ |\n| Integration | API/DB | {{TEST_FRAMEWORK}} | 70%+ |\n| E2E | User flows | Playwright | Key paths |\n\n## Coverage targets by directory\n\n| Directory | Target | Rationale |\n|-----------|--------|-----------|\n| `src/lib/` | 90%+ | Core business logic |\n| `src/api/` | 80%+ | API handlers |\n| `src/components/` | 60%+ | UI — focus on logic, not rendering |\n| `src/utils/` | 90%+ | Pure utility functions |\n\n## Running tests\n\n```bash\n# Run all tests\nnpm test\n\n# Run with coverage\nnpm run test:coverage\n\n# Run E2E tests\nnpm run test:e2e\n\n# Watch mode\nnpm run test:watch\n```\n\n## Writing tests\n\n### Unit test example\n\n```typescript\ndescribe('MyFunction', () => {\n it('should return expected value', () => {\n expect(myFunction(input)).toBe(expected)\n })\n})\n```\n\n### Integration test guidelines\n- Use a real database (not mocks) for DB tests\n- Reset state between tests\n- Test happy path and error cases\n\n### E2E test guidelines\n- Cover critical user journeys\n- Use stable selectors (`data-testid`)\n- Run against staging environment\n\n### Playwright config example\n\n```typescript\n// playwright.config.ts\nimport { defineConfig, devices } from '@playwright/test'\n\nexport default defineConfig({\n testDir: './e2e',\n fullyParallel: true,\n forbidOnly: !!process.env.CI,\n retries: process.env.CI ? 2 : 0,\n reporter: 'html',\n use: {\n baseURL: process.env.PLAYWRIGHT_BASE_URL ?? 'http://localhost:3000',\n trace: 'on-first-retry',\n },\n projects: [\n {name: 'chromium', use: {...devices['Desktop Chrome']}},\n {name: 'Mobile Safari', use: {...devices['iPhone 13']}},\n ],\n webServer: {\n command: 'npm run dev',\n url: 'http://localhost:3000',\n reuseExistingServer: !process.env.CI,\n },\n})\n```\n\n## Flaky test policy\n\n1. **Quarantine immediately** — tag with `@flaky` and skip in CI (`test.skip`)\n2. **Create a ticket** — track as a P2 bug with a 2-week SLA to fix\n3. **Root cause** — common causes: timing issues, shared state, network calls\n4. **Fix or delete** — flaky tests are worse than no tests (false confidence)\n\nQuarantine example:\n```typescript\ntest.skip('flaky: timing issue with animation', async ({ page }) => {\n // TODO: fix by waiting for animation end event instead of sleep\n})\n```\n\n## Test organization\n\n```\nsrc/\n __tests__/ # Unit tests\n __integration__/ # Integration tests\ne2e/ # E2E tests\n```\n\n## CI/CD\n\nTests run automatically on every PR. PRs cannot merge with failing tests.\n"},{id:"glossary",name:"Glossary",description:"Project terminology reference",defaultPath:"docs/glossary.md",category:"process",content:"# Glossary — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\nThis document defines terms used throughout the project documentation and codebase.\n\n## Terms\n\n| Term | Definition |\n|------|------------|\n| | |\n\n## Acronyms\n\n| Acronym | Full form | Meaning |\n|---------|-----------|---------|\n| | | |\n\n## Domain concepts\n\n<!-- Add domain-specific concepts here -->\n\n---\n\n*Keep this document updated as new terminology is introduced.*\n"},{id:"prd",name:"PRD",description:"Product requirements document",defaultPath:"docs/prd.md",category:"technical",content:"# Product Requirements — {{PROJECT_NAME}}\n\n**Status:** Draft\n**Last updated:** {{DATE}}\n**Author:**\n**Stakeholders:**\n\n## Problem statement\n{{DESCRIPTION}}\n\n## Goals\n-\n-\n\n## Non-goals\n-\n-\n\n## User stories\n| As a... | I want to... | So that... |\n|---------|--------------|------------|\n| user | | |\n\n## Requirements\n\n### Functional\n{{KEY_FEATURES}}\n\n### Non-functional\n- Performance:\n- Security:\n- Reliability:\n- Scalability:\n\n## Success metrics\n| Metric | Current | Target |\n|--------|---------|--------|\n| | | |\n\n## Timeline\n| Milestone | Target date |\n|-----------|-------------|\n| | |\n\n## Open questions\n-\n"},{id:"architecture-overview",name:"Architecture Overview",description:"System architecture doc",defaultPath:"docs/architecture/overview.md",category:"technical",content:'# Architecture Overview — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Summary\n{{DESCRIPTION}}\n\n## Tech stack\n{{TECH_STACK}}\n\n## System diagram\n\n### Context (C4 Level 1)\n\n```mermaid\ngraph TB\n User["User"] --> System["{{PROJECT_NAME}}"]\n System --> ExternalAPI["External APIs"]\n System --> DB["Database"]\n```\n\n### Container (C4 Level 2)\n\n```mermaid\ngraph TB\n Client["Web Client<br/>(Browser)"] --> API["API Server<br/>(Node.js)"]\n API --> DB["Database<br/>(PostgreSQL)"]\n API --> Cache["Cache<br/>(Redis)"]\n API --> Queue["Job Queue"]\n```\n\n## Components\n\n| Component | Responsibility | Tech |\n|-----------|---------------|------|\n| | | |\n\n## Data flow\n\n1.\n2.\n3.\n\n## Key decisions\n\n| Decision | Chosen | Alternative | Rationale |\n|----------|--------|-------------|-----------|\n| | | | |\n\n## ADR log\n\n| ADR | Title | Status | Date |\n|-----|-------|--------|------|\n| 001 | | Accepted | {{DATE}} |\n\n## Non-goals\n\n- <!-- What this system explicitly does NOT do -->\n\n## Security considerations\n- Authentication:\n- Authorization:\n- Data validation:\n- Secrets management:\n\n## Scalability notes\n-\n'},{id:"api-reference",name:"API Reference",description:"API endpoints reference",defaultPath:"docs/api-reference.md",category:"technical",content:'# API Reference — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Base URL\n\n```\nhttps://api.example.com/v1\n```\n\n## Versioning\n\nThis API uses URL-based versioning (`/v1/`, `/v2/`, etc.).\n\n- The current stable version is `v1`.\n- Deprecated versions are supported for 12 months after a new version is released.\n- Breaking changes always increment the major version.\n\n## Authentication\n\nAll requests require a bearer token in the Authorization header:\n\n```\nAuthorization: Bearer <token>\n```\n\n### Token refresh\n\nTokens expire after 1 hour. Refresh using:\n\n```\nPOST /auth/refresh\nContent-Type: application/json\n\n{"refreshToken": "<refresh_token>"}\n```\n\n**Response:**\n```json\n{"accessToken": "...", "refreshToken": "...", "expiresIn": 3600}\n```\n\n## Rate limiting\n\n- **Limit:** 1000 requests/hour per API key\n- **Headers:** `X-RateLimit-Limit`, `X-RateLimit-Remaining`, `X-RateLimit-Reset`\n\n## Pagination\n\nList endpoints support cursor-based pagination:\n\n```\nGET /resources?cursor=<cursor>&limit=20\n```\n\n## Error format\n\nAll errors follow a standard envelope:\n\n```json\n{\n "code": "VALIDATION_ERROR",\n "message": "Human-readable description",\n "details": [{"field": "email", "issue": "invalid format"}]\n}\n```\n\n## Error codes\n\n| Code | Meaning |\n|------|---------|\n| 400 | Bad request — invalid parameters |\n| 401 | Unauthorized — missing or invalid token |\n| 403 | Forbidden — insufficient permissions |\n| 404 | Not found |\n| 422 | Unprocessable entity — validation error |\n| 429 | Too many requests |\n| 500 | Internal server error |\n\n## Webhooks\n\n### Signature verification\n\nAll webhook payloads are signed with HMAC-SHA256. Verify the signature:\n\n```\nX-Webhook-Signature: sha256=<hmac_hex>\n```\n\n```typescript\nimport crypto from \'crypto\'\n\nfunction verifyWebhook(payload: string, signature: string, secret: string): boolean {\n const expected = crypto\n .createHmac(\'sha256\', secret)\n .update(payload)\n .digest(\'hex\')\n return crypto.timingSafeEqual(\n Buffer.from(`sha256=${expected}`),\n Buffer.from(signature)\n )\n}\n```\n\n## Endpoints\n\n### GET /resource\n\n**Description:** List resources\n\n**Query parameters:**\n- `limit` (integer, default 20) — items per page\n- `cursor` (string) — pagination cursor\n\n**Response:**\n```json\n{\n "data": [],\n "cursor": null,\n "total": 0\n}\n```\n\n### POST /resource\n\n**Description:** Create a resource\n\n**Request body:**\n```json\n{}\n```\n\n**Response:**\n```json\n{}\n```\n'},{id:"runbook",name:"Runbook",description:"Operational runbook",defaultPath:"docs/runbook.md",category:"technical",content:'# Runbook — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Overview\n{{DESCRIPTION}}\n\n## SLOs\n\n| Metric | Target |\n|--------|--------|\n| Availability | 99.9% |\n| P95 latency | < 500ms |\n| Error rate | < 0.1% |\n\n## Environments\n\n| Env | URL | Purpose |\n|-----|-----|---------|\n| Production | | Live traffic |\n| Staging | | Pre-release testing |\n| Development | | Local dev |\n\n## Alerting\n\n| Alert | Threshold | Severity | Action |\n|-------|-----------|----------|--------|\n| | | | |\n\n## On-call contacts\n\n| Role | Name | Contact |\n|------|------|---------|\n| Primary | | |\n| Secondary | | |\n\n## Escalation matrix\n\n| Time since incident | Contact | Method |\n|--------------------|---------|--------|\n| 0–15 min | On-call engineer | PagerDuty / phone |\n| 15–30 min | Team lead | Slack + phone |\n| 30+ min | Engineering manager | Phone + email |\n\n## Procedures\n\n### Deploy\n\n1.\n2.\n3.\n\n### Rollback\n\n**When to rollback:**\n\n| Signal | Action |\n|--------|--------|\n| Error rate > 1% after deploy | Immediate rollback |\n| P95 latency doubled | Rollback if no fix in 15 min |\n| Health check failing | Immediate rollback |\n| Critical bug reported | Rollback within 30 min |\n\n**Rollback steps:**\n\n```bash\n# 1. Identify last stable release\ngit log --oneline --tags --simplify-by-decoration | head -5\n\n# 2. Deploy previous version\ngit checkout <previous-tag>\nnpm run build && npm run deploy\n\n# 3. Verify rollback\ncurl -f https://your-app.com/health\n```\n\n### Troubleshooting\n\n#### High error rate\n```bash\n# Check recent application logs\ntail -f /var/log/app/error.log\n\n# Check error counts by endpoint\ngrep "ERROR" /var/log/app/app.log | awk \'{print $5}\' | sort | uniq -c | sort -rn | head -10\n\n# Review recent deploys\ngit log --oneline -10\n```\n\n1. Check application logs for exception traces\n2. Check downstream dependencies (database, cache, external APIs)\n3. Review recent deploys — consider rollback if deploy-correlated\n\n#### High latency\n```bash\n# Check database slow query log\npsql $DATABASE_URL -c "SELECT query, calls, mean_exec_time FROM pg_stat_statements ORDER BY mean_exec_time DESC LIMIT 10;"\n\n# Check cache hit rate\nredis-cli info stats | grep hit_rate\n\n# Check CPU/memory\ntop -b -n 1 | head -20\n```\n\n1. Check database query times (slow query log)\n2. Check cache hit rates\n3. Review resource utilization (CPU, memory, connections)\n\n#### Service won\'t start\n```bash\n# Check environment variables\nenv | grep -E "DATABASE|REDIS|PORT"\n\n# Test database connectivity\npsql $DATABASE_URL -c "SELECT 1"\n\n# Check port availability\nlsof -i :3000\n```\n\n#### Database connection issues\n```bash\n# Check connection pool status\npsql $DATABASE_URL -c "SELECT count(*), state FROM pg_stat_activity GROUP BY state;"\n\n# Check max connections\npsql $DATABASE_URL -c "SHOW max_connections;"\n```\n\n#### Memory leak suspected\n```bash\n# Monitor memory over time\nwatch -n 5 \'ps aux --sort=-%mem | head -5\'\n\n# Capture heap snapshot (Node.js)\nkill -USR2 <pid>\n```\n'},{id:"adr",name:"Architecture Decision",description:"Architecture Decision Record",defaultPath:"docs/architecture/decisions/ADR-001.md",category:"technical",content:"# ADR-001: Title\n\n**Status:** Proposed\n**Date:** {{DATE}}\n**Deciders:**\n\n## Context\nWhat is the issue that we're seeing that is motivating this decision or change?\n\n## Decision\nWhat is the change that we're proposing and/or doing?\n\n## Rationale\nWhy did we choose this option?\n\n## Alternatives considered\n- **Option A:** Description — pros/cons\n- **Option B:** Description — pros/cons\n\n## Consequences\n\n### Positive\n-\n\n### Negative\n-\n\n### Neutral\n-\n"},{id:"onboarding",name:"Onboarding Guide",description:"Developer onboarding guide",defaultPath:"docs/onboarding.md",category:"technical",content:"# Developer Onboarding — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Overview\n{{DESCRIPTION}}\n\n## Prerequisites\n- [ ] Access to repository ({{REPO_URL}})\n- [ ] Access to staging environment\n- [ ] Accounts: (list required accounts/services)\n\n## Day 1: Get running\n\n- [ ] Clone the repository and set up local environment\n- [ ] Run the app locally and verify it works\n- [ ] Read the architecture overview (`docs/architecture/overview.md`)\n- [ ] Meet your team lead and get a tour of the codebase\n\n```bash\n# Clone\ngit clone {{REPO_URL}}\ncd {{PROJECT_NAME}}\n\n# Install dependencies\nnpm install\n\n# Copy environment variables\ncp .env.example .env.local\n# Edit .env.local with real values (ask your team lead)\n\n# Start development server\nnpm run dev\n```\n\n## Week 1: Get productive\n\n- [ ] Complete the environment setup checklist below\n- [ ] Read `CONTRIBUTING.md` and understand the PR process\n- [ ] Submit your first PR (even a small doc fix counts)\n- [ ] Attend team standup and sprint planning\n- [ ] Review 2–3 recent merged PRs to understand code patterns\n- [ ] Shadow a code review\n\n## Month 1: Get comfortable\n\n- [ ] Deliver your first feature end-to-end\n- [ ] Lead a code review\n- [ ] Identify one piece of tech debt and create a ticket\n- [ ] Update this onboarding doc with anything that was unclear\n\n## Environment setup\n\n```bash\n# Install dependencies\nnpm install\n\n# Copy environment variables\ncp .env.example .env.local\n\n# Start development server\nnpm run dev\n```\n\n## Tech stack\n{{TECH_STACK}}\n\n## IDE setup\n- Recommended: VS Code or Cursor\n- Install recommended extensions (see `.vscode/extensions.json`)\n- Enable format on save\n\n## Project structure\n\n```\n(describe key directories here)\n```\n\n## Key concepts\n-\n\n## Common tasks\n\n### Running tests\n```bash\nnpm test\n```\n\n### Building for production\n```bash\nnpm run build\n```\n\n## Common pitfalls\n\n1. **Forgetting to copy .env.local** — the app won't start without required env vars. Copy from `.env.example` and fill in real values.\n2. **Running `npm install` instead of the project's package manager** — check `package.json` for the `packageManager` field or look for a lock file (`pnpm-lock.yaml`, `yarn.lock`).\n3. **Committing to `main` directly** — always branch and open a PR. Direct pushes to `main` are blocked.\n4. **Skipping tests** — CI will catch you, but it's faster to run `npm test` locally before pushing.\n5. **Not reading existing patterns** — before adding a new abstraction, search the codebase for how similar problems are solved.\n\n## Your first PR\n\n1. Pick a small, well-defined issue labelled `good first issue`\n2. Create a branch: `git checkout -b feat/your-name-first-pr`\n3. Make the change and add a test\n4. Open a PR with the PR template filled out\n5. Ask for a review in the team Slack channel\n\n## Key contacts\n\n| Role | Name | Contact |\n|------|------|---------|\n| | | |\n\n## Resources\n- Architecture overview: `docs/architecture/overview.md`\n- API reference: `docs/api-reference.md`\n- Runbook: `docs/runbook.md`\n- Contributing guide: `CONTRIBUTING.md`\n"},{id:"database",name:"Database Docs",description:"Database schema and design reference",defaultPath:"docs/DATABASE.md",category:"technical",content:"# Database Documentation — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Overview\n\n<!-- Brief description of the database design -->\n\n## Entity Relationship Diagram\n\n```mermaid\nerDiagram\n USERS {\n uuid id PK\n string email\n timestamp created_at\n }\n```\n\n## Tables\n\n### users\n\n| Column | Type | Nullable | Description |\n|--------|------|----------|-------------|\n| id | uuid | No | Primary key |\n| email | varchar | No | Unique email |\n| created_at | timestamp | No | Creation time |\n\n## Indexes\n\n| Table | Columns | Type | Purpose |\n|-------|---------|------|---------|\n| | | | |\n\n## Migrations\n\nMigrations live in `db/migrations/`. Run with:\n\n```bash\nnpm run db:migrate\n```\n\n## Connection\n\n```\nDATABASE_URL=postgresql://user:password@host:5432/dbname\n```\n\n## Backup & restore\n\n```bash\n# Backup\npg_dump $DATABASE_URL > backup.sql\n\n# Restore\npsql $DATABASE_URL < backup.sql\n```\n\n## Performance notes\n\n-\n"},{id:"openapi",name:"OpenAPI Spec",description:"OpenAPI 3.0 API specification scaffold",defaultPath:"docs/api-spec.yaml",category:"technical",content:"openapi: 3.0.3\ninfo:\n title: {{PROJECT_NAME}} API\n description: |\n {{DESCRIPTION}}\n version: 1.0.0\n contact:\n email: team@example.com\n\nservers:\n - url: https://api.example.com/v1\n description: Production\n - url: https://staging-api.example.com/v1\n description: Staging\n\nsecurity:\n - bearerAuth: []\n\npaths:\n /health:\n get:\n summary: Health check\n operationId: healthCheck\n security: []\n responses:\n '200':\n description: OK\n content:\n application/json:\n schema:\n type: object\n properties:\n status:\n type: string\n example: ok\n\n /resources:\n get:\n summary: List resources\n operationId: listResources\n parameters:\n - name: limit\n in: query\n schema:\n type: integer\n default: 20\n - name: cursor\n in: query\n schema:\n type: string\n responses:\n '200':\n description: Success\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/ResourceList'\n '401':\n $ref: '#/components/responses/Unauthorized'\n\ncomponents:\n securitySchemes:\n bearerAuth:\n type: http\n scheme: bearer\n bearerFormat: JWT\n\n schemas:\n Resource:\n type: object\n properties:\n id:\n type: string\n format: uuid\n createdAt:\n type: string\n format: date-time\n\n ResourceList:\n type: object\n properties:\n data:\n type: array\n items:\n $ref: '#/components/schemas/Resource'\n cursor:\n type: string\n nullable: true\n total:\n type: integer\n\n Error:\n type: object\n properties:\n error:\n type: string\n message:\n type: string\n\n responses:\n Unauthorized:\n description: Unauthorized\n content:\n application/json:\n schema:\n $ref: '#/components/schemas/Error'\n"},{id:"meeting-notes",name:"Meeting Notes",description:"Meeting notes template",defaultPath:"docs/meetings/".concat(i,".md"),category:"technical",content:"# Meeting Notes — ".concat(i,"\n\n**Attendees:**\n**Facilitator:**\n\n## Agenda\n\n1.\n2.\n\n## Notes\n\n## Decisions\n\n## Action items\n\n| Action | Owner | Due |\n|--------|-------|-----|\n| | | |\n\n## Next meeting\n")},{id:"blank",name:"Blank Document",description:"Empty markdown file",defaultPath:"docs/untitled.md",category:"technical",content:"# Untitled\n\n"},{id:"dockerfile",name:"Dockerfile",description:"Multi-stage Docker build with health check",defaultPath:"Dockerfile",category:"infrastructure",content:'# Stage 1: Install dependencies\nFROM node:20-alpine AS deps\nRUN apk add --no-cache libc6-compat\nWORKDIR /app\nCOPY package*.json ./\nRUN npm ci --only=production\n\n# Stage 2: Build\nFROM node:20-alpine AS builder\nWORKDIR /app\nCOPY --from=deps /app/node_modules ./node_modules\nCOPY . .\nRUN npm run build\n\n# Stage 3: Run\nFROM node:20-alpine AS runner\nWORKDIR /app\nENV NODE_ENV=production\nRUN addgroup --system --gid 1001 nodejs\nRUN adduser --system --uid 1001 appuser\nCOPY --from=builder /app/dist ./dist\nCOPY --from=deps /app/node_modules ./node_modules\nCOPY package*.json ./\nUSER appuser\nEXPOSE 3000\nHEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \\\n CMD wget -qO- http://localhost:3000/health || exit 1\nCMD ["node", "dist/index.js"]\n'},{id:"docker-compose",name:"docker-compose.yml",description:"Docker Compose with app, Postgres, and Redis",defaultPath:"docker-compose.yml",category:"infrastructure",content:'# Docker Compose V2+ (no version key needed)\nservices:\n app:\n build: .\n ports:\n - "3000:3000"\n environment:\n DATABASE_URL: postgresql://postgres:password@db:5432/{{PROJECT_NAME}}\n REDIS_URL: redis://redis:6379\n depends_on:\n db:\n condition: service_healthy\n redis:\n condition: service_healthy\n\n db:\n image: postgres:16-alpine\n environment:\n POSTGRES_PASSWORD: password\n POSTGRES_DB: {{PROJECT_NAME}}\n healthcheck:\n test: ["CMD-SHELL", "pg_isready -U postgres"]\n interval: 10s\n timeout: 5s\n retries: 5\n volumes:\n - postgres_data:/var/lib/postgresql/data\n\n redis:\n image: redis:7-alpine\n healthcheck:\n test: ["CMD", "redis-cli", "ping"]\n interval: 10s\n timeout: 5s\n retries: 5\n volumes:\n - redis_data:/data\n\nvolumes:\n postgres_data:\n redis_data:\n'},{id:"dockerignore",name:".dockerignore",description:"Docker build context exclusions",defaultPath:".dockerignore",category:"infrastructure",content:"node_modules\nnpm-debug.log*\n.git\n.gitignore\n.env*\n!.env.example\ndist\nbuild\ncoverage\n.nyc_output\n*.test.*\n*.spec.*\n__tests__\ne2e\n.github\ndocs\nREADME.md\nCHANGELOG.md\n"},{id:"makefile",name:"Makefile",description:"Makefile with common dev/build/deploy targets",defaultPath:"Makefile",category:"infrastructure",content:".PHONY: help dev build test lint docker-up docker-down migrate clean\n\nhelp: ## Show this help\n @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | awk 'BEGIN {FS = \":.*?## \"}; {printf \"\\033[36m%-20s\\033[0m %s\\n\", $$1, $$2}'\n\ndev: ## Start development server\n npm run dev\n\nbuild: ## Build for production\n npm run build\n\ntest: ## Run all tests\n npm test\n\nlint: ## Run linter\n npm run lint\n\ndocker-up: ## Start Docker services\n docker compose up -d\n\ndocker-down: ## Stop Docker services\n docker compose down\n\nmigrate: ## Run database migrations\n npm run db:migrate\n\nclean: ## Remove build artifacts\n rm -rf dist build .next coverage node_modules/.cache\n"},{id:"env-example",name:".env.example",description:"Annotated environment variables template",defaultPath:".env.example",category:"infrastructure",content:"# App Config\nNODE_ENV=development\nPORT=3000\nAPP_URL=http://localhost:3000\nLOG_LEVEL=info\n\n# Database\nDATABASE_URL=postgresql://user:password@localhost:5432/{{PROJECT_NAME}}_dev\n\n# Auth\nJWT_SECRET=your-super-secret-jwt-key-change-in-production\nJWT_EXPIRES_IN=7d\nSESSION_SECRET=your-session-secret-change-in-production\n\n# External Services\n# STRIPE_SECRET_KEY=sk_test_...\n# SENDGRID_API_KEY=SG....\n# AWS_ACCESS_KEY_ID=\n# AWS_SECRET_ACCESS_KEY=\n# AWS_REGION=us-east-1\n# AWS_S3_BUCKET=\n\n# Observability\n# SENTRY_DSN=https://...@sentry.io/...\n# DATADOG_API_KEY=\n# NEW_RELIC_LICENSE_KEY=\n"},{id:"nginx-conf",name:"nginx.conf",description:"Nginx reverse proxy with gzip, security headers, rate limiting",defaultPath:"nginx/nginx.conf",category:"infrastructure",content:'events {\n worker_connections 1024;\n}\n\nhttp {\n gzip on;\n gzip_types text/plain text/css application/json application/javascript text/xml;\n gzip_min_length 1000;\n\n # Rate limiting\n limit_req_zone $binary_remote_addr zone=api:10m rate=10r/s;\n\n server {\n listen 80;\n server_name _;\n\n # Security headers\n add_header X-Frame-Options "SAMEORIGIN" always;\n add_header X-Content-Type-Options "nosniff" always;\n add_header X-XSS-Protection "1; mode=block" always;\n add_header Referrer-Policy "strict-origin-when-cross-origin" always;\n add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always;\n\n location /api/ {\n limit_req zone=api burst=20 nodelay;\n proxy_pass http://app:3000;\n proxy_http_version 1.1;\n proxy_set_header Upgrade $http_upgrade;\n proxy_set_header Connection \'upgrade\';\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n proxy_cache_bypass $http_upgrade;\n }\n\n location / {\n proxy_pass http://app:3000;\n proxy_http_version 1.1;\n proxy_set_header Host $host;\n proxy_set_header X-Real-IP $remote_addr;\n }\n }\n}\n'},{id:"ci-workflow",name:"CI Workflow",description:"GitHub Actions CI: lint, typecheck, test matrix, coverage",defaultPath:".github/workflows/ci.yml",category:"github-actions",content:"name: CI\non:\n push:\n branches: [main, develop]\n pull_request:\n branches: [main, develop]\n\njobs:\n lint:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with: {node-version: '20', cache: 'npm'}\n - run: npm ci\n - run: npm run lint\n - run: npm run typecheck\n\n test:\n runs-on: ubuntu-latest\n strategy:\n matrix:\n node-version: ['20', '22']\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with: {node-version: '${{ matrix.node-version }}', cache: 'npm'}\n - run: npm ci\n - run: npm run test:coverage\n - uses: codecov/codecov-action@v4\n if: matrix.node-version == '20'\n\n build:\n runs-on: ubuntu-latest\n needs: [lint, test]\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with: {node-version: '20', cache: 'npm'}\n - run: npm ci\n - run: npm run build\n"},{id:"cd-workflow",name:"CD Workflow",description:"GitHub Actions CD: deploy to production with health check",defaultPath:".github/workflows/cd.yml",category:"github-actions",content:"name: CD\non:\n push:\n branches: [main]\n\njobs:\n deploy:\n runs-on: ubuntu-latest\n # needs: [ci] # Uncomment if using a reusable CI workflow\n environment: production\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with: {node-version: '20', cache: 'npm'}\n - run: npm ci\n - run: npm run build\n - name: Deploy\n env:\n DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }}\n DEPLOY_URL: ${{ secrets.DEPLOY_URL }}\n run: |\n # Add your deployment command here\n # e.g.: npx railway deploy, vercel deploy --prod, etc.\n echo \"Deploy to production\"\n - name: Health check\n run: |\n sleep 30\n curl -f ${{ secrets.APP_URL }}/health || exit 1\n"},{id:"security-scan",name:"Security Scan",description:"GitHub Actions security: npm audit + CodeQL analysis",defaultPath:".github/workflows/security.yml",category:"github-actions",content:"name: Security\non:\n push:\n branches: [main]\n schedule:\n - cron: '0 0 * * 1' # Weekly on Monday\n\njobs:\n audit:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - uses: actions/setup-node@v4\n with: {node-version: '20', cache: 'npm'}\n - run: npm ci\n - run: npm audit --audit-level=high\n\n codeql:\n runs-on: ubuntu-latest\n permissions:\n actions: read\n contents: read\n security-events: write\n steps:\n - uses: actions/checkout@v4\n - uses: github/codeql-action/init@v3\n with: {languages: javascript}\n - uses: github/codeql-action/autobuild@v3\n - uses: github/codeql-action/analyze@v3\n"},{id:"dependabot-config",name:"Dependabot Config",description:"Dependabot config: npm + GitHub Actions weekly updates",defaultPath:".github/dependabot.yml",category:"github-actions",content:'version: 2\nupdates:\n - package-ecosystem: npm\n directory: "/"\n schedule:\n interval: weekly\n day: monday\n groups:\n minor-and-patch:\n update-types: ["minor", "patch"]\n ignore:\n - dependency-name: "*"\n update-types: ["version-update:semver-major"]\n\n - package-ecosystem: github-actions\n directory: "/"\n schedule:\n interval: weekly\n day: monday\n'},{id:"release-workflow",name:"Release Workflow",description:"GitHub Actions release: GitHub Release + Docker image to GHCR",defaultPath:".github/workflows/release.yml",category:"github-actions",content:"name: Release\non:\n push:\n tags: ['v*']\n\njobs:\n release:\n runs-on: ubuntu-latest\n permissions:\n contents: write\n packages: write\n steps:\n - uses: actions/checkout@v4\n - name: Create GitHub Release\n uses: softprops/action-gh-release@v2\n with:\n generate_release_notes: true\n - name: Log in to GHCR\n uses: docker/login-action@v3\n with:\n registry: ghcr.io\n username: ${{ github.actor }}\n password: ${{ secrets.GITHUB_TOKEN }}\n - name: Build and push Docker image\n uses: docker/build-push-action@v5\n with:\n context: .\n push: true\n tags: |\n ghcr.io/${{ github.repository }}:${{ github.ref_name }}\n ghcr.io/${{ github.repository }}:latest\n"},{id:"codeowners",name:"CODEOWNERS",description:"GitHub CODEOWNERS file for review assignments",defaultPath:".github/CODEOWNERS",category:"github",content:"# IMPORTANT: Replace {{PROJECT_NAME}} below with your GitHub organization name\n# (org name and project name are often different)\n# Format: @org-name/team-slug\n\n# Global owners - review all changes\n* @{{PROJECT_NAME}}/maintainers\n\n# Documentation\ndocs/ @{{PROJECT_NAME}}/docs\n*.md @{{PROJECT_NAME}}/docs\n\n# CI/CD config\n.github/ @{{PROJECT_NAME}}/devops\nDockerfile @{{PROJECT_NAME}}/devops\ndocker-compose*.yml @{{PROJECT_NAME}}/devops\n\n# Security-sensitive files\n**/auth/ @{{PROJECT_NAME}}/security\n**/security/ @{{PROJECT_NAME}}/security\nSECURITY.md @{{PROJECT_NAME}}/security\n"},{id:"eslintrc",name:"ESLint Config",description:"ESLint config with TypeScript strict rules",defaultPath:".eslintrc.json",category:"code-quality",content:'{\n "extends": [\n "eslint:recommended",\n "plugin:@typescript-eslint/recommended",\n "plugin:@typescript-eslint/recommended-requiring-type-checking"\n ],\n "parser": "@typescript-eslint/parser",\n "parserOptions": {\n "project": true,\n "tsconfigRootDir": "."\n },\n "plugins": ["@typescript-eslint"],\n "rules": {\n "no-console": "warn",\n "no-unused-vars": "off",\n "@typescript-eslint/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],\n "@typescript-eslint/no-explicit-any": "warn",\n "@typescript-eslint/consistent-type-imports": "error",\n "@typescript-eslint/no-floating-promises": "error"\n },\n "ignorePatterns": ["dist/", "build/", "node_modules/", "*.config.js"]\n}\n'},{id:"prettierrc",name:"Prettier Config",description:"Prettier formatting config",defaultPath:".prettierrc",category:"code-quality",content:'{\n "semi": false,\n "singleQuote": true,\n "trailingComma": "es5",\n "printWidth": 100,\n "tabWidth": 2,\n "useTabs": false,\n "bracketSpacing": true,\n "arrowParens": "avoid"\n}\n'},{id:"tsconfig-strict",name:"tsconfig (strict)",description:"TypeScript config with strict settings for Node/ESM",defaultPath:"tsconfig.json",category:"code-quality",content:'{\n "compilerOptions": {\n "target": "ES2022",\n "lib": ["ES2022"],\n "module": "NodeNext",\n "moduleResolution": "NodeNext",\n "outDir": "dist",\n "rootDir": "src",\n "strict": true,\n "noUncheckedIndexedAccess": true,\n "exactOptionalPropertyTypes": true,\n "noImplicitReturns": true,\n "noFallthroughCasesInSwitch": true,\n "noImplicitOverride": true,\n "esModuleInterop": true,\n "skipLibCheck": true,\n "forceConsistentCasingInFileNames": true,\n "paths": {\n "@/*": ["./src/*"]\n }\n },\n "include": ["src/**/*"],\n "exclude": ["node_modules", "dist"]\n}\n'},{id:"editorconfig",name:".editorconfig",description:"EditorConfig for consistent editor settings",defaultPath:".editorconfig",category:"code-quality",content:"root = true\n\n[*]\nindent_style = space\nindent_size = 2\nend_of_line = lf\ncharset = utf-8\ntrim_trailing_whitespace = true\ninsert_final_newline = true\n\n[*.md]\ntrim_trailing_whitespace = false\n\n[Makefile]\nindent_style = tab\n\n[*.{yml,yaml}]\nindent_size = 2\n"},{id:"lint-staged",name:"lint-staged Config",description:"lint-staged config for pre-commit formatting and linting",defaultPath:".lintstagedrc.json",category:"code-quality",content:'{\n "*.{ts,tsx}": ["eslint --fix", "prettier --write"],\n "*.{js,jsx}": ["eslint --fix", "prettier --write"],\n "*.{json,md,yml,yaml}": ["prettier --write"],\n "*.{css,scss}": ["prettier --write"]\n}\n'},{id:"commitlint",name:"commitlint Config",description:"commitlint config enforcing Conventional Commits",defaultPath:"commitlint.config.js",category:"code-quality",content:"module.exports = {\n extends: ['@commitlint/config-conventional'],\n rules: {\n 'type-enum': [2, 'always', [\n 'feat', 'fix', 'docs', 'style', 'refactor',\n 'perf', 'test', 'chore', 'revert', 'ci', 'build'\n ]],\n 'scope-case': [2, 'always', 'lower-case'],\n 'subject-case': [2, 'always', 'lower-case'],\n 'subject-max-length': [2, 'always', 100],\n 'body-max-line-length': [2, 'always', 200],\n },\n}\n"},{id:"husky-setup",name:"Husky Setup Doc",description:"Documentation for Husky git hooks setup",defaultPath:".husky/README.md",category:"code-quality",content:'# Husky Git Hooks\n\nThis project uses [Husky](https://typicode.github.io/husky/) to enforce code quality at commit time.\n\n## Setup\n\nAfter cloning and running `npm install`, Husky hooks are auto-installed via the `prepare` script.\n\nIf hooks aren\'t running, install manually:\n\n```\nnpx husky install\n```\n\n## Hooks\n\n| Hook | Command | Purpose |\n|------|---------|---------|\n| pre-commit | `lint-staged` | Lint and format staged files |\n| commit-msg | `commitlint` | Validate commit message format |\n| pre-push | `npm test` | Run tests before pushing |\n\n## Skip hooks (emergencies only)\n\n```\ngit commit --no-verify -m "emergency fix"\n```\n\nUse sparingly. CI will still catch failures.\n'},{id:"vscode-settings",name:"VS Code Settings",description:"VS Code workspace settings for the project",defaultPath:".vscode/settings.json",category:"code-quality",content:'{\n "editor.formatOnSave": true,\n "editor.defaultFormatter": "esbenp.prettier-vscode",\n "editor.codeActionsOnSave": {\n "source.fixAll.eslint": "explicit",\n "source.organizeImports": "explicit"\n },\n "typescript.preferences.importModuleSpecifier": "non-relative",\n "typescript.tsdk": "node_modules/typescript/lib",\n "files.eol": "\\n",\n "files.trimTrailingWhitespace": true,\n "files.insertFinalNewline": true,\n "[markdown]": {\n "editor.formatOnSave": false\n }\n}\n'},{id:"vscode-extensions",name:"VS Code Extensions",description:"Recommended VS Code extensions for the project",defaultPath:".vscode/extensions.json",category:"code-quality",content:'{\n "recommendations": [\n "esbenp.prettier-vscode",\n "dbaeumer.vscode-eslint",\n "ms-vscode.vscode-typescript-next",\n "bradlc.vscode-tailwindcss",\n "eamodio.gitlens",\n "usernamehw.errorlens",\n "streetsidesoftware.code-spell-checker",\n "github.copilot",\n "christian-kohler.path-intellisense"\n ]\n}\n'},{id:"health-check-doc",name:"Health Check Guide",description:"Health check endpoint documentation with Kubernetes config",defaultPath:"docs/health-checks.md",category:"monitoring",content:'# Health Checks — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Overview\n\nHealth check endpoints allow load balancers and orchestrators to verify service status.\n\n## Endpoints\n\n| Endpoint | Purpose | Auth required |\n|----------|---------|---------------|\n| `GET /health` | Liveness probe — is the process running? | No |\n| `GET /health/ready` | Readiness probe — can the service handle traffic? | No |\n| `GET /health/detailed` | Full dependency status | Yes (internal) |\n\n## Liveness Check (`GET /health`)\n\nReturns 200 if the process is alive, regardless of dependency status.\n\n```json\n{"status": "ok", "uptime": 1234}\n```\n\n## Readiness Check (`GET /health/ready`)\n\nReturns 200 only if all critical dependencies are healthy.\n\n```json\n{\n "status": "ready",\n "dependencies": {\n "database": "ok",\n "redis": "ok",\n "external_api": "degraded"\n }\n}\n```\n\nReturns 503 if any critical dependency is unhealthy.\n\n## Kubernetes Configuration\n\n```yaml\nlivenessProbe:\n httpGet:\n path: /health\n port: 3000\n initialDelaySeconds: 30\n periodSeconds: 10\nreadinessProbe:\n httpGet:\n path: /health/ready\n port: 3000\n initialDelaySeconds: 5\n periodSeconds: 5\n```\n'},{id:"slo-doc",name:"SLO/SLA Document",description:"Service Level Objectives with error budget and burn rate alerts",defaultPath:"docs/slo.md",category:"monitoring",content:"# Service Level Objectives — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n**Owner:** Platform Team\n\n## Availability SLO\n\n| Metric | Target | Error Budget (30 days) |\n|--------|--------|----------------------|\n| Availability | 99.9% | 43.8 minutes |\n| Success rate | 99.5% | — |\n\n## Latency SLO\n\n| Percentile | Target |\n|------------|--------|\n| p50 | < 100ms |\n| p95 | < 500ms |\n| p99 | < 1000ms |\n\n## Error Budget Policy\n\n| Burn Rate | Alert Window | Severity | Action |\n|-----------|-------------|----------|--------|\n| > 14.4x | 1 hour | Critical | Page on-call immediately |\n| > 6x | 6 hours | High | Page on-call |\n| > 3x | 24 hours | Medium | Ticket + monitor |\n| > 1x | 72 hours | Low | Review in standup |\n\n## Consequences of Exhausting Error Budget\n\n- Feature freeze until budget replenishes\n- Reliability sprint prioritized over new features\n- Post-mortem required for any budget burn > 50%\n\n## Measurement\n\n- Uptime tracked via synthetic monitoring (Pingdom / UptimeRobot)\n- Latency tracked via APM (Datadog / New Relic)\n- Error rate from application logs + Sentry\n"},{id:"incident-runbook",name:"Incident Runbook",description:"Incident response runbook with severity levels and escalation",defaultPath:"docs/incident-runbook.md",category:"monitoring",content:"# Incident Runbook — {{PROJECT_NAME}}\n\n**Last updated:** {{DATE}}\n\n## Severity Levels\n\n| Severity | Definition | Response Time | Example |\n|----------|-----------|---------------|---------|\n| P0 | Complete outage, all users affected | 15 minutes | Site down |\n| P1 | Major feature broken, >50% users affected | 30 minutes | Login broken |\n| P2 | Significant degradation, subset of users | 2 hours | Slow API |\n| P3 | Minor issue, workaround available | Next business day | Cosmetic bug |\n\n## Roles\n\n| Role | Responsibility |\n|------|---------------|\n| Incident Commander (IC) | Owns resolution, coordinates team, communicates status |\n| Tech Lead | Diagnoses root cause, coordinates fixes |\n| Comms Lead | Updates status page, notifies stakeholders |\n\n## Response Process\n\n### 0–15 minutes (Detect & Triage)\n1. Confirm the incident (not a false alarm)\n2. Assign Incident Commander\n3. Create incident Slack channel: `#incident-YYYYMMDD-description`\n4. Set severity level\n5. Start incident timeline document\n\n### 15–60 minutes (Investigate)\n1. Identify scope: what's broken, who's affected\n2. Check recent deployments (`git log`, deployment history)\n3. Review error rates and logs\n4. Consider rollback if recent deploy is suspected\n\n### Mitigation\n1. Apply fix or rollback\n2. Monitor for improvement\n3. Update status page\n4. Notify stakeholders\n\n## Post-Incident Checklist\n\n- [ ] Incident resolved and verified\n- [ ] Status page updated to \"resolved\"\n- [ ] Stakeholders notified\n- [ ] Timeline documented\n- [ ] Post-mortem scheduled (P0/P1) or ticket created (P2)\n- [ ] Action items created in project tracker\n"},{id:"postmortem",name:"Postmortem Template",description:"Blameless postmortem template with five-whys and action items",defaultPath:"docs/postmortem-template.md",category:"monitoring",content:"# Postmortem: [Title]\n\n**Date:** {{DATE}}\n**Severity:** P[0-3]\n**Duration:**\n**Author:**\n**Reviewers:**\n\n> This postmortem follows a blameless culture. We focus on systems and processes, not individuals.\n\n## Summary\n\n<!-- 2-3 sentence summary: what happened, why it matters, what we're doing about it -->\n\n## Impact\n\n- **Users affected:**\n- **Duration:**\n- **Revenue impact:**\n- **Data loss:**\n\n## Timeline\n\n| Time (UTC) | Event |\n|------------|-------|\n| 00:00 | Monitoring alert fired |\n| 00:05 | On-call engineer paged |\n| 00:15 | Incident confirmed, IC assigned |\n| 00:30 | Root cause identified |\n| 01:00 | Fix deployed |\n| 01:15 | Incident resolved |\n\n## Root Cause Analysis (Five Whys)\n\n**Problem:** [Describe the issue]\n\n1. **Why?** [First cause]\n2. **Why?** [Second cause]\n3. **Why?** [Third cause]\n4. **Why?** [Fourth cause]\n5. **Why?** [Root cause]\n\n## What Went Well\n\n-\n-\n\n## What Could Have Gone Better\n\n-\n-\n\n## Action Items\n\n| Action | Owner | Due Date | Priority |\n|--------|-------|----------|----------|\n| | | | P[0-3] |\n\n## Lessons Learned\n\n<!-- Key takeaways to share with the wider team -->\n"}]},52284:function(n,e,t){t.d(e,{cn:function(){return s}});var i=t(27494),o=t(724);function s(){for(var n=arguments.length,e=Array(n),t=0;t<n;t++)e[t]=arguments[t];return(0,o.m6)((0,i.W)(e))}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6441],{39854:function(e,t,a){a.d(t,{t:function(){return m}});var s=a(59533),r=a(31229),n=a(21263),l=a(66611),d=a(52284),o=a(72374),i=a(220),c=a(13191),f=a(8637),u=a(61193);function m(e){let{open:t,onOpenChange:a,rootParam:m,onDocCreated:x}=e,[p,h]=(0,r.useState)(1),[b,g]=(0,r.useState)(null),[v,N]=(0,r.useState)(""),[k,y]=(0,r.useState)(""),[j,w]=(0,r.useState)(!1);async function z(){if(b&&v.trim()){y(""),w(!0);try{let e=await fetch("/api/docs".concat(m),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:v.trim(),content:b.content})});if(409===e.status){y("File already exists"),w(!1);return}if(!e.ok){let t=await e.json();y(t.error||"Failed to create file"),w(!1);return}a(!1),x(v.trim())}catch(e){y("Network error"),w(!1)}}}return(0,r.useEffect)(()=>{t&&(h(1),g(null),N(""),y(""),w(!1))},[t]),(0,s.jsx)(o.Vq,{open:t,onOpenChange:a,children:(0,s.jsxs)(o.cZ,{className:"max-w-2xl bg-surface border-border",children:[(0,s.jsx)(o.fK,{children:(0,s.jsx)(o.$N,{className:"text-txt text-sm font-semibold",children:1===p?"Choose a template":"Confirm file path"})}),1===p&&(0,s.jsx)(f.x,{className:"max-h-[420px]",children:(0,s.jsx)("div",{className:"grid grid-cols-3 gap-2 p-1",children:u.x.map(e=>(0,s.jsxs)("button",{onClick:()=>{g(e),N(e.defaultPath),y(""),h(2)},className:(0,d.cn)("flex flex-col items-start gap-1.5 p-3 rounded-lg border border-border text-left","bg-surface2 hover:bg-surface2/80 hover:border-accent/50 transition-colors"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(n.Z,{className:"h-3.5 w-3.5 text-accent shrink-0"}),(0,s.jsx)("span",{className:"text-xs font-medium text-txt",children:e.name})]}),(0,s.jsx)("p",{className:"text-[11px] text-muted leading-relaxed",children:e.description}),(0,s.jsx)("p",{className:"text-[10px] text-muted/60 font-mono truncate w-full",children:e.defaultPath})]},e.id))})}),2===p&&b&&(0,s.jsxs)("div",{className:"space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-start gap-3 p-3 rounded-lg bg-surface2 border border-border",children:[(0,s.jsx)(n.Z,{className:"h-4 w-4 text-accent shrink-0 mt-0.5"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs font-medium text-txt",children:b.name}),(0,s.jsx)("p",{className:"text-[11px] text-muted mt-0.5",children:b.description})]})]}),(0,s.jsxs)("div",{className:"space-y-1.5",children:[(0,s.jsx)("label",{className:"text-[11px] font-medium text-muted uppercase tracking-wider",children:"File path"}),(0,s.jsx)(c.I,{autoFocus:!0,value:v,onChange:e=>{N(e.target.value),y("")},onKeyDown:e=>{"Enter"===e.key&&z()},placeholder:"docs/my-document.md",className:"h-8 text-xs bg-surface2 border-border font-mono"}),k&&(0,s.jsx)("p",{className:"text-[11px] text-red-400",children:k})]}),(0,s.jsxs)("div",{className:"flex items-center justify-between pt-1",children:[(0,s.jsxs)(i.z,{variant:"ghost",size:"sm",onClick:()=>h(1),className:"h-7 text-xs text-muted hover:text-txt gap-1.5",children:[(0,s.jsx)(l.Z,{className:"h-3 w-3"}),"Back"]}),(0,s.jsx)(i.z,{size:"sm",onClick:z,disabled:j||!v.trim(),className:"h-7 text-xs bg-accent hover:bg-accent/90 text-white",children:j?"Creating…":"Create"})]})]})]})})}},71301:function(e,t,a){a.d(t,{C:function(){return d}});var s=a(59533);a(31229);var r=a(95084),n=a(52284);let l=(0,r.j)("inline-flex items-center rounded-full border border-slate-200 px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-slate-950 focus:ring-offset-2 dark:border-slate-800 dark:focus:ring-slate-300",{variants:{variant:{default:"border-transparent bg-slate-900 text-slate-50 hover:bg-slate-900/80 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50/80",secondary:"border-transparent bg-slate-100 text-slate-900 hover:bg-slate-100/80 dark:bg-slate-800 dark:text-slate-50 dark:hover:bg-slate-800/80",destructive:"border-transparent bg-red-500 text-slate-50 hover:bg-red-500/80 dark:bg-red-900 dark:text-slate-50 dark:hover:bg-red-900/80",outline:"text-slate-950 dark:text-slate-50"}},defaultVariants:{variant:"default"}});function d(e){let{className:t,variant:a,...r}=e;return(0,s.jsx)("div",{className:(0,n.cn)(l({variant:a}),t),...r})}},220:function(e,t,a){a.d(t,{z:function(){return i}});var s=a(59533),r=a(31229),n=a(38777),l=a(95084),d=a(52284);let o=(0,l.j)("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium ring-offset-white transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300",{variants:{variant:{default:"bg-slate-900 text-slate-50 hover:bg-slate-900/90 dark:bg-slate-50 dark:text-slate-900 dark:hover:bg-slate-50/90",destructive:"bg-red-500 text-slate-50 hover:bg-red-500/90 dark:bg-red-900 dark:text-slate-50 dark:hover:bg-red-900/90",outline:"border border-slate-200 bg-white hover:bg-slate-100 hover:text-slate-900 dark:border-slate-800 dark:bg-slate-950 dark:hover:bg-slate-800 dark:hover:text-slate-50",secondary:"bg-slate-100 text-slate-900 hover:bg-slate-100/80 dark:bg-slate-800 dark:text-slate-50 dark:hover:bg-slate-800/80",ghost:"hover:bg-slate-100 hover:text-slate-900 dark:hover:bg-slate-800 dark:hover:text-slate-50",link:"text-slate-900 underline-offset-4 hover:underline dark:text-slate-50"},size:{default:"h-10 px-4 py-2",sm:"h-9 rounded-md px-3",lg:"h-11 rounded-md px-8",icon:"h-10 w-10"}},defaultVariants:{variant:"default",size:"default"}}),i=r.forwardRef((e,t)=>{let{className:a,variant:r,size:l,asChild:i=!1,...c}=e,f=i?n.g7:"button";return(0,s.jsx)(f,{className:(0,d.cn)(o({variant:r,size:l,className:a})),ref:t,...c})});i.displayName="Button"},72374:function(e,t,a){a.d(t,{$N:function(){return m},Vq:function(){return o},cZ:function(){return f},fK:function(){return u}});var s=a(59533),r=a(31229),n=a(68778),l=a(46850),d=a(52284);let o=n.fC;n.xz;let i=n.h_;n.x8;let c=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.aV,{ref:t,className:(0,d.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",a),...r})});c.displayName=n.aV.displayName;let f=r.forwardRef((e,t)=>{let{className:a,children:r,...o}=e;return(0,s.jsxs)(i,{children:[(0,s.jsx)(c,{}),(0,s.jsxs)(n.VY,{ref:t,className:(0,d.cn)("fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border border-slate-200 bg-white p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg dark:border-slate-800 dark:bg-slate-950",a),...o,children:[r,(0,s.jsxs)(n.x8,{className:"absolute right-4 top-4 rounded-sm opacity-70 ring-offset-white transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-slate-950 focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-slate-100 data-[state=open]:text-slate-500 dark:ring-offset-slate-950 dark:focus:ring-slate-300 dark:data-[state=open]:bg-slate-800 dark:data-[state=open]:text-slate-400",children:[(0,s.jsx)(l.Z,{className:"h-4 w-4"}),(0,s.jsx)("span",{className:"sr-only",children:"Close"})]})]})]})});f.displayName=n.VY.displayName;let u=e=>{let{className:t,...a}=e;return(0,s.jsx)("div",{className:(0,d.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};u.displayName="DialogHeader";let m=r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.Dx,{ref:t,className:(0,d.cn)("text-lg font-semibold leading-none tracking-tight",a),...r})});m.displayName=n.Dx.displayName,r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.dk,{ref:t,className:(0,d.cn)("text-sm text-slate-500 dark:text-slate-400",a),...r})}).displayName=n.dk.displayName},83373:function(e,t,a){a.d(t,{$F:function(){return f},AW:function(){return u},Xi:function(){return m},h_:function(){return c}});var s=a(59533),r=a(31229),n=a(9140),l=a(12794),d=a(20508),o=a(34457),i=a(52284);let c=n.fC,f=n.xz;n.ZA,n.Uv,n.Tr,n.Ee,r.forwardRef((e,t)=>{let{className:a,inset:r,children:d,...o}=e;return(0,s.jsxs)(n.fF,{ref:t,className:(0,i.cn)("flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none focus:bg-slate-100 data-[state=open]:bg-slate-100 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 dark:focus:bg-slate-800 dark:data-[state=open]:bg-slate-800",r&&"pl-8",a),...o,children:[d,(0,s.jsx)(l.Z,{className:"ml-auto"})]})}).displayName=n.fF.displayName,r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.tu,{ref:t,className:(0,i.cn)("z-50 min-w-[8rem] overflow-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-lg data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin] dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",a),...r})}).displayName=n.tu.displayName;let u=r.forwardRef((e,t)=>{let{className:a,sideOffset:r=4,...l}=e;return(0,s.jsx)(n.Uv,{children:(0,s.jsx)(n.VY,{ref:t,sideOffset:r,className:(0,i.cn)("z-50 max-h-[var(--radix-dropdown-menu-content-available-height)] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border border-slate-200 bg-white p-1 text-slate-950 shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-dropdown-menu-content-transform-origin] dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",a),...l})})});u.displayName=n.VY.displayName;let m=r.forwardRef((e,t)=>{let{className:a,inset:r,...l}=e;return(0,s.jsx)(n.ck,{ref:t,className:(0,i.cn)("relative flex cursor-default select-none items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 dark:focus:bg-slate-800 dark:focus:text-slate-50",r&&"pl-8",a),...l})});m.displayName=n.ck.displayName,r.forwardRef((e,t)=>{let{className:a,children:r,checked:l,...o}=e;return(0,s.jsxs)(n.oC,{ref:t,className:(0,i.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",a),checked:l,...o,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(d.Z,{className:"h-4 w-4"})})}),r]})}).displayName=n.oC.displayName,r.forwardRef((e,t)=>{let{className:a,children:r,...l}=e;return(0,s.jsxs)(n.Rk,{ref:t,className:(0,i.cn)("relative flex cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none transition-colors focus:bg-slate-100 focus:text-slate-900 data-[disabled]:pointer-events-none data-[disabled]:opacity-50 dark:focus:bg-slate-800 dark:focus:text-slate-50",a),...l,children:[(0,s.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,s.jsx)(n.wU,{children:(0,s.jsx)(o.Z,{className:"h-2 w-2 fill-current"})})}),r]})}).displayName=n.Rk.displayName,r.forwardRef((e,t)=>{let{className:a,inset:r,...l}=e;return(0,s.jsx)(n.__,{ref:t,className:(0,i.cn)("px-2 py-1.5 text-sm font-semibold",r&&"pl-8",a),...l})}).displayName=n.__.displayName,r.forwardRef((e,t)=>{let{className:a,...r}=e;return(0,s.jsx)(n.Z0,{ref:t,className:(0,i.cn)("-mx-1 my-1 h-px bg-slate-100 dark:bg-slate-800",a),...r})}).displayName=n.Z0.displayName},8637:function(e,t,a){a.d(t,{x:function(){return d}});var s=a(59533),r=a(31229),n=a(19006),l=a(52284);let d=r.forwardRef((e,t)=>{let{className:a,children:r,...d}=e;return(0,s.jsxs)(n.fC,{ref:t,className:(0,l.cn)("relative overflow-hidden",a),...d,children:[(0,s.jsx)(n.l_,{className:"h-full w-full rounded-[inherit]",children:r}),(0,s.jsx)(o,{}),(0,s.jsx)(n.Ns,{})]})});d.displayName=n.fC.displayName;let o=r.forwardRef((e,t)=>{let{className:a,orientation:r="vertical",...d}=e;return(0,s.jsx)(n.gb,{ref:t,orientation:r,className:(0,l.cn)("flex touch-none select-none transition-colors","vertical"===r&&"h-full w-2.5 border-l border-l-transparent p-[1px]","horizontal"===r&&"h-2.5 flex-col border-t border-t-transparent p-[1px]",a),...d,children:(0,s.jsx)(n.q4,{className:"relative flex-1 rounded-full bg-slate-200 dark:bg-slate-800"})})});o.displayName=n.gb.displayName},12301:function(e,t,a){a.d(t,{Z:function(){return d}});var s=a(59533),r=a(31229),n=a(513),l=a(52284);let d=r.forwardRef((e,t)=>{let{className:a,orientation:r="horizontal",decorative:d=!0,...o}=e;return(0,s.jsx)(n.f,{ref:t,decorative:d,orientation:r,className:(0,l.cn)("shrink-0 bg-slate-200 dark:bg-slate-800","horizontal"===r?"h-[1px] w-full":"h-full w-[1px]",a),...o})});d.displayName=n.f.displayName},17477:function(e,t,a){a.d(t,{_v:function(){return c},aJ:function(){return i},pn:function(){return d},u:function(){return o}});var s=a(59533),r=a(31229),n=a(9332),l=a(52284);let d=n.zt,o=n.fC,i=n.xz,c=r.forwardRef((e,t)=>{let{className:a,sideOffset:r=4,...d}=e;return(0,s.jsx)(n.VY,{ref:t,sideOffset:r,className:(0,l.cn)("z-50 overflow-hidden rounded-md border border-slate-200 bg-white px-3 py-1.5 text-sm text-slate-950 shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-tooltip-content-transform-origin] dark:border-slate-800 dark:bg-slate-950 dark:text-slate-50",a),...d})});c.displayName=n.VY.displayName}}]);
|
package/.next/static/chunks/app/(app)/docs/{page-17670ed46c3594e6.js → page-f5615cefbd3d1c64.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3015],{69827:function(e,t,n){Promise.resolve().then(n.bind(n,3526))},3526:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ep}});var a=n(59533),s=n(31229),c=n(11180),l=n(21263),r=n(20508),o=n(86725),i=n(92560),d=n(39098),u=n(12794),h=n(25612),x=n(80261),m=n(35710),p=n(48354),f=n(76877),v=n(56622),j=n(46850),g=n(30445),b=n(52284),w=n(13191),N=n(8637),y=n(1815);let k=y.fC,C=y.wy,S=y.Fw;var P=n(83373);let Z=(0,s.createContext)({active:!1,selected:new Set,toggle:()=>{},onRename:()=>{},onDelete:()=>{},renamingPath:null,setRenamingPath:()=>{}});function D(e){return e.replace(/\\/g,"/")}function E(e){return e.replace(/^\d+-/,"").replace(/[-_]/g," ").toLowerCase().replace(/\b\w/g,e=>e.toUpperCase())}function T(e){let{node:t,depth:n,selectedPath:c,onDocClick:m,folderPath:p}=e,{active:f,selected:v,toggle:j,onRename:g,onDelete:N,renamingPath:y,setRenamingPath:D}=(0,s.useContext)(Z),[L,R]=(0,s.useState)(t.name),U=!!t.docPath,A=t.docPath===c,O=!!t.docPath&&v.has(t.docPath),z=t.docPath===y,_=12*n;return U?z?(0,a.jsxs)("div",{style:{paddingLeft:"".concat(8+_,"px")},className:"flex items-center gap-2 h-7 pr-2",children:[(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"}),(0,a.jsx)(w.I,{autoFocus:!0,value:L,onChange:e=>R(e.target.value),onKeyDown:e=>{if("Enter"===e.key){let e=L.trim();if(e&&e!==t.name){let n=t.docPath.split("/").slice(0,-1).join("/");g(n?"".concat(n,"/").concat(e,".md"):"".concat(e,".md"))}D(null)}else"Escape"===e.key&&(R(t.name),D(null))},onBlur:()=>{R(t.name),D(null)},className:"h-5 text-xs px-1 py-0"})]}):(0,a.jsxs)("div",{className:(0,b.cn)("group w-full flex items-center gap-2 h-7 pr-1 rounded-md text-xs transition-colors",A&&!f?"bg-accent/10 text-accent font-medium":O?"bg-accent/10 text-accent":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsxs)("button",{onClick:()=>f?j(t.docPath):m(t.docPath),style:{paddingLeft:"".concat(8+_,"px")},className:"flex-1 flex items-center gap-2 h-full truncate",children:[f?(0,a.jsx)("span",{className:(0,b.cn)("h-3.5 w-3.5 shrink-0 rounded border flex items-center justify-center transition-colors",O?"border-accent bg-accent/20":"border-border"),children:O&&(0,a.jsx)(r.Z,{className:"h-2.5 w-2.5 text-accent"})}):(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"}),(0,a.jsx)("span",{className:"truncate",children:E(t.name)})]}),!f&&(0,a.jsxs)(P.h_,{children:[(0,a.jsx)(P.$F,{asChild:!0,children:(0,a.jsx)("button",{className:"h-5 w-5 shrink-0 flex items-center justify-center rounded opacity-0 group-hover:opacity-100 hover:bg-surface2 transition-opacity",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(o.Z,{className:"h-3.5 w-3.5"})})}),(0,a.jsxs)(P.AW,{align:"end",className:"w-32",children:[(0,a.jsxs)(P.Xi,{onClick:()=>{R(t.name.replace(/\.md$/,"")),D(t.docPath)},children:[(0,a.jsx)(i.Z,{className:"h-3.5 w-3.5 mr-2"})," Rename"]}),(0,a.jsxs)(P.Xi,{onClick:()=>N(t.docPath),className:"text-red-400 focus:text-red-400",children:[(0,a.jsx)(d.Z,{className:"h-3.5 w-3.5 mr-2"})," Delete"]})]})]})]}):(0,a.jsxs)(k,{defaultOpen:!0,className:"group/folder",children:[(0,a.jsx)(C,{asChild:!0,children:(0,a.jsxs)("button",{style:{paddingLeft:"".concat(8+_,"px")},className:"w-full flex items-center gap-2 h-7 pr-2 rounded-md text-xs font-medium text-muted hover:text-txt hover:bg-surface2 transition-colors",children:[(0,a.jsx)(u.Z,{className:"h-3 w-3 shrink-0 transition-transform duration-200 group-data-[state=open]/folder:rotate-90"}),(0,a.jsx)(h.Z,{className:"h-3.5 w-3.5 shrink-0 text-accent/70 group-data-[state=open]/folder:hidden"}),(0,a.jsx)(x.Z,{className:"h-3.5 w-3.5 shrink-0 text-accent/70 hidden group-data-[state=open]/folder:block"}),(0,a.jsx)("span",{className:"truncate",children:E(t.name)})]})}),(0,a.jsx)(S,{className:"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",children:t.children.map(e=>{var t;return(0,a.jsx)(T,{node:e,depth:n+1,selectedPath:c,onDocClick:m,folderPath:"".concat(p,"/").concat(e.name)},null!==(t=e.docPath)&&void 0!==t?t:e.name)})})]})}function L(e){let{docs:t,selectedDocPath:n,searchValue:c,onSearchChange:o,onDocClick:i,onNewDocClick:d,onDocDeleted:u,onDocRenamed:h,rootParam:x=""}=e,[y,k]=(0,s.useState)(!1),[C,S]=(0,s.useState)(new Set),[P,L]=(0,s.useState)("idle"),[R,U]=(0,s.useState)(null),[A,O]=(0,s.useState)(null),z=(0,s.useMemo)(()=>t.filter(e=>{let t=D(e.path);return"CLAUDE.md"===t||"AGENTS.md"===t||t.endsWith("/CLAUDE.md")||t.endsWith("/AGENTS.md")}),[t]),_=(0,s.useMemo)(()=>t.filter(e=>{let t=D(e.path);return"CLAUDE.md"!==t&&"AGENTS.md"!==t&&!t.endsWith("/CLAUDE.md")&&!t.endsWith("/AGENTS.md")}),[t]),I=(0,s.useMemo)(()=>(function(e){let t={name:"",children:[]};for(let n of e){let e=D(n.path).split("/"),a=t;for(let t=0;t<e.length-1;t++){let n=a.children.find(n=>n.name===e[t]&&!n.docPath);n||(n={name:e[t],children:[]},a.children.push(n)),a=n}a.children.push({name:n.name,docPath:n.path,children:[]})}return t.children})(_),[_]),M=c.trim().length>0;function V(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function F(){k(!1),S(new Set),L("idle")}async function H(e){if(R&&h){try{(await fetch("/api/docs".concat(x),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:R,newPath:e})})).ok&&h(R,e)}catch(e){}U(null)}}async function W(e){if(u&&window.confirm("Delete ".concat(e,"?")))try{(await fetch("/api/docs".concat(x),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})).ok&&u(e)}catch(e){}}async function B(){if(0!==C.size){L("copying");try{let e=await fetch("/api/context".concat(x),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:[...C]})}),{context:t}=await e.json();await navigator.clipboard.writeText(t),L("copied"),setTimeout(()=>L("idle"),2e3)}catch(e){L("idle")}}}return(0,a.jsx)(Z.Provider,{value:{active:y,selected:C,toggle:V,onRename:H,onDelete:W,renamingPath:R,setRenamingPath:U},children:(0,a.jsxs)("aside",{className:"w-56 flex flex-col border-r border-border flex-shrink-0 bg-sidebar",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Docs"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>{y?F():k(!0)},className:(0,b.cn)("h-5 w-5 flex items-center justify-center rounded transition-colors",y?"bg-accent/20 text-accent":"hover:bg-surface2 text-muted hover:text-accent"),title:"Select docs",children:(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5"})}),d&&(0,a.jsx)("button",{onClick:d,className:"h-5 w-5 flex items-center justify-center rounded hover:bg-surface2 text-muted hover:text-accent transition-colors",title:"New document",children:(0,a.jsx)(p.Z,{className:"h-3.5 w-3.5"})})]})]}),!y&&(0,a.jsx)("div",{className:"p-2 border-b border-border",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(f.Z,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted pointer-events-none"}),(0,a.jsx)(w.I,{id:"doc-search",value:c,onChange:e=>o(e.target.value),placeholder:"Search docs...",className:"pl-7 h-8 text-xs bg-surface2 border-transparent focus:border-border"})]})}),(0,a.jsx)(N.x,{className:"flex-1",children:(0,a.jsx)("div",{className:"p-1.5 space-y-0.5",children:y?t.map(e=>{let t=C.has(e.path);return(0,a.jsxs)("button",{onClick:()=>V(e.path),className:(0,b.cn)("w-full flex items-center gap-2 h-7 px-2 rounded-md text-xs transition-colors",t?"bg-accent/10 text-accent":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsx)("span",{className:(0,b.cn)("h-3.5 w-3.5 shrink-0 rounded border flex items-center justify-center transition-colors",t?"border-accent bg-accent/20":"border-border"),children:t&&(0,a.jsx)(r.Z,{className:"h-2.5 w-2.5 text-accent"})}),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:e.name}),(0,a.jsx)("span",{className:"text-[10px] opacity-40 truncate max-w-[60px]",children:D(e.path).split("/").slice(0,-1).join("/")||"root"})]},e.path)}):(0,a.jsxs)(a.Fragment,{children:[!M&&z.length>0&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[(0,a.jsx)(v.Z,{className:"h-3.5 w-3.5 text-amber-400 shrink-0"}),(0,a.jsx)("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Agent Config"}),(0,a.jsx)("span",{className:"ml-auto text-[9px] font-medium bg-amber-400/15 text-amber-400 px-1.5 py-0.5 rounded-full",children:"AI"})]}),z.map(e=>(0,a.jsxs)("button",{onClick:()=>i(e.path),className:(0,b.cn)("w-full flex items-center gap-2 h-7 px-2 rounded-md text-xs transition-colors",e.path===n?"bg-accent/10 text-accent font-medium":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]},e.path)),(0,a.jsx)("div",{className:"mt-2 border-t border-border"})]}),M?0===t.length?(0,a.jsx)("p",{className:"text-xs text-muted px-2 py-4 text-center",children:"No results"}):t.map(e=>(0,a.jsxs)("button",{onClick:()=>i(e.path),className:(0,b.cn)("w-full flex flex-col items-start gap-0.5 px-2 py-1.5 rounded-md text-xs transition-colors text-left",e.path===n?"bg-accent/10 text-accent":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsx)("span",{className:"font-medium truncate w-full",children:E(e.name)}),(0,a.jsx)("span",{className:"text-[10px] opacity-50 truncate w-full",children:D(e.path).split("/").slice(0,-1).join("/")})]},e.path)):I.map(e=>{var t;return(0,a.jsx)(T,{node:e,depth:0,selectedPath:n,onDocClick:i,folderPath:e.name},null!==(t=e.docPath)&&void 0!==t?t:e.name)})]})})}),y&&(0,a.jsxs)("div",{className:"border-t border-border p-2 space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-[11px] text-muted",children:[(0,a.jsxs)("span",{children:[C.size," selected"]}),(0,a.jsxs)("button",{onClick:F,className:"hover:text-txt transition-colors flex items-center gap-1",children:[(0,a.jsx)(j.Z,{className:"h-3 w-3"})," Clear"]})]}),(0,a.jsx)("button",{onClick:B,disabled:0===C.size||"copying"===P,className:(0,b.cn)("w-full flex items-center justify-center gap-1.5 h-7 rounded-md text-xs font-medium transition-colors","copied"===P?"bg-green-500/20 text-green-400":0===C.size?"bg-surface2 text-muted cursor-not-allowed":"bg-accent/20 text-accent hover:bg-accent/30"),children:"copied"===P?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{className:"h-3 w-3"})," Copied!"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{className:"h-3 w-3"})," Copy Context"]})})]})]})})}var R=n(8892),U=n(42008),A=n(89333),O=n(71301),z=n(220),_=n(60893);let I=_.fC,M=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)(_.aV,{ref:t,className:(0,b.cn)("inline-flex h-10 items-center justify-center rounded-md bg-slate-100 p-1 text-slate-500 dark:bg-slate-800 dark:text-slate-400",n),...s})});M.displayName=_.aV.displayName;let V=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)(_.xz,{ref:t,className:(0,b.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-slate-950 data-[state=active]:shadow-sm dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300 dark:data-[state=active]:bg-slate-950 dark:data-[state=active]:text-slate-50",n),...s})});V.displayName=_.xz.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)(_.VY,{ref:t,className:(0,b.cn)("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300",n),...s})}).displayName=_.VY.displayName;var F=n(17477),H=n(46366),W=n(58797),B=n(95371),J=n(92231),q=n(82772),$=n(60031),G=n(75255),K=n(25902),X=n(27881),Y=n(42921),Q=n(47953),ee=n(73473),et=n(69195),en=n(12301);function ea(e,t,n){let{from:a,to:s}=e.state.selection.main,c=e.state.sliceDoc(a,s);e.dispatch({changes:{from:a,to:s,insert:t+c+n},selection:{anchor:a+t.length,head:a+t.length+c.length}}),e.focus()}function es(e,t){let{from:n}=e.state.selection.main,a=e.state.doc.lineAt(n);e.dispatch({changes:{from:a.from,to:a.from,insert:t},selection:{anchor:n+t.length}}),e.focus()}function ec(e){let{icon:t,label:n,onClick:s}=e;return(0,a.jsxs)(F.u,{children:[(0,a.jsx)(F.aJ,{asChild:!0,children:(0,a.jsx)(z.z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,children:t})}),(0,a.jsx)(F._v,{side:"bottom",children:n})]})}function el(e){let{editorView:t}=e;return(0,a.jsx)(F.pn,{delayDuration:300,children:(0,a.jsxs)("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border bg-surface flex-shrink-0",children:[(0,a.jsx)(ec,{icon:(0,a.jsx)(H.Z,{className:"h-3.5 w-3.5"}),label:"Bold",onClick:function(){t&&ea(t,"**","**")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(W.Z,{className:"h-3.5 w-3.5"}),label:"Italic",onClick:function(){t&&ea(t,"*","*")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(B.Z,{className:"h-3.5 w-3.5"}),label:"Strikethrough",onClick:function(){t&&ea(t,"~~","~~")}}),(0,a.jsx)(en.Z,{orientation:"vertical",className:"h-4 mx-1"}),(0,a.jsx)(ec,{icon:(0,a.jsx)(J.Z,{className:"h-3.5 w-3.5"}),label:"Heading 1",onClick:function(){t&&es(t,"# ")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(q.Z,{className:"h-3.5 w-3.5"}),label:"Heading 2",onClick:function(){t&&es(t,"## ")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)($.Z,{className:"h-3.5 w-3.5"}),label:"Heading 3",onClick:function(){t&&es(t,"### ")}}),(0,a.jsx)(en.Z,{orientation:"vertical",className:"h-4 mx-1"}),(0,a.jsx)(ec,{icon:(0,a.jsx)(G.Z,{className:"h-3.5 w-3.5"}),label:"Link",onClick:function(){if(!t)return;let{from:e,to:n}=t.state.selection.main,a=t.state.sliceDoc(e,n)||"link text";t.dispatch({changes:{from:e,to:n,insert:"[".concat(a,"](url)")},selection:{anchor:e+a.length+3,head:e+a.length+3+3}}),t.focus()}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(K.Z,{className:"h-3.5 w-3.5"}),label:"Inline code",onClick:function(){t&&ea(t,"`","`")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(X.Z,{className:"h-3.5 w-3.5"}),label:"Code block",onClick:function(){t&&ea(t,"```\n","\n```")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(Y.Z,{className:"h-3.5 w-3.5"}),label:"Blockquote",onClick:function(){t&&es(t,"> ")}}),(0,a.jsx)(en.Z,{orientation:"vertical",className:"h-4 mx-1"}),(0,a.jsx)(ec,{icon:(0,a.jsx)(Q.Z,{className:"h-3.5 w-3.5"}),label:"Horizontal rule",onClick:function(){t&&function(e,t){let{from:n,to:a}=e.state.selection.main;e.dispatch({changes:{from:n,to:a,insert:t},selection:{anchor:n+t.length}}),e.focus()}(t,"\n---\n")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(ee.Z,{className:"h-3.5 w-3.5"}),label:"Unordered list",onClick:function(){t&&es(t,"- ")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(et.Z,{className:"h-3.5 w-3.5"}),label:"Ordered list",onClick:function(){t&&es(t,"1. ")}})]})})}var er=n(5763),eo=n(44492);function ei(e){var t,c;let{docPath:l,initialContent:o,onSave:i,onDirtyChange:d,onContentChange:u}=e,h=(0,s.useRef)(null),[x,m]=(0,s.useState)("split"),[p,f]=(0,s.useState)(o),[v,j]=(0,s.useState)("saved"),[g,b]=(0,s.useState)(1),[w,N]=(0,s.useState)([]),[y,k]=(0,s.useState)([]),[C,S]=(0,s.useState)(!1),P=(0,s.useRef)(void 0),Z=(0,s.useRef)(void 0),D=(0,s.useRef)(o);(0,s.useEffect)(()=>{D.current=p},[p]),(0,s.useEffect)(()=>{f(o),D.current=o,j("saved"),N([]),k([]),S(!1),b(1),clearTimeout(P.current),clearTimeout(Z.current),null==d||d(!1)},[l]),(0,s.useEffect)(()=>{let e=!1,t=null,a=null;return(async function(){var s;let[{Doc:c,UndoManager:r},{WebsocketProvider:i},{yCollab:d},{markdown:u},{oneDark:h},{EditorView:x}]=await Promise.all([Promise.all([n.e(787),n.e(6482)]).then(n.bind(n,79110)),Promise.all([n.e(787),n.e(6482),n.e(2306)]).then(n.bind(n,52306)),Promise.all([n.e(787),n.e(6482),n.e(9672)]).then(n.bind(n,49672)),n.e(8338).then(n.bind(n,40228)),Promise.resolve().then(n.bind(n,64880)),Promise.resolve().then(n.bind(n,47824))]);if(e)return;N([u(),h,x.lineWrapping]);let m=new c,p=m.getText("codemirror"),f=new r(p),v=new i(null!==(s=eo.env.NEXT_PUBLIC_WS_URL)&&void 0!==s?s:"ws://localhost:1234",l,m);a=m,t=v;let j="hsl(".concat(360*Math.random()|0,",70%,50%)");v.awareness.setLocalStateField("user",{color:j,colorLight:j+"44"}),v.awareness.on("change",()=>{b(v.awareness.getStates().size)}),v.on("sync",t=>{t&&!e&&(0===p.length&&p.insert(0,o),k([d(p,v.awareness,{undoManager:f})]),S(!0))})})().catch(console.error),()=>{e=!0,null==t||t.disconnect(),null==a||a.destroy()}},[l,o]),(0,s.useEffect)(()=>{if("unsaved"===v)return clearTimeout(P.current),P.current=setTimeout(async()=>{j("saving");try{await i(D.current),j("saved"),null==d||d(!1)}catch(e){j("unsaved")}},2e3),()=>clearTimeout(P.current)},[p,v]),(0,s.useEffect)(()=>{function e(e){(e.ctrlKey||e.metaKey)&&"s"===e.key&&(e.preventDefault(),clearTimeout(P.current),j("saving"),i(D.current).then(()=>{j("saved"),null==d||d(!1)}).catch(()=>j("unsaved")))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,d]);let E=(0,s.useCallback)(e=>{e!==D.current&&(f(e),j("unsaved"),null==d||d(!0),clearTimeout(Z.current),Z.current=setTimeout(()=>{null==u||u(e)},500))},[d,u]),T=null!==(c=null===(t=h.current)||void 0===t?void 0:t.view)&&void 0!==c?c:null,L="preview"!==x,_="edit"!==x,H=C?[...w,...y]:w,W="saving"===v?"text-muted":"saved"===v?"text-teal-400":"text-yellow-400";return(0,a.jsx)(F.pn,{delayDuration:300,children:(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border flex-shrink-0",children:[(0,a.jsx)("span",{className:"text-xs font-mono text-muted flex-1 truncate min-w-0",children:l}),(0,a.jsx)(I,{value:x,onValueChange:e=>m(e),children:(0,a.jsxs)(M,{className:"h-7 bg-surface2 p-0.5",children:[(0,a.jsx)(V,{value:"edit",className:"h-6 px-2.5 text-xs",children:"Edit"}),(0,a.jsx)(V,{value:"split",className:"h-6 px-2.5 text-xs",children:"Split"}),(0,a.jsx)(V,{value:"preview",className:"h-6 px-2.5 text-xs",children:"Preview"})]})}),g>1&&(0,a.jsxs)(O.C,{variant:"secondary",className:"h-5 gap-1 text-[10px] px-1.5",children:[(0,a.jsx)(R.Z,{className:"h-3 w-3"}),g]}),(0,a.jsxs)(F.u,{children:[(0,a.jsx)(F.aJ,{asChild:!0,children:(0,a.jsx)(z.z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:function(){var e;let t=new Blob([D.current],{type:"text/markdown"}),n=URL.createObjectURL(t),a=document.createElement("a");a.href=n,a.download=null!==(e=l.split("/").pop())&&void 0!==e?e:"document.md",a.click(),URL.revokeObjectURL(n)},children:(0,a.jsx)(U.Z,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(F._v,{side:"bottom",children:"Download .md"})]}),(0,a.jsxs)("span",{className:"text-xs flex items-center gap-1 ".concat(W),children:["saved"===v&&(0,a.jsx)(r.Z,{className:"h-3 w-3"}),"saving"===v?"Saving…":"saved"===v?"Saved":"Unsaved"]})]}),"preview"!==x&&(0,a.jsx)(el,{editorView:T}),(0,a.jsxs)("div",{className:"flex-1 overflow-hidden ".concat(L&&_?"grid grid-cols-2 divide-x divide-border":"flex"),children:[L&&(0,a.jsx)("div",{className:"flex flex-col overflow-hidden min-h-0",children:0===w.length?(0,a.jsx)("div",{className:"flex-1 p-4 font-mono text-sm text-txt bg-[#282c34] overflow-auto whitespace-pre-wrap",children:p}):(0,a.jsx)(A.ZP,{ref:h,value:p,theme:"none",onChange:E,extensions:H,style:{height:"100%",overflow:"auto"},className:"h-full text-sm"},l)}),_&&(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6 min-w-0",children:(0,a.jsx)(er.$,{content:p})})]})]})})}function ed(e){let{docPath:t,rootParam:n,onOpenDoc:c}=e,[r,o]=(0,s.useState)(null),[i,d]=(0,s.useState)(!1),[u,h]=(0,s.useState)(!1),x=(0,s.useCallback)(async()=>{if(!u){d(!0);try{var e;let a=await fetch("/api/backlinks".concat(n,"&path=").concat(encodeURIComponent(t))),s=await a.json();o(null!==(e=s.links)&&void 0!==e?e:[])}catch(e){o([])}finally{d(!1),h(!0)}}},[t,n,u]);return(0,a.jsxs)("div",{className:"fixed right-4 bottom-8 z-40 group",onMouseEnter:()=>{u||x()},children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full bg-surface border border-border flex items-center justify-center group-hover:opacity-0 transition-opacity duration-200 shadow-sm",children:(0,a.jsx)(G.Z,{className:"h-4 w-4 text-muted"})}),(0,a.jsxs)("div",{className:(0,b.cn)("absolute right-0 bottom-0 w-72 max-h-[50vh] bg-surface/95 backdrop-blur-sm border border-border rounded-lg shadow-xl","opacity-0 scale-95 origin-bottom-right pointer-events-none","group-hover:opacity-100 group-hover:scale-100 group-hover:pointer-events-auto","transition-all duration-200 ease-out"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[(0,a.jsx)(G.Z,{className:"h-3.5 w-3.5 text-accent"}),(0,a.jsx)("span",{className:"text-[11px] font-semibold text-muted uppercase tracking-wider",children:"Referenced by"}),null!==r&&(0,a.jsx)("span",{className:"text-[10px] text-muted/60 bg-accent/10 px-1.5 py-0.5 rounded-full ml-auto",children:r.length})]}),(0,a.jsxs)("div",{className:"overflow-y-auto max-h-[calc(50vh-44px)]",children:[i&&(0,a.jsxs)("div",{className:"px-3 py-6 text-center",children:[(0,a.jsx)("div",{className:"w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin mx-auto"}),(0,a.jsx)("p",{className:"text-xs text-muted/60 mt-2",children:"Scanning docs..."})]}),!i&&null!==r&&0===r.length&&(0,a.jsxs)("div",{className:"px-3 py-6 text-center",children:[(0,a.jsx)(G.Z,{className:"h-8 w-8 text-muted/30 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-xs text-muted/60",children:"No other docs link to this file"})]}),!i&&null!==r&&r.length>0&&(0,a.jsx)("div",{className:"py-1",children:r.map((e,t)=>{var n;return(0,a.jsxs)("button",{onClick:()=>c(e.file),className:"w-full text-left px-3 py-2 hover:bg-accent/10 transition-colors group/item",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-txt truncate",children:null===(n=e.file.split("/").pop())||void 0===n?void 0:n.replace(/\.md$/,"")}),(0,a.jsxs)("span",{className:"text-[10px] text-muted/50 shrink-0",children:["L",e.line]})]}),(0,a.jsx)("p",{className:"text-[11px] text-muted/70 mt-1 truncate pl-5",children:e.text})]},"".concat(e.file,"-").concat(e.line,"-").concat(t))})})]})]})]})}function eu(e){let{doc:t,onDirtyChange:n,onContentChange:s}=e,{rootParam:l,setSelectedDoc:r,openDoc:o}=(0,c.q)();if(!t)return(0,a.jsx)("div",{className:"flex items-center justify-center h-full text-muted text-sm",children:"Select a document to read"});async function i(e){let n=await fetch("/api/docs".concat(l),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,content:e})});if(!n.ok){var a;throw Error(null!==(a=(await n.json()).error)&&void 0!==a?a:"Save failed")}r({...t,content:e})}return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsx)(ei,{docPath:t.path,initialContent:t.content,onSave:i,onDirtyChange:n,onContentChange:s}),(0,a.jsx)(ed,{docPath:t.path,rootParam:l,onOpenDoc:o})]})}function eh(e){let{headings:t}=e;return 0===t.length?null:(0,a.jsxs)("div",{className:"fixed right-4 top-20 z-40 group",children:[(0,a.jsx)("div",{className:"w-1 h-32 bg-muted/20 rounded-full group-hover:opacity-0 transition-opacity duration-200"}),(0,a.jsxs)("div",{className:(0,b.cn)("absolute right-0 top-0 w-56 max-h-[70vh] bg-surface/95 backdrop-blur-sm border border-border rounded-lg shadow-xl","opacity-0 scale-95 origin-top-right pointer-events-none","group-hover:opacity-100 group-hover:scale-100 group-hover:pointer-events-auto","transition-all duration-200 ease-out"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[(0,a.jsx)(ee.Z,{className:"h-3.5 w-3.5 text-accent"}),(0,a.jsx)("span",{className:"text-[11px] font-semibold text-muted uppercase tracking-wider",children:"Outline"}),(0,a.jsx)("span",{className:"text-[10px] text-muted/60 bg-accent/10 px-1.5 py-0.5 rounded-full ml-auto",children:t.length})]}),(0,a.jsx)("div",{className:"overflow-y-auto max-h-[calc(70vh-44px)] py-2",children:t.map((e,t)=>(0,a.jsx)("button",{onClick:()=>{var t,n;return t=e.anchor,void(null===(n=document.getElementById(t))||void 0===n||n.scrollIntoView({behavior:"smooth",block:"start"}))},className:(0,b.cn)("w-full text-left text-[13px] py-1.5 px-3 hover:bg-accent/10 transition-colors truncate",1===e.level&&"font-medium text-txt",2===e.level&&"pl-5 text-muted hover:text-txt",3===e.level&&"pl-7 text-muted/70 text-[12px] hover:text-muted"),children:e.text},t))})]})]})}function ex(e){var t;let{docs:n,selectedDoc:c,docSearch:l,onSearchChange:r,onDocSelect:o,onDirtyChange:i,onNewDocClick:d,onDocDeleted:u,onDocRenamed:h,rootParam:x}=e,[m,p]=(0,s.useState)(null!==(t=null==c?void 0:c.content)&&void 0!==t?t:"");(0,s.useEffect)(()=>{var e;p(null!==(e=null==c?void 0:c.content)&&void 0!==e?e:"")},[null==c?void 0:c.path]);let f=(0,s.useMemo)(()=>m.split("\n").filter(e=>/^#{1,3} /.test(e)).flatMap(e=>{let t=e.match(/^(#{1,3}) (.+)/);if(!t)return[];let n=t[2].trim(),a=n.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-");return[{level:t[1].length,text:n,anchor:a}]}),[m]);return(0,a.jsxs)("div",{className:"flex h-full relative",style:{minHeight:"calc(100vh - 3rem)"},children:[(0,a.jsx)(L,{docs:n,selectedDocPath:null==c?void 0:c.path,searchValue:l,onSearchChange:r,onDocClick:o,onNewDocClick:d,onDocDeleted:u,onDocRenamed:h,rootParam:x}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsx)(eu,{doc:c,onDirtyChange:i,onContentChange:p})}),c&&(0,a.jsx)(eh,{headings:f})]})}var em=n(82825);function ep(){let{selectedDoc:e,setSelectedDoc:t,rootParam:n,activeProject:l}=(0,c.q)(),[r,o]=(0,s.useState)([]),[i,d]=(0,s.useState)(""),[u,h]=(0,s.useState)(!1),x=(0,s.useRef)(!1),m=(0,s.useCallback)(()=>{l&&fetch("/api/docs".concat(n)).then(e=>e.json()).then(e=>o(Array.isArray(e)?e:[])).catch(()=>{})},[l,n]);(0,s.useEffect)(()=>{m()},[m]);let p=(0,s.useCallback)(async e=>{var t;if(!e.trim()){m();return}let a=await fetch("/api/docs".concat(n,"&q=").concat(encodeURIComponent(e)));o((null===(t=(await a.json()).results)||void 0===t?void 0:t.map(e=>({path:e.file,section:"search",name:e.file})))||[])},[n,m]);async function f(e){if(x.current&&!window.confirm("You have unsaved changes. Discard?"))return;x.current=!1;let a=await fetch("/api/docs".concat(n,"&read=").concat(encodeURIComponent(e)));t(await a.json())}async function v(e){m(),await f(e)}async function j(t,n){m(),(null==e?void 0:e.path)===t&&await f(n)}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ex,{docs:r,selectedDoc:e,docSearch:i,onSearchChange:function(e){d(e),p(e)},onDocSelect:f,onDirtyChange:function(e){x.current=e},onNewDocClick:()=>h(!0),onDocDeleted:function(n){m(),(null==e?void 0:e.path)===n&&t(null)},onDocRenamed:j,rootParam:n}),(0,a.jsx)(em.t,{open:u,onOpenChange:h,rootParam:n,onDocCreated:v})]})}},5763:function(e,t,n){"use strict";n.d(t,{$:function(){return r}});var a=n(59533),s=n(31229),c=n(10228),l=n(52284);function r(e){let{content:t,className:r}=e,o=c.TU.parse(t).replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/\son\w+="[^"]*"/gi,"").replace(/\son\w+='[^']*'/gi,""),i=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let e=i.current;if(!e)return;let t=!1,a=setTimeout(()=>{t||Promise.all([n.e(4655),n.e(5218)]).then(n.bind(n,45218)).then(n=>{if(t||!e.isConnected)return;let a=Array.from(e.querySelectorAll(".mermaid:not([data-processed])"));0!==a.length&&(n.default.initialize({startOnLoad:!1,theme:"dark",darkMode:!0,securityLevel:"antiscript"}),n.default.run({nodes:a,suppressErrors:!0}).catch(e=>{console.error("[mermaid]",e)}))})},120);return()=>{t=!0,clearTimeout(a)}},[o]),(0,a.jsx)("div",{ref:i,className:(0,l.cn)("prose-dark",r),dangerouslySetInnerHTML:{__html:o}})}c.TU.setOptions({gfm:!0,breaks:!1}),c.TU.use({renderer:{code(e,t){if("mermaid"===t){let t=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return'<div class="mermaid">'.concat(t,"</div>")}return!1}}}),c.TU.use({renderer:{heading(e,t){let n=e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-");return"<h".concat(t,' id="').concat(n,'">').concat(e,"</h").concat(t,">\n")}}})}},function(e){e.O(0,[7069,490,228,7725,4316,845,4170,6842,1744],function(){return e(e.s=69827)}),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3015],{69827:function(e,t,n){Promise.resolve().then(n.bind(n,3526))},3526:function(e,t,n){"use strict";n.r(t),n.d(t,{default:function(){return ep}});var a=n(59533),s=n(31229),c=n(11180),l=n(21263),r=n(20508),o=n(86725),i=n(92560),d=n(39098),u=n(12794),h=n(25612),x=n(80261),m=n(35710),p=n(48354),f=n(76877),v=n(56622),j=n(46850),g=n(30445),b=n(52284),w=n(13191),N=n(8637),y=n(1815);let k=y.fC,C=y.wy,S=y.Fw;var P=n(83373);let Z=(0,s.createContext)({active:!1,selected:new Set,toggle:()=>{},onRename:()=>{},onDelete:()=>{},renamingPath:null,setRenamingPath:()=>{}});function D(e){return e.replace(/\\/g,"/")}function E(e){return e.replace(/^\d+-/,"").replace(/[-_]/g," ").toLowerCase().replace(/\b\w/g,e=>e.toUpperCase())}function T(e){let{node:t,depth:n,selectedPath:c,onDocClick:m,folderPath:p}=e,{active:f,selected:v,toggle:j,onRename:g,onDelete:N,renamingPath:y,setRenamingPath:D}=(0,s.useContext)(Z),[L,R]=(0,s.useState)(t.name),U=!!t.docPath,A=t.docPath===c,O=!!t.docPath&&v.has(t.docPath),z=t.docPath===y,_=12*n;return U?z?(0,a.jsxs)("div",{style:{paddingLeft:"".concat(8+_,"px")},className:"flex items-center gap-2 h-7 pr-2",children:[(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"}),(0,a.jsx)(w.I,{autoFocus:!0,value:L,onChange:e=>R(e.target.value),onKeyDown:e=>{if("Enter"===e.key){let e=L.trim();if(e&&e!==t.name){let n=t.docPath.split("/").slice(0,-1).join("/");g(n?"".concat(n,"/").concat(e,".md"):"".concat(e,".md"))}D(null)}else"Escape"===e.key&&(R(t.name),D(null))},onBlur:()=>{R(t.name),D(null)},className:"h-5 text-xs px-1 py-0"})]}):(0,a.jsxs)("div",{className:(0,b.cn)("group w-full flex items-center gap-2 h-7 pr-1 rounded-md text-xs transition-colors",A&&!f?"bg-accent/10 text-accent font-medium":O?"bg-accent/10 text-accent":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsxs)("button",{onClick:()=>f?j(t.docPath):m(t.docPath),style:{paddingLeft:"".concat(8+_,"px")},className:"flex-1 flex items-center gap-2 h-full truncate",children:[f?(0,a.jsx)("span",{className:(0,b.cn)("h-3.5 w-3.5 shrink-0 rounded border flex items-center justify-center transition-colors",O?"border-accent bg-accent/20":"border-border"),children:O&&(0,a.jsx)(r.Z,{className:"h-2.5 w-2.5 text-accent"})}):(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"}),(0,a.jsx)("span",{className:"truncate",children:E(t.name)})]}),!f&&(0,a.jsxs)(P.h_,{children:[(0,a.jsx)(P.$F,{asChild:!0,children:(0,a.jsx)("button",{className:"h-5 w-5 shrink-0 flex items-center justify-center rounded opacity-0 group-hover:opacity-100 hover:bg-surface2 transition-opacity",onClick:e=>e.stopPropagation(),children:(0,a.jsx)(o.Z,{className:"h-3.5 w-3.5"})})}),(0,a.jsxs)(P.AW,{align:"end",className:"w-32",children:[(0,a.jsxs)(P.Xi,{onClick:()=>{R(t.name.replace(/\.md$/,"")),D(t.docPath)},children:[(0,a.jsx)(i.Z,{className:"h-3.5 w-3.5 mr-2"})," Rename"]}),(0,a.jsxs)(P.Xi,{onClick:()=>N(t.docPath),className:"text-red-400 focus:text-red-400",children:[(0,a.jsx)(d.Z,{className:"h-3.5 w-3.5 mr-2"})," Delete"]})]})]})]}):(0,a.jsxs)(k,{defaultOpen:!0,className:"group/folder",children:[(0,a.jsx)(C,{asChild:!0,children:(0,a.jsxs)("button",{style:{paddingLeft:"".concat(8+_,"px")},className:"w-full flex items-center gap-2 h-7 pr-2 rounded-md text-xs font-medium text-muted hover:text-txt hover:bg-surface2 transition-colors",children:[(0,a.jsx)(u.Z,{className:"h-3 w-3 shrink-0 transition-transform duration-200 group-data-[state=open]/folder:rotate-90"}),(0,a.jsx)(h.Z,{className:"h-3.5 w-3.5 shrink-0 text-accent/70 group-data-[state=open]/folder:hidden"}),(0,a.jsx)(x.Z,{className:"h-3.5 w-3.5 shrink-0 text-accent/70 hidden group-data-[state=open]/folder:block"}),(0,a.jsx)("span",{className:"truncate",children:E(t.name)})]})}),(0,a.jsx)(S,{className:"overflow-hidden data-[state=closed]:animate-collapsible-up data-[state=open]:animate-collapsible-down",children:t.children.map(e=>{var t;return(0,a.jsx)(T,{node:e,depth:n+1,selectedPath:c,onDocClick:m,folderPath:"".concat(p,"/").concat(e.name)},null!==(t=e.docPath)&&void 0!==t?t:e.name)})})]})}function L(e){let{docs:t,selectedDocPath:n,searchValue:c,onSearchChange:o,onDocClick:i,onNewDocClick:d,onDocDeleted:u,onDocRenamed:h,rootParam:x=""}=e,[y,k]=(0,s.useState)(!1),[C,S]=(0,s.useState)(new Set),[P,L]=(0,s.useState)("idle"),[R,U]=(0,s.useState)(null),[A,O]=(0,s.useState)(null),z=(0,s.useMemo)(()=>t.filter(e=>{let t=D(e.path);return"CLAUDE.md"===t||"AGENTS.md"===t||t.endsWith("/CLAUDE.md")||t.endsWith("/AGENTS.md")}),[t]),_=(0,s.useMemo)(()=>t.filter(e=>{let t=D(e.path);return"CLAUDE.md"!==t&&"AGENTS.md"!==t&&!t.endsWith("/CLAUDE.md")&&!t.endsWith("/AGENTS.md")}),[t]),I=(0,s.useMemo)(()=>(function(e){let t={name:"",children:[]};for(let n of e){let e=D(n.path).split("/"),a=t;for(let t=0;t<e.length-1;t++){let n=a.children.find(n=>n.name===e[t]&&!n.docPath);n||(n={name:e[t],children:[]},a.children.push(n)),a=n}a.children.push({name:n.name,docPath:n.path,children:[]})}return t.children})(_),[_]),M=c.trim().length>0;function V(e){S(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})}function F(){k(!1),S(new Set),L("idle")}async function H(e){if(R&&h){try{(await fetch("/api/docs".concat(x),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldPath:R,newPath:e})})).ok&&h(R,e)}catch(e){}U(null)}}async function W(e){if(u&&window.confirm("Delete ".concat(e,"?")))try{(await fetch("/api/docs".concat(x),{method:"DELETE",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:e})})).ok&&u(e)}catch(e){}}async function B(){if(0!==C.size){L("copying");try{let e=await fetch("/api/context".concat(x),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({paths:[...C]})}),{context:t}=await e.json();await navigator.clipboard.writeText(t),L("copied"),setTimeout(()=>L("idle"),2e3)}catch(e){L("idle")}}}return(0,a.jsx)(Z.Provider,{value:{active:y,selected:C,toggle:V,onRename:H,onDelete:W,renamingPath:R,setRenamingPath:U},children:(0,a.jsxs)("aside",{className:"w-56 flex flex-col border-r border-border flex-shrink-0 bg-sidebar",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 border-b border-border",children:[(0,a.jsx)("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Docs"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>{y?F():k(!0)},className:(0,b.cn)("h-5 w-5 flex items-center justify-center rounded transition-colors",y?"bg-accent/20 text-accent":"hover:bg-surface2 text-muted hover:text-accent"),title:"Select docs",children:(0,a.jsx)(m.Z,{className:"h-3.5 w-3.5"})}),d&&(0,a.jsx)("button",{onClick:d,className:"h-5 w-5 flex items-center justify-center rounded hover:bg-surface2 text-muted hover:text-accent transition-colors",title:"New document",children:(0,a.jsx)(p.Z,{className:"h-3.5 w-3.5"})})]})]}),!y&&(0,a.jsx)("div",{className:"p-2 border-b border-border",children:(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(f.Z,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3.5 w-3.5 text-muted pointer-events-none"}),(0,a.jsx)(w.I,{id:"doc-search",value:c,onChange:e=>o(e.target.value),placeholder:"Search docs...",className:"pl-7 h-8 text-xs bg-surface2 border-transparent focus:border-border"})]})}),(0,a.jsx)(N.x,{className:"flex-1",children:(0,a.jsx)("div",{className:"p-1.5 space-y-0.5",children:y?t.map(e=>{let t=C.has(e.path);return(0,a.jsxs)("button",{onClick:()=>V(e.path),className:(0,b.cn)("w-full flex items-center gap-2 h-7 px-2 rounded-md text-xs transition-colors",t?"bg-accent/10 text-accent":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsx)("span",{className:(0,b.cn)("h-3.5 w-3.5 shrink-0 rounded border flex items-center justify-center transition-colors",t?"border-accent bg-accent/20":"border-border"),children:t&&(0,a.jsx)(r.Z,{className:"h-2.5 w-2.5 text-accent"})}),(0,a.jsx)("span",{className:"truncate flex-1 text-left",children:e.name}),(0,a.jsx)("span",{className:"text-[10px] opacity-40 truncate max-w-[60px]",children:D(e.path).split("/").slice(0,-1).join("/")||"root"})]},e.path)}):(0,a.jsxs)(a.Fragment,{children:[!M&&z.length>0&&(0,a.jsxs)("div",{className:"mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 px-2 py-1",children:[(0,a.jsx)(v.Z,{className:"h-3.5 w-3.5 text-amber-400 shrink-0"}),(0,a.jsx)("span",{className:"text-[10px] font-semibold text-muted uppercase tracking-wider",children:"Agent Config"}),(0,a.jsx)("span",{className:"ml-auto text-[9px] font-medium bg-amber-400/15 text-amber-400 px-1.5 py-0.5 rounded-full",children:"AI"})]}),z.map(e=>(0,a.jsxs)("button",{onClick:()=>i(e.path),className:(0,b.cn)("w-full flex items-center gap-2 h-7 px-2 rounded-md text-xs transition-colors",e.path===n?"bg-accent/10 text-accent font-medium":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 shrink-0 opacity-50"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]},e.path)),(0,a.jsx)("div",{className:"mt-2 border-t border-border"})]}),M?0===t.length?(0,a.jsx)("p",{className:"text-xs text-muted px-2 py-4 text-center",children:"No results"}):t.map(e=>(0,a.jsxs)("button",{onClick:()=>i(e.path),className:(0,b.cn)("w-full flex flex-col items-start gap-0.5 px-2 py-1.5 rounded-md text-xs transition-colors text-left",e.path===n?"bg-accent/10 text-accent":"text-muted hover:text-txt hover:bg-surface2"),children:[(0,a.jsx)("span",{className:"font-medium truncate w-full",children:E(e.name)}),(0,a.jsx)("span",{className:"text-[10px] opacity-50 truncate w-full",children:D(e.path).split("/").slice(0,-1).join("/")})]},e.path)):I.map(e=>{var t;return(0,a.jsx)(T,{node:e,depth:0,selectedPath:n,onDocClick:i,folderPath:e.name},null!==(t=e.docPath)&&void 0!==t?t:e.name)})]})})}),y&&(0,a.jsxs)("div",{className:"border-t border-border p-2 space-y-1.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between text-[11px] text-muted",children:[(0,a.jsxs)("span",{children:[C.size," selected"]}),(0,a.jsxs)("button",{onClick:F,className:"hover:text-txt transition-colors flex items-center gap-1",children:[(0,a.jsx)(j.Z,{className:"h-3 w-3"})," Clear"]})]}),(0,a.jsx)("button",{onClick:B,disabled:0===C.size||"copying"===P,className:(0,b.cn)("w-full flex items-center justify-center gap-1.5 h-7 rounded-md text-xs font-medium transition-colors","copied"===P?"bg-green-500/20 text-green-400":0===C.size?"bg-surface2 text-muted cursor-not-allowed":"bg-accent/20 text-accent hover:bg-accent/30"),children:"copied"===P?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.Z,{className:"h-3 w-3"})," Copied!"]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(g.Z,{className:"h-3 w-3"})," Copy Context"]})})]})]})})}var R=n(8892),U=n(42008),A=n(89333),O=n(71301),z=n(220),_=n(60893);let I=_.fC,M=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)(_.aV,{ref:t,className:(0,b.cn)("inline-flex h-10 items-center justify-center rounded-md bg-slate-100 p-1 text-slate-500 dark:bg-slate-800 dark:text-slate-400",n),...s})});M.displayName=_.aV.displayName;let V=s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)(_.xz,{ref:t,className:(0,b.cn)("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-white data-[state=active]:text-slate-950 data-[state=active]:shadow-sm dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300 dark:data-[state=active]:bg-slate-950 dark:data-[state=active]:text-slate-50",n),...s})});V.displayName=_.xz.displayName,s.forwardRef((e,t)=>{let{className:n,...s}=e;return(0,a.jsx)(_.VY,{ref:t,className:(0,b.cn)("mt-2 ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-slate-950 focus-visible:ring-offset-2 dark:ring-offset-slate-950 dark:focus-visible:ring-slate-300",n),...s})}).displayName=_.VY.displayName;var F=n(17477),H=n(46366),W=n(58797),B=n(95371),J=n(92231),q=n(82772),$=n(60031),G=n(75255),K=n(25902),X=n(27881),Y=n(42921),Q=n(47953),ee=n(73473),et=n(69195),en=n(12301);function ea(e,t,n){let{from:a,to:s}=e.state.selection.main,c=e.state.sliceDoc(a,s);e.dispatch({changes:{from:a,to:s,insert:t+c+n},selection:{anchor:a+t.length,head:a+t.length+c.length}}),e.focus()}function es(e,t){let{from:n}=e.state.selection.main,a=e.state.doc.lineAt(n);e.dispatch({changes:{from:a.from,to:a.from,insert:t},selection:{anchor:n+t.length}}),e.focus()}function ec(e){let{icon:t,label:n,onClick:s}=e;return(0,a.jsxs)(F.u,{children:[(0,a.jsx)(F.aJ,{asChild:!0,children:(0,a.jsx)(z.z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:s,children:t})}),(0,a.jsx)(F._v,{side:"bottom",children:n})]})}function el(e){let{editorView:t}=e;return(0,a.jsx)(F.pn,{delayDuration:300,children:(0,a.jsxs)("div",{className:"flex items-center gap-0.5 px-2 py-1 border-b border-border bg-surface flex-shrink-0",children:[(0,a.jsx)(ec,{icon:(0,a.jsx)(H.Z,{className:"h-3.5 w-3.5"}),label:"Bold",onClick:function(){t&&ea(t,"**","**")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(W.Z,{className:"h-3.5 w-3.5"}),label:"Italic",onClick:function(){t&&ea(t,"*","*")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(B.Z,{className:"h-3.5 w-3.5"}),label:"Strikethrough",onClick:function(){t&&ea(t,"~~","~~")}}),(0,a.jsx)(en.Z,{orientation:"vertical",className:"h-4 mx-1"}),(0,a.jsx)(ec,{icon:(0,a.jsx)(J.Z,{className:"h-3.5 w-3.5"}),label:"Heading 1",onClick:function(){t&&es(t,"# ")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(q.Z,{className:"h-3.5 w-3.5"}),label:"Heading 2",onClick:function(){t&&es(t,"## ")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)($.Z,{className:"h-3.5 w-3.5"}),label:"Heading 3",onClick:function(){t&&es(t,"### ")}}),(0,a.jsx)(en.Z,{orientation:"vertical",className:"h-4 mx-1"}),(0,a.jsx)(ec,{icon:(0,a.jsx)(G.Z,{className:"h-3.5 w-3.5"}),label:"Link",onClick:function(){if(!t)return;let{from:e,to:n}=t.state.selection.main,a=t.state.sliceDoc(e,n)||"link text";t.dispatch({changes:{from:e,to:n,insert:"[".concat(a,"](url)")},selection:{anchor:e+a.length+3,head:e+a.length+3+3}}),t.focus()}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(K.Z,{className:"h-3.5 w-3.5"}),label:"Inline code",onClick:function(){t&&ea(t,"`","`")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(X.Z,{className:"h-3.5 w-3.5"}),label:"Code block",onClick:function(){t&&ea(t,"```\n","\n```")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(Y.Z,{className:"h-3.5 w-3.5"}),label:"Blockquote",onClick:function(){t&&es(t,"> ")}}),(0,a.jsx)(en.Z,{orientation:"vertical",className:"h-4 mx-1"}),(0,a.jsx)(ec,{icon:(0,a.jsx)(Q.Z,{className:"h-3.5 w-3.5"}),label:"Horizontal rule",onClick:function(){t&&function(e,t){let{from:n,to:a}=e.state.selection.main;e.dispatch({changes:{from:n,to:a,insert:t},selection:{anchor:n+t.length}}),e.focus()}(t,"\n---\n")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(ee.Z,{className:"h-3.5 w-3.5"}),label:"Unordered list",onClick:function(){t&&es(t,"- ")}}),(0,a.jsx)(ec,{icon:(0,a.jsx)(et.Z,{className:"h-3.5 w-3.5"}),label:"Ordered list",onClick:function(){t&&es(t,"1. ")}})]})})}var er=n(5763),eo=n(44492);function ei(e){var t,c;let{docPath:l,initialContent:o,onSave:i,onDirtyChange:d,onContentChange:u}=e,h=(0,s.useRef)(null),[x,m]=(0,s.useState)("split"),[p,f]=(0,s.useState)(o),[v,j]=(0,s.useState)("saved"),[g,b]=(0,s.useState)(1),[w,N]=(0,s.useState)([]),[y,k]=(0,s.useState)([]),[C,S]=(0,s.useState)(!1),P=(0,s.useRef)(void 0),Z=(0,s.useRef)(void 0),D=(0,s.useRef)(o);(0,s.useEffect)(()=>{D.current=p},[p]),(0,s.useEffect)(()=>{f(o),D.current=o,j("saved"),N([]),k([]),S(!1),b(1),clearTimeout(P.current),clearTimeout(Z.current),null==d||d(!1)},[l]),(0,s.useEffect)(()=>{let e=!1,t=null,a=null;return(async function(){var s;let[{Doc:c,UndoManager:r},{WebsocketProvider:i},{yCollab:d},{markdown:u},{oneDark:h},{EditorView:x}]=await Promise.all([Promise.all([n.e(787),n.e(6482)]).then(n.bind(n,79110)),Promise.all([n.e(787),n.e(6482),n.e(2306)]).then(n.bind(n,52306)),Promise.all([n.e(787),n.e(6482),n.e(9672)]).then(n.bind(n,49672)),n.e(8338).then(n.bind(n,40228)),Promise.resolve().then(n.bind(n,64880)),Promise.resolve().then(n.bind(n,47824))]);if(e)return;N([u(),h,x.lineWrapping]);let m=new c,p=m.getText("codemirror"),f=new r(p),v=new i(null!==(s=eo.env.NEXT_PUBLIC_WS_URL)&&void 0!==s?s:"ws://localhost:1234",l,m);a=m,t=v;let j="hsl(".concat(360*Math.random()|0,",70%,50%)");v.awareness.setLocalStateField("user",{color:j,colorLight:j+"44"}),v.awareness.on("change",()=>{b(v.awareness.getStates().size)}),v.on("sync",t=>{t&&!e&&(0===p.length&&p.insert(0,o),k([d(p,v.awareness,{undoManager:f})]),S(!0))})})().catch(console.error),()=>{e=!0,null==t||t.disconnect(),null==a||a.destroy()}},[l,o]),(0,s.useEffect)(()=>{if("unsaved"===v)return clearTimeout(P.current),P.current=setTimeout(async()=>{j("saving");try{await i(D.current),j("saved"),null==d||d(!1)}catch(e){j("unsaved")}},2e3),()=>clearTimeout(P.current)},[p,v]),(0,s.useEffect)(()=>{function e(e){(e.ctrlKey||e.metaKey)&&"s"===e.key&&(e.preventDefault(),clearTimeout(P.current),j("saving"),i(D.current).then(()=>{j("saved"),null==d||d(!1)}).catch(()=>j("unsaved")))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[i,d]);let E=(0,s.useCallback)(e=>{e!==D.current&&(f(e),j("unsaved"),null==d||d(!0),clearTimeout(Z.current),Z.current=setTimeout(()=>{null==u||u(e)},500))},[d,u]),T=null!==(c=null===(t=h.current)||void 0===t?void 0:t.view)&&void 0!==c?c:null,L="preview"!==x,_="edit"!==x,H=C?[...w,...y]:w,W="saving"===v?"text-muted":"saved"===v?"text-teal-400":"text-yellow-400";return(0,a.jsx)(F.pn,{delayDuration:300,children:(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-4 py-2 border-b border-border flex-shrink-0",children:[(0,a.jsx)("span",{className:"text-xs font-mono text-muted flex-1 truncate min-w-0",children:l}),(0,a.jsx)(I,{value:x,onValueChange:e=>m(e),children:(0,a.jsxs)(M,{className:"h-7 bg-surface2 p-0.5",children:[(0,a.jsx)(V,{value:"edit",className:"h-6 px-2.5 text-xs",children:"Edit"}),(0,a.jsx)(V,{value:"split",className:"h-6 px-2.5 text-xs",children:"Split"}),(0,a.jsx)(V,{value:"preview",className:"h-6 px-2.5 text-xs",children:"Preview"})]})}),g>1&&(0,a.jsxs)(O.C,{variant:"secondary",className:"h-5 gap-1 text-[10px] px-1.5",children:[(0,a.jsx)(R.Z,{className:"h-3 w-3"}),g]}),(0,a.jsxs)(F.u,{children:[(0,a.jsx)(F.aJ,{asChild:!0,children:(0,a.jsx)(z.z,{variant:"ghost",size:"icon",className:"h-7 w-7",onClick:function(){var e;let t=new Blob([D.current],{type:"text/markdown"}),n=URL.createObjectURL(t),a=document.createElement("a");a.href=n,a.download=null!==(e=l.split("/").pop())&&void 0!==e?e:"document.md",a.click(),URL.revokeObjectURL(n)},children:(0,a.jsx)(U.Z,{className:"h-3.5 w-3.5"})})}),(0,a.jsx)(F._v,{side:"bottom",children:"Download .md"})]}),(0,a.jsxs)("span",{className:"text-xs flex items-center gap-1 ".concat(W),children:["saved"===v&&(0,a.jsx)(r.Z,{className:"h-3 w-3"}),"saving"===v?"Saving…":"saved"===v?"Saved":"Unsaved"]})]}),"preview"!==x&&(0,a.jsx)(el,{editorView:T}),(0,a.jsxs)("div",{className:"flex-1 overflow-hidden ".concat(L&&_?"grid grid-cols-2 divide-x divide-border":"flex"),children:[L&&(0,a.jsx)("div",{className:"flex flex-col overflow-hidden min-h-0",children:0===w.length?(0,a.jsx)("div",{className:"flex-1 p-4 font-mono text-sm text-txt bg-[#282c34] overflow-auto whitespace-pre-wrap",children:p}):(0,a.jsx)(A.ZP,{ref:h,value:p,theme:"none",onChange:E,extensions:H,style:{height:"100%",overflow:"auto"},className:"h-full text-sm"},l)}),_&&(0,a.jsx)("div",{className:"flex-1 overflow-y-auto p-6 min-w-0",children:(0,a.jsx)(er.$,{content:p})})]})]})})}function ed(e){let{docPath:t,rootParam:n,onOpenDoc:c}=e,[r,o]=(0,s.useState)(null),[i,d]=(0,s.useState)(!1),[u,h]=(0,s.useState)(!1),x=(0,s.useCallback)(async()=>{if(!u){d(!0);try{var e;let a=await fetch("/api/backlinks".concat(n,"&path=").concat(encodeURIComponent(t))),s=await a.json();o(null!==(e=s.links)&&void 0!==e?e:[])}catch(e){o([])}finally{d(!1),h(!0)}}},[t,n,u]);return(0,a.jsxs)("div",{className:"fixed right-4 bottom-8 z-40 group",onMouseEnter:()=>{u||x()},children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-full bg-surface border border-border flex items-center justify-center group-hover:opacity-0 transition-opacity duration-200 shadow-sm",children:(0,a.jsx)(G.Z,{className:"h-4 w-4 text-muted"})}),(0,a.jsxs)("div",{className:(0,b.cn)("absolute right-0 bottom-0 w-72 max-h-[50vh] bg-surface/95 backdrop-blur-sm border border-border rounded-lg shadow-xl","opacity-0 scale-95 origin-bottom-right pointer-events-none","group-hover:opacity-100 group-hover:scale-100 group-hover:pointer-events-auto","transition-all duration-200 ease-out"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[(0,a.jsx)(G.Z,{className:"h-3.5 w-3.5 text-accent"}),(0,a.jsx)("span",{className:"text-[11px] font-semibold text-muted uppercase tracking-wider",children:"Referenced by"}),null!==r&&(0,a.jsx)("span",{className:"text-[10px] text-muted/60 bg-accent/10 px-1.5 py-0.5 rounded-full ml-auto",children:r.length})]}),(0,a.jsxs)("div",{className:"overflow-y-auto max-h-[calc(50vh-44px)]",children:[i&&(0,a.jsxs)("div",{className:"px-3 py-6 text-center",children:[(0,a.jsx)("div",{className:"w-5 h-5 border-2 border-accent/30 border-t-accent rounded-full animate-spin mx-auto"}),(0,a.jsx)("p",{className:"text-xs text-muted/60 mt-2",children:"Scanning docs..."})]}),!i&&null!==r&&0===r.length&&(0,a.jsxs)("div",{className:"px-3 py-6 text-center",children:[(0,a.jsx)(G.Z,{className:"h-8 w-8 text-muted/30 mx-auto mb-2"}),(0,a.jsx)("p",{className:"text-xs text-muted/60",children:"No other docs link to this file"})]}),!i&&null!==r&&r.length>0&&(0,a.jsx)("div",{className:"py-1",children:r.map((e,t)=>{var n;return(0,a.jsxs)("button",{onClick:()=>c(e.file),className:"w-full text-left px-3 py-2 hover:bg-accent/10 transition-colors group/item",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(l.Z,{className:"h-3.5 w-3.5 text-muted shrink-0"}),(0,a.jsx)("span",{className:"text-sm font-medium text-txt truncate",children:null===(n=e.file.split("/").pop())||void 0===n?void 0:n.replace(/\.md$/,"")}),(0,a.jsxs)("span",{className:"text-[10px] text-muted/50 shrink-0",children:["L",e.line]})]}),(0,a.jsx)("p",{className:"text-[11px] text-muted/70 mt-1 truncate pl-5",children:e.text})]},"".concat(e.file,"-").concat(e.line,"-").concat(t))})})]})]})]})}function eu(e){let{doc:t,onDirtyChange:n,onContentChange:s}=e,{rootParam:l,setSelectedDoc:r,openDoc:o}=(0,c.q)();if(!t)return(0,a.jsx)("div",{className:"flex items-center justify-center h-full text-muted text-sm",children:"Select a document to read"});async function i(e){let n=await fetch("/api/docs".concat(l),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({path:t.path,content:e})});if(!n.ok){var a;throw Error(null!==(a=(await n.json()).error)&&void 0!==a?a:"Save failed")}r({...t,content:e})}return(0,a.jsxs)("div",{className:"flex flex-col h-full",children:[(0,a.jsx)(ei,{docPath:t.path,initialContent:t.content,onSave:i,onDirtyChange:n,onContentChange:s}),(0,a.jsx)(ed,{docPath:t.path,rootParam:l,onOpenDoc:o})]})}function eh(e){let{headings:t}=e;return 0===t.length?null:(0,a.jsxs)("div",{className:"fixed right-4 top-20 z-40 group",children:[(0,a.jsx)("div",{className:"w-1 h-32 bg-muted/20 rounded-full group-hover:opacity-0 transition-opacity duration-200"}),(0,a.jsxs)("div",{className:(0,b.cn)("absolute right-0 top-0 w-56 max-h-[70vh] bg-surface/95 backdrop-blur-sm border border-border rounded-lg shadow-xl","opacity-0 scale-95 origin-top-right pointer-events-none","group-hover:opacity-100 group-hover:scale-100 group-hover:pointer-events-auto","transition-all duration-200 ease-out"),children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2.5 border-b border-border/50",children:[(0,a.jsx)(ee.Z,{className:"h-3.5 w-3.5 text-accent"}),(0,a.jsx)("span",{className:"text-[11px] font-semibold text-muted uppercase tracking-wider",children:"Outline"}),(0,a.jsx)("span",{className:"text-[10px] text-muted/60 bg-accent/10 px-1.5 py-0.5 rounded-full ml-auto",children:t.length})]}),(0,a.jsx)("div",{className:"overflow-y-auto max-h-[calc(70vh-44px)] py-2",children:t.map((e,t)=>(0,a.jsx)("button",{onClick:()=>{var t,n;return t=e.anchor,void(null===(n=document.getElementById(t))||void 0===n||n.scrollIntoView({behavior:"smooth",block:"start"}))},className:(0,b.cn)("w-full text-left text-[13px] py-1.5 px-3 hover:bg-accent/10 transition-colors truncate",1===e.level&&"font-medium text-txt",2===e.level&&"pl-5 text-muted hover:text-txt",3===e.level&&"pl-7 text-muted/70 text-[12px] hover:text-muted"),children:e.text},t))})]})]})}function ex(e){var t;let{docs:n,selectedDoc:c,docSearch:l,onSearchChange:r,onDocSelect:o,onDirtyChange:i,onNewDocClick:d,onDocDeleted:u,onDocRenamed:h,rootParam:x}=e,[m,p]=(0,s.useState)(null!==(t=null==c?void 0:c.content)&&void 0!==t?t:"");(0,s.useEffect)(()=>{var e;p(null!==(e=null==c?void 0:c.content)&&void 0!==e?e:"")},[null==c?void 0:c.path]);let f=(0,s.useMemo)(()=>m.split("\n").filter(e=>/^#{1,3} /.test(e)).flatMap(e=>{let t=e.match(/^(#{1,3}) (.+)/);if(!t)return[];let n=t[2].trim(),a=n.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-");return[{level:t[1].length,text:n,anchor:a}]}),[m]);return(0,a.jsxs)("div",{className:"flex h-full relative",style:{minHeight:"calc(100vh - 3rem)"},children:[(0,a.jsx)(L,{docs:n,selectedDocPath:null==c?void 0:c.path,searchValue:l,onSearchChange:r,onDocClick:o,onNewDocClick:d,onDocDeleted:u,onDocRenamed:h,rootParam:x}),(0,a.jsx)("div",{className:"flex-1 overflow-y-auto",children:(0,a.jsx)(eu,{doc:c,onDirtyChange:i,onContentChange:p})}),c&&(0,a.jsx)(eh,{headings:f})]})}var em=n(39854);function ep(){let{selectedDoc:e,setSelectedDoc:t,rootParam:n,activeProject:l}=(0,c.q)(),[r,o]=(0,s.useState)([]),[i,d]=(0,s.useState)(""),[u,h]=(0,s.useState)(!1),x=(0,s.useRef)(!1),m=(0,s.useCallback)(()=>{l&&fetch("/api/docs".concat(n)).then(e=>e.json()).then(e=>o(Array.isArray(e)?e:[])).catch(()=>{})},[l,n]);(0,s.useEffect)(()=>{m()},[m]);let p=(0,s.useCallback)(async e=>{var t;if(!e.trim()){m();return}let a=await fetch("/api/docs".concat(n,"&q=").concat(encodeURIComponent(e)));o((null===(t=(await a.json()).results)||void 0===t?void 0:t.map(e=>({path:e.file,section:"search",name:e.file})))||[])},[n,m]);async function f(e){if(x.current&&!window.confirm("You have unsaved changes. Discard?"))return;x.current=!1;let a=await fetch("/api/docs".concat(n,"&read=").concat(encodeURIComponent(e)));t(await a.json())}async function v(e){m(),await f(e)}async function j(t,n){m(),(null==e?void 0:e.path)===t&&await f(n)}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(ex,{docs:r,selectedDoc:e,docSearch:i,onSearchChange:function(e){d(e),p(e)},onDocSelect:f,onDirtyChange:function(e){x.current=e},onNewDocClick:()=>h(!0),onDocDeleted:function(n){m(),(null==e?void 0:e.path)===n&&t(null)},onDocRenamed:j,rootParam:n}),(0,a.jsx)(em.t,{open:u,onOpenChange:h,rootParam:n,onDocCreated:v})]})}},5763:function(e,t,n){"use strict";n.d(t,{$:function(){return r}});var a=n(59533),s=n(31229),c=n(10228),l=n(52284);function r(e){let{content:t,className:r}=e,o=c.TU.parse(t).replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,"").replace(/\son\w+="[^"]*"/gi,"").replace(/\son\w+='[^']*'/gi,""),i=(0,s.useRef)(null);return(0,s.useEffect)(()=>{let e=i.current;if(!e)return;let t=!1,a=setTimeout(()=>{t||Promise.all([n.e(4655),n.e(5218)]).then(n.bind(n,45218)).then(n=>{if(t||!e.isConnected)return;let a=Array.from(e.querySelectorAll(".mermaid:not([data-processed])"));0!==a.length&&(n.default.initialize({startOnLoad:!1,theme:"dark",darkMode:!0,securityLevel:"antiscript"}),n.default.run({nodes:a,suppressErrors:!0}).catch(e=>{console.error("[mermaid]",e)}))})},120);return()=>{t=!0,clearTimeout(a)}},[o]),(0,a.jsx)("div",{ref:i,className:(0,l.cn)("prose-dark",r),dangerouslySetInnerHTML:{__html:o}})}c.TU.setOptions({gfm:!0,breaks:!1}),c.TU.use({renderer:{code(e,t){if("mermaid"===t){let t=e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">");return'<div class="mermaid">'.concat(t,"</div>")}return!1}}}),c.TU.use({renderer:{heading(e,t){let n=e.toLowerCase().replace(/[^\w\s-]/g,"").replace(/\s+/g,"-");return"<h".concat(t,' id="').concat(n,'">').concat(e,"</h").concat(t,">\n")}}})}},function(e){e.O(0,[7069,490,228,7725,4316,5179,6441,4170,6842,1744],function(){return e(e.s=69827)}),_N_E=e.O()}]);
|