@getcoherent/cli 0.6.18 → 0.6.19
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.
|
@@ -1157,6 +1157,27 @@ ${selectImport}`
|
|
|
1157
1157
|
if (fixed !== beforeImgFix) {
|
|
1158
1158
|
fixes.push("placeholder images \u2192 working URLs (picsum/pravatar)");
|
|
1159
1159
|
}
|
|
1160
|
+
const beforePlaceholder = fixed;
|
|
1161
|
+
fixed = fixed.replace(
|
|
1162
|
+
/>(\s*)Lorem ipsum[^<]*/gi,
|
|
1163
|
+
">$1Streamline your workflow with intelligent automation and real-time collaboration tools"
|
|
1164
|
+
);
|
|
1165
|
+
fixed = fixed.replace(/>(\s*)Card content(\s*)</gi, ">$1View details$2<");
|
|
1166
|
+
fixed = fixed.replace(/>(\s*)Your (?:text|content) here(\s*)</gi, ">$1Get started today$2<");
|
|
1167
|
+
fixed = fixed.replace(/>(\s*)Description(\s*)</g, ">$1Overview$2<");
|
|
1168
|
+
fixed = fixed.replace(/>\s*Title\s*</g, ">Page Title<");
|
|
1169
|
+
fixed = fixed.replace(/placeholder\s*text/gi, "contextual content");
|
|
1170
|
+
fixed = fixed.replace(/"John Doe"/g, '"Alex Thompson"');
|
|
1171
|
+
fixed = fixed.replace(/'John Doe'/g, "'Alex Thompson'");
|
|
1172
|
+
fixed = fixed.replace(/"Jane Doe"/g, '"Sarah Chen"');
|
|
1173
|
+
fixed = fixed.replace(/'Jane Doe'/g, "'Sarah Chen'");
|
|
1174
|
+
fixed = fixed.replace(/"user@example\.com"/g, '"alex@company.com"');
|
|
1175
|
+
fixed = fixed.replace(/'user@example\.com'/g, "'alex@company.com'");
|
|
1176
|
+
fixed = fixed.replace(/"test@example\.com"/g, '"team@company.com"');
|
|
1177
|
+
fixed = fixed.replace(/'test@example\.com'/g, "'team@company.com'");
|
|
1178
|
+
if (fixed !== beforePlaceholder) {
|
|
1179
|
+
fixes.push("placeholder content \u2192 contextual content");
|
|
1180
|
+
}
|
|
1160
1181
|
return { code: fixed, fixes };
|
|
1161
1182
|
}
|
|
1162
1183
|
function formatIssues(issues) {
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
formatIssues,
|
|
8
8
|
validatePageQuality,
|
|
9
9
|
verifyIncrementalEdit
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CF4377B7.js";
|
|
11
11
|
import {
|
|
12
12
|
generateArchitecturePlan,
|
|
13
13
|
getPageGroup,
|
|
@@ -6427,7 +6427,7 @@ ${existingAppPageCode}
|
|
|
6427
6427
|
const result = await parseModification(prompt, modCtx, provider, parseOpts);
|
|
6428
6428
|
phase5Done++;
|
|
6429
6429
|
spinner.text = `Phase 5/6 \u2014 ${phase5Done}/${remainingPages.length} pages generated...`;
|
|
6430
|
-
|
|
6430
|
+
const codePage = result.requests.find((r) => r.type === "add-page");
|
|
6431
6431
|
if (currentReusePlan && currentReusePlan.reuse.length > 0 && codePage) {
|
|
6432
6432
|
const pageCode = codePage.changes?.pageCode;
|
|
6433
6433
|
if (pageCode) {
|
|
@@ -6437,17 +6437,28 @@ ${existingAppPageCode}
|
|
|
6437
6437
|
chalk8.dim(` \u2713 Reuse verified for "${name}": ${verification.passed.map((p) => p.component).join(", ")}`)
|
|
6438
6438
|
);
|
|
6439
6439
|
}
|
|
6440
|
-
if (verification.missed.length > 0
|
|
6441
|
-
|
|
6442
|
-
|
|
6443
|
-
` \u26A0 Missed reuse in "${name}": ${verification.missed.map((m) => m.component).join(", ")} \u2014 retrying...`
|
|
6444
|
-
)
|
|
6445
|
-
);
|
|
6440
|
+
if (verification.missed.length > 0) {
|
|
6441
|
+
const missedNames = verification.missed.map((m) => m.component);
|
|
6442
|
+
console.log(chalk8.yellow(` \u26A0 Missed reuse in "${name}": ${missedNames.join(", ")} \u2014 patching...`));
|
|
6446
6443
|
try {
|
|
6447
|
-
const
|
|
6448
|
-
|
|
6449
|
-
|
|
6450
|
-
|
|
6444
|
+
const ai = await createAIProvider(provider);
|
|
6445
|
+
if (ai.editPageCode) {
|
|
6446
|
+
const patchLines = verification.missed.map((m) => {
|
|
6447
|
+
const importPath = m.importPath || `@/components/shared/${m.component.replace(/([A-Z])/g, (_, c, i) => (i ? "-" : "") + c.toLowerCase()).replace(/^-/, "")}`;
|
|
6448
|
+
return `- Add: import { ${m.component} } from '${importPath}'
|
|
6449
|
+
Then find any inline implementation of ${m.component} and replace with <${m.component} />`;
|
|
6450
|
+
});
|
|
6451
|
+
const patchInstruction = `Add these shared components to this page:
|
|
6452
|
+
${patchLines.join("\n")}
|
|
6453
|
+
|
|
6454
|
+
Keep all existing functionality. Only add imports and replace inline duplicates.`;
|
|
6455
|
+
const patched = await ai.editPageCode(pageCode, patchInstruction, name);
|
|
6456
|
+
if (patched && patched.length > 100 && /export\s+(default\s+)?function/.test(patched)) {
|
|
6457
|
+
;
|
|
6458
|
+
codePage.changes.pageCode = patched;
|
|
6459
|
+
console.log(chalk8.dim(` \u2713 Patched ${missedNames.join(", ")} into "${name}"`));
|
|
6460
|
+
}
|
|
6461
|
+
}
|
|
6451
6462
|
} catch {
|
|
6452
6463
|
}
|
|
6453
6464
|
}
|
|
@@ -8492,7 +8503,7 @@ async function chatCommand(message, options) {
|
|
|
8492
8503
|
spinner.start(`Creating shared component: ${componentName}...`);
|
|
8493
8504
|
const { createAIProvider: createAIProvider2 } = await import("./ai-provider-CGSIYFZT.js");
|
|
8494
8505
|
const { generateSharedComponent: generateSharedComponent7 } = await import("@getcoherent/core");
|
|
8495
|
-
const { autoFixCode: autoFixCode2 } = await import("./quality-validator-
|
|
8506
|
+
const { autoFixCode: autoFixCode2 } = await import("./quality-validator-BX3T5X6Z.js");
|
|
8496
8507
|
const { extractPropsInterface, extractDependencies } = await import("./component-extractor-VYJLT5NR.js");
|
|
8497
8508
|
const aiProvider = await createAIProvider2(provider ?? "auto");
|
|
8498
8509
|
const prompt = `Generate a React component called "${componentName}". Description: ${message}.
|