@standards-kit/conform 0.3.1 → 0.4.0

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 (69) hide show
  1. package/README.md +0 -9
  2. package/dist/{chunk-DXIYZR62.js → chunk-G5AS4QBP.js} +1 -1
  3. package/dist/{chunk-YKKWXHYS.js → chunk-HLF56NMK.js} +2 -5
  4. package/dist/chunk-HLF56NMK.js.map +1 -0
  5. package/dist/{chunk-RHM53NLG.js → chunk-RR4OEIAZ.js} +2 -2
  6. package/dist/{chunk-RHM53NLG.js.map → chunk-RR4OEIAZ.js.map} +1 -1
  7. package/dist/{chunk-M7G73Q6P.js → chunk-T2PWT2B5.js} +1 -1
  8. package/dist/chunk-T2PWT2B5.js.map +1 -0
  9. package/dist/{chunk-J5S6GRGW.js → chunk-XZERDHOH.js} +2 -2
  10. package/dist/{chunk-FJZMUGYW.js → chunk-ZKFWS3GU.js} +45 -13
  11. package/dist/chunk-ZKFWS3GU.js.map +1 -0
  12. package/dist/cli/index.d.ts +1 -1
  13. package/dist/cli/utils.d.ts +2 -4
  14. package/dist/cli.js +55 -23
  15. package/dist/cli.js.map +1 -1
  16. package/dist/code/tools/base.d.ts +4 -2
  17. package/dist/constants.d.ts +0 -9
  18. package/dist/core/index.d.ts +0 -1
  19. package/dist/core/schema.d.ts +1 -0
  20. package/dist/{core-LFX2BFLG.js → core-HQ7WZCSW.js} +6 -16
  21. package/dist/{generate-D4MFMOHP.js → generate-4EY6VETG.js} +3 -3
  22. package/dist/{iam-YXMHK2MV.js → iam-363WGRLI.js} +2 -2
  23. package/dist/index.d.ts +1 -1
  24. package/dist/index.js +47 -16
  25. package/dist/index.js.map +1 -1
  26. package/dist/infra/checkers/index.d.ts +0 -4
  27. package/dist/infra/schemas.d.ts +1 -1
  28. package/dist/{infra-RFEWGWPW.js → infra-CHHXGSWU.js} +10 -10
  29. package/dist/infra-CHHXGSWU.js.map +1 -0
  30. package/dist/{manifest-7AIL2FK2.js → manifest-CL4QMZT6.js} +2 -2
  31. package/dist/mcp/index.d.ts +1 -1
  32. package/dist/mcp/standards/matcher.d.ts +0 -9
  33. package/dist/mcp/standards/parser.d.ts +0 -4
  34. package/dist/{mcp-DYQG6JEQ.js → mcp-RPYXEVCR.js} +5 -5
  35. package/dist/process/index.d.ts +1 -1
  36. package/dist/process/scan/remote-fetcher.d.ts +0 -2
  37. package/dist/process/tools/hooks.d.ts +3 -0
  38. package/dist/process/tools/index.d.ts +0 -1
  39. package/dist/projects/templates.d.ts +0 -4
  40. package/dist/{registry-J2LVW3M2.js → registry-7CTKYGKA.js} +3 -3
  41. package/dist/{s3-S4GXNR7H.js → s3-7GRZRXLA.js} +2 -2
  42. package/dist/{s3-53UELUWT.js → s3-MFBDXYQ5.js} +2 -2
  43. package/dist/{scan-BZH5IR3Z.js → scan-S5VYRCPC.js} +5 -5
  44. package/dist/scan-S5VYRCPC.js.map +1 -0
  45. package/dist/{standards-ALMA4VIU.js → standards-CASOIZJV.js} +3 -9
  46. package/dist/{sync-EGJ2CSYK.js → sync-PT6KT46K.js} +4 -4
  47. package/dist/validate/guidelines.d.ts +0 -14
  48. package/dist/validate/index.d.ts +1 -2
  49. package/dist/{validate-X4K2SHYT.js → validate-WLVATJEZ.js} +5 -6
  50. package/dist/validate-WLVATJEZ.js.map +1 -0
  51. package/package.json +2 -2
  52. package/dist/chunk-FJZMUGYW.js.map +0 -1
  53. package/dist/chunk-M7G73Q6P.js.map +0 -1
  54. package/dist/chunk-YKKWXHYS.js.map +0 -1
  55. package/dist/infra-RFEWGWPW.js.map +0 -1
  56. package/dist/scan-BZH5IR3Z.js.map +0 -1
  57. package/dist/validate-X4K2SHYT.js.map +0 -1
  58. /package/dist/{chunk-DXIYZR62.js.map → chunk-G5AS4QBP.js.map} +0 -0
  59. /package/dist/{chunk-J5S6GRGW.js.map → chunk-XZERDHOH.js.map} +0 -0
  60. /package/dist/{core-LFX2BFLG.js.map → core-HQ7WZCSW.js.map} +0 -0
  61. /package/dist/{generate-D4MFMOHP.js.map → generate-4EY6VETG.js.map} +0 -0
  62. /package/dist/{iam-YXMHK2MV.js.map → iam-363WGRLI.js.map} +0 -0
  63. /package/dist/{manifest-7AIL2FK2.js.map → manifest-CL4QMZT6.js.map} +0 -0
  64. /package/dist/{mcp-DYQG6JEQ.js.map → mcp-RPYXEVCR.js.map} +0 -0
  65. /package/dist/{registry-J2LVW3M2.js.map → registry-7CTKYGKA.js.map} +0 -0
  66. /package/dist/{s3-53UELUWT.js.map → s3-7GRZRXLA.js.map} +0 -0
  67. /package/dist/{s3-S4GXNR7H.js.map → s3-MFBDXYQ5.js.map} +0 -0
  68. /package/dist/{standards-ALMA4VIU.js.map → standards-CASOIZJV.js.map} +0 -0
  69. /package/dist/{sync-EGJ2CSYK.js.map → sync-PT6KT46K.js.map} +0 -0
@@ -9,11 +9,13 @@ export declare abstract class BaseToolRunner implements IToolRunner {
9
9
  abstract readonly toolId: string;
10
10
  abstract readonly configFiles: string[];
11
11
  /**
12
- * Check if any of the config files exist
12
+ * Check if any of the config files exist in projectRoot or parent directories.
13
+ * Most tools (ESLint, TSC, etc.) walk up directories to find configs.
13
14
  */
14
15
  protected hasConfig(projectRoot: string): boolean;
15
16
  /**
16
- * Find which config file exists (if any)
17
+ * Find which config file exists, searching projectRoot and parent directories.
18
+ * Returns the path relative to the directory where it was found, or null.
17
19
  */
18
20
  protected findConfig(projectRoot: string): string | null;
19
21
  /**
@@ -58,12 +58,3 @@ export declare const CONCURRENCY: {
58
58
  /** Default concurrency for infrastructure resource checks */
59
59
  readonly infraScan: 10;
60
60
  };
61
- /**
62
- * Default threshold values
63
- */
64
- export declare const DEFAULTS: {
65
- /** Default backup max age in hours */
66
- readonly backupMaxAgeHours: 24;
67
- /** Default code coverage minimum threshold */
68
- readonly coverageMinThreshold: 80;
69
- };
@@ -4,4 +4,3 @@ export type { Config } from "./schema.js";
4
4
  export { configSchema, defaultConfig, DEFAULT_FORBIDDEN_FILES_IGNORE } from "./schema.js";
5
5
  export { CONFIG_FILE_NAME, ConfigError, findConfigFile, loadConfig, loadConfigAsync, loadConfigWithOverrides, getProjectRoot, } from "./loader.js";
6
6
  export type { ConfigOverride } from "./loader.js";
7
- export { parseRegistryUrl, fetchRegistry, loadRuleset, mergeConfigs, resolveExtends, } from "./registry.js";
@@ -154,6 +154,7 @@ export declare const configSchema: z.ZodObject<{
154
154
  require_hooks: z.ZodOptional<z.ZodArray<z.ZodString>>;
155
155
  commands: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodArray<z.ZodString>>>;
156
156
  protected_branches: z.ZodOptional<z.ZodArray<z.ZodString>>;
157
+ templates: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
157
158
  }, z.core.$strict>>;
158
159
  ci: z.ZodOptional<z.ZodObject<{
159
160
  enabled: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
@@ -3,25 +3,20 @@ import {
3
3
  DomainResultBuilder,
4
4
  ExitCode,
5
5
  ViolationBuilder
6
- } from "./chunk-DXIYZR62.js";
6
+ } from "./chunk-G5AS4QBP.js";
7
7
  import {
8
8
  CONFIG_FILE_NAME,
9
9
  ConfigError,
10
10
  DEFAULT_FORBIDDEN_FILES_IGNORE,
11
11
  configSchema,
12
12
  defaultConfig,
13
- fetchRegistry,
14
13
  findConfigFile,
15
14
  getProjectRoot,
16
15
  loadConfig,
17
16
  loadConfigAsync,
18
- loadConfigWithOverrides,
19
- loadRuleset,
20
- mergeConfigs,
21
- parseRegistryUrl,
22
- resolveExtends
23
- } from "./chunk-FJZMUGYW.js";
24
- import "./chunk-RHM53NLG.js";
17
+ loadConfigWithOverrides
18
+ } from "./chunk-ZKFWS3GU.js";
19
+ import "./chunk-RR4OEIAZ.js";
25
20
  export {
26
21
  CONFIG_FILE_NAME,
27
22
  CheckResultBuilder,
@@ -32,15 +27,10 @@ export {
32
27
  ViolationBuilder,
33
28
  configSchema,
34
29
  defaultConfig,
35
- fetchRegistry,
36
30
  findConfigFile,
37
31
  getProjectRoot,
38
32
  loadConfig,
39
33
  loadConfigAsync,
40
- loadConfigWithOverrides,
41
- loadRuleset,
42
- mergeConfigs,
43
- parseRegistryUrl,
44
- resolveExtends
34
+ loadConfigWithOverrides
45
35
  };
46
- //# sourceMappingURL=core-LFX2BFLG.js.map
36
+ //# sourceMappingURL=core-HQ7WZCSW.js.map
@@ -10,8 +10,8 @@ import {
10
10
  parseStackExportMultiAccount,
11
11
  readExistingManifest,
12
12
  writeManifest
13
- } from "./chunk-J5S6GRGW.js";
14
- import "./chunk-M7G73Q6P.js";
13
+ } from "./chunk-XZERDHOH.js";
14
+ import "./chunk-T2PWT2B5.js";
15
15
  export {
16
16
  DEFAULT_MANIFEST_NAME,
17
17
  generateManifestFromFile,
@@ -25,4 +25,4 @@ export {
25
25
  readExistingManifest,
26
26
  writeManifest
27
27
  };
28
- //# sourceMappingURL=generate-D4MFMOHP.js.map
28
+ //# sourceMappingURL=generate-4EY6VETG.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  AWS_DEFAULTS
3
- } from "./chunk-RHM53NLG.js";
3
+ } from "./chunk-RR4OEIAZ.js";
4
4
 
5
5
  // src/infra/checkers/iam.ts
6
6
  import { GetPolicyCommand, GetRoleCommand, IAMClient } from "@aws-sdk/client-iam";
@@ -97,4 +97,4 @@ async function checkPolicy(policyArn) {
97
97
  export {
98
98
  IAMChecker
99
99
  };
100
- //# sourceMappingURL=iam-YXMHK2MV.js.map
100
+ //# sourceMappingURL=iam-363WGRLI.js.map
package/dist/index.d.ts CHANGED
@@ -5,7 +5,7 @@ export type { CheckResult, DomainResult, DomainStatus, ExitCodeType, FullResult,
5
5
  export { CheckResultBuilder, DomainResultBuilder, ExitCode, ViolationBuilder, } from "./core/index.js";
6
6
  export { type Config, ConfigError, configSchema, defaultConfig, findConfigFile, getProjectRoot, loadConfig, } from "./core/index.js";
7
7
  export { auditCodeConfig, BaseToolRunner, ESLintRunner, KnipRunner, NamingRunner, RuffRunner, runCodeChecks, TscRunner, TyRunner, VultureRunner, } from "./code/index.js";
8
- export { auditProcessConfig, BaseProcessToolRunner, HooksRunner, runProcessChecks, } from "./process/index.js";
8
+ export { auditProcessConfig, HooksRunner, runProcessChecks, } from "./process/index.js";
9
9
  export { type RemoteRepoInfo, type ScanOptions, scanRepository, type ScanResult, validateProcess, type ValidateProcessOptions, type ValidateProcessResult, } from "./process/scan/index.js";
10
10
  export { formatJson, formatOutput, formatText, type OutputFormat } from "./output/index.js";
11
11
  export { type DependenciesOptions, type DependenciesResult, getDependencies, } from "./dependencies/index.js";
package/dist/index.js CHANGED
@@ -10,13 +10,13 @@ import {
10
10
  parseStackExportMultiAccount,
11
11
  readExistingManifest,
12
12
  writeManifest
13
- } from "./chunk-J5S6GRGW.js";
13
+ } from "./chunk-XZERDHOH.js";
14
14
  import {
15
15
  CheckResultBuilder,
16
16
  DomainResultBuilder,
17
17
  ExitCode,
18
18
  ViolationBuilder
19
- } from "./chunk-DXIYZR62.js";
19
+ } from "./chunk-G5AS4QBP.js";
20
20
  import {
21
21
  ConfigError,
22
22
  DEFAULT_FORBIDDEN_FILES_IGNORE,
@@ -26,7 +26,7 @@ import {
26
26
  getProjectRoot,
27
27
  loadConfig,
28
28
  loadConfigAsync
29
- } from "./chunk-FJZMUGYW.js";
29
+ } from "./chunk-ZKFWS3GU.js";
30
30
  import {
31
31
  AccountIdSchema,
32
32
  AccountKeySchema,
@@ -70,7 +70,7 @@ import {
70
70
  validateManifest,
71
71
  validateMultiAccountManifest,
72
72
  validateStackExport
73
- } from "./chunk-M7G73Q6P.js";
73
+ } from "./chunk-T2PWT2B5.js";
74
74
  import {
75
75
  AWS_DEFAULTS,
76
76
  CACHE,
@@ -78,26 +78,34 @@ import {
78
78
  GITHUB_API,
79
79
  STANDARDS_REPO,
80
80
  TIMEOUTS
81
- } from "./chunk-RHM53NLG.js";
81
+ } from "./chunk-RR4OEIAZ.js";
82
82
 
83
83
  // src/code/tools/base.ts
84
84
  import * as fs from "fs";
85
85
  import * as path from "path";
86
86
  var BaseToolRunner = class {
87
87
  /**
88
- * Check if any of the config files exist
88
+ * Check if any of the config files exist in projectRoot or parent directories.
89
+ * Most tools (ESLint, TSC, etc.) walk up directories to find configs.
89
90
  */
90
91
  hasConfig(projectRoot) {
91
- return this.configFiles.some((config) => fs.existsSync(path.join(projectRoot, config)));
92
+ return this.findConfig(projectRoot) !== null;
92
93
  }
93
94
  /**
94
- * Find which config file exists (if any)
95
+ * Find which config file exists, searching projectRoot and parent directories.
96
+ * Returns the path relative to the directory where it was found, or null.
95
97
  */
96
98
  findConfig(projectRoot) {
97
- for (const config of this.configFiles) {
98
- if (fs.existsSync(path.join(projectRoot, config))) {
99
- return config;
99
+ let dir = path.resolve(projectRoot);
100
+ const root = path.parse(dir).root;
101
+ while (true) {
102
+ for (const config of this.configFiles) {
103
+ if (fs.existsSync(path.join(dir, config))) {
104
+ return dir === path.resolve(projectRoot) ? config : path.join(dir, config);
105
+ }
100
106
  }
107
+ if (dir === root) break;
108
+ dir = path.dirname(dir);
101
109
  }
102
110
  return null;
103
111
  }
@@ -5169,6 +5177,28 @@ var HooksRunner = class extends BaseProcessToolRunner {
5169
5177
  (pattern) => this.fileContains(projectRoot, hookPath, pattern)
5170
5178
  );
5171
5179
  }
5180
+ /** Check that hook files match expected template content */
5181
+ checkHookTemplates(projectRoot) {
5182
+ const templates = this.config.templates ?? {};
5183
+ const violations = [];
5184
+ for (const [hook, expectedContent] of Object.entries(templates)) {
5185
+ const hookPath = `.husky/${hook}`;
5186
+ const actual = this.readFile(projectRoot, hookPath);
5187
+ if (actual === null) {
5188
+ continue;
5189
+ }
5190
+ if (actual.trim() !== expectedContent.trim()) {
5191
+ violations.push({
5192
+ rule: `${this.rule}.${hook}.template`,
5193
+ tool: this.toolId,
5194
+ file: hookPath,
5195
+ message: `Hook '${hook}' does not match expected template`,
5196
+ severity: "error"
5197
+ });
5198
+ }
5199
+ }
5200
+ return violations;
5201
+ }
5172
5202
  /** Check that pre-push hook prevents direct pushes to protected branches */
5173
5203
  checkProtectedBranches(projectRoot) {
5174
5204
  const protectedBranches = this.config.protected_branches ?? [];
@@ -5210,6 +5240,7 @@ var HooksRunner = class extends BaseProcessToolRunner {
5210
5240
  const violations = [
5211
5241
  ...this.checkRequiredHooks(projectRoot),
5212
5242
  ...this.checkHookCommands(projectRoot),
5243
+ ...this.checkHookTemplates(projectRoot),
5213
5244
  ...this.checkProtectedBranches(projectRoot)
5214
5245
  ];
5215
5246
  return this.fromViolations(violations, elapsed());
@@ -5921,7 +5952,8 @@ function createHooksRunner(config) {
5921
5952
  require_husky: hooksConfig.require_husky,
5922
5953
  require_hooks: hooksConfig.require_hooks,
5923
5954
  commands: hooksConfig.commands,
5924
- protected_branches: hooksConfig.protected_branches
5955
+ protected_branches: hooksConfig.protected_branches,
5956
+ templates: hooksConfig.templates
5925
5957
  });
5926
5958
  }
5927
5959
  return runner;
@@ -6663,7 +6695,7 @@ async function scanRepository(repo, config) {
6663
6695
  return aggregateResults(repoInfo, [rulesetsResult, filesResult]);
6664
6696
  }
6665
6697
  async function validateProcess(options) {
6666
- const { loadConfigAsync: loadConfigAsync2 } = await import("./core-LFX2BFLG.js");
6698
+ const { loadConfigAsync: loadConfigAsync2 } = await import("./core-HQ7WZCSW.js");
6667
6699
  const { config } = await loadConfigAsync2(options.config);
6668
6700
  const result = await scanRepository(options.repo, config);
6669
6701
  const fs22 = await import("fs");
@@ -7636,12 +7668,12 @@ function isSupportedService(service) {
7636
7668
  return SUPPORTED_SERVICES.includes(service);
7637
7669
  }
7638
7670
  var checkerFactories = {
7639
- s3: async () => (await import("./s3-53UELUWT.js")).S3Checker,
7671
+ s3: async () => (await import("./s3-MFBDXYQ5.js")).S3Checker,
7640
7672
  lambda: async () => (await import("./lambda-YTJOCYV5.js")).LambdaChecker,
7641
7673
  dynamodb: async () => (await import("./dynamodb-HQH3IMAI.js")).DynamoDBChecker,
7642
7674
  sqs: async () => (await import("./sqs-MHBW6UFC.js")).SQSChecker,
7643
7675
  sns: async () => (await import("./sns-RV64OMK2.js")).SNSChecker,
7644
- iam: async () => (await import("./iam-YXMHK2MV.js")).IAMChecker,
7676
+ iam: async () => (await import("./iam-363WGRLI.js")).IAMChecker,
7645
7677
  secretsmanager: async () => (await import("./secretsmanager-FJKTPIXI.js")).SecretsManagerChecker,
7646
7678
  logs: async () => (await import("./cloudwatch-3LTDYG6G.js")).CloudWatchLogsChecker,
7647
7679
  ecs: async () => (await import("./ecs-UHKCH5A7.js")).ECSChecker,
@@ -7862,7 +7894,6 @@ export {
7862
7894
  AccountIdSchema,
7863
7895
  AccountKeySchema,
7864
7896
  ArnSchema,
7865
- BaseProcessToolRunner,
7866
7897
  BaseToolRunner,
7867
7898
  CheckResultBuilder,
7868
7899
  CloudProviderSchema,