feat: add generic post-processing command for generated files - #1693
Open
manuc66 wants to merge 2 commits into
Open
feat: add generic post-processing command for generated files#1693manuc66 wants to merge 2 commits into
manuc66 wants to merge 2 commits into
Conversation
Runs an external command over every generated scan file (PDFs and
delivered images) before it is uploaded or cleaned up. The template
supports {input} and an optional {output} that atomically replaces
the file on success; failures keep the original file and are logged,
so the hook never blocks the scan flow.
| function runShellCommand(command: string): Promise<number> { | ||
| return new Promise((resolve) => { | ||
| exec( | ||
| command, |
This was referenced Aug 31, 2026
Resolve the CHANGELOG conflict by combining the [Unreleased] sections (post-processing command => Added, pattern validation => Changed, Windows test fixes => Fixed); README help blocks and program.ts merged cleanly and the blocks were re-verified against the merged program.
16 tasks
Owner
Author
Integration note: event ordering with the webhook (PR #1706/#1707)The webhook event advertises
The webhook schema itself is generic (one descriptor per file) and does not need to change; only the source of the descriptors moves later in the pipeline. |
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.
Implements the generic post-processing hook discussed in #… (picks up the PDF/A/archival idea without bundling or maintaining Ghostscript or any other tool in the project).
What
New option --post-command \ (CLI on \listen, \single-scan, \�df-autoscan) or \post_command\ in the config file. It runs an external command over every generated scan file before it is uploaded or cleaned up:
Typical uses (documented in the README): PDF/A conversion with Ghostscript, digital signature, metadata injection for PDFs; recompression/resize, watermark, EXIF metadata for images.
Template contract
Failure policy: a non-zero exit or missing {output}\ file keeps the original and logs an error — the scan flow never blocks or fails because of the hook. The hook is synchronous within the existing per-job processing pipeline (the app already awaits PDF build + uploads there).
Files
ode -e\ commands), image + PDF flows in \postProcessing.test.ts.
Notes