unoverse 0.1.54 → 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.
@@ -42,11 +42,70 @@ cmd_deploy() {
42
42
  exit 1
43
43
  }
44
44
  echo ""
45
- info "Your $cloud ground is prefilled. Two commands left:"
46
- info " cd infra/$cloud && terraform init && terraform apply ${DIM}# creates the server (billable)${NC}"
47
- info " cd ../.. && unoverse deploy ${DIM}# ships the platform onto it${NC}"
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.
94
+ echo ""
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
100
+ fi
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..."
48
106
  echo ""
49
- exit 0
107
+ cmd_deploy init
108
+ return $?
50
109
  fi
51
110
 
52
111
  # Read deploy target from .env.production
@@ -265,20 +265,14 @@ cmd_ground() {
265
265
  [ -f "$ROOT/infra/digitalocean/terraform.tfvars" ] && { fail "infra/digitalocean/terraform.tfvars already exists. Edit it, or delete it to regenerate"; return 1; }
266
266
  _ground_do || return 1
267
267
  echo ""
268
- info "Next: fill every FILL_ME in infra/digitalocean/terraform.tfvars, then"
269
- info " cd infra/digitalocean && terraform init && terraform apply"
270
- info " cd ../.. && unoverse deploy init # renders .env.production from the ground itself"
271
- info " npx unoverse where # every deployed URL, probed live"
268
+ : # no closing narration here: deploy owns the next-steps (one voice)
272
269
  ;;
273
270
  aws)
274
271
  banner "Prefill your AWS ground"
275
272
  [ -f "$ROOT/infra/aws/terraform.tfvars" ] && { fail "infra/aws/terraform.tfvars already exists. Edit it, or delete it to regenerate"; return 1; }
276
273
  _ground_aws || return 1
277
274
  echo ""
278
- info "Next: fill every FILL_ME in infra/aws/terraform.tfvars, then"
279
- info " cd infra/aws && terraform init && terraform apply"
280
- info " cd ../.. && unoverse deploy init # renders .env.production from the ground itself"
281
- info " npx unoverse where # every deployed URL, probed live"
275
+ : # no closing narration here: deploy owns the next-steps (one voice)
282
276
  ;;
283
277
  *)
284
278
  fail "unknown ground: $which (use: do | aws)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.54",
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",