vibe-coding-mcp 2.3.0

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 (130) hide show
  1. package/README.md +179 -0
  2. package/dist/__tests__/collectCodeContext.test.d.ts +2 -0
  3. package/dist/__tests__/collectCodeContext.test.d.ts.map +1 -0
  4. package/dist/__tests__/collectCodeContext.test.js +139 -0
  5. package/dist/__tests__/collectCodeContext.test.js.map +1 -0
  6. package/dist/__tests__/createSessionLog.test.d.ts +2 -0
  7. package/dist/__tests__/createSessionLog.test.d.ts.map +1 -0
  8. package/dist/__tests__/createSessionLog.test.js +130 -0
  9. package/dist/__tests__/createSessionLog.test.js.map +1 -0
  10. package/dist/__tests__/generateDevDocument.test.d.ts +2 -0
  11. package/dist/__tests__/generateDevDocument.test.d.ts.map +1 -0
  12. package/dist/__tests__/generateDevDocument.test.js +174 -0
  13. package/dist/__tests__/generateDevDocument.test.js.map +1 -0
  14. package/dist/__tests__/normalizeForPlatform.test.d.ts +2 -0
  15. package/dist/__tests__/normalizeForPlatform.test.d.ts.map +1 -0
  16. package/dist/__tests__/normalizeForPlatform.test.js +171 -0
  17. package/dist/__tests__/normalizeForPlatform.test.js.map +1 -0
  18. package/dist/__tests__/publishDocument.test.d.ts +2 -0
  19. package/dist/__tests__/publishDocument.test.d.ts.map +1 -0
  20. package/dist/__tests__/publishDocument.test.js +93 -0
  21. package/dist/__tests__/publishDocument.test.js.map +1 -0
  22. package/dist/__tests__/summarizeDesignDecisions.test.d.ts +2 -0
  23. package/dist/__tests__/summarizeDesignDecisions.test.d.ts.map +1 -0
  24. package/dist/__tests__/summarizeDesignDecisions.test.js +158 -0
  25. package/dist/__tests__/summarizeDesignDecisions.test.js.map +1 -0
  26. package/dist/core/cache.d.ts +39 -0
  27. package/dist/core/cache.d.ts.map +1 -0
  28. package/dist/core/cache.js +112 -0
  29. package/dist/core/cache.js.map +1 -0
  30. package/dist/core/config.d.ts +30 -0
  31. package/dist/core/config.d.ts.map +1 -0
  32. package/dist/core/config.js +90 -0
  33. package/dist/core/config.js.map +1 -0
  34. package/dist/core/errors.d.ts +52 -0
  35. package/dist/core/errors.d.ts.map +1 -0
  36. package/dist/core/errors.js +99 -0
  37. package/dist/core/errors.js.map +1 -0
  38. package/dist/core/logger.d.ts +57 -0
  39. package/dist/core/logger.d.ts.map +1 -0
  40. package/dist/core/logger.js +114 -0
  41. package/dist/core/logger.js.map +1 -0
  42. package/dist/core/schemas.d.ts +690 -0
  43. package/dist/core/schemas.d.ts.map +1 -0
  44. package/dist/core/schemas.js +136 -0
  45. package/dist/core/schemas.js.map +1 -0
  46. package/dist/core/security.d.ts +28 -0
  47. package/dist/core/security.d.ts.map +1 -0
  48. package/dist/core/security.js +103 -0
  49. package/dist/core/security.js.map +1 -0
  50. package/dist/index.d.ts +3 -0
  51. package/dist/index.d.ts.map +1 -0
  52. package/dist/index.js +168 -0
  53. package/dist/index.js.map +1 -0
  54. package/dist/platforms/confluence.d.ts +13 -0
  55. package/dist/platforms/confluence.d.ts.map +1 -0
  56. package/dist/platforms/confluence.js +178 -0
  57. package/dist/platforms/confluence.js.map +1 -0
  58. package/dist/platforms/discord.d.ts +54 -0
  59. package/dist/platforms/discord.d.ts.map +1 -0
  60. package/dist/platforms/discord.js +176 -0
  61. package/dist/platforms/discord.js.map +1 -0
  62. package/dist/platforms/github-wiki.d.ts +3 -0
  63. package/dist/platforms/github-wiki.d.ts.map +1 -0
  64. package/dist/platforms/github-wiki.js +120 -0
  65. package/dist/platforms/github-wiki.js.map +1 -0
  66. package/dist/platforms/notion.d.ts +3 -0
  67. package/dist/platforms/notion.d.ts.map +1 -0
  68. package/dist/platforms/notion.js +205 -0
  69. package/dist/platforms/notion.js.map +1 -0
  70. package/dist/platforms/obsidian.d.ts +3 -0
  71. package/dist/platforms/obsidian.d.ts.map +1 -0
  72. package/dist/platforms/obsidian.js +43 -0
  73. package/dist/platforms/obsidian.js.map +1 -0
  74. package/dist/platforms/slack.d.ts +21 -0
  75. package/dist/platforms/slack.d.ts.map +1 -0
  76. package/dist/platforms/slack.js +217 -0
  77. package/dist/platforms/slack.js.map +1 -0
  78. package/dist/stdio.d.ts +6 -0
  79. package/dist/stdio.d.ts.map +1 -0
  80. package/dist/stdio.js +98 -0
  81. package/dist/stdio.js.map +1 -0
  82. package/dist/tools/analyzeCode.d.ts +65 -0
  83. package/dist/tools/analyzeCode.d.ts.map +1 -0
  84. package/dist/tools/analyzeCode.js +113 -0
  85. package/dist/tools/analyzeCode.js.map +1 -0
  86. package/dist/tools/collectCodeContext.d.ts +86 -0
  87. package/dist/tools/collectCodeContext.d.ts.map +1 -0
  88. package/dist/tools/collectCodeContext.js +275 -0
  89. package/dist/tools/collectCodeContext.js.map +1 -0
  90. package/dist/tools/createSessionLog.d.ts +79 -0
  91. package/dist/tools/createSessionLog.d.ts.map +1 -0
  92. package/dist/tools/createSessionLog.js +160 -0
  93. package/dist/tools/createSessionLog.js.map +1 -0
  94. package/dist/tools/generateDevDocument.d.ts +216 -0
  95. package/dist/tools/generateDevDocument.d.ts.map +1 -0
  96. package/dist/tools/generateDevDocument.js +659 -0
  97. package/dist/tools/generateDevDocument.js.map +1 -0
  98. package/dist/tools/normalizeForPlatform.d.ts +95 -0
  99. package/dist/tools/normalizeForPlatform.d.ts.map +1 -0
  100. package/dist/tools/normalizeForPlatform.js +340 -0
  101. package/dist/tools/normalizeForPlatform.js.map +1 -0
  102. package/dist/tools/publishDocument.d.ts +60 -0
  103. package/dist/tools/publishDocument.d.ts.map +1 -0
  104. package/dist/tools/publishDocument.js +117 -0
  105. package/dist/tools/publishDocument.js.map +1 -0
  106. package/dist/tools/summarizeDesignDecisions.d.ts +82 -0
  107. package/dist/tools/summarizeDesignDecisions.d.ts.map +1 -0
  108. package/dist/tools/summarizeDesignDecisions.js +361 -0
  109. package/dist/tools/summarizeDesignDecisions.js.map +1 -0
  110. package/dist/types/index.d.ts +63 -0
  111. package/dist/types/index.d.ts.map +1 -0
  112. package/dist/types/index.js +2 -0
  113. package/dist/types/index.js.map +1 -0
  114. package/dist/utils/astParser.d.ts +55 -0
  115. package/dist/utils/astParser.d.ts.map +1 -0
  116. package/dist/utils/astParser.js +333 -0
  117. package/dist/utils/astParser.js.map +1 -0
  118. package/dist/utils/i18n.d.ts +67 -0
  119. package/dist/utils/i18n.d.ts.map +1 -0
  120. package/dist/utils/i18n.js +193 -0
  121. package/dist/utils/i18n.js.map +1 -0
  122. package/dist/utils/markdown.d.ts +9 -0
  123. package/dist/utils/markdown.d.ts.map +1 -0
  124. package/dist/utils/markdown.js +99 -0
  125. package/dist/utils/markdown.js.map +1 -0
  126. package/dist/utils/mermaidGenerator.d.ts +69 -0
  127. package/dist/utils/mermaidGenerator.d.ts.map +1 -0
  128. package/dist/utils/mermaidGenerator.js +315 -0
  129. package/dist/utils/mermaidGenerator.js.map +1 -0
  130. package/package.json +66 -0
@@ -0,0 +1,659 @@
1
+ import { codeBlockToMarkdown, designDecisionToMarkdown, formatDate } from '../utils/markdown.js';
2
+ const translations = {
3
+ en: {
4
+ overview: 'Overview',
5
+ installation: 'Installation',
6
+ usage: 'Usage',
7
+ codeExamples: 'Code Examples',
8
+ designDecisions: 'Design Decisions',
9
+ features: 'Features',
10
+ prerequisites: 'Prerequisites',
11
+ gettingStarted: 'Getting Started',
12
+ summary: 'Summary',
13
+ apiReference: 'API Reference',
14
+ faq: 'FAQ',
15
+ contributing: 'Contributing',
16
+ license: 'License',
17
+ changelog: 'Changelog',
18
+ added: 'Added',
19
+ changed: 'Changed',
20
+ fixed: 'Fixed',
21
+ removed: 'Removed',
22
+ tableOfContents: 'Table of Contents',
23
+ parameters: 'Parameters',
24
+ returns: 'Returns',
25
+ step: 'Step'
26
+ },
27
+ ko: {
28
+ overview: '개요',
29
+ installation: '설치',
30
+ usage: '사용법',
31
+ codeExamples: '코드 예제',
32
+ designDecisions: '설계 결정',
33
+ features: '기능',
34
+ prerequisites: '사전 요구사항',
35
+ gettingStarted: '시작하기',
36
+ summary: '요약',
37
+ apiReference: 'API 레퍼런스',
38
+ faq: 'FAQ',
39
+ contributing: '기여하기',
40
+ license: '라이선스',
41
+ changelog: '변경 이력',
42
+ added: '추가됨',
43
+ changed: '변경됨',
44
+ fixed: '수정됨',
45
+ removed: '제거됨',
46
+ tableOfContents: '목차',
47
+ parameters: '매개변수',
48
+ returns: '반환값',
49
+ step: '단계'
50
+ }
51
+ };
52
+ export function generateDevDocument(input) {
53
+ const lang = input.language || 'en';
54
+ const t = translations[lang];
55
+ let document = '';
56
+ const sections = [];
57
+ switch (input.documentType) {
58
+ case 'README':
59
+ document = generateReadme(input, t, sections);
60
+ break;
61
+ case 'DESIGN':
62
+ document = generateDesignDoc(input, t, sections);
63
+ break;
64
+ case 'TUTORIAL':
65
+ document = generateTutorial(input, t, sections);
66
+ break;
67
+ case 'CHANGELOG':
68
+ document = generateChangelog(input, t, sections);
69
+ break;
70
+ case 'API':
71
+ document = generateApiDoc(input, t, sections);
72
+ break;
73
+ case 'ARCHITECTURE':
74
+ document = generateArchitectureDoc(input, t, sections);
75
+ break;
76
+ }
77
+ const wordCount = document.split(/\s+/).filter(w => w.length > 0).length;
78
+ return {
79
+ document,
80
+ documentType: input.documentType,
81
+ generatedAt: new Date().toISOString(),
82
+ wordCount,
83
+ sections
84
+ };
85
+ }
86
+ function generateBadges(badges) {
87
+ return badges
88
+ .map(b => `![${b.label}](https://img.shields.io/badge/${encodeURIComponent(b.label)}-${encodeURIComponent(b.message)}-${b.color})`)
89
+ .join(' ') + '\n\n';
90
+ }
91
+ function generateTableOfContents(sections, t) {
92
+ let toc = `## ${t.tableOfContents}\n\n`;
93
+ sections.forEach((section, index) => {
94
+ const slug = section.toLowerCase().replace(/\s+/g, '-').replace(/[^\w-]/g, '');
95
+ toc += `${index + 1}. [${section}](#${slug})\n`;
96
+ });
97
+ return toc + '\n';
98
+ }
99
+ function generateReadme(input, t, sectionList) {
100
+ const title = input.title || input.projectName || 'Project';
101
+ let doc = `# ${title}\n\n`;
102
+ // 배지
103
+ if (input.badges && input.badges.length > 0) {
104
+ doc += generateBadges(input.badges);
105
+ }
106
+ // 설명
107
+ if (input.description) {
108
+ doc += `${input.description}\n\n`;
109
+ }
110
+ // 목차를 위한 섹션 수집
111
+ const sections = [t.overview];
112
+ if (input.features)
113
+ sections.push(t.features);
114
+ sections.push(t.installation, t.usage);
115
+ if (input.codeContexts?.length)
116
+ sections.push(t.codeExamples);
117
+ if (input.apiReference?.length)
118
+ sections.push(t.apiReference);
119
+ if (input.designDecisions?.length)
120
+ sections.push(t.designDecisions);
121
+ if (input.faq?.length)
122
+ sections.push(t.faq);
123
+ if (input.contributors?.length)
124
+ sections.push(t.contributing);
125
+ if (input.license)
126
+ sections.push(t.license);
127
+ sectionList.push(...sections);
128
+ if (input.includeTableOfContents) {
129
+ doc += generateTableOfContents(sections, t);
130
+ }
131
+ // 개요
132
+ doc += `## ${t.overview}\n\n`;
133
+ if (input.codeContexts && input.codeContexts.length > 0) {
134
+ doc += input.codeContexts[0].conversationSummary + '\n\n';
135
+ }
136
+ else {
137
+ doc += `This document provides an overview of the ${title} project.\n\n`;
138
+ }
139
+ // 기능
140
+ if (input.features && input.features.length > 0) {
141
+ doc += `## ${t.features}\n\n`;
142
+ for (const feature of input.features) {
143
+ doc += `- ${feature}\n`;
144
+ }
145
+ doc += '\n';
146
+ }
147
+ // 설치
148
+ doc += `## ${t.installation}\n\n`;
149
+ if (input.installation) {
150
+ if (input.installation.requirements) {
151
+ doc += `### ${t.prerequisites}\n\n`;
152
+ for (const req of input.installation.requirements) {
153
+ doc += `- ${req}\n`;
154
+ }
155
+ doc += '\n';
156
+ }
157
+ doc += '```bash\n';
158
+ for (const step of input.installation.steps) {
159
+ doc += `${step}\n`;
160
+ }
161
+ doc += '```\n\n';
162
+ }
163
+ else {
164
+ doc += '```bash\n# Installation\nnpm install\n```\n\n';
165
+ }
166
+ // 사용법
167
+ doc += `## ${t.usage}\n\n`;
168
+ doc += 'Describe how to use the project here.\n\n';
169
+ // 코드 예제
170
+ if (input.codeContexts && input.codeContexts.length > 0) {
171
+ doc += `## ${t.codeExamples}\n\n`;
172
+ for (const context of input.codeContexts) {
173
+ if (context.conversationSummary) {
174
+ doc += `### ${context.tags?.[0] || 'Example'}\n\n`;
175
+ doc += context.conversationSummary + '\n\n';
176
+ }
177
+ for (const block of context.codeBlocks) {
178
+ doc += codeBlockToMarkdown(block) + '\n\n';
179
+ }
180
+ }
181
+ }
182
+ // API 레퍼런스
183
+ if (input.apiReference && input.apiReference.length > 0) {
184
+ doc += `## ${t.apiReference}\n\n`;
185
+ for (const api of input.apiReference) {
186
+ doc += `### \`${api.name}\`\n\n`;
187
+ doc += `${api.description}\n\n`;
188
+ if (api.params && api.params.length > 0) {
189
+ doc += `**${t.parameters}:**\n`;
190
+ for (const param of api.params) {
191
+ doc += `- ${param}\n`;
192
+ }
193
+ doc += '\n';
194
+ }
195
+ if (api.returns) {
196
+ doc += `**${t.returns}:** ${api.returns}\n\n`;
197
+ }
198
+ }
199
+ }
200
+ // 설계 결정
201
+ if (input.designDecisions && input.designDecisions.length > 0) {
202
+ doc += `## ${t.designDecisions}\n\n`;
203
+ for (const decision of input.designDecisions) {
204
+ doc += designDecisionToMarkdown(decision) + '\n\n';
205
+ }
206
+ }
207
+ // FAQ
208
+ if (input.faq && input.faq.length > 0) {
209
+ doc += `## ${t.faq}\n\n`;
210
+ for (const item of input.faq) {
211
+ doc += `### ${item.question}\n\n`;
212
+ doc += `${item.answer}\n\n`;
213
+ }
214
+ }
215
+ // 커스텀 섹션
216
+ if (input.customSections) {
217
+ for (const [sectionTitle, content] of Object.entries(input.customSections)) {
218
+ doc += `## ${sectionTitle}\n\n${content}\n\n`;
219
+ }
220
+ }
221
+ // 기여자
222
+ if (input.contributors && input.contributors.length > 0) {
223
+ doc += `## ${t.contributing}\n\n`;
224
+ for (const contrib of input.contributors) {
225
+ doc += `- **${contrib.name}**${contrib.role ? ` - ${contrib.role}` : ''}\n`;
226
+ }
227
+ doc += '\n';
228
+ }
229
+ // 라이선스
230
+ if (input.license) {
231
+ doc += `## ${t.license}\n\n`;
232
+ doc += `This project is licensed under the ${input.license} License.\n\n`;
233
+ }
234
+ // 푸터
235
+ doc += `---\n\n`;
236
+ if (input.author) {
237
+ doc += `Created by ${input.author}. `;
238
+ }
239
+ doc += `*Generated on ${formatDate()}*\n`;
240
+ return doc;
241
+ }
242
+ function generateDesignDoc(input, t, sectionList) {
243
+ const title = input.title || 'Design Document';
244
+ let doc = `# ${title}\n\n`;
245
+ doc += `| Field | Value |\n`;
246
+ doc += `|-------|-------|\n`;
247
+ doc += `| **Date** | ${formatDate()} |\n`;
248
+ if (input.author)
249
+ doc += `| **Author** | ${input.author} |\n`;
250
+ if (input.version)
251
+ doc += `| **Version** | ${input.version} |\n`;
252
+ doc += '\n';
253
+ sectionList.push('Summary', 'Architecture Overview', 'Key Decisions', 'Implementation Details');
254
+ if (input.description) {
255
+ doc += `## Summary\n\n${input.description}\n\n`;
256
+ }
257
+ doc += `## Architecture Overview\n\n`;
258
+ if (input.codeContexts && input.codeContexts.length > 0) {
259
+ doc += input.codeContexts[0].conversationSummary + '\n\n';
260
+ }
261
+ else {
262
+ doc += 'Describe the overall architecture here.\n\n';
263
+ }
264
+ if (input.designDecisions && input.designDecisions.length > 0) {
265
+ doc += `## Key Decisions\n\n`;
266
+ // 카테고리별로 그룹화
267
+ const byCategory = input.designDecisions.reduce((acc, d) => {
268
+ if (!acc[d.category])
269
+ acc[d.category] = [];
270
+ acc[d.category].push(d);
271
+ return acc;
272
+ }, {});
273
+ for (const [category, decisions] of Object.entries(byCategory)) {
274
+ doc += `### ${category.charAt(0).toUpperCase() + category.slice(1)}\n\n`;
275
+ for (const decision of decisions) {
276
+ doc += designDecisionToMarkdown(decision) + '\n';
277
+ }
278
+ }
279
+ }
280
+ if (input.codeContexts && input.codeContexts.length > 0) {
281
+ doc += `## Implementation Details\n\n`;
282
+ for (const context of input.codeContexts) {
283
+ const contextTitle = context.tags?.[0] || new Date(context.timestamp).toLocaleDateString();
284
+ doc += `### ${contextTitle}\n\n`;
285
+ doc += context.conversationSummary + '\n\n';
286
+ for (const block of context.codeBlocks) {
287
+ doc += codeBlockToMarkdown(block) + '\n\n';
288
+ }
289
+ }
290
+ }
291
+ if (input.customSections) {
292
+ for (const [sectionTitle, content] of Object.entries(input.customSections)) {
293
+ doc += `## ${sectionTitle}\n\n${content}\n\n`;
294
+ }
295
+ }
296
+ return doc;
297
+ }
298
+ function generateTutorial(input, t, sectionList) {
299
+ const title = input.title || 'Tutorial';
300
+ let doc = `# ${title}\n\n`;
301
+ if (input.description) {
302
+ doc += `> ${input.description}\n\n`;
303
+ }
304
+ sectionList.push(t.prerequisites, t.gettingStarted, t.summary);
305
+ // 사전 요구사항
306
+ doc += `## ${t.prerequisites}\n\n`;
307
+ if (input.installation?.requirements) {
308
+ for (const req of input.installation.requirements) {
309
+ doc += `- ${req}\n`;
310
+ }
311
+ }
312
+ else {
313
+ doc += '- List prerequisites here\n';
314
+ }
315
+ doc += '\n';
316
+ // 시작하기
317
+ doc += `## ${t.gettingStarted}\n\n`;
318
+ if (input.codeContexts && input.codeContexts.length > 0) {
319
+ let stepNumber = 1;
320
+ for (const context of input.codeContexts) {
321
+ const stepTitle = context.tags?.[0] || `${t.step} ${stepNumber}`;
322
+ doc += `### ${t.step} ${stepNumber}: ${stepTitle}\n\n`;
323
+ doc += context.conversationSummary + '\n\n';
324
+ for (const block of context.codeBlocks) {
325
+ doc += codeBlockToMarkdown(block) + '\n\n';
326
+ }
327
+ stepNumber++;
328
+ }
329
+ }
330
+ // 요약
331
+ doc += `## ${t.summary}\n\n`;
332
+ if (input.features) {
333
+ doc += 'In this tutorial, you learned:\n\n';
334
+ for (const feature of input.features) {
335
+ doc += `- ${feature}\n`;
336
+ }
337
+ }
338
+ else {
339
+ doc += 'Summarize what was learned in this tutorial.\n';
340
+ }
341
+ doc += '\n';
342
+ if (input.customSections) {
343
+ for (const [sectionTitle, content] of Object.entries(input.customSections)) {
344
+ doc += `## ${sectionTitle}\n\n${content}\n\n`;
345
+ }
346
+ }
347
+ return doc;
348
+ }
349
+ function generateChangelog(input, t, sectionList) {
350
+ let doc = `# ${t.changelog}\n\n`;
351
+ doc += `All notable changes to this project will be documented in this file.\n\n`;
352
+ doc += `The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).\n\n`;
353
+ const today = formatDate();
354
+ const version = input.version || 'Unreleased';
355
+ sectionList.push(`[${version}] - ${today}`);
356
+ doc += `## [${version}] - ${today}\n\n`;
357
+ if (input.codeContexts && input.codeContexts.length > 0) {
358
+ doc += `### ${t.added}\n\n`;
359
+ for (const context of input.codeContexts) {
360
+ doc += `- ${context.conversationSummary}\n`;
361
+ if (context.tags && context.tags.length > 0) {
362
+ doc += ` - Tags: ${context.tags.join(', ')}\n`;
363
+ }
364
+ }
365
+ doc += '\n';
366
+ }
367
+ if (input.designDecisions && input.designDecisions.length > 0) {
368
+ doc += `### ${t.changed}\n\n`;
369
+ for (const decision of input.designDecisions) {
370
+ doc += `- **${decision.title}**: ${decision.description.substring(0, 100)}${decision.description.length > 100 ? '...' : ''}\n`;
371
+ }
372
+ doc += '\n';
373
+ }
374
+ if (input.customSections) {
375
+ for (const [sectionTitle, content] of Object.entries(input.customSections)) {
376
+ doc += `### ${sectionTitle}\n\n${content}\n\n`;
377
+ }
378
+ }
379
+ return doc;
380
+ }
381
+ function generateApiDoc(input, t, sectionList) {
382
+ const title = input.title || 'API Reference';
383
+ let doc = `# ${title}\n\n`;
384
+ if (input.version) {
385
+ doc += `> Version ${input.version}\n\n`;
386
+ }
387
+ if (input.description) {
388
+ doc += `${input.description}\n\n`;
389
+ }
390
+ sectionList.push('Overview', 'Authentication', 'Endpoints', 'Error Codes');
391
+ doc += `## Overview\n\n`;
392
+ doc += `This document describes the API endpoints and their usage.\n\n`;
393
+ if (input.installation?.requirements) {
394
+ doc += `### Base URL\n\n`;
395
+ doc += `\`\`\`\n${input.installation.requirements[0] || 'https://api.example.com/v1'}\n\`\`\`\n\n`;
396
+ }
397
+ doc += `## Authentication\n\n`;
398
+ doc += `Include your API key in the request header:\n\n`;
399
+ doc += `\`\`\`\nAuthorization: Bearer YOUR_API_KEY\n\`\`\`\n\n`;
400
+ if (input.apiReference && input.apiReference.length > 0) {
401
+ doc += `## Endpoints\n\n`;
402
+ for (const api of input.apiReference) {
403
+ doc += `### ${api.name}\n\n`;
404
+ doc += `${api.description}\n\n`;
405
+ if (api.params && api.params.length > 0) {
406
+ doc += `#### ${t.parameters}\n\n`;
407
+ doc += `| Name | Type | Required | Description |\n`;
408
+ doc += `|------|------|----------|-------------|\n`;
409
+ for (const param of api.params) {
410
+ const parts = param.split(':').map(s => s.trim());
411
+ doc += `| \`${parts[0]}\` | ${parts[1] || 'string'} | ${parts[2] || 'No'} | ${parts[3] || '-'} |\n`;
412
+ }
413
+ doc += '\n';
414
+ }
415
+ if (api.returns) {
416
+ doc += `#### Response\n\n`;
417
+ doc += `\`\`\`json\n${api.returns}\n\`\`\`\n\n`;
418
+ }
419
+ }
420
+ }
421
+ doc += `## Error Codes\n\n`;
422
+ doc += `| Code | Description |\n`;
423
+ doc += `|------|-------------|\n`;
424
+ doc += `| 200 | Success |\n`;
425
+ doc += `| 400 | Bad Request |\n`;
426
+ doc += `| 401 | Unauthorized |\n`;
427
+ doc += `| 403 | Forbidden |\n`;
428
+ doc += `| 404 | Not Found |\n`;
429
+ doc += `| 500 | Internal Server Error |\n\n`;
430
+ doc += `---\n\n*Generated on ${formatDate()}*\n`;
431
+ return doc;
432
+ }
433
+ function generateArchitectureDoc(input, t, sectionList) {
434
+ const title = input.title || 'Architecture Document';
435
+ let doc = `# ${title}\n\n`;
436
+ doc += `| Field | Value |\n`;
437
+ doc += `|-------|-------|\n`;
438
+ doc += `| **Date** | ${formatDate()} |\n`;
439
+ if (input.author)
440
+ doc += `| **Author** | ${input.author} |\n`;
441
+ if (input.version)
442
+ doc += `| **Version** | ${input.version} |\n`;
443
+ doc += '\n';
444
+ sectionList.push('Overview', 'System Components', 'Data Flow', 'Technology Stack', 'Deployment');
445
+ doc += `## Overview\n\n`;
446
+ if (input.description) {
447
+ doc += `${input.description}\n\n`;
448
+ }
449
+ else {
450
+ doc += `This document describes the system architecture.\n\n`;
451
+ }
452
+ doc += `## System Components\n\n`;
453
+ doc += `\`\`\`mermaid\nflowchart TB\n`;
454
+ doc += ` Client[Client Layer]\n`;
455
+ doc += ` API[API Gateway]\n`;
456
+ doc += ` Services[Service Layer]\n`;
457
+ doc += ` DB[(Database)]\n`;
458
+ doc += ` Client --> API\n`;
459
+ doc += ` API --> Services\n`;
460
+ doc += ` Services --> DB\n`;
461
+ doc += `\`\`\`\n\n`;
462
+ if (input.features && input.features.length > 0) {
463
+ doc += `### Components\n\n`;
464
+ for (const feature of input.features) {
465
+ doc += `- **${feature}**\n`;
466
+ }
467
+ doc += '\n';
468
+ }
469
+ doc += `## Data Flow\n\n`;
470
+ doc += `\`\`\`mermaid\nsequenceDiagram\n`;
471
+ doc += ` participant C as Client\n`;
472
+ doc += ` participant A as API\n`;
473
+ doc += ` participant S as Service\n`;
474
+ doc += ` participant D as Database\n`;
475
+ doc += ` C->>A: Request\n`;
476
+ doc += ` A->>S: Process\n`;
477
+ doc += ` S->>D: Query\n`;
478
+ doc += ` D-->>S: Result\n`;
479
+ doc += ` S-->>A: Response\n`;
480
+ doc += ` A-->>C: Response\n`;
481
+ doc += `\`\`\`\n\n`;
482
+ doc += `## Technology Stack\n\n`;
483
+ if (input.codeContexts && input.codeContexts.length > 0) {
484
+ const allTags = new Set();
485
+ for (const ctx of input.codeContexts) {
486
+ ctx.tags?.forEach(tag => allTags.add(tag));
487
+ }
488
+ if (allTags.size > 0) {
489
+ doc += `| Category | Technology |\n`;
490
+ doc += `|----------|------------|\n`;
491
+ for (const tag of allTags) {
492
+ doc += `| ${tag} | - |\n`;
493
+ }
494
+ doc += '\n';
495
+ }
496
+ }
497
+ else {
498
+ doc += `| Category | Technology |\n`;
499
+ doc += `|----------|------------|\n`;
500
+ doc += `| Frontend | - |\n`;
501
+ doc += `| Backend | - |\n`;
502
+ doc += `| Database | - |\n`;
503
+ doc += `| Infrastructure | - |\n\n`;
504
+ }
505
+ doc += `## Deployment\n\n`;
506
+ doc += `\`\`\`mermaid\nflowchart LR\n`;
507
+ doc += ` Dev[Development] --> Staging[Staging]\n`;
508
+ doc += ` Staging --> Prod[Production]\n`;
509
+ doc += `\`\`\`\n\n`;
510
+ if (input.designDecisions && input.designDecisions.length > 0) {
511
+ doc += `## Key Decisions\n\n`;
512
+ for (const decision of input.designDecisions) {
513
+ doc += `### ${decision.title}\n\n`;
514
+ doc += `${decision.description}\n\n`;
515
+ doc += `**Rationale:** ${decision.rationale}\n\n`;
516
+ if (decision.alternatives && decision.alternatives.length > 0) {
517
+ doc += `**Alternatives Considered:**\n`;
518
+ for (const alt of decision.alternatives) {
519
+ doc += `- ${alt}\n`;
520
+ }
521
+ doc += '\n';
522
+ }
523
+ }
524
+ }
525
+ if (input.customSections) {
526
+ for (const [sectionTitle, content] of Object.entries(input.customSections)) {
527
+ doc += `## ${sectionTitle}\n\n${content}\n\n`;
528
+ }
529
+ }
530
+ doc += `---\n\n*Generated on ${formatDate()}*\n`;
531
+ return doc;
532
+ }
533
+ export const generateDevDocumentSchema = {
534
+ name: 'muse_generate_dev_document',
535
+ description: 'Generates README, DESIGN, TUTORIAL, or CHANGELOG documents in Markdown format. Supports multiple languages, badges, API reference, FAQ, and more.',
536
+ inputSchema: {
537
+ type: 'object',
538
+ properties: {
539
+ documentType: {
540
+ type: 'string',
541
+ enum: ['README', 'DESIGN', 'TUTORIAL', 'CHANGELOG', 'API', 'ARCHITECTURE'],
542
+ description: 'Type of document to generate (README, DESIGN, TUTORIAL, CHANGELOG, API, ARCHITECTURE)'
543
+ },
544
+ title: {
545
+ type: 'string',
546
+ description: 'Title of the document'
547
+ },
548
+ projectName: {
549
+ type: 'string',
550
+ description: 'Name of the project'
551
+ },
552
+ description: {
553
+ type: 'string',
554
+ description: 'Project or document description'
555
+ },
556
+ language: {
557
+ type: 'string',
558
+ enum: ['en', 'ko'],
559
+ description: 'Language for section headers (default: en)'
560
+ },
561
+ author: {
562
+ type: 'string',
563
+ description: 'Author name'
564
+ },
565
+ version: {
566
+ type: 'string',
567
+ description: 'Version number'
568
+ },
569
+ license: {
570
+ type: 'string',
571
+ description: 'License type (e.g., MIT, Apache-2.0)'
572
+ },
573
+ repository: {
574
+ type: 'string',
575
+ description: 'Repository URL'
576
+ },
577
+ badges: {
578
+ type: 'array',
579
+ description: 'Shield.io badges',
580
+ items: {
581
+ type: 'object',
582
+ properties: {
583
+ label: { type: 'string' },
584
+ message: { type: 'string' },
585
+ color: { type: 'string' }
586
+ }
587
+ }
588
+ },
589
+ features: {
590
+ type: 'array',
591
+ items: { type: 'string' },
592
+ description: 'List of features'
593
+ },
594
+ installation: {
595
+ type: 'object',
596
+ description: 'Installation instructions',
597
+ properties: {
598
+ steps: { type: 'array', items: { type: 'string' } },
599
+ requirements: { type: 'array', items: { type: 'string' } }
600
+ }
601
+ },
602
+ apiReference: {
603
+ type: 'array',
604
+ description: 'API documentation',
605
+ items: {
606
+ type: 'object',
607
+ properties: {
608
+ name: { type: 'string' },
609
+ description: { type: 'string' },
610
+ params: { type: 'array', items: { type: 'string' } },
611
+ returns: { type: 'string' }
612
+ }
613
+ }
614
+ },
615
+ faq: {
616
+ type: 'array',
617
+ description: 'Frequently asked questions',
618
+ items: {
619
+ type: 'object',
620
+ properties: {
621
+ question: { type: 'string' },
622
+ answer: { type: 'string' }
623
+ }
624
+ }
625
+ },
626
+ contributors: {
627
+ type: 'array',
628
+ description: 'List of contributors',
629
+ items: {
630
+ type: 'object',
631
+ properties: {
632
+ name: { type: 'string' },
633
+ role: { type: 'string' }
634
+ }
635
+ }
636
+ },
637
+ codeContexts: {
638
+ type: 'array',
639
+ description: 'Array of code contexts to include',
640
+ items: { type: 'object' }
641
+ },
642
+ designDecisions: {
643
+ type: 'array',
644
+ description: 'Array of design decisions to include',
645
+ items: { type: 'object' }
646
+ },
647
+ customSections: {
648
+ type: 'object',
649
+ description: 'Custom sections to add (key: section title, value: content)'
650
+ },
651
+ includeTableOfContents: {
652
+ type: 'boolean',
653
+ description: 'Whether to include a table of contents'
654
+ }
655
+ },
656
+ required: ['documentType']
657
+ }
658
+ };
659
+ //# sourceMappingURL=generateDevDocument.js.map