@open-document/core 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{build-U81g9Hnk.js → build-C3pMGxJN.js} +1 -1
- package/dist/check-Dtwb1wvU.js +42 -0
- package/dist/cli/bin.js +24 -3
- package/dist/config-Dg1AMP0r.js +2461 -0
- package/dist/context-FoX0afRf.js +26 -0
- package/dist/{dev-DwwFT6uX.js → dev-Cdd7NZRQ.js} +1 -1
- package/dist/diagram-xlVDekYk.js +763 -0
- package/dist/export-ClJ4T1uU.js +36 -0
- package/dist/import-D7Psi8WK.js +25 -0
- package/dist/index.d.ts +235 -90
- package/dist/index.js +515 -49
- package/dist/ops/index.d.ts +96 -1
- package/dist/ops/index.js +3 -199
- package/dist/ops-Ci5Xw6QG.js +1270 -0
- package/dist/{preview-C_jbySle.js → preview-BhbCiAKC.js} +1 -1
- package/dist/sdk-CWMsH9Ms.d.ts +123 -0
- package/dist/vite/index.d.ts +6 -0
- package/dist/vite/index.js +1 -2
- package/env.d.ts +33 -1
- package/package.json +10 -1
- package/skills/create-doc/SKILL.md +6 -2
- package/skills/doc-authoring/SKILL.md +79 -0
- package/skills/doc-authoring/references/long-form.md +131 -0
- package/src/app/components/data-table.tsx +196 -0
- package/src/app/components/diagram.tsx +76 -0
- package/src/app/components/flow-page.tsx +20 -3
- package/src/app/components/footnote.tsx +196 -0
- package/src/app/components/numbering.tsx +208 -0
- package/src/app/lib/agent-bridge.ts +128 -0
- package/src/app/lib/diagnostics.ts +282 -0
- package/src/app/lib/export-html.ts +35 -11
- package/src/app/lib/export-pdf.ts +54 -19
- package/src/app/lib/flow-measure.ts +100 -31
- package/src/app/lib/flow.test.ts +46 -0
- package/src/app/lib/flow.ts +28 -3
- package/src/app/lib/footnotes.test.tsx +102 -0
- package/src/app/lib/footnotes.ts +94 -0
- package/src/app/lib/labels.ts +175 -0
- package/src/app/lib/page-context.tsx +6 -1
- package/src/app/lib/scan.ts +26 -0
- package/src/app/lib/sdk.ts +3 -0
- package/src/app/lib/use-doc-pages.ts +50 -15
- package/src/app/routes/doc.tsx +7 -4
- package/dist/config-8zkUElGq.js +0 -1169
- package/dist/design-IyRSwCtK.js +0 -52
- package/dist/edit-ops-D2W2plpc.js +0 -1190
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { g as listDocIds } from "./config-Dg1AMP0r.js";
|
|
2
|
+
import { m as closeRenderSession, p as checkLayout } from "./ops-Ci5Xw6QG.js";
|
|
3
|
+
import { t as cliContext } from "./context-FoX0afRf.js";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
//#region src/cli/check.ts
|
|
6
|
+
function line(finding) {
|
|
7
|
+
const where = finding.page > 0 ? `p.${finding.page}` : "doc";
|
|
8
|
+
const mark = finding.severity === "error" ? chalk.red("✗") : chalk.yellow("!");
|
|
9
|
+
const detail = [finding.element, finding.loc && chalk.dim(`@ ${finding.loc}`)].filter(Boolean).join(" ");
|
|
10
|
+
return ` ${mark} ${chalk.dim(where.padEnd(5))} ${finding.message}${detail ? `\n ${chalk.dim(detail)}` : ""}`;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Renders every sheet at true page size and reports the layout faults an agent
|
|
14
|
+
* writing React cannot see: content clipped by the page edge, an empty sheet, a
|
|
15
|
+
* heading stranded at the foot of a page, type too small to print.
|
|
16
|
+
*
|
|
17
|
+
* Exits non-zero when anything is an error, so it works as a CI gate.
|
|
18
|
+
*/
|
|
19
|
+
async function checkDocs(docIds, opts = {}) {
|
|
20
|
+
const ctx = await cliContext();
|
|
21
|
+
const targets = docIds.length > 0 ? docIds : await listDocIds(ctx);
|
|
22
|
+
if (targets.length === 0) throw new Error("No documents found under docs/.");
|
|
23
|
+
let errors = 0;
|
|
24
|
+
const reports = [];
|
|
25
|
+
try {
|
|
26
|
+
for (const docId of targets) {
|
|
27
|
+
const report = await checkLayout(ctx, docId);
|
|
28
|
+
reports.push(report);
|
|
29
|
+
errors += report.errors;
|
|
30
|
+
if (opts.json) continue;
|
|
31
|
+
const summary = report.errors === 0 && report.warnings === 0 ? chalk.green("clean") : [report.errors > 0 ? chalk.red(`${report.errors} error(s)`) : "", report.warnings > 0 ? chalk.yellow(`${report.warnings} warning(s)`) : ""].filter(Boolean).join(", ");
|
|
32
|
+
process.stdout.write(`${chalk.bold(docId)} ${chalk.dim(`${report.pageCount} pages`)} — ${summary}\n`);
|
|
33
|
+
for (const finding of report.findings) process.stdout.write(`${line(finding)}\n`);
|
|
34
|
+
}
|
|
35
|
+
} finally {
|
|
36
|
+
await closeRenderSession();
|
|
37
|
+
}
|
|
38
|
+
if (opts.json) process.stdout.write(`${JSON.stringify(reports, null, 2)}\n`);
|
|
39
|
+
if (errors > 0) process.exitCode = 1;
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { checkDocs };
|
package/dist/cli/bin.js
CHANGED
|
@@ -148,17 +148,38 @@ async function run(argv) {
|
|
|
148
148
|
program.name("open-doc").description("Author documents — we handle the Vite/React stack, pagination, and export.").version(version, "-v, --version", "print version").helpOption("-h, --help", "show help").showHelpAfterError(chalk.dim("(run `open-doc --help` for usage)"));
|
|
149
149
|
program.command("dev").description("Start the dev server").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").option("--no-skills-check", "skip the built-in skills drift check").option("--mcp", "serve an MCP endpoint at /mcp (requires @open-document/mcp)").action(async (flags) => {
|
|
150
150
|
if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
|
|
151
|
-
const { dev } = await import("../dev-
|
|
151
|
+
const { dev } = await import("../dev-Cdd7NZRQ.js");
|
|
152
152
|
await dev(flags);
|
|
153
153
|
});
|
|
154
154
|
program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
|
|
155
|
-
const { build } = await import("../build-
|
|
155
|
+
const { build } = await import("../build-C3pMGxJN.js");
|
|
156
156
|
await build(flags);
|
|
157
157
|
});
|
|
158
158
|
program.command("preview").description("Preview the production build").addOption(new Option("-p, --port <port>", "port to listen on").argParser(parsePort)).addOption(new Option("--host [host]", "expose on the network (optional host)")).option("--open", "open the browser on start").action(async (flags) => {
|
|
159
|
-
const { preview } = await import("../preview-
|
|
159
|
+
const { preview } = await import("../preview-BhbCiAKC.js");
|
|
160
160
|
await preview(flags);
|
|
161
161
|
});
|
|
162
|
+
program.command("export [docIds...]").description("Render documents headlessly to PDF, HTML, or PNG").addOption(new Option("-f, --format <format>", "output format").choices([
|
|
163
|
+
"pdf",
|
|
164
|
+
"html",
|
|
165
|
+
"png"
|
|
166
|
+
])).option("-o, --out-dir <dir>", "directory to write into (defaults to `out`)").option("--all", "export every document under docs/").action(async (docIds, flags) => {
|
|
167
|
+
const { exportDocs } = await import("../export-ClJ4T1uU.js");
|
|
168
|
+
await exportDocs(docIds, flags);
|
|
169
|
+
});
|
|
170
|
+
program.command("check [docIds...]").description("Report layout faults — clipped content, blank sheets, stranded headings").option("--json", "print the full report as JSON").action(async (docIds, flags) => {
|
|
171
|
+
const { checkDocs } = await import("../check-Dtwb1wvU.js");
|
|
172
|
+
await checkDocs(docIds, flags);
|
|
173
|
+
});
|
|
174
|
+
program.command("import <file>").description("Turn a Markdown file into a document under docs/").option("--id <id>", "document id (defaults to a slug of the title)").option("--title <title>", "override the title").option("--subtitle <subtitle>", "subtitle, also used as the cover eyebrow").option("--author <author>", "author line on the cover").option("--theme <theme>", "theme id to back-link from meta.theme").addOption(new Option("--page-size <size>", "page size").choices([
|
|
175
|
+
"A4",
|
|
176
|
+
"Letter",
|
|
177
|
+
"A5",
|
|
178
|
+
"Legal"
|
|
179
|
+
])).option("--no-cover", "skip the title page").option("--contents", "add a self-filling contents page").action(async (file, flags) => {
|
|
180
|
+
const { importDoc } = await import("../import-D7Psi8WK.js");
|
|
181
|
+
await importDoc(file, flags);
|
|
182
|
+
});
|
|
162
183
|
program.command("sync:skills").description("Sync built-in skills from @open-document/core into this workspace").option("--dry-run", "show what would change without writing").action(async (flags) => {
|
|
163
184
|
const { syncSkills } = await Promise.resolve().then(() => sync_exports);
|
|
164
185
|
await syncSkills(resolveBuiltinSkillsDir(), flags);
|