feat: v1.3.0 — pdfnative 1.6.0: text extraction, forms, encrypt/decry…#37
Merged
Conversation
…pt, charts & doctor Built on pdfnative 1.6.0. Adds five new commands, native vector charts in render, and password / re-encryption / constant-memory streaming across the page-tree commands. Unifies the render encryption vocabulary, adds an agent capability manifest (schema manifest + llms.txt), a grouped --help, PowerShell completion, fill --export, and the stable E_PASSWORD code. 100% backward- compatible with v1.2.0. New commands: - extract-text — reading-order text (text | json | ndjson); --runs/--pages/--password; no OCR - fill — fill / flatten / export AcroForms via an incremental save - encrypt / decrypt — AES-128/256 page-tree re-encryption & decryption (+ --stream) - doctor — offline environment / capability preflight (text | --json) Enhancements: - render: native chart blocks (bar/barH/line/pie/donut); unified --encrypt / --owner-password / --user-password / --permissions flags (--encrypt-* kept as aliases) - merge/split/extract: --password, --encrypt [aes-128|aes-256], --stream (+ --chunk-size) - inspect: --form-fields, --encryption, --password - schema: extract-text/fill/form-export/status/manifest/doctor subjects - grouped --help by category; expanded package.json keywords/description Fixes: - render --encrypt was a silent no-op (help documented flags the code never read) → now encrypts - schema/--version crashed in the published binary (bundle-relative package.json) → bundle-safe version.ts - empty env password no longer overrides an explicit --password flag - fill --data content errors are consistently (exit 1, E_INPUT) Docs: README, KNOWLEDGE_BASE, AGENTS, CHANGELOG, ROADMAP, llms.txt, CLAUDE.md, samples (+ dual-shell for the new commands), release notes and draft PR. Bumps pdfnative ^1.5.0 → ^1.6.0; version → 1.3.0. 452 tests, npm audit clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…pt, charts & doctor
Built on pdfnative 1.6.0. Adds five new commands, native vector charts in render, and password / re-encryption / constant-memory streaming across the page-tree commands. Unifies the render encryption vocabulary, adds an agent capability manifest (schema manifest + llms.txt), a grouped --help, PowerShell completion, fill --export, and the stable E_PASSWORD code. 100% backward- compatible with v1.2.0.
New commands:
Enhancements:
Fixes:
Docs: README, KNOWLEDGE_BASE, AGENTS, CHANGELOG, ROADMAP, llms.txt, CLAUDE.md, samples (+ dual-shell for the new commands), release notes and draft PR. Bumps pdfnative ^1.5.0 → ^1.6.0; version → 1.3.0. 452 tests, npm audit clean.
v1.3.0 — pdfnative 1.6.0: text extraction, form fill/flatten, encrypt/decrypt, native charts & page-tree password/streaming
Summary
Five new commands plus
render/merge/split/extract/inspectenhancements land the pdfnative 1.6.0 engine's additions on the CLI — with an
agent-facing capability manifest, a unified encryption vocabulary, and three
bug fixes surfaced by an independent functional + documentation audit. Zero breaking
changes, zero new runtime dependencies:
extract-text— reading-order Unicode text viaextractText, astext | json | ndjson(NDJSON = one object/page, RAG/agent-friendly), with--runs,--pages,--password,--max-length. No OCR.fill— fill, flatten, and export existing AcroForms viafillForm/flattenForm/readFormFields, incremental save.fill --exportdumpscurrent values as a
--data-shaped map (read → edit → fill round-trip).encrypt/decrypt— AES-128/256 re-encryption and transparentdecryption via pdfnative 1.6.0 page-tree re-encryption. CSPRNG-gated; RC4
never emitted; passwords never logged. Both also gain
--stream.doctor— offline environment / capability preflight (CLI/Node/pdfnativeversions, Web Crypto CSPRNG, command count); text or
--json, exit 0/1.rendernative charts — thechartdocument block (bar/barH/line/pie/donut) —plus a unified encryption vocabulary (
--encrypt/--owner-password/ … ;--encrypt-*kept as aliases).merge/split/extractgain--password,--encrypt [aes-128|aes-256],--stream+--chunk-size.inspectgains--form-fields,--encryption,--password.schema manifest+llms.txt(tool discovery); schemasubjects
extract-text/fill/form-export/status/doctor; newE_PASSWORDcode.render --encryptwas a silent no-op (help vs code mismatch) → nowencrypts; (b)
schema/--versionwere broken in the published binary (bundle-relativepackage.json) → bundle-safeversion.ts; (c) an empty env password no longer overridesan explicit
--password; (d)fill--dataerrors are consistently(exit 1, E_INPUT).Changes
package.jsonpdfnativebumped^1.5.0→^1.6.0; version →1.3.0.extract-text,text-extraction,pdf-forms,acroform,form-fill,flatten-pdf,encrypt,decrypt,pdf-encryption,aes-256,charts,data-visualization,rag,llm,mcp,powershell-completion, …).descriptionupdated;filesnow shipsllms.txt.src/core-bridge/index.tsextractText,readFormFields/fillForm/flattenForm,streamMergedPdfs/streamSplitPdf/streamExtractPages,the error classes (
PdfPasswordError,PdfEncryptionUnsupportedError, thethree form errors), and the types (
OpenPdfOptions,PdfEncryptionInfo,PdfSourceInput,StreamMergeOptions,ExtractTextOptions&c.,ParsedFormField&c.,
ChartBlock/ChartSeries/ChartType).New commands
src/commands/extract-text.ts—extractText;--format text|json|ndjson,--runs,--pages(1-based),--password,--max-length,--summary/--fields.src/commands/fill.ts—fillForm/flattenForm/readFormFields;--data,--flatten,--export(values →--datamap, unset choice fields omitted),--force,--on-unknown,--need-appearances,--password,--dry-run. Malformed--datacontent →(exit 1, E_INPUT); form errors →E_INPUT/E_UNSUPPORTED.src/commands/encrypt.ts/decrypt.ts— page-tree re-encryption / decryption overall pages (
extractPages/streamExtractPageswithMergeOptions.encrypt/password).src/commands/doctor.ts— new, offline env/capability preflight (Node ≥ 20, Web CryptoCSPRNG,
pdfnativeversion, command count); text or--json, sets exit 1 on failure.Enhanced commands
src/commands/merge.ts/split.ts/extract.ts—--password,--encrypt(+
--owner/user-password,--permissions),--stream(+--chunk-size) viathe
stream*generators; errors routed throughmapPdfError(→E_PASSWORD).src/commands/inspect.ts—--form-fields,--encryption,--password.src/commands/schema.ts— subjectsextract-text/fill/form-export/status/manifest/doctor;encryption+formFieldsadded to theinspectschema.src/commands/completion.ts— new commands + flags (incl. render's unified crypto flags);PowerShell generator;
COMMANDS/GLOBAL_FLAGSexported (single source for the manifest).New / changed utilities
src/utils/version.ts— new, bundle-safecliVersion()(name-guardedcandidate probing); adopted by
index.tsandschema.ts(fixes the publishedschema/--versioncrash).src/utils/layout.ts—renderencryption unified:buildEncryptionFromFlagsnowreads
--encrypt/--owner-password/--user-password/--permissions(via the sharedpdfops helpers), with
--encrypt-*as aliases — fixing the silentrender --encryptno-op.src/utils/pdfops.ts—parseChunkSize,firstNonEmpty(empty env ≠ override),resolveSourcePassword/resolveOwnerPassword/resolveUserPassword,normalizeEncryptAlgo,readEncryptTrigger(--encrypt=falsedisables), exportedparsePermissions,buildEncryptOptions,mapPdfError.src/utils/error.ts/agent.ts—E_PASSWORDcode + default message.src/index.ts— dispatch, usage, help wiring for the five new commands; correctedrenderencryption/watermark help; updated merge/split/extract/inspect/completion/schema help.llms.txt(repo root) — LLM-facing capability manifest.CLAUDE.md(repo root) — Claude Code contributor guide.Samples
extract-text/,fill/,encrypt/(encrypt+decrypt flow),render/chart/(Bash + PowerShell + JSON).
samples/README.mdupdated; charts render viarun-all.jslike any document sample.Docs
README.md,AGENTS.md,docs/KNOWLEDGE_BASE.md,CHANGELOG.md,ROADMAP.md,samples/README.md,llms.txt;release-notes/v1.3.0.md.--help+ command-group overview tables(README / KB); the
mergesingle-password caveat (help + README + KB + AGENTS); a fullfactual-coherence sweep (17-command count,
E_PASSWORDin every list,--max-output-size256 MiB default, refreshed KB architecture map); ROADMAP entries for
optimize/compare/batch --manifestwith honest feasibility notes.Tests
tests/commands/{extract-text,fill,encrypt-decrypt,doctor}.test.ts(incl. anencrypt→inspect→decrypt round-trip,
fill --exportround-trip, and streaming variants);tests/utils/version.test.tsand expandedpdfops.test.ts(env-precedence /firstNonEmpty/normalizeEncryptAlgo/readEncryptTrigger); render encryptionunification regression in
render.test.ts(unified encrypts, legacy alias works, no-flagis plaintext); a chart case; updated
schema.test.ts(subjects/manifest) andcompletion.test.ts(PowerShell).Independent audit (this release)
Two independent agents audited the branch — functional (static source review) and
documentation (ran the built CLI + every sample). Findings were addressed: the silent
render --encryptno-op, the empty-env-password override, thefillerror-codeinconsistency, and a batch of doc must-fixes (KB command count/error-table/
--dry-run,README agent lists, a broken
--conformance pdfa2bsample). The complementary features(
fill --export,doctor,encrypt/decrypt --stream) came out of the same pass.Validation
npm run typecheck:all→ clean (src + tests).npm run lint→ clean.npm run build→ CJS + ESM + types emitted;node dist/cli.cjs --version→1.3.0.npm run test:coverage→ all tests passing (440+); coverage above thresholds(≈ statements 83 / branches 73 / functions 89 / lines 85 vs. 79/68/83/79).
npm audit→ 0 vulnerabilities.node dist/cli.cjs):render --encrypt aes-256 --owner-password X→inspect --encryption=aes256(the no-op is fixed); legacy
--encrypt-owner-pass/--encrypt-algorithmstill encrypt.extract-texttext / json / ndjson (+--runs,--pages).fill --export→ edit →fill --dataround-trip;--flatten→ 0 fields.encrypt(aes-256, incl.--stream) →inspect --encryption→decrypt --streamround-trip.merge --encrypt --stream,extract --stream,split --stream.doctor(exit 0) anddoctor --format json.{ ok:false, error:{ code:"E_PASSWORD" } }, exit 1.renderchart blocks;schema manifestlists all 17 commands +E_PASSWORD.Backward compatibility
E_PASSWORDis a new, additive error code.version.tschange fixes a latent crash in the publishedschema/--versionpath; source-run behaviour is unchanged.Out of scope (recorded in ROADMAP)
extract-textyields empty text on image-only pages (pdfnative scope).sign --timestampstays reserved and errors withE_UNSUPPORTED.merge— deliberately not added (apath:passsyntaxcollides with Windows drive letters and complicates the CLI). Documented instead: one
--passwordfor all sources; different passwords fail withE_PASSWORD.pdfnative page/security --help) — the global--helpisgrouped instead; dedicated category commands are deferred.
batch --manifest,compare,optimize— future ROADMAP items.batch --manifestand a text/structural
compareare feasible today;optimizeand a visualcompareneed pdfnative primitives (object GC / linearisation / a rasteriser).
pdfnativeremains the only one.Self-review checklist
console.log; all output viaprocess.stdout.write/process.stderr.write.--jsonnever touches stdout.error messages carry no secrets;
E_PASSWORDdistinguishes the failure class.render --encryptactually encrypts now (regression-tested);--encrypt-*aliases preserved; unified crypto vocabulary across render + page-tree commands.
E_PASSWORDis additive;fill--dataerrors are consistently
(exit 1, E_INPUT).--dry-runwrites no output forfill/encrypt/decrypt(in additionto the existing commands).
(
--max-length,--max-output-size,--chunk-size).--streamoutput is structurally equivalent to buffered;streamSplitPdfranges fully drained before advancing.
any; new typesreadonlywhere applicable; ESM-first.jsimports; all core imports go throughcore-bridge.pdfnativeis still the only runtime dependency.