@getcoherent/cli 0.5.0 → 0.5.1

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 +35 -44
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -2435,7 +2435,7 @@ import {
2435
2435
  PageManager as PageManager3,
2436
2436
  CLI_VERSION as CLI_VERSION2,
2437
2437
  getTemplateForPageType as getTemplateForPageType2,
2438
- loadManifest as loadManifest8,
2438
+ loadManifest as loadManifest7,
2439
2439
  saveManifest as saveManifest2
2440
2440
  } from "@getcoherent/core";
2441
2441
 
@@ -5890,7 +5890,7 @@ import { dirname as dirname6 } from "path";
5890
5890
  import chalk11 from "chalk";
5891
5891
  import {
5892
5892
  getTemplateForPageType,
5893
- loadManifest as loadManifest6,
5893
+ loadManifest as loadManifest5,
5894
5894
  saveManifest,
5895
5895
  updateUsedIn,
5896
5896
  findSharedComponentByIdOrName,
@@ -6684,7 +6684,7 @@ import {
6684
6684
  PageGenerator,
6685
6685
  TailwindConfigGenerator
6686
6686
  } from "@getcoherent/core";
6687
- import { integrateSharedLayoutIntoRootLayout as integrateSharedLayoutIntoRootLayout2, loadManifest as loadManifest5, generateSharedComponent as generateSharedComponent2 } from "@getcoherent/core";
6687
+ import { integrateSharedLayoutIntoRootLayout as integrateSharedLayoutIntoRootLayout2, generateSharedComponent as generateSharedComponent2 } from "@getcoherent/core";
6688
6688
  import chalk9 from "chalk";
6689
6689
  async function validateAndFixGeneratedCode(projectRoot, code, options = {}) {
6690
6690
  const fixes = [];
@@ -6755,13 +6755,6 @@ async function regenerateLayout(config2, projectRoot) {
6755
6755
  const layout = config2.pages[0]?.layout || "centered";
6756
6756
  const appType = config2.settings.appType || "multi-page";
6757
6757
  const generator = new PageGenerator(config2);
6758
- let manifest = null;
6759
- try {
6760
- manifest = await loadManifest5(projectRoot);
6761
- } catch {
6762
- }
6763
- const hasSharedHeader = manifest?.shared.some((c) => c.type === "layout" && /header|nav/i.test(c.name)) ?? false;
6764
- const hasSharedFooter = manifest?.shared.some((c) => c.type === "layout" && /footer/i.test(c.name)) ?? false;
6765
6758
  const code = await generator.generateLayout(layout, appType, { skipNav: true });
6766
6759
  const layoutPath = resolve6(projectRoot, "app", "layout.tsx");
6767
6760
  await writeFile(layoutPath, code);
@@ -6778,17 +6771,15 @@ async function regenerateLayout(config2, projectRoot) {
6778
6771
  overwrite: true
6779
6772
  });
6780
6773
  }
6781
- if (!hasSharedFooter) {
6782
- const footerCode = generator.generateSharedFooterCode();
6783
- await generateSharedComponent2(projectRoot, {
6784
- name: "Footer",
6785
- type: "layout",
6786
- code: footerCode,
6787
- description: "Site footer",
6788
- usedIn: ["app/layout.tsx"],
6789
- overwrite: true
6790
- });
6791
- }
6774
+ const footerCode = generator.generateSharedFooterCode();
6775
+ await generateSharedComponent2(projectRoot, {
6776
+ name: "Footer",
6777
+ type: "layout",
6778
+ code: footerCode,
6779
+ description: "Site footer",
6780
+ usedIn: ["app/layout.tsx"],
6781
+ overwrite: true
6782
+ });
6792
6783
  if (navType === "sidebar" || navType === "both") {
6793
6784
  const sidebarCode = generator.generateSharedSidebarCode();
6794
6785
  await generateSharedComponent2(projectRoot, {
@@ -7338,7 +7329,7 @@ async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider,
7338
7329
  fixes.forEach((f) => console.log(chalk11.dim(` ${f}`)));
7339
7330
  }
7340
7331
  await writeFile(pageFilePath, fixedCode);
7341
- const manifest = await loadManifest6(projectRoot);
7332
+ const manifest = await loadManifest5(projectRoot);
7342
7333
  const usedIn = manifest.shared.find((e) => e.id === resolved.id)?.usedIn ?? [];
7343
7334
  const routePath = route.replace(/^\//, "");
7344
7335
  const filePathRel = routePath ? `app/${routePath}/page.tsx` : "app/page.tsx";
@@ -7443,7 +7434,7 @@ async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider,
7443
7434
  await writeFile(fullPath, fixedCode);
7444
7435
  usedInFiles.push(relPath);
7445
7436
  }
7446
- const manifest = await loadManifest6(projectRoot);
7437
+ const manifest = await loadManifest5(projectRoot);
7447
7438
  const nextManifest = updateUsedIn(manifest, created.id, usedInFiles);
7448
7439
  await saveManifest(projectRoot, nextManifest);
7449
7440
  printPromoteAndLinkReport({
@@ -7627,7 +7618,7 @@ async function applyModification(request, dsm, cm, pm, projectRoot, aiProvider,
7627
7618
  cm.updateConfig(cfg);
7628
7619
  pm.updateConfig(cfg);
7629
7620
  }
7630
- const manifestForAudit = await loadManifest6(projectRoot);
7621
+ const manifestForAudit = await loadManifest5(projectRoot);
7631
7622
  await warnInlineDuplicates(projectRoot, page.name || page.id || route.slice(1), codeToWrite, manifestForAudit);
7632
7623
  const relFilePath = routeToRelPath(route, isAuth);
7633
7624
  printPostGenerationReport({
@@ -7806,7 +7797,7 @@ ${pagesCtx}`
7806
7797
  cm.updateConfig(cfg);
7807
7798
  pm.updateConfig(cfg);
7808
7799
  }
7809
- const manifestForAudit = await loadManifest6(projectRoot);
7800
+ const manifestForAudit = await loadManifest5(projectRoot);
7810
7801
  await warnInlineDuplicates(
7811
7802
  projectRoot,
7812
7803
  pageDef.name || pageDef.id || route.slice(1),
@@ -7843,7 +7834,7 @@ ${pagesCtx}`
7843
7834
  fixes.forEach((f) => console.log(chalk11.dim(` ${f}`)));
7844
7835
  }
7845
7836
  const relFilePath = routeToRelPath(route, isAuth);
7846
- const manifest = await loadManifest6(projectRoot);
7837
+ const manifest = await loadManifest5(projectRoot);
7847
7838
  printPostGenerationReport({
7848
7839
  action: "updated",
7849
7840
  pageTitle: pageDef.name || pageDef.id || "Page",
@@ -7892,7 +7883,7 @@ ${pagesCtx}`
7892
7883
  import chalk12 from "chalk";
7893
7884
  import { resolve as resolve8 } from "path";
7894
7885
  import { existsSync as existsSync15, readFileSync as readFileSync9, writeFileSync as writeFileSync8, mkdirSync as mkdirSync5 } from "fs";
7895
- import { DesignSystemManager as DesignSystemManager6, ComponentManager as ComponentManager3, loadManifest as loadManifest7 } from "@getcoherent/core";
7886
+ import { DesignSystemManager as DesignSystemManager6, ComponentManager as ComponentManager3, loadManifest as loadManifest6 } from "@getcoherent/core";
7896
7887
  var DEBUG3 = process.env.COHERENT_DEBUG === "1";
7897
7888
  async function interactiveChat(options, chatCommandFn) {
7898
7889
  const { createInterface } = await import("readline");
@@ -7962,7 +7953,7 @@ async function interactiveChat(options, chatCommandFn) {
7962
7953
  return;
7963
7954
  }
7964
7955
  if (lower === "components" || lower === "list components" || lower.includes("what components")) {
7965
- const manifest = await loadManifest7(projectRoot);
7956
+ const manifest = await loadManifest6(projectRoot);
7966
7957
  if (manifest.shared.length === 0) {
7967
7958
  console.log(chalk12.gray("\n No shared components yet.\n"));
7968
7959
  } else {
@@ -7996,7 +7987,7 @@ async function interactiveChat(options, chatCommandFn) {
7996
7987
  }
7997
7988
  if (lower === "status") {
7998
7989
  const currentConfig = dsm.getConfig();
7999
- const manifest = await loadManifest7(projectRoot);
7990
+ const manifest = await loadManifest6(projectRoot);
8000
7991
  console.log(chalk12.bold(`
8001
7992
  ${currentConfig.name || "Coherent Project"}`));
8002
7993
  console.log(
@@ -8178,7 +8169,7 @@ async function chatCommand(message, options) {
8178
8169
  }
8179
8170
  }
8180
8171
  spinner.start("Parsing your request...");
8181
- let manifest = await loadManifest8(project.root);
8172
+ let manifest = await loadManifest7(project.root);
8182
8173
  const validShared = manifest.shared.filter((s) => {
8183
8174
  const fp = resolve9(project.root, s.file);
8184
8175
  return existsSync16(fp);
@@ -8749,7 +8740,7 @@ import { DesignSystemManager as DesignSystemManager8, ComponentGenerator as Comp
8749
8740
  // src/utils/file-watcher.ts
8750
8741
  import { readFileSync as readFileSync12, writeFileSync as writeFileSync9, existsSync as existsSync18 } from "fs";
8751
8742
  import { relative as relative3, join as join10 } from "path";
8752
- import { loadManifest as loadManifest9, saveManifest as saveManifest3 } from "@getcoherent/core";
8743
+ import { loadManifest as loadManifest8, saveManifest as saveManifest3 } from "@getcoherent/core";
8753
8744
 
8754
8745
  // src/utils/component-integrity.ts
8755
8746
  import { existsSync as existsSync17, readFileSync as readFileSync11, readdirSync as readdirSync2 } from "fs";
@@ -9103,7 +9094,7 @@ async function handleFileChange(projectRoot, filePath) {
9103
9094
  if (config2.warnSharedReuse) {
9104
9095
  let manifest;
9105
9096
  try {
9106
- manifest = await loadManifest9(projectRoot);
9097
+ manifest = await loadManifest8(projectRoot);
9107
9098
  } catch {
9108
9099
  manifest = { shared: [], nextId: 1 };
9109
9100
  }
@@ -9122,7 +9113,7 @@ async function handleFileDelete(projectRoot, filePath) {
9122
9113
  if (!relativePath.startsWith("components/") || relativePath.startsWith("components/ui/")) return;
9123
9114
  try {
9124
9115
  const chalk32 = (await import("chalk")).default;
9125
- const manifest = await loadManifest9(projectRoot);
9116
+ const manifest = await loadManifest8(projectRoot);
9126
9117
  const orphaned = manifest.shared.find((s) => s.file === relativePath);
9127
9118
  if (orphaned) {
9128
9119
  const cleaned = {
@@ -9143,7 +9134,7 @@ async function detectNewComponent(projectRoot, filePath) {
9143
9134
  if (!relativePath.endsWith(".tsx") && !relativePath.endsWith(".jsx")) return;
9144
9135
  try {
9145
9136
  const chalk32 = (await import("chalk")).default;
9146
- const manifest = await loadManifest9(projectRoot);
9137
+ const manifest = await loadManifest8(projectRoot);
9147
9138
  const alreadyRegistered = manifest.shared.some((s) => s.file === relativePath);
9148
9139
  if (alreadyRegistered) return;
9149
9140
  const code = readFileSync12(filePath, "utf-8");
@@ -10060,7 +10051,7 @@ import {
10060
10051
  ComponentManager as ComponentManager5,
10061
10052
  PageManager as PageManager4,
10062
10053
  ComponentGenerator as ComponentGenerator4,
10063
- loadManifest as loadManifest10,
10054
+ loadManifest as loadManifest9,
10064
10055
  saveManifest as saveManifest4
10065
10056
  } from "@getcoherent/core";
10066
10057
  function extractComponentIdsFromCode2(code) {
@@ -10267,7 +10258,7 @@ async function fixCommand(opts = {}) {
10267
10258
  fileIssues.push({ path: relativePath, report });
10268
10259
  }
10269
10260
  try {
10270
- let manifest = await loadManifest10(project.root);
10261
+ let manifest = await loadManifest9(project.root);
10271
10262
  let manifestModified = false;
10272
10263
  const { manifest: cleaned, removed: orphaned } = removeOrphanedEntries(project.root, manifest);
10273
10264
  if (orphaned.length > 0) {
@@ -10367,7 +10358,7 @@ async function fixCommand(opts = {}) {
10367
10358
  import chalk19 from "chalk";
10368
10359
  import { resolve as resolve13 } from "path";
10369
10360
  import { readdirSync as readdirSync5, readFileSync as readFileSync15, statSync as statSync2, existsSync as existsSync22 } from "fs";
10370
- import { loadManifest as loadManifest11 } from "@getcoherent/core";
10361
+ import { loadManifest as loadManifest10 } from "@getcoherent/core";
10371
10362
  var EXCLUDED_DIRS = /* @__PURE__ */ new Set(["node_modules", "design-system"]);
10372
10363
  function findTsxFiles(dir) {
10373
10364
  const results = [];
@@ -10494,7 +10485,7 @@ async function checkCommand(opts = {}) {
10494
10485
  \u{1F517} Internal Links`) + chalk19.dim(` \u2014 all ${result.links.total} links resolve \u2713`));
10495
10486
  }
10496
10487
  try {
10497
- const manifest = await loadManifest11(project.root);
10488
+ const manifest = await loadManifest10(project.root);
10498
10489
  if (manifest.shared.length > 0) {
10499
10490
  for (const entry of manifest.shared) {
10500
10491
  const fullPath = resolve13(project.root, entry.file);
@@ -10510,7 +10501,7 @@ async function checkCommand(opts = {}) {
10510
10501
  }
10511
10502
  if (!skipShared) {
10512
10503
  try {
10513
- const manifest = await loadManifest11(projectRoot);
10504
+ const manifest = await loadManifest10(projectRoot);
10514
10505
  if (!opts.json && manifest.shared.length > 0) {
10515
10506
  console.log(chalk19.cyan(`
10516
10507
  \u{1F9E9} Shared Components`) + chalk19.dim(` (${manifest.shared.length} registered)
@@ -10692,7 +10683,7 @@ import chalk25 from "chalk";
10692
10683
  import {
10693
10684
  DesignSystemManager as DesignSystemManager12,
10694
10685
  ComponentManager as ComponentManager6,
10695
- loadManifest as loadManifest12,
10686
+ loadManifest as loadManifest11,
10696
10687
  generateSharedComponent as generateSharedComponent4,
10697
10688
  integrateSharedLayoutIntoRootLayout as integrateSharedLayoutIntoRootLayout3
10698
10689
  } from "@getcoherent/core";
@@ -10733,7 +10724,7 @@ function createComponentsCommand() {
10733
10724
  await dsm.load();
10734
10725
  const config2 = dsm.getConfig();
10735
10726
  const cm = new ComponentManager6(config2);
10736
- const manifest = await loadManifest12(project.root);
10727
+ const manifest = await loadManifest11(project.root);
10737
10728
  if (opts.json) {
10738
10729
  const installed2 = cm.getAllComponents();
10739
10730
  console.log(JSON.stringify({ shared: manifest.shared, ui: installed2 }, null, 2));
@@ -10785,7 +10776,7 @@ function createComponentsCommand() {
10785
10776
  sharedCmd.option("--json", "Machine-readable JSON output").option("--verbose", "Show file paths and usage details").action(async (opts) => {
10786
10777
  const project = findConfig();
10787
10778
  if (!project) exitNotCoherent();
10788
- const manifest = await loadManifest12(project.root);
10779
+ const manifest = await loadManifest11(project.root);
10789
10780
  if (opts.json) {
10790
10781
  console.log(JSON.stringify(manifest, null, 2));
10791
10782
  return;
@@ -11489,7 +11480,7 @@ import { existsSync as existsSync26, readFileSync as readFileSync17 } from "fs";
11489
11480
  import { join as join17, relative as relative4, dirname as dirname10 } from "path";
11490
11481
  import { readdir as readdir4, readFile as readFile6 } from "fs/promises";
11491
11482
  import { DesignSystemManager as DesignSystemManager16 } from "@getcoherent/core";
11492
- import { loadManifest as loadManifest13, saveManifest as saveManifest5, findSharedComponent } from "@getcoherent/core";
11483
+ import { loadManifest as loadManifest12, saveManifest as saveManifest5, findSharedComponent } from "@getcoherent/core";
11493
11484
  function extractTokensFromProject(projectRoot) {
11494
11485
  const lightColors = {};
11495
11486
  const darkColors = {};
@@ -11769,7 +11760,7 @@ async function syncCommand(options = {}) {
11769
11760
  let reconcileResult = null;
11770
11761
  if (doComponents) {
11771
11762
  spinner.start("Reconciling shared components...");
11772
- const manifest = await loadManifest13(project.root);
11763
+ const manifest = await loadManifest12(project.root);
11773
11764
  const { manifest: reconciledManifest, result: rr } = reconcileComponents(project.root, manifest);
11774
11765
  reconcileResult = rr;
11775
11766
  if (!dryRun) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "0.5.0",
6
+ "version": "0.5.1",
7
7
  "description": "CLI interface for Coherent Design Method",
8
8
  "type": "module",
9
9
  "main": "./dist/index.js",
@@ -43,7 +43,7 @@
43
43
  "ora": "^7.0.1",
44
44
  "prompts": "^2.4.2",
45
45
  "zod": "^3.22.4",
46
- "@getcoherent/core": "0.5.0"
46
+ "@getcoherent/core": "0.5.1"
47
47
  },
48
48
  "devDependencies": {
49
49
  "@types/node": "^20.11.0",