Skip to content

Fix #74: [Bug]: Default docker status is not configured properly for display#75

Closed
itniuma2026 wants to merge 3 commits intogaureshpai:mainfrom
itniuma2026:fix/issue-74
Closed

Fix #74: [Bug]: Default docker status is not configured properly for display#75
itniuma2026 wants to merge 3 commits intogaureshpai:mainfrom
itniuma2026:fix/issue-74

Conversation

@itniuma2026
Copy link
Copy Markdown

@itniuma2026 itniuma2026 commented Mar 22, 2026

Description

Fixed the Docker prompt default value display issue. The confirmation hint was using a truthy check (defaultVal) instead of strict equality (defaultVal === true), causing non-boolean truthy values like strings to incorrectly show (Y/n) instead of (y/N).

Related Issue

Fixes #74

Type of Change

  • Bug fix (non-breaking change addressing an issue)
  • New feature (non-breaking change adding functionality)
  • Breaking change (fix or feature causing existing functionality to break)
  • Documentation update

Testing

  • Manually verified that confirm prompts with default: false now correctly display (y/N)
  • Verified that confirm prompts with default: true still correctly display (Y/n)

Checklist

  • My code follows the project style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Screenshots

N/A - This is a logic fix in the prompt hint selection.

Additional Notes

The fix changes defaultVal ? "(Y/n)" : "(y/N)" to defaultVal === true ? "(Y/n)" : "(y/N)" in src/lib/prompts.js (line 26). This ensures only an explicit boolean true triggers the affirmative hint, while all other values (including truthy non-booleans) default to the negative hint.

Summary by CodeRabbit

  • Bug Fixes
    • Confirmation prompts now correctly display default option indicators (Y/n) vs (y/N) by enforcing stricter boolean handling.
    • Confirmation prompts now include the computed default-value text in the displayed message so the prompt line and default indicator match.
    • Prompt input handling aligned with displayed message for clearer, less confusing confirmation interactions.

The Docker prompt's default value is not properly configured, causing it to display incorrectly when the user accepts the default. The default should be 'N' (No) and should be displayed/selected properly.

Fixes gaureshpai#74
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 22, 2026

📝 Walkthrough

Walkthrough

Confirm prompt behavior in src/lib/prompts.js was tightened: the affirmative hint (Y/n) is shown only when defaultVal === true; other truthy/non-boolean defaults follow (y/N). The prompt now passes displayMessage (including the computed (default: ...) suffix) to ask instead of the raw message.

Changes

Cohort / File(s) Summary
Confirm prompt logic
src/lib/prompts.js
Use strict equality defaultVal === true to choose confirm hint (Y/n) vs (y/N); pass displayMessage (which includes the (default: ...) suffix) to ask so the prompt line matches the displayed default information.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Suggested labels

bug

Poem

🐰 I tweak the prompt with nimble paws,
Only true gets the bold applause,
Defaults now printed as they should,
No fuzzy truth, the display is good,
Hopping joy for clearer laws 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing the bug where Docker status default display wasn't configured properly, directly matching the core issue addressed in the PR.
Description check ✅ Passed The PR description comprehensively follows the template with all major sections completed, including description, related issue, type of change, testing, and checklist items properly filled out.
Linked Issues check ✅ Passed The PR successfully addresses issue #74 by implementing the strict boolean check (defaultVal === true) to ensure confirm prompts display the correct default hint based on actual boolean values rather than truthy/falsy evaluation.
Out of Scope Changes check ✅ Passed All changes in src/lib/prompts.js are directly scoped to fixing the boolean check consistency for the confirm prompt display hint, with no extraneous modifications introduced.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

📋 Issue Planner

Let us write the prompt for your AI agent so you can ship faster (with fewer bugs).

View plan for ticket: #74

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉 Hi @itniuma2026!

Thanks for submitting your first Pull Request!
We’re thrilled to have your contribution and will review it shortly.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 22, 2026

✅ CI/CD Test Results

Overall Status: success


View full workflow run

Copy link
Copy Markdown
Owner

@gaureshpai gaureshpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

The default option is not changing in the display

Thank you for your contribution

@itniuma2026
Copy link
Copy Markdown
Author

Updated the PR description to follow the repository template structure with proper sections (Type of Change, Checklist, Testing, etc.). Code changes remain the same as reviewed.

The confirm prompts now display '(default: Yes)' or '(default: No)' text
in addition to the (Y/n) hint, making the default option much clearer.

Before: ? Do you want to use TypeScript? (Y/n)
After: ? Do you want to use TypeScript? (default: Yes) (Y/n)

Co-Authored-By: Claude Sonnet 4 <noreply@anthropic.com>
@itniuma2026
Copy link
Copy Markdown
Author

Hi @gaureshpai,

I've identified and fixed the issue! The boolean prompts weren't displaying the default values clearly. They only showed (Y/n) or (y/N) instead of explicitly stating (default: Yes) or (default: No).

What was changed

Updated the prompt display in src/lib/prompts.js to use displayMessage instead of message for confirm-type questions.

Before vs After

Before:

? Do you want to use TypeScript? (Y/n)
? Do you want to use Tailwind CSS? (Y/n)
? Do you want to use src directory? (Y/n)

After:

? Do you want to use TypeScript? (default: Yes) (Y/n)
? Do you want to use Tailwind CSS? (default: Yes) (Y/n)
? Do you want to use src directory? (default: Yes) (Y/n)

This makes the default option much clearer and consistent with the documentation. The fix has been pushed to this PR. Please test it and let me know if this resolves the display issue!

@coderabbitai coderabbitai bot added the bug Something isn't working label Mar 24, 2026
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/lib/prompts.js (1)

24-26: Inconsistent boolean check between displayMessage and confirmHint.

Line 24 uses a truthy check (defaultVal ? "Yes" : "No") while line 26 now correctly uses a strict boolean check (defaultVal === true). If a non-boolean truthy value were passed as defaultVal, the prompt would display contradictory hints (e.g., "(default: Yes) (y/N)").

For consistency, apply the same strict check in displayMessage:

♻️ Proposed fix
-  const displayMessage = `${message}${defaultVal !== undefined ? ` (default: ${type === "confirm" ? (defaultVal ? "Yes" : "No") : defaultVal})` : ""} `;
+  const displayMessage = `${message}${defaultVal !== undefined ? ` (default: ${type === "confirm" ? (defaultVal === true ? "Yes" : "No") : defaultVal})` : ""} `;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/prompts.js` around lines 24 - 26, The displayMessage uses a truthy
check for defaultVal while confirmHint uses a strict boolean check, causing
inconsistent output; update the displayMessage construction (the template that
uses `${type === "confirm" ? (defaultVal ? "Yes" : "No") : defaultVal}`) to use
a strict boolean comparison like `defaultVal === true` when type === "confirm"
so both displayMessage and confirmHint evaluate booleans the same way and
non-boolean truthy defaults no longer produce contradictory hints.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@src/lib/prompts.js`:
- Around line 24-26: The displayMessage uses a truthy check for defaultVal while
confirmHint uses a strict boolean check, causing inconsistent output; update the
displayMessage construction (the template that uses `${type === "confirm" ?
(defaultVal ? "Yes" : "No") : defaultVal}`) to use a strict boolean comparison
like `defaultVal === true` when type === "confirm" so both displayMessage and
confirmHint evaluate booleans the same way and non-boolean truthy defaults no
longer produce contradictory hints.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d085171d-76ea-45ae-87ea-0aac31390bb1

📥 Commits

Reviewing files that changed from the base of the PR and between 2dce405 and 04eea3f.

📒 Files selected for processing (1)
  • src/lib/prompts.js
📜 Review details
🔇 Additional comments (1)
src/lib/prompts.js (1)

29-31: LGTM!

Using displayMessage ensures the explicit default indicator (e.g., "(default: No)") is shown alongside the (Y/n) or (y/N) hint, making the prompt clearer for users.

Make displayMessage use strict boolean check (defaultVal === true) to match confirmHint behavior and prevent contradictory hints when non-boolean truthy values are passed as defaultVal.
@itniuma2026
Copy link
Copy Markdown
Author

Perfect catch by CodeRabbit! I've fixed the boolean check inconsistency.

Issue Identified

CodeRabbit correctly identified that displayMessage and confirmHint were using different boolean evaluation methods:

  • displayMessage (line 24): used truthy check (defaultVal ? "Yes" : "No")
  • confirmHint (line 26): used strict boolean check (defaultVal === true)

This could cause contradictory hints like "(default: Yes) (y/N)" when non-boolean truthy values are passed as defaultVal.

Fix Applied

Updated line 24 to use the same strict boolean comparison:

// BEFORE:
const displayMessage = `${message}${defaultVal !== undefined ? ` (default: ${type === "confirm" ? (defaultVal ? "Yes" : "No") : defaultVal})` : ""} `;

// AFTER:
const displayMessage = `${message}${defaultVal !== undefined ? ` (default: ${type === "confirm" ? (defaultVal === true ? "Yes" : "No") : defaultVal})` : ""} `;

Now both displayMessage and confirmHint use defaultVal === true, ensuring consistent behavior where only explicit boolean true shows "Yes/(Y/n)" and all other values show "No/(y/N)".

The fix has been pushed and should resolve the consistency concern!

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/lib/prompts.js (1)

33-35: ⚠️ Potential issue | 🟠 Major

Normalize confirm default result to boolean on Enter.

On empty input, Line [34] returns raw defaultVal. If defaultVal is a truthy string (e.g., "false"), the answer is not boolean and can be misinterpreted downstream as enabled.

💡 Proposed fix
       if (trimmed === "") {
-        answer = defaultVal !== undefined ? defaultVal : false;
+        answer = defaultVal === true;
         break;
       }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/prompts.js` around lines 33 - 35, The confirm prompt currently
assigns answer = defaultVal (which may be a truthy string like "false") when
trimmed input is empty, causing non-boolean results; update the logic in the
confirm handler (the block where trimmed === "" sets answer) to coerce
defaultVal to an actual boolean (e.g., answer = Boolean(defaultVal) or compare
defaultVal to the string "false"/"true") so that answer is always true/false
rather than a raw string.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/lib/prompts.js`:
- Around line 24-30: displayMessage currently always appends a "(default: ...)"
suffix which causes duplicate default text for confirm prompts because
confirmHint and the original message may already include it; update the
displayMessage construction to only add the "(default: ...)" suffix when
defaultVal is defined AND type !== "confirm" (or when the message does not
already contain "(default:"), so in the code that builds displayMessage change
the condition to skip adding the default for confirm prompts (referencing
displayMessage, confirmHint, ask and the type === "confirm" branch).

---

Outside diff comments:
In `@src/lib/prompts.js`:
- Around line 33-35: The confirm prompt currently assigns answer = defaultVal
(which may be a truthy string like "false") when trimmed input is empty, causing
non-boolean results; update the logic in the confirm handler (the block where
trimmed === "" sets answer) to coerce defaultVal to an actual boolean (e.g.,
answer = Boolean(defaultVal) or compare defaultVal to the string "false"/"true")
so that answer is always true/false rather than a raw string.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 43d36e3a-d20e-4a42-a2ec-4fb5e03093a2

📥 Commits

Reviewing files that changed from the base of the PR and between 04eea3f and 0c55971.

📒 Files selected for processing (1)
  • src/lib/prompts.js
📜 Review details
🔇 Additional comments (1)
src/lib/prompts.js (1)

26-26: Strict boolean check for confirm hint is a good fix.

defaultVal === true ? "(Y/n)" : "(y/N)" correctly prevents truthy non-boolean values from showing the affirmative hint.

Comment on lines +24 to +30
const displayMessage = `${message}${defaultVal !== undefined ? ` (default: ${type === "confirm" ? (defaultVal === true ? "Yes" : "No") : defaultVal})` : ""} `;

const confirmHint = defaultVal ? "(Y/n)" : "(y/N)";
const confirmHint = defaultVal === true ? "(Y/n)" : "(y/N)";
if (type === "confirm") {
while (true) {
const input = await ask(
`${chalk.green("?")} ${chalk.bold(message)} ${chalk.dim(confirmHint)} `,
`${chalk.green("?")} ${chalk.bold(displayMessage)} ${chalk.dim(confirmHint)} `,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Avoid duplicate (default: ...) text in confirm prompts.

Line [24] appends (default: ...), and Line [30] now renders displayMessage. In src/create-next-quick.js Line [240]-[243], the message already contains (default: Yes), so this can render duplicate suffixes.

💡 Proposed fix
-  const displayMessage = `${message}${defaultVal !== undefined ? ` (default: ${type === "confirm" ? (defaultVal === true ? "Yes" : "No") : defaultVal})` : ""} `;
+  const hasDefaultSuffix = /\(default:\s*[^)]+\)/i.test(message);
+  const displayMessage = `${message}${
+    defaultVal !== undefined && !hasDefaultSuffix
+      ? ` (default: ${type === "confirm" ? (defaultVal === true ? "Yes" : "No") : defaultVal})`
+      : ""
+  } `;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const displayMessage = `${message}${defaultVal !== undefined ? ` (default: ${type === "confirm" ? (defaultVal === true ? "Yes" : "No") : defaultVal})` : ""} `;
const confirmHint = defaultVal ? "(Y/n)" : "(y/N)";
const confirmHint = defaultVal === true ? "(Y/n)" : "(y/N)";
if (type === "confirm") {
while (true) {
const input = await ask(
`${chalk.green("?")} ${chalk.bold(message)} ${chalk.dim(confirmHint)} `,
`${chalk.green("?")} ${chalk.bold(displayMessage)} ${chalk.dim(confirmHint)} `,
const hasDefaultSuffix = /\(default:\s*[^)]+\)/i.test(message);
const displayMessage = `${message}${
defaultVal !== undefined && !hasDefaultSuffix
? ` (default: ${type === "confirm" ? (defaultVal === true ? "Yes" : "No") : defaultVal})`
: ""
} `;
const confirmHint = defaultVal === true ? "(Y/n)" : "(y/N)";
if (type === "confirm") {
while (true) {
const input = await ask(
`${chalk.green("?")} ${chalk.bold(displayMessage)} ${chalk.dim(confirmHint)} `,
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/lib/prompts.js` around lines 24 - 30, displayMessage currently always
appends a "(default: ...)" suffix which causes duplicate default text for
confirm prompts because confirmHint and the original message may already include
it; update the displayMessage construction to only add the "(default: ...)"
suffix when defaultVal is defined AND type !== "confirm" (or when the message
does not already contain "(default:"), so in the code that builds displayMessage
change the condition to skip adding the default for confirm prompts (referencing
displayMessage, confirmHint, ask and the type === "confirm" branch).

Copy link
Copy Markdown
Owner

@gaureshpai gaureshpai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

redundancy in default: Yes

Expected behavior:
If default is the value then display the option Yes

Current behavior:
Re prints default: Yes

@Oranquelui
Copy link
Copy Markdown

I prepared a follow-up fix locally for the regression introduced by rendering displayMessage in confirm prompts.

Changes covered:

  • Avoid appending (default: ...) when the incoming message already includes a default suffix.
  • Normalize empty confirm answers to a boolean so confirm prompts do not return raw string defaults.
  • Add regression tests for both behaviors.

Validation used:

  • COREPACK_ENABLE_AUTO_PIN=0 pnpm exec biome check src/lib/prompts.js src/test/test.js
  • COREPACK_ENABLE_AUTO_PIN=0 pnpm test

I could not push this commit directly to fix/issue-74 from my current account because GitHub returned a 403 on the contributor fork, so the branch still needs to be updated manually.

@gaureshpai
Copy link
Copy Markdown
Owner

@Oranquelui would appreciate a PR on this

@itniuma2026 any updates?

@Oranquelui
Copy link
Copy Markdown

I could not push directly to the contributor fork, so I opened a follow-up PR with the validated fix here:

This follow-up includes the duplicate default-label fix, confirm default normalization, and regression coverage.

@itniuma2026
Copy link
Copy Markdown
Author

Hi @gaureshpai, thanks for following up!

@Oranquelui has already opened #78 with a more comprehensive fix that builds on the work here — it includes duplicate default-label prevention, confirm default normalization, and regression tests.

I'd recommend merging #78 instead, as it covers the remaining edge cases. Happy to close this PR in favor of that one if you agree. Let me know!

@gaureshpai
Copy link
Copy Markdown
Owner

LGTM! Thank you for your contributions. Do consider checking out other issues to work on!

@gaureshpai gaureshpai closed this Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Default docker status is not configured properly for display

3 participants