Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ See [README.md](./README.md) for full project overview.

## Installation

End-user install methods (pipx, npm, one-liner script, manual download) are documented in
[README.md](./README.md). The install script lives at [script/install.sh](./script/install.sh).
End-user install methods (Homebrew, pipx, npm, one-liner scripts, manual download) are documented
in [README.md](./README.md). The install scripts live at [script/install.sh](./script/install.sh)
(macOS/Linux) and [script/install.ps1](./script/install.ps1) (Windows PowerShell).

For local development, build from source with `make build` (see below) or:

Expand All @@ -18,16 +19,17 @@ go install github.com/min0625/mint/cmd/mint@latest # Go 1.26.4+; binary → $G

```bash
make build # compile → bin/mint (CGO_ENABLED=0, trimpath, ldflags injected)
make test # go test -race -failfast -v ./...
make test # go test -race -failfast ./...
make lint # golangci-lint (only new violations since HEAD)
make fix # golangci-lint --fix + go mod tidy
make check # check-tidy + lint + test (CI gate)
make check-tidy # verify go.mod/go.sum are tidy
make release-snapshot # goreleaser release --snapshot --clean (test release locally)
```

Tool versions are pinned in [mise.toml](./mise.toml) (Go 1.26.4, golangci-lint 2.12.2, goreleaser 2.16.0).
Run `mise install` to set up the exact toolchain.
Tool versions are pinned in [mise.toml](./mise.toml) (Go 1.26.4, golangci-lint 2.12.2, goreleaser 2.16.0, prek 0.4.6).
Run `mise install` to set up the exact toolchain. Pre-commit hooks run `make check` via
`prek` (config: [.pre-commit-config.yaml](./.pre-commit-config.yaml)).

## Distribution

Expand All @@ -37,7 +39,10 @@ live under [pypi/](./pypi/) (`build_wheels.py`) and [npm/](./npm/). For local wh
steps see [pypi/](./pypi/).

**Release trigger:** push a tag matching `v*.*.*` → `release.yml` builds multi-platform
binaries → `publish-pypi.yml` assembles wheels and uploads to PyPI.
binaries → `publish-pypi.yml` assembles wheels and uploads to PyPI, and `publish-npm.yml`
publishes the npm packages (both run on `workflow_run` after Release succeeds). The Homebrew
cask in `min0625/homebrew-tap` is updated by goreleaser itself (see `homebrew_casks` in
[.goreleaser.yaml](./.goreleaser.yaml)).

## Project Layout

Expand All @@ -52,6 +57,10 @@ internal/provider/
googlegenai/google_genai.go # Google Gemini HTTP client (implements Completer)
openai/openai.go # OpenAI GPT HTTP client (implements Completer)
anthropic/anthropic.go # Anthropic Claude HTTP client (implements Completer)
script/install.sh, install.ps1 # end-user one-liner install scripts (macOS/Linux, Windows)
docs/manual-testing.md # manual test cases for humans and AI agents
npm/, pypi/ # npm / PyPI packaging that wraps the released binaries
testdata/sample.txt # long-form input used in tests and token-usage measurements
bin/mint # compiled binary (gitignored)
.goreleaser.yaml # GoReleaser multi-platform release configuration
.github/workflows/release.yml # GitHub Actions: triggered on v*.*.* tag push
Expand All @@ -63,7 +72,7 @@ bin/mint # compiled binary (gitignored)
|----------|-------------|----------|---------|
| `MINT_PROVIDER` | LLM provider: `google-genai`, `openai`, `anthropic` | Yes | — |
| `MINT_API_KEY` | API key for the chosen provider; optional when `MINT_BASE_URL` is set | Conditional* | — |
| `MINT_BASE_URL` | Custom API base URL (domain only; each provider appends its own path); use with `openai` to target local inference serversOllama (`http://localhost:11434`) or LM Studio (`http://localhost:1234`); optional for cloud providers to point to a proxy | Conditional* | Provider default |
| `MINT_BASE_URL` | Custom API base URL (domain only; each provider appends its own path); use with `openai` to target any OpenAI-compatible endpointlocal servers (Ollama `http://localhost:11434`, LM Studio `http://localhost:1234`, llama.cpp `http://localhost:8080`) or hosted services (OpenRouter, Groq, DeepSeek); optional for cloud providers to point to a proxy | Conditional* | Provider default |
| `MINT_MODEL_NAME` | LLM model name to use | Required when `MINT_BASE_URL` is set; optional otherwise | Provider default** |
| `MINT_TARGET_LANG` | Target language(s) - single or comma-separated (e.g. `en`, `en,zh-TW,ja`) | Optional | System locale or `en` |
| `MINT_VERBOSE` | Set to `true` to enable verbose diagnostic output to stderr (equivalent to `--verbose`) | Optional | `false` |
Expand All @@ -73,6 +82,7 @@ bin/mint # compiled binary (gitignored)

## Documentation

- **Manual test cases** — [docs/manual-testing.md](./docs/manual-testing.md) lists end-to-end CLI cases (with expected output and verbose diagnostics) that AI agents and humans can run to verify behavior; keep it in sync when CLI behavior, flags, or error messages change.
- **Multilingual README sync** — **all** README variants must be kept in sync: `README.md` (English, the canonical source) and every `README.<locale>.md` translation. [LANGUAGES.md](./LANGUAGES.md) is the authoritative list of variants — consult it first to confirm the full set, since new languages are added over time. Whenever one README is updated, apply the equivalent change to *every* other variant listed there. New README language variants follow the pattern `README.<locale>.md`.
- **Language list** — the list of available languages lives **only** in [LANGUAGES.md](./LANGUAGES.md). Each README links to it with a single static line, written **in that README's own language** (e.g. English: `🌐 Other languages`; Traditional Chinese: `🌐 其他語言`). This line never changes when languages are added. To add a language: create `README.<locale>.md` and add one entry to `LANGUAGES.md` — do **not** add a per-language switcher row to every README.
- **Absolute URLs in README headers** — `README.md` is shipped as the PyPI long-description and the npm package readme. PyPI does **not** rewrite relative links, so the `LANGUAGES.md` link in each README must be an **absolute** GitHub URL (`https://github.com/min0625/mint/blob/main/LANGUAGES.md`). Links *inside* `LANGUAGES.md` may stay relative — that file is GitHub-only (not packaged into PyPI/npm).
Expand Down
2 changes: 2 additions & 0 deletions LANGUAGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
Mint's README is available in the following languages:

- [English](README.md)
- [简体中文 (Simplified Chinese)](README.zh-CN.md)
- [繁體中文 (Traditional Chinese)](README.zh-TW.md)
- [日本語 (Japanese)](README.ja.md)
- [한국어 (Korean)](README.ko.md)

> Adding a new language? Create `README.<locale>.md` and add one line to this file —
> the existing READMEs link here and don't need to change.
30 changes: 26 additions & 4 deletions README.ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cat document.txt | mint -t fr # ファイル全体を翻訳
## ✨ Mintの特徴

- **ゼロ設定** — 単一の実行ファイル。APIキーは環境変数で管理するため、設定ファイルを汚しません。
- **マルチプロバイダー** — Google Gemini、OpenAI、Anthropicのほか、ローカルのOllamaやLM Studioにも対応
- **マルチプロバイダー** — Google Gemini、OpenAI、Anthropicに加え、OpenAI互換エンドポイント(Ollama、LM Studio、OpenRouter、Groq、DeepSeek、llama.cppなど)にも対応
- **スマート検出** — 実行のたびに言語を自動検出。言語に依存しない内容(数字、記号)はそのまま出力します。
- **スマート修正** — 入力言語とターゲット言語が同じ場合は、翻訳ではなく文法やスペルの修正を行います。
- **ストリーミング出力** — レスポンスをリアルタイムでストリーミングするため、長文翻訳でも待たされません。
Expand Down Expand Up @@ -108,6 +108,29 @@ export MINT_MODEL_NAME=qwen2.5:7b # Ollamaでロード済みのモデル名に
export MINT_PROVIDER=openai
export MINT_BASE_URL=http://localhost:1234
export MINT_MODEL_NAME=lmstudio-community/Qwen2.5-7B-Instruct-GGUF # LM Studioでロード済みのモデル名に変更

# llama.cpp の llama-server(APIキー不要)
export MINT_PROVIDER=openai
export MINT_BASE_URL=http://localhost:8080
export MINT_MODEL_NAME=qwen2.5:7b # llama-serverでロード済みのモデル名に変更

# OpenRouter(1つのキーで数百のモデルを利用可能 — https://openrouter.ai/models)
export MINT_PROVIDER=openai
export MINT_BASE_URL=https://openrouter.ai/api
export MINT_API_KEY=sk-or-...
export MINT_MODEL_NAME=openai/gpt-4o-mini

# Groq(高速推論、無料枠あり)
export MINT_PROVIDER=openai
export MINT_BASE_URL=https://api.groq.com/openai
export MINT_API_KEY=gsk_...
export MINT_MODEL_NAME=llama-3.1-8b-instant

# DeepSeek
export MINT_PROVIDER=openai
export MINT_BASE_URL=https://api.deepseek.com
export MINT_API_KEY=sk-...
export MINT_MODEL_NAME=deepseek-chat
```

### 2. 翻訳の実行
Expand All @@ -125,7 +148,6 @@ cat document.txt | mint -t zh-TW
```bash
mint -t ja -v "Good morning"
# [mint] provider: google-genai
# [mint] model: gemini-3.1-flash-lite
# [mint] single target — skipping language detection
# [mint] target language: ja
# おはようございます
Expand Down Expand Up @@ -204,7 +226,7 @@ mint "こんにちは" # ja → en: Hello
| `MINT_API_KEY` | APIキー。デフォルトのエンドポイント使用時は必須。`MINT_BASE_URL`設定時は任意(プロキシ側で認証処理する場合) | — |
| `MINT_BASE_URL` | カスタムAPIベースURL(ドメインのみ指定、パスは各プロバイダーが自動付与)。`openai`と組み合わせることで、Ollama(`http://localhost:11434`)、LM Studio(`http://localhost:1234`)、またはOpenAI互換エンドポイントを指定可能 | プロバイダーのデフォルト |
| `MINT_MODEL_NAME` | 使用するモデル名(`MINT_BASE_URL` 設定時は必須) | `gemini-3.1-flash-lite` / `gpt-4o-mini` / `claude-haiku-4-5` |
| `MINT_TARGET_LANG` | ターゲット言語(例: `en` または `en,zh-TW,ja`) | システムのロケール設定 |
| `MINT_TARGET_LANG` | ターゲット言語(例: `en` または `en,zh-TW,ja`) | システムのロケール設定(なければ `en`) |
| `MINT_VERBOSE` | `true`に設定すると詳細な診断出力が有効になります(`--verbose`相当) | `false` |

---
Expand All @@ -222,7 +244,7 @@ mint "こんにちは" # ja → en: Hello

## 📅 ロードマップ

- [x] 複数のLLMプロバイダー対応(Google Gemini、OpenAI、Anthropic、ローカルのOllama / LM Studio
- [x] 複数のLLMプロバイダー対応(Google Gemini、OpenAI、Anthropic、およびOpenAI互換エンドポイント
- [x] `MINT_TARGET_LANG` による言語自動検出と多言語ローテーション
- [x] `--target` / `-t` フラグによるターゲット言語の明示的指定
- [x] `--source` / `-s` フラグによるソース言語の明示的指定
Expand Down
Loading
Loading