cdk-cost-analyzer 0.1.1
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/.cdk-cost-analyzer-cache/metadata.json +12 -0
- package/.gitlab-ci.yml +214 -0
- package/.husky/pre-commit +12 -0
- package/.kiro/hooks/accessibility-audit.kiro.hook +18 -0
- package/.kiro/hooks/api-schema-validation.kiro.hook +21 -0
- package/.kiro/hooks/auto-test-on-save.kiro.hook +19 -0
- package/.kiro/hooks/cdk-synth-on-change.kiro.hook +20 -0
- package/.kiro/hooks/code-coverage-check.kiro.hook +14 -0
- package/.kiro/hooks/commit-message-helper.kiro.hook +14 -0
- package/.kiro/hooks/dependency-update-check.kiro.hook +14 -0
- package/.kiro/hooks/env-file-validation.kiro.hook +18 -0
- package/.kiro/hooks/lint-and-format-on-save.kiro.hook +21 -0
- package/.kiro/hooks/mcp-config-validation.kiro.hook +17 -0
- package/.kiro/hooks/mcp-server-test.kiro.hook +14 -0
- package/.kiro/hooks/performance-analysis.kiro.hook +14 -0
- package/.kiro/hooks/readme-spell-check.kiro.hook +14 -0
- package/.kiro/hooks/security-scan-on-dependency-change.kiro.hook +21 -0
- package/.kiro/hooks/translation-update.kiro.hook +18 -0
- package/.kiro/hooks/update-documentation.kiro.hook +18 -0
- package/.kiro/settings/mcp.json +20 -0
- package/.kiro/specs/cdk-cost-analyzer/design.md +620 -0
- package/.kiro/specs/cdk-cost-analyzer/requirements.md +183 -0
- package/.kiro/specs/cdk-cost-analyzer/tasks.md +357 -0
- package/.kiro/specs/github-actions-ci/design.md +281 -0
- package/.kiro/specs/github-actions-ci/requirements.md +86 -0
- package/.kiro/specs/github-actions-ci/tasks.md +115 -0
- package/.kiro/specs/nlb-calculator-test-coverage/design.md +190 -0
- package/.kiro/specs/nlb-calculator-test-coverage/requirements.md +84 -0
- package/.kiro/specs/nlb-calculator-test-coverage/tasks.md +150 -0
- package/.kiro/specs/production-readiness/design.md +1213 -0
- package/.kiro/specs/production-readiness/requirements.md +312 -0
- package/.kiro/specs/production-readiness/tasks.md +269 -0
- package/.kiro/specs/repository-cleanup/design.md +283 -0
- package/.kiro/specs/repository-cleanup/requirements.md +74 -0
- package/.kiro/specs/repository-cleanup/tasks.md +64 -0
- package/.kiro/steering/aws-cli-best-practices.md +41 -0
- package/.kiro/steering/cdk-best-practices.md +49 -0
- package/.kiro/steering/development-standards.md +54 -0
- package/.kiro/steering/docker-best-practices.md +34 -0
- package/.kiro/steering/documentation-style.md +151 -0
- package/.kiro/steering/git-best-practices.md +37 -0
- package/.kiro/steering/mcp-best-practices.md +95 -0
- package/.kiro/steering/python-best-practices.md +48 -0
- package/.kiro/steering/react-best-practices.md +44 -0
- package/.kiro/steering/security-best-practices.md +41 -0
- package/.kiro/steering/testing-best-practices.md +59 -0
- package/.kiro/steering/typescript-best-practices.md +40 -0
- package/CHANGELOG.md +49 -0
- package/CONTRIBUTING.md +258 -0
- package/LICENSE +19 -0
- package/README.md +480 -0
- package/SECURITY.md +117 -0
- package/dist/api/index.d.ts +11 -0
- package/dist/api/index.js +65 -0
- package/dist/api/types.d.ts +15 -0
- package/dist/api/types.js +3 -0
- package/dist/cli/index.d.ts +2 -0
- package/dist/cli/index.js +262 -0
- package/dist/config/ConfigManager.d.ts +40 -0
- package/dist/config/ConfigManager.js +238 -0
- package/dist/config/index.d.ts +2 -0
- package/dist/config/index.js +19 -0
- package/dist/config/types.d.ts +72 -0
- package/dist/config/types.js +15 -0
- package/dist/diff/DiffEngine.d.ts +7 -0
- package/dist/diff/DiffEngine.js +73 -0
- package/dist/diff/index.d.ts +2 -0
- package/dist/diff/index.js +21 -0
- package/dist/diff/types.d.ts +20 -0
- package/dist/diff/types.js +3 -0
- package/dist/integrations/GitLabIntegration.d.ts +7 -0
- package/dist/integrations/GitLabIntegration.js +45 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.js +21 -0
- package/dist/integrations/types.d.ts +11 -0
- package/dist/integrations/types.js +13 -0
- package/dist/parser/TemplateParser.d.ts +8 -0
- package/dist/parser/TemplateParser.js +75 -0
- package/dist/parser/index.d.ts +2 -0
- package/dist/parser/index.js +22 -0
- package/dist/parser/types.d.ts +30 -0
- package/dist/parser/types.js +3 -0
- package/dist/pipeline/PipelineOrchestrator.d.ts +23 -0
- package/dist/pipeline/PipelineOrchestrator.js +191 -0
- package/dist/pipeline/index.d.ts +2 -0
- package/dist/pipeline/index.js +19 -0
- package/dist/pipeline/types.d.ts +41 -0
- package/dist/pipeline/types.js +13 -0
- package/dist/pricing/CacheManager.d.ts +75 -0
- package/dist/pricing/CacheManager.js +195 -0
- package/dist/pricing/PricingClient.d.ts +17 -0
- package/dist/pricing/PricingClient.js +122 -0
- package/dist/pricing/PricingService.d.ts +16 -0
- package/dist/pricing/PricingService.js +149 -0
- package/dist/pricing/calculators/ALBCalculator.d.ts +16 -0
- package/dist/pricing/calculators/ALBCalculator.js +163 -0
- package/dist/pricing/calculators/APIGatewayCalculator.d.ts +10 -0
- package/dist/pricing/calculators/APIGatewayCalculator.js +177 -0
- package/dist/pricing/calculators/CloudFrontCalculator.d.ts +59 -0
- package/dist/pricing/calculators/CloudFrontCalculator.js +151 -0
- package/dist/pricing/calculators/DynamoDBCalculator.d.ts +9 -0
- package/dist/pricing/calculators/DynamoDBCalculator.js +146 -0
- package/dist/pricing/calculators/EC2Calculator.d.ts +7 -0
- package/dist/pricing/calculators/EC2Calculator.js +80 -0
- package/dist/pricing/calculators/ECSCalculator.d.ts +9 -0
- package/dist/pricing/calculators/ECSCalculator.js +116 -0
- package/dist/pricing/calculators/ElastiCacheCalculator.d.ts +8 -0
- package/dist/pricing/calculators/ElastiCacheCalculator.js +106 -0
- package/dist/pricing/calculators/LambdaCalculator.d.ts +13 -0
- package/dist/pricing/calculators/LambdaCalculator.js +111 -0
- package/dist/pricing/calculators/NLBCalculator.d.ts +16 -0
- package/dist/pricing/calculators/NLBCalculator.js +138 -0
- package/dist/pricing/calculators/NatGatewayCalculator.d.ts +12 -0
- package/dist/pricing/calculators/NatGatewayCalculator.js +116 -0
- package/dist/pricing/calculators/RDSCalculator.d.ts +9 -0
- package/dist/pricing/calculators/RDSCalculator.js +103 -0
- package/dist/pricing/calculators/S3Calculator.d.ts +8 -0
- package/dist/pricing/calculators/S3Calculator.js +68 -0
- package/dist/pricing/calculators/VPCEndpointCalculator.d.ts +12 -0
- package/dist/pricing/calculators/VPCEndpointCalculator.js +129 -0
- package/dist/pricing/index.d.ts +10 -0
- package/dist/pricing/index.js +37 -0
- package/dist/pricing/types.d.ts +53 -0
- package/dist/pricing/types.js +22 -0
- package/dist/releasetag.txt +1 -0
- package/dist/reporter/Reporter.d.ts +18 -0
- package/dist/reporter/Reporter.js +412 -0
- package/dist/reporter/index.d.ts +2 -0
- package/dist/reporter/index.js +21 -0
- package/dist/reporter/types.d.ts +72 -0
- package/dist/reporter/types.js +3 -0
- package/dist/synthesis/SynthesisOrchestrator.d.ts +26 -0
- package/dist/synthesis/SynthesisOrchestrator.js +243 -0
- package/dist/synthesis/index.d.ts +2 -0
- package/dist/synthesis/index.js +19 -0
- package/dist/synthesis/types.d.ts +17 -0
- package/dist/synthesis/types.js +13 -0
- package/dist/threshold/ThresholdEnforcer.d.ts +29 -0
- package/dist/threshold/ThresholdEnforcer.js +143 -0
- package/dist/threshold/index.d.ts +2 -0
- package/dist/threshold/index.js +19 -0
- package/dist/threshold/types.d.ts +15 -0
- package/dist/threshold/types.js +17 -0
- package/docs/CALCULATORS.md +820 -0
- package/docs/CI_CD.md +608 -0
- package/docs/CONFIGURATION.md +407 -0
- package/docs/DEVELOPMENT.md +387 -0
- package/docs/RELEASE.md +223 -0
- package/docs/TROUBLESHOOTING.md +847 -0
- package/examples/.cdk-cost-analyzer.yml +85 -0
- package/examples/.gitlab-ci.yml +125 -0
- package/examples/api-usage.js +26 -0
- package/examples/complex/base.json +16 -0
- package/examples/complex/target.json +29 -0
- package/examples/monorepo/.gitlab-ci.yml +251 -0
- package/examples/monorepo/README.md +341 -0
- package/examples/monorepo/package.json +27 -0
- package/examples/monorepo/packages/backend-infra/.cdk-cost-analyzer.yml +34 -0
- package/examples/monorepo/packages/backend-infra/bin/app.ts +16 -0
- package/examples/monorepo/packages/backend-infra/cdk.json +7 -0
- package/examples/monorepo/packages/backend-infra/lib/backend-stack.ts +128 -0
- package/examples/monorepo/packages/backend-infra/package.json +30 -0
- package/examples/monorepo/packages/backend-infra/tsconfig.json +11 -0
- package/examples/monorepo/packages/data-infra/.cdk-cost-analyzer.yml +38 -0
- package/examples/monorepo/packages/data-infra/bin/app.ts +16 -0
- package/examples/monorepo/packages/data-infra/cdk.json +7 -0
- package/examples/monorepo/packages/data-infra/lib/data-stack.ts +121 -0
- package/examples/monorepo/packages/data-infra/package.json +30 -0
- package/examples/monorepo/packages/data-infra/tsconfig.json +11 -0
- package/examples/monorepo/packages/frontend-infra/.cdk-cost-analyzer.yml +31 -0
- package/examples/monorepo/packages/frontend-infra/bin/app.ts +16 -0
- package/examples/monorepo/packages/frontend-infra/cdk.json +7 -0
- package/examples/monorepo/packages/frontend-infra/lib/frontend-stack.ts +60 -0
- package/examples/monorepo/packages/frontend-infra/package.json +30 -0
- package/examples/monorepo/packages/frontend-infra/tsconfig.json +11 -0
- package/examples/monorepo/tsconfig.json +35 -0
- package/examples/multi-stack/.cdk-cost-analyzer.yml +72 -0
- package/examples/multi-stack/.gitlab-ci.yml +184 -0
- package/examples/multi-stack/README.md +279 -0
- package/examples/multi-stack/bin/app.ts +36 -0
- package/examples/multi-stack/cdk.json +72 -0
- package/examples/multi-stack/lib/compute-stack.ts +128 -0
- package/examples/multi-stack/lib/networking-stack.ts +69 -0
- package/examples/multi-stack/lib/storage-stack.ts +141 -0
- package/examples/multi-stack/package-lock.json +4437 -0
- package/examples/multi-stack/package.json +42 -0
- package/examples/multi-stack/tsconfig.json +34 -0
- package/examples/simple/base.json +8 -0
- package/examples/simple/target.json +14 -0
- package/examples/single-stack/.NVP +0 -0
- package/examples/single-stack/.cdk-cost-analyzer.yml +52 -0
- package/examples/single-stack/.gitlab-ci.yml +126 -0
- package/examples/single-stack/README.md +184 -0
- package/examples/single-stack/UeK +0 -0
- package/examples/single-stack/bin/app.ts +16 -0
- package/examples/single-stack/cdk.json +72 -0
- package/examples/single-stack/lib/infrastructure-stack.ts +119 -0
- package/examples/single-stack/package-lock.json +4443 -0
- package/examples/single-stack/package.json +38 -0
- package/examples/single-stack/tsconfig.json +34 -0
- package/package.json +139 -0
- package/test-cdk-project/README-COMPUTE.md +141 -0
- package/test-cdk-project/README.md +95 -0
- package/test-cdk-project/app-with-compute.js +102 -0
- package/test-cdk-project/app.js +81 -0
- package/test-cdk-project/cdk-compute.json +3 -0
- package/test-cdk-project/cdk.context.json +7 -0
- package/test-cdk-project/cdk.json +3 -0
- package/test-cdk-project/cdk.out/TestStack.assets.json +21 -0
- package/test-cdk-project/cdk.out/TestStack.template.json +115 -0
- package/test-cdk-project/cdk.out/cdk.out +1 -0
- package/test-cdk-project/cdk.out/manifest.json +503 -0
- package/test-cdk-project/cdk.out/tree.json +1 -0
- package/test-cdk-project/cdk.out.base/TestStack.assets.json +21 -0
- package/test-cdk-project/cdk.out.base/TestStack.template.json +115 -0
- package/test-cdk-project/cdk.out.base/cdk.out +1 -0
- package/test-cdk-project/cdk.out.base/manifest.json +503 -0
- package/test-cdk-project/cdk.out.base/tree.json +1 -0
- package/test-cdk-project/cdk.out.target/TestStack.assets.json +21 -0
- package/test-cdk-project/cdk.out.target/TestStack.template.json +183 -0
- package/test-cdk-project/cdk.out.target/cdk.out +1 -0
- package/test-cdk-project/cdk.out.target/manifest.json +521 -0
- package/test-cdk-project/cdk.out.target/tree.json +1 -0
- package/test-cdk-project/package-lock.json +422 -0
- package/test-cdk-project/package.json +17 -0
- package/tools/workflows/README.md +102 -0
- package/tools/workflows/validate-workflows.js +109 -0
- package/tools/workflows/workflow-utils.ts +181 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Requirements Document
|
|
2
|
+
|
|
3
|
+
## Introduction
|
|
4
|
+
|
|
5
|
+
The CDK Cost Analyzer is a TypeScript/Node.js package that analyzes AWS CDK infrastructure changes and provides cost impact summaries. The package can be used as a CLI tool or imported programmatically, helping developers understand the financial implications of their infrastructure changes at ANWB.
|
|
6
|
+
|
|
7
|
+
This document covers requirements for both Phase 1 (MVP) and Phase 2 (Enhanced Features). Phase 1 focuses on core functionality: comparing CloudFormation templates, calculating costs for common resources, and providing clear reports. Phase 2 adds GitLab integration, advanced features, and broader resource support.
|
|
8
|
+
|
|
9
|
+
## Glossary
|
|
10
|
+
|
|
11
|
+
- **CDK Cost Analyzer**: The npm package that analyzes CDK infrastructure changes and generates cost reports
|
|
12
|
+
- **Cost Impact Report**: A summary document showing estimated cost changes between current and proposed infrastructure
|
|
13
|
+
- **GitLab MR**: GitLab Merge Request, a code review mechanism where infrastructure changes are proposed
|
|
14
|
+
- **CDK Synthesizer**: The component that converts CDK code into CloudFormation templates
|
|
15
|
+
- **Cost Estimator**: The component that calculates AWS resource costs using pricing data
|
|
16
|
+
- **CLI Interface**: The command-line interface for running cost analysis from terminal or CI/CD pipelines
|
|
17
|
+
- **Programmatic API**: The TypeScript/JavaScript API for integrating cost analysis into custom applications
|
|
18
|
+
- **Base Infrastructure**: The current deployed infrastructure state before proposed changes
|
|
19
|
+
- **Target Infrastructure**: The proposed infrastructure state after applying merge request changes
|
|
20
|
+
- **Resource Diff**: The set of added, modified, or removed AWS resources between base and target infrastructure
|
|
21
|
+
- **AWS Pricing API**: The AWS service providing current pricing information for AWS resources
|
|
22
|
+
|
|
23
|
+
## Requirements
|
|
24
|
+
|
|
25
|
+
## Phase 1: MVP Requirements
|
|
26
|
+
|
|
27
|
+
### Requirement 1
|
|
28
|
+
|
|
29
|
+
**User Story:** As a developer, I want to compare two CloudFormation templates and see the cost difference, so that I can understand the financial impact of infrastructure changes.
|
|
30
|
+
|
|
31
|
+
#### Acceptance Criteria
|
|
32
|
+
|
|
33
|
+
1. WHEN provided with two CloudFormation template files THEN the CDK Cost Analyzer SHALL parse both templates successfully
|
|
34
|
+
2. WHEN templates are parsed THEN the CDK Cost Analyzer SHALL identify added, removed, and modified resources
|
|
35
|
+
3. WHEN resources are identified THEN the CDK Cost Analyzer SHALL calculate estimated monthly costs for each resource type
|
|
36
|
+
4. WHEN cost calculations complete THEN the CDK Cost Analyzer SHALL generate a summary showing total cost delta
|
|
37
|
+
5. WHEN displaying the summary THEN the CDK Cost Analyzer SHALL list resources grouped by added, removed, and modified categories
|
|
38
|
+
|
|
39
|
+
### Requirement 2
|
|
40
|
+
|
|
41
|
+
**User Story:** As a developer, I want to see cost estimates for common AWS resources, so that I can understand the pricing of basic infrastructure components.
|
|
42
|
+
|
|
43
|
+
#### Acceptance Criteria
|
|
44
|
+
|
|
45
|
+
1. WHEN analyzing EC2 instances THEN the CDK Cost Analyzer SHALL calculate monthly costs based on instance type and region
|
|
46
|
+
2. WHEN analyzing S3 buckets THEN the CDK Cost Analyzer SHALL estimate storage costs using default assumptions
|
|
47
|
+
3. WHEN analyzing Lambda functions THEN the CDK Cost Analyzer SHALL estimate costs based on memory configuration and default invocation assumptions
|
|
48
|
+
4. WHEN analyzing RDS instances THEN the CDK Cost Analyzer SHALL calculate monthly costs based on instance class and engine type
|
|
49
|
+
5. WHEN a resource type is not supported THEN the CDK Cost Analyzer SHALL mark the cost as unknown and continue processing
|
|
50
|
+
|
|
51
|
+
### Requirement 3
|
|
52
|
+
|
|
53
|
+
**User Story:** As a developer, I want to use the cost analyzer as a CLI tool, so that I can quickly compare templates from the command line.
|
|
54
|
+
|
|
55
|
+
#### Acceptance Criteria
|
|
56
|
+
|
|
57
|
+
1. WHEN the package is installed THEN the CDK Cost Analyzer SHALL provide a CLI executable named cdk-cost-analyzer
|
|
58
|
+
2. WHEN running the CLI THEN the CDK Cost Analyzer SHALL accept two file paths as arguments for base and target templates
|
|
59
|
+
3. WHEN running the CLI THEN the CDK Cost Analyzer SHALL accept an AWS region flag with a default value of eu-central-1
|
|
60
|
+
4. WHEN analysis completes THEN the CDK Cost Analyzer SHALL output a formatted cost report to stdout
|
|
61
|
+
5. IF template files are missing or invalid THEN the CDK Cost Analyzer SHALL exit with a non-zero status code and display an error message
|
|
62
|
+
|
|
63
|
+
### Requirement 4
|
|
64
|
+
|
|
65
|
+
**User Story:** As a developer, I want to use the cost analyzer programmatically in my code, so that I can integrate it into custom scripts and tools.
|
|
66
|
+
|
|
67
|
+
#### Acceptance Criteria
|
|
68
|
+
|
|
69
|
+
1. WHEN the package is imported THEN the CDK Cost Analyzer SHALL export a main analysis function
|
|
70
|
+
2. WHEN calling the analysis function THEN the CDK Cost Analyzer SHALL accept base template content, target template content, and region as parameters
|
|
71
|
+
3. WHEN analysis completes THEN the CDK Cost Analyzer SHALL return a structured object containing cost data and resource details
|
|
72
|
+
4. WHEN errors occur during analysis THEN the CDK Cost Analyzer SHALL throw descriptive errors
|
|
73
|
+
5. WHEN using TypeScript THEN the CDK Cost Analyzer SHALL provide type definitions for all exported functions and types
|
|
74
|
+
|
|
75
|
+
### Requirement 5
|
|
76
|
+
|
|
77
|
+
**User Story:** As a developer, I want the cost analyzer to fetch current AWS pricing data, so that cost estimates reflect actual AWS prices.
|
|
78
|
+
|
|
79
|
+
#### Acceptance Criteria
|
|
80
|
+
|
|
81
|
+
1. WHEN calculating costs THEN the CDK Cost Analyzer SHALL query the AWS Pricing API for current pricing information
|
|
82
|
+
2. WHEN querying pricing data THEN the CDK Cost Analyzer SHALL filter by the specified AWS region
|
|
83
|
+
3. WHEN pricing API calls fail THEN the CDK Cost Analyzer SHALL retry up to 3 times with exponential backoff
|
|
84
|
+
4. IF pricing data cannot be retrieved THEN the CDK Cost Analyzer SHALL use cached pricing data if available
|
|
85
|
+
5. IF no pricing data is available THEN the CDK Cost Analyzer SHALL mark affected resources as having unknown costs
|
|
86
|
+
|
|
87
|
+
### Requirement 6
|
|
88
|
+
|
|
89
|
+
**User Story:** As a developer, I want clear and readable cost reports, so that I can quickly understand the financial impact without parsing complex data.
|
|
90
|
+
|
|
91
|
+
#### Acceptance Criteria
|
|
92
|
+
|
|
93
|
+
1. WHEN generating a report THEN the CDK Cost Analyzer SHALL display the total monthly cost delta prominently
|
|
94
|
+
2. WHEN listing resources THEN the CDK Cost Analyzer SHALL show resource logical ID, type, and estimated monthly cost
|
|
95
|
+
3. WHEN displaying costs THEN the CDK Cost Analyzer SHALL format currency values with two decimal places and currency symbol
|
|
96
|
+
4. WHEN showing cost increases THEN the CDK Cost Analyzer SHALL use a plus sign prefix for positive deltas
|
|
97
|
+
5. WHEN showing cost decreases THEN the CDK Cost Analyzer SHALL use a minus sign prefix for negative deltas
|
|
98
|
+
|
|
99
|
+
## Phase 2: Enhanced Features
|
|
100
|
+
|
|
101
|
+
### Requirement 7
|
|
102
|
+
|
|
103
|
+
**User Story:** As a developer, I want the cost analysis to integrate with GitLab merge requests, so that I receive cost feedback automatically in my MR workflow.
|
|
104
|
+
|
|
105
|
+
#### Acceptance Criteria
|
|
106
|
+
|
|
107
|
+
1. WHEN the GitLab pipeline executes THEN the CDK Cost Analyzer SHALL run as a dedicated pipeline stage
|
|
108
|
+
2. WHEN the cost analysis stage runs THEN the CDK Cost Analyzer SHALL access the merge request source and target branches
|
|
109
|
+
3. WHEN accessing GitLab resources THEN the CDK Cost Analyzer SHALL authenticate using GitLab CI/CD environment variables
|
|
110
|
+
4. WHEN the cost analysis completes THEN the CDK Cost Analyzer SHALL post the cost report as a comment on the merge request
|
|
111
|
+
5. IF the cost analysis fails THEN the CDK Cost Analyzer SHALL report the error in the pipeline logs and mark the job as failed
|
|
112
|
+
|
|
113
|
+
### Requirement 8
|
|
114
|
+
|
|
115
|
+
**User Story:** As a FinOps engineer, I want to set cost thresholds for merge requests, so that expensive changes require additional review before merging.
|
|
116
|
+
|
|
117
|
+
#### Acceptance Criteria
|
|
118
|
+
|
|
119
|
+
1. WHEN a cost threshold is configured THEN the CDK Cost Analyzer SHALL compare the total cost delta against the threshold
|
|
120
|
+
2. WHEN the cost delta exceeds the threshold THEN the CDK Cost Analyzer SHALL mark the pipeline job as requiring manual approval
|
|
121
|
+
3. WHEN the cost delta is below the threshold THEN the CDK Cost Analyzer SHALL mark the pipeline job as passed
|
|
122
|
+
4. WHEN threshold validation occurs THEN the CDK Cost Analyzer SHALL include threshold status in the cost impact report
|
|
123
|
+
5. WHERE multiple threshold levels are configured THEN the CDK Cost Analyzer SHALL apply the appropriate threshold based on cost delta magnitude
|
|
124
|
+
|
|
125
|
+
### Requirement 9
|
|
126
|
+
|
|
127
|
+
**User Story:** As a developer, I want the cost analyzer to automatically synthesize CDK applications, so that I don't need to manually generate CloudFormation templates.
|
|
128
|
+
|
|
129
|
+
#### Acceptance Criteria
|
|
130
|
+
|
|
131
|
+
1. WHEN provided with a CDK application path THEN the CDK Cost Analyzer SHALL execute CDK synthesis to generate CloudFormation templates
|
|
132
|
+
2. WHEN synthesis is required for both base and target THEN the CDK Cost Analyzer SHALL synthesize each independently
|
|
133
|
+
3. IF CDK synthesis fails THEN the CDK Cost Analyzer SHALL report the synthesis error with the CDK error message
|
|
134
|
+
4. WHEN synthesis completes THEN the CDK Cost Analyzer SHALL use the generated templates for cost analysis
|
|
135
|
+
5. WHEN synthesis generates multiple stacks THEN the CDK Cost Analyzer SHALL analyze all stacks and aggregate costs
|
|
136
|
+
|
|
137
|
+
### Requirement 10
|
|
138
|
+
|
|
139
|
+
**User Story:** As a developer, I want to see cost estimates for resources across multiple AWS regions, so that I can understand regional pricing variations.
|
|
140
|
+
|
|
141
|
+
#### Acceptance Criteria
|
|
142
|
+
|
|
143
|
+
1. WHEN analyzing resources THEN the CDK Cost Analyzer SHALL detect the AWS region from CloudFormation template metadata
|
|
144
|
+
2. WHEN multiple regions are present THEN the CDK Cost Analyzer SHALL calculate costs separately for each region
|
|
145
|
+
3. WHEN displaying regional costs THEN the CDK Cost Analyzer SHALL group resources by region in the cost impact report
|
|
146
|
+
4. WHEN region information is unavailable THEN the CDK Cost Analyzer SHALL use the default region from configuration
|
|
147
|
+
5. WHEN displaying cost summaries THEN the CDK Cost Analyzer SHALL show both per-region and total cost deltas
|
|
148
|
+
|
|
149
|
+
### Requirement 11
|
|
150
|
+
|
|
151
|
+
**User Story:** As a developer, I want detailed cost breakdowns for modified resources, so that I can understand how configuration changes affect pricing.
|
|
152
|
+
|
|
153
|
+
#### Acceptance Criteria
|
|
154
|
+
|
|
155
|
+
1. WHEN a resource is modified THEN the CDK Cost Analyzer SHALL show the cost difference between old and new configurations
|
|
156
|
+
2. WHEN displaying modified resources THEN the CDK Cost Analyzer SHALL highlight configuration properties that impact cost
|
|
157
|
+
3. WHEN instance types or sizes change THEN the CDK Cost Analyzer SHALL show the cost impact of the sizing change
|
|
158
|
+
4. WHEN storage configurations change THEN the CDK Cost Analyzer SHALL calculate the cost difference based on storage type and size
|
|
159
|
+
5. WHEN displaying cost comparisons THEN the CDK Cost Analyzer SHALL show both before and after monthly costs
|
|
160
|
+
|
|
161
|
+
### Requirement 12
|
|
162
|
+
|
|
163
|
+
**User Story:** As a FinOps engineer, I want to track cost analysis history, so that I can identify cost trends and optimization opportunities over time.
|
|
164
|
+
|
|
165
|
+
#### Acceptance Criteria
|
|
166
|
+
|
|
167
|
+
1. WHEN cost analysis completes THEN the CDK Cost Analyzer SHALL store analysis results in a structured format
|
|
168
|
+
2. WHEN storing analysis results THEN the CDK Cost Analyzer SHALL include merge request ID, timestamp, cost delta, and resource details
|
|
169
|
+
3. WHERE a storage backend is configured THEN the CDK Cost Analyzer SHALL persist analysis results to the configured backend
|
|
170
|
+
4. WHEN storing results THEN the CDK Cost Analyzer SHALL handle storage failures gracefully without blocking the pipeline
|
|
171
|
+
5. WHEN analysis results are stored THEN the CDK Cost Analyzer SHALL include metadata about the analyzed CDK application and stacks
|
|
172
|
+
|
|
173
|
+
### Requirement 13
|
|
174
|
+
|
|
175
|
+
**User Story:** As a developer, I want support for additional AWS resource types, so that I can get cost estimates for my complete infrastructure.
|
|
176
|
+
|
|
177
|
+
#### Acceptance Criteria
|
|
178
|
+
|
|
179
|
+
1. WHEN analyzing DynamoDB tables THEN the CDK Cost Analyzer SHALL estimate costs based on capacity mode and throughput settings
|
|
180
|
+
2. WHEN analyzing ECS services THEN the CDK Cost Analyzer SHALL calculate costs based on task definitions and desired count
|
|
181
|
+
3. WHEN analyzing API Gateway APIs THEN the CDK Cost Analyzer SHALL estimate costs based on request volume assumptions
|
|
182
|
+
4. WHEN analyzing CloudFront distributions THEN the CDK Cost Analyzer SHALL estimate costs based on data transfer assumptions
|
|
183
|
+
5. WHEN analyzing NAT Gateways THEN the CDK Cost Analyzer SHALL calculate costs based on hourly rates and data processing assumptions
|
|
@@ -0,0 +1,357 @@
|
|
|
1
|
+
# Implementation Plan
|
|
2
|
+
|
|
3
|
+
- [x] 1. Set up project structure and dependencies
|
|
4
|
+
- Initialize TypeScript project with proper tsconfig
|
|
5
|
+
- Install production dependencies: aws-sdk (v3), js-yaml, commander
|
|
6
|
+
- Install development dependencies: typescript, fast-check, vitest, type definitions
|
|
7
|
+
- Configure build and test scripts in package.json
|
|
8
|
+
- Set up source directory structure (src/parser, src/diff, src/pricing, src/reporter, src/cli, src/api)
|
|
9
|
+
- _Requirements: 4.5, 13_
|
|
10
|
+
|
|
11
|
+
- [x] 2. Implement CloudFormation template parser
|
|
12
|
+
- Create TemplateParser interface and implementation
|
|
13
|
+
- Support JSON template parsing
|
|
14
|
+
- Support YAML template parsing using js-yaml
|
|
15
|
+
- Validate template structure (Resources section required)
|
|
16
|
+
- Extract resource definitions with logical IDs
|
|
17
|
+
- _Requirements: 1.1_
|
|
18
|
+
|
|
19
|
+
- [x] 2.1 Write property test for template parser
|
|
20
|
+
- **Property 1: Template parsing succeeds for valid templates**
|
|
21
|
+
- **Validates: Requirements 1.1**
|
|
22
|
+
- Generate random valid CloudFormation templates
|
|
23
|
+
- Verify parser returns structured template object without errors
|
|
24
|
+
- Test with both JSON and YAML formats
|
|
25
|
+
|
|
26
|
+
- [x] 2.2 Write unit tests for template parser
|
|
27
|
+
- Test parsing valid JSON templates
|
|
28
|
+
- Test parsing valid YAML templates
|
|
29
|
+
- Test handling malformed JSON/YAML
|
|
30
|
+
- Test handling missing Resources section
|
|
31
|
+
- Test handling empty templates
|
|
32
|
+
- _Requirements: 1.1_
|
|
33
|
+
|
|
34
|
+
- [x] 3. Implement diff engine
|
|
35
|
+
- Create DiffEngine interface and implementation
|
|
36
|
+
- Identify added resources (in target, not in base)
|
|
37
|
+
- Identify removed resources (in base, not in target)
|
|
38
|
+
- Identify modified resources (in both, properties differ)
|
|
39
|
+
- Implement deep property comparison for modified resources
|
|
40
|
+
- _Requirements: 1.2_
|
|
41
|
+
|
|
42
|
+
- [x] 3.1 Write property test for diff categorization
|
|
43
|
+
- **Property 2: Diff engine correctly categorizes resources**
|
|
44
|
+
- **Validates: Requirements 1.2**
|
|
45
|
+
- Generate random template pairs with known differences
|
|
46
|
+
- Verify all added, removed, and modified resources are correctly identified
|
|
47
|
+
|
|
48
|
+
- [x] 3.2 Write property test for resource uniqueness
|
|
49
|
+
- **Property 5: Resources appear in exactly one category**
|
|
50
|
+
- **Validates: Requirements 1.5**
|
|
51
|
+
- Generate random template pairs
|
|
52
|
+
- Verify each resource appears in exactly one category (added, removed, or modified)
|
|
53
|
+
- Verify all resources from diff appear in the report
|
|
54
|
+
|
|
55
|
+
- [x] 3.3 Write unit tests for diff engine
|
|
56
|
+
- Test identifying added resources
|
|
57
|
+
- Test identifying removed resources
|
|
58
|
+
- Test identifying modified resources
|
|
59
|
+
- Test handling identical templates (no changes)
|
|
60
|
+
- Test handling completely different templates
|
|
61
|
+
- _Requirements: 1.2_
|
|
62
|
+
|
|
63
|
+
- [x] 4. Implement pricing service foundation
|
|
64
|
+
- Create PricingService interface
|
|
65
|
+
- Set up AWS SDK v3 Pricing API client
|
|
66
|
+
- Implement pricing data caching mechanism
|
|
67
|
+
- Implement retry logic with exponential backoff (3 retries)
|
|
68
|
+
- Handle pricing API failures gracefully
|
|
69
|
+
- _Requirements: 5.1, 5.3, 5.4, 5.5_
|
|
70
|
+
|
|
71
|
+
- [x] 4.1 Write property test for pricing API integration
|
|
72
|
+
- **Property 17: Pricing queries include region filter**
|
|
73
|
+
- **Validates: Requirements 5.2**
|
|
74
|
+
- Generate random resource types and regions
|
|
75
|
+
- Verify pricing API queries include correct region parameter
|
|
76
|
+
|
|
77
|
+
- [x] 4.2 Write property test for retry logic
|
|
78
|
+
- **Property 18: Failed pricing calls trigger retries**
|
|
79
|
+
- **Validates: Requirements 5.3**
|
|
80
|
+
- Simulate transient API failures
|
|
81
|
+
- Verify system retries up to 3 times with exponential backoff
|
|
82
|
+
|
|
83
|
+
- [x] 4.3 Write property test for cache fallback
|
|
84
|
+
- **Property 19: Cache is used when API fails**
|
|
85
|
+
- **Validates: Requirements 5.4**
|
|
86
|
+
- Simulate API failure with cached data available
|
|
87
|
+
- Verify cached data is used instead of marking cost as unknown
|
|
88
|
+
|
|
89
|
+
- [x] 4.4 Write property test for unknown cost handling
|
|
90
|
+
- **Property 20: Unavailable pricing results in unknown cost**
|
|
91
|
+
- **Validates: Requirements 5.5**
|
|
92
|
+
- Simulate scenarios where pricing data is unavailable
|
|
93
|
+
- Verify resources are marked with confidence 'unknown' and processing continues
|
|
94
|
+
|
|
95
|
+
- [x] 5. Implement EC2 cost calculator
|
|
96
|
+
- Create ResourceCostCalculator interface
|
|
97
|
+
- Implement EC2Calculator class
|
|
98
|
+
- Extract instance type from EC2 resource properties
|
|
99
|
+
- Query AWS Pricing API for EC2 instance pricing
|
|
100
|
+
- Calculate monthly cost (730 hours * hourly rate)
|
|
101
|
+
- Handle different regions
|
|
102
|
+
- _Requirements: 2.1_
|
|
103
|
+
|
|
104
|
+
- [x] 5.1 Write property test for EC2 cost variation
|
|
105
|
+
- **Property 6: EC2 costs vary by instance type and region**
|
|
106
|
+
- **Validates: Requirements 2.1**
|
|
107
|
+
- Generate EC2 instances with different instance types and regions
|
|
108
|
+
- Verify calculated costs differ appropriately
|
|
109
|
+
|
|
110
|
+
- [x] 5.2 Write unit tests for EC2 calculator
|
|
111
|
+
- Test cost calculation for specific instance types (t3.micro, m5.large)
|
|
112
|
+
- Test cost calculation for different regions
|
|
113
|
+
- Test handling missing instance type property
|
|
114
|
+
- _Requirements: 2.1_
|
|
115
|
+
|
|
116
|
+
- [x] 6. Implement S3 cost calculator
|
|
117
|
+
- Implement S3Calculator class
|
|
118
|
+
- Apply default storage assumptions (100 GB standard storage)
|
|
119
|
+
- Query AWS Pricing API for S3 storage pricing
|
|
120
|
+
- Calculate monthly storage cost
|
|
121
|
+
- Document assumptions in MonthlyCost object
|
|
122
|
+
- _Requirements: 2.2_
|
|
123
|
+
|
|
124
|
+
- [x] 6.1 Write property test for S3 cost estimates
|
|
125
|
+
- **Property 7: S3 buckets receive cost estimates**
|
|
126
|
+
- **Validates: Requirements 2.2**
|
|
127
|
+
- Generate random S3 bucket resources
|
|
128
|
+
- Verify cost estimates are greater than zero
|
|
129
|
+
|
|
130
|
+
- [x] 6.2 Write unit tests for S3 calculator
|
|
131
|
+
- Test cost calculation with default assumptions
|
|
132
|
+
- Test cost calculation for different regions
|
|
133
|
+
- _Requirements: 2.2_
|
|
134
|
+
|
|
135
|
+
- [x] 7. Implement Lambda cost calculator
|
|
136
|
+
- Implement LambdaCalculator class
|
|
137
|
+
- Extract memory configuration from Lambda resource properties
|
|
138
|
+
- Apply default invocation assumptions (1M invocations/month, 1s duration)
|
|
139
|
+
- Query AWS Pricing API for Lambda pricing
|
|
140
|
+
- Calculate monthly cost (requests + compute)
|
|
141
|
+
- _Requirements: 2.3_
|
|
142
|
+
|
|
143
|
+
- [x] 7.1 Write property test for Lambda cost scaling
|
|
144
|
+
- **Property 8: Lambda costs scale with memory configuration**
|
|
145
|
+
- **Validates: Requirements 2.3**
|
|
146
|
+
- Generate Lambda functions with different memory allocations
|
|
147
|
+
- Verify higher memory results in equal or higher cost
|
|
148
|
+
|
|
149
|
+
- [x] 7.2 Write unit tests for Lambda calculator
|
|
150
|
+
- Test cost calculation for different memory configurations
|
|
151
|
+
- Test cost calculation with default assumptions
|
|
152
|
+
- Test handling missing memory property
|
|
153
|
+
- _Requirements: 2.3_
|
|
154
|
+
|
|
155
|
+
- [x] 8. Implement RDS cost calculator
|
|
156
|
+
- Implement RDSCalculator class
|
|
157
|
+
- Extract instance class and engine type from RDS resource properties
|
|
158
|
+
- Apply default storage assumptions (100 GB)
|
|
159
|
+
- Query AWS Pricing API for RDS instance pricing
|
|
160
|
+
- Calculate monthly cost (instance + storage)
|
|
161
|
+
- _Requirements: 2.4_
|
|
162
|
+
|
|
163
|
+
- [x] 8.1 Write property test for RDS cost calculation
|
|
164
|
+
- **Property 9: RDS costs are calculated for all engine types**
|
|
165
|
+
- **Validates: Requirements 2.4**
|
|
166
|
+
- Generate RDS instances with different engine types
|
|
167
|
+
- Verify cost estimates are greater than zero for all engines
|
|
168
|
+
|
|
169
|
+
- [x] 8.2 Write unit tests for RDS calculator
|
|
170
|
+
- Test cost calculation for different instance classes
|
|
171
|
+
- Test cost calculation for different engine types (MySQL, PostgreSQL)
|
|
172
|
+
- Test handling missing properties
|
|
173
|
+
- _Requirements: 2.4_
|
|
174
|
+
|
|
175
|
+
- [x] 9. Implement cost aggregation and delta calculation
|
|
176
|
+
- Implement getCostDelta method in PricingService
|
|
177
|
+
- Calculate costs for all added resources
|
|
178
|
+
- Calculate costs for all removed resources
|
|
179
|
+
- Calculate costs for all modified resources (before and after)
|
|
180
|
+
- Aggregate total cost delta
|
|
181
|
+
- _Requirements: 1.3, 1.4_
|
|
182
|
+
|
|
183
|
+
- [x] 9.1 Write property test for cost calculation validity
|
|
184
|
+
- **Property 3: Cost calculation produces valid results**
|
|
185
|
+
- **Validates: Requirements 1.3**
|
|
186
|
+
- Generate random supported resources
|
|
187
|
+
- Verify cost calculations return non-negative values with valid currency and confidence
|
|
188
|
+
|
|
189
|
+
- [x] 9.2 Write property test for cost delta summation
|
|
190
|
+
- **Property 4: Total cost delta equals sum of individual costs**
|
|
191
|
+
- **Validates: Requirements 1.4**
|
|
192
|
+
- Generate random cost analysis results
|
|
193
|
+
- Verify total delta equals sum of added minus removed plus modified deltas
|
|
194
|
+
|
|
195
|
+
- [x] 9.3 Write property test for unsupported resource handling
|
|
196
|
+
- **Property 10: Unsupported resources don't cause failures**
|
|
197
|
+
- **Validates: Requirements 2.5**
|
|
198
|
+
- Generate templates with unsupported resource types
|
|
199
|
+
- Verify analysis completes successfully with resources marked as unknown cost
|
|
200
|
+
|
|
201
|
+
- [x] 10. Checkpoint - Ensure all tests pass
|
|
202
|
+
- Ensure all tests pass, ask the user if questions arise.
|
|
203
|
+
|
|
204
|
+
- [x] 11. Implement text report formatter
|
|
205
|
+
- Create Reporter interface and implementation
|
|
206
|
+
- Implement generateReport method for text format
|
|
207
|
+
- Display total cost delta prominently at top
|
|
208
|
+
- Group resources by added, removed, modified categories
|
|
209
|
+
- Sort resources by cost impact (descending)
|
|
210
|
+
- Format currency with 2 decimal places and symbol
|
|
211
|
+
- Use + prefix for positive deltas, - for negative
|
|
212
|
+
- Include resource logical ID, type, and cost for each entry
|
|
213
|
+
- _Requirements: 1.5, 6.1, 6.2, 6.3, 6.4, 6.5_
|
|
214
|
+
|
|
215
|
+
- [x] 11.1 Write property test for report resource fields
|
|
216
|
+
- **Property 21: Reports contain all required resource fields**
|
|
217
|
+
- **Validates: Requirements 6.2**
|
|
218
|
+
- Generate random cost analysis results
|
|
219
|
+
- Verify each resource in report includes logical ID, type, and cost
|
|
220
|
+
|
|
221
|
+
- [x] 11.2 Write property test for currency formatting
|
|
222
|
+
- **Property 22: Currency values are consistently formatted**
|
|
223
|
+
- **Validates: Requirements 6.3**
|
|
224
|
+
- Generate random cost values
|
|
225
|
+
- Verify all formatted values have exactly 2 decimal places and currency symbol
|
|
226
|
+
|
|
227
|
+
- [x] 11.3 Write property test for positive delta formatting
|
|
228
|
+
- **Property 23: Positive deltas have plus sign prefix**
|
|
229
|
+
- **Validates: Requirements 6.4**
|
|
230
|
+
- Generate cost deltas greater than zero
|
|
231
|
+
- Verify formatted values include + prefix
|
|
232
|
+
|
|
233
|
+
- [x] 11.4 Write property test for negative delta formatting
|
|
234
|
+
- **Property 24: Negative deltas have minus sign prefix**
|
|
235
|
+
- **Validates: Requirements 6.5**
|
|
236
|
+
- Generate cost deltas less than zero
|
|
237
|
+
- Verify formatted values include - prefix
|
|
238
|
+
|
|
239
|
+
- [x] 11.5 Write unit tests for text reporter
|
|
240
|
+
- Test report generation with added resources
|
|
241
|
+
- Test report generation with removed resources
|
|
242
|
+
- Test report generation with modified resources
|
|
243
|
+
- Test currency formatting
|
|
244
|
+
- Test delta sign formatting
|
|
245
|
+
- Test resource sorting by cost impact
|
|
246
|
+
- _Requirements: 6.1, 6.2, 6.3, 6.4, 6.5_
|
|
247
|
+
|
|
248
|
+
- [x] 12. Implement JSON report formatter
|
|
249
|
+
- Add JSON format support to Reporter
|
|
250
|
+
- Return structured JSON with all cost data
|
|
251
|
+
- Include totalDelta, currency, addedResources, removedResources, modifiedResources
|
|
252
|
+
- Ensure JSON is properly formatted and parseable
|
|
253
|
+
- _Requirements: 4.3_
|
|
254
|
+
|
|
255
|
+
- [x] 12.1 Write unit tests for JSON reporter
|
|
256
|
+
- Test JSON structure matches expected schema
|
|
257
|
+
- Test JSON is valid and parseable
|
|
258
|
+
- Test all required fields are present
|
|
259
|
+
- _Requirements: 4.3_
|
|
260
|
+
|
|
261
|
+
- [x] 13. Implement programmatic API
|
|
262
|
+
- Create main analyzeCosts function
|
|
263
|
+
- Accept AnalyzeOptions (baseTemplate, targetTemplate, region)
|
|
264
|
+
- Orchestrate: parse templates → diff → calculate costs → generate report
|
|
265
|
+
- Return CostAnalysisResult with structured data
|
|
266
|
+
- Throw typed exceptions for errors
|
|
267
|
+
- Export TypeScript type definitions
|
|
268
|
+
- _Requirements: 4.1, 4.2, 4.3, 4.4, 4.5_
|
|
269
|
+
|
|
270
|
+
- [x] 13.1 Write property test for API return structure
|
|
271
|
+
- **Property 15: API returns structured results**
|
|
272
|
+
- **Validates: Requirements 4.3**
|
|
273
|
+
- Generate random valid template pairs
|
|
274
|
+
- Verify return value contains all required fields (totalDelta, currency, resources, summary)
|
|
275
|
+
|
|
276
|
+
- [x] 13.2 Write property test for API error handling
|
|
277
|
+
- **Property 16: API throws errors for invalid inputs**
|
|
278
|
+
- **Validates: Requirements 4.4**
|
|
279
|
+
- Generate invalid inputs (malformed templates, invalid regions)
|
|
280
|
+
- Verify API throws descriptive errors instead of crashing
|
|
281
|
+
|
|
282
|
+
- [x] 13.3 Write unit tests for programmatic API
|
|
283
|
+
- Test successful analysis with valid templates
|
|
284
|
+
- Test error handling for invalid templates
|
|
285
|
+
- Test error handling for invalid region
|
|
286
|
+
- Test TypeScript type definitions are exported
|
|
287
|
+
- _Requirements: 4.1, 4.2, 4.3, 4.4, 4.5_
|
|
288
|
+
|
|
289
|
+
- [x] 14. Implement CLI interface
|
|
290
|
+
- Create CLI entry point using commander
|
|
291
|
+
- Define command: cdk-cost-analyzer <base> <target>
|
|
292
|
+
- Add --region flag with default eu-central-1
|
|
293
|
+
- Add --format flag (text, json) with default text
|
|
294
|
+
- Add --help and --version flags
|
|
295
|
+
- Read template files from filesystem
|
|
296
|
+
- Call analyzeCosts API function
|
|
297
|
+
- Output report to stdout
|
|
298
|
+
- Handle errors and exit with appropriate status codes
|
|
299
|
+
- _Requirements: 3.1, 3.2, 3.3, 3.4, 3.5_
|
|
300
|
+
|
|
301
|
+
- [x] 14.1 Write property test for CLI argument parsing
|
|
302
|
+
- **Property 11: CLI accepts valid template file paths**
|
|
303
|
+
- **Validates: Requirements 3.2**
|
|
304
|
+
- Generate valid file paths
|
|
305
|
+
- Verify CLI accepts them and proceeds with analysis
|
|
306
|
+
|
|
307
|
+
- [x] 14.2 Write property test for CLI region flag
|
|
308
|
+
- **Property 12: CLI region flag overrides default**
|
|
309
|
+
- **Validates: Requirements 3.3**
|
|
310
|
+
- Generate random valid AWS regions
|
|
311
|
+
- Verify analysis uses provided region instead of default
|
|
312
|
+
|
|
313
|
+
- [x] 14.3 Write property test for CLI success output
|
|
314
|
+
- **Property 13: Successful analysis outputs to stdout**
|
|
315
|
+
- **Validates: Requirements 3.4**
|
|
316
|
+
- Generate valid template pairs
|
|
317
|
+
- Verify CLI outputs to stdout and exits with code 0
|
|
318
|
+
|
|
319
|
+
- [x] 14.4 Write property test for CLI error handling
|
|
320
|
+
- **Property 14: Invalid inputs cause non-zero exit**
|
|
321
|
+
- **Validates: Requirements 3.5**
|
|
322
|
+
- Generate invalid inputs (missing files, malformed templates)
|
|
323
|
+
- Verify CLI exits with non-zero code and writes to stderr
|
|
324
|
+
|
|
325
|
+
- [x] 14.5 Write unit tests for CLI
|
|
326
|
+
- Test CLI with valid template files
|
|
327
|
+
- Test CLI with missing files
|
|
328
|
+
- Test CLI with invalid region
|
|
329
|
+
- Test --help flag
|
|
330
|
+
- Test --version flag
|
|
331
|
+
- Test output to stdout
|
|
332
|
+
- Test error output to stderr
|
|
333
|
+
- Test exit codes
|
|
334
|
+
- _Requirements: 3.1, 3.2, 3.3, 3.4, 3.5_
|
|
335
|
+
|
|
336
|
+
- [x] 15. Add package.json configuration
|
|
337
|
+
- Configure package name, version, description
|
|
338
|
+
- Set main entry point for programmatic API
|
|
339
|
+
- Set bin entry point for CLI executable
|
|
340
|
+
- Configure TypeScript build output
|
|
341
|
+
- Add scripts: build, test, lint
|
|
342
|
+
- Specify files to include in npm package
|
|
343
|
+
- Add repository, author, license information
|
|
344
|
+
- _Requirements: 3.1, 4.1_
|
|
345
|
+
|
|
346
|
+
- [x] 16. Create README documentation
|
|
347
|
+
- Document installation instructions
|
|
348
|
+
- Document CLI usage with examples
|
|
349
|
+
- Document programmatic API usage with examples
|
|
350
|
+
- Document supported resource types
|
|
351
|
+
- Document cost calculation assumptions
|
|
352
|
+
- Document error handling behavior
|
|
353
|
+
- Include example templates and output
|
|
354
|
+
- _Requirements: All_
|
|
355
|
+
|
|
356
|
+
- [x] 17. Final checkpoint - Ensure all tests pass
|
|
357
|
+
- Ensure all tests pass, ask the user if questions arise.
|