commandmate 0.13.0 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/app-build-manifest.json +158 -158
- package/.next/app-path-routes-manifest.json +28 -28
- package/.next/build-manifest.json +2 -2
- package/.next/prerender-manifest.json +3 -3
- package/.next/required-server-files.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/update/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/app/update-check/route.js +1 -1
- package/.next/server/app/api/app/update-check/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/conversation/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/current-output/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/messages/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/start/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/assistant/tools/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/login/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/logout/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/auth/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/daily-summary/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/health/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/external-apps/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/hooks/claude-done/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/ollama/models/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/subscriptions/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/push/vapid/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/[id]/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/clone/[jobId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/clone/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/excluded/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/restore/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/scan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/repositories/sync/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/sidebar/group-order/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/templates/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/auto-yes/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/capture/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cli-tool/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/cmate/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/current-output/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/[logId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/execution-logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/files/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/create/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branch/delete/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/branches/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/checkout/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/commit/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/fetch/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/log/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/pull/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/reset/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/revert/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/show/[commitHash]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/staged/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/[index]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/apply/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/pop/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/push/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/stash/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/status/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/unstage/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/git/working-diff/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/interrupt/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/kill-session/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/[filename]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/logs/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/marp-render/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/[memoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/memos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/messages/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/prompt-response/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/respond/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/[scheduleId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/active/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/schedules/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/search/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/send/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/install/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/[skillId]/uninstall-plan/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/skills/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/slash-commands/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/special-keys/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/start-polling/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/terminal/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/history/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/timers/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/[todoId]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/todos/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/tree/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/upload/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/[id]/viewed/route_client-reference-manifest.js +1 -1
- package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
- package/.next/server/app/chat/page_client-reference-manifest.js +1 -1
- package/.next/server/app/login/page_client-reference-manifest.js +1 -1
- package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
- package/.next/server/app/more/page_client-reference-manifest.js +1 -1
- package/.next/server/app/offline/page_client-reference-manifest.js +1 -1
- package/.next/server/app/page.js +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/proxy/[...path]/route_client-reference-manifest.js +1 -1
- package/.next/server/app/repositories/page_client-reference-manifest.js +1 -1
- package/.next/server/app/review/page_client-reference-manifest.js +1 -1
- package/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/[skillId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/skills/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/files/[...path]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/page.js +2 -2
- package/.next/server/app/worktrees/[id]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/worktrees/[id]/terminal/page_client-reference-manifest.js +1 -1
- package/.next/server/app-paths-manifest.json +28 -28
- package/.next/server/chunks/2119.js +1 -1
- package/.next/server/chunks/2404.js +1 -1
- package/.next/server/chunks/2445.js +1 -1
- package/.next/server/chunks/5959.js +1 -1
- package/.next/server/chunks/6130.js +1 -1
- package/.next/server/middleware-manifest.json +5 -5
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.json +1 -1
- package/.next/static/chunks/{6488-87bc158682ce8c24.js → 6488-1a37ccee1d444c10.js} +1 -1
- package/.next/static/chunks/app/page-a34d26812f085b6c.js +1 -0
- package/.next/static/chunks/app/worktrees/[id]/page-f2801662a721faab.js +1 -0
- package/.next/trace +11 -11
- package/package.json +3 -2
- package/.next/static/chunks/app/page-af457ca5876ed616.js +0 -1
- package/.next/static/chunks/app/worktrees/[id]/page-d9a6cb166c73746e.js +0 -1
- /package/.next/static/{qeQn6_9VTrYHitt3mqIG8 → Etea8LidpB8eWOTac-R8b}/_buildManifest.js +0 -0
- /package/.next/static/{qeQn6_9VTrYHitt3mqIG8 → Etea8LidpB8eWOTac-R8b}/_ssgManifest.js +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";exports.id=6130,exports.ids=[6130],exports.modules={26838:(a,b,c)=>{c.d(b,{Mj:()=>k,Sw:()=>j,lX:()=>l});var d=c(29021),e=c(33873),f=c(90164);let g=/^v?\d+\.\d+\.\d+$/,h=/^[a-zA-Z0-9.\-\s_v]+$/,i=globalThis.__versionCheckCache??(globalThis.__versionCheckCache={result:null,fetchedAt:0,rateLimitResetAt:null});function j(){return function(){try{let a=(0,d.readFileSync)((0,e.join)(process.cwd(),"package.json"),"utf-8"),b=JSON.parse(a);if("commandmate"===b.name&&"string"==typeof b.version&&b.version.length>0)return b.version;return null}catch{return null}}()??"0.
|
|
1
|
+
"use strict";exports.id=6130,exports.ids=[6130],exports.modules={26838:(a,b,c)=>{c.d(b,{Mj:()=>k,Sw:()=>j,lX:()=>l});var d=c(29021),e=c(33873),f=c(90164);let g=/^v?\d+\.\d+\.\d+$/,h=/^[a-zA-Z0-9.\-\s_v]+$/,i=globalThis.__versionCheckCache??(globalThis.__versionCheckCache={result:null,fetchedAt:0,rateLimitResetAt:null});function j(){return function(){try{let a=(0,d.readFileSync)((0,e.join)(process.cwd(),"package.json"),"utf-8"),b=JSON.parse(a);if("commandmate"===b.name&&"string"==typeof b.version&&b.version.length>0)return b.version;return null}catch{return null}}()??"0.14.0"}function k(){return j()}async function l(){try{var a,b,c;if(null!==i.result&&Date.now()-i.fetchedAt<36e5||i.rateLimitResetAt&&(!(Date.now()>=i.rateLimitResetAt)||(i.rateLimitResetAt=null,0)))return i.result;let d=await fetch("https://api.github.com/repos/Kewton/CommandMate/releases/latest",{headers:{Accept:"application/vnd.github+json","User-Agent":`CommandMate/${k()}`},cache:"no-store",signal:AbortSignal.timeout(5e3)});if(403===d.status)return function(a){let b=a.headers.get("X-RateLimit-Reset");b?i.rateLimitResetAt=1e3*parseInt(b,10):i.rateLimitResetAt=Date.now()+36e5}(d),i.result;if(!d.ok)return i.result;let e=await d.json(),j=k(),l=e.tag_name.replace(/^v/,""),m={hasUpdate:function(a,b){if(!g.test(a)||!g.test(b))return!1;let c=a=>a.replace(/^v/,"").split(".").map(Number),[d,e,f]=c(a),[h,i,j]=c(b);return h!==d?h>d:i!==e?i>e:j>f}(j,e.tag_name),currentVersion:j,latestVersion:l,releaseUrl:(a=e.html_url).startsWith(f.Dk)?a:null,releaseName:(b=e.name,c=e.tag_name,h.test(b)&&b.length<=128?b:c),publishedAt:e.published_at};return i.result=m,i.fetchedAt=Date.now(),m}catch{return i.result}}},88573:(a,b,c)=>{c.d(b,{Lw:()=>s});let d="https://raw.githubusercontent.com/Kewton/commandmate-skills/main/catalog/v1/catalog.json",e=[d],f=/^[A-Za-z0-9/+=_."-]{1,128}$/;var g=c(72626),h=c(13075);let i=(0,g.h)("lib/skills/catalog-client"),j={FETCH_FAILED:"SKILL_CATALOG_FETCH_FAILED",RATE_LIMITED:"SKILL_CATALOG_RATE_LIMITED",OVERSIZED:"SKILL_CATALOG_OVERSIZED",MALFORMED:"SKILL_CATALOG_MALFORMED",INVALID_SCHEMA:"SKILL_CATALOG_INVALID_SCHEMA"},k=globalThis.__skillCatalogCache??={catalog:null,validatedAt:0,confirmedAt:0,etag:null,revision:null,rateLimitResetAt:null,inflight:null};class l extends Error{}let m={[j.FETCH_FAILED]:"The Skill Catalog could not be retrieved.",[j.RATE_LIMITED]:"The Skill Catalog origin is rate limiting requests.",[j.OVERSIZED]:"The Skill Catalog response exceeded the allowed size.",[j.MALFORMED]:"The Skill Catalog response was not valid JSON.",[j.INVALID_SCHEMA]:"The Skill Catalog response did not match the supported Catalog schema."};function n(a){return new Date(a).toISOString()}function o(a,b,c){return{catalog:a,fetchedAt:n(k.validatedAt),revalidatedAt:n(k.confirmedAt),state:b,stale:"stale"===b,offline:"stale"===b,staleReason:c,source:{repository:"Kewton/commandmate-skills",ref:"main",revision:k.revision}}}function p(a,b=[]){return k.catalog?{ok:!0,snapshot:o(k.catalog,"stale",a)}:{ok:!1,failure:{code:a,message:m[a],errors:b}}}async function q(a,b){let c=a.headers.get("Content-Length");if(null!==c){let a=Number(c);if(!Number.isFinite(a)||a<0||a>b)throw new l("content-length out of bounds")}let d=a.body;if(!d||"function"!=typeof d.getReader){let c=await a.text();if(new TextEncoder().encode(c).length>b)throw new l("body exceeded size cap");return c}let e=d.getReader(),f=[],g=0;for(;;){let{done:a,value:c}=await e.read();if(a)break;if(c){if((g+=c.byteLength)>b)throw await e.cancel(),new l("body exceeded size cap");f.push(c)}}let h=new Uint8Array(g),i=0;for(let a of f)h.set(a,i),i+=a.byteLength;return new TextDecoder("utf-8").decode(h)}async function r(a){let b,c,g;if(!e.includes(d))return p(j.FETCH_FAILED);let m={Accept:"application/json","User-Agent":`CommandMate/${a}`};null!==k.catalog&&null!==k.etag&&(m["If-None-Match"]=k.etag);try{b=await fetch(d,{headers:m,cache:"no-store",signal:AbortSignal.timeout(5e3)})}catch{return i.warn("catalog-fetch-failed",{reason:j.FETCH_FAILED}),p(j.FETCH_FAILED)}if(304===b.status&&null!==k.catalog)return k.confirmedAt=Date.now(),{ok:!0,snapshot:o(k.catalog,"revalidated",null)};if(403===b.status||429===b.status)return!function(a){let b=Date.now(),c=b+864e5,d=a.headers.get("X-RateLimit-Reset");if(null!==d){let a=Number(d);if(Number.isFinite(a)&&a>0){k.rateLimitResetAt=Math.min(1e3*a,c);return}}let e=a.headers.get("Retry-After");if(null!==e){let a=Number(e);if(Number.isFinite(a)&&a>0){k.rateLimitResetAt=Math.min(b+1e3*a,c);return}}k.rateLimitResetAt=b+36e5}(b),i.warn("catalog-rate-limited",{status:b.status}),p(j.RATE_LIMITED);if(!b.ok)return i.warn("catalog-fetch-failed",{status:b.status}),p(j.FETCH_FAILED);try{c=await q(b,1048576)}catch(b){let a=b instanceof l?j.OVERSIZED:j.FETCH_FAILED;return i.warn("catalog-body-rejected",{reason:a}),p(a)}try{g=JSON.parse(c)}catch{return i.warn("catalog-malformed",{reason:j.MALFORMED}),p(j.MALFORMED)}let n=(0,h.JJ)(g);if(!n.ok)return i.warn("catalog-invalid-schema",{errorCount:n.errors.length}),p(j.INVALID_SCHEMA,n.errors);let r=Date.now();return k.catalog=n.value,k.validatedAt=r,k.confirmedAt=r,k.etag=b.headers.get("ETag"),k.revision=function(a){if(null===a)return null;let b=a.trim();return f.test(b)?b:null}(k.etag),{ok:!0,snapshot:o(n.value,"fresh",null)}}async function s(a={}){let{hostVersion:b="0.0.0",forceRevalidate:c=!1}=a;return!c&&null!==k.catalog&&Date.now()-k.confirmedAt<9e5&&null!==k.catalog?{ok:!0,snapshot:o(k.catalog,"cached",null)}:null!==k.rateLimitResetAt&&(!(Date.now()>=k.rateLimitResetAt)||(k.rateLimitResetAt=null,0))?p(j.RATE_LIMITED):(null===k.inflight&&(k.inflight=r(b).finally(()=>{k.inflight=null})),k.inflight)}},90164:(a,b,c)=>{c.d(b,{Dk:()=>e,kD:()=>f});let d="https://github.com/Kewton/CommandMate",e=`${d}/releases/`,f=`${d}/blob/main/docs/security-guide.md`}};
|
|
@@ -17,11 +17,11 @@
|
|
|
17
17
|
"wasm": [],
|
|
18
18
|
"assets": [],
|
|
19
19
|
"env": {
|
|
20
|
-
"__NEXT_BUILD_ID": "
|
|
21
|
-
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "+
|
|
22
|
-
"__NEXT_PREVIEW_MODE_ID": "
|
|
23
|
-
"__NEXT_PREVIEW_MODE_SIGNING_KEY": "
|
|
24
|
-
"__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "
|
|
20
|
+
"__NEXT_BUILD_ID": "Etea8LidpB8eWOTac-R8b",
|
|
21
|
+
"NEXT_SERVER_ACTIONS_ENCRYPTION_KEY": "v+gvyeW7fkAD+4YJm89unalgDc0mop2Pd4ByQgnfUyk=",
|
|
22
|
+
"__NEXT_PREVIEW_MODE_ID": "d505c90bbe94e6dc8314f2b7aabb78dd",
|
|
23
|
+
"__NEXT_PREVIEW_MODE_SIGNING_KEY": "2c4883c0794bcfcd2003ffd5c1ce9c80e6001fe57703f0f0188d523f50bc2b1d",
|
|
24
|
+
"__NEXT_PREVIEW_MODE_ENCRYPTION_KEY": "bdda7895d35f9dc2746c1b2403a473bfb6795d43089b51e9a43edb7c53f51ee4"
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-0f9275e279c058eb.js" defer=""></script><script src="/_next/static/chunks/framework-eaf13c96191cb608.js" defer=""></script><script src="/_next/static/chunks/main-6092074a0dc78280.js" defer=""></script><script src="/_next/static/chunks/pages/_app-4b3fb5e477a0267f.js" defer=""></script><script src="/_next/static/chunks/pages/_error-c970d8b55ace1b48.js" defer=""></script><script src="/_next/static/
|
|
1
|
+
<!DOCTYPE html><html><head><meta charSet="utf-8" data-next-head=""/><meta name="viewport" content="width=device-width" data-next-head=""/><title data-next-head="">500: Internal Server Error</title><noscript data-n-css=""></noscript><script defer="" noModule="" src="/_next/static/chunks/polyfills-42372ed130431b0a.js"></script><script src="/_next/static/chunks/webpack-0f9275e279c058eb.js" defer=""></script><script src="/_next/static/chunks/framework-eaf13c96191cb608.js" defer=""></script><script src="/_next/static/chunks/main-6092074a0dc78280.js" defer=""></script><script src="/_next/static/chunks/pages/_app-4b3fb5e477a0267f.js" defer=""></script><script src="/_next/static/chunks/pages/_error-c970d8b55ace1b48.js" defer=""></script><script src="/_next/static/Etea8LidpB8eWOTac-R8b/_buildManifest.js" defer=""></script><script src="/_next/static/Etea8LidpB8eWOTac-R8b/_ssgManifest.js" defer=""></script></head><body><div id="__next"><div style="font-family:system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";height:100vh;text-align:center;display:flex;flex-direction:column;align-items:center;justify-content:center"><div style="line-height:48px"><style>body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}</style><h1 class="next-error-h1" style="display:inline-block;margin:0 20px 0 0;padding-right:23px;font-size:24px;font-weight:500;vertical-align:top">500</h1><div style="display:inline-block"><h2 style="font-size:14px;font-weight:400;line-height:28px">Internal Server Error<!-- -->.</h2></div></div></div></div><script id="__NEXT_DATA__" type="application/json">{"props":{"pageProps":{"statusCode":500}},"page":"/_error","query":{},"buildId":"Etea8LidpB8eWOTac-R8b","nextExport":true,"isFallback":false,"gip":true,"scriptLoader":[]}</script></body></html>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"node":{},"edge":{},"encryptionKey":"+
|
|
1
|
+
{"node":{},"edge":{},"encryptionKey":"v+gvyeW7fkAD+4YJm89unalgDc0mop2Pd4ByQgnfUyk="}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6488],{2317:(e,t,r)=>{r.d(t,{V:()=>a});var n=r(12115);function o(){try{let e="__localStorage_test__";return window.localStorage.setItem(e,"test"),window.localStorage.removeItem(e),!0}catch(e){return!1}}function a(e){let{key:t,defaultValue:r,validate:a,serialize:s=JSON.stringify,deserialize:i=JSON.parse}=e,c=(0,n.useRef)(r),l=(0,n.useRef)(a),u=(0,n.useRef)(s),d=(0,n.useRef)(i);c.current=r,l.current=a,u.current=s,d.current=i;let[f,p]=(0,n.useState)(!1),[y,m]=(0,n.useState)(r),w=(0,n.useCallback)(()=>{if(!o())return c.current;try{let e=window.localStorage.getItem(t);if(null===e)return c.current;let r=d.current(e);if(l.current)return l.current(r)?r:c.current;return r}catch(e){return c.current}},[t]),g=(0,n.useCallback)(e=>{if(o())try{let r=u.current(e);window.localStorage.setItem(t,r)}catch(e){}},[t]),h=(0,n.useCallback)(e=>{m(t=>{let r="function"==typeof e?e(t):e;return g(r),r})},[g]),S=(0,n.useCallback)(()=>{if(o())try{window.localStorage.removeItem(t)}catch(e){}m(c.current)},[t]);return(0,n.useEffect)(()=>{p(o()),m(w())},[w]),{value:y,setValue:h,removeValue:S,isAvailable:f}}},7636:(e,t,r)=>{r.d(t,{LV:()=>c,Si:()=>o,UZ:()=>s,Xn:()=>u,_s:()=>d,nO:()=>l,s6:()=>i});let n=["updatedAt","repositoryName","branchName","status","lastSent"],o=e=>n.includes(e),a={waiting:0,ready:1,running:2,generating:3,idle:4};function s(e){let t=new Set;for(let r of e)!1===r.visible&&t.add(r.path);return t}function i(e,t){return 0===t.size?e.slice():e.filter(e=>{let r=e.repositoryPath;return!r||!t.has(r)})}function c(e){let t=function(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)|0;return Math.abs(t)}(e)%360;return"hsl(".concat(t,", ").concat(65,"%, ").concat(60,"%)")}function l(e,t){if(!e&&!t)return 0;if(!e)return 1;if(!t)return -1;let r=e instanceof Date?e.getTime():new Date(e).getTime();return(t instanceof Date?t.getTime():new Date(t).getTime())-r}function u(e,t,r){let n=[...e];return n.sort((e,n)=>{let o=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,r=t(e.lastActivity);o=t(n.lastActivity)-r;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),r=n.repositoryName.toLowerCase();o=t.localeCompare(r);break}case"branchName":{let t=e.name.toLowerCase(),r=n.name.toLowerCase();o=t.localeCompare(r);break}case"status":o=a[e.status]-a[n.status];break;case"lastSent":{let t=l(e.lastActivity,n.lastActivity);if(!e.lastActivity&&!n.lastActivity){o=0;break}if(!e.lastActivity)return 1;if(!n.lastActivity)return -1;o=t;break}default:o=0}return("updatedAt"===t||"lastSent"===t?"desc"===r:"asc"===r)?o:-o}),n}function d(e,t,r){let n=new Map;for(let t of e){let e=t.repositoryName;n.has(e)||n.set(e,[]),n.get(e).push(t)}return[...n.keys()].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).map(e=>({repositoryName:e,branches:u(n.get(e),t,r)}))}},22592:(e,t,r)=>{r.d(t,{Ps:()=>d,W5:()=>u});var n=r(95155),o=r(12115),a=r(38218),s=r(68704);let i="data-pc-size",c={size:s.r5,setSize:()=>{},isMobile:!1,factor:s.d8[s.r5].factor,isAvailable:!1},l=(0,o.createContext)(c);function u(e){let{children:t}=e,{size:r,setSize:c,isAvailable:u}=(0,s.of)(),d=(0,a.a)();(0,o.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.documentElement;return d?void e.removeAttribute(i):(e.setAttribute(i,r),()=>{e.removeAttribute(i)})},[r,d]);let f=(0,o.useMemo)(()=>({size:r,setSize:c,isMobile:d,factor:s.d8[r].factor,isAvailable:u}),[r,c,d,u]);return(0,n.jsx)(l.Provider,{value:f,children:t})}function d(){return(0,o.useContext)(l)}},32916:(e,t,r)=>{r.d(t,{GB:()=>u,VF:()=>d});var n=r(95155),o=r(12115),a=r(7636);let s="updatedAt",i=(0,o.createContext)(null);function c(e,t,r,n){let a=(0,o.useRef)(!0);(0,o.useEffect)(()=>{try{let t=localStorage.getItem(e);t&&n(t)}catch(e){}},[]),(0,o.useEffect)(()=>{if(a.current){a.current=!1;return}try{localStorage.setItem(e,r())}catch(e){}},[t])}function l(e,t){switch(t.type){case"TOGGLE":return{...e,isOpen:!e.isOpen};case"SET_WIDTH":return{...e,width:t.width};case"OPEN_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!0};case"CLOSE_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!1};case"SET_SORT_KEY":return{...e,sortKey:t.sortKey};case"SET_SORT_DIRECTION":return{...e,sortDirection:t.sortDirection};case"LOAD_SORT_SETTINGS":return{...e,sortKey:t.sortKey,sortDirection:t.sortDirection};case"SET_VIEW_MODE":return{...e,viewMode:t.viewMode};default:return e}}function u(e){let{children:t,initialOpen:r=!0,initialWidth:u=224}=e,[d,f]=(0,o.useReducer)(l,{isOpen:r,width:u,isMobileDrawerOpen:!1,sortKey:s,sortDirection:"desc",viewMode:"grouped"});c("mcbd-sidebar-sort","".concat(d.sortKey,":").concat(d.sortDirection),()=>JSON.stringify({sortKey:d.sortKey,sortDirection:d.sortDirection}),e=>{try{let t=JSON.parse(e),r=t.sortDirection,n=(0,a.Si)(t.sortKey)?t.sortKey:s;n&&("asc"===r||"desc"===r)&&f({type:"LOAD_SORT_SETTINGS",sortKey:n,sortDirection:r})}catch(e){}}),c("mcbd-sidebar-view-mode",d.viewMode,()=>d.viewMode,e=>{("grouped"===e||"flat"===e)&&f({type:"SET_VIEW_MODE",viewMode:e})}),c("mcbd-sidebar-width",d.width,()=>String(d.width),e=>{let t=Number(e);!isNaN(t)&&t>0&&f({type:"SET_WIDTH",width:288===t?224:t})});let p=(0,o.useCallback)(()=>{f({type:"TOGGLE"})},[]),y=(0,o.useCallback)(e=>{f({type:"SET_WIDTH",width:e})},[]),m=(0,o.useCallback)(()=>{f({type:"OPEN_MOBILE_DRAWER"})},[]),w=(0,o.useCallback)(()=>{f({type:"CLOSE_MOBILE_DRAWER"})},[]),g=(0,o.useCallback)(e=>{f({type:"SET_SORT_KEY",sortKey:e})},[]),h=(0,o.useCallback)(e=>{f({type:"SET_SORT_DIRECTION",sortDirection:e})},[]),S=(0,o.useCallback)(e=>{f({type:"SET_VIEW_MODE",viewMode:e})},[]),b=(0,o.useMemo)(()=>({isOpen:d.isOpen,width:d.width,isMobileDrawerOpen:d.isMobileDrawerOpen,sortKey:d.sortKey,sortDirection:d.sortDirection,toggle:p,setWidth:y,openMobileDrawer:m,closeMobileDrawer:w,setSortKey:g,setSortDirection:h,viewMode:d.viewMode,setViewMode:S}),[d.isOpen,d.width,d.isMobileDrawerOpen,d.sortKey,d.sortDirection,d.viewMode,p,y,m,w,g,h,S]);return(0,n.jsx)(i.Provider,{value:b,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useSidebarContext must be used within a SidebarProvider");return e}},38218:(e,t,r)=>{r.d(t,{D:()=>a,a:()=>s});var n=r(12115);let o=n.useLayoutEffect,a=768;function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=a}=e,[r,s]=(0,n.useState)(!1);return o(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));s(e.matches);let r=e=>{s(e.matches)};return e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}},[t]),r}},39649:(e,t,r)=>{r.d(t,{$f:()=>d,H8:()=>u});var n=r(95155),o=r(12115),a=r(80344);let s={PROCESSING:2e3,SESSION_RUNNING:5e3,IDLE:1e4},i=(0,o.createContext)(null),c={selectedWorktreeId:null,worktrees:[],repositories:[],selectedWorktreeDetail:null,isLoading:!0,isLoadingDetail:!1,error:null};function l(e,t){switch(t.type){case"SET_WORKTREES":return{...e,worktrees:t.worktrees,isLoading:!1};case"SET_REPOSITORIES":return{...e,repositories:t.repositories};case"SELECT_WORKTREE":{var r;let n=null!=(r=e.worktrees.find(e=>e.id===t.id))?r:null;return{...e,selectedWorktreeId:t.id,selectedWorktreeDetail:null!=n?n:e.selectedWorktreeDetail,isLoadingDetail:null===n}}case"SET_WORKTREE_DETAIL":return{...e,selectedWorktreeDetail:t.detail};case"SET_LOADING":return{...e,isLoading:t.isLoading};case"SET_LOADING_DETAIL":return{...e,isLoadingDetail:t.isLoadingDetail};case"SET_ERROR":return{...e,error:t.error,isLoading:!1};default:return e}}function u(e){let{children:t,externalWorktrees:r,externalRepositories:u}=e,d=void 0!==r,[f,p]=(0,o.useReducer)(l,c);(0,o.useEffect)(()=>{d&&r&&p({type:"SET_WORKTREES",worktrees:r})},[d,r]),(0,o.useEffect)(()=>{d&&u&&p({type:"SET_REPOSITORIES",repositories:u})},[d,u]);let y=(0,o.useCallback)(async()=>{if(!d){p({type:"SET_LOADING",isLoading:!0}),p({type:"SET_ERROR",error:null});try{var e;let t=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:t.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(e=t.repositories)?e:[]})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktrees"})}}},[d]),m=(0,o.useCallback)(async e=>{p({type:"SELECT_WORKTREE",id:e}),p({type:"SET_ERROR",error:null});try{a.y.markAsViewed(e).catch(e=>{console.warn("[WorktreeSelectionContext] Failed to mark as viewed:",e)});let t=await a.y.getById(e);p({type:"SET_WORKTREE_DETAIL",detail:t})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktree detail"})}finally{p({type:"SET_LOADING_DETAIL",isLoadingDetail:!1})}},[]),w=(0,o.useCallback)(async()=>{await y()},[y]);(0,o.useEffect)(()=>{d||y()},[y,d]),(0,o.useEffect)(()=>{if(d)return;let e=null,t=!0,r=async()=>{if(t)try{var n,o;let i=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:i.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(n=i.repositories)?n:[]});let c=(o=i.worktrees).some(e=>e.isProcessing||e.isWaitingForResponse)?s.PROCESSING:o.some(e=>e.isSessionRunning)?s.SESSION_RUNNING:s.IDLE;t&&(e=setTimeout(r,c))}catch(n){if(n instanceof a.hD&&401===n.status)return;console.error("[WorktreeSelectionContext] Polling error:",n),t&&(e=setTimeout(r,s.SESSION_RUNNING))}};return r(),()=>{t=!1,e&&clearTimeout(e)}},[d]);let g={selectedWorktreeId:f.selectedWorktreeId,worktrees:f.worktrees,repositories:f.repositories,selectedWorktreeDetail:f.selectedWorktreeDetail,isLoadingDetail:f.isLoadingDetail,error:f.error,selectWorktree:m,refreshWorktrees:w};return(0,n.jsx)(i.Provider,{value:g,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useWorktreeSelection must be used within a WorktreeSelectionProvider");return e}},52703:(e,t,r)=>{r.d(t,{Oo:()=>o,ST:()=>n,zS:()=>a});let n="client_version",o="version_mismatch";function a(e){let t;try{t=JSON.parse(e)}catch(e){return null}if(!t||"object"!=typeof t)return null;let r=t;if("broadcast"===r.type){let e=r.data;return e&&"object"==typeof e?"string"!=typeof e.type?null:(void 0===e.worktreeId&&"string"==typeof r.worktreeId&&(e.worktreeId=r.worktreeId),e):null}return"string"==typeof r.type?r:null}},63365:(e,t,r)=>{r.d(t,{tS:()=>u,xM:()=>d,T3:()=>f});var n=r(95155),o=r(12115),a=r(52703);function s(){return"undefined"!=typeof globalThis&&"function"==typeof globalThis.WebSocket?globalThis.WebSocket:null}let i=()=>{},c={status:"disconnected",connected:!1,subscribe:i,unsubscribe:i,addListener:()=>i},l=(0,o.createContext)(null);function u(e){let{children:t,enabled:r=!0}=e,i=(0,o.useRef)(new Set),c=(0,o.useRef)(new Map),{status:u,subscribe:d,unsubscribe:f}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onEvent:t,onStatusChange:r,autoReconnect:n=!0,reconnectBaseDelay:i=1e3,reconnectMaxDelay:c=3e4,enabled:l=!0}=e,[u,d]=(0,o.useState)("disconnected"),f=(0,o.useRef)(null),p=(0,o.useRef)(null),y=(0,o.useRef)(0),m=(0,o.useRef)(new Set),w=(0,o.useRef)(!1),g=(0,o.useRef)(t);g.current=t;let h=(0,o.useRef)(r);h.current=r;let S=(0,o.useCallback)(e=>{var t;d(e),null==(t=h.current)||t.call(h,e)},[]),b=(0,o.useCallback)(()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},[]),E=(0,o.useCallback)(()=>{if(!l)return;let e=s();if(!e||f.current&&(f.current.readyState===e.OPEN||f.current.readyState===e.CONNECTING))return;b(),w.current=!1,S("connecting");let t="https:"===window.location.protocol?"wss:":"ws:",r=new e("".concat(t,"//").concat(window.location.host));f.current=r,r.onopen=()=>{y.current=0,S("connected");try{r.send(JSON.stringify({type:a.ST,version:"0.13.0"}))}catch(e){}m.current.forEach(e=>{try{r.send(JSON.stringify({type:"subscribe",worktreeId:e}))}catch(e){}})},r.onmessage=e=>{var t;let r="string"==typeof e.data?e.data:String(e.data),n=(0,a.zS)(r);n&&(null==(t=g.current)||t.call(g,n))},r.onerror=()=>{S("error")},r.onclose=()=>{var e;if(f.current=null,S("disconnected"),w.current||!n||"undefined"!=typeof document&&"hidden"===document.visibilityState)return;let t=(e=y.current,Math.min(i*2**Math.max(0,e),c));y.current+=1,p.current=setTimeout(()=>{p.current=null,E()},t)}},[l,n,i,c,S,b]),T=(0,o.useCallback)(()=>{if(b(),w.current=!0,f.current){try{f.current.close(1e3,"Client disconnect")}catch(e){}f.current=null}},[b]),k=(0,o.useCallback)(e=>{let t=f.current,r=s();if(t&&r&&t.readyState===r.OPEN)try{t.send(JSON.stringify(e))}catch(e){}},[]),C=(0,o.useCallback)(e=>{m.current.has(e)||(m.current.add(e),k({type:"subscribe",worktreeId:e}))},[k]),v=(0,o.useCallback)(e=>{m.current.has(e)&&(m.current.delete(e),k({type:"unsubscribe",worktreeId:e}))},[k]);return(0,o.useEffect)(()=>{if(l)return E(),()=>{T()}},[l,E,T]),(0,o.useEffect)(()=>{if(!l||"undefined"==typeof document)return;let e=()=>{"visible"===document.visibilityState&&(f.current||(y.current=0,E()))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[l,E]),{status:u,subscribe:C,unsubscribe:v,send:k}}({enabled:r,onEvent:(0,o.useCallback)(e=>{i.current.forEach(t=>{try{t(e)}catch(e){}})},[])}),p=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;r.set(e,n+1),0===n&&d(e)},[d]),y=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;n<=1?(r.delete(e),f(e)):r.set(e,n-1)},[f]),m=(0,o.useCallback)(e=>(i.current.add(e),()=>{i.current.delete(e)}),[]),w=(0,o.useMemo)(()=>({status:u,connected:"connected"===u,subscribe:p,unsubscribe:y,addListener:m}),[u,p,y,m]);return(0,n.jsx)(l.Provider,{value:w,children:t})}function d(){var e;return null!=(e=(0,o.useContext)(l))?e:c}function f(e){let{addListener:t}=d(),r=(0,o.useRef)(e);r.current=e,(0,o.useEffect)(()=>t(e=>r.current(e)),[t])}},65380:(e,t,r)=>{r.d(t,{H:()=>i,O:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)(!1);function s(e){let{children:t,authEnabled:r}=e;return(0,n.jsx)(a.Provider,{value:r,children:t})}function i(){return(0,o.useContext)(a)}},66966:(e,t,r)=>{r.d(t,{g7:()=>c,rC:()=>u,Fn:()=>l});var n=r(95155),o=r(12115),a=r(63365),s=r(39649);let i=(0,o.createContext)(null);function c(e){let{children:t}=e,{worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}=function(){let[e,t]=(0,o.useState)([]),[r,n]=(0,o.useState)([]),[s,i]=(0,o.useState)(!0),[c,l]=(0,o.useState)(null),u=(0,o.useRef)(null),d=(0,o.useRef)([]),f=(0,o.useRef)(null),{connected:p,subscribe:y,unsubscribe:m,addListener:w}=(0,a.xM)(),g=(0,o.useRef)(p);g.current=p;let h=(0,o.useCallback)(async()=>{try{var e,r;l(null);let a=await fetch("/api/worktrees");if(!a.ok)throw Error("Failed to fetch worktrees: ".concat(a.status));let s=await a.json(),i=null!=(e=s.worktrees)?e:[],c=null!=(r=s.repositories)?r:[];(0,o.startTransition)(()=>{t(i),n(c)}),d.current=i}catch(e){l(e instanceof Error?e:Error(String(e)))}finally{i(!1)}},[]);(0,o.useEffect)(()=>{h()},[h]);let S=(0,o.useCallback)(()=>d.current.some(e=>!0===e.isSessionRunning),[]),b=(0,o.useCallback)(()=>{let e=S();return g.current?e?2e4:6e4:e?5e3:3e4},[S]),E=(0,o.useCallback)(()=>{null!==u.current&&(clearInterval(u.current),u.current=null),f.current=null},[]),T=(0,o.useCallback)(()=>{E();let e=b();f.current=e,u.current=setInterval(()=>{h()},e)},[b,h,E]);(0,o.useEffect)(()=>{let e=()=>{document.hidden?E():(h(),T())},t=setTimeout(()=>{T()},0);return document.addEventListener("visibilitychange",e),()=>{clearTimeout(t),E(),document.removeEventListener("visibilitychange",e)}},[h,T,E]),(0,o.useEffect)(()=>{if(d.current=e,"undefined"!=typeof document&&document.hidden||null===f.current)return;let t=b();f.current!==t&&T()},[e,p,b,T]);let k=e.map(e=>e.id).sort().join(" ");return(0,o.useEffect)(()=>{let e=k.length>0?k.split(" "):[];return e.forEach(e=>y(e)),()=>{e.forEach(e=>m(e))}},[k,y,m]),(0,o.useEffect)(()=>w(e=>{if("session_status_changed"===e.type&&"string"==typeof e.worktreeId){let r=e.worktreeId,n=e.isRunning;if("boolean"==typeof n){if((null!=e.cliTool||null!=e.instance)&&!1===n)return void h();(0,o.startTransition)(()=>{t(e=>{let t=!1,o=e.map(e=>e.id===r&&e.isSessionRunning!==n?(t=!0,{...e,isSessionRunning:n}):e);return t?o:e})})}}else("message"===e.type||"message_updated"===e.type)&&h()}),[w,h]),{worktrees:e,repositories:r,isLoading:s,error:c,refresh:h}}(),f=(0,o.useMemo)(()=>({worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}),[r,c,l,u,d]);return(0,n.jsx)(i.Provider,{value:f,children:(0,n.jsx)(s.H8,{externalWorktrees:r,externalRepositories:c,children:t})})}function l(){let e=(0,o.useContext)(i);if(null===e)throw Error("useWorktreesCacheContext must be used within a WorktreesCacheProvider");return e}function u(){return(0,o.useContext)(i)}},68704:(e,t,r)=>{r.d(t,{Uf:()=>a,d8:()=>s,fM:()=>i,of:()=>l,r5:()=>o,rq:()=>c});var n=r(2317);let o="medium",a=["large","medium","small","xsmall"],s={large:{value:"large",rootFontSizePx:18,factor:1.125,terminalFontSize:16},medium:{value:"medium",rootFontSizePx:16,factor:1,terminalFontSize:14},small:{value:"small",rootFontSizePx:14,factor:.875,terminalFontSize:12},xsmall:{value:"xsmall",rootFontSizePx:12.5,factor:.78,terminalFontSize:11}};function i(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(s,e)}function c(e){return s[e].terminalFontSize}function l(){let{value:e,setValue:t,isAvailable:r}=(0,n.V)({key:"mcbd-pc-display-size",defaultValue:o,validate:i});return{size:e,setSize:t,isAvailable:r}}},70628:(e,t,r)=>{r.d(t,{K:()=>i,S:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},80344:(e,t,r)=>{r.d(t,{$T:()=>c,GQ:()=>u,Rx:()=>i,hD:()=>n,hS:()=>l,y:()=>s});class n extends Error{constructor(e,t,r){super(e),this.status=t,this.data=r,this.name="ApiError"}}async function o(e,t,r){if(!(e.headers.get("content-type")||"").includes("application/json"))return t;try{return await e.json()}catch(e){return t}}async function a(e,t){try{let r=new Headers(null==t?void 0:t.headers);r.set("Content-Type","application/json");let a=await fetch(e,{...t,headers:r}),s=a.headers.get("content-type")||"";if(a.redirected&&a.url.includes("/login"))throw new n("Authentication required",401);if(!a.ok){let e=await o(a,{},"error-body");throw new n(e.error||"HTTP error ".concat(a.status),a.status,e)}if(!s.includes("application/json"))throw new n("Unexpected response format",a.status);return a.json()}catch(e){if(e instanceof n)throw e;throw new n(e instanceof Error?e.message:"Unknown error",0,e)}}let s={getAll:async()=>a("/api/worktrees"),getById:async e=>a("/api/worktrees/".concat(e)),updateDescription:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({description:t})}),updateLink:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({link:t})}),toggleFavorite:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({favorite:t})}),updateStatus:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({status:t})}),updateCliTool:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({cliToolId:t})}),markAsViewed:async e=>a("/api/worktrees/".concat(e,"/viewed"),{method:"PATCH"}),async getMessages(e,t,r,n){let o=new URLSearchParams;return t&&o.append("cliTool",t),r&&o.append("includeArchived","true"),"number"==typeof n&&Number.isFinite(n)&&o.append("limit",String(n)),a("/api/worktrees/".concat(e,"/messages").concat(o.toString()?"?".concat(o.toString()):""))},async sendMessage(e,t,r){let n={content:t};return(null==r?void 0:r.cliToolId)&&(n.cliToolId=r.cliToolId),(null==r?void 0:r.instanceId)&&(n.instanceId=r.instanceId),(null==r?void 0:r.imagePath)&&(n.imagePath=r.imagePath),a("/api/worktrees/".concat(e,"/send"),{method:"POST",body:JSON.stringify(n)})},async uploadImageFile(e,t){let r=Date.now(),n="".concat(r,"-").concat(t.name),a=".commandmate/attachments",s=new FormData;s.append("file",new File([t],n,{type:t.type}));let i=await fetch("/api/worktrees/".concat(e,"/upload/").concat(a),{method:"POST",body:s});if(!i.ok){var c;let e=await o(i,{},"error-body");throw Error((null==e||null==(c=e.error)?void 0:c.message)||"Upload failed (HTTP ".concat(i.status,")"))}return{path:(await o(i,{},"response-body")).path||"".concat(a,"/").concat(n)}},getLogs:async e=>a("/api/worktrees/".concat(e,"/logs")),async getLogFile(e,t,r){let n=(null==r?void 0:r.sanitize)?"?sanitize=true":"";return a("/api/worktrees/".concat(e,"/logs/").concat(t).concat(n))},async killSession(e,t,r){let n=new URLSearchParams;t&&n.set("cliTool",t),r&&n.set("instance",r);let o=n.toString();return a("/api/worktrees/".concat(e,"/kill-session").concat(o?"?".concat(o):""),{method:"POST"})}},i={scan:async e=>a("/api/repositories/scan",{method:"POST",body:JSON.stringify({repositoryPath:e})}),sync:async()=>a("/api/repositories/sync",{method:"POST"}),delete:async e=>a("/api/repositories",{method:"DELETE",body:JSON.stringify({repositoryPath:e})}),async clone(e,t){var r;return a("/api/repositories/clone",{method:"POST",body:JSON.stringify({cloneUrl:e,fork:null!=(r=null==t?void 0:t.fork)&&r})})},getCloneStatus:async e=>a("/api/repositories/clone/".concat(e)),getExcluded:async()=>a("/api/repositories/excluded"),restore:async e=>a("/api/repositories/restore",{method:"PUT",body:JSON.stringify({repositoryPath:e})}),list:async()=>a("/api/repositories"),updateDisplayName:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({displayName:t})}),updateVisibility:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({visible:t})})},c={getAll:async e=>(await a("/api/worktrees/".concat(e,"/memos"))).memos,create:async(e,t)=>(await a("/api/worktrees/".concat(e,"/memos"),{method:"POST",body:JSON.stringify(t||{})})).memo,update:async(e,t,r)=>(await a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"PUT",body:JSON.stringify(r)})).memo,delete:async(e,t)=>a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"DELETE"}),async reorder(e,t){await a("/api/worktrees/".concat(e,"/memos"),{method:"PATCH",body:JSON.stringify({memoIds:t})})}};function l(e){return e instanceof n||e instanceof Error?e.message:"An unknown error occurred"}let u={checkForUpdate:async()=>a("/api/app/update-check",{method:"GET"}),startUpdate:async()=>a("/api/app/update",{method:"POST"}),async ping(){try{return(await fetch("/api/auth/status",{cache:"no-store"})).ok}catch(e){return!1}}}},89275:(e,t,r)=>{r.d(t,{Bo:()=>u,Hq:()=>c});var n=r(95155),o=r(12115),a=r(20063);let s={startTransition:e=>e()},i=(0,o.createContext)(null);function c(){var e;let t=(0,a.useRouter)(),{startTransition:r}=null!=(e=(0,o.useContext)(i))?e:s;return(0,o.useMemo)(()=>({push:e=>r(()=>t.push(e)),replace:e=>r(()=>t.replace(e))}),[t,r])}function l(e){let{onCommit:t}=e,r=(0,a.usePathname)(),n=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!n.current){n.current=!0;return}t()},[r,t]),null}function u(e){let{children:t}=e,r=(0,o.useRef)(null),a=(0,o.useCallback)(()=>{var e;null==(e=r.current)||e.call(r)},[]),s=(0,o.useCallback)(e=>{var t;t=()=>new Promise(t=>{let n=!1,o=()=>{n||(n=!0,t())};r.current=o,e(),window.setTimeout(o,500)}),"undefined"==typeof document||"function"!=typeof document.startViewTransition||"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?t():document.startViewTransition(t)},[]),c=(0,o.useMemo)(()=>({startTransition:s}),[s]);return(0,n.jsxs)(i.Provider,{value:c,children:[(0,n.jsx)(l,{onCommit:a}),t]})}},92614:(e,t,r)=>{r.d(t,{C:()=>i,E:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},94442:(e,t,r)=>{r.d(t,{dj:()=>E,tE:()=>b});var n=r(95155),o=r(12115),a=r(47650),s=r(18955),i=r(42529),c=r(78874),l=r(52056),u=r(23327),d=r(65229),f=r(59854),p=r(9900),y=r(9286);function m(e){let{type:t,iconColor:r}=e,o="h-5 w-5 ".concat(r);switch(t){case"success":return(0,n.jsx)(i.A,{className:o,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(c.A,{className:o,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(l.A,{className:o,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(u.A,{className:o,"data-testid":"toast-icon-info"})}}function w(e){let{id:t,message:r,type:a,onClose:i,duration:c=3e3}=e,l=(0,s.c)("common"),u=(0,o.useRef)(null),f=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(a),[w,g]=(0,o.useState)(!0),{shouldRender:h,isExiting:S}=(0,y.O)(w,p.Ys),b=(0,o.useRef)(i);b.current=i,(0,o.useEffect)(()=>{h||b.current(t)},[h,t]),(0,o.useEffect)(()=>(c>0&&(u.current=setTimeout(()=>{g(!1)},c)),()=>{u.current&&clearTimeout(u.current)}),[c]);let E=(0,o.useCallback)(()=>{u.current&&clearTimeout(u.current),g(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(f.bgColor,"\n ").concat(f.borderColor,"\n ").concat(f.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(S?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(m,{type:a,iconColor:f.iconColor}),(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:r}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:E,"aria-label":l("closeNotification"),className:"\n ".concat(f.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})]})}function g(e){let{toasts:t,onClose:r}=e,[s,i]=(0,o.useState)(!1);(0,o.useEffect)(()=>{i(!0)},[]);let c=(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:f.M.TOAST},children:t.map(e=>(0,n.jsx)(w,{id:e.id,message:e.message,type:e.type,onClose:r,duration:e.duration},e.id))});return s?(0,a.createPortal)(c,document.body):null}function h(){let[e,t]=(0,o.useState)([]),r=(0,o.useRef)(0),n=(0,o.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,a="toast-".concat(++r.current,"-").concat(Date.now()),s={id:a,message:e,type:n,duration:o};return t(e=>[...e,s]),a},[]),a=(0,o.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),s=(0,o.useCallback)(()=>{t([])},[]);return(0,o.useMemo)(()=>({toasts:e,showToast:n,removeToast:a,clearToasts:s}),[e,n,a,s])}let S=(0,o.createContext)(null);function b(e){let{children:t}=e,r=h();return(0,n.jsxs)(S.Provider,{value:r,children:[t,(0,n.jsx)(g,{toasts:r.toasts,onClose:r.removeToast})]})}function E(){let e=(0,o.useContext)(S),t=h();return null!=e?e:t}}}]);
|
|
1
|
+
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6488],{2317:(e,t,r)=>{r.d(t,{V:()=>a});var n=r(12115);function o(){try{let e="__localStorage_test__";return window.localStorage.setItem(e,"test"),window.localStorage.removeItem(e),!0}catch(e){return!1}}function a(e){let{key:t,defaultValue:r,validate:a,serialize:s=JSON.stringify,deserialize:i=JSON.parse}=e,c=(0,n.useRef)(r),l=(0,n.useRef)(a),u=(0,n.useRef)(s),d=(0,n.useRef)(i);c.current=r,l.current=a,u.current=s,d.current=i;let[f,p]=(0,n.useState)(!1),[y,m]=(0,n.useState)(r),w=(0,n.useCallback)(()=>{if(!o())return c.current;try{let e=window.localStorage.getItem(t);if(null===e)return c.current;let r=d.current(e);if(l.current)return l.current(r)?r:c.current;return r}catch(e){return c.current}},[t]),g=(0,n.useCallback)(e=>{if(o())try{let r=u.current(e);window.localStorage.setItem(t,r)}catch(e){}},[t]),h=(0,n.useCallback)(e=>{m(t=>{let r="function"==typeof e?e(t):e;return g(r),r})},[g]),S=(0,n.useCallback)(()=>{if(o())try{window.localStorage.removeItem(t)}catch(e){}m(c.current)},[t]);return(0,n.useEffect)(()=>{p(o()),m(w())},[w]),{value:y,setValue:h,removeValue:S,isAvailable:f}}},7636:(e,t,r)=>{r.d(t,{LV:()=>c,Si:()=>o,UZ:()=>s,Xn:()=>u,_s:()=>d,nO:()=>l,s6:()=>i});let n=["updatedAt","repositoryName","branchName","status","lastSent"],o=e=>n.includes(e),a={waiting:0,ready:1,running:2,generating:3,idle:4};function s(e){let t=new Set;for(let r of e)!1===r.visible&&t.add(r.path);return t}function i(e,t){return 0===t.size?e.slice():e.filter(e=>{let r=e.repositoryPath;return!r||!t.has(r)})}function c(e){let t=function(e){let t=5381;for(let r=0;r<e.length;r++)t=(t<<5)+t+e.charCodeAt(r)|0;return Math.abs(t)}(e)%360;return"hsl(".concat(t,", ").concat(65,"%, ").concat(60,"%)")}function l(e,t){if(!e&&!t)return 0;if(!e)return 1;if(!t)return -1;let r=e instanceof Date?e.getTime():new Date(e).getTime();return(t instanceof Date?t.getTime():new Date(t).getTime())-r}function u(e,t,r){let n=[...e];return n.sort((e,n)=>{let o=0;switch(t){case"updatedAt":{let t=e=>e?e instanceof Date?e.getTime():new Date(e).getTime():0,r=t(e.lastActivity);o=t(n.lastActivity)-r;break}case"repositoryName":{let t=e.repositoryName.toLowerCase(),r=n.repositoryName.toLowerCase();o=t.localeCompare(r);break}case"branchName":{let t=e.name.toLowerCase(),r=n.name.toLowerCase();o=t.localeCompare(r);break}case"status":o=a[e.status]-a[n.status];break;case"lastSent":{let t=l(e.lastActivity,n.lastActivity);if(!e.lastActivity&&!n.lastActivity){o=0;break}if(!e.lastActivity)return 1;if(!n.lastActivity)return -1;o=t;break}default:o=0}return("updatedAt"===t||"lastSent"===t?"desc"===r:"asc"===r)?o:-o}),n}function d(e,t,r){let n=new Map;for(let t of e){let e=t.repositoryName;n.has(e)||n.set(e,[]),n.get(e).push(t)}return[...n.keys()].sort((e,t)=>e.toLowerCase().localeCompare(t.toLowerCase())).map(e=>({repositoryName:e,branches:u(n.get(e),t,r)}))}},22592:(e,t,r)=>{r.d(t,{Ps:()=>d,W5:()=>u});var n=r(95155),o=r(12115),a=r(38218),s=r(68704);let i="data-pc-size",c={size:s.r5,setSize:()=>{},isMobile:!1,factor:s.d8[s.r5].factor,isAvailable:!1},l=(0,o.createContext)(c);function u(e){let{children:t}=e,{size:r,setSize:c,isAvailable:u}=(0,s.of)(),d=(0,a.a)();(0,o.useEffect)(()=>{if("undefined"==typeof document)return;let e=document.documentElement;return d?void e.removeAttribute(i):(e.setAttribute(i,r),()=>{e.removeAttribute(i)})},[r,d]);let f=(0,o.useMemo)(()=>({size:r,setSize:c,isMobile:d,factor:s.d8[r].factor,isAvailable:u}),[r,c,d,u]);return(0,n.jsx)(l.Provider,{value:f,children:t})}function d(){return(0,o.useContext)(l)}},32916:(e,t,r)=>{r.d(t,{GB:()=>u,VF:()=>d});var n=r(95155),o=r(12115),a=r(7636);let s="updatedAt",i=(0,o.createContext)(null);function c(e,t,r,n){let a=(0,o.useRef)(!0);(0,o.useEffect)(()=>{try{let t=localStorage.getItem(e);t&&n(t)}catch(e){}},[]),(0,o.useEffect)(()=>{if(a.current){a.current=!1;return}try{localStorage.setItem(e,r())}catch(e){}},[t])}function l(e,t){switch(t.type){case"TOGGLE":return{...e,isOpen:!e.isOpen};case"SET_WIDTH":return{...e,width:t.width};case"OPEN_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!0};case"CLOSE_MOBILE_DRAWER":return{...e,isMobileDrawerOpen:!1};case"SET_SORT_KEY":return{...e,sortKey:t.sortKey};case"SET_SORT_DIRECTION":return{...e,sortDirection:t.sortDirection};case"LOAD_SORT_SETTINGS":return{...e,sortKey:t.sortKey,sortDirection:t.sortDirection};case"SET_VIEW_MODE":return{...e,viewMode:t.viewMode};default:return e}}function u(e){let{children:t,initialOpen:r=!0,initialWidth:u=224}=e,[d,f]=(0,o.useReducer)(l,{isOpen:r,width:u,isMobileDrawerOpen:!1,sortKey:s,sortDirection:"desc",viewMode:"grouped"});c("mcbd-sidebar-sort","".concat(d.sortKey,":").concat(d.sortDirection),()=>JSON.stringify({sortKey:d.sortKey,sortDirection:d.sortDirection}),e=>{try{let t=JSON.parse(e),r=t.sortDirection,n=(0,a.Si)(t.sortKey)?t.sortKey:s;n&&("asc"===r||"desc"===r)&&f({type:"LOAD_SORT_SETTINGS",sortKey:n,sortDirection:r})}catch(e){}}),c("mcbd-sidebar-view-mode",d.viewMode,()=>d.viewMode,e=>{("grouped"===e||"flat"===e)&&f({type:"SET_VIEW_MODE",viewMode:e})}),c("mcbd-sidebar-width",d.width,()=>String(d.width),e=>{let t=Number(e);!isNaN(t)&&t>0&&f({type:"SET_WIDTH",width:288===t?224:t})});let p=(0,o.useCallback)(()=>{f({type:"TOGGLE"})},[]),y=(0,o.useCallback)(e=>{f({type:"SET_WIDTH",width:e})},[]),m=(0,o.useCallback)(()=>{f({type:"OPEN_MOBILE_DRAWER"})},[]),w=(0,o.useCallback)(()=>{f({type:"CLOSE_MOBILE_DRAWER"})},[]),g=(0,o.useCallback)(e=>{f({type:"SET_SORT_KEY",sortKey:e})},[]),h=(0,o.useCallback)(e=>{f({type:"SET_SORT_DIRECTION",sortDirection:e})},[]),S=(0,o.useCallback)(e=>{f({type:"SET_VIEW_MODE",viewMode:e})},[]),b=(0,o.useMemo)(()=>({isOpen:d.isOpen,width:d.width,isMobileDrawerOpen:d.isMobileDrawerOpen,sortKey:d.sortKey,sortDirection:d.sortDirection,toggle:p,setWidth:y,openMobileDrawer:m,closeMobileDrawer:w,setSortKey:g,setSortDirection:h,viewMode:d.viewMode,setViewMode:S}),[d.isOpen,d.width,d.isMobileDrawerOpen,d.sortKey,d.sortDirection,d.viewMode,p,y,m,w,g,h,S]);return(0,n.jsx)(i.Provider,{value:b,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useSidebarContext must be used within a SidebarProvider");return e}},38218:(e,t,r)=>{r.d(t,{D:()=>a,a:()=>s});var n=r(12115);let o=n.useLayoutEffect,a=768;function s(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoint:t=a}=e,[r,s]=(0,n.useState)(!1);return o(()=>{let e=window.matchMedia("(max-width: ".concat(t-1,"px)"));s(e.matches);let r=e=>{s(e.matches)};return e.addEventListener("change",r),()=>{e.removeEventListener("change",r)}},[t]),r}},39649:(e,t,r)=>{r.d(t,{$f:()=>d,H8:()=>u});var n=r(95155),o=r(12115),a=r(80344);let s={PROCESSING:2e3,SESSION_RUNNING:5e3,IDLE:1e4},i=(0,o.createContext)(null),c={selectedWorktreeId:null,worktrees:[],repositories:[],selectedWorktreeDetail:null,isLoading:!0,isLoadingDetail:!1,error:null};function l(e,t){switch(t.type){case"SET_WORKTREES":return{...e,worktrees:t.worktrees,isLoading:!1};case"SET_REPOSITORIES":return{...e,repositories:t.repositories};case"SELECT_WORKTREE":{var r;let n=null!=(r=e.worktrees.find(e=>e.id===t.id))?r:null;return{...e,selectedWorktreeId:t.id,selectedWorktreeDetail:null!=n?n:e.selectedWorktreeDetail,isLoadingDetail:null===n}}case"SET_WORKTREE_DETAIL":return{...e,selectedWorktreeDetail:t.detail};case"SET_LOADING":return{...e,isLoading:t.isLoading};case"SET_LOADING_DETAIL":return{...e,isLoadingDetail:t.isLoadingDetail};case"SET_ERROR":return{...e,error:t.error,isLoading:!1};default:return e}}function u(e){let{children:t,externalWorktrees:r,externalRepositories:u}=e,d=void 0!==r,[f,p]=(0,o.useReducer)(l,c);(0,o.useEffect)(()=>{d&&r&&p({type:"SET_WORKTREES",worktrees:r})},[d,r]),(0,o.useEffect)(()=>{d&&u&&p({type:"SET_REPOSITORIES",repositories:u})},[d,u]);let y=(0,o.useCallback)(async()=>{if(!d){p({type:"SET_LOADING",isLoading:!0}),p({type:"SET_ERROR",error:null});try{var e;let t=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:t.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(e=t.repositories)?e:[]})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktrees"})}}},[d]),m=(0,o.useCallback)(async e=>{p({type:"SELECT_WORKTREE",id:e}),p({type:"SET_ERROR",error:null});try{a.y.markAsViewed(e).catch(e=>{console.warn("[WorktreeSelectionContext] Failed to mark as viewed:",e)});let t=await a.y.getById(e);p({type:"SET_WORKTREE_DETAIL",detail:t})}catch(e){p({type:"SET_ERROR",error:e instanceof Error?e.message:"Failed to fetch worktree detail"})}finally{p({type:"SET_LOADING_DETAIL",isLoadingDetail:!1})}},[]),w=(0,o.useCallback)(async()=>{await y()},[y]);(0,o.useEffect)(()=>{d||y()},[y,d]),(0,o.useEffect)(()=>{if(d)return;let e=null,t=!0,r=async()=>{if(t)try{var n,o;let i=await a.y.getAll();p({type:"SET_WORKTREES",worktrees:i.worktrees}),p({type:"SET_REPOSITORIES",repositories:null!=(n=i.repositories)?n:[]});let c=(o=i.worktrees).some(e=>e.isProcessing||e.isWaitingForResponse)?s.PROCESSING:o.some(e=>e.isSessionRunning)?s.SESSION_RUNNING:s.IDLE;t&&(e=setTimeout(r,c))}catch(n){if(n instanceof a.hD&&401===n.status)return;console.error("[WorktreeSelectionContext] Polling error:",n),t&&(e=setTimeout(r,s.SESSION_RUNNING))}};return r(),()=>{t=!1,e&&clearTimeout(e)}},[d]);let g={selectedWorktreeId:f.selectedWorktreeId,worktrees:f.worktrees,repositories:f.repositories,selectedWorktreeDetail:f.selectedWorktreeDetail,isLoadingDetail:f.isLoadingDetail,error:f.error,selectWorktree:m,refreshWorktrees:w};return(0,n.jsx)(i.Provider,{value:g,children:t})}function d(){let e=(0,o.useContext)(i);if(!e)throw Error("useWorktreeSelection must be used within a WorktreeSelectionProvider");return e}},52703:(e,t,r)=>{r.d(t,{Oo:()=>o,ST:()=>n,zS:()=>a});let n="client_version",o="version_mismatch";function a(e){let t;try{t=JSON.parse(e)}catch(e){return null}if(!t||"object"!=typeof t)return null;let r=t;if("broadcast"===r.type){let e=r.data;return e&&"object"==typeof e?"string"!=typeof e.type?null:(void 0===e.worktreeId&&"string"==typeof r.worktreeId&&(e.worktreeId=r.worktreeId),e):null}return"string"==typeof r.type?r:null}},63365:(e,t,r)=>{r.d(t,{tS:()=>u,xM:()=>d,T3:()=>f});var n=r(95155),o=r(12115),a=r(52703);function s(){return"undefined"!=typeof globalThis&&"function"==typeof globalThis.WebSocket?globalThis.WebSocket:null}let i=()=>{},c={status:"disconnected",connected:!1,subscribe:i,unsubscribe:i,addListener:()=>i},l=(0,o.createContext)(null);function u(e){let{children:t,enabled:r=!0}=e,i=(0,o.useRef)(new Set),c=(0,o.useRef)(new Map),{status:u,subscribe:d,unsubscribe:f}=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{onEvent:t,onStatusChange:r,autoReconnect:n=!0,reconnectBaseDelay:i=1e3,reconnectMaxDelay:c=3e4,enabled:l=!0}=e,[u,d]=(0,o.useState)("disconnected"),f=(0,o.useRef)(null),p=(0,o.useRef)(null),y=(0,o.useRef)(0),m=(0,o.useRef)(new Set),w=(0,o.useRef)(!1),g=(0,o.useRef)(t);g.current=t;let h=(0,o.useRef)(r);h.current=r;let S=(0,o.useCallback)(e=>{var t;d(e),null==(t=h.current)||t.call(h,e)},[]),b=(0,o.useCallback)(()=>{null!==p.current&&(clearTimeout(p.current),p.current=null)},[]),E=(0,o.useCallback)(()=>{if(!l)return;let e=s();if(!e||f.current&&(f.current.readyState===e.OPEN||f.current.readyState===e.CONNECTING))return;b(),w.current=!1,S("connecting");let t="https:"===window.location.protocol?"wss:":"ws:",r=new e("".concat(t,"//").concat(window.location.host));f.current=r,r.onopen=()=>{y.current=0,S("connected");try{r.send(JSON.stringify({type:a.ST,version:"0.14.0"}))}catch(e){}m.current.forEach(e=>{try{r.send(JSON.stringify({type:"subscribe",worktreeId:e}))}catch(e){}})},r.onmessage=e=>{var t;let r="string"==typeof e.data?e.data:String(e.data),n=(0,a.zS)(r);n&&(null==(t=g.current)||t.call(g,n))},r.onerror=()=>{S("error")},r.onclose=()=>{var e;if(f.current=null,S("disconnected"),w.current||!n||"undefined"!=typeof document&&"hidden"===document.visibilityState)return;let t=(e=y.current,Math.min(i*2**Math.max(0,e),c));y.current+=1,p.current=setTimeout(()=>{p.current=null,E()},t)}},[l,n,i,c,S,b]),T=(0,o.useCallback)(()=>{if(b(),w.current=!0,f.current){try{f.current.close(1e3,"Client disconnect")}catch(e){}f.current=null}},[b]),k=(0,o.useCallback)(e=>{let t=f.current,r=s();if(t&&r&&t.readyState===r.OPEN)try{t.send(JSON.stringify(e))}catch(e){}},[]),C=(0,o.useCallback)(e=>{m.current.has(e)||(m.current.add(e),k({type:"subscribe",worktreeId:e}))},[k]),v=(0,o.useCallback)(e=>{m.current.has(e)&&(m.current.delete(e),k({type:"unsubscribe",worktreeId:e}))},[k]);return(0,o.useEffect)(()=>{if(l)return E(),()=>{T()}},[l,E,T]),(0,o.useEffect)(()=>{if(!l||"undefined"==typeof document)return;let e=()=>{"visible"===document.visibilityState&&(f.current||(y.current=0,E()))};return document.addEventListener("visibilitychange",e),()=>document.removeEventListener("visibilitychange",e)},[l,E]),{status:u,subscribe:C,unsubscribe:v,send:k}}({enabled:r,onEvent:(0,o.useCallback)(e=>{i.current.forEach(t=>{try{t(e)}catch(e){}})},[])}),p=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;r.set(e,n+1),0===n&&d(e)},[d]),y=(0,o.useCallback)(e=>{var t;let r=c.current,n=null!=(t=r.get(e))?t:0;n<=1?(r.delete(e),f(e)):r.set(e,n-1)},[f]),m=(0,o.useCallback)(e=>(i.current.add(e),()=>{i.current.delete(e)}),[]),w=(0,o.useMemo)(()=>({status:u,connected:"connected"===u,subscribe:p,unsubscribe:y,addListener:m}),[u,p,y,m]);return(0,n.jsx)(l.Provider,{value:w,children:t})}function d(){var e;return null!=(e=(0,o.useContext)(l))?e:c}function f(e){let{addListener:t}=d(),r=(0,o.useRef)(e);r.current=e,(0,o.useEffect)(()=>t(e=>r.current(e)),[t])}},65380:(e,t,r)=>{r.d(t,{H:()=>i,O:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)(!1);function s(e){let{children:t,authEnabled:r}=e;return(0,n.jsx)(a.Provider,{value:r,children:t})}function i(){return(0,o.useContext)(a)}},66966:(e,t,r)=>{r.d(t,{g7:()=>c,rC:()=>u,Fn:()=>l});var n=r(95155),o=r(12115),a=r(63365),s=r(39649);let i=(0,o.createContext)(null);function c(e){let{children:t}=e,{worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}=function(){let[e,t]=(0,o.useState)([]),[r,n]=(0,o.useState)([]),[s,i]=(0,o.useState)(!0),[c,l]=(0,o.useState)(null),u=(0,o.useRef)(null),d=(0,o.useRef)([]),f=(0,o.useRef)(null),{connected:p,subscribe:y,unsubscribe:m,addListener:w}=(0,a.xM)(),g=(0,o.useRef)(p);g.current=p;let h=(0,o.useCallback)(async()=>{try{var e,r;l(null);let a=await fetch("/api/worktrees");if(!a.ok)throw Error("Failed to fetch worktrees: ".concat(a.status));let s=await a.json(),i=null!=(e=s.worktrees)?e:[],c=null!=(r=s.repositories)?r:[];(0,o.startTransition)(()=>{t(i),n(c)}),d.current=i}catch(e){l(e instanceof Error?e:Error(String(e)))}finally{i(!1)}},[]);(0,o.useEffect)(()=>{h()},[h]);let S=(0,o.useCallback)(()=>d.current.some(e=>!0===e.isSessionRunning),[]),b=(0,o.useCallback)(()=>{let e=S();return g.current?e?2e4:6e4:e?5e3:3e4},[S]),E=(0,o.useCallback)(()=>{null!==u.current&&(clearInterval(u.current),u.current=null),f.current=null},[]),T=(0,o.useCallback)(()=>{E();let e=b();f.current=e,u.current=setInterval(()=>{h()},e)},[b,h,E]);(0,o.useEffect)(()=>{let e=()=>{document.hidden?E():(h(),T())},t=setTimeout(()=>{T()},0);return document.addEventListener("visibilitychange",e),()=>{clearTimeout(t),E(),document.removeEventListener("visibilitychange",e)}},[h,T,E]),(0,o.useEffect)(()=>{if(d.current=e,"undefined"!=typeof document&&document.hidden||null===f.current)return;let t=b();f.current!==t&&T()},[e,p,b,T]);let k=e.map(e=>e.id).sort().join(" ");return(0,o.useEffect)(()=>{let e=k.length>0?k.split(" "):[];return e.forEach(e=>y(e)),()=>{e.forEach(e=>m(e))}},[k,y,m]),(0,o.useEffect)(()=>w(e=>{if("session_status_changed"===e.type&&"string"==typeof e.worktreeId){let r=e.worktreeId,n=e.isRunning;if("boolean"==typeof n){if((null!=e.cliTool||null!=e.instance)&&!1===n)return void h();(0,o.startTransition)(()=>{t(e=>{let t=!1,o=e.map(e=>e.id===r&&e.isSessionRunning!==n?(t=!0,{...e,isSessionRunning:n}):e);return t?o:e})})}}else("message"===e.type||"message_updated"===e.type)&&h()}),[w,h]),{worktrees:e,repositories:r,isLoading:s,error:c,refresh:h}}(),f=(0,o.useMemo)(()=>({worktrees:r,repositories:c,isLoading:l,error:u,refresh:d}),[r,c,l,u,d]);return(0,n.jsx)(i.Provider,{value:f,children:(0,n.jsx)(s.H8,{externalWorktrees:r,externalRepositories:c,children:t})})}function l(){let e=(0,o.useContext)(i);if(null===e)throw Error("useWorktreesCacheContext must be used within a WorktreesCacheProvider");return e}function u(){return(0,o.useContext)(i)}},68704:(e,t,r)=>{r.d(t,{Uf:()=>a,d8:()=>s,fM:()=>i,of:()=>l,r5:()=>o,rq:()=>c});var n=r(2317);let o="medium",a=["large","medium","small","xsmall"],s={large:{value:"large",rootFontSizePx:18,factor:1.125,terminalFontSize:16},medium:{value:"medium",rootFontSizePx:16,factor:1,terminalFontSize:14},small:{value:"small",rootFontSizePx:14,factor:.875,terminalFontSize:12},xsmall:{value:"xsmall",rootFontSizePx:12.5,factor:.78,terminalFontSize:11}};function i(e){return"string"==typeof e&&Object.prototype.hasOwnProperty.call(s,e)}function c(e){return s[e].terminalFontSize}function l(){let{value:e,setValue:t,isAvailable:r}=(0,n.V)({key:"mcbd-pc-display-size",defaultValue:o,validate:i});return{size:e,setSize:t,isAvailable:r}}},70628:(e,t,r)=>{r.d(t,{K:()=>i,S:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},80344:(e,t,r)=>{r.d(t,{$T:()=>c,GQ:()=>u,Rx:()=>i,hD:()=>n,hS:()=>l,y:()=>s});class n extends Error{constructor(e,t,r){super(e),this.status=t,this.data=r,this.name="ApiError"}}async function o(e,t,r){if(!(e.headers.get("content-type")||"").includes("application/json"))return t;try{return await e.json()}catch(e){return t}}async function a(e,t){try{let r=new Headers(null==t?void 0:t.headers);r.set("Content-Type","application/json");let a=await fetch(e,{...t,headers:r}),s=a.headers.get("content-type")||"";if(a.redirected&&a.url.includes("/login"))throw new n("Authentication required",401);if(!a.ok){let e=await o(a,{},"error-body");throw new n(e.error||"HTTP error ".concat(a.status),a.status,e)}if(!s.includes("application/json"))throw new n("Unexpected response format",a.status);return a.json()}catch(e){if(e instanceof n)throw e;throw new n(e instanceof Error?e.message:"Unknown error",0,e)}}let s={getAll:async()=>a("/api/worktrees"),getById:async e=>a("/api/worktrees/".concat(e)),updateDescription:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({description:t})}),updateLink:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({link:t})}),toggleFavorite:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({favorite:t})}),updateStatus:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({status:t})}),updateCliTool:async(e,t)=>a("/api/worktrees/".concat(e),{method:"PATCH",body:JSON.stringify({cliToolId:t})}),markAsViewed:async e=>a("/api/worktrees/".concat(e,"/viewed"),{method:"PATCH"}),async getMessages(e,t,r,n){let o=new URLSearchParams;return t&&o.append("cliTool",t),r&&o.append("includeArchived","true"),"number"==typeof n&&Number.isFinite(n)&&o.append("limit",String(n)),a("/api/worktrees/".concat(e,"/messages").concat(o.toString()?"?".concat(o.toString()):""))},async sendMessage(e,t,r){let n={content:t};return(null==r?void 0:r.cliToolId)&&(n.cliToolId=r.cliToolId),(null==r?void 0:r.instanceId)&&(n.instanceId=r.instanceId),(null==r?void 0:r.imagePath)&&(n.imagePath=r.imagePath),a("/api/worktrees/".concat(e,"/send"),{method:"POST",body:JSON.stringify(n)})},async uploadImageFile(e,t){let r=Date.now(),n="".concat(r,"-").concat(t.name),a=".commandmate/attachments",s=new FormData;s.append("file",new File([t],n,{type:t.type}));let i=await fetch("/api/worktrees/".concat(e,"/upload/").concat(a),{method:"POST",body:s});if(!i.ok){var c;let e=await o(i,{},"error-body");throw Error((null==e||null==(c=e.error)?void 0:c.message)||"Upload failed (HTTP ".concat(i.status,")"))}return{path:(await o(i,{},"response-body")).path||"".concat(a,"/").concat(n)}},getLogs:async e=>a("/api/worktrees/".concat(e,"/logs")),async getLogFile(e,t,r){let n=(null==r?void 0:r.sanitize)?"?sanitize=true":"";return a("/api/worktrees/".concat(e,"/logs/").concat(t).concat(n))},async killSession(e,t,r){let n=new URLSearchParams;t&&n.set("cliTool",t),r&&n.set("instance",r);let o=n.toString();return a("/api/worktrees/".concat(e,"/kill-session").concat(o?"?".concat(o):""),{method:"POST"})}},i={scan:async e=>a("/api/repositories/scan",{method:"POST",body:JSON.stringify({repositoryPath:e})}),sync:async()=>a("/api/repositories/sync",{method:"POST"}),delete:async e=>a("/api/repositories",{method:"DELETE",body:JSON.stringify({repositoryPath:e})}),async clone(e,t){var r;return a("/api/repositories/clone",{method:"POST",body:JSON.stringify({cloneUrl:e,fork:null!=(r=null==t?void 0:t.fork)&&r})})},getCloneStatus:async e=>a("/api/repositories/clone/".concat(e)),getExcluded:async()=>a("/api/repositories/excluded"),restore:async e=>a("/api/repositories/restore",{method:"PUT",body:JSON.stringify({repositoryPath:e})}),list:async()=>a("/api/repositories"),updateDisplayName:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({displayName:t})}),updateVisibility:async(e,t)=>a("/api/repositories/".concat(encodeURIComponent(e)),{method:"PUT",body:JSON.stringify({visible:t})})},c={getAll:async e=>(await a("/api/worktrees/".concat(e,"/memos"))).memos,create:async(e,t)=>(await a("/api/worktrees/".concat(e,"/memos"),{method:"POST",body:JSON.stringify(t||{})})).memo,update:async(e,t,r)=>(await a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"PUT",body:JSON.stringify(r)})).memo,delete:async(e,t)=>a("/api/worktrees/".concat(e,"/memos/").concat(t),{method:"DELETE"}),async reorder(e,t){await a("/api/worktrees/".concat(e,"/memos"),{method:"PATCH",body:JSON.stringify({memoIds:t})})}};function l(e){return e instanceof n||e instanceof Error?e.message:"An unknown error occurred"}let u={checkForUpdate:async()=>a("/api/app/update-check",{method:"GET"}),startUpdate:async()=>a("/api/app/update",{method:"POST"}),async ping(){try{return(await fetch("/api/auth/status",{cache:"no-store"})).ok}catch(e){return!1}}}},89275:(e,t,r)=>{r.d(t,{Bo:()=>u,Hq:()=>c});var n=r(95155),o=r(12115),a=r(20063);let s={startTransition:e=>e()},i=(0,o.createContext)(null);function c(){var e;let t=(0,a.useRouter)(),{startTransition:r}=null!=(e=(0,o.useContext)(i))?e:s;return(0,o.useMemo)(()=>({push:e=>r(()=>t.push(e)),replace:e=>r(()=>t.replace(e))}),[t,r])}function l(e){let{onCommit:t}=e,r=(0,a.usePathname)(),n=(0,o.useRef)(!1);return(0,o.useEffect)(()=>{if(!n.current){n.current=!0;return}t()},[r,t]),null}function u(e){let{children:t}=e,r=(0,o.useRef)(null),a=(0,o.useCallback)(()=>{var e;null==(e=r.current)||e.call(r)},[]),s=(0,o.useCallback)(e=>{var t;t=()=>new Promise(t=>{let n=!1,o=()=>{n||(n=!0,t())};r.current=o,e(),window.setTimeout(o,500)}),"undefined"==typeof document||"function"!=typeof document.startViewTransition||"function"==typeof window.matchMedia&&window.matchMedia("(prefers-reduced-motion: reduce)").matches?t():document.startViewTransition(t)},[]),c=(0,o.useMemo)(()=>({startTransition:s}),[s]);return(0,n.jsxs)(i.Provider,{value:c,children:[(0,n.jsx)(l,{onCommit:a}),t]})}},92614:(e,t,r)=>{r.d(t,{C:()=>i,E:()=>s});var n=r(95155),o=r(12115);let a=(0,o.createContext)({open:!1,setOpen:()=>{},toggle:()=>{}});function s(e){let{children:t}=e,[r,s]=(0,o.useState)(!1),i=(0,o.useCallback)(()=>s(e=>!e),[]),c=(0,o.useMemo)(()=>({open:r,setOpen:s,toggle:i}),[r,i]);return(0,n.jsx)(a.Provider,{value:c,children:t})}function i(){return(0,o.useContext)(a)}},94442:(e,t,r)=>{r.d(t,{dj:()=>E,tE:()=>b});var n=r(95155),o=r(12115),a=r(47650),s=r(18955),i=r(42529),c=r(78874),l=r(52056),u=r(23327),d=r(65229),f=r(59854),p=r(9900),y=r(9286);function m(e){let{type:t,iconColor:r}=e,o="h-5 w-5 ".concat(r);switch(t){case"success":return(0,n.jsx)(i.A,{className:o,"data-testid":"toast-icon-success"});case"error":return(0,n.jsx)(c.A,{className:o,"data-testid":"toast-icon-error"});case"warning":return(0,n.jsx)(l.A,{className:o,"data-testid":"toast-icon-warning"});default:return(0,n.jsx)(u.A,{className:o,"data-testid":"toast-icon-info"})}}function w(e){let{id:t,message:r,type:a,onClose:i,duration:c=3e3}=e,l=(0,s.c)("common"),u=(0,o.useRef)(null),f=function(e){switch(e){case"success":return{bgColor:"bg-success-subtle",borderColor:"border-success-border",textColor:"text-success-foreground",iconColor:"text-success-foreground"};case"error":return{bgColor:"bg-danger-subtle",borderColor:"border-danger-border",textColor:"text-danger-foreground",iconColor:"text-danger-foreground"};case"warning":return{bgColor:"bg-warning-subtle",borderColor:"border-warning-border",textColor:"text-warning-foreground",iconColor:"text-warning-foreground"};default:return{bgColor:"bg-info-subtle",borderColor:"border-info-border",textColor:"text-info-foreground",iconColor:"text-info-foreground"}}}(a),[w,g]=(0,o.useState)(!0),{shouldRender:h,isExiting:S}=(0,y.O)(w,p.Ys),b=(0,o.useRef)(i);b.current=i,(0,o.useEffect)(()=>{h||b.current(t)},[h,t]),(0,o.useEffect)(()=>(c>0&&(u.current=setTimeout(()=>{g(!1)},c)),()=>{u.current&&clearTimeout(u.current)}),[c]);let E=(0,o.useCallback)(()=>{u.current&&clearTimeout(u.current),g(!1)},[]);return(0,n.jsxs)("div",{"data-testid":"toast-".concat(t),role:"alert",className:"\n ".concat(f.bgColor,"\n ").concat(f.borderColor,"\n ").concat(f.textColor,"\n border rounded-lg shadow-lg p-4 min-w-[300px] max-w-[400px]\n flex items-start gap-3\n ").concat(S?"animate-out fade-out-0 slide-out-to-right-full duration-200 fill-mode-forwards pointer-events-none":"animate-slide-in","\n "),children:[(0,n.jsx)(m,{type:a,iconColor:f.iconColor}),(0,n.jsx)("p",{className:"flex-1 text-sm font-medium",children:r}),(0,n.jsx)("button",{"data-testid":"toast-close-button",onClick:E,"aria-label":l("closeNotification"),className:"\n ".concat(f.textColor,"\n hover:opacity-70\n focus:outline-none focus:ring-2 focus:ring-offset-2\n transition-opacity\n "),children:(0,n.jsx)(d.A,{className:"h-4 w-4"})})]})}function g(e){let{toasts:t,onClose:r}=e,[s,i]=(0,o.useState)(!1);(0,o.useEffect)(()=>{i(!0)},[]);let c=(0,n.jsx)("div",{"data-testid":"toast-container","aria-live":"polite",className:"fixed bottom-4 right-4 flex flex-col gap-2",style:{zIndex:f.M.TOAST},children:t.map(e=>(0,n.jsx)(w,{id:e.id,message:e.message,type:e.type,onClose:r,duration:e.duration},e.id))});return s?(0,a.createPortal)(c,document.body):null}function h(){let[e,t]=(0,o.useState)([]),r=(0,o.useRef)(0),n=(0,o.useCallback)(function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"info",o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:3e3,a="toast-".concat(++r.current,"-").concat(Date.now()),s={id:a,message:e,type:n,duration:o};return t(e=>[...e,s]),a},[]),a=(0,o.useCallback)(e=>{t(t=>t.filter(t=>t.id!==e))},[]),s=(0,o.useCallback)(()=>{t([])},[]);return(0,o.useMemo)(()=>({toasts:e,showToast:n,removeToast:a,clearToasts:s}),[e,n,a,s])}let S=(0,o.createContext)(null);function b(e){let{children:t}=e,r=h();return(0,n.jsxs)(S.Provider,{value:r,children:[t,(0,n.jsx)(g,{toasts:r.toasts,onClose:r.removeToast})]})}function E(){let e=(0,o.useContext)(S),t=h();return null!=e?e:t}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{6473:(e,t,s)=>{"use strict";s.d(t,{Lc:()=>n,qz:()=>a});let a="animate-in fade-in-0 slide-in-from-bottom-2 fill-mode-backwards duration-300";function n(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:40,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:10;if(Number.isFinite(e)&&!(e<=0)&&!(e>=s))return"".concat(e*t,"ms")}},53292:(e,t,s)=>{"use strict";s.d(t,{Ll:()=>a,bu:()=>n});let a=2e3,n=4e3},54799:(e,t,s)=>{Promise.resolve().then(s.bind(s,75590))},75590:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>P});var a=s(95155),n=s(4560),o=s(66966),i=s(12115),r=s(18955);function d(e){let{worktrees:t}=e,s=(0,r.c)("home"),{runningCount:n,waitingCount:o}=(0,i.useMemo)(()=>{let e=0,s=0;for(let a of t)a.isSessionRunning&&(e++,a.isWaitingForResponse&&s++);return{runningCount:e,waitingCount:s}},[t]);return(0,a.jsxs)("div",{className:"mb-8",children:[(0,a.jsx)("h1",{className:"text-2xl font-semibold text-foreground",children:s("title")}),(0,a.jsxs)("p",{className:"mt-1 text-sm text-muted-foreground","data-testid":"home-subline",children:[(0,a.jsx)("span",{className:"tabular-nums","data-testid":"subline-running",children:n})," ",s("running"),(0,a.jsx)("span",{"aria-hidden":"true",children:" \xb7 "}),(0,a.jsx)("span",{className:"tabular-nums","data-testid":"subline-waiting",children:o})," ",s("waiting")]})]})}var l=s(52619),c=s.n(l),m=s(65229),u=s(61362),h=s(99051),x=s(744),g=s(2317);function f(e){return"boolean"==typeof e}let p=[{key:"registerRepository",href:"/repositories"},{key:"sendFirstMessage",href:"/sessions"}];function j(e){let{worktrees:t,repositories:s,isLoading:n=!1,error:o=null}=e,d=(0,r.c)("home"),{value:l,setValue:j}=(0,g.V)({key:"commandmate:onboarding-dismissed",defaultValue:!1,validate:f}),[b,v]=(0,i.useState)(!1);(0,i.useEffect)(()=>v(!0),[]);let y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];return{hasRepository:(null!=t?t:[]).length>0,hasSentMessage:(null!=e?e:[]).some(e=>!!e.lastUserMessageAt)}}(t,s),N=y.hasRepository&&y.hasSentMessage,w=b&&!n&&null===o;return((0,i.useEffect)(()=>{w&&N&&!l&&j(!0)},[w,N,l,j]),!w||N||l)?null:(0,a.jsx)("div",{className:"mb-8",children:(0,a.jsxs)(x.Zp,{variant:"elevated","data-testid":"onboarding-checklist",children:[(0,a.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-foreground",children:d("onboarding.title")}),(0,a.jsx)(x.$n,{variant:"ghost",size:"sm","aria-label":d("onboarding.dismiss"),"data-testid":"onboarding-dismiss",onClick:()=>j(!0),children:(0,a.jsx)(m.A,{size:16,"aria-hidden":"true"})})]}),(0,a.jsx)("ol",{className:"mt-3 space-y-3",children:p.map(e=>{let{key:t,href:s}=e,n="registerRepository"===t?y.hasRepository:y.hasSentMessage;return(0,a.jsxs)("li",{className:"flex items-center gap-3","data-testid":"onboarding-step-".concat(t),"data-complete":n,children:[n?(0,a.jsx)(u.A,{size:20,className:"shrink-0 text-success-foreground","aria-hidden":"true"}):(0,a.jsx)(h.A,{size:20,className:"shrink-0 text-muted-foreground","aria-hidden":"true"}),(0,a.jsx)("span",{className:"min-w-0 flex-1 text-sm ".concat(n?"text-muted-foreground line-through":"text-foreground"),children:d("onboarding.steps.".concat(t))}),!n&&(0,a.jsx)(c(),{href:s,"data-testid":"onboarding-action-".concat(t),className:"shrink-0 rounded-md bg-accent-600 px-3 py-1.5 text-xs font-medium text-white transition-colors hover:bg-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:bg-accent-500 dark:hover:bg-accent-600",children:d("onboarding.actions.".concat(t))})]},t)})})]})})}var b=s(87531);function v(e){let{worktrees:t,isLoading:s=!1}=e,n=(0,r.c)("home"),{runningCount:o,waitingCount:d}=(0,i.useMemo)(()=>{let e=0,s=0;for(let a of t)a.isSessionRunning&&(e++,a.isWaitingForResponse&&s++);return{runningCount:e,waitingCount:s}},[t]);return s?(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary-loading",role:"status","aria-label":n("sessionSummary.loading"),children:[0,1].map(e=>(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsx)("div",{className:"flex h-4 items-center",children:(0,a.jsx)(x.EA,{className:"h-3 w-16"})}),(0,a.jsx)("div",{className:"flex h-9 items-center",children:(0,a.jsx)(x.EA,{className:"h-7 w-10"})})]},e))}):(0,a.jsxs)("div",{className:"grid grid-cols-2 gap-3","data-testid":"home-session-summary",children:[(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,a.jsx)(x.md,{status:o>0?"running":"idle",size:"sm",label:n("sessionSummary.running")}),n("sessionSummary.running")]}),(0,a.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",o>0?"text-foreground":"text-muted-foreground"),"data-testid":"running-count",children:o})]}),(0,a.jsxs)("div",{className:"rounded-lg border border-border bg-surface-2 px-3 py-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground",children:[(0,a.jsx)(x.md,{status:d>0?"waiting":"idle",size:"sm",label:n("sessionSummary.waiting")}),n("sessionSummary.waiting")]}),(0,a.jsx)("div",{className:(0,b.cn)("text-3xl font-bold tabular-nums",d>0?"text-foreground":"text-muted-foreground"),"data-testid":"waiting-count",children:d})]})]})}var y=s(7636),N=s(83012);function w(e){var t;return null!=(t=e.lastUserMessageAt)?t:e.updatedAt}function k(e){let{worktrees:t,limit:s=5,isLoading:n=!1}=e,o=(0,r.c)("home"),d=(0,i.useMemo)(()=>[...t].sort((e,t)=>(0,y.nO)(w(e),w(t))).slice(0,s),[t,s]);return n?(0,a.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions-loading",role:"status","aria-label":o("recentSessions.loading"),children:Array.from({length:s},(e,t)=>(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-2 py-1.5",children:[(0,a.jsx)(x.EA,{className:"h-2 w-2 shrink-0 rounded-full"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1 space-y-1",children:[(0,a.jsx)(x.EA,{className:"h-4 w-2/5"}),(0,a.jsx)(x.EA,{className:"h-3 w-3/5"})]}),(0,a.jsx)(x.EA,{className:"h-3 w-8 shrink-0"})]},t))}):0===d.length?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"recent-sessions-empty",children:o("recentSessions.empty")}),(0,a.jsx)(c(),{href:"/repositories","data-testid":"recent-sessions-cta",className:"inline-block text-sm font-medium text-accent-600 transition-colors hover:text-accent-700 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring dark:text-accent-400 dark:hover:text-accent-300",children:o("recentSessions.cta")})]}):(0,a.jsx)("ul",{className:"space-y-1","data-testid":"recent-sessions",children:d.map(e=>{var t;let s=w(e),n=s?(0,N.Fx)(String(s)):"";return(0,a.jsx)("li",{children:(0,a.jsxs)(c(),{href:"/worktrees/".concat(e.id),"data-testid":"recent-session-".concat(e.id),className:"flex items-center gap-2 rounded-md px-2 py-1.5 transition-colors hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",children:[(0,a.jsx)("span",{className:"h-2 w-2 shrink-0 rounded-full ".concat(e.isWaitingForResponse?"bg-warning":e.isSessionRunning?"bg-success":"bg-muted-foreground"),"aria-hidden":"true"}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"block truncate text-sm font-medium text-foreground",children:null!=(t=e.repositoryDisplayName)?t:e.repositoryName}),(0,a.jsx)("span",{className:"block truncate text-xs text-muted-foreground",children:e.name})]}),n&&(0,a.jsx)("span",{className:"shrink-0 text-xs tabular-nums text-muted-foreground",children:n})]})},e.id)})})}function C(e){let{worktrees:t,isLoading:s=!1}=e,n=(0,r.c)("home");return(0,a.jsxs)(x.Zp,{variant:"elevated",className:"h-full","data-testid":"session-overview-tile",children:[(0,a.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:n("sessionOverview.title")}),(0,a.jsx)(v,{worktrees:t,isLoading:s}),(0,a.jsxs)("div",{className:"mt-4 flex items-center justify-between",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-foreground",children:n("sessionOverview.recentSessions")}),(0,a.jsx)(c(),{href:"/sessions",className:"text-xs text-accent-600 hover:underline dark:text-accent-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring rounded","data-testid":"session-overview-view-all",children:n("sessionOverview.viewAll")})]}),(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(k,{worktrees:t,isLoading:s})})]})}var S=s(36402),A=s(85872),E=s(53292);let R="commandmate-home-todo-repo";function F(e){var t;return(null==(t=e.repositoryDisplayName)?void 0:t.trim())||e.repositoryName||""}function M(){let e=(0,r.c)("home"),t=(0,r.c)("common"),s=(0,S.SC)(),[n,o]=(0,i.useState)([]),[d,l]=(0,i.useState)(""),[c,m]=(0,i.useState)([]),[u,h]=(0,i.useState)(""),[g,f]=(0,i.useState)(!1),[p,j]=(0,i.useState)(!1),[b,v]=(0,i.useState)(null),y=(0,i.useRef)(!1),N=(0,i.useMemo)(()=>c.filter(e=>!e.done).length,[c]);(0,i.useEffect)(()=>{!async function(){try{var e;let t=await fetch("/api/worktrees");if(!t.ok)return;let s=(null!=(e=(await t.json()).repositories)?e:[]).map(e=>({id:e.id,path:e.path,name:e.name,displayName:e.displayName}));if(o(s),s.length>0){let e=localStorage.getItem(R),t=e&&s.some(t=>t.id===e)?e:s[0].id;l(t)}}catch(e){}finally{y.current=!0}}()},[]);let w=(0,i.useCallback)(async()=>{f(!0),v(null);try{let e=await A.$C.listAll();m(e)}catch(t){v(t instanceof Error?t.message:e("todo.errors.load")),m([])}finally{f(!1)}},[e]);(0,i.useEffect)(()=>{w()},[w]),(0,i.useEffect)(()=>{d&&localStorage.setItem(R,d)},[d]);let k=(0,i.useCallback)(async()=>{let t=u.trim();if(t&&d&&!p){j(!0),v(null);try{await A.$C.create(d,t),h(""),await w()}catch(t){v(t instanceof Error?t.message:e("todo.errors.add"))}finally{j(!1)}}},[u,d,p,w,e]),C=(0,i.useCallback)(async t=>{m(e=>e.map(e=>e.id===t.id?{...e,done:!e.done}:e)),v(null);try{await A.$C.update(t.repositoryId,t.id,{done:!t.done})}catch(t){v(t instanceof Error?t.message:e("todo.errors.update")),w()}},[w,e]),M=(0,i.useCallback)(async a=>{if(await s({description:t("confirmDelete",{name:a.content}),variant:"danger"})){v(null);try{await A.$C.remove(a.repositoryId,a.id),m(e=>e.filter(e=>e.id!==a.id))}catch(t){v(t instanceof Error?t.message:e("todo.errors.delete"))}}},[e,s,t]),I=(0,i.useCallback)(e=>{"Enter"!==e.key||e.nativeEvent.isComposing||(e.preventDefault(),k())},[k]),T=n.length>0;return(0,a.jsxs)(x.Zp,{className:"h-full","data-testid":"home-todo-widget",children:[(0,a.jsx)("h2",{className:"mb-3 text-lg font-semibold text-foreground",children:e("todo.title")}),(0,a.jsxs)("div",{className:"flex flex-col gap-2 mb-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3","data-testid":"todo-selector-row",children:[(0,a.jsxs)("label",{className:"flex items-center gap-2 text-sm text-muted-foreground min-w-0",children:[(0,a.jsx)("span",{className:"shrink-0",children:e("todo.repository")}),(0,a.jsx)("select",{value:d,onChange:e=>l(e.target.value),disabled:!T,"data-testid":"todo-repo-select",className:"min-w-0 flex-1 truncate rounded-md border border-input bg-surface dark:bg-surface-2 px-2 py-1 text-sm text-surface-foreground disabled:opacity-50 sm:flex-initial sm:max-w-[16rem]",children:n.map(e=>{var t;return(0,a.jsx)("option",{value:e.id,children:(null==(t=e.displayName)?void 0:t.trim())||e.name},e.id)})})]}),T&&(0,a.jsx)("span",{className:"shrink-0 text-xs text-muted-foreground","data-testid":"todo-remaining",children:e("todo.open",{count:N})})]}),T?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-3",children:[(0,a.jsx)(x.pd,{type:"text",value:u,onChange:e=>h(e.target.value),onKeyDown:I,maxLength:E.Ll,placeholder:e("todo.inputPlaceholder"),"data-testid":"todo-input",className:"w-auto flex-1 min-w-0"}),(0,a.jsx)(x.$n,{type:"button",variant:"primary",size:"sm",onClick:k,disabled:p||0===u.trim().length,"data-testid":"todo-add-button",className:"shrink-0",children:e("todo.add")})]}),b&&(0,a.jsx)("p",{className:"mb-2 text-xs text-danger-foreground","data-testid":"todo-error",children:b}),g&&0===c.length?(0,a.jsx)("ul",{className:"space-y-1","data-testid":"todo-loading",role:"status","aria-label":e("todo.loading"),children:[0,1,2].map(e=>(0,a.jsxs)("li",{className:"flex items-center gap-2 rounded-md px-1 py-1",children:[(0,a.jsx)(x.EA,{className:"h-4 w-4 shrink-0 rounded"}),(0,a.jsx)(x.EA,{className:"h-4 ".concat(1===e?"w-2/3":"w-5/6")})]},e))}):0===c.length?(0,a.jsx)("p",{className:"text-sm text-muted-foreground","data-testid":"todo-empty",children:e("todo.empty")}):(0,a.jsx)("ul",{className:"space-y-1","data-testid":"todo-list",children:c.map(t=>(0,a.jsxs)("li",{className:"flex flex-col gap-1 rounded-md px-1 py-1 hover:bg-muted group sm:flex-row sm:items-center sm:gap-2","data-testid":"todo-item",children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,a.jsx)("label",{className:"shrink-0 inline-flex min-h-[44px] min-w-[44px] cursor-pointer items-center justify-center sm:min-h-0 sm:min-w-0",children:(0,a.jsx)(x.Sc,{checked:t.done,onCheckedChange:()=>C(t),"data-testid":"todo-checkbox","aria-label":t.done?e("todo.markAsNotDone"):e("todo.markAsDone")})}),(0,a.jsx)("span",{className:"min-w-0 flex-1 break-words text-sm ".concat(t.done?"line-through text-muted-foreground":"text-foreground"),children:t.content})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center justify-end gap-2",children:[F(t)&&(0,a.jsx)("span",{className:"shrink-0 max-w-[8rem] truncate rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground","data-testid":"todo-repo-badge",title:F(t),children:F(t)}),(0,a.jsx)("button",{type:"button",onClick:()=>M(t),"aria-label":e("todo.delete"),"data-testid":"todo-delete",className:"inline-flex min-h-[44px] min-w-[44px] shrink-0 items-center justify-center text-muted-foreground opacity-100 transition-opacity hover:text-danger-foreground sm:min-h-0 sm:min-w-0 sm:opacity-0 sm:group-hover:opacity-100",children:(0,a.jsx)("svg",{className:"w-4 h-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M6 18L18 6M6 6l12 12"})})})]})]},t.id))})]}):(0,a.jsx)("p",{className:"text-sm text-muted-foreground",children:e("todo.noRepositories")})]})}var I=s(37586),T=s(66685),U=s(24533),z=s(37772),D=s(6473);let L=[{key:"chat",href:"/chat",icon:(0,a.jsx)(I.A,{size:20,"aria-hidden":"true"})},{key:"sessions",href:"/sessions",icon:(0,a.jsx)(T.A,{size:20,"aria-hidden":"true"})},{key:"repositories",href:"/repositories",icon:(0,a.jsx)(U.A,{size:20,"aria-hidden":"true"})},{key:"review",href:"/review",icon:(0,a.jsx)(u.A,{size:20,"aria-hidden":"true"})},{key:"more",href:"/more",icon:(0,a.jsx)(z.A,{size:20,"aria-hidden":"true"})}];function O(){let e=(0,r.c)("common");return(0,a.jsx)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5","data-testid":"home-quick-actions",children:L.map((t,s)=>{let n=e("nav.".concat(t.key));return(0,a.jsx)(c(),{href:t.href,"aria-label":n,className:"group block rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2","data-testid":"quick-action-".concat(t.key),children:(0,a.jsxs)(x.Zp,{interactive:!0,padding:"sm",style:{animationDelay:(0,D.Lc)(s)},className:"flex h-full flex-col items-center justify-center gap-1.5 py-3 text-center hover:border-accent-300 dark:hover:border-accent-700 ".concat(D.qz),children:[(0,a.jsx)("span",{className:"text-muted-foreground group-hover:text-accent-600 dark:group-hover:text-accent-400 transition-colors",children:t.icon}),(0,a.jsx)("span",{className:"text-xs font-medium text-foreground",children:n})]})},t.href)})})}function P(){let{worktrees:e,repositories:t,isLoading:s,error:i}=(0,o.Fn)(),r=s&&0===e.length;return(0,a.jsx)(n.GV,{children:(0,a.jsxs)("div",{className:"container-custom py-8 overflow-auto h-full",children:[(0,a.jsx)(d,{worktrees:e}),(0,a.jsx)(j,{worktrees:e,repositories:t,isLoading:r,error:i}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-12","data-testid":"home-bento-grid",children:[(0,a.jsx)("div",{className:"md:col-span-8",children:(0,a.jsx)(C,{worktrees:e,isLoading:r})}),(0,a.jsx)("div",{className:"md:col-span-4",children:(0,a.jsx)(M,{})}),(0,a.jsx)("div",{className:"md:col-span-12",children:(0,a.jsx)(O,{})})]})]})})}},83012:(e,t,s)=>{"use strict";s.d(t,{Fx:()=>i,bg:()=>r,fw:()=>o});var a=s(53298),n=s(73683);function o(e,t){let s=new Date(e);return isNaN(s.getTime())?"":(0,a.m)(s,{addSuffix:!0,...t?{locale:t}:{}})}function i(e){let t=new Date(e);if(isNaN(t.getTime()))return"";let s=Math.round((Date.now()-t.getTime())/1e3);if(s<45)return"now";let a=Math.round(s/60);if(a<60)return"".concat(a,"m ago");let n=Math.round(a/60);if(n<24)return"".concat(n,"h ago");let o=Math.round(n/24);return o<7?"".concat(o,"d ago"):o<30?"".concat(Math.round(o/7),"w ago"):o<365?"".concat(Math.round(o/30),"mo ago"):"".concat(Math.round(o/365),"y ago")}function r(e,t){return!(e instanceof Date)||isNaN(e.getTime())?"":(0,n.GP)(e,"PPp",t?{locale:t}:void 0)}},85872:(e,t,s)=>{"use strict";async function a(e,t){throw Error((await e.json().catch(()=>({}))).error||"".concat(t," (").concat(e.status,")"))}s.d(t,{$C:()=>n,Ar:()=>i,KG:()=>o});let n={async list(e){var t;let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:a(s,"Failed to load todos")},async listAll(){var e;let t=await fetch("/api/todos");return t.ok?null!=(e=(await t.json()).todos)?e:[]:a(t,"Failed to load todos")},async create(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({content:t})});return s.ok?(await s.json()).todo:a(s,"Failed to create todo")},async update(e,t,s){let n=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return n.ok?(await n.json()).todo:a(n,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/repositories/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await a(s,"Failed to delete todo")}},o=["todo","doing","done"],i={async list(e){var t;let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"));return s.ok?null!=(t=(await s.json()).todos)?t:[]:a(s,"Failed to load todos")},async create(e,t,s){let n=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(void 0!==s?{content:t,detail:s}:{content:t})});return n.ok?(await n.json()).todo:a(n,"Failed to create todo")},async update(e,t,s){let n=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(s)});return n.ok?(await n.json()).todo:a(n,"Failed to update todo")},async remove(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos/").concat(encodeURIComponent(t)),{method:"DELETE"});s.ok||await a(s,"Failed to delete todo")},async reorder(e,t){let s=await fetch("/api/worktrees/".concat(encodeURIComponent(e),"/todos"),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({todoIds:t})});s.ok||await a(s,"Failed to reorder todos")}}}},e=>{e.O(0,[6809,4909,2770,790,4974,9948,6402,744,6488,4560,8441,1255,7358],()=>e(e.s=54799)),_N_E=e.O()}]);
|