Documentation
¶
Index ¶
- Constants
- Variables
- func CopyTemplateFiles(appPath, language, template string) error
- func NormalizeLanguage(language string) string
- func PromptForAppName(providedAppName string) (string, error)
- func PromptForLanguage(providedLanguage string) (string, error)
- func PromptForTemplate(providedTemplate string, providedLanguage string) (string, error)
- type TemplateInfo
- type TemplateKeyValue
- type TemplateKeyValues
Constants ¶
const ( DIR_PERM = 0755 // rwxr-xr-x FILE_PERM = 0644 // rw-r--r-- )
const ( DefaultAppName = "my-kernel-app" AppNamePrompt = "What is the name of your project?" LanguagePrompt = "Choose a programming language:" TemplatePrompt = "Select a template:" )
const ( LanguageTypeScript = "typescript" LanguagePython = "python" LanguageShorthandTypeScript = "ts" LanguageShorthandPython = "py" )
Variables ¶
var SupportedLanguages = []string{ LanguageTypeScript, LanguagePython, }
SupportedLanguages returns a list of all supported languages
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 ¶
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 ¶
Helper to normalize language input (handle shorthand)
func PromptForAppName ¶
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 ¶
Types ¶
type TemplateInfo ¶
type TemplateKeyValue ¶
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