@sma1lboy/rove 0.9.276 → 0.9.277-next.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/{chunk-mkfc9a09.js → chunk-0a65j1zj.js} +1 -1
- package/dist/cli/{chunk-xb3p11g0.js → chunk-0rvydb9q.js} +1 -1
- package/dist/cli/chunk-1g6vhgfe.js +14 -0
- package/dist/cli/{chunk-eq7vey2j.js → chunk-1vxtd8rh.js} +2 -2
- package/dist/cli/chunk-1wwqf6kx.js +3 -0
- package/dist/cli/{chunk-1jjqk7sq.js → chunk-2kbzb24j.js} +1 -1
- package/dist/cli/chunk-2kt0mfvf.js +2 -0
- package/dist/cli/{chunk-mz1ffkqb.js → chunk-2vph030z.js} +3 -3
- package/dist/cli/{chunk-nr7e3e82.js → chunk-2y70y8na.js} +1 -1
- package/dist/cli/{chunk-jckx79gk.js → chunk-36eyrv4r.js} +3 -3
- package/dist/cli/chunk-37fas9aj.js +2 -0
- package/dist/cli/chunk-3dhv5n19.js +2 -0
- package/dist/cli/{chunk-zkp6nty3.js → chunk-3x5g06mw.js} +1 -1
- package/dist/cli/{chunk-c6fy8xew.js → chunk-3y0z478f.js} +1 -1
- package/dist/cli/{chunk-91tcwxph.js → chunk-4w4tpsqx.js} +1 -1
- package/dist/cli/chunk-5apxck3d.js +97 -0
- package/dist/cli/chunk-5vrg6h71.js +3 -0
- package/dist/cli/{chunk-k1pwp155.js → chunk-5xpvd182.js} +1 -1
- package/dist/cli/{chunk-8dd60adw.js → chunk-5yh5trgy.js} +1 -1
- package/dist/cli/{chunk-r7ntkd6y.js → chunk-61cn88e7.js} +1 -1
- package/dist/cli/{chunk-e3cd4qd2.js → chunk-671ak750.js} +2 -2
- package/dist/cli/{chunk-82apkcrk.js → chunk-676f3tva.js} +1 -1
- package/dist/cli/chunk-6hcyvg0m.js +3 -0
- package/dist/cli/{chunk-h2gznz46.js → chunk-6mg5zp8y.js} +1 -1
- package/dist/cli/chunk-6q4br0pt.js +2 -0
- package/dist/cli/chunk-6wfhq8xd.js +4 -0
- package/dist/cli/{chunk-3xkhcfet.js → chunk-748656h7.js} +3 -3
- package/dist/cli/{chunk-2kqxz9a4.js → chunk-7bakcyes.js} +1 -1
- package/dist/cli/{chunk-yk9b8zgn.js → chunk-7kgcy89w.js} +1 -1
- package/dist/cli/{chunk-e3t1zbv1.js → chunk-8qkyd589.js} +1 -1
- package/dist/cli/chunk-9ckvdy0j.js +3 -0
- package/dist/cli/{chunk-5e9y8aw5.js → chunk-9fdy8vne.js} +1 -1
- package/dist/cli/chunk-9x2xd1rz.js +2 -0
- package/dist/cli/{chunk-je80r59s.js → chunk-9zswhjkv.js} +1 -1
- package/dist/cli/{chunk-c7mz2aq0.js → chunk-aq4j8ar4.js} +1 -1
- package/dist/cli/{chunk-dt676ks9.js → chunk-aqwckba5.js} +1 -1
- package/dist/cli/chunk-atg13xab.js +3 -0
- package/dist/cli/{chunk-wvqn1t55.js → chunk-bagwgxsg.js} +1 -1
- package/dist/cli/{chunk-syn0tfwy.js → chunk-bcyex84w.js} +1 -1
- package/dist/cli/chunk-bv050ssb.js +8 -0
- package/dist/cli/chunk-bykqhbvy.js +2 -0
- package/dist/cli/{chunk-81thm1eb.js → chunk-ca4x8s96.js} +3 -3
- package/dist/cli/{chunk-syfs63r2.js → chunk-cakyme4s.js} +1 -1
- package/dist/cli/{chunk-63cwjceg.js → chunk-ccmke5sx.js} +1 -1
- package/dist/cli/{chunk-5nvg3ek8.js → chunk-cf3vpsm5.js} +1 -1
- package/dist/cli/{chunk-zat16a83.js → chunk-d552cvb2.js} +1 -1
- package/dist/cli/{chunk-awh7np6x.js → chunk-dsdtq087.js} +1 -1
- package/dist/cli/{chunk-d0hpes59.js → chunk-e58kj4gm.js} +1 -1
- package/dist/cli/chunk-ee314raa.js +2 -0
- package/dist/cli/{chunk-f76gzvq3.js → chunk-fgtc1xq9.js} +1 -1
- package/dist/cli/{chunk-h7vwn62z.js → chunk-fq2pefc5.js} +1 -1
- package/dist/cli/{chunk-4117kgmx.js → chunk-g4p5znv1.js} +1 -1
- package/dist/cli/{chunk-1ca2j9w6.js → chunk-g9xknhjq.js} +1 -1
- package/dist/cli/chunk-gbd5j3dv.js +2 -0
- package/dist/cli/{chunk-4xvmrg86.js → chunk-ggjmcqpt.js} +1 -1
- package/dist/cli/chunk-hv79ys32.js +1 -1
- package/dist/cli/chunk-hz1x3hak.js +3 -0
- package/dist/cli/{chunk-h64rsbrx.js → chunk-hzz020xx.js} +1 -1
- package/dist/cli/{chunk-ma21srvx.js → chunk-j1qy79fd.js} +1 -1
- package/dist/cli/chunk-j9tsdn1d.js +2 -0
- package/dist/cli/chunk-jejmt4k0.js +140 -0
- package/dist/cli/chunk-jj5f4n51.js +1 -1
- package/dist/cli/{chunk-x3n4y5sp.js → chunk-k225696b.js} +1 -1
- package/dist/cli/{chunk-d7xbm9jp.js → chunk-kag7cfbr.js} +1 -1
- package/dist/cli/{chunk-283vd9h7.js → chunk-kdnk8m5j.js} +1 -1
- package/dist/cli/{chunk-xd93fm1k.js → chunk-kxp04jnp.js} +1 -1
- package/dist/cli/chunk-m4z6kepz.js +3 -0
- package/dist/cli/{chunk-372g44dg.js → chunk-mjyhy152.js} +1 -1
- package/dist/cli/chunk-mqvkd2g1.js +2 -0
- package/dist/cli/{chunk-t4qr9sv4.js → chunk-mvtqstte.js} +1 -1
- package/dist/cli/{chunk-m2a19yt4.js → chunk-mxx0y791.js} +1 -1
- package/dist/cli/{chunk-d9643dwf.js → chunk-n2zgej1a.js} +1 -1
- package/dist/cli/{chunk-xn2f56tg.js → chunk-n94vzkbe.js} +1 -1
- package/dist/cli/{chunk-9gh8kgjs.js → chunk-njncqdwf.js} +1 -1
- package/dist/cli/{chunk-t52gzaeb.js → chunk-nw092jak.js} +1 -1
- package/dist/cli/{chunk-gafkp74h.js → chunk-pfagrkt6.js} +1 -1
- package/dist/cli/{chunk-511103e8.js → chunk-pnrftncm.js} +1 -1
- package/dist/cli/{chunk-9c3brkb3.js → chunk-pqr6td4z.js} +1 -1
- package/dist/cli/{chunk-tvdrvgen.js → chunk-qcjkactr.js} +1 -1
- package/dist/cli/{chunk-v1r83m3n.js → chunk-qs359899.js} +1 -1
- package/dist/cli/{chunk-n6marmjn.js → chunk-qzzmd63x.js} +2 -3
- package/dist/cli/{chunk-fn7ffyam.js → chunk-r2bb8b11.js} +1 -1
- package/dist/cli/chunk-rjy900p4.js +4 -0
- package/dist/cli/{chunk-b035pej7.js → chunk-rmsdybs3.js} +1 -1
- package/dist/cli/{chunk-6mtfafaw.js → chunk-rztqccs3.js} +1 -1
- package/dist/cli/chunk-s1308b3d.js +63 -0
- package/dist/cli/{chunk-ne6x6g2c.js → chunk-se00fc8v.js} +1 -1
- package/dist/cli/{chunk-zcrs4sm2.js → chunk-shtm72c0.js} +1 -1
- package/dist/cli/{chunk-gq57he03.js → chunk-t9vjj8sy.js} +1 -1
- package/dist/cli/{chunk-0d7517kk.js → chunk-ta1p2nwa.js} +1 -1
- package/dist/cli/chunk-teh40faw.js +1 -1
- package/dist/cli/{chunk-eyvw70yb.js → chunk-tnatqcy7.js} +1 -1
- package/dist/cli/{chunk-mq88bvj6.js → chunk-tt58819p.js} +1 -1
- package/dist/cli/{chunk-pdq3ya2e.js → chunk-tw9tfs1d.js} +2 -2
- package/dist/cli/chunk-v6dz59gy.js +2 -0
- package/dist/cli/chunk-v6v272b3.js +3 -0
- package/dist/cli/{chunk-hhcmzs67.js → chunk-vkv1v3xn.js} +6 -28
- package/dist/cli/chunk-vkz6kkmm.js +24 -0
- package/dist/cli/chunk-vp29jgbt.js +4 -0
- package/dist/cli/chunk-vpsarakj.js +2 -0
- package/dist/cli/{chunk-745pg3xm.js → chunk-vr2r2ncm.js} +1 -1
- package/dist/cli/{chunk-3y9xzbqh.js → chunk-vvqwgcge.js} +1 -1
- package/dist/cli/{chunk-m73x5nry.js → chunk-vwpf55cr.js} +2 -2
- package/dist/cli/{chunk-vz0f8e8q.js → chunk-vytrhm50.js} +1 -1
- package/dist/cli/{chunk-c63vgbkw.js → chunk-w7v71t7e.js} +1 -1
- package/dist/cli/{chunk-hcvp84b3.js → chunk-wfgrn8p2.js} +1 -1
- package/dist/cli/chunk-wzss4pzh.js +3 -0
- package/dist/cli/chunk-x1ghdmp1.js +1 -1
- package/dist/cli/chunk-x1jxxmtc.js +3 -0
- package/dist/cli/{chunk-d7f022eb.js → chunk-x83xbzjd.js} +3 -3
- package/dist/cli/{chunk-22rgewg0.js → chunk-x85rcep5.js} +1 -1
- package/dist/cli/{chunk-j9b285x6.js → chunk-x89zw7br.js} +1 -1
- package/dist/cli/{chunk-ccwe9n56.js → chunk-xg42e2ff.js} +1 -1
- package/dist/cli/{chunk-jfcn77n9.js → chunk-xte4phd1.js} +1 -1
- package/dist/cli/chunk-y8b2p44q.js +1 -1
- package/dist/cli/chunk-ys6v36ph.js +2 -0
- package/dist/cli/{chunk-n8t4y0bj.js → chunk-yzdrhytj.js} +1 -1
- package/dist/cli/{chunk-qna1s1r4.js → chunk-z3qz6enf.js} +1 -1
- package/dist/cli/chunk-z3wrbtcq.js +22 -0
- package/dist/cli/{chunk-cfzg8q3e.js → chunk-z43e08kw.js} +1 -1
- package/dist/cli/{chunk-ehm9abge.js → chunk-zpwvjt14.js} +7 -5
- package/dist/cli/{chunk-k235z3ct.js → chunk-zrf93zrx.js} +1 -1
- package/dist/cli/index.js +9 -12
- package/dist/cli/pty-host-node.mjs +1 -3
- package/dist/cli/rove-run.js +1 -1
- package/dist/completions/rove.bash +1 -1
- package/dist/completions/rove.fish +1 -1
- package/dist/completions/rove.zsh +1 -1
- package/dist/skills/rove/SKILL.md +4 -3
- package/dist/skills/rove/references/api-flags.md +12 -5
- package/dist/web/assets/index-BVQbpUea.css +1 -0
- package/dist/web/assets/index-BakEtMcK.js +152 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DJqRU3vO.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-500-normal-DmUKJPL_.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-8K4wrrwR.woff +0 -0
- package/dist/web/assets/jetbrains-mono-cyrillic-600-normal-EVf6-Yzo.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-D7SFKleX.woff +0 -0
- package/dist/web/assets/jetbrains-mono-greek-500-normal-JpySY46c.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-H7WoG9Et.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-greek-600-normal-mc2nkWzM.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-BWZEU5yA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-500-normal-CJOVTJB7.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-BfsvjouI.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-600-normal-C8RAYTDA.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-Cut-4mMH.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-500-normal-ckzbgY84.woff +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-BfB_LPfz.woff2 +0 -0
- package/dist/web/assets/jetbrains-mono-latin-ext-600-normal-DObL3zCW.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-500-normal-DNRqzVM1.woff +0 -0
- package/dist/web/assets/jetbrains-mono-vietnamese-600-normal-OWROknRo.woff +0 -0
- package/dist/web/index.html +2 -2
- package/dist/web/relay/index.html +34 -0
- package/dist/web-ui/assets/{harness-pEyVtWV4.js → harness-C7ciHx2w.js} +2 -2
- package/dist/web-ui/assets/{index-Dyg-qcgB.js → index-B1FLht5L.js} +2 -2
- package/dist/web-ui/assets/{index-Bsn8NuKa.css → index-BDIkPexK.css} +1 -1
- package/dist/web-ui/index.html +2 -2
- package/package.json +1 -1
- package/dist/cli/chunk-1eef3z5v.js +0 -3
- package/dist/cli/chunk-1n03wzx4.js +0 -3
- package/dist/cli/chunk-387w0db1.js +0 -2
- package/dist/cli/chunk-4a05fgdh.js +0 -2
- package/dist/cli/chunk-59p3h5e9.js +0 -2
- package/dist/cli/chunk-6xga1a2d.js +0 -3
- package/dist/cli/chunk-84pvn784.js +0 -2
- package/dist/cli/chunk-883fyezq.js +0 -3
- package/dist/cli/chunk-a4r45qdn.js +0 -3
- package/dist/cli/chunk-brgfsm5v.js +0 -2
- package/dist/cli/chunk-bw98jn7g.js +0 -18
- package/dist/cli/chunk-cbrt4s7m.js +0 -3
- package/dist/cli/chunk-d9e4ssy7.js +0 -12
- package/dist/cli/chunk-dgx02565.js +0 -3
- package/dist/cli/chunk-g4dtqbrj.js +0 -2
- package/dist/cli/chunk-gctqthxq.js +0 -97
- package/dist/cli/chunk-hmjg1qh3.js +0 -2
- package/dist/cli/chunk-jn10xeft.js +0 -2
- package/dist/cli/chunk-nbpq1tkx.js +0 -98
- package/dist/cli/chunk-ns35rdyk.js +0 -3
- package/dist/cli/chunk-pap7k3b4.js +0 -3
- package/dist/cli/chunk-r7kmn4js.js +0 -2
- package/dist/cli/chunk-tz373e5w.js +0 -3
- package/dist/cli/chunk-vp171as9.js +0 -65
- package/dist/cli/chunk-vtcr71fs.js +0 -8
- package/dist/cli/chunk-w7v4jzwy.js +0 -3
- package/dist/cli/chunk-xv3217yv.js +0 -2
- package/dist/cli/chunk-yhytkwpv.js +0 -2
- package/dist/web/assets/index-C5t3gibI.css +0 -1
- package/dist/web/assets/index-Djp7M6r8.js +0 -122
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{readOutdatedCache}from"./chunk-c25vea1q.js";import{hookConfigIssues}from"./chunk-
|
|
2
|
+
import{readOutdatedCache}from"./chunk-c25vea1q.js";import{hookConfigIssues}from"./chunk-x89zw7br.js";import{tightenPluginPermissions}from"./chunk-6hcyvg0m.js";import{engineSkillDir,readSkillCopy}from"./chunk-5vrg6h71.js";import{DEFAULT_PREFIX_CONFIGURATION}from"./chunk-x85rcep5.js";import{AUTO_ROUTING_TIERS}from"./chunk-zpwvjt14.js";import{reloadPluginEngines}from"./chunk-kdnk8m5j.js";import{ENGINE_ACTIVITY_KINDS}from"./chunk-17e2tgyg.js";import{currentPluginPlatform,loadPluginRegistry,parsePluginManifest,pluginManifestPath,qualifiedActionId,readPluginManifest,savePluginRegistry,supportsPlatform}from"./chunk-n0rdn2fn.js";import{THEME_MODE_PREFERENCES,ensureContrast,inkAtHue,oklchCusp,relativeLuminance,toOklch}from"./chunk-cf3vpsm5.js";import{expandHome}from"./chunk-tw9tfs1d.js";import{pluginConfigDir,pluginLogPath}from"./chunk-j1z9kgyd.js";import{readFirstNonEmptyRepoFile}from"./chunk-catrr0z3.js";import{activityHookAdapters,engineEntry}from"./chunk-x83xbzjd.js";import{maybeStartScheduledRun,spawnCapture}from"./chunk-2tfnscxk.js";import{recordSpawn}from"./chunk-40dgv828.js";import{readOnlyGitProcessEnv}from"./chunk-6xppe9bj.js";import{tildify}from"./chunk-2r1fgng9.js";import{errorMessage}from"./chunk-2brn8e1y.js";import{loadStateFile}from"./chunk-32j6y5d1.js";import{t}from"./chunk-mjyhy152.js";import{LOCALES}from"./chunk-wzss4pzh.js";import{createStateCell}from"./chunk-cmp64q4j.js";import{ROVE_HOOK_VERSION}from"./chunk-8qkyd589.js";import{rollupPr}from"./chunk-x1jxxmtc.js";import{OWNER_ONLY_DIR_MODE,OWNER_ONLY_FILE_MODE}from"./chunk-yt15y085.js";import{promptAttachmentsDir}from"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import{pathIdentity,pathSyntax}from"./chunk-pn5ygqn6.js";import{readRoveEnv}from"./chunk-nc46gddg.js";var pluginPageErrorState=createStateCell([],"plugin-page-errors");function pluginPageErrors(){return pluginPageErrorState.get()}var WORKING_BORDER_KEY="appearance.workingBorder",WORKING_BORDERS=["flow","still"],DEFAULT_WORKING_BORDER="flow";function normalizeWorkingBorder(raw){return WORKING_BORDERS.includes(raw)?raw:"flow"}var SCROLLBACK_ROWS_KEY="terminal.scrollbackRows",DEFAULT_SCROLLBACK_ROWS=1000,SCROLLBACK_ROWS_MIN=100,SCROLLBACK_ROWS_MAX=1e5;function normalizeScrollbackRows(value){let n=typeof value==="number"?Math.floor(value):typeof value==="string"?Number.parseInt(value.trim(),10):Number.NaN;if(!Number.isFinite(n))return DEFAULT_SCROLLBACK_ROWS;return Math.min(SCROLLBACK_ROWS_MAX,Math.max(SCROLLBACK_ROWS_MIN,n))}function persistedScrollbackRows(){return normalizeScrollbackRows(loadStateFile()[SCROLLBACK_ROWS_KEY])}function relativeBuckets(absMs){let minutes=Math.floor(absMs/60000),hours=Math.floor(minutes/60);return{minutes,hours,days:Math.floor(hours/24)}}function relativeAge(ms,nowMs=Date.now()){let delta=Math.max(0,nowMs-ms),secs=Math.floor(delta/1000);if(secs<60)return`${secs}s`;let{minutes,hours,days}=relativeBuckets(delta);if(minutes<60)return`${minutes}m`;if(hours<24)return`${hours}h`;return`${days}d`}import{randomBytes}from"crypto";import{existsSync,mkdirSync,writeFileSync}from"fs";import{isAbsolute,join}from"path";var ATTACHMENT_EXTENSION_REGEX=/\.(png|jpe?g|gif|webp|pdf)$/i,PDF_EXTENSION_REGEX=/\.pdf$/i;function removeOuterQuotes(text){if(text.startsWith('"')&&text.endsWith('"')||text.startsWith("'")&&text.endsWith("'"))return text.slice(1,-1);return text}function stripBackslashEscapes(path){let placeholder=`__DOUBLE_BACKSLASH_${randomBytes(8).toString("hex")}__`;return path.replace(/\\\\/g,placeholder).replace(/\\(.)/g,"$1").replaceAll(placeholder,"\\")}function asAttachmentPath(text,exists=existsSync){let cleaned=stripBackslashEscapes(removeOuterQuotes(text.trim()));if(!ATTACHMENT_EXTENSION_REGEX.test(cleaned))return null;if(!isAbsolute(cleaned))return null;return exists(cleaned)?cleaned:null}function asAttachmentPaths(pasted,exists=existsSync){let lines=pasted.split(`
|
|
3
3
|
`).map((l)=>l.trim()).filter((l)=>l.length>0);if(lines.length===0)return null;let paths=[];for(let line of lines){let p=asAttachmentPath(line,exists);if(!p)return null;paths.push(p)}return paths}function attachmentLabel(path,index){return PDF_EXTENSION_REGEX.test(path)?`pdf[${index}]`:`images[${index}]`}function appendAttachmentRefs(prompt,attachments){if(attachments.length===0)return prompt;let refs=attachments.map((p,i)=>`${attachmentLabel(p,i)}: ${p}`).join(`
|
|
4
4
|
`);return`${prompt}
|
|
5
5
|
|
|
@@ -7,7 +7,7 @@ ${refs}`}async function capture(cmd){try{let proc=Bun.spawn(cmd,{stdin:"ignore",
|
|
|
7
7
|
`)}function issueProjectPrompt(issue,api){return[...promptHeader(issue),"You are working directly in the project checkout \u2014 no dedicated worktree or branch was created. Keep changes reviewable and do not switch branches unless asked.","Before finishing, verify the acceptance criteria implied by the story and summarize what changed plus any verification still needed.",`When the work lands, run: ${api} issue-update --repo . --id ${issue.id} --status done`].join(`
|
|
8
8
|
`)}function displayProductName(){return ROVE_PRODUCT_NAME.charAt(0).toUpperCase()+ROVE_PRODUCT_NAME.slice(1)}function nextPlaceholderIndex(body){let max=-1;for(let m of body.matchAll(/^(?:images|pdf)\[(\d+)\]:/gm)){let n=Number.parseInt(m[1],10);if(n>max)max=n}return max+1}function withImagePlaceholders(body,paths){let next=body.replace(/\s+$/,""),index=nextPlaceholderIndex(body);for(let path of paths){let line=`${attachmentLabel(path,index)}: ${path}`;next=next.length>0?`${next}
|
|
9
9
|
${line}`:line,index+=1}return next}var ISSUE_CHAT_PLACEMENTS=["worktree","projectWorktree","project"];function issueChatTaskTitle(issue){return`#${issue.id} ${issue.title}`}function issueWorktreePrompt2(issue,api="rove api"){return issueWorktreePrompt(issue,api,displayProductName())}function issueProjectPrompt2(issue,api="rove api"){return issueProjectPrompt(issue,api)}import{spawnSync}from"child_process";import*as fs from"fs";var DEFAULT_BASE_REF="main";function notAGitRepoReason(path){return`This folder isn't a git repository yet, and a task needs a git branch to work in. To fix it, turn ${path} into a repo: git init && git add -A && git commit -m "init" \u2014 then create the task again. (Working in non-git folders is coming soon.)`}function gitMissingReason(){return t("workspace.welcome.gitMissing")}function isBinaryMissing(out){return out.error!==void 0&&out.error.code==="ENOENT"}function git(repo,args){try{recordSpawn("tui.gitSnapshot",["git",...args],repo);let out=spawnSync("git",args,{cwd:repo,encoding:"utf-8",timeout:2000,stdio:["ignore","pipe","ignore"]});return{status:out.status??1,stdout:out.stdout??"",missing:isBinaryMissing(out),spawned:!0}}catch{return{status:1,stdout:"",missing:!1,spawned:!1}}}function noCommitsReason(path){return`This repository has no commits yet, and a task branches off an existing commit. To fix it, make one in ${path}: git add -A && git commit -m "init" \u2014 then create the task again.`}function hasNoCommits(repo){let out=git(repo,["rev-parse","--verify","HEAD"]);return out.spawned&&!out.missing&&out.status!==0}function validateRepoPath(repo){let trimmed=repo.trim();if(!trimmed)return"repo path is required";let stat;try{stat=fs.statSync(trimmed)}catch{return`path does not exist: ${trimmed}`}if(!stat.isDirectory())return`not a directory: ${trimmed}`;let repoCheck=git(trimmed,["rev-parse","--git-dir"]);if(repoCheck.missing)return gitMissingReason();if(repoCheck.status!==0)return notAGitRepoReason(trimmed);if(hasNoCommits(trimmed))return noCommitsReason(trimmed);return null}function getCurrentBranch(repo){if(!repo)return null;let out=git(repo,["rev-parse","--abbrev-ref","HEAD"]);if(out.status!==0)return null;let name=out.stdout.trim();return!name||name==="HEAD"?null:name}function listLocalBranches(repo){if(!repo)return[];let out=git(repo,["for-each-ref","--format=%(refname:short)","refs/heads/"]);if(out.status!==0)return[];return out.stdout.split(`
|
|
10
|
-
`).map((s)=>s.trim()).filter(Boolean).sort((a,b)=>{let score=(n)=>n==="main"?0:n==="master"?1:n==="develop"?2:3,sa=score(a),sb=score(b);if(sa!==sb)return sa-sb;return a.localeCompare(b)})}function truncateEnd(s,max){if(max<=0)return"";let points=[...s];if(points.length<=max)return s;return`${points.slice(0,Math.max(0,max-1)).join("")}\u2026`}function truncateEndCells(s,maxCells,cellsOf){if(maxCells<=0)return"";let total=0;for(let ch of s)total+=cellsOf(ch.codePointAt(0)??0);if(total<=maxCells)return s;let used=0,out="";for(let ch of s){let w=cellsOf(ch.codePointAt(0)??0);if(used+w>maxCells-1)break;used+=w,out+=ch}return`${out}\u2026`}function truncateStart(s,max){if(max<=0)return"";let points=[...s];if(points.length<=max)return s;return`\u2026${points.slice(points.length-Math.max(0,max-1)).join("")}`}function truncateStartCells(s,maxCells,cellsOf){if(maxCells<=0)return"";let points=[...s],total=0;for(let ch of points)total+=cellsOf(ch.codePointAt(0)??0);if(total<=maxCells)return s;let used=0,out="";for(let i=points.length-1;i>=0;i--){let ch=points[i],w=cellsOf(ch.codePointAt(0)??0);if(used+w>maxCells-1)break;used+=w,out=ch+out}return`\u2026${out}`}var EVENT_FEED_LIMIT=12,FRAGMENT_MAX=40;function str(value){return typeof value==="string"?value:""}function detailFragment(event){let detail=event.detail;if(!detail)return"";let{tool,compact,subagent}=detail,fragment=str(tool?.name)||str(compact?.trigger)||str(subagent?.type)||str(detail.note);return truncateEnd(fragment,FRAGMENT_MAX)}function eventRows(events,nowMs,limit=EVENT_FEED_LIMIT){return events.slice(-limit).reverse().map((event,index)=>{let tail=[detailFragment(event),str(event.vendor)].filter((part)=>part.length>0);return{key:`${event.at}:${index}`,age:relativeAge(event.at,nowMs),kind:event.kind,tail:tail.join(" \xB7 ")}})}var PREFIX_TAP_PRESENTATION_KEY="hints.keyboard.prefixTapPresentation",PREFIX_TAP_PRESENTATIONS=["local","guide"],DEFAULT_PREFIX_TAP_PRESENTATION="local";function normalizePrefixTapPresentation(raw){return raw==="guide"?"guide":"local"}var SPLIT_STYLE_KEY="appearance.splitStyle",SPLIT_STYLES=["box","line","rail","rule"];function normalizeSplitStyle(value){return SPLIT_STYLES.includes(value)?value:"line"}var TASK_COLORS_KEY="appearance.taskColors",TASK_COLORS=["on","off"],DEFAULT_TASK_COLORS="on";function normalizeTaskColors(raw){return TASK_COLORS.includes(raw)?raw:"on"}var DARK_HUES=[[0,93],[139,157],[201,359]],LIGHT_HUES=[[195,330]],SEMANTIC_GUARD_DEG=25,GUARD_SLACK_DEG=2,GREY_CHROMA=0.03,GREY_ACCENT_CHROMA_SHARE=0.7,MIN_CHROMA=0.05,MAX_CHROMA=0.21,DARK_MIN_LIGHTNESS=0.65,DARK_MAX_LIGHTNESS=0.88,MIN_CONTRAST=3;function hueDistance(a,b){let d=Math.abs(a-b)%360;return Math.min(d,360-d)}function hueOf(color){if(color.intent!=="rgb")return;let{c,h}=toOklch(color);if(c<GREY_CHROMA)return;return(h*180/Math.PI%360+360)%360}function hash(text){let h=5381;for(let i=0;i<text.length;i++)h=((h<<5)+h^text.charCodeAt(i))>>>0;return h=Math.imul(h^h>>>16,2246822507),h=Math.imul(h^h>>>13,3266489909),(h^h>>>16)>>>0}function taskHue(taskId,arcs,semantic){let all=arcs.flatMap(([from,to])=>Array.from({length:to-from+1},(_,i)=>from+i)),clear=all.filter((h)=>semantic.every((s)=>hueDistance(h,s)>=SEMANTIC_GUARD_DEG+GUARD_SLACK_DEG)),hues=clear.length>0?clear:all;return hues[hash(taskId)%hues.length]??0}function computeTaskColor(taskId,theme){let accent=theme.accent,[r,g,b]=theme.background.toInts(),light=relativeLuminance([r,g,b])>0.5,semantic=[theme.success,theme.warning,theme.error].map(hueOf).filter((h)=>h!==void 0),hue=taskHue(taskId,light?LIGHT_HUES:DARK_HUES,semantic),target=oklchCusp(hue),accentHue=hueOf(accent),lightness=target.l,share=GREY_ACCENT_CHROMA_SHARE;if(accentHue!==void 0){let{l,c}=toOklch(accent),source=oklchCusp(accentHue);lightness=l<=source.l?l/source.l*target.l:target.l+(l-source.l)/(1-source.l)*(1-target.l),share=c/source.c}let chroma=Math.min(MAX_CHROMA,Math.max(MIN_CHROMA,share*target.c));if(!light)lightness=Math.min(DARK_MAX_LIGHTNESS,Math.max(DARK_MIN_LIGHTNESS,lightness));return ensureContrast(inkAtHue(hue,lightness,chroma,accent.toInts()[3]),theme.background,MIN_CONTRAST)}var cache=new Map,CACHE_LIMIT=256;function taskColor(taskId,theme){if(theme.accent.intent!=="rgb")return theme.accent;let key=[taskId,theme.accent,theme.background,theme.success,theme.warning,theme.error].map((part)=>typeof part==="string"?part:part.toInts().join()).join("|"),hit=cache.get(key);if(hit)return hit;let color=computeTaskColor(taskId,theme);if(cache.size>=CACHE_LIMIT)cache.clear();return cache.set(key,color),color}var COLORBLIND_KEY="appearance.colorblind",COLORBLIND_MODES=["off","on"],DEFAULT_COLORBLIND="off";function normalizeColorblind(raw){return COLORBLIND_MODES.includes(raw)?raw:"off"}var GLYPH_SET_KEY="appearance.glyphSet",GLYPH_SET_NAMES=["braille","starburst","ascii"],DEFAULT_GLYPH_SET="braille";function normalizeGlyphSet(raw){return GLYPH_SET_NAMES.includes(raw)?raw:"braille"}var RUNNING_TITLE_KEY="appearance.runningTitle",RUNNING_TITLES=["shimmer","still"],DEFAULT_RUNNING_TITLE="shimmer";function normalizeRunningTitle(raw){return RUNNING_TITLES.includes(raw)?raw:"shimmer"}var APPEARANCE_SETTINGS=["theme","themeMode","transparent","focusAccent","splitStyle","railFold","workingBorder","taskColors","glyphSet","colorblind","runningTitle"];function appearanceChoices(setting,themes){switch(setting){case"theme":return themes.map((value)=>({kind:setting,value}));case"themeMode":return THEME_MODE_PREFERENCES.map((value)=>({kind:setting,value}));case"transparent":return[!1,!0].map((value)=>({kind:setting,value}));case"focusAccent":return["primary","success","info"].map((value)=>({kind:setting,value}));case"splitStyle":return SPLIT_STYLES.map((value)=>({kind:setting,value}));case"railFold":return["glyphs","initials","hairline"].map((value)=>({kind:setting,value}));case"workingBorder":return WORKING_BORDERS.map((value)=>({kind:setting,value}));case"taskColors":return TASK_COLORS.map((value)=>({kind:setting,value}));case"glyphSet":return GLYPH_SET_NAMES.map((value)=>({kind:setting,value}));case"colorblind":return COLORBLIND_MODES.map((value)=>({kind:setting,value}));case"runningTitle":return RUNNING_TITLES.map((value)=>({kind:setting,value}))}}function applyAppearanceChoice(current,choice){switch(choice.kind){case"theme":return{...current,themeName:choice.value};case"themeMode":return{...current,themeMode:choice.value};case"transparent":return{...current,transparentBackground:choice.value};case"focusAccent":return{...current,focusAccent:choice.value};case"splitStyle":return{...current,splitStyle:choice.value};case"railFold":return{...current,railFoldStyle:choice.value};case"workingBorder":return{...current,workingBorder:choice.value};case"taskColors":return{...current,taskColors:choice.value};case"glyphSet":return{...current,glyphSet:choice.value};case"colorblind":return{...current,colorblind:choice.value};case"runningTitle":return{...current,runningTitle:choice.value}}}function currentAppearanceChoice(current,setting){switch(setting){case"theme":return{kind:setting,value:current.themeName};case"themeMode":return{kind:setting,value:current.themeMode};case"transparent":return{kind:setting,value:current.transparentBackground};case"focusAccent":return{kind:setting,value:current.focusAccent};case"splitStyle":return{kind:setting,value:current.splitStyle};case"railFold":return{kind:setting,value:current.railFoldStyle};case"workingBorder":return{kind:setting,value:current.workingBorder};case"taskColors":return{kind:setting,value:current.taskColors};case"glyphSet":return{kind:setting,value:current.glyphSet};case"colorblind":return{kind:setting,value:current.colorblind};case"runningTitle":return{kind:setting,value:current.runningTitle}}}var TAB_STRIP_MODE_KEY="chat.tabStrip.mode",TAB_STRIP_MODES=["always","multipleOnly","never"];var TAB_STRIP_HIDE_SINGLE_KEY="chat.tabStrip.hideSingle";function resolveTabStripMode(stored,legacyHideSingle){if(typeof stored==="string"&&TAB_STRIP_MODES.includes(stored))return stored;if(legacyHideSingle===!0)return"multipleOnly";if(legacyHideSingle===!1)return"always";return"never"}function tabStripVisible(mode,tabCount){if(mode==="never")return!1;if(mode==="multipleOnly")return tabCount>=2;return!0}import{spawn}from"child_process";import{existsSync as existsSync2}from"fs";import{basename,delimiter,isAbsolute as isAbsolute2,join as join2}from"path";var CLI_CANDIDATES=[{id:"code",label:"VS Code",command:"code"},{id:"cursor",label:"Cursor",command:"cursor"},{id:"windsurf",label:"Windsurf",command:"windsurf"},{id:"zed",label:"Zed",command:"zed"}],MAC_APP_CANDIDATES=[{id:"vscode.app",label:"VS Code",appName:"Visual Studio Code",paths:["/Applications/Visual Studio Code.app"]},{id:"cursor.app",label:"Cursor",appName:"Cursor",paths:["/Applications/Cursor.app","/System/Applications/Cursor.app"]},{id:"windsurf.app",label:"Windsurf",appName:"Windsurf",paths:["/Applications/Windsurf.app"]},{id:"zed.app",label:"Zed",appName:"Zed",paths:["/Applications/Zed.app"]}];function executableOnPath(command,env,exists){if(isAbsolute2(command))return exists(command);let pathEnv=env.PATH??"";for(let dir of pathEnv.split(delimiter)){if(!dir)continue;if(exists(join2(dir,command)))return!0}return!1}function labelForOverride(command){let name=basename(command);if(name==="code")return"VS Code";if(name==="cursor")return"Cursor";if(name==="windsurf")return"Windsurf";if(name==="zed")return"Zed";return name||command}function detectWorktreeOpener(deps={}){let env=deps.env??process.env,platform=deps.platform??process.platform,exists=deps.exists??existsSync2,override=readRoveEnv("OPEN_EDITOR",env)?.trim();if(override)return{id:"env",label:labelForOverride(override),command:override,args:[]};for(let c of CLI_CANDIDATES)if(executableOnPath(c.command,env,exists))return{id:c.id,label:c.label,command:c.command,args:[]};if(platform==="darwin"&&executableOnPath("open",env,exists)){for(let app of MAC_APP_CANDIDATES)if(app.paths.some((path)=>exists(path)))return{id:app.id,label:app.label,command:"open",args:["-a",app.appName]};return{id:"mac-open",label:"Finder",command:"open",args:[]}}if(platform==="linux"&&executableOnPath("xdg-open",env,exists))return{id:"xdg-open",label:"Open",command:"xdg-open",args:[]};return null}function buildOpenWorktreeCommand(worktreePath,opener){return[opener.command,[...opener.args,worktreePath]]}function openWorktree(worktreePath,opener,deps={}){if(!worktreePath)return!1;let spawnFn=deps.spawn??spawn,[command,args]=buildOpenWorktreeCommand(worktreePath,opener);try{let child=spawnFn(command,args,{detached:!0,stdio:"ignore"});if(child.pid===void 0)return!1;return child.unref(),!0}catch{return!1}}var changeListeners=new Set;function subscribeBackgroundPolls(listener){return changeListeners.add(listener),()=>{changeListeners.delete(listener)}}function notifyChanged(){for(let listener of changeListeners)try{listener()}catch{}}function createBackgroundPoller(cfg){let entries=new Map,equals=cfg.equals??((a,b)=>a===b);function entryFor(key){let entry=entries.get(key);if(!entry){let current=cfg.initial;entry={read:()=>current,write:(next)=>{if(equals(current,next))return;current=next,notifyChanged()},inFlight:!1,nextAllowedAt:0},entries.set(key,entry)}return entry}return{read(key){if(!key)return cfg.initial;return entryFor(key).read()},poll(key){if(!key)return;let entry=entryFor(key);maybeStartScheduledRun(entry,cfg,(signal)=>cfg.run(key,signal),(value)=>entry.write(value))},reset(){entries.clear()}}}var GIT_TIMEOUT_MS=5000,DEFAULT_PR_PROMPT_TEMPLATE=`The user likes the current state of the code.
|
|
10
|
+
`).map((s)=>s.trim()).filter(Boolean).sort((a,b)=>{let score=(n)=>n==="main"?0:n==="master"?1:n==="develop"?2:3,sa=score(a),sb=score(b);if(sa!==sb)return sa-sb;return a.localeCompare(b)})}function truncateEnd(s,max){if(max<=0)return"";let points=[...s];if(points.length<=max)return s;return`${points.slice(0,Math.max(0,max-1)).join("")}\u2026`}function truncateEndCells(s,maxCells,cellsOf){if(maxCells<=0)return"";let total=0;for(let ch of s)total+=cellsOf(ch.codePointAt(0)??0);if(total<=maxCells)return s;let used=0,out="";for(let ch of s){let w=cellsOf(ch.codePointAt(0)??0);if(used+w>maxCells-1)break;used+=w,out+=ch}return`${out}\u2026`}function truncateStart(s,max){if(max<=0)return"";let points=[...s];if(points.length<=max)return s;return`\u2026${points.slice(points.length-Math.max(0,max-1)).join("")}`}function truncateStartCells(s,maxCells,cellsOf){if(maxCells<=0)return"";let points=[...s],total=0;for(let ch of points)total+=cellsOf(ch.codePointAt(0)??0);if(total<=maxCells)return s;let used=0,out="";for(let i=points.length-1;i>=0;i--){let ch=points[i],w=cellsOf(ch.codePointAt(0)??0);if(used+w>maxCells-1)break;used+=w,out=ch+out}return`\u2026${out}`}function reconcileStableRows(prev,next,keyOf,equals,opts={}){if(prev.length===0)return next;let prevByKey=new Map;for(let row of prev)prevByKey.set(keyOf(row),row);let allReused=prev.length===next.length,out=Array(next.length);for(let i=0;i<next.length;i++){let fresh=next[i],old=prevByKey.get(keyOf(fresh));if(old&&equals(old,fresh)&&(!opts.samePosition||prev[i]===old)){if(out[i]=old,allReused&&prev[i]!==old)allReused=!1}else out[i]=fresh,allReused=!1}return allReused?prev:out}function fuzzyMatch(query,haystack){if(!query)return!0;let q=query.toLowerCase(),h=haystack.toLowerCase(),qi=0;for(let hi=0;hi<h.length&&qi<q.length;hi++)if(h.charCodeAt(hi)===q.charCodeAt(qi))qi++;return qi===q.length}function compareNewest(a,b){let byTime=Date.parse(b.createdAt)-Date.parse(a.createdAt);if(Number.isFinite(byTime)&&byTime!==0)return byTime;return String(b.id).localeCompare(String(a.id))}function compareRecent(a,b){let byTime=taskTime(b)-taskTime(a);if(byTime!==0)return byTime;return String(b.id).localeCompare(String(a.id))}var nameCollator=new Intl.Collator(void 0,{numeric:!0,sensitivity:"base"});function compareName(a,b){let byName=nameCollator.compare(a.title.trim(),b.title.trim());if(byName!==0)return byName;return String(a.id).localeCompare(String(b.id))}function taskTime(task){let parsed=Date.parse(task.updatedAt||task.createdAt);return Number.isFinite(parsed)?parsed:0}function repoBasename(repo){return pathSyntax(repo).basename(repo)||repo}function sidebarProjectKey(repo,machineId="local"){let path=pathIdentity(repo.trim())||repo;return machineId==="local"?path:`${machineId}\x00${path}`}function sidebarProjectKeyOfTask(task){return sidebarProjectKey(task.repo,task.origin?.machineId??"local")}function isLocalTask(task){return(task.origin?.machineId??"local")==="local"}function isNoProjectTask(task){return task.kind==="dir"&&(task.scratch===!0||task.noProject===!0)}function sidebarProjectKeyResolver(tasks){let counted=tasks.filter((task)=>{let phase=task.deletion?.phase;if(phase==="queued"||phase==="running")return!1;return!isNoProjectTask(task)}),repoIdOf=new Map;for(let task of counted){if(!task.repoId)continue;let key=sidebarProjectKeyOfTask(task);if(!repoIdOf.has(key))repoIdOf.set(key,task.repoId)}if(repoIdOf.size===0)return sidebarProjectKeyOfTask;let home=new Map;for(let task of counted){let key=sidebarProjectKeyOfTask(task),id=repoIdOf.get(key);if(!id)continue;let rank=(isLocalTask(task)?0:2)+(task.kind==="main"?0:1),current=home.get(id);if(!current||rank<current.rank)home.set(id,{key,rank})}return(task)=>{let key=sidebarProjectKeyOfTask(task),id=repoIdOf.get(key);return id&&home.get(id)?.key||key}}function repoIdTail(id){return id.startsWith("root:")?null:id.split("/").slice(-2).join("/")}function sidebarRepoLabel(project,all){let base=repoBasename(project.repo),others=all.filter((other)=>other!==project&&repoBasename(other.repo)===base);if(others.length===0)return base;let id=project.repoId,tail=id?repoIdTail(id):null;if(id&&tail)return others.some((other)=>other.repoId&&other.repoId!==id&&repoIdTail(other.repoId)===tail)?id:tail;return sidebarProjectLabel(project.repo,others.map((other)=>other.repo))}function sidebarProjectLabel(repo,repos,hostLabel){let base=repoBasename(repo),host=hostLabel??"",collisions=repos.map((entry)=>typeof entry==="string"?{repo:entry}:entry).filter((entry)=>entry.repo!==repo||(entry.hostLabel??"")!==host).filter((entry)=>repoBasename(entry.repo)===base);if(collisions.length===0)return base;if(collisions.some((entry)=>(entry.hostLabel??"")===host)){let tail=pathTail(repo);return collisions.some((entry)=>(entry.hostLabel??"")!==host&&pathTail(entry.repo)===tail)&&host?`${host}:${tail}`:tail}return host?`${host}:${base}`:base}function pathTail(repo){let syntax=pathSyntax(repo);return syntax.normalize(repo).split(syntax.sep).filter(Boolean).slice(-2).join("/")}var EVENT_FEED_LIMIT=12,FRAGMENT_MAX=40;function str(value){return typeof value==="string"?value:""}function detailFragment(event){let detail=event.detail;if(!detail)return"";let{tool,compact,subagent}=detail,fragment=str(tool?.name)||str(compact?.trigger)||str(subagent?.type)||str(detail.note);return truncateEnd(fragment,FRAGMENT_MAX)}function eventRows(events,nowMs,limit=EVENT_FEED_LIMIT){return events.slice(-limit).reverse().map((event,index)=>{let tail=[detailFragment(event),str(event.vendor)].filter((part)=>part.length>0);return{key:`${event.at}:${index}`,age:relativeAge(event.at,nowMs),kind:event.kind,tail:tail.join(" \xB7 ")}})}var PREFIX_TAP_PRESENTATION_KEY="hints.keyboard.prefixTapPresentation",PREFIX_TAP_PRESENTATIONS=["local","guide"],DEFAULT_PREFIX_TAP_PRESENTATION="local";function normalizePrefixTapPresentation(raw){return raw==="guide"?"guide":"local"}var SPLIT_STYLE_KEY="appearance.splitStyle",SPLIT_STYLES=["box","line","rail","rule"];function normalizeSplitStyle(value){return SPLIT_STYLES.includes(value)?value:"line"}var TASK_COLORS_KEY="appearance.taskColors",TASK_COLORS=["on","off"],DEFAULT_TASK_COLORS="on";function normalizeTaskColors(raw){return TASK_COLORS.includes(raw)?raw:"on"}var DARK_HUES=[[0,93],[139,157],[201,359]],LIGHT_HUES=[[195,330]],SEMANTIC_GUARD_DEG=25,GUARD_SLACK_DEG=2,GREY_CHROMA=0.03,GREY_ACCENT_CHROMA_SHARE=0.7,MIN_CHROMA=0.05,MAX_CHROMA=0.21,DARK_MIN_LIGHTNESS=0.65,DARK_MAX_LIGHTNESS=0.88,MIN_CONTRAST=3;function hueDistance(a,b){let d=Math.abs(a-b)%360;return Math.min(d,360-d)}function hueOf(color){if(color.intent!=="rgb")return;let{c,h}=toOklch(color);if(c<GREY_CHROMA)return;return(h*180/Math.PI%360+360)%360}function hash(text){let h=5381;for(let i=0;i<text.length;i++)h=((h<<5)+h^text.charCodeAt(i))>>>0;return h=Math.imul(h^h>>>16,2246822507),h=Math.imul(h^h>>>13,3266489909),(h^h>>>16)>>>0}function taskHue(taskId,arcs,semantic){let all=arcs.flatMap(([from,to])=>Array.from({length:to-from+1},(_,i)=>from+i)),clear=all.filter((h)=>semantic.every((s)=>hueDistance(h,s)>=SEMANTIC_GUARD_DEG+GUARD_SLACK_DEG)),hues=clear.length>0?clear:all;return hues[hash(taskId)%hues.length]??0}function computeTaskColor(taskId,theme){let accent=theme.accent,[r,g,b]=theme.background.toInts(),light=relativeLuminance([r,g,b])>0.5,semantic=[theme.success,theme.warning,theme.error].map(hueOf).filter((h)=>h!==void 0),hue=taskHue(taskId,light?LIGHT_HUES:DARK_HUES,semantic),target=oklchCusp(hue),accentHue=hueOf(accent),lightness=target.l,share=GREY_ACCENT_CHROMA_SHARE;if(accentHue!==void 0){let{l,c}=toOklch(accent),source=oklchCusp(accentHue);lightness=l<=source.l?l/source.l*target.l:target.l+(l-source.l)/(1-source.l)*(1-target.l),share=c/source.c}let chroma=Math.min(MAX_CHROMA,Math.max(MIN_CHROMA,share*target.c));if(!light)lightness=Math.min(DARK_MAX_LIGHTNESS,Math.max(DARK_MIN_LIGHTNESS,lightness));return ensureContrast(inkAtHue(hue,lightness,chroma,accent.toInts()[3]),theme.background,MIN_CONTRAST)}var cache=new Map,CACHE_LIMIT=256;function taskColor(taskId,theme){if(theme.accent.intent!=="rgb")return theme.accent;let key=[taskId,theme.accent,theme.background,theme.success,theme.warning,theme.error].map((part)=>typeof part==="string"?part:part.toInts().join()).join("|"),hit=cache.get(key);if(hit)return hit;let color=computeTaskColor(taskId,theme);if(cache.size>=CACHE_LIMIT)cache.clear();return cache.set(key,color),color}var COLORBLIND_KEY="appearance.colorblind",COLORBLIND_MODES=["off","on"],DEFAULT_COLORBLIND="off";function normalizeColorblind(raw){return COLORBLIND_MODES.includes(raw)?raw:"off"}var GLYPH_SET_KEY="appearance.glyphSet",GLYPH_SET_NAMES=["braille","starburst","ascii"],DEFAULT_GLYPH_SET="braille";function normalizeGlyphSet(raw){return GLYPH_SET_NAMES.includes(raw)?raw:"braille"}var RUNNING_TITLE_KEY="appearance.runningTitle",RUNNING_TITLES=["shimmer","still"],DEFAULT_RUNNING_TITLE="shimmer";function normalizeRunningTitle(raw){return RUNNING_TITLES.includes(raw)?raw:"shimmer"}var APPEARANCE_SETTINGS=["theme","themeMode","transparent","focusAccent","splitStyle","railFold","workingBorder","taskColors","glyphSet","colorblind","runningTitle"];function appearanceChoices(setting,themes){switch(setting){case"theme":return themes.map((value)=>({kind:setting,value}));case"themeMode":return THEME_MODE_PREFERENCES.map((value)=>({kind:setting,value}));case"transparent":return[!1,!0].map((value)=>({kind:setting,value}));case"focusAccent":return["primary","success","info"].map((value)=>({kind:setting,value}));case"splitStyle":return SPLIT_STYLES.map((value)=>({kind:setting,value}));case"railFold":return["glyphs","initials","hairline"].map((value)=>({kind:setting,value}));case"workingBorder":return WORKING_BORDERS.map((value)=>({kind:setting,value}));case"taskColors":return TASK_COLORS.map((value)=>({kind:setting,value}));case"glyphSet":return GLYPH_SET_NAMES.map((value)=>({kind:setting,value}));case"colorblind":return COLORBLIND_MODES.map((value)=>({kind:setting,value}));case"runningTitle":return RUNNING_TITLES.map((value)=>({kind:setting,value}))}}function applyAppearanceChoice(current,choice){switch(choice.kind){case"theme":return{...current,themeName:choice.value};case"themeMode":return{...current,themeMode:choice.value};case"transparent":return{...current,transparentBackground:choice.value};case"focusAccent":return{...current,focusAccent:choice.value};case"splitStyle":return{...current,splitStyle:choice.value};case"railFold":return{...current,railFoldStyle:choice.value};case"workingBorder":return{...current,workingBorder:choice.value};case"taskColors":return{...current,taskColors:choice.value};case"glyphSet":return{...current,glyphSet:choice.value};case"colorblind":return{...current,colorblind:choice.value};case"runningTitle":return{...current,runningTitle:choice.value}}}function currentAppearanceChoice(current,setting){switch(setting){case"theme":return{kind:setting,value:current.themeName};case"themeMode":return{kind:setting,value:current.themeMode};case"transparent":return{kind:setting,value:current.transparentBackground};case"focusAccent":return{kind:setting,value:current.focusAccent};case"splitStyle":return{kind:setting,value:current.splitStyle};case"railFold":return{kind:setting,value:current.railFoldStyle};case"workingBorder":return{kind:setting,value:current.workingBorder};case"taskColors":return{kind:setting,value:current.taskColors};case"glyphSet":return{kind:setting,value:current.glyphSet};case"colorblind":return{kind:setting,value:current.colorblind};case"runningTitle":return{kind:setting,value:current.runningTitle}}}var TAB_STRIP_MODE_KEY="chat.tabStrip.mode",TAB_STRIP_MODES=["always","multipleOnly","never"];var TAB_STRIP_HIDE_SINGLE_KEY="chat.tabStrip.hideSingle";function resolveTabStripMode(stored,legacyHideSingle){if(typeof stored==="string"&&TAB_STRIP_MODES.includes(stored))return stored;if(legacyHideSingle===!0)return"multipleOnly";if(legacyHideSingle===!1)return"always";return"never"}function tabStripVisible(mode,tabCount){if(mode==="never")return!1;if(mode==="multipleOnly")return tabCount>=2;return!0}import{spawn}from"child_process";import{existsSync as existsSync2}from"fs";import{basename,delimiter,isAbsolute as isAbsolute2,join as join2}from"path";var CLI_CANDIDATES=[{id:"code",label:"VS Code",command:"code"},{id:"cursor",label:"Cursor",command:"cursor"},{id:"windsurf",label:"Windsurf",command:"windsurf"},{id:"zed",label:"Zed",command:"zed"}],MAC_APP_CANDIDATES=[{id:"vscode.app",label:"VS Code",appName:"Visual Studio Code",paths:["/Applications/Visual Studio Code.app"]},{id:"cursor.app",label:"Cursor",appName:"Cursor",paths:["/Applications/Cursor.app","/System/Applications/Cursor.app"]},{id:"windsurf.app",label:"Windsurf",appName:"Windsurf",paths:["/Applications/Windsurf.app"]},{id:"zed.app",label:"Zed",appName:"Zed",paths:["/Applications/Zed.app"]}];function executableOnPath(command,env,exists){if(isAbsolute2(command))return exists(command);let pathEnv=env.PATH??"";for(let dir of pathEnv.split(delimiter)){if(!dir)continue;if(exists(join2(dir,command)))return!0}return!1}function labelForOverride(command){let name=basename(command);if(name==="code")return"VS Code";if(name==="cursor")return"Cursor";if(name==="windsurf")return"Windsurf";if(name==="zed")return"Zed";return name||command}function detectWorktreeOpener(deps={}){let env=deps.env??process.env,platform=deps.platform??process.platform,exists=deps.exists??existsSync2,override=readRoveEnv("OPEN_EDITOR",env)?.trim();if(override)return{id:"env",label:labelForOverride(override),command:override,args:[]};for(let c of CLI_CANDIDATES)if(executableOnPath(c.command,env,exists))return{id:c.id,label:c.label,command:c.command,args:[]};if(platform==="darwin"&&executableOnPath("open",env,exists)){for(let app of MAC_APP_CANDIDATES)if(app.paths.some((path)=>exists(path)))return{id:app.id,label:app.label,command:"open",args:["-a",app.appName]};return{id:"mac-open",label:"Finder",command:"open",args:[]}}if(platform==="linux"&&executableOnPath("xdg-open",env,exists))return{id:"xdg-open",label:"Open",command:"xdg-open",args:[]};return null}function buildOpenWorktreeCommand(worktreePath,opener){return[opener.command,[...opener.args,worktreePath]]}function openWorktree(worktreePath,opener,deps={}){if(!worktreePath)return!1;let spawnFn=deps.spawn??spawn,[command,args]=buildOpenWorktreeCommand(worktreePath,opener);try{let child=spawnFn(command,args,{detached:!0,stdio:"ignore"});if(child.pid===void 0)return!1;return child.unref(),!0}catch{return!1}}var changeListeners=new Set;function subscribeBackgroundPolls(listener){return changeListeners.add(listener),()=>{changeListeners.delete(listener)}}function notifyChanged(){for(let listener of changeListeners)try{listener()}catch{}}function createBackgroundPoller(cfg){let entries=new Map,equals=cfg.equals??((a,b)=>a===b);function entryFor(key){let entry=entries.get(key);if(!entry){let current=cfg.initial;entry={read:()=>current,write:(next)=>{if(equals(current,next))return;current=next,notifyChanged()},inFlight:!1,nextAllowedAt:0},entries.set(key,entry)}return entry}return{read(key){if(!key)return cfg.initial;return entryFor(key).read()},poll(key){if(!key)return;let entry=entryFor(key);maybeStartScheduledRun(entry,cfg,(signal)=>cfg.run(key,signal),(value)=>entry.write(value))},reset(){entries.clear()}}}var GIT_TIMEOUT_MS=5000,DEFAULT_PR_PROMPT_TEMPLATE=`The user likes the current state of the code.
|
|
11
11
|
|
|
12
12
|
{{dirtyCountSentence}}
|
|
13
13
|
The current branch is {{branch}}.
|
|
@@ -43,36 +43,14 @@ If any of these steps fail, ask the user for help.`;async function git2(cwd,args
|
|
|
43
43
|
# darwin: # platform overlay (also: linux)
|
|
44
44
|
# bindings:
|
|
45
45
|
# palette.open: [cmd+p, ctrl+p]
|
|
46
|
-
`;function createKeybindingsFile(path){if(existsSync4(path))return!1;return mkdirSync2(dirname(path),{recursive:!0}),writeFileSync2(path,KEYBINDINGS_STARTER),!0}function chipOf(pr,glyphs){if(!pr)return null;let stale=pr.lastError!==void 0;if((pr.mergeable??"").toUpperCase()==="CONFLICTING")return{glyph:glyphs.conflict,tone:stale?"textMuted":"error"};if(pr.checkState==="failing")return{glyph:glyphs.checksFailing,tone:stale?"textMuted":"error"};if(pr.checkState==="passing")return{glyph:glyphs.checksPassing,tone:stale?"textMuted":"success"};return null}function prChip(task,glyphs=DEFAULT_GLYPHS){return chipOf(rollupPr(task),glyphs)}function sidebarPrChip(task,glyphs=DEFAULT_GLYPHS){let attached=(task.sessionPrs??[]).flatMap((entry)=>entry.status?[{prStatus:entry.status}]:[]);return chipOf(rollupPr({prStatus:task.prStatus,extraRepos:[...task.extraRepos??[],...attached]}),glyphs)}import{spawn as spawn4}from"child_process";import*as fs2 from"fs";import*as path from"path";function deriveFolderName(url){let trimmed=url.trim().replace(/\/+$/,"");if(!trimmed)return"";let lastSlash=trimmed.lastIndexOf("/"),lastColon=trimmed.lastIndexOf(":"),cutAt=Math.max(lastSlash,lastColon);return(cutAt>=0?trimmed.slice(cutAt+1):trimmed).replace(/\.git$/i,"")}function validateGitUrl(url){let trimmed=url.trim();if(!trimmed)return t("newTask.error.gitUrlRequired");let hasProtocol=trimmed.includes("://"),hasScpSep=trimmed.includes("@")&&trimmed.includes(":"),hasPathSep=trimmed.includes("/");if(!hasProtocol&&!hasScpSep&&!hasPathSep)return t("newTask.error.gitUrlInvalid",{url:trimmed});return null}function validateCloneTarget(parentDir,folder){let folderTrimmed=folder.trim();if(!folderTrimmed)return t("newTask.error.folderRequired");if(folderTrimmed.includes("/")||folderTrimmed.includes("\\"))return t("newTask.error.folderHasSeparator");let parentTrimmed=parentDir.trim();if(!parentTrimmed)return t("newTask.error.parentRequired");let parentExpanded=expandHome(parentTrimmed),parentStat;try{parentStat=fs2.statSync(parentExpanded)}catch{return t("newTask.error.parentNotFound",{path:parentExpanded})}if(!parentStat.isDirectory())return t("newTask.error.parentNotDir",{path:parentExpanded});let target=path.join(parentExpanded,folderTrimmed);if(fs2.existsSync(target))return t("newTask.error.targetExists",{path:target});return null}function resolveCloneTarget(parentDir,folder){return path.join(expandHome(parentDir.trim()),folder.trim())}function findAvailableFolderName(parentDir,base){let trimmed=base.trim();if(!trimmed)return base;let parentExpanded=expandHome(parentDir.trim());if(!parentExpanded)return base;try{if(!fs2.statSync(parentExpanded).isDirectory())return base}catch{return base}if(!fs2.existsSync(path.join(parentExpanded,trimmed)))return trimmed;for(let n=2;n<1000;n++){let candidate=`${trimmed}-${n}`;if(!fs2.existsSync(path.join(parentExpanded,candidate)))return candidate}return trimmed}function cloneRepo(url,target,onProgress){return new Promise((resolve)=>{let stderrBuf="";try{let child=spawn4("git",["clone","--progress",url,target],{stdio:["ignore","ignore","pipe"],env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:""}});child.stderr?.setEncoding("utf-8"),child.stderr?.on("data",(chunk)=>{if(stderrBuf+=chunk,onProgress){let lines=chunk.split(/[\r\n]+/).filter((s)=>s.trim().length>0),last=lines[lines.length-1];if(last)onProgress(last)}}),child.on("error",(err)=>{resolve({ok:!1,error:err.message})}),child.on("close",(code)=>{if(code===0){resolve({ok:!0,path:target});return}let tail=stderrBuf.split(/[\r\n]+/).filter((s)=>s.trim().length>0).pop()??`git clone exited with ${code}`;resolve({ok:!1,error:tail})})}catch(err){resolve({ok:!1,error:errorMessage(err)})}})}import{randomUUID}from"crypto";import{existsSync as existsSync6}from"fs";import{join as join4}from"path";function formatDiffComment(c,stale=!1){let escaped=c.body.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\r/g,"\\r").replace(/\n/g,"\\n"),location=c.startLine!==void 0&&c.startLine!==c.line?`Lines: ${c.startLine}-${c.line}`:`Line: ${c.line}`,staleNote=stale?["Note: this path is no longer in the branch \u2014 it was renamed or deleted after the note was written."]:[];return[`File: ${c.filePath}`,location,...staleNote,`User comment: "${escaped}"`].join(`
|
|
46
|
+
`;function createKeybindingsFile(path){if(existsSync4(path))return!1;return mkdirSync2(dirname(path),{recursive:!0}),writeFileSync2(path,KEYBINDINGS_STARTER),!0}import{homedir}from"os";var PATH_LABEL_MAX=24;function rowLiveBranchPath(task){if(task.kind!=="main"&&task.kind!=="dir")return"";return task.worktreePath||task.repo||""}function conversationTitleOf(task,tabsByTask){let alias=task.ptyAlias,tabs=tabsByTask.get(alias?.taskId??task.id);if(!tabs)return;if(alias)return tabs.find((tab)=>tab.id===alias.tabId)?.title;return tabs.find((tab)=>tab.engine===!0&&tab.title!==void 0)?.title}var AUTO_DIR_TITLE=/^\S+-[0-9a-z]{4}$/;function worktreeRowLabel(task,opts={}){let live=opts.liveTitle?.trim();if(live)return live;let title=task.title.trim(),renamedMain=task.kind==="main"&&title!==""&&title!==repoBasename(task.repo),namedDir=task.kind==="dir"&&title!==repoBasename(task.repo)&&!AUTO_DIR_TITLE.test(title);if(title&&(task.parentTaskId!==void 0||task.kind==="task"||renamedMain||namedDir))return title;let branch=(opts.liveBranch??task.branch)||task.branch;if(branch)return branch;if(task.kind!=="dir"&&task.title)return task.title;let path=task.worktreePath||task.repo;if(path){let home=opts.home??homedir(),tildified=tildify(path,home);return truncateStart(tildified,PATH_LABEL_MAX)}return task.title||"scratch"}function chipOf(pr,glyphs){if(!pr)return null;let stale=pr.lastError!==void 0;if((pr.mergeable??"").toUpperCase()==="CONFLICTING")return{glyph:glyphs.conflict,tone:stale?"textMuted":"error"};if(pr.checkState==="failing")return{glyph:glyphs.checksFailing,tone:stale?"textMuted":"error"};if(pr.checkState==="passing")return{glyph:glyphs.checksPassing,tone:stale?"textMuted":"success"};return null}function prChip(task,glyphs=DEFAULT_GLYPHS){return chipOf(rollupPr(task),glyphs)}function sidebarPrChip(task,glyphs=DEFAULT_GLYPHS){let attached=(task.sessionPrs??[]).flatMap((entry)=>entry.status?[{prStatus:entry.status}]:[]);return chipOf(rollupPr({prStatus:task.prStatus,extraRepos:[...task.extraRepos??[],...attached]}),glyphs)}import{spawn as spawn4}from"child_process";import*as fs2 from"fs";import*as path from"path";function deriveFolderName(url){let trimmed=url.trim().replace(/\/+$/,"");if(!trimmed)return"";let lastSlash=trimmed.lastIndexOf("/"),lastColon=trimmed.lastIndexOf(":"),cutAt=Math.max(lastSlash,lastColon);return(cutAt>=0?trimmed.slice(cutAt+1):trimmed).replace(/\.git$/i,"")}function validateGitUrl(url){let trimmed=url.trim();if(!trimmed)return t("newTask.error.gitUrlRequired");let hasProtocol=trimmed.includes("://"),hasScpSep=trimmed.includes("@")&&trimmed.includes(":"),hasPathSep=trimmed.includes("/");if(!hasProtocol&&!hasScpSep&&!hasPathSep)return t("newTask.error.gitUrlInvalid",{url:trimmed});return null}function validateCloneTarget(parentDir,folder){let folderTrimmed=folder.trim();if(!folderTrimmed)return t("newTask.error.folderRequired");if(folderTrimmed.includes("/")||folderTrimmed.includes("\\"))return t("newTask.error.folderHasSeparator");let parentTrimmed=parentDir.trim();if(!parentTrimmed)return t("newTask.error.parentRequired");let parentExpanded=expandHome(parentTrimmed),parentStat;try{parentStat=fs2.statSync(parentExpanded)}catch{return t("newTask.error.parentNotFound",{path:parentExpanded})}if(!parentStat.isDirectory())return t("newTask.error.parentNotDir",{path:parentExpanded});let target=path.join(parentExpanded,folderTrimmed);if(fs2.existsSync(target))return t("newTask.error.targetExists",{path:target});return null}function resolveCloneTarget(parentDir,folder){return path.join(expandHome(parentDir.trim()),folder.trim())}function findAvailableFolderName(parentDir,base){let trimmed=base.trim();if(!trimmed)return base;let parentExpanded=expandHome(parentDir.trim());if(!parentExpanded)return base;try{if(!fs2.statSync(parentExpanded).isDirectory())return base}catch{return base}if(!fs2.existsSync(path.join(parentExpanded,trimmed)))return trimmed;for(let n=2;n<1000;n++){let candidate=`${trimmed}-${n}`;if(!fs2.existsSync(path.join(parentExpanded,candidate)))return candidate}return trimmed}function cloneRepo(url,target,onProgress){return new Promise((resolve)=>{let stderrBuf="";try{let child=spawn4("git",["clone","--progress",url,target],{stdio:["ignore","ignore","pipe"],env:{...process.env,GIT_TERMINAL_PROMPT:"0",GIT_ASKPASS:""}});child.stderr?.setEncoding("utf-8"),child.stderr?.on("data",(chunk)=>{if(stderrBuf+=chunk,onProgress){let lines=chunk.split(/[\r\n]+/).filter((s)=>s.trim().length>0),last=lines[lines.length-1];if(last)onProgress(last)}}),child.on("error",(err)=>{resolve({ok:!1,error:err.message})}),child.on("close",(code)=>{if(code===0){resolve({ok:!0,path:target});return}let tail=stderrBuf.split(/[\r\n]+/).filter((s)=>s.trim().length>0).pop()??`git clone exited with ${code}`;resolve({ok:!1,error:tail})})}catch(err){resolve({ok:!1,error:errorMessage(err)})}})}import{randomUUID}from"crypto";import{existsSync as existsSync6}from"fs";import{join as join4}from"path";function fenceFor(text){let longest=Math.max(0,...(text.match(/`+/g)??[]).map((run)=>run.length));return"`".repeat(Math.max(3,longest+1))}function formatDiffComment(c,stale=!1){let escaped=c.body.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\r/g,"\\r").replace(/\n/g,"\\n"),location=c.startLine!==void 0&&c.startLine!==c.line?`Lines: ${c.startLine}-${c.line}`:`Line: ${c.line}`,staleNote=stale?["Note: this path is no longer in the branch \u2014 it was renamed or deleted after the note was written."]:[],fence=c.code?fenceFor(c.code):"",quoted=c.code?["Code:",`${fence}diff`,c.code,fence]:[];return[`File: ${c.filePath}`,location,...staleNote,...quoted,`User comment: "${escaped}"`].join(`
|
|
47
47
|
`)}function formatDiffComments(comments,worktreePath){return comments.map((c)=>formatDiffComment(c,worktreePath?!existsSync6(join4(worktreePath,c.filePath)):!1)).join(`
|
|
48
48
|
|
|
49
49
|
`)}function unsentComments(comments){return comments.filter((c)=>c.sentAt===void 0)}function markAllSent(comments,now){return comments.map((c)=>c.sentAt===void 0?{...c,sentAt:now}:c)}var HUNK_HEADER=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/;function unifiedDiffRows(diff){let rows=[],oldLine=0,newLine=0,inHunk=!1;for(let line of diff.split(`
|
|
50
|
-
`)){let m=HUNK_HEADER.exec(line);if(m){oldLine=Number(m[1]),newLine=Number(m[2]),inHunk=!0;continue}if(!inHunk)continue;let c=line[0];if(c==="+")rows.push({kind:"add",line:newLine++});else if(c==="-")rows.push({kind:"del",line:oldLine++});else if(c===" ")rows.push({kind:"ctx",line:newLine}),oldLine++,newLine++;else if(c!=="\\")inHunk=!1}return rows}function commentRange(rows,cursor,anchor){let cursorRow=rows[cursor];if(!cursorRow)return null;if(anchor==null||anchor===cursor)return{line:cursorRow.line};let first=rows[Math.min(anchor,cursor)],last=rows[Math.max(anchor,cursor)];if(!first||!last||first.line>=last.line)return{line:cursorRow.line};return{line:last.line,startLine:first.line}}function computeReviewPaint(rows,cursor,anchor,comments,filePath){let paint=new Map,unsent=unsentComments(comments).filter((c)=>c.filePath===filePath);if(unsent.length>0)rows.forEach((row,i)=>{if(unsent.some((c)=>(c.startLine??c.line)<=row.line&&row.line<=c.line))paint.set(i,"note")});if(anchor!=null){let lo=Math.min(anchor,cursor),hi=Math.max(anchor,cursor);for(let i=lo;i<=hi;i++)paint.set(i,"range")}return paint.set(cursor,"cursor"),paint}function commentAtRow(rows,cursor,comments,filePath){let row=rows[cursor];if(!row)return;for(let i=comments.length-1;i>=0;i-=1){let c=comments[i];if(c&&c.filePath===filePath&&(c.startLine??c.line)<=row.line&&row.line<=c.line)return c}return}function diffCommentsKey(taskId){return`diffComments.${taskId}`}function buildDiffReview(kv,taskId,sendToEngine){let key=diffCommentsKey(taskId),read=()=>kv.get(key,[])??[];return{comments:read(),add(input){kv.set(key,[...read(),{...input,id:randomUUID(),createdAt:Date.now()}])},remove(id){kv.set(key,read().filter((c)=>c.id!==id))},send(worktreePath){let all=read(),unsent=unsentComments(all);if(unsent.length===0)return!0;if(!sendToEngine(formatDiffComments(unsent,worktreePath)))return!1;return kv.set(key,markAllSent(all,Date.now())),!0}}}
|
|
51
|
-
|
|
52
|
-
The current branch is {{branch}}.
|
|
53
|
-
{{prSentence}}
|
|
54
|
-
{{jobsSentence}}
|
|
55
|
-
|
|
56
|
-
{{logs}}
|
|
57
|
-
|
|
58
|
-
Follow these steps:
|
|
59
|
-
|
|
60
|
-
- Read the log excerpts above and name the actual failure before changing anything \u2014 a job can fail for a reason its last line does not state.
|
|
61
|
-
- Reproduce it locally where you can. Prefer the same command the job ran.
|
|
62
|
-
- Fix the cause, not the symptom, and do not weaken a gate to make it pass.
|
|
63
|
-
- Re-run the local equivalent of the failing job before pushing.
|
|
64
|
-
|
|
65
|
-
If the log excerpt is empty or does not explain the failure, say so and ask the user for help rather than guessing.`;function prSentence(prNumber){return prNumber===void 0?"There is no PR number recorded.":`The pull request is #${prNumber}.`}function jobsSentence(state){let names=state.checks.map((check)=>`${check.jobName} (${check.conclusion.toLowerCase()})`);if(names.length===0)return"No failing job was reported.";let total=state.totalFailing??names.length,extra=total>names.length?` ${total-names.length} further failing check(s) are not shown.`:"";return`${names.length===1?`The failing job is ${names[0]}.`:`The failing jobs are ${names.join(", ")}.`}${extra}`}function logs(checks){if(checks.length===0)return"";return checks.map((check)=>{let header=check.url?`### ${check.jobName} \u2014 ${check.url}`:`### ${check.jobName}`,body=check.tail.length>0?`\`\`\`
|
|
66
|
-
${check.tail}
|
|
67
|
-
\`\`\``:"(no log available \u2014 open the job in a browser to read it)";return`${header}
|
|
68
|
-
|
|
69
|
-
${body}`}).join(`
|
|
70
|
-
|
|
71
|
-
`)}function renderCIPrompt(template,state){let replacements={branch:state.branch,prSentence:prSentence(state.prNumber),jobsSentence:jobsSentence(state),logs:logs(state.checks)};return template.replace(/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g,(match,key)=>Object.hasOwn(replacements,key)?replacements[key]:match)}var CI_INSTRUCTION_FILENAME="ci-instructions.md";function loadTemplate2(worktree){return readFirstNonEmptyRepoFile(worktree,CI_INSTRUCTION_FILENAME)??DEFAULT_CI_PROMPT_TEMPLATE}async function buildCIPromptForWorktree(worktree,state){return renderCIPrompt(loadTemplate2(worktree),state)}function pluginSettingRows(schema,values){return schema.map((setting)=>{let stored=values[setting.key],defaultValue=setting.default??"";return{key:setting.key,label:setting.label,type:setting.type,options:setting.options??[],defaultValue,value:stored??defaultValue,defaulted:stored===void 0}})}function displaySettingValue(row){if(row.type!=="secret"||row.value==="")return row.value;return"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function isBooleanOn(value){return value!==""&&value!=="0"&&value.toLowerCase()!=="false"}function nextEnumValue(options,current){if(options.length===0)return current;let i=options.indexOf(current);return options[(i+1)%options.length]}function toggledBooleanValue(row){if(!isBooleanOn(row.value))return"1";return isBooleanOn(row.defaultValue)?"0":""}function normalizeNumberInput(raw){let trimmed=raw.trim();if(trimmed==="")return"";let n=Number(trimmed);return Number.isFinite(n)?String(n):null}import{mkdirSync as mkdirSync3,readFileSync as readFileSync2,writeFileSync as writeFileSync3}from"fs";import{join as join5}from"path";function envPath(pluginId,homeDir){return join5(pluginConfigDir(pluginId,homeDir),".env")}function readPluginSettings(pluginId,homeDir){let text;try{text=readFileSync2(envPath(pluginId,homeDir),"utf8")}catch{return{}}let out={};for(let line of text.split(`
|
|
50
|
+
`)){let m=HUNK_HEADER.exec(line);if(m){oldLine=Number(m[1]),newLine=Number(m[2]),inHunk=!0;continue}if(!inHunk)continue;let c=line[0];if(c==="+")rows.push({kind:"add",line:newLine++});else if(c==="-")rows.push({kind:"del",line:oldLine++});else if(c===" ")rows.push({kind:"ctx",line:newLine}),oldLine++,newLine++;else if(c!=="\\")inHunk=!1}return rows}function commentRange(rows,cursor,anchor){let cursorRow=rows[cursor];if(!cursorRow)return null;if(anchor==null||anchor===cursor)return{line:cursorRow.line};let first=rows[Math.min(anchor,cursor)],last=rows[Math.max(anchor,cursor)];if(!first||!last||first.line>=last.line)return{line:cursorRow.line};return{line:last.line,startLine:first.line}}function computeReviewPaint(rows,cursor,anchor,comments,filePath){let paint=new Map,unsent=unsentComments(comments).filter((c)=>c.filePath===filePath);if(unsent.length>0)rows.forEach((row,i)=>{if(unsent.some((c)=>(c.startLine??c.line)<=row.line&&row.line<=c.line))paint.set(i,"note")});if(anchor!=null){let lo=Math.min(anchor,cursor),hi=Math.max(anchor,cursor);for(let i=lo;i<=hi;i++)paint.set(i,"range")}return paint.set(cursor,"cursor"),paint}function commentAtRow(rows,cursor,comments,filePath){let row=rows[cursor];if(!row)return;for(let i=comments.length-1;i>=0;i-=1){let c=comments[i];if(c&&c.filePath===filePath&&(c.startLine??c.line)<=row.line&&row.line<=c.line)return c}return}function diffCommentsKey(taskId){return`diffComments.${taskId}`}function buildDiffReview(kv,taskId,sendToEngine){let key=diffCommentsKey(taskId),read=()=>kv.get(key,[])??[];return{comments:read(),add(input){kv.set(key,[...read(),{...input,id:randomUUID(),createdAt:Date.now()}])},remove(id){kv.set(key,read().filter((c)=>c.id!==id))},send(worktreePath){let all=read(),unsent=unsentComments(all);if(unsent.length===0)return!0;if(!sendToEngine(formatDiffComments(unsent,worktreePath)))return!1;return kv.set(key,markAllSent(all,Date.now())),!0}}}function pluginSettingRows(schema,values){return schema.map((setting)=>{let stored=values[setting.key],defaultValue=setting.default??"";return{key:setting.key,label:setting.label,type:setting.type,options:setting.options??[],defaultValue,value:stored??defaultValue,defaulted:stored===void 0}})}function displaySettingValue(row){if(row.type!=="secret"||row.value==="")return row.value;return"\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022"}function isBooleanOn(value){return value!==""&&value!=="0"&&value.toLowerCase()!=="false"}function nextEnumValue(options,current){if(options.length===0)return current;let i=options.indexOf(current);return options[(i+1)%options.length]}function toggledBooleanValue(row){if(!isBooleanOn(row.value))return"1";return isBooleanOn(row.defaultValue)?"0":""}function normalizeNumberInput(raw){let trimmed=raw.trim();if(trimmed==="")return"";let n=Number(trimmed);return Number.isFinite(n)?String(n):null}import{mkdirSync as mkdirSync3,readFileSync as readFileSync2,writeFileSync as writeFileSync3}from"fs";import{join as join5}from"path";function envPath(pluginId,homeDir){return join5(pluginConfigDir(pluginId,homeDir),".env")}function readPluginSettings(pluginId,homeDir){let text;try{text=readFileSync2(envPath(pluginId,homeDir),"utf8")}catch{return{}}let out={};for(let line of text.split(`
|
|
72
51
|
`)){let m=line.match(/^([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);if(m)out[m[1]]=m[2]}return out}function oneLine(value){return value.replace(/[\r\n]/g,"")}function writePluginSettings(pluginId,values,homeDir){let path2=envPath(pluginId,homeDir),lines=[];try{lines=readFileSync2(path2,"utf8").split(`
|
|
73
52
|
`)}catch{}let remaining={...values},next=[];for(let line of lines){let key=line.match(/^([A-Za-z_][A-Za-z0-9_]*)=/)?.[1];if(key&&key in remaining){let value=oneLine(remaining[key]);if(delete remaining[key],value!=="")next.push(`${key}=${value}`);continue}next.push(line)}for(let[key,raw]of Object.entries(remaining)){let value=oneLine(raw);if(value!=="")next.push(`${key}=${value}`)}while(next.length>0&&next[next.length-1]==="")next.pop();mkdirSync3(pluginConfigDir(pluginId,homeDir),{recursive:!0,mode:OWNER_ONLY_DIR_MODE}),writeFileSync3(path2,next.length>0?`${next.join(`
|
|
74
53
|
`)}
|
|
75
54
|
`:"",{mode:OWNER_ONLY_FILE_MODE}),tightenPluginPermissions(pluginId,homeDir)}function findFileHandler(fileName,homeDir){for(let entry of loadPluginRegistry(homeDir).plugins){if(!entry.enabled)continue;let manifest;try{manifest=readPluginManifest(entry.root).manifest}catch{continue}for(let handler of manifest.fileHandlers)try{if(new RegExp(handler.pattern,"i").test(fileName))return{qualifiedAction:qualifiedActionId(entry.id,handler.action)}}catch{}}return null}import{closeSync,openSync,readFileSync as readFileSync3,readSync,statSync as statSync3}from"fs";function builtInRowView(info){return{id:info.id,version:"",enabled:info.enabled,linked:!1,source:info.description,declares:{actions:0,events:0,panes:0,engines:0,pages:info.pages},platformOk:!0,hooksDeclared:!1,lastRun:null,settings:[],updateAvailable:!1,pageErrors:[],builtIn:!0}}function parseLastRun(logText){if(!logText)return null;let lines=logText.trimEnd().split(`
|
|
76
|
-
`);for(let i=lines.length-1;i>=0;i--){let line=lines[i]?.trim();if(!line)continue;let record;try{record=JSON.parse(line)}catch{continue}if(typeof record.at!=="number")continue;let exitCode=typeof record.exitCode==="number"?record.exitCode:null,spawnError=typeof record.spawnError==="string"?record.spawnError:void 0,running=record.phase==="running";return{at:record.at,label:typeof record.label==="string"?record.label:typeof record.kind==="string"?record.kind:"run",exitCode,ok:!running&&spawnError===void 0&&exitCode===0,running,...spawnError?{spawnError}:{}}}return null}function pluginRowView(outdated,entry,manifestText,logText,settingValues={},pageErrors=[]){let declares=null,settings=[],platformOk=!0,hooksDeclared=!1;if(manifestText!==null)try{let{manifest}=parsePluginManifest(manifestText);declares={actions:manifest.actions.length,events:manifest.events.length,panes:manifest.panes.length,engines:manifest.engines.length,pages:manifest.pages.length},hooksDeclared=manifest.actions.length+manifest.events.length+manifest.startup.length>0,platformOk=supportsPlatform({},manifest,currentPluginPlatform()),settings=pluginSettingRows(manifest.settings,settingValues)}catch{declares=null}return{id:entry.id,version:entry.version,enabled:entry.enabled,linked:entry.source.kind==="link",source:entry.source.kind==="link"?entry.root:entry.source.spec,declares,platformOk,hooksDeclared,lastRun:parseLastRun(logText),settings,updateAvailable:outdated.has(entry.id),pageErrors,builtIn:!1}}var LOG_TAIL_BYTES=65536;function readTail(path2){let fd;try{let size=statSync3(path2).size,length=Math.min(size,LOG_TAIL_BYTES),buf=Buffer.alloc(length);return fd=openSync(path2,"r"),readSync(fd,buf,0,length,size-length),buf.toString("utf8")}catch{return null}finally{if(fd!==void 0)closeSync(fd)}}function readTextOrNull(path2){if(!path2)return null;try{return readFileSync3(path2,"utf8")}catch{return null}}function readPluginRows(builtIns=[],homeDir){let outdated=new Set(readOutdatedCache(homeDir)),registered=loadPluginRegistry(homeDir).plugins.map((entry)=>pluginRowView(outdated,entry,readTextOrNull(pluginManifestPath(entry.root)),readTail(pluginLogPath(entry.id,homeDir)),readPluginSettings(entry.id,homeDir),pluginPageErrors().filter((error)=>error.pluginId===entry.id).map((error)=>`${error.pageId}: ${error.message}`)));return[...builtIns.map(builtInRowView),...registered]}function setPluginSetting(pluginId,key,value,homeDir){writePluginSettings(pluginId,{[key]:value},homeDir)}function setPluginEnabled(id,enabled,homeDir){let registry=loadPluginRegistry(homeDir);savePluginRegistry({plugins:registry.plugins.map((p)=>p.id===id?{...p,enabled}:p)},homeDir),reloadPluginEngines(homeDir)}
|
|
77
|
-
|
|
78
|
-
export{SCROLLBACK_ROWS_KEY,DEFAULT_SCROLLBACK_ROWS,SCROLLBACK_ROWS_MIN,SCROLLBACK_ROWS_MAX,normalizeScrollbackRows,persistedScrollbackRows,relativeBuckets,relativeAge,asAttachmentPaths,attachmentLabel,appendAttachmentRefs,captureClipboardAttachment,withImagePlaceholders,ISSUE_CHAT_PLACEMENTS,issueChatTaskTitle,issueWorktreePrompt2 as issueWorktreePrompt,issueProjectPrompt2 as issueProjectPrompt,DEFAULT_BASE_REF,validateRepoPath,getCurrentBranch,listLocalBranches,truncateEnd,truncateEndCells,truncateStart,truncateStartCells,EVENT_FEED_LIMIT,detailFragment,eventRows,pluginPageErrorState,WORKING_BORDER_KEY,DEFAULT_WORKING_BORDER,normalizeWorkingBorder,PREFIX_TAP_PRESENTATION_KEY,PREFIX_TAP_PRESENTATIONS,DEFAULT_PREFIX_TAP_PRESENTATION,normalizePrefixTapPresentation,SPLIT_STYLE_KEY,normalizeSplitStyle,TASK_COLORS_KEY,DEFAULT_TASK_COLORS,normalizeTaskColors,taskColor,GLYPH_SETS,DEFAULT_GLYPHS,subscribeBackgroundPolls,createBackgroundPoller,COLORBLIND_KEY,DEFAULT_COLORBLIND,normalizeColorblind,spawnDetached,openExternally,engineIntegrations,enginesNeedingHookInstall,enginesWithHooksInstalled,GLYPH_SET_KEY,DEFAULT_GLYPH_SET,normalizeGlyphSet,RUNNING_TITLE_KEY,DEFAULT_RUNNING_TITLE,normalizeRunningTitle,APPEARANCE_SETTINGS,appearanceChoices,applyAppearanceChoice,currentAppearanceChoice,SECTIONS,languageRowId,prefixTapPresentationRowId,generalRows,autoRoutingRows,displayEndpoint,keybindingRows,devRows,sectionRows,rowIndex,rowAt,SECTIONS_SIDEBAR_WIDTH,generalLabelLayout,createKeybindingsFile,prChip,sidebarPrChip,displaySettingValue,isBooleanOn,nextEnumValue,toggledBooleanValue,normalizeNumberInput,findFileHandler,readPluginRows,setPluginSetting,setPluginEnabled,TAB_STRIP_MODE_KEY,TAB_STRIP_MODES,TAB_STRIP_HIDE_SINGLE_KEY,resolveTabStripMode,tabStripVisible,deriveFolderName,validateGitUrl,validateCloneTarget,resolveCloneTarget,findAvailableFolderName,cloneRepo,detectWorktreeOpener,openWorktree,formatDiffComments,unsentComments,unifiedDiffRows,commentRange,computeReviewPaint,commentAtRow,diffCommentsKey,buildDiffReview,liveSourceProtocol,planChatContinuation,planWorktreeHandoff,addForkTab,addHandoffTab,forkFirstTab,engineStarted,unstartedEngineTab,retargetUnstartedEngine,gatherPRPromptState,buildPRPrompt,buildCIPromptForWorktree};
|
|
55
|
+
`);for(let i=lines.length-1;i>=0;i--){let line=lines[i]?.trim();if(!line)continue;let record;try{record=JSON.parse(line)}catch{continue}if(typeof record.at!=="number")continue;let exitCode=typeof record.exitCode==="number"?record.exitCode:null,spawnError=typeof record.spawnError==="string"?record.spawnError:void 0,running=record.phase==="running";return{at:record.at,label:typeof record.label==="string"?record.label:typeof record.kind==="string"?record.kind:"run",exitCode,ok:!running&&spawnError===void 0&&exitCode===0,running,...spawnError?{spawnError}:{}}}return null}function pluginRowView(outdated,entry,manifestText,logText,settingValues={},pageErrors=[]){let declares=null,settings=[],platformOk=!0,hooksDeclared=!1;if(manifestText!==null)try{let{manifest}=parsePluginManifest(manifestText);declares={actions:manifest.actions.length,events:manifest.events.length,panes:manifest.panes.length,engines:manifest.engines.length,pages:manifest.pages.length},hooksDeclared=manifest.actions.length+manifest.events.length+manifest.startup.length>0,platformOk=supportsPlatform({},manifest,currentPluginPlatform()),settings=pluginSettingRows(manifest.settings,settingValues)}catch{declares=null}return{id:entry.id,version:entry.version,enabled:entry.enabled,linked:entry.source.kind==="link",source:entry.source.kind==="link"?entry.root:entry.source.spec,declares,platformOk,hooksDeclared,lastRun:parseLastRun(logText),settings,updateAvailable:outdated.has(entry.id),pageErrors,builtIn:!1}}var LOG_TAIL_BYTES=65536;function readTail(path2){let fd;try{let size=statSync3(path2).size,length=Math.min(size,LOG_TAIL_BYTES),buf=Buffer.alloc(length);return fd=openSync(path2,"r"),readSync(fd,buf,0,length,size-length),buf.toString("utf8")}catch{return null}finally{if(fd!==void 0)closeSync(fd)}}function readTextOrNull(path2){if(!path2)return null;try{return readFileSync3(path2,"utf8")}catch{return null}}function readPluginRows(builtIns=[],homeDir){let outdated=new Set(readOutdatedCache(homeDir)),registered=loadPluginRegistry(homeDir).plugins.map((entry)=>pluginRowView(outdated,entry,readTextOrNull(pluginManifestPath(entry.root)),readTail(pluginLogPath(entry.id,homeDir)),readPluginSettings(entry.id,homeDir),pluginPageErrors().filter((error)=>error.pluginId===entry.id).map((error)=>`${error.pageId}: ${error.message}`)));return[...builtIns.map(builtInRowView),...registered]}function setPluginSetting(pluginId,key,value,homeDir){writePluginSettings(pluginId,{[key]:value},homeDir)}function setPluginEnabled(id,enabled,homeDir){let registry=loadPluginRegistry(homeDir);savePluginRegistry({plugins:registry.plugins.map((p)=>p.id===id?{...p,enabled}:p)},homeDir),reloadPluginEngines(homeDir)}
|
|
56
|
+
export{SCROLLBACK_ROWS_KEY,DEFAULT_SCROLLBACK_ROWS,SCROLLBACK_ROWS_MIN,SCROLLBACK_ROWS_MAX,normalizeScrollbackRows,persistedScrollbackRows,relativeBuckets,relativeAge,asAttachmentPaths,attachmentLabel,appendAttachmentRefs,captureClipboardAttachment,withImagePlaceholders,ISSUE_CHAT_PLACEMENTS,issueChatTaskTitle,issueWorktreePrompt2 as issueWorktreePrompt,issueProjectPrompt2 as issueProjectPrompt,DEFAULT_BASE_REF,validateRepoPath,getCurrentBranch,listLocalBranches,truncateEnd,truncateEndCells,truncateStartCells,reconcileStableRows,fuzzyMatch,compareNewest,compareRecent,compareName,repoBasename,sidebarProjectKeyOfTask,isNoProjectTask,sidebarProjectKeyResolver,sidebarRepoLabel,sidebarProjectLabel,EVENT_FEED_LIMIT,detailFragment,eventRows,pluginPageErrorState,WORKING_BORDER_KEY,DEFAULT_WORKING_BORDER,normalizeWorkingBorder,PREFIX_TAP_PRESENTATION_KEY,PREFIX_TAP_PRESENTATIONS,DEFAULT_PREFIX_TAP_PRESENTATION,normalizePrefixTapPresentation,SPLIT_STYLE_KEY,normalizeSplitStyle,TASK_COLORS_KEY,DEFAULT_TASK_COLORS,normalizeTaskColors,taskColor,GLYPH_SETS,DEFAULT_GLYPHS,subscribeBackgroundPolls,createBackgroundPoller,COLORBLIND_KEY,DEFAULT_COLORBLIND,normalizeColorblind,spawnDetached,openExternally,GLYPH_SET_KEY,DEFAULT_GLYPH_SET,normalizeGlyphSet,engineIntegrations,enginesNeedingHookInstall,enginesWithHooksInstalled,RUNNING_TITLE_KEY,DEFAULT_RUNNING_TITLE,normalizeRunningTitle,APPEARANCE_SETTINGS,appearanceChoices,applyAppearanceChoice,currentAppearanceChoice,SECTIONS,languageRowId,prefixTapPresentationRowId,generalRows,autoRoutingRows,displayEndpoint,keybindingRows,devRows,sectionRows,rowIndex,rowAt,SECTIONS_SIDEBAR_WIDTH,generalLabelLayout,createKeybindingsFile,rowLiveBranchPath,conversationTitleOf,worktreeRowLabel,prChip,sidebarPrChip,displaySettingValue,isBooleanOn,nextEnumValue,toggledBooleanValue,normalizeNumberInput,findFileHandler,readPluginRows,setPluginSetting,setPluginEnabled,TAB_STRIP_MODE_KEY,TAB_STRIP_MODES,TAB_STRIP_HIDE_SINGLE_KEY,resolveTabStripMode,tabStripVisible,deriveFolderName,validateGitUrl,validateCloneTarget,resolveCloneTarget,findAvailableFolderName,cloneRepo,detectWorktreeOpener,openWorktree,formatDiffComments,unsentComments,unifiedDiffRows,commentRange,computeReviewPaint,commentAtRow,diffCommentsKey,buildDiffReview,gatherPRPromptState,buildPRPrompt};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{readFirstNonEmptyRepoFile}from"./chunk-catrr0z3.js";var DEFAULT_CI_PROMPT_TEMPLATE=`CI is failing on this branch and the user wants it green.
|
|
3
|
+
|
|
4
|
+
The current branch is {{branch}}.
|
|
5
|
+
{{prSentence}}
|
|
6
|
+
{{jobsSentence}}
|
|
7
|
+
|
|
8
|
+
{{logs}}
|
|
9
|
+
|
|
10
|
+
Follow these steps:
|
|
11
|
+
|
|
12
|
+
- Read the log excerpts above and name the actual failure before changing anything \u2014 a job can fail for a reason its last line does not state.
|
|
13
|
+
- Reproduce it locally where you can. Prefer the same command the job ran.
|
|
14
|
+
- Fix the cause, not the symptom, and do not weaken a gate to make it pass.
|
|
15
|
+
- Re-run the local equivalent of the failing job before pushing.
|
|
16
|
+
|
|
17
|
+
If the log excerpt is empty or does not explain the failure, say so and ask the user for help rather than guessing.`;function prSentence(prNumber){return prNumber===void 0?"There is no PR number recorded.":`The pull request is #${prNumber}.`}function jobsSentence(state){let names=state.checks.map((check)=>`${check.jobName} (${check.conclusion.toLowerCase()})`);if(names.length===0)return"No failing job was reported.";let total=state.totalFailing??names.length,extra=total>names.length?` ${total-names.length} further failing check(s) are not shown.`:"";return`${names.length===1?`The failing job is ${names[0]}.`:`The failing jobs are ${names.join(", ")}.`}${extra}`}function logs(checks){if(checks.length===0)return"";return checks.map((check)=>{let header=check.url?`### ${check.jobName} \u2014 ${check.url}`:`### ${check.jobName}`,body=check.tail.length>0?`\`\`\`
|
|
18
|
+
${check.tail}
|
|
19
|
+
\`\`\``:"(no log available \u2014 open the job in a browser to read it)";return`${header}
|
|
20
|
+
|
|
21
|
+
${body}`}).join(`
|
|
22
|
+
|
|
23
|
+
`)}function renderCIPrompt(template,state){let replacements={branch:state.branch,prSentence:prSentence(state.prNumber),jobsSentence:jobsSentence(state),logs:logs(state.checks)};return template.replace(/\{\{([a-zA-Z][a-zA-Z0-9_]*)\}\}/g,(match,key)=>Object.hasOwn(replacements,key)?replacements[key]:match)}var CI_INSTRUCTION_FILENAME="ci-instructions.md";function loadTemplate(worktree){return readFirstNonEmptyRepoFile(worktree,CI_INSTRUCTION_FILENAME)??DEFAULT_CI_PROMPT_TEMPLATE}async function buildCIPromptForWorktree(worktree,state){return renderCIPrompt(loadTemplate(worktree),state)}
|
|
24
|
+
export{buildCIPromptForWorktree};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{managedWorktreeRootsFor,readWorktreeBaseOverride}from"./chunk-gq36nzg8.js";import{pathIdentity,pathSyntax,pathWithin,samePath}from"./chunk-pn5ygqn6.js";import{existsSync}from"fs";import{homedir}from"os";import path from"path";function ownerFirst(a,b){let rank=(t)=>t.sharesWorkspaceOf?1:0;return rank(a)-rank(b)||(a.id<b.id?-1:a.id>b.id?1:0)}function resolvePtyOwner(tasks,taskId,tabId){if(!tabId)return taskId;return tasks.find((t)=>t.ptyAlias?.taskId===taskId&&t.ptyAlias.tabId===tabId)?.id??taskId}function crossesRepoBoundary(wt,cwd){let syntax=pathSyntax(cwd);for(let dir=cwd;!samePath(dir,wt);dir=syntax.dirname(dir)){if(existsSync(syntax.join(dir,".git")))return!0;if(samePath(dir,syntax.dirname(dir)))break}return!1}function worktreesOf(t){return[t.worktreePath,...(t.extraRepos??[]).map((x)=>x.worktreePath)].filter((p)=>!!p)}function matchTaskByCwd(tasks,cwd){let target=pathIdentity(cwd),best,bestWt="";for(let t of tasks)for(let worktree of worktreesOf(t)){let wt=pathIdentity(worktree);if(pathWithin(wt,target)===null)continue;if(samePath(wt,homedir())&&!samePath(wt,target))continue;if(!best||wt.length>bestWt.length||wt.length===bestWt.length&&ownerFirst(t,best)<0)best=t,bestWt=wt}if(best&&crossesRepoBoundary(bestWt,target))return;return best?.id}function tasksAtWorktreePath(tasks,worktreePath){let target=pathIdentity(worktreePath);return tasks.filter((t)=>worktreesOf(t).some((wt)=>pathIdentity(wt)===target)).sort(ownerFirst).map((t)=>t.id)}function findAdoptableWorktree(tasks,cwd){let target=pathIdentity(cwd),repos=new Set,known=new Set;for(let t of tasks){if(t.repo&&path.isAbsolute(t.repo))repos.add(pathIdentity(t.repo));for(let wt of worktreesOf(t))known.add(pathIdentity(wt))}for(let repo of repos)for(let root of managedWorktreeRootsFor(repo,readWorktreeBaseOverride(repo)).map(pathIdentity)){let prefix=root.endsWith("/")?root:`${root}/`,rest=pathWithin(root,target);if(!rest)continue;let name=rest.split("/")[0];if(!name)continue;let worktreePath=`${prefix}${name}`;if(known.has(worktreePath))return;return{repo,worktreePath}}return}var DISPATCH_PROMPT_HEAD_CHARS=160;var SETTLED=new Set(["done","failed"]);function next(status,state){if(state==="error"||state==="dead")return"failed";if(state==="running"&&(status==="delivered"||status==="asking"))return"working";if(state==="permission_needed"&&(status==="delivered"||status==="working"))return"asking";if((state==="turn_complete"||state==="idle")&&(status==="working"||status==="asking"))return"done";return}class DispatchLedger{bus;rows=[];seq=1;rev=0;expiry=null;relayed=new Set;off;now;constructor(bus,now){this.bus=bus;this.now=now??Date.now,this.off=bus.onPublish((event)=>{if(event.channel==="engine-state")this.take(event.payload);else if(event.channel==="machines")this.takeRelayed(event.payload)})}list(){return{rows:this.rows,rev:this.rev}}record(input){let at=this.now(),row={id:`x-${this.seq++}`,kind:input.kind,from:input.from,...input.routine?{routine:input.routine}:{},to:input.to,promptHead:input.promptHead.replace(/\s+/g," ").trim().slice(0,160),at,status:input.delivered?"delivered":"failed",statusAt:at,...input.reason?{reason:input.reason}:{},...input.deliveryId?{deliveryId:input.deliveryId}:{}};return this.rows=[...this.rows,row],this.publish(),row}close(){this.off(),this.clearExpiry()}take(payload){let p=payload;if(typeof p.taskId!=="string"||typeof p.state!=="string")return;let tabId=typeof p.tabId==="string"&&p.tabId?p.tabId:null,at=typeof p.at==="number"?p.at:this.now(),changed=!1;if(this.rows=this.rows.map((row)=>{if(SETTLED.has(row.status)||row.to.taskId!==p.taskId||at<row.at)return row;if(row.to.tabId!==null&&tabId!==null&&row.to.tabId!==tabId)return row;let status=next(row.status,p.state);if(!status)return row;return changed=!0,{...row,to:row.to.tabId===null&&tabId!==null?{...row.to,tabId}:row.to,status,statusAt:at,...status==="failed"?{reason:p.state}:{}}}),changed)this.publish()}takeRelayed(payload){let activity=payload?.live?.activity;if(!activity||typeof activity!=="object")return;let seen=new Set;for(let[taskId,reading]of Object.entries(activity)){if(!reading||typeof reading!=="object")continue;seen.add(taskId),this.take({...reading,taskId})}for(let taskId of this.relayed)if(!seen.has(taskId))this.take({taskId,state:"idle",at:this.now()});this.relayed=seen}publish(){this.rows=prune(this.rows,this.now()),this.rev+=1,this.bus.publish("dispatch.snapshot",this.list()),this.scheduleExpiry()}scheduleExpiry(){this.clearExpiry();let open=this.rows.filter((r)=>!SETTLED.has(r.status));if(open.length===0)return;let due=Math.min(...open.map((r)=>r.statusAt))+21600000;this.expiry=setTimeout(()=>{if(this.expiry=null,prune(this.rows,this.now()).length!==this.rows.length)this.publish();else this.scheduleExpiry()},Math.max(0,due-this.now())),this.expiry.unref?.()}clearExpiry(){if(this.expiry)clearTimeout(this.expiry);this.expiry=null}}function prune(rows,now){let open=rows.filter((r)=>!SETTLED.has(r.status)&&now-r.statusAt<21600000).slice(-100),settled=rows.filter((r)=>SETTLED.has(r.status)).slice(-40),keep=new Set([...open,...settled]);return rows.filter((r)=>keep.has(r))}import{spawnSync}from"child_process";import{existsSync as existsSync2}from"fs";function normalizeRemoteUrl(url){let u=url.trim();return u=u.replace(/^[a-z+]+:\/\//i,""),u=u.replace(/^[^@/]+@/,""),u=u.replace(/^([^/:]+):(?!\d+\/)/,"$1/"),u=u.replace(/^([^/:]+):\d+\//,"$1/"),u=u.replace(/\/+$/,"").replace(/\.git$/i,""),u=u.replace(/^ssh\.github\.com\//i,"github.com/"),u.toLowerCase()}function git(cwd,args){let res=spawnSync("git",["-C",cwd,...args],{encoding:"utf8",timeout:5000,windowsHide:!0});return res.status===0?res.stdout.trim():null}function computeRepoId(path2){let origin=git(path2,["remote","get-url","origin"]);if(origin)return normalizeRemoteUrl(origin);let root=git(path2,["rev-list","--max-parents=0","HEAD"])?.split(`
|
|
3
|
+
`).filter(Boolean).sort()[0];return root?`root:${root}`:void 0}var memo=new Map;function repoIdOf(path2){if(!path2)return;if(memo.has(path2))return memo.get(path2);if(!existsSync2(path2))return;let id=computeRepoId(path2);return memo.set(path2,id),id}
|
|
4
|
+
export{resolvePtyOwner,matchTaskByCwd,tasksAtWorktreePath,findAdoptableWorktree,DISPATCH_PROMPT_HEAD_CHARS,DispatchLedger,normalizeRemoteUrl,repoIdOf};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{argvToParams,booleanFlagsOf,callVerb,errorBody,errorEnvelope,executeVerb,paramsToFlags,repeatableFlagsOf,runVerb,successEnvelope,toApiError}from"./chunk-fgtc1xq9.js";import"./chunk-z3wrbtcq.js";import"./chunk-zpwvjt14.js";import"./chunk-kdnk8m5j.js";import"./chunk-qcjkactr.js";import"./chunk-rjfdzjhj.js";import"./chunk-r2bb8b11.js";import"./chunk-agvtzads.js";import"./chunk-pm91e38v.js";import"./chunk-2xsxcdp6.js";import"./chunk-17e2tgyg.js";import"./chunk-1vxtd8rh.js";import"./chunk-q8ffd1pc.js";import"./chunk-4hestsjp.js";import"./chunk-qgrg9a5n.js";import"./chunk-2bgmby1d.js";import"./chunk-n0rdn2fn.js";import"./chunk-5mhvjytn.js";import"./chunk-atn06ncf.js";import"./chunk-tt58819p.js";import"./chunk-ta1p2nwa.js";import"./chunk-vytrhm50.js";import"./chunk-vp29jgbt.js";import"./chunk-gq36nzg8.js";import"./chunk-sq6zj3fb.js";import"./chunk-qkehg2c1.js";import"./chunk-shtm72c0.js";import"./chunk-j1qy79fd.js";import"./chunk-z43e08kw.js";import"./chunk-w77s2df8.js";import"./chunk-mqfvzdpr.js";import"./chunk-cf3vpsm5.js";import"./chunk-rxqdw6s5.js";import"./chunk-kxp04jnp.js";import"./chunk-tw9tfs1d.js";import"./chunk-61cn88e7.js";import"./chunk-atg13xab.js";import"./chunk-r5j8fycq.js";import"./chunk-xfgqae9t.js";import"./chunk-j1z9kgyd.js";import"./chunk-g9ba25q5.js";import"./chunk-ggnq2vvk.js";import"./chunk-hpay0ax8.js";import"./chunk-catrr0z3.js";import"./chunk-mdc7b01e.js";import"./chunk-tn9gtf18.js";import"./chunk-895yqjjz.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-e58kj4gm.js";import"./chunk-0a65j1zj.js";import"./chunk-bcyex84w.js";import"./chunk-vvqwgcge.js";import"./chunk-x83xbzjd.js";import"./chunk-2tfnscxk.js";import"./chunk-hzz020xx.js";import"./chunk-w7zv47mp.js";import"./chunk-etfh8f4z.js";import"./chunk-9rj2fx6v.js";import"./chunk-rfp0ayra.js";import"./chunk-t7j8g9f6.js";import"./chunk-dmzg9zdc.js";import"./chunk-40dgv828.js";import"./chunk-kg9kmwt9.js";import"./chunk-6xppe9bj.js";import"./chunk-9ckvdy0j.js";import"./chunk-zsfyj36g.js";import"./chunk-2r1fgng9.js";import"./chunk-2brn8e1y.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-mjyhy152.js";import"./chunk-wzss4pzh.js";import"./chunk-cmp64q4j.js";import"./chunk-qzzmd63x.js";import"./chunk-96kvwzj8.js";import"./chunk-7bakcyes.js";import"./chunk-8qkyd589.js";import"./chunk-7kysxgbq.js";import"./chunk-hz1x3hak.js";import"./chunk-x1jxxmtc.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-7ghwdjdc.js";import"./chunk-8t7qbr1e.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import"./chunk-z1nj22va.js";import"./chunk-zt7wfnva.js";import"./chunk-0g4wc808.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-pxk2c2vj.js";import"./chunk-91sykzqq.js";export{toApiError,successEnvelope,runVerb,repeatableFlagsOf,paramsToFlags,executeVerb,errorEnvelope,errorBody,callVerb,booleanFlagsOf,argvToParams};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{submitFeedback}from"./chunk-
|
|
2
|
+
import{submitFeedback}from"./chunk-tt58819p.js";import"./chunk-9ckvdy0j.js";import"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";import{readFileSync}from"fs";var CLI_NAME=ROVE_PRODUCT_NAME,FEEDBACK_USAGE=[`Usage: ${CLI_NAME} feedback --title <text> (--body <text> | --body-file <path>) [--category <slug>]`,"","Create a GitHub Discussion in the Rove repository using the GitHub CLI.","","Requires:"," gh auth login","","Options:"," --title <text> Discussion title"," --body <text> Discussion body"," --body-file <path> Read the Discussion body from a file; use - for stdin"," --category <slug> Discussion category slug (default: feedback)"," -h, --help Print this help",""].join(`
|
|
3
3
|
`);function usageError(message){process.stderr.write(`${CLI_NAME} feedback: ${message}
|
|
4
4
|
|
|
5
5
|
${FEEDBACK_USAGE}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{engineEntry,identifiableEngineIds}from"./chunk-
|
|
2
|
+
import{engineEntry,identifiableEngineIds}from"./chunk-x83xbzjd.js";import{recordSpawn}from"./chunk-40dgv828.js";import{loadStateFile}from"./chunk-32j6y5d1.js";import{PsProbeUnavailableError}from"./chunk-pxk2c2vj.js";import{__require}from"./chunk-91sykzqq.js";import{basename}from"path";var WRAPPERS=new Set(["node","bun","npx","deno","sh","zsh","bash","env","script"]);function binaryName(token){return basename(token).replace(/\.(exe|js|mjs|cjs)$/,"")}function executableNameFromArgv(argv){for(let token of argv.slice(0,8)){if(/^[A-Za-z_][A-Za-z0-9_]*=/.test(token))continue;let name=binaryName(token);if(WRAPPERS.has(name))continue;return name||null}return null}function vendorFromArgv(commandLine){let name=executableNameFromArgv(commandLine.trim().split(/\s+/));if(!name)return null;return identifiableEngineIds().find((v)=>{let entry=engineEntry(v);return entry.defaultCommand[0]===name||entry.processNames?.includes(name)===!0})??null}function parsePsSnapshot(text){let rows=[];for(let line of text.split(`
|
|
3
3
|
`)){let m=/^\s*(\d+)\s+(\d+)\s+(\S.*)$/.exec(line);if(m)rows.push({pid:Number(m[1]),ppid:Number(m[2]),args:m[3]})}return rows}function childrenIndex(rows){let kids=new Map;for(let row of rows){let list=kids.get(row.ppid);if(list)list.push(row);else kids.set(row.ppid,[row])}return kids}function hasAncestor(rows,pid,ancestorPid){let parents=new Map(rows.map((r)=>[r.pid,r.ppid])),cur=pid;for(let hops=0;hops<=rows.length;hops++){if(cur===ancestorPid)return!0;let next=parents.get(cur);if(next===void 0||next<=1)return!1;cur=next}return!1}function customEngineBinaries(){let state=loadStateFile(),ids=state.customEngineIds,out=new Map;if(!Array.isArray(ids))return out;for(let id of ids){if(typeof id!=="string"||id.trim().length===0)continue;let command=state[`engineCommand.${id}`],argv=typeof command==="string"&&command.trim().length>0?command.trim().split(/\s+/):[id],name=executableNameFromArgv(argv);if(name)out.set(name,id)}return out}function findDescendant(rows,rootPid,pick){let kids=childrenIndex(rows),queue=[...kids.get(rootPid)??[]],visited=new Set;while(queue.length>0){let row=queue.shift();if(!row)break;if(visited.has(row.pid))continue;visited.add(row.pid);let hit=pick(row);if(hit!==null)return hit;queue.push(...kids.get(row.pid)??[])}return null}function walkDescendants(rows,rootPid,identify){return findDescendant(rows,rootPid,(row)=>{let vendor=identify(row.args);return vendor?{vendor,argv:row.args,pid:row.pid}:null})}function foregroundEngineIn(rows,rootPid){let builtin=walkDescendants(rows,rootPid,vendorFromArgv);if(builtin)return builtin;let custom=customEngineBinaries();if(custom.size===0)return null;return walkDescendants(rows,rootPid,(args)=>custom.get(executableNameFromArgv(args.trim().split(/\s+/))??"")??null)}function engineProcessIn(rows,rootPid,extraLaunch){if(foregroundEngineIn(rows,rootPid))return!0;let expected=extraLaunch?executableNameFromArgv(typeof extraLaunch==="string"?[extraLaunch]:extraLaunch):null;if(!expected)return!1;return findDescendant(rows,rootPid,(row)=>executableNameFromArgv(row.args.trim().split(/\s+/))===expected?!0:null)===!0}var PS_PROBE_TIMEOUT_MS=5000,bunPsSpawn=()=>{recordSpawn("engine.foregroundWalk",["ps","-A","-o","pid=,ppid=,args="]);let proc=Bun.spawn(["ps","-A","-o","pid=,ppid=,args="],{stdout:"pipe",stderr:"ignore"});return{text:new Response(proc.stdout).text(),kill:()=>proc.kill()}};async function psSnapshotWith(spawn,timeoutMs=PS_PROBE_TIMEOUT_MS){let proc=spawn(),timer;try{let text=await Promise.race([proc.text,new Promise((_resolve,reject)=>{timer=setTimeout(()=>{try{proc.kill()}catch{}reject(new PsProbeUnavailableError(`ps did not answer within ${timeoutMs}ms`))},timeoutMs)})]);if(parsePsSnapshot(text).length===0)throw new PsProbeUnavailableError("ps returned no usable rows");return text}finally{if(timer)clearTimeout(timer)}}var psSnapshot=async(anchors)=>{if(process.platform!=="win32")return psSnapshotWith(bunPsSpawn);let{defaultWinProcessProbe,winProcessSnapshot}=await import("./chunk-14f459aa.js");return winProcessSnapshot(anchors??[],defaultWinProcessProbe())};async function foregroundEngine(rootPid,snapshot=psSnapshot){try{return foregroundEngineIn(parsePsSnapshot(await snapshot([rootPid])),rootPid)}catch{return null}}
|
|
4
4
|
export{vendorFromArgv,parsePsSnapshot,hasAncestor,foregroundEngineIn,engineProcessIn,PS_PROBE_TIMEOUT_MS,psSnapshotWith,psSnapshot,foregroundEngine};
|
|
@@ -4,5 +4,5 @@ import{generateCompletions,isShellKind,mergeSubVerbs,shippedCompletionsPath}from
|
|
|
4
4
|
|
|
5
5
|
${usage}`),process.exit(2)};if(rest.some((arg)=>HELP_WORDS.includes(arg))){process.stdout.write(usage);return}let flags=rest.filter((arg)=>arg.startsWith("-")),shells=rest.filter((arg)=>!arg.startsWith("-")),unknownFlag=flags.find((flag)=>flag!=="--path"&&flag!=="--install");if(unknownFlag)fail(`unknown option "${unknownFlag}"`);if(new Set(flags).size>1)fail("--path and --install are different things; pass one");let shell=shells.length===1?shells[0]:void 0;if(!isShellKind(shell))fail(`unknown shell "${shells.join(" ")}"`);let scriptPath=shippedCompletionsPath(shell,cliName,deps.shippedDir),shipped=existsSync(scriptPath)?scriptPath:null;if(flags[0]==="--path"){if(!shipped)fail(`no pre-generated ${shell} script at ${scriptPath}
|
|
6
6
|
${cliName} completions ${shell} # print the script to stdout instead`);process.stdout.write(`${shipped}
|
|
7
|
-
`);return}if(flags[0]==="--install"){let[{installCompletions,settleWelcomeInstall},{t}]=await Promise.all([import("./chunk-
|
|
8
|
-
`);return}if(shipped){process.stdout.write(readFileSync(shipped,"utf8"));return}let{API_VERBS}=await import("./chunk-
|
|
7
|
+
`);return}if(flags[0]==="--install"){let[{installCompletions,settleWelcomeInstall},{t}]=await Promise.all([import("./chunk-zrf93zrx.js"),import("./chunk-z3qz6enf.js")]),completion=installCompletions(shell,deps.home,cliName,shipped);settleWelcomeInstall("completions",shell);let line=completion.installed?"onboarding.appliedCompletions":"onboarding.keptCompletions";process.stdout.write(`${t(line,{path:completion.path})}
|
|
8
|
+
`);return}if(shipped){process.stdout.write(readFileSync(shipped,"utf8"));return}let{API_VERBS}=await import("./chunk-9x2xd1rz.js");process.stdout.write(generateCompletions(shell,cliName,mergeSubVerbs(API_VERBS)))}export{runCompletionsSubcommand};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{PreambleStripper}from"./chunk-sq6zj3fb.js";import{shQuote}from"./chunk-y1xnjx8x.js";import{loadStateFile,updateStateFile}from"./chunk-32j6y5d1.js";import{RoveDaemonClient}from"./chunk-
|
|
2
|
+
import{PreambleStripper}from"./chunk-sq6zj3fb.js";import{shQuote}from"./chunk-y1xnjx8x.js";import{loadStateFile,updateStateFile}from"./chunk-32j6y5d1.js";import{RoveDaemonClient}from"./chunk-qzzmd63x.js";import{homeDir}from"./chunk-z1nj22va.js";import{logClientError}from"./chunk-0g4wc808.js";import{shortHomeTag}from"./chunk-eqdbfgq5.js";import{PRE_RENAME_VERSION_KEY}from"./chunk-f8gg8cqh.js";import{spawn as spawn3}from"child_process";import{mkdirSync as mkdirSync3,rmSync as rmSync2}from"fs";import{connect as netConnect}from"net";import{tmpdir}from"os";import{join}from"path";var LOCAL_MACHINE_ID="local",ALIAS_RE=/^[A-Za-z0-9][A-Za-z0-9._-]*$/;function isValidMachineAlias(alias){return alias!==LOCAL_MACHINE_ID&&alias.length<=64&&ALIAS_RE.test(alias)}function parseSshTarget(target){let trimmed=target.trim();if(!trimmed)return null;let at=trimmed.lastIndexOf("@"),user=at>=0?trimmed.slice(0,at):void 0,rest=at>=0?trimmed.slice(at+1):trimmed;if(at>=0&&!user)return null;let bracketed=/^\[([^\]]+)\](?::(\d{1,5}))?$/.exec(rest),portMatch=bracketed?null:/^([^:]*):(\d{1,5})$/.exec(rest),host=bracketed?bracketed[1]??"":portMatch?portMatch[1]??"":rest,rawPort=bracketed?bracketed[2]:portMatch?.[2],port=rawPort?Number(rawPort):void 0;if(!host||/\s/.test(host))return null;if(port!==void 0&&(port<1||port>65535))return null;return{host,...user?{user}:{},...port?{port}:{}}}function defaultMachineAlias(args){let source=!args.typedUser&&args.port===void 0&&!isIpLiteral(args.typedHost)?args.typedHost:args.remoteHostname||args.typedHost;return sanitizeAlias(source)}function isIpLiteral(host){return host.includes(":")||/^\d{1,3}(\.\d{1,3}){3}$/.test(host)}function sanitizeAlias(raw){return(raw.split(".")[0]??raw).replace(/[^A-Za-z0-9._-]/g,"-").slice(0,64)}function sshTargetOf(config){return config.user?`${config.user}@${config.host}`:config.host}function readMachines(state){let raw=state.machines;if(!raw||typeof raw!=="object"||Array.isArray(raw))return{};return raw}function listMachines(){let machines=readMachines(loadStateFile());return Object.entries(machines).map(([alias,config])=>({alias,...config}))}function getMachine(alias){return readMachines(loadStateFile())[alias]??null}function addMachine(alias,config){let added=!1;return updateStateFile((state)=>{let machines={...readMachines(state)};added=machines[alias]===void 0,machines[alias]={...config,addedAt:config.addedAt??machines[alias]?.addedAt??new Date().toISOString()},state.machines=machines;return}),{added}}function updateMachine(alias,patch){updateStateFile((state)=>{let machines={...readMachines(state)},existing=machines[alias];if(!existing)return!1;machines[alias]={...existing,...patch},state.machines=machines;return})}function setMachineIdentity(alias,identity){updateMachine(alias,{identity})}function removeMachine(alias){let removed=!1;return updateStateFile((state)=>{let machines={...readMachines(state)};if(removed=machines[alias]!==void 0,!removed)return!1;delete machines[alias],state.machines=machines;return}),removed}function dedupeMachines(entries){let kept=[],seen=[];for(let entry of entries){let identity=entry.identity;if(identity){if(seen.some((other)=>sameMachine(other,identity)))continue;seen.push(identity)}kept.push(entry)}return kept}function sameMachine(a,b){return a.hostname===b.hostname&&a.homeDir===b.homeDir&&a.daemonPid===b.daemonPid}function duplicateAliasOf(machines,self,identity){for(let[alias,config]of Object.entries(machines)){if(alias===self)continue;let other=config.identity;if(!other)continue;if(other.hostname===identity.hostname&&other.homeDir===identity.homeDir&&other.daemonPid===identity.daemonPid)return alias}return null}var CONTROL_PERSIST_SECONDS=300;function machineSocketDir(alias,home=homeDir()){let natural=join(home,".rove","machines",alias);if(Buffer.byteLength(join(natural,"daemon.sock"),"utf8")<=SOCKET_PATH_LIMIT)return natural;return join(tmpdir(),`rove-m-${shortHomeTag(home)}-${shortHomeTag(alias)}`)}var SOCKET_PATH_LIMIT=100;function localDaemonSocketPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"daemon.sock")}function localPtySocketPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"pty.sock")}function controlPath(alias,home=homeDir()){return join(machineSocketDir(alias,home),"cm")}function machineSshArgs(alias,config,opts={}){let argv=["ssh"];if(opts.batch!==!1)argv.push("-o","BatchMode=yes");if(opts.mux!==!1&&process.platform!=="win32")argv.push("-o","ControlMaster=auto","-o",`ControlPath=${controlPath(alias,opts.home)}`,"-o",`ControlPersist=${CONTROL_PERSIST_SECONDS}`);if(argv.push("-o","StrictHostKeyChecking=accept-new"),config.port)argv.push("-p",String(config.port));if(config.auth.kind==="key"&&config.auth.keyPath)argv.push("-i",config.auth.keyPath);return argv.push(sshTargetOf(config)),argv}import{spawn as spawn2}from"child_process";import{mkdirSync as mkdirSync2,rmSync}from"fs";import{createServer}from"net";import{spawn}from"child_process";import{mkdirSync}from"fs";import{posix}from"path";function isWindowsPath(path){return/^[A-Za-z]:[\\/]/.test(path)||/^\\\\[.?]\\/.test(path)}function isWindowsMachine(config){if(config.sockets&&(isWindowsPath(config.sockets.daemon)||isWindowsPath(config.sockets.pty)))return!0;return config.roveBin!==void 0&&isWindowsPath(config.roveBin)}function psQuote(value){return`'${value.replaceAll("'","''")}'`}function powershellCommand(script){return`powershell -NoProfile -NonInteractive -ExecutionPolicy Bypass -EncodedCommand ${Buffer.from(script,"utf16le").toString("base64")}`}function windowsRoveCommand(roveBin,args){return powershellCommand(`& ${psQuote(roveBin)} ${args.map(psQuote).join(" ")}; exit $LASTEXITCODE`)}var WINDOWS_LOCATE_SCRIPT=['$dirs = @("$env:APPDATA\\npm", "$env:USERPROFILE\\.bun\\bin", "$env:LOCALAPPDATA\\pnpm", $env:NVM_SYMLINK)',"$dirs += [Environment]::GetEnvironmentVariable('Path', 'User') -split ';'","foreach ($d in $dirs) { if (-not $d) { continue }",` foreach ($n in 'rove.cmd', 'rove.exe') { $p = Join-Path $d $n; if (Test-Path -LiteralPath $p) { "ROVE_BIN=$p"; exit 0 } } }`,"exit 1"].join(`
|
|
3
3
|
`),WINDOWS_LOCATE_ROVE=powershellCommand(WINDOWS_LOCATE_SCRIPT),WINDOWS_ROVE_MISSING=/'(?:[^'\r\n]*[\\/])?rove(?:\.cmd|\.exe|\.ps1)?' is not recognized as (?:an internal or external command|(?:the|a) name of a cmdlet)/i,WINDOWS_SCRIPTS_DISABLED=/rove\.ps1 cannot be loaded because running scripts is disabled/i;function windowsNoRoveMessage(alias,output){if(WINDOWS_SCRIPTS_DISABLED.test(output))return[`${alias}'s ssh sessions run Windows PowerShell, whose execution policy refuses npm's rove.ps1, and no rove.cmd was found to use instead.`,`On ${alias}, either allow scripts for your user: Set-ExecutionPolicy -Scope CurrentUser RemoteSigned`,'or make ssh use PowerShell 7 (elevated): New-ItemProperty -Path HKLM:\\SOFTWARE\\OpenSSH -Name DefaultShell -Value "$env:ProgramFiles\\PowerShell\\7\\pwsh.exe" -PropertyType String -Force'].join(`
|
|
4
4
|
`);return[`Rove is not on the PATH of ssh sessions on ${alias} (Windows), nor in %APPDATA%\\npm, ~\\.bun\\bin or the user PATH.`,"Install it there in a PowerShell: npm install -g @sma1lboy/rove",`If it is installed elsewhere, add that folder to your user PATH on ${alias}, then restart sshd (elevated: Restart-Service sshd) so new sessions see it.`].join(`
|
|
5
5
|
`)}var WINDOWS_SSHD_BANNER=/remote software version OpenSSH_for_Windows/i,WINDOWS_SSHD_STEPS=["Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0","Set-Service sshd -StartupType Automatic; Start-Service sshd","if (-not (Get-NetFirewallRule -Name OpenSSH-Server-In-TCP -ErrorAction SilentlyContinue)) { New-NetFirewallRule -Name OpenSSH-Server-In-TCP -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22 }"];function windowsAuthorizeKeySteps(publicKey){let key=psQuote(publicKey.trim());return["# Administrator account (elevated PowerShell):",`Add-Content -Path "$env:ProgramData\\ssh\\administrators_authorized_keys" -Value ${key}`,'icacls.exe "$env:ProgramData\\ssh\\administrators_authorized_keys" /inheritance:r /grant "*S-1-5-32-544:F" /grant "SYSTEM:F"',"# Standard account (normal PowerShell):",`New-Item -ItemType Directory -Force "$HOME\\.ssh" | Out-Null; Add-Content -Path "$HOME\\.ssh\\authorized_keys" -Value ${key}`]}var PATTERNS=[["host-key-changed",/REMOTE HOST IDENTIFICATION HAS CHANGED|Host key for .* has changed/i],["host-key-unverified",/Host key verification failed|No .*host key is known for/i],["auth-denied",/Permission denied \(|Too many authentication failures|no matching host key type/i],["unresolved",/Could not resolve hostname|Name or service not known|nodename nor servname/i],["refused",/Connection refused/i],["timeout",/timed out|Operation timed out|No route to host|Network is unreachable/i]];function classifySshFailure(stderr){for(let[kind,pattern]of PATTERNS)if(pattern.test(stderr))return kind;return"unknown"}function sshFailureRemedy(kind,target,windows=!1){if(windows&&(kind==="refused"||kind==="timeout"))return[`${target} (Windows) ${kind==="refused"?"refused the connection: its OpenSSH Server is not running":"did not answer on the ssh port: its OpenSSH Server is off, or the firewall drops it"}.`,"In an elevated PowerShell there:",...WINDOWS_SSHD_STEPS.map((step)=>` ${step}`)].join(`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{binaryAvailable,resolveEditorCommand}from"./chunk-agvtzads.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-6xppe9bj.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-7kysxgbq.js";import"./chunk-bejhca6z.js";import
|
|
2
|
+
import{binaryAvailable,resolveEditorCommand}from"./chunk-agvtzads.js";import"./chunk-rfp0ayra.js";import"./chunk-40dgv828.js";import"./chunk-6xppe9bj.js";import"./chunk-7mwvvj46.js";import"./chunk-32j6y5d1.js";import"./chunk-7kysxgbq.js";import"./chunk-bejhca6z.js";import"./chunk-br8r72bf.js";import"./chunk-yt15y085.js";import{kvStatePath}from"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-pn5ygqn6.js";import"./chunk-eqdbfgq5.js";import"./chunk-f8gg8cqh.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";import{existsSync,mkdirSync,writeFileSync}from"fs";import{dirname}from"path";var CLI_NAME=ROVE_PRODUCT_NAME;function printUsage(out){out.write([`Usage: ${CLI_NAME} config [--path]`,"","Open Rove's user config (state.json \u2014 theme, locale, engine + editor prefs)","in your editor. The editor is your configured one (Settings \u2192 General \u2192","Editor); left on Auto it is $VISUAL / $EDITOR, else the first of","nvim / vim / emacs / nano.","Rove re-reads the file on its next launch.","","Options:"," --path Print the config file path and exit (don't open an editor)"," -h, --help Print this help",""].join(`
|
|
3
3
|
`))}async function runConfigSubcommand(argv=[]){if(argv.some((a)=>a==="-h"||a==="--help"||a==="help")){printUsage(process.stdout);return}let path=kvStatePath();if(argv.some((a)=>a==="--path"||a==="path")){console.log(path);return}let unknown=argv.find((a)=>a.length>0);if(unknown!==void 0)process.stderr.write(`${CLI_NAME} config: unexpected argument "${unknown}"
|
|
4
4
|
`),printUsage(process.stderr),process.exit(2);if(!existsSync(path))mkdirSync(dirname(path),{recursive:!0}),writeFileSync(path,`{}
|
|
5
5
|
`);let resolved=await resolveEditorCommand(path);if(!resolved||!await binaryAvailable(resolved.bin))process.stderr.write(`${CLI_NAME} config: no editor found \u2014 set $EDITOR (or Settings \u2192 General \u2192 Editor), or edit directly:
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{userThemesDir,validateTheme}from"./chunk-
|
|
2
|
+
import{userThemesDir,validateTheme}from"./chunk-kxp04jnp.js";import{existsSync,mkdirSync,writeFileSync}from"fs";import{join}from"path";var HOSTED_THEMES=["catppuccin","dracula","everforest","gruvbox","kanagawa","nord","opencode","osaka-jade","rose-pine","solarized"],hostedThemeUrl=(name)=>`https://rove.run/themes/${name}.json`;class ThemeInstallError extends Error{}function parseTheme(text){let parsed;try{parsed=JSON.parse(text)}catch(err){throw new ThemeInstallError(`source is not valid JSON: ${err instanceof Error?err.message:String(err)}`)}let result=validateTheme(parsed);if(!result.ok)throw new ThemeInstallError(`source is not a valid Rove theme: ${result.reason}`);return result.theme}function isThemeName(name){return!!name&&/^[a-zA-Z0-9._-]+$/.test(name)&&name!=="."&&name!==".."}function writeUserTheme(name,theme,force){if(!isThemeName(name))throw new ThemeInstallError(`invalid theme name "${name}" (use letters, digits, '.', '_', '-')`);let dir=userThemesDir();mkdirSync(dir,{recursive:!0});let dest=join(dir,`${name}.json`);if(existsSync(dest)&&!force)throw new ThemeInstallError(`${dest} already exists (pass --force to overwrite)`);return writeFileSync(dest,`${JSON.stringify(theme,null,2)}
|
|
3
3
|
`,"utf8"),dest}
|
|
4
4
|
export{HOSTED_THEMES,hostedThemeUrl,ThemeInstallError,parseTheme,isThemeName,writeUserTheme};
|