commandmate 0.3.5 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (161) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-build-manifest.json +19 -23
  3. package/.next/app-path-routes-manifest.json +1 -1
  4. package/.next/build-manifest.json +5 -5
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/cache/config.json +3 -3
  7. package/.next/cache/webpack/client-production/0.pack +0 -0
  8. package/.next/cache/webpack/client-production/1.pack +0 -0
  9. package/.next/cache/webpack/client-production/2.pack +0 -0
  10. package/.next/cache/webpack/client-production/index.pack +0 -0
  11. package/.next/cache/webpack/client-production/index.pack.old +0 -0
  12. package/.next/cache/webpack/edge-server-production/0.pack +0 -0
  13. package/.next/cache/webpack/edge-server-production/index.pack +0 -0
  14. package/.next/cache/webpack/server-production/0.pack +0 -0
  15. package/.next/cache/webpack/server-production/index.pack +0 -0
  16. package/.next/next-server.js.nft.json +1 -1
  17. package/.next/prerender-manifest.json +1 -1
  18. package/.next/react-loadable-manifest.json +69 -55
  19. package/.next/required-server-files.json +1 -1
  20. package/.next/server/app/_not-found/page.js +1 -1
  21. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  22. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  23. package/.next/server/app/api/app/update-check/route.js +1 -1
  24. package/.next/server/app/api/repositories/clone/route.js +1 -1
  25. package/.next/server/app/api/repositories/route.js +8 -8
  26. package/.next/server/app/api/repositories/scan/route.js +1 -1
  27. package/.next/server/app/api/worktrees/[id]/capture/route.js +1 -2
  28. package/.next/server/app/api/worktrees/[id]/capture/route.js.nft.json +1 -1
  29. package/.next/server/app/api/worktrees/[id]/current-output/route.js +1 -1
  30. package/.next/server/app/api/worktrees/[id]/files/[...path]/route.js +1 -1
  31. package/.next/server/app/api/worktrees/[id]/prompt-response/route.js +1 -1
  32. package/.next/server/app/api/worktrees/[id]/respond/route.js +1 -1
  33. package/.next/server/app/api/worktrees/[id]/route.js +1 -1
  34. package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route.js +1 -1
  35. package/.next/server/app/api/worktrees/[id]/schedules/route.js +2 -2
  36. package/.next/server/app/api/worktrees/[id]/search/route.js +1 -1
  37. package/.next/server/app/api/worktrees/[id]/terminal/route.js +1 -1
  38. package/.next/server/app/api/worktrees/[id]/terminal/route.js.nft.json +1 -1
  39. package/.next/server/app/api/worktrees/[id]/tree/[...path]/route.js +1 -1
  40. package/.next/server/app/api/worktrees/[id]/upload/[...path]/route.js +1 -1
  41. package/.next/server/app/api/worktrees/route.js +1 -1
  42. package/.next/server/app/login/page.js +1 -1
  43. package/.next/server/app/login/page.js.nft.json +1 -1
  44. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  45. package/.next/server/app/page.js +3 -3
  46. package/.next/server/app/page.js.nft.json +1 -1
  47. package/.next/server/app/page_client-reference-manifest.js +1 -1
  48. package/.next/server/app/proxy/[...path]/route.js +4 -4
  49. package/.next/server/app/worktrees/[id]/files/[...path]/page.js +1 -1
  50. package/.next/server/app/worktrees/[id]/files/[...path]/page.js.nft.json +1 -1
  51. package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
  52. package/.next/server/app/worktrees/[id]/page.js +6 -6
  53. package/.next/server/app/worktrees/[id]/page.js.nft.json +1 -1
  54. package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/worktrees/[id]/terminal/page.js +2 -4
  56. package/.next/server/app/worktrees/[id]/terminal/page.js.nft.json +1 -1
  57. package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
  58. package/.next/server/app-paths-manifest.json +8 -8
  59. package/.next/server/chunks/{3294.js → 1628.js} +3 -3
  60. package/.next/server/chunks/185.js +36 -0
  61. package/.next/server/chunks/3860.js +1 -1
  62. package/.next/server/chunks/4893.js +2 -2
  63. package/.next/server/chunks/4952.js +1 -1
  64. package/.next/server/chunks/5488.js +6 -6
  65. package/.next/server/chunks/7425.js +34 -31
  66. package/.next/server/chunks/7566.js +2 -2
  67. package/.next/server/chunks/8199.js +1 -0
  68. package/.next/server/chunks/8585.js +1 -1
  69. package/.next/server/chunks/8693.js +1 -1
  70. package/.next/server/middleware-build-manifest.js +1 -1
  71. package/.next/server/middleware-manifest.json +5 -5
  72. package/.next/server/middleware-react-loadable-manifest.js +1 -1
  73. package/.next/server/pages/500.html +1 -1
  74. package/.next/server/server-reference-manifest.json +1 -1
  75. package/.next/static/chunks/12-00c528d46a0a0a1d.js +1 -0
  76. package/.next/static/chunks/{13.feeafc7cc620f8c4.js → 13.b9521543496f4468.js} +1 -1
  77. package/.next/static/chunks/1334.bfedf44ee9fe2761.js +1 -0
  78. package/.next/static/chunks/143.eb6b4671490cd223.js +1 -0
  79. package/.next/static/chunks/{3574.7a94c27e6a496a56.js → 1442.74b5f4de9a4b4e1b.js} +1 -1
  80. package/.next/static/chunks/2083-b5bed0c77cc53281.js +1 -0
  81. package/.next/static/chunks/2725.eb2d236c8030711c.js +1 -0
  82. package/.next/static/chunks/3398-3d40a17387bd554b.js +1 -0
  83. package/.next/static/chunks/3516.3c576047408cae6b.js +1 -0
  84. package/.next/static/chunks/3559.422c6ca760b85750.js +1 -0
  85. package/.next/static/chunks/3956.52c5b9a0071a641d.js +1 -0
  86. package/.next/static/chunks/4012.32b576a4fa621774.js +1 -0
  87. package/.next/static/chunks/4212.e7ba1009bc1da62d.js +131 -0
  88. package/.next/static/chunks/4303.caf91e86105d5e70.js +1 -0
  89. package/.next/static/chunks/4327.4dcda9b6fab6a385.js +82 -0
  90. package/.next/static/chunks/4671.d86d21d0dfdace41.js +1 -0
  91. package/.next/static/chunks/5518.ec88dcb5a27b17fe.js +1 -0
  92. package/.next/static/chunks/6434.08d262283371d333.js +1 -0
  93. package/.next/static/chunks/{656.5e2de0173f5a06bd.js → 656.dc26b973d07d9627.js} +5 -5
  94. package/.next/static/chunks/7119.01777af21b55740c.js +1 -0
  95. package/.next/static/chunks/7293.fb88bb102af4aa04.js +1 -0
  96. package/.next/static/chunks/8913-40625650292eb3d0.js +1 -0
  97. package/.next/static/chunks/8977.fc18b8260cd8bc1f.js +1 -0
  98. package/.next/static/chunks/9552.d959149efd41e84b.js +1 -0
  99. package/.next/static/chunks/app/layout-7198a7a49aa21a97.js +1 -0
  100. package/.next/static/chunks/app/page-7498cf75e69d9227.js +1 -0
  101. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-0599f64a8e80d255.js +1 -0
  102. package/.next/static/chunks/app/worktrees/[id]/page-94ad7a1ce1f0c440.js +1 -0
  103. package/.next/static/chunks/app/worktrees/[id]/terminal/page-175b618c047bc992.js +1 -0
  104. package/.next/static/chunks/d3ac728e.daf595a898e9b720.js +1 -0
  105. package/.next/static/chunks/webpack-f7111aab807d73b9.js +1 -0
  106. package/.next/static/css/f7dc01350168df01.css +3 -0
  107. package/.next/trace +5 -5
  108. package/README.md +66 -56
  109. package/dist/server/server.js +5 -0
  110. package/dist/server/src/lib/auto-yes-manager.js +58 -18
  111. package/dist/server/src/lib/claude-session.js +9 -3
  112. package/dist/server/src/lib/cli-session.js +60 -10
  113. package/dist/server/src/lib/cli-tools/codex.js +7 -7
  114. package/dist/server/src/lib/cli-tools/gemini.js +3 -0
  115. package/dist/server/src/lib/cli-tools/opencode-config.js +179 -33
  116. package/dist/server/src/lib/cli-tools/opencode.js +5 -0
  117. package/dist/server/src/lib/cli-tools/vibe-local.js +3 -0
  118. package/dist/server/src/lib/cmate-parser.js +7 -7
  119. package/dist/server/src/lib/db-migrations.js +18 -1
  120. package/dist/server/src/lib/errors.js +153 -0
  121. package/dist/server/src/lib/prompt-answer-sender.js +3 -0
  122. package/dist/server/src/lib/prompt-detector.js +49 -7
  123. package/dist/server/src/lib/resource-cleanup.js +257 -0
  124. package/dist/server/src/lib/schedule-manager.js +269 -83
  125. package/dist/server/src/lib/tmux-capture-cache.js +221 -0
  126. package/dist/server/src/lib/tmux.js +41 -20
  127. package/dist/server/src/types/markdown-editor.js +9 -1
  128. package/package.json +11 -8
  129. package/.next/server/chunks/539.js +0 -35
  130. package/.next/server/chunks/7458.js +0 -1
  131. package/.next/server/chunks/7808.js +0 -1
  132. package/.next/static/chunks/1038-3509435b68c0967e.js +0 -1
  133. package/.next/static/chunks/1098.49268c9fe1b028fa.js +0 -1
  134. package/.next/static/chunks/2335-98a211e00b94c7ac.js +0 -1
  135. package/.next/static/chunks/3559.f073f72c4466ce0e.js +0 -1
  136. package/.next/static/chunks/3843.3fdda732987f7bb8.js +0 -1
  137. package/.next/static/chunks/4212.52c1bb34fc97d0d0.js +0 -131
  138. package/.next/static/chunks/4327.157a4c226d919531.js +0 -60
  139. package/.next/static/chunks/4362.7bd6f0282e49d79b.js +0 -1
  140. package/.next/static/chunks/4721.40615a5f4f32b5fb.js +0 -1
  141. package/.next/static/chunks/5112.17318d1c6b28044b.js +0 -1
  142. package/.next/static/chunks/6406.9653f0d41ab85059.js +0 -1
  143. package/.next/static/chunks/6792.3c01ac4dda4b5c6d.js +0 -1
  144. package/.next/static/chunks/8091-d65d2ab6daed23c6.js +0 -1
  145. package/.next/static/chunks/8125.245a9df052d274fb.js +0 -1
  146. package/.next/static/chunks/8522.1607e96011c66877.js +0 -1
  147. package/.next/static/chunks/8841.dadeb1ece8e46004.js +0 -1
  148. package/.next/static/chunks/8885.f8d9912b40d74811.js +0 -1
  149. package/.next/static/chunks/9178-88850a7c48deea07.js +0 -1
  150. package/.next/static/chunks/9552.b7dfb7903ead934b.js +0 -1
  151. package/.next/static/chunks/app/layout-9110f9a5e41c6bf4.js +0 -1
  152. package/.next/static/chunks/app/page-9e523a8f415bc707.js +0 -1
  153. package/.next/static/chunks/app/worktrees/[id]/files/[...path]/page-4a3c0861367e0391.js +0 -1
  154. package/.next/static/chunks/app/worktrees/[id]/page-8fb4dc30b58a5681.js +0 -1
  155. package/.next/static/chunks/app/worktrees/[id]/terminal/page-5d85a7e508ce36d3.js +0 -1
  156. package/.next/static/chunks/d3ac728e.6c9c508274d4d2d5.js +0 -1
  157. package/.next/static/chunks/webpack-81c97591dd5567ac.js +0 -1
  158. package/.next/static/css/45b3a41370668314.css +0 -3
  159. /package/.next/static/chunks/{30d07d85-393352a92199f695.js → 30d07d85.1dc99a921fc18e34.js} +0 -0
  160. /package/.next/static/{p3hosTZoJ22r35fWwUoLr → dwGMLEU53HOvFOWqiZOT0}/_buildManifest.js +0 -0
  161. /package/.next/static/{p3hosTZoJ22r35fWwUoLr → dwGMLEU53HOvFOWqiZOT0}/_ssgManifest.js +0 -0
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=7601,e.ids=[7601],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},19496:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>R,patchFetch:()=>I,requestAsyncStorage:()=>T,routeModule:()=>S,serverHooks:()=>M,staticGenerationAsyncStorage:()=>A});var n={};r.r(n),r.d(n,{GET:()=>D});var o=r(49303),i=r(88716),s=r(60670),a=r(87070),c=r(97425),u=r(75748),l=r(20629),d=r(55315),f=r(57440),p=r(18163);let m=[...r(81481).P7,".exe",".dll",".so",".dylib",".bin",".zip",".tar",".gz",".tar.gz",".tgz",".rar",".7z",".bz2",".xz",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".avi",".mov",".mkv",".wav",".flac",".ogg",".sqlite",".db",".o",".obj",".a",".lib",".class",".jar",".war",".pyc",".pyo",".wasm"];function h(e){return!!e&&0!==e.trim().length&&!(e.length>1e3)}async function g(e,t,r){let{query:n,maxResults:o=100,maxFileSize:i=p.bB.MAX_FILE_SIZE_PREVIEW,maxDepth:s=p.bB.MAX_DEPTH}=t;if(!h(n))return{results:[],totalMatches:0,truncated:!1};let a={results:[],totalMatches:0,truncated:!1,startTime:Date.now()},c={basePath:e,lowerQuery:n.toLowerCase(),maxDepth:s,maxResults:o,maxFileSize:i,signal:r};return await x(e,0,c,a),{results:a.results,totalMatches:a.totalMatches,truncated:a.truncated}}async function x(e,t,r,n){let o;let{basePath:i,maxDepth:s,maxResults:a,signal:c}=r;if(c?.aborted)throw new DOMException("Search aborted","AbortError");if(!(t>s)){if(n.results.length>=a){n.truncated=!0;return}if((0,f.j)(e,i)){try{o=await (0,l.readdir)(e)}catch{return}for(let s of o){if(c?.aborted)throw new DOMException("Search aborted","AbortError");if(n.results.length>=a){n.truncated=!0;return}if((0,p.bS)(s))continue;let o=(0,d.join)(e,s);if((0,f.j)(o,i))try{let e=await (0,l.lstat)(o);if(e.isSymbolicLink())continue;e.isDirectory()?await x(o,t+1,r,n):e.isFile()&&await y(o,s,e.size,r,n)}catch{continue}}}}}async function y(e,t,r,n,o){let i,s;let{basePath:a,lowerQuery:c,maxFileSize:u}=n;if(!(r>u||function(e){if(!e)return!1;let t=e.startsWith(".")?e.toLowerCase():"."+e.toLowerCase();return m.includes(t)}((0,d.extname)(t)))){try{i=await (0,l.readFile)(e)}catch{return}if(!i.includes(0)){try{s=i.toString("utf-8")}catch{return}if(s.toLowerCase().includes(c)){let r=function(e,t){let r=e.split("\n"),n=t.toLowerCase(),o=[];for(let e=0;e<r.length;e++){let t=r[e];t.toLowerCase().includes(n)&&o.push({line:e+1,content:function(e,t=500){return e.length<=t?e:e.slice(0,t)+"..."}(t)})}return o}(s,c);if(r.length>0){let n=(0,d.relative)(a,e);o.results.push({filePath:n,fileName:(0,d.basename)(t),matches:r}),o.totalMatches+=r.length}}}}}class w extends Error{constructor(e="Search timed out"){super(e),this.name="SearchTimeoutError"}}async function v(e,t){let r=t.timeoutMs??5e3,n=new AbortController,o=setTimeout(()=>n.abort(),r),i=Date.now();try{let r=await g(e,t,n.signal),o=Date.now()-i;return{...r,executionTimeMs:o}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new w(`Search timed out after ${r}ms`);throw e}finally{clearTimeout(o)}}var E=r(43895);let b=(0,E.h)("api-search");async function D(e,{params:t}){let r=Date.now(),n=(0,E.Y)(),o=t.id,i=b.withContext({worktreeId:o,requestId:n});try{let t=e.nextUrl.searchParams,r=t.get("q")||"",n=t.get("mode")||"content";if("content"!==n)return i.warn("search:invalid-mode",{mode:n}),a.NextResponse.json({success:!1,error:{code:"INVALID_MODE",message:"Only mode=content is supported for API search"}},{status:400});if(!h(r))return i.warn("search:invalid-query",{queryLength:r.length}),a.NextResponse.json({success:!1,error:{code:"INVALID_QUERY",message:"Query cannot be empty or exceed 1000 characters"}},{status:400});let s=(0,c.getDbInstance)(),l=(0,u.gU)(s,o);if(!l){let e=(0,p.dq)(o);return i.warn("search:worktree-not-found"),a.NextResponse.json({success:!1,error:{code:"WORKTREE_NOT_FOUND",message:e.error}},{status:e.status})}let d=await v(l.path,{query:r,maxResults:100,timeoutMs:5e3});return i.info("search:complete",{queryHash:Buffer.from(r).toString("base64").slice(0,8),executionTimeMs:d.executionTimeMs,resultCount:d.results.length,totalMatches:d.totalMatches,truncated:d.truncated}),a.NextResponse.json({success:!0,results:d.results,totalMatches:d.totalMatches,truncated:d.truncated,executionTimeMs:d.executionTimeMs})}catch(t){if(t instanceof w){let e=Date.now()-r;return i.warn("search:timeout",{executionTimeMs:e}),a.NextResponse.json({success:!1,error:{code:"SEARCH_TIMEOUT",message:"Search timed out. Try a more specific query."}},{status:408})}let e=Date.now()-r;return i.error("search:error",{error:t instanceof Error?t.message:"Unknown error",executionTimeMs:e}),a.NextResponse.json({success:!1,error:{code:"INTERNAL_ERROR",message:"An error occurred while searching"}},{status:500})}}let S=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/search/route",pathname:"/api/worktrees/[id]/search",filename:"route",bundlePath:"app/api/worktrees/[id]/search/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/search/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:T,staticGenerationAsyncStorage:A,serverHooks:M}=S,R="/api/worktrees/[id]/search/route";function I(){return(0,s.patchFetch)({serverHooks:M,staticGenerationAsyncStorage:A})}},81481:(e,t,r)=>{r.d(t,{Ab:()=>i,Db:()=>a,Kc:()=>s,P7:()=>n,gp:()=>c});let n=[".png",".jpg",".jpeg",".gif",".webp",".svg"],o=[{extension:".png",mimeType:"image/png",magicBytes:[137,80,78,71]},{extension:".jpg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".jpeg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".gif",mimeType:"image/gif",magicBytes:[71,73,70,56]},{extension:".webp",mimeType:"image/webp",magicBytes:[82,73,70,70]},{extension:".svg",mimeType:"image/svg+xml"}];function i(e){return e?e.startsWith(".")?e.toLowerCase():"."+e.toLowerCase():""}function s(e){let t=i(e),r=o.find(e=>e.extension===t);return r?.mimeType||"application/octet-stream"}function a(e){if(!e)return!1;let t=i(e);return n.includes(t)}function c(e,t){if(t.length>5242880)return{valid:!1,error:"File size exceeds 5MB limit"};if(".svg"===i(e)){var r;return(r=t.toString("utf-8")).includes("<svg")||r.startsWith("<?xml")?/<script[\s>]/i.test(r)?{valid:!1,error:"SVG contains script tags"}:/\s+on\w+\s*=/i.test(r)?{valid:!1,error:"SVG contains event handler attributes"}:/(?:xlink:)?href\s*=\s*["']?\s*(?:javascript|data|vbscript):/i.test(r)?{valid:!1,error:"SVG contains dangerous URI scheme"}:/<foreignObject[\s>]/i.test(r)?{valid:!1,error:"SVG contains foreignObject element"}:{valid:!0}:{valid:!1,error:"Invalid SVG format"}}return!function(e,t){let r=i(e),n=o.find(e=>e.extension===r);if(!n?.magicBytes)return".svg"===r;let s=n.magicBytesOffset||0;return!(t.length<s+n.magicBytes.length)&&n.magicBytes.every((e,r)=>t[s+r]===e)}(e,t)?{valid:!1,error:"Invalid image magic bytes"}:{valid:!0}}},18163:(e,t,r)=>{r.d(t,{GT:()=>l,Lu:()=>u,W:()=>f,bB:()=>s,bS:()=>a,dq:()=>d});var n=r(20629),o=r(55315);let i=[".git",".env",".env.*","node_modules",".DS_Store","Thumbs.db","*.pem","*.key",".env.local",".env.development",".env.production",".env.test"],s={MAX_ITEMS_PER_DIR:500,MAX_DEPTH:10,MAX_FILE_SIZE_PREVIEW:1048576};function a(e){for(let t of i){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(1);if(e.endsWith(r))return!0}if(t.endsWith(".*")){let r=t.slice(0,-2);if(e.startsWith(r+"."))return!0}}return!1}async function c(e){try{return(await (0,n.readdir)(e)).filter(e=>!a(e)).length}catch{return 0}}async function u(e,t=""){let r;let i=t?(0,o.join)(e,t):e;try{r=await (0,n.stat)(i)}catch{throw Error(`Directory not found: ${t||"(root)"}`)}if(!r.isDirectory())throw Error(`Path is not a directory: ${t}`);let u=await (0,n.readdir)(i),l=[];for(let e of u){if(a(e))continue;let t=(0,o.join)(i,e);try{let r=await (0,n.lstat)(t);if(r.isSymbolicLink())continue;if(r.isDirectory()){let r=await c(t);l.push({name:e,type:"directory",itemCount:r})}else if(r.isFile()){let t=(0,o.extname)(e),n={name:e,type:"file",size:r.size,birthtime:r.birthtime.toISOString()};t&&t.length>1&&(n.extension=t.slice(1)),l.push(n)}}catch{continue}if(l.length>=s.MAX_ITEMS_PER_DIR)break}let d=[...l].sort((e,t)=>e.type!==t.type?"directory"===e.type?-1:1:e.name.toLowerCase().localeCompare(t.name.toLowerCase())),f=null;if(t){let e=(0,o.dirname)(t);f="."===e?"":e}return{path:t,name:t?(0,o.basename)(t):"",items:d,parentPath:f}}function l(e){let t=e instanceof Error?e.message:"Unknown error";return t.includes("not found")?{error:"Directory not found",status:404}:t.includes("not a directory")?{error:"Path is not a directory",status:400}:{error:"Failed to read directory",status:500}}function d(e){return{error:`Worktree '${e}' not found`,status:404}}function f(e="Invalid path"){return{error:`Access denied: ${e}`,status:403}}},43895:(e,t,r)=>{r.d(t,{Y:()=>c,h:()=>u});var n=r(98838);let o=[{pattern:/Bearer\s+[A-Za-z0-9\-._~+/]+=*/gi,replacement:"Bearer [REDACTED]"},{pattern:/(password|passwd|pwd)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/(token|secret|api_key|apikey|auth)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/Authorization:\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/-----BEGIN\s+\w+\s+PRIVATE\s+KEY-----[\s\S]*?-----END\s+\w+\s+PRIVATE\s+KEY-----/g,replacement:"[SSH_KEY_REDACTED]"}],i=/password|secret|token|key|auth/i,s={debug:0,info:1,warn:2,error:3};function a(e,t,r,a,c){let u=(0,n.LI)().level;if(s[e]<s[u])return;let l=a?function e(t){if("string"==typeof t){let e=t;for(let{pattern:t,replacement:r}of o)e=e.replace(t,r);return e}if("object"==typeof t&&null!==t){if(Array.isArray(t))return t.map(e);let r={};for(let[n,o]of Object.entries(t))i.test(n)?r[n]="[REDACTED]":r[n]=e(o);return r}return t}(a):void 0,d=function(e){if("json"===(0,n.LI)().format)return JSON.stringify(e);let{timestamp:t,level:r,module:o,action:i,data:s,worktreeId:a,cliToolId:c,requestId:u}=e,l=[a,c].filter(Boolean),d=l.length>0?` [${l.join(":")}]`:"",f=u?` (${u.slice(0,8)})`:"",p=s?` ${JSON.stringify(s)}`:"";return`[${t}] [${r.toUpperCase()}] [${o}]${d}${f} ${i}${p}`}({level:e,module:t,action:r,timestamp:new Date().toISOString(),...c,...l&&{data:l}});switch(e){case"error":console.error(d);break;case"warn":console.warn(d);break;default:console.log(d)}}function c(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function u(e){let t=r=>({debug:(t,n)=>a("debug",e,t,n,r),info:(t,n)=>a("info",e,t,n,r),warn:(t,n)=>a("warn",e,t,n,r),error:(t,n)=>a("error",e,t,n,r),withContext:e=>t({...r,...e})});return t()}},57440:(e,t,r)=>{r.d(t,{j:()=>i});var n=r(55315),o=r.n(n);function i(e,t){if(!e||""===e.trim()||e.includes("\0"))return!1;let r=e;try{r=decodeURIComponent(e)}catch{r=e}if(r.includes("\0"))return!1;let n=o().resolve(t),i=o().resolve(t,r),s=o().relative(n,i);return!(s.startsWith("..")||o().isAbsolute(s))}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,5972,7425],()=>r(19496));module.exports=n})();
1
+ "use strict";(()=>{var e={};e.id=7601,e.ids=[7601],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},19496:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>I,patchFetch:()=>R,requestAsyncStorage:()=>T,routeModule:()=>D,serverHooks:()=>A,staticGenerationAsyncStorage:()=>j});var n={};r.r(n),r.d(n,{GET:()=>S});var o=r(49303),i=r(88716),a=r(60670),s=r(87070),c=r(97425),l=r(75748),u=r(20629),d=r(55315),f=r(57440),p=r(18163);let m=[...r(81481).P7,".exe",".dll",".so",".dylib",".bin",".zip",".tar",".gz",".tar.gz",".tgz",".rar",".7z",".bz2",".xz",".pdf",".doc",".docx",".xls",".xlsx",".ppt",".pptx",".woff",".woff2",".ttf",".otf",".eot",".mp3",".mp4",".avi",".mov",".mkv",".wav",".flac",".ogg",".sqlite",".db",".o",".obj",".a",".lib",".class",".jar",".war",".pyc",".pyo",".wasm"];function h(e){return!!e&&0!==e.trim().length&&!(e.length>1e3)}async function g(e,t,r){let{query:n,maxResults:o=100,maxFileSize:i=p.bB.MAX_FILE_SIZE_PREVIEW,maxDepth:a=p.bB.MAX_DEPTH}=t;if(!h(n))return{results:[],totalMatches:0,truncated:!1};let s={results:[],totalMatches:0,truncated:!1,startTime:Date.now()},c={basePath:e,lowerQuery:n.toLowerCase(),maxDepth:a,maxResults:o,maxFileSize:i,signal:r};return await y(e,0,c,s),{results:s.results,totalMatches:s.totalMatches,truncated:s.truncated}}async function y(e,t,r,n){let o;let{basePath:i,maxDepth:a,maxResults:s,signal:c}=r;if(c?.aborted)throw new DOMException("Search aborted","AbortError");if(!(t>a)){if(n.results.length>=s){n.truncated=!0;return}if((0,f.jj)(e,i)){try{o=await (0,u.readdir)(e)}catch{return}for(let a of o){if(c?.aborted)throw new DOMException("Search aborted","AbortError");if(n.results.length>=s){n.truncated=!0;return}if((0,p.bS)(a))continue;let o=(0,d.join)(e,a);if((0,f.jj)(o,i))try{let e=await (0,u.lstat)(o);if(e.isSymbolicLink())continue;e.isDirectory()?await y(o,t+1,r,n):e.isFile()&&await x(o,a,e.size,r,n)}catch{continue}}}}}async function x(e,t,r,n,o){let i,a;let{basePath:s,lowerQuery:c,maxFileSize:l}=n;if(!(r>l||function(e){if(!e)return!1;let t=e.startsWith(".")?e.toLowerCase():"."+e.toLowerCase();return m.includes(t)}((0,d.extname)(t)))){try{i=await (0,u.readFile)(e)}catch{return}if(!i.includes(0)){try{a=i.toString("utf-8")}catch{return}if(a.toLowerCase().includes(c)){let r=function(e,t){let r=e.split("\n"),n=t.toLowerCase(),o=[];for(let e=0;e<r.length;e++){let t=r[e];t.toLowerCase().includes(n)&&o.push({line:e+1,content:function(e,t=500){return e.length<=t?e:e.slice(0,t)+"..."}(t)})}return o}(a,c);if(r.length>0){let n=(0,d.relative)(s,e);o.results.push({filePath:n,fileName:(0,d.basename)(t),matches:r}),o.totalMatches+=r.length}}}}}class w extends Error{constructor(e="Search timed out"){super(e),this.name="SearchTimeoutError"}}async function v(e,t){let r=t.timeoutMs??5e3,n=new AbortController,o=setTimeout(()=>n.abort(),r),i=Date.now();try{let r=await g(e,t,n.signal),o=Date.now()-i;return{...r,executionTimeMs:o}}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)throw new w(`Search timed out after ${r}ms`);throw e}finally{clearTimeout(o)}}var E=r(43895);let b=(0,E.h)("api-search");async function S(e,{params:t}){let r=Date.now(),n=(0,E.Y)(),o=t.id,i=b.withContext({worktreeId:o,requestId:n});try{let t=e.nextUrl.searchParams,r=t.get("q")||"",n=t.get("mode")||"content";if("content"!==n)return i.warn("search:invalid-mode",{mode:n}),s.NextResponse.json({success:!1,error:{code:"INVALID_MODE",message:"Only mode=content is supported for API search"}},{status:400});if(!h(r))return i.warn("search:invalid-query",{queryLength:r.length}),s.NextResponse.json({success:!1,error:{code:"INVALID_QUERY",message:"Query cannot be empty or exceed 1000 characters"}},{status:400});let a=(0,c.getDbInstance)(),u=(0,l.gU)(a,o);if(!u){let e=(0,p.dq)(o);return i.warn("search:worktree-not-found"),s.NextResponse.json({success:!1,error:{code:"WORKTREE_NOT_FOUND",message:e.error}},{status:e.status})}let d=await v(u.path,{query:r,maxResults:100,timeoutMs:5e3});return i.info("search:complete",{queryHash:Buffer.from(r).toString("base64").slice(0,8),executionTimeMs:d.executionTimeMs,resultCount:d.results.length,totalMatches:d.totalMatches,truncated:d.truncated}),s.NextResponse.json({success:!0,results:d.results,totalMatches:d.totalMatches,truncated:d.truncated,executionTimeMs:d.executionTimeMs})}catch(t){if(t instanceof w){let e=Date.now()-r;return i.warn("search:timeout",{executionTimeMs:e}),s.NextResponse.json({success:!1,error:{code:"SEARCH_TIMEOUT",message:"Search timed out. Try a more specific query."}},{status:408})}let e=Date.now()-r;return i.error("search:error",{error:t instanceof Error?t.message:"Unknown error",executionTimeMs:e}),s.NextResponse.json({success:!1,error:{code:"INTERNAL_ERROR",message:"An error occurred while searching"}},{status:500})}}let D=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/search/route",pathname:"/api/worktrees/[id]/search",filename:"route",bundlePath:"app/api/worktrees/[id]/search/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/search/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:T,staticGenerationAsyncStorage:j,serverHooks:A}=D,I="/api/worktrees/[id]/search/route";function R(){return(0,a.patchFetch)({serverHooks:A,staticGenerationAsyncStorage:j})}},81481:(e,t,r)=>{r.d(t,{Ab:()=>i,Db:()=>s,Kc:()=>a,P7:()=>n,gp:()=>c});let n=[".png",".jpg",".jpeg",".gif",".webp",".svg"],o=[{extension:".png",mimeType:"image/png",magicBytes:[137,80,78,71]},{extension:".jpg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".jpeg",mimeType:"image/jpeg",magicBytes:[255,216,255]},{extension:".gif",mimeType:"image/gif",magicBytes:[71,73,70,56]},{extension:".webp",mimeType:"image/webp",magicBytes:[82,73,70,70]},{extension:".svg",mimeType:"image/svg+xml"}];function i(e){return e?e.startsWith(".")?e.toLowerCase():"."+e.toLowerCase():""}function a(e){let t=i(e),r=o.find(e=>e.extension===t);return r?.mimeType||"application/octet-stream"}function s(e){if(!e)return!1;let t=i(e);return n.includes(t)}function c(e,t){if(t.length>5242880)return{valid:!1,error:"File size exceeds 5MB limit"};if(".svg"===i(e)){var r;return(r=t.toString("utf-8")).includes("<svg")||r.startsWith("<?xml")?/<script[\s>]/i.test(r)?{valid:!1,error:"SVG contains script tags"}:/\s+on\w+\s*=/i.test(r)?{valid:!1,error:"SVG contains event handler attributes"}:/(?:xlink:)?href\s*=\s*["']?\s*(?:javascript|data|vbscript):/i.test(r)?{valid:!1,error:"SVG contains dangerous URI scheme"}:/<foreignObject[\s>]/i.test(r)?{valid:!1,error:"SVG contains foreignObject element"}:{valid:!0}:{valid:!1,error:"Invalid SVG format"}}return!function(e,t){let r=i(e),n=o.find(e=>e.extension===r);if(!n?.magicBytes)return".svg"===r;let a=n.magicBytesOffset||0;return!(t.length<a+n.magicBytes.length)&&n.magicBytes.every((e,r)=>t[a+r]===e)}(e,t)?{valid:!1,error:"Invalid image magic bytes"}:{valid:!0}}},18163:(e,t,r)=>{r.d(t,{GT:()=>u,Lu:()=>l,W:()=>f,bB:()=>a,bS:()=>s,dq:()=>d});var n=r(20629),o=r(55315);let i=[".git",".env",".env.*","node_modules",".DS_Store","Thumbs.db","*.pem","*.key",".env.local",".env.development",".env.production",".env.test"],a={MAX_ITEMS_PER_DIR:500,MAX_DEPTH:10,MAX_FILE_SIZE_PREVIEW:1048576};function s(e){for(let t of i){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(1);if(e.endsWith(r))return!0}if(t.endsWith(".*")){let r=t.slice(0,-2);if(e.startsWith(r+"."))return!0}}return!1}async function c(e){try{return(await (0,n.readdir)(e)).filter(e=>!s(e)).length}catch{return 0}}async function l(e,t=""){let r;let i=t?(0,o.join)(e,t):e;try{r=await (0,n.stat)(i)}catch{throw Error(`Directory not found: ${t||"(root)"}`)}if(!r.isDirectory())throw Error(`Path is not a directory: ${t}`);let l=await (0,n.readdir)(i),u=[];for(let e of l){if(s(e))continue;let t=(0,o.join)(i,e);try{let r=await (0,n.lstat)(t);if(r.isSymbolicLink())continue;if(r.isDirectory()){let r=await c(t);u.push({name:e,type:"directory",itemCount:r})}else if(r.isFile()){let t=(0,o.extname)(e),n={name:e,type:"file",size:r.size,birthtime:r.birthtime.toISOString()};t&&t.length>1&&(n.extension=t.slice(1)),u.push(n)}}catch{continue}if(u.length>=a.MAX_ITEMS_PER_DIR)break}let d=[...u].sort((e,t)=>e.type!==t.type?"directory"===e.type?-1:1:e.name.toLowerCase().localeCompare(t.name.toLowerCase())),f=null;if(t){let e=(0,o.dirname)(t);f="."===e?"":e}return{path:t,name:t?(0,o.basename)(t):"",items:d,parentPath:f}}function u(e){let t=e instanceof Error?e.message:"Unknown error";return t.includes("not found")?{error:"Directory not found",status:404}:t.includes("not a directory")?{error:"Path is not a directory",status:400}:{error:"Failed to read directory",status:500}}function d(e){return{error:`Worktree '${e}' not found`,status:404}}function f(e="Invalid path"){return{error:`Access denied: ${e}`,status:403}}},43895:(e,t,r)=>{r.d(t,{Y:()=>c,h:()=>l});var n=r(98838);let o=[{pattern:/Bearer\s+[A-Za-z0-9\-._~+/]+=*/gi,replacement:"Bearer [REDACTED]"},{pattern:/(password|passwd|pwd)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/(token|secret|api_key|apikey|auth)[=:]\s*\S+/gi,replacement:"$1=[REDACTED]"},{pattern:/Authorization:\s*\S+/gi,replacement:"Authorization: [REDACTED]"},{pattern:/-----BEGIN\s+\w+\s+PRIVATE\s+KEY-----[\s\S]*?-----END\s+\w+\s+PRIVATE\s+KEY-----/g,replacement:"[SSH_KEY_REDACTED]"}],i=/password|secret|token|key|auth/i,a={debug:0,info:1,warn:2,error:3};function s(e,t,r,s,c){let l=(0,n.LI)().level;if(a[e]<a[l])return;let u=s?function e(t){if("string"==typeof t){let e=t;for(let{pattern:t,replacement:r}of o)e=e.replace(t,r);return e}if("object"==typeof t&&null!==t){if(Array.isArray(t))return t.map(e);let r={};for(let[n,o]of Object.entries(t))i.test(n)?r[n]="[REDACTED]":r[n]=e(o);return r}return t}(s):void 0,d=function(e){if("json"===(0,n.LI)().format)return JSON.stringify(e);let{timestamp:t,level:r,module:o,action:i,data:a,worktreeId:s,cliToolId:c,requestId:l}=e,u=[s,c].filter(Boolean),d=u.length>0?` [${u.join(":")}]`:"",f=l?` (${l.slice(0,8)})`:"",p=a?` ${JSON.stringify(a)}`:"";return`[${t}] [${r.toUpperCase()}] [${o}]${d}${f} ${i}${p}`}({level:e,module:t,action:r,timestamp:new Date().toISOString(),...c,...u&&{data:u}});switch(e){case"error":console.error(d);break;case"warn":console.warn(d);break;default:console.log(d)}}function c(){return"undefined"!=typeof crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function l(e){let t=r=>({debug:(t,n)=>s("debug",e,t,n,r),info:(t,n)=>s("info",e,t,n,r),warn:(t,n)=>s("warn",e,t,n,r),error:(t,n)=>s("error",e,t,n,r),withContext:e=>t({...r,...e})});return t()}},57440:(e,t,r)=>{r.d(t,{iH:()=>l,jj:()=>s,kz:()=>c});var n=r(55315),o=r.n(n),i=r(92048);function a(e,t){return e===t||e.startsWith(t+o().sep)}function s(e,t){if(!e||""===e.trim()||e.includes("\0"))return!1;let r=e;try{r=decodeURIComponent(e)}catch{r=e}if(r.includes("\0"))return!1;let n=o().resolve(t),i=o().resolve(t,r),a=o().relative(n,i);return!(a.startsWith("..")||o().isAbsolute(a))}function c(e,t){if(!e||""===e.trim())throw Error("Invalid path: Path cannot be empty");if(e.includes("\0"))throw Error("Invalid path: Null bytes not allowed");if(!s(e,t))throw Error(`Path is outside allowed directory: ${e} (allowed root: ${t})`);let r=e;try{r=decodeURIComponent(e)}catch{r=e}return o().resolve(t,r)}function l(e,t){let r;try{r=(0,i.realpathSync)(t)}catch{return!1}let n=o().resolve(t,e);if((0,i.existsSync)(n))try{let t=(0,i.realpathSync)(n),o=a(t,r);return o||console.warn(`[SEC-394] symlink traversal rejected: ${e} -> ${t}`),o}catch{return!1}try{if((0,i.lstatSync)(n).isSymbolicLink())try{let t=(0,i.readlinkSync)(n),s=o().resolve(o().dirname(n),t),c=a(s,r);return c||console.warn(`[SEC-394] dangling symlink traversal rejected: ${e} -> ${s}`),c}catch{return!1}}catch{}let s=o().dirname(n);for(;s!==o().dirname(s);){if((0,i.existsSync)(s))try{let e=(0,i.realpathSync)(s),t=a(e,r);return t||console.warn(`[SEC-394] symlink traversal rejected (ancestor): ${s} -> ${e}`),t}catch{break}s=o().dirname(s)}return!1}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,5972,7425],()=>r(19496));module.exports=n})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=7586,e.ids=[7586],e.modules={20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},61282:e=>{e.exports=require("child_process")},21764:e=>{e.exports=require("util")},35135:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>h,patchFetch:()=>f,requestAsyncStorage:()=>d,routeModule:()=>m,serverHooks:()=>w,staticGenerationAsyncStorage:()=>p});var s={};r.r(s),r.d(s,{POST:()=>c});var n=r(49303),i=r(88716),o=r(60670),a=r(87070),u=r(10927);async function c(e,{params:t}){try{var r;let{cliToolId:s,command:n}=await e.json();if(!s||!n)return a.NextResponse.json({error:"Missing cliToolId or command"},{status:400});let i=(r=t.id,`mcbd-${s}-${r}`);return await u.Hk(i)||await u.ed(i,process.cwd()),await l(i,n),a.NextResponse.json({success:!0})}catch(e){return console.error("Terminal API error:",e),a.NextResponse.json({error:e.message},{status:500})}}async function l(e,t){await u.Is(e,t)}let m=new n.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/terminal/route",pathname:"/api/worktrees/[id]/terminal",filename:"route",bundlePath:"app/api/worktrees/[id]/terminal/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/terminal/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:d,staticGenerationAsyncStorage:p,serverHooks:w}=m,h="/api/worktrees/[id]/terminal/route";function f(){return(0,o.patchFetch)({serverHooks:w,staticGenerationAsyncStorage:p})}},10927:(e,t,r)=>{r.d(t,{AJ:()=>m,Hk:()=>i,Is:()=>a,ZV:()=>d,ed:()=>o,hL:()=>c,xq:()=>l});var s=r(61282);let n=(0,r(21764).promisify)(s.exec);async function i(e){try{return await n(`tmux has-session -t "${e}"`,{timeout:5e3}),!0}catch{return!1}}async function o(e,t){let r,s,i;"string"==typeof e?(r=e,s=t,i=5e4):(r=e.sessionName,s=e.workingDirectory,i=e.historyLimit||5e4);try{await n(`tmux new-session -d -s "${r}" -c "${s}"`,{timeout:5e3}),await n(`tmux set-option -t "${r}" history-limit ${i}`,{timeout:5e3})}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to create tmux session: ${e}`)}}async function a(e,t,r=!0){let s=t.replace(/'/g,"'\\''"),i=r?`tmux send-keys -t "${e}" '${s}' C-m`:`tmux send-keys -t "${e}" '${s}'`;try{await n(i,{timeout:5e3})}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to send keys to tmux session: ${e}`)}}let u=new Set(["Up","Down","Left","Right","Enter","Space","Tab","Escape","BSpace","DC"]);async function c(e,t){if(0!==t.length){for(let e of t)if(!u.has(e))throw Error(`Invalid special key: ${e}`);try{for(let r=0;r<t.length;r++){let s=`tmux send-keys -t "${e}" ${t[r]}`;await n(s,{timeout:5e3}),r<t.length-1&&await new Promise(e=>setTimeout(e,100))}}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to send special keys to tmux session: ${e}`)}}}async function l(e,t){let r,s;"number"==typeof t?(r=-t,s="-"):t?(r=t.startLine??-1e4,s=t.endLine??"-"):(r=-1e3,s="-");try{let{stdout:t}=await n(`tmux capture-pane -t "${e}" -p -e -S ${r} -E ${s}`,{timeout:5e3,maxBuffer:10485760});return t}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to capture pane: ${e}`)}}async function m(e){try{return await n(`tmux kill-session -t "${e}"`,{timeout:5e3}),!0}catch(t){let e=t instanceof Error?t.message:String(t);if(e?.includes("no server running")||e?.includes("can't find session"))return!1;throw Error(`Failed to kill tmux session: ${e}`)}}async function d(e,t){try{await n(`tmux send-keys -t "${e}" ${t}`,{timeout:5e3})}catch(t){let e=t instanceof Error?t.message:String(t);throw Error(`Failed to send special key: ${e}`)}}}};var t=require("../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8948,5972],()=>r(35135));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=7586,e.ids=[7586],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},78893:e=>{e.exports=require("buffer")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},98216:e=>{e.exports=require("net")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},82452:e=>{e.exports=require("tls")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},35135:(e,r,t)=>{t.r(r),t.d(r,{originalPathname:()=>v,patchFetch:()=>j,requestAsyncStorage:()=>f,routeModule:()=>q,serverHooks:()=>h,staticGenerationAsyncStorage:()=>g});var s={};t.r(s),t.d(s,{POST:()=>c});var o=t(49303),i=t(88716),n=t(60670),a=t(87070),u=t(83513),p=t(55837),d=t(75748),l=t(97425),m=t(10927),x=t(4633);async function c(e,{params:r}){try{let{cliToolId:t,command:s}=await e.json();if(!t||"string"!=typeof t||!(0,u._7)(t))return a.NextResponse.json({error:"Invalid cliToolId parameter"},{status:400});if(!s||"string"!=typeof s)return a.NextResponse.json({error:"Missing command parameter"},{status:400});if(s.length>1e4)return a.NextResponse.json({error:"Invalid command parameter"},{status:400});let o=(0,l.getDbInstance)();if(!(0,d.gU)(o,r.id))return a.NextResponse.json({error:"Worktree not found"},{status:404});let i=p.g.getInstance().getTool(t).getSessionName(r.id);if(!await (0,m.Hk)(i))return a.NextResponse.json({error:"Session not found. Use startSession API to create a session first."},{status:404});return await (0,m.Is)(i,s),(0,x.e5)(i),a.NextResponse.json({success:!0})}catch(e){return console.error("Terminal API error:",e),a.NextResponse.json({error:"Failed to send command to terminal"},{status:500})}}let q=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/terminal/route",pathname:"/api/worktrees/[id]/terminal",filename:"route",bundlePath:"app/api/worktrees/[id]/terminal/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/terminal/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:f,staticGenerationAsyncStorage:g,serverHooks:h}=q,v="/api/worktrees/[id]/terminal/route";function j(){return(0,n.patchFetch)({serverHooks:h,staticGenerationAsyncStorage:g})}}};var r=require("../../../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[8948,5972,3853,4893,7425,7566,4952],()=>t(35135));module.exports=s})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../../../../node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../../../node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../../../node_modules/next/dist/client/components/async-local-storage.js","../../../../../../../node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../../../node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../../../node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../../../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../../node_modules/next/package.json","../../../../../../../package.json","../../../../../../package.json","../../../../../chunks/5972.js","../../../../../chunks/8948.js","../../../../../webpack-runtime.js"]}
1
+ {"version":1,"files":["../../../../../../../data/cm.db","../../../../../../../node_modules/better-sqlite3/build/Release/better_sqlite3.node","../../../../../../../node_modules/better-sqlite3/lib/database.js","../../../../../../../node_modules/better-sqlite3/lib/index.js","../../../../../../../node_modules/better-sqlite3/lib/methods/aggregate.js","../../../../../../../node_modules/better-sqlite3/lib/methods/backup.js","../../../../../../../node_modules/better-sqlite3/lib/methods/function.js","../../../../../../../node_modules/better-sqlite3/lib/methods/inspect.js","../../../../../../../node_modules/better-sqlite3/lib/methods/pragma.js","../../../../../../../node_modules/better-sqlite3/lib/methods/serialize.js","../../../../../../../node_modules/better-sqlite3/lib/methods/table.js","../../../../../../../node_modules/better-sqlite3/lib/methods/transaction.js","../../../../../../../node_modules/better-sqlite3/lib/methods/wrappers.js","../../../../../../../node_modules/better-sqlite3/lib/sqlite-error.js","../../../../../../../node_modules/better-sqlite3/lib/util.js","../../../../../../../node_modules/better-sqlite3/package.json","../../../../../../../node_modules/bindings/bindings.js","../../../../../../../node_modules/bindings/package.json","../../../../../../../node_modules/file-uri-to-path/index.js","../../../../../../../node_modules/file-uri-to-path/package.json","../../../../../../../node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../../../../node_modules/next/dist/client/components/action-async-storage.external.js","../../../../../../../node_modules/next/dist/client/components/async-local-storage.js","../../../../../../../node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../../../../node_modules/next/dist/client/components/request-async-storage.external.js","../../../../../../../node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../../../../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../../../../node_modules/next/dist/compiled/next-server/app-route.runtime.prod.js","../../../../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../../../../node_modules/next/package.json","../../../../../../../package.json","../../../../../../package.json","../../../../../chunks/3853.js","../../../../../chunks/4893.js","../../../../../chunks/4952.js","../../../../../chunks/5972.js","../../../../../chunks/7425.js","../../../../../chunks/7566.js","../../../../../chunks/8948.js","../../../../../webpack-runtime.js"]}
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=8347,e.ids=[8347],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},74097:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>v,patchFetch:()=>x,requestAsyncStorage:()=>f,routeModule:()=>h,serverHooks:()=>y,staticGenerationAsyncStorage:()=>m});var o={};r.r(o),r.d(o,{GET:()=>p});var n=r(49303),i=r(88716),s=r(60670),a=r(87070),u=r(97425),c=r(75748),d=r(18163),l=r(57440);async function p(e,{params:t}){try{let e=(0,u.getDbInstance)(),r=(0,c.gU)(e,t.id);if(!r){let e=(0,d.dq)(t.id);return a.NextResponse.json({error:e.error},{status:e.status})}let o=t.path.join("/");if(t.path.some(e=>{let t=function(e){try{return decodeURIComponent(e)}catch{return e}}(e);return(0,d.bS)(t)})){let e=(0,d.W)("Path contains excluded pattern");return a.NextResponse.json({error:e.error},{status:e.status})}if(!(0,l.j)(o,r.path)){let e=(0,d.W)("Invalid path");return a.NextResponse.json({error:e.error},{status:e.status})}let n=await (0,d.Lu)(r.path,o);return a.NextResponse.json(n)}catch(t){console.error("Error reading directory:",t);let e=(0,d.GT)(t);return a.NextResponse.json({error:e.error},{status:e.status})}}let h=new n.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/tree/[...path]/route",pathname:"/api/worktrees/[id]/tree/[...path]",filename:"route",bundlePath:"app/api/worktrees/[id]/tree/[...path]/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/tree/[...path]/route.ts",nextConfigOutput:"",userland:o}),{requestAsyncStorage:f,staticGenerationAsyncStorage:m,serverHooks:y}=h,v="/api/worktrees/[id]/tree/[...path]/route";function x(){return(0,s.patchFetch)({serverHooks:y,staticGenerationAsyncStorage:m})}},18163:(e,t,r)=>{r.d(t,{GT:()=>d,Lu:()=>c,W:()=>p,bB:()=>s,bS:()=>a,dq:()=>l});var o=r(20629),n=r(55315);let i=[".git",".env",".env.*","node_modules",".DS_Store","Thumbs.db","*.pem","*.key",".env.local",".env.development",".env.production",".env.test"],s={MAX_ITEMS_PER_DIR:500,MAX_DEPTH:10,MAX_FILE_SIZE_PREVIEW:1048576};function a(e){for(let t of i){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(1);if(e.endsWith(r))return!0}if(t.endsWith(".*")){let r=t.slice(0,-2);if(e.startsWith(r+"."))return!0}}return!1}async function u(e){try{return(await (0,o.readdir)(e)).filter(e=>!a(e)).length}catch{return 0}}async function c(e,t=""){let r;let i=t?(0,n.join)(e,t):e;try{r=await (0,o.stat)(i)}catch{throw Error(`Directory not found: ${t||"(root)"}`)}if(!r.isDirectory())throw Error(`Path is not a directory: ${t}`);let c=await (0,o.readdir)(i),d=[];for(let e of c){if(a(e))continue;let t=(0,n.join)(i,e);try{let r=await (0,o.lstat)(t);if(r.isSymbolicLink())continue;if(r.isDirectory()){let r=await u(t);d.push({name:e,type:"directory",itemCount:r})}else if(r.isFile()){let t=(0,n.extname)(e),o={name:e,type:"file",size:r.size,birthtime:r.birthtime.toISOString()};t&&t.length>1&&(o.extension=t.slice(1)),d.push(o)}}catch{continue}if(d.length>=s.MAX_ITEMS_PER_DIR)break}let l=[...d].sort((e,t)=>e.type!==t.type?"directory"===e.type?-1:1:e.name.toLowerCase().localeCompare(t.name.toLowerCase())),p=null;if(t){let e=(0,n.dirname)(t);p="."===e?"":e}return{path:t,name:t?(0,n.basename)(t):"",items:l,parentPath:p}}function d(e){let t=e instanceof Error?e.message:"Unknown error";return t.includes("not found")?{error:"Directory not found",status:404}:t.includes("not a directory")?{error:"Path is not a directory",status:400}:{error:"Failed to read directory",status:500}}function l(e){return{error:`Worktree '${e}' not found`,status:404}}function p(e="Invalid path"){return{error:`Access denied: ${e}`,status:403}}},57440:(e,t,r)=>{r.d(t,{j:()=>i});var o=r(55315),n=r.n(o);function i(e,t){if(!e||""===e.trim()||e.includes("\0"))return!1;let r=e;try{r=decodeURIComponent(e)}catch{r=e}if(r.includes("\0"))return!1;let o=n().resolve(t),i=n().resolve(t,r),s=n().relative(o,i);return!(s.startsWith("..")||n().isAbsolute(s))}}};var t=require("../../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),o=t.X(0,[8948,5972,7425],()=>r(74097));module.exports=o})();
1
+ "use strict";(()=>{var e={};e.id=8347,e.ids=[8347],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},74097:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>v,patchFetch:()=>w,requestAsyncStorage:()=>f,routeModule:()=>h,serverHooks:()=>m,staticGenerationAsyncStorage:()=>y});var n={};r.r(n),r.d(n,{GET:()=>p});var o=r(49303),i=r(88716),a=r(60670),s=r(87070),u=r(97425),l=r(75748),c=r(18163),d=r(57440);async function p(e,{params:t}){try{let e=(0,u.getDbInstance)(),r=(0,l.gU)(e,t.id);if(!r){let e=(0,c.dq)(t.id);return s.NextResponse.json({error:e.error},{status:e.status})}let n=t.path.join("/");if(t.path.some(e=>{let t=function(e){try{return decodeURIComponent(e)}catch{return e}}(e);return(0,c.bS)(t)})){let e=(0,c.W)("Path contains excluded pattern");return s.NextResponse.json({error:e.error},{status:e.status})}if(!(0,d.jj)(n,r.path)){let e=(0,c.W)("Invalid path");return s.NextResponse.json({error:e.error},{status:e.status})}if(!(0,d.iH)(n,r.path)){let e=(0,c.W)("Invalid path");return s.NextResponse.json({error:e.error},{status:e.status})}let o=await (0,c.Lu)(r.path,n);return s.NextResponse.json(o)}catch(t){console.error("Error reading directory:",t);let e=(0,c.GT)(t);return s.NextResponse.json({error:e.error},{status:e.status})}}let h=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/[id]/tree/[...path]/route",pathname:"/api/worktrees/[id]/tree/[...path]",filename:"route",bundlePath:"app/api/worktrees/[id]/tree/[...path]/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/tree/[...path]/route.ts",nextConfigOutput:"",userland:n}),{requestAsyncStorage:f,staticGenerationAsyncStorage:y,serverHooks:m}=h,v="/api/worktrees/[id]/tree/[...path]/route";function w(){return(0,a.patchFetch)({serverHooks:m,staticGenerationAsyncStorage:y})}},18163:(e,t,r)=>{r.d(t,{GT:()=>c,Lu:()=>l,W:()=>p,bB:()=>a,bS:()=>s,dq:()=>d});var n=r(20629),o=r(55315);let i=[".git",".env",".env.*","node_modules",".DS_Store","Thumbs.db","*.pem","*.key",".env.local",".env.development",".env.production",".env.test"],a={MAX_ITEMS_PER_DIR:500,MAX_DEPTH:10,MAX_FILE_SIZE_PREVIEW:1048576};function s(e){for(let t of i){if(t===e)return!0;if(t.startsWith("*.")){let r=t.slice(1);if(e.endsWith(r))return!0}if(t.endsWith(".*")){let r=t.slice(0,-2);if(e.startsWith(r+"."))return!0}}return!1}async function u(e){try{return(await (0,n.readdir)(e)).filter(e=>!s(e)).length}catch{return 0}}async function l(e,t=""){let r;let i=t?(0,o.join)(e,t):e;try{r=await (0,n.stat)(i)}catch{throw Error(`Directory not found: ${t||"(root)"}`)}if(!r.isDirectory())throw Error(`Path is not a directory: ${t}`);let l=await (0,n.readdir)(i),c=[];for(let e of l){if(s(e))continue;let t=(0,o.join)(i,e);try{let r=await (0,n.lstat)(t);if(r.isSymbolicLink())continue;if(r.isDirectory()){let r=await u(t);c.push({name:e,type:"directory",itemCount:r})}else if(r.isFile()){let t=(0,o.extname)(e),n={name:e,type:"file",size:r.size,birthtime:r.birthtime.toISOString()};t&&t.length>1&&(n.extension=t.slice(1)),c.push(n)}}catch{continue}if(c.length>=a.MAX_ITEMS_PER_DIR)break}let d=[...c].sort((e,t)=>e.type!==t.type?"directory"===e.type?-1:1:e.name.toLowerCase().localeCompare(t.name.toLowerCase())),p=null;if(t){let e=(0,o.dirname)(t);p="."===e?"":e}return{path:t,name:t?(0,o.basename)(t):"",items:d,parentPath:p}}function c(e){let t=e instanceof Error?e.message:"Unknown error";return t.includes("not found")?{error:"Directory not found",status:404}:t.includes("not a directory")?{error:"Path is not a directory",status:400}:{error:"Failed to read directory",status:500}}function d(e){return{error:`Worktree '${e}' not found`,status:404}}function p(e="Invalid path"){return{error:`Access denied: ${e}`,status:403}}},57440:(e,t,r)=>{r.d(t,{iH:()=>l,jj:()=>s,kz:()=>u});var n=r(55315),o=r.n(n),i=r(92048);function a(e,t){return e===t||e.startsWith(t+o().sep)}function s(e,t){if(!e||""===e.trim()||e.includes("\0"))return!1;let r=e;try{r=decodeURIComponent(e)}catch{r=e}if(r.includes("\0"))return!1;let n=o().resolve(t),i=o().resolve(t,r),a=o().relative(n,i);return!(a.startsWith("..")||o().isAbsolute(a))}function u(e,t){if(!e||""===e.trim())throw Error("Invalid path: Path cannot be empty");if(e.includes("\0"))throw Error("Invalid path: Null bytes not allowed");if(!s(e,t))throw Error(`Path is outside allowed directory: ${e} (allowed root: ${t})`);let r=e;try{r=decodeURIComponent(e)}catch{r=e}return o().resolve(t,r)}function l(e,t){let r;try{r=(0,i.realpathSync)(t)}catch{return!1}let n=o().resolve(t,e);if((0,i.existsSync)(n))try{let t=(0,i.realpathSync)(n),o=a(t,r);return o||console.warn(`[SEC-394] symlink traversal rejected: ${e} -> ${t}`),o}catch{return!1}try{if((0,i.lstatSync)(n).isSymbolicLink())try{let t=(0,i.readlinkSync)(n),s=o().resolve(o().dirname(n),t),u=a(s,r);return u||console.warn(`[SEC-394] dangling symlink traversal rejected: ${e} -> ${s}`),u}catch{return!1}}catch{}let s=o().dirname(n);for(;s!==o().dirname(s);){if((0,i.existsSync)(s))try{let e=(0,i.realpathSync)(s),t=a(e,r);return t||console.warn(`[SEC-394] symlink traversal rejected (ancestor): ${s} -> ${e}`),t}catch{break}s=o().dirname(s)}return!1}}};var t=require("../../../../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,5972,7425],()=>r(74097));module.exports=n})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=1210,e.ids=[1210],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},14276:(e,t,i)=>{i.r(t),i.d(t,{originalPathname:()=>w,patchFetch:()=>L,requestAsyncStorage:()=>N,routeModule:()=>g,serverHooks:()=>_,staticGenerationAsyncStorage:()=>T});var r={};i.r(r),i.d(r,{POST:()=>E});var a=i(49303),o=i(88716),n=i(60670),s=i(87070),l=i(97425),p=i(75748),u=i(55315),m=i(57440),d=i(68585);let c=[{extension:".png",maxFileSize:5242880,allowedMimeTypes:["image/png"],magicBytes:[{bytes:[137,80,78,71,13,10,26,10]}]},{extension:".jpg",maxFileSize:5242880,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".jpeg",maxFileSize:5242880,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".gif",maxFileSize:5242880,allowedMimeTypes:["image/gif"],magicBytes:[{bytes:[71,73,70,56,55,97]},{bytes:[71,73,70,56,57,97]}]},{extension:".webp",maxFileSize:5242880,allowedMimeTypes:["image/webp"],magicBytes:[{bytes:[82,73,70,70],offset:0}]},{extension:".mp4",maxFileSize:15728640,allowedMimeTypes:["video/mp4"],magicBytes:[{bytes:[102,116,121,112],offset:4}]},{extension:".txt",maxFileSize:5242880,allowedMimeTypes:["text/plain"]},{extension:".log",maxFileSize:5242880,allowedMimeTypes:["text/plain"]},{extension:".md",maxFileSize:5242880,allowedMimeTypes:["text/markdown","text/plain"]},{extension:".csv",maxFileSize:5242880,allowedMimeTypes:["text/csv"]},{extension:".json",maxFileSize:5242880,allowedMimeTypes:["application/json"]},{extension:".yaml",maxFileSize:5242880,allowedMimeTypes:["text/yaml","application/x-yaml"]},{extension:".yml",maxFileSize:5242880,allowedMimeTypes:["text/yaml","application/x-yaml"]}],y=c.map(e=>e.extension);function x(e){let t=e.toLowerCase();return c.find(e=>e.extension===t)}let I={FILE_NOT_FOUND:404,WORKTREE_NOT_FOUND:404,PERMISSION_DENIED:403,INVALID_PATH:400,INVALID_REQUEST:400,FILE_EXISTS:409,DISK_FULL:507,INTERNAL_ERROR:500,INVALID_EXTENSION:400,INVALID_MIME_TYPE:400,INVALID_MAGIC_BYTES:400,FILE_TOO_LARGE:413,INVALID_FILENAME:400,INVALID_FILE_CONTENT:400};function f(e,t,i=500){if("string"==typeof e){let r=I[e]??i;return s.NextResponse.json({success:!1,error:{code:e,message:t}},{status:r})}let r=e.error?.code??"INTERNAL_ERROR",a=e.error?.message??"Unknown error",o=I[r]??i;return s.NextResponse.json({success:!1,error:{code:r,message:a}},{status:o})}async function E(e,{params:t}){try{let r;let a=(0,l.getDbInstance)(),o=(0,p.gU)(a,t.id);if(!o)return f("WORKTREE_NOT_FOUND","Worktree not found");let n=t.path.join("/"),c=(0,u.normalize)(n);if(!(0,m.j)(c,o.path))return f("INVALID_PATH","Invalid file path");try{r=await e.formData()}catch{return f("INVALID_REQUEST","Invalid form data",400)}let I=r.get("file");if(!I||!(I instanceof File))return f("INVALID_REQUEST","File is required",400);let E=I.name,g=I.type,N=I.size,T=(0,u.extname)(E).toLowerCase();if(!function(e){if(!e)return!1;let t=e.toLowerCase();return y.includes(t)}(T))return f((0,d.wZ)("INVALID_EXTENSION"));if(!function(e,t){let i=x(e);return i?.allowedMimeTypes.includes(t)??!1}(T,g))return f((0,d.wZ)("INVALID_MIME_TYPE"));let _=function(e){let t=x(e);return t?.maxFileSize??5242880}(T);if(N>_)return f((0,d.wZ)("FILE_TOO_LARGE"));let w=await I.arrayBuffer(),L=Buffer.from(w);if(!function(e,t){let i=x(e);return!i?.magicBytes||0===i.magicBytes.length||i.magicBytes.some(e=>{let i=e.offset??0;return!(t.length<i+e.bytes.length)&&e.bytes.every((e,r)=>t[i+r]===e)})}(T,L))return f((0,d.wZ)("INVALID_MAGIC_BYTES"));if(!(0,d.TG)(E,{forUpload:!0}).valid)return f((0,d.wZ)("INVALID_FILENAME"));if(".yaml"===T||".yml"===T){var i;if(i=L.toString("utf-8"),[/!ruby\/object/i,/!python\/object/i,/!!python/i,/!!ruby/i,/!<tag:yaml\.org,2002:python/i,/!<tag:yaml\.org,2002:ruby/i].some(e=>e.test(i)))return f((0,d.wZ)("INVALID_FILE_CONTENT"))}if(".json"===T){let e=L.toString("utf-8");if(!function(e){try{return JSON.parse(e),!0}catch{return!1}}(e))return f((0,d.wZ)("INVALID_FILE_CONTENT"))}let F=c?`${c}/${E}`:E,S=await (0,d.Kr)(o.path,F,L);if(!S.success)return f(S);return s.NextResponse.json({success:!0,path:S.path,filename:E,size:S.size},{status:201})}catch(e){return console.error("Error uploading file:",e),f("INTERNAL_ERROR","Failed to upload file")}}let g=new a.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/worktrees/[id]/upload/[...path]/route",pathname:"/api/worktrees/[id]/upload/[...path]",filename:"route",bundlePath:"app/api/worktrees/[id]/upload/[...path]/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/upload/[...path]/route.ts",nextConfigOutput:"",userland:r}),{requestAsyncStorage:N,staticGenerationAsyncStorage:T,serverHooks:_}=g,w="/api/worktrees/[id]/upload/[...path]/route";function L(){return(0,n.patchFetch)({serverHooks:_,staticGenerationAsyncStorage:T})}}};var t=require("../../../../../../webpack-runtime.js");t.C(e);var i=e=>t(t.s=e),r=t.X(0,[8948,5972,7425,8585],()=>i(14276));module.exports=r})();
1
+ "use strict";(()=>{var e={};e.id=1210,e.ids=[1210],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},84770:e=>{e.exports=require("crypto")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},14276:(e,t,i)=>{i.r(t),i.d(t,{originalPathname:()=>w,patchFetch:()=>L,requestAsyncStorage:()=>g,routeModule:()=>N,serverHooks:()=>_,staticGenerationAsyncStorage:()=>T});var r={};i.r(r),i.d(r,{POST:()=>E});var a=i(49303),n=i(88716),o=i(60670),s=i(87070),l=i(97425),p=i(75748),u=i(55315),m=i(57440),d=i(68585);let I=[{extension:".png",maxFileSize:5242880,allowedMimeTypes:["image/png"],magicBytes:[{bytes:[137,80,78,71,13,10,26,10]}]},{extension:".jpg",maxFileSize:5242880,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".jpeg",maxFileSize:5242880,allowedMimeTypes:["image/jpeg"],magicBytes:[{bytes:[255,216,255]}]},{extension:".gif",maxFileSize:5242880,allowedMimeTypes:["image/gif"],magicBytes:[{bytes:[71,73,70,56,55,97]},{bytes:[71,73,70,56,57,97]}]},{extension:".webp",maxFileSize:5242880,allowedMimeTypes:["image/webp"],magicBytes:[{bytes:[82,73,70,70],offset:0}]},{extension:".mp4",maxFileSize:15728640,allowedMimeTypes:["video/mp4"],magicBytes:[{bytes:[102,116,121,112],offset:4}]},{extension:".txt",maxFileSize:5242880,allowedMimeTypes:["text/plain"]},{extension:".log",maxFileSize:5242880,allowedMimeTypes:["text/plain"]},{extension:".md",maxFileSize:5242880,allowedMimeTypes:["text/markdown","text/plain"]},{extension:".csv",maxFileSize:5242880,allowedMimeTypes:["text/csv"]},{extension:".json",maxFileSize:5242880,allowedMimeTypes:["application/json"]},{extension:".yaml",maxFileSize:5242880,allowedMimeTypes:["text/yaml","application/x-yaml"]},{extension:".yml",maxFileSize:5242880,allowedMimeTypes:["text/yaml","application/x-yaml"]}],c=I.map(e=>e.extension);function y(e){let t=e.toLowerCase();return I.find(e=>e.extension===t)}let x={FILE_NOT_FOUND:404,WORKTREE_NOT_FOUND:404,PERMISSION_DENIED:403,INVALID_PATH:400,INVALID_REQUEST:400,FILE_EXISTS:409,DISK_FULL:507,INTERNAL_ERROR:500,INVALID_EXTENSION:400,INVALID_MIME_TYPE:400,INVALID_MAGIC_BYTES:400,FILE_TOO_LARGE:413,INVALID_FILENAME:400,INVALID_FILE_CONTENT:400};function f(e,t,i=500){if("string"==typeof e){let r=x[e]??i;return s.NextResponse.json({success:!1,error:{code:e,message:t}},{status:r})}let r=e.error?.code??"INTERNAL_ERROR",a=e.error?.message??"Unknown error",n=x[r]??i;return s.NextResponse.json({success:!1,error:{code:r,message:a}},{status:n})}async function E(e,{params:t}){try{let r;let a=(0,l.getDbInstance)(),n=(0,p.gU)(a,t.id);if(!n)return f("WORKTREE_NOT_FOUND","Worktree not found");let o=t.path.join("/"),I=(0,u.normalize)(o);if(!(0,m.jj)(I,n.path))return f("INVALID_PATH","Invalid file path");if(!(0,m.iH)(I,n.path))return f("INVALID_PATH","Invalid path");try{r=await e.formData()}catch{return f("INVALID_REQUEST","Invalid form data",400)}let x=r.get("file");if(!x||!(x instanceof File))return f("INVALID_REQUEST","File is required",400);let E=x.name,N=x.type,g=x.size,T=(0,u.extname)(E).toLowerCase();if(!function(e){if(!e)return!1;let t=e.toLowerCase();return c.includes(t)}(T))return f((0,d.wZ)("INVALID_EXTENSION"));if(!function(e,t){let i=y(e);return i?.allowedMimeTypes.includes(t)??!1}(T,N))return f((0,d.wZ)("INVALID_MIME_TYPE"));let _=function(e){let t=y(e);return t?.maxFileSize??5242880}(T);if(g>_)return f((0,d.wZ)("FILE_TOO_LARGE"));let w=await x.arrayBuffer(),L=Buffer.from(w);if(!function(e,t){let i=y(e);return!i?.magicBytes||0===i.magicBytes.length||i.magicBytes.some(e=>{let i=e.offset??0;return!(t.length<i+e.bytes.length)&&e.bytes.every((e,r)=>t[i+r]===e)})}(T,L))return f((0,d.wZ)("INVALID_MAGIC_BYTES"));if(!(0,d.TG)(E,{forUpload:!0}).valid)return f((0,d.wZ)("INVALID_FILENAME"));if(".yaml"===T||".yml"===T){var i;if(i=L.toString("utf-8"),[/!ruby\/object/i,/!python\/object/i,/!!python/i,/!!ruby/i,/!<tag:yaml\.org,2002:python/i,/!<tag:yaml\.org,2002:ruby/i].some(e=>e.test(i)))return f((0,d.wZ)("INVALID_FILE_CONTENT"))}if(".json"===T){let e=L.toString("utf-8");if(!function(e){try{return JSON.parse(e),!0}catch{return!1}}(e))return f((0,d.wZ)("INVALID_FILE_CONTENT"))}let A=I?`${I}/${E}`:E,h=await (0,d.Kr)(n.path,A,L);if(!h.success)return f(h);return s.NextResponse.json({success:!0,path:h.path,filename:E,size:h.size},{status:201})}catch(e){return console.error("Error uploading file:",e),f("INTERNAL_ERROR","Failed to upload file")}}let N=new a.AppRouteRouteModule({definition:{kind:n.x.APP_ROUTE,page:"/api/worktrees/[id]/upload/[...path]/route",pathname:"/api/worktrees/[id]/upload/[...path]",filename:"route",bundlePath:"app/api/worktrees/[id]/upload/[...path]/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/[id]/upload/[...path]/route.ts",nextConfigOutput:"",userland:r}),{requestAsyncStorage:g,staticGenerationAsyncStorage:T,serverHooks:_}=N,w="/api/worktrees/[id]/upload/[...path]/route";function L(){return(0,o.patchFetch)({serverHooks:_,staticGenerationAsyncStorage:T})}}};var t=require("../../../../../../webpack-runtime.js");t.C(e);var i=e=>t(t.s=e),r=t.X(0,[8948,5972,7425,8585],()=>i(14276));module.exports=r})();
@@ -1 +1 @@
1
- "use strict";(()=>{var e={};e.id=3058,e.ids=[3058],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},78893:e=>{e.exports=require("buffer")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},98216:e=>{e.exports=require("net")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},82452:e=>{e.exports=require("tls")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},17679:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>P,patchFetch:()=>k,requestAsyncStorage:()=>v,routeModule:()=>x,serverHooks:()=>w,staticGenerationAsyncStorage:()=>q});var s={};r.r(s),r.d(s,{GET:()=>f,dynamic:()=>g});var o=r(49303),i=r(88716),n=r(60670),a=r(87070),p=r(97425),u=r(75748),c=r(55837),l=r(83513),d=r(89194),h=r(13561),m=r(2693);let g="force-dynamic";async function f(e){try{let t=(0,p.getDbInstance)(),r=e.nextUrl?.searchParams,s=r?.get("repository"),o=(0,u.Xv)(t,s||void 0),i=c.g.getInstance(),n=l.tK,g=await Promise.all(o.map(async e=>{let r={},s=!1,o=!1,a=!1;for(let p of n){let n=i.getTool(p),c=await n.isRunning(e.id),l=!1,g=!1;if(c)try{let r="opencode"===p?m.uC:100,s=await (0,d.NA)(e.id,p,r),o=(0,h._)(s,p);l="waiting"===o.status,g="running"===o.status,!o.hasActivePrompt&&(0,u._U)(t,e.id,void 0,10,p).some(e=>"prompt"===e.messageType&&e.promptData?.status!=="answered")&&(0,u.GP)(t,e.id,p)}catch{g=!0}r[p]={isRunning:c,isWaitingForResponse:l,isProcessing:g},c&&(s=!0),l&&(o=!0),g&&(a=!0)}return{...e,isSessionRunning:s,isWaitingForResponse:o,isProcessing:a,sessionStatusByCli:r}})),f=(0,u.ER)(t);return a.NextResponse.json({worktrees:g,repositories:f},{status:200})}catch(e){return console.error("Error fetching worktrees:",e),a.NextResponse.json({error:"Failed to fetch worktrees"},{status:500})}}let x=new o.AppRouteRouteModule({definition:{kind:i.x.APP_ROUTE,page:"/api/worktrees/route",pathname:"/api/worktrees",filename:"route",bundlePath:"app/api/worktrees/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:v,staticGenerationAsyncStorage:q,serverHooks:w}=x,P="/api/worktrees/route";function k(){return(0,n.patchFetch)({serverHooks:w,staticGenerationAsyncStorage:q})}},13561:(e,t,r)=>{r.d(t,{_:()=>i});var s=r(19377),o=r(63661);function i(e,t,r){let i=(0,s.vp)(e),n=i.split("\n"),a=n.length-1;for(;a>=0&&""===n[a].trim();)a--;let p=n.slice(0,a+1),u=p.slice(-15).join("\n"),c=p.slice(-5).join("\n"),l=(0,s.Sg)(t);if((0,o.F)((0,s.BN)(i),l).isPrompt)return{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0};if((0,s.Wg)(t,c))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1};if("opencode"===t){if(s.nT.test(u))return{status:"running",confidence:"high",reason:"opencode_processing_indicator",hasActivePrompt:!1};let e=(0,s.BN)(i).split("\n"),t=Math.max(0,e.length-7);for(let r=e.length-1;r>=Math.max(0,e.length-10);r--)if(/ctrl\+[tp]/.test(e[r])){t=Math.max(0,r-2);break}let r=e.slice(0,t),o=r.length-1;for(;o>=0&&""===r[o].trim();)o--;if(o>=0){let e=r.slice(Math.max(0,o-5+1),o+1).join("\n");if((0,s.Wg)("opencode",e))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1};let t=r.slice(Math.max(0,o-15+1),o+1).join("\n");if(s.n9.test(t))return{status:"ready",confidence:"high",reason:"opencode_response_complete",hasActivePrompt:!1}}}let{promptPattern:d}=(0,s.bs)(t);return d.test(u)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1}:r&&Date.now()-r.getTime()>5e3?{status:"ready",confidence:"low",reason:"no_recent_output",hasActivePrompt:!1}:{status:"running",confidence:"low",reason:"default",hasActivePrompt:!1}}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8948,5972,3853,4893,7425,7566,4952],()=>r(17679));module.exports=s})();
1
+ "use strict";(()=>{var e={};e.id=3058,e.ids=[3058],e.modules={85890:e=>{e.exports=require("better-sqlite3")},20399:e=>{e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},30517:e=>{e.exports=require("next/dist/compiled/next-server/app-route.runtime.prod.js")},78893:e=>{e.exports=require("buffer")},61282:e=>{e.exports=require("child_process")},84770:e=>{e.exports=require("crypto")},17702:e=>{e.exports=require("events")},92048:e=>{e.exports=require("fs")},20629:e=>{e.exports=require("fs/promises")},32615:e=>{e.exports=require("http")},35240:e=>{e.exports=require("https")},98216:e=>{e.exports=require("net")},19801:e=>{e.exports=require("os")},55315:e=>{e.exports=require("path")},76162:e=>{e.exports=require("stream")},82452:e=>{e.exports=require("tls")},17360:e=>{e.exports=require("url")},21764:e=>{e.exports=require("util")},71568:e=>{e.exports=require("zlib")},17679:(e,t,r)=>{r.r(t),r.d(t,{originalPathname:()=>v,patchFetch:()=>w,requestAsyncStorage:()=>g,routeModule:()=>m,serverHooks:()=>x,staticGenerationAsyncStorage:()=>f});var s={};r.r(s),r.d(s,{GET:()=>h,dynamic:()=>d});var n=r(49303),o=r(88716),i=r(60670),a=r(87070),p=r(97425),u=r(75748),c=r(10927),l=r(37670);let d="force-dynamic";async function h(e){try{let t=(0,p.getDbInstance)(),r=e.nextUrl?.searchParams,s=r?.get("repository"),n=(0,u.Xv)(t,s||void 0),o=await (0,c.LF)(),i=new Set(o.map(e=>e.name)),d=await Promise.all(n.map(async e=>{let r=await (0,l.r)(e.id,i,t,u._U,u.GP);return{...e,...r}})),h=(0,u.ER)(t);return a.NextResponse.json({worktrees:d,repositories:h},{status:200})}catch(e){return console.error("Error fetching worktrees:",e),a.NextResponse.json({error:"Failed to fetch worktrees"},{status:500})}}let m=new n.AppRouteRouteModule({definition:{kind:o.x.APP_ROUTE,page:"/api/worktrees/route",pathname:"/api/worktrees",filename:"route",bundlePath:"app/api/worktrees/route"},resolvedPagePath:"/home/runner/work/CommandMate/CommandMate/src/app/api/worktrees/route.ts",nextConfigOutput:"",userland:s}),{requestAsyncStorage:g,staticGenerationAsyncStorage:f,serverHooks:x}=m,v="/api/worktrees/route";function w(){return(0,i.patchFetch)({serverHooks:x,staticGenerationAsyncStorage:f})}},13561:(e,t,r)=>{r.d(t,{_:()=>o});var s=r(19377),n=r(63661);function o(e,t,r){let o=(0,s.vp)(e),i=o.split("\n"),a=i.length-1;for(;a>=0&&""===i[a].trim();)a--;let p=i.slice(0,a+1),u=p.slice(-15).join("\n"),c=p.slice(-5).join("\n"),l=(0,s.Sg)(t),d=(0,n.FS)((0,s.BN)(u),l);if(d.isPrompt)return{status:"waiting",confidence:"high",reason:"prompt_detected",hasActivePrompt:!0,promptDetection:d};if((0,s.Wg)(t,c))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:d};if("opencode"===t){if(s.nT.test(u))return{status:"running",confidence:"high",reason:"opencode_processing_indicator",hasActivePrompt:!1,promptDetection:d};let e=(0,s.BN)(o).split("\n"),t=Math.max(0,e.length-7);for(let r=e.length-1;r>=Math.max(0,e.length-10);r--)if(/ctrl\+[tp]/.test(e[r])){t=Math.max(0,r-2);break}let r=e.slice(0,t),n=r.length-1;for(;n>=0&&""===r[n].trim();)n--;if(n>=0){let e=r.slice(Math.max(0,n-5+1),n+1).join("\n");if((0,s.Wg)("opencode",e))return{status:"running",confidence:"high",reason:"thinking_indicator",hasActivePrompt:!1,promptDetection:d};let t=r.slice(Math.max(0,n-15+1),n+1).join("\n");if(s.n9.test(t))return{status:"ready",confidence:"high",reason:"opencode_response_complete",hasActivePrompt:!1,promptDetection:d}}}let{promptPattern:h}=(0,s.bs)(t);return h.test(u)?{status:"ready",confidence:"high",reason:"input_prompt",hasActivePrompt:!1,promptDetection:d}:r&&Date.now()-r.getTime()>5e3?{status:"ready",confidence:"low",reason:"no_recent_output",hasActivePrompt:!1,promptDetection:d}:{status:"running",confidence:"low",reason:"default",hasActivePrompt:!1,promptDetection:d}}},37670:(e,t,r)=>{r.d(t,{r:()=>u});var s=r(55837),n=r(83513),o=r(89194),i=r(13561),a=r(2693),p=r(62648);async function u(e,t,r,u,c){let l=s.g.getInstance(),d=n.tK,h={},m=!1,g=!1,f=!1;for(let s of d){let n=l.getTool(s).getSessionName(e),d=t.has(n);d&&"claude"===s&&!(await (0,p.i_)(n)).healthy&&(d=!1);let x=!1,v=!1;if(d)try{let t="opencode"===s?a.uC:100,n=await (0,o.NA)(e,s,t),p=(0,i._)(n,s);x="waiting"===p.status,v="running"===p.status,!p.hasActivePrompt&&u(r,e,void 0,10,s).some(e=>"prompt"===e.messageType&&e.promptData?.status!=="answered")&&c(r,e,s)}catch{v=!0}h[s]={isRunning:d,isWaitingForResponse:x,isProcessing:v},d&&(m=!0),x&&(g=!0),v&&(f=!0)}return{sessionStatusByCli:h,isSessionRunning:m,isWaitingForResponse:g,isProcessing:f}}}};var t=require("../../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),s=t.X(0,[8948,5972,3853,4893,7425,7566,4952],()=>r(17679));module.exports=s})();
@@ -1 +1 @@
1
- (()=>{var e={};e.id=2626,e.ids=[2626],e.modules={72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},55315:e=>{"use strict";e.exports=require("path")},17360:e=>{"use strict";e.exports=require("url")},66023:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>o.a,__next_app__:()=>m,originalPathname:()=>c,pages:()=>d,routeModule:()=>f,tree:()=>u}),r(80974),r(25086),r(35866);var n=r(23191),a=r(88716),l=r(37922),o=r.n(l),s=r(95231),i={};for(let e in s)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(i[e]=()=>s[e]);r.d(t,i);let u=["",{children:["login",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,80974)),"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx"]}]},{metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(r.bind(r,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(r.bind(r,25086)),"/home/runner/work/CommandMate/CommandMate/src/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,35866,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(r.bind(r,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}],d=["/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx"],c="/login/page",m={require:r,loadChunk:()=>Promise.resolve()},f=new n.AppPageRouteModule({definition:{kind:a.x.APP_PAGE,page:"/login/page",pathname:"/login",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:u}})},72089:(e,t,r)=>{Promise.resolve().then(r.bind(r,25546))},33265:(e,t,r)=>{"use strict";r.d(t,{default:()=>a.a});var n=r(43353),a=r.n(n)},43353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let n=r(91174);r(10326),r(17577);let a=n._(r(77028));function l(e,t){var r;let n={loading:e=>{let{error:t,isLoading:r,pastDelay:n}=e;return null}};"function"==typeof e&&(n.loader=e);let l={...n,...t};return(0,a.default)({...l,modules:null==(r=l.loadableGenerated)?void 0:r.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},933:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let n=r(94129);function a(e){let{reason:t,children:r}=e;throw new n.BailoutToCSRError(t)}},77028:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let n=r(10326),a=r(17577),l=r(933),o=r(46618);function s(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(s(()=>null)),loading:null,ssr:!0},u=function(e){let t={...i,...e},r=(0,a.lazy)(()=>t.loader().then(s)),u=t.loading;function d(e){let s=u?(0,n.jsx)(u,{isLoading:!0,pastDelay:!0,error:null}):null,i=t.ssr?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.PreloadCss,{moduleIds:t.modules}),(0,n.jsx)(r,{...e})]}):(0,n.jsx)(l.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(r,{...e})});return(0,n.jsx)(a.Suspense,{fallback:s,children:i})}return d.displayName="LoadableComponent",d}},46618:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return l}});let n=r(10326),a=r(54580);function l(e){let{moduleIds:t}=e,r=(0,a.getExpectedRequestStore)("next/dynamic css"),l=[];if(r.reactLoadableManifest&&t){let e=r.reactLoadableManifest;for(let r of t){if(!e[r])continue;let t=e[r].files.filter(e=>e.endsWith(".css"));l.push(...t)}}return 0===l.length?null:(0,n.jsx)(n.Fragment,{children:l.map(e=>(0,n.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:r.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},25546:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u});var n=r(10326),a=r(17577),l=r(33265),o=r(6162),s=r(94001);let i=(0,l.default)(async()=>{},{loadableGenerated:{modules:["app/login/page.tsx -> @/components/auth/QrCodeGenerator"]},ssr:!1});function u(){let e=(0,o.T)("auth"),t=(0,s.m)(),[r,l]=(0,a.useState)(""),[u,d]=(0,a.useState)(null),[c,m]=(0,a.useState)(!1),[f,p]=(0,a.useState)(null),{autoLoginErrorKey:g,retryAfterSeconds:x,clearError:h}=function(e){let[t,r]=(0,a.useState)(null),[n,l]=(0,a.useState)(null);return(0,a.useRef)(!1),{autoLoginErrorKey:t,retryAfterSeconds:n,clearError:()=>{r(null),l(null)}}}(0),b={token_invalid:e("login.qr.tokenExpiredOrInvalid"),rate_limited:e("login.qr.rateLimited"),auto_login_failed:e("login.qr.autoLoginError")},y=g?b[g]??null:null;async function v(t){t.preventDefault(),d(null),h(),m(!0);try{let t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r})});if(t.ok){window.location.href="/";return}if(429===t.status){let r=t.headers.get("Retry-After"),n=r?parseInt(r,10):900;p(n),d(e("error.lockedOut"));return}if(401===t.status){d(e("error.invalidToken"));return}d(e("error.unknownError"))}catch{d(e("error.unknownError"))}finally{m(!1)}}if(!t)return null;let j=y||u;return n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100 dark:bg-gray-900",children:(0,n.jsxs)("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-lg shadow-md w-full max-w-md",children:[n.jsx("h1",{className:"text-2xl font-bold mb-6 text-center text-gray-900 dark:text-white",children:e("login.title")}),(0,n.jsxs)("form",{onSubmit:v,className:"space-y-4",children:[(0,n.jsxs)("div",{children:[n.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("login.tokenLabel")}),n.jsx("input",{id:"token",type:"password",value:r,onChange:e=>l(e.target.value),placeholder:e("login.tokenPlaceholder"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",autoFocus:!0,autoComplete:"off",disabled:null!==f&&f>0})]}),j&&(0,n.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm",children:[j,null!==f&&f>0&&n.jsx("div",{className:"mt-1",children:e("error.retryAfter",{minutes:Math.ceil(f/60)})})]}),n.jsx("button",{type:"submit",disabled:c||!r||null!==f&&f>0,className:"w-full py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:c?"...":e("login.submitButton")})]}),n.jsx("div",{className:"hidden md:block",children:n.jsx(i,{})})]})})}},80974:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});let n=(0,r(68570).createProxy)(String.raw`/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx#default`)},63601:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var n=r(66621);let a=e=>[{type:"image/png",sizes:"180x180",url:(0,n.fillMetadataSegment)(".",e.params,"apple-icon.png")+"?31a89e65aa4ac65b"}]},71150:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var n=r(66621);let a=e=>[{type:"image/png",sizes:"32x32",url:(0,n.fillMetadataSegment)(".",e.params,"icon.png")+"?32d9127ba30ee286"}]},6162:(e,t,r)=>{"use strict";r.d(t,{T:()=>l});var n=r(34643);function a(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let l=a(0,n.T_);a(0,n.Gb)}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,3294,6621,3860],()=>r(66023));module.exports=n})();
1
+ (()=>{var e={};e.id=2626,e.ids=[2626],e.modules={72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},55315:e=>{"use strict";e.exports=require("path")},17360:e=>{"use strict";e.exports=require("url")},66023:(e,t,r)=>{"use strict";r.r(t),r.d(t,{GlobalError:()=>o.a,__next_app__:()=>m,originalPathname:()=>c,pages:()=>d,routeModule:()=>f,tree:()=>u}),r(80974),r(25086),r(35866);var n=r(23191),a=r(88716),l=r(37922),o=r.n(l),s=r(95231),i={};for(let e in s)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(i[e]=()=>s[e]);r.d(t,i);let u=["",{children:["login",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(r.bind(r,80974)),"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx"]}]},{metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(r.bind(r,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(r.bind(r,25086)),"/home/runner/work/CommandMate/CommandMate/src/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(r.t.bind(r,35866,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(r.bind(r,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(r.bind(r,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}],d=["/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx"],c="/login/page",m={require:r,loadChunk:()=>Promise.resolve()},f=new n.AppPageRouteModule({definition:{kind:a.x.APP_PAGE,page:"/login/page",pathname:"/login",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:u}})},72089:(e,t,r)=>{Promise.resolve().then(r.bind(r,25546))},33265:(e,t,r)=>{"use strict";r.d(t,{default:()=>a.a});var n=r(43353),a=r.n(n)},43353:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return l}});let n=r(91174);r(10326),r(17577);let a=n._(r(77028));function l(e,t){var r;let n={loading:e=>{let{error:t,isLoading:r,pastDelay:n}=e;return null}};"function"==typeof e&&(n.loader=e);let l={...n,...t};return(0,a.default)({...l,modules:null==(r=l.loadableGenerated)?void 0:r.modules})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},933:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let n=r(94129);function a(e){let{reason:t,children:r}=e;throw new n.BailoutToCSRError(t)}},77028:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return u}});let n=r(10326),a=r(17577),l=r(933),o=r(46618);function s(e){return{default:e&&"default"in e?e.default:e}}let i={loader:()=>Promise.resolve(s(()=>null)),loading:null,ssr:!0},u=function(e){let t={...i,...e},r=(0,a.lazy)(()=>t.loader().then(s)),u=t.loading;function d(e){let s=u?(0,n.jsx)(u,{isLoading:!0,pastDelay:!0,error:null}):null,i=t.ssr?(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)(o.PreloadCss,{moduleIds:t.modules}),(0,n.jsx)(r,{...e})]}):(0,n.jsx)(l.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(r,{...e})});return(0,n.jsx)(a.Suspense,{fallback:s,children:i})}return d.displayName="LoadableComponent",d}},46618:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadCss",{enumerable:!0,get:function(){return l}});let n=r(10326),a=r(54580);function l(e){let{moduleIds:t}=e,r=(0,a.getExpectedRequestStore)("next/dynamic css"),l=[];if(r.reactLoadableManifest&&t){let e=r.reactLoadableManifest;for(let r of t){if(!e[r])continue;let t=e[r].files.filter(e=>e.endsWith(".css"));l.push(...t)}}return 0===l.length?null:(0,n.jsx)(n.Fragment,{children:l.map(e=>(0,n.jsx)("link",{precedence:"dynamic",rel:"stylesheet",href:r.assetPrefix+"/_next/"+encodeURI(e),as:"style"},e))})}},25546:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>u});var n=r(10326),a=r(17577),l=r(33265),o=r(6162),s=r(94001);let i=(0,l.default)(async()=>{},{loadableGenerated:{modules:["app/login/page.tsx -> @/components/auth/QrCodeGenerator"]},ssr:!1});function u(){let e=(0,o.T)("auth"),t=(0,s.m)(),[r,l]=(0,a.useState)(""),[u,d]=(0,a.useState)(null),[c,m]=(0,a.useState)(!1),[f,p]=(0,a.useState)(null),{autoLoginErrorKey:g,retryAfterSeconds:x,clearError:h}=function(e){let[t,r]=(0,a.useState)(null),[n,l]=(0,a.useState)(null);return(0,a.useRef)(!1),{autoLoginErrorKey:t,retryAfterSeconds:n,clearError:()=>{r(null),l(null)}}}(0),b={token_invalid:e("login.qr.tokenExpiredOrInvalid"),rate_limited:e("login.qr.rateLimited"),auto_login_failed:e("login.qr.autoLoginError")},y=g?b[g]??null:null;async function v(t){t.preventDefault(),d(null),h(),m(!0);try{let t=await fetch("/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({token:r})});if(t.ok){window.location.href="/";return}if(429===t.status){let r=t.headers.get("Retry-After"),n=r?parseInt(r,10):900;p(n),d(e("error.lockedOut"));return}if(401===t.status){d(e("error.invalidToken"));return}d(e("error.unknownError"))}catch{d(e("error.unknownError"))}finally{m(!1)}}if(!t)return null;let j=y||u;return n.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gray-100 dark:bg-gray-900",children:(0,n.jsxs)("div",{className:"bg-white dark:bg-gray-800 p-8 rounded-lg shadow-md w-full max-w-md",children:[n.jsx("h1",{className:"text-2xl font-bold mb-6 text-center text-gray-900 dark:text-white",children:e("login.title")}),(0,n.jsxs)("form",{onSubmit:v,className:"space-y-4",children:[(0,n.jsxs)("div",{children:[n.jsx("label",{htmlFor:"token",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-1",children:e("login.tokenLabel")}),n.jsx("input",{id:"token",type:"password",value:r,onChange:e=>l(e.target.value),placeholder:e("login.tokenPlaceholder"),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md shadow-sm focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:text-white",autoFocus:!0,autoComplete:"off",disabled:null!==f&&f>0})]}),j&&(0,n.jsxs)("div",{className:"text-red-600 dark:text-red-400 text-sm",children:[j,null!==f&&f>0&&n.jsx("div",{className:"mt-1",children:e("error.retryAfter",{minutes:Math.ceil(f/60)})})]}),n.jsx("button",{type:"submit",disabled:c||!r||null!==f&&f>0,className:"w-full py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500 disabled:opacity-50 disabled:cursor-not-allowed",children:c?"...":e("login.submitButton")})]}),n.jsx("div",{className:"hidden md:block",children:n.jsx(i,{})})]})})}},80974:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>n});let n=(0,r(68570).createProxy)(String.raw`/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx#default`)},63601:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var n=r(66621);let a=e=>[{type:"image/png",sizes:"180x180",url:(0,n.fillMetadataSegment)(".",e.params,"apple-icon.png")+"?31a89e65aa4ac65b"}]},71150:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>a});var n=r(66621);let a=e=>[{type:"image/png",sizes:"32x32",url:(0,n.fillMetadataSegment)(".",e.params,"icon.png")+"?32d9127ba30ee286"}]},6162:(e,t,r)=>{"use strict";r.d(t,{T:()=>l});var n=r(34643);function a(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let l=a(0,n.T_);a(0,n.Gb)}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),n=t.X(0,[8948,1628,6621,3860],()=>r(66023));module.exports=n})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../../node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../node_modules/next/dist/client/components/action-async-storage.external.js","../../../../node_modules/next/dist/client/components/async-local-storage.js","../../../../node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../node_modules/next/dist/client/components/request-async-storage.external.js","../../../../node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../node_modules/next/package.json","../../../../package.json","../../../package.json","../../chunks/2314.js","../../chunks/2683.js","../../chunks/3074.js","../../chunks/3294.js","../../chunks/3348.js","../../chunks/369.js","../../chunks/3860.js","../../chunks/4559.js","../../chunks/5795.js","../../chunks/5823.js","../../chunks/5853.js","../../chunks/6228.js","../../chunks/6621.js","../../chunks/6837.js","../../chunks/7266.js","../../chunks/8744.js","../../chunks/8948.js","../../chunks/9582.js","../../webpack-runtime.js","page_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../../node_modules/next/dist/client/components/action-async-storage-instance.js","../../../../node_modules/next/dist/client/components/action-async-storage.external.js","../../../../node_modules/next/dist/client/components/async-local-storage.js","../../../../node_modules/next/dist/client/components/request-async-storage-instance.js","../../../../node_modules/next/dist/client/components/request-async-storage.external.js","../../../../node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../../node_modules/next/dist/server/lib/trace/constants.js","../../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../../node_modules/next/package.json","../../../../package.json","../../../package.json","../../chunks/1628.js","../../chunks/2314.js","../../chunks/2683.js","../../chunks/3074.js","../../chunks/3348.js","../../chunks/369.js","../../chunks/3860.js","../../chunks/4559.js","../../chunks/5795.js","../../chunks/5823.js","../../chunks/5853.js","../../chunks/6228.js","../../chunks/6621.js","../../chunks/6837.js","../../chunks/7266.js","../../chunks/8744.js","../../chunks/8948.js","../../chunks/9582.js","../../webpack-runtime.js","page_client-reference-manifest.js"]}
@@ -1 +1 @@
1
- globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/login/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"40991":{"*":{"id":"72964","name":"*","chunks":[],"async":false}},"41845":{"*":{"id":"37398","name":"*","chunks":[],"async":false}},"50653":{"*":{"id":"84442","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"66677":{"*":{"id":"42106","name":"*","chunks":[],"async":false}},"88880":{"*":{"id":"25546","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/globals.css":{"id":2778,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-9110f9a5e41c6bf4.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx":{"id":88880,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","2626","static/chunks/app/login/page-010f02fd4b0dbc48.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx":{"id":66677,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","2335","static/chunks/2335-98a211e00b94c7ac.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","8091","static/chunks/8091-d65d2ab6daed23c6.js","1931","static/chunks/app/page-9e523a8f415bc707.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/files/[...path]/page.tsx":{"id":50653,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx":{"id":40991,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page.tsx":{"id":41845,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/home/runner/work/CommandMate/CommandMate/src/":[],"/home/runner/work/CommandMate/CommandMate/src/app/layout":["static/css/45b3a41370668314.css"],"/home/runner/work/CommandMate/CommandMate/src/app/page":[],"/home/runner/work/CommandMate/CommandMate/src/app/login/page":[]}}
1
+ globalThis.__RSC_MANIFEST=(globalThis.__RSC_MANIFEST||{});globalThis.__RSC_MANIFEST["/login/page"]={"moduleLoading":{"prefix":"/_next/","crossOrigin":null},"ssrModuleMapping":{"80":{"*":{"id":"41868","name":"*","chunks":[],"async":false}},"4707":{"*":{"id":"79671","name":"*","chunks":[],"async":false}},"12846":{"*":{"id":"12994","name":"*","chunks":[],"async":false}},"18828":{"*":{"id":"2108","name":"*","chunks":[],"async":false}},"19107":{"*":{"id":"96114","name":"*","chunks":[],"async":false}},"26514":{"*":{"id":"30349","name":"*","chunks":[],"async":false}},"27323":{"*":{"id":"45763","name":"*","chunks":[],"async":false}},"36423":{"*":{"id":"84759","name":"*","chunks":[],"async":false}},"50653":{"*":{"id":"89829","name":"*","chunks":[],"async":false}},"61060":{"*":{"id":"9727","name":"*","chunks":[],"async":false}},"66677":{"*":{"id":"42106","name":"*","chunks":[],"async":false}},"88880":{"*":{"id":"25546","name":"*","chunks":[],"async":false}}},"edgeSSRModuleMapping":{},"clientModules":{"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/app-router.js":{"id":12846,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/client-page.js":{"id":19107,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/error-boundary.js":{"id":61060,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/layout-router.js":{"id":4707,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/not-found-boundary.js":{"id":80,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/node_modules/next/dist/esm/client/components/render-from-template-context.js":{"id":36423,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/globals.css":{"id":2778,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-7198a7a49aa21a97.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/components/providers/AppProviders.tsx":{"id":18828,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","3185","static/chunks/app/layout-7198a7a49aa21a97.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/login/page.tsx":{"id":88880,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","2626","static/chunks/app/login/page-010f02fd4b0dbc48.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx":{"id":66677,"name":"*","chunks":["9234","static/chunks/9234-b0304101384ca079.js","216","static/chunks/216-f18f4a9d8b04a91e.js","12","static/chunks/12-00c528d46a0a0a1d.js","8528","static/chunks/8528-4d554d3b94d4cf9b.js","2083","static/chunks/2083-b5bed0c77cc53281.js","1931","static/chunks/app/page-7498cf75e69d9227.js"],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/files/[...path]/page.tsx":{"id":50653,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/page.tsx":{"id":26514,"name":"*","chunks":[],"async":false},"/home/runner/work/CommandMate/CommandMate/src/app/worktrees/[id]/terminal/page.tsx":{"id":27323,"name":"*","chunks":[],"async":false}},"entryCSSFiles":{"/home/runner/work/CommandMate/CommandMate/src/":[],"/home/runner/work/CommandMate/CommandMate/src/app/layout":["static/css/f7dc01350168df01.css"],"/home/runner/work/CommandMate/CommandMate/src/app/page":[],"/home/runner/work/CommandMate/CommandMate/src/app/login/page":[]}}
@@ -1,7 +1,7 @@
1
- (()=>{var e={};e.id=1931,e.ids=[1931],e.modules={72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},55315:e=>{"use strict";e.exports=require("path")},17360:e=>{"use strict";e.exports=require("url")},37906:(e,t,s)=>{"use strict";s.r(t),s.d(t,{GlobalError:()=>n.a,__next_app__:()=>m,originalPathname:()=>x,pages:()=>c,routeModule:()=>p,tree:()=>d}),s(35480),s(25086),s(35866);var a=s(23191),r=s(88716),l=s(37922),n=s.n(l),i=s(95231),o={};for(let e in i)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(o[e]=()=>i[e]);s.d(t,o);let d=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(s.bind(s,35480)),"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx"],metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(s.bind(s,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(s.bind(s,25086)),"/home/runner/work/CommandMate/CommandMate/src/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(s.t.bind(s,35866,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(s.bind(s,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(s.bind(s,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}],c=["/home/runner/work/CommandMate/CommandMate/src/app/page.tsx"],x="/page",m={require:s,loadChunk:()=>Promise.resolve()},p=new a.AppPageRouteModule({definition:{kind:r.x.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:d}})},11518:(e,t,s)=>{Promise.resolve().then(s.bind(s,42106))},35047:(e,t,s)=>{"use strict";var a=s(77389);s.o(a,"useParams")&&s.d(t,{useParams:function(){return a.useParams}}),s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}})},42106:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>C});var a=s(10326),r=s(17577),l=s(79906),n=s(90434),i=s(77758),o=s(6162),d=s(34643),c=s(352),x=s(41593),m=s(73002);function p({worktree:e,onSessionKilled:t,onStatusChanged:s}){let{id:l,name:p,description:u,updatedAt:h,isSessionRunning:g,isWaitingForResponse:y,favorite:b,status:j,link:f}=e,[v,N]=(0,r.useState)(!1),[w,k]=(0,r.useState)(b||!1),[C,S]=(0,r.useState)(!1),[P,z]=(0,r.useState)(j||null),[A,$]=(0,r.useState)(!1),T=(0,o.T)(),L=(0,d.bU)(),R=(0,x.G)(L),D=h?(0,c.Q)(new Date(h),{addSuffix:!0,locale:R}):null,M="main"===p||"master"===p,E=async e=>{if(e.preventDefault(),e.stopPropagation(),confirm(T("worktree.session.confirmKill",{name:p})))try{N(!0),await m.Iv.killSession(l),t&&t()}catch(t){let e=(0,m.zG)(t);alert(`${T("worktree.session.failedToKill")}: ${e}`)}finally{N(!1)}},I=async e=>{e.preventDefault(),e.stopPropagation();try{S(!0);let e=!w;await m.Iv.toggleFavorite(l,e),k(e)}catch(t){let e=(0,m.zG)(t);alert(`${T("worktree.errors.failedToUpdateFavorite")}: ${e}`)}finally{S(!1)}},_=async(e,t)=>{t.preventDefault(),t.stopPropagation();try{$(!0),await m.Iv.updateStatus(l,e),z(e),s&&s()}catch(t){let e=(0,m.zG)(t);alert(`${T("worktree.errors.failedToUpdateStatus")}: ${e}`)}finally{$(!1)}};return a.jsx(n.default,{href:`/worktrees/${l}`,className:"block",children:(0,a.jsxs)(i.Zb,{hover:!0,padding:"lg",className:"h-full",children:[a.jsx(i.Ol,{children:(0,a.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,a.jsxs)(i.ll,{className:"flex items-center gap-2 flex-wrap",children:[a.jsx("button",{onClick:I,disabled:C,className:"flex-shrink-0 transition-colors hover:scale-110",title:w?T("common.favorites.remove"):T("common.favorites.add"),children:a.jsx("svg",{className:`w-5 h-5 ${w?"fill-yellow-400 text-yellow-400":"fill-none text-gray-400"}`,stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),a.jsx("span",{className:"truncate",children:p}),M&&a.jsx(i.Ct,{variant:"info",children:"Main"}),g&&y&&a.jsx(i.Ct,{variant:"warning",dot:!0,children:T("worktree.status.waitingForResponse")}),g&&!y&&a.jsx(i.Ct,{variant:"success",dot:!0,children:T("worktree.status.responseCompleted")})]}),g&&a.jsx(i.zx,{variant:"danger",size:"sm",onClick:E,disabled:v,className:"flex-shrink-0",children:v?T("common.ending"):T("common.end")})]})}),a.jsx(i.aY,{children:(0,a.jsxs)("div",{className:"space-y-3",children:[u&&(0,a.jsxs)("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Description"}),a.jsx("p",{className:"text-sm text-gray-700 line-clamp-2 whitespace-pre-wrap",children:u})]}),f&&(0,a.jsxs)("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Link"}),(0,a.jsxs)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),f&&window.open(f,"_blank","noopener,noreferrer")},className:"flex items-center gap-1 text-sm text-blue-600 hover:text-blue-800 hover:underline transition-colors",title:"Open link in new tab",children:[a.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),a.jsx("span",{className:"truncate",children:f})]})]}),(0,a.jsxs)("div",{children:[a.jsx("p",{className:"text-xs text-gray-500 mb-1",children:"Status"}),(0,a.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[a.jsx("button",{onClick:e=>_(null,e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${null===P?"bg-gray-100 text-gray-700 border-gray-400":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,children:"Not set"}),a.jsx("button",{onClick:e=>_("todo",e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${"todo"===P?"bg-gray-100 text-gray-700 border-gray-400":"bg-white text-gray-600 border-gray-200 hover:bg-gray-50"}`,children:"ToDo"}),a.jsx("button",{onClick:e=>_("doing",e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${"doing"===P?"bg-blue-100 text-blue-700 border-blue-400":"bg-white text-gray-600 border-gray-200 hover:bg-blue-50"}`,children:"Doing"}),a.jsx("button",{onClick:e=>_("done",e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${"done"===P?"bg-green-100 text-green-700 border-green-400":"bg-white text-gray-600 border-gray-200 hover:bg-green-50"}`,children:"Done"})]})]}),D&&(0,a.jsxs)("div",{className:"flex items-center text-xs text-gray-500",children:[a.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,a.jsxs)("span",{children:["Updated ",D]})]})]})})]})})}function u({initialWorktrees:e=[]}){let[t,s]=(0,r.useState)(e),[l,n]=(0,r.useState)([]),[o,d]=(0,r.useState)(!e.length),[c,x]=(0,r.useState)(null),[u,h]=(0,r.useState)(""),[g,y]=(0,r.useState)("updated"),[b,j]=(0,r.useState)("desc"),[f,v]=(0,r.useState)(null),[N,w]=(0,r.useState)(null),[k,C]=(0,r.useState)(null),[S,P]=(0,r.useState)([]),[z,A]=(0,r.useState)(!1),[$,T]=(0,r.useState)(null),L=(0,r.useCallback)(async()=>{try{let e=await m.J1.getExcluded();e.success&&P(e.repositories)}catch{}},[]),R=(0,r.useCallback)(async(e=!1)=>{try{e||d(!0),x(null);let t=await m.Iv.getAll();s(t.worktrees),n(t.repositories)}catch(e){x((0,m.zG)(e))}finally{e||d(!1)}},[]),D=e=>!!(e&&"session_status_changed"===e.type),{status:M}=function(e={}){let{worktreeIds:t=[],onMessage:s,onStatusChange:a,autoReconnect:l=!0,reconnectDelay:n=3e3}=e,[i,o]=(0,r.useState)("disconnected"),d=(0,r.useRef)(null),c=(0,r.useRef)(),x=(0,r.useRef)(new Set),m=(0,r.useCallback)(e=>{o(e),a?.(e)},[a]),p=(0,r.useCallback)(()=>{if(d.current?.readyState===WebSocket.OPEN)return;m("connecting");let e="https:"===window.location.protocol?"wss:":"ws:",t=new WebSocket(`${e}//${window.location.host}`);t.onopen=()=>{m("connected"),x.current.forEach(e=>{t.send(JSON.stringify({type:"subscribe",worktreeId:e}))})},t.onmessage=e=>{try{let t=JSON.parse(e.data);s?.(t)}catch(e){console.error("Failed to parse WebSocket message:",e)}},t.onerror=()=>{m("error")},t.onclose=()=>{m("disconnected"),d.current=null,l&&(c.current=setTimeout(()=>{p()},n))},d.current=t},[m,s,l,n]),u=(0,r.useCallback)(()=>{c.current&&clearTimeout(c.current),d.current&&(d.current.close(1e3,"Client disconnect"),d.current=null),m("disconnected")},[m]);return{status:i,subscribe:(0,r.useCallback)(e=>{d.current?.readyState===WebSocket.OPEN&&(d.current.send(JSON.stringify({type:"subscribe",worktreeId:e})),x.current.add(e))},[]),unsubscribe:(0,r.useCallback)(e=>{d.current?.readyState===WebSocket.OPEN&&(d.current.send(JSON.stringify({type:"unsubscribe",worktreeId:e})),x.current.delete(e))},[]),sendMessage:(0,r.useCallback)(e=>{d.current?.readyState===WebSocket.OPEN&&d.current.send(JSON.stringify(e))},[]),connect:p,disconnect:u}}({onMessage:(0,r.useCallback)(e=>{if(D(e.data)){let t=e.data;s(e=>e.map(e=>e.id===t.worktreeId?{...e,isSessionRunning:t.isRunning}:e))}"broadcast"===e.type&&R(!0)},[R])}),E=(0,r.useMemo)(()=>{let e=[...t];if(f&&(e=e.filter(e=>e.repositoryPath===f)),null!==N&&(e="unset"===N?e.filter(e=>!e.status):e.filter(e=>e.status===N)),u){let t=u.toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t)||e.lastMessageSummary?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t))}return e.sort((e,t)=>{let s=0;switch(g){case"name":s=e.name.localeCompare(t.name);break;case"updated":s=(e.updatedAt?new Date(e.updatedAt).getTime():0)-(t.updatedAt?new Date(t.updatedAt).getTime():0);break;case"favorite":s=(e.favorite?1:0)-(t.favorite?1:0)}return"asc"===b?s:-s}),e},[t,f,N,u,g,b]),I=(0,r.useMemo)(()=>{let e=new Map;for(let t of E){let s=t.repositoryPath||"unknown";e.has(s)||e.set(s,[]),e.get(s).push(t)}return e},[E]),_=e=>{g===e?j(e=>"asc"===e?"desc":"asc"):(y(e),j("asc"))},O=async e=>{T(e);try{let t=await m.J1.restore(e);t.warning&&x(t.warning),await R(),await L()}catch(e){x((0,m.zG)(e))}finally{T(null)}},F=async(e,t)=>{let s=l.find(t=>t.path===e)?.worktreeCount||0;if("delete"===prompt(`Delete repository "${t}"?
1
+ (()=>{var e={};e.id=1931,e.ids=[1931],e.modules={72934:e=>{"use strict";e.exports=require("next/dist/client/components/action-async-storage.external.js")},54580:e=>{"use strict";e.exports=require("next/dist/client/components/request-async-storage.external.js")},45869:e=>{"use strict";e.exports=require("next/dist/client/components/static-generation-async-storage.external.js")},20399:e=>{"use strict";e.exports=require("next/dist/compiled/next-server/app-page.runtime.prod.js")},55315:e=>{"use strict";e.exports=require("path")},17360:e=>{"use strict";e.exports=require("url")},37906:(e,t,a)=>{"use strict";a.r(t),a.d(t,{GlobalError:()=>n.a,__next_app__:()=>m,originalPathname:()=>x,pages:()=>c,routeModule:()=>p,tree:()=>o}),a(35480),a(25086),a(35866);var r=a(23191),s=a(88716),l=a(37922),n=a.n(l),i=a(95231),d={};for(let e in i)0>["default","tree","pages","GlobalError","originalPathname","__next_app__","routeModule"].indexOf(e)&&(d[e]=()=>i[e]);a.d(t,d);let o=["",{children:["__PAGE__",{},{page:[()=>Promise.resolve().then(a.bind(a,35480)),"/home/runner/work/CommandMate/CommandMate/src/app/page.tsx"],metadata:{icon:[async e=>(await Promise.resolve().then(a.bind(a,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(a.bind(a,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}]},{layout:[()=>Promise.resolve().then(a.bind(a,25086)),"/home/runner/work/CommandMate/CommandMate/src/app/layout.tsx"],"not-found":[()=>Promise.resolve().then(a.t.bind(a,35866,23)),"next/dist/client/components/not-found-error"],metadata:{icon:[async e=>(await Promise.resolve().then(a.bind(a,71150))).default(e)],apple:[async e=>(await Promise.resolve().then(a.bind(a,63601))).default(e)],openGraph:[],twitter:[],manifest:void 0}}],c=["/home/runner/work/CommandMate/CommandMate/src/app/page.tsx"],x="/page",m={require:a,loadChunk:()=>Promise.resolve()},p=new r.AppPageRouteModule({definition:{kind:s.x.APP_PAGE,page:"/page",pathname:"/",bundlePath:"",filename:"",appPaths:[]},userland:{loaderTree:o}})},11518:(e,t,a)=>{Promise.resolve().then(a.bind(a,42106))},42106:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>C});var r=a(10326),s=a(17577),l=a(17706),n=a(90434),i=a(77758),d=a(6162),o=a(34643),c=a(352),x=a(41593),m=a(73002);function p({worktree:e,onSessionKilled:t,onStatusChanged:a}){let{id:l,name:p,description:h,updatedAt:u,isSessionRunning:g,isWaitingForResponse:y,favorite:b,status:j,link:k}=e,[f,v]=(0,s.useState)(!1),[N,w]=(0,s.useState)(b||!1),[C,S]=(0,s.useState)(!1),[P,z]=(0,s.useState)(j||null),[A,$]=(0,s.useState)(!1),L=(0,d.T)(),T=(0,o.bU)(),M=(0,x.G)(T),D=u?(0,c.Q)(new Date(u),{addSuffix:!0,locale:M}):null,R="main"===p||"master"===p,E=async e=>{if(e.preventDefault(),e.stopPropagation(),confirm(L("worktree.session.confirmKill",{name:p})))try{v(!0),await m.Iv.killSession(l),t&&t()}catch(t){let e=(0,m.zG)(t);alert(`${L("worktree.session.failedToKill")}: ${e}`)}finally{v(!1)}},I=async e=>{e.preventDefault(),e.stopPropagation();try{S(!0);let e=!N;await m.Iv.toggleFavorite(l,e),w(e)}catch(t){let e=(0,m.zG)(t);alert(`${L("worktree.errors.failedToUpdateFavorite")}: ${e}`)}finally{S(!1)}},O=async(e,t)=>{t.preventDefault(),t.stopPropagation();try{$(!0),await m.Iv.updateStatus(l,e),z(e),a&&a()}catch(t){let e=(0,m.zG)(t);alert(`${L("worktree.errors.failedToUpdateStatus")}: ${e}`)}finally{$(!1)}};return r.jsx(n.default,{href:`/worktrees/${l}`,className:"block",children:(0,r.jsxs)(i.Zb,{hover:!0,padding:"lg",className:"h-full",children:[r.jsx(i.Ol,{children:(0,r.jsxs)("div",{className:"flex items-start justify-between gap-2",children:[(0,r.jsxs)(i.ll,{className:"flex items-center gap-2 flex-wrap",children:[r.jsx("button",{onClick:I,disabled:C,className:"flex-shrink-0 transition-colors hover:scale-110",title:N?L("common.favorites.remove"):L("common.favorites.add"),children:r.jsx("svg",{className:`w-5 h-5 ${N?"fill-yellow-400 text-yellow-400":"fill-none text-gray-400"}`,stroke:"currentColor",strokeWidth:"2",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11.48 3.499a.562.562 0 011.04 0l2.125 5.111a.563.563 0 00.475.345l5.518.442c.499.04.701.663.321.988l-4.204 3.602a.563.563 0 00-.182.557l1.285 5.385a.562.562 0 01-.84.61l-4.725-2.885a.563.563 0 00-.586 0L6.982 20.54a.562.562 0 01-.84-.61l1.285-5.386a.562.562 0 00-.182-.557l-4.204-3.602a.563.563 0 01.321-.988l5.518-.442a.563.563 0 00.475-.345L11.48 3.5z"})})}),r.jsx("span",{className:"truncate",children:p}),R&&r.jsx(i.Ct,{variant:"info",children:"Main"}),g&&y&&r.jsx(i.Ct,{variant:"warning",dot:!0,children:L("worktree.status.waitingForResponse")}),g&&!y&&r.jsx(i.Ct,{variant:"success",dot:!0,children:L("worktree.status.responseCompleted")})]}),g&&r.jsx(i.zx,{variant:"danger",size:"sm",onClick:E,disabled:f,className:"flex-shrink-0",children:f?L("common.ending"):L("common.end")})]})}),r.jsx(i.aY,{children:(0,r.jsxs)("div",{className:"space-y-3",children:[h&&(0,r.jsxs)("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Description"}),r.jsx("p",{className:"text-sm text-gray-700 dark:text-gray-300 line-clamp-2 whitespace-pre-wrap",children:h})]}),k&&(0,r.jsxs)("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Link"}),(0,r.jsxs)("button",{onClick:e=>{e.preventDefault(),e.stopPropagation(),k&&window.open(k,"_blank","noopener,noreferrer")},className:"flex items-center gap-1 text-sm text-cyan-600 dark:text-cyan-400 hover:text-cyan-800 dark:hover:text-cyan-300 hover:underline transition-colors",title:"Open link in new tab",children:[r.jsx("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14"})}),r.jsx("span",{className:"truncate",children:k})]})]}),(0,r.jsxs)("div",{children:[r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mb-1",children:"Status"}),(0,r.jsxs)("div",{className:"flex gap-1 flex-wrap",children:[r.jsx("button",{onClick:e=>O(null,e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${null===P?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-400 dark:border-gray-500":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:"Not set"}),r.jsx("button",{onClick:e=>O("todo",e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${"todo"===P?"bg-gray-100 dark:bg-gray-700 text-gray-700 dark:text-gray-300 border-gray-400 dark:border-gray-500":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700"}`,children:"ToDo"}),r.jsx("button",{onClick:e=>O("doing",e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${"doing"===P?"bg-cyan-100 dark:bg-cyan-900 text-cyan-700 dark:text-cyan-300 border-cyan-400 dark:border-cyan-600":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600 hover:bg-cyan-50 dark:hover:bg-gray-700"}`,children:"Doing"}),r.jsx("button",{onClick:e=>O("done",e),disabled:A,className:`px-2 py-1 text-xs font-medium rounded border transition-colors disabled:opacity-50 ${"done"===P?"bg-green-100 dark:bg-green-900 text-green-700 dark:text-green-300 border-green-400 dark:border-green-600":"bg-white dark:bg-gray-800 text-gray-600 dark:text-gray-400 border-gray-200 dark:border-gray-600 hover:bg-green-50 dark:hover:bg-gray-700"}`,children:"Done"})]})]}),D&&(0,r.jsxs)("div",{className:"flex items-center text-xs text-gray-500 dark:text-gray-400",children:[r.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z"})}),(0,r.jsxs)("span",{children:["Updated ",D]})]})]})})]})})}function h({initialWorktrees:e=[]}){let[t,a]=(0,s.useState)(e),[l,n]=(0,s.useState)([]),[d,o]=(0,s.useState)(!e.length),[c,x]=(0,s.useState)(null),[h,u]=(0,s.useState)(""),[g,y]=(0,s.useState)("updated"),[b,j]=(0,s.useState)("desc"),[k,f]=(0,s.useState)(null),[v,N]=(0,s.useState)(null),[w,C]=(0,s.useState)(null),[S,P]=(0,s.useState)([]),[z,A]=(0,s.useState)(!1),[$,L]=(0,s.useState)(null),T=(0,s.useCallback)(async()=>{try{let e=await m.J1.getExcluded();e.success&&P(e.repositories)}catch{}},[]),M=(0,s.useCallback)(async(e=!1)=>{try{e||o(!0),x(null);let t=await m.Iv.getAll();a(t.worktrees),n(t.repositories)}catch(e){x((0,m.zG)(e))}finally{e||o(!1)}},[]),D=e=>!!(e&&"session_status_changed"===e.type),{status:R}=function(e={}){let{worktreeIds:t=[],onMessage:a,onStatusChange:r,autoReconnect:l=!0,reconnectDelay:n=3e3}=e,[i,d]=(0,s.useState)("disconnected"),o=(0,s.useRef)(null),c=(0,s.useRef)(),x=(0,s.useRef)(new Set),m=(0,s.useCallback)(e=>{d(e),r?.(e)},[r]),p=(0,s.useCallback)(()=>{if(o.current?.readyState===WebSocket.OPEN)return;m("connecting");let e="https:"===window.location.protocol?"wss:":"ws:",t=new WebSocket(`${e}//${window.location.host}`);t.onopen=()=>{m("connected"),x.current.forEach(e=>{t.send(JSON.stringify({type:"subscribe",worktreeId:e}))})},t.onmessage=e=>{try{let t=JSON.parse(e.data);a?.(t)}catch(e){console.error("Failed to parse WebSocket message:",e)}},t.onerror=()=>{m("error")},t.onclose=()=>{m("disconnected"),o.current=null,l&&(c.current=setTimeout(()=>{p()},n))},o.current=t},[m,a,l,n]),h=(0,s.useCallback)(()=>{c.current&&clearTimeout(c.current),o.current&&(o.current.close(1e3,"Client disconnect"),o.current=null),m("disconnected")},[m]);return{status:i,subscribe:(0,s.useCallback)(e=>{o.current?.readyState===WebSocket.OPEN&&(o.current.send(JSON.stringify({type:"subscribe",worktreeId:e})),x.current.add(e))},[]),unsubscribe:(0,s.useCallback)(e=>{o.current?.readyState===WebSocket.OPEN&&(o.current.send(JSON.stringify({type:"unsubscribe",worktreeId:e})),x.current.delete(e))},[]),sendMessage:(0,s.useCallback)(e=>{o.current?.readyState===WebSocket.OPEN&&o.current.send(JSON.stringify(e))},[]),connect:p,disconnect:h}}({onMessage:(0,s.useCallback)(e=>{if(D(e.data)){let t=e.data;a(e=>e.map(e=>e.id===t.worktreeId?{...e,isSessionRunning:t.isRunning}:e))}"broadcast"===e.type&&M(!0)},[M])}),E=(0,s.useMemo)(()=>{let e=[...t];if(k&&(e=e.filter(e=>e.repositoryPath===k)),null!==v&&(e="unset"===v?e.filter(e=>!e.status):e.filter(e=>e.status===v)),h){let t=h.toLowerCase();e=e.filter(e=>e.name.toLowerCase().includes(t)||e.path.toLowerCase().includes(t)||e.repositoryName.toLowerCase().includes(t)||e.lastMessageSummary?.toLowerCase().includes(t)||e.description?.toLowerCase().includes(t))}return e.sort((e,t)=>{let a=0;switch(g){case"name":a=e.name.localeCompare(t.name);break;case"updated":a=(e.updatedAt?new Date(e.updatedAt).getTime():0)-(t.updatedAt?new Date(t.updatedAt).getTime():0);break;case"favorite":a=(e.favorite?1:0)-(t.favorite?1:0)}return"asc"===b?a:-a}),e},[t,k,v,h,g,b]),I=(0,s.useMemo)(()=>{let e=new Map;for(let t of E){let a=t.repositoryPath||"unknown";e.has(a)||e.set(a,[]),e.get(a).push(t)}return e},[E]),O=e=>{g===e?j(e=>"asc"===e?"desc":"asc"):(y(e),j("asc"))},_=async e=>{L(e);try{let t=await m.J1.restore(e);t.warning&&x(t.warning),await M(),await T()}catch(e){x((0,m.zG)(e))}finally{L(null)}},F=async(e,t)=>{let a=l.find(t=>t.path===e)?.worktreeCount||0;if("delete"===prompt(`Delete repository "${t}"?
2
2
 
3
3
  This will delete:
4
- - ${s} worktree(s)
4
+ - ${a} worktree(s)
5
5
  - Related chat history
6
6
  - Related memos
7
7
 
@@ -11,4 +11,4 @@ This repository will be added to the exclusion list.
11
11
  It will NOT be re-registered when you run "Sync All".
12
12
  You can restore it from the excluded repositories list.
13
13
 
14
- Type "delete" to confirm:`)){C(e);try{await m.J1.delete(e),f===e&&v(null),await R(),await L()}catch(e){x((0,m.zG)(e))}finally{C(null)}}};return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,a.jsxs)(i.Ct,{variant:"gray",children:[t.length," branches"]}),l.length>0&&(0,a.jsxs)(i.Ct,{variant:"info",children:[l.length," ",1===l.length?"repository":"repositories"]}),"connected"===M&&a.jsx(i.Ct,{variant:"success",dot:!0,children:"Live"})]}),a.jsx("div",{className:"flex gap-2 w-full sm:w-auto",children:a.jsx(i.zx,{variant:"secondary",size:"sm",onClick:()=>R(),disabled:o,children:o?"Loading...":"Refresh"})})]}),a.jsx("div",{className:"flex flex-col sm:flex-row gap-3",children:a.jsx("input",{type:"text",placeholder:"Search worktrees...",value:u,onChange:e=>h(e.target.value),className:"input flex-1"})}),l.length>0&&(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap items-center",children:[(0,a.jsxs)(i.zx,{variant:null===f?"primary":"ghost",size:"sm",onClick:()=>v(null),children:["All (",t.length,")"]}),l.map(e=>(0,a.jsxs)("div",{className:"relative group inline-flex items-center",children:[(0,a.jsxs)(i.zx,{variant:f===e.path?"primary":"ghost",size:"sm",onClick:()=>v(e.path),className:"pr-6",children:[e.name," (",e.worktreeCount,")"]}),a.jsx("button",{className:"absolute right-1 opacity-0 group-hover:opacity-100 text-gray-400 hover:text-red-500 transition-opacity px-1",onClick:t=>{t.stopPropagation(),F(e.path,e.name)},disabled:k===e.path,title:"Delete repository",children:k===e.path?"...":"x"})]},e.path))]}),(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap items-center",children:[a.jsx(i.zx,{variant:null===N?"primary":"ghost",size:"sm",onClick:()=>w(null),children:"All"}),a.jsx(i.zx,{variant:"todo"===N?"primary":"ghost",size:"sm",onClick:()=>w("todo"),children:"\uD83D\uDCDD ToDo"}),a.jsx(i.zx,{variant:"doing"===N?"primary":"ghost",size:"sm",onClick:()=>w("doing"),children:"\uD83D\uDEA7 Doing"}),a.jsx(i.zx,{variant:"done"===N?"primary":"ghost",size:"sm",onClick:()=>w("done"),children:"✅ Done"}),a.jsx(i.zx,{variant:"unset"===N?"primary":"ghost",size:"sm",onClick:()=>w("unset"),children:"Not set"})]}),(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[a.jsx("span",{className:"text-sm text-gray-600 self-center",children:"Sort by:"}),(0,a.jsxs)(i.zx,{variant:"favorite"===g?"primary":"ghost",size:"sm",onClick:()=>_("favorite"),children:["⭐ Favorite ","favorite"===g&&("asc"===b?"↑":"↓")]}),(0,a.jsxs)(i.zx,{variant:"name"===g?"primary":"ghost",size:"sm",onClick:()=>_("name"),children:["Name ","name"===g&&("asc"===b?"↑":"↓")]}),(0,a.jsxs)(i.zx,{variant:"updated"===g?"primary":"ghost",size:"sm",onClick:()=>_("updated"),children:["Updated ","updated"===g&&("asc"===b?"↑":"↓")]})]}),c&&a.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:a.jsx("p",{className:"text-sm text-red-800",children:c})}),o&&!t.length&&(0,a.jsxs)("div",{className:"text-center py-12",children:[a.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 border-t-blue-600"}),a.jsx("p",{className:"mt-4 text-gray-600",children:"Loading worktrees..."})]}),!o&&!c&&0===E.length&&(0,a.jsxs)("div",{className:"text-center py-12",children:[a.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:a.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),a.jsx("p",{className:"mt-4 text-gray-600",children:u?"No worktrees found matching your search":"No worktrees found"})]}),!o&&E.length>0&&a.jsx("div",{className:"space-y-8",children:Array.from(I.entries()).map(([e,t])=>{let s=l.find(t=>t.path===e),r=s?.name||"Unknown Repository";return(0,a.jsxs)("div",{className:"space-y-4",children:[(l.length>1||!f)&&(0,a.jsxs)("div",{className:"flex items-center gap-3 pb-2 border-b border-gray-200",children:[a.jsx("h3",{className:"text-xl font-semibold text-gray-900",children:r}),a.jsx(i.Ct,{variant:"gray",children:t.length})]}),a.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(e=>a.jsx(p,{worktree:e,onSessionKilled:R,onStatusChanged:R},e.id))})]},e)})}),S.length>0&&(0,a.jsxs)("div",{className:"border border-gray-200 rounded-lg",children:[(0,a.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 transition-colors",onClick:()=>A(!z),children:[(0,a.jsxs)("span",{className:"text-sm font-medium text-gray-700",children:["Excluded Repositories (",S.length,")"]}),a.jsx("span",{className:"text-gray-400 text-sm",children:z?"Hide":"Show"})]}),z&&a.jsx("div",{className:"border-t border-gray-200 divide-y divide-gray-100",children:S.map(e=>(0,a.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,a.jsxs)("div",{children:[a.jsx("span",{className:"text-sm font-medium text-gray-700",children:e.name}),a.jsx("span",{className:"text-xs text-gray-500 ml-2",children:e.path})]}),a.jsx(i.zx,{variant:"secondary",size:"sm",onClick:()=>O(e.path),disabled:$===e.path,children:$===e.path?"Restoring...":"Restore"})]},e.id))})]})]})}s(35047),s(2491),s(43053),s(15470),s(11867);class h{constructor(){}static getInstance(){return h.instance||(h.instance=new h),h.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return`https://${t[1]}/${t[3]}`.toLowerCase().replace(/\/$/,"");let s=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return s?`https://${s[1]}/${s[2]}`.toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let s=e.match(/:(.+?)(\.git)?$/);if(s&&e.startsWith("git@")){let e=s[1].split("/");return e[e.length-1]}let a=e.match(/\/([^\/]+?)(\.git)?$/);return a?a[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")&&/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}}}function g({onRepositoryAdded:e}){let[t,s]=(0,r.useState)(!1),[l,n]=(0,r.useState)("local"),[o,d]=(0,r.useState)(""),[c,x]=(0,r.useState)(""),[p,u]=(0,r.useState)(!1),[g,y]=(0,r.useState)(!1),[b,j]=(0,r.useState)(!1),[f,v]=(0,r.useState)(null),[N,w]=(0,r.useState)(null),[k,C]=(0,r.useState)(null),S=h.getInstance(),P=(0,r.useCallback)(async t=>{try{let a=await m.J1.getCloneStatus(t);"completed"===a.status?(C("Repository cloned successfully"),j(!1),v(null),x(""),s(!1),e&&e()):"failed"===a.status?(w(a.error?.message||"Clone failed"),j(!1),v(null)):("running"===a.status||"pending"===a.status)&&setTimeout(()=>P(t),2e3)}catch(e){w((0,m.zG)(e)),j(!1),v(null)}},[e]),z=async t=>{if(t.preventDefault(),!o.trim()){w("Repository path is required");return}w(null),C(null),u(!0);try{let t=await m.J1.scan(o);C(t.message),d(""),s(!1),e&&e()}catch(e){w((0,m.zG)(e))}finally{u(!1)}},A=async e=>{if(e.preventDefault(),!c.trim()){w("Clone URL is required");return}let t=S.validate(c.trim());if(!t.valid){"EMPTY_URL"===t.error?w("Clone URL is required"):w("Invalid URL format");return}w(null),C(null),j(!0);try{let e=await m.J1.clone(c.trim());v(e.jobId)}catch(e){w((0,m.zG)(e)),j(!1)}},$=async()=>{w(null),C(null),y(!0);try{let t=await m.J1.sync();C(t.message),e&&e()}catch(e){w((0,m.zG)(e))}finally{y(!1)}},T=()=>{s(!1),d(""),x(""),w(null),n("local")};return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!t&&a.jsx(i.zx,{variant:"primary",size:"sm",onClick:()=>s(!0),children:"+ Add Repository"}),a.jsx(i.zx,{variant:"secondary",size:"sm",onClick:$,disabled:g,children:g?"Syncing...":"Sync All"})]}),t&&a.jsx(i.Zb,{padding:"lg",children:(0,a.jsxs)("div",{className:"space-y-4",children:[a.jsx("div",{children:a.jsx("h3",{className:"text-lg font-semibold mb-2",children:"Add New Repository"})}),(0,a.jsxs)("div",{className:"flex border-b border-gray-200",role:"tablist",children:[a.jsx("button",{role:"tab","aria-selected":"local"===l,onClick:()=>n("local"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${"local"===l?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"Local Path"}),a.jsx("button",{role:"tab","aria-selected":"url"===l,onClick:()=>n("url"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${"url"===l?"border-blue-500 text-blue-600":"border-transparent text-gray-500 hover:text-gray-700"}`,children:"Clone URL"})]}),"local"===l&&(0,a.jsxs)("form",{onSubmit:z,className:"space-y-4",children:[(0,a.jsxs)("div",{children:[a.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Enter the absolute path to a git repository containing worktrees."}),a.jsx("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-gray-700 mb-2",children:"Repository Path"}),a.jsx("input",{id:"repositoryPath",type:"text",value:o,onChange:e=>d(e.target.value),placeholder:"/absolute/path/to/repository",className:"input w-full font-mono text-sm",disabled:p}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Example: /Users/username/projects/my-repo"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[a.jsx(i.zx,{type:"submit",variant:"primary",disabled:p||!o.trim(),children:p?"Scanning...":"Scan & Add"}),a.jsx(i.zx,{type:"button",variant:"ghost",onClick:T,disabled:p,children:"Cancel"})]})]}),"url"===l&&(0,a.jsxs)("form",{onSubmit:A,className:"space-y-4",children:[(0,a.jsxs)("div",{children:[a.jsx("p",{className:"text-sm text-gray-600 mb-4",children:"Enter a git clone URL to clone a remote repository."}),a.jsx("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-gray-700 mb-2",children:"Clone URL"}),a.jsx("input",{id:"cloneUrl",type:"text",value:c,onChange:e=>x(e.target.value),placeholder:"https://github.com/user/repo.git",className:"input w-full font-mono text-sm",disabled:b}),a.jsx("p",{className:"text-xs text-gray-500 mt-1",children:"Supports HTTPS and SSH URLs"})]}),(0,a.jsxs)("div",{className:"flex gap-2",children:[a.jsx(i.zx,{type:"submit",variant:"primary",disabled:b||!c.trim(),children:b?"Cloning...":"Clone"}),a.jsx(i.zx,{type:"button",variant:"ghost",onClick:T,disabled:b,children:"Cancel"})]})]})]})}),k&&a.jsx("div",{className:"p-4 bg-green-50 border border-green-200 rounded-lg",children:a.jsx("p",{className:"text-sm text-green-800",children:k})}),N&&a.jsx("div",{className:"p-4 bg-red-50 border border-red-200 rounded-lg",children:a.jsx("p",{className:"text-sm text-red-800",children:N})})]})}function y({appId:e,pollInterval:t=3e4,showResponseTime:s=!1,compact:l=!1}){let[n,i]=(0,r.useState)(null),[o,d]=(0,r.useState)(!0);if((0,r.useCallback)(async()=>{try{let t=await fetch(`/api/external-apps/${e}/health`);if(t.ok){let e=await t.json();i(e)}else i({id:e,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch{i({id:e,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{d(!1)}},[e]),o)return(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-gray-300 animate-pulse"}),!l&&a.jsx("span",{className:"text-xs text-gray-400",children:"Checking..."})]});let c=n?.healthy??!1,x=c?"bg-green-500":"bg-gray-400",m=c?"Running":"Stopped";return l?a.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full ${x}`,title:m}):(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[a.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full ${x}`}),a.jsx("span",{className:`text-xs ${c?"text-green-600":"text-gray-500"}`,children:m}),s&&n?.responseTime!==void 0&&(0,a.jsxs)("span",{className:"text-xs text-gray-400",children:["(",n.responseTime,"ms)"]})]})}function b({app:e,onEdit:t,onDelete:s}){var l;let[n,o]=(0,r.useState)(!1),[d,c]=(0,r.useState)(!1),x=async()=>{c(!0);try{await s(e.id)}finally{c(!1),o(!1)}},m=`/proxy/${e.pathPrefix}/`;return(0,a.jsxs)(i.Zb,{padding:"md",className:"relative",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[a.jsx("h4",{className:"text-base font-semibold text-gray-900 truncate",children:e.displayName}),a.jsx("p",{className:"text-xs text-gray-500 mt-0.5 font-mono truncate",children:e.name})]}),a.jsx(i.Ct,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[e.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[l=e.appType]||l})]}),(0,a.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Status"}),a.jsx(y,{appId:e.id,pollInterval:3e4})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Port"}),(0,a.jsxs)("span",{className:"text-sm font-mono text-gray-900",children:[":",e.targetPort]})]}),(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"Path"}),(0,a.jsxs)("span",{className:"text-sm font-mono text-gray-900 truncate max-w-[150px]",children:["/proxy/",e.pathPrefix,"/"]})]}),e.websocketEnabled&&(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("span",{className:"text-sm text-gray-600",children:"WebSocket"}),a.jsx(i.Ct,{variant:"info",children:"Enabled"})]}),!e.enabled&&a.jsx("div",{className:"mt-2 py-1 px-2 bg-yellow-50 border border-yellow-200 rounded text-xs text-yellow-700",children:"This app is disabled"})]}),n?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("p",{className:"text-sm text-gray-600",children:['Delete "',e.displayName,'"?']}),(0,a.jsxs)("div",{className:"flex gap-2",children:[a.jsx(i.zx,{variant:"danger",size:"sm",onClick:x,disabled:d,loading:d,children:"Delete"}),a.jsx(i.zx,{variant:"ghost",size:"sm",onClick:()=>o(!1),disabled:d,children:"Cancel"})]})]}):(0,a.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[a.jsx(i.zx,{variant:"primary",size:"sm",onClick:()=>window.open(m,"_blank"),disabled:!e.enabled,children:"Open"}),a.jsx(i.zx,{variant:"secondary",size:"sm",onClick:()=>t(e),children:"Settings"}),a.jsx(i.zx,{variant:"ghost",size:"sm",onClick:()=>o(!0),className:"text-red-600 hover:bg-red-50",children:"Delete"})]})]})}let j={MIN:1024,MAX:65535},f=/^[a-zA-Z0-9-]+$/,v={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},N=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:v[e]}));function w({isOpen:e,onClose:t,editApp:s,onSave:l}){let n=!!s,[o,d]=(0,r.useState)(""),[c,x]=(0,r.useState)(""),[m,p]=(0,r.useState)(""),[u,h]=(0,r.useState)(""),[g,y]=(0,r.useState)(""),[b,v]=(0,r.useState)(!1),[w,k]=(0,r.useState)(""),[C,S]=(0,r.useState)(!0),[P,z]=(0,r.useState)({}),[A,$]=(0,r.useState)(!1),[T,L]=(0,r.useState)(null),R=async e=>{e.preventDefault(),L(null);let a=function(e,t){var s;let a={};return e.displayName?.trim()||(a.displayName="Display name is required"),t||(e.name?.trim()?f.test(e.name)||(a.name="Only alphanumeric characters and hyphens are allowed"):a.name="Identifier name is required",e.pathPrefix?.trim()?f.test(e.pathPrefix)||(a.pathPrefix="Only alphanumeric characters and hyphens are allowed"):a.pathPrefix="Path prefix is required"),e.targetPort?"number"!=typeof e.targetPort||Number.isInteger(s=e.targetPort)&&s>=j.MIN&&s<=j.MAX||(a.targetPort=`Port must be between ${j.MIN} and ${j.MAX}`):a.targetPort="Port number is required",t||e.appType||(a.appType="App type is required"),a}({displayName:o,name:c,pathPrefix:m,targetPort:u,appType:g},n);if(Object.keys(a).length>0){z(a);return}z({}),$(!0);try{if(n&&s){let e=await fetch(`/api/external-apps/${s.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:o,description:w||void 0,targetPort:u||void 0,websocketEnabled:b,enabled:C})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to update app")}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:o,name:c,pathPrefix:m,targetPort:u,appType:g,websocketEnabled:b,description:w||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to create app")}}l(),t()}catch(e){L(e instanceof Error?e.message:"An error occurred")}finally{$(!1)}};return a.jsx(i.u_,{isOpen:e,onClose:t,title:n?"Edit External App":"Add External App",size:"md",children:(0,a.jsxs)("form",{onSubmit:R,className:"space-y-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-gray-700 mb-1",children:["Display Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{id:"displayName",type:"text",value:o,onChange:e=>d(e.target.value),className:`input w-full ${P.displayName?"border-red-500":""}`,placeholder:"My App",disabled:A}),P.displayName&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.displayName})]}),!n&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 mb-1",children:["Identifier Name ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{id:"name",type:"text",value:c,onChange:e=>x(e.target.value),className:`input w-full font-mono ${P.name?"border-red-500":""}`,placeholder:"my-app",disabled:A}),a.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"Alphanumeric and hyphens only. Cannot be changed later."}),P.name&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.name})]}),!n&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-gray-700 mb-1",children:["Path Prefix ",a.jsx("span",{className:"text-red-500",children:"*"})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[a.jsx("span",{className:"text-sm text-gray-500 mr-1",children:"/proxy/"}),a.jsx("input",{id:"pathPrefix",type:"text",value:m,onChange:e=>p(e.target.value),className:`input flex-1 font-mono ${P.pathPrefix?"border-red-500":""}`,placeholder:"app-name",disabled:A}),a.jsx("span",{className:"text-sm text-gray-500 ml-1",children:"/"})]}),a.jsx("p",{className:"mt-1 text-xs text-gray-500",children:"URL path for accessing this app. Cannot be changed later."}),P.pathPrefix&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.pathPrefix})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-gray-700 mb-1",children:["Port Number ",a.jsx("span",{className:"text-red-500",children:"*"})]}),a.jsx("input",{id:"targetPort",type:"number",value:u,onChange:e=>h(e.target.value?parseInt(e.target.value,10):""),className:`input w-full font-mono ${P.targetPort?"border-red-500":""}`,placeholder:"5173",min:j.MIN,max:j.MAX,disabled:A}),(0,a.jsxs)("p",{className:"mt-1 text-xs text-gray-500",children:["Target port (",j.MIN,"-",j.MAX,")"]}),P.targetPort&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.targetPort})]}),!n&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-gray-700 mb-1",children:["App Type ",a.jsx("span",{className:"text-red-500",children:"*"})]}),(0,a.jsxs)("select",{id:"appType",value:g,onChange:e=>y(e.target.value),className:`input w-full ${P.appType?"border-red-500":""}`,disabled:A,children:[a.jsx("option",{value:"",children:"Select app type..."}),N.map(e=>a.jsx("option",{value:e.value,children:e.label},e.value))]}),P.appType&&a.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.appType})]}),(0,a.jsxs)("div",{children:[a.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 mb-1",children:"Description"}),a.jsx("textarea",{id:"description",value:w,onChange:e=>k(e.target.value),className:"input w-full",placeholder:"Optional description...",rows:2,disabled:A})]}),(0,a.jsxs)("div",{className:"flex items-center",children:[a.jsx("input",{id:"websocketEnabled",type:"checkbox",checked:b,onChange:e=>v(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:A}),a.jsx("label",{htmlFor:"websocketEnabled",className:"ml-2 text-sm text-gray-700",children:"Enable WebSocket support"})]}),n&&(0,a.jsxs)("div",{className:"flex items-center",children:[a.jsx("input",{id:"enabled",type:"checkbox",checked:C,onChange:e=>S(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:A}),a.jsx("label",{htmlFor:"enabled",className:"ml-2 text-sm text-gray-700",children:"App is enabled"})]}),T&&a.jsx("div",{className:"p-3 bg-red-50 border border-red-200 rounded text-sm text-red-700",children:T}),(0,a.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-gray-200",children:[a.jsx(i.zx,{type:"button",variant:"ghost",onClick:t,disabled:A,children:"Cancel"}),a.jsx(i.zx,{type:"submit",variant:"primary",loading:A,children:n?"Save Changes":"Add App"})]})]})})}function k(){let[e,t]=(0,r.useState)([]),[s,l]=(0,r.useState)(!0),[n,o]=(0,r.useState)(null),[d,c]=(0,r.useState)(!1),[x,m]=(0,r.useState)(null),p=(0,r.useCallback)(async()=>{try{o(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let s=await e.json();t(s.apps||[])}catch(e){o(e instanceof Error?e.message:"An error occurred")}finally{l(!1)}},[]),u=(0,r.useCallback)(e=>{m(e),c(!0)},[]),h=(0,r.useCallback)(()=>{m(null),c(!0)},[]),g=(0,r.useCallback)(async e=>{try{let t=await fetch(`/api/external-apps/${e}`,{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}p()}catch(e){console.error("Failed to delete app:",e)}},[p]),y=(0,r.useCallback)(()=>{p()},[p]),j=(0,r.useCallback)(()=>{c(!1),m(null)},[]);return(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[a.jsx("h2",{className:"text-xl font-semibold text-gray-900",children:"External Apps"}),a.jsx(i.zx,{variant:"primary",size:"sm",onClick:h,children:"+ Add App"})]}),s?a.jsx(i.Zb,{padding:"lg",children:(0,a.jsxs)("div",{className:"flex items-center justify-center py-8",children:[a.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-blue-600"}),a.jsx("span",{className:"ml-3 text-gray-600",children:"Loading apps..."})]})}):n?a.jsx(i.Zb,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-8",children:[a.jsx("p",{className:"text-red-600 mb-4",children:"Failed to load external apps"}),a.jsx(i.zx,{variant:"secondary",size:"sm",onClick:p,children:"Retry"})]})}):0===e.length?a.jsx(i.Zb,{padding:"lg",children:(0,a.jsxs)("div",{className:"text-center py-8",children:[a.jsx("p",{className:"text-gray-500 mb-4",children:"No external apps registered yet."}),a.jsx("p",{className:"text-sm text-gray-400 mb-4",children:"Add an external app to proxy requests to other frontend applications."}),a.jsx(i.zx,{variant:"primary",size:"sm",onClick:h,children:"Add Your First App"})]})}):a.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(e=>a.jsx(b,{app:e,onEdit:u,onDelete:g},e.id))}),a.jsx(w,{isOpen:d,onClose:j,editApp:x,onSave:y})]})}function C(){let[e,t]=(0,r.useState)(0),s=(0,r.useCallback)(()=>{t(e=>e+1)},[]);return a.jsx(l.Vw,{children:(0,a.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,a.jsxs)("div",{className:"mb-8",children:[a.jsx("h1",{className:"mb-2",children:"CommandMate"}),a.jsx("p",{className:"text-lg text-gray-600",children:"Git worktree management with Claude CLI and tmux sessions"})]}),a.jsx("div",{className:"mb-8",children:a.jsx(g,{onRepositoryAdded:s})}),a.jsx(u,{},e),a.jsx("div",{className:"mt-8",children:a.jsx(k,{})})]})})}},35480:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>a});let a=(0,s(68570).createProxy)(String.raw`/home/runner/work/CommandMate/CommandMate/src/app/page.tsx#default`)},6162:(e,t,s)=>{"use strict";s.d(t,{T:()=>l});var a=s(34643);function r(e,t){return(...e)=>{try{return t(...e)}catch{throw Error(void 0)}}}let l=r(0,a.T_);r(0,a.Gb)}};var t=require("../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),a=t.X(0,[8948,3294,6621,8705,7808,3860,539],()=>s(37906));module.exports=a})();
14
+ Type "delete" to confirm:`)){C(e);try{await m.J1.delete(e),k===e&&f(null),await M(),await T()}catch(e){x((0,m.zG)(e))}finally{C(null)}}};return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex flex-col sm:flex-row gap-4 items-start sm:items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 flex-wrap",children:[(0,r.jsxs)(i.Ct,{variant:"gray",children:[t.length," branches"]}),l.length>0&&(0,r.jsxs)(i.Ct,{variant:"info",children:[l.length," ",1===l.length?"repository":"repositories"]}),"connected"===R&&r.jsx(i.Ct,{variant:"success",dot:!0,children:"Live"})]}),r.jsx("div",{className:"flex gap-2 w-full sm:w-auto",children:r.jsx(i.zx,{variant:"secondary",size:"sm",onClick:()=>M(),disabled:d,children:d?"Loading...":"Refresh"})})]}),r.jsx("div",{className:"flex flex-col sm:flex-row gap-3",children:r.jsx("input",{type:"text",placeholder:"Search worktrees...",value:h,onChange:e=>u(e.target.value),className:"input flex-1"})}),l.length>0&&(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap items-center",children:[(0,r.jsxs)(i.zx,{variant:null===k?"primary":"ghost",size:"sm",onClick:()=>f(null),children:["All (",t.length,")"]}),l.map(e=>(0,r.jsxs)("div",{className:"relative group inline-flex items-center",children:[(0,r.jsxs)(i.zx,{variant:k===e.path?"primary":"ghost",size:"sm",onClick:()=>f(e.path),className:"pr-6",children:[e.name," (",e.worktreeCount,")"]}),r.jsx("button",{className:"absolute right-1 opacity-0 group-hover:opacity-100 text-gray-400 hover:text-red-500 transition-opacity px-1",onClick:t=>{t.stopPropagation(),F(e.path,e.name)},disabled:w===e.path,title:"Delete repository",children:w===e.path?"...":"x"})]},e.path))]}),(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap items-center",children:[r.jsx(i.zx,{variant:null===v?"primary":"ghost",size:"sm",onClick:()=>N(null),children:"All"}),r.jsx(i.zx,{variant:"todo"===v?"primary":"ghost",size:"sm",onClick:()=>N("todo"),children:"\uD83D\uDCDD ToDo"}),r.jsx(i.zx,{variant:"doing"===v?"primary":"ghost",size:"sm",onClick:()=>N("doing"),children:"\uD83D\uDEA7 Doing"}),r.jsx(i.zx,{variant:"done"===v?"primary":"ghost",size:"sm",onClick:()=>N("done"),children:"✅ Done"}),r.jsx(i.zx,{variant:"unset"===v?"primary":"ghost",size:"sm",onClick:()=>N("unset"),children:"Not set"})]}),(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-400 self-center",children:"Sort by:"}),(0,r.jsxs)(i.zx,{variant:"favorite"===g?"primary":"ghost",size:"sm",onClick:()=>O("favorite"),children:["⭐ Favorite ","favorite"===g&&("asc"===b?"↑":"↓")]}),(0,r.jsxs)(i.zx,{variant:"name"===g?"primary":"ghost",size:"sm",onClick:()=>O("name"),children:["Name ","name"===g&&("asc"===b?"↑":"↓")]}),(0,r.jsxs)(i.zx,{variant:"updated"===g?"primary":"ghost",size:"sm",onClick:()=>O("updated"),children:["Updated ","updated"===g&&("asc"===b?"↑":"↓")]})]}),c&&r.jsx("div",{className:"p-4 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg",children:r.jsx("p",{className:"text-sm text-red-800 dark:text-red-300",children:c})}),d&&!t.length&&(0,r.jsxs)("div",{className:"text-center py-12",children:[r.jsx("div",{className:"inline-block animate-spin rounded-full h-8 w-8 border-4 border-gray-300 dark:border-gray-600 border-t-cyan-600"}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:"Loading worktrees..."})]}),!d&&!c&&0===E.length&&(0,r.jsxs)("div",{className:"text-center py-12",children:[r.jsx("svg",{className:"mx-auto h-12 w-12 text-gray-400",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:r.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z"})}),r.jsx("p",{className:"mt-4 text-gray-600 dark:text-gray-400",children:h?"No worktrees found matching your search":"No worktrees found"})]}),!d&&E.length>0&&r.jsx("div",{className:"space-y-8",children:Array.from(I.entries()).map(([e,t])=>{let a=l.find(t=>t.path===e),s=a?.name||"Unknown Repository";return(0,r.jsxs)("div",{className:"space-y-4",children:[(l.length>1||!k)&&(0,r.jsxs)("div",{className:"flex items-center gap-3 pb-2 border-b border-gray-200 dark:border-gray-700",children:[r.jsx("h3",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:s}),r.jsx(i.Ct,{variant:"gray",children:t.length})]}),r.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6",children:t.map(e=>r.jsx(p,{worktree:e,onSessionKilled:M,onStatusChanged:M},e.id))})]},e)})}),S.length>0&&(0,r.jsxs)("div",{className:"border border-gray-200 dark:border-gray-700 rounded-lg",children:[(0,r.jsxs)("button",{className:"w-full flex items-center justify-between p-4 text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors",onClick:()=>A(!z),children:[(0,r.jsxs)("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:["Excluded Repositories (",S.length,")"]}),r.jsx("span",{className:"text-gray-400 text-sm",children:z?"Hide":"Show"})]}),z&&r.jsx("div",{className:"border-t border-gray-200 dark:border-gray-700 divide-y divide-gray-100 dark:divide-gray-800",children:S.map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between p-4",children:[(0,r.jsxs)("div",{children:[r.jsx("span",{className:"text-sm font-medium text-gray-700 dark:text-gray-300",children:e.name}),r.jsx("span",{className:"text-xs text-gray-500 dark:text-gray-400 ml-2",children:e.path})]}),r.jsx(i.zx,{variant:"secondary",size:"sm",onClick:()=>_(e.path),disabled:$===e.path,children:$===e.path?"Restoring...":"Restore"})]},e.id))})]})]})}a(35047),a(2491),a(43053),a(15470),a(11867);class u{constructor(){}static getInstance(){return u.instance||(u.instance=new u),u.instance}normalize(e){let t=e.match(/^ssh:\/\/git@([^:\/]+)(:\d+)?\/(.+?)(\.git)?$/);if(t)return`https://${t[1]}/${t[3]}`.toLowerCase().replace(/\/$/,"");let a=e.match(/^git@([^:]+):(.+?)(\.git)?$/);return a?`https://${a[1]}/${a[2]}`.toLowerCase().replace(/\/$/,""):e.replace(/\.git\/?$/,"").replace(/\/$/,"").toLowerCase()}isSameRepository(e,t){return this.normalize(e)===this.normalize(t)}extractRepoName(e){let t=e.match(/^ssh:\/\/git@[^\/]+\/(.+?)(\.git)?$/);if(t){let e=t[1].split("/");return e[e.length-1]}let a=e.match(/:(.+?)(\.git)?$/);if(a&&e.startsWith("git@")){let e=a[1].split("/");return e[e.length-1]}let r=e.match(/\/([^\/]+?)(\.git)?$/);return r?r[1]:""}getUrlType(e){return e.startsWith("https://")?"https":e.startsWith("git@")||e.startsWith("ssh://")?"ssh":null}validate(e){if(!e||"string"!=typeof e||""===e.trim())return{valid:!1,error:"EMPTY_URL"};let t=e.trim();return t.startsWith("https://")?/^https:\/\/[^\/]+\/[^\/]+\/[^\/]+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("git@")?/^git@[^:]+:.+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}:t.startsWith("ssh://")&&/^ssh:\/\/git@[^\/]+(:\d+)?\/[^\/]+\/.+(\.git)?$/.test(t)?{valid:!0}:{valid:!1,error:"INVALID_URL_FORMAT"}}}function g({onRepositoryAdded:e}){let[t,a]=(0,s.useState)(!1),[l,n]=(0,s.useState)("local"),[d,o]=(0,s.useState)(""),[c,x]=(0,s.useState)(""),[p,h]=(0,s.useState)(!1),[g,y]=(0,s.useState)(!1),[b,j]=(0,s.useState)(!1),[k,f]=(0,s.useState)(null),[v,N]=(0,s.useState)(null),[w,C]=(0,s.useState)(null),S=u.getInstance(),P=(0,s.useCallback)(async t=>{try{let r=await m.J1.getCloneStatus(t);"completed"===r.status?(C("Repository cloned successfully"),j(!1),f(null),x(""),a(!1),e&&e()):"failed"===r.status?(N(r.error?.message||"Clone failed"),j(!1),f(null)):("running"===r.status||"pending"===r.status)&&setTimeout(()=>P(t),2e3)}catch(e){N((0,m.zG)(e)),j(!1),f(null)}},[e]),z=async t=>{if(t.preventDefault(),!d.trim()){N("Repository path is required");return}N(null),C(null),h(!0);try{let t=await m.J1.scan(d);C(t.message),o(""),a(!1),e&&e()}catch(e){N((0,m.zG)(e))}finally{h(!1)}},A=async e=>{if(e.preventDefault(),!c.trim()){N("Clone URL is required");return}let t=S.validate(c.trim());if(!t.valid){"EMPTY_URL"===t.error?N("Clone URL is required"):N("Invalid URL format");return}N(null),C(null),j(!0);try{let e=await m.J1.clone(c.trim());f(e.jobId)}catch(e){N((0,m.zG)(e)),j(!1)}},$=async()=>{N(null),C(null),y(!0);try{let t=await m.J1.sync();C(t.message),e&&e()}catch(e){N((0,m.zG)(e))}finally{y(!1)}},L=()=>{a(!1),o(""),x(""),N(null),n("local")};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[!t&&r.jsx(i.zx,{variant:"primary",size:"sm",onClick:()=>a(!0),children:"+ Add Repository"}),r.jsx(i.zx,{variant:"secondary",size:"sm",onClick:$,disabled:g,children:g?"Syncing...":"Sync All"})]}),t&&r.jsx(i.Zb,{padding:"lg",children:(0,r.jsxs)("div",{className:"space-y-4",children:[r.jsx("div",{children:r.jsx("h3",{className:"text-lg font-semibold mb-2 dark:text-gray-100",children:"Add New Repository"})}),(0,r.jsxs)("div",{className:"flex border-b border-gray-200 dark:border-gray-700",role:"tablist",children:[r.jsx("button",{role:"tab","aria-selected":"local"===l,onClick:()=>n("local"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${"local"===l?"border-cyan-500 text-cyan-600 dark:text-cyan-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Local Path"}),r.jsx("button",{role:"tab","aria-selected":"url"===l,onClick:()=>n("url"),className:`px-4 py-2 text-sm font-medium border-b-2 -mb-px transition-colors ${"url"===l?"border-cyan-500 text-cyan-600 dark:text-cyan-400":"border-transparent text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300"}`,children:"Clone URL"})]}),"local"===l&&(0,r.jsxs)("form",{onSubmit:z,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-4",children:"Enter the absolute path to a git repository containing worktrees."}),r.jsx("label",{htmlFor:"repositoryPath",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-2",children:"Repository Path"}),r.jsx("input",{id:"repositoryPath",type:"text",value:d,onChange:e=>o(e.target.value),placeholder:"/absolute/path/to/repository",className:"input w-full font-mono text-sm",disabled:p}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Example: /Users/username/projects/my-repo"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[r.jsx(i.zx,{type:"submit",variant:"primary",disabled:p||!d.trim(),children:p?"Scanning...":"Scan & Add"}),r.jsx(i.zx,{type:"button",variant:"ghost",onClick:L,disabled:p,children:"Cancel"})]})]}),"url"===l&&(0,r.jsxs)("form",{onSubmit:A,className:"space-y-4",children:[(0,r.jsxs)("div",{children:[r.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-4",children:"Enter a git clone URL to clone a remote repository."}),r.jsx("label",{htmlFor:"cloneUrl",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-2",children:"Clone URL"}),r.jsx("input",{id:"cloneUrl",type:"text",value:c,onChange:e=>x(e.target.value),placeholder:"https://github.com/user/repo.git",className:"input w-full font-mono text-sm",disabled:b}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-1",children:"Supports HTTPS and SSH URLs"})]}),(0,r.jsxs)("div",{className:"flex gap-2",children:[r.jsx(i.zx,{type:"submit",variant:"primary",disabled:b||!c.trim(),children:b?"Cloning...":"Clone"}),r.jsx(i.zx,{type:"button",variant:"ghost",onClick:L,disabled:b,children:"Cancel"})]})]})]})}),w&&r.jsx("div",{className:"p-4 bg-green-50 dark:bg-green-900/30 border border-green-200 dark:border-green-800 rounded-lg",children:r.jsx("p",{className:"text-sm text-green-800 dark:text-green-300",children:w})}),v&&r.jsx("div",{className:"p-4 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded-lg",children:r.jsx("p",{className:"text-sm text-red-800 dark:text-red-300",children:v})})]})}function y({appId:e,pollInterval:t=3e4,showResponseTime:a=!1,compact:l=!1}){let[n,i]=(0,s.useState)(null),[d,o]=(0,s.useState)(!0);if((0,s.useCallback)(async()=>{try{let t=await fetch(`/api/external-apps/${e}/health`);if(t.ok){let e=await t.json();i(e)}else i({id:e,healthy:!1,lastChecked:Date.now(),error:"Failed to check health"})}catch{i({id:e,healthy:!1,lastChecked:Date.now(),error:"Network error"})}finally{o(!1)}},[e]),d)return(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:"inline-block h-2.5 w-2.5 rounded-full bg-gray-300 dark:bg-gray-600 animate-pulse"}),!l&&r.jsx("span",{className:"text-xs text-gray-400 dark:text-gray-500",children:"Checking..."})]});let c=n?.healthy??!1,x=c?"bg-green-500":"bg-gray-400",m=c?"Running":"Stopped";return l?r.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full ${x}`,title:m}):(0,r.jsxs)("div",{className:"flex items-center gap-1.5",children:[r.jsx("span",{className:`inline-block h-2.5 w-2.5 rounded-full ${x}`}),r.jsx("span",{className:`text-xs ${c?"text-green-600 dark:text-green-400":"text-gray-500 dark:text-gray-400"}`,children:m}),a&&n?.responseTime!==void 0&&(0,r.jsxs)("span",{className:"text-xs text-gray-400",children:["(",n.responseTime,"ms)"]})]})}function b({app:e,onEdit:t,onDelete:a}){var l;let[n,d]=(0,s.useState)(!1),[o,c]=(0,s.useState)(!1),x=async()=>{c(!0);try{await a(e.id)}finally{c(!1),d(!1)}},m=`/proxy/${e.pathPrefix}/`;return(0,r.jsxs)(i.Zb,{padding:"md",className:"relative",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex-1 min-w-0",children:[r.jsx("h4",{className:"text-base font-semibold text-gray-900 dark:text-gray-100 truncate",children:e.displayName}),r.jsx("p",{className:"text-xs text-gray-500 dark:text-gray-400 mt-0.5 font-mono truncate",children:e.name})]}),r.jsx(i.Ct,{variant:{sveltekit:"warning",streamlit:"error",nextjs:"info",other:"gray"}[e.appType]||"gray",children:{sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"}[l=e.appType]||l})]}),(0,r.jsxs)("div",{className:"space-y-2 mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Status"}),r.jsx(y,{appId:e.id,pollInterval:3e4})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Port"}),(0,r.jsxs)("span",{className:"text-sm font-mono text-gray-900 dark:text-gray-100",children:[":",e.targetPort]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"Path"}),(0,r.jsxs)("span",{className:"text-sm font-mono text-gray-900 dark:text-gray-100 truncate max-w-[150px]",children:["/proxy/",e.pathPrefix,"/"]})]}),e.websocketEnabled&&(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[r.jsx("span",{className:"text-sm text-gray-600 dark:text-gray-300",children:"WebSocket"}),r.jsx(i.Ct,{variant:"info",children:"Enabled"})]}),!e.enabled&&r.jsx("div",{className:"mt-2 py-1 px-2 bg-yellow-50 dark:bg-yellow-900/30 border border-yellow-200 dark:border-yellow-700 rounded text-xs text-yellow-700 dark:text-yellow-300",children:"This app is disabled"})]}),n?(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("p",{className:"text-sm text-gray-600 dark:text-gray-300",children:['Delete "',e.displayName,'"?']}),(0,r.jsxs)("div",{className:"flex gap-2",children:[r.jsx(i.zx,{variant:"danger",size:"sm",onClick:x,disabled:o,loading:o,children:"Delete"}),r.jsx(i.zx,{variant:"ghost",size:"sm",onClick:()=>d(!1),disabled:o,children:"Cancel"})]})]}):(0,r.jsxs)("div",{className:"flex gap-2 flex-wrap",children:[r.jsx(i.zx,{variant:"primary",size:"sm",onClick:()=>window.open(m,"_blank"),disabled:!e.enabled,children:"Open"}),r.jsx(i.zx,{variant:"secondary",size:"sm",onClick:()=>t(e),children:"Settings"}),r.jsx(i.zx,{variant:"ghost",size:"sm",onClick:()=>d(!0),className:"text-red-600 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/30",children:"Delete"})]})]})}let j={MIN:1024,MAX:65535},k=/^[a-zA-Z0-9-]+$/,f={sveltekit:"SvelteKit",streamlit:"Streamlit",nextjs:"Next.js",other:"Other"},v=["sveltekit","streamlit","nextjs","other"].map(e=>({value:e,label:f[e]}));function N({isOpen:e,onClose:t,editApp:a,onSave:l}){let n=!!a,[d,o]=(0,s.useState)(""),[c,x]=(0,s.useState)(""),[m,p]=(0,s.useState)(""),[h,u]=(0,s.useState)(""),[g,y]=(0,s.useState)(""),[b,f]=(0,s.useState)(!1),[N,w]=(0,s.useState)(""),[C,S]=(0,s.useState)(!0),[P,z]=(0,s.useState)({}),[A,$]=(0,s.useState)(!1),[L,T]=(0,s.useState)(null),M=async e=>{e.preventDefault(),T(null);let r=function(e,t){var a;let r={};return e.displayName?.trim()||(r.displayName="Display name is required"),t||(e.name?.trim()?k.test(e.name)||(r.name="Only alphanumeric characters and hyphens are allowed"):r.name="Identifier name is required",e.pathPrefix?.trim()?k.test(e.pathPrefix)||(r.pathPrefix="Only alphanumeric characters and hyphens are allowed"):r.pathPrefix="Path prefix is required"),e.targetPort?"number"!=typeof e.targetPort||Number.isInteger(a=e.targetPort)&&a>=j.MIN&&a<=j.MAX||(r.targetPort=`Port must be between ${j.MIN} and ${j.MAX}`):r.targetPort="Port number is required",t||e.appType||(r.appType="App type is required"),r}({displayName:d,name:c,pathPrefix:m,targetPort:h,appType:g},n);if(Object.keys(r).length>0){z(r);return}z({}),$(!0);try{if(n&&a){let e=await fetch(`/api/external-apps/${a.id}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:d,description:N||void 0,targetPort:h||void 0,websocketEnabled:b,enabled:C})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to update app")}}else{let e=await fetch("/api/external-apps",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({displayName:d,name:c,pathPrefix:m,targetPort:h,appType:g,websocketEnabled:b,description:N||void 0})});if(!e.ok){let t=await e.json();throw Error(t.error||"Failed to create app")}}l(),t()}catch(e){T(e instanceof Error?e.message:"An error occurred")}finally{$(!1)}};return r.jsx(i.u_,{isOpen:e,onClose:t,title:n?"Edit External App":"Add External App",size:"md",children:(0,r.jsxs)("form",{onSubmit:M,className:"space-y-4",children:[r.jsx("div",{className:"rounded-md bg-amber-50 dark:bg-amber-900/30 p-3 mb-4 border border-amber-200 dark:border-amber-700",children:r.jsx("p",{className:"text-sm text-amber-800 dark:text-amber-300",children:"Proxied apps run under the CommandMate origin and can access CommandMate APIs. Only register trusted applications."})}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{htmlFor:"displayName",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",children:["Display Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{id:"displayName",type:"text",value:d,onChange:e=>o(e.target.value),className:`input w-full ${P.displayName?"border-red-500":""}`,placeholder:"My App",disabled:A}),P.displayName&&r.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.displayName})]}),!n&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{htmlFor:"name",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",children:["Identifier Name ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{id:"name",type:"text",value:c,onChange:e=>x(e.target.value),className:`input w-full font-mono ${P.name?"border-red-500":""}`,placeholder:"my-app",disabled:A}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"Alphanumeric and hyphens only. Cannot be changed later."}),P.name&&r.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.name})]}),!n&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{htmlFor:"pathPrefix",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",children:["Path Prefix ",r.jsx("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 mr-1",children:"/proxy/"}),r.jsx("input",{id:"pathPrefix",type:"text",value:m,onChange:e=>p(e.target.value),className:`input flex-1 font-mono ${P.pathPrefix?"border-red-500":""}`,placeholder:"app-name",disabled:A}),r.jsx("span",{className:"text-sm text-gray-500 dark:text-gray-400 ml-1",children:"/"})]}),r.jsx("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400",children:"URL path for accessing this app. Cannot be changed later."}),P.pathPrefix&&r.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.pathPrefix})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{htmlFor:"targetPort",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",children:["Port Number ",r.jsx("span",{className:"text-red-500",children:"*"})]}),r.jsx("input",{id:"targetPort",type:"number",value:h,onChange:e=>u(e.target.value?parseInt(e.target.value,10):""),className:`input w-full font-mono ${P.targetPort?"border-red-500":""}`,placeholder:"5173",min:j.MIN,max:j.MAX,disabled:A}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-gray-500",children:["Target port (",j.MIN,"-",j.MAX,")"]}),P.targetPort&&r.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.targetPort})]}),!n&&(0,r.jsxs)("div",{children:[(0,r.jsxs)("label",{htmlFor:"appType",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",children:["App Type ",r.jsx("span",{className:"text-red-500",children:"*"})]}),(0,r.jsxs)("select",{id:"appType",value:g,onChange:e=>y(e.target.value),className:`input w-full ${P.appType?"border-red-500":""}`,disabled:A,children:[r.jsx("option",{value:"",children:"Select app type..."}),v.map(e=>r.jsx("option",{value:e.value,children:e.label},e.value))]}),P.appType&&r.jsx("p",{className:"mt-1 text-xs text-red-500",children:P.appType})]}),(0,r.jsxs)("div",{children:[r.jsx("label",{htmlFor:"description",className:"block text-sm font-medium text-gray-700 dark:text-gray-200 mb-1",children:"Description"}),r.jsx("textarea",{id:"description",value:N,onChange:e=>w(e.target.value),className:"input w-full",placeholder:"Optional description...",rows:2,disabled:A})]}),(0,r.jsxs)("div",{className:"flex items-center",children:[r.jsx("input",{id:"websocketEnabled",type:"checkbox",checked:b,onChange:e=>f(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:A}),r.jsx("label",{htmlFor:"websocketEnabled",className:"ml-2 text-sm text-gray-700 dark:text-gray-200",children:"Enable WebSocket support"})]}),n&&(0,r.jsxs)("div",{className:"flex items-center",children:[r.jsx("input",{id:"enabled",type:"checkbox",checked:C,onChange:e=>S(e.target.checked),className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",disabled:A}),r.jsx("label",{htmlFor:"enabled",className:"ml-2 text-sm text-gray-700 dark:text-gray-200",children:"App is enabled"})]}),L&&r.jsx("div",{className:"p-3 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-800 rounded text-sm text-red-700 dark:text-red-300",children:L}),(0,r.jsxs)("div",{className:"flex justify-end gap-2 pt-4 border-t border-gray-200 dark:border-gray-700",children:[r.jsx(i.zx,{type:"button",variant:"ghost",onClick:t,disabled:A,children:"Cancel"}),r.jsx(i.zx,{type:"submit",variant:"primary",loading:A,children:n?"Save Changes":"Add App"})]})]})})}function w(){let[e,t]=(0,s.useState)([]),[a,l]=(0,s.useState)(!0),[n,d]=(0,s.useState)(null),[o,c]=(0,s.useState)(!1),[x,m]=(0,s.useState)(null),p=(0,s.useCallback)(async()=>{try{d(null);let e=await fetch("/api/external-apps");if(!e.ok)throw Error("Failed to fetch external apps");let a=await e.json();t(a.apps||[])}catch(e){d(e instanceof Error?e.message:"An error occurred")}finally{l(!1)}},[]),h=(0,s.useCallback)(e=>{m(e),c(!0)},[]),u=(0,s.useCallback)(()=>{m(null),c(!0)},[]),g=(0,s.useCallback)(async e=>{try{let t=await fetch(`/api/external-apps/${e}`,{method:"DELETE"});if(!t.ok){let e=await t.json();throw Error(e.error||"Failed to delete app")}p()}catch(e){console.error("Failed to delete app:",e)}},[p]),y=(0,s.useCallback)(()=>{p()},[p]),j=(0,s.useCallback)(()=>{c(!1),m(null)},[]);return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[r.jsx("h2",{className:"text-xl font-semibold text-gray-900 dark:text-gray-100",children:"External Apps"}),r.jsx(i.zx,{variant:"primary",size:"sm",onClick:u,children:"+ Add App"})]}),a?r.jsx(i.Zb,{padding:"lg",children:(0,r.jsxs)("div",{className:"flex items-center justify-center py-8",children:[r.jsx("div",{className:"animate-spin rounded-full h-8 w-8 border-b-2 border-cyan-600"}),r.jsx("span",{className:"ml-3 text-gray-600 dark:text-gray-300",children:"Loading apps..."})]})}):n?r.jsx(i.Zb,{padding:"lg",children:(0,r.jsxs)("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-red-600 dark:text-red-400 mb-4",children:"Failed to load external apps"}),r.jsx(i.zx,{variant:"secondary",size:"sm",onClick:p,children:"Retry"})]})}):0===e.length?r.jsx(i.Zb,{padding:"lg",children:(0,r.jsxs)("div",{className:"text-center py-8",children:[r.jsx("p",{className:"text-gray-500 dark:text-gray-400 mb-4",children:"No external apps registered yet."}),r.jsx("p",{className:"text-sm text-gray-400 dark:text-gray-500 mb-4",children:"Add an external app to proxy requests to other frontend applications."}),r.jsx(i.zx,{variant:"primary",size:"sm",onClick:u,children:"Add Your First App"})]})}):r.jsx("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4",children:e.map(e=>r.jsx(b,{app:e,onEdit:h,onDelete:g},e.id))}),r.jsx(N,{isOpen:o,onClose:j,editApp:x,onSave:y})]})}function C(){let[e,t]=(0,s.useState)(0),a=(0,s.useCallback)(()=>{t(e=>e+1)},[]);return r.jsx(l.Vw,{children:(0,r.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,r.jsxs)("div",{className:"mb-8",children:[r.jsx("h1",{className:"mb-2",children:"CommandMate"}),(0,r.jsxs)("p",{className:"text-base text-gray-600 dark:text-gray-400",children:["Stop managing terminal tabs. Start running issue-driven development.",r.jsx("br",{}),"CommandMate helps you refine issues, run them in parallel, switch agents when needed, and keep work moving wherever you are."]})]}),r.jsx("div",{className:"mb-8",children:r.jsx(g,{onRepositoryAdded:a})}),r.jsx(h,{},e),r.jsx("div",{className:"mt-8",children:r.jsx(w,{})})]})})}},35480:(e,t,a)=>{"use strict";a.r(t),a.d(t,{default:()=>r});let r=(0,a(68570).createProxy)(String.raw`/home/runner/work/CommandMate/CommandMate/src/app/page.tsx#default`)}};var t=require("../webpack-runtime.js");t.C(e);var a=e=>t(t.s=e),r=t.X(0,[8948,1628,6621,8705,8199,3860,185],()=>a(37906));module.exports=r})();
@@ -1 +1 @@
1
- {"version":1,"files":["../../../node_modules/next/dist/client/components/action-async-storage-instance.js","../../../node_modules/next/dist/client/components/action-async-storage.external.js","../../../node_modules/next/dist/client/components/async-local-storage.js","../../../node_modules/next/dist/client/components/request-async-storage-instance.js","../../../node_modules/next/dist/client/components/request-async-storage.external.js","../../../node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/package.json","../../../package.json","../../package.json","../chunks/2314.js","../chunks/2683.js","../chunks/3074.js","../chunks/3294.js","../chunks/3348.js","../chunks/369.js","../chunks/3860.js","../chunks/4559.js","../chunks/539.js","../chunks/5795.js","../chunks/5823.js","../chunks/5853.js","../chunks/6228.js","../chunks/6621.js","../chunks/6837.js","../chunks/7266.js","../chunks/7808.js","../chunks/8705.js","../chunks/8744.js","../chunks/8948.js","../chunks/9582.js","../webpack-runtime.js","page_client-reference-manifest.js"]}
1
+ {"version":1,"files":["../../../node_modules/next/dist/client/components/action-async-storage-instance.js","../../../node_modules/next/dist/client/components/action-async-storage.external.js","../../../node_modules/next/dist/client/components/async-local-storage.js","../../../node_modules/next/dist/client/components/request-async-storage-instance.js","../../../node_modules/next/dist/client/components/request-async-storage.external.js","../../../node_modules/next/dist/client/components/static-generation-async-storage-instance.js","../../../node_modules/next/dist/client/components/static-generation-async-storage.external.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/index.js","../../../node_modules/next/dist/compiled/@opentelemetry/api/package.json","../../../node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js","../../../node_modules/next/dist/server/lib/trace/constants.js","../../../node_modules/next/dist/server/lib/trace/tracer.js","../../../node_modules/next/package.json","../../../package.json","../../package.json","../chunks/1628.js","../chunks/185.js","../chunks/2314.js","../chunks/2683.js","../chunks/3074.js","../chunks/3348.js","../chunks/369.js","../chunks/3860.js","../chunks/4559.js","../chunks/5795.js","../chunks/5823.js","../chunks/5853.js","../chunks/6228.js","../chunks/6621.js","../chunks/6837.js","../chunks/7266.js","../chunks/8199.js","../chunks/8705.js","../chunks/8744.js","../chunks/8948.js","../chunks/9582.js","../webpack-runtime.js","page_client-reference-manifest.js"]}