前端资源嵌入提醒:从源码构建可执行文件若需包含 Web 控制台,必须先执行 bash scripts/ci/build-web.sh。该脚本使用 npm ci --ignore-scripts 并以 CHEESEWAF_AGENT_EYES=0 构建;@agent-eyes/agent-eyes 只允许本地开发使用,不得进入发布包或生产镜像。不要直接执行会触发该依赖 monorepo postinstall 的裸 npm ci。
BASH
# 克隆仓库git clone https://github.com/LaokeQwQ/CheeseWAF.git
cd CheeseWAF
# 1. 编译 Web 控制台前端静态资源,并同步到 Go 嵌入目录bash scripts/ci/build-web.sh
# 2. 编译 Go 主程序二进制go build -o bin/cheesewaf ./cmd/cheesewaf
# 3. 使用运行时配置副本启动本地服务,避免污染模板mkdir -p ./data/config
cp ./configs/cheesewaf.yaml ./data/config/cheesewaf.yaml
./bin/cheesewaf serve --config ./data/config/cheesewaf.yaml --data-dir ./data
自动化测试与质量校验
在提交代码前,请执行以下完整的单元测试、静态检查与攻击语料评测:
BASH
# 后端 Go 单元测试与代码静态检查go test -v ./cmd/... ./internal/...
go vet ./cmd/... ./internal/...
# 前端 TypeScript 类型检查与单元测试cd web && npm ci --no-audit --no-fund --ignore-scripts && npm run typecheck && npm test&&cd ..
# 运行内置攻击语料库压测与 AST 语义分析器评测go run ./cmd/cheesewaf-corpus --mode analyzer