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.
Files changed (228) hide show
  1. package/.cdk-cost-analyzer-cache/metadata.json +12 -0
  2. package/.gitlab-ci.yml +214 -0
  3. package/.husky/pre-commit +12 -0
  4. package/.kiro/hooks/accessibility-audit.kiro.hook +18 -0
  5. package/.kiro/hooks/api-schema-validation.kiro.hook +21 -0
  6. package/.kiro/hooks/auto-test-on-save.kiro.hook +19 -0
  7. package/.kiro/hooks/cdk-synth-on-change.kiro.hook +20 -0
  8. package/.kiro/hooks/code-coverage-check.kiro.hook +14 -0
  9. package/.kiro/hooks/commit-message-helper.kiro.hook +14 -0
  10. package/.kiro/hooks/dependency-update-check.kiro.hook +14 -0
  11. package/.kiro/hooks/env-file-validation.kiro.hook +18 -0
  12. package/.kiro/hooks/lint-and-format-on-save.kiro.hook +21 -0
  13. package/.kiro/hooks/mcp-config-validation.kiro.hook +17 -0
  14. package/.kiro/hooks/mcp-server-test.kiro.hook +14 -0
  15. package/.kiro/hooks/performance-analysis.kiro.hook +14 -0
  16. package/.kiro/hooks/readme-spell-check.kiro.hook +14 -0
  17. package/.kiro/hooks/security-scan-on-dependency-change.kiro.hook +21 -0
  18. package/.kiro/hooks/translation-update.kiro.hook +18 -0
  19. package/.kiro/hooks/update-documentation.kiro.hook +18 -0
  20. package/.kiro/settings/mcp.json +20 -0
  21. package/.kiro/specs/cdk-cost-analyzer/design.md +620 -0
  22. package/.kiro/specs/cdk-cost-analyzer/requirements.md +183 -0
  23. package/.kiro/specs/cdk-cost-analyzer/tasks.md +357 -0
  24. package/.kiro/specs/github-actions-ci/design.md +281 -0
  25. package/.kiro/specs/github-actions-ci/requirements.md +86 -0
  26. package/.kiro/specs/github-actions-ci/tasks.md +115 -0
  27. package/.kiro/specs/nlb-calculator-test-coverage/design.md +190 -0
  28. package/.kiro/specs/nlb-calculator-test-coverage/requirements.md +84 -0
  29. package/.kiro/specs/nlb-calculator-test-coverage/tasks.md +150 -0
  30. package/.kiro/specs/production-readiness/design.md +1213 -0
  31. package/.kiro/specs/production-readiness/requirements.md +312 -0
  32. package/.kiro/specs/production-readiness/tasks.md +269 -0
  33. package/.kiro/specs/repository-cleanup/design.md +283 -0
  34. package/.kiro/specs/repository-cleanup/requirements.md +74 -0
  35. package/.kiro/specs/repository-cleanup/tasks.md +64 -0
  36. package/.kiro/steering/aws-cli-best-practices.md +41 -0
  37. package/.kiro/steering/cdk-best-practices.md +49 -0
  38. package/.kiro/steering/development-standards.md +54 -0
  39. package/.kiro/steering/docker-best-practices.md +34 -0
  40. package/.kiro/steering/documentation-style.md +151 -0
  41. package/.kiro/steering/git-best-practices.md +37 -0
  42. package/.kiro/steering/mcp-best-practices.md +95 -0
  43. package/.kiro/steering/python-best-practices.md +48 -0
  44. package/.kiro/steering/react-best-practices.md +44 -0
  45. package/.kiro/steering/security-best-practices.md +41 -0
  46. package/.kiro/steering/testing-best-practices.md +59 -0
  47. package/.kiro/steering/typescript-best-practices.md +40 -0
  48. package/CHANGELOG.md +49 -0
  49. package/CONTRIBUTING.md +258 -0
  50. package/LICENSE +19 -0
  51. package/README.md +480 -0
  52. package/SECURITY.md +117 -0
  53. package/dist/api/index.d.ts +11 -0
  54. package/dist/api/index.js +65 -0
  55. package/dist/api/types.d.ts +15 -0
  56. package/dist/api/types.js +3 -0
  57. package/dist/cli/index.d.ts +2 -0
  58. package/dist/cli/index.js +262 -0
  59. package/dist/config/ConfigManager.d.ts +40 -0
  60. package/dist/config/ConfigManager.js +238 -0
  61. package/dist/config/index.d.ts +2 -0
  62. package/dist/config/index.js +19 -0
  63. package/dist/config/types.d.ts +72 -0
  64. package/dist/config/types.js +15 -0
  65. package/dist/diff/DiffEngine.d.ts +7 -0
  66. package/dist/diff/DiffEngine.js +73 -0
  67. package/dist/diff/index.d.ts +2 -0
  68. package/dist/diff/index.js +21 -0
  69. package/dist/diff/types.d.ts +20 -0
  70. package/dist/diff/types.js +3 -0
  71. package/dist/integrations/GitLabIntegration.d.ts +7 -0
  72. package/dist/integrations/GitLabIntegration.js +45 -0
  73. package/dist/integrations/index.d.ts +2 -0
  74. package/dist/integrations/index.js +21 -0
  75. package/dist/integrations/types.d.ts +11 -0
  76. package/dist/integrations/types.js +13 -0
  77. package/dist/parser/TemplateParser.d.ts +8 -0
  78. package/dist/parser/TemplateParser.js +75 -0
  79. package/dist/parser/index.d.ts +2 -0
  80. package/dist/parser/index.js +22 -0
  81. package/dist/parser/types.d.ts +30 -0
  82. package/dist/parser/types.js +3 -0
  83. package/dist/pipeline/PipelineOrchestrator.d.ts +23 -0
  84. package/dist/pipeline/PipelineOrchestrator.js +191 -0
  85. package/dist/pipeline/index.d.ts +2 -0
  86. package/dist/pipeline/index.js +19 -0
  87. package/dist/pipeline/types.d.ts +41 -0
  88. package/dist/pipeline/types.js +13 -0
  89. package/dist/pricing/CacheManager.d.ts +75 -0
  90. package/dist/pricing/CacheManager.js +195 -0
  91. package/dist/pricing/PricingClient.d.ts +17 -0
  92. package/dist/pricing/PricingClient.js +122 -0
  93. package/dist/pricing/PricingService.d.ts +16 -0
  94. package/dist/pricing/PricingService.js +149 -0
  95. package/dist/pricing/calculators/ALBCalculator.d.ts +16 -0
  96. package/dist/pricing/calculators/ALBCalculator.js +163 -0
  97. package/dist/pricing/calculators/APIGatewayCalculator.d.ts +10 -0
  98. package/dist/pricing/calculators/APIGatewayCalculator.js +177 -0
  99. package/dist/pricing/calculators/CloudFrontCalculator.d.ts +59 -0
  100. package/dist/pricing/calculators/CloudFrontCalculator.js +151 -0
  101. package/dist/pricing/calculators/DynamoDBCalculator.d.ts +9 -0
  102. package/dist/pricing/calculators/DynamoDBCalculator.js +146 -0
  103. package/dist/pricing/calculators/EC2Calculator.d.ts +7 -0
  104. package/dist/pricing/calculators/EC2Calculator.js +80 -0
  105. package/dist/pricing/calculators/ECSCalculator.d.ts +9 -0
  106. package/dist/pricing/calculators/ECSCalculator.js +116 -0
  107. package/dist/pricing/calculators/ElastiCacheCalculator.d.ts +8 -0
  108. package/dist/pricing/calculators/ElastiCacheCalculator.js +106 -0
  109. package/dist/pricing/calculators/LambdaCalculator.d.ts +13 -0
  110. package/dist/pricing/calculators/LambdaCalculator.js +111 -0
  111. package/dist/pricing/calculators/NLBCalculator.d.ts +16 -0
  112. package/dist/pricing/calculators/NLBCalculator.js +138 -0
  113. package/dist/pricing/calculators/NatGatewayCalculator.d.ts +12 -0
  114. package/dist/pricing/calculators/NatGatewayCalculator.js +116 -0
  115. package/dist/pricing/calculators/RDSCalculator.d.ts +9 -0
  116. package/dist/pricing/calculators/RDSCalculator.js +103 -0
  117. package/dist/pricing/calculators/S3Calculator.d.ts +8 -0
  118. package/dist/pricing/calculators/S3Calculator.js +68 -0
  119. package/dist/pricing/calculators/VPCEndpointCalculator.d.ts +12 -0
  120. package/dist/pricing/calculators/VPCEndpointCalculator.js +129 -0
  121. package/dist/pricing/index.d.ts +10 -0
  122. package/dist/pricing/index.js +37 -0
  123. package/dist/pricing/types.d.ts +53 -0
  124. package/dist/pricing/types.js +22 -0
  125. package/dist/releasetag.txt +1 -0
  126. package/dist/reporter/Reporter.d.ts +18 -0
  127. package/dist/reporter/Reporter.js +412 -0
  128. package/dist/reporter/index.d.ts +2 -0
  129. package/dist/reporter/index.js +21 -0
  130. package/dist/reporter/types.d.ts +72 -0
  131. package/dist/reporter/types.js +3 -0
  132. package/dist/synthesis/SynthesisOrchestrator.d.ts +26 -0
  133. package/dist/synthesis/SynthesisOrchestrator.js +243 -0
  134. package/dist/synthesis/index.d.ts +2 -0
  135. package/dist/synthesis/index.js +19 -0
  136. package/dist/synthesis/types.d.ts +17 -0
  137. package/dist/synthesis/types.js +13 -0
  138. package/dist/threshold/ThresholdEnforcer.d.ts +29 -0
  139. package/dist/threshold/ThresholdEnforcer.js +143 -0
  140. package/dist/threshold/index.d.ts +2 -0
  141. package/dist/threshold/index.js +19 -0
  142. package/dist/threshold/types.d.ts +15 -0
  143. package/dist/threshold/types.js +17 -0
  144. package/docs/CALCULATORS.md +820 -0
  145. package/docs/CI_CD.md +608 -0
  146. package/docs/CONFIGURATION.md +407 -0
  147. package/docs/DEVELOPMENT.md +387 -0
  148. package/docs/RELEASE.md +223 -0
  149. package/docs/TROUBLESHOOTING.md +847 -0
  150. package/examples/.cdk-cost-analyzer.yml +85 -0
  151. package/examples/.gitlab-ci.yml +125 -0
  152. package/examples/api-usage.js +26 -0
  153. package/examples/complex/base.json +16 -0
  154. package/examples/complex/target.json +29 -0
  155. package/examples/monorepo/.gitlab-ci.yml +251 -0
  156. package/examples/monorepo/README.md +341 -0
  157. package/examples/monorepo/package.json +27 -0
  158. package/examples/monorepo/packages/backend-infra/.cdk-cost-analyzer.yml +34 -0
  159. package/examples/monorepo/packages/backend-infra/bin/app.ts +16 -0
  160. package/examples/monorepo/packages/backend-infra/cdk.json +7 -0
  161. package/examples/monorepo/packages/backend-infra/lib/backend-stack.ts +128 -0
  162. package/examples/monorepo/packages/backend-infra/package.json +30 -0
  163. package/examples/monorepo/packages/backend-infra/tsconfig.json +11 -0
  164. package/examples/monorepo/packages/data-infra/.cdk-cost-analyzer.yml +38 -0
  165. package/examples/monorepo/packages/data-infra/bin/app.ts +16 -0
  166. package/examples/monorepo/packages/data-infra/cdk.json +7 -0
  167. package/examples/monorepo/packages/data-infra/lib/data-stack.ts +121 -0
  168. package/examples/monorepo/packages/data-infra/package.json +30 -0
  169. package/examples/monorepo/packages/data-infra/tsconfig.json +11 -0
  170. package/examples/monorepo/packages/frontend-infra/.cdk-cost-analyzer.yml +31 -0
  171. package/examples/monorepo/packages/frontend-infra/bin/app.ts +16 -0
  172. package/examples/monorepo/packages/frontend-infra/cdk.json +7 -0
  173. package/examples/monorepo/packages/frontend-infra/lib/frontend-stack.ts +60 -0
  174. package/examples/monorepo/packages/frontend-infra/package.json +30 -0
  175. package/examples/monorepo/packages/frontend-infra/tsconfig.json +11 -0
  176. package/examples/monorepo/tsconfig.json +35 -0
  177. package/examples/multi-stack/.cdk-cost-analyzer.yml +72 -0
  178. package/examples/multi-stack/.gitlab-ci.yml +184 -0
  179. package/examples/multi-stack/README.md +279 -0
  180. package/examples/multi-stack/bin/app.ts +36 -0
  181. package/examples/multi-stack/cdk.json +72 -0
  182. package/examples/multi-stack/lib/compute-stack.ts +128 -0
  183. package/examples/multi-stack/lib/networking-stack.ts +69 -0
  184. package/examples/multi-stack/lib/storage-stack.ts +141 -0
  185. package/examples/multi-stack/package-lock.json +4437 -0
  186. package/examples/multi-stack/package.json +42 -0
  187. package/examples/multi-stack/tsconfig.json +34 -0
  188. package/examples/simple/base.json +8 -0
  189. package/examples/simple/target.json +14 -0
  190. package/examples/single-stack/.NVP +0 -0
  191. package/examples/single-stack/.cdk-cost-analyzer.yml +52 -0
  192. package/examples/single-stack/.gitlab-ci.yml +126 -0
  193. package/examples/single-stack/README.md +184 -0
  194. package/examples/single-stack/UeK +0 -0
  195. package/examples/single-stack/bin/app.ts +16 -0
  196. package/examples/single-stack/cdk.json +72 -0
  197. package/examples/single-stack/lib/infrastructure-stack.ts +119 -0
  198. package/examples/single-stack/package-lock.json +4443 -0
  199. package/examples/single-stack/package.json +38 -0
  200. package/examples/single-stack/tsconfig.json +34 -0
  201. package/package.json +139 -0
  202. package/test-cdk-project/README-COMPUTE.md +141 -0
  203. package/test-cdk-project/README.md +95 -0
  204. package/test-cdk-project/app-with-compute.js +102 -0
  205. package/test-cdk-project/app.js +81 -0
  206. package/test-cdk-project/cdk-compute.json +3 -0
  207. package/test-cdk-project/cdk.context.json +7 -0
  208. package/test-cdk-project/cdk.json +3 -0
  209. package/test-cdk-project/cdk.out/TestStack.assets.json +21 -0
  210. package/test-cdk-project/cdk.out/TestStack.template.json +115 -0
  211. package/test-cdk-project/cdk.out/cdk.out +1 -0
  212. package/test-cdk-project/cdk.out/manifest.json +503 -0
  213. package/test-cdk-project/cdk.out/tree.json +1 -0
  214. package/test-cdk-project/cdk.out.base/TestStack.assets.json +21 -0
  215. package/test-cdk-project/cdk.out.base/TestStack.template.json +115 -0
  216. package/test-cdk-project/cdk.out.base/cdk.out +1 -0
  217. package/test-cdk-project/cdk.out.base/manifest.json +503 -0
  218. package/test-cdk-project/cdk.out.base/tree.json +1 -0
  219. package/test-cdk-project/cdk.out.target/TestStack.assets.json +21 -0
  220. package/test-cdk-project/cdk.out.target/TestStack.template.json +183 -0
  221. package/test-cdk-project/cdk.out.target/cdk.out +1 -0
  222. package/test-cdk-project/cdk.out.target/manifest.json +521 -0
  223. package/test-cdk-project/cdk.out.target/tree.json +1 -0
  224. package/test-cdk-project/package-lock.json +422 -0
  225. package/test-cdk-project/package.json +17 -0
  226. package/tools/workflows/README.md +102 -0
  227. package/tools/workflows/validate-workflows.js +109 -0
  228. package/tools/workflows/workflow-utils.ts +181 -0
@@ -0,0 +1,283 @@
1
+ # Design Document - Repository Cleanup
2
+
3
+ ## Overview
4
+
5
+ This design outlines the approach for cleaning up and reorganizing the CDK Cost Analyzer repository. The cleanup will consolidate documentation into a `docs/` folder, organize test artifacts appropriately, remove obsolete files, and ensure compliance with all steering guidelines. The goal is to create a professional, well-organized repository structure that follows Node.js/TypeScript best practices.
6
+
7
+ ## Architecture
8
+
9
+ The cleanup is a structural reorganization task that involves:
10
+
11
+ 1. **File Analysis**: Identify all files in the repository and categorize them
12
+ 2. **Documentation Consolidation**: Move supplementary docs to `docs/` folder
13
+ 3. **Test Artifact Organization**: Move or remove manual test files
14
+ 4. **Obsolete File Removal**: Remove files that are no longer needed
15
+ 5. **Reference Updates**: Update any links or references to moved files
16
+ 6. **Validation**: Ensure all steering guidelines are followed
17
+
18
+ ## Components and Interfaces
19
+
20
+ ### File Categories
21
+
22
+ The repository files fall into these categories:
23
+
24
+ 1. **Essential Root Files** (keep in root):
25
+ - `README.md` - Main project documentation
26
+ - `package.json`, `package-lock.json` - NPM configuration
27
+ - `tsconfig.json` - TypeScript configuration
28
+ - `vitest.config.mts` - Test configuration
29
+ - `.gitignore` - Git configuration
30
+
31
+ 2. **Supplementary Documentation** (move to `docs/`):
32
+ - `IMPLEMENTATION.md` - Technical implementation details
33
+ - `NEXT-STEPS.md` - Project status and next steps
34
+
35
+ 3. **Test Artifacts** (organize or remove):
36
+ - `test-api.js` - Manual test script
37
+ - `base.json`, `target.json` - Simple test templates
38
+ - `complex-base.json`, `complex-target.json` - Complex test templates
39
+ - `verify-structure.sh` - Verification script
40
+
41
+ 4. **Test Projects** (keep as-is):
42
+ - `test-cdk-project/` - Complete test CDK project with its own documentation
43
+
44
+ 5. **Source and Build** (keep as-is):
45
+ - `src/` - Source code
46
+ - `test/` - Automated tests
47
+ - `dist/` - Build output
48
+ - `node_modules/` - Dependencies
49
+
50
+ 6. **Configuration Directories** (keep as-is):
51
+ - `.kiro/` - Kiro configuration and specs
52
+ - `.git/` - Git repository data
53
+
54
+ ## Data Models
55
+
56
+ ### Repository Structure (Before)
57
+
58
+ ```
59
+ cdk-cost-analyzer/
60
+ ├── README.md
61
+ ├── IMPLEMENTATION.md ← Move to docs/
62
+ ├── NEXT-STEPS.md ← Move to docs/
63
+ ├── package.json
64
+ ├── tsconfig.json
65
+ ├── vitest.config.mts
66
+ ├── test-api.js ← Move to examples/ or remove
67
+ ├── base.json ← Move to examples/
68
+ ├── target.json ← Move to examples/
69
+ ├── complex-base.json ← Move to examples/
70
+ ├── complex-target.json ← Move to examples/
71
+ ├── verify-structure.sh ← Evaluate if needed
72
+ ├── src/
73
+ ├── test/
74
+ ├── test-cdk-project/
75
+ ├── dist/
76
+ ├── node_modules/
77
+ └── .kiro/
78
+ ```
79
+
80
+ ### Repository Structure (After)
81
+
82
+ ```
83
+ cdk-cost-analyzer/
84
+ ├── README.md
85
+ ├── package.json
86
+ ├── tsconfig.json
87
+ ├── vitest.config.mts
88
+ ├── .gitignore
89
+ ├── docs/
90
+ │ ├── IMPLEMENTATION.md
91
+ │ └── DEVELOPMENT.md ← Renamed from NEXT-STEPS.md
92
+ ├── examples/
93
+ │ ├── simple/
94
+ │ │ ├── base.json
95
+ │ │ └── target.json
96
+ │ ├── complex/
97
+ │ │ ├── base.json
98
+ │ │ └── target.json
99
+ │ └── api-usage.js ← Renamed from test-api.js
100
+ ├── src/
101
+ ├── test/
102
+ ├── test-cdk-project/
103
+ ├── dist/
104
+ ├── node_modules/
105
+ └── .kiro/
106
+ ```
107
+
108
+
109
+ ## Correctness Properties
110
+
111
+ *A property is a characteristic or behavior that should hold true across all valid executions of a system—essentially, a formal statement about what the system should do. Properties serve as the bridge between human-readable specifications and machine-verifiable correctness guarantees.*
112
+
113
+
114
+ ### Property Reflection
115
+
116
+ After reviewing the prework analysis, several properties can be consolidated:
117
+
118
+ - Properties 1.4 and 5.3 are identical (no files with backup/temp suffixes) - keep as one property
119
+ - Properties 2.3 and 3.4 both check link validity - combine into one comprehensive property
120
+ - Properties 3.3 and 4.5 both check file preservation - combine into one property about preserving functional files
121
+
122
+ The remaining properties provide unique validation value and should be kept.
123
+
124
+ ### Correctness Properties
125
+
126
+ Property 1: No temporary or backup file suffixes
127
+ *For any* file in the repository, the filename should not contain suffixes like `_backup`, `_old`, `_fixed`, `_clean`, `_temp`, or similar temporary naming patterns
128
+ **Validates: Requirements 1.4, 5.3**
129
+
130
+ Property 2: All documentation links are valid
131
+ *For any* markdown file in the repository, all internal links (links to other files in the repository) should point to files that exist
132
+ **Validates: Requirements 2.3, 3.4**
133
+
134
+ Property 3: Functional files are preserved
135
+ *For any* file in `src/`, `test/`, or configuration files (package.json, tsconfig.json, vitest.config.mts, .gitignore) that existed before cleanup, that file should still exist after cleanup
136
+ **Validates: Requirements 3.3, 4.5**
137
+
138
+ Note: Most acceptance criteria in this feature are about specific final states (examples) rather than universal properties, which is appropriate for a one-time cleanup task. The properties above capture the key invariants that should hold across all files.
139
+
140
+ ## Error Handling
141
+
142
+ ### File Operations
143
+
144
+ - **Missing files**: If a file to be moved doesn't exist, log a warning and continue
145
+ - **Permission errors**: If a file cannot be moved due to permissions, report error and stop
146
+ - **Existing destinations**: If destination file already exists, report error and ask for confirmation
147
+
148
+ ### Link Updates
149
+
150
+ - **Broken links found**: Report all broken links before making changes
151
+ - **Ambiguous paths**: If a link could refer to multiple files, report and ask for clarification
152
+ - **External links**: Do not modify external links (http://, https://)
153
+
154
+ ### Validation
155
+
156
+ - **Steering guideline violations**: Report any violations found but don't block cleanup
157
+ - **Structure issues**: Report if expected directories are missing
158
+
159
+ ## Testing Strategy
160
+
161
+ ### Manual Verification
162
+
163
+ Since this is a one-time cleanup task, testing will primarily be manual verification:
164
+
165
+ 1. **Before Cleanup Snapshot**: Document current repository state
166
+ 2. **Execute Cleanup**: Perform file moves and deletions
167
+ 3. **Verify Structure**: Check that new structure matches design
168
+ 4. **Verify Links**: Check that all documentation links work
169
+ 5. **Verify Build**: Run `npm run build` to ensure nothing broke
170
+ 6. **Verify Tests**: Run `npm test` to ensure tests still pass
171
+ 7. **Verify CLI**: Test CLI functionality with examples
172
+
173
+ ### Property-Based Tests
174
+
175
+ While this is a cleanup task, we can write simple verification scripts:
176
+
177
+ - **Property 1 Test**: Script to find files with temporary suffixes
178
+ - **Property 2 Test**: Script to validate all markdown links
179
+ - **Property 3 Test**: Script to compare file lists before/after
180
+
181
+ These scripts can be run after cleanup to verify correctness.
182
+
183
+ ### Checklist Validation
184
+
185
+ After cleanup, verify:
186
+
187
+ - [ ] Root directory contains only essential files
188
+ - [ ] All supplementary docs are in `docs/`
189
+ - [ ] README.md is in root
190
+ - [ ] Test artifacts are in `examples/` or removed
191
+ - [ ] No files with temporary suffixes exist
192
+ - [ ] All markdown links are valid
193
+ - [ ] `npm run build` succeeds
194
+ - [ ] `npm test` passes
195
+ - [ ] CLI works with example files
196
+ - [ ] Test project documentation is unchanged
197
+ - [ ] No duplicate files exist
198
+
199
+ ## Implementation Approach
200
+
201
+ ### Phase 1: Preparation
202
+
203
+ 1. Create new directory structure (`docs/`, `examples/`)
204
+ 2. Document current file locations for reference
205
+ 3. Identify all files to be moved or removed
206
+
207
+ ### Phase 2: Documentation Consolidation
208
+
209
+ 1. Create `docs/` folder
210
+ 2. Move `IMPLEMENTATION.md` to `docs/IMPLEMENTATION.md`
211
+ 3. Rename and move `NEXT-STEPS.md` to `docs/DEVELOPMENT.md`
212
+ 4. Update any links in README.md that reference moved files
213
+
214
+ ### Phase 3: Test Artifact Organization
215
+
216
+ 1. Create `examples/` folder with `simple/` and `complex/` subdirectories
217
+ 2. Move `base.json` and `target.json` to `examples/simple/`
218
+ 3. Move `complex-base.json` and `complex-target.json` to `examples/complex/`
219
+ 4. Rename and move `test-api.js` to `examples/api-usage.js`
220
+ 5. Update script to reference new example file locations
221
+ 6. Evaluate `verify-structure.sh` - remove if obsolete
222
+
223
+ ### Phase 4: Documentation Updates
224
+
225
+ 1. Update README.md to reference new file locations
226
+ 2. Update `docs/IMPLEMENTATION.md` if it references moved files
227
+ 3. Update `docs/DEVELOPMENT.md` to reflect new structure
228
+ 4. Update `examples/api-usage.js` to use new paths
229
+
230
+ ### Phase 5: Validation
231
+
232
+ 1. Run link validation script
233
+ 2. Run build: `npm run build`
234
+ 3. Run tests: `npm test`
235
+ 4. Test CLI with examples
236
+ 5. Verify no temporary files exist
237
+ 6. Review against steering guidelines
238
+
239
+ ### Phase 6: Documentation
240
+
241
+ 1. Update README.md with new structure information
242
+ 2. Add examples section showing how to use files in `examples/`
243
+ 3. Update any references to file locations
244
+
245
+ ## Steering Guideline Compliance
246
+
247
+ ### Development Standards (development-standards.md)
248
+
249
+ ✅ **No duplicate files with suffixes**: Property 1 ensures this
250
+ ✅ **Clean directory structure**: New structure is organized and logical
251
+ ✅ **Documentation approach**: Single comprehensive README with supplementary docs in `docs/`
252
+ ✅ **File management**: No temporary or backup files
253
+
254
+ ### Documentation Style (documentation-style.md)
255
+
256
+ ✅ **Professional tone**: Existing documentation already follows this
257
+ ✅ **Clear structure**: Documentation will be organized in `docs/` folder
258
+ ✅ **No emojis**: Existing docs comply (except NEXT-STEPS.md which will be reviewed)
259
+
260
+ ### TypeScript Best Practices (typescript-best-practices.md)
261
+
262
+ ✅ **Project structure**: Source in `src/`, tests in `test/`, follows conventions
263
+ ✅ **Configuration files**: All in root as expected
264
+
265
+ ### Testing Best Practices (testing-best-practices.md)
266
+
267
+ ✅ **Test organization**: Automated tests in `test/`, examples separate
268
+ ✅ **Clear separation**: Production code, tests, and examples are distinct
269
+
270
+ ## Success Criteria
271
+
272
+ The cleanup is successful when:
273
+
274
+ 1. Root directory contains only essential files (README, package files, configs)
275
+ 2. All supplementary documentation is in `docs/` folder
276
+ 3. All test artifacts are in `examples/` folder or removed
277
+ 4. No files with temporary suffixes exist
278
+ 5. All markdown links are valid and working
279
+ 6. `npm run build` completes successfully
280
+ 7. `npm test` passes all tests
281
+ 8. CLI works correctly with example files
282
+ 9. Repository structure follows all steering guidelines
283
+ 10. Git history preserves all removed files
@@ -0,0 +1,74 @@
1
+ # Requirements Document
2
+
3
+ ## Introduction
4
+
5
+ This document outlines the requirements for cleaning up and reorganizing the CDK Cost Analyzer repository. The goal is to remove unnecessary files, consolidate documentation into a dedicated folder, and maintain a clean, professional repository structure that follows best practices.
6
+
7
+ ## Glossary
8
+
9
+ - **Repository**: The CDK Cost Analyzer codebase and all its files
10
+ - **Documentation Files**: Markdown files that provide information about the project (README, IMPLEMENTATION, NEXT-STEPS, etc.)
11
+ - **Test Artifacts**: Sample JSON files and test scripts used for manual testing
12
+ - **Docs Folder**: A dedicated directory (`docs/`) for storing all documentation except the main README
13
+
14
+ ## Requirements
15
+
16
+ ### Requirement 1
17
+
18
+ **User Story:** As a developer, I want a clean repository structure, so that I can easily navigate and understand the project organization.
19
+
20
+ #### Acceptance Criteria
21
+
22
+ 1. WHEN the repository is viewed THEN the root directory SHALL contain only essential files (README, package files, config files, and source directories)
23
+ 2. WHEN documentation is needed THEN all supplementary documentation SHALL be located in a `docs/` folder
24
+ 3. WHEN test artifacts exist THEN they SHALL be organized in appropriate test directories or removed if obsolete
25
+ 4. THE repository SHALL NOT contain duplicate or temporary files with suffixes like `_backup`, `_old`, or similar
26
+ 5. THE repository SHALL follow standard Node.js/TypeScript project conventions for file organization
27
+
28
+ ### Requirement 2
29
+
30
+ **User Story:** As a developer, I want all documentation consolidated in one location, so that I can find information quickly without searching through the repository.
31
+
32
+ #### Acceptance Criteria
33
+
34
+ 1. WHEN supplementary documentation exists THEN the system SHALL move it to the `docs/` folder
35
+ 2. THE main README.md file SHALL remain in the root directory for immediate visibility
36
+ 3. WHEN documentation is moved THEN all internal links SHALL be updated to reflect new paths
37
+ 4. THE `docs/` folder SHALL contain a clear structure with descriptive filenames
38
+ 5. WHEN test project documentation exists THEN it SHALL remain with the test project for context
39
+
40
+ ### Requirement 3
41
+
42
+ **User Story:** As a developer, I want test artifacts properly organized, so that I can distinguish between automated tests and manual test files.
43
+
44
+ #### Acceptance Criteria
45
+
46
+ 1. WHEN manual test scripts exist in the root THEN they SHALL be moved to appropriate locations or removed
47
+ 2. WHEN sample JSON templates exist for testing THEN they SHALL be moved to a test fixtures directory or examples folder
48
+ 3. THE automated test suite in the `test/` directory SHALL remain unchanged
49
+ 4. WHEN test artifacts are moved THEN any references in documentation SHALL be updated
50
+ 5. THE repository SHALL clearly separate production code, automated tests, and examples
51
+
52
+ ### Requirement 4
53
+
54
+ **User Story:** As a repository maintainer, I want to remove obsolete files, so that the repository contains only current and necessary content.
55
+
56
+ #### Acceptance Criteria
57
+
58
+ 1. WHEN implementation tracking documents exist THEN they SHALL be archived or removed if no longer needed
59
+ 2. WHEN duplicate documentation exists THEN it SHALL be consolidated into single authoritative sources
60
+ 3. THE repository SHALL NOT contain files that are no longer referenced or used
61
+ 4. WHEN files are removed THEN the git history SHALL preserve them for reference
62
+ 5. THE cleanup process SHALL maintain all functional code and configuration files
63
+
64
+ ### Requirement 5
65
+
66
+ **User Story:** As a developer, I want the repository to follow all established steering guidelines, so that the codebase maintains consistency with team standards.
67
+
68
+ #### Acceptance Criteria
69
+
70
+ 1. WHEN documentation is written THEN it SHALL follow the documentation-style.md guidelines
71
+ 2. WHEN the repository structure is organized THEN it SHALL adhere to development-standards.md conventions
72
+ 3. THE repository SHALL NOT contain files that violate the development standards (no duplicate files with suffixes)
73
+ 4. WHEN documentation references AWS services THEN it SHALL use official AWS service names as specified in documentation-style.md
74
+ 5. THE repository structure SHALL align with TypeScript and testing best practices from the steering documents
@@ -0,0 +1,64 @@
1
+ # Implementation Plan
2
+
3
+ - [ ] 1. Create new directory structure
4
+ - Create `docs/` folder in repository root
5
+ - Create `examples/` folder in repository root
6
+ - Create `examples/simple/` subdirectory
7
+ - Create `examples/complex/` subdirectory
8
+ - _Requirements: 1.1, 1.2, 3.5_
9
+
10
+ - [ ] 2. Move supplementary documentation to docs folder
11
+ - Move `IMPLEMENTATION.md` to `docs/IMPLEMENTATION.md`
12
+ - Rename and move `NEXT-STEPS.md` to `docs/DEVELOPMENT.md`
13
+ - Review `docs/DEVELOPMENT.md` for any emojis or casual language and update to follow documentation-style.md
14
+ - _Requirements: 2.1, 2.2, 5.1_
15
+
16
+ - [ ] 3. Organize test artifacts into examples folder
17
+ - Move `base.json` to `examples/simple/base.json`
18
+ - Move `target.json` to `examples/simple/target.json`
19
+ - Move `complex-base.json` to `examples/complex/base.json`
20
+ - Move `complex-target.json` to `examples/complex/target.json`
21
+ - Rename and move `test-api.js` to `examples/api-usage.js`
22
+ - Update `examples/api-usage.js` to reference new file paths (`./simple/base.json`, `./simple/target.json`)
23
+ - _Requirements: 3.1, 3.2, 3.5_
24
+
25
+ - [ ] 4. Evaluate and remove obsolete files
26
+ - Check if `verify-structure.sh` is still needed
27
+ - Remove `verify-structure.sh` if it's obsolete
28
+ - _Requirements: 4.1, 4.3_
29
+
30
+ - [ ] 5. Update documentation references
31
+ - Update README.md to add "Documentation" section referencing docs folder
32
+ - Update README.md "Quick Start" examples to reference new example file paths
33
+ - Update README.md "Programmatic Usage" example to reference `examples/api-usage.js`
34
+ - Check `docs/IMPLEMENTATION.md` for any references to moved files and update paths
35
+ - Check `docs/DEVELOPMENT.md` for any references to moved files and update paths
36
+ - _Requirements: 2.3, 3.4_
37
+
38
+ - [ ] 6. Update test project documentation references
39
+ - Review `test-cdk-project/README.md` for any references to root-level files
40
+ - Update any paths in test project docs if needed
41
+ - Ensure test project documentation remains in place
42
+ - _Requirements: 2.5_
43
+
44
+ - [ ] 6.1 Write property test for no temporary file suffixes
45
+ - **Property 1: No temporary or backup file suffixes**
46
+ - **Validates: Requirements 1.4, 5.3**
47
+
48
+ - [ ] 6.2 Write property test for valid documentation links
49
+ - **Property 2: All documentation links are valid**
50
+ - **Validates: Requirements 2.3, 3.4**
51
+
52
+ - [ ] 6.3 Write property test for functional file preservation
53
+ - **Property 3: Functional files are preserved**
54
+ - **Validates: Requirements 3.3, 4.5**
55
+
56
+ - [ ] 7. Checkpoint - Verify repository structure and functionality
57
+ - Ensure all tests pass, ask the user if questions arise
58
+ - Verify `npm run build` succeeds
59
+ - Verify `npm test` passes
60
+ - Test CLI with example files: `node dist/cli/index.js examples/simple/base.json examples/simple/target.json --region eu-central-1`
61
+ - Test API usage script: `node examples/api-usage.js`
62
+ - Verify root directory contains only essential files
63
+ - Verify no files with temporary suffixes exist
64
+ - _Requirements: 1.1, 1.4, 3.3, 4.5_
@@ -0,0 +1,41 @@
1
+ ---
2
+ title: AWS CLI Best Practices
3
+ inclusion: always
4
+ ---
5
+
6
+ # AWS CLI Best Practices
7
+
8
+ ## Pager Behavior
9
+ When running AWS CLI commands that might produce large outputs, always use the `--no-cli-pager` option to prevent interactive paging. This is especially important for:
10
+ - List operations (`aws s3 ls`, `aws ec2 describe-instances`, etc.)
11
+ - Commands that return large JSON responses
12
+ - Commands used in scripts or automation
13
+
14
+ Example:
15
+ ```bash
16
+ aws amplify list-apps --profile da --no-cli-pager
17
+ aws ec2 describe-instances --no-cli-pager
18
+ aws s3 ls s3://my-bucket --no-cli-pager
19
+ ```
20
+
21
+ ## Output Formatting
22
+ - Use `--output json` for programmatic processing
23
+ - Use `--output table` for human-readable output
24
+ - Use `--query` to filter results and reduce output size
25
+
26
+ ## Error Handling
27
+ - Always check exit codes in scripts
28
+ - Use `--debug` flag for troubleshooting
29
+ - Consider using `--dry-run` for testing destructive operations
30
+
31
+ ## Security
32
+ - Use IAM roles instead of access keys when possible
33
+ - Rotate access keys regularly
34
+ - Use least privilege principle for IAM policies
35
+
36
+ ## AWS Integration Best Practices
37
+ - Use AWS-Knowledge MCP server for current documentation and best practices
38
+ - Follow AWS Well-Architected Framework principles
39
+ - Reference official AWS documentation for implementation patterns
40
+ - Validate service usage against latest AWS documentation
41
+ - Use aws-api-mcp-server for programmatic AWS API interactions
@@ -0,0 +1,49 @@
1
+ <!-- CDK Best Practices adopted from https://github.com/mbonig/kiro-steering-docs/blob/main/cdk/cdk-best-practices.md -->
2
+ ---
3
+ title: CDK Best Practices
4
+ inclusion: always
5
+ ---
6
+
7
+ # CDK Best Practices
8
+
9
+ ## Basics
10
+ - Use projen for project initialization and file management
11
+ - Use the latest version of the CDK, found here: https://github.com/aws/aws-cdk/releases
12
+ - Use cdk-iam-floyd for IAM policy generation
13
+ - Additional CDK apps should have a projen task with a prefix `cdk:`. E.g. `cdk:iam-roles`
14
+
15
+ ## Structure
16
+ - All files in the `src/**` directory
17
+ - Applications in the `src/` directory
18
+ - Stacks in the `src/stacks/**` directory
19
+ - Constructs in the `src/constructs/**` directory
20
+ - Stages in the `src/stages/**` directory
21
+ - Lambda function handlers in a sub-directory of the defining construct, called `handler`
22
+ - Pascal-casing for filenames (e.g. `SomeConstruct.ts`)
23
+ - Each custom construct should reside in its own file named the same as the construct
24
+
25
+ ## Apps
26
+ - SHOULD contain distinct stack/stage instances for each environment
27
+ - SHOULD provide each stack/stage with account/region specific values
28
+ - Context SHOULD NOT be used for anything, at all
29
+
30
+ ## Stacks
31
+ - SHOULD be responsible for importing resources (`Vpc.fromLookup()`, `Bucket.fromBucketName()`, etc.)
32
+ - SHOULD be responsible for instantiating constructs
33
+
34
+ ## Constructs
35
+ - SHOULD save the incoming constructor props as a private field
36
+ - SHOULD create all resources in protected methods, not in the constructor
37
+ - SHOULD NOT import resources (e.g. `Vpc.fromLookup()`)
38
+ - SHOULD be passed concrete objects representing resources
39
+ - Properties representing resource identifiers should use template literal types (e.g. `vpc-${string}`)
40
+
41
+ ## Tests
42
+ - All tests in the `test/` directory
43
+ - Tests should match construct names (e.g. `SomeConstruct.test.ts`)
44
+ - Use fine-grained assertions for constructs
45
+ - Use snapshot tests for stacks
46
+ - Mock `Code.fromAsset` and `ContainerImage.fromAsset` calls
47
+
48
+ ## Lambda Functions
49
+ - Use `NodejsFunction` or `PythonFunction` whenever possible
@@ -0,0 +1,54 @@
1
+ ---
2
+ title: Development Standards
3
+ inclusion: always
4
+ ---
5
+
6
+ # Development Standards
7
+
8
+ ## Dependency Management
9
+ - Use latest stable versions of all libraries and dependencies
10
+ - Leverage Context7 MCP server to verify compatibility before adding dependencies
11
+ - Justify each new dependency with clear business or technical value
12
+ - Prefer well-maintained libraries with active communities
13
+ - Document version constraints in project files
14
+ - Remove unused dependencies regularly
15
+ - Use lock files to ensure consistent installations across environments
16
+
17
+ ## Code Quality Standards
18
+ - Never create duplicate files with suffixes like `_fixed`, `_clean`, `_backup`, etc.
19
+ - Work iteratively on existing files (hooks handle commits automatically)
20
+ - Include relevant documentation links in code comments
21
+ - Follow language-specific conventions (TypeScript for CDK, Python for Lambda)
22
+ - Use meaningful variable and function names
23
+ - Keep functions small and focused on single responsibilities
24
+ - Implement proper error handling and logging
25
+
26
+ ## File Management
27
+ - Maintain clean directory structures
28
+ - Use consistent naming conventions across the project
29
+ - Avoid temporary or backup files in version control
30
+ - Organize code logically by feature or domain
31
+ - Keep configuration files at appropriate levels (project vs user)
32
+
33
+ ## Documentation Approach
34
+ - Maintain single comprehensive README covering all aspects including deployment
35
+ - Reference official sources through MCP servers when available
36
+ - Update documentation when upgrading dependencies
37
+ - Keep documentation close to relevant code
38
+ - Use inline comments for complex business logic
39
+ - Document API endpoints and data structures
40
+ - Include setup and deployment instructions
41
+
42
+ ## Version Control Integration
43
+ - Commit frequently with meaningful messages
44
+ - Use feature branches for development
45
+ - Keep main branch deployable at all times
46
+ - Tag releases appropriately
47
+ - Use .gitignore to exclude generated files and secrets
48
+
49
+ ## Quality Assurance
50
+ - Write tests for new functionality
51
+ - Run tests before committing changes
52
+ - Use linting and formatting tools consistently
53
+ - Perform code reviews for all changes
54
+ - Monitor code coverage and maintain high standards
@@ -0,0 +1,34 @@
1
+ ---
2
+ title: Docker Best Practices
3
+ inclusion: fileMatch
4
+ fileMatchPattern: 'Dockerfile*,docker-compose*,*.dockerfile'
5
+ ---
6
+
7
+ # Docker Best Practices
8
+
9
+ ## Dockerfile Optimization
10
+ - Use multi-stage builds to reduce image size
11
+ - Use specific base image tags, avoid `latest`
12
+ - Minimize layers by combining RUN commands
13
+ - Use `.dockerignore` to exclude unnecessary files
14
+ - Run as non-root user when possible
15
+
16
+ ## Security
17
+ - Scan images for vulnerabilities
18
+ - Use minimal base images (alpine, distroless)
19
+ - Don't include secrets in images
20
+ - Use secrets management for sensitive data
21
+ - Keep base images updated
22
+
23
+ ## Performance
24
+ - Order layers from least to most frequently changing
25
+ - Use build cache effectively
26
+ - Minimize context size
27
+ - Use appropriate COPY vs ADD commands
28
+
29
+ ## Best Practices
30
+ - Use LABEL for metadata
31
+ - Set appropriate WORKDIR
32
+ - Use EXPOSE for documentation
33
+ - Use health checks when appropriate
34
+ - Clean up package manager caches