mirror of
https://github.com/AmruthPillai/Reactive-Resume.git
synced 2026-10-03 02:04:31 +10:00
* feat(import): parse a PDF resume without an AI provider Importing a PDF required a connected AI provider, so anyone without a paid API key could only import the three JSON formats. Almost nobody arrives with one of those files; they arrive with a PDF. The first thing a new user tries to do was blocked behind bringing their own key. Adds a deterministic parser that reads the text out of the PDF in the browser and prefills the builder. It pulls the contact block, segments the body on conventional headings, and maps entries to real items, reusing the ATS period parser for dates so a date range is not mistaken for a phone number. Nothing is thrown away: header parts that do not map to a field go into the description, and unrecognized headings become custom sections. The imported sections are placed on the page so the result renders straight away. Output is validated against the resume schema before it is returned. Text extraction groups items by baseline rather than trusting hasEOL, and turns wide column gaps into a double space, which is what lets a row split into company, position and location. The AI path still runs when a provider is connected. Word import is unchanged and still requires one. Closes #3334 * fix(import): keep every section and entry the PDF actually contains Review found three ways the parser lost or mangled content, all of them reproducible. A document whose first heading was not one of the known aliases never started a section, because unknown-heading detection was gated on a section already being open. Everything after it was swallowed as contact header text. The header block is now bounded by where the contact details stop, so a heading is recognized wherever it appears. An entry spreading company, position and dates over three lines was imported as two malformed items. A line that introduces an entry now merges into the open entry instead of starting a second one. An uppercase company such as ACME CORPORATION was read as a section heading and fragmented the entry. A heading candidate followed by a date line is now treated as an entry header, which is what it is. Also escape single quotes, and construct the PDF worker inside the try so the nested worker is terminated even if construction throws. Title-case headings are deliberately still not treated as headings: company and school names are title case too, and splitting on them would fragment real entries. Such a section stays in the preceding one with its text intact rather than risking loss. * fix(import): look past a multi-line preamble before calling a line a heading The previous guard only inspected the next line, so an uppercase company followed by a separate role line and then the dates was still read as a section heading. The experience or education entry was moved into a custom section and lost. Heading detection now scans a two-line window for the date that marks an entry, and stops early at a bullet so a genuine heading whose section opens with bullet points is still recognized. The window can suppress a real heading whose first entry puts a bare date two lines below it. That is the deliberate direction to fail in: a missed heading leaves the text in the preceding section, while a misread entry fragments structured content. * fix(import): collect an entry preamble until its dates appear An entry that spread company, role, location and dates over four lines was imported as two broken items: the company with no dates, and the location carrying the period. The cause was in entry grouping rather than heading detection. Lines before a date were only folded into the entry header when the date sat on the very next line; anything earlier fell through to the description. Preamble lines are now collected into the entry header until the dates turn up, bounded by the same lookahead and stopping at a bullet, so an undated section cannot swallow itself. The heading lookahead widens to four lines to match, which is the realistic maximum for company, role, location and dates. * fix(import): harden local PDF resume parsing * chore(import): document audited HTML construction --------- Co-authored-by: Amruth Pillai <im.amruth@gmail.com>