generate

package
v0.11.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 2, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package generate provides functions for generating platform-specific plugins from canonical JSON specifications.

This package is the core library used by the assistantkit CLI and can be used directly by projects that need programmatic plugin generation.

Example usage:

result, err := generate.Plugins("plugins/spec", "plugins", []string{"claude", "kiro"})
if err != nil {
    log.Fatal(err)
}
fmt.Printf("Generated %d commands, %d skills\n", result.CommandCount, result.SkillCount)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentsResult

type AgentsResult struct {
	// AgentCount is the number of agents loaded.
	AgentCount int

	// TeamName is the name of the team being deployed.
	TeamName string

	// TargetsGenerated lists the names of generated targets.
	TargetsGenerated []string

	// GeneratedDirs maps target names to their output directories.
	GeneratedDirs map[string]string
}

AgentsResult contains the results of simplified agent generation.

func Agents

func Agents(specsDir, target, outputDir string) (*AgentsResult, error)

Agents generates platform-specific agents from a specs directory with simplified options.

The specsDir should contain:

  • agents/: Agent definitions (*.md with YAML frontmatter)
  • deployments/: Deployment definitions (*.json)

The target parameter specifies which deployment file to use (looks for {target}.json). The outputDir is the base directory for resolving relative output paths in the deployment.

type CheckResult

type CheckResult struct {
	Name    string
	Passed  bool
	Message string
}

CheckResult represents the result of a single validation check.

type ClaudeTeamSettings

type ClaudeTeamSettings struct {
	TeamMode     string `json:"team_mode"`
	TeammateMode string `json:"teammate_mode,omitempty"`
	EnableTeams  bool   `json:"enable_teams,omitempty"`
}

ClaudeTeamSettings represents Claude Code team settings.

type DeploymentResult

type DeploymentResult struct {
	// AgentCount is the number of agents loaded.
	AgentCount int

	// TeamName is the name of the team being deployed.
	TeamName string

	// TargetsGenerated lists the names of generated targets.
	TargetsGenerated []string

	// GeneratedDirs maps target names to their output directories.
	GeneratedDirs map[string]string
}

DeploymentResult contains the results of deployment generation.

func Deployment

func Deployment(specsDir string, deploymentFile string) (*DeploymentResult, error)

Deployment generates platform-specific output from multi-agent-spec definitions.

The specsDir should contain:

  • agents/: Agent definitions (*.md with YAML frontmatter)
  • teams/: Team definitions (*.json)
  • deployments/: Deployment definitions (*.json)

Each deployment target specifies a platform and output directory.

type DeploymentSpec

type DeploymentSpec struct {
	Team    string             `json:"team"`
	Targets []DeploymentTarget `json:"targets"`
}

DeploymentSpec represents a deployment definition.

type DeploymentTarget

type DeploymentTarget struct {
	Name     string          `json:"name"`
	Platform string          `json:"platform"`
	Mode     string          `json:"mode,omitempty"`
	Priority string          `json:"priority,omitempty"`
	Output   string          `json:"output"`
	Config   json.RawMessage `json:"config,omitempty"`
	// KiroCli contains Kiro CLI-specific configuration.
	KiroCli *KiroTargetConfig `json:"kiroCli,omitempty"`
}

DeploymentTarget represents a deployment target configuration.

func (*DeploymentTarget) ParseKiroConfig

func (t *DeploymentTarget) ParseKiroConfig() *KiroTargetConfig

ParseKiroConfig extracts Kiro-specific config from a deployment target. Checks both the structured kiroCli field and the generic config field.

type GenerateResult

type GenerateResult struct {
	// CommandCount is the number of commands loaded.
	CommandCount int

	// SkillCount is the number of skills loaded.
	SkillCount int

	// AgentCount is the number of agents loaded.
	AgentCount int

	// TeamName is the name of the team being deployed.
	TeamName string

	// TargetsGenerated lists the names of generated targets.
	TargetsGenerated []string

	// GeneratedDirs maps target names to their output directories.
	GeneratedDirs map[string]string
}

GenerateResult contains the results of unified plugin generation.

func Generate

func Generate(specsDir, target, outputDir string) (*GenerateResult, error)

Generate generates platform-specific plugins from a unified specs directory. Output is driven by the deployment file at specs/deployments/{target}.json.

Each deployment target receives a complete plugin:

  • agents (from specs/agents/*.md)
  • commands (from specs/commands/*.md)
  • skills (from specs/skills/*.md)
  • plugin manifest (from specs/plugin.json)

The specsDir should contain:

  • plugin.json: Plugin metadata
  • commands/: Command definitions (*.md or *.json)
  • skills/: Skill definitions (*.md or *.json)
  • agents/: Agent definitions (*.md with YAML frontmatter)
  • deployments/: Deployment definitions (*.json)

The target parameter specifies which deployment file to use (looks for {target}.json). The outputDir is the base directory for resolving relative output paths in the deployment.

func GenerateWithTeams

func GenerateWithTeams(specsDir, target, outputDir string) (*GenerateResult, error)

GenerateWithTeams generates platform-specific plugins including team files. This extends Generate() to also process team definitions.

type KiroAgent

type KiroAgent struct {
	Name        string   `json:"name"`
	Description string   `json:"description"`
	Prompt      string   `json:"prompt"`
	Model       string   `json:"model,omitempty"`
	Tools       []string `json:"tools,omitempty"`
}

KiroAgent represents a Kiro CLI agent definition.

type KiroTargetConfig

type KiroTargetConfig struct {
	// Prefix is prepended to agent and steering file names (e.g., "cext_").
	Prefix string `json:"prefix,omitempty"`
	// PluginDir is the output directory for the plugin.
	PluginDir string `json:"pluginDir,omitempty"`
	// Format is the output format (json, yaml).
	Format string `json:"format,omitempty"`
}

KiroTargetConfig contains Kiro-specific deployment configuration.

type MCPServer

type MCPServer struct {
	Command     string   `json:"command"`
	Args        []string `json:"args,omitempty"`
	Description string   `json:"description,omitempty"`
}

MCPServer defines an MCP server configuration.

type PluginSpec

type PluginSpec struct {
	plugins.Plugin
	DisplayName string               `json:"displayName,omitempty"`
	Keywords    []string             `json:"keywords,omitempty"`
	MCPServers  map[string]MCPServer `json:"mcpServers,omitempty"`
}

PluginSpec extends the base Plugin with power-specific fields.

type Result

type Result struct {
	// CommandCount is the number of commands loaded.
	CommandCount int

	// SkillCount is the number of skills loaded.
	SkillCount int

	// AgentCount is the number of agents loaded.
	AgentCount int

	// GeneratedDirs maps platform names to their output directories.
	GeneratedDirs map[string]string
}

Result contains the results of plugin generation.

func Plugins

func Plugins(specDir, outputDir string, platforms []string) (*Result, error)

Plugins generates platform-specific plugins from a canonical spec directory.

The specDir should contain:

  • plugin.json: Plugin metadata
  • commands/: Command definitions (*.json)
  • skills/: Skill definitions (*.json)
  • agents/: Agent definitions (*.json)

Generated plugins are written to outputDir/<platform>/.

type TeamResult

type TeamResult struct {
	// TeamName is the name of the generated team.
	TeamName string

	// WorkflowType is the workflow type of the team.
	WorkflowType string

	// AgentCount is the number of agents in the team.
	AgentCount int

	// GeneratedFiles lists the paths of generated files.
	GeneratedFiles []string

	// OutputDir is the directory where files were generated.
	OutputDir string
}

TeamResult contains the results of team generation.

func Teams

func Teams(specsDir, teamName, platform, outputDir string) (*TeamResult, error)

Teams generates platform-specific team files from multi-agent-spec definitions.

The specsDir should contain:

  • agents/: Agent definitions (*.md with YAML frontmatter)
  • teams/: Team definitions (*.json)

The teamName specifies which team file to use (looks for {teamName}.json). The platform specifies the target platform (e.g., "claude-code"). The outputDir is the directory for generated files.

type ValidateError

type ValidateError struct {
	Check   string
	File    string
	Message string
}

ValidateError represents a validation error or warning.

type ValidateResult

type ValidateResult struct {
	// Checks contains results for each validation check.
	Checks []CheckResult

	// Errors contains all validation errors.
	Errors []ValidateError

	// Warnings contains non-fatal issues.
	Warnings []ValidateError

	// Stats contains counts of loaded items.
	Stats ValidateStats
}

ValidateResult contains the results of specs validation.

func Validate

func Validate(specsDir string) *ValidateResult

Validate performs static validation on a specs directory.

func (*ValidateResult) IsValid

func (r *ValidateResult) IsValid() bool

IsValid returns true if there are no errors.

type ValidateStats

type ValidateStats struct {
	Agents      int
	Commands    int
	Skills      int
	Teams       int
	Steps       int
	Phases      int
	Deployments int
	Targets     int
}

ValidateStats contains counts of loaded items.

Jump to

Keyboard shortcuts

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