toolperm

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package toolperm provides parsing and validation for tool permission syntax as defined in the Agent Skills Specification.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Parser

type Parser struct{}

Parser handles tool permission string parsing.

func New

func New() *Parser

New creates a new Parser instance.

func (*Parser) Format

func (p *Parser) Format(perms []Permission) string

Format converts a slice of permissions back to space-delimited string.

func (*Parser) Parse

func (p *Parser) Parse(allowedTools string) ([]Permission, error)

Parse parses a space-delimited allowed-tools string into individual permissions. Returns an empty slice for empty input.

func (*Parser) ParseSingle

func (p *Parser) ParseSingle(token string) (Permission, error)

ParseSingle parses a single tool permission token.

type Permission

type Permission struct {
	// Name is the tool name (e.g., "Read", "Bash", "Write")
	Name string

	// Scope is the optional scope specification (e.g., "git:*" from "Bash(git:*)")
	// Empty string if no scope is specified.
	Scope string
}

Permission represents a parsed tool permission.

func (Permission) String

func (p Permission) String() string

String returns the permission in its canonical string form.

type ToolPermError

type ToolPermError struct {
	Token   string // The problematic token
	Message string // Description of the error
}

ToolPermError represents an error in tool permission syntax.

func (*ToolPermError) Error

func (e *ToolPermError) Error() string

Jump to

Keyboard shortcuts

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