Documentation
¶
Index ¶
- func CleanupTempProjects() error
- func ClearConfig() error
- func ClearSession() error
- func ComputeFileHash(filePath string) (string, error)
- func ConfigExists() (bool, error)
- func DeleteConversation(projectID, conversationID string) error
- func DeleteProject(project *Project) error
- func GetConfigDir() (string, error)
- func GetConfigPath() (string, error)
- func GetConversationPath(projectID, conversationID string) (string, error)
- func GetEndpointsList(endpoints []parser.Endpoint) string
- func GetProjectPathByType(projectID string, isTemporary bool) (string, error)
- func GetProjectsDir() (string, error)
- func GetSessionPath() (string, error)
- func GetTempProjectsDir() (string, error)
- func HasEndpoints(projectID string, isTemporary bool) bool
- func Load() (*analyzer.Analysis, error)
- func LoadEndpoints(projectID string, isTemporary bool) ([]parser.Endpoint, error)
- func LoadOrParseSpec(specPath, projectID, baseURL, apiKey string, isTemporary bool) ([]parser.Endpoint, string, error)
- func SaveConfig(config *Config) error
- func SaveEndpoints(projectID string, endpoints []parser.Endpoint, isTemporary bool) error
- func SaveMessage(projectID, conversationID, messageType, content string, ...) error
- func SaveProject(project *Project) error
- func SaveSession(session *Session) error
- func SessionExists() bool
- func Store(analysis *analyzer.Analysis) error
- func ValidateSpecPath(specPath string) error
- type AuthConfig
- type Config
- type Conversation
- type Message
- type Project
- func CheckNameConflict(name string, excludeProjectID string) (*Project, error)
- func CreateOrUpdateProject(projectID, name, baseURL, specPath, apiKey string, isTemporary bool) (*Project, []parser.Endpoint, error)
- func FindProjectByName(name string) (*Project, error)
- func ListNamedProjects() ([]*Project, error)
- func ListProjects() ([]*Project, error)
- func LoadProject(projectID string) (*Project, error)
- type ProjectContext
- type Session
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CleanupTempProjects ¶
func CleanupTempProjects() error
CleanupTempProjects removes all temporary projects
func ComputeFileHash ¶
ComputeFileHash computes SHA256 hash of a file
func DeleteConversation ¶ added in v0.3.0
DeleteConversation deletes a conversation and all its messages
func DeleteProject ¶
DeleteProject deletes a project from disk
func GetConfigDir ¶
GetConfigDir returns the octrafic config directory
func GetConfigPath ¶
GetConfigPath returns the full path to the config file
func GetConversationPath ¶ added in v0.3.0
GetConversationPath returns the path to a conversation database file
func GetEndpointsList ¶
GetEndpointsList returns comma-separated list of endpoints for system prompt Format: "GET /users, POST /users, GET /users/{id}, PUT /users/{id}, DELETE /users/{id}, GET /health"
func GetProjectPathByType ¶
GetProjectPathByType returns the path to a specific project directory based on type
func GetProjectsDir ¶
GetProjectsDir returns the path to the projects directory
func GetSessionPath ¶
GetSessionPath returns the path to the session file
func GetTempProjectsDir ¶
GetTempProjectsDir returns the path to the temporary projects directory
func HasEndpoints ¶
HasEndpoints checks if endpoints.json exists for a project
func LoadEndpoints ¶
LoadEndpoints loads endpoints from endpoints.json
func LoadOrParseSpec ¶
func LoadOrParseSpec(specPath, projectID, baseURL, apiKey string, isTemporary bool) ([]parser.Endpoint, string, error)
LoadOrParseSpec parses the spec file and returns endpoints with hash Now uses endpoints.json storage instead of Bleve index
func SaveConfig ¶
SaveConfig saves the configuration to disk with secure permissions
func SaveEndpoints ¶
SaveEndpoints saves parsed endpoints to endpoints.json
func SaveMessage ¶ added in v0.3.0
func SaveMessage(projectID, conversationID, messageType, content string, metadata map[string]interface{}) error
SaveMessage saves a message to the conversation
func ValidateSpecPath ¶
ValidateSpecPath checks if spec file exists and is readable
Types ¶
type AuthConfig ¶
type AuthConfig struct {
Type string `json:"type"` // none, bearer, apikey, basic
Token string `json:"token,omitempty"` // Bearer token
KeyName string `json:"key_name,omitempty"` // API key name (e.g., X-API-Key)
KeyValue string `json:"key_value,omitempty"` // API key value
Location string `json:"location,omitempty"` // header or query
Username string `json:"username,omitempty"` // Basic auth username
Password string `json:"password,omitempty"` // Basic auth password
}
AuthConfig stores authentication configuration for a project WARNING: Credentials are stored in plain text
type Config ¶
type Config struct {
APIKey string `json:"api_key"`
}
Config represents the CLI configuration
type Conversation ¶ added in v0.3.0
type Conversation struct {
ID string `json:"id"`
ProjectID string `json:"project_id"`
Title string `json:"title"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
Conversation represents a chat conversation for a project
func CreateConversation ¶ added in v0.3.0
func CreateConversation(projectID, conversationID, title string) (*Conversation, error)
CreateConversation creates a new conversation
func ListConversations ¶ added in v0.3.0
func ListConversations(projectID string) ([]*Conversation, error)
ListConversations returns all conversations for a project
func LoadConversation ¶ added in v0.3.0
func LoadConversation(projectID, conversationID string) (*Conversation, error)
LoadConversation loads a conversation by ID
type Message ¶ added in v0.3.0
type Message struct {
ID int64 `json:"id"`
ConversationID string `json:"conversation_id"`
Type string `json:"type"` // 'user', 'assistant', 'api_request', 'api_response', 'system'
Content string `json:"content"`
Metadata map[string]interface{} `json:"metadata,omitempty"`
Timestamp time.Time `json:"timestamp"`
}
Message represents a single message in a conversation
func GetMessages ¶ added in v0.3.0
GetMessages retrieves all messages from a conversation
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name"`
BaseURL string `json:"base_url"`
SpecPath string `json:"spec_path,omitempty"`
SpecHash string `json:"spec_hash,omitempty"`
IsTemporary bool `json:"is_temporary"`
AuthConfig *AuthConfig `json:"auth_config,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
LastAccessedAt time.Time `json:"last_accessed_at"`
}
Project represents a single API testing project
func CheckNameConflict ¶
CheckNameConflict checks if a project with the given name already exists (excluding given projectID)
func CreateOrUpdateProject ¶
func CreateOrUpdateProject(projectID, name, baseURL, specPath, apiKey string, isTemporary bool) (*Project, []parser.Endpoint, error)
CreateOrUpdateProject creates or updates a project with spec parsing Returns the project and parsed endpoints
func FindProjectByName ¶
FindProjectByName searches for a project by name in permanent storage
func ListNamedProjects ¶
ListNamedProjects returns only named (non-temporary) projects
func LoadProject ¶
LoadProject loads a project from disk (checks both permanent and temporary locations)
type ProjectContext ¶
type ProjectContext struct {
Project *Project
ProjectPath string
EndpointsPath string
HashPath string
}
ProjectContext encapsulates project data with pre-computed paths
func LoadProjectContext ¶
func LoadProjectContext(projectID string) (*ProjectContext, error)
LoadProjectContext loads a project and creates its context
func NewProjectContext ¶
func NewProjectContext(project *Project) (*ProjectContext, error)
NewProjectContext creates a ProjectContext from a loaded or new project