gen

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package gen writes a skill bundle from an approved spec.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RewriteDescription

func RewriteDescription(bundleDir, description string) error

RewriteDescription replaces the description in a bundle's SKILL.md frontmatter and leaves the body untouched.

The tuner changes one field. A full regeneration spends several model calls and rewrites prose nobody asked to change. The frontmatter is re-marshalled instead. The body is copied through verbatim.

The re-marshalled frontmatter keeps the name and the description, and nothing else. A key somebody added by hand does not survive this call.

func RobustnessRules

func RobustnessRules() string

RobustnessRules returns the rule text the body pass is written under. The budget line is built from lint's own exported constants rather than restated as prose, so the generator and the linter cannot state two different numbers.

func SafeJoin

func SafeJoin(dir, rel string) (string, error)

SafeJoin is the bundle-containment check for model-authored paths: a resource path a model names is untrusted input.

It resolves rel inside dir, refusing anything that escapes: an absolute path, or a traversal that resolves outside dir even when buried after the first path segment (e.g. "scripts/../../escape.sh", which does not start with ".." and so would slip past a naive prefix check).

Types

type Bundle

type Bundle struct {
	// Dir is the bundle's root directory (outDir/spec.DirName()).
	Dir string
	// Files lists every path written, relative to Dir, sorted.
	Files []string
}

Bundle describes a skill bundle written to disk.

func Generate

func Generate(ctx context.Context, g llm.Gateway, s *spec.SkillSpec, outDir string) (*Bundle, error)

Generate writes a skill bundle for s into outDir.

Jump to

Keyboard shortcuts

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