Pure, non-exiting CLI parser. Returns a discriminated union representing
each possible outcome:
{kind:'help'} — --help or -h was passed; print HELP_TEXT
and exit 0.
{kind:'error', message} — argv was rejected (unknown flag, missing
value, invalid language, run dir not found, etc.); print message to
stderr and exit non-zero.
{kind:'options', value} — argv parsed cleanly; value is ready to
pass to generateArticle / generateAllArticles.
Compared to the legacy parseCliArgs in article-generator.ts (which
throws and calls process.exit on --help), this entry point keeps
tests self-contained.
Pure, non-exiting CLI parser. Returns a discriminated union representing each possible outcome:
{kind:'help'}—--helpor-hwas passed; print HELP_TEXT and exit 0.{kind:'error', message}— argv was rejected (unknown flag, missing value, invalid language, run dir not found, etc.); print message to stderr and exit non-zero.{kind:'options', value}— argv parsed cleanly;valueis ready to pass togenerateArticle/generateAllArticles.Compared to the legacy
parseCliArgsinarticle-generator.ts(which throws and callsprocess.exiton--help), this entry point keeps tests self-contained.