critical-gate 2.3.0 → 2.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 (122) hide show
  1. package/README.md +44 -35
  2. package/dist/agent-onboarding/agent-instructions.d.ts +21 -0
  3. package/dist/agent-onboarding/agent-instructions.d.ts.map +1 -0
  4. package/dist/agent-onboarding/agent-instructions.js +67 -0
  5. package/dist/agent-onboarding/agent-instructions.js.map +1 -0
  6. package/dist/agent-onboarding/index.d.ts +2 -0
  7. package/dist/agent-onboarding/index.d.ts.map +1 -0
  8. package/dist/agent-onboarding/index.js +2 -0
  9. package/dist/agent-onboarding/index.js.map +1 -0
  10. package/dist/cli/args.d.ts +57 -0
  11. package/dist/cli/args.d.ts.map +1 -0
  12. package/dist/cli/args.js +209 -0
  13. package/dist/cli/args.js.map +1 -0
  14. package/dist/cli/commands.d.ts +8 -0
  15. package/dist/cli/commands.d.ts.map +1 -0
  16. package/dist/cli/commands.js +170 -0
  17. package/dist/cli/commands.js.map +1 -0
  18. package/dist/cli/entrypoint.d.ts +2 -0
  19. package/dist/cli/entrypoint.d.ts.map +1 -0
  20. package/dist/cli/entrypoint.js +18 -0
  21. package/dist/cli/entrypoint.js.map +1 -0
  22. package/dist/cli/git-hooks.d.ts +2 -0
  23. package/dist/cli/git-hooks.d.ts.map +1 -0
  24. package/dist/cli/git-hooks.js +31 -0
  25. package/dist/cli/git-hooks.js.map +1 -0
  26. package/dist/cli/help.d.ts +4 -0
  27. package/dist/cli/help.d.ts.map +1 -0
  28. package/dist/cli/help.js +151 -0
  29. package/dist/cli/help.js.map +1 -0
  30. package/dist/cli/io.d.ts +3 -0
  31. package/dist/cli/io.d.ts.map +1 -0
  32. package/dist/cli/io.js +16 -0
  33. package/dist/cli/io.js.map +1 -0
  34. package/dist/cli/main.d.ts +4 -0
  35. package/dist/cli/main.d.ts.map +1 -0
  36. package/dist/cli/main.js +76 -0
  37. package/dist/cli/main.js.map +1 -0
  38. package/dist/cli/result.d.ts +4 -0
  39. package/dist/cli/result.d.ts.map +1 -0
  40. package/dist/cli/result.js +107 -0
  41. package/dist/cli/result.js.map +1 -0
  42. package/dist/cli/types.d.ts +30 -0
  43. package/dist/cli/types.d.ts.map +1 -0
  44. package/dist/cli/types.js +7 -0
  45. package/dist/cli/types.js.map +1 -0
  46. package/dist/cli.d.ts +5 -18
  47. package/dist/cli.d.ts.map +1 -1
  48. package/dist/cli.js +6 -681
  49. package/dist/cli.js.map +1 -1
  50. package/dist/config/critical-gate-config.d.ts +4 -0
  51. package/dist/config/critical-gate-config.d.ts.map +1 -1
  52. package/dist/config/critical-gate-config.js +18 -1
  53. package/dist/config/critical-gate-config.js.map +1 -1
  54. package/dist/config/index.d.ts +1 -1
  55. package/dist/config/index.d.ts.map +1 -1
  56. package/dist/config/index.js +1 -1
  57. package/dist/config/index.js.map +1 -1
  58. package/dist/detectors/api-surface-detector.d.ts.map +1 -1
  59. package/dist/detectors/api-surface-detector.js +56 -9
  60. package/dist/detectors/api-surface-detector.js.map +1 -1
  61. package/dist/detectors/intent-verification-detector.d.ts.map +1 -1
  62. package/dist/detectors/intent-verification-detector.js +31 -1
  63. package/dist/detectors/intent-verification-detector.js.map +1 -1
  64. package/dist/detectors/runner.d.ts +1 -0
  65. package/dist/detectors/runner.d.ts.map +1 -1
  66. package/dist/detectors/runner.js +21 -0
  67. package/dist/detectors/runner.js.map +1 -1
  68. package/dist/detectors/scope-detector.d.ts.map +1 -1
  69. package/dist/detectors/scope-detector.js +24 -7
  70. package/dist/detectors/scope-detector.js.map +1 -1
  71. package/dist/index.d.ts +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +1 -0
  74. package/dist/index.js.map +1 -1
  75. package/dist/intent/index.d.ts +1 -1
  76. package/dist/intent/index.d.ts.map +1 -1
  77. package/dist/intent/index.js +1 -1
  78. package/dist/intent/index.js.map +1 -1
  79. package/dist/intent/intent-model.d.ts +3 -0
  80. package/dist/intent/intent-model.d.ts.map +1 -1
  81. package/dist/intent/intent-model.js +49 -1
  82. package/dist/intent/intent-model.js.map +1 -1
  83. package/dist/intent/observed-actions.d.ts.map +1 -1
  84. package/dist/intent/observed-actions.js +45 -2
  85. package/dist/intent/observed-actions.js.map +1 -1
  86. package/dist/llm/artifact.js +8 -8
  87. package/dist/llm/artifact.js.map +1 -1
  88. package/dist/reporters/markdown-reporter.d.ts.map +1 -1
  89. package/dist/reporters/markdown-reporter.js +36 -2
  90. package/dist/reporters/markdown-reporter.js.map +1 -1
  91. package/dist/reporters/pr-comment-reporter.d.ts.map +1 -1
  92. package/dist/reporters/pr-comment-reporter.js +25 -4
  93. package/dist/reporters/pr-comment-reporter.js.map +1 -1
  94. package/dist/reporters/sarif-reporter.d.ts.map +1 -1
  95. package/dist/reporters/sarif-reporter.js +2 -0
  96. package/dist/reporters/sarif-reporter.js.map +1 -1
  97. package/dist/repository/api-snapshot.d.ts +12 -1
  98. package/dist/repository/api-snapshot.d.ts.map +1 -1
  99. package/dist/repository/api-snapshot.js +85 -22
  100. package/dist/repository/api-snapshot.js.map +1 -1
  101. package/dist/repository/index.d.ts +2 -1
  102. package/dist/repository/index.d.ts.map +1 -1
  103. package/dist/repository/index.js +2 -1
  104. package/dist/repository/index.js.map +1 -1
  105. package/dist/repository/token-index.d.ts +9 -0
  106. package/dist/repository/token-index.d.ts.map +1 -0
  107. package/dist/repository/token-index.js +143 -0
  108. package/dist/repository/token-index.js.map +1 -0
  109. package/dist/schema/gate-result.schema.d.ts +191 -0
  110. package/dist/schema/gate-result.schema.d.ts.map +1 -1
  111. package/dist/schema/gate-result.schema.js +97 -2
  112. package/dist/schema/gate-result.schema.js.map +1 -1
  113. package/dist/schema/index.d.ts +1 -1
  114. package/dist/schema/index.d.ts.map +1 -1
  115. package/dist/schema/index.js.map +1 -1
  116. package/dist/schema/types.d.ts +44 -0
  117. package/dist/schema/types.d.ts.map +1 -1
  118. package/dist/version.d.ts +2 -0
  119. package/dist/version.d.ts.map +1 -0
  120. package/dist/version.js +2 -0
  121. package/dist/version.js.map +1 -0
  122. package/package.json +7 -3
@@ -0,0 +1,107 @@
1
+ import { join } from "node:path";
2
+ import { GATE_RESULT_SCHEMA_VERSION, applyLearningPolicy, analyzeTaskIntentQuality, buildRepositoryTokenIndex, detectFrameworkPacks, detectMonorepoContext, getConfiguredExpectedSupportFiles, getConfiguredFailOn, getConfiguredPublicApiEntrypoints, getPolicyBlockingDetectors, getPolicyObservationDetectors, loadApiSurfaceSnapshot, loadCriticalGateConfig, resolvePublicApiEntrypoints, runDetectors, summarizeApiSurfaceSnapshot, summarizeFindings, summarizeIntentVerification } from "../index.js";
3
+ import { CRITICAL_GATE_VERSION } from "../version.js";
4
+ export function createGateResult(options, generatedAt, diffResult, io = {}) {
5
+ const configResult = loadCriticalGateConfig(diffResult.root, {
6
+ exists: io.exists,
7
+ readFile: io.readFile
8
+ });
9
+ const task = {
10
+ source: "cli",
11
+ text: options.task
12
+ };
13
+ const diff = {
14
+ baseRef: diffResult.baseRef,
15
+ headRef: diffResult.headRef,
16
+ files: diffResult.files
17
+ };
18
+ const packageJson = readOptionalPackageJson(diffResult.root, io);
19
+ const frameworkPacks = detectFrameworkPacks({
20
+ files: diff.files,
21
+ packageJson,
22
+ config: configResult.config
23
+ });
24
+ const monorepo = detectMonorepoContext(diffResult.root, diff.files, io);
25
+ const repositoryTokenIndex = buildRepositoryTokenIndex({
26
+ files: diff.files,
27
+ packageJson
28
+ });
29
+ const publicApiEntrypoints = resolvePublicApiEntrypoints(diffResult.root, io, getConfiguredPublicApiEntrypoints(configResult.config));
30
+ const publicApiEntrypointContext = publicApiEntrypoints.length > 0 ? publicApiEntrypoints : undefined;
31
+ const apiSnapshot = loadApiSurfaceSnapshot(diffResult.root, io);
32
+ const context = {
33
+ root: diffResult.root,
34
+ packageManager: "pnpm",
35
+ monorepo,
36
+ apiSnapshot: summarizeApiSurfaceSnapshot(apiSnapshot),
37
+ publicEntrypoints: publicApiEntrypointContext?.map((entrypoint) => entrypoint.path),
38
+ publicApiEntrypoints: publicApiEntrypointContext,
39
+ frameworkPacks: frameworkPacks.map((pack) => pack.id),
40
+ repositoryProfile: diffResult.repositoryProfile,
41
+ utilityIndex: diffResult.utilityIndex,
42
+ repositoryTokenIndex,
43
+ git: {
44
+ baseRef: diffResult.baseRef,
45
+ headRef: diffResult.headRef
46
+ }
47
+ };
48
+ const detectorContext = {
49
+ ...context,
50
+ apiSurfaceSnapshot: apiSnapshot,
51
+ publicApiEntrypoints: publicApiEntrypointContext,
52
+ knowledge: diffResult.knowledge
53
+ };
54
+ const detectorFindings = runDetectors(task, diff, detectorContext);
55
+ const learningResult = applyLearningPolicy(detectorFindings, diff.files, {
56
+ ...configResult.config.learning,
57
+ expectedSupportFiles: getConfiguredExpectedSupportFiles(configResult.config)
58
+ });
59
+ const findings = learningResult.findings;
60
+ const loadedHistoryIndex = diffResult.knowledge?.getLoadedHistoryIndex?.();
61
+ const loadedSolutionIndex = diffResult.knowledge?.getLoadedSolutionIndex?.();
62
+ context.repositoryProfile ??= loadedHistoryIndex?.profile;
63
+ context.utilityIndex ??= loadedSolutionIndex?.utilityIndex;
64
+ return {
65
+ schemaVersion: GATE_RESULT_SCHEMA_VERSION,
66
+ generatedAt: generatedAt.toISOString(),
67
+ task,
68
+ diff,
69
+ context,
70
+ findings,
71
+ summary: summarizeFindings(findings, task, diff, {
72
+ observationDetectors: getPolicyObservationDetectors(configResult.config),
73
+ blockingDetectors: getPolicyBlockingDetectors(configResult.config),
74
+ failOn: options.failOn ?? getConfiguredFailOn(configResult.config),
75
+ acceptedFindingIds: learningResult.appliedAcceptedFindings
76
+ }),
77
+ intentVerification: summarizeIntentVerification(task, diff.files),
78
+ intentQuality: analyzeTaskIntentQuality(task),
79
+ metadata: {
80
+ cliVersion: CRITICAL_GATE_VERSION,
81
+ strict: options.strict,
82
+ staged: options.staged,
83
+ failOn: options.failOn ?? getConfiguredFailOn(configResult.config) ?? "high",
84
+ rolloutPolicy: configResult.config.rollout,
85
+ policy: configResult.config.policy,
86
+ frameworkPacks: frameworkPacks.map((pack) => pack.id),
87
+ learning: {
88
+ acceptedFindingsApplied: learningResult.appliedAcceptedFindings,
89
+ expectedSupportRulesApplied: learningResult.appliedExpectedSupportRules
90
+ },
91
+ configWarnings: configResult.warnings
92
+ }
93
+ };
94
+ }
95
+ function readOptionalPackageJson(root, io) {
96
+ const path = join(root, "package.json");
97
+ if (io.exists?.(path) !== true) {
98
+ return undefined;
99
+ }
100
+ try {
101
+ return JSON.parse(io.readFile?.(path) ?? "");
102
+ }
103
+ catch {
104
+ return undefined;
105
+ }
106
+ }
107
+ //# sourceMappingURL=result.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../../src/cli/result.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,0BAA0B,EAC1B,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,qBAAqB,EACrB,iCAAiC,EACjC,mBAAmB,EACnB,iCAAiC,EACjC,0BAA0B,EAC1B,6BAA6B,EAC7B,sBAAsB,EACtB,sBAAsB,EACtB,2BAA2B,EAC3B,YAAY,EACZ,2BAA2B,EAC3B,iBAAiB,EACjB,2BAA2B,EAG5B,MAAM,aAAa,CAAC;AAErB,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,MAAM,UAAU,gBAAgB,CAC9B,OAAqB,EACrB,WAAiB,EACjB,UAAyB,EACzB,KAAyC,EAAE;IAE3C,MAAM,YAAY,GAAG,sBAAsB,CAAC,UAAU,CAAC,IAAI,EAAE;QAC3D,MAAM,EAAE,EAAE,CAAC,MAAM;QACjB,QAAQ,EAAE,EAAE,CAAC,QAAQ;KACtB,CAAC,CAAC;IACH,MAAM,IAAI,GAAG;QACX,MAAM,EAAE,KAAc;QACtB,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB,CAAC;I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CAAC;IAC/C,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,SAAS,CAAC;IACnB,CAAC;AACH,CAAC"}
@@ -0,0 +1,30 @@
1
+ import type { GitDiffResult, ReportFormat } from "../index.js";
2
+ export declare const ExitCode: {
3
+ readonly Pass: 0;
4
+ readonly FindingsFailed: 1;
5
+ readonly UsageError: 2;
6
+ readonly InternalError: 3;
7
+ };
8
+ export type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
9
+ export interface CheckOptions {
10
+ task: string;
11
+ base?: string;
12
+ format: ReportFormat;
13
+ strict: boolean;
14
+ staged: boolean;
15
+ failOn?: "blocker" | "high" | "medium";
16
+ output?: string;
17
+ }
18
+ export interface CliIo {
19
+ stdout: (message: string) => void;
20
+ stderr: (message: string) => void;
21
+ writeFile: (path: string, content: string) => void;
22
+ chmodFile?: (path: string, mode: number) => void;
23
+ now: () => Date;
24
+ readDiff: (baseRef?: string, options?: {
25
+ staged?: boolean;
26
+ }) => GitDiffResult;
27
+ exists?: (path: string) => boolean;
28
+ readFile?: (path: string) => string;
29
+ }
30
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE/D,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAEhE,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,YAAY,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;IACvC,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,KAAK;IACpB,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjD,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,KAAK,aAAa,CAAC;IAC9E,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IACnC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACrC"}
@@ -0,0 +1,7 @@
1
+ export const ExitCode = {
2
+ Pass: 0,
3
+ FindingsFailed: 1,
4
+ UsageError: 2,
5
+ InternalError: 3
6
+ };
7
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/cli/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,IAAI,EAAE,CAAC;IACP,cAAc,EAAE,CAAC;IACjB,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;CACR,CAAC"}
package/dist/cli.d.ts CHANGED
@@ -1,26 +1,13 @@
1
1
  #!/usr/bin/env node
2
- import { type GitDiffResult } from "./index.js";
3
- export declare const CLI_VERSION = "2.1.1";
2
+ import type { CheckOptions, CliIo, ExitCode as ExitCodeTypeInternal } from "./cli/types.js";
3
+ export { isCliEntrypoint } from "./cli/entrypoint.js";
4
+ export { CLI_VERSION, main } from "./cli/main.js";
4
5
  export declare const ExitCode: {
5
6
  readonly Pass: 0;
6
7
  readonly FindingsFailed: 1;
7
8
  readonly UsageError: 2;
8
9
  readonly InternalError: 3;
9
10
  };
10
- export type ExitCode = (typeof ExitCode)[keyof typeof ExitCode];
11
- interface CliIo {
12
- stdout: (message: string) => void;
13
- stderr: (message: string) => void;
14
- writeFile: (path: string, content: string) => void;
15
- chmodFile?: (path: string, mode: number) => void;
16
- now: () => Date;
17
- readDiff: (baseRef?: string, options?: {
18
- staged?: boolean;
19
- }) => GitDiffResult;
20
- exists?: (path: string) => boolean;
21
- readFile?: (path: string) => string;
22
- }
23
- export declare function main(argv?: string[], io?: CliIo): ExitCode;
24
- export declare function isCliEntrypoint(importMetaUrl: string, argvPath?: string): boolean;
25
- export {};
11
+ export type { CheckOptions, CliIo };
12
+ export type ExitCode = ExitCodeTypeInternal;
26
13
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAaA,OAAO,EAyBL,KAAK,aAAa,EAEnB,MAAM,YAAY,CAAC;AAEpB,eAAO,MAAM,WAAW,UAAU,CAAC;AAEnC,eAAO,MAAM,QAAQ;;;;;CAKX,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,OAAO,QAAQ,CAAC,CAAC;AAYhE,UAAU,KAAK;IACb,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACnD,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAA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