Code Hug 是一个先进的 AI 驱动的软件开发工作流编排器,提供全面的端到端项目管理能力。基于六层控制系统构建,它无缝集成了代码考古学、商业智能提取和智能工作流自动化。
bash
# Python 依赖
pip install PyYAML requests python-dotenv
# 验证安装
python3 -c "import yaml; print('OK')"
node --version
java -version
工具描述参数codehug:start_session启动新的工作流会话project_name, project_root, tech_stack``codehug:run_stage执行指定阶段session_id, stage, context``codehug:diagnose诊断构建/测试失败session_id, build_log, test_log``codehug:auto_fix尝试自动修复问题session_id, problem_type, project_root``codehug:validate运行集成验证session_id, project_root, test_cases``codehug:get_status获取当前会话状态session_id``codehug:extract_business_rules从代码库提取业务规则project_root, output_format``codehug:generate_prd生成PRD文档project_root, business_context``codehug:map_workflows映射业务工作流project_root, workflow_types
在 ~/.openclaw/config.json 中添加:
json
{
"skills": {
"code-hug": {
"project_root": "/path/to/your/project",
"auto_fix_enabled": true,
"max_fix_attempts": 3,
"enable_safety_checks": true,
"enable_rollback": true,
"notification_channels": ["webchat", "email"],
"business_intelligence_enabled": true
}
}
}
选项类型默认值描述project_rootstring必填项目根目录auto_fix_enabledbooleantrue启用自动修复max_fix_attemptsinteger3最大自动修复尝试次数enable_safety_checksbooleantrue启用安全验证enable_rollbackbooleantrue启用回滚机制notification_channelsarray["webchat"]通知渠道business_intelligence_enabledbooleantrue启用商业智能提取
text
/codehug:start_session {
"project_name": "membership-service",
"project_root": "/Users/dev/projects/membership-service",
"tech_stack": ["Java 17", "Spring Boot 3", "MySQL 8"]
}
text
/codehug:run_stage {
"session_id": "membership-service-001",
"stage": "requirements_analysis",
"context": {
"business_context_provided": true,
"success_metrics_defined": true,
"stakeholder_identified": true,
"extract_business_rules": true,
"generate_prd": true
}
}
text
/codehug:extract_business_rules {
"project_root": "/Users/dev/projects/membership-service",
"output_format": "markdown"
}
text
/codehug:diagnose {
"session_id": "membership-service-001",
"build_log": "[ERROR] COMPILATION ERROR: cannot find symbol...",
"test_log": ""
}
text
/codehug:auto_fix {
"session_id": "membership-service-001",
"problem_type": "compilation_error",
"project_root": "/Users/dev/projects/membership-service"
}
阶段准入标准准出标准产出物requirements_analysis业务背景、成功指标、干系人PRD完整性≥0.8、干系人批准、技术可行性确认prd.md, business_rules.jsonfunctional_decompositionPRD批准、架构约束、技术栈技术规格完整性≥0.9、API契约验证、数据库Schema评审tech_spec.md, api_contracts.jsoncode_implementation技术规格批准、编码规范、开发环境单元测试覆盖率≥80%、静态分析通过、代码评审≥0.85source_code/, test_coverage.jsonintegration_validation代码批准、构建脚本、测试环境构建成功、集成测试通过、冒烟测试通过test_results.json, integration_report.mddeployment_preparation集成验证批准、部署脚本、回滚计划部署包验证、生产就绪确认、监控配置deployment_plan.md, production_checklist.md
问题类型描述自动修复支持build_configuration构建配置错误(Java版本、Maven/Gradle配置)✅ 完全支持dependency_conflict依赖冲突、版本不兼容✅ 完全支持compilation_error编译错误、语法错误、符号未找到✅ 完全支持test_failure单元/集成测试失败⚠️ 部分支持runtime_error运行时错误(空指针、内存溢出)⚠️ 建议性修复environment_issue环境问题(权限、磁盘空间、网络)⚠️ 建议性修复business_rule_violation违反提取的业务规则✅ 完全支持
错误码描述解决方案SESSION_NOT_FOUND会话不存在验证 session_idSTAGE_INVALID阶段名称无效检查阶段是否在定义列表中ENTRY_CRITERIA_NOT_MET不满足准入标准验证上下文先决条件EXIT_CRITERIA_NOT_MET不满足准出标准完成所需产出物AUTO_FIX_FAILED自动修复失败查看日志,考虑手动干预VALIDATION_FAILED集成验证失败检查构建日志和测试报告
所有操作都会记录到审计轨迹中:
json
{
"timestamp": "2026-03-24T12:50:00Z",
"action": "stage_completed",
"actor": "code-hug",
"details": {
"session_id": "membership-service-001",
"stage": "requirements_analysis",
"artifact": "/path/to/prd.md",
"business_rules_extracted": true
}
}
Code Hug 与代码考古学技能无缝集成,提供:
版本日期变更1.0.02026-03-24初始发布,从 workflow-orchestrator 演化而来,增强了商业智能能力