Files
life-echo/app-expo/scripts/use-env.js
Sully fa42757916 feat: OpenTelemetry LGTM observability, dev tooling, and memoir UX fixes (#31)
* add staging ios app build script

* feat(api): add OpenTelemetry LGTM stack for local observability

Wire OTel traces, metrics, and logs through a collector to Tempo,
Prometheus, and Loki, with custom LLM instrumentation, dev compose overlay,
Grafana provisioning, env templates, and development.sh auto-start.

Co-authored-by: Cursor <cursoragent@cursor.com>

* feat: expand observability, harden dev tooling, and fix expo staging UX

Add business and LLM Prometheus metrics with Grafana dashboards, alerting,
and a metrics verification script. Wire telemetry through adapters and core
LLM paths, and document the local LGTM workflow.

Fix development.sh for macOS bash 3.2, open Grafana and eval-web in Chrome,
and repair eval-web auto-open (unbound EVAL_WEB_BROWSER_SCHEDULED). Merge
internal-eval into the main dev script with improved compose handling.

Require EXPO_PUBLIC_* at build time, improve iOS HTTP ATS for staging IPs,
show memoir empty state instead of load errors when no chapters exist, and
add jest env setup plus chapter list response normalization.

Co-authored-by: Cursor <cursoragent@cursor.com>

* chore: enable Grafana Assistant Cursor plugin

Co-authored-by: Cursor <cursoragent@cursor.com>

* fix: memoir empty state and repair withdrawn 0020_chapters_book_id stamp

Show empty memoir UI when the chapter list succeeds with no items; treat auth/404 as non-fatal. Extend alembic revision repair so local dev DBs stamped with the removed 0020_chapters_book_id migration can roll back and upgrade to 0019.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Kevin <kevin@brighteng.org>
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-20 15:12:21 +08:00

40 lines
1.3 KiB
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* 将 app-expo/env/<name> 复制为 .env供 Metro/Expo 读取 EXPO_PUBLIC_*。
*
* 环境模板放在 env/ 子目录,而非 .env.staging / .env.production
* Release 构建时 Expo 会按 NODE_ENV=production 自动加载根目录 .env.production
* 若与 use-env 写入的 .env 并存production 会覆盖 staging见 @expo/env getEnvFiles
*
* 参数 name → 源文件:
* development → env/development
* staging → env/staging
* production → env/production
*
* CI.github/workflows/app-expo-deploy.yml 按分支/tag 调用本脚本。
*/
const fs = require('fs');
const path = require('path');
const env = process.argv[2] || 'development';
const root = path.join(__dirname, '..');
const src = path.join(root, 'env', env);
const dest = path.join(root, '.env');
/** @deprecated 旧路径;若仍存在会在 Release 构建中覆盖 .env */
const legacyEnvFile = path.join(root, `.env.${env}`);
if (!fs.existsSync(src)) {
console.error(`Missing env/${env} (expected ${src})`);
process.exit(1);
}
fs.copyFileSync(src, dest);
console.log(`Switched to env/${env} → .env`);
if (fs.existsSync(legacyEnvFile)) {
console.warn(
`Warning: legacy ${path.basename(legacyEnvFile)} still exists. ` +
'Remove it or Release builds may load production values over .env.',
);
}