Self-Healing Configuration
2026/9/12 16:13:40 网站建设 项目流程

Self-Healing Configuration

【免费下载链接】nxThe Monorepo Platform that amplifies both developers and AI agents. Nx optimizes your builds, scales your CI, and fixes failed PRs automatically. Ship in half the time.项目地址: https://gitcode.com/GitHub_Trending/nx/nx

Confidence Rules

  • Fixes involving "test" targets should require high confidence
  • Formatting fixes can be applied with medium confidence

Off-Limits Areas

  • /src/generated/- auto-generated, do not modify
  • /legacy/- requires manual review

Fix Preferences

  • Prefer updating ESLint rules over adding disable comments
  • For type errors, prefer explicit types overany

Context

See ARCHICTECTURE.md for module boundaries.

文档建议覆盖的五类内容: | 段落 | 用途 | 示例 | | --- | --- | --- | | **Confidence Rules** | 覆盖 AI 对失败严重程度的分级 | “`**/migrations/**` 中的失败应归类为 `environment_state`” | | **Off-Limits Areas** | agent 永远不应修改的目录或文件 | “`/src/generated/` - auto-generated code” | | **Fix Preferences** | 指导 agent 处理常见问题的方式 | “Prefer updating ESLint rules over adding disable comments” | | **Predefined Fixes** | 为已知失败指定确定性解法 | “对 lint 失败,先尝试运行 `nx lint --fix`” | | **Context** | 引用 agent 应阅读的其他文档 | “See ARCHITECTURE.md for module boundaries” | 如果仓库根目录已有 `CLAUDE.md`,agent 也会读取它;两者同时存在时,冲突指令以 **SELF_HEALING.md 优先**,`CLAUDE.md` 中的通用上下文仍然可用。CI 专属指令应写在 `SELF_HEALING.md` 里。 ## 高级:用 .nx/ci-config.yaml 做分支级覆盖 官方建议日常配置走工作区设置,`.nx/ci-config.yaml` 中的覆盖项只用于**临时的、分支专属**的调整(例如在敏感分支上临时关闭自愈,或在把工作区设置定稿前试配置)。在 `.nx/ci-config.yaml` 的 `ai` 段下可设置: | 键 | 说明 | 示例 | | --- | --- | --- | | `fix-tasks-patterns` | 覆盖哪些任务有资格被修复 | `['*lint*', '*test*']` | | `auto-apply-patterns` | 覆盖哪些任务可被自动应用 | `['*lint*']` | ```yaml # .nx/ci-config.yaml ai: # 修复 lint 和 test 任务,但从不修复 e2e fix-tasks-patterns: - '*lint*' - '*test*' - '!*e2e*' # 只自动应用 lint 修复 auto-apply-patterns: - lint

模式使用 glob 语法匹配任务名,!前缀表示取反。优先级规则:当工作区设置和.nx/ci-config.yaml同时存在时,.nx/ci-config.yaml它设置的键优先,未设置的键回落到工作区设置。完整的键说明见 CI Configuration File 参考。

验证配置生效并处理修复

CI 跑完后,到 Nx Cloud 中打开对应的 pipeline execution(CIPE),有两个入口用于核对:

  • Configurations 标签页:查看本次执行时相关的工作区设置、ci-config.yaml提供的值,以及最终生效的配置;如果创建了SELF_HEALING.md,这里也能看到它是否被检测到并应用;
  • PR/MR 本身:失败任务的修复会以 PR 评论形式出现,包含推理摘要、diff 视图和 Apply/Reject 按钮;安装了 Nx Console 的用户还能在 VS Code、Cursor 或 WebStorm 里直接收到修复通知。

对一条具体修复,应用与回滚都有明确路径:

  • 直接应用:在编辑器通知、PR/MR 评论或 Nx Cloud UI 的 diff 视图中点击 “Apply”;
  • 本地微调:如果修复只差一点,在评论或 UI 中点 “Apply Locally”,然后在终端运行给出的命令(fix identifier 显示在 Nx Cloud UI 和 PR/MR 评论中):
nx apply-locally <fix-identifier>

【免费下载链接】nxThe Monorepo Platform that amplifies both developers and AI agents. Nx optimizes your builds, scales your CI, and fixes failed PRs automatically. Ship in half the time.项目地址: https://gitcode.com/GitHub_Trending/nx/nx

创作声明:本文部分内容由AI辅助生成(AIGC),仅供参考

需要专业的网站建设服务?

联系我们获取免费的网站建设咨询和方案报价,让我们帮助您实现业务目标

立即咨询