Skip to content

refactor(cli): add shared warn() helper, unify warning stream - #1843

Open
sloemo01 wants to merge 1 commit into
repowise-dev:mainfrom
sloemo01:refactor/shared-warn
Open

refactor(cli): add shared warn() helper, unify warning stream#1843
sloemo01 wants to merge 1 commit into
repowise-dev:mainfrom
sloemo01:refactor/shared-warn

Conversation

@sloemo01

Copy link
Copy Markdown
Contributor

Fixes #1368

Adds a shared warn() helper to repowise.cli.helpers that prints the yellow Warning: prefix to err_console (stderr), and routes every CLI warning site through it so warnings unify on the stderr stream instead of being split across console/stdout and err_console.

Sites updated:

  • helpers.py_persist_provider_key env-save failure, resolve_provider config validation warnings
  • worktree.py--include-submodules state conflict
  • reindex_cmd.py — embed/skip failures
  • init_cmd/command.py — local-provider concurrency warning
  • workspace_cmd.py — indexing failure
  • mcp_cmd.py — missing .repowise directory

Behavior is unchanged (still a yellow Warning: prefix), only the destination stream is normalized to stderr. Adds TestWarn unit tests asserting warnings land on stderr with the prefix and nothing leaks to stdout.

@repowise-bot

repowise-bot Bot commented Aug 22, 2026

Copy link
Copy Markdown

✅ Health of changed files: 2.6 (unchanged)

📋 At a glance
5 hotspots touched · 4 co-change pairs left out · 5 files with recent fix history.

Files & modules (2)
  • packages (5 files)
    • .../commands/mcp_cmd.py
    • .../init_cmd/command.py
    • .../commands/workspace_cmd.py
    • .../cli/helpers.py
    • .../commands/reindex_cmd.py
  • tests (1 file)
    • .../cli/test_helpers.py

✅ Health gate: passed

📌 Before you merge

  • Run .../cli/test_edenai_reachability.py, .../cli/test_editor_setup.py, .../cli/test_health_rescore_gate.py, tests/unit/test_release_manifests.py (+10 more): they import the changed files
  • .../init_cmd/workspace.py changed together with .../init_cmd/command.py in 22 past commits and isn't in this PR
  • .../ui/mode_selection.py changed together with .../init_cmd/command.py in 12 past commits and isn't in this PR
  • .../update_cmd/command.py changed together with .../init_cmd/command.py in 10 past commits and isn't in this PR
  • ...and 1 more co-change partner not in this PR
  • Docs that usually track this code: docs/reference/CLI_REFERENCE.md
🔎 More signals (3)

🗺️ Change map

flowchart LR
  subgraph PR ["Changed in this PR (7 with dependents)"]
    f_packages_cli_src_repowise_cli_commands_init_cmd_command_py[".../init_cmd/command.py 🔥"]:::changed
    f_packages_cli_src_repowise_cli_commands_mcp_cmd_py[".../commands/mcp_cmd.py 🔥"]:::changed
    f_packages_cli_src_repowise_cli_commands_workspace_cmd_py[".../commands/workspace_cmd.py 🔥"]:::changed
    f_packages_cli_src_repowise_cli_helpers_py[".../cli/helpers.py 🔥"]:::changed
    f_packages_cli_src_repowise_cli_commands_reindex_cmd_py[".../commands/reindex_cmd.py"]:::changed
    f_packages_cli_src_repowise_cli_worktree_py[".../cli/worktree.py"]:::changed
    f_tests_unit_cli_test_helpers_py[".../cli/test_helpers.py"]:::changed
  end
  f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py[".../doctor_cmd/repo_checks.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
  f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py[".../generate_cmd/command.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
  f_packages_cli_src_repowise_cli_commands_hook_cmd_py[".../commands/hook_cmd.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_hook_cmd_py
  f_packages_cli_src_repowise_cli_commands_init_cmd___init___py[".../init_cmd/__init__.py"]
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py --> f_packages_cli_src_repowise_cli_commands_init_cmd___init___py
  f_packages_cli_src_repowise_cli_commands_workspace_cmd_py --> f_packages_cli_src_repowise_cli_commands_hook_cmd_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py[".../init_cmd/generation.py"]
  f_packages_cli_src_repowise_cli_commands_workspace_cmd_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_generation_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_persistence_py[".../init_cmd/persistence.py"]
  f_packages_cli_src_repowise_cli_commands_workspace_cmd_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_persistence_py
  f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py[".../init_cmd/workspace.py"]
  f_packages_cli_src_repowise_cli_commands_workspace_cmd_py --> f_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
  f_packages_cli_src_repowise_cli__repo_session_py[".../cli/_repo_session.py"]
  f_packages_cli_src_repowise_cli_helpers_py --> f_packages_cli_src_repowise_cli__repo_session_py
  f_packages_cli_src_repowise_cli_commands__tool_adapters_py[".../commands/_tool_adapters.py"]
  f_packages_cli_src_repowise_cli_helpers_py --> f_packages_cli_src_repowise_cli_commands__tool_adapters_py
  f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_commands_doctor_cmd_repo_checks_py
  f_packages_cli_src_repowise_cli_commands_reindex_cmd_py --> f_packages_cli_src_repowise_cli_commands_generate_cmd_command_py
  more(["+69 more dependents"])
  PR --> more
  w_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py(["⚠️ .../init_cmd/workspace.py changed together 22×, not in PR"]):::warn
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_commands_init_cmd_workspace_py
  w_packages_cli_src_repowise_cli_ui_mode_selection_py(["⚠️ .../ui/mode_selection.py changed together 12×, not in PR"]):::warn
  f_packages_cli_src_repowise_cli_commands_init_cmd_command_py -.- w_packages_cli_src_repowise_cli_ui_mode_selection_py
  t_tests_unit_cli_test_edenai_reachability_py(["✅ .../cli/test_edenai_reachability.py"]):::guard
  t_tests_unit_cli_test_edenai_reachability_py -.-> f_packages_cli_src_repowise_cli_commands_init_cmd_command_py
  t_tests_unit_test_release_manifests_py(["✅ tests/unit/test_release_manifests.py"]):::guard
  t_tests_unit_test_release_manifests_py -.-> f_packages_cli_src_repowise_cli_commands_mcp_cmd_py
  t_tests_unit_cli_test_distill_verdict_fingerprint_py(["✅ .../cli/test_distill_verdict_fingerprint.py"]):::guard
  t_tests_unit_cli_test_distill_verdict_fingerprint_py -.-> f_packages_cli_src_repowise_cli_commands_workspace_cmd_py
  classDef changed fill:#dbeafe,stroke:#1d4ed8,color:#1e3a5f
  classDef warn fill:#fef3c7,stroke:#b45309,color:#78350f
  classDef guard fill:#dcfce7,stroke:#15803d,color:#14532d
Loading

Solid arrows: code that imports the changed files (78 direct dependents, from the last indexed snapshot). Dashed: history/tests.

🔥 Hotspots touched (5)

  • .../commands/mcp_cmd.py: 9 commits/90d, 1 dependents · primary owner: Raghav Chamadiya (45%)
  • .../init_cmd/command.py: 54 commits/90d, 8 dependents · primary owner: Raghav Chamadiya (92%)
  • .../cli/test_helpers.py: 11 commits/90d, 2 dependents · primary owner: Raghav Chamadiya (54%)
2 more
  • .../commands/workspace_cmd.py: 23 commits/90d, 14 dependents · primary owner: Raghav Chamadiya (96%)
  • .../cli/helpers.py: 39 commits/90d, 113 dependents · primary owner: Raghav Chamadiya (83%)

🔗 Hidden coupling (1 file)

  • .../init_cmd/command.py co-changes with these files (not in this PR):
    • .../init_cmd/workspace.py (22×, 🔴 strong)
    • .../ui/mode_selection.py (12×, 🟡 notable)
    • .../update_cmd/command.py (10×, 🟡 notable)
    • .../init_cmd/generation.py (10×, 🟡 notable)

👀 Suggested reviewers @RaghavChamadiya


📊 See the full report for this PR
Your repo map with this PR's blast radius lit up, every caller of the contracts it changes, and health before and after. No sign-in. · ⭐ Star Repowise · 📥 Install bot · Silence on a single PR with [skip repowise] in the title · Per-repo toggle on repowise.dev/settings?tab=bot · Updated 2026-08-22 14:07 UTC

@Ayush7614 Ayush7614 left a comment

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.

Verified: packages/cli/src/repowise/cli/helpers.py:1 adds shared warn() → err_console (stderr) with yellow Warning prefix, and all sites routed through it (#1368). Unifies stream split (was console vs err_console). TestWarn asserts stderr + prefix, nothing on stdout. No behavior change, no extra code — LGTM.

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.

cli: add a shared warn() helper and unify console vs err_console warning stream

2 participants