Documentation
¶
Overview ¶
Copyright (c) 2025 Nexlayer. All rights reserved.n// Use of this source code is governed by an MIT-stylen// license that can be found in the LICENSE file.nn
Index ¶
- Variables
- func DetectStack(dir string) (*detection.ProjectInfo, error)
- func GenerateTemplate(ctx context.Context, req TemplateRequest) (string, error)
- func NewCommand() *cobra.Command
- type AIProvider
- type Application
- type Capability
- type CommandProvider
- type Pod
- type RegistryLogin
- type Secret
- type ServicePort
- type Template
- type TemplateRequest
- type Volume
Constants ¶
This section is empty.
Variables ¶
var ( // Predefined AI providers WindsurfEditor = AIProvider{ Name: "Windsurf Editor", Description: "Built-in AI code assistant", EnvVarKey: "WINDSURF_EDITOR_ACTIVE", Capabilities: CapCodeGeneration | CapCodeCompletion | CapDeploymentAssistance | CapErrorDiagnosis, } GitHubCopilot = AIProvider{ Name: "GitHub Copilot", Description: "GitHub's AI pair programmer", EnvVarKey: "GITHUB_COPILOT_ACTIVE", Capabilities: CapCodeGeneration | CapCodeCompletion, } ZedEditor = AIProvider{ Name: "Zed Editor", Description: "Zed's built-in AI assistant", EnvVarKey: "ZED_AI_ACTIVE", Capabilities: CapCodeGeneration | CapCodeCompletion | CapDeploymentAssistance, } CursorAI = AIProvider{ Name: "Cursor AI", Description: "Cursor's AI code assistant", EnvVarKey: "CURSOR_AI_ACTIVE", Capabilities: CapCodeGeneration | CapCodeCompletion, } VSCodeAI = AIProvider{ Name: "VS Code AI", Description: "VS Code's AI assistant", EnvVarKey: "VSCODE_AI_ACTIVE", Capabilities: CapCodeGeneration | CapCodeCompletion, } // AllProviders is a list of all available AI providers AllProviders = []AIProvider{ WindsurfEditor, GitHubCopilot, ZedEditor, CursorAI, VSCodeAI, } )
Functions ¶
func DetectStack ¶
func DetectStack(dir string) (*detection.ProjectInfo, error)
DetectStack analyzes a directory to determine its stack type, components, and AI environment.
func GenerateTemplate ¶
func GenerateTemplate(ctx context.Context, req TemplateRequest) (string, error)
GenerateTemplate uses AI assistance to generate a valid Nexlayer deployment template.
func NewCommand ¶
NewCommand creates the "ai" command with its subcommands.
Types ¶
type AIProvider ¶
type AIProvider struct {
Name string
Description string
EnvVarKey string
Capabilities Capability
}
AIProvider represents an AI code assistant provider
func GetPreferredProvider ¶
func GetPreferredProvider(ctx context.Context, requiredCaps Capability) *AIProvider
GetPreferredProvider returns the first configured AI provider with the required capabilities
func (*AIProvider) GenerateText ¶
GenerateText generates text using the AI provider
type Application ¶
type Application struct {
Name string `yaml:"name"`
URL string `yaml:"url,omitempty"`
RegistryLogin *RegistryLogin `yaml:"registryLogin,omitempty"`
Pods []Pod `yaml:"pods"`
}
Application represents the top-level application configuration
type Capability ¶
type Capability int
Capability represents an AI provider's capabilities
const ( CapCodeGeneration Capability = 1 << iota CapCodeCompletion CapDeploymentAssistance CapErrorDiagnosis )
type CommandProvider ¶
type CommandProvider struct{}
CommandProvider implements the registry.CommandProvider interface
func NewProvider ¶
func NewProvider() *CommandProvider
NewProvider creates a new AI command provider
func (*CommandProvider) Commands ¶
func (p *CommandProvider) Commands(deps *registry.CommandDependencies) []*cobra.Command
Commands returns the AI-related commands
func (*CommandProvider) Dependencies ¶
func (p *CommandProvider) Dependencies() []string
Dependencies returns a list of other provider names that this provider depends on
func (*CommandProvider) Description ¶
func (p *CommandProvider) Description() string
Description returns a description of what commands this provider offers
func (*CommandProvider) Name ¶
func (p *CommandProvider) Name() string
Name returns the unique name of this command provider
type Pod ¶
type Pod struct {
Name string `yaml:"name"`
Type string `yaml:"type"`
Path string `yaml:"path,omitempty"`
Image string `yaml:"image"`
Volumes []Volume `yaml:"volumes,omitempty"`
Secrets []Secret `yaml:"secrets,omitempty"`
EnvVars map[string]string `yaml:"env_vars,omitempty"`
ServicePorts []ServicePort `yaml:"servicePorts"`
}
Pod represents a single pod configuration
type RegistryLogin ¶
type RegistryLogin struct {
Registry string `yaml:"registry"`
Username string `yaml:"username"`
PersonalAccessToken string `yaml:"personalAccessToken"`
}
RegistryLogin represents private registry authentication
type Secret ¶
type Secret struct {
Name string `yaml:"name"`
Data string `yaml:"data"`
MountPath string `yaml:"mountPath"`
FileName string `yaml:"fileName"`
}
Secret represents secret configuration
type ServicePort ¶
type ServicePort struct {
ContainerPort int `yaml:"containerPort"`
ServicePort int `yaml:"servicePort"`
Name string `yaml:"name"`
}
ServicePort represents port configuration
type Template ¶
type Template struct {
Application Application `yaml:"application"`
}
Template represents a Nexlayer YAML template
type TemplateRequest ¶
TemplateRequest represents a request to generate a Nexlayer deployment template.