feat: 清理openspec

This commit is contained in:
npc0-hue
2026-08-20 17:58:36 +08:00
parent 49669a9d5d
commit 40b35b05c7
522 changed files with 168 additions and 19538 deletions
+6 -5
View File
@@ -183,7 +183,7 @@ describe("first-party console pages", () => {
expect(serverDeploymentWorkflowSource).toContain("基本信息");
expect(serverDeploymentWorkflowSource).toContain("部署方式");
expect(serverDeploymentWorkflowSource).toContain("相关配置");
expect(serverDeploymentWorkflowSource).toContain("专属 Run");
expect(serverDeploymentWorkflowSource).toContain("自动上报心跳");
expect(serverDeploymentWorkflowSource).toContain("创建服务器");
expect(serverDeploymentWorkflowSource).toContain("执行目录(可选)");
expect(serverDeploymentWorkflowSource).toContain("默认使用服务器目录");
@@ -197,8 +197,7 @@ describe("first-party console pages", () => {
expect(serverDeploymentWorkflowSource).toContain("接管已有服务器执行流程");
expect(serverDeploymentWorkflowSource).toContain("不需要填写 SteamCMD 目录");
expect(serverDeploymentWorkflowSource).toContain("当前平台尚未提供 SCUM 服务端的受控升级任务");
expect(serverDeploymentWorkflowSource).toContain("已绑定服务器编辑时会直接进入相关配置");
expect(serverDeploymentWorkflowSource).toContain("可在此调整部署方式;不会重复要求选择已绑定的运行节点");
expect(serverDeploymentWorkflowSource).toContain("Run 会按心跳自动识别服务器");
expect(serversPageSource).toContain('onNavigate("serverDetail", { serverId: result.instance.id })');
expect(serverDetailPageSource).not.toContain("运行配置绑定");
expect(serverDetailPageSource).not.toContain('type={field.sensitive ? "password" : "text"}');
@@ -252,8 +251,10 @@ describe("first-party console pages", () => {
expect(serverDeploymentWorkflowSource).toContain("配置启动项");
expect(serverDeploymentWorkflowSource).toContain("本次保存创建向导配置");
expect(serverDeploymentWorkflowSource).toContain('const modeStep = kind === "create" ? 1 : -1;');
expect(serverDeploymentWorkflowSource).toContain('const configurationStep = kind === "create" ? 2 : needsTargetSelection ? 1 : 0;');
expect(serverDeploymentWorkflowSource).toContain('const needsTargetSelection = kind === "edit" && !initialForm.runEndpointId;');
expect(serverDeploymentWorkflowSource).toContain('const configurationStep = kind === "create" ? 2 : 0;');
expect(serverDeploymentWorkflowSource).not.toContain("needsTargetSelection");
expect(serverDeploymentWorkflowSource).not.toContain('name="runEndpointId"');
expect(serverDeploymentWorkflowSource).not.toContain("profileKey");
expect(serversPageSource).toContain("serverCreateRequestFromForm(nextForm)");
expect(serverCreateSchemaSource).not.toContain("runEndpointId: form.runEndpointId");
expect(serverCreateSchemaSource).not.toContain("deploymentTargetId: form.deploymentTargetId");
+1 -1
View File
@@ -120,7 +120,7 @@ describe("ServerDetailPage config write approval", () => {
expect(serverDetailPageSource).not.toContain('capability: "process.stop"');
});
it("leaves guided deployment to the dedicated Run registration workflow", () => {
it("leaves guided deployment to the generated Run heartbeat workflow", () => {
expect(serverDetailPageSource).not.toContain("canDeployServer(instance.data.state)");
expect(serverDetailPageSource).not.toContain("requestDeployment(instance.data)");
expect(serverDetailPageSource).not.toContain("platformApiClient.deployServerInstance(current.id");
+1 -1
View File
@@ -206,7 +206,7 @@ export function ServerDetailPage(props: PageComponentProps) {
<div>
<h1 id="server-detail-title">{instance.data.name}</h1>
<span className="provider-id">
{instance.data.id} · {instance.data.pluginId}@{instance.data.pluginVersion} · {instance.data.runEndpointId}
{instance.data.id} · {instance.data.pluginId}@{instance.data.pluginVersion} · Run {runEndpoint ? "已自动附着" : "等待上报"}
</span>
</div>
<div className="action-strip">
+7 -14
View File
@@ -22,7 +22,6 @@ import type { PageComponentProps } from "../contracts/page";
import {
canDeleteServer,
defaultServerCreateForm,
endpointLabel,
pluginCreateInputDefaults,
runtimeObservationFreshness,
type ServerCreateFormState
@@ -72,7 +71,7 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
const [metricsError, setMetricsError] = useState("");
const [keyword, setKeyword] = useState("");
const [statusFilter, setStatusFilter] = useState<ServerStatusFilter>("all");
const [form, setForm] = useState<ServerCreateFormState>(() => defaultServerCreateForm([], []));
const [form, setForm] = useState<ServerCreateFormState>(() => defaultServerCreateForm([]));
const [showCreate, setShowCreate] = useState(false);
const [editDeployment, setEditDeployment] = useState<{ instance: ServerInstanceResponse; deployment: import("../api/types").ServerDeploymentResponse } | null>(null);
const runtimeTask = useRuntimeTaskController();
@@ -98,15 +97,9 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
setJobs(jobResponse.items);
if (showLoading) setForm((current) => {
const plugin = pluginResponse.items.find((item) => item.id === current.pluginId) ?? pluginResponse.items[0];
const profileKey = plugin?.runtimeProfiles?.lifecycleProfiles?.some((profile) => profile.key === current.profileKey)
? current.profileKey
: plugin?.runtimeProfiles?.lifecycleProfiles?.[0]?.key ?? "";
return {
...current,
pluginId: plugin?.id ?? "",
profileKey,
bindings: plugin?.id === current.pluginId && profileKey === current.profileKey ? current.bindings : {},
runEndpointId: endpointResponse.items.some((endpoint) => endpoint.id === current.runEndpointId) ? current.runEndpointId : ""
};
});
if (showLoading) {
@@ -170,8 +163,8 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
const operationId = operations.begin({ intent: "创建服务器", targetKind: "server", targetId: "platform", requester: session.displayName });
try {
const result = await platformApiClient.createServerWorkflow(serverCreateRequestFromForm(nextForm));
operations.succeed(operationId, result.job.id ? `已创建实例 ${result.instance.id},安装任务 ${result.job.id} 已派发` : `已创建服务器 ${result.instance.id};部署方式和启动项已随创建向导保存,请生成并启动专属 Run。`, result.job.id ? result.job : undefined);
setForm(defaultServerCreateForm(plugins, endpoints));
operations.succeed(operationId, result.job.id ? `已创建实例 ${result.instance.id},安装任务 ${result.job.id} 已派发` : `已创建服务器 ${result.instance.id};部署方式和启动项已随创建向导保存,请生成并启动 Run。`, result.job.id ? result.job : undefined);
setForm(defaultServerCreateForm(plugins));
setShowCreate(false);
await refresh();
onNavigate("serverDetail", { serverId: result.instance.id });
@@ -184,7 +177,7 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
try {
const deployment = await platformApiClient.getServerDeployment(instance.id);
const plugin = plugins.find((item) => item.id === instance.pluginId);
setForm({ ...defaultServerCreateForm(plugins, endpoints), name: instance.name, pluginId: instance.pluginId, runEndpointId: instance.runEndpointId, profileKey: deployment.profileKey ?? plugin?.runtimeProfiles?.lifecycleProfiles?.[0]?.key ?? "", createInputs: deployment.createInputs ?? pluginCreateInputDefaults(plugin), deploymentMode: deployment.mode ?? "guided-install", shell: deployment.shell ?? "" });
setForm({ ...defaultServerCreateForm(plugins), name: instance.name, pluginId: instance.pluginId, createInputs: deployment.createInputs ?? pluginCreateInputDefaults(plugin), deploymentMode: deployment.mode ?? "guided-install", shell: deployment.shell ?? "" });
setEditDeployment({ instance, deployment });
} catch (error) {
const operationId = operations.begin({ intent: "读取部署设置", targetKind: "server", targetId: instance.id, requester: session.displayName });
@@ -197,7 +190,7 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
const { instance } = editDeployment;
const operationId = operations.begin({ intent: "更新部署定义", targetKind: "server", targetId: instance.id, requester: session.displayName });
try {
await platformApiClient.updateServerDeployment(instance.id, { runEndpointId: nextForm.runEndpointId || undefined, mode: nextForm.deploymentMode, profileKey: nextForm.profileKey || undefined, createInputs: nextForm.createInputs, serverRoot: nextForm.serverRoot.trim() || undefined, workingDirectory: nextForm.workingDirectory.trim() || undefined, installCommand: nextForm.installCommand.trim() || undefined, startCommand: nextForm.startCommand.trim() || undefined, stopCommand: nextForm.stopCommand.trim() || undefined, statusCommand: nextForm.statusCommand.trim() || undefined, shell: nextForm.shell || undefined });
await platformApiClient.updateServerDeployment(instance.id, { mode: nextForm.deploymentMode, createInputs: nextForm.createInputs, serverRoot: nextForm.serverRoot.trim() || undefined, workingDirectory: nextForm.workingDirectory.trim() || undefined, installCommand: nextForm.installCommand.trim() || undefined, startCommand: nextForm.startCommand.trim() || undefined, stopCommand: nextForm.stopCommand.trim() || undefined, statusCommand: nextForm.statusCommand.trim() || undefined, shell: nextForm.shell || undefined });
operations.succeed(operationId, "部署设置已保存;路径和命令保持受保护状态。");
setEditDeployment(null);
await refresh();
@@ -504,8 +497,8 @@ export function ServersPage({ session, operations, onNavigate }: PageComponentPr
</div>
)}
<ServerDeploymentWorkflow open={showCreate && canManageServers} kind="create" plugins={plugins} endpoints={endpoints} initialForm={form} busy={createPending} onClose={() => setShowCreate(false)} onSubmit={handleCreate} />
<ServerDeploymentWorkflow open={editDeployment !== null} kind="edit" plugins={plugins} endpoints={endpoints} initialForm={form} deployment={editDeployment?.deployment} busy={editDeployment ? operations.isPending(editDeployment.instance.id, "更新部署定义") : false} onReveal={() => platformApiClient.revealServerDeployment(editDeployment?.instance.id ?? "")} onClose={() => setEditDeployment(null)} onSubmit={handleUpdateDeployment} />
<ServerDeploymentWorkflow open={showCreate && canManageServers} kind="create" plugins={plugins} initialForm={form} busy={createPending} onClose={() => setShowCreate(false)} onSubmit={handleCreate} />
<ServerDeploymentWorkflow open={editDeployment !== null} kind="edit" plugins={plugins} initialForm={form} deployment={editDeployment?.deployment} busy={editDeployment ? operations.isPending(editDeployment.instance.id, "更新部署定义") : false} onReveal={() => platformApiClient.revealServerDeployment(editDeployment?.instance.id ?? "")} onClose={() => setEditDeployment(null)} onSubmit={handleUpdateDeployment} />
<ManagementDialog
open={runTargetSelection !== null}