taskname

package
v2.29.1 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: AGPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoAPIKey        = xerrors.New("no api key provided")
	ErrNoNameGenerated = xerrors.New("no task name generated")
)

Functions

This section is empty.

Types

type TaskName added in v2.29.0

type TaskName struct {
	Name        string `json:"task_name"`
	DisplayName string `json:"display_name"`
}

func Generate

func Generate(ctx context.Context, logger slog.Logger, prompt string) TaskName

Generate creates a task name and display name from a user prompt. It attempts multiple strategies in order of preference:

  1. Use Claude (Anthropic) to generate semantic names from the prompt if an API key is available
  2. Sanitize the prompt directly into a valid task name
  3. Generate a random name as a final fallback

A suffix is always appended to task names to reduce collision risk. This function always succeeds and returns a valid TaskName.

Jump to

Keyboard shortcuts

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