@mycompbox/compbox-mcp 1.21.7 → 1.21.9

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 (2) hide show
  1. package/index.js +518 -39
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -212,6 +212,15 @@ var init_deployment = __esm({
212
212
  }
213
213
  });
214
214
 
215
+ // ../shared/dist/types/database.js
216
+ var CLOUD_SQL_MONTHLY_ESTIMATE_USD;
217
+ var init_database = __esm({
218
+ "../shared/dist/types/database.js"() {
219
+ "use strict";
220
+ CLOUD_SQL_MONTHLY_ESTIMATE_USD = 10;
221
+ }
222
+ });
223
+
215
224
  // ../shared/dist/types/index.js
216
225
  var init_types = __esm({
217
226
  "../shared/dist/types/index.js"() {
@@ -228,6 +237,7 @@ var init_types = __esm({
228
237
  init_cloud();
229
238
  init_stack();
230
239
  init_deployment();
240
+ init_database();
231
241
  }
232
242
  });
233
243
 
@@ -548,6 +558,12 @@ var init_pxpipe = __esm({
548
558
  });
549
559
 
550
560
  // ../shared/dist/interview-definition.js
561
+ function normalizeDatabaseChoice(raw) {
562
+ if (typeof raw !== "string")
563
+ return void 0;
564
+ const candidate = raw.trim().toLowerCase().replace(/[\s-]+/g, "_");
565
+ return DATABASE_CHOICE_VALUES.includes(candidate) ? candidate : void 0;
566
+ }
551
567
  function interviewSectionKeys() {
552
568
  return INTERVIEW_DEFINITION.map((s) => s.key);
553
569
  }
@@ -568,7 +584,7 @@ function buildInterviewSystemPrompt(definition = INTERVIEW_DEFINITION, seedConte
568
584
  const requiredSections = definition.filter((s) => s.required);
569
585
  const optionalSections = definition.filter((s) => !s.required);
570
586
  const renderSection2 = (s) => {
571
- const tag = s.required ? "REQUIRED" : "OPTIONAL \u2014 ask, but the user may decline";
587
+ const tag = s.required ? "REQUIRED" : s.askOnlyWhen ? `OPTIONAL \u2014 ask ONLY if ${s.askOnlyWhen}` : "OPTIONAL \u2014 ask, but the user may decline";
572
588
  const followUps = s.followUps.map((q) => ` - ${q}`).join("\n");
573
589
  return `- ${s.title} (${tag}) [json keys: ${s.fields.join(", ")}]
574
590
  ${s.purpose}
@@ -582,7 +598,7 @@ ${followUps}`;
582
598
  const completionShape = completionKeys.map((k) => `"${k}": "..."`).join(", ");
583
599
  const base = `You are the CompBox request-formulator, interviewing an employee to turn their idea into a well-formed Epic Request. Ask exactly ONE short, focused question at a time \u2014 never multiple questions in one message, never preamble or explanation.
584
600
 
585
- Work through these interview sections in order. Cover EVERY required section; for optional sections, ask about them too, but if the employee has nothing to add or declines, move on and leave that field out (never invent or pad it):
601
+ Work through these interview sections in order. Cover EVERY required section; for optional sections, ask about them too, but if the employee has nothing to add or declines, move on and leave that field out (never invent or pad it). A section marked "ask ONLY if" is conditional: when its condition does not hold, skip it without asking and leave its fields out:
586
602
 
587
603
  REQUIRED sections (an Epic Request cannot omit these):
588
604
  ${requiredSections.map(renderSection2).join("\n")}
@@ -637,10 +653,11 @@ function interviewFieldKeysFor(definition) {
637
653
  }
638
654
  return out;
639
655
  }
640
- var INTERVIEW_DEFINITION, INTERVIEW_FIELD_MIN_WORDS;
656
+ var DATABASE_CHOICE_VALUES, INTERVIEW_DEFINITION, INTERVIEW_FIELD_MIN_WORDS;
641
657
  var init_interview_definition = __esm({
642
658
  "../shared/dist/interview-definition.js"() {
643
659
  "use strict";
660
+ DATABASE_CHOICE_VALUES = ["free_hosted", "cloud_paid", "existing", "none"];
644
661
  INTERVIEW_DEFINITION = [
645
662
  {
646
663
  key: "problemStatement",
@@ -727,6 +744,17 @@ var init_interview_definition = __esm({
727
744
  "Why were those alternatives not chosen?"
728
745
  ],
729
746
  fields: ["alternatives"]
747
+ },
748
+ {
749
+ key: "database",
750
+ title: "Database",
751
+ purpose: "Record what kind of database the work should use, as databaseChoice set to exactly one of: free_hosted, cloud_paid, existing, none. Put any extra detail the employee gives in databaseNote. Never ask for, suggest, or record credentials, connection strings, or a specific vendor.",
752
+ required: false,
753
+ followUps: [
754
+ "Will this need a database: a free hosted one, a paid cloud one, an existing one your team already has, or none?"
755
+ ],
756
+ fields: ["databaseChoice", "databaseNote"],
757
+ askOnlyWhen: "the idea involves storing or persisting data. Ask this at most once, and skip it entirely for ideas that store nothing"
730
758
  }
731
759
  ];
732
760
  INTERVIEW_FIELD_MIN_WORDS = {
@@ -826,6 +854,9 @@ function toDraft(parsed) {
826
854
  draft[key] = raw;
827
855
  }
828
856
  }
857
+ const databaseChoice = normalizeDatabaseChoice(parsed.databaseChoice);
858
+ if (databaseChoice)
859
+ draft.databaseChoice = databaseChoice;
829
860
  return draft;
830
861
  }
831
862
  function extractCompletionJson(text) {
@@ -856,13 +887,15 @@ var TARGET_COMPLIANCE_TIER, OPTIONAL_DRAFT_KEYS, COMPLETION_REPAIR_INSTRUCTION;
856
887
  var init_interview_completion = __esm({
857
888
  "../shared/dist/interview-completion.js"() {
858
889
  "use strict";
890
+ init_interview_definition();
859
891
  TARGET_COMPLIANCE_TIER = "pass";
860
892
  OPTIONAL_DRAFT_KEYS = [
861
893
  "successMetrics",
862
894
  "targetAudience",
863
895
  "alternatives",
864
896
  "dependencies",
865
- "estimatedEffort"
897
+ "estimatedEffort",
898
+ "databaseNote"
866
899
  ];
867
900
  COMPLETION_REPAIR_INSTRUCTION = 'Your last message looked like a completion but I could NOT parse it as a valid JSON object with all required fields. Re-emit ONLY a single valid JSON object inside a ```json code fence \u2014 no other text \u2014 with every string value properly escaped (escape any internal double-quotes as \\" and any line breaks as \\n), and make sure title, problemStatement, proposedSolution, impactAssessment, and description are all present and non-empty:\n```json\n{"done": true, "title": "...", "problemStatement": "...", "proposedSolution": "...", "impactAssessment": "...", "description": "..."}\n```';
868
901
  }
@@ -1153,8 +1186,7 @@ REGION=${input.region}
1153
1186
  SA=${gcpServiceAccountEmail(input.projectId)}
1154
1187
 
1155
1188
  gcloud config set project "$PROJECT"
1156
- gcloud services enable run.googleapis.com artifactregistry.googleapis.com iam.googleapis.com \\
1157
- iamcredentials.googleapis.com sts.googleapis.com cloudresourcemanager.googleapis.com
1189
+ gcloud services enable ${GCP_SERVICES.join(" ")}
1158
1190
  NUMBER=$(gcloud projects describe "$PROJECT" --format='value(projectNumber)')
1159
1191
 
1160
1192
  # The account deploys run as.
@@ -1163,6 +1195,16 @@ gcloud iam service-accounts describe "$SA" >/dev/null 2>&1 || \\
1163
1195
  for ROLE in ${GCP_DEPLOY_ROLES.join(" ")}; do
1164
1196
  gcloud projects add-iam-policy-binding "$PROJECT" --member="serviceAccount:$SA" --role="$ROLE" --condition=None --quiet >/dev/null
1165
1197
  done
1198
+ # Lets deploys grant Cloud SQL Client to an environment's runtime account, and nothing else.
1199
+ CONDITION=$(mktemp)
1200
+ cat > "$CONDITION" <<'EOF'
1201
+ title: ${GCP_DEPLOY_CONDITIONAL_ROLE.condition.title}
1202
+ description: ${GCP_DEPLOY_CONDITIONAL_ROLE.condition.description}
1203
+ expression: "${GCP_DEPLOY_CONDITIONAL_ROLE.condition.expression}"
1204
+ EOF
1205
+ gcloud projects add-iam-policy-binding "$PROJECT" --member="serviceAccount:$SA" \\
1206
+ --role="${GCP_DEPLOY_CONDITIONAL_ROLE.role}" --condition-from-file="$CONDITION" --quiet >/dev/null
1207
+ rm -f "$CONDITION"
1166
1208
 
1167
1209
  # Trust GitHub Actions from your GitHub only: ${owners.join(", ")}.
1168
1210
  gcloud iam workload-identity-pools describe ${GCP_IDENTITY_POOL} --location=global >/dev/null 2>&1 || \\
@@ -1186,7 +1228,7 @@ echo "Done. Your project number is: $NUMBER"
1186
1228
  echo "Paste it into CompBox to finish."
1187
1229
  `;
1188
1230
  }
1189
- var GCP_REGIONS, GCP_DEPLOY_ACCOUNT, GCP_IDENTITY_POOL, GCP_IDENTITY_PROVIDER, GCP_DEPLOY_ROLES, PROJECT_ID, PROJECT_NUMBER, GITHUB_LOGIN, GCP_CONNECT_STEPS, GCP_CONNECT_STEP_LABELS;
1231
+ var GCP_REGIONS, GCP_DEPLOY_ACCOUNT, GCP_IDENTITY_POOL, GCP_IDENTITY_PROVIDER, GCP_DEPLOY_ROLES, GCP_SERVICES, GCP_DEPLOY_CONDITIONAL_ROLE, PROJECT_ID, PROJECT_NUMBER, GITHUB_LOGIN, GCP_CONNECT_STEPS, GCP_CONNECT_STEP_LABELS;
1190
1232
  var init_cloud_setup = __esm({
1191
1233
  "../shared/dist/cloud-setup.js"() {
1192
1234
  "use strict";
@@ -1215,8 +1257,31 @@ var init_cloud_setup = __esm({
1215
1257
  "roles/iam.serviceAccountUser",
1216
1258
  "roles/iam.serviceAccountAdmin",
1217
1259
  "roles/storage.admin",
1218
- "roles/serviceusage.serviceUsageConsumer"
1260
+ "roles/serviceusage.serviceUsageConsumer",
1261
+ // Keeps each environment's DATABASE_URL in Secret Manager and lets its runtime account read it.
1262
+ "roles/secretmanager.admin",
1263
+ // Creates each environment's Cloud SQL database (ENG-316) and connects the migrate job to it.
1264
+ "roles/cloudsql.admin"
1219
1265
  ];
1266
+ GCP_SERVICES = [
1267
+ "run.googleapis.com",
1268
+ "artifactregistry.googleapis.com",
1269
+ "iam.googleapis.com",
1270
+ "iamcredentials.googleapis.com",
1271
+ "sts.googleapis.com",
1272
+ "cloudresourcemanager.googleapis.com",
1273
+ "storage.googleapis.com",
1274
+ "secretmanager.googleapis.com",
1275
+ "sqladmin.googleapis.com"
1276
+ ];
1277
+ GCP_DEPLOY_CONDITIONAL_ROLE = {
1278
+ role: "roles/resourcemanager.projectIamAdmin",
1279
+ condition: {
1280
+ title: "compbox-cloudsql-client-only",
1281
+ description: "CompBox deploys may only grant Cloud SQL Client.",
1282
+ expression: "api.getAttribute('iam.googleapis.com/modifiedGrantsByRole', []).hasOnly(['roles/cloudsql.client'])"
1283
+ }
1284
+ };
1220
1285
  PROJECT_ID = /^[a-z][a-z0-9-]{4,28}[a-z0-9]$/;
1221
1286
  PROJECT_NUMBER = /^\d{6,20}$/;
1222
1287
  GITHUB_LOGIN = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,37}[A-Za-z0-9])?$/;
@@ -1646,6 +1711,12 @@ function stackEnvironments(tier) {
1646
1711
  function deployRunTitle(environment) {
1647
1712
  return `Deploy to ${environment}`;
1648
1713
  }
1714
+ function teardownRunTitle(environment) {
1715
+ return `Tear down ${environment}`;
1716
+ }
1717
+ function teardownConfirmation(app, environment) {
1718
+ return `${app}-${environment}`;
1719
+ }
1649
1720
  function cloudRunUrl(service, projectNumber, region) {
1650
1721
  return `https://${service}-${projectNumber}.${region}.run.app`;
1651
1722
  }
@@ -1655,11 +1726,21 @@ function stackAppName(repoName) {
1655
1726
  slug = `app${slug}`.slice(0, 20);
1656
1727
  return slug;
1657
1728
  }
1658
- function envSettings(env) {
1659
- return env === "prod" ? { min: 0, max: 10 } : { min: 0, max: 2 };
1729
+ function cloudSqlInstanceName(app, environment) {
1730
+ return `${app}-${environment}-db`;
1731
+ }
1732
+ function databaseSecretName(app, environment, database) {
1733
+ return `${app}-${environment}-${database === "cloudsql" ? "cloudsql-url" : "database-url"}`;
1734
+ }
1735
+ function stackEnvSettings(tier) {
1736
+ return stackEnvironments(tier).map((environment) => environment === "prod" ? { environment, minInstances: 0, maxInstances: 10 } : { environment, minInstances: 0, maxInstances: 2 });
1660
1737
  }
1661
1738
  function buildStackFiles(input) {
1662
1739
  const { tier, app, defaultBranch, cloud } = input;
1740
+ const cloudSql = input.database === "cloudsql";
1741
+ if (input.database != null && !cloudSql)
1742
+ throw new Error("Not a supported database.");
1743
+ const secretSuffix = cloudSql ? "cloudsql-url" : "database-url";
1663
1744
  if (!APP.test(app))
1664
1745
  throw new Error("Not a valid app name.");
1665
1746
  if (!BRANCH.test(defaultBranch))
@@ -1667,6 +1748,16 @@ function buildStackFiles(input) {
1667
1748
  const envs = stackEnvironments(tier);
1668
1749
  const registry = `${cloud.region}-docker.pkg.dev/${cloud.projectId}/${app}`;
1669
1750
  const files = [];
1751
+ const stateBucket = gcpStateBucket(cloud.projectId);
1752
+ const cloudSetupSteps = ` - uses: google-github-actions/auth@v2
1753
+ with:
1754
+ workload_identity_provider: ${cloud.workloadProvider}
1755
+ service_account: ${cloud.serviceAccountEmail}
1756
+
1757
+ - uses: google-github-actions/setup-gcloud@v2
1758
+
1759
+ - uses: hashicorp/setup-terraform@v3`;
1760
+ const terraformInit = `terraform init -input=false -backend-config="bucket=$STATE_BUCKET" -backend-config="prefix=$APP/$ENVIRONMENT"`;
1670
1761
  files.push({
1671
1762
  path: "infra/versions.tf",
1672
1763
  content: `# Managed by CompBox. Changes here are applied on the next deploy.
@@ -1676,7 +1767,11 @@ terraform {
1676
1767
  google = {
1677
1768
  source = "hashicorp/google"
1678
1769
  version = "~> 6.0"
1679
- }
1770
+ }${cloudSql ? `
1771
+ random = {
1772
+ source = "hashicorp/random"
1773
+ version = "~> 3.6"
1774
+ }` : ""}
1680
1775
  }
1681
1776
  # Bucket and prefix are passed by the deploy workflow.
1682
1777
  backend "gcs" {}
@@ -1760,10 +1855,20 @@ resource "google_cloud_run_v2_service" "app" {
1760
1855
  }
1761
1856
  }
1762
1857
 
1763
- # Deploys change the image; Terraform owns everything else.
1858
+ ${cloudSql ? ` # Deploys set the image, DATABASE_URL and the Cloud SQL connection; Terraform owns everything else.
1859
+ lifecycle {
1860
+ ignore_changes = [
1861
+ template[0].containers[0].image,
1862
+ template[0].containers[0].env,
1863
+ template[0].containers[0].volume_mounts,
1864
+ template[0].volumes,
1865
+ client,
1866
+ client_version,
1867
+ ]
1868
+ }` : ` # Deploys change the image; Terraform owns everything else.
1764
1869
  lifecycle {
1765
1870
  ignore_changes = [template[0].containers[0].image, client, client_version]
1766
- }
1871
+ }`}
1767
1872
  }
1768
1873
 
1769
1874
  # Anyone with the link can open it. Remove this to keep the app private.
@@ -1779,16 +1884,96 @@ output "url" {
1779
1884
  }
1780
1885
  `
1781
1886
  });
1782
- for (const env of envs) {
1783
- const s = envSettings(env);
1887
+ if (cloudSql) {
1888
+ files.push({
1889
+ path: "infra/database.tf",
1890
+ content: `# Managed by CompBox: a Cloud SQL for PostgreSQL database for this environment.
1891
+ # Estimated cost: a db-f1-micro instance with 10 GB of SSD, per environment.
1892
+ # The password is generated here and kept only in Terraform state and Secret Manager.
1893
+ resource "google_sql_database_instance" "db" {
1894
+ name = "\${local.service}-db"
1895
+ database_version = "POSTGRES_16"
1896
+ region = var.region
1897
+ # Terraform refuses to delete it; turn this off first if you really mean to.
1898
+ deletion_protection = true
1899
+
1900
+ settings {
1901
+ edition = "ENTERPRISE"
1902
+ tier = "db-f1-micro"
1903
+ availability_type = "ZONAL"
1904
+ disk_type = "PD_SSD"
1905
+ disk_size = 10
1906
+ deletion_protection_enabled = true
1907
+
1908
+ backup_configuration {
1909
+ enabled = true
1910
+ }
1911
+
1912
+ # A public IP with no authorized networks: only IAM-authorized connectors
1913
+ # (Cloud Run's Cloud SQL connection, the Cloud SQL Auth Proxy) can reach it.
1914
+ ip_configuration {
1915
+ ipv4_enabled = true
1916
+ }
1917
+ }
1918
+ }
1919
+
1920
+ resource "google_sql_database" "app" {
1921
+ name = var.app
1922
+ instance = google_sql_database_instance.db.name
1923
+ }
1924
+
1925
+ resource "random_password" "db" {
1926
+ length = 32
1927
+ special = false
1928
+ }
1929
+
1930
+ resource "google_sql_user" "app" {
1931
+ name = var.app
1932
+ instance = google_sql_database_instance.db.name
1933
+ password = random_password.db.result
1934
+ }
1935
+
1936
+ # Cloud Run (and the migrate job's proxy) reach the database over a Unix socket in /cloudsql.
1937
+ resource "google_secret_manager_secret" "database_url" {
1938
+ secret_id = "\${local.service}-${secretSuffix}"
1939
+ replication {
1940
+ auto {}
1941
+ }
1942
+ }
1943
+
1944
+ resource "google_secret_manager_secret_version" "database_url" {
1945
+ secret = google_secret_manager_secret.database_url.id
1946
+ secret_data = "postgresql://\${google_sql_user.app.name}:\${random_password.db.result}@localhost/\${google_sql_database.app.name}?host=/cloudsql/\${google_sql_database_instance.db.connection_name}"
1947
+ }
1948
+
1949
+ resource "google_secret_manager_secret_iam_member" "runtime" {
1950
+ secret_id = google_secret_manager_secret.database_url.id
1951
+ role = "roles/secretmanager.secretAccessor"
1952
+ member = "serviceAccount:\${google_service_account.runtime.email}"
1953
+ }
1954
+
1955
+ resource "google_project_iam_member" "runtime_cloudsql" {
1956
+ project = var.project_id
1957
+ role = "roles/cloudsql.client"
1958
+ member = "serviceAccount:\${google_service_account.runtime.email}"
1959
+ }
1960
+
1961
+ output "database_instance" {
1962
+ value = google_sql_database_instance.db.connection_name
1963
+ }
1964
+ `
1965
+ });
1966
+ }
1967
+ for (const s of stackEnvSettings(tier)) {
1968
+ const env = s.environment;
1784
1969
  files.push({
1785
1970
  path: `infra/envs/${env}.tfvars`,
1786
1971
  content: `project_id = "${cloud.projectId}"
1787
1972
  region = "${cloud.region}"
1788
1973
  app = "${app}"
1789
1974
  environment = "${env}"
1790
- min_instances = ${String(s.min)}
1791
- max_instances = ${String(s.max)}
1975
+ min_instances = ${String(s.minInstances)}
1976
+ max_instances = ${String(s.maxInstances)}
1792
1977
  `
1793
1978
  });
1794
1979
  }
@@ -1820,11 +2005,19 @@ jobs:
1820
2005
  uses: ./.github/workflows/compbox-deploy.yml
1821
2006
  with:
1822
2007
  environment: \${{ inputs.environment || 'dev' }}
2008
+ secrets: inherit
1823
2009
  `
1824
2010
  });
1825
2011
  files.push({
1826
2012
  path: ".github/workflows/compbox-deploy.yml",
1827
2013
  content: `# Managed by CompBox. Signs in to Google Cloud without stored keys (Workload Identity).
2014
+ #
2015
+ # 1. build \u2014 runs in the environment (prod waits for its approval): applies the
2016
+ # Terraform, ${cloudSql ? "including the Cloud SQL database and its DATABASE_URL" : "keeps DATABASE_URL in Secret Manager"}, builds the image.
2017
+ # 2. migrate \u2014 only when the environment has a DATABASE_URL: runs the app's own
2018
+ # "db:migrate" (or "migrate") script. It runs in the "<environment>-migrations"
2019
+ # GitHub environment, so you can require an approval before migrations.
2020
+ # 3. release \u2014 deploys the image to Cloud Run once migrations have succeeded.
1828
2021
  name: CompBox deploy
1829
2022
 
1830
2023
  on:
@@ -1842,37 +2035,58 @@ concurrency:
1842
2035
  group: compbox-\${{ inputs.environment }}
1843
2036
  cancel-in-progress: false
1844
2037
 
2038
+ env:
2039
+ ENVIRONMENT: \${{ inputs.environment }}
2040
+ PROJECT_ID: ${cloud.projectId}
2041
+ REGION: ${cloud.region}
2042
+ APP: ${app}
2043
+ IMAGE: ${registry}/app:\${{ github.sha }}
2044
+ STATE_BUCKET: ${stateBucket}
2045
+
1845
2046
  jobs:
1846
- deploy:
2047
+ build:
1847
2048
  runs-on: ubuntu-latest
1848
- environment:
1849
- name: \${{ inputs.environment }}
1850
- url: \${{ steps.deploy.outputs.url }}
2049
+ environment: \${{ inputs.environment }}
2050
+ outputs:
2051
+ database: \${{ steps.database.outputs.configured }}
1851
2052
  env:
1852
- ENVIRONMENT: \${{ inputs.environment }}
1853
- PROJECT_ID: ${cloud.projectId}
1854
- REGION: ${cloud.region}
1855
- APP: ${app}
1856
- IMAGE: ${registry}/app:\${{ github.sha }}
1857
- STATE_BUCKET: ${gcpStateBucket(cloud.projectId)}
2053
+ HAS_DATABASE_URL: \${{ secrets.DATABASE_URL != '' }}
1858
2054
  steps:
1859
2055
  - uses: actions/checkout@v4
1860
2056
 
1861
- - uses: google-github-actions/auth@v2
1862
- with:
1863
- workload_identity_provider: ${cloud.workloadProvider}
1864
- service_account: ${cloud.serviceAccountEmail}
1865
-
1866
- - uses: google-github-actions/setup-gcloud@v2
1867
-
1868
- - uses: hashicorp/setup-terraform@v3
2057
+ ${cloudSetupSteps}
1869
2058
 
1870
2059
  - name: Infrastructure
1871
2060
  working-directory: infra
1872
2061
  run: |
1873
- terraform init -input=false -backend-config="bucket=$STATE_BUCKET" -backend-config="prefix=$APP/$ENVIRONMENT"
2062
+ ${terraformInit}
1874
2063
  terraform apply -input=false -auto-approve -var-file="envs/$ENVIRONMENT.tfvars"
1875
2064
 
2065
+ ${cloudSql ? ` - name: Database secret
2066
+ id: database
2067
+ # Terraform created the Cloud SQL database and keeps its DATABASE_URL.
2068
+ run: echo "configured=true" >> "$GITHUB_OUTPUT"
2069
+ ` : ` - name: Database secret
2070
+ id: database
2071
+ env:
2072
+ DATABASE_URL: \${{ secrets.DATABASE_URL }}
2073
+ run: |
2074
+ if [ "$HAS_DATABASE_URL" != "true" ]; then
2075
+ echo "configured=false" >> "$GITHUB_OUTPUT"
2076
+ exit 0
2077
+ fi
2078
+ SECRET="$APP-$ENVIRONMENT-database-url"
2079
+ RUNTIME="serviceAccount:$APP-$ENVIRONMENT@$PROJECT_ID.iam.gserviceaccount.com"
2080
+ gcloud secrets describe "$SECRET" --project "$PROJECT_ID" >/dev/null 2>&1 || \\
2081
+ gcloud secrets create "$SECRET" --project "$PROJECT_ID" --replication-policy=automatic --quiet
2082
+ CURRENT=$(gcloud secrets versions access latest --secret "$SECRET" --project "$PROJECT_ID" 2>/dev/null || true)
2083
+ if [ "$CURRENT" != "$DATABASE_URL" ]; then
2084
+ printf '%s' "$DATABASE_URL" | gcloud secrets versions add "$SECRET" --project "$PROJECT_ID" --data-file=- --quiet
2085
+ fi
2086
+ gcloud secrets add-iam-policy-binding "$SECRET" --project "$PROJECT_ID" --member="$RUNTIME" \\
2087
+ --role=roles/secretmanager.secretAccessor --condition=None --quiet >/dev/null
2088
+ echo "configured=true" >> "$GITHUB_OUTPUT"
2089
+ `}
1876
2090
  - name: Build
1877
2091
  run: |
1878
2092
  if [ ! -f Dockerfile ]; then
@@ -1883,16 +2097,173 @@ jobs:
1883
2097
  docker build -t "$IMAGE" .
1884
2098
  docker push "$IMAGE"
1885
2099
 
2100
+ migrate:
2101
+ needs: build
2102
+ if: needs.build.outputs.database == 'true'
2103
+ runs-on: ubuntu-latest
2104
+ environment: \${{ inputs.environment }}-migrations
2105
+ steps:
2106
+ - uses: actions/checkout@v4
2107
+
2108
+ - uses: google-github-actions/auth@v2
2109
+ with:
2110
+ workload_identity_provider: ${cloud.workloadProvider}
2111
+ service_account: ${cloud.serviceAccountEmail}
2112
+
2113
+ - uses: google-github-actions/setup-gcloud@v2
2114
+
2115
+ - uses: actions/setup-node@v4
2116
+ with:
2117
+ node-version: lts/*
2118
+
2119
+ - name: Migrate
2120
+ run: |
2121
+ if [ ! -f package.json ]; then
2122
+ echo "::notice::No package.json, so there is no migrate script to run. Skipping migrations."
2123
+ exit 0
2124
+ fi
2125
+ SCRIPT=$(node -e 'const s = require("./package.json").scripts || {}; process.stdout.write(s["db:migrate"] ? "db:migrate" : s.migrate ? "migrate" : "")')
2126
+ if [ -z "$SCRIPT" ]; then
2127
+ echo "::notice::package.json has no \\"db:migrate\\" or \\"migrate\\" script. Skipping migrations."
2128
+ exit 0
2129
+ fi
2130
+ DATABASE_URL=$(gcloud secrets versions access latest --secret "$APP-$ENVIRONMENT-${secretSuffix}" --project "$PROJECT_ID")
2131
+ echo "::add-mask::$DATABASE_URL"
2132
+ export DATABASE_URL${cloudSql ? `
2133
+ # Reach the Cloud SQL database through the Cloud SQL Auth Proxy, on the same /cloudsql socket Cloud Run uses.
2134
+ curl -fsSL -o cloud-sql-proxy "https://storage.googleapis.com/cloud-sql-connectors/cloud-sql-proxy/${CLOUD_SQL_PROXY_VERSION}/cloud-sql-proxy.linux.amd64"
2135
+ chmod +x cloud-sql-proxy
2136
+ sudo mkdir -p /cloudsql && sudo chown "$(id -u)" /cloudsql
2137
+ INSTANCE="$PROJECT_ID:$REGION:$APP-$ENVIRONMENT-db"
2138
+ ./cloud-sql-proxy --unix-socket /cloudsql "$INSTANCE" &
2139
+ for _ in $(seq 1 30); do
2140
+ [ -S "/cloudsql/$INSTANCE/.s.PGSQL.5432" ] && break
2141
+ sleep 1
2142
+ done
2143
+ if [ ! -S "/cloudsql/$INSTANCE/.s.PGSQL.5432" ]; then
2144
+ echo "::error::Couldn't reach the Cloud SQL database $INSTANCE."
2145
+ exit 1
2146
+ fi` : ""}
2147
+ if [ -f pnpm-lock.yaml ]; then
2148
+ corepack enable
2149
+ pnpm install --frozen-lockfile
2150
+ pnpm run "$SCRIPT"
2151
+ elif [ -f yarn.lock ]; then
2152
+ corepack enable
2153
+ yarn install --immutable || yarn install --frozen-lockfile
2154
+ yarn run "$SCRIPT"
2155
+ else
2156
+ if [ -f package-lock.json ]; then npm ci; else npm install; fi
2157
+ npm run "$SCRIPT"
2158
+ fi
2159
+
2160
+ release:
2161
+ needs: [build, migrate]
2162
+ if: \${{ !cancelled() && needs.build.result == 'success' && (needs.migrate.result == 'success' || needs.migrate.result == 'skipped') }}
2163
+ runs-on: ubuntu-latest
2164
+ steps:
2165
+ - uses: google-github-actions/auth@v2
2166
+ with:
2167
+ workload_identity_provider: ${cloud.workloadProvider}
2168
+ service_account: ${cloud.serviceAccountEmail}
2169
+
2170
+ - uses: google-github-actions/setup-gcloud@v2
2171
+
1886
2172
  - name: Deploy
1887
2173
  id: deploy
2174
+ env:
2175
+ DATABASE: \${{ needs.build.outputs.database }}
1888
2176
  run: |
1889
2177
  SERVICE="$APP-$ENVIRONMENT"
1890
- gcloud run deploy "$SERVICE" --image "$IMAGE" --region "$REGION" --project "$PROJECT_ID" --quiet
2178
+ SECRETS=()
2179
+ if [ "$DATABASE" = "true" ]; then
2180
+ SECRETS=(--set-secrets "DATABASE_URL=$APP-$ENVIRONMENT-${secretSuffix}:latest"${cloudSql ? ` --add-cloudsql-instances "$PROJECT_ID:$REGION:$APP-$ENVIRONMENT-db"` : ""})
2181
+ fi
2182
+ gcloud run deploy "$SERVICE" --image "$IMAGE" --region "$REGION" --project "$PROJECT_ID" "\${SECRETS[@]}" --quiet
1891
2183
  URL=$(gcloud run services describe "$SERVICE" --region "$REGION" --project "$PROJECT_ID" --format='value(status.url)')
1892
2184
  echo "url=$URL" >> "$GITHUB_OUTPUT"
1893
2185
  echo "### Live at $URL" >> "$GITHUB_STEP_SUMMARY"
1894
2186
  `
1895
2187
  });
2188
+ if (tier === "full") {
2189
+ files.push({
2190
+ path: `.github/workflows/${TEARDOWN_WORKFLOW}`,
2191
+ content: `# Managed by CompBox. Destroys stage or prod; dev is never torn down here.
2192
+ # Start it from CompBox, or Actions \u2192 CompBox teardown \u2192 Run workflow and type "${app}-<environment>".
2193
+ name: CompBox teardown
2194
+ run-name: Tear down \${{ inputs.environment }}
2195
+
2196
+ on:
2197
+ workflow_dispatch:
2198
+ inputs:
2199
+ environment:
2200
+ description: What to tear down
2201
+ type: choice
2202
+ options:
2203
+ ${TEARDOWN_ENVIRONMENTS.map((e) => ` - ${e}`).join("\n")}
2204
+ confirm:
2205
+ description: Type ${app}-<environment> to confirm
2206
+ type: string
2207
+ required: true
2208
+
2209
+ permissions:
2210
+ contents: read
2211
+ id-token: write
2212
+
2213
+ concurrency:
2214
+ group: compbox-\${{ inputs.environment }}
2215
+ cancel-in-progress: false
2216
+
2217
+ jobs:
2218
+ teardown:
2219
+ runs-on: ubuntu-latest
2220
+ environment:
2221
+ name: \${{ inputs.environment }}
2222
+ env:
2223
+ ENVIRONMENT: \${{ inputs.environment }}
2224
+ CONFIRM: \${{ inputs.confirm }}
2225
+ APP: ${app}
2226
+ STATE_BUCKET: ${stateBucket}
2227
+ steps:
2228
+ - name: Confirm
2229
+ run: |
2230
+ case "$ENVIRONMENT" in
2231
+ stage|prod) ;;
2232
+ *) echo "::error::Only stage and prod can be torn down."; exit 1 ;;
2233
+ esac
2234
+ if [ "$CONFIRM" != "$APP-$ENVIRONMENT" ]; then
2235
+ echo "::error::Type $APP-$ENVIRONMENT to confirm the teardown."
2236
+ exit 1
2237
+ fi
2238
+
2239
+ - uses: actions/checkout@v4
2240
+
2241
+ ${cloudSetupSteps}
2242
+
2243
+ - name: Init
2244
+ working-directory: infra
2245
+ run: ${terraformInit}
2246
+
2247
+ # main.tf keeps prod's service protected; a Terraform override file
2248
+ # (created only on the runner, never committed) lifts that for this run.
2249
+ - name: Turn off deletion protection
2250
+ if: inputs.environment == 'prod'
2251
+ working-directory: infra
2252
+ run: |
2253
+ printf '%s\\n' 'resource "google_cloud_run_v2_service" "app" {' ' deletion_protection = false' '}' > compbox_teardown_override.tf
2254
+ terraform apply -input=false -auto-approve -var-file="envs/$ENVIRONMENT.tfvars" -target=google_cloud_run_v2_service.app
2255
+
2256
+ - name: Destroy
2257
+ working-directory: infra
2258
+ run: terraform destroy -input=false -auto-approve -var-file="envs/$ENVIRONMENT.tfvars"
2259
+
2260
+ - name: Remove state
2261
+ run: |
2262
+ gcloud storage rm -r "gs://$STATE_BUCKET/$APP/$ENVIRONMENT"
2263
+ echo "### $APP-$ENVIRONMENT torn down" >> "$GITHUB_STEP_SUMMARY"
2264
+ `
2265
+ });
2266
+ }
1896
2267
  files.push({
1897
2268
  path: "infra/README.md",
1898
2269
  content: `# Infrastructure (managed by CompBox)
@@ -1901,13 +2272,14 @@ This project deploys to Google Cloud project \`${cloud.projectId}\` (${cloud.reg
1901
2272
 
1902
2273
  - **Dev:** every push to \`${defaultBranch}\` deploys it.${envs.length > 1 ? "\n- **Stage and prod:** in GitHub, Actions \u2192 CompBox \u2192 Run workflow, then pick the environment. Add required reviewers to the `prod` environment (Settings \u2192 Environments) so prod waits for approval." : ""}
1903
2274
  - **The app:** a \`Dockerfile\` at the repository root, for a container that listens on \`$PORT\` (8080).
2275
+ - **Database:** ${cloudSql ? `each environment has a Cloud SQL for PostgreSQL database (\`${app}-<environment>-db\`, in \`database.tf\`), created by the first deploy. Terraform keeps its \`DATABASE_URL\` in Secret Manager (\`${app}-<environment>-cloudsql-url\`) and the deploy gives it to the service as \`DATABASE_URL\`. Deletion protection is on: Terraform won't delete the database. The database password is in the Terraform state (the \`${app}\` prefix of the state bucket), so keep that bucket private.` : `when the environment has a \`DATABASE_URL\` secret, the deploy keeps it in Secret Manager (\`${app}-<environment>-database-url\`) and gives it to the service as \`DATABASE_URL\`.`} Before the new version goes live, it runs the app's \`db:migrate\` script (or \`migrate\`) with npm, pnpm or yarn, matching the lockfile; with neither script, migrations are skipped. Migrations run in the \`<environment>-migrations\` GitHub environment: add required reviewers there to approve them before they run. CompBox never runs a reset or a data-loss migration.
1904
2276
  - **Sign-in:** GitHub Actions sign in to Google Cloud through Workload Identity \u2014 there are no keys to store or rotate.
1905
2277
  - **Changes:** edit the Terraform here; the next deploy applies it. Services are public by default; remove the \`public\` resource in \`main.tf\` to keep one private.
1906
2278
  `
1907
2279
  });
1908
2280
  return files;
1909
2281
  }
1910
- var STACK_TIERS, STACK_WORKFLOW, APP, BRANCH;
2282
+ var STACK_TIERS, STACK_WORKFLOW, TEARDOWN_WORKFLOW, TEARDOWN_ENVIRONMENTS, CLOUD_SQL_PROXY_VERSION, APP, BRANCH;
1911
2283
  var init_stack_files = __esm({
1912
2284
  "../shared/dist/stack-files.js"() {
1913
2285
  "use strict";
@@ -1917,11 +2289,102 @@ var init_stack_files = __esm({
1917
2289
  full: { label: "Dev, stage and prod", environments: ["dev", "stage", "prod"] }
1918
2290
  };
1919
2291
  STACK_WORKFLOW = "compbox.yml";
2292
+ TEARDOWN_WORKFLOW = "compbox-teardown.yml";
2293
+ TEARDOWN_ENVIRONMENTS = ["stage", "prod"];
2294
+ CLOUD_SQL_PROXY_VERSION = "v2.14.1";
1920
2295
  APP = /^[a-z][a-z0-9-]{1,19}$/;
1921
2296
  BRANCH = /^[A-Za-z0-9._/-]{1,200}$/;
1922
2297
  }
1923
2298
  });
1924
2299
 
2300
+ // ../shared/dist/stack-cost.js
2301
+ function lowUsage() {
2302
+ const busySeconds = LOW_REQUESTS * LOW_REQUEST_SECONDS;
2303
+ return {
2304
+ vcpuSeconds: busySeconds * INSTANCE_VCPU,
2305
+ gibSeconds: busySeconds * INSTANCE_GIB,
2306
+ requests: LOW_REQUESTS,
2307
+ imagesGb: LOW_IMAGES_GB
2308
+ };
2309
+ }
2310
+ function highUsage(maxInstances) {
2311
+ const busySeconds = maxInstances * MONTH_SECONDS * HIGH_BUSY_SHARE;
2312
+ return {
2313
+ vcpuSeconds: busySeconds * INSTANCE_VCPU,
2314
+ gibSeconds: busySeconds * INSTANCE_GIB,
2315
+ requests: busySeconds * HIGH_REQUESTS_PER_SECOND,
2316
+ imagesGb: HIGH_IMAGES_GB
2317
+ };
2318
+ }
2319
+ function cost(usage, free, p) {
2320
+ const take = (key) => {
2321
+ const covered = Math.min(usage[key], free[key]);
2322
+ free[key] -= covered;
2323
+ return usage[key] - covered;
2324
+ };
2325
+ return take("vcpuSeconds") * p.cloudRunVcpuSecond + take("gibSeconds") * p.cloudRunGibSecond + take("requests") / 1e6 * p.cloudRunPerMillionRequests + usage.imagesGb * p.artifactRegistryGbMonth + STATE_GB * p.storageGbMonth;
2326
+ }
2327
+ function estimateStackCost(tier, cloud) {
2328
+ if (cloud.provider !== "gcp")
2329
+ return null;
2330
+ const p = STACK_PRICING.gcp;
2331
+ const settings = stackEnvSettings(tier);
2332
+ const lowFree = { ...p.freeTier };
2333
+ const highFree = { ...p.freeTier };
2334
+ const environments = settings.map((s) => ({
2335
+ environment: s.environment,
2336
+ low: Math.round(cost(lowUsage(), lowFree, p)),
2337
+ high: Math.round(cost(highUsage(s.maxInstances), highFree, p))
2338
+ }));
2339
+ const total = environments.reduce((t, e) => ({ low: t.low + e.low, high: t.high + e.high }), { low: 0, high: 0 });
2340
+ const busyHours = Math.round(MONTH_SECONDS * HIGH_BUSY_SHARE / 3600);
2341
+ return {
2342
+ currency: p.currency,
2343
+ pricesAsOf: p.pricesAsOf,
2344
+ calculatorUrl: p.calculatorUrl,
2345
+ environments,
2346
+ total,
2347
+ assumptions: [
2348
+ `List prices for Google Cloud as of ${p.pricesAsOf}, for a Tier 1 region; ${cloud.region} may cost more if it is a Tier 2 region.`,
2349
+ `Each instance has ${String(INSTANCE_VCPU)} vCPU and ${String(INSTANCE_GIB * 1024)} MiB of memory and is billed only while handling requests.`,
2350
+ `Low: light traffic \u2014 about ${LOW_REQUESTS.toLocaleString("en-US")} requests a month per environment, ${String(LOW_REQUEST_SECONDS * 1e3)} ms each; the app scales to zero when idle.`,
2351
+ `High: every allowed instance (${settings.map((s) => `${s.environment} ${String(s.maxInstances)}`).join(", ")}) busy for ${String(HIGH_BUSY_SHARE * 100)}% of the month (about ${String(busyHours)} hours), serving ${String(HIGH_REQUESTS_PER_SECOND)} requests a second each.`,
2352
+ `Google's monthly free tier (${p.freeTier.vcpuSeconds.toLocaleString("en-US")} vCPU-seconds, ${p.freeTier.gibSeconds.toLocaleString("en-US")} GiB-seconds, ${(p.freeTier.requests / 1e6).toLocaleString("en-US")} million requests) is counted once for the whole stack.`,
2353
+ `Includes ${String(LOW_IMAGES_GB)}\u2013${String(HIGH_IMAGES_GB)} GB of stored container images per environment; databases, networking and other services you add are not included.`
2354
+ ]
2355
+ };
2356
+ }
2357
+ var STACK_PRICING, INSTANCE_VCPU, INSTANCE_GIB, MONTH_SECONDS, LOW_REQUESTS, LOW_REQUEST_SECONDS, LOW_IMAGES_GB, HIGH_BUSY_SHARE, HIGH_REQUESTS_PER_SECOND, HIGH_IMAGES_GB, STATE_GB;
2358
+ var init_stack_cost = __esm({
2359
+ "../shared/dist/stack-cost.js"() {
2360
+ "use strict";
2361
+ init_stack_files();
2362
+ STACK_PRICING = {
2363
+ gcp: {
2364
+ pricesAsOf: "2026-05-11",
2365
+ calculatorUrl: "https://cloud.google.com/products/calculator",
2366
+ currency: "USD",
2367
+ cloudRunVcpuSecond: 24e-6,
2368
+ cloudRunGibSecond: 25e-7,
2369
+ cloudRunPerMillionRequests: 0.4,
2370
+ freeTier: { vcpuSeconds: 18e4, gibSeconds: 36e4, requests: 2e6 },
2371
+ artifactRegistryGbMonth: 0.1,
2372
+ storageGbMonth: 0.02
2373
+ }
2374
+ };
2375
+ INSTANCE_VCPU = 1;
2376
+ INSTANCE_GIB = 0.5;
2377
+ MONTH_SECONDS = 30 * 24 * 60 * 60;
2378
+ LOW_REQUESTS = 1e4;
2379
+ LOW_REQUEST_SECONDS = 0.2;
2380
+ LOW_IMAGES_GB = 0.5;
2381
+ HIGH_BUSY_SHARE = 0.25;
2382
+ HIGH_REQUESTS_PER_SECOND = 20;
2383
+ HIGH_IMAGES_GB = 2;
2384
+ STATE_GB = 0.01;
2385
+ }
2386
+ });
2387
+
1925
2388
  // ../shared/dist/github-repo.js
1926
2389
  function githubRepoKey(remote) {
1927
2390
  if (typeof remote !== "string")
@@ -1986,17 +2449,22 @@ __export(dist_exports, {
1986
2449
  APPEND_DESCRIPTION_MAX: () => APPEND_DESCRIPTION_MAX,
1987
2450
  AWS_REGIONS: () => AWS_REGIONS,
1988
2451
  AZURE_DEPLOY_IDENTITY: () => AZURE_DEPLOY_IDENTITY,
2452
+ CLOUD_SQL_MONTHLY_ESTIMATE_USD: () => CLOUD_SQL_MONTHLY_ESTIMATE_USD,
2453
+ CLOUD_SQL_PROXY_VERSION: () => CLOUD_SQL_PROXY_VERSION,
1989
2454
  COMPLETION_REPAIR_INSTRUCTION: () => COMPLETION_REPAIR_INSTRUCTION,
1990
2455
  CONVERSATION_QUALITY_ROUNDS: () => CONVERSATION_QUALITY_ROUNDS,
2456
+ DATABASE_CHOICE_VALUES: () => DATABASE_CHOICE_VALUES,
1991
2457
  DESCRIPTION_MAX: () => DESCRIPTION_MAX,
1992
2458
  EMPTY_ARM_TEMPLATE: () => EMPTY_ARM_TEMPLATE,
1993
2459
  GCP_CONNECT_STEPS: () => GCP_CONNECT_STEPS,
1994
2460
  GCP_CONNECT_STEP_LABELS: () => GCP_CONNECT_STEP_LABELS,
1995
2461
  GCP_DEPLOY_ACCOUNT: () => GCP_DEPLOY_ACCOUNT,
2462
+ GCP_DEPLOY_CONDITIONAL_ROLE: () => GCP_DEPLOY_CONDITIONAL_ROLE,
1996
2463
  GCP_DEPLOY_ROLES: () => GCP_DEPLOY_ROLES,
1997
2464
  GCP_IDENTITY_POOL: () => GCP_IDENTITY_POOL,
1998
2465
  GCP_IDENTITY_PROVIDER: () => GCP_IDENTITY_PROVIDER,
1999
2466
  GCP_REGIONS: () => GCP_REGIONS,
2467
+ GCP_SERVICES: () => GCP_SERVICES,
2000
2468
  INTERVIEW_DEFINITION: () => INTERVIEW_DEFINITION,
2001
2469
  INTERVIEW_FIELD_MIN_WORDS: () => INTERVIEW_FIELD_MIN_WORDS,
2002
2470
  INTERVIEW_STATUSES: () => INTERVIEW_STATUSES,
@@ -2007,6 +2475,7 @@ __export(dist_exports, {
2007
2475
  ORG_ROLES: () => ORG_ROLES,
2008
2476
  PXPIPE_DEFAULT_PROXY_URL: () => PXPIPE_DEFAULT_PROXY_URL,
2009
2477
  RETURN_TO_MAX_LENGTH: () => RETURN_TO_MAX_LENGTH,
2478
+ STACK_PRICING: () => STACK_PRICING,
2010
2479
  STACK_TIERS: () => STACK_TIERS,
2011
2480
  STACK_WORKFLOW: () => STACK_WORKFLOW,
2012
2481
  START_EXECUTION_KINDS: () => START_EXECUTION_KINDS,
@@ -2014,6 +2483,8 @@ __export(dist_exports, {
2014
2483
  SUMMARY_MAX: () => SUMMARY_MAX,
2015
2484
  SessionEventType: () => SessionEventType,
2016
2485
  TARGET_COMPLIANCE_TIER: () => TARGET_COMPLIANCE_TIER,
2486
+ TEARDOWN_ENVIRONMENTS: () => TEARDOWN_ENVIRONMENTS,
2487
+ TEARDOWN_WORKFLOW: () => TEARDOWN_WORKFLOW,
2017
2488
  TERMINAL_JOB_STATUSES: () => TERMINAL_JOB_STATUSES,
2018
2489
  TURN_ROLES: () => TURN_ROLES,
2019
2490
  agentSchema: () => agentSchema,
@@ -2030,9 +2501,12 @@ __export(dist_exports, {
2030
2501
  buildInterviewSystemPrompt: () => buildInterviewSystemPrompt,
2031
2502
  buildStackFiles: () => buildStackFiles,
2032
2503
  cloudRunUrl: () => cloudRunUrl,
2504
+ cloudSqlInstanceName: () => cloudSqlInstanceName,
2033
2505
  complianceFromRecord: () => complianceFromRecord,
2506
+ databaseSecretName: () => databaseSecretName,
2034
2507
  deployRunTitle: () => deployRunTitle,
2035
2508
  err: () => err,
2509
+ estimateStackCost: () => estimateStackCost,
2036
2510
  extractCompletionJson: () => extractCompletionJson,
2037
2511
  gcpServiceAccountEmail: () => gcpServiceAccountEmail,
2038
2512
  gcpStateBucket: () => gcpStateBucket,
@@ -2079,6 +2553,7 @@ __export(dist_exports, {
2079
2553
  mcpServerConfigSchema: () => mcpServerConfigSchema,
2080
2554
  meetsComplianceTarget: () => meetsComplianceTarget,
2081
2555
  modelRecommendationSourceValues: () => modelRecommendationSourceValues,
2556
+ normalizeDatabaseChoice: () => normalizeDatabaseChoice,
2082
2557
  normalizeGitRemote: () => normalizeGitRemote,
2083
2558
  ok: () => ok,
2084
2559
  probeProxyHealth: () => probeProxyHealth,
@@ -2094,7 +2569,10 @@ __export(dist_exports, {
2094
2569
  skillSchema: () => skillSchema,
2095
2570
  sleep: () => sleep,
2096
2571
  stackAppName: () => stackAppName,
2572
+ stackEnvSettings: () => stackEnvSettings,
2097
2573
  stackEnvironments: () => stackEnvironments,
2574
+ teardownConfirmation: () => teardownConfirmation,
2575
+ teardownRunTitle: () => teardownRunTitle,
2098
2576
  thinkingLevelValues: () => thinkingLevelValues,
2099
2577
  toConversationMessages: () => toConversationMessages,
2100
2578
  validatePackName: () => validatePackName,
@@ -2115,6 +2593,7 @@ var init_dist = __esm({
2115
2593
  init_cloud_setup();
2116
2594
  init_cloud_connect();
2117
2595
  init_stack_files();
2596
+ init_stack_cost();
2118
2597
  init_github_repo();
2119
2598
  init_return_to();
2120
2599
  }
@@ -12343,7 +12822,7 @@ function withLegacyToolCallRewrite(transport) {
12343
12822
  var SERVER_NAME = "compbox-mcp";
12344
12823
  function resolveServerVersion() {
12345
12824
  if (true) {
12346
- return "1.21.7";
12825
+ return "1.21.9";
12347
12826
  }
12348
12827
  const require2 = createRequire(import.meta.url);
12349
12828
  for (const candidate of ["../package.json", "./package.json"]) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mycompbox/compbox-mcp",
3
- "version": "1.21.7",
3
+ "version": "1.21.9",
4
4
  "description": "CompBox MCP server - Uses HTTP API client (no direct database access)",
5
5
  "license": "MIT",
6
6
  "type": "module",