Skip to content

v0.1.10

Choose a tag to compare

@apstndb apstndb released this 16 May 15:32
3b3bcc1

Patch release for the rendering-helper and scalar-appendix work merged after v0.1.9.

Added

  • Added the public treerender package for generic ASCII tree rendering.
    • Provides Render, RenderTree, and RenderTreeWithOptions.
    • Provides DefaultStyle and CompactStyle.
    • Supports wrapping through RenderOptions.WrapWidth.
    • Supports continuation indentation modes including fixed-prefix and anchor-based hanging indentation.
    • Exposes Row.Text, Row.TreePartLines, PrefixMetrics, and related helpers for callers that need stable tree-prefix handling.
  • Added the public asciitable package for aligned table and appendix rendering.
    • Provides RenderTable with typed TableSpec and Column definitions.
    • Provides RenderAppendix with typed AppendixSpec definitions.
    • Supports left, right, and center alignment.
    • Preserves multiline table cells without wrapping them unexpectedly.
  • Added examples/pgexplainjson, a dependency-free PostgreSQL EXPLAIN (ANALYZE, FORMAT JSON) renderer that demonstrates the generic treerender and asciitable helpers.
    • Supports compact tree output.
    • Supports total-width wrapping.
    • Generates preorder IDs for PostgreSQL plans, which do not provide stable plan-node IDs.
  • Added scalar child-link accessors and documentation in plantree.
    • RowWithPredicates.TreePartLines exposes tree prefixes as one line per rendered node-text line.
    • RowWithPredicates.ScalarChildLinks preserves scalar child links in original PlanNode.ChildLinks order.
    • ScalarChildLink carries child index, type, variable, description, and the scalar child node.
    • RowWithPredicates.Keys and RowWithPredicates.ChildLinks remain populated as compatibility mirrors.
  • Added scalar appendix controls to cmd/rendertree.
    • --print=predicates,ordering,aggregate selects semantic appendix sections.
    • --print=typed prints all typed scalar links as a raw debug dump.
    • --print=full prints all scalar links, including unnamed links, as a raw debug dump.
    • --print="" suppresses appendix output.
    • --show-vars shows scalar assignment variable names.
    • --resolve-vars resolves direct scalar variable aliases.
    • --resolve-vars-recursive recursively expands scalar variable aliases for investigation.
  • Added scalar appendix controls to plantree/reference.
    • Added PrintSection, PrintSections, ParsePrintSection, and ParsePrintSections.
    • Added WithPrintSections, WithShowScalarVars, WithResolveScalarVars, and WithResolveScalarVarsRecursive.
    • Extended RenderConfig with PrintSections, ShowScalarVars, ResolveScalarVars, and ResolveScalarVarsRecursive.
    • RenderConfig.PrintSections distinguishes omitted/null config from an explicit empty list, so JSON [] can intentionally suppress appendices.
  • Added the shared internal internal/scalarappendix package used by both cmd/rendertree and plantree/reference.
    • Centralizes scalar appendix parsing, validation, rendering, and scalar variable resolution.
    • Keeps public packages as facades rather than exposing internal symbols.
  • Added Gemini review style-guide guidance to avoid readability-reducing micro-optimizations and to treat JSON tags as API design choices.

Changed

  • cmd/rendertree now reuses the shared scalar appendix implementation instead of carrying its own separate section parsing and rendering logic.
  • plantree/reference now renders appendices through the shared scalar appendix implementation.
  • asciitable appendix rendering was generalized beyond predicates through AppendixSpec and RenderAppendix.
  • treerender is now public instead of only being available under an internal package.
  • The unreleased predicate-specific asciitable compatibility API from the development branch was replaced by the more general appendix API before release.
  • treerender hanging-indent validation now requires GetContinuationAnchor only when wrapping is active.
  • The golangci-lint GitHub Actions workflow is pinned to a concrete v2 release.
  • Local review scratch files are ignored by git.

Fixed

  • WithHangingIndent and RenderConfig{HangingIndent: true} no longer fail when no wrap width is configured; without wrapping, hanging indent is a no-op.
  • Empty print-section strings now parse as an explicit empty section list, allowing callers to suppress appendix output.
  • Scalar appendix JSON config preserves explicit empty printSections slices while still treating omitted/null as the default predicate appendix.

Merged PRs

  • #39: feat: expose generic render helpers
  • #40: feat: add scalar appendix sections
  • #41: refactor: share scalar appendix rendering

Validation

  • go test ./...
  • mise x -- golangci-lint run --timeout=5m
  • git diff --check v0.1.9..origin/main