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 ¶
BuildSystemContext builds the system prompt context for the chat assistant. It combines multiple sources of information:
- Identity and role description for the AI assistant
- Current working directory and ksail.yaml configuration if present
- KSail documentation loaded from the docs/ directory
- Dynamic CLI help output from the ksail executable
- Instructions for proper behavior and command usage
Returns the complete system context string and any error encountered. If documentation loading fails, a partial context is still returned.
func FindKSailExecutable ¶
func FindKSailExecutable() string
FindKSailExecutable attempts to find the ksail executable.
func GetKSailTools ¶
GetKSailTools returns the tools available to the chat assistant. It combines auto-generated tools from Cobra commands with manual file system tools. 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.