@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
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ARN parsing utilities
|
|
3
|
+
*
|
|
4
|
+
* ARN format: arn:partition:service:region:account-id:resource
|
|
5
|
+
* or: arn:partition:service:region:account-id:resource-type/resource-id
|
|
6
|
+
* or: arn:partition:service:region:account-id:resource-type:resource-id
|
|
7
|
+
*/
|
|
8
|
+
import type { ParsedArn } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Validate that a string is a valid ARN format
|
|
11
|
+
*/
|
|
12
|
+
export declare function isValidArn(arn: string): boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Parse an ARN string into its components
|
|
15
|
+
*/
|
|
16
|
+
export declare function parseArn(arn: string): ParsedArn | null;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared AWS client factory with caching.
|
|
3
|
+
* Eliminates duplicated client caching pattern across all AWS checker files.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Generic client constructor type
|
|
7
|
+
*/
|
|
8
|
+
type ClientConstructor<T> = new (config: {
|
|
9
|
+
region: string;
|
|
10
|
+
}) => T;
|
|
11
|
+
/**
|
|
12
|
+
* Creates a cached client factory for any AWS SDK client.
|
|
13
|
+
* Clients are cached per region to avoid creating multiple instances.
|
|
14
|
+
*
|
|
15
|
+
* @param ClientClass - The AWS SDK client class constructor
|
|
16
|
+
* @returns A function that returns a cached client for the given region
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* import { S3Client } from "@aws-sdk/client-s3";
|
|
21
|
+
*
|
|
22
|
+
* const getS3Client = createClientFactory(S3Client);
|
|
23
|
+
* const client = getS3Client("us-east-1");
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function createClientFactory<T>(ClientClass: ClientConstructor<T>): (region: string) => T;
|
|
27
|
+
/**
|
|
28
|
+
* Creates a cached client factory for AWS SDK clients that need custom config.
|
|
29
|
+
* Useful for clients that need additional options beyond just region.
|
|
30
|
+
*
|
|
31
|
+
* @param createClient - Factory function that creates the client with config
|
|
32
|
+
* @returns A function that returns a cached client for the given region
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* import { S3Client } from "@aws-sdk/client-s3";
|
|
37
|
+
*
|
|
38
|
+
* const getS3Client = createClientFactoryWithConfig(
|
|
39
|
+
* (region) => new S3Client({ region, followRegionRedirects: true })
|
|
40
|
+
* );
|
|
41
|
+
* const client = getS3Client("us-east-1");
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function createClientFactoryWithConfig<T>(createClient: (region: string) => T): (region: string) => T;
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ElastiCache resource checker
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - Cache clusters
|
|
6
|
+
* - Subnet groups
|
|
7
|
+
* - Replication groups
|
|
8
|
+
*/
|
|
9
|
+
import type { ResourceChecker } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* ElastiCache resource checker
|
|
12
|
+
*/
|
|
13
|
+
export declare const ElastiCacheChecker: ResourceChecker;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Elastic Load Balancing v2 resource checker
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - Load balancers (ALB, NLB, GLB)
|
|
6
|
+
* - Target groups
|
|
7
|
+
* - Listeners
|
|
8
|
+
*/
|
|
9
|
+
import type { ResourceChecker } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* Elastic Load Balancing resource checker
|
|
12
|
+
*/
|
|
13
|
+
export declare const ELBChecker: ResourceChecker;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GCP checker registry with lazy loading
|
|
3
|
+
*/
|
|
4
|
+
import type { GcpResourceChecker } from "../types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Supported GCP services for resource checking
|
|
7
|
+
*/
|
|
8
|
+
export declare const SUPPORTED_GCP_SERVICES: readonly ["run", "secretmanager", "artifactregistry", "iam"];
|
|
9
|
+
export type SupportedGcpService = (typeof SUPPORTED_GCP_SERVICES)[number];
|
|
10
|
+
/**
|
|
11
|
+
* Check if a GCP service is supported
|
|
12
|
+
*/
|
|
13
|
+
export declare function isSupportedGcpService(service: string): service is SupportedGcpService;
|
|
14
|
+
/**
|
|
15
|
+
* Get a GCP checker for a service, loading it if necessary
|
|
16
|
+
*/
|
|
17
|
+
export declare function getGcpChecker(service: string): Promise<GcpResourceChecker | undefined>;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checker registry with lazy loading
|
|
3
|
+
*
|
|
4
|
+
* Checkers are loaded on-demand to avoid loading all AWS SDK clients upfront.
|
|
5
|
+
*/
|
|
6
|
+
import type { ResourceChecker } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Supported AWS services for resource checking
|
|
9
|
+
*/
|
|
10
|
+
export declare const SUPPORTED_SERVICES: readonly ["s3", "lambda", "dynamodb", "sqs", "sns", "iam", "secretsmanager", "logs", "ecs", "rds", "ec2", "elasticache", "elasticloadbalancing"];
|
|
11
|
+
export type SupportedService = (typeof SUPPORTED_SERVICES)[number];
|
|
12
|
+
/**
|
|
13
|
+
* Check if a service is supported
|
|
14
|
+
*/
|
|
15
|
+
export declare function isSupportedService(service: string): service is SupportedService;
|
|
16
|
+
/**
|
|
17
|
+
* Get a checker for a service, loading it if necessary
|
|
18
|
+
*
|
|
19
|
+
* @param service - The AWS service name
|
|
20
|
+
* @returns The checker instance, or undefined if the service is not supported
|
|
21
|
+
*/
|
|
22
|
+
export declare function getChecker(service: string): Promise<ResourceChecker | undefined>;
|
|
23
|
+
/**
|
|
24
|
+
* Clear the checker cache (useful for testing)
|
|
25
|
+
*/
|
|
26
|
+
export declare function clearCheckerCache(): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* RDS resource checker
|
|
3
|
+
*
|
|
4
|
+
* Supports:
|
|
5
|
+
* - DB instances
|
|
6
|
+
* - DB clusters (Aurora)
|
|
7
|
+
* - DB subnet groups
|
|
8
|
+
*/
|
|
9
|
+
import type { ResourceChecker } from "./types.js";
|
|
10
|
+
/**
|
|
11
|
+
* RDS resource checker
|
|
12
|
+
*/
|
|
13
|
+
export declare const RDSChecker: ResourceChecker;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for resource checkers
|
|
3
|
+
*/
|
|
4
|
+
import type { ParsedArn, ParsedGcpResource, ResourceCheckResult } from "../types.js";
|
|
5
|
+
/**
|
|
6
|
+
* Interface for AWS resource checkers
|
|
7
|
+
*/
|
|
8
|
+
export interface ResourceChecker {
|
|
9
|
+
/**
|
|
10
|
+
* Check if a resource exists
|
|
11
|
+
*
|
|
12
|
+
* @param arn - Parsed ARN of the resource
|
|
13
|
+
* @returns Check result with exists status and optional error
|
|
14
|
+
*/
|
|
15
|
+
check(arn: ParsedArn): Promise<ResourceCheckResult>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Interface for GCP resource checkers
|
|
19
|
+
*/
|
|
20
|
+
export interface GcpResourceChecker {
|
|
21
|
+
/**
|
|
22
|
+
* Check if a resource exists
|
|
23
|
+
*
|
|
24
|
+
* @param resource - Parsed GCP resource
|
|
25
|
+
* @returns Check result with exists status and optional error
|
|
26
|
+
*/
|
|
27
|
+
check(resource: ParsedGcpResource): Promise<ResourceCheckResult>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GCP resource path parsing utilities
|
|
3
|
+
*
|
|
4
|
+
* GCP resource paths follow patterns like:
|
|
5
|
+
* - projects/{project}/locations/{location}/services/{service} (Cloud Run)
|
|
6
|
+
* - projects/{project}/serviceAccounts/{email} (IAM Service Accounts)
|
|
7
|
+
* - projects/{project}/secrets/{secret} (Secret Manager)
|
|
8
|
+
* - projects/{project}/locations/{location}/repositories/{repo} (Artifact Registry)
|
|
9
|
+
*/
|
|
10
|
+
import type { ParsedGcpResource } from "./types.js";
|
|
11
|
+
/**
|
|
12
|
+
* Validate that a string is a valid GCP resource path
|
|
13
|
+
*/
|
|
14
|
+
export declare function isValidGcpResource(path: string): boolean;
|
|
15
|
+
/**
|
|
16
|
+
* Parse a GCP resource path into its components
|
|
17
|
+
*/
|
|
18
|
+
export declare function parseGcpResource(path: string): ParsedGcpResource | null;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest generation from Pulumi stack exports
|
|
3
|
+
*
|
|
4
|
+
* Parses Pulumi stack export JSON and extracts resource ARNs/identifiers
|
|
5
|
+
* to generate an infra-manifest.json file.
|
|
6
|
+
*/
|
|
7
|
+
import type { Manifest, MultiAccountManifest } from "./types.js";
|
|
8
|
+
/** Default manifest filename */
|
|
9
|
+
export declare const DEFAULT_MANIFEST_NAME = "infra-manifest.json";
|
|
10
|
+
/**
|
|
11
|
+
* Options for manifest generation
|
|
12
|
+
*/
|
|
13
|
+
export interface GenerateManifestOptions {
|
|
14
|
+
/** Project name (extracted from stack if not provided) */
|
|
15
|
+
project?: string;
|
|
16
|
+
/** Output file path (defaults to infra-manifest.json) */
|
|
17
|
+
output?: string;
|
|
18
|
+
/** If true, output to stdout instead of file */
|
|
19
|
+
stdout?: boolean;
|
|
20
|
+
/** Account alias (e.g., "prod-aws") for multi-account manifests */
|
|
21
|
+
account?: string;
|
|
22
|
+
/** Explicit account ID (e.g., "aws:111111111111") */
|
|
23
|
+
accountId?: string;
|
|
24
|
+
/** Merge into existing manifest instead of overwriting */
|
|
25
|
+
merge?: boolean;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Parse Pulumi stack export JSON and extract manifest
|
|
29
|
+
*/
|
|
30
|
+
export declare function parseStackExport(stackExport: unknown, project?: string): Manifest;
|
|
31
|
+
/**
|
|
32
|
+
* Generate manifest from stdin (Pulumi stack export)
|
|
33
|
+
*/
|
|
34
|
+
export declare function generateManifestFromStdin(options?: GenerateManifestOptions): Promise<Manifest>;
|
|
35
|
+
/**
|
|
36
|
+
* Generate manifest from a file
|
|
37
|
+
*/
|
|
38
|
+
export declare function generateManifestFromFile(filePath: string, options?: GenerateManifestOptions): Manifest;
|
|
39
|
+
/**
|
|
40
|
+
* Write manifest to file or stdout
|
|
41
|
+
*
|
|
42
|
+
* @param manifest - The manifest to write
|
|
43
|
+
* @param options - Output options (defaults to writing infra-manifest.json)
|
|
44
|
+
*/
|
|
45
|
+
export declare function writeManifest(manifest: Manifest, options?: {
|
|
46
|
+
output?: string;
|
|
47
|
+
stdout?: boolean;
|
|
48
|
+
}): void;
|
|
49
|
+
/**
|
|
50
|
+
* Parse Pulumi stack export and create multi-account manifest
|
|
51
|
+
* Groups resources by detected account
|
|
52
|
+
*/
|
|
53
|
+
export declare function parseStackExportMultiAccount(stackExport: unknown, options?: GenerateManifestOptions): MultiAccountManifest;
|
|
54
|
+
/**
|
|
55
|
+
* Read existing manifest from file
|
|
56
|
+
* Returns null if file doesn't exist
|
|
57
|
+
*/
|
|
58
|
+
export declare function readExistingManifest(filePath: string): Manifest | null;
|
|
59
|
+
/**
|
|
60
|
+
* Merge new resources into an existing manifest
|
|
61
|
+
*/
|
|
62
|
+
export declare function mergeIntoManifest(existing: Manifest, newResources: string[], accountKey: string, alias?: string): MultiAccountManifest;
|
|
63
|
+
/**
|
|
64
|
+
* Generate multi-account manifest from stdin (Pulumi stack export)
|
|
65
|
+
*/
|
|
66
|
+
export declare function generateMultiAccountFromStdin(options?: GenerateManifestOptions): Promise<MultiAccountManifest>;
|
|
67
|
+
/**
|
|
68
|
+
* Generate multi-account manifest from a file
|
|
69
|
+
*/
|
|
70
|
+
export declare function generateMultiAccountFromFile(filePath: string, options?: GenerateManifestOptions): MultiAccountManifest;
|
|
71
|
+
/**
|
|
72
|
+
* Handle merge operation for manifest generation
|
|
73
|
+
*/
|
|
74
|
+
export declare function generateWithMerge(inputPath: string | undefined, options: GenerateManifestOptions): Promise<Manifest>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Infra scan module - Public API
|
|
3
|
+
*
|
|
4
|
+
* Provides functionality to verify AWS resources declared in a manifest actually exist.
|
|
5
|
+
*/
|
|
6
|
+
import type { InfraScanResult, RunInfraScanOptions, ScanInfraOptions } from "./types.js";
|
|
7
|
+
export type { AccountId, AccountScanResult, Arn, CloudProvider, GcpResourcePath, InfraScanResult, InfraScanSummary, LegacyManifest, Manifest, ManifestAccount, MultiAccountManifest, ParsedArn, ParsedGcpResource, PulumiResource, PulumiStackExport, ResourceCheckResult, ResourceIdentifier, ScanInfraOptions, } from "./types.js";
|
|
8
|
+
export { ArnSchema, AccountIdSchema, AccountKeySchema, CloudProviderSchema, GcpResourcePathSchema, InfraScanResultSchema, InfraScanSummarySchema, LegacyManifestSchema, ManifestAccountSchema, ManifestSchema, MultiAccountManifestSchema, ParsedArnSchema, ParsedGcpResourceSchema, PulumiResourceSchema, PulumiStackExportSchema, ResourceCheckResultSchema, ResourceIdentifierSchema, isValidArnFormat, isValidGcpResourcePath, isValidAccountKey, isMultiAccountManifestSchema, isLegacyManifestSchema, validateArn, validateGcpResourcePath, validateAccountKey, validateManifest, validateMultiAccountManifest, validateLegacyManifest, validateStackExport, } from "./types.js";
|
|
9
|
+
export { ManifestError, isMultiAccountManifest, isLegacyManifest, parseAccountKey, formatAccountKey, normalizeManifest, detectAccountFromResource, getAllResources, } from "./manifest.js";
|
|
10
|
+
export { parseArn, isValidArn } from "./arn.js";
|
|
11
|
+
export { parseGcpResource, isValidGcpResource } from "./gcp.js";
|
|
12
|
+
export { SUPPORTED_SERVICES, isSupportedService } from "./checkers/index.js";
|
|
13
|
+
export { SUPPORTED_GCP_SERVICES, isSupportedGcpService } from "./checkers/gcp/index.js";
|
|
14
|
+
export { DEFAULT_MANIFEST_NAME, generateManifestFromStdin, generateManifestFromFile, generateMultiAccountFromStdin, generateMultiAccountFromFile, generateWithMerge, mergeIntoManifest, parseStackExport, parseStackExportMultiAccount, readExistingManifest, writeManifest, type GenerateManifestOptions, } from "./generate.js";
|
|
15
|
+
/**
|
|
16
|
+
* Scan infrastructure resources declared in a manifest.
|
|
17
|
+
*
|
|
18
|
+
* This is the programmatic API for @standards-kit/drift integration.
|
|
19
|
+
*
|
|
20
|
+
* @param options - Options for the scan
|
|
21
|
+
* @returns Scan result with all resource check results and summary
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import { scanInfra } from "@standards-kit/conform";
|
|
26
|
+
*
|
|
27
|
+
* const result = await scanInfra({ manifestPath: "./infra-manifest.json" });
|
|
28
|
+
* console.log(result.summary);
|
|
29
|
+
* // { total: 5, found: 4, missing: 1, errors: 0 }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare function scanInfra(options?: ScanInfraOptions): Promise<InfraScanResult>;
|
|
33
|
+
/**
|
|
34
|
+
* Run infra scan from CLI
|
|
35
|
+
*/
|
|
36
|
+
export declare function runInfraScan(options?: RunInfraScanOptions): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Options for CLI generate command
|
|
39
|
+
*/
|
|
40
|
+
export interface RunInfraGenerateOptions {
|
|
41
|
+
/** Input file path (if not provided, reads from stdin) */
|
|
42
|
+
input?: string;
|
|
43
|
+
/** Output file path (defaults to infra-manifest.json) */
|
|
44
|
+
output?: string;
|
|
45
|
+
/** Project name override */
|
|
46
|
+
project?: string;
|
|
47
|
+
/** Output to stdout instead of file */
|
|
48
|
+
stdout?: boolean;
|
|
49
|
+
/** Account alias (e.g., "prod-aws") for multi-account manifests */
|
|
50
|
+
account?: string;
|
|
51
|
+
/** Explicit account ID (e.g., "aws:111111111111") */
|
|
52
|
+
accountId?: string;
|
|
53
|
+
/** Merge into existing manifest instead of overwriting */
|
|
54
|
+
merge?: boolean;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Run infra generate from CLI
|
|
58
|
+
*/
|
|
59
|
+
export declare function runInfraGenerate(options?: RunInfraGenerateOptions): Promise<void>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Manifest reader for infra scan
|
|
3
|
+
*
|
|
4
|
+
* Supports two formats:
|
|
5
|
+
* 1. JSON: { "project": "...", "resources": ["arn:...", "projects/..."] }
|
|
6
|
+
* 2. TXT: One resource per line, # for comments
|
|
7
|
+
*
|
|
8
|
+
* Resources can be:
|
|
9
|
+
* - AWS ARNs: arn:aws:s3:::bucket-name
|
|
10
|
+
* - GCP paths: projects/{project}/locations/{location}/services/{service}
|
|
11
|
+
*/
|
|
12
|
+
import { type AccountId, type LegacyManifest, type Manifest, type MultiAccountManifest } from "./types.js";
|
|
13
|
+
/**
|
|
14
|
+
* Error thrown when manifest parsing fails
|
|
15
|
+
*/
|
|
16
|
+
export declare class ManifestError extends Error {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Type guard: check if manifest is multi-account format (v2)
|
|
21
|
+
*/
|
|
22
|
+
export declare function isMultiAccountManifest(manifest: Manifest): manifest is MultiAccountManifest;
|
|
23
|
+
/**
|
|
24
|
+
* Type guard: check if manifest is legacy format (v1)
|
|
25
|
+
*/
|
|
26
|
+
export declare function isLegacyManifest(manifest: Manifest): manifest is LegacyManifest;
|
|
27
|
+
/**
|
|
28
|
+
* Parse an account key (e.g., "aws:111111111111" or "gcp:my-project")
|
|
29
|
+
*
|
|
30
|
+
* @param key - The account key in format "cloud:id"
|
|
31
|
+
* @returns Parsed AccountId or null if invalid
|
|
32
|
+
*/
|
|
33
|
+
export declare function parseAccountKey(key: string): AccountId | null;
|
|
34
|
+
/**
|
|
35
|
+
* Format an account key from cloud and id
|
|
36
|
+
*/
|
|
37
|
+
export declare function formatAccountKey(cloud: "aws" | "gcp", id: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Normalize a legacy manifest to multi-account format
|
|
40
|
+
* This converts v1 manifests to v2 format for unified processing
|
|
41
|
+
*/
|
|
42
|
+
export declare function normalizeManifest(manifest: Manifest): MultiAccountManifest;
|
|
43
|
+
/**
|
|
44
|
+
* Detect the account key from a resource identifier
|
|
45
|
+
* Extracts AWS account ID from ARN or GCP project from resource path
|
|
46
|
+
*/
|
|
47
|
+
export declare function detectAccountFromResource(resource: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* Get all resources from a manifest (flattened for v2 manifests)
|
|
50
|
+
*/
|
|
51
|
+
export declare function getAllResources(manifest: Manifest): string[];
|
|
52
|
+
/**
|
|
53
|
+
* Read and parse a manifest file
|
|
54
|
+
*
|
|
55
|
+
* @param manifestPath - Path to the manifest file
|
|
56
|
+
* @returns Parsed manifest with project name and resource ARNs
|
|
57
|
+
*/
|
|
58
|
+
export declare function readManifest(manifestPath: string): Manifest;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scan logic for infra scan
|
|
3
|
+
*
|
|
4
|
+
* Orchestrates checking all resources in a manifest (AWS and GCP)
|
|
5
|
+
*/
|
|
6
|
+
import type { InfraScanResult, Manifest } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Options for scanning
|
|
9
|
+
*/
|
|
10
|
+
interface ScanOptions {
|
|
11
|
+
/** Max number of parallel checks */
|
|
12
|
+
concurrency?: number;
|
|
13
|
+
/** Filter to specific account (by alias or account key) */
|
|
14
|
+
account?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Scan all resources in a manifest
|
|
18
|
+
*
|
|
19
|
+
* @param manifest - The manifest containing resources to check
|
|
20
|
+
* @param manifestPath - Path to the manifest file (for result metadata)
|
|
21
|
+
* @param options - Scan options
|
|
22
|
+
* @returns Scan result with all resource check results and summary
|
|
23
|
+
*/
|
|
24
|
+
export declare function scanManifest(manifest: Manifest, manifestPath: string, options?: ScanOptions): Promise<InfraScanResult>;
|
|
25
|
+
export {};
|