next2d-development-mcp 0.0.1

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.
Files changed (145) hide show
  1. package/README.md +344 -0
  2. package/dist/index.d.ts +3 -0
  3. package/dist/index.d.ts.map +1 -0
  4. package/dist/index.js +16 -0
  5. package/dist/index.js.map +1 -0
  6. package/dist/prompts/index.d.ts +3 -0
  7. package/dist/prompts/index.d.ts.map +1 -0
  8. package/dist/prompts/index.js +211 -0
  9. package/dist/prompts/index.js.map +1 -0
  10. package/dist/prompts/prompts.test.d.ts +2 -0
  11. package/dist/prompts/prompts.test.d.ts.map +1 -0
  12. package/dist/prompts/prompts.test.js +23 -0
  13. package/dist/prompts/prompts.test.js.map +1 -0
  14. package/dist/references/develop-specs.md +1576 -0
  15. package/dist/references/framework-specs.md +1687 -0
  16. package/dist/references/player-specs.md +3292 -0
  17. package/dist/resources/index.d.ts +3 -0
  18. package/dist/resources/index.d.ts.map +1 -0
  19. package/dist/resources/index.js +185 -0
  20. package/dist/resources/index.js.map +1 -0
  21. package/dist/resources/resources.test.d.ts +2 -0
  22. package/dist/resources/resources.test.d.ts.map +1 -0
  23. package/dist/resources/resources.test.js +32 -0
  24. package/dist/resources/resources.test.js.map +1 -0
  25. package/dist/templates/animation.d.ts +6 -0
  26. package/dist/templates/animation.d.ts.map +1 -0
  27. package/dist/templates/animation.js +65 -0
  28. package/dist/templates/animation.js.map +1 -0
  29. package/dist/templates/animation.test.d.ts +2 -0
  30. package/dist/templates/animation.test.d.ts.map +1 -0
  31. package/dist/templates/animation.test.js +30 -0
  32. package/dist/templates/animation.test.js.map +1 -0
  33. package/dist/templates/domainService.d.ts +9 -0
  34. package/dist/templates/domainService.d.ts.map +1 -0
  35. package/dist/templates/domainService.js +56 -0
  36. package/dist/templates/domainService.js.map +1 -0
  37. package/dist/templates/domainService.test.d.ts +2 -0
  38. package/dist/templates/domainService.test.d.ts.map +1 -0
  39. package/dist/templates/domainService.test.js +33 -0
  40. package/dist/templates/domainService.test.js.map +1 -0
  41. package/dist/templates/interfaceFile.d.ts +5 -0
  42. package/dist/templates/interfaceFile.d.ts.map +1 -0
  43. package/dist/templates/interfaceFile.js +16 -0
  44. package/dist/templates/interfaceFile.js.map +1 -0
  45. package/dist/templates/interfaceFile.test.d.ts +2 -0
  46. package/dist/templates/interfaceFile.test.d.ts.map +1 -0
  47. package/dist/templates/interfaceFile.test.js +30 -0
  48. package/dist/templates/interfaceFile.test.js.map +1 -0
  49. package/dist/templates/loading.d.ts +5 -0
  50. package/dist/templates/loading.d.ts.map +1 -0
  51. package/dist/templates/loading.js +62 -0
  52. package/dist/templates/loading.js.map +1 -0
  53. package/dist/templates/loading.test.d.ts +2 -0
  54. package/dist/templates/loading.test.d.ts.map +1 -0
  55. package/dist/templates/loading.test.js +31 -0
  56. package/dist/templates/loading.test.js.map +1 -0
  57. package/dist/templates/repository.d.ts +2 -0
  58. package/dist/templates/repository.d.ts.map +1 -0
  59. package/dist/templates/repository.js +42 -0
  60. package/dist/templates/repository.js.map +1 -0
  61. package/dist/templates/repository.test.d.ts +2 -0
  62. package/dist/templates/repository.test.d.ts.map +1 -0
  63. package/dist/templates/repository.test.js +44 -0
  64. package/dist/templates/repository.test.js.map +1 -0
  65. package/dist/templates/uiComponent.d.ts +4 -0
  66. package/dist/templates/uiComponent.d.ts.map +1 -0
  67. package/dist/templates/uiComponent.js +108 -0
  68. package/dist/templates/uiComponent.js.map +1 -0
  69. package/dist/templates/uiComponent.test.d.ts +2 -0
  70. package/dist/templates/uiComponent.test.d.ts.map +1 -0
  71. package/dist/templates/uiComponent.test.js +76 -0
  72. package/dist/templates/uiComponent.test.js.map +1 -0
  73. package/dist/templates/usecase.d.ts +2 -0
  74. package/dist/templates/usecase.d.ts.map +1 -0
  75. package/dist/templates/usecase.js +31 -0
  76. package/dist/templates/usecase.js.map +1 -0
  77. package/dist/templates/usecase.test.d.ts +2 -0
  78. package/dist/templates/usecase.test.d.ts.map +1 -0
  79. package/dist/templates/usecase.test.js +23 -0
  80. package/dist/templates/usecase.test.js.map +1 -0
  81. package/dist/templates/view.d.ts +3 -0
  82. package/dist/templates/view.d.ts.map +1 -0
  83. package/dist/templates/view.js +112 -0
  84. package/dist/templates/view.js.map +1 -0
  85. package/dist/templates/view.test.d.ts +2 -0
  86. package/dist/templates/view.test.d.ts.map +1 -0
  87. package/dist/templates/view.test.js +71 -0
  88. package/dist/templates/view.test.js.map +1 -0
  89. package/dist/tools/addRoute.d.ts +3 -0
  90. package/dist/tools/addRoute.d.ts.map +1 -0
  91. package/dist/tools/addRoute.js +101 -0
  92. package/dist/tools/addRoute.js.map +1 -0
  93. package/dist/tools/createAnimation.d.ts +3 -0
  94. package/dist/tools/createAnimation.d.ts.map +1 -0
  95. package/dist/tools/createAnimation.js +53 -0
  96. package/dist/tools/createAnimation.js.map +1 -0
  97. package/dist/tools/createDomainService.d.ts +3 -0
  98. package/dist/tools/createDomainService.d.ts.map +1 -0
  99. package/dist/tools/createDomainService.js +82 -0
  100. package/dist/tools/createDomainService.js.map +1 -0
  101. package/dist/tools/createInterface.d.ts +3 -0
  102. package/dist/tools/createInterface.d.ts.map +1 -0
  103. package/dist/tools/createInterface.js +59 -0
  104. package/dist/tools/createInterface.js.map +1 -0
  105. package/dist/tools/createLoading.d.ts +3 -0
  106. package/dist/tools/createLoading.d.ts.map +1 -0
  107. package/dist/tools/createLoading.js +52 -0
  108. package/dist/tools/createLoading.js.map +1 -0
  109. package/dist/tools/createRepository.d.ts +3 -0
  110. package/dist/tools/createRepository.d.ts.map +1 -0
  111. package/dist/tools/createRepository.js +55 -0
  112. package/dist/tools/createRepository.js.map +1 -0
  113. package/dist/tools/createUiComponent.d.ts +3 -0
  114. package/dist/tools/createUiComponent.d.ts.map +1 -0
  115. package/dist/tools/createUiComponent.js +80 -0
  116. package/dist/tools/createUiComponent.js.map +1 -0
  117. package/dist/tools/createUseCase.d.ts +3 -0
  118. package/dist/tools/createUseCase.d.ts.map +1 -0
  119. package/dist/tools/createUseCase.js +52 -0
  120. package/dist/tools/createUseCase.js.map +1 -0
  121. package/dist/tools/createView.d.ts +3 -0
  122. package/dist/tools/createView.d.ts.map +1 -0
  123. package/dist/tools/createView.js +59 -0
  124. package/dist/tools/createView.js.map +1 -0
  125. package/dist/tools/index.d.ts +5 -0
  126. package/dist/tools/index.d.ts.map +1 -0
  127. package/dist/tools/index.js +25 -0
  128. package/dist/tools/index.js.map +1 -0
  129. package/dist/tools/tools.test.d.ts +2 -0
  130. package/dist/tools/tools.test.d.ts.map +1 -0
  131. package/dist/tools/tools.test.js +58 -0
  132. package/dist/tools/tools.test.js.map +1 -0
  133. package/dist/tools/validateArchitecture.d.ts +3 -0
  134. package/dist/tools/validateArchitecture.d.ts.map +1 -0
  135. package/dist/tools/validateArchitecture.js +134 -0
  136. package/dist/tools/validateArchitecture.js.map +1 -0
  137. package/dist/utils.d.ts +10 -0
  138. package/dist/utils.d.ts.map +1 -0
  139. package/dist/utils.js +18 -0
  140. package/dist/utils.js.map +1 -0
  141. package/dist/utils.test.d.ts +2 -0
  142. package/dist/utils.test.d.ts.map +1 -0
  143. package/dist/utils.test.js +34 -0
  144. package/dist/utils.test.js.map +1 -0
  145. package/package.json +48 -0
package/README.md ADDED
@@ -0,0 +1,344 @@
1
+ # next2d-development-mcp
2
+
3
+ <div align="center">
4
+ <img src="https://next2d.app/assets/img/logo.svg" width="180" alt="Next2D">
5
+ </div>
6
+
7
+ [Next2D](https://next2d.app) アプリケーション開発を支援する **MCP (Model Context Protocol) サーバー**です。
8
+ [framework-typescript-template](https://github.com/Next2D/framework-typescript-template) を使った **MVVM + Clean Architecture + Atomic Design** パターンに従ったコード生成、アーキテクチャ検証、API リファレンスを提供します。
9
+
10
+ An **MCP (Model Context Protocol) server** for [Next2D](https://next2d.app) application development.
11
+ Provides code generation, architecture validation, and API reference following **MVVM + Clean Architecture + Atomic Design** patterns used with the [framework-typescript-template](https://github.com/Next2D/framework-typescript-template).
12
+
13
+ ---
14
+
15
+ ## 目次 / Table of Contents
16
+
17
+ - [概要 / Overview](#概要--overview)
18
+ - [必要な環境 / Requirements](#必要な環境--requirements)
19
+ - [AI エージェントへの追加方法 / AI Agent Setup](#ai-エージェントへの追加方法--ai-agent-setup)
20
+ - [Tools / ツール](#tools--ツール)
21
+ - [Resources / リソース](#resources--リソース)
22
+ - [Prompts / プロンプト](#prompts--プロンプト)
23
+ - [サポートするアーキテクチャ / Supported Architecture](#サポートするアーキテクチャ--supported-architecture)
24
+ - [License](#license)
25
+
26
+ ---
27
+
28
+ ## 概要 / Overview
29
+
30
+ Next2D は **WebGL/WebGPU** ベースの 2D レンダリングエンジン ([Player](https://github.com/Next2D/player)) と MVVM フレームワーク ([Framework](https://github.com/Next2D/framework)) で構成される、マルチプラットフォーム対応の開発環境です。
31
+
32
+ Next2D is a multi-platform development environment consisting of a **WebGL/WebGPU** based 2D rendering engine ([Player](https://github.com/Next2D/player)) and an MVVM framework ([Framework](https://github.com/Next2D/framework)).
33
+
34
+ この MCP サーバーは以下の機能を AI エージェントに提供します:
35
+
36
+ This MCP server provides the following capabilities to AI agents:
37
+
38
+ | 機能 / Feature | 説明 / Description |
39
+ |---|---|
40
+ | **コード生成** | View/ViewModel, UseCase, Repository, UI コンポーネント, Interface のスキャフォールディング |
41
+ | **ルーティング設定** | routing.json へのルートエントリ生成 |
42
+ | **アーキテクチャ検証** | プロジェクト構造の Clean Architecture 準拠チェック |
43
+ | **API リファレンス** | Player API, Framework 仕様, 開発テンプレート仕様の提供 |
44
+ | **開発ガイド** | 画面追加手順, コーディング規約, デバッグガイドの提供 |
45
+
46
+ ### 対応プラットフォーム / Supported Platforms
47
+
48
+ Web / Steam (Windows・macOS・Linux) / iOS / Android
49
+
50
+ ---
51
+
52
+ ## 必要な環境 / Requirements
53
+
54
+ | ツール / Tool | バージョン / Version |
55
+ |---|---|
56
+ | Node.js | 22.x 以上 / 22.x or higher |
57
+ | npm | 10.x 以上 / 10.x or higher |
58
+
59
+ ---
60
+
61
+ ## AI エージェントへの追加方法 / AI Agent Setup
62
+
63
+ ### GitHub Copilot (VS Code / VS Code Insiders)
64
+
65
+ プロジェクトルートに `.vscode/mcp.json` を作成します。
66
+ Create `.vscode/mcp.json` at the project root:
67
+
68
+ ```json
69
+ {
70
+ "servers": {
71
+ "next2d": {
72
+ "command": "npx",
73
+ "args": ["next2d-development-mcp"]
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ VS Code の設定 (`settings.json`) で MCP を有効化:
80
+ Enable MCP in VS Code settings (`settings.json`):
81
+
82
+ ```json
83
+ {
84
+ "github.copilot.chat.mcp.enabled": true
85
+ }
86
+ ```
87
+
88
+ > 💡 Copilot Chat で `@mcp` を入力すると、利用可能なツールが表示されます。
89
+ > 💡 Type `@mcp` in Copilot Chat to see available tools.
90
+
91
+ ### Claude Desktop
92
+
93
+ 設定ファイルを編集します。
94
+ Edit the configuration file:
95
+
96
+ - **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
97
+ - **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
98
+
99
+ ```json
100
+ {
101
+ "mcpServers": {
102
+ "next2d": {
103
+ "command": "npx",
104
+ "args": ["next2d-development-mcp"]
105
+ }
106
+ }
107
+ }
108
+ ```
109
+
110
+ > 💡 設定後、Claude Desktop を再起動してください。
111
+ > 💡 Restart Claude Desktop after updating the configuration.
112
+
113
+ ### Claude Code (CLI)
114
+
115
+ プロジェクトルートに `.mcp.json` を作成します。
116
+ Create `.mcp.json` at the project root:
117
+
118
+ ```json
119
+ {
120
+ "mcpServers": {
121
+ "next2d": {
122
+ "command": "npx",
123
+ "args": ["next2d-development-mcp"]
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ または、CLI で直接追加:
130
+ Or add directly via CLI:
131
+
132
+ ```bash
133
+ claude mcp add next2d -- npx next2d-development-mcp
134
+ ```
135
+
136
+ ### OpenAI Codex (ChatGPT CLI)
137
+
138
+ プロジェクトルートに `.codex/mcp.json` を作成します。
139
+ Create `.codex/mcp.json` at the project root:
140
+
141
+ ```json
142
+ {
143
+ "mcpServers": {
144
+ "next2d": {
145
+ "command": "npx",
146
+ "args": ["next2d-development-mcp"]
147
+ }
148
+ }
149
+ }
150
+ ```
151
+
152
+ ### Gemini CLI
153
+
154
+ プロジェクトルートに `.gemini/settings.json` を作成します。
155
+ Create `.gemini/settings.json` at the project root:
156
+
157
+ ```json
158
+ {
159
+ "mcpServers": {
160
+ "next2d": {
161
+ "command": "npx",
162
+ "args": ["next2d-development-mcp"]
163
+ }
164
+ }
165
+ }
166
+ ```
167
+
168
+ ### Cline (VS Code Extension)
169
+
170
+ Cline の設定画面から MCP サーバーを追加します。
171
+ Add the MCP server from Cline settings:
172
+
173
+ 1. VS Code で Cline 拡張のサイドバーを開く / Open the Cline extension sidebar in VS Code
174
+ 2. **MCP Servers** セクションを開く / Open the **MCP Servers** section
175
+ 3. **Edit MCP Settings** をクリック / Click **Edit MCP Settings**
176
+ 4. 以下を追加 / Add the following:
177
+
178
+ ```json
179
+ {
180
+ "mcpServers": {
181
+ "next2d": {
182
+ "command": "npx",
183
+ "args": ["next2d-development-mcp"]
184
+ }
185
+ }
186
+ }
187
+ ```
188
+
189
+ ### Cursor
190
+
191
+ Cursor の設定ファイルに追加します。
192
+ Add to Cursor settings:
193
+
194
+ - **プロジェクト単位 / Per-project**: `.cursor/mcp.json`
195
+ - **グローバル / Global**: `~/.cursor/mcp.json`
196
+
197
+ ```json
198
+ {
199
+ "mcpServers": {
200
+ "next2d": {
201
+ "command": "npx",
202
+ "args": ["next2d-development-mcp"]
203
+ }
204
+ }
205
+ }
206
+ ```
207
+
208
+ ### Windsurf
209
+
210
+ Windsurf の MCP 設定ファイルに追加します。
211
+ Add to Windsurf MCP configuration:
212
+
213
+ `~/.codeium/windsurf/mcp_config.json`:
214
+
215
+ ```json
216
+ {
217
+ "mcpServers": {
218
+ "next2d": {
219
+ "command": "npx",
220
+ "args": ["next2d-development-mcp"]
221
+ }
222
+ }
223
+ }
224
+ ```
225
+
226
+ ### その他の MCP 対応クライアント / Other MCP-compatible Clients
227
+
228
+ MCP は **stdio** トランスポートの標準プロトコルです。MCP 対応の任意のクライアントで以下のコマンドを設定すれば利用可能です:
229
+
230
+ MCP uses the standard **stdio** transport protocol. Configure the following command in any MCP-compatible client:
231
+
232
+ ```
233
+ command: npx
234
+ args: next2d-development-mcp
235
+ ```
236
+
237
+ ---
238
+
239
+ ## Tools / ツール
240
+
241
+ | Tool | Description |
242
+ |---|---|
243
+ | `create_view` | View/ViewModel ペアを生成 (MVVM パターン)。`name` にルートパスを指定 (例: `home`, `quest/list`) |
244
+ | `create_usecase` | UseCase クラスを生成 (Application 層)。1 アクション = 1 UseCase、`execute()` がエントリーポイント |
245
+ | `create_repository` | Repository クラスを生成 (Infrastructure 層)。try-catch 必須、config からエンドポイント取得 |
246
+ | `create_ui_component` | Atomic Design UI コンポーネント生成 (`atom` / `molecule` / `organism` / `page` / `content`) |
247
+ | `add_route` | routing.json へのルートエントリ生成。リクエスト設定 (`json` / `content` / `custom` / `cluster`) に対応 |
248
+ | `create_interface` | TypeScript インターフェースファイル生成 (`I` プレフィックス規約に準拠) |
249
+ | `validate_architecture` | プロジェクト構造の検証。ディレクトリ構成、設定ファイル、routing.json ↔ View の整合性をチェック |
250
+
251
+ ### ツール使用例 / Tool Usage Example
252
+
253
+ AI エージェントへの指示例:
254
+
255
+ ```
256
+ Next2Dプロジェクトに「quest/list」画面を追加して。
257
+ APIからクエスト一覧を取得して表示するようにして。
258
+ ```
259
+
260
+ エージェントが自動的に `add_route` → `create_view` → `create_usecase` → `create_repository` → `create_interface` → `create_ui_component` を順に実行し、必要なファイルをすべて生成します。
261
+
262
+ ---
263
+
264
+ ## Resources / リソース
265
+
266
+ | Resource | URI | Description |
267
+ |---|---|---|
268
+ | Player API Specs | `next2d://specs/player` | DisplayObject, MovieClip, Sprite, Shape, TextField, Video, Sound, Tween, Events, Filters 等の API リファレンス |
269
+ | Framework Specs | `next2d://specs/framework` | MVVM アーキテクチャ, ルーティング, config 設定, View/ViewModel ライフサイクル, gotoView フロー |
270
+ | Development Specs | `next2d://specs/develop` | プロジェクト構造, CLI コマンド, Interface 定義, Model 層, UI 層 (Atomic Design), View/ViewModel パターン |
271
+ | Architecture Overview | `next2d://architecture` | アーキテクチャ概要, レイヤー構成, 設定ファイル仕様, ライフサイクル, npm コマンド一覧 |
272
+
273
+ ---
274
+
275
+ ## Prompts / プロンプト
276
+
277
+ | Prompt | Parameters | Description |
278
+ |---|---|---|
279
+ | `new-screen` | `screenName`, `hasApi?`, `hasAnimation?` | 新しい画面追加のステップバイステップガイド |
280
+ | `architecture-guide` | — | アーキテクチャルールとコーディング規約のリファレンス |
281
+ | `debug-help` | `issue` | よくある問題のデバッグのヒントとトラブルシューティング |
282
+
283
+ ---
284
+
285
+ ## サポートするアーキテクチャ / Supported Architecture
286
+
287
+ ```
288
+ src/
289
+ ├── config/ # 設定ファイル (stage.json, config.json, routing.json)
290
+ ├── interface/ # インターフェース定義 (I プレフィックス)
291
+ ├── model/
292
+ │ ├── application/ # UseCase (ビジネスロジック)
293
+ │ ├── domain/ # コアビジネスルール
294
+ │ └── infrastructure/ # Repository (データアクセス)
295
+ ├── ui/
296
+ │ ├── component/
297
+ │ │ ├── atom/ # 最小コンポーネント
298
+ │ │ ├── molecule/ # 複合コンポーネント
299
+ │ │ ├── organism/ # 複雑なコンポーネント
300
+ │ │ └── page/ # 画面レイアウト
301
+ │ └── content/ # Animation Tool コンテンツ
302
+ └── view/ # View & ViewModel (MVVM)
303
+ ```
304
+
305
+ ### レイヤー依存関係 / Layer Dependencies
306
+
307
+ ```
308
+ View Layer (view/, ui/)
309
+ └─ depends on ─→ Interface Layer (interface/)
310
+
311
+ Application Layer (model/application/)
312
+ ├─ depends on ─→ Interface Layer
313
+ ├─ depends on ─→ Domain Layer (model/domain/)
314
+ └─ calls ──────→ Infrastructure Layer (model/infrastructure/)
315
+ ```
316
+
317
+ ### View ライフサイクル / View Lifecycle
318
+
319
+ ```
320
+ ViewModel.constructor
321
+ → ViewModel.initialize()
322
+ → View.constructor(vm)
323
+ → View.initialize()
324
+ → View.onEnter()
325
+ → (ユーザー操作 / User interaction)
326
+ → View.onExit()
327
+ ```
328
+
329
+ ---
330
+
331
+ ## 関連リンク / Related Links
332
+
333
+ - [Next2D Player](https://github.com/Next2D/player) — WebGL/WebGPU 2D レンダリングエンジン
334
+ - [Next2D Framework](https://github.com/Next2D/framework) — MVVM フレームワーク
335
+ - [framework-typescript-template](https://github.com/Next2D/framework-typescript-template) — TypeScript テンプレート
336
+ - [Create Next2D App](https://github.com/Next2D/create-next2d-app) — プロジェクト生成ツール
337
+ - [Next2D Animation Tool](https://tool.next2d.app/) — アニメーション作成ツール
338
+ - [MCP Specification](https://modelcontextprotocol.io/) — Model Context Protocol 仕様
339
+
340
+ ---
341
+
342
+ ## License
343
+
344
+ MIT
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
package/dist/index.js ADDED
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
4
+ import { registerTools } from "./tools/index.js";
5
+ import { registerResources } from "./resources/index.js";
6
+ import { registerPrompts } from "./prompts/index.js";
7
+ const server = new McpServer({
8
+ "name": "next2d-development-mcp",
9
+ "version": "0.0.1"
10
+ });
11
+ registerTools(server);
12
+ registerResources(server);
13
+ registerPrompts(server);
14
+ const transport = new StdioServerTransport();
15
+ await server.connect(transport);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IACzB,MAAM,EAAE,wBAAwB;IAChC,SAAS,EAAE,OAAO;CACrB,CAAC,CAAC;AAEH,aAAa,CAAC,MAAM,CAAC,CAAC;AACtB,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAC1B,eAAe,CAAC,MAAM,CAAC,CAAC;AAExB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;AAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
2
+ export declare function registerPrompts(server: McpServer): void;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AAGzE,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CA8KvD"}
@@ -0,0 +1,211 @@
1
+ import { z } from "zod";
2
+ export function registerPrompts(server) {
3
+ server.registerPrompt("new-screen", {
4
+ "description": "Step-by-step guide for adding a new screen to a Next2D project",
5
+ "argsSchema": {
6
+ "screenName": z.string().describe("Screen name (e.g. 'quest/list', 'settings', 'profile')"),
7
+ "hasApi": z.string().optional().describe("Does this screen need API data? (yes/no)"),
8
+ "hasAnimation": z.string().optional().describe("Does this screen use Animation Tool content? (yes/no)")
9
+ }
10
+ }, async ({ screenName, hasApi, hasAnimation }) => {
11
+ const pascal = screenName
12
+ .split(/[\\/]/)
13
+ .map((s) => s.charAt(0).toUpperCase() + s.slice(1))
14
+ .join("");
15
+ // Screen directory is the first segment for slash-separated routes
16
+ const screenDir = screenName.includes("/") ? screenName.split("/")[0].toLowerCase() : screenName.toLowerCase();
17
+ const steps = [
18
+ `# Adding New Screen: ${pascal}`,
19
+ "",
20
+ "## Step 1: Add Route",
21
+ "Add to `src/config/routing.json`:",
22
+ "```json",
23
+ `"${screenName}": {`,
24
+ " \"requests\": ["
25
+ ];
26
+ if (hasAnimation === "yes") {
27
+ steps.push(" {", " \"type\": \"content\",", ` "path": "{{ content.endPoint }}content/${screenName.toLowerCase()}.json",`, ` "name": "${pascal}Content",`, " \"cache\": true", ` }${hasApi === "yes" ? "," : ""}`);
28
+ }
29
+ if (hasApi === "yes") {
30
+ steps.push(" {", " \"type\": \"json\",", ` "path": "{{ api.endPoint }}api/${screenName.toLowerCase()}.json",`, ` "name": "${pascal}Data"`, " }");
31
+ }
32
+ steps.push(" ]", "}", "```", "", "## Step 2: Generate View/ViewModel", "```bash", "npm run generate", "```", "> **Note:** `npm run generate` auto-creates View, ViewModel, Packages.ts registration, and IViewName.ts update.", "> Steps 3-4 below are only needed if creating files manually.", "", "Or manually create:", `- \`src/view/${screenDir}/${pascal}View.ts\``, `- \`src/view/${screenDir}/${pascal}ViewModel.ts\``, "", "## Step 3: Create UI Components", `Create Page component: \`src/ui/component/page/${screenDir}/${pascal}Page.ts\``, "", "## Step 4: Register in Packages.ts", "```typescript", `import { ${pascal}View } from "@/view/${screenDir}/${pascal}View";`, `import { ${pascal}ViewModel } from "@/view/${screenDir}/${pascal}ViewModel";`, "```", "", "## Step 5: Implement ViewModel", "- Add UseCases for business logic", "- Get response data in `initialize()`", "", "## Step 6: Implement View", "- Add Page component in constructor", "- Bind events to ViewModel methods in `initialize()`");
33
+ return {
34
+ "messages": [
35
+ {
36
+ "role": "user",
37
+ "content": {
38
+ "type": "text",
39
+ "text": steps.join("\n")
40
+ }
41
+ }
42
+ ]
43
+ };
44
+ });
45
+ server.registerPrompt("architecture-guide", {
46
+ "description": "Next2D architecture rules and coding conventions reference"
47
+ }, async () => ({
48
+ "messages": [
49
+ {
50
+ "role": "user",
51
+ "content": {
52
+ "type": "text",
53
+ "text": ARCHITECTURE_GUIDE
54
+ }
55
+ }
56
+ ]
57
+ }));
58
+ server.registerPrompt("debug-help", {
59
+ "description": "Common Next2D debugging tips and troubleshooting guide",
60
+ "argsSchema": {
61
+ "issue": z.string().describe("Describe the issue you're experiencing")
62
+ }
63
+ }, async ({ issue }) => ({
64
+ "messages": [
65
+ {
66
+ "role": "user",
67
+ "content": {
68
+ "type": "text",
69
+ "text": [
70
+ "# Next2D Debugging Guide",
71
+ "",
72
+ `## Issue: ${issue}`,
73
+ "",
74
+ "## Common Issues & Solutions",
75
+ "",
76
+ "### View not loading",
77
+ "1. Check routing.json has the route defined",
78
+ "2. Verify View/ViewModel are registered in Packages.ts",
79
+ "3. Check browser console for import errors",
80
+ "4. Verify config.json has correct `defaultTop` setting",
81
+ "",
82
+ "### API data not appearing",
83
+ "1. Check routing.json `requests` configuration",
84
+ "2. Verify `name` matches `app.getResponse().get('name')`",
85
+ "3. Check config.json endpoint for the current environment",
86
+ "4. Look for network errors in browser DevTools",
87
+ "",
88
+ "### Animation content not showing",
89
+ "1. Verify .n2d file exists in file/ directory",
90
+ "2. Check Content class `namespace` matches symbol name",
91
+ "3. Verify routing.json has `type: 'content'` request",
92
+ "4. Check `cache: true` if using shared content via cluster",
93
+ "",
94
+ "### Build errors",
95
+ "1. Run `npm run lint` to check for TypeScript errors",
96
+ "2. Verify all imports use path aliases (@/)",
97
+ "3. Check tsconfig.json paths configuration",
98
+ "4. Ensure all interfaces have `I` prefix",
99
+ "",
100
+ "### Performance issues",
101
+ "1. Use `cache: true` for shared content/data",
102
+ "2. Cluster shared requests with `type: 'cluster'`",
103
+ "3. Minimize DisplayObject tree depth",
104
+ "4. Use Texture Atlas for multiple images",
105
+ "5. Consider reducing fps in stage.json if not needed at 60"
106
+ ].join("\n")
107
+ }
108
+ }
109
+ ]
110
+ }));
111
+ }
112
+ const ARCHITECTURE_GUIDE = `# Next2D Architecture & Coding Conventions
113
+
114
+ ## MVVM + Clean Architecture
115
+
116
+ ### Layer Rules
117
+ 1. **View → ViewModel → UseCase → Repository** (one-directional dependency)
118
+ 2. All cross-layer communication through **interfaces** in src/interface/
119
+ 3. **Domain Layer** has no external API/DB dependencies (Next2D display APIs are allowed)
120
+
121
+ ### File Naming
122
+ - View: \`{PascalCase}View.ts\` in \`src/view/{lowercase}/\`
123
+ - ViewModel: \`{PascalCase}ViewModel.ts\` in same directory as View
124
+ - UseCase: \`{PascalCase}UseCase.ts\` in \`src/model/application/{screen}/usecase/\`
125
+ - Repository: \`{PascalCase}Repository.ts\` in \`src/model/infrastructure/repository/\`
126
+ - Interface: \`I{PascalCase}.ts\` in \`src/interface/\`
127
+ - UI Atom: \`{PascalCase}Atom.ts\` in \`src/ui/component/atom/\`
128
+ - UI Molecule: \`{PascalCase}Molecule.ts\` in \`src/ui/component/molecule/\`
129
+ - UI Organism: \`{PascalCase}Organism.ts\` in \`src/ui/component/organism/\`
130
+ - UI Page: \`{PascalCase}Page.ts\` in \`src/ui/component/page/{screen}/\`
131
+ - Content: \`{PascalCase}Content.ts\` in \`src/ui/content/\`
132
+
133
+ ### TypeScript Rules
134
+ - \`any\` type is **prohibited**
135
+ - Interfaces always use \`I\` prefix
136
+ - Use \`import type\` for type-only imports
137
+ - Config values accessed via \`config\` import, not hardcoded
138
+ - All public methods must have JSDoc comments
139
+
140
+ ### View Rules
141
+ - Extends \`Sprite\` (via framework \`View\` class)
142
+ - **No business logic** - only display structure
143
+ - Constructor receives ViewModel and creates Page component with \`addChild()\`
144
+ - \`initialize()\`: Delegates to Page for UI setup and event binding
145
+ - \`onEnter()\`: Delegates to Page for entry animations
146
+ - \`onExit()\`: Cleanup when view is hidden
147
+
148
+ ### ViewModel Rules
149
+ - Extends framework \`ViewModel\` class
150
+ - Holds UseCase instances as private readonly properties
151
+ - \`initialize()\`: Get data from \`app.getResponse()\`
152
+ - Event handler methods receive typed events
153
+ - Cast event targets to interfaces, not concrete classes
154
+
155
+ ### UseCase Rules
156
+ - One action = one UseCase class
157
+ - Single \`execute()\` method as entry point
158
+ - Parameters use interface types
159
+ - Can call Repository, Domain services, and framework APIs (e.g. \`app.gotoView()\`)
160
+ - Can compose with other UseCases (hold as private readonly properties, call their \`execute()\` methods)
161
+
162
+ ### Repository Rules
163
+ - Static or instance methods for data access
164
+ - **Always** wrap in try-catch
165
+ - Endpoints from config: \`config.api.endPoint\`
166
+ - Return typed data (interface, not \`any\`)
167
+
168
+ ### Atomic Design
169
+ - **Atom**: Smallest reusable unit (button, text, icon)
170
+ - **Molecule**: Combination of atoms
171
+ - **Organism**: Complex section with business logic connections
172
+ - **Page**: Full screen layout, used directly in View
173
+ - **Content**: Animation Tool asset wrapper (extends MovieClipContent)
174
+
175
+ ### Event Handling Pattern
176
+ \`\`\`typescript
177
+ // In Page.initialize(vm):
178
+ // Use arrow function wrapper to preserve ViewModel context
179
+ component.addEventListener(PointerEvent.POINTER_UP, async (): Promise<void> => {
180
+ await vm.onClickSomething();
181
+ });
182
+
183
+ // For drag operations, use POINTER_DOWN:
184
+ content.addEventListener(PointerEvent.POINTER_DOWN, (event: PointerEvent): void => {
185
+ const target = event.currentTarget as unknown as IDraggable;
186
+ vm.onStartDrag(target);
187
+ });
188
+ \`\`\`
189
+
190
+ ### Button Double-Press Prevention
191
+ \`\`\`typescript
192
+ // ButtonAtom provides disable()/enable() for mouseEnabled/mouseChildren control
193
+
194
+ // In Page.initialize(vm):
195
+ button.addEventListener(PointerEvent.POINTER_UP, async (): Promise<void> => {
196
+ button.disable(); // Immediately disable to prevent double-press
197
+ await vm.onClickButton();
198
+ button.enable(); // Re-enable after processing (skip if navigating away)
199
+ });
200
+
201
+ // In ViewModel (for async operations):
202
+ async onClickButton (): Promise<void> {
203
+ try {
204
+ await this.fetchDataUseCase.execute();
205
+ } catch (error) {
206
+ console.error(error);
207
+ }
208
+ }
209
+ \`\`\`
210
+ `;
211
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/prompts/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,UAAU,eAAe,CAAC,MAAiB;IAC7C,MAAM,CAAC,cAAc,CACjB,YAAY,EACZ;QACI,aAAa,EAAE,gEAAgE;QAC/E,YAAY,EAAE;YACV,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;YAC3F,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;YACpF,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;SAC1G;KACJ,EACD,KAAK,EAAE,EAAE,UAAU,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE;QAC3C,MAAM,MAAM,GAAG,UAAU;aACpB,KAAK,CAAC,OAAO,CAAC;aACd,GAAG,CAAC,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;aAC1D,IAAI,CAAC,EAAE,CAAC,CAAC;QAEd,mEAAmE;QACnE,MAAM,SAAS,GAAG,UAAU,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,WAAW,EAAE,CAAC;QAE/G,MAAM,KAAK,GAAa;YACpB,wBAAwB,MAAM,EAAE;YAChC,EAAE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xB,8CAA8C;wBAC9C,mDAAmD;wBACnD,sCAAsC;wBACtC,0CAA0C;wBAC1C,4DAA4D;qBAC/D,CAAC,IAAI,CAAC,IAAI,CAAC;iBACf;aACJ;SACJ;KACJ,CAAC,CACL,CAAC;AACN,CAAC;AAED,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkG1B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=prompts.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.test.d.ts","sourceRoot":"","sources":["../../src/prompts/prompts.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import { describe, it, expect, vi, beforeEach } from "vitest";
2
+ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
3
+ import { registerPrompts } from "./index.js";
4
+ describe("Prompt registration", () => {
5
+ let server;
6
+ beforeEach(() => {
7
+ server = new McpServer({ name: "test", version: "0.0.1" });
8
+ });
9
+ it("registers 3 prompts without error", () => {
10
+ const spy = vi.spyOn(server, "registerPrompt");
11
+ registerPrompts(server);
12
+ expect(spy).toHaveBeenCalledTimes(3);
13
+ });
14
+ it("registers expected prompt names", () => {
15
+ const spy = vi.spyOn(server, "registerPrompt");
16
+ registerPrompts(server);
17
+ const names = spy.mock.calls.map((call) => call[0]);
18
+ expect(names).toContain("new-screen");
19
+ expect(names).toContain("architecture-guide");
20
+ expect(names).toContain("debug-help");
21
+ });
22
+ });
23
+ //# sourceMappingURL=prompts.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prompts.test.js","sourceRoot":"","sources":["../../src/prompts/prompts.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;A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