Skip to content

Commit 3401a19

Browse files
web-flowclaude
andcommitted
refactor: version SSoT化 + パス設定ドキュメント簡潔化
- version.py: plugin.jsonから動的にバージョンを読み込むように変更 - check_version.py: 不要になったため削除 - CONTRIBUTING.md: SSoTセクションをplugin.json中心に更新 - GUIDE.md: パス設定セクションをシンプルな表形式に簡潔化 🤖 Generated with [Claude Code](https://claude.ai/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 71913ec commit 3401a19

5 files changed

Lines changed: 73 additions & 271 deletions

File tree

EpisodicRAG/CONTRIBUTING.md

Lines changed: 30 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -375,24 +375,43 @@ git status
375375

376376
#### バージョンのSSoT
377377

378-
バージョン情報は `scripts/domain/version.py``__version__` が唯一の真実です。
379-
380-
```python
381-
# scripts/domain/version.py
382-
__version__ = "3.0.0" # ← ここを更新
378+
バージョン情報は `.claude-plugin/plugin.json``version` フィールドが唯一の真実(SSoT)です。
379+
380+
```json
381+
// .claude-plugin/plugin.json
382+
{
383+
"name": "EpisodicRAG-Plugin",
384+
"version": "3.0.0", // ← ここがSSoT(唯一の更新場所)
385+
...
386+
}
383387
```
384388

385389
| ファイル | フィールド | 備考 |
386390
|---------|-----------|------|
387-
| `scripts/domain/version.py` | `__version__` | SSoT(ここを更新) |
388-
| `.claude-plugin/plugin.json` | `version` | 手動同期 |
389-
| `pyproject.toml` | `version` | 手動同期 |
391+
| `.claude-plugin/plugin.json` | `version` | **SSoT**(ここを更新) |
392+
| `scripts/domain/version.py` | `__version__` | plugin.json から動的読み込み(自動) |
393+
| `CHANGELOG.md` | `## [x.x.x]` | 変更履歴として手動更新 |
394+
395+
**動的読み込みの仕組み**:
396+
397+
`scripts/domain/version.py``plugin.json` からバージョンを動的に読み込みます:
398+
399+
```python
400+
from domain import __version__
401+
print(__version__) # plugin.json の version が表示される
402+
```
403+
404+
### リリース手順
390405

391-
**pre-commitによる自動チェック**: コミット時に `check_version.py` が自動実行され、3箇所のバージョンが一致しているか検証されます。不一致がある場合はコミットがブロックされます。
406+
バージョン更新時は以下の**2ファイルのみ**更新:
407+
408+
1. `.claude-plugin/plugin.json` - `version` フィールドを更新(SSoT)
409+
2. `CHANGELOG.md` - 新しいセクション `## [x.x.x] - YYYY-MM-DD` を追加
392410

393411
```bash
394-
# 手動でチェック
395-
python scripts/check_version.py
412+
# 動作確認
413+
cd scripts
414+
python -c "from domain import __version__; print(__version__)"
396415
```
397416

398417
### ドキュメントヘッダーのバージョン

EpisodicRAG/docs/user/GUIDE.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,17 @@ flowchart TD
185185

186186
> 📖 完全な設定仕様は [API_REFERENCE.md](../dev/API_REFERENCE.md) を参照
187187
188+
### パス設定について
189+
190+
データの保存場所は `base_dir` で指定します:
191+
192+
| 設定 | データの保存先 | 用途 |
193+
|------|--------------|------|
194+
| `"base_dir": "."` | プラグイン内 `data/` | デフォルト |
195+
| `"base_dir": "C:/GoogleDrive/..."` | 指定した場所の `data/` | クラウド同期 |
196+
197+
現在の設定確認: `@digest-config`
198+
188199
---
189200

190201
## 5. 困ったときは

EpisodicRAG/scripts/check_version.py

Lines changed: 0 additions & 85 deletions
This file was deleted.

EpisodicRAG/scripts/domain/version.py

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,40 @@
33
EpisodicRAG バージョン定義
44
=========================
55
6-
プロジェクト全体で使用するバージョン定数のSingle Source of Truth。
6+
plugin.json からバージョンを動的に読み込む(SSoT)
7+
8+
SSoT (Single Source of Truth):
9+
バージョンは `.claude-plugin/plugin.json` の `version` フィールドが唯一の定義場所。
10+
このモジュールはそこから動的に読み込み、後方互換性のため `__version__` として公開。
711
"""
812

9-
# プラグインバージョン (plugin.json と同期)
10-
__version__ = "3.0.0"
13+
import json
14+
from pathlib import Path
15+
16+
17+
def _load_version_from_plugin_json() -> str:
18+
"""
19+
plugin.json からバージョンを読み込む
20+
21+
Returns:
22+
str: バージョン文字列(例: "3.0.0")
23+
plugin.json が見つからない場合は "0.0.0"
24+
"""
25+
# version.py → domain/ → scripts/ → EpisodicRAG/ → .claude-plugin/
26+
plugin_json = Path(__file__).parent.parent.parent / ".claude-plugin" / "plugin.json"
27+
28+
if not plugin_json.exists():
29+
return "0.0.0" # フォールバック
30+
31+
try:
32+
data = json.loads(plugin_json.read_text(encoding="utf-8"))
33+
return data.get("version", "0.0.0")
34+
except (json.JSONDecodeError, OSError):
35+
return "0.0.0"
36+
37+
38+
# プラグインバージョン(plugin.json から動的読み込み - SSoT)
39+
__version__ = _load_version_from_plugin_json()
1140

1241
# データフォーマットバージョン (GrandDigest, ShadowGrandDigest, RegularDigest用)
1342
# プラグインバージョンとは独立して管理

EpisodicRAG/scripts/test/interfaces_tests/test_check_version.py

Lines changed: 0 additions & 172 deletions
This file was deleted.

0 commit comments

Comments
 (0)