swift-skills-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.
- package/LICENSE +21 -0
- package/README.md +410 -0
- package/build/cli/auth.d.ts +3 -0
- package/build/cli/auth.d.ts.map +1 -0
- package/build/cli/auth.js +44 -0
- package/build/cli/auth.js.map +1 -0
- package/build/cli/setup.d.ts +2 -0
- package/build/cli/setup.d.ts.map +1 -0
- package/build/cli/setup.js +150 -0
- package/build/cli/setup.js.map +1 -0
- package/build/cli/source-manager.d.ts +3 -0
- package/build/cli/source-manager.d.ts.map +1 -0
- package/build/cli/source-manager.js +117 -0
- package/build/cli/source-manager.js.map +1 -0
- package/build/config/creators.d.ts +11 -0
- package/build/config/creators.d.ts.map +1 -0
- package/build/config/creators.js +32 -0
- package/build/config/creators.js.map +1 -0
- package/build/config/sources.d.ts +91 -0
- package/build/config/sources.d.ts.map +1 -0
- package/build/config/sources.js +231 -0
- package/build/config/sources.js.map +1 -0
- package/build/config/sources.test.d.ts +2 -0
- package/build/config/sources.test.d.ts.map +1 -0
- package/build/config/sources.test.js +199 -0
- package/build/config/sources.test.js.map +1 -0
- package/build/config/swift-keywords.d.ts +29 -0
- package/build/config/swift-keywords.d.ts.map +1 -0
- package/build/config/swift-keywords.js +77 -0
- package/build/config/swift-keywords.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +181 -0
- package/build/index.js.map +1 -0
- package/build/integration/cache-behavior.test.d.ts +2 -0
- package/build/integration/cache-behavior.test.d.ts.map +1 -0
- package/build/integration/cache-behavior.test.js +521 -0
- package/build/integration/cache-behavior.test.js.map +1 -0
- package/build/integration/mcp-client.test.d.ts +2 -0
- package/build/integration/mcp-client.test.d.ts.map +1 -0
- package/build/integration/mcp-client.test.js +82 -0
- package/build/integration/mcp-client.test.js.map +1 -0
- package/build/integration/response-quality.test.d.ts +2 -0
- package/build/integration/response-quality.test.d.ts.map +1 -0
- package/build/integration/response-quality.test.js +230 -0
- package/build/integration/response-quality.test.js.map +1 -0
- package/build/integration/test-client.d.ts +25 -0
- package/build/integration/test-client.d.ts.map +1 -0
- package/build/integration/test-client.js +93 -0
- package/build/integration/test-client.js.map +1 -0
- package/build/sources/free/nilcoalescing.d.ts +8 -0
- package/build/sources/free/nilcoalescing.d.ts.map +1 -0
- package/build/sources/free/nilcoalescing.js +26 -0
- package/build/sources/free/nilcoalescing.js.map +1 -0
- package/build/sources/free/nilcoalescing.test.d.ts +2 -0
- package/build/sources/free/nilcoalescing.test.d.ts.map +1 -0
- package/build/sources/free/nilcoalescing.test.js +63 -0
- package/build/sources/free/nilcoalescing.test.js.map +1 -0
- package/build/sources/free/pointfree.d.ts +15 -0
- package/build/sources/free/pointfree.d.ts.map +1 -0
- package/build/sources/free/pointfree.js +175 -0
- package/build/sources/free/pointfree.js.map +1 -0
- package/build/sources/free/pointfree.test.d.ts +2 -0
- package/build/sources/free/pointfree.test.d.ts.map +1 -0
- package/build/sources/free/pointfree.test.js +86 -0
- package/build/sources/free/pointfree.test.js.map +1 -0
- package/build/sources/free/rssPatternSource.d.ts +42 -0
- package/build/sources/free/rssPatternSource.d.ts.map +1 -0
- package/build/sources/free/rssPatternSource.js +109 -0
- package/build/sources/free/rssPatternSource.js.map +1 -0
- package/build/sources/free/rssPatternSource.test.d.ts +2 -0
- package/build/sources/free/rssPatternSource.test.d.ts.map +1 -0
- package/build/sources/free/rssPatternSource.test.js +89 -0
- package/build/sources/free/rssPatternSource.test.js.map +1 -0
- package/build/sources/free/sundell.d.ts +8 -0
- package/build/sources/free/sundell.d.ts.map +1 -0
- package/build/sources/free/sundell.js +17 -0
- package/build/sources/free/sundell.js.map +1 -0
- package/build/sources/free/sundell.test.d.ts +2 -0
- package/build/sources/free/sundell.test.d.ts.map +1 -0
- package/build/sources/free/sundell.test.js +63 -0
- package/build/sources/free/sundell.test.js.map +1 -0
- package/build/sources/free/vanderlee.d.ts +8 -0
- package/build/sources/free/vanderlee.d.ts.map +1 -0
- package/build/sources/free/vanderlee.js +63 -0
- package/build/sources/free/vanderlee.js.map +1 -0
- package/build/sources/free/vanderlee.test.d.ts +2 -0
- package/build/sources/free/vanderlee.test.d.ts.map +1 -0
- package/build/sources/free/vanderlee.test.js +77 -0
- package/build/sources/free/vanderlee.test.js.map +1 -0
- package/build/sources/premium/patreon-dl.d.ts +45 -0
- package/build/sources/premium/patreon-dl.d.ts.map +1 -0
- package/build/sources/premium/patreon-dl.js +189 -0
- package/build/sources/premium/patreon-dl.js.map +1 -0
- package/build/sources/premium/patreon-fetch.d.ts +3 -0
- package/build/sources/premium/patreon-fetch.d.ts.map +1 -0
- package/build/sources/premium/patreon-fetch.js +18 -0
- package/build/sources/premium/patreon-fetch.js.map +1 -0
- package/build/sources/premium/patreon-oauth.d.ts +24 -0
- package/build/sources/premium/patreon-oauth.d.ts.map +1 -0
- package/build/sources/premium/patreon-oauth.js +208 -0
- package/build/sources/premium/patreon-oauth.js.map +1 -0
- package/build/sources/premium/patreon-zip.d.ts +17 -0
- package/build/sources/premium/patreon-zip.d.ts.map +1 -0
- package/build/sources/premium/patreon-zip.js +127 -0
- package/build/sources/premium/patreon-zip.js.map +1 -0
- package/build/sources/premium/patreon.d.ts +48 -0
- package/build/sources/premium/patreon.d.ts.map +1 -0
- package/build/sources/premium/patreon.js +221 -0
- package/build/sources/premium/patreon.js.map +1 -0
- package/build/sources/premium/youtube.d.ts +14 -0
- package/build/sources/premium/youtube.d.ts.map +1 -0
- package/build/sources/premium/youtube.js +92 -0
- package/build/sources/premium/youtube.js.map +1 -0
- package/build/tools/extract-cookie.d.ts +2 -0
- package/build/tools/extract-cookie.d.ts.map +1 -0
- package/build/tools/extract-cookie.js +40 -0
- package/build/tools/extract-cookie.js.map +1 -0
- package/build/tools/handlers/enableSource.d.ts +3 -0
- package/build/tools/handlers/enableSource.d.ts.map +1 -0
- package/build/tools/handlers/enableSource.js +25 -0
- package/build/tools/handlers/enableSource.js.map +1 -0
- package/build/tools/handlers/getPatreonPatterns.d.ts +3 -0
- package/build/tools/handlers/getPatreonPatterns.d.ts.map +1 -0
- package/build/tools/handlers/getPatreonPatterns.js +43 -0
- package/build/tools/handlers/getPatreonPatterns.js.map +1 -0
- package/build/tools/handlers/getSwiftPattern.d.ts +3 -0
- package/build/tools/handlers/getSwiftPattern.d.ts.map +1 -0
- package/build/tools/handlers/getSwiftPattern.js +72 -0
- package/build/tools/handlers/getSwiftPattern.js.map +1 -0
- package/build/tools/handlers/handlers.test.d.ts +2 -0
- package/build/tools/handlers/handlers.test.d.ts.map +1 -0
- package/build/tools/handlers/handlers.test.js +359 -0
- package/build/tools/handlers/handlers.test.js.map +1 -0
- package/build/tools/handlers/listContentSources.d.ts +3 -0
- package/build/tools/handlers/listContentSources.d.ts.map +1 -0
- package/build/tools/handlers/listContentSources.js +34 -0
- package/build/tools/handlers/listContentSources.js.map +1 -0
- package/build/tools/handlers/searchSwiftContent.d.ts +3 -0
- package/build/tools/handlers/searchSwiftContent.d.ts.map +1 -0
- package/build/tools/handlers/searchSwiftContent.js +121 -0
- package/build/tools/handlers/searchSwiftContent.js.map +1 -0
- package/build/tools/handlers/setupPatreon.d.ts +3 -0
- package/build/tools/handlers/setupPatreon.d.ts.map +1 -0
- package/build/tools/handlers/setupPatreon.js +40 -0
- package/build/tools/handlers/setupPatreon.js.map +1 -0
- package/build/tools/index.d.ts +3 -0
- package/build/tools/index.d.ts.map +1 -0
- package/build/tools/index.js +18 -0
- package/build/tools/index.js.map +1 -0
- package/build/tools/registry.d.ts +14 -0
- package/build/tools/registry.d.ts.map +1 -0
- package/build/tools/registry.js +21 -0
- package/build/tools/registry.js.map +1 -0
- package/build/tools/registry.test.d.ts +2 -0
- package/build/tools/registry.test.d.ts.map +1 -0
- package/build/tools/registry.test.js +54 -0
- package/build/tools/registry.test.js.map +1 -0
- package/build/tools/types.d.ts +67 -0
- package/build/tools/types.d.ts.map +1 -0
- package/build/tools/types.js +3 -0
- package/build/tools/types.js.map +1 -0
- package/build/utils/cache.d.ts +20 -0
- package/build/utils/cache.d.ts.map +1 -0
- package/build/utils/cache.js +186 -0
- package/build/utils/cache.js.map +1 -0
- package/build/utils/concurrency.d.ts +13 -0
- package/build/utils/concurrency.d.ts.map +1 -0
- package/build/utils/concurrency.js +33 -0
- package/build/utils/concurrency.js.map +1 -0
- package/build/utils/errors.d.ts +19 -0
- package/build/utils/errors.d.ts.map +1 -0
- package/build/utils/errors.js +35 -0
- package/build/utils/errors.js.map +1 -0
- package/build/utils/fetch.d.ts +6 -0
- package/build/utils/fetch.d.ts.map +1 -0
- package/build/utils/fetch.js +6 -0
- package/build/utils/fetch.js.map +1 -0
- package/build/utils/http.d.ts +21 -0
- package/build/utils/http.d.ts.map +1 -0
- package/build/utils/http.js +53 -0
- package/build/utils/http.js.map +1 -0
- package/build/utils/intent-cache.d.ts +94 -0
- package/build/utils/intent-cache.d.ts.map +1 -0
- package/build/utils/intent-cache.js +164 -0
- package/build/utils/intent-cache.js.map +1 -0
- package/build/utils/intent-cache.test.d.ts +2 -0
- package/build/utils/intent-cache.test.d.ts.map +1 -0
- package/build/utils/intent-cache.test.js +290 -0
- package/build/utils/intent-cache.test.js.map +1 -0
- package/build/utils/logger.d.ts +4 -0
- package/build/utils/logger.d.ts.map +1 -0
- package/build/utils/logger.js +9 -0
- package/build/utils/logger.js.map +1 -0
- package/build/utils/paths.d.ts +27 -0
- package/build/utils/paths.d.ts.map +1 -0
- package/build/utils/paths.js +43 -0
- package/build/utils/paths.js.map +1 -0
- package/build/utils/pattern-formatter.d.ts +40 -0
- package/build/utils/pattern-formatter.d.ts.map +1 -0
- package/build/utils/pattern-formatter.js +124 -0
- package/build/utils/pattern-formatter.js.map +1 -0
- package/build/utils/response-helpers.d.ts +17 -0
- package/build/utils/response-helpers.d.ts.map +1 -0
- package/build/utils/response-helpers.js +34 -0
- package/build/utils/response-helpers.js.map +1 -0
- package/build/utils/search-terms.d.ts +17 -0
- package/build/utils/search-terms.d.ts.map +1 -0
- package/build/utils/search-terms.js +71 -0
- package/build/utils/search-terms.js.map +1 -0
- package/build/utils/search-terms.test.d.ts +2 -0
- package/build/utils/search-terms.test.d.ts.map +1 -0
- package/build/utils/search-terms.test.js +107 -0
- package/build/utils/search-terms.test.js.map +1 -0
- package/build/utils/search.d.ts +48 -0
- package/build/utils/search.d.ts.map +1 -0
- package/build/utils/search.js +158 -0
- package/build/utils/search.js.map +1 -0
- package/build/utils/search.test.d.ts +2 -0
- package/build/utils/search.test.d.ts.map +1 -0
- package/build/utils/search.test.js +199 -0
- package/build/utils/search.test.js.map +1 -0
- package/build/utils/semantic-recall.d.ts +38 -0
- package/build/utils/semantic-recall.d.ts.map +1 -0
- package/build/utils/semantic-recall.js +134 -0
- package/build/utils/semantic-recall.js.map +1 -0
- package/build/utils/semantic-recall.test.d.ts +2 -0
- package/build/utils/semantic-recall.test.d.ts.map +1 -0
- package/build/utils/semantic-recall.test.js +326 -0
- package/build/utils/semantic-recall.test.js.map +1 -0
- package/build/utils/source-registry.d.ts +45 -0
- package/build/utils/source-registry.d.ts.map +1 -0
- package/build/utils/source-registry.js +113 -0
- package/build/utils/source-registry.js.map +1 -0
- package/build/utils/source-registry.test.d.ts +2 -0
- package/build/utils/source-registry.test.d.ts.map +1 -0
- package/build/utils/source-registry.test.js +206 -0
- package/build/utils/source-registry.test.js.map +1 -0
- package/build/utils/swift-analysis.d.ts +61 -0
- package/build/utils/swift-analysis.d.ts.map +1 -0
- package/build/utils/swift-analysis.js +339 -0
- package/build/utils/swift-analysis.js.map +1 -0
- package/build/utils/swift-analysis.test.d.ts +2 -0
- package/build/utils/swift-analysis.test.d.ts.map +1 -0
- package/build/utils/swift-analysis.test.js +473 -0
- package/build/utils/swift-analysis.test.js.map +1 -0
- package/package.json +85 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lasha Efremidze
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,410 @@
|
|
|
1
|
+
# swift-patterns-mcp
|
|
2
|
+
|
|
3
|
+
### 🎯 Curated Swift/SwiftUI Patterns from Top iOS Developers
|
|
4
|
+
|
|
5
|
+
**An MCP server providing curated Swift and SwiftUI best practices from leading iOS developers, including patterns and real-world code examples from Swift by Sundell, SwiftLee, and other trusted sources.**
|
|
6
|
+
|
|
7
|
+
[Quick Start](#-quick-start) • [Features](#-features) • [Usage](#-usage-examples) • [Contributing](#-contributing)
|
|
8
|
+
|
|
9
|
+
[](https://lobehub.com/mcp/efremidze-swift-patterns-mcp)
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Why swift-patterns-mcp?
|
|
14
|
+
|
|
15
|
+
- ✅ **Curated Content**: Only high-quality patterns from trusted iOS developers
|
|
16
|
+
- ✅ **Always Up-to-Date**: Automatically fetches the latest articles and patterns
|
|
17
|
+
- ✅ **MCP Native**: Works seamlessly with Claude, Cursor, Windsurf, and other MCP-compatible tools
|
|
18
|
+
- ✅ **Privacy First**: Free sources require no authentication
|
|
19
|
+
- ✅ **Extensible**: Optional Patreon integration for premium content
|
|
20
|
+
|
|
21
|
+
## 🌟 Features
|
|
22
|
+
|
|
23
|
+
### Core Features
|
|
24
|
+
|
|
25
|
+
- 🎓 **Expert Knowledge Base**: Provides patterns from Swift by Sundell, Antoine van der Lee, Nil Coalescing, and more
|
|
26
|
+
- 🔍 **Intelligent Search**: Query by topic, pattern, or specific iOS concepts
|
|
27
|
+
- 🎯 **Quality Filtering**: Configurable quality thresholds ensure only the best content
|
|
28
|
+
- 📚 **Multiple Sources**: Aggregates knowledge from various trusted educators
|
|
29
|
+
- 🔄 **Auto-Updates**: Content automatically refreshes from RSS feeds
|
|
30
|
+
- ⚡ **Fast Performance**: Efficient caching and indexed search
|
|
31
|
+
|
|
32
|
+
### Built-in Sources (Free)
|
|
33
|
+
- ✅ **Swift by Sundell** - Articles, patterns, and best practices
|
|
34
|
+
- ✅ **Antoine van der Lee** - Tutorials, tips, and deep dives
|
|
35
|
+
- ✅ **Nil Coalescing** - SwiftUI patterns and practical Swift tips
|
|
36
|
+
- ✅ **Point-Free** - Open source libraries and patterns
|
|
37
|
+
|
|
38
|
+
### Premium Sources (Optional)
|
|
39
|
+
- 🔐 **Patreon Integration** - Access premium content from creators you support
|
|
40
|
+
|
|
41
|
+
## 📋 Prerequisites
|
|
42
|
+
|
|
43
|
+
- **Node.js**: Version 18.0.0 or higher
|
|
44
|
+
- **MCP-Compatible AI Assistant**: Claude Desktop, Cursor, Windsurf, or VS Code with Copilot
|
|
45
|
+
|
|
46
|
+
## 🚀 Quick Start
|
|
47
|
+
|
|
48
|
+
### Install
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npm install -g swift-patterns-mcp
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### Configure Your AI Assistant
|
|
55
|
+
|
|
56
|
+
#### Cursor
|
|
57
|
+
|
|
58
|
+
[](https://cursor.com/en-US/install-mcp?name=swift-patterns&config=eyJjb21tYW5kIjoibnB4IC15IHN3aWZ0LXBhdHRlcm5zLW1jcEBsYXRlc3QifQ%3D%3D)
|
|
59
|
+
|
|
60
|
+
Or manually add to **Cursor Settings** → **Tools** → **MCP Servers**:
|
|
61
|
+
|
|
62
|
+
`.cursor/mcp.json`:
|
|
63
|
+
```json
|
|
64
|
+
{
|
|
65
|
+
"mcpServers": {
|
|
66
|
+
"swift-patterns": {
|
|
67
|
+
"command": "npx",
|
|
68
|
+
"args": ["-y", "swift-patterns-mcp@latest"]
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Alternatively, add the following to your `~/.cursor/mcp.json` file. To learn more, see the Cursor documentation.
|
|
75
|
+
|
|
76
|
+
#### Claude Code
|
|
77
|
+
|
|
78
|
+
Run this command in your terminal:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
claude mcp add swift-patterns -- npx -y swift-patterns-mcp@latest
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Or manually add to your project's `.mcp.json` file:
|
|
85
|
+
|
|
86
|
+
`.mcp.json`
|
|
87
|
+
```json
|
|
88
|
+
{
|
|
89
|
+
"mcpServers": {
|
|
90
|
+
"swift-patterns": {
|
|
91
|
+
"command": "npx",
|
|
92
|
+
"args": ["-y", "swift-patterns-mcp@latest"]
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
After adding the configuration, restart Claude Code and run /mcp to see the swift-patterns MCP server in the list. If you see Connected, you're ready to use it.
|
|
99
|
+
|
|
100
|
+
See the Claude Code MCP documentation for more details.
|
|
101
|
+
|
|
102
|
+
#### Windsurf
|
|
103
|
+
|
|
104
|
+
Add the swift-patterns server to your project's `.windsurf/mcp.json` configuration file:
|
|
105
|
+
|
|
106
|
+
`.windsurf/mcp.json`
|
|
107
|
+
```json
|
|
108
|
+
{
|
|
109
|
+
"mcpServers": {
|
|
110
|
+
"swift-patterns": {
|
|
111
|
+
"command": "npx",
|
|
112
|
+
"args": ["-y", "swift-patterns-mcp@latest"]
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
After adding the configuration, restart Windsurf to activate the MCP server.
|
|
119
|
+
|
|
120
|
+
See the Windsurf MCP documentation for more details.
|
|
121
|
+
|
|
122
|
+
#### VS Code
|
|
123
|
+
|
|
124
|
+
To configure MCP in VS Code with GitHub Copilot, add the swift-patterns-mcp server to your project's `.vscode/mcp.json` configuration file:
|
|
125
|
+
|
|
126
|
+
`.vscode/mcp.json`
|
|
127
|
+
```json
|
|
128
|
+
{
|
|
129
|
+
"mcp": {
|
|
130
|
+
"servers": {
|
|
131
|
+
"swift-patterns": {
|
|
132
|
+
"command": "npx",
|
|
133
|
+
"args": ["-y", "swift-patterns-mcp@latest"]
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
After adding the configuration, open `.vscode/mcp.json` and click Start next to the swift-patterns server.
|
|
141
|
+
|
|
142
|
+
See the VS Code MCP documentation for more details.
|
|
143
|
+
|
|
144
|
+
### Test It Out
|
|
145
|
+
|
|
146
|
+
Try these queries:
|
|
147
|
+
|
|
148
|
+
```
|
|
149
|
+
"Show me SwiftUI animation patterns"
|
|
150
|
+
"What does Sundell say about testing?"
|
|
151
|
+
"Explain navigation patterns in SwiftUI"
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
## 🔧 Configuration
|
|
155
|
+
|
|
156
|
+
The configuration file is automatically created at `~/.swift-patterns-mcp/config.json`:
|
|
157
|
+
|
|
158
|
+
```json
|
|
159
|
+
{
|
|
160
|
+
"sources": {
|
|
161
|
+
"sundell": { "enabled": true, "configured": true },
|
|
162
|
+
"vanderlee": { "enabled": true, "configured": true },
|
|
163
|
+
"nilcoalescing": { "enabled": true, "configured": true },
|
|
164
|
+
"pointfree": { "enabled": true, "configured": true },
|
|
165
|
+
"patreon": { "enabled": false, "configured": false }
|
|
166
|
+
},
|
|
167
|
+
"prefetchSources": true,
|
|
168
|
+
"semanticRecall": {
|
|
169
|
+
"enabled": false,
|
|
170
|
+
"minLexicalScore": 0.35,
|
|
171
|
+
"minRelevanceScore": 70
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Semantic Recall (Optional AI Enhancement)
|
|
177
|
+
|
|
178
|
+
Semantic recall provides AI-powered semantic search as a fallback when traditional keyword search returns poor results. It uses transformer embeddings to understand query intent and find conceptually similar patterns.
|
|
179
|
+
|
|
180
|
+
**Features:**
|
|
181
|
+
- 🧠 Automatically activates when keyword search scores are low
|
|
182
|
+
- 🎯 Uses sentence transformers to understand meaning, not just keywords
|
|
183
|
+
- 📊 Quality filtering to only index high-relevance patterns
|
|
184
|
+
- ⚡ Efficient caching of embeddings
|
|
185
|
+
|
|
186
|
+
**Configuration:**
|
|
187
|
+
|
|
188
|
+
```json
|
|
189
|
+
{
|
|
190
|
+
"semanticRecall": {
|
|
191
|
+
"enabled": false, // Enable semantic recall
|
|
192
|
+
"minLexicalScore": 0.35, // Activate when keyword search < 0.35
|
|
193
|
+
"minRelevanceScore": 70 // Only index patterns with score >= 70
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
**When to Enable:**
|
|
199
|
+
- Your queries use conceptual terms that don't match exact keywords
|
|
200
|
+
- You want more intelligent, context-aware search results
|
|
201
|
+
- You're okay with slightly slower first-time searches (embeddings need to compute)
|
|
202
|
+
|
|
203
|
+
**Note:** Requires downloading a ~50MB transformer model on first use. Embeddings are cached for performance.
|
|
204
|
+
|
|
205
|
+
### Environment Variables (Optional)
|
|
206
|
+
|
|
207
|
+
For premium features, add to your MCP client config:
|
|
208
|
+
|
|
209
|
+
```json
|
|
210
|
+
{
|
|
211
|
+
"mcpServers": {
|
|
212
|
+
"swift-patterns": {
|
|
213
|
+
"command": "npx",
|
|
214
|
+
"args": ["-y", "swift-patterns-mcp@latest"],
|
|
215
|
+
"env": {
|
|
216
|
+
"PATREON_CLIENT_ID": "your_client_id",
|
|
217
|
+
"PATREON_CLIENT_SECRET": "your_client_secret"
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## 💡 Usage Examples
|
|
225
|
+
|
|
226
|
+
### Basic Queries
|
|
227
|
+
|
|
228
|
+
```
|
|
229
|
+
"Show me best practices for SwiftUI animations"
|
|
230
|
+
"What does Sundell say about testing?"
|
|
231
|
+
"Explain navigation patterns in SwiftUI"
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Advanced Queries
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
"Show me performance tips from van der Lee"
|
|
238
|
+
"Find iOS architecture patterns for MVVM + coordinator"
|
|
239
|
+
"Give me examples for SwiftUI infinite scrolling"
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### With Patreon Integration
|
|
243
|
+
|
|
244
|
+
```
|
|
245
|
+
"Show me advanced SwiftUI patterns"
|
|
246
|
+
"How do I build a photo editor app?"
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
## 📚 Content Sources
|
|
250
|
+
|
|
251
|
+
### Free Sources
|
|
252
|
+
|
|
253
|
+
Currently supported, no authentication needed:
|
|
254
|
+
|
|
255
|
+
| Source | Creator | Content Type | Update Frequency |
|
|
256
|
+
|--------|---------|--------------|------------------|
|
|
257
|
+
| **Swift by Sundell** | John Sundell | Articles, patterns, best practices | Weekly |
|
|
258
|
+
| **Antoine van der Lee** | Antoine van der Lee | Tutorials, tips, deep dives | Weekly |
|
|
259
|
+
| **Nil Coalescing** | Nil Coalescing | SwiftUI patterns, Swift tips | Weekly |
|
|
260
|
+
| **Point-Free** | Point-Free | Open source libraries, patterns | On release |
|
|
261
|
+
|
|
262
|
+
### Premium Sources
|
|
263
|
+
|
|
264
|
+
Requires authentication and active subscriptions:
|
|
265
|
+
|
|
266
|
+
| Source | What You Get | Setup Method | Status |
|
|
267
|
+
|--------|--------------|--------------|--------|
|
|
268
|
+
| **Patreon** | Premium content from iOS creators | OAuth 2.0 | ✅ Available |
|
|
269
|
+
|
|
270
|
+
## 🔐 Premium Integration (Optional)
|
|
271
|
+
|
|
272
|
+
### Patreon Setup
|
|
273
|
+
|
|
274
|
+
Access premium content from iOS creators you support:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
swift-patterns-mcp setup --patreon
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
Follow the interactive wizard to:
|
|
281
|
+
1. Create a Patreon OAuth application
|
|
282
|
+
2. Configure credentials
|
|
283
|
+
3. Complete authentication
|
|
284
|
+
|
|
285
|
+
📖 **Detailed Guide**: [Patreon Setup Documentation](docs/PATREON_SETUP.md)
|
|
286
|
+
|
|
287
|
+
#### Requirements
|
|
288
|
+
|
|
289
|
+
- Active Patreon account with at least one iOS creator subscription
|
|
290
|
+
- Patreon Creator account (free - no need to launch a creator page)
|
|
291
|
+
- 10 minutes for one-time OAuth setup
|
|
292
|
+
|
|
293
|
+
#### Why Creator Account?
|
|
294
|
+
|
|
295
|
+
Patreon requires OAuth apps to be registered by creators. You don't need to launch a creator page or become an active creator - just register as one to create an OAuth app for personal use.
|
|
296
|
+
|
|
297
|
+
#### What You Get
|
|
298
|
+
|
|
299
|
+
- ✅ Access to premium tutorials and patterns from creators you support
|
|
300
|
+
- ✅ Automatic extraction of code from downloadable content
|
|
301
|
+
- ✅ Quality filtering and advanced search
|
|
302
|
+
- ✅ Multi-creator support
|
|
303
|
+
- ✅ Private, secure authentication
|
|
304
|
+
|
|
305
|
+
## ⚙️ Commands
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
# Source management
|
|
309
|
+
swift-patterns-mcp source list
|
|
310
|
+
swift-patterns-mcp source enable <source-name>
|
|
311
|
+
swift-patterns-mcp source disable <source-name>
|
|
312
|
+
|
|
313
|
+
# Configuration
|
|
314
|
+
swift-patterns-mcp setup
|
|
315
|
+
swift-patterns-mcp setup --patreon
|
|
316
|
+
|
|
317
|
+
# Authentication
|
|
318
|
+
swift-patterns-mcp auth patreon
|
|
319
|
+
swift-patterns-mcp auth status
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
## 🏗️ How It Works
|
|
323
|
+
|
|
324
|
+
```mermaid
|
|
325
|
+
graph LR
|
|
326
|
+
A[AI Assistant] --> B[swift-patterns-mcp Server]
|
|
327
|
+
B --> C[Free Sources]
|
|
328
|
+
B --> D[Premium Sources]
|
|
329
|
+
C --> E[Swift by Sundell RSS]
|
|
330
|
+
C --> F[van der Lee RSS]
|
|
331
|
+
C --> G[Nil Coalescing RSS]
|
|
332
|
+
C --> H[Point-Free GitHub]
|
|
333
|
+
D --> I[Patreon API]
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
1. **Query**: Receives a query through the MCP protocol
|
|
337
|
+
2. **Processing**: Searches enabled sources based on the query
|
|
338
|
+
3. **Content Retrieval**: Fetches and parses content from RSS feeds, APIs, and cached data
|
|
339
|
+
4. **Quality Filtering**: Applies configurable quality thresholds
|
|
340
|
+
5. **Response**: Returns formatted, relevant patterns and examples
|
|
341
|
+
|
|
342
|
+
## 🔧 Troubleshooting
|
|
343
|
+
|
|
344
|
+
### Common Issues
|
|
345
|
+
|
|
346
|
+
**Node version incompatible**
|
|
347
|
+
```bash
|
|
348
|
+
node --version # Should be >= 18.0.0
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
**Sources not returning results**
|
|
352
|
+
```bash
|
|
353
|
+
swift-patterns-mcp source list
|
|
354
|
+
ls ~/.swift-patterns-mcp/config.json
|
|
355
|
+
swift-patterns-mcp setup
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
#### Patreon Integration Issues
|
|
359
|
+
|
|
360
|
+
**OAuth redirect not working**
|
|
361
|
+
- Ensure redirect URI is exactly: `http://localhost:3000/patreon/callback`
|
|
362
|
+
- Check no other process is using port 3000
|
|
363
|
+
- Verify OAuth credentials are correctly set
|
|
364
|
+
|
|
365
|
+
**No premium content showing**
|
|
366
|
+
- Confirm you have active Patreon subscriptions to iOS creators
|
|
367
|
+
- Re-authenticate: `swift-patterns-mcp auth patreon`
|
|
368
|
+
- Check Patreon source is enabled: `swift-patterns-mcp source list`
|
|
369
|
+
|
|
370
|
+
## 🗺️ Roadmap
|
|
371
|
+
|
|
372
|
+
### Current (v1.x)
|
|
373
|
+
- [x] Core MCP server
|
|
374
|
+
- [x] Swift by Sundell RSS
|
|
375
|
+
- [x] Antoine van der Lee RSS
|
|
376
|
+
- [x] Nil Coalescing RSS
|
|
377
|
+
- [x] Patreon OAuth
|
|
378
|
+
- [x] Point-Free GitHub
|
|
379
|
+
- [ ] Advanced filtering
|
|
380
|
+
|
|
381
|
+
### Future (v2.x)
|
|
382
|
+
- [ ] Additional premium sources
|
|
383
|
+
- [ ] More free sources
|
|
384
|
+
- [ ] Code validation
|
|
385
|
+
|
|
386
|
+
## 🤝 Contributing
|
|
387
|
+
|
|
388
|
+
We welcome contributions! See our [contributing guidelines](CONTRIBUTING.md).
|
|
389
|
+
|
|
390
|
+
## 📄 License
|
|
391
|
+
|
|
392
|
+
MIT License - Copyright (c) 2026 Lasha Efremidze
|
|
393
|
+
|
|
394
|
+
## 🙏 Credits
|
|
395
|
+
|
|
396
|
+
**Created by** [Lasha Efremidze](https://github.com/efremidze)
|
|
397
|
+
|
|
398
|
+
**Content Sources**
|
|
399
|
+
- [John Sundell](https://swiftbysundell.com) - Swift by Sundell
|
|
400
|
+
- [Antoine van der Lee](https://www.avanderlee.com) - SwiftLee
|
|
401
|
+
- [Nil Coalescing](https://nilcoalescing.com) - SwiftUI patterns and Swift tips
|
|
402
|
+
- [Point-Free](https://www.pointfree.co) - Advanced Swift education
|
|
403
|
+
|
|
404
|
+
**Built with** [Model Context Protocol](https://modelcontextprotocol.io)
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
**Made with ❤️ for the Swift community**
|
|
409
|
+
|
|
410
|
+
[⭐ Star this repo](https://github.com/efremidze/swift-patterns-mcp) • [🐛 Report Bug](./issues) • [✨ Request Feature](./issues)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/cli/auth.ts"],"names":[],"mappings":";AAIA,OAAO,eAAe,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// src/cli/auth.ts
|
|
3
|
+
import 'dotenv/config';
|
|
4
|
+
import { clearPatreonAuth } from "../sources/premium/patreon-oauth.js";
|
|
5
|
+
import logger from "../utils/logger.js";
|
|
6
|
+
function print(msg) {
|
|
7
|
+
console.log(msg);
|
|
8
|
+
}
|
|
9
|
+
async function resetAuth() {
|
|
10
|
+
print("\n🔄 Resetting Patreon Authentication");
|
|
11
|
+
print("━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n");
|
|
12
|
+
try {
|
|
13
|
+
await clearPatreonAuth();
|
|
14
|
+
print("✅ Authentication data cleared successfully!\n");
|
|
15
|
+
print("Run 'swift-patterns-mcp setup --patreon' to re-authenticate.\n");
|
|
16
|
+
}
|
|
17
|
+
catch (err) {
|
|
18
|
+
print(`❌ Failed to clear authentication: ${err instanceof Error ? err.message : String(err)}\n`);
|
|
19
|
+
process.exit(1);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
// Parse args
|
|
23
|
+
const args = process.argv.slice(2);
|
|
24
|
+
if (args.includes("reset") || args.includes("-r")) {
|
|
25
|
+
resetAuth().catch((err) => {
|
|
26
|
+
logger.error({ err }, "Reset failed");
|
|
27
|
+
process.exit(1);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
else if (args.includes("--help") || args.includes("-h")) {
|
|
31
|
+
print("swift-patterns-mcp auth\n");
|
|
32
|
+
print("Usage:");
|
|
33
|
+
print(" swift-patterns-mcp auth reset Clear all Patreon authentication data");
|
|
34
|
+
print(" swift-patterns-mcp auth --help Show this help");
|
|
35
|
+
process.exit(0);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
print("swift-patterns-mcp auth\n");
|
|
39
|
+
print("Available commands:");
|
|
40
|
+
print(" reset Clear all Patreon authentication data");
|
|
41
|
+
print("\nRun: swift-patterns-mcp auth reset");
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/cli/auth.ts"],"names":[],"mappings":";AAEA,kBAAkB;AAElB,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAA;AACtE,OAAO,MAAM,MAAM,oBAAoB,CAAA;AAEvC,SAAS,KAAK,CAAC,GAAW;IACxB,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAA;AAClB,CAAC;AAED,KAAK,UAAU,SAAS;IACtB,KAAK,CAAC,uCAAuC,CAAC,CAAA;IAC9C,KAAK,CAAC,sCAAsC,CAAC,CAAA;IAE7C,IAAI,CAAC;QACH,MAAM,gBAAgB,EAAE,CAAA;QACxB,KAAK,CAAC,+CAA+C,CAAC,CAAA;QACtD,KAAK,CAAC,gEAAgE,CAAC,CAAA;IACzE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,KAAK,CAAC,qCAAqC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,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@ -0,0 +1,150 @@
|
|
|
1
|
+
// src/cli/setup.ts
|
|
2
|
+
import 'dotenv/config';
|
|
3
|
+
import readline from 'readline';
|
|
4
|
+
import { startOAuthFlow, loadTokens } from '../sources/premium/patreon-oauth.js';
|
|
5
|
+
import PatreonSource from '../sources/premium/patreon.js';
|
|
6
|
+
import SourceManager from '../config/sources.js';
|
|
7
|
+
import logger from '../utils/logger.js';
|
|
8
|
+
const rl = readline.createInterface({
|
|
9
|
+
input: process.stdin,
|
|
10
|
+
output: process.stdout,
|
|
11
|
+
});
|
|
12
|
+
function question(prompt) {
|
|
13
|
+
return new Promise(resolve => rl.question(prompt, resolve));
|
|
14
|
+
}
|
|
15
|
+
function print(msg) {
|
|
16
|
+
console.log(msg);
|
|
17
|
+
}
|
|
18
|
+
async function setupPatreon() {
|
|
19
|
+
print('\n🔐 Patreon Setup');
|
|
20
|
+
print('━━━━━━━━━━━━━━━━\n');
|
|
21
|
+
const clientId = process.env.PATREON_CLIENT_ID;
|
|
22
|
+
const clientSecret = process.env.PATREON_CLIENT_SECRET;
|
|
23
|
+
if (!clientId || !clientSecret) {
|
|
24
|
+
print('❌ Missing Patreon credentials.\n');
|
|
25
|
+
print('Please set these environment variables:');
|
|
26
|
+
print(' PATREON_CLIENT_ID=your_client_id');
|
|
27
|
+
print(' PATREON_CLIENT_SECRET=your_client_secret\n');
|
|
28
|
+
print('Get credentials at: https://www.patreon.com/portal/registration/register-clients');
|
|
29
|
+
rl.close();
|
|
30
|
+
process.exit(1);
|
|
31
|
+
}
|
|
32
|
+
// Check if already configured
|
|
33
|
+
const existingTokens = await loadTokens();
|
|
34
|
+
if (existingTokens) {
|
|
35
|
+
const answer = await question('Patreon is already configured. Reconfigure? (y/N): ');
|
|
36
|
+
if (answer.toLowerCase() !== 'y') {
|
|
37
|
+
print('\nSetup cancelled.');
|
|
38
|
+
rl.close();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
// Step 1: OAuth
|
|
43
|
+
print('Step 1/3: Authentication');
|
|
44
|
+
const result = await startOAuthFlow(clientId, clientSecret);
|
|
45
|
+
if (!result.success) {
|
|
46
|
+
print(`\n❌ Authorization failed: ${result.error}`);
|
|
47
|
+
rl.close();
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
print('✓ Authenticated successfully!\n');
|
|
51
|
+
// Step 2: Detect creators
|
|
52
|
+
print('Step 2/3: Detecting Swift/iOS Creators');
|
|
53
|
+
print('Scanning your subscriptions...\n');
|
|
54
|
+
const patreon = new PatreonSource();
|
|
55
|
+
const allCreators = await patreon.getSubscribedCreators();
|
|
56
|
+
const swiftCreators = allCreators.filter(c => c.isSwiftRelated);
|
|
57
|
+
if (allCreators.length === 0) {
|
|
58
|
+
print('No Patreon subscriptions found.');
|
|
59
|
+
print('Subscribe to iOS/Swift creators on Patreon, then run setup again.');
|
|
60
|
+
rl.close();
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
// Display creators with pre-selection
|
|
64
|
+
const selected = new Set(swiftCreators.map(c => c.id));
|
|
65
|
+
print(`Found ${allCreators.length} subscriptions:\n`);
|
|
66
|
+
function displayCreators() {
|
|
67
|
+
allCreators.forEach((c, i) => {
|
|
68
|
+
const check = selected.has(c.id) ? '✓' : ' ';
|
|
69
|
+
const swift = c.isSwiftRelated ? ' (Swift/iOS)' : '';
|
|
70
|
+
print(` ${check} [${i + 1}] ${c.name}${swift}`);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
displayCreators();
|
|
74
|
+
print('\nToggle numbers to change selection, or press Enter to confirm.');
|
|
75
|
+
while (true) {
|
|
76
|
+
const input = await question('\nToggle (or Enter to confirm): ');
|
|
77
|
+
if (input.trim() === '') {
|
|
78
|
+
break;
|
|
79
|
+
}
|
|
80
|
+
const nums = input.split(/[\s,]+/).map(s => parseInt(s.trim(), 10)).filter(n => !isNaN(n));
|
|
81
|
+
for (const num of nums) {
|
|
82
|
+
if (num >= 1 && num <= allCreators.length) {
|
|
83
|
+
const creator = allCreators[num - 1];
|
|
84
|
+
if (selected.has(creator.id)) {
|
|
85
|
+
selected.delete(creator.id);
|
|
86
|
+
}
|
|
87
|
+
else {
|
|
88
|
+
selected.add(creator.id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
print('\nUpdated selection:');
|
|
93
|
+
displayCreators();
|
|
94
|
+
}
|
|
95
|
+
if (selected.size === 0) {
|
|
96
|
+
print('\n⚠️ No creators selected. You can run setup again later.');
|
|
97
|
+
rl.close();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
// Save selected creators
|
|
101
|
+
patreon.saveEnabledCreators(Array.from(selected));
|
|
102
|
+
// Step 3: Initial sync
|
|
103
|
+
print('\nStep 3/3: Initial Sync');
|
|
104
|
+
print(`Fetching content from ${selected.size} creator(s)...\n`);
|
|
105
|
+
const patterns = await patreon.fetchPatterns();
|
|
106
|
+
const creatorStats = new Map();
|
|
107
|
+
for (const p of patterns) {
|
|
108
|
+
if (!creatorStats.has(p.creator)) {
|
|
109
|
+
creatorStats.set(p.creator, { posts: 0, withCode: 0 });
|
|
110
|
+
}
|
|
111
|
+
const stats = creatorStats.get(p.creator);
|
|
112
|
+
stats.posts++;
|
|
113
|
+
if (p.hasCode)
|
|
114
|
+
stats.withCode++;
|
|
115
|
+
}
|
|
116
|
+
for (const [creatorId, stats] of creatorStats) {
|
|
117
|
+
const creator = allCreators.find(c => c.id === creatorId);
|
|
118
|
+
print(` ${creator?.name || creatorId}: ${stats.posts} posts (${stats.withCode} with code)`);
|
|
119
|
+
}
|
|
120
|
+
// Mark as configured
|
|
121
|
+
const sourceManager = new SourceManager();
|
|
122
|
+
sourceManager.markSourceConfigured('patreon');
|
|
123
|
+
print('\n✅ Setup complete!\n');
|
|
124
|
+
print(`Found ${patterns.length} posts across ${selected.size} creator(s).`);
|
|
125
|
+
print("Use 'get_patreon_patterns' in your AI assistant to search them.\n");
|
|
126
|
+
rl.close();
|
|
127
|
+
}
|
|
128
|
+
// Parse args
|
|
129
|
+
const args = process.argv.slice(2);
|
|
130
|
+
if (args.includes('--patreon') || args.includes('-p')) {
|
|
131
|
+
setupPatreon().catch(err => {
|
|
132
|
+
logger.error({ err }, 'Setup failed');
|
|
133
|
+
process.exit(1);
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
else if (args.includes('--help') || args.includes('-h')) {
|
|
137
|
+
print('swift-patterns-mcp setup\n');
|
|
138
|
+
print('Usage:');
|
|
139
|
+
print(' swift-patterns-mcp setup --patreon Set up Patreon integration');
|
|
140
|
+
print(' swift-patterns-mcp setup --help Show this help');
|
|
141
|
+
process.exit(0);
|
|
142
|
+
}
|
|
143
|
+
else {
|
|
144
|
+
print('swift-patterns-mcp setup\n');
|
|
145
|
+
print('Available options:');
|
|
146
|
+
print(' --patreon Set up Patreon integration');
|
|
147
|
+
print('\nRun: swift-patterns-mcp setup --patreon');
|
|
148
|
+
process.exit(0);
|
|
149
|
+
}
|
|
150
|
+
//# sourceMappingURL=setup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup.js","sourceRoot":"","sources":["../../src/cli/setup.ts"],"names":[],"mappings":"AAAA,mBAAmB;AAEnB,OAAO,eAAe,CAAC;AAEvB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,qCAAqC,CAAC;AACjF,OAAO,aAAa,MAAM,+BAA+B,CAAC;AAC1D,OAAO,aAAa,MAAM,sBAAsB,CAAC;AACjD,OAAO,MAAM,MAAM,oBAAoB,CAAC;AAExC,MAAM,EAAE,GAAG,QAAQ,CAAC,eAAe,CAAC;IAClC,KAAK,EAAE,OAAO,CAAC,KAAK;IACpB,MAAM,EAAE,OAAO,CAAC,MAAM;CACvB,CAAC,CAAC;AAEH,SAAS,QAAQ,CAAC,MAAc;IAC9B,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,C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