开发者生态
morning
Show HN:AISlop,用于捕获 AI 生成的代码气味的 CLI
2026-05-29
1 阅读
Heavykenny
aislop 捕获人工智能编码代理在您的代码中留下的废话。 Claude Code、Cursor、Codex 和 OpenCode 留下的模式:不言自明的代码之上的叙述性注释、吞噬异常、任何强制转换、幻觉导入、重复的帮助程序、死代码、待办事项存根、超大函数。测试通过。林特通过了。无论如何,代码都会腐烂。艾斯洛普抓住了他们。跨 7 种语言(TS/JS、Python、Go、Rust、Ruby、PHP、Java)的 40 多个规则。每次变化的评分为 0-100。亚秒级。确定性——运行时路径中没有法学硕士,相同的代码,相同的分数。麻省理工学院许可的免费 CLI。快速启动 npx aislop scan 无需安装。适用于任何项目。几秒钟内即可获得分数。 npx aislop fix # 自动修复问题 npx aislop fix -f # 积极修复(deps、未使用的文件) npx aislop ci # CI 模式(JSON + gateway) npx aislop hook install --claude # per-edit hook 公共徽章 : 在 README 上显示你的分数 [ ![ aislop ] ( https://badges.scanaislop.com/score//.svg )] ( https://scanaislop.com )运行 npx aislop bad 来自动生成。免费访问 scanaislop.com。查看实际操作 扫描安装 # 无需安装 npx aislop scan 即可运行 # npm npm install --save-dev aislop # warnyarn add --dev aislop # pnpm pnpm add -D aislop # 全局 npm install -g aislop 也可在 GitHub Packages 上以 @scanaislop/aislop 形式获取。用法 扫描 npx aislop scan # 当前目录 npx aislop scan ./src # 特定目录 npx aislop scan --changes # 从 HEAD 更改的文件 npx aislop scan --staged # 仅暂存文件 npx aislop scan --json # JSON 输出 排除文件:node_modules、.git、dist、build、默认排除覆盖率。在 .aislop/config.yml 中添加更多内容: except : - " **/*.test.ts " - src/ generated 或通过 CLI: npx aislop scan --exclude "**/*.test.ts,dist" 扩展配置 : 项目配置可以扩展父级: # .aislop/config.yml extends : ../../.aislop/base.yml ci : failureBelow : 80 #覆盖特定键修复自动修复机械问题(格式化程序、未使用的导入、死代码)。对于需要上下文的问题,请将完整的诊断信息交给您的代理。 npx aislop fix # 安全自动修复 npx aislop fix -f # 激进:deps,未使用的文件 交给代理 当自动修复无法解决时,将剩余问题传递给您的编码代理并提供完整的上下文: npx aislop fix --claude # Claude Code npx aislop fix --cursor # 光标(复制到剪贴板) npx aislop fix --gemini # Gemini CLI npx aislop fix --codex # Codex CLI #另外:--windsurf、--amp、--aider、--goose、--opencode、--warp、--kimi、--antigravity、--deep-agents、--vscode npx aislop fix --prompt # 打印提示(与代理无关) 安装挂钩 在每次代理编辑后运行。反馈立即回流。 npx aislop hook install --claude # Claude 代码 npx aislop hook install --cursor # 光标 npx aislop hook install --gemini # Gemini CLI npx aislop hook install # 所有支持的代理 npx aislop hook install claude cursor # 特定代理 运行时适配器(扫描 + 反馈): claude 、cursor 、 gemini 。仅规则(代理读取规则): codex 、 Windsurf 、 cline 、 kilocode 、 antigravity 、 copilot 。质量门模式:如果分数低于基线,则阻止。 npx aislop hook install --claude --quality-gate npx aislop hook benchmark # 重新捕获基线 npx aislop hook status # 列出已安装的 npx aislop hook uninstall --claude # 删除文档:/docs/hooks MCP 服务器 将 aislop 公开为 Claude Desktop、Cursor、Codex 的 MCP 工具: // ~/.cursor/mcp.json 或 Claude Desktop config { "mcpServers" : { "aislop" : { "command" : " npx " , "args" : [ " -y " , " aislop-mcp " ] } } } 工具 : aislop_scan , aislop_fix , aislop_why , aislop_baseline CI npx aislop ci # JSON 输出,如果分数 < 阈值则退出 1 其他命令 npx aislop init # create .aislop/config.yml npx aislop init --strict # 企业级入口:所有引擎、类型检查、failBelow 85 npx aislop Rules # 列表规则 npx aislop bad # 打印徽章 URL npx aislop # 交互式菜单 文档:命令 CI 集成 预提交 npx aislop scan --staged GitHub Actions 运行 npx aislop init 并接受工作流程提示,或手动添加: - 使用 : actions/checkout@v4 - 使用 : actions/setup-node@v4 with:node-version:20 - 运行:npx aislop@latest ci。复合操作: - 使用:actions/checkout@v4 - 使用:scanaislop/aislop@v0.8 质量门