specweave 0.22.0 → 0.22.2

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 (184) hide show
  1. package/CLAUDE.md +211 -0
  2. package/README.md +5 -5
  3. package/bin/specweave.js +5 -8
  4. package/dist/plugins/specweave-github/lib/CodeValidator.d.ts +1 -1
  5. package/dist/plugins/specweave-github/lib/CodeValidator.js +1 -1
  6. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts +10 -0
  7. package/dist/plugins/specweave-github/lib/github-client-v2.d.ts.map +1 -1
  8. package/dist/plugins/specweave-github/lib/github-client-v2.js +26 -0
  9. package/dist/plugins/specweave-github/lib/github-client-v2.js.map +1 -1
  10. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
  11. package/dist/plugins/specweave-github/lib/task-sync.js +7 -0
  12. package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
  13. package/dist/src/cli/commands/migrate-to-profiles.d.ts +1 -0
  14. package/dist/src/cli/commands/migrate-to-profiles.d.ts.map +1 -1
  15. package/dist/src/cli/commands/migrate-to-profiles.js +12 -1
  16. package/dist/src/cli/commands/migrate-to-profiles.js.map +1 -1
  17. package/dist/src/cli/commands/next-command.d.ts +52 -0
  18. package/dist/src/cli/commands/next-command.d.ts.map +1 -0
  19. package/dist/src/cli/commands/next-command.js +204 -0
  20. package/dist/src/cli/commands/next-command.js.map +1 -0
  21. package/dist/src/cli/commands/sync-specs.d.ts +16 -0
  22. package/dist/src/cli/commands/sync-specs.d.ts.map +1 -0
  23. package/dist/src/cli/commands/sync-specs.js +130 -0
  24. package/dist/src/cli/commands/sync-specs.js.map +1 -0
  25. package/dist/src/cli/count-tasks.d.ts +20 -0
  26. package/dist/src/cli/count-tasks.d.ts.map +1 -0
  27. package/dist/src/cli/count-tasks.js +50 -0
  28. package/dist/src/cli/count-tasks.js.map +1 -0
  29. package/dist/src/config/ConfigManager.d.ts.map +1 -1
  30. package/dist/src/config/ConfigManager.js +2 -1
  31. package/dist/src/config/ConfigManager.js.map +1 -1
  32. package/dist/src/config/types.d.ts +50 -50
  33. package/dist/src/core/cicd/state-manager.d.ts +8 -0
  34. package/dist/src/core/cicd/state-manager.d.ts.map +1 -1
  35. package/dist/src/core/cicd/state-manager.js +60 -15
  36. package/dist/src/core/cicd/state-manager.js.map +1 -1
  37. package/dist/src/core/cost-tracker.d.ts.map +1 -1
  38. package/dist/src/core/cost-tracker.js +2 -1
  39. package/dist/src/core/cost-tracker.js.map +1 -1
  40. package/dist/src/core/iac/template-engine.d.ts.map +1 -1
  41. package/dist/src/core/iac/template-engine.js +28 -0
  42. package/dist/src/core/iac/template-engine.js.map +1 -1
  43. package/dist/src/core/iac/template-generator.d.ts +53 -0
  44. package/dist/src/core/iac/template-generator.d.ts.map +1 -0
  45. package/dist/src/core/iac/template-generator.js +125 -0
  46. package/dist/src/core/iac/template-generator.js.map +1 -0
  47. package/dist/src/core/increment/status-auto-transition.js +3 -3
  48. package/dist/src/core/increment/status-auto-transition.js.map +1 -1
  49. package/dist/src/core/living-docs/CodeValidator.js +1 -1
  50. package/dist/src/core/living-docs/CodeValidator.js.map +1 -1
  51. package/dist/src/core/living-docs/content-distributor.d.ts.map +1 -1
  52. package/dist/src/core/living-docs/content-distributor.js +11 -1
  53. package/dist/src/core/living-docs/content-distributor.js.map +1 -1
  54. package/dist/src/core/living-docs/living-docs-sync.d.ts +166 -0
  55. package/dist/src/core/living-docs/living-docs-sync.d.ts.map +1 -0
  56. package/dist/src/core/living-docs/living-docs-sync.js +726 -0
  57. package/dist/src/core/living-docs/living-docs-sync.js.map +1 -0
  58. package/dist/src/core/living-docs/task-project-specific-generator.d.ts +7 -3
  59. package/dist/src/core/living-docs/task-project-specific-generator.d.ts.map +1 -1
  60. package/dist/src/core/living-docs/task-project-specific-generator.js +40 -24
  61. package/dist/src/core/living-docs/task-project-specific-generator.js.map +1 -1
  62. package/dist/src/core/plugin-loader.d.ts +7 -0
  63. package/dist/src/core/plugin-loader.d.ts.map +1 -1
  64. package/dist/src/core/plugin-loader.js +18 -1
  65. package/dist/src/core/plugin-loader.js.map +1 -1
  66. package/dist/src/core/serverless/platform-data-loader.d.ts +8 -0
  67. package/dist/src/core/serverless/platform-data-loader.d.ts.map +1 -1
  68. package/dist/src/core/serverless/platform-data-loader.js +14 -0
  69. package/dist/src/core/serverless/platform-data-loader.js.map +1 -1
  70. package/dist/src/core/serverless/types.d.ts +1 -1
  71. package/dist/src/core/serverless/types.d.ts.map +1 -1
  72. package/dist/src/core/status-line/status-line-manager.d.ts +6 -2
  73. package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
  74. package/dist/src/core/status-line/status-line-manager.js +11 -5
  75. package/dist/src/core/status-line/status-line-manager.js.map +1 -1
  76. package/dist/src/core/status-line/task-counter.d.ts +69 -0
  77. package/dist/src/core/status-line/task-counter.d.ts.map +1 -0
  78. package/dist/src/core/status-line/task-counter.js +107 -0
  79. package/dist/src/core/status-line/task-counter.js.map +1 -0
  80. package/dist/src/core/workflow/autonomous-executor.d.ts +111 -0
  81. package/dist/src/core/workflow/autonomous-executor.d.ts.map +1 -0
  82. package/dist/src/core/workflow/autonomous-executor.js +275 -0
  83. package/dist/src/core/workflow/autonomous-executor.js.map +1 -0
  84. package/dist/src/core/workflow/backlog-scanner.d.ts +94 -0
  85. package/dist/src/core/workflow/backlog-scanner.d.ts.map +1 -0
  86. package/dist/src/core/workflow/backlog-scanner.js +170 -0
  87. package/dist/src/core/workflow/backlog-scanner.js.map +1 -0
  88. package/dist/src/core/workflow/command-invoker.d.ts +86 -0
  89. package/dist/src/core/workflow/command-invoker.d.ts.map +1 -0
  90. package/dist/src/core/workflow/command-invoker.js +131 -0
  91. package/dist/src/core/workflow/command-invoker.js.map +1 -0
  92. package/dist/src/core/workflow/cost-estimator.d.ts +120 -0
  93. package/dist/src/core/workflow/cost-estimator.d.ts.map +1 -0
  94. package/dist/src/core/workflow/cost-estimator.js +222 -0
  95. package/dist/src/core/workflow/cost-estimator.js.map +1 -0
  96. package/dist/src/core/workflow/index.d.ts +20 -0
  97. package/dist/src/core/workflow/index.d.ts.map +1 -0
  98. package/dist/src/core/workflow/index.js +24 -0
  99. package/dist/src/core/workflow/index.js.map +1 -0
  100. package/dist/src/core/workflow/state-manager.d.ts +107 -0
  101. package/dist/src/core/workflow/state-manager.d.ts.map +1 -0
  102. package/dist/src/core/workflow/state-manager.js +126 -0
  103. package/dist/src/core/workflow/state-manager.js.map +1 -0
  104. package/dist/src/core/workflow/workflow-orchestrator.d.ts +93 -0
  105. package/dist/src/core/workflow/workflow-orchestrator.d.ts.map +1 -0
  106. package/dist/src/core/workflow/workflow-orchestrator.js +195 -0
  107. package/dist/src/core/workflow/workflow-orchestrator.js.map +1 -0
  108. package/dist/src/init/architecture/types.d.ts +10 -10
  109. package/dist/src/metrics/dora-calculator.js +2 -2
  110. package/dist/src/metrics/dora-calculator.js.map +1 -1
  111. package/dist/src/utils/pricing-constants.d.ts +5 -2
  112. package/dist/src/utils/pricing-constants.d.ts.map +1 -1
  113. package/dist/src/utils/pricing-constants.js +3 -2
  114. package/dist/src/utils/pricing-constants.js.map +1 -1
  115. package/package.json +4 -4
  116. package/plugins/specweave/agents/infrastructure/AGENT.md +88 -46
  117. package/plugins/specweave/agents/pm/AGENT.md +58 -1
  118. package/plugins/specweave/commands/specweave-archive-features.md +1 -1
  119. package/plugins/specweave/commands/specweave-archive-increments.md +1 -1
  120. package/plugins/specweave/commands/specweave-check-hooks.md +5 -0
  121. package/plugins/specweave/commands/specweave-done.md +12 -0
  122. package/plugins/specweave/commands/specweave-plan.md +1 -1
  123. package/plugins/specweave/commands/specweave-progress.md +108 -379
  124. package/plugins/specweave/commands/specweave-reopen.md +1 -1
  125. package/plugins/specweave/commands/specweave-restore-feature.md +1 -1
  126. package/plugins/specweave/commands/specweave-sync-specs.md +20 -48
  127. package/plugins/specweave/hooks/lib/update-status-line.sh +44 -35
  128. package/plugins/specweave/hooks/lib/validate-spec-status.sh +163 -0
  129. package/plugins/specweave/hooks/user-prompt-submit.sh +17 -35
  130. package/plugins/specweave/lib/hooks/update-tasks-md.js +52 -9
  131. package/plugins/specweave/lib/hooks/update-tasks-md.ts +77 -16
  132. package/plugins/specweave/templates/iac/aws-lambda/defaults.json +24 -0
  133. package/plugins/specweave/templates/iac/aws-lambda/templates/README.md.hbs +260 -0
  134. package/plugins/specweave/templates/iac/aws-lambda/templates/environments/dev.tfvars.hbs +34 -0
  135. package/plugins/specweave/templates/iac/aws-lambda/templates/environments/prod.tfvars.hbs +37 -0
  136. package/plugins/specweave/templates/iac/aws-lambda/templates/environments/staging.tfvars.hbs +35 -0
  137. package/plugins/specweave/templates/iac/aws-lambda/templates/outputs.tf.hbs +77 -0
  138. package/plugins/specweave/templates/iac/aws-lambda/templates/providers.tf.hbs +36 -0
  139. package/plugins/specweave/templates/iac/aws-lambda/templates/variables.tf.hbs +115 -0
  140. package/plugins/specweave/templates/iac/azure-functions/defaults.json +25 -0
  141. package/plugins/specweave/templates/iac/azure-functions/templates/README.md.hbs +268 -0
  142. package/plugins/specweave/templates/iac/azure-functions/templates/environments/dev.tfvars.hbs +34 -0
  143. package/plugins/specweave/templates/iac/azure-functions/templates/environments/prod.tfvars.hbs +46 -0
  144. package/plugins/specweave/templates/iac/azure-functions/templates/environments/staging.tfvars.hbs +34 -0
  145. package/plugins/specweave/templates/iac/azure-functions/templates/main.tf.hbs +225 -0
  146. package/plugins/specweave/templates/iac/azure-functions/templates/outputs.tf.hbs +89 -0
  147. package/plugins/specweave/templates/iac/azure-functions/templates/provider.tf.hbs +27 -0
  148. package/plugins/specweave/templates/iac/azure-functions/templates/providers.tf.hbs +35 -0
  149. package/plugins/specweave/templates/iac/azure-functions/templates/variables.tf.hbs +124 -0
  150. package/plugins/specweave/templates/iac/firebase/defaults.json +29 -0
  151. package/plugins/specweave/templates/iac/firebase/templates/README.md.hbs +35 -0
  152. package/plugins/specweave/templates/iac/firebase/templates/environments/dev.tfvars.hbs +7 -0
  153. package/plugins/specweave/templates/iac/firebase/templates/environments/prod.tfvars.hbs +7 -0
  154. package/plugins/specweave/templates/iac/firebase/templates/environments/staging.tfvars.hbs +7 -0
  155. package/plugins/specweave/templates/iac/firebase/templates/main.tf.hbs +90 -0
  156. package/plugins/specweave/templates/iac/firebase/templates/outputs.tf.hbs +15 -0
  157. package/plugins/specweave/templates/iac/firebase/templates/providers.tf.hbs +23 -0
  158. package/plugins/specweave/templates/iac/firebase/templates/variables.tf.hbs +42 -0
  159. package/plugins/specweave/templates/iac/gcp-cloud-functions/defaults.json +26 -0
  160. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/README.md.hbs +299 -0
  161. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/dev.tfvars.hbs +36 -0
  162. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/prod.tfvars.hbs +48 -0
  163. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/environments/staging.tfvars.hbs +41 -0
  164. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/main.tf.hbs +192 -0
  165. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/outputs.tf.hbs +66 -0
  166. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/providers.tf.hbs +25 -0
  167. package/plugins/specweave/templates/iac/gcp-cloud-functions/templates/variables.tf.hbs +119 -0
  168. package/plugins/specweave/templates/iac/supabase/defaults.json +15 -0
  169. package/plugins/specweave/templates/iac/supabase/templates/README.md.hbs +46 -0
  170. package/plugins/specweave/templates/iac/supabase/templates/main.tf.hbs +50 -0
  171. package/plugins/specweave-github/agents/github-manager/AGENT.md +39 -7
  172. package/plugins/specweave-github/commands/specweave-github-create-issue.md +5 -5
  173. package/plugins/specweave-github/lib/CodeValidator.ts +1 -1
  174. package/plugins/specweave-github/lib/github-client-v2.js +29 -0
  175. package/plugins/specweave-github/lib/github-client-v2.ts +30 -0
  176. package/plugins/specweave-github/lib/task-sync.js +4 -0
  177. package/plugins/specweave-github/lib/task-sync.ts +7 -0
  178. package/plugins/specweave-jira/lib/enhanced-jira-sync.js +3 -3
  179. package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +2022 -0
  180. package/src/templates/CLAUDE.md.template +31 -0
  181. package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts +0 -116
  182. package/dist/src/core/living-docs/ThreeLayerSyncManager.d.ts.map +0 -1
  183. package/dist/src/core/living-docs/ThreeLayerSyncManager.js +0 -356
  184. package/dist/src/core/living-docs/ThreeLayerSyncManager.js.map +0 -1
@@ -0,0 +1,27 @@
1
+ # Terraform and Azure Provider Configuration
2
+ # Generated by SpecWeave Serverless Architecture Intelligence
3
+
4
+ terraform {
5
+ required_version = ">= 1.5.0"
6
+
7
+ required_providers {
8
+ azurerm = {
9
+ source = "hashicorp/azurerm"
10
+ version = "~> 3.0"
11
+ }
12
+ }
13
+ }
14
+
15
+ provider "azurerm" {
16
+ features {
17
+ resource_group {
18
+ prevent_deletion_if_contains_resources = false
19
+ }
20
+
21
+ key_vault {
22
+ purge_soft_delete_on_destroy = true
23
+ }
24
+ }
25
+
26
+ skip_provider_registration = false
27
+ }
@@ -0,0 +1,35 @@
1
+ # Terraform Provider Configuration for Azure
2
+ # Generated by SpecWeave Serverless Architecture Intelligence
3
+
4
+ terraform {
5
+ required_version = ">= 1.5.0"
6
+
7
+ required_providers {
8
+ azurerm = {
9
+ source = "hashicorp/azurerm"
10
+ version = "~> 3.0"
11
+ }
12
+ }
13
+
14
+ {{#if enableRemoteState}}
15
+ backend "azurerm" {
16
+ resource_group_name = "{{tfStateResourceGroup}}"
17
+ storage_account_name = "{{tfStateStorageAccount}}"
18
+ container_name = "tfstate"
19
+ key = "{{projectName}}-{{environment}}.tfstate"
20
+ }
21
+ {{/if}}
22
+ }
23
+
24
+ provider "azurerm" {
25
+ features {
26
+ key_vault {
27
+ purge_soft_delete_on_destroy = true
28
+ recover_soft_deleted_key_vaults = true
29
+ }
30
+
31
+ resource_group {
32
+ prevent_deletion_if_contains_resources = false
33
+ }
34
+ }
35
+ }
@@ -0,0 +1,124 @@
1
+ # Input Variables for Azure Functions + Cosmos DB
2
+ # Generated by SpecWeave Serverless Architecture Intelligence
3
+
4
+ variable "location" {
5
+ description = "Azure region for all resources"
6
+ type = string
7
+ default = "{{location}}"
8
+ }
9
+
10
+ variable "resource_group_name" {
11
+ description = "Resource group name"
12
+ type = string
13
+ default = "{{resourceGroupName}}"
14
+ }
15
+
16
+ variable "app_name" {
17
+ description = "Function App name"
18
+ type = string
19
+ default = "{{appName}}"
20
+ }
21
+
22
+ variable "runtime" {
23
+ description = "Function runtime (node, python, dotnet)"
24
+ type = string
25
+ default = "{{runtime}}"
26
+ }
27
+
28
+ variable "runtime_version" {
29
+ description = "Runtime version (20 for Node.js 20, 3.11 for Python 3.11, etc.)"
30
+ type = string
31
+ default = "{{runtimeVersion}}"
32
+ }
33
+
34
+ variable "os_type" {
35
+ description = "OS type (Linux or Windows)"
36
+ type = string
37
+ default = "{{osType}}"
38
+ }
39
+
40
+ variable "sku_name" {
41
+ description = "App Service Plan SKU (Y1 for Consumption, EP1/EP2/EP3 for Premium)"
42
+ type = string
43
+ default = "{{skuName}}"
44
+ }
45
+
46
+ variable "environment" {
47
+ description = "Environment name (dev, staging, prod)"
48
+ type = string
49
+ default = "{{environment}}"
50
+ }
51
+
52
+ variable "database_account_name" {
53
+ description = "Cosmos DB account name"
54
+ type = string
55
+ default = "{{databaseAccountName}}"
56
+ }
57
+
58
+ variable "database_name" {
59
+ description = "Cosmos DB database name"
60
+ type = string
61
+ default = "{{databaseName}}"
62
+ }
63
+
64
+ variable "container_name" {
65
+ description = "Cosmos DB container name"
66
+ type = string
67
+ default = "{{containerName}}"
68
+ }
69
+
70
+ variable "partition_key" {
71
+ description = "Cosmos DB partition key"
72
+ type = string
73
+ default = "{{partitionKey}}"
74
+ }
75
+
76
+ variable "throughput" {
77
+ description = "Cosmos DB throughput (RU/s, minimum 400)"
78
+ type = number
79
+ default = {{throughput}}
80
+ }
81
+
82
+ variable "cors_origins" {
83
+ description = "List of allowed CORS origins for Function App"
84
+ type = list(string)
85
+ default = {{tfList corsOrigins}}
86
+ }
87
+
88
+ variable "project_name" {
89
+ description = "Project name for resource tagging"
90
+ type = string
91
+ default = "{{projectName}}"
92
+ }
93
+
94
+ variable "storage_account_tier" {
95
+ description = "Storage account tier (Standard or Premium)"
96
+ type = string
97
+ default = "{{storageAccountTier}}"
98
+ }
99
+
100
+ variable "storage_account_replication" {
101
+ description = "Storage account replication type (LRS, GRS, RAGRS, ZRS)"
102
+ type = string
103
+ default = "{{storageAccountReplication}}"
104
+ }
105
+
106
+ {{#if enableMultiRegion}}
107
+ variable "secondary_regions" {
108
+ description = "List of secondary regions for multi-region deployment"
109
+ type = list(string)
110
+ default = {{tfList secondaryRegions}}
111
+ }
112
+ {{/if}}
113
+
114
+ {{#if enableVnet}}
115
+ variable "vnet_id" {
116
+ description = "Virtual Network ID for Function App integration"
117
+ type = string
118
+ }
119
+
120
+ variable "subnet_id" {
121
+ description = "Subnet ID for Function App integration"
122
+ type = string
123
+ }
124
+ {{/if}}
@@ -0,0 +1,29 @@
1
+ {
2
+ "projectId": "my-firebase-project",
3
+ "region": "us-central1",
4
+ "appDisplayName": "My Firebase App",
5
+ "siteId": "my-firebase-site",
6
+ "functionName": "myFirebaseFunction",
7
+ "runtime": "nodejs20",
8
+ "entryPoint": "handler",
9
+ "memoryMb": 256,
10
+ "timeoutSeconds": 60,
11
+ "environment": "dev",
12
+ "databaseId": "(default)",
13
+ "collectionId": "my-collection",
14
+ "storageBucket": "my-firebase-storage",
15
+ "projectName": "my-project",
16
+ "enableAuth": false,
17
+ "enableStorage": false,
18
+ "enableAnalytics": false,
19
+ "enableCrashlytics": false,
20
+ "hostingIndexPage": "index.html",
21
+ "hosting404Page": "404.html",
22
+ "hostingHeaders": [],
23
+ "hostingRewrites": [
24
+ {
25
+ "source": "**",
26
+ "function": "myFirebaseFunction"
27
+ }
28
+ ]
29
+ }
@@ -0,0 +1,35 @@
1
+ # Firebase (Hosting + Functions + Firestore) Terraform Configuration
2
+
3
+ **Generated by SpecWeave Serverless Architecture Intelligence**
4
+
5
+ Deploys complete Firebase backend:
6
+ - Firebase Web App
7
+ - Firebase Hosting (static site)
8
+ - Cloud Functions for Firebase
9
+ - Firestore database
10
+
11
+ ## Prerequisites
12
+
13
+ 1. Install Firebase CLI: `npm install -g firebase-tools`
14
+ 2. Authenticate: `firebase login`
15
+ 3. Create Firebase project: `firebase projects:create {{projectId}}`
16
+
17
+ ## Deployment
18
+
19
+ ```bash
20
+ terraform init
21
+ terraform apply -var-file="environments/dev.tfvars"
22
+ ```
23
+
24
+ ## Cost: $0/month (Free Spark Plan)
25
+
26
+ Firebase free tier includes:
27
+ - 10 GB hosting storage
28
+ - 360 MB/day hosting transfer
29
+ - Cloud Functions: 2M invocations/month
30
+ - Firestore: 1 GB storage, 50K reads/day
31
+
32
+ ## Support
33
+
34
+ - Firebase Docs: https://firebase.google.com/docs
35
+ - SpecWeave: https://spec-weave.com
@@ -0,0 +1,7 @@
1
+ project_id = "{{projectId}}"
2
+ region = "us-central1"
3
+ app_display_name = "{{projectName}} Dev"
4
+ site_id = "{{projectName}}-dev"
5
+ function_name = "{{projectName}}-dev-function"
6
+ runtime = "nodejs20"
7
+ environment = "dev"
@@ -0,0 +1,7 @@
1
+ project_id = "{{projectId}}"
2
+ region = "us-central1"
3
+ app_display_name = "{{projectName}}"
4
+ site_id = "{{projectName}}"
5
+ function_name = "{{projectName}}-function"
6
+ runtime = "nodejs20"
7
+ environment = "prod"
@@ -0,0 +1,7 @@
1
+ project_id = "{{projectId}}"
2
+ region = "us-central1"
3
+ app_display_name = "{{projectName}} Staging"
4
+ site_id = "{{projectName}}-staging"
5
+ function_name = "{{projectName}}-staging-function"
6
+ runtime = "nodejs20"
7
+ environment = "staging"
@@ -0,0 +1,90 @@
1
+ # Firebase (Hosting + Functions + Firestore) Terraform Configuration
2
+ # Generated by SpecWeave Serverless Architecture Intelligence
3
+
4
+ # Enable Firebase for existing GCP project
5
+ resource "google_firebase_project" "default" {
6
+ provider = google-beta
7
+ project = "{{projectId}}"
8
+ }
9
+
10
+ # Enable required APIs
11
+ resource "google_project_service" "firebasehosting" {
12
+ project = "{{projectId}}"
13
+ service = "firebasehosting.googleapis.com"
14
+ disable_on_destroy = false
15
+ }
16
+
17
+ resource "google_project_service" "firebase" {
18
+ project = "{{projectId}}"
19
+ service = "firebase.googleapis.com"
20
+ disable_on_destroy = false
21
+ }
22
+
23
+ # Firebase Web App
24
+ resource "google_firebase_web_app" "{{snakeCase appDisplayName}}" {
25
+ provider = google-beta
26
+ project = "{{projectId}}"
27
+ display_name = "{{appDisplayName}}"
28
+
29
+ depends_on = [google_firebase_project.default]
30
+ }
31
+
32
+ # Firebase Hosting Site
33
+ resource "google_firebase_hosting_site" "{{snakeCase siteId}}" {
34
+ provider = google-beta
35
+ project = "{{projectId}}"
36
+ site_id = "{{siteId}}"
37
+
38
+ depends_on = [google_firebase_project.default]
39
+ }
40
+
41
+ # Firestore Database (same as GCP)
42
+ resource "google_firestore_database" "{{snakeCase databaseId}}" {
43
+ project = "{{projectId}}"
44
+ name = "{{databaseId}}"
45
+ location_id = "{{region}}"
46
+ type = "FIRESTORE_NATIVE"
47
+
48
+ depends_on = [google_firebase_project.default]
49
+ }
50
+
51
+ # Cloud Functions for Firebase (similar to GCP Cloud Functions)
52
+ resource "google_cloudfunctions2_function" "{{snakeCase functionName}}" {
53
+ name = "{{functionName}}"
54
+ location = "{{region}}"
55
+ project = "{{projectId}}"
56
+
57
+ build_config {
58
+ runtime = "{{runtime}}"
59
+ entry_point = "{{entryPoint}}"
60
+ source {
61
+ storage_source {
62
+ bucket = "{{projectId}}.appspot.com"
63
+ object = "function-source.zip"
64
+ }
65
+ }
66
+ }
67
+
68
+ service_config {
69
+ max_instance_count = 10
70
+ available_memory = "{{memoryMb}}M"
71
+ timeout_seconds = {{timeoutSeconds}}
72
+ environment_variables = {
73
+ FIREBASE_CONFIG = google_firebase_web_app.{{snakeCase appDisplayName}}.app_id
74
+ ENVIRONMENT = "{{environment}}"
75
+ }
76
+ }
77
+
78
+ depends_on = [google_firebase_project.default]
79
+ }
80
+
81
+ {{#if enableStorage}}
82
+ # Firebase Storage Bucket
83
+ resource "google_firebase_storage_bucket" "{{snakeCase storageBucket}}" {
84
+ provider = google-beta
85
+ project = "{{projectId}}"
86
+ bucket_id = "{{storageBucket}}"
87
+
88
+ depends_on = [google_firebase_project.default]
89
+ }
90
+ {{/if}}
@@ -0,0 +1,15 @@
1
+ # Firebase Outputs
2
+ output "web_app_id" {
3
+ description = "Firebase Web App ID"
4
+ value = google_firebase_web_app.{{snakeCase appDisplayName}}.app_id
5
+ }
6
+
7
+ output "hosting_site_url" {
8
+ description = "Firebase Hosting URL"
9
+ value = "https://${google_firebase_hosting_site.{{snakeCase siteId}}.default_url}"
10
+ }
11
+
12
+ output "function_url" {
13
+ description = "Cloud Function URL"
14
+ value = google_cloudfunctions2_function.{{snakeCase functionName}}.service_config[0].uri
15
+ }
@@ -0,0 +1,23 @@
1
+ terraform {
2
+ required_version = ">= 1.5.0"
3
+ required_providers {
4
+ google = {
5
+ source = "hashicorp/google"
6
+ version = "~> 5.0"
7
+ }
8
+ google-beta = {
9
+ source = "hashicorp/google-beta"
10
+ version = "~> 5.0"
11
+ }
12
+ }
13
+ }
14
+
15
+ provider "google" {
16
+ project = "{{projectId}}"
17
+ region = "{{region}}"
18
+ }
19
+
20
+ provider "google-beta" {
21
+ project = "{{projectId}}"
22
+ region = "{{region}}"
23
+ }
@@ -0,0 +1,42 @@
1
+ # Input Variables for Firebase
2
+ variable "project_id" {
3
+ description = "GCP/Firebase Project ID"
4
+ type = string
5
+ default = "{{projectId}}"
6
+ }
7
+
8
+ variable "region" {
9
+ description = "Firebase/GCP region"
10
+ type = string
11
+ default = "{{region}}"
12
+ }
13
+
14
+ variable "app_display_name" {
15
+ description = "Firebase Web App display name"
16
+ type = string
17
+ default = "{{appDisplayName}}"
18
+ }
19
+
20
+ variable "site_id" {
21
+ description = "Firebase Hosting site ID"
22
+ type = string
23
+ default = "{{siteId}}"
24
+ }
25
+
26
+ variable "function_name" {
27
+ description = "Cloud Function name"
28
+ type = string
29
+ default = "{{functionName}}"
30
+ }
31
+
32
+ variable "runtime" {
33
+ description = "Function runtime"
34
+ type = string
35
+ default = "{{runtime}}"
36
+ }
37
+
38
+ variable "environment" {
39
+ description = "Environment (dev/staging/prod)"
40
+ type = string
41
+ default = "{{environment}}"
42
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "projectId": "my-gcp-project",
3
+ "region": "us-central1",
4
+ "functionName": "my-cloud-function",
5
+ "runtime": "nodejs20",
6
+ "entryPoint": "handler",
7
+ "memoryMb": 256,
8
+ "timeoutSeconds": 60,
9
+ "minInstances": 0,
10
+ "maxInstances": 100,
11
+ "environment": "dev",
12
+ "databaseId": "(default)",
13
+ "collectionId": "my-collection",
14
+ "serviceAccountId": "my-function-sa",
15
+ "corsOrigins": ["*"],
16
+ "projectName": "my-project",
17
+ "enableSecretManager": false,
18
+ "enableVpc": false,
19
+ "enableCloudArmor": false,
20
+ "enableConcurrency": false,
21
+ "maxConcurrentRequests": 80,
22
+ "enableCloudLogging": true,
23
+ "enableCloudMonitoring": true,
24
+ "bucketName": "my-function-source",
25
+ "bucketLocation": "US"
26
+ }