utils

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Aug 29, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EffectiveLimit

func EffectiveLimit(flag, def int) int

CANARY: REQ=ENG-4323; FEATURE="ContextCaps"; ASPECT=CLI; STATUS=TESTED; TEST=TestCANARY_CBIN_205_EffectiveLimit; UPDATED=2026-08-28 EffectiveLimit maps CLI --limit semantics (0/unset => def, -1 => unlimited) to the storage layer's convention (0 => unlimited). Defaults are deliberately small to protect agent context; callers pass -1 to explicitly request everything.

func ExtractField

func ExtractField(token, field string) string

ExtractField extracts a field value from a CANARY token string

func FilterCanaryTokens

func FilterCanaryTokens(content []byte) []byte

FilterCanaryTokens removes CANARY tokens with OWNER=canary from file content This strips out CANARY CLI internal tracking tokens when copying templates to user projects

func GetAvailablePrompts

func GetAvailablePrompts() ([]string, error)

GetAvailablePrompts returns the list of available embedded prompt names (command prompts from prompts/commands/* and system prompts from prompts/sys/*).

func LoadProjectConfig

func LoadProjectConfig() (*config.ProjectConfig, error)

LoadProjectConfig loads the .canary/project.yaml configuration

func LoadPrompt

func LoadPrompt(promptArg string) (string, error)

LoadPrompt loads a custom prompt from file or embedded prompt name. This is a stub implementation that will be expanded in the future to support: - Loading prompts from embedded FS - Loading prompts from filesystem - Template variable substitution - Prompt validation and caching

func ReadEmbeddedFile

func ReadEmbeddedFile(path string) ([]byte, error)

ReadEmbeddedFile safely reads a file from the embedded filesystem It tries with and without the "base/" prefix to handle different embed scenarios

func ValidatePromptArg

func ValidatePromptArg(promptArg string) error

ValidatePromptArg validates a prompt argument format

Types

This section is empty.

Jump to

Keyboard shortcuts

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