Upgrade updateassets command to use templates with manifest context
- Convert all asset files to be processed as Go templates - Expose plugin manifest data via .Manifest key in template context - Add template processing infrastructure with TemplateContext struct - Update asset processing pipeline to execute templates instead of direct file copying - Fix info command output format to use plain text instead of structured logging - All tests passing with proper error handling and backward compatibility This enables dynamic asset files that can access plugin manifest properties like {{.Manifest.Id}}, {{.Manifest.Version}}, and conditional logic based on plugin configuration. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
03c521f237
commit
04fa4154b3
2 changed files with 77 additions and 31 deletions
41
info.go
41
info.go
|
@ -28,28 +28,28 @@ func PrintPluginInfo(manifest *model.Manifest) error {
|
|||
|
||||
// printBasicInfo prints basic plugin information.
|
||||
func printBasicInfo(manifest *model.Manifest) {
|
||||
Logger.Info("Plugin Information:")
|
||||
Logger.Info("==================")
|
||||
fmt.Println("Plugin Information:")
|
||||
fmt.Println("==================")
|
||||
|
||||
Logger.Info("ID:", "value", manifest.Id)
|
||||
Logger.Info("Name:", "value", manifest.Name)
|
||||
Logger.Info("Version:", "value", manifest.Version)
|
||||
fmt.Printf("ID: %s\n", manifest.Id)
|
||||
fmt.Printf("Name: %s\n", manifest.Name)
|
||||
fmt.Printf("Version: %s\n", manifest.Version)
|
||||
|
||||
minVersion := manifest.MinServerVersion
|
||||
if minVersion == "" {
|
||||
minVersion = "Not specified"
|
||||
}
|
||||
Logger.Info("Min MM Version:", "value", minVersion)
|
||||
fmt.Printf("Min MM Version: %s\n", minVersion)
|
||||
|
||||
if manifest.Description != "" {
|
||||
Logger.Info("Description:", "value", manifest.Description)
|
||||
fmt.Printf("Description: %s\n", manifest.Description)
|
||||
}
|
||||
}
|
||||
|
||||
// printCodeComponents prints information about server and webapp code.
|
||||
func printCodeComponents(manifest *model.Manifest) {
|
||||
Logger.Info("Code Components:")
|
||||
Logger.Info("================")
|
||||
fmt.Println("Code Components:")
|
||||
fmt.Println("================")
|
||||
|
||||
printServerCodeInfo(manifest)
|
||||
printWebappCodeInfo(manifest)
|
||||
|
@ -58,28 +58,33 @@ func printCodeComponents(manifest *model.Manifest) {
|
|||
// printServerCodeInfo prints server code information.
|
||||
func printServerCodeInfo(manifest *model.Manifest) {
|
||||
if HasServerCode(manifest) {
|
||||
Logger.Info("Server Code:", "value", "Yes")
|
||||
fmt.Println("Server Code: Yes")
|
||||
if manifest.Server != nil && len(manifest.Server.Executables) > 0 {
|
||||
var executables []string
|
||||
fmt.Print("Executables: ")
|
||||
first := true
|
||||
for platform := range manifest.Server.Executables {
|
||||
executables = append(executables, platform)
|
||||
if !first {
|
||||
fmt.Print(", ")
|
||||
}
|
||||
fmt.Print(platform)
|
||||
first = false
|
||||
}
|
||||
Logger.Info("Executables:", "platforms", executables)
|
||||
fmt.Println()
|
||||
}
|
||||
} else {
|
||||
Logger.Info("Server Code:", "value", "No")
|
||||
fmt.Println("Server Code: No")
|
||||
}
|
||||
}
|
||||
|
||||
// printWebappCodeInfo prints webapp code information.
|
||||
func printWebappCodeInfo(manifest *model.Manifest) {
|
||||
if HasWebappCode(manifest) {
|
||||
Logger.Info("Webapp Code:", "value", "Yes")
|
||||
fmt.Println("Webapp Code: Yes")
|
||||
if manifest.Webapp != nil && manifest.Webapp.BundlePath != "" {
|
||||
Logger.Info("Bundle Path:", "value", manifest.Webapp.BundlePath)
|
||||
fmt.Printf("Bundle Path: %s\n", manifest.Webapp.BundlePath)
|
||||
}
|
||||
} else {
|
||||
Logger.Info("Webapp Code:", "value", "No")
|
||||
fmt.Println("Webapp Code: No")
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -89,7 +94,7 @@ func printSettingsSchema(manifest *model.Manifest) {
|
|||
if manifest.SettingsSchema != nil {
|
||||
value = "Yes"
|
||||
}
|
||||
Logger.Info("Settings Schema:", "value", value)
|
||||
fmt.Printf("Settings Schema: %s\n", value)
|
||||
}
|
||||
|
||||
// InfoCommandWithPath implements the 'info' command with a custom path.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue