@getcoherent/cli 0.3.2 → 0.3.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.
Files changed (2) hide show
  1. package/dist/index.js +41 -26
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4483,11 +4483,17 @@ Format:
4483
4483
  LAYOUT CONTRACT (CRITICAL \u2014 prevents duplicate navigation and footer):
4484
4484
  - The app has a root layout (app/layout.tsx) that renders a shared Header and Footer.
4485
4485
  - Pages are rendered INSIDE this layout, between the Header and Footer.
4486
- - NEVER include <header>, <nav>, or <footer> elements in pageCode.
4486
+ - NEVER include <header>, <nav>, or <footer> elements in pageCode. Also do NOT add a footer-like section at the bottom (no "\xA9 2024", no site links, no logo + nav links at the bottom).
4487
4487
  - Start page content with <main> or a wrapper <div>. The first visible element should be the page title or hero section.
4488
4488
  - If the page needs sub-navigation (tabs, breadcrumbs, sidebar nav), use elements like <div role="tablist"> or <aside> \u2014 NOT <header>, <nav>, or <footer>.
4489
4489
  - Do NOT add any navigation bars, logo headers, site-wide menus, or site footers to pages. The layout provides all of these.
4490
4490
 
4491
+ WIDTH CONSISTENCY (CRITICAL \u2014 prevents visual mismatch between header and content):
4492
+ - The shared Header and Footer use "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8" for inner content.
4493
+ - ALL page content MUST use the same width constraint: wrap the outermost element content in "mx-auto max-w-7xl px-4 sm:px-6 lg:px-8" or use the same constraint on the <main> element.
4494
+ - Example: <main className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6"> or a nested <div> with this class.
4495
+ - NEVER have page content at full width while header/footer are constrained \u2014 this looks broken.
4496
+
4491
4497
  pageCode rules (shadcn/ui blocks quality):
4492
4498
  - Full Next.js App Router page. Imports from '@/components/ui/...' for registry components.
4493
4499
  - Follow ALL design constraints above: text-sm base, semantic colors only, restricted spacing, weight-based hierarchy.
@@ -6279,8 +6285,8 @@ async function autoFixCode(code) {
6279
6285
  fixed = fixed.replace(/&lt;=/g, "<=");
6280
6286
  fixed = fixed.replace(/&gt;=/g, ">=");
6281
6287
  fixed = fixed.replace(/&amp;&amp;/g, "&&");
6282
- fixed = fixed.replace(/(\w)\s*&lt;\s*(\d)/g, "$1 < $2");
6283
- fixed = fixed.replace(/(\w)\s*&gt;\s*(\d)/g, "$1 > $2");
6288
+ fixed = fixed.replace(/([\w)\]])\s*&lt;\s*([\w(])/g, "$1 < $2");
6289
+ fixed = fixed.replace(/([\w)\]])\s*&gt;\s*([\w(])/g, "$1 > $2");
6284
6290
  if (fixed !== beforeEntityFix) {
6285
6291
  fixes.push("Fixed syntax issues");
6286
6292
  }
@@ -6711,33 +6717,27 @@ async function regenerateLayout(config2, projectRoot) {
6711
6717
  }
6712
6718
  const hasSharedHeader = manifest?.shared.some((c) => c.type === "layout" && /header|nav/i.test(c.name)) ?? false;
6713
6719
  const hasSharedFooter = manifest?.shared.some((c) => c.type === "layout" && /footer/i.test(c.name)) ?? false;
6714
- if (hasSharedHeader) {
6715
- const code = await generator.generateLayout(layout, appType, { skipNav: true });
6716
- const layoutPath = resolve6(projectRoot, "app", "layout.tsx");
6717
- await writeFile(layoutPath, code);
6718
- } else {
6719
- const code = await generator.generateLayout(layout, appType, { skipNav: true });
6720
- const layoutPath = resolve6(projectRoot, "app", "layout.tsx");
6721
- await writeFile(layoutPath, code);
6722
- if (config2.navigation?.enabled && appType === "multi-page") {
6723
- const headerCode = generator.generateSharedHeaderCode();
6720
+ const code = await generator.generateLayout(layout, appType, { skipNav: true });
6721
+ const layoutPath = resolve6(projectRoot, "app", "layout.tsx");
6722
+ await writeFile(layoutPath, code);
6723
+ if (config2.navigation?.enabled && appType === "multi-page") {
6724
+ const headerCode = generator.generateSharedHeaderCode();
6725
+ await generateSharedComponent2(projectRoot, {
6726
+ name: "Header",
6727
+ type: "layout",
6728
+ code: headerCode,
6729
+ description: "Main site header with navigation and theme toggle",
6730
+ usedIn: ["app/layout.tsx"]
6731
+ });
6732
+ if (!hasSharedFooter) {
6733
+ const footerCode = generator.generateSharedFooterCode();
6724
6734
  await generateSharedComponent2(projectRoot, {
6725
- name: "Header",
6735
+ name: "Footer",
6726
6736
  type: "layout",
6727
- code: headerCode,
6728
- description: "Main site header with navigation and theme toggle",
6737
+ code: footerCode,
6738
+ description: "Site footer",
6729
6739
  usedIn: ["app/layout.tsx"]
6730
6740
  });
6731
- if (!hasSharedFooter) {
6732
- const footerCode = generator.generateSharedFooterCode();
6733
- await generateSharedComponent2(projectRoot, {
6734
- name: "Footer",
6735
- type: "layout",
6736
- code: footerCode,
6737
- description: "Site footer",
6738
- usedIn: ["app/layout.tsx"]
6739
- });
6740
- }
6741
6741
  }
6742
6742
  }
6743
6743
  try {
@@ -7057,11 +7057,26 @@ function stripInlineLayoutElements(code) {
7057
7057
  result = result.replace(headerBlock, "");
7058
7058
  stripped.push("header");
7059
7059
  }
7060
+ const navBlock = extractBalancedTag(result, "nav");
7061
+ if (navBlock) {
7062
+ result = result.replace(navBlock, "");
7063
+ stripped.push("nav");
7064
+ }
7060
7065
  const footerBlock = extractBalancedTag(result, "footer");
7061
7066
  if (footerBlock) {
7062
7067
  result = result.replace(footerBlock, "");
7063
7068
  stripped.push("footer");
7064
7069
  }
7070
+ const commentFooterRe = /\s*\{\/\*\s*Footer\s*\*\/\}\s*\n/i;
7071
+ const commentMatch = result.match(commentFooterRe);
7072
+ if (commentMatch && commentMatch.index != null) {
7073
+ const afterComment = result.slice(commentMatch.index + commentMatch[0].length);
7074
+ const divBlock = extractBalancedTag(afterComment, "div");
7075
+ if (divBlock) {
7076
+ result = result.replace(commentMatch[0] + divBlock, "");
7077
+ stripped.push("footer (div)");
7078
+ }
7079
+ }
7065
7080
  if (stripped.length > 0) {
7066
7081
  result = result.replace(/\n{3,}/g, "\n\n");
7067
7082
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.2",
6
+ "version": "0.3.4",
7
7
  "description": "CLI interface for Coherent Design Method",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",