feat(inquirerer): add skipPrompt flag to skip prompting for optional fields#68
Merged
pyramation merged 2 commits intomainfrom Mar 5, 2026
Merged
Conversation
…fields Adds skipPrompt?: boolean to BaseQuestion. When set to true: - The question is skipped entirely during interactive prompting - CLI flag overrides still work (--fieldName value) - The field still appears in man pages - The field is simply left out of the answers object if not provided This is useful for fields with backend-managed defaults where the CLI should not prompt the user, but still allow explicit overrides.
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
4 tasks
- Added skipPrompt?: boolean to BaseQuestion docs with usage examples - Added optionsFrom?: string to BaseQuestion docs (was missing) - Added 'Skipping Prompts' section with code examples and key behaviors
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
feat(inquirerer): add
skipPromptflag to skip prompting for optional fieldsSummary
Adds a new
skipPrompt?: booleanproperty toBaseQuestion. When set totrue, the question is entirely skipped during interactive prompting — the field is left out of the answers object unless the user explicitly provides it via a CLI flag (e.g.--status "active").This is designed for generated CLI commands where certain fields have backend-managed defaults. The CLI shouldn't prompt for these fields, but should still allow explicit overrides and include them in man pages.
Changes:
packages/inquirerer/src/question/types.ts— addedskipPrompt?: booleantoBaseQuestionpackages/inquirerer/src/prompt.ts— added skip check in the prompt loop, placed after thewhencallback check and beforeuseDefault, so CLI flag overrides (checked earlier viaquestion.name in obj) still take precedencepackages/inquirerer/__tests__/prompt.test.ts— 5 new tests covering core behavior, CLI override, noTty mode, man page inclusion, and multiple skipped fieldspackages/inquirerer/README.md— updatedBaseQuestioninterface docs, addedskipPromptandoptionsFromproperties, added new "Skipping Prompts" section with usage examples and key behavior notesUpdates since last revision
skipPromptincluding a code example showing basic skip behavior and CLI flag overrideoptionsFrom?: stringproperty to theBaseQuestioninterface in the README (it was already in the TypeScript type but missing from docs)Review & Testing Checklist for Human
required: true+skipPrompt: truein noTty mode — The noTty early-return path (hasMissingRequiredArgs, line 442) runs before the main prompt loop whereskipPromptis checked. If a question has bothrequired: trueandskipPrompt: true, the noTty path could throw "missing required arguments" beforeskipPromptever runs. The existing test (test 3) avoids this by only markingnameas required andstatusas skipPrompt — it does not test a field that is bothrequiredandskipPrompt. Verify this combination is either documented as unsupported or handled.useDefault—skipPromptcheck runs beforeuseDefault. If both are set,skipPromptwins and the default is never applied. Confirm this is the desired behavior.cd packages/inquirerer && npx jest --no-coverage— all 142 tests should pass (5 new skipPrompt tests + 137 existing).optionsFromaddition are accurate and match actual runtime behavior.Notes
constructive-io/constructive, which will emitskipPrompt: truefor fields with backend-managed defaults (separate PR).