feat: 自动更新
This commit is contained in:
@@ -222,45 +222,37 @@ const fs = require("fs");
|
||||
const manifestPath = process.argv[2];
|
||||
const outputPath = process.argv[3];
|
||||
const source = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
|
||||
const localRunCapabilities = [
|
||||
"process.install",
|
||||
"process.start",
|
||||
"process.stop",
|
||||
"logs.read",
|
||||
"run.self-update",
|
||||
"dependencies.check",
|
||||
"dependencies.install",
|
||||
"logs.backfill",
|
||||
...source.capabilities.filter((capability) => capability.startsWith("remote."))
|
||||
];
|
||||
const manifest = {
|
||||
id: source.id,
|
||||
name: source.name,
|
||||
description: "SCUM local proof plugin",
|
||||
description: source.description,
|
||||
version: source.version,
|
||||
kind: "game-plugin",
|
||||
kind: source.kind,
|
||||
tags: source.tags,
|
||||
server: {
|
||||
type: source.server.type,
|
||||
displayName: source.server.displayName,
|
||||
supportedOs: ["linux"],
|
||||
supportedOs: source.server.supportedOS || source.server.supportedOs || [],
|
||||
createFormSchema: source.server.createFormSchema
|
||||
},
|
||||
capabilities: ["process.install", "process.start", "process.stop"],
|
||||
permissions: ["server.create", "server.read", "server.lifecycle", "server.logs.read", "server.artifacts.read"],
|
||||
actions: {
|
||||
install: source.actions.install,
|
||||
start: source.actions.start,
|
||||
stop: source.actions.stop,
|
||||
restart: source.actions.restart
|
||||
},
|
||||
pages: [
|
||||
{
|
||||
key: "overview",
|
||||
title: "SCUM Overview",
|
||||
path: "/overview",
|
||||
permissions: ["server.read", "server.lifecycle", "server.logs.read", "server.artifacts.read"],
|
||||
bridgeActions: ["server.instances.read", "jobs.dispatch", "logs.query", "artifacts.open"]
|
||||
},
|
||||
{
|
||||
key: "logs",
|
||||
title: "SCUM Logs",
|
||||
path: "/logs",
|
||||
permissions: ["server.read", "server.lifecycle", "server.logs.read", "server.artifacts.read"],
|
||||
bridgeActions: ["server.instances.read", "jobs.dispatch", "logs.query", "artifacts.open"]
|
||||
}
|
||||
],
|
||||
bridge: { actions: ["server.instances.read", "jobs.dispatch", "logs.query", "artifacts.open"] },
|
||||
ai: { purposes: [] }
|
||||
capabilities: localRunCapabilities,
|
||||
permissions: source.permissions,
|
||||
actions: source.actions,
|
||||
pages: source.pages,
|
||||
bridge: source.bridge,
|
||||
ai: source.ai,
|
||||
remoteAccess: source.remoteAccess
|
||||
};
|
||||
fs.writeFileSync(outputPath, JSON.stringify({
|
||||
manifestRef: "artifact://manifests/game.scum/0.1.0",
|
||||
@@ -314,6 +306,14 @@ cat >"$WORK_DIR/create-scum-beta.request.json" <<JSON
|
||||
}
|
||||
JSON
|
||||
|
||||
cat >"$WORK_DIR/scum-alpha-run-generate.request.json" <<JSON
|
||||
{
|
||||
"targetOs": "windows",
|
||||
"targetArch": "amd64",
|
||||
"idempotencyKey": "local-debug-scum-alpha-run-generate"
|
||||
}
|
||||
JSON
|
||||
|
||||
printf 'creating server lifecycle workflow through platform API\n'
|
||||
if ! curl -fsS -H 'Content-Type: application/json' "${AUTH_HEADER[@]}" --data-binary "@$WORK_DIR/create-server.request.json" "$API_URL/server-instances/workflows/create" >"$WORK_DIR/create-server.response.json"; then
|
||||
json_get "$API_URL/server-instances/server-local-debug" "$WORK_DIR/create-server.response.json" "${AUTH_HEADER[@]}"
|
||||
@@ -336,6 +336,28 @@ SERVER_ID="$(json_id "$WORK_DIR/create-server.response.json")"
|
||||
SCUM_ALPHA_ID="$(json_id "$WORK_DIR/create-scum-alpha.response.json")"
|
||||
SCUM_BETA_ID="$(json_id "$WORK_DIR/create-scum-beta.response.json")"
|
||||
|
||||
printf 'checking SCUM runtime distribution action\n'
|
||||
json_get "$API_URL/server-instances/$SCUM_ALPHA_ID/runtime/actions" "$WORK_DIR/scum-alpha-runtime-actions.response.json" "${AUTH_HEADER[@]}"
|
||||
reject_forbidden_fragments "$WORK_DIR/scum-alpha-runtime-actions.response.json"
|
||||
require_file_contains "$WORK_DIR/scum-alpha-runtime-actions.response.json" '"key"[[:space:]]*:[[:space:]]*"generate-run"'
|
||||
node - "$WORK_DIR/scum-alpha-runtime-actions.response.json" <<'NODE'
|
||||
const fs = require("fs");
|
||||
const response = JSON.parse(fs.readFileSync(process.argv[2], "utf8"));
|
||||
const action = (response.actions || []).find((candidate) => candidate.key === "generate-run");
|
||||
if (!action || action.available !== true) {
|
||||
console.error("expected SCUM generate-run action to be available");
|
||||
console.error(JSON.stringify(response, null, 2));
|
||||
process.exit(1);
|
||||
}
|
||||
NODE
|
||||
|
||||
printf 'generating SCUM run package through platform API\n'
|
||||
curl -fsS -H 'Content-Type: application/json' "${AUTH_HEADER[@]}" --data-binary "@$WORK_DIR/scum-alpha-run-generate.request.json" "$API_URL/server-instances/$SCUM_ALPHA_ID/run/generate" >"$WORK_DIR/scum-alpha-run-generate.response.json"
|
||||
reject_forbidden_fragments "$WORK_DIR/scum-alpha-run-generate.response.json"
|
||||
require_file_contains "$WORK_DIR/scum-alpha-run-generate.response.json" '"serverInstanceId"[[:space:]]*:[[:space:]]*"scum-alpha"'
|
||||
require_file_contains "$WORK_DIR/scum-alpha-run-generate.response.json" '"artifactId"[[:space:]]*:[[:space:]]*"artifact-run-dist-scum-alpha'
|
||||
require_file_contains "$WORK_DIR/scum-alpha-run-generate.response.json" '"checksum"[[:space:]]*:[[:space:]]*"sha256:'
|
||||
|
||||
printf 'checking jobs, logs, artifacts, and marketplace refs\n'
|
||||
json_get "$API_URL/server-instances" "$WORK_DIR/server-instances.response.json" "${AUTH_HEADER[@]}"
|
||||
json_get "$API_URL/jobs?serverInstanceId=$SERVER_ID" "$WORK_DIR/jobs.response.json" "${AUTH_HEADER[@]}"
|
||||
@@ -346,10 +368,11 @@ json_get "$API_URL/artifacts" "$WORK_DIR/artifacts.response.json" "${AUTH_HEADER
|
||||
json_get "$API_URL/plugin-marketplace/plugins" "$WORK_DIR/marketplace.response.json" "${AUTH_HEADER[@]}"
|
||||
json_get "$API_URL/plugin-marketplace/plugins?serverType=scum&keyword=scum" "$WORK_DIR/scum-marketplace.response.json" "${AUTH_HEADER[@]}"
|
||||
require_file_contains "$WORK_DIR/scum-marketplace.response.json" '"id"[[:space:]]*:[[:space:]]*"game.scum"'
|
||||
require_file_contains "$WORK_DIR/artifacts.response.json" '"id"[[:space:]]*:[[:space:]]*"artifact-run-dist-scum-alpha'
|
||||
require_file_contains "$WORK_DIR/scum-alpha-jobs.response.json" '"serverInstanceId"[[:space:]]*:[[:space:]]*"scum-alpha"'
|
||||
require_file_contains "$WORK_DIR/scum-beta-jobs.response.json" '"serverInstanceId"[[:space:]]*:[[:space:]]*"scum-beta"'
|
||||
|
||||
for file in "$WORK_DIR"/server-instances.response.json "$WORK_DIR"/jobs.response.json "$WORK_DIR"/scum-alpha-jobs.response.json "$WORK_DIR"/scum-beta-jobs.response.json "$WORK_DIR"/log-streams.response.json "$WORK_DIR"/artifacts.response.json "$WORK_DIR"/marketplace.response.json "$WORK_DIR"/scum-marketplace.response.json; do
|
||||
for file in "$WORK_DIR"/server-instances.response.json "$WORK_DIR"/jobs.response.json "$WORK_DIR"/scum-alpha-jobs.response.json "$WORK_DIR"/scum-beta-jobs.response.json "$WORK_DIR"/log-streams.response.json "$WORK_DIR"/artifacts.response.json "$WORK_DIR"/marketplace.response.json "$WORK_DIR"/scum-marketplace.response.json "$WORK_DIR"/scum-alpha-runtime-actions.response.json "$WORK_DIR"/scum-alpha-run-generate.response.json; do
|
||||
reject_forbidden_fragments "$file"
|
||||
done
|
||||
|
||||
@@ -366,8 +389,8 @@ if [[ "$VITE_ENABLE_LOCAL_AUTH_FALLBACK" != "false" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat >"$WORK_DIR/browser-walkthrough-checklist.md" <<EOF
|
||||
# Local Debug Browser Walkthrough
|
||||
cat >"$WORK_DIR/local-ui-checklist.md" <<EOF
|
||||
# Local Debug UI Checklist
|
||||
|
||||
- Open $(local_debug_web_url)
|
||||
- Login with operator.local@example.test / operator-local.
|
||||
|
||||
Reference in New Issue
Block a user