代码架构健康检查工具

Boilerforge是一款用于检查代码架构健康状态的工具,提供架构质量评分、堆栈元数据检测和治理护栏验证,适用于生产团队的代码质量管理和CI/CD流程。

  • by MRKT365-India
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 MRKT365-India/boilerforge

使用说明

锅炉

AI构建的代码库的架构治理楔子——医生优先的健康检查和生产团队的护栏。

Boilerforge现在 医生优先。与其从样板注册表开始,不如从检查架构质量开始:

boilerforge doctor .

它为您的项目评分,检测堆栈元数据,验证治理护栏,并给出可操作的建议。


快速入门

npx -y @cometforge/boilerforge@latest doctor .

CI门:

boilerforge doctor . --ci --min-score 70

徽章片段:

boilerforge doctor . --badge

输出示例:

![Boilerforge Score](https://img.shields.io/badge/boilerforge-78%2F100-yellow)

命令

boilerforge doctor [path]

建筑健康报告,加权评分(/100)。

旗帜:

  • --json 输出机器可读JSON
  • --ci 如果低于阈值,则以非零退出失败
  • --min-score <number> 阈值 --ci (默认值70)
  • --badge 打印标记徽章片段+分数

boilerforge analyze [path]

检测堆栈元数据:

  • 语言/运行时
  • 框架
  • 包管理器
  • 基线项目元数据

boilerforge validate [path]

评估建筑护栏并返回:

  • 通过
  • 得分
  • 分类问题(critical, warning, info)
  • 建议

boilerforge extract [path] [--name <template-name>]

将当前项目提取到本地模板注册表中:

  • 写 .boilerforge-template.yaml 源代码项目
  • 在下创建模板 ~/.boilerforge/registry/<template-name>/
  • 仅复制正常文件(不包括 .git, node_modules, dist、构建工件、环境秘密)

boilerforge create <template-name> [target-path]

从本地注册表模板构建项目并写入锁文件(boilerforge.lock.json).

boilerforge upgrade [path]

基于锁文件+本地模板版本升级项目:

  • 将锁定的模板版本与最新的本地注册表进行比较
  • 按顺序应用迁移挂钩(如果存在)(writeFile, appendFile, deleteFile, copyFromTemplate, patchJSON)
  • 写入更新的锁文件

医生规则引擎(100分)

  1. CI工作流已存在-- 12
  2. 存在环境模式验证-- 10
  3. 类型检查脚本存在-- 10
  4. 测试脚本+测试文件存在-- 12
  5. Lint已配置-- 10
  6. 已配置安全标头(web堆栈)-- 10
  7. 存在集中日志记录-- 8
  8. 存在可观测钩子(哨兵/开放遥测等)-- 8
  9. 依赖性卫生-- 10
  10. 文档基线(README+设置)-- 10

产出包括:

  • 得分 /100
  • 检测到的堆栈摘要
  • 分类问题
  • 可操作的建议

本地注册表模型

注册表根:

~/.boilerforge/registry

模板布局:

<template>/
  template.yaml
  files/
  migrations/   (optional)

template.yaml 接受YAML(不仅仅是JSON),并对必填字段进行严格验证(name, version, createdAt)存在明显的解析/验证错误。

锁定文件(boilerforge.lock.json)存储用于确定性升级的模板名称/版本/源。


生命周期兼容性

现有的生命周期工作流仍受支持:

boilerforge init <project-name> [--workflow=claude]
boilerforge update [--dry-run]
boilerforge protect add <category> <name>
boilerforge protect remove <category> <name>
boilerforge status

MCP服务器工具(未更改)

  • list_boilerplates
  • get_boilerplate
  • search_boilerplates
  • scaffold_project
  • check_project_updates

在非交互式MCP上下文中运行不带CLI参数的包仍然会启动MCP服务器。


CI/CD

GitHub操作工作流包括:

  • ci.yml:安装、调试、类型检查、测试、构建, doctor --ci --min-score 70CLI烟雾检查和npm包完整性(npm pack)验证。
  • publish.yml:发布驱动的发布管道(lint+typecheck+test+build+doctor gate+npm发布源代码)。

您自己仓库的最小CI代码段:

- name: Architecture gate
  run: boilerforge doctor . --ci --min-score 70

doctor --ci 当低于阈值时退出非零,因此它可以用作硬合并/释放门。


发展

git clone https://github.com/MRKT365-India/boilerforge.git
cd boilerforge
npm install
npm run build
npm test