Accepted
The PatternFly CLI exposes multiple commands (create, init, list, save, load, deploy, and so on). We need a clear place to register the program with Commander and parse arguments, while keeping each command’s behavior maintainable and easy to test.
-
src/cli.tsis the sole main entry point for the published binary (package.json"main"/bin→ compileddist/cli.js). It owns:- importing Commander and wiring
program; - registering commands, options, and descriptions;
- delegating execution to command-specific modules.
- importing Commander and wiring
-
Each command’s implementation lives in its own TypeScript file under
src/(for examplecreate.ts,save.ts,load.ts,gh-pages.ts). Those modules export functions such asrunCreate,runSave, etc., and contain the command’s business logic, side effects, and error handling. -
cli.tsstays thin: it should not grow large bodies of domain logic; new or refactored behavior belongs in the appropriate command module (or shared helpers), not inlined incli.ts.
Positive
- Easier navigation: contributors find command logic by filename, not inside one long entry file.
- Testing can target command modules with focused imports and mocks.
- Adding a command follows a repeatable pattern: new
src/<command>.ts+ registration incli.ts.
Negative / trade-offs
cli.tsmust stay in sync when adding or renaming commands (registration + imports).- Shared cross-command behavior should live in dedicated modules to avoid circular imports between
cli.tsand command files.
src/cli.ts— program wiring and command registrationsrc/create.ts,src/save.ts,src/load.ts, and related modules — command implementations