@jjrawlins/cfn-drift-remediate 0.0.0 → 0.0.4
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/package.json +1 -1
- package/CLAUDE.md +0 -61
package/package.json
CHANGED
package/CLAUDE.md
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
# CLAUDE.md
|
|
2
|
-
|
|
3
|
-
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
|
|
4
|
-
|
|
5
|
-
## Project Overview
|
|
6
|
-
|
|
7
|
-
CLI tool and library that remediates AWS CloudFormation stack drift. It detects drifted resources, safely removes them from the stack (with DeletionPolicy:Retain), then re-imports them with their actual current state.
|
|
8
|
-
|
|
9
|
-
## Commands
|
|
10
|
-
|
|
11
|
-
```bash
|
|
12
|
-
yarn build # Full pipeline: projen synth → compile → test → package
|
|
13
|
-
yarn compile # TypeScript compile only (tsc --build)
|
|
14
|
-
yarn test # Run Jest unit tests + ESLint
|
|
15
|
-
yarn watch # Watch mode (tsc --build -w)
|
|
16
|
-
npx projen eslint # ESLint with auto-fix
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Run a single test file:
|
|
20
|
-
```bash
|
|
21
|
-
npx jest --passWithNoTests test/template-transformer.test.ts
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Integration tests are excluded from the default test run. They live in `test/integration/`.
|
|
25
|
-
|
|
26
|
-
## Projen
|
|
27
|
-
|
|
28
|
-
This project uses **projen** — `.projenrc.ts` is the source of truth for all project config. **Never edit generated files directly** (package.json, tsconfig.json, workflows, etc.). Instead modify `.projenrc.ts` and run `npx projen` to regenerate.
|
|
29
|
-
|
|
30
|
-
## Architecture
|
|
31
|
-
|
|
32
|
-
**Entry point** — `src/index.ts` is both the CLI entrypoint (Commander.js) and the library export for programmatic use.
|
|
33
|
-
|
|
34
|
-
**Orchestration** — `src/cli.ts` contains `remediate()`, the main 10-step process:
|
|
35
|
-
1. Fetch stack info and template
|
|
36
|
-
2. Detect and collect drifted resources
|
|
37
|
-
3. Filter to importable resource types
|
|
38
|
-
4. Build ResourceToImport descriptors with physical identifiers
|
|
39
|
-
5. Set DeletionPolicy:Retain on all resources (safety net)
|
|
40
|
-
6. Resolve cross-references via temporary stack Outputs
|
|
41
|
-
7. Remove drifted resources from template, update stack
|
|
42
|
-
8. Re-import resources via IMPORT change set
|
|
43
|
-
9. Restore original template
|
|
44
|
-
|
|
45
|
-
**Key modules in `src/lib/`:**
|
|
46
|
-
- `cfn-client.ts` — AWS SDK wrapper (CloudFormation API calls with polling)
|
|
47
|
-
- `template-transformer.ts` — Pure functions for CloudFormation template manipulation (parse, stringify, add/remove resources, resolve Ref/GetAtt)
|
|
48
|
-
- `eligible-resources.ts` — Static registry of ~100 importable resource types with their identifier fields
|
|
49
|
-
- `resource-importer.ts` — Maps drifted resources to ResourceToImport descriptors, including special-case identifier handling for S3, SQS, Lambda, etc.
|
|
50
|
-
- `types.ts` — TypeScript interfaces
|
|
51
|
-
- `utils.ts` — sleep, deepClone, Logger
|
|
52
|
-
|
|
53
|
-
**Template parsing** uses `yaml-cfn` which correctly handles CloudFormation intrinsic functions (`!Ref`, `!GetAtt`, etc.).
|
|
54
|
-
|
|
55
|
-
## PR Title Convention
|
|
56
|
-
|
|
57
|
-
Semantic PR titles required. Allowed prefixes: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `chore`, `revert`, `ci`, `build`, `deps`, `wip`, `release`.
|
|
58
|
-
|
|
59
|
-
## Runtime Versions
|
|
60
|
-
|
|
61
|
-
Node 20.19.0 and Yarn 1.22.22 (pinned in `.tool-versions`). Release workflow uses Node 24 for OIDC-based npm publishing.
|