Summarize AWS CDK diff JSON as compact Markdown.
Project description
cdk-diff-summary
cdk-diff-summary reads AWS CDK diff JSON and renders a compact Markdown summary.
It is useful locally, in CI systems, and in GitHub Actions workflows where raw CDK or CloudFormation diffs are too noisy. It groups adds, modifies, removes, replacements, security group rule changes, and other changes while reducing common churn from IAM policy documents and CDK asset hashes.
The tool deliberately shows changed field paths only, not before/after values, to avoid exposing sensitive infrastructure values in summaries.
Install
pipx install cdk-diff-summary
or:
python -m pip install cdk-diff-summary
Usage
Generate CDK diff JSON:
npx cdk diff --json > cdk-diff.json
Render Markdown to stdout:
cdk-diff-summary cdk-diff.json
Append Markdown to a file:
cdk-diff-summary cdk-diff.json --output cdk-diff-summary.md
Use a custom title and field limit:
cdk-diff-summary cdk-diff.json \
--title "Production CDK diff" \
--max-changed-fields 5
Fail when visible removals or replacements exist:
cdk-diff-summary cdk-diff.json --fail-on-remove --fail-on-replace
CLI Options
| Option | Description |
|---|---|
diff-json-path |
Path to JSON produced by cdk diff --json. May also be set with DIFF_JSON_PATH. |
--title |
Markdown heading for the summary. Defaults to CDK diff summary. |
--max-changed-fields |
Maximum changed field paths shown per resource. Defaults to 8. |
--collapse-iam-policies / --no-collapse-iam-policies |
Collapse large IAM policy document diffs to compact paths. Enabled by default. |
--collapse-assets / --no-collapse-assets |
Collapse common CDK asset/hash churn. Enabled by default. |
--fail-on-remove |
Write the summary, then exit non-zero if visible resource removes exist. |
--fail-on-replace |
Write the summary, then exit non-zero if visible resource replacements exist. |
--output |
Optional path to append the generated Markdown summary. |
--github-step-summary |
Optional path to append GitHub Step Summary Markdown. Defaults to $GITHUB_STEP_SUMMARY. |
Environment variables compatible with the GitHub Action wrapper are also supported:
DIFF_JSON_PATHSUMMARY_TITLEMAX_CHANGED_FIELDSCOLLAPSE_IAM_POLICIESCOLLAPSE_ASSETSFAIL_ON_REMOVEFAIL_ON_REPLACESUMMARY_OUTPUT_PATHGITHUB_STEP_SUMMARY
CLI arguments take precedence over environment variables.
Example Output
## CDK diff summary
| Metric | Count |
| --- | ---: |
| Stack changes | 1 |
| Resource changes | 3 |
| Adds | 1 |
| Modifies | 1 |
| Removes | 0 |
| Replacements | 1 |
| Security group changes | 1 |
| Changes shown below | 4 |
### Replacements
| Stack | Logical ID | Action | Resource type | Changed fields |
| --- | --- | --- | --- | --- |
| PaymentsStack | Worker | replace | AWS::Lambda::Function | `Architectures[]`, `Layers[]` |
### Security group changes
| Stack | Security group | Direction | Protocol | Port | Action |
| --- | --- | --- | --- | --- | --- |
| PaymentsStack | AppSecurityGroup | ingress | tcp | 443 | add |
Local Development
python -m pip install -e ".[dev]"
python -m pytest
ruff check .
python -m build
twine check dist/*
Run from source:
cdk-diff-summary example_cdk_diff_json/cdk-diff-json-tiny.json
Publishing
This package is ready for PyPI trusted publishing. Create a PyPI project named cdk-diff-summary, configure a trusted publisher for this repository and the publish.yml workflow, then create a GitHub release.
For a manual dry run:
python -m build
twine check dist/*
CDK diff JSON shape can vary by CDK version. If parsing fails, please open an issue with a sanitized example of the JSON shape that failed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cdk_diff_summary-1.1.1.tar.gz.
File metadata
- Download URL: cdk_diff_summary-1.1.1.tar.gz
- Upload date:
- Size: 14.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
939f7b3ffc341741d532b0f929d71dc14657bb67e4649e392775956ee569c5e1
|
|
| MD5 |
6154d08cddcd092b882187973a3d6795
|
|
| BLAKE2b-256 |
80f49e60cd838c347e0e308db551690a1b195fa490d661e5e1b511ca8925673e
|
Provenance
The following attestation bundles were made for cdk_diff_summary-1.1.1.tar.gz:
Publisher:
publish.yml on jalcock501/cdk-diff-summary-pypi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cdk_diff_summary-1.1.1.tar.gz -
Subject digest:
939f7b3ffc341741d532b0f929d71dc14657bb67e4649e392775956ee569c5e1 - Sigstore transparency entry: 1931647511
- Sigstore integration time:
-
Permalink:
jalcock501/cdk-diff-summary-pypi@81692d53a289feb4a027405c01e55383f4d971c5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jalcock501
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@81692d53a289feb4a027405c01e55383f4d971c5 -
Trigger Event:
release
-
Statement type:
File details
Details for the file cdk_diff_summary-1.1.1-py3-none-any.whl.
File metadata
- Download URL: cdk_diff_summary-1.1.1-py3-none-any.whl
- Upload date:
- Size: 12.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
04c4418c3147534045cc657980218240f0b7bad53e8759ec5594f65ad02cad3b
|
|
| MD5 |
27bc444c024cd745fddf4d7d13696b51
|
|
| BLAKE2b-256 |
ce0ca0b6588539abfd4aa4ac18c475fc92fd348520acd494362b4151f3e4f4e3
|
Provenance
The following attestation bundles were made for cdk_diff_summary-1.1.1-py3-none-any.whl:
Publisher:
publish.yml on jalcock501/cdk-diff-summary-pypi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
cdk_diff_summary-1.1.1-py3-none-any.whl -
Subject digest:
04c4418c3147534045cc657980218240f0b7bad53e8759ec5594f65ad02cad3b - Sigstore transparency entry: 1931647623
- Sigstore integration time:
-
Permalink:
jalcock501/cdk-diff-summary-pypi@81692d53a289feb4a027405c01e55383f4d971c5 -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/jalcock501
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@81692d53a289feb4a027405c01e55383f4d971c5 -
Trigger Event:
release
-
Statement type: