@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
@@ -8979,7 +8979,6 @@ const RULE_COMMANDS = {
8979
8979
  title: "Fix Rules"
8980
8980
  },
8981
8981
  gitLint: {
8982
- aliases: ["gitlint"],
8983
8982
  command: "git lint",
8984
8983
  configKey: "gitLint",
8985
8984
  includeInRoot: true,
@@ -8992,14 +8991,12 @@ const RULE_COMMANDS = {
8992
8991
  title: "Lint Rules"
8993
8992
  },
8994
8993
  lintLint: {
8995
- aliases: ["lintlint"],
8996
8994
  command: "lint lint",
8997
8995
  configKey: "lintLint",
8998
8996
  includeInRoot: true,
8999
8997
  title: "Lint Lint Rules"
9000
8998
  },
9001
8999
  nodeLint: {
9002
- aliases: ["node-lint"],
9003
9000
  command: "node lint",
9004
9001
  configKey: "nodeLint",
9005
9002
  includeInRoot: true,
@@ -9018,7 +9015,6 @@ const RULE_COMMANDS = {
9018
9015
  title: "Plan Lint Rules"
9019
9016
  },
9020
9017
  publint: {
9021
- aliases: ["republint"],
9022
9018
  command: "publint",
9023
9019
  configKey: "publint",
9024
9020
  includeInRoot: true,
@@ -10919,7 +10915,7 @@ function resolveSafeCleanPatterns(patterns, baseDir, rootDir) {
10919
10915
  return resolvedPatterns;
10920
10916
  }
10921
10917
  //#endregion
10922
- //#region src/actions/package/cleanRules.ts
10918
+ //#region src/actions/ruleRunner.ts
10923
10919
  const RULE_LEVELS = /* @__PURE__ */ new Set([
10924
10920
  "error",
10925
10921
  "off",
@@ -10928,29 +10924,34 @@ const RULE_LEVELS = /* @__PURE__ */ new Set([
10928
10924
  function isRuleLevel(value) {
10929
10925
  return typeof value === "string" && RULE_LEVELS.has(value);
10930
10926
  }
10931
- function levelFromObject(location, setting, defaultLevel) {
10932
- if (setting.level !== void 0) {
10933
- if (!isRuleLevel(setting.level)) throw new TypeError(`${location}.level must be "error", "warn", or "off"`);
10934
- return setting.level;
10935
- }
10936
- if (setting.enabled !== void 0) {
10937
- if (typeof setting.enabled !== "boolean") throw new TypeError(`${location}.enabled must be a boolean`);
10938
- return setting.enabled ? defaultLevel : "off";
10939
- }
10940
- throw new TypeError(`${location} must be a rule level, boolean, [level, options], or { level?, enabled? } object`);
10941
- }
10942
- /**
10943
- * Local parse of rule level settings — kept here to avoid a circular import
10944
- * through `ruleRunner` → `package/index` → `cleanRules`.
10945
- */
10946
- function parseCleanRuleLevel(location, setting, defaultLevel) {
10927
+ function parseRuleLevelSetting(location, setting, defaultLevel) {
10947
10928
  if (setting === void 0) return defaultLevel;
10948
10929
  if (typeof setting === "boolean") return setting ? "warn" : "off";
10949
10930
  if (isRuleLevel(setting)) return setting;
10950
- if (Array.isArray(setting) && setting.length > 0 && isRuleLevel(setting[0])) return setting[0];
10951
- if (typeof setting === "object" && setting !== null && !Array.isArray(setting)) return levelFromObject(location, setting, defaultLevel);
10931
+ if (Array.isArray(setting) && setting.length > 0) {
10932
+ const [level] = setting;
10933
+ if (isRuleLevel(level)) return level;
10934
+ }
10935
+ if (typeof setting === "object" && setting !== null && !Array.isArray(setting)) {
10936
+ const record = setting;
10937
+ if (record.level !== void 0) {
10938
+ if (!isRuleLevel(record.level)) throw new TypeError(`${location}.level must be "error", "warn", or "off"`);
10939
+ return record.level;
10940
+ }
10941
+ if (record.enabled !== void 0) {
10942
+ if (typeof record.enabled !== "boolean") throw new TypeError(`${location}.enabled must be a boolean`);
10943
+ return record.enabled ? defaultLevel : "off";
10944
+ }
10945
+ }
10952
10946
  throw new TypeError(`${location} must be a rule level, boolean, [level, options], or { level?, enabled? } object`);
10953
10947
  }
10948
+ function validateConfiguredRuleIds(commandName, configKey, rules, config) {
10949
+ const known = new Set(rules.flatMap((rule) => [rule.id, ...rule.aliases ?? []]));
10950
+ const unknown = Object.keys(config?.rules ?? {}).filter((id) => !known.has(id));
10951
+ if (unknown.length > 0) throw new TypeError(`Unknown ${commandName} rule ${unknown.map((id) => `"${id}"`).join(", ")} in commands.${configKey}.rules`);
10952
+ }
10953
+ //#endregion
10954
+ //#region src/actions/package/cleanRules.ts
10954
10955
  /**
10955
10956
  Hard safety rules — always enforced; cannot be disabled via config.
10956
10957
  */
@@ -10973,7 +10974,6 @@ const CLEAN_CONFIGURABLE_RULES = [{
10973
10974
  description: "Also delete every path under the package that is matched by .gitignore",
10974
10975
  id: "clean.gitignored-all"
10975
10976
  }];
10976
- const CONFIGURABLE_RULE_IDS = new Set(CLEAN_CONFIGURABLE_RULES.map((rule) => rule.id));
10977
10977
  const HARD_RULE_IDS = new Set(CLEAN_HARD_RULES.map((rule) => rule.id));
10978
10978
  /**
10979
10979
  Immutable exclude entries — always skipped by clean, cannot be overridden.
@@ -10999,17 +10999,22 @@ function defaultLevelForRule(ruleId) {
10999
10999
  return CLEAN_CONFIGURABLE_RULES.find((rule) => rule.id === ruleId)?.defaultLevel ?? "off";
11000
11000
  }
11001
11001
  /**
11002
+ * Reject config references to hard (non-configurable) safety rules.
11003
+ */
11004
+ function assertCleanConfigurableRules(config) {
11005
+ const configured = Object.keys(config?.rules ?? {});
11006
+ 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`);
11007
+ }
11008
+ /**
11002
11009
  * Resolve configurable clean rule levels from config. Throws if the config
11003
11010
  * references hard (non-configurable) rules or unknown rule ids.
11004
11011
  */
11005
11012
  function resolveCleanRules(config) {
11006
11013
  const rules = config?.rules ?? {};
11007
- for (const ruleId of Object.keys(rules)) {
11008
- if (HARD_RULE_IDS.has(ruleId)) throw new TypeError(`commands.clean.rules["${ruleId}"] cannot be configured — hard safety rules are always enforced`);
11009
- if (!CONFIGURABLE_RULE_IDS.has(ruleId)) throw new TypeError(`Unknown clean rule "${ruleId}" in commands.clean.rules. Configurable rules: ${[...CONFIGURABLE_RULE_IDS].join(", ")}`);
11010
- }
11014
+ assertCleanConfigurableRules(config);
11015
+ validateConfiguredRuleIds("clean", "clean", CLEAN_CONFIGURABLE_RULES, config);
11011
11016
  const level = (ruleId, setting) => {
11012
- return parseCleanRuleLevel(`commands.clean.rules["${ruleId}"]`, setting, defaultLevelForRule(ruleId));
11017
+ return parseRuleLevelSetting(`commands.clean.rules["${ruleId}"]`, setting, defaultLevelForRule(ruleId));
11013
11018
  };
11014
11019
  return {
11015
11020
  gitignoredAll: level("clean.gitignored-all", rules["clean.gitignored-all"]),