feat(mcp): כלי docs_get_section — סקשן בודד מתיעוד RST במקום קובץ שלם - #3198
Conversation
כלי MCP חדש (public) שמחזיר סקשן בודד מקבצי ה-RST של אתר התיעוד, במקום למשוך קובץ שלם (environment-variables.rst הוא 77KB / 2242 שורות). מחזיר גם ניווט — עץ כותרות, breadcrumb, תת-סקשנים ושכנים — כדי שמודל שלא רואה את הקובץ לא יישאר בלי כלום. - services/rst_parser.py (מודול עצמאי): זיהוי כותרות דינמי פר-קובץ (underline ו-overline), עמידות ל-literal/code blocks (שורת === בתוך Development:: אינה כותרת), התאמה סלחנית לעברית, TOC, מועמדים לכפולות, והצעות ל-not-found. - mcp_server/docs_handlers.py: בונה מעל RepoBackend.get_file הקיים (reuse מלא של ref/policy/sync_in_progress), עם slug resolution ו-offset/max_chars לדפדוף. - server.py: רישום public (opt-in — בלי require_admin, לא ב-_ADMIN_TOOLS), תיאור שמסביר מתי להשתמש בו במקום get_repo_file. - ריפו ברירת מחדל CodeBot דרך MCP_DOCS_REPO (env var חדש) — תועד ב-rst וב-config_inspector. עקרון-על: לעולם לא רק "לא נמצא" — בלי section מחזיר TOC, section חסר מחזיר TOC+הצעות, כותרת כפולה מחזירה מועמדים עם breadcrumb. טסטים על RST אמיתי מהריפו (69 ירוקים): טבלה גדולה נחתכת עם offset תקין, literal block לא נחשב כותרת, כפול→מועמדים, לא-קיים→TOC, slug ⇄ נתיב מלא, ו-public לא ב-_ADMIN_TOOLS. הפארסר עצמאי לשימוש חוזר עתידי (docs_search / docs_lookup_config). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WNFuSyshwpRcxozVZEui5K
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
🧯 Dangerous deletes guard reportPolicy: see .cursorrules — dangerous deletions are blocked unless wrapped safely. Summary:
Flagged findings (file:line:snippet): Excluded matches (by path pattern) |
|
Warning Review limit reached
Next review available in: 25 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 (4)
📝 WalkthroughWalkthroughנוסף כלי MCP ציבורי בשם Changesכלי תיעוד MCP
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Client
participant codekeeper_docs_get_section
participant RepoBackend
participant services_rst_parser
Client->>codekeeper_docs_get_section: שליחת path ו-section
codekeeper_docs_get_section->>RepoBackend: get_file
RepoBackend-->>codekeeper_docs_get_section: תוכן קובץ RST
codekeeper_docs_get_section->>services_rst_parser: parse_document
services_rst_parser-->>codekeeper_docs_get_section: section, TOC וניווט
codekeeper_docs_get_section-->>Client: תשובת TOC או section
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
⏱️ Performance report(No performance test durations collected. Mark tests with |
📖 Documentation PreviewThe documentation has been built successfully!
To view locally:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@mcp_server/docs_handlers.py`:
- Around line 29-45: הקשח את זרימת codekeeper_docs_get_section כך ש-repo יאומת
מול MCP_DOCS_REPO או allowlist ייעודי לפני העברתו ל-RepoBackend.get_file. עדכן
את _resolve_docs_path לנרמל נתיבים באמצעות posixpath ולדחות נתיבי traversal או
נתיבים שאינם תחת docs/. ודא שרק נתיב מנורמל המתחיל ב-docs/ מועבר
ל-backend.get_file, כולל עבור קלט המכיל slash.
🪄 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: e718e094-fe01-43e2-8cf0-9f5d4c2ac715
📒 Files selected for processing (11)
FEATURE_SUGGESTIONS/FEATURE_MCP_CLAUDE_INTEGRATION.mddocs/environment-variables.rstdocs/mcp-server.rstmcp_server/README.mdmcp_server/docs_handlers.pymcp_server/server.pyservices/config_inspector_service.pyservices/rst_parser.pytests/test_mcp_docs_handlers.pytests/test_mcp_server_build.pytests/test_rst_parser.py
|
@claude is planning.. |
סבב review על הכלי הציבורי codekeeper_docs_get_section: - IDOR: repo מפורש מאומת מול allowlist (MCP_DOCS_REPO כ-CSV) לפני קריאה ל-backend. בלי זה כל משתמש מאומת יכול לקרוא .rst מכל ריפו ב-mirror (עוקף את ה-admin-gate). - Path: _resolve_docs_path מנרמל עם posixpath ודוחה traversal, נתיב מוחלט, וכל נתיב מחוץ ל-docs/ (כולל קלט עם slash כמו webapp/x) — הגנת שכבה מעל ה-backend. - תיאור MCP_DOCS_REPO עודכן (rst + config_inspector) כגבול אבטחה (CSV allowlist). טסטים: repo לא-מותר → repo_not_allowed (backend לא נקרא), נתיב מחוץ ל-docs/ ו-traversal → missing_path. 54 טסטים ירוקים. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WNFuSyshwpRcxozVZEui5K
|
@claude טנקס |
✨ תיאור קצר
כלי MCP חדש ציבורי
codekeeper_docs_get_sectionשמחזיר סקשן בודד מקבצי ה-RST של התיעוד במקום קובץ שלם. במקום למשוך אתenvironment-variables.rst(77KB / 2242 שורות) כדי לקרוא ערך אחד — מקבלים את הסקשן הרלוונטי + ניווט (עץ כותרות, breadcrumb, תת-סקשנים, שכנים). עיינתי ב-CodeBot Docs לפני המימוש.📦 שינויים עיקריים
פירוט:
services/rst_parser.py(מודול עצמאי, טהור): זיהוי כותרות דינמי פר-קובץ (לא קשיח====1), תמיכה ב-underline ו-overline+underline, עמידות ל-literal/code blocks — שורת===/---בתוךDevelopment::או.. code-block::אינה כותרת. התאמה סלחנית לעברית (רווחים/מקפים/case). מחזיר עץ כותרות, מועמדים לכותרת כפולה, והצעות ל-not-found.mcp_server/docs_handlers.py: בונה מעלRepoBackend.get_fileהקיים (reuse מלא של ברירת-ref, מדיניות סודות, ו-sync_in_progress). slug resolution (environment-variables⇄docs/environment-variables.rst) ו-offset/max_charsלדפדוף בסקשנים גדולים.mcp_server/server.py: רישום public (opt-in — הכלי לא קוראrequire_adminואינו ב-_ADMIN_TOOLS), עם תיאור שמסביר מפורשות מתי להשתמש בו במקוםget_repo_file.CodeBotדרך env var חדשMCP_DOCS_REPO(ניתן לעקוף פר-קריאה ב-repo).עקרון-על: לעולם לא רק "לא נמצא" — בלי
sectionמחזיר TOC; section חסר מחזיר TOC + הצעות; כותרת כפולה מחזירה מועמדים עם breadcrumb.🧪 בדיקות
test_rst_parser,test_mcp_docs_handlers,test_mcp_server_buildועוד), על RST אמיתי מהריפו: הטבלה המרכזית נחתכת עםnext_offsetתקין,Development::לא נחשב כותרת, כפול→מועמדים, לא-קיים→TOC, slug ⇄ נתיב מלא, ו-public לא ב-_ADMIN_TOOLS.py_compileנקי; RST lint (docutils) ללא בעיות מבנה.🧪 בדיקות נדרשות ב‑PR
📝 סוג שינוי
✅ צ'קליסט
docs/mcp-server.rst,mcp_server/README.md,FEATURE_MCP_CLAUDE_INTEGRATION.mddocs/environment-variables.rstוגםservices/config_inspector_service.py🧩 השפעות/סיכונים
כלי קריאה-בלבד, ציבורי (כל משתמש מאומת, לא admin — התיעוד ציבורי ממילא). נשען על אותו mirror של כלי הריפו הקיימים; אם CodeKeeper לא ב-mirror, מוחזר
not_foundברור. אין מיגרציות DB, אין שינוי בכלים קיימים. הכלי נרשם רק כש-repo_backendפעיל.🔗 קישורים
services/rst_parser.py) עצמאי לשימוש חוזר עתידי (docs_search/docs_lookup_config).🧯 סיכון / החזרה לאחור (Rollback)
git revertשל הקומיט. אין schema/מיגרציה; קבצים חדשים (rst_parser,docs_handlers) עצמאיים — ביטול בטוח ומיידי.Generated by Claude Code