cnb-rs info repo
cnb-rs info repo [--json]显示当前仓库元数据(卡片视图)。聚焦点:「我和这个仓库的关系」—— stared / pinned / my access role。
输出分区
IDENTITY:path / id / description
META(扩展版):
Visibility—Public/Private/Secret(友好名而非 Debug 派生的VisibilityPublic)Status—Active(绿)/Archived(红加粗)/Forking(黄),由RepoStatusenum 映射License— SPDX 许可证短名Language— 仓库主语言Default Branch— 仓库默认分支名(来自GET /{repo}/-/git/head)Current Branch— 本地 gitHEAD所在分支(来自git rev-parse --abbrev-ref HEAD)Sync— 本地分支相对origin/<default>的同步状态:✓ up to date(绿)/↑ N ahead(黄,需 push)/↓ N behind(黄,需 pull)/↑ A ↓ B diverged(红加粗)。无 origin remote 或未 fetch 时不显示该行Last Pushed— 最后一次 push 时间(last_updated_at,已格式化为YYYY-MM-DD HH:MM:SS)
ENGAGEMENT:stars / forks / open-issues / open-prs(数字 cyan 加粗)
MY RELATION:
Stared— 我是否 star 了本仓库(yes=绿 / no=灰)Pinned— 我是否 pin 了本仓库My Access— 我的角色(Anonymous / Reporter / Developer / Master / Owner)
与 repo view 的区别
| 维度 | info repo | repo view |
|---|---|---|
| 风格 | 4 分区卡片 + 颜色 + 「我的关系」强调 | git-style 完整详情表格 |
| 字段 | 精选 ~15 字段,分 4 分区 | 完整字段 + 时间戳 + 链接 |
| 适用 | 快速判断「我能做什么 / 它有多火」 | 仓库详情查阅 / 复制 metadata |
并行调用 2 个:
- ser`(仓库元数据)
GET /{repo}/-/git/head→HeadRef(默认分支;失败时 Default Branch 显示-)
本地额外调用:
git rev-pare --abbrv-ef HEAD→ 当前分支名(非 git 仓库时 Current Branch 显示 `-)
选项
--json:直接输出Repos4User完整 JSON
API
GET /{repo} → Repos4User
示例
bash
# 默认输出(自动从 git remote 解析仓库)
cnb-rs info repo
# 指定仓库
cnb-rs --repo wwvo/cnb-rs/cnb-rs info repo
# JSON 模式
cnb-rs info repo --json | jq '.visibility_level'另请参阅
- cnb-rs info — info 子组首页
- cnb-rs repo view — 完整仓库详情