chat

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: 15 Imported by: 0

Documentation

Overview

Package chat provides services for the AI chat assistant feature.

This package implements the core functionality for KSail's AI-assisted chat, powered by GitHub Copilot SDK. It provides:

  • Context building: Aggregates KSail documentation, CLI help, and project configuration into a system context for the AI assistant.
  • Custom tools: Read-only tools for cluster inspection (list, info, get), file reading, and directory listing.

Security: All file and directory operations are restricted to paths within the current working directory to prevent directory traversal attacks.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSystemContext

func BuildSystemContext() (string, error)

BuildSystemContext builds the system prompt context for the chat assistant. It delegates to the generic chatui.BuildSystemContext with KSail-specific defaults.

func CreatePermissionHandler added in v5.26.0

func CreatePermissionHandler(writer io.Writer) copilot.PermissionHandler

CreatePermissionHandler creates a permission handler that manages user consent for tool operations. Read operations with kind "read" or "url" are auto-approved, while write operations require explicit user confirmation via an interactive prompt.

The handler displays operation details in a formatted box showing:

  • Tool name being executed
  • Shell command (for command execution)
  • Arguments and file paths involved
  • Content preview for write operations (truncated to 200 chars)

func DefaultSystemContextConfig added in v5.31.2

func DefaultSystemContextConfig() chatui.SystemContextConfig

DefaultSystemContextConfig returns the default KSail system context configuration.

func FindKSailExecutable

func FindKSailExecutable() string

FindKSailExecutable attempts to find the ksail executable.

func GetKSailToolMetadata added in v5.26.0

func GetKSailToolMetadata(rootCmd *cobra.Command, outputChan chan<- toolgen.OutputChunk) (
	[]copilot.Tool, map[string]toolgen.ToolDefinition,
)

GetKSailToolMetadata returns both the Copilot tools and their metadata. This allows callers to access RequiresPermission and other metadata.

func GetKSailTools

func GetKSailTools(rootCmd *cobra.Command, outputChan chan<- toolgen.OutputChunk) []copilot.Tool

GetKSailTools returns the tools available to the chat assistant. It auto-generates tools from Cobra commands using the toolgen package. The rootCmd parameter should be the root Cobra command for the CLI. The outputChan parameter enables real-time output streaming (can be nil).

Types

This section is empty.

Jump to

Keyboard shortcuts

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