scai
Version:
> AI-powered CLI tool for commit messages **and** pull request reviews — using local models.
16 lines (15 loc) • 561 B
JavaScript
import { Config } from '../config.js';
import { promptForToken } from './token.js';
export async function ensureGitHubAuth() {
// First check if the token exists in the config
let token = Config.getGitHubToken();
if (token) {
return token; // Token already exists in config, return it
}
// Token doesn't exist in config, prompt the user for it
console.log("🔐 GitHub token not found.");
token = await promptForToken();
// Save the token in the config
Config.setGitHubToken(token.trim());
return token.trim();
}