Documentation
¶
Index ¶
- Constants
- Variables
- func ContentTypeForExtension(ext string) string
- func ExtractSkillBundleArchive(archive []byte, destDir string) error
- func KnownFormats() []string
- func RegisterFormatter(name string, f Formatter)
- func SkillBundleFiles(archive []byte) ([]string, error)
- func SkillBundleMatchesDir(archive []byte, dir string) (bool, error)
- func SkillMarkdownFromArchive(archive []byte) (string, error)
- type ClaudeCodeMCPConfig
- type ClaudeCodeMCPServer
- type CursorMCPConfig
- type CursorMCPServer
- type Formatter
- type TarEntry
- type TarIterator
- type TarIteratorOption
- type TarIteratorOptions
Constants ¶
const ( // Extensions. ExtJSON = ".json" ExtMD = ".md" ExtGzip = ".gzip" // Formats. FormatOASF = "oasf" FormatA2A = "a2a" FormatAgentSkill = "agent-skill" FormatAgentSkillBundle = "agent-skill-bundle" FormatSkill = "skill" FormatMCPGHCopiot = "mcp-ghcopilot" FormatMCPClaudeCode = "mcp-claudecode" FormatMCPCursor = "mcp-cursor" )
Variables ¶
var ErrUnsupportedRecord = errors.New("record does not contain the required module for this format")
ErrUnsupportedRecord indicates the record lacks the OASF module required by the requested format (e.g. asking for "a2a" on a record without integration/a2a). The request was well-formed; the data simply doesn't carry what the format reads.
Functions ¶
func ContentTypeForExtension ¶
ContentTypeForExtension returns the MIME content type for a file extension.
func ExtractSkillBundleArchive ¶ added in v1.6.0
ExtractSkillBundleArchive extracts a skill artifact into destDir. The artifact is either a gzip-compressed tar bundle (full skill with code samples) or a plain-text SKILL.md manifest. Both formats are handled transparently.
func KnownFormats ¶
func KnownFormats() []string
KnownFormats returns a sorted list of all registered format names.
func RegisterFormatter ¶
RegisterFormatter registers a named formatter. It is safe for concurrent use.
func SkillBundleFiles ¶ added in v1.7.1
SkillBundleFiles lists the regular files a skill artifact holds, as paths relative to the directory ExtractSkillBundleArchive writes them into, in archive order. A plain-text SKILL.md artifact reports the single file the extractor creates for it, so both artifact shapes answer the same question.
TarEntry's fields are unexported, so this is the one accessor callers outside this package have for entry names. `dirctl install` records the list in its install manifest, so that a later manifest-driven uninstall or upgrade can remove exactly the files that were written without re-fetching a record that may since have been garbage-collected upstream.
func SkillBundleMatchesDir ¶ added in v1.6.0
SkillBundleMatchesDir reports whether dir already contains the same files as archive.
func SkillMarkdownFromArchive ¶ added in v1.6.0
SkillMarkdownFromArchive returns the SKILL.md content from a skill artifact. Plain-text archives are returned as-is; gzip tar bundles must contain SKILL.md.
Types ¶
type ClaudeCodeMCPConfig ¶ added in v1.6.0
type ClaudeCodeMCPConfig struct {
MCPServers map[string]ClaudeCodeMCPServer `json:"mcpServers"`
}
ClaudeCodeMCPConfig models Claude Code's project-scoped .mcp.json file.
func RecordToClaudeCode ¶ added in v1.6.0
func RecordToClaudeCode(record *structpb.Struct) (*ClaudeCodeMCPConfig, error)
RecordToClaudeCode translates a record's "integration/mcp" module (OASF 1.0.0 "connections" format) into a ClaudeCodeMCPConfig. Exported (like translator.RecordToGHCopilot) so cli/cmd/export's batch exporter can merge several records' configs into one .mcp.json without round-tripping through JSON.
This is a local implementation rather than a call to an oasf-sdk translator function (issue #1386 proposes a RecordToClaudeCode in oasf-sdk's translator package). Keeping it here lets the format ship without blocking on an oasf-sdk release; it can move upstream later without changing this package's public surface.
Only the OASF 1.0.0 "connections" array format is supported. The legacy 0.7.0/0.8.0 "servers" array format (still handled by translator.RecordToGHCopilot for GitHub Copilot) is not.
type ClaudeCodeMCPServer ¶ added in v1.6.0
type ClaudeCodeMCPServer struct {
Type string `json:"type,omitempty"`
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
ClaudeCodeMCPServer models a single entry under "mcpServers" in Claude Code's project-scoped .mcp.json configuration file.
Command/Args/Env describe a local, stdio-launched server. URL/Headers describe a remote server; Type is only set ("http" or "sse") for remote servers -- Claude Code has no "type" field for stdio and infers it from the presence of Command. See https://code.claude.com/docs/en/mcp.
type CursorMCPConfig ¶ added in v1.6.0
type CursorMCPConfig struct {
MCPServers map[string]CursorMCPServer `json:"mcpServers"`
}
CursorMCPConfig models Cursor's mcp.json file.
func RecordToCursor ¶ added in v1.6.0
func RecordToCursor(record *structpb.Struct) (*CursorMCPConfig, error)
RecordToCursor translates a record's "integration/mcp" module (OASF 1.0.0 "connections" format) into a CursorMCPConfig. Exported (like translator.RecordToGHCopilot) so cli/cmd/export's batch exporter can merge several records' configs into one mcp.json without round-tripping through JSON.
This is a local implementation rather than a call to an oasf-sdk translator function (issue #1385 proposes a RecordToCursor in oasf-sdk's translator package). Keeping it here lets the format ship without blocking on an oasf-sdk release; it can move upstream later without changing this package's public surface.
Only the OASF 1.0.0 "connections" array format is supported. The legacy 0.7.0/0.8.0 "servers" array format (still handled by translator.RecordToGHCopilot for GitHub Copilot) is not.
type CursorMCPServer ¶ added in v1.6.0
type CursorMCPServer struct {
Command string `json:"command,omitempty"`
Args []string `json:"args,omitempty"`
Env map[string]string `json:"env,omitempty"`
URL string `json:"url,omitempty"`
Headers map[string]string `json:"headers,omitempty"`
}
CursorMCPServer models a single entry under "mcpServers" in Cursor's mcp.json configuration file (.cursor/mcp.json project-scoped, or ~/.cursor/mcp.json global).
Command/Args/Env describe a local, stdio-launched server. URL/Headers describe a remote (SSE or streamable HTTP) server -- Cursor has no "type" field and infers the transport from the presence of URL. See https://cursor.com/docs/context/mcp.
type Formatter ¶
type Formatter interface {
// Format transforms the OASF record into the target representation.
Format(record *corev1.Record) ([]byte, error)
// FileExtension returns the default file extension for this format (e.g. ".json", ".md").
FileExtension() string
}
Formatter converts an OASF record into a target format.
func GetFormatter ¶
GetFormatter returns the formatter registered under name, or an error if not found.
type TarIterator ¶ added in v1.6.0
func NewTarIterator ¶ added in v1.6.0
func NewTarIterator(raw []byte, opts ...TarIteratorOption) (TarIterator, error)
type TarIteratorOption ¶ added in v1.6.0
type TarIteratorOption func(*TarIteratorOptions)
func WithTypeflag ¶ added in v1.6.0
func WithTypeflag(typeflag byte) TarIteratorOption
type TarIteratorOptions ¶ added in v1.6.0
type TarIteratorOptions struct {
// contains filtered or unexported fields
}