Initial commit: Memind H5 portal with MindSpace, Plaza, and agent jobs.

Track application source and tests; exclude local env, user workspaces, and runtime data via .gitignore.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
John
2026-06-15 15:04:43 -07:00
commit 2e14873f2d
272 changed files with 64133 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
#!/usr/bin/env node
/**
* Map plaza.tkmind.cn -> 127.0.0.1 for local Plaza dev.
* Requires sudo to edit /etc/hosts.
*
* Usage:
* node scripts/setup-plaza-local-dns.mjs
* node scripts/setup-plaza-local-dns.mjs --remove
*/
import fs from 'node:fs';
import { execSync } from 'node:child_process';
const HOST = process.env.PLAZA_LOCAL_HOST ?? 'plaza.tkmind.cn';
const IP = process.env.PLAZA_LOCAL_IP ?? '127.0.0.1';
const MARKER = '# tkmind-plaza-local';
const LINE = `${IP} ${HOST} ${MARKER}`;
const remove = process.argv.includes('--remove');
const hostsPath = '/etc/hosts';
const current = fs.readFileSync(hostsPath, 'utf8');
const lines = current.split('\n');
const filtered = lines.filter(
(line) => !line.includes(MARKER) && !line.match(new RegExp(`\\s${HOST.replace('.', '\\.')}(\\s|$)`)),
);
if (remove) {
if (filtered.length === lines.length) {
console.log(`hosts 中未找到 ${HOST},无需移除`);
process.exit(0);
}
const next = filtered.join('\n').replace(/\n?$/, '\n');
execSync(`tee ${hostsPath}`, { input: next, stdio: ['pipe', 'inherit', 'inherit'] });
console.log(`已移除 ${HOST} 本地解析`);
process.exit(0);
}
if (lines.some((line) => line.includes(MARKER) || new RegExp(`\\s${HOST.replace('.', '\\.')}(\\s|$)`).test(line))) {
console.log(`${HOST} 已在 /etc/hosts 中指向本地`);
process.exit(0);
}
const next = `${filtered.join('\n').replace(/\n?$/, '\n')}${LINE}\n`;
if (process.getuid?.() !== 0) {
console.log('需要 root 权限写入 /etc/hosts,请执行:');
console.log(` sudo node ${process.argv[1]}`);
process.exit(1);
}
try {
execSync(`tee ${hostsPath}`, { input: next, stdio: ['pipe', 'inherit', 'inherit'] });
console.log(`已添加:${LINE}`);
console.log('下一步:');
console.log(' sudo pnpm setup:plaza-local # hosts + TLS 证书');
console.log(' sudo pnpm dev:plaza-proxy # HTTPS :443 代理');
} catch {
console.error('写入 /etc/hosts 失败,请手动执行:');
console.error(` sudo sh -c 'echo "${LINE}" >> /etc/hosts'`);
process.exit(1);
}