@opensaas/stack-cli 0.1.6 → 0.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 (94) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +215 -0
  3. package/CLAUDE.md +60 -12
  4. package/dist/commands/generate.d.ts.map +1 -1
  5. package/dist/commands/generate.js +10 -1
  6. package/dist/commands/generate.js.map +1 -1
  7. package/dist/commands/mcp.d.ts +6 -0
  8. package/dist/commands/mcp.d.ts.map +1 -0
  9. package/dist/commands/mcp.js +116 -0
  10. package/dist/commands/mcp.js.map +1 -0
  11. package/dist/generator/context.d.ts.map +1 -1
  12. package/dist/generator/context.js +21 -3
  13. package/dist/generator/context.js.map +1 -1
  14. package/dist/generator/index.d.ts +3 -0
  15. package/dist/generator/index.d.ts.map +1 -1
  16. package/dist/generator/index.js +3 -0
  17. package/dist/generator/index.js.map +1 -1
  18. package/dist/generator/lists.d.ts +31 -0
  19. package/dist/generator/lists.d.ts.map +1 -0
  20. package/dist/generator/lists.js +91 -0
  21. package/dist/generator/lists.js.map +1 -0
  22. package/dist/generator/plugin-types.d.ts +10 -0
  23. package/dist/generator/plugin-types.d.ts.map +1 -0
  24. package/dist/generator/plugin-types.js +122 -0
  25. package/dist/generator/plugin-types.js.map +1 -0
  26. package/dist/generator/prisma-config.d.ts +17 -0
  27. package/dist/generator/prisma-config.d.ts.map +1 -0
  28. package/dist/generator/prisma-config.js +40 -0
  29. package/dist/generator/prisma-config.js.map +1 -0
  30. package/dist/generator/prisma.d.ts.map +1 -1
  31. package/dist/generator/prisma.js +1 -2
  32. package/dist/generator/prisma.js.map +1 -1
  33. package/dist/generator/types.d.ts.map +1 -1
  34. package/dist/generator/types.js +53 -1
  35. package/dist/generator/types.js.map +1 -1
  36. package/dist/index.js +3 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/mcp/lib/documentation-provider.d.ts +43 -0
  39. package/dist/mcp/lib/documentation-provider.d.ts.map +1 -0
  40. package/dist/mcp/lib/documentation-provider.js +163 -0
  41. package/dist/mcp/lib/documentation-provider.js.map +1 -0
  42. package/dist/mcp/lib/features/catalog.d.ts +26 -0
  43. package/dist/mcp/lib/features/catalog.d.ts.map +1 -0
  44. package/dist/mcp/lib/features/catalog.js +291 -0
  45. package/dist/mcp/lib/features/catalog.js.map +1 -0
  46. package/dist/mcp/lib/generators/feature-generator.d.ts +35 -0
  47. package/dist/mcp/lib/generators/feature-generator.d.ts.map +1 -0
  48. package/dist/mcp/lib/generators/feature-generator.js +546 -0
  49. package/dist/mcp/lib/generators/feature-generator.js.map +1 -0
  50. package/dist/mcp/lib/types.d.ts +80 -0
  51. package/dist/mcp/lib/types.d.ts.map +1 -0
  52. package/dist/mcp/lib/types.js +5 -0
  53. package/dist/mcp/lib/types.js.map +1 -0
  54. package/dist/mcp/lib/wizards/wizard-engine.d.ts +71 -0
  55. package/dist/mcp/lib/wizards/wizard-engine.d.ts.map +1 -0
  56. package/dist/mcp/lib/wizards/wizard-engine.js +356 -0
  57. package/dist/mcp/lib/wizards/wizard-engine.js.map +1 -0
  58. package/dist/mcp/server/index.d.ts +8 -0
  59. package/dist/mcp/server/index.d.ts.map +1 -0
  60. package/dist/mcp/server/index.js +202 -0
  61. package/dist/mcp/server/index.js.map +1 -0
  62. package/dist/mcp/server/stack-mcp-server.d.ts +92 -0
  63. package/dist/mcp/server/stack-mcp-server.d.ts.map +1 -0
  64. package/dist/mcp/server/stack-mcp-server.js +265 -0
  65. package/dist/mcp/server/stack-mcp-server.js.map +1 -0
  66. package/package.json +9 -7
  67. package/src/commands/__snapshots__/generate.test.ts.snap +61 -21
  68. package/src/commands/dev.test.ts +0 -1
  69. package/src/commands/generate.test.ts +18 -8
  70. package/src/commands/generate.ts +12 -0
  71. package/src/commands/mcp.ts +135 -0
  72. package/src/generator/__snapshots__/context.test.ts.snap +8 -8
  73. package/src/generator/__snapshots__/prisma.test.ts.snap +8 -16
  74. package/src/generator/__snapshots__/types.test.ts.snap +605 -9
  75. package/src/generator/context.test.ts +13 -8
  76. package/src/generator/context.ts +21 -3
  77. package/src/generator/index.ts +3 -0
  78. package/src/generator/lists.test.ts +335 -0
  79. package/src/generator/lists.ts +102 -0
  80. package/src/generator/plugin-types.ts +147 -0
  81. package/src/generator/prisma-config.ts +46 -0
  82. package/src/generator/prisma.test.ts +0 -10
  83. package/src/generator/prisma.ts +1 -2
  84. package/src/generator/types.test.ts +0 -12
  85. package/src/generator/types.ts +56 -1
  86. package/src/index.ts +4 -0
  87. package/src/mcp/lib/documentation-provider.ts +203 -0
  88. package/src/mcp/lib/features/catalog.ts +301 -0
  89. package/src/mcp/lib/generators/feature-generator.ts +598 -0
  90. package/src/mcp/lib/types.ts +89 -0
  91. package/src/mcp/lib/wizards/wizard-engine.ts +427 -0
  92. package/src/mcp/server/index.ts +240 -0
  93. package/src/mcp/server/stack-mcp-server.ts +301 -0
  94. package/tsconfig.tsbuildinfo +1 -1
@@ -0,0 +1,301 @@
1
+ /**
2
+ * Feature catalog - Defines all available features with their configuration wizards
3
+ */
4
+
5
+ import type { Feature } from '../types.js'
6
+
7
+ export const AUTHENTICATION_FEATURE: Feature = {
8
+ id: 'authentication',
9
+ name: 'User Authentication',
10
+ description: 'Complete authentication system with sessions, sign-up/sign-in, and access control',
11
+ category: 'authentication',
12
+ includes: [
13
+ 'User list with email, password, name, and optional fields',
14
+ 'Better-auth integration with session management',
15
+ 'Sign-up and sign-in pages with form validation',
16
+ 'Access control helpers (isAuthenticated, isAdmin, isOwner)',
17
+ 'OAuth providers (optional)',
18
+ 'Email verification (optional)',
19
+ ],
20
+ questions: [
21
+ {
22
+ id: 'auth-methods',
23
+ text: 'Which authentication methods do you want to support?',
24
+ type: 'multiselect',
25
+ required: true,
26
+ options: ['Email & Password', 'Google OAuth', 'GitHub OAuth', 'Magic Links'],
27
+ defaultValue: ['Email & Password'],
28
+ },
29
+ {
30
+ id: 'user-roles',
31
+ text: 'Do you need user roles for access control?',
32
+ type: 'boolean',
33
+ required: true,
34
+ defaultValue: true,
35
+ followUp: {
36
+ if: true,
37
+ ask: 'What roles do you need? (Enter comma-separated, e.g., admin,editor,user)',
38
+ type: 'text',
39
+ },
40
+ },
41
+ {
42
+ id: 'user-fields',
43
+ text: 'Select additional user profile fields',
44
+ type: 'multiselect',
45
+ required: false,
46
+ options: ['Avatar', 'Bio', 'Phone', 'Location', 'Website'],
47
+ defaultValue: [],
48
+ },
49
+ {
50
+ id: 'email-verification',
51
+ text: 'Require email verification for new accounts?',
52
+ type: 'boolean',
53
+ required: true,
54
+ defaultValue: false,
55
+ },
56
+ ],
57
+ }
58
+
59
+ export const BLOG_FEATURE: Feature = {
60
+ id: 'blog',
61
+ name: 'Blog System',
62
+ description: 'Complete blog with posts, authors, and rich content editing',
63
+ category: 'content',
64
+ includes: [
65
+ 'Post list with title, content, and metadata',
66
+ 'Author relationship to User',
67
+ 'Draft/publish workflow with status field',
68
+ 'Access control (authors can edit own posts)',
69
+ 'Rich text editor or markdown support',
70
+ 'SEO-friendly slugs',
71
+ ],
72
+ dependsOn: ['authentication'],
73
+ questions: [
74
+ {
75
+ id: 'content-editor',
76
+ text: 'How should users write posts?',
77
+ type: 'select',
78
+ required: true,
79
+ options: ['Rich text editor (Tiptap)', 'Markdown', 'Plain text'],
80
+ defaultValue: 'Rich text editor (Tiptap)',
81
+ },
82
+ {
83
+ id: 'post-status',
84
+ text: 'Enable draft/publish workflow?',
85
+ type: 'boolean',
86
+ required: true,
87
+ defaultValue: true,
88
+ },
89
+ {
90
+ id: 'taxonomy',
91
+ text: 'Add categories or tags for organizing posts?',
92
+ type: 'multiselect',
93
+ required: false,
94
+ options: ['Categories', 'Tags'],
95
+ defaultValue: [],
96
+ },
97
+ {
98
+ id: 'post-fields',
99
+ text: 'Select additional post fields',
100
+ type: 'multiselect',
101
+ required: false,
102
+ options: [
103
+ 'Featured image',
104
+ 'Excerpt/summary',
105
+ 'SEO metadata (title, description)',
106
+ 'Published date',
107
+ 'Reading time estimate',
108
+ ],
109
+ defaultValue: ['Featured image', 'Excerpt/summary'],
110
+ },
111
+ {
112
+ id: 'comments-enabled',
113
+ text: 'Enable comments on blog posts?',
114
+ type: 'boolean',
115
+ required: false,
116
+ defaultValue: false,
117
+ },
118
+ ],
119
+ }
120
+
121
+ export const COMMENTS_FEATURE: Feature = {
122
+ id: 'comments',
123
+ name: 'Comments System',
124
+ description: 'Add threaded comments to your content with moderation',
125
+ category: 'content',
126
+ includes: [
127
+ 'Comment list with content and author',
128
+ 'Relationship to commentable content',
129
+ 'Nested replies support (optional)',
130
+ 'Moderation workflow',
131
+ 'Access control for comment management',
132
+ ],
133
+ dependsOn: ['authentication'],
134
+ questions: [
135
+ {
136
+ id: 'comment-targets',
137
+ text: 'What content types can users comment on?',
138
+ type: 'multiselect',
139
+ required: true,
140
+ options: ['Posts', 'Products', 'Other'],
141
+ defaultValue: ['Posts'],
142
+ },
143
+ {
144
+ id: 'nested-replies',
145
+ text: 'Allow nested/threaded replies?',
146
+ type: 'boolean',
147
+ required: true,
148
+ defaultValue: true,
149
+ },
150
+ {
151
+ id: 'moderation',
152
+ text: 'Comment moderation approach?',
153
+ type: 'select',
154
+ required: true,
155
+ options: [
156
+ 'Auto-approve all comments',
157
+ 'Require admin approval',
158
+ 'Auto-approve for verified users only',
159
+ ],
160
+ defaultValue: 'Auto-approve all comments',
161
+ },
162
+ {
163
+ id: 'comment-features',
164
+ text: 'Additional comment features?',
165
+ type: 'multiselect',
166
+ required: false,
167
+ options: ['Upvotes/downvotes', 'Report/flag comments', 'Markdown support'],
168
+ defaultValue: [],
169
+ },
170
+ ],
171
+ }
172
+
173
+ export const FILE_UPLOAD_FEATURE: Feature = {
174
+ id: 'file-upload',
175
+ name: 'File Uploads',
176
+ description: 'Upload and manage files with cloud storage integration',
177
+ category: 'storage',
178
+ includes: [
179
+ 'File list with name, URL, size, and type',
180
+ 'Storage plugin integration',
181
+ 'Upload UI components',
182
+ 'Access control for files',
183
+ 'Image optimization (optional)',
184
+ ],
185
+ questions: [
186
+ {
187
+ id: 'storage-provider',
188
+ text: 'Which storage provider do you want to use?',
189
+ type: 'select',
190
+ required: true,
191
+ options: ['AWS S3', 'Cloudflare R2', 'Vercel Blob', 'Local filesystem (development only)'],
192
+ defaultValue: 'Vercel Blob',
193
+ },
194
+ {
195
+ id: 'file-associations',
196
+ text: 'Where will files be used?',
197
+ type: 'multiselect',
198
+ required: true,
199
+ options: ['User avatars', 'Post featured images', 'General attachments', 'Product images'],
200
+ defaultValue: ['User avatars'],
201
+ },
202
+ {
203
+ id: 'file-types',
204
+ text: 'What file types should be allowed?',
205
+ type: 'multiselect',
206
+ required: true,
207
+ options: ['Images (jpg, png, webp)', 'PDFs', 'Videos', 'Any file type'],
208
+ defaultValue: ['Images (jpg, png, webp)'],
209
+ },
210
+ {
211
+ id: 'image-processing',
212
+ text: 'Enable automatic image optimization and resizing?',
213
+ type: 'boolean',
214
+ required: false,
215
+ defaultValue: true,
216
+ dependsOn: {
217
+ questionId: 'file-types',
218
+ value: 'Images (jpg, png, webp)',
219
+ },
220
+ },
221
+ ],
222
+ }
223
+
224
+ export const SEMANTIC_SEARCH_FEATURE: Feature = {
225
+ id: 'semantic-search',
226
+ name: 'Semantic Search',
227
+ description: 'AI-powered search using RAG (Retrieval Augmented Generation)',
228
+ category: 'search',
229
+ includes: [
230
+ 'RAG plugin integration',
231
+ 'Automatic embeddings generation',
232
+ 'Search API endpoint',
233
+ 'Search UI component',
234
+ 'Relevance scoring',
235
+ ],
236
+ questions: [
237
+ {
238
+ id: 'searchable-content',
239
+ text: 'What content should be searchable?',
240
+ type: 'multiselect',
241
+ required: true,
242
+ options: ['Posts', 'Products', 'Documentation', 'User profiles'],
243
+ defaultValue: ['Posts'],
244
+ },
245
+ {
246
+ id: 'embedding-provider',
247
+ text: 'Which embedding provider?',
248
+ type: 'select',
249
+ required: true,
250
+ options: ['OpenAI (text-embedding-3-small)', 'Cohere', 'Anthropic'],
251
+ defaultValue: 'OpenAI (text-embedding-3-small)',
252
+ },
253
+ {
254
+ id: 'search-fields',
255
+ text: 'Which fields should be indexed for search?',
256
+ type: 'multiselect',
257
+ required: true,
258
+ options: ['Title', 'Content/body', 'Excerpt', 'Tags/categories'],
259
+ defaultValue: ['Title', 'Content/body'],
260
+ },
261
+ {
262
+ id: 'real-time-indexing',
263
+ text: 'Update search index in real-time when content changes?',
264
+ type: 'boolean',
265
+ required: true,
266
+ defaultValue: true,
267
+ },
268
+ ],
269
+ }
270
+
271
+ /**
272
+ * Feature catalog - maps feature IDs to feature definitions
273
+ */
274
+ export const FeatureCatalog = new Map<string, Feature>([
275
+ ['authentication', AUTHENTICATION_FEATURE],
276
+ ['blog', BLOG_FEATURE],
277
+ ['comments', COMMENTS_FEATURE],
278
+ ['file-upload', FILE_UPLOAD_FEATURE],
279
+ ['semantic-search', SEMANTIC_SEARCH_FEATURE],
280
+ ])
281
+
282
+ /**
283
+ * Get feature by ID
284
+ */
285
+ export function getFeature(featureId: string): Feature | undefined {
286
+ return FeatureCatalog.get(featureId)
287
+ }
288
+
289
+ /**
290
+ * Get all available features
291
+ */
292
+ export function getAllFeatures(): Feature[] {
293
+ return Array.from(FeatureCatalog.values())
294
+ }
295
+
296
+ /**
297
+ * Get features by category
298
+ */
299
+ export function getFeaturesByCategory(category: Feature['category']): Feature[] {
300
+ return getAllFeatures().filter((f) => f.category === category)
301
+ }