@ikas/code-components-mcp 1.4.0-beta.6 → 1.4.0-beta.7
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/data/framework.json +34 -34
- package/data/migration.json +33 -19
- package/data/storefront-api.json +1 -1
- package/data/storefront-types.json +1 -1
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1199,10 +1199,25 @@ function generateSectionMigrationPlan(theme, sectionName, projectName, oldSource
|
|
|
1199
1199
|
parts.push("");
|
|
1200
1200
|
}
|
|
1201
1201
|
else if (shapeKind === "list" || shapeKind === "record") {
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
if (
|
|
1205
|
-
parts.push(`⚠️ **
|
|
1202
|
+
const fieldCount = fieldDescriptions.length;
|
|
1203
|
+
const isMinimal = fieldCount > 0 && fieldCount <= 2;
|
|
1204
|
+
if (isMinimal) {
|
|
1205
|
+
parts.push(`⚠️ **This child would have only ${fieldCount} field${fieldCount === 1 ? "" : "s"}** (${fieldDescriptions.join(", ")}). \`COMPONENT_LIST\` is usually overkill at this size. **Prefer one of:**`);
|
|
1206
|
+
parts.push(`- repeated scalar props on the parent (\`title1\`/\`link1\`, \`title2\`/\`link2\`, …) for a small fixed count`);
|
|
1207
|
+
parts.push(`- a domain LIST prop type (\`LIST_OF_LINK\`, \`IMAGE_LIST\`, \`PRODUCT_LIST\`, …) when each item IS one domain object`);
|
|
1208
|
+
parts.push(`- \`COMPONENT_LIST\` (CLI command below) only if reordering in the editor is a real UX win`);
|
|
1209
|
+
parts.push("");
|
|
1210
|
+
parts.push(`See \`get_migration_guide("component-composition-decision-guide")\` for the full tree. Log your choice in MIGRATION.md → \`## Custom Data Decisions\`.`);
|
|
1211
|
+
parts.push("");
|
|
1212
|
+
}
|
|
1213
|
+
else {
|
|
1214
|
+
parts.push(`**Default: component + COMPONENT_LIST.** Multiple fields per item — a single enum value cannot carry this structure.`);
|
|
1215
|
+
parts.push("");
|
|
1216
|
+
if (fieldCount > 0) {
|
|
1217
|
+
parts.push(`⚠️ **Fields you would lose if you flatten this:** ${fieldDescriptions.join(", ")}. Flattening to a simpler prop type drops these from the editor UI permanently. **Do not "simplify for later"** — if the feature genuinely isn't wanted, log that explicitly in MIGRATION.md → \`## Notes\` with reasoning. Otherwise build the component.`);
|
|
1218
|
+
parts.push("");
|
|
1219
|
+
}
|
|
1220
|
+
parts.push(`> See \`get_migration_guide("component-composition-decision-guide")\` for when \`COMPONENT_LIST\` is overkill.`);
|
|
1206
1221
|
parts.push("");
|
|
1207
1222
|
}
|
|
1208
1223
|
const compName = cd.typescriptName || (cd.name ? cd.name.replace(/[^a-zA-Z0-9]/g, "") : `${sectionPascal}Item`);
|
|
@@ -1218,6 +1233,9 @@ function generateSectionMigrationPlan(theme, sectionName, projectName, oldSource
|
|
|
1218
1233
|
compPropsForCli.push({ name: f.key, displayName: f.name || f.key, type: fType });
|
|
1219
1234
|
}
|
|
1220
1235
|
parts.push("```bash");
|
|
1236
|
+
if (isMinimal) {
|
|
1237
|
+
parts.push(`# Fallback: COMPONENT_LIST (use only if the simpler alternatives above don't fit)`);
|
|
1238
|
+
}
|
|
1221
1239
|
parts.push(`npx ikas-component config add-component --name "${compName}" --type component --props '${JSON.stringify(compPropsForCli)}'`);
|
|
1222
1240
|
parts.push(`# Then on the parent, set the prop's filteredComponentIds to the new component's id.`);
|
|
1223
1241
|
parts.push("```");
|