Spaces:
Configuration error
Configuration error
File size: 44,182 Bytes
33a4fd2 c4cf57a 33a4fd2 c4cf57a 1b7e00b 33a4fd2 c4cf57a 33a4fd2 c4cf57a 33a4fd2 8904f7b c4cf57a 33a4fd2 c4cf57a 33a4fd2 c4cf57a 33a4fd2 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a 33a4fd2 c4cf57a 33a4fd2 da206c8 33a4fd2 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a da206c8 c4cf57a 41ad1b0 33a4fd2 41ad1b0 33a4fd2 41ad1b0 33a4fd2 41ad1b0 33a4fd2 41ad1b0 33a4fd2 8904f7b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 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 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 | # API Reference
All endpoints are hosted at `http://127.0.0.1:8001`. Every route is also available under the `/api/v1/` versioned prefix.
---
## Authentication
When the application is configured with an `API_KEY` (via the environment variable), all expensive endpoints (indexing, ingestion, chat, issues, reports) require authentication.
You must supply the API key in one of the following HTTP headers:
1. **X-API-Key Header**:
```http
X-API-Key: your_secret_api_key_here
```
2. **Authorization Bearer Token Header**:
```http
Authorization: Bearer your_secret_api_key_here
```
Failed authentication requests return a `401 Unauthorized` response:
```json
{
"detail": "Unauthorized. Invalid or missing API key."
}
```
---
## Navigation
- [System Status & Utility](#system-status--utility)
- [Repository Processing](#repository-processing)
- [Semantic Querying](#semantic-querying)
- [Repository Chat (v2)](#repository-chat-v2)
- [Architecture Intelligence](#architecture-intelligence)
- [Interactive Graph Intelligence](#interactive-graph-intelligence)
- [Symbol Intelligence](#symbol-intelligence)
- [Call Graph Intelligence](#call-graph-intelligence)
- [API Surface Intelligence](#api-surface-intelligence)
- [Git History & Churn](#git-history--churn)
- [PR & Architecture Drift Intelligence](#pr--architecture-drift-intelligence)
- [Dead Code Intelligence](#dead-code-intelligence)
- [Repository Intelligence Report](#repository-intelligence-report)
- [AI Engineering Advisor](#ai-engineering-advisor)
- [Autonomous Engineering Agent (AEA²)](#autonomous-engineering-agent-aea2)
- [Intelligent IDE Workspace](#intelligent-ide-workspace)
---
## System Status & Utility
### GET /health
Returns the static configuration health — active LLM provider, model, embedding provider, and vector DB. This endpoint makes no external calls and is suitable for load balancer health probes.
#### Response (200 OK)
```json
{
"backend": "online",
"llm_provider": "gemini",
"llm_model": "gemini-2.5-flash",
"embedding_provider": "BAAI/bge-small-en-v1.5",
"vector_db": "chromadb",
"status": "healthy"
}
```
---
### GET /metrics
Returns application metrics in Prometheus text format. Exempt from rate limiting. Available at both `/metrics` and `/api/v1/metrics`.
#### Request Example
```bash
curl http://127.0.0.1:8001/metrics
```
#### Response (200 OK — `text/plain; version=0.0.4`)
```
# HELP http_requests_total Total number of HTTP requests.
# TYPE http_requests_total counter
http_requests_total{method="GET",path="/health",status="200"} 12.0
# HELP active_requests_count Total number of active requests.
# TYPE active_requests_count gauge
active_requests_count 0.0
# HELP build_duration_seconds Build pipeline durations in seconds.
# TYPE build_duration_seconds summary
build_duration_seconds_sum{repository="fastapi/fastapi"} 45.123
build_duration_seconds_count{repository="fastapi/fastapi"} 1
# HELP cache_hits_total Total number of analysis cache hits.
# TYPE cache_hits_total counter
cache_hits_total{cache_key="symbols"} 3.0
# HELP cache_size Total number of entries currently in the cache.
# TYPE cache_size gauge
cache_size 12.0
```
---
### GET /api/repos/examples
Fetch a list of pre-configured example repositories designed for testing.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/repos/examples
```
#### Response (200 OK)
```json
[
{
"name": "google/guava",
"url": "https://github.com/google/guava",
"tech_stack": ["Java", "Maven"],
"description": "Google core libraries for Java."
},
{
"name": "fastapi/fastapi",
"url": "https://github.com/fastapi/fastapi",
"tech_stack": ["Python", "Pydantic", "Starlette"],
"description": "High performance, easy to learn, fast to code, ready for production API framework."
},
{
"name": "vercel/next.js",
"url": "https://github.com/vercel/next.js",
"tech_stack": ["JavaScript", "TypeScript", "React", "Rust"],
"description": "The React Framework for the Web."
}
]
```
---
### GET /api/repos/recent
Fetch a list of repositories processed during the current server session, loaded from the persisted store.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/repos/recent
```
#### Response (200 OK)
```json
[
{
"name": "Ankita15k/GitNest",
"url": "https://github.com/Ankita15k/GitNest",
"tech_stack": ["JavaScript", "TypeScript"],
"analyzed_at": "Just now"
}
]
```
---
## Repository Processing
### POST /api/analyze (SSE Stream)
Trigger a full repository cloning, language parsing, code chunking, indexing, and architecture mapping pipeline. This endpoint streams real-time progress events using the `text/event-stream` mime-type.
#### Request Schema (AnalyzeRequest)
- `url` (string, required): GitHub repository URL.
- `branch` (string, optional): Git branch or ref. Defaults to `"main"`.
- `model` (string, optional): LLM model variant to use. Defaults to `"deepseek-ai/deepseek-v4-flash"`.
```json
{
"url": "https://github.com/owner/repository",
"branch": "main",
"model": "deepseek-ai/deepseek-v4-flash"
}
```
#### Request Example
```bash
curl -N -X POST http://127.0.0.1:8001/api/analyze \
-H "Content-Type: application/json" \
-H "Accept: text/event-stream" \
-d '{
"url": "https://github.com/Ankita15k/GitNest",
"branch": "main"
}'
```
#### SSE Stream Events Progress Output
```
data: {"status": "cloning", "message": "Cloning repository from GitHub..."}
data: {"status": "cloned", "message": "✓ Repository cloned successfully"}
data: {"status": "detecting", "message": "Detecting languages and frameworks..."}
data: {"status": "detected", "message": "✓ Technologies detected: ['JavaScript', 'TypeScript']"}
data: {"status": "chunking", "message": "START: chunking"}
data: {"status": "chunking", "message": "END: chunking"}
data: {"status": "embedding", "message": "START: embeddings"}
data: {"status": "embedding", "message": "END: embeddings"}
data: {"status": "chroma", "message": "START: chroma indexing"}
data: {"status": "chroma", "message": "END: chroma indexing"}
data: {"status": "building_graph", "message": "Building file dependency graph..."}
data: {"status": "graph_built", "message": "✓ Dependency graph: 328 files parsed, 1440 edges", "files_parsed": 328, "dependencies_found": 1440, "entry_points": ["backend/src/index.js"]}
data: {"status": "analyzed", "message": "✓ Architecture analyzed"}
data: {"status": "complete", "message": "✓ Repository analysis complete!"}
data: {"status": "done", "repo": "Ankita15k/GitNest"}
```
---
### POST /api/index
Clones, chunks, and indexes a repository's vector embeddings in ChromaDB, without building structural dependency graphs.
#### Request Schema (IndexRequest)
- `repo_url` (string, required): GitHub repository URL.
```json
{
"repo_url": "https://github.com/owner/repository"
}
```
#### Response (200 OK)
```json
{
"status": "indexed",
"files": 328,
"chunks": 1549
}
```
---
### GET /api/analysis/{owner}/{repo_name}
Fetch the complete metadata results of a repository analysis.
#### Response (200 OK)
```json
{
"analysis": {
"structure": {
".": ["README.md", "package.json"],
"src": ["app.js", "server.js"]
},
"dependencies": ["express", "cors", "jsonwebtoken"],
"tech_stack": ["JavaScript", "TypeScript"],
"metadata": {
"owner": "Ankita15k",
"name": "GitNest",
"local_path": "C:\\Users\\Varshith Reddy\\.repo_intelligence\\cloned_repos\\Ankita15k_GitNest"
}
},
"architecture": {
"summary": "GitNest is a full-stack Git hosting dashboard built with Node.js and Express...",
"reading_order": [
"backend/src/index.js",
"backend/src/app.js"
],
"relationships": [
{
"source": "backend/src/index.js",
"target": "backend/src/app.js",
"relationship_type": "imports",
"description": "Imports app instance to launch listener server."
}
]
}
}
```
---
## Semantic Querying
### POST /api/retrieve
Query the vector space index directly for a repository using BGE embeddings and generate a grounded LLM response.
#### Request Schema (RetrieveRequest)
- `repo` (string, required): Repository identifier (owner/repo).
- `question` (string, required): Question query.
```json
{
"repo": "owner/repository",
"question": "How is authentication handled?"
}
```
#### Response (200 OK)
```json
{
"answer": "Authentication is implemented using JWT tokens inside authMiddleware.js...",
"sources": [
{
"file": "backend/src/middleware/authMiddleware.js",
"content": "const token = req.headers.authorization.split(' ')[1]; ...",
"score": 0.92
}
]
}
```
---
### POST /api/chat (SSE Stream)
See [Repository Chat (v2) → POST /api/chat](#post-apichat) for the full request/response specification including `session_id`, SSE event format, and streaming behavior.
---
### POST /api/issues/map
See [Repository Chat (v2) → POST /api/issues/map](#post-apiissuesmap) for the full request/response specification.
---
---
## Architecture Intelligence
### POST /api/architecture/build
Trigger Tree-sitter AST parsing over local cloned repository files and construct the dependency NetworkX graph.
#### Request Schema (ArchitectureBuildRequest)
- `repo` (string, required): Repository identifier (owner/repo).
```json
{
"repo": "owner/repository"
}
```
#### Response (200 OK)
```json
{
"status": "built",
"repo": "Ankita15k/GitNest",
"files_parsed": 328,
"dependencies_found": 1440,
"entry_points": [
"backend/src/index.js"
]
}
```
---
### GET /api/architecture/{owner}/{repo_name}
Fetch the generated architecture summary, reading order, and relationship schemas.
#### Response (200 OK - ArchitectureSummary)
```json
{
"summary": "GitNest is a full-stack Git dashboard using Express and local git hooks...",
"reading_order": [
"backend/src/index.js",
"backend/src/app.js"
],
"relationships": [
{
"source": "backend/src/index.js",
"target": "backend/src/app.js",
"relationship_type": "imports",
"description": "Instantiates app config schemas."
}
]
}
```
---
### GET /api/architecture/{owner}/{repo_name}/graph
Retrieve React Flow-compatible node and edge datasets for visualization.
#### Query Parameters
- `q` (string, optional): Substring filter for file names/module paths.
#### Response (200 OK)
```json
{
"nodes": [
{
"id": "backend/src/index.js",
"data": { "label": "index.js" },
"position": { "x": 120, "y": 80 },
"style": { "background": "#1e293b", "color": "#f8fafc" }
}
],
"edges": [
{
"id": "e_backend/src/index.js_backend/src/app.js",
"source": "backend/src/index.js",
"target": "backend/src/app.js",
"animated": true
}
]
}
```
---
### POST /api/reading-order
Generate an optimal, ranked file list for onboarding new developers based on graph centrality metrics.
#### Request Schema (ReadingOrderRequest)
- `repo` (string, required): Repository identifier (owner/repo).
```json
{
"repo": "owner/repository"
}
```
#### Response (200 OK - ReadingOrder)
```json
{
"repo": "Ankita15k/GitNest",
"ordered_files": [
{
"rank": 1,
"file_path": "backend/src/index.js",
"reason": "Primary application entry point initializing server configurations.",
"tier": "entry_point",
"score": 150.0
}
],
"reasoning": [
"Timeline starts with detected application entry points.",
"Order prioritizes modules with high degree centrality scores."
],
"estimated_reading_time": 45,
"total_files_ranked": 328
}
```
---
### POST /api/impact-analysis
Predict downstream affected modules and components resulting from a proposed change.
#### Request Schema (ImpactAnalysisRequest)
- `repo` (string, required): Repository identifier (owner/repo).
- `issue` (string, required): Change request or GitHub issue text.
```json
{
"repo": "Ankita15k/GitNest",
"issue": "Add API key authentication"
}
```
#### Response (200 OK - ImpactAnalysis)
```json
{
"repo": "Ankita15k/GitNest",
"issue_text": "Add API key authentication",
"directly_affected_files": [
"backend/src/middleware/authMiddleware.js"
],
"indirectly_affected_files": [
"backend/src/routes/auth.routes.js",
"backend/src/app.js"
],
"affected_components": [
"Authentication",
"API Layer"
],
"risk_level": "medium",
"estimated_file_count": 3,
"dependency_paths": [
{
"path": [
"backend/src/middleware/authMiddleware.js",
"backend/src/routes/auth.routes.js",
"backend/src/app.js"
]
}
],
"confidence": 85
}
```
---
---
## Repository Chat (v2)
### GET /api/chat/health
Live provider health diagnostic. Runs a health check against all configured LLM providers. Use for operational monitoring — not load balancer probes (has 200–400 ms latency due to live API calls).
#### Request Example
```bash
curl http://127.0.0.1:8001/api/chat/health
```
#### Response (200 OK)
```json
{
"status": "ok",
"provider": "gemini",
"api_key_present": true,
"authenticated": true,
"healthy": true,
"latency_ms": 234.1,
"error_type": null,
"error_message": null,
"recommendation": null,
"circuit_states": [
{"name": "gemini", "circuit_state": "CLOSED", "failure_count": 0}
],
"all_providers": {
"gemini": {
"provider": "gemini",
"model": "gemini-2.5-flash",
"healthy": true,
"authenticated": true,
"latency_ms": 234.1,
"error_type": null,
"error_message": null,
"recommendation": null
}
},
"timestamp": 1750000000.0
}
```
`status` values: `ok` (all configured providers healthy), `degraded` (at least one healthy), `unhealthy` (none healthy), `error` (health check failed).
#### Status Codes
| Code | Meaning |
|------|---------|
| 200 | Health check ran — inspect `status` field for result |
| 500 | Health check itself failed unexpectedly |
---
### POST /api/chat/reload
Hot-reload the LLM provider without restarting the server. Call this after updating `GEMINI_API_KEY` or `DEEPSEEK_API_KEY` in `.env`. Resets the `ProviderFactory` cache, `ProviderManager`, and all circuit breakers, then verifies the new provider with a test call.
#### Request Example
```bash
curl -X POST http://127.0.0.1:8001/api/chat/reload
```
#### Response (200 OK)
```json
{
"status": "ok",
"message": "LLM provider reloaded successfully. Chat is ready.",
"test_response": "ready"
}
```
#### Error Response (500)
```json
{
"status": "error",
"detail": "Provider loaded but test call failed: 401 UNAUTHENTICATED"
}
```
---
### POST /api/chat
Interactive streaming chat over a repository's codebase context. Streams token-by-token via SSE.
The v2 pipeline runs: conversation memory → intent detection → intent routing → weighted retrieval (top-15 reranked to top-5) → context assembly → LLM streaming → memory update.
#### Request Schema (ChatRequest)
- `repo` (string, required): Repository identifier (`owner/repo`)
- `message` (string, required): User message
- `history` (list, optional): Conversation history turns
- `session_id` (string, optional): Session identifier for conversation memory. Defaults to `"default"`
```json
{
"repo": "fastapi/fastapi",
"message": "How does dependency injection work?",
"history": [
{"role": "user", "content": "What is the entry point?"},
{"role": "assistant", "content": "The entry point is fastapi/applications.py..."}
],
"session_id": "user-abc-session-1"
}
```
#### SSE Stream Output
```
data: {"text": "FastAPI"}
data: {"text": "'s "}
data: {"text": "dependency "}
data: {"text": "injection "}
data: {"text": "uses "}
data: {"text": "the "}
data: {"text": "Depends() "}
data: {"text": "system..."}
data: {"sources": ["fastapi/dependencies/utils.py", "fastapi/routing.py"], "confidence": 91, "fallback_mode": false, "status": "done"}
```
The final SSE event always includes `"status": "done"`.
#### Status Codes
| Code | Meaning |
|------|---------|
| 200 | SSE stream opened |
| 400 | `repo` field is empty |
| 422 | Request body validation failed |
---
### POST /api/issues/map
Map a GitHub issue to relevant source files and generate a grounded implementation plan. Uses exactly 2 LLM calls: one to parse the issue and rank files, one to generate the implementation plan. Results are cached by `sha256(issue_text)`.
#### Request Schema (IssueMapRequest)
- `repo` (string, required): Repository identifier (`owner/repo`)
- `title` (string, optional): GitHub issue title
- `description` (string, optional): GitHub issue body
- `issue` (string, optional): Combined issue text (alternative to title + description)
```json
{
"repo": "fastapi/fastapi",
"title": "Dependency injection fails with async generators",
"description": "When using yield-based dependencies with async context managers, cleanup is not called."
}
```
#### Response (200 OK)
```json
{
"issue_summary": "Async generator dependencies do not trigger cleanup",
"issue_type": "bug",
"relevant_files": [
"fastapi/dependencies/utils.py",
"fastapi/concurrency.py"
],
"affected_components": ["Services", "API Layer"],
"implementation_plan": [
{
"step_number": 1,
"description": "In fastapi/dependencies/utils.py, locate solve_dependencies() and ensure async generator cleanup is awaited.",
"files_to_modify": ["fastapi/dependencies/utils.py"]
}
],
"complexity": "medium",
"confidence": 84,
"verified": true,
"sources": ["fastapi/dependencies/utils.py", "fastapi/concurrency.py"]
}
```
---
## Interactive Graph Intelligence
### GET /api/graph/{owner}/{repo}/full
Retrieve the full dependency graph for visualization in the interactive layout.
#### Query Parameters
- `q` (string, optional): Query substring to filter node files.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/graph/VarshithReddy2006/Repo-Intelligence-Agent/full?q=service
```
#### Response (200 OK)
```json
{
"nodes": [
{
"id": "services/symbol_service.py",
"label": "symbol_service.py",
"category": "file",
"language": "python"
}
],
"edges": [
{
"source": "services/symbol_service.py",
"target": "models/symbol.py",
"relationship": "imports"
}
]
}
```
---
### GET /api/graph/{owner}/{repo}/neighbors/{node_path:path}
Retrieve the immediate neighborhood of a single file node.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/graph/VarshithReddy2006/Repo-Intelligence-Agent/neighbors/services/symbol_service.py
```
#### Response (200 OK)
```json
{
"nodes": [
{ "id": "services/symbol_service.py", "label": "symbol_service.py", "category": "focus", "language": "python" },
{ "id": "backend/api.py", "label": "api.py", "category": "predecessor", "language": "python" },
{ "id": "models/symbol.py", "label": "symbol.py", "category": "successor", "language": "python" }
],
"edges": [
{ "source": "backend/api.py", "target": "services/symbol_service.py", "relationship": "imports" },
{ "source": "services/symbol_service.py", "target": "models/symbol.py", "relationship": "imports" }
]
}
```
---
### GET /api/graph/{owner}/{repo}/trace/{node_path:path}
Trace all reachable nodes in the dependency graph starting from a node.
#### Query Parameters
- `direction` (string, optional): Direction of walk. Options: `forward`, `backward`, `both`. Defaults to `both`.
- `depth` (int, optional): BFS walk limit. Minimum 1, Maximum 12. Defaults to 6.
#### Request Example
```bash
curl "http://127.0.0.1:8001/api/graph/VarshithReddy2006/Repo-Intelligence-Agent/trace/services/symbol_service.py?direction=backward&depth=3"
```
#### Response (200 OK)
```json
{
"nodes": [
{ "id": "services/symbol_service.py", "label": "symbol_service.py", "category": "focus", "language": "python" },
{ "id": "backend/api.py", "label": "api.py", "category": "dependent", "language": "python" }
],
"edges": [
{ "source": "backend/api.py", "target": "services/symbol_service.py", "relationship": "imports" }
]
}
```
---
### GET /api/graph/{owner}/{repo}/search
Search for nodes by label or file path, returning matches highlighted with their immediate context.
#### Query Parameters
- `q` (string, required): Query term.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/graph/VarshithReddy2006/Repo-Intelligence-Agent/search?q=dead_code
```
#### Response (200 OK)
```json
{
"nodes": [
{ "id": "services/dead_code_service.py", "label": "dead_code_service.py", "category": "file", "language": "python", "highlighted": true },
{ "id": "backend/api.py", "label": "api.py", "category": "file", "language": "python", "highlighted": false }
],
"edges": [
{ "source": "backend/api.py", "target": "services/dead_code_service.py", "relationship": "imports" }
]
}
```
---
## Symbol Intelligence
### GET /api/symbols/{owner}/{repo}/file/{file_path:path}
Retrieve all AST symbols (classes, functions, methods) defined in a file.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/symbols/VarshithReddy2006/Repo-Intelligence-Agent/file/services/symbol_service.py
```
#### Response (200 OK)
```json
{
"file": "services/symbol_service.py",
"repo": "VarshithReddy2006/Repo-Intelligence-Agent",
"symbol_count": 2,
"symbols": [
{
"name": "SymbolService",
"type": "class",
"file_path": "services/symbol_service.py",
"line_number": 26,
"language": "python",
"parent_class": null
},
{
"name": "get_file_symbols",
"type": "function",
"file_path": "services/symbol_service.py",
"line_number": 95,
"language": "python",
"parent_class": "SymbolService"
}
]
}
```
---
### GET /api/symbols/{owner}/{repo}/definition/{symbol_name}
Find the definition site of a symbol.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/symbols/VarshithReddy2006/Repo-Intelligence-Agent/definition/SymbolService
```
#### Response (200 OK)
```json
{
"symbol": "SymbolService",
"repo": "VarshithReddy2006/Repo-Intelligence-Agent",
"definition": {
"name": "SymbolService",
"type": "class",
"file_path": "services/symbol_service.py",
"line_number": 26,
"language": "python",
"parent_class": null
}
}
```
---
### GET /api/symbols/{owner}/{repo}/references/{symbol_name}
Search for references to a symbol across the repository symbol index.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/symbols/VarshithReddy2006/Repo-Intelligence-Agent/references/SymbolService
```
#### Response (200 OK)
```json
{
"symbol": "SymbolService",
"repo": "VarshithReddy2006/Repo-Intelligence-Agent",
"references": [
{
"name": "SymbolService",
"type": "class",
"file_path": "services/symbol_service.py",
"line_number": 26,
"language": "python",
"parent_class": null
}
],
"reference_count": 1,
"note": "MVP: name-based matching only. Full cross-file call graph planned for PH2-003."
}
```
---
## Call Graph Intelligence
### POST /api/call-graph/build
Build the function-level call graph for a repository. Streams SSE progress. Requires the repository to have been analyzed (`POST /api/analyze`) and the symbol index to exist (`POST /api/architecture/build`).
#### Request Schema
- `repo` (string, required): Repository identifier (`owner/repo`)
```json
{"repo": "fastapi/fastapi"}
```
#### SSE Stream Events
```
data: {"status": "progress", "message": "Parsing function calls..."}
data: {"status": "result", "data": {"total_functions": 142, "total_edges": 389}}
data: {"status": "done"}
```
---
### GET /api/call-graph/{owner}/{repo}
Return the call graph as React Flow JSON for visualization.
#### Query Parameters
- `q` (string, optional): Filter by function name substring
- `max_nodes` (int, optional): Maximum nodes to return. Range: 1–1000. Default: 300
#### Request Example
```bash
curl "http://127.0.0.1:8001/api/call-graph/fastapi/fastapi?q=router&max_nodes=50"
```
#### Response (200 OK)
```json
{
"nodes": [
{"id": "fastapi.routing:APIRouter.add_api_route", "label": "add_api_route", "file": "fastapi/routing.py"}
],
"edges": [
{"source": "fastapi.routing:APIRouter.add_api_route", "target": "fastapi.routing:APIRoute.__init__"}
],
"node_count": 1,
"edge_count": 1
}
```
---
### GET /api/call-graph/{owner}/{repo}/callers/{function_id}
Return all functions that directly call the given function.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/call-graph/fastapi/fastapi/callers/fastapi.routing:APIRouter.add_api_route
```
#### Response (200 OK)
```json
{
"function_id": "fastapi.routing:APIRouter.add_api_route",
"callers": [
{"id": "fastapi.routing:APIRouter.get", "name": "get", "file": "fastapi/routing.py", "line": 412}
]
}
```
---
### GET /api/call-graph/{owner}/{repo}/callees/{function_id}
Return all functions directly called by the given function.
---
### GET /api/call-graph/{owner}/{repo}/hierarchy/{function_id}
Return the call hierarchy tree for a function (callers tree or callees tree).
#### Query Parameters
- `direction` (string, optional): `down` (callees) or `up` (callers). Default: `down`
- `depth` (int, optional): BFS depth limit. Range: 1–12. Default: 6
---
### GET /api/call-graph/{owner}/{repo}/blast-radius/{function_id}
Return the function-level blast radius — all functions reachable from this one, with risk scoring.
---
### GET /api/call-graph/{owner}/{repo}/stats
Return aggregate call graph statistics (total functions, total edges, most-called functions, most-calling functions).
---
### GET /api/call-graph/{owner}/{repo}/neighbors/{function_id}
Return immediate callers and callees of a function as React Flow JSON.
---
### GET /api/call-graph/{owner}/{repo}/trace/{function_id}
BFS trace from a function as React Flow JSON.
#### Query Parameters
- `direction` (string, optional): `forward`, `backward`, or `both`. Default: `both`
- `depth` (int, optional): BFS depth limit. Range: 1–12. Default: 6
---
## API Surface Intelligence
### POST /api/api-surface/build
Build the API surface index — classifies every exported symbol as public, internal, or deprecated, and computes Martin's instability metrics. Streams SSE progress. Requires analyzed repository and symbol index.
#### Request Schema
- `repo` (string, required): Repository identifier (`owner/repo`)
```json
{"repo": "fastapi/fastapi"}
```
#### SSE Stream Events
```
data: {"status": "progress", "message": "Classifying symbols..."}
data: {"status": "result", "data": {"total_symbols": 142, "public": 42, "internal": 98, "deprecated": 2}}
data: {"status": "done"}
```
---
### GET /api/api-surface/{owner}/{repo}
Return the full API surface report including all symbols, stability metrics, and visibility ratio.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/api-surface/fastapi/fastapi
```
---
### GET /api/api-surface/{owner}/{repo}/stats
Return aggregate API surface statistics.
#### Response (200 OK)
```json
{
"total_symbols": 142,
"public_count": 42,
"internal_count": 98,
"deprecated_count": 2,
"visibility_ratio": 0.296
}
```
---
### GET /api/api-surface/{owner}/{repo}/public
Return all public symbols. Supports optional `q` search and `kind` filter query parameters, and a `limit` (default 100, max 1000).
---
### GET /api/api-surface/{owner}/{repo}/internal
Return all internal symbols. Supports `limit` query parameter.
---
### GET /api/api-surface/{owner}/{repo}/deprecated
Return all deprecated symbols.
---
### GET /api/api-surface/{owner}/{repo}/breaking
Detect breaking changes between two API surfaces, or return orphaned public APIs if `compare_repo` is omitted.
#### Query Parameters
- `compare_repo` (string, optional): Baseline repository identifier (`owner/repo`) to diff against
#### Response (200 OK — with compare_repo)
```json
{
"breaking_changes": [
{
"symbol": "authenticate_user",
"type": "function",
"change_type": "removed",
"file_path": "services/auth_service.py"
}
],
"count": 1
}
```
#### Response (200 OK — without compare_repo)
```json
{
"orphans": [
{
"name": "legacy_helper",
"type": "function",
"file_path": "services/legacy_helper.py",
"visibility": "public"
}
],
"count": 1
}
```
---
### GET /api/api-surface/{owner}/{repo}/{symbol_name}
Return classification details for a single symbol by name.
---
## Git History & Churn
### POST /api/churn/analyze
Mine git commit history and compute per-file churn scores. Streams SSE progress.
#### Request Schema
- `repo` (string, required): Repository identifier (`owner/repo`)
- `since_days` (int, optional): Days of history to mine. Range: 7–3650. Default: 365
```json
{
"repo": "fastapi/fastapi",
"since_days": 365
}
```
#### SSE Stream Events
```
data: {"status": "progress", "message": "Processing 1200 commits..."}
data: {"status": "result", "data": {"total_commits": 1200, "files_analyzed": 89}}
data: {"status": "done"}
```
---
### GET /api/churn/{owner}/{repo}
Return the full churn summary. Requires `POST /api/churn/analyze` to have been run first.
#### Query Parameters
- `since_days` (int, optional): Must match the value used during analysis. Default: 365
#### Response (200 OK)
```json
{
"repo": "fastapi/fastapi",
"since_days": 365,
"total_commits": 1200,
"files_analyzed": 89,
"top_churned_files": [
{"file_path": "fastapi/routing.py", "commit_count": 87, "churn_score": 0.94}
],
"timeline": [...]
}
```
---
### GET /api/churn/{owner}/{repo}/hotspots
Return the top-N hotspot files (high churn × high graph centrality).
#### Query Parameters
- `since_days` (int, optional): Default: 365
- `top_n` (int, optional): Range: 1–100. Default: 25
#### Response (200 OK)
```json
{
"hotspots": [
{
"file_path": "fastapi/routing.py",
"churn_score": 0.94,
"centrality_score": 0.87,
"hotspot_score": 0.91,
"commit_count": 87,
"risk_level": "HIGH"
}
]
}
```
---
### GET /api/churn/{owner}/{repo}/file/{file_path}
Return churn data for a single file.
#### Request Example
```bash
curl http://127.0.0.1:8001/api/churn/fastapi/fastapi/file/fastapi/routing.py
```
---
### GET /api/churn/{owner}/{repo}/timeline
Return the weekly commit activity timeline.
#### Response (200 OK)
```json
{
"timeline": [
{"week": "2026-01-06", "commit_count": 12},
{"week": "2026-01-13", "commit_count": 8}
]
}
```
---
## PR & Architecture Drift Intelligence
### POST /api/pr/analyze
Perform risk assessment, changed files extraction, symbol diffs, and blast radius propagation for a Pull Request.
#### Request Schema (PRAnalyzeRequest)
- `owner` (string, required): GitHub repository owner.
- `repo` (string, required): GitHub repository name.
- `pr_number` (int, required): GitHub pull request ID.
```json
{
"owner": "VarshithReddy2006",
"repo": "Repo-Intelligence-Agent",
"pr_number": 2
}
```
#### Response (200 OK)
```json
{
"repo": "VarshithReddy2006/Repo-Intelligence-Agent",
"pr_number": 2,
"risk_score": 24.5,
"pr_size": "M",
"blast_radius": "MEDIUM",
"changed_files": [
{
"filename": "services/pr_intelligence_service.py",
"status": "modified",
"additions": 45,
"deletions": 10,
"changes": 55
}
],
"added_symbols": [],
"modified_symbols": [
{
"name": "analyze_pull_request",
"type": "function",
"file_path": "services/pr_intelligence_service.py",
"line_number": 85,
"language": "python",
"change_type": "modified",
"parent_class": "PRIntelligenceService"
}
],
"removed_symbols": [],
"affected_files": [
"backend/api.py"
],
"propagation_paths": [
{
"source": "services/pr_intelligence_service.py",
"target": "backend/api.py",
"path": ["backend/api.py", "services/pr_intelligence_service.py"],
"depth": 1
}
],
"risk_breakdown": {
"size_risk": "MEDIUM",
"blast_radius_risk": "LOW",
"drift_risk": "LOW",
"hotspot_risk": "HIGH"
},
"review_focus_areas": [
{
"area": "hotspots",
"description": "Changes to services/pr_intelligence_service.py modify highly coupled module logic.",
"severity": "HIGH"
}
],
"analyzed_at": "2026-06-20T14:14:00Z"
}
```
---
### GET /api/pr/health
Health diagnostics check for PR Intelligence configurations.
#### Query Parameters
- `owner` (string, optional): GitHub owner.
- `repo` (string, optional): GitHub repo.
#### Request Example
```bash
curl "http://127.0.0.1:8001/api/pr/health?owner=VarshithReddy2006&repo=Repo-Intelligence-Agent"
```
#### Response (200 OK)
```json
{
"github_token": true,
"github_token_loaded": true,
"github_token_prefix": "github_pat_1...",
"github_rate_limit_authenticated": true,
"rate_limit_remaining": 4982,
"analysis_exists": true,
"graph_available": true,
"symbol_index_available": true,
"status": "healthy"
}
```
---
### POST /api/repos/repair
Repair a repository by forcefully regenerating its missing graph and symbol indices.
#### Request Schema
- `owner` (string, required): GitHub owner.
- `repo` (string, required): GitHub repo.
```json
{
"owner": "VarshithReddy2006",
"repo": "Repo-Intelligence-Agent"
}
```
#### Response (200 OK)
```json
{
"status": "success",
"message": "Repository indexes rebuilt successfully for 'VarshithReddy2006/Repo-Intelligence-Agent'",
"details": {
"architecture": { "status": "built", "repo": "VarshithReddy2006/Repo-Intelligence-Agent", "files_parsed": 34, "dependencies_found": 80 },
"symbols": { "repo": "VarshithReddy2006/Repo-Intelligence-Agent", "symbols_parsed": 122 }
}
}
```
---
### POST /api/architecture/drift
Detect architectural drift, cycle additions, and coupling shifts introduced by a Pull Request.
#### Request Schema (PRDriftRequest)
- `owner` (string, required): GitHub owner.
- `repo` (string, required): GitHub repo.
- `pr_number` (int, required): GitHub PR ID.
```json
{
"owner": "VarshithReddy2006",
"repo": "Repo-Intelligence-Agent",
"pr_number": 2
}
```
#### Response (200 OK)
```json
{
"repo": "VarshithReddy2006/Repo-Intelligence-Agent",
"pr_number": 2,
"added_dependencies": [],
"removed_dependencies": [],
"new_cycles": [],
"resolved_cycles": [],
"coupling_increase": [
{ "file": "services/pr_intelligence_service.py", "before": 4, "after": 5 }
],
"coupling_decrease": [],
"new_entry_points": [],
"removed_entry_points": [],
"architectural_hotspots": [
"services/pr_intelligence_service.py"
],
"risk_score": 10.0,
"improvement_score": 0.0,
"analyzed_at": "2026-06-20T14:14:00Z"
}
```
---
## Dead Code Intelligence
### POST /api/dead-code/analyze
Traces reachability from application entry points to sweep unreachable files, orphaned modules, and dead dependency chains.
#### Request Schema (DeadCodeRequest)
- `owner` (string, required): GitHub owner.
- `repo` (string, required): GitHub repo.
```json
{
"owner": "VarshithReddy2006",
"repo": "Repo-Intelligence-Agent"
}
```
#### Response (200 OK)
```json
{
"repo": "VarshithReddy2006/Repo-Intelligence-Agent",
"cleanup_score": 92,
"previous_cleanup_score": null,
"estimated_cleanup_effort": "LOW",
"unused_files": [
{
"file_path": "scripts/unused_script.py",
"confidence": 0.95,
"risk_level": "SAFE",
"recommendation": "Consider removing unused file scripts/unused_script.py"
}
],
"orphan_modules": [
{
"file_path": "services/legacy_helper.py",
"confidence": 0.90,
"risk_level": "REVIEW",
"recommendation": "Review orphaned module services/legacy_helper.py; no active execution path reaches it.",
"last_reachable_parent": "services/architecture_service.py"
}
],
"dead_dependency_chains": [
{
"chain": ["services/dead_chain_a.py", "services/dead_chain_b.py"],
"confidence": 0.95,
"risk_level": "SAFE",
"recommendation": "Dependency chain [dead_chain_a.py -> dead_chain_b.py] appears unreachable and may be removable as a unit.",
"length": 1,
"total_nodes": 2,
"max_centrality": 0.012
}
],
"cleanup_recommendations": [
"Remove unused file scripts/unused_script.py (no active imports).",
"Review orphaned module services/legacy_helper.py (previously connected via services/architecture_service.py)."
],
"analyzed_at": "2026-06-20T14:14:00Z"
}
```
---
## Repository Intelligence Report
### POST /api/v1/report/{owner}/{repo}/build
Triggers the full scoring, rating, and serialization pipeline for a repository. Compiles raw analyses (circular dependencies, stability index, dead code, change risks) and persists the result to SQLite before returning the model.
#### Response (200 OK)
```json
{
"scores": {
"overall": 87.5,
"grade": "B",
"breakdown": {
"stability": 92.0,
"api_distance": 85.0,
"hygiene": 95.0,
"churn": 80.0,
"onboarding": 88.0
}
},
"architecture": {
"circular_dependencies": [
["services/a.py", "services/b.py", "services/a.py"]
],
"coupling_hotspots": ["services/pr_intelligence_service.py"],
"design_smells": [
{
"type": "HIGH_COUPLING",
"file_path": "services/pr_intelligence_service.py",
"description": "File has high in-degree / out-degree ratio."
}
]
},
"api_surface": {
"total_symbols": 142,
"exported_symbols": 42,
"visibility_ratio": 0.295,
"instability_metrics": [
{
"module": "services/github_service",
"efferent_coupling": 2,
"afferent_coupling": 8,
"instability": 0.20
}
]
},
"hygiene": {
"dead_functions": 12,
"unreachable_files_count": 2,
"registry": [
{
"symbol": "legacy_cleanup",
"file_path": "services/legacy_helper.py",
"line": 42
}
]
},
"onboarding": {
"entry_points": ["backend/api.py", "backend/cli.py"],
"reading_path": [
"models/report.py",
"services/report/composer.py",
"backend/routers/report.py"
]
},
"metadata": {
"repo_name": "VarshithReddy2006/Repo-Intelligence-Agent",
"commit_hash": "a8f4c2e",
"generated_at": "2026-06-23T04:00:00Z"
}
}
```
---
### GET /api/v1/report/{owner}/{repo}/summary
Retrieves the overall health rating and score summary from the cache without running a full re-build.
#### Response (200 OK)
```json
{
"repo_name": "VarshithReddy2006/Repo-Intelligence-Agent",
"score": 87.5,
"grade": "B",
"analyzed_at": "2026-06-23T04:00:00Z"
}
```
---
### GET /api/v1/report/{owner}/{repo}/download
Downloads the formatted report in the requested file type.
#### Query Parameters
- `format` (string, optional): One of `html` (default), `pdf`, or `markdown`.
#### Response (200 OK)
- **Binary Stream** with appropriate MIME type (`text/html` or `text/markdown`) and `Content-Disposition` attachment header.
---
## AI Engineering Advisor
### POST /api/v1/repositories/{owner}/{repo}/advisor
Runs the full AI Engineering Advisor pipeline and returns a structured AdvisorReport. Consolidates information from the Repository Inspector, Engineering Memory, and Continuous Monitoring.
#### Response (200 OK)
```json
{
"repository": "fastapi/fastapi",
"overall_priority": "medium",
"total_recommendations": 12,
"top_recommendations": [
{
"id": "rec-1",
"title": "Resolve cycle between main and routing",
"category": "architecture",
"priority": "high",
"estimated_effort": "medium"
}
],
"roadmap_phases": 3,
"roadmap_summary": [
{
"phase": 1,
"title": "Mitigate Security & Dependency Issues",
"recommendation_count": 4
}
]
}
```
---
### GET /api/v1/repositories/{owner}/{repo}/advisor/latest
Returns the most recently persisted AdvisorReport.
#### Response (200 OK)
*(Same schema format as Advisor Report)*
---
### GET /api/v1/repositories/{owner}/{repo}/advisor/recommendations
Returns the prioritized recommendation list from the latest AdvisorReport.
#### Query Parameters
- `priority` (string, optional): Filter by: `critical` | `high` | `medium` | `low`.
- `category` (string, optional): Filter by category name.
- `limit` (int, optional): Maximum number to return (default `50`).
#### Response (200 OK)
```json
[
{
"id": "rec-1",
"title": "Resolve cycle between main and routing",
"category": "architecture",
"priority": "high",
"estimated_effort": "medium"
}
]
```
---
### GET /api/v1/repositories/{owner}/{repo}/advisor/roadmap
Returns the phased engineering roadmap from the latest AdvisorReport.
#### Response (200 OK)
```json
[
{
"phase": 1,
"title": "Mitigate Security & Dependency Issues",
"recommendation_count": 4
}
]
```
---
## Autonomous Engineering Agent (AEA²)
### POST /api/v1/repositories/{owner}/{repo}/execution-plan
Generates a structured implementation plan from the latest AdvisorReport. Requires a previously generated AdvisorReport to exist.
#### Response (200 OK)
```json
{
"repository": "fastapi/fastapi",
"total_tasks": 8,
"total_batches": 2,
"critical_path_length": 5,
"rollback_checkpoints": 2,
"conflict_count": 0,
"overall_risk": "low",
"batches": [
{
"batch_id": "batch-1",
"order": 1,
"title": "Initial Refactoring Pass",
"task_count": 3,
"parallel": true,
"estimated_effort": "1 day"
}
],
"critical_path": ["task-1", "task-3"],
"metadata": {}
}
```
---
### GET /api/v1/repositories/{owner}/{repo}/execution-plan/latest
Returns the most recently persisted ExecutionPlan.
#### Response (200 OK)
*(Same schema format as ExecutionPlan)*
---
### GET /api/v1/repositories/{owner}/{repo}/execution-plan/batches
Returns the ordered execution batches from the latest ExecutionPlan.
#### Response (200 OK)
*(Returns batches summary array)*
---
### GET /api/v1/repositories/{owner}/{repo}/execution-plan/critical-path
Returns the critical path of execution tasks.
#### Response (200 OK)
```json
["task-1", "task-3"]
```
---
## Intelligent IDE Workspace
### GET /api/v1/repositories/{owner}/{repo}/workspace
Returns the complete consolidated IDE workspace snapshot for a repository.
#### Query Parameters
- `file` (string, optional): Currently open file path.
- `symbol` (string, optional): Currently selected symbol.
- `panel` (string, optional): Active workspace panel name (default `overview`).
#### Response (200 OK)
```json
{
"state": {
"repository": "fastapi/fastapi",
"selected_file": "main.py",
"selected_symbol": "app",
"active_panel": "overview",
"filters": {},
"ui_preferences": {}
},
"overview": {
"repository": "fastapi/fastapi",
"description": "High performance API framework",
"primary_language": "Python",
"languages": ["Python"],
"total_files": 342,
"total_symbols": 1821,
"architecture_style": "FastAPI Router Structure",
"dependency_count": 12,
"health": {
"overall_score": 88,
"overall_priority": "medium",
"critical_count": 0,
"high_count": 2,
"medium_count": 4,
"low_count": 6,
"trend_direction": "stable"
},
"last_indexed_at": 1719543600,
"metadata": {}
},
"explorer": null,
"chat": null,
"findings": null,
"timeline": null,
"monitor": null,
"advisor": null,
"execution": null,
"available_panels": ["overview", "explorer", "chat", "findings", "timeline", "monitor", "advisor", "execution"],
"metadata": {}
}
```
---
### GET /api/v1/repositories/{owner}/{repo}/workspace/{panel}
Fetches details for a specific dashboard panel in the workspace. Available panels: `overview`, `explorer`, `chat`, `findings`, `timeline`, `monitor`, `advisor`, `execution`.
Prefixes can be root `/repositories/...`, `/api/repositories/...`, or `/api/v1/repositories/...`.
|