@sma1lboy/rove 0.9.148 → 0.9.150
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-xzrqnpmh.js → chunk-0h4cfy44.js} +2 -2
- package/dist/cli/chunk-0kn7xxqm.js +6 -0
- package/dist/cli/{chunk-cbkje3aw.js → chunk-0tw42ad1.js} +1 -1
- package/dist/cli/{chunk-49s2zc0h.js → chunk-1cqtm24j.js} +1 -1
- package/dist/cli/{chunk-adez6hq4.js → chunk-1gpx52qj.js} +2 -2
- package/dist/cli/{chunk-dkxhmj9k.js → chunk-1ps9qzp1.js} +1 -1
- package/dist/cli/{chunk-bj59a9mg.js → chunk-1z9ae43v.js} +1 -1
- package/dist/cli/{chunk-39s1ndtm.js → chunk-2ffbcsm6.js} +6 -6
- package/dist/cli/{chunk-m0fz6g32.js → chunk-2hgt2esq.js} +3 -3
- package/dist/cli/{chunk-xbc3gcry.js → chunk-2t62vct7.js} +1 -1
- package/dist/cli/{chunk-91j0an0j.js → chunk-2w4zymkv.js} +1 -1
- package/dist/cli/{chunk-h5j8b87f.js → chunk-4d7bbh87.js} +1 -1
- package/dist/cli/{chunk-1x0vahnn.js → chunk-5b6940vk.js} +1 -1
- package/dist/cli/{chunk-3rqa4pyt.js → chunk-5gn4chrm.js} +2 -2
- package/dist/cli/{chunk-s66eh0pw.js → chunk-5kkm6tjz.js} +2 -2
- package/dist/cli/{chunk-dvabncrk.js → chunk-6h9tc9vn.js} +1 -1
- package/dist/cli/{chunk-jvpzy378.js → chunk-6xhtf9jx.js} +1 -1
- package/dist/cli/{chunk-a4a4qaa2.js → chunk-71m4ak4t.js} +1 -1
- package/dist/cli/chunk-7j8zpeer.js +3 -0
- package/dist/cli/{chunk-jfqbq12b.js → chunk-7sgtpyr0.js} +1 -1
- package/dist/cli/{chunk-eq5f3z2f.js → chunk-84aks78e.js} +1 -1
- package/dist/cli/{chunk-np07kccr.js → chunk-8x0h6rwa.js} +1 -1
- package/dist/cli/{chunk-me77sx3d.js → chunk-a0rxr20w.js} +1 -1
- package/dist/cli/{chunk-gbasmvsc.js → chunk-b24ykek8.js} +1 -1
- package/dist/cli/{chunk-8sbevss4.js → chunk-bjat0fyy.js} +1 -1
- package/dist/cli/{chunk-0dv2xssg.js → chunk-bzz4ta7g.js} +5 -7
- package/dist/cli/{chunk-dx6b3dv8.js → chunk-cjxwzzq7.js} +1 -1
- package/dist/cli/{chunk-7ngv7v9g.js → chunk-db57060b.js} +1 -1
- package/dist/cli/{chunk-v5893dx3.js → chunk-dk3pvrw6.js} +1 -1
- package/dist/cli/{chunk-y2yq6zca.js → chunk-fbg4fkmg.js} +1 -1
- package/dist/cli/{chunk-5ar3vspk.js → chunk-fhfqyfpf.js} +1 -1
- package/dist/cli/{chunk-x930m5fs.js → chunk-fyjj9ast.js} +1 -1
- package/dist/cli/{chunk-0b48bpkd.js → chunk-h9xpeqn6.js} +1 -1
- package/dist/cli/{chunk-pbqwegjy.js → chunk-hpj8xjxb.js} +1 -1
- package/dist/cli/{chunk-vqpa27cf.js → chunk-k2gfqqmg.js} +1 -1
- package/dist/cli/chunk-k5k0ecka.js +4 -0
- package/dist/cli/{chunk-7pfnda5z.js → chunk-khp1ga68.js} +1 -1
- package/dist/cli/{chunk-mggca3k4.js → chunk-mfvy10ep.js} +1 -1
- package/dist/cli/{chunk-8g456mmt.js → chunk-ppe5myr0.js} +1 -1
- package/dist/cli/{chunk-yn5a7xcv.js → chunk-r26g5ree.js} +1 -1
- package/dist/cli/{chunk-vzxbe80f.js → chunk-r2w8qgyd.js} +3 -3
- package/dist/cli/chunk-sm1vhrb6.js +3 -0
- package/dist/cli/{chunk-b8d162tf.js → chunk-tfdx5ve6.js} +1 -1
- package/dist/cli/chunk-vwjec3m6.js +3 -0
- package/dist/cli/{chunk-nrnjt5b6.js → chunk-vzvy1s1d.js} +1 -1
- package/dist/cli/{chunk-pcvk98rr.js → chunk-y34fff4t.js} +1 -1
- package/dist/cli/{chunk-wsvf9eka.js → chunk-yeytzg1x.js} +1 -1
- package/dist/cli/chunk-z3va3mt0.js +34 -0
- package/dist/cli/index.js +3 -3
- package/dist/cli/kobe.js +1 -1
- package/dist/cli/pty-host-node.mjs +113 -76
- package/dist/cli/rove.js +1 -1
- package/package.json +2 -2
- package/dist/cli/chunk-df7qe9y7.js +0 -4
- package/dist/cli/chunk-q7dr9eh6.js +0 -3
- package/dist/cli/chunk-t0kta7rb.js +0 -5
- package/dist/cli/chunk-yhcz2d2r.js +0 -34
- package/dist/cli/chunk-ykvk2546.js +0 -3
- package/dist/cli/chunk-ympakh8w.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{buildPaneArgv}from"./chunk-13s8rnk5.js";import{PluginCliError,installPlugin,linkPlugin}from"./chunk-
|
|
2
|
+
import{buildPaneArgv}from"./chunk-13s8rnk5.js";import{PluginCliError,installPlugin,linkPlugin}from"./chunk-bjat0fyy.js";import{resolvePluginBinPath}from"./chunk-svpn3av1.js";import{buildPluginEnv}from"./chunk-q6579rbz.js";import{currentPluginPlatform,loadPluginRegistry,pluginCheckoutDir,pluginConfigDir,pluginLogPath,qualifiedActionId,readPluginManifest,removePluginEntry,savePluginRegistry,supportsPlatform}from"./chunk-jyv82gf0.js";import{SUBCOMMAND_VERBS}from"./chunk-s76r56rj.js";import"./chunk-84aks78e.js";import{flagValue}from"./chunk-jvxh93nz.js";import"./chunk-b99tf0jr.js";import"./chunk-kwe61yx7.js";import{errorMessage}from"./chunk-2brn8e1y.js";import"./chunk-6dn6h640.js";import{activeCliName}from"./chunk-ef11h2am.js";import"./chunk-8ddjfc2v.js";import"./chunk-cb2fpajx.js";import{defaultDaemonSocketPath}from"./chunk-x760j10f.js";import"./chunk-3bfm4hrs.js";import{__require}from"./chunk-wqfp8d9w.js";import{spawnSync}from"child_process";import{readFileSync,rmSync}from"fs";var CLI_NAME=activeCliName();function printUsage(out){out.write([`usage: ${CLI_NAME} plugin <command>`,""," install <owner/repo[/subdir]> [--yes] [--ref <rev>] clone from GitHub, preview, build, register"," link <dir> register a local plugin directory (dev)"," list installed + linked plugins"," search [query] browse the marketplace (GitHub topic rove-plugin)"," outdated check GitHub-installed plugins against upstream"," update <id\u2026> | --all [--yes] reinstall stale plugins from GitHub"," enable <id> | disable <id> toggle a plugin without unregistering it"," unlink <id> unregister a linked plugin (files untouched)"," uninstall <id-or-spec> unregister + remove the managed checkout"," config-dir <id> print the plugin's config directory"," log <id> [-n <count>] tail the plugin's command-run log"," action list [--plugin <id>] declared actions"," action invoke <plugin-id.action-id> run an action now"," pane open <plugin-id.pane-id> [--task <task-id>] open a plugin pane as a terminal tab (JSON:"," clients \u2014 0 = no attached UI performed the split)","","Marketplace: https://github.com/topics/rove-plugin (legacy kobe-plugin is included)",""].join(`
|
|
3
3
|
`))}function loadAll(){return loadPluginRegistry().plugins.map((entry)=>{try{return{entry,manifest:readPluginManifest(entry.root).manifest}}catch{return{entry,manifest:void 0}}})}function requireEntry(id){let entry=loadPluginRegistry().plugins.find((p)=>p.id===id);if(!entry)throw new PluginCliError(`no plugin registered as \`${id}\`; see \`${CLI_NAME} plugin list\``);return entry}function listPlugins(){let all=loadAll();if(all.length===0){console.log(`no plugins installed. Try: ${CLI_NAME} plugin install <owner/repo> \u2014 browse the \`rove-plugin\` GitHub topic.`);return}for(let{entry,manifest}of all){let state=entry.enabled?"enabled":"disabled",kind=entry.source.kind==="link"?`linked ${entry.root}`:entry.source.spec,broken=manifest?"":" [manifest unreadable]";console.log(`${entry.id} v${entry.version} ${state} (${kind})${broken}`)}}function setEnabled(id,enabled){let entry=requireEntry(id),registry=loadPluginRegistry();savePluginRegistry({plugins:registry.plugins.map((p)=>p.id===id?{...entry,enabled}:p)}),console.log(`${enabled?"enabled":"disabled"} ${id}`)}function unlink(id){let entry=requireEntry(id);if(entry.source.kind!=="link")throw new PluginCliError(`\`${id}\` is a GitHub install; use uninstall`);savePluginRegistry(removePluginEntry(loadPluginRegistry(),id)),console.log(`unlinked ${id} (files untouched at ${entry.root})`)}function uninstall(idOrSpec){let registry=loadPluginRegistry(),entry=registry.plugins.find((p)=>p.id===idOrSpec||p.source.kind==="github"&&p.source.spec===idOrSpec);if(!entry)throw new PluginCliError(`no plugin registered as \`${idOrSpec}\``);if(entry.source.kind==="link")throw new PluginCliError(`\`${entry.id}\` is linked; use unlink`);savePluginRegistry(removePluginEntry(registry,entry.id)),rmSync(pluginCheckoutDir(entry.id),{recursive:!0,force:!0}),console.log(`uninstalled ${entry.id} (config/state kept under ~/.rove/plugins/${entry.id}/)`)}function listActions(pluginFilter){for(let{entry,manifest}of loadAll()){if(!manifest||pluginFilter&&entry.id!==pluginFilter)continue;for(let action of manifest.actions)console.log(`${qualifiedActionId(entry.id,action.id)} ${action.title}`)}}function findByLongestPluginPrefix(qualified,options,findItem){for(let{entry,manifest}of loadAll().filter(({entry:entry2,manifest:manifest2})=>Boolean(manifest2&&(!options.enabledOnly||entry2.enabled)&&qualified.startsWith(`${entry2.id}.`))).sort((a,b)=>b.entry.id.length-a.entry.id.length)){let item=findItem(manifest,qualified.slice(entry.id.length+1));if(item!==void 0)return{entry,manifest,item}}return}function assertPlatformSupported(label,item,manifest){if(supportsPlatform(item,manifest,currentPluginPlatform()))return;let declared=(item.platforms??manifest.platforms??[]).join(", ");throw new PluginCliError(`\`${label}\` is not supported on this platform (declares ${declared})`)}function invokeAction(qualified,extraArgs){let hit=findByLongestPluginPrefix(qualified,{enabledOnly:!0},(manifest,actionId)=>manifest.actions.find((a)=>a.id===actionId));if(!hit)throw new PluginCliError(`no action \`${qualified}\`; see \`${CLI_NAME} plugin action list\``);assertPlatformSupported(qualified,hit.item,hit.manifest);let action=hit.item,[cmd,...args]=[...action.command,...extraArgs],res=spawnSync(cmd,args,{cwd:hit.entry.root,stdio:"inherit",env:buildPluginEnv({socketPath:defaultDaemonSocketPath(),binPath:resolvePluginBinPath(),pluginId:hit.entry.id,pluginRoot:hit.entry.root,extra:{ROVE_PLUGIN_ACTION_ID:action.id,ROVE_PLUGIN_INVOKE_CWD:process.cwd()}})});process.exit(res.status??1)}function resolvePaneQualified(qualified){let hit=findByLongestPluginPrefix(qualified,{enabledOnly:!1},(manifest,entrypoint)=>manifest.panes.find((p)=>p.id===entrypoint));if(!hit)throw new PluginCliError(`no pane \`${qualified}\`; see \`${CLI_NAME} plugin list\``);return{pluginId:hit.entry.id,entrypoint:hit.item.id}}async function openPane(pluginId,entrypoint,taskFlag){let loaded=loadAll().find(({entry})=>entry.id===pluginId);if(!loaded?.manifest)throw new PluginCliError(`no plugin \`${pluginId}\` (or its manifest is unreadable)`);if(!loaded.entry.enabled)throw new PluginCliError(`\`${pluginId}\` is disabled`);let pane=loaded.manifest.panes.find((p)=>p.id===entrypoint);if(!pane)throw new PluginCliError(`no pane \`${entrypoint}\` in \`${pluginId}\`; declare it under [[panes]]`);assertPlatformSupported(`${pluginId}.${pane.id}`,pane,loaded.manifest);let{openDaemonSession,resolveActiveTaskId}=await import("./chunk-aynx3d2a.js"),session=await openDaemonSession({mode:"start"});try{let taskId=taskFlag??await resolveActiveTaskId(session.client);if(!taskId)throw new PluginCliError("no active task; pass --task <id>");let argv=buildPaneArgv(loaded.entry.id,loaded.entry.root,pane,{socketPath:defaultDaemonSocketPath(),binPath:resolvePluginBinPath(),taskId}),reply=await session.client.request("tab.open",{taskId,argv,title:pane.title,placement:pane.placement});console.log(JSON.stringify({...reply,ok:!0,pane:`${pluginId}.${pane.id}`,taskId,title:pane.title}))}finally{session.close()}}function tailLog(id,count){requireEntry(id);let text;try{text=readFileSync(pluginLogPath(id),"utf8")}catch{console.log("(no runs logged yet)");return}let lines=text.trimEnd().split(`
|
|
4
|
-
`);for(let line of lines.slice(-count))console.log(line)}async function runPluginSubcommand(rest){let[command,...args]=rest;if(command!==void 0&&!SUBCOMMAND_VERBS.plugin.includes(command)){let isHelp=command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}try{switch(command){case"install":{let spec=args.find((a)=>!a.startsWith("-"));if(!spec)throw new PluginCliError("install needs <owner/repo[/subdir]>");await installPlugin(spec,{yes:args.includes("--yes"),ref:flagValue(args,"--ref")});return}case"link":{if(!args[0])throw new PluginCliError("link needs a directory");linkPlugin(args[0]);return}case"list":listPlugins();return;case"search":{let{searchMarketplace}=await import("./chunk-vpzvcxc1.js");await searchMarketplace(args.find((a)=>!a.startsWith("-")));return}case"outdated":{let{printOutdated}=await import("./chunk-
|
|
4
|
+
`);for(let line of lines.slice(-count))console.log(line)}async function runPluginSubcommand(rest){let[command,...args]=rest;if(command!==void 0&&!SUBCOMMAND_VERBS.plugin.includes(command)){let isHelp=command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}try{switch(command){case"install":{let spec=args.find((a)=>!a.startsWith("-"));if(!spec)throw new PluginCliError("install needs <owner/repo[/subdir]>");await installPlugin(spec,{yes:args.includes("--yes"),ref:flagValue(args,"--ref")});return}case"link":{if(!args[0])throw new PluginCliError("link needs a directory");linkPlugin(args[0]);return}case"list":listPlugins();return;case"search":{let{searchMarketplace}=await import("./chunk-vpzvcxc1.js");await searchMarketplace(args.find((a)=>!a.startsWith("-")));return}case"outdated":{let{printOutdated}=await import("./chunk-5b6940vk.js");printOutdated();return}case"update":{let{updatePlugins}=await import("./chunk-5b6940vk.js");await updatePlugins(args.filter((a)=>!a.startsWith("-")),{all:args.includes("--all"),yes:args.includes("--yes")});return}case"enable":case"disable":{if(!args[0])throw new PluginCliError(`${command} needs a plugin id`);setEnabled(args[0],command==="enable");return}case"unlink":{if(!args[0])throw new PluginCliError("unlink needs a plugin id");unlink(args[0]);return}case"uninstall":{if(!args[0])throw new PluginCliError("uninstall needs a plugin id or owner/repo spec");uninstall(args[0]);return}case"config-dir":{if(!args[0])throw new PluginCliError("config-dir needs a plugin id");requireEntry(args[0]),console.log(pluginConfigDir(args[0]));return}case"log":{if(!args[0])throw new PluginCliError("log needs a plugin id");tailLog(args[0],Number.parseInt(flagValue(args,"-n")??"20",10)||20);return}case"pane":{let[sub,...paneArgs]=args;if(sub==="open"){let positional=paneArgs.find((a)=>!a.startsWith("-")&&a!==flagValue(paneArgs,"--task")),pluginId=flagValue(paneArgs,"--plugin"),entrypoint=flagValue(paneArgs,"--entrypoint");if(!pluginId||!entrypoint){if(!positional)throw new PluginCliError("pane open needs <plugin-id.pane-id> (or --plugin <id> --entrypoint <pane-id>) [--task <task-id>]");({pluginId,entrypoint}=resolvePaneQualified(positional))}await openPane(pluginId,entrypoint,flagValue(paneArgs,"--task"));return}printUsage(process.stderr),process.exit(2);return}case"action":{let[sub,...actionArgs]=args;if(sub==="list"){listActions(flagValue(actionArgs,"--plugin"));return}if(sub==="invoke"){if(!actionArgs[0])throw new PluginCliError("action invoke needs <plugin-id.action-id>");invokeAction(actionArgs[0],actionArgs.slice(1));return}printUsage(process.stderr),process.exit(2);return}default:{let isHelp=command===void 0||command==="help"||command==="--help"||command==="-h";if(printUsage(isHelp?process.stdout:process.stderr),!isHelp)process.exit(2);return}}}catch(err){if(err instanceof PluginCliError)console.error(`${CLI_NAME} plugin: ${err.message}`),process.exit(1);console.error(`${CLI_NAME} plugin: ${errorMessage(err)}`),process.exit(1)}}export{runPluginSubcommand};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
function toError(err){if(err instanceof Error)return err;let text;try{text=typeof err==="string"?err:JSON.stringify(err)}catch{text=String(err)}return Error(text)}function formatCrashEntry(kind,err,now=new Date){let e=toError(err);return`[${now.toISOString()}] daemon ${kind}: ${e.stack??`${e.name}: ${e.message}`}
|
|
3
|
+
`}function formatDaemonError(subsystem,err,now=new Date){let e=toError(err);return`[${now.toISOString()}] daemon error [${subsystem}]: ${e.stack??`${e.name}: ${e.message}`}
|
|
4
|
+
`}function logDaemonError(subsystem,err){process.stderr.write(formatDaemonError(subsystem,err))}function formatDaemonInfo(subsystem,message,now=new Date){return`[${now.toISOString()}] daemon [${subsystem}]: ${message}
|
|
5
|
+
`}function logDaemonInfo(subsystem,message){process.stderr.write(formatDaemonInfo(subsystem,message))}var onRejection,onException;function installDaemonCrashHandlers(log=(l)=>process.stderr.write(l)){if(onRejection||onException)return;onRejection=(reason)=>log(formatCrashEntry("unhandledRejection",reason)),onException=(err)=>log(formatCrashEntry("uncaughtException",err)),process.on("unhandledRejection",onRejection),process.on("uncaughtException",onException)}class ClientWriter{socket;highWaterMark;onOverflow;queue=new Map;snapshots=new Map;sequence=0;queuedBytes=0;paused=!1;droppedFrames=0;overflowed=!1;constructor(socket,options={}){this.socket=socket;this.highWaterMark=options.highWaterMark??8388608,this.onOverflow=options.onOverflow??(()=>socket.destroy())}get isPaused(){return this.paused}get pendingBytes(){return this.queuedBytes}get pendingCount(){return this.queue.size}get dropped(){return this.droppedFrames}write(line,replaceKey=null){if(this.overflowed)return;if(!this.paused){if(!this.safeWrite(line))this.pause();return}if(replaceKey!==null){let previous=this.snapshots.get(replaceKey);if(previous!==void 0)this.dequeue(previous),this.droppedFrames++}let id=this.sequence++,frame={line,bytes:Buffer.byteLength(line),replaceKey};if(this.queue.set(id,frame),replaceKey!==null)this.snapshots.set(replaceKey,id);if(this.queuedBytes+=frame.bytes,this.queuedBytes<=this.highWaterMark)return;this.overflowed=!0,this.queue.clear(),this.snapshots.clear(),this.queuedBytes=0,this.onOverflow()}dequeue(id){let frame=this.queue.get(id);if(!frame)return;if(this.queue.delete(id),this.queuedBytes-=frame.bytes,frame.replaceKey!==null)this.snapshots.delete(frame.replaceKey)}pause(){this.paused=!0,this.socket.once("drain",()=>{if(this.paused=!1,this.overflowed)return;for(let[id,frame]of this.queue)if(this.dequeue(id),!this.safeWrite(frame.line)){this.pause();return}})}safeWrite(line){try{return this.socket.write(line)}catch{return!0}}}import{lstat,symlink,unlink}from"fs/promises";import{dirname}from"path";async function linkLegacyRuntimePath(canonical,legacy){if(canonical===legacy)return!1;try{if(!await lstat(dirname(legacy)).catch(()=>null))return!1;let existing=await lstat(legacy).catch(()=>null);if(existing&&!existing.isSymbolicLink())return!1;if(existing)await unlink(legacy).catch(()=>{});return await symlink(canonical,legacy),!0}catch{return!1}}function objectPayload(payload){if(!payload||typeof payload!=="object"||Array.isArray(payload))return{};return payload}function requireString(payload,key){let value=payload[key];if(typeof value!=="string"||value.length===0)throw Error(`${key} is required`);return value}function optionalString(payload,key){let value=payload[key];if(value===void 0||value===null||value==="")return;if(typeof value!=="string")throw Error(`${key} must be a string`);return value}function optionalBoolean(payload,key){let value=payload[key];if(value===void 0||value===null)return;if(typeof value!=="boolean")throw Error(`${key} must be a boolean`);return value}function requireNumber(payload,key){let value=payload[key];if(typeof value!=="number"||!Number.isFinite(value))throw Error(`${key} must be a finite number`);return value}function optionalNumber(payload,key){let value=payload[key];if(value===void 0||value===null)return;if(typeof value!=="number"||!Number.isFinite(value))throw Error(`${key} must be a finite number`);return value}function optionalVendor(payload,key){let value=optionalString(payload,key);return value&&value.trim().length>0?value:void 0}function optionalActivityDetail(payload){let raw=payload.detail;if(!raw||typeof raw!=="object"||Array.isArray(raw))return;let d=raw,out={};if(d.failure==="rate_limit"||d.failure==="billing"||d.failure==="other")out.failure=d.failure;if(d.waiting==="permission"||d.waiting==="input")out.waiting=d.waiting;if(typeof d.note==="string")out.note=d.note;let tool=d.tool;if(tool&&typeof tool==="object"&&!Array.isArray(tool))out.tool={...typeof tool.name==="string"?{name:tool.name}:{},...typeof tool.id==="string"?{id:tool.id}:{}};let compact=d.compact;if(compact&&typeof compact==="object"&&!Array.isArray(compact))out.compact=compact.trigger==="manual"||compact.trigger==="auto"?{trigger:compact.trigger}:{};let subagent=d.subagent;if(subagent&&typeof subagent==="object"&&!Array.isArray(subagent))out.subagent={...typeof subagent.type==="string"?{type:subagent.type}:{},...typeof subagent.id==="string"?{id:subagent.id}:{}};return Object.keys(out).length>0?out:void 0}class LineReceiver{maxBytes;storage=Buffer.alloc(0);length=0;failed=!1;constructor(maxBytes=8388608){this.maxBytes=maxBytes}get pendingBytes(){return this.length}push(chunk,onLine){if(this.failed)return!1;let start=0;while(start<chunk.length){let newline=chunk.indexOf(10,start),end=newline===-1?chunk.length:newline,size=this.length+end-start;if(size>this.maxBytes)return this.failed=!0,this.storage=Buffer.alloc(0),this.length=0,!1;if(size>this.storage.length){let capacity=Math.min(this.maxBytes,Math.max(size,this.storage.length*2,1024)),grown=Buffer.allocUnsafe(capacity);this.storage.copy(grown,0,0,this.length),this.storage=grown}if(chunk.copy(this.storage,this.length,start,end),this.length=size,newline===-1)return!0;let line=this.storage.toString("utf8",0,this.length);this.length=0,onLine(line),start=newline+1}return!0}}
|
|
6
|
+
export{logDaemonError,logDaemonInfo,installDaemonCrashHandlers,ClientWriter,linkLegacyRuntimePath,objectPayload,requireString,optionalString,optionalBoolean,requireNumber,optionalNumber,optionalVendor,optionalActivityDetail,LineReceiver};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{envReadyForTasks}from"./chunk-
|
|
2
|
+
import{envReadyForTasks}from"./chunk-5kkm6tjz.js";import{wizardKeyLines}from"./chunk-y34fff4t.js";import"./chunk-1z9ae43v.js";import"./chunk-8x0h6rwa.js";import"./chunk-mfvy10ep.js";import"./chunk-g1ybdgad.js";import{$Fragment,$jsx,$jsxs,bootPaneHost,currentPrefixConfiguration,pageCloseBindings,require_react_production,useBindings,useRenderer,useT,useTheme}from"./chunk-5gn4chrm.js";import"./chunk-764bsyb0.js";import"./chunk-mjvq39gf.js";import"./chunk-6xppe9bj.js";import"./chunk-84aks78e.js";import"./chunk-sm1vhrb6.js";import"./chunk-jvxh93nz.js";import"./chunk-71m4ak4t.js";import"./chunk-tfdx5ve6.js";import"./chunk-ppe5myr0.js";import"./chunk-sdyzxayr.js";import"./chunk-0sm2k04y.js";import"./chunk-5bn91n19.js";import"./chunk-pdh5w4ht.js";import"./chunk-4wwx51m5.js";import"./chunk-79gqh5p2.js";import"./chunk-3ztek08w.js";import"./chunk-kwe61yx7.js";import"./chunk-b24ykek8.js";import"./chunk-z3va3mt0.js";import"./chunk-k5k0ecka.js";import"./chunk-gwcneg6c.js";import"./chunk-7nhdvr5v.js";import"./chunk-2fypr41w.js";import"./chunk-k3ksts6g.js";import"./chunk-gjf604bb.js";import"./chunk-qtke4x42.js";import"./chunk-xy8be792.js";import"./chunk-2brn8e1y.js";import"./chunk-9c1e5z6a.js";import"./chunk-6dn6h640.js";import"./chunk-h82kzdsn.js";import"./chunk-ef11h2am.js";import"./chunk-8ddjfc2v.js";import"./chunk-cb2fpajx.js";import"./chunk-grh6dvfv.js";import"./chunk-pw6yfj10.js";import"./chunk-x760j10f.js";import"./chunk-3bfm4hrs.js";import{__toESM}from"./chunk-wqfp8d9w.js";import{TextAttributes}from"@opentui/core";var import_react2=__toESM(require_react_production(),1);function inlineRowsFor(env){return 15+env.engines.lines.length+envActionKeys(env).length}function envActionKeys(env){let keys=[];if(!env.engines.anyUsable)keys.push("doctor.fix.noEngineAction");if(!env.git.found)keys.push("doctor.fix.gitAction");return keys}function WizardPage(props){let{theme}=useTheme(),t=useT(),renderer=useRenderer(),steps=(props.mode??"full")==="primer"?[]:props.shell===null?["skill"]:["completions","skill"],[stepIndex,setStepIndex]=import_react2.useState(0),[yes,setYes]=import_react2.useState(!0),[answers,setAnswers]=import_react2.useState({}),[page,setPage]=import_react2.useState(steps.length===0?"env":"questions"),step=steps[stepIndex];function finish(finalAnswers){renderer?.destroy(),props.onDone({completions:finalAnswers.completions??!1,skill:finalAnswers.skill??!1})}function confirm(choice=yes){if(page==="env"){setPage("keys");return}if(page==="keys"){finish(answers);return}let next={...answers,[step]:choice};if(setAnswers(next),stepIndex+1>=steps.length){setPage("env");return}setStepIndex(stepIndex+1),setYes(!0)}useBindings(()=>({bindings:[{key:"up",cmd:()=>setYes(!0)},{key:"k",cmd:()=>setYes(!0)},{key:"down",cmd:()=>setYes(!1)},{key:"j",cmd:()=>setYes(!1)},{key:"return",cmd:()=>confirm()},...pageCloseBindings(()=>finish(answers))]}));function questionFor(s){return s==="completions"?t("onboarding.completionsQuestion",{shell:props.shell??""}):t("onboarding.skillQuestion")}let explain=step==="completions"?t("onboarding.completionsExplain"):t("onboarding.skillExplain"),ready=envReadyForTasks(props.env);return $jsxs("box",{flexDirection:"column",flexGrow:1,paddingTop:1,paddingLeft:2,paddingRight:2,children:[$jsx("text",{fg:theme.primary,attributes:TextAttributes.BOLD,wrapMode:"none",children:t("onboarding.title")}),$jsx("text",{fg:theme.textMuted,wrapMode:"word",children:t("onboarding.subtitle")}),$jsxs("box",{flexDirection:"column",paddingTop:1,children:[steps.slice(0,page==="questions"?stepIndex:steps.length).map((answered)=>$jsxs("box",{flexDirection:"row",gap:1,children:[$jsx("text",{fg:theme.success,wrapMode:"none",children:"\u2713"}),$jsx("text",{fg:theme.textMuted,wrapMode:"none",children:questionFor(answered)}),$jsx("text",{fg:theme.text,wrapMode:"none",children:answers[answered]?t("onboarding.optionYes"):t("onboarding.optionNo")})]},answered)),page==="env"?$jsxs("box",{flexDirection:"column",onMouseUp:()=>confirm(),children:[$jsx("text",{fg:theme.text,attributes:TextAttributes.BOLD,wrapMode:"word",children:t("onboarding.envTitle")}),$jsx("text",{fg:theme.textMuted,wrapMode:"word",children:t("onboarding.envExplain")}),$jsxs("box",{flexDirection:"column",paddingTop:1,children:[$jsx("text",{fg:theme.textMuted,wrapMode:"word",children:props.env.git.line}),props.env.engines.lines.map((line)=>$jsx("text",{fg:theme.textMuted,wrapMode:"word",children:line},line))]}),$jsxs("box",{paddingTop:1,flexDirection:"column",children:[$jsx("text",{fg:ready?theme.success:theme.error,wrapMode:"word",children:ready?t("onboarding.envReady"):t("onboarding.envNotReady")}),envActionKeys(props.env).map((key)=>$jsx("text",{fg:theme.textMuted,wrapMode:"word",children:`\u2192 ${t(key)}`},key))]})]}):null,page==="keys"?$jsxs("box",{flexDirection:"column",onMouseUp:()=>confirm(),children:[$jsx("text",{fg:theme.text,attributes:TextAttributes.BOLD,wrapMode:"word",children:t("onboarding.keysTitle")}),wizardKeyLines(currentPrefixConfiguration().key).map((line)=>$jsx("text",{fg:theme.textMuted,wrapMode:"word",children:t(`onboarding.${line.msg}`,line.params)},line.msg))]}):null,page==="questions"?$jsxs($Fragment,{children:[$jsx("text",{fg:theme.text,attributes:TextAttributes.BOLD,wrapMode:"word",children:questionFor(step)}),$jsx("text",{fg:theme.textMuted,wrapMode:"word",children:explain}),[!0,!1].map((option)=>{let active=yes===option;return $jsxs("box",{flexDirection:"row",gap:1,paddingLeft:1,onMouseUp:()=>confirm(option),children:[$jsx("text",{fg:active?theme.primary:theme.textMuted,wrapMode:"none",children:active?"\u276F":" "}),$jsx("text",{fg:active?theme.primary:theme.textMuted,attributes:active?TextAttributes.BOLD:void 0,wrapMode:"none",children:option?t("onboarding.optionYes"):t("onboarding.optionNo")})]},String(option))})]}):null]}),$jsx("box",{paddingTop:1,children:$jsx("text",{fg:theme.textMuted,attributes:TextAttributes.DIM,wrapMode:"none",children:t(page==="keys"?"onboarding.keysLegend":page==="env"?"onboarding.envLegend":"onboarding.legend")})})]})}async function runOnboardingWizard(shell,env,mode){return await new Promise((resolve)=>{bootPaneHost({inlineRows:inlineRowsFor(env),setup:()=>({root:()=>$jsx(WizardPage,{shell,env,mode,onDone:resolve})})})})}export{runOnboardingWizard,WizardPage};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// @bun
|
|
2
|
-
import{isEngineActivityKind}from"./chunk-3ry6prwn.js";import{loadPluginRegistry,readPluginManifest}from"./chunk-jyv82gf0.js";import{flagValue}from"./chunk-jvxh93nz.js";import{connectIfRunning}from"./chunk-5bn91n19.js";import{createEngineHookAdapter}from"./chunk-
|
|
2
|
+
import{isEngineActivityKind}from"./chunk-3ry6prwn.js";import{loadPluginRegistry,readPluginManifest}from"./chunk-jyv82gf0.js";import{flagValue}from"./chunk-jvxh93nz.js";import{connectIfRunning}from"./chunk-5bn91n19.js";import{createEngineHookAdapter}from"./chunk-z3va3mt0.js";import{getPersistedString,setPersistedString}from"./chunk-k3ksts6g.js";import{ALL_VENDORS}from"./chunk-h82kzdsn.js";import{activeCliName}from"./chunk-ef11h2am.js";import{readRoveEnv}from"./chunk-3bfm4hrs.js";import{__require}from"./chunk-wqfp8d9w.js";import{homedir}from"os";import{join,resolve}from"path";var STDIN_READ_TIMEOUT_MS=500;async function readTextWithTimeout(read,timeoutMs=STDIN_READ_TIMEOUT_MS){let raceTimer;try{return await Promise.race([read(),new Promise((resolve2)=>{raceTimer=setTimeout(()=>resolve2(""),timeoutMs)})])}finally{if(raceTimer!==void 0)clearTimeout(raceTimer)}}async function readStdinPayload(){try{let text=await readTextWithTimeout(()=>Bun.stdin.text());if(!text.trim())return{};let parsed=JSON.parse(text);return parsed&&typeof parsed==="object"&&!Array.isArray(parsed)?parsed:{}}catch{return{}}}async function runHookSubcommand(argv){let[verb,...rest]=argv;if(verb==="setup"){await runHookSetup(rest);return}if(verb==="cleanup"){await runHookCleanup();return}try{if(!verb||!isEngineActivityKind(verb))return;let payload=await readStdinPayload(),taskId=flagValue(rest,"--task-id"),cwd=typeof payload.cwd==="string"&&payload.cwd?payload.cwd:process.cwd(),envTaskId=process.env.KOBE_TASK_ID,envTabId=process.env.KOBE_TAB_ID,engine=flagValue(rest,"--engine"),adapters=activityHookAdapters().filter((a)=>!engine||a.vendor===engine),detail;for(let adapter of adapters)if(detail=adapter.activityDetailFromPayload(verb,payload),detail)break;let session;for(let adapter of adapters)if(session=adapter.sessionFromPayload(payload),session)break;let client=await connectIfRunning();if(!client)return;try{let effectiveTaskId=taskId??envTaskId;await client.request("engine.reportEvent",{...effectiveTaskId?{taskId:effectiveTaskId}:{cwd},kind:verb,...engine?{engine}:{},...envTabId?{tabId:envTabId}:{},...detail?{detail}:{},...session?{sessionId:session.sessionId}:{},...session?.transcriptPath?{transcriptPath:session.transcriptPath}:{}})}finally{client.close()}}catch(err){if(readRoveEnv("HOOK_DEBUG"))console.error(`[rove hook] ${verb} failed:`,err instanceof Error?err.message:String(err))}}var SYNC_SETTING_KEY="externalWorktreeSync";function worktreeSyncAdapters(){return ALL_VENDORS.map((v)=>createEngineHookAdapter(v)).filter((a)=>a.supportsWorktreeSync())}function activityHookAdapters(){return ALL_VENDORS.map((v)=>createEngineHookAdapter(v)).filter((a)=>a.supportsHooks())}function globalSettingsPath(){return join(homedir(),".claude","settings.json")}function persistedSyncPath(stored){if(!stored||stored==="off")return;if(stored==="global")return globalSettingsPath();if(stored.startsWith("repo:"))return join(resolve(stored.slice(5)),".claude","settings.json");return stored}async function ensureGlobalKobeHooks(){try{let{isRovePluginEnabled,detectLegacyInstalls,migrationHint}=await import("./chunk-vws0j65e.js"),pluginMode=isRovePluginEnabled();if(pluginMode){let hint=migrationHint(detectLegacyInstalls(),activeCliName());if(hint)process.stderr.write(`
|
|
3
3
|
${hint}
|
|
4
4
|
`)}let toolEvents=pluginsWantToolEvents();for(let a of activityHookAdapters()){if(pluginMode&&a.vendor==="claude")continue;let enginePath=a.globalSettingsPath();if(!enginePath)continue;await a.installActivityHooks(enginePath,{toolEvents}),await a.removeWorktreeWatchHook(enginePath)}await cleanupWorktreeSyncHook()}catch{}}function pluginsWantToolEvents(){try{for(let entry of loadPluginRegistry().plugins){if(!entry.enabled)continue;try{if(readPluginManifest(entry.root).manifest.events.some((e)=>e.on.startsWith("tool.")))return!0}catch{}}}catch{}return!1}async function cleanupWorktreeSyncHook(){let adapters=worktreeSyncAdapters();if(adapters.length===0)return;let stored=getPersistedString(SYNC_SETTING_KEY),paths=new Set([globalSettingsPath()]),prev=persistedSyncPath(stored);if(prev)paths.add(prev);for(let a of adapters)for(let p of paths)await a.removeWorktreeSyncHook(p);if(stored!=="off")setPersistedString(SYNC_SETTING_KEY,"off")}async function runHookCleanup(){let claude=activityHookAdapters().find((a)=>a.vendor==="claude"),path=claude?.globalSettingsPath();if(!claude||!path){process.stdout.write(`rove hook cleanup: no Claude hook adapter \u2014 nothing to do.
|
|
5
5
|
`);return}await claude.removeActivityHooks(path),await claude.removeWorktreeWatchHook(path),process.stdout.write([`rove hook cleanup: removed Rove's settings-managed hooks from ${path}.`,"Only Rove's own entries were touched; your other hooks are intact.","The Claude Code plugin's hooks.json now carries these events (if the plugin","is not installed, the next Rove launch reinstalls the settings-managed set).",""].join(`
|