Skip to content

Commit

Permalink
Add error handling to check if current repo has .git
Browse files Browse the repository at this point in the history
  • Loading branch information
josephrmartinez committed Jun 27, 2024
1 parent 111203c commit 2b78703
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import { getOpenAIResponse, getAnthropicResponse, getOllamaResponse, estimateCos
import { createLoadingIndicator, generateFileName } from './cliUtils';

export async function runMktute() {
// Check if git logs
if (!(fs.readdirSync(process.cwd()).includes('.git'))) {
throw new Error("To use mktute, initialize a git repo in the current working directory.")
}

// Select commits
const { startCommit, endCommit } = await selectCommits();
const diffsAndContent = await getDiffsAndContent(startCommit, endCommit);

// Drop git diffs into local file for debugging
// fs.writeFileSync("./diffsAndContent.md", diffsAndContent);

// Enter tutorial topic
const {topic} = await inquirer.prompt({
type: 'input',
Expand Down

0 comments on commit 2b78703

Please sign in to comment.