feat(task-017): implement git publishing dry-run and commit flow
This commit is contained in:
@@ -11,6 +11,7 @@ export type DetailSummary = {
|
||||
articleId: string;
|
||||
status: string;
|
||||
publishingStatus: string;
|
||||
publishingValidationLabel: string;
|
||||
briefDescription: string;
|
||||
targetSite: string;
|
||||
updatedAt: string;
|
||||
@@ -47,6 +48,7 @@ export function buildDetailSummary(detail: ArticleDetailResponse): DetailSummary
|
||||
articleId: detail.article.id,
|
||||
status: detail.article.status,
|
||||
publishingStatus: detail.article.publishing_status,
|
||||
publishingValidationLabel: resolvePublishingValidationLabel(detail),
|
||||
briefDescription: detail.article.brief_description,
|
||||
targetSite: detail.target_site?.name ?? "Unknown",
|
||||
updatedAt: detail.article.updated_at,
|
||||
@@ -55,6 +57,20 @@ export function buildDetailSummary(detail: ArticleDetailResponse): DetailSummary
|
||||
};
|
||||
}
|
||||
|
||||
function resolvePublishingValidationLabel(detail: ArticleDetailResponse): string {
|
||||
const manifest = detail.publish_commit?.content_bundle_manifest;
|
||||
if (manifest && typeof manifest === "object") {
|
||||
const validation = (manifest as Record<string, unknown>).validation;
|
||||
if (validation && typeof validation === "object") {
|
||||
const label = (validation as Record<string, unknown>).label;
|
||||
if (typeof label === "string" && label.trim()) {
|
||||
return label;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "Best-effort content-shape validation only.";
|
||||
}
|
||||
|
||||
export function buildProductionArtifactRows(
|
||||
jobs: readonly AgentJobSummary[],
|
||||
): ProductionArtifactRow[] {
|
||||
|
||||
@@ -26,6 +26,10 @@ export function ArticleDetailShell({ summary }: DetailShellProps) {
|
||||
<dt>Publishing status</dt>
|
||||
<dd>{summary.publishingStatus}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Validation</dt>
|
||||
<dd>{summary.publishingValidationLabel}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Target site</dt>
|
||||
<dd>{summary.targetSite}</dd>
|
||||
|
||||
@@ -15,7 +15,7 @@ const compiled = ts.transpileModule(source, {
|
||||
const moduleExports = {};
|
||||
new Function("exports", compiled.outputText)(moduleExports);
|
||||
|
||||
const { buildProductionArtifactRows } = moduleExports;
|
||||
const { buildDetailSummary, buildProductionArtifactRows } = moduleExports;
|
||||
|
||||
const rows = buildProductionArtifactRows([
|
||||
{
|
||||
@@ -102,3 +102,40 @@ assert.equal(rows[0].status, "SUCCEEDED");
|
||||
assert.deepEqual(rows[0].usedEvidenceIds, ["e1", "e2"]);
|
||||
assert.equal(rows[1].status, "FAILED");
|
||||
assert.deepEqual(rows[1].unsupportedClaims, ["Unverified claim"]);
|
||||
|
||||
const detailSummary = buildDetailSummary({
|
||||
article: {
|
||||
id: "a1",
|
||||
target_site_id: "site1",
|
||||
status: "PUBLISH_COMMIT_CREATED",
|
||||
publishing_status: "PUBLISH_COMMIT_CREATED",
|
||||
brief_description: "desc",
|
||||
language: "en",
|
||||
content_type: "longform_guide",
|
||||
created_at: "2026-05-21T00:00:00Z",
|
||||
updated_at: "2026-05-21T00:00:00Z",
|
||||
},
|
||||
target_site: { name: "Demo Site" },
|
||||
workflow_events: [],
|
||||
agent_jobs: [],
|
||||
publish_commit: {
|
||||
id: "pc1",
|
||||
article_id: "a1",
|
||||
target_site_id: "site1",
|
||||
repository_url: "/tmp/repo.git",
|
||||
branch: "main",
|
||||
commit_sha: "abc123",
|
||||
status: "PUBLISH_COMMIT_CREATED",
|
||||
created_at: "2026-05-21T00:00:00Z",
|
||||
content_bundle_manifest: {
|
||||
validation: {
|
||||
label: "Best-effort content-shape validation only.",
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
detailSummary.publishingValidationLabel,
|
||||
"Best-effort content-shape validation only.",
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user