feat(review): generate AGENTS.md/CLAUDE.md from repo profile, deliver as a PR - #3052
Conversation
… as a PR Consumes extractRepoProfile (#2999) to render an AGENTS.md body and open it as a pull request via the installation-token write chokepoint, with CLAUDE.md kept in sync as a real symlink (falling back to a byte-identical copy when the target tree rejects one). First-run and refresh are handled identically at the tree level, and a non-live action mode short-circuits before any dependent write. Closes #3000. Part of #2993.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3052 +/- ##
=======================================
Coverage 96.10% 96.11%
=======================================
Files 261 263 +2
Lines 28888 28953 +65
Branches 10516 10533 +17
=======================================
+ Hits 27762 27827 +65
Misses 492 492
Partials 634 634
🚀 New features to boost your workflow:
|
|
Warning 🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨🟨 ⏸️ Gittensory review result - manual review recommendedReview updated: 2026-07-04 10:24:16 UTC
⏸️ Suggested Action - Manual Review
Review summary Blockers
Nits — 6 non-blocking
Concerns raised — review before merging
Review context
Contributor next steps
Signal definitions
🟩 Safe / merged · 🟦 Advisory · 🟨 Held for review · 🟥 Blocked / closed 💰 Earn for open-source contributions like this. Gittensor lets GitHub contributors earn for the work they already do — register to start earning →. Checked by Gittensory, a quiet PR intelligence layer for OSS maintainers.
|
Summary
renderRepoDocContent(profile)(src/review/repo-doc-render.ts), a pure template that turns aRepoProfile(feat(review): extract a codebase-grounded repo profile from RAG + signals #2999) into the markdown body of a generatedAGENTS.md: architecture, naming/test conventions, build/test/lint commands, and contribution-workflow facts. Returnsnullfor an absent profile -- never a placeholder document.openRepoDocPullRequest(env, repoFullName, mode)(src/github/repo-doc-pr.ts), which renders the content and opens (or finds the already-open) pull request carryingAGENTS.md+CLAUDE.md, reusing the SAME installation-token write chokepoint (makeInstallationOctokit) every other GitHub write in this engine goes through -- never a direct commit to the target repo's default branch.CLAUDE.mdis delivered as a real git symlink (mode120000) pointing atAGENTS.mdwhen the target tree accepts one, falling back to a byte-identical regular-file copy when it doesn't -- matching this repo's own convention (verified directly:CLAUDE.mdhere really is a symlink toAGENTS.md, not the singular "AGENT.md" the parent issue's prose loosely uses).base_tree+ explicit per-path tree entries), so a first-run repo (no existing file) and a refresh (file already present) are handled identically at the delivery layer -- no separate "does it exist yet" probe."live"action mode short-circuits before any GitHub write, rather than chaining four dependent writes through synthetic dry-run responses (mirrors the same guardmaybeEscalateModerationuses inagent-action-executor.ts).Part of #2993 (repo-doc generation roadmap). Closes #3000.
Scope
type(scope): short summaryConventional Commit format, for examplefix(api): restore profile access checks.CONTRIBUTING.mdand does not reintroduce GitHub Pages, VitePress,site/, orCNAME.Validation
git diff --checknpm run actionlint(not run -- no workflow files touched)npm run typechecknpm run test:coverage-- scoped to the two changed files: 100% statements/branches/functions/lines on bothsrc/review/repo-doc-render.tsandsrc/github/repo-doc-pr.ts. Full unshardedtest:coverageleft to CI per this repo's own "don't duplicate CI locally" convention; ran the affected suites directly instead (test/unit/repo-doc-render.test.ts,test/unit/repo-doc-pr.test.ts, plustest/unit/repo-profile.test.tsandtest/unit/no-direct-octokit.test.tsas regression checks -- 79/79 passing).npm run test:workers(not run -- no Cloudflare-Workers-pool-specific code touched)npm run build:mcp/npm run test:mcp-pack(not run -- no MCP package changes)npm run ui:openapi:check/npm run ui:lint/npm run ui:typecheck/npm run ui:build(not run -- noapps/gittensory-uichanges, no API/OpenAPI surface changed)npm audit --audit-level=moderate(not run locally -- no dependency changes; CI's dependency-review job covers this)If any required check was skipped, explain why:
validatejob runs them as a backstop.Safety
Errorand a non-Errorthrown-value test for the outer catch.)UI Evidencesection below with screenshots. (N/A -- no visible UI changes.)Notes
.gittensory.ymlsurface to enable/scope it per repo, feat(selfhost): scheduled + on-demand refresh for repo-doc generation #3003 adds scheduled/on-demand triggering, and fix(review): make repo-doc refresh diff-aware and preserve manual edits #3004 makes a repeat run diff-aware instead of just re-writing both files onto the same stable branch.gittensory/repo-docs) and the "reuse the already-open PR" check are deliberate: fix(review): make repo-doc refresh diff-aware and preserve manual edits #3004 is expected to push new commits onto this same branch rather than opening a second PR, so this PR does the minimum needed to make that safe (one branch, one PR, add-or-replace tree entries) without implementing the diffing itself.