unoverse 0.1.19 → 0.1.20

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.
@@ -103,7 +103,7 @@ cmd_init() {
103
103
  ok "Registry token carried over from create"
104
104
  else
105
105
  while true; do
106
- read -p " DOCR Token (from your Unoverse admin): " DOCR_TOKEN
106
+ read -p " DOCR Token (from your Unoverse admin): " DOCR_TOKEN || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
107
107
  if [[ "$DOCR_TOKEN" == dop_v1_* ]]; then
108
108
  break
109
109
  fi
@@ -111,9 +111,13 @@ cmd_init() {
111
111
  done
112
112
  fi
113
113
 
114
- # Database (required from admin)
114
+ # A DEFAULT, because "from your admin" is meaningless when you are the admin. The
115
+ # platform ships no database (docker-compose has no postgres), so this points at one
116
+ # you run. Enter takes the conventional local one.
117
+ DB_DEFAULT="postgres://postgres:postgres@localhost:5432/universe"
115
118
  while true; do
116
- read -p " DATABASE_URL (from your admin): " DATABASE_URL
119
+ read -p " DATABASE_URL [${DB_DEFAULT}]: " DATABASE_URL || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
120
+ DATABASE_URL="${DATABASE_URL:-$DB_DEFAULT}"
117
121
  if [ -n "$DATABASE_URL" ] && [[ "$DATABASE_URL" != *"user:password"* ]]; then
118
122
  break
119
123
  fi
@@ -148,28 +152,59 @@ cmd_init() {
148
152
  REDIS_TLS="${REDIS_TLS:-false}"
149
153
 
150
154
  # Auth (required — from admin)
151
- while true; do
152
- read -p " AUTH_ISSUER (e.g. https://your-tenant.auth0.com): " AUTH_ISSUER
153
- if [ -n "$AUTH_ISSUER" ] && [[ "$AUTH_ISSUER" != *"your-tenant"* ]]; then
154
- break
155
- fi
156
- fail "AUTH_ISSUER is required. Get it from your Unoverse admin"
157
- done
155
+ # ASK BEFORE DEMANDING. A developer trying the platform locally has no identity
156
+ # provider yet, and AUTH_ISSUER was required, so init could not be completed at all.
157
+ #
158
+ # This is a LOCAL switch only. INFRASTRUCTURE.md is explicit that auth is always on for
159
+ # a deployed universe ("there is no auth-off deployment"), and the platform enforces it
160
+ # rather than trusting this wizard: authConfig.ts refuses to start with auth off when
161
+ # NODE_ENV=production. So answering "no" here cannot produce an unprotected deployment.
162
+ echo ""
163
+ read -r -p " Do you have an identity provider (Auth0/OIDC) to connect? [y/N] " HAS_IDP
164
+ echo ""
158
165
 
159
- while true; do
160
- read -p " AUTH_CLIENT_ID: " AUTH_CLIENT_ID
161
- if [ -n "$AUTH_CLIENT_ID" ] && [[ "$AUTH_CLIENT_ID" != *"your-"* ]]; then
162
- break
163
- fi
164
- fail "AUTH_CLIENT_ID is required. Get it from your Unoverse admin"
165
- done
166
+ if [[ "$HAS_IDP" =~ ^[Yy]$ ]]; then
167
+ AUTH_ENABLED=true
168
+ while true; do
169
+ read -p " AUTH_ISSUER (e.g. https://your-tenant.auth0.com): " AUTH_ISSUER || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
170
+ if [ -n "$AUTH_ISSUER" ] && [[ "$AUTH_ISSUER" == https://* ]]; then
171
+ break
172
+ fi
173
+ fail "AUTH_ISSUER must be an https:// URL from your identity provider"
174
+ done
175
+
176
+ while true; do
177
+ read -p " AUTH_CLIENT_ID: " AUTH_CLIENT_ID || { fail "no input (end of stream). Run unoverse init interactively"; exit 1; }
178
+ if [ -n "$AUTH_CLIENT_ID" ] && [[ "$AUTH_CLIENT_ID" != *"your-"* ]]; then
179
+ break
180
+ fi
181
+ fail "AUTH_CLIENT_ID is required"
182
+ done
183
+
184
+ read -p " AUTH_AUDIENCE [gravity-api]: " AUTH_AUDIENCE
185
+ AUTH_AUDIENCE="${AUTH_AUDIENCE:-gravity-api}"
186
+ else
187
+ AUTH_ENABLED=false
188
+ AUTH_ISSUER=""
189
+ AUTH_CLIENT_ID=""
190
+ AUTH_AUDIENCE="gravity-api"
191
+ warn "Auth is OFF for local development"
192
+ info "Deploying needs it: ${BOLD}unoverse deploy${NC} runs with auth on, and the server refuses to start without it in production"
193
+ fi
166
194
 
167
- read -p " AUTH_AUDIENCE [gravity-api]: " AUTH_AUDIENCE
168
- AUTH_AUDIENCE="${AUTH_AUDIENCE:-gravity-api}"
195
+ # NOT ASKED. 4105 is the port docker-compose publishes, so locally this is a fact the
196
+ # CLI already knows, and confirming it is not a question. A DEPLOYED universe gets its
197
+ # own API_URL rendered into .env.production by Terraform, which never comes through here.
198
+ API_URL="http://localhost:4105"
169
199
 
170
- # API URL
171
- read -p " API_URL [http://localhost:4105]: " API_URL
172
- API_URL="${API_URL:-http://localhost:4105}"
200
+ # DERIVED FROM THE FOLDER, not hardcoded. Every key the memory server writes is
201
+ # prefixed with this, so two universes sharing one Redis and the same namespace mix
202
+ # their streams and caches. It used to be written as a literal `gravity` for every
203
+ # local universe, while Terraform rendered `universe` for deployed ones: same Redis,
204
+ # same prefix, silently interleaved.
205
+ REDIS_NAMESPACE=$(basename "$ROOT" | tr '[:upper:]' '[:lower:]' | tr -c 'a-z0-9-' '-' | sed 's/-*$//')
206
+ REDIS_NAMESPACE="${REDIS_NAMESPACE:-universe}"
207
+ ok "Redis namespace: ${BOLD}${REDIS_NAMESPACE}${NC}"
173
208
 
174
209
  # OpenAI (for Memory Server)
175
210
  read -p " OPENAI_API_KEY (for Memory Server, blank to skip): " OPENAI_API_KEY
@@ -183,7 +218,8 @@ REDIS_HOST=${REDIS_HOST}
183
218
  REDIS_PORT=${REDIS_PORT}
184
219
  REDIS_PASSWORD=${REDIS_PASSWORD}
185
220
  REDIS_TLS=${REDIS_TLS}
186
- REDIS_NAMESPACE=gravity
221
+ REDIS_NAMESPACE=${REDIS_NAMESPACE}
222
+ AUTH_ENABLED=${AUTH_ENABLED}
187
223
  AUTH_ISSUER=${AUTH_ISSUER}
188
224
  AUTH_CLIENT_ID=${AUTH_CLIENT_ID}
189
225
  AUTH_AUDIENCE=${AUTH_AUDIENCE}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.19",
3
+ "version": "0.1.20",
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",