Skip to content

Remove pdf#73

Merged
moshloop merged 8 commits intomainfrom
remove-pdf
Jan 27, 2026
Merged

Remove pdf#73
moshloop merged 8 commits intomainfrom
remove-pdf

Conversation

@moshloop
Copy link
Copy Markdown
Member

@moshloop moshloop commented Jan 27, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Added column-based table formatting with customizable labels, styles, and visibility controls.
    • Introduced TableProvider interface for flexible data rendering with better control over column definitions.
    • Enhanced task UI with improved interactive rendering.
    • Added JSON and YAML serialization support for tables.
    • Improved alignment parsing with new constants and public API.
  • Improvements

    • Optimized data processing with early typed-value detection.
    • Enhanced CSV formatter with dedicated table and data formatting methods.
  • Dependencies

    • Updated to latest Bubble Tea and terminal libraries for improved UI rendering.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 27, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces column-based table abstraction with ColumnDef and TableProvider interface, adds reflection-based type resolution with early short-circuit handling, refactors alignment handling to new Alignment type, replaces task rendering with Bubble Tea-based interactive UI, and refactors CSV formatter to separate concerns.

Changes

Cohort / File(s) Summary
Column-based table abstraction
aliases.go, api/column.go, api/column_test.go
Introduces ColumnDef struct with metadata (Name, Label, Style, MaxWidth, Hidden), ColumnBuilder fluent constructor, TableProvider interface requiring Columns() and Row(), and generic NewTableFrom function to build TextTable from provider implementations. Includes comprehensive tests for builder chaining and table generation.
Type resolution & marshaling
api/meta.go, api/meta_test.go
Adds reflection-based slice detection in TryTypedValue to auto-wrap slices into appropriate typed values, introduces PrettyData.IsEmpty() method, adds TextTable.MarshalJSON() and MarshalYAML() serialization methods, and includes extensive tests for conversion paths and marshaling.
Parser early typed-value resolution
api/parser.go, formatters/parser.go
Implements pre-processing step in ParseDataWithSchema and ToPrettyDataWithOptions to call TryTypedValue early, bypassing further processing when typed values are detected, reducing unnecessary reflection.
Alignment type refactoring
api/tailwind/alignment.go, api/tailwind/alignment_test.go, api/tailwind/parsers_test.go
Replaces internal align.Type with new public Alignment type (Left, Right, Center, Top, Bottom, Middle, Justify constants), updates stringToHorizontalAlign to return Alignment, and exposes DefaultAlignmentParser and ParseAlignment() as public API. Tests updated to use new Alignment type.
CSV formatter refactoring
formatters/csv_formatter.go, formatters/manager.go
Modifies Format signature to accept FormatOptions parameter, adds FormatTable() and FormatPrettyData() methods to separate table/data formatting concerns, adds package init registration, and routes CSV formatting through generic Format method with explicit options.
HTML formatter empty data handling
formatters/html_formatter.go
Replaces nil checks with PrettyData.IsEmpty() calls in Format and FormatPrettyData to determine early exit conditions.
Task rendering refactored to Bubble Tea
task/manager.go, task/model.go, task/group.go, task/task.go, task/render.go, task/render_test.go
Replaces previous render loop mechanism with Bubble Tea program lifecycle (startProgram/stopProgram), introduces taskModel implementing tea.Model for interactive rendering, conditionally starts plain render loop for non-interactive mode, removes interactive renderer code, and adds tests validating render output line counts and dirty task filtering.
Example app TableProvider & task demos
examples/uber_demo/main.go
Implements EmployeeTable with Columns() and Row() methods per TableProvider interface, adds showTableProvider() and showTasks() handlers demonstrating new APIs, introduces TasksOptions and TableProviderOptions types, and registers new commands table-provider and tasks.
Dependency updates
go.mod, examples/go.mod, examples/uber_demo/go.mod
Substantial refresh of UI libraries: replaces lipgloss/x/ansi with Bubble Tea v1.3.10 and lipgloss v1.1.0, updates termenv to v0.16.0, adds terminal support modules (muesli/ansi, muesli/cancelreader, xo/terminfo, x/* modules), removes older PDF and tree libraries (pdfcpu, johnfercher/go-tree).
PDF test cleanup
formatters/pdf/unicode_test.go, formatters/pdf/utils_test.go
Removes extensive Unicode PDF rendering tests (unicode_test.go entirely deleted) and PDF text extraction utilities (ExtractTextFromPDF, ExtractTextFromPage, PDF-related assertions removed from utils_test.go), retaining only SVG and file I/O helpers.

Sequence Diagrams

sequenceDiagram
    participant Client
    participant ColumnBuilder
    participant TableProvider
    participant NewTableFrom
    participant TextTable
    participant Field as PrettyField

    Client->>ColumnBuilder: Column("name").Label("N").Style("bold")...
    ColumnBuilder-->>ColumnBuilder: Label/Style/Format/etc chaining
    ColumnBuilder->>TableProvider: Build() -> ColumnDef
    Client->>NewTableFrom: NewTableFrom([item1, item2])
    NewTableFrom->>TableProvider: item.Columns() -> []ColumnDef
    NewTableFrom->>Field: Create PrettyField from ColumnDef
    NewTableFrom->>TableProvider: item.Row() -> map[string]any
    NewTableFrom->>TextTable: Populate headers & rows
    TextTable-->>Client: Rendered table with styled columns
Loading
sequenceDiagram
    participant Manager
    participant Tea as BubbleTea Program
    participant taskModel
    participant View as UI Renderer
    participant Task

    Manager->>Manager: Check noProgress flag
    alt Interactive Mode
        Manager->>Tea: startProgram(newTaskModel)
        Tea->>taskModel: Init()
        taskModel-->>taskModel: Start ticker (250ms)
    else Non-Interactive Mode
        Manager->>Manager: Start plainRenderLoop
    end
    
    Task->>Manager: Update task state
    alt Interactive Mode
        taskModel->>taskModel: Update(tickMsg/WindowSize/etc)
        taskModel->>View: View()
        View->>Manager: Get Pretty() output
        View-->>View: Apply color & height constraints
        View-->>Tea: Render to screen
    else Non-Interactive Mode
        Manager->>Manager: PlainRender() on ticker
    end
    
    Manager->>Tea: stopProgram() on shutdown
    Tea->>taskModel: shutdown signal
    taskModel-->>Tea: Quit
Loading

Possibly related PRs

  • feat: slack blocks formatter #59: Introduces same TryTypedValue pre-check in ParseDataWithSchema to enable early typed-value resolution before standard table handling
  • fix: lint #60: Modifies TryTypedValue reflection logic in api/meta.go to add slice detection and type assertion capabilities
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch remove-pdf

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@moshloop moshloop merged commit fd87d74 into main Jan 27, 2026
10 checks passed
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.16.0

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant