v1.1.0 — pdfnative 1.3.0 coverage + an agent-native CLI#23
Merged
Conversation
Surface pdfnative 1.3.0 through the CLI and make the tool agent-native (100% backward-compatible). render: --font allow-list to all 22 Unicode scripts + COLRv1 colour emoji; --stream-true (true constant-memory streaming); --max-blocks document-block cap. inspect: read-only PDF/UA (ISO 14289-1) structural validation via --pdfua and --check pdfua (developer-time gate, not a veraPDF substitute). Agent contract: global --json status/error envelopes on stderr, stable E_* error codes, --dry-run for render/sign/batch, and a new schema command (Draft 2020-12, versioned \). Adds no network surface. Supply chain: CycloneDX SBOM (sbom.cdx.json) generated in CI and attached to each GitHub release; OpenSSF Scorecard badge. pdfnative bumped to ^1.3.0. Docs/samples: AGENTS.md, KNOWLEDGE_BASE agent section, README polish, new samples (agent/, schema, pdfua, stream-true, max-blocks, cert-chain, online-revocation). Tests 277/277.
…, compact JSON) Add a zero-dep agent projection layer that shrinks inspect/verify/batch JSON-on-stdout output ~90% for AI-agent/CI consumers, without an MCP server. - src/utils/projection.ts: selectFields (dot-path projection, array map, lenient on unknown paths), serializeJson (compact/pretty), parseFieldList. - inspect/verify/batch: --summary canonical minimal verdicts, --fields dot-path projection, compact JSON by default under --json with --pretty opt-out. Non-JSON human output unchanged (not a breaking change: --json agent mode is new in 1.1.0). - schema: new inspect-summary/verify-summary/batch-summary subjects, versioned \. - completion + help usage strings document the new flags/subjects. - Tests: tests/utils/projection.test.ts + projection cases on inspect/verify/batch/schema (304 passing). - Docs: AGENTS.md token-economy section, KNOWLEDGE_BASE projection subsection, CHANGELOG, release notes, instructions, README, samples/agent/04-token-economy.*
Align the published v1.1.0 release notes with implemented scope: - document output projection levers (--summary, --fields, compact JSON under --json, --pretty opt-out) - include canonical summary shapes and schema summary subjects - add agent-focused command examples for token-cheap orchestration This keeps the release notes complete and consistent with PR draft and shipped behavior.
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.
v1.1.0 — pdfnative 1.3.0 coverage + an agent-native CLI
Summary
Two themes, one release, zero breaking changes:
renderreaches all 22 Unicode scriptsand COLRv1 colour emoji, adds true constant-memory streaming
(
--stream-true) and a--max-blockscap;inspectgains a read-onlyPDF/UA (ISO 14289-1) structural validator (
--pdfua,--check pdfua).dispatch lets autonomous AI agents and CI drive the CLI deterministically:
a global
--jsonstatus/error envelope, stableE_*error codes, a--dry-runvalidation mode, a newschemacommand, and atoken-economy output projection (
--summary/--fields+ compact JSONunder
--json) that cuts agent output ~90 %. No MCP server, no daemon, no newruntime dependency — just the process contract.
Plus supply-chain transparency: a CycloneDX SBOM attached to every release
and an OpenSSF Scorecard badge.
Changes
src/utils/error.tsErrorCodeconst map +ErrorCodeValuetype (E_USAGE,E_INPUT,E_PARSE,E_IO,E_SIGN,E_VERIFY_FAILED,E_CHECK_FAILED,E_UNSUPPORTED,E_RUNTIME).CliErrorgains acodefield; constructor(message, exitCode = 1, code?)derives the code from the exit code when omitted (
2 → E_USAGE, elseE_RUNTIME), so every existing call site keeps a sensible code for free.src/commands/render.ts,sign.ts,batch.ts--dry-run(hasFlag(...) || isDryRun()): full validation, then short-circuitbefore producing/writing output.
signstops after credentials are parsed andthe PDF is placeholder-prepared, before any signature value is computed.
emitStatus({...})success envelopes on stderr in--jsonmode; INPUT/SIGN/IO/UNSUPPORTED error codes attached to the relevant
CliErrors.batch: global--jsonforces the JSON summary;--dry-runskipsmkdirand forwards to each
render.src/commands/inspect.ts,verify.tsE_PARSEon unreadable PDFs;inspect --checkfailures carryE_CHECK_FAILED,verify --strictfailures carryE_VERIFY_FAILED. In--jsonmode the check detail rides in the error message instead of beingpre-printed to stderr (avoids a double-print through the dispatcher).
utils/projection.ts:--summaryemits a canonical minimal verdict(inspect
{ pages, encrypted, signatures, pdfa }, verify{ valid, signatures, invalid }),--fields a,b.cprojects to named dot-paths,and output is compact by default under
--json(--prettyopts back into2-space). Non-
--jsonhuman output is unchanged.src/commands/batch.ts(projection)--summaryemits{ total, succeeded, failed }(drops the per-fileresultsarray — the largest token sink);
--fields/ compact /--prettybehave asabove.
summary/fields/prettyare added toBATCH_ONLY_FLAGSso they arenot forwarded to per-file
render.src/commands/completion.tsschemacommand and the--json/--dry-runglobal flags to thebash/zsh/fish flag and command tables; corrected the
batchflag list.src/index.tsPDFNATIVE_JSON=1/PDFNATIVE_DRY_RUN=1; tracks theactive command; on a thrown error in
--jsonmode,emitJsonError()writesthe failure envelope to stderr and exits with the
CliError.exitCode.schemawith usage text; help/usage listschema,--json,--dry-run, and point agents atAGENTS.md.New files
src/utils/agent.ts—isJsonMode,isDryRun,buildErrorEnvelope,emitJsonError,emitStatus(no-op outside--json).src/utils/projection.ts—selectFields(dot-path projection, array map,lenient on unknown paths),
serializeJson(compact/pretty),parseFieldList.Pure data, zero deps.
src/commands/schema.ts—pdfnative schema [render|inspect|verify|batch| inspect-summary|verify-summary|batch-summary|list], hand-authored versionedJSON Schemas (Draft 2020-12);
$idembeds the CLI version. Pure data, zero deps.AGENTS.md— agent-facing contract (channels,--json, error codes,--dry-run,schema, recommended loop, safety notes).tests/utils/error.test.ts,tests/utils/agent.test.ts,tests/utils/projection.test.ts,tests/commands/schema.test.ts; agent-modeand output-projection cases appended to
tests/commands/{render,sign,inspect,verify,batch,completion}.test.ts.samples/agent/{01-json-and-dry-run,02-schema,03-error-envelope}.{sh,ps1},samples/render/font/02-new-scripts.{json,sh,ps1},samples/render/document/06-max-blocks.{json,sh,ps1}(the--max-blockslarge-report guard),
samples/inspect/05-pdfua.{sh,ps1}.Docs & governance
README.md— OpenSSF Scorecard badge, refreshed "What's new",schemain thecommand tables, an "Driving from AI agents" section, agent globals.
docs/KNOWLEDGE_BASE.md— new §5 Agent Automation Contract (channels,envelope, error codes,
--dry-run,schema) + an agent integration snippet.CHANGELOG.md,release-notes/v1.1.0.md,ROADMAP.md— agent-native +SBOM entries.
SECURITY.md— supported versions to 1.1.x/1.0.x; note that theagent contract adds no network surface.
CITATION.cff— version/abstract/keywords.
CONTRIBUTING.md— error-code + schema-authoring conventions, SBOM..github/instructions/{cli-design,commands}.instructions.md— agent contractdeltas.
.github/workflows/publish.yml— CycloneDX SBOM generation + upload +release attachment (
contents: write).package.json— keywords (ai-agent,agentic,automation,json-output,json-schema,sbom,supply-chain).sbom.cdx.json) and links thereleases page, completes the agent error-code list (
E_IO), and notes thePDF/UA validator is a developer-time gate (not a veraPDF substitute);
samples/README.mdversion tags aligned to the CLI release line.Validation
npm run typecheck:all→ clean (src + tests).npm run lint→ clean.npm run test:coverage→ 276 / 276 passing (was 226 in v1.0.0); thresholdsmet — statements 81.78 %, branches 72.01 %, functions 85.9 %,
lines 83.59 %.
npm run build→ CJS 142.07 KB, ESM 141.16 KB, types emitted.node dist/cli.cjs --help→ ok;schema list→{ subjects: [...] }.render … --dry-run --json→{ ok: true, dryRun: true, … }on stderr, nofile written.
inspect --json→{ ok: false, command: "inspect", error: { code: "E_PARSE", … } }, exit 1.Backward compatibility
--jsononly adds a stderr envelope; stdout artifacts are byte-unchanged.CliError.codeis additive; existing call sites get a derived code for free.Out of scope (unchanged)
is a separate integration; this release keeps the CLI a stateless process.
sign --timestampstays reserved and errors withE_UNSUPPORTED(exit 2).Self-review checklist
console.log; all output viaprocess.stdout.write/process.stderr.write.--jsonnever touches stdout.signfailure stays the fixedFailed to sign PDF.(E_SIGN);--dry-runsignnever logs PEM bytes.E_*codes are additive.--dry-runwrites no output forrender/sign/batch(verified).any; new typesreadonlywhere applicable;ESM-first
.jsimports.pdfnativeis still the only runtime dependency.