Skip to content

Commit

Permalink
fix: do not send empty api key to LLM (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
zlalvani authored Apr 29, 2024
1 parent 04f2e25 commit 1635bda
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions apps/cli/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React from "react";
import { Option, program } from "@commander-js/extra-typings";
import { select } from "@inquirer/prompts";
import { render } from "ink";
import { toInt } from "radash";
import { serializeError } from "serialize-error";

import {
Expand Down Expand Up @@ -54,6 +53,15 @@ if (isNaN(port)) {
process.exit(1);
}

const resolvedToken = token ?? process.env.LLM_API_KEY;

if (!resolvedToken) {
console.log(
"LLM token must be provided (either via --token or the LLM_API_KEY environment variable)",
);
process.exit(1);
}

const bumpFinder = makeBumpFinder({
language,
projectRoot: process.cwd(),
Expand Down Expand Up @@ -95,7 +103,7 @@ if (!pkg) {
}

const bumpgen = makeBumpgen({
llmApiKey: token ?? process.env.LLM_API_KEY ?? "",
llmApiKey: resolvedToken,
model,
packageToUpgrade: {
packageName: pkg,
Expand Down

0 comments on commit 1635bda

Please sign in to comment.