✨ feat: add repo preflight onboarding command#32
✨ feat: add repo preflight onboarding command#32ShigureNyako wants to merge 7 commits intoShigureLab:mainfrom
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 995c6b8b3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
Pull request overview
Adds a new gh-llm repo preflight (alias: repo onboarding) command to summarize repository contribution/onboarding signals (metadata, onboarding files, branch protection) and print inferred next-step commands.
Changes:
- Introduce repo preflight data models and GitHub API resolution (repo view, tree scan, branch protection GraphQL).
- Add
repo preflight/onboardingCLI command and renderer. - Document the new command in
README.mdand add CLI test coverage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_cli.py | Extends GhResponder stubs and adds a CLI test for repo preflight output. |
| src/gh_llm/models.py | Adds RepoPreflight-related dataclasses for repo onboarding signals. |
| src/gh_llm/github_api.py | Implements repo preflight resolution, document detection, and branch protection rule selection. |
| src/gh_llm/commands/repo.py | Adds the new repo preflight/onboarding command and output rendering. |
| src/gh_llm/cli.py | Registers the new repo command group with the top-level CLI parser. |
| README.md | Documents usage and expected output of the new command. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ShigureNyako
left a comment
There was a problem hiding this comment.
结论:REQUEST_CHANGES。
说明:受当前 GitHub 账号限制影响,我无法对自己的 PR 提交 REQUEST_CHANGES 状态,所以这里用 COMMENT 形式提交正式 review;但从评审结论上看,这个 PR 还需要先改再合。
我本地复跑了 uv run ruff check、uv run pyright、uv run pytest -q,并实际运行了 uv run gh-llm repo preflight --repo PaddlePaddle/Paddle 与 uv run gh-llm repo preflight --repo AutoMQ/automq。有两个阻塞问题:
src/gh_llm/github_api.py:879-933里的 branch protection 解析对真实只读贡献场景会给出错误结果。当前实现完全依赖branchProtectionRulesGraphQL 查询,但我本地实测:uv run gh-llm repo preflight --repo PaddlePaddle/Paddle输出No branch protection rule matched develop.uv run gh-llm repo preflight --repo AutoMQ/automq输出No branch protection rule matched main.
但对应的 REST 分支接口gh api repos/PaddlePaddle/Paddle/branches/develop/gh api repos/AutoMQ/automq/branches/main都返回protected: true,并带有 required status checks。也就是说,这个 PR 在最核心的 onboarding 信号上会出现系统性 false negative,后面的“next commands”推导也会一起失真。
src/gh_llm/github_api.py:2887-2888声称匹配CONTRIBUTING*,实际只接受CONTRIBUTING或CONTRIBUTING.<ext>。我本地实测uv run gh-llm repo preflight --repo AutoMQ/automq时,输出里CONTRIBUTING是(not found);但gh api repos/AutoMQ/automq/contents/CONTRIBUTING_GUIDE.md可以正常返回。这个行为和 PR 描述 / README 中承诺的CONTRIBUTING*不一致,也会漏掉真实仓库里常见的贡献指引文件。
测试覆盖也还不够:当前新增测试只覆盖了一个完全理想化的 happy path(CONTRIBUTING.md + GraphQL 直接返回 branchProtectionRules 节点),没有覆盖上面这两类真实失败场景。另,当前 CI 里的 fmt 检查也还是红的。
Co-authored-by: SigureMo <38436475+SigureMo@users.noreply.github.com>
|
已跟进本轮 review,并逐条回复 / resolve 了相关 thread。 本轮新增修复点:
验证:
|
ShigureNyako
left a comment
There was a problem hiding this comment.
结论:REQUEST_CHANGES。
说明:受当前 GitHub 账号限制影响,我无法对自己的 PR 提交 REQUEST_CHANGES 状态,所以这里继续用 COMMENT 形式提交正式 review;但从评审结论上看,这个 PR 还需要先改再合。
我独立复跑了:
uv run pytest -quv run ruff checkuv run pyrightuv run gh-llm repo preflight --repo PaddlePaddle/Paddleuv run gh-llm repo preflight --repo AutoMQ/automquv run gh-llm repo preflight --repo ShigureNyako/gh-llm
前两个真实上游仓库场景这轮已经基本修正到位:branch protection 的 REST 回退、CONTRIBUTING* 匹配、CLI surface 收敛,以及对应测试都对上了。
但 fork 场景还有一个阻塞问题:当前 src/gh_llm/github_api.py 里把 parent_repo 读成了 parent.nameWithOwner,而 gh repo view --json parent 实际返回的是 parent.owner.login + parent.name。我本地实测 uv run gh-llm repo preflight --repo ShigureNyako/gh-llm 时,输出里只有 is_fork: true,没有 parent_repo / Parent repo,后续 next commands 还会生成 gh pr create --repo ShigureNyako/gh-llm --base main。这会把 fork 贡献链路导向错误目标仓库。
建议先把 fork 的 upstream 识别 / 输出 / 测试链路补齐,再合这个 PR。
Summary
Fixes #15.
This PR adds
gh-llm repo preflight --repo OWNER/REPOto consolidate repo-level contribution setup checks before starting work.Motivation
Before contributing to an unfamiliar repo, users still need to manually check the default branch, whether a fork is required, onboarding docs, PR template,
CODEOWNERS, and default-branch protection expectations.Solution
repo preflightcommand group and renderergh repo view, use recursive tree scan plus common-path contents fallback for onboarding files, and read default-branch protection via REST with paginated GraphQL enrichment for rule detailsCONTRIBUTING*,AGENTS.md, PR templates, andCODEOWNERSskills/github-conversation/SKILL.mdand cover it with CLI testsValidation
uv run pytest -quv run ruff checkuv run pyrightuv run gh-llm repo preflight --repo PaddlePaddle/Paddleuv run gh-llm repo preflight --repo AutoMQ/automqNotes
AGENTS.mdis included in the onboarding scan alongsideCONTRIBUTING*, PR templates, andCODEOWNERS.@SigureMo Please review this PR when you have time. Thanks!