Skip to content

Return clickable file:// locations for generated HTML/PDF reports - #24

Merged
YashvantHange merged 1 commit into
feat/auto-html-modern-reportfrom
feat/report-file-links
Jul 18, 2026
Merged

Return clickable file:// locations for generated HTML/PDF reports#24
YashvantHange merged 1 commit into
feat/auto-html-modern-reportfrom
feat/report-file-links

Conversation

@YashvantHange

Copy link
Copy Markdown
Owner

What & why

The report tools write files to disk but only surface a bare path string, so a user has to hunt the path down and open it manually. This makes each generated file's location a clickable file:// link — for the HTML and the PDF — so clicking it opens the file in the default app (browser for HTML, viewer for PDF). Nothing opens on its own; the file opens on click.

Stacked on #23 (base = feat/auto-html-modern-report) because it builds on that branch's html_report_path plumbing. Retarget to main once #23 merges.

Changes

  • export.py — one helper file_url(path) = absolute, percent-escaped file:///… (reused by the headless-Chrome loader, so a click opens exactly the file that was written). save_html/save_pdf unchanged — no side effects.
  • models.py — new ExportedFile; ExportResult gains file_url + a files list (a PDF export lists both the pdf and its html sidecar); AnalysisReport gains html_report_url.
  • server.pyanalyze_company's auto-HTML records html_report_url; export_report returns file_url + files for html and pdf.
  • cli.pyinvesto analyze prints the clickable file:// URL for every written artifact (and the html sidecar's URL for --pdf). No --no-open flag — nothing auto-opens.

Verification

  • ruff check ., mypy, pytest -q — all green (285 tests; added file_url + URL-surfacing coverage).
  • Live CLI run confirmed the output, e.g.:
    Wrote PDF report to …\rel_links.pdf  (chrome.exe (headless))
      Open: file:///C:/…/rel_links.pdf
      HTML: file:///C:/…/rel_links.html
    
  • Clicking a printed file:// link opens the report in the default app.

Surface each generated report as a clickable file:// URL so it opens in the
default app on click — for the HTML and the PDF alike.

- export.file_url(path): one absolute, percent-escaped file:// URL builder,
  reused by the headless-Chrome loader so a click opens exactly what was written.
- models: new ExportedFile; ExportResult gains file_url + files (a PDF export
  lists both the pdf and its html sidecar); AnalysisReport gains html_report_url.
- server: analyze_company's auto-HTML records html_report_url; export_report
  returns file_url + files for html and pdf.
- cli: analyze prints the clickable file:// URL for every written artifact
  (plus the html sidecar location for --pdf).

Nothing opens on its own — the file opens when the user clicks the link.
@YashvantHange
YashvantHange merged commit 84022be into feat/auto-html-modern-report Jul 18, 2026
6 checks passed
@YashvantHange
YashvantHange deleted the feat/report-file-links branch July 18, 2026 17:59
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.

1 participant