@xylabs/ts-scripts-yarn3 7.4.4 → 7.4.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/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";
@@ -801,12 +903,12 @@ function getExternalImportsFromFiles({
801
903
 
802
904
  // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
803
905
  import { builtinModules } from "module";
804
- import chalk11 from "chalk";
906
+ import chalk12 from "chalk";
805
907
  function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
806
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}`);
807
909
  }
808
910
  function logMissing(name, imp, importPaths) {
809
- 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)}`);
810
912
  if (importPaths[imp]) {
811
913
  console.log(` ${importPaths[imp].join("\n ")}`);
812
914
  }
@@ -831,7 +933,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
831
933
  }
832
934
  if (unlistedDependencies > 0) {
833
935
  const packageLocation = `${location}/package.json`;
834
- console.log(` ${chalk11.yellow(packageLocation)}
936
+ console.log(` ${chalk12.yellow(packageLocation)}
835
937
  `);
836
938
  }
837
939
  return unlistedDependencies;
@@ -839,7 +941,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
839
941
 
840
942
  // src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
841
943
  import { builtinModules as builtinModules2 } from "module";
842
- import chalk12 from "chalk";
944
+ import chalk13 from "chalk";
843
945
  function getUnlistedDevDependencies({ name, location }, {
844
946
  devDependencies,
845
947
  dependencies,
@@ -853,7 +955,7 @@ function getUnlistedDevDependencies({ name, location }, {
853
955
  for (const imp of externalAllImports) {
854
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)) {
855
957
  unlistedDevDependencies++;
856
- 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)}`);
857
959
  if (allImportPaths[imp]) {
858
960
  console.log(` ${allImportPaths[imp].join("\n ")}`);
859
961
  }
@@ -861,14 +963,14 @@ function getUnlistedDevDependencies({ name, location }, {
861
963
  }
862
964
  if (unlistedDevDependencies > 0) {
863
965
  const packageLocation = `${location}/package.json`;
864
- console.log(` ${chalk12.yellow(packageLocation)}
966
+ console.log(` ${chalk13.yellow(packageLocation)}
865
967
  `);
866
968
  }
867
969
  return unlistedDevDependencies;
868
970
  }
869
971
 
870
972
  // src/actions/deplint/checkPackage/getUnusedDependencies.ts
871
- import chalk13 from "chalk";
973
+ import chalk14 from "chalk";
872
974
  function getUnusedDependencies({ name, location }, { dependencies }, {
873
975
  externalDistImports,
874
976
  externalDistTypeImports,
@@ -879,22 +981,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
879
981
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
880
982
  unusedDependencies++;
881
983
  if (externalAllImports.includes(dep)) {
882
- 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)}`);
883
985
  } else {
884
- 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)}`);
885
987
  }
886
988
  }
887
989
  }
888
990
  if (unusedDependencies > 0) {
889
991
  const packageLocation = `${location}/package.json`;
890
- console.log(` ${chalk13.yellow(packageLocation)}
992
+ console.log(` ${chalk14.yellow(packageLocation)}
891
993
  `);
892
994
  }
893
995
  return unusedDependencies;
894
996
  }
895
997
 
896
998
  // src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
897
- import chalk14 from "chalk";
999
+ import chalk15 from "chalk";
898
1000
 
899
1001
  // src/actions/deplint/getRequiredPeerDependencies.ts
900
1002
  import fs6 from "fs";
@@ -1077,34 +1179,34 @@ function getUnusedDevDependencies({ name, location }, {
1077
1179
  if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
1078
1180
  if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
1079
1181
  unusedDevDependencies++;
1080
- 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)}`);
1081
1183
  }
1082
1184
  }
1083
1185
  if (unusedDevDependencies > 0) {
1084
1186
  const packageLocation = `${location}/package.json`;
1085
- console.log(` ${chalk14.yellow(packageLocation)}
1187
+ console.log(` ${chalk15.yellow(packageLocation)}
1086
1188
  `);
1087
1189
  }
1088
1190
  return unusedDevDependencies;
1089
1191
  }
1090
1192
 
1091
1193
  // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
1092
- import chalk15 from "chalk";
1194
+ import chalk16 from "chalk";
1093
1195
  function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
1094
1196
  let unusedDependencies = 0;
1095
1197
  for (const dep of peerDependencies) {
1096
1198
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
1097
1199
  unusedDependencies++;
1098
1200
  if (dependencies.includes(dep)) {
1099
- 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)}`);
1100
1202
  } else {
1101
- 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)}`);
1102
1204
  }
1103
1205
  }
1104
1206
  }
1105
1207
  if (unusedDependencies > 0) {
1106
1208
  const packageLocation = `${location}/package.json`;
1107
- console.log(` ${chalk15.yellow(packageLocation)}
1209
+ console.log(` ${chalk16.yellow(packageLocation)}
1108
1210
  `);
1109
1211
  }
1110
1212
  return unusedDependencies;
@@ -1190,19 +1292,19 @@ var deplint = ({
1190
1292
  });
1191
1293
  }
1192
1294
  if (totalErrors > 0) {
1193
- 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")}`);
1194
1296
  } else {
1195
- console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
1297
+ console.info(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
1196
1298
  }
1197
1299
  return 0;
1198
1300
  };
1199
1301
 
1200
1302
  // src/actions/deploy.ts
1201
- import { readFileSync as readFileSync3 } from "fs";
1303
+ import { readFileSync as readFileSync5 } from "fs";
1202
1304
  var privatePackageExcludeList = () => {
1203
1305
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1204
1306
  workspace,
1205
- JSON.parse(readFileSync3(`${workspace.location}/package.json`, { encoding: "utf8" }))
1307
+ JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
1206
1308
  ]);
1207
1309
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1208
1310
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1222,11 +1324,11 @@ var deploy = () => {
1222
1324
  };
1223
1325
 
1224
1326
  // src/actions/deploy-major.ts
1225
- import { readFileSync as readFileSync4 } from "fs";
1327
+ import { readFileSync as readFileSync6 } from "fs";
1226
1328
  var privatePackageExcludeList2 = () => {
1227
1329
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1228
1330
  workspace,
1229
- JSON.parse(readFileSync4(`${workspace.location}/package.json`, { encoding: "utf8" }))
1331
+ JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
1230
1332
  ]);
1231
1333
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1232
1334
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1246,11 +1348,11 @@ var deployMajor = () => {
1246
1348
  };
1247
1349
 
1248
1350
  // src/actions/deploy-minor.ts
1249
- import { readFileSync as readFileSync5 } from "fs";
1351
+ import { readFileSync as readFileSync7 } from "fs";
1250
1352
  var privatePackageExcludeList3 = () => {
1251
1353
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1252
1354
  workspace,
1253
- JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
1355
+ JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
1254
1356
  ]);
1255
1357
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1256
1358
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1270,11 +1372,11 @@ var deployMinor = () => {
1270
1372
  };
1271
1373
 
1272
1374
  // src/actions/deploy-next.ts
1273
- import { readFileSync as readFileSync6 } from "fs";
1375
+ import { readFileSync as readFileSync8 } from "fs";
1274
1376
  var privatePackageExcludeList4 = () => {
1275
1377
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1276
1378
  workspace,
1277
- JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
1379
+ JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
1278
1380
  ]);
1279
1381
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1280
1382
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1294,22 +1396,22 @@ var deployNext = () => {
1294
1396
  };
1295
1397
 
1296
1398
  // src/actions/dupdeps.ts
1297
- import chalk17 from "chalk";
1399
+ import chalk18 from "chalk";
1298
1400
  var dupdeps = () => {
1299
- console.log(chalk17.green("Checking all Dependencies for Duplicates"));
1401
+ console.log(chalk18.green("Checking all Dependencies for Duplicates"));
1300
1402
  const allDependencies = parsedPackageJSON()?.dependencies;
1301
1403
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
1302
1404
  return detectDuplicateDependencies(dependencies);
1303
1405
  };
1304
1406
 
1305
1407
  // src/actions/lint.ts
1306
- import chalk18 from "chalk";
1408
+ import chalk19 from "chalk";
1307
1409
  var lintPackage = ({
1308
1410
  pkg,
1309
1411
  fix: fix2,
1310
1412
  verbose
1311
1413
  }) => {
1312
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1414
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1313
1415
  const start = Date.now();
1314
1416
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1315
1417
  ["yarn", [
@@ -1319,7 +1421,7 @@ var lintPackage = ({
1319
1421
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1320
1422
  ]]
1321
1423
  ]);
1322
- 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")}`));
1323
1425
  return result;
1324
1426
  };
1325
1427
  var lint = ({
@@ -1339,13 +1441,13 @@ var lint = ({
1339
1441
  });
1340
1442
  };
1341
1443
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1342
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1444
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1343
1445
  const start = Date.now();
1344
1446
  const fixOptions = fix2 ? ["--fix"] : [];
1345
1447
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1346
1448
  ["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
1347
1449
  ]);
1348
- 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")}`));
1349
1451
  return result;
1350
1452
  };
1351
1453
 
@@ -1373,7 +1475,7 @@ var filename = ".gitignore";
1373
1475
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1374
1476
 
1375
1477
  // src/actions/gitlint.ts
1376
- import chalk19 from "chalk";
1478
+ import chalk20 from "chalk";
1377
1479
  import ParseGitConfig from "parse-git-config";
1378
1480
  var gitlint = () => {
1379
1481
  console.log(`
@@ -1384,7 +1486,7 @@ Gitlint Start [${process.cwd()}]
1384
1486
  const errors = 0;
1385
1487
  const gitConfig = ParseGitConfig.sync();
1386
1488
  const warn = (message) => {
1387
- console.warn(chalk19.yellow(`Warning: ${message}`));
1489
+ console.warn(chalk20.yellow(`Warning: ${message}`));
1388
1490
  warnings++;
1389
1491
  };
1390
1492
  if (gitConfig.core.ignorecase) {
@@ -1404,13 +1506,13 @@ Gitlint Start [${process.cwd()}]
1404
1506
  }
1405
1507
  const resultMessages = [];
1406
1508
  if (valid > 0) {
1407
- resultMessages.push(chalk19.green(`Passed: ${valid}`));
1509
+ resultMessages.push(chalk20.green(`Passed: ${valid}`));
1408
1510
  }
1409
1511
  if (warnings > 0) {
1410
- resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
1512
+ resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
1411
1513
  }
1412
1514
  if (errors > 0) {
1413
- resultMessages.push(chalk19.red(` Errors: ${errors}`));
1515
+ resultMessages.push(chalk20.red(` Errors: ${errors}`));
1414
1516
  }
1415
1517
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1416
1518
  `);
@@ -1419,7 +1521,7 @@ Gitlint Start [${process.cwd()}]
1419
1521
 
1420
1522
  // src/actions/gitlint-fix.ts
1421
1523
  import { execSync as execSync2 } from "child_process";
1422
- import chalk20 from "chalk";
1524
+ import chalk21 from "chalk";
1423
1525
  import ParseGitConfig2 from "parse-git-config";
1424
1526
  var gitlintFix = () => {
1425
1527
  console.log(`
@@ -1428,15 +1530,15 @@ Gitlint Fix Start [${process.cwd()}]
1428
1530
  const gitConfig = ParseGitConfig2.sync();
1429
1531
  if (gitConfig.core.ignorecase) {
1430
1532
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
1431
- 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"));
1432
1534
  }
1433
1535
  if (gitConfig.core.autocrlf !== false) {
1434
1536
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
1435
- 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"));
1436
1538
  }
1437
1539
  if (gitConfig.core.eol !== "lf") {
1438
1540
  execSync2("git config core.eol lf", { stdio: "inherit" });
1439
- 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'));
1440
1542
  }
1441
1543
  return 1;
1442
1544
  };
@@ -1447,7 +1549,7 @@ var knip = () => {
1447
1549
  };
1448
1550
 
1449
1551
  // src/actions/license.ts
1450
- import chalk21 from "chalk";
1552
+ import chalk22 from "chalk";
1451
1553
  import { init } from "license-checker";
1452
1554
  var license = async (pkg) => {
1453
1555
  const workspaces = yarnWorkspaces();
@@ -1472,18 +1574,18 @@ var license = async (pkg) => {
1472
1574
  "LGPL-3.0-or-later",
1473
1575
  "Python-2.0"
1474
1576
  ]);
1475
- console.log(chalk21.green("License Checker"));
1577
+ console.log(chalk22.green("License Checker"));
1476
1578
  return (await Promise.all(
1477
1579
  workspaceList.map(({ location, name }) => {
1478
1580
  return new Promise((resolve) => {
1479
1581
  init({ production: true, start: location }, (error, packages) => {
1480
1582
  if (error) {
1481
- console.error(chalk21.red(`License Checker [${name}] Error`));
1482
- console.error(chalk21.gray(error));
1583
+ console.error(chalk22.red(`License Checker [${name}] Error`));
1584
+ console.error(chalk22.gray(error));
1483
1585
  console.log("\n");
1484
1586
  resolve(1);
1485
1587
  } else {
1486
- console.log(chalk21.green(`License Checker [${name}]`));
1588
+ console.log(chalk22.green(`License Checker [${name}]`));
1487
1589
  let count = 0;
1488
1590
  for (const [name2, info] of Object.entries(packages)) {
1489
1591
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1499,7 +1601,7 @@ var license = async (pkg) => {
1499
1601
  }
1500
1602
  if (!orLicenseFound) {
1501
1603
  count++;
1502
- console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
1604
+ console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
1503
1605
  }
1504
1606
  }
1505
1607
  }
@@ -1543,7 +1645,7 @@ var rebuild = ({ target }) => {
1543
1645
  };
1544
1646
 
1545
1647
  // src/actions/recompile.ts
1546
- import chalk22 from "chalk";
1648
+ import chalk23 from "chalk";
1547
1649
  var recompile = async ({
1548
1650
  verbose,
1549
1651
  target,
@@ -1579,7 +1681,7 @@ var recompileAll = async ({
1579
1681
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
1580
1682
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
1581
1683
  if (jobs) {
1582
- console.log(chalk22.blue(`Jobs set to [${jobs}]`));
1684
+ console.log(chalk23.blue(`Jobs set to [${jobs}]`));
1583
1685
  }
1584
1686
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
1585
1687
  [
@@ -1610,7 +1712,7 @@ var recompileAll = async ({
1610
1712
  ]
1611
1713
  ]);
1612
1714
  console.log(
1613
- `${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")}`
1614
1716
  );
1615
1717
  return result;
1616
1718
  };
@@ -1641,13 +1743,13 @@ var reinstall = () => {
1641
1743
  };
1642
1744
 
1643
1745
  // src/actions/relint.ts
1644
- import chalk23 from "chalk";
1746
+ import chalk24 from "chalk";
1645
1747
  var relintPackage = ({
1646
1748
  pkg,
1647
1749
  fix: fix2,
1648
1750
  verbose
1649
1751
  }) => {
1650
- console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1752
+ console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1651
1753
  const start = Date.now();
1652
1754
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1653
1755
  ["yarn", [
@@ -1657,7 +1759,7 @@ var relintPackage = ({
1657
1759
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1658
1760
  ]]
1659
1761
  ]);
1660
- 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")}`));
1661
1763
  return result;
1662
1764
  };
1663
1765
  var relint = ({
@@ -1677,13 +1779,13 @@ var relint = ({
1677
1779
  });
1678
1780
  };
1679
1781
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
1680
- console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1782
+ console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1681
1783
  const start = Date.now();
1682
1784
  const fixOptions = fix2 ? ["--fix"] : [];
1683
1785
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1684
1786
  ["yarn", ["eslint", ...fixOptions]]
1685
1787
  ]);
1686
- 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")}`));
1687
1789
  return result;
1688
1790
  };
1689
1791
 
@@ -1701,10 +1803,10 @@ var sonar = () => {
1701
1803
  };
1702
1804
 
1703
1805
  // src/actions/statics.ts
1704
- import chalk24 from "chalk";
1806
+ import chalk25 from "chalk";
1705
1807
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
1706
1808
  var statics = () => {
1707
- console.log(chalk24.green("Check Required Static Dependencies"));
1809
+ console.log(chalk25.green("Check Required Static Dependencies"));
1708
1810
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1709
1811
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1710
1812
  };
@@ -1858,6 +1960,21 @@ var packagePositionalParam = (yargs2) => {
1858
1960
  // src/xy/xyCommonCommands.ts
1859
1961
  var xyCommonCommands = (args) => {
1860
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(
1861
1978
  "license [package]",
1862
1979
  "License - Check licenses of dependencies",
1863
1980
  (yargs2) => {
@@ -2104,7 +2221,7 @@ var xyInstallCommands = (args) => {
2104
2221
  };
2105
2222
 
2106
2223
  // src/xy/xyLintCommands.ts
2107
- import chalk25 from "chalk";
2224
+ import chalk26 from "chalk";
2108
2225
  var xyLintCommands = (args) => {
2109
2226
  return args.command(
2110
2227
  "cycle [package]",
@@ -2116,7 +2233,7 @@ var xyLintCommands = (args) => {
2116
2233
  const start = Date.now();
2117
2234
  if (argv.verbose) console.log("Cycle");
2118
2235
  process.exitCode = await cycle({ pkg: argv.package });
2119
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2236
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2120
2237
  }
2121
2238
  ).command(
2122
2239
  "lint [package]",
@@ -2146,7 +2263,7 @@ var xyLintCommands = (args) => {
2146
2263
  cache: argv.cache,
2147
2264
  verbose: !!argv.verbose
2148
2265
  });
2149
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2266
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2150
2267
  }
2151
2268
  ).command(
2152
2269
  "deplint [package]",
@@ -2179,7 +2296,7 @@ var xyLintCommands = (args) => {
2179
2296
  peerDeps: !!argv.peerDeps,
2180
2297
  verbose: !!argv.verbose
2181
2298
  });
2182
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2299
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2183
2300
  }
2184
2301
  ).command(
2185
2302
  "fix [package]",
@@ -2191,7 +2308,7 @@ var xyLintCommands = (args) => {
2191
2308
  const start = Date.now();
2192
2309
  if (argv.verbose) console.log("Fix");
2193
2310
  process.exitCode = fix();
2194
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2311
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2195
2312
  }
2196
2313
  ).command(
2197
2314
  "relint [package]",
@@ -2203,7 +2320,7 @@ var xyLintCommands = (args) => {
2203
2320
  if (argv.verbose) console.log("Relinting");
2204
2321
  const start = Date.now();
2205
2322
  process.exitCode = relint();
2206
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2323
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2207
2324
  }
2208
2325
  ).command(
2209
2326
  "publint [package]",
@@ -2215,7 +2332,7 @@ var xyLintCommands = (args) => {
2215
2332
  if (argv.verbose) console.log("Publint");
2216
2333
  const start = Date.now();
2217
2334
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
2218
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2335
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2219
2336
  }
2220
2337
  ).command(
2221
2338
  "knip",
@@ -2227,7 +2344,7 @@ var xyLintCommands = (args) => {
2227
2344
  if (argv.verbose) console.log("Knip");
2228
2345
  const start = Date.now();
2229
2346
  process.exitCode = knip();
2230
- console.log(chalk25.blue(`Knip finished in ${Date.now() - start}ms`));
2347
+ console.log(chalk26.blue(`Knip finished in ${Date.now() - start}ms`));
2231
2348
  }
2232
2349
  ).command(
2233
2350
  "sonar",
@@ -2239,7 +2356,7 @@ var xyLintCommands = (args) => {
2239
2356
  const start = Date.now();
2240
2357
  if (argv.verbose) console.log("Sonar Check");
2241
2358
  process.exitCode = sonar();
2242
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2359
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2243
2360
  }
2244
2361
  );
2245
2362
  };
@@ -2275,8 +2392,8 @@ var xyParseOptions = () => {
2275
2392
  var xy = async () => {
2276
2393
  const options = xyParseOptions();
2277
2394
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2278
- console.error(chalk26.yellow(`Command not found [${chalk26.magenta(process.argv[2])}]`));
2279
- 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"));
2280
2397
  }).version().help().argv;
2281
2398
  };
2282
2399
  export {