跳转到内容

cnb-rs info repo

cnb-rs info repo [--json]

显示当前仓库元数据(卡片视图)。聚焦点:「我和这个仓库的关系」—— stared / pinned / my access role。

输出分区

IDENTITY:path / id / description

META(扩展版):

  • VisibilityPublic / Private / Secret(友好名而非 Debug 派生的 VisibilityPublic
  • StatusActive(绿)/ Archived(红加粗)/ Forking(黄),由 RepoStatus enum 映射
  • License — SPDX 许可证短名
  • Language — 仓库主语言
  • Default Branch — 仓库默认分支名(来自 GET /{repo}/-/git/head
  • Current Branch — 本地 git HEAD 所在分支(来自 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 reporepo view
风格4 分区卡片 + 颜色 + 「我的关系」强调git-style 完整详情表格
字段精选 ~15 字段,分 4 分区完整字段 + 时间戳 + 链接
适用快速判断「我能做什么 / 它有多火」仓库详情查阅 / 复制 metadata

并行调用 2 个:

  • ser`(仓库元数据)
  • GET /{repo}/-/git/headHeadRef(默认分支;失败时 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'

另请参阅

Released under the MIT License.