@xylabs/toolchain 7.10.1 → 7.10.3

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/index.d.ts CHANGED
@@ -536,12 +536,31 @@ interface ReadmeConfig {
536
536
  */
537
537
  logoUrl?: string;
538
538
  }
539
+ /**
540
+ * Configuration for packman lint (package manager config linting).
541
+ */
542
+ interface PackmanConfig {
543
+ /**
544
+ * Minimum age in minutes that a package must be published before pnpm will install it.
545
+ * Only applies when pnpm is the detected package manager.
546
+ * @default 4320 (3 days)
547
+ */
548
+ minimumReleaseAge?: number;
549
+ /**
550
+ * Package patterns to exclude from the minimumReleaseAge requirement.
551
+ * These packages can be installed immediately upon release.
552
+ * Supports exact names and scoped wildcards (e.g. '@myorg/*').
553
+ * @default ["'@xylabs/*'", "'@xyo-network/*'"]
554
+ */
555
+ minimumReleaseAgeExclude?: string[];
556
+ }
539
557
  /**
540
558
  * Command-specific configuration that cascades from root to package.
541
559
  * Settings here override the legacy top-level equivalents.
542
560
  */
543
561
  interface CommandsConfig {
544
562
  deplint?: DeplintConfig;
563
+ packman?: PackmanConfig;
545
564
  publint?: boolean | PublintConfig;
546
565
  }
547
566
  interface XyConfigBase {
@@ -686,7 +705,7 @@ interface PackmanLintParams {
686
705
  fix?: boolean;
687
706
  verbose?: boolean;
688
707
  }
689
- declare function packmanLint({ fix, verbose }?: PackmanLintParams): number;
708
+ declare function packmanLint({ fix, verbose }?: PackmanLintParams): Promise<number>;
690
709
 
691
710
  type Direction = 'pnpm-to-yarn' | 'yarn-to-pnpm';
692
711
  declare function rewriteScript(script: string, direction: Direction): string;
@@ -1101,4 +1120,4 @@ declare const xyParseOptions: () => Argv;
1101
1120
 
1102
1121
  declare const xyYarnCommands: (args: Argv) => Argv<{}>;
1103
1122
 
1104
- export { ALL_PUBLINT_CHECKS, type BuildParams, CROSS_PLATFORM_NEWLINE, type CleanPackageParams, type CleanParams, type CommandsConfig, type CompileConfig, type CompileParams, type ConvertParams, type CopyAssetsParams, type CycleEdge, type CycleParams, DEFAULT_README_BODY, DEFAULT_README_TEMPLATE, type DeclaredDep, type DepLintOptions, type DepType, type DeplintAppliedFix, type DeplintConfig, type DeplintDiagnostic, type DeplintFix, type DeplintPackageConfig, DeplintPackageEditor, type DeplintRefType, type DeplintReporter, type DeplintRule, type DeplintRunOptions, type DeplintRunResult, type DeplintSection, type DeplintSeverity, type DeplintSummary, type DeplintWorkspaceContext, type DeployLevel, DuplicateDetector, type DynamicShareConfig, type EntryMode, type GenDocsPackageParams, type GenDocsParams, INIT_CWD, LEGACY_COMMANDS_PREFIX, type LintInitParams, type LintNextParams, type LintPackageParams, type LintParams, type LintResult, type LiveShareConfig, type OrphanParams, PUBLISH_ONLY_CHECKS, type PackageCompileTscConfig, type PackageCompileTsupConfig, type PackageCopyAssetsParams, type PackageJsonEx, type PackageManager, type PackageManagerName, type PackagePublintParams, type PackmanCleanParams, type PackmanLintParams, type PathConfig, PnpmPackageManager, type PublintCheckName, type PublintConfig, type PublintPackageParams, type PublintParams, type ReadFileSyncOptions, type ReadmeConfig, type ReadmeGenParams, type ReadmeInitParams, type ReadmeLintParams, type RebuildParams, type RecompilePackageParams, type RecompileParams, type RegistryInfo, type RelintPackageParams, type RelintParams, type RepoInitParams, type ResolvedDep, type ResolvedPublintOptions, type RetestParams, type ScriptStep, type SelectedUpdate, type SettingsLevel, type TemplateFile, type TestParams, type UpdoOptions, type VersionChoice, WINDOWS_NEWLINE_REGEX, type Workspace, type WorkspaceForeachOptions, XYLABS_COMMANDS_PREFIX, XYLABS_RULES_PREFIX, XYLABS_SKILLS_PREFIX, type XyConfig, type XyConfigBase, type XyConfigLegacy, type XyTscConfig, type XyTsupConfig, YarnPackageManager, analyze, applyDeplintFixes, applyLogoConfig, applyPackageManager, applyUpdates, build, buildWorkspaceContext, checkInternalDepVersions, checkInternalPeerVersions, checkResult, checkVersionConsistency, checkWorkspaceProtocol, claudeCheck, claudeClean, claudeCommandTemplates, claudeCommands, claudeMdLocalTemplate, claudeMdProjectTemplate, claudeMdRuleTemplates, claudeRules, claudeSettings, claudeSkillTemplates, claudeSkills, clean, cleanAll, cleanDocs, cleanESLint, cleanPackage, collectWorkspaceDeps, compile, compileAll, compilePackage, convert, copyAssets, createBuildConfig, cycle, cycleAll, cyclePackage, dead, defaultBuildConfig, defaultReadFileSyncOptions, deleteGlob, deplint, deplintRules, deploy, deprecationMigrate, detectCurrentPM, detectDuplicateDependencies, detectPackageManager, detectReact, detectReactInMonorepo, detectWorkspaceCycles, dupdeps, eject, empty, fetchAllRegistryInfo, fetchRegistryInfo, fillTemplate, findWorkspacePackagePaths, fix, fixInternalDepVersions, fixInternalPeerVersions, fixVersionConsistency, fixWorkspaceProtocol, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, generateReadmeFiles, getDeplintReporter, getPackageManager, gitignore, gitignoreGen, gitignoreTemplate, gitlint, gitlintFix, humanDeplintReporter, installOutputCapture, interactiveSelect, isYarnVersionOrGreater, jsonDeplintReporter, knip, latestVersions, license, lint, lintAllPackages, lintInit, lintNext, lintPackage, lintlint, listRepoTemplates, loadConfig, loadPackageConfig, loadPublintOptions, loadRepoTemplateFiles, loadWorkspaceCommandConfig, logMonorepoVersion, multiLineToJSONArray, notEmpty, npmignoreGen, orphanClean, orphanList, outputStorage, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageCycle, packageGenDocs, packageLint, packageLintMonorepo, packageName, packagePublint, packageRecompile, packmanClean, packmanLint, parsedPackageJSON, printWorkspaceCycles, processEx, publint, publintAll, publintSingle, publish, test$1 as reactTest, readLines, readNonEmptyLines, readmeGen, readmeInit, readmeLint, rebuild, recompile, recompileAll, recompilePackage, registerPackageManager, reinstall, relint, relintAllPackages, relintPackage, renderTable, repoInit, resolveTemplatePath, resolveVersions, retest, rewriteScript, rewriteScriptsInPackageJson, runDeplint, runInstall, runStepAsync, runSteps, runStepsAsync, runUpdo, runWithConcurrency, runXy, runXyWithWarning, safeExit, safeExitAsync, scaffoldTemplate, sitemap, sonar, start, statics, syncInternalPeerVersions, test, tryReadFileSync, tryRunLocalScript, tsupOptions, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBase, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, xyReactCommands, xyYarnCommands, yarn3Only, yarnWorkspace, yarnWorkspaces };
1123
+ export { ALL_PUBLINT_CHECKS, type BuildParams, CROSS_PLATFORM_NEWLINE, type CleanPackageParams, type CleanParams, type CommandsConfig, type CompileConfig, type CompileParams, type ConvertParams, type CopyAssetsParams, type CycleEdge, type CycleParams, DEFAULT_README_BODY, DEFAULT_README_TEMPLATE, type DeclaredDep, type DepLintOptions, type DepType, type DeplintAppliedFix, type DeplintConfig, type DeplintDiagnostic, type DeplintFix, type DeplintPackageConfig, DeplintPackageEditor, type DeplintRefType, type DeplintReporter, type DeplintRule, type DeplintRunOptions, type DeplintRunResult, type DeplintSection, type DeplintSeverity, type DeplintSummary, type DeplintWorkspaceContext, type DeployLevel, DuplicateDetector, type DynamicShareConfig, type EntryMode, type GenDocsPackageParams, type GenDocsParams, INIT_CWD, LEGACY_COMMANDS_PREFIX, type LintInitParams, type LintNextParams, type LintPackageParams, type LintParams, type LintResult, type LiveShareConfig, type OrphanParams, PUBLISH_ONLY_CHECKS, type PackageCompileTscConfig, type PackageCompileTsupConfig, type PackageCopyAssetsParams, type PackageJsonEx, type PackageManager, type PackageManagerName, type PackagePublintParams, type PackmanCleanParams, type PackmanConfig, type PackmanLintParams, type PathConfig, PnpmPackageManager, type PublintCheckName, type PublintConfig, type PublintPackageParams, type PublintParams, type ReadFileSyncOptions, type ReadmeConfig, type ReadmeGenParams, type ReadmeInitParams, type ReadmeLintParams, type RebuildParams, type RecompilePackageParams, type RecompileParams, type RegistryInfo, type RelintPackageParams, type RelintParams, type RepoInitParams, type ResolvedDep, type ResolvedPublintOptions, type RetestParams, type ScriptStep, type SelectedUpdate, type SettingsLevel, type TemplateFile, type TestParams, type UpdoOptions, type VersionChoice, WINDOWS_NEWLINE_REGEX, type Workspace, type WorkspaceForeachOptions, XYLABS_COMMANDS_PREFIX, XYLABS_RULES_PREFIX, XYLABS_SKILLS_PREFIX, type XyConfig, type XyConfigBase, type XyConfigLegacy, type XyTscConfig, type XyTsupConfig, YarnPackageManager, analyze, applyDeplintFixes, applyLogoConfig, applyPackageManager, applyUpdates, build, buildWorkspaceContext, checkInternalDepVersions, checkInternalPeerVersions, checkResult, checkVersionConsistency, checkWorkspaceProtocol, claudeCheck, claudeClean, claudeCommandTemplates, claudeCommands, claudeMdLocalTemplate, claudeMdProjectTemplate, claudeMdRuleTemplates, claudeRules, claudeSettings, claudeSkillTemplates, claudeSkills, clean, cleanAll, cleanDocs, cleanESLint, cleanPackage, collectWorkspaceDeps, compile, compileAll, compilePackage, convert, copyAssets, createBuildConfig, cycle, cycleAll, cyclePackage, dead, defaultBuildConfig, defaultReadFileSyncOptions, deleteGlob, deplint, deplintRules, deploy, deprecationMigrate, detectCurrentPM, detectDuplicateDependencies, detectPackageManager, detectReact, detectReactInMonorepo, detectWorkspaceCycles, dupdeps, eject, empty, fetchAllRegistryInfo, fetchRegistryInfo, fillTemplate, findWorkspacePackagePaths, fix, fixInternalDepVersions, fixInternalPeerVersions, fixVersionConsistency, fixWorkspaceProtocol, genDocs, genDocsAll, genDocsPackage, generateIgnoreFiles, generateReadmeFiles, getDeplintReporter, getPackageManager, gitignore, gitignoreGen, gitignoreTemplate, gitlint, gitlintFix, humanDeplintReporter, installOutputCapture, interactiveSelect, isYarnVersionOrGreater, jsonDeplintReporter, knip, latestVersions, license, lint, lintAllPackages, lintInit, lintNext, lintPackage, lintlint, listRepoTemplates, loadConfig, loadPackageConfig, loadPublintOptions, loadRepoTemplateFiles, loadWorkspaceCommandConfig, logMonorepoVersion, multiLineToJSONArray, notEmpty, npmignoreGen, orphanClean, orphanList, outputStorage, packageClean, packageCleanOutputs, packageCleanTypescript, packageCompile, packageCompileTsc, packageCompileTsup, packageCopyAssets, packageCycle, packageGenDocs, packageLint, packageLintMonorepo, packageName, packagePublint, packageRecompile, packmanClean, packmanLint, parsedPackageJSON, printWorkspaceCycles, processEx, publint, publintAll, publintSingle, publish, test$1 as reactTest, readLines, readNonEmptyLines, readmeGen, readmeInit, readmeLint, rebuild, recompile, recompileAll, recompilePackage, registerPackageManager, reinstall, relint, relintAllPackages, relintPackage, renderTable, repoInit, resolveTemplatePath, resolveVersions, retest, rewriteScript, rewriteScriptsInPackageJson, runDeplint, runInstall, runStepAsync, runSteps, runStepsAsync, runUpdo, runWithConcurrency, runXy, runXyWithWarning, safeExit, safeExitAsync, scaffoldTemplate, sitemap, sonar, start, statics, syncInternalPeerVersions, test, tryReadFileSync, tryRunLocalScript, tsupOptions, union, up, updateYarnPlugins, updateYarnVersion, updo, withErrnoException, withError, writeLines, xy, xyBase, xyBuildCommands, xyCommonCommands, xyDeployCommands, xyInstallCommands, xyLintCommands, xyParseOptions, xyReactCommands, xyYarnCommands, yarn3Only, yarnWorkspace, yarnWorkspaces };
package/dist/index.mjs CHANGED
@@ -700,6 +700,7 @@ function printWorkspaceCycles(cycles) {
700
700
  }
701
701
 
702
702
  // src/lib/deprecationMigrate.ts
703
+ import { spawnSync as spawnSync5 } from "child_process";
703
704
  import {
704
705
  existsSync as existsSync2,
705
706
  readFileSync as readFileSync5,
@@ -708,6 +709,12 @@ import {
708
709
  import PATH4 from "path";
709
710
  import { createInterface } from "readline";
710
711
  import chalk5 from "chalk";
712
+ var DEPRECATED_PACKAGES = [
713
+ "@xylabs/ts-scripts-common",
714
+ "@xylabs/ts-scripts-yarn3",
715
+ "@xylabs/ts-scripts-pnpm",
716
+ "@xylabs/ts-scripts-react-yarn3"
717
+ ];
711
718
  function findProjectRoot() {
712
719
  return process.env.INIT_CWD ?? process.cwd();
713
720
  }
@@ -720,56 +727,64 @@ function askYesNo(question) {
720
727
  });
721
728
  });
722
729
  }
723
- function replaceInFile(filePath, oldStr, newStr) {
730
+ function replaceAllOldPackagesInFile(filePath) {
724
731
  if (!existsSync2(filePath)) return false;
725
- const content = readFileSync5(filePath, "utf8");
726
- if (!content.includes(oldStr)) return false;
727
- writeFileSync(filePath, content.replaceAll(oldStr, newStr), "utf8");
728
- return true;
729
- }
730
- function migrateRootPackageJson(pkg, pkgPath, oldPackage, depField) {
731
- const version = pkg[depField][oldPackage];
732
- delete pkg[depField][oldPackage];
733
- pkg[depField]["@xylabs/toolchain"] = version;
734
- writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
735
- `, "utf8");
736
- console.warn(chalk5.green(` \u2713 Replaced ${oldPackage} \u2192 @xylabs/toolchain in ${depField}`));
732
+ let content = readFileSync5(filePath, "utf8");
733
+ let changed = false;
734
+ for (const oldPkg of DEPRECATED_PACKAGES) {
735
+ if (content.includes(oldPkg)) {
736
+ content = content.replaceAll(oldPkg, "@xylabs/toolchain");
737
+ changed = true;
738
+ }
739
+ }
740
+ if (changed) {
741
+ writeFileSync(filePath, content, "utf8");
742
+ }
743
+ return changed;
737
744
  }
738
- function migrateWorkspacePackageJson(wsPkgPath, dir, oldPackage) {
739
- if (!existsSync2(wsPkgPath)) return;
740
- const wsPkg = JSON.parse(readFileSync5(wsPkgPath, "utf8"));
745
+ function migratePackageJson(pkgPath, label) {
746
+ if (!existsSync2(pkgPath)) return false;
747
+ const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
741
748
  let changed = false;
742
749
  for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
743
- if (wsPkg[field]?.[oldPackage]) {
744
- const ver = wsPkg[field][oldPackage];
745
- delete wsPkg[field][oldPackage];
746
- wsPkg[field]["@xylabs/toolchain"] = ver;
747
- changed = true;
750
+ for (const oldPkg of DEPRECATED_PACKAGES) {
751
+ if (pkg[field]?.[oldPkg]) {
752
+ const ver = pkg[field][oldPkg];
753
+ delete pkg[field][oldPkg];
754
+ if (!pkg[field]["@xylabs/toolchain"]) {
755
+ pkg[field]["@xylabs/toolchain"] = ver;
756
+ }
757
+ changed = true;
758
+ }
748
759
  }
749
760
  }
750
761
  if (changed) {
751
- writeFileSync(wsPkgPath, `${JSON.stringify(wsPkg, null, 2)}
762
+ writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}
752
763
  `, "utf8");
753
- console.warn(chalk5.green(` \u2713 Updated ${dir}/package.json`));
764
+ console.warn(chalk5.green(` \u2713 Updated ${label}`));
754
765
  }
766
+ return changed;
755
767
  }
756
- async function migrateWorkspaces(root, workspacesGlob, oldPackage) {
757
- if (!Array.isArray(workspacesGlob)) return;
768
+ async function migrateWorkspaces(root) {
758
769
  const { globSync: globSync5 } = await import("glob");
759
- for (const pattern of workspacesGlob) {
760
- const dirs = globSync5(pattern, { cwd: root });
761
- for (const dir of dirs) {
762
- if (replaceInFile(PATH4.join(root, dir, "xy.config.ts"), oldPackage, "@xylabs/toolchain")) {
763
- console.warn(chalk5.green(` \u2713 Updated ${dir}/xy.config.ts imports`));
764
- }
765
- migrateWorkspacePackageJson(PATH4.join(root, dir, "package.json"), dir, oldPackage);
770
+ const packageJsonFiles = globSync5("**/package.json", {
771
+ cwd: root,
772
+ ignore: ["node_modules/**", "**/node_modules/**", "dist/**", "**/dist/**"]
773
+ });
774
+ for (const relPath of packageJsonFiles) {
775
+ if (relPath === "package.json") continue;
776
+ const dir = PATH4.dirname(relPath);
777
+ migratePackageJson(PATH4.join(root, relPath), relPath);
778
+ const xyConfigPath = PATH4.join(root, dir, "xy.config.ts");
779
+ if (replaceAllOldPackagesInFile(xyConfigPath)) {
780
+ console.warn(chalk5.green(` \u2713 Updated ${dir}/xy.config.ts`));
766
781
  }
767
782
  }
768
783
  }
769
- function printManualInstructions(oldPackage) {
784
+ function printManualInstructions() {
770
785
  console.warn(chalk5.gray(" Skipped. To migrate manually:\n"));
771
- console.warn(chalk5.gray(` 1. Replace "${oldPackage}" with "@xylabs/toolchain" in package.json`));
772
- console.warn(chalk5.gray(" 2. Update xy.config.ts imports"));
786
+ console.warn(chalk5.gray(" 1. Replace all @xylabs/ts-scripts-* deps with @xylabs/toolchain in package.json"));
787
+ console.warn(chalk5.gray(" 2. Update imports in xy.config.ts files"));
773
788
  console.warn(chalk5.gray(" 3. Run your package manager install\n"));
774
789
  }
775
790
  async function deprecationMigrate(oldPackage) {
@@ -777,22 +792,33 @@ async function deprecationMigrate(oldPackage) {
777
792
  const pkgPath = PATH4.join(root, "package.json");
778
793
  if (!existsSync2(pkgPath)) return;
779
794
  const pkg = JSON.parse(readFileSync5(pkgPath, "utf8"));
780
- const depField = pkg.dependencies?.[oldPackage] ? "dependencies" : pkg.devDependencies?.[oldPackage] ? "devDependencies" : void 0;
781
- if (!depField) return;
795
+ const hasOldDep = DEPRECATED_PACKAGES.some((dep) => pkg.dependencies?.[dep] || pkg.devDependencies?.[dep]);
796
+ if (!hasOldDep) return;
782
797
  console.warn(chalk5.yellow(`
783
798
  \u26A0 ${oldPackage} is deprecated. Use @xylabs/toolchain instead.
784
799
  `));
785
800
  const shouldMigrate = await askYesNo(chalk5.cyan(" Auto-migrate to @xylabs/toolchain? [y/N] "));
786
801
  if (!shouldMigrate) {
787
- printManualInstructions(oldPackage);
802
+ printManualInstructions();
788
803
  return;
789
804
  }
790
- migrateRootPackageJson(pkg, pkgPath, oldPackage, depField);
791
- if (replaceInFile(PATH4.join(root, "xy.config.ts"), oldPackage, "@xylabs/toolchain")) {
792
- console.warn(chalk5.green(" \u2713 Updated xy.config.ts imports"));
805
+ migratePackageJson(pkgPath, "package.json");
806
+ if (replaceAllOldPackagesInFile(PATH4.join(root, "xy.config.ts"))) {
807
+ console.warn(chalk5.green(" \u2713 Updated xy.config.ts"));
808
+ }
809
+ await migrateWorkspaces(root);
810
+ const pm = detectPackageManager();
811
+ console.warn(chalk5.cyan(`
812
+ Running ${pm} install...
813
+ `));
814
+ const result = spawnSync5(pm, ["install"], { cwd: root, stdio: "inherit" });
815
+ if (result.status === 0) {
816
+ console.warn(chalk5.green(" \u2713 Migration complete. Re-run your command.\n"));
817
+ } else {
818
+ console.warn(chalk5.red(` Install failed (exit ${result.status}). Run "${pm} install" manually.
819
+ `));
793
820
  }
794
- await migrateWorkspaces(root, pkg.workspaces, oldPackage);
795
- console.warn(chalk5.yellow("\n Run your package manager install to complete the migration.\n"));
821
+ process.exit(result.status ?? 1);
796
822
  }
797
823
 
798
824
  // src/lib/file/constants.ts
@@ -1260,12 +1286,12 @@ function listRepoTemplates() {
1260
1286
  }
1261
1287
 
1262
1288
  // src/lib/runInstall.ts
1263
- import { spawnSync as spawnSync5 } from "child_process";
1289
+ import { spawnSync as spawnSync6 } from "child_process";
1264
1290
  import chalk9 from "chalk";
1265
1291
  function runInstall(cwd6) {
1266
1292
  const pm = detectPackageManager();
1267
1293
  console.log(chalk9.gray(`Running ${pm} install...`));
1268
- const result = spawnSync5(pm, ["install"], {
1294
+ const result = spawnSync6(pm, ["install"], {
1269
1295
  cwd: cwd6,
1270
1296
  stdio: "inherit"
1271
1297
  });
@@ -1278,7 +1304,7 @@ function runInstall(cwd6) {
1278
1304
  }
1279
1305
 
1280
1306
  // src/lib/runSteps.ts
1281
- import { spawnSync as spawnSync6 } from "child_process";
1307
+ import { spawnSync as spawnSync7 } from "child_process";
1282
1308
  import { existsSync as existsSync5 } from "fs";
1283
1309
  import chalk10 from "chalk";
1284
1310
  var runSteps = (name, steps, exitOnFail = true, messages) => {
@@ -1294,7 +1320,7 @@ var runSteps = (name, steps, exitOnFail = true, messages) => {
1294
1320
  if (command === "node" && !existsSync5(argList[0])) {
1295
1321
  throw new Error(`File not found [${argList[0]}]`);
1296
1322
  }
1297
- const status = spawnSync6(command, Array.isArray(args) ? args : args.split(" "), {
1323
+ const status = spawnSync7(command, Array.isArray(args) ? args : args.split(" "), {
1298
1324
  ...config2,
1299
1325
  encoding: "utf8",
1300
1326
  env: { FORCE_COLOR: "3", ...process.env },
@@ -1377,7 +1403,7 @@ var runXyWithWarning = (command) => {
1377
1403
  };
1378
1404
 
1379
1405
  // src/lib/tryRunLocalScript.ts
1380
- import { spawnSync as spawnSync7 } from "child_process";
1406
+ import { spawnSync as spawnSync8 } from "child_process";
1381
1407
  import { readFileSync as readFileSync13 } from "fs";
1382
1408
  import PATH8 from "path";
1383
1409
  import chalk13 from "chalk";
@@ -1394,7 +1420,7 @@ function tryRunLocalScript(commandName) {
1394
1420
  const extraArgs = process.argv.slice(process.argv.indexOf(commandName) + 1);
1395
1421
  console.log(chalk13.blue(`Delegating "${commandName}" to local script`));
1396
1422
  const pm = getPackageManager();
1397
- const result = spawnSync7(pm.command, ["run", commandName, ...extraArgs], {
1423
+ const result = spawnSync8(pm.command, ["run", commandName, ...extraArgs], {
1398
1424
  cwd: process.cwd(),
1399
1425
  encoding: "utf8",
1400
1426
  env: {
@@ -2163,7 +2189,7 @@ var claudeCommands = () => {
2163
2189
  };
2164
2190
 
2165
2191
  // src/actions/claude-rules.ts
2166
- import { spawnSync as spawnSync8 } from "child_process";
2192
+ import { spawnSync as spawnSync9 } from "child_process";
2167
2193
  import {
2168
2194
  existsSync as existsSync10,
2169
2195
  mkdirSync as mkdirSync2,
@@ -2231,7 +2257,7 @@ var ensureProjectClaudeMd = (cwd6, force) => {
2231
2257
  console.log(chalk21.yellow("Regenerating CLAUDE.md"));
2232
2258
  }
2233
2259
  console.log(chalk21.green("Generating CLAUDE.md via claude /init..."));
2234
- const result = spawnSync8("claude", ["-p", "/init", "--allowedTools", "Read", "Write", "Glob", "Grep"], {
2260
+ const result = spawnSync9("claude", ["-p", "/init", "--allowedTools", "Read", "Write", "Glob", "Grep"], {
2235
2261
  cwd: cwd6,
2236
2262
  shell: true,
2237
2263
  stdio: "inherit"
@@ -5415,7 +5441,7 @@ async function lintInit({ verbose } = {}) {
5415
5441
  }
5416
5442
 
5417
5443
  // src/actions/lintlint.ts
5418
- import { spawnSync as spawnSync9 } from "child_process";
5444
+ import { spawnSync as spawnSync10 } from "child_process";
5419
5445
  import {
5420
5446
  existsSync as existsSync14,
5421
5447
  readFileSync as readFileSync23,
@@ -5620,7 +5646,7 @@ Fixed: removed ${redundant.length} redundant rule(s)`));
5620
5646
  }
5621
5647
  }
5622
5648
  function formatConfigFile(eslintConfigPath) {
5623
- spawnSync9("eslint", ["--fix", eslintConfigPath], { stdio: "inherit" });
5649
+ spawnSync10("eslint", ["--fix", eslintConfigPath], { stdio: "inherit" });
5624
5650
  }
5625
5651
  function fixConfigMismatch(eslintConfigPath, configDir, source, sharedPkg, expectedPkg) {
5626
5652
  const updated = source.replaceAll(sharedPkg, expectedPkg);
@@ -7222,7 +7248,7 @@ function packageLintMonorepo(fix2 = false) {
7222
7248
  fix: () => fixInternalDepVersions(cwd6, workspaces),
7223
7249
  label: "Internal deps/devDeps use correct version ranges"
7224
7250
  };
7225
- const checks2 = [
7251
+ const checks = [
7226
7252
  {
7227
7253
  check: () => checkRootPrivate(pkg),
7228
7254
  fix: fixRootPrivate,
@@ -7274,7 +7300,7 @@ function packageLintMonorepo(fix2 = false) {
7274
7300
  label: "Internal peerDeps use semver ranges (not workspace: protocol)"
7275
7301
  }
7276
7302
  ];
7277
- const { errors, fixed } = runChecks(checks2, cwd6, pkg, fix2);
7303
+ const { errors, fixed } = runChecks(checks, cwd6, pkg, fix2);
7278
7304
  logSummary(errors, fixed);
7279
7305
  if (fix2 && fixed > 0) {
7280
7306
  runInstall();
@@ -7302,7 +7328,7 @@ import PATH24 from "path";
7302
7328
  import chalk65 from "chalk";
7303
7329
 
7304
7330
  // src/actions/packman/convertToPnpm.ts
7305
- import { spawnSync as spawnSync10 } from "child_process";
7331
+ import { spawnSync as spawnSync11 } from "child_process";
7306
7332
  import {
7307
7333
  existsSync as existsSync19,
7308
7334
  mkdirSync as mkdirSync5,
@@ -7579,7 +7605,7 @@ function convertToPnpm(cwd6, workspacePackageJsonPaths) {
7579
7605
  rewriteSourceImports(cwd6, "yarn-to-pnpm");
7580
7606
  deleteYarnArtifacts(cwd6);
7581
7607
  console.log(chalk63.blue("\nRunning pnpm install..."));
7582
- const install = spawnSync10("pnpm", ["install"], {
7608
+ const install = spawnSync11("pnpm", ["install"], {
7583
7609
  cwd: cwd6,
7584
7610
  encoding: "utf8",
7585
7611
  shell: true,
@@ -7594,7 +7620,7 @@ function convertToPnpm(cwd6, workspacePackageJsonPaths) {
7594
7620
  }
7595
7621
 
7596
7622
  // src/actions/packman/convertToYarn.ts
7597
- import { spawnSync as spawnSync11 } from "child_process";
7623
+ import { spawnSync as spawnSync12 } from "child_process";
7598
7624
  import {
7599
7625
  existsSync as existsSync20,
7600
7626
  readFileSync as readFileSync28,
@@ -7722,7 +7748,7 @@ function convertToYarn(cwd6, workspacePackageJsonPaths) {
7722
7748
  rewriteSourceImports(cwd6, "pnpm-to-yarn");
7723
7749
  deletePnpmArtifacts(cwd6);
7724
7750
  console.log(chalk64.blue("\nRunning yarn install..."));
7725
- const install = spawnSync11("yarn", ["install"], {
7751
+ const install = spawnSync12("yarn", ["install"], {
7726
7752
  cwd: cwd6,
7727
7753
  encoding: "utf8",
7728
7754
  shell: true,
@@ -7897,6 +7923,41 @@ import {
7897
7923
  } from "fs";
7898
7924
  import PATH26 from "path";
7899
7925
  import chalk67 from "chalk";
7926
+ var DEFAULT_MINIMUM_RELEASE_AGE = 4320;
7927
+ var DEFAULT_RELEASE_AGE_EXCLUDES = ["'@xylabs/*'", "'@xyo-network/*'"];
7928
+ function resolvePackmanConfig(cfg) {
7929
+ return {
7930
+ minimumReleaseAge: cfg?.minimumReleaseAge ?? DEFAULT_MINIMUM_RELEASE_AGE,
7931
+ minimumReleaseAgeExclude: cfg?.minimumReleaseAgeExclude ?? DEFAULT_RELEASE_AGE_EXCLUDES
7932
+ };
7933
+ }
7934
+ function readPnpmWorkspaceYaml(cwd6) {
7935
+ const wsPath = PATH26.join(cwd6, "pnpm-workspace.yaml");
7936
+ if (!existsSync23(wsPath)) return void 0;
7937
+ return readFileSync30(wsPath, "utf8");
7938
+ }
7939
+ function writePnpmWorkspaceYaml(cwd6, content) {
7940
+ writeFileSync17(PATH26.join(cwd6, "pnpm-workspace.yaml"), content, "utf8");
7941
+ }
7942
+ function parseYamlListSection(content, sectionName) {
7943
+ const items = [];
7944
+ let inSection = false;
7945
+ for (const line of content.split("\n")) {
7946
+ if (new RegExp(String.raw`^${sectionName}\s*:`).test(line)) {
7947
+ inSection = true;
7948
+ continue;
7949
+ }
7950
+ if (inSection) {
7951
+ const match = /^\s+-\s+(.+)$/.exec(line);
7952
+ if (match) {
7953
+ items.push(match[1].trim());
7954
+ } else if (line.trim() && !/^\s/.test(line)) {
7955
+ break;
7956
+ }
7957
+ }
7958
+ }
7959
+ return items;
7960
+ }
7900
7961
  function checkEnableScripts(cwd6, verbose, silent) {
7901
7962
  const yarnrcPath = PATH26.join(cwd6, ".yarnrc.yml");
7902
7963
  if (!existsSync23(yarnrcPath)) {
@@ -7904,8 +7965,7 @@ function checkEnableScripts(cwd6, verbose, silent) {
7904
7965
  return true;
7905
7966
  }
7906
7967
  const content = readFileSync30(yarnrcPath, "utf8");
7907
- const lines = content.split("\n");
7908
- for (const line of lines) {
7968
+ for (const line of content.split("\n")) {
7909
7969
  const trimmed = line.trim();
7910
7970
  if (/^enableScripts\s*:/.test(trimmed)) {
7911
7971
  const value = trimmed.replace(/^enableScripts\s*:\s*/, "").trim();
@@ -7920,12 +7980,9 @@ function checkEnableScripts(cwd6, verbose, silent) {
7920
7980
  if (!silent) console.log(chalk67.red(" enableScripts is not set in .yarnrc.yml (expected false)"));
7921
7981
  return false;
7922
7982
  }
7923
- function fixEnableScripts(cwd6, verbose) {
7983
+ function fixEnableScripts(cwd6) {
7924
7984
  const yarnrcPath = PATH26.join(cwd6, ".yarnrc.yml");
7925
- if (!existsSync23(yarnrcPath)) {
7926
- if (verbose) console.log(chalk67.gray(" No .yarnrc.yml found, skipping enableScripts fix"));
7927
- return true;
7928
- }
7985
+ if (!existsSync23(yarnrcPath)) return true;
7929
7986
  const content = readFileSync30(yarnrcPath, "utf8");
7930
7987
  const lines = content.split("\n");
7931
7988
  let found = false;
@@ -7959,28 +8016,129 @@ function fixEnableScripts(cwd6, verbose) {
7959
8016
  console.log(chalk67.green(" Fixed: enableScripts set to false"));
7960
8017
  return true;
7961
8018
  }
7962
- var checks = [
7963
- {
7964
- name: "enableScripts should be false in .yarnrc.yml",
7965
- check: checkEnableScripts,
7966
- fix: fixEnableScripts
8019
+ function checkMinimumReleaseAge(cwd6, config2, verbose, silent) {
8020
+ if (detectPackageManager() !== "pnpm") return true;
8021
+ const content = readPnpmWorkspaceYaml(cwd6);
8022
+ if (!content) {
8023
+ if (!silent) console.log(chalk67.red(" No pnpm-workspace.yaml found"));
8024
+ return false;
7967
8025
  }
7968
- ];
7969
- function packmanLint({ fix: fix2, verbose } = {}) {
8026
+ const { minimumReleaseAge } = config2;
8027
+ for (const line of content.split("\n")) {
8028
+ const match = /^minimumReleaseAge\s*:\s*(\d+)/.exec(line.trim());
8029
+ if (match) {
8030
+ const value = Number.parseInt(match[1], 10);
8031
+ if (value >= minimumReleaseAge) {
8032
+ if (verbose) console.log(chalk67.green(` minimumReleaseAge is ${value} (>= ${minimumReleaseAge})`));
8033
+ return true;
8034
+ }
8035
+ if (!silent) console.log(chalk67.red(` minimumReleaseAge is ${value} (expected >= ${minimumReleaseAge})`));
8036
+ return false;
8037
+ }
8038
+ }
8039
+ if (!silent) console.log(chalk67.red(` minimumReleaseAge is not set in pnpm-workspace.yaml (expected >= ${minimumReleaseAge})`));
8040
+ return false;
8041
+ }
8042
+ function fixMinimumReleaseAge(cwd6, config2) {
8043
+ if (detectPackageManager() !== "pnpm") return true;
8044
+ const content = readPnpmWorkspaceYaml(cwd6);
8045
+ if (!content) return false;
8046
+ const { minimumReleaseAge } = config2;
8047
+ const lines = content.split("\n");
8048
+ let found = false;
8049
+ const newLines = lines.map((line) => {
8050
+ if (/^minimumReleaseAge\s*:/.test(line)) {
8051
+ found = true;
8052
+ return `minimumReleaseAge: ${minimumReleaseAge}`;
8053
+ }
8054
+ return line;
8055
+ });
8056
+ if (!found) {
8057
+ const lastLine = newLines.at(-1);
8058
+ if (lastLine === "") {
8059
+ newLines.splice(-1, 0, `minimumReleaseAge: ${minimumReleaseAge}`);
8060
+ } else {
8061
+ newLines.push(`minimumReleaseAge: ${minimumReleaseAge}`);
8062
+ }
8063
+ }
8064
+ writePnpmWorkspaceYaml(cwd6, newLines.join("\n"));
8065
+ console.log(chalk67.green(` Fixed: minimumReleaseAge set to ${minimumReleaseAge}`));
8066
+ return true;
8067
+ }
8068
+ function checkMinimumReleaseAgeExclude(cwd6, config2, verbose, silent) {
8069
+ if (detectPackageManager() !== "pnpm") return true;
8070
+ const content = readPnpmWorkspaceYaml(cwd6);
8071
+ if (!content) {
8072
+ if (!silent) console.log(chalk67.red(" No pnpm-workspace.yaml found"));
8073
+ return false;
8074
+ }
8075
+ const excludes = parseYamlListSection(content, "minimumReleaseAgeExclude");
8076
+ const missing = config2.minimumReleaseAgeExclude.filter((scope) => !excludes.includes(scope));
8077
+ if (missing.length === 0) {
8078
+ if (verbose) console.log(chalk67.green(" minimumReleaseAgeExclude includes all required scopes"));
8079
+ return true;
8080
+ }
8081
+ if (!silent) console.log(chalk67.red(` minimumReleaseAgeExclude is missing: ${missing.join(", ")}`));
8082
+ return false;
8083
+ }
8084
+ function fixMinimumReleaseAgeExclude(cwd6, config2) {
8085
+ if (detectPackageManager() !== "pnpm") return true;
8086
+ const content = readPnpmWorkspaceYaml(cwd6);
8087
+ if (!content) return false;
8088
+ const existingExcludes = parseYamlListSection(content, "minimumReleaseAgeExclude");
8089
+ const toAdd = config2.minimumReleaseAgeExclude.filter((scope) => !existingExcludes.includes(scope));
8090
+ if (toAdd.length === 0) return true;
8091
+ const lines = content.split("\n");
8092
+ const sectionIndex = lines.findIndex((line) => /^minimumReleaseAgeExclude\s*:/.test(line));
8093
+ if (sectionIndex === -1) {
8094
+ const newSection = ["minimumReleaseAgeExclude:", ...config2.minimumReleaseAgeExclude.map((s) => ` - ${s}`)];
8095
+ const lastLine = lines.at(-1);
8096
+ if (lastLine === "") {
8097
+ lines.splice(-1, 0, ...newSection);
8098
+ } else {
8099
+ lines.push(...newSection);
8100
+ }
8101
+ } else {
8102
+ let insertAt = sectionIndex + 1;
8103
+ while (insertAt < lines.length && /^\s+-/.test(lines[insertAt])) {
8104
+ insertAt++;
8105
+ }
8106
+ for (const scope of toAdd) {
8107
+ lines.splice(insertAt, 0, ` - ${scope}`);
8108
+ insertAt++;
8109
+ }
8110
+ }
8111
+ writePnpmWorkspaceYaml(cwd6, lines.join("\n"));
8112
+ console.log(chalk67.green(` Fixed: added ${toAdd.join(", ")} to minimumReleaseAgeExclude`));
8113
+ return true;
8114
+ }
8115
+ async function packmanLint({ fix: fix2, verbose } = {}) {
7970
8116
  const cwd6 = process.cwd();
8117
+ const rootConfig = await loadConfig();
8118
+ const packmanConfig = resolvePackmanConfig(rootConfig.commands ? rootConfig.commands.packman : void 0);
7971
8119
  let failures = 0;
7972
- for (const check of checks) {
7973
- if (verbose) console.log(chalk67.gray(`Checking: ${check.name}`));
7974
- const passed = check.check(cwd6, verbose, fix2);
7975
- if (!passed) {
7976
- if (fix2) {
7977
- const fixed = check.fix(cwd6, verbose);
7978
- if (!fixed) {
7979
- failures++;
7980
- }
7981
- } else {
7982
- failures++;
7983
- }
8120
+ const enableScriptsPassed = checkEnableScripts(cwd6, verbose, fix2);
8121
+ if (!enableScriptsPassed) {
8122
+ if (fix2) {
8123
+ if (!fixEnableScripts(cwd6)) failures++;
8124
+ } else {
8125
+ failures++;
8126
+ }
8127
+ }
8128
+ const agePassed = checkMinimumReleaseAge(cwd6, packmanConfig, verbose, fix2);
8129
+ if (!agePassed) {
8130
+ if (fix2) {
8131
+ if (!fixMinimumReleaseAge(cwd6, packmanConfig)) failures++;
8132
+ } else {
8133
+ failures++;
8134
+ }
8135
+ }
8136
+ const excludePassed = checkMinimumReleaseAgeExclude(cwd6, packmanConfig, verbose, fix2);
8137
+ if (!excludePassed) {
8138
+ if (fix2) {
8139
+ if (!fixMinimumReleaseAgeExclude(cwd6, packmanConfig)) failures++;
8140
+ } else {
8141
+ failures++;
7984
8142
  }
7985
8143
  }
7986
8144
  if (failures > 0) {
@@ -8264,14 +8422,14 @@ function lintPackages(cwd6) {
8264
8422
  function readmeLint({ config: config2, verbose }) {
8265
8423
  const cwd6 = INIT_CWD();
8266
8424
  console.log(chalk69.green("Readme Lint"));
8267
- const checks2 = [
8425
+ const checks = [
8268
8426
  lintTemplate(cwd6),
8269
8427
  lintLogoConfig(cwd6, config2),
8270
8428
  lintPackages(cwd6)
8271
8429
  ];
8272
8430
  let errorCount = 0;
8273
8431
  let warningCount = 0;
8274
- for (const { errors, warnings } of checks2) {
8432
+ for (const { errors, warnings } of checks) {
8275
8433
  for (const error of errors) {
8276
8434
  console.log(chalk69.red(` \u2717 ${error}`));
8277
8435
  errorCount++;
@@ -8392,7 +8550,7 @@ var relintAllPackages = ({ fix: fix2 = false } = {}) => {
8392
8550
  };
8393
8551
 
8394
8552
  // src/actions/repo-init.ts
8395
- import { spawnSync as spawnSync12 } from "child_process";
8553
+ import { spawnSync as spawnSync13 } from "child_process";
8396
8554
  import {
8397
8555
  existsSync as existsSync25,
8398
8556
  mkdirSync as mkdirSync6,
@@ -8495,7 +8653,7 @@ function scaffoldFiles(templateName, layer, outputDir, pm, variables, verbose) {
8495
8653
  }
8496
8654
  function initGitRepo(projectDir, verbose) {
8497
8655
  if (verbose) console.log(chalk70.gray("Initializing git repository..."));
8498
- const result = spawnSync12("git", ["init", "-b", "main"], {
8656
+ const result = spawnSync13("git", ["init", "-b", "main"], {
8499
8657
  cwd: projectDir,
8500
8658
  stdio: verbose ? "inherit" : "pipe"
8501
8659
  });
@@ -8507,7 +8665,7 @@ function initGitRepo(projectDir, verbose) {
8507
8665
  }
8508
8666
  function installDependencies(projectDir, pm) {
8509
8667
  console.log(chalk70.gray(`Running ${pm} install...`));
8510
- const result = spawnSync12(pm, ["install"], {
8668
+ const result = spawnSync13(pm, ["install"], {
8511
8669
  cwd: projectDir,
8512
8670
  stdio: "inherit"
8513
8671
  });
@@ -9104,8 +9262,8 @@ var lintCommand = {
9104
9262
  type: "boolean"
9105
9263
  });
9106
9264
  },
9107
- handler: (argv) => {
9108
- process.exitCode = packmanLint({
9265
+ handler: async (argv) => {
9266
+ process.exitCode = await packmanLint({
9109
9267
  fix: !!argv.fix,
9110
9268
  verbose: !!argv.verbose
9111
9269
  });