loopbackio / loopbackio/loopback-next
CLI incorrectly assumes non-interactive mode
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 5.1k
- Forks
- 1.1k
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 27
Description
Our CLI app allows users to provide prompt answers in multiple ways:
- Some values can be configured via CLI arguments and options, e.g.
name. - It is possible to provide JSON object with values to all prompts via
--configoption. - It is possible to stream a JSON object to
stdin
At the moment, the logic determining when to read data from stdin is based on process.stdin.isTTY flag. Unfortunately, this is often causing confusing behavior.
- When debugging our CLI tool via Visual Studio Code, application's
stdinstream is in non-TTY mode. As a result, CLI uses different way (code path) to prompt for options. - The outcome of our test suite depends on whether the
stdinstream is available and in TTY mode. When running the tests withstdindisabled (e.g. vianpm test < /dev/null), many of the tests fail.
I would like us to improve the logic deciding how to prompt for options and make it more robust, less suspect to different ways how CLI can be legitimately invoked.
Acceptance Criteria
To be added by the team after discussing with @bajtos.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the CLI logic that decides whether to read JSON from stdin, then inspect the tests that fail when stdin is disabled with npm test < /dev/null. The issue has no acceptance criteria yet, so confirm the intended prompting behavior with the team before changing code; done should include stable behavior across debugging, TTY, and disabled-stdin runs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- cli, testing
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100