Summary
Running node src/cli.js <args> exits 0 with no output (stdout + stderr both empty). The correct entry point bin/patina.js works fine.
Root Cause
src/cli.js exports main() but never calls it at module level. When Node executes the file directly, it defines/exports the function and exits cleanly — no work is performed.
bin/patina.js correctly calls main(process.argv.slice(2)), so npx patina works. Only the node src/cli.js invocation path is broken.
Reproduction
node src/cli.js --backend codex-cli --tone casual --lang ko input.txt
# → exit 0, no output
node bin/patina.js --backend codex-cli --tone casual --lang ko input.txt
# → correct output
Suggested Fix
Add an ESM self-invocation guard at the bottom of src/cli.js:
import { fileURLToPath } from 'node:url';
if (process.argv[1] && fileURLToPath(import.meta.url) === process.argv[1]) {
main(process.argv.slice(2)).catch((err) => { console.error(err); process.exit(1); });
}
This preserves importability (tests import main() without side effects) while making node src/cli.js work as expected.
References
src/cli.js:18 — main() defined and exported, never called
bin/patina.js:5 — correct pattern already in use
package.json "main": "src/cli.js" implies it should be self-executing
Summary
Running
node src/cli.js <args>exits 0 with no output (stdout + stderr both empty). The correct entry pointbin/patina.jsworks fine.Root Cause
src/cli.jsexportsmain()but never calls it at module level. When Node executes the file directly, it defines/exports the function and exits cleanly — no work is performed.bin/patina.jscorrectly callsmain(process.argv.slice(2)), sonpx patinaworks. Only thenode src/cli.jsinvocation path is broken.Reproduction
Suggested Fix
Add an ESM self-invocation guard at the bottom of
src/cli.js:This preserves importability (tests import
main()without side effects) while makingnode src/cli.jswork as expected.References
src/cli.js:18—main()defined and exported, never calledbin/patina.js:5— correct pattern already in usepackage.json"main": "src/cli.js"implies it should be self-executing