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