接入客户端登录和配套后端启动

启动客户端时先检查平台登录态,未登录展示登录页,登录后进入启动器首页

独立客户端登录使用平台 auth 接口并对 refresh 做并发去重

Tauri 开发启动改为短命令 agc:serve,并先拉起配套 SpacetimeDB 与 api-server

AGC Vite 代理读取 dev-stack 状态并暴露本地 marker,复用时校验 API target

恢复启动器项目目录输入、最近项目刷新移除和非空文件夹提醒交互

补充启动器和登录 gate 测试,并更新 AI 游戏创作 App 开发文档
This commit is contained in:
AIGameCreator App
2026-07-08 02:25:31 +08:00
parent 3b3d9dcf8e
commit f9d8142068
13 changed files with 1188 additions and 104 deletions
+28 -8
View File
@@ -134,12 +134,14 @@ const SERVICE_ALIASES = new Map([
['api', 'api-server'],
['admin', 'admin-web'],
['adminWeb', 'admin-web'],
['backend', 'backend'],
['all', 'all'],
]);
function usage() {
console.log(`用法:
npm run dev [-- --watch] [-- --api-port 8090]
npm run dev backend [-- --watch]
npm run dev:spacetime [-- --skip-publish]
npm run dev:api-server [-- --database genarrative-dev]
npm run dev:web [-- --api-port 8082]
@@ -345,7 +347,7 @@ function parseArgs(argv, baseEnv) {
function normalizeServiceName(rawName) {
const alias = SERVICE_ALIASES.get(rawName);
const name = alias ?? rawName;
if (name === 'all' || SERVICE_NAMES.includes(name)) {
if (name === 'all' || name === 'backend' || SERVICE_NAMES.includes(name)) {
return name;
}
@@ -627,11 +629,16 @@ function ensureSpacetimeToolVersionMatchesWorkspace() {
function ensureRequiredFiles(command) {
const requiredFiles = [];
if (command === 'api-server' || command === 'spacetime' || command === 'all') {
if (
command === 'api-server' ||
command === 'spacetime' ||
command === 'all' ||
command === 'backend'
) {
requiredFiles.push([manifestPath, 'server-rs/Cargo.toml']);
}
if (command === 'spacetime' || command === 'all') {
if (command === 'spacetime' || command === 'all' || command === 'backend') {
requiredFiles.push([resolve(modulePath, 'Cargo.toml'), 'spacetime-module Cargo.toml']);
}
@@ -1062,12 +1069,13 @@ class DevRunner {
this.command = command;
ensureRequiredFiles(command);
requireCommand('node');
if (command === 'api-server' || command === 'all') {
if (command === 'api-server' || command === 'all' || command === 'backend') {
requireCommand('cargo');
}
if (
command === 'spacetime' ||
(command === 'all' && (!this.options.skipSpacetime || !this.options.skipPublish))
((command === 'all' || command === 'backend') &&
(!this.options.skipSpacetime || !this.options.skipPublish))
) {
requireCommand('spacetime');
}
@@ -1134,6 +1142,9 @@ class DevRunner {
if (command === 'all') {
return !this.options.skipSpacetime || !this.options.skipPublish;
}
if (command === 'backend') {
return !this.options.skipSpacetime || !this.options.skipPublish;
}
if (command === 'api-server') {
return isLoopbackSpacetimeServer(this.state.spacetimeServer);
}
@@ -1148,6 +1159,7 @@ class DevRunner {
if (
this.options.spacetimeServerUrl &&
command !== 'all' &&
command !== 'backend' &&
command !== 'spacetime'
) {
return;
@@ -1230,7 +1242,7 @@ class DevRunner {
const portRangeFor = (optionName) =>
this.explicitOptions.has(optionName) ? null : this.state.portRange;
if (command === 'all' || command === 'spacetime') {
if (command === 'all' || command === 'backend' || command === 'spacetime') {
if (!options.skipSpacetime && !this.state.spacetimeReused) {
portConfig.spacetime = {
host: options.spacetimeHost,
@@ -1240,7 +1252,7 @@ class DevRunner {
}
}
if (command === 'all' || command === 'api-server') {
if (command === 'all' || command === 'backend' || command === 'api-server') {
portConfig.api = {
host: options.apiHost,
preferredPort: options.apiPort,
@@ -1298,7 +1310,7 @@ class DevRunner {
this.state.apiTargetHost = resolveClientHost(options.apiHost);
this.state.adminWebTargetHost = resolveClientHost(options.adminWebHost);
if (command === 'all' || command === 'spacetime') {
if (command === 'all' || command === 'backend' || command === 'spacetime') {
this.state.spacetimeServer = `http://${options.spacetimeHost}:${options.spacetimePort}`;
}
this.state.apiTarget = `http://${this.state.apiTargetHost}:${options.apiPort}`;
@@ -1392,6 +1404,14 @@ class DevRunner {
return;
}
if (command === 'backend') {
await this.startSpacetimeForFullStack();
await this.services.get('api-server').start();
await this.waitForApiServer();
this.startWatchers(['spacetime', 'api-server']);
return;
}
if (command === 'spacetime') {
await this.startSpacetimeForFullStack();
} else {