coderouter-cli 1.7.0__tar.gz → 1.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/.gitignore +6 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/CHANGELOG.md +225 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/PKG-INFO +44 -19
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/README.en.md +41 -19
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/README.md +40 -18
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/cli.py +168 -2
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/config/capability_registry.py +27 -1
- coderouter_cli-1.8.0/coderouter/data/model-capabilities.yaml +235 -0
- coderouter_cli-1.8.0/coderouter/doctor_apply.py +612 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/ingress/app.py +8 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/logging.py +86 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/routing/capability.py +113 -1
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/free-tier-guide.en.md +15 -1
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/free-tier-guide.md +15 -1
- coderouter_cli-1.8.0/docs/hf-ollama-models.md +244 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/quickstart.en.md +57 -20
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/quickstart.md +56 -20
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/usage-guide.en.md +1 -1
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/usage-guide.md +1 -1
- coderouter_cli-1.8.0/examples/providers.yaml +1019 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/pyproject.toml +21 -1
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_capability_registry.py +106 -0
- coderouter_cli-1.8.0/tests/test_claude_code_suitability.py +281 -0
- coderouter_cli-1.8.0/tests/test_doctor_apply.py +598 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_examples_yaml.py +96 -0
- coderouter_cli-1.8.0/tests/test_setup_sh.py +377 -0
- coderouter_cli-1.7.0/coderouter/data/model-capabilities.yaml +0 -86
- coderouter_cli-1.7.0/examples/providers.yaml +0 -493
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/LICENSE +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/__main__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/adapters/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/adapters/anthropic_native.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/adapters/base.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/adapters/openai_compat.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/adapters/registry.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/cli_stats.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/config/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/config/env_file.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/config/loader.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/config/schemas.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/data/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/doctor.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/env_security.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/errors.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/ingress/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/ingress/anthropic_routes.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/ingress/dashboard_routes.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/ingress/metrics_routes.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/ingress/openai_routes.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/metrics/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/metrics/collector.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/metrics/prometheus.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/output_filters.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/routing/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/routing/auto_router.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/routing/fallback.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/translation/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/translation/anthropic.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/translation/convert.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/coderouter/translation/tool_repair.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/assets/dashboard-demo.png +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/designs/v1.5-dashboard-mockup.html +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/designs/v1.6-auto-router-verification.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/designs/v1.6-auto-router.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/openrouter-roster/README.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/openrouter-roster/latest.json +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/retrospectives/v0.4.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/retrospectives/v0.5-verify.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/retrospectives/v0.5.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/retrospectives/v0.6.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/retrospectives/v0.7.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/retrospectives/v1.0-verify.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/retrospectives/v1.0.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/security.en.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/security.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/troubleshooting.en.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/troubleshooting.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/when-do-i-need-coderouter.en.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/docs/when-do-i-need-coderouter.md +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/examples/.env.example +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/examples/providers.auto-custom.yaml +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/examples/providers.auto.yaml +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/examples/providers.note-2026.yaml +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/examples/providers.nvidia-nim.yaml +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/scripts/demo_traffic.sh +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/scripts/openrouter_roster_diff.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/scripts/verify_v0_5.sh +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/scripts/verify_v1_0.sh +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/__init__.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/conftest.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_adapter_anthropic.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_auto_router.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_capability.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_capability_degraded_payload.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_cli.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_cli_stats.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_config.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_dashboard_endpoint.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_doctor.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_env_file.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_env_security.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_errors.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_fallback.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_fallback_anthropic.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_fallback_cache_control.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_fallback_misconfig_warn.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_fallback_paid_gate.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_fallback_thinking.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_ingress_anthropic.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_ingress_profile.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_metrics_collector.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_metrics_endpoint.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_metrics_jsonl.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_metrics_prometheus.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_openai_compat.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_openrouter_roster_diff.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_output_filters.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_output_filters_adapters.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_reasoning_strip.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_tool_repair.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_translation_anthropic.py +0 -0
- {coderouter_cli-1.7.0 → coderouter_cli-1.8.0}/tests/test_translation_reverse.py +0 -0
|
@@ -78,3 +78,9 @@ docs/inside/
|
|
|
78
78
|
docs/articles/
|
|
79
79
|
!.env.publish.tpl
|
|
80
80
|
!.env.tpl
|
|
81
|
+
|
|
82
|
+
# v1.7-A: 1Password publish-time secret reference templates.
|
|
83
|
+
# These contain `op://` references, not actual secrets, but kept out
|
|
84
|
+
# of the repo because the Vault path includes personal Vault names.
|
|
85
|
+
.env.publish.tpl
|
|
86
|
+
.env.tpl
|
|
@@ -6,6 +6,231 @@ versioning follows [SemVer](https://semver.org/).
|
|
|
6
6
|
|
|
7
7
|
---
|
|
8
8
|
|
|
9
|
+
## [v1.8.0] — 2026-04-26 (用途別 4 プロファイル + GLM/Gemma 4/Qwen3.6 公式化 + apply 自動化)
|
|
10
|
+
|
|
11
|
+
**Theme: 「Claude Code で意味合いがズレない代替モデル」を operator に渡す minor。** plan.md §11.B (v1.7-B umbrella) を 6 タスクで一気に消化:
|
|
12
|
+
|
|
13
|
+
1. **PyPI Trusted Publishing** 自動化 — `git tag v* && git push` だけで release.yml が PyPI publish + GitHub Release 草稿を自動作成。API トークン不要 (OIDC)
|
|
14
|
+
2. **`claude_code_suitability` hint** — capability registry に `Literal["ok", "degraded"] | None` フィールド新設、Llama-3.3-70B 系を `claude-code-*` profile に置くと startup で `chain-claude-code-suitability-degraded` warn を構造化 emit。v1.6.2 で docs 化した「`こんにちは` → `Skill(hello)` 暴走」罠の自動検出版
|
|
15
|
+
3. **`coderouter doctor --check-model --apply` / `--dry-run`** — doctor 提案の YAML パッチを `providers.yaml` / `model-capabilities.yaml` に**非破壊**書き戻し (コメント・key 順序 100% 保持)。`--dry-run` は `git apply` 互換 unified diff、`--apply` は `.bak` バックアップ作成 + 冪等 (二回目は no-op)。`ruamel.yaml` を optional dep (`[doctor]` extras) で lazy import → base 5 deps streak 維持
|
|
16
|
+
4. **`setup.sh` onboarding ウィザード** — RAM 自動検出 → 推奨ローカルモデル提案 → `ollama pull` → `~/.coderouter/providers.yaml` 生成。`--ram-gb N` / `--non-interactive` / `--no-pull` / `--dry-run` / `--force` のフラグ整備、bash 3.2 互換、新規依存ゼロ
|
|
17
|
+
5. **examples/providers.yaml を 4 プロファイル構成に拡張** — `multi` (default) / `coding` / `general` / `reasoning`、各プロファイルに `append_system_prompt` で Claude 風応答を nudge、`mode_aliases` で `default/fast/vision/think/cheap` ショートカット
|
|
18
|
+
6. **Gemma 4 / Qwen3.6 / Z.AI (GLM-4.7/5.1) を providers.yaml に登録** — Ollama 公式 tag 化された `gemma4:e4b/26b/31b` (note 推奨 26B-A4B 含む) と `qwen3.6:27b/35b` (note "local champ" 35b-a3b) を active stanza として登録、note 記事推奨モデルを各 profile primary に格上げ。Z.AI を OpenAI-compat で 2 base_url 提供 (Coding Plan / General API)、unauthorized-tool 警告込みで明文化。`bundled model-capabilities.yaml` に `qwen3.6:*` (claude_code_suitability=ok) / `gemma4:*` / `GLM-5*` / `GLM-4.[5-9]*` family を新規宣言
|
|
19
|
+
|
|
20
|
+
- Tests: 651 → **710** (+59, +9.1%): `tests/test_claude_code_suitability.py` (6, walker + payload + opt-out), `tests/test_capability_registry.py` (+11 schema/lookup/bundled-yaml), `tests/test_doctor_apply.py` (25, parse/merge/apply/idempotent), `tests/test_setup_sh.py` (17 + 1 shellcheck-skip, RAM 推奨 / 既存ファイル衝突 / dry-run / parent dir 作成), `tests/test_examples_yaml.py` (+5, 4 profiles 存在 / append_system_prompt 必須 / mode_aliases / coding head 検証)
|
|
21
|
+
- Runtime deps: 5 → 5 (18 sub-release 連続据え置き; `ruamel.yaml` は `[project.optional-dependencies].doctor` の optional)
|
|
22
|
+
- Backward compat: `default_profile: default` → `default_profile: multi` への変更を伴うため、**`examples/providers.yaml` を ~/.coderouter/providers.yaml にコピーし直すと挙動が変わります**。手元の `providers.yaml` は触らない限り変化なし。`mode_aliases.default → multi` で旧 default 呼び出しは multi に解決される後方互換あり
|
|
23
|
+
|
|
24
|
+
### Theme: 「意味合いがズレない代替モデル」を 3 段の対策で実現
|
|
25
|
+
|
|
26
|
+
Claude Code を主用途とするユーザーが直面する核心問題は、ローカル/オープンモデルへ fallback したときに **応答の "性格"** が Claude Sonnet/Opus と乖離して「なんでだろ?」と混乱することでした。v1.8.0 はこれに 3 段で対処:
|
|
27
|
+
|
|
28
|
+
1. **モデル選定を Claude 風に寄せる** — Qwen3.6 35B-A3B (note 記事 "local champ") と Qwen3-Coder family を coding 主軸に。Llama-3.3-70B は引き続き `claude_code_suitability: degraded` で claude-code chain から自動退避。Gemma 4 26B-A4B (note "日常の王者") を multi/general に
|
|
29
|
+
2. **`append_system_prompt` で nudge** — 4 プロファイルすべてに「Match Claude Sonnet's coding style」「Match Claude Haiku's style」等の指示を載せ、非 Claude モデルでも応答スタイルが寄るように。プロファイル単位で適用 (v0.6-B 既実装機能)
|
|
30
|
+
3. **`output_filters` で表面差をクリーンアップ** — Qwen 系の `<think>` リーク・stop marker は引き続き strip (v1.0-A)。Qwen3.6 / Qwen3-Coder 30B には `[strip_thinking, strip_stop_markers]` を default で付与
|
|
31
|
+
|
|
32
|
+
### Z.AI (GLM family) — Coding Plan の落とし穴と回避策
|
|
33
|
+
|
|
34
|
+
Z.AI の GLM-4.7 / 5.1 は note 記事で「intent 理解が Claude Opus 級」と評価される強力な選択肢。OpenAI 互換エンドポイントなので CodeRouter は `kind: openai_compat` でそのまま接続できますが、Coding Plan の規約に注意:
|
|
35
|
+
|
|
36
|
+
公式 docs (docs.z.ai/devpack/overview) は「**未認可サードパーティツール経由のアクセスは benefit が制限される可能性**」と明記しています。CodeRouter は Anthropic API 互換 ingress を持つので Claude Code から見て認可ツールに見えるはずですが、Z.AI 側の検出ロジック次第で「router 経由」と判定されるリスクは残ります。
|
|
37
|
+
|
|
38
|
+
`examples/providers.yaml` には 2 種類の base_url stanza を用意:
|
|
39
|
+
|
|
40
|
+
- `zai-coding-glm-4-7/5-1/4-5-air`: Coding Plan 用 (`api/coding/paas/v4`) — 加入者向け、CodeRouter 経由でも Claude Code 直結に見えるはず
|
|
41
|
+
- `zai-paas-glm-4-7` (commented): General API 用 (`api/paas/v4`) — pay-as-you-go、制限対象外。CodeRouter 経由で安心して使える
|
|
42
|
+
|
|
43
|
+
**推奨運用**: Coding Plan 加入者で確実性を取るなら Claude Code に Z.AI を直結 (CodeRouter 経由しない) または General API stanza を有効化。General API は使用量比例課金。
|
|
44
|
+
|
|
45
|
+
### Changes
|
|
46
|
+
|
|
47
|
+
#### v1.8-A: Trusted Publishing 自動化 (ドキュメントのみ、PyPI 側 1 回登録)
|
|
48
|
+
|
|
49
|
+
- PyPI 側で trusted publisher を登録 (Owner: zephel01, Repo: CodeRouter, Workflow: release.yml, Environment: pypi)
|
|
50
|
+
- GitHub 側で `pypi` environment を作成 (protection rules なし、シークレットなし)
|
|
51
|
+
- `docs/inside/release-pypi.md` §0-6 に登録手順 + 自動化後フローを追記、§11 のチェックリストを `[x]` 完了に
|
|
52
|
+
|
|
53
|
+
#### v1.8-B: `claude_code_suitability` hint
|
|
54
|
+
|
|
55
|
+
- `coderouter/config/capability_registry.py` の `RegistryCapabilities` / `ResolvedCapabilities` に `claude_code_suitability: Literal["ok", "degraded"] | None` フィールド追加。`lookup` メソッドの first-match-per-flag walk に新スロット
|
|
56
|
+
- `coderouter/data/model-capabilities.yaml` に Llama-3.3-70B family (`*llama-3.3-70b*` / `*Llama-3.3-70B*`) を `claude_code_suitability: degraded` で宣言
|
|
57
|
+
- `coderouter/logging.py` に `ChainClaudeCodeSuitabilityDegradedPayload` TypedDict + `log_chain_claude_code_suitability_degraded` helper 新設、msg は `chain-claude-code-suitability-degraded`
|
|
58
|
+
- `coderouter/routing/capability.py` に `CLAUDE_CODE_PROFILE_PREFIX = "claude-code"` 定数 + `check_claude_code_chain_suitability(config, *, logger, registry=None)` 関数。プロファイル名 prefix gate + chain walk + プロファイル単位 aggregate WARN
|
|
59
|
+
- `coderouter/ingress/app.py` の lifespan で startup 時に `check_claude_code_chain_suitability` を 1 行で呼び出し
|
|
60
|
+
|
|
61
|
+
#### v1.8-C: `coderouter doctor --check-model --apply` / `--dry-run`
|
|
62
|
+
|
|
63
|
+
- `coderouter/doctor_apply.py` 新設 — `parse_patch_yaml` (doctor の YAML literal をコメント strip + safe_load) / `deep_merge_dicts` (再帰マージ、idempotent 検出) / `merge_provider_patch_into_doc` / `merge_capabilities_rule_into_doc` / `apply_doctor_patches` (top-level entry, ApplyResult dataclass 返す) / `render_unified_diff` (stdlib `difflib.unified_diff`) / `DoctorApplyError` + `MissingDependencyError`
|
|
64
|
+
- `pyproject.toml` `[project.optional-dependencies].doctor = ["ruamel.yaml>=0.18.6"]` 追加 (base 5 deps streak は維持、`[dev]` にも入れて test 用)
|
|
65
|
+
- `coderouter/cli.py` の doctor subparser に `--apply` / `--dry-run` フラグ追加 + `_run_check_model` / `_resolve_config_path` / `_run_apply_or_dry_run` のヘルパ。doctor 提案の YAML パッチを 1 invocation で書き戻し可能に
|
|
66
|
+
- 冪等性: 既に同じ値が入っていれば no-op (file mtime 不変、exit 0、"already up to date" メッセージ)
|
|
67
|
+
- バックアップ: `--apply` 時に自動で `providers.yaml.bak` を作成 (overwriting 形式、git 派は git-diff で履歴管理)
|
|
68
|
+
|
|
69
|
+
#### v1.8-D: `setup.sh` onboarding ウィザード
|
|
70
|
+
|
|
71
|
+
- リポジトリルートに `setup.sh` 新設 (bash 3.2 互換、新規依存ゼロ)
|
|
72
|
+
- macOS (`sysctl hw.memsize`) / Linux (`/proc/meminfo`) で RAM 自動検出
|
|
73
|
+
- RAM → 推奨モデル: ≥24GB→qwen2.5-coder:14b / ≥12GB→qwen2.5-coder:7b / ≥6GB→qwen2.5-coder:1.5b / <6GB→cloud-only バイル + cloud hint
|
|
74
|
+
- `ollama` 不在チェック: 実 pull モード時のみ強制、`--no-pull` / `--dry-run` 時は許容
|
|
75
|
+
- 既存 `providers.yaml` 保護: デフォルトは `.new` sidecar に書き、`--force` 時のみ `.bak` 残して overwrite
|
|
76
|
+
- 生成 YAML が live `CodeRouterConfig` Pydantic schema で round-trip すること、を回帰テストで pin
|
|
77
|
+
|
|
78
|
+
#### v1.8-E: examples/providers.yaml の 4 プロファイル構成 + Gemma 4/Qwen3.6/Z.AI 登録
|
|
79
|
+
|
|
80
|
+
- `default_profile: default` → `default_profile: multi` に変更 (新 default はマルチモーダル対応 chain)
|
|
81
|
+
- 4 プロファイル新設:
|
|
82
|
+
- `multi` (default): vision-capable、Gemma 4 26B local primary → Sonnet 4-6 with vision paid 終端
|
|
83
|
+
- `coding`: Qwen3.6 35B-A3B (note "local champ") → Qwen3-Coder 30B → ... → GLM-4.7 → Sonnet 4-6
|
|
84
|
+
- `general`: Gemma 4 E4B (laptop でも動く軽量) → Gemini Flash free → GLM-4.5-Air → Haiku 4-5
|
|
85
|
+
- `reasoning`: Qwen3.6 35B (thinking native) → ... → GLM-5.1 → Opus 4-1 with thinking
|
|
86
|
+
- 全プロファイルに `append_system_prompt` で Claude 風応答を nudge
|
|
87
|
+
- `mode_aliases`: `default → multi`, `fast → general`, `vision → multi`, `think → reasoning`, `cheap → general`
|
|
88
|
+
- 新規プロバイダ 11 種追加: Qwen3.6 (27b/35b), Gemma 4 (e4b/26b/31b), Z.AI (GLM-4.7/5.1/4.5-Air), Gemini Flash free, Claude Haiku/Opus direct
|
|
89
|
+
- `coderouter/data/model-capabilities.yaml` に `qwen3.6:*` (tools=true, claude_code_suitability=ok), `gemma4:*` (tools=true), `GLM-5*` / `GLM-4.[5-9]*` (tools=true) family を新規登録
|
|
90
|
+
- HF-on-Ollama コメント stanza は Gemma 4 / Qwen3.6 公式 tag 化に伴い縮小、GLM-4.5-Air は Z.AI cloud と HF GGUF の両方を案内
|
|
91
|
+
- `docs/hf-ollama-models.md` 新設 (HF GGUF を Ollama に登録する手順、推奨モデル別レシピ、既知の落とし穴)
|
|
92
|
+
|
|
93
|
+
### Migration
|
|
94
|
+
|
|
95
|
+
`pyproject.toml version 1.7.0 → 1.8.0`、`coderouter --version` は 1.8.0 を返すように。**手元の `~/.coderouter/providers.yaml` は触らない限り完全に変化なし** (新 example は `examples/providers.yaml` のみで、コピー操作は手動)。
|
|
96
|
+
|
|
97
|
+
新 example を試したい場合:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
# 既存 config をバックアップしつつ新 example をコピー
|
|
101
|
+
cp ~/.coderouter/providers.yaml ~/.coderouter/providers.yaml.bak
|
|
102
|
+
cp examples/providers.yaml ~/.coderouter/providers.yaml
|
|
103
|
+
|
|
104
|
+
# Ollama に推奨モデルを pull (24GB+ VRAM の場合)
|
|
105
|
+
ollama pull qwen3.6:35b
|
|
106
|
+
ollama pull qwen3-coder:30b-a3b
|
|
107
|
+
ollama pull gemma4:26b
|
|
108
|
+
|
|
109
|
+
# Z.AI を使うなら API key を環境変数に
|
|
110
|
+
echo 'export Z_AI_API_KEY="your-key-here"' >> ~/.zshrc
|
|
111
|
+
source ~/.zshrc
|
|
112
|
+
|
|
113
|
+
# 確認
|
|
114
|
+
coderouter doctor --check-model local --apply # 自動 patch も試せる
|
|
115
|
+
coderouter serve --port 8088 --mode coding # 用途別に明示
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
`--mode default` は新 example では `multi` (マルチモーダル chain) に解決されます。旧 example の意味合い (Qwen2.5-Coder + cloud chain) を維持したい場合は `--mode coding` を使うか、`mode_aliases` に独自 alias を追加してください。
|
|
119
|
+
|
|
120
|
+
### Real-machine verification
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
$ pytest -q
|
|
124
|
+
710 passed, 1 skipped in 1.81s
|
|
125
|
+
|
|
126
|
+
$ ruff check coderouter/ tests/
|
|
127
|
+
All checks passed!
|
|
128
|
+
|
|
129
|
+
$ mypy --strict coderouter/doctor_apply.py coderouter/cli.py
|
|
130
|
+
Success: no issues found in 4 source files
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`coderouter doctor --check-model X --apply` の冪等性 + バックアップ作成を smoke test で確認:
|
|
134
|
+
|
|
135
|
+
```
|
|
136
|
+
$ coderouter doctor --check-model local --apply
|
|
137
|
+
[probe report ...]
|
|
138
|
+
Apply: 1 target file(s).
|
|
139
|
+
1 patch(es) applied.
|
|
140
|
+
[diff 表示]
|
|
141
|
+
Backup: ~/.coderouter/providers.yaml → ~/.coderouter/providers.yaml.bak
|
|
142
|
+
|
|
143
|
+
$ coderouter doctor --check-model local --apply # 二回目は no-op
|
|
144
|
+
Apply: 1 target file(s).
|
|
145
|
+
All 1 patch(es) already applied — providers.yaml is up to date.
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### Out of scope / 次回送り (v1.9 候補)
|
|
149
|
+
|
|
150
|
+
- v1.7-C 候補は引き続き需要待ち: `coderouter doctor --network`, `--check-config`/`--check-adapter` (引数なし全部回す mode), `recover_garbled_tool_json` 拡張, 起動時アップデートチェック
|
|
151
|
+
- macOS `.command` / Linux `.sh` / Windows `.bat` launcher は `uvx coderouter-cli` で onboarding 摩擦が十分低くなったため再評価
|
|
152
|
+
- PEP 541 reclamation (`coderouter` 名前空間) は引き続き審査待ち、進捗あれば plan.md §11.B に追記
|
|
153
|
+
- Z.AI Coding Plan の "router 経由でも認可される" 保証取得 (Z.AI 側へのフィードバック)
|
|
154
|
+
|
|
155
|
+
---
|
|
156
|
+
|
|
157
|
+
## [v1.7.0] — 2026-04-25 (PyPI 公開: `uvx coderouter-cli` 一発で動く)
|
|
158
|
+
|
|
159
|
+
**Theme: 「git clone してから `uv tool install --from git+...`」の onboarding 摩擦をゼロにする minor リリース。** PyPI に **`coderouter-cli`** として公開、以降は `uvx coderouter-cli serve --port 8088` の 1 行で何処からでもインストール + 起動できるようになりました。配布インフラ整備のための小さなコード変更 (パッケージ名、`importlib.metadata` lookup 名追従) と、リリースを反復可能にする GitHub Actions workflow / `pyproject.toml` の sdist allowlist が同梱です。Runtime / API 挙動は v1.6.3 から完全に変化なし。
|
|
160
|
+
|
|
161
|
+
- Tests: 651 → **651** (±0、コード変更は配布周りのみ)
|
|
162
|
+
- Runtime deps: 5 → 5 (17 sub-release 連続据え置き)
|
|
163
|
+
- New PyPI package: [`coderouter-cli`](https://pypi.org/project/coderouter-cli/) (Python ≥ 3.12)
|
|
164
|
+
- Backward compat: 既存の `git clone + uv tool install --from git+...` 経路も引き続き有効。`coderouter` コマンド名 / Python import 名 (`from coderouter import ...`) も完全に変化なし
|
|
165
|
+
|
|
166
|
+
### Why `coderouter-cli` (and not `coderouter`)
|
|
167
|
+
|
|
168
|
+
PyPI 上の `coderouter` 名前空間は別作者 (Lawrence Chen) の HTTP routing 系汎用ライブラリ (2025-06 公開、0.1.0 のみ、ドメイン完全別物) によって既に取得済みでした。新規 publish には別名が必要なため、npm / cargo の慣習 (`*-cli` suffix で CLI ツール) に倣って `coderouter-cli` で取得。**Python import 名と console script 名は両方とも `coderouter` のまま**なので、ユーザー視点では `pip install` 時の名前だけが異なります:
|
|
169
|
+
|
|
170
|
+
```bash
|
|
171
|
+
pip install coderouter-cli # ← install (名前変わる)
|
|
172
|
+
import coderouter # ← import (変わらない)
|
|
173
|
+
coderouter serve --port 8088 # ← run (変わらない)
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
PEP 541 reclamation request で `coderouter` 名を引き取る道は plan.md §11.B に追跡として残します (通っても 1〜数ヶ月かかるので、その間は `coderouter-cli` で運用)。
|
|
177
|
+
|
|
178
|
+
### Changes
|
|
179
|
+
|
|
180
|
+
- **PyPI publish 化** — `pyproject.toml` の `name` を `coderouter` → `coderouter-cli` に変更、`version` を 1.7.0 に bump、`classifiers` / `project.urls` / `keywords` を publish に必要なメタデータで enrich (`Topic :: Scientific/Engineering :: Artificial Intelligence` / Homepage / Issues / Changelog / Documentation の 4 URL)
|
|
181
|
+
- **`coderouter/__init__.py`** — `importlib.metadata.version("coderouter")` を `version("coderouter-cli")` に追従。Python import 名 (`coderouter`) は変わらないので、`from coderouter import ...` する全ユーザーには影響なし
|
|
182
|
+
- **`LICENSE` 新規** — MIT License を明示的にファイル化、wheel の `dist-info/licenses/LICENSE` に同梱されるようになった (PyPI の license 表示と sdist の完全性向上)
|
|
183
|
+
- **`tool.hatch.build.targets.sdist`** — `only-include` で sdist を厳格 allowlist 化。ローカル virtualenv (`.venv*`) や `__pycache__` / `dist/` / `.pytest_cache` 等を絶対に取り込まない設計に。これで `uv build` がどのマシンでも同じサイズ (sdist 668 KB / wheel 161 KB) を出す
|
|
184
|
+
- **`.github/workflows/release.yml` 新規** — `git tag v*` push 時に Trusted Publishing (OIDC、API トークン不要) で PyPI へ自動 publish + GitHub Release 草稿作成。**初回 publish (v1.7.0) は手動で実施**、Trusted Publisher 登録後の v1.7.x 以降は tag push のみで自動化される
|
|
185
|
+
- **doc reorder for new entry path** — README ja/en、quickstart.md ja/en、free-tier-guide ja/en の install セクションを `uvx coderouter-cli` 中心に書き換え。`uv tool install --from git+...` 経路は中級者向けに残置
|
|
186
|
+
|
|
187
|
+
### Real-machine verification
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
$ uv build
|
|
191
|
+
Successfully built dist/coderouter_cli-1.7.0.tar.gz (668 KB, .venv 汚染ゼロ)
|
|
192
|
+
Successfully built dist/coderouter_cli-1.7.0-py3-none-any.whl (161 KB)
|
|
193
|
+
|
|
194
|
+
$ coderouter-publish-prod # = op run + uv publish (1Password から PYPI_TOKEN を inject)
|
|
195
|
+
Publishing 2 files https://upload.pypi.org/legacy/
|
|
196
|
+
Uploading coderouter_cli-1.7.0-py3-none-any.whl (157.7KiB)
|
|
197
|
+
Uploading coderouter_cli-1.7.0.tar.gz (652.7KiB)
|
|
198
|
+
|
|
199
|
+
$ curl -sI "https://pypi.org/pypi/coderouter-cli/json" | head -1
|
|
200
|
+
HTTP/2 200
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
CDN 伝播後に `uvx coderouter-cli --version` で本物の PyPI 経由インストールも確認済み。
|
|
204
|
+
|
|
205
|
+
### Migration
|
|
206
|
+
|
|
207
|
+
不要。**v1.6.x までで `uv tool install --from git+...` していたユーザーは、自然なアップグレード経路として:**
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# 旧 (引き続き有効)
|
|
211
|
+
uv tool install --from git+https://github.com/zephel01/CodeRouter.git coderouter-cli
|
|
212
|
+
|
|
213
|
+
# 新 (PyPI から、コマンド 1 行)
|
|
214
|
+
uvx coderouter-cli serve --port 8088
|
|
215
|
+
# あるいは恒久的に:
|
|
216
|
+
uv tool install coderouter-cli
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
`coderouter` 起動コマンド名、`from coderouter import ...` の Python import、`providers.yaml` のフォーマット、env 変数 (`ANTHROPIC_BASE_URL` 等)、ingress の URL 構造、すべて v1.6.3 と完全に同じです。
|
|
220
|
+
|
|
221
|
+
### Out of scope / 次回送り (v1.7-B 以降)
|
|
222
|
+
|
|
223
|
+
v1.7.0 (= v1.7-A) は配布パイプラインだけに集中して shipping させました。plan.md §11.B に記載された残りの v1.7 候補機能は v1.7-B 以降で:
|
|
224
|
+
|
|
225
|
+
- `coderouter doctor --check-config` / `--check-adapter` (引数なしで全部回す mode)
|
|
226
|
+
- `coderouter doctor --network` (外向き接続検出、CI で 0 outbound 保証)
|
|
227
|
+
- `setup.sh` (RAM 検出 → モデル提案 → providers.yaml 生成)
|
|
228
|
+
- macOS `.command` / Linux `.sh` / Windows `.bat` launcher
|
|
229
|
+
- 起動時アップデートチェック (opt-in)
|
|
230
|
+
- capability registry の `claude_code_suitability` hint (Llama-3.3-70B 系の startup WARN)
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
9
234
|
## [v1.6.3] — 2026-04-24 (`--env-file` + `doctor --check-env` for `.env` hygiene)
|
|
10
235
|
|
|
11
236
|
**Theme: ergonomic + safe `.env` handling, without rolling our own crypto.** v1.6.2 documented the `.env` `export` gotcha; v1.6.3 makes it disappear by giving operators two new tools that integrate cleanly with the existing secret-management ecosystem (1Password CLI, sops, direnv, OS Keychain) instead of inventing yet another encryption scheme.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: coderouter-cli
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.8.0
|
|
4
4
|
Summary: Local-first, free-first, fallback-built-in LLM router. Claude Code / OpenAI compatible.
|
|
5
5
|
Project-URL: Homepage, https://github.com/zephel01/CodeRouter
|
|
6
6
|
Project-URL: Repository, https://github.com/zephel01/CodeRouter
|
|
@@ -32,8 +32,11 @@ Requires-Dist: mypy>=1.13.0; extra == 'dev'
|
|
|
32
32
|
Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
|
|
33
33
|
Requires-Dist: pytest-httpx>=0.32.0; extra == 'dev'
|
|
34
34
|
Requires-Dist: pytest>=8.3.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: ruamel-yaml>=0.18.6; extra == 'dev'
|
|
35
36
|
Requires-Dist: ruff>=0.7.0; extra == 'dev'
|
|
36
37
|
Requires-Dist: types-pyyaml>=6.0.12; extra == 'dev'
|
|
38
|
+
Provides-Extra: doctor
|
|
39
|
+
Requires-Dist: ruamel-yaml>=0.18.6; extra == 'doctor'
|
|
37
40
|
Description-Content-Type: text/markdown
|
|
38
41
|
|
|
39
42
|
<h1 align="center">CodeRouter</h1>
|
|
@@ -57,7 +60,7 @@ Description-Content-Type: text/markdown
|
|
|
57
60
|
<p align="center">
|
|
58
61
|
<a href="https://github.com/zephel01/CodeRouter/actions/workflows/ci.yml"><img src="https://github.com/zephel01/CodeRouter/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
|
|
59
62
|
<a href=""><img src="https://img.shields.io/badge/status-stable-brightgreen" alt="status"></a>
|
|
60
|
-
<a href=""><img src="https://img.shields.io/badge/version-1.
|
|
63
|
+
<a href=""><img src="https://img.shields.io/badge/version-1.8.0-blue" alt="version"></a>
|
|
61
64
|
<a href=""><img src="https://img.shields.io/badge/python-3.12%2B-blue" alt="python"></a>
|
|
62
65
|
<a href=""><img src="https://img.shields.io/badge/runtime%20deps-5-brightgreen" alt="deps"></a>
|
|
63
66
|
<a href=""><img src="https://img.shields.io/badge/license-MIT-yellow" alt="license"></a>
|
|
@@ -83,7 +86,7 @@ Description-Content-Type: text/markdown
|
|
|
83
86
|
- `coderouter doctor --check-model <provider>` でそのモデルが tool call / streaming / thinking に対応しているかを**実プローブで即診断**し、足りない宣言をコピペ可能な YAML パッチで教えてくれる
|
|
84
87
|
- reasoning leak(`<think>...</think>` タグや `<|turn|>` など 6 種の stop マーカー漏れ)を SSE チャンク境界を跨いで自動スクラブ
|
|
85
88
|
- ローカル → 無料クラウド(OpenRouter free / NVIDIA NIM 40 req/min 無料枠)→ 有料 API の自動フォールバック。既定で `ALLOW_PAID=false` なので課金はオプトイン制
|
|
86
|
-
- ランタイム依存 5 個(`fastapi` / `uvicorn` / `httpx` / `pydantic` / `pyyaml`)— 純 Python、MIT、テスト
|
|
89
|
+
- ランタイム依存 5 個(`fastapi` / `uvicorn` / `httpx` / `pydantic` / `pyyaml`)— 純 Python、MIT、テスト 710 本緑
|
|
87
90
|
|
|
88
91
|
→ **Claude Code / gemini-cli / codex + Ollama / llama.cpp / NVIDIA NIM で、破綻しない local-first agent が組める**
|
|
89
92
|
|
|
@@ -97,7 +100,7 @@ Description-Content-Type: text/markdown
|
|
|
97
100
|
| **要るか判断する** | [要否判定ガイド](./docs/when-do-i-need-coderouter.md) | エージェント × モデルの詳細マトリクスで「そもそも自分に必要か」を決める |
|
|
98
101
|
| **詰まったとき** | [トラブルシューティング](./docs/troubleshooting.md) | `doctor` の使い方、`.env` の export 必須、Ollama サイレント失敗 5 症状、Claude Code 連携の罠 |
|
|
99
102
|
| **安全に使う** | [セキュリティ方針](./docs/security.md) | 脅威モデル・秘密情報の扱い・脆弱性報告経路 |
|
|
100
|
-
| **履歴** | [CHANGELOG](./CHANGELOG.md) | 全リリース履歴(最新: v1.
|
|
103
|
+
| **履歴** | [CHANGELOG](./CHANGELOG.md) | 全リリース履歴(最新: v1.8.0 — 用途別 4 プロファイル + GLM/Gemma 4/Qwen3.6 公式化 + apply 自動化) |
|
|
101
104
|
| **設計を追う** | [plan.md](./plan.md) | 設計不変項・マイルストーン・今後のロードマップ |
|
|
102
105
|
|
|
103
106
|
English versions: [Quickstart](./docs/quickstart.en.md) · [Usage guide](./docs/usage-guide.en.md) · [Free-tier guide](./docs/free-tier-guide.en.md) · [When you need it](./docs/when-do-i-need-coderouter.en.md) · [Troubleshooting](./docs/troubleshooting.en.md) · [Security](./docs/security.en.md)
|
|
@@ -113,7 +116,7 @@ CodeRouter は、コーディングエージェント(Claude Code / gemini-cli
|
|
|
113
116
|
- **うっかり課金しない。** `ALLOW_PAID=false` が既定。有料プロバイダをチェーンから外したときは理由を 1 行ログに出すので、なぜ使われなかったかが後で grep できます。
|
|
114
117
|
- **ローカル Ollama の上で Claude Code / gemini-cli / codex が動く。** Claude Code は Anthropic のワイアフォーマット、Ollama / llama.cpp / LM Studio は OpenAI。CodeRouter が双方向に変換し、小さいローカルモデルがテキストで吐いてしまう `{"name":..., "arguments":...}` を tool_use ブロックへ復元してからエージェントに渡します。
|
|
115
118
|
- **「なぜか動かない」の原因を教えてくれる。** `coderouter doctor --check-model <provider>` が 6 種類の典型的な失敗モード(コンテキスト切り詰め / ストリーム早期終了 / ツール呼び出し欠落 / reasoning フィールド漏れ / 認証 / Anthropic `thinking`)を実地プローブし、コピペ可能な YAML パッチを出します。
|
|
116
|
-
- **監査しやすい。** ランタイム依存 5 個(LiteLLM は 100+)。Pure Python、MIT、テスト
|
|
119
|
+
- **監査しやすい。** ランタイム依存 5 個(LiteLLM は 100+)。Pure Python、MIT、テスト 710 本緑。
|
|
117
120
|
|
|
118
121
|
```
|
|
119
122
|
クライアント (Claude Code / OpenAI SDK / gemini-cli / codex / curl)
|
|
@@ -172,22 +175,42 @@ OpenAI 互換エージェント + お行儀の良いモデル + フォールバ
|
|
|
172
175
|
|
|
173
176
|
## クイックスタート(3 コマンド)
|
|
174
177
|
|
|
175
|
-
|
|
176
|
-
# 1. インストール (uv を利用 — 高速・lockfile フレンドリー)
|
|
177
|
-
uv sync
|
|
178
|
+
**v1.7.0 で PyPI 公開**、**v1.8.0 で用途別 4 プロファイル + Z.AI/GLM 連携**を追加しました。`uvx` 一発で動きます (Python 3.12 以上必須):
|
|
178
179
|
|
|
179
|
-
|
|
180
|
+
```bash
|
|
181
|
+
# 1. サンプル設定を置く
|
|
180
182
|
mkdir -p ~/.coderouter
|
|
181
|
-
|
|
183
|
+
curl -fsSL https://raw.githubusercontent.com/zephel01/CodeRouter/main/examples/providers.yaml \
|
|
184
|
+
> ~/.coderouter/providers.yaml
|
|
185
|
+
|
|
186
|
+
# 2. uvx で起動 (インストール + 起動が 1 行)
|
|
187
|
+
uvx coderouter-cli serve --port 8088
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
恒久的にインストールしておきたい場合:
|
|
191
|
+
|
|
192
|
+
```bash
|
|
193
|
+
uv tool install coderouter-cli
|
|
194
|
+
coderouter serve --port 8088
|
|
195
|
+
```
|
|
182
196
|
|
|
183
|
-
|
|
184
|
-
|
|
197
|
+
git clone して開発にも参加したい場合 (中級者向け):
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
git clone https://github.com/zephel01/CodeRouter.git
|
|
201
|
+
cd CodeRouter
|
|
202
|
+
uv sync
|
|
203
|
+
uv run coderouter serve --port 8088
|
|
185
204
|
```
|
|
186
205
|
|
|
187
|
-
|
|
206
|
+
> **注**: PyPI 上のパッケージ名は `coderouter-cli` ですが、コマンド名と Python import 名は `coderouter` のままです。詳しくは [CHANGELOG `[v1.7.0]`](./CHANGELOG.md#v170--2026-04-25-pypi-公開-uvx-coderouter-cli-一発で動く) 参照。
|
|
207
|
+
>
|
|
208
|
+
> **v1.8.0 の `--apply` 自動化を使う場合**: `ruamel.yaml` を optional dep として一緒に入れます (`pip install 'coderouter-cli[doctor]'` または `uv pip install ruamel.yaml`)。基本機能には不要です。
|
|
209
|
+
|
|
210
|
+
あとは任意の OpenAI クライアントを `http://127.0.0.1:8088` に向けるだけです:
|
|
188
211
|
|
|
189
212
|
```bash
|
|
190
|
-
curl http://127.0.0.1:
|
|
213
|
+
curl http://127.0.0.1:8088/v1/chat/completions \
|
|
191
214
|
-H 'Content-Type: application/json' \
|
|
192
215
|
-d '{
|
|
193
216
|
"model": "ignored",
|
|
@@ -220,7 +243,7 @@ CodeRouter 自体は純 Python 3.12+ で、実質的な OS 対応範囲は `min(
|
|
|
220
243
|
|
|
221
244
|
## ステータス — v1.0 安定版 (2026-04)
|
|
222
245
|
|
|
223
|
-
**テスト
|
|
246
|
+
**テスト 710 本通過。ランタイム依存 5 個。macOS / Linux / Windows WSL2 で動作。** ルーターは日常的な Claude Code 用途で安定しています。v1.0 の総まとめは [`docs/retrospectives/v1.0.md`](./docs/retrospectives/v1.0.md)。
|
|
224
247
|
|
|
225
248
|
今日の CodeRouter が届ける価値:
|
|
226
249
|
|
|
@@ -234,7 +257,7 @@ CodeRouter 自体は純 Python 3.12+ で、実質的な OS 対応範囲は `min(
|
|
|
234
257
|
|
|
235
258
|
**リリース単位の詳細が欲しい?** v0.x と v1.0-A/B/C の各スライス — 何が入り、何本のテストが増え、なぜ必要だったのか — は [CHANGELOG.md](./CHANGELOG.md) に揃っています。設計の不変項と今後のロードマップは [plan.md](./plan.md)。
|
|
236
259
|
|
|
237
|
-
**次の予定**(v1.0 は [plan.md §10](./plan.md)、v1.0+ は §18): v1.5 ✅
|
|
260
|
+
**次の予定**(v1.0 は [plan.md §10](./plan.md)、v1.0+ は §18): v1.5 ✅ メトリクス / `/dashboard` / `coderouter stats` TUI / `scripts/demo_traffic.sh`、v1.6 ✅ `auto_router` (task-aware routing) + NVIDIA NIM 無料枠 + トラブルシュートドキュメント分離 + `--env-file` / `doctor --check-env`、v1.7 ✅ PyPI 公開 (`uvx coderouter-cli`)、v1.8 ✅ 用途別 4 プロファイル (multi/coding/general/reasoning) + Gemma 4 / Qwen3.6 / Z.AI (GLM) 登録 + `setup.sh` onboarding ウィザード + `coderouter doctor --check-model --apply` (非破壊 YAML 書き戻し) + `claude_code_suitability` startup チェック + Trusted Publishing 自動化。残り (v1.9 候補) は `coderouter doctor --network` (CI 用) / launcher スクリプト / 起動時アップデートチェック (opt-in)。
|
|
238
261
|
|
|
239
262
|
### Claude Code と一緒に使う
|
|
240
263
|
|
|
@@ -406,9 +429,11 @@ suggested patch for ~/.coderouter/providers.yaml:
|
|
|
406
429
|
|
|
407
430
|
予定(v1.0 は [plan.md §10](./plan.md)、v1.0+ は §18):
|
|
408
431
|
|
|
409
|
-
- v1.0 — 14 ケースのリグレッションスイート、Code Mode (スリム版 Claude Code ハーネス); 出力クリーニングは **v1.0-A** で `output_filters` チェーンとして完了
|
|
410
|
-
- v1.5 — **メトリクスダッシュボード(出荷済み)** — `MetricsCollector` + `GET /metrics.json` + `GET /metrics` (Prometheus) + `GET /dashboard` (HTML 1 ページ) + `coderouter stats` curses TUI + `scripts/demo_traffic.sh` トラフィックジェネレータ + `display_timezone` 設定
|
|
411
|
-
- v1.6 — `
|
|
432
|
+
- v1.0 ✅ — 14 ケースのリグレッションスイート、Code Mode (スリム版 Claude Code ハーネス); 出力クリーニングは **v1.0-A** で `output_filters` チェーンとして完了
|
|
433
|
+
- v1.5 ✅ — **メトリクスダッシュボード(出荷済み)** — `MetricsCollector` + `GET /metrics.json` + `GET /metrics` (Prometheus) + `GET /dashboard` (HTML 1 ページ) + `coderouter stats` curses TUI + `scripts/demo_traffic.sh` トラフィックジェネレータ + `display_timezone` 設定
|
|
434
|
+
- v1.6 ✅ — `auto_router` (task-aware routing、`default_profile: auto` で画像/コード濃度/その他を自動振り分け) + NVIDIA NIM 無料枠 8 段チェーン + ドキュメント言語スワップ (JA primary) + トラブルシュート独立ドキュメント + `--env-file` / `doctor --check-env`
|
|
435
|
+
- v1.7 ✅ — PyPI 公開 (`uvx coderouter-cli` で 1 行起動) + Trusted Publishing 経路 (release.yml で自動 publish)
|
|
436
|
+
- v1.8 ✅ — **用途別 4 プロファイル + GLM/Gemma 4/Qwen3.6 公式化 + apply 自動化**: `multi` (default) / `coding` / `general` / `reasoning` の 4 プロファイル + 全プロファイルに `append_system_prompt` で Claude 風応答 nudge + `mode_aliases` (default/fast/vision/think/cheap)、Ollama 公式 tag 化された `gemma4:e4b/26b/31b` / `qwen3.6:27b/35b` を active stanza に格上げ、Z.AI を OpenAI-compat で 2 base_url 提供 (Coding Plan / General API)、`coderouter doctor --check-model --apply` で YAML パッチを非破壊書き戻し (`ruamel.yaml` round-trip でコメント・key 順序保持、冪等)、`setup.sh` onboarding ウィザード、`claude_code_suitability` startup チェック (Llama-3.3-70B 系を `claude-code-*` profile で WARN)。残り (v1.9 以降): `coderouter doctor --network` (CI 用)、launcher スクリプト (`.command` / `.sh` / `.bat`)、opt-in 起動時アップデートチェック
|
|
412
437
|
|
|
413
438
|
## `kind: openai_compat` と `kind: anthropic` の選び方
|
|
414
439
|
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
<p align="center">
|
|
21
21
|
<a href="https://github.com/zephel01/CodeRouter/actions/workflows/ci.yml"><img src="https://github.com/zephel01/CodeRouter/actions/workflows/ci.yml/badge.svg?branch=main" alt="CI"></a>
|
|
22
22
|
<a href=""><img src="https://img.shields.io/badge/status-stable-brightgreen" alt="status"></a>
|
|
23
|
-
<a href=""><img src="https://img.shields.io/badge/version-1.
|
|
23
|
+
<a href=""><img src="https://img.shields.io/badge/version-1.8.0-blue" alt="version"></a>
|
|
24
24
|
<a href=""><img src="https://img.shields.io/badge/python-3.12%2B-blue" alt="python"></a>
|
|
25
25
|
<a href=""><img src="https://img.shields.io/badge/runtime%20deps-5-brightgreen" alt="deps"></a>
|
|
26
26
|
<a href=""><img src="https://img.shields.io/badge/license-MIT-yellow" alt="license"></a>
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
- `coderouter doctor --check-model <provider>` runs live probes against the provider and tells you whether it actually supports tool_calls / streaming / thinking — with a copy-paste YAML patch when declarations and behavior disagree
|
|
46
46
|
- Scrubs reasoning leaks (`<think>...</think>` tags and six variants of `<|turn|>` / `<|eot_id|>` / `<|im_end|>` stop markers) across SSE chunk boundaries
|
|
47
47
|
- Automatic fallback from local → free cloud (OpenRouter free / NVIDIA NIM 40 req/min free tier) → paid APIs, with `ALLOW_PAID=false` as the default so billing is opt-in
|
|
48
|
-
- Five runtime dependencies (`fastapi` / `uvicorn` / `httpx` / `pydantic` / `pyyaml`) — pure Python, MIT,
|
|
48
|
+
- Five runtime dependencies (`fastapi` / `uvicorn` / `httpx` / `pydantic` / `pyyaml`) — pure Python, MIT, 710 tests green
|
|
49
49
|
|
|
50
50
|
→ **Claude Code / gemini-cli / codex on top of Ollama / llama.cpp / NVIDIA NIM, without the agent falling apart.**
|
|
51
51
|
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
| **Decide if you need it** | [Decision guide](./docs/when-do-i-need-coderouter.en.md) | Agent × model matrix to figure out whether CodeRouter fits your setup at all |
|
|
60
60
|
| **When stuck** | [Troubleshooting](./docs/troubleshooting.en.md) | How to use `doctor`, why `.env` needs `export`, the 5 Ollama silent-fail symptoms, Claude Code integration gotchas |
|
|
61
61
|
| **Operate safely** | [Security](./docs/security.en.md) | Threat model, secret handling, vulnerability reporting |
|
|
62
|
-
| **History** | [CHANGELOG](./CHANGELOG.md) | All releases (latest: v1.
|
|
62
|
+
| **History** | [CHANGELOG](./CHANGELOG.md) | All releases (latest: v1.8.0 — use-case-aware 4 profiles + GLM/Gemma 4/Qwen3.6 official tags + apply automation) |
|
|
63
63
|
| **Track the design** | [plan.md](./plan.md) | Design invariants, milestones, roadmap |
|
|
64
64
|
|
|
65
65
|
日本語版: [Quickstart](./docs/quickstart.md) · [利用ガイド](./docs/usage-guide.md) · [無料枠ガイド](./docs/free-tier-guide.md) · [要否判定](./docs/when-do-i-need-coderouter.md) · [トラブルシューティング](./docs/troubleshooting.md) · [Security](./docs/security.md)
|
|
@@ -75,7 +75,7 @@ Concretely, it takes care of things most beginners hit the hard way:
|
|
|
75
75
|
- **No surprise bill.** `ALLOW_PAID=false` is the default; when CodeRouter drops a paid provider from the chain it logs one clear line so you can see why.
|
|
76
76
|
- **Use Claude Code / gemini-cli / codex on top of local Ollama.** Claude Code speaks Anthropic wire format, Ollama / llama.cpp / LM Studio speak OpenAI. CodeRouter translates both directions, and repairs the malformed `{"name":..., "arguments":...}` JSON that small local models emit as plain text.
|
|
77
77
|
- **Know *why* your local model is acting weird.** `coderouter doctor --check-model <provider>` probes six common failure modes (context truncation, streaming cutoff, missing tool-use, reasoning leaks, auth, Anthropic `thinking`) and prints a copy-paste YAML patch.
|
|
78
|
-
- **Auditable.** 5 runtime dependencies (vs. 100+ for LiteLLM). Pure Python, MIT,
|
|
78
|
+
- **Auditable.** 5 runtime dependencies (vs. 100+ for LiteLLM). Pure Python, MIT, 710 tests passing.
|
|
79
79
|
|
|
80
80
|
```
|
|
81
81
|
Client (Claude Code / OpenAI SDK / gemini-cli / codex / curl)
|
|
@@ -132,24 +132,44 @@ If you're on an OpenAI-compatible agent with a well-behaved model and don't need
|
|
|
132
132
|
|
|
133
133
|
Design invariants and the roadmap are in [`plan.md`](./plan.md). Beginner-friendly articles on *why the same local model sometimes works and sometimes doesn't* are published separately on Zenn / Note.
|
|
134
134
|
|
|
135
|
-
## Quickstart (
|
|
135
|
+
## Quickstart (2 commands)
|
|
136
136
|
|
|
137
|
-
|
|
138
|
-
# 1. Install (uses uv — fast, lockfile-friendly)
|
|
139
|
-
uv sync
|
|
137
|
+
**v1.7.0 published to PyPI**, **v1.8.0 added use-case-aware 4 profiles + Z.AI/GLM integration**. `uvx` installs and runs in one shot (Python 3.12+ required):
|
|
140
138
|
|
|
141
|
-
|
|
139
|
+
```bash
|
|
140
|
+
# 1. Drop a sample config
|
|
142
141
|
mkdir -p ~/.coderouter
|
|
143
|
-
|
|
142
|
+
curl -fsSL https://raw.githubusercontent.com/zephel01/CodeRouter/main/examples/providers.yaml \
|
|
143
|
+
> ~/.coderouter/providers.yaml
|
|
144
|
+
|
|
145
|
+
# 2. Install + run, in one line
|
|
146
|
+
uvx coderouter-cli serve --port 8088
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
Want a permanent install?
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
uv tool install coderouter-cli
|
|
153
|
+
coderouter serve --port 8088
|
|
154
|
+
```
|
|
144
155
|
|
|
145
|
-
|
|
146
|
-
|
|
156
|
+
Cloning for development?
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
git clone https://github.com/zephel01/CodeRouter.git
|
|
160
|
+
cd CodeRouter
|
|
161
|
+
uv sync
|
|
162
|
+
uv run coderouter serve --port 8088
|
|
147
163
|
```
|
|
148
164
|
|
|
149
|
-
|
|
165
|
+
> **Note**: the PyPI distribution name is `coderouter-cli`, but the command and Python import name are both `coderouter`. See [CHANGELOG `[v1.7.0]`](./CHANGELOG.md#v170--2026-04-25-pypi-公開-uvx-coderouter-cli-一発で動く) for details.
|
|
166
|
+
>
|
|
167
|
+
> **For the v1.8.0 `--apply` automation**: install `ruamel.yaml` as the optional dependency (`pip install 'coderouter-cli[doctor]'` or `uv pip install ruamel.yaml`). Not required for the base feature set.
|
|
168
|
+
|
|
169
|
+
Then point any OpenAI client at `http://127.0.0.1:8088`:
|
|
150
170
|
|
|
151
171
|
```bash
|
|
152
|
-
curl http://127.0.0.1:
|
|
172
|
+
curl http://127.0.0.1:8088/v1/chat/completions \
|
|
153
173
|
-H 'Content-Type: application/json' \
|
|
154
174
|
-d '{
|
|
155
175
|
"model": "ignored",
|
|
@@ -182,7 +202,7 @@ Full matrix with caveats and the "no local GPU" recipe: [usage guide §1](./docs
|
|
|
182
202
|
|
|
183
203
|
## Status — v1.0 stable (2026-04)
|
|
184
204
|
|
|
185
|
-
**
|
|
205
|
+
**710 tests pass. 5 runtime dependencies. Works on macOS / Linux / Windows WSL2.** The router is stable for day-to-day Claude Code use; the v1.0 wrap-up is in [`docs/retrospectives/v1.0.md`](./docs/retrospectives/v1.0.md).
|
|
186
206
|
|
|
187
207
|
What CodeRouter can do for you today:
|
|
188
208
|
|
|
@@ -196,7 +216,7 @@ What CodeRouter can do for you today:
|
|
|
196
216
|
|
|
197
217
|
**Want the per-release detail?** Every v0.x and v1.0-A/B/C slice — what shipped, how many tests it added, why it was needed — is in [CHANGELOG.md](./CHANGELOG.md). Design invariants and the forward roadmap live in [plan.md](./plan.md).
|
|
198
218
|
|
|
199
|
-
**Coming next** (see [plan.md §10](./plan.md) for v1.0, §18 for v1.0+): v1.5 ✅
|
|
219
|
+
**Coming next** (see [plan.md §10](./plan.md) for v1.0, §18 for v1.0+): v1.5 ✅ metrics / `/dashboard` / `coderouter stats` TUI / `scripts/demo_traffic.sh`. v1.6 ✅ `auto_router` (task-aware routing) + NVIDIA NIM free tier + troubleshooting doc split + `--env-file` / `doctor --check-env`. v1.7 ✅ PyPI publish (`uvx coderouter-cli`). v1.8 ✅ Use-case-aware 4 profiles (multi/coding/general/reasoning) + Gemma 4 / Qwen3.6 / Z.AI (GLM) registration + `setup.sh` wizard + `coderouter doctor --check-model --apply` (non-destructive YAML write-back) + `claude_code_suitability` startup check + Trusted Publishing automation. Remaining for v1.9+: `coderouter doctor --network` (CI), launcher scripts, opt-in update check.
|
|
200
220
|
|
|
201
221
|
### Use it with Claude Code
|
|
202
222
|
|
|
@@ -370,9 +390,11 @@ The subcommand targets **one** provider per invocation by design: a doctor probe
|
|
|
370
390
|
|
|
371
391
|
Coming next (see [plan.md §10](./plan.md) for v1.0, §18 for v1.0+):
|
|
372
392
|
|
|
373
|
-
- v1.0 — 14-case regression suite, Code Mode (slim Claude Code harness); output cleaning shipped in **v1.0-A** (`output_filters` chain, done)
|
|
374
|
-
- v1.5 — **Metrics dashboard (shipped)** — `MetricsCollector` + `GET /metrics.json` + `GET /metrics` (Prometheus) + `GET /dashboard` (HTML one-pager) + `coderouter stats` curses TUI + `scripts/demo_traffic.sh` traffic generator + `display_timezone` config
|
|
375
|
-
- v1.6 — `
|
|
393
|
+
- v1.0 ✅ — 14-case regression suite, Code Mode (slim Claude Code harness); output cleaning shipped in **v1.0-A** (`output_filters` chain, done)
|
|
394
|
+
- v1.5 ✅ — **Metrics dashboard (shipped)** — `MetricsCollector` + `GET /metrics.json` + `GET /metrics` (Prometheus) + `GET /dashboard` (HTML one-pager) + `coderouter stats` curses TUI + `scripts/demo_traffic.sh` traffic generator + `display_timezone` config
|
|
395
|
+
- v1.6 ✅ — `auto_router` (task-aware routing; `default_profile: auto` dispatches by image attachment / code-fence ratio / else) + NVIDIA NIM free-tier 8-step chain + doc language swap (JA primary) + troubleshooting page split + `--env-file` / `doctor --check-env`
|
|
396
|
+
- v1.7 ✅ — PyPI publish (`uvx coderouter-cli` one-line bootstrap) + Trusted Publishing path (release.yml auto-publish on tag push)
|
|
397
|
+
- v1.8 ✅ — **Use-case-aware 4 profiles + GLM/Gemma 4/Qwen3.6 official tags + apply automation**: `multi` (default) / `coding` / `general` / `reasoning` profiles + `append_system_prompt` per profile to nudge non-Claude models toward Claude-style replies + `mode_aliases` (default/fast/vision/think/cheap), Ollama-official `gemma4:e4b/26b/31b` and `qwen3.6:27b/35b` promoted to active stanzas, Z.AI provided as OpenAI-compat with two base URLs (Coding Plan / General API), `coderouter doctor --check-model --apply` writes YAML patches non-destructively (`ruamel.yaml` round-trip preserves comments + key order; idempotent), `setup.sh` onboarding wizard, `claude_code_suitability` startup check (Llama-3.3-70B in `claude-code-*` profiles emits a structured WARN). Remaining for v1.9+: `coderouter doctor --network` (CI-friendly), launcher scripts (`.command` / `.sh` / `.bat`), opt-in startup update check
|
|
376
398
|
|
|
377
399
|
## Choosing `kind: openai_compat` vs `kind: anthropic`
|
|
378
400
|
|