Skip to content

Commit 8767e1d

Browse files
committed
仕様を作成
1 parent e260b21 commit 8767e1d

1 file changed

Lines changed: 305 additions & 0 deletions

File tree

Lines changed: 305 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,305 @@
1+
# Text Assets Integration Plan - CommandForgeEditor & mooreseditor
2+
3+
## 概要
4+
mooreseditorで管理するテキストアセット(テキストID、テキスト内容、ボイスID)をCommandForgeEditorで利用できるようにする連携機能の実装計画。
5+
6+
## 実装目標
7+
- mooreseditorでテキストアセットを一元管理
8+
- CommandForgeEditorでテキストIDを選択してメッセージ表示
9+
- ファイルベースの自動同期機能
10+
- 開発効率を向上させるプレビュー機能
11+
12+
## アーキテクチャ
13+
14+
### システム構成図
15+
```
16+
mooreseditor(マスターデータ管理)
17+
├── テキストアセット編集UI
18+
├── カテゴリ/タグ管理
19+
└── エクスポート機能
20+
21+
text_assets.json
22+
23+
CommandForgeEditor(読み込み専用)
24+
├── テキストアセット読み込み
25+
├── TextIdSelectorコンポーネント
26+
└── リアルタイムプレビュー
27+
```
28+
29+
### データフロー
30+
1. mooreseditorでテキストアセットを作成・編集
31+
2. text_assets.jsonとしてエクスポート
32+
3. CommandForgeEditorが自動検知して読み込み
33+
4. show_messageコマンドでテキストIDを選択
34+
5. スキットファイルにはテキストIDのみ保存
35+
36+
## データ仕様
37+
38+
### text_assets.json
39+
```json
40+
{
41+
"$version": "1.0.0",
42+
"$schema": "text-assets-schema-v1",
43+
"$exportedAt": "2025-07-04T10:00:00Z",
44+
"$exportedBy": "mooreseditor v0.5.1",
45+
"assets": {
46+
"T_HELLO_001": {
47+
"text": "こんにちは、冒険者よ。",
48+
"voiceId": "voice_001",
49+
"category": "greeting",
50+
"tags": ["npc", "village"],
51+
"description": "村人の挨拶",
52+
"variables": [],
53+
"lastModified": "2025-07-04T09:00:00Z"
54+
},
55+
"T_QUEST_START_001": {
56+
"text": "新しいクエストが始まりました。",
57+
"voiceId": "voice_sys_010",
58+
"category": "system",
59+
"tags": ["quest", "notification"],
60+
"description": "クエスト開始通知",
61+
"variables": [],
62+
"lastModified": "2025-07-04T09:30:00Z"
63+
},
64+
"T_ITEM_GET_001": {
65+
"text": "{itemName}を{count}個手に入れた!",
66+
"voiceId": "voice_sys_021",
67+
"category": "system",
68+
"tags": ["item", "notification"],
69+
"description": "アイテム取得メッセージ",
70+
"variables": ["itemName", "count"],
71+
"lastModified": "2025-07-04T09:45:00Z"
72+
}
73+
}
74+
}
75+
```
76+
77+
### スキットファイルの変更
78+
```json
79+
// Before
80+
{
81+
"id": "cmd_1",
82+
"command": "show_message",
83+
"properties": {
84+
"text": "こんにちは、冒険者よ。"
85+
}
86+
}
87+
88+
// After
89+
{
90+
"id": "cmd_1",
91+
"command": "show_message",
92+
"properties": {
93+
"textId": "T_HELLO_001",
94+
"variables": {}
95+
}
96+
}
97+
```
98+
99+
## 実装タスク
100+
101+
### Phase 1: 基本機能(MVP)
102+
103+
#### 1-1. CommandForgeEditor - データ読み込み機能
104+
- [ ] text_assets.jsonの型定義作成
105+
- [ ] ファイル読み込み機能の実装
106+
- [ ] Zustandストアへのテキストアセット状態追加
107+
- [ ] エラーハンドリング(ファイル不在、形式エラー)
108+
109+
#### 1-2. CommandForgeEditor - UI実装
110+
- [ ] TextIdSelectorコンポーネントの作成
111+
- [ ] ドロップダウンUI
112+
- [ ] 検索機能
113+
- [ ] プレビュー表示
114+
- [ ] commands.yamlの修正(show_messageコマンド)
115+
- [ ] CommandEditorコンポーネントの拡張
116+
117+
#### 1-3. mooreseditor - エクスポート機能
118+
- [ ] テキストアセット管理画面の設計
119+
- [ ] エクスポート機能の実装
120+
- [ ] ファイル保存ダイアログ
121+
- [ ] バージョン情報の付与
122+
123+
### Phase 2: 自動同期機能
124+
125+
#### 2-1. ファイル監視システム
126+
- [ ] Tauri file watcherプラグインの導入
127+
- [ ] ファイル変更検知の実装
128+
- [ ] 自動リロード機能
129+
- [ ] 変更通知UI
130+
131+
#### 2-2. 検証機能
132+
- [ ] 存在しないテキストIDの検出
133+
- [ ] 検証エラーの表示
134+
- [ ] フォールバック処理
135+
136+
### Phase 3: 高度な機能
137+
138+
#### 3-1. 変数システム
139+
- [ ] 変数定義のサポート
140+
- [ ] 変数入力UI
141+
- [ ] プレビューでの変数展開
142+
143+
#### 3-2. カテゴリ/タグ機能
144+
- [ ] フィルタリングUI
145+
- [ ] カテゴリ別表示
146+
- [ ] タグ検索
147+
148+
#### 3-3. パフォーマンス最適化
149+
- [ ] 大量データ対応(仮想スクロール)
150+
- [ ] キャッシュ機構
151+
- [ ] インクリメンタル検索
152+
153+
### Phase 4: 開発体験向上
154+
155+
#### 4-1. 開発ツール
156+
- [ ] マイグレーションツール(既存テキストからの変換)
157+
- [ ] 一括置換機能
158+
- [ ] 使用状況分析
159+
160+
#### 4-2. ドキュメント
161+
- [ ] ユーザーガイド作成
162+
- [ ] API仕様書
163+
- [ ] トラブルシューティングガイド
164+
165+
## 技術的実装詳細
166+
167+
### CommandForgeEditor側の実装
168+
169+
#### 1. 型定義(types/textAssets.ts)
170+
```typescript
171+
export interface TextAsset {
172+
text: string;
173+
voiceId: string;
174+
category: string;
175+
tags: string[];
176+
description: string;
177+
variables: string[];
178+
lastModified: string;
179+
}
180+
181+
export interface TextAssetsFile {
182+
$version: string;
183+
$schema: string;
184+
$exportedAt: string;
185+
$exportedBy: string;
186+
assets: Record<string, TextAsset>;
187+
}
188+
```
189+
190+
#### 2. ストア拡張(store/skitStore.ts)
191+
```typescript
192+
interface SkitStore {
193+
// 新規追加
194+
textAssets: Record<string, TextAsset> | null;
195+
textAssetsLoadError: string | null;
196+
textAssetsVersion: string | null;
197+
198+
// 新規アクション
199+
loadTextAssets: () => Promise<void>;
200+
reloadTextAssets: () => Promise<void>;
201+
getTextAsset: (id: string) => TextAsset | undefined;
202+
}
203+
```
204+
205+
#### 3. TextIdSelectorコンポーネント
206+
```typescript
207+
interface TextIdSelectorProps {
208+
value: string;
209+
onChange: (value: string) => void;
210+
variables?: Record<string, string>;
211+
onVariablesChange?: (variables: Record<string, string>) => void;
212+
}
213+
```
214+
215+
### mooreseditor側の実装
216+
217+
#### 1. テキストアセット管理スキーマ
218+
```yaml
219+
# schema/textAssets.yml
220+
type: object
221+
properties:
222+
id:
223+
type: string
224+
pattern: "^T_[A-Z0-9_]+$"
225+
description: "テキストID(T_で始まる大文字英数字)"
226+
text:
227+
type: string
228+
description: "表示テキスト"
229+
voiceId:
230+
type: string
231+
description: "ボイスファイルID"
232+
category:
233+
type: string
234+
enum: ["greeting", "system", "dialogue", "narration", "ui"]
235+
tags:
236+
type: array
237+
items:
238+
type: string
239+
description:
240+
type: string
241+
variables:
242+
type: array
243+
items:
244+
type: string
245+
```
246+
247+
## リスク管理
248+
249+
### 技術的リスク
250+
1. **大量データでのパフォーマンス低下**
251+
- 対策: 遅延読み込み、仮想化、インデックス作成
252+
253+
2. **ファイル同期の競合**
254+
- 対策: ファイルロック、トランザクション処理
255+
256+
3. **後方互換性の破壊**
257+
- 対策: セマンティックバージョニング、マイグレーションツール
258+
259+
### 運用リスク
260+
1. **両アプリ間の依存関係**
261+
- 対策: 明確なインターフェース定義、疎結合設計
262+
263+
2. **開発フローの複雑化**
264+
- 対策: 自動化ツール、明確なドキュメント
265+
266+
## スケジュール目安
267+
268+
- Phase 1: 2週間(基本機能の実装)
269+
- Phase 2: 1週間(自動同期機能)
270+
- Phase 3: 2週間(高度な機能)
271+
- Phase 4: 1週間(開発体験向上)
272+
273+
合計: 約6週間
274+
275+
## 成功指標
276+
277+
1. **機能面**
278+
- テキストアセットの作成から使用までの一連の流れが動作
279+
- 1000件以上のテキストアセットでも快適に動作
280+
- ファイル変更の自動検知と反映
281+
282+
2. **開発効率**
283+
- テキスト変更にかかる時間を50%削減
284+
- テキストの重複を排除
285+
- ローカライズ対応の準備完了
286+
287+
3. **品質**
288+
- テキストIDの参照エラーゼロ
289+
- 自動テストカバレッジ80%以上
290+
- ユーザードキュメント完備
291+
292+
## 次のステップ
293+
294+
1. この実装計画のレビューと承認
295+
2. Phase 1の詳細設計
296+
3. プロトタイプ実装
297+
4. ユーザーフィードバックの収集
298+
5. 本実装の開始
299+
300+
## 参考資料
301+
302+
- [Tauri File System API](https://tauri.app/v1/api/js/fs/)
303+
- [Tauri File Watcher Plugin](https://github.com/tauri-apps/plugins-workspace/tree/v1/plugins/fs-watch)
304+
- [JSON Schema Specification](https://json-schema.org/)
305+
- [Semantic Versioning](https://semver.org/)

0 commit comments

Comments
 (0)