@getcoherent/cli 0.3.1 → 0.3.3

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 (3) hide show
  1. package/dist/index.js +38 -6
  2. package/package.json +10 -10
  3. package/LICENSE +0 -21
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
  }
@@ -6506,16 +6512,28 @@ ${fixed}`;
6506
6512
  } catch {
6507
6513
  }
6508
6514
  if (lucideExports) {
6515
+ const nonLucideImports = /* @__PURE__ */ new Set();
6516
+ for (const m of fixed.matchAll(/import\s*\{([^}]+)\}\s*from\s*["'](?!lucide-react)([^"']+)["']/g)) {
6517
+ m[1].split(",").map((s) => s.trim()).filter(Boolean).forEach((n) => nonLucideImports.add(n));
6518
+ }
6509
6519
  const iconNames = lucideImportMatch[1].split(",").map((s) => s.trim()).filter(Boolean);
6510
- const invalid = iconNames.filter((name) => !lucideExports.has(name));
6520
+ const duplicates = iconNames.filter((name) => nonLucideImports.has(name));
6521
+ let newImport = lucideImportMatch[1];
6522
+ for (const dup of duplicates) {
6523
+ newImport = newImport.replace(new RegExp(`\\b${dup}\\b,?\\s*`), "");
6524
+ fixes.push(`removed ${dup} from lucide import (conflicts with UI component import)`);
6525
+ }
6526
+ const invalid = iconNames.filter((name) => !lucideExports.has(name) && !nonLucideImports.has(name));
6511
6527
  if (invalid.length > 0) {
6512
6528
  const fallback = "Circle";
6513
- let newImport = lucideImportMatch[1];
6514
6529
  for (const bad of invalid) {
6515
6530
  const re = new RegExp(`\\b${bad}\\b`, "g");
6516
6531
  newImport = newImport.replace(re, fallback);
6517
6532
  fixed = fixed.replace(re, fallback);
6518
6533
  }
6534
+ fixes.push(`invalid lucide icons \u2192 ${fallback}: ${invalid.join(", ")}`);
6535
+ }
6536
+ if (duplicates.length > 0 || invalid.length > 0) {
6519
6537
  const importedNames = [
6520
6538
  ...new Set(
6521
6539
  newImport.split(",").map((s) => s.trim()).filter(Boolean)
@@ -6523,7 +6541,6 @@ ${fixed}`;
6523
6541
  ];
6524
6542
  const originalImportLine = lucideImportMatch[0];
6525
6543
  fixed = fixed.replace(originalImportLine, `import { ${importedNames.join(", ")} } from "lucide-react"`);
6526
- fixes.push(`invalid lucide icons \u2192 ${fallback}: ${invalid.join(", ")}`);
6527
6544
  }
6528
6545
  }
6529
6546
  }
@@ -7046,11 +7063,26 @@ function stripInlineLayoutElements(code) {
7046
7063
  result = result.replace(headerBlock, "");
7047
7064
  stripped.push("header");
7048
7065
  }
7066
+ const navBlock = extractBalancedTag(result, "nav");
7067
+ if (navBlock) {
7068
+ result = result.replace(navBlock, "");
7069
+ stripped.push("nav");
7070
+ }
7049
7071
  const footerBlock = extractBalancedTag(result, "footer");
7050
7072
  if (footerBlock) {
7051
7073
  result = result.replace(footerBlock, "");
7052
7074
  stripped.push("footer");
7053
7075
  }
7076
+ const commentFooterRe = /\s*\{\/\*\s*Footer\s*\*\/\}\s*\n/i;
7077
+ const commentMatch = result.match(commentFooterRe);
7078
+ if (commentMatch && commentMatch.index != null) {
7079
+ const afterComment = result.slice(commentMatch.index + commentMatch[0].length);
7080
+ const divBlock = extractBalancedTag(afterComment, "div");
7081
+ if (divBlock) {
7082
+ result = result.replace(commentMatch[0] + divBlock, "");
7083
+ stripped.push("footer (div)");
7084
+ }
7085
+ }
7054
7086
  if (stripped.length > 0) {
7055
7087
  result = result.replace(/\n{3,}/g, "\n\n");
7056
7088
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.1",
6
+ "version": "0.3.3",
7
7
  "description": "CLI interface for Coherent Design Method",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",
@@ -33,8 +33,15 @@
33
33
  ],
34
34
  "author": "Coherent Design Method",
35
35
  "license": "MIT",
36
+ "scripts": {
37
+ "dev": "tsup --watch",
38
+ "build": "tsup",
39
+ "typecheck": "tsc --noEmit",
40
+ "test": "vitest"
41
+ },
36
42
  "dependencies": {
37
43
  "@anthropic-ai/sdk": "^0.32.0",
44
+ "@getcoherent/core": "workspace:*",
38
45
  "chalk": "^5.3.0",
39
46
  "chokidar": "^4.0.1",
40
47
  "commander": "^11.1.0",
@@ -42,19 +49,12 @@
42
49
  "open": "^10.1.0",
43
50
  "ora": "^7.0.1",
44
51
  "prompts": "^2.4.2",
45
- "zod": "^3.22.4",
46
- "@getcoherent/core": "0.3.1"
52
+ "zod": "^3.22.4"
47
53
  },
48
54
  "devDependencies": {
49
55
  "@types/node": "^20.11.0",
50
56
  "@types/prompts": "^2.4.9",
51
57
  "tsup": "^8.0.1",
52
58
  "typescript": "^5.3.3"
53
- },
54
- "scripts": {
55
- "dev": "tsup --watch",
56
- "build": "tsup",
57
- "typecheck": "tsc --noEmit",
58
- "test": "vitest"
59
59
  }
60
- }
60
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Sergei Kovtun
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.