@friggframework/devtools 2.0.0-next.12 → 2.0.0-next.121

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 (265) hide show
  1. package/frigg-cli/README.md +1336 -0
  2. package/frigg-cli/__tests__/unit/commands/build.test.js +279 -0
  3. package/frigg-cli/__tests__/unit/commands/db-setup.test.js +649 -0
  4. package/frigg-cli/__tests__/unit/commands/deploy.test.js +320 -0
  5. package/frigg-cli/__tests__/unit/commands/doctor.test.js +309 -0
  6. package/frigg-cli/__tests__/unit/commands/generate-iam.test.js +115 -0
  7. package/frigg-cli/__tests__/unit/commands/init.test.js +688 -0
  8. package/frigg-cli/__tests__/unit/commands/install.test.js +653 -0
  9. package/frigg-cli/__tests__/unit/commands/ui.test.js +346 -0
  10. package/frigg-cli/__tests__/unit/dependencies.test.js +74 -0
  11. package/frigg-cli/__tests__/unit/utils/database-validator.test.js +397 -0
  12. package/frigg-cli/__tests__/unit/utils/error-messages.test.js +345 -0
  13. package/frigg-cli/__tests__/unit/version-detection.test.js +171 -0
  14. package/frigg-cli/__tests__/utils/mock-factory.js +270 -0
  15. package/frigg-cli/__tests__/utils/prisma-mock.js +194 -0
  16. package/frigg-cli/__tests__/utils/test-fixtures.js +463 -0
  17. package/frigg-cli/__tests__/utils/test-setup.js +287 -0
  18. package/frigg-cli/auth-command/CLAUDE.md +293 -0
  19. package/frigg-cli/auth-command/README.md +450 -0
  20. package/frigg-cli/auth-command/api-key-flow.js +153 -0
  21. package/frigg-cli/auth-command/auth-tester.js +344 -0
  22. package/frigg-cli/auth-command/credential-storage.js +182 -0
  23. package/frigg-cli/auth-command/index.js +256 -0
  24. package/frigg-cli/auth-command/json-schema-form.js +67 -0
  25. package/frigg-cli/auth-command/module-loader.js +172 -0
  26. package/frigg-cli/auth-command/oauth-callback-server.js +431 -0
  27. package/frigg-cli/auth-command/oauth-flow.js +195 -0
  28. package/frigg-cli/auth-command/utils/browser.js +30 -0
  29. package/frigg-cli/build-command/index.js +17 -3
  30. package/frigg-cli/db-setup-command/index.js +246 -0
  31. package/frigg-cli/deploy-command/SPEC-DEPLOY-DRY-RUN.md +981 -0
  32. package/frigg-cli/deploy-command/index.js +339 -23
  33. package/frigg-cli/doctor-command/index.js +335 -0
  34. package/frigg-cli/generate-command/__tests__/generate-command.test.js +301 -0
  35. package/frigg-cli/generate-command/azure-generator.js +43 -0
  36. package/frigg-cli/generate-command/gcp-generator.js +47 -0
  37. package/frigg-cli/generate-command/index.js +334 -0
  38. package/frigg-cli/generate-command/terraform-generator.js +555 -0
  39. package/frigg-cli/generate-iam-command.js +120 -0
  40. package/frigg-cli/index.js +193 -1
  41. package/frigg-cli/index.test.js +1 -4
  42. package/frigg-cli/init-command/backend-first-handler.js +599 -0
  43. package/frigg-cli/init-command/deployment-modes.js +7 -0
  44. package/frigg-cli/init-command/index.js +140 -0
  45. package/frigg-cli/init-command/safe-path.js +58 -0
  46. package/frigg-cli/init-command/scaffold-dependencies.js +202 -0
  47. package/frigg-cli/init-command/template-handler.js +143 -0
  48. package/frigg-cli/install-command/app-definition.js +174 -0
  49. package/frigg-cli/install-command/commit-changes.js +40 -8
  50. package/frigg-cli/install-command/environment-variables.js +15 -0
  51. package/frigg-cli/install-command/index.js +96 -24
  52. package/frigg-cli/install-command/install-package.js +77 -4
  53. package/frigg-cli/install-command/integration-file.js +20 -11
  54. package/frigg-cli/install-command/resolve-module.js +69 -0
  55. package/frigg-cli/install-command/template.js +102 -75
  56. package/frigg-cli/install-command/validate-package.js +36 -4
  57. package/frigg-cli/jest.config.js +124 -0
  58. package/frigg-cli/package.json +63 -0
  59. package/frigg-cli/repair-command/index.js +564 -0
  60. package/frigg-cli/ssm-command/index.js +308 -0
  61. package/frigg-cli/ssm-command/index.test.js +318 -0
  62. package/frigg-cli/start-command/index.js +118 -5
  63. package/frigg-cli/start-command/start-command.test.js +297 -0
  64. package/frigg-cli/templates/backend/README.md +267 -0
  65. package/frigg-cli/templates/backend/env.example +20 -0
  66. package/frigg-cli/templates/backend/gitignore +10 -0
  67. package/frigg-cli/templates/backend/index.js +114 -0
  68. package/frigg-cli/templates/backend/infrastructure.js +20 -0
  69. package/frigg-cli/test/init-command.test.js +187 -0
  70. package/frigg-cli/test/npm-registry.test.js +319 -0
  71. package/frigg-cli/ui-command/index.js +154 -0
  72. package/frigg-cli/utils/app-resolver.js +319 -0
  73. package/frigg-cli/utils/backend-path.js +16 -17
  74. package/frigg-cli/utils/database-validator.js +167 -0
  75. package/frigg-cli/utils/error-messages.js +329 -0
  76. package/frigg-cli/utils/npm-registry.js +167 -0
  77. package/frigg-cli/utils/process-manager.js +199 -0
  78. package/frigg-cli/utils/repo-detection.js +405 -0
  79. package/infrastructure/ARCHITECTURE.md +487 -0
  80. package/infrastructure/CLAUDE.md +481 -0
  81. package/infrastructure/HEALTH.md +468 -0
  82. package/infrastructure/README.md +540 -0
  83. package/infrastructure/__tests__/fixtures/mock-aws-resources.js +391 -0
  84. package/infrastructure/__tests__/helpers/test-utils.js +275 -0
  85. package/infrastructure/__tests__/postgres-config.test.js +914 -0
  86. package/infrastructure/__tests__/scaffold-default-infrastructure.test.js +148 -0
  87. package/infrastructure/__tests__/scoped-environment.test.js +126 -0
  88. package/infrastructure/__tests__/ssm-preload-node-options.test.js +79 -0
  89. package/infrastructure/__tests__/template-generation.test.js +687 -0
  90. package/infrastructure/create-frigg-infrastructure.js +129 -20
  91. package/infrastructure/docs/POSTGRES-CONFIGURATION.md +650 -0
  92. package/infrastructure/docs/PRE-DEPLOYMENT-HEALTH-CHECK-SPEC.md +1317 -0
  93. package/infrastructure/docs/WEBSOCKET-CONFIGURATION.md +105 -0
  94. package/infrastructure/docs/deployment-instructions.md +268 -0
  95. package/infrastructure/docs/generate-iam-command.md +278 -0
  96. package/infrastructure/docs/iam-policy-templates.md +193 -0
  97. package/infrastructure/domains/admin-scripts/admin-script-builder.js +571 -0
  98. package/infrastructure/domains/admin-scripts/admin-script-builder.test.js +1047 -0
  99. package/infrastructure/domains/admin-scripts/index.js +5 -0
  100. package/infrastructure/domains/database/aurora-builder.js +868 -0
  101. package/infrastructure/domains/database/aurora-builder.test.js +982 -0
  102. package/infrastructure/domains/database/aurora-discovery.js +87 -0
  103. package/infrastructure/domains/database/aurora-discovery.test.js +188 -0
  104. package/infrastructure/domains/database/aurora-resolver.js +210 -0
  105. package/infrastructure/domains/database/aurora-resolver.test.js +347 -0
  106. package/infrastructure/domains/database/migration-builder.js +757 -0
  107. package/infrastructure/domains/database/migration-builder.test.js +454 -0
  108. package/infrastructure/domains/database/migration-resolver.js +163 -0
  109. package/infrastructure/domains/database/migration-resolver.test.js +337 -0
  110. package/infrastructure/domains/health/application/ports/IPropertyReconciler.js +164 -0
  111. package/infrastructure/domains/health/application/ports/IResourceDetector.js +129 -0
  112. package/infrastructure/domains/health/application/ports/IResourceImporter.js +142 -0
  113. package/infrastructure/domains/health/application/ports/IStackRepository.js +131 -0
  114. package/infrastructure/domains/health/application/ports/index.js +26 -0
  115. package/infrastructure/domains/health/application/use-cases/__tests__/execute-resource-import-use-case.test.js +679 -0
  116. package/infrastructure/domains/health/application/use-cases/__tests__/mismatch-analyzer-method-name.test.js +167 -0
  117. package/infrastructure/domains/health/application/use-cases/__tests__/repair-via-import-use-case.test.js +1130 -0
  118. package/infrastructure/domains/health/application/use-cases/execute-resource-import-use-case.js +221 -0
  119. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.js +152 -0
  120. package/infrastructure/domains/health/application/use-cases/reconcile-properties-use-case.test.js +343 -0
  121. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.js +535 -0
  122. package/infrastructure/domains/health/application/use-cases/repair-via-import-use-case.test.js +376 -0
  123. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.js +213 -0
  124. package/infrastructure/domains/health/application/use-cases/run-health-check-use-case.test.js +441 -0
  125. package/infrastructure/domains/health/docs/ACME-DEV-DRIFT-ANALYSIS.md +267 -0
  126. package/infrastructure/domains/health/docs/BUILD-VS-DEPLOYED-TEMPLATE-ANALYSIS.md +324 -0
  127. package/infrastructure/domains/health/docs/ORPHAN-DETECTION-ANALYSIS.md +386 -0
  128. package/infrastructure/domains/health/docs/SPEC-CLEANUP-COMMAND.md +1419 -0
  129. package/infrastructure/domains/health/docs/TDD-IMPLEMENTATION-SUMMARY.md +391 -0
  130. package/infrastructure/domains/health/docs/TEMPLATE-COMPARISON-IMPLEMENTATION.md +551 -0
  131. package/infrastructure/domains/health/domain/entities/issue.js +299 -0
  132. package/infrastructure/domains/health/domain/entities/issue.test.js +528 -0
  133. package/infrastructure/domains/health/domain/entities/property-mismatch.js +108 -0
  134. package/infrastructure/domains/health/domain/entities/property-mismatch.test.js +275 -0
  135. package/infrastructure/domains/health/domain/entities/resource.js +159 -0
  136. package/infrastructure/domains/health/domain/entities/resource.test.js +432 -0
  137. package/infrastructure/domains/health/domain/entities/stack-health-report.js +306 -0
  138. package/infrastructure/domains/health/domain/entities/stack-health-report.test.js +601 -0
  139. package/infrastructure/domains/health/domain/services/__tests__/health-score-percentage-based.test.js +380 -0
  140. package/infrastructure/domains/health/domain/services/__tests__/import-progress-monitor.test.js +971 -0
  141. package/infrastructure/domains/health/domain/services/__tests__/import-template-generator.test.js +1150 -0
  142. package/infrastructure/domains/health/domain/services/__tests__/logical-id-mapper.test.js +672 -0
  143. package/infrastructure/domains/health/domain/services/__tests__/template-parser.test.js +496 -0
  144. package/infrastructure/domains/health/domain/services/__tests__/update-progress-monitor.test.js +419 -0
  145. package/infrastructure/domains/health/domain/services/health-score-calculator.js +248 -0
  146. package/infrastructure/domains/health/domain/services/health-score-calculator.test.js +504 -0
  147. package/infrastructure/domains/health/domain/services/import-progress-monitor.js +195 -0
  148. package/infrastructure/domains/health/domain/services/import-template-generator.js +435 -0
  149. package/infrastructure/domains/health/domain/services/logical-id-mapper.js +345 -0
  150. package/infrastructure/domains/health/domain/services/mismatch-analyzer.js +234 -0
  151. package/infrastructure/domains/health/domain/services/mismatch-analyzer.test.js +431 -0
  152. package/infrastructure/domains/health/domain/services/property-mutability-config.js +382 -0
  153. package/infrastructure/domains/health/domain/services/template-parser.js +245 -0
  154. package/infrastructure/domains/health/domain/services/update-progress-monitor.js +192 -0
  155. package/infrastructure/domains/health/domain/value-objects/health-score.js +138 -0
  156. package/infrastructure/domains/health/domain/value-objects/health-score.test.js +267 -0
  157. package/infrastructure/domains/health/domain/value-objects/property-mutability.js +161 -0
  158. package/infrastructure/domains/health/domain/value-objects/property-mutability.test.js +198 -0
  159. package/infrastructure/domains/health/domain/value-objects/resource-state.js +167 -0
  160. package/infrastructure/domains/health/domain/value-objects/resource-state.test.js +196 -0
  161. package/infrastructure/domains/health/domain/value-objects/stack-identifier.js +192 -0
  162. package/infrastructure/domains/health/domain/value-objects/stack-identifier.test.js +262 -0
  163. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-cfn-tagged.test.js +312 -0
  164. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-multi-stack.test.js +367 -0
  165. package/infrastructure/domains/health/infrastructure/adapters/__tests__/orphan-detection-relationship-analysis.test.js +432 -0
  166. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.js +784 -0
  167. package/infrastructure/domains/health/infrastructure/adapters/aws-property-reconciler.test.js +1133 -0
  168. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.js +565 -0
  169. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-detector.test.js +554 -0
  170. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.js +318 -0
  171. package/infrastructure/domains/health/infrastructure/adapters/aws-resource-importer.test.js +398 -0
  172. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.js +777 -0
  173. package/infrastructure/domains/health/infrastructure/adapters/aws-stack-repository.test.js +580 -0
  174. package/infrastructure/domains/integration/integration-builder.js +668 -0
  175. package/infrastructure/domains/integration/integration-builder.test.js +1116 -0
  176. package/infrastructure/domains/integration/integration-resolver.js +170 -0
  177. package/infrastructure/domains/integration/integration-resolver.test.js +369 -0
  178. package/infrastructure/domains/integration/websocket-builder.js +69 -0
  179. package/infrastructure/domains/integration/websocket-builder.test.js +195 -0
  180. package/infrastructure/domains/networking/vpc-builder.js +2101 -0
  181. package/infrastructure/domains/networking/vpc-builder.test.js +2001 -0
  182. package/infrastructure/domains/networking/vpc-discovery.js +184 -0
  183. package/infrastructure/domains/networking/vpc-discovery.test.js +368 -0
  184. package/infrastructure/domains/networking/vpc-resolver.js +514 -0
  185. package/infrastructure/domains/networking/vpc-resolver.test.js +841 -0
  186. package/infrastructure/domains/parameters/offload-utils.js +197 -0
  187. package/infrastructure/domains/parameters/offload-utils.test.js +206 -0
  188. package/infrastructure/domains/parameters/ssm-builder.js +132 -0
  189. package/infrastructure/domains/parameters/ssm-builder.test.js +346 -0
  190. package/infrastructure/domains/parameters/ssm-discovery.js +84 -0
  191. package/infrastructure/domains/parameters/ssm-discovery.test.js +210 -0
  192. package/infrastructure/domains/scheduler/scheduler-builder.js +247 -0
  193. package/infrastructure/domains/scheduler/scheduler-builder.test.js +118 -0
  194. package/infrastructure/domains/security/iam-generator.js +959 -0
  195. package/infrastructure/domains/security/iam-generator.test.js +410 -0
  196. package/infrastructure/domains/security/kms-builder.js +415 -0
  197. package/infrastructure/domains/security/kms-builder.test.js +392 -0
  198. package/infrastructure/domains/security/kms-discovery.js +80 -0
  199. package/infrastructure/domains/security/kms-discovery.test.js +177 -0
  200. package/infrastructure/domains/security/kms-resolver.js +96 -0
  201. package/infrastructure/domains/security/kms-resolver.test.js +216 -0
  202. package/infrastructure/domains/security/templates/frigg-deployment-iam-stack.yaml +419 -0
  203. package/infrastructure/domains/security/templates/iam-policy-basic.json +219 -0
  204. package/infrastructure/domains/security/templates/iam-policy-full.json +294 -0
  205. package/infrastructure/domains/shared/base-builder.js +112 -0
  206. package/infrastructure/domains/shared/base-resolver.js +186 -0
  207. package/infrastructure/domains/shared/base-resolver.test.js +305 -0
  208. package/infrastructure/domains/shared/builder-orchestrator.js +226 -0
  209. package/infrastructure/domains/shared/builder-orchestrator.test.js +258 -0
  210. package/infrastructure/domains/shared/cloudformation-discovery-v2.js +334 -0
  211. package/infrastructure/domains/shared/cloudformation-discovery.js +681 -0
  212. package/infrastructure/domains/shared/cloudformation-discovery.test.js +1320 -0
  213. package/infrastructure/domains/shared/environment-builder.js +222 -0
  214. package/infrastructure/domains/shared/environment-builder.test.js +648 -0
  215. package/infrastructure/domains/shared/function-environments.js +97 -0
  216. package/infrastructure/domains/shared/function-environments.test.js +146 -0
  217. package/infrastructure/domains/shared/providers/aws-provider-adapter.js +579 -0
  218. package/infrastructure/domains/shared/providers/aws-provider-adapter.test.js +416 -0
  219. package/infrastructure/domains/shared/providers/azure-provider-adapter.stub.js +93 -0
  220. package/infrastructure/domains/shared/providers/cloud-provider-adapter.js +136 -0
  221. package/infrastructure/domains/shared/providers/gcp-provider-adapter.stub.js +82 -0
  222. package/infrastructure/domains/shared/providers/provider-factory.js +108 -0
  223. package/infrastructure/domains/shared/providers/provider-factory.test.js +170 -0
  224. package/infrastructure/domains/shared/resource-discovery.enhanced.test.js +306 -0
  225. package/infrastructure/domains/shared/resource-discovery.js +256 -0
  226. package/infrastructure/domains/shared/resource-discovery.test.js +757 -0
  227. package/infrastructure/domains/shared/types/app-definition.js +225 -0
  228. package/infrastructure/domains/shared/types/discovery-result.js +106 -0
  229. package/infrastructure/domains/shared/types/discovery-result.test.js +258 -0
  230. package/infrastructure/domains/shared/types/index.js +46 -0
  231. package/infrastructure/domains/shared/types/resource-ownership.js +108 -0
  232. package/infrastructure/domains/shared/types/resource-ownership.test.js +101 -0
  233. package/infrastructure/domains/shared/utilities/base-definition-factory.js +417 -0
  234. package/infrastructure/domains/shared/utilities/base-definition-factory.test.js +391 -0
  235. package/infrastructure/domains/shared/utilities/handler-path-resolver.js +134 -0
  236. package/infrastructure/domains/shared/utilities/handler-path-resolver.test.js +268 -0
  237. package/infrastructure/domains/shared/utilities/logging-config.js +82 -0
  238. package/infrastructure/domains/shared/utilities/logging-config.test.js +52 -0
  239. package/infrastructure/domains/shared/utilities/nested-node-modules.js +53 -0
  240. package/infrastructure/domains/shared/utilities/nested-node-modules.test.js +61 -0
  241. package/infrastructure/domains/shared/utilities/prisma-layer-manager.js +159 -0
  242. package/infrastructure/domains/shared/utilities/prisma-layer-manager.test.js +444 -0
  243. package/infrastructure/domains/shared/validation/env-validator.js +78 -0
  244. package/infrastructure/domains/shared/validation/env-validator.test.js +173 -0
  245. package/infrastructure/domains/shared/validation/plugin-validator.js +187 -0
  246. package/infrastructure/domains/shared/validation/plugin-validator.test.js +323 -0
  247. package/infrastructure/esbuild.config.js +53 -0
  248. package/infrastructure/infrastructure-composer.js +168 -0
  249. package/infrastructure/infrastructure-composer.test.js +2086 -0
  250. package/infrastructure/integration.test.js +381 -0
  251. package/infrastructure/scripts/build-prisma-layer.js +701 -0
  252. package/infrastructure/scripts/build-prisma-layer.test.js +170 -0
  253. package/infrastructure/scripts/build-time-discovery.js +238 -0
  254. package/infrastructure/scripts/build-time-discovery.test.js +379 -0
  255. package/infrastructure/scripts/run-discovery.js +110 -0
  256. package/infrastructure/scripts/verify-prisma-layer.js +72 -0
  257. package/management-ui/README.md +203 -0
  258. package/package.json +49 -16
  259. package/test/index.js +2 -4
  260. package/test/mock-api.js +1 -3
  261. package/test/mock-integration.js +4 -14
  262. package/.eslintrc.json +0 -3
  263. package/CHANGELOG.md +0 -132
  264. package/infrastructure/serverless-template.js +0 -279
  265. package/test/auther-definition-tester.js +0 -125
@@ -0,0 +1,1336 @@
1
+ # Frigg CLI - Complete Documentation
2
+
3
+ ## Overview
4
+
5
+ The Frigg CLI provides tools for building, deploying, and managing serverless integrations on cloud platforms. Built with Domain-Driven Design and Hexagonal Architecture for multi-cloud extensibility.
6
+
7
+ ---
8
+
9
+ ## Command Reference
10
+
11
+ ### Core Commands
12
+
13
+ #### `frigg init [projectName] [options]`
14
+
15
+ Scaffold a new Frigg backend application that installs and runs out of the box.
16
+
17
+ **Usage:**
18
+
19
+ ```bash
20
+ frigg init my-app # interactive (when stdin is a TTY)
21
+ frigg init my-app --yes # accept every default, no prompts
22
+ frigg init my-app --yes --mode standalone --no-install --no-git
23
+ frigg init my-app --mode embedded # add to an existing project (./frigg-integration)
24
+ npx @friggframework/devtools init my-app --yes # without a global install
25
+ ```
26
+
27
+ **What it does:**
28
+
29
+ 1. Validates the project name and `--mode`, and checks that the target directory is
30
+ empty (only `.git`, `.gitignore`, `README.md` and `.DS_Store` may exist) before asking anything else
31
+ 2. Copies the backend template: `index.js` (app definition, named after the project),
32
+ `infrastructure.js`, `README.md`, `.gitignore`, `.env.example` (also seeded into `.env`)
33
+ 3. Writes `package.json` with:
34
+ - scripts: `start` (`frigg start`), `build` (`frigg build`), `deploy` (`frigg deploy`),
35
+ `db:setup` (`frigg db:setup`), `test` (`jest --passWithNoTests`)
36
+ - dependencies: `@friggframework/core`, `@prisma/client`, `prisma`
37
+ - devDependencies: `@friggframework/devtools`, `@friggframework/serverless-plugin`,
38
+ `osls`, and the serverless plugins the composed definition loads
39
+ - Frigg package versions match the devtools that ran `init` (a prerelease is pinned exactly)
40
+ 4. Validates the generated app definition against the app-definition schema (problems
41
+ are printed as warnings; `frigg start`, `build` and `deploy` do not validate)
42
+ 5. Optionally initializes git and runs `npm install`
43
+ 6. Prints next steps. API modules picked in the interactive prompt are not wired in
44
+ automatically; the next steps list a `frigg install <module>` command for each
45
+
46
+ In `embedded` mode the backend is written to `./frigg-integration` inside the target
47
+ directory, which may already contain your application. Git is not initialized.
48
+
49
+ **Options:**
50
+
51
+ - `-n, --name <name>` - Project name (alternative to the positional argument)
52
+ - `-m, --mode <mode>` - `standalone` (default) or `embedded`
53
+ - `-y, --yes` - Accept the default for every prompt. Implied when stdin is not a TTY
54
+ - `--no-install` - Skip `npm install`
55
+ - `--no-git` - Skip `git init` and the initial commit
56
+ - `-f, --force` - Scaffold into a non-empty directory and overwrite an existing `README.md`/`.gitignore`
57
+ - `-v, --verbose` - Verbose output
58
+
59
+ **Next steps after `init`:**
60
+
61
+ ```bash
62
+ cd my-app
63
+ docker run --name frigg-postgres -e POSTGRES_PASSWORD=postgres -p 5432:5432 -d postgres:16
64
+ npm run db:setup
65
+ npm start
66
+ ```
67
+
68
+ The scaffolded app deploys nothing that bills by the hour, so it costs near $0 while
69
+ idle: no VPC, NAT gateway or database cluster (`vpc: { enable: false }`,
70
+ `database.postgres.management: 'external'`), field-level encryption with a per-stage
71
+ KMS key ($1/month, about $3/month after its first two yearly rotations), 14-day log
72
+ retention, and the app connecting to a PostgreSQL you host through `DATABASE_URL`.
73
+ `frigg deploy` reads `DATABASE_URL` from the shell that runs it, not from `.env`. The
74
+ generated `README.md` lists every resource, the security model and the other options.
75
+
76
+ ---
77
+
78
+ #### `frigg install <module-name>`
79
+
80
+ Install and configure an API integration module from the Frigg module library.
81
+
82
+ **Usage:**
83
+ ```bash
84
+ frigg install hubspot
85
+ frigg install salesforce
86
+ frigg install stripe
87
+ ```
88
+
89
+ Run it in the app directory (the one with `package.json` and `index.js`).
90
+
91
+ **What it does:**
92
+ - Searches npm for `@friggframework/api-module-<name>` and lets you pick the
93
+ packages to install (with no terminal to prompt on, it takes the exact match)
94
+ - Runs `npm install` in the app directory. An app on a Frigg 2.x prerelease
95
+ (what `frigg init` scaffolds today) gets the module's `@next` release, because
96
+ most modules' `latest` is still a 1.x release built for Frigg 1.x
97
+ - Resolves the installed module from the app directory and writes
98
+ `src/integrations/<Label>Integration.js`: an `IntegrationBase` subclass whose
99
+ `Definition.modules` wraps the module (an existing file is kept)
100
+ - Registers the class in your app definition: in `index.js` it adds the
101
+ `require` and the first entry of the `integrations` array. When it cannot do
102
+ that safely (no single `integrations: [...]` array literal, or the file does not
103
+ parse) it changes nothing and prints the two lines to add by hand. Older apps
104
+ with a `backend.js` are updated there instead
105
+ - Commits the files it changed (`git commit -- <files>`, so nothing else you have
106
+ staged is included) when the app is in a git repository; otherwise leaves them
107
+ in the working tree
108
+ - Lists the environment variables the module reads (from its `definition.js`)
109
+ that are not in `.env`, and offers to add them when run in a terminal
110
+
111
+ **Options:**
112
+ - None
113
+
114
+ **Example:**
115
+ ```bash
116
+ cd my-app
117
+ npx frigg install hubspot
118
+ # -> src/integrations/HubSpotIntegration.js, listed in index.js's integrations
119
+ ```
120
+
121
+ ---
122
+
123
+ #### `frigg search <term>`
124
+
125
+ Search for available API integration modules.
126
+
127
+ **Usage:**
128
+ ```bash
129
+ frigg search crm
130
+ frigg search payment
131
+ frigg search
132
+ ```
133
+
134
+ **What it does:**
135
+ - Queries the api-module-library directory
136
+ - Filters modules by name, description, or category
137
+ - Returns list of matching integrations with metadata
138
+
139
+ **Options:**
140
+ - None (searches all if no term provided)
141
+
142
+ **Example Output:**
143
+ ```
144
+ 📚 Available API Modules:
145
+
146
+ CRM Systems:
147
+ • hubspot - HubSpot CRM & Marketing automation
148
+ • salesforce - Salesforce CRM & Sales Cloud
149
+ • pipedrive - Pipedrive sales CRM
150
+
151
+ Payment Processing:
152
+ • stripe - Stripe payment processing
153
+ • square - Square payments & POS
154
+
155
+ Found 5 modules matching "crm"
156
+ ```
157
+
158
+ ---
159
+
160
+ #### `frigg start [options]`
161
+
162
+ Start local development server with hot reload.
163
+
164
+ **Usage:**
165
+ ```bash
166
+ frigg start
167
+ frigg start --stage dev
168
+ frigg start --verbose
169
+ frigg start --frontend
170
+ ```
171
+
172
+ **What it does:**
173
+ 1. Validates DATABASE_URL environment variable
174
+ 2. Detects database type (MongoDB or PostgreSQL)
175
+ 3. Checks Prisma client generation status
176
+ 4. Tests database connection
177
+ 5. Starts serverless-offline for backend
178
+ 6. Optionally starts frontend dev server
179
+
180
+ **Options:**
181
+ - `--stage <stage>` - Deployment stage (default: 'dev')
182
+ - `--verbose` - Enable verbose logging
183
+ - `--frontend` - Also start frontend dev server
184
+ - `--port <port>` - Backend port (default: 3000)
185
+ - `--frontend-port <port>` - Frontend port (default: 3001)
186
+
187
+ **Example Output:**
188
+ ```
189
+ 🚀 Starting Frigg application...
190
+ ✓ DATABASE_URL found
191
+ ✓ Database type: mongodb
192
+ ✓ Prisma client generated
193
+ ✓ Database connection successful
194
+
195
+ Starting backend and optional frontend...
196
+ Starting backend in /Users/dev/my-app/backend...
197
+
198
+ ╔═════════════════════════════════════════════════╗
199
+ ║ ║
200
+ ║ Serverless Offline listening on port 3000 ║
201
+ ║ ║
202
+ ╚═════════════════════════════════════════════════╝
203
+
204
+ endpoints:
205
+ GET - http://localhost:3000/health
206
+ POST - http://localhost:3000/api/authorize
207
+ POST - http://localhost:3000/api/webhook
208
+ ...
209
+ ```
210
+
211
+ **Database Checks:**
212
+ - Validates DATABASE_URL exists and is accessible
213
+ - Determines database type from connection string
214
+ - Verifies Prisma client is generated for the correct database
215
+ - Tests connection with timeout
216
+ - Provides helpful error messages for connection failures
217
+
218
+ ---
219
+
220
+ #### `frigg deploy [options]`
221
+
222
+ Deploy serverless infrastructure to cloud provider.
223
+
224
+ **Usage:**
225
+ ```bash
226
+ frigg deploy
227
+ frigg deploy --stage production
228
+ frigg deploy --region us-west-2
229
+ frigg deploy --force
230
+ frigg deploy --skip-env-validation
231
+ frigg deploy --skip-doctor # Skip health check (not recommended)
232
+ frigg deploy --no-interactive # CI/CD mode (no prompts, auto-repair safe issues)
233
+ ```
234
+
235
+ **What it does:**
236
+ 1. **Runs health check** (`frigg doctor`) to detect infrastructure issues
237
+ 2. **Auto-repairs safe issues** (or prompts for confirmation in interactive mode)
238
+ 3. **Fails if critical issues found** (unless `--skip-doctor` flag used)
239
+ 4. Loads app definition from index.js
240
+ 5. Validates required environment variables
241
+ 6. Discovers existing cloud resources (VPC, KMS, Aurora, etc.)
242
+ 7. Makes ownership decisions (resources managed in CloudFormation stack)
243
+ 8. Generates CloudFormation resources
244
+ 9. Generates serverless.yml configuration
245
+ 10. Executes `osls deploy` with filtered environment
246
+ 11. Creates/updates stack in cloud provider
247
+
248
+ **Options:**
249
+ - `--stage <stage>` - Deployment stage (default: 'dev')
250
+ - `--region <region>` - Cloud provider region (overrides app definition)
251
+ - `--force` - Force deployment even if no changes detected
252
+ - `--skip-env-validation` - Skip environment variable validation warnings
253
+ - `--skip-doctor` - Skip infrastructure health check ⚠️ Not recommended
254
+ - `--no-interactive` - Non-interactive mode for CI/CD (auto-repair safe issues, fail on risky changes)
255
+ - `--verbose` - Enable verbose logging
256
+
257
+ **Example Output:**
258
+ ```
259
+ 🔧 Loading environment configuration from appDefinition...
260
+ Found 3 environment variables: DATABASE_URL, JWT_SECRET, STRIPE_API_KEY
261
+
262
+ 🔍 Discovering existing infrastructure...
263
+
264
+ [VPC Builder] Discovering VPC resources...
265
+ Found VPC: vpc-0abc123def456 (existing in AWS)
266
+ 📋 Resource Ownership Decision: external - Using existing VPC vpc-0abc123def456
267
+ [VPC Builder] ✅ VPC configuration completed
268
+
269
+ [KMS Builder] Discovering KMS keys...
270
+ Found KMS key: alias/frigg-my-app-dev
271
+ 📋 Resource Ownership Decision: stack - Will create FriggKMSKey in stack
272
+ [KMS Builder] ✅ KMS configuration completed
273
+
274
+ [Aurora Builder] Discovering Aurora clusters...
275
+ No existing Aurora cluster found
276
+ 📋 Resource Ownership Decision: stack - Will create AuroraCluster in stack
277
+ [Aurora Builder] ✅ Aurora configuration completed
278
+
279
+ 🚀 Deploying serverless application...
280
+
281
+ Deploying my-app to stage dev (us-east-1)
282
+
283
+ Creating CloudFormation stack...
284
+ ✓ Stack created: my-app-dev
285
+ ✓ VPC endpoints configured
286
+ ✓ Aurora cluster created
287
+ ✓ Lambda functions deployed (12)
288
+ ✓ API Gateway configured
289
+ ✓ CloudWatch alarms created
290
+
291
+ Stack Outputs:
292
+ ServiceEndpoint: https://abc123.execute-api.us-east-1.amazonaws.com/dev
293
+ AuroraEndpoint: my-app-dev.cluster-abc123.us-east-1.rds.amazonaws.com
294
+
295
+ Deployment completed in 3m 42s
296
+ ```
297
+
298
+ **Environment Variable Handling:**
299
+ - Passes only necessary environment variables to serverless (security)
300
+ - Includes AWS credentials (AWS_* prefix)
301
+ - Includes app-defined environment variables from definition
302
+ - Validates required variables exist
303
+ - Warns about missing optional variables
304
+
305
+ **Resource Ownership:**
306
+ - Resources can be marked as `STACK` (managed in CloudFormation) or `EXTERNAL` (use existing by ID)
307
+ - Default behavior: manage resources in CloudFormation stack for full lifecycle control
308
+ - Doctor/repair handles edge cases (orphaned resources, drift) before deployment
309
+ - Explicit ownership in app definition recommended for production
310
+
311
+ **CI/CD Deployment:**
312
+ - Use `--no-interactive` flag to prevent prompts
313
+ - Deployment will auto-fix safe issues (mutable property drift)
314
+ - Deployment will **fail fast** on risky issues (orphaned resources, immutable property changes)
315
+ - Prevents stack rollbacks and 2+ hour waits from bad deployments
316
+ - Returns non-zero exit code if issues require manual intervention
317
+
318
+ **Example CI/CD Pipeline:**
319
+ ```yaml
320
+ # GitHub Actions / GitLab CI / etc.
321
+ - name: Deploy to production
322
+ run: |
323
+ frigg deploy \
324
+ --stage production \
325
+ --no-interactive \
326
+ --skip-env-validation
327
+ env:
328
+ AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
329
+ AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
330
+ DATABASE_URL: ${{ secrets.DATABASE_URL }}
331
+ ```
332
+
333
+ ---
334
+
335
+ #### `frigg db:setup [options]`
336
+
337
+ Initialize database and Prisma configuration.
338
+
339
+ **Usage:**
340
+ ```bash
341
+ frigg db:setup
342
+ frigg db:setup --mongodb
343
+ frigg db:setup --postgresql
344
+ frigg db:setup --generate-only
345
+ ```
346
+
347
+ **What it does:**
348
+ 1. Detects database type (MongoDB, AWS DocumentDB, or PostgreSQL) from the app definition and `DATABASE_URL`
349
+ 2. Validates that `DATABASE_URL` exists and is not empty
350
+ 3. Generates the correct Prisma client (DocumentDB reuses the MongoDB client)
351
+ 4. Checks Prisma migration state for the selected database
352
+ 5. Runs `prisma migrate` for PostgreSQL or `prisma db push` for MongoDB/DocumentDB
353
+ 6. Prints next steps (database connectivity health checks now happen during `frigg start`)
354
+
355
+ **Options:**
356
+ - `--mongodb` - Force MongoDB-compatible configuration (also applies to AWS DocumentDB)
357
+ - `--postgresql` - Force PostgreSQL configuration
358
+ - `--generate-only` - Only generate Prisma client, don't push schema
359
+ - `--verbose` - Show detailed progress and Prisma output
360
+
361
+ **Example Output (MongoDB/DocumentDB):**
362
+ ```
363
+ 🗄️ Setting up database...
364
+ ✓ DATABASE_URL found
365
+ ✓ Database type detected: AWS DocumentDB (MongoDB-compatible)
366
+ ✓ Generating Prisma client for mongodb...
367
+ ✓ Prisma client generated successfully
368
+ ✓ Pushing schema to database...
369
+ ✓ Database schema synchronized
370
+
371
+ Database setup complete!
372
+ ```
373
+
374
+ > **AWS DocumentDB notes:** Use a MongoDB-style connection string that includes `tls=true`, `replicaSet=rs0`, and `retryWrites=false`. The CLI automatically treats `database.documentDB.enable` as MongoDB-compatible during setup.
375
+
376
+ **Error Handling:**
377
+ - Validates `DATABASE_URL` format for each database type
378
+ - Provides helpful error messages for:
379
+ - Connection timeout
380
+ - Invalid credentials
381
+ - Network issues
382
+ - Schema validation errors
383
+ - Suggests fixes based on error type
384
+
385
+ ---
386
+
387
+ #### `frigg generate <type> <name>`
388
+
389
+ Generate boilerplate code for integrations, handlers, or tests.
390
+
391
+ **Usage:**
392
+ ```bash
393
+ frigg generate integration shopify
394
+ frigg generate handler payment-webhook
395
+ frigg generate test integration-shopify
396
+ ```
397
+
398
+ **What it does:**
399
+ - Creates file structure from templates
400
+ - Generates TypeScript or JavaScript based on project
401
+ - Includes proper imports and exports
402
+ - Follows Frigg framework conventions
403
+ - Updates relevant configuration files
404
+
405
+ **Types:**
406
+ - `integration` - New integration module
407
+ - `handler` - API handler/route
408
+ - `test` - Test file
409
+ - `migration` - Database migration
410
+
411
+ **Options:**
412
+ - `--typescript` - Generate TypeScript files
413
+ - `--javascript` - Generate JavaScript files
414
+ - `--template <name>` - Use specific template
415
+
416
+ **Example Output:**
417
+ ```
418
+ ✨ Generating integration: shopify
419
+
420
+ Created files:
421
+ ✓ backend/integrations/shopify/index.js
422
+ ✓ backend/integrations/shopify/api.js
423
+ ✓ backend/integrations/shopify/config.js
424
+ ✓ backend/integrations/shopify/definition.js
425
+ ✓ backend/integrations/shopify/__tests__/integration.test.js
426
+
427
+ Updated files:
428
+ ✓ backend/index.js (added integration import)
429
+
430
+ Next steps:
431
+ 1. Configure OAuth settings in definition.js
432
+ 2. Implement API methods in api.js
433
+ 3. Add integration to app definition
434
+ 4. Run tests: npm test shopify
435
+ ```
436
+
437
+ ---
438
+
439
+ ### New Infrastructure Health Commands
440
+
441
+ #### `frigg doctor [options]`
442
+
443
+ **Status:** Planned (implementation in progress)
444
+
445
+ Run comprehensive health check on deployed infrastructure.
446
+
447
+ **Usage:**
448
+ ```bash
449
+ frigg doctor
450
+ frigg doctor --stack my-app-prod
451
+ frigg doctor --region us-west-2
452
+ frigg doctor --verbose
453
+ frigg doctor --format json
454
+ ```
455
+
456
+ **What it does:**
457
+ 1. Discovers resources in CloudFormation stack
458
+ 2. Discovers resources in cloud provider (AWS/GCP/Azure)
459
+ 3. Compares desired state (app definition) with actual state
460
+ 4. Detects infrastructure issues:
461
+ - **Orphaned Resources** - Resources exist in cloud but not in stack
462
+ - **Missing Resources** - Resources defined in stack but don't exist
463
+ - **Drifted Resources** - Properties differ between stack and actual
464
+ - **Property Mismatches** - Configuration drift on specific properties
465
+ 5. Calculates health score (0-100)
466
+ 6. Provides actionable remediation suggestions
467
+
468
+ **Options:**
469
+ - `--stack <name>` - CloudFormation stack name (default: from app definition)
470
+ - `--region <region>` - Cloud provider region
471
+ - `--format <format>` - Output format: `table` (default), `json`, `yaml`
472
+ - `--verbose` - Show detailed property comparisons
473
+ - `--check <domain>` - Check specific domain only: `vpc`, `kms`, `aurora`, `all`
474
+ - `--exit-code` - Exit with non-zero code if unhealthy (for CI/CD)
475
+
476
+ **Example Output:**
477
+
478
+ ```
479
+ 🩺 Running infrastructure health check...
480
+
481
+ Stack: my-app-prod (us-east-1)
482
+ Region: us-east-1
483
+ Account: 123456789012
484
+
485
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
486
+ HEALTH SCORE: 65 (degraded)
487
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
488
+
489
+ 📊 Resource Summary
490
+ ✓ 12 resources healthy
491
+ ⚠ 3 resources with warnings
492
+ ✗ 2 critical issues
493
+
494
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
495
+
496
+ 🔴 CRITICAL ISSUES (2)
497
+
498
+ [1] Orphaned Resource
499
+ Type: AWS::RDS::DBCluster
500
+ Physical ID: my-app-prod-aurora-cluster
501
+ Status: ORPHANED
502
+ Issue: Resource exists in AWS but not managed by CloudFormation stack
503
+ Impact: Stack doesn't track this resource. Manual deletion could break app.
504
+
505
+ Resolution: Run 'frigg repair --import' to import into stack
506
+
507
+ [2] Property Mismatch (Immutable)
508
+ Resource: ProductionBucket (AWS::S3::Bucket)
509
+ Property: BucketName
510
+ Expected: my-app-prod-bucket-v2
511
+ Actual: my-app-prod-bucket-v1
512
+ Mutability: IMMUTABLE
513
+ Impact: Requires resource replacement to fix
514
+
515
+ Resolution: Run 'frigg repair --reconcile' to plan replacement
516
+
517
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
518
+
519
+ ⚠️ WARNINGS (3)
520
+
521
+ [1] Property Drift (Mutable)
522
+ Resource: ProdVPC (AWS::EC2::VPC)
523
+ Property: Tags
524
+ Expected: [{"Key": "Environment", "Value": "production"}]
525
+ Actual: [{"Key": "Env", "Value": "prod"}]
526
+ Mutability: MUTABLE
527
+ Impact: Configuration drift - can be auto-fixed
528
+
529
+ Resolution: Run 'frigg repair --reconcile'
530
+
531
+ [2] Property Drift (Mutable)
532
+ Resource: FriggKMSKey (AWS::KMS::Key)
533
+ Property: EnableKeyRotation
534
+ Expected: true
535
+ Actual: false
536
+ Mutability: MUTABLE
537
+ Impact: Key rotation disabled - security risk
538
+
539
+ Resolution: Run 'frigg repair --reconcile'
540
+
541
+ [3] Missing Tag
542
+ Resource: LambdaExecutionRole (AWS::IAM::Role)
543
+ Expected Tag: CostCenter
544
+ Impact: Cost tracking incomplete
545
+
546
+ Resolution: Update app definition and redeploy
547
+
548
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
549
+
550
+ 💡 RECOMMENDATIONS
551
+
552
+ High Priority:
553
+ • Import orphaned Aurora cluster to prevent data loss
554
+ • Plan S3 bucket replacement (requires downtime)
555
+
556
+ Medium Priority:
557
+ • Fix 2 mutable property drifts
558
+ • Enable KMS key rotation for security
559
+
560
+ Low Priority:
561
+ • Add missing tags for cost tracking
562
+
563
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
564
+
565
+ Next steps:
566
+ 1. Review critical issues above
567
+ 2. Run 'frigg repair' to fix detected issues
568
+ 3. Re-run 'frigg doctor' to verify fixes
569
+
570
+ For detailed report: frigg doctor --format json > health-report.json
571
+ ```
572
+
573
+ **JSON Output** (with `--format json`):
574
+ ```json
575
+ {
576
+ "stack": {
577
+ "name": "my-app-prod",
578
+ "region": "us-east-1",
579
+ "accountId": "123456789012"
580
+ },
581
+ "healthScore": 65,
582
+ "assessment": "degraded",
583
+ "summary": {
584
+ "healthy": 12,
585
+ "warnings": 3,
586
+ "critical": 2,
587
+ "total": 17
588
+ },
589
+ "issues": [
590
+ {
591
+ "severity": "critical",
592
+ "type": "orphaned_resource",
593
+ "resource": {
594
+ "type": "AWS::RDS::DBCluster",
595
+ "physicalId": "my-app-prod-aurora-cluster",
596
+ "state": "ORPHANED"
597
+ },
598
+ "description": "Resource exists in AWS but not managed by stack",
599
+ "impact": "Stack doesn't track this resource",
600
+ "resolution": {
601
+ "command": "frigg repair --import",
602
+ "canAutoFix": true
603
+ }
604
+ },
605
+ {
606
+ "severity": "critical",
607
+ "type": "property_mismatch",
608
+ "resource": {
609
+ "logicalId": "ProductionBucket",
610
+ "type": "AWS::S3::Bucket",
611
+ "physicalId": "my-app-prod-bucket-v1"
612
+ },
613
+ "mismatch": {
614
+ "propertyPath": "Properties.BucketName",
615
+ "expected": "my-app-prod-bucket-v2",
616
+ "actual": "my-app-prod-bucket-v1",
617
+ "mutability": "IMMUTABLE"
618
+ },
619
+ "impact": "Requires resource replacement",
620
+ "resolution": {
621
+ "command": "frigg repair --reconcile",
622
+ "canAutoFix": false,
623
+ "requiresReplacement": true
624
+ }
625
+ }
626
+ ],
627
+ "recommendations": [
628
+ {
629
+ "priority": "high",
630
+ "action": "Import orphaned Aurora cluster",
631
+ "reason": "Prevent data loss"
632
+ },
633
+ {
634
+ "priority": "high",
635
+ "action": "Plan S3 bucket replacement",
636
+ "reason": "Requires downtime coordination"
637
+ }
638
+ ],
639
+ "timestamp": "2025-10-26T01:23:45.678Z"
640
+ }
641
+ ```
642
+
643
+ **Exit Codes** (with `--exit-code`):
644
+ - `0` - Healthy (score >= 80)
645
+ - `1` - Degraded (score 40-79)
646
+ - `2` - Unhealthy (score < 40)
647
+ - `3` - Error running health check
648
+
649
+ **Use Cases:**
650
+ - **Pre-deployment validation** - Run before deploy to catch issues
651
+ - **CI/CD health gates** - Fail pipeline if score below threshold
652
+ - **Scheduled audits** - Cron job to monitor infrastructure drift
653
+ - **Incident investigation** - Diagnose production issues
654
+ - **Compliance checks** - Verify security configurations
655
+
656
+ ---
657
+
658
+ #### `frigg repair [options]`
659
+
660
+ **Status:** Planned (implementation in progress)
661
+
662
+ Repair infrastructure issues detected by `frigg doctor`.
663
+
664
+ **Usage:**
665
+ ```bash
666
+ frigg repair # Interactive mode
667
+ frigg repair --import # Import orphaned resources
668
+ frigg repair --reconcile # Fix property mismatches
669
+ frigg repair --clean-deploy # Delete and recreate resources
670
+ frigg repair --auto # Auto-fix all fixable issues (CI/CD mode)
671
+ frigg repair --dry-run # Show what would be fixed
672
+ frigg repair --issue <id> # Fix specific issue only
673
+ ```
674
+
675
+ **What it does:**
676
+
677
+ **Import Mode** (`--import`):
678
+ 1. Discovers orphaned resources (exist in cloud, not in stack)
679
+ 2. Validates resources are importable
680
+ 3. Generates CloudFormation import change set
681
+ 4. Displays resources to be imported
682
+ 5. Confirms with user (unless --auto)
683
+ 6. Executes CloudFormation import operation
684
+ 7. Updates stack to track resources
685
+
686
+ **Reconcile Mode** (`--reconcile`):
687
+ 1. Detects property mismatches (drift)
688
+ 2. Categorizes by mutability:
689
+ - **Mutable** - Can update without replacement
690
+ - **Immutable** - Requires resource replacement
691
+ - **Conditional** - Depends on other properties
692
+ 3. Auto-fixes mutable properties
693
+ 4. Plans replacement for immutable properties
694
+ 5. Prompts for confirmation on destructive changes
695
+ 6. Executes updates via CloudFormation
696
+
697
+ **Clean Deploy Mode** (`--clean-deploy`):
698
+ 1. Identifies resources that can't be imported/reconciled
699
+ 2. Plans deletion of problematic resources
700
+ 3. Generates new resource definitions
701
+ 4. Confirms destructive operation
702
+ 5. Deletes old resources
703
+ 6. Creates new resources via CloudFormation
704
+ 7. Updates application references
705
+
706
+ **Options:**
707
+ - `--import` - Import orphaned resources into stack
708
+ - `--reconcile` - Fix property mismatches
709
+ - `--clean-deploy` - Delete and recreate resources
710
+ - `--auto` - Auto-fix without prompts (for CI/CD)
711
+ - `--dry-run` - Show planned changes without executing
712
+ - `--issue <id>` - Fix only specific issue from doctor report
713
+ - `--force` - Skip safety checks (dangerous!)
714
+ - `--backup` - Create backup before destructive operations
715
+
716
+ **Example Output:**
717
+
718
+ **Interactive Mode:**
719
+ ```
720
+ 🔧 Frigg Repair - Infrastructure Remediation
721
+
722
+ 🩺 Running health check first...
723
+ Found 5 issues to repair:
724
+ • 2 orphaned resources
725
+ • 2 property mismatches (mutable)
726
+ • 1 property mismatch (immutable)
727
+
728
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
729
+
730
+ What would you like to do?
731
+
732
+ [1] Import orphaned resources (2)
733
+ ├─ AWS::RDS::DBCluster - my-app-prod-aurora-cluster
734
+ └─ AWS::EC2::VPC - vpc-0abc123
735
+
736
+ [2] Fix mutable property drift (2) ⚡ Auto-fixable
737
+ ├─ ProdVPC: Tags property mismatch
738
+ └─ FriggKMSKey: EnableKeyRotation mismatch
739
+
740
+ [3] Plan immutable property replacement (1) ⚠️ Requires downtime
741
+ └─ ProductionBucket: BucketName mismatch
742
+
743
+ [4] Fix all auto-fixable issues
744
+ [5] Show detailed repair plan
745
+ [Q] Quit
746
+
747
+ Select option [1-5, Q]:
748
+ ```
749
+
750
+ **After selecting option 1 (Import):**
751
+ ```
752
+ 🔍 Analyzing resources for import...
753
+
754
+ Resources to import:
755
+ ┌──────────────────────────────────────────────────────────────┐
756
+ │ Resource 1: Aurora Database Cluster │
757
+ ├──────────────────────────────────────────────────────────────┤
758
+ │ Type: AWS::RDS::DBCluster │
759
+ │ Physical ID: my-app-prod-aurora-cluster │
760
+ │ Logical ID: AuroraCluster (will be assigned) │
761
+ │ Status: Ready for import │
762
+ │ Properties: Will be matched from existing resource │
763
+ └──────────────────────────────────────────────────────────────┘
764
+
765
+ ┌──────────────────────────────────────────────────────────────┐
766
+ │ Resource 2: VPC │
767
+ ├──────────────────────────────────────────────────────────────┤
768
+ │ Type: AWS::EC2::VPC │
769
+ │ Physical ID: vpc-0abc123 │
770
+ │ Logical ID: ProdVPC (will be assigned) │
771
+ │ Status: Ready for import │
772
+ │ Properties: Will be matched from existing resource │
773
+ └──────────────────────────────────────────────────────────────┘
774
+
775
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
776
+
777
+ ⚠️ IMPORTANT: CloudFormation Import Requirements
778
+
779
+ ✓ Resources must be in a stable state
780
+ ✓ Resources must be importable resource types
781
+ ✓ Stack must be in UPDATE_COMPLETE or CREATE_COMPLETE state
782
+ ✓ Import operation cannot be rolled back
783
+
784
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
785
+
786
+ Proceed with import? [y/N]: y
787
+
788
+ Creating CloudFormation change set for import...
789
+ ✓ Change set created: import-2025-10-26-01-23-45
790
+
791
+ Reviewing change set...
792
+ ✓ Validation passed
793
+
794
+ Executing import operation...
795
+ [████████████████████████████████] 100% - Importing resources
796
+
797
+ ✓ AuroraCluster imported successfully
798
+ ✓ ProdVPC imported successfully
799
+
800
+ Import completed! Resources are now managed by CloudFormation.
801
+
802
+ Next steps:
803
+ • Run 'frigg doctor' to verify health improved
804
+ • Future deploys will manage these resources
805
+ ```
806
+
807
+ **After selecting option 2 (Fix Mutable Drift):**
808
+ ```
809
+ 🔄 Reconciling property mismatches...
810
+
811
+ Planned Updates:
812
+ ┌──────────────────────────────────────────────────────────────┐
813
+ │ Update 1: ProdVPC (AWS::EC2::VPC) │
814
+ ├──────────────────────────────────────────────────────────────┤
815
+ │ Property: Tags │
816
+ │ Current: [{"Key": "Env", "Value": "prod"}] │
817
+ │ Desired: [{"Key": "Environment", "Value": "production"}] │
818
+ │ Impact: No interruption │
819
+ │ Auto-fix: ✓ Yes │
820
+ └──────────────────────────────────────────────────────────────┘
821
+
822
+ ┌──────────────────────────────────────────────────────────────┐
823
+ │ Update 2: FriggKMSKey (AWS::KMS::Key) │
824
+ ├──────────────────────────────────────────────────────────────┤
825
+ │ Property: EnableKeyRotation │
826
+ │ Current: false │
827
+ │ Desired: true │
828
+ │ Impact: No interruption │
829
+ │ Auto-fix: ✓ Yes │
830
+ └──────────────────────────────────────────────────────────────┘
831
+
832
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
833
+
834
+ These changes are safe (no resource replacement required).
835
+
836
+ Proceed with updates? [y/N]: y
837
+
838
+ Applying updates via CloudFormation...
839
+ [████████████████████████████████] 100% - Updating stack
840
+
841
+ ✓ ProdVPC tags updated
842
+ ✓ FriggKMSKey rotation enabled
843
+
844
+ Property drift fixed! Stack now matches desired configuration.
845
+ ```
846
+
847
+ **Dry Run Mode** (`--dry-run`):
848
+ ```
849
+ 🔬 Repair Dry Run - No changes will be made
850
+
851
+ Detected Issues:
852
+ ✓ 2 orphaned resources → Would import via CloudFormation
853
+ ✓ 2 mutable property drifts → Would update properties
854
+ ✗ 1 immutable property drift → Requires manual intervention
855
+
856
+ Planned Actions:
857
+
858
+ [1] Import Resources
859
+ Command: aws cloudformation create-change-set \
860
+ --stack-name my-app-prod \
861
+ --change-set-type IMPORT \
862
+ --resources-to-import file://resources.json
863
+
864
+ [2] Update Properties
865
+ Update: ProdVPC.Tags
866
+ From: [{"Key": "Env", "Value": "prod"}]
867
+ To: [{"Key": "Environment", "Value": "production"}]
868
+
869
+ Update: FriggKMSKey.EnableKeyRotation
870
+ From: false
871
+ To: true
872
+
873
+ [3] Manual Action Required
874
+ Resource: ProductionBucket
875
+ Issue: BucketName is immutable
876
+ Current: my-app-prod-bucket-v1
877
+ Desired: my-app-prod-bucket-v2
878
+
879
+ Resolution steps:
880
+ 1. Create new bucket: my-app-prod-bucket-v2
881
+ 2. Copy data from old bucket to new bucket
882
+ 3. Update application configuration
883
+ 4. Delete old bucket: my-app-prod-bucket-v1
884
+ 5. Update CloudFormation stack
885
+
886
+ ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
887
+
888
+ To execute repairs, run: frigg repair --auto
889
+ To execute specific issue: frigg repair --issue <id>
890
+ ```
891
+
892
+ **Exit Codes:**
893
+ - `0` - Repairs completed successfully
894
+ - `1` - Some repairs failed
895
+ - `2` - Repairs require manual intervention
896
+ - `3` - Error during repair operation
897
+
898
+ **Safety Features:**
899
+ - **Confirmation prompts** for destructive operations
900
+ - **Dry-run mode** to preview changes
901
+ - **Backup creation** before deletions
902
+ - **Rollback support** via CloudFormation
903
+ - **Validation** before import/update
904
+ - **Issue-specific** repair to limit blast radius
905
+
906
+ **Use Cases:**
907
+ - **Import unmanaged resources** - Bring existing infrastructure under CloudFormation management
908
+ - **Fix configuration drift** - Align actual state with desired state
909
+ - **Clean up orphaned resources** - Remove resources outside stack control
910
+ - **Remediate security issues** - Fix misconfigurations automatically
911
+ - **CI/CD integration** - Auto-repair in deployment pipelines
912
+
913
+ ---
914
+
915
+ ## Multi-Cloud Provider Support
916
+
917
+ ### Current Status
918
+ - **AWS**: Fully supported
919
+ - **GCP**: Planned
920
+ - **Azure**: Planned
921
+ - **Cloudflare**: Planned
922
+
923
+ ### Architecture for Multi-Cloud
924
+
925
+ The CLI uses Hexagonal Architecture (Ports & Adapters) to support multiple cloud providers:
926
+
927
+ **Domain Layer** (Provider-Agnostic):
928
+ ```
929
+ packages/devtools/infrastructure/domains/health/
930
+ domain/ # Pure domain logic (no provider specifics)
931
+ entities/ # Resource, Issue, StackHealthReport
932
+ value-objects/ # HealthScore, ResourceState, PropertyMutability
933
+ services/ # HealthScoreCalculator, DriftDetector
934
+
935
+ application/ # Use cases (orchestration)
936
+ use-cases/ # RunHealthCheck, RepairStack, ImportResource
937
+ ports/ # Interfaces for adapters
938
+ StackRepository.js # Port interface
939
+ ResourceDetector.js # Port interface
940
+ DriftDetector.js # Port interface
941
+ ```
942
+
943
+ **Infrastructure Layer** (Provider-Specific Adapters):
944
+ ```
945
+ packages/devtools/infrastructure/domains/health/
946
+ infrastructure/
947
+ adapters/
948
+ aws/ # AWS-specific implementations
949
+ AWSStackRepository.js # CloudFormation
950
+ AWSResourceDetector.js # AWS APIs (EC2, RDS, etc.)
951
+ AWSCloudFormationImporter.js # Import operations
952
+
953
+ gcp/ # GCP-specific implementations (future)
954
+ GCPStackRepository.js # Deployment Manager
955
+ GCPResourceDetector.js # GCP APIs
956
+ GCPDeploymentImporter.js
957
+
958
+ azure/ # Azure-specific implementations (future)
959
+ AzureStackRepository.js # ARM Templates
960
+ AzureResourceDetector.js # Azure APIs
961
+ AzureResourceImporter.js
962
+ ```
963
+
964
+ **Provider Selection**:
965
+ ```javascript
966
+ // App definition specifies provider
967
+ {
968
+ provider: 'aws', // or 'gcp', 'azure', 'cloudflare'
969
+ region: 'us-east-1',
970
+ // ... rest of definition
971
+ }
972
+
973
+ // CLI auto-selects correct adapter
974
+ const adapters = getAdaptersForProvider(appDefinition.provider);
975
+ const useCase = new RunHealthCheckUseCase({
976
+ stackRepository: adapters.stackRepository, // AWS/GCP/Azure
977
+ resourceDetector: adapters.resourceDetector, // Provider-specific
978
+ driftDetector: adapters.driftDetector, // Provider-specific
979
+ });
980
+ ```
981
+
982
+ **Provider-Specific Domains**:
983
+
984
+ Some infrastructure domains are inherently provider-specific:
985
+
986
+ ```
987
+ domains/
988
+ networking/
989
+ vpc-builder.js # AWS VPC
990
+ vnet-builder.js # Azure VNet (future)
991
+ network-builder.js # GCP Network (future)
992
+
993
+ database/
994
+ aurora-builder.js # AWS Aurora
995
+ cloud-sql-builder.js # GCP Cloud SQL (future)
996
+ cosmos-db-builder.js # Azure Cosmos DB (future)
997
+ ```
998
+
999
+ Builder orchestrator selects appropriate builders based on provider:
1000
+ ```javascript
1001
+ const orchestrator = new BuilderOrchestrator(
1002
+ getBuilders(appDefinition.provider) // Returns AWS/GCP/Azure builders
1003
+ );
1004
+ ```
1005
+
1006
+ ---
1007
+
1008
+ ## Environment Variables
1009
+
1010
+ ### Required (varies by features used)
1011
+
1012
+ **Database:**
1013
+ - `DATABASE_URL` - Connection string for MongoDB or PostgreSQL
1014
+
1015
+ **AWS Deployment:**
1016
+ - `AWS_ACCESS_KEY_ID` - AWS access key
1017
+ - `AWS_SECRET_ACCESS_KEY` - AWS secret key
1018
+ - `AWS_REGION` - AWS region (or use --region flag)
1019
+
1020
+ **Encryption:**
1021
+ - `KMS_KEY_ARN` - AWS KMS key ARN (or auto-discovered)
1022
+ - `AES_KEY_ID` - AES key ID (if using AES encryption)
1023
+ - `AES_KEY` - AES encryption key (32 characters)
1024
+
1025
+ **Optional:**
1026
+ - `STAGE` - Deployment stage (default: 'dev')
1027
+ - `FRIGG_SKIP_AWS_DISCOVERY` - Skip AWS resource discovery (speeds up local dev)
1028
+ - `NODE_ENV` - Node environment (development, production, test)
1029
+
1030
+ ### App-Defined Variables
1031
+
1032
+ Additional environment variables can be defined in your app definition:
1033
+
1034
+ ```javascript
1035
+ {
1036
+ environment: {
1037
+ JWT_SECRET: true, // Mark as required
1038
+ STRIPE_API_KEY: true,
1039
+ SENDGRID_API_KEY: true,
1040
+ FEATURE_FLAG_X: true,
1041
+ }
1042
+ }
1043
+ ```
1044
+
1045
+ These are validated during deploy and passed to Lambda functions.
1046
+
1047
+ ---
1048
+
1049
+ ## Configuration Files
1050
+
1051
+ ### `index.js` (App Definition)
1052
+
1053
+ Entry point for your Frigg application:
1054
+
1055
+ ```javascript
1056
+ const { ModuleManager, IntegrationManager } = require('@friggframework/core');
1057
+ const HubSpotIntegration = require('@friggframework/api-module-hubspot');
1058
+
1059
+ const Definition = {
1060
+ name: 'my-integration-app',
1061
+ version: '1.0.0',
1062
+
1063
+ provider: 'aws',
1064
+ region: 'us-east-1',
1065
+
1066
+ integrations: [
1067
+ {
1068
+ Definition: HubSpotIntegration.Definition,
1069
+ ownership: {
1070
+ queue: 'STACK', // Create queue in CloudFormation
1071
+ },
1072
+ },
1073
+ ],
1074
+
1075
+ database: {
1076
+ type: 'mongodb',
1077
+ ownership: 'STACK', // Create Aurora in CloudFormation
1078
+ },
1079
+
1080
+ vpc: {
1081
+ ownership: 'EXTERNAL',
1082
+ vpcId: 'vpc-0abc123', // Use existing VPC
1083
+ },
1084
+
1085
+ kms: {
1086
+ ownership: 'STACK', // Create KMS key in CloudFormation
1087
+ },
1088
+
1089
+ encryption: {
1090
+ useDefaultKMSForFieldLevelEncryption: true,
1091
+ },
1092
+
1093
+ environment: {
1094
+ DATABASE_URL: true,
1095
+ JWT_SECRET: true,
1096
+ },
1097
+ };
1098
+
1099
+ module.exports = { Definition };
1100
+ ```
1101
+
1102
+ ### `infrastructure.js` (Generated)
1103
+
1104
+ This file is **generated** by the Frigg infrastructure composer and should not be edited manually. It's referenced by `osls deploy` command.
1105
+
1106
+ ---
1107
+
1108
+ ## Architecture Overview
1109
+
1110
+ ```
1111
+ ┌─────────────────────────────────────────────────────────┐
1112
+ │ Frigg CLI Commands │
1113
+ │ • frigg install • frigg deploy • frigg doctor │
1114
+ │ • frigg search • frigg start • frigg repair │
1115
+ │ • frigg generate • frigg db:setup │
1116
+ └───────────────┬─────────────────────────────────────────┘
1117
+ │
1118
+ ┌───────────────▼─────────────────────────────────────────┐
1119
+ │ Infrastructure Composer │
1120
+ │ packages/devtools/infrastructure/ │
1121
+ │ │
1122
+ │ • Loads app definition (index.js) │
1123
+ │ • Orchestrates domain builders │
1124
+ │ • Generates serverless configuration │
1125
+ └───────────────┬─────────────────────────────────────────┘
1126
+ │
1127
+ ┌───────────────▼─────────────────────────────────────────┐
1128
+ │ Domain Builders (Hexagonal Architecture) │
1129
+ │ │
1130
+ │ Discovery → Resolution → Building │
1131
+ │ │
1132
+ │ • VpcBuilder (networking) │
1133
+ │ • KmsBuilder (security) │
1134
+ │ • AuroraBuilder (database) │
1135
+ │ • MigrationBuilder (database) │
1136
+ │ • IntegrationBuilder (integration) │
1137
+ │ • SsmBuilder (parameters) │
1138
+ │ • WebsocketBuilder (integration) │
1139
+ └───────────────┬─────────────────────────────────────────┘
1140
+ │
1141
+ ┌───────────────▼─────────────────────────────────────────┐
1142
+ │ OSS-Serverless (Deployment) │
1143
+ │ • Packages Lambda functions │
1144
+ │ • Generates CloudFormation templates │
1145
+ │ • Deploys to AWS │
1146
+ └─────────────────────────────────────────────────────────┘
1147
+ ```
1148
+
1149
+ ---
1150
+
1151
+ ## Common Workflows
1152
+
1153
+ ### Initial Project Setup
1154
+
1155
+ ```bash
1156
+ # 1. Install integrations
1157
+ frigg install hubspot
1158
+ frigg install stripe
1159
+
1160
+ # 2. Set up database
1161
+ export DATABASE_URL="mongodb://localhost:27017/myapp"
1162
+ frigg db:setup
1163
+
1164
+ # 3. Start local development
1165
+ frigg start --frontend
1166
+
1167
+ # 4. Test integration flows locally
1168
+ # Visit http://localhost:3000
1169
+
1170
+ # 5. Deploy to dev
1171
+ frigg deploy --stage dev
1172
+
1173
+ # 6. Deploy to production
1174
+ frigg deploy --stage production
1175
+ ```
1176
+
1177
+ ### Infrastructure Health Workflow
1178
+
1179
+ ```bash
1180
+ # 1. Check infrastructure health
1181
+ frigg doctor --stage production
1182
+
1183
+ # 2. Review issues (health score, orphaned resources, drift)
1184
+
1185
+ # 3. Fix auto-fixable issues
1186
+ frigg repair --auto
1187
+
1188
+ # 4. Manually fix complex issues
1189
+ frigg repair --issue 3
1190
+
1191
+ # 5. Verify health improved
1192
+ frigg doctor --stage production
1193
+ ```
1194
+
1195
+ ### Troubleshooting Deployment Issues
1196
+
1197
+ ```bash
1198
+ # 1. Enable verbose logging
1199
+ frigg deploy --stage dev --verbose
1200
+
1201
+ # 2. Check for orphaned resources
1202
+ frigg doctor --verbose
1203
+
1204
+ # 3. Import orphaned resources
1205
+ frigg repair --import
1206
+
1207
+ # 4. Retry deployment
1208
+ frigg deploy --stage dev --force
1209
+ ```
1210
+
1211
+ ---
1212
+
1213
+ ## Exit Codes
1214
+
1215
+ All commands follow consistent exit code conventions:
1216
+
1217
+ - `0` - Success
1218
+ - `1` - General error
1219
+ - `2` - Configuration error
1220
+ - `3` - Network/API error
1221
+ - `4` - Validation error
1222
+ - `5` - User cancelled operation
1223
+
1224
+ ---
1225
+
1226
+ ## Getting Help
1227
+
1228
+ ```bash
1229
+ frigg --help # General help
1230
+ frigg <command> --help # Command-specific help
1231
+ frigg --version # Show version
1232
+ ```
1233
+
1234
+ **Community Support:**
1235
+ - GitHub Issues: https://github.com/friggframework/frigg/issues
1236
+ - Documentation: https://docs.friggframework.org
1237
+ - Slack: Join via https://friggframework.org/#contact
1238
+
1239
+ ---
1240
+
1241
+ ## Package Structure & Global Installation
1242
+
1243
+ ### Overview
1244
+
1245
+ The Frigg CLI is a standalone globally-installable npm package that can be installed via `npm i -g @friggframework/frigg-cli`. It includes version detection logic to automatically prefer local project installations when available.
1246
+
1247
+ ### Package Structure
1248
+
1249
+ **@friggframework/frigg-cli** (standalone package)
1250
+ ```
1251
+ ├── package.json
1252
+ │ ├── dependencies: @friggframework/core@^2.0.0-next.0
1253
+ │ ├── dependencies: @friggframework/devtools@^2.0.0-next.0
1254
+ │ └── publishConfig: { access: "public" }
1255
+ └── index.js (with version detection wrapper)
1256
+ ```
1257
+
1258
+ **Key Changes from Previous Structure:**
1259
+ - ✅ Replaced `workspace:*` with concrete versions (`^2.0.0-next.0`)
1260
+ - ✅ Added `@friggframework/devtools` as dependency
1261
+ - ✅ Added `publishConfig` for public npm publishing
1262
+ - ✅ Removed bin entry from devtools package.json
1263
+
1264
+ **Note:** Since `@friggframework/devtools` is a dependency, the global install size includes devtools. The main benefit is proper version resolution (no `workspace:*` errors) and automatic local CLI preference.
1265
+
1266
+ ### Version Detection Logic
1267
+
1268
+ When you run `frigg` (globally installed), the CLI:
1269
+
1270
+ 1. **Checks for skip flag**
1271
+ - If `FRIGG_CLI_SKIP_VERSION_CHECK=true`, skips detection (prevents recursion)
1272
+
1273
+ 2. **Looks for local installation**
1274
+ - Searches for `node_modules/@friggframework/frigg-cli` in current directory
1275
+
1276
+ 3. **Compares versions**
1277
+ - Uses `semver.compare(localVersion, globalVersion)`
1278
+
1279
+ 4. **Makes decision**:
1280
+ - **Local ≥ Global**: Uses local CLI (spawns subprocess)
1281
+ - **Global > Local**: Warns and uses global
1282
+ - **No local**: Uses global silently
1283
+
1284
+ ### Benefits
1285
+
1286
+ | Aspect | Before | After |
1287
+ |--------|--------|-------|
1288
+ | **Global Install** | `npm i -g @friggframework/devtools` | `npm i -g @friggframework/frigg-cli` |
1289
+ | **Dependencies** | workspace:* (broken) | Concrete versions (works) |
1290
+ | **Version Preference** | No detection | Automatic local preference |
1291
+ | **Version Warnings** | None | Mismatch alerts |
1292
+ | **Publishability** | ❌ Fails | ✅ Works |
1293
+ | **Local Project Isolation** | ❌ Uses global versions | ✅ Uses local versions when available |
1294
+
1295
+ ### Publishing Workflow
1296
+
1297
+ ```bash
1298
+ # Publish to npm
1299
+ cd packages/frigg-cli
1300
+ npm version patch # or minor, major
1301
+ npm publish
1302
+
1303
+ # Users can now install globally
1304
+ npm install -g @friggframework/frigg-cli
1305
+
1306
+ # And it will automatically use local versions when available
1307
+ ```
1308
+
1309
+ ### Migration Path
1310
+
1311
+ **For existing users:**
1312
+
1313
+ ```bash
1314
+ # Step 1: Uninstall old global devtools
1315
+ npm uninstall -g @friggframework/devtools
1316
+
1317
+ # Step 2: Install new global CLI
1318
+ npm install -g @friggframework/frigg-cli
1319
+
1320
+ # Step 3: Update local project dependencies
1321
+ npm install @friggframework/frigg-cli@latest
1322
+ ```
1323
+
1324
+ **For new projects:**
1325
+
1326
+ ```bash
1327
+ # Global CLI (once per machine)
1328
+ npm install -g @friggframework/frigg-cli
1329
+
1330
+ # Local project dependencies
1331
+ npx create-frigg-app my-app
1332
+ # (Will automatically include @friggframework/frigg-cli in package.json)
1333
+ ```
1334
+
1335
+ **Status:** ✅ Complete and tested (15 passing tests)
1336
+