@getcoherent/cli 0.3.10 → 0.3.12

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 +51 -28
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -469,7 +469,8 @@ var COHERENT_REQUIRED_PACKAGES = [
469
469
  "lucide-react",
470
470
  "class-variance-authority",
471
471
  "clsx",
472
- "tailwind-merge"
472
+ "tailwind-merge",
473
+ "@radix-ui/react-slot"
473
474
  ];
474
475
  var IMPORT_FROM_REGEX = /from\s+['"]([^'"]+)['"]/g;
475
476
  var NODE_BUILTINS = /* @__PURE__ */ new Set([
@@ -4519,6 +4520,7 @@ WIDTH CONSISTENCY (CRITICAL \u2014 prevents visual mismatch between header and c
4519
4520
  - ALL page content MUST use the same width constraint: wrap the outermost element in <main className="mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6">.
4520
4521
  - Landing/marketing pages: each <section> is full-width for backgrounds, but inner content uses "mx-auto max-w-6xl" or similar.
4521
4522
  - NEVER use max-w-4xl or smaller for the page wrapper \u2014 it makes the page look narrower than the header.
4523
+ - NEVER add inner centering wrappers like <div className="max-w-4xl mx-auto"> inside the page. All content (title, cards, forms) must flow within the same max-w-7xl container so everything aligns to the same left edge.
4522
4524
  - NEVER have page content at full width while header/footer are constrained \u2014 this looks broken.
4523
4525
 
4524
4526
  PAGE CONTENT (CRITICAL \u2014 prevents empty or duplicate pages):
@@ -4534,6 +4536,7 @@ pageCode rules (shadcn/ui blocks quality):
4534
4536
  - Dashboard pattern: main(mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 py-6 flex flex-1 flex-col gap-4) > page header(h1 text-2xl font-bold tracking-tight + p text-sm text-muted-foreground) > stats grid(grid gap-4 md:grid-cols-2 lg:grid-cols-4) > content cards.
4535
4537
  - No placeholders: real contextual copy only. Use the EXACT text, language, and content from the user's request.
4536
4538
  - IMAGES: For avatar/profile photos, use https://i.pravatar.cc/150?u=<unique-seed> (e.g. ?u=sarah.johnson). For hero/product images, use https://picsum.photos/800/400?random=N. Use standard <img> tags with className, NOT Next.js <Image>. Always provide alt text.
4539
+ - BUTTON + LINK: The Button component supports asChild prop. To make a button that navigates, use <Button asChild><Link href="/path"><Plus className="size-4" /> Label</Link></Button>. Never nest <button> inside <Link> or vice versa without asChild.
4537
4540
  - Hover/focus on every interactive element (hover:bg-muted, focus-visible:ring-2 focus-visible:ring-ring).
4538
4541
  - LANGUAGE: Match the language of the user's request. English request \u2192 English page. Russian request \u2192 Russian page. Never switch languages.
4539
4542
 
@@ -7143,36 +7146,56 @@ function enforceWidthWrapper(code, route) {
7143
7146
  if (/<section[\s>]/i.test(code) && (/<section[\s>]/gi.exec(code) || []).length >= 2) {
7144
7147
  return { code, fixed: false };
7145
7148
  }
7146
- const narrowWidths = /max-w-(xs|sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl)\b/;
7147
- const hasMax7xl = /max-w-7xl/.test(code);
7148
- if (hasMax7xl) return { code, fixed: false };
7149
- const mainMatch = code.match(/<main\s+className="([^"]*)"/);
7149
+ let result = code;
7150
+ let didFix = false;
7151
+ const mainMatch = result.match(/<main\s+className="([^"]*)"/);
7150
7152
  if (mainMatch) {
7151
- const currentClasses = mainMatch[1];
7152
- if (narrowWidths.test(currentClasses)) {
7153
- const fixed = currentClasses.replace(narrowWidths, "max-w-7xl");
7154
- return { code: code.replace(mainMatch[0], `<main className="${fixed}"`), fixed: true };
7155
- }
7156
- if (!currentClasses.includes("max-w-")) {
7157
- const newClasses = `mx-auto max-w-7xl ${currentClasses}`;
7158
- return { code: code.replace(mainMatch[0], `<main className="${newClasses}"`), fixed: true };
7159
- }
7160
- }
7161
- const returnMatch = code.match(/return\s*\(\s*\n?\s*<(div|main)\s+className="([^"]*)"/);
7162
- if (returnMatch) {
7163
- const [fullMatch, tag, currentClasses] = returnMatch;
7164
- if (narrowWidths.test(currentClasses)) {
7165
- const fixed = currentClasses.replace(narrowWidths, "max-w-7xl");
7166
- return { code: code.replace(fullMatch, `return (
7167
- <${tag} className="${fixed}"`), fixed: true };
7168
- }
7169
- if (!currentClasses.includes("max-w-")) {
7170
- const newClasses = `mx-auto max-w-7xl px-4 sm:px-6 lg:px-8 ${currentClasses}`;
7171
- return { code: code.replace(fullMatch, `return (
7172
- <${tag} className="${newClasses}"`), fixed: true };
7153
+ const cls = mainMatch[1];
7154
+ const needsMaxW = !cls.includes("max-w-7xl");
7155
+ const needsMxAuto = !cls.includes("mx-auto");
7156
+ const needsPadding = !cls.includes("px-");
7157
+ if (needsMaxW || needsMxAuto || needsPadding) {
7158
+ let fixed = cls;
7159
+ fixed = fixed.replace(/\bmax-w-\S+/g, "");
7160
+ fixed = `${needsMxAuto ? "mx-auto " : ""}max-w-7xl ${needsPadding ? "px-4 sm:px-6 lg:px-8 " : ""}${fixed}`.replace(/\s+/g, " ").trim();
7161
+ result = result.replace(mainMatch[0], `<main className="${fixed}"`);
7162
+ didFix = true;
7173
7163
  }
7164
+ } else {
7165
+ const returnMatch = result.match(/return\s*\(\s*\n?\s*<(div|main)\s+className="([^"]*)"/);
7166
+ if (returnMatch) {
7167
+ const [fullMatch, tag, cls] = returnMatch;
7168
+ const needsMaxW = !cls.includes("max-w-7xl");
7169
+ const needsMxAuto = !cls.includes("mx-auto");
7170
+ const needsPadding = !cls.includes("px-");
7171
+ if (needsMaxW || needsMxAuto || needsPadding) {
7172
+ let fixed = cls;
7173
+ fixed = fixed.replace(/\bmax-w-\S+/g, "");
7174
+ fixed = `${needsMxAuto ? "mx-auto " : ""}max-w-7xl ${needsPadding ? "px-4 sm:px-6 lg:px-8 " : ""}${fixed}`.replace(/\s+/g, " ").trim();
7175
+ result = result.replace(fullMatch, `return (
7176
+ <${tag} className="${fixed}"`);
7177
+ didFix = true;
7178
+ }
7179
+ }
7180
+ }
7181
+ const isAuthPage = /\/(login|signin|sign-in|signup|sign-up|register|auth)\b/i.test(route);
7182
+ if (!isAuthPage) {
7183
+ const before = result;
7184
+ result = result.replace(
7185
+ /(<div\s+className="[^"]*)\bmax-w-(xs|sm|md|lg|xl|2xl|3xl|4xl|5xl|6xl)\b/g,
7186
+ "$1"
7187
+ );
7188
+ result = result.replace(
7189
+ /(<div\s+className="[^"]*)\bmx-auto\b/g,
7190
+ "$1"
7191
+ );
7192
+ result = result.replace(
7193
+ /className="([^"]*)"/g,
7194
+ (_, classes) => `className="${classes.replace(/\s{2,}/g, " ").trim()}"`
7195
+ );
7196
+ if (result !== before) didFix = true;
7174
7197
  }
7175
- return { code, fixed: false };
7198
+ return { code: result, fixed: didFix };
7176
7199
  }
7177
7200
  async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider, originalMessage) {
7178
7201
  switch (request.type) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.3.10",
6
+ "version": "0.3.12",
7
7
  "description": "CLI interface for Coherent Design Method",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",