Runner¶
Runner
¶
Runner class for orchestrating documentation generation and updates.
This class manages the entire process of analyzing a project's code, generating documentation using a language model, and committing changes to a Git repository. It handles tasks such as identifying components, creating documentation stubs, generating detailed descriptions, and maintaining consistency between the codebase and the generated documentation.
Class Methods: - init:
Source code in repo_agent/runner.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
|
__init__()
¶
Initializes the processing pipeline by loading project settings, preparing the repository, and setting up tools for analysis and interaction. It handles initial metadata creation or loading from existing checkpoints, ensuring a consistent view of the project's structure and content.
This constructor sets up the necessary components for processing project documentation, including loading settings, copying the mkdocs configuration file, initializing project and change detectors, setting up a chat engine, and creating or loading meta-information about the project.
Returns:
Type | Description |
---|---|
None |
Source code in repo_agent/runner.py
convert_path_to_dot_notation(path, class_)
¶
Transforms a file system path into a structured string representation suitable for identifying code elements.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
Path
|
The path to the file or directory. |
required |
class_
|
str
|
The name of the class within the file. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
A string representing the dot notation path, formatted as '::: |
Source code in repo_agent/runner.py
generate_doc()
¶
Creates documentation for the project by processing a task list in parallel threads and updating markdown files. It manages task persistence, tracks progress, and handles potential errors during generation.
Returns:
Type | Description |
---|---|
None |
Source code in repo_agent/runner.py
generate_doc_for_a_single_item(doc_item)
¶
Processes a single documentation item, generating content with a chat engine and updating its status. It respects ignore lists to avoid unnecessary generation and handles potential errors gracefully by logging them and ensuring an empty entry in the output. A checkpoint save occurs after successful or failed processing.
This method checks if the DocItem needs to be generated based on ignore lists, generates the documentation using a chat engine, appends it to the DocItem's content, updates the item status and performs a checkpoint save. It handles potential exceptions during document generation by logging them and appending an empty string to the content.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc_item
|
DocItem
|
The DocItem for which documentation needs to be generated. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in repo_agent/runner.py
generate_main_idea(docs)
¶
Extracts the core concept of a project from its documentation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
docs
|
The input documents used to generate the main idea. |
required |
Returns:
Type | Description |
---|---|
The main project idea extracted from the documents. |
Source code in repo_agent/runner.py
generate_main_project_idea(docs)
¶
Synthesizes a cohesive project concept by analyzing the functionality and relationships between software components.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
docs
|
List[Dict]
|
A list of dictionaries, each detailing a component's name, description, and position within the system architecture. |
required |
Returns:
Name | Type | Description |
---|---|---|
str |
A concise summary outlining the overall project direction derived from the component details. Args: docs: A list of dictionaries, where each dictionary represents a component and contains its name, description, and hierarchical path. Returns: str: The generated project idea as a string. |
Source code in repo_agent/runner.py
get_all_pys(directory)
¶
No valid docstring found.
Source code in repo_agent/runner.py
get_top_n_components(doc_item)
¶
Extracts and formats top-level classes from a DocItem, excluding files matching specified ignore patterns. Returns a list of markdown strings with links for each class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc_item
|
DocItem
|
The DocItem object to extract components from. |
required |
Returns:
Name | Type | Description |
---|---|---|
list |
A list of markdown strings and links representing the top-level components found within the DocItem, excluding those matching ignore patterns. |
Source code in repo_agent/runner.py
git_commit(commit_message)
¶
Records changes to the repository with a descriptive message.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
commit_message
|
The message for the commit. |
required |
Returns:
Type | Description |
---|---|
None |
Source code in repo_agent/runner.py
markdown_refresh()
¶
Rebuilds markdown files in the target repository, generating documentation from code structure and docstrings. It processes directories, files, and repositories to create up-to-date content, including retry logic for file writing.
This method rebuilds the markdown files in the target repository, ensuring they are up-to-date with the latest code structure and docstrings. It handles directories, files, and repositories differently to generate appropriate content. It also includes retry logic for file writing operations.
Returns:
Type | Description |
---|---|
None |
Source code in repo_agent/runner.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 |
|
run()
¶
No valid docstring found.
Source code in repo_agent/runner.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 |
|
search_tree(doc, path)
¶
Recursively traverses the document tree to locate a specific path, returning the corresponding DocItem if found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
doc
|
DocItem
|
The root DocItem of the tree to search. |
required |
path
|
str
|
The path to search for within the tree. |
required |
Returns:
Name | Type | Description |
---|---|---|
DocItem |
The DocItem at the specified path, or None if not found. |
Source code in repo_agent/runner.py
summarize_modules()
¶
No valid docstring found.
Source code in repo_agent/runner.py
update_modules(module)
¶
Recursively updates the documentation for a module and its submodules by appending the module summary to the corresponding location in the documentation tree and marking it as up-to-date.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
module
|
A dictionary containing information about the module, including its path and summary. It also contains a list of submodules under the 'submodules' key. |
required |
Returns:
Type | Description |
---|---|
None |