create

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DIR_PERM  = 0755 // rwxr-xr-x
	FILE_PERM = 0644 // rw-r--r--
)
View Source
const (
	DefaultAppName = "my-kernel-app"
	AppNamePrompt  = "What is the name of your project?"
	LanguagePrompt = "Choose a programming language:"
	TemplatePrompt = "Select a template:"
)
View Source
const (
	LanguageTypeScript          = "typescript"
	LanguagePython              = "python"
	LanguageShorthandTypeScript = "ts"
	LanguageShorthandPython     = "py"
)

Variables

View Source
var SupportedLanguages = []string{
	LanguageTypeScript,
	LanguagePython,
}

SupportedLanguages returns a list of all supported languages

View Source
var Templates = map[string]TemplateInfo{
	"sample-app": {
		Name:        "Sample App",
		Description: "Implements basic Kernel apps",
		Languages:   []string{LanguageTypeScript, LanguagePython},
	},
	"advanced-sample": {
		Name:        "Advanced Sample",
		Description: "Implements sample actions with advanced Kernel configs",
		Languages:   []string{LanguageTypeScript, LanguagePython},
	},
	"computer-use": {
		Name:        "Computer Use",
		Description: "Implements the Anthropic Computer Use SDK",
		Languages:   []string{LanguageTypeScript, LanguagePython},
	},
	"cua": {
		Name:        "CUA Sample",
		Description: "Implements a Computer Use Agent (OpenAI CUA) sample",
		Languages:   []string{LanguageTypeScript, LanguagePython},
	},
	"magnitude": {
		Name:        "Magnitude",
		Description: "Implements the Magnitude.run SDK",
		Languages:   []string{LanguageTypeScript},
	},
	"gemini-cua": {
		Name:        "Gemini CUA",
		Description: "Implements Gemini 2.5 Computer Use Agent",
		Languages:   []string{LanguageTypeScript},
	},
	"browser-use": {
		Name:        "Browser Use",
		Description: "Implements Browser Use SDK",
		Languages:   []string{LanguagePython},
	},
	"stagehand": {
		Name:        "Stagehand",
		Description: "Implements the Stagehand v3 SDK",
		Languages:   []string{LanguageTypeScript},
	},
}

Functions

func CopyTemplateFiles

func CopyTemplateFiles(appPath, language, template string) error

CopyTemplateFiles copies all files and directories from the specified embedded template into the target application path. It uses the given language and template names to locate the template inside the embedded filesystem.

  • appPath: filesystem path where the files should be written (the project directory)
  • language: language subdirectory (e.g., "typescript")
  • template: template subdirectory (e.g., "sample-app")

The function will recursively walk through the embedded template directory and replicate all files and folders in appPath. If a file named "_gitignore" is encountered, it is renamed to ".gitignore" in the output, to work around file embedding limitations.

Returns an error if the template path is invalid, empty, or if any file operations fail.

func NormalizeLanguage

func NormalizeLanguage(language string) string

Helper to normalize language input (handle shorthand)

func PromptForAppName

func PromptForAppName(providedAppName string) (string, error)

PromptForAppName validates the provided app name or prompts the user for one. If the provided name is invalid, it shows a warning and prompts the user.

func PromptForLanguage

func PromptForLanguage(providedLanguage string) (string, error)

func PromptForTemplate

func PromptForTemplate(providedTemplate string, providedLanguage string) (string, error)

Types

type TemplateInfo

type TemplateInfo struct {
	Name        string
	Description string
	Languages   []string
}

type TemplateKeyValue

type TemplateKeyValue struct {
	Key   string
	Value string
}

type TemplateKeyValues

type TemplateKeyValues []TemplateKeyValue

func GetSupportedTemplatesForLanguage

func GetSupportedTemplatesForLanguage(language string) TemplateKeyValues

GetSupportedTemplatesForLanguage returns a list of all supported template names for a given language

func (TemplateKeyValues) ContainsKey

func (tkv TemplateKeyValues) ContainsKey(key string) bool

ContainsKey checks if a template key exists in the TemplateKeyValues

func (TemplateKeyValues) GetTemplateDisplayValues

func (tkv TemplateKeyValues) GetTemplateDisplayValues() []string

GetTemplateDisplayValues extracts display values from TemplateKeyValue slice

func (TemplateKeyValues) GetTemplateKeyFromValue

func (tkv TemplateKeyValues) GetTemplateKeyFromValue(selectedValue string) (string, error)

GetTemplateKeyFromValue maps the selected display value back to the template key

Jump to

Keyboard shortcuts

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