Skip to content

zjs105910/workbuddy-market / bundled/github-project-manager/skills/github-project-manager

github-project-manager

Verified

管理从 GitHub 下载到本机的开源项目与技能包:列出、扫描发现、安装前预检、检查更新、一键更新、移除、回滚、数据完整性校验与环境诊断。带 O_EXCL 原子锁 + 心跳租约、事务级失败回滚、InstallPlan 状态收敛、单次遍历的磁盘预检、批量更新复用远程信息(消灭 N+1 请求)、ZIP 预扫描与压缩炸弹/设备名双重防护、skill 冲突阻断、内容指纹校验、硬链接与 rename 两种备份介质。触发方式:/ghpm、『GitHub 项目管理』『检查插件更新』『更新开源项目』『我装了哪些 GitHub 项目』『这个插件有新版吗』『卸载插件』『这个仓库能装吗』『ghpm doctor』『ghpm verify』『文件丢了/装坏了』。

scripts/ghpm/commands/verify.py

View on GitHub
# -*- coding: utf-8 -*-
"""verify:清单 ↔ 磁盘 ↔ 远端 的三方一致性检查(只读)。"""
from __future__ import annotations

import json

from .. import config
from ..registry import find_project, load
from ..remote import fetch_repo_infos
from ..util import emit
from ..verifier import verify_all

_ICON = {"ok": "✓", "warn": "!", "fail": "✗"}


def cmd_verify(args):
    """不写盘、不删文件。发现 FAIL 时返回非零退出码(由 cli 判断)。"""
    data = load()
    targets = data.get("projects", [])
    if getattr(args, "name", None):
        hit = find_project(data, args.name)
        if not hit:
            emit("failed", "未找到项目", percent=100, code="E_NOT_FOUND",
                 detail=args.name, hint="用 `ghpm list` 看看已登记的项目名")
            print("未找到项目:%s" % args.name)
            return 1
        targets = [hit]

    remote_infos = None
    if getattr(args, "remote", False) and targets:
        ttl = 0 if getattr(args, "fresh", False) else config.CACHE_TTL
        remote_infos, _errors = fetch_repo_infos(
            [p.get("repo") or p.get("name") for p in targets], ttl=ttl,
            progress=lambda d, t, r: emit(
                "checking", "核对远端 %d/%d · %s" % (d, t, r),
                percent=int(80 * d / max(1, t))))
        remote_infos = remote_infos or {}

    scoped = dict(data)
    scoped["projects"] = targets
    result = verify_all(scoped, remote_infos=remote_infos)

    if getattr(args, "json", False):
        print(json.dumps(result, ensure_ascii=False))
    else:
        _render(result, remote=bool(getattr(args, "remote", False)))

    summary = result["summary"]
    emit("done", "%d 个项目:%d 正常,%d 警告,%d 失败"
         % (result["checked"], summary["ok"], summary["warn"], summary["fail"]),
         percent=100, ok=result["ok"],
         hint=None if result["ok"] else "有项目数据不一致,逐项见 data.projects[].findings",
         data=result)
    return 0 if result["ok"] else 1


def _render(result: dict, remote: bool = False) -> None:
    print("GHPM Verify%s\n" % ("(含远端比对)" if remote else "(仅本地)"))
    if not result["projects"]:
        print("清单为空,没有可校验的项目。")
    for proj in result["projects"]:
        print("%s %s  [%s]" % (_ICON.get(proj["status"], "?"), proj["repo"],
                               proj["status"].upper()))
        for f in proj["findings"]:
            if f["level"] == "ok":
                continue                      # 正常项不刷屏,只看问题
            print("     %s %-20s %s" % (_ICON.get(f["level"], "?"), f["code"], f["message"]))
            if f.get("path"):
                print("       %s" % f["path"])
    if result["orphans"]:
        print("\n未被任何项目认领的 skill 目录(可能是手动放的,也可能是孤儿):")
        for o in result["orphans"]:
            print("  ? %s" % o)
    s = result["summary"]
    print("\n汇总:%d 正常,%d 警告,%d 失败" % (s["ok"], s["warn"], s["fail"]))
    if s["fail"]:
        print("有 FAIL 项:清单与磁盘已经不一致,建议 `ghpm remove` 后重装,"
              "或用 `ghpm rollback <备份目录>` 恢复。")
    else:
        print("清单与磁盘一致。")
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall