Code Health API
Octokraft continuously scores your codebase across 8 categories: security, runtime risks, test coverage, code smells, duplication, dead code, codebase consistency, and compliance. The Code Health API provides access to assessments, drift alerts, and the underlying analysis issues.Get Health Dashboard
Returns the comprehensive health dashboard for a project, including the latest assessment, trend data, drift alerts, codebase dynamics, convention consistency, and test quality metrics.List Assessments
Returns paginated assessment summaries for a project, ordered by creation date (newest first).Get Assessment
Returns a full assessment by ID with all category scores and metrics.Assessment Fields
| Field | Type | Description |
|---|---|---|
overall_score | number | Weighted average of all category scores (0-100) |
overall_grade | string | Letter grade: A, B, C, D, or F |
*_score | number | Per-category scores (0-100) |
critical_count … info_count | integer | Issue counts by severity |
total_lines_of_code | integer | Total lines of code in the project |
test_lines_of_code | integer | Lines of test code |
structural_coverage_pct | number | Structural test coverage percentage |
trigger_type | string | manual, push, pr_merge, or scheduled |
status | string | pending, running, completed, or failed |
Trigger Assessment
Triggers a new health assessment. The assessment runs asynchronously.List Drift Alerts
Returns drift alerts for a project. Drift alerts are generated when health scores change significantly between assessments.Drift Alert Fields
| Field | Type | Description |
|---|---|---|
drift_type | string | score, coverage, convention, or churn |
category | string | The health category affected |
previous_value | number | Value from the previous assessment |
current_value | number | Value from the current assessment |
change | number | Delta between assessments |
Dismiss Drift Alert
Dismisses a drift alert so it no longer appears in active alerts.List Issues
Returns analysis issues for a project with optional filters. Issues are findings from static analyzers, AI analysis, graph rules, and convention checks.Query Parameters
| Parameter | Type | Description | |
|---|---|---|---|
severity | string | Filter by severity: critical, high, medium, low, info | |
severities | string | Comma-separated list of severities (OR filter) | |
category | string | Filter by category: security, runtime, testing, code_smell, dead_code, duplication, consistency, compliance | |
source | string | Filter by source: static_analyzer, llm_agent, graph_rule, convention, architecture | |
is_dismissed | boolean | Filter dismissed/active issues | |
context_type | string | Filter by analysis context: pr_analysis, health_assessment, architecture_review, push | |
context_id | string | Filter by specific analysis run context | |
sort_by | string | Sort by: severity, file_path, category, created_at | |
limit | integer | Items per page | 50 |
offset | integer | Number of items to skip | 0 |
Get Issue Statistics
Returns aggregate issue counts for a project, grouped by category, severity, and source.Dismiss Issue
Dismisses an issue with an action and optional reason. Creates a dismiss rule to suppress future matches.Request Body
| Field | Type | Required | Description |
|---|---|---|---|
action | string | no | dismiss, false_positive, or wont_fix. Defaults to dismiss. |
reason | string | no | Human-readable reason for dismissing |
Restore Issue
Restores a previously dismissed issue back to active status.List Dismiss Rules
Returns all dismiss rules configured for a project. Dismiss rules automatically suppress matching issues.Create Dismiss Rule
Creates a new dismiss rule that automatically suppresses matching issues.Request Body
| Field | Type | Required | Description |
|---|---|---|---|
rule_pattern | string | yes | Pattern to match against issue rule IDs or titles |
source_type | string | no | Restrict to a specific source: static_analyzer, llm_agent, graph_rule, convention, architecture |
secondary_pattern | string | no | Additional pattern for finer matching |
scope | string | no | global, project, or file. Defaults to global. |
file_path | string | no | File path or glob pattern (required when scope is file) |
action | string | no | dismiss, false_positive, or wont_fix. Defaults to dismiss. |
reason | string | no | Human-readable reason |
Delete Dismiss Rule
Removes a dismiss rule. Previously suppressed issues will reappear as active.204 No Content on success.