Skip to content

Codebase intelligence for AI and humans: code health scores, auto-generated docs, git analytics, dead code detection, and architectural decisions via MCP.

feat(api-client): hosted provider adapter (#693)

Raghav Chamadiya1b61786c60e0
diff --git a/package-lock.json b/package-lock.json
index 0043d6276..c65df6a64 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -18482,12 +18482,30 @@
},
"devDependencies": {
"@repowise-dev/ui": "*",
+ "@types/node": "^26.1.0",
"@types/react": "^19.0.0",
"react": "^19.0.0",
"typescript": "^5.6.0",
"vitest": "^4.1.5"
}
},
+ "packages/api-client/node_modules/@types/node": {
+ "version": "26.1.0",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-26.1.0.tgz",
+ "integrity": "sha512-O0A1G3xPGy4w7AgQdAQYUlQ+BKk2Oovw8eRpofyp5KdBZULnbe+WqaOVNrm705SHphCiG4XHsACrSmPu1f+Kgw==",
+ "dev": true,
+ "license": "MIT",
+ "dependencies": {
+ "undici-types": "~8.3.0"
+ }
+ },
+ "packages/api-client/node_modules/undici-types": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.3.0.tgz",
+ "integrity": "sha512-j375ScV60dom+YkPFIfTLcOiPxkN/buHz5GobjLhixFuANaNs3C9l4GmrWqejgXWJ7BbJcFYpTEUkS1Ge8bpZQ==",
+ "dev": true,
+ "license": "MIT"
+ },
"packages/types": {
"name": "@repowise-dev/types",
"version": "0.0.1",
diff --git a/packages/api-client/package.json b/packages/api-client/package.json
index b9b964a82..3af7e748d 100644
--- a/packages/api-client/package.json
+++ b/packages/api-client/package.json
@@ -4,7 +4,9 @@
"private": true,
"description": "Framework-free TypeScript client for the repowise REST API, shared by packages/web and downstream consumers.",
"type": "module",
- "files": ["src"],
+ "files": [
+ "src"
+ ],
"main": "./src/index.ts",
"types": "./src/index.ts",
"exports": {
@@ -23,6 +25,7 @@
"./git": "./src/git.ts",
"./graph": "./src/graph.ts",
"./health": "./src/health.ts",
+ "./hosted": "./src/hosted.ts",
"./jobs": "./src/jobs.ts",
"./knowledge-map": "./src/knowledge-map.ts",
"./mcp-tools": "./src/mcp-tools.ts",
@@ -54,6 +57,7 @@
},
"devDependencies": {
"@repowise-dev/ui": "*",
+ "@types/node": "^26.1.0",
"@types/react": "^19.0.0",
"react": "^19.0.0",
"typescript": "^5.6.0",
diff --git a/packages/api-client/src/__fixtures__/hosted/architecture-view.json b/packages/api-client/src/__fixtures__/hosted/architecture-view.json
new file mode 100644
index 000000000..a03a6ec1c
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/architecture-view.json
@@ -0,0 +1,496 @@
+{
+ "project_name": "flask",
+ "project_description": "",
+ "layers": [
+ {
+ "id": "layer:application",
+ "name": "Application",
+ "description": "",
+ "node_ids": [
+ ".pre-commit-config.yaml",
+ ".readthedocs.yaml",
+ "README.md",
+ "pyproject.toml",
+ "src/flask/__init__.py",
+ "src/flask/__main__.py",
+ "src/flask/cli.py",
+ "src/flask/globals.py",
+ "src/flask/helpers.py",
+ "src/flask/debughelpers.py",
+ "src/flask/signals.py",
+ "src/flask/app.py",
+ "src/flask/testing.py",
+ "src/flask/typing.py",
+ "src/flask/views.py",
+ "src/flask/wrappers.py",
+ "src/flask/sessions.py",
+ "src/flask/json/__init__.py",
+ "src/flask/sansio/README.md",
+ "src/flask/config.py",
+ "src/flask/sansio/app.py",
+ "src/flask/json/tag.py",
+ "src/flask/ctx.py",
+ "src/flask/logging.py",
+ "src/flask/templating.py",
+ "src/flask/sansio/scaffold.py",
+ "src/flask/json/provider.py",
+ "src/flask/blueprints.py",
+ "src/flask/sansio/blueprints.py"
+ ],
+ "file_count": 29,
+ "complexity_distribution": {
+ "simple": 7,
+ "moderate": 8,
+ "complex": 14
+ },
+ "health_score": null,
+ "sub_groups": [],
+ "display_order": 0
+ },
+ {
+ "id": "layer:config",
+ "name": "Config",
+ "description": "",
+ "node_ids": [
+ ".devcontainer/on-create-command.sh",
+ ".github/pull_request_template.md",
+ ".github/ISSUE_TEMPLATE/bug-report.md",
+ ".github/ISSUE_TEMPLATE/config.yml",
+ ".github/ISSUE_TEMPLATE/feature-request.md",
+ ".github/workflows/lock.yaml",
+ ".devcontainer/devcontainer.json",
+ ".github/workflows/pre-commit.yaml",
+ ".github/workflows/publish.yaml",
+ ".github/workflows/tests.yaml",
+ ".github/workflows/zizmor.yaml"
+ ],
+ "file_count": 11,
+ "complexity_distribution": {
+ "simple": 11,
+ "moderate": 0,
+ "complex": 0
+ },
+ "health_score": null,
+ "sub_groups": [],
+ "display_order": 1
+ },
+ {
+ "id": "layer:docs-tooling",
+ "name": "Docs & Tooling",
+ "description": "",
+ "node_ids": [
+ "docs/Makefile",
+ "docs/conf.py",
+ "examples/celery/README.md",
+ "examples/celery/pyproject.toml",
+ "examples/celery/src/task_app/__init__.py",
+ "examples/celery/src/task_app/views.py",
+ "examples/celery/src/task_app/tasks.py",
+ "examples/celery/make_celery.py",
+ "examples/javascript/pyproject.toml",
+ "examples/javascript/js_example/views.py",
+ "examples/javascript/js_example/__init__.py",
+ "examples/tutorial/pyproject.toml",
+ "examples/tutorial/flaskr/auth.py",
+ "examples/tutorial/flaskr/db.py",
+ "examples/tutorial/flaskr/schema.sql",
+ "examples/tutorial/flaskr/blog.py",
+ "examples/tutorial/flaskr/__init__.py"
+ ],
+ "file_count": 17,
+ "complexity_distribution": {
+ "simple": 12,
+ "moderate": 4,
+ "complex": 1
+ },
+ "health_score": null,
+ "sub_groups": [],
+ "display_order": 2
+ }
+ ],
+ "nodes": [
+ {
+ "id": ".devcontainer/devcontainer.json",
+ "node_type": "config",
+ "name": "devcontainer.json",
+ "file_path": ".devcontainer/devcontainer.json",
+ "line_range": null,
+ "summary": "Configuration file: devcontainer.json.",
+ "complexity": "simple",
+ "tags": [
+ "config"
+ ],
+ "language": "json",
+ "pagerank": 0.0021357579334815545,
+ "pagerank_percentile": 0,
+ "betweenness": 0,
+ "in_degree": 0,
+ "out_degree": 1,
+ "community_id": 4,
+ "is_entry_point": false,
+ "is_test": false,
+ "is_hotspot": false,
+ "is_dead": false,
+ "has_doc": false,
+ "primary_owner": null,
+ "primary_owner_pct": null,
+ "bus_factor": null
+ },
+ {
+ "id": ".devcontainer/on-create-command.sh",
+ "node_type": "file",
+ "name": "on-create-command.sh",
+ "file_path": ".devcontainer/on-create-command.sh",
+ "line_range": null,
+ "summary": "Config module on-create-command.",
+ "complexity": "simple",
+ "tags": [
+ "shell",
+ ".devcontainer"
+ ],
+ "language": "shell",
+ "pagerank": 0.0021357579334815545,
+ "pagerank_percentile": 0,
+ "betweenness": 0,
+ "in_degree": 0,
+ "out_degree": 1,
+ "community_id": 5,
+ "is_entry_point": false,
+ "is_test": false,
+ "is_hotspot": false,
+ "is_dead": false,
+ "has_doc": false,
+ "primary_owner": "emisargent",
+ "primary_owner_pct": 0.8571428571428571,
+ "bus_factor": 2
+ },
+ {
+ "id": ".github/ISSUE_TEMPLATE/bug-report.md",
+ "node_type": "document",
+ "name": "bug-report.md",
+ "file_path": ".github/ISSUE_TEMPLATE/bug-report.md",
+ "line_range": null,
+ "summary": "Documentation: bug-report.md.",
+ "complexity": "simple",
+ "tags": [
+ "markdown",
+ "ISSUE_TEMPLATE"
+ ],
+ "language": "markdown",
+ "pagerank": 0.0021357579334815545,
+ "pagerank_percentile": 0,
+ "betweenness": 0,
+ "in_degree": 0,
+ "out_degree": 1,
+ "community_id": 6,
+ "is_entry_point": false,
+ "is_test": false,
+ "is_hotspot": false,
+ "is_dead": false,
+ "has_doc": false,
+ "primary_owner": null,
+ "primary_owner_pct": null,
+ "bus_factor": null
+ }
+ ],
+ "edges": [
+ {
+ "source": "examples/celery/make_celery.py",
+ "target": "examples/celery/src/task_app/__init__.py",
+ "edge_type": "imports",
+ "direction": "forward",
+ "weight": 1,
+ "confidence": 1
+ },
+ {
+ "source": "examples/celery/src/task_app/__init__.py",
+ "target": "examples/celery/src/task_app/views.py",
+ "edge_type": "imports",
+ "direction": "forward",
+ "weight": 1,
+ "confidence": 1
+ },
+ {
+ "source": "examples/celery/src/task_app/__init__.py",
+ "target": "src/flask/__init__.py",
+ "edge_type": "imports",
+ "direction": "forward",
+ "weight": 1,
+ "confidence": 1
+ }
+ ],
+ "tour": [
+ {
+ "order": 1,
+ "title": "README.md",
+ "description": "",
+ "node_ids": [
+ "README.md"
+ ],
+ "target_path": "README.md",
+ "layer_id": "layer:application",
+ "reason": "Start here for the end-to-end picture before diving into the code.",
+ "depth": 0,
+ "kind": "overview",
+ "page_type": "repo_overview"
+ },
+ {
+ "order": 2,
+ "title": "app.py",
+ "description": "",
+ "node_ids": [
+ "src/flask/app.py"
+ ],
+ "target_path": "src/flask/app.py",
+ "layer_id": "layer:application",
+ "reason": "An entry point — execution and imports fan out from here.",
+ "depth": 0,
+ "kind": "code",
+ "page_type": "file_page"
+ }
+ ],
+ "total_files": 108,
+ "total_symbols": 1060,
+ "total_edges": 257,
+ "languages": [
+ "json",
+ "makefile",
+ "markdown",
+ "python",
+ "shell",
+ "sql",
+ "toml",
+ "yaml"
+ ],
+ "frameworks": [
+ "flask"
+ ],
+ "external_systems": [
+ {
+ "id": "ext:amqp",
+ "name": "amqp",
+ "display_name": "Amqp",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==5.1.1",
+ "io_kind": null
+ },
+ {
+ "id": "ext:asgiref",
+ "name": "asgiref",
+ "display_name": "Asgiref",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=3.2",
+ "io_kind": null
+ },
+ {
+ "id": "ext:async-timeout",
+ "name": "async-timeout",
+ "display_name": "Async Timeout",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==4.0.2",
+ "io_kind": null
+ },
+ {
+ "id": "ext:billiard",
+ "name": "billiard",
+ "display_name": "Billiard",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==3.6.4.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:blinker",
+ "name": "blinker",
+ "display_name": "Blinker",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=1.9.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:celery",
+ "name": "celery",
+ "display_name": "Celery",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:click",
+ "name": "click",
+ "display_name": "Click",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=8.1.3",
+ "io_kind": null
+ },
+ {
+ "id": "ext:click-didyoumean",
+ "name": "click-didyoumean",
+ "display_name": "Click Didyoumean",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==0.3.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:click-plugins",
+ "name": "click-plugins",
+ "display_name": "Click Plugins",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==1.1.1",
+ "io_kind": null
+ },
+ {
+ "id": "ext:click-repl",
+ "name": "click-repl",
+ "display_name": "Click Repl",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==0.2.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:flask",
+ "name": "flask",
+ "display_name": "Flask",
+ "category": "framework",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:itsdangerous",
+ "name": "itsdangerous",
+ "display_name": "Itsdangerous",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=2.2.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:jinja2",
+ "name": "jinja2",
+ "display_name": "Jinja2",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=3.1.2",
+ "io_kind": null
+ },
+ {
+ "id": "ext:kombu",
+ "name": "kombu",
+ "display_name": "Kombu",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==5.2.4",
+ "io_kind": null
+ },
+ {
+ "id": "ext:markupsafe",
+ "name": "markupsafe",
+ "display_name": "Markupsafe",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=2.1.1",
+ "io_kind": null
+ },
+ {
+ "id": "ext:prompt-toolkit",
+ "name": "prompt-toolkit",
+ "display_name": "Prompt Toolkit",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==3.0.38",
+ "io_kind": null
+ },
+ {
+ "id": "ext:pytest",
+ "name": "pytest",
+ "display_name": "Pytest",
+ "category": "tool",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:python-dotenv",
+ "name": "python-dotenv",
+ "display_name": "Python Dotenv",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:pytz",
+ "name": "pytz",
+ "display_name": "Pytz",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==2023.3",
+ "io_kind": null
+ },
+ {
+ "id": "ext:redis",
+ "name": "redis",
+ "display_name": "Redis",
+ "category": "service",
+ "ecosystem": "pypi",
+ "version": "==4.5.4",
+ "io_kind": "db"
+ },
+ {
+ "id": "ext:six",
+ "name": "six",
+ "display_name": "Six",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==1.16.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:vine",
+ "name": "vine",
+ "display_name": "Vine",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==5.0.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:wcwidth",
+ "name": "wcwidth",
+ "display_name": "Wcwidth",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==0.2.6",
+ "io_kind": null
+ },
+ {
+ "id": "ext:werkzeug",
+ "name": "werkzeug",
+ "display_name": "Werkzeug",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=3.1.0",
+ "io_kind": null
+ }
+ ],
+ "entry_points": [
+ "src/flask/app.py",
+ "src/flask/__main__.py",
+ "src/flask/sansio/app.py"
+ ],
+ "entry_candidates": [
+ "src/flask/app.py",
+ "src/flask/__main__.py",
+ "src/flask/sansio/app.py"
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/architecture.json b/packages/api-client/src/__fixtures__/hosted/architecture.json
new file mode 100644
index 000000000..5e4526a18
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/architecture.json
@@ -0,0 +1,116 @@
+{
+ "nodes": [
+ {
+ "community_id": 0,
+ "label": "tests",
+ "cohesion": 0.066,
+ "member_count": 53,
+ "top_file": "src/flask/__init__.py",
+ "avg_pagerank": 0.007025647351207999,
+ "hotspot_count": 0,
+ "dead_count": 7,
+ "has_decision": true,
+ "doc_coverage_pct": 0,
+ "languages": [
+ "python"
+ ]
+ },
+ {
+ "community_id": 1,
+ "label": "flask",
+ "cohesion": 0.5091,
+ "member_count": 11,
+ "top_file": "src/flask/globals.py",
+ "avg_pagerank": 0.02957310326458718,
+ "hotspot_count": 0,
+ "dead_count": 0,
+ "has_decision": true,
+ "doc_coverage_pct": 0,
+ "languages": [
+ "python"
+ ]
+ },
+ {
+ "community_id": 2,
+ "label": "flask/sansio",
+ "cohesion": 0.3333,
+ "member_count": 9,
+ "top_file": "src/flask/sansio/app.py",
+ "avg_pagerank": 0.010039298404646381,
+ "hotspot_count": 0,
+ "dead_count": 0,
+ "has_decision": true,
+ "doc_coverage_pct": 0,
+ "languages": [
+ "python"
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "source": 26,
+ "target": 0,
+ "edge_count": 1
+ },
+ {
+ "source": 0,
+ "target": 1,
+ "edge_count": 17
+ },
+ {
+ "source": 0,
+ "target": 3,
+ "edge_count": 11
+ },
+ {
+ "source": 1,
+ "target": 2,
+ "edge_count": 9
+ },
+ {
+ "source": 1,
+ "target": 3,
+ "edge_count": 10
+ },
+ {
+ "source": 0,
+ "target": 2,
+ "edge_count": 8
+ },
+ {
+ "source": 3,
+ "target": 0,
+ "edge_count": 9
+ },
+ {
+ "source": 2,
+ "target": 1,
+ "edge_count": 8
+ },
+ {
+ "source": 2,
+ "target": 0,
+ "edge_count": 7
+ },
+ {
+ "source": 2,
+ "target": 3,
+ "edge_count": 3
+ },
+ {
+ "source": 3,
+ "target": 1,
+ "edge_count": 8
+ },
+ {
+ "source": 1,
+ "target": 0,
+ "edge_count": 1
+ },
+ {
+ "source": 3,
+ "target": 26,
+ "edge_count": 1
+ }
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/c4-l1.json b/packages/api-client/src/__fixtures__/hosted/c4-l1.json
new file mode 100644
index 000000000..e8639c0d9
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/c4-l1.json
@@ -0,0 +1,449 @@
+{
+ "system": {
+ "id": "sys:291eda74d214461487a07d63c4276cb3",
+ "name": "flask",
+ "description": ""
+ },
+ "people": [
+ {
+ "id": "person:cli",
+ "name": "CLI user",
+ "description": "Runs commands from a terminal",
+ "kind": "cli"
+ },
+ {
+ "id": "person:api",
+ "name": "API client",
+ "description": "Calls the HTTP API",
+ "kind": "api"
+ }
+ ],
+ "external_systems": [
+ {
+ "id": "ext:amqp",
+ "name": "amqp",
+ "display_name": "Amqp",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==5.1.1",
+ "io_kind": null
+ },
+ {
+ "id": "ext:asgiref",
+ "name": "asgiref",
+ "display_name": "Asgiref",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=3.2",
+ "io_kind": null
+ },
+ {
+ "id": "ext:async-timeout",
+ "name": "async-timeout",
+ "display_name": "Async Timeout",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==4.0.2",
+ "io_kind": null
+ },
+ {
+ "id": "ext:billiard",
+ "name": "billiard",
+ "display_name": "Billiard",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==3.6.4.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:blinker",
+ "name": "blinker",
+ "display_name": "Blinker",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=1.9.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:celery",
+ "name": "celery",
+ "display_name": "Celery",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:click",
+ "name": "click",
+ "display_name": "Click",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=8.1.3",
+ "io_kind": null
+ },
+ {
+ "id": "ext:click-didyoumean",
+ "name": "click-didyoumean",
+ "display_name": "Click Didyoumean",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==0.3.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:click-plugins",
+ "name": "click-plugins",
+ "display_name": "Click Plugins",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==1.1.1",
+ "io_kind": null
+ },
+ {
+ "id": "ext:click-repl",
+ "name": "click-repl",
+ "display_name": "Click Repl",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==0.2.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:flask",
+ "name": "flask",
+ "display_name": "Flask",
+ "category": "framework",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:itsdangerous",
+ "name": "itsdangerous",
+ "display_name": "Itsdangerous",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=2.2.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:jinja2",
+ "name": "jinja2",
+ "display_name": "Jinja2",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=3.1.2",
+ "io_kind": null
+ },
+ {
+ "id": "ext:kombu",
+ "name": "kombu",
+ "display_name": "Kombu",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==5.2.4",
+ "io_kind": null
+ },
+ {
+ "id": "ext:markupsafe",
+ "name": "markupsafe",
+ "display_name": "Markupsafe",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=2.1.1",
+ "io_kind": null
+ },
+ {
+ "id": "ext:prompt-toolkit",
+ "name": "prompt-toolkit",
+ "display_name": "Prompt Toolkit",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==3.0.38",
+ "io_kind": null
+ },
+ {
+ "id": "ext:pytest",
+ "name": "pytest",
+ "display_name": "Pytest",
+ "category": "tool",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:python-dotenv",
+ "name": "python-dotenv",
+ "display_name": "Python Dotenv",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": null,
+ "io_kind": null
+ },
+ {
+ "id": "ext:pytz",
+ "name": "pytz",
+ "display_name": "Pytz",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==2023.3",
+ "io_kind": null
+ },
+ {
+ "id": "ext:redis",
+ "name": "redis",
+ "display_name": "Redis",
+ "category": "service",
+ "ecosystem": "pypi",
+ "version": "==4.5.4",
+ "io_kind": "db"
+ },
+ {
+ "id": "ext:six",
+ "name": "six",
+ "display_name": "Six",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==1.16.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:vine",
+ "name": "vine",
+ "display_name": "Vine",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==5.0.0",
+ "io_kind": null
+ },
+ {
+ "id": "ext:wcwidth",
+ "name": "wcwidth",
+ "display_name": "Wcwidth",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": "==0.2.6",
+ "io_kind": null
+ },
+ {
+ "id": "ext:werkzeug",
+ "name": "werkzeug",
+ "display_name": "Werkzeug",
+ "category": "library",
+ "ecosystem": "pypi",
+ "version": ">=3.1.0",
+ "io_kind": null
+ }
+ ],
+ "relations": [
+ {
+ "source_id": "person:cli",
+ "target_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "label": "runs",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "person:api",
+ "target_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "label": "calls",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:amqp",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:asgiref",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:async-timeout",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:billiard",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:blinker",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:celery",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:click",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:click-didyoumean",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:click-plugins",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:click-repl",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:flask",
+ "label": "framework",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:itsdangerous",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:jinja2",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:kombu",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:markupsafe",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:prompt-toolkit",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:pytest",
+ "label": "tool",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:python-dotenv",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:pytz",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:redis",
+ "label": "service",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:six",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:vine",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:wcwidth",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ },
+ {
+ "source_id": "sys:291eda74d214461487a07d63c4276cb3",
+ "target_id": "ext:werkzeug",
+ "label": "library",
+ "edge_count": 1,
+ "edge_types": [],
+ "coupling": ""
+ }
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/churn-complexity.json b/packages/api-client/src/__fixtures__/hosted/churn-complexity.json
new file mode 100644
index 000000000..e9c69a4f5
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/churn-complexity.json
@@ -0,0 +1,30 @@
+{
+ "points": [
+ {
+ "file_path": "src/flask/cli.py",
+ "commit_count_90d": 2,
+ "max_ccn": 13,
+ "nloc": 822,
+ "score": 2.05,
+ "churn_percentile": 84.5
+ },
+ {
+ "file_path": "src/flask/sansio/app.py",
+ "commit_count_90d": 1,
+ "max_ccn": 12,
+ "nloc": 678,
+ "score": 1.35,
+ "churn_percentile": 94
+ },
+ {
+ "file_path": "src/flask/ctx.py",
+ "commit_count_90d": 1,
+ "max_ccn": 7,
+ "nloc": 395,
+ "score": 6.51,
+ "churn_percentile": 97.6
+ }
+ ],
+ "total_points": 4,
+ "state": "ready"
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/coupling.json b/packages/api-client/src/__fixtures__/hosted/coupling.json
new file mode 100644
index 000000000..9a7be4d46
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/coupling.json
@@ -0,0 +1,38 @@
+{
+ "nodes": [
+ {
+ "file_path": "CHANGES.rst",
+ "module": null,
+ "score": null,
+ "nloc": 0
+ },
+ {
+ "file_path": "src/flask/app.py",
+ "module": "flask",
+ "score": 1.07,
+ "nloc": 1235
+ },
+ {
+ "file_path": "src/flask/sansio/app.py",
+ "module": "flask/sansio",
+ "score": 1.35,
+ "nloc": 678
+ }
+ ],
+ "edges": [
+ {
+ "source": "CHANGES.rst",
+ "target": "src/flask/sansio/app.py",
+ "strength": 2.66,
+ "last_co_change": "2026-05-02"
+ },
+ {
+ "source": "CHANGES.rst",
+ "target": "src/flask/app.py",
+ "strength": 2.05,
+ "last_co_change": "2026-02-20"
+ }
+ ],
+ "total_edges": 2,
+ "state": "ready"
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/dead-code.json b/packages/api-client/src/__fixtures__/hosted/dead-code.json
new file mode 100644
index 000000000..02a2ab54e
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/dead-code.json
@@ -0,0 +1,46 @@
+{
+ "total_findings": 28,
+ "deletable_lines": 169,
+ "findings": [
+ {
+ "kind": "unreachable_file",
+ "file_path": "docs/conf.py",
+ "symbol_name": null,
+ "symbol_kind": null,
+ "confidence": 0.4,
+ "reason": "File has no importers (in_degree=0)",
+ "last_commit_at": "2025-06-12T20:46:49+00:00",
+ "commit_count_90d": 0,
+ "lines": 240,
+ "package": "docs",
+ "evidence": [
+ "in_degree=0 (no files import this)",
+ "No commits in last 90 days",
+ "Package uses dynamic imports or runtime-resolved edges",
+ "Runtime-load risk (configuration): files of this kind are often referenced outside static imports — review before deleting"
+ ],
+ "safe_to_delete": false,
+ "primary_owner": "David Lord",
+ "age_days": 3734
+ },
+ {
+ "kind": "unreachable_file",
+ "file_path": "examples/celery/make_celery.py",
+ "symbol_name": null,
+ "symbol_kind": null,
+ "confidence": 1,
+ "reason": "File has no importers (in_degree=0)",
+ "last_commit_at": "2023-02-10T17:16:53+00:00",
+ "commit_count_90d": 0,
+ "lines": 20,
+ "package": "examples",
+ "evidence": [
+ "in_degree=0 (no files import this)",
+ "No commits in last 90 days"
+ ],
+ "safe_to_delete": true,
+ "primary_owner": "David Lord",
+ "age_days": 1239
+ }
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/decisions.json b/packages/api-client/src/__fixtures__/hosted/decisions.json
new file mode 100644
index 000000000..d68c5e585
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/decisions.json
@@ -0,0 +1,106 @@
+{
+ "total_found": 32,
+ "decisions": [
+ {
+ "id": "9827083f96ad4d149c9d983a7e59a9bc",
+ "title": "Windows env var keys are always uppercase.",
+ "context": "In `tests.test_config.test_from_prefixed_env_nested` (tests/test_config.py:97)",
+ "decision": "Windows env var keys are always uppercase.",
+ "rationale": "",
+ "alternatives": [],
+ "consequences": [],
+ "affected_files": [
+ "tests/test_config.py"
+ ],
+ "affected_modules": [
+ "tests"
+ ],
+ "tags": [],
+ "source": "code_comment",
+ "evidence_commits": [],
+ "evidence_file": "tests/test_config.py",
+ "evidence_line": 97,
+ "confidence": 0.511,
+ "status": "proposed",
+ "verification": "exact",
+ "source_quote": "Windows env var keys are always uppercase.",
+ "staleness_score": 0,
+ "superseded_by": null,
+ "last_code_change": null,
+ "evidence": [
+ {
+ "source": "code_comment",
+ "source_rank": 2,
+ "evidence_file": "tests/test_config.py",
+ "evidence_line": 97,
+ "evidence_commit": null,
+ "source_quote": "Windows env var keys are always uppercase.",
+ "confidence": 0.3,
+ "verification": "exact"
+ }
+ ],
+ "evidence_count": 1,
+ "evidence_preview": {
+ "source": "code_comment",
+ "source_quote": "Windows env var keys are always uppercase.",
+ "verification": "exact",
+ "evidence_file": "tests/test_config.py",
+ "evidence_line": 97
+ }
+ },
+ {
+ "id": "d4175eb5203c426abeb80cd320a55136",
+ "title": "do this instead of startswith for nicer pytest output",
+ "context": "In `tests.test_cli.TestRoutes.expect_order` (tests/test_cli.py:466)",
+ "decision": "do this instead of startswith for nicer pytest output",
+ "rationale": "",
+ "alternatives": [],
+ "consequences": [],
+ "affected_files": [
+ "tests/test_cli.py"
+ ],
+ "affected_modules": [
+ "tests"
+ ],
+ "tags": [
+ "testing"
+ ],
+ "source": "code_comment",
+ "evidence_commits": [],
+ "evidence_file": "tests/test_cli.py",
+ "evidence_line": 466,
+ "confidence": 0.511,
+ "status": "proposed",
+ "verification": "exact",
+ "source_quote": "do this instead of startswith for nicer pytest output",
+ "staleness_score": 0,
+ "superseded_by": null,
+ "last_code_change": null,
+ "evidence": [
+ {
+ "source": "code_comment",
+ "source_rank": 2,
+ "evidence_file": "tests/test_cli.py",
+ "evidence_line": 466,
+ "evidence_commit": null,
+ "source_quote": "do this instead of startswith for nicer pytest output",
+ "confidence": 0.3,
+ "verification": "exact"
+ }
+ ],
+ "evidence_count": 1,
+ "evidence_preview": {
+ "source": "code_comment",
+ "source_quote": "do this instead of startswith for nicer pytest output",
+ "verification": "exact",
+ "evidence_file": "tests/test_cli.py",
+ "evidence_line": 466
+ }
+ }
+ ],
+ "by_source": {
+ "code_comment": 24,
+ "comment": 4,
+ "pr": 4
+ }
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/docs.json b/packages/api-client/src/__fixtures__/hosted/docs.json
new file mode 100644
index 000000000..0e95b9388
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/docs.json
@@ -0,0 +1,89 @@
+{
+ "available": true,
+ "pages": [
+ {
+ "page_id": "api_contract:packages/core/src/repowise/core/ingestion/languages/specs/openapi.py",
+ "page_type": "api_contract",
+ "title": "API Contract: packages/core/src/repowise/core/ingestion/languages/specs/openapi.py",
+ "content": "## Overview\n\nThis API contract defines a **language specification** for **OpenAPI** within the Repowise ingestion system. It does **not** declare any HTTP endpoints or data schemas itself; instead, it configures how the ingestion pipeline should treat OpenAPI inputs.\n\nKey characteristics of this lan",
+ "target_path": "packages/core/src/repowise/core/ingestion/languages/specs/openapi.py",
+ "freshness_status": "fresh",
+ "source_hash": "8edc971707061718d2ed7ead86300977b3bb4d843f3af13938d665c26f8ff35b",
+ "model_name": "gpt-5.4-nano",
+ "provider_name": "openai",
+ "input_tokens": 0,
+ "output_tokens": 0,
+ "generation_level": 0,
+ "confidence": 1,
+ "created_at": "2026-07-04T15:16:00.959140+00:00",
+ "updated_at": "2026-07-04T15:16:00.959140+00:00",
+ "summary": "This API contract defines a **language specification** for **OpenAPI** within the Repowise ingestion system. It does **not** declare any HTTP endpoints or data schemas itself; instead, it configures how the ingestion pipeline should treat OpenAPI inputs.",
+ "metadata": {
+ "wiki_links": [],
+ "backlinks": [
+ {
+ "source_page_id": "file_page:packages/core/src/repowise/core/ingestion/languages/specs/__init__.py",
+ "source_title": "File: packages/core/src/repowise/core/ingestion/languages/specs/__init__.py",
+ "source_page_type": "file_page",
+ "anchor": "SPEC"
+ },
+ {
+ "source_page_id": "module_page:packages/core/src/repowise/core/ingestion/languages",
+ "source_title": "Module: ingestion/languages",
+ "source_page_type": "module_page",
+ "anchor": "SPEC"
+ },
+ {
+ "source_page_id": "layer_page:layer:service",
+ "source_title": "Layer: Service",
+ "source_page_type": "layer_page",
+ "anchor": "SPEC"
+ },
+ {
+ "source_page_id": "onboarding:onboarding/key_concepts",
+ "source_title": "Key Concepts",
+ "source_page_type": "onboarding",
+ "anchor": "SPEC"
+ }
+ ]
+ },
+ "id": "api_contract:packages/core/src/repowise/core/ingestion/languages/specs/openapi.py"
+ },
+ {
+ "page_id": "symbol_spotlight:tests/conftest.py::repo_root",
+ "page_type": "symbol_spotlight",
+ "title": "Symbol: tests.conftest.repo_root",
+ "content": "## Purpose\n\n`repo_root` is a session-scoped pytest fixture that returns the absolute filesystem path to the repository’s root directory. It is used throughout the test suite to reliably locate files and resources relative to the project root, regardless of the current working directory.\n\n## Signatur",
+ "target_path": "tests/conftest.py::repo_root",
+ "freshness_status": "fresh",
+ "source_hash": "b71ffe24c2c9096841740a4a0274f75603afc2a879e7a694cbf6a1450a464b9e",
+ "model_name": "gpt-5.4-nano",
+ "provider_name": "openai",
+ "input_tokens": 6808,
+ "output_tokens": 152,
+ "generation_level": 1,
+ "confidence": 1,
+ "created_at": "2026-07-04T15:16:04.157142+00:00",
+ "updated_at": "2026-07-04T15:16:04.157142+00:00",
+ "summary": "`repo_root` is a session-scoped pytest fixture that returns the absolute filesystem path to the repository’s root directory. It is used throughout the test suite to reliably locate files and resources relative to the project root, regardless of the current working directory.",
+ "metadata": {
+ "wiki_links": [
+ {
+ "anchor": "repo_root",
+ "target_page_id": "file_page:tests/conftest.py",
+ "kind": "symbol"
+ }
+ ],
+ "backlinks": []
+ },
+ "id": "symbol_spotlight:tests/conftest.py::repo_root"
+ }
+ ],
+ "docs_status": "ready",
+ "pages_ready": 523,
+ "pages_total": 523,
+ "authoritative_page_types": [
+ "module_page",
+ "layer_page"
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/execution-flows.json b/packages/api-client/src/__fixtures__/hosted/execution-flows.json
new file mode 100644
index 000000000..411150511
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/execution-flows.json
@@ -0,0 +1,406 @@
+{
+ "total_entry_points": 39,
+ "flows": [
+ {
+ "entry_point": "src/flask/app.py::Flask::do_teardown_request",
+ "entry_point_name": "do_teardown_request",
+ "entry_point_score": 0.8383,
+ "trace": [
+ "src/flask/app.py::Flask::do_teardown_request",
+ "src/flask/app.py::Flask::ensure_sync",
+ "src/flask/app.py::Flask::async_to_sync"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 0
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::do_teardown_appcontext",
+ "entry_point_name": "do_teardown_appcontext",
+ "entry_point_score": 0.8383,
+ "trace": [
+ "src/flask/app.py::Flask::do_teardown_appcontext",
+ "src/flask/app.py::Flask::ensure_sync",
+ "src/flask/app.py::Flask::async_to_sync"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 0
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::__init_subclass__",
+ "entry_point_name": "__init_subclass__",
+ "entry_point_score": 0.7483,
+ "trace": [
+ "src/flask/app.py::Flask::__init_subclass__",
+ "src/flask/app.py::add_ctx",
+ "src/flask/globals.py::ProxyMixin::_get_current_object"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 12
+ ]
+ },
+ {
+ "entry_point": "src/flask/templating.py::DispatchingJinjaLoader::get_source",
+ "entry_point_name": "get_source",
+ "entry_point_score": 0.7433,
+ "trace": [
+ "src/flask/templating.py::DispatchingJinjaLoader::get_source",
+ "src/flask/templating.py::DispatchingJinjaLoader::_get_source_explained",
+ "src/flask/debughelpers.py::explain_template_loading_attempts",
+ "src/flask/debughelpers.py::_dump_loader_info"
+ ],
+ "depth": 3,
+ "crosses_community": false,
+ "communities_visited": [
+ 17
+ ]
+ },
+ {
+ "entry_point": "src/flask/blueprints.py::Blueprint::send_static_file",
+ "entry_point_name": "send_static_file",
+ "entry_point_score": 0.7433,
+ "trace": [
+ "src/flask/blueprints.py::Blueprint::send_static_file",
+ "src/flask/helpers.py::send_from_directory",
+ "src/flask/helpers.py::_prepare_send_file_kwargs",
+ "src/flask/globals.py::ProxyMixin::_get_current_object"
+ ],
+ "depth": 3,
+ "crosses_community": true,
+ "communities_visited": [
+ 7,
+ 12
+ ]
+ },
+ {
+ "entry_point": "src/flask/testing.py::FlaskClient::open",
+ "entry_point_name": "open",
+ "entry_point_score": 0.7275,
+ "trace": [
+ "src/flask/testing.py::FlaskClient::open",
+ "src/flask/testing.py::FlaskClient::_request_from_builder_args",
+ "src/flask/testing.py::FlaskClient::_copy_environ"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 9
+ ]
+ },
+ {
+ "entry_point": "src/flask/testing.py::FlaskClient::__init__",
+ "entry_point_name": "__init__",
+ "entry_point_score": 0.6983,
+ "trace": [
+ "src/flask/testing.py::FlaskClient::__init__",
+ "src/flask/testing.py::FlaskCliRunner::__init__",
+ "src/flask/app.py::Flask::__init__",
+ "src/flask/app.py::Flask::send_static_file",
+ "src/flask/helpers.py::send_from_directory",
+ "src/flask/helpers.py::_prepare_send_file_kwargs",
+ "src/flask/globals.py::ProxyMixin::_get_current_object"
+ ],
+ "depth": 6,
+ "crosses_community": true,
+ "communities_visited": [
+ 9,
+ 0,
+ 12
+ ]
+ },
+ {
+ "entry_point": "src/flask/sessions.py::SecureCookieSessionInterface::save_session",
+ "entry_point_name": "save_session",
+ "entry_point_score": 0.6983,
+ "trace": [
+ "src/flask/sessions.py::SecureCookieSessionInterface::save_session",
+ "src/flask/json/tag.py::TaggedJSONSerializer::dumps",
+ "src/flask/json/__init__.py::dumps"
+ ],
+ "depth": 2,
+ "crosses_community": true,
+ "communities_visited": [
+ 11,
+ 5
+ ]
+ },
+ {
+ "entry_point": "src/flask/json/tag.py::TaggedJSONSerializer::loads",
+ "entry_point_name": "loads",
+ "entry_point_score": 0.6983,
+ "trace": [
+ "src/flask/json/tag.py::TaggedJSONSerializer::loads",
+ "src/flask/json/tag.py::TaggedJSONSerializer::_untag_scan",
+ "src/flask/json/tag.py::TaggedJSONSerializer::untag"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 5
+ ]
+ },
+ {
+ "entry_point": "src/flask/templating.py::stream_template_string",
+ "entry_point_name": "stream_template_string",
+ "entry_point_score": 0.6983,
+ "trace": [
+ "src/flask/templating.py::stream_template_string",
+ "src/flask/templating.py::_stream",
+ "src/flask/helpers.py::stream_with_context"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 12
+ ]
+ },
+ {
+ "entry_point": "src/flask/sansio/blueprints.py::Blueprint::register",
+ "entry_point_name": "register",
+ "entry_point_score": 0.6983,
+ "trace": [
+ "src/flask/sansio/blueprints.py::Blueprint::register",
+ "src/flask/sansio/blueprints.py::Blueprint::make_setup_state",
+ "src/flask/sansio/blueprints.py::BlueprintSetupState"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 8
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::handle_exception",
+ "entry_point_name": "handle_exception",
+ "entry_point_score": 0.69,
+ "trace": [
+ "src/flask/app.py::Flask::handle_exception",
+ "src/flask/app.py::Flask::finalize_request",
+ "src/flask/app.py::Flask::process_response",
+ "src/flask/app.py::Flask::ensure_sync",
+ "src/flask/app.py::Flask::async_to_sync"
+ ],
+ "depth": 4,
+ "crosses_community": false,
+ "communities_visited": [
+ 0
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::dispatch_request",
+ "entry_point_name": "dispatch_request",
+ "entry_point_score": 0.69,
+ "trace": [
+ "src/flask/app.py::Flask::dispatch_request",
+ "src/flask/app.py::Flask::raise_routing_exception",
+ "src/flask/debughelpers.py::FormDataRoutingRedirect"
+ ],
+ "depth": 2,
+ "crosses_community": true,
+ "communities_visited": [
+ 0,
+ 7
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::handle_user_exception",
+ "entry_point_name": "handle_user_exception",
+ "entry_point_score": 0.655,
+ "trace": [
+ "src/flask/app.py::Flask::handle_user_exception",
+ "src/flask/app.py::Flask::handle_http_exception",
+ "src/flask/app.py::Flask::ensure_sync",
+ "src/flask/app.py::Flask::async_to_sync"
+ ],
+ "depth": 3,
+ "crosses_community": false,
+ "communities_visited": [
+ 0
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::full_dispatch_request",
+ "entry_point_name": "full_dispatch_request",
+ "entry_point_score": 0.6233,
+ "trace": [
+ "src/flask/app.py::Flask::full_dispatch_request",
+ "src/flask/app.py::Flask::dispatch_request",
+ "src/flask/app.py::Flask::raise_routing_exception",
+ "src/flask/debughelpers.py::FormDataRoutingRedirect"
+ ],
+ "depth": 3,
+ "crosses_community": true,
+ "communities_visited": [
+ 0,
+ 7
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::send_static_file",
+ "entry_point_name": "send_static_file",
+ "entry_point_score": 0.61,
+ "trace": [
+ "src/flask/app.py::Flask::send_static_file",
+ "src/flask/helpers.py::send_from_directory",
+ "src/flask/helpers.py::_prepare_send_file_kwargs",
+ "src/flask/globals.py::ProxyMixin::_get_current_object"
+ ],
+ "depth": 3,
+ "crosses_community": true,
+ "communities_visited": [
+ 0,
+ 12
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::wsgi_app",
+ "entry_point_name": "wsgi_app",
+ "entry_point_score": 0.6,
+ "trace": [
+ "src/flask/app.py::Flask::wsgi_app",
+ "src/flask/app.py::Flask::full_dispatch_request",
+ "src/flask/app.py::Flask::dispatch_request",
+ "src/flask/app.py::Flask::raise_routing_exception",
+ "src/flask/debughelpers.py::FormDataRoutingRedirect"
+ ],
+ "depth": 4,
+ "crosses_community": true,
+ "communities_visited": [
+ 0,
+ 7
+ ]
+ },
+ {
+ "entry_point": "src/flask/cli.py::ScriptInfo::load_app",
+ "entry_point_name": "load_app",
+ "entry_point_score": 0.5733,
+ "trace": [
+ "src/flask/cli.py::ScriptInfo::load_app",
+ "src/flask/cli.py::locate_app",
+ "src/flask/cli.py::find_best_app",
+ "src/flask/cli.py::NoAppException"
+ ],
+ "depth": 3,
+ "crosses_community": false,
+ "communities_visited": [
+ 3
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::test_request_context",
+ "entry_point_name": "test_request_context",
+ "entry_point_score": 0.565,
+ "trace": [
+ "src/flask/app.py::Flask::test_request_context",
+ "src/flask/app.py::Flask::request_context",
+ "src/flask/ctx.py::AppContext::from_environ"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 0
+ ]
+ },
+ {
+ "entry_point": "src/flask/templating.py::stream_template",
+ "entry_point_name": "stream_template",
+ "entry_point_score": 0.515,
+ "trace": [
+ "src/flask/templating.py::stream_template",
+ "src/flask/templating.py::_stream",
+ "src/flask/helpers.py::stream_with_context"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 12
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::__init__",
+ "entry_point_name": "__init__",
+ "entry_point_score": 0.44,
+ "trace": [
+ "src/flask/app.py::Flask::__init__",
+ "src/flask/app.py::Flask::send_static_file",
+ "src/flask/helpers.py::send_from_directory",
+ "src/flask/helpers.py::_prepare_send_file_kwargs",
+ "src/flask/globals.py::ProxyMixin::_get_current_object"
+ ],
+ "depth": 4,
+ "crosses_community": true,
+ "communities_visited": [
+ 0,
+ 12
+ ]
+ },
+ {
+ "entry_point": "src/flask/app.py::Flask::finalize_request",
+ "entry_point_name": "finalize_request",
+ "entry_point_score": 0.405,
+ "trace": [
+ "src/flask/app.py::Flask::finalize_request",
+ "src/flask/app.py::Flask::process_response",
+ "src/flask/app.py::Flask::ensure_sync",
+ "src/flask/app.py::Flask::async_to_sync"
+ ],
+ "depth": 3,
+ "crosses_community": false,
+ "communities_visited": [
+ 0
+ ]
+ },
+ {
+ "entry_point": "src/flask/cli.py::locate_app",
+ "entry_point_name": "locate_app",
+ "entry_point_score": 0.3463,
+ "trace": [
+ "src/flask/cli.py::locate_app",
+ "src/flask/cli.py::find_best_app",
+ "src/flask/cli.py::NoAppException"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 3
+ ]
+ },
+ {
+ "entry_point": "src/flask/wrappers.py::Request::_load_form_data",
+ "entry_point_name": "_load_form_data",
+ "entry_point_score": 0.315,
+ "trace": [
+ "src/flask/wrappers.py::Request::_load_form_data",
+ "src/flask/debughelpers.py::attach_enctype_error_multidict",
+ "src/flask/debughelpers.py::DebugFilesKeyError"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 13
+ ]
+ },
+ {
+ "entry_point": "src/flask/templating.py::DispatchingJinjaLoader::_get_source_explained",
+ "entry_point_name": "_get_source_explained",
+ "entry_point_score": 0.315,
+ "trace": [
+ "src/flask/templating.py::DispatchingJinjaLoader::_get_source_explained",
+ "src/flask/debughelpers.py::explain_template_loading_attempts",
+ "src/flask/debughelpers.py::_dump_loader_info"
+ ],
+ "depth": 2,
+ "crosses_community": false,
+ "communities_visited": [
+ 17
+ ]
+ }
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/file-detail.json b/packages/api-client/src/__fixtures__/hosted/file-detail.json
new file mode 100644
index 000000000..55c98c35c
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/file-detail.json
@@ -0,0 +1,61 @@
+{
+ "file_path": ".pre-commit-config.yaml",
+ "wiki_page": null,
+ "health": {
+ "metric": {
+ "file_path": ".pre-commit-config.yaml",
+ "score": 10,
+ "band": "healthy",
+ "max_ccn": 1,
+ "max_nesting": 0,
+ "nloc": 23,
+ "duplication_pct": null,
+ "has_test_file": false,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "config",
+ "defect_score": 10,
+ "maintainability_score": 10,
+ "performance_score": 10,
+ "top_biomarkers": []
+ },
+ "breakdown": {
+ "file_path": ".pre-commit-config.yaml",
+ "score": 10,
+ "deductions_by_category": {},
+ "findings": [],
+ "suggestion": null,
+ "state": "ready",
+ "reason": null
+ },
+ "findings": []
+ },
+ "git": null,
+ "coverage": null,
+ "graph": {
+ "language": "yaml",
+ "is_entry_point": false,
+ "is_test": false,
+ "symbol_count": 0,
+ "pagerank": 0.002136,
+ "pagerank_percentile": 0,
+ "in_degree": 0,
+ "out_degree": 1,
+ "community_id": 14,
+ "community_label": null,
+ "dependents": [],
+ "dependencies": [
+ {
+ "node_id": ".pre-commit-config.yaml::__module__",
+ "node_type": "symbol",
+ "language": "yaml",
+ "edge_type": "defines",
+ "imported_names": []
+ }
+ ]
+ },
+ "symbols": [],
+ "function_blame": [],
+ "governing_decisions": [],
+ "dead_code": []
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/files-index.json b/packages/api-client/src/__fixtures__/hosted/files-index.json
new file mode 100644
index 000000000..0f905fd74
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/files-index.json
@@ -0,0 +1,78 @@
+{
+ "files": [
+ {
+ "file_path": ".pre-commit-config.yaml",
+ "language": "yaml",
+ "loc": 23,
+ "symbol_count": 0,
+ "pagerank_pct": 0,
+ "in_degree": 0,
+ "out_degree": 1,
+ "defect_score": 10,
+ "maintainability_score": 10,
+ "performance_score": 10,
+ "churn_pct": null,
+ "commit_count": null,
+ "last_commit_at": null,
+ "coverage_pct": null,
+ "is_test": false,
+ "is_entry_point": false,
+ "community_id": 14
+ },
+ {
+ "file_path": ".readthedocs.yaml",
+ "language": "yaml",
+ "loc": 10,
+ "symbol_count": 0,
+ "pagerank_pct": 0,
+ "in_degree": 0,
+ "out_degree": 1,
+ "defect_score": 10,
+ "maintainability_score": 10,
+ "performance_score": 10,
+ "churn_pct": null,
+ "commit_count": null,
+ "last_commit_at": null,
+ "coverage_pct": null,
+ "is_test": false,
+ "is_entry_point": false,
+ "community_id": 15
+ },
+ {
+ "file_path": "README.md",
+ "language": "markdown",
+ "loc": 38,
+ "symbol_count": 0,
+ "pagerank_pct": 0,
+ "in_degree": 0,
+ "out_degree": 1,
+ "defect_score": 10,
+ "maintainability_score": 10,
+ "performance_score": 10,
+ "churn_pct": null,
+ "commit_count": null,
+ "last_commit_at": null,
+ "coverage_pct": null,
+ "is_test": false,
+ "is_entry_point": false,
+ "community_id": 16
+ }
+ ],
+ "language_counts": {
+ "yaml": 8,
+ "markdown": 6,
+ "toml": 5,
+ "shell": 1,
+ "json": 2,
+ "makefile": 1,
+ "python": 83,
+ "sql": 2
+ },
+ "totals": {
+ "files": 108,
+ "loc": 14043
+ },
+ "state": "ready",
+ "reason": null,
+ "items": []
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/git-summary.json b/packages/api-client/src/__fixtures__/hosted/git-summary.json
new file mode 100644
index 000000000..8d7a7db4b
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/git-summary.json
@@ -0,0 +1,23 @@
+{
+ "total_files": 84,
+ "hotspot_count": 0,
+ "stable_count": 35,
+ "average_churn_percentile": 49.404761904761905,
+ "top_owners": [
+ {
+ "name": "David Lord",
+ "file_count": 58,
+ "pct": 0.6904761904761905
+ },
+ {
+ "name": "Markus Unterwaditzer",
+ "file_count": 5,
+ "pct": 0.05952380952380952
+ },
+ {
+ "name": "pgjones",
+ "file_count": 4,
+ "pct": 0.047619047619047616
+ }
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/health-files.json b/packages/api-client/src/__fixtures__/hosted/health-files.json
new file mode 100644
index 000000000..49a51fdbb
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/health-files.json
@@ -0,0 +1,182 @@
+[
+ {
+ "file_path": "src/flask/app.py",
+ "score": 1.07,
+ "band": "alert",
+ "max_ccn": 16,
+ "max_nesting": 5,
+ "nloc": 1235,
+ "duplication_pct": 10.42,
+ "has_test_file": false,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "flask",
+ "defect_score": 1.07,
+ "maintainability_score": 3.1,
+ "performance_score": 9.7,
+ "top_biomarkers": [
+ {
+ "id": "1633695362c7ee2ec41d4144",
+ "biomarker_type": "untested_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/app.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "dependents_count": 6,
+ "commit_count_90d": 0,
+ "has_test_file": false
+ },
+ "health_impact": 1.56,
+ "reason": "Hotspot with no paired test file and no coverage data — 6 dependents",
+ "status": "open",
+ "suggestion": "Hot file with low/no coverage — add tests against the most-changed methods first.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "a636c1b680c14f66696424f2",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/app.py",
+ "function_name": "make_response",
+ "line_start": 1224,
+ "line_end": 1364,
+ "details": {
+ "modification_count": 6,
+ "repo_p80": 5,
+ "ccn": 16,
+ "max_nesting": 5
+ },
+ "health_impact": 1.392,
+ "reason": "make_response has been modified across 6 commits (repo p80=5) and carries CCN=16 / nesting=5",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ },
+ {
+ "file_path": "src/flask/sansio/app.py",
+ "score": 1.35,
+ "band": "alert",
+ "max_ccn": 12,
+ "max_nesting": 4,
+ "nloc": 678,
+ "duplication_pct": 14.3,
+ "has_test_file": false,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "flask/sansio",
+ "defect_score": 1.35,
+ "maintainability_score": 4.8,
+ "performance_score": 10,
+ "top_biomarkers": [
+ {
+ "id": "cb2c376ceb485261bac68091",
+ "biomarker_type": "untested_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/sansio/app.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "dependents_count": 7,
+ "commit_count_90d": 1,
+ "has_test_file": false
+ },
+ "health_impact": 1.56,
+ "reason": "Hotspot with no paired test file and no coverage data — 7 dependents",
+ "status": "open",
+ "suggestion": "Hot file with low/no coverage — add tests against the most-changed methods first.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "25e5ed47ef2620733ce4d61b",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/sansio/app.py",
+ "function_name": "add_url_rule",
+ "line_start": 605,
+ "line_end": 661,
+ "details": {
+ "modification_count": 19,
+ "repo_p80": 5,
+ "ccn": 12,
+ "max_nesting": 2
+ },
+ "health_impact": 1.18,
+ "reason": "add_url_rule has been modified across 19 commits (repo p80=5) and carries CCN=12 / nesting=2",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ },
+ {
+ "file_path": "src/flask/cli.py",
+ "score": 2.05,
+ "band": "alert",
+ "max_ccn": 13,
+ "max_nesting": 5,
+ "nloc": 822,
+ "duplication_pct": null,
+ "has_test_file": true,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "flask",
+ "defect_score": 2.05,
+ "maintainability_score": 3.6,
+ "performance_score": 9.85,
+ "top_biomarkers": [
+ {
+ "id": "3c7b89ff0c13fa0b1123901b",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "convert",
+ "line_start": 791,
+ "line_end": 825,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 6,
+ "cognitive": 21
+ },
+ "health_impact": 0.605,
+ "reason": "convert nests 5 levels deep",
+ "status": "open",
+ "suggestion": "Flatten nested control flow with early returns or guard clauses.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "d9c8ad9cb0af754e7a5a0a54",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 10,
+ "cognitive": 25
+ },
+ "health_impact": 0.605,
+ "reason": "find_best_app nests 5 levels deep",
+ "status": "open",
+ "suggestion": "Flatten nested control flow with early returns or guard clauses.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ }
+]
diff --git a/packages/api-client/src/__fixtures__/hosted/health-findings.json b/packages/api-client/src/__fixtures__/hosted/health-findings.json
new file mode 100644
index 000000000..9dc411013
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/health-findings.json
@@ -0,0 +1,1022 @@
+{
+ "items": [
+ {
+ "id": "24ee1f24b481e78e25d7b1aa",
+ "biomarker_type": "primitive_obsession",
+ "severity": "medium",
+ "file_path": "docs/conf.py",
+ "function_name": "github_link",
+ "line_start": 72,
+ "line_end": 97,
+ "details": {
+ "param_count": 7
+ },
+ "health_impact": 0.35,
+ "reason": "github_link takes 7 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "docs/conf.py::github_link"
+ },
+ {
+ "id": "7fc2bfb45bd876adac3926a2",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "docs/conf.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 6,
+ "top_owner_share": 0.771,
+ "contributor_count": 8,
+ "total_commits": 48,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "6 minor contributors (each <5% of commits); top owner holds 77% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "09d0b47644642dd7b41fd9c1",
+ "biomarker_type": "nested_complexity",
+ "severity": "medium",
+ "file_path": "examples/tutorial/flaskr/auth.py",
+ "function_name": "register",
+ "line_start": 47,
+ "line_end": 81,
+ "details": {
+ "max_nesting": 4,
+ "ccn": 6,
+ "cognitive": 15
+ },
+ "health_impact": 0.938,
+ "reason": "register nests 4 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "examples/tutorial/flaskr/auth.py::register"
+ },
+ {
+ "id": "845765e86a8dc67f7be0f099",
+ "biomarker_type": "dry_violation",
+ "severity": "medium",
+ "file_path": "examples/tutorial/flaskr/blog.py",
+ "function_name": null,
+ "line_start": 64,
+ "line_end": 77,
+ "details": {
+ "duplication_pct": 28,
+ "clone_pair_count": 1,
+ "worst_clone_lines": 14,
+ "worst_clone_partner": "examples/tutorial/flaskr/blog.py",
+ "worst_clone_co_change": 0
+ },
+ "health_impact": 0.35,
+ "reason": "28% of file duplicated; worst clone shares 14 lines with examples/tutorial/flaskr/blog.py",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "examples/tutorial/flaskr/blog.py::create"
+ },
+ {
+ "id": "a254a623ca40c0367121f788",
+ "biomarker_type": "dry_violation",
+ "severity": "medium",
+ "file_path": "src/flask/__init__.py",
+ "function_name": null,
+ "line_start": 1,
+ "line_end": 38,
+ "details": {
+ "duplication_pct": 100,
+ "clone_pair_count": 1,
+ "worst_clone_lines": 38,
+ "worst_clone_partner": "src/flask/__init__.py",
+ "worst_clone_co_change": 0
+ },
+ "health_impact": 0.35,
+ "reason": "100% of file duplicated; worst clone shares 38 lines with src/flask/__init__.py",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "8510993cad8a38502173828e",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/__init__.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 6,
+ "top_owner_share": 0.9,
+ "contributor_count": 7,
+ "total_commits": 70,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "6 minor contributors (each <5% of commits); top owner holds 90% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "3d05bc5d79a01696d298014f",
+ "biomarker_type": "low_cohesion",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "FlaskGroup",
+ "line_start": 531,
+ "line_end": 688,
+ "details": {
+ "class_name": "FlaskGroup",
+ "lcom4": 2,
+ "method_count": 6,
+ "field_count": 8
+ },
+ "health_impact": 0.132,
+ "reason": "FlaskGroup has low cohesion (LCOM4=2): its 6 methods split into 2 groups that share no fields or calls",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/cli.py::FlaskGroup"
+ },
+ {
+ "id": "3c7b89ff0c13fa0b1123901b",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "convert",
+ "line_start": 791,
+ "line_end": 825,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 6,
+ "cognitive": 21
+ },
+ "health_impact": 0.605,
+ "reason": "convert nests 5 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::CertParamType::convert"
+ },
+ {
+ "id": "6b2d945db56c1c1a84bc1b61",
+ "biomarker_type": "nested_complexity",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_app",
+ "line_start": 333,
+ "line_end": 372,
+ "details": {
+ "max_nesting": 4,
+ "ccn": 8,
+ "cognitive": 13
+ },
+ "health_impact": 0.353,
+ "reason": "load_app nests 4 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::ScriptInfo::load_app"
+ },
+ {
+ "id": "14513497430140aabebfc2fe",
+ "biomarker_type": "nested_complexity",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "max_nesting": 4,
+ "ccn": 11,
+ "cognitive": 30
+ },
+ "health_impact": 0.353,
+ "reason": "find_app_by_string nests 4 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_app_by_string"
+ },
+ {
+ "id": "d9c8ad9cb0af754e7a5a0a54",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 10,
+ "cognitive": 25
+ },
+ "health_impact": 0.605,
+ "reason": "find_best_app nests 5 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_best_app"
+ },
+ {
+ "id": "d5bc5211e56aca8f359d5826",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "routes_command",
+ "line_start": 1061,
+ "line_end": 1107,
+ "details": {
+ "ccn": 13,
+ "cognitive": 18,
+ "nloc": 35
+ },
+ "health_impact": 0.237,
+ "reason": "routes_command has cyclomatic complexity 13",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::routes_command"
+ },
+ {
+ "id": "cbb603900f1a645cb7015dca",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "_validate_key",
+ "line_start": 828,
+ "line_end": 864,
+ "details": {
+ "ccn": 9,
+ "cognitive": 14,
+ "nloc": 29
+ },
+ "health_impact": 0.237,
+ "reason": "_validate_key has cyclomatic complexity 9",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::_validate_key"
+ },
+ {
+ "id": "ca167abaa1b0f1c1158ea66b",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_dotenv",
+ "line_start": 698,
+ "line_end": 763,
+ "details": {
+ "ccn": 13,
+ "cognitive": 20,
+ "nloc": 47
+ },
+ "health_impact": 0.237,
+ "reason": "load_dotenv has cyclomatic complexity 13",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::load_dotenv"
+ },
+ {
+ "id": "57ab482435ea9ed4a56a87bc",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "ccn": 11,
+ "cognitive": 30,
+ "nloc": 68
+ },
+ "health_impact": 0.237,
+ "reason": "find_app_by_string has cyclomatic complexity 11",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_app_by_string"
+ },
+ {
+ "id": "f22e456d7508251a6d18b2e9",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "ccn": 10,
+ "cognitive": 25,
+ "nloc": 41
+ },
+ "health_impact": 0.237,
+ "reason": "find_best_app has cyclomatic complexity 10",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_best_app"
+ },
+ {
+ "id": "7206560799f1a29b8bd7c4ac",
+ "biomarker_type": "bumpy_road",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "routes_command",
+ "line_start": 1061,
+ "line_end": 1107,
+ "details": {
+ "bumps": 3,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.056,
+ "reason": "routes_command has 3 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::routes_command"
+ },
+ {
+ "id": "913c5f0126bcd903c916922e",
+ "biomarker_type": "bumpy_road",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_dotenv",
+ "line_start": 698,
+ "line_end": 763,
+ "details": {
+ "bumps": 3,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.056,
+ "reason": "load_dotenv has 3 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::load_dotenv"
+ },
+ {
+ "id": "0c5715dc8398bb9ecd57b830",
+ "biomarker_type": "bumpy_road",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "bumps": 4,
+ "ccn": 11,
+ "max_nesting": 4
+ },
+ "health_impact": 0.132,
+ "reason": "find_app_by_string has 4 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_app_by_string"
+ },
+ {
+ "id": "cc5c719dea8b6a80d1476727",
+ "biomarker_type": "bumpy_road",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "bumps": 3,
+ "ccn": 10,
+ "max_nesting": 5
+ },
+ "health_impact": 0.056,
+ "reason": "find_best_app has 3 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_best_app"
+ },
+ {
+ "id": "dd0194f456cad899e68c5882",
+ "biomarker_type": "large_method",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "nloc": 68,
+ "ccn": 11
+ },
+ "health_impact": 0.105,
+ "reason": "find_app_by_string is 68 lines long",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_app_by_string"
+ },
+ {
+ "id": "35e3b26a20e7b8469cf29305",
+ "biomarker_type": "primitive_obsession",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "run_command",
+ "line_start": 935,
+ "line_end": 993,
+ "details": {
+ "param_count": 9
+ },
+ "health_impact": 0.168,
+ "reason": "run_command takes 9 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/cli.py::run_command"
+ },
+ {
+ "id": "692f1eafa18fac253c10a7cd",
+ "biomarker_type": "primitive_obsession",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "make_context",
+ "line_start": 657,
+ "line_end": 676,
+ "details": {
+ "param_count": 5
+ },
+ "health_impact": 0.042,
+ "reason": "make_context takes 5 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/cli.py::FlaskGroup::make_context"
+ },
+ {
+ "id": "928db1374c4f29d5737fac2d",
+ "biomarker_type": "complex_conditional",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "parse_args",
+ "line_start": 679,
+ "line_end": 679,
+ "details": {
+ "operator_count": 3,
+ "enclosing_construct": "if"
+ },
+ "health_impact": 0.15,
+ "reason": "if condition combines 3 boolean operators",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::FlaskGroup::parse_args"
+ },
+ {
+ "id": "6def7c58d9285973cbd6f39d",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "routes_command",
+ "line_start": 1061,
+ "line_end": 1107,
+ "details": {
+ "modification_count": 6,
+ "repo_p80": 5,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.29,
+ "reason": "routes_command has been modified across 6 commits (repo p80=5) and carries CCN=13 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::routes_command"
+ },
+ {
+ "id": "59d987fdc3c5b86b84f15d0f",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "shell_command",
+ "line_start": 1001,
+ "line_end": 1045,
+ "details": {
+ "modification_count": 13,
+ "repo_p80": 5,
+ "ccn": 5,
+ "max_nesting": 3
+ },
+ "health_impact": 0.497,
+ "reason": "shell_command has been modified across 13 commits (repo p80=5) and carries CCN=5 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::shell_command"
+ },
+ {
+ "id": "b3c8a05d6fcfdb41ae13cefb",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "run_command",
+ "line_start": 935,
+ "line_end": 993,
+ "details": {
+ "modification_count": 11,
+ "repo_p80": 5,
+ "ccn": 5,
+ "max_nesting": 3
+ },
+ "health_impact": 0.497,
+ "reason": "run_command has been modified across 11 commits (repo p80=5) and carries CCN=5 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::run_command"
+ },
+ {
+ "id": "e1908844bfa38cece9505c6f",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "convert",
+ "line_start": 791,
+ "line_end": 825,
+ "details": {
+ "modification_count": 9,
+ "repo_p80": 5,
+ "ccn": 6,
+ "max_nesting": 5
+ },
+ "health_impact": 0.29,
+ "reason": "convert has been modified across 9 commits (repo p80=5) and carries CCN=6 / nesting=5",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::CertParamType::convert"
+ },
+ {
+ "id": "58266b29c997afce37748eda",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_dotenv",
+ "line_start": 698,
+ "line_end": 763,
+ "details": {
+ "modification_count": 9,
+ "repo_p80": 5,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.29,
+ "reason": "load_dotenv has been modified across 9 commits (repo p80=5) and carries CCN=13 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::load_dotenv"
+ },
+ {
+ "id": "f0ae5435d4f75d89f63cfa86",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_app",
+ "line_start": 333,
+ "line_end": 372,
+ "details": {
+ "modification_count": 15,
+ "repo_p80": 5,
+ "ccn": 8,
+ "max_nesting": 4
+ },
+ "health_impact": 0.497,
+ "reason": "load_app has been modified across 15 commits (repo p80=5) and carries CCN=8 / nesting=4",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::ScriptInfo::load_app"
+ },
+ {
+ "id": "aee5b1828c3883a30621c4de",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "modification_count": 13,
+ "repo_p80": 5,
+ "ccn": 11,
+ "max_nesting": 4
+ },
+ "health_impact": 0.497,
+ "reason": "find_app_by_string has been modified across 13 commits (repo p80=5) and carries CCN=11 / nesting=4",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_app_by_string"
+ },
+ {
+ "id": "6ac160cd46a9479d6d2263b1",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "modification_count": 17,
+ "repo_p80": 5,
+ "ccn": 10,
+ "max_nesting": 5
+ },
+ "health_impact": 0.497,
+ "reason": "find_best_app has been modified across 17 commits (repo p80=5) and carries CCN=10 / nesting=5",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/cli.py::find_best_app"
+ },
+ {
+ "id": "fb1070635166396549df3d9d",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 16,
+ "top_owner_share": 0.697,
+ "contributor_count": 18,
+ "total_commits": 66,
+ "small_team": true
+ },
+ "health_impact": 0.148,
+ "reason": "16 minor contributors (each <5% of commits); top owner holds 70% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "19efd878bb50fe44398161e7",
+ "biomarker_type": "error_handling",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": 650,
+ "line_end": 650,
+ "details": {
+ "kind": "bare_except"
+ },
+ "health_impact": 0.15,
+ "reason": "catch-all except hides every error, including KeyboardInterrupt",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/cli.py::FlaskGroup::list_commands"
+ },
+ {
+ "id": "db511e524f8430078dc806c9",
+ "biomarker_type": "error_handling",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": 1036,
+ "line_end": 1036,
+ "details": {
+ "kind": "swallowed_catch"
+ },
+ "health_impact": 0.15,
+ "reason": "caught exception is swallowed without any handling",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/cli.py::shell_command"
+ },
+ {
+ "id": "1c5ab929fed77ec9ae5d3bf3",
+ "biomarker_type": "error_handling",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": 1098,
+ "line_end": 1098,
+ "details": {
+ "kind": "swallowed_catch"
+ },
+ "health_impact": 0.15,
+ "reason": "caught exception is swallowed without any handling",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/cli.py::routes_command"
+ },
+ {
+ "id": "21e7656ae601236104f81d2e",
+ "biomarker_type": "hot_path_sync_io",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "shell_command",
+ "line_start": 1022,
+ "line_end": 1022,
+ "details": {
+ "boundary_kind": "filesystem"
+ },
+ "health_impact": 0,
+ "reason": "a blocking filesystem call runs on a hot, request-reachable path; its latency is paid on every call through this function",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "performance",
+ "symbol_id": "src/flask/cli.py::shell_command"
+ },
+ {
+ "id": "866b5edd940c2fd3c736feb8",
+ "biomarker_type": "dry_violation",
+ "severity": "low",
+ "file_path": "src/flask/globals.py",
+ "function_name": null,
+ "line_start": 18,
+ "line_end": 28,
+ "details": {
+ "duplication_pct": 22.41,
+ "clone_pair_count": 1,
+ "worst_clone_lines": 11,
+ "worst_clone_partner": "src/flask/globals.py",
+ "worst_clone_co_change": 0
+ },
+ "health_impact": 0.15,
+ "reason": "22% of file duplicated; worst clone shares 11 lines with src/flask/globals.py",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/globals.py::ProxyMixin::_get_current_object"
+ },
+ {
+ "id": "dd3381c1030aed17697543ea",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/helpers.py",
+ "function_name": "get_root_path",
+ "line_start": 587,
+ "line_end": 641,
+ "details": {
+ "ccn": 9,
+ "cognitive": 12,
+ "nloc": 45
+ },
+ "health_impact": 0.821,
+ "reason": "get_root_path has cyclomatic complexity 9",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/helpers.py::get_root_path"
+ },
+ {
+ "id": "0da42a3887baa307c4485598",
+ "biomarker_type": "primitive_obsession",
+ "severity": "medium",
+ "file_path": "src/flask/helpers.py",
+ "function_name": "send_file",
+ "line_start": 417,
+ "line_end": 540,
+ "details": {
+ "param_count": 8
+ },
+ "health_impact": 0.339,
+ "reason": "send_file takes 8 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/helpers.py::send_file"
+ },
+ {
+ "id": "1894a1e4e5d886fb52cbcbcf",
+ "biomarker_type": "primitive_obsession",
+ "severity": "medium",
+ "file_path": "src/flask/helpers.py",
+ "function_name": "url_for",
+ "line_start": 200,
+ "line_end": 251,
+ "details": {
+ "param_count": 7
+ },
+ "health_impact": 0.339,
+ "reason": "url_for takes 7 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/helpers.py::url_for"
+ },
+ {
+ "id": "818bb7c32b8a0ac81c3afe7d",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/helpers.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 20,
+ "top_owner_share": 0.636,
+ "contributor_count": 22,
+ "total_commits": 88,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "20 minor contributors (each <5% of commits); top owner holds 64% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "e3e3a4f918437a70cfea06c5",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/debughelpers.py",
+ "function_name": "explain_template_loading_attempts",
+ "line_start": 124,
+ "line_end": 179,
+ "details": {
+ "ccn": 13,
+ "cognitive": 18,
+ "nloc": 37
+ },
+ "health_impact": 0.847,
+ "reason": "explain_template_loading_attempts has cyclomatic complexity 13",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/debughelpers.py::explain_template_loading_attempts"
+ },
+ {
+ "id": "fcb77b4c8e501e308d016f2b",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/debughelpers.py",
+ "function_name": "explain_template_loading_attempts",
+ "line_start": 124,
+ "line_end": 179,
+ "details": {
+ "modification_count": 8,
+ "repo_p80": 5,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.812,
+ "reason": "explain_template_loading_attempts has been modified across 8 commits (repo p80=5) and carries CCN=13 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/debughelpers.py::explain_template_loading_attempts"
+ },
+ {
+ "id": "ec30edc0a31e12eaa4c24baa",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/debughelpers.py",
+ "function_name": "_dump_loader_info",
+ "line_start": 107,
+ "line_end": 121,
+ "details": {
+ "modification_count": 6,
+ "repo_p80": 5,
+ "ccn": 7,
+ "max_nesting": 3
+ },
+ "health_impact": 0.812,
+ "reason": "_dump_loader_info has been modified across 6 commits (repo p80=5) and carries CCN=7 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/debughelpers.py::_dump_loader_info"
+ },
+ {
+ "id": "a268d5af746390e327d8c3e2",
+ "biomarker_type": "brain_method",
+ "severity": "high",
+ "file_path": "src/flask/app.py",
+ "function_name": "make_response",
+ "line_start": 1224,
+ "line_end": 1364,
+ "details": {
+ "ccn": 16,
+ "nloc": 119,
+ "max_nesting": 5,
+ "dependents_count": 6,
+ "centrality_floor": 5
+ },
+ "health_impact": 0.141,
+ "reason": "Brain Method: make_response is 119 lines, CCN 16, in a file imported by 6 others",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/app.py::Flask::make_response"
+ },
+ {
+ "id": "bce878892996951400e98fad",
+ "biomarker_type": "brain_method",
+ "severity": "medium",
+ "file_path": "src/flask/app.py",
+ "function_name": "url_for",
+ "line_start": 1102,
+ "line_end": 1222,
+ "details": {
+ "ccn": 13,
+ "nloc": 94,
+ "max_nesting": 3,
+ "dependents_count": 6,
+ "centrality_floor": 5
+ },
+ "health_impact": 0.082,
+ "reason": "Brain Method: url_for is 94 lines, CCN 13, in a file imported by 6 others",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/app.py::Flask::url_for"
+ },
+ {
+ "id": "5aba56e5bbdd42c6154c3f8b",
+ "biomarker_type": "brain_method",
+ "severity": "medium",
+ "file_path": "src/flask/app.py",
+ "function_name": "run",
+ "line_start": 632,
+ "line_end": 753,
+ "details": {
+ "ccn": 12,
+ "nloc": 91,
+ "max_nesting": 2,
+ "dependents_count": 6,
+ "centrality_floor": 5
+ },
+ "health_impact": 0.082,
+ "reason": "Brain Method: run is 91 lines, CCN 12, in a file imported by 6 others",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/app.py::Flask::run"
+ },
+ {
+ "id": "b947e6b2fbf89f86347697af",
+ "biomarker_type": "low_cohesion",
+ "severity": "critical",
+ "file_path": "src/flask/app.py",
+ "function_name": "Flask",
+ "line_start": 109,
+ "line_end": 1625,
+ "details": {
+ "class_name": "Flask",
+ "lcom4": 6,
+ "method_count": 35,
+ "field_count": 36
+ },
+ "health_impact": 0.234,
+ "reason": "Flask has low cohesion (LCOM4=6): its 35 methods split into 6 groups that share no fields or calls",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": "src/flask/app.py::Flask"
+ },
+ {
+ "id": "352bff6fdeba1bb9c11a3be3",
+ "biomarker_type": "god_class",
+ "severity": "critical",
+ "file_path": "src/flask/app.py",
+ "function_name": "Flask",
+ "line_start": 109,
+ "line_end": 1625,
+ "details": {
+ "class_name": "Flask",
+ "total_nloc": 1238,
+ "method_count": 35,
+ "max_method_ccn": 16
+ },
+ "health_impact": 0.53,
+ "reason": "Flask is a god class: 1238 lines across 35 methods, including a brain method (max method CCN 16)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": "src/flask/app.py::Flask"
+ }
+ ],
+ "total": 209,
+ "has_more": true,
+ "next_offset": 50,
+ "state": "ready",
+ "reason": null
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/health-overview.json b/packages/api-client/src/__fixtures__/hosted/health-overview.json
new file mode 100644
index 000000000..045370abb
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/health-overview.json
@@ -0,0 +1,1707 @@
+{
+ "kpis": {
+ "hotspot_health": 10,
+ "average_health": 6.94,
+ "worst_performer_path": "src/flask/app.py",
+ "worst_performer_score": 1.07,
+ "file_count": 108,
+ "maintainability_average": 7.71,
+ "performance_average": 9.96,
+ "maintainability_findings": 73,
+ "performance_findings": 4
+ },
+ "files": [
+ {
+ "file_path": "src/flask/app.py",
+ "score": 1.07,
+ "band": "alert",
+ "max_ccn": 16,
+ "max_nesting": 5,
+ "nloc": 1235,
+ "duplication_pct": 10.42,
+ "has_test_file": false,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "flask",
+ "defect_score": 1.07,
+ "maintainability_score": 3.1,
+ "performance_score": 9.7,
+ "top_biomarkers": [
+ {
+ "id": "1633695362c7ee2ec41d4144",
+ "biomarker_type": "untested_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/app.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "dependents_count": 6,
+ "commit_count_90d": 0,
+ "has_test_file": false
+ },
+ "health_impact": 1.56,
+ "reason": "Hotspot with no paired test file and no coverage data — 6 dependents",
+ "status": "open",
+ "suggestion": "Hot file with low/no coverage — add tests against the most-changed methods first.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "a636c1b680c14f66696424f2",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/app.py",
+ "function_name": "make_response",
+ "line_start": 1224,
+ "line_end": 1364,
+ "details": {
+ "modification_count": 6,
+ "repo_p80": 5,
+ "ccn": 16,
+ "max_nesting": 5
+ },
+ "health_impact": 1.392,
+ "reason": "make_response has been modified across 6 commits (repo p80=5) and carries CCN=16 / nesting=5",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ },
+ {
+ "file_path": "src/flask/sansio/app.py",
+ "score": 1.35,
+ "band": "alert",
+ "max_ccn": 12,
+ "max_nesting": 4,
+ "nloc": 678,
+ "duplication_pct": 14.3,
+ "has_test_file": false,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "flask/sansio",
+ "defect_score": 1.35,
+ "maintainability_score": 4.8,
+ "performance_score": 10,
+ "top_biomarkers": [
+ {
+ "id": "cb2c376ceb485261bac68091",
+ "biomarker_type": "untested_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/sansio/app.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "dependents_count": 7,
+ "commit_count_90d": 1,
+ "has_test_file": false
+ },
+ "health_impact": 1.56,
+ "reason": "Hotspot with no paired test file and no coverage data — 7 dependents",
+ "status": "open",
+ "suggestion": "Hot file with low/no coverage — add tests against the most-changed methods first.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "25e5ed47ef2620733ce4d61b",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/sansio/app.py",
+ "function_name": "add_url_rule",
+ "line_start": 605,
+ "line_end": 661,
+ "details": {
+ "modification_count": 19,
+ "repo_p80": 5,
+ "ccn": 12,
+ "max_nesting": 2
+ },
+ "health_impact": 1.18,
+ "reason": "add_url_rule has been modified across 19 commits (repo p80=5) and carries CCN=12 / nesting=2",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ },
+ {
+ "file_path": "src/flask/cli.py",
+ "score": 2.05,
+ "band": "alert",
+ "max_ccn": 13,
+ "max_nesting": 5,
+ "nloc": 822,
+ "duplication_pct": null,
+ "has_test_file": true,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "flask",
+ "defect_score": 2.05,
+ "maintainability_score": 3.6,
+ "performance_score": 9.85,
+ "top_biomarkers": [
+ {
+ "id": "3c7b89ff0c13fa0b1123901b",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "convert",
+ "line_start": 791,
+ "line_end": 825,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 6,
+ "cognitive": 21
+ },
+ "health_impact": 0.605,
+ "reason": "convert nests 5 levels deep",
+ "status": "open",
+ "suggestion": "Flatten nested control flow with early returns or guard clauses.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "d9c8ad9cb0af754e7a5a0a54",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 10,
+ "cognitive": 25
+ },
+ "health_impact": 0.605,
+ "reason": "find_best_app nests 5 levels deep",
+ "status": "open",
+ "suggestion": "Flatten nested control flow with early returns or guard clauses.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ },
+ {
+ "file_path": "src/flask/sansio/blueprints.py",
+ "score": 3.53,
+ "band": "alert",
+ "max_ccn": 22,
+ "max_nesting": 3,
+ "nloc": 557,
+ "duplication_pct": 20.63,
+ "has_test_file": true,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "flask/sansio",
+ "defect_score": 3.53,
+ "maintainability_score": 5.4,
+ "performance_score": 10,
+ "top_biomarkers": [
+ {
+ "id": "c2d2eaab3a7919f76340c959",
+ "biomarker_type": "function_hotspot",
+ "severity": "critical",
+ "file_path": "src/flask/sansio/blueprints.py",
+ "function_name": "register",
+ "line_start": 273,
+ "line_end": 377,
+ "details": {
+ "modification_count": 23,
+ "repo_p80": 5,
+ "ccn": 22,
+ "max_nesting": 3
+ },
+ "health_impact": 2.32,
+ "reason": "register has been modified across 23 commits (repo p80=5) and carries CCN=22 / nesting=3",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "54354aebd028ccbd8c7730bc",
+ "biomarker_type": "god_class",
+ "severity": "critical",
+ "file_path": "src/flask/sansio/blueprints.py",
+ "function_name": "Blueprint",
+ "line_start": 119,
+ "line_end": 692,
+ "details": {
+ "class_name": "Blueprint",
+ "total_nloc": 473,
+ "method_count": 28,
+ "max_method_ccn": 22
+ },
+ "health_impact": 1.657,
+ "reason": "Blueprint is a god class: 473 lines across 28 methods, including a brain method (max method CCN 22)",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ },
+ {
+ "file_path": "src/flask/config.py",
+ "score": 5.15,
+ "band": "warning",
+ "max_ccn": 7,
+ "max_nesting": 3,
+ "nloc": 282,
+ "duplication_pct": null,
+ "has_test_file": true,
+ "line_coverage_pct": null,
+ "branch_coverage_pct": null,
+ "module": "tests",
+ "defect_score": 5.15,
+ "maintainability_score": 6.7,
+ "performance_score": 10,
+ "top_biomarkers": [
+ {
+ "id": "6d907c7224823a792f775870",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/config.py",
+ "function_name": "from_file",
+ "line_start": 256,
+ "line_end": 302,
+ "details": {
+ "modification_count": 12,
+ "repo_p80": 5,
+ "ccn": 5,
+ "max_nesting": 3
+ },
+ "health_impact": 1.392,
+ "reason": "from_file has been modified across 12 commits (repo p80=5) and carries CCN=5 / nesting=3",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "a526153466bab14f9dfa6193",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/config.py",
+ "function_name": "from_pyfile",
+ "line_start": 187,
+ "line_end": 216,
+ "details": {
+ "modification_count": 10,
+ "repo_p80": 5,
+ "ccn": 4,
+ "max_nesting": 3
+ },
+ "health_impact": 1.392,
+ "reason": "from_pyfile has been modified across 10 commits (repo p80=5) and carries CCN=4 / nesting=3",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ }
+ ],
+ "biomarkers": [
+ {
+ "id": "24ee1f24b481e78e25d7b1aa",
+ "biomarker_type": "primitive_obsession",
+ "severity": "medium",
+ "file_path": "docs/conf.py",
+ "function_name": "github_link",
+ "line_start": 72,
+ "line_end": 97,
+ "details": {
+ "param_count": 7
+ },
+ "health_impact": 0.35,
+ "reason": "github_link takes 7 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "7fc2bfb45bd876adac3926a2",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "docs/conf.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 6,
+ "top_owner_share": 0.771,
+ "contributor_count": 8,
+ "total_commits": 48,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "6 minor contributors (each <5% of commits); top owner holds 77% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "09d0b47644642dd7b41fd9c1",
+ "biomarker_type": "nested_complexity",
+ "severity": "medium",
+ "file_path": "examples/tutorial/flaskr/auth.py",
+ "function_name": "register",
+ "line_start": 47,
+ "line_end": 81,
+ "details": {
+ "max_nesting": 4,
+ "ccn": 6,
+ "cognitive": 15
+ },
+ "health_impact": 0.938,
+ "reason": "register nests 4 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "845765e86a8dc67f7be0f099",
+ "biomarker_type": "dry_violation",
+ "severity": "medium",
+ "file_path": "examples/tutorial/flaskr/blog.py",
+ "function_name": null,
+ "line_start": 64,
+ "line_end": 77,
+ "details": {
+ "duplication_pct": 28,
+ "clone_pair_count": 1,
+ "worst_clone_lines": 14,
+ "worst_clone_partner": "examples/tutorial/flaskr/blog.py",
+ "worst_clone_co_change": 0
+ },
+ "health_impact": 0.35,
+ "reason": "28% of file duplicated; worst clone shares 14 lines with examples/tutorial/flaskr/blog.py",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "a254a623ca40c0367121f788",
+ "biomarker_type": "dry_violation",
+ "severity": "medium",
+ "file_path": "src/flask/__init__.py",
+ "function_name": null,
+ "line_start": 1,
+ "line_end": 38,
+ "details": {
+ "duplication_pct": 100,
+ "clone_pair_count": 1,
+ "worst_clone_lines": 38,
+ "worst_clone_partner": "src/flask/__init__.py",
+ "worst_clone_co_change": 0
+ },
+ "health_impact": 0.35,
+ "reason": "100% of file duplicated; worst clone shares 38 lines with src/flask/__init__.py",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "8510993cad8a38502173828e",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/__init__.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 6,
+ "top_owner_share": 0.9,
+ "contributor_count": 7,
+ "total_commits": 70,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "6 minor contributors (each <5% of commits); top owner holds 90% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "3d05bc5d79a01696d298014f",
+ "biomarker_type": "low_cohesion",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "FlaskGroup",
+ "line_start": 531,
+ "line_end": 688,
+ "details": {
+ "class_name": "FlaskGroup",
+ "lcom4": 2,
+ "method_count": 6,
+ "field_count": 8
+ },
+ "health_impact": 0.132,
+ "reason": "FlaskGroup has low cohesion (LCOM4=2): its 6 methods split into 2 groups that share no fields or calls",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "3c7b89ff0c13fa0b1123901b",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "convert",
+ "line_start": 791,
+ "line_end": 825,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 6,
+ "cognitive": 21
+ },
+ "health_impact": 0.605,
+ "reason": "convert nests 5 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "6b2d945db56c1c1a84bc1b61",
+ "biomarker_type": "nested_complexity",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_app",
+ "line_start": 333,
+ "line_end": 372,
+ "details": {
+ "max_nesting": 4,
+ "ccn": 8,
+ "cognitive": 13
+ },
+ "health_impact": 0.353,
+ "reason": "load_app nests 4 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "14513497430140aabebfc2fe",
+ "biomarker_type": "nested_complexity",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "max_nesting": 4,
+ "ccn": 11,
+ "cognitive": 30
+ },
+ "health_impact": 0.353,
+ "reason": "find_app_by_string nests 4 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "d9c8ad9cb0af754e7a5a0a54",
+ "biomarker_type": "nested_complexity",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "max_nesting": 5,
+ "ccn": 10,
+ "cognitive": 25
+ },
+ "health_impact": 0.605,
+ "reason": "find_best_app nests 5 levels deep",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "d5bc5211e56aca8f359d5826",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "routes_command",
+ "line_start": 1061,
+ "line_end": 1107,
+ "details": {
+ "ccn": 13,
+ "cognitive": 18,
+ "nloc": 35
+ },
+ "health_impact": 0.237,
+ "reason": "routes_command has cyclomatic complexity 13",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "cbb603900f1a645cb7015dca",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "_validate_key",
+ "line_start": 828,
+ "line_end": 864,
+ "details": {
+ "ccn": 9,
+ "cognitive": 14,
+ "nloc": 29
+ },
+ "health_impact": 0.237,
+ "reason": "_validate_key has cyclomatic complexity 9",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "ca167abaa1b0f1c1158ea66b",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_dotenv",
+ "line_start": 698,
+ "line_end": 763,
+ "details": {
+ "ccn": 13,
+ "cognitive": 20,
+ "nloc": 47
+ },
+ "health_impact": 0.237,
+ "reason": "load_dotenv has cyclomatic complexity 13",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "57ab482435ea9ed4a56a87bc",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "ccn": 11,
+ "cognitive": 30,
+ "nloc": 68
+ },
+ "health_impact": 0.237,
+ "reason": "find_app_by_string has cyclomatic complexity 11",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "f22e456d7508251a6d18b2e9",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "ccn": 10,
+ "cognitive": 25,
+ "nloc": 41
+ },
+ "health_impact": 0.237,
+ "reason": "find_best_app has cyclomatic complexity 10",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "7206560799f1a29b8bd7c4ac",
+ "biomarker_type": "bumpy_road",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "routes_command",
+ "line_start": 1061,
+ "line_end": 1107,
+ "details": {
+ "bumps": 3,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.056,
+ "reason": "routes_command has 3 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "913c5f0126bcd903c916922e",
+ "biomarker_type": "bumpy_road",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_dotenv",
+ "line_start": 698,
+ "line_end": 763,
+ "details": {
+ "bumps": 3,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.056,
+ "reason": "load_dotenv has 3 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "0c5715dc8398bb9ecd57b830",
+ "biomarker_type": "bumpy_road",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "bumps": 4,
+ "ccn": 11,
+ "max_nesting": 4
+ },
+ "health_impact": 0.132,
+ "reason": "find_app_by_string has 4 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "cc5c719dea8b6a80d1476727",
+ "biomarker_type": "bumpy_road",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "bumps": 3,
+ "ccn": 10,
+ "max_nesting": 5
+ },
+ "health_impact": 0.056,
+ "reason": "find_best_app has 3 nested blocks at the same level (bumpy road)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "dd0194f456cad899e68c5882",
+ "biomarker_type": "large_method",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "nloc": 68,
+ "ccn": 11
+ },
+ "health_impact": 0.105,
+ "reason": "find_app_by_string is 68 lines long",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "35e3b26a20e7b8469cf29305",
+ "biomarker_type": "primitive_obsession",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "run_command",
+ "line_start": 935,
+ "line_end": 993,
+ "details": {
+ "param_count": 9
+ },
+ "health_impact": 0.168,
+ "reason": "run_command takes 9 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "692f1eafa18fac253c10a7cd",
+ "biomarker_type": "primitive_obsession",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "make_context",
+ "line_start": 657,
+ "line_end": 676,
+ "details": {
+ "param_count": 5
+ },
+ "health_impact": 0.042,
+ "reason": "make_context takes 5 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "928db1374c4f29d5737fac2d",
+ "biomarker_type": "complex_conditional",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "parse_args",
+ "line_start": 679,
+ "line_end": 679,
+ "details": {
+ "operator_count": 3,
+ "enclosing_construct": "if"
+ },
+ "health_impact": 0.15,
+ "reason": "if condition combines 3 boolean operators",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "6def7c58d9285973cbd6f39d",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "routes_command",
+ "line_start": 1061,
+ "line_end": 1107,
+ "details": {
+ "modification_count": 6,
+ "repo_p80": 5,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.29,
+ "reason": "routes_command has been modified across 6 commits (repo p80=5) and carries CCN=13 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "59d987fdc3c5b86b84f15d0f",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "shell_command",
+ "line_start": 1001,
+ "line_end": 1045,
+ "details": {
+ "modification_count": 13,
+ "repo_p80": 5,
+ "ccn": 5,
+ "max_nesting": 3
+ },
+ "health_impact": 0.497,
+ "reason": "shell_command has been modified across 13 commits (repo p80=5) and carries CCN=5 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "b3c8a05d6fcfdb41ae13cefb",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "run_command",
+ "line_start": 935,
+ "line_end": 993,
+ "details": {
+ "modification_count": 11,
+ "repo_p80": 5,
+ "ccn": 5,
+ "max_nesting": 3
+ },
+ "health_impact": 0.497,
+ "reason": "run_command has been modified across 11 commits (repo p80=5) and carries CCN=5 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "e1908844bfa38cece9505c6f",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "convert",
+ "line_start": 791,
+ "line_end": 825,
+ "details": {
+ "modification_count": 9,
+ "repo_p80": 5,
+ "ccn": 6,
+ "max_nesting": 5
+ },
+ "health_impact": 0.29,
+ "reason": "convert has been modified across 9 commits (repo p80=5) and carries CCN=6 / nesting=5",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "58266b29c997afce37748eda",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_dotenv",
+ "line_start": 698,
+ "line_end": 763,
+ "details": {
+ "modification_count": 9,
+ "repo_p80": 5,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.29,
+ "reason": "load_dotenv has been modified across 9 commits (repo p80=5) and carries CCN=13 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "f0ae5435d4f75d89f63cfa86",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "load_app",
+ "line_start": 333,
+ "line_end": 372,
+ "details": {
+ "modification_count": 15,
+ "repo_p80": 5,
+ "ccn": 8,
+ "max_nesting": 4
+ },
+ "health_impact": 0.497,
+ "reason": "load_app has been modified across 15 commits (repo p80=5) and carries CCN=8 / nesting=4",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "aee5b1828c3883a30621c4de",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_app_by_string",
+ "line_start": 120,
+ "line_end": 197,
+ "details": {
+ "modification_count": 13,
+ "repo_p80": 5,
+ "ccn": 11,
+ "max_nesting": 4
+ },
+ "health_impact": 0.497,
+ "reason": "find_app_by_string has been modified across 13 commits (repo p80=5) and carries CCN=11 / nesting=4",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "6ac160cd46a9479d6d2263b1",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/cli.py",
+ "function_name": "find_best_app",
+ "line_start": 41,
+ "line_end": 91,
+ "details": {
+ "modification_count": 17,
+ "repo_p80": 5,
+ "ccn": 10,
+ "max_nesting": 5
+ },
+ "health_impact": 0.497,
+ "reason": "find_best_app has been modified across 17 commits (repo p80=5) and carries CCN=10 / nesting=5",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "fb1070635166396549df3d9d",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 16,
+ "top_owner_share": 0.697,
+ "contributor_count": 18,
+ "total_commits": 66,
+ "small_team": true
+ },
+ "health_impact": 0.148,
+ "reason": "16 minor contributors (each <5% of commits); top owner holds 70% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "19efd878bb50fe44398161e7",
+ "biomarker_type": "error_handling",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": 650,
+ "line_end": 650,
+ "details": {
+ "kind": "bare_except"
+ },
+ "health_impact": 0.15,
+ "reason": "catch-all except hides every error, including KeyboardInterrupt",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "db511e524f8430078dc806c9",
+ "biomarker_type": "error_handling",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": 1036,
+ "line_end": 1036,
+ "details": {
+ "kind": "swallowed_catch"
+ },
+ "health_impact": 0.15,
+ "reason": "caught exception is swallowed without any handling",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "1c5ab929fed77ec9ae5d3bf3",
+ "biomarker_type": "error_handling",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": null,
+ "line_start": 1098,
+ "line_end": 1098,
+ "details": {
+ "kind": "swallowed_catch"
+ },
+ "health_impact": 0.15,
+ "reason": "caught exception is swallowed without any handling",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "21e7656ae601236104f81d2e",
+ "biomarker_type": "hot_path_sync_io",
+ "severity": "low",
+ "file_path": "src/flask/cli.py",
+ "function_name": "shell_command",
+ "line_start": 1022,
+ "line_end": 1022,
+ "details": {
+ "boundary_kind": "filesystem"
+ },
+ "health_impact": 0,
+ "reason": "a blocking filesystem call runs on a hot, request-reachable path; its latency is paid on every call through this function",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "performance",
+ "symbol_id": null
+ },
+ {
+ "id": "866b5edd940c2fd3c736feb8",
+ "biomarker_type": "dry_violation",
+ "severity": "low",
+ "file_path": "src/flask/globals.py",
+ "function_name": null,
+ "line_start": 18,
+ "line_end": 28,
+ "details": {
+ "duplication_pct": 22.41,
+ "clone_pair_count": 1,
+ "worst_clone_lines": 11,
+ "worst_clone_partner": "src/flask/globals.py",
+ "worst_clone_co_change": 0
+ },
+ "health_impact": 0.15,
+ "reason": "22% of file duplicated; worst clone shares 11 lines with src/flask/globals.py",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "dd3381c1030aed17697543ea",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/helpers.py",
+ "function_name": "get_root_path",
+ "line_start": 587,
+ "line_end": 641,
+ "details": {
+ "ccn": 9,
+ "cognitive": 12,
+ "nloc": 45
+ },
+ "health_impact": 0.821,
+ "reason": "get_root_path has cyclomatic complexity 9",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "0da42a3887baa307c4485598",
+ "biomarker_type": "primitive_obsession",
+ "severity": "medium",
+ "file_path": "src/flask/helpers.py",
+ "function_name": "send_file",
+ "line_start": 417,
+ "line_end": 540,
+ "details": {
+ "param_count": 8
+ },
+ "health_impact": 0.339,
+ "reason": "send_file takes 8 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "1894a1e4e5d886fb52cbcbcf",
+ "biomarker_type": "primitive_obsession",
+ "severity": "medium",
+ "file_path": "src/flask/helpers.py",
+ "function_name": "url_for",
+ "line_start": 200,
+ "line_end": 251,
+ "details": {
+ "param_count": 7
+ },
+ "health_impact": 0.339,
+ "reason": "url_for takes 7 parameters",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "818bb7c32b8a0ac81c3afe7d",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/helpers.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 20,
+ "top_owner_share": 0.636,
+ "contributor_count": 22,
+ "total_commits": 88,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "20 minor contributors (each <5% of commits); top owner holds 64% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "e3e3a4f918437a70cfea06c5",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/debughelpers.py",
+ "function_name": "explain_template_loading_attempts",
+ "line_start": 124,
+ "line_end": 179,
+ "details": {
+ "ccn": 13,
+ "cognitive": 18,
+ "nloc": 37
+ },
+ "health_impact": 0.847,
+ "reason": "explain_template_loading_attempts has cyclomatic complexity 13",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "fcb77b4c8e501e308d016f2b",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/debughelpers.py",
+ "function_name": "explain_template_loading_attempts",
+ "line_start": 124,
+ "line_end": 179,
+ "details": {
+ "modification_count": 8,
+ "repo_p80": 5,
+ "ccn": 13,
+ "max_nesting": 3
+ },
+ "health_impact": 0.812,
+ "reason": "explain_template_loading_attempts has been modified across 8 commits (repo p80=5) and carries CCN=13 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "ec30edc0a31e12eaa4c24baa",
+ "biomarker_type": "function_hotspot",
+ "severity": "medium",
+ "file_path": "src/flask/debughelpers.py",
+ "function_name": "_dump_loader_info",
+ "line_start": 107,
+ "line_end": 121,
+ "details": {
+ "modification_count": 6,
+ "repo_p80": 5,
+ "ccn": 7,
+ "max_nesting": 3
+ },
+ "health_impact": 0.812,
+ "reason": "_dump_loader_info has been modified across 6 commits (repo p80=5) and carries CCN=7 / nesting=3",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "a268d5af746390e327d8c3e2",
+ "biomarker_type": "brain_method",
+ "severity": "high",
+ "file_path": "src/flask/app.py",
+ "function_name": "make_response",
+ "line_start": 1224,
+ "line_end": 1364,
+ "details": {
+ "ccn": 16,
+ "nloc": 119,
+ "max_nesting": 5,
+ "dependents_count": 6,
+ "centrality_floor": 5
+ },
+ "health_impact": 0.141,
+ "reason": "Brain Method: make_response is 119 lines, CCN 16, in a file imported by 6 others",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "bce878892996951400e98fad",
+ "biomarker_type": "brain_method",
+ "severity": "medium",
+ "file_path": "src/flask/app.py",
+ "function_name": "url_for",
+ "line_start": 1102,
+ "line_end": 1222,
+ "details": {
+ "ccn": 13,
+ "nloc": 94,
+ "max_nesting": 3,
+ "dependents_count": 6,
+ "centrality_floor": 5
+ },
+ "health_impact": 0.082,
+ "reason": "Brain Method: url_for is 94 lines, CCN 13, in a file imported by 6 others",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "5aba56e5bbdd42c6154c3f8b",
+ "biomarker_type": "brain_method",
+ "severity": "medium",
+ "file_path": "src/flask/app.py",
+ "function_name": "run",
+ "line_start": 632,
+ "line_end": 753,
+ "details": {
+ "ccn": 12,
+ "nloc": 91,
+ "max_nesting": 2,
+ "dependents_count": 6,
+ "centrality_floor": 5
+ },
+ "health_impact": 0.082,
+ "reason": "Brain Method: run is 91 lines, CCN 12, in a file imported by 6 others",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "b947e6b2fbf89f86347697af",
+ "biomarker_type": "low_cohesion",
+ "severity": "critical",
+ "file_path": "src/flask/app.py",
+ "function_name": "Flask",
+ "line_start": 109,
+ "line_end": 1625,
+ "details": {
+ "class_name": "Flask",
+ "lcom4": 6,
+ "method_count": 35,
+ "field_count": 36
+ },
+ "health_impact": 0.234,
+ "reason": "Flask has low cohesion (LCOM4=6): its 35 methods split into 6 groups that share no fields or calls",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "352bff6fdeba1bb9c11a3be3",
+ "biomarker_type": "god_class",
+ "severity": "critical",
+ "file_path": "src/flask/app.py",
+ "function_name": "Flask",
+ "line_start": 109,
+ "line_end": 1625,
+ "details": {
+ "class_name": "Flask",
+ "total_nloc": 1238,
+ "method_count": 35,
+ "max_method_ccn": 16
+ },
+ "health_impact": 0.53,
+ "reason": "Flask is a god class: 1238 lines across 35 methods, including a brain method (max method CCN 16)",
+ "status": "open",
+ "suggestion": null,
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ],
+ "modules": [
+ {
+ "module": "flask",
+ "file_count": 11,
+ "average_health": 7.35,
+ "worst_file_path": "src/flask/app.py",
+ "worst_file_score": 1.07,
+ "nloc_weighted_health": 3.93,
+ "critical_finding_count": 3,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "flask/sansio",
+ "file_count": 9,
+ "average_health": 7.79,
+ "worst_file_path": "src/flask/sansio/app.py",
+ "worst_file_score": 1.35,
+ "nloc_weighted_health": 5.62,
+ "critical_finding_count": 5,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "flask (6)",
+ "file_count": 6,
+ "average_health": 8.45,
+ "worst_file_path": "src/flask/testing.py",
+ "worst_file_score": 5.5,
+ "nloc_weighted_health": 8.23,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "tests",
+ "file_count": 53,
+ "average_health": 9.66,
+ "worst_file_path": "src/flask/config.py",
+ "worst_file_score": 5.15,
+ "nloc_weighted_health": 8.61,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "docs (1)",
+ "file_count": 1,
+ "average_health": 9.24,
+ "worst_file_path": "docs/conf.py",
+ "worst_file_score": 9.24,
+ "nloc_weighted_health": 9.24,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "config",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": ".pre-commit-config.yaml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": ".readthedocs",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": ".readthedocs.yaml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "readme",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "README.md",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "pyproject",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "pyproject.toml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "on-create-command",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": ".devcontainer/on-create-command.sh",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "pull_request_template",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": ".github/pull_request_template.md",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "issue_template",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": ".github/ISSUE_TEMPLATE/bug-report.md",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "issue_template (1)",
+ "file_count": 2,
+ "average_health": 10,
+ "worst_file_path": ".github/ISSUE_TEMPLATE/config.yml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "workflows",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": ".github/workflows/lock.yaml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "devcontainer",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": ".devcontainer/devcontainer.json",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "workflows (1)",
+ "file_count": 3,
+ "average_health": 10,
+ "worst_file_path": ".github/workflows/pre-commit.yaml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "tests/test_apps",
+ "file_count": 7,
+ "average_health": 10,
+ "worst_file_path": ".github/workflows/tests.yaml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "docs",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "docs/Makefile",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "examples/celery",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "examples/celery/README.md",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "examples/celery (1)",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "examples/celery/pyproject.toml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "examples/javascript",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "examples/javascript/pyproject.toml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "examples/tutorial (1)",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "examples/tutorial/pyproject.toml",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "examples/tutorial",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "examples/tutorial/flaskr/schema.sql",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ },
+ {
+ "module": "flask/sansio (1)",
+ "file_count": 1,
+ "average_health": 10,
+ "worst_file_path": "src/flask/sansio/README.md",
+ "worst_file_score": 10,
+ "nloc_weighted_health": 10,
+ "critical_finding_count": 0,
+ "warning_finding_count": 0
+ }
+ ],
+ "defect_accuracy": {
+ "k": 20,
+ "hits": 5,
+ "precision": 0.25,
+ "base_rate": 0.0556,
+ "lift": 4.5,
+ "window_days": 180,
+ "scored_files": 108,
+ "defect_files": 6,
+ "concentration_file_fraction": 0.2,
+ "concentration_defect_share": 0.8333,
+ "precision_table": [
+ {
+ "k": 10,
+ "hits": 3
+ },
+ {
+ "k": 20,
+ "hits": 5
+ },
+ {
+ "k": 30,
+ "hits": 5
+ }
+ ],
+ "flagged_files": [
+ {
+ "file_path": "src/flask/app.py",
+ "score": 1.07,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/sansio/app.py",
+ "score": 1.35,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/cli.py",
+ "score": 2.05,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/sansio/blueprints.py",
+ "score": 3.53,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/config.py",
+ "score": 5.15,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/testing.py",
+ "score": 5.5,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/ctx.py",
+ "score": 6.51,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/templating.py",
+ "score": 7.15,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/sansio/scaffold.py",
+ "score": 7.16,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_basic.py",
+ "score": 7.49,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/debughelpers.py",
+ "score": 7.53,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/helpers.py",
+ "score": 8.09,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_blueprints.py",
+ "score": 8.14,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "tests/test_cli.py",
+ "score": 8.19,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/wrappers.py",
+ "score": 8.59,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/blueprints.py",
+ "score": 8.64,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_templating.py",
+ "score": 8.74,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_appctx.py",
+ "score": 8.94,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_reqctx.py",
+ "score": 8.94,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_testing.py",
+ "score": 8.94,
+ "recent_fixes": 0
+ }
+ ]
+ },
+ "meta": {
+ "last_indexed_at": "2026-07-03T19:00:28.037767+00:00",
+ "head_commit": "36e4a824f340fdee7ed50937ba8e7f6bc7d17f81",
+ "snapshot_count": 1
+ },
+ "state": "ready",
+ "reason": null
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/health-trend.json b/packages/api-client/src/__fixtures__/hosted/health-trend.json
new file mode 100644
index 000000000..4738b7f78
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/health-trend.json
@@ -0,0 +1,15 @@
+{
+ "points": [
+ {
+ "taken_at": "2026-07-03T19:00:45.142832+00:00",
+ "hotspot_health": 10,
+ "average_health": 6.94,
+ "worst_performer_path": "src/flask/app.py",
+ "worst_performer_score": 1.07
+ }
+ ],
+ "declining": false,
+ "predicted_decline": false,
+ "state": "ready",
+ "reason": null
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/hotspots.json b/packages/api-client/src/__fixtures__/hosted/hotspots.json
new file mode 100644
index 000000000..9f30ac51c
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/hotspots.json
@@ -0,0 +1,69 @@
+{
+ "items": [
+ {
+ "path": "src/flask/app.py",
+ "commit_count": 134,
+ "commit_count_90d": 0,
+ "commit_count_30d": 0,
+ "churn_percentile": 0.9880952380952381,
+ "primary_owner": "pgjones",
+ "last_commit_at": "2026-02-20T03:41:50+00:00",
+ "is_hotspot": false,
+ "is_stable": true,
+ "bus_factor": 4,
+ "contributor_count": 30,
+ "lines_added_90d": 0,
+ "lines_deleted_90d": 0,
+ "avg_commit_size": 0,
+ "commit_categories": {
+ "fix": 16,
+ "dependency": 3,
+ "feature": 15,
+ "refactor": 10
+ },
+ "commit_count_capped": false,
+ "merge_commit_count_90d": 0,
+ "recent_owner_name": null,
+ "recent_owner_commit_pct": null,
+ "temporal_hotspot_score": 1.7468812018086186,
+ "change_entropy": 1.13513,
+ "change_entropy_pct": 0.9705882352941176,
+ "prior_defect_count": 1,
+ "original_path": null
+ },
+ {
+ "path": "src/flask/ctx.py",
+ "commit_count": 44,
+ "commit_count_90d": 1,
+ "commit_count_30d": 0,
+ "churn_percentile": 0.9761904761904762,
+ "primary_owner": "David Lord",
+ "last_commit_at": "2026-05-02T03:31:50+00:00",
+ "is_hotspot": false,
+ "is_stable": false,
+ "bus_factor": 2,
+ "contributor_count": 8,
+ "lines_added_90d": 5,
+ "lines_deleted_90d": 5,
+ "avg_commit_size": 10,
+ "commit_categories": {
+ "feature": 5,
+ "dependency": 1,
+ "fix": 6,
+ "refactor": 2
+ },
+ "commit_count_capped": false,
+ "merge_commit_count_90d": 0,
+ "recent_owner_name": "David Lord",
+ "recent_owner_commit_pct": 1,
+ "temporal_hotspot_score": 1.7200224452756603,
+ "change_entropy": 1.101266,
+ "change_entropy_pct": 0.9558823529411765,
+ "prior_defect_count": 0,
+ "original_path": null
+ }
+ ],
+ "total": 83,
+ "has_more": true,
+ "next_offset": 2
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/module-graph.json b/packages/api-client/src/__fixtures__/hosted/module-graph.json
new file mode 100644
index 000000000..fadf13a4b
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/module-graph.json
@@ -0,0 +1,59 @@
+{
+ "nodes": [
+ {
+ "module_id": ".pre-commit-config.yaml",
+ "file_count": 1,
+ "symbol_count": 0,
+ "avg_pagerank": 0.002136,
+ "doc_coverage_pct": 0
+ },
+ {
+ "module_id": ".readthedocs.yaml",
+ "file_count": 1,
+ "symbol_count": 0,
+ "avg_pagerank": 0.002136,
+ "doc_coverage_pct": 0
+ },
+ {
+ "module_id": "README.md",
+ "file_count": 1,
+ "symbol_count": 0,
+ "avg_pagerank": 0.002136,
+ "doc_coverage_pct": 0
+ }
+ ],
+ "edges": [
+ {
+ "source": "examples",
+ "target": "src",
+ "edge_count": 10
+ },
+ {
+ "source": "src",
+ "target": "tests",
+ "edge_count": 5
+ },
+ {
+ "source": "tests",
+ "target": "src",
+ "edge_count": 64
+ }
+ ],
+ "links": [
+ {
+ "source": "examples",
+ "target": "src",
+ "edge_count": 10
+ },
+ {
+ "source": "src",
+ "target": "tests",
+ "edge_count": 5
+ },
+ {
+ "source": "tests",
+ "target": "src",
+ "edge_count": 64
+ }
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/modules-health.json b/packages/api-client/src/__fixtures__/hosted/modules-health.json
new file mode 100644
index 000000000..b314bf300
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/modules-health.json
@@ -0,0 +1,58 @@
+{
+ "items": [
+ {
+ "module_path": "docs",
+ "file_count": 1,
+ "symbol_count": 24,
+ "hotspot_count": 0,
+ "dead_code_count": 2,
+ "dead_code_lines": 241,
+ "avg_churn_percentile": 61.904761904761905,
+ "median_bus_factor": 2,
+ "min_bus_factor": 2,
+ "primary_owner": "David Lord",
+ "primary_owner_pct": 1,
+ "is_silo": true,
+ "decision_count": 0,
+ "doc_coverage_pct": 0,
+ "health_score": 25.714285714285715
+ },
+ {
+ "module_path": "examples",
+ "file_count": 17,
+ "symbol_count": 62,
+ "hotspot_count": 0,
+ "dead_code_count": 2,
+ "dead_code_lines": 40,
+ "avg_churn_percentile": 35.22408963585434,
+ "median_bus_factor": 1,
+ "min_bus_factor": 1,
+ "primary_owner": "David Lord",
+ "primary_owner_pct": 1,
+ "is_silo": true,
+ "decision_count": 0,
+ "doc_coverage_pct": 32.25806451612903,
+ "health_score": 61.613919761452976
+ },
+ {
+ "module_path": "src",
+ "file_count": 24,
+ "symbol_count": 495,
+ "hotspot_count": 0,
+ "dead_code_count": 9,
+ "dead_code_lines": 76,
+ "avg_churn_percentile": 73.26388888888889,
+ "median_bus_factor": 2,
+ "min_bus_factor": 1,
+ "primary_owner": "David Lord",
+ "primary_owner_pct": 0.8333333333333334,
+ "is_silo": true,
+ "decision_count": 21,
+ "doc_coverage_pct": 51.515151515151516,
+ "health_score": 72.3626893939394
+ }
+ ],
+ "total": 5,
+ "has_more": true,
+ "next_offset": 3
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/overview-summary.json b/packages/api-client/src/__fixtures__/hosted/overview-summary.json
new file mode 100644
index 000000000..4dc7998a1
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/overview-summary.json
@@ -0,0 +1,117 @@
+{
+ "repo": {
+ "id": "d8ea204a-6325-438c-a805-fbdb029ffd11",
+ "name": "flask",
+ "owner": "pallets",
+ "is_public": true,
+ "local_path": "github.com/pallets/flask",
+ "updated_at": "2026-07-03T19:00:28.037767+00:00",
+ "head_commit": "36e4a824f340fdee7ed50937ba8e7f6bc7d17f81",
+ "default_branch": "main"
+ },
+ "sync": {
+ "page_count": 0,
+ "last_sync_at": "2026-07-03T19:00:28.037767+00:00",
+ "active_job_id": null,
+ "last_resync_at": null,
+ "last_sync_model": null
+ },
+ "stats": {
+ "deltas": {
+ "file_count": null,
+ "average_health": null,
+ "hotspot_health": null
+ },
+ "file_count": 108,
+ "silo_count": 4,
+ "module_count": 24,
+ "symbol_count": 1060,
+ "hotspot_count": 0,
+ "freshness_score": 0,
+ "doc_coverage_pct": 0,
+ "dead_export_count": 12,
+ "entry_point_count": 5
+ },
+ "health": {
+ "history": [
+ {
+ "taken_at": "2026-07-03T19:00:45.142832+00:00",
+ "average_health": 6.94,
+ "hotspot_health": 10
+ }
+ ],
+ "open_findings": 209,
+ "average_health": 6.94,
+ "hotspot_health": 10,
+ "snapshot_count": 1,
+ "last_indexed_at": "2026-07-03T19:00:45.142832+00:00",
+ "severity_breakdown": {
+ "low": 85,
+ "high": 32,
+ "medium": 84,
+ "critical": 8
+ },
+ "performance_average": 9.96,
+ "performance_findings": 4,
+ "worst_performer_path": "src/flask/app.py",
+ "worst_performer_score": 1.07,
+ "worst_performance_path": "src/flask/app.py",
+ "maintainability_average": 7.71,
+ "worst_performance_score": 9.7
+ },
+ "savings": {
+ "available": false
+ },
+ "attention": [
+ {
+ "id": "proposed-9827083f96ad4d149c9d983a7e59a9bc",
+ "type": "proposed_decision",
+ "title": "Windows env var keys are always uppercase.",
+ "severity": "medium",
+ "target_id": "9827083f96ad4d149c9d983a7e59a9bc",
+ "description": "Auto-proposed decision awaiting review"
+ },
+ {
+ "id": "proposed-d4175eb5203c426abeb80cd320a55136",
+ "type": "proposed_decision",
+ "title": "do this instead of startswith for nicer pytest output",
+ "severity": "medium",
+ "target_id": "d4175eb5203c426abeb80cd320a55136",
+ "description": "Auto-proposed decision awaiting review"
+ }
+ ],
+ "languages": [
+ {
+ "language": "python",
+ "file_count": 83
+ },
+ {
+ "language": "yaml",
+ "file_count": 8
+ },
+ {
+ "language": "markdown",
+ "file_count": 6
+ }
+ ],
+ "top_hotspots": [],
+ "recent_decisions": [
+ {
+ "id": "9827083f96ad4d149c9d983a7e59a9bc",
+ "title": "Windows env var keys are always uppercase.",
+ "source": "code_comment",
+ "status": "proposed",
+ "created_at": null,
+ "staleness_score": 0
+ },
+ {
+ "id": "d4175eb5203c426abeb80cd320a55136",
+ "title": "do this instead of startswith for nicer pytest output",
+ "source": "code_comment",
+ "status": "proposed",
+ "created_at": null,
+ "staleness_score": 0
+ }
+ ],
+ "onboarding_targets": []
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/refactoring-targets.json b/packages/api-client/src/__fixtures__/hosted/refactoring-targets.json
new file mode 100644
index 000000000..cd491c657
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/refactoring-targets.json
@@ -0,0 +1,204 @@
+{
+ "targets": [
+ {
+ "file_path": "src/flask/__init__.py",
+ "score": 9.24,
+ "impact": 0.76,
+ "effort": 0.2,
+ "biomarkers": [
+ {
+ "id": "a254a623ca40c0367121f788",
+ "biomarker_type": "dry_violation",
+ "severity": "medium",
+ "file_path": "src/flask/__init__.py",
+ "function_name": null,
+ "line_start": 1,
+ "line_end": 38,
+ "details": {
+ "duplication_pct": 100,
+ "clone_pair_count": 1,
+ "worst_clone_lines": 38,
+ "worst_clone_partner": "src/flask/__init__.py",
+ "worst_clone_co_change": 0
+ },
+ "health_impact": 0.35,
+ "reason": "100% of file duplicated; worst clone shares 38 lines with src/flask/__init__.py",
+ "status": "open",
+ "suggestion": "Duplicated logic detected — extract the shared code path.",
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "8510993cad8a38502173828e",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/__init__.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 6,
+ "top_owner_share": 0.9,
+ "contributor_count": 7,
+ "total_commits": 70,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "6 minor contributors (each <5% of commits); top owner holds 90% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ },
+ {
+ "file_path": "src/flask/testing.py",
+ "score": 5.5,
+ "impact": 4.5,
+ "effort": 1.91,
+ "biomarkers": [
+ {
+ "id": "5a4894573329adb5f7f26a2e",
+ "biomarker_type": "complex_method",
+ "severity": "medium",
+ "file_path": "src/flask/testing.py",
+ "function_name": "__init__",
+ "line_start": 49,
+ "line_end": 86,
+ "details": {
+ "ccn": 12,
+ "cognitive": 14,
+ "nloc": 22
+ },
+ "health_impact": 0.847,
+ "reason": "__init__ has cyclomatic complexity 12",
+ "status": "open",
+ "suggestion": "Reduce cyclomatic complexity by extracting decision points into helper functions.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "b5d910a7b0b8ffd956e186ab",
+ "biomarker_type": "primitive_obsession",
+ "severity": "low",
+ "file_path": "src/flask/testing.py",
+ "function_name": "invoke",
+ "line_start": 275,
+ "line_end": 298,
+ "details": {
+ "param_count": 5
+ },
+ "health_impact": 0.15,
+ "reason": "invoke takes 5 parameters",
+ "status": "open",
+ "suggestion": "Replace cluster of primitive parameters with a small value-object.",
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "0f932e1ea251b154a4eec694",
+ "biomarker_type": "primitive_obsession",
+ "severity": "low",
+ "file_path": "src/flask/testing.py",
+ "function_name": "__init__",
+ "line_start": 49,
+ "line_end": 86,
+ "details": {
+ "param_count": 8
+ },
+ "health_impact": 0.15,
+ "reason": "__init__ takes 8 parameters",
+ "status": "open",
+ "suggestion": "Replace cluster of primitive parameters with a small value-object.",
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "2592aedd72c16c25e33e2318",
+ "biomarker_type": "primitive_obsession",
+ "severity": "low",
+ "file_path": "src/flask/testing.py",
+ "function_name": "open",
+ "line_start": 204,
+ "line_end": 247,
+ "details": {
+ "param_count": 5
+ },
+ "health_impact": 0.15,
+ "reason": "open takes 5 parameters",
+ "status": "open",
+ "suggestion": "Replace cluster of primitive parameters with a small value-object.",
+ "dimension": "maintainability",
+ "symbol_id": null
+ },
+ {
+ "id": "239a78b51ac69856aa1c46fa",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/testing.py",
+ "function_name": "__init__",
+ "line_start": 49,
+ "line_end": 86,
+ "details": {
+ "modification_count": 10,
+ "repo_p80": 5,
+ "ccn": 12,
+ "max_nesting": 2
+ },
+ "health_impact": 1.392,
+ "reason": "__init__ has been modified across 10 commits (repo p80=5) and carries CCN=12 / nesting=2",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "7e881daa9d798d7b9228b510",
+ "biomarker_type": "function_hotspot",
+ "severity": "high",
+ "file_path": "src/flask/testing.py",
+ "function_name": "open",
+ "line_start": 204,
+ "line_end": 247,
+ "details": {
+ "modification_count": 12,
+ "repo_p80": 5,
+ "ccn": 7,
+ "max_nesting": 3
+ },
+ "health_impact": 1.392,
+ "reason": "open has been modified across 12 commits (repo p80=5) and carries CCN=7 / nesting=3",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ },
+ {
+ "id": "7bb853f727b7391545d28836",
+ "biomarker_type": "ownership_risk",
+ "severity": "low",
+ "file_path": "src/flask/testing.py",
+ "function_name": null,
+ "line_start": null,
+ "line_end": null,
+ "details": {
+ "minor_contributors": 3,
+ "top_owner_share": 0.868,
+ "contributor_count": 5,
+ "total_commits": 38,
+ "small_team": true
+ },
+ "health_impact": 0.414,
+ "reason": "3 minor contributors (each <5% of commits); top owner holds 87% (informational: small team, 1 active contributors in 90d)",
+ "status": "open",
+ "suggestion": "Review and refactor according to the biomarker details.",
+ "dimension": "defect",
+ "symbol_id": null
+ }
+ ]
+ }
+ ],
+ "state": "ready",
+ "reason": null
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/search.json b/packages/api-client/src/__fixtures__/hosted/search.json
new file mode 100644
index 000000000..2f50e875f
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/search.json
@@ -0,0 +1,28 @@
+{
+ "results": [
+ {
+ "title": "Set with env var instead of ScriptInfo.load so that it can be accessed early during a factory functi",
+ "page_type": "decision_record",
+ "target_path": "decision:26c8470eb1f84a45987e4276c0e3b982",
+ "snippet": "Set with env var instead of ScriptInfo.load so that it can be accessed early during a factory functi\nSet with env var instead of ScriptInfo.load so that it can be accessed early during a factory function.",
+ "score": 0.370858750216633,
+ "search_type": "semantic"
+ },
+ {
+ "title": "Handle app factory errors by distinguishing TypeError from factory-raised errors",
+ "page_type": "decision_record",
+ "target_path": "decision:c6c45112396544979af05342c09476e5",
+ "snippet": "Handle app factory errors by distinguishing TypeError from factory-raised errors\nTreat a TypeError as indicating call failure only if it was raised because the call failed, not because something inside the factory raised the error.",
+ "score": 0.348739732750966,
+ "search_type": "semantic"
+ },
+ {
+ "title": "Processing is done with option callbacks instead of a group callback. This allows users to make a cu",
+ "page_type": "decision_record",
+ "target_path": "decision:aa9c9a7359724a22842a61146e730b9a",
+ "snippet": "Processing is done with option callbacks instead of a group callback. This allows users to make a cu\nProcessing is done with option callbacks instead of a group callback. This allows users to make a custom group callback without losing the ",
+ "score": 0.336411976817619,
+ "search_type": "semantic"
+ }
+ ]
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/snapshot-status.json b/packages/api-client/src/__fixtures__/hosted/snapshot-status.json
new file mode 100644
index 000000000..d9a2dbae3
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/snapshot-status.json
@@ -0,0 +1,24 @@
+{
+ "id": "85db9d2fcd56506c52ffe8a430e32bd2ef65ca02d888a6dcd1f02a33505df627",
+ "short_id": "85db9d2fcd56",
+ "repo_id": "d8ea204a-6325-438c-a805-fbdb029ffd11",
+ "head_sha": "36e4a824f340fdee7ed50937ba8e7f6bc7d17f81",
+ "commit_depth": 2000,
+ "status": "ready",
+ "error_message": null,
+ "file_count": 108,
+ "line_count": null,
+ "indexing_duration_seconds": 18,
+ "created_at": "2026-07-03T19:00:28.037767Z",
+ "completed_at": "2026-07-03T19:01:16.335012Z",
+ "ref": "main",
+ "generate_docs": false,
+ "docs_file_percentage": null,
+ "reaped_at": null,
+ "superseded_by_short_id": null,
+ "triggered_by_kind": null,
+ "triggered_by_installation_id": null,
+ "docs_status": "skipped",
+ "docs_pages_ready": 0,
+ "docs_pages_total": null
+}
diff --git a/packages/api-client/src/__fixtures__/hosted/stats-highlights.json b/packages/api-client/src/__fixtures__/hosted/stats-highlights.json
new file mode 100644
index 000000000..5269ef248
--- /dev/null
+++ b/packages/api-client/src/__fixtures__/hosted/stats-highlights.json
@@ -0,0 +1,939 @@
+{
+ "repo": {
+ "id": "d8ea204a-6325-438c-a805-fbdb029ffd11",
+ "name": "flask",
+ "default_branch": "main",
+ "head_commit": "36e4a824f340fdee7ed50937ba8e7f6bc7d17f81"
+ },
+ "scale": {
+ "file_count": 108,
+ "symbol_count": 1060,
+ "entry_point_count": 5,
+ "module_count": 24,
+ "total_nloc": 14043,
+ "language_count": 8,
+ "languages": [
+ {
+ "language": "python",
+ "file_count": 83
+ },
+ {
+ "language": "yaml",
+ "file_count": 8
+ },
+ {
+ "language": "markdown",
+ "file_count": 6
+ },
+ {
+ "language": "toml",
+ "file_count": 5
+ },
+ {
+ "language": "json",
+ "file_count": 2
+ },
+ {
+ "language": "sql",
+ "file_count": 2
+ },
+ {
+ "language": "shell",
+ "file_count": 1
+ },
+ {
+ "language": "makefile",
+ "file_count": 1
+ }
+ ],
+ "size_class": {
+ "name": "Village",
+ "blurb": "A tidy village — a few neighborhoods, easy to walk.",
+ "nloc": 14043
+ }
+ },
+ "activity": {
+ "total_commits": 2000,
+ "agent_commits": 0,
+ "agent_pct": 0,
+ "fix_commits": 204,
+ "fix_pct": 10.2,
+ "contributor_count": 568,
+ "first_commit_at": "2015-06-06T04:25:41+00:00",
+ "last_commit_at": "2026-05-31T14:42:46+00:00",
+ "age_days": 4012,
+ "busiest_month": {
+ "month": "2017-05",
+ "total": 100,
+ "agent": 0
+ },
+ "monthly": [
+ {
+ "month": "2015-06",
+ "total": 22,
+ "agent": 0
+ },
+ {
+ "month": "2015-07",
+ "total": 12,
+ "agent": 0
+ },
+ {
+ "month": "2015-08",
+ "total": 3,
+ "agent": 0
+ },
+ {
+ "month": "2015-09",
+ "total": 2,
+ "agent": 0
+ },
+ {
+ "month": "2015-10",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2015-11",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2015-12",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2016-01",
+ "total": 6,
+ "agent": 0
+ },
+ {
+ "month": "2016-02",
+ "total": 6,
+ "agent": 0
+ },
+ {
+ "month": "2016-03",
+ "total": 7,
+ "agent": 0
+ },
+ {
+ "month": "2016-04",
+ "total": 18,
+ "agent": 0
+ },
+ {
+ "month": "2016-05",
+ "total": 33,
+ "agent": 0
+ },
+ {
+ "month": "2016-06",
+ "total": 71,
+ "agent": 0
+ },
+ {
+ "month": "2016-07",
+ "total": 9,
+ "agent": 0
+ },
+ {
+ "month": "2016-08",
+ "total": 33,
+ "agent": 0
+ },
+ {
+ "month": "2016-09",
+ "total": 22,
+ "agent": 0
+ },
+ {
+ "month": "2016-10",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2016-11",
+ "total": 13,
+ "agent": 0
+ },
+ {
+ "month": "2016-12",
+ "total": 21,
+ "agent": 0
+ },
+ {
+ "month": "2017-01",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2017-02",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2017-03",
+ "total": 27,
+ "agent": 0
+ },
+ {
+ "month": "2017-04",
+ "total": 29,
+ "agent": 0
+ },
+ {
+ "month": "2017-05",
+ "total": 100,
+ "agent": 0
+ },
+ {
+ "month": "2017-06",
+ "total": 54,
+ "agent": 0
+ },
+ {
+ "month": "2017-07",
+ "total": 11,
+ "agent": 0
+ },
+ {
+ "month": "2017-08",
+ "total": 9,
+ "agent": 0
+ },
+ {
+ "month": "2017-09",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2017-10",
+ "total": 9,
+ "agent": 0
+ },
+ {
+ "month": "2017-11",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2017-12",
+ "total": 16,
+ "agent": 0
+ },
+ {
+ "month": "2018-01",
+ "total": 25,
+ "agent": 0
+ },
+ {
+ "month": "2018-02",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2018-03",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2018-04",
+ "total": 77,
+ "agent": 0
+ },
+ {
+ "month": "2018-05",
+ "total": 27,
+ "agent": 0
+ },
+ {
+ "month": "2018-06",
+ "total": 11,
+ "agent": 0
+ },
+ {
+ "month": "2018-07",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2018-08",
+ "total": 1,
+ "agent": 0
+ },
+ {
+ "month": "2018-09",
+ "total": 12,
+ "agent": 0
+ },
+ {
+ "month": "2018-10",
+ "total": 6,
+ "agent": 0
+ },
+ {
+ "month": "2018-11",
+ "total": 7,
+ "agent": 0
+ },
+ {
+ "month": "2018-12",
+ "total": 2,
+ "agent": 0
+ },
+ {
+ "month": "2019-01",
+ "total": 36,
+ "agent": 0
+ },
+ {
+ "month": "2019-02",
+ "total": 2,
+ "agent": 0
+ },
+ {
+ "month": "2019-03",
+ "total": 1,
+ "agent": 0
+ },
+ {
+ "month": "2019-04",
+ "total": 2,
+ "agent": 0
+ },
+ {
+ "month": "2019-05",
+ "total": 73,
+ "agent": 0
+ },
+ {
+ "month": "2019-06",
+ "total": 26,
+ "agent": 0
+ },
+ {
+ "month": "2019-07",
+ "total": 19,
+ "agent": 0
+ },
+ {
+ "month": "2019-08",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2019-09",
+ "total": 5,
+ "agent": 0
+ },
+ {
+ "month": "2019-10",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2019-11",
+ "total": 11,
+ "agent": 0
+ },
+ {
+ "month": "2020-02",
+ "total": 22,
+ "agent": 0
+ },
+ {
+ "month": "2020-03",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2020-04",
+ "total": 22,
+ "agent": 0
+ },
+ {
+ "month": "2020-05",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2020-06",
+ "total": 19,
+ "agent": 0
+ },
+ {
+ "month": "2020-07",
+ "total": 33,
+ "agent": 0
+ },
+ {
+ "month": "2020-08",
+ "total": 12,
+ "agent": 0
+ },
+ {
+ "month": "2020-09",
+ "total": 6,
+ "agent": 0
+ },
+ {
+ "month": "2020-10",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2020-11",
+ "total": 21,
+ "agent": 0
+ },
+ {
+ "month": "2020-12",
+ "total": 2,
+ "agent": 0
+ },
+ {
+ "month": "2021-01",
+ "total": 16,
+ "agent": 0
+ },
+ {
+ "month": "2021-02",
+ "total": 26,
+ "agent": 0
+ },
+ {
+ "month": "2021-03",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2021-04",
+ "total": 34,
+ "agent": 0
+ },
+ {
+ "month": "2021-05",
+ "total": 67,
+ "agent": 0
+ },
+ {
+ "month": "2021-06",
+ "total": 15,
+ "agent": 0
+ },
+ {
+ "month": "2021-07",
+ "total": 12,
+ "agent": 0
+ },
+ {
+ "month": "2021-08",
+ "total": 21,
+ "agent": 0
+ },
+ {
+ "month": "2021-09",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2021-10",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2021-11",
+ "total": 24,
+ "agent": 0
+ },
+ {
+ "month": "2021-12",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2022-01",
+ "total": 7,
+ "agent": 0
+ },
+ {
+ "month": "2022-02",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2022-03",
+ "total": 23,
+ "agent": 0
+ },
+ {
+ "month": "2022-04",
+ "total": 16,
+ "agent": 0
+ },
+ {
+ "month": "2022-05",
+ "total": 24,
+ "agent": 0
+ },
+ {
+ "month": "2022-06",
+ "total": 32,
+ "agent": 0
+ },
+ {
+ "month": "2022-07",
+ "total": 33,
+ "agent": 0
+ },
+ {
+ "month": "2022-08",
+ "total": 32,
+ "agent": 0
+ },
+ {
+ "month": "2022-09",
+ "total": 6,
+ "agent": 0
+ },
+ {
+ "month": "2022-10",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2022-11",
+ "total": 5,
+ "agent": 0
+ },
+ {
+ "month": "2022-12",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2023-01",
+ "total": 13,
+ "agent": 0
+ },
+ {
+ "month": "2023-02",
+ "total": 22,
+ "agent": 0
+ },
+ {
+ "month": "2023-03",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2023-04",
+ "total": 34,
+ "agent": 0
+ },
+ {
+ "month": "2023-05",
+ "total": 24,
+ "agent": 0
+ },
+ {
+ "month": "2023-06",
+ "total": 21,
+ "agent": 0
+ },
+ {
+ "month": "2023-07",
+ "total": 6,
+ "agent": 0
+ },
+ {
+ "month": "2023-08",
+ "total": 24,
+ "agent": 0
+ },
+ {
+ "month": "2023-09",
+ "total": 7,
+ "agent": 0
+ },
+ {
+ "month": "2023-10",
+ "total": 5,
+ "agent": 0
+ },
+ {
+ "month": "2023-11",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2023-12",
+ "total": 6,
+ "agent": 0
+ },
+ {
+ "month": "2024-01",
+ "total": 11,
+ "agent": 0
+ },
+ {
+ "month": "2024-02",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2024-04",
+ "total": 14,
+ "agent": 0
+ },
+ {
+ "month": "2024-05",
+ "total": 11,
+ "agent": 0
+ },
+ {
+ "month": "2024-06",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2024-07",
+ "total": 5,
+ "agent": 0
+ },
+ {
+ "month": "2024-08",
+ "total": 10,
+ "agent": 0
+ },
+ {
+ "month": "2024-09",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2024-10",
+ "total": 13,
+ "agent": 0
+ },
+ {
+ "month": "2024-11",
+ "total": 22,
+ "agent": 0
+ },
+ {
+ "month": "2025-01",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2025-03",
+ "total": 11,
+ "agent": 0
+ },
+ {
+ "month": "2025-05",
+ "total": 8,
+ "agent": 0
+ },
+ {
+ "month": "2025-06",
+ "total": 7,
+ "agent": 0
+ },
+ {
+ "month": "2025-08",
+ "total": 13,
+ "agent": 0
+ },
+ {
+ "month": "2025-09",
+ "total": 3,
+ "agent": 0
+ },
+ {
+ "month": "2025-10",
+ "total": 1,
+ "agent": 0
+ },
+ {
+ "month": "2025-11",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2026-01",
+ "total": 12,
+ "agent": 0
+ },
+ {
+ "month": "2026-02",
+ "total": 11,
+ "agent": 0
+ },
+ {
+ "month": "2026-03",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2026-04",
+ "total": 4,
+ "agent": 0
+ },
+ {
+ "month": "2026-05",
+ "total": 6,
+ "agent": 0
+ }
+ ],
+ "agent_names": []
+ },
+ "people": {
+ "owner_count": 12,
+ "top_owners": [
+ {
+ "name": "David Lord",
+ "file_count": 58,
+ "pct": 0.6904761904761905
+ },
+ {
+ "name": "Markus Unterwaditzer",
+ "file_count": 5,
+ "pct": 0.05952380952380952
+ },
+ {
+ "name": "pgjones",
+ "file_count": 4,
+ "pct": 0.047619047619047616
+ },
+ {
+ "name": "David Baumgold",
+ "file_count": 4,
+ "pct": 0.047619047619047616
+ },
+ {
+ "name": "Armin Ronacher",
+ "file_count": 4,
+ "pct": 0.047619047619047616
+ },
+ {
+ "name": "Jannis Leidel",
+ "file_count": 3,
+ "pct": 0.03571428571428571
+ },
+ {
+ "name": "emisargent",
+ "file_count": 1,
+ "pct": 0.011904761904761904
+ },
+ {
+ "name": "Hendrik Makait",
+ "file_count": 1,
+ "pct": 0.011904761904761904
+ }
+ ],
+ "single_owner_files": 28,
+ "silo_count": 4
+ },
+ "quality": {
+ "average_health": 6.94,
+ "maintainability_average": 7.71,
+ "performance_average": 9.96,
+ "worst_performer_path": "src/flask/app.py",
+ "worst_performer_score": 1.07,
+ "open_findings": 209,
+ "severity_breakdown": {
+ "critical": 8,
+ "high": 32,
+ "medium": 84,
+ "low": 85
+ },
+ "defect_accuracy": {
+ "k": 20,
+ "hits": 5,
+ "precision": 0.25,
+ "base_rate": 0.0556,
+ "lift": 4.5,
+ "window_days": 180,
+ "scored_files": 108,
+ "defect_files": 6,
+ "concentration_file_fraction": 0.2,
+ "concentration_defect_share": 0.8333,
+ "precision_table": [
+ {
+ "k": 10,
+ "hits": 3
+ },
+ {
+ "k": 20,
+ "hits": 5
+ },
+ {
+ "k": 30,
+ "hits": 5
+ }
+ ],
+ "flagged_files": [
+ {
+ "file_path": "src/flask/app.py",
+ "score": 1.07,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/sansio/app.py",
+ "score": 1.35,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/cli.py",
+ "score": 2.05,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/sansio/blueprints.py",
+ "score": 3.53,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/config.py",
+ "score": 5.15,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/testing.py",
+ "score": 5.5,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/ctx.py",
+ "score": 6.51,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/templating.py",
+ "score": 7.15,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/sansio/scaffold.py",
+ "score": 7.16,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_basic.py",
+ "score": 7.49,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/debughelpers.py",
+ "score": 7.53,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/helpers.py",
+ "score": 8.09,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_blueprints.py",
+ "score": 8.14,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "tests/test_cli.py",
+ "score": 8.19,
+ "recent_fixes": 1
+ },
+ {
+ "file_path": "src/flask/wrappers.py",
+ "score": 8.59,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "src/flask/blueprints.py",
+ "score": 8.64,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_templating.py",
+ "score": 8.74,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_appctx.py",
+ "score": 8.94,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_reqctx.py",
+ "score": 8.94,
+ "recent_fixes": 0
+ },
+ {
+ "file_path": "tests/test_testing.py",
+ "score": 8.94,
+ "recent_fixes": 0
+ }
+ ]
+ },
+ "distribution": {
+ "total_files": 108,
+ "total_nloc": 14046,
+ "bands": {
+ "healthy": {
+ "files": 97,
+ "nloc": 7562,
+ "pct": 53.8
+ },
+ "warning": {
+ "files": 7,
+ "nloc": 3192,
+ "pct": 22.7
+ },
+ "alert": {
+ "files": 4,
+ "nloc": 3292,
+ "pct": 23.4
+ }
+ }
+ },
+ "doc_coverage_pct": 0,
+ "page_count": 0,
+ "test_coverage_pct": 62,
+ "dead_code": {
+ "total_findings": 28,
+ "deletable_lines": 169
+ }
+ },
+ "knowledge": {
+ "decision_count": 32,
+ "active_decision_count": 0
+ },
+ "superlatives": {
+ "largest_file": {
+ "path": "tests/test_basic.py",
+ "nloc": 1440
+ },
+ "most_complex_symbol": {
+ "name": "register",
+ "file_path": "src/flask/sansio/blueprints.py",
+ "complexity": 22
+ },
+ "most_changed_file": {
+ "path": "src/flask/app.py",
+ "commit_count": 134
+ },
+ "oldest_file": {
+ "path": "tests/test_apps/blueprintapp/apps/__init__.py",
+ "first_commit_at": "2014-09-11T20:09:50+00:00"
+ },
+ "strongest_coupling": {
+ "a": "CHANGES.rst",
+ "b": "src/flask/sansio/app.py",
+ "count": 3
+ }
+ }
+}
diff --git a/packages/api-client/src/hosted.fixtures.test.ts b/packages/api-client/src/hosted.fixtures.test.ts
new file mode 100644
index 000000000..4a5feb1c0
--- /dev/null
+++ b/packages/api-client/src/hosted.fixtures.test.ts
@@ -0,0 +1,197 @@
+/**
+ * Shape-compat tests: recorded responses from the live hosted API, replayed
+ * through the provider and pinned to the shared OSS types. The assignments
+ * below are the contract; if a hosted route drifts from the OSS shape, the
+ * re-recorded fixture stops satisfying the type or these key-field checks.
+ *
+ * Fixtures live in __fixtures__/hosted/, recorded from public snapshots
+ * (pallets/flask for data domains, repowise for docs) and trimmed to a few
+ * entries. Re-record with a fresh snapshot id when the contract changes.
+ */
+
+import { readFileSync } from "node:fs";
+import path from "node:path";
+import { fileURLToPath } from "node:url";
+import { describe, expect, it } from "vitest";
+
+import type { FileDetailResponse, FilesIndexResponse } from "@repowise-dev/types/files";
+import type {
+ ChurnComplexityResponse,
+ HealthFilesResponse,
+ HealthFinding,
+ HealthOverviewResponse,
+ HealthTrendResponse,
+ RefactoringTargetsResponse,
+} from "@repowise-dev/types/health";
+import type { OverviewSummaryResponse } from "@repowise-dev/types/overview";
+import type { StatsHighlights } from "@repowise-dev/types/stats";
+import { createHostedProvider, type HostedProvider } from "./hosted";
+import type {
+ ArchitectureGraphResponse,
+ HotspotResponse,
+ ModuleGraphResponse,
+ Paginated,
+} from "./types";
+
+const FIXTURES = path.join(path.dirname(fileURLToPath(import.meta.url)), "__fixtures__", "hosted");
+
+function fixture(name: string): unknown {
+ return JSON.parse(readFileSync(path.join(FIXTURES, `${name}.json`), "utf-8"));
+}
+
+const REPO = {
+ repo: {
+ id: "repo-1",
+ canonical_url: "github.com/pallets/flask",
+ owner: "pallets",
+ name: "flask",
+ default_branch: "main",
+ latest_known_head_sha: null,
+ is_public: true,
+ },
+ active_snapshot: { id: "snap-1", short_id: "snap-1", status: "ready" },
+};
+
+/** Provider whose fetch serves each snapshot route from its fixture. */
+function fixtureProvider(routes: Array<[string, string]>): HostedProvider {
+ const table: Array<[string, unknown]> = routes.map(([suffix, name]) => [suffix, fixture(name)]);
+ return createHostedProvider({
+ baseUrl: "https://api.example.dev",
+ fetch: (async (url: string | URL) => {
+ const u = String(url);
+ if (u.includes("/repos/mine")) return json([REPO]);
+ for (const [suffix, body] of table) {
+ if (u.includes(suffix)) return json(body);
+ }
+ throw new Error(`no fixture route for ${u}`);
+ }) as typeof fetch,
+ });
+}
+
+function json(body: unknown): Response {
+ return new Response(JSON.stringify(body), {
+ status: 200,
+ headers: { "Content-Type": "application/json" },
+ });
+}
+
+describe("hosted fixtures satisfy the OSS contracts", () => {
+ it("health overview / files / findings / trend", async () => {
+ const p = fixtureProvider([
+ ["/health/overview", "health-overview"],
+ ["/health/files/breakdown", "health-files"], // unused; ordering guard
+ ["/health/findings", "health-findings"],
+ ["/health/files", "health-files"],
+ ["/health/trend", "health-trend"],
+ ["/health/churn-complexity", "churn-complexity"],
+ ["/health/refactoring-targets", "refactoring-targets"],
+ ]);
+ const overview: HealthOverviewResponse = await p.getHealthOverview("repo-1");
+ expect(overview.summary.file_count).toBeGreaterThan(0);
+ expect(overview.summary.average_health).toBeTypeOf("number");
+ expect(typeof overview.summary.open_findings).toBe("number");
+ expect(Array.isArray(overview.files)).toBe(true);
+ expect(overview.top_findings[0]).toHaveProperty("biomarker_type");
+
+ const files: HealthFilesResponse = await p.listHealthFiles("repo-1");
+ expect(files.files[0]).toHaveProperty("file_path");
+ expect(files.files[0]).toHaveProperty("score");
+ expect(typeof files.total).toBe("number");
+
+ const findings: HealthFinding[] = await p.listHealthFindings("repo-1");
+ expect(findings[0]).toHaveProperty("biomarker_type");
+ expect(findings[0]).toHaveProperty("severity");
+
+ const trend: HealthTrendResponse = await p.getHealthTrend("repo-1");
+ expect(Array.isArray(trend.history)).toBe(true);
+ expect(trend.summary).toHaveProperty("current_hotspot_health");
+
+ const churn: ChurnComplexityResponse = await p.getChurnComplexity("repo-1");
+ expect(Array.isArray(churn.points)).toBe(true);
+
+ const targets: RefactoringTargetsResponse = await p.getRefactoringTargets("repo-1");
+ expect(Array.isArray(targets.targets)).toBe(true);
+ });
+
+ it("overview summary and stats highlights", async () => {
+ const p = fixtureProvider([
+ ["/overview-summary", "overview-summary"],
+ ["/stats/highlights", "stats-highlights"],
+ ]);
+ const summary: OverviewSummaryResponse = await p.getOverviewSummary("repo-1");
+ expect(summary.repo).toBeDefined();
+ expect(summary.health).toBeDefined();
+ expect(summary.sync).toBeDefined();
+
+ const stats: StatsHighlights = await p.getStatsHighlights("repo-1");
+ expect(stats.scale).toBeDefined();
+ expect(stats.people).toBeDefined();
+ });
+
+ it("files index and file detail", async () => {
+ const p = fixtureProvider([
+ ["/files/detail", "file-detail"],
+ ["/files", "files-index"],
+ ]);
+ const index: FilesIndexResponse = await p.getFilesIndex("repo-1");
+ expect(index.files[0]).toHaveProperty("file_path");
+ expect(index.files[0]).toHaveProperty("pagerank_pct");
+ expect(typeof index.total).toBe("number");
+
+ const detail: FileDetailResponse = await p.getFileDetail("repo-1", "src/flask/app.py");
+ expect(detail).toHaveProperty("file_path");
+ });
+
+ it("hotspots page keeps the paginated envelope", async () => {
+ const p = fixtureProvider([["/hotspots", "hotspots"]]);
+ const page: Paginated<HotspotResponse> = await p.getHotspotsPage("repo-1", { limit: 2 });
+ expect(typeof page.total).toBe("number");
+ expect(page.items[0]).toHaveProperty("path");
+ expect(page.items[0]).toHaveProperty("churn_percentile");
+ });
+
+ it("architecture graph and module graph", async () => {
+ const p = fixtureProvider([
+ ["/architecture", "architecture"],
+ ["/module-graph", "module-graph"],
+ ]);
+ const arch: ArchitectureGraphResponse = await p.getArchitecture("repo-1");
+ expect(Array.isArray(arch.nodes)).toBe(true);
+ expect(Array.isArray(arch.edges)).toBe(true);
+
+ const modules: ModuleGraphResponse = await p.getModuleGraph("repo-1");
+ expect(Array.isArray(modules.nodes)).toBe(true);
+ });
+
+ it("decisions, dead code, search and docs map into the local shapes", async () => {
+ const p = fixtureProvider([
+ ["/decisions", "decisions"],
+ ["/dead-code", "dead-code"],
+ ["/search", "search"],
+ ["/docs", "docs"],
+ ]);
+ const decisions = await p.listDecisions("repo-1");
+ expect(decisions.length).toBeGreaterThan(0);
+ expect(decisions[0]).toHaveProperty("title");
+
+ const findings = await p.listDeadCode("repo-1");
+ expect(findings[0]!.id).toBeTruthy();
+ expect(findings[0]!.status).toBeTruthy();
+
+ const results = await p.search("application factory", { repo_id: "repo-1" });
+ expect(results[0]).toHaveProperty("title");
+ expect(results[0]).toHaveProperty("target_path");
+ expect(typeof results[0]!.page_id).toBe("string");
+
+ const pages = await p.listAllPages("repo-1");
+ expect(pages[0]!.id).toBeTruthy();
+ expect(pages[0]!.repository_id).toBe("repo-1");
+ });
+
+ it("snapshot status carries the polling fields", async () => {
+ const p = fixtureProvider([["/snapshots/snap-x", "snapshot-status"]]);
+ const status = await p.getSnapshotStatus("snap-x");
+ expect(["queued", "indexing", "ready", "failed"]).toContain(status.status);
+ expect(status.short_id).toBeTruthy();
+ });
+});
diff --git a/packages/api-client/src/hosted.test.ts b/packages/api-client/src/hosted.test.ts
new file mode 100644
index 000000000..714c4ce49
--- /dev/null
+++ b/packages/api-client/src/hosted.test.ts
@@ -0,0 +1,383 @@
+import { beforeEach, describe, expect, it, vi } from "vitest";
+
+import { ApiClientError } from "./client";
+import {
+ createHostedProvider,
+ mapHostedDeadCodeFinding,
+ mapHostedPage,
+ mapHostedRepo,
+ mapHostedSearchResult,
+} from "./hosted";
+
+// ---------------------------------------------------------------------------
+// Shared wire fixtures (shape per the hosted API's /repos/mine and snapshot
+// routes; trimmed to the fields the adapter reads)
+// ---------------------------------------------------------------------------
+
+const READY_REPO = {
+ repo: {
+ id: "repo-1",
+ canonical_url: "github.com/acme/widgets",
+ owner: "acme",
+ name: "widgets",
+ default_branch: "main",
+ latest_known_head_sha: "aaa111",
+ is_public: true,
+ description: "Widget factory",
+ primary_language: "Python",
+ stars: 42,
+ last_checked_at: "2026-07-01T00:00:00Z",
+ },
+ active_snapshot: {
+ id: "snap-1",
+ short_id: "abcdef123456",
+ status: "ready",
+ head_sha: "bbb222",
+ completed_at: "2026-06-30T00:00:00Z",
+ },
+ added_at: "2026-06-01T00:00:00Z",
+ team_name: null,
+};
+
+const UNINDEXED_REPO = {
+ repo: {
+ id: "repo-2",
+ canonical_url: "github.com/acme/empty",
+ owner: "acme",
+ name: "empty",
+ default_branch: null,
+ latest_known_head_sha: null,
+ is_public: false,
+ },
+ active_snapshot: null,
+ team_name: "Platform",
+};
+
+function jsonResponse(body: unknown, status = 200): Response {
+ return new Response(JSON.stringify(body), {
+ status,
+ headers: { "Content-Type": "application/json" },
+ });
+}
+
+/** A fetch stub that routes by URL substring and records every call. */
+function makeFetch(routes: Array<[string, unknown]>) {
+ const calls: Array<{ url: string; init: RequestInit }> = [];
+ const impl = vi.fn(async (url: string | URL | Request, init?: RequestInit) => {
+ const u = String(url);
+ calls.push({ url: u, init: init ?? {} });
+ for (const [needle, body] of routes) {
+ if (u.includes(needle)) {
+ return typeof body === "string" ? new Response(body, { status: 200 }) : jsonResponse(body);
+ }
+ }
+ return jsonResponse({ detail: `no route for ${u}` }, 404);
+ });
+ return { impl: impl as unknown as typeof fetch, calls };
+}
+
+function provider(routes: Array<[string, unknown]>, token: string | null = "tok-1") {
+ const { impl, calls } = makeFetch(routes);
+ return {
+ p: createHostedProvider({ baseUrl: "https://api.example.dev", token, fetch: impl }),
+ calls,
+ };
+}
+
+const REPOS_ROUTE: [string, unknown] = ["/repos/mine", [READY_REPO, UNINDEXED_REPO]];
+
+// ---------------------------------------------------------------------------
+// Mapping
+// ---------------------------------------------------------------------------
+
+describe("mapHostedRepo", () => {
+ it("presents a hosted repo in the local RepoResponse shape", () => {
+ const mapped = mapHostedRepo(READY_REPO);
+ expect(mapped).toMatchObject({
+ id: "repo-1",
+ name: "widgets",
+ url: "https://github.com/acme/widgets",
+ local_path: "",
+ default_branch: "main",
+ head_commit: "bbb222",
+ settings: {},
+ hosted: true,
+ owner: "acme",
+ snapshot_id: "snap-1",
+ snapshot_short_id: "abcdef123456",
+ snapshot_status: "ready",
+ last_indexed_at: "2026-06-30T00:00:00Z",
+ });
+ });
+
+ it("degrades cleanly for a repo with no snapshot", () => {
+ const mapped = mapHostedRepo(UNINDEXED_REPO);
+ expect(mapped.head_commit).toBeNull();
+ expect(mapped.snapshot_id).toBeNull();
+ expect(mapped.snapshot_status).toBeNull();
+ expect(mapped.default_branch).toBe("main");
+ expect(mapped.team_name).toBe("Platform");
+ });
+});
+
+describe("mapHostedPage", () => {
+ it("keeps content fields and defaults the local-DB bookkeeping", () => {
+ const page = mapHostedPage(
+ {
+ page_id: "file_page:src/a.py",
+ id: "file_page:src/a.py",
+ title: "a.py",
+ content: "# a",
+ page_type: "file_page",
+ target_path: "src/a.py",
+ metadata: { onboarding_slot: "start" },
+ },
+ "repo-1",
+ );
+ expect(page.id).toBe("file_page:src/a.py");
+ expect(page.repository_id).toBe("repo-1");
+ expect(page.version).toBe(1);
+ expect(page.freshness_status).toBe("fresh");
+ expect(page.human_notes).toBeNull();
+ expect(page.metadata).toEqual({ onboarding_slot: "start" });
+ });
+
+ it("falls back to page_id when the id alias is absent (old snapshots)", () => {
+ expect(mapHostedPage({ page_id: "p1" }, "r").id).toBe("p1");
+ });
+});
+
+describe("mapHostedDeadCodeFinding", () => {
+ it("synthesises an id and triage defaults for artifact rows", () => {
+ const f = mapHostedDeadCodeFinding({
+ kind: "unused_export",
+ file_path: "src/a.py",
+ symbol_name: "helper",
+ confidence: 0.9,
+ start_line: 10,
+ });
+ expect(f.id).toBe("src/a.py:helper:10");
+ expect(f.status).toBe("open");
+ expect(f.note).toBeNull();
+ expect(f.risk_factors).toEqual([]);
+ });
+});
+
+describe("mapHostedSearchResult", () => {
+ it("fills page_id for results that lack one", () => {
+ const r = mapHostedSearchResult({ title: "t", target_path: "src/a.py", score: 0.5 });
+ expect(r.page_id).toBe("");
+ expect(r.search_type).toBe("keyword");
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Snapshot resolution
+// ---------------------------------------------------------------------------
+
+describe("snapshot resolution", () => {
+ it("resolves via /repos/mine once and caches per repo", async () => {
+ const { p, calls } = provider([
+ REPOS_ROUTE,
+ ["/health/overview", { kpis: { file_count: 1, average_health: 8 }, files: [], biomarkers: [] }],
+ ]);
+ await p.getHealthOverview("repo-1");
+ await p.getHealthTrend("repo-1").catch(() => undefined);
+ const repoListCalls = calls.filter((c) => c.url.includes("/repos/mine"));
+ expect(repoListCalls).toHaveLength(1);
+ expect(calls[1]!.url).toContain("/snapshots/snap-1/health/overview");
+ });
+
+ it("throws 404 for a repo that is not on the account", async () => {
+ const { p } = provider([REPOS_ROUTE]);
+ await expect(p.getHealthOverview("nope")).rejects.toMatchObject({ status: 404 });
+ });
+
+ it("throws 409 for a repo with no ready snapshot", async () => {
+ const { p } = provider([REPOS_ROUTE]);
+ await expect(p.getHealthOverview("repo-2")).rejects.toMatchObject({ status: 409 });
+ });
+
+ it("refresh() drops the cache so the next call re-resolves", async () => {
+ const { p, calls } = provider([REPOS_ROUTE, ["/stats/highlights", {}]]);
+ await p.getStatsHighlights("repo-1");
+ p.refresh();
+ await p.getStatsHighlights("repo-1");
+ expect(calls.filter((c) => c.url.includes("/repos/mine"))).toHaveLength(2);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Request wiring
+// ---------------------------------------------------------------------------
+
+describe("request wiring", () => {
+ it("attaches the bearer token from a live resolver", async () => {
+ const { impl, calls } = makeFetch([REPOS_ROUTE]);
+ let token: string | null = "first";
+ const p = createHostedProvider({
+ baseUrl: "https://api.example.dev",
+ token: () => token,
+ fetch: impl,
+ });
+ await p.listRepos();
+ token = "second";
+ p.refresh();
+ await p.listRepos();
+ const auth = (i: number) => new Headers(calls[i]!.init.headers).get("Authorization");
+ expect(auth(0)).toBe("Bearer first");
+ expect(auth(1)).toBe("Bearer second");
+ });
+
+ it("stays anonymous without a token (public repo reads)", async () => {
+ const { impl, calls } = makeFetch([REPOS_ROUTE]);
+ const p = createHostedProvider({ baseUrl: "https://api.example.dev", token: null, fetch: impl });
+ await p.listRepos();
+ expect(new Headers(calls[0]!.init.headers).get("Authorization")).toBeNull();
+ });
+
+ it("passes query params through on re-addressed routes", async () => {
+ const { p, calls } = provider([REPOS_ROUTE, ["/health/files", []]]);
+ const res = await p.listHealthFiles("repo-1", { limit: 10, sort: "score", search: "app" });
+ const url = calls.at(-1)!.url;
+ expect(url).toContain("/snapshots/snap-1/health/files");
+ expect(url).toContain("sort=score");
+ expect(url).toContain("q=app");
+ expect(res).toMatchObject({ total: 0, offset: 0, limit: 10, files: [] });
+ });
+
+ it("surfaces API errors as ApiClientError with the detail", async () => {
+ const { impl } = makeFetch([REPOS_ROUTE]);
+ const p = createHostedProvider({ baseUrl: "https://api.example.dev", fetch: impl });
+ await p.listRepos();
+ // No route registered for health/overview: stub returns a 404 body.
+ await expect(p.getHealthOverview("repo-1")).rejects.toBeInstanceOf(ApiClientError);
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Docs
+// ---------------------------------------------------------------------------
+
+const DOCS_BODY = {
+ available: true,
+ docs_status: "ready",
+ pages_ready: 2,
+ pages_total: 2,
+ pages: [
+ { id: "overview", page_id: "overview", page_type: "overview", title: "Overview" },
+ { id: "file_page:a", page_id: "file_page:a", page_type: "file_page", title: "a" },
+ ],
+};
+
+describe("docs", () => {
+ it("maps and caches the docs list per snapshot", async () => {
+ const { p, calls } = provider([REPOS_ROUTE, ["/docs", DOCS_BODY]]);
+ const all = await p.listAllPages("repo-1");
+ await p.listAllPages("repo-1");
+ expect(all).toHaveLength(2);
+ expect(all[0]!.repository_id).toBe("repo-1");
+ expect(calls.filter((c) => c.url.includes("/docs"))).toHaveLength(1);
+ });
+
+ it("listPages filters by page_type and slices", async () => {
+ const { p } = provider([REPOS_ROUTE, ["/docs", DOCS_BODY]]);
+ const filtered = await p.listPages("repo-1", { page_type: "file_page" });
+ expect(filtered.map((pg) => pg.id)).toEqual(["file_page:a"]);
+ const sliced = await p.listPages("repo-1", { limit: 1 });
+ expect(sliced).toHaveLength(1);
+ });
+
+ it("getPageById finds a page and 404s on a miss", async () => {
+ const { p } = provider([REPOS_ROUTE, ["/docs", DOCS_BODY]]);
+ const page = await p.getPageById("overview", "repo-1");
+ expect(page.title).toBe("Overview");
+ await expect(p.getPageById("missing", "repo-1")).rejects.toMatchObject({ status: 404 });
+ });
+
+ it("getDocsStatus exposes the generation-progress fields", async () => {
+ const { p } = provider([REPOS_ROUTE, ["/docs", DOCS_BODY]]);
+ expect(await p.getDocsStatus("repo-1")).toEqual({
+ available: true,
+ docs_status: "ready",
+ pages_ready: 2,
+ pages_total: 2,
+ });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Envelope unwrapping
+// ---------------------------------------------------------------------------
+
+describe("envelope unwrapping", () => {
+ it("listDecisions unwraps the hosted envelope", async () => {
+ const { p } = provider([
+ REPOS_ROUTE,
+ ["/decisions", { total_found: 1, decisions: [{ title: "Use X" }], by_source: {} }],
+ ]);
+ const decisions = await p.listDecisions("repo-1");
+ expect(decisions).toEqual([{ title: "Use X" }]);
+ });
+
+ it("listDeadCode unwraps and filters client-side", async () => {
+ const { p } = provider([
+ REPOS_ROUTE,
+ [
+ "/dead-code",
+ {
+ total_findings: 3,
+ deletable_lines: 30,
+ findings: [
+ { kind: "unused_export", file_path: "a.py", confidence: 0.9, safe_to_delete: true },
+ { kind: "unused_export", file_path: "b.py", confidence: 0.4, safe_to_delete: false },
+ { kind: "unreachable", file_path: "c.py", confidence: 0.95, safe_to_delete: true },
+ ],
+ },
+ ],
+ ]);
+ const safe = await p.listDeadCode("repo-1", { kind: "unused_export", min_confidence: 0.5 });
+ expect(safe.map((f) => f.file_path)).toEqual(["a.py"]);
+ });
+
+ it("search posts to the snapshot route and maps results", async () => {
+ const { p, calls } = provider([
+ REPOS_ROUTE,
+ ["/search", { results: [{ title: "hit", target_path: "a.py", score: 1, search_type: "semantic" }] }],
+ ]);
+ const results = await p.search("widgets", { repo_id: "repo-1", limit: 5 });
+ expect(results[0]).toMatchObject({ title: "hit", page_id: "", search_type: "semantic" });
+ const call = calls.at(-1)!;
+ expect(call.url).toContain("/snapshots/snap-1/search");
+ expect(JSON.parse(String(call.init.body))).toEqual({ query: "widgets", limit: 5 });
+ });
+
+ it("search without repo_id is rejected", async () => {
+ const { p } = provider([REPOS_ROUTE]);
+ await expect(p.search("q")).rejects.toMatchObject({ status: 400 });
+ });
+});
+
+// ---------------------------------------------------------------------------
+// Indexing lifecycle
+// ---------------------------------------------------------------------------
+
+describe("indexing lifecycle", () => {
+ it("triggerReindex posts to the repo route with the docs flag", async () => {
+ const { p, calls } = provider([
+ ["/repos/repo-1/reindex", { snapshot_id: "snap-2", short_id: "s2", status: "queued", cached: false }],
+ ]);
+ const res = await p.triggerReindex("repo-1", { generate_docs: true });
+ expect(res.status).toBe("queued");
+ const call = calls.at(-1)!;
+ expect(call.init.method).toBe("POST");
+ expect(JSON.parse(String(call.init.body))).toEqual({ generate_docs: true });
+ });
+
+ it("getSnapshotStatus polls the snapshot row", async () => {
+ const { p, calls } = provider([["/snapshots/snap-2", { id: "snap-2", status: "indexing" }]]);
+ const status = await p.getSnapshotStatus("snap-2");
+ expect(status.status).toBe("indexing");
+ expect(calls[0]!.url).toContain("/snapshots/snap-2");
+ });
+});
diff --git a/packages/api-client/src/hosted.ts b/packages/api-client/src/hosted.ts
new file mode 100644
index 000000000..c939f5809
--- /dev/null
+++ b/packages/api-client/src/hosted.ts
@@ -0,0 +1,800 @@
+/**
+ * Hosted-platform provider: the same typed read surface as the per-domain
+ * modules in this package, addressed at the hosted repowise API instead of a
+ * local server.
+ *
+ * The hosted API serves the same artifact JSON the local pipeline produces,
+ * but reads are snapshot-addressed (`/snapshots/{id}/...`) where the local
+ * server is repo-addressed (`/api/repos/{id}/...`). The provider bridges
+ * that: every method takes the same arguments as its local counterpart and
+ * resolves the repo's latest ready snapshot internally (resolved once per
+ * repo and cached; `refresh()` clears the cache after a reindex).
+ *
+ * Unlike `configureApiClient`, which sets module-global state, this is an
+ * instance factory: a host app can hold a hosted provider per account next
+ * to the local singleton client and route per repo.
+ */
+
+import type { ArchitectureView, C4L1, C4L2, C4L3 } from "@repowise-dev/ui/c4";
+import type { CouplingGraphResponse } from "@repowise-dev/types/coupling";
+import type { FileDetailResponse, FilesIndexResponse } from "@repowise-dev/types/files";
+import type {
+ ChurnComplexityResponse,
+ HealthCoverageResponse,
+ HealthFileBreakdownResponse,
+ HealthFilesQuery,
+ HealthFilesResponse,
+ HealthFinding,
+ HealthOverviewResponse,
+ HealthTrendResponse,
+ RefactoringQuery,
+ RefactoringTargetsResponse,
+} from "@repowise-dev/types/health";
+import type { OverviewSummaryResponse } from "@repowise-dev/types/overview";
+import type { StatsHighlights } from "@repowise-dev/types/stats";
+import type { SymbolDetailResponse } from "@repowise-dev/types/symbols";
+import { ApiClientError } from "./client";
+import type { ModuleHealthSortKey } from "./modules";
+import type {
+ ArchitectureGraphResponse,
+ CommunitySliceResponse,
+ DeadCodeFindingResponse,
+ DecisionRecordResponse,
+ ExecutionFlowsResponse,
+ GitSummaryResponse,
+ HotspotResponse,
+ ModuleGraphResponse,
+ ModuleHealthDetail,
+ ModuleHealthSummary,
+ Paginated,
+ PageResponse,
+ RepoResponse,
+ SearchResultResponse,
+} from "./types";
+
+// ---------------------------------------------------------------------------
+// Config + hosted-only response types
+// ---------------------------------------------------------------------------
+
+export interface HostedProviderConfig {
+ /** Absolute origin of the hosted API, e.g. "https://api.repowise.dev". */
+ baseUrl: string;
+ /**
+ * Bearer token: an OAuth access token or an rw_live_ API key. May be a
+ * resolver called fresh on every request (same convention as
+ * `configureApiClient`). Reads on public repos work without one.
+ */
+ token?: string | null | (() => string | null);
+ fetch?: typeof fetch;
+}
+
+export type HostedSnapshotState = "queued" | "indexing" | "ready" | "failed";
+
+/** Snapshot row served by GET /snapshots/{id}; the reindex polling target. */
+export interface HostedSnapshotStatus {
+ id: string;
+ short_id: string;
+ repo_id: string;
+ head_sha: string | null;
+ status: HostedSnapshotState;
+ error_message: string | null;
+ file_count: number | null;
+ line_count: number | null;
+ ref: string | null;
+ created_at: string | null;
+ completed_at: string | null;
+}
+
+export interface HostedReindexResponse {
+ snapshot_id: string;
+ short_id: string;
+ status: HostedSnapshotState;
+ /** True when the head commit was already indexed and no new run started. */
+ cached: boolean;
+}
+
+/**
+ * A hosted repo presented in the local `RepoResponse` shape (so repo-list
+ * components render it unchanged) plus hosted-only context. `local_path` is
+ * always "" and `hosted` is the discriminant.
+ */
+export interface HostedRepoResponse extends RepoResponse {
+ hosted: true;
+ owner: string;
+ is_public: boolean;
+ description: string | null;
+ primary_language: string | null;
+ stars: number | null;
+ /** Team that shares this repo with the account, if any. */
+ team_name: string | null;
+ snapshot_id: string | null;
+ snapshot_short_id: string | null;
+ snapshot_status: HostedSnapshotState | null;
+ last_indexed_at: string | null;
+}
+
+/** Docs payload with the hosted generation-progress fields. */
+export interface HostedDocsStatus {
+ available: boolean;
+ docs_status: string | null;
+ pages_ready: number;
+ pages_total: number | null;
+}
+
+// Wire shapes of the hosted endpoints the provider maps (not re-exported).
+
+interface WireSnapshot {
+ id?: string;
+ short_id?: string;
+ status?: string;
+ head_sha?: string | null;
+ completed_at?: string | null;
+}
+
+interface WireUserRepo {
+ repo: {
+ id: string;
+ canonical_url: string;
+ owner: string;
+ name: string;
+ default_branch: string | null;
+ latest_known_head_sha: string | null;
+ is_public: boolean;
+ description?: string | null;
+ primary_language?: string | null;
+ stars?: number | null;
+ last_checked_at?: string | null;
+ };
+ active_snapshot: WireSnapshot | null;
+ added_at?: string | null;
+ team_name?: string | null;
+}
+
+interface WireDocs extends HostedDocsStatus {
+ pages: Array<Record<string, unknown>>;
+}
+
+interface WireDecisions {
+ total_found: number;
+ decisions: Array<Record<string, unknown>>;
+ by_source: Record<string, number>;
+}
+
+interface WireDeadCode {
+ total_findings: number;
+ deletable_lines: number;
+ findings: Array<Record<string, unknown>>;
+}
+
+interface WireSearch {
+ results: Array<Record<string, unknown>>;
+}
+
+interface WireFindings {
+ items: HealthFinding[];
+ total: number;
+}
+
+interface WireTrend {
+ points: Array<{
+ taken_at: string;
+ hotspot_health: number;
+ average_health: number;
+ worst_performer_path?: string | null;
+ worst_performer_score?: number | null;
+ }>;
+ declining: boolean;
+ predicted_decline: boolean;
+}
+
+const SEVERITY_ORDER: Record<string, number> = { low: 0, medium: 1, high: 2, critical: 3 };
+
+interface WireHealthOverview {
+ kpis: Record<string, unknown> & {
+ file_count?: number;
+ average_health?: number;
+ worst_performer_path?: string | null;
+ worst_performer_score?: number | null;
+ };
+ files: HealthOverviewResponse["files"];
+ /** Top finding rows (the hosted counterpart of the local `top_findings`). */
+ biomarkers: HealthFinding[];
+ modules?: HealthOverviewResponse["modules"];
+ defect_accuracy?: HealthOverviewResponse["defect_accuracy"];
+ meta?: HealthOverviewResponse["meta"];
+}
+
+interface WireFilesIndex {
+ files: FilesIndexResponse["files"];
+ language_counts: Record<string, number>;
+ totals: { files?: number; loc?: number };
+}
+
+// ---------------------------------------------------------------------------
+// Mapping helpers (exported for tests)
+// ---------------------------------------------------------------------------
+
+export function mapHostedRepo(item: WireUserRepo): HostedRepoResponse {
+ const { repo, active_snapshot: snap } = item;
+ return {
+ id: repo.id,
+ name: repo.name,
+ url: `https://${repo.canonical_url}`,
+ local_path: "",
+ default_branch: repo.default_branch ?? "main",
+ head_commit: snap?.head_sha ?? repo.latest_known_head_sha ?? null,
+ settings: {},
+ created_at: item.added_at ?? "",
+ updated_at: repo.last_checked_at ?? item.added_at ?? "",
+ hosted: true,
+ owner: repo.owner,
+ is_public: repo.is_public,
+ description: repo.description ?? null,
+ primary_language: repo.primary_language ?? null,
+ stars: repo.stars ?? null,
+ team_name: item.team_name ?? null,
+ snapshot_id: snap?.id ?? null,
+ snapshot_short_id: snap?.short_id ?? null,
+ snapshot_status: (snap?.status as HostedSnapshotState | undefined) ?? null,
+ last_indexed_at: snap?.completed_at ?? null,
+ };
+}
+
+/**
+ * A pages.json entry into the local `PageResponse` shape. The artifact
+ * carries the content fields; the local-DB bookkeeping fields (token counts,
+ * versioning) do not exist on hosted and get neutral defaults.
+ */
+export function mapHostedPage(raw: Record<string, unknown>, repoId: string): PageResponse {
+ const str = (k: string): string => (typeof raw[k] === "string" ? (raw[k] as string) : "");
+ const num = (k: string, fallback = 0): number =>
+ typeof raw[k] === "number" ? (raw[k] as number) : fallback;
+ return {
+ id: str("id") || str("page_id"),
+ repository_id: repoId,
+ page_type: str("page_type"),
+ title: str("title"),
+ content: str("content"),
+ target_path: str("target_path"),
+ source_hash: str("source_hash"),
+ model_name: str("model_name"),
+ provider_name: str("provider_name"),
+ input_tokens: num("input_tokens"),
+ output_tokens: num("output_tokens"),
+ cached_tokens: num("cached_tokens"),
+ generation_level: num("generation_level"),
+ version: num("version", 1),
+ confidence: num("confidence", 1),
+ freshness_status: str("freshness_status") || "fresh",
+ metadata: (raw.metadata as Record<string, unknown> | undefined) ?? {},
+ human_notes: null,
+ created_at: str("created_at"),
+ updated_at: str("updated_at") || str("created_at"),
+ };
+}
+
+/** A dead_code.json finding into the local finding shape (artifact rows lack
+ * the local-DB triage fields, which default to an open, note-less finding). */
+export function mapHostedDeadCodeFinding(raw: Record<string, unknown>): DeadCodeFindingResponse {
+ const partial = raw as Partial<DeadCodeFindingResponse>;
+ return {
+ id:
+ partial.id ??
+ `${partial.file_path ?? ""}:${partial.symbol_name ?? ""}:${partial.start_line ?? 0}`,
+ kind: partial.kind ?? "",
+ file_path: partial.file_path ?? "",
+ symbol_name: partial.symbol_name ?? null,
+ symbol_kind: partial.symbol_kind ?? null,
+ confidence: partial.confidence ?? 0,
+ reason: partial.reason ?? "",
+ lines: partial.lines ?? 0,
+ start_line: partial.start_line ?? null,
+ end_line: partial.end_line ?? null,
+ safe_to_delete: partial.safe_to_delete ?? false,
+ risk_factors: partial.risk_factors ?? [],
+ evidence: partial.evidence ?? [],
+ primary_owner: partial.primary_owner ?? null,
+ status: partial.status ?? "open",
+ note: partial.note ?? null,
+ };
+}
+
+export function mapHostedSearchResult(raw: Record<string, unknown>): SearchResultResponse {
+ const partial = raw as Partial<SearchResultResponse>;
+ return {
+ page_id: partial.page_id ?? "",
+ title: partial.title ?? "",
+ page_type: partial.page_type ?? "",
+ target_path: partial.target_path ?? "",
+ score: partial.score ?? 0,
+ snippet: partial.snippet ?? "",
+ search_type: partial.search_type ?? "keyword",
+ };
+}
+
+// ---------------------------------------------------------------------------
+// Provider
+// ---------------------------------------------------------------------------
+
+type QueryParams = Record<string, string | number | boolean | undefined>;
+
+export interface HostedProvider {
+ /** Personal + team repos of the signed-in account, in RepoResponse shape. */
+ listRepos(): Promise<HostedRepoResponse[]>;
+ /** Drops the cached repo list and snapshot ids (e.g. after a reindex). */
+ refresh(): void;
+
+ // Overview / stats / health (identical shapes, re-addressed)
+ getOverviewSummary(repoId: string): Promise<OverviewSummaryResponse>;
+ getStatsHighlights(repoId: string): Promise<StatsHighlights>;
+ getHealthOverview(repoId: string, limit?: number): Promise<HealthOverviewResponse>;
+ listHealthFindings(
+ repoId: string,
+ opts?: {
+ biomarker_type?: string;
+ file_path?: string;
+ min_severity?: string;
+ dimension?: string;
+ },
+ ): Promise<HealthFinding[]>;
+ listHealthFiles(repoId: string, opts?: HealthFilesQuery): Promise<HealthFilesResponse>;
+ getHealthFileBreakdown(repoId: string, filePath: string): Promise<HealthFileBreakdownResponse>;
+ getHealthTrend(repoId: string, limit?: number): Promise<HealthTrendResponse>;
+ getHealthCoverage(
+ repoId: string,
+ opts?: { file_path?: string; limit?: number },
+ ): Promise<HealthCoverageResponse>;
+ getRefactoringTargets(
+ repoId: string,
+ opts?: RefactoringQuery,
+ ): Promise<RefactoringTargetsResponse>;
+ getChurnComplexity(repoId: string, opts?: { limit?: number }): Promise<ChurnComplexityResponse>;
+
+ // Modules
+ listModuleHealth(
+ repoId: string,
+ options?: { sort?: ModuleHealthSortKey; limit?: number; offset?: number },
+ ): Promise<Paginated<ModuleHealthSummary>>;
+ getModuleHealth(repoId: string, modulePath: string): Promise<ModuleHealthDetail>;
+
+ // Architecture
+ getC4L1(repoId: string): Promise<C4L1>;
+ getC4L2(repoId: string): Promise<C4L2>;
+ getC4L3(repoId: string, containerId: string): Promise<C4L3>;
+ getC4Mermaid(repoId: string, level: 1 | 2 | 3, containerId?: string | null): Promise<string>;
+ getArchitectureView(repoId: string, includeSymbols?: boolean): Promise<ArchitectureView>;
+ getArchitecture(repoId: string, minMembers?: number): Promise<ArchitectureGraphResponse>;
+ getCommunitySlice(repoId: string, communityId: number): Promise<CommunitySliceResponse>;
+ getModuleGraph(repoId: string): Promise<ModuleGraphResponse>;
+ getExecutionFlows(
+ repoId: string,
+ params?: { top_n?: number; max_depth?: number; entry_point?: string },
+ ): Promise<ExecutionFlowsResponse>;
+ getCoupling(repoId: string, opts?: { limit?: number }): Promise<CouplingGraphResponse>;
+
+ // Files / symbols
+ getFilesIndex(repoId: string): Promise<FilesIndexResponse>;
+ getFileDetail(repoId: string, filePath: string): Promise<FileDetailResponse>;
+ getSymbolDetail(repoId: string, symbolId: string): Promise<SymbolDetailResponse>;
+
+ // Docs
+ getDocsStatus(repoId: string): Promise<HostedDocsStatus>;
+ listPages(
+ repoId: string,
+ opts?: { page_type?: string; limit?: number; offset?: number },
+ ): Promise<PageResponse[]>;
+ listAllPages(repoId: string, opts?: { page_type?: string }): Promise<PageResponse[]>;
+ getPageById(pageId: string, repoId?: string): Promise<PageResponse>;
+
+ // Decisions / risk / dead code
+ listDecisions(repoId: string, opts?: { limit?: number }): Promise<DecisionRecordResponse[]>;
+ listDeadCode(
+ repoId: string,
+ opts?: {
+ kind?: string;
+ min_confidence?: number;
+ status?: string;
+ safe_only?: boolean;
+ limit?: number;
+ },
+ ): Promise<DeadCodeFindingResponse[]>;
+ getHotspotsPage(
+ repoId: string,
+ options?: { limit?: number; offset?: number },
+ ): Promise<Paginated<HotspotResponse>>;
+ getHotspots(repoId: string, limit?: number): Promise<HotspotResponse[]>;
+ getCoChanges(
+ repoId: string,
+ filePath: string,
+ minCount?: number,
+ ): Promise<{
+ file_path: string;
+ co_change_partners: Array<{ file_path: string; co_change_count: number }>;
+ total?: number;
+ }>;
+ getGitSummary(repoId: string, topOwnersLimit?: number): Promise<GitSummaryResponse>;
+
+ // Search
+ search(
+ query: string,
+ opts?: { search_type?: "semantic" | "fulltext"; limit?: number; repo_id?: string },
+ ): Promise<SearchResultResponse[]>;
+
+ // Indexing lifecycle
+ triggerReindex(
+ repoId: string,
+ opts?: { generate_docs?: boolean; docs_file_percentage?: number },
+ ): Promise<HostedReindexResponse>;
+ getSnapshotStatus(snapshotId: string): Promise<HostedSnapshotStatus>;
+}
+
+export function createHostedProvider(config: HostedProviderConfig): HostedProvider {
+ const baseUrl = config.baseUrl.replace(/\/+$/, "");
+
+ function resolveToken(): string | null {
+ const { token } = config;
+ if (typeof token === "function") return token();
+ return token ?? null;
+ }
+
+ function buildUrl(path: string, params?: QueryParams): string {
+ const url = new URL(`${baseUrl}${path}`);
+ if (params) {
+ for (const [k, v] of Object.entries(params)) {
+ if (v !== undefined && v !== null) url.searchParams.set(k, String(v));
+ }
+ }
+ return url.toString();
+ }
+
+ function headers(): Headers {
+ const h = new Headers({ "Content-Type": "application/json" });
+ const token = resolveToken();
+ if (token) h.set("Authorization", `Bearer ${token}`);
+ return h;
+ }
+
+ async function handle<T>(res: Response): Promise<T> {
+ if (!res.ok) {
+ let detail = res.statusText;
+ try {
+ const body = (await res.json()) as { detail?: unknown };
+ if (typeof body.detail === "string") detail = body.detail;
+ else if (body.detail !== undefined) detail = JSON.stringify(body.detail);
+ } catch {
+ // response body is not JSON
+ }
+ throw new ApiClientError(res.status, detail);
+ }
+ return res.json() as Promise<T>;
+ }
+
+ async function get<T>(path: string, params?: QueryParams): Promise<T> {
+ const res = await (config.fetch ?? fetch)(buildUrl(path, params), {
+ method: "GET",
+ headers: headers(),
+ });
+ return handle<T>(res);
+ }
+
+ async function getText(path: string, params?: QueryParams): Promise<string> {
+ const res = await (config.fetch ?? fetch)(buildUrl(path, params), {
+ method: "GET",
+ headers: headers(),
+ });
+ if (!res.ok) throw new ApiClientError(res.status, res.statusText);
+ return res.text();
+ }
+
+ async function post<T>(path: string, body?: unknown): Promise<T> {
+ const res = await (config.fetch ?? fetch)(buildUrl(path), {
+ method: "POST",
+ headers: headers(),
+ ...(body !== undefined ? { body: JSON.stringify(body) } : {}),
+ });
+ return handle<T>(res);
+ }
+
+ // Repo handle -> snapshot id, resolved from the repo list and cached for
+ // the provider's lifetime (a snapshot's content is immutable; a reindex
+ // mints a new id, surfaced via refresh()).
+ let repos: HostedRepoResponse[] | null = null;
+ let reposInFlight: Promise<HostedRepoResponse[]> | null = null;
+ const snapshotByRepo = new Map<string, string | null>();
+ const pagesBySnapshot = new Map<string, PageResponse[]>();
+
+ function listRepos(): Promise<HostedRepoResponse[]> {
+ // Single-flight: concurrent calls (e.g. parallel dashboard requests all
+ // resolving their snapshot) share one /repos/mine round trip.
+ if (reposInFlight) return reposInFlight;
+ reposInFlight = (async () => {
+ try {
+ const items = await get<WireUserRepo[]>("/repos/mine");
+ repos = items.map(mapHostedRepo);
+ for (const r of repos) {
+ snapshotByRepo.set(r.id, r.snapshot_status === "ready" ? r.snapshot_id : null);
+ }
+ return repos;
+ } finally {
+ reposInFlight = null;
+ }
+ })();
+ return reposInFlight;
+ }
+
+ async function snapshot(repoId: string): Promise<string> {
+ if (!snapshotByRepo.has(repoId)) await listRepos();
+ if (!snapshotByRepo.has(repoId)) {
+ throw new ApiClientError(404, `Repository ${repoId} is not on your hosted account`);
+ }
+ const sid = snapshotByRepo.get(repoId);
+ if (!sid) {
+ throw new ApiClientError(409, "This repository has no ready hosted snapshot yet");
+ }
+ return sid;
+ }
+
+ async function snapGet<T>(repoId: string, suffix: string, params?: QueryParams): Promise<T> {
+ return get<T>(`/snapshots/${await snapshot(repoId)}${suffix}`, params);
+ }
+
+ async function getDocs(repoId: string): Promise<WireDocs> {
+ return snapGet<WireDocs>(repoId, "/docs");
+ }
+
+ async function loadPages(repoId: string): Promise<PageResponse[]> {
+ const sid = await snapshot(repoId);
+ const cached = pagesBySnapshot.get(sid);
+ if (cached) return cached;
+ const docs = await getDocs(repoId);
+ const mapped = (docs.pages ?? []).map((p) => mapHostedPage(p, repoId));
+ pagesBySnapshot.set(sid, mapped);
+ return mapped;
+ }
+
+ return {
+ listRepos,
+ refresh(): void {
+ repos = null;
+ snapshotByRepo.clear();
+ pagesBySnapshot.clear();
+ },
+
+ getOverviewSummary: (repoId) => snapGet(repoId, "/overview-summary"),
+ getStatsHighlights: (repoId) => snapGet(repoId, "/stats/highlights"),
+ async getHealthOverview(repoId, limit = 25): Promise<HealthOverviewResponse> {
+ // Hosted splits what the local route serves in one payload: the KPI
+ // block is named differently, the top finding rows live under
+ // `biomarkers`, the distribution has its own route, and the open
+ // finding count only exists as the findings-list total. Compose them.
+ const [overview, distribution, findingsPage] = await Promise.all([
+ snapGet<WireHealthOverview>(repoId, "/health/overview", { limit }),
+ snapGet<HealthOverviewResponse["distribution"]>(repoId, "/health/distribution").catch(
+ () => null,
+ ),
+ snapGet<WireFindings>(repoId, "/health/findings", { limit: 1 }).catch(() => null),
+ ]);
+ return {
+ summary: {
+ ...overview.kpis,
+ file_count: overview.kpis.file_count ?? 0,
+ average_health: overview.kpis.average_health ?? 0,
+ worst_performer_path: overview.kpis.worst_performer_path ?? null,
+ worst_performer_score: overview.kpis.worst_performer_score ?? null,
+ open_findings: findingsPage?.total ?? overview.biomarkers?.length ?? 0,
+ },
+ distribution: distribution ?? null,
+ defect_accuracy: overview.defect_accuracy ?? null,
+ files: overview.files ?? [],
+ top_findings: overview.biomarkers ?? [],
+ modules: overview.modules ?? [],
+ ...(overview.meta ? { meta: overview.meta } : {}),
+ };
+ },
+ async listHealthFindings(repoId, opts): Promise<HealthFinding[]> {
+ // Hosted paginates findings and filters by exact severity; the local
+ // route returns a bare list with a minimum-severity filter. Fetch the
+ // (server-filtered) page and apply the threshold client-side.
+ const res = await snapGet<WireFindings>(repoId, "/health/findings", {
+ biomarker: opts?.biomarker_type,
+ file_path: opts?.file_path,
+ dimension: opts?.dimension,
+ limit: 500,
+ });
+ let items = res.items ?? [];
+ if (opts?.min_severity !== undefined && opts.min_severity in SEVERITY_ORDER) {
+ const floor = SEVERITY_ORDER[opts.min_severity] as number;
+ items = items.filter((f) => (SEVERITY_ORDER[f.severity] ?? 0) >= floor);
+ }
+ return items;
+ },
+ async listHealthFiles(repoId, opts): Promise<HealthFilesResponse> {
+ // Hosted returns a bare (server-sliced) list with its own param names;
+ // the local route returns a windowed envelope. Fetch a wide window and
+ // apply the local windowing semantics client-side. Ceiling: repos with
+ // more than 500 scored files see the worst 500 (server sort: score).
+ const filter = opts?.only_hotspots
+ ? "hotspots"
+ : opts?.only_untested
+ ? "untested"
+ : opts?.only_failing
+ ? "failing"
+ : undefined;
+ const rows = await snapGet<HealthFilesResponse["files"]>(repoId, "/health/files", {
+ limit: 500,
+ sort: opts?.sort,
+ q: opts?.search,
+ filter,
+ });
+ let files = rows ?? [];
+ if (opts?.module) files = files.filter((f) => f.file_path.startsWith(opts.module as string));
+ if (opts?.order === "desc") files = [...files].reverse();
+ const offset = opts?.offset ?? 0;
+ const limit = opts?.limit ?? 50;
+ return { total: files.length, offset, limit, files: files.slice(offset, offset + limit) };
+ },
+ getHealthFileBreakdown: (repoId, filePath) =>
+ snapGet(repoId, "/health/files/breakdown", { file_path: filePath }),
+ async getHealthTrend(repoId, limit = 20): Promise<HealthTrendResponse> {
+ // Hosted serves the raw trend points; the local route pre-computes the
+ // summary block. Derive it from the last two points; alerts and
+ // per-file deltas are not exposed on hosted and stay empty.
+ const res = await snapGet<WireTrend>(repoId, "/health/trend");
+ const history = (res.points ?? []).slice(-limit).map((p) => ({
+ taken_at: p.taken_at ?? null,
+ hotspot_health: p.hotspot_health,
+ average_health: p.average_health,
+ worst_performer_path: p.worst_performer_path ?? null,
+ worst_performer_score: p.worst_performer_score ?? null,
+ }));
+ const current = history.at(-1);
+ const previous = history.at(-2);
+ return {
+ history,
+ summary: {
+ current_hotspot_health: current?.hotspot_health ?? 0,
+ current_average_health: current?.average_health ?? 0,
+ previous_hotspot_health: previous?.hotspot_health ?? null,
+ previous_average_health: previous?.average_health ?? null,
+ hotspot_delta:
+ current && previous ? current.hotspot_health - previous.hotspot_health : null,
+ average_delta:
+ current && previous ? current.average_health - previous.average_health : null,
+ },
+ alerts: [],
+ file_deltas: [],
+ snapshot_count: history.length,
+ };
+ },
+ getHealthCoverage: (repoId, opts) => snapGet(repoId, "/health/coverage", opts),
+ getRefactoringTargets: (repoId, opts) =>
+ snapGet(repoId, "/health/refactoring-targets", opts as QueryParams),
+ getChurnComplexity: (repoId, opts) => snapGet(repoId, "/health/churn-complexity", opts),
+
+ listModuleHealth: (repoId, options = {}) => snapGet(repoId, "/modules/health", options),
+ getModuleHealth: (repoId, modulePath) =>
+ snapGet(repoId, `/modules/health/${encodeURIComponent(modulePath)}`),
+
+ getC4L1: (repoId) => snapGet(repoId, "/c4/l1"),
+ getC4L2: (repoId) => snapGet(repoId, "/c4/l2"),
+ getC4L3: (repoId, containerId) => snapGet(repoId, "/c4/l3", { container_id: containerId }),
+ getC4Mermaid: async (repoId, level, containerId) => {
+ const params: QueryParams = { level };
+ if (level === 3 && containerId) params.container_id = containerId;
+ return getText(`/snapshots/${await snapshot(repoId)}/c4/mermaid`, params);
+ },
+ getArchitectureView: (repoId, includeSymbols = false) =>
+ snapGet(repoId, "/architecture-view", { include_symbols: includeSymbols }),
+ getArchitecture: (repoId) => snapGet(repoId, "/architecture"),
+ getCommunitySlice: (repoId, communityId) =>
+ snapGet(repoId, `/communities/${communityId}/slice`),
+ getModuleGraph: (repoId) => snapGet(repoId, "/module-graph"),
+ getExecutionFlows: (repoId, params) => snapGet(repoId, "/execution-flows", params),
+ getCoupling: (repoId, opts) => snapGet(repoId, "/coupling", opts),
+
+ async getFilesIndex(repoId): Promise<FilesIndexResponse> {
+ // Same rows, different envelope: hosted totals/language_counts vs the
+ // local total/languages.
+ const res = await snapGet<WireFilesIndex>(repoId, "/files");
+ return {
+ files: res.files ?? [],
+ total: res.totals?.files ?? (res.files ?? []).length,
+ languages: Object.entries(res.language_counts ?? {}).map(([language, count]) => ({
+ language,
+ count,
+ })),
+ };
+ },
+ getFileDetail: (repoId, filePath) => snapGet(repoId, "/files/detail", { path: filePath }),
+ getSymbolDetail: (repoId, symbolId) =>
+ snapGet(repoId, "/symbols/detail", { symbol_id: symbolId }),
+
+ async getDocsStatus(repoId): Promise<HostedDocsStatus> {
+ const docs = await getDocs(repoId);
+ return {
+ available: docs.available,
+ docs_status: docs.docs_status ?? null,
+ pages_ready: docs.pages_ready ?? 0,
+ pages_total: docs.pages_total ?? null,
+ };
+ },
+ async listPages(repoId, opts): Promise<PageResponse[]> {
+ let pages = await loadPages(repoId);
+ if (opts?.page_type) pages = pages.filter((p) => p.page_type === opts.page_type);
+ const offset = opts?.offset ?? 0;
+ if (offset || opts?.limit !== undefined) {
+ pages = pages.slice(offset, opts?.limit !== undefined ? offset + opts.limit : undefined);
+ }
+ return pages;
+ },
+ async listAllPages(repoId, opts): Promise<PageResponse[]> {
+ const pages = await loadPages(repoId);
+ return opts?.page_type ? pages.filter((p) => p.page_type === opts.page_type) : pages;
+ },
+ async getPageById(pageId, repoId): Promise<PageResponse> {
+ const pools = repoId
+ ? [await loadPages(repoId)]
+ : Array.from(pagesBySnapshot.values());
+ for (const pool of pools) {
+ const hit = pool.find((p) => p.id === pageId);
+ if (hit) return hit;
+ }
+ throw new ApiClientError(404, `Page not found: ${pageId}`);
+ },
+
+ async listDecisions(repoId, opts): Promise<DecisionRecordResponse[]> {
+ const res = await snapGet<WireDecisions>(repoId, "/decisions", opts);
+ return (res.decisions ?? []) as unknown as DecisionRecordResponse[];
+ },
+ async listDeadCode(repoId, opts): Promise<DeadCodeFindingResponse[]> {
+ // Hosted paginates but does not filter; filters apply client-side over
+ // the full report so semantics match the local server.
+ const res = await snapGet<WireDeadCode>(repoId, "/dead-code", { limit: 500 });
+ let findings = (res.findings ?? []).map(mapHostedDeadCodeFinding);
+ if (opts?.kind) findings = findings.filter((f) => f.kind === opts.kind);
+ if (opts?.min_confidence !== undefined) {
+ findings = findings.filter((f) => f.confidence >= (opts.min_confidence as number));
+ }
+ if (opts?.status) findings = findings.filter((f) => f.status === opts.status);
+ if (opts?.safe_only) findings = findings.filter((f) => f.safe_to_delete);
+ return opts?.limit !== undefined ? findings.slice(0, opts.limit) : findings;
+ },
+ getHotspotsPage: (repoId, options = {}) => {
+ const { limit = 50, offset = 0 } = options;
+ return snapGet(repoId, "/hotspots", { limit, offset });
+ },
+ async getHotspots(repoId, limit = 50): Promise<HotspotResponse[]> {
+ const page = await snapGet<Paginated<HotspotResponse>>(repoId, "/hotspots", { limit });
+ return page.items;
+ },
+ getCoChanges: (repoId, filePath, minCount = 3) =>
+ snapGet(repoId, "/co-changes", { file_path: filePath, min_count: minCount }),
+ getGitSummary: (repoId, topOwnersLimit) =>
+ snapGet(
+ repoId,
+ "/git-summary",
+ topOwnersLimit ? { top_owners_limit: topOwnersLimit } : undefined,
+ ),
+
+ async search(query, opts): Promise<SearchResultResponse[]> {
+ if (!opts?.repo_id) {
+ throw new ApiClientError(400, "Hosted search requires a repo_id");
+ }
+ const sid = await snapshot(opts.repo_id);
+ const res = await post<WireSearch>(`/snapshots/${sid}/search`, {
+ query,
+ limit: opts.limit ?? 10,
+ });
+ return (res.results ?? []).map(mapHostedSearchResult);
+ },
+
+ triggerReindex: (repoId, opts) =>
+ post(`/repos/${repoId}/reindex`, {
+ generate_docs: opts?.generate_docs ?? false,
+ ...(opts?.docs_file_percentage !== undefined
+ ? { docs_file_percentage: opts.docs_file_percentage }
+ : {}),
+ }),
+ getSnapshotStatus: (snapshotId) => get(`/snapshots/${snapshotId}`),
+ };
+}
diff --git a/packages/api-client/tsconfig.json b/packages/api-client/tsconfig.json
index 0ecff06fc..c0c29a253 100644
--- a/packages/api-client/tsconfig.json
+++ b/packages/api-client/tsconfig.json
@@ -15,7 +15,7 @@
"declaration": true,
"declarationMap": true,
"noEmit": true,
- "types": ["vitest/globals"],
+ "types": ["vitest/globals", "node"],
"paths": {
"@repowise-dev/types": ["../types/src/index.ts"],
"@repowise-dev/types/*": ["../types/src/*"],