@getcoherent/cli 0.6.27 → 0.6.29

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.
@@ -6,7 +6,7 @@ import {
6
6
  getPageGroup,
7
7
  installPackages,
8
8
  sanitizeMetadataStrings
9
- } from "./chunk-VNDQ4DYQ.js";
9
+ } from "./chunk-RKXLSNDV.js";
10
10
 
11
11
  // src/commands/chat/code-generator.ts
12
12
  import { resolve as resolve3 } from "path";
@@ -2149,7 +2149,7 @@ async function regeneratePage(pageId, config, projectRoot) {
2149
2149
  const code = await generator.generate(page, appType);
2150
2150
  const route = page.route || "/";
2151
2151
  const isAuth = isAuthRoute(route) || isAuthRoute(page.name || page.id || "");
2152
- const { loadPlan: loadPlanForPath } = await import("./plan-generator-HRULTJ55.js");
2152
+ const { loadPlan: loadPlanForPath } = await import("./plan-generator-QKBYJB4A.js");
2153
2153
  const planForPath = loadPlanForPath(projectRoot);
2154
2154
  const filePath = routeToFsPath(projectRoot, route, planForPath || isAuth);
2155
2155
  await mkdir3(dirname3(filePath), { recursive: true });
@@ -1050,7 +1050,25 @@ ${selectImport}`
1050
1050
  for (const m of fixed.matchAll(/import\s*\{([^}]+)\}\s*from\s*["'](?!lucide-react)([^"']+)["']/g)) {
1051
1051
  m[1].split(",").map((s) => s.trim()).filter(Boolean).forEach((n) => nonLucideImports.add(n));
1052
1052
  }
1053
- const rawIconEntries = lucideImportMatch[1].split(",").map((s) => s.trim()).filter(Boolean);
1053
+ let rawIconEntries = lucideImportMatch[1].split(",").map((s) => s.trim()).filter(Boolean);
1054
+ const seenLocals = /* @__PURE__ */ new Map();
1055
+ for (let i = 0; i < rawIconEntries.length; i++) {
1056
+ const local = rawIconEntries[i].split(/\s+as\s+/).pop().trim();
1057
+ if (seenLocals.has(local)) {
1058
+ const prevIdx = seenLocals.get(local);
1059
+ const prevHasAlias = rawIconEntries[prevIdx].includes(" as ");
1060
+ const curHasAlias = rawIconEntries[i].includes(" as ");
1061
+ if (curHasAlias && !prevHasAlias) {
1062
+ rawIconEntries[prevIdx] = "";
1063
+ } else {
1064
+ rawIconEntries[i] = "";
1065
+ }
1066
+ fixes.push(`removed duplicate import ${local}`);
1067
+ } else {
1068
+ seenLocals.set(local, i);
1069
+ }
1070
+ }
1071
+ rawIconEntries = rawIconEntries.filter(Boolean);
1054
1072
  const iconNames = rawIconEntries.map((entry) => {
1055
1073
  const parts = entry.split(/\s+as\s+/);
1056
1074
  return parts[0].trim();
@@ -1059,7 +1077,7 @@ ${selectImport}`
1059
1077
  const alias = entry.split(/\s+as\s+/).pop().trim();
1060
1078
  return nonLucideImports.has(alias);
1061
1079
  });
1062
- let newImport = lucideImportMatch[1];
1080
+ let newImport = rawIconEntries.join(", ");
1063
1081
  for (const dup of duplicates) {
1064
1082
  const escaped = dup.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1065
1083
  newImport = newImport.replace(new RegExp(`${escaped},?\\s*`), "");
@@ -1107,7 +1125,8 @@ ${selectImport}`
1107
1125
  }
1108
1126
  fixes.push(`invalid lucide icons: ${replacements.join(", ")}`);
1109
1127
  }
1110
- if (duplicates.length > 0 || invalid.length > 0) {
1128
+ const dedupHappened = seenLocals.size < lucideImportMatch[1].split(",").filter((s) => s.trim()).length;
1129
+ if (duplicates.length > 0 || invalid.length > 0 || dedupHappened) {
1111
1130
  const importedNames = [
1112
1131
  ...new Set(
1113
1132
  newImport.split(",").map((s) => s.trim()).filter(Boolean)
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-5AHG4NNX.js";
6
6
  import {
7
7
  autoFixCode
8
- } from "./chunk-4WTUPW2L.js";
8
+ } from "./chunk-NP2CGABX.js";
9
9
 
10
10
  // src/commands/chat/plan-generator.ts
11
11
  import { z } from "zod";
@@ -10,10 +10,10 @@ import {
10
10
  regeneratePage,
11
11
  scanAndInstallSharedDeps,
12
12
  validateAndFixGeneratedCode
13
- } from "./chunk-EUE5UIOI.js";
14
- import "./chunk-VNDQ4DYQ.js";
13
+ } from "./chunk-KUXMS2EF.js";
14
+ import "./chunk-RKXLSNDV.js";
15
15
  import "./chunk-5AHG4NNX.js";
16
- import "./chunk-4WTUPW2L.js";
16
+ import "./chunk-NP2CGABX.js";
17
17
  import "./chunk-3RG5ZIWI.js";
18
18
  export {
19
19
  buildAppLayoutCode,
package/dist/index.js CHANGED
@@ -38,7 +38,7 @@ import {
38
38
  warnIfVolatile,
39
39
  warnInlineDuplicates,
40
40
  writeFile
41
- } from "./chunk-EUE5UIOI.js";
41
+ } from "./chunk-KUXMS2EF.js";
42
42
  import {
43
43
  COHERENT_REQUIRED_PACKAGES,
44
44
  ensureUseClientIfNeeded,
@@ -56,7 +56,7 @@ import {
56
56
  sanitizeMetadataStrings,
57
57
  savePlan,
58
58
  updateArchitecturePlan
59
- } from "./chunk-VNDQ4DYQ.js";
59
+ } from "./chunk-RKXLSNDV.js";
60
60
  import {
61
61
  CORE_CONSTRAINTS,
62
62
  DESIGN_QUALITY,
@@ -74,7 +74,7 @@ import {
74
74
  formatIssues,
75
75
  validatePageQuality,
76
76
  verifyIncrementalEdit
77
- } from "./chunk-4WTUPW2L.js";
77
+ } from "./chunk-NP2CGABX.js";
78
78
  import {
79
79
  __require
80
80
  } from "./chunk-3RG5ZIWI.js";
@@ -4109,7 +4109,7 @@ async function splitGeneratePages(spinner, message, modCtx, provider, parseOpts)
4109
4109
  if (plan && plan.sharedComponents.length > 0) {
4110
4110
  spinner.start(`Phase 4.5/6 \u2014 Generating ${plan.sharedComponents.length} shared components from plan...`);
4111
4111
  try {
4112
- const { generateSharedComponentsFromPlan } = await import("./plan-generator-HRULTJ55.js");
4112
+ const { generateSharedComponentsFromPlan } = await import("./plan-generator-QKBYJB4A.js");
4113
4113
  const generated = await generateSharedComponentsFromPlan(
4114
4114
  plan,
4115
4115
  styleContext,
@@ -5967,7 +5967,7 @@ async function chatCommand(message, options) {
5967
5967
  spinner.start(`Creating shared component: ${componentName}...`);
5968
5968
  const { createAIProvider: createAIProvider2 } = await import("./ai-provider-CGSIYFZT.js");
5969
5969
  const { generateSharedComponent: generateSharedComponent6 } = await import("@getcoherent/core");
5970
- const { autoFixCode: autoFixCode2 } = await import("./quality-validator-BCN2ECNV.js");
5970
+ const { autoFixCode: autoFixCode2 } = await import("./quality-validator-EC2QSVEM.js");
5971
5971
  const { extractPropsInterface, extractDependencies } = await import("./component-extractor-VYJLT5NR.js");
5972
5972
  const aiProvider = await createAIProvider2(provider ?? "auto");
5973
5973
  const prompt = `Generate a React component called "${componentName}". Description: ${message}.
@@ -8443,14 +8443,35 @@ async function fixCommand(opts = {}) {
8443
8443
  console.log(chalk15.green(` \u2714 ${verb} syntax: ${syntaxFixed} file(s) (use client, metadata, quotes)`));
8444
8444
  }
8445
8445
  try {
8446
- const { loadPlan: loadPlan2 } = await import("./plan-generator-HRULTJ55.js");
8447
- const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-7RUQTKXA.js");
8446
+ const { loadPlan: loadPlan2 } = await import("./plan-generator-QKBYJB4A.js");
8447
+ const { ensurePlanGroupLayouts: ensurePlanGroupLayouts2 } = await import("./code-generator-LTS6F77G.js");
8448
8448
  const plan = loadPlan2(projectRoot);
8449
8449
  if (plan) {
8450
8450
  await ensurePlanGroupLayouts2(projectRoot, plan);
8451
8451
  const layoutTypes = plan.groups.map((g) => `${g.id}:${g.layout}`).join(", ");
8452
8452
  fixes.push(`Verified group layouts (${layoutTypes})`);
8453
8453
  console.log(chalk15.green(` \u2714 Verified group layouts: ${layoutTypes}`));
8454
+ const hasSidebar = plan.groups.some((g) => g.layout === "sidebar" || g.layout === "both");
8455
+ const sidebarPath = resolve10(projectRoot, "components", "shared", "sidebar.tsx");
8456
+ if (hasSidebar && !existsSync16(sidebarPath) && !dryRun) {
8457
+ if (!dsm) {
8458
+ dsm = new DesignSystemManager9(project.configPath);
8459
+ await dsm.load();
8460
+ }
8461
+ const { PageGenerator, generateSharedComponent: generateSharedComponent6 } = await import("@getcoherent/core");
8462
+ const generator = new PageGenerator(dsm.getConfig());
8463
+ const sidebarCode = generator.generateSharedSidebarCode();
8464
+ await generateSharedComponent6(projectRoot, {
8465
+ name: "AppSidebar",
8466
+ type: "layout",
8467
+ code: sidebarCode,
8468
+ description: "Application sidebar using shadcn/ui Sidebar components",
8469
+ usedIn: ["app/(app)/layout.tsx"],
8470
+ overwrite: true
8471
+ });
8472
+ fixes.push("Generated AppSidebar shared component");
8473
+ console.log(chalk15.green(" \u2714 Generated AppSidebar shared component"));
8474
+ }
8454
8475
  }
8455
8476
  } catch {
8456
8477
  }
@@ -11,9 +11,9 @@ import {
11
11
  routeToKey,
12
12
  savePlan,
13
13
  updateArchitecturePlan
14
- } from "./chunk-VNDQ4DYQ.js";
14
+ } from "./chunk-RKXLSNDV.js";
15
15
  import "./chunk-5AHG4NNX.js";
16
- import "./chunk-4WTUPW2L.js";
16
+ import "./chunk-NP2CGABX.js";
17
17
  import "./chunk-3RG5ZIWI.js";
18
18
  export {
19
19
  ArchitecturePlanSchema,
@@ -4,7 +4,7 @@ import {
4
4
  formatIssues,
5
5
  validatePageQuality,
6
6
  verifyIncrementalEdit
7
- } from "./chunk-4WTUPW2L.js";
7
+ } from "./chunk-NP2CGABX.js";
8
8
  import "./chunk-3RG5ZIWI.js";
9
9
  export {
10
10
  autoFixCode,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.6.27",
6
+ "version": "0.6.29",
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,8 +49,7 @@
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.27"
52
+ "zod": "^3.22.4"
47
53
  },
48
54
  "devDependencies": {
49
55
  "@types/node": "^20.11.0",
@@ -52,11 +58,5 @@
52
58
  "react": "^19.2.4",
53
59
  "tsup": "^8.0.1",
54
60
  "typescript": "^5.3.3"
55
- },
56
- "scripts": {
57
- "dev": "tsup --watch",
58
- "build": "tsup",
59
- "typecheck": "tsc --noEmit",
60
- "test": "vitest"
61
61
  }
62
- }
62
+ }
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.