Skip to content

feat: Add Executable YAML support (shebang for CloudFormation templates)#78

Closed
nmccready wants to merge 150 commits intomonken:masterfrom
brickhouse-tech:feat/executable-yaml
Closed

feat: Add Executable YAML support (shebang for CloudFormation templates)#78
nmccready wants to merge 150 commits intomonken:masterfrom
brickhouse-tech:feat/executable-yaml

Conversation

@nmccready
Copy link
Collaborator

Suggested PR description:

🔥 Executable YAML for CloudFormation

Make CloudFormation templates directly executable like shell scripts.

Usage

#!/usr/bin/env yaml
# vim: ft=yaml

Resources:
  Bucket:
    Type: AWS::S3::Bucket
chmod +x template.yaml
./template.yaml              # Preview
./template.yaml --deploy     # Deploy
Changes

• ✅ Add bin/cfn wrapper script
• ✅ Add bin/yml and bin/yaml symlinks
• ✅ Support three shebangs: #!/usr/bin/env cfn|yml|yaml
• ✅ Add executable examples
• ✅ Update package.json keywords
Marketing
"Executable YAML for AWS" — differentiates from raw CFN and heavy frameworks.

nmccready and others added 30 commits November 5, 2024 20:44
…bled

fix: fail Fn::Eval, Fn::IfEval if opts.doEval is falsy
Bumps [sort-package-json](https://github.com/keithamus/sort-package-json) from 2.10.1 to 3.2.1.
- [Release notes](https://github.com/keithamus/sort-package-json/releases)
- [Commits](keithamus/sort-package-json@v2.10.1...v3.2.1)

---
updated-dependencies:
- dependency-name: sort-package-json
  dependency-version: 3.2.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Bumps [eslint-config-prettier](https://github.com/prettier/eslint-config-prettier) from 9.1.0 to 10.1.5.
- [Release notes](https://github.com/prettier/eslint-config-prettier/releases)
- [Changelog](https://github.com/prettier/eslint-config-prettier/blob/main/CHANGELOG.md)
- [Commits](prettier/eslint-config-prettier@v9.1.0...v10.1.5)

---
updated-dependencies:
- dependency-name: eslint-config-prettier
  dependency-version: 10.1.5
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
…ckage-json-3.2.1

chore(deps-dev): bump sort-package-json from 2.10.1 to 3.2.1
…config-prettier-10.1.5

chore(deps-dev): bump eslint-config-prettier from 9.1.0 to 10.1.5
…11a52fe

fix(deps): bump the all group across 1 directory with 12 updates
Bumps the all group with 5 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@znemz/cft-utils](https://github.com/nmccready/cft-utils) | `0.1.19` | `0.1.22` |
| [glob](https://github.com/isaacs/node-glob) | `11.1.0` | `12.0.0` |
| [js-yaml](https://github.com/nodeca/js-yaml) | `3.14.2` | `4.1.1` |
| [yargs](https://github.com/yargs/yargs) | `17.7.2` | `18.0.0` |
| [mocha](https://github.com/mochajs/mocha) | `11.7.2` | `11.7.5` |



Updates `@znemz/cft-utils` from 0.1.19 to 0.1.22
- [Release notes](https://github.com/nmccready/cft-utils/releases)
- [Changelog](https://github.com/nmccready/cft-utils/blob/main/CHANGELOG.md)
- [Commits](brickhouse-tech/cft-utils@v0.1.19...v0.1.22)

Updates `glob` from 11.1.0 to 12.0.0
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](isaacs/node-glob@v11.1.0...v12.0.0)

Updates `js-yaml` from 3.14.2 to 4.1.1
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](nodeca/js-yaml@3.14.2...4.1.1)

Updates `yargs` from 17.7.2 to 18.0.0
- [Release notes](https://github.com/yargs/yargs/releases)
- [Changelog](https://github.com/yargs/yargs/blob/main/CHANGELOG.md)
- [Commits](yargs/yargs@v17.7.2...v18.0.0)

Updates `mocha` from 11.7.2 to 11.7.5
- [Release notes](https://github.com/mochajs/mocha/releases)
- [Changelog](https://github.com/mochajs/mocha/blob/v11.7.5/CHANGELOG.md)
- [Commits](mochajs/mocha@v11.7.2...v11.7.5)

---
updated-dependencies:
- dependency-name: "@znemz/cft-utils"
  dependency-version: 0.1.22
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: glob
  dependency-version: 12.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all
- dependency-name: js-yaml
  dependency-version: 4.1.1
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all
- dependency-name: yargs
  dependency-version: 18.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: all
- dependency-name: mocha
  dependency-version: 11.7.5
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
…4b45b08

fix(deps): bump the all group across 1 directory with 5 updates
creadbot_github and others added 29 commits February 14, 2026 04:06
…functions/

Phase 1 complete:
- Created src/lib/functions/ with types, helpers, and individual handler files
- fn-array-ops.ts: Flatten, FlattenDeep, Uniq, Compact, Concat, Sort, SortedUniq, SortBy, Without
- fn-object-ops.ts: Omit, OmitEmpty, Merge, DeepMerge, ObjectKeys, ObjectValues, SortObject
- fn-string-ops.ts: Stringify, StringSplit, UpperCamelCase, LowerCamelCase, JoinNow, SubNow
- fn-misc.ts: GetEnv, Eval, Filenames, Outputs, Sequence, IfEval, RefNow, ApplyTags
- fn-map.ts: Map handler
- fn-length.ts: Length handler
- fn-include.ts: Include handler with fnInclude, handleIncludeBody
- registry.ts: dispatch map Record<string, FnHandler>
- helpers.ts: findAndReplace, interpolate, JSONifyString, getBoolEnvOpt
- src/index.ts reduced from 889 to ~100 lines, clean dispatcher
- All 197 tests pass
Phase 2:
- Added depth parameter to RecurseContext, incremented on each recurse call
- Added MAX_RECURSE_DEPTH=100 safety limit to prevent stack overflow
- Depth is propagated through handler dispatch
- All 197 tests pass
…nctions

refactor: modularize Fn:: handlers + add recursion depth safety
Bumps the all group with 2 updates: [@znemz/cft-utils](https://github.com/brickhouse-tech/cft-utils) and [@znemz/sort-object](https://github.com/brickhouse-tech/sort-object).


Updates `@znemz/cft-utils` from 0.1.34 to 0.1.35
- [Release notes](https://github.com/brickhouse-tech/cft-utils/releases)
- [Changelog](https://github.com/brickhouse-tech/cft-utils/blob/main/CHANGELOG.md)
- [Commits](brickhouse-tech/cft-utils@v0.1.34...v0.1.35)

Updates `@znemz/sort-object` from 3.0.7 to 3.0.8
- [Changelog](https://github.com/brickhouse-tech/sort-object/blob/master/CHANGELOG.md)
- [Commits](brickhouse-tech/sort-object@v3.0.7...v3.0.8)

---
updated-dependencies:
- dependency-name: "@znemz/cft-utils"
  dependency-version: 0.1.35
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: "@znemz/sort-object"
  dependency-version: 3.0.8
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
…ll-4039b8c2fd

fix(deps): bump the all group with 2 updates
Bumps the all group with 5 updates:

| Package | From | To |
| --- | --- | --- |
| [@aws-sdk/client-cloudformation](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-cloudformation) | `3.985.0` | `3.986.0` |
| [@aws-sdk/client-s3](https://github.com/aws/aws-sdk-js-v3/tree/HEAD/clients/client-s3) | `3.985.0` | `3.986.0` |
| [@znemz/cft-utils](https://github.com/brickhouse-tech/cft-utils) | `0.1.35` | `0.1.36` |
| [glob](https://github.com/isaacs/node-glob) | `13.0.1` | `13.0.2` |
| [@types/node](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/node) | `25.2.2` | `25.2.3` |


Updates `@aws-sdk/client-cloudformation` from 3.985.0 to 3.986.0
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-cloudformation/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.986.0/clients/client-cloudformation)

Updates `@aws-sdk/client-s3` from 3.985.0 to 3.986.0
- [Release notes](https://github.com/aws/aws-sdk-js-v3/releases)
- [Changelog](https://github.com/aws/aws-sdk-js-v3/blob/main/clients/client-s3/CHANGELOG.md)
- [Commits](https://github.com/aws/aws-sdk-js-v3/commits/v3.986.0/clients/client-s3)

Updates `@znemz/cft-utils` from 0.1.35 to 0.1.36
- [Release notes](https://github.com/brickhouse-tech/cft-utils/releases)
- [Changelog](https://github.com/brickhouse-tech/cft-utils/blob/main/CHANGELOG.md)
- [Commits](brickhouse-tech/cft-utils@v0.1.35...v0.1.36)

Updates `glob` from 13.0.1 to 13.0.2
- [Changelog](https://github.com/isaacs/node-glob/blob/main/changelog.md)
- [Commits](isaacs/node-glob@v13.0.1...v13.0.2)

Updates `@types/node` from 25.2.2 to 25.2.3
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/node)

---
updated-dependencies:
- dependency-name: "@aws-sdk/client-cloudformation"
  dependency-version: 3.986.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: "@aws-sdk/client-s3"
  dependency-version: 3.986.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all
- dependency-name: "@znemz/cft-utils"
  dependency-version: 0.1.36
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: glob
  dependency-version: 13.0.2
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all
- dependency-name: "@types/node"
  dependency-version: 25.2.3
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: all
...

Signed-off-by: dependabot[bot] <support@github.com>
…ll-81346f0ac2

fix(deps): bump the all group with 5 updates
)

- Add --stats CLI flag to report template statistics to stderr
- Compute resource count, output count, and template size with % of CFN limits
- Warn at 80% thresholds (400 resources, 160 outputs, ~800KB size)
- List resource types and their counts
- All warnings/stats go to stderr to not break piping
- Add comprehensive tests for stats module

Refs #90
feat: add template stats and oversized template warnings (Phase 1 of #90)
… code generation (#90)

Phase 2 (suggest-split):
- src/lib/graph.ts: dependency graph builder scanning Ref, Fn::GetAtt, DependsOn, Conditions
- src/lib/split.ts: suggestSplit() groups resources by category (Networking, Compute, Data, IAM, Monitoring)
- Detects cross-stack dependencies and computes topological deployment order
- --suggest-split CLI flag prints human-readable split report

Phase 3 (auto-split):
- autoSplit() generates valid child stack templates from split suggestion
- Cross-stack references wired via Export/Fn::ImportValue
- Prunes unused Parameters, Mappings, Conditions per child stack
- Generates parent orchestrator stack with AWS::CloudFormation::Stack resources
- --auto-split <dir> CLI flag writes templates to output directory
- Works with --yaml flag for YAML output

Tests: 30 new tests covering graph detection and split logic
- Add bin/cfn wrapper script for executable CloudFormation templates
- Add bin/yml and bin/yaml symlinks for discoverability
- Support three shebang options: #!/usr/bin/env cfn|yml|yaml
- Add executable template examples (simple & full)
- Update package.json with new bin entries and keywords
- Enable 'Executable YAML' workflow: chmod +x template.yaml && ./template.yaml --deploy

This allows CloudFormation templates to be directly executable like shell scripts,
eliminating the need for explicit CLI wrapper commands.
@nmccready nmccready closed this Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants