Skip to content

fix: make Java init respect --yes flag for non-interactive mode#1952

Closed
mashraf-222 wants to merge 2 commits intomainfrom
cf-1086-java-init-yes-flag
Closed

fix: make Java init respect --yes flag for non-interactive mode#1952
mashraf-222 wants to merge 2 commits intomainfrom
cf-1086-java-init-yes-flag

Conversation

@mashraf-222
Copy link
Copy Markdown
Contributor

Problem

codeflash init --yes for Java projects still prompts interactively. The --yes flag is defined in the CLI argument parser (cli.py:502) but never consumed by any init function — init_java_project() always calls should_modify_java_config() and collect_java_setup_info() which use Confirm.ask() and inquirer.prompt().

Root Cause

init_java_project() has no non_interactive parameter. The --yes flag from parse_args() is never threaded through main.pyinit_codeflash()init_java_project().

Fix

  1. main.py: Pass args.yes to init_codeflash(non_interactive=...)
  2. cmd_init.py: Thread non_interactive to init_java_project()
  3. init_java.py: When non_interactive=True, skip should_modify_java_config() and collect_java_setup_info() (both interactive), use JavaSetupInfo() defaults (all auto-detected values)

Validation

  • Unit tests confirm non-interactive mode uses auto-detected defaults and skips interactive prompts
  • uv run pytest tests/test_init_java.py -v — 2 tests pass

Test Coverage

  • tests/test_init_java.py (new) — TestInitJavaNonInteractive with 2 tests:
    • test_non_interactive_skips_prompts_and_uses_auto_detected — verifies auto-detected JavaSetupInfo defaults
    • test_non_interactive_skips_should_modify_check — verifies should_modify_java_config is not called

Closes CF-1086

The --yes CLI flag was defined but never consumed by init_java_project().
Thread non_interactive through main.py → init_codeflash() → init_java_project()
so that when --yes is set, auto-detected defaults are used without prompts.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Apr 1, 2026

Claude encountered an error —— View job


I'll analyze this and get back to you.

@HeshamHM28 HeshamHM28 closed this Apr 9, 2026
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.

2 participants