@standards-kit/conform 0.1.0 → 0.1.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/LICENSE +21 -0
- package/README.md +143 -0
- package/dist/{chunk-P7TIZJ4C.js → chunk-DXIYZR62.js} +2 -2
- package/dist/chunk-DXIYZR62.js.map +1 -0
- package/dist/{chunk-KHO6NIAI.js → chunk-PZ2NVKI7.js} +7 -7
- package/dist/chunk-PZ2NVKI7.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +14 -14
- package/dist/cli.js.map +1 -1
- package/dist/code/index.d.ts +11 -0
- package/dist/code/tools/base.d.ts +51 -0
- package/dist/code/tools/comment-utils.d.ts +17 -0
- package/dist/code/tools/coverage-run.d.ts +37 -0
- package/dist/code/tools/disable-comments.d.ts +42 -0
- package/dist/code/tools/eslint.d.ts +99 -0
- package/dist/code/tools/gitleaks.d.ts +42 -0
- package/dist/code/tools/index.d.ts +13 -0
- package/dist/code/tools/knip.d.ts +20 -0
- package/dist/code/tools/naming.d.ts +64 -0
- package/dist/code/tools/pipaudit.d.ts +24 -0
- package/dist/code/tools/pnpmaudit.d.ts +36 -0
- package/dist/code/tools/ruff.d.ts +46 -0
- package/dist/code/tools/tsc.d.ts +57 -0
- package/dist/code/tools/ty.d.ts +34 -0
- package/dist/code/tools/vulture.d.ts +32 -0
- package/dist/core/index.d.ts +7 -0
- package/dist/core/loader.d.ts +42 -0
- package/dist/core/registry.d.ts +17 -0
- package/dist/core/schema.d.ts +1829 -0
- package/dist/core/types.d.ts +95 -0
- package/dist/{src-KZRTG3EU.js → core-KB2W6SE2.js} +3 -3
- package/dist/dependencies/index.d.ts +13 -0
- package/dist/dependencies/mappings.d.ts +17 -0
- package/dist/dependencies/output.d.ts +12 -0
- package/dist/dependencies/types.d.ts +34 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +9 -5
- package/dist/index.js.map +1 -1
- package/dist/infra/arn.d.ts +16 -0
- package/dist/infra/checkers/cloudwatch.d.ts +8 -0
- package/dist/infra/checkers/dynamodb.d.ts +8 -0
- package/dist/infra/checkers/ec2.d.ts +13 -0
- package/dist/infra/checkers/ecs.d.ts +13 -0
- package/dist/infra/checkers/elasticache.d.ts +13 -0
- package/dist/infra/checkers/elb.d.ts +13 -0
- package/dist/infra/checkers/gcp/artifactregistry.d.ts +5 -0
- package/dist/infra/checkers/gcp/cloudrun.d.ts +5 -0
- package/dist/infra/checkers/gcp/iam.d.ts +5 -0
- package/dist/infra/checkers/gcp/index.d.ts +17 -0
- package/dist/infra/checkers/gcp/secretmanager.d.ts +5 -0
- package/dist/infra/checkers/iam.d.ts +8 -0
- package/dist/infra/checkers/index.d.ts +26 -0
- package/dist/infra/checkers/lambda.d.ts +8 -0
- package/dist/infra/checkers/rds.d.ts +13 -0
- package/dist/infra/checkers/s3.d.ts +8 -0
- package/dist/infra/checkers/secretsmanager.d.ts +8 -0
- package/dist/infra/checkers/sns.d.ts +8 -0
- package/dist/infra/checkers/sqs.d.ts +8 -0
- package/dist/infra/checkers/types.d.ts +28 -0
- package/dist/infra/gcp.d.ts +18 -0
- package/dist/infra/generate.d.ts +74 -0
- package/dist/infra/index.d.ts +59 -0
- package/dist/infra/manifest.d.ts +58 -0
- package/dist/infra/output.d.ts +8 -0
- package/dist/infra/scan.d.ts +25 -0
- package/dist/infra/schemas.d.ts +806 -0
- package/dist/infra/types.d.ts +8 -0
- package/dist/{infra-UXM5XQX3.js → infra-ZQRXX7AW.js} +3 -3
- package/dist/infra-ZQRXX7AW.js.map +1 -0
- package/dist/mcp/index.d.ts +7 -0
- package/dist/mcp/server.d.ts +18 -0
- package/dist/mcp/standards/fetcher.d.ts +29 -0
- package/dist/mcp/standards/index.d.ts +4 -0
- package/dist/mcp/standards/matcher.d.ts +22 -0
- package/dist/mcp/standards/parser.d.ts +46 -0
- package/dist/mcp/standards/types.d.ts +32 -0
- package/dist/mcp/tools/get-guideline.d.ts +26 -0
- package/dist/mcp/tools/get-ruleset.d.ts +26 -0
- package/dist/mcp/tools/get-standards.d.ts +27 -0
- package/dist/mcp/tools/index.d.ts +4 -0
- package/dist/mcp/tools/list-guidelines.d.ts +25 -0
- package/dist/{mcp-O5O7XVFG.js → mcp-WXYRFNEV.js} +3 -3
- package/dist/mcp-WXYRFNEV.js.map +1 -0
- package/dist/output/index.d.ts +14 -0
- package/dist/process/commands/check-branch.d.ts +13 -0
- package/dist/process/commands/check-commit.d.ts +14 -0
- package/dist/process/commands/index.d.ts +2 -0
- package/dist/process/index.d.ts +11 -0
- package/dist/process/scan/index.d.ts +5 -0
- package/dist/process/scan/remote-fetcher.d.ts +18 -0
- package/dist/process/scan/scanner.d.ts +6 -0
- package/dist/process/scan/types.d.ts +57 -0
- package/dist/process/scan/validators.d.ts +37 -0
- package/dist/process/sync/applier.d.ts +10 -0
- package/dist/process/sync/differ.d.ts +7 -0
- package/dist/process/sync/fetcher.d.ts +14 -0
- package/dist/process/sync/index.d.ts +9 -0
- package/dist/process/sync/types.d.ts +131 -0
- package/dist/process/sync/validator.d.ts +22 -0
- package/dist/process/tools/backups.d.ts +32 -0
- package/dist/process/tools/base.d.ts +52 -0
- package/dist/process/tools/branches.d.ts +41 -0
- package/dist/process/tools/changesets.d.ts +53 -0
- package/dist/process/tools/ci.d.ts +57 -0
- package/dist/process/tools/codeowners.d.ts +68 -0
- package/dist/process/tools/commits.d.ts +39 -0
- package/dist/process/tools/coverage.d.ts +57 -0
- package/dist/process/tools/docs-helpers.d.ts +44 -0
- package/dist/process/tools/docs.d.ts +38 -0
- package/dist/process/tools/forbidden-files.d.ts +40 -0
- package/dist/process/tools/hooks.d.ts +39 -0
- package/dist/process/tools/index.d.ts +14 -0
- package/dist/process/tools/pr.d.ts +59 -0
- package/dist/process/tools/repo.d.ts +65 -0
- package/dist/process/tools/tickets.d.ts +42 -0
- package/dist/projects/detector.d.ts +16 -0
- package/dist/projects/index.d.ts +4 -0
- package/dist/projects/templates.d.ts +15 -0
- package/dist/projects/tier-loader.d.ts +14 -0
- package/dist/projects/types.d.ts +76 -0
- package/dist/{registry-V65CC7IN.js → registry-7CDIMOLZ.js} +2 -2
- package/dist/{scan-EELS42BP.js → scan-IKEHLZXV.js} +4 -4
- package/dist/{scan-EELS42BP.js.map → scan-IKEHLZXV.js.map} +1 -1
- package/dist/{sync-RLYBGYNY.js → sync-XV6XBLVZ.js} +3 -3
- package/dist/{sync-RLYBGYNY.js.map → sync-XV6XBLVZ.js.map} +1 -1
- package/dist/validate/guidelines.d.ts +18 -0
- package/dist/validate/index.d.ts +5 -0
- package/dist/validate/tier.d.ts +14 -0
- package/dist/validate/types.d.ts +56 -0
- package/dist/{validate-AABLVQJS.js → validate-DKEJICCK.js} +3 -3
- package/dist/validate-DKEJICCK.js.map +1 -0
- package/package.json +26 -19
- package/dist/chunk-KHO6NIAI.js.map +0 -1
- package/dist/chunk-P7TIZJ4C.js.map +0 -1
- package/dist/infra-UXM5XQX3.js.map +0 -1
- package/dist/mcp-O5O7XVFG.js.map +0 -1
- package/dist/validate-AABLVQJS.js.map +0 -1
- /package/dist/{registry-V65CC7IN.js.map → core-KB2W6SE2.js.map} +0 -0
- /package/dist/{src-KZRTG3EU.js.map → registry-7CDIMOLZ.js.map} +0 -0
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { type Config } from "../../core/index.js";
|
|
2
|
+
import { type Violation } from "../../core/index.js";
|
|
3
|
+
/** GitHub Ruleset response types */
|
|
4
|
+
interface RulesetBypassActor {
|
|
5
|
+
actor_id: number | null;
|
|
6
|
+
actor_type: string;
|
|
7
|
+
bypass_mode: string;
|
|
8
|
+
}
|
|
9
|
+
interface RulesetRule {
|
|
10
|
+
type: string;
|
|
11
|
+
parameters?: {
|
|
12
|
+
required_approving_review_count?: number;
|
|
13
|
+
dismiss_stale_reviews_on_push?: boolean;
|
|
14
|
+
require_code_owner_review?: boolean;
|
|
15
|
+
required_status_checks?: {
|
|
16
|
+
context: string;
|
|
17
|
+
}[];
|
|
18
|
+
strict_required_status_checks_policy?: boolean;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface RulesetResponse {
|
|
22
|
+
id: number;
|
|
23
|
+
name: string;
|
|
24
|
+
target: string;
|
|
25
|
+
enforcement: string;
|
|
26
|
+
conditions?: {
|
|
27
|
+
ref_name?: {
|
|
28
|
+
include?: string[];
|
|
29
|
+
exclude?: string[];
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
bypass_actors?: RulesetBypassActor[];
|
|
33
|
+
rules?: RulesetRule[];
|
|
34
|
+
}
|
|
35
|
+
/** Validate rulesets against config */
|
|
36
|
+
export declare function validateRulesets(rulesets: RulesetResponse[], repoConfig: NonNullable<Config["process"]>["repo"]): Violation[];
|
|
37
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DesiredBranchProtection, type DesiredTagProtection, type RepoInfo, type SyncDiffResult, type SyncResult, type TagProtectionDiffResult } from "./types.js";
|
|
2
|
+
/** Error thrown when applier encounters an issue */
|
|
3
|
+
export declare class ApplierError extends Error {
|
|
4
|
+
readonly code: "NO_PERMISSION" | "API_ERROR";
|
|
5
|
+
constructor(message: string, code: "NO_PERMISSION" | "API_ERROR");
|
|
6
|
+
}
|
|
7
|
+
/** Apply branch protection ruleset to GitHub */
|
|
8
|
+
export declare function applyBranchProtection(repoInfo: RepoInfo, branch: string, desired: DesiredBranchProtection, diffResult: SyncDiffResult): Promise<SyncResult>;
|
|
9
|
+
/** Apply tag protection ruleset to GitHub */
|
|
10
|
+
export declare function applyTagProtection(repoInfo: RepoInfo, desired: DesiredTagProtection, diffResult: TagProtectionDiffResult): Promise<SyncResult>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { type BranchProtectionSettings, type DesiredBranchProtection, type DesiredTagProtection, type RepoInfo, type SyncDiffResult, type TagProtectionDiffResult, type TagProtectionSettings } from "./types.js";
|
|
2
|
+
/** Compare current settings with desired and generate diffs */
|
|
3
|
+
export declare function computeDiff(repoInfo: RepoInfo, current: BranchProtectionSettings, desired: DesiredBranchProtection): SyncDiffResult;
|
|
4
|
+
/** Format a value for display */
|
|
5
|
+
export declare function formatValue(value: unknown): string;
|
|
6
|
+
/** Compare current tag protection with desired and generate diffs */
|
|
7
|
+
export declare function computeTagDiff(repoInfo: RepoInfo, current: TagProtectionSettings, desired: DesiredTagProtection): TagProtectionDiffResult;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { type BranchProtectionSettings, type RepoInfo, type TagProtectionSettings } from "./types.js";
|
|
2
|
+
/** Error thrown when fetcher encounters an issue */
|
|
3
|
+
export declare class FetcherError extends Error {
|
|
4
|
+
readonly code: "NO_GH" | "NO_REPO" | "NO_PERMISSION" | "API_ERROR";
|
|
5
|
+
constructor(message: string, code: "NO_GH" | "NO_REPO" | "NO_PERMISSION" | "API_ERROR");
|
|
6
|
+
}
|
|
7
|
+
/** Check if gh CLI is available */
|
|
8
|
+
export declare function isGhAvailable(): Promise<boolean>;
|
|
9
|
+
/** Get repository info from git remote */
|
|
10
|
+
export declare function getRepoInfo(projectRoot: string): Promise<RepoInfo>;
|
|
11
|
+
/** Fetch current branch protection settings from GitHub Rulesets */
|
|
12
|
+
export declare function fetchBranchProtection(repoInfo: RepoInfo, branch: string): Promise<BranchProtectionSettings>;
|
|
13
|
+
/** Fetch current tag protection rulesets from GitHub */
|
|
14
|
+
export declare function fetchTagProtection(repoInfo: RepoInfo): Promise<TagProtectionSettings>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type SyncOptions } from "./types.js";
|
|
2
|
+
/** Run diff command - show what would change */
|
|
3
|
+
export declare function runDiff(options: SyncOptions): Promise<void>;
|
|
4
|
+
/** Run sync command - apply changes (or preview if --apply not set) */
|
|
5
|
+
export declare function runSync(options: SyncOptions): Promise<void>;
|
|
6
|
+
/** Run tag protection diff command - show what would change */
|
|
7
|
+
export declare function runTagDiff(options: SyncOptions): Promise<void>;
|
|
8
|
+
/** Run tag protection sync command - apply changes (or preview if --apply not set) */
|
|
9
|
+
export declare function runTagSync(options: SyncOptions): Promise<void>;
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/** Bypass actor type for GitHub Rulesets */
|
|
2
|
+
export type BypassActorType = "Integration" | "OrganizationAdmin" | "RepositoryRole" | "Team" | "DeployKey";
|
|
3
|
+
/** Bypass mode - when the actor can bypass */
|
|
4
|
+
export type BypassMode = "always" | "pull_request";
|
|
5
|
+
/** Single bypass actor configuration */
|
|
6
|
+
export interface BypassActor {
|
|
7
|
+
actor_type: BypassActorType;
|
|
8
|
+
actor_id?: number;
|
|
9
|
+
bypass_mode?: BypassMode;
|
|
10
|
+
}
|
|
11
|
+
/** Current branch protection settings from GitHub Ruleset */
|
|
12
|
+
export interface BranchProtectionSettings {
|
|
13
|
+
branch: string;
|
|
14
|
+
requiredReviews: number | null;
|
|
15
|
+
dismissStaleReviews: boolean | null;
|
|
16
|
+
requireCodeOwnerReviews: boolean | null;
|
|
17
|
+
requiredStatusChecks: string[] | null;
|
|
18
|
+
requireBranchesUpToDate: boolean | null;
|
|
19
|
+
requireSignedCommits: boolean | null;
|
|
20
|
+
enforceAdmins: boolean | null;
|
|
21
|
+
bypassActors: BypassActor[] | null;
|
|
22
|
+
rulesetId: number | null;
|
|
23
|
+
rulesetName: string | null;
|
|
24
|
+
}
|
|
25
|
+
/** A single setting difference */
|
|
26
|
+
export interface SettingDiff {
|
|
27
|
+
setting: string;
|
|
28
|
+
current: unknown;
|
|
29
|
+
desired: unknown;
|
|
30
|
+
action: "add" | "change";
|
|
31
|
+
}
|
|
32
|
+
/** Result of comparing current vs. desired settings */
|
|
33
|
+
export interface SyncDiffResult {
|
|
34
|
+
repoInfo: {
|
|
35
|
+
owner: string;
|
|
36
|
+
repo: string;
|
|
37
|
+
};
|
|
38
|
+
branch: string;
|
|
39
|
+
diffs: SettingDiff[];
|
|
40
|
+
hasChanges: boolean;
|
|
41
|
+
currentRulesetId: number | null;
|
|
42
|
+
}
|
|
43
|
+
/** Result of applying sync changes */
|
|
44
|
+
export interface SyncResult {
|
|
45
|
+
success: boolean;
|
|
46
|
+
applied: SettingDiff[];
|
|
47
|
+
failed: {
|
|
48
|
+
diff: SettingDiff;
|
|
49
|
+
error: string;
|
|
50
|
+
}[];
|
|
51
|
+
}
|
|
52
|
+
/** Options for sync/diff commands */
|
|
53
|
+
export interface SyncOptions {
|
|
54
|
+
config?: string;
|
|
55
|
+
format: "text" | "json";
|
|
56
|
+
apply?: boolean;
|
|
57
|
+
validateActors?: boolean;
|
|
58
|
+
}
|
|
59
|
+
/** Repository info */
|
|
60
|
+
export interface RepoInfo {
|
|
61
|
+
owner: string;
|
|
62
|
+
repo: string;
|
|
63
|
+
}
|
|
64
|
+
/** Desired branch protection settings from config */
|
|
65
|
+
export interface DesiredBranchProtection {
|
|
66
|
+
branch?: string;
|
|
67
|
+
required_reviews?: number;
|
|
68
|
+
dismiss_stale_reviews?: boolean;
|
|
69
|
+
require_code_owner_reviews?: boolean;
|
|
70
|
+
require_status_checks?: string[];
|
|
71
|
+
require_branches_up_to_date?: boolean;
|
|
72
|
+
require_signed_commits?: boolean;
|
|
73
|
+
enforce_admins?: boolean;
|
|
74
|
+
bypass_actors?: BypassActor[];
|
|
75
|
+
}
|
|
76
|
+
/** GitHub Ruleset bypass actor from API */
|
|
77
|
+
export interface GitHubRulesetBypassActor {
|
|
78
|
+
actor_id: number | null;
|
|
79
|
+
actor_type: BypassActorType;
|
|
80
|
+
bypass_mode: BypassMode;
|
|
81
|
+
}
|
|
82
|
+
/** GitHub Ruleset rule types */
|
|
83
|
+
export type GitHubRulesetRuleType = "deletion" | "update" | "creation" | "pull_request" | "required_status_checks" | "required_signatures" | string;
|
|
84
|
+
/** GitHub Ruleset response */
|
|
85
|
+
export interface GitHubRuleset {
|
|
86
|
+
id: number;
|
|
87
|
+
name: string;
|
|
88
|
+
target: "branch" | "tag";
|
|
89
|
+
enforcement: "active" | "evaluate" | "disabled";
|
|
90
|
+
conditions?: {
|
|
91
|
+
ref_name?: {
|
|
92
|
+
include?: string[];
|
|
93
|
+
exclude?: string[];
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
bypass_actors?: GitHubRulesetBypassActor[];
|
|
97
|
+
rules?: {
|
|
98
|
+
type: GitHubRulesetRuleType;
|
|
99
|
+
parameters?: {
|
|
100
|
+
required_approving_review_count?: number;
|
|
101
|
+
dismiss_stale_reviews_on_push?: boolean;
|
|
102
|
+
require_code_owner_review?: boolean;
|
|
103
|
+
required_status_checks?: {
|
|
104
|
+
context: string;
|
|
105
|
+
}[];
|
|
106
|
+
strict_required_status_checks_policy?: boolean;
|
|
107
|
+
[key: string]: unknown;
|
|
108
|
+
};
|
|
109
|
+
}[];
|
|
110
|
+
}
|
|
111
|
+
/** Current tag protection settings from GitHub */
|
|
112
|
+
export interface TagProtectionSettings {
|
|
113
|
+
patterns: string[];
|
|
114
|
+
preventDeletion: boolean;
|
|
115
|
+
preventUpdate: boolean;
|
|
116
|
+
rulesetId: number | null;
|
|
117
|
+
rulesetName: string | null;
|
|
118
|
+
}
|
|
119
|
+
/** Desired tag protection settings from config */
|
|
120
|
+
export interface DesiredTagProtection {
|
|
121
|
+
patterns?: string[];
|
|
122
|
+
prevent_deletion?: boolean;
|
|
123
|
+
prevent_update?: boolean;
|
|
124
|
+
}
|
|
125
|
+
/** Tag protection diff result */
|
|
126
|
+
export interface TagProtectionDiffResult {
|
|
127
|
+
repoInfo: RepoInfo;
|
|
128
|
+
diffs: SettingDiff[];
|
|
129
|
+
hasChanges: boolean;
|
|
130
|
+
currentRulesetId: number | null;
|
|
131
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type RepoInfo } from "./types.js";
|
|
2
|
+
/** Bypass actor configuration from standards.toml */
|
|
3
|
+
export interface BypassActorConfig {
|
|
4
|
+
actor_type: "Integration" | "OrganizationAdmin" | "RepositoryRole" | "Team" | "DeployKey";
|
|
5
|
+
actor_id?: number;
|
|
6
|
+
bypass_mode?: "always" | "pull_request";
|
|
7
|
+
}
|
|
8
|
+
/** Validation error for a single actor */
|
|
9
|
+
export interface ActorValidationError {
|
|
10
|
+
actor: BypassActorConfig;
|
|
11
|
+
error: string;
|
|
12
|
+
}
|
|
13
|
+
/** Result of validating bypass actors */
|
|
14
|
+
export interface ValidationResult {
|
|
15
|
+
valid: boolean;
|
|
16
|
+
errors: ActorValidationError[];
|
|
17
|
+
warnings: string[];
|
|
18
|
+
}
|
|
19
|
+
/** Validate bypass actors against GitHub API */
|
|
20
|
+
export declare function validateBypassActors(repoInfo: RepoInfo, actors: BypassActorConfig[]): Promise<ValidationResult>;
|
|
21
|
+
/** Format validation result for display */
|
|
22
|
+
export declare function formatValidationResult(result: ValidationResult): string;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { S3Client } from "@aws-sdk/client-s3";
|
|
2
|
+
import { type CheckResult } from "../../core/index.js";
|
|
3
|
+
import { BaseProcessToolRunner } from "./base.js";
|
|
4
|
+
/** Backups configuration */
|
|
5
|
+
interface BackupsConfig {
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
bucket?: string;
|
|
8
|
+
prefix?: string;
|
|
9
|
+
max_age_hours?: number;
|
|
10
|
+
region?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Runner for S3 backup verification.
|
|
14
|
+
* Checks that backups exist in S3 and are recent.
|
|
15
|
+
*/
|
|
16
|
+
export declare class BackupsRunner extends BaseProcessToolRunner {
|
|
17
|
+
readonly name = "Backups";
|
|
18
|
+
readonly rule = "process.backups";
|
|
19
|
+
readonly toolId = "backups";
|
|
20
|
+
private config;
|
|
21
|
+
private s3Client;
|
|
22
|
+
setConfig(config: BackupsConfig): void;
|
|
23
|
+
/** Allow injecting S3 client for testing */
|
|
24
|
+
setS3Client(client: S3Client): void;
|
|
25
|
+
run(_projectRoot: string): Promise<CheckResult>;
|
|
26
|
+
private checkBackups;
|
|
27
|
+
private getS3Client;
|
|
28
|
+
private createExistsViolation;
|
|
29
|
+
private checkBackupRecency;
|
|
30
|
+
private findMostRecentBackup;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type CheckResult, type IToolRunner, type Violation } from "../../core/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Abstract base class for process tool runners.
|
|
4
|
+
* Provides common functionality for checking files and directories.
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseProcessToolRunner implements IToolRunner {
|
|
7
|
+
abstract readonly name: string;
|
|
8
|
+
abstract readonly rule: string;
|
|
9
|
+
abstract readonly toolId: string;
|
|
10
|
+
/** Process tools don't have config files in the same way code tools do */
|
|
11
|
+
readonly configFiles: string[];
|
|
12
|
+
/**
|
|
13
|
+
* Check if a directory exists
|
|
14
|
+
*/
|
|
15
|
+
protected directoryExists(projectRoot: string, dirPath: string): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Check if a file exists
|
|
18
|
+
*/
|
|
19
|
+
protected fileExists(projectRoot: string, filePath: string): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Read file contents
|
|
22
|
+
*/
|
|
23
|
+
protected readFile(projectRoot: string, filePath: string): string | null;
|
|
24
|
+
/**
|
|
25
|
+
* Check if a file contains a specific string/pattern
|
|
26
|
+
*/
|
|
27
|
+
protected fileContains(projectRoot: string, filePath: string, pattern: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Create a pass result
|
|
30
|
+
*/
|
|
31
|
+
protected pass(duration: number): CheckResult;
|
|
32
|
+
/**
|
|
33
|
+
* Create a fail result from violations
|
|
34
|
+
*/
|
|
35
|
+
protected fail(violations: Violation[], duration: number): CheckResult;
|
|
36
|
+
/**
|
|
37
|
+
* Create a result from violations (pass if empty, fail otherwise)
|
|
38
|
+
*/
|
|
39
|
+
protected fromViolations(violations: Violation[], duration: number): CheckResult;
|
|
40
|
+
/**
|
|
41
|
+
* Create a skip result
|
|
42
|
+
*/
|
|
43
|
+
protected skip(reason: string, duration: number): CheckResult;
|
|
44
|
+
/**
|
|
45
|
+
* Run the tool - must be implemented by subclasses
|
|
46
|
+
*/
|
|
47
|
+
abstract run(projectRoot: string): Promise<CheckResult>;
|
|
48
|
+
/**
|
|
49
|
+
* Audit the tool - by default same as run for process tools
|
|
50
|
+
*/
|
|
51
|
+
audit(projectRoot: string): Promise<CheckResult>;
|
|
52
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type CheckResult } from "../../core/index.js";
|
|
2
|
+
import { BaseProcessToolRunner } from "./base.js";
|
|
3
|
+
/** Branches configuration from standards.toml */
|
|
4
|
+
interface BranchesConfig {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
pattern?: string;
|
|
7
|
+
exclude?: string[];
|
|
8
|
+
require_issue?: boolean;
|
|
9
|
+
issue_pattern?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Branch naming validation runner.
|
|
13
|
+
* Checks that the current git branch name matches a required pattern.
|
|
14
|
+
*/
|
|
15
|
+
export declare class BranchesRunner extends BaseProcessToolRunner {
|
|
16
|
+
readonly name = "Branches";
|
|
17
|
+
readonly rule = "process.branches";
|
|
18
|
+
readonly toolId = "branches";
|
|
19
|
+
private config;
|
|
20
|
+
/**
|
|
21
|
+
* Set configuration from standards.toml
|
|
22
|
+
*/
|
|
23
|
+
setConfig(config: BranchesConfig): void;
|
|
24
|
+
/** Get the current git branch name */
|
|
25
|
+
private getCurrentBranch;
|
|
26
|
+
/** Check if branch is excluded from validation */
|
|
27
|
+
private isExcluded;
|
|
28
|
+
/** Validate branch name against pattern */
|
|
29
|
+
private validateBranchPattern;
|
|
30
|
+
/** Extract issue number from branch name */
|
|
31
|
+
private extractIssueNumber;
|
|
32
|
+
/** Validate that branch contains issue reference */
|
|
33
|
+
private validateIssueReference;
|
|
34
|
+
/** Check if any validation is configured */
|
|
35
|
+
private hasValidationConfigured;
|
|
36
|
+
/** Collect violations from all validations */
|
|
37
|
+
private collectViolations;
|
|
38
|
+
/** Run branch naming validation */
|
|
39
|
+
run(projectRoot: string): Promise<CheckResult>;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type CheckResult } from "../../core/index.js";
|
|
2
|
+
import { BaseProcessToolRunner } from "./base.js";
|
|
3
|
+
/** Valid changeset bump types */
|
|
4
|
+
type BumpType = "patch" | "minor" | "major";
|
|
5
|
+
/** Changesets configuration from standards.toml */
|
|
6
|
+
interface ChangesetsConfig {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
require_for_paths?: string[];
|
|
9
|
+
exclude_paths?: string[];
|
|
10
|
+
validate_format?: boolean;
|
|
11
|
+
allowed_bump_types?: BumpType[];
|
|
12
|
+
require_description?: boolean;
|
|
13
|
+
min_description_length?: number;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Changeset validation runner.
|
|
17
|
+
* Validates that changeset files exist and are properly formatted.
|
|
18
|
+
*/
|
|
19
|
+
export declare class ChangesetsRunner extends BaseProcessToolRunner {
|
|
20
|
+
readonly name = "Changesets";
|
|
21
|
+
readonly rule = "process.changesets";
|
|
22
|
+
readonly toolId = "changesets";
|
|
23
|
+
private config;
|
|
24
|
+
/**
|
|
25
|
+
* Set configuration from standards.toml
|
|
26
|
+
*/
|
|
27
|
+
setConfig(config: ChangesetsConfig): void;
|
|
28
|
+
/** Get list of changeset files (excluding config.json) */
|
|
29
|
+
private getChangesetFiles;
|
|
30
|
+
/** Parse a changeset file and extract frontmatter and description */
|
|
31
|
+
private parseChangesetFile;
|
|
32
|
+
/** Parse changeset content and populate result */
|
|
33
|
+
private parseChangesetContent;
|
|
34
|
+
/** Get files changed in current branch vs main/master */
|
|
35
|
+
private getChangedFiles;
|
|
36
|
+
/** Check if any changed files match the require_for_paths patterns */
|
|
37
|
+
private hasChangesRequiringChangeset;
|
|
38
|
+
/** Validate changeset format (packages in frontmatter) */
|
|
39
|
+
private validateFormat;
|
|
40
|
+
/** Validate bump types against allowed list */
|
|
41
|
+
private validateBumpTypes;
|
|
42
|
+
/** Validate description requirements */
|
|
43
|
+
private validateDescription;
|
|
44
|
+
/** Validate a single changeset file */
|
|
45
|
+
private validateChangeset;
|
|
46
|
+
/** Check if changeset directory exists */
|
|
47
|
+
private checkDirectoryExists;
|
|
48
|
+
/** Check if changes require a changeset */
|
|
49
|
+
private checkChangesRequireChangeset;
|
|
50
|
+
/** Run changeset validation */
|
|
51
|
+
run(projectRoot: string): Promise<CheckResult>;
|
|
52
|
+
}
|
|
53
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type CheckResult } from "../../core/index.js";
|
|
2
|
+
import { BaseProcessToolRunner } from "./base.js";
|
|
3
|
+
/** Commands configuration value - workflow-level or job-level */
|
|
4
|
+
type CommandsValue = string[] | Record<string, string[]>;
|
|
5
|
+
/** CI configuration from standards.toml */
|
|
6
|
+
interface CiConfig {
|
|
7
|
+
enabled?: boolean;
|
|
8
|
+
require_workflows?: string[];
|
|
9
|
+
jobs?: Record<string, string[]>;
|
|
10
|
+
actions?: Record<string, string[]>;
|
|
11
|
+
commands?: Record<string, CommandsValue>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* CI/CD workflow validation runner.
|
|
15
|
+
* Checks that GitHub Actions workflows exist and contain required jobs/actions/commands.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CiRunner extends BaseProcessToolRunner {
|
|
18
|
+
readonly name = "CI";
|
|
19
|
+
readonly rule = "process.ci";
|
|
20
|
+
readonly toolId = "ci";
|
|
21
|
+
private config;
|
|
22
|
+
setConfig(config: CiConfig): void;
|
|
23
|
+
private checkWorkflowsDirectory;
|
|
24
|
+
private checkRequiredWorkflows;
|
|
25
|
+
private parseWorkflow;
|
|
26
|
+
private triggersPRToMain;
|
|
27
|
+
private isUnconditionalExpression;
|
|
28
|
+
private extractRunCommands;
|
|
29
|
+
private commandMatches;
|
|
30
|
+
/** Check if run content has a commented version of the command */
|
|
31
|
+
private hasCommentedCommand;
|
|
32
|
+
/** Search for a command in a single step */
|
|
33
|
+
private searchCommandInStep;
|
|
34
|
+
private searchCommandInJob;
|
|
35
|
+
private searchCommandInWorkflow;
|
|
36
|
+
private cmdViolation;
|
|
37
|
+
private workflowCmdViolation;
|
|
38
|
+
private jobCmdViolation;
|
|
39
|
+
private checkWorkflowLevelCommands;
|
|
40
|
+
private checkJobLevelCommands;
|
|
41
|
+
private yamlErrorViolation;
|
|
42
|
+
private checkWorkflowCommands;
|
|
43
|
+
private checkRequiredJobs;
|
|
44
|
+
/**
|
|
45
|
+
* Parse a GitHub Actions reference to extract the action name.
|
|
46
|
+
* Handles:
|
|
47
|
+
* - Standard refs: "actions/checkout@v4" -> "actions/checkout"
|
|
48
|
+
* - SHA refs: "actions/checkout@abc123" -> "actions/checkout"
|
|
49
|
+
* - Local actions: "./path/to/action" -> "./path/to/action"
|
|
50
|
+
* - Docker actions: "docker://image:tag" -> null (excluded)
|
|
51
|
+
*/
|
|
52
|
+
private parseActionReference;
|
|
53
|
+
private extractUsedActions;
|
|
54
|
+
private checkRequiredActions;
|
|
55
|
+
run(projectRoot: string): Promise<CheckResult>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type CheckResult } from "../../core/index.js";
|
|
2
|
+
import { BaseProcessToolRunner } from "./base.js";
|
|
3
|
+
/** Single CODEOWNERS rule from config */
|
|
4
|
+
interface CodeownersRule {
|
|
5
|
+
pattern: string;
|
|
6
|
+
owners: string[];
|
|
7
|
+
}
|
|
8
|
+
/** CODEOWNERS configuration */
|
|
9
|
+
interface CodeownersConfig {
|
|
10
|
+
enabled?: boolean;
|
|
11
|
+
rules?: CodeownersRule[];
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Runner for CODEOWNERS file validation.
|
|
15
|
+
* Validates that CODEOWNERS file exists and contains all required rules.
|
|
16
|
+
*/
|
|
17
|
+
export declare class CodeownersRunner extends BaseProcessToolRunner {
|
|
18
|
+
readonly name = "CODEOWNERS";
|
|
19
|
+
readonly rule = "process.codeowners";
|
|
20
|
+
readonly toolId = "codeowners";
|
|
21
|
+
private config;
|
|
22
|
+
setConfig(config: CodeownersConfig): void;
|
|
23
|
+
/**
|
|
24
|
+
* Run check - validates CODEOWNERS content matches config
|
|
25
|
+
*/
|
|
26
|
+
run(projectRoot: string): Promise<CheckResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Audit - just checks that CODEOWNERS file exists
|
|
29
|
+
*/
|
|
30
|
+
audit(projectRoot: string): Promise<CheckResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Find CODEOWNERS file in one of the standard locations
|
|
33
|
+
*/
|
|
34
|
+
private findCodeownersFile;
|
|
35
|
+
/**
|
|
36
|
+
* Parse result including both valid rules and malformed line violations
|
|
37
|
+
*/
|
|
38
|
+
private parseCodeowners;
|
|
39
|
+
/**
|
|
40
|
+
* Parse a single CODEOWNERS line into pattern and owners
|
|
41
|
+
*/
|
|
42
|
+
private parseCodeownersLine;
|
|
43
|
+
/**
|
|
44
|
+
* Validate rules against config
|
|
45
|
+
*/
|
|
46
|
+
private validateRules;
|
|
47
|
+
/**
|
|
48
|
+
* Build a map of parsed rules for quick lookup
|
|
49
|
+
*/
|
|
50
|
+
private buildParsedRuleMap;
|
|
51
|
+
/**
|
|
52
|
+
* Check that all configured rules exist with correct owners
|
|
53
|
+
*/
|
|
54
|
+
private checkMissingRules;
|
|
55
|
+
/**
|
|
56
|
+
* Validate a single config rule against parsed rule
|
|
57
|
+
*/
|
|
58
|
+
private validateConfigRule;
|
|
59
|
+
/**
|
|
60
|
+
* Check for rules in CODEOWNERS that aren't in config
|
|
61
|
+
*/
|
|
62
|
+
private checkExtraRules;
|
|
63
|
+
/**
|
|
64
|
+
* Check if two owner arrays match exactly (order-sensitive)
|
|
65
|
+
*/
|
|
66
|
+
private ownersMatch;
|
|
67
|
+
}
|
|
68
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { type CheckResult } from "../../core/index.js";
|
|
2
|
+
import { BaseProcessToolRunner } from "./base.js";
|
|
3
|
+
/** Commits configuration from standards.toml */
|
|
4
|
+
interface CommitsConfig {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
pattern?: string;
|
|
7
|
+
types?: string[];
|
|
8
|
+
require_scope?: boolean;
|
|
9
|
+
max_subject_length?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Commit message format validation runner.
|
|
13
|
+
* Validates that commit messages follow conventional commit format or custom patterns.
|
|
14
|
+
*/
|
|
15
|
+
export declare class CommitsRunner extends BaseProcessToolRunner {
|
|
16
|
+
readonly name = "Commits";
|
|
17
|
+
readonly rule = "process.commits";
|
|
18
|
+
readonly toolId = "commits";
|
|
19
|
+
private config;
|
|
20
|
+
/**
|
|
21
|
+
* Set configuration from standards.toml
|
|
22
|
+
*/
|
|
23
|
+
setConfig(config: CommitsConfig): void;
|
|
24
|
+
/** Get the HEAD commit message (subject line only) */
|
|
25
|
+
private getHeadCommitSubject;
|
|
26
|
+
/** Build conventional commits pattern from config */
|
|
27
|
+
private buildConventionalPattern;
|
|
28
|
+
/** Check if text matches a pattern */
|
|
29
|
+
private matchesPattern;
|
|
30
|
+
/** Validate the regex pattern is valid */
|
|
31
|
+
private isValidPattern;
|
|
32
|
+
/** Check configuration validity */
|
|
33
|
+
private hasValidConfig;
|
|
34
|
+
/** Validate commit message format */
|
|
35
|
+
private validateCommitFormat;
|
|
36
|
+
/** Run commit message validation */
|
|
37
|
+
run(projectRoot: string): Promise<CheckResult>;
|
|
38
|
+
}
|
|
39
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { type CheckResult } from "../../core/index.js";
|
|
2
|
+
import { BaseProcessToolRunner } from "./base.js";
|
|
3
|
+
/** Coverage configuration from standards.toml */
|
|
4
|
+
interface CoverageConfig {
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
min_threshold?: number;
|
|
7
|
+
enforce_in?: "ci" | "config" | "both";
|
|
8
|
+
ci_workflow?: string;
|
|
9
|
+
ci_job?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Coverage enforcement runner.
|
|
13
|
+
* Checks that coverage thresholds are configured in CI workflows and/or config files.
|
|
14
|
+
*/
|
|
15
|
+
export declare class CoverageRunner extends BaseProcessToolRunner {
|
|
16
|
+
readonly name = "Coverage";
|
|
17
|
+
readonly rule = "process.coverage";
|
|
18
|
+
readonly toolId = "coverage";
|
|
19
|
+
private config;
|
|
20
|
+
/**
|
|
21
|
+
* Set configuration from standards.toml
|
|
22
|
+
*/
|
|
23
|
+
setConfig(config: CoverageConfig): void;
|
|
24
|
+
/** Check for vitest coverage config */
|
|
25
|
+
private checkVitestConfig;
|
|
26
|
+
/** Check jest config file */
|
|
27
|
+
private checkJestConfigFile;
|
|
28
|
+
/** Check jest config in package.json */
|
|
29
|
+
private checkJestPackageJson;
|
|
30
|
+
/** Check for jest coverage config */
|
|
31
|
+
private checkJestConfig;
|
|
32
|
+
/** Check a single nyc config file and return result */
|
|
33
|
+
private checkSingleNycConfig;
|
|
34
|
+
/** Check nyc config file */
|
|
35
|
+
private checkNycConfigFile;
|
|
36
|
+
/** Check nyc config in package.json */
|
|
37
|
+
private checkNycPackageJson;
|
|
38
|
+
/** Check for nyc coverage config */
|
|
39
|
+
private checkNycConfig;
|
|
40
|
+
/** Check for coverage config in any supported tool */
|
|
41
|
+
private checkConfigCoverage;
|
|
42
|
+
/** Check if a step has coverage enforcement */
|
|
43
|
+
private stepHasCoverage;
|
|
44
|
+
/** Check a single job for coverage enforcement */
|
|
45
|
+
private checkJobForCoverage;
|
|
46
|
+
/** Check workflow jobs for coverage */
|
|
47
|
+
private checkWorkflowJobs;
|
|
48
|
+
/** Check for coverage enforcement in CI workflow */
|
|
49
|
+
private checkCiCoverage;
|
|
50
|
+
/** Validate config coverage and add violations if needed */
|
|
51
|
+
private validateConfigCoverage;
|
|
52
|
+
/** Validate CI coverage and add violations if needed */
|
|
53
|
+
private validateCiCoverage;
|
|
54
|
+
/** Run coverage validation */
|
|
55
|
+
run(projectRoot: string): Promise<CheckResult>;
|
|
56
|
+
}
|
|
57
|
+
export {};
|