@standards-kit/conform 0.1.0 → 0.2.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.
- 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-RXA4FO7L.js → chunk-NADY2H35.js} +12 -8
- package/dist/chunk-NADY2H35.js.map +1 -0
- package/dist/chunk-O745CMWG.js +29 -0
- package/dist/chunk-O745CMWG.js.map +1 -0
- package/dist/chunk-RHM53NLG.js +49 -0
- package/dist/chunk-RHM53NLG.js.map +1 -0
- package/dist/{chunk-KHO6NIAI.js → chunk-YGDEM6K5.js} +24 -10
- package/dist/chunk-YGDEM6K5.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +49 -38
- package/dist/cli.js.map +1 -1
- package/dist/{cloudwatch-KSZ4A256.js → cloudwatch-3LTDYG6G.js} +6 -10
- package/dist/cloudwatch-3LTDYG6G.js.map +1 -0
- 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/constants.d.ts +69 -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 +1857 -0
- package/dist/core/types.d.ts +95 -0
- package/dist/{src-KZRTG3EU.js → core-QRFGIQ42.js} +4 -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/{dynamodb-5KVESCVJ.js → dynamodb-HQH3IMAI.js} +6 -10
- package/dist/dynamodb-HQH3IMAI.js.map +1 -0
- package/dist/{ec2-HKPE6GZV.js → ec2-AEPT735A.js} +6 -10
- package/dist/ec2-AEPT735A.js.map +1 -0
- package/dist/{ecs-OS3NJZTA.js → ecs-UHKCH5A7.js} +6 -10
- package/dist/ecs-UHKCH5A7.js.map +1 -0
- package/dist/{elasticache-7TCRHYYM.js → elasticache-5Y6K7GKJ.js} +6 -10
- package/dist/elasticache-5Y6K7GKJ.js.map +1 -0
- package/dist/{elb-PEDLXW5R.js → elb-CN6ELVM5.js} +6 -10
- package/dist/elb-CN6ELVM5.js.map +1 -0
- package/dist/{iam-7H5HFWVQ.js → iam-YXMHK2MV.js} +6 -2
- package/dist/iam-YXMHK2MV.js.map +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +99 -121
- package/dist/index.js.map +1 -1
- package/dist/infra/arn.d.ts +16 -0
- package/dist/infra/checkers/client-factory.d.ts +45 -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-TO54IUSC.js} +21 -19
- package/dist/infra-TO54IUSC.js.map +1 -0
- package/dist/{lambda-NFB5UILT.js → lambda-YTJOCYV5.js} +6 -10
- package/dist/lambda-YTJOCYV5.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-73FZXT3P.js} +5 -4
- package/dist/mcp-73FZXT3P.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 +21 -0
- package/dist/projects/types.d.ts +76 -0
- package/dist/{rds-KLG5O5SI.js → rds-GZ5RVPIU.js} +6 -10
- package/dist/rds-GZ5RVPIU.js.map +1 -0
- package/dist/{registry-V65CC7IN.js → registry-JRCQAIHR.js} +3 -2
- package/dist/{s3-2DH7PRVR.js → s3-53UELUWT.js} +16 -12
- package/dist/s3-53UELUWT.js.map +1 -0
- package/dist/s3-S4GXNR7H.js +53 -0
- package/dist/s3-S4GXNR7H.js.map +1 -0
- package/dist/{scan-EELS42BP.js → scan-RHQWHASY.js} +5 -4
- package/dist/{scan-EELS42BP.js.map → scan-RHQWHASY.js.map} +1 -1
- package/dist/{secretsmanager-MOOIHLAO.js → secretsmanager-FJKTPIXI.js} +6 -10
- package/dist/secretsmanager-FJKTPIXI.js.map +1 -0
- package/dist/{sns-Y36LVTWA.js → sns-RV64OMK2.js} +6 -10
- package/dist/sns-RV64OMK2.js.map +1 -0
- package/dist/{sqs-RRS3GRHK.js → sqs-MHBW6UFC.js} +6 -10
- package/dist/sqs-MHBW6UFC.js.map +1 -0
- package/dist/{standards-RXK5G4IG.js → standards-XAZKTKYJ.js} +3 -2
- package/dist/{sync-RLYBGYNY.js → sync-P3UZECLW.js} +4 -3
- package/dist/{sync-RLYBGYNY.js.map → sync-P3UZECLW.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 +17 -0
- package/dist/validate/types.d.ts +50 -0
- package/dist/{validate-AABLVQJS.js → validate-J5E336GX.js} +53 -84
- package/dist/validate-J5E336GX.js.map +1 -0
- package/package.json +22 -25
- package/dist/chunk-KHO6NIAI.js.map +0 -1
- package/dist/chunk-P7TIZJ4C.js.map +0 -1
- package/dist/chunk-RXA4FO7L.js.map +0 -1
- package/dist/cloudwatch-KSZ4A256.js.map +0 -1
- package/dist/dynamodb-5KVESCVJ.js.map +0 -1
- package/dist/ec2-HKPE6GZV.js.map +0 -1
- package/dist/ecs-OS3NJZTA.js.map +0 -1
- package/dist/elasticache-7TCRHYYM.js.map +0 -1
- package/dist/elb-PEDLXW5R.js.map +0 -1
- package/dist/iam-7H5HFWVQ.js.map +0 -1
- package/dist/infra-UXM5XQX3.js.map +0 -1
- package/dist/lambda-NFB5UILT.js.map +0 -1
- package/dist/mcp-O5O7XVFG.js.map +0 -1
- package/dist/rds-KLG5O5SI.js.map +0 -1
- package/dist/s3-2DH7PRVR.js.map +0 -1
- package/dist/secretsmanager-MOOIHLAO.js.map +0 -1
- package/dist/sns-Y36LVTWA.js.map +0 -1
- package/dist/sqs-RRS3GRHK.js.map +0 -1
- package/dist/validate-AABLVQJS.js.map +0 -1
- /package/dist/{registry-V65CC7IN.js.map → core-QRFGIQ42.js.map} +0 -0
- /package/dist/{src-KZRTG3EU.js.map → registry-JRCQAIHR.js.map} +0 -0
- /package/dist/{standards-RXK5G4IG.js.map → standards-XAZKTKYJ.js.map} +0 -0
package/dist/index.js
CHANGED
|
@@ -14,8 +14,9 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
CheckResultBuilder,
|
|
16
16
|
DomainResultBuilder,
|
|
17
|
-
ExitCode
|
|
18
|
-
|
|
17
|
+
ExitCode,
|
|
18
|
+
ViolationBuilder
|
|
19
|
+
} from "./chunk-DXIYZR62.js";
|
|
19
20
|
import {
|
|
20
21
|
ConfigError,
|
|
21
22
|
DEFAULT_FORBIDDEN_FILES_IGNORE,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
getProjectRoot,
|
|
26
27
|
loadConfig,
|
|
27
28
|
loadConfigAsync
|
|
28
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-YGDEM6K5.js";
|
|
29
30
|
import {
|
|
30
31
|
AccountIdSchema,
|
|
31
32
|
AccountKeySchema,
|
|
@@ -70,6 +71,14 @@ import {
|
|
|
70
71
|
validateMultiAccountManifest,
|
|
71
72
|
validateStackExport
|
|
72
73
|
} from "./chunk-M7G73Q6P.js";
|
|
74
|
+
import {
|
|
75
|
+
AWS_DEFAULTS,
|
|
76
|
+
CACHE,
|
|
77
|
+
CONCURRENCY,
|
|
78
|
+
GITHUB_API,
|
|
79
|
+
STANDARDS_REPO,
|
|
80
|
+
TIMEOUTS
|
|
81
|
+
} from "./chunk-RHM53NLG.js";
|
|
73
82
|
|
|
74
83
|
// src/code/tools/base.ts
|
|
75
84
|
import * as fs from "fs";
|
|
@@ -401,7 +410,7 @@ var CoverageRunRunner = class extends BaseToolRunner {
|
|
|
401
410
|
const result = await execa(testCommand.cmd, testCommand.args, {
|
|
402
411
|
cwd: projectRoot,
|
|
403
412
|
reject: false,
|
|
404
|
-
timeout:
|
|
413
|
+
timeout: TIMEOUTS.codeToolExtended,
|
|
405
414
|
env: { ...process.env, CI: "true" }
|
|
406
415
|
});
|
|
407
416
|
return { exitCode: result.exitCode, stderr: result.stderr, stdout: result.stdout };
|
|
@@ -902,7 +911,7 @@ var ESLintRunner = class extends BaseToolRunner {
|
|
|
902
911
|
const result = await execa2("npx", ["eslint", ...args], {
|
|
903
912
|
cwd: projectRoot,
|
|
904
913
|
reject: false,
|
|
905
|
-
timeout:
|
|
914
|
+
timeout: TIMEOUTS.codeTool
|
|
906
915
|
});
|
|
907
916
|
const violations = this.parseOutput(result.stdout, projectRoot);
|
|
908
917
|
if (violations === null && result.exitCode !== 0 && result.stderr) {
|
|
@@ -986,7 +995,7 @@ var ESLintRunner = class extends BaseToolRunner {
|
|
|
986
995
|
const result = await execa2("npx", ["eslint", "--print-config", sampleFile], {
|
|
987
996
|
cwd: projectRoot,
|
|
988
997
|
reject: false,
|
|
989
|
-
timeout:
|
|
998
|
+
timeout: TIMEOUTS.quick
|
|
990
999
|
});
|
|
991
1000
|
if (result.exitCode !== 0) {
|
|
992
1001
|
return { error: `Failed to read ESLint config: ${result.stderr || "Unknown error"}` };
|
|
@@ -1310,7 +1319,7 @@ var GitleaksRunner = class extends BaseToolRunner {
|
|
|
1310
1319
|
const result = await execa3("gitleaks", args, {
|
|
1311
1320
|
cwd: projectRoot,
|
|
1312
1321
|
reject: false,
|
|
1313
|
-
timeout:
|
|
1322
|
+
timeout: TIMEOUTS.codeTool
|
|
1314
1323
|
});
|
|
1315
1324
|
return this.processResult(result, elapsed);
|
|
1316
1325
|
} catch (error) {
|
|
@@ -1390,7 +1399,7 @@ var GitleaksRunner = class extends BaseToolRunner {
|
|
|
1390
1399
|
await execa3("gitleaks", ["version"], {
|
|
1391
1400
|
cwd: projectRoot,
|
|
1392
1401
|
reject: true,
|
|
1393
|
-
timeout:
|
|
1402
|
+
timeout: TIMEOUTS.versionCheck
|
|
1394
1403
|
});
|
|
1395
1404
|
return this.pass(Date.now() - startTime);
|
|
1396
1405
|
} catch (error) {
|
|
@@ -1427,7 +1436,7 @@ var KnipRunner = class extends BaseToolRunner {
|
|
|
1427
1436
|
const result = await execa4("npx", ["knip", "--reporter", "json"], {
|
|
1428
1437
|
cwd: projectRoot,
|
|
1429
1438
|
reject: false,
|
|
1430
|
-
timeout:
|
|
1439
|
+
timeout: TIMEOUTS.codeTool
|
|
1431
1440
|
});
|
|
1432
1441
|
const output = result.stdout || result.stderr;
|
|
1433
1442
|
const violations = this.parseOutput(output, projectRoot);
|
|
@@ -1889,13 +1898,13 @@ var PipAuditRunner = class extends BaseToolRunner {
|
|
|
1889
1898
|
return await execa5("uvx", args, {
|
|
1890
1899
|
cwd: projectRoot,
|
|
1891
1900
|
reject: false,
|
|
1892
|
-
timeout:
|
|
1901
|
+
timeout: TIMEOUTS.codeTool
|
|
1893
1902
|
});
|
|
1894
1903
|
} catch {
|
|
1895
1904
|
return await execa5("pip-audit", args.slice(1), {
|
|
1896
1905
|
cwd: projectRoot,
|
|
1897
1906
|
reject: false,
|
|
1898
|
-
timeout:
|
|
1907
|
+
timeout: TIMEOUTS.codeTool
|
|
1899
1908
|
});
|
|
1900
1909
|
}
|
|
1901
1910
|
}
|
|
@@ -2012,7 +2021,7 @@ var PnpmAuditRunner = class extends BaseToolRunner {
|
|
|
2012
2021
|
const result = await execa6("pnpm", args, {
|
|
2013
2022
|
cwd: projectRoot,
|
|
2014
2023
|
reject: false,
|
|
2015
|
-
timeout:
|
|
2024
|
+
timeout: TIMEOUTS.codeTool
|
|
2016
2025
|
});
|
|
2017
2026
|
return this.processAuditResult(result, elapsed);
|
|
2018
2027
|
} catch (error) {
|
|
@@ -2190,7 +2199,7 @@ var RuffRunner = class extends BaseToolRunner {
|
|
|
2190
2199
|
const result = await execa7("ruff", this.buildCliArgs(), {
|
|
2191
2200
|
cwd: projectRoot,
|
|
2192
2201
|
reject: false,
|
|
2193
|
-
timeout:
|
|
2202
|
+
timeout: TIMEOUTS.codeTool
|
|
2194
2203
|
});
|
|
2195
2204
|
if (this.isBinaryNotFound(result)) {
|
|
2196
2205
|
return this.skipNotInstalled(Date.now() - startTime);
|
|
@@ -2356,7 +2365,7 @@ var TscRunner = class extends BaseToolRunner {
|
|
|
2356
2365
|
return execa8("npx", ["tsc", "--noEmit"], {
|
|
2357
2366
|
cwd: projectRoot,
|
|
2358
2367
|
reject: false,
|
|
2359
|
-
timeout:
|
|
2368
|
+
timeout: TIMEOUTS.codeTool
|
|
2360
2369
|
});
|
|
2361
2370
|
}
|
|
2362
2371
|
processRunResult(result, projectRoot, elapsed) {
|
|
@@ -2587,7 +2596,7 @@ var TyRunner = class extends BaseToolRunner {
|
|
|
2587
2596
|
const result = await execa9("uvx", ["ty", "check", "--output-format", "concise", "."], {
|
|
2588
2597
|
cwd: projectRoot,
|
|
2589
2598
|
reject: false,
|
|
2590
|
-
timeout:
|
|
2599
|
+
timeout: TIMEOUTS.codeTool
|
|
2591
2600
|
});
|
|
2592
2601
|
return this.handleExitCode(result, projectRoot, elapsed);
|
|
2593
2602
|
} catch (error) {
|
|
@@ -2736,7 +2745,7 @@ var VultureRunner = class _VultureRunner extends BaseToolRunner {
|
|
|
2736
2745
|
const result = await execa10("vulture", [".", "--exclude", excludePatterns], {
|
|
2737
2746
|
cwd: projectRoot,
|
|
2738
2747
|
reject: false,
|
|
2739
|
-
timeout:
|
|
2748
|
+
timeout: TIMEOUTS.codeTool
|
|
2740
2749
|
});
|
|
2741
2750
|
if (this.isBinaryNotFound(result)) {
|
|
2742
2751
|
return this.skipNotInstalled(Date.now() - startTime);
|
|
@@ -3150,7 +3159,7 @@ var BackupsRunner = class extends BaseProcessToolRunner {
|
|
|
3150
3159
|
}
|
|
3151
3160
|
getS3Client() {
|
|
3152
3161
|
return this.s3Client ?? new S3Client({
|
|
3153
|
-
region: this.config.region ?? process.env.AWS_REGION ??
|
|
3162
|
+
region: this.config.region ?? process.env.AWS_REGION ?? AWS_DEFAULTS.globalRegion
|
|
3154
3163
|
});
|
|
3155
3164
|
}
|
|
3156
3165
|
createExistsViolation() {
|
|
@@ -5245,7 +5254,7 @@ var PrRunner = class extends BaseProcessToolRunner {
|
|
|
5245
5254
|
/** Fetch a single page of PR files from GitHub API */
|
|
5246
5255
|
async fetchPrFilesPage(repo, prNumber, page, token) {
|
|
5247
5256
|
const response = await fetch(
|
|
5248
|
-
|
|
5257
|
+
`${GITHUB_API.baseUrl}/repos/${repo}/pulls/${prNumber}/files?per_page=${GITHUB_API.perPage}&page=${page}`,
|
|
5249
5258
|
{
|
|
5250
5259
|
headers: {
|
|
5251
5260
|
Authorization: `Bearer ${token}`,
|
|
@@ -6656,7 +6665,7 @@ async function scanRepository(repo, config) {
|
|
|
6656
6665
|
return aggregateResults(repoInfo, [rulesetsResult, filesResult]);
|
|
6657
6666
|
}
|
|
6658
6667
|
async function validateProcess(options) {
|
|
6659
|
-
const { loadConfigAsync: loadConfigAsync2 } = await import("./
|
|
6668
|
+
const { loadConfigAsync: loadConfigAsync2 } = await import("./core-QRFGIQ42.js");
|
|
6660
6669
|
const { config } = await loadConfigAsync2(options.config);
|
|
6661
6670
|
const result = await scanRepository(options.repo, config);
|
|
6662
6671
|
const fs22 = await import("fs");
|
|
@@ -6692,7 +6701,7 @@ function formatJson(result) {
|
|
|
6692
6701
|
}
|
|
6693
6702
|
function formatText(result) {
|
|
6694
6703
|
const lines = [];
|
|
6695
|
-
lines.push(`
|
|
6704
|
+
lines.push(`conform v${result.version}`);
|
|
6696
6705
|
lines.push(`Config: ${result.configPath}`);
|
|
6697
6706
|
lines.push("");
|
|
6698
6707
|
for (const [domainName, domain] of Object.entries(result.domains)) {
|
|
@@ -6967,9 +6976,7 @@ import * as fs18 from "fs";
|
|
|
6967
6976
|
import * as os from "os";
|
|
6968
6977
|
import * as path17 from "path";
|
|
6969
6978
|
import { execa as execa19 } from "execa";
|
|
6970
|
-
var
|
|
6971
|
-
var DEFAULT_REPO = "standards";
|
|
6972
|
-
var CACHE_DIR = path17.join(os.tmpdir(), "cm-standards-cache");
|
|
6979
|
+
var CACHE_DIR = path17.join(os.tmpdir(), CACHE.standardsCacheDir);
|
|
6973
6980
|
function parseGitHubSource(source) {
|
|
6974
6981
|
const remainder = source.slice(7);
|
|
6975
6982
|
const atIndex = remainder.indexOf("@");
|
|
@@ -7028,7 +7035,7 @@ function buildGitHubUrl(auth, owner, repo) {
|
|
|
7028
7035
|
}
|
|
7029
7036
|
async function updateExistingRepo(repoDir) {
|
|
7030
7037
|
try {
|
|
7031
|
-
await execa19("git", ["pull", "--ff-only"], { cwd: repoDir, timeout:
|
|
7038
|
+
await execa19("git", ["pull", "--ff-only"], { cwd: repoDir, timeout: TIMEOUTS.git });
|
|
7032
7039
|
return true;
|
|
7033
7040
|
} catch {
|
|
7034
7041
|
fs18.rmSync(repoDir, { recursive: true, force: true });
|
|
@@ -7046,12 +7053,12 @@ async function cloneRepo(repoDir, owner, repo, ref) {
|
|
|
7046
7053
|
}
|
|
7047
7054
|
args.push(url, repoDir);
|
|
7048
7055
|
await execa19("git", args, {
|
|
7049
|
-
timeout:
|
|
7056
|
+
timeout: TIMEOUTS.git
|
|
7050
7057
|
});
|
|
7051
7058
|
} catch (error) {
|
|
7052
7059
|
const message = error instanceof Error ? error.message : String(error);
|
|
7053
7060
|
if (message.includes("timed out")) {
|
|
7054
|
-
throw new StandardsError(`Standards repo clone timed out after
|
|
7061
|
+
throw new StandardsError(`Standards repo clone timed out after ${TIMEOUTS.git / 1e3} seconds`);
|
|
7055
7062
|
}
|
|
7056
7063
|
throw new StandardsError(`Failed to clone standards repo: ${message}`);
|
|
7057
7064
|
}
|
|
@@ -7086,7 +7093,7 @@ async function fetchStandardsRepoFromSource(source, basePath) {
|
|
|
7086
7093
|
return fetchGitHubRepo(parsed.owner, parsed.repo, parsed.ref);
|
|
7087
7094
|
}
|
|
7088
7095
|
async function fetchStandardsRepo() {
|
|
7089
|
-
return fetchGitHubRepo(
|
|
7096
|
+
return fetchGitHubRepo(STANDARDS_REPO.owner, STANDARDS_REPO.repo);
|
|
7090
7097
|
}
|
|
7091
7098
|
function getGuidelinesDir(repoPath) {
|
|
7092
7099
|
return path17.join(repoPath, "guidelines");
|
|
@@ -7223,63 +7230,16 @@ ${guideline.content}`;
|
|
|
7223
7230
|
}
|
|
7224
7231
|
|
|
7225
7232
|
// src/validate/tier.ts
|
|
7226
|
-
import { execSync } from "child_process";
|
|
7227
7233
|
import * as fs21 from "fs";
|
|
7228
7234
|
import * as path20 from "path";
|
|
7229
7235
|
import TOML from "@iarna/toml";
|
|
7230
7236
|
import chalk4 from "chalk";
|
|
7231
|
-
import * as yaml3 from "js-yaml";
|
|
7232
7237
|
|
|
7233
7238
|
// src/validate/types.ts
|
|
7234
7239
|
var VALID_TIERS = ["production", "internal", "prototype"];
|
|
7235
7240
|
|
|
7236
7241
|
// src/validate/tier.ts
|
|
7237
7242
|
var DEFAULT_TIER = "internal";
|
|
7238
|
-
function findGitRoot(startDir) {
|
|
7239
|
-
try {
|
|
7240
|
-
const gitRoot = execSync("git rev-parse --show-toplevel", {
|
|
7241
|
-
cwd: startDir,
|
|
7242
|
-
encoding: "utf-8",
|
|
7243
|
-
stdio: ["pipe", "pipe", "pipe"]
|
|
7244
|
-
}).trim();
|
|
7245
|
-
return gitRoot;
|
|
7246
|
-
} catch {
|
|
7247
|
-
return null;
|
|
7248
|
-
}
|
|
7249
|
-
}
|
|
7250
|
-
function readFileContent2(filePath) {
|
|
7251
|
-
if (!fs21.existsSync(filePath)) {
|
|
7252
|
-
return null;
|
|
7253
|
-
}
|
|
7254
|
-
try {
|
|
7255
|
-
return fs21.readFileSync(filePath, "utf-8");
|
|
7256
|
-
} catch {
|
|
7257
|
-
return null;
|
|
7258
|
-
}
|
|
7259
|
-
}
|
|
7260
|
-
function parseYamlContent(content) {
|
|
7261
|
-
try {
|
|
7262
|
-
const parsed = yaml3.load(content);
|
|
7263
|
-
if (parsed === void 0 || parsed === null) {
|
|
7264
|
-
return { metadata: null, sourceDetail: "default (file empty)" };
|
|
7265
|
-
}
|
|
7266
|
-
return { metadata: parsed, sourceDetail: "repo-metadata.yaml" };
|
|
7267
|
-
} catch (error) {
|
|
7268
|
-
const parseError = error instanceof Error ? error.message : String(error);
|
|
7269
|
-
return { metadata: null, sourceDetail: "default (parse error)", parseError };
|
|
7270
|
-
}
|
|
7271
|
-
}
|
|
7272
|
-
function loadRepoMetadata(projectRoot) {
|
|
7273
|
-
const metadataPath = path20.join(projectRoot, "repo-metadata.yaml");
|
|
7274
|
-
const content = readFileContent2(metadataPath);
|
|
7275
|
-
if (content === null) {
|
|
7276
|
-
return { metadata: null, sourceDetail: "default (file not found)" };
|
|
7277
|
-
}
|
|
7278
|
-
if (!content.trim()) {
|
|
7279
|
-
return { metadata: null, sourceDetail: "default (file empty)" };
|
|
7280
|
-
}
|
|
7281
|
-
return parseYamlContent(content);
|
|
7282
|
-
}
|
|
7283
7243
|
function loadExtendsConfig(configPath) {
|
|
7284
7244
|
try {
|
|
7285
7245
|
const content = fs21.readFileSync(configPath, "utf-8");
|
|
@@ -7289,24 +7249,48 @@ function loadExtendsConfig(configPath) {
|
|
|
7289
7249
|
return null;
|
|
7290
7250
|
}
|
|
7291
7251
|
}
|
|
7292
|
-
function
|
|
7293
|
-
|
|
7294
|
-
|
|
7295
|
-
|
|
7296
|
-
|
|
7297
|
-
|
|
7298
|
-
|
|
7252
|
+
function loadTierFromStandardsToml(configPath) {
|
|
7253
|
+
if (!fs21.existsSync(configPath)) {
|
|
7254
|
+
return {
|
|
7255
|
+
tier: DEFAULT_TIER,
|
|
7256
|
+
source: "default",
|
|
7257
|
+
sourceDetail: "default (file not found)"
|
|
7258
|
+
};
|
|
7299
7259
|
}
|
|
7300
|
-
|
|
7301
|
-
|
|
7260
|
+
try {
|
|
7261
|
+
const content = fs21.readFileSync(configPath, "utf-8");
|
|
7262
|
+
const parsed = TOML.parse(content);
|
|
7263
|
+
if (!parsed.metadata) {
|
|
7264
|
+
return {
|
|
7265
|
+
tier: DEFAULT_TIER,
|
|
7266
|
+
source: "default",
|
|
7267
|
+
sourceDetail: "default (no metadata)"
|
|
7268
|
+
};
|
|
7269
|
+
}
|
|
7270
|
+
if (parsed.metadata.tier === void 0) {
|
|
7271
|
+
return {
|
|
7272
|
+
tier: DEFAULT_TIER,
|
|
7273
|
+
source: "default",
|
|
7274
|
+
sourceDetail: "default (tier not specified)"
|
|
7275
|
+
};
|
|
7276
|
+
}
|
|
7277
|
+
const tier = parsed.metadata.tier;
|
|
7278
|
+
if (!VALID_TIERS.includes(tier)) {
|
|
7279
|
+
return {
|
|
7280
|
+
tier: DEFAULT_TIER,
|
|
7281
|
+
source: "default",
|
|
7282
|
+
sourceDetail: "default (invalid value)",
|
|
7283
|
+
invalidValue: String(tier)
|
|
7284
|
+
};
|
|
7285
|
+
}
|
|
7286
|
+
return { tier, source: "standards.toml", sourceDetail: "standards.toml" };
|
|
7287
|
+
} catch {
|
|
7302
7288
|
return {
|
|
7303
7289
|
tier: DEFAULT_TIER,
|
|
7304
7290
|
source: "default",
|
|
7305
|
-
sourceDetail: "default (
|
|
7306
|
-
invalidValue: String(tier)
|
|
7291
|
+
sourceDetail: "default (file not found)"
|
|
7307
7292
|
};
|
|
7308
7293
|
}
|
|
7309
|
-
return { tier, source: "repo-metadata.yaml", sourceDetail: "repo-metadata.yaml" };
|
|
7310
7294
|
}
|
|
7311
7295
|
function findMatchingRulesets(rulesets, tier) {
|
|
7312
7296
|
const suffix = `-${tier}`;
|
|
@@ -7324,6 +7308,7 @@ function createNotFoundResult() {
|
|
|
7324
7308
|
valid: false,
|
|
7325
7309
|
tier: DEFAULT_TIER,
|
|
7326
7310
|
tierSource: "default",
|
|
7311
|
+
tierSourceDetail: "default (file not found)",
|
|
7327
7312
|
rulesets: [],
|
|
7328
7313
|
expectedPattern: `*-${DEFAULT_TIER}`,
|
|
7329
7314
|
matchedRulesets: [],
|
|
@@ -7339,20 +7324,16 @@ function buildResult(options) {
|
|
|
7339
7324
|
matchedRulesets,
|
|
7340
7325
|
invalidTierValue,
|
|
7341
7326
|
hasEmptyRulesets,
|
|
7342
|
-
registryUrl
|
|
7343
|
-
parseError
|
|
7327
|
+
registryUrl
|
|
7344
7328
|
} = options;
|
|
7345
7329
|
const warnings = options.warnings ?? [];
|
|
7346
7330
|
const expectedPattern = `*-${tier}`;
|
|
7347
7331
|
const valid = rulesets.length === 0 || matchedRulesets.length > 0;
|
|
7348
7332
|
if (invalidTierValue) {
|
|
7349
7333
|
warnings.push(
|
|
7350
|
-
`Invalid tier '${invalidTierValue}' in
|
|
7334
|
+
`Invalid tier '${invalidTierValue}' in standards.toml [metadata]. Valid values are: ${VALID_TIERS.join(", ")}`
|
|
7351
7335
|
);
|
|
7352
7336
|
}
|
|
7353
|
-
if (parseError) {
|
|
7354
|
-
warnings.push(`Failed to parse repo-metadata.yaml: ${parseError}`);
|
|
7355
|
-
}
|
|
7356
7337
|
if (hasEmptyRulesets && registryUrl) {
|
|
7357
7338
|
warnings.push(
|
|
7358
7339
|
`[extends] is configured with registry '${registryUrl}' but rulesets is empty - no standards will be inherited`
|
|
@@ -7378,26 +7359,21 @@ function validateTierRuleset(options = {}) {
|
|
|
7378
7359
|
if (!configPath) {
|
|
7379
7360
|
return createNotFoundResult();
|
|
7380
7361
|
}
|
|
7381
|
-
const
|
|
7382
|
-
const gitRoot = findGitRoot(configDir);
|
|
7383
|
-
const metadataSearchPath = gitRoot ?? configDir;
|
|
7384
|
-
const metadataResult = loadRepoMetadata(metadataSearchPath);
|
|
7385
|
-
const { tier, source, sourceDetail, invalidValue } = getTier(metadataResult);
|
|
7362
|
+
const tierResult = loadTierFromStandardsToml(configPath);
|
|
7386
7363
|
const extendsConfig = loadExtendsConfig(configPath);
|
|
7387
7364
|
const rulesets = extendsConfig?.rulesets ?? [];
|
|
7388
|
-
const matchedRulesets = rulesets.length > 0 ? findMatchingRulesets(rulesets, tier) : [];
|
|
7365
|
+
const matchedRulesets = rulesets.length > 0 ? findMatchingRulesets(rulesets, tierResult.tier) : [];
|
|
7389
7366
|
const hasEmptyRulesets = extendsConfig !== null && rulesets.length === 0;
|
|
7390
7367
|
const registryUrl = extendsConfig?.registry;
|
|
7391
7368
|
return buildResult({
|
|
7392
|
-
tier,
|
|
7393
|
-
source,
|
|
7394
|
-
sourceDetail,
|
|
7369
|
+
tier: tierResult.tier,
|
|
7370
|
+
source: tierResult.source,
|
|
7371
|
+
sourceDetail: tierResult.sourceDetail,
|
|
7395
7372
|
rulesets,
|
|
7396
7373
|
matchedRulesets,
|
|
7397
|
-
invalidTierValue: invalidValue,
|
|
7374
|
+
invalidTierValue: tierResult.invalidValue,
|
|
7398
7375
|
hasEmptyRulesets,
|
|
7399
|
-
registryUrl
|
|
7400
|
-
parseError: metadataResult.parseError
|
|
7376
|
+
registryUrl
|
|
7401
7377
|
});
|
|
7402
7378
|
}
|
|
7403
7379
|
function formatWarnings(warnings) {
|
|
@@ -7431,7 +7407,7 @@ function formatFailedValidation(result, sourceDisplay) {
|
|
|
7431
7407
|
lines.push("");
|
|
7432
7408
|
lines.push(
|
|
7433
7409
|
chalk4.cyan(
|
|
7434
|
-
` Hint: Update
|
|
7410
|
+
` Hint: Update standards.toml [metadata].tier to use a valid value: ${VALID_TIERS.join(", ")}`
|
|
7435
7411
|
)
|
|
7436
7412
|
);
|
|
7437
7413
|
}
|
|
@@ -7662,19 +7638,19 @@ function isSupportedService(service) {
|
|
|
7662
7638
|
return SUPPORTED_SERVICES.includes(service);
|
|
7663
7639
|
}
|
|
7664
7640
|
var checkerFactories = {
|
|
7665
|
-
s3: async () => (await import("./s3-
|
|
7666
|
-
lambda: async () => (await import("./lambda-
|
|
7667
|
-
dynamodb: async () => (await import("./dynamodb-
|
|
7668
|
-
sqs: async () => (await import("./sqs-
|
|
7669
|
-
sns: async () => (await import("./sns-
|
|
7670
|
-
iam: async () => (await import("./iam-
|
|
7671
|
-
secretsmanager: async () => (await import("./secretsmanager-
|
|
7672
|
-
logs: async () => (await import("./cloudwatch-
|
|
7673
|
-
ecs: async () => (await import("./ecs-
|
|
7674
|
-
rds: async () => (await import("./rds-
|
|
7675
|
-
ec2: async () => (await import("./ec2-
|
|
7676
|
-
elasticache: async () => (await import("./elasticache-
|
|
7677
|
-
elasticloadbalancing: async () => (await import("./elb-
|
|
7641
|
+
s3: async () => (await import("./s3-53UELUWT.js")).S3Checker,
|
|
7642
|
+
lambda: async () => (await import("./lambda-YTJOCYV5.js")).LambdaChecker,
|
|
7643
|
+
dynamodb: async () => (await import("./dynamodb-HQH3IMAI.js")).DynamoDBChecker,
|
|
7644
|
+
sqs: async () => (await import("./sqs-MHBW6UFC.js")).SQSChecker,
|
|
7645
|
+
sns: async () => (await import("./sns-RV64OMK2.js")).SNSChecker,
|
|
7646
|
+
iam: async () => (await import("./iam-YXMHK2MV.js")).IAMChecker,
|
|
7647
|
+
secretsmanager: async () => (await import("./secretsmanager-FJKTPIXI.js")).SecretsManagerChecker,
|
|
7648
|
+
logs: async () => (await import("./cloudwatch-3LTDYG6G.js")).CloudWatchLogsChecker,
|
|
7649
|
+
ecs: async () => (await import("./ecs-UHKCH5A7.js")).ECSChecker,
|
|
7650
|
+
rds: async () => (await import("./rds-GZ5RVPIU.js")).RDSChecker,
|
|
7651
|
+
ec2: async () => (await import("./ec2-AEPT735A.js")).EC2Checker,
|
|
7652
|
+
elasticache: async () => (await import("./elasticache-5Y6K7GKJ.js")).ElastiCacheChecker,
|
|
7653
|
+
elasticloadbalancing: async () => (await import("./elb-CN6ELVM5.js")).ELBChecker
|
|
7678
7654
|
};
|
|
7679
7655
|
var checkerCache = /* @__PURE__ */ new Map();
|
|
7680
7656
|
async function getChecker(service) {
|
|
@@ -7718,9 +7694,8 @@ async function getGcpChecker(service) {
|
|
|
7718
7694
|
}
|
|
7719
7695
|
|
|
7720
7696
|
// src/infra/scan.ts
|
|
7721
|
-
var DEFAULT_CONCURRENCY = 10;
|
|
7722
7697
|
async function scanManifest(manifest, manifestPath, options = {}) {
|
|
7723
|
-
const concurrency = options.concurrency ??
|
|
7698
|
+
const concurrency = options.concurrency ?? CONCURRENCY.infraScan;
|
|
7724
7699
|
if (isMultiAccountManifest(manifest)) {
|
|
7725
7700
|
return scanMultiAccountManifest(manifest, manifestPath, options);
|
|
7726
7701
|
}
|
|
@@ -7735,7 +7710,7 @@ async function scanManifest(manifest, manifestPath, options = {}) {
|
|
|
7735
7710
|
};
|
|
7736
7711
|
}
|
|
7737
7712
|
async function scanMultiAccountManifest(manifest, manifestPath, options = {}) {
|
|
7738
|
-
const concurrency = options.concurrency ??
|
|
7713
|
+
const concurrency = options.concurrency ?? CONCURRENCY.infraScan;
|
|
7739
7714
|
const accountResults = {};
|
|
7740
7715
|
const allResults = [];
|
|
7741
7716
|
const accountsToScan = filterAccounts(manifest, options.account);
|
|
@@ -7891,9 +7866,11 @@ export {
|
|
|
7891
7866
|
ArnSchema,
|
|
7892
7867
|
BaseProcessToolRunner,
|
|
7893
7868
|
BaseToolRunner,
|
|
7869
|
+
CheckResultBuilder,
|
|
7894
7870
|
CloudProviderSchema,
|
|
7895
7871
|
ConfigError,
|
|
7896
7872
|
DEFAULT_MANIFEST_NAME,
|
|
7873
|
+
DomainResultBuilder,
|
|
7897
7874
|
ESLintRunner,
|
|
7898
7875
|
ExitCode,
|
|
7899
7876
|
GcpResourcePathSchema,
|
|
@@ -7919,6 +7896,7 @@ export {
|
|
|
7919
7896
|
TscRunner,
|
|
7920
7897
|
TyRunner,
|
|
7921
7898
|
VALID_TIERS,
|
|
7899
|
+
ViolationBuilder,
|
|
7922
7900
|
VultureRunner,
|
|
7923
7901
|
auditCodeConfig,
|
|
7924
7902
|
auditProcessConfig,
|