annotations

package
v5.36.4 Latest Latest
Warning

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

Go to latest
Published: Feb 18, 2026 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package annotations provides constants for annotating Cobra commands to control AI tool generation, permission requirements, and command consolidation.

These annotations are used by the toolgen package to generate AI-accessible tools and by the chat interface to enforce permission checks for edit operations.

See also: pkg/toolgen for annotation processing and tool generation.

Available Annotations

AnnotationExclude: Exclude a command and all its subcommands from AI tool generation. Set to "true" to exclude. Useful for meta commands like chat, mcp, completion.

cmd.Annotations = map[string]string{
    annotations.AnnotationExclude: "true",
}

AnnotationDescription: Override the default description for AI tool generation. If not set, the command's Short description is used.

cmd.Annotations = map[string]string{
    annotations.AnnotationDescription: "Custom description for AI",
}

AnnotationPermission: Mark commands that modify state and require user confirmation. Set to "write" for any operation that creates, updates, or deletes resources.

cmd.Annotations = map[string]string{
    annotations.AnnotationPermission: "write",
}

AnnotationConsolidate: Consolidate subcommands into a single AI tool with an enum parameter. The value specifies the parameter name for subcommand selection.

cmd.Annotations = map[string]string{
    annotations.AnnotationConsolidate: "resource_type", // or "action", "operation"
}

Index

Constants

View Source
const (
	// AnnotationExclude is a command annotation to exclude it from tool generation.
	// Set to "true" to exclude a command and all its subcommands.
	AnnotationExclude = "ai.toolgen.exclude"

	// AnnotationDescription is a command annotation to provide a custom description.
	// If not set, the command's Short description is used.
	AnnotationDescription = "ai.toolgen.description"

	// AnnotationPermission is a command annotation to indicate permission requirements.
	// Set to "write" for commands that modify state and need user confirmation.
	AnnotationPermission = "ai.toolgen.permission"

	// AnnotationConsolidate is a command annotation to consolidate subcommands into a single tool.
	// The value specifies the parameter name for subcommand selection (e.g., "resource_type", "action", "operation").
	AnnotationConsolidate = "ai.toolgen.consolidate"
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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