@sma1lboy/rove 0.9.274 → 0.9.276

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (195) hide show
  1. package/dist/cli/chunk-0d7517kk.js +6 -0
  2. package/dist/cli/{chunk-55ajzrj6.js → chunk-0r1jf8m9.js} +1 -1
  3. package/dist/cli/{chunk-qe7xb4rm.js → chunk-1ca2j9w6.js} +2 -2
  4. package/dist/cli/chunk-1eef3z5v.js +3 -0
  5. package/dist/cli/{chunk-8h437k1q.js → chunk-1jjqk7sq.js} +1 -1
  6. package/dist/cli/chunk-1n03wzx4.js +3 -0
  7. package/dist/cli/{chunk-9trbc3kj.js → chunk-22rgewg0.js} +2 -2
  8. package/dist/cli/{chunk-jwedmkm8.js → chunk-283vd9h7.js} +1 -1
  9. package/dist/cli/chunk-2kqxz9a4.js +5 -0
  10. package/dist/cli/chunk-2xsxcdp6.js +3 -0
  11. package/dist/cli/{chunk-bj6sa371.js → chunk-372g44dg.js} +1 -1
  12. package/dist/cli/{chunk-4dxc29mm.js → chunk-387w0db1.js} +1 -1
  13. package/dist/cli/{chunk-ypd337d0.js → chunk-3xkhcfet.js} +2 -2
  14. package/dist/cli/{chunk-qvnr8c18.js → chunk-3y9xzbqh.js} +1 -1
  15. package/dist/cli/chunk-4117kgmx.js +2 -0
  16. package/dist/cli/chunk-4a05fgdh.js +2 -0
  17. package/dist/cli/chunk-4dt1gfb3.js +3 -0
  18. package/dist/cli/{chunk-ycd28edp.js → chunk-4xvmrg86.js} +3 -4
  19. package/dist/cli/{chunk-sa48rtjz.js → chunk-511103e8.js} +1 -1
  20. package/dist/cli/chunk-59p3h5e9.js +2 -0
  21. package/dist/cli/{chunk-egpcaxwb.js → chunk-5e9y8aw5.js} +1 -1
  22. package/dist/cli/chunk-5nvg3ek8.js +3 -0
  23. package/dist/cli/chunk-5yfffvqe.js +2 -0
  24. package/dist/cli/{chunk-16ttm9x6.js → chunk-63cwjceg.js} +1 -1
  25. package/dist/cli/{chunk-y5axx6ev.js → chunk-6mtfafaw.js} +1 -1
  26. package/dist/cli/{chunk-0g3sjn8z.js → chunk-6xga1a2d.js} +1 -1
  27. package/dist/cli/{chunk-xbwq4bc0.js → chunk-745pg3xm.js} +1 -1
  28. package/dist/cli/{chunk-29s67j3k.js → chunk-81thm1eb.js} +4 -4
  29. package/dist/cli/chunk-82apkcrk.js +5 -0
  30. package/dist/cli/chunk-84pvn784.js +2 -0
  31. package/dist/cli/{chunk-1exwrmjd.js → chunk-883fyezq.js} +1 -1
  32. package/dist/cli/{chunk-gryq2vgw.js → chunk-8dd60adw.js} +1 -1
  33. package/dist/cli/{chunk-qfe1wf5c.js → chunk-91tcwxph.js} +1 -1
  34. package/dist/cli/{chunk-mxgtz5vz.js → chunk-9c3brkb3.js} +1 -1
  35. package/dist/cli/chunk-9gh8kgjs.js +2 -0
  36. package/dist/cli/{chunk-h8t4xg1p.js → chunk-9rj2fx6v.js} +1 -1
  37. package/dist/cli/{chunk-w9cdc97q.js → chunk-a4r45qdn.js} +1 -1
  38. package/dist/cli/{chunk-p6jw0zcd.js → chunk-agvtzads.js} +1 -1
  39. package/dist/cli/{chunk-gcg5h667.js → chunk-awh7np6x.js} +1 -1
  40. package/dist/cli/chunk-b035pej7.js +20 -0
  41. package/dist/cli/{chunk-ez438kn3.js → chunk-b95q6zhk.js} +1 -1
  42. package/dist/cli/chunk-brgfsm5v.js +2 -0
  43. package/dist/cli/chunk-bw98jn7g.js +18 -0
  44. package/dist/cli/{chunk-bexnp6g4.js → chunk-c63vgbkw.js} +1 -1
  45. package/dist/cli/{chunk-8sggyn8y.js → chunk-c6fy8xew.js} +1 -1
  46. package/dist/cli/chunk-c7mz2aq0.js +2 -0
  47. package/dist/cli/{chunk-ec7f3wcm.js → chunk-cbrt4s7m.js} +2 -2
  48. package/dist/cli/chunk-ccwe9n56.js +19 -0
  49. package/dist/cli/chunk-cfzg8q3e.js +4 -0
  50. package/dist/cli/{chunk-387ecqb8.js → chunk-d0hpes59.js} +1 -1
  51. package/dist/cli/{chunk-edrxs4cy.js → chunk-d7f022eb.js} +5 -5
  52. package/dist/cli/{chunk-by6fjf7m.js → chunk-d7xbm9jp.js} +1 -1
  53. package/dist/cli/{chunk-3v9s3bcz.js → chunk-d9643dwf.js} +1 -1
  54. package/dist/cli/{chunk-x20bs6bs.js → chunk-dgx02565.js} +1 -1
  55. package/dist/cli/{chunk-ecrw211n.js → chunk-dt676ks9.js} +1 -1
  56. package/dist/cli/{chunk-g9yba5vh.js → chunk-e3cd4qd2.js} +2 -2
  57. package/dist/cli/chunk-e3t1zbv1.js +5 -0
  58. package/dist/cli/{chunk-0rrmz6k6.js → chunk-eege1x0a.js} +1 -1
  59. package/dist/cli/{chunk-t34kjg5y.js → chunk-ehm9abge.js} +4 -3
  60. package/dist/cli/{chunk-mmq6922s.js → chunk-eq7vey2j.js} +2 -2
  61. package/dist/cli/chunk-eyvw70yb.js +2 -0
  62. package/dist/cli/{chunk-m6yy3qc1.js → chunk-f76gzvq3.js} +1 -1
  63. package/dist/cli/{chunk-xkmdxcjg.js → chunk-fn7ffyam.js} +1 -1
  64. package/dist/cli/chunk-g4dtqbrj.js +2 -0
  65. package/dist/cli/chunk-g9ba25q5.js +3 -0
  66. package/dist/cli/{chunk-22d4fjjb.js → chunk-gafkp74h.js} +1 -1
  67. package/dist/cli/chunk-gctqthxq.js +97 -0
  68. package/dist/cli/{chunk-dpq60qph.js → chunk-gq57he03.js} +1 -1
  69. package/dist/cli/chunk-h2gznz46.js +2 -0
  70. package/dist/cli/{chunk-03rbg95q.js → chunk-h64rsbrx.js} +5 -5
  71. package/dist/cli/{chunk-5dd7trgf.js → chunk-h7vwn62z.js} +1 -1
  72. package/dist/cli/chunk-hcvp84b3.js +4 -0
  73. package/dist/cli/chunk-hhcmzs67.js +78 -0
  74. package/dist/cli/chunk-hmjg1qh3.js +2 -0
  75. package/dist/cli/{chunk-jd7p0y5x.js → chunk-j9b285x6.js} +1 -1
  76. package/dist/cli/{chunk-tw9w8pzg.js → chunk-jckx79gk.js} +3 -3
  77. package/dist/cli/{chunk-r77pfw4m.js → chunk-je80r59s.js} +1 -1
  78. package/dist/cli/{chunk-sbds7zx4.js → chunk-jfcn77n9.js} +1 -1
  79. package/dist/cli/chunk-jn10xeft.js +2 -0
  80. package/dist/cli/{chunk-g263457v.js → chunk-k1pwp155.js} +1 -1
  81. package/dist/cli/chunk-k235z3ct.js +2 -0
  82. package/dist/cli/{chunk-qs1r0tqr.js → chunk-m2a19yt4.js} +1 -1
  83. package/dist/cli/{chunk-5gzpq34w.js → chunk-m73x5nry.js} +3 -3
  84. package/dist/cli/chunk-ma21srvx.js +3 -0
  85. package/dist/cli/chunk-mdc7b01e.js +3 -0
  86. package/dist/cli/{chunk-kgs56yns.js → chunk-mkfc9a09.js} +1 -1
  87. package/dist/cli/{chunk-9er68n24.js → chunk-mq88bvj6.js} +1 -1
  88. package/dist/cli/chunk-mqfvzdpr.js +3 -0
  89. package/dist/cli/{chunk-m4dvx7bd.js → chunk-mz1ffkqb.js} +3 -3
  90. package/dist/cli/{chunk-1rjq808h.js → chunk-n0rdn2fn.js} +1 -1
  91. package/dist/cli/{chunk-sza3tyhs.js → chunk-n6marmjn.js} +1 -1
  92. package/dist/cli/chunk-n8t4y0bj.js +10 -0
  93. package/dist/cli/chunk-nbpq1tkx.js +98 -0
  94. package/dist/cli/{chunk-b492aee1.js → chunk-ne6x6g2c.js} +1 -1
  95. package/dist/cli/{chunk-fexzfgd1.js → chunk-nr7e3e82.js} +1 -1
  96. package/dist/cli/chunk-ns35rdyk.js +3 -0
  97. package/dist/cli/chunk-pap7k3b4.js +3 -0
  98. package/dist/cli/chunk-pdq3ya2e.js +3 -0
  99. package/dist/cli/chunk-q8ffd1pc.js +3 -0
  100. package/dist/cli/{chunk-39sfhppm.js → chunk-qna1s1r4.js} +1 -1
  101. package/dist/cli/{chunk-tjj9bt7n.js → chunk-qqr4tfhk.js} +1 -1
  102. package/dist/cli/chunk-r7kmn4js.js +2 -0
  103. package/dist/cli/chunk-r7ntkd6y.js +15 -0
  104. package/dist/cli/{chunk-rtpa8hg3.js → chunk-rjfdzjhj.js} +1 -1
  105. package/dist/cli/chunk-syfs63r2.js +2 -0
  106. package/dist/cli/{chunk-4hnz77xf.js → chunk-syn0tfwy.js} +1 -1
  107. package/dist/cli/chunk-t4qr9sv4.js +4 -0
  108. package/dist/cli/{chunk-6jk2khme.js → chunk-t52gzaeb.js} +1 -1
  109. package/dist/cli/chunk-teh40faw.js +1 -1
  110. package/dist/cli/{chunk-gqh6atvp.js → chunk-tjhw09bz.js} +1 -1
  111. package/dist/cli/chunk-tq0h3vy6.js +3 -0
  112. package/dist/cli/{chunk-snqa07h6.js → chunk-tvdrvgen.js} +1 -1
  113. package/dist/cli/chunk-tz373e5w.js +3 -0
  114. package/dist/cli/chunk-v1r83m3n.js +3 -0
  115. package/dist/cli/chunk-vp171as9.js +65 -0
  116. package/dist/cli/chunk-vtcr71fs.js +8 -0
  117. package/dist/cli/{chunk-zaw71cf4.js → chunk-vz0f8e8q.js} +1 -1
  118. package/dist/cli/chunk-w77s2df8.js +3 -0
  119. package/dist/cli/chunk-w7v4jzwy.js +3 -0
  120. package/dist/cli/chunk-wvqn1t55.js +2 -0
  121. package/dist/cli/{chunk-r40aj7z6.js → chunk-x1ghdmp1.js} +1 -1
  122. package/dist/cli/{chunk-nzbq51h9.js → chunk-x3n4y5sp.js} +1 -1
  123. package/dist/cli/{chunk-q6septaj.js → chunk-xb3p11g0.js} +1 -1
  124. package/dist/cli/{chunk-yzkhwn31.js → chunk-xd93fm1k.js} +1 -1
  125. package/dist/cli/chunk-xn2f56tg.js +3 -0
  126. package/dist/cli/chunk-xv3217yv.js +2 -0
  127. package/dist/cli/chunk-yhytkwpv.js +2 -0
  128. package/dist/cli/{chunk-hfdk7j28.js → chunk-yk9b8zgn.js} +1 -1
  129. package/dist/cli/chunk-zat16a83.js +2 -0
  130. package/dist/cli/chunk-zcrs4sm2.js +3 -0
  131. package/dist/cli/{chunk-kx53jjee.js → chunk-zkp6nty3.js} +8 -6
  132. package/dist/cli/index.js +5 -5
  133. package/dist/cli/pty-host-node.mjs +258 -29
  134. package/dist/cli/rove-run.js +1 -1
  135. package/dist/cli/rove.js +1 -1
  136. package/dist/completions/rove.bash +2 -2
  137. package/dist/completions/rove.fish +2 -2
  138. package/dist/completions/rove.zsh +2 -2
  139. package/dist/skills/rove/SKILL.md +23 -9
  140. package/dist/skills/rove/references/api-flags.md +20 -11
  141. package/dist/web/assets/index-C5t3gibI.css +1 -0
  142. package/dist/web/assets/index-Djp7M6r8.js +122 -0
  143. package/dist/web/index.html +2 -2
  144. package/dist/web/sw.js +52 -0
  145. package/package.json +3 -3
  146. package/dist/cli/chunk-033k4ap7.js +0 -2
  147. package/dist/cli/chunk-0ppkvphp.js +0 -2
  148. package/dist/cli/chunk-11wyec8z.js +0 -2
  149. package/dist/cli/chunk-15fp4p9v.js +0 -15
  150. package/dist/cli/chunk-1ffqacz9.js +0 -3
  151. package/dist/cli/chunk-2v68zaaa.js +0 -2
  152. package/dist/cli/chunk-2y29zrm1.js +0 -2
  153. package/dist/cli/chunk-4d1v6066.js +0 -3
  154. package/dist/cli/chunk-5zsdjrgz.js +0 -4
  155. package/dist/cli/chunk-68wpp5y8.js +0 -20
  156. package/dist/cli/chunk-6h4qdckd.js +0 -3
  157. package/dist/cli/chunk-6jj82bej.js +0 -2
  158. package/dist/cli/chunk-783d1ba0.js +0 -3
  159. package/dist/cli/chunk-78v1q5mz.js +0 -2
  160. package/dist/cli/chunk-7z463zkx.js +0 -3
  161. package/dist/cli/chunk-97m9nyw7.js +0 -2
  162. package/dist/cli/chunk-9bae7f3m.js +0 -4
  163. package/dist/cli/chunk-b5c7p22a.js +0 -2
  164. package/dist/cli/chunk-b5pytfgm.js +0 -2
  165. package/dist/cli/chunk-b68dd36h.js +0 -3
  166. package/dist/cli/chunk-bbksmb5a.js +0 -3
  167. package/dist/cli/chunk-cpf78z3x.js +0 -4
  168. package/dist/cli/chunk-cyzp2btw.js +0 -63
  169. package/dist/cli/chunk-e01321zn.js +0 -5
  170. package/dist/cli/chunk-erx7x9xg.js +0 -97
  171. package/dist/cli/chunk-ewqqwtrj.js +0 -2
  172. package/dist/cli/chunk-fmbv4m3y.js +0 -25
  173. package/dist/cli/chunk-fs51wx31.js +0 -3
  174. package/dist/cli/chunk-fvvb0072.js +0 -3
  175. package/dist/cli/chunk-g3tv8kht.js +0 -2
  176. package/dist/cli/chunk-g53yqr82.js +0 -78
  177. package/dist/cli/chunk-k67vbszb.js +0 -3
  178. package/dist/cli/chunk-kyt9ytz2.js +0 -20
  179. package/dist/cli/chunk-n2ejvjrd.js +0 -3
  180. package/dist/cli/chunk-p4s826r2.js +0 -96
  181. package/dist/cli/chunk-p6334e7v.js +0 -2
  182. package/dist/cli/chunk-q9zgj6kw.js +0 -3
  183. package/dist/cli/chunk-rzef6szc.js +0 -3
  184. package/dist/cli/chunk-sqxdfzdq.js +0 -5
  185. package/dist/cli/chunk-sz2xs0a2.js +0 -4
  186. package/dist/cli/chunk-t5y8k772.js +0 -2
  187. package/dist/cli/chunk-vht2e44j.js +0 -10
  188. package/dist/cli/chunk-vjp7drne.js +0 -2
  189. package/dist/cli/chunk-vm551pxs.js +0 -2
  190. package/dist/cli/chunk-w09356fj.js +0 -20
  191. package/dist/cli/chunk-xmqv1zx6.js +0 -2
  192. package/dist/cli/chunk-xn7bk4f9.js +0 -3
  193. package/dist/cli/chunk-zybjm7d5.js +0 -2
  194. package/dist/web/assets/index-C9vaSoIJ.js +0 -113
  195. package/dist/web/assets/index-sA2EEQJw.css +0 -1
@@ -1,5 +0,0 @@
1
- // @bun
2
- import{quoteShellArgv}from"./chunk-7kysxgbq.js";import{acquireWithRetry}from"./chunk-b68dd36h.js";import{isObject}from"./chunk-7ghwdjdc.js";import{acquireSync,release,releaseSync}from"./chunk-bejhca6z.js";import{roveStateDir}from"./chunk-z1nj22va.js";import{ROVE_PRODUCT_NAME}from"./chunk-zt7wfnva.js";import{fileURLToPath}from"url";function roveCliInvocation(){let cliName=ROVE_PRODUCT_NAME;if(import.meta.url.endsWith(".js"))return[cliName];let entry=fileURLToPath(new URL(`./${"rove.ts"}`,import.meta.url));return[process.execPath,"--conditions=browser",entry]}function roveHookInvocation(){if(import.meta.url.endsWith(".js"))return[ROVE_PRODUCT_NAME];if(Bun.which(ROVE_PRODUCT_NAME))return[ROVE_PRODUCT_NAME];return roveCliInvocation()}var ROVE_HOOK_VERSION=1;function roveHookArgs(vendor){return["--engine",vendor,"--hook-version",String(ROVE_HOOK_VERSION)]}var GATED_TOOL_VERBS=new Set(["tool-pre","tool-post","tool-failed"]);function parseHookSettings(raw){if(raw===void 0)return{ok:!0,doc:{}};let parsed;try{parsed=JSON.parse(raw)}catch(err){return{ok:!1,reason:`not valid JSON (${err instanceof Error?err.message:String(err)})`}}if(!isObject(parsed))return{ok:!1,reason:"top level is not a JSON object"};if(parsed.hooks===void 0)return{ok:!0,doc:parsed};if(!isObject(parsed.hooks))return{ok:!1,reason:'"hooks" is not an object'};for(let[event,groups]of Object.entries(parsed.hooks)){if(!Array.isArray(groups))return{ok:!1,reason:`"hooks.${event}" is not an array`};let bad=groups.findIndex((group)=>!isObject(group)||!Array.isArray(group.hooks));if(bad>=0)return{ok:!1,reason:`"hooks.${event}[${bad}]" is not an object with a "hooks" array`}}return{ok:!0,doc:parsed}}var HOOK_WORD=String.raw`(?:'(?:[^']|'\\'')*'|"[^"$\x60\\]*"|[A-Za-z0-9_./:=+-]+)`,HOOK_ARGV=new RegExp(`^${HOOK_WORD}(?:[ ]+${HOOK_WORD})*$`),ROVE_HOOK_FLAGS={"--engine":/^[a-z][a-z0-9-]*$/,"--hook-version":/^\d+$/};function isRoveHook(hook,verbs){if(!isObject(hook)||typeof hook.command!=="string")return!1;if(hook.type!==void 0&&hook.type!=="command")return!1;let command=hook.command.replace(/^[ \t]+|[ \t]+$/g,"");if(HOOK_ARGV.exec(command)?.[0]!==command)return!1;let argv=(command.match(new RegExp(HOOK_WORD,"g"))??[]).map((word)=>{if(word.startsWith("'"))return word.slice(1,-1).replaceAll("'\\''","'");if(word.startsWith('"'))return word.slice(1,-1);return word}),executable=argv[0]?.split("/").at(-1),offset=1;if(executable==="bun"||executable==="node"){if(argv[offset]==="--conditions=browser")offset++;let entry=argv[offset]??"";if(!/(?:^|\/)(?:src|dist)\/cli\/(?:rove|rove)\.(?:ts|js)$/.test(entry))return!1;offset++}else if(executable!=="rove"&&executable!=="rove")return!1;if(argv[offset]!=="hook"||!verbs.includes(argv[offset+1]))return!1;let rest=argv.slice(offset+2);for(let i=0;i<rest.length;i+=2){let value=rest[i+1],pattern=ROVE_HOOK_FLAGS[rest[i]??""];if(!pattern||value===void 0||!pattern.test(value))return!1}return!0}function removeRoveHooks(groups,verbs){return groups.flatMap((group)=>{if(!isObject(group)||!Array.isArray(group.hooks))return[group];let kept=group.hooks.filter((hook)=>!isRoveHook(hook,verbs));if(kept.length===group.hooks.length)return[group];return kept.length>0?[{...group,hooks:kept}]:[]})}function hasRoveActivityHooks(current,eventMap){let verbs=eventMap.map((spec)=>spec.verb),hooks=isObject(current.hooks)?current.hooks:{};return Object.values(hooks).some((groups)=>Array.isArray(groups)&&groups.some((group)=>isObject(group)&&Array.isArray(group.hooks)&&group.hooks.some((hook)=>isRoveHook(hook,verbs))))}function hookCommandQuoting(platform=process.platform){return{bareSafe:!0,windows:platform==="win32"}}function buildActivityHooks(eventMap,inv=roveHookInvocation(),opts={}){let out={},quoting=hookCommandQuoting();for(let spec of eventMap){if(opts.buildFilter&&!opts.buildFilter(spec))continue;let{event,matcher,verb}=spec,group={hooks:[{type:"command",command:quoteShellArgv([...inv,"hook",verb,...opts.extraArgs??[]],quoting)}]};if(matcher)group.matcher=matcher;let previous=out[event],groups=Array.isArray(previous)?previous:[];groups.push(group),out[event]=groups}return out}function mergeActivityHooks(current,install,eventMap,inv=roveHookInvocation(),opts={}){let verbs=eventMap.map((spec)=>spec.verb),{hooks:rawHooks,...restSettings}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},built=install?buildActivityHooks(eventMap,inv,opts):{};for(let{event}of eventMap){let groups=hooks[event],prior=Array.isArray(groups)?groups:[],kept=removeRoveHooks(prior,verbs),additions=built[event];if(install&&Array.isArray(additions))kept.push(...additions);if(kept.length>0)hooks[event]=kept;else delete hooks[event]}return Object.keys(hooks).length>0?{...restSettings,hooks}:{...restSettings}}var RETIRED_WATCH_EVENT="PostToolUse";function removeWorktreeWatchHook(current){let{hooks:rawHooks,...restSettings}=current,hooks=isObject(rawHooks)?{...rawHooks}:{},groups=hooks[RETIRED_WATCH_EVENT],prior=Array.isArray(groups)?groups:[],kept=removeRoveHooks(prior,["worktree-created"]);if(kept.length>0)hooks[RETIRED_WATCH_EVENT]=kept;else delete hooks[RETIRED_WATCH_EVENT];return Object.keys(hooks).length>0?{...restSettings,hooks}:{...restSettings}}import{constants,closeSync,fstatSync,openSync,readSync}from"fs";import{open}from"fs/promises";var MAX_ENGINE_FILE_BYTES=104857600,MAX_JSONL_LINE_CHARS=8388608,READ_CHUNK_BYTES=65536,READ_FLAGS=constants.O_RDONLY|constants.O_NONBLOCK;async function readTextFileIfRegular(p,maxBytes=MAX_ENGINE_FILE_BYTES){let file=await open(p,READ_FLAGS);try{let info=await file.stat();if(!info.isFile()||info.size>maxBytes)return null;let chunks=[],total=0;while(total<=maxBytes){let buffer=Buffer.allocUnsafe(Math.min(READ_CHUNK_BYTES,maxBytes+1-total)),{bytesRead}=await file.read(buffer);if(bytesRead===0)return Buffer.concat(chunks,total).toString("utf8");chunks.push(buffer.subarray(0,bytesRead)),total+=bytesRead}return null}finally{await file.close()}}async function readTextFileBounded(p,maxBytes=MAX_ENGINE_FILE_BYTES){return await readTextFileIfRegular(p,maxBytes)??""}async function readFirstLineBounded(p,maxBytes=MAX_JSONL_LINE_CHARS){let file=await open(p,READ_FLAGS);try{if(!(await file.stat()).isFile())return"";let chunks=[],total=0,start=0,nonblank=!1;while(total<=maxBytes){let buffer=Buffer.allocUnsafe(Math.min(16384,maxBytes+1-total)),{bytesRead}=await file.read(buffer);if(!bytesRead)return Buffer.concat(chunks,total).subarray(start).toString("utf8");chunks.push(buffer.subarray(0,bytesRead));let segment=0;for(let i=0;i<bytesRead;i++){if(buffer[i]!==10)continue;nonblank||=buffer.subarray(segment,i).toString("utf8").trim().length>0;let end=total+i;if(end>maxBytes)return"";if(nonblank)return Buffer.concat(chunks,total+bytesRead).subarray(start,end).toString("utf8");start=end+1,segment=i+1}nonblank||=buffer.subarray(segment,bytesRead).toString("utf8").trim().length>0,total+=bytesRead}return""}finally{await file.close()}}function readTextFileSyncBounded(p,maxBytes=MAX_ENGINE_FILE_BYTES){try{return readTextFileIfRegularSync(p,maxBytes)}catch(err){if(err instanceof Error&&"code"in err&&err.code==="ENOENT")return null;throw err}}function readTextFileIfRegularSync(p,maxBytes=MAX_ENGINE_FILE_BYTES){let fd=openSync(p,READ_FLAGS);try{let info=fstatSync(fd);if(!info.isFile()||info.size>maxBytes)return null;let chunks=[],total=0;while(total<=maxBytes){let buffer=Buffer.allocUnsafe(Math.min(READ_CHUNK_BYTES,maxBytes+1-total)),bytesRead=readSync(fd,buffer);if(!bytesRead)return Buffer.concat(chunks,total).toString("utf8");chunks.push(buffer.subarray(0,bytesRead)),total+=bytesRead}return null}finally{closeSync(fd)}}function isJsonlLineWithinBound(line,maxChars=MAX_JSONL_LINE_CHARS){return line.length<=maxChars}import{createHash,randomBytes}from"crypto";import{mkdirSync,renameSync,unlinkSync,writeFileSync}from"fs";import{mkdir,rename,unlink,writeFile}from"fs/promises";import{dirname,join}from"path";var MAX_SHARED_CONFIG_BYTES=8388608;function stagingPath(file){return`${file}.rove-${process.pid}-${randomBytes(6).toString("hex")}.tmp`}function sharedConfigLockPath(file){return join(roveStateDir(),`shared-config-${createHash("sha256").update(file).digest("hex").slice(0,16)}.lock`)}var MAX_ATTEMPTS=5;function readSharedConfigSync(file){try{let raw=readTextFileIfRegularSync(file,MAX_SHARED_CONFIG_BYTES);if(raw===null)throw Error(`Refusing non-regular or oversized config: ${file}`);return raw}catch(err){if(err instanceof Error&&"code"in err&&err.code==="ENOENT")return;throw err}}async function readRaw(file){try{let raw=await readTextFileIfRegular(file,MAX_SHARED_CONFIG_BYTES);if(raw===null)throw Error(`Refusing non-regular or oversized config: ${file}`);return raw}catch(err){if(err instanceof Error&&"code"in err&&err.code==="ENOENT")return;throw err}}function updateSharedJsonSync(file,load,build){let lockPath=sharedConfigLockPath(file),lockToken=acquireSync(lockPath);try{for(let attempt=0;attempt<MAX_ATTEMPTS;attempt++){let before=readSharedConfigSync(file),doc=load(before);if(!doc)return;let text=build(doc);if(text===void 0)return;let tmp=stagingPath(file);try{if(mkdirSync(dirname(file),{recursive:!0}),writeFileSync(tmp,text,{mode:384,flag:"wx"}),readSharedConfigSync(file)===before){renameSync(tmp,file);return}}finally{try{unlinkSync(tmp)}catch{}}}throw Error(`gave up updating ${file} after ${MAX_ATTEMPTS} concurrent writes`)}finally{releaseSync(lockPath,lockToken)}}async function updateSharedJson(file,load,build){let lockPath=sharedConfigLockPath(file),lockToken=await acquireWithRetry(lockPath);try{for(let attempt=0;attempt<MAX_ATTEMPTS;attempt++){let before=await readRaw(file),doc=load(before);if(!doc)return;let text=build(doc);if(text===void 0)return;let tmp=stagingPath(file);try{if(await mkdir(dirname(file),{recursive:!0}),await writeFile(tmp,text,{mode:384,flag:"wx"}),await readRaw(file)===before){await rename(tmp,file);return}}finally{await unlink(tmp).catch(()=>{})}}throw Error(`gave up updating ${file} after ${MAX_ATTEMPTS} concurrent writes`)}finally{await release(lockPath,lockToken)}}async function editJsonSettings(settingsFilePath,transform,parse=parseHookSettings){let rejected;try{await updateSharedJson(settingsFilePath,(raw)=>{let parsed=parse(raw);if(parsed.ok)return parsed.doc;rejected=parsed.reason;return},(current)=>{let next=transform(current),json=JSON.stringify(next,null,2);return json===JSON.stringify(current,null,2)?void 0:`${json}
3
- `})}catch(err){return{ok:!1,file:settingsFilePath,reason:err instanceof Error?err.message:String(err)}}if(rejected!==void 0)return{ok:!1,file:settingsFilePath,reason:rejected};return{ok:!0}}class JsonHookAdapter{supportsHooks(){return!0}activityDetailFromPayload(_kind,_payload){return}sessionFromPayload(_payload){return}supportsWorktreeSync(){return!1}async removeWorktreeSyncHook(_settingsFilePath){}gatedVerbs(){return GATED_TOOL_VERBS}async installActivityHooks(settingsFilePath,opts={}){let gated=this.gatedVerbs(),outcome=await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!0,this.eventMap,void 0,{extraArgs:roveHookArgs(this.vendor),buildFilter:(spec)=>opts.toolEvents===!0||!gated.has(spec.verb)}));if(!outcome.ok&&!opts.quiet)process.stderr.write(`[rove hooks] ${this.vendor}: skipped ${outcome.file}: ${outcome.reason}
4
- `);return outcome}async removeActivityHooks(settingsFilePath){await editJsonSettings(settingsFilePath,(cur)=>mergeActivityHooks(cur,!1,this.eventMap))}async removeWorktreeWatchHook(settingsFilePath){await editJsonSettings(settingsFilePath,removeWorktreeWatchHook)}hookConfigRefusal(raw){let parsed=parseHookSettings(raw);return parsed.ok?void 0:parsed.reason}}import{homedir}from"os";import path from"path";var VENDOR_HOMES={claude:{envVar:"CLAUDE_CONFIG_DIR",dirName:".claude"},codex:{envVar:"CODEX_HOME",dirName:".codex"},copilot:{envVar:"COPILOT_HOME",dirName:".copilot"},kimi:{envVar:"KIMI_CODE_HOME",dirName:".kimi-code"}},AGENT_DIR_VENDORS={pi:{envVar:"PI_CODING_AGENT_DIR",dirName:".pi"},omp:{envVar:"PI_CODING_AGENT_DIR",dirName:".omp"}},defaultVendorHomeDeps={env:(name)=>process.env[name],home:()=>homedir()};function vendorWriteHomeDeps(home){return home===void 0?defaultVendorHomeDeps:{env:()=>{return},home:()=>home}}function vendorConfigHome(vendor,deps=defaultVendorHomeDeps){let{envVar,dirName}=VENDOR_HOMES[vendor],override=deps.env(envVar)?.trim();if(override)return override;return path.join(deps.home(),dirName)}function vendorAgentDir(vendor,deps=defaultVendorHomeDeps){let{envVar,dirName}=AGENT_DIR_VENDORS[vendor],override=deps.env(envVar)?.trim();if(override)return override;return path.join(deps.home(),dirName,"agent")}function depsOf(env,home){return{env,home:()=>home}}function claudeGlobalConfigPath(env,home){let override=env("CLAUDE_CONFIG_DIR")?.trim();if(override)return path.join(override,".claude.json");return path.join(home,".claude.json")}function codexAuthPath(env,home){return path.join(vendorConfigHome("codex",depsOf(env,home)),"auth.json")}function copilotConfigPath(env,home){return path.join(vendorConfigHome("copilot",depsOf(env,home)),"config.json")}function bobHome(home=homedir()){return path.join(home,".bob")}function bobTrustPath(home){return path.join(bobHome(home),"trustedFolders.json")}function bobDbPath(home){return path.join(bobHome(home),"db","bob.db")}function bobAuthSecretsPath(home){return path.join(bobHome(home),"settings","auth-secrets.json")}function kimiCredentialsPath(env,home){return path.join(vendorConfigHome("kimi",depsOf(env,home)),"credentials","kimi-code.json")}
5
- export{roveCliInvocation,roveHookInvocation,ROVE_HOOK_VERSION,roveHookArgs,GATED_TOOL_VERBS,isRoveHook,removeRoveHooks,hasRoveActivityHooks,hookCommandQuoting,readTextFileIfRegular,readTextFileBounded,readFirstLineBounded,readTextFileSyncBounded,isJsonlLineWithinBound,readSharedConfigSync,updateSharedJsonSync,updateSharedJson,editJsonSettings,JsonHookAdapter,vendorWriteHomeDeps,vendorConfigHome,vendorAgentDir,claudeGlobalConfigPath,codexAuthPath,copilotConfigPath,bobTrustPath,bobDbPath,bobAuthSecretsPath,kimiCredentialsPath};