Skip to content

feat(inquirerer): add skipPrompt flag to skip prompting for optional fields#68

Merged
pyramation merged 2 commits intomainfrom
devin/1772748045-add-skip-prompt
Mar 5, 2026
Merged

feat(inquirerer): add skipPrompt flag to skip prompting for optional fields#68
pyramation merged 2 commits intomainfrom
devin/1772748045-add-skip-prompt

Conversation

@pyramation
Copy link
Contributor

@pyramation pyramation commented Mar 5, 2026

feat(inquirerer): add skipPrompt flag to skip prompting for optional fields

Summary

Adds a new skipPrompt?: boolean property to BaseQuestion. When set to true, 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 — added skipPrompt?: boolean to BaseQuestion
  • packages/inquirerer/src/prompt.ts — added skip check in the prompt loop, placed after the when callback check and before useDefault, so CLI flag overrides (checked earlier via question.name in obj) still take precedence
  • packages/inquirerer/__tests__/prompt.test.ts — 5 new tests covering core behavior, CLI override, noTty mode, man page inclusion, and multiple skipped fields
  • packages/inquirerer/README.md — updated BaseQuestion interface docs, added skipPrompt and optionsFrom properties, added new "Skipping Prompts" section with usage examples and key behavior notes

Updates since last revision

  • Added README documentation for skipPrompt including a code example showing basic skip behavior and CLI flag override
  • Also added the previously-undocumented optionsFrom?: string property to the BaseQuestion interface in the README (it was already in the TypeScript type but missing from docs)

Review & Testing Checklist for Human

  • Edge case: required: true + skipPrompt: true in noTty mode — The noTty early-return path (hasMissingRequiredArgs, line 442) runs before the main prompt loop where skipPrompt is checked. If a question has both required: true and skipPrompt: true, the noTty path could throw "missing required arguments" before skipPrompt ever runs. The existing test (test 3) avoids this by only marking name as required and status as skipPrompt — it does not test a field that is both required and skipPrompt. Verify this combination is either documented as unsupported or handled.
  • Interaction with useDefaultskipPrompt check runs before useDefault. If both are set, skipPrompt wins and the default is never applied. Confirm this is the desired behavior.
  • Run tests locallycd packages/inquirerer && npx jest --no-coverage — all 142 tests should pass (5 new skipPrompt tests + 137 existing).
  • README accuracy — Verify the new "Skipping Prompts" section and the optionsFrom addition are accurate and match actual runtime behavior.

Notes

  • Link to Devin Session
  • Requested by @pyramation
  • The downstream consumer of this flag will be the CLI codegen in constructive-io/constructive, which will emit skipPrompt: true for fields with backend-managed defaults (separate PR).

…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-integration
Copy link

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

- 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
@pyramation pyramation merged commit c598dbc into main Mar 5, 2026
36 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant