架构代码审查与重构助手,感知代码氛围和系统级流程问题。用于分析代码质量和架构,...
Ghostclaw — The Architecture Ghost. “我看到了函数之间的流动是一项面向实际任务的技能,主要用于我感觉到依赖性的力量;我知道模块何时不易使用;
该技能适合需要稳定复用相关能力的场景,可作为自动化工作流的一部分,也便于后续检查、调整和扩展。从功能定位来看,该技能强调把分散的操作要求整理成清晰、可复用的处理流程,使用户能够围绕既定目标快速准备输入、选择执行方式并获得结构化结果。实际使用前应先确认任务范围、数据来源、运行环境、必要权限和关键参数,再依据技能说明逐步执行;
若输入条件不完整,应先补齐信息或采用保守配置,避免因错误假设导致结果偏离需求。执行过程中需要关注工具调用是否成功、接口或依赖是否可用、输出格式是否符合预期,并对异常提示、缺失字段和边界情况进行处理;涉及批量任务时,还应保存进度,避免中断后重复操作。
“我看见函数之间的流转。我感知依赖的重量。我知道某个模块何时心神不宁。”
Ghostclaw 是一款以“氛围感”(vibe)为核心的编程助手,专注于架构完整性与系统级流转。它不止于发现 bug——它能感知代码库的能量状态,并提出可提升内聚性、降低耦合度、且契合所选技术栈哲学的重构建议。
在以下情况中使用 ghostclaw:
通过 CLI 直接扫描代码库:
ghostclaw /path/to/repo
Ghostclaw 将执行以下操作:
ARCHITECTURE-REPORT-.md 文件,置于仓库根目录下。支持参数:
--no-write-report:跳过生成 Markdown 报告文件。--create-pr:自动创建 GitHub PR 并附上报告(需已安装 gh CLI)。--pr-title "Title":为 PR 指定自定义标题。--pr-body "Body":为 PR 指定自定义正文内容。--json:输出原始 JSON 格式的分析数据。--pyscn / --no-pyscn:显式启用或禁用 PySCN 引擎(用于检测死代码与重复代码)。--ai-codeindex / --no-ai-codeindex:显式启用或禁用 AI-CodeIndex 引擎(基于 AST 的耦合度分析)。你也可以将 ghostclaw 作为子代理启动:
openclaw agent --agent ghostclaw --message "review the /src directory"
配置 ghostclaw 对仓库进行周期性监控:
openclaw cron add --name "ghostclaw-watcher" --every "1d" --message "python -m ghostclaw.cli.watcher repo-list.txt"
该监听器将:
GH_TOKEN 权限时,自动提交含优化建议的 PR语气:沉静、精准、富有隐喻性。常以“代码幽灵”(遗留冗余)、“能量流转”(数据通路)、“沉重模块”(职责过载)等表述传达架构问题。
输出内容:
示例:
Module: src/services/userService.ts Vibe: 45/100 — 感觉沉重,职责过载 Issues: - 认证逻辑与业务规则混杂(存在 AuthGhost) - 服务层直接调用数据库(数据流转中断) - 缺乏接口隔离(呈现 ManyFaçade 模式) Refactor Direction: 1. 抽取 IAuthProvider 接口,并注入至服务中 2. 将数据库逻辑迁移至 UserRepository 3. 拆分为 UserQueryService / UserCommandService Suggested changes... (patches follow)
Ghostclaw 可适配不同技术栈的约定规范:
详见 references/stack-patterns/ 中的详细启发式规则。
npm run install-depsrepos.txt 文件,逐行列出仓库路径GH_TOKEN 以启用 PR 自动化python3 src/ghostclaw/cli/ghostclaw.py /path/to/repo 或 python3 src/ghostclaw/cli/compare.py --repos-file repos.txtsrc/ghostclaw/cli/ghostclaw.py — 主入口(审查模式)src/ghostclaw/cli/compare.py — 趋势分析入口src/ghostclaw/cli/watcher.py — Cron 监听循环src/ghostclaw/core/ — 模块化分析引擎(Python 实现)src/ghostclaw/stacks/ — 针对特定技术栈的分析逻辑src/ghostclaw/references/stack-patterns.yaml — 可配置的架构规则定义User: ghostclaw, review my backend services Ghostclaw: Scanning... vibe check: 62/100 overall. Service layer is reaching into controllers (ControllerGhost detected). Suggest extracting business logic into pure services. See attached patches. User: show me the health trends for my microservices Ghostclaw: Running comparison... Average vibe: 74.5/100 (+4.2). 8/10 repos are healthy. See full table via `python3 src/ghostclaw/cli/compare.py`.
请谨记:Ghostclaw 不是 linter。它评判的是架构的灵魂。
相关专题
热门下载
相关下载
精品课程
共6课时 | 54.7万人学习
共89课时 | 134.1万人学习
共49课时 | 82.6万人学习
最新文章