hookcli

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 25, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EmitHookOutput

func EmitHookOutput(out map[string]any)

EmitHookOutput 写 stdout 单行 JSON 并返回退出码 0。

func Main

func Main(args []string) int

Main 是 relaymesh-hook 的入口;返回进程退出码。

func RunDoctor

func RunDoctor(project string) int

func RunHook

func RunHook(event string, stdin []byte) (out map[string]any)

RunHook 执行一个 hook 事件(子命令名见 eventSpecs);任何异常都静默放行,输出该事件的默认输出(多数是空对象)。

  • post-tool-use / stop:同步,要把 Hub 的回复(提醒 / 拦一次)交还给 Cursor,同时顺带上报运行情况;
  • 其余事件(会话开始 / 结束、提交提示词、思考、工具开始、回复、工具失败、压缩):不需要回包, 只做白名单上报并交给分离出去的子进程发送,父进程立刻返回(见 async.go)。

func RunInstall

func RunInstall(opts InstallOptions) int

func RunReport

func RunReport(stdin []byte) int

RunReport 是子进程的入口:从标准输入读一个任务,把上报发给 Hub。任何异常都静默退出。

func RunStatus

func RunStatus(project string, jsonOut bool) int

func RunUninstall

func RunUninstall(project string, userScope, purge bool) int

func SetBuildVersion

func SetBuildVersion(v string)

SetBuildVersion 由 main 包在 init 时注入编译版本。

func Version

func Version() string

Version 返回编译时写入的版本号。

Types

type InstallOptions

type InstallOptions struct {
	Workflow  string
	McpURL    string
	McpServer string
	TokenEnv  string
	Interval  *float64
	Project   string
	UserScope bool
	DryRun    bool
	Preview   bool // 预览:含 DryRun 的全部语义(不写任何文件),并打印 hooks.json / relaymesh.json 的逐行改动
	NoStatus  bool // 只登记收件箱需要的 postToolUse / stop,不登记状态事件(并摘掉先前登记过的状态事件)
	Command   string
}

InstallOptions 控制 install 子命令。

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL