@xylabs/ts-scripts-yarn3 7.4.4 → 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.
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";
@@ -803,12 +905,12 @@ function getExternalImportsFromFiles({
803
905
 
804
906
  // src/actions/deplint/checkPackage/getUnlistedDependencies.ts
805
907
  import { builtinModules } from "module";
806
- import chalk11 from "chalk";
908
+ import chalk12 from "chalk";
807
909
  function isListedOrBuiltin(imp, name, dependencies, peerDependencies) {
808
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}`);
809
911
  }
810
912
  function logMissing(name, imp, importPaths) {
811
- 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)}`);
812
914
  if (importPaths[imp]) {
813
915
  console.log(` ${importPaths[imp].join("\n ")}`);
814
916
  }
@@ -833,7 +935,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
833
935
  }
834
936
  if (unlistedDependencies > 0) {
835
937
  const packageLocation = `${location}/package.json`;
836
- console.log(` ${chalk11.yellow(packageLocation)}
938
+ console.log(` ${chalk12.yellow(packageLocation)}
837
939
  `);
838
940
  }
839
941
  return unlistedDependencies;
@@ -841,7 +943,7 @@ function getUnlistedDependencies({ name, location }, { dependencies, peerDepende
841
943
 
842
944
  // src/actions/deplint/checkPackage/getUnlistedDevDependencies.ts
843
945
  import { builtinModules as builtinModules2 } from "module";
844
- import chalk12 from "chalk";
946
+ import chalk13 from "chalk";
845
947
  function getUnlistedDevDependencies({ name, location }, {
846
948
  devDependencies,
847
949
  dependencies,
@@ -855,7 +957,7 @@ function getUnlistedDevDependencies({ name, location }, {
855
957
  for (const imp of externalAllImports) {
856
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)) {
857
959
  unlistedDevDependencies++;
858
- 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)}`);
859
961
  if (allImportPaths[imp]) {
860
962
  console.log(` ${allImportPaths[imp].join("\n ")}`);
861
963
  }
@@ -863,14 +965,14 @@ function getUnlistedDevDependencies({ name, location }, {
863
965
  }
864
966
  if (unlistedDevDependencies > 0) {
865
967
  const packageLocation = `${location}/package.json`;
866
- console.log(` ${chalk12.yellow(packageLocation)}
968
+ console.log(` ${chalk13.yellow(packageLocation)}
867
969
  `);
868
970
  }
869
971
  return unlistedDevDependencies;
870
972
  }
871
973
 
872
974
  // src/actions/deplint/checkPackage/getUnusedDependencies.ts
873
- import chalk13 from "chalk";
975
+ import chalk14 from "chalk";
874
976
  function getUnusedDependencies({ name, location }, { dependencies }, {
875
977
  externalDistImports,
876
978
  externalDistTypeImports,
@@ -881,22 +983,22 @@ function getUnusedDependencies({ name, location }, { dependencies }, {
881
983
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
882
984
  unusedDependencies++;
883
985
  if (externalAllImports.includes(dep)) {
884
- 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)}`);
885
987
  } else {
886
- 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)}`);
887
989
  }
888
990
  }
889
991
  }
890
992
  if (unusedDependencies > 0) {
891
993
  const packageLocation = `${location}/package.json`;
892
- console.log(` ${chalk13.yellow(packageLocation)}
994
+ console.log(` ${chalk14.yellow(packageLocation)}
893
995
  `);
894
996
  }
895
997
  return unusedDependencies;
896
998
  }
897
999
 
898
1000
  // src/actions/deplint/checkPackage/getUnusedDevDependencies.ts
899
- import chalk14 from "chalk";
1001
+ import chalk15 from "chalk";
900
1002
 
901
1003
  // src/actions/deplint/getRequiredPeerDependencies.ts
902
1004
  import fs6 from "fs";
@@ -1079,34 +1181,34 @@ function getUnusedDevDependencies({ name, location }, {
1079
1181
  if (dependencies.includes(dep) || peerDependencies.includes(dep)) continue;
1080
1182
  if (!isDevDepUsed(dep, allImports, implicitDeps, requiredPeers, scriptRefs)) {
1081
1183
  unusedDevDependencies++;
1082
- 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)}`);
1083
1185
  }
1084
1186
  }
1085
1187
  if (unusedDevDependencies > 0) {
1086
1188
  const packageLocation = `${location}/package.json`;
1087
- console.log(` ${chalk14.yellow(packageLocation)}
1189
+ console.log(` ${chalk15.yellow(packageLocation)}
1088
1190
  `);
1089
1191
  }
1090
1192
  return unusedDevDependencies;
1091
1193
  }
1092
1194
 
1093
1195
  // src/actions/deplint/checkPackage/getUnusedPeerDependencies.ts
1094
- import chalk15 from "chalk";
1196
+ import chalk16 from "chalk";
1095
1197
  function getUnusedPeerDependencies({ name, location }, { peerDependencies, dependencies }, { externalDistImports, externalDistTypeImports }) {
1096
1198
  let unusedDependencies = 0;
1097
1199
  for (const dep of peerDependencies) {
1098
1200
  if (!externalDistImports.includes(dep) && !externalDistImports.includes(dep.replace(/^@types\//, "")) && !externalDistTypeImports.includes(dep) && !externalDistTypeImports.includes(dep.replace(/^@types\//, ""))) {
1099
1201
  unusedDependencies++;
1100
1202
  if (dependencies.includes(dep)) {
1101
- 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)}`);
1102
1204
  } else {
1103
- 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)}`);
1104
1206
  }
1105
1207
  }
1106
1208
  }
1107
1209
  if (unusedDependencies > 0) {
1108
1210
  const packageLocation = `${location}/package.json`;
1109
- console.log(` ${chalk15.yellow(packageLocation)}
1211
+ console.log(` ${chalk16.yellow(packageLocation)}
1110
1212
  `);
1111
1213
  }
1112
1214
  return unusedDependencies;
@@ -1192,19 +1294,19 @@ var deplint = ({
1192
1294
  });
1193
1295
  }
1194
1296
  if (totalErrors > 0) {
1195
- 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")}`);
1196
1298
  } else {
1197
- console.info(`Deplint: Found no dependency problems. ${chalk16.green("\u2714")}`);
1299
+ console.info(`Deplint: Found no dependency problems. ${chalk17.green("\u2714")}`);
1198
1300
  }
1199
1301
  return 0;
1200
1302
  };
1201
1303
 
1202
1304
  // src/actions/deploy.ts
1203
- import { readFileSync as readFileSync3 } from "fs";
1305
+ import { readFileSync as readFileSync5 } from "fs";
1204
1306
  var privatePackageExcludeList = () => {
1205
1307
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1206
1308
  workspace,
1207
- JSON.parse(readFileSync3(`${workspace.location}/package.json`, { encoding: "utf8" }))
1309
+ JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
1208
1310
  ]);
1209
1311
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1210
1312
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1224,11 +1326,11 @@ var deploy = () => {
1224
1326
  };
1225
1327
 
1226
1328
  // src/actions/deploy-major.ts
1227
- import { readFileSync as readFileSync4 } from "fs";
1329
+ import { readFileSync as readFileSync6 } from "fs";
1228
1330
  var privatePackageExcludeList2 = () => {
1229
1331
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1230
1332
  workspace,
1231
- JSON.parse(readFileSync4(`${workspace.location}/package.json`, { encoding: "utf8" }))
1333
+ JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
1232
1334
  ]);
1233
1335
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1234
1336
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1248,11 +1350,11 @@ var deployMajor = () => {
1248
1350
  };
1249
1351
 
1250
1352
  // src/actions/deploy-minor.ts
1251
- import { readFileSync as readFileSync5 } from "fs";
1353
+ import { readFileSync as readFileSync7 } from "fs";
1252
1354
  var privatePackageExcludeList3 = () => {
1253
1355
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1254
1356
  workspace,
1255
- JSON.parse(readFileSync5(`${workspace.location}/package.json`, { encoding: "utf8" }))
1357
+ JSON.parse(readFileSync7(`${workspace.location}/package.json`, { encoding: "utf8" }))
1256
1358
  ]);
1257
1359
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1258
1360
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1272,11 +1374,11 @@ var deployMinor = () => {
1272
1374
  };
1273
1375
 
1274
1376
  // src/actions/deploy-next.ts
1275
- import { readFileSync as readFileSync6 } from "fs";
1377
+ import { readFileSync as readFileSync8 } from "fs";
1276
1378
  var privatePackageExcludeList4 = () => {
1277
1379
  const possibleDeployablePackages = yarnWorkspaces().map((workspace) => [
1278
1380
  workspace,
1279
- JSON.parse(readFileSync6(`${workspace.location}/package.json`, { encoding: "utf8" }))
1381
+ JSON.parse(readFileSync8(`${workspace.location}/package.json`, { encoding: "utf8" }))
1280
1382
  ]);
1281
1383
  const privatePackages = possibleDeployablePackages.filter(([_, pkg]) => pkg.private).map(([workspace]) => workspace);
1282
1384
  const excludeList = privatePackages.map((workspace) => `--exclude ${workspace.name}`);
@@ -1296,22 +1398,22 @@ var deployNext = () => {
1296
1398
  };
1297
1399
 
1298
1400
  // src/actions/dupdeps.ts
1299
- import chalk17 from "chalk";
1401
+ import chalk18 from "chalk";
1300
1402
  var dupdeps = () => {
1301
- console.log(chalk17.green("Checking all Dependencies for Duplicates"));
1403
+ console.log(chalk18.green("Checking all Dependencies for Duplicates"));
1302
1404
  const allDependencies = parsedPackageJSON()?.dependencies;
1303
1405
  const dependencies = Object.entries(allDependencies).map(([k]) => k);
1304
1406
  return detectDuplicateDependencies(dependencies);
1305
1407
  };
1306
1408
 
1307
1409
  // src/actions/lint.ts
1308
- import chalk18 from "chalk";
1410
+ import chalk19 from "chalk";
1309
1411
  var lintPackage = ({
1310
1412
  pkg,
1311
1413
  fix: fix2,
1312
1414
  verbose
1313
1415
  }) => {
1314
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1416
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1315
1417
  const start = Date.now();
1316
1418
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1317
1419
  ["yarn", [
@@ -1321,7 +1423,7 @@ var lintPackage = ({
1321
1423
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1322
1424
  ]]
1323
1425
  ]);
1324
- 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")}`));
1325
1427
  return result;
1326
1428
  };
1327
1429
  var lint = ({
@@ -1341,13 +1443,13 @@ var lint = ({
1341
1443
  });
1342
1444
  };
1343
1445
  var lintAllPackages = ({ fix: fix2 = false } = {}) => {
1344
- console.log(chalk18.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1446
+ console.log(chalk19.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1345
1447
  const start = Date.now();
1346
1448
  const fixOptions = fix2 ? ["--fix"] : [];
1347
1449
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1348
1450
  ["yarn", ["eslint", "--cache", "--cache-location", ".eslintcache", "--cache-strategy", "content", ...fixOptions]]
1349
1451
  ]);
1350
- 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")}`));
1351
1453
  return result;
1352
1454
  };
1353
1455
 
@@ -1375,7 +1477,7 @@ var filename = ".gitignore";
1375
1477
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
1376
1478
 
1377
1479
  // src/actions/gitlint.ts
1378
- import chalk19 from "chalk";
1480
+ import chalk20 from "chalk";
1379
1481
  import ParseGitConfig from "parse-git-config";
1380
1482
  var gitlint = () => {
1381
1483
  console.log(`
@@ -1386,7 +1488,7 @@ Gitlint Start [${process.cwd()}]
1386
1488
  const errors = 0;
1387
1489
  const gitConfig = ParseGitConfig.sync();
1388
1490
  const warn = (message) => {
1389
- console.warn(chalk19.yellow(`Warning: ${message}`));
1491
+ console.warn(chalk20.yellow(`Warning: ${message}`));
1390
1492
  warnings++;
1391
1493
  };
1392
1494
  if (gitConfig.core.ignorecase) {
@@ -1406,13 +1508,13 @@ Gitlint Start [${process.cwd()}]
1406
1508
  }
1407
1509
  const resultMessages = [];
1408
1510
  if (valid > 0) {
1409
- resultMessages.push(chalk19.green(`Passed: ${valid}`));
1511
+ resultMessages.push(chalk20.green(`Passed: ${valid}`));
1410
1512
  }
1411
1513
  if (warnings > 0) {
1412
- resultMessages.push(chalk19.yellow(`Warnings: ${warnings}`));
1514
+ resultMessages.push(chalk20.yellow(`Warnings: ${warnings}`));
1413
1515
  }
1414
1516
  if (errors > 0) {
1415
- resultMessages.push(chalk19.red(` Errors: ${errors}`));
1517
+ resultMessages.push(chalk20.red(` Errors: ${errors}`));
1416
1518
  }
1417
1519
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
1418
1520
  `);
@@ -1421,7 +1523,7 @@ Gitlint Start [${process.cwd()}]
1421
1523
 
1422
1524
  // src/actions/gitlint-fix.ts
1423
1525
  import { execSync as execSync2 } from "child_process";
1424
- import chalk20 from "chalk";
1526
+ import chalk21 from "chalk";
1425
1527
  import ParseGitConfig2 from "parse-git-config";
1426
1528
  var gitlintFix = () => {
1427
1529
  console.log(`
@@ -1430,15 +1532,15 @@ Gitlint Fix Start [${process.cwd()}]
1430
1532
  const gitConfig = ParseGitConfig2.sync();
1431
1533
  if (gitConfig.core.ignorecase) {
1432
1534
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
1433
- 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"));
1434
1536
  }
1435
1537
  if (gitConfig.core.autocrlf !== false) {
1436
1538
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
1437
- 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"));
1438
1540
  }
1439
1541
  if (gitConfig.core.eol !== "lf") {
1440
1542
  execSync2("git config core.eol lf", { stdio: "inherit" });
1441
- 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'));
1442
1544
  }
1443
1545
  return 1;
1444
1546
  };
@@ -1449,7 +1551,7 @@ var knip = () => {
1449
1551
  };
1450
1552
 
1451
1553
  // src/actions/license.ts
1452
- import chalk21 from "chalk";
1554
+ import chalk22 from "chalk";
1453
1555
  import { init } from "license-checker";
1454
1556
  var license = async (pkg) => {
1455
1557
  const workspaces = yarnWorkspaces();
@@ -1474,18 +1576,18 @@ var license = async (pkg) => {
1474
1576
  "LGPL-3.0-or-later",
1475
1577
  "Python-2.0"
1476
1578
  ]);
1477
- console.log(chalk21.green("License Checker"));
1579
+ console.log(chalk22.green("License Checker"));
1478
1580
  return (await Promise.all(
1479
1581
  workspaceList.map(({ location, name }) => {
1480
1582
  return new Promise((resolve) => {
1481
1583
  init({ production: true, start: location }, (error, packages) => {
1482
1584
  if (error) {
1483
- console.error(chalk21.red(`License Checker [${name}] Error`));
1484
- console.error(chalk21.gray(error));
1585
+ console.error(chalk22.red(`License Checker [${name}] Error`));
1586
+ console.error(chalk22.gray(error));
1485
1587
  console.log("\n");
1486
1588
  resolve(1);
1487
1589
  } else {
1488
- console.log(chalk21.green(`License Checker [${name}]`));
1590
+ console.log(chalk22.green(`License Checker [${name}]`));
1489
1591
  let count = 0;
1490
1592
  for (const [name2, info] of Object.entries(packages)) {
1491
1593
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -1501,7 +1603,7 @@ var license = async (pkg) => {
1501
1603
  }
1502
1604
  if (!orLicenseFound) {
1503
1605
  count++;
1504
- console.warn(chalk21.yellow(`${name2}: Package License not allowed [${license2}]`));
1606
+ console.warn(chalk22.yellow(`${name2}: Package License not allowed [${license2}]`));
1505
1607
  }
1506
1608
  }
1507
1609
  }
@@ -1545,7 +1647,7 @@ var rebuild = ({ target }) => {
1545
1647
  };
1546
1648
 
1547
1649
  // src/actions/recompile.ts
1548
- import chalk22 from "chalk";
1650
+ import chalk23 from "chalk";
1549
1651
  var recompile = async ({
1550
1652
  verbose,
1551
1653
  target,
@@ -1581,7 +1683,7 @@ var recompileAll = async ({
1581
1683
  const incrementalOptions = incremental ? ["--since", "-Apt", "--topological-dev"] : ["--parallel", "-Apt", "--topological-dev"];
1582
1684
  const jobsOptions = jobs ? ["-j", `${jobs}`] : [];
1583
1685
  if (jobs) {
1584
- console.log(chalk22.blue(`Jobs set to [${jobs}]`));
1686
+ console.log(chalk23.blue(`Jobs set to [${jobs}]`));
1585
1687
  }
1586
1688
  const result = await runStepsAsync(`Recompile${incremental ? "-Incremental" : ""} [All]`, [
1587
1689
  [
@@ -1612,7 +1714,7 @@ var recompileAll = async ({
1612
1714
  ]
1613
1715
  ]);
1614
1716
  console.log(
1615
- `${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")}`
1616
1718
  );
1617
1719
  return result;
1618
1720
  };
@@ -1643,13 +1745,13 @@ var reinstall = () => {
1643
1745
  };
1644
1746
 
1645
1747
  // src/actions/relint.ts
1646
- import chalk23 from "chalk";
1748
+ import chalk24 from "chalk";
1647
1749
  var relintPackage = ({
1648
1750
  pkg,
1649
1751
  fix: fix2,
1650
1752
  verbose
1651
1753
  }) => {
1652
- console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1754
+ console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [${pkg}]`));
1653
1755
  const start = Date.now();
1654
1756
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [${pkg}]`, [
1655
1757
  ["yarn", [
@@ -1659,7 +1761,7 @@ var relintPackage = ({
1659
1761
  fix2 ? "package-fix" : verbose ? "package-lint-verbose" : "package-lint"
1660
1762
  ]]
1661
1763
  ]);
1662
- 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")}`));
1663
1765
  return result;
1664
1766
  };
1665
1767
  var relint = ({
@@ -1679,13 +1781,13 @@ var relint = ({
1679
1781
  });
1680
1782
  };
1681
1783
  var relintAllPackages = ({ fix: fix2 = false } = {}) => {
1682
- console.log(chalk23.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1784
+ console.log(chalk24.gray(`${fix2 ? "Fix" : "Lint"} [All-Packages]`));
1683
1785
  const start = Date.now();
1684
1786
  const fixOptions = fix2 ? ["--fix"] : [];
1685
1787
  const result = runSteps(`${fix2 ? "Fix" : "Lint"} [All-Packages]`, [
1686
1788
  ["yarn", ["eslint", ...fixOptions]]
1687
1789
  ]);
1688
- 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")}`));
1689
1791
  return result;
1690
1792
  };
1691
1793
 
@@ -1703,10 +1805,10 @@ var sonar = () => {
1703
1805
  };
1704
1806
 
1705
1807
  // src/actions/statics.ts
1706
- import chalk24 from "chalk";
1808
+ import chalk25 from "chalk";
1707
1809
  var DefaultDependencies = ["axios", "@xylabs/pixel", "react", "graphql", "react-router", "@mui/material", "@mui/system"];
1708
1810
  var statics = () => {
1709
- console.log(chalk24.green("Check Required Static Dependencies"));
1811
+ console.log(chalk25.green("Check Required Static Dependencies"));
1710
1812
  const statics2 = parsedPackageJSON()?.xy?.deps?.statics;
1711
1813
  return detectDuplicateDependencies(statics2, DefaultDependencies);
1712
1814
  };
@@ -1860,6 +1962,21 @@ var packagePositionalParam = (yargs2) => {
1860
1962
  // src/xy/xyCommonCommands.ts
1861
1963
  var xyCommonCommands = (args) => {
1862
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(
1863
1980
  "license [package]",
1864
1981
  "License - Check licenses of dependencies",
1865
1982
  (yargs2) => {
@@ -2106,7 +2223,7 @@ var xyInstallCommands = (args) => {
2106
2223
  };
2107
2224
 
2108
2225
  // src/xy/xyLintCommands.ts
2109
- import chalk25 from "chalk";
2226
+ import chalk26 from "chalk";
2110
2227
  var xyLintCommands = (args) => {
2111
2228
  return args.command(
2112
2229
  "cycle [package]",
@@ -2118,7 +2235,7 @@ var xyLintCommands = (args) => {
2118
2235
  const start = Date.now();
2119
2236
  if (argv.verbose) console.log("Cycle");
2120
2237
  process.exitCode = await cycle({ pkg: argv.package });
2121
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2238
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2122
2239
  }
2123
2240
  ).command(
2124
2241
  "lint [package]",
@@ -2148,7 +2265,7 @@ var xyLintCommands = (args) => {
2148
2265
  cache: argv.cache,
2149
2266
  verbose: !!argv.verbose
2150
2267
  });
2151
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2268
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2152
2269
  }
2153
2270
  ).command(
2154
2271
  "deplint [package]",
@@ -2181,7 +2298,7 @@ var xyLintCommands = (args) => {
2181
2298
  peerDeps: !!argv.peerDeps,
2182
2299
  verbose: !!argv.verbose
2183
2300
  });
2184
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2301
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2185
2302
  }
2186
2303
  ).command(
2187
2304
  "fix [package]",
@@ -2193,7 +2310,7 @@ var xyLintCommands = (args) => {
2193
2310
  const start = Date.now();
2194
2311
  if (argv.verbose) console.log("Fix");
2195
2312
  process.exitCode = fix();
2196
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2313
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2197
2314
  }
2198
2315
  ).command(
2199
2316
  "relint [package]",
@@ -2205,7 +2322,7 @@ var xyLintCommands = (args) => {
2205
2322
  if (argv.verbose) console.log("Relinting");
2206
2323
  const start = Date.now();
2207
2324
  process.exitCode = relint();
2208
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2325
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2209
2326
  }
2210
2327
  ).command(
2211
2328
  "publint [package]",
@@ -2217,7 +2334,7 @@ var xyLintCommands = (args) => {
2217
2334
  if (argv.verbose) console.log("Publint");
2218
2335
  const start = Date.now();
2219
2336
  process.exitCode = await publint({ pkg: argv.package, verbose: !!argv.verbose });
2220
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2337
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2221
2338
  }
2222
2339
  ).command(
2223
2340
  "knip",
@@ -2229,7 +2346,7 @@ var xyLintCommands = (args) => {
2229
2346
  if (argv.verbose) console.log("Knip");
2230
2347
  const start = Date.now();
2231
2348
  process.exitCode = knip();
2232
- console.log(chalk25.blue(`Knip finished in ${Date.now() - start}ms`));
2349
+ console.log(chalk26.blue(`Knip finished in ${Date.now() - start}ms`));
2233
2350
  }
2234
2351
  ).command(
2235
2352
  "sonar",
@@ -2241,7 +2358,7 @@ var xyLintCommands = (args) => {
2241
2358
  const start = Date.now();
2242
2359
  if (argv.verbose) console.log("Sonar Check");
2243
2360
  process.exitCode = sonar();
2244
- console.log(chalk25.blue(`Finished in ${Date.now() - start}ms`));
2361
+ console.log(chalk26.blue(`Finished in ${Date.now() - start}ms`));
2245
2362
  }
2246
2363
  );
2247
2364
  };
@@ -2277,8 +2394,8 @@ var xyParseOptions = () => {
2277
2394
  var xy = async () => {
2278
2395
  const options = xyParseOptions();
2279
2396
  return await xyBuildCommands(xyCommonCommands(xyInstallCommands(xyDeployCommands(xyLintCommands(options))))).demandCommand(1).command("*", "", () => {
2280
- console.error(chalk26.yellow(`Command not found [${chalk26.magenta(process.argv[2])}]`));
2281
- 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"));
2282
2399
  }).version().help().argv;
2283
2400
  };
2284
2401