Stylesafe

io.github.Patrizzos由 GitHub 账号 Patrizzos 发布v0.1.9更新于 Oct 27, 2026

MCP server and CLI that catches CSS cascade conflicts and Tailwind utility clashes before they ship.

已验证STDIO仅桌面开发者工具媒体与设计

概览

AI 生成的概览

本地 MCP 服务器兼 CLI,在样式上线前发现 CSS 层叠冲突和相互冲突的 Tailwind 工具类。

可以做什么
  • 分析样式表和组件文件中的重复 CSS 声明、由优先级冲突导致的死规则,以及可能非故意的静默样式覆盖
  • 找出相互冲突的 Tailwind 工具类,如 padding、margin、background、shadow、opacity、border、ring 等
  • 识别 cn()、clsx() 和 twMerge() 调用表达式,而不只是普通 className 字符串
  • 返回结构化报告,包含 confidence、riskScore、nextStep 以及 passed、clean 标记
  • 可作为 CLI 分析单个文件、目录、git 变更文件,或以监听模式持续运行
适用场景
适合在助手修改 JSX 或 CSS 后、提交变更前捕获样式问题;也适合在拉取请求中拦截层叠冲突或工具类冲突,或对现有项目做样式审计。
运行要求
以 stdio 本地进程方式运行,从 npm 包安装(需要 Node.js)。未声明任何认证、环境变量或请求头。可在项目根目录放置 .styleintegrityrc 配置文件。
安装前请注意
它会读取项目源文件进行分析,可通过 .styleintegrityrc 的 ignore 列表排除路径。报告为建议性质,带有置信度和 requiresUserConfirmation 标记,被标记的冲突通常需要人工确认而非自动修复。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Stylesafe,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

StyleSafe - MCP and CLI

An MCP server and CLI that catches CSS cascade conflicts and Tailwind utility clashes before they ship — built for AI coding agents and CI workflows.

What it does

  • Detects duplicate CSS declarations and dead rules from specificity conflicts
  • Flags silent style overrides that may be accidental
  • Finds conflicting Tailwind utilities (padding, margin, background, shadow, opacity, border, ring, etc.)
  • Understands cn(), clsx(), and twMerge() call expressions, not just plain className strings
  • Returns structured agent-friendly reports with confidence, riskScore, and nextStep

Quick start

As a CLI tool

bash
npm install -g stylesafestylesafe src/components/Button.jsxstylesafe --changed --fail-on-issuesstylesafe --projectRoot srcstylesafe --watch src

As an MCP server

json
{  "mcpServers": {    "stylesafe": {      "command": "node",      "args": ["/absolute/path/to/server.js"]    }  }}

Example output

bash
stylesafe examples/tailwind-conflict.jsx

Returns a structured report:

json
{  "totalIssues": 5,  "riskScore": 275,  "averageRiskScore": 55,  "riskLevel": "medium",  "passed": true,  "clean": false,  "files": [    {      "filename": "examples/tailwind-conflict.jsx",      "issues": [        {          "type": "tailwind-conflict",          "category": "padding",          "classes": ["p-4", "px-8"],          "confidence": "medium",          "riskScore": 55,          "nextStep": "Choose one utility from the conflicting set or split the classes by scope.",          "requiresUserConfirmation": true        }      ]    }  ]}

passed: true means no hard errors. clean: true means zero issues of any kind.

Use cases

  • AI code generation: Catch style bugs before the agent commits changes
  • PR gate: Block merged changes that introduce cascade conflicts or utility clashes
  • Agent workflows: Integrate as a confirmation step in multi-turn coding tasks
  • Style audits: Run across a project to find existing issues

CLI options

  • stylesafe <file> — analyze a single file
  • stylesafe <dir> — analyze a directory recursively
  • stylesafe --projectRoot <dir> — same as above
  • stylesafe --changed — analyze git-changed files (for PR/CI)
  • stylesafe --changed --fail-on-issues — exit with code 1 if any issues found
  • stylesafe --watch src — re-run on every file change
  • npm test — run regression tests

Config

Place a .styleintegrityrc file in your project root:

json
{  "ignore": ["dist", "*.min.css"],  "failOn": ["error", "warning"]}

GitHub Actions

Add to .github/workflows/style-check.yml:

yaml
name: stylesafe
on:  pull_request:  push:    branches: [main]
jobs:  stylesafe:    runs-on: ubuntu-latest    steps:      - uses: actions/checkout@v4      - uses: actions/setup-node@v4        with:          node-version: 20      - run: npm install      - run: node server.js --changed --fail-on-issues

来源:README.md,提交 8d5978c

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v0.1.9最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分