AI-powered Japanese grammar checker and optimizer Chrome extension.
- 文法チェック (Grammar Check): Analyze and improve Japanese text with AI-powered grammar corrections
- 翻訳 (Translation): Translate between Japanese and multiple languages
- AIチャット (AI Chat): Chat with AI about Japanese language questions
- 履歴管理 (History): Track and manage your grammar checks and translations
- Download the latest release ZIP file from the Releases page
- Extract the ZIP file to a folder on your computer
- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in the top-right corner)
- Click "Load unpacked" and select the extracted folder
- The extension should now be installed and ready to use
- Clone the repository
- Install dependencies:
npm install - Configure environment: Copy
.env.exampleto.envand setVITE_OPENAI_API_MODEL - Build the extension:
npm run clean:build - Load the
distdirectory in Chrome as an unpacked extension
japanese-grammar-checker/
├── js/ # 📁 Source code (main development directory)
│ ├── modules/ # Feature modules (grammar, translation, AI chat, etc.)
│ ├── utils/ # Utility functions (API, storage, config)
│ ├── background.js # Background service worker
│ ├── content.js # Content script
│ └── sidebar.js # Sidebar main entry point
├── css/ # Stylesheets
│ └── sidebar.css # Main sidebar styles
├── tests/ # Unit tests
│ ├── modules/ # Module tests
├── tests/ # Unit tests
├── dist/ # 🔨 Build output directory
│ ├── prod/ # Production build
│ └── dev/ # Development build
├── config.js # Build configuration
├── manifest.json # Chrome extension manifest (base)
├── sidebar.html # Extension UI
└── vite.config.extension.js # Vite build configuration
⚠️ Note: All build outputs are in `dist/` directory and ignored by Git.
- Node.js (v18 or later)
- npm (v8 or later)
- Chrome browser
- Clone the repository:
git clone https://github.com/macshion/japanese-grammar-checker.git
cd japanese-grammar-checker- Install dependencies:
npm install- Configure environment (optional):
cp .env.example .env
# Edit .env to set VITE_OPENAI_API_MODEL if needed (default: gpt-4o-mini)# Build development version (with DEV label, separate storage)
npm run build:dev
# Build production version
npm run build:prod
# Build both versions
npm run build:all
# Clean and rebuild all
npm run clean:build# Run all tests
npm test
# Run tests in watch mode
npm run test:watch
# Generate coverage report
npm run test:coverage# Run ESLint
npm run lint- Build the extension:
npm run build:dev # or build:prod- Open Chrome and navigate to
chrome://extensions/ - Enable "Developer mode" (toggle in the top-right corner)
- Click "Load unpacked" and select:
dist/dev/for development versiondist/prod/for production version
- The extension should now be installed and ready to use
Note: You can load both dev and prod versions simultaneously for testing.
| Feature | Development (dist/dev/) |
Production (dist/prod/) |
|---|---|---|
| Extension Name | "Japanese Grammar Checker - DEV" | "Japanese Grammar Checker" |
| Icon | Blue with "DEV" label | Original icon |
| Storage Namespace | dev_* |
Default |
| Extension ID | Unique (via manifest.key) | Unique |
This allows you to test changes without affecting your production data.
- Click on the extension icon in the Chrome toolbar
- The sidebar will open with the Japanese Grammar Checker
- Enter Japanese text in the input area
- Click "チェック" to check the grammar
- View the corrected text in the result area
- Use the copy button to copy the corrected text
- View and manage your history in the history section
Create a .env file in the project root (or copy from .env.example):
# AI Model Configuration
VITE_OPENAI_API_MODEL=gpt-4o-miniAvailable models:
gpt-4o- Latest GPT-4 Omni model (best quality, higher cost)gpt-4o-mini- Smaller GPT-4 Omni (recommended, balanced performance/cost)gpt-4-turbo- GPT-4 Turbogpt-3.5-turbo- Faster, lower cost
The OpenAI API key is not stored in the .env file for security reasons. Instead:
- Install and open the extension
- Click the extension icon to open the sidebar
- Click the settings (⚙️) button
- Select "APIキーを設定" (Set API Key)
- Enter your OpenAI API key
The API key is stored securely in Chrome's local storage and is only accessible by the extension.
Important: This extension uses a fixed extension ID (via manifest.key) to ensure your API key and settings persist across Chrome updates and extension reinstalls.
Backup Your Settings:
- Click settings (⚙️) → "設定をエクスポート" to backup your API key and history
- Store the backup file in a safe location
- If your API key is lost after a Chrome update, use "設定をインポート" to restore it
Protection Mechanisms:
- Fixed extension ID prevents data loss during updates
- Automatic detection and notification if API key is missing
- Settings backup includes API key for manual recovery
See __IGNORE__/API_KEY_PERSISTENCE_FIX.md for technical details.
- grammar.js: Grammar checking and text correction
- translation.js: Multi-language translation
- aiChat.js: AI-powered chat interface
- history.js: History management with filtering
- tabManager.js: Tab navigation management
- api.js: OpenAI API client with error handling
- storage.js: Chrome storage abstraction
- config.js: Centralized configuration
- settings.js: Settings import/export
- Add UT Framework
日本語の文法チェック、翻訳、および AI チャット機能を提供するウェブアプリケーションです。
- 文法チェック: 日本語の文章を入力して、文法的な間違いを修正します。より自然で適切な表現に改善します。
- 翻訳: 日本語から他の言語への翻訳、または他の言語から日本語への翻訳を行います。
- AI チャット: 日本語学習に関する質問や、一般的な日本語の使い方について質問できます。
npm installnpm run devnpm run buildテストを実行するには:
npm test特定のテストファイルのみを実行するには:
npm test -- tests/utils/api.test.jsウォッチモードでテストを実行するには:
npm run test:watchカバレッジレポートを生成するには:
npm run test:coverageこのアプリケーションは以下のモジュールで構成されています:
- 文法チェック: 日本語の文法と表現を検証し改善します。
- 翻訳: 複数の言語間で翻訳を行います。
- AI チャット: 日本語に関する様々な質問に回答します。
- 履歴管理: 全ての操作履歴を保存、表示、フィルタリングします。
MIT

