Skip to content

Commit dfd4c4a

Browse files
committed
remove auth requirement for create command, fix path bug
1 parent 717f002 commit dfd4c4a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/codegen/cli/api/endpoints.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
DOCS_ENDPOINT = f"https://{MODAL_PREFIX}--cli-docs.modal.run"
55
EXPERT_ENDPOINT = f"https://{MODAL_PREFIX}--cli-ask-expert.modal.run"
66
IDENTIFY_ENDPOINT = f"https://{MODAL_PREFIX}--cli-identify.modal.run"
7-
CREATE_ENDPOINT = f"https://{MODAL_PREFIX}--cli-create.modal.run"
7+
CREATE_ENDPOINT = f"https://codegen-sh-develop-rpatel--cli-create.modal.run"
88
DEPLOY_ENDPOINT = f"https://{MODAL_PREFIX}--cli-deploy.modal.run"
99
LOOKUP_ENDPOINT = f"https://{MODAL_PREFIX}--cli-lookup.modal.run"
1010
RUN_ON_PR_ENDPOINT = f"https://{MODAL_PREFIX}--cli-run-on-pull-request.modal.run"

src/codegen/cli/commands/create/main.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,19 @@ def make_relative(path: Path) -> str:
6565

6666

6767
@click.command(name="create")
68-
@requires_init
6968
@click.argument("name", type=str)
7069
@click.argument("path", type=click.Path(path_type=Path), default=Path.cwd())
7170
@click.option("--description", "-d", default=None, help="Description of what this codemod does.")
7271
@click.option("--overwrite", is_flag=True, help="Overwrites function if it already exists.")
73-
def create_command(session: CodegenSession, name: str, path: Path, description: str | None = None, overwrite: bool = False):
72+
def create_command(name: str, path: Path, description: str | None = None, overwrite: bool = False):
7473
"""Create a new codegen function.
7574
7675
NAME is the name/label for the function
7776
PATH is where to create the function (default: current directory)
7877
"""
7978
# Get the target path for the function
8079
codemod_path, prompt_path = get_target_paths(name, path)
80+
session = CodegenSession()
8181

8282
# Check if file exists
8383
if codemod_path.exists() and not overwrite:
@@ -93,6 +93,7 @@ def create_command(session: CodegenSession, name: str, path: Path, description:
9393
with create_spinner("Generating function (using LLM, this will take ~10s)") as status:
9494
response = RestAPI(session.token).create(name=name, query=description)
9595
code = convert_to_cli(response.code, session.language, name)
96+
prompt_path.parent.mkdir(parents=True, exist_ok=True)
9697
prompt_path.write_text(response.context)
9798
else:
9899
# Use default implementation

0 commit comments

Comments
 (0)