higress-group/higress

nginx-migration-mcp 插件沙箱工具 || nginx-migration-mcp plug-in sandbox tool

Ouverte

#3 081 ouverte le 31 oct. 2025

 (0 commentaire) (0 réaction) (0 personne assignée)Go (1 219 forks)github user discovery
area/aihelp wanted

Métriques du dépôt

Stars
 (9 036 étoiles)
Métriques de merge PR
 (Merge moyen 7j 9h) (18 PRs mergées en 30 j)

Description

沙盒验证工具

目标

自动验证 AI 生成的代码和配置能否真正编译、部署和运行

新增工具

1. validate_ingress_config - Ingress 配置验证

{
  "name": "validate_ingress_config",
  "inputSchema": {
    "ingress_yaml": "生成的 Ingress YAML",
    "test_paths": ["测试路径列表"]
  }
}

流程: YAML检查 → 部署 → 路由测试

示例:

kubectl apply --dry-run=client -f ingress.yaml  # 语法检查
kubectl apply -f ingress.yaml                    # 部署
curl -H "Host: api.com" http://$IP/api          # 测试路由

2. validate_and_deploy_plugin - WASM 插件验证

{
  "name": "validate_and_deploy_plugin",
  "inputSchema": {
    "plugin_name": "插件名称",
    "go_code": "Go 代码",
    "wasmplugin_yaml": "WasmPlugin YAML",
    "test_requests": ["测试请求"]
  }
}

流程: 编译 → 构建镜像 → 部署 → 功能测试

示例:

tinygo build -o plugin.wasm main.go              # 编译
docker build -t plugin:test .                    # 构建
kubectl apply -f wasmplugin.yaml                 # 部署
curl -H "Auth: token" http://$IP/api            # 测试

返回格式

{
  "status": "success|failed",
  "steps": [
    {"name": "compile", "success": true, "output": "3.2MB"},
    {"name": "deploy", "success": true},
    {"name": "test", "success": false, "error": "验证失败"}
  ],
  "suggestions": ["LLM 修复建议"]
}

Originally posted by @imp2002 in https://github.com/alibaba/higress/issues/2916#issuecomment-3467836093


Sandbox verification tool

Target

Automatically verify that AI-generated code and configurations actually compile, deploy, and run.

New tools

1. validate_ingress_config - Ingress configuration verification

{
  "name": "validate_ingress_config",
  "inputSchema": {
    "ingress_yaml": "Generated Ingress YAML",
    "test_paths": ["Test path list"]
  }
}

Process: YAML check → deployment → routing test

Example:

kubectl apply --dry-run=client -f ingress.yaml # Grammar check
kubectl apply -f ingress.yaml # Deployment
curl -H "Host: api.com" http://$IP/api # Test routing

2. validate_and_deploy_plugin - WASM plug-in validation

{
  "name": "validate_and_deploy_plugin",
  "inputSchema": {
    "plugin_name": "plugin name",
    "go_code": "Go code",
    "wasmplugin_yaml": "WasmPlugin YAML",
    "test_requests": ["test requests"]
  }
}

Process: Compile → Build Image → Deploy → Functional Test

Example:

tinygo build -o plugin.wasm main.go # Compile
docker build -t plugin:test . # Build
kubectl apply -f wasmplugin.yaml # Deployment
curl -H "Auth: token" http://$IP/api # Test

Return format

{
  "status": "success|failed",
  "steps": [
    {"name": "compile", "success": true, "output": "3.2MB"},
    {"name": "deploy", "success": true},
    {"name": "test", "success": false, "error": "Verification failed"}
  ],
  "suggestions": ["LLM fix suggestions"]
}

Originally posted by @imp2002 in https://github.com/alibaba/higress/issues/2916#issuecomment-3467836093

Guide contributeur