Help us shape the future of Go! Take the 2026 Go Developer Survey

pack

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pack 领域包(expert/pack 目录布局)的契约面:布局约定为 `_shared/`(平台共享基线)+ 各包目录(`<包>/`,`_` 前缀目录不算包), LayoutDirs 是该约定的单一事实源(本包的 mcp/ 扫描与 skill.Library 的 skills/ 扫描共用——布局演进单点修改)。本包承载跨包的 MCP 工具面契约清单 ——加载规则(基线/整文件覆盖/字典序冲突)为唯一事实源,调用方 (reload 校验、lint、血缘)共享同一份加载语义。

Index

Constants

View Source
const LayoutBaseline = "_shared"

LayoutBaseline `_shared` 基线目录名。

Variables

This section is empty.

Functions

func LayoutDirs

func LayoutDirs(fsys fs.FS) (baseline string, packs []string, err error)

LayoutDirs 领域包布局约定的单一事实源:返回基线目录名与全部包目录名 (`_` 前缀目录不算包),包名按字典序返回(确定性装配序契约)。

func LoadToolManifests

func LoadToolManifests(fsys fs.FS) (map[string]*ToolManifest, []string, error)

LoadToolManifests 扫描 FS 的契约清单:`_shared/mcp/*.yaml` 基线 + 各包 `mcp/*.yaml` 覆盖。规则:

  • 目录不存在=无清单(合法,恒返回非 nil map);
  • 包清单整文件替换 _shared 基线(不是 merge——「扩展清单」应拷出全量再增改);
  • 包间同名冲突 → 警告 + 按包名字典序第一个生效(确定性、可测试; 两包真争同一 server 的工具面属治理问题,警告暴露给人裁决)。

Types

type ManifestTool

type ManifestTool struct {
	Name string `yaml:"name" json:"name"`
	Desc string `yaml:"desc" json:"desc,omitempty"`
}

ManifestTool 清单声明的单工具(契约面;desc 仅供人读)。

type ToolManifest

type ToolManifest struct {
	Server      string         `yaml:"-" json:"-"` // 文件名(<server>.yaml),加载期填
	Name        string         `yaml:"name" json:"name"`
	Version     string         `yaml:"version" json:"version,omitempty"`
	Description string         `yaml:"description" json:"description,omitempty"`
	Tools       []ManifestTool `yaml:"tools" json:"tools"`
	From        string         `yaml:"-" json:"from,omitempty"` // 生效来源("_shared" 或包名;同名词冲突提示用)
}

ToolManifest MCP server 工具面契约清单(`_shared/mcp/<server>.yaml` 或 `<包>/mcp/<server>.yaml`)。conf(运行时装配)是装配事实源,清单是契约事实源; 两者对账由调用方做(缺清单=现状语义:授予反查推导,不对账)。

func (*ToolManifest) Has

func (m *ToolManifest) Has(tool string) bool

Has 声明是否包含某工具名。

Jump to

Keyboard shortcuts

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