@xylabs/ts-scripts-yarn3 7.4.3 → 7.4.5

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 (44) hide show
  1. package/dist/actions/claude-rules.mjs +113 -0
  2. package/dist/actions/claude-rules.mjs.map +1 -0
  3. package/dist/actions/deplint/checkPackage/checkPackage.mjs +3 -2
  4. package/dist/actions/deplint/checkPackage/checkPackage.mjs.map +1 -1
  5. package/dist/actions/deplint/checkPackage/index.mjs +3 -2
  6. package/dist/actions/deplint/checkPackage/index.mjs.map +1 -1
  7. package/dist/actions/deplint/deplint.mjs +3 -2
  8. package/dist/actions/deplint/deplint.mjs.map +1 -1
  9. package/dist/actions/deplint/getExternalImportsFromFiles.mjs +3 -2
  10. package/dist/actions/deplint/getExternalImportsFromFiles.mjs.map +1 -1
  11. package/dist/actions/deplint/getImportsFromFile.mjs +3 -2
  12. package/dist/actions/deplint/getImportsFromFile.mjs.map +1 -1
  13. package/dist/actions/deplint/index.mjs +3 -2
  14. package/dist/actions/deplint/index.mjs.map +1 -1
  15. package/dist/actions/index.mjs +235 -131
  16. package/dist/actions/index.mjs.map +1 -1
  17. package/dist/bin/xy.mjs +204 -86
  18. package/dist/bin/xy.mjs.map +1 -1
  19. package/dist/index.d.ts +9 -1
  20. package/dist/index.mjs +269 -147
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/lib/claudeMdTemplate.mjs +24 -0
  23. package/dist/lib/claudeMdTemplate.mjs.map +1 -0
  24. package/dist/lib/index.mjs +31 -9
  25. package/dist/lib/index.mjs.map +1 -1
  26. package/dist/xy/index.mjs +204 -86
  27. package/dist/xy/index.mjs.map +1 -1
  28. package/dist/xy/xy.mjs +204 -86
  29. package/dist/xy/xy.mjs.map +1 -1
  30. package/dist/xy/xyCommonCommands.mjs +137 -20
  31. package/dist/xy/xyCommonCommands.mjs.map +1 -1
  32. package/dist/xy/xyLintCommands.mjs +3 -2
  33. package/dist/xy/xyLintCommands.mjs.map +1 -1
  34. package/package.json +4 -3
  35. package/templates/CLAUDE-project.md +4 -0
  36. package/templates/rules/xylabs-architecture.md +11 -0
  37. package/templates/rules/xylabs-build.md +14 -0
  38. package/templates/rules/xylabs-dependencies.md +24 -0
  39. package/templates/rules/xylabs-error-handling.md +7 -0
  40. package/templates/rules/xylabs-frameworks.md +8 -0
  41. package/templates/rules/xylabs-git-workflow.md +9 -0
  42. package/templates/rules/xylabs-naming.md +10 -0
  43. package/templates/rules/xylabs-style.md +22 -0
  44. package/templates/rules/xylabs-typescript.md +10 -0
package/dist/xy/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/xy/xy.ts
2
- import chalk26 from "chalk";
2
+ import chalk27 from "chalk";
3
3
 
4
4
  // src/actions/build.ts
5
5
  import chalk7 from "chalk";
@@ -17,6 +17,25 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
17
17
  }
18
18
  };
19
19
 
20
+ // src/lib/claudeMdTemplate.ts
21
+ import { readdirSync, readFileSync } from "fs";
22
+ import { createRequire } from "module";
23
+ import PATH from "path";
24
+ var require2 = createRequire(import.meta.url);
25
+ var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/package.json"));
26
+ var templatesDir = PATH.resolve(packageRoot, "templates");
27
+ var XYLABS_RULES_PREFIX = "xylabs-";
28
+ var claudeMdRuleTemplates = () => {
29
+ const rulesDir = PATH.resolve(templatesDir, "rules");
30
+ const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
31
+ const result = {};
32
+ for (const file of files) {
33
+ result[file] = readFileSync(PATH.resolve(rulesDir, file), "utf8");
34
+ }
35
+ return result;
36
+ };
37
+ var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
38
+
20
39
  // src/lib/deleteGlob.ts
21
40
  import fs from "fs";
22
41
  import { glob } from "glob";
@@ -206,7 +225,7 @@ var CROSS_PLATFORM_NEWLINE = "\n";
206
225
  // src/lib/file/fileLines.ts
207
226
  import {
208
227
  existsSync,
209
- readFileSync,
228
+ readFileSync as readFileSync2,
210
229
  writeFileSync
211
230
  } from "fs";
212
231
 
@@ -221,10 +240,10 @@ var union = (a, b) => /* @__PURE__ */ new Set([...new Set(a), ...new Set(b)]);
221
240
  var defaultReadFileSyncOptions = { encoding: "utf8" };
222
241
 
223
242
  // src/lib/file/fileLines.ts
224
- var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [];
243
+ var readLines = (uri, options = defaultReadFileSyncOptions) => existsSync(uri) ? readFileSync2(uri, options).replace(WINDOWS_NEWLINE_REGEX, CROSS_PLATFORM_NEWLINE).split(CROSS_PLATFORM_NEWLINE) : [];
225
244
  var readNonEmptyLines = (uri, options = defaultReadFileSyncOptions) => readLines(uri, options).filter(notEmpty);
226
245
  var writeLines = (uri, lines, options = defaultReadFileSyncOptions) => {
227
- const existing = existsSync(uri) ? readFileSync(uri, options) : void 0;
246
+ const existing = existsSync(uri) ? readFileSync2(uri, options) : void 0;
228
247
  const desired = lines.join(CROSS_PLATFORM_NEWLINE);
229
248
  if (existing !== desired) writeFileSync(uri, desired, options);
230
249
  };
@@ -296,10 +315,10 @@ var generateIgnoreFiles = (filename3, pkg) => {
296
315
  };
297
316
 
298
317
  // src/lib/parsedPackageJSON.ts
299
- import { readFileSync as readFileSync2 } from "fs";
318
+ import { readFileSync as readFileSync3 } from "fs";
300
319
  var parsedPackageJSON = (path7) => {
301
320
  const pathToPackageJSON = path7 ?? process.env.npm_package_json ?? "";
302
- const packageJSON = readFileSync2(pathToPackageJSON).toString();
321
+ const packageJSON = readFileSync3(pathToPackageJSON).toString();
303
322
  return JSON.parse(packageJSON);
304
323
  };
305
324
 
@@ -409,6 +428,89 @@ var build = async ({
409
428
  return result;
410
429
  };
411
430
 
431
+ // src/actions/claude-rules.ts
432
+ import {
433
+ existsSync as existsSync4,
434
+ mkdirSync,
435
+ readdirSync as readdirSync2,
436
+ readFileSync as readFileSync4,
437
+ unlinkSync,
438
+ writeFileSync as writeFileSync2
439
+ } from "fs";
440
+ import PATH2 from "path";
441
+ import chalk8 from "chalk";
442
+ var syncRuleFiles = (rulesDir) => {
443
+ const templates = claudeMdRuleTemplates();
444
+ const templateNames = new Set(Object.keys(templates));
445
+ let updated = 0;
446
+ let created = 0;
447
+ for (const [filename3, content] of Object.entries(templates)) {
448
+ const targetPath = PATH2.resolve(rulesDir, filename3);
449
+ const existing = existsSync4(targetPath) ? readFileSync4(targetPath, "utf8") : void 0;
450
+ if (existing === content) continue;
451
+ writeFileSync2(targetPath, content, "utf8");
452
+ if (existing) {
453
+ updated++;
454
+ } else {
455
+ created++;
456
+ }
457
+ }
458
+ return {
459
+ created,
460
+ templateNames,
461
+ updated
462
+ };
463
+ };
464
+ var removeStaleRules = (rulesDir, templateNames) => {
465
+ const existingRules = readdirSync2(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
466
+ let removed = 0;
467
+ for (const file of existingRules) {
468
+ if (!templateNames.has(file)) {
469
+ unlinkSync(PATH2.resolve(rulesDir, file));
470
+ removed++;
471
+ }
472
+ }
473
+ return removed;
474
+ };
475
+ var logRulesResult = (created, updated, removed) => {
476
+ if (created || updated || removed) {
477
+ const parts = [
478
+ created ? `${created} created` : "",
479
+ updated ? `${updated} updated` : "",
480
+ removed ? `${removed} removed` : ""
481
+ ].filter(Boolean);
482
+ console.log(chalk8.green(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: ${parts.join(", ")}`));
483
+ } else {
484
+ console.log(chalk8.gray(`.claude/rules/${XYLABS_RULES_PREFIX}*.md: already up to date`));
485
+ }
486
+ };
487
+ var ensureProjectClaudeMd = (cwd, force) => {
488
+ const projectPath = PATH2.resolve(cwd, "CLAUDE.md");
489
+ if (!existsSync4(projectPath) || force) {
490
+ if (force && existsSync4(projectPath)) {
491
+ console.log(chalk8.yellow("Overwriting existing CLAUDE.md"));
492
+ }
493
+ writeFileSync2(projectPath, claudeMdProjectTemplate(), "utf8");
494
+ console.log(chalk8.green("Generated CLAUDE.md"));
495
+ } else {
496
+ console.log(chalk8.gray("CLAUDE.md already exists (skipped)"));
497
+ }
498
+ };
499
+ var claudeRules = ({ force } = {}) => {
500
+ const cwd = INIT_CWD() ?? process.cwd();
501
+ const rulesDir = PATH2.resolve(cwd, ".claude", "rules");
502
+ mkdirSync(rulesDir, { recursive: true });
503
+ const {
504
+ created,
505
+ templateNames,
506
+ updated
507
+ } = syncRuleFiles(rulesDir);
508
+ const removed = removeStaleRules(rulesDir, templateNames);
509
+ logRulesResult(created, updated, removed);
510
+ ensureProjectClaudeMd(cwd, force);
511
+ return 0;
512
+ };
513
+
412
514
  // src/actions/clean.ts
413
515
  var clean = async ({ verbose, pkg }) => {
414
516
  return pkg ? await cleanPackage({ pkg, verbose }) : cleanAll({ verbose });
@@ -423,16 +525,16 @@ var cleanAll = ({ verbose }) => {
423
525
 
424
526
  // src/actions/clean-docs.ts
425
527
  import path from "path";
426
- import chalk8 from "chalk";
528
+ import chalk9 from "chalk";
427
529
  var cleanDocs = () => {
428
530
  const pkgName = process.env.npm_package_name;
429
- console.log(chalk8.green(`Cleaning Docs [${pkgName}]`));
531
+ console.log(chalk9.green(`Cleaning Docs [${pkgName}]`));
430
532
  for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
431
533
  return 0;
432
534
  };
433
535
 
434
536
  // src/actions/compile.ts
435
- import chalk9 from "chalk";
537
+ import chalk10 from "chalk";
436
538
  var compile = ({
437
539
  verbose,
438
540
  target,
@@ -473,7 +575,7 @@ var compileAll = ({
473
575
  const incrementalOptions = incremental ? ["--since", "-Ap", "--topological-dev"] : ["--parallel", "-Ap", "--topological-dev"];
474
576
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
475
577
  if (jobs) {
476
- console.log(chalk9.blue(`Jobs set to [${jobs}]`));
578
+ console.log(chalk10.blue(`Jobs set to [${jobs}]`));
477
579
  }
478
580
  const result = runSteps(`Compile${incremental ? "-Incremental" : ""} [All]`, [
479
581
  ["yarn", [
@@ -487,13 +589,13 @@ var compileAll = ({
487
589
  ...targetOptions
488
590
  ]]
489
591
  ]);
490
- console.log(`${chalk9.gray("Compiled in")} [${chalk9.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk9.gray("seconds")}`);
592
+ console.log(`${chalk10.gray("Compiled in")} [${chalk10.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk10.gray("seconds")}`);
491
593
  return result;
492
594
  };
493
595
 
494
596
  // src/actions/copy-assets.ts
495
597
  import path2 from "path/posix";
496
- import chalk10 from "chalk";
598
+ import chalk11 from "chalk";
497
599
  import cpy from "cpy";
498
600
  var copyPackageTargetAssets = async (target, name, location) => {
499
601
  try {
@@ -516,7 +618,7 @@ var copyPackageTargetAssets = async (target, name, location) => {
516
618
  };
517
619
  var copyTargetAssets = async (target, pkg) => {
518
620
  const workspaces = yarnWorkspaces();
519
- console.log(chalk10.green(`Copying Assets [${target.toUpperCase()}]`));
621
+ console.log(chalk11.green(`Copying Assets [${target.toUpperCase()}]`));
520
622
  const workspaceList = workspaces.filter(({ name }) => {
521
623
  return pkg === void 0 || name === pkg;
522
624
  });
@@ -600,7 +702,7 @@ var dead = () => {
600
702
  };
601
703
 
602
704
  // src/actions/deplint/deplint.ts
603
- import chalk16 from "chalk";
705
+ import chalk17 from "chalk";
604
706
 
605
707
  // src/actions/deplint/findFiles.ts
606
708
  import fs2 from "fs";
@@ -747,8 +849,9 @@ function getImportsFromFile(filePath, importPaths, typeImportPaths) {
747
849
  }
748
850
  visit(sourceFile);
749
851
  const importsStartsWithExcludes = [".", "#", "node:"];
750
- const cleanedImports = imports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
751
- const cleanedTypeImports = typeImports.filter((imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc))).map(getBasePackageName);
852
+ const isValidImport = (imp) => !importsStartsWithExcludes.some((exc) => imp.startsWith(exc)) && !imp.includes("*") && !imp.includes("!");
853
+ const cleanedImports = imports.filter(isValidImport).map(getBasePackageName);
854
+ const cleanedTypeImports = typeImports.filter(isValidImport).map(getBasePackageName);
752
855
  for (const imp of cleanedImports) {
753
856
  importPaths[imp] = importPaths[imp] ?? [];
754
857
  importPaths[imp].push(filePath);
@@ -800,12 +903,12 @@ function getExternalImportsFromFiles({
800
903
 
801
904
  // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
802
905
  import { builtinModules } from "module";
803
- import chalk11 from "chalk";
906
+ import chalk12 from "chalk";
804
907
  function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
805
908
  return dependencies.includes(imp) || imp === name || dependencies.includes(`@types/${imp}`) || peerDependencies.includes(imp) || peerDependencies.includes(`@types/${imp}`) || builtinModules.includes(imp) || builtinModules.includes(`@types/${imp}`);
806
909
  }
807
910
  function logMissing(name, imp, importPaths) {
808
- console.log(`[${chalk11.blue(name)}] Missing dependency in package.json: ${chalk11.red(imp)}`);
911
+ console.log(`[${chalk12.blue(name)}] Missing dependency in package.json: ${chalk12.red(imp)}`);
809
912
  if (importPaths[imp]) {
810
913
  console.log(` ${importPaths[imp].join("\n ")}`);
811
914
  }
@@ -830,7 +933,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
830
933
  }
831
934
  if (unlistedDependencies > 0) {
832
935
  const packageLocation = `${location}/package.json`;
833
- console.log(` ${chalk11.yellow(packageLocation)}
936
+ console.log(` ${chalk12.yellow(packageLocation)}
834
937
  `);
835
938
  }
836
939
  return unlistedDependencies;
@@ -838,7 +941,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
838
941
 
839
942
  // src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
840
943
  import { builtinModules as builtinModules2 } from "module";
841
- import chalk12 from "chalk";
944
+ import chalk13 from "chalk";
842
945
  function getUnlistedDevDependencies({ name, location }, {
843
946
  devDependencies,
844
947
  dependencies,
@@ -852,7 +955,7 @@ function getUnlistedDevDependencies({ name, location }, {
852
955
  for (const imp of externalAllImports) {
853
956
  if (!distImports.includes(imp) && imp !== name && !dependencies.includes(imp) && !dependencies.includes(`@types/${imp}`) && !peerDependencies.includes(imp) && !peerDependencies.includes(`@types/${imp}`) && !devDependencies.includes(imp) && !devDependencies.includes(`@types/${imp}`) && !builtinModules2.includes(imp)) {
854
957
  unlistedDevDependencies++;
855
- console.log(`[${chalk12.blue(name)}] Missing devDependency in package.json: ${chalk12.red(imp)}`);
958
+ console.log(`[${chalk13.blue(name)}] Missing devDependency in package.json: ${chalk13.red(imp)}`);
856
959
  if (allImportPaths[imp]) {
857
960
  console.log(` ${allImportPaths[imp].join("\n ")}`);
858
961
  }
@@ -860,14 +963,14 @@ function getUnlistedDevDependencies({ name, location }, {
860
963
  }
861
964
  if (unlistedDevDependencies > 0) {
862
965
  const packageLocation = `${location}/package.json`;
863
- console.log(` ${chalk12.yellow(packageLocation)}
966
+ console.log(` ${chalk13.yellow(packageLocation)}
864
967
  `);
865
968
  }
866
969
  return unlistedDevDependencies;
867
970
  }
868
971
 
869
972
  // src/actions/deplint/checkPackage/getUnusedDependencies.ts
870
- import chalk13 from "chalk";
973
+ import chalk14 from "chalk";
871
974
  function getUnusedDependencies({ name, location }, { dependencies }, {
872
975
  externalDistImports,
873
976
  externalDistTypeImports,
@@ -878,22 +981,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
878
981
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
879
982
  unusedDependencies++;
880
983
  if (externalAllImports.includes(dep)) {
881
- console.log(`[${chalk13.blue(name)}] dependency should be devDependency in package.json: ${chalk13.red(dep)}`);
984
+ console.log(`[${chalk14.blue(name)}] dependency should be devDependency in package.json: ${chalk14.red(dep)}`);
882
985
  } else {
883
- console.log(`[${chalk13.blue(name)}] Unused dependency in package.json: ${chalk13.red(dep)}`);
986
+ console.log(`[${chalk14.blue(name)}] Unused dependency in package.json: ${chalk14.red(dep)}`);
884
987
  }
885
988
  }
886
989
  }
887
990
  if (unusedDependencies > 0) {
888
991
  const packageLocation = `${location}/package.json`;
889
- console.log(` ${chalk13.yellow(packageLocation)}
992
+ console.log(` ${chalk14.yellow(packageLocation)}
890
993
  `);
891
994
  }
892
995
  return unusedDependencies;
893
996
  }
894
997
 
895
998
  // src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
896
- import chalk14 from "chalk";
999
+ import chalk15 from "chalk";
897
1000
 
898
1001
  // src/actions/deplint/getRequiredPeerDependencies.ts
899
1002
  import fs6 from "fs";
@@ -1076,34 +1179,34 @@ function getUnusedDevDependencies({ name, location }, {
1076
1179
  if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
1077
1180
  if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
1078
1181
  unusedDevDependencies++;
1079
- console.log(`[${chalk14.blue(name)}] Unused devDependency in package.json: ${chalk14.red(dep)}`);
1182
+ console.log(`[${chalk15.blue(name)}] Unused devDependency in package.json: ${chalk15.red(dep)}`);
1080
1183
  }
1081
1184
  }
1082
1185
  if (unusedDevDependencies > 0) {
1083
1186
  const packageLocation = `${location}/package.json`;
1084
- console.log(` ${chalk14.yellow(packageLocation)}
1187
+ console.log(` ${chalk15.yellow(packageLocation)}
1085
1188
  `);
1086
1189
  }
1087
1190
  return unusedDevDependencies;
1088
1191
  }
1089
1192
 
1090
1193
  // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
1091
- import chalk15 from "chalk";
1194
+ import chalk16 from "chalk";
1092
1195
  function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
1093
1196
  let unusedDependencies = 0;
1094
1197
  for (const dep of peerDependencies) {
1095
1198
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
1096
1199
  unusedDependencies++;
1097
1200
  if (dependencies.includes(dep)) {
1098
- console.log(`[${chalk15.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk15.red(dep)}`);
1201
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency [already a dependency] in package.json: ${chalk16.red(dep)}`);
1099
1202
  } else {
1100
- console.log(`[${chalk15.blue(name)}] Unused peerDependency in package.json: ${chalk15.red(dep)}`);
1203
+ console.log(`[${chalk16.blue(name)}] Unused peerDependency in package.json: ${chalk16.red(dep)}`);
1101
1204
  }
1102
1205
  }
1103
1206
  }
1104
1207
  if (unusedDependencies > 0) {
1105
1208
  const packageLocation = `${location}/package.json`;
1106
- console.log(` ${chalk15.yellow(packageLocation)}
1209
+ console.log(` ${chalk16.yellow(packageLocation)}
1107
1210
  `);
1108
1211
  }
1109
1212
  return unusedDependencies;
@@ -1189,19 +1292,19 @@ var deplint = ({
1189
1292
  });
1190
1293
  }
1191
1294
  if (totalErrors > 0) {
1192
- console.warn(`Deplint: Found ${chalk16.red(totalErrors)} dependency problems. ${chalk16.red("\u2716")}`);
1295
+ console.warn(`Deplint: Found ${chalk17.red(totalErrors)} dependency problems. ${chalk17.red("\u2716")}`);
1193
1296
  } else {
1194
- console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
1297
+ console.info(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
1195
1298
  }
1196
1299
  return 0;
1197
1300
  };
1198
1301
 
1199
1302
  // src/actions/deploy.ts
1200
- import { readFileSync as readFileSync3 } from "fs";
1303
+ import { readFileSync as readFileSync5 } from "fs";
1201
1304
  var privatePackageExcludeList = () => {
1202
1305
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1203
1306
  workspace,
1204
- JSON.parse(readFileSync3(`${workspace.location}/package.json`, { encoding: "utf8" }))
1307
+ JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
1205
1308
  ]);
1206
1309
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1207
1310
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1221,11 +1324,11 @@ var deploy = () => {
1221
1324
  };
1222
1325
 
1223
1326
  // src/actions/deploy-major.ts
1224
- import { readFileSync as readFileSync4 } from "fs";
1327
+ import { readFileSync as readFileSync6 } from "fs";
1225
1328
  var privatePackageExcludeList2 = () => {
1226
1329
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1227
1330
  workspace,
1228
- JSON.parse(readFileSync4(`${workspace.location}/package.json`, { encoding: "utf8" }))
1331
+ JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
1229
1332
  ]);
1230
1333
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1231
1334
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1245,11 +1348,11 @@ var deployMajor = () => {
1245
1348
  };
1246
1349
 
1247
1350
  // src/actions/deploy-minor.ts
1248
- import { readFileSync as readFileSync5 } from "fs";
1351
+ import { readFileSync as readFileSync7 } from "fs";
1249
1352
  var privatePackageExcludeList3 = () => {
1250
1353
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1251
1354
  workspace,
1252
- JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
1355
+ JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
1253
1356
  ]);
1254
1357
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1255
1358
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1269,11 +1372,11 @@ var deployMinor = () => {
1269
1372
  };
1270
1373
 
1271
1374
  // src/actions/deploy-next.ts
1272
- import { readFileSync as readFileSync6 } from "fs";
1375
+ import { readFileSync as readFileSync8 } from "fs";
1273
1376
  var privatePackageExcludeList4 = () => {
1274
1377
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1275
1378
  workspace,
1276
- JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
1379
+ JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
1277
1380
  ]);
1278
1381
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1279
1382
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1293,22 +1396,22 @@ var deployNext = () => {
1293
1396
  };
1294
1397
 
1295
1398
  // src/actions/dupdeps.ts
1296
- import chalk17 from "chalk";
1399
+ import chalk18 from "chalk";
1297
1400
  var dupdeps = () => {
1298
- console.log(chalk17.green("Checking all Dependencies for Duplicates"));
1401
+ console.log(chalk18.green("Checking all Dependencies for Duplicates"));
1299
1402
  const allDependencies = parsedPackageJSON()?.dependencies;
1300
1403
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
1301
1404
  return detectDuplicateDependencies(dependencies);
1302
1405
  };
1303
1406
 
1304
1407
  // src/actions/lint.ts
1305
- import chalk18 from "chalk";
1408
+ import chalk19 from "chalk";
1306
1409
  var lintPackage = ({
1307
1410
  pkg,
1308
1411
  fix: fix2,
1309
1412
  verbose
1310
1413
  }) => {
1311
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1414
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1312
1415
  const start = Date.now();
1313
1416
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1314
1417
  ["yarn", [
@@ -1318,7 +1421,7 @@ var lintPackage = ({
1318
1421
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1319
1422
  ]]
1320
1423
  ]);
1321
- console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
1424
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1322
1425
  return result;
1323
1426
  };
1324
1427
  var lint = ({
@@ -1338,13 +1441,13 @@ var lint = ({
1338
1441
  });
1339
1442
  };
1340
1443
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1341
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1444
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1342
1445
  const start = Date.now();
1343
1446
  const fixOptions = fix2 ? ["--fix"] : [];
1344
1447
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1345
1448
  ["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
1346
1449
  ]);
1347
- console.log(chalk18.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk18.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk18.gray("seconds")}`));
1450
+ console.log(chalk19.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk19.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk19.gray("seconds")}`));
1348
1451
  return result;
1349
1452
  };
1350
1453
 
@@ -1372,7 +1475,7 @@ var filename = ".gitignore";
1372
1475
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1373
1476
 
1374
1477
  // src/actions/gitlint.ts
1375
- import chalk19 from "chalk";
1478
+ import chalk20 from "chalk";
1376
1479
  import ParseGitConfig from "parse-git-config";
1377
1480
  var gitlint = () => {
1378
1481
  console.log(`
@@ -1383,7 +1486,7 @@ Gitlint Start [${process.cwd()}]
1383
1486
  const errors = 0;
1384
1487
  const gitConfig = ParseGitConfig.sync();
1385
1488
  const warn = (message) => {
1386
- console.warn(chalk19.yellow(`Warning: ${message}`));
1489
+ console.warn(chalk20.yellow(`Warning: ${message}`));
1387
1490
  warnings++;
1388
1491
  };
1389
1492
  if (gitConfig.core.ignorecase) {
@@ -1403,13 +1506,13 @@ Gitlint Start [${process.cwd()}]
1403
1506
  }
1404
1507
  const resultMessages = [];
1405
1508
  if (valid > 0) {
1406
- resultMessages.push(chalk19.green(`Passed: ${valid}`));
1509
+ resultMessages.push(chalk20.green(`Passed: ${valid}`));
1407
1510
  }
1408
1511
  if (warnings > 0) {
1409
- resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
1512
+ resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
1410
1513
  }
1411
1514
  if (errors > 0) {
1412
- resultMessages.push(chalk19.red(` Errors: ${errors}`));
1515
+ resultMessages.push(chalk20.red(` Errors: ${errors}`));
1413
1516
  }
1414
1517
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1415
1518
  `);
@@ -1418,7 +1521,7 @@ Gitlint Start [${process.cwd()}]
1418
1521
 
1419
1522
  // src/actions/gitlint-fix.ts
1420
1523
  import { execSync as execSync2 } from "child_process";
1421
- import chalk20 from "chalk";
1524
+ import chalk21 from "chalk";
1422
1525
  import ParseGitConfig2 from "parse-git-config";
1423
1526
  var gitlintFix = () => {
1424
1527
  console.log(`
@@ -1427,15 +1530,15 @@ Gitlint Fix Start [${process.cwd()}]
1427
1530
  const gitConfig = ParseGitConfig2.sync();
1428
1531
  if (gitConfig.core.ignorecase) {
1429
1532
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
1430
- console.warn(chalk20.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1533
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
1431
1534
  }
1432
1535
  if (gitConfig.core.autocrlf !== false) {
1433
1536
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
1434
- console.warn(chalk20.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1537
+ console.warn(chalk21.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
1435
1538
  }
1436
1539
  if (gitConfig.core.eol !== "lf") {
1437
1540
  execSync2("git config core.eol lf", { stdio: "inherit" });
1438
- console.warn(chalk20.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1541
+ console.warn(chalk21.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
1439
1542
  }
1440
1543
  return 1;
1441
1544
  };
@@ -1446,7 +1549,7 @@ var knip = () => {
1446
1549
  };
1447
1550
 
1448
1551
  // src/actions/license.ts
1449
- import chalk21 from "chalk";
1552
+ import chalk22 from "chalk";
1450
1553
  import { init } from "license-checker";
1451
1554
  var license = async (pkg) => {
1452
1555
  const workspaces = yarnWorkspaces();
@@ -1471,18 +1574,18 @@ var license = async (pkg) => {
1471
1574
  "LGPL-3.0-or-later",
1472
1575
  "Python-2.0"
1473
1576
  ]);
1474
- console.log(chalk21.green("License Checker"));
1577
+ console.log(chalk22.green("License Checker"));
1475
1578
  return (await Promise.all(
1476
1579
  workspaceList.map(({ location, name }) => {
1477
1580
  return new Promise((resolve) => {
1478
1581
  init({ production: true, start: location }, (error, packages) => {
1479
1582
  if (error) {
1480
- console.error(chalk21.red(`License Checker [${name}] Error`));
1481
- console.error(chalk21.gray(error));
1583
+ console.error(chalk22.red(`License Checker [${name}] Error`));
1584
+ console.error(chalk22.gray(error));
1482
1585
  console.log("\n");
1483
1586
  resolve(1);
1484
1587
  } else {
1485
- console.log(chalk21.green(`License Checker [${name}]`));
1588
+ console.log(chalk22.green(`License Checker [${name}]`));
1486
1589
  let count = 0;
1487
1590
  for (const [name2, info] of Object.entries(packages)) {
1488
1591
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1498,7 +1601,7 @@ var license = async (pkg) => {
1498
1601
  }
1499
1602
  if (!orLicenseFound) {
1500
1603
  count++;
1501
- console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
1604
+ console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
1502
1605
  }
1503
1606
  }
1504
1607
  }
@@ -1542,7 +1645,7 @@ var rebuild = ({ target }) => {
1542
1645
  };
1543
1646
 
1544
1647
  // src/actions/recompile.ts
1545
- import chalk22 from "chalk";
1648
+ import chalk23 from "chalk";
1546
1649
  var recompile = async ({
1547
1650
  verbose,
1548
1651
  target,
@@ -1578,7 +1681,7 @@ var recompileAll = async ({
1578
1681
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
1579
1682
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
1580
1683
  if (jobs) {
1581
- console.log(chalk22.blue(`Jobs set to [${jobs}]`));
1684
+ console.log(chalk23.blue(`Jobs set to [${jobs}]`));
1582
1685
  }
1583
1686
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
1584
1687
  [
@@ -1609,7 +1712,7 @@ var recompileAll = async ({
1609
1712
  ]
1610
1713
  ]);
1611
1714
  console.log(
1612
- `${chalk22.gray("Recompiled in")} [${chalk22.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk22.gray("seconds")}`
1715
+ `${chalk23.gray("Recompiled in")} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`
1613
1716
  );
1614
1717
  return result;
1615
1718
  };
@@ -1640,13 +1743,13 @@ var reinstall = () => {
1640
1743
  };
1641
1744
 
1642
1745
  // src/actions/relint.ts
1643
- import chalk23 from "chalk";
1746
+ import chalk24 from "chalk";
1644
1747
  var relintPackage = ({
1645
1748
  pkg,
1646
1749
  fix: fix2,
1647
1750
  verbose
1648
1751
  }) => {
1649
- console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1752
+ console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1650
1753
  const start = Date.now();
1651
1754
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1652
1755
  ["yarn", [
@@ -1656,7 +1759,7 @@ var relintPackage = ({
1656
1759
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1657
1760
  ]]
1658
1761
  ]);
1659
- console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
1762
+ console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
1660
1763
  return result;
1661
1764
  };
1662
1765
  var relint = ({
@@ -1676,13 +1779,13 @@ var relint = ({
1676
1779
  });
1677
1780
  };
1678
1781
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
1679
- console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1782
+ console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1680
1783
  const start = Date.now();
1681
1784
  const fixOptions = fix2 ? ["--fix"] : [];
1682
1785
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1683
1786
  ["yarn", ["eslint", ...fixOptions]]
1684
1787
  ]);
1685
- console.log(chalk23.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk23.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk23.gray("seconds")}`));
1788
+ console.log(chalk24.gray(`${fix2 ? "Fixed in" : "Linted in"} [${chalk24.magenta(((Date.now() - start) / 1e3).toFixed(2))}] ${chalk24.gray("seconds")}`));
1686
1789
  return result;
1687
1790
  };
1688
1791
 
@@ -1700,10 +1803,10 @@ var sonar = () => {
1700
1803
  };
1701
1804
 
1702
1805
  // src/actions/statics.ts
1703
- import chalk24 from "chalk";
1806
+ import chalk25 from "chalk";
1704
1807
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
1705
1808
  var statics = () => {
1706
- console.log(chalk24.green("Check Required Static Dependencies"));
1809
+ console.log(chalk25.green("Check Required Static Dependencies"));
1707
1810
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1708
1811
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1709
1812
  };
@@ -1857,6 +1960,21 @@ var packagePositionalParam = (yargs2) => {
1857
1960
  // src/xy/xyCommonCommands.ts
1858
1961
  var xyCommonCommands = (args) => {
1859
1962
  return args.command(
1963
+ "claude-rules",
1964
+ "Claude Rules - Sync XY Labs standard Claude rules to .claude/rules/",
1965
+ (yargs2) => {
1966
+ return yargs2.option("force", {
1967
+ alias: "f",
1968
+ default: false,
1969
+ description: "Overwrite existing CLAUDE.md",
1970
+ type: "boolean"
1971
+ });
1972
+ },
1973
+ (argv) => {
1974
+ if (argv.verbose) console.log("Claude Rules");
1975
+ process.exitCode = claudeRules({ force: argv.force });
1976
+ }
1977
+ ).command(
1860
1978
  "license [package]",
1861
1979
  "License - Check licenses of dependencies",
1862
1980
  (yargs2) => {
@@ -2103,7 +2221,7 @@ var xyInstallCommands = (args) => {
2103
2221
  };
2104
2222
 
2105
2223
  // src/xy/xyLintCommands.ts
2106
- import chalk25 from "chalk";
2224
+ import chalk26 from "chalk";
2107
2225
  var xyLintCommands = (args) => {
2108
2226
  return args.command(
2109
2227
  "cycle [package]",
@@ -2115,7 +2233,7 @@ var xyLintCommands = (args) => {
2115
2233
  const start = Date.now();
2116
2234
  if (argv.verbose) console.log("Cycle");
2117
2235
  process.exitCode = await cycle({ pkg: argv.package });
2118
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2236
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2119
2237
  }
2120
2238
  ).command(
2121
2239
  "lint [package]",
@@ -2145,7 +2263,7 @@ var xyLintCommands = (args) => {
2145
2263
  cache: argv.cache,
2146
2264
  verbose: !!argv.verbose
2147
2265
  });
2148
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2266
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2149
2267
  }
2150
2268
  ).command(
2151
2269
  "deplint [package]",
@@ -2178,7 +2296,7 @@ var xyLintCommands = (args) => {
2178
2296
  peerDeps: !!argv.peerDeps,
2179
2297
  verbose: !!argv.verbose
2180
2298
  });
2181
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2299
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2182
2300
  }
2183
2301
  ).command(
2184
2302
  "fix [package]",
@@ -2190,7 +2308,7 @@ var xyLintCommands = (args) => {
2190
2308
  const start = Date.now();
2191
2309
  if (argv.verbose) console.log("Fix");
2192
2310
  process.exitCode = fix();
2193
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2311
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2194
2312
  }
2195
2313
  ).command(
2196
2314
  "relint [package]",
@@ -2202,7 +2320,7 @@ var xyLintCommands = (args) => {
2202
2320
  if (argv.verbose) console.log("Relinting");
2203
2321
  const start = Date.now();
2204
2322
  process.exitCode = relint();
2205
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2323
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2206
2324
  }
2207
2325
  ).command(
2208
2326
  "publint [package]",
@@ -2214,7 +2332,7 @@ var xyLintCommands = (args) => {
2214
2332
  if (argv.verbose) console.log("Publint");
2215
2333
  const start = Date.now();
2216
2334
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
2217
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2335
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2218
2336
  }
2219
2337
  ).command(
2220
2338
  "knip",
@@ -2226,7 +2344,7 @@ var xyLintCommands = (args) => {
2226
2344
  if (argv.verbose) console.log("Knip");
2227
2345
  const start = Date.now();
2228
2346
  process.exitCode = knip();
2229
- console.log(chalk25.blue(`Knip finished in ${Date.now() - start}ms`));
2347
+ console.log(chalk26.blue(`Knip finished in ${Date.now() - start}ms`));
2230
2348
  }
2231
2349
  ).command(
2232
2350
  "sonar",
@@ -2238,7 +2356,7 @@ var xyLintCommands = (args) => {
2238
2356
  const start = Date.now();
2239
2357
  if (argv.verbose) console.log("Sonar Check");
2240
2358
  process.exitCode = sonar();
2241
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2359
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2242
2360
  }
2243
2361
  );
2244
2362
  };
@@ -2274,8 +2392,8 @@ var xyParseOptions = () => {
2274
2392
  var xy = async () => {
2275
2393
  const options = xyParseOptions();
2276
2394
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2277
- console.error(chalk26.yellow(`Command not found [${chalk26.magenta(process.argv[2])}]`));
2278
- console.log(chalk26.gray("Try 'yarn xy --help' for list of commands"));
2395
+ console.error(chalk27.yellow(`Command not found [${chalk27.magenta(process.argv[2])}]`));
2396
+ console.log(chalk27.gray("Try 'yarn xy --help' for list of commands"));
2279
2397
  }).version().help().argv;
2280
2398
  };
2281
2399
  export {