@tanstack/cli 0.0.7 → 0.48.2
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/dist/bin.js +7 -0
- package/dist/cli.js +481 -0
- package/dist/command-line.js +174 -0
- package/dist/dev-watch.js +290 -0
- package/dist/file-syncer.js +148 -0
- package/dist/index.js +1 -0
- package/dist/mcp/api.js +31 -0
- package/dist/mcp/tools.js +250 -0
- package/dist/mcp/types.js +37 -0
- package/dist/mcp.js +121 -0
- package/dist/options.js +162 -0
- package/dist/types/bin.d.ts +2 -0
- package/dist/types/cli.d.ts +16 -0
- package/dist/types/command-line.d.ts +10 -0
- package/dist/types/dev-watch.d.ts +27 -0
- package/dist/types/file-syncer.d.ts +18 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/mcp/api.d.ts +4 -0
- package/dist/types/mcp/tools.d.ts +2 -0
- package/dist/types/mcp/types.d.ts +217 -0
- package/dist/types/mcp.d.ts +6 -0
- package/dist/types/options.d.ts +8 -0
- package/dist/types/types.d.ts +25 -0
- package/dist/types/ui-environment.d.ts +2 -0
- package/dist/types/ui-prompts.d.ts +12 -0
- package/dist/types/utils.d.ts +8 -0
- package/dist/types.js +1 -0
- package/dist/ui-environment.js +52 -0
- package/dist/ui-prompts.js +244 -0
- package/dist/utils.js +30 -0
- package/package.json +46 -46
- package/src/bin.ts +6 -93
- package/src/cli.ts +692 -0
- package/src/command-line.ts +236 -0
- package/src/dev-watch.ts +430 -0
- package/src/file-syncer.ts +205 -0
- package/src/index.ts +1 -85
- package/src/mcp.ts +190 -0
- package/src/options.ts +260 -0
- package/src/types.ts +27 -0
- package/src/ui-environment.ts +74 -0
- package/src/ui-prompts.ts +322 -0
- package/src/utils.ts +38 -0
- package/tests/command-line.test.ts +304 -0
- package/tests/index.test.ts +9 -0
- package/tests/mcp.test.ts +225 -0
- package/tests/options.test.ts +304 -0
- package/tests/setupVitest.ts +6 -0
- package/tests/ui-environment.test.ts +97 -0
- package/tests/ui-prompts.test.ts +238 -0
- package/tsconfig.json +17 -0
- package/vitest.config.js +7 -0
- package/dist/bin.cjs +0 -761
- package/dist/bin.d.cts +0 -1
- package/dist/bin.d.mts +0 -1
- package/dist/bin.mjs +0 -760
- package/dist/index.cjs +0 -36
- package/dist/index.d.cts +0 -1172
- package/dist/index.d.mts +0 -1172
- package/dist/index.mjs +0 -3
- package/dist/template-CkAkdP8n.mjs +0 -2545
- package/dist/template-Cup47s9h.cjs +0 -2783
- package/src/api/fetch.test.ts +0 -114
- package/src/api/fetch.ts +0 -249
- package/src/cache/index.ts +0 -89
- package/src/commands/create.ts +0 -463
- package/src/commands/mcp.test.ts +0 -152
- package/src/commands/mcp.ts +0 -203
- package/src/engine/compile-with-addons.test.ts +0 -302
- package/src/engine/compile.test.ts +0 -404
- package/src/engine/compile.ts +0 -551
- package/src/engine/config-file.test.ts +0 -118
- package/src/engine/config-file.ts +0 -61
- package/src/engine/custom-addons/integration.ts +0 -323
- package/src/engine/custom-addons/shared.test.ts +0 -98
- package/src/engine/custom-addons/shared.ts +0 -281
- package/src/engine/custom-addons/template.test.ts +0 -288
- package/src/engine/custom-addons/template.ts +0 -124
- package/src/engine/template.test.ts +0 -256
- package/src/engine/template.ts +0 -269
- package/src/engine/types.ts +0 -336
- package/src/parse-gitignore.d.ts +0 -5
- package/src/templates/base.ts +0 -891
package/src/engine/types.ts
DELETED
|
@@ -1,336 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod'
|
|
2
|
-
|
|
3
|
-
// Package manager options
|
|
4
|
-
export type PackageManager = 'npm' | 'pnpm' | 'yarn' | 'bun' | 'deno'
|
|
5
|
-
|
|
6
|
-
// Feature categories for UI grouping
|
|
7
|
-
export const CategorySchema = z.enum([
|
|
8
|
-
'tanstack',
|
|
9
|
-
'database',
|
|
10
|
-
'orm',
|
|
11
|
-
'auth',
|
|
12
|
-
'deploy',
|
|
13
|
-
'tooling',
|
|
14
|
-
'monitoring',
|
|
15
|
-
'api',
|
|
16
|
-
'i18n',
|
|
17
|
-
'cms',
|
|
18
|
-
'other',
|
|
19
|
-
])
|
|
20
|
-
export type Category = z.infer<typeof CategorySchema>
|
|
21
|
-
|
|
22
|
-
// Integration types
|
|
23
|
-
export const IntegrationTypeSchema = z.enum([
|
|
24
|
-
'integration',
|
|
25
|
-
'example',
|
|
26
|
-
'toolchain',
|
|
27
|
-
'deployment',
|
|
28
|
-
])
|
|
29
|
-
export type IntegrationType = z.infer<typeof IntegrationTypeSchema>
|
|
30
|
-
|
|
31
|
-
// Integration phases
|
|
32
|
-
export const IntegrationPhaseSchema = z.enum(['setup', 'integration', 'example'])
|
|
33
|
-
export type IntegrationPhase = z.infer<typeof IntegrationPhaseSchema>
|
|
34
|
-
|
|
35
|
-
// Router modes
|
|
36
|
-
export const RouterModeSchema = z.enum(['file-router', 'code-router'])
|
|
37
|
-
export type RouterMode = z.infer<typeof RouterModeSchema>
|
|
38
|
-
|
|
39
|
-
// Option schemas
|
|
40
|
-
export const SelectOptionSchema = z.object({
|
|
41
|
-
type: z.literal('select'),
|
|
42
|
-
label: z.string(),
|
|
43
|
-
description: z.string().optional(),
|
|
44
|
-
default: z.string(),
|
|
45
|
-
options: z.array(
|
|
46
|
-
z.object({
|
|
47
|
-
value: z.string(),
|
|
48
|
-
label: z.string(),
|
|
49
|
-
}),
|
|
50
|
-
),
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
export const BooleanOptionSchema = z.object({
|
|
54
|
-
type: z.literal('boolean'),
|
|
55
|
-
label: z.string(),
|
|
56
|
-
description: z.string().optional(),
|
|
57
|
-
default: z.boolean(),
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
export const StringOptionSchema = z.object({
|
|
61
|
-
type: z.literal('string'),
|
|
62
|
-
label: z.string(),
|
|
63
|
-
description: z.string().optional(),
|
|
64
|
-
default: z.string(),
|
|
65
|
-
})
|
|
66
|
-
|
|
67
|
-
export const IntegrationOptionSchema = z.discriminatedUnion('type', [
|
|
68
|
-
SelectOptionSchema,
|
|
69
|
-
BooleanOptionSchema,
|
|
70
|
-
StringOptionSchema,
|
|
71
|
-
])
|
|
72
|
-
export type IntegrationOption = z.infer<typeof IntegrationOptionSchema>
|
|
73
|
-
|
|
74
|
-
export const IntegrationOptionsSchema = z.record(z.string(), IntegrationOptionSchema)
|
|
75
|
-
export type IntegrationOptions = z.infer<typeof IntegrationOptionsSchema>
|
|
76
|
-
|
|
77
|
-
// Hook schemas (code injection points)
|
|
78
|
-
export const HookTypeSchema = z.enum([
|
|
79
|
-
'header-user',
|
|
80
|
-
'provider',
|
|
81
|
-
'root-provider',
|
|
82
|
-
'layout',
|
|
83
|
-
'vite-plugin',
|
|
84
|
-
'devtools',
|
|
85
|
-
'entry-client',
|
|
86
|
-
])
|
|
87
|
-
export type HookType = z.infer<typeof HookTypeSchema>
|
|
88
|
-
|
|
89
|
-
export const HookSchema = z.object({
|
|
90
|
-
type: HookTypeSchema.optional(),
|
|
91
|
-
path: z.string().optional(),
|
|
92
|
-
jsName: z.string().optional(),
|
|
93
|
-
import: z.string().optional(),
|
|
94
|
-
code: z.string().optional(),
|
|
95
|
-
})
|
|
96
|
-
export type Hook = z.infer<typeof HookSchema>
|
|
97
|
-
|
|
98
|
-
// Route schema
|
|
99
|
-
export interface Route {
|
|
100
|
-
url?: string
|
|
101
|
-
name?: string
|
|
102
|
-
icon?: string
|
|
103
|
-
path: string
|
|
104
|
-
jsName: string
|
|
105
|
-
children?: Array<Route>
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export const RouteSchema: z.ZodType<Route> = z.object({
|
|
109
|
-
url: z.string().optional(),
|
|
110
|
-
name: z.string().optional(),
|
|
111
|
-
icon: z.string().optional(),
|
|
112
|
-
path: z.string(),
|
|
113
|
-
jsName: z.string(),
|
|
114
|
-
children: z.array(z.lazy(() => RouteSchema)).optional(),
|
|
115
|
-
})
|
|
116
|
-
|
|
117
|
-
// Environment variable schema
|
|
118
|
-
export const EnvVarSchema = z.object({
|
|
119
|
-
name: z.string(),
|
|
120
|
-
description: z.string(),
|
|
121
|
-
required: z.boolean().optional(),
|
|
122
|
-
example: z.string().optional(),
|
|
123
|
-
})
|
|
124
|
-
export type EnvVar = z.infer<typeof EnvVarSchema>
|
|
125
|
-
|
|
126
|
-
// Command schema
|
|
127
|
-
export const CommandSchema = z.object({
|
|
128
|
-
command: z.string(),
|
|
129
|
-
args: z.array(z.string()).optional(),
|
|
130
|
-
})
|
|
131
|
-
export type Command = z.infer<typeof CommandSchema>
|
|
132
|
-
|
|
133
|
-
// Integration info schema (what's in info.json)
|
|
134
|
-
export const IntegrationInfoSchema = z.object({
|
|
135
|
-
// Identity
|
|
136
|
-
id: z.string().optional(), // Auto-generated from directory name
|
|
137
|
-
name: z.string(),
|
|
138
|
-
description: z.string(),
|
|
139
|
-
author: z.string().optional(),
|
|
140
|
-
version: z.string().optional(),
|
|
141
|
-
link: z.string().optional(),
|
|
142
|
-
license: z.string().optional(),
|
|
143
|
-
warning: z.string().optional(),
|
|
144
|
-
|
|
145
|
-
// Classification
|
|
146
|
-
type: IntegrationTypeSchema,
|
|
147
|
-
phase: IntegrationPhaseSchema,
|
|
148
|
-
category: CategorySchema.optional(),
|
|
149
|
-
modes: z.array(RouterModeSchema),
|
|
150
|
-
priority: z.number().optional(),
|
|
151
|
-
default: z.boolean().optional(),
|
|
152
|
-
|
|
153
|
-
// Tailwind dependencies
|
|
154
|
-
// requiresTailwind: integration won't work without Tailwind (e.g., shadcn)
|
|
155
|
-
// demoRequiresTailwind: demo uses Tailwind, but core integration doesn't
|
|
156
|
-
requiresTailwind: z.boolean().optional(),
|
|
157
|
-
demoRequiresTailwind: z.boolean().optional(),
|
|
158
|
-
|
|
159
|
-
// Dependencies
|
|
160
|
-
dependsOn: z.array(z.string()).optional(),
|
|
161
|
-
// Exclusive types - only one integration per exclusive type can be selected
|
|
162
|
-
// e.g., exclusive: ['deploy'] means only one deploy integration at a time
|
|
163
|
-
exclusive: z.array(z.string()).optional(),
|
|
164
|
-
|
|
165
|
-
// Partner integration
|
|
166
|
-
partnerId: z.string().optional(),
|
|
167
|
-
|
|
168
|
-
// Configuration
|
|
169
|
-
options: IntegrationOptionsSchema.optional(),
|
|
170
|
-
|
|
171
|
-
// Hooks (code injection points)
|
|
172
|
-
hooks: z.array(HookSchema).optional(),
|
|
173
|
-
routes: z.array(RouteSchema).optional(),
|
|
174
|
-
|
|
175
|
-
// Package additions
|
|
176
|
-
packageAdditions: z
|
|
177
|
-
.object({
|
|
178
|
-
dependencies: z.record(z.string(), z.string()).optional(),
|
|
179
|
-
devDependencies: z.record(z.string(), z.string()).optional(),
|
|
180
|
-
scripts: z.record(z.string(), z.string()).optional(),
|
|
181
|
-
})
|
|
182
|
-
.optional(),
|
|
183
|
-
|
|
184
|
-
// Shadcn components to install
|
|
185
|
-
shadcnComponents: z.array(z.string()).optional(),
|
|
186
|
-
|
|
187
|
-
// Gitignore patterns to add
|
|
188
|
-
gitignorePatterns: z.array(z.string()).optional(),
|
|
189
|
-
|
|
190
|
-
// Environment variables
|
|
191
|
-
envVars: z.array(EnvVarSchema).optional(),
|
|
192
|
-
|
|
193
|
-
// Commands to run
|
|
194
|
-
command: CommandSchema.optional(),
|
|
195
|
-
|
|
196
|
-
// Special steps
|
|
197
|
-
integrationSpecialSteps: z.array(z.string()).optional(),
|
|
198
|
-
createSpecialSteps: z.array(z.string()).optional(),
|
|
199
|
-
postInitSpecialSteps: z.array(z.string()).optional(),
|
|
200
|
-
|
|
201
|
-
// Visual assets
|
|
202
|
-
smallLogo: z.string().optional(),
|
|
203
|
-
logo: z.string().optional(),
|
|
204
|
-
readme: z.string().optional(),
|
|
205
|
-
})
|
|
206
|
-
export type IntegrationInfo = z.infer<typeof IntegrationInfoSchema>
|
|
207
|
-
|
|
208
|
-
// Compiled integration (info + files)
|
|
209
|
-
export const IntegrationCompiledSchema = IntegrationInfoSchema.extend({
|
|
210
|
-
id: z.string(), // Required after compilation
|
|
211
|
-
files: z.record(z.string(), z.string()),
|
|
212
|
-
deletedFiles: z.array(z.string()).optional(),
|
|
213
|
-
})
|
|
214
|
-
export type IntegrationCompiled = z.infer<typeof IntegrationCompiledSchema>
|
|
215
|
-
|
|
216
|
-
// Custom template schema - a curated collection of integrations with preset options
|
|
217
|
-
// Custom templates are just integration presets, nothing more
|
|
218
|
-
export const CustomTemplateInfoSchema = z.object({
|
|
219
|
-
// Identity
|
|
220
|
-
id: z.string().optional(),
|
|
221
|
-
name: z.string(),
|
|
222
|
-
description: z.string(),
|
|
223
|
-
|
|
224
|
-
// Project defaults
|
|
225
|
-
framework: z.string(),
|
|
226
|
-
mode: RouterModeSchema,
|
|
227
|
-
typescript: z.boolean(),
|
|
228
|
-
tailwind: z.boolean(),
|
|
229
|
-
|
|
230
|
-
// Core: which integrations to include (integration IDs or custom integration URLs)
|
|
231
|
-
integrations: z.array(z.string()),
|
|
232
|
-
|
|
233
|
-
// Preset integration options
|
|
234
|
-
integrationOptions: z.record(z.string(), z.record(z.string(), z.unknown())).optional(),
|
|
235
|
-
|
|
236
|
-
// Display
|
|
237
|
-
banner: z.string().optional(),
|
|
238
|
-
})
|
|
239
|
-
export type CustomTemplateInfo = z.infer<typeof CustomTemplateInfoSchema>
|
|
240
|
-
|
|
241
|
-
export const CustomTemplateCompiledSchema = CustomTemplateInfoSchema.extend({
|
|
242
|
-
id: z.string(),
|
|
243
|
-
})
|
|
244
|
-
export type CustomTemplateCompiled = z.infer<typeof CustomTemplateCompiledSchema>
|
|
245
|
-
|
|
246
|
-
// Manifest schema (lightweight index of integrations)
|
|
247
|
-
export const ManifestIntegrationSchema = z.object({
|
|
248
|
-
id: z.string(),
|
|
249
|
-
name: z.string(),
|
|
250
|
-
description: z.string(),
|
|
251
|
-
type: IntegrationTypeSchema,
|
|
252
|
-
category: CategorySchema.optional(),
|
|
253
|
-
modes: z.array(RouterModeSchema),
|
|
254
|
-
dependsOn: z.array(z.string()).optional(),
|
|
255
|
-
// Exclusive types - only one integration per exclusive type can be selected
|
|
256
|
-
exclusive: z.array(z.string()).optional(),
|
|
257
|
-
partnerId: z.string().optional(),
|
|
258
|
-
hasOptions: z.boolean().optional(),
|
|
259
|
-
link: z.string().optional(),
|
|
260
|
-
color: z.string().optional(),
|
|
261
|
-
// Tailwind dependencies
|
|
262
|
-
requiresTailwind: z.boolean().optional(),
|
|
263
|
-
demoRequiresTailwind: z.boolean().optional(),
|
|
264
|
-
})
|
|
265
|
-
export type ManifestIntegration = z.infer<typeof ManifestIntegrationSchema>
|
|
266
|
-
|
|
267
|
-
export const ManifestCustomTemplateSchema = z.object({
|
|
268
|
-
id: z.string(),
|
|
269
|
-
name: z.string(),
|
|
270
|
-
description: z.string(),
|
|
271
|
-
banner: z.string().optional(),
|
|
272
|
-
icon: z.string().optional(),
|
|
273
|
-
features: z.array(z.string()).optional(),
|
|
274
|
-
})
|
|
275
|
-
|
|
276
|
-
export const ManifestSchema = z.object({
|
|
277
|
-
version: z.string(),
|
|
278
|
-
generated: z.string(),
|
|
279
|
-
integrations: z.array(ManifestIntegrationSchema),
|
|
280
|
-
customTemplates: z.array(ManifestCustomTemplateSchema).optional(),
|
|
281
|
-
})
|
|
282
|
-
export type Manifest = z.infer<typeof ManifestSchema>
|
|
283
|
-
|
|
284
|
-
// Project definition (what the user configures)
|
|
285
|
-
export interface ProjectDefinition {
|
|
286
|
-
name: string
|
|
287
|
-
framework: string
|
|
288
|
-
mode: RouterMode
|
|
289
|
-
typescript: boolean
|
|
290
|
-
tailwind: boolean
|
|
291
|
-
integrations: Array<string>
|
|
292
|
-
integrationOptions: Record<string, Record<string, unknown>>
|
|
293
|
-
customTemplate?: string
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
// Compile options
|
|
297
|
-
export interface CompileOptions {
|
|
298
|
-
projectName: string
|
|
299
|
-
framework: string
|
|
300
|
-
mode: RouterMode
|
|
301
|
-
typescript: boolean
|
|
302
|
-
tailwind: boolean
|
|
303
|
-
packageManager: PackageManager
|
|
304
|
-
chosenIntegrations: Array<IntegrationCompiled>
|
|
305
|
-
integrationOptions: Record<string, Record<string, unknown>>
|
|
306
|
-
customTemplate?: CustomTemplateCompiled
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
// Compile output
|
|
310
|
-
export interface CompileOutput {
|
|
311
|
-
files: Record<string, string>
|
|
312
|
-
packages: {
|
|
313
|
-
dependencies: Record<string, string>
|
|
314
|
-
devDependencies: Record<string, string>
|
|
315
|
-
scripts: Record<string, string>
|
|
316
|
-
}
|
|
317
|
-
envVars: Array<EnvVar>
|
|
318
|
-
warnings: Array<string>
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
// Line attribution for showing which integration contributed each line
|
|
322
|
-
export interface LineAttribution {
|
|
323
|
-
lineNumber: number
|
|
324
|
-
featureId: string | 'base'
|
|
325
|
-
featureName: string
|
|
326
|
-
}
|
|
327
|
-
|
|
328
|
-
export interface AttributedFile {
|
|
329
|
-
path: string
|
|
330
|
-
content: string
|
|
331
|
-
attributions: Array<LineAttribution>
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
export interface AttributedCompileOutput extends CompileOutput {
|
|
335
|
-
attributedFiles: Record<string, AttributedFile>
|
|
336
|
-
}
|