UNPKG

article-summarizer-jp

Version:

CLI tool for summarizing web articles in Japanese using Anthropic Claude API. Fetches content from URLs and generates both 3-line summaries and full translations in polite Japanese.

39 lines 1.29 kB
import Configstore from 'configstore'; import inquirer from 'inquirer'; class ConfigManager { store; constructor() { this.store = new Configstore('article-summarizer-jp', {}); } hasApiKey() { return !!this.store.get('anthropicApiKey'); } getApiKey() { const apiKey = this.store.get('anthropicApiKey'); if (!apiKey) { throw new Error('API key not configured. Run with --config flag first.'); } return apiKey; } async configure() { const answers = await inquirer.prompt([ { type: 'password', name: 'apiKey', message: 'Anthropic APIキーを入力してください:', validate: (input) => { if (!input || input.trim().length === 0) { return 'APIキーは必須です'; } if (!input.startsWith('sk-')) { return 'APIキーは "sk-" で始まる必要があります'; } return true; }, }, ]); this.store.set('anthropicApiKey', answers.apiKey); } } export const config = new ConfigManager(); //# sourceMappingURL=config.js.map