Summary
Three InDesign pipeline entry points document - as the "read from stdin"
argument (and their loadIr() helpers are written to handle it), but their
argument-parsing loops reject - as an unknown flag. The advertised stdin form
therefore fails with Unknown argument: - (exit 2). Stdin is still reachable by
omitting the positional argument, so the capability isn't lost — only the
documented - form is broken.
Found while building the new flavian-ingest stage in #146, which handles -
correctly and serves as the reference fix.
Affected entry points
| Entry point |
Rejects - at |
Dead stdin branch |
flavian-generate-theme |
packages/pipeline/bin/generate-theme.mjs:68 |
:94 |
flavian-map-tokens |
packages/pipeline/bin/map-tokens.mjs:60 |
:80 |
flavian pipeline indesign |
bin/flavian.mjs:80 |
:155 |
Each one advertises -:
generate-theme / map-tokens usage string: <ir.json | doc.idml | doc.pdf | ->
bin/flavian.mjs:86: an input is required (an .idml/.pdf file, an IR JSON, or - for stdin)
flavian-parse-idml and flavian-parse-pdf are not affected — they take a
file path only and intentionally offer no stdin mode.
Reproduction
node tests/fixtures/indesign/emit.mjs ./tmp-fix
node packages/pipeline/bin/ingest.mjs ./tmp-fix/brochure.idml --quiet \
| node packages/pipeline/bin/generate-theme.mjs - --out-dir ./tmp-theme
# → Unknown argument: - (exit 2)
- Expected:
- is accepted; the IR JSON is read from stdin.
- Actual:
Unknown argument: -, usage printed, exit 2.
- Workaround: drop the
- (the bins fall back to stdin when no positional is given).
Root cause
The positional-capture guard is !arg.startsWith('-'), and '-'.startsWith('-')
is true, so a bare - is never stored as the input path and falls through to
the unknown-argument branch.
Proposed fix
Treat a bare - as the stdin sentinel before the dash check — exactly what the
merged flavian-ingest bin already does at packages/pipeline/bin/ingest.mjs:53:
// before
if (!inputPath && !arg.startsWith('-')) { inputPath = arg; }
// after — a bare "-" is the explicit stdin sentinel
if (!inputPath && (arg === '-' || !arg.startsWith('-'))) { inputPath = arg; }
Apply the equivalent change in all three entry points. The downstream loadIr()
helpers already special-case inputPath === '-', so no other changes are needed.
Acceptance criteria
References
Summary
Three InDesign pipeline entry points document
-as the "read from stdin"argument (and their
loadIr()helpers are written to handle it), but theirargument-parsing loops reject
-as an unknown flag. The advertised stdin formtherefore fails with
Unknown argument: -(exit 2). Stdin is still reachable byomitting the positional argument, so the capability isn't lost — only the
documented
-form is broken.Found while building the new
flavian-ingeststage in #146, which handles-correctly and serves as the reference fix.
Affected entry points
-atflavian-generate-themepackages/pipeline/bin/generate-theme.mjs:68:94flavian-map-tokenspackages/pipeline/bin/map-tokens.mjs:60:80flavian pipeline indesignbin/flavian.mjs:80:155Each one advertises
-:generate-theme/map-tokensusage string:<ir.json | doc.idml | doc.pdf | ->bin/flavian.mjs:86:an input is required (an .idml/.pdf file, an IR JSON, or - for stdin)flavian-parse-idmlandflavian-parse-pdfare not affected — they take afile path only and intentionally offer no stdin mode.
Reproduction
-is accepted; the IR JSON is read from stdin.Unknown argument: -, usage printed, exit 2.-(the bins fall back to stdin when no positional is given).Root cause
The positional-capture guard is
!arg.startsWith('-'), and'-'.startsWith('-')is
true, so a bare-is never stored as the input path and falls through tothe unknown-argument branch.
Proposed fix
Treat a bare
-as the stdin sentinel before the dash check — exactly what themerged
flavian-ingestbin already does atpackages/pipeline/bin/ingest.mjs:53:Apply the equivalent change in all three entry points. The downstream
loadIr()helpers already special-case
inputPath === '-', so no other changes are needed.Acceptance criteria
flavian-generate-theme -,flavian-map-tokens -, andflavian pipeline indesign -read the IR from stdin instead of erroring.-succeeds (mirror the ingest stdin path).-; no doc change expected).pnpm --filter @flavian/pipeline test, the InDesign smoke test, and the fixture tests stay green.References
flavian-ingesthandles-atpackages/pipeline/bin/ingest.mjs:53).