@getcoherent/cli 0.5.5 → 0.5.7

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 +38 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4341,6 +4341,7 @@ User Request: "${message}"
4341
4341
 
4342
4342
  Return ONLY a JSON object with this structure (no pageCode, no sections, no content):
4343
4343
  {
4344
+ "appName": "Extracted App Name",
4344
4345
  "requests": [
4345
4346
  { "type": "add-page", "target": "new", "changes": { "id": "page-id", "name": "Page Name", "route": "/page-route" } }
4346
4347
  ],
@@ -4350,6 +4351,7 @@ Return ONLY a JSON object with this structure (no pageCode, no sections, no cont
4350
4351
  }
4351
4352
 
4352
4353
  Rules:
4354
+ - appName: Extract the app/product name from the user's request if mentioned (e.g. "app called TaskFlow" \u2192 "TaskFlow", "build a CRM" \u2192 "CRM"). If no name is mentioned, omit this field.
4353
4355
  - Use kebab-case for id and route
4354
4356
  - Route must start with /
4355
4357
  - Keep response under 500 tokens
@@ -5055,7 +5057,7 @@ function fixGlobalsCss(projectRoot, config2) {
5055
5057
  }
5056
5058
 
5057
5059
  // src/utils/quality-validator.ts
5058
- var RAW_COLOR_RE = /(?:bg|text|border)-(gray|blue|red|green|yellow|purple|pink|indigo|orange|slate|zinc|stone|neutral|emerald|teal|cyan|sky|violet|fuchsia|rose|amber|lime)-\d+/g;
5060
+ var RAW_COLOR_RE = /(?:(?:hover|focus|active|group-hover|focus-visible|focus-within):)?(?:bg|text|border|ring|outline|from|to|via)-(gray|blue|red|green|yellow|purple|pink|indigo|orange|slate|zinc|stone|neutral|emerald|teal|cyan|sky|violet|fuchsia|rose|amber|lime)-\d+/g;
5059
5061
  var HEX_IN_CLASS_RE = /className="[^"]*#[0-9a-fA-F]{3,8}[^"]*"/g;
5060
5062
  var TEXT_BASE_RE = /\btext-base\b/g;
5061
5063
  var HEAVY_SHADOW_RE = /\bshadow-(md|lg|xl|2xl)\b/g;
@@ -5481,82 +5483,90 @@ function validatePageQuality(code, validRoutes) {
5481
5483
  function replaceRawColors(classes, colorMap) {
5482
5484
  let changed = false;
5483
5485
  let result = classes;
5484
- const accentColorRe = /\b(bg|text|border)-(emerald|blue|violet|indigo|purple|teal|cyan|sky|rose|amber|red|green|yellow|pink|orange|fuchsia|lime)-(\d+)\b/g;
5485
- result = result.replace(accentColorRe, (m, prefix, color, shade) => {
5486
- if (colorMap[m]) {
5486
+ const accentColorRe = /\b((?:(?:hover|focus|active|group-hover|focus-visible|focus-within):)?)(bg|text|border|ring|outline|from|to|via)-(emerald|blue|violet|indigo|purple|teal|cyan|sky|rose|amber|red|green|yellow|pink|orange|fuchsia|lime)-(\d+)\b/g;
5487
+ result = result.replace(accentColorRe, (m, statePrefix, prefix, color, shade) => {
5488
+ const bare = m.replace(statePrefix, "");
5489
+ if (colorMap[bare]) {
5487
5490
  changed = true;
5488
- return colorMap[m];
5491
+ return statePrefix + colorMap[bare];
5489
5492
  }
5490
5493
  const n = parseInt(shade);
5491
5494
  const isDestructive = color === "red";
5492
5495
  if (prefix === "bg") {
5493
5496
  if (n >= 500 && n <= 700) {
5494
5497
  changed = true;
5495
- return isDestructive ? "bg-destructive" : "bg-primary";
5498
+ return statePrefix + (isDestructive ? "bg-destructive" : "bg-primary");
5496
5499
  }
5497
5500
  if (n >= 100 && n <= 200) {
5498
5501
  changed = true;
5499
- return isDestructive ? "bg-destructive/10" : "bg-primary/10";
5502
+ return statePrefix + (isDestructive ? "bg-destructive/10" : "bg-primary/10");
5500
5503
  }
5501
5504
  if (n >= 300 && n <= 400) {
5502
5505
  changed = true;
5503
- return isDestructive ? "bg-destructive/20" : "bg-primary/20";
5506
+ return statePrefix + (isDestructive ? "bg-destructive/20" : "bg-primary/20");
5504
5507
  }
5505
5508
  if (n >= 800) {
5506
5509
  changed = true;
5507
- return "bg-muted";
5510
+ return statePrefix + "bg-muted";
5508
5511
  }
5509
5512
  }
5510
5513
  if (prefix === "text") {
5511
5514
  if (n >= 400 && n <= 600) {
5512
5515
  changed = true;
5513
- return isDestructive ? "text-destructive" : "text-primary";
5516
+ return statePrefix + (isDestructive ? "text-destructive" : "text-primary");
5514
5517
  }
5515
5518
  if (n >= 100 && n <= 300) {
5516
5519
  changed = true;
5517
- return "text-foreground";
5520
+ return statePrefix + "text-foreground";
5518
5521
  }
5519
5522
  if (n >= 700) {
5520
5523
  changed = true;
5521
- return "text-foreground";
5524
+ return statePrefix + "text-foreground";
5522
5525
  }
5523
5526
  }
5524
- if (prefix === "border") {
5527
+ if (prefix === "border" || prefix === "ring" || prefix === "outline") {
5525
5528
  changed = true;
5526
- return isDestructive ? "border-destructive" : "border-primary";
5529
+ return statePrefix + (isDestructive ? `${prefix}-destructive` : `${prefix}-primary`);
5530
+ }
5531
+ if (prefix === "from" || prefix === "to" || prefix === "via") {
5532
+ changed = true;
5533
+ if (n >= 100 && n <= 300)
5534
+ return statePrefix + (isDestructive ? `${prefix}-destructive/20` : `${prefix}-primary/20`);
5535
+ return statePrefix + (isDestructive ? `${prefix}-destructive` : `${prefix}-primary`);
5527
5536
  }
5528
5537
  return m;
5529
5538
  });
5530
- const neutralColorRe = /\b(bg|text|border)-(zinc|slate|gray|neutral|stone)-(\d+)\b/g;
5531
- result = result.replace(neutralColorRe, (m, prefix, _color, shade) => {
5532
- if (colorMap[m]) {
5539
+ const neutralColorRe = /\b((?:(?:hover|focus|active|group-hover|focus-visible|focus-within):)?)(bg|text|border|ring|outline)-(zinc|slate|gray|neutral|stone)-(\d+)\b/g;
5540
+ result = result.replace(neutralColorRe, (m, statePrefix, prefix, _color, shade) => {
5541
+ const bare = m.replace(statePrefix, "");
5542
+ if (colorMap[bare]) {
5533
5543
  changed = true;
5534
- return colorMap[m];
5544
+ return statePrefix + colorMap[bare];
5535
5545
  }
5536
5546
  const n = parseInt(shade);
5537
5547
  if (prefix === "bg") {
5538
5548
  if (n >= 800) {
5539
5549
  changed = true;
5540
- return "bg-background";
5550
+ return statePrefix + "bg-background";
5541
5551
  }
5542
5552
  if (n >= 100 && n <= 300) {
5543
5553
  changed = true;
5544
- return "bg-muted";
5554
+ return statePrefix + "bg-muted";
5545
5555
  }
5546
5556
  }
5547
5557
  if (prefix === "text") {
5548
5558
  if (n >= 100 && n <= 300) {
5549
5559
  changed = true;
5550
- return "text-foreground";
5560
+ return statePrefix + "text-foreground";
5551
5561
  }
5552
5562
  if (n >= 400 && n <= 600) {
5553
5563
  changed = true;
5554
- return "text-muted-foreground";
5564
+ return statePrefix + "text-muted-foreground";
5555
5565
  }
5556
5566
  }
5557
- if (prefix === "border") {
5567
+ if (prefix === "border" || prefix === "ring" || prefix === "outline") {
5558
5568
  changed = true;
5559
- return "border-border";
5569
+ return statePrefix + `${prefix === "border" ? "border-border" : `${prefix}-ring`}`;
5560
5570
  }
5561
5571
  return m;
5562
5572
  });
@@ -6762,6 +6772,10 @@ async function splitGeneratePages(spinner, message, modCtx, provider, parseOpts)
6762
6772
  if (detectedNavType !== "header" && modCtx.config.navigation) {
6763
6773
  modCtx.config.navigation.type = detectedNavType;
6764
6774
  }
6775
+ const planRaw = planResult;
6776
+ if (typeof planRaw.appName === "string" && planRaw.appName && modCtx.config.name === "My App") {
6777
+ modCtx.config.name = planRaw.appName;
6778
+ }
6765
6779
  } catch {
6766
6780
  spinner.text = "AI plan failed \u2014 extracting pages from your request...";
6767
6781
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.5",
6
+ "version": "0.5.7",
7
7
  "description": "CLI interface for Coherent Design Method",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",