Skip to content

Conversation

@philwinder
Copy link
Member

Description

This PR introduces a design document outlining the backend infrastructure for a new MCP tool that provides contextual API documentation. It details how to enhance the slicer to extract public API methods with hierarchical context (package, class), identify related methods, and dynamically assemble "live views" of the API. The design proposes extending the existing SnippetV2 model and integrating a new api_documentation() MCP tool.

Related Issue

N/A

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (This PR adds a new design document)
  • Other (please describe)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

Additional Notes

This PR introduces a design document for the api_documentation MCP tool. It does not include any code implementation. The document details the proposed architecture, including enhancements to the slicer for API extraction, extension of the SnippetV2 model, and the approach for dynamic API view generation.


Open in Cursor Open in Web

Co-authored-by: phil+authenticator.cursor.sh <[email protected]>
@cursor
Copy link

cursor bot commented Sep 29, 2025

Cursor Agent can help with this pull request. Just @cursor in comments and I'll start working on changes in this branch.
Learn more about Cursor Agents

@github-actions
Copy link

github-actions bot commented Sep 29, 2025

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/kodit
   _version.py18475%15–19
   app.py71710%3–168
   cli.py511767%57–84, 99–101, 107
   cli_utils.py25250%3–67
   config.py1092869%24, 163, 166–169, 182, 191–193, 197–199, 206–209, 229–233, 239–247
   database.py422635%25–62, 71, 76–84, 88–89, 93
   log.py1212474%56, 70, 133–137, 147–>151, 196–>189, 198–199, 204–214, 233, 235–244, 250–>249, 254–257, 267
   mcp.py512058%51–55, 157–198, 203, 222
   middleware.py35350%3–75
src/kodit/application/factories
   reporting_factory.py211148%20–24, 31–36
   server_factory.py1479328%82–109, 113–115, 119–123, 127–131, 135–137, 141–150, 154–156, 160–164, 168–172, 176–198, 202, 206–210, 217–219, 225–227, 231–235, 239–243, 247–251, 255–260, 264–268, 272–274, 278–287, 291–295, 299–303, 307–311
src/kodit/application/services
   code_search_application_service.py513231%30, 44, 60–66, 70–138
   commit_indexing_application_service.py23616127%101–112, 118, 127–159, 163–170, 174–219, 234, 243–>253, 253–>268, 287–369, 375–382, 396–423, 427–478, 484–527, 533–541
   indexing_worker_service.py62620%3–115
   queue_service.py28481%57–66
   reporting.py40583%13, 72, 84, 88, 102
   sync_scheduler.py392727%25–29, 33–35, 39–45, 49–64, 68–78
src/kodit/domain
   errors.py110%4
   protocols.py1311092%36, 40, 44, 48, 52, 56, 64, 72, 78, 82
   value_objects.py2821196%72, 101–126, 131, 136–139, 330, 646, 650
src/kodit/domain/entities
   __init__.py1321686%22, 39, 80, 93, 103–107, 238–240, 244–245, 261, 267–268
   git.py1211288%27, 32–34, 52, 67, 72–76, 125–>142, 135, 163, 168
src/kodit/domain/factories
   git_repo_factory.py15193%66
src/kodit/domain/services
   bm25_service.py36292%59, 116
   embedding_service.py39196%92
   git_repository_service.py1847653%75–108, 128–>126, 153–157, 165–175, 191, 212–214, 220–230, 239–259, 268–285, 291–297, 312–329, 333–337, 424
   git_service.py1501500%3–300
   task_status_query_service.py880%3–17
src/kodit/infrastructure/api/client
   __init__.py440%3–7
   base.py39390%3–100
   exceptions.py440%4–19
   generated_endpoints.py660%7–23
   search_client.py13130%3–86
src/kodit/infrastructure/api/middleware
   auth.py13130%3–31
src/kodit/infrastructure/api/v1
   dependencies.py51510%3–155
src/kodit/infrastructure/api/v1/routers
   commits.py55550%3–258
   queue.py16160%3–64
   repositories.py87870%3–282
   search.py11110%3–58
src/kodit/infrastructure/api/v1/schemas
   commit.py45450%3–96
   context.py660%3–13
   queue.py16160%3–35
   repository.py55550%3–128
   search.py94940%3–222
   snippet.py27270%3–58
   tag.py13130%3–31
   task_status.py20200%3–41
src/kodit/infrastructure/bm25
   local_bm25_repository.py762465%22–23, 46–57, 76–77, 80–81, 88–89, 102–103, 107, 112, 137–>135, 150
   vectorchord_bm25_repository.py895532%118–120, 124–131, 135–139, 143–148, 152–154, 157–161, 165–202, 206–227, 234–237
src/kodit/infrastructure/cloning/git
   git_python_adaptor.py2338859%19–37, 42–59, 107–117, 158–>154, 169–171, 208, 240–249, 258–287, 305–313, 325–329, 362, 376–381, 407–411, 430–435, 445–>exit, 463–465
   working_copy.py53392%48–55
src/kodit/infrastructure/embedding
   embedding_factory.py39776%64–65, 74–77, 85–86
   local_vector_search_repository.py352032%50–70, 75–88, 97
   vectorchord_vector_search_repository.py997221%100–105, 109–115, 119–120, 124–161, 167–202, 206–240, 249–260, 263–272
src/kodit/infrastructure/embedding/embedding_providers
   litellm_embedding_provider.py61099%152–>156
   local_embedding_provider.py53292%16–17, 50–>60, 64–>78
src/kodit/infrastructure/enrichment
   litellm_enrichment_provider.py63592%99–103, 118–119
src/kodit/infrastructure/git
   git_utils.py12120%3–32
src/kodit/infrastructure/ignore
   ignore_pattern_provider.py30300%3–69
src/kodit/infrastructure/indexing
   fusion_service.py191416%26–48
src/kodit/infrastructure/mappers
   git_mapper.py531077%59–75, 87, 112
   snippet_mapper.py25962%55, 65–75, 83, 99
   task_mapper.py12186%23
   task_status_mapper.py18845%16, 42, 72–85
src/kodit/infrastructure/reporting
   db_progress.py11464%17–19, 23
   log_progress.py18945%18–20, 24–40
   telemetry_progress.py9278%15, 19
src/kodit/infrastructure/slicing
   slicer.py48040111%150, 169–242, 246–255, 259–277, 283–305, 309–313, 317–319, 324–339, 343, 347, 353–363, 367–370, 376–386, 392–395, 399–405, 409–421, 425–431, 435, 439–440, 444–449, 453–459, 463–471, 475–481, 485–494, 498–504, 508–513, 517–522, 526–529, 533–536, 542–547, 551–559, 569–627, 639–644, 659–686, 692–720, 728, 738–759, 765–777, 781–795, 801–817, 823–843, 847–877, 882, 888–897, 907–929
src/kodit/infrastructure/sqlalchemy
   embedding_repository.py821184%48–51, 60, 66–72, 169, 193, 201–>209
   entities.py2452390%37, 63, 180–192, 457–461, 481–483
   git_branch_repository.py1054255%30–79, 118–>121, 139, 166–189, 194, 209–216, 230–>exit, 239–245, 258–263
   git_commit_repository.py1422878%89–>92, 120–142, 226–231, 237–270, 295–>293, 307–>exit, 335
   git_repository.py1042671%55–62, 91–99, 125–139, 208, 218, 220, 226–235
   git_tag_repository.py1024155%30–77, 114–>117, 135, 162–185, 190, 203–210, 224–>exit, 233–239, 252–257
   snippet_v2_repository.py1513377%126, 209–210, 225–230, 244–275, 284–310, 359, 440–450
   task_repository.py591374%52–62, 66–72, 82
   task_status_repository.py503527%20, 28–30, 35–68, 74–83, 87–91
   unit_of_work.py30960%29–>exit, 41–43, 47–49, 53–55
src/kodit/migrations
   env.py30300%3–85
src/kodit/migrations/versions
   04b80f802e0c_foreign_key_review.py23230%10–98
   7c3bbc2ab32b_add_embeddings_table.py15150%10–54
   7f15f878c3a1_add_new_git_entities.py1401400%10–689
   9cf0e87de578_add_queue.py15150%10–46
   9e53ea8bb3b0_add_authors.py33330%10–102
   4073b33f9436_add_file_processing_flag.py11110%10–35
   4552eb3f23ce_add_summary.py11110%10–33
   85155663351e_initial.py23230%10–97
   b9cd1c3fd762_add_task_status.py21210%10–76
   c3f5137d30f5_index_all_the_things.py21210%10–49
   f9e5ef5e688f_add_git_commits_number.py15150%10–43
src/kodit/utils
   dump_config.py1821820%3–361
   dump_openapi.py24240%3–38
   generate_api_paths.py40400%4–135
   path_utils.py382039%28–57, 72, 77, 81
TOTAL6168316945% 

Tests Skipped Failures Errors Time
287 1 💤 0 ❌ 0 🔥 58.606s ⏱️

Co-authored-by: phil+authenticator.cursor.sh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants