Skip to content

Commit 26f59be

Browse files
authored
refactor: remove auth from CLI (#36)
- **remove cloud cli commands** - **remove more cloud cli commands** - **more fixes/removals**
1 parent ccaeffc commit 26f59be

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+13
-3678
lines changed

examples/examples/codegen-mcp-server/server.py

Lines changed: 5 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@
66
from pathlib import Path
77
from typing import Annotated, Any, Dict, List, Optional
88

9-
import requests
109
from graph_sitter import Codebase
11-
from graph_sitter.cli.api.client import RestAPI
12-
from graph_sitter.cli.api.endpoints import CODEGEN_SYSTEM_PROMPT_URL
13-
from graph_sitter.cli.auth.token_manager import get_current_token
14-
from graph_sitter.cli.codemod.convert import convert_to_cli
1510
from graph_sitter.cli.utils.default_code import DEFAULT_CODEMOD
1611
from graph_sitter.extensions.tools.reveal_symbol import reveal_symbol
1712
from mcp.server.fastmcp import FastMCP
@@ -99,7 +94,7 @@ async def wrapper(*args, **kwargs):
9994
# return {"message": f"Codebase is parsed. Found {len(state.parsed_codebase.files)} files.", "status": "parsed"}
10095

10196

102-
async def create_codemod_task(name: str, description: str, language: str = "python") -> Dict[str, Any]:
97+
async def create_codemod_task(name: str, language: str = "python") -> Dict[str, Any]:
10398
"""Background task to create a codemod using the API."""
10499
try:
105100
# Convert name to snake case for filename
@@ -116,37 +111,12 @@ async def create_codemod_task(name: str, description: str, language: str = "pyth
116111
function_dir.mkdir(parents=True, exist_ok=True)
117112
logger.info(f"Created directories for codemod {name} in {function_dir}")
118113

119-
# Use API to generate implementation if description is provided
120-
if description:
121-
try:
122-
api = RestAPI(get_current_token())
123-
response = api.create(name=name, query=description)
124-
code = convert_to_cli(response.code, language, name)
125-
context = response.context
126-
127-
# Save the prompt/context
128-
if context:
129-
prompt_path.write_text(context)
130-
except Exception as e:
131-
# Fall back to default implementation on API error
132-
code = DEFAULT_CODEMOD.format(name=name)
133-
return {"status": "error", "message": f"Error generating codemod via API, using default template: {str(e)}", "path": str(codemod_path), "code": code}
134-
else:
135-
# Use default implementation
136-
code = DEFAULT_CODEMOD.format(name=name)
114+
# Use default implementation
115+
code = DEFAULT_CODEMOD.format(name=name)
137116

138117
# Write the codemod file
139118
codemod_path.write_text(code)
140119

141-
# Download and save system prompt if not already done
142-
if not prompt_path.exists():
143-
try:
144-
response = requests.get(CODEGEN_SYSTEM_PROMPT_URL)
145-
response.raise_for_status()
146-
prompt_path.write_text(response.text)
147-
except Exception:
148-
pass # Ignore system prompt download failures
149-
150120
return {"status": "completed", "message": f"Created codemod '{name}'", "path": str(codemod_path), "docs_path": str(prompt_path), "code": code}
151121
except Exception as e:
152122
return {"status": "error", "message": f"Error creating codemod: {str(e)}"}
@@ -268,7 +238,6 @@ def get_config() -> str:
268238
@mcp.tool(name="create_codemod", description="Initiate creation of a new codemod in the `.codegen/codemods/{name}` directory")
269239
async def create_codemod(
270240
name: Annotated[str, "Name of the codemod to create"],
271-
description: Annotated[str, "Description of what the codemod does. Be specific, as this is passed to an expert LLM to generate the first draft"] = None,
272241
language: Annotated[str, "Programming language for the codemod (default Python)"] = "python",
273242
) -> Dict[str, Any]:
274243
# Check if a task with this name already exists
@@ -291,13 +260,13 @@ def sync_wrapper():
291260
new_loop = asyncio.new_event_loop()
292261
asyncio.set_event_loop(new_loop)
293262
# Run our async function to completion in this thread
294-
return new_loop.run_until_complete(create_codemod_task(name, description, language))
263+
return new_loop.run_until_complete(create_codemod_task(name, language))
295264

296265
# Run the wrapper in a thread pool
297266
task = loop.run_in_executor(None, sync_wrapper)
298267

299268
# Store task info
300-
state.codemod_tasks[name] = {"task": task, "name": name, "description": description, "language": language, "started_at": loop.time()}
269+
state.codemod_tasks[name] = {"task": task, "name": name, "language": language, "started_at": loop.time()}
301270

302271
# Return immediately
303272
return {

examples/examples/promises_to_async_await/convert_promises_twilio_repository.ipynb

Lines changed: 0 additions & 197 deletions
This file was deleted.

0 commit comments

Comments
 (0)