skill

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

install.go —— 把 skill 内容装到本机各家 agent。

职责:

  • 写基准副本到 <home>/.handoff/skill/SKILL.md
  • 在**存在的** agent 目录里各写一份副本
  • 返回每个落点的实际处置,供命令层如实打印

边界:

  • 不改任何 agent 的配置文件(四家都按约定自动扫描 skills 目录)
  • **agent 的 home 目录不存在就跳过,不代为创建**:给没装 codex 的机器 造一个 ~/.codex,下次那台机器真装了 codex 时会拿到我们凭空造的半截结构
  • 不含 go:embed:内容与 home 都是入参,测试给临时目录与任意字符串即可, 不需要构建产物
  • 不装到远端:skill 服务于协调者,协调者在本机(spec 非目标)

state.go —— 各落点相对于当前二进制内嵌内容的一致性。

职责:

  • Status:逐个落点读出实际内容,与 content 比 sha256,报 in_sync / stale / missing

边界:

  • **只报有,不报无**:落点不存在只说 missing,绝不断言「你没装 skill」。 agent 可能从我们表外的位置读到它,而一条会说谎的诊断命令比没有更糟
  • 不修复:发现不一致只报告,同步是 handoff skill install

Index

Constants

View Source
const (
	StateInstalled = "installed" // 本次已写入副本
	StateSkipped   = "skipped"   // agent 目录不存在,跳过(Note 说明理由)
	StateInSync    = "in_sync"   // 内容与当前二进制内嵌的一致
	StateStale     = "stale"     // 存在但内容不一致
	StateMissing   = "missing"   // 落点不存在
)

落点状态。

Variables

This section is empty.

Functions

func BasePath

func BasePath(home string) string

BasePath 返回基准副本目录。

为什么四家各存一份副本、而不是软链到这里或软链到仓库:软链到仓库会在仓库 切分支/移动时让四个 agent 一起失效;软链到基准副本看似便宜,买到的 「改一处生效四处」却是零收益——内容来自 go:embed,Install 每次运行本来 就全量重写所有落点,没人手改基准副本(手改了也会被 Status 判成 stale)。 而它的代价是实打实的:Windows 上建目录软链需要管理员特权,非特权时四个 落点全部装不上,症状还是静默半残(B84)。副本形态全平台一条路径。

func InSync

func InSync(sites []Site) bool

InSync 判断全部**存在的**落点是否都与 content 一致。

missing 不算不一致:那家 agent 没装,本来就不该有落点。

Types

type Site

type Site struct {
	Path  string
	State string
	Note  string
}

Site 是一个落点及其状态。

Note 只在需要解释时非空(跳过的理由、读取失败的原因)。

func Install

func Install(content, home string) ([]Site, error)

Install 把 content 装到本机。

参数:

  • content: SKILL.md 的全文(生产由 go:embed 注入)
  • home: 用户 home 目录(测试注入临时目录)

返回:

  • 每个落点的处置结果,顺序为 [基准副本, .claude, .codex, opencode, .grok]
  • err: 只有基准副本写失败才返回错误——那是这个功能的地基; 单个 agent 落点失败记进 Site.Note 继续,不因为一家没装成就全盘失败

func Status

func Status(content, home string) ([]Site, error)

Status 报告每个落点的一致性。

参数:

  • content: 当前二进制内嵌的 SKILL.md 全文,作为比对基准
  • home: 用户 home 目录

返回:

  • 每个落点的状态,顺序与 Install 一致
  • err: 恒为 nil(保留返回值是为了让调用方的签名不必因将来加 I/O 而变); 单个落点读失败落到该 Site 的 Note 上,不让一处坏掉的落点吃掉整份报告

Jump to

Keyboard shortcuts

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