Skip to content

Commit 0200347

Browse files
committed
Remove auto v1 migration prompt
1 parent 0402d77 commit 0200347

3 files changed

Lines changed: 33 additions & 39 deletions

File tree

src/mcpm/cli.py

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
usage,
2828
)
2929
from mcpm.commands.share import share
30-
from mcpm.migration import V1ConfigDetector, V1ToV2Migrator
3130
from mcpm.utils.logging_config import setup_logging
3231
from mcpm.utils.rich_click_config import click, get_header_text
3332

@@ -94,19 +93,6 @@ def main(ctx, version, help_flag):
9493
click.rich_click.FOOTER_TEXT = original_footer
9594
return
9695

97-
# Check for v1 configuration and offer migration (even with subcommands)
98-
detector = V1ConfigDetector()
99-
if detector.has_v1_config():
100-
migrator = V1ToV2Migrator()
101-
migration_choice = migrator.show_migration_prompt()
102-
if migration_choice == "migrate":
103-
migrator.migrate_config()
104-
return
105-
elif migration_choice == "start_fresh":
106-
migrator.start_fresh()
107-
# Continue to execute the subcommand
108-
# If "ignore", continue to subcommand without migration
109-
11096
# If no command was invoked, show help with header and footer
11197
if ctx.invoked_subcommand is None:
11298
console.print(get_header_text())

src/mcpm/migration/v1_migrator.py

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,35 @@ def __init__(self, config_dir: Optional[Path] = None):
3535
def _wait_for_keypress(self, message: str):
3636
"""Wait for any key press (cross-platform)"""
3737
import sys
38-
import termios
39-
import tty
38+
39+
try:
40+
import termios
41+
import tty
42+
except ImportError:
43+
termios = None
44+
tty = None
4045

4146
console.print(message, end="")
4247

43-
try:
44-
# Unix/Linux/macOS
45-
fd = sys.stdin.fileno()
46-
old_settings = termios.tcgetattr(fd)
48+
if termios and tty:
49+
try:
50+
# Unix/Linux/macOS
51+
fd = sys.stdin.fileno()
52+
old_settings = termios.tcgetattr(fd)
53+
try:
54+
tty.setraw(fd)
55+
sys.stdin.read(1)
56+
finally:
57+
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
58+
except (AttributeError, termios.error, ValueError, OSError):
59+
input()
60+
else:
4761
try:
48-
tty.setraw(sys.stdin.fileno())
49-
sys.stdin.read(1)
50-
finally:
51-
termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
52-
except (ImportError, AttributeError):
53-
# Windows fallback - use input() which requires Enter
54-
input()
62+
import msvcrt
63+
except ImportError:
64+
input()
65+
else:
66+
msvcrt.getch()
5567

5668
console.print() # Add newline after keypress
5769

tests/test_global_config.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,18 +40,14 @@ def test_list_shows_global_config():
4040

4141
def test_v2_help_shows_global_model():
4242
"""Test that help shows v2.0 global configuration messaging"""
43-
from unittest.mock import patch
44-
45-
# Mock v1 config detection to avoid migration prompt
46-
with patch("mcpm.cli.V1ConfigDetector.has_v1_config", return_value=False):
47-
runner = CliRunner()
48-
result = runner.invoke(main, ["--help"])
49-
50-
assert result.exit_code == 0
51-
assert "global configuration" in result.output.lower()
52-
assert "profile" in result.output.lower()
53-
assert "install" in result.output
54-
assert "run" in result.output
43+
runner = CliRunner()
44+
result = runner.invoke(main, ["--help"])
45+
46+
assert result.exit_code == 0
47+
assert "global configuration" in result.output.lower()
48+
assert "profile" in result.output.lower()
49+
assert "install" in result.output
50+
assert "run" in result.output
5551

5652

5753
def test_deprecated_commands_removed():

0 commit comments

Comments
 (0)