fix(mindspace): keep standalone service data paths under MindSpace root

Prevent Portal .env from overriding MindSpace storage/users roots, and
set launchd env plus runtime docs to use /Users/john/MindSpace paths.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
john
2026-07-12 18:06:16 +08:00
parent f9561cd91d
commit 67d529c81e
3 changed files with 49 additions and 4 deletions
+7 -2
View File
@@ -128,7 +128,11 @@ async function writeMetadata() {
'',
'Production runtime target:',
' /Users/john/MindSpace',
'Shared persisted data root:',
'Standalone persisted data root:',
' /Users/john/MindSpace/data/mindspace',
'Standalone users root:',
' /Users/john/MindSpace/users',
'Shared Portal/H5 root:',
' /Users/john/Project/Memind',
'',
'This artifact contains:',
@@ -145,7 +149,8 @@ async function writeMetadata() {
' users/ runtime data',
' .env / .env.local',
'',
'The production service keeps using shared persisted paths from /Users/john/Project/Memind.',
'The production service may read shared Portal secrets from /Users/john/Project/Memind/.env,',
'but standalone MindSpace data paths must stay under /Users/john/MindSpace.',
'',
`Git head ref: ${head.trim()}`,
].join('\n');
@@ -279,6 +279,10 @@ cat > "${SERVICE_PLIST}" <<EOF
<string>8082</string>
<key>MINDSPACE_SERVICE_HOST</key>
<string>127.0.0.1</string>
<key>MINDSPACE_STORAGE_ROOT</key>
<string>${APP_DIR}/data/mindspace</string>
<key>H5_USERS_ROOT</key>
<string>${APP_DIR}/users</string>
<key>MINDSPACE_SERVICE_AGENT_WORKER_ENABLED</key>
<string>true</string>
<key>MINDSPACE_SERVICE_WORKSPACE_MAINTENANCE</key>
@@ -306,6 +310,7 @@ mv "${NEW_DIR}" "${APP_DIR}"
APP_MOVED=1
say "启动 MindSpace service"
mkdir -p "${APP_DIR}/data/mindspace" "${APP_DIR}/users"
launchctl bootstrap "${LAUNCHD_GUI}" "${SERVICE_PLIST}" >/dev/null 2>&1 || true
launchctl enable "${LAUNCHD_GUI}/${SERVICE_LABEL}" >/dev/null 2>&1 || true
launchctl kickstart -k "${LAUNCHD_GUI}/${SERVICE_LABEL}" >/dev/null 2>&1 || true