@getcoherent/cli 0.6.18 → 0.6.20

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-63DJQ2TU.js";
10
+ } from "./chunk-CF4377B7.js";
11
11
  import {
12
12
  generateArchitecturePlan,
13
13
  getPageGroup,
@@ -6411,6 +6411,7 @@ ${existingAppPageCode}
6411
6411
  `Create ONE page called "${name}" at route "${route}".`,
6412
6412
  `Context: ${message}.`,
6413
6413
  `Generate complete pageCode for this single page only. Do not generate other pages.`,
6414
+ `FORBIDDEN in pageCode: <header>, <nav>, <footer>, site-wide navigation, copyright footers. The layout provides all of these.`,
6414
6415
  `PAGE TYPE: ${pageType}`,
6415
6416
  designConstraints,
6416
6417
  layoutNote,
@@ -6427,7 +6428,7 @@ ${existingAppPageCode}
6427
6428
  const result = await parseModification(prompt, modCtx, provider, parseOpts);
6428
6429
  phase5Done++;
6429
6430
  spinner.text = `Phase 5/6 \u2014 ${phase5Done}/${remainingPages.length} pages generated...`;
6430
- let codePage = result.requests.find((r) => r.type === "add-page");
6431
+ const codePage = result.requests.find((r) => r.type === "add-page");
6431
6432
  if (currentReusePlan && currentReusePlan.reuse.length > 0 && codePage) {
6432
6433
  const pageCode = codePage.changes?.pageCode;
6433
6434
  if (pageCode) {
@@ -6437,17 +6438,28 @@ ${existingAppPageCode}
6437
6438
  chalk8.dim(` \u2713 Reuse verified for "${name}": ${verification.passed.map((p) => p.component).join(", ")}`)
6438
6439
  );
6439
6440
  }
6440
- if (verification.missed.length > 0 && verification.retryDirective) {
6441
- console.log(
6442
- chalk8.yellow(
6443
- ` \u26A0 Missed reuse in "${name}": ${verification.missed.map((m) => m.component).join(", ")} \u2014 retrying...`
6444
- )
6445
- );
6441
+ if (verification.missed.length > 0) {
6442
+ const missedNames = verification.missed.map((m) => m.component);
6443
+ console.log(chalk8.yellow(` \u26A0 Missed reuse in "${name}": ${missedNames.join(", ")} \u2014 patching...`));
6446
6444
  try {
6447
- const retryPrompt = [prompt, verification.retryDirective].join("\n\n");
6448
- const retryResult = await parseModification(retryPrompt, modCtx, provider, parseOpts);
6449
- const retryPage = retryResult.requests.find((r) => r.type === "add-page");
6450
- if (retryPage) codePage = retryPage;
6445
+ const ai = await createAIProvider(provider);
6446
+ if (ai.editPageCode) {
6447
+ const patchLines = verification.missed.map((m) => {
6448
+ const importPath = m.importPath || `@/components/shared/${m.component.replace(/([A-Z])/g, (_, c, i) => (i ? "-" : "") + c.toLowerCase()).replace(/^-/, "")}`;
6449
+ return `- Add: import { ${m.component} } from '${importPath}'
6450
+ Then find any inline implementation of ${m.component} and replace with <${m.component} />`;
6451
+ });
6452
+ const patchInstruction = `Add these shared components to this page:
6453
+ ${patchLines.join("\n")}
6454
+
6455
+ Keep all existing functionality. Only add imports and replace inline duplicates.`;
6456
+ const patched = await ai.editPageCode(pageCode, patchInstruction, name);
6457
+ if (patched && patched.length > 100 && /export\s+(default\s+)?function/.test(patched)) {
6458
+ ;
6459
+ codePage.changes.pageCode = patched;
6460
+ console.log(chalk8.dim(` \u2713 Patched ${missedNames.join(", ")} into "${name}"`));
6461
+ }
6462
+ }
6451
6463
  } catch {
6452
6464
  }
6453
6465
  }
@@ -7072,7 +7084,8 @@ function printPostGenerationReport(opts) {
7072
7084
  if (inCodeShared.length > 0) {
7073
7085
  console.log(chalk10.dim(` Shared: ${inCodeShared.map((s) => `${s.id} (${s.name})`).join(", ")}`));
7074
7086
  }
7075
- if (layoutShared.length > 0) {
7087
+ const isAuthPage = route && (/^\/(login|signin|signup|register|forgot-password|reset-password)\b/.test(route) || filePath.includes("(auth)"));
7088
+ if (layoutShared.length > 0 && !isAuthPage) {
7076
7089
  console.log(chalk10.dim(` Layout: ${layoutShared.map((l) => `${l.id} (${l.name})`).join(", ")} via layout.tsx`));
7077
7090
  }
7078
7091
  if (iconCount > 0) {
@@ -8492,7 +8505,7 @@ async function chatCommand(message, options) {
8492
8505
  spinner.start(`Creating shared component: ${componentName}...`);
8493
8506
  const { createAIProvider: createAIProvider2 } = await import("./ai-provider-CGSIYFZT.js");
8494
8507
  const { generateSharedComponent: generateSharedComponent7 } = await import("@getcoherent/core");
8495
- const { autoFixCode: autoFixCode2 } = await import("./quality-validator-GKGPDQ5I.js");
8508
+ const { autoFixCode: autoFixCode2 } = await import("./quality-validator-BX3T5X6Z.js");
8496
8509
  const { extractPropsInterface, extractDependencies } = await import("./component-extractor-VYJLT5NR.js");
8497
8510
  const aiProvider = await createAIProvider2(provider ?? "auto");
8498
8511
  const prompt = `Generate a React component called "${componentName}". Description: ${message}.
@@ -4,7 +4,7 @@ import {
4
4
  formatIssues,
5
5
  validatePageQuality,
6
6
  verifyIncrementalEdit
7
- } from "./chunk-63DJQ2TU.js";
7
+ } from "./chunk-CF4377B7.js";
8
8
  import "./chunk-3RG5ZIWI.js";
9
9
  export {
10
10
  autoFixCode,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.6.18",
6
+ "version": "0.6.20",
7
7
  "description": "CLI interface for Coherent Design Method",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",