@pristine-ts/cli 2.0.6 → 2.0.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib/cjs/bin.js +0 -0
- package/dist/lib/cjs/bootstrap/app-module-cache.js +71 -0
- package/dist/lib/cjs/bootstrap/app-module-cache.js.map +1 -0
- package/dist/lib/cjs/bootstrap/app-module-discoverer.js +119 -0
- package/dist/lib/cjs/bootstrap/app-module-discoverer.js.map +1 -0
- package/dist/lib/cjs/bootstrap/app-module-discovery-candidate.js +21 -0
- package/dist/lib/cjs/bootstrap/app-module-discovery-candidate.js.map +1 -0
- package/dist/lib/cjs/bootstrap/app-module-discovery-reason.enum.js +15 -0
- package/dist/lib/cjs/bootstrap/app-module-discovery-reason.enum.js.map +1 -0
- package/dist/lib/cjs/bootstrap/app-module-prompt.js +78 -0
- package/dist/lib/cjs/bootstrap/app-module-prompt.js.map +1 -0
- package/dist/lib/cjs/bootstrap/build-runner.js +1 -1
- package/dist/lib/cjs/bootstrap/build-staleness-prompt.js +12 -13
- package/dist/lib/cjs/bootstrap/build-staleness-prompt.js.map +1 -1
- package/dist/lib/cjs/bootstrap/init-prompt.js +16 -47
- package/dist/lib/cjs/bootstrap/init-prompt.js.map +1 -1
- package/dist/lib/cjs/cli.configuration-keys.js +24 -0
- package/dist/lib/cjs/cli.configuration-keys.js.map +1 -0
- package/dist/lib/cjs/cli.js +23 -10
- package/dist/lib/cjs/cli.js.map +1 -1
- package/dist/lib/cjs/cli.module.js +41 -8
- package/dist/lib/cjs/cli.module.js.map +1 -1
- package/dist/lib/cjs/commands/build.command.js +15 -14
- package/dist/lib/cjs/commands/build.command.js.map +1 -1
- package/dist/lib/cjs/commands/commands.js +6 -0
- package/dist/lib/cjs/commands/commands.js.map +1 -1
- package/dist/lib/cjs/commands/config-init.command.js +133 -0
- package/dist/lib/cjs/commands/config-init.command.js.map +1 -0
- package/dist/lib/cjs/commands/config-print.command.js +16 -11
- package/dist/lib/cjs/commands/config-print.command.js.map +1 -1
- package/dist/lib/cjs/commands/help.command.js +17 -17
- package/dist/lib/cjs/commands/help.command.js.map +1 -1
- package/dist/lib/cjs/commands/info.command.js +26 -21
- package/dist/lib/cjs/commands/info.command.js.map +1 -1
- package/dist/lib/cjs/commands/init.command.js +22 -21
- package/dist/lib/cjs/commands/init.command.js.map +1 -1
- package/dist/lib/cjs/commands/list.command.js +6 -6
- package/dist/lib/cjs/commands/list.command.js.map +1 -1
- package/dist/lib/cjs/commands/logs-alias.command.js +49 -0
- package/dist/lib/cjs/commands/logs-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/logs.command-options.js +72 -0
- package/dist/lib/cjs/commands/logs.command-options.js.map +1 -0
- package/dist/lib/cjs/commands/logs.command.js +102 -0
- package/dist/lib/cjs/commands/logs.command.js.map +1 -0
- package/dist/lib/cjs/commands/requests-alias.command.js +49 -0
- package/dist/lib/cjs/commands/requests-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/requests.command-options.js +26 -0
- package/dist/lib/cjs/commands/requests.command-options.js.map +1 -0
- package/dist/lib/cjs/commands/requests.command.js +88 -0
- package/dist/lib/cjs/commands/requests.command.js.map +1 -0
- package/dist/lib/cjs/commands/start.command.js +12 -13
- package/dist/lib/cjs/commands/start.command.js.map +1 -1
- package/dist/lib/cjs/commands/trace-alias.command.js +49 -0
- package/dist/lib/cjs/commands/trace-alias.command.js.map +1 -0
- package/dist/lib/cjs/commands/trace.command-options.js +59 -0
- package/dist/lib/cjs/commands/trace.command-options.js.map +1 -0
- package/dist/lib/cjs/commands/trace.command.js +84 -0
- package/dist/lib/cjs/commands/trace.command.js.map +1 -0
- package/dist/lib/cjs/config/config-loader.js +34 -13
- package/dist/lib/cjs/config/config-loader.js.map +1 -1
- package/dist/lib/cjs/decorators/command-parameter.decorator.js +40 -0
- package/dist/lib/cjs/decorators/command-parameter.decorator.js.map +1 -0
- package/dist/lib/cjs/decorators/decorators.js +18 -0
- package/dist/lib/cjs/decorators/decorators.js.map +1 -0
- package/dist/lib/cjs/enums/cli-decorator-metadata-keyname.enum.js +14 -0
- package/dist/lib/cjs/enums/cli-decorator-metadata-keyname.enum.js.map +1 -0
- package/dist/lib/cjs/enums/enums.js +19 -0
- package/dist/lib/cjs/enums/enums.js.map +1 -0
- package/dist/lib/cjs/enums/exit-code.enum.js +9 -0
- package/dist/lib/cjs/enums/exit-code.enum.js.map +1 -0
- package/dist/lib/cjs/enums/terminal-key-name.enum.js +21 -0
- package/dist/lib/cjs/enums/terminal-key-name.enum.js.map +1 -0
- package/dist/lib/cjs/errors/cli-error-code.enum.js +11 -1
- package/dist/lib/cjs/errors/cli-error-code.enum.js.map +1 -1
- package/dist/lib/cjs/errors/errors.js +1 -0
- package/dist/lib/cjs/errors/errors.js.map +1 -1
- package/dist/lib/cjs/errors/prompt-cancelled.error.js +25 -0
- package/dist/lib/cjs/errors/prompt-cancelled.error.js.map +1 -0
- package/dist/lib/cjs/event-handlers/cli.event-handler.js +28 -70
- package/dist/lib/cjs/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/cjs/event-handlers/event-handlers.js +1 -0
- package/dist/lib/cjs/event-handlers/event-handlers.js.map +1 -1
- package/dist/lib/cjs/event-handlers/repl-start.event-handler.js +280 -0
- package/dist/lib/cjs/event-handlers/repl-start.event-handler.js.map +1 -0
- package/dist/lib/cjs/event-payloads/event-payloads.js +1 -0
- package/dist/lib/cjs/event-payloads/event-payloads.js.map +1 -1
- package/dist/lib/cjs/event-payloads/start-repl.event-payload.js +19 -0
- package/dist/lib/cjs/event-payloads/start-repl.event-payload.js.map +1 -0
- package/dist/lib/cjs/interfaces/interfaces.js +1 -0
- package/dist/lib/cjs/interfaces/interfaces.js.map +1 -1
- package/dist/lib/cjs/interfaces/terminal-key.interface.js +3 -0
- package/dist/lib/cjs/interfaces/terminal-key.interface.js.map +1 -0
- package/dist/lib/cjs/managers/cli-output.manager.js +45 -0
- package/dist/lib/cjs/managers/cli-output.manager.js.map +1 -0
- package/dist/lib/cjs/managers/cli-progress-bar.manager.js +49 -0
- package/dist/lib/cjs/managers/cli-progress-bar.manager.js.map +1 -0
- package/dist/lib/cjs/managers/cli-prompt.manager.js +265 -0
- package/dist/lib/cjs/managers/cli-prompt.manager.js.map +1 -0
- package/dist/lib/cjs/managers/cli-spinner.manager.js +93 -0
- package/dist/lib/cjs/managers/cli-spinner.manager.js.map +1 -0
- package/dist/lib/cjs/managers/managers.js +5 -1
- package/dist/lib/cjs/managers/managers.js.map +1 -1
- package/dist/lib/cjs/managers/repl-session.js +251 -0
- package/dist/lib/cjs/managers/repl-session.js.map +1 -0
- package/dist/lib/cjs/managers/shell.manager.js +25 -20
- package/dist/lib/cjs/managers/shell.manager.js.map +1 -1
- package/dist/lib/cjs/managers/terminal-key-reader.manager.js +99 -0
- package/dist/lib/cjs/managers/terminal-key-reader.manager.js.map +1 -0
- package/dist/lib/cjs/mappers/command-event.mapper.js +48 -8
- package/dist/lib/cjs/mappers/command-event.mapper.js.map +1 -1
- package/dist/lib/cjs/mappers/mappers.js +1 -0
- package/dist/lib/cjs/mappers/mappers.js.map +1 -1
- package/dist/lib/cjs/mappers/repl-start-event.mapper.js +80 -0
- package/dist/lib/cjs/mappers/repl-start-event.mapper.js.map +1 -0
- package/dist/lib/cjs/options/command-parameter.options.js +3 -0
- package/dist/lib/cjs/options/command-parameter.options.js.map +1 -0
- package/dist/lib/cjs/options/options.js +1 -0
- package/dist/lib/cjs/options/options.js.map +1 -1
- package/dist/lib/cjs/services/command-argument-resolver.js +62 -0
- package/dist/lib/cjs/services/command-argument-resolver.js.map +1 -0
- package/dist/lib/cjs/services/command-options-resolver.js +114 -0
- package/dist/lib/cjs/services/command-options-resolver.js.map +1 -0
- package/dist/lib/cjs/services/command-parameter-prompter.js +311 -0
- package/dist/lib/cjs/services/command-parameter-prompter.js.map +1 -0
- package/dist/lib/cjs/services/services.js +20 -0
- package/dist/lib/cjs/services/services.js.map +1 -0
- package/dist/lib/cjs/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/lib/cjs/types/start-repl-event-response.type.js +13 -0
- package/dist/lib/cjs/types/start-repl-event-response.type.js.map +1 -0
- package/dist/lib/cjs/types/types.js +1 -0
- package/dist/lib/cjs/types/types.js.map +1 -1
- package/dist/lib/cjs/utils/boolean-answer-parser.js +25 -0
- package/dist/lib/cjs/utils/boolean-answer-parser.js.map +1 -0
- package/dist/lib/cjs/utils/pristine-argv.js +87 -0
- package/dist/lib/cjs/utils/pristine-argv.js.map +1 -0
- package/dist/lib/cjs/utils/terminal-key-decoder.js +71 -0
- package/dist/lib/cjs/utils/terminal-key-decoder.js.map +1 -0
- package/dist/lib/esm/bootstrap/app-module-cache.js +65 -0
- package/dist/lib/esm/bootstrap/app-module-cache.js.map +1 -0
- package/dist/lib/esm/bootstrap/app-module-discoverer.js +113 -0
- package/dist/lib/esm/bootstrap/app-module-discoverer.js.map +1 -0
- package/dist/lib/esm/bootstrap/app-module-discovery-candidate.js +17 -0
- package/dist/lib/esm/bootstrap/app-module-discovery-candidate.js.map +1 -0
- package/dist/lib/esm/bootstrap/app-module-discovery-reason.enum.js +12 -0
- package/dist/lib/esm/bootstrap/app-module-discovery-reason.enum.js.map +1 -0
- package/dist/lib/esm/bootstrap/app-module-prompt.js +75 -0
- package/dist/lib/esm/bootstrap/app-module-prompt.js.map +1 -0
- package/dist/lib/esm/bootstrap/build-runner.js +1 -1
- package/dist/lib/esm/bootstrap/build-staleness-prompt.js +12 -13
- package/dist/lib/esm/bootstrap/build-staleness-prompt.js.map +1 -1
- package/dist/lib/esm/bootstrap/init-prompt.js +16 -47
- package/dist/lib/esm/bootstrap/init-prompt.js.map +1 -1
- package/dist/lib/esm/cli.configuration-keys.js +21 -0
- package/dist/lib/esm/cli.configuration-keys.js.map +1 -0
- package/dist/lib/esm/cli.js +23 -10
- package/dist/lib/esm/cli.js.map +1 -1
- package/dist/lib/esm/cli.module.js +41 -8
- package/dist/lib/esm/cli.module.js.map +1 -1
- package/dist/lib/esm/commands/build.command.js +16 -15
- package/dist/lib/esm/commands/build.command.js.map +1 -1
- package/dist/lib/esm/commands/commands.js +6 -0
- package/dist/lib/esm/commands/commands.js.map +1 -1
- package/dist/lib/esm/commands/config-init.command.js +127 -0
- package/dist/lib/esm/commands/config-init.command.js.map +1 -0
- package/dist/lib/esm/commands/config-print.command.js +16 -11
- package/dist/lib/esm/commands/config-print.command.js.map +1 -1
- package/dist/lib/esm/commands/help.command.js +17 -17
- package/dist/lib/esm/commands/help.command.js.map +1 -1
- package/dist/lib/esm/commands/info.command.js +27 -22
- package/dist/lib/esm/commands/info.command.js.map +1 -1
- package/dist/lib/esm/commands/init.command.js +23 -22
- package/dist/lib/esm/commands/init.command.js.map +1 -1
- package/dist/lib/esm/commands/list.command.js +6 -6
- package/dist/lib/esm/commands/list.command.js.map +1 -1
- package/dist/lib/esm/commands/logs-alias.command.js +46 -0
- package/dist/lib/esm/commands/logs-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/logs.command-options.js +68 -0
- package/dist/lib/esm/commands/logs.command-options.js.map +1 -0
- package/dist/lib/esm/commands/logs.command.js +99 -0
- package/dist/lib/esm/commands/logs.command.js.map +1 -0
- package/dist/lib/esm/commands/requests-alias.command.js +46 -0
- package/dist/lib/esm/commands/requests-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/requests.command-options.js +22 -0
- package/dist/lib/esm/commands/requests.command-options.js.map +1 -0
- package/dist/lib/esm/commands/requests.command.js +85 -0
- package/dist/lib/esm/commands/requests.command.js.map +1 -0
- package/dist/lib/esm/commands/start.command.js +13 -14
- package/dist/lib/esm/commands/start.command.js.map +1 -1
- package/dist/lib/esm/commands/trace-alias.command.js +46 -0
- package/dist/lib/esm/commands/trace-alias.command.js.map +1 -0
- package/dist/lib/esm/commands/trace.command-options.js +55 -0
- package/dist/lib/esm/commands/trace.command-options.js.map +1 -0
- package/dist/lib/esm/commands/trace.command.js +81 -0
- package/dist/lib/esm/commands/trace.command.js.map +1 -0
- package/dist/lib/esm/config/config-loader.js +34 -13
- package/dist/lib/esm/config/config-loader.js.map +1 -1
- package/dist/lib/esm/decorators/command-parameter.decorator.js +36 -0
- package/dist/lib/esm/decorators/command-parameter.decorator.js.map +1 -0
- package/dist/lib/esm/decorators/decorators.js +2 -0
- package/dist/lib/esm/decorators/decorators.js.map +1 -0
- package/dist/lib/esm/enums/cli-decorator-metadata-keyname.enum.js +11 -0
- package/dist/lib/esm/enums/cli-decorator-metadata-keyname.enum.js.map +1 -0
- package/dist/lib/esm/enums/enums.js +3 -0
- package/dist/lib/esm/enums/enums.js.map +1 -0
- package/dist/lib/esm/enums/exit-code.enum.js +6 -0
- package/dist/lib/esm/enums/exit-code.enum.js.map +1 -0
- package/dist/lib/esm/enums/terminal-key-name.enum.js +18 -0
- package/dist/lib/esm/enums/terminal-key-name.enum.js.map +1 -0
- package/dist/lib/esm/errors/cli-error-code.enum.js +11 -1
- package/dist/lib/esm/errors/cli-error-code.enum.js.map +1 -1
- package/dist/lib/esm/errors/errors.js +1 -0
- package/dist/lib/esm/errors/errors.js.map +1 -1
- package/dist/lib/esm/errors/prompt-cancelled.error.js +21 -0
- package/dist/lib/esm/errors/prompt-cancelled.error.js.map +1 -0
- package/dist/lib/esm/event-handlers/cli.event-handler.js +29 -71
- package/dist/lib/esm/event-handlers/cli.event-handler.js.map +1 -1
- package/dist/lib/esm/event-handlers/event-handlers.js +1 -0
- package/dist/lib/esm/event-handlers/event-handlers.js.map +1 -1
- package/dist/lib/esm/event-handlers/repl-start.event-handler.js +244 -0
- package/dist/lib/esm/event-handlers/repl-start.event-handler.js.map +1 -0
- package/dist/lib/esm/event-payloads/event-payloads.js +1 -0
- package/dist/lib/esm/event-payloads/event-payloads.js.map +1 -1
- package/dist/lib/esm/event-payloads/start-repl.event-payload.js +15 -0
- package/dist/lib/esm/event-payloads/start-repl.event-payload.js.map +1 -0
- package/dist/lib/esm/interfaces/interfaces.js +1 -0
- package/dist/lib/esm/interfaces/interfaces.js.map +1 -1
- package/dist/lib/esm/interfaces/terminal-key.interface.js +2 -0
- package/dist/lib/esm/interfaces/terminal-key.interface.js.map +1 -0
- package/dist/lib/esm/managers/cli-output.manager.js +42 -0
- package/dist/lib/esm/managers/cli-output.manager.js.map +1 -0
- package/dist/lib/esm/managers/cli-progress-bar.manager.js +46 -0
- package/dist/lib/esm/managers/cli-progress-bar.manager.js.map +1 -0
- package/dist/lib/esm/managers/cli-prompt.manager.js +229 -0
- package/dist/lib/esm/managers/cli-prompt.manager.js.map +1 -0
- package/dist/lib/esm/managers/cli-spinner.manager.js +90 -0
- package/dist/lib/esm/managers/cli-spinner.manager.js.map +1 -0
- package/dist/lib/esm/managers/managers.js +5 -1
- package/dist/lib/esm/managers/managers.js.map +1 -1
- package/dist/lib/esm/managers/repl-session.js +215 -0
- package/dist/lib/esm/managers/repl-session.js.map +1 -0
- package/dist/lib/esm/managers/shell.manager.js +26 -21
- package/dist/lib/esm/managers/shell.manager.js.map +1 -1
- package/dist/lib/esm/managers/terminal-key-reader.manager.js +96 -0
- package/dist/lib/esm/managers/terminal-key-reader.manager.js.map +1 -0
- package/dist/lib/esm/mappers/command-event.mapper.js +49 -9
- package/dist/lib/esm/mappers/command-event.mapper.js.map +1 -1
- package/dist/lib/esm/mappers/mappers.js +1 -0
- package/dist/lib/esm/mappers/mappers.js.map +1 -1
- package/dist/lib/esm/mappers/repl-start-event.mapper.js +77 -0
- package/dist/lib/esm/mappers/repl-start-event.mapper.js.map +1 -0
- package/dist/lib/esm/options/command-parameter.options.js +2 -0
- package/dist/lib/esm/options/command-parameter.options.js.map +1 -0
- package/dist/lib/esm/options/options.js +1 -0
- package/dist/lib/esm/options/options.js.map +1 -1
- package/dist/lib/esm/services/command-argument-resolver.js +59 -0
- package/dist/lib/esm/services/command-argument-resolver.js.map +1 -0
- package/dist/lib/esm/services/command-options-resolver.js +111 -0
- package/dist/lib/esm/services/command-options-resolver.js.map +1 -0
- package/dist/lib/esm/services/command-parameter-prompter.js +308 -0
- package/dist/lib/esm/services/command-parameter-prompter.js.map +1 -0
- package/dist/lib/esm/services/services.js +4 -0
- package/dist/lib/esm/services/services.js.map +1 -0
- package/dist/lib/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/lib/esm/types/start-repl-event-response.type.js +9 -0
- package/dist/lib/esm/types/start-repl-event-response.type.js.map +1 -0
- package/dist/lib/esm/types/types.js +1 -0
- package/dist/lib/esm/types/types.js.map +1 -1
- package/dist/lib/esm/utils/boolean-answer-parser.js +21 -0
- package/dist/lib/esm/utils/boolean-answer-parser.js.map +1 -0
- package/dist/lib/esm/utils/pristine-argv.js +50 -0
- package/dist/lib/esm/utils/pristine-argv.js.map +1 -0
- package/dist/lib/esm/utils/terminal-key-decoder.js +67 -0
- package/dist/lib/esm/utils/terminal-key-decoder.js.map +1 -0
- package/dist/types/bootstrap/app-module-cache.d.ts +15 -0
- package/dist/types/bootstrap/app-module-discoverer.d.ts +30 -0
- package/dist/types/bootstrap/app-module-discovery-candidate.d.ts +18 -0
- package/dist/types/bootstrap/app-module-discovery-reason.enum.d.ts +10 -0
- package/dist/types/bootstrap/app-module-prompt.d.ts +20 -0
- package/dist/types/bootstrap/build-runner.d.ts +1 -1
- package/dist/types/bootstrap/build-staleness-prompt.d.ts +3 -3
- package/dist/types/bootstrap/init-prompt.d.ts +5 -5
- package/dist/types/cli.configuration-keys.d.ts +32 -0
- package/dist/types/cli.d.ts +8 -4
- package/dist/types/cli.module.d.ts +4 -0
- package/dist/types/commands/build.command.d.ts +3 -3
- package/dist/types/commands/commands.d.ts +6 -0
- package/dist/types/commands/config-init.command.d.ts +18 -0
- package/dist/types/commands/config-print.command.d.ts +8 -3
- package/dist/types/commands/help.command.d.ts +3 -3
- package/dist/types/commands/info.command.d.ts +5 -3
- package/dist/types/commands/init.command.d.ts +3 -3
- package/dist/types/commands/list.command.d.ts +3 -3
- package/dist/types/commands/logs-alias.command.d.ts +14 -0
- package/dist/types/commands/logs.command-options.d.ts +38 -0
- package/dist/types/commands/logs.command.d.ts +31 -0
- package/dist/types/commands/requests-alias.command.d.ts +14 -0
- package/dist/types/commands/requests.command-options.d.ts +8 -0
- package/dist/types/commands/requests.command.d.ts +25 -0
- package/dist/types/commands/start.command.d.ts +3 -3
- package/dist/types/commands/trace-alias.command.d.ts +14 -0
- package/dist/types/commands/trace.command-options.d.ts +31 -0
- package/dist/types/commands/trace.command.d.ts +21 -0
- package/dist/types/config/config-loader.d.ts +15 -3
- package/dist/types/decorators/command-parameter.decorator.d.ts +30 -0
- package/dist/types/decorators/decorators.d.ts +1 -0
- package/dist/types/enums/cli-decorator-metadata-keyname.enum.d.ts +9 -0
- package/dist/types/enums/enums.d.ts +2 -0
- package/dist/types/enums/exit-code.enum.d.ts +4 -0
- package/dist/types/enums/terminal-key-name.enum.d.ts +16 -0
- package/dist/types/errors/cli-error-code.enum.d.ts +12 -2
- package/dist/types/errors/errors.d.ts +1 -0
- package/dist/types/errors/prompt-cancelled.error.d.ts +13 -0
- package/dist/types/event-handlers/cli.event-handler.d.ts +16 -15
- package/dist/types/event-handlers/event-handlers.d.ts +1 -0
- package/dist/types/event-handlers/repl-start.event-handler.d.ts +70 -0
- package/dist/types/event-payloads/event-payloads.d.ts +1 -0
- package/dist/types/event-payloads/start-repl.event-payload.d.ts +13 -0
- package/dist/types/interfaces/interfaces.d.ts +1 -0
- package/dist/types/interfaces/terminal-key.interface.d.ts +11 -0
- package/dist/types/managers/cli-output.manager.d.ts +21 -0
- package/dist/types/managers/cli-progress-bar.manager.d.ts +17 -0
- package/dist/types/managers/cli-prompt.manager.d.ts +79 -0
- package/dist/types/managers/cli-spinner.manager.d.ts +34 -0
- package/dist/types/managers/managers.d.ts +5 -1
- package/dist/types/managers/repl-session.d.ts +62 -0
- package/dist/types/managers/shell.manager.d.ts +3 -3
- package/dist/types/managers/terminal-key-reader.manager.d.ts +31 -0
- package/dist/types/mappers/command-event.mapper.d.ts +10 -1
- package/dist/types/mappers/mappers.d.ts +1 -0
- package/dist/types/mappers/repl-start-event.mapper.d.ts +28 -0
- package/dist/types/options/command-parameter.options.d.ts +29 -0
- package/dist/types/options/options.d.ts +1 -0
- package/dist/types/services/command-argument-resolver.d.ts +24 -0
- package/dist/types/services/command-options-resolver.d.ts +35 -0
- package/dist/types/services/command-parameter-prompter.d.ts +113 -0
- package/dist/types/services/services.d.ts +3 -0
- package/dist/types/types/start-repl-event-response.type.d.ts +10 -0
- package/dist/types/types/types.d.ts +1 -0
- package/dist/types/utils/boolean-answer-parser.d.ts +11 -0
- package/dist/types/utils/pristine-argv.d.ts +33 -0
- package/dist/types/utils/terminal-key-decoder.d.ts +28 -0
- package/package.json +16 -12
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
/**
|
|
3
|
+
* Flags + positional for `pristine logs [<id>] [--event-id <x>] [--trace-id <x>] [--request-id <x>] [--follow|-f]`.
|
|
4
|
+
*
|
|
5
|
+
* Filter the log stream by any of three correlation ids — `--event-id` is canonical,
|
|
6
|
+
* `--trace-id` covers the distributed-tracing case (a propagated `traceparent`),
|
|
7
|
+
* `--request-id` covers HTTP requests with an `x-pristine-request-id` header. A
|
|
8
|
+
* positional id (e.g. `pristine logs abc-123`) is tried against all three.
|
|
9
|
+
*
|
|
10
|
+
* `--follow` and `-f` are accepted as independent boolean keys (that's how
|
|
11
|
+
* `CommandEventMapper` records short-vs-long flags); the `isFollowing` getter combines
|
|
12
|
+
* them so the command body reads a single field.
|
|
13
|
+
*/
|
|
14
|
+
export declare class LogsCommandOptions {
|
|
15
|
+
/** `--event-id <id>`: filter by the canonical event id. */
|
|
16
|
+
"event-id"?: string;
|
|
17
|
+
/** `--trace-id <id>`: filter by the trace id (distributed-tracing scenarios). */
|
|
18
|
+
"trace-id"?: string;
|
|
19
|
+
/** `--request-id <id>`: filter by the request id (HTTP `x-pristine-request-id`). */
|
|
20
|
+
"request-id"?: string;
|
|
21
|
+
/** `--follow`: tail the log stream and render new entries as they arrive. */
|
|
22
|
+
follow?: boolean;
|
|
23
|
+
/** `-f`: short alias for `--follow`. */
|
|
24
|
+
f?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Bare positional tokens. A positional id is tried against all three correlation
|
|
27
|
+
* fields by `LogStore.read(id)` / `LogStore.tail(id, ...)`. Decorators are required
|
|
28
|
+
* for `AutoDataMappingBuilder` to round-trip the field.
|
|
29
|
+
*/
|
|
30
|
+
_?: string[];
|
|
31
|
+
/**
|
|
32
|
+
* Resolves the filter id: an explicit flag wins over the positional, and explicit
|
|
33
|
+
* flags are preferred in `eventId > traceId > requestId` order on the (rare) chance
|
|
34
|
+
* the user passed several.
|
|
35
|
+
*/
|
|
36
|
+
get filterId(): string | undefined;
|
|
37
|
+
get isFollowing(): boolean;
|
|
38
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { ExitCode } from "@pristine-ts/common";
|
|
2
|
+
import { LogStore } from "@pristine-ts/observability";
|
|
3
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
4
|
+
import { CliOutput } from "../managers/cli-output.manager";
|
|
5
|
+
import { LogsCommandOptions } from "./logs.command-options";
|
|
6
|
+
/**
|
|
7
|
+
* Renders captured logs: `pristine logs` for everything (newest first across all
|
|
8
|
+
* processes), `pristine logs <id>` to filter by any of event/trace/request id, or
|
|
9
|
+
* the explicit `--event-id` / `--trace-id` / `--request-id` flags. With `--follow`/`-f`
|
|
10
|
+
* it tails the live writers (Ctrl-C to stop). A pure report command: output goes
|
|
11
|
+
* through `CliOutput`.
|
|
12
|
+
*/
|
|
13
|
+
export declare class LogsCommand implements CommandInterface<LogsCommandOptions> {
|
|
14
|
+
private readonly cliOutput;
|
|
15
|
+
private readonly logStore;
|
|
16
|
+
optionsType: typeof LogsCommandOptions;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
constructor(cliOutput: CliOutput, logStore: LogStore);
|
|
20
|
+
run(args: LogsCommandOptions): Promise<ExitCode | number>;
|
|
21
|
+
/**
|
|
22
|
+
* Tails live writes, rendering each newly-appended line until SIGINT.
|
|
23
|
+
*/
|
|
24
|
+
private followLogs;
|
|
25
|
+
/**
|
|
26
|
+
* Renders one stored log entry through `PrettyLogFormatter`. The store keeps `date`
|
|
27
|
+
* as an ISO string and `severity` as a numeric `SeverityEnum`; rehydrate the date so
|
|
28
|
+
* the formatter (date-fns) can format it.
|
|
29
|
+
*/
|
|
30
|
+
private render;
|
|
31
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExitCode } from "@pristine-ts/common";
|
|
2
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
3
|
+
import { RequestsCommand } from "./requests.command";
|
|
4
|
+
/**
|
|
5
|
+
* Top-level alias for `p:requests`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class RequestsAliasCommand implements CommandInterface<null> {
|
|
8
|
+
private readonly delegate;
|
|
9
|
+
optionsType: null;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(delegate: RequestsCommand);
|
|
13
|
+
run(args: any): Promise<ExitCode | number>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ExitCode } from "@pristine-ts/common";
|
|
2
|
+
import { TraceStore } from "@pristine-ts/observability";
|
|
3
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
4
|
+
import { CliOutput } from "../managers/cli-output.manager";
|
|
5
|
+
import { RequestsCommandOptions } from "./requests.command-options";
|
|
6
|
+
/**
|
|
7
|
+
* Lists recent requests captured in the observability store — the entry point for
|
|
8
|
+
* "what just happened, and what's the event id I want to inspect?".
|
|
9
|
+
*
|
|
10
|
+
* Pulls summaries from every captured process newest-first. A pure report command: all
|
|
11
|
+
* output goes through `CliOutput` so it pipes cleanly.
|
|
12
|
+
*
|
|
13
|
+
* Flags: `--limit <n>` (default 20).
|
|
14
|
+
*/
|
|
15
|
+
export declare class RequestsCommand implements CommandInterface<RequestsCommandOptions> {
|
|
16
|
+
private readonly cliOutput;
|
|
17
|
+
private readonly traceStore;
|
|
18
|
+
optionsType: typeof RequestsCommandOptions;
|
|
19
|
+
name: string;
|
|
20
|
+
description: string;
|
|
21
|
+
private static readonly DEFAULT_LIMIT;
|
|
22
|
+
constructor(cliOutput: CliOutput, traceStore: TraceStore);
|
|
23
|
+
run(args: RequestsCommandOptions): Promise<ExitCode | number>;
|
|
24
|
+
private renderTable;
|
|
25
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ExitCode } from "@pristine-ts/common";
|
|
2
2
|
import { Kernel, RuntimeServerInterface } from "@pristine-ts/core";
|
|
3
|
+
import { LogHandlerInterface } from "@pristine-ts/logging";
|
|
3
4
|
import { CommandInterface } from "../interfaces/command.interface";
|
|
4
|
-
import { ConsoleManager } from "../managers/console.manager";
|
|
5
5
|
import { StartCommandOptions } from "./start.command-options";
|
|
6
6
|
/**
|
|
7
7
|
* Boots the AppModule, starts every registered `RuntimeServerInterface` (HTTP server, gRPC
|
|
@@ -34,7 +34,7 @@ import { StartCommandOptions } from "./start.command-options";
|
|
|
34
34
|
* `nodemon` or `tsx --watch`.
|
|
35
35
|
*/
|
|
36
36
|
export declare class StartCommand implements CommandInterface<StartCommandOptions> {
|
|
37
|
-
private readonly
|
|
37
|
+
private readonly logHandler;
|
|
38
38
|
private readonly kernel;
|
|
39
39
|
private readonly servers;
|
|
40
40
|
optionsType: typeof StartCommandOptions;
|
|
@@ -42,6 +42,6 @@ export declare class StartCommand implements CommandInterface<StartCommandOption
|
|
|
42
42
|
description: string;
|
|
43
43
|
private static readonly HARD_EXIT_TIMEOUT_MS;
|
|
44
44
|
private readonly defaultRuntimeServerName;
|
|
45
|
-
constructor(
|
|
45
|
+
constructor(logHandler: LogHandlerInterface, kernel: Kernel, servers: RuntimeServerInterface[]);
|
|
46
46
|
run(args: StartCommandOptions): Promise<ExitCode | number>;
|
|
47
47
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ExitCode } from "@pristine-ts/common";
|
|
2
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
3
|
+
import { TraceCommand } from "./trace.command";
|
|
4
|
+
/**
|
|
5
|
+
* Top-level alias for `p:trace`.
|
|
6
|
+
*/
|
|
7
|
+
export declare class TraceAliasCommand implements CommandInterface<null> {
|
|
8
|
+
private readonly delegate;
|
|
9
|
+
optionsType: null;
|
|
10
|
+
name: string;
|
|
11
|
+
description: string;
|
|
12
|
+
constructor(delegate: TraceCommand);
|
|
13
|
+
run(args: any): Promise<ExitCode | number>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "reflect-metadata";
|
|
2
|
+
export type TraceFormat = "tree" | "flat" | "json";
|
|
3
|
+
/**
|
|
4
|
+
* Flags + positional for `pristine trace [<id>] [--event-id <x>] [--trace-id <x>] [--request-id <x>] [--format tree|flat|json]`.
|
|
5
|
+
*
|
|
6
|
+
* Look up a trace by any of three correlation ids — `--event-id` is canonical,
|
|
7
|
+
* `--trace-id` covers the distributed-tracing case (a propagated `traceparent`),
|
|
8
|
+
* `--request-id` covers HTTP requests with an `x-pristine-request-id` header. A
|
|
9
|
+
* positional id is tried against all three.
|
|
10
|
+
*/
|
|
11
|
+
export declare class TraceCommandOptions {
|
|
12
|
+
/** `--event-id <id>`: look up by the canonical event id. */
|
|
13
|
+
"event-id"?: string;
|
|
14
|
+
/** `--trace-id <id>`: look up by the trace id (distributed-tracing scenarios). */
|
|
15
|
+
"trace-id"?: string;
|
|
16
|
+
/** `--request-id <id>`: look up by the request id (HTTP `x-pristine-request-id`). */
|
|
17
|
+
"request-id"?: string;
|
|
18
|
+
/** `--format tree|flat|json`: how to render the trace. Defaults to `tree`. */
|
|
19
|
+
format?: TraceFormat;
|
|
20
|
+
/**
|
|
21
|
+
* Bare positional tokens. A positional id is tried against all three correlation
|
|
22
|
+
* fields by `TraceStore.find(id)`. Decorators are required for `AutoDataMappingBuilder`
|
|
23
|
+
* to round-trip the field.
|
|
24
|
+
*/
|
|
25
|
+
_?: string[];
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the lookup id: an explicit flag wins over the positional, and explicit
|
|
28
|
+
* flags are preferred in `eventId > traceId > requestId` order.
|
|
29
|
+
*/
|
|
30
|
+
get lookupId(): string | undefined;
|
|
31
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ExitCode } from "@pristine-ts/common";
|
|
2
|
+
import { TraceStore } from "@pristine-ts/observability";
|
|
3
|
+
import { CommandInterface } from "../interfaces/command.interface";
|
|
4
|
+
import { CliOutput } from "../managers/cli-output.manager";
|
|
5
|
+
import { TraceCommandOptions } from "./trace.command-options";
|
|
6
|
+
/**
|
|
7
|
+
* Renders the span tree of one captured trace. Look it up by any of event/trace/request
|
|
8
|
+
* id — `pristine trace <id>` tries all three, or use the explicit `--event-id`,
|
|
9
|
+
* `--trace-id`, `--request-id` flags.
|
|
10
|
+
*
|
|
11
|
+
* `--format tree|flat|json` controls the rendering (defaults to `tree`).
|
|
12
|
+
*/
|
|
13
|
+
export declare class TraceCommand implements CommandInterface<TraceCommandOptions> {
|
|
14
|
+
private readonly cliOutput;
|
|
15
|
+
private readonly traceStore;
|
|
16
|
+
optionsType: typeof TraceCommandOptions;
|
|
17
|
+
name: string;
|
|
18
|
+
description: string;
|
|
19
|
+
constructor(cliOutput: CliOutput, traceStore: TraceStore);
|
|
20
|
+
run(args: TraceCommandOptions): Promise<ExitCode | number>;
|
|
21
|
+
}
|
|
@@ -3,7 +3,8 @@ import { DynamicImporter } from "../bootstrap/dynamic-importer";
|
|
|
3
3
|
/**
|
|
4
4
|
* Loads `pristine.config.ts` (preferred) or `pristine.config.js` (escape hatch for
|
|
5
5
|
* pure-JS projects). Walks up from `process.cwd()` looking for the file, then loads it
|
|
6
|
-
* through
|
|
6
|
+
* through Node's native dynamic `import()`: TypeScript type-stripping (Node >= 22.18)
|
|
7
|
+
* handles `.ts`, while `.js` loads directly.
|
|
7
8
|
*
|
|
8
9
|
* Returns a `ResolvedPristineConfig` carrying the file path (when found) and per-field
|
|
9
10
|
* provenance, which `pristine p:config:print` uses to render an annotated dump.
|
|
@@ -31,10 +32,21 @@ export declare class ConfigLoader {
|
|
|
31
32
|
*/
|
|
32
33
|
private findConfigFile;
|
|
33
34
|
/**
|
|
34
|
-
* Loads a config file from `absolutePath
|
|
35
|
-
*
|
|
35
|
+
* Loads a config file from `absolutePath` via Node's native dynamic `import()`. A `.ts`
|
|
36
|
+
* config is handled by Node's built-in TypeScript type-stripping (Node >= 22.18); a `.js`
|
|
37
|
+
* config loads directly. Extracts the default export, falling back to a named
|
|
36
38
|
* `pristineConfig` export for users who prefer not to use `export default`.
|
|
37
39
|
* @private
|
|
38
40
|
*/
|
|
39
41
|
private importConfigFile;
|
|
42
|
+
/**
|
|
43
|
+
* Translates Node's low-level module-loading failures for a `.ts` config into an
|
|
44
|
+
* actionable error. Native type-stripping has two distinct failure modes worth telling
|
|
45
|
+
* apart: the running Node is too old (or has stripping disabled) to import `.ts` at all
|
|
46
|
+
* (`ERR_UNKNOWN_FILE_EXTENSION`), versus a config written with non-erasable TypeScript that
|
|
47
|
+
* stripping refuses (`ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX`). Any other error is passed through
|
|
48
|
+
* unchanged so genuine config bugs surface as-is.
|
|
49
|
+
* @private
|
|
50
|
+
*/
|
|
51
|
+
private describeImportError;
|
|
40
52
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { CommandParameterOptions } from "../options/command-parameter.options";
|
|
2
|
+
/**
|
|
3
|
+
* Describes a command-line parameter on a command's options class. Stored as property
|
|
4
|
+
* metadata and read by the CLI while resolving a command's arguments — before the arguments
|
|
5
|
+
* are mapped onto the options instance and validated.
|
|
6
|
+
*
|
|
7
|
+
* Two behaviors flow from the options:
|
|
8
|
+
*
|
|
9
|
+
* - `flag` rebinds the property to a differently-named flag (the property name is the
|
|
10
|
+
* default), so the property and the flag no longer have to be spelled identically.
|
|
11
|
+
* - `question` makes the CLI ask for the value interactively when the flag is absent
|
|
12
|
+
* (subject to configuration and an interactive terminal). Omit it to never prompt.
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* import {IsString, IsOptional} from "@pristine-ts/class-validator";
|
|
16
|
+
* import {commandParameter} from "@pristine-ts/cli";
|
|
17
|
+
*
|
|
18
|
+
* export class MigrateCommandOptions {
|
|
19
|
+
* @commandParameter({flag: "db-url", question: "What is the database URL?"})
|
|
20
|
+
* @IsString()
|
|
21
|
+
* databaseUrl?: string; // bound to --db-url; asked for when missing
|
|
22
|
+
*
|
|
23
|
+
* @commandParameter({flag: "dir"}) // bound to --dir; never asked for
|
|
24
|
+
* @IsOptional()
|
|
25
|
+
* @IsString()
|
|
26
|
+
* migrationsDirectory?: string;
|
|
27
|
+
* }
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
export declare const commandParameter: (options?: CommandParameterOptions) => (target: any, propertyKey: string) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./command-parameter.decorator";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Metadata keynames written by `@pristine-ts/cli`'s own property/class decorators and read
|
|
3
|
+
* back when resolving a command's options. Namespaced under `cli:` so they never collide
|
|
4
|
+
* with the keys other Pristine decorators (validation, data-mapping, mysql, …) store on the
|
|
5
|
+
* same class.
|
|
6
|
+
*/
|
|
7
|
+
export declare enum CliDecoratorMetadataKeynameEnum {
|
|
8
|
+
CommandParameter = "cli:command-parameter"
|
|
9
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The kinds of keypress the CLI's interactive prompts understand. `TerminalKeyDecoder`
|
|
3
|
+
* maps the raw bytes Node delivers from a raw-mode stdin onto one of these; every printable
|
|
4
|
+
* keystroke collapses to `Character` (with the literal character carried separately on
|
|
5
|
+
* {@link TerminalKey}). `Other` covers control/escape sequences the prompts don't act on
|
|
6
|
+
* (function keys, unhandled arrows) so callers can ignore them instead of echoing garbage.
|
|
7
|
+
*/
|
|
8
|
+
export declare enum TerminalKeyName {
|
|
9
|
+
Up = "up",
|
|
10
|
+
Down = "down",
|
|
11
|
+
Enter = "enter",
|
|
12
|
+
Backspace = "backspace",
|
|
13
|
+
CtrlC = "ctrl-c",
|
|
14
|
+
Character = "character",
|
|
15
|
+
Other = "other"
|
|
16
|
+
}
|
|
@@ -3,10 +3,20 @@
|
|
|
3
3
|
* (typed `PristineErrorCode | string`, so any enum value is accepted).
|
|
4
4
|
*
|
|
5
5
|
* Codes here describe CLI-specific failures — command resolution, argument mapping,
|
|
6
|
-
* and
|
|
6
|
+
* argument validation, and command-parameter binding.
|
|
7
7
|
*/
|
|
8
8
|
export declare enum CliErrorCode {
|
|
9
9
|
CommandNotFound = "COMMAND_NOT_FOUND",
|
|
10
10
|
ArgumentMappingFailed = "ARGUMENT_MAPPING_FAILED",
|
|
11
|
-
ArgumentValidationFailed = "ARGUMENT_VALIDATION_FAILED"
|
|
11
|
+
ArgumentValidationFailed = "ARGUMENT_VALIDATION_FAILED",
|
|
12
|
+
/**
|
|
13
|
+
* Two `@commandParameter` properties on the same options class resolve to the same flag.
|
|
14
|
+
* A programming error in the command's options definition, not bad user input.
|
|
15
|
+
*/
|
|
16
|
+
CommandParameterFlagConflict = "COMMAND_PARAMETER_FLAG_CONFLICT",
|
|
17
|
+
/**
|
|
18
|
+
* The user cancelled an interactive prompt with `Ctrl+C`. Carried by
|
|
19
|
+
* `PromptCancelledError` — a clean, user-initiated cancellation, not a failure.
|
|
20
|
+
*/
|
|
21
|
+
PromptCancelled = "PROMPT_CANCELLED"
|
|
12
22
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { PristineError } from "@pristine-ts/common";
|
|
2
|
+
/**
|
|
3
|
+
* Thrown when the user cancels an interactive prompt with `Ctrl+C`. A clean, user-initiated
|
|
4
|
+
* cancellation — not a crash — so it carries `kind: UserError` (the `CliErrorReporter`
|
|
5
|
+
* renders the message verbatim instead of a stack dump) and exit code `130`, following the
|
|
6
|
+
* POSIX `128 + SIGINT(2)` convention so shell pipelines can detect the interrupt.
|
|
7
|
+
*
|
|
8
|
+
* Callers that treat cancellation as a normal branch (e.g. `BuildStalenessPrompt`) catch it
|
|
9
|
+
* via `instanceof`; everywhere else it propagates to the reporter for a tidy exit.
|
|
10
|
+
*/
|
|
11
|
+
export declare class PromptCancelledError extends PristineError {
|
|
12
|
+
constructor();
|
|
13
|
+
}
|
|
@@ -3,26 +3,27 @@ import { CommandEvent } from "../types/command-event.type";
|
|
|
3
3
|
import { CommandEventResponse } from "../types/command-event-response.type";
|
|
4
4
|
import { CommandInterface } from "../interfaces/command.interface";
|
|
5
5
|
import { LogHandlerInterface } from "@pristine-ts/logging";
|
|
6
|
-
import {
|
|
7
|
-
import { ConsoleManager } from "../managers/console.manager";
|
|
6
|
+
import { CommandArgumentResolver } from "../services/command-argument-resolver";
|
|
8
7
|
export declare class CliEventHandler implements EventHandlerInterface<any, any> {
|
|
9
8
|
private readonly logHandler;
|
|
10
|
-
private readonly
|
|
11
|
-
private readonly consoleManager;
|
|
9
|
+
private readonly commandArgumentResolver;
|
|
12
10
|
private readonly commands;
|
|
13
|
-
constructor(logHandler: LogHandlerInterface,
|
|
14
|
-
handle(event: CommandEvent): Promise<CommandEventResponse>;
|
|
11
|
+
constructor(logHandler: LogHandlerInterface, commandArgumentResolver: CommandArgumentResolver, commands: CommandInterface<any>[]);
|
|
15
12
|
/**
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* For commands that opt out of typed options (`optionsType === null`), passes the raw
|
|
20
|
-
* args through unchanged — the legacy escape hatch for commands that want to handle
|
|
21
|
-
* argv parsing themselves.
|
|
13
|
+
* Resolves and runs the command, then **returns** its exit code wrapped in a
|
|
14
|
+
* `CommandEventResponse` — it does not call `process.exit`.
|
|
22
15
|
*
|
|
23
|
-
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
16
|
+
* Process lifecycle is the bin's job: `kernel.handle` resolves with this exit code,
|
|
17
|
+
* `Cli.bootstrap` returns it, and `bin.ts` does the actual `process.exit`. Returning
|
|
18
|
+
* (rather than exiting) is also what lets the interactive REPL dispatch commands
|
|
19
|
+
* through this very handler — `kernel.handle(argv, {keyname: Cli})` per typed line —
|
|
20
|
+
* without the process dying after the first command.
|
|
21
|
+
*/
|
|
22
|
+
handle(event: CommandEvent): Promise<CommandEventResponse>;
|
|
23
|
+
/**
|
|
24
|
+
* Maps + validates a command's raw arguments. Delegates to the shared
|
|
25
|
+
* `CommandArgumentResolver`. Since the REPL dispatches through this same handler, the
|
|
26
|
+
* one-shot CLI and the REPL resolve arguments through identical logic.
|
|
26
27
|
*/
|
|
27
28
|
resolveArgs(command: CommandInterface<any>, rawArgs: any): Promise<any>;
|
|
28
29
|
supports(event: Event<any>): boolean;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { DependencyContainer } from "tsyringe";
|
|
2
|
+
import { Event, EventHandlerInterface, Kernel } from "@pristine-ts/core";
|
|
3
|
+
import { ExitCode } from "@pristine-ts/common";
|
|
4
|
+
import { TraceStore } from "@pristine-ts/observability";
|
|
5
|
+
import { CliOutput } from "../managers/cli-output.manager";
|
|
6
|
+
import { StartReplEventPayload } from "../event-payloads/start-repl.event-payload";
|
|
7
|
+
import { StartReplEventResponse } from "../types/start-repl-event-response.type";
|
|
8
|
+
/**
|
|
9
|
+
* The interactive `pristine` console, modelled as a long-running event handler. Launched
|
|
10
|
+
* when the bin is invoked with no command (or `pristine repl`) — `ReplStartEventMapper`
|
|
11
|
+
* produces a `StartReplEventPayload` and this handler runs the readline loop for the rest
|
|
12
|
+
* of the process lifetime.
|
|
13
|
+
*
|
|
14
|
+
* **Why an event handler.** The REPL is the same shape as `pristine start` (or any
|
|
15
|
+
* long-running command): an EventHandler whose `handle()` doesn't return until the
|
|
16
|
+
* session ends. This gives the CLI bootstrap a uniform shape — `cli.ts` just calls
|
|
17
|
+
* `kernel.handle(argv, {keyname: Cli})` regardless of whether the user invoked a one-shot
|
|
18
|
+
* command or wants the interactive console. There is no driver/handler asymmetry left in
|
|
19
|
+
* the bootstrap; the mapping layer routes argv to the right payload.
|
|
20
|
+
*
|
|
21
|
+
* **Per-line dispatch.** Each typed line is re-entered through `kernel.handle(...,
|
|
22
|
+
* {keyname: Cli})` — using `Kernel` (the proper re-entry seam — it owns trace lifecycle,
|
|
23
|
+
* child container creation, the works). The `Kernel` is `registerInstance`-d into its
|
|
24
|
+
* own container by `Cli.bootstrap()`, so this handler injects it via DI like any other
|
|
25
|
+
* service.
|
|
26
|
+
*
|
|
27
|
+
* Plus the session verbs `/help`, `/clear`, `/exit` handled in-process (they're not
|
|
28
|
+
* commands — they don't re-enter the kernel). Tab-completion is driven by the live
|
|
29
|
+
* command registry and by recent trace ids for `/trace` / `/logs`.
|
|
30
|
+
*/
|
|
31
|
+
export declare class ReplStartEventHandler implements EventHandlerInterface<StartReplEventPayload, ExitCode | number> {
|
|
32
|
+
private readonly kernel;
|
|
33
|
+
private readonly container;
|
|
34
|
+
private readonly cliOutput;
|
|
35
|
+
private readonly traceStore;
|
|
36
|
+
private static readonly PROMPT;
|
|
37
|
+
private static readonly SESSION_VERBS;
|
|
38
|
+
private static readonly TRACE_ID_COMPLETION_LIMIT;
|
|
39
|
+
private commands;
|
|
40
|
+
constructor(kernel: Kernel, container: DependencyContainer, cliOutput: CliOutput, traceStore: TraceStore);
|
|
41
|
+
supports<T>(event: Event<T>): boolean;
|
|
42
|
+
/**
|
|
43
|
+
* Runs the read-eval-print loop until `/exit` or EOF (Ctrl-D). Resolves with the exit
|
|
44
|
+
* code wrapped in a `StartReplEventResponse`; the mapper surfaces that to `Cli.bootstrap`.
|
|
45
|
+
*/
|
|
46
|
+
handle(event: Event<StartReplEventPayload>): Promise<StartReplEventResponse>;
|
|
47
|
+
/**
|
|
48
|
+
* Handles one input line. Returns true when the session should end.
|
|
49
|
+
*/
|
|
50
|
+
private handleLine;
|
|
51
|
+
/**
|
|
52
|
+
* Readline completer. Completes `/`-prefixed command names and session verbs; for
|
|
53
|
+
* `/trace` and `/logs` it completes the trailing token with recent trace ids.
|
|
54
|
+
*/
|
|
55
|
+
private complete;
|
|
56
|
+
private printBanner;
|
|
57
|
+
private printHelp;
|
|
58
|
+
private shutdown;
|
|
59
|
+
/**
|
|
60
|
+
* Enumerates every registered command. Resolved from the per-event child container the
|
|
61
|
+
* kernel handed this handler when it dispatched the REPL-start event — same container
|
|
62
|
+
* `HelpCommand`/`ListCommand` themselves use, so commands that depend on
|
|
63
|
+
* `CurrentChildContainer` resolve cleanly.
|
|
64
|
+
*
|
|
65
|
+
* `resolveAll`, justified: framework REPL infrastructure at session start — enumerating
|
|
66
|
+
* every `Command`-tagged service is a container-introspection operation with no
|
|
67
|
+
* constructor seam.
|
|
68
|
+
*/
|
|
69
|
+
private resolveCommands;
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Payload that signals "launch the interactive REPL." Produced by `ReplStartEventMapper`
|
|
3
|
+
* for argv shapes with no command (`pristine`) or with the explicit `repl` command
|
|
4
|
+
* (`pristine repl`). Consumed by `ReplStartEventHandler` which runs the readline loop
|
|
5
|
+
* for the rest of the process lifetime.
|
|
6
|
+
*
|
|
7
|
+
* The payload carries the `scriptPath` (argv[1]) for parity with `CommandEventPayload`
|
|
8
|
+
* and for diagnostics; the REPL itself reads its input from stdin, not from the payload.
|
|
9
|
+
*/
|
|
10
|
+
export declare class StartReplEventPayload {
|
|
11
|
+
scriptPath: string;
|
|
12
|
+
constructor(scriptPath: string);
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { TerminalKeyName } from "../enums/terminal-key-name.enum";
|
|
2
|
+
/**
|
|
3
|
+
* A single decoded keypress from an interactive terminal. `name` classifies the key;
|
|
4
|
+
* `sequence` is the raw character(s) it produced — meaningful for `Character` keys (the
|
|
5
|
+
* literal typed character, echoed/accumulated by callers) and retained for the rest for
|
|
6
|
+
* diagnostics.
|
|
7
|
+
*/
|
|
8
|
+
export interface TerminalKey {
|
|
9
|
+
name: TerminalKeyName;
|
|
10
|
+
sequence: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipe-friendly stdout primitives for the CLI. Use this when you need to emit text that
|
|
3
|
+
* a user might redirect or pipe — help banners, command tables, JSON dumps — and the
|
|
4
|
+
* `LogHandler` pipeline would be wrong because it can be severity-gated, routed to
|
|
5
|
+
* stderr per-severity, or fanned out to file/Sentry transports. For event narration
|
|
6
|
+
* ("Compiling X", "Server started"), use `LogHandler` instead.
|
|
7
|
+
*/
|
|
8
|
+
export declare class CliOutput {
|
|
9
|
+
/**
|
|
10
|
+
* Writes a message to stdout without a newline.
|
|
11
|
+
*/
|
|
12
|
+
write(message: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Writes a message to stdout with a newline.
|
|
15
|
+
*/
|
|
16
|
+
writeLine(message: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Renders an array of objects as a table using Node's `console.table`.
|
|
19
|
+
*/
|
|
20
|
+
writeTable(rows: any[]): void;
|
|
21
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline progress bar rendered on the current TTY line. Each call clears and redraws
|
|
3
|
+
* the line, so callers must not interleave other output (LogHandler narration, raw
|
|
4
|
+
* CliOutput writes, etc.) between updates or the previous bar will be left behind on
|
|
5
|
+
* the line above.
|
|
6
|
+
*/
|
|
7
|
+
export declare class CliProgressBar {
|
|
8
|
+
private static readonly FILLED;
|
|
9
|
+
private static readonly EMPTY;
|
|
10
|
+
private static readonly CYAN;
|
|
11
|
+
private static readonly RESET;
|
|
12
|
+
/**
|
|
13
|
+
* Renders the progress bar at the current line. When `current >= total` the cursor
|
|
14
|
+
* is advanced to the next line so subsequent output doesn't overwrite the finished bar.
|
|
15
|
+
*/
|
|
16
|
+
update(current: number, total: number, message?: string, width?: number): void;
|
|
17
|
+
}
|