# CSV, clarified.

A free, original browser-only CSV comparison tool from AI BUNKER's GPT entry.
No account, file uploads, tracking, external libraries or build step.

Open `index.html` in a modern browser, select the older and newer files,
choose their separator and a unique key column, then compare. The sample
button demonstrates one added row, one removed row, two changed rows and
one unchanged row. Its fictional data includes a quoted comma and a
multiline cell. The downloadable sample files are in `samples/`.

## What it does

- Matches rows by an exact, nonempty unique key. Duplicate keys are errors.
- Matches columns by name, so reordered rows or columns are not changes.
- Reports added, removed, changed and unchanged row counts.
- Supports comma, semicolon or tab separators, UTF-8 BOM, CRLF/LF/CR record
  endings, quoted separators, escaped quotes and multiline quoted fields.
- Trims header names, preserves all cell values, and ignores blank lines.
  Spaces, case and leading zeroes in values remain significant.
- Distinguishes absent columns from empty values. Column changes are shown
  even if both inputs contain headers but no data rows.
- Provides key search, change filters, paginated results and per-row values.
- Exports the full difference report independent of screen filtering.

## Report format

The CSV contains `change`, `key`, `column`, `before`, `after`,
`before_present`, `after_present`, `before_data_row`, `after_data_row`.
Changed rows have one report record for each changed field. Added and
removed rows contain all fields that exist in their respective input.
Presence flags distinguish an absent field from an empty string. Data-row
numbers exclude the header and ignored blank lines; a quoted multiline
field is still one record. Row/column order alone does not create a report.

Every exported field is quoted and embedded quotes are escaped. A UTF-8 BOM
helps spreadsheets recognize the encoding. Formula-like values (including
`=`, `+`, `-`, `@` following leading whitespace, and leading tab/CR/LF) get
an apostrophe prefix. This deliberately changes potentially executable
exported strings; original values remain unchanged during comparison.
Spreadsheet behavior varies, so review unfamiliar files before opening.

## Limits and privacy

Per file: 5 MiB, 50,000 data rows, 200 columns, 1,000,000 cells including the
header. Files must be UTF-8 text and all rows must have the header's number
of fields. Export Excel workbooks or other text encodings to UTF-8 first.
On-screen values are shortened after 2,000 characters; the report retains
their complete contents. Exports stop with an explicit error above 25 million
characters, since a long key repeated in a field-level report can expand
far beyond the input size. An identical comparison exports only the header.

All selected content is processed in the current tab. The app has no
network calls, local storage, cookies or service workers. The HTML includes
a policy denying outgoing connections. Static page assets must initially
load if hosted; host-level request logs are outside this app's control.
Downloading the ZIP and opening index.html locally also works offline.
Reset discards the app's references to selected content and clears its UI;
it is not a promise of secure memory erasure. A browser extension or modified
copy can have behavior outside this tool's control.

## Files and verification

- `index.html`, `styles.css`: interface and local styles.
- `core.js`: standalone parser, comparison and safe report functions.
- `app.js`: file selection and interface behavior.
- `core.test.cjs`: Node built-in tests; no packages required.

Run `node --test core.test.cjs` from this folder. Tests cover valid and
malformed CSV, BOM, multiline values, duplicates, empty keys, reordered
data, schema changes, prototype-like keys and spreadsheet-safe exports.
There is no claimed formal accessibility or security audit.

For hosting, upload the static files together. Keep relative paths intact.
The `csv-diff-tool.zip` download is a convenience source bundle generated
from a fixed whitelist; it does not contain itself or any user data.

Free use, modification and redistribution are permitted by `LICENSE.txt`.
