Documentation
¶
Index ¶
- Constants
- func EnsureInstalled() error
- func EnsureInstalledWithForce(force bool) error
- func LaunchChat(agentName, initialPrompt string) error
- func NewConfig() corekiro.Config
- func RunTest(ctx context.Context, prompt string) (string, error)
- type AgentConfig
- type MCPEntry
- type TestResult
- type TestRunner
Constants ¶
const AgentName = "wetwire-gitlab"
AgentName is the identifier for the wetwire-gitlab Kiro agent.
const AgentPrompt = `You are an expert GitLab CI/CD pipeline designer using wetwire-gitlab-go.
Your role is to help users design and generate GitLab CI pipelines as Go code.
## wetwire-gitlab Syntax Rules
1. **Flat, Declarative Syntax**: Use package-level var declarations
` + "```go" + `
var BuildJob = pipeline.Job{
Name: "build",
Stage: "build",
Script: List("go build ./..."),
}
` + "```" + `
2. **Direct Variable References**: Jobs reference other jobs directly
` + "```go" + `
var TestJob = pipeline.Job{
Needs: []any{BuildJob, LintJob}, // Variables, not strings
}
` + "```" + `
3. **Dot-Import for Intrinsics**: Use intrinsics cleanly
` + "```go" + `
import (
. "github.com/lex00/wetwire-gitlab-go/intrinsics"
"github.com/lex00/wetwire-gitlab-go/pipeline"
)
` + "```" + `
4. **Helper Functions**: Use List(), Json{} for type safety
- ` + "`List(\"a\", \"b\")`" + ` - For string slices
- ` + "`Json{\"key\": \"value\"}`" + ` - For maps
- ` + "`[]any{Job1, Job2}`" + ` - Only for Needs field
## Workflow
1. Ask the user about their project requirements
2. Generate Go pipeline code following wetwire conventions
3. Use wetwire_lint to validate the code
4. Fix any lint issues
5. Use wetwire_build to generate .gitlab-ci.yml
## Important
- Always validate code with wetwire_lint before presenting to user
- Fix lint issues immediately without asking
- Keep code simple and readable
- Use extracted variables for complex nested configurations`
AgentPrompt contains the system prompt for the wetwire-gitlab agent.
const MCPCommand = "wetwire-gitlab"
MCPCommand is the command to run the MCP server.
Variables ¶
This section is empty.
Functions ¶
func EnsureInstalled ¶
func EnsureInstalled() error
EnsureInstalled installs the Kiro agent configuration if not already present.
func EnsureInstalledWithForce ¶
EnsureInstalledWithForce installs the Kiro agent configuration. If force is true, overwrites any existing configuration.
func LaunchChat ¶
LaunchChat launches an interactive Kiro CLI chat session with the wetwire-gitlab agent. It connects stdin/stdout directly to the terminal for interactive use.
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Name string `json:"name"`
Prompt string `json:"prompt"`
MCPServers []MCPEntry `json:"mcpServers"`
}
AgentConfig represents a Kiro agent configuration.
type MCPEntry ¶
type MCPEntry struct {
Name string `json:"name"`
Command string `json:"command"`
Args []string `json:"args"`
Cwd string `json:"cwd,omitempty"`
}
MCPEntry represents an MCP server configuration.
type TestResult ¶
type TestResult struct {
Success bool // Overall test success
Output string // Full command output
Duration time.Duration // Test execution time
LintPassed bool // Whether linting succeeded
BuildPassed bool // Whether build succeeded
FilesCreated []string // Generated .go files
ErrorMessages []string // Collected error lines
}
TestResult contains the results of a persona test run.
type TestRunner ¶
type TestRunner struct {
OutputDir string // Directory for generated files
Timeout time.Duration // Test timeout
StreamHandler func(text string) // Optional output streaming callback
}
TestRunner executes persona-based tests using Kiro CLI.
func NewTestRunner ¶
func NewTestRunner(outputDir string) *TestRunner
NewTestRunner creates a new TestRunner with the specified output directory.
func (*TestRunner) EnsureTestEnvironment ¶
func (r *TestRunner) EnsureTestEnvironment() error
EnsureTestEnvironment prepares the output directory for testing.
func (*TestRunner) RunAllPersonas ¶
func (r *TestRunner) RunAllPersonas(ctx context.Context, prompt string) (map[string]*TestResult, error)
RunAllPersonas runs the test with all available personas and returns aggregate results.
func (*TestRunner) RunWithPersona ¶
func (r *TestRunner) RunWithPersona(ctx context.Context, prompt string, persona personas.Persona) (*TestResult, error)
RunWithPersona executes a test with the specified persona.