|
11 | 11 | import typer |
12 | 12 |
|
13 | 13 | from codegen.cli.api.endpoints import API_ENDPOINT |
14 | | -from codegen.cli.auth.token_manager import get_current_token |
| 14 | +from codegen.cli.auth.token_manager import get_current_org_name, get_current_token |
15 | 15 | from codegen.cli.commands.agent.main import pull |
16 | 16 | from codegen.cli.utils.org import resolve_org_id |
17 | 17 | from codegen.cli.utils.url import generate_webapp_url, get_domain |
@@ -57,6 +57,23 @@ def _signal_handler(self, signum, frame): |
57 | 57 | print("\n") # Just add a newline and exit |
58 | 58 | sys.exit(0) |
59 | 59 |
|
| 60 | + def _format_status_line(self, left_text: str) -> str: |
| 61 | + """Format status line with instructions and org info on a new line below.""" |
| 62 | + # Get organization name |
| 63 | + org_name = get_current_org_name() |
| 64 | + if not org_name: |
| 65 | + org_name = f"Org {self.org_id}" if hasattr(self, "org_id") and self.org_id else "No Org" |
| 66 | + |
| 67 | + # Use the same purple color as the Codegen logo |
| 68 | + purple_color = "\033[38;2;82;19;217m" |
| 69 | + reset_color = "\033[0m" |
| 70 | + |
| 71 | + # Return instructions on first line, org on second line (bottom left) |
| 72 | + instructions_line = f"\033[90m{left_text}\033[0m" |
| 73 | + org_line = f"{purple_color}• {org_name}{reset_color}" |
| 74 | + |
| 75 | + return f"{instructions_line}\n{org_line}" |
| 76 | + |
60 | 77 | def _load_agent_runs(self) -> bool: |
61 | 78 | """Load the last 10 agent runs.""" |
62 | 79 | if not self.token or not self.org_id: |
@@ -635,17 +652,17 @@ def _clear_and_redraw(self): |
635 | 652 |
|
636 | 653 | # Show appropriate instructions based on context |
637 | 654 | if self.input_mode and self.current_tab == 1: # new tab input mode |
638 | | - print("\n\033[90mType your prompt • [Enter] create • [Esc] cancel • [Tab] switch tabs • [Ctrl+C] quit\033[0m") |
| 655 | + print(f"\n{self._format_status_line('Type your prompt • [Enter] create • [Esc] cancel • [Tab] switch tabs • [Ctrl+C] quit')}") |
639 | 656 | elif self.input_mode: # other input modes |
640 | | - print("\n\033[90mType your prompt • [Enter] create • [Esc] cancel • [Ctrl+C] quit\033[0m") |
| 657 | + print(f"\n{self._format_status_line('Type your prompt • [Enter] create • [Esc] cancel • [Ctrl+C] quit')}") |
641 | 658 | elif self.show_action_menu: |
642 | | - print("\n\033[90m[Enter] select • [↑↓] navigate • [C] close • [Q] quit\033[0m") |
| 659 | + print(f"\n{self._format_status_line('[Enter] select • [↑↓] navigate • [C] close • [Q] quit')}") |
643 | 660 | elif self.current_tab == 0: # recents |
644 | | - print("\n\033[90m[Tab] switch tabs • (↑↓) navigate • (←→) open/close • [Enter] actions • [R] refresh • [Q] quit\033[0m") |
| 661 | + print(f"\n{self._format_status_line('[Tab] switch tabs • (↑↓) navigate • (←→) open/close • [Enter] actions • [R] refresh • [Q] quit')}") |
645 | 662 | elif self.current_tab == 1: # new |
646 | | - print("\n\033[90m[Tab] switch tabs • [Enter] start typing • [Q] quit\033[0m") |
| 663 | + print(f"\n{self._format_status_line('[Tab] switch tabs • [Enter] start typing • [Q] quit')}") |
647 | 664 | elif self.current_tab == 2: # web |
648 | | - print("\n\033[90m[Tab] switch tabs • [Enter] open web • [Q] quit\033[0m") |
| 665 | + print(f"\n{self._format_status_line('[Tab] switch tabs • [Enter] open web • [Q] quit')}") |
649 | 666 |
|
650 | 667 | def run(self): |
651 | 668 | """Run the minimal TUI.""" |
|
0 commit comments