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/inspect.py
View on GitHub# -*- coding: utf-8 -*-
"""inspect:安装前预检(只读)。"""
from __future__ import annotations
from .. import config
from ..errors import E_ALREADY, E_CONFLICT, E_INVALID_SPEC, E_NOT_FOUND, E_NOT_SKILL
from ..registry import find_skill_conflicts, load
from ..remote import classify_net_error, parse_repo, repo_info, repo_skill_index
from ..util import emit
def cmd_inspect(args):
"""安装前预检(仿 DSH 的 inspect(spec)):先弄清楚这个地址到底指向什么,再决定装不装。"""
emit("starting", "解析仓库地址", percent=8)
try:
repo = parse_repo(args.repo)
except ValueError as e:
emit("failed", "地址无法解析", percent=100, code=E_INVALID_SPEC,
detail=str(e), hint="应为 owner/repo 或 https://github.com/owner/repo")
return
name = repo.split("/")[1]
data = load()
dup = [p for p in data["projects"] if str(p.get("repo", "")).lower() == repo.lower()]
if dup and not args.force:
emit("failed", "已经安装过了", percent=100, code=E_ALREADY,
detail="%s(本地 %s)" % (repo, dup[0].get("sha_short", "-")),
hint="要覆盖重装请用 update,或加 --force")
return
emit("checking", "连接仓库 · %s" % repo, percent=32)
ttl = 0 if getattr(args, "fresh", False) else config.CACHE_TTL
try:
info = repo_info(repo, ttl=ttl)
except Exception as e:
code, hint = classify_net_error(e)
emit("failed", "仓库不可达或不存在" if code == E_NOT_FOUND else "连不上仓库",
percent=100, code=code, detail=str(e)[:160], hint=hint)
return
emit("checking", "检查包结构", percent=64)
index = repo_skill_index(repo, info["branch"])
unknown = index is None
index = index or {"skills": {}, "tree_size": 0, "inspection_mode": "unavailable",
"complete": False}
found = index["skills"]
names = sorted(found)
# 冲突检测:会覆盖掉别的项目已装的 skill(DSH 只管 npm 包,没有这层)
# 与 install 用的是同一个 find_skill_conflicts,保证预检结论 == 安装行为
conflicts = find_skill_conflicts(repo, names, data)
payload = {
"repo": repo,
"name": name,
"branch": info["branch"],
"sha": info["sha"],
"sha_short": info["sha_short"],
"stars": info["stars"],
"desc": info["desc"],
"last_msg": info["msg"],
"pushed_at": info["pushed_at"],
"skill_names": names,
"skill_paths": [{"name": n, "path": found[n]} for n in names],
"skill_count": len(names),
"tree_size": index.get("tree_size", 0),
"inspection_mode": index.get("inspection_mode", "unavailable"),
"inspection_complete": bool(index.get("complete", False)),
"conflicts": conflicts,
"already": bool(dup),
}
if not names:
uncertain = unknown or not index.get("complete", False)
emit("done", "预检完成:%s" % ("未能完整确认包结构" if uncertain else "该仓库不含标准 skill 包"),
percent=100, ok=False, code=None if uncertain else E_NOT_SKILL,
detail=("目录索引不完整或不可用,安装时会用 ZIP 索引最终确认" if uncertain
else "未发现 */skills/<name>/SKILL.md"),
hint="仍可只安装源码备用", data=payload)
return
label = "预检完成:%s%d 个 skill" % (
"至少 " if not index.get("complete", False) else "", len(names))
if conflicts:
label += "(有 %d 个会覆盖已装的)" % len(conflicts)
emit("done", label, percent=100, ok=True,
code=E_CONFLICT if conflicts else None,
detail=("将覆盖:%s" % "、".join(c["skill"] for c in conflicts[:6])) if conflicts else None,
data=payload)
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 471k | Updated | Claude CodeCodex | Verified | Install |
| 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: 322k | Updated | Claude CodeCodex | Verified | Install |
| dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| 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 available | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |