mockup

package
v1.0.55 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderMockupPrompt

func RenderMockupPrompt(ctx *MockupPromptContext) (string, error)

RenderMockupPrompt renders the mockup prompt template with the given context.

func WriteDesignSystem

func WriteDesignSystem(path string, ds *DesignSystem) error

WriteDesignSystem writes a DesignSystem to a design-system.md file.

Types

type AppStructure added in v1.0.38

type AppStructure struct {
	Router       string   `yaml:"router,omitempty" json:"router,omitempty"`
	Layouts      []string `yaml:"layouts,omitempty" json:"layouts,omitempty"`
	Components   []string `yaml:"components,omitempty" json:"components,omitempty"`
	GlobalStyles []string `yaml:"global_styles,omitempty" json:"global_styles,omitempty"`
}

AppStructure describes the project's layout and routing structure.

func ScanAppStructure added in v1.0.38

func ScanAppStructure(projectPath string, framework FrameworkType) *AppStructure

ScanAppStructure detects the project's layout files based on the detected framework. Returns nil if no layouts are found.

type DesignSystem

type DesignSystem struct {
	Version      int           `yaml:"version" json:"version"`
	Framework    FrameworkType `yaml:"framework" json:"framework"`
	LastScanned  time.Time     `yaml:"last_scanned" json:"last_scanned"`
	ExternalLibs []string      `yaml:"external_libs,omitempty" json:"external_libs,omitempty"`
	Style        *StyleInfo    `yaml:"style,omitempty" json:"style,omitempty"`
	AppStructure *AppStructure `yaml:"app_structure,omitempty" json:"app_structure,omitempty"`
}

DesignSystem contains the project's design tokens and styling conventions. Does NOT index components - the AI agent discovers those via codebase search.

func LoadDesignSystem

func LoadDesignSystem(path string) (*DesignSystem, error)

LoadDesignSystem reads and parses a design-system.md file.

type DetectionResult

type DetectionResult struct {
	IsFrontend    bool          `json:"is_frontend"`
	Framework     FrameworkType `json:"framework"`
	Confidence    int           `json:"confidence"`
	ComponentDirs []string      `json:"component_dirs"`
	Indicators    []string      `json:"indicators"`
	ConfigFile    string        `json:"config_file"`
}

DetectionResult is the result of frontend framework detection.

func DetectFramework

func DetectFramework(projectPath string) (*DetectionResult, error)

DetectFramework detects the frontend framework in the given project path. It uses a 3-tier heuristic: config files > package.json > file extensions.

type FrameworkType

type FrameworkType string

FrameworkType identifies the frontend framework in use.

const (
	FrameworkReact     FrameworkType = "react"
	FrameworkNextJS    FrameworkType = "nextjs"
	FrameworkVue       FrameworkType = "vue"
	FrameworkNuxt      FrameworkType = "nuxt"
	FrameworkSvelte    FrameworkType = "svelte"
	FrameworkSvelteKit FrameworkType = "sveltekit"
	FrameworkAngular   FrameworkType = "angular"
	FrameworkAstro     FrameworkType = "astro"
	FrameworkSolid     FrameworkType = "solid"
	FrameworkQwik      FrameworkType = "qwik"
	FrameworkRemix     FrameworkType = "remix"
	FrameworkUnknown   FrameworkType = "unknown"
)

func (FrameworkType) String

func (f FrameworkType) String() string

String returns the display name for the framework.

type MockupFormat

type MockupFormat string

MockupFormat is the output format for the generated mockup file.

const (
	MockupFormatHTML MockupFormat = "html"
	MockupFormatJSX  MockupFormat = "jsx"
)

func (MockupFormat) IsValid

func (f MockupFormat) IsValid() bool

IsValid returns true if the format is supported.

type MockupPromptContext

type MockupPromptContext struct {
	SpecName   string        `json:"spec_name"`
	SpecPath   string        `json:"spec_path"`
	SpecTitle  string        `json:"spec_title"`
	Framework  FrameworkType `json:"framework"`
	Format     MockupFormat  `json:"format"`
	OutputPath string        `json:"output_path"`
	UserPrompt string        `json:"user_prompt,omitempty"`
}

MockupPromptContext is the template rendering context for the AI agent prompt.

func BuildMockupPromptContext

func BuildMockupPromptContext(
	specName string,
	specPath string,
	specTitle string,
	framework FrameworkType,
	format MockupFormat,
	outputPath string,
	userPrompt string,
) *MockupPromptContext

BuildMockupPromptContext assembles a MockupPromptContext from the gathered data. The prompt template instructs the AI agent to read design-system.md directly, so style/design-system data is not embedded in the prompt context.

type MockupResult

type MockupResult struct {
	Status              string `json:"status"`
	Framework           string `json:"framework"`
	SpecName            string `json:"spec_name"`
	MockupPath          string `json:"mockup_path"`
	PromptPath          string `json:"prompt_path,omitempty"`
	Format              string `json:"format"`
	DesignSystemCreated bool   `json:"design_system_created"`
	AgentLaunched       bool   `json:"agent_launched"`
	Committed           bool   `json:"committed"`
}

MockupResult is the JSON output for --json mode.

type SpecContent

type SpecContent struct {
	Title        string   `json:"title"`
	UserStories  []string `json:"user_stories"`
	Requirements []string `json:"requirements"`
	FullContent  string   `json:"full_content"`
}

SpecContent is parsed content from a spec.md file.

func ParseSpec

func ParseSpec(specPath string) (*SpecContent, error)

ParseSpec reads and parses a spec.md file into SpecContent.

type StyleInfo

type StyleInfo struct {
	CSSFramework    string            `yaml:"css_framework" json:"css_framework"`
	Preprocessor    string            `yaml:"preprocessor,omitempty" json:"preprocessor,omitempty"`
	StylingApproach string            `yaml:"styling_approach" json:"styling_approach"`
	ThemeColors     map[string]string `yaml:"theme_colors,omitempty" json:"theme_colors,omitempty"`
	FontFamilies    []string          `yaml:"font_families,omitempty" json:"font_families,omitempty"`
	CSSVariables    []string          `yaml:"css_variables,omitempty" json:"css_variables,omitempty"`
	SampleImports   []string          `yaml:"sample_imports,omitempty" json:"sample_imports,omitempty"`
	ComponentLibs   []string          `yaml:"component_libs,omitempty" json:"component_libs,omitempty"`
}

StyleInfo describes the project's CSS/styling patterns.

func ScanStyles

func ScanStyles(projectPath string) *StyleInfo

ScanStyles detects the project's CSS framework, variables, and styling patterns.

type UpdateResult

type UpdateResult struct {
	Status         string `json:"status"`
	ScanDurationMs int64  `json:"scan_duration_ms"`
}

UpdateResult is the JSON output for mockup update --json mode.

Jump to

Keyboard shortcuts

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