Release-notes workflow, anonymous magnets, and bilingual templates - #6
Conversation
审阅者指南引入一个带版本控制的双语变更日志系统(基于 Go 工具),并将其接入 CI/发布流程(包括仅文档变更的路由和平台冒烟门控),同时在仓库中增加本地 agent 技能,以及相关文档和元数据更新,以支持新的发布流程。 带审计的版本化发布说明的发布流程序列图sequenceDiagram
actor Actions as GitHubActions
participant validate as job_validate
participant release_notes_audit as job_release_notes_audit
participant publish as job_publish
participant Releasenotes as scripts_releasenotes
participant GitHub as GitHubAPI
participant GHCLI as gh_cli
Actions->>validate: run validate job
validate-->>Actions: set RELEASE_TAG
Actions->>release_notes_audit: run Audit release notes
release_notes_audit->>Releasenotes: go run ./scripts/releasenotes validate --version --dir
release_notes_audit->>Releasenotes: go run ./scripts/releasenotes audit --repo --from --to --require-classified
Releasenotes->>GitHub: requestJSON commits/pulls
GitHub-->>Releasenotes: auditReport
release_notes_audit->>Releasenotes: go run ./scripts/releasenotes validate --version --dir --audit
release_notes_audit-->>publish: job dependency release_notes_audit
Actions->>publish: run Publish GitHub Release
publish->>Releasenotes: go run ./scripts/releasenotes render --version --dir --output
publish->>GHCLI: gh release create --notes-file release/release-notes.md
GHCLI->>GitHub: create draft Release with rendered bilingual body
CI 与平台冒烟(仅文档变更路由)的序列图sequenceDiagram
actor Actions as GitHubActions
participant classify_changes as job_classify_changes
participant changescope as cmd_changescope
participant quality as job_quality
participant packaged_smoke as job_packaged_binary_smoke
participant smoke_gate as job_platform_smoke_gate
Actions->>classify_changes: run Classify change scope
classify_changes->>changescope: go run ./scripts/changescope --base --head --github-output
changescope-->>classify_changes: docs_only=true|false
Actions->>quality: run quality job (needs classify_changes)
quality->>quality: releasenotes pr-validate (pull_request only)
alt docs_only == 'true'
quality->>quality: sh scripts/test-documentation.sh
else docs_only != 'true'
quality->>quality: gofmt / go test / go test -race / go vet
quality->>quality: sh scripts/build.sh
quality->>quality: sh scripts/test-package-release.sh
quality->>quality: sh scripts/test-workflows.sh
quality->>quality: pre-commit checks
end
Actions->>packaged_smoke: run packaged_binary_smoke (needs classify_changes)
alt docs_only == 'true'
packaged_smoke-->>Actions: job skipped
else docs_only != 'true'
packaged_smoke->>packaged_smoke: build, download, smoke javdb-cli
end
Actions->>smoke_gate: run platform_smoke_gate (needs classify_changes, packaged_smoke)
smoke_gate->>smoke_gate: check DOCS_ONLY and MATRIX_RESULT
alt DOCS_ONLY == true
smoke_gate->>smoke_gate: require MATRIX_RESULT == skipped
else DOCS_ONLY != true
smoke_gate->>smoke_gate: require MATRIX_RESULT == success
end
文件级变更
提示与命令与 Sourcery 交互
自定义你的使用体验访问你的 控制面板 以:
获取帮助Original review guide in EnglishReviewer's GuideIntroduces a versioned bilingual changelog system with Go-based tooling, wires it into CI/release workflows (including docs-only routing and a platform smoke gate), and adds repo-local agent skills plus documentation/metadata updates to support the new release process. Sequence diagram for release workflow with audited versioned release notessequenceDiagram
actor Actions as GitHubActions
participant validate as job_validate
participant release_notes_audit as job_release_notes_audit
participant publish as job_publish
participant Releasenotes as scripts_releasenotes
participant GitHub as GitHubAPI
participant GHCLI as gh_cli
Actions->>validate: run validate job
validate-->>Actions: set RELEASE_TAG
Actions->>release_notes_audit: run Audit release notes
release_notes_audit->>Releasenotes: go run ./scripts/releasenotes validate --version --dir
release_notes_audit->>Releasenotes: go run ./scripts/releasenotes audit --repo --from --to --require-classified
Releasenotes->>GitHub: requestJSON commits/pulls
GitHub-->>Releasenotes: auditReport
release_notes_audit->>Releasenotes: go run ./scripts/releasenotes validate --version --dir --audit
release_notes_audit-->>publish: job dependency release_notes_audit
Actions->>publish: run Publish GitHub Release
publish->>Releasenotes: go run ./scripts/releasenotes render --version --dir --output
publish->>GHCLI: gh release create --notes-file release/release-notes.md
GHCLI->>GitHub: create draft Release with rendered bilingual body
Sequence diagram for CI and platform smoke docs-only routingsequenceDiagram
actor Actions as GitHubActions
participant classify_changes as job_classify_changes
participant changescope as cmd_changescope
participant quality as job_quality
participant packaged_smoke as job_packaged_binary_smoke
participant smoke_gate as job_platform_smoke_gate
Actions->>classify_changes: run Classify change scope
classify_changes->>changescope: go run ./scripts/changescope --base --head --github-output
changescope-->>classify_changes: docs_only=true|false
Actions->>quality: run quality job (needs classify_changes)
quality->>quality: releasenotes pr-validate (pull_request only)
alt docs_only == 'true'
quality->>quality: sh scripts/test-documentation.sh
else docs_only != 'true'
quality->>quality: gofmt / go test / go test -race / go vet
quality->>quality: sh scripts/build.sh
quality->>quality: sh scripts/test-package-release.sh
quality->>quality: sh scripts/test-workflows.sh
quality->>quality: pre-commit checks
end
Actions->>packaged_smoke: run packaged_binary_smoke (needs classify_changes)
alt docs_only == 'true'
packaged_smoke-->>Actions: job skipped
else docs_only != 'true'
packaged_smoke->>packaged_smoke: build, download, smoke javdb-cli
end
Actions->>smoke_gate: run platform_smoke_gate (needs classify_changes, packaged_smoke)
smoke_gate->>smoke_gate: check DOCS_ONLY and MATRIX_RESULT
alt DOCS_ONLY == true
smoke_gate->>smoke_gate: require MATRIX_RESULT == skipped
else DOCS_ONLY != true
smoke_gate->>smoke_gate: require MATRIX_RESULT == success
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Warning Review limit reached
Next review available in: 52 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthrough本次变更新增版本化双语发布说明系统、release notes CLI、docs-only CI 分类、发布审计门禁、仓库流程文档,并使磁力相关命令支持匿名请求和认证失败回退。 Changes版本化发布说明系统
CI 门禁与仓库流程
匿名磁力请求
Estimated code review effort: 5 (Critical) | ~120 minutes Sequence Diagram(s)sequenceDiagram
participant PullRequest
participant CI
participant ReleaseNotesCLI
participant Changelog
participant GitHubRelease
PullRequest->>CI: submit release-note declaration
CI->>ReleaseNotesCLI: validate declaration and change scope
ReleaseNotesCLI->>Changelog: audit and prepare bilingual notes
ReleaseNotesCLI->>GitHubRelease: render and publish release body
GitHubRelease-->>ReleaseNotesCLI: return release body for verification
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Hey - 我在这里给出了一些总体反馈:
scripts/releasenotes命令已经变得相当庞大且承担多种职责;可以考虑将其功能拆分到更小的内部包或子命令文件中(例如 audit/prepare/render/sync-history),以便后续维护更轻松,也更容易理解和控制其副作用。scripts/changescope中的仅文档路径白名单目前是硬编码的;或许值得将这组路径(以及其设计理由)集中放在单一的配置或共享的辅助工具中,这样未来新增文档路径时就不需要在多个位置更新,也能降低遗漏新文档位置的风险。
给 AI Agent 的提示
Please address the comments from this code review:
## Overall Comments
- The `scripts/releasenotes` command has grown quite large and multi-purpose; consider splitting the functionality into smaller internal packages or subcommands files (e.g., audit/prepare/render/sync-history) to make future maintenance and reasoning about side effects easier.
- The docs-only path allowlist in `scripts/changescope` is currently hard-coded; it may be worth centralizing this set (and its rationale) in a single config or shared helper so future additions to documentation paths don’t require updating multiple places and reduce the risk of missing a new docs location.帮我变得更有用!请在每条评论上点击 👍 或 👎,我会根据这些反馈改进为你提供的评审。
Original comment in English
Hey - I've left some high level feedback:
- The
scripts/releasenotescommand has grown quite large and multi-purpose; consider splitting the functionality into smaller internal packages or subcommands files (e.g., audit/prepare/render/sync-history) to make future maintenance and reasoning about side effects easier. - The docs-only path allowlist in
scripts/changescopeis currently hard-coded; it may be worth centralizing this set (and its rationale) in a single config or shared helper so future additions to documentation paths don’t require updating multiple places and reduce the risk of missing a new docs location.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `scripts/releasenotes` command has grown quite large and multi-purpose; consider splitting the functionality into smaller internal packages or subcommands files (e.g., audit/prepare/render/sync-history) to make future maintenance and reasoning about side effects easier.
- The docs-only path allowlist in `scripts/changescope` is currently hard-coded; it may be worth centralizing this set (and its rationale) in a single config or shared helper so future additions to documentation paths don’t require updating multiple places and reduce the risk of missing a new docs location.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
There was a problem hiding this comment.
Actionable comments posted: 11
🧹 Nitpick comments (8)
scripts/changescope/main.go (1)
42-46: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value建议用
exec.CommandContext并对 git 调用设置超时。golangci-lint
noctx已提示;CI 中挂起的git diff会阻塞整条流水线。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/changescope/main.go` around lines 42 - 46, Update the git diff invocation in the surrounding changescope flow to use exec.CommandContext with a bounded timeout context, ensuring the git process is canceled when the deadline expires. Preserve the existing arguments, output handling, and wrapped error reporting around command.Output.Source: Linters/SAST tools
scripts/test-documentation.sh (1)
27-32: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value这 6 行与
scripts/test-releasenotes.sh第 7-12 行完全重复。可考虑只在
scripts/test-releasenotes.sh中保留 changelog 入口检查,由文档脚本调用它,避免两处规则漂移。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/test-documentation.sh` around lines 27 - 32, Remove the duplicated changelog entry and file-presence checks from the documentation test, and have scripts/test-documentation.sh invoke the existing scripts/test-releasenotes.sh validation instead. Keep the changelog validation centralized in test-releasenotes.sh so the two scripts cannot drift.scripts/releasenotes/main.go (3)
730-737: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
None分支与 else 分支完全相同。两个分支都只是
source.Note = ¬e,要么删除多余分支,要么补上原本打算对None做的处理。♻️ 建议简化
note, parseErr := parseReleaseNoteDeclaration(pull.Body) if parseErr != nil { source.Issue = parseErr.Error() - } else if note.Category == "None" { - source.Note = ¬e } else { source.Note = ¬e }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/main.go` around lines 730 - 737, 简化处理 parseReleaseNoteDeclaration 结果的条件分支:删除对 note.Category == "None" 的冗余判断,保留一次 source.Note = ¬e 的赋值,同时维持 parseErr 非空时写入 source.Issue 的现有行为。
976-1005: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick wingit 调用未绑定 context。
collectAudit已持有ctx,但gitRevisionList/gitCommitDetail用exec.Command,无法取消或超时(golangci-lintnoctx也已提示)。建议改为exec.CommandContext并透传ctx。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/main.go` around lines 976 - 1005, Update gitRevisionList and gitCommitDetail to accept the existing context.Context and invoke git through exec.CommandContext instead of exec.Command. Pass collectAudit’s ctx through every call while preserving the current revision and commit metadata behavior and error messages.Source: Linters/SAST tools
507-510: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
[:7]魔法切片过于脆弱。排除
New Contributors依赖两个数组长度恰好为 8。新增分类时会静默错位(中英映射依赖同一下标)。建议显式定义正文分类切片或用 map 建立中英映射。Also applies to: 545-552
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/main.go` around lines 507 - 510, 更新 englishSectionOrder 和 chineseSectionOrder 的正文分类选择逻辑,移除依赖固定长度 7 的魔法切片;显式定义不包含 New Contributors 的分类集合,或通过中英分类映射按名称选择,确保新增分类不会导致中英文顺序错位,并同步调整相关的 order 使用处。.github/workflows/ci.yml (1)
19-51: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoff
classify_changes与 platform-smoke.yml 中的实现完全重复。两处 job(含 checkout/setup-go/SHA 计算/workflow_dispatch 兜底)逐行一致,后续修改容易漂移。可抽成可复用 workflow(
workflow_call)或复合 action。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In @.github/workflows/ci.yml around lines 19 - 51, Extract the duplicated change-scope detection flow from the classify_changes job and platform-smoke.yml into a reusable workflow_call workflow or composite action. Preserve the existing checkout, setup-go, SHA selection, workflow_dispatch fallback, and changescope invocation behavior, then update both callers to reuse the shared implementation and expose the docs_only result.scripts/test-releasenotes.sh (1)
14-16: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win硬编码版本列表会导致门禁静默退化。
新版本发布时若忘记在此追加版本号,该版本的双语说明与 plan 就完全不被校验。建议直接遍历
changelog/plans/v*.json推导版本。♻️ 建议改法
-for version in 0.1.0 0.1.1 0.2.0; do - plan="$repo_root/changelog/plans/v$version.json" - test -s "$plan" +for plan in "$repo_root"/changelog/plans/v*.json; do + test -s "$plan" + version=$(basename "$plan" .json) + version=${version#v}🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/test-releasenotes.sh` around lines 14 - 16, 将版本校验循环从硬编码的 0.1.0、0.1.1、0.2.0 改为遍历 changelog/plans 下所有匹配 v*.json 的 plan 文件,并从文件名直接使用对应路径执行 test -s,确保新增版本会自动纳入校验。scripts/releasenotes/main_test.go (1)
189-215: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winhttptest handler 内不应用
t.Fatalf终止流程。
t.Fatalf只能在测试 goroutine 调用;在http.HandlerFuncgoroutine 中调用会跳过响应写入并终止该协程,导致测试行为不确定。这些 handler 分支建议收集失败信息并在测试 goroutine 调用t.Fatalf,或改为t.Errorf+ 返回错误状态码。Also applies to: 376-392, 419-435
[maintainability和code_quality]
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/main_test.go` around lines 189 - 215, Update the httptest handlers in the test cases around the visible server handler and the analogous sections noted by the review so they do not call t.Fatalf from the handler goroutine. Replace unexpected-path or query-mismatch fatal assertions with handler-safe error reporting and an error HTTP response, or collect the failure for the main test goroutine to fail after the request completes; preserve the existing successful response behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/PULL_REQUEST_TEMPLATE.md:
- Around line 18-23: 默认 PR 模板中的占位值会通过
parseReleaseNoteDeclaration,导致未填写内容进入发布说明。更新 release-note 模板使用必然非法的哨兵值,或修改
parseReleaseNoteDeclaration 显式拒绝这些占位文本,并为未替换模板的校验失败补充测试。
In @.github/workflows/ci.yml:
- Around line 72-75: 更新 CI 中 docs-only 分支的校验流程,使 `scripts/test-documentation.sh`
之外也执行 `scripts/test-releasenotes.sh`。确保纯 `changelog/` 变更仍经过双语发布说明与 plan
契约校验,并保留现有非 docs-only 流程的行为,避免依赖被 `docs_only != 'true'` 排除的步骤。
In @.github/workflows/release.yml:
- Around line 86-89: Remove unconditional Go caching from the release workflow’s
setup-go steps, especially the publish job and its contents: write permission.
Update the actions/setup-go configuration in release_notes_audit, build, and
publish to disable cache unless a strictly controlled read-only or
restricted-write strategy is already available.
- Around line 100-111: Replace the Python assert checks in the release
validation script around the plan version, previous_tag, and compare_url checks
with explicit if conditions that report an error and terminate nonzero on
mismatch. Preserve the existing validation rules and previous-tag output
behavior, ensuring they cannot be bypassed when Python runs with optimization
enabled.
In `@changelog/plans/v0.2.0.json`:
- Around line 5-25: Update the v0.2.0 manifest entries to match the schema
consumed by scripts/releasenotes: replace each sources array with a single
source value, split entries that have multiple sources into separate entries,
and add the required unique breaking and source-type fields to every entry.
Preserve the existing release-note content while ensuring prepare/validate can
parse all entries.
In `@docs/maintainers/development.md`:
- Around line 113-116: 更新开发文档中关于 GH_TOKEN 权限的说明:将本机只读的 audit 和 dry-run
明确为使用最小读取权限,保留 audit 所需的仓库与 PR 读取权限;仅为 sync-history --apply、修改 GitHub
description、创建 tag 和发布 Release 等外部写操作要求写权限,并保持 GitHub Actions 审计使用受限的
github.token。
In `@scripts/changescope/main.go`:
- Around line 98-109: Update writeOutput to explicitly check and return the
error from file.Close instead of relying on deferred cleanup that discards it.
Preserve the existing early return, OpenFile error handling, and Fprintf result
while ensuring close failures are propagated to the caller.
In `@scripts/releasenotes/main.go`:
- Around line 239-243: Update the githubClient initialization used by the
release-note audit/sync-history flows to inject an HTTP client with an explicit
finite timeout instead of http.DefaultClient. Apply the same change to the
corresponding second initialization, reusing the project’s existing timeout
configuration or defining one consistent timeout for both clients.
- Around line 309-315: 在 prepare 流程中补充 plan 元数据校验:让 readPreparePlan/preparePlan
解析 version、previous_tag 和 compare_url,并在 validatePreparePlan 或其调用处将其与 config 中的
--version、--previous 及预期 compare URL
比对;任一不匹配都应返回错误,避免继续生成错误版本的说明,同时保持现有读取和校验流程不变。
- Around line 1012-1027: Update writeJSON to check and return any error from
closing the opened file, removing the unchecked defer file.Close() while
preserving stdout behavior and returning encoder errors as before.
- Around line 796-812: 更新 firstMergedPullRequest,不再依赖 /search/issues 的
sort=created asc;分页获取该作者全部已合并 PR,按 merged_at 时间比较并返回实际最早合并的
PR。同步调整覆盖查询参数的测试断言及相关文档,确保描述和实现都以合并时间判定首次贡献。
---
Nitpick comments:
In @.github/workflows/ci.yml:
- Around line 19-51: Extract the duplicated change-scope detection flow from the
classify_changes job and platform-smoke.yml into a reusable workflow_call
workflow or composite action. Preserve the existing checkout, setup-go, SHA
selection, workflow_dispatch fallback, and changescope invocation behavior, then
update both callers to reuse the shared implementation and expose the docs_only
result.
In `@scripts/changescope/main.go`:
- Around line 42-46: Update the git diff invocation in the surrounding
changescope flow to use exec.CommandContext with a bounded timeout context,
ensuring the git process is canceled when the deadline expires. Preserve the
existing arguments, output handling, and wrapped error reporting around
command.Output.
In `@scripts/releasenotes/main_test.go`:
- Around line 189-215: Update the httptest handlers in the test cases around the
visible server handler and the analogous sections noted by the review so they do
not call t.Fatalf from the handler goroutine. Replace unexpected-path or
query-mismatch fatal assertions with handler-safe error reporting and an error
HTTP response, or collect the failure for the main test goroutine to fail after
the request completes; preserve the existing successful response behavior.
In `@scripts/releasenotes/main.go`:
- Around line 730-737: 简化处理 parseReleaseNoteDeclaration 结果的条件分支:删除对
note.Category == "None" 的冗余判断,保留一次 source.Note = ¬e 的赋值,同时维持 parseErr 非空时写入
source.Issue 的现有行为。
- Around line 976-1005: Update gitRevisionList and gitCommitDetail to accept the
existing context.Context and invoke git through exec.CommandContext instead of
exec.Command. Pass collectAudit’s ctx through every call while preserving the
current revision and commit metadata behavior and error messages.
- Around line 507-510: 更新 englishSectionOrder 和 chineseSectionOrder
的正文分类选择逻辑,移除依赖固定长度 7 的魔法切片;显式定义不包含 New Contributors
的分类集合,或通过中英分类映射按名称选择,确保新增分类不会导致中英文顺序错位,并同步调整相关的 order 使用处。
In `@scripts/test-documentation.sh`:
- Around line 27-32: Remove the duplicated changelog entry and file-presence
checks from the documentation test, and have scripts/test-documentation.sh
invoke the existing scripts/test-releasenotes.sh validation instead. Keep the
changelog validation centralized in test-releasenotes.sh so the two scripts
cannot drift.
In `@scripts/test-releasenotes.sh`:
- Around line 14-16: 将版本校验循环从硬编码的 0.1.0、0.1.1、0.2.0 改为遍历 changelog/plans 下所有匹配
v*.json 的 plan 文件,并从文件名直接使用对应路径执行 test -s,确保新增版本会自动纳入校验。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 89ec7ac1-b201-4977-9665-84fa052abace
📒 Files selected for processing (41)
.agents/skills/javdb-cli-commit-message/SKILL.md.agents/skills/javdb-cli-docs/SKILL.md.agents/skills/javdb-cli-release-notes/SKILL.md.agents/skills/javdb-cli-review/SKILL.md.github/PULL_REQUEST_TEMPLATE.md.github/workflows/ci.yml.github/workflows/platform-smoke.yml.github/workflows/release.yml.pre-commit-config.yamlAGENTS.mdCHANGELOG.mdCHANGELOG.zh-CN.mdCONTRIBUTING.mdCONTRIBUTING.zh-CN.mdREADME.mdREADME.zh-CN.mdchangelog/README.mdchangelog/README.zh-CN.mdchangelog/plans/v0.1.0.jsonchangelog/plans/v0.1.1.jsonchangelog/plans/v0.2.0.jsonchangelog/unreleased/en.mdchangelog/unreleased/zh-CN.mdchangelog/v0.1.0/en.mdchangelog/v0.1.0/zh-CN.mdchangelog/v0.1.1/en.mdchangelog/v0.1.1/zh-CN.mdchangelog/v0.2.0/en.mdchangelog/v0.2.0/zh-CN.mddocs/maintainers/agents/documentation-guidelines.mddocs/maintainers/agents/index.mddocs/maintainers/development.mddocs/superpowers/specs/2026-07-30-release-notes-system-design.mdscripts/changescope/main.goscripts/changescope/main_test.goscripts/internal/releasenotesrender/render.goscripts/releasenotes/main.goscripts/releasenotes/main_test.goscripts/test-documentation.shscripts/test-releasenotes.shscripts/test-workflows.sh
| "entries": [ | ||
| { | ||
| "category": "Added", | ||
| "english": "Add verified self-update support that preserves the Homebrew, go install, or Release-archive installation channel.", | ||
| "zh_cn": "新增经校验的自更新能力,并保留 Homebrew、go install 或 Release 压缩包的安装渠道。", | ||
| "sources": ["https://github.com/FlanChanXwO/javdb-cli/commit/a51115d"] | ||
| }, | ||
| { | ||
| "category": "Fixed", | ||
| "english": "Preserve LF source bytes on Windows release runners and pass the validated version into production builds.", | ||
| "zh_cn": "修复 Windows 发布 runner 的 LF 源码字节保留问题,并将已校验版本传递给生产构建。", | ||
| "sources": [ | ||
| "https://github.com/FlanChanXwO/javdb-cli/commit/8a7c3a0", | ||
| "https://github.com/FlanChanXwO/javdb-cli/commit/3924241" | ||
| ] | ||
| }, | ||
| { | ||
| "category": "Changed", | ||
| "english": "Align the repository layout with the public SDK facade and protocol-boundary conventions.", | ||
| "zh_cn": "调整仓库布局,使其与公开 SDK facade 和协议边界约定保持一致。", | ||
| "sources": ["https://github.com/FlanChanXwO/javdb-cli/commit/5e5b769"] |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
修正 manifest 的 entry schema。
设计契约要求每个 entry 具有唯一 source、breaking 和来源类型;当前文件使用 sources 数组且缺少另外两个必填字段。prepare/validate 将无法按约定解析该 manifest,导致 v0.2.0 发布门禁失败。请按 scripts/releasenotes 的实际 schema 拆分多来源条目并补齐字段。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@changelog/plans/v0.2.0.json` around lines 5 - 25, Update the v0.2.0 manifest
entries to match the schema consumed by scripts/releasenotes: replace each
sources array with a single source value, split entries that have multiple
sources into separate entries, and add the required unique breaking and
source-type fields to every entry. Preserve the existing release-note content
while ensuring prepare/validate can parse all entries.
| client: githubClient{ | ||
| baseURL: *apiBase, | ||
| token: os.Getenv(*tokenEnv), | ||
| client: http.DefaultClient, | ||
| }, |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
GitHub 客户端缺少超时设置。
http.DefaultClient 无 Timeout,audit/sync-history 在 GitHub 端挂起时会无限阻塞发布工作流;建议注入带超时的客户端。
🛠️ 建议修复
client: githubClient{
baseURL: *apiBase,
token: os.Getenv(*tokenEnv),
- client: http.DefaultClient,
+ client: &http.Client{Timeout: 30 * time.Second},
},Also applies to: 898-902
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/releasenotes/main.go` around lines 239 - 243, Update the githubClient
initialization used by the release-note audit/sync-history flows to inject an
HTTP client with an explicit finite timeout instead of http.DefaultClient. Apply
the same change to the corresponding second initialization, reusing the
project’s existing timeout configuration or defining one consistent timeout for
both clients.
| func writeJSON(path string, value any) error { | ||
| var destination io.Writer = os.Stdout | ||
| var file *os.File | ||
| if path != "" { | ||
| opened, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600) | ||
| if err != nil { | ||
| return err | ||
| } | ||
| file = opened | ||
| destination = file | ||
| defer file.Close() | ||
| } | ||
| encoder := json.NewEncoder(destination) | ||
| encoder.SetIndent("", " ") | ||
| return encoder.Encode(value) | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
写文件时未检查 Close 错误。
audit 报告是 prepare/validate 的输入,defer file.Close() 丢弃的错误可能掩盖写入失败,产生被截断的 JSON(errcheck 亦提示)。
🛡️ 建议修复
- encoder := json.NewEncoder(destination)
- encoder.SetIndent("", " ")
- return encoder.Encode(value)
+ encoder := json.NewEncoder(destination)
+ encoder.SetIndent("", " ")
+ if err := encoder.Encode(value); err != nil {
+ return err
+ }
+ if file != nil {
+ return file.Close()
+ }
+ return nil(同时移除上方的 defer file.Close(),或改为忽略二次关闭错误。)
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| func writeJSON(path string, value any) error { | |
| var destination io.Writer = os.Stdout | |
| var file *os.File | |
| if path != "" { | |
| opened, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600) | |
| if err != nil { | |
| return err | |
| } | |
| file = opened | |
| destination = file | |
| defer file.Close() | |
| } | |
| encoder := json.NewEncoder(destination) | |
| encoder.SetIndent("", " ") | |
| return encoder.Encode(value) | |
| } | |
| func writeJSON(path string, value any) error { | |
| var destination io.Writer = os.Stdout | |
| var file *os.File | |
| if path != "" { | |
| opened, err := os.OpenFile(path, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0o600) | |
| if err != nil { | |
| return err | |
| } | |
| file = opened | |
| destination = file | |
| } | |
| encoder := json.NewEncoder(destination) | |
| encoder.SetIndent("", " ") | |
| if err := encoder.Encode(value); err != nil { | |
| return err | |
| } | |
| if file != nil { | |
| return file.Close() | |
| } | |
| return nil | |
| } |
🧰 Tools
🪛 golangci-lint (2.12.2)
[error] 1022-1022: Error return value of file.Close is not checked
(errcheck)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/releasenotes/main.go` around lines 1012 - 1027, Update writeJSON to
check and return any error from closing the opened file, removing the unchecked
defer file.Close() while preserving stdout behavior and returning encoder errors
as before.
Source: Linters/SAST tools
magnets and detail --magnets only needed auth because the CLI forced a
token; the underlying /api/v1/movies/{id}/magnets endpoint works
anonymously. Route both through a new withOptionalAuthClient that uses
the saved default token when present, never fails upfront for missing
auth, and retries once anonymously when the server rejects the token.
Also move the e2e magnets checks out of the authed block, drop the
"needs login" help text, and sync the EN/zh-CN docs and skill guides.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Adopt the bilingual EN/中文 structure for the pull-request and issue templates, Copilot instructions, and CONTRIBUTING guides. Align the changelog wording so release entries carry inline PR or direct-commit sources. No behavior change. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Covers the anonymous magnets fallback, the versioned release-notes workflow, bilingual contribution templates, and repository docs. Every entry cites its commit sources. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 10
🧹 Nitpick comments (7)
scripts/releasenotes/audit.go (2)
335-364: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueGit 命令失败时丢失 stderr 内容。
exec.Cmd.Output只返回*exec.ExitError,错误信息不包含 git 的 stderr。审计在 CI 中失败时,维护者只能看到 “list commits for … : exit status 128”。建议在包装错误时附加exitErr.Stderr。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/audit.go` around lines 335 - 364, Update gitRevisionList and gitCommitDetail to preserve git stderr when exec.CommandContext(...).Output() fails. Detect the returned *exec.ExitError and append its Stderr content to the existing wrapped errors, while retaining the current error messages for other error types.
238-262: 🚀 Performance & Scalability | 🔵 Trivial | ⚖️ Poor tradeoff每位作者会拉取全部已合并 PR 详情,请求量较大。
该方法对搜索结果中的每个 PR 都发起一次详情请求。对提交较多的作者,这会产生大量请求并快速消耗 GitHub API 速率配额。审计在发布工作流中运行,速率受限会直接导致发布失败。
建议只在需要判定“首次贡献”时缩小范围,例如先按
created升序取候选,再仅对最早的一小批 PR 取详情比较merged_at;或缓存审计结果。若维持当前实现,请在文档中记录预期请求量。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/audit.go` around lines 238 - 262, Reduce API usage in mergedPullRequestsByAuthor by ordering search results by created time and limiting detail lookups to the smallest candidate set needed to determine each author’s first contribution; do not call pullRequest for every search result. Preserve correct merged_at evaluation and return behavior, or document the expected request volume if the full-detail approach must remain.scripts/releasenotes/main_test.go (3)
323-334: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value元数据校验的其他分支未覆盖。
该用例只验证版本不匹配。
validatePreparePlanMetadata还有三条拒绝路径:初始发布带非空previous_tag或compare_url、previous_tag不匹配、compare_url不匹配。建议用表驱动方式补齐。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/main_test.go` around lines 323 - 334, 扩展 TestPrepareRejectsMismatchedPlanMetadata,使用表驱动用例覆盖 validatePreparePlanMetadata 的其余拒绝路径:初始发布包含非空 PreviousTag 或 CompareURL、PreviousTag 不匹配,以及 CompareURL 不匹配;保留现有版本不匹配场景,并分别断言返回错误。
476-485: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win
strings.Contains(created.Body, "assets")无法证明请求不含 assets。该断言只检查渲染出的正文文本里没有 "assets" 字样。创建载荷是否包含 assets 字段由
githubReleaseWrite的字段集合决定,与正文无关。这条断言在正文措辞变化时还可能误报失败。建议改为解析原始请求体 JSON,并断言其键集合不含 asset 相关字段。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/main_test.go` around lines 476 - 485, 更新 syncHistoricalRelease 测试中针对 created.Body 的 assets 断言:捕获并解析 githubReleaseWrite 发送的原始请求体 JSON,直接检查顶层键集合不包含 assets 相关字段。保留现有版本、名称和 Draft 的断言,避免通过正文文本推断请求载荷结构。
219-260: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win测试未覆盖分页与
merged_at比较。
/search/issues只返回一项,mergedPullRequestsByAuthor在第一页即结束。firstMergedPullRequest中按merged_at取最早项的比较逻辑因此没有被验证。建议补充一个用例:第一页返回 100 项、第二页返回剩余项,并让创建顺序与合并顺序不一致。这样可以证明实现按合并时间而不是创建时间判定首次贡献。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/main_test.go` around lines 219 - 260, 扩展现有测试服务器对“/search/issues”的模拟,使第一页返回恰好 100 个合并 PR、第二页返回剩余 PR,并验证请求了第二页;安排这些 PR 的创建顺序与 merged_at 顺序不同。更新断言以确认 firstMergedPullRequest 通过 mergedPullRequestsByAuthor 按 merged_at 选择最早合并的 PR,而不是按返回或创建顺序选择。scripts/test-releasenotes.sh (1)
18-35: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winplan 元数据校验逻辑与发布工作流重复。
.github/workflows/release.yml第 100-116 行内嵌了同一段 Python 校验(version、previous_tag、compare_url 与0.1.0例外)。两处独立维护,规则一旦变化就会分叉。建议把该校验抽成一个共享脚本,或在
releasenotesCLI 中提供一个 plan 校验子命令,然后由脚本与工作流共同调用。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/test-releasenotes.sh` around lines 18 - 35, 将 scripts/test-releasenotes.sh 中内嵌的 plan 元数据校验逻辑抽取到可复用的共享脚本或 releasenotes CLI 校验子命令中,涵盖 version、previous_tag、compare_url 及 0.1.0 特例;让 test-releasenotes.sh 与 .github/workflows/release.yml 共同调用该实现,删除两处重复校验并确保现有校验结果保持一致。scripts/releasenotes/prepare.go (1)
215-231: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value变量遮蔽与不确定的错误信息。
第 220 行的
planned遮蔽了第 195 行的plannedmap。两者含义不同,容易在后续修改时误用。
第 229-231 行在 map 上取第一个键后立即返回。map 遍历顺序不确定,同一份数据可能报告不同的贡献者。建议排序后一次性列出全部多余贡献者。🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/releasenotes/prepare.go` around lines 215 - 231, 在校验新贡献者的逻辑中,避免循环内的 planned 遮蔽外层 planned map,使用能区分单个贡献者的名称。处理 plannedContributors 剩余项时先收集并排序所有登录名,再一次性构造包含全部缺失贡献者的错误信息,确保结果稳定且不遗漏项目。
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In @.github/ISSUE_TEMPLATE/feature-request.yml:
- Line 53: Remove the render: text configuration from the alternatives field in
the issue template, while preserving the existing render settings for fields
that collect logs or commands.
In `@CONTRIBUTING.md`:
- Line 71: Update the release-sensitive checks checklist entry at
CONTRIBUTING.md:71-71 and CONTRIBUTING.zh-CN.md:71-71 to use the
repository-relative paths scripts/test-package-release.sh,
scripts/test-homebrew-formula.sh, scripts/test-workflows.sh,
scripts/test-documentation.sh, and scripts/test-architecture.sh in both locale
files.
In `@internal/cli/authclient.go`:
- Around line 81-85: 更新认证初始化流程,保留 openAuth 和 store.Default
返回的具体错误;仅在明确表示不存在默认账户或 token
为空时继续匿名请求。其他认证存储、解析、读取、权限及文件系统错误必须向调用方返回,确保不会被转化为成功结果,并为这些错误路径补充回归测试。
In `@README.md`:
- Around line 206-207: Update the English README authentication description near
the Magnet, TOP250, and user-list command notes to state that requests fall back
to anonymous access when the saved token is rejected, matching the corresponding
README.zh-CN.md behavior and keeping both locale documents consistent.
In `@scripts/changescope/documentation_paths.go`:
- Around line 16-22: 更新 directoryPrefixes,使其仅匹配 changelog/ 下的 Markdown 内容路径,排除
changelog/plans/;保留其他文档专属路径不变。为 changelog/plans/*.json
增加完整验证测试,确保仅修改这些计划文件时不会被判定为 docs_only。
In `@scripts/releasenotes/audit.go`:
- Around line 43-47: Configure both githubClient construction sites with the
same explicit HTTP timeout: update scripts/releasenotes/audit.go lines 43-47 and
scripts/releasenotes/history.go lines 36-40, replacing http.DefaultClient with a
shared timeout-configured client or constructor and adding the required time
import. Ensure both command entry points use the identical timeout value.
- Line 314: Update the response-body cleanup near response.Body.Close to
explicitly discard the Close return value, satisfying errcheck while preserving
the existing behavior that close failures do not affect the result.
In `@scripts/releasenotes/history.go`:
- Around line 59-77: Handle the ignored return values from both fmt.Fprintf
calls in the historical release flow by explicitly assigning them to blank
identifiers, preserving the existing output messages and control flow in the
Apply checks.
In `@scripts/releasenotes/prepare.go`:
- Around line 89-93: 在 prepare 流程中更新 fmt.Fprintln 调用,显式忽略其返回值以通过
errcheck;同时处理同文件中 file.Close() 的未检查返回值,使用显式结果丢弃方式,保持现有行为不变。
- Around line 368-374: 更新包含 versionMarker 的 replace 分支:不要直接返回原始
body,而应定位该版本的索引行并按当前版本日期及 compare 链接重写后返回。非 replace 场景仍保留现有重复版本错误行为,确保 --replace
后索引与版本说明文件保持一致。
---
Nitpick comments:
In `@scripts/releasenotes/audit.go`:
- Around line 335-364: Update gitRevisionList and gitCommitDetail to preserve
git stderr when exec.CommandContext(...).Output() fails. Detect the returned
*exec.ExitError and append its Stderr content to the existing wrapped errors,
while retaining the current error messages for other error types.
- Around line 238-262: Reduce API usage in mergedPullRequestsByAuthor by
ordering search results by created time and limiting detail lookups to the
smallest candidate set needed to determine each author’s first contribution; do
not call pullRequest for every search result. Preserve correct merged_at
evaluation and return behavior, or document the expected request volume if the
full-detail approach must remain.
In `@scripts/releasenotes/main_test.go`:
- Around line 323-334: 扩展 TestPrepareRejectsMismatchedPlanMetadata,使用表驱动用例覆盖
validatePreparePlanMetadata 的其余拒绝路径:初始发布包含非空 PreviousTag 或
CompareURL、PreviousTag 不匹配,以及 CompareURL 不匹配;保留现有版本不匹配场景,并分别断言返回错误。
- Around line 476-485: 更新 syncHistoricalRelease 测试中针对 created.Body 的 assets
断言:捕获并解析 githubReleaseWrite 发送的原始请求体 JSON,直接检查顶层键集合不包含 assets 相关字段。保留现有版本、名称和
Draft 的断言,避免通过正文文本推断请求载荷结构。
- Around line 219-260: 扩展现有测试服务器对“/search/issues”的模拟,使第一页返回恰好 100 个合并 PR、第二页返回剩余
PR,并验证请求了第二页;安排这些 PR 的创建顺序与 merged_at 顺序不同。更新断言以确认 firstMergedPullRequest 通过
mergedPullRequestsByAuthor 按 merged_at 选择最早合并的 PR,而不是按返回或创建顺序选择。
In `@scripts/releasenotes/prepare.go`:
- Around line 215-231: 在校验新贡献者的逻辑中,避免循环内的 planned 遮蔽外层 planned
map,使用能区分单个贡献者的名称。处理 plannedContributors
剩余项时先收集并排序所有登录名,再一次性构造包含全部缺失贡献者的错误信息,确保结果稳定且不遗漏项目。
In `@scripts/test-releasenotes.sh`:
- Around line 18-35: 将 scripts/test-releasenotes.sh 中内嵌的 plan
元数据校验逻辑抽取到可复用的共享脚本或 releasenotes CLI 校验子命令中,涵盖 version、previous_tag、compare_url
及 0.1.0 特例;让 test-releasenotes.sh 与 .github/workflows/release.yml
共同调用该实现,删除两处重复校验并确保现有校验结果保持一致。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6e4d77d6-5d79-4687-a406-29fba6c38c6f
📒 Files selected for processing (45)
.github/ISSUE_TEMPLATE/bug-report.yml.github/ISSUE_TEMPLATE/config.yml.github/ISSUE_TEMPLATE/feature-request.yml.github/PULL_REQUEST_TEMPLATE.md.github/actions/classify-change-scope/action.yml.github/copilot-instructions.md.github/workflows/ci.yml.github/workflows/platform-smoke.yml.github/workflows/release.ymlCONTRIBUTING.mdCONTRIBUTING.zh-CN.mdREADME.mdREADME.zh-CN.mdchangelog/README.mdchangelog/README.zh-CN.mdchangelog/plans/v0.3.0.jsonchangelog/v0.3.0/en.mdchangelog/v0.3.0/zh-CN.mddocs/en/cli-reference.mddocs/maintainers/development.mddocs/zh-CN/cli-reference.mde2e/run.shinternal/cli/authclient.gointernal/cli/authclient_test.gointernal/cli/detail_cmd.gointernal/cli/detail_test.gointernal/cli/magnets_cmd.gointernal/cli/magnets_cmd_test.gointernal/javdb/appapi/movie.gojavdb/movie.goscripts/changescope/documentation_paths.goscripts/changescope/main.goscripts/changescope/main_test.goscripts/releasenotes/audit.goscripts/releasenotes/history.goscripts/releasenotes/main.goscripts/releasenotes/main_test.goscripts/releasenotes/prepare.goscripts/releasenotes/render.goscripts/releasenotes/validate.goscripts/test-documentation.shscripts/test-releasenotes.shscripts/test-workflows.shskills/javdb-cli/SKILL.mdskills/javdb-cli/references/discover.md
🚧 Files skipped from review as they are similar to previous changes (6)
- changelog/README.zh-CN.md
- changelog/README.md
- .github/workflows/ci.yml
- docs/maintainers/development.md
- .github/workflows/release.yml
- .github/workflows/platform-smoke.yml
| description: Describe existing commands, workarounds, or other designs you considered. | ||
| label: Alternatives considered / 已考虑的替代方案 | ||
| description: Describe existing commands, workarounds, or other designs you considered. / 请说明已考虑的现有命令、变通方案或其他设计。 | ||
| render: text |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== file exists and relevant lines =="
if [ -f .github/ISSUE_TEMPLATE/feature-request.yml ]; then
nl -ba .github/ISSUE_TEMPLATE/feature-request.yml | sed -n '1,140p'
else
echo ".github/ISSUE_TEMPLATE/feature-request.yml not found"
fi
echo
echo "== all render fields in issue templates =="
rg -n "render:\s*(text|markdown|code|yaml|json|shell|html)" .github/ISSUE_TEMPLATE || trueRepository: FlanChanXwO/javdb-cli
Length of output: 236
🌐 Web query:
GitHub Forms schema options field render markdown code text behavior
💡 Result:
In GitHub issue form schemas, markdown support within the options of fields (specifically for dropdown and checkboxes elements) is limited to basic formatting [1][2][3]. According to official documentation, for the label attribute within an options array, markdown is supported for bold or italic text formatting and hyperlinks [1][2][3]. It is important to note that this support does not extend to rendering code blocks or more complex markdown elements within those option labels [1][2]. If you require high-fidelity markdown rendering—such as code snippets or complex layouts—you should use a separate markdown element to provide the necessary context, as the markdown element type is explicitly designed to render full markdown, including code blocks, though its content is not submitted with the form [1][2][4]. Summary of behavior: - Dropdown/Checkbox labels: Supported for limited markdown (bold, italics, hyperlinks) [1][2]. - Code blocks: Not supported in option labels [1][2]. - Markdown element type: Supports full markdown (including code blocks) but is for display/context only and is not submitted [1][2][4].
Citations:
- 1: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 2: https://docs.github.com/en/enterprise-server@3.21/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 3: https://docs.github.com/en/enterprise-server@3.12/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 4: https://github.com/github/docs/blob/main/content/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema.md
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== find nl or use awk for numbered view =="
(sed -n '1,140p' .github/ISSUE_TEMPLATE/feature-request.yml | awk '{printf "%6d\t%s\n", NR, $0}') || true
echo
echo "== render fields in issue templates =="
rg -n "render:\s*(text|markdown|code|yaml|json|shell|html)" .github/ISSUE_TEMPLATE || trueRepository: FlanChanXwO/javdb-cli
Length of output: 3207
🌐 Web query:
site:docs.github.com issue form schema textarea render text text area code block text area render option text
💡 Result:
In the context of GitHub issue form schemas, the render key is an attribute used specifically within a textarea element to define how submitted content should be formatted [1][2]. When the render attribute is specified, the input provided in the textarea will be automatically wrapped in a Markdown code block using the language syntax specified by that value [1][2]. For example, setting render: bash will format the input as a bash code block, while render: shell will format it as a shell script block [1][2]. When this attribute is utilized, the textarea UI does not expand for file attachments or Markdown editing, as the primary purpose of the field becomes structured code input [1][2]. Supported values for the render attribute correspond to the programming languages recognized by GitHub [1][2].
Citations:
- 1: https://docs.github.com/en/enterprise-cloud@latest/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 2: https://docs.github.com/en/enterprise-cloud@latest/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
🌐 Web query:
GitHub issue forms textarea render option text text area render text code block
💡 Result:
In GitHub issue forms, the render attribute for a textarea field allows you to control how the submitted content is formatted [1][2]. When a render value is specified, the input is automatically wrapped in a code block, which eliminates the need for the user to manually enter backticks [3][4]. Key details regarding the render attribute for textarea: - Functionality: If you provide a value to the render attribute, the submitted text will be formatted as a code block [1][2]. - Constraints: When the render key is used, the text area will not expand to allow for file attachments or rich Markdown editing [1][2]. - Values: You can specify a language for the code block (e.g., bash, shell, json, yaml, etc.) to trigger syntax highlighting [1][3][2]. The allowed values correspond to the languages supported by GitHub Linguist [1][2]. - Usage Example: - type: textarea id: logs attributes: label: Relevant log output render: shell In this example, the input provided by the user will be rendered as a shell code block [3][4]. Additionally, you can use render: markdown if you want the submitted text to be treated as Markdown content [5][4].
Citations:
- 1: https://docs.github.com/en/enterprise-server@3.21/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 2: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 3: https://docs.github.com/en/enterprise-cloud@latest/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms?apiVersion=2022-11-28
- 4: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
- 5: https://github.com/github/docs/blob/main/content/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms.md
🌐 Web query:
GitHub docs issue forms render: markdown textarea code block
💡 Result:
In GitHub issue forms, you can ensure user input in a textarea is rendered as a code block by using the render key in your YAML configuration [1][2]. When you provide a language value to the render key, the content submitted by the user in that textarea is automatically wrapped in a Markdown code block using that language [1][3]. This eliminates the need for the user to manually type backticks [2]. Example configuration: - type: textarea id: logs attributes: label: Relevant log output description: Please copy and paste any relevant log output. render: shell validations: required: true Important considerations: - If the render key is provided, the textarea will not expand to allow for file attachments or additional Markdown editing by the contributor [1][4]. - The value provided for render must be a language known to GitHub (e.g., shell, bash, json, python) [1][3]. For a complete list of supported languages, you can refer to the languages YAML file in the GitHub Linguist repository [1][4].
Citations:
- 1: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 2: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository
- 3: https://docs.github.com/en/enterprise-server@3.12/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 4: https://github.com/github/docs/blob/main/content/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema.md
🌐 Web query:
site:docs.github.com "render" "textarea" "issue forms" "text"
💡 Result:
In GitHub issue forms, the render key is an optional attribute used within a textarea element to automatically format submitted text into a code block [1][2]. When you provide a language or format (such as shell, bash, or markdown) to the render key, the content entered by the user into that textarea will be wrapped in the corresponding Markdown code block syntax upon submission [1][3]. Important considerations when using the render attribute: - Functional limitation: When you include the render key in a textarea, the field will not support file attachments or Markdown editing (e.g., standard text formatting features) [1][4]. - Languages: The value provided to render must be a language recognized by GitHub [1]. You can refer to the GitHub Linguist repository for a full list of supported language identifiers [1]. - Example usage: body: - type: textarea id: logs attributes: label: Relevant log output render: shell validations: required: true In this example, any text entered into the "Relevant log output" field will be automatically formatted as a shell script code block when the issue is created [2][5].
Citations:
- 1: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 2: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms
- 3: https://docs.github.com/en/enterprise-server@3.12/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 4: https://docs.github.com/en/enterprise-server@3.17/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-githubs-form-schema
- 5: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository
不要给 alternatives 添加 render: text。
render 会启用代码块渲染模式,并会禁用 Markdown 编辑和附件扩展。alternatives 用于自然语言说明,不应使用代码块渲染;保留日志或命令字段所需的 render 配置即可。
建议修改
description: Describe existing commands, workarounds, or other designs you considered. / 请说明已考虑的现有命令、变通方案或其他设计。
- render: text📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| render: text |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In @.github/ISSUE_TEMPLATE/feature-request.yml at line 53, Remove the render:
text configuration from the alternatives field in the issue template, while
preserving the existing render settings for fields that collect logs or
commands.
| - [ ] `go test ./... -count=1` passes. | ||
| - [ ] `go vet ./...` passes. | ||
| - [ ] `sh scripts/build.sh` passes. | ||
| - [ ] The release-sensitive checks pass (`scripts/test-package-release.sh`, `test-homebrew-formula.sh`, `test-workflows.sh`, `test-documentation.sh`, `test-architecture.sh`). |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/sh
set -eu
# 检查清单列出的脚本是否存在。
for name in \
test-package-release.sh \
test-homebrew-formula.sh \
test-workflows.sh \
test-documentation.sh \
test-architecture.sh
do
matches="$(fd --type f --hidden --exclude .git --glob "$name" . || true)"
if [ -z "$matches" ]; then
printf '缺少脚本: %s\n' "$name" >&2
exit 1
fi
doneRepository: FlanChanXwO/javdb-cli
Length of output: 159
🏁 Script executed:
#!/bin/sh
set -eu
printf '列出匹配脚本文件:\n'
fd --type f --hidden --exclude .git '^(test-package-release|test-homebrew-formula|test-workflows|test-documentation|test-architecture)\.sh$' . || true
printf '\n贡献指南第71行:\n'
for f in CONTRIBUTING.md CONTRIBUTING.zh-CN.md; do
if [ -f "$f" ]; then
sed -n '65,75p' "$f"
fi
done
printf '\nworkflow 中脚本调用:\n'
rg -n "scripts/test-(?:package-release|homebrew-formula|workflows|documentation|architecture)\.sh|test-(?:homebrew-formula|workflows|documentation|architecture)\.sh" .github/workflows || trueRepository: FlanChanXwO/javdb-cli
Length of output: 1951
统一 CONTRIBUTING 清单中的发布检查脚本路径。
清单中列出的裸脚本名与实际仓库文件不一致,两个 locale 的条目都需要改为实际路径:scripts/test-package-release.sh、scripts/test-homebrew-formula.sh、scripts/test-workflows.sh、scripts/test-documentation.sh 和 scripts/test-architecture.sh。
📍 Affects 2 files
CONTRIBUTING.md#L71-L71(this comment)CONTRIBUTING.zh-CN.md#L71-L71
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@CONTRIBUTING.md` at line 71, Update the release-sensitive checks checklist
entry at CONTRIBUTING.md:71-71 and CONTRIBUTING.zh-CN.md:71-71 to use the
repository-relative paths scripts/test-package-release.sh,
scripts/test-homebrew-formula.sh, scripts/test-workflows.sh,
scripts/test-documentation.sh, and scripts/test-architecture.sh in both locale
files.
Source: Learnings
| if _, store, err := openAuth(); err == nil { | ||
| if acc, aerr := store.Default(); aerr == nil { | ||
| token = acc.Token | ||
| } | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
不要吞掉 openAuth 和 store.Default 的错误。
当前代码忽略所有认证存储错误。损坏的 auth.json、读取失败或权限失败会改为匿名请求,并可能返回成功结果。
仅将预期的“无默认账户”或空 token 状态视为匿名请求。返回其他认证和文件系统错误。为这些错误添加回归测试。
As per coding guidelines:不得将 authentication、network、JavDB API 或 filesystem 错误隐藏为成功结果。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/cli/authclient.go` around lines 81 - 85, 更新认证初始化流程,保留 openAuth 和
store.Default 返回的具体错误;仅在明确表示不存在默认账户或 token
为空时继续匿名请求。其他认证存储、解析、读取、权限及文件系统错误必须向调用方返回,确保不会被转化为成功结果,并为这些错误路径补充回归测试。
Source: Coding guidelines
| Magnet commands work anonymously and use the saved token when available. | ||
| TOP250 and user-list commands need the default authenticated account. |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
同步英文 README 的无效 token 回退说明。
README.md 只说明存在时使用保存的 token。README.zh-CN.md 还说明 token 被拒绝后会回退匿名请求。
在英文文档中加入相同的回退行为说明。否则不同 locale 的用户会得到不同的认证行为预期。
Based on learnings:认证行为变更必须同步更新两个 locale 的 CLI reference、README 和 skills/javdb-cli/。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@README.md` around lines 206 - 207, Update the English README authentication
description near the Magnet, TOP250, and user-list command notes to state that
requests fall back to anonymous access when the saved token is rejected,
matching the corresponding README.zh-CN.md behavior and keeping both locale
documents consistent.
Source: Learnings
| directoryPrefixes: []string{ | ||
| "docs/", | ||
| "changelog/", | ||
| "skills/", | ||
| ".agents/skills/", | ||
| ".github/ISSUE_TEMPLATE/", | ||
| }, |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
不要将 changelog/plans/ 归类为文档专属路径。
changelog/ 会批准 changelog/plans/v*.json。这些 JSON 文件是 release notes 审计和渲染的输入。仅修改计划文件时,docs_only 会跳过完整质量门禁和平台 smoke,但发布输出行为已改变。
请只允许 changelog 的 Markdown 内容路径,并为 changelog/plans/*.json 添加“完整验证”测试。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/changescope/documentation_paths.go` around lines 16 - 22, 更新
directoryPrefixes,使其仅匹配 changelog/ 下的 Markdown 内容路径,排除
changelog/plans/;保留其他文档专属路径不变。为 changelog/plans/*.json
增加完整验证测试,确保仅修改这些计划文件时不会被判定为 docs_only。
| client: githubClient{ | ||
| baseURL: *apiBase, | ||
| token: os.Getenv(*tokenEnv), | ||
| client: http.DefaultClient, | ||
| }, |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
GitHub 客户端缺少超时设置。 两处命令入口都用 http.DefaultClient 构造 githubClient。该客户端没有 Timeout。GitHub 端挂起时,请求会无限等待并阻塞发布工作流。根因是构造 githubClient 时没有注入带超时的 *http.Client。
scripts/releasenotes/audit.go#L43-L47:把client: http.DefaultClient改为带明确超时的客户端,例如&http.Client{Timeout: 30 * time.Second},并导入time。scripts/releasenotes/history.go#L36-L40:使用同一个超时配置构造客户端,避免两处取值分叉;建议抽出一个共享的构造函数。
📍 Affects 2 files
scripts/releasenotes/audit.go#L43-L47(this comment)scripts/releasenotes/history.go#L36-L40
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/releasenotes/audit.go` around lines 43 - 47, Configure both
githubClient construction sites with the same explicit HTTP timeout: update
scripts/releasenotes/audit.go lines 43-47 and scripts/releasenotes/history.go
lines 36-40, replacing http.DefaultClient with a shared timeout-configured
client or constructor and adding the required time import. Ensure both command
entry points use the identical timeout value.
| if err != nil { | ||
| return err | ||
| } | ||
| defer response.Body.Close() |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
response.Body.Close 的返回值未检查。
golangci-lint 的 errcheck 会报错。读取响应体后关闭失败不影响结果,显式忽略即可。
🛠️ 建议修复
- defer response.Body.Close()
+ defer func() { _ = response.Body.Close() }()📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| defer response.Body.Close() | |
| defer func() { _ = response.Body.Close() }() |
🧰 Tools
🪛 golangci-lint (2.12.2)
[error] 314-314: Error return value of response.Body.Close is not checked
(errcheck)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/releasenotes/audit.go` at line 314, Update the response-body cleanup
near response.Body.Close to explicitly discard the Close return value,
satisfying errcheck while preserving the existing behavior that close failures
do not affect the result.
Source: Linters/SAST tools
| if !config.Apply { | ||
| fmt.Fprintf(os.Stdout, "would create historical Release v%s without assets\n", config.Version) | ||
| return nil | ||
| } | ||
| created := githubRelease{} | ||
| if err := config.Client.requestJSON(ctx, http.MethodPost, "/repos/"+config.Repository+"/releases", githubReleaseWrite{ | ||
| TagName: "v" + config.Version, | ||
| Name: "v" + config.Version, | ||
| Body: body, | ||
| Draft: false, | ||
| }, &created); err != nil { | ||
| return fmt.Errorf("create historical Release v%s: %w", config.Version, err) | ||
| } | ||
| release = created | ||
| } else { | ||
| if !config.Apply { | ||
| fmt.Fprintf(os.Stdout, "would update historical Release v%s body; assets remain unchanged\n", config.Version) | ||
| return nil | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
未检查 fmt.Fprintf 的返回值。
golangci-lint 的 errcheck 对第 60 行与第 75 行报错。改为 _, _ = fmt.Fprintf(...)。
🧰 Tools
🪛 golangci-lint (2.12.2)
[error] 60-60: Error return value of fmt.Fprintf is not checked
(errcheck)
[error] 75-75: Error return value of fmt.Fprintf is not checked
(errcheck)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/releasenotes/history.go` around lines 59 - 77, Handle the ignored
return values from both fmt.Fprintf calls in the historical release flow by
explicitly assigning them to blank identifiers, preserving the existing output
messages and control flow in the Apply checks.
Source: Linters/SAST tools
| if !config.Apply { | ||
| for _, path := range sortedFilePaths(files) { | ||
| fmt.Fprintln(os.Stdout, path) | ||
| } | ||
| return nil |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
未检查 fmt.Fprintln 的返回值。
golangci-lint 的 errcheck 会报错。改为 _, _ = fmt.Fprintln(...)。同文件第 412 行的 file.Close() 也未检查返回值,请一并处理。
🧰 Tools
🪛 golangci-lint (2.12.2)
[error] 91-91: Error return value of fmt.Fprintln is not checked
(errcheck)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/releasenotes/prepare.go` around lines 89 - 93, 在 prepare 流程中更新
fmt.Fprintln 调用,显式忽略其返回值以通过 errcheck;同时处理同文件中 file.Close()
的未检查返回值,使用显式结果丢弃方式,保持现有行为不变。
Source: Linters/SAST tools
| versionMarker := "v" + version + "](" | ||
| if strings.Contains(content, versionMarker) { | ||
| if replace { | ||
| return body, nil | ||
| } | ||
| return nil, fmt.Errorf("changelog index already contains v%s", version) | ||
| } |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟡 Minor | ⚡ Quick win
--replace 时索引行不会被更新。
如果索引已包含该版本且 replace 为 true,函数直接返回原文件内容。此时版本目录下的说明文件会被替换,但索引中的日期与 compare 链接保持旧值。历史回填如果修正了日期或前序标签,索引会与说明文件不一致。
请确认这是期望行为;否则应重写该行而不是跳过。
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/releasenotes/prepare.go` around lines 368 - 374, 更新包含 versionMarker 的
replace 分支:不要直接返回原始 body,而应定位该版本的索引行并按当前版本日期及 compare 链接重写后返回。非 replace
场景仍保留现有重复版本错误行为,确保 --replace 后索引与版本说明文件保持一致。
config.Dir resolves the auth store via os.UserHomeDir, which reads USERPROFILE on Windows rather than HOME. The withOptionalAuthClient tests set only HOME, so on Windows runners they shared the real user profile, and a seeded token leaked into the anonymous test when the race run followed the non-race run in the same job. Redirect both HOME and the Windows home env vars to a per-test temp directory. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
After the squash merge of PR #6, the release range on main is the six merged pull requests #1-#6, not the original branch commits. Rewrite the v0.3.0 plan and bilingual notes to cite those PR URLs so the release audit source coverage matches, and fold the magnets behavior into PR #6's Added entry. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
magnetsanddetail --magnetsno longer require a default account: they use a saved token when present and fall back to anonymous requests when the token is rejected.Scope and compatibility
CLI and public Go SDK behavior are unchanged except that
magnetsanddetail --magnetsno longer require login (anonymous fallback when a saved token is rejected). The project still has no MCP server.Test plan
go test ./...passessh scripts/build.shpassessh scripts/test-releasenotes.shpassespython -m pre_commit run --all-filespasses (gofmt, go test, release tooling, release notes, documentation structure, architecture structure)Summary by CodeRabbit