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.
- package/README.md +179 -0
- package/dist/__tests__/collectCodeContext.test.d.ts +2 -0
- package/dist/__tests__/collectCodeContext.test.d.ts.map +1 -0
- package/dist/__tests__/collectCodeContext.test.js +139 -0
- package/dist/__tests__/collectCodeContext.test.js.map +1 -0
- package/dist/__tests__/createSessionLog.test.d.ts +2 -0
- package/dist/__tests__/createSessionLog.test.d.ts.map +1 -0
- package/dist/__tests__/createSessionLog.test.js +130 -0
- package/dist/__tests__/createSessionLog.test.js.map +1 -0
- package/dist/__tests__/generateDevDocument.test.d.ts +2 -0
- package/dist/__tests__/generateDevDocument.test.d.ts.map +1 -0
- package/dist/__tests__/generateDevDocument.test.js +174 -0
- package/dist/__tests__/generateDevDocument.test.js.map +1 -0
- package/dist/__tests__/normalizeForPlatform.test.d.ts +2 -0
- package/dist/__tests__/normalizeForPlatform.test.d.ts.map +1 -0
- package/dist/__tests__/normalizeForPlatform.test.js +171 -0
- package/dist/__tests__/normalizeForPlatform.test.js.map +1 -0
- package/dist/__tests__/publishDocument.test.d.ts +2 -0
- package/dist/__tests__/publishDocument.test.d.ts.map +1 -0
- package/dist/__tests__/publishDocument.test.js +93 -0
- package/dist/__tests__/publishDocument.test.js.map +1 -0
- package/dist/__tests__/summarizeDesignDecisions.test.d.ts +2 -0
- package/dist/__tests__/summarizeDesignDecisions.test.d.ts.map +1 -0
- package/dist/__tests__/summarizeDesignDecisions.test.js +158 -0
- package/dist/__tests__/summarizeDesignDecisions.test.js.map +1 -0
- package/dist/core/cache.d.ts +39 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +112 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/core/config.d.ts +30 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +90 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/errors.d.ts +52 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +99 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/logger.d.ts +57 -0
- package/dist/core/logger.d.ts.map +1 -0
- package/dist/core/logger.js +114 -0
- package/dist/core/logger.js.map +1 -0
- package/dist/core/schemas.d.ts +690 -0
- package/dist/core/schemas.d.ts.map +1 -0
- package/dist/core/schemas.js +136 -0
- package/dist/core/schemas.js.map +1 -0
- package/dist/core/security.d.ts +28 -0
- package/dist/core/security.d.ts.map +1 -0
- package/dist/core/security.js +103 -0
- package/dist/core/security.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +168 -0
- package/dist/index.js.map +1 -0
- package/dist/platforms/confluence.d.ts +13 -0
- package/dist/platforms/confluence.d.ts.map +1 -0
- package/dist/platforms/confluence.js +178 -0
- package/dist/platforms/confluence.js.map +1 -0
- package/dist/platforms/discord.d.ts +54 -0
- package/dist/platforms/discord.d.ts.map +1 -0
- package/dist/platforms/discord.js +176 -0
- package/dist/platforms/discord.js.map +1 -0
- package/dist/platforms/github-wiki.d.ts +3 -0
- package/dist/platforms/github-wiki.d.ts.map +1 -0
- package/dist/platforms/github-wiki.js +120 -0
- package/dist/platforms/github-wiki.js.map +1 -0
- package/dist/platforms/notion.d.ts +3 -0
- package/dist/platforms/notion.d.ts.map +1 -0
- package/dist/platforms/notion.js +205 -0
- package/dist/platforms/notion.js.map +1 -0
- package/dist/platforms/obsidian.d.ts +3 -0
- package/dist/platforms/obsidian.d.ts.map +1 -0
- package/dist/platforms/obsidian.js +43 -0
- package/dist/platforms/obsidian.js.map +1 -0
- package/dist/platforms/slack.d.ts +21 -0
- package/dist/platforms/slack.d.ts.map +1 -0
- package/dist/platforms/slack.js +217 -0
- package/dist/platforms/slack.js.map +1 -0
- package/dist/stdio.d.ts +6 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +98 -0
- package/dist/stdio.js.map +1 -0
- package/dist/tools/analyzeCode.d.ts +65 -0
- package/dist/tools/analyzeCode.d.ts.map +1 -0
- package/dist/tools/analyzeCode.js +113 -0
- package/dist/tools/analyzeCode.js.map +1 -0
- package/dist/tools/collectCodeContext.d.ts +86 -0
- package/dist/tools/collectCodeContext.d.ts.map +1 -0
- package/dist/tools/collectCodeContext.js +275 -0
- package/dist/tools/collectCodeContext.js.map +1 -0
- package/dist/tools/createSessionLog.d.ts +79 -0
- package/dist/tools/createSessionLog.d.ts.map +1 -0
- package/dist/tools/createSessionLog.js +160 -0
- package/dist/tools/createSessionLog.js.map +1 -0
- package/dist/tools/generateDevDocument.d.ts +216 -0
- package/dist/tools/generateDevDocument.d.ts.map +1 -0
- package/dist/tools/generateDevDocument.js +659 -0
- package/dist/tools/generateDevDocument.js.map +1 -0
- package/dist/tools/normalizeForPlatform.d.ts +95 -0
- package/dist/tools/normalizeForPlatform.d.ts.map +1 -0
- package/dist/tools/normalizeForPlatform.js +340 -0
- package/dist/tools/normalizeForPlatform.js.map +1 -0
- package/dist/tools/publishDocument.d.ts +60 -0
- package/dist/tools/publishDocument.d.ts.map +1 -0
- package/dist/tools/publishDocument.js +117 -0
- package/dist/tools/publishDocument.js.map +1 -0
- package/dist/tools/summarizeDesignDecisions.d.ts +82 -0
- package/dist/tools/summarizeDesignDecisions.d.ts.map +1 -0
- package/dist/tools/summarizeDesignDecisions.js +361 -0
- package/dist/tools/summarizeDesignDecisions.js.map +1 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/astParser.d.ts +55 -0
- package/dist/utils/astParser.d.ts.map +1 -0
- package/dist/utils/astParser.js +333 -0
- package/dist/utils/astParser.js.map +1 -0
- package/dist/utils/i18n.d.ts +67 -0
- package/dist/utils/i18n.d.ts.map +1 -0
- package/dist/utils/i18n.js +193 -0
- package/dist/utils/i18n.js.map +1 -0
- package/dist/utils/markdown.d.ts +9 -0
- package/dist/utils/markdown.d.ts.map +1 -0
- package/dist/utils/markdown.js +99 -0
- package/dist/utils/markdown.js.map +1 -0
- package/dist/utils/mermaidGenerator.d.ts +69 -0
- package/dist/utils/mermaidGenerator.d.ts.map +1 -0
- package/dist/utils/mermaidGenerator.js +315 -0
- package/dist/utils/mermaidGenerator.js.map +1 -0
- package/package.json +66 -0
package/README.md
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# Vibe Coding Documentation MCP (MUSE)
|
|
2
|
+
|
|
3
|
+
MCP server that automatically collects, summarizes, documents, and publishes code and design decisions created during vibe coding sessions.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
This MCP server provides 7 tools for managing vibe coding documentation:
|
|
8
|
+
|
|
9
|
+
| Tool | Description |
|
|
10
|
+
|------|-------------|
|
|
11
|
+
| `muse_collect_code_context` | Collects code blocks and conversation summaries into structured context |
|
|
12
|
+
| `muse_summarize_design_decisions` | Extracts key architectural and design decisions from conversation logs |
|
|
13
|
+
| `muse_generate_dev_document` | Generates README, DESIGN, TUTORIAL, CHANGELOG, API, or ARCHITECTURE documents |
|
|
14
|
+
| `muse_normalize_for_platform` | Converts Markdown documents for Notion, GitHub Wiki, or Obsidian |
|
|
15
|
+
| `muse_publish_document` | Publishes generated documents to external platforms |
|
|
16
|
+
| `muse_create_session_log` | Creates daily or session-based vibe coding session logs |
|
|
17
|
+
| `muse_analyze_code` | AST-based code analysis with Mermaid diagram generation |
|
|
18
|
+
|
|
19
|
+
### Additional Features (v2.0)
|
|
20
|
+
- **AST Parsing**: TypeScript, Python, Go code analysis
|
|
21
|
+
- **Mermaid Diagrams**: Class, Flowchart, Sequence, ER, Architecture diagrams
|
|
22
|
+
- **Multi-language**: Korean/English support
|
|
23
|
+
- **6 Document Types**: README, DESIGN, TUTORIAL, CHANGELOG, API, ARCHITECTURE
|
|
24
|
+
- **6 Platforms**: Notion, GitHub Wiki, Obsidian, Confluence, Slack, Discord
|
|
25
|
+
|
|
26
|
+
### Code Quality (v2.1)
|
|
27
|
+
- **Input Validation**: Zod schema-based type-safe validation for all tools
|
|
28
|
+
- **Error Handling**: Structured error classes (ToolError, ValidationError, PlatformError)
|
|
29
|
+
- **Security**: Command injection prevention (exec → spawn), path sanitization
|
|
30
|
+
- **Performance**: LRU cache, regex cache, memoization utilities
|
|
31
|
+
|
|
32
|
+
### Security (v2.2)
|
|
33
|
+
- **Path Traversal Prevention**: Validates file paths stay within allowed directories
|
|
34
|
+
- **SSRF Protection**: Webhook URL validation for Slack/Discord
|
|
35
|
+
- **Network Timeout**: AbortController-based request timeout (30s default)
|
|
36
|
+
- **Retry Logic**: Exponential backoff with configurable retry attempts
|
|
37
|
+
|
|
38
|
+
### Enhanced Quality (v2.3)
|
|
39
|
+
- **Structured Logging**: JSON-based logging with child loggers per tool
|
|
40
|
+
- **Configuration Validation**: Startup validation for all platform configurations
|
|
41
|
+
- **Platform Expansion**: Full support for 6 platforms (Notion, GitHub Wiki, Obsidian, Confluence, Slack, Discord)
|
|
42
|
+
- **AST Memoization**: Cached code analysis for improved performance
|
|
43
|
+
- **Test Coverage**: 81 tests with 85%+ coverage on core modules
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
### Claude Code (Recommended)
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
claude mcp add vibe-coding-mcp npx github:MUSE-CODE-SPACE/vibe-coding-mcp
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Claude Desktop
|
|
54
|
+
|
|
55
|
+
Add to `claude_desktop_config.json`:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"mcpServers": {
|
|
60
|
+
"vibe-coding-mcp": {
|
|
61
|
+
"command": "npx",
|
|
62
|
+
"args": ["github:MUSE-CODE-SPACE/vibe-coding-mcp"]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Environment Variables
|
|
69
|
+
|
|
70
|
+
```env
|
|
71
|
+
# Notion API (optional)
|
|
72
|
+
NOTION_API_KEY=your_notion_api_key_here
|
|
73
|
+
NOTION_DATABASE_ID=your_database_id_here
|
|
74
|
+
|
|
75
|
+
# GitHub (optional, for Wiki publishing)
|
|
76
|
+
GITHUB_TOKEN=your_github_token_here
|
|
77
|
+
GITHUB_REPO=owner/repo
|
|
78
|
+
|
|
79
|
+
# Confluence (optional)
|
|
80
|
+
CONFLUENCE_BASE_URL=https://your-domain.atlassian.net
|
|
81
|
+
CONFLUENCE_USERNAME=your_email@example.com
|
|
82
|
+
CONFLUENCE_API_TOKEN=your_api_token_here
|
|
83
|
+
CONFLUENCE_SPACE_KEY=YOURSPACE
|
|
84
|
+
|
|
85
|
+
# Slack (optional, webhook URL passed via tool parameter)
|
|
86
|
+
SLACK_WEBHOOK_URL=https://hooks.slack.com/services/...
|
|
87
|
+
|
|
88
|
+
# Discord (optional, webhook URL passed via tool parameter)
|
|
89
|
+
DISCORD_WEBHOOK_URL=https://discord.com/api/webhooks/...
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Demo Scenarios
|
|
93
|
+
|
|
94
|
+
### 1. Generate README and Publish to Notion
|
|
95
|
+
|
|
96
|
+
```
|
|
97
|
+
User: Collect the code we wrote today and create a README, then publish to Notion.
|
|
98
|
+
|
|
99
|
+
Claude: [Uses collect_code_context → generate_dev_document → normalize_for_platform → publish_document]
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### 2. Create Design Decision Docs for GitHub Wiki
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
User: Summarize our design decisions and publish to GitHub Wiki.
|
|
106
|
+
|
|
107
|
+
Claude: [Uses summarize_design_decisions → generate_dev_document → normalize_for_platform → publish_document]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. Daily Vibe Coding Log
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
User: Create a session log for today's work.
|
|
114
|
+
|
|
115
|
+
Claude: [Uses collect_code_context → create_session_log]
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Supported Platforms
|
|
119
|
+
|
|
120
|
+
- **Notion**: Full API integration with page creation
|
|
121
|
+
- **GitHub Wiki**: Git-based wiki updates
|
|
122
|
+
- **Obsidian**: Local vault file storage with frontmatter support
|
|
123
|
+
- **Confluence**: Atlassian Confluence page publishing
|
|
124
|
+
- **Slack**: Webhook-based message publishing
|
|
125
|
+
- **Discord**: Webhook-based message publishing
|
|
126
|
+
|
|
127
|
+
## Project Structure
|
|
128
|
+
|
|
129
|
+
```
|
|
130
|
+
src/
|
|
131
|
+
├── stdio.ts # MCP server entry point (stdio transport)
|
|
132
|
+
├── index.ts # HTTP/SSE server entry point
|
|
133
|
+
├── core/
|
|
134
|
+
│ ├── schemas.ts # Zod validation schemas
|
|
135
|
+
│ ├── errors.ts # Structured error classes
|
|
136
|
+
│ ├── cache.ts # LRU cache & memoization
|
|
137
|
+
│ ├── security.ts # Path traversal, SSRF, timeout utilities
|
|
138
|
+
│ ├── logger.ts # Structured JSON logging
|
|
139
|
+
│ └── config.ts # Platform configuration validation
|
|
140
|
+
├── tools/ # 7 MCP tools
|
|
141
|
+
├── platforms/ # Notion, GitHub Wiki, Obsidian, Confluence, Slack, Discord
|
|
142
|
+
├── types/ # TypeScript interfaces
|
|
143
|
+
└── utils/ # Markdown, AST, diagram utilities
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Development
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
# Watch mode
|
|
150
|
+
npm run dev
|
|
151
|
+
|
|
152
|
+
# Build
|
|
153
|
+
npm run build
|
|
154
|
+
|
|
155
|
+
# Start (HTTP/SSE mode)
|
|
156
|
+
npm start
|
|
157
|
+
|
|
158
|
+
# Start (stdio mode for Claude Desktop)
|
|
159
|
+
npm run stdio
|
|
160
|
+
|
|
161
|
+
# Run tests
|
|
162
|
+
npm test
|
|
163
|
+
|
|
164
|
+
# Run tests with coverage
|
|
165
|
+
npm run test:coverage
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Dependencies
|
|
169
|
+
|
|
170
|
+
| Package | Purpose |
|
|
171
|
+
|---------|---------|
|
|
172
|
+
| `@modelcontextprotocol/sdk` | MCP server SDK |
|
|
173
|
+
| `@notionhq/client` | Notion API integration |
|
|
174
|
+
| `zod` | Input validation |
|
|
175
|
+
| `typescript` | TypeScript compiler |
|
|
176
|
+
|
|
177
|
+
## License
|
|
178
|
+
|
|
179
|
+
MIT
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectCodeContext.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/collectCodeContext.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { collectCodeContext } from '../tools/collectCodeContext.js';
|
|
2
|
+
describe('collectCodeContext', () => {
|
|
3
|
+
describe('basic functionality', () => {
|
|
4
|
+
it('should create a context with provided code blocks', () => {
|
|
5
|
+
const result = collectCodeContext({
|
|
6
|
+
codeBlocks: [
|
|
7
|
+
{ language: 'typescript', code: 'const x = 1;' }
|
|
8
|
+
],
|
|
9
|
+
conversationSummary: 'Test summary'
|
|
10
|
+
});
|
|
11
|
+
expect(result.context).toBeDefined();
|
|
12
|
+
expect(result.context.codeBlocks).toHaveLength(1);
|
|
13
|
+
expect(result.context.conversationSummary).toBe('Test summary');
|
|
14
|
+
expect(result.context.sessionId).toBeDefined();
|
|
15
|
+
expect(result.context.timestamp).toBeDefined();
|
|
16
|
+
});
|
|
17
|
+
it('should extract code blocks from raw text', () => {
|
|
18
|
+
const rawText = `
|
|
19
|
+
Here is some code:
|
|
20
|
+
\`\`\`javascript
|
|
21
|
+
function hello() {
|
|
22
|
+
console.log('Hello');
|
|
23
|
+
}
|
|
24
|
+
\`\`\`
|
|
25
|
+
`;
|
|
26
|
+
const result = collectCodeContext({
|
|
27
|
+
rawText,
|
|
28
|
+
conversationSummary: 'Extracted from raw text'
|
|
29
|
+
});
|
|
30
|
+
expect(result.context.codeBlocks).toHaveLength(1);
|
|
31
|
+
expect(result.context.codeBlocks[0].language).toBe('javascript');
|
|
32
|
+
});
|
|
33
|
+
});
|
|
34
|
+
describe('language detection', () => {
|
|
35
|
+
it('should auto-detect TypeScript', () => {
|
|
36
|
+
const result = collectCodeContext({
|
|
37
|
+
codeBlocks: [
|
|
38
|
+
{ language: '', code: 'interface User { name: string; age: number; }' }
|
|
39
|
+
],
|
|
40
|
+
conversationSummary: 'TypeScript detection',
|
|
41
|
+
autoDetectLanguage: true
|
|
42
|
+
});
|
|
43
|
+
expect(result.context.codeBlocks[0].language).toBe('typescript');
|
|
44
|
+
});
|
|
45
|
+
it('should auto-detect Python', () => {
|
|
46
|
+
const result = collectCodeContext({
|
|
47
|
+
codeBlocks: [
|
|
48
|
+
{ language: '', code: 'def hello():\n print("Hello")' }
|
|
49
|
+
],
|
|
50
|
+
conversationSummary: 'Python detection',
|
|
51
|
+
autoDetectLanguage: true
|
|
52
|
+
});
|
|
53
|
+
expect(result.context.codeBlocks[0].language).toBe('python');
|
|
54
|
+
});
|
|
55
|
+
it('should auto-detect SQL', () => {
|
|
56
|
+
const result = collectCodeContext({
|
|
57
|
+
codeBlocks: [
|
|
58
|
+
{ language: '', code: 'SELECT * FROM users WHERE id = 1' }
|
|
59
|
+
],
|
|
60
|
+
conversationSummary: 'SQL detection'
|
|
61
|
+
});
|
|
62
|
+
expect(result.context.codeBlocks[0].language).toBe('sql');
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
describe('duplicate removal', () => {
|
|
66
|
+
it('should remove duplicate code blocks', () => {
|
|
67
|
+
const result = collectCodeContext({
|
|
68
|
+
codeBlocks: [
|
|
69
|
+
{ language: 'javascript', code: 'const x = 1;' },
|
|
70
|
+
{ language: 'javascript', code: 'const x = 1;' },
|
|
71
|
+
{ language: 'javascript', code: 'const y = 2;' }
|
|
72
|
+
],
|
|
73
|
+
conversationSummary: 'Duplicate test',
|
|
74
|
+
removeDuplicates: true
|
|
75
|
+
});
|
|
76
|
+
expect(result.context.codeBlocks).toHaveLength(2);
|
|
77
|
+
expect(result.warnings).toContain('Removed 1 duplicate code block(s)');
|
|
78
|
+
});
|
|
79
|
+
it('should keep duplicates when removeDuplicates is false', () => {
|
|
80
|
+
const result = collectCodeContext({
|
|
81
|
+
codeBlocks: [
|
|
82
|
+
{ language: 'javascript', code: 'const x = 1;' },
|
|
83
|
+
{ language: 'javascript', code: 'const x = 1;' }
|
|
84
|
+
],
|
|
85
|
+
conversationSummary: 'Keep duplicates',
|
|
86
|
+
removeDuplicates: false
|
|
87
|
+
});
|
|
88
|
+
expect(result.context.codeBlocks).toHaveLength(2);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe('statistics', () => {
|
|
92
|
+
it('should include stats when includeStats is true', () => {
|
|
93
|
+
const result = collectCodeContext({
|
|
94
|
+
codeBlocks: [
|
|
95
|
+
{ language: 'javascript', code: 'const x = 1;\nconst y = 2;' },
|
|
96
|
+
{ language: 'python', code: 'x = 1' }
|
|
97
|
+
],
|
|
98
|
+
conversationSummary: 'Stats test',
|
|
99
|
+
includeStats: true
|
|
100
|
+
});
|
|
101
|
+
expect(result.stats).toBeDefined();
|
|
102
|
+
expect(result.stats?.totalBlocks).toBe(2);
|
|
103
|
+
expect(result.stats?.languageBreakdown).toEqual({
|
|
104
|
+
javascript: 1,
|
|
105
|
+
python: 1
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
describe('tags', () => {
|
|
110
|
+
it('should auto-add language tags', () => {
|
|
111
|
+
const result = collectCodeContext({
|
|
112
|
+
codeBlocks: [
|
|
113
|
+
{ language: 'typescript', code: 'const x: number = 1;' }
|
|
114
|
+
],
|
|
115
|
+
conversationSummary: 'Tag test',
|
|
116
|
+
tags: ['custom-tag']
|
|
117
|
+
});
|
|
118
|
+
expect(result.context.tags).toContain('custom-tag');
|
|
119
|
+
expect(result.context.tags).toContain('typescript');
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
describe('validation', () => {
|
|
123
|
+
it('should warn on empty summary', () => {
|
|
124
|
+
const result = collectCodeContext({
|
|
125
|
+
codeBlocks: [{ language: 'js', code: 'x' }],
|
|
126
|
+
conversationSummary: ''
|
|
127
|
+
});
|
|
128
|
+
expect(result.warnings).toContain('Conversation summary is empty');
|
|
129
|
+
});
|
|
130
|
+
it('should warn on empty code block', () => {
|
|
131
|
+
const result = collectCodeContext({
|
|
132
|
+
codeBlocks: [{ language: 'js', code: '' }],
|
|
133
|
+
conversationSummary: 'Test'
|
|
134
|
+
});
|
|
135
|
+
expect(result.warnings).toContain('Code block 1 is empty');
|
|
136
|
+
});
|
|
137
|
+
});
|
|
138
|
+
});
|
|
139
|
+
//# sourceMappingURL=collectCodeContext.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collectCodeContext.test.js","sourceRoot":"","sources":["../../src/__tests__/collectCodeContext.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,mDAAmD,EAAE,GAAG,EAAE;YAC3D,MAAM,MAAM,GAAG,kBAAkB,CAAC;gBAChC,UAAU,EAAE;oBACV,EAAE,QAAQ,EAAE,YAAY,EAAE,IAAI,EAAE,cAAc,EAAE;iBACjD;gBACD,mBAAmB,EAAE,cAAc;aACpC,CAAC,CAAC;YAEH,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;YACrC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;YAClD,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,IAAI,C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|
1
|
+
{"version":3,"file":"createSessionLog.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/createSessionLog.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { createSessionLog } from '../tools/createSessionLog.js';
|
|
2
|
+
describe('createSessionLog', () => {
|
|
3
|
+
describe('basic functionality', () => {
|
|
4
|
+
it('should create a session log with required fields', async () => {
|
|
5
|
+
const result = await createSessionLog({
|
|
6
|
+
title: 'Test Session',
|
|
7
|
+
summary: 'This is a test summary'
|
|
8
|
+
});
|
|
9
|
+
expect(result.sessionLog).toBeDefined();
|
|
10
|
+
expect(result.sessionLog.sessionId).toBeDefined();
|
|
11
|
+
expect(result.sessionLog.date).toBeDefined();
|
|
12
|
+
expect(result.sessionLog.title).toBe('Test Session');
|
|
13
|
+
expect(result.sessionLog.summary).toBe('This is a test summary');
|
|
14
|
+
expect(result.content).toBeDefined();
|
|
15
|
+
});
|
|
16
|
+
it('should include duration when provided', async () => {
|
|
17
|
+
const result = await createSessionLog({
|
|
18
|
+
title: 'Test Session',
|
|
19
|
+
summary: 'Test summary',
|
|
20
|
+
duration: 3600
|
|
21
|
+
});
|
|
22
|
+
expect(result.sessionLog.duration).toBe(3600);
|
|
23
|
+
expect(result.content).toContain('60 minutes');
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
describe('log formats', () => {
|
|
27
|
+
it('should create markdown log by default', async () => {
|
|
28
|
+
const result = await createSessionLog({
|
|
29
|
+
title: 'Test',
|
|
30
|
+
summary: 'Summary'
|
|
31
|
+
});
|
|
32
|
+
expect(result.content).toContain('#');
|
|
33
|
+
expect(result.content).toContain('Test');
|
|
34
|
+
});
|
|
35
|
+
it('should create JSON log when requested', async () => {
|
|
36
|
+
const result = await createSessionLog({
|
|
37
|
+
title: 'Test',
|
|
38
|
+
summary: 'Summary',
|
|
39
|
+
options: {
|
|
40
|
+
logType: 'session',
|
|
41
|
+
format: 'json'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
expect(() => JSON.parse(result.content)).not.toThrow();
|
|
45
|
+
const parsed = JSON.parse(result.content);
|
|
46
|
+
expect(parsed.title).toBe('Test');
|
|
47
|
+
});
|
|
48
|
+
it('should create daily log type', async () => {
|
|
49
|
+
const result = await createSessionLog({
|
|
50
|
+
title: 'Daily',
|
|
51
|
+
summary: 'Daily summary',
|
|
52
|
+
options: {
|
|
53
|
+
logType: 'daily',
|
|
54
|
+
format: 'markdown'
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
expect(result.content).toContain('Daily Vibe Coding Log');
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
describe('code contexts', () => {
|
|
61
|
+
it('should include code contexts in log', async () => {
|
|
62
|
+
const result = await createSessionLog({
|
|
63
|
+
title: 'Test',
|
|
64
|
+
summary: 'Summary',
|
|
65
|
+
codeContexts: [
|
|
66
|
+
{
|
|
67
|
+
sessionId: '1',
|
|
68
|
+
timestamp: new Date().toISOString(),
|
|
69
|
+
codeBlocks: [{ language: 'typescript', code: 'const x = 1;' }],
|
|
70
|
+
conversationSummary: 'Created a variable'
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
});
|
|
74
|
+
expect(result.content).toContain('Code Contexts');
|
|
75
|
+
expect(result.content).toContain('const x = 1;');
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
describe('design decisions', () => {
|
|
79
|
+
it('should include design decisions in log', async () => {
|
|
80
|
+
const result = await createSessionLog({
|
|
81
|
+
title: 'Test',
|
|
82
|
+
summary: 'Summary',
|
|
83
|
+
designDecisions: [
|
|
84
|
+
{
|
|
85
|
+
id: '1',
|
|
86
|
+
title: 'Use TypeScript',
|
|
87
|
+
description: 'Decided to use TypeScript',
|
|
88
|
+
rationale: 'Type safety',
|
|
89
|
+
alternatives: ['JavaScript'],
|
|
90
|
+
timestamp: new Date().toISOString(),
|
|
91
|
+
category: 'implementation'
|
|
92
|
+
}
|
|
93
|
+
]
|
|
94
|
+
});
|
|
95
|
+
expect(result.content).toContain('Design Decisions');
|
|
96
|
+
expect(result.content).toContain('Use TypeScript');
|
|
97
|
+
});
|
|
98
|
+
});
|
|
99
|
+
describe('tags', () => {
|
|
100
|
+
it('should include tags in log', async () => {
|
|
101
|
+
const result = await createSessionLog({
|
|
102
|
+
title: 'Test',
|
|
103
|
+
summary: 'Summary',
|
|
104
|
+
tags: ['react', 'typescript', 'api']
|
|
105
|
+
});
|
|
106
|
+
expect(result.sessionLog.tags).toContain('react');
|
|
107
|
+
expect(result.content).toContain('#react');
|
|
108
|
+
expect(result.content).toContain('#typescript');
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
describe('edge cases', () => {
|
|
112
|
+
it('should handle empty code contexts array', async () => {
|
|
113
|
+
const result = await createSessionLog({
|
|
114
|
+
title: 'Test',
|
|
115
|
+
summary: 'Summary',
|
|
116
|
+
codeContexts: []
|
|
117
|
+
});
|
|
118
|
+
expect(result.content).toBeDefined();
|
|
119
|
+
});
|
|
120
|
+
it('should handle empty design decisions array', async () => {
|
|
121
|
+
const result = await createSessionLog({
|
|
122
|
+
title: 'Test',
|
|
123
|
+
summary: 'Summary',
|
|
124
|
+
designDecisions: []
|
|
125
|
+
});
|
|
126
|
+
expect(result.content).toBeDefined();
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
});
|
|
130
|
+
//# sourceMappingURL=createSessionLog.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createSessionLog.test.js","sourceRoot":"","sources":["../../src/__tests__/createSessionLog.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,QAAQ,CAAC,qBAAqB,EAAE,GAAG,EAAE;QACnC,EAAE,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;YAChE,MAAM,MAAM,GAAG,MAAM,gBAAgB,CAAC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":[],"mappings":""}
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
import { generateDevDocument } from '../tools/generateDevDocument.js';
|
|
2
|
+
describe('generateDevDocument', () => {
|
|
3
|
+
describe('README generation', () => {
|
|
4
|
+
it('should generate a basic README', () => {
|
|
5
|
+
const result = generateDevDocument({
|
|
6
|
+
documentType: 'README',
|
|
7
|
+
title: 'Test Project',
|
|
8
|
+
description: 'A test project description'
|
|
9
|
+
});
|
|
10
|
+
expect(result.document).toContain('# Test Project');
|
|
11
|
+
expect(result.document).toContain('A test project description');
|
|
12
|
+
expect(result.documentType).toBe('README');
|
|
13
|
+
expect(result.generatedAt).toBeDefined();
|
|
14
|
+
expect(result.wordCount).toBeGreaterThan(0);
|
|
15
|
+
});
|
|
16
|
+
it('should include table of contents when requested', () => {
|
|
17
|
+
const result = generateDevDocument({
|
|
18
|
+
documentType: 'README',
|
|
19
|
+
title: 'Test',
|
|
20
|
+
includeTableOfContents: true
|
|
21
|
+
});
|
|
22
|
+
expect(result.document).toContain('## Table of Contents');
|
|
23
|
+
});
|
|
24
|
+
it('should include features list', () => {
|
|
25
|
+
const result = generateDevDocument({
|
|
26
|
+
documentType: 'README',
|
|
27
|
+
title: 'Test',
|
|
28
|
+
features: ['Feature 1', 'Feature 2', 'Feature 3']
|
|
29
|
+
});
|
|
30
|
+
expect(result.document).toContain('## Features');
|
|
31
|
+
expect(result.document).toContain('- Feature 1');
|
|
32
|
+
expect(result.document).toContain('- Feature 2');
|
|
33
|
+
expect(result.document).toContain('- Feature 3');
|
|
34
|
+
});
|
|
35
|
+
it('should include custom installation steps', () => {
|
|
36
|
+
const result = generateDevDocument({
|
|
37
|
+
documentType: 'README',
|
|
38
|
+
title: 'Test',
|
|
39
|
+
installation: {
|
|
40
|
+
requirements: ['Node.js 18+', 'npm'],
|
|
41
|
+
steps: ['npm install', 'npm run build']
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
expect(result.document).toContain('npm install');
|
|
45
|
+
expect(result.document).toContain('npm run build');
|
|
46
|
+
expect(result.document).toContain('Node.js 18+');
|
|
47
|
+
});
|
|
48
|
+
it('should include badges', () => {
|
|
49
|
+
const result = generateDevDocument({
|
|
50
|
+
documentType: 'README',
|
|
51
|
+
title: 'Test',
|
|
52
|
+
badges: [
|
|
53
|
+
{ label: 'version', message: '1.0.0', color: 'blue' }
|
|
54
|
+
]
|
|
55
|
+
});
|
|
56
|
+
expect(result.document).toContain('img.shields.io');
|
|
57
|
+
});
|
|
58
|
+
it('should include API reference', () => {
|
|
59
|
+
const result = generateDevDocument({
|
|
60
|
+
documentType: 'README',
|
|
61
|
+
title: 'Test',
|
|
62
|
+
apiReference: [
|
|
63
|
+
{
|
|
64
|
+
name: 'myFunction',
|
|
65
|
+
description: 'Does something',
|
|
66
|
+
params: ['arg1: string', 'arg2: number'],
|
|
67
|
+
returns: 'boolean'
|
|
68
|
+
}
|
|
69
|
+
]
|
|
70
|
+
});
|
|
71
|
+
expect(result.document).toContain('`myFunction`');
|
|
72
|
+
expect(result.document).toContain('Does something');
|
|
73
|
+
expect(result.document).toContain('arg1: string');
|
|
74
|
+
expect(result.document).toContain('**Returns:** boolean');
|
|
75
|
+
});
|
|
76
|
+
it('should include FAQ section', () => {
|
|
77
|
+
const result = generateDevDocument({
|
|
78
|
+
documentType: 'README',
|
|
79
|
+
title: 'Test',
|
|
80
|
+
faq: [
|
|
81
|
+
{ question: 'How does it work?', answer: 'It works well.' }
|
|
82
|
+
]
|
|
83
|
+
});
|
|
84
|
+
expect(result.document).toContain('## FAQ');
|
|
85
|
+
expect(result.document).toContain('How does it work?');
|
|
86
|
+
expect(result.document).toContain('It works well.');
|
|
87
|
+
});
|
|
88
|
+
});
|
|
89
|
+
describe('Korean language support', () => {
|
|
90
|
+
it('should use Korean headers when language is ko', () => {
|
|
91
|
+
const result = generateDevDocument({
|
|
92
|
+
documentType: 'README',
|
|
93
|
+
title: '테스트 프로젝트',
|
|
94
|
+
language: 'ko',
|
|
95
|
+
features: ['기능 1']
|
|
96
|
+
});
|
|
97
|
+
expect(result.document).toContain('## 개요');
|
|
98
|
+
expect(result.document).toContain('## 기능');
|
|
99
|
+
expect(result.document).toContain('## 설치');
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
describe('DESIGN document', () => {
|
|
103
|
+
it('should generate a design document with metadata table', () => {
|
|
104
|
+
const result = generateDevDocument({
|
|
105
|
+
documentType: 'DESIGN',
|
|
106
|
+
title: 'System Design',
|
|
107
|
+
author: 'Test Author',
|
|
108
|
+
version: '1.0'
|
|
109
|
+
});
|
|
110
|
+
expect(result.document).toContain('# System Design');
|
|
111
|
+
expect(result.document).toContain('**Author**');
|
|
112
|
+
expect(result.document).toContain('Test Author');
|
|
113
|
+
expect(result.document).toContain('**Version**');
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
describe('TUTORIAL document', () => {
|
|
117
|
+
it('should generate a tutorial with steps', () => {
|
|
118
|
+
const result = generateDevDocument({
|
|
119
|
+
documentType: 'TUTORIAL',
|
|
120
|
+
title: 'Getting Started',
|
|
121
|
+
codeContexts: [
|
|
122
|
+
{
|
|
123
|
+
sessionId: '1',
|
|
124
|
+
timestamp: new Date().toISOString(),
|
|
125
|
+
codeBlocks: [{ language: 'bash', code: 'npm install' }],
|
|
126
|
+
conversationSummary: 'First, install dependencies',
|
|
127
|
+
tags: ['setup']
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
});
|
|
131
|
+
expect(result.document).toContain('# Getting Started');
|
|
132
|
+
expect(result.document).toContain('Step 1');
|
|
133
|
+
expect(result.document).toContain('npm install');
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
describe('CHANGELOG document', () => {
|
|
137
|
+
it('should generate a changelog', () => {
|
|
138
|
+
const result = generateDevDocument({
|
|
139
|
+
documentType: 'CHANGELOG',
|
|
140
|
+
version: '1.0.0',
|
|
141
|
+
codeContexts: [
|
|
142
|
+
{
|
|
143
|
+
sessionId: '1',
|
|
144
|
+
timestamp: new Date().toISOString(),
|
|
145
|
+
codeBlocks: [],
|
|
146
|
+
conversationSummary: 'Added new feature X'
|
|
147
|
+
}
|
|
148
|
+
]
|
|
149
|
+
});
|
|
150
|
+
expect(result.document).toContain('# Changelog');
|
|
151
|
+
expect(result.document).toContain('[1.0.0]');
|
|
152
|
+
expect(result.document).toContain('Added new feature X');
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
describe('output metadata', () => {
|
|
156
|
+
it('should include sections list', () => {
|
|
157
|
+
const result = generateDevDocument({
|
|
158
|
+
documentType: 'README',
|
|
159
|
+
title: 'Test'
|
|
160
|
+
});
|
|
161
|
+
expect(result.sections).toBeDefined();
|
|
162
|
+
expect(result.sections.length).toBeGreaterThan(0);
|
|
163
|
+
});
|
|
164
|
+
it('should calculate word count', () => {
|
|
165
|
+
const result = generateDevDocument({
|
|
166
|
+
documentType: 'README',
|
|
167
|
+
title: 'Test',
|
|
168
|
+
description: 'This is a description with multiple words.'
|
|
169
|
+
});
|
|
170
|
+
expect(result.wordCount).toBeGreaterThan(10);
|
|
171
|
+
});
|
|
172
|
+
});
|
|
173
|
+
});
|
|
174
|
+
//# sourceMappingURL=generateDevDocument.test.js.map
|