Skip to content

feat(builtins): add csv builtin (qsv-inspired CSV utilities) #564

@chaliy

Description

@chaliy

Goal

Add native CSV/TSV handling for common data workflows that are awkward with pure awk or jq.

Proposal

Add a focused csv builtin inspired by qsv/xsv, optimized for the operations agents and scripts hit most often.

Initial subcommands

  • csv headers <file>
  • csv select <cols> <file>
  • csv to-json <file>
  • csv from-json <file>
  • csv sort <col> <file>
  • csv join <left-col> <right-col> <left> <right>
  • csv stats <file>

Format support

  • CSV first
  • TSV via delimiter flag
  • stdin/stdout friendly
  • proper quoting / escaping / embedded commas / newlines

Why this shape

A CSV-specific builtin covers the common structured-tabular workflows without pulling in the full surface area of a tool like Miller. For more complex transforms, users can compose csv to-json | jq ... | csv from-json.

Non-goals

  • full spreadsheet language
  • trying to clone every mlr feature in v1

Tests

  • quoted cells
  • escaped quotes
  • delimiter override
  • headerless mode
  • join on missing keys
  • malformed CSV errors
  • JSON round-trip compatibility

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions