wizard

package
v0.1.0-beta Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Registry = map[string]StackTemplate{
	"goth": {
		ID:          "goth",
		DisplayName: "Go + templ + HTMX",
		Description: "Full-stack Go with templ templates and HTMX interactivity",
		BuildCmd:    "templ generate && go build ./...",
		TestCmd:     "go test ./... -count=1",
		DevCmd:      "go run ./cmd/server",
		Instructions: []string{
			"Use templ for all HTML templates (.templ files)",
			"Use HTMX for interactivity — no custom JavaScript frameworks",
			"Run `templ generate` before `go build`",
			"Follow Go stdlib HTTP routing patterns (Go 1.22+ mux)",
			"Use SQLite via modernc.org/sqlite for data persistence if needed",
		},
		FilePatterns: []string{"*.go", "*.templ", "*.css"},
	},
	"go-api": {
		ID:          "go-api",
		DisplayName: "Go REST API",
		Description: "Backend Go API with SQLite",
		BuildCmd:    "go build ./...",
		TestCmd:     "go test ./... -count=1",
		DevCmd:      "go run ./cmd/server",
		Instructions: []string{
			"Build a REST API using Go stdlib net/http",
			"Use Go 1.22+ routing patterns with wildcards: mux.HandleFunc(\"GET /api/resource/{id}\", handler)",
			"Use SQLite via modernc.org/sqlite for data persistence",
			"Return JSON responses with proper Content-Type headers",
			"Write table-driven tests using the testing package",
		},
		FilePatterns: []string{"*.go"},
	},
	"react": {
		ID:          "react",
		DisplayName: "React (Vite)",
		Description: "React frontend with Vite build system",
		BuildCmd:    "npm run build",
		TestCmd:     "npm test",
		DevCmd:      "npm run dev",
		Instructions: []string{
			"Use React with TypeScript",
			"Use Vite as the build tool",
			"Use fetch() for API calls — configure the backend URL from environment",
			"Use React Router for client-side routing",
			"Write component tests with Vitest and React Testing Library",
		},
		FilePatterns: []string{"*.tsx", "*.ts", "*.css"},
	},
	"flutter": {
		ID:          "flutter",
		DisplayName: "Flutter",
		Description: "Flutter cross-platform application",
		BuildCmd:    "flutter build",
		TestCmd:     "flutter test",
		DevCmd:      "flutter run",
		Instructions: []string{
			"Use Flutter with Dart",
			"Structure as lib/screens/, lib/widgets/, lib/services/",
			"Use http package for API calls to the backend",
			"Write widget tests for key components",
			"Keep business logic in services, not widgets",
		},
		FilePatterns: []string{"*.dart"},
	},
	"c": {
		ID:          "c",
		DisplayName: "C (make/cmake)",
		Description: "C application with make or cmake build system",
		BuildCmd:    "make",
		TestCmd:     "make test",
		DevCmd:      "make run",
		Instructions: []string{
			"Use C with a Makefile or CMakeLists.txt",
			"Organize as src/, include/, tests/",
			"Use proper header guards in all .h files",
			"Compile with -Wall -Wextra -Werror",
			"Manage memory carefully — free all allocations",
		},
		FilePatterns: []string{"*.c", "*.h"},
	},
	"generic": {
		ID:          "generic",
		DisplayName: "Generic",
		Description: "Language-agnostic minimal template",
		BuildCmd:    "",
		TestCmd:     "",
		DevCmd:      "",
		Instructions: []string{
			"Follow the project conventions established by the Controller",
			"Keep code organized and well-documented",
			"Write tests for all major functionality",
		},
		FilePatterns: []string{},
	},
}

Registry is the global map of all known stack templates.

Functions

func CopyCLI

func CopyCLI(srcPath, destDir string) (string, error)

CopyCLI copies the koor-cli binary from srcPath into destDir. Returns the destination path.

func FindCLI

func FindCLI() string

FindCLI searches for the koor-cli binary. It checks next to the running executable first, then falls back to PATH. Returns the absolute path or empty string if not found.

func GenerateMCPJSON

func GenerateMCPJSON(serverURL string) ([]byte, error)

GenerateMCPJSON returns the bytes for .claude/mcp.json.

func RenderAgentCLAUDEMD

func RenderAgentCLAUDEMD(data agentData) (string, error)

RenderAgentCLAUDEMD renders an agent's CLAUDE.md.

func RenderControllerCLAUDEMD

func RenderControllerCLAUDEMD(data controllerData) (string, error)

RenderControllerCLAUDEMD renders the Controller's CLAUDE.md.

func RenderOverviewMD

func RenderOverviewMD(projectName string, agents []agentSummary) (string, error)

RenderOverviewMD renders the plan/overview.md placeholder.

func Run

func Run(opts Options) error

Run runs the unified wizard flow.

func ScaffoldAgent

func ScaffoldAgent(cfg AgentConfig) error

ScaffoldAgent creates a single agent workspace.

func ScaffoldProject

func ScaffoldProject(cfg ProjectConfig) error

ScaffoldProject creates the full project directory structure: controller dir + all agent dirs.

func Slug

func Slug(name string) string

Slug converts a name to a lowercase slug for directory names and event topics.

func StackIDs

func StackIDs() []string

StackIDs returns all registered stack IDs with pinned stacks first, rest sorted alphabetically.

func ValidateAgentName

func ValidateAgentName(s string) error

ValidateAgentName validates an agent name.

func ValidateProjectName

func ValidateProjectName(s string) error

ValidateProjectName validates a project name.

Types

type AgentConfig

type AgentConfig struct {
	ProjectName  string
	AgentName    string
	Stack        string
	DBType       string // "sqlite", "postgres", "memory" — only for go-api stack
	ServerURL    string
	WorkspaceDir string
	CLIPath      string // path to koor-cli binary (empty = skip copy)
}

AgentConfig holds data needed to scaffold a single agent.

type AgentInfo

type AgentInfo struct {
	Name   string
	Stack  string
	DBType string // "sqlite", "postgres", "memory" — only for go-api stack
}

AgentInfo is the per-agent data collected during the wizard.

type Options

type Options struct {
	Accessible bool
}

Options configures the wizard behavior.

type ProjectConfig

type ProjectConfig struct {
	ProjectName string
	ServerURL   string
	ParentDir   string
	Agents      []AgentInfo
	CLIPath     string // path to koor-cli binary (empty = skip copy)
}

ProjectConfig holds all data needed to scaffold a new project.

type StackTemplate

type StackTemplate struct {
	ID           string   // registry key, e.g. "goth"
	DisplayName  string   // shown in select menu, e.g. "Go + templ + HTMX"
	Description  string   // one-line summary for the wizard UI
	BuildCmd     string   // primary build command
	TestCmd      string   // primary test command
	DevCmd       string   // dev server command
	Instructions []string // stack-specific lines for CLAUDE.md "Your Job" section
	FilePatterns []string // glob patterns this stack works with
}

StackTemplate defines stack-specific content injected into CLAUDE.md files.

Jump to

Keyboard shortcuts

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