Skip to content

feat: add self-contained HTML output for gaze analyze #260

Closed

Description

@yvonnedevlinrh

Summary

Implement the shared, self-contained HTML output foundation and make it available through gaze analyze --format=html.

This delivers the first HTML report while establishing the rendering, styling, and test patterns needed by future HTML support for gaze quality, gaze crap, and gaze report.

Why

Gaze currently provides terminal text and JSON output. Text is concise but difficult to share and inspect interactively, while JSON is machine-oriented. A single-file HTML report provides a portable human-readable artifact for local review and CI uploads without requiring a web server, external assets, or additional dependencies.

The repository architecture already describes internal/report/ as including an HTML formatter stub, but no HTML formatter or --format=html value exists.

Scope

  • Add a shared HTML rendering path in internal/report/, implemented with Go's html/template.
  • Generate a complete single-file HTML document with inline CSS and no external network resources.
  • Add html to the supported output formats.
  • Wire gaze analyze --format=html to render analysis results.
  • Present functions and their detected side effects in navigable, collapsible sections.
  • Escape all report data through html/template; do not interpolate source-derived data into raw HTML.
  • Add deterministic formatter and CLI integration tests.

Acceptance Criteria

  • gaze analyze --format=html <package> produces a complete HTML document.
  • The document contains every function and side effect represented by the analyze result.
  • Function sections are collapsible without loading external JavaScript or stylesheets.
  • The output contains no external <link>, <script src>, or other remote asset references.
  • Source-derived content, including function names, file paths, and effect details, is HTML-escaped.
  • Existing text and json output behavior remains unchanged.
  • Tests cover successful rendering, escaping, self-containment, and CLI format selection.

Non-Goals

  • HTML output for gaze quality, gaze crap, or gaze report.
  • Introducing a web server, asset pipeline, CSS framework, or third-party dependency.
  • Changing analysis, classification, scoring, or existing text/JSON report contracts.

Implementation Notes

  • Use html/template, not text/template.
  • Prefer native HTML elements such as <details> and <summary> over custom JavaScript for collapsible content.
  • Implementation requires the project’s spec-first workflow before code changes.

Activity

  1. added
    enhancement
    on Sep 15, 2026
  2. fullsend-ai-triage commented on Sep 15, 2026

    @fullsend-ai-triage

    🤖 Finished Triage · ✅ Success · Started 8:37 AM UTC · Completed 8:42 AM UTC

    Commit: ec204ea · View workflow run →

    Runtime: claude · Model: opus → claude-opus-4-6 · Effort: high · Cost: $1.03

  3. fullsend-ai-triage commented on Sep 15, 2026

    @fullsend-ai-triage

    Triage Summary

    Severity: medium · Category: feature

    This is a well-specified feature request. The internal/report/ package already has json.go and text.go — adding html.go follows the established pattern.

    Related Issues

    Implementation Notes

    Per project conventions, a spec-first workflow (speckit pipeline) is required before code changes. Key implementation points:

    • Add html.go in internal/report/ using html/template (not text/template)
    • Use <details>/<summary> for collapsible sections — no JS needed
    • Inline all CSS; zero external resources
    • Register html as a valid format value in internal/cliutil/
    • All source-derived data must flow through html/template auto-escaping

    Proposed Test Cases

    func TestWriteHTML_RendersCompleteDocument(t *testing.T) {
        results := []taxonomy.AnalysisResult{
            {FuncName: "DoWork", Effects: []taxonomy.SideEffect{{Type: taxonomy.FileWrite}}},
        }
        var buf bytes.Buffer
        err := report.WriteHTML(&buf, results)
        if err != nil {
            t.Fatalf("WriteHTML: %%v", err)
        }
        html := buf.String()
        if !strings.Contains(html, "<!DOCTYPE html>") {
            t.Error("missing DOCTYPE")
        }
        if !strings.Contains(html, "DoWork") {
            t.Error("missing function name")
        }
        if strings.Contains(html, "<link") || strings.Contains(html, "<script src") {
            t.Error("contains external resource references")
        }
    }
    
    func TestWriteHTML_EscapesSourceDerivedContent(t *testing.T) {
        results := []taxonomy.AnalysisResult{
            {FuncName: "Foo<script>alert(1)</script>"},
        }
        var buf bytes.Buffer
        _ = report.WriteHTML(&buf, results)
        if strings.Contains(buf.String(), "<script>alert") {
            t.Error("source-derived content not escaped")
        }
    }

    Next steps:

    • /fs-code — agent creates a PR to implement this issue
    • /fs-code <your instruction> — agent implements with your specific guidance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementfeaturetriaged

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions