Skip to content

feat(report): findings report — Markdown + styled HTML#99

Open
aktasbatuhan wants to merge 3 commits into
masterfrom
kai/report
Open

feat(report): findings report — Markdown + styled HTML#99
aktasbatuhan wants to merge 3 commits into
masterfrom
kai/report

Conversation

@aktasbatuhan

@aktasbatuhan aktasbatuhan commented Jun 8, 2026

Copy link
Copy Markdown
Member

Stacked on #98 (kai/view) — reuses kai.viewer.findings + the shared kai.viewer.style design system. Retarget to master once #98 merges.

What this does

The deliverable surface for findings, in the format you need — the counterpart to the interactive kai view:

  • kai report <run>Markdown (default). Pipe into CI, paste in a PR, read in a terminal; renders in GitHub's style.
  • kai report --format html <run> [-o OUT] [--open] → a styled single-page HTML document, rendered with the viewer's own Tufte design tokens (kai.viewer.style) — same palette, severity dots, CVSS tables, and +/- patch diff as kai view, so the surfaces never drift. Unlike the interactive viewer (master-detail + trace tabs), this is a linear, fully-expanded document meant to print / attach / share. Static HTML, all dynamic values escaped server-side.

Both formats: sorted summary table (confirmed/critical first) + per-finding sections (facts, why-exploitable, exploit sketch, CVSS 3.1 breakdown, PoC, patch). --format scales to sarif / json later (e.g. GitHub code-scanning).

Verification

  • ty / ruff clean; pytest 585 passed, 6 skipped (7 report tests, incl. HTML self-contained + shared-tokens assertions).

Follow-up

Wire kai report / kai report --format html as real subcommands in the packaging/CLI PR (alongside kai view).

@aktasbatuhan aktasbatuhan changed the title feat(report): Markdown findings report (kai report) feat(report): findings report — Markdown + styled HTML Jun 8, 2026
@aktasbatuhan aktasbatuhan requested a review from andthattoo June 9, 2026 08:33
@eren23

eren23 commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

this one lgtm

andthattoo
andthattoo previously approved these changes Jun 9, 2026
The no-browser companion to kai.viewer: same on-disk source
(<run_dir>/exploits.json) rendered as a plain-text Markdown report you
can pipe into CI, paste into a PR, or read over SSH.

- render_markdown(): a sorted summary table (confirmed/critical first)
  plus per-finding sections -- facts, why-exploitable, exploit sketch,
  CVSS 3.1 breakdown table, fenced PoC, and the patch as a ```diff
- render_run(): load a run dir's findings and render
- python -m kai.report <run_dir> [-o OUT] (stdout by default)

Reuses kai.viewer.findings.load_findings; no live state backend.
kai report --format html renders a self-contained, fully-expanded report
document that shares the viewer's design system (kai.viewer.style) -- same
palette, severity dots, CVSS tables, and +/- patch diff as kai view, so the
two surfaces never drift. Markdown stays the default (-f md); --open opens
the rendered file.

Unlike the interactive viewer (master-detail + trace tabs), this is a linear
document meant to be printed, attached, or shared. Static HTML with all
dynamic values escaped server-side. --format scales to sarif/json later.
Match the viewer fix (#98): 'kai report -o some/new/dir/report.md' (and
--format html) now mkdir the parent instead of raising FileNotFoundError.
@aktasbatuhan aktasbatuhan changed the base branch from kai/view to master June 9, 2026 16:07
@aktasbatuhan aktasbatuhan dismissed andthattoo’s stale review June 9, 2026 16:07

The base branch was changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants