unoverse 0.1.55 → 0.1.56

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.
@@ -43,17 +43,69 @@ cmd_deploy() {
43
43
  }
44
44
  echo ""
45
45
  ok "Your $cloud ground is prefilled ${DIM}(infra/$cloud/terraform.tfvars)${NC}"
46
+
47
+ # FILL THE BLANKS OURSELVES. Every FILL_ME the universe already knows (.env from
48
+ # setup) is copied in silently; only genuine unknowns are asked. Hand-copying
49
+ # values between our own files is not a step a developer should ever see.
50
+ local tfv="$ROOT/infra/$cloud/terraform.tfvars"
51
+ _tf_put() { # key value — safe replacement via node (values may hold sed specials)
52
+ node -e 'const fs=require("fs");const[f,k,v]=process.argv.slice(1);let s=fs.readFileSync(f,"utf8");s=s.replace(new RegExp("^"+k+"(\\s*)=\\s*\"FILL_ME\"","m"),k+"$1= "+JSON.stringify(v));fs.writeFileSync(f,s)' "$tfv" "$1" "$2"
53
+ }
54
+ _tf_fill() { # key envname prompt
55
+ local key="$1" envname="$2" prompt="$3" val
56
+ grep -q "^${key}[[:space:]]*=[[:space:]]*\"FILL_ME\"" "$tfv" 2>/dev/null || return 0
57
+ val=$(grep "^${envname}=" "$ROOT/.env" 2>/dev/null | head -1 | cut -d= -f2-)
58
+ if [ -n "$val" ]; then
59
+ _tf_put "$key" "$val"
60
+ ok "$key ${DIM}from your .env${NC}"
61
+ else
62
+ read -r -p " $prompt: " val
63
+ [ -n "$val" ] && _tf_put "$key" "$val"
64
+ fi
65
+ }
66
+ echo ""
67
+ _tf_fill docr_token DOCR_TOKEN "Registry access token (from your Unoverse admin)"
68
+ _tf_fill openai_api_key OPENAI_API_KEY "OPENAI_API_KEY (powers the platform's AI)"
69
+ if grep -q '^auth_issuer[[:space:]]*=[[:space:]]*"FILL_ME"' "$tfv" 2>/dev/null; then
70
+ local env_auth
71
+ env_auth=$(grep "^AUTH_ISSUER=" "$ROOT/.env" 2>/dev/null | cut -d= -f2-)
72
+ if [ -z "$env_auth" ]; then
73
+ echo ""
74
+ info "A deployed universe requires a login. Local auth-off does not deploy"
75
+ info "${DIM}(Auth0 or any OIDC provider; the issuer looks like https://your-tenant.auth0.com)${NC}"
76
+ fi
77
+ fi
78
+ _tf_fill auth_issuer AUTH_ISSUER "AUTH_ISSUER"
79
+ _tf_fill auth_client_id AUTH_CLIENT_ID "AUTH_CLIENT_ID"
80
+
81
+ if grep -q "FILL_ME" "$tfv" 2>/dev/null; then
82
+ echo ""
83
+ warn "Some values are still blank in ${BOLD}infra/$cloud/terraform.tfvars${NC} — fill them, then:"
84
+ info " cd infra/$cloud && terraform init && terraform apply"
85
+ info " cd ../.. && unoverse deploy"
86
+ echo ""
87
+ exit 1
88
+ fi
89
+ ok "terraform.tfvars is complete"
90
+
91
+ # PROVISION FROM RIGHT HERE, if wanted. terraform apply prints its plan and asks
92
+ # for its own explicit yes — creating billable infrastructure stays a deliberate,
93
+ # visible act, it just no longer requires leaving the flow.
46
94
  echo ""
47
- local step=1
48
- if grep -q "FILL_ME" "$ROOT/infra/$cloud/terraform.tfvars" 2>/dev/null; then
49
- info "$step. Fill in each FILL_ME value: ${BOLD}infra/$cloud/terraform.tfvars${NC}"
50
- step=$((step+1))
95
+ local REPLY
96
+ read -r -p " Provision now? terraform runs here and shows its plan first. [Y/n] " REPLY
97
+ if [[ "$REPLY" =~ ^[Nn]$ ]]; then
98
+ info "When ready: cd infra/$cloud && terraform init && terraform apply && cd ../.. && unoverse deploy"
99
+ exit 0
51
100
  fi
52
- info "$step. ${BOLD}cd infra/$cloud && terraform init && terraform apply${NC} ${DIM}creates the server (billable)${NC}"
53
- step=$((step+1))
54
- info "$step. ${BOLD}cd ../.. && unoverse deploy${NC} ${DIM}ships the platform onto it${NC}"
101
+ command -v terraform >/dev/null 2>&1 || { fail "terraform is not installed"; info " brew install terraform"; exit 1; }
102
+ terraform -chdir="$ROOT/infra/$cloud" init -input=false >/dev/null 2>&1 || { fail "terraform init failed"; exit 1; }
103
+ terraform -chdir="$ROOT/infra/$cloud" apply || { fail "apply did not complete. Re-run: unoverse deploy"; exit 1; }
104
+ echo ""
105
+ ok "Infrastructure is up. Shipping the platform onto it..."
55
106
  echo ""
56
- exit 0
107
+ cmd_deploy init
108
+ return $?
57
109
  fi
58
110
 
59
111
  # Read deploy target from .env.production
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.55",
3
+ "version": "0.1.56",
4
4
  "description": "The Unoverse front door — create a Studio project, a universe, or a client app, and launch Studio.",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",