M0 (product shell / user entry): /login page, app-shell nav with current user + role + logout, real project list (replaces hardcoded demoProjects), create-project + auto first-version, role-aware home entries. Auth uses native-form + 303 PRG redirect + HttpOnly huijing_api_token cookie; new proxies for auth(login/logout/me) and projects(create/version). M1 (creator flow): surface deterministic-generator demo label; switch prompt/save/compile routes from raw-JSON passthrough to PRG redirect back to workbench + status banner; 401/403 -> /login, empty-state create-version fallback. M1-T5 (per-version playable preview) deferred to M2 (Path A): verified blockers = stub logic compiler + no package-serving endpoint + tested S2 boundary; workbench honestly labels preview as a later capability and links the fixture as a clearly-marked platform sample (no orphan jump, S2 boundary untouched). Verification (@huijing/web): typecheck + lint + 88 unit tests + next build + git diff --check all green. End-to-end (DB-backed create/generate/save/compile) requires real Postgres and is not claimed verified in-sandbox. Docs: docs/agent-specs/2026-06-06-MVP用户可试用M0M1-执行版.md (execution plan + status), docs/agent-specs/2026-06-06-M1T5预览试玩-审阅版.md (M1-T5 review/decision), docs/memorys/2026-06-06-MVP可试用M0M1执行版.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
14 lines
587 B
TypeScript
14 lines
587 B
TypeScript
import { apiBaseUrlFromEnv, createProjectThenVersionAndRedirect } from "../proxy";
|
||
|
||
// POST /api/workbench/projects:原生表单提交 → 创建项目 + 自动建首个 draft version → 303 跳项目工作台。
|
||
// 失败回创建页并带 ?error=create 提示。
|
||
export async function POST(request: Request): Promise<Response> {
|
||
return createProjectThenVersionAndRedirect(
|
||
{ apiBaseUrl: apiBaseUrlFromEnv(), request },
|
||
{
|
||
failureLocation: "/workbench/new?error=create",
|
||
projectLocation: (projectId) => `/workbench/${encodeURIComponent(projectId)}`
|
||
}
|
||
);
|
||
}
|