@createlex/figgen 1.4.7 → 1.4.9
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/companion/mcp-server.mjs +9 -1
- package/package.json +1 -1
package/companion/mcp-server.mjs
CHANGED
|
@@ -965,6 +965,7 @@ server.registerTool('figma_to_swiftui', {
|
|
|
965
965
|
context,
|
|
966
966
|
generationMode,
|
|
967
967
|
includeOverflow,
|
|
968
|
+
imageNames,
|
|
968
969
|
});
|
|
969
970
|
if (response.ok && data?.handled) {
|
|
970
971
|
llmResult = {
|
|
@@ -987,7 +988,14 @@ server.registerTool('figma_to_swiftui', {
|
|
|
987
988
|
// -------------------------------------------------------------------------
|
|
988
989
|
if (llmResult) {
|
|
989
990
|
const parsed = parseClaudeResponse(llmResult.code || '');
|
|
990
|
-
const
|
|
991
|
+
const llmCode = parsed.code || llmResult.code || '';
|
|
992
|
+
// If the hosted provider returned a generic template that doesn't reference any exported
|
|
993
|
+
// assets, fall back to the plugin-generated code which has correct Image("name") calls.
|
|
994
|
+
const hostedMissedAssets =
|
|
995
|
+
llmResult.provider === 'createlex-hosted' &&
|
|
996
|
+
imageNames.length > 0 &&
|
|
997
|
+
!imageNames.some((n) => llmCode.includes(`Image("${n}")`));
|
|
998
|
+
const finalCode = hostedMissedAssets ? (generated.code || llmCode) : (llmCode || generated.code);
|
|
991
999
|
const effectiveStructName = inferStructName({
|
|
992
1000
|
code: finalCode,
|
|
993
1001
|
selectionNames: generated.selection?.names ?? [],
|