grada-run 0.0.2 → 0.32.0

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 (231) hide show
  1. package/.github/workflows/deploy-docs.yml +37 -0
  2. package/.github/workflows/iac-validation.yml +303 -0
  3. package/.github/workflows/publish.yml +68 -0
  4. package/.github/workflows/sync-bedrock-models.yml +57 -0
  5. package/.github/workflows/test.yml +43 -0
  6. package/.muserules +31 -0
  7. package/LICENSE +21 -0
  8. package/README.md +193 -3
  9. package/apps/docs/.astro/collections/docs.schema.json +644 -0
  10. package/apps/docs/.astro/content-assets.mjs +4 -0
  11. package/apps/docs/.astro/content-modules.mjs +4 -0
  12. package/apps/docs/.astro/content.d.ts +179 -0
  13. package/apps/docs/.astro/data-store.json +1 -0
  14. package/apps/docs/.astro/dev.json +14 -0
  15. package/apps/docs/.astro/settings.json +5 -0
  16. package/apps/docs/.astro/types.d.ts +2 -0
  17. package/apps/docs/astro.config.mjs +97 -0
  18. package/apps/docs/package.json +17 -0
  19. package/apps/docs/src/content/docs/adrs/0001-s3-native-state-locking.md +37 -0
  20. package/apps/docs/src/content/docs/adrs/0002-eject-mechanism-pure-iac.md +39 -0
  21. package/apps/docs/src/content/docs/adrs/0003-sync-ai-context-strategy.md +48 -0
  22. package/apps/docs/src/content/docs/adrs/0004-iac-driven-diagnostic-context.md +37 -0
  23. package/apps/docs/src/content/docs/adrs/0005-ecs-fargate-alb-runtime-target.md +38 -0
  24. package/apps/docs/src/content/docs/adrs/0006-github-oidc-no-stored-keys.md +37 -0
  25. package/apps/docs/src/content/docs/adrs/0007-framework-detection-with-fallback.md +37 -0
  26. package/apps/docs/src/content/docs/adrs/0008-secrets-names-in-git-values-in-aws.md +37 -0
  27. package/apps/docs/src/content/docs/adrs/0009-regenerate-with-backup-on-rerun.md +37 -0
  28. package/apps/docs/src/content/docs/adrs/0010-advisory-only-security-scans.md +37 -0
  29. package/apps/docs/src/content/docs/cli/add.md +84 -0
  30. package/apps/docs/src/content/docs/cli/apply.md +32 -0
  31. package/apps/docs/src/content/docs/cli/db.md +200 -0
  32. package/apps/docs/src/content/docs/cli/destroy.md +31 -0
  33. package/apps/docs/src/content/docs/cli/diagnose.md +37 -0
  34. package/apps/docs/src/content/docs/cli/doctor.md +28 -0
  35. package/apps/docs/src/content/docs/cli/domain.md +57 -0
  36. package/apps/docs/src/content/docs/cli/drift.md +40 -0
  37. package/apps/docs/src/content/docs/cli/eject.md +29 -0
  38. package/apps/docs/src/content/docs/cli/exec.md +49 -0
  39. package/apps/docs/src/content/docs/cli/gc.md +37 -0
  40. package/apps/docs/src/content/docs/cli/init.md +72 -0
  41. package/apps/docs/src/content/docs/cli/logs.md +39 -0
  42. package/apps/docs/src/content/docs/cli/rollback.md +51 -0
  43. package/apps/docs/src/content/docs/cli/secrets.md +73 -0
  44. package/apps/docs/src/content/docs/cli/sleep.md +53 -0
  45. package/apps/docs/src/content/docs/cli/status.md +34 -0
  46. package/apps/docs/src/content/docs/cli/sync-ai.md +27 -0
  47. package/apps/docs/src/content/docs/guides/architecture.md +87 -0
  48. package/apps/docs/src/content/docs/guides/aws-credentials.md +72 -0
  49. package/apps/docs/src/content/docs/guides/background-workers.md +45 -0
  50. package/apps/docs/src/content/docs/guides/cicd-pipeline.md +64 -0
  51. package/apps/docs/src/content/docs/guides/database-connections.md +64 -0
  52. package/apps/docs/src/content/docs/guides/docker-compose.md +37 -0
  53. package/apps/docs/src/content/docs/guides/dockerfiles.md +46 -0
  54. package/apps/docs/src/content/docs/guides/ephemeral-pr-previews.md +39 -0
  55. package/apps/docs/src/content/docs/guides/examples.md +50 -0
  56. package/apps/docs/src/content/docs/guides/frameworks.md +88 -0
  57. package/apps/docs/src/content/docs/guides/headless.md +75 -0
  58. package/apps/docs/src/content/docs/guides/quickstart.md +52 -0
  59. package/apps/docs/src/content/docs/guides/rerun-init.md +43 -0
  60. package/apps/docs/src/content/docs/guides/secrets-management.md +83 -0
  61. package/apps/docs/src/content/docs/guides/understanding-your-bill.md +63 -0
  62. package/apps/docs/src/content/docs/index.mdx +103 -0
  63. package/apps/docs/src/content/docs/migrations/astro-vercel-to-aws.md +55 -0
  64. package/apps/docs/src/content/docs/migrations/heroku-procfile-to-aws.md +41 -0
  65. package/apps/docs/src/content/docs/migrations/nextjs-vercel-to-aws.md +51 -0
  66. package/apps/docs/src/content/docs/migrations/sveltekit-vercel-to-aws.md +63 -0
  67. package/apps/docs/src/content/docs/roadmap.md +97 -0
  68. package/apps/docs/src/content/docs/testing-strategy.md +32 -0
  69. package/apps/docs/src/content.config.ts +7 -0
  70. package/apps/docs/src/custom.css +14 -0
  71. package/apps/docs/tsconfig.json +6 -0
  72. package/bin/cli.js +140 -0
  73. package/package.json +105 -7
  74. package/scripts/sync-bedrock-models.js +22 -0
  75. package/scripts/test-iac.js +261 -0
  76. package/specs/add-redis-sqs-bedrock.md +128 -0
  77. package/specs/add-storage-dynamodb.md +106 -0
  78. package/specs/bedrock-model-catalog.md +131 -0
  79. package/specs/ci-pipeline.md +17 -0
  80. package/specs/cost-transparency.md +115 -0
  81. package/specs/custom-domains-and-ses.md +153 -0
  82. package/specs/database-suite-expansion.md +151 -0
  83. package/specs/db-connect.md +69 -0
  84. package/specs/db-lifecycle-migrations.md +159 -0
  85. package/specs/dependency-aware-init.md +176 -0
  86. package/specs/deploy-stack-to-grada-run-rebrand.md +45 -0
  87. package/specs/deployment-safety.md +170 -0
  88. package/specs/diagnose.md +16 -0
  89. package/specs/docs-hub.md +16 -0
  90. package/specs/dx-polish.md +46 -0
  91. package/specs/exec.md +25 -0
  92. package/specs/finops-cron-drift.md +161 -0
  93. package/specs/gc.md +26 -0
  94. package/specs/integration-suite.md +16 -0
  95. package/specs/logs.md +32 -0
  96. package/specs/rollback-live-polling.md +40 -0
  97. package/specs/secrets-pull-audit.md +51 -0
  98. package/specs/serverless-lambda-target.md +133 -0
  99. package/specs/status.md +31 -0
  100. package/specs/telemetry-and-spawn-hardening.md +69 -0
  101. package/specs/telemetry-hardening.md +35 -0
  102. package/src/commands/add.js +1111 -0
  103. package/src/commands/apply.js +214 -0
  104. package/src/commands/db/backup.js +229 -0
  105. package/src/commands/db/connect.js +304 -0
  106. package/src/commands/db/enable-vector.js +344 -0
  107. package/src/commands/db/import.js +604 -0
  108. package/src/commands/db/migrate.js +477 -0
  109. package/src/commands/db/restore.js +361 -0
  110. package/src/commands/db.js +87 -0
  111. package/src/commands/destroy.js +217 -0
  112. package/src/commands/diagnose.js +460 -0
  113. package/src/commands/doctor.js +109 -0
  114. package/src/commands/domain.js +685 -0
  115. package/src/commands/drift.js +243 -0
  116. package/src/commands/eject.js +127 -0
  117. package/src/commands/exec.js +222 -0
  118. package/src/commands/gc.js +250 -0
  119. package/src/commands/init.js +649 -0
  120. package/src/commands/logs.js +256 -0
  121. package/src/commands/rollback.js +323 -0
  122. package/src/commands/secrets.js +485 -0
  123. package/src/commands/sleep.js +347 -0
  124. package/src/commands/status.js +309 -0
  125. package/src/commands/sync-ai.js +115 -0
  126. package/src/commands/wake.js +337 -0
  127. package/src/core/parser.js +126 -0
  128. package/src/core/telemetry.js +244 -0
  129. package/src/data/bedrock-models.json +896 -0
  130. package/src/utils/addons.js +126 -0
  131. package/src/utils/ai-rules.js +59 -0
  132. package/src/utils/args.js +91 -0
  133. package/src/utils/aws.js +178 -0
  134. package/src/utils/backup.js +69 -0
  135. package/src/utils/bedrock-catalog.js +511 -0
  136. package/src/utils/capabilities.js +500 -0
  137. package/src/utils/command.js +65 -0
  138. package/src/utils/db-tunnel.js +164 -0
  139. package/src/utils/detector.js +298 -0
  140. package/src/utils/dockerCompose.js +65 -0
  141. package/src/utils/domains.js +73 -0
  142. package/src/utils/ecs-runner.js +289 -0
  143. package/src/utils/ecs.js +92 -0
  144. package/src/utils/frameworks.js +55 -0
  145. package/src/utils/generator.js +527 -0
  146. package/src/utils/hcl.js +426 -0
  147. package/src/utils/lambda-ecr.js +185 -0
  148. package/src/utils/prompts.js +278 -0
  149. package/src/utils/rds.js +131 -0
  150. package/src/utils/resolvers.js +174 -0
  151. package/src/utils/sleep-state.js +140 -0
  152. package/src/utils/sleep-targets.js +139 -0
  153. package/src/utils/system.js +42 -0
  154. package/src/utils/terraform.js +70 -0
  155. package/src/utils/visualizer.js +381 -0
  156. package/src/utils/warnings.js +49 -0
  157. package/templates/README.md +150 -0
  158. package/templates/docker/django.Dockerfile +40 -0
  159. package/templates/docker/go.Dockerfile +23 -0
  160. package/templates/docker/nestjs.Dockerfile +33 -0
  161. package/templates/docker/nextjs.Dockerfile +55 -0
  162. package/templates/docker/node.Dockerfile +24 -0
  163. package/templates/docker/nuxt.Dockerfile +47 -0
  164. package/templates/docker/python.Dockerfile +38 -0
  165. package/templates/docker/rails.Dockerfile +59 -0
  166. package/templates/docker/static.Dockerfile +32 -0
  167. package/templates/docker/svelte.Dockerfile +52 -0
  168. package/templates/github/deploy-lambda.yml +120 -0
  169. package/templates/github/deploy.yml +138 -0
  170. package/templates/github/drift.yml +112 -0
  171. package/templates/github/preview-lambda.yml +86 -0
  172. package/templates/github/preview.yml +69 -0
  173. package/templates/github/teardown.yml +43 -0
  174. package/templates/terraform/addons/bedrock.tf +34 -0
  175. package/templates/terraform/addons/cron-lambda.tf +78 -0
  176. package/templates/terraform/addons/cron.tf +101 -0
  177. package/templates/terraform/addons/dynamodb.tf +73 -0
  178. package/templates/terraform/addons/redis.tf +64 -0
  179. package/templates/terraform/addons/s3.tf +143 -0
  180. package/templates/terraform/addons/ses.tf +73 -0
  181. package/templates/terraform/addons/sqs.tf +67 -0
  182. package/templates/terraform/backend.tf +22 -0
  183. package/templates/terraform/cloudfront-lambda.tf +80 -0
  184. package/templates/terraform/cloudfront.tf +80 -0
  185. package/templates/terraform/database-aurora-postgresql.tf +92 -0
  186. package/templates/terraform/database-mysql.tf +72 -0
  187. package/templates/terraform/database.tf +71 -0
  188. package/templates/terraform/main-lambda.tf +229 -0
  189. package/templates/terraform/main.tf +296 -0
  190. package/templates/terraform/network.tf +95 -0
  191. package/templates/terraform/oidc.tf +64 -0
  192. package/templates/terraform/secrets.tf +31 -0
  193. package/templates/terraform/worker.tf +69 -0
  194. package/tests/__snapshots__/generator.test.js.snap +9633 -0
  195. package/tests/add.test.js +2037 -0
  196. package/tests/ai.test.js +94 -0
  197. package/tests/apply.test.js +488 -0
  198. package/tests/args.test.js +86 -0
  199. package/tests/aws.test.js +244 -0
  200. package/tests/capabilities.test.js +307 -0
  201. package/tests/cli.test.js +29 -0
  202. package/tests/command.test.js +100 -0
  203. package/tests/commands-import.test.js +74 -0
  204. package/tests/db.test.js +2704 -0
  205. package/tests/destroy.test.js +391 -0
  206. package/tests/detector.test.js +79 -0
  207. package/tests/diagnose.test.js +779 -0
  208. package/tests/doctor.test.js +202 -0
  209. package/tests/domain.test.js +899 -0
  210. package/tests/drift.test.js +243 -0
  211. package/tests/ecs.test.js +130 -0
  212. package/tests/eject.test.js +65 -0
  213. package/tests/exec.test.js +380 -0
  214. package/tests/gc.test.js +496 -0
  215. package/tests/generator.test.js +794 -0
  216. package/tests/headless.test.js +562 -0
  217. package/tests/lambda-ecr.test.js +185 -0
  218. package/tests/logs.test.js +447 -0
  219. package/tests/parser.test.js +160 -0
  220. package/tests/rds.test.js +244 -0
  221. package/tests/resolvers.test.js +282 -0
  222. package/tests/rollback.test.js +692 -0
  223. package/tests/secrets.test.js +752 -0
  224. package/tests/sleep-wake.test.js +1016 -0
  225. package/tests/status.test.js +370 -0
  226. package/tests/system.test.js +70 -0
  227. package/tests/telemetry.test.js +520 -0
  228. package/tests/terraform.test.js +84 -0
  229. package/tests/visualizer.test.js +496 -0
  230. package/vitest.config.js +9 -0
  231. package/index.js +0 -2
@@ -0,0 +1,37 @@
1
+ name: Deploy Docs to GitHub Pages
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ paths: ['apps/docs/**']
7
+ workflow_dispatch:
8
+
9
+ permissions:
10
+ contents: read
11
+ pages: write
12
+ id-token: write
13
+
14
+ jobs:
15
+ build:
16
+ runs-on: ubuntu-latest
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+ - uses: actions/setup-node@v4
20
+ with:
21
+ node-version: 22
22
+ - run: npm ci
23
+ - run: npm run build
24
+ working-directory: apps/docs
25
+ - uses: actions/upload-pages-artifact@v3
26
+ with:
27
+ path: apps/docs/dist
28
+
29
+ deploy:
30
+ environment:
31
+ name: github-pages
32
+ url: ${{ steps.deployment.outputs.page_url }}
33
+ needs: build
34
+ runs-on: ubuntu-latest
35
+ steps:
36
+ - id: deployment
37
+ uses: actions/deploy-pages@v4
@@ -0,0 +1,303 @@
1
+ name: IaC Validation
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ workflow_dispatch:
8
+ workflow_call:
9
+
10
+ jobs:
11
+ validate:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ framework: [nestjs, nextjs, nuxt, node, svelte, static, python, django, rails, go]
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Setup Node.js
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: '24.x'
23
+
24
+ - name: Install dependencies
25
+ run: npm install
26
+
27
+ - name: Setup Terraform
28
+ uses: hashicorp/setup-terraform@v3
29
+
30
+ - name: Setup TFLint
31
+ uses: terraform-linters/setup-tflint@v4
32
+ with:
33
+ github_token: ${{ secrets.GITHUB_TOKEN }}
34
+
35
+ - name: Scaffold app (${{ matrix.framework }})
36
+ env:
37
+ CI_MOCK_AWS: 'true'
38
+ DO_NOT_TRACK: '1'
39
+ run: |
40
+ TMPROOT=$(mktemp -d)
41
+ APP_DIR="$TMPROOT/test-app-${{ matrix.framework }}"
42
+ mkdir -p "$APP_DIR"
43
+ echo "GENERATED_DIR=$APP_DIR" >> "$GITHUB_ENV"
44
+ cd "$APP_DIR"
45
+ node "$GITHUB_WORKSPACE/bin/cli.js" --headless --preconfigured --framework=${{ matrix.framework }}
46
+
47
+ - name: Terraform Compile
48
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
49
+ run: |
50
+ terraform init -backend=false
51
+ terraform validate
52
+
53
+ - name: Init TFLint
54
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
55
+ run: tflint --init
56
+
57
+ - name: Terraform Lint
58
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
59
+ run: tflint
60
+
61
+ - name: DevSecOps Scan (IaC & Filesystem)
62
+ uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25
63
+ with:
64
+ scan-type: 'fs'
65
+ scan-ref: ${{ env.GENERATED_DIR }}
66
+ format: 'table'
67
+ output: 'trivy-fs-results.txt'
68
+ severity: 'HIGH,CRITICAL'
69
+ exit-code: '0'
70
+
71
+ - name: Build Container Image
72
+ working-directory: ${{ env.GENERATED_DIR }}
73
+ run: |
74
+ awk '
75
+ /^COPY/ { next }
76
+ /^RUN/ {
77
+ if ($0 ~ /apk |apt-get |apt |addgroup |adduser |groupadd |useradd |gem install |mkdir |chown |rm /) {
78
+ print $0
79
+ skip = 0
80
+ } else {
81
+ skip = 1
82
+ }
83
+ next
84
+ }
85
+ {
86
+ if (skip) {
87
+ # If the line does NOT end with a backslash, the skipped block is over
88
+ if ($0 !~ /\\ *$/) skip = 0
89
+ } else {
90
+ print $0
91
+ }
92
+ }
93
+ ' Dockerfile > Dockerfile.tmp && mv Dockerfile.tmp Dockerfile
94
+
95
+ # Print the patched Dockerfile to the logs for easy debugging
96
+ echo "Patched Dockerfile:"
97
+ cat Dockerfile
98
+ echo "-------------------"
99
+
100
+ docker build -t test-app-${{ matrix.framework }}:latest .
101
+
102
+ - name: DevSecOps Scan (Container Image)
103
+ uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25
104
+ with:
105
+ image-ref: 'test-app-${{ matrix.framework }}:latest'
106
+ format: 'table'
107
+ output: 'trivy-image-results.txt'
108
+ severity: 'HIGH,CRITICAL'
109
+ exit-code: '0'
110
+
111
+ - name: Publish Trivy Summary to GitHub Actions UI
112
+ if: always()
113
+ run: |
114
+ echo "### 🏗️ Terraform Misconfiguration Scan (${{ matrix.framework }})" >> $GITHUB_STEP_SUMMARY
115
+ echo "\`\`\`text" >> $GITHUB_STEP_SUMMARY
116
+ if [ -f trivy-fs-results.txt ]; then cat trivy-fs-results.txt >> $GITHUB_STEP_SUMMARY; else echo "Scan failed or skipped."; fi
117
+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
118
+ echo "" >> $GITHUB_STEP_SUMMARY
119
+
120
+ echo "### 🛡️ Container Security Scan Results (${{ matrix.framework }})" >> $GITHUB_STEP_SUMMARY
121
+ echo "\`\`\`text" >> $GITHUB_STEP_SUMMARY
122
+ if [ -f trivy-image-results.txt ]; then cat trivy-image-results.txt >> $GITHUB_STEP_SUMMARY; else echo "Container scan failed or skipped."; fi
123
+ echo "\`\`\`" >> $GITHUB_STEP_SUMMARY
124
+
125
+ validate-addons:
126
+ runs-on: ubuntu-latest
127
+ steps:
128
+ - uses: actions/checkout@v4
129
+
130
+ - name: Setup Node.js
131
+ uses: actions/setup-node@v4
132
+ with:
133
+ node-version: '24.x'
134
+
135
+ - name: Install dependencies
136
+ run: npm install
137
+
138
+ - name: Setup Terraform
139
+ uses: hashicorp/setup-terraform@v3
140
+
141
+ - name: Setup TFLint
142
+ uses: terraform-linters/setup-tflint@v4
143
+ with:
144
+ github_token: ${{ secrets.GITHUB_TOKEN }}
145
+
146
+ - name: Scaffold backend with all addons
147
+ env:
148
+ CI_MOCK_AWS: 'true'
149
+ DO_NOT_TRACK: '1'
150
+ run: |
151
+ TMPROOT=$(mktemp -d)
152
+ APP_DIR="$TMPROOT/test-app-addons"
153
+ mkdir -p "$APP_DIR"
154
+ echo "GENERATED_DIR=$APP_DIR" >> "$GITHUB_ENV"
155
+ cd "$APP_DIR"
156
+ printf '{"scripts":{"db:migrate":"prisma migrate deploy"}}' > package.json
157
+ printf 'web: node index.js\nworker: node worker.js\n' > Procfile
158
+ node "$GITHUB_WORKSPACE/bin/cli.js" --headless --preconfigured --framework=nestjs --needsDatabase \
159
+ --with storage:s3,db:dynamodb,db:redis,queue:sqs,ai:bedrock,email:ses,cron \
160
+ --domain example.com --zone-id Z1234567890ABC --setup-ci-migrate
161
+ node "$GITHUB_WORKSPACE/bin/cli.js" domain add example.com --zone-id Z1234567890ABC
162
+ test -f terraform/ses.tf
163
+ test -f terraform/bedrock.tf
164
+ test -f terraform/cron.tf
165
+ test -f terraform/worker.tf
166
+ test -f terraform/domain.tf
167
+ grep -q 'grada:db-migrate-start' .github/workflows/deploy.yml
168
+
169
+ - name: Terraform Compile
170
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
171
+ run: |
172
+ terraform init -backend=false
173
+ terraform validate
174
+
175
+ - name: Init TFLint
176
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
177
+ run: tflint --init
178
+
179
+ - name: Terraform Lint
180
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
181
+ run: tflint
182
+
183
+ validate-engines:
184
+ runs-on: ubuntu-latest
185
+ strategy:
186
+ matrix:
187
+ db-engine: [mysql, aurora-postgresql]
188
+ steps:
189
+ - uses: actions/checkout@v4
190
+
191
+ - name: Setup Node.js
192
+ uses: actions/setup-node@v4
193
+ with:
194
+ node-version: '24.x'
195
+
196
+ - name: Install dependencies
197
+ run: npm install
198
+
199
+ - name: Setup Terraform
200
+ uses: hashicorp/setup-terraform@v3
201
+
202
+ - name: Setup TFLint
203
+ uses: terraform-linters/setup-tflint@v4
204
+ with:
205
+ github_token: ${{ secrets.GITHUB_TOKEN }}
206
+
207
+ - name: Scaffold app (${{ matrix.db-engine }})
208
+ env:
209
+ CI_MOCK_AWS: 'true'
210
+ DO_NOT_TRACK: '1'
211
+ run: |
212
+ TMPROOT=$(mktemp -d)
213
+ APP_DIR="$TMPROOT/test-app-engine-${{ matrix.db-engine }}"
214
+ mkdir -p "$APP_DIR"
215
+ echo "GENERATED_DIR=$APP_DIR" >> "$GITHUB_ENV"
216
+ cd "$APP_DIR"
217
+ node "$GITHUB_WORKSPACE/bin/cli.js" --headless --preconfigured --framework=node --needsDatabase --db-engine ${{ matrix.db-engine }}
218
+ test -f terraform/database.tf
219
+
220
+ - name: Terraform Compile
221
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
222
+ run: |
223
+ terraform init -backend=false
224
+ terraform validate
225
+
226
+ - name: Init TFLint
227
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
228
+ run: tflint --init
229
+
230
+ - name: Terraform Lint
231
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
232
+ run: tflint
233
+ validate-lambda:
234
+ runs-on: ubuntu-latest
235
+ strategy:
236
+ matrix:
237
+ include:
238
+ - name: base
239
+ scaffold: node "$GITHUB_WORKSPACE/bin/cli.js" --headless --preconfigured --framework=node --target lambda
240
+ assert: test -f terraform/main.tf
241
+ - name: aurora-addons-domain
242
+ scaffold: |
243
+ printf '{"scripts":{"db:migrate":"prisma migrate deploy"}}' > package.json
244
+ printf 'web: node index.js\n' > Procfile
245
+ node "$GITHUB_WORKSPACE/bin/cli.js" --headless --preconfigured --framework=node --target lambda --needsDatabase --db-engine aurora-postgresql \
246
+ --with storage:s3,db:dynamodb,db:redis,queue:sqs,ai:bedrock,email:ses,cron \
247
+ --domain example.com --zone-id Z1234567890ABC --setup-ci-migrate
248
+ node "$GITHUB_WORKSPACE/bin/cli.js" domain add example.com --zone-id Z1234567890ABC
249
+ assert: |
250
+ test -f terraform/database.tf
251
+ test -f terraform/ses.tf
252
+ test -f terraform/bedrock.tf
253
+ test -f terraform/cron.tf
254
+ test -f terraform/redis.tf
255
+ test -f terraform/domain.tf
256
+ test ! -f terraform/worker.tf
257
+ grep -q 'aws_lambda_function.app.arn' terraform/cron.tf
258
+ grep -q 'random_password' terraform/database.tf
259
+ steps:
260
+ - uses: actions/checkout@v4
261
+
262
+ - name: Setup Node.js
263
+ uses: actions/setup-node@v4
264
+ with:
265
+ node-version: '24.x'
266
+
267
+ - name: Install dependencies
268
+ run: npm install
269
+
270
+ - name: Setup Terraform
271
+ uses: hashicorp/setup-terraform@v3
272
+
273
+ - name: Setup TFLint
274
+ uses: terraform-linters/setup-tflint@v4
275
+ with:
276
+ github_token: ${{ secrets.GITHUB_TOKEN }}
277
+
278
+ - name: Scaffold lambda app (${{ matrix.name }})
279
+ env:
280
+ CI_MOCK_AWS: 'true'
281
+ DO_NOT_TRACK: '1'
282
+ run: |
283
+ TMPROOT=$(mktemp -d)
284
+ APP_DIR="$TMPROOT/test-app-lambda-${{ matrix.name }}"
285
+ mkdir -p "$APP_DIR"
286
+ echo "GENERATED_DIR=$APP_DIR" >> "$GITHUB_ENV"
287
+ cd "$APP_DIR"
288
+ ${{ matrix.scaffold }}
289
+ ${{ matrix.assert }}
290
+
291
+ - name: Terraform Compile
292
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
293
+ run: |
294
+ terraform init -backend=false
295
+ terraform validate
296
+
297
+ - name: Init TFLint
298
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
299
+ run: tflint --init
300
+
301
+ - name: Terraform Lint
302
+ working-directory: ${{ env.GENERATED_DIR }}/terraform
303
+ run: tflint
@@ -0,0 +1,68 @@
1
+ name: Publish CLI
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+
7
+ jobs:
8
+ validate:
9
+ uses: ./.github/workflows/iac-validation.yml
10
+ secrets: inherit
11
+
12
+ build-and-publish:
13
+ needs: [validate]
14
+ runs-on: ubuntu-latest
15
+ permissions:
16
+ contents: read
17
+ id-token: write
18
+
19
+ steps:
20
+ - uses: actions/checkout@v4
21
+
22
+ - name: Setup Node.js
23
+ uses: actions/setup-node@v4
24
+ with:
25
+ node-version: '24.x'
26
+ registry-url: 'https://registry.npmjs.org'
27
+
28
+ - name: Upgrade NPM for OIDC
29
+ run: npm install -g npm@latest
30
+
31
+ - name: Inject Telemetry Key
32
+ run: sed -i "s/___POSTHOG_INGESTION_KEY___/${{ secrets.POSTHOG_KEY }}/g" src/core/telemetry.js
33
+
34
+ - name: Install dependencies
35
+ run: npm install
36
+
37
+ # --- Phase 1: Static Generation Validation ---
38
+ - name: Run Unit & Snapshot Tests
39
+ run: npm test
40
+
41
+ # --- Phase 2: Execution & Security Validation ---
42
+ - name: Setup TFLint
43
+ uses: terraform-linters/setup-tflint@v4
44
+ with:
45
+ github_token: ${{ secrets.GITHUB_TOKEN }}
46
+
47
+ - name: Init TFLint
48
+ run: tflint --init
49
+
50
+ - name: Run TFLint across Terraform files
51
+ run: tflint --recursive || true
52
+
53
+ - name: Run Trivy IaC Config Scanner
54
+ uses: aquasecurity/trivy-action@master
55
+ with:
56
+ scan-type: 'config'
57
+ scan-dir: '.'
58
+ format: 'table'
59
+ exit-code: '0'
60
+
61
+ # --- Phase 3: Publish ---
62
+ - name: Publish Primary Package (grada-run)
63
+ run: npm publish --provenance
64
+
65
+ - name: Publish Scoped Alias (@grada-run/grada)
66
+ run: |
67
+ npm pkg set name="@grada-run/grada"
68
+ npm publish --access public --provenance
@@ -0,0 +1,57 @@
1
+ name: Sync Bedrock Model Catalog
2
+
3
+ on:
4
+ schedule:
5
+ - cron: '0 6 * * 1'
6
+ workflow_dispatch:
7
+
8
+ permissions:
9
+ id-token: write
10
+ contents: write
11
+ pull-requests: write
12
+
13
+ jobs:
14
+ sync:
15
+ runs-on: ubuntu-latest
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Check for AWS role configuration
20
+ id: guard
21
+ run: |
22
+ if [ -z "${{ vars.AWS_ROLE_ARN }}" ]; then
23
+ echo "Bedrock catalog sync skipped: set the AWS_ROLE_ARN repository variable to enable weekly syncs." >> "$GITHUB_STEP_SUMMARY"
24
+ echo "enabled=false" >> "$GITHUB_OUTPUT"
25
+ else
26
+ echo "enabled=true" >> "$GITHUB_OUTPUT"
27
+ fi
28
+
29
+ - name: Configure AWS credentials
30
+ if: steps.guard.outputs.enabled == 'true'
31
+ uses: aws-actions/configure-aws-credentials@v4
32
+ with:
33
+ role-to-assume: ${{ vars.AWS_ROLE_ARN }}
34
+ aws-region: ${{ vars.AWS_REGION || 'us-east-2' }}
35
+
36
+ - name: Setup Node.js
37
+ if: steps.guard.outputs.enabled == 'true'
38
+ uses: actions/setup-node@v4
39
+ with:
40
+ node-version: '24.x'
41
+
42
+ - name: Install dependencies
43
+ if: steps.guard.outputs.enabled == 'true'
44
+ run: npm ci
45
+
46
+ - name: Sync bundled catalog
47
+ if: steps.guard.outputs.enabled == 'true'
48
+ run: npm run sync:bedrock-models
49
+
50
+ - name: Open catalog update PR
51
+ if: steps.guard.outputs.enabled == 'true'
52
+ uses: peter-evans/create-pull-request@v7
53
+ with:
54
+ branch: chore/sync-bedrock-models
55
+ commit-message: 'chore(bedrock): sync model catalog'
56
+ title: 'chore(bedrock): sync AWS Bedrock model catalog'
57
+ body: Automated weekly refresh of `src/data/bedrock-models.json` from live AWS Bedrock data.
@@ -0,0 +1,43 @@
1
+ name: Test Suite
2
+
3
+ on:
4
+ push:
5
+ branches: [ "**" ]
6
+ pull_request:
7
+ branches: [ "main" ]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - uses: actions/checkout@v4
14
+
15
+ - name: Setup Node.js
16
+ uses: actions/setup-node@v4
17
+ with:
18
+ node-version: '24.x'
19
+
20
+ - name: Install dependencies
21
+ run: npm install
22
+
23
+ - name: Run Vitest Suite
24
+ run: npm test
25
+
26
+ - name: Setup TFLint
27
+ uses: terraform-linters/setup-tflint@v4
28
+ with:
29
+ github_token: ${{ secrets.GITHUB_TOKEN }}
30
+
31
+ - name: Init TFLint
32
+ run: tflint --init
33
+
34
+ - name: Run TFLint across Terraform files
35
+ run: tflint --recursive || true
36
+
37
+ - name: Run Trivy IaC Config Scanner
38
+ uses: aquasecurity/trivy-action@master
39
+ with:
40
+ scan-type: 'config'
41
+ scan-dir: '.'
42
+ format: 'table'
43
+ exit-code: '0' # Set to '1' to block PRs on Trivy findings once baselined
package/.muserules ADDED
@@ -0,0 +1,31 @@
1
+ # Grada: AI Agent Core Directives
2
+
3
+ ## 1. Architectural Boundaries
4
+ - When scaffolding or managing a generated user project, you are strictly forbidden from modifying the user's application code. *(Note: When working on the Grada CLI codebase itself, modifying our `src/` directory is the entire job and is fully permitted).*
5
+ - All Dockerfiles must remain at **0 CVEs**. Use multi-stage builds and strip package managers from runtime images to maintain this. Do not introduce unvetted packages.
6
+ - All AWS IAM configurations must use OIDC. Never generate long-lived IAM access keys.
7
+
8
+ ## 2. Tech Stack & Formatting
9
+ - **AWS Integration:** Use the `@aws-sdk/client-*` (v3) libraries for programmatic cloud interactions by default. Spawning the `aws` CLI is permitted for interactive terminal sessions (e.g., ECS Exec) and established programmatic helpers (e.g., ECR seeding, `status`, `diagnose`) where it is already heavily utilized or a clean SDK equivalent is lacking.
10
+ - **Testing:** Use `vitest` for all unit and snapshot testing. Extract shared test mocks to `tests/helpers/` (create this directory if it does not yet exist).
11
+ - Always append new tests to the corresponding existing `.test.js` file rather than creating fragmented test files for new functions within the same module.
12
+ - **Terminal UI:** Use `picocolors` and `@clack/prompts` for all CLI output. Standardize on green for success, yellow for warnings, red for errors, and cyan for info/waiting.
13
+ - **Telemetry:** Ensure `trackEvent` is called for key user actions and `flushTelemetry` is awaited before exiting.
14
+
15
+ ## 3. Workflow
16
+ - **Analyze Before Implementing [CRITICAL]:** For specifications, migrations, and multi-file changes, do not implement immediately. Always thoroughly analyze the prompt against the existing codebase first to confirm there are no conflicts or unaddressed edge-cases. Outline any questions or inconsistencies before proceeding. *(Exception: For trivial single-point tasks, or if the user explicitly instructs you to "skip analysis" or "implement now," you may implement immediately).*
17
+ - Read the relevant `specs/` document before writing any code.
18
+ - **Strictly Headless Tests:** All Vitest tests must run cleanly in CI. You must aggressively mock `@clack/prompts`, `child_process.spawn`, and all AWS SDK clients to prevent the test suite from hanging on user input or attempting real network calls.
19
+ - **CI parity:** GitHub Actions sets `CI=true` and Vitest workers run with `FORCE_COLOR=1` (via `vitest.config.js`), which activates ANSI escape sequences in `picocolors` even when `process.stdout.isTTY` is false. Any test asserting on strings styled with `picocolors` must either strip ANSI codes using `stripVTControlCharacters` from `node:util` or avoid matching across styled/unstyled boundaries.
20
+ - Run `npm test` continuously to verify your work.
21
+ - Do not conclude your task until the test suite passes completely.
22
+
23
+ ## 4. Documentation & Communication
24
+ - **Audience First:** Write all READMEs, documentation, and release notes for the **end-user**, not the backend engineer.
25
+ - **Focus on Value:** Emphasize *what* the change does for the user (e.g., "Enhanced security," "Faster deployments") rather than *how* it was implemented under the hood.
26
+ - **Hide the Wiring:** Do not explain deep technical refactors, regex changes, or script adjustments in user-facing docs unless they require the user to change their own behavior. Keep it concise, accessible, and benefit-driven.
27
+
28
+ ## 5. Terminal UI & Viewport Ergonomics
29
+ - **Target viewport:** Users typically run the CLI inside an IDE bottom terminal panel (bottom 1/4 to 1/3 of a fullscreen window: ~10–15 visible rows, ~85–100 columns wide).
30
+ - **Density budget:** Every Clack `note` box, summary table, or command output block must balance clarity with high vertical and horizontal density: aim for <= 12–14 lines tall and <= 88–90 characters wide per line so boxes never wrap or scroll off-screen before a confirmation prompt.
31
+ - **No repeated lists:** Never repeat the same list of items twice inside a single box (e.g., in both a topology tree and a verbose footer list). Keep verbose prose breakdowns in standalone command outputs (`add`, `diagnose`) or generated markdown docs (`GRADA.md`), and use compact 1-line summaries inside pre-flight/status boxes.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 grada-run (https://github.com/grada-run)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.