-
Notifications
You must be signed in to change notification settings - Fork 62
Removes MCP (this is now remote) #1194
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -40,8 +40,6 @@ def login_routine(token: str | None = None) -> str: | |||||||
| token_manager = TokenManager() | ||||||||
| token_manager.authenticate_token(token) | ||||||||
| rich.print(f"[green]✓ Stored token to:[/green] {token_manager.token_file}") | ||||||||
| rich.print("[cyan]📊 Hey![/cyan] We collect anonymous usage data to improve your experience 🔒") | ||||||||
| rich.print("To opt out, set [green]telemetry_enabled = false[/green] in [cyan]~/.config/codegen-sh/analytics.json[/cyan] ✨") | ||||||||
| return token | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Logic bug]: Removed consent message may hide telemetry notice
Suggested change
|
||||||||
| except AuthError as e: | ||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Logic error]: Telemetry opt-out path hard-coded to old config location
Suggested change
|
||||||||
| rich.print(f"[red]Error:[/red] {e!s}") | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -3,16 +3,16 @@ | |||||
|
|
||||||
| from codegen import __version__ | ||||||
|
|
||||||
| # Import config command (still a Typer app) | ||||||
| from codegen.cli.commands.agents.main import agents_app | ||||||
|
|
||||||
| # Import the actual command functions | ||||||
| from codegen.cli.commands.claude.main import claude | ||||||
|
|
||||||
| # Import config command (still a Typer app) | ||||||
| from codegen.cli.commands.config.main import config_command | ||||||
| from codegen.cli.commands.init.main import init | ||||||
| from codegen.cli.commands.integrations.main import integrations_app | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Syntax error]: extraneous import removed in diff but still referenced
Suggested change
|
||||||
| from codegen.cli.commands.login.main import login | ||||||
| from codegen.cli.commands.logout.main import logout | ||||||
| from codegen.cli.commands.mcp.main import mcp | ||||||
| from codegen.cli.commands.profile.main import profile | ||||||
| from codegen.cli.commands.style_debug.main import style_debug | ||||||
| from codegen.cli.commands.tools.main import tools | ||||||
|
|
@@ -29,27 +29,27 @@ def version_callback(value: bool): | |||||
|
|
||||||
|
|
||||||
| # Create the main Typer app | ||||||
| main = typer.Typer(name="codegen", help="Codegen CLI - Transform your code with AI.", rich_markup_mode="rich") | ||||||
| main = typer.Typer(name="codegen", help="Codegen - the Operating System for Code Agents.", rich_markup_mode="rich") | ||||||
|
|
||||||
| # Add individual commands to the main app | ||||||
| main.command("claude", help="Run Claude Code with OpenTelemetry monitoring and logging.")(claude) | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Logic error]: Command registration for removed
Suggested change
|
||||||
| main.command("init", help="Initialize or update the Codegen folder.")(init) | ||||||
| main.command("login", help="Store authentication token.")(login) | ||||||
| main.command("logout", help="Clear stored authentication token.")(logout) | ||||||
| main.command("mcp", help="Start the Codegen MCP server.")(mcp) | ||||||
| main.command("profile", help="Display information about the currently authenticated user.")(profile) | ||||||
| main.command("style-debug", help="Debug command to visualize CLI styling (spinners, etc).")(style_debug) | ||||||
| main.command("tools", help="List available tools from the Codegen API.")(tools) | ||||||
| main.command("update", help="Update Codegen to the latest or specified version")(update) | ||||||
|
|
||||||
| # Add Typer apps as sub-applications | ||||||
| main.add_typer(agents_app, name="agents") | ||||||
| main.add_typer(config_command, name="config") | ||||||
| main.add_typer(integrations_app, name="integrations") | ||||||
|
|
||||||
|
|
||||||
| @main.callback() | ||||||
| def main_callback(version: bool = typer.Option(False, "--version", callback=version_callback, is_eager=True, help="Show version and exit")): | ||||||
| """Codegen CLI - Transform your code with AI.""" | ||||||
| """Codegen - the Operating System for Code Agents""" | ||||||
| pass | ||||||
|
|
||||||
|
|
||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| """Agents command module.""" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,127 @@ | ||
| """Agents command for the Codegen CLI.""" | ||
|
|
||
| import requests | ||
| import typer | ||
| from rich.console import Console | ||
| from rich.table import Table | ||
|
|
||
| from codegen.cli.api.endpoints import API_ENDPOINT | ||
| from codegen.cli.auth.token_manager import get_current_token | ||
| from codegen.cli.rich.spinners import create_spinner | ||
| from codegen.cli.utils.org import resolve_org_id | ||
|
|
||
| console = Console() | ||
|
|
||
| # Create the agents app | ||
| agents_app = typer.Typer(help="Manage Codegen agents") | ||
|
|
||
|
|
||
| @agents_app.command("list") | ||
| def list_agents(org_id: int | None = typer.Option(None, help="Organization ID (defaults to CODEGEN_ORG_ID/REPOSITORY_ORG_ID or auto-detect)")): | ||
| """List agent runs from the Codegen API.""" | ||
| # Get the current token | ||
| token = get_current_token() | ||
| if not token: | ||
| console.print("[red]Error:[/red] Not authenticated. Please run 'codegen login' first.") | ||
| raise typer.Exit(1) | ||
|
|
||
| try: | ||
| # Resolve org id | ||
| resolved_org_id = resolve_org_id(org_id) | ||
| if resolved_org_id is None: | ||
| console.print("[red]Error:[/red] Organization ID not provided. Pass --org-id, set CODEGEN_ORG_ID, or REPOSITORY_ORG_ID.") | ||
| raise typer.Exit(1) | ||
|
|
||
| # Make API request to list agent runs with spinner | ||
| spinner = create_spinner("Fetching agent runs...") | ||
| spinner.start() | ||
|
|
||
| try: | ||
| headers = {"Authorization": f"Bearer {token}"} | ||
| url = f"{API_ENDPOINT.rstrip('/')}/v1/organizations/{resolved_org_id}/agent/runs" | ||
| response = requests.get(url, headers=headers) | ||
| response.raise_for_status() | ||
| response_data = response.json() | ||
| finally: | ||
| spinner.stop() | ||
|
|
||
| # Extract agent runs from the response structure | ||
| agent_runs = response_data.get("items", []) | ||
| total = response_data.get("total", 0) | ||
| page = response_data.get("page", 1) | ||
| page_size = response_data.get("page_size", 10) | ||
|
|
||
| if not agent_runs: | ||
| console.print("[yellow]No agent runs found.[/yellow]") | ||
| return | ||
|
|
||
| # Create a table to display agent runs | ||
| table = Table( | ||
| title=f"Agent Runs (Page {page}, Total: {total})", | ||
| border_style="blue", | ||
| show_header=True, | ||
| title_justify="center", | ||
| ) | ||
| table.add_column("ID", style="cyan", no_wrap=True) | ||
| table.add_column("Status", style="white", justify="center") | ||
| table.add_column("Source", style="magenta") | ||
| table.add_column("Created", style="dim") | ||
| table.add_column("Result", style="green") | ||
|
|
||
| # Add agent runs to table | ||
| for agent_run in agent_runs: | ||
| run_id = str(agent_run.get("id", "Unknown")) | ||
| status = agent_run.get("status", "Unknown") | ||
| source_type = agent_run.get("source_type", "Unknown") | ||
| created_at = agent_run.get("created_at", "Unknown") | ||
| result = agent_run.get("result", "") | ||
|
|
||
| # Status with emoji | ||
| status_display = status | ||
| if status == "COMPLETE": | ||
| status_display = "✅ Complete" | ||
| elif status == "RUNNING": | ||
| status_display = "🏃 Running" | ||
| elif status == "FAILED": | ||
| status_display = "❌ Failed" | ||
| elif status == "STOPPED": | ||
| status_display = "⏹️ Stopped" | ||
| elif status == "PENDING": | ||
| status_display = "⏳ Pending" | ||
|
|
||
| # Format created date (just show date and time, not full timestamp) | ||
| if created_at and created_at != "Unknown": | ||
| try: | ||
| # Parse and format the timestamp to be more readable | ||
| from datetime import datetime | ||
|
|
||
| dt = datetime.fromisoformat(created_at.replace("Z", "+00:00")) | ||
| created_display = dt.strftime("%m/%d %H:%M") | ||
| except (ValueError, TypeError): | ||
| created_display = created_at[:16] if len(created_at) > 16 else created_at | ||
| else: | ||
| created_display = created_at | ||
|
|
||
| # Truncate result if too long | ||
| result_display = result[:50] + "..." if result and len(result) > 50 else result or "No result" | ||
|
|
||
| table.add_row(run_id, status_display, source_type, created_display, result_display) | ||
|
|
||
| console.print(table) | ||
| console.print(f"\n[green]Showing {len(agent_runs)} of {total} agent runs[/green]") | ||
|
|
||
| except requests.RequestException as e: | ||
| console.print(f"[red]Error fetching agent runs:[/red] {e}", style="bold red") | ||
| raise typer.Exit(1) | ||
| except Exception as e: | ||
| console.print(f"[red]Unexpected error:[/red] {e}", style="bold red") | ||
| raise typer.Exit(1) | ||
|
|
||
|
|
||
| # Default callback for the agents app | ||
| @agents_app.callback(invoke_without_command=True) | ||
| def agents_callback(ctx: typer.Context): | ||
| """Manage Codegen agents.""" | ||
| if ctx.invoked_subcommand is None: | ||
| # If no subcommand is provided, run list by default | ||
| list_agents(org_id=None) |
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Logic bug]: CONFIG_DIR path change breaks consistency
Other modules (e.g.
src/codegen/configs/constants.py) still reference the old~/.config/codegen-shdirectory, so credentials/config written here will no longer be found elsewhere.