export

package
v0.7.28 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package export holds the interop exporters: pure functions of (archive, manifest, target) that emit the claude-skill and agents-md install formats, and the two tree writers that lay them on disk from an extracted archive. Keeping the shaping side-effect free makes it table-testable without a registry, and lets any client — the CLI, the desktop app — produce byte-identical installs from the same inputs.

Embedded-mode tool mapping (RUNNER-PLAN §R5, RQ2): when an agent is installed INTO an existing coding agent instead of run standalone, the host's built-in tools stand in for the runner's companion server, and the manifest capability contract compiles to the host's tool-allowlist vocabulary. Nothing is bundled either way — the contract just changes dialect. Enforcement here is the host's; the runner's docs say so (honest-posture rule).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AgentsMDSection

func AgentsMDSection(ns, name, version, summary, installPath string) string

AgentsMDSection renders the AGENTS.md section for one installed QuickAgent (the agents-md target).

func AgentsMDSectionNote

func AgentsMDSectionNote(ns, name, version, summary, installPath, note string) string

AgentsMDSectionNote is AgentsMDSection plus an optional trailing note line — the embedded-mode tools contract (RUNNER-PLAN §R5) rides here.

func CopyTree

func CopyTree(src, dest string) error

CopyTree copies src into dest, preserving each file's permission bits (the archive normalizes modes).

func CopyTreeSkipping

func CopyTreeSkipping(src, dest string, skipDir func(name string) bool) error

CopyTreeSkipping is CopyTree leaving out every directory skipDir names (a local tree's .git, a run's own output folder).

func EnsureSkillFrontmatter

func EnsureSkillFrontmatter(content []byte, name, summary string) []byte

EnsureSkillFrontmatter returns content guaranteed to start with YAML frontmatter. When the skill file already opens with a frontmatter fence it is returned unchanged; otherwise `name` and `description` (mapped from the manifest name and summary) are prepended.

func HostToolGrants

func HostToolGrants(c manifest.Capabilities) []string

HostToolGrants maps the capability contract to Claude Code's built-in tool grant vocabulary (the claude-skill target's `allowed-tools`). Returns nil for a pure-text contract: a skill that declares no capabilities needs no tool grants, and emitting an empty list would depend on host semantics we do not control.

func HostToolsNote

func HostToolsNote(c manifest.Capabilities) string

HostToolsNote renders the embedded-tools contract for prose targets (the agents-md section): what the host should grant, in one line.

func SetSkillAllowedTools

func SetSkillAllowedTools(content []byte, tools []string) []byte

SetSkillAllowedTools makes a SKILL.md frontmatter's top-level allowed-tools line the compiled grants: the declared capability contract, never the author's. An author's own line (or list) that differs is replaced and kept as a comment naming what was dropped; with no grants it is removed, so the host pre-approves nothing the manifest did not declare. Content without frontmatter is returned unchanged (EnsureSkillFrontmatter runs first and owns that case).

func SkillFrontmatterWithTools

func SkillFrontmatterWithTools(content []byte, name, summary string, tools []string) []byte

SkillFrontmatterWithTools is EnsureSkillFrontmatter plus the embedded tool grants: the allowed-tools line is the compiled contract whether the frontmatter is generated or the author's.

func UpsertAgentsMDSection

func UpsertAgentsMDSection(existing []byte, ns, name, version, summary, installPath string) []byte

UpsertAgentsMDSection appends the agent's section to an AGENTS.md document, replacing any existing section for the same ns/name (any version) so reinstalls and upgrades stay idempotent.

func UpsertAgentsMDSectionNote

func UpsertAgentsMDSectionNote(existing []byte, ns, name, version, summary, installPath, note string) []byte

UpsertAgentsMDSectionNote is UpsertAgentsMDSection with the note line.

func WriteAgentsMDTree

func WriteAgentsMDTree(staging, dest, agentsMDPath string, m *manifest.Manifest, ns, version string) error

WriteAgentsMDTree copies the release's files from staging into dest — <project>/agents/<name> — and upserts the agent's section, with the note naming which host built-ins the declared contract corresponds to (embedded mode, RUNNER-PLAN §R5), into the AGENTS.md at agentsMDPath.

func WriteClaudeSkillTree

func WriteClaudeSkillTree(staging, dest string, m *manifest.Manifest) error

WriteClaudeSkillTree copies the release's files from staging into dest — the skill's directory, as ~/.claude/skills/<name> holds it — and gives the skill entrypoint its frontmatter. Embedded mode (RUNNER-PLAN §R5): the host coding agent supplies the tools, so the capability contract compiles to its allowed-tools vocabulary here — the same contract the standalone runner enforces through the gateway. The entrypoint is a manifest string; the file it names must be inside dest, whatever the string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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