yao/cmd/robot/robot.go
Max 44af6ba759 Enhance command structure with MCP and Robot functionalities
- Introduce new MCP and Robot command groups in the CLI, allowing for better organization of package management commands.
- Add corresponding command descriptions for MCP and Robot functionalities to improve user guidance.
- Update the agent command group to include additional commands for enhanced agent management.
- Modify .gitignore to exclude specific design markdown files from version control.
- Add environment variable for test application path in GitHub workflows to streamline testing setup.
2026-03-03 08:11:43 +08:00

52 lines
1.1 KiB
Go

package robot
import (
"os"
"path/filepath"
"github.com/yaoapp/kun/exception"
"github.com/yaoapp/yao/config"
)
var appPath string
var envFile string
var langs = map[string]string{
"Install a robot package from the registry": "从注册中心安装 Robot 包",
"Team ID (required)": "团队 ID (必填)",
"Package version or dist-tag": "包版本或 dist-tag",
"Application directory": "应用目录",
"Environment file": "环境变量文件",
}
// L Language switch
func L(words string) string {
var lang = os.Getenv("YAO_LANG")
if lang == "" {
return words
}
if trans, has := langs[words]; has {
return trans
}
return words
}
// Boot sets the configuration
func Boot() {
root := config.Conf.Root
if appPath != "" {
r, err := filepath.Abs(appPath)
if err != nil {
exception.New("Root error %s", 500, err.Error()).Throw()
}
root = r
}
if envFile != "" {
config.Conf = config.LoadFromWithRoot(envFile, root)
} else {
config.Conf = config.LoadFromWithRoot(filepath.Join(root, ".env"), root)
}
config.ApplyMode()
}