@sma1lboy/rove 0.9.296-next.328 → 0.9.296-next.331
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-8pvh2fff.js → chunk-09tyy8gw.js} +3 -3
- package/dist/cli/{chunk-bdbm8jkd.js → chunk-0kbd6nzm.js} +1 -1
- package/dist/cli/{chunk-f1wh362h.js → chunk-0xk05694.js} +1 -1
- package/dist/cli/{chunk-awmb1vzd.js → chunk-1hydxa8k.js} +1 -1
- package/dist/cli/{chunk-e9gnt61v.js → chunk-2bgb2810.js} +1 -1
- package/dist/cli/{chunk-7kgksv06.js → chunk-2z2jwetd.js} +2 -2
- package/dist/cli/{chunk-6pfeq5mx.js → chunk-3193p75b.js} +1 -1
- package/dist/cli/{chunk-2t0wxzcc.js → chunk-352dhjkf.js} +1 -1
- package/dist/cli/{chunk-t6q1we78.js → chunk-38w60dmy.js} +1 -1
- package/dist/cli/{chunk-4eh8ts01.js → chunk-3pbbf6hf.js} +1 -1
- package/dist/cli/chunk-44h0mhsa.js +2 -0
- package/dist/cli/chunk-49zh8bgk.js +2 -0
- package/dist/cli/{chunk-ncn022hs.js → chunk-4hvacnnr.js} +1 -1
- package/dist/cli/{chunk-77xn441d.js → chunk-4n7s5h9s.js} +1 -1
- package/dist/cli/{chunk-7f02vk0v.js → chunk-4rebycv9.js} +1 -1
- package/dist/cli/{chunk-ceg2g6ce.js → chunk-4sfdr0qw.js} +2 -2
- package/dist/cli/{chunk-c0fd63tg.js → chunk-4vbk9z6n.js} +1 -1
- package/dist/cli/{chunk-fv2j6zvm.js → chunk-53eqkfas.js} +1 -1
- package/dist/cli/{chunk-yfwn3fj5.js → chunk-5c591htx.js} +1 -1
- package/dist/cli/chunk-5drk7d2z.js +2 -0
- package/dist/cli/{chunk-6zxjc0et.js → chunk-5g01tqn6.js} +5 -5
- package/dist/cli/{chunk-mezp33qp.js → chunk-5jd2z8n0.js} +1 -1
- package/dist/cli/{chunk-arqemcjt.js → chunk-5wjskd40.js} +1 -1
- package/dist/cli/{chunk-wgk3dkq9.js → chunk-66vj434n.js} +3 -3
- package/dist/cli/chunk-6br2a2ze.js +2 -0
- package/dist/cli/{chunk-x58p36jn.js → chunk-6cmqh134.js} +1 -1
- package/dist/cli/{chunk-nps8009r.js → chunk-6dk6zcqm.js} +1 -1
- package/dist/cli/{chunk-gagrapmj.js → chunk-6evkd8be.js} +1 -1
- package/dist/cli/{chunk-da2j4tx2.js → chunk-75b4cgbz.js} +1 -1
- package/dist/cli/chunk-7cptm3td.js +2 -0
- package/dist/cli/chunk-7fxadh60.js +2 -0
- package/dist/cli/{chunk-cj4t4q1r.js → chunk-7j7sdn4p.js} +1 -1
- package/dist/cli/{chunk-m781veb4.js → chunk-7m3txy05.js} +1 -1
- package/dist/cli/{chunk-s8hc0wfr.js → chunk-7wwdcw8e.js} +2 -2
- package/dist/cli/{chunk-r79nb3kg.js → chunk-8cw8zznb.js} +1 -1
- package/dist/cli/{chunk-ynzyrjks.js → chunk-8ejt1bqj.js} +1 -1
- package/dist/cli/chunk-8hcmyjjn.js +2 -0
- package/dist/cli/{chunk-6xzx53b7.js → chunk-8q0nr6v6.js} +1 -1
- package/dist/cli/{chunk-p84bhs57.js → chunk-8trtyc98.js} +1 -1
- package/dist/cli/{chunk-29b3pj9h.js → chunk-8wfz7gyp.js} +1 -1
- package/dist/cli/{chunk-4tah26ys.js → chunk-95tzjzgb.js} +1 -1
- package/dist/cli/{chunk-k9a2b00g.js → chunk-9bhf8tkd.js} +3 -3
- package/dist/cli/{chunk-mw6rdm3k.js → chunk-9gevsmy4.js} +1 -1
- package/dist/cli/{chunk-yfzfbqp5.js → chunk-9we0f035.js} +1 -1
- package/dist/cli/{chunk-qbxpecq4.js → chunk-9wre0m8x.js} +1 -1
- package/dist/cli/chunk-a1scaehn.js +2 -0
- package/dist/cli/chunk-a2z0b48q.js +2 -0
- package/dist/cli/{chunk-k0yjcgd8.js → chunk-apaw34c5.js} +1 -1
- package/dist/cli/{chunk-jxc240wh.js → chunk-avf521sy.js} +1 -1
- package/dist/cli/{chunk-vd36r76s.js → chunk-b53drx76.js} +1 -1
- package/dist/cli/{chunk-p525sfz5.js → chunk-bk2vb6jj.js} +1 -1
- package/dist/cli/{chunk-nr8pxs18.js → chunk-bkhbaqt1.js} +1 -1
- package/dist/cli/chunk-c5w5t1t8.js +2 -0
- package/dist/cli/{chunk-7dmcpc3d.js → chunk-c5xnhy0v.js} +1 -1
- package/dist/cli/{chunk-85hmnbh1.js → chunk-c70kbg4m.js} +1 -1
- package/dist/cli/{chunk-s00k8tn6.js → chunk-cqzkk7j0.js} +1 -1
- package/dist/cli/{chunk-f26k5yqw.js → chunk-d63mrw6g.js} +1 -1
- package/dist/cli/{chunk-ewdanfd9.js → chunk-dvpjthdf.js} +1 -1
- package/dist/cli/chunk-dxyy3ep8.js +2 -0
- package/dist/cli/chunk-dz562xtj.js +2 -0
- package/dist/cli/{chunk-g8wzy7mn.js → chunk-e3bqjaff.js} +1 -1
- package/dist/cli/{chunk-5frd2aze.js → chunk-eaav6ajz.js} +1 -1
- package/dist/cli/{chunk-k3n95g00.js → chunk-etac300d.js} +1 -1
- package/dist/cli/{chunk-fjw8qqpz.js → chunk-f5hhhn3x.js} +1 -1
- package/dist/cli/{chunk-xwbntnv8.js → chunk-fhejs7ph.js} +1 -1
- package/dist/cli/{chunk-zbnw68pg.js → chunk-fj8awvx3.js} +2 -2
- package/dist/cli/{chunk-aw0rz15f.js → chunk-fqm68m42.js} +1 -1
- package/dist/cli/{chunk-nd5bhfxv.js → chunk-g37q36fs.js} +1 -1
- package/dist/cli/{chunk-hkqcc1t4.js → chunk-g5jc6c2d.js} +1 -1
- package/dist/cli/{chunk-wevvztwk.js → chunk-gceeh3yr.js} +1 -1
- package/dist/cli/chunk-h57gekkj.js +2 -0
- package/dist/cli/{chunk-m45b6d19.js → chunk-h72tns53.js} +1 -1
- package/dist/cli/{chunk-8yce2acw.js → chunk-jhnpr3cj.js} +1 -1
- package/dist/cli/{chunk-vda9epmy.js → chunk-jjc3v2zc.js} +1 -1
- package/dist/cli/{chunk-w8da1czv.js → chunk-jt9n8k7z.js} +1 -1
- package/dist/cli/{chunk-a1bzaw1b.js → chunk-jyakk1ah.js} +2 -2
- package/dist/cli/{chunk-hg0eck4e.js → chunk-kdf7cq06.js} +7 -7
- package/dist/cli/chunk-kvj8s9ck.js +2 -0
- package/dist/cli/{chunk-tygdsqwk.js → chunk-m5s8vn56.js} +1 -1
- package/dist/cli/{chunk-xejbrtx2.js → chunk-m6kw77w3.js} +1 -1
- package/dist/cli/{chunk-ev45vka6.js → chunk-m9ssmhrc.js} +1 -1
- package/dist/cli/chunk-mdx18vtz.js +3 -0
- package/dist/cli/{chunk-bfvfche3.js → chunk-mf2p3p9k.js} +1 -1
- package/dist/cli/{chunk-kvf0qqye.js → chunk-msgr4fes.js} +1 -1
- package/dist/cli/{chunk-86ssev5h.js → chunk-mx2smec1.js} +1 -1
- package/dist/cli/{chunk-86fzfqvw.js → chunk-mz82b1jf.js} +1 -1
- package/dist/cli/{chunk-8xtc0gqb.js → chunk-n1nt3zx9.js} +1 -1
- package/dist/cli/chunk-n2hz851r.js +2 -0
- package/dist/cli/{chunk-pn3tpqam.js → chunk-nawvr7j5.js} +1 -1
- package/dist/cli/{chunk-s8d3d2c2.js → chunk-ne7bbq1z.js} +5 -5
- package/dist/cli/{chunk-tcq7zep6.js → chunk-nv64scpb.js} +1 -1
- package/dist/cli/{chunk-dkcgm1cx.js → chunk-p2h4we4w.js} +1 -1
- package/dist/cli/chunk-p8te8w0d.js +2 -0
- package/dist/cli/chunk-pcmd0ydw.js +2 -0
- package/dist/cli/chunk-pferbnyr.js +2 -0
- package/dist/cli/{chunk-kfak0axd.js → chunk-pywaz045.js} +1 -1
- package/dist/cli/{chunk-3qg5wjnq.js → chunk-q5ncrh80.js} +1 -1
- package/dist/cli/{chunk-zb50xk9t.js → chunk-qcces6e3.js} +1 -1
- package/dist/cli/{chunk-fcs8szn5.js → chunk-qcdznw50.js} +1 -1
- package/dist/cli/{chunk-1tmmkk54.js → chunk-qdatysve.js} +1 -1
- package/dist/cli/{chunk-zgcfzfq3.js → chunk-qg92cfsh.js} +1 -1
- package/dist/cli/{chunk-857zfv82.js → chunk-qgf01sm2.js} +1 -1
- package/dist/cli/chunk-qjr36jpm.js +2 -0
- package/dist/cli/chunk-qpncf5as.js +2 -0
- package/dist/cli/{chunk-vn6brdp7.js → chunk-qqc8mn6x.js} +1 -1
- package/dist/cli/{chunk-7p8pb8c5.js → chunk-r271mcer.js} +1 -1
- package/dist/cli/{chunk-qa3dghyt.js → chunk-r7khfa3k.js} +1 -1
- package/dist/cli/{chunk-b8dr13gm.js → chunk-rr0cjy1v.js} +1 -1
- package/dist/cli/{chunk-9y21c892.js → chunk-s9j0sbmf.js} +1 -1
- package/dist/cli/chunk-sj0h67ht.js +2 -0
- package/dist/cli/{chunk-dsq5eqd5.js → chunk-t1vbw2me.js} +1 -1
- package/dist/cli/{chunk-5wjs7phr.js → chunk-t74ptmvq.js} +1 -1
- package/dist/cli/{chunk-rgz4m509.js → chunk-t7thxgcc.js} +1 -1
- package/dist/cli/chunk-tjtgks9k.js +2 -0
- package/dist/cli/chunk-v8e5smwe.js +2 -0
- package/dist/cli/{chunk-102yytay.js → chunk-v9n5e14e.js} +1 -1
- package/dist/cli/{chunk-5m8v3c29.js → chunk-vyh3ddp0.js} +1 -1
- package/dist/cli/{chunk-88cap497.js → chunk-w56terew.js} +1 -1
- package/dist/cli/chunk-wf5q5wm0.js +2 -0
- package/dist/cli/{chunk-qdf11nnb.js → chunk-wg9agpvf.js} +4 -4
- package/dist/cli/chunk-x8nc6bc2.js +2 -0
- package/dist/cli/{chunk-b0szsxbc.js → chunk-xxz504p6.js} +1 -1
- package/dist/cli/{chunk-49zrnjq1.js → chunk-y0skz8j9.js} +1 -1
- package/dist/cli/{chunk-b6ds8yfb.js → chunk-y2pt0wa6.js} +1 -1
- package/dist/cli/{chunk-vfrxywtx.js → chunk-y8hjgmn0.js} +1 -1
- package/dist/cli/{chunk-6r74n1g2.js → chunk-ywwg5zxs.js} +1 -1
- package/dist/cli/{chunk-s5ymevzg.js → chunk-yzdpmamq.js} +1 -1
- package/dist/cli/{chunk-ym33391g.js → chunk-z3k0wg31.js} +1 -1
- package/dist/cli/{chunk-mg9rjc2f.js → chunk-z538fdny.js} +1 -1
- package/dist/cli/{chunk-md47as1y.js → chunk-zjxz2v8a.js} +1 -1
- package/dist/cli/index.js +7 -7
- package/dist/cli/rove-run.js +1 -1
- package/dist/cli/rove.js +1 -1
- package/dist/skills/rove/SKILL.md +77 -1
- package/dist/skills/rove/references/api-flags.md +1 -1
- package/dist/web/assets/{index-DXX0TiVw.js → index-BugGU1Rz.js} +36 -36
- package/dist/web/assets/index-DBXOSxIY.css +1 -0
- package/dist/web/assets/{term-mount-C5szHrI9.js → term-mount-DnP2B2rY.js} +1 -1
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/cli/chunk-0e0dd4gt.js +0 -2
- package/dist/cli/chunk-3qmb3hhp.js +0 -2
- package/dist/cli/chunk-44msqtz9.js +0 -2
- package/dist/cli/chunk-4cr4pb6t.js +0 -2
- package/dist/cli/chunk-4fsdtw4r.js +0 -2
- package/dist/cli/chunk-6mxck5m6.js +0 -2
- package/dist/cli/chunk-6xhvprnc.js +0 -2
- package/dist/cli/chunk-atn06ncf.js +0 -3
- package/dist/cli/chunk-b6xrkzhj.js +0 -2
- package/dist/cli/chunk-dtb0dqwh.js +0 -2
- package/dist/cli/chunk-fftmsc4z.js +0 -2
- package/dist/cli/chunk-gsqphkca.js +0 -2
- package/dist/cli/chunk-gw9kzc63.js +0 -2
- package/dist/cli/chunk-h8m26j04.js +0 -2
- package/dist/cli/chunk-hq76ge1j.js +0 -2
- package/dist/cli/chunk-k4c7aqtj.js +0 -2
- package/dist/cli/chunk-pne75syz.js +0 -2
- package/dist/cli/chunk-q6t3gcs1.js +0 -2
- package/dist/cli/chunk-qb7jzw8e.js +0 -2
- package/dist/cli/chunk-r92mwjet.js +0 -2
- package/dist/cli/chunk-s84z30t2.js +0 -2
- package/dist/cli/chunk-ta9w2w9k.js +0 -2
- package/dist/cli/chunk-ts3q3a8a.js +0 -2
- package/dist/cli/chunk-vddmgpdz.js +0 -2
- package/dist/cli/chunk-wcwzvssh.js +0 -2
- package/dist/cli/chunk-znbtn8b8.js +0 -2
- package/dist/web/assets/index-DcF7AQIK.css +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{PLUGIN_MANIFEST_FILENAMES,currentPluginPlatform,loadPluginRegistry,parsePluginManifest,pluginManifestPath,savePluginRegistry,supportsPlatform,upsertPluginEntry}from"./chunk-psxhek7n.js";import{CURRENT_VERSION,compareSemver}from"./chunk-
|
|
2
|
+
import{PLUGIN_MANIFEST_FILENAMES,currentPluginPlatform,loadPluginRegistry,parsePluginManifest,pluginManifestPath,savePluginRegistry,supportsPlatform,upsertPluginEntry}from"./chunk-psxhek7n.js";import{CURRENT_VERSION,compareSemver}from"./chunk-qqc8mn6x.js";import{pluginCheckoutDir,pluginConfigDir,pluginStateDir,pluginsRootDir}from"./chunk-ws2q07kb.js";import{spawn}from"child_process";import{cpSync,existsSync,mkdirSync,readFileSync,renameSync,rmSync}from"fs";import{mkdtempSync}from"fs";import{basename,join,resolve}from"path";import{createInterface}from"readline/promises";var GITHUB_SPEC_RE=/^([A-Za-z0-9-]+)\/([A-Za-z0-9._-]+)(\/.+)?$/;class PluginCliError extends Error{}function fail(message){throw new PluginCliError(message)}function readManifestAt(root){let path=pluginManifestPath(root);if(!path)fail(`no ${PLUGIN_MANIFEST_FILENAMES.join(" or ")} found at ${root}`);let source=readFileSync(path,"utf8");return{...parsePluginManifest(source,basename(path)),manifestPath:path,manifestSource:source}}function checkVersionGate(parsed){let min=parsed.manifest.minRoveVersion;if(compareSemver(CURRENT_VERSION,min)<0)fail(`plugin requires Rove >= ${min} (this is ${CURRENT_VERSION}); update Rove first`)}function commandLines(parsed){let m=parsed.manifest,lines=[];for(let c of m.build)lines.push(`build: ${c.command.join(" ")}`);for(let c of m.startup)lines.push(`startup: ${c.command.join(" ")}`);for(let a of m.actions)lines.push(`action ${a.id}: ${a.command.join(" ")}`);for(let e of m.events)lines.push(`on ${e.on}: ${e.command.join(" ")}`);return lines}var CAPTURE_TAIL_BYTES=4096;function run(cmd,args,opts){return new Promise((resolve2)=>{let child=spawn(cmd,args,{cwd:opts.cwd,stdio:opts.inherit?["ignore","inherit","inherit"]:["ignore","pipe","pipe"]}),output="",collect=(chunk)=>{output=`${output}${String(chunk)}`.slice(-CAPTURE_TAIL_BYTES)};child.stdout?.on("data",collect),child.stderr?.on("data",collect),child.on("error",(err)=>resolve2({code:null,output:`${output}${err.message}`})),child.on("close",(code)=>resolve2({code,output}))})}function outputTail(output){let trimmed=output.trim();return trimmed?`: ${trimmed.split(`
|
|
3
3
|
`).slice(-3).join(" / ")}`:""}async function git(args,opts){let{code,output}=await run("git",args,opts);if(code!==0)fail(`git ${args[0]} failed${outputTail(output)}`)}async function runBuildCommands(parsed,root,opts){let platform=currentPluginPlatform();for(let[i,step]of parsed.manifest.build.entries()){if(!supportsPlatform(step,parsed.manifest,platform))continue;let[cmd,...args]=step.command;if(opts.inherit)console.log(`build[${i}]: ${step.command.join(" ")}`);let{code,output}=await run(cmd,args,{cwd:root,inherit:opts.inherit});if(code!==0)fail(`build[${i}] failed (exit ${code??"spawn error"}); plugin not registered${outputTail(output)}`)}}function makeStagingDir(){let root=pluginsRootDir();return mkdirSync(root,{recursive:!0}),mkdtempSync(join(root,".staging-"))}function movePluginTree(from,to){try{renameSync(from,to)}catch(err){if(err.code!=="EXDEV")throw err;cpSync(from,to,{recursive:!0,verbatimSymlinks:!0}),rmSync(from,{recursive:!0,force:!0})}}function register(entry){savePluginRegistry(upsertPluginEntry(loadPluginRegistry(),entry)),mkdirSync(pluginConfigDir(entry.id),{recursive:!0,mode:448}),mkdirSync(pluginStateDir(entry.id),{recursive:!0,mode:448})}async function preparePluginInstall(spec,opts={}){let match=spec.match(GITHUB_SPEC_RE);if(!match)fail(`install takes GitHub shorthand (owner/repo[/subdir]), got \`${spec}\``);let[,owner,repo,subdirRaw]=match,subdir=subdirRaw?.replace(/^\//,""),inherit=opts.inherit??!1,tmp=makeStagingDir();try{let url=`https://github.com/${owner}/${repo}.git`;if(inherit)console.log(`cloning ${url}${opts.ref?` @ ${opts.ref}`:""}`);if(opts.ref)await git(["clone","--quiet",url,tmp],{inherit}),await git(["checkout","--quiet",opts.ref],{cwd:tmp,inherit});else await git(["clone","--quiet","--depth","1",url,tmp],{inherit});let rootInClone=subdir?join(tmp,subdir):tmp,parsed=readManifestAt(rootInClone);checkVersionGate(parsed);let id=parsed.manifest.id,existing=loadPluginRegistry().plugins.find((p)=>p.id===id);if(existing?.source.kind==="link")fail(`\`${id}\` is locally linked at ${existing.root}; unlink it first`);if(!supportsPlatform({},parsed.manifest,currentPluginPlatform()))fail(`plugin declares platforms [${parsed.manifest.platforms?.join(", ")}]; this machine is unsupported`);return{preview:{id,name:parsed.manifest.name,version:parsed.manifest.version,description:parsed.manifest.description??null,source:`github.com/${owner}/${repo}${subdir?`/${subdir}`:""}`,commands:commandLines(parsed),warnings:parsed.warnings},commit:async()=>{try{await runBuildCommands(parsed,rootInClone,{inherit});let manifestPath=pluginManifestPath(rootInClone);if(!manifestPath)fail("manifest disappeared during build; aborting");if(manifestPath!==parsed.manifestPath)fail("manifest changed during build; aborting");if(readFileSync(manifestPath,"utf8")!==parsed.manifestSource)fail("manifest changed during build; aborting");let checkout=pluginCheckoutDir(id);return rmSync(checkout,{recursive:!0,force:!0}),mkdirSync(join(checkout,".."),{recursive:!0}),movePluginTree(tmp,checkout),register({id,source:{kind:"github",spec},root:subdir?join(checkout,subdir):checkout,enabled:!0,version:parsed.manifest.version,installedAt:Date.now()}),id}finally{rmSync(tmp,{recursive:!0,force:!0})}},discard:()=>rmSync(tmp,{recursive:!0,force:!0})}}catch(err){throw rmSync(tmp,{recursive:!0,force:!0}),err}}function printPreview(preview){console.log(`
|
|
4
4
|
${preview.name} (${preview.id}) v${preview.version} \u2014 ${preview.description??"no description"}`),console.log(`source: ${preview.source}`);for(let line of preview.commands)console.log(` ${line}`);for(let w of preview.warnings)console.log(` warning: ${w}`);console.log("")}async function confirmOrBail(yes){if(yes)return;if(!process.stdin.isTTY)fail("refusing to install without confirmation in a non-interactive terminal; pass --yes");let rl=createInterface({input:process.stdin,output:process.stdout}),answer=(await rl.question("Install this plugin and run its build commands? [y/N] ")).trim().toLowerCase();if(rl.close(),answer!=="y"&&answer!=="yes")fail("aborted")}async function installPlugin(spec,opts){let prepared=await preparePluginInstall(spec,{ref:opts.ref,inherit:!0});printPreview(prepared.preview);try{await confirmOrBail(opts.yes)}catch(err){throw prepared.discard(),err}let id=await prepared.commit();return console.log(`installed ${id} v${prepared.preview.version}`),id}function linkPlugin(dir){let root=resolve(dir);if(!existsSync(root))fail(`no such directory: ${root}`);let parsed=readManifestAt(root);checkVersionGate(parsed);let id=parsed.manifest.id;if(loadPluginRegistry().plugins.find((p)=>p.id===id)?.source.kind==="github")fail(`\`${id}\` is installed from GitHub; uninstall it before linking a local copy`);for(let w of parsed.warnings)console.log(`warning: ${w}`);if(!supportsPlatform({},parsed.manifest,currentPluginPlatform()))console.log(`warning: declares platforms [${parsed.manifest.platforms?.join(", ")}]; nothing will run on this machine`);register({id,source:{kind:"link"},root,enabled:!0,version:parsed.manifest.version,installedAt:Date.now()}),console.log(`linked ${id} v${parsed.manifest.version} \u2192 ${root}`)}
|
|
5
5
|
export{PluginCliError,preparePluginInstall,installPlugin,linkPlugin};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{isWindowsMachine,localDaemonSocketPath,localPtySocketPath,machineSocketDir,machineSshArgs,remoteRove}from"./chunk-
|
|
2
|
+
import{isWindowsMachine,localDaemonSocketPath,localPtySocketPath,machineSocketDir,machineSshArgs,remoteRove}from"./chunk-7m3txy05.js";import{RoveDaemonClient}from"./chunk-8wfz7gyp.js";import{logClientError}from"./chunk-y8hjgmn0.js";import{homeDir}from"./chunk-8143k3t6.js";import{spawn as spawn2}from"child_process";import{mkdirSync as mkdirSync2,rmSync as rmSync2}from"fs";import{connect as netConnect}from"net";import{spawn}from"child_process";import{mkdirSync,rmSync}from"fs";import{createServer}from"net";var RELAY_PREAMBLE=`\x00rove-relay-ready\x00
|
|
3
3
|
`,MARKER=Buffer.from(`\x00rove-relay-ready\x00
|
|
4
4
|
`,"utf8");class PreambleStripper{pending=Buffer.alloc(0);seen=0;push(chunk){if(this.pending===null)return chunk;this.seen+=chunk.length;let joined=Buffer.concat([this.pending,chunk]),at=joined.indexOf(MARKER);if(at>=0)return this.pending=null,joined.subarray(at+MARKER.length);if(this.seen>1048576)return null;return this.pending=joined.subarray(Math.max(0,joined.length-(MARKER.length-1))),Buffer.alloc(0)}}function useStdioTransport(platform=process.platform,machine={}){return platform==="win32"||process.env.ROVE_MACHINE_TRANSPORT==="stdio"||isWindowsMachine(machine)}function relayCommand(machine,pty){let flags=[...pty?["--pty"]:[],...machine.relayPreamble?["--preamble"]:[]];return remoteRove(machine.roveBin,["daemon","relay",...flags])}var servers=new Map;function serve(path,argv,preamble){if(servers.has(path))return Promise.resolve();let server=createServer((conn)=>{let[cmd,...args]=argv,child=spawn(cmd??"ssh",args,{stdio:["pipe","pipe","ignore"],windowsHide:!0});conn.pipe(child.stdin);let end=()=>{conn.destroy(),child.kill()};if(preamble){let stripper=new PreambleStripper;child.stdout?.on("data",(chunk)=>{let out=stripper.push(chunk);if(out===null)end();else if(out.length>0)conn.write(out)})}else child.stdout?.pipe(conn);conn.on("close",()=>child.kill()),conn.on("error",end),child.on("exit",()=>conn.end()),child.on("error",(err)=>{logClientError("machines",err),end()})});return servers.set(path,server),new Promise((resolve,reject)=>{server.once("error",(err)=>{servers.delete(path),reject(err)}),rmSync(path,{force:!0}),server.unref(),server.listen(path,()=>resolve())})}async function relayAnswers(alias,home){let client=new RoveDaemonClient(localDaemonSocketPath(alias,home));try{return await client.request("hello",{}),!0}catch{return!1}finally{client.close()}}async function ensureStdioForwards(args){mkdirSync(machineSocketDir(args.alias,args.home),{recursive:!0});let ssh=machineSshArgs(args.alias,args.config,{home:args.home}),preamble=args.config.relayPreamble===!0;await serve(localDaemonSocketPath(args.alias,args.home),[...ssh,relayCommand(args.config,!1)],preamble),await serve(localPtySocketPath(args.alias,args.home),[...ssh,relayCommand(args.config,!0)],preamble)}function stopStdioForwards(alias,home){for(let path of[localDaemonSocketPath(alias,home),localPtySocketPath(alias,home)])servers.get(path)?.close(),servers.delete(path)}var DIR_MODE=448,BACKOFF_START_MS=500,BACKOFF_MAX_MS=5000,HEALTH_INTERVAL_MS=1e4;function startTunnel(opts){let home=opts.home??homeDir(),daemonSocketPath=localDaemonSocketPath(opts.alias,home),ptySocketPath=localPtySocketPath(opts.alias,home),listeners=new Set,state="connecting",stopped=!1,backoff=BACKOFF_START_MS,setState=(next)=>{if(state===next)return;state=next;for(let listener of listeners)listener(next)},handle={alias:opts.alias,daemonSocketPath,ptySocketPath,state:()=>state,onState:(listener)=>{return listeners.add(listener),()=>listeners.delete(listener)},stop:()=>{if(stopped=!0,useStdioTransport(void 0,opts.config))stopStdioForwards(opts.alias,home)}},schedule=opts.setTimeoutFn??((fn,ms)=>setTimeout(fn,ms)),stdio=()=>ensureStdioForwards({alias:opts.alias,config:opts.config,home}).then(()=>relayAnswers(opts.alias,home)).catch(()=>!1),ensure=opts.ensureFn??(useStdioTransport(void 0,opts.config)?stdio:()=>ensureForwards({alias:opts.alias,config:opts.config,remoteDaemonSocket:opts.remoteDaemonSocket,remotePtySocket:opts.remotePtySocket,home})),check=opts.checkFn??(()=>socketAnswers(daemonSocketPath)),attempt=async()=>{if(stopped)return;let up=await ensure();if(stopped)return;if(up){backoff=BACKOFF_START_MS,setState("online"),schedule(()=>void health(),HEALTH_INTERVAL_MS);return}setState("offline");let wait=backoff;backoff=Math.min(backoff*2,BACKOFF_MAX_MS),schedule(()=>void attempt(),wait)},health=async()=>{if(stopped)return;if(await check()){if(!stopped)schedule(()=>void health(),HEALTH_INTERVAL_MS);return}setState("offline"),attempt()};return attempt(),handle}async function ensureForwards(args){let home=args.home??homeDir();if(useStdioTransport(void 0,args.config))return ensureStdioForwards({alias:args.alias,config:args.config,home}).then(()=>relayAnswers(args.alias,home)).catch(()=>!1);let daemonLocal=localDaemonSocketPath(args.alias,home),ptyLocal=localPtySocketPath(args.alias,home);try{mkdirSync2(machineSocketDir(args.alias,home),{recursive:!0,mode:DIR_MODE})}catch{}if(await socketAnswers(daemonLocal))return!0;for(let path of[daemonLocal,ptyLocal])try{rmSync2(path,{force:!0})}catch{}let base=machineSshArgs(args.alias,args.config,{home});if(await runSsh([...base,"true"])!==0)return!1;let target=base.at(-1)??args.alias,flags=base.slice(0,-1);return await runSsh([...flags,"-O","forward","-L",`${daemonLocal}:${args.remoteDaemonSocket}`,"-L",`${ptyLocal}:${args.remotePtySocket}`,target])===0&&await socketAnswers(daemonLocal)}function runSsh(argv){return new Promise((resolve)=>{let child=spawn2(argv[0]??"ssh",argv.slice(1),{stdio:"ignore"});child.on("error",()=>resolve(-1)),child.on("close",(code)=>resolve(code??-1))})}function socketAnswers(path){return new Promise((resolve)=>{let socket=netConnect(path),done=(answer)=>{socket.destroy(),resolve(answer)};socket.once("connect",()=>done(!0)),socket.once("error",()=>done(!1)),socket.setTimeout(1500,()=>done(!1))})}
|
|
5
5
|
export{RELAY_PREAMBLE,startTunnel,ensureForwards};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{AUTO_MACHINE,LOCAL_MACHINE,addStaysHere,autoMachineFor,forwardVerb,invokeRouted,machineDaemonSocket,machineLoad,machinePtySocket,machineTasks,pickMachine,repoHosts,repoWanted,requireMachine,routeTarget}from"./chunk-0xk05694.js";import"./chunk-bkhbaqt1.js";import"./chunk-7m3txy05.js";import"./chunk-y0e28qha.js";import"./chunk-m6kw77w3.js";import"./chunk-6jcmdxza.js";import"./chunk-m9ssmhrc.js";import"./chunk-han0d078.js";import"./chunk-jz1kj4sf.js";import"./chunk-v8nbqjwc.js";import"./chunk-ws2q07kb.js";import"./chunk-g9ba25q5.js";import"./chunk-cqzkk7j0.js";import"./chunk-catrr0z3.js";import"./chunk-dvpjthdf.js";import"./chunk-tn9gtf18.js";import"./chunk-r7khfa3k.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-zsfyj36g.js";import"./chunk-1feav1w3.js";import"./chunk-vpph4nqf.js";import"./chunk-cmp64q4j.js";import"./chunk-8cw8zznb.js";import"./chunk-z3k0wg31.js";import"./chunk-4hvacnnr.js";import"./chunk-w7zv47mp.js";import"./chunk-mz82b1jf.js";import"./chunk-jhnpr3cj.js";import"./chunk-w56terew.js";import"./chunk-8wfz7gyp.js";import"./chunk-96kvwzj8.js";import"./chunk-v9n5e14e.js";import"./chunk-40dgv828.js";import"./chunk-9gctbddn.js";import"./chunk-mg1cas61.js";import"./chunk-8trtyc98.js";import"./chunk-g5jc6c2d.js";import"./chunk-qdatysve.js";import"./chunk-7kysxgbq.js";import"./chunk-5c591htx.js";import"./chunk-y8hjgmn0.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-pn5ygqn6.js";import"./chunk-7ghwdjdc.js";import"./chunk-m5nd44st.js";import"./chunk-jt9n8k7z.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-1mp632fj.js";import"./chunk-91sykzqq.js";export{routeTarget,requireMachine,repoWanted,repoHosts,pickMachine,machineTasks,machinePtySocket,machineLoad,machineDaemonSocket,invokeRouted,forwardVerb,autoMachineFor,addStaysHere,LOCAL_MACHINE,AUTO_MACHINE};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{StaleInstallError,autospawnDaemonEnv,connectIfRunning,connectOrStartDaemon,daemonSpawnReason,ensureDaemonReachable,isStaleInstallError,probeDaemonSocket,resolveRoveSpawn,restartDaemon,systemdUnitOf,testDaemonResponds,tryAcquireSpawnLock}from"./chunk-
|
|
2
|
+
import{StaleInstallError,autospawnDaemonEnv,connectIfRunning,connectOrStartDaemon,daemonSpawnReason,ensureDaemonReachable,isStaleInstallError,probeDaemonSocket,resolveRoveSpawn,restartDaemon,systemdUnitOf,testDaemonResponds,tryAcquireSpawnLock}from"./chunk-mz82b1jf.js";import"./chunk-jhnpr3cj.js";import"./chunk-w56terew.js";import"./chunk-8wfz7gyp.js";import"./chunk-96kvwzj8.js";import"./chunk-y8hjgmn0.js";import"./chunk-pn5ygqn6.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{tryAcquireSpawnLock,testDaemonResponds,systemdUnitOf,restartDaemon,resolveRoveSpawn,probeDaemonSocket,isStaleInstallError,ensureDaemonReachable,daemonSpawnReason,connectOrStartDaemon,connectIfRunning,autospawnDaemonEnv,StaleInstallError};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{execHostForRepo}from"./chunk-qa3dghyt.js";import{getRemoteRepoConfig,isRemoteRepoKey}from"./chunk-102yytay.js";import{errorMessage}from"./chunk-9gctbddn.js";import{loadStateFile}from"./chunk-p84bhs57.js";import{pathWithin}from"./chunk-pn5ygqn6.js";import{resolveProductHomeDir}from"./chunk-8143k3t6.js";import{preRenameStateDir}from"./chunk-g6wb8p4p.js";import{ROVE_STATE_DIR_BASENAME}from"./chunk-nc46gddg.js";class IllegalTransitionError extends Error{from;to;taskId;constructor(from,to,taskId){super(`illegal transition for task ${taskId}: ${from} -> ${to}`);this.from=from;this.to=to;this.taskId=taskId;this.name="IllegalTransitionError"}}class TaskNotFoundError extends Error{constructor(taskId){super(`task not found: ${taskId}`);this.name="TaskNotFoundError"}}class CannotDeleteMainTaskError extends Error{constructor(){super("cannot delete a main task; remove the repo from saved repos instead");this.name="CannotDeleteMainTaskError"}}var DIRTY_WORKTREE_CODE="DIRTY_WORKTREE";function describeDirtyWorktreeWork(ignored,dirty=[]){if(dirty.length>0)return`uncommitted or untracked changes: ${namePaths(dirty)}`;return ignored==="unknown"?"gitignored work this check could not read (git status --ignored failed) \u2014 nothing here can confirm it is empty":ignored.length>0?`gitignored work git status cannot see: ${ignored.join(", ")}`:"uncommitted or untracked changes"}var DIRTY_PATHS_SHOWN=10;function namePaths(paths){let shown=paths.slice(0,DIRTY_PATHS_SHOWN).join(", "),more=paths.length-DIRTY_PATHS_SHOWN;return more>0?`${shown} (+${more} more)`:shown}function dirtyRefusalReason(err){let message=errorMessage(err),at=message.indexOf(DIRTY_WORKTREE_CODE);if(at<0)return null;return message.slice(at+DIRTY_WORKTREE_CODE.length).replace(/^:\s*/,"")}class DirtyWorktreeError extends Error{taskId;ignored;dirty;repo;also;constructor(taskId,ignored=[],dirty=[],repo,also=[]){let where=repo?` (${repo})`:"",rest=also.map((f)=>`; also ${f.repo}: ${describeDirtyWorktreeWork(f.ignored,f.dirty)}`).join("");super(`${DIRTY_WORKTREE_CODE}: task ${taskId} worktree${where} has ${describeDirtyWorktreeWork(ignored,dirty)}${rest}`);this.taskId=taskId;this.ignored=ignored;this.dirty=dirty;this.repo=repo;this.also=also;this.name="DirtyWorktreeError"}}class WorktreeRemoveFailedError extends Error{taskId;cause;constructor(taskId,cause){super(`failed to remove worktree for task ${taskId}: ${errorMessage(cause)}`);this.taskId=taskId;this.cause=cause;this.name="WorktreeRemoveFailedError"}}var TASK_DELETING_CODE="TASK_DELETING";class TaskDeletingError extends Error{taskId;constructor(taskId){super(`${TASK_DELETING_CODE}: task ${taskId} is being deleted`);this.taskId=taskId;this.name="TaskDeletingError"}}var MAIN_CHECKOUT_DIRTY_CODE="MAIN_CHECKOUT_DIRTY";class MainCheckoutDirtyError extends Error{repo;dir;constructor(repo,dir){super(`${MAIN_CHECKOUT_DIRTY_CODE}: base checkout at ${dir} has uncommitted changes; commit them before landing (never git stash \u2014 the stash stack is shared by every worktree of this repo)`);this.repo=repo;this.dir=dir;this.name="MainCheckoutDirtyError"}}var EMPTY_BRANCH_CODE="EMPTY_BRANCH";class EmptyBranchError extends Error{branch;landedOn;constructor(branch,landedOn){super(`${EMPTY_BRANCH_CODE}: '${branch}' has no commits ahead of '${landedOn}' \u2014 landing it would be a no-op (the worker may not have delivered anything)`);this.branch=branch;this.landedOn=landedOn;this.name="EmptyBranchError"}}var EMPTY_BRANCH_DIRTY_WORKTREE_CODE="EMPTY_BRANCH_DIRTY_WORKTREE";class EmptyBranchDirtyWorktreeError extends Error{branch;landedOn;worktreePath;files;constructor(branch,landedOn,worktreePath,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${EMPTY_BRANCH_DIRTY_WORKTREE_CODE}: '${branch}' has no commits ahead of '${landedOn}' but its worktree ${worktreePath} has uncommitted changes (${list}) \u2014 commit them in the worktree first, then land again`);this.branch=branch;this.landedOn=landedOn;this.worktreePath=worktreePath;this.files=files;this.name="EmptyBranchDirtyWorktreeError"}}var MISSING_REF_CODE="MISSING_REF";class MissingRefError extends Error{branch;landedOn;dir;constructor(branch,landedOn,dir){super(`${MISSING_REF_CODE}: '${branch}' does not resolve in the base repo at ${dir} (comparing against '${landedOn}') \u2014 the branch was renamed or deleted outside Rove; re-point the task with \`rove api update --branch\` or recreate the branch`);this.branch=branch;this.landedOn=landedOn;this.dir=dir;this.name="MissingRefError"}}var LAND_CONFLICT_CODE="LAND_CONFLICT";class LandConflictError extends Error{taskId;branch;files;constructor(taskId,branch,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${LAND_CONFLICT_CODE}: merging '${branch}' hit conflicts, merge aborted \u2014 conflicted files: ${list}`);this.taskId=taskId;this.branch=branch;this.files=files;this.name="LandConflictError"}}var GIT_COMMAND_FAILED_CODE="GIT_COMMAND_FAILED";class GitCommandFailedError extends Error{command;stderr;constructor(command,stderr,hint){let detail=stderr.trim()||"(git printed nothing on stderr)";super(`${GIT_COMMAND_FAILED_CODE}: \`git ${command}\` failed \u2014 ${detail}${hint?`; ${hint}`:""}`);this.command=command;this.stderr=stderr;this.name="GitCommandFailedError"}}var WORKTREE_NAME_TAKEN_CODE="WORKTREE_NAME_TAKEN";class WorktreeNameTakenError extends Error{worktreeName;constructor(worktreeName){super(`${WORKTREE_NAME_TAKEN_CODE}: worktree name '${worktreeName}' is already in use in this repo \u2014 pick another, or omit --worktree-name for a generated one`);this.worktreeName=worktreeName;this.name="WorktreeNameTakenError"}}var INVALID_WORKTREE_NAME_CODE="INVALID_WORKTREE_NAME";class InvalidWorktreeNameError extends Error{worktreeName;constructor(worktreeName){super(`${INVALID_WORKTREE_NAME_CODE}: worktree name '${worktreeName}' must be a single path segment of letters, digits, '.', '_' or '-' (no '/', no '..', not starting with '.')`);this.worktreeName=worktreeName;this.name="InvalidWorktreeNameError"}}var NOT_A_GIT_REPO_CODE="NOT_A_GIT_REPO";class NotAGitRepoError extends Error{dir;constructor(dir){super(`${NOT_A_GIT_REPO_CODE}: ${dir} is not inside a git repository, so a child cannot get its own worktree \u2014 pass --no-worktree to share the directory`);this.dir=dir;this.name="NotAGitRepoError"}}var NOT_A_LINKED_REPO_CODE="NOT_A_LINKED_REPO";class NotALinkedRepoError extends Error{link;available;constructor(link,available){super(`${NOT_A_LINKED_REPO_CODE}: '${link}' is not a top-level symlink to a git checkout in the parent workspace (linked repos: ${available.length>0?available.join(", "):"none"})`);this.link=link;this.available=available;this.name="NotALinkedRepoError"}}var REMOTE_PARENT_UNSUPPORTED_CODE="REMOTE_PARENT_UNSUPPORTED";class RemoteParentUnsupportedError extends Error{taskId;constructor(taskId){super(`${REMOTE_PARENT_UNSUPPORTED_CODE}: task ${taskId} lives on a remote project \u2014 add the child from that machine's rove`);this.taskId=taskId;this.name="RemoteParentUnsupportedError"}}class ReparentRefusedError extends Error{code;constructor(code,detail){super(`${code}: ${detail}`);this.code=code;this.name="ReparentRefusedError"}}class MoveRefusedError extends Error{code;constructor(code,detail){super(`${code}: ${detail}`);this.code=code;this.name="MoveRefusedError"}}var TOO_MANY_REPOS_CODE="TOO_MANY_REPOS";class TooManyReposError extends Error{constructor(count,cap){super(`${TOO_MANY_REPOS_CODE}: ${count} repos exceed the cap of ${cap} per task (the first is the primary)`);this.name="TooManyReposError"}}var REPO_DUPLICATE_CODE="REPO_DUPLICATE";class RepoDuplicateError extends Error{repo;constructor(repo){super(`${REPO_DUPLICATE_CODE}: ${repo} is listed more than once (a subdirectory resolves to its repo root)`);this.repo=repo;this.name="RepoDuplicateError"}}var REMOTE_EXTRA_UNSUPPORTED_CODE="REMOTE_EXTRA_UNSUPPORTED";class RemoteExtraUnsupportedError extends Error{repo;constructor(repo){super(`${REMOTE_EXTRA_UNSUPPORTED_CODE}: ${repo} is a remote project \u2014 a task spanning several repos must keep all of them local`);this.repo=repo;this.name="RemoteExtraUnsupportedError"}}class ExtraRepoNotGitError extends Error{repo;constructor(repo){super(`${NOT_A_GIT_REPO_CODE}: ${repo} is not a git repository \u2014 every repo of a task needs one to cut its worktree and branch from`);this.repo=repo;this.name="ExtraRepoNotGitError"}}var FORK_UNSUPPORTED_CODE="FORK_UNSUPPORTED";class ForkUnsupportedError extends Error{constructor(reason){super(`${FORK_UNSUPPORTED_CODE}: ${reason}`);this.name="ForkUnsupportedError"}}import fs from"fs";import path2 from"path";import{createHash}from"crypto";import path from"path";var WORKTREE_ROOT_DIR="worktrees",REPO_LOCAL_ROVE_WORKTREE_ROOT_SUBPATH=".rove/worktrees",LEGACY_ROVE_WORKTREE_ROOT_SUBPATH=".claude/worktrees",REPO_LOCAL_MANAGED_WORKTREE_ROOT_SUBPATHS=[REPO_LOCAL_ROVE_WORKTREE_ROOT_SUBPATH,LEGACY_ROVE_WORKTREE_ROOT_SUBPATH],WORKTREE_BASE_KEY="worktree.basePath",PROJECT_DIR_TOKEN="$project_dir";function repoWorktreeDirName(repo){let safeBase=(path.basename(repo)||"repo").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"repo",hash=createHash("sha1").update(path.resolve(repo)).digest("hex").slice(0,12);return`${safeBase}-${hash}`}function hasProjectDirToken(raw){let trimmed=raw.trim();return trimmed===PROJECT_DIR_TOKEN||trimmed.startsWith(`${PROJECT_DIR_TOKEN}/`)||process.platform==="win32"&&trimmed.startsWith(`${PROJECT_DIR_TOKEN}\\`)}function normalizeWorktreeBase(raw,projectDir){if(typeof raw!=="string")return null;let trimmed=raw.trim();if(!trimmed)return null;if(hasProjectDirToken(trimmed)){if(!projectDir)return null;let rest=trimmed.slice(PROJECT_DIR_TOKEN.length).replace(process.platform==="win32"?/^[/\\]+/:/^\/+/,"");return path.resolve(projectDir,rest)}let home=resolveProductHomeDir();if(trimmed==="~")return home;let expanded=trimmed.startsWith("~/")||process.platform==="win32"&&trimmed.startsWith("~\\")?path.join(home,trimmed.slice(2)):trimmed;return path.isAbsolute(expanded)?expanded:path.resolve(home,expanded)}function defaultLocalWorktreesRoot(){return path.join(resolveProductHomeDir(),ROVE_STATE_DIR_BASENAME,WORKTREE_ROOT_DIR)}function legacyLocalWorktreesRoot(){return path.join(preRenameStateDir(resolveProductHomeDir()),WORKTREE_ROOT_DIR)}function worktreeRootFor(repo,override){if(!path.isAbsolute(repo))throw Error(`worktreeRootFor: repo must be an absolute path, got: ${repo}`);return path.join(override??defaultLocalWorktreesRoot(),repoWorktreeDirName(repo))}function managedWorktreeRootsFor(repo,override){if(!path.isAbsolute(repo))throw Error(`managedWorktreeRootsFor: repo must be an absolute path, got: ${repo}`);let dirName=repoWorktreeDirName(repo);return[...new Set([worktreeRootFor(repo,override),path.join(defaultLocalWorktreesRoot(),dirName),path.join(legacyLocalWorktreesRoot(),dirName),...REPO_LOCAL_MANAGED_WORKTREE_ROOT_SUBPATHS.map((subpath)=>path.join(repo,subpath))])]}var WORKTREE_BASE_CUSTOM_KEY="worktree.basePath.custom",PROJECT_SIBLING_BASE=`${PROJECT_DIR_TOKEN}/..`;function worktreeBaseKindOf(raw){let trimmed=raw.trim();if(!trimmed)return"default";if(trimmed.replace(/\/+$/,"")===PROJECT_SIBLING_BASE)return"nextToProject";return"custom"}function getWorktreeBaseOverride(projectDir){let value=loadStateFile()[WORKTREE_BASE_KEY];return normalizeWorktreeBase(typeof value==="string"?value:null,projectDir)}function worktreeRootFor2(repo){return worktreeRootFor(repo,getWorktreeBaseOverride(repo))}function managedWorktreeRootsFor2(repo){return managedWorktreeRootsFor(repo,getWorktreeBaseOverride(repo))}function worktreePathFor(repo,slug){if(!slug||/[/\\\0]/.test(slug))throw Error(`worktreePathFor: invalid slug: ${JSON.stringify(slug)}`);return path2.join(worktreeRootFor2(repo),slug)}async function listWorktreeDirNames(repo){if(isRemoteRepoKey(repo)){let basePath=getRemoteRepoConfig(repo)?.basePath;if(!basePath)return[];let names2=new Set,host=execHostForRepo(repo),entries=await Promise.all(remoteManagedWorktreeRootsFor(basePath).map((root)=>host.readdir(root)));for(let list of entries)for(let name of list)names2.add(name);return[...names2]}let names=new Set;for(let root of managedWorktreeRootsFor2(repo))try{for(let e of fs.readdirSync(root,{withFileTypes:!0}))if(e.isDirectory())names.add(e.name)}catch{}return[...names]}function managedWorktreeRootForPath(repo,candidate){if(!path2.isAbsolute(repo)||!path2.isAbsolute(candidate))return null;let target=canonicalize(candidate);for(let rootPath of managedWorktreeRootsFor2(repo)){let root=canonicalize(rootPath),rel=pathWithin(root,target);if(rel!==null&&rel!=="")return rootPath}return null}function isRoveManagedPath(repo,candidate){return managedWorktreeRootForPath(repo,candidate)!==null}function isUnderManagedWorktreesRoot(candidate,projectDir){if(!path2.isAbsolute(candidate))return!1;let target=canonicalize(candidate),roots=[getWorktreeBaseOverride(projectDir)??"",defaultLocalWorktreesRoot(),legacyLocalWorktreesRoot()];for(let rootPath of roots){if(!rootPath)continue;let root=canonicalize(rootPath),rel=pathWithin(root,target);if(rel===null)continue;if(rel.split("/").filter(Boolean).length===2)return!0}return!1}function remoteWorktreeRootFor(basePath){return`${stripTrailingSlash(basePath)}/.rove/worktrees`}function remoteManagedWorktreeRootsFor(basePath){let base=stripTrailingSlash(basePath);return[`${base}/.rove/worktrees`,`${base}/.rove/worktrees`]}function remoteWorktreePathFor(basePath,slug){if(!slug||/[/\\\0]/.test(slug))throw Error(`remoteWorktreePathFor: invalid slug: ${JSON.stringify(slug)}`);return`${remoteWorktreeRootFor(basePath)}/${slug}`}function remoteManagedRootForPath(basePath,candidate){for(let root of remoteManagedWorktreeRootsFor(basePath))if(candidate===root||candidate.startsWith(`${root}/`))return root;return null}function stripTrailingSlash(p){return p.length>1&&p.endsWith("/")?p.replace(/\/+$/,""):p}function requireAbsolute(name,value){if(!value||!path2.isAbsolute(value))throw Error(`${name} must be an absolute path, got: ${JSON.stringify(value)}`)}function canonicalize(p){try{return fs.realpathSync(p)}catch{return path2.resolve(p)}}
|
|
2
|
+
import{execHostForRepo}from"./chunk-r7khfa3k.js";import{getRemoteRepoConfig,isRemoteRepoKey}from"./chunk-v9n5e14e.js";import{errorMessage}from"./chunk-9gctbddn.js";import{loadStateFile}from"./chunk-8trtyc98.js";import{pathWithin}from"./chunk-pn5ygqn6.js";import{resolveProductHomeDir}from"./chunk-8143k3t6.js";import{preRenameStateDir}from"./chunk-g6wb8p4p.js";import{ROVE_STATE_DIR_BASENAME}from"./chunk-nc46gddg.js";class IllegalTransitionError extends Error{from;to;taskId;constructor(from,to,taskId){super(`illegal transition for task ${taskId}: ${from} -> ${to}`);this.from=from;this.to=to;this.taskId=taskId;this.name="IllegalTransitionError"}}class TaskNotFoundError extends Error{constructor(taskId){super(`task not found: ${taskId}`);this.name="TaskNotFoundError"}}class CannotDeleteMainTaskError extends Error{constructor(){super("cannot delete a main task; remove the repo from saved repos instead");this.name="CannotDeleteMainTaskError"}}var DIRTY_WORKTREE_CODE="DIRTY_WORKTREE";function describeDirtyWorktreeWork(ignored,dirty=[]){if(dirty.length>0)return`uncommitted or untracked changes: ${namePaths(dirty)}`;return ignored==="unknown"?"gitignored work this check could not read (git status --ignored failed) \u2014 nothing here can confirm it is empty":ignored.length>0?`gitignored work git status cannot see: ${ignored.join(", ")}`:"uncommitted or untracked changes"}var DIRTY_PATHS_SHOWN=10;function namePaths(paths){let shown=paths.slice(0,DIRTY_PATHS_SHOWN).join(", "),more=paths.length-DIRTY_PATHS_SHOWN;return more>0?`${shown} (+${more} more)`:shown}function dirtyRefusalReason(err){let message=errorMessage(err),at=message.indexOf(DIRTY_WORKTREE_CODE);if(at<0)return null;return message.slice(at+DIRTY_WORKTREE_CODE.length).replace(/^:\s*/,"")}class DirtyWorktreeError extends Error{taskId;ignored;dirty;repo;also;constructor(taskId,ignored=[],dirty=[],repo,also=[]){let where=repo?` (${repo})`:"",rest=also.map((f)=>`; also ${f.repo}: ${describeDirtyWorktreeWork(f.ignored,f.dirty)}`).join("");super(`${DIRTY_WORKTREE_CODE}: task ${taskId} worktree${where} has ${describeDirtyWorktreeWork(ignored,dirty)}${rest}`);this.taskId=taskId;this.ignored=ignored;this.dirty=dirty;this.repo=repo;this.also=also;this.name="DirtyWorktreeError"}}class WorktreeRemoveFailedError extends Error{taskId;cause;constructor(taskId,cause){super(`failed to remove worktree for task ${taskId}: ${errorMessage(cause)}`);this.taskId=taskId;this.cause=cause;this.name="WorktreeRemoveFailedError"}}var TASK_DELETING_CODE="TASK_DELETING";class TaskDeletingError extends Error{taskId;constructor(taskId){super(`${TASK_DELETING_CODE}: task ${taskId} is being deleted`);this.taskId=taskId;this.name="TaskDeletingError"}}var MAIN_CHECKOUT_DIRTY_CODE="MAIN_CHECKOUT_DIRTY";class MainCheckoutDirtyError extends Error{repo;dir;constructor(repo,dir){super(`${MAIN_CHECKOUT_DIRTY_CODE}: base checkout at ${dir} has uncommitted changes; commit them before landing (never git stash \u2014 the stash stack is shared by every worktree of this repo)`);this.repo=repo;this.dir=dir;this.name="MainCheckoutDirtyError"}}var EMPTY_BRANCH_CODE="EMPTY_BRANCH";class EmptyBranchError extends Error{branch;landedOn;constructor(branch,landedOn){super(`${EMPTY_BRANCH_CODE}: '${branch}' has no commits ahead of '${landedOn}' \u2014 landing it would be a no-op (the worker may not have delivered anything)`);this.branch=branch;this.landedOn=landedOn;this.name="EmptyBranchError"}}var EMPTY_BRANCH_DIRTY_WORKTREE_CODE="EMPTY_BRANCH_DIRTY_WORKTREE";class EmptyBranchDirtyWorktreeError extends Error{branch;landedOn;worktreePath;files;constructor(branch,landedOn,worktreePath,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${EMPTY_BRANCH_DIRTY_WORKTREE_CODE}: '${branch}' has no commits ahead of '${landedOn}' but its worktree ${worktreePath} has uncommitted changes (${list}) \u2014 commit them in the worktree first, then land again`);this.branch=branch;this.landedOn=landedOn;this.worktreePath=worktreePath;this.files=files;this.name="EmptyBranchDirtyWorktreeError"}}var MISSING_REF_CODE="MISSING_REF";class MissingRefError extends Error{branch;landedOn;dir;constructor(branch,landedOn,dir){super(`${MISSING_REF_CODE}: '${branch}' does not resolve in the base repo at ${dir} (comparing against '${landedOn}') \u2014 the branch was renamed or deleted outside Rove; re-point the task with \`rove api update --branch\` or recreate the branch`);this.branch=branch;this.landedOn=landedOn;this.dir=dir;this.name="MissingRefError"}}var LAND_CONFLICT_CODE="LAND_CONFLICT";class LandConflictError extends Error{taskId;branch;files;constructor(taskId,branch,files){let list=files.length>0?files.join(", "):"(none reported)";super(`${LAND_CONFLICT_CODE}: merging '${branch}' hit conflicts, merge aborted \u2014 conflicted files: ${list}`);this.taskId=taskId;this.branch=branch;this.files=files;this.name="LandConflictError"}}var GIT_COMMAND_FAILED_CODE="GIT_COMMAND_FAILED";class GitCommandFailedError extends Error{command;stderr;constructor(command,stderr,hint){let detail=stderr.trim()||"(git printed nothing on stderr)";super(`${GIT_COMMAND_FAILED_CODE}: \`git ${command}\` failed \u2014 ${detail}${hint?`; ${hint}`:""}`);this.command=command;this.stderr=stderr;this.name="GitCommandFailedError"}}var WORKTREE_NAME_TAKEN_CODE="WORKTREE_NAME_TAKEN";class WorktreeNameTakenError extends Error{worktreeName;constructor(worktreeName){super(`${WORKTREE_NAME_TAKEN_CODE}: worktree name '${worktreeName}' is already in use in this repo \u2014 pick another, or omit --worktree-name for a generated one`);this.worktreeName=worktreeName;this.name="WorktreeNameTakenError"}}var INVALID_WORKTREE_NAME_CODE="INVALID_WORKTREE_NAME";class InvalidWorktreeNameError extends Error{worktreeName;constructor(worktreeName){super(`${INVALID_WORKTREE_NAME_CODE}: worktree name '${worktreeName}' must be a single path segment of letters, digits, '.', '_' or '-' (no '/', no '..', not starting with '.')`);this.worktreeName=worktreeName;this.name="InvalidWorktreeNameError"}}var NOT_A_GIT_REPO_CODE="NOT_A_GIT_REPO";class NotAGitRepoError extends Error{dir;constructor(dir){super(`${NOT_A_GIT_REPO_CODE}: ${dir} is not inside a git repository, so a child cannot get its own worktree \u2014 pass --no-worktree to share the directory`);this.dir=dir;this.name="NotAGitRepoError"}}var NOT_A_LINKED_REPO_CODE="NOT_A_LINKED_REPO";class NotALinkedRepoError extends Error{link;available;constructor(link,available){super(`${NOT_A_LINKED_REPO_CODE}: '${link}' is not a top-level symlink to a git checkout in the parent workspace (linked repos: ${available.length>0?available.join(", "):"none"})`);this.link=link;this.available=available;this.name="NotALinkedRepoError"}}var REMOTE_PARENT_UNSUPPORTED_CODE="REMOTE_PARENT_UNSUPPORTED";class RemoteParentUnsupportedError extends Error{taskId;constructor(taskId){super(`${REMOTE_PARENT_UNSUPPORTED_CODE}: task ${taskId} lives on a remote project \u2014 add the child from that machine's rove`);this.taskId=taskId;this.name="RemoteParentUnsupportedError"}}class ReparentRefusedError extends Error{code;constructor(code,detail){super(`${code}: ${detail}`);this.code=code;this.name="ReparentRefusedError"}}class MoveRefusedError extends Error{code;constructor(code,detail){super(`${code}: ${detail}`);this.code=code;this.name="MoveRefusedError"}}var TOO_MANY_REPOS_CODE="TOO_MANY_REPOS";class TooManyReposError extends Error{constructor(count,cap){super(`${TOO_MANY_REPOS_CODE}: ${count} repos exceed the cap of ${cap} per task (the first is the primary)`);this.name="TooManyReposError"}}var REPO_DUPLICATE_CODE="REPO_DUPLICATE";class RepoDuplicateError extends Error{repo;constructor(repo){super(`${REPO_DUPLICATE_CODE}: ${repo} is listed more than once (a subdirectory resolves to its repo root)`);this.repo=repo;this.name="RepoDuplicateError"}}var REMOTE_EXTRA_UNSUPPORTED_CODE="REMOTE_EXTRA_UNSUPPORTED";class RemoteExtraUnsupportedError extends Error{repo;constructor(repo){super(`${REMOTE_EXTRA_UNSUPPORTED_CODE}: ${repo} is a remote project \u2014 a task spanning several repos must keep all of them local`);this.repo=repo;this.name="RemoteExtraUnsupportedError"}}class ExtraRepoNotGitError extends Error{repo;constructor(repo){super(`${NOT_A_GIT_REPO_CODE}: ${repo} is not a git repository \u2014 every repo of a task needs one to cut its worktree and branch from`);this.repo=repo;this.name="ExtraRepoNotGitError"}}var FORK_UNSUPPORTED_CODE="FORK_UNSUPPORTED";class ForkUnsupportedError extends Error{constructor(reason){super(`${FORK_UNSUPPORTED_CODE}: ${reason}`);this.name="ForkUnsupportedError"}}import fs from"fs";import path2 from"path";import{createHash}from"crypto";import path from"path";var WORKTREE_ROOT_DIR="worktrees",REPO_LOCAL_ROVE_WORKTREE_ROOT_SUBPATH=".rove/worktrees",LEGACY_ROVE_WORKTREE_ROOT_SUBPATH=".claude/worktrees",REPO_LOCAL_MANAGED_WORKTREE_ROOT_SUBPATHS=[REPO_LOCAL_ROVE_WORKTREE_ROOT_SUBPATH,LEGACY_ROVE_WORKTREE_ROOT_SUBPATH],WORKTREE_BASE_KEY="worktree.basePath",PROJECT_DIR_TOKEN="$project_dir";function repoWorktreeDirName(repo){let safeBase=(path.basename(repo)||"repo").replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"")||"repo",hash=createHash("sha1").update(path.resolve(repo)).digest("hex").slice(0,12);return`${safeBase}-${hash}`}function hasProjectDirToken(raw){let trimmed=raw.trim();return trimmed===PROJECT_DIR_TOKEN||trimmed.startsWith(`${PROJECT_DIR_TOKEN}/`)||process.platform==="win32"&&trimmed.startsWith(`${PROJECT_DIR_TOKEN}\\`)}function normalizeWorktreeBase(raw,projectDir){if(typeof raw!=="string")return null;let trimmed=raw.trim();if(!trimmed)return null;if(hasProjectDirToken(trimmed)){if(!projectDir)return null;let rest=trimmed.slice(PROJECT_DIR_TOKEN.length).replace(process.platform==="win32"?/^[/\\]+/:/^\/+/,"");return path.resolve(projectDir,rest)}let home=resolveProductHomeDir();if(trimmed==="~")return home;let expanded=trimmed.startsWith("~/")||process.platform==="win32"&&trimmed.startsWith("~\\")?path.join(home,trimmed.slice(2)):trimmed;return path.isAbsolute(expanded)?expanded:path.resolve(home,expanded)}function defaultLocalWorktreesRoot(){return path.join(resolveProductHomeDir(),ROVE_STATE_DIR_BASENAME,WORKTREE_ROOT_DIR)}function legacyLocalWorktreesRoot(){return path.join(preRenameStateDir(resolveProductHomeDir()),WORKTREE_ROOT_DIR)}function worktreeRootFor(repo,override){if(!path.isAbsolute(repo))throw Error(`worktreeRootFor: repo must be an absolute path, got: ${repo}`);return path.join(override??defaultLocalWorktreesRoot(),repoWorktreeDirName(repo))}function managedWorktreeRootsFor(repo,override){if(!path.isAbsolute(repo))throw Error(`managedWorktreeRootsFor: repo must be an absolute path, got: ${repo}`);let dirName=repoWorktreeDirName(repo);return[...new Set([worktreeRootFor(repo,override),path.join(defaultLocalWorktreesRoot(),dirName),path.join(legacyLocalWorktreesRoot(),dirName),...REPO_LOCAL_MANAGED_WORKTREE_ROOT_SUBPATHS.map((subpath)=>path.join(repo,subpath))])]}var WORKTREE_BASE_CUSTOM_KEY="worktree.basePath.custom",PROJECT_SIBLING_BASE=`${PROJECT_DIR_TOKEN}/..`;function worktreeBaseKindOf(raw){let trimmed=raw.trim();if(!trimmed)return"default";if(trimmed.replace(/\/+$/,"")===PROJECT_SIBLING_BASE)return"nextToProject";return"custom"}function getWorktreeBaseOverride(projectDir){let value=loadStateFile()[WORKTREE_BASE_KEY];return normalizeWorktreeBase(typeof value==="string"?value:null,projectDir)}function worktreeRootFor2(repo){return worktreeRootFor(repo,getWorktreeBaseOverride(repo))}function managedWorktreeRootsFor2(repo){return managedWorktreeRootsFor(repo,getWorktreeBaseOverride(repo))}function worktreePathFor(repo,slug){if(!slug||/[/\\\0]/.test(slug))throw Error(`worktreePathFor: invalid slug: ${JSON.stringify(slug)}`);return path2.join(worktreeRootFor2(repo),slug)}async function listWorktreeDirNames(repo){if(isRemoteRepoKey(repo)){let basePath=getRemoteRepoConfig(repo)?.basePath;if(!basePath)return[];let names2=new Set,host=execHostForRepo(repo),entries=await Promise.all(remoteManagedWorktreeRootsFor(basePath).map((root)=>host.readdir(root)));for(let list of entries)for(let name of list)names2.add(name);return[...names2]}let names=new Set;for(let root of managedWorktreeRootsFor2(repo))try{for(let e of fs.readdirSync(root,{withFileTypes:!0}))if(e.isDirectory())names.add(e.name)}catch{}return[...names]}function managedWorktreeRootForPath(repo,candidate){if(!path2.isAbsolute(repo)||!path2.isAbsolute(candidate))return null;let target=canonicalize(candidate);for(let rootPath of managedWorktreeRootsFor2(repo)){let root=canonicalize(rootPath),rel=pathWithin(root,target);if(rel!==null&&rel!=="")return rootPath}return null}function isRoveManagedPath(repo,candidate){return managedWorktreeRootForPath(repo,candidate)!==null}function isUnderManagedWorktreesRoot(candidate,projectDir){if(!path2.isAbsolute(candidate))return!1;let target=canonicalize(candidate),roots=[getWorktreeBaseOverride(projectDir)??"",defaultLocalWorktreesRoot(),legacyLocalWorktreesRoot()];for(let rootPath of roots){if(!rootPath)continue;let root=canonicalize(rootPath),rel=pathWithin(root,target);if(rel===null)continue;if(rel.split("/").filter(Boolean).length===2)return!0}return!1}function remoteWorktreeRootFor(basePath){return`${stripTrailingSlash(basePath)}/.rove/worktrees`}function remoteManagedWorktreeRootsFor(basePath){let base=stripTrailingSlash(basePath);return[`${base}/.rove/worktrees`,`${base}/.rove/worktrees`]}function remoteWorktreePathFor(basePath,slug){if(!slug||/[/\\\0]/.test(slug))throw Error(`remoteWorktreePathFor: invalid slug: ${JSON.stringify(slug)}`);return`${remoteWorktreeRootFor(basePath)}/${slug}`}function remoteManagedRootForPath(basePath,candidate){for(let root of remoteManagedWorktreeRootsFor(basePath))if(candidate===root||candidate.startsWith(`${root}/`))return root;return null}function stripTrailingSlash(p){return p.length>1&&p.endsWith("/")?p.replace(/\/+$/,""):p}function requireAbsolute(name,value){if(!value||!path2.isAbsolute(value))throw Error(`${name} must be an absolute path, got: ${JSON.stringify(value)}`)}function canonicalize(p){try{return fs.realpathSync(p)}catch{return path2.resolve(p)}}
|
|
3
3
|
export{IllegalTransitionError,TaskNotFoundError,CannotDeleteMainTaskError,DIRTY_WORKTREE_CODE,describeDirtyWorktreeWork,dirtyRefusalReason,DirtyWorktreeError,WorktreeRemoveFailedError,TASK_DELETING_CODE,TaskDeletingError,MainCheckoutDirtyError,EmptyBranchError,EMPTY_BRANCH_DIRTY_WORKTREE_CODE,EmptyBranchDirtyWorktreeError,MissingRefError,LandConflictError,GitCommandFailedError,WorktreeNameTakenError,InvalidWorktreeNameError,NotAGitRepoError,NotALinkedRepoError,REMOTE_PARENT_UNSUPPORTED_CODE,RemoteParentUnsupportedError,ReparentRefusedError,MoveRefusedError,TooManyReposError,RepoDuplicateError,RemoteExtraUnsupportedError,ExtraRepoNotGitError,FORK_UNSUPPORTED_CODE,ForkUnsupportedError,WORKTREE_BASE_KEY,PROJECT_DIR_TOKEN,hasProjectDirToken,normalizeWorktreeBase,WORKTREE_BASE_CUSTOM_KEY,PROJECT_SIBLING_BASE,worktreeBaseKindOf,worktreePathFor,listWorktreeDirNames,managedWorktreeRootForPath,isRoveManagedPath,isUnderManagedWorktreesRoot,remoteWorktreePathFor,remoteManagedRootForPath,requireAbsolute,canonicalize};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{REPO_CONFIG_DIRS,isNonEmptyRepoFile,readFirstNonEmptyRepoFile}from"./chunk-catrr0z3.js";import{getRepoInitOverride}from"./chunk-
|
|
2
|
+
import{REPO_CONFIG_DIRS,isNonEmptyRepoFile,readFirstNonEmptyRepoFile}from"./chunk-catrr0z3.js";import{getRepoInitOverride}from"./chunk-v9n5e14e.js";import{existsSync}from"fs";import{join}from"path";var CJK=/[\u3040-\u30FF\u3400-\u4DBF\u4E00-\u9FFF\uF900-\uFAFF]/u,ALPHA=/[a-zA-Z\u00C0-\u024F\u0370-\u03FF\u0400-\u04FF]/u;function detectLanguage(text){let cjk=0,alpha=0;for(let ch of text)if(CJK.test(ch))cjk+=1;else if(ALPHA.test(ch))alpha+=1;if(cjk===0&&alpha===0)return null;return cjk*10>alpha?"zh":"en"}var LOCKFILE_DEPENDENCY_DIRS=[["bun.lock","node_modules"],["bun.lockb","node_modules"],["package-lock.json","node_modules"],["yarn.lock","node_modules"],["pnpm-lock.yaml","node_modules"],["Cargo.lock","target"],["poetry.lock",".venv"],["uv.lock",".venv"]];function missingDependenciesCoda(worktreePath,language){let missing=new Set;for(let[lockfile,dependencyDir]of LOCKFILE_DEPENDENCY_DIRS){if(!existsSync(join(worktreePath,lockfile)))continue;if(existsSync(join(worktreePath,dependencyDir)))continue;missing.add(dependencyDir)}if(missing.size===0)return;let dirs=[...missing].join(", ");if(language==="zh")return`\u8865\u5145\uFF1A\u8FD9\u4E2A worktree \u6CA1\u6709\u88C5\u4F9D\u8D56\uFF08\u4ED3\u5E93\u91CC\u6709 lockfile\uFF0C\u4F46 ${dirs} \u4E0D\u5B58\u5728\uFF09\u3002\u5728\u76F8\u4FE1\u4EFB\u4F55\u6784\u5EFA / \u6D4B\u8BD5\u7ED3\u679C\u4E4B\u524D\uFF0C\u5148\u8DD1\u4E00\u904D\u672C\u4ED3\u5E93\u7684\u5B89\u88C5\u6B65\u9AA4\u2014\u2014\u8FD9\u91CC\u7684\u5931\u8D25\u591A\u534A\u662F\u56E0\u4E3A\u6CA1\u88C5\u4F9D\u8D56\uFF0C\u800C\u4E0D\u662F\u4EE3\u7801\u56DE\u5F52\u3002\u5982\u679C\u8FD9\u4E2A\u4ED3\u5E93\u6BCF\u6B21\u90FD\u9700\u8981\u88C5\uFF0C\u53EF\u4EE5\u8003\u8651\u52A0\u4E00\u4E2A \`.rove/init.sh\`\u3002`;return`PS: this worktree has no installed dependencies (${dirs} missing beside a committed lockfile). Run the repo's install step before trusting build/test results \u2014 a failure here is most likely the missing install, not a regression. If this repo always needs one, consider adding \`.rove/init.sh\`.`}var INIT_SCRIPT_FILENAME="init.sh",INIT_PROMPT_FILENAME="init-prompt.md";function repoFileScript(worktreePath){for(let dir of REPO_CONFIG_DIRS)if(existsSync(join(worktreePath,dir,INIT_SCRIPT_FILENAME)))return`sh ${dir}/${INIT_SCRIPT_FILENAME}`;return}function repoFilePrompt(worktreePath){return readFirstNonEmptyRepoFile(worktreePath,INIT_PROMPT_FILENAME)}function describeRepoInitSources(repoRoot){let describe=(filename,counts)=>{let taken=!1;return REPO_CONFIG_DIRS.map((dir)=>{let absolute=join(repoRoot,dir,filename),effective=!taken&&counts(absolute);if(effective)taken=!0;return{rel:`${dir}/${filename}`,present:existsSync(absolute),effective}})};return{script:describe(INIT_SCRIPT_FILENAME,existsSync),prompt:describe(INIT_PROMPT_FILENAME,isNonEmptyRepoFile)}}function resolveRepoInit(repoRoot,worktreePath){let override=repoRoot?getRepoInitOverride(repoRoot):{},initScript=repoFileScript(worktreePath)??override.initScript,initPrompt=repoFilePrompt(worktreePath)??override.initPrompt;return{initScript:initScript&&initScript.trim().length>0?initScript:void 0,initPrompt:initPrompt&&initPrompt.trim().length>0?initPrompt:void 0}}function firstMessageFor(intent,init,worktreePath){if(intent.kind==="none")return;if(intent.kind==="explicit")return{source:"explicit",text:intent.prompt};if(intent.kind==="new-task"){let deps=init.initScript?void 0:missingDependenciesCoda(worktreePath,detectLanguage(intent.prompt)??void 0);return{source:"explicit",text:[intent.prompt,deps].filter(Boolean).join(`
|
|
3
3
|
|
|
4
4
|
`)}}let text=init.initPrompt?.trim();return text?{source:"repo-init",text}:void 0}function resolveEngineLaunchInit(repoRoot,worktreePath,intent={kind:"repo-init"}){let init=resolveRepoInit(repoRoot,worktreePath);return{initScript:init.initScript,firstMessage:firstMessageFor(intent,init,worktreePath)}}
|
|
5
5
|
export{detectLanguage,missingDependenciesCoda,describeRepoInitSources,resolveRepoInit,resolveEngineLaunchInit};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{BREAKING_VERSIONS,CURRENT_VERSION,PACKAGE_NAME,UPDATE_COMMAND,UPDATE_SCRIPT_URL,ZH_NOTES_ASSET,breakingVersionsCrossed,channelOf,checkLatestVersion,compareSemver,fetchReleaseNotes,fetchReleaseNotesRange,fetchReleaseSummaries,isNewerSemver,owningNpmPrefix,recommendedGlobalInstallCommand,releasePageUrl,repoSlug,updateCommandFor}from"./chunk-
|
|
2
|
+
import{BREAKING_VERSIONS,CURRENT_VERSION,PACKAGE_NAME,UPDATE_COMMAND,UPDATE_SCRIPT_URL,ZH_NOTES_ASSET,breakingVersionsCrossed,channelOf,checkLatestVersion,compareSemver,fetchReleaseNotes,fetchReleaseNotesRange,fetchReleaseSummaries,isNewerSemver,owningNpmPrefix,recommendedGlobalInstallCommand,releasePageUrl,repoSlug,updateCommandFor}from"./chunk-qqc8mn6x.js";import"./chunk-8143k3t6.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{updateCommandFor,repoSlug,releasePageUrl,recommendedGlobalInstallCommand,owningNpmPrefix,isNewerSemver,fetchReleaseSummaries,fetchReleaseNotesRange,fetchReleaseNotes,compareSemver,checkLatestVersion,channelOf,breakingVersionsCrossed,ZH_NOTES_ASSET,UPDATE_SCRIPT_URL,UPDATE_COMMAND,PACKAGE_NAME,CURRENT_VERSION,BREAKING_VERSIONS};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{loadStateFile,patchStateFile}from"./chunk-
|
|
2
|
+
import{loadStateFile,patchStateFile}from"./chunk-8trtyc98.js";var TERMINAL_TABS_PREFIX="terminalTabs.";function terminalTabsKey(taskId){return`${TERMINAL_TABS_PREFIX}${taskId}`}var stateFileTabsPersistence={load(){let out={};for(let[key,value]of Object.entries(loadStateFile())){if(!key.startsWith(TERMINAL_TABS_PREFIX))continue;let state=value;if(state&&Array.isArray(state.tabs))out[key.slice(TERMINAL_TABS_PREFIX.length)]=state}return out},save(changes){let patch={};for(let[taskId,state]of Object.entries(changes))patch[terminalTabsKey(taskId)]=state??void 0;patchStateFile(patch)}};
|
|
3
3
|
export{TERMINAL_TABS_PREFIX,terminalTabsKey,stateFileTabsPersistence};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{installSkillNow,refreshSkillStatus,skillMissing,startSkillStatus}from"./chunk-jjc3v2zc.js";import"./chunk-qg92cfsh.js";import"./chunk-cmp64q4j.js";import"./chunk-z3k0wg31.js";import"./chunk-4hvacnnr.js";import"./chunk-w7zv47mp.js";import"./chunk-mz82b1jf.js";import"./chunk-jhnpr3cj.js";import"./chunk-w56terew.js";import"./chunk-8wfz7gyp.js";import"./chunk-96kvwzj8.js";import"./chunk-v9n5e14e.js";import"./chunk-40dgv828.js";import"./chunk-9gctbddn.js";import"./chunk-mg1cas61.js";import"./chunk-8trtyc98.js";import"./chunk-g5jc6c2d.js";import"./chunk-qdatysve.js";import"./chunk-7kysxgbq.js";import"./chunk-5c591htx.js";import"./chunk-y8hjgmn0.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-pn5ygqn6.js";import"./chunk-7ghwdjdc.js";import"./chunk-m5nd44st.js";import"./chunk-jt9n8k7z.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{startSkillStatus,skillMissing,refreshSkillStatus,installSkillNow};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{TaskIndexStore}from"./chunk-4vbk9z6n.js";import"./chunk-qkehg2c1.js";import"./chunk-5c591htx.js";import"./chunk-y8hjgmn0.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-pn5ygqn6.js";import"./chunk-m5nd44st.js";import"./chunk-jt9n8k7z.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{TaskIndexStore};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{interactiveEngineCommand,listPresetIds}from"./chunk-
|
|
2
|
+
import{interactiveEngineCommand,listPresetIds}from"./chunk-m9ssmhrc.js";import{resolveSessionShell}from"./chunk-tn9gtf18.js";import{engineEntry}from"./chunk-z3k0wg31.js";import{installedEngineIds}from"./chunk-4hvacnnr.js";import{spawn,spawnSync}from"child_process";import{statSync}from"fs";import path from"path";function whichOnPath(bin){let bunWhich=globalThis.Bun?.which;if(bunWhich)return bunWhich(bin);let out=spawnSync(process.platform==="win32"?"where":"which",[bin],{encoding:"utf8"});if(out.status!==0)return null;return out.stdout.split(`
|
|
3
3
|
`).map((l)=>l.trim()).find(Boolean)??null}var LOGIN_PROBE_MS=5000,MARK="__rove_which__";function whichInLoginShell(bin){return new Promise((resolve)=>{let out="",child;try{let quoted=`'${bin.replaceAll("'","'\\''")}'`;child=spawn(resolveSessionShell(),["-ilc",`printf '\\n${MARK}%s\\n' "$(command -v ${quoted})"`],{stdio:["ignore","pipe","ignore"]})}catch{return resolve(null)}let timer=setTimeout(()=>child.kill("SIGKILL"),LOGIN_PROBE_MS);child.stdout?.on("data",(b)=>{out+=b.toString()}),child.on("error",()=>{clearTimeout(timer),resolve(null)}),child.on("close",()=>{clearTimeout(timer);let line=out.split(`
|
|
4
4
|
`).find((l)=>l.startsWith(MARK));resolve(line?.slice(MARK.length).trim()||null)})})}var defaultDeps={which:(bin)=>whichOnPath(bin)??(process.platform==="win32"?null:whichInLoginShell(bin)),command:(vendor)=>interactiveEngineCommand(vendor)};async function probeLaunchBinary(argv,which){let bin=argv[0]?.trim();if(!bin)return{found:!1,error:"no launch command"};if(bin.includes(path.sep)||bin.startsWith(".")){try{if(statSync(bin).isFile())return{found:!0,path:bin}}catch{}return{found:!1,error:`not found at ${bin}`}}let found=await which(bin);return found?{found:!0,path:found}:{found:!1,error:"not found on PATH"}}async function detectEngineStatus(vendor,over={}){let deps={...defaultDeps,...over},detector=engineEntry(vendor).detectAccount;if(!detector)return{vendor,binary:await probeLaunchBinary(deps.command(vendor),deps.which),account:null};let status=await detector(deps.accountDeps),binary=status.binary.found?status.binary:await probeLaunchBinary(deps.command(vendor),deps.which);return{vendor,binary,account:status.account,accountError:status.accountError}}function detectEngineStatuses(vendors,over={}){return Promise.all(vendors.map((v)=>detectEngineStatus(v,over)))}function describeAccount(account){if(account===null)return"login not detectable";switch(account.kind){case"oauth":return"email"in account?`logged in (${account.email}${account.organization?`, ${account.organization}`:""})`:"logged in";case"chatgpt":return`logged in (${account.email}${account.plan?`, ${account.plan}`:""})`;case"apikey":return"API key";case"token":return`token (${account.source})`;default:return"no account"}}function engineUsable(status){return status.binary.found&&status.account?.kind!=="none"}async function probeableEngineIds(){return[...new Set([...listPresetIds(),...await installedEngineIds()])]}function summarizeEngines(statuses){let usable=[],signedOut=[];for(let status of statuses)if(engineUsable(status))usable.push(status.vendor);else if(status.binary.found)signedOut.push(status.vendor);return{usable,signedOut}}
|
|
5
5
|
export{detectEngineStatus,detectEngineStatuses,describeAccount,probeableEngineIds,summarizeEngines};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{stripTerminalControls,terminalRows}from"./chunk-etfh8f4z.js";import{OWNER_ONLY_FILE_MODE}from"./chunk-yt15y085.js";import{defaultPtyExitsPath}from"./chunk-
|
|
2
|
+
import{stripTerminalControls,terminalRows}from"./chunk-etfh8f4z.js";import{OWNER_ONLY_FILE_MODE}from"./chunk-yt15y085.js";import{defaultPtyExitsPath}from"./chunk-2z2jwetd.js";import{randomUUID}from"crypto";import{mkdirSync,readFileSync,renameSync,writeFileSync}from"fs";import{dirname}from"path";var MAX_RECORDS=50,TAIL_LINES=40,TAIL_LINE_CHARS=500;function plainTail(raw){let lines=terminalRows(raw,TAIL_LINE_CHARS);while(lines.length>0&&(lines[lines.length-1]??"").trim()==="")lines.pop();return lines.slice(-TAIL_LINES)}function engineExitCodeFromTail(tail){for(let i=tail.length-1;i>=0;i--){let m=ENGINE_EXIT_BANNER.exec(tail[i]??"");if(m?.[1])return Number.parseInt(m[1],10)}return null}var WRAPPER_BANNER_ROW=/^\s*(?:\u26A0\s*)?Engine exited \(code (\d+)\)\. Check Settings/;function wrapperBannerCodeFromTail(tail){for(let i=tail.length-1;i>=0;i--){let m=WRAPPER_BANNER_ROW.exec(tail[i]??"");if(m?.[1])return Number.parseInt(m[1],10)}return null}var ENGINE_EXIT_BANNER=/Engine exited \(code (\d+)\)/;function healTails(records){let out={};for(let[key,record]of Object.entries(records)){let tail=record?.tail;out[key]=Array.isArray(tail)?{...record,tail:tail.map((line)=>stripTerminalControls(String(line)))}:record}return out}function compareByExitAtDesc(a,b){if(a.at===b.at)return 0;return a.at<b.at?1:-1}function readPtyExitStore(path=defaultPtyExitsPath()){let read=(status,records={})=>({records,status,readable:status==="ok"||status==="absent"}),raw;try{raw=readFileSync(path,"utf8")}catch(err){return read(err.code==="ENOENT"?"absent":"unreadable")}try{let parsed=JSON.parse(raw);if(parsed===null||typeof parsed!=="object"||Array.isArray(parsed))return read("unparsable");return read("ok",healTails(parsed))}catch{return read("unparsable")}}function readPtyExitRecords(path=defaultPtyExitsPath()){return readPtyExitStore(path).records}function recordPtyExit(info,path=defaultPtyExitsPath()){if(info.key.startsWith("::"))return;if(info.exit.code===0&&info.exit.signal===null)return;let tail=plainTail(info.tail);writeRecord(info.key,{key:info.key,pid:info.pid,code:info.exit.code??engineExitCodeFromTail(tail),signal:info.exit.signal,at:info.exit.at,tail,layer:"pty"},path)}function recordEngineExit(info,path=defaultPtyExitsPath()){if(info.key.startsWith("::"))return;let tail=plainTail(info.tail);writeRecord(`${info.key}#engine`,{key:info.key,pid:info.pid,code:engineExitCodeFromTail(tail),signal:null,at:info.at,tail,layer:"engine",...info.vendor?{vendor:info.vendor}:{},...info.atApproximate?{atApproximate:!0}:{},parentAlive:!0},path)}function writeRecord(storeKey,record,path){let store=readPtyExitStore(path);if(store.status==="unreadable")throw Error(`pty-exits store is unreadable (${path}) \u2014 refusing to overwrite it`);let records=store.records;records[storeKey]=record;let newest=Object.entries(records).sort(([,a],[,b])=>compareByExitAtDesc(a,b)).slice(0,MAX_RECORDS);mkdirSync(dirname(path),{recursive:!0});let tmp=`${path}.tmp-${process.pid}-${randomUUID()}`;writeFileSync(tmp,JSON.stringify(Object.fromEntries(newest),null,2),{encoding:"utf8",mode:OWNER_ONLY_FILE_MODE}),renameSync(tmp,path)}
|
|
3
3
|
export{plainTail,engineExitCodeFromTail,wrapperBannerCodeFromTail,ENGINE_EXIT_BANNER,compareByExitAtDesc,readPtyExitStore,readPtyExitRecords,recordPtyExit,recordEngineExit};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{stampOrigin}from"./chunk-
|
|
2
|
+
import{stampOrigin}from"./chunk-38w60dmy.js";import{createStateCell}from"./chunk-cmp64q4j.js";var NO_LIVE={activity:new Map,changes:new Map,tokens:new Map};function decodeMachines(payload){let p=payload;if(!p||!Array.isArray(p.machines)||!Array.isArray(p.tasks)||!p.live||typeof p.live!=="object")return null;let map=(value)=>new Map(value&&typeof value==="object"?Object.entries(value):[]);return{machines:p.machines,tasks:p.tasks,live:{activity:map(p.live.activity),changes:map(p.live.changes),tokens:map(p.live.tokens)}}}class MachineFeed{local;machinesAcc=createStateCell([],"machines.status");remoteTasksAcc=createStateCell(null,"machines.remoteTasks");tasksAcc;merged=null;liveAcc=createStateCell(NO_LIVE,"machines.live");stops;constructor(local){this.local=local;this.tasksAcc=this.mergedTasks();let raw=local.rawChannelSignal("machines"),take=()=>{let next=decodeMachines(raw.get());if(!next)return;this.machinesAcc.set(next.machines),this.liveAcc.set(next.live),this.remoteTasksAcc.set(next.machines.length===0?null:next.tasks)};this.stops=[raw.subscribe(take)],take()}machinesSignal(){return this.machinesAcc}tasksSignal(){return this.tasksAcc}liveSignal(){return this.liveAcc}mergedTasks(){let localTasks=this.local.tasksSignal(),get=()=>{let local=localTasks.get(),remote=this.remoteTasksAcc.get();if(remote===null)return local;if(this.merged?.local!==local||this.merged.remote!==remote){let value=[...local.map((task)=>stampOrigin(task,"local","local")),...remote];this.merged={local,remote,value}}return this.merged.value},state=get;return state.get=get,state.subscribe=(listener)=>{let stopLocal=localTasks.subscribe(listener),stopRemote=this.remoteTasksAcc.subscribe(listener);return()=>{stopLocal(),stopRemote()}},state}dispose(){for(let stop of this.stops)stop()}}
|
|
3
3
|
export{decodeMachines,MachineFeed};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{MachineHub}from"./chunk-
|
|
2
|
+
import{MachineHub}from"./chunk-38w60dmy.js";import"./chunk-t7thxgcc.js";import"./chunk-6xr1prk6.js";import{upgradeMachine}from"./chunk-vyh3ddp0.js";import"./chunk-mdx18vtz.js";import{preferredReleaseChannel}from"./chunk-b53drx76.js";import{machineDaemonSocket}from"./chunk-0xk05694.js";import"./chunk-bkhbaqt1.js";import{isWindowsMachine,listMachines}from"./chunk-7m3txy05.js";import"./chunk-y0e28qha.js";import"./chunk-55ajzrj6.js";import"./chunk-t7j8g9f6.js";import"./chunk-dmzg9zdc.js";import"./chunk-6xppe9bj.js";import{CURRENT_VERSION,checkLatestVersion,isNewerSemver}from"./chunk-qqc8mn6x.js";import{logDaemonInfo}from"./chunk-rxqdw6s5.js";import"./chunk-m6kw77w3.js";import"./chunk-6jcmdxza.js";import"./chunk-m9ssmhrc.js";import"./chunk-han0d078.js";import"./chunk-jz1kj4sf.js";import"./chunk-v8nbqjwc.js";import"./chunk-ws2q07kb.js";import"./chunk-g9ba25q5.js";import"./chunk-cqzkk7j0.js";import"./chunk-catrr0z3.js";import"./chunk-dvpjthdf.js";import"./chunk-tn9gtf18.js";import"./chunk-r7khfa3k.js";import"./chunk-sak1tphp.js";import"./chunk-y1xnjx8x.js";import"./chunk-zsfyj36g.js";import"./chunk-1feav1w3.js";import"./chunk-vpph4nqf.js";import"./chunk-cmp64q4j.js";import"./chunk-8cw8zznb.js";import"./chunk-z3k0wg31.js";import"./chunk-4hvacnnr.js";import"./chunk-w7zv47mp.js";import"./chunk-mz82b1jf.js";import"./chunk-jhnpr3cj.js";import"./chunk-w56terew.js";import{RoveDaemonClient}from"./chunk-8wfz7gyp.js";import"./chunk-96kvwzj8.js";import"./chunk-v9n5e14e.js";import"./chunk-40dgv828.js";import"./chunk-9gctbddn.js";import"./chunk-mg1cas61.js";import{loadStateFile}from"./chunk-8trtyc98.js";import"./chunk-g5jc6c2d.js";import"./chunk-qdatysve.js";import"./chunk-7kysxgbq.js";import"./chunk-5c591htx.js";import"./chunk-y8hjgmn0.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-pn5ygqn6.js";import"./chunk-7ghwdjdc.js";import"./chunk-m5nd44st.js";import"./chunk-jt9n8k7z.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-1mp632fj.js";import"./chunk-91sykzqq.js";var MACHINES_AUTO_UPDATE_KEY="machines.autoUpdate",DEFAULTS={hubVersion:CURRENT_VERSION,enabled:()=>loadStateFile()[MACHINES_AUTO_UPDATE_KEY]!==!1,head:async()=>(await checkLatestVersion({force:!0,channel:preferredReleaseChannel()}))?.latest??null,entryOf:(alias)=>listMachines().find((m)=>m.alias===alias),busy:async(entry)=>{let socketPath=await machineDaemonSocket(entry);if(!socketPath)return!0;let client=new RoveDaemonClient(socketPath);try{return((await client.request("daemon.status")).invoking??0)>0}catch{return!0}finally{client.close()}},upgrade:upgradeMachine,log:(line)=>logDaemonInfo("machines",line),retryMs:60000};function startMachineAutoUpdate(machines,overrides={}){let deps={...DEFAULTS,...overrides},tried=new Set,running=new Set,retry=null,attempt=async(alias,version)=>{let key=`${alias}@${version}`,entry=deps.entryOf(alias);if(!entry||isWindowsMachine(entry))return void tried.add(key);let head=await deps.head();if(!head||!isNewerSemver(head,version))return void tried.add(key);if(await deps.busy(entry)){retry??=setTimeout(()=>{retry=null,look()},deps.retryMs);return}tried.add(key);let done=await deps.upgrade(entry);deps.log(done.changed?`${alias} updated: ${done.from??"?"} \u2192 ${done.to??"?"}`:`${alias} had nothing newer to install`)},look=()=>{if(!deps.enabled())return;for(let row of machines.get()){if(row.state!=="online"||!row.version||row.duplicateOf)continue;if(!isNewerSemver(deps.hubVersion,row.version))continue;if(tried.has(`${row.alias}@${row.version}`)||running.has(row.alias))continue;running.add(row.alias),attempt(row.alias,row.version).catch((err)=>deps.log(`${row.alias} auto-update failed: ${err instanceof Error?err.message:err}`)).finally(()=>running.delete(row.alias))}},stop=machines.subscribe(look);return look(),()=>{if(stop(),retry)clearTimeout(retry)}}var PUBLISH_DEBOUNCE_MS=50;function startDaemonMachineHub(bus){let hub=new MachineHub,timer=null,publish=()=>{timer=null;let live=hub.liveSignal().get(),payload={machines:hub.machinesSignal().get(),tasks:hub.tasksSignal().get().map((task)=>({...task,kind:task.kind??"task",pinned:task.pinned??!1})),live:{activity:Object.fromEntries(live.activity),changes:Object.fromEntries(live.changes),tokens:Object.fromEntries(live.tokens)}};bus.publish("machines",payload)},schedule=()=>{timer??=setTimeout(publish,PUBLISH_DEBOUNCE_MS)},stops=[hub.machinesSignal(),hub.tasksSignal(),hub.liveSignal()].map((signal)=>signal.subscribe(schedule)),lastRegistry=null,offState=bus.onPublish((event)=>{if(event.channel!=="state")return;let state=event.payload.state,text=JSON.stringify(state.machines??null);if(text===lastRegistry)return;lastRegistry=text,hub.sync()});hub.sync(),publish();let stopAutoUpdate=startMachineAutoUpdate(hub.machinesSignal());return()=>{stopAutoUpdate(),offState();for(let stop of stops)stop();if(timer)clearTimeout(timer);hub.dispose(),bus.publish("machines",{machines:[],tasks:[],live:{activity:{},changes:{},tokens:{}}})}}export{startDaemonMachineHub};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{launchTui,trackWelcomeWrite}from"./chunk-
|
|
2
|
+
import{launchTui,trackWelcomeWrite}from"./chunk-fqm68m42.js";import"./chunk-91sykzqq.js";export{trackWelcomeWrite,launchTui};
|
|
@@ -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-8ejt1bqj.js"),import("./chunk-19f8v0wz.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-v8e5smwe.js");process.stdout.write(generateCompletions(shell,cliName,mergeSubVerbs(API_VERBS)))}export{runCompletionsSubcommand};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{__require}from"./chunk-91sykzqq.js";var welcomeWrite=Promise.resolve();function trackWelcomeWrite(write){welcomeWrite=write}async function launchTui(){let{startTui}=await import("./chunk-
|
|
2
|
+
import{__require}from"./chunk-91sykzqq.js";var welcomeWrite=Promise.resolve();function trackWelcomeWrite(write){welcomeWrite=write}async function launchTui(){let{startTui}=await import("./chunk-gceeh3yr.js");await startTui(),await welcomeWrite;let{runPendingWelcomeInstalls}=await import("./chunk-8ejt1bqj.js");runPendingWelcomeInstalls()}
|
|
3
3
|
export{trackWelcomeWrite,launchTui};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{recommendedGlobalInstallCommand}from"./chunk-
|
|
2
|
+
import{recommendedGlobalInstallCommand}from"./chunk-qqc8mn6x.js";import{resolveLoginShell}from"./chunk-tn9gtf18.js";function updaterShell(deps={}){let platform=deps.platform??process.platform;if(platform!=="win32")return"sh";return resolveLoginShell({fallback:"/bin/sh",platform,env:deps.env,exists:deps.exists})}function updaterShellFailureHint(deps={}){if((deps.platform??process.platform)!=="win32")return null;return["The update script is POSIX shell. Rove runs it through Git for Windows'","bash \u2014 the same shell every engine and terminal tab launches through.","Install Git for Windows (https://git-scm.com/download/win), or update","by hand:",` ${recommendedGlobalInstallCommand()}`,""].join(`
|
|
3
3
|
`)}
|
|
4
4
|
export{updaterShell,updaterShellFailureHint};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{JsonHookAdapter,editJsonSettings,hasRoveActivityHooks,removeRoveHooks,vendorConfigHome,vendorWriteHomeDeps}from"./chunk-
|
|
2
|
+
import{JsonHookAdapter,editJsonSettings,hasRoveActivityHooks,removeRoveHooks,vendorConfigHome,vendorWriteHomeDeps}from"./chunk-qdatysve.js";import{isObject}from"./chunk-7ghwdjdc.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import{__require}from"./chunk-91sykzqq.js";import{existsSync,readFileSync}from"fs";import{join as join2}from"path";import{join}from"path";var CLAUDE_HOOK_EVENT_MAP=[{event:"SessionStart",verb:"session-start"},{event:"UserPromptSubmit",verb:"turn-start"},{event:"Stop",verb:"turn-complete"},{event:"StopFailure",verb:"turn-failed"},{event:"Notification",matcher:"permission_prompt",verb:"awaiting-input"},{event:"Notification",matcher:"elicitation_dialog",verb:"awaiting-input"},{event:"SessionEnd",verb:"session-end"},{event:"PreCompact",verb:"pre-compact"},{event:"PostCompact",verb:"post-compact"},{event:"SubagentStart",verb:"subagent-start"},{event:"SubagentStop",verb:"subagent-stop"},{event:"PreToolUse",verb:"tool-pre"},{event:"PostToolUse",verb:"tool-post"},{event:"PostToolUseFailure",verb:"tool-failed"}],ROVE_HOOK_EVENTS=[...new Set(CLAUDE_HOOK_EVENT_MAP.map((e)=>e.event))];function failureFromErrorType(errorType){if(typeof errorType!=="string")return"other";if(errorType==="rate_limit"||errorType==="overloaded")return"rate_limit";if(errorType==="billing_error")return"billing";if(errorType==="server_error")return"transient";return"other"}function claudeSettingsPath(){return join(vendorConfigHome("claude"),"settings.json")}var WORKTREE_SYNC_VERB="worktree-created";function mergeWorktreeSyncHook(current,command){let{hooks:rawHooks,...restSettings}=current,{WorktreeCreate,...otherHooks}=isObject(rawHooks)?rawHooks:{},prior=Array.isArray(WorktreeCreate)?WorktreeCreate:[],kept=removeRoveHooks(prior,[WORKTREE_SYNC_VERB]);if(command!==null)kept.push({hooks:[{type:"command",command}]});let nextHooks={...otherHooks};if(kept.length>0)nextHooks.WorktreeCreate=kept;return Object.keys(nextHooks).length>0?{...restSettings,hooks:nextHooks}:{...restSettings}}class ClaudeHookAdapter extends JsonHookAdapter{vendor="claude";eventMap=CLAUDE_HOOK_EVENT_MAP;globalSettingsPath(){return claudeSettingsPath()}activityDetailFromPayload(kind,payload){if(kind==="turn-failed")return{failure:failureFromErrorType(payload.error??payload.error_type)};if(kind==="awaiting-input")return{waiting:payload.notification_type==="elicitation_dialog"?"input":"permission"};if(kind==="tool-pre"||kind==="tool-post"||kind==="tool-failed")return{tool:{...typeof payload.tool_name==="string"?{name:payload.tool_name}:{},...typeof payload.tool_use_id==="string"?{id:payload.tool_use_id}:{}}};if(kind==="pre-compact"||kind==="post-compact")return{compact:{trigger:payload.trigger==="manual"?"manual":"auto"}};if(kind==="subagent-start"||kind==="subagent-stop")return{subagent:{...typeof payload.agent_type==="string"?{type:payload.agent_type}:{},...typeof payload.agent_id==="string"?{id:payload.agent_id}:{}}};return}sessionFromPayload(payload){if(typeof payload.session_id!=="string"||!payload.session_id)return;return{sessionId:payload.session_id,...typeof payload.transcript_path==="string"&&payload.transcript_path?{transcriptPath:payload.transcript_path}:{}}}isUnattendedSession(env){return env.CLAUDE_CODE_SESSION_ATTENDED==="0"}async externallyManagedHooks(){let{isRovePluginEnabled,detectLegacyInstalls,migrationHint}=await import("./chunk-9gevsmy4.js");if(!isRovePluginEnabled())return;let notice=migrationHint(detectLegacyInstalls(),ROVE_PRODUCT_NAME);return notice?{notice}:{}}supportsWorktreeSync(){return!0}async removeWorktreeSyncHook(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeWorktreeSyncHook(cur,null))}}var PLUGIN_NAME="rove";function readSettings(path){try{let parsed=JSON.parse(readFileSync(path,"utf8"));return isObject(parsed)?parsed:null}catch{return null}}function isRovePluginEnabled(settingsFilePath=claudeSettingsPath()){let settings=readSettings(settingsFilePath);if(!settings||!isObject(settings.enabledPlugins))return!1;return Object.entries(settings.enabledPlugins).some(([key,on])=>on===!0&&key.split("@")[0]===PLUGIN_NAME)}function detectLegacyInstalls(opts={}){let settingsFilePath=opts.settingsFilePath??claudeSettingsPath(),settings=readSettings(settingsFilePath),legacyHooks=settings!==null&&(hasRoveActivityHooks(settings,CLAUDE_HOOK_EVENT_MAP)||settingsHasWorktreeWatch(settings)),skillDir=join2(vendorConfigHome("claude",vendorWriteHomeDeps(opts.home)),"skills","rove"),legacySkillDirs=existsSync(join2(skillDir,"SKILL.md"))?[skillDir]:[];return{legacyHooks,legacySkillDirs}}function settingsHasWorktreeWatch(settings){let hooks=isObject(settings.hooks)?settings.hooks:{};return Object.values(hooks).some((groups)=>Array.isArray(groups)&&groups.some((g)=>isObject(g)&&Array.isArray(g.hooks)&&g.hooks.some((h)=>isObject(h)&&typeof h.command==="string"&&h.command.includes("worktree-created")&&!h.command.includes("CLAUDE_PLUGIN_ROOT"))))}function migrationHint(findings,cliName){if(!findings.legacyHooks&&findings.legacySkillDirs.length===0)return null;let lines=[`${cliName}: the Rove Claude Code plugin is enabled, but legacy installs remain:`];if(findings.legacyHooks)lines.push(" \u2022 ~/.claude/settings.json still has the settings-managed Rove hooks (every event fires TWICE).",` Run \`${cliName} hook cleanup\` to remove them (only Rove's own entries are touched).`);for(let dir of findings.legacySkillDirs)lines.push(` \u2022 legacy skill copy at ${dir} (the plugin bundles the skill \u2014 two copies double-register).`," Remove that directory to keep the plugin's copy only.");return lines.push(" Reading this inside a session? Just ask your agent to run the cleanup for you."),`${lines.join(`
|
|
3
3
|
`)}
|
|
4
4
|
`}
|
|
5
5
|
export{isRovePluginEnabled,detectLegacyInstalls,migrationHint,ClaudeHookAdapter};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{publishRoveTerminalTitle}from"./chunk-3aqhytyy.js";import{ensureGlobalRoveHooks}from"./chunk-
|
|
2
|
+
import{publishRoveTerminalTitle}from"./chunk-3aqhytyy.js";import{ensureGlobalRoveHooks}from"./chunk-2bgb2810.js";import{LAST_RUN_VERSION_KEY,enforceResetGate}from"./chunk-352dhjkf.js";import"./chunk-17e2tgyg.js";import"./chunk-2bgmby1d.js";import"./chunk-psxhek7n.js";import{CURRENT_VERSION,compareSemver}from"./chunk-qqc8mn6x.js";import{detectShell}from"./chunk-8q0nr6v6.js";import"./chunk-289j5sz5.js";import"./chunk-z35jsvwk.js";import"./chunk-ws2q07kb.js";import"./chunk-zsfyj36g.js";import"./chunk-vpph4nqf.js";import"./chunk-cmp64q4j.js";import"./chunk-z3k0wg31.js";import"./chunk-4hvacnnr.js";import"./chunk-w7zv47mp.js";import"./chunk-mz82b1jf.js";import"./chunk-jhnpr3cj.js";import"./chunk-w56terew.js";import"./chunk-8wfz7gyp.js";import"./chunk-96kvwzj8.js";import"./chunk-v9n5e14e.js";import"./chunk-40dgv828.js";import"./chunk-9gctbddn.js";import"./chunk-mg1cas61.js";import{loadStateFile,patchStateFile}from"./chunk-8trtyc98.js";import"./chunk-g5jc6c2d.js";import"./chunk-qdatysve.js";import"./chunk-7kysxgbq.js";import"./chunk-5c591htx.js";import"./chunk-y8hjgmn0.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-pn5ygqn6.js";import"./chunk-7ghwdjdc.js";import"./chunk-m5nd44st.js";import"./chunk-jt9n8k7z.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";var WELCOMED_KEY="welcomed";function shouldWelcome(state){if(state[WELCOMED_KEY]===!0)return!1;return typeof state[LAST_RUN_VERSION_KEY]!=="string"}function takeWelcome(){if(!shouldWelcome(loadStateFile()))return null;try{patchStateFile({[WELCOMED_KEY]:!0})}catch{}return{shell:detectShell()}}var WHATS_NEW_SEEN_KEY="app.whatsNewSeenVersion";function whatsNewFromVersion(state,current=CURRENT_VERSION){let stamped=state[WHATS_NEW_SEEN_KEY]??state[LAST_RUN_VERSION_KEY];if(typeof stamped!=="string"||stamped.length===0)return null;return compareSemver(current,stamped)>0?stamped:null}function takeWhatsNew(){let from=whatsNewFromVersion(loadStateFile());try{patchStateFile({[WHATS_NEW_SEEN_KEY]:CURRENT_VERSION})}catch{}return from}async function startTui(){let whatsNewFrom=takeWhatsNew(),welcome=takeWelcome();enforceResetGate(),publishRoveTerminalTitle(),await ensureGlobalRoveHooks();let{loadPluginEngines}=await import("./chunk-h57gekkj.js");loadPluginEngines();let{startSkillStatus}=await import("./chunk-dxyy3ep8.js");startSkillStatus();let{startWorkspaceHost}=await import("./chunk-5g01tqn6.js");await startWorkspaceHost({whatsNewFrom,welcome})}export{startTui};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import{ensurePluginEnginesLoaded,loadPluginEngines,registeredEngineIds,reloadPluginEngines}from"./chunk-qcdznw50.js";import"./chunk-psxhek7n.js";import"./chunk-ws2q07kb.js";import"./chunk-4hvacnnr.js";import"./chunk-w7zv47mp.js";import"./chunk-96kvwzj8.js";import"./chunk-v9n5e14e.js";import"./chunk-40dgv828.js";import"./chunk-9gctbddn.js";import"./chunk-mg1cas61.js";import"./chunk-8trtyc98.js";import"./chunk-qdatysve.js";import"./chunk-7kysxgbq.js";import"./chunk-5c591htx.js";import"./chunk-y8hjgmn0.js";import"./chunk-xy8be792.js";import"./chunk-h2m7em1e.js";import"./chunk-pn5ygqn6.js";import"./chunk-7ghwdjdc.js";import"./chunk-m5nd44st.js";import"./chunk-jt9n8k7z.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import"./chunk-91sykzqq.js";export{reloadPluginEngines,registeredEngineIds,loadPluginEngines,ensurePluginEnginesLoaded};
|
|
@@ -6,6 +6,6 @@ ${EXPORT_USAGE}
|
|
|
6
6
|
`),process.exit(2)}function parseFormat(args){let format="json";for(let i=0;i<args.length;i++){let a=args[i];if(a==="--json")format="json";else if(a==="--csv")format="csv";else if(a==="--format"){let v=args[++i];if(v===void 0)usageError("--format requires a value (json, csv, or table)");format=coerceFormat(v)}else if(a.startsWith("--format="))format=coerceFormat(a.slice(9));else usageError(`unexpected argument "${a}"`)}return format}function coerceFormat(value){if(value==="json"||value==="csv"||value==="table")return value;usageError(`unknown format "${value}" (expected json, csv, or table)`)}function csvCell(value){if(/[",\r\n]/.test(value))return`"${value.replace(/"/g,'""')}"`;return value}function renderCsv(rows){let lines=[COLUMNS.join(",")];for(let row of rows)lines.push(COLUMNS.map((c)=>csvCell(row[c])).join(","));return lines.join(`
|
|
7
7
|
`)}function padCell(cell,width){return cell+" ".repeat(Math.max(0,width-displayWidth(cell)))}function renderTable(rows){let widths={};for(let c of COLUMNS)widths[c]=Math.max(displayWidth(c),...rows.map((r)=>displayWidth(r[c])));let line=(cells)=>COLUMNS.map((c)=>padCell(cells[c],widths[c])).join(" ").trimEnd(),header={};for(let c of COLUMNS)header[c]=c;return[line(header),...rows.map(line)].join(`
|
|
8
8
|
`)}function renderExport(tasks,format){let rows=tasks.map(toRow);if(format==="json")return JSON.stringify(rows,null,2);if(format==="csv")return renderCsv(rows);return renderTable(rows)}async function runExportSubcommand(args){if(args.includes("--help")||args.includes("-h")||args.includes("help")){process.stdout.write(`${EXPORT_USAGE}
|
|
9
|
-
`);return}let format=parseFormat(args),{TaskIndexStore}=await import("./chunk-
|
|
9
|
+
`);return}let format=parseFormat(args),{TaskIndexStore}=await import("./chunk-dz562xtj.js"),store=new TaskIndexStore;await store.load();let tasks=store.list();if(tasks.length===0&&format==="table"){process.stdout.write(`no tasks
|
|
10
10
|
`);return}process.stdout.write(`${renderExport(tasks,format)}
|
|
11
11
|
`)}export{runExportSubcommand,renderExport};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{RoveDaemonClient}from"./chunk-
|
|
2
|
+
import{RoveDaemonClient}from"./chunk-8wfz7gyp.js";import{defaultDaemonSocketPath,defaultPtyHostSocketPath}from"./chunk-2z2jwetd.js";import{spawn}from"child_process";import{existsSync}from"fs";import{join}from"path";var LAUNCH_CMD_ENV="ROVE_LAUNCH_CMD",LAUNCH_LOG_ENV="ROVE_LAUNCH_LOG",WIN_DETACHED_LAUNCHER_PS=`
|
|
3
3
|
$ErrorActionPreference = 'Stop'
|
|
4
4
|
$cmd = $env:${LAUNCH_CMD_ENV}
|
|
5
5
|
$log = $env:${LAUNCH_LOG_ENV}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{installSkillErrors,missingSkillNames}from"./chunk-
|
|
2
|
+
import{installSkillErrors,missingSkillNames}from"./chunk-qg92cfsh.js";import{createStateCell}from"./chunk-cmp64q4j.js";import{installedEngineIds}from"./chunk-4hvacnnr.js";var skillMissing=createStateCell([]),POLL_MS=30000,started=!1;function refreshSkillStatus(){if(!started)return;installedEngineIds().then((installed)=>{let next=missingSkillNames(installed);if(next.join(`
|
|
3
3
|
`)!==skillMissing.get().join(`
|
|
4
4
|
`))skillMissing.set(next)}).catch(()=>{})}function startSkillStatus(){if(started)return;started=!0,refreshSkillStatus(),setInterval(refreshSkillStatus,POLL_MS).unref?.()}function installSkillNow(){let error=installSkillErrors();return refreshSkillStatus(),error}
|
|
5
5
|
export{skillMissing,refreshSkillStatus,startSkillStatus,installSkillNow};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{isProcessAlive}from"./chunk-
|
|
2
|
+
import{isProcessAlive}from"./chunk-apaw34c5.js";import{randomBytes}from"crypto";import{linkSync,mkdirSync,readFileSync,unlinkSync,writeFileSync}from"fs";import{link,mkdir,readFile,unlink,writeFile}from"fs/promises";import{dirname}from"path";class LockfileError extends Error{heldByPid;constructor(message,heldByPid){super(message);this.name="LockfileError",this.heldByPid=heldByPid}}async function acquire(lockPath,opts={}){await mkdir(dirname(lockPath),{recursive:!0});let token=`${process.pid}:${randomBytes(8).toString("hex")}`,sidecar=`${lockPath}.${token.replace(":","-")}`;for(;;){await writeFile(sidecar,token);try{return await link(sidecar,lockPath),token}catch(err){if(err.code!=="EEXIST")throw err}finally{await unlink(sidecar).catch(()=>{})}let holder;try{holder=(await readFile(lockPath,"utf8")).trim()}catch(err){if(err.code!=="ENOENT")throw err;continue}let holderPid=Number.parseInt(holder,10),alive=Number.isFinite(holderPid)&&holderPid>0&&isProcessAlive(holderPid);if(alive&&!opts.forceTakeover)throw new LockfileError(`task index is locked by another Rove instance (pid ${holderPid})`,holderPid);console.warn(`[rove] removing stale lockfile at ${lockPath} (was held by pid ${holderPid}${alive?", forced":", process gone"})`),releaseSync(lockPath,holder)}}async function release(lockPath,token){let current;try{current=(await readFile(lockPath,"utf8")).trim()}catch(err){if(err.code==="ENOENT")return;throw err}if(current!==token)return;try{await unlink(lockPath)}catch(err){if(err.code==="ENOENT")return;throw err}}function sleepSync(ms){Atomics.wait(new Int32Array(new SharedArrayBuffer(4)),0,0,ms)}function acquireSync(lockPath,timeoutMs=5000){mkdirSync(dirname(lockPath),{recursive:!0});let token=`${process.pid}:${randomBytes(8).toString("hex")}`,sidecar=`${lockPath}.${token.replace(":","-")}`,deadline=Date.now()+timeoutMs;for(;;){writeFileSync(sidecar,token);try{return linkSync(sidecar,lockPath),token}catch(err){if(err.code!=="EEXIST")throw err}finally{try{unlinkSync(sidecar)}catch{}}let holder;try{holder=readFileSync(lockPath,"utf8").trim()}catch(err){if(err.code!=="ENOENT")throw err;continue}let holderPid=Number.parseInt(holder,10);if(Number.isFinite(holderPid)&&holderPid>0&&isProcessAlive(holderPid)){if(Date.now()>=deadline)throw new LockfileError(`${lockPath} is locked by another Rove instance (pid ${holderPid})`,holderPid);sleepSync(25);continue}console.warn(`[rove] removing stale lockfile at ${lockPath} (was held by pid ${holderPid}, process gone)`),releaseSync(lockPath,holder)}}function releaseSync(lockPath,token){try{if(readFileSync(lockPath,"utf8").trim()!==token)return;unlinkSync(lockPath)}catch(err){if(err.code!=="ENOENT")throw err}}
|
|
3
3
|
export{LockfileError,acquire,release,acquireSync,releaseSync};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{updaterShell,updaterShellFailureHint}from"./chunk-
|
|
2
|
+
import{updaterShell,updaterShellFailureHint}from"./chunk-g37q36fs.js";import{preferredReleaseChannel,rememberReleaseChannel}from"./chunk-b53drx76.js";import{BREAKING_VERSIONS,CURRENT_VERSION,DEFAULT_RELEASE_CHANNEL,RELEASE_CHANNELS,UPDATE_COMMAND,UPDATE_SCRIPT_URL,breakingVersionsCrossed,channelOf,checkLatestVersion,fetchReleaseSummaries,recommendedGlobalInstallCommand,updateCommandFor}from"./chunk-qqc8mn6x.js";import"./chunk-tn9gtf18.js";import"./chunk-8trtyc98.js";import"./chunk-jt9n8k7z.js";import"./chunk-apaw34c5.js";import"./chunk-yt15y085.js";import"./chunk-2z2jwetd.js";import"./chunk-8143k3t6.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import"./chunk-g6wb8p4p.js";import"./chunk-nc46gddg.js";import{__require}from"./chunk-91sykzqq.js";import{spawnSync}from"child_process";var CLI_NAME=ROVE_PRODUCT_NAME;function updatePlan(target){let shell=updateCommandFor(target);return{command:updaterShell(),args:["-c",shell],display:shell}}var VERSION_SHAPE=/^\d+\.\d+\.\d+(-[0-9A-Za-z.-]+)?$/;function isReleaseChannel(value){return RELEASE_CHANNELS.includes(value)}var CHANNEL_FLAGS={"--nightly":"nightly","--next":"next","--stable":"latest","--latest":"latest",stable:"latest"};function parseUpdateArgs(args){let dryRun=!1,list=!1,version,channel;for(let i=0;i<args.length;i+=1){let arg=args[i];if(arg===void 0)continue;if(arg==="--help"||arg==="-h"||arg==="help")return{help:!0,dryRun,list,version,channel};if(arg==="dry-run"||arg==="--dry-run"){dryRun=!0;continue}if(arg==="list"||arg==="--list"){list=!0;continue}if(arg==="--channel"||arg.startsWith("--channel=")){let value=(arg.startsWith("--channel=")?arg.slice(10):void 0)??args[++i];if(value===void 0||!isReleaseChannel(value))process.stderr.write(`${CLI_NAME} update: --channel expects one of ${RELEASE_CHANNELS.join(", ")}${value===void 0?"":` (got "${value}")`}
|
|
3
3
|
|
|
4
4
|
`),printUsage(process.stderr),process.exit(2);channel=value;continue}let flagged=CHANNEL_FLAGS[arg];if(channel===void 0&&flagged!==void 0){channel=flagged;continue}if(channel===void 0&&isReleaseChannel(arg)){channel=arg;continue}if(version===void 0&&VERSION_SHAPE.test(arg)){version=arg;continue}process.stderr.write(`${CLI_NAME} update: unknown argument "${arg}"
|
|
5
5
|
|
|
@@ -10,7 +10,7 @@ import{updaterShell,updaterShellFailureHint}from"./chunk-nd5bhfxv.js";import{pre
|
|
|
10
10
|
install one with: ${CLI_NAME} update <version>
|
|
11
11
|
`)}async function warnBreakingCrossings(target,channel,io){if(BREAKING_VERSIONS.length===0)return;let resolved=target??(await checkLatestVersion({force:!0,channel}))?.latest;if(!resolved)return;let crossed=breakingVersionsCrossed(CURRENT_VERSION,resolved);if(crossed.length===0)return;io.stderr.write([`warning: ${CURRENT_VERSION} -> ${resolved} crosses breaking version(s): ${crossed.join(", ")}.`,`After this update, Rove will refuse to start until you run \`${CLI_NAME} reset\``,"(worktrees are never touched; add --hard only to also wipe the task index).",""].join(`
|
|
12
12
|
`))}var FOLLOW_UP_NOTE=["",`${CLI_NAME}: installed. Two background processes are still running the old build:`,` daemon \u2192 \`${CLI_NAME} daemon restart\` (safe; never touches live sessions)`,` pty host \u2192 only \`${CLI_NAME} reset\` replaces it, and that ends every live`," terminal and engine session \u2014 do it when you can afford to.",`Run \`${CLI_NAME} doctor\` to see which of the two is actually stale.`,""].join(`
|
|
13
|
-
`);async function runUpdateSubcommand(args,deps){let io={spawn:deps?.spawn??spawnSync,stdout:deps?.stdout??process.stdout,stderr:deps?.stderr??process.stderr,exit:deps?.exit??((code)=>process.exit(code)),channel:deps?.channel??{get:()=>preferredReleaseChannel(),remember:rememberReleaseChannel}},parsed=parseUpdateArgs(args);if(parsed.help){printUsage(io.stdout);return}if(parsed.list){if(deps===void 0&&process.stdout.isTTY){let{startVersionsHost}=await import("./chunk-
|
|
13
|
+
`);async function runUpdateSubcommand(args,deps){let io={spawn:deps?.spawn??spawnSync,stdout:deps?.stdout??process.stdout,stderr:deps?.stderr??process.stderr,exit:deps?.exit??((code)=>process.exit(code)),channel:deps?.channel??{get:()=>preferredReleaseChannel(),remember:rememberReleaseChannel}},parsed=parseUpdateArgs(args);if(parsed.help){printUsage(io.stdout);return}if(parsed.list){if(deps===void 0&&process.stdout.isTTY){let{startVersionsHost}=await import("./chunk-q5ncrh80.js");await startVersionsHost();return}await printVersionList(io);return}let channel=parsed.channel??io.channel.get(),target=parsed.version??(channel===DEFAULT_RELEASE_CHANNEL?void 0:channel),plan=updatePlan(target),switching=parsed.version===void 0&&channel!==channelOf();if(io.stdout.write(`${CLI_NAME} ${CURRENT_VERSION} -> ${target??channel}
|
|
14
14
|
`),switching)io.stdout.write(`switching channel: ${channelOf()} -> ${channel}
|
|
15
15
|
`);if(io.stdout.write(`running: ${plan.display}
|
|
16
16
|
`),await warnBreakingCrossings(parsed.version,channel,io),parsed.dryRun)return;let result=io.spawn(plan.command,plan.args,{stdio:"inherit"});if(result.error){io.stderr.write(`${CLI_NAME} update: failed to run ${plan.command}: ${result.error.message}
|