Repository: google/adk-go
File: cmd/adkgo/root/build/webui/webui.go (Go)

Code before:

type buildFlags struct {
	targetDir string // command line param
}

type sourceFlags struct {
	webuiDir string // command line param
}

type runLocalFlags struct {
	build  buildFlags
	source sourceFlags
}

var flags runLocalFlags

// webuiCmd represents the build webui command
var webuiCmd = &cobra.Command{
	Use:   "webui",
	Short: "Build static ADK Web UI from sources.",
	Long: `
	Builds static ADK Web UI files from sources. 
	WARNINIG: deletes the whole build directory and recreates it anew!
	You need: 
	  - a downloaded version of adk-web (available at https://github.com/google/adk-web)
	  - an ability to build adk-web (prerequisites on  https://github.com/google/adk-web):
	  	npm (node js: see https://nodejs.org/en/download)
		ng (angular cli: see https://angular.dev/tools/cli/setup-local)		
	  - go

	Building the adk-web takes a while, and sometimes presents some warnings.
	`,
	RunE: func(cmd *cobra.Command, args []string) error {
		err := flags.buildWebui()
		return err
	},
}

func init() {
	build.BuildCmd.AddCommand(webuiCmd)

	webuiCmd.PersistentFlags().StringVarP(&flags.build.targetDir, "targetDir", "t", "", "Target directory for build output")
	webuiCmd.PersistentFlags().StringVarP(&flags.source.webuiDir, "sourceDir", "s", "", "Directory containing ADK Web UI (from https://github.com/google/adk-web)")
}

func (f *runLocalFlags) cleanTemp() error {
	err := util.LogStartStop("Cleaning target directory",
		func(p util.Printer) error {
			p("Clean target directory starting with", f.build.targetDir)
			err := os.RemoveAll(f.build.targetDir)
			if err != nil {

Review comment (suggestion):
```suggestion
	  - an ability to build adk-web (prerequisites on https://github.com/google/adk-web):
```

Code after:

type buildFlags struct {
	targetDir string // command line param
}

type sourceFlags struct {
	webuiDir string // command line param
}

type runLocalFlags struct {
	build  buildFlags
	source sourceFlags
}

var flags runLocalFlags

// webuiCmd represents the build webui command
var webuiCmd = &cobra.Command{
	Use:   "webui",
	Short: "Build static ADK Web UI from sources.",
	Long: `
	Builds static ADK Web UI files from sources. 
	WARNINIG: deletes the whole build directory and recreates it anew!
	You need: 
	  - a downloaded version of adk-web (available at https://github.com/google/adk-web)
	  - an ability to build adk-web (prerequisites on https://github.com/google/adk-web):
	  	npm (node js: see https://nodejs.org/en/download)
		ng (angular cli: see https://angular.dev/tools/cli/setup-local)		
	  - go

	Building the adk-web takes a while, and sometimes presents some warnings.
	`,
	RunE: func(cmd *cobra.Command, args []string) error {
		err := flags.buildWebui()
		return err
	},
}

func init() {
	build.BuildCmd.AddCommand(webuiCmd)

	webuiCmd.PersistentFlags().StringVarP(&flags.build.targetDir, "targetDir", "t", "", "Target directory for build output")
	webuiCmd.PersistentFlags().StringVarP(&flags.source.webuiDir, "sourceDir", "s", "", "Directory containing ADK Web UI (from https://github.com/google/adk-web)")
}

func (f *runLocalFlags) cleanTemp() error {
	return util.LogStartStop("Cleaning target directory",
		func(p util.Printer) error {
			p("Clean target directory starting with", f.build.targetDir)
			err := os.RemoveAll(f.build.targetDir)
			if err != nil {