@ariestools/toolchain 9.2.1 → 10.0.1

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 (42) hide show
  1. package/dist/actions/cleanRuleCatalog.d.ts +2 -10
  2. package/dist/actions/cleanRuleCatalog.d.ts.map +1 -1
  3. package/dist/actions/dead/dead.d.ts.map +1 -1
  4. package/dist/actions/dead/evaluateRules.d.ts +1 -0
  5. package/dist/actions/dead/evaluateRules.d.ts.map +1 -1
  6. package/dist/actions/dead/ruleChecks.d.ts +32 -0
  7. package/dist/actions/dead/ruleChecks.d.ts.map +1 -0
  8. package/dist/actions/dead/runDeadAnalysis.d.ts +4 -3
  9. package/dist/actions/dead/runDeadAnalysis.d.ts.map +1 -1
  10. package/dist/actions/package/cleanRules.d.ts +4 -0
  11. package/dist/actions/package/cleanRules.d.ts.map +1 -1
  12. package/dist/actions/ruleCatalog.d.ts +1 -1
  13. package/dist/actions/ruleCatalog.d.ts.map +1 -1
  14. package/dist/actions/ruleCatalogRender.d.ts +12 -0
  15. package/dist/actions/ruleCatalogRender.d.ts.map +1 -1
  16. package/dist/actions/ruleRunner.d.ts +15 -1
  17. package/dist/actions/ruleRunner.d.ts.map +1 -1
  18. package/dist/bin/package/build.mjs +0 -4
  19. package/dist/bin/package/build.mjs.map +1 -1
  20. package/dist/bin/package/clean.mjs +34 -29
  21. package/dist/bin/package/clean.mjs.map +1 -1
  22. package/dist/bin/package/publint.mjs +0 -4
  23. package/dist/bin/package/publint.mjs.map +1 -1
  24. package/dist/bin/package/recompile.mjs +34 -29
  25. package/dist/bin/package/recompile.mjs.map +1 -1
  26. package/dist/bin/xy.mjs +290 -351
  27. package/dist/bin/xy.mjs.map +1 -1
  28. package/dist/bin/xyex.mjs +290 -351
  29. package/dist/bin/xyex.mjs.map +1 -1
  30. package/dist/lib/ruleCommandRegistry.d.ts +0 -4
  31. package/dist/lib/ruleCommandRegistry.d.ts.map +1 -1
  32. package/dist/xy/common/gitlintCommand.d.ts +0 -1
  33. package/dist/xy/common/gitlintCommand.d.ts.map +1 -1
  34. package/dist/xy/common/index.d.ts.map +1 -1
  35. package/dist/xy/lint/index.d.ts.map +1 -1
  36. package/dist/xy/lint/lintlintCommand.d.ts +0 -1
  37. package/dist/xy/lint/lintlintCommand.d.ts.map +1 -1
  38. package/dist/xy/lint/nodeLintCommand.d.ts +0 -1
  39. package/dist/xy/lint/nodeLintCommand.d.ts.map +1 -1
  40. package/dist/xy/stability.d.ts +0 -4
  41. package/dist/xy/stability.d.ts.map +1 -1
  42. package/package.json +4 -4
@@ -8941,7 +8941,6 @@ const RULE_COMMANDS = {
8941
8941
  title: "Fix Rules"
8942
8942
  },
8943
8943
  gitLint: {
8944
- aliases: ["gitlint"],
8945
8944
  command: "git lint",
8946
8945
  configKey: "gitLint",
8947
8946
  includeInRoot: true,
@@ -8954,14 +8953,12 @@ const RULE_COMMANDS = {
8954
8953
  title: "Lint Rules"
8955
8954
  },
8956
8955
  lintLint: {
8957
- aliases: ["lintlint"],
8958
8956
  command: "lint lint",
8959
8957
  configKey: "lintLint",
8960
8958
  includeInRoot: true,
8961
8959
  title: "Lint Lint Rules"
8962
8960
  },
8963
8961
  nodeLint: {
8964
- aliases: ["node-lint"],
8965
8962
  command: "node lint",
8966
8963
  configKey: "nodeLint",
8967
8964
  includeInRoot: true,
@@ -8980,7 +8977,6 @@ const RULE_COMMANDS = {
8980
8977
  title: "Plan Lint Rules"
8981
8978
  },
8982
8979
  publint: {
8983
- aliases: ["republint"],
8984
8980
  command: "publint",
8985
8981
  configKey: "publint",
8986
8982
  includeInRoot: true,
@@ -10856,7 +10852,7 @@ function resolveSafeCleanPatterns(patterns, baseDir, rootDir) {
10856
10852
  return resolvedPatterns;
10857
10853
  }
10858
10854
  //#endregion
10859
- //#region src/actions/package/cleanRules.ts
10855
+ //#region src/actions/ruleRunner.ts
10860
10856
  const RULE_LEVELS = /* @__PURE__ */ new Set([
10861
10857
  "error",
10862
10858
  "off",
@@ -10865,29 +10861,34 @@ const RULE_LEVELS = /* @__PURE__ */ new Set([
10865
10861
  function isRuleLevel(value) {
10866
10862
  return typeof value === "string" && RULE_LEVELS.has(value);
10867
10863
  }
10868
- function levelFromObject(location, setting, defaultLevel) {
10869
- if (setting.level !== void 0) {
10870
- if (!isRuleLevel(setting.level)) throw new TypeError(`${location}.level must be "error", "warn", or "off"`);
10871
- return setting.level;
10872
- }
10873
- if (setting.enabled !== void 0) {
10874
- if (typeof setting.enabled !== "boolean") throw new TypeError(`${location}.enabled must be a boolean`);
10875
- return setting.enabled ? defaultLevel : "off";
10876
- }
10877
- throw new TypeError(`${location} must be a rule level, boolean, [level, options], or { level?, enabled? } object`);
10878
- }
10879
- /**
10880
- * Local parse of rule level settings — kept here to avoid a circular import
10881
- * through `ruleRunner` → `package/index` → `cleanRules`.
10882
- */
10883
- function parseCleanRuleLevel(location, setting, defaultLevel) {
10864
+ function parseRuleLevelSetting(location, setting, defaultLevel) {
10884
10865
  if (setting === void 0) return defaultLevel;
10885
10866
  if (typeof setting === "boolean") return setting ? "warn" : "off";
10886
10867
  if (isRuleLevel(setting)) return setting;
10887
- if (Array.isArray(setting) && setting.length > 0 && isRuleLevel(setting[0])) return setting[0];
10888
- if (typeof setting === "object" && setting !== null && !Array.isArray(setting)) return levelFromObject(location, setting, defaultLevel);
10868
+ if (Array.isArray(setting) && setting.length > 0) {
10869
+ const [level] = setting;
10870
+ if (isRuleLevel(level)) return level;
10871
+ }
10872
+ if (typeof setting === "object" && setting !== null && !Array.isArray(setting)) {
10873
+ const record = setting;
10874
+ if (record.level !== void 0) {
10875
+ if (!isRuleLevel(record.level)) throw new TypeError(`${location}.level must be "error", "warn", or "off"`);
10876
+ return record.level;
10877
+ }
10878
+ if (record.enabled !== void 0) {
10879
+ if (typeof record.enabled !== "boolean") throw new TypeError(`${location}.enabled must be a boolean`);
10880
+ return record.enabled ? defaultLevel : "off";
10881
+ }
10882
+ }
10889
10883
  throw new TypeError(`${location} must be a rule level, boolean, [level, options], or { level?, enabled? } object`);
10890
10884
  }
10885
+ function validateConfiguredRuleIds(commandName, configKey, rules, config) {
10886
+ const known = new Set(rules.flatMap((rule) => [rule.id, ...rule.aliases ?? []]));
10887
+ const unknown = Object.keys(config?.rules ?? {}).filter((id) => !known.has(id));
10888
+ if (unknown.length > 0) throw new TypeError(`Unknown ${commandName} rule ${unknown.map((id) => `"${id}"`).join(", ")} in commands.${configKey}.rules`);
10889
+ }
10890
+ //#endregion
10891
+ //#region src/actions/package/cleanRules.ts
10891
10892
  /**
10892
10893
  Hard safety rules — always enforced; cannot be disabled via config.
10893
10894
  */
@@ -10910,7 +10911,6 @@ const CLEAN_CONFIGURABLE_RULES = [{
10910
10911
  description: "Also delete every path under the package that is matched by .gitignore",
10911
10912
  id: "clean.gitignored-all"
10912
10913
  }];
10913
- const CONFIGURABLE_RULE_IDS = new Set(CLEAN_CONFIGURABLE_RULES.map((rule) => rule.id));
10914
10914
  const HARD_RULE_IDS = new Set(CLEAN_HARD_RULES.map((rule) => rule.id));
10915
10915
  /**
10916
10916
  Immutable exclude entries — always skipped by clean, cannot be overridden.
@@ -10936,17 +10936,22 @@ function defaultLevelForRule(ruleId) {
10936
10936
  return CLEAN_CONFIGURABLE_RULES.find((rule) => rule.id === ruleId)?.defaultLevel ?? "off";
10937
10937
  }
10938
10938
  /**
10939
+ * Reject config references to hard (non-configurable) safety rules.
10940
+ */
10941
+ function assertCleanConfigurableRules(config) {
10942
+ const configured = Object.keys(config?.rules ?? {});
10943
+ for (const ruleId of configured) if (HARD_RULE_IDS.has(ruleId)) throw new TypeError(`commands.clean.rules["${ruleId}"] cannot be configured — hard safety rules are always enforced`);
10944
+ }
10945
+ /**
10939
10946
  * Resolve configurable clean rule levels from config. Throws if the config
10940
10947
  * references hard (non-configurable) rules or unknown rule ids.
10941
10948
  */
10942
10949
  function resolveCleanRules(config) {
10943
10950
  const rules = config?.rules ?? {};
10944
- for (const ruleId of Object.keys(rules)) {
10945
- if (HARD_RULE_IDS.has(ruleId)) throw new TypeError(`commands.clean.rules["${ruleId}"] cannot be configured — hard safety rules are always enforced`);
10946
- if (!CONFIGURABLE_RULE_IDS.has(ruleId)) throw new TypeError(`Unknown clean rule "${ruleId}" in commands.clean.rules. Configurable rules: ${[...CONFIGURABLE_RULE_IDS].join(", ")}`);
10947
- }
10951
+ assertCleanConfigurableRules(config);
10952
+ validateConfiguredRuleIds("clean", "clean", CLEAN_CONFIGURABLE_RULES, config);
10948
10953
  const level = (ruleId, setting) => {
10949
- return parseCleanRuleLevel(`commands.clean.rules["${ruleId}"]`, setting, defaultLevelForRule(ruleId));
10954
+ return parseRuleLevelSetting(`commands.clean.rules["${ruleId}"]`, setting, defaultLevelForRule(ruleId));
10950
10955
  };
10951
10956
  return {
10952
10957
  gitignoredAll: level("clean.gitignored-all", rules["clean.gitignored-all"]),