🎨 Palette: Improve interactive CLI prompts with helpful hints#114
🎨 Palette: Improve interactive CLI prompts with helpful hints#114
Conversation
- Added a direct link to the Control D account page when prompting for the API Token. - Added a hint about where to find the Profile ID when prompting for it. - Improved the new user experience by reducing friction during initial setup.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
😎 Merged manually by Abhi Mehrotra (@abhimehro) - details. |
| captured = capsys.readouterr() | ||
| stdout = captured.out | ||
|
|
||
| assert "You can find this in the URL of your profile" in stdout |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| stdout = captured.out | ||
|
|
||
| assert "You can find this in the URL of your profile" in stdout | ||
| assert "https://controld.com/account/manage-account" in stdout |
Check notice
Code scanning / Bandit
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| captured = capsys.readouterr() | ||
| stdout = captured.out | ||
|
|
||
| assert "You can find this in the URL of your profile" in stdout |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| stdout = captured.out | ||
|
|
||
| assert "You can find this in the URL of your profile" in stdout | ||
| assert "https://controld.com/account/manage-account" in stdout |
Check notice
Code scanning / Bandit (reported by Codacy)
Use of assert detected. The enclosed code will be removed when compiling to optimised byte code. Note test
| if not args.dry_run and sys.stdin.isatty(): | ||
| if not profile_ids: | ||
| print(f"{Colors.CYAN}ℹ Profile ID is missing.{Colors.ENDC}") | ||
| print(f"{Colors.CYAN} You can find this in the URL of your profile in the Control D Dashboard.{Colors.ENDC}") |
Check warning
Code scanning / Pylint (reported by Codacy)
Line too long (122/100) Warning
|
|
||
| if not TOKEN: | ||
| print(f"{Colors.CYAN}ℹ API Token is missing.{Colors.ENDC}") | ||
| print(f"{Colors.CYAN} You can generate one at: https://controld.com/account/manage-account{Colors.ENDC}") |
Check warning
Code scanning / Pylint (reported by Codacy)
Line too long (118/100) Warning
| assert "\033[" in combined_output | ||
|
|
||
| # Case 6: Interactive prompts show helpful hints | ||
| def test_interactive_prompts_show_hints(monkeypatch, capsys): |
Check warning
Code scanning / Pylint (reported by Codacy)
Missing function docstring Warning test
| monkeypatch.delenv("TOKEN", raising=False) | ||
|
|
||
| # Reload main with isatty=True to trigger interactive mode logic | ||
| m = reload_main_with_env(monkeypatch, isatty=True) |
Check warning
Code scanning / Pylint (reported by Codacy)
Variable name "m" doesn't conform to snake_case naming style Warning test
| if not args.dry_run and sys.stdin.isatty(): | ||
| if not profile_ids: | ||
| print(f"{Colors.CYAN}ℹ Profile ID is missing.{Colors.ENDC}") | ||
| print(f"{Colors.CYAN} You can find this in the URL of your profile in the Control D Dashboard.{Colors.ENDC}") |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Line too long (122/100) Warning
|
|
||
| if not TOKEN: | ||
| print(f"{Colors.CYAN}ℹ API Token is missing.{Colors.ENDC}") | ||
| print(f"{Colors.CYAN} You can generate one at: https://controld.com/account/manage-account{Colors.ENDC}") |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Line too long (118/100) Warning
| assert "\033[" in combined_output | ||
|
|
||
| # Case 6: Interactive prompts show helpful hints | ||
| def test_interactive_prompts_show_hints(monkeypatch, capsys): |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Missing function or method docstring Warning test
| monkeypatch.delenv("TOKEN", raising=False) | ||
|
|
||
| # Reload main with isatty=True to trigger interactive mode logic | ||
| m = reload_main_with_env(monkeypatch, isatty=True) |
Check warning
Code scanning / Pylintpython3 (reported by Codacy)
Variable name "m" doesn't conform to snake_case naming style Warning test
There was a problem hiding this comment.
Pull request overview
This PR improves the user experience of the CLI tool by adding contextual hints to interactive credential prompts. When Profile ID or API Token are missing, the tool now displays helpful messages directing users to where they can find or generate these credentials, reducing setup friction for new users.
Changes:
- Added informational hints to Profile ID and API Token prompts with direct URLs to help users locate credentials
- Added test coverage to verify the hints are displayed in interactive mode
- Documented the learning pattern in the project's palette documentation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| main.py | Added two hint messages (lines 811 and 818) providing contextual help for Profile ID and API Token prompts with direct URLs |
| test_main.py | Added new test case to verify interactive prompts display the helpful hints correctly |
| .Jules/palette.md | Added documentation about the CLI prompt improvement pattern for future reference |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
💡 What: Added helpful hints and a direct URL to the interactive prompts for Profile ID and API Token.
🎯 Why: To help new users easily locate their credentials without needing to search through documentation, reducing setup friction.
📸 Before/After:
Enter Control D API Token:♿ Accessibility: N/A (CLI text improvement)
PR created automatically by Jules for task 15106567699088137186 started by @abhimehro