← 返回
AI智能 中文

Anti-Pattern Czar

Detect and fix TypeScript error handling anti-patterns with state persistence and approval workflows. Use when scanning a codebase for silent error failures,...
检测并修复 TypeScript 错误处理反模式,支持状态持久化与审批工作流。适用于扫描代码库中的静默错误失败等场景。
glucksberg
AI智能 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 930
下载
💾 18
安装
1
版本
#latest

概述

Anti-Pattern Czar

Autonomous agent that systematically identifies and fixes TypeScript error handling anti-patterns.

Detector

Run with Bun (no install required):

bunx antipattern-czar
bunx antipattern-czar --src lib
bunx antipattern-czar --config my-config.json

Config via .antipatternrc.json:

{
  "srcDir": "src",
  "criticalPaths": ["DatabaseService.ts", "AuthHandler.ts"],
  "skipDirectories": ["node_modules", "dist", ".git"]
}

Mode Selection

Parse user intent to pick mode:

User SaysModeAction
-------------------------
"scan", "detect", "find"SCANRun detector, save state
"review", "fix", "help me fix"REVIEWInteractive fix session
"auto", "fix all", "autonomous"AUTOBatch fix with guardrails
"resume", "continue"RESUMELoad state, continue
"report", "status", "progress"REPORTShow current state

State File

Always check .anti-pattern-state.json at the project root. On first SCAN, ask if resuming when it exists.

{
  "session_id": "<uuid>",
  "started_at": "<ISO>",
  "target_path": "<path>",
  "issues": [],
  "history": []
}

Issue schema: id, file, line, pattern, severity (critical/high/medium), is_critical_path, status (pending/fixed/approved_override/skipped), code_snippet.

Workflow by Mode

See workflows.md for full per-mode workflows. Summary:

  • SCAN: Run detector → parse issues → classify severity → save state → show summary
  • REVIEW: Load state → sort by critical-path + severity → read code context → explain issue → propose fix options → apply approved fix → update state
  • AUTO: Confirm with user → auto-fix non-critical-path issues using templates → switch to REVIEW for critical-path hits → show summary
  • RESUME: Load .anti-pattern-state.json → continue from first pending issue
  • REPORT: Display session stats, severity table, recent fixes, next actions

Approved Overrides

Only suggest APPROVED_OVERRIDE when ALL are true:

  1. Error is expected and frequent
  2. Logging would create excessive noise
  3. There is explicit recovery/fallback logic
  4. Reason is specific and technical

NEVER approve overrides on critical paths without exceptional user confirmation.

Format:

} catch {
  // [APPROVED_OVERRIDE] <specific technical reason>
  // Fallback: <what happens instead>
}

Fix Templates

See patterns.md for the full pattern list with severity, auto-fix eligibility, and code templates.

Progress Output Format

After each fix:

✅ Fixed: src/services/example.ts:42
   Pattern: NO_LOGGING_IN_CATCH
   Solution: Added logger.error() with context

Progress: 4/28 issues remaining ━━━━━━━ 14%

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 10:00 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

security-compliance

pr-review

glucksberg
在发布PR前查找并修复代码问题。单次审查并自动修复。适用于在提交前审查代码变更或审计现有代码...
★ 0 📥 2,119
ai-intelligence

ontology

oswalpalash
类型化知识图谱,用于结构化智能体记忆与可组合技能。支持创建/查询实体(人员、项目、任务、事件、文档)及关联...
★ 711 📥 243,717
ai-intelligence

Proactive Agent

halthelobster
将AI智能体从任务执行者升级为主动预判需求、持续优化的智能伙伴。集成WAL协议、工作缓冲区、自主定时任务及实战验证模式。Hal Stack核心组件 🦞
★ 834 📥 213,006