新增 release artifact URL workflow SDK API

This commit is contained in:
2026-06-16 13:54:53 +08:00
parent d789920d7f
commit 9015de1961
9 changed files with 305 additions and 2 deletions

View File

@@ -74,6 +74,7 @@ import {
isSupportedIniPanelLaunchApiManifest,
isSupportedIniPanelShellIntegrationManifest,
loadIniPanelShellWorkflowOverviewReleaseReadinessArtifactUrl,
loadProjectReleaseReadinessArtifactUrlWorkflow,
loadMachineSessionFromOpfs,
loadMachineSessionSnapshot,
loadMachineTextFiles,
@@ -243,6 +244,10 @@ one-call wrapper for dashboards that receive artifact JSON text. It parses,
validates, builds the validation summary, and builds the action plan. Invalid
JSON returns a blocked workflow with `parsed: false` and the same next-command
action plan instead of throwing.
`loadProjectReleaseReadinessArtifactUrlWorkflow()` is the SDK-side URL workflow
for callers that supply a `fetch` implementation. It fetches the artifact URL,
runs the JSON workflow, and returns fetch status, validation, summary, and
action-plan output without executing release gates.
## OPFS/session persistence exports

View File

@@ -10,6 +10,7 @@ export {
createProjectReleaseReadinessArtifactValidationSummaryViewModel,
createProjectReleaseReadinessReport,
createProjectReleaseReadinessSummaryViewModel,
loadProjectReleaseReadinessArtifactUrlWorkflow,
parseProjectReleaseReadinessArtifactJson,
} from "./project-release-readiness.js";
export {

View File

@@ -518,6 +518,162 @@ export function createProjectReleaseReadinessArtifactJsonWorkflow({ artifactJson
}
}
export async function loadProjectReleaseReadinessArtifactUrlWorkflow({
artifactUrl = "",
fetchRef = globalThis.fetch,
} = {}) {
if (!artifactUrl || typeof fetchRef !== "function") {
const jsonWorkflow = createProjectReleaseReadinessArtifactJsonWorkflow({ artifactJson: "" });
const missing = [
...(artifactUrl ? [] : ["artifact-url"]),
...(typeof fetchRef === "function" ? [] : ["fetch"]),
...jsonWorkflow.missing,
];
return {
apiName: "project-release-readiness-artifact-url-workflow",
workflowVersion: 1,
phase: "blocked",
ready: false,
artifactUrl,
fetched: false,
httpStatus: null,
fetchError: null,
jsonWorkflow,
validation: jsonWorkflow.validation,
summaryViewModel: jsonWorkflow.summaryViewModel,
actionPlan: jsonWorkflow.actionPlan,
missing,
rows: [
{
id: "fetch",
label: "Artifact URL fetch",
value: "blocked",
},
{
id: "json-workflow",
label: "Artifact JSON workflow",
value: "blocked",
},
{
id: "next-command",
label: "Next command",
value: jsonWorkflow.actionPlan.nextCommand ?? "none",
},
],
};
}
try {
const response = await fetchRef(artifactUrl);
const httpStatus = response?.status ?? null;
if (!response?.ok) {
const jsonWorkflow = createProjectReleaseReadinessArtifactJsonWorkflow({ artifactJson: "" });
const fetchError = `artifact URL fetch failed${httpStatus ? `: ${httpStatus}` : ""}`;
return {
apiName: "project-release-readiness-artifact-url-workflow",
workflowVersion: 1,
phase: "blocked",
ready: false,
artifactUrl,
fetched: false,
httpStatus,
fetchError,
jsonWorkflow,
validation: jsonWorkflow.validation,
summaryViewModel: jsonWorkflow.summaryViewModel,
actionPlan: jsonWorkflow.actionPlan,
missing: ["artifact-fetch", ...jsonWorkflow.missing],
rows: [
{
id: "fetch",
label: "Artifact URL fetch",
value: "blocked",
},
{
id: "json-workflow",
label: "Artifact JSON workflow",
value: "blocked",
},
{
id: "next-command",
label: "Next command",
value: jsonWorkflow.actionPlan.nextCommand ?? "none",
},
],
};
}
const artifactJson = await response.text();
const jsonWorkflow = createProjectReleaseReadinessArtifactJsonWorkflow({ artifactJson });
return {
apiName: "project-release-readiness-artifact-url-workflow",
workflowVersion: 1,
phase: jsonWorkflow.ready === true ? "ready" : "blocked",
ready: jsonWorkflow.ready === true,
artifactUrl,
fetched: true,
httpStatus,
fetchError: null,
jsonWorkflow,
validation: jsonWorkflow.validation,
summaryViewModel: jsonWorkflow.summaryViewModel,
actionPlan: jsonWorkflow.actionPlan,
missing: jsonWorkflow.missing,
rows: [
{
id: "fetch",
label: "Artifact URL fetch",
value: "ready",
},
{
id: "json-workflow",
label: "Artifact JSON workflow",
value: jsonWorkflow.ready === true ? "ready" : "blocked",
},
{
id: "next-command",
label: "Next command",
value: jsonWorkflow.actionPlan.nextCommand ?? "none",
},
],
};
} catch (error) {
const jsonWorkflow = createProjectReleaseReadinessArtifactJsonWorkflow({ artifactJson: "" });
return {
apiName: "project-release-readiness-artifact-url-workflow",
workflowVersion: 1,
phase: "blocked",
ready: false,
artifactUrl,
fetched: false,
httpStatus: null,
fetchError: error?.message ?? "artifact URL fetch error",
jsonWorkflow,
validation: jsonWorkflow.validation,
summaryViewModel: jsonWorkflow.summaryViewModel,
actionPlan: jsonWorkflow.actionPlan,
missing: ["artifact-fetch", ...jsonWorkflow.missing],
rows: [
{
id: "fetch",
label: "Artifact URL fetch",
value: "blocked",
},
{
id: "json-workflow",
label: "Artifact JSON workflow",
value: "blocked",
},
{
id: "next-command",
label: "Next command",
value: jsonWorkflow.actionPlan.nextCommand ?? "none",
},
],
};
}
}
export function createProjectReleaseReadinessArtifactValidation(artifact = {}) {
const artifactObject = objectOrEmpty(artifact);
const releaseGate = objectOrEmpty(artifactObject.releaseGate);