@xylabs/ts-scripts-yarn3 7.4.19 → 7.4.21

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 (52) hide show
  1. package/dist/actions/claude-commands.mjs +5 -1
  2. package/dist/actions/claude-commands.mjs.map +1 -1
  3. package/dist/actions/claude-rules.mjs +5 -1
  4. package/dist/actions/claude-rules.mjs.map +1 -1
  5. package/dist/actions/claude-skills.mjs +120 -0
  6. package/dist/actions/claude-skills.mjs.map +1 -0
  7. package/dist/actions/index.mjs +229 -127
  8. package/dist/actions/index.mjs.map +1 -1
  9. package/dist/bin/xy.mjs +239 -140
  10. package/dist/bin/xy.mjs.map +1 -1
  11. package/dist/index.d.ts +5 -1
  12. package/dist/index.mjs +299 -197
  13. package/dist/index.mjs.map +1 -1
  14. package/dist/lib/claudeMdTemplate.mjs +27 -2
  15. package/dist/lib/claudeMdTemplate.mjs.map +1 -1
  16. package/dist/lib/index.mjs +26 -1
  17. package/dist/lib/index.mjs.map +1 -1
  18. package/dist/xy/build-commands/build.mjs +502 -0
  19. package/dist/xy/build-commands/build.mjs.map +1 -0
  20. package/dist/xy/{build → build-commands}/index.mjs +40 -45
  21. package/dist/xy/build-commands/index.mjs.map +1 -0
  22. package/dist/xy/common/claude/commandsCommand.mjs +5 -1
  23. package/dist/xy/common/claude/commandsCommand.mjs.map +1 -1
  24. package/dist/xy/common/claude/index.mjs +111 -2
  25. package/dist/xy/common/claude/index.mjs.map +1 -1
  26. package/dist/xy/common/claude/initCommand.mjs +111 -1
  27. package/dist/xy/common/claude/initCommand.mjs.map +1 -1
  28. package/dist/xy/common/claude/rulesCommand.mjs +5 -1
  29. package/dist/xy/common/claude/rulesCommand.mjs.map +1 -1
  30. package/dist/xy/common/claude/skillsCommand.mjs +129 -0
  31. package/dist/xy/common/claude/skillsCommand.mjs.map +1 -0
  32. package/dist/xy/common/index.mjs +128 -19
  33. package/dist/xy/common/index.mjs.map +1 -1
  34. package/dist/xy/index.mjs +239 -140
  35. package/dist/xy/index.mjs.map +1 -1
  36. package/dist/xy/xy.mjs +239 -140
  37. package/dist/xy/xy.mjs.map +1 -1
  38. package/package.json +2 -2
  39. package/templates/claude/skills/xylabs-e2e-setup/SKILL.md +197 -0
  40. package/dist/xy/build/buildCommand.mjs +0 -161
  41. package/dist/xy/build/buildCommand.mjs.map +0 -1
  42. package/dist/xy/build/compileCommand.mjs +0 -174
  43. package/dist/xy/build/compileCommand.mjs.map +0 -1
  44. package/dist/xy/build/compileOnlyCommand.mjs +0 -175
  45. package/dist/xy/build/compileOnlyCommand.mjs.map +0 -1
  46. package/dist/xy/build/copyAssetsCommand.mjs +0 -84
  47. package/dist/xy/build/copyAssetsCommand.mjs.map +0 -1
  48. package/dist/xy/build/index.mjs.map +0 -1
  49. package/dist/xy/build/rebuildCommand.mjs +0 -114
  50. package/dist/xy/build/rebuildCommand.mjs.map +0 -1
  51. package/dist/xy/build/recompileCommand.mjs +0 -204
  52. package/dist/xy/build/recompileCommand.mjs.map +0 -1
@@ -12,7 +12,11 @@ var checkResult = (name, result, level = "error", exitOnFail = false) => {
12
12
  };
13
13
 
14
14
  // src/lib/claudeMdTemplate.ts
15
- import { readdirSync, readFileSync } from "fs";
15
+ import {
16
+ readdirSync,
17
+ readFileSync,
18
+ statSync
19
+ } from "fs";
16
20
  import { createRequire } from "module";
17
21
  import PATH from "path";
18
22
  var require2 = createRequire(import.meta.url);
@@ -20,6 +24,7 @@ var packageRoot = PATH.dirname(require2.resolve("@xylabs/ts-scripts-yarn3/packag
20
24
  var templatesDir = PATH.resolve(packageRoot, "templates", "claude");
21
25
  var XYLABS_RULES_PREFIX = "xylabs-";
22
26
  var XYLABS_COMMANDS_PREFIX = "xylabs-";
27
+ var XYLABS_SKILLS_PREFIX = "xylabs-";
23
28
  var claudeMdRuleTemplates = () => {
24
29
  const rulesDir = PATH.resolve(templatesDir, "rules");
25
30
  const files = readdirSync(rulesDir).filter((f) => f.startsWith(XYLABS_RULES_PREFIX) && f.endsWith(".md"));
@@ -38,6 +43,24 @@ var claudeCommandTemplates = () => {
38
43
  }
39
44
  return result;
40
45
  };
46
+ var claudeSkillTemplates = () => {
47
+ const skillsDir = PATH.resolve(templatesDir, "skills");
48
+ const dirs = readdirSync(skillsDir).filter(
49
+ (f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync(PATH.resolve(skillsDir, f)).isDirectory()
50
+ );
51
+ const result = {};
52
+ for (const dir of dirs) {
53
+ const dirPath = PATH.resolve(skillsDir, dir);
54
+ const files = readdirSync(dirPath, { recursive: true, encoding: "utf8" });
55
+ result[dir] = {};
56
+ for (const file of files) {
57
+ if (statSync(PATH.resolve(dirPath, file)).isFile()) {
58
+ result[dir][file] = readFileSync(PATH.resolve(dirPath, file), "utf8");
59
+ }
60
+ }
61
+ }
62
+ return result;
63
+ };
41
64
  var claudeMdProjectTemplate = () => readFileSync(PATH.resolve(templatesDir, "CLAUDE-project.md"), "utf8");
42
65
 
43
66
  // src/lib/deleteGlob.ts
@@ -690,12 +713,90 @@ async function claudeSettings() {
690
713
  return 0;
691
714
  }
692
715
 
716
+ // src/actions/claude-skills.ts
717
+ import {
718
+ existsSync as existsSync6,
719
+ mkdirSync as mkdirSync4,
720
+ readdirSync as readdirSync4,
721
+ readFileSync as readFileSync6,
722
+ rmSync,
723
+ statSync as statSync2,
724
+ writeFileSync as writeFileSync5
725
+ } from "fs";
726
+ import PATH6 from "path";
727
+ import chalk10 from "chalk";
728
+ var syncSkillFiles = (skillsDir) => {
729
+ const templates = claudeSkillTemplates();
730
+ const templateNames = new Set(Object.keys(templates));
731
+ let updated = 0;
732
+ let created = 0;
733
+ for (const [skillName, files] of Object.entries(templates)) {
734
+ const skillDir = PATH6.resolve(skillsDir, skillName);
735
+ mkdirSync4(skillDir, { recursive: true });
736
+ for (const [filename3, content] of Object.entries(files)) {
737
+ const targetPath = PATH6.resolve(skillDir, filename3);
738
+ mkdirSync4(PATH6.dirname(targetPath), { recursive: true });
739
+ const existing = existsSync6(targetPath) ? readFileSync6(targetPath, "utf8") : void 0;
740
+ if (existing === content) continue;
741
+ writeFileSync5(targetPath, content, "utf8");
742
+ if (existing) {
743
+ updated++;
744
+ } else {
745
+ created++;
746
+ }
747
+ }
748
+ }
749
+ return {
750
+ created,
751
+ templateNames,
752
+ updated
753
+ };
754
+ };
755
+ var removeStaleSkills = (skillsDir, templateNames) => {
756
+ const existingSkills = readdirSync4(skillsDir).filter(
757
+ (f) => f.startsWith(XYLABS_SKILLS_PREFIX) && statSync2(PATH6.resolve(skillsDir, f)).isDirectory()
758
+ );
759
+ let removed = 0;
760
+ for (const dir of existingSkills) {
761
+ if (!templateNames.has(dir)) {
762
+ rmSync(PATH6.resolve(skillsDir, dir), { recursive: true });
763
+ removed++;
764
+ }
765
+ }
766
+ return removed;
767
+ };
768
+ var logSkillsResult = (created, updated, removed) => {
769
+ if (created || updated || removed) {
770
+ const parts = [
771
+ created ? `${created} created` : "",
772
+ updated ? `${updated} updated` : "",
773
+ removed ? `${removed} removed` : ""
774
+ ].filter(Boolean);
775
+ console.log(chalk10.green(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: ${parts.join(", ")}`));
776
+ } else {
777
+ console.log(chalk10.gray(`.claude/skills/${XYLABS_SKILLS_PREFIX}*/: already up to date`));
778
+ }
779
+ };
780
+ var claudeSkills = () => {
781
+ const cwd = INIT_CWD() ?? process.cwd();
782
+ const skillsDir = PATH6.resolve(cwd, ".claude", "skills");
783
+ mkdirSync4(skillsDir, { recursive: true });
784
+ const {
785
+ created,
786
+ templateNames,
787
+ updated
788
+ } = syncSkillFiles(skillsDir);
789
+ const removed = removeStaleSkills(skillsDir, templateNames);
790
+ logSkillsResult(created, updated, removed);
791
+ return 0;
792
+ };
793
+
693
794
  // src/actions/clean-docs.ts
694
795
  import path from "path";
695
- import chalk10 from "chalk";
796
+ import chalk11 from "chalk";
696
797
  var cleanDocs = () => {
697
798
  const pkgName = process.env.npm_package_name;
698
- console.log(chalk10.green(`Cleaning Docs [${pkgName}]`));
799
+ console.log(chalk11.green(`Cleaning Docs [${pkgName}]`));
699
800
  for (const { location } of yarnWorkspaces()) deleteGlob(path.join(location, "docs"));
700
801
  return 0;
701
802
  };
@@ -724,7 +825,7 @@ var filename = ".gitignore";
724
825
  var gitignoreGen = (pkg) => generateIgnoreFiles(filename, pkg);
725
826
 
726
827
  // src/actions/gitlint.ts
727
- import chalk11 from "chalk";
828
+ import chalk12 from "chalk";
728
829
  import ParseGitConfig from "parse-git-config";
729
830
  var gitlint = () => {
730
831
  console.log(`
@@ -735,7 +836,7 @@ Gitlint Start [${process.cwd()}]
735
836
  const errors = 0;
736
837
  const gitConfig = ParseGitConfig.sync();
737
838
  const warn = (message) => {
738
- console.warn(chalk11.yellow(`Warning: ${message}`));
839
+ console.warn(chalk12.yellow(`Warning: ${message}`));
739
840
  warnings++;
740
841
  };
741
842
  if (gitConfig.core.ignorecase) {
@@ -755,13 +856,13 @@ Gitlint Start [${process.cwd()}]
755
856
  }
756
857
  const resultMessages = [];
757
858
  if (valid > 0) {
758
- resultMessages.push(chalk11.green(`Passed: ${valid}`));
859
+ resultMessages.push(chalk12.green(`Passed: ${valid}`));
759
860
  }
760
861
  if (warnings > 0) {
761
- resultMessages.push(chalk11.yellow(`Warnings: ${warnings}`));
862
+ resultMessages.push(chalk12.yellow(`Warnings: ${warnings}`));
762
863
  }
763
864
  if (errors > 0) {
764
- resultMessages.push(chalk11.red(` Errors: ${errors}`));
865
+ resultMessages.push(chalk12.red(` Errors: ${errors}`));
765
866
  }
766
867
  console.warn(`Gitlint Finish [ ${resultMessages.join(" | ")} ]
767
868
  `);
@@ -770,7 +871,7 @@ Gitlint Start [${process.cwd()}]
770
871
 
771
872
  // src/actions/gitlint-fix.ts
772
873
  import { execSync as execSync2 } from "child_process";
773
- import chalk12 from "chalk";
874
+ import chalk13 from "chalk";
774
875
  import ParseGitConfig2 from "parse-git-config";
775
876
  var gitlintFix = () => {
776
877
  console.log(`
@@ -779,21 +880,21 @@ Gitlint Fix Start [${process.cwd()}]
779
880
  const gitConfig = ParseGitConfig2.sync();
780
881
  if (gitConfig.core.ignorecase) {
781
882
  execSync2("git config core.ignorecase false", { stdio: "inherit" });
782
- console.warn(chalk12.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
883
+ console.warn(chalk13.yellow("\nGitlint Fix: Updated core.ignorecase to be false\n"));
783
884
  }
784
885
  if (gitConfig.core.autocrlf !== false) {
785
886
  execSync2("git config core.autocrlf false", { stdio: "inherit" });
786
- console.warn(chalk12.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
887
+ console.warn(chalk13.yellow("\nGitlint Fix: Updated core.autocrlf to be false\n"));
787
888
  }
788
889
  if (gitConfig.core.eol !== "lf") {
789
890
  execSync2("git config core.eol lf", { stdio: "inherit" });
790
- console.warn(chalk12.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
891
+ console.warn(chalk13.yellow('\nGitlint Fix: Updated core.eol to be "lf"\n'));
791
892
  }
792
893
  return 1;
793
894
  };
794
895
 
795
896
  // src/actions/license.ts
796
- import chalk13 from "chalk";
897
+ import chalk14 from "chalk";
797
898
  import { init } from "license-checker";
798
899
  var license = async (pkg) => {
799
900
  const workspaces = yarnWorkspaces();
@@ -818,18 +919,18 @@ var license = async (pkg) => {
818
919
  "LGPL-3.0-or-later",
819
920
  "Python-2.0"
820
921
  ]);
821
- console.log(chalk13.green("License Checker"));
922
+ console.log(chalk14.green("License Checker"));
822
923
  return (await Promise.all(
823
924
  workspaceList.map(({ location, name }) => {
824
925
  return new Promise((resolve) => {
825
926
  init({ production: true, start: location }, (error, packages) => {
826
927
  if (error) {
827
- console.error(chalk13.red(`License Checker [${name}] Error`));
828
- console.error(chalk13.gray(error));
928
+ console.error(chalk14.red(`License Checker [${name}] Error`));
929
+ console.error(chalk14.gray(error));
829
930
  console.log("\n");
830
931
  resolve(1);
831
932
  } else {
832
- console.log(chalk13.green(`License Checker [${name}]`));
933
+ console.log(chalk14.green(`License Checker [${name}]`));
833
934
  let count = 0;
834
935
  for (const [name2, info] of Object.entries(packages)) {
835
936
  const licenses = Array.isArray(info.licenses) ? info.licenses : [info.licenses];
@@ -845,7 +946,7 @@ var license = async (pkg) => {
845
946
  }
846
947
  if (!orLicenseFound) {
847
948
  count++;
848
- console.warn(chalk13.yellow(`${name2}: Package License not allowed [${license2}]`));
949
+ console.warn(chalk14.yellow(`${name2}: Package License not allowed [${license2}]`));
849
950
  }
850
951
  }
851
952
  }
@@ -957,6 +1058,14 @@ var initCommand = {
957
1058
  process.exitCode = commandsResult || rulesResult || settingsResult;
958
1059
  }
959
1060
  };
1061
+ var initClaudeSkillsCommand = {
1062
+ command: "init:skills",
1063
+ describe: "Initialize Claude skills configuration",
1064
+ handler: () => {
1065
+ const result = claudeSkills();
1066
+ process.exitCode = result;
1067
+ }
1068
+ };
960
1069
 
961
1070
  // src/xy/common/claude/rulesCommand.ts
962
1071
  var rulesCommand = {
@@ -989,7 +1098,7 @@ var settingsCommand = {
989
1098
  // src/xy/common/claude/index.ts
990
1099
  var claudeCommand = {
991
1100
  builder: (yargs) => {
992
- return yargs.command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).demandCommand(1, "Please specify a claude subcommand");
1101
+ return yargs.command(commandsCommand).command(initCommand).command(rulesCommand).command(settingsCommand).command(initClaudeSkillsCommand).demandCommand(1, "Please specify a claude subcommand");
993
1102
  },
994
1103
  command: "claude",
995
1104
  describe: "Claude - Claude Code configuration utilities",