决策守护者:使用正则表达式和 JSONPath 在拉取请求中强制执行 ADRs

4作者: iamalizaidi3 个月前原帖
我最近偶然发现了这个工具,觉得对于管理大型代码库或单体仓库的开发者来说非常值得分享。 问题:我们编写架构决策记录(ADRs),将它们放在一个文件夹里,然后就不再关注。新工程师因为不了解历史而打破架构规则。 解决方案:Decision Guardian 在持续集成(CI)中运行。你可以定义与文件模式相关的规则(ADRs)。 它的有趣之处在于: 它不仅仅是简单的模式匹配。你可以基于以下内容定义规则: - 内容(正则表达式):例如,如果有人提交了秘密密钥模式或被禁止的函数,则发出警报。 - 结构(JSONPath):例如,监控 package.json 中的 $.dependencies,以防止库的漂移。 - 位置(行范围):保护遗留文件的前50行。 它是开源的,还有一个辅助网站可以生成规则配置: https://decision-guardian.decispher.com/
查看原文
I stumbled across this tool recently and thought it was worth sharing for anyone managing large codebases or monorepos.<p>The Problem: We write ADRs (Architectural Decision Records), put them in a folder, and then ignore them. New engineers break architectural rules because they don&#x27;t know the history.<p>The Solution: Decision Guardian runs in CI. You define rules (ADRs) linked to file patterns.<p>What makes it interesting: It goes beyond simple glob matching. You can define rules based on:<p>Content (Regex): e.g., Alert if someone commits a secret key pattern or a banned function.<p>Structure (JSONPath): e.g., Watch $.dependencies in package.json to prevent library drift.<p>Location (Line Range): Protect the first 50 lines of a legacy file.<p>It’s open source and there&#x27;s a helper site to generate the rule configs: https:&#x2F;&#x2F;decision-guardian.decispher.com&#x2F;