Skip to content

Conversation

Copy link

Copilot AI commented Nov 2, 2025

Implements a command-line tool for querying CSV files using SQL syntax, runnable via npx csvsqlcli.

Implementation

Core Components

  • CSV parser with automatic numeric type detection
  • SQL query engine supporting SELECT, WHERE (=, !=, <, >, <=, >=, LIKE), AND/OR, ORDER BY, LIMIT
  • CLI with three commands: query, info, interactive (placeholder)
  • Output formats: table (default), JSON, CSV

Security

  • Replaced complex regex patterns with indexOf-based parsing to eliminate ReDoS vulnerabilities
  • Query length validation (10KB limit)
  • Escaped regex metacharacters in LIKE patterns

Type Safety

  • Strict TypeScript configuration
  • Explicit types throughout (no any)
  • Exported QueryResult interface for library usage

Usage

# Query with filtering and ordering
npx csvsqlcli query data.csv "SELECT name, salary FROM employees WHERE salary > 70000 ORDER BY salary DESC LIMIT 5"

# JSON output
npx csvsqlcli query data.csv "SELECT * FROM data WHERE status = 'active'" --format json

# File info
npx csvsqlcli info data.csv

Testing

17 unit tests covering CSV parsing and SQL operations. Package includes .npmignore and files configuration for NPM publication.

Original prompt

It's a NPX project for querying data from CSV files in CLI


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 4 commits November 2, 2025 14:10
Co-authored-by: tarsislimadev <69215425+tarsislimadev@users.noreply.github.com>
Co-authored-by: tarsislimadev <69215425+tarsislimadev@users.noreply.github.com>
Co-authored-by: tarsislimadev <69215425+tarsislimadev@users.noreply.github.com>
Co-authored-by: tarsislimadev <69215425+tarsislimadev@users.noreply.github.com>
Copilot AI changed the title [WIP] Add CSV querying capabilities for NPX project Implement NPX-based CSV SQL query CLI tool Nov 2, 2025
Copilot AI requested a review from tarsislimadev November 2, 2025 14:26
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.

2 participants