@getcoherent/cli 0.6.11 → 0.6.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.
- package/dist/index.js +132 -1
- package/package.json +10 -10
- package/LICENSE +0 -21
package/dist/index.js
CHANGED
|
@@ -3385,6 +3385,24 @@ function generateV4GlobalsCss(config2) {
|
|
|
3385
3385
|
--color-warning: var(--warning);
|
|
3386
3386
|
--color-error: var(--error);
|
|
3387
3387
|
--color-info: var(--info);
|
|
3388
|
+
--color-black: #000;
|
|
3389
|
+
--color-white: #fff;
|
|
3390
|
+
--color-sidebar-background: var(--sidebar-background);
|
|
3391
|
+
--color-sidebar-foreground: var(--sidebar-foreground);
|
|
3392
|
+
--color-sidebar-primary: var(--sidebar-primary);
|
|
3393
|
+
--color-sidebar-primary-foreground: var(--sidebar-primary-foreground);
|
|
3394
|
+
--color-sidebar-accent: var(--sidebar-accent);
|
|
3395
|
+
--color-sidebar-accent-foreground: var(--sidebar-accent-foreground);
|
|
3396
|
+
--color-sidebar-border: var(--sidebar-border);
|
|
3397
|
+
--color-sidebar-ring: var(--sidebar-ring);
|
|
3398
|
+
--color-sidebar-muted: var(--sidebar-muted);
|
|
3399
|
+
--color-sidebar-muted-foreground: var(--sidebar-muted-foreground);
|
|
3400
|
+
--color-chart-1: var(--chart-1);
|
|
3401
|
+
--color-chart-2: var(--chart-2);
|
|
3402
|
+
--color-chart-3: var(--chart-3);
|
|
3403
|
+
--color-chart-4: var(--chart-4);
|
|
3404
|
+
--color-chart-5: var(--chart-5);
|
|
3405
|
+
--radius-xs: 0.125rem;
|
|
3388
3406
|
--radius-sm: ${radius.sm || "0.25rem"};
|
|
3389
3407
|
--radius-md: ${radius.md || "0.5rem"};
|
|
3390
3408
|
--radius-lg: ${radius.lg || "0.75rem"};
|
|
@@ -3416,6 +3434,21 @@ function generateV4GlobalsCss(config2) {
|
|
|
3416
3434
|
--warning: ${light.warning};
|
|
3417
3435
|
--error: ${light.error};
|
|
3418
3436
|
--info: ${light.info || light.primary};
|
|
3437
|
+
--sidebar-background: ${light.background};
|
|
3438
|
+
--sidebar-foreground: ${light.foreground};
|
|
3439
|
+
--sidebar-primary: ${light.primary};
|
|
3440
|
+
--sidebar-primary-foreground: ${contrastFg(light.primary)};
|
|
3441
|
+
--sidebar-accent: ${light.accent || light.muted};
|
|
3442
|
+
--sidebar-accent-foreground: ${light.foreground};
|
|
3443
|
+
--sidebar-border: ${light.border};
|
|
3444
|
+
--sidebar-ring: ${light.primary};
|
|
3445
|
+
--sidebar-muted: ${light.muted};
|
|
3446
|
+
--sidebar-muted-foreground: ${blendColors(light.foreground, light.background, 0.45)};
|
|
3447
|
+
--chart-1: ${light.primary};
|
|
3448
|
+
--chart-2: ${light.success};
|
|
3449
|
+
--chart-3: ${light.warning};
|
|
3450
|
+
--chart-4: ${light.error};
|
|
3451
|
+
--chart-5: ${light.info || light.primary};
|
|
3419
3452
|
}
|
|
3420
3453
|
|
|
3421
3454
|
.dark {
|
|
@@ -3442,6 +3475,21 @@ function generateV4GlobalsCss(config2) {
|
|
|
3442
3475
|
--warning: ${dark.warning};
|
|
3443
3476
|
--error: ${dark.error};
|
|
3444
3477
|
--info: ${dark.info || dark.primary};
|
|
3478
|
+
--sidebar-background: ${dark.background};
|
|
3479
|
+
--sidebar-foreground: ${dark.foreground};
|
|
3480
|
+
--sidebar-primary: ${dark.primary};
|
|
3481
|
+
--sidebar-primary-foreground: ${contrastFg(dark.primary)};
|
|
3482
|
+
--sidebar-accent: ${dark.accent || dark.muted};
|
|
3483
|
+
--sidebar-accent-foreground: ${dark.foreground};
|
|
3484
|
+
--sidebar-border: ${dark.border};
|
|
3485
|
+
--sidebar-ring: ${dark.primary};
|
|
3486
|
+
--sidebar-muted: ${dark.muted};
|
|
3487
|
+
--sidebar-muted-foreground: ${blendColors(dark.foreground, dark.background, 0.45)};
|
|
3488
|
+
--chart-1: ${dark.primary};
|
|
3489
|
+
--chart-2: ${dark.success};
|
|
3490
|
+
--chart-3: ${dark.warning};
|
|
3491
|
+
--chart-4: ${dark.error};
|
|
3492
|
+
--chart-5: ${dark.info || dark.primary};
|
|
3445
3493
|
}
|
|
3446
3494
|
|
|
3447
3495
|
* {
|
|
@@ -4921,7 +4969,17 @@ function needsGlobalsFix(projectRoot) {
|
|
|
4921
4969
|
if (isTailwindV4(projectRoot)) {
|
|
4922
4970
|
if (!content.includes("@theme inline")) return true;
|
|
4923
4971
|
if (content.includes("@tailwind base")) return true;
|
|
4924
|
-
|
|
4972
|
+
const REQUIRED_V4_TOKENS = [
|
|
4973
|
+
"--color-transparent",
|
|
4974
|
+
"--color-sidebar-background",
|
|
4975
|
+
"--color-chart-1",
|
|
4976
|
+
"--color-black",
|
|
4977
|
+
"--color-white",
|
|
4978
|
+
"--radius-xs"
|
|
4979
|
+
];
|
|
4980
|
+
for (const token of REQUIRED_V4_TOKENS) {
|
|
4981
|
+
if (!content.includes(token)) return true;
|
|
4982
|
+
}
|
|
4925
4983
|
return false;
|
|
4926
4984
|
}
|
|
4927
4985
|
if (content.includes(":root {") || content.includes(".dark {")) return true;
|
|
@@ -6087,6 +6145,15 @@ ${selectImport}`
|
|
|
6087
6145
|
if (fixed !== beforeTabsFix) {
|
|
6088
6146
|
fixes.push("stripped border from TabsTrigger (shadcn handles active state)");
|
|
6089
6147
|
}
|
|
6148
|
+
const beforeJunkFix = fixed;
|
|
6149
|
+
fixed = fixed.replace(/className="([^"]*)"/g, (_match, classes) => {
|
|
6150
|
+
const cleaned = classes.split(/\s+/).filter((c) => c !== "-0").join(" ");
|
|
6151
|
+
if (cleaned !== classes.trim()) return `className="${cleaned}"`;
|
|
6152
|
+
return _match;
|
|
6153
|
+
});
|
|
6154
|
+
if (fixed !== beforeJunkFix) {
|
|
6155
|
+
fixes.push("removed junk classes (-0)");
|
|
6156
|
+
}
|
|
6090
6157
|
fixed = fixed.replace(/className="([^"]*)"/g, (_match, inner) => {
|
|
6091
6158
|
const cleaned = inner.replace(/\s{2,}/g, " ").trim();
|
|
6092
6159
|
return `className="${cleaned}"`;
|
|
@@ -9984,6 +10051,56 @@ import { spawn } from "child_process";
|
|
|
9984
10051
|
import { existsSync as existsSync20, rmSync as rmSync3, readFileSync as readFileSync15, writeFileSync as writeFileSync10, readdirSync as readdirSync6 } from "fs";
|
|
9985
10052
|
import { resolve as resolve11, join as join14 } from "path";
|
|
9986
10053
|
import { readdir as readdir2 } from "fs/promises";
|
|
10054
|
+
|
|
10055
|
+
// src/utils/css-validator.ts
|
|
10056
|
+
var REQUIRED_THEME_TOKENS = [
|
|
10057
|
+
"--color-transparent",
|
|
10058
|
+
"--color-black",
|
|
10059
|
+
"--color-white",
|
|
10060
|
+
"--color-sidebar-background",
|
|
10061
|
+
"--color-sidebar-foreground",
|
|
10062
|
+
"--color-sidebar-primary",
|
|
10063
|
+
"--color-sidebar-primary-foreground",
|
|
10064
|
+
"--color-sidebar-accent",
|
|
10065
|
+
"--color-sidebar-accent-foreground",
|
|
10066
|
+
"--color-sidebar-border",
|
|
10067
|
+
"--color-sidebar-ring",
|
|
10068
|
+
"--color-sidebar-muted",
|
|
10069
|
+
"--color-sidebar-muted-foreground",
|
|
10070
|
+
"--color-chart-1",
|
|
10071
|
+
"--color-chart-2",
|
|
10072
|
+
"--color-chart-3",
|
|
10073
|
+
"--color-chart-4",
|
|
10074
|
+
"--color-chart-5",
|
|
10075
|
+
"--radius-xs"
|
|
10076
|
+
];
|
|
10077
|
+
var VAR_REFERENCE_RE = /var\(--([^)]+)\)/;
|
|
10078
|
+
function validateV4GlobalsCss(css) {
|
|
10079
|
+
const issues = [];
|
|
10080
|
+
if (css.includes("@tailwind base") || css.includes("@tailwind components")) {
|
|
10081
|
+
issues.push("Stale v3 directive (@tailwind) found in v4 CSS \u2014 remove it");
|
|
10082
|
+
}
|
|
10083
|
+
const themeMatch = css.match(/@theme\s+inline\s*\{([^}]*(?:\{[^}]*\}[^}]*)*)\}/s);
|
|
10084
|
+
const themeBlock = themeMatch ? themeMatch[1] : "";
|
|
10085
|
+
for (const token of REQUIRED_THEME_TOKENS) {
|
|
10086
|
+
if (!themeBlock.includes(token)) {
|
|
10087
|
+
issues.push(`Missing @theme token: ${token}`);
|
|
10088
|
+
}
|
|
10089
|
+
}
|
|
10090
|
+
const themeLines = themeBlock.split("\n");
|
|
10091
|
+
for (const line of themeLines) {
|
|
10092
|
+
const varMatch = line.match(VAR_REFERENCE_RE);
|
|
10093
|
+
if (!varMatch) continue;
|
|
10094
|
+
const referencedVar = `--${varMatch[1]}`;
|
|
10095
|
+
const definedInRoot = css.includes(`${referencedVar}:`) || css.includes(`${referencedVar} :`);
|
|
10096
|
+
if (!definedInRoot) {
|
|
10097
|
+
issues.push(`@theme references var(${referencedVar}) but it is not defined in :root/.dark`);
|
|
10098
|
+
}
|
|
10099
|
+
}
|
|
10100
|
+
return issues;
|
|
10101
|
+
}
|
|
10102
|
+
|
|
10103
|
+
// src/commands/preview.ts
|
|
9987
10104
|
import { DesignSystemManager as DesignSystemManager8, ComponentGenerator as ComponentGenerator3 } from "@getcoherent/core";
|
|
9988
10105
|
|
|
9989
10106
|
// src/utils/file-watcher.ts
|
|
@@ -10838,6 +10955,20 @@ async function previewCommand() {
|
|
|
10838
10955
|
spinner.warn("Could not auto-fix globals.css");
|
|
10839
10956
|
}
|
|
10840
10957
|
}
|
|
10958
|
+
if (isTailwindV4(projectRoot)) {
|
|
10959
|
+
const globalsPath = resolve11(projectRoot, "app", "globals.css");
|
|
10960
|
+
if (existsSync20(globalsPath)) {
|
|
10961
|
+
const globalsContent = readFileSync15(globalsPath, "utf-8");
|
|
10962
|
+
const cssIssues = validateV4GlobalsCss(globalsContent);
|
|
10963
|
+
if (cssIssues.length > 0) {
|
|
10964
|
+
console.log(chalk15.yellow("\n\u26A0\uFE0F globals.css validation warnings:"));
|
|
10965
|
+
for (const issue of cssIssues) {
|
|
10966
|
+
console.log(chalk15.yellow(` \u2022 ${issue}`));
|
|
10967
|
+
}
|
|
10968
|
+
console.log(chalk15.dim(' Run "coherent chat" to regenerate globals.css\n'));
|
|
10969
|
+
}
|
|
10970
|
+
}
|
|
10971
|
+
}
|
|
10841
10972
|
spinner.text = "Pre-flight: dependencies and syntax...";
|
|
10842
10973
|
await preflightDependencyCheck(projectRoot);
|
|
10843
10974
|
clearStaleCache(projectRoot);
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "0.6.
|
|
6
|
+
"version": "0.6.12",
|
|
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.6.11"
|
|
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.
|