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