create-fornix 0.0.2 → 0.0.4
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/dist/index.js +747 -243
- package/dist/index.js.map +1 -1
- package/package.json +18 -18
package/dist/index.js
CHANGED
|
@@ -213,7 +213,7 @@ function topologicalSort(blocks, manifests) {
|
|
|
213
213
|
}
|
|
214
214
|
|
|
215
215
|
// src/scaffold/structure-generator.ts
|
|
216
|
-
function generateStructure(config) {
|
|
216
|
+
function generateStructure(config, manifests = []) {
|
|
217
217
|
const files = {};
|
|
218
218
|
const adapterDeps = getAdapterDependencies(config);
|
|
219
219
|
const pkg = {
|
|
@@ -278,16 +278,35 @@ pnpm-debug.log*
|
|
|
278
278
|
.DS_Store
|
|
279
279
|
Thumbs.db
|
|
280
280
|
`.trim() + "\n";
|
|
281
|
-
|
|
281
|
+
const blockImports = [];
|
|
282
|
+
const blockComponents = [];
|
|
283
|
+
if (manifests.length > 0) {
|
|
284
|
+
for (const manifest2 of manifests) {
|
|
285
|
+
if (manifest2.type !== "section") continue;
|
|
286
|
+
const mainFile = manifest2.files.find((f) => f.destination.endsWith(".astro") || f.destination.endsWith(".tsx"));
|
|
287
|
+
if (mainFile) {
|
|
288
|
+
const componentName = manifest2.name.split("-").map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
289
|
+
let importPath = mainFile.destination;
|
|
290
|
+
if (importPath.startsWith("src/")) {
|
|
291
|
+
importPath = "../" + importPath.substring(4);
|
|
292
|
+
}
|
|
293
|
+
blockImports.push(`import ${componentName} from '${importPath}';`);
|
|
294
|
+
blockComponents.push(` <${componentName} />`);
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const indexAstroContent = `
|
|
282
299
|
---
|
|
283
300
|
import Layout from '../layouts/Layout.astro';
|
|
301
|
+
${blockImports.join("\n")}
|
|
284
302
|
---
|
|
285
|
-
<Layout title="Welcome to
|
|
303
|
+
<Layout title="Welcome to ${config.projectName}.">
|
|
286
304
|
<main>
|
|
287
|
-
<h1>Welcome to <span class="text-gradient">${config.projectName}</span></h1
|
|
305
|
+
${blockComponents.length > 0 ? blockComponents.join("\n") : ` <h1>Welcome to <span class="text-gradient">${config.projectName}</span></h1>`}
|
|
288
306
|
</main>
|
|
289
307
|
</Layout>
|
|
290
|
-
`.trim() + "
|
|
308
|
+
`.trim() + "\\n";
|
|
309
|
+
files["src/pages/index.astro"] = indexAstroContent;
|
|
291
310
|
files["src/layouts/Layout.astro"] = `
|
|
292
311
|
---
|
|
293
312
|
interface Props {
|
|
@@ -584,11 +603,12 @@ function generateContentConfig(blocks) {
|
|
|
584
603
|
'import { defineCollection, z } from "astro:content";'
|
|
585
604
|
];
|
|
586
605
|
const collections = [];
|
|
606
|
+
const dataCollections = /* @__PURE__ */ new Map();
|
|
587
607
|
for (const block of blocks) {
|
|
588
608
|
if (block.collections && block.collections.length > 0) {
|
|
589
609
|
for (const col of block.collections) {
|
|
590
610
|
const importName = `${block.name.replace(/-/g, "")}${col.name}Schema`;
|
|
591
|
-
const importPath = col.schemaSource.replace(
|
|
611
|
+
const importPath = col.schemaSource.replace(/\\.ts$/, "");
|
|
592
612
|
imports.push(`import { schema as ${importName} } from "${importPath}";`);
|
|
593
613
|
collections.push(
|
|
594
614
|
` "${col.name}": defineCollection({
|
|
@@ -600,17 +620,30 @@ function generateContentConfig(blocks) {
|
|
|
600
620
|
}
|
|
601
621
|
const slots = block.ai?.contentSlots;
|
|
602
622
|
if (slots && Object.keys(slots).length > 0) {
|
|
603
|
-
const schemaFields = Object.entries(slots).map(([name, slot]) => `
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
623
|
+
const schemaFields = Object.entries(slots).map(([name, slot]) => ` ${name}: ${zodTypeForSlot(slot)}.optional(),`).join("\n");
|
|
624
|
+
const subdirectory = TYPE_DIRECTORY[block.type] ?? block.type;
|
|
625
|
+
if (!dataCollections.has(subdirectory)) {
|
|
626
|
+
dataCollections.set(subdirectory, []);
|
|
627
|
+
}
|
|
628
|
+
dataCollections.get(subdirectory).push(
|
|
629
|
+
` // ${block.name}
|
|
630
|
+
z.object({
|
|
608
631
|
${schemaFields}
|
|
609
|
-
})
|
|
610
|
-
})`
|
|
632
|
+
})`
|
|
611
633
|
);
|
|
612
634
|
}
|
|
613
635
|
}
|
|
636
|
+
for (const [colName, schemas] of dataCollections.entries()) {
|
|
637
|
+
const schemaStr = schemas.length === 1 ? schemas[0] : `z.union([
|
|
638
|
+
${schemas.join(",\n")}
|
|
639
|
+
])`;
|
|
640
|
+
collections.push(
|
|
641
|
+
` "${colName}": defineCollection({
|
|
642
|
+
type: "data",
|
|
643
|
+
schema: ${schemaStr},
|
|
644
|
+
})`
|
|
645
|
+
);
|
|
646
|
+
}
|
|
614
647
|
const lines = [
|
|
615
648
|
...imports,
|
|
616
649
|
"",
|
|
@@ -789,13 +822,13 @@ function scaffold(input) {
|
|
|
789
822
|
const selectedBlockNames = config.blocks.map((block) => block.name);
|
|
790
823
|
const dependencyResult = resolveDependencies(selectedBlockNames, manifests);
|
|
791
824
|
if (!isOk(dependencyResult)) {
|
|
792
|
-
return err(new Error(
|
|
825
|
+
return err(Object.assign(new Error(dependencyResult.error.message), dependencyResult.error));
|
|
793
826
|
}
|
|
794
827
|
const resolvedBlockNames = dependencyResult.value;
|
|
795
828
|
const files = {};
|
|
796
|
-
const structureFiles = generateStructure(config);
|
|
797
|
-
Object.assign(files, structureFiles);
|
|
798
829
|
const resolvedManifests = resolvedBlockNames.filter((name) => manifests[name] !== void 0).map((name) => manifests[name]);
|
|
830
|
+
const structureFiles = generateStructure(config, resolvedManifests);
|
|
831
|
+
Object.assign(files, structureFiles);
|
|
799
832
|
const astroConfigResult = generateAstroConfig(config, resolvedManifests);
|
|
800
833
|
if (!isOk(astroConfigResult)) {
|
|
801
834
|
return err(astroConfigResult.error);
|
|
@@ -898,6 +931,535 @@ function generateProjectManifest(config, blocks) {
|
|
|
898
931
|
return JSON.stringify(manifest2, null, 2) + "\n";
|
|
899
932
|
}
|
|
900
933
|
|
|
934
|
+
// ../fornix-registry/src/schemas/block-manifest.ts
|
|
935
|
+
import { z } from "zod";
|
|
936
|
+
var BlockFileSchema = z.object({
|
|
937
|
+
source: z.string().min(1),
|
|
938
|
+
destination: z.string().min(1),
|
|
939
|
+
condition: z.string().optional()
|
|
940
|
+
});
|
|
941
|
+
var EnvVarSchema = z.object({
|
|
942
|
+
name: z.string().min(1),
|
|
943
|
+
description: z.string().min(1),
|
|
944
|
+
required: z.boolean()
|
|
945
|
+
});
|
|
946
|
+
var ContentSlotSchema = z.object({
|
|
947
|
+
type: z.enum(["string", "number", "boolean", "array", "object"]),
|
|
948
|
+
description: z.string().optional(),
|
|
949
|
+
maxLength: z.number().int().positive().optional(),
|
|
950
|
+
example: z.unknown().optional(),
|
|
951
|
+
items: z.record(z.unknown()).optional(),
|
|
952
|
+
minItems: z.number().int().nonnegative().optional(),
|
|
953
|
+
maxItems: z.number().int().positive().optional()
|
|
954
|
+
});
|
|
955
|
+
var BlockCollectionSchema = z.object({
|
|
956
|
+
name: z.string().min(1),
|
|
957
|
+
type: z.enum(["data", "content"]),
|
|
958
|
+
schemaSource: z.string().min(1)
|
|
959
|
+
});
|
|
960
|
+
var BlockAIMetadataSchema = z.object({
|
|
961
|
+
whenToUse: z.string().min(1),
|
|
962
|
+
whenNotToUse: z.string().min(1),
|
|
963
|
+
pairsWith: z.array(z.string()),
|
|
964
|
+
contentSlots: z.record(ContentSlotSchema).optional()
|
|
965
|
+
});
|
|
966
|
+
var BlockManifestSchema = z.object({
|
|
967
|
+
schemaVersion: z.number().int().positive(),
|
|
968
|
+
name: z.string().regex(
|
|
969
|
+
/^[a-z][a-z0-9-]*$/,
|
|
970
|
+
"Block name must be kebab-case, starting with a lowercase letter (regex: ^[a-z][a-z0-9-]*$)"
|
|
971
|
+
),
|
|
972
|
+
version: z.string().min(1),
|
|
973
|
+
type: z.enum(["section", "integration", "feature", "layout"]),
|
|
974
|
+
description: z.string().min(1).max(200),
|
|
975
|
+
category: z.string().min(1),
|
|
976
|
+
tags: z.array(z.string()),
|
|
977
|
+
dependencies: z.record(z.string()),
|
|
978
|
+
requires: z.array(z.string()),
|
|
979
|
+
conflicts: z.array(z.string()),
|
|
980
|
+
requiredMode: z.enum(["static", "hybrid", "server"]).optional(),
|
|
981
|
+
envVars: z.array(EnvVarSchema),
|
|
982
|
+
variants: z.array(z.string()),
|
|
983
|
+
slots: z.array(z.string()),
|
|
984
|
+
files: z.array(BlockFileSchema),
|
|
985
|
+
collections: z.array(BlockCollectionSchema).optional(),
|
|
986
|
+
ai: BlockAIMetadataSchema.optional()
|
|
987
|
+
});
|
|
988
|
+
|
|
989
|
+
// ../fornix-registry/src/schemas/palette.ts
|
|
990
|
+
import { z as z2 } from "zod";
|
|
991
|
+
var HexColorSchema = z2.string().regex(/^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6})$/, "Must be a valid hex color (e.g. #ff00aa or #fff)");
|
|
992
|
+
var PaletteSchema = z2.object({
|
|
993
|
+
schemaVersion: z2.number().int().positive(),
|
|
994
|
+
name: z2.string().regex(
|
|
995
|
+
/^[a-z][a-z0-9-]*$/,
|
|
996
|
+
"Palette name must be kebab-case, starting with a lowercase letter"
|
|
997
|
+
),
|
|
998
|
+
displayName: z2.string().min(1),
|
|
999
|
+
category: z2.string().min(1),
|
|
1000
|
+
mode: z2.enum(["light", "dark"]),
|
|
1001
|
+
colors: z2.object({
|
|
1002
|
+
primary: HexColorSchema,
|
|
1003
|
+
secondary: HexColorSchema,
|
|
1004
|
+
accent: HexColorSchema,
|
|
1005
|
+
background: HexColorSchema,
|
|
1006
|
+
foreground: HexColorSchema
|
|
1007
|
+
})
|
|
1008
|
+
});
|
|
1009
|
+
var PaletteRegistrySchema = z2.array(PaletteSchema);
|
|
1010
|
+
|
|
1011
|
+
// ../fornix-registry/src/builtin-palettes.ts
|
|
1012
|
+
var BUILTIN_PALETTES = [
|
|
1013
|
+
{
|
|
1014
|
+
schemaVersion: 1,
|
|
1015
|
+
name: "arctic",
|
|
1016
|
+
displayName: "Arctic",
|
|
1017
|
+
category: "nature",
|
|
1018
|
+
mode: "light",
|
|
1019
|
+
colors: {
|
|
1020
|
+
primary: "#0ea5e9",
|
|
1021
|
+
secondary: "#38bdf8",
|
|
1022
|
+
accent: "#6366f1",
|
|
1023
|
+
background: "#f0f9ff",
|
|
1024
|
+
foreground: "#0c4a6e"
|
|
1025
|
+
}
|
|
1026
|
+
},
|
|
1027
|
+
{
|
|
1028
|
+
schemaVersion: 1,
|
|
1029
|
+
name: "charcoal",
|
|
1030
|
+
displayName: "Charcoal",
|
|
1031
|
+
category: "dark",
|
|
1032
|
+
mode: "dark",
|
|
1033
|
+
colors: {
|
|
1034
|
+
primary: "#3b82f6",
|
|
1035
|
+
secondary: "#60a5fa",
|
|
1036
|
+
accent: "#f59e0b",
|
|
1037
|
+
background: "#1c1917",
|
|
1038
|
+
foreground: "#e7e5e4"
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
schemaVersion: 1,
|
|
1043
|
+
name: "copper",
|
|
1044
|
+
displayName: "Copper",
|
|
1045
|
+
category: "warm",
|
|
1046
|
+
mode: "dark",
|
|
1047
|
+
colors: {
|
|
1048
|
+
primary: "#b45309",
|
|
1049
|
+
secondary: "#d97706",
|
|
1050
|
+
accent: "#06b6d4",
|
|
1051
|
+
background: "#27272a",
|
|
1052
|
+
foreground: "#fef3c7"
|
|
1053
|
+
}
|
|
1054
|
+
},
|
|
1055
|
+
{
|
|
1056
|
+
schemaVersion: 1,
|
|
1057
|
+
name: "corporate-blue",
|
|
1058
|
+
displayName: "Corporate Blue",
|
|
1059
|
+
category: "professional",
|
|
1060
|
+
mode: "light",
|
|
1061
|
+
colors: {
|
|
1062
|
+
primary: "#1e40af",
|
|
1063
|
+
secondary: "#2563eb",
|
|
1064
|
+
accent: "#0d9488",
|
|
1065
|
+
background: "#f0f9ff",
|
|
1066
|
+
foreground: "#1e3a5f"
|
|
1067
|
+
}
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
schemaVersion: 1,
|
|
1071
|
+
name: "cotton",
|
|
1072
|
+
displayName: "Cotton",
|
|
1073
|
+
category: "light",
|
|
1074
|
+
mode: "light",
|
|
1075
|
+
colors: {
|
|
1076
|
+
primary: "#7c3aed",
|
|
1077
|
+
secondary: "#8b5cf6",
|
|
1078
|
+
accent: "#10b981",
|
|
1079
|
+
background: "#fafaf9",
|
|
1080
|
+
foreground: "#1c1917"
|
|
1081
|
+
}
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
schemaVersion: 1,
|
|
1085
|
+
name: "cream",
|
|
1086
|
+
displayName: "Cream",
|
|
1087
|
+
category: "light",
|
|
1088
|
+
mode: "light",
|
|
1089
|
+
colors: {
|
|
1090
|
+
primary: "#b45309",
|
|
1091
|
+
secondary: "#d97706",
|
|
1092
|
+
accent: "#059669",
|
|
1093
|
+
background: "#fffbeb",
|
|
1094
|
+
foreground: "#451a03"
|
|
1095
|
+
}
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
schemaVersion: 1,
|
|
1099
|
+
name: "cyber-punk",
|
|
1100
|
+
displayName: "Cyber Punk",
|
|
1101
|
+
category: "vibrant",
|
|
1102
|
+
mode: "dark",
|
|
1103
|
+
colors: {
|
|
1104
|
+
primary: "#eab308",
|
|
1105
|
+
secondary: "#facc15",
|
|
1106
|
+
accent: "#ec4899",
|
|
1107
|
+
background: "#0a0a0a",
|
|
1108
|
+
foreground: "#fef9c3"
|
|
1109
|
+
}
|
|
1110
|
+
},
|
|
1111
|
+
{
|
|
1112
|
+
schemaVersion: 1,
|
|
1113
|
+
name: "deep-sea",
|
|
1114
|
+
displayName: "Deep Sea",
|
|
1115
|
+
category: "cool",
|
|
1116
|
+
mode: "dark",
|
|
1117
|
+
colors: {
|
|
1118
|
+
primary: "#06b6d4",
|
|
1119
|
+
secondary: "#22d3ee",
|
|
1120
|
+
accent: "#f97316",
|
|
1121
|
+
background: "#042f2e",
|
|
1122
|
+
foreground: "#ccfbf1"
|
|
1123
|
+
}
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
schemaVersion: 1,
|
|
1127
|
+
name: "desert-sand",
|
|
1128
|
+
displayName: "Desert Sand",
|
|
1129
|
+
category: "nature",
|
|
1130
|
+
mode: "light",
|
|
1131
|
+
colors: {
|
|
1132
|
+
primary: "#c2410c",
|
|
1133
|
+
secondary: "#ea580c",
|
|
1134
|
+
accent: "#0d9488",
|
|
1135
|
+
background: "#fef3c7",
|
|
1136
|
+
foreground: "#431407"
|
|
1137
|
+
}
|
|
1138
|
+
},
|
|
1139
|
+
{
|
|
1140
|
+
schemaVersion: 1,
|
|
1141
|
+
name: "electric-violet",
|
|
1142
|
+
displayName: "Electric Violet",
|
|
1143
|
+
category: "vibrant",
|
|
1144
|
+
mode: "dark",
|
|
1145
|
+
colors: {
|
|
1146
|
+
primary: "#8b5cf6",
|
|
1147
|
+
secondary: "#a78bfa",
|
|
1148
|
+
accent: "#34d399",
|
|
1149
|
+
background: "#1e1b4b",
|
|
1150
|
+
foreground: "#ede9fe"
|
|
1151
|
+
}
|
|
1152
|
+
},
|
|
1153
|
+
{
|
|
1154
|
+
schemaVersion: 1,
|
|
1155
|
+
name: "ember",
|
|
1156
|
+
displayName: "Ember",
|
|
1157
|
+
category: "warm",
|
|
1158
|
+
mode: "dark",
|
|
1159
|
+
colors: {
|
|
1160
|
+
primary: "#ef4444",
|
|
1161
|
+
secondary: "#f87171",
|
|
1162
|
+
accent: "#fbbf24",
|
|
1163
|
+
background: "#1c1917",
|
|
1164
|
+
foreground: "#fef2f2"
|
|
1165
|
+
}
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
schemaVersion: 1,
|
|
1169
|
+
name: "executive",
|
|
1170
|
+
displayName: "Executive",
|
|
1171
|
+
category: "professional",
|
|
1172
|
+
mode: "dark",
|
|
1173
|
+
colors: {
|
|
1174
|
+
primary: "#d4af37",
|
|
1175
|
+
secondary: "#f5d063",
|
|
1176
|
+
accent: "#4ade80",
|
|
1177
|
+
background: "#1a1a2e",
|
|
1178
|
+
foreground: "#eef2ff"
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
{
|
|
1182
|
+
schemaVersion: 1,
|
|
1183
|
+
name: "fintech-dark",
|
|
1184
|
+
displayName: "Fintech Dark",
|
|
1185
|
+
category: "brand-inspired",
|
|
1186
|
+
mode: "dark",
|
|
1187
|
+
colors: {
|
|
1188
|
+
primary: "#10b981",
|
|
1189
|
+
secondary: "#34d399",
|
|
1190
|
+
accent: "#6366f1",
|
|
1191
|
+
background: "#0a0a0a",
|
|
1192
|
+
foreground: "#ecfdf5"
|
|
1193
|
+
}
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
schemaVersion: 1,
|
|
1197
|
+
name: "forest",
|
|
1198
|
+
displayName: "Forest",
|
|
1199
|
+
category: "nature",
|
|
1200
|
+
mode: "dark",
|
|
1201
|
+
colors: {
|
|
1202
|
+
primary: "#22c55e",
|
|
1203
|
+
secondary: "#4ade80",
|
|
1204
|
+
accent: "#fbbf24",
|
|
1205
|
+
background: "#14532d",
|
|
1206
|
+
foreground: "#dcfce7"
|
|
1207
|
+
}
|
|
1208
|
+
},
|
|
1209
|
+
{
|
|
1210
|
+
schemaVersion: 1,
|
|
1211
|
+
name: "frost",
|
|
1212
|
+
displayName: "Frost",
|
|
1213
|
+
category: "cool",
|
|
1214
|
+
mode: "light",
|
|
1215
|
+
colors: {
|
|
1216
|
+
primary: "#6366f1",
|
|
1217
|
+
secondary: "#818cf8",
|
|
1218
|
+
accent: "#f43f5e",
|
|
1219
|
+
background: "#eef2ff",
|
|
1220
|
+
foreground: "#312e81"
|
|
1221
|
+
}
|
|
1222
|
+
},
|
|
1223
|
+
{
|
|
1224
|
+
schemaVersion: 1,
|
|
1225
|
+
name: "glacier",
|
|
1226
|
+
displayName: "Glacier",
|
|
1227
|
+
category: "cool",
|
|
1228
|
+
mode: "light",
|
|
1229
|
+
colors: {
|
|
1230
|
+
primary: "#0284c7",
|
|
1231
|
+
secondary: "#0ea5e9",
|
|
1232
|
+
accent: "#c026d3",
|
|
1233
|
+
background: "#ecfeff",
|
|
1234
|
+
foreground: "#164e63"
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
schemaVersion: 1,
|
|
1239
|
+
name: "golden-hour",
|
|
1240
|
+
displayName: "Golden Hour",
|
|
1241
|
+
category: "warm",
|
|
1242
|
+
mode: "light",
|
|
1243
|
+
colors: {
|
|
1244
|
+
primary: "#d97706",
|
|
1245
|
+
secondary: "#f59e0b",
|
|
1246
|
+
accent: "#be185d",
|
|
1247
|
+
background: "#fffbeb",
|
|
1248
|
+
foreground: "#451a03"
|
|
1249
|
+
}
|
|
1250
|
+
},
|
|
1251
|
+
{
|
|
1252
|
+
schemaVersion: 1,
|
|
1253
|
+
name: "health-clean",
|
|
1254
|
+
displayName: "Health Clean",
|
|
1255
|
+
category: "brand-inspired",
|
|
1256
|
+
mode: "light",
|
|
1257
|
+
colors: {
|
|
1258
|
+
primary: "#0891b2",
|
|
1259
|
+
secondary: "#06b6d4",
|
|
1260
|
+
accent: "#16a34a",
|
|
1261
|
+
background: "#f0fdfa",
|
|
1262
|
+
foreground: "#134e4a"
|
|
1263
|
+
}
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
schemaVersion: 1,
|
|
1267
|
+
name: "luxury-gold",
|
|
1268
|
+
displayName: "Luxury Gold",
|
|
1269
|
+
category: "brand-inspired",
|
|
1270
|
+
mode: "dark",
|
|
1271
|
+
colors: {
|
|
1272
|
+
primary: "#d4af37",
|
|
1273
|
+
secondary: "#f5d063",
|
|
1274
|
+
accent: "#e11d48",
|
|
1275
|
+
background: "#0c0a09",
|
|
1276
|
+
foreground: "#fef9c3"
|
|
1277
|
+
}
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
schemaVersion: 1,
|
|
1281
|
+
name: "midnight",
|
|
1282
|
+
displayName: "Midnight",
|
|
1283
|
+
category: "dark",
|
|
1284
|
+
mode: "dark",
|
|
1285
|
+
colors: {
|
|
1286
|
+
primary: "#6366f1",
|
|
1287
|
+
secondary: "#818cf8",
|
|
1288
|
+
accent: "#c084fc",
|
|
1289
|
+
background: "#0f172a",
|
|
1290
|
+
foreground: "#f8fafc"
|
|
1291
|
+
}
|
|
1292
|
+
},
|
|
1293
|
+
{
|
|
1294
|
+
schemaVersion: 1,
|
|
1295
|
+
name: "neon-tokyo",
|
|
1296
|
+
displayName: "Neon Tokyo",
|
|
1297
|
+
category: "vibrant",
|
|
1298
|
+
mode: "dark",
|
|
1299
|
+
colors: {
|
|
1300
|
+
primary: "#f43f5e",
|
|
1301
|
+
secondary: "#fb7185",
|
|
1302
|
+
accent: "#22d3ee",
|
|
1303
|
+
background: "#0c0a09",
|
|
1304
|
+
foreground: "#fef2f2"
|
|
1305
|
+
}
|
|
1306
|
+
},
|
|
1307
|
+
{
|
|
1308
|
+
schemaVersion: 1,
|
|
1309
|
+
name: "obsidian",
|
|
1310
|
+
displayName: "Obsidian",
|
|
1311
|
+
category: "dark",
|
|
1312
|
+
mode: "dark",
|
|
1313
|
+
colors: {
|
|
1314
|
+
primary: "#a855f7",
|
|
1315
|
+
secondary: "#7c3aed",
|
|
1316
|
+
accent: "#f472b6",
|
|
1317
|
+
background: "#09090b",
|
|
1318
|
+
foreground: "#fafafa"
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
{
|
|
1322
|
+
schemaVersion: 1,
|
|
1323
|
+
name: "ocean-breeze",
|
|
1324
|
+
displayName: "Ocean Breeze",
|
|
1325
|
+
category: "nature",
|
|
1326
|
+
mode: "light",
|
|
1327
|
+
colors: {
|
|
1328
|
+
primary: "#0077b6",
|
|
1329
|
+
secondary: "#0096c7",
|
|
1330
|
+
accent: "#f4845f",
|
|
1331
|
+
background: "#caf0f8",
|
|
1332
|
+
foreground: "#023e8a"
|
|
1333
|
+
}
|
|
1334
|
+
},
|
|
1335
|
+
{
|
|
1336
|
+
schemaVersion: 1,
|
|
1337
|
+
name: "pearl",
|
|
1338
|
+
displayName: "Pearl",
|
|
1339
|
+
category: "light",
|
|
1340
|
+
mode: "light",
|
|
1341
|
+
colors: {
|
|
1342
|
+
primary: "#0891b2",
|
|
1343
|
+
secondary: "#06b6d4",
|
|
1344
|
+
accent: "#e11d48",
|
|
1345
|
+
background: "#f8fafc",
|
|
1346
|
+
foreground: "#0c4a6e"
|
|
1347
|
+
}
|
|
1348
|
+
},
|
|
1349
|
+
{
|
|
1350
|
+
schemaVersion: 1,
|
|
1351
|
+
name: "slate-modern",
|
|
1352
|
+
displayName: "Slate Modern",
|
|
1353
|
+
category: "professional",
|
|
1354
|
+
mode: "light",
|
|
1355
|
+
colors: {
|
|
1356
|
+
primary: "#475569",
|
|
1357
|
+
secondary: "#64748b",
|
|
1358
|
+
accent: "#0ea5e9",
|
|
1359
|
+
background: "#f8fafc",
|
|
1360
|
+
foreground: "#0f172a"
|
|
1361
|
+
}
|
|
1362
|
+
},
|
|
1363
|
+
{
|
|
1364
|
+
schemaVersion: 1,
|
|
1365
|
+
name: "snow",
|
|
1366
|
+
displayName: "Snow",
|
|
1367
|
+
category: "light",
|
|
1368
|
+
mode: "light",
|
|
1369
|
+
colors: {
|
|
1370
|
+
primary: "#2563eb",
|
|
1371
|
+
secondary: "#3b82f6",
|
|
1372
|
+
accent: "#f97316",
|
|
1373
|
+
background: "#ffffff",
|
|
1374
|
+
foreground: "#0f172a"
|
|
1375
|
+
}
|
|
1376
|
+
},
|
|
1377
|
+
{
|
|
1378
|
+
schemaVersion: 1,
|
|
1379
|
+
name: "startup-bold",
|
|
1380
|
+
displayName: "Startup Bold",
|
|
1381
|
+
category: "brand-inspired",
|
|
1382
|
+
mode: "light",
|
|
1383
|
+
colors: {
|
|
1384
|
+
primary: "#7c3aed",
|
|
1385
|
+
secondary: "#8b5cf6",
|
|
1386
|
+
accent: "#f97316",
|
|
1387
|
+
background: "#faf5ff",
|
|
1388
|
+
foreground: "#3b0764"
|
|
1389
|
+
}
|
|
1390
|
+
},
|
|
1391
|
+
{
|
|
1392
|
+
schemaVersion: 1,
|
|
1393
|
+
name: "storm",
|
|
1394
|
+
displayName: "Storm",
|
|
1395
|
+
category: "cool",
|
|
1396
|
+
mode: "dark",
|
|
1397
|
+
colors: {
|
|
1398
|
+
primary: "#64748b",
|
|
1399
|
+
secondary: "#94a3b8",
|
|
1400
|
+
accent: "#38bdf8",
|
|
1401
|
+
background: "#0f172a",
|
|
1402
|
+
foreground: "#cbd5e1"
|
|
1403
|
+
}
|
|
1404
|
+
},
|
|
1405
|
+
{
|
|
1406
|
+
schemaVersion: 1,
|
|
1407
|
+
name: "sunset-glow",
|
|
1408
|
+
displayName: "Sunset Glow",
|
|
1409
|
+
category: "vibrant",
|
|
1410
|
+
mode: "dark",
|
|
1411
|
+
colors: {
|
|
1412
|
+
primary: "#f97316",
|
|
1413
|
+
secondary: "#fb923c",
|
|
1414
|
+
accent: "#a855f7",
|
|
1415
|
+
background: "#18181b",
|
|
1416
|
+
foreground: "#fff7ed"
|
|
1417
|
+
}
|
|
1418
|
+
},
|
|
1419
|
+
{
|
|
1420
|
+
schemaVersion: 1,
|
|
1421
|
+
name: "terracotta",
|
|
1422
|
+
displayName: "Terracotta",
|
|
1423
|
+
category: "warm",
|
|
1424
|
+
mode: "light",
|
|
1425
|
+
colors: {
|
|
1426
|
+
primary: "#c2410c",
|
|
1427
|
+
secondary: "#dc2626",
|
|
1428
|
+
accent: "#65a30d",
|
|
1429
|
+
background: "#fdf2f8",
|
|
1430
|
+
foreground: "#431407"
|
|
1431
|
+
}
|
|
1432
|
+
},
|
|
1433
|
+
{
|
|
1434
|
+
schemaVersion: 1,
|
|
1435
|
+
name: "trust",
|
|
1436
|
+
displayName: "Trust",
|
|
1437
|
+
category: "professional",
|
|
1438
|
+
mode: "light",
|
|
1439
|
+
colors: {
|
|
1440
|
+
primary: "#0369a1",
|
|
1441
|
+
secondary: "#0284c7",
|
|
1442
|
+
accent: "#16a34a",
|
|
1443
|
+
background: "#f0fdfa",
|
|
1444
|
+
foreground: "#0c4a6e"
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
{
|
|
1448
|
+
schemaVersion: 1,
|
|
1449
|
+
name: "void",
|
|
1450
|
+
displayName: "Void",
|
|
1451
|
+
category: "dark",
|
|
1452
|
+
mode: "dark",
|
|
1453
|
+
colors: {
|
|
1454
|
+
primary: "#14b8a6",
|
|
1455
|
+
secondary: "#2dd4bf",
|
|
1456
|
+
accent: "#f43f5e",
|
|
1457
|
+
background: "#020617",
|
|
1458
|
+
foreground: "#e2e8f0"
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
];
|
|
1462
|
+
|
|
901
1463
|
// src/cli/fixture-registry.ts
|
|
902
1464
|
import { readFileSync, readdirSync } from "fs";
|
|
903
1465
|
import { join, dirname } from "path";
|
|
@@ -1208,6 +1770,9 @@ export function getStaticPaths() { return [{ params: { slug: '1' } }]; }
|
|
|
1208
1770
|
};
|
|
1209
1771
|
var FIXTURE_DEFAULT_CONTENT = {};
|
|
1210
1772
|
function loadAllPalettes() {
|
|
1773
|
+
if (BUILTIN_PALETTES.length > 0) {
|
|
1774
|
+
return [...BUILTIN_PALETTES];
|
|
1775
|
+
}
|
|
1211
1776
|
try {
|
|
1212
1777
|
const registryPath = findRegistryPalettesDir();
|
|
1213
1778
|
if (!registryPath) return [];
|
|
@@ -1779,26 +2344,26 @@ ONLY recommend blocks that exist in the catalog above. Be precise with block nam
|
|
|
1779
2344
|
}
|
|
1780
2345
|
|
|
1781
2346
|
// src/ai/schemas.ts
|
|
1782
|
-
import { z } from "zod";
|
|
1783
|
-
var BrandSchema =
|
|
1784
|
-
name:
|
|
1785
|
-
tagline:
|
|
1786
|
-
description:
|
|
1787
|
-
targetAudience:
|
|
1788
|
-
tone:
|
|
2347
|
+
import { z as z3 } from "zod";
|
|
2348
|
+
var BrandSchema = z3.object({
|
|
2349
|
+
name: z3.string().min(1),
|
|
2350
|
+
tagline: z3.string().nullable().default(null),
|
|
2351
|
+
description: z3.string().min(1),
|
|
2352
|
+
targetAudience: z3.string().nullable().default(null),
|
|
2353
|
+
tone: z3.string().min(1)
|
|
1789
2354
|
});
|
|
1790
|
-
var RecommendedBlockSchema =
|
|
1791
|
-
blockName:
|
|
1792
|
-
reason:
|
|
1793
|
-
confidence:
|
|
2355
|
+
var RecommendedBlockSchema = z3.object({
|
|
2356
|
+
blockName: z3.string().min(1),
|
|
2357
|
+
reason: z3.string().min(1),
|
|
2358
|
+
confidence: z3.number().min(0).max(1)
|
|
1794
2359
|
});
|
|
1795
|
-
var UncertaintySchema =
|
|
1796
|
-
topic:
|
|
1797
|
-
question:
|
|
1798
|
-
defaultAssumption:
|
|
2360
|
+
var UncertaintySchema = z3.object({
|
|
2361
|
+
topic: z3.string().min(1),
|
|
2362
|
+
question: z3.string().min(1),
|
|
2363
|
+
defaultAssumption: z3.string().min(1)
|
|
1799
2364
|
});
|
|
1800
|
-
var IntentSchema =
|
|
1801
|
-
siteType:
|
|
2365
|
+
var IntentSchema = z3.object({
|
|
2366
|
+
siteType: z3.enum([
|
|
1802
2367
|
"landing-page",
|
|
1803
2368
|
"saas",
|
|
1804
2369
|
"agency",
|
|
@@ -1810,20 +2375,20 @@ var IntentSchema = z.object({
|
|
|
1810
2375
|
"community",
|
|
1811
2376
|
"other"
|
|
1812
2377
|
]),
|
|
1813
|
-
industry:
|
|
2378
|
+
industry: z3.string().min(1),
|
|
1814
2379
|
brand: BrandSchema,
|
|
1815
|
-
needsAuth:
|
|
1816
|
-
needsPayments:
|
|
1817
|
-
needsBlog:
|
|
1818
|
-
needsDocs:
|
|
1819
|
-
needsDashboard:
|
|
1820
|
-
needsContactForm:
|
|
1821
|
-
needsNewsletter:
|
|
1822
|
-
hasDynamicContent:
|
|
1823
|
-
hasEcommerce:
|
|
1824
|
-
hasUserAccounts:
|
|
1825
|
-
prefersDarkMode:
|
|
1826
|
-
visualStyle:
|
|
2380
|
+
needsAuth: z3.boolean(),
|
|
2381
|
+
needsPayments: z3.boolean(),
|
|
2382
|
+
needsBlog: z3.boolean(),
|
|
2383
|
+
needsDocs: z3.boolean(),
|
|
2384
|
+
needsDashboard: z3.boolean(),
|
|
2385
|
+
needsContactForm: z3.boolean(),
|
|
2386
|
+
needsNewsletter: z3.boolean(),
|
|
2387
|
+
hasDynamicContent: z3.boolean(),
|
|
2388
|
+
hasEcommerce: z3.boolean(),
|
|
2389
|
+
hasUserAccounts: z3.boolean(),
|
|
2390
|
+
prefersDarkMode: z3.boolean(),
|
|
2391
|
+
visualStyle: z3.enum([
|
|
1827
2392
|
"minimal",
|
|
1828
2393
|
"bold",
|
|
1829
2394
|
"glassmorphism",
|
|
@@ -1831,80 +2396,15 @@ var IntentSchema = z.object({
|
|
|
1831
2396
|
"flat",
|
|
1832
2397
|
"neo-brutalist"
|
|
1833
2398
|
]),
|
|
1834
|
-
languages:
|
|
1835
|
-
palettePreference:
|
|
1836
|
-
wantsThemeSwitcher:
|
|
1837
|
-
recommendedBlocks:
|
|
1838
|
-
uncertainties:
|
|
1839
|
-
overallConfidence:
|
|
2399
|
+
languages: z3.array(z3.string().min(1)).default([]),
|
|
2400
|
+
palettePreference: z3.enum(["custom", "prebuilt", "ai-generated", "unspecified"]),
|
|
2401
|
+
wantsThemeSwitcher: z3.boolean(),
|
|
2402
|
+
recommendedBlocks: z3.array(RecommendedBlockSchema),
|
|
2403
|
+
uncertainties: z3.array(UncertaintySchema),
|
|
2404
|
+
overallConfidence: z3.number().min(0).max(1)
|
|
1840
2405
|
});
|
|
1841
2406
|
|
|
1842
2407
|
// src/ai/rules.ts
|
|
1843
|
-
import { z as z2 } from "zod";
|
|
1844
|
-
var IntentSchema2 = z2.object({
|
|
1845
|
-
siteType: z2.enum([
|
|
1846
|
-
"landing-page",
|
|
1847
|
-
"saas",
|
|
1848
|
-
"agency",
|
|
1849
|
-
"portfolio",
|
|
1850
|
-
"blog",
|
|
1851
|
-
"docs",
|
|
1852
|
-
"ecommerce",
|
|
1853
|
-
"dashboard",
|
|
1854
|
-
"community",
|
|
1855
|
-
"other"
|
|
1856
|
-
]),
|
|
1857
|
-
industry: z2.string(),
|
|
1858
|
-
brand: z2.object({
|
|
1859
|
-
name: z2.string(),
|
|
1860
|
-
tagline: z2.string().optional(),
|
|
1861
|
-
description: z2.string(),
|
|
1862
|
-
targetAudience: z2.string().optional(),
|
|
1863
|
-
tone: z2.string()
|
|
1864
|
-
}),
|
|
1865
|
-
needsAuth: z2.boolean(),
|
|
1866
|
-
needsPayments: z2.boolean(),
|
|
1867
|
-
needsBlog: z2.boolean(),
|
|
1868
|
-
needsDocs: z2.boolean(),
|
|
1869
|
-
needsDashboard: z2.boolean(),
|
|
1870
|
-
needsContactForm: z2.boolean(),
|
|
1871
|
-
needsNewsletter: z2.boolean(),
|
|
1872
|
-
hasDynamicContent: z2.boolean(),
|
|
1873
|
-
hasEcommerce: z2.boolean(),
|
|
1874
|
-
hasUserAccounts: z2.boolean(),
|
|
1875
|
-
prefersDarkMode: z2.boolean(),
|
|
1876
|
-
visualStyle: z2.enum([
|
|
1877
|
-
"minimal",
|
|
1878
|
-
"bold",
|
|
1879
|
-
"glassmorphism",
|
|
1880
|
-
"gradient",
|
|
1881
|
-
"flat",
|
|
1882
|
-
"neo-brutalist"
|
|
1883
|
-
]),
|
|
1884
|
-
languages: z2.array(z2.string()),
|
|
1885
|
-
palettePreference: z2.enum([
|
|
1886
|
-
"custom",
|
|
1887
|
-
"prebuilt",
|
|
1888
|
-
"ai-generated",
|
|
1889
|
-
"unspecified"
|
|
1890
|
-
]),
|
|
1891
|
-
wantsThemeSwitcher: z2.boolean(),
|
|
1892
|
-
recommendedBlocks: z2.array(
|
|
1893
|
-
z2.object({
|
|
1894
|
-
blockName: z2.string(),
|
|
1895
|
-
reason: z2.string(),
|
|
1896
|
-
confidence: z2.number()
|
|
1897
|
-
})
|
|
1898
|
-
),
|
|
1899
|
-
uncertainties: z2.array(
|
|
1900
|
-
z2.object({
|
|
1901
|
-
topic: z2.string(),
|
|
1902
|
-
question: z2.string(),
|
|
1903
|
-
defaultAssumption: z2.string()
|
|
1904
|
-
})
|
|
1905
|
-
),
|
|
1906
|
-
overallConfidence: z2.number().min(0).max(1)
|
|
1907
|
-
});
|
|
1908
2408
|
function hasBlock(config, name) {
|
|
1909
2409
|
return config.blocks.some((b) => b.name === name);
|
|
1910
2410
|
}
|
|
@@ -1996,37 +2496,37 @@ function createDefaultConfig(overrides = {}) {
|
|
|
1996
2496
|
}
|
|
1997
2497
|
|
|
1998
2498
|
// src/schemas/config.ts
|
|
1999
|
-
import { z as
|
|
2000
|
-
var BlockSelectionSchema =
|
|
2001
|
-
name:
|
|
2002
|
-
variant:
|
|
2499
|
+
import { z as z4 } from "zod";
|
|
2500
|
+
var BlockSelectionSchema = z4.object({
|
|
2501
|
+
name: z4.string().min(1),
|
|
2502
|
+
variant: z4.string().min(1)
|
|
2003
2503
|
});
|
|
2004
|
-
var PaletteColorsSchema =
|
|
2005
|
-
primary:
|
|
2006
|
-
secondary:
|
|
2007
|
-
accent:
|
|
2008
|
-
background:
|
|
2009
|
-
foreground:
|
|
2504
|
+
var PaletteColorsSchema = z4.object({
|
|
2505
|
+
primary: z4.string().min(1),
|
|
2506
|
+
secondary: z4.string().min(1),
|
|
2507
|
+
accent: z4.string().min(1),
|
|
2508
|
+
background: z4.string().min(1),
|
|
2509
|
+
foreground: z4.string().min(1)
|
|
2010
2510
|
});
|
|
2011
|
-
var PaletteConfigSchema =
|
|
2012
|
-
preset:
|
|
2511
|
+
var PaletteConfigSchema = z4.object({
|
|
2512
|
+
preset: z4.string().min(1).optional(),
|
|
2013
2513
|
colors: PaletteColorsSchema
|
|
2014
2514
|
});
|
|
2015
|
-
var ResolvedConfigSchema =
|
|
2016
|
-
projectName:
|
|
2017
|
-
projectDir:
|
|
2018
|
-
renderMode:
|
|
2019
|
-
deployTarget:
|
|
2020
|
-
database:
|
|
2021
|
-
cssEngine:
|
|
2022
|
-
packageManager:
|
|
2023
|
-
blocks:
|
|
2024
|
-
locales:
|
|
2025
|
-
defaultLocale:
|
|
2515
|
+
var ResolvedConfigSchema = z4.object({
|
|
2516
|
+
projectName: z4.string().min(1),
|
|
2517
|
+
projectDir: z4.string().min(1),
|
|
2518
|
+
renderMode: z4.enum(["static", "hybrid", "server"]),
|
|
2519
|
+
deployTarget: z4.enum(["cloudflare", "vercel", "netlify", "static"]),
|
|
2520
|
+
database: z4.enum(["none", "d1", "turso", "astro-db", "postgres"]),
|
|
2521
|
+
cssEngine: z4.enum(["tailwind", "vanilla"]),
|
|
2522
|
+
packageManager: z4.enum(["npm", "pnpm", "bun"]),
|
|
2523
|
+
blocks: z4.array(BlockSelectionSchema),
|
|
2524
|
+
locales: z4.array(z4.string().min(1)).transform((locales) => locales.length === 0 ? ["en"] : locales),
|
|
2525
|
+
defaultLocale: z4.string().min(1),
|
|
2026
2526
|
palette: PaletteConfigSchema,
|
|
2027
|
-
themeSwitcher:
|
|
2028
|
-
content:
|
|
2029
|
-
createdWith:
|
|
2527
|
+
themeSwitcher: z4.boolean().default(false),
|
|
2528
|
+
content: z4.record(z4.record(z4.unknown())).optional(),
|
|
2529
|
+
createdWith: z4.enum(["ai", "manual", "recipe", "mcp"])
|
|
2030
2530
|
}).refine(
|
|
2031
2531
|
(config) => config.locales.includes(config.defaultLocale),
|
|
2032
2532
|
{
|
|
@@ -2341,7 +2841,7 @@ function createOpenAIProvider(apiKey) {
|
|
|
2341
2841
|
const { openai } = await import("@ai-sdk/openai");
|
|
2342
2842
|
const result = await generateObject({
|
|
2343
2843
|
model: openai("gpt-4o-mini", { structuredOutputs: true }),
|
|
2344
|
-
schema:
|
|
2844
|
+
schema: IntentSchema,
|
|
2345
2845
|
system: systemPrompt ?? "You are the Fornix AI assistant. Analyze the user's website description and produce a structured Intent object.",
|
|
2346
2846
|
prompt,
|
|
2347
2847
|
maxTokens: 2e3
|
|
@@ -2402,7 +2902,7 @@ function createOllamaProvider(opts = {}) {
|
|
|
2402
2902
|
});
|
|
2403
2903
|
}
|
|
2404
2904
|
const parsed = JSON.parse(content);
|
|
2405
|
-
const validated =
|
|
2905
|
+
const validated = IntentSchema.parse(parsed);
|
|
2406
2906
|
return ok(validated);
|
|
2407
2907
|
} catch (error) {
|
|
2408
2908
|
const message = error instanceof Error ? error.message : "Unknown Ollama error";
|
|
@@ -2478,7 +2978,7 @@ function createCloudflareProvider(opts = {}) {
|
|
|
2478
2978
|
});
|
|
2479
2979
|
}
|
|
2480
2980
|
const parsed = JSON.parse(content);
|
|
2481
|
-
const validated =
|
|
2981
|
+
const validated = IntentSchema.parse(parsed);
|
|
2482
2982
|
return ok(validated);
|
|
2483
2983
|
} catch (error) {
|
|
2484
2984
|
const message = error instanceof Error ? error.message : "Unknown Cloudflare AI error";
|
|
@@ -2538,7 +3038,7 @@ function createMockProvider() {
|
|
|
2538
3038
|
try {
|
|
2539
3039
|
const raw = readFileSync2(filePath, "utf-8");
|
|
2540
3040
|
const parsed = JSON.parse(raw);
|
|
2541
|
-
const validated =
|
|
3041
|
+
const validated = IntentSchema.parse(parsed);
|
|
2542
3042
|
return ok(validated);
|
|
2543
3043
|
} catch (error) {
|
|
2544
3044
|
const message = error instanceof Error ? error.message : "Unknown parse error";
|
|
@@ -2862,11 +3362,11 @@ var createCommand = defineCommand({
|
|
|
2862
3362
|
default: false
|
|
2863
3363
|
}
|
|
2864
3364
|
},
|
|
2865
|
-
async run({ args }) {
|
|
3365
|
+
async run({ args: args2 }) {
|
|
2866
3366
|
const allPalettes = loadAllPalettes();
|
|
2867
|
-
const hasExplicitFlags = !!(
|
|
2868
|
-
if (
|
|
2869
|
-
const defaultProjectName =
|
|
3367
|
+
const hasExplicitFlags = !!(args2.render || args2.deploy || args2.blocks || args2.database || args2.css || args2.locales || args2.palette || args2.recipe);
|
|
3368
|
+
if (args2.manual && !args2.yes) {
|
|
3369
|
+
const defaultProjectName = args2.dir ? basename2(resolve(args2.dir)) : "my-project";
|
|
2870
3370
|
const config = await runManualFlow({
|
|
2871
3371
|
defaultProjectName,
|
|
2872
3372
|
manifests: FIXTURE_MANIFESTS,
|
|
@@ -2876,20 +3376,20 @@ var createCommand = defineCommand({
|
|
|
2876
3376
|
process.exitCode = 0;
|
|
2877
3377
|
return;
|
|
2878
3378
|
}
|
|
2879
|
-
const projectDir =
|
|
3379
|
+
const projectDir = args2.dir ? resolve(args2.dir) : resolve(config.projectDir);
|
|
2880
3380
|
const finalConfig = { ...config, projectDir };
|
|
2881
|
-
return runScaffold(finalConfig, allPalettes,
|
|
3381
|
+
return runScaffold(finalConfig, allPalettes, args2["dry-run"] ?? false, args2.verbose ?? false, !(args2.install ?? true), !(args2.git ?? true));
|
|
2882
3382
|
}
|
|
2883
|
-
if (
|
|
2884
|
-
return runFlagDrivenMode(
|
|
3383
|
+
if (args2.manual || hasExplicitFlags) {
|
|
3384
|
+
return runFlagDrivenMode(args2, allPalettes);
|
|
2885
3385
|
}
|
|
2886
|
-
return runAIMode(
|
|
3386
|
+
return runAIMode(args2, allPalettes);
|
|
2887
3387
|
}
|
|
2888
3388
|
});
|
|
2889
|
-
async function runAIMode(
|
|
2890
|
-
const providerName = parseProviderName(
|
|
2891
|
-
if (
|
|
2892
|
-
console.error(pc3.red(`\u2716 Unknown provider: ${String(
|
|
3389
|
+
async function runAIMode(args2, allPalettes) {
|
|
3390
|
+
const providerName = parseProviderName(args2.provider);
|
|
3391
|
+
if (args2.provider && !providerName) {
|
|
3392
|
+
console.error(pc3.red(`\u2716 Unknown provider: ${String(args2.provider)}`));
|
|
2893
3393
|
console.error(pc3.dim(` Available: ${VALID_PROVIDER_NAMES.join(", ")}`));
|
|
2894
3394
|
process.exitCode = 1;
|
|
2895
3395
|
return;
|
|
@@ -2904,7 +3404,7 @@ async function runAIMode(args, allPalettes) {
|
|
|
2904
3404
|
return;
|
|
2905
3405
|
}
|
|
2906
3406
|
const provider = adaptProvider(legacyProvider);
|
|
2907
|
-
const description = await getDescription(
|
|
3407
|
+
const description = await getDescription(args2);
|
|
2908
3408
|
if (!description) {
|
|
2909
3409
|
process.exitCode = 0;
|
|
2910
3410
|
return;
|
|
@@ -2913,7 +3413,7 @@ async function runAIMode(args, allPalettes) {
|
|
|
2913
3413
|
blocks: Object.values(FIXTURE_MANIFESTS),
|
|
2914
3414
|
palettes: [...allPalettes]
|
|
2915
3415
|
};
|
|
2916
|
-
const projectDir = resolve(String(
|
|
3416
|
+
const projectDir = resolve(String(args2.dir ?? "."));
|
|
2917
3417
|
const projectName = basename2(projectDir);
|
|
2918
3418
|
const nameResult = validateProjectName(projectName);
|
|
2919
3419
|
if (!nameResult.ok) {
|
|
@@ -2934,7 +3434,7 @@ async function runAIMode(args, allPalettes) {
|
|
|
2934
3434
|
return;
|
|
2935
3435
|
}
|
|
2936
3436
|
const config = result.value;
|
|
2937
|
-
if (!
|
|
3437
|
+
if (!args2.yes) {
|
|
2938
3438
|
showAISummary(config);
|
|
2939
3439
|
const confirmed = await p2.confirm({
|
|
2940
3440
|
message: "Create this project?",
|
|
@@ -2949,14 +3449,14 @@ async function runAIMode(args, allPalettes) {
|
|
|
2949
3449
|
return runScaffold(
|
|
2950
3450
|
config,
|
|
2951
3451
|
allPalettes,
|
|
2952
|
-
(
|
|
2953
|
-
(
|
|
2954
|
-
!((
|
|
2955
|
-
!((
|
|
3452
|
+
(args2["dry-run"] ?? false) === true,
|
|
3453
|
+
(args2.verbose ?? false) === true,
|
|
3454
|
+
!((args2.install ?? true) === true),
|
|
3455
|
+
!((args2.git ?? true) === true)
|
|
2956
3456
|
);
|
|
2957
3457
|
}
|
|
2958
|
-
function runFlagDrivenMode(
|
|
2959
|
-
const projectDir = resolve(String(
|
|
3458
|
+
function runFlagDrivenMode(args2, allPalettes) {
|
|
3459
|
+
const projectDir = resolve(String(args2.dir ?? "."));
|
|
2960
3460
|
const projectName = basename2(projectDir);
|
|
2961
3461
|
const nameResult = validateProjectName(projectName);
|
|
2962
3462
|
if (!nameResult.ok) {
|
|
@@ -2964,7 +3464,7 @@ function runFlagDrivenMode(args, allPalettes) {
|
|
|
2964
3464
|
process.exitCode = 1;
|
|
2965
3465
|
return;
|
|
2966
3466
|
}
|
|
2967
|
-
const recipeName =
|
|
3467
|
+
const recipeName = args2.recipe ? String(args2.recipe) : void 0;
|
|
2968
3468
|
let recipeOverlay = {};
|
|
2969
3469
|
if (recipeName) {
|
|
2970
3470
|
if (RECIPES[recipeName]) {
|
|
@@ -2977,11 +3477,11 @@ function runFlagDrivenMode(args, allPalettes) {
|
|
|
2977
3477
|
return;
|
|
2978
3478
|
}
|
|
2979
3479
|
}
|
|
2980
|
-
const renderMode = String(
|
|
2981
|
-
const deployTarget = String(
|
|
2982
|
-
const database = String(
|
|
2983
|
-
const cssEngine = String(
|
|
2984
|
-
const localesRaw = String(
|
|
3480
|
+
const renderMode = String(args2.render ?? recipeOverlay.renderMode ?? "static");
|
|
3481
|
+
const deployTarget = String(args2.deploy ?? recipeOverlay.deployTarget ?? "cloudflare");
|
|
3482
|
+
const database = String(args2.database ?? recipeOverlay.database ?? "none");
|
|
3483
|
+
const cssEngine = String(args2.css ?? recipeOverlay.cssEngine ?? "tailwind");
|
|
3484
|
+
const localesRaw = String(args2.locales ?? "");
|
|
2985
3485
|
let locales = ["en"];
|
|
2986
3486
|
let defaultLocale = "en";
|
|
2987
3487
|
if (localesRaw) {
|
|
@@ -2991,8 +3491,8 @@ function runFlagDrivenMode(args, allPalettes) {
|
|
|
2991
3491
|
locales = [...recipeOverlay.locales];
|
|
2992
3492
|
defaultLocale = recipeOverlay.defaultLocale ?? locales[0] ?? "en";
|
|
2993
3493
|
}
|
|
2994
|
-
const themeSwitcher =
|
|
2995
|
-
const blocksString =
|
|
3494
|
+
const themeSwitcher = args2["theme-switcher"] !== void 0 ? args2["theme-switcher"] === true : recipeOverlay.themeSwitcher ?? false;
|
|
3495
|
+
const blocksString = args2.blocks ? String(args2.blocks) : "";
|
|
2996
3496
|
let blocks = recipeOverlay.blocks ? [...recipeOverlay.blocks] : [];
|
|
2997
3497
|
if (blocksString) {
|
|
2998
3498
|
const blockNames = blocksString.split(",").map((b) => b.trim()).filter(Boolean);
|
|
@@ -3006,8 +3506,8 @@ function runFlagDrivenMode(args, allPalettes) {
|
|
|
3006
3506
|
}
|
|
3007
3507
|
let paletteColors = recipeOverlay.palette ? { ...recipeOverlay.palette.colors } : { ...DEFAULT_COLORS };
|
|
3008
3508
|
let palettePreset = recipeOverlay.palette?.preset;
|
|
3009
|
-
if (
|
|
3010
|
-
const paletteName = String(
|
|
3509
|
+
if (args2.palette) {
|
|
3510
|
+
const paletteName = String(args2.palette);
|
|
3011
3511
|
const found = allPalettes.find((palette) => palette.name === paletteName);
|
|
3012
3512
|
if (found) {
|
|
3013
3513
|
paletteColors = { ...found.colors };
|
|
@@ -3040,10 +3540,10 @@ function runFlagDrivenMode(args, allPalettes) {
|
|
|
3040
3540
|
return runScaffold(
|
|
3041
3541
|
config,
|
|
3042
3542
|
allPalettes,
|
|
3043
|
-
(
|
|
3044
|
-
(
|
|
3045
|
-
!((
|
|
3046
|
-
!((
|
|
3543
|
+
(args2["dry-run"] ?? false) === true,
|
|
3544
|
+
(args2.verbose ?? false) === true,
|
|
3545
|
+
!((args2.install ?? true) === true),
|
|
3546
|
+
!((args2.git ?? true) === true)
|
|
3047
3547
|
);
|
|
3048
3548
|
}
|
|
3049
3549
|
function runScaffold(config, allPalettes, dryRun, verbose, skipInstall, skipGit) {
|
|
@@ -3125,9 +3625,9 @@ function parseProviderName(value) {
|
|
|
3125
3625
|
}
|
|
3126
3626
|
return void 0;
|
|
3127
3627
|
}
|
|
3128
|
-
async function getDescription(
|
|
3129
|
-
if (
|
|
3130
|
-
return typeof
|
|
3628
|
+
async function getDescription(args2) {
|
|
3629
|
+
if (args2.yes) {
|
|
3630
|
+
return typeof args2.description === "string" && args2.description.length > 0 ? args2.description : DEFAULT_AI_DESCRIPTION;
|
|
3131
3631
|
}
|
|
3132
3632
|
p2.intro(pc3.bgCyan(pc3.black(" Fornix \u2014 AI Mode ")));
|
|
3133
3633
|
const input = await p2.text({
|
|
@@ -3206,8 +3706,8 @@ var addCommand = defineCommand2({
|
|
|
3206
3706
|
default: false
|
|
3207
3707
|
}
|
|
3208
3708
|
},
|
|
3209
|
-
run({ args }) {
|
|
3210
|
-
const typedArgs =
|
|
3709
|
+
run({ args: args2 }) {
|
|
3710
|
+
const typedArgs = args2;
|
|
3211
3711
|
const cwd = process.cwd();
|
|
3212
3712
|
const manifestPath = join5(cwd, "fornix.json");
|
|
3213
3713
|
if (!existsSync2(manifestPath)) {
|
|
@@ -3375,8 +3875,8 @@ var removeCommand = defineCommand3({
|
|
|
3375
3875
|
default: false
|
|
3376
3876
|
}
|
|
3377
3877
|
},
|
|
3378
|
-
run({ args }) {
|
|
3379
|
-
const typedArgs =
|
|
3878
|
+
run({ args: args2 }) {
|
|
3879
|
+
const typedArgs = args2;
|
|
3380
3880
|
const cwd = process.cwd();
|
|
3381
3881
|
const manifestPath = join6(cwd, "fornix.json");
|
|
3382
3882
|
if (!existsSync3(manifestPath)) {
|
|
@@ -3503,8 +4003,8 @@ var listCommand = defineCommand4({
|
|
|
3503
4003
|
default: false
|
|
3504
4004
|
}
|
|
3505
4005
|
},
|
|
3506
|
-
run({ args }) {
|
|
3507
|
-
const typedArgs =
|
|
4006
|
+
run({ args: args2 }) {
|
|
4007
|
+
const typedArgs = args2;
|
|
3508
4008
|
const blocks = getFilteredBlocks(typedArgs);
|
|
3509
4009
|
if (blocks.length === 0) {
|
|
3510
4010
|
console.log(pc6.yellow("No blocks found matching your filters."));
|
|
@@ -3517,14 +4017,14 @@ var listCommand = defineCommand4({
|
|
|
3517
4017
|
}
|
|
3518
4018
|
}
|
|
3519
4019
|
});
|
|
3520
|
-
function getFilteredBlocks(
|
|
4020
|
+
function getFilteredBlocks(args2) {
|
|
3521
4021
|
let blocks = Object.values(FIXTURE_MANIFESTS);
|
|
3522
|
-
if (
|
|
3523
|
-
const filterType =
|
|
4022
|
+
if (args2.type) {
|
|
4023
|
+
const filterType = args2.type.toLowerCase();
|
|
3524
4024
|
blocks = blocks.filter((b) => b.type === filterType);
|
|
3525
4025
|
}
|
|
3526
|
-
if (
|
|
3527
|
-
const filterCategory =
|
|
4026
|
+
if (args2.category) {
|
|
4027
|
+
const filterCategory = args2.category.toLowerCase();
|
|
3528
4028
|
blocks = blocks.filter((b) => b.category === filterCategory);
|
|
3529
4029
|
}
|
|
3530
4030
|
return blocks.sort((a, b) => a.name.localeCompare(b.name));
|
|
@@ -3618,8 +4118,8 @@ var statusCommand = defineCommand5({
|
|
|
3618
4118
|
default: false
|
|
3619
4119
|
}
|
|
3620
4120
|
},
|
|
3621
|
-
run({ args }) {
|
|
3622
|
-
const typedArgs =
|
|
4121
|
+
run({ args: args2 }) {
|
|
4122
|
+
const typedArgs = args2;
|
|
3623
4123
|
const cwd = process.cwd();
|
|
3624
4124
|
const manifestPath = join7(cwd, "fornix.json");
|
|
3625
4125
|
if (!existsSync4(manifestPath)) {
|
|
@@ -3730,7 +4230,7 @@ var doctorCommand = defineCommand6({
|
|
|
3730
4230
|
default: false
|
|
3731
4231
|
}
|
|
3732
4232
|
},
|
|
3733
|
-
run({ args }) {
|
|
4233
|
+
run({ args: args2 }) {
|
|
3734
4234
|
const cwd = process.cwd();
|
|
3735
4235
|
const manifestPath = join8(cwd, "fornix.json");
|
|
3736
4236
|
let hasErrors = false;
|
|
@@ -3738,13 +4238,13 @@ var doctorCommand = defineCommand6({
|
|
|
3738
4238
|
function reportError(msg) {
|
|
3739
4239
|
hasErrors = true;
|
|
3740
4240
|
errors.push(msg);
|
|
3741
|
-
if (!
|
|
4241
|
+
if (!args2.json) {
|
|
3742
4242
|
console.error(pc8.red(`\u2717 ${msg}`));
|
|
3743
4243
|
}
|
|
3744
4244
|
}
|
|
3745
4245
|
if (!existsSync5(manifestPath)) {
|
|
3746
4246
|
reportError("No fornix.json found in the current directory.");
|
|
3747
|
-
if (
|
|
4247
|
+
if (args2.json) {
|
|
3748
4248
|
console.log(JSON.stringify({ healthy: false, errors }));
|
|
3749
4249
|
}
|
|
3750
4250
|
process.exit(1);
|
|
@@ -3755,7 +4255,7 @@ var doctorCommand = defineCommand6({
|
|
|
3755
4255
|
manifest2 = JSON.parse(raw);
|
|
3756
4256
|
} catch {
|
|
3757
4257
|
reportError("Failed to parse fornix.json.");
|
|
3758
|
-
if (
|
|
4258
|
+
if (args2.json) {
|
|
3759
4259
|
console.log(JSON.stringify({ healthy: false, errors }));
|
|
3760
4260
|
}
|
|
3761
4261
|
process.exit(1);
|
|
@@ -3816,7 +4316,7 @@ var doctorCommand = defineCommand6({
|
|
|
3816
4316
|
reportError(`Broken content reference: missing ${missing}`);
|
|
3817
4317
|
}
|
|
3818
4318
|
if (hasErrors) {
|
|
3819
|
-
if (
|
|
4319
|
+
if (args2.json) {
|
|
3820
4320
|
console.log(JSON.stringify({ healthy: false, errors }));
|
|
3821
4321
|
} else {
|
|
3822
4322
|
console.log();
|
|
@@ -3824,7 +4324,7 @@ var doctorCommand = defineCommand6({
|
|
|
3824
4324
|
}
|
|
3825
4325
|
process.exit(1);
|
|
3826
4326
|
} else {
|
|
3827
|
-
if (
|
|
4327
|
+
if (args2.json) {
|
|
3828
4328
|
console.log(JSON.stringify({ healthy: true, errors: [] }));
|
|
3829
4329
|
} else {
|
|
3830
4330
|
console.log(pc8.green("\u2713 Project is healthy!"));
|
|
@@ -4090,7 +4590,7 @@ function getContentSchema(input) {
|
|
|
4090
4590
|
}
|
|
4091
4591
|
|
|
4092
4592
|
// src/mcp/tools/validate-content.ts
|
|
4093
|
-
import { z as
|
|
4593
|
+
import { z as z5 } from "zod";
|
|
4094
4594
|
function validateContent(input) {
|
|
4095
4595
|
const { collection, data } = input;
|
|
4096
4596
|
const manifest2 = FIXTURE_MANIFESTS[collection];
|
|
@@ -4113,7 +4613,7 @@ function validateContent(input) {
|
|
|
4113
4613
|
for (const [slotName, slot] of Object.entries(contentSlots)) {
|
|
4114
4614
|
schemaShape[slotName] = zodTypeForSlot2(slot.type);
|
|
4115
4615
|
}
|
|
4116
|
-
const schema =
|
|
4616
|
+
const schema = z5.object(schemaShape);
|
|
4117
4617
|
const parseResult = schema.safeParse(data);
|
|
4118
4618
|
if (parseResult.success) {
|
|
4119
4619
|
return ok({ valid: true, errors: [] });
|
|
@@ -4126,17 +4626,17 @@ function validateContent(input) {
|
|
|
4126
4626
|
function zodTypeForSlot2(slotType) {
|
|
4127
4627
|
switch (slotType) {
|
|
4128
4628
|
case "string":
|
|
4129
|
-
return
|
|
4629
|
+
return z5.string();
|
|
4130
4630
|
case "number":
|
|
4131
|
-
return
|
|
4631
|
+
return z5.number();
|
|
4132
4632
|
case "boolean":
|
|
4133
|
-
return
|
|
4633
|
+
return z5.boolean();
|
|
4134
4634
|
case "array":
|
|
4135
|
-
return
|
|
4635
|
+
return z5.array(z5.unknown());
|
|
4136
4636
|
case "object":
|
|
4137
|
-
return
|
|
4637
|
+
return z5.record(z5.unknown());
|
|
4138
4638
|
default:
|
|
4139
|
-
return
|
|
4639
|
+
return z5.unknown();
|
|
4140
4640
|
}
|
|
4141
4641
|
}
|
|
4142
4642
|
|
|
@@ -4387,8 +4887,8 @@ var FornixMCPServer = class {
|
|
|
4387
4887
|
CallToolRequestSchema,
|
|
4388
4888
|
async (request) => {
|
|
4389
4889
|
const toolName = request.params.name;
|
|
4390
|
-
const
|
|
4391
|
-
const result = await this.executeTool(toolName,
|
|
4890
|
+
const args2 = request.params.arguments ?? {};
|
|
4891
|
+
const result = await this.executeTool(toolName, args2);
|
|
4392
4892
|
if (!result.ok) {
|
|
4393
4893
|
return {
|
|
4394
4894
|
content: [
|
|
@@ -4461,49 +4961,49 @@ var FornixMCPServer = class {
|
|
|
4461
4961
|
* Execute a tool by name with the given arguments.
|
|
4462
4962
|
* Exposed as a public method for testing without MCP transport.
|
|
4463
4963
|
*/
|
|
4464
|
-
async callTool(toolName,
|
|
4465
|
-
return this.executeTool(toolName,
|
|
4964
|
+
async callTool(toolName, args2) {
|
|
4965
|
+
return this.executeTool(toolName, args2);
|
|
4466
4966
|
}
|
|
4467
|
-
async executeTool(toolName,
|
|
4967
|
+
async executeTool(toolName, args2) {
|
|
4468
4968
|
switch (toolName) {
|
|
4469
4969
|
case "list_blocks": {
|
|
4470
4970
|
const result = listBlocks({
|
|
4471
|
-
type:
|
|
4472
|
-
category:
|
|
4473
|
-
search:
|
|
4971
|
+
type: args2.type,
|
|
4972
|
+
category: args2.category,
|
|
4973
|
+
search: args2.search
|
|
4474
4974
|
});
|
|
4475
4975
|
if (!result.ok) return err(result.error);
|
|
4476
4976
|
return ok(JSON.stringify(result.value, null, 2));
|
|
4477
4977
|
}
|
|
4478
4978
|
case "add_block": {
|
|
4479
4979
|
const result = addBlock2({
|
|
4480
|
-
name:
|
|
4481
|
-
variant:
|
|
4482
|
-
projectDirectory:
|
|
4980
|
+
name: args2.name,
|
|
4981
|
+
variant: args2.variant,
|
|
4982
|
+
projectDirectory: args2.projectDirectory
|
|
4483
4983
|
});
|
|
4484
4984
|
if (!result.ok) return err(result.error);
|
|
4485
4985
|
return ok(JSON.stringify(result.value, null, 2));
|
|
4486
4986
|
}
|
|
4487
4987
|
case "remove_block": {
|
|
4488
4988
|
const result = removeBlock({
|
|
4489
|
-
name:
|
|
4490
|
-
force:
|
|
4491
|
-
projectDirectory:
|
|
4989
|
+
name: args2.name,
|
|
4990
|
+
force: args2.force,
|
|
4991
|
+
projectDirectory: args2.projectDirectory
|
|
4492
4992
|
});
|
|
4493
4993
|
if (!result.ok) return err(result.error);
|
|
4494
4994
|
return ok(JSON.stringify(result.value, null, 2));
|
|
4495
4995
|
}
|
|
4496
4996
|
case "get_content_schema": {
|
|
4497
4997
|
const result = getContentSchema({
|
|
4498
|
-
collection:
|
|
4998
|
+
collection: args2.collection
|
|
4499
4999
|
});
|
|
4500
5000
|
if (!result.ok) return err(result.error);
|
|
4501
5001
|
return ok(JSON.stringify(result.value, null, 2));
|
|
4502
5002
|
}
|
|
4503
5003
|
case "update_content": {
|
|
4504
5004
|
const validationResult = validateContent({
|
|
4505
|
-
collection:
|
|
4506
|
-
data:
|
|
5005
|
+
collection: args2.collection,
|
|
5006
|
+
data: args2.data
|
|
4507
5007
|
});
|
|
4508
5008
|
if (!validationResult.ok) return err(validationResult.error);
|
|
4509
5009
|
if (!validationResult.value.valid) {
|
|
@@ -4517,34 +5017,34 @@ var FornixMCPServer = class {
|
|
|
4517
5017
|
return ok(
|
|
4518
5018
|
JSON.stringify({
|
|
4519
5019
|
updated: true,
|
|
4520
|
-
collection:
|
|
4521
|
-
data:
|
|
5020
|
+
collection: args2.collection,
|
|
5021
|
+
data: args2.data
|
|
4522
5022
|
})
|
|
4523
5023
|
);
|
|
4524
5024
|
}
|
|
4525
5025
|
case "validate_content": {
|
|
4526
5026
|
const result = validateContent({
|
|
4527
|
-
collection:
|
|
4528
|
-
data:
|
|
5027
|
+
collection: args2.collection,
|
|
5028
|
+
data: args2.data
|
|
4529
5029
|
});
|
|
4530
5030
|
if (!result.ok) return err(result.error);
|
|
4531
5031
|
return ok(JSON.stringify(result.value, null, 2));
|
|
4532
5032
|
}
|
|
4533
5033
|
case "get_project_status": {
|
|
4534
5034
|
const result = getProjectStatus({
|
|
4535
|
-
projectDirectory:
|
|
5035
|
+
projectDirectory: args2.projectDirectory
|
|
4536
5036
|
});
|
|
4537
5037
|
if (!result.ok) return err(result.error);
|
|
4538
5038
|
return ok(JSON.stringify(result.value, null, 2));
|
|
4539
5039
|
}
|
|
4540
5040
|
case "scaffold_project": {
|
|
4541
5041
|
const result = scaffoldProject({
|
|
4542
|
-
description:
|
|
4543
|
-
projectDirectory:
|
|
4544
|
-
renderMode:
|
|
4545
|
-
deployTarget:
|
|
4546
|
-
blocks:
|
|
4547
|
-
locales:
|
|
5042
|
+
description: args2.description,
|
|
5043
|
+
projectDirectory: args2.projectDirectory,
|
|
5044
|
+
renderMode: args2.renderMode,
|
|
5045
|
+
deployTarget: args2.deployTarget,
|
|
5046
|
+
blocks: args2.blocks,
|
|
5047
|
+
locales: args2.locales
|
|
4548
5048
|
});
|
|
4549
5049
|
if (!result.ok) return err(result.error);
|
|
4550
5050
|
return ok(JSON.stringify(result.value, null, 2));
|
|
@@ -4609,8 +5109,12 @@ var main = defineCommand8({
|
|
|
4609
5109
|
|
|
4610
5110
|
// src/index.ts
|
|
4611
5111
|
var KNOWN_COMMANDS = /* @__PURE__ */ new Set(["create", "add", "remove", "list", "status", "doctor", "mcp"]);
|
|
4612
|
-
var
|
|
4613
|
-
|
|
5112
|
+
var HELP_FLAGS = /* @__PURE__ */ new Set(["--help", "-h", "--version", "-V"]);
|
|
5113
|
+
var args = process.argv.slice(2);
|
|
5114
|
+
var hasKnownCommand = args.some((arg) => KNOWN_COMMANDS.has(arg));
|
|
5115
|
+
var isHelpOrVersion = args.some((arg) => HELP_FLAGS.has(arg));
|
|
5116
|
+
var hasArgs = args.length > 0;
|
|
5117
|
+
if (hasArgs && !hasKnownCommand && !isHelpOrVersion) {
|
|
4614
5118
|
process.argv.splice(2, 0, "create");
|
|
4615
5119
|
}
|
|
4616
5120
|
runMain(main);
|