Skip to content
19 changes: 19 additions & 0 deletions packages/cli/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { runIngest } from "./commands/ingest.js";
import { runTagSync } from "./commands/tag-sync.js";
import { runTagReconcile } from "./commands/tag-reconcile.js";
import { runPagePublish } from "./commands/page-publish.js";
import { runPageRenderHtml } from "./commands/page-render-html.js";
import { runProjectPagePublish } from "./commands/project-page-publish.js";
import { runSyncStatus, runSyncPush, runSyncPull, runSyncLock, runSyncUnlock, runSyncPeers, runSyncLintDelta } from "./commands/sync.js";
import { runSyncJournalList, runSyncJournalClearStale } from "./commands/sync-journal.js";
Expand Down Expand Up @@ -789,6 +790,21 @@ pageCmd
);
});

pageCmd
.command("render-html <page> [vault]")
.description("render an opted-in typed page to a self-contained HTML file")
.requiredOption("--out <file>", "output HTML path (must be outside the vault)")
.option("--wiki <name>", "wiki profile name")
.action(async (page, vault, opts) => {
const resolved = await resolveVaultArg(vault, opts.wiki);
if (!resolved.ok) return emit({ exitCode: resolved.exitCode, result: resolved.payload });
return emit(await runPageRenderHtml({
vault: resolved.vault,
page,
out: opts.out,
}), resolved.vault, { postCommit: false });
});

const projectPageCmd = program.command("project-page").description("publish project-local architecture pages");

projectPageCmd
Expand Down Expand Up @@ -2054,6 +2070,7 @@ program
.requiredOption("--title <title>", "page title")
.option("--tags <csv>", "comma-separated tags")
.option("--provenance <provenance>", "provenance (research|project)")
.option("--html", "stamp html_render: true on the typed stub", false)
.option("--dry-run", "preview without writing files", false)
.action(async (source, opts) => {
const tags = typeof opts.tags === "string"
Expand All @@ -2067,6 +2084,7 @@ program
title: opts.title,
tags,
provenance: opts.provenance,
html: !!opts.html,
dryRun: true,
}), opts.vault);
return;
Expand All @@ -2081,6 +2099,7 @@ program
title: opts.title,
tags,
provenance: opts.provenance,
html: !!opts.html,
dryRun: false,
})
);
Expand Down
9 changes: 8 additions & 1 deletion packages/cli/src/commands/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
type DoctorOutput,
} from "./doctor.js";
import { runLint, type LintBucketSummary, type LintSummaryOutput, type LintSeverity } from "./lint.js";
import { isAdvisoryLintWarning } from "../lint/helpers.js";
import { inventorySources } from "../utils/source-lifecycle.js";
import { VAULT_SYNC_FILTER_REQUIRED_EXCLUDES } from "../utils/vault-hygiene-ignores.js";

Expand Down Expand Up @@ -645,7 +646,13 @@ export async function runHealth(input: HealthInput): Promise<{ exitCode: number;
checks: doctor.result.data.checks.map(check => ({ id: check.id, status: check.status, detail: check.detail })),
};
const lintComponent: LintComponent = {
status: statusFromCounts({ error: lint.result.data.summary.errors, warnings: lint.result.data.summary.warnings, info: lint.result.data.summary.info }),
status: statusFromCounts({
error: lint.result.data.summary.errors,
warnings: lint.result.data.buckets
.filter((bucket) => bucket.severity === "warning" && !isAdvisoryLintWarning(bucket.kind))
.reduce((n, bucket) => n + bucket.count, 0),
info: lint.result.data.summary.info,
}),
blocking: true,
summary: lint.result.data.summary,
buckets: lint.result.data.buckets,
Expand Down
12 changes: 10 additions & 2 deletions packages/cli/src/commands/ingest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export interface IngestInput {
tags?: string[];
provenance?: string;
dryRun?: boolean;
html?: boolean;
}

export interface IngestOutput {
Expand Down Expand Up @@ -95,7 +96,8 @@ function buildTypedContent(
type: string,
tags: string[],
rawRelPath: string,
provenance: string | undefined
provenance: string | undefined,
html?: boolean
): string {
const aliases: string[] = [];
const sourcesYaml = ` - ${rawRelPath}`;
Expand All @@ -120,6 +122,10 @@ function buildTypedContent(
if (provenance) {
fmLines.push(`provenance: ${provenance}`);
}
fmLines.push("output_standard: v2");
if (html) {
fmLines.push("html_render: true");
}
fmLines.push("---");
fmLines.push("");

Expand Down Expand Up @@ -412,7 +418,8 @@ export async function runIngest(
input.type,
tags,
rawRelPath,
input.provenance
input.provenance,
input.html
);

// The publisher resolves and validates the final target path, so create the
Expand Down Expand Up @@ -513,6 +520,7 @@ export async function runIngest(
tags,
rawRelPath,
input.provenance,
input.html,
);
const refreshedPublication = preparePagePublicationFromContent({
vault: input.vault,
Expand Down
Loading
Loading