Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,17 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20, 22]
python-version: ["3.11", "3.12"]
steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: npm ci
- run: npm test
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install package and test deps
run: |
python -m pip install --upgrade pip
pip install -e ".[dev]"
- name: Run tests
run: pytest
24 changes: 16 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.DS_Store
*.tgz
coverage/
.nyc_output/
__pycache__/
*.py[cod]
*$py.class
*.egg-info/
.eggs/
dist/
build/
.pytest_cache/
.mypy_cache/
.ruff_cache/
.coverage
htmlcov/
.venv/
venv/
.env
.DS_Store
.idea/
.vscode/
*.egg
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@

## Setup

- Use Node 20 or newer
- Install dependencies with the package manager
- Run the test script from package.json
- Use Python 3.11 or newer
- Install with `pip install -e ".[dev]"`
- Run tests with `pytest`

## Guidelines

- Keep the CLI ESM-only (type module).
- Keep the public CLI entry as the `data-transform` console script.
- Prefer small, focused changes with tests for round-trips and edge cases.
- Do not add company names or personal contacts in committed files.
- Match existing style: errors on stderr, exit code 1 on failure, UTF-8 I/O.
- Match existing style: errors on stderr as `error: …`, exit code 1 on failure, UTF-8 I/O.

## Pull requests

1. Fork and branch from main.
2. Add or update tests under test/.
3. Ensure the test script passes.
2. Add or update tests under `tests/`.
3. Ensure `pytest` passes.
4. Open a PR with a short summary of the change and why.
55 changes: 15 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
# data-transform-cli

Node.js ESM CLI for **YAML ↔ JSON ↔ CSV** transforms. Built for shell pipelines and local scripts.
Python CLI for **YAML ↔ JSON ↔ CSV** transforms. Built for shell pipelines and local scripts.
Streaming-friendly where practical (stdin/stdout; full documents buffered for parse safety).

Requires **Node.js 20+**.
Requires **Python 3.11+**.

## Install

```bash
npm install -g .
# or run without installing:
npx --yes . to-json ./data.yaml
pip install -e .
# or with test extras:
pip install -e ".[dev]"
```

From a clone of this repo:

```bash
npm install
npm link # optional: exposes data-transform on your PATH
```
After install, the `data-transform` console script is on your `PATH`.

## Commands

Expand Down Expand Up @@ -63,46 +58,26 @@ printf "a: 1\n" | data-transform to-json -f yaml

### Library use

```js
import { convert, parse, serialize } from "data-transform-cli";
```python
from data_transform import convert, parse, serialize

const yaml = convert("{\"a\":1}", "json", "yaml");
const data = parse("id,name\n1,x\n", "csv");
const json = serialize(data, "json", { pretty: true });
yaml_text = convert('{"a":1}', "json", "yaml")
data = parse("id,name\n1,x\n", "csv")
json_text = serialize(data, "json", pretty=True)
```

## CSV notes

CSV support is intentionally small and robust (RFC 4180-ish): quoted fields, escaped quotes (`""`), and newlines inside quotes. Object arrays use a header row; all cell values are strings when parsed from CSV.
CSV support is intentionally small and robust (RFC 4180-ish) via the Python standard library `csv` module: quoted fields, escaped quotes (`""`), and newlines inside quotes. Object arrays use a header row; all cell values are strings when parsed from CSV.

## Development

```bash
npm install
npm test
pip install -e ".[dev]"
pytest
```

Tests use Node built-in `node:test` runner with fixtures under `test/fixtures/` for JSON/YAML/CSV round-trips and CLI smoke checks.

## Extending with coding agents

### GitHub Copilot

- Open this repo in VS Code / JetBrains with Copilot enabled.
- Prefer asking Copilot to follow existing modules (`src/convert.js`, `src/csv.js`) and to add `node:test` cases beside fixtures.
- Optional: add workspace guidance under `.github/copilot-instructions.md`.

### Claude Code

- From the repo root, open the folder in Claude Code (or its CLI).
- Point it at `CONTRIBUTING.md` and ask for a failing test first, then implementation.
- Keep changes ESM-compatible and avoid adding heavy CSV libraries unless needed.

### OpenAI Codex

- Open the project in Codex with this directory as the workspace.
- Ask for command-level changes (`to-json`, `to-csv`, ...) and matching CLI tests in `test/cli.test.js`.
- Remind the agent: no company names, no personal contacts, no generator authorship comments in committed files.
Tests use **pytest** with fixtures under `tests/fixtures/` for JSON/YAML/CSV round-trips and CLI smoke checks.

## License

Expand Down
57 changes: 0 additions & 57 deletions package-lock.json

This file was deleted.

46 changes: 0 additions & 46 deletions package.json

This file was deleted.

35 changes: 35 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[build-system]
requires = ["setuptools>=68", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "data-transform-cli"
version = "0.1.0"
description = "CLI for YAML ↔ JSON ↔ CSV transforms for pipelines and shell use"
readme = "README.md"
license = { text = "MIT" }
requires-python = ">=3.11"
authors = [{ name = "rmkr-dev" }]
keywords = ["cli", "yaml", "json", "csv", "transform", "pipeline"]
dependencies = [
"click>=8.1",
"PyYAML>=6.0",
]

[project.optional-dependencies]
dev = ["pytest>=8.0"]

[project.scripts]
data-transform = "data_transform.cli:main"

[project.urls]
Homepage = "https://github.com/rmkr-dev/data-transform-cli"
Repository = "https://github.com/rmkr-dev/data-transform-cli"
Issues = "https://github.com/rmkr-dev/data-transform-cli/issues"

[tool.setuptools.packages.find]
where = ["src"]

[tool.pytest.ini_options]
testpaths = ["tests"]
pythonpath = ["src"]
Loading
Loading