@open-document/core 0.12.0 → 0.13.1
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-DfUfpeTR.js → build-CvsOak5B.js} +1 -1
- package/dist/{check-CHxiOkQG.js → check-CbUBwYmf.js} +3 -3
- package/dist/cli/bin.js +47 -10
- package/dist/config-BWtOZ1jc.d.ts +45 -0
- package/dist/{config-9IdbhVuT.js → config-CltJJVsw.js} +398 -493
- package/dist/{context-BLI1-64_.js → context-CWgfsHoE.js} +2 -1
- package/dist/deploy-gcp-BUiSuqz7.js +758 -0
- package/dist/{dev-yNYKv5mm.js → dev-B8H2qT6G.js} +1 -1
- package/dist/{diagram-BK4jTZr4.js → diagram-CKf3ptOE.js} +293 -13
- package/dist/{diff-Bs205mOx.js → diff-BvIjjgnc.js} +2 -2
- package/dist/{export-tkquS5O5.js → export-DX30_s2q.js} +3 -3
- package/dist/{sdk-CHEGeINh.d.ts → flow-CS5apebG.d.ts} +72 -3
- package/dist/{import-D1hIKIr3.js → import-DgsdJT5e.js} +2 -2
- package/dist/index.d.ts +155 -59
- package/dist/index.js +896 -90
- package/dist/open-doc-plugin-DnX5usgI.js +320 -0
- package/dist/ops/index.d.ts +98 -13
- package/dist/ops/index.js +3 -3
- package/dist/{ops-Dgqujq5a.js → ops-CSR5RlrE.js} +2 -1
- package/dist/{preview-BImdTH6K.js → preview-DYMUNjXL.js} +1 -1
- package/dist/{templates-DT5zzqHq.js → templates-B5Tz0AKb.js} +3 -3
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +2 -1
- package/package.json +1 -1
- package/skills/doc-authoring/SKILL.md +15 -16
- package/skills/doc-authoring/references/long-form.md +43 -2
- package/skills/doc-authoring/references/pagination.md +14 -2
- package/skills/doc-authoring/references/tables-and-charts.md +21 -17
- package/src/app/components/callout.tsx +101 -0
- package/src/app/components/chart.tsx +191 -33
- package/src/app/components/code-block.tsx +249 -0
- package/src/app/components/data-table.tsx +146 -18
- package/src/app/components/flow-page.tsx +57 -8
- package/src/app/components/numbering.tsx +226 -12
- package/src/app/components/page-frame.tsx +42 -0
- package/src/app/lib/chart.test.ts +15 -0
- package/src/app/lib/chart.ts +134 -9
- package/src/app/lib/diagnostics.ts +45 -1
- package/src/app/lib/export-dom.ts +15 -2
- package/src/app/lib/export-pdf.ts +9 -1
- package/src/app/lib/flow-measure.ts +33 -4
- package/src/app/lib/flow.test.ts +20 -1
- package/src/app/lib/flow.ts +120 -20
- package/src/app/lib/labels.ts +29 -10
- package/src/app/lib/sdk.ts +6 -0
- package/src/app/lib/use-doc-pages.ts +23 -8
- package/src/app/routes/doc.tsx +1 -0
- package/dist/config-P61niZMf.d.ts +0 -24
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as closeRenderSession, t as checkLayout } from "./ops-
|
|
3
|
-
import { t as cliContext } from "./context-
|
|
1
|
+
import { j as listDocIds } from "./config-CltJJVsw.js";
|
|
2
|
+
import { n as closeRenderSession, t as checkLayout } from "./ops-CSR5RlrE.js";
|
|
3
|
+
import { t as cliContext } from "./context-CWgfsHoE.js";
|
|
4
4
|
import chalk from "chalk";
|
|
5
5
|
//#region src/cli/check.ts
|
|
6
6
|
function line(finding) {
|
package/dist/cli/bin.js
CHANGED
|
@@ -5,7 +5,7 @@ import chalk from "chalk";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import * as readline from "node:readline/promises";
|
|
7
7
|
import { fileURLToPath } from "node:url";
|
|
8
|
-
import { Command, Option } from "commander";
|
|
8
|
+
import { Argument, Command, Option } from "commander";
|
|
9
9
|
import fs from "node:fs/promises";
|
|
10
10
|
import { existsSync } from "node:fs";
|
|
11
11
|
//#region \0rolldown/runtime.js
|
|
@@ -107,6 +107,16 @@ function parsePort(value) {
|
|
|
107
107
|
if (!Number.isInteger(n) || n < 0 || n > 65535) throw new Error(`Invalid port: ${value}`);
|
|
108
108
|
return n;
|
|
109
109
|
}
|
|
110
|
+
const GCP_DEPLOY_ACTIONS = [
|
|
111
|
+
"up",
|
|
112
|
+
"check",
|
|
113
|
+
"status",
|
|
114
|
+
"pull",
|
|
115
|
+
"push",
|
|
116
|
+
"stop",
|
|
117
|
+
"start",
|
|
118
|
+
"down"
|
|
119
|
+
];
|
|
110
120
|
function resolveBuiltinSkillsDir() {
|
|
111
121
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
112
122
|
return path.resolve(here, "..", "..", "skills");
|
|
@@ -144,45 +154,72 @@ async function run(argv) {
|
|
|
144
154
|
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)"));
|
|
145
155
|
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) => {
|
|
146
156
|
if (flags.skillsCheck !== false) await runSkillsDriftCheck(resolveBuiltinSkillsDir());
|
|
147
|
-
const { dev } = await import("../dev-
|
|
157
|
+
const { dev } = await import("../dev-B8H2qT6G.js");
|
|
148
158
|
await dev(flags);
|
|
149
159
|
});
|
|
150
160
|
program.command("build").description("Build a static site").option("--out-dir <dir>", "output directory (defaults to `dist`)").action(async (flags) => {
|
|
151
|
-
const { build } = await import("../build-
|
|
161
|
+
const { build } = await import("../build-CvsOak5B.js");
|
|
152
162
|
await build(flags);
|
|
153
163
|
});
|
|
154
164
|
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) => {
|
|
155
|
-
const { preview } = await import("../preview-
|
|
165
|
+
const { preview } = await import("../preview-DYMUNjXL.js");
|
|
156
166
|
await preview(flags);
|
|
157
167
|
});
|
|
158
168
|
program.command("export [docIds...]").description("Render documents headlessly to PDF, HTML, PNG, or DOCX").addOption(new Option("-f, --format <format>", "output format").choices([...EXPORT_FORMATS])).option("-o, --out-dir <dir>", "directory to write into (defaults to `out`)").option("--all", "export every document under docs/").option("--each", "one copy per row of the document's `records`").option("--name <pattern>", "with --each: file name, e.g. \"certificate-{name}\" ({#} is the row number)").action(async (docIds, flags) => {
|
|
159
|
-
const { exportDocs } = await import("../export-
|
|
169
|
+
const { exportDocs } = await import("../export-DX30_s2q.js");
|
|
160
170
|
await exportDocs(docIds, flags);
|
|
161
171
|
});
|
|
162
172
|
program.command("diff <docId>").description("Show what changed in a document since a git revision, page by page").option("-s, --since <rev>", "revision to compare against (defaults to HEAD)").option("-o, --out-dir <dir>", "directory to write the report into (defaults to `out`)").option("--json", "print the result as JSON").action(async (docId, flags) => {
|
|
163
|
-
const { diffDoc } = await import("../diff-
|
|
173
|
+
const { diffDoc } = await import("../diff-BvIjjgnc.js");
|
|
164
174
|
await diffDoc(docId, flags);
|
|
165
175
|
});
|
|
166
176
|
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) => {
|
|
167
|
-
const { checkDocs } = await import("../check-
|
|
177
|
+
const { checkDocs } = await import("../check-CbUBwYmf.js");
|
|
168
178
|
await checkDocs(docIds, flags);
|
|
169
179
|
});
|
|
170
180
|
program.command("templates").description("List the templates a new document can start from").option("--json", "print them as JSON").action(async (flags) => {
|
|
171
|
-
const { printTemplates } = await import("../templates-
|
|
181
|
+
const { printTemplates } = await import("../templates-B5Tz0AKb.js");
|
|
172
182
|
await printTemplates(flags);
|
|
173
183
|
});
|
|
174
184
|
program.command("new [docId]").description("Create a document under docs/ from a template (see `open-doc templates`)").option("-t, --template <name>", "template to start from (defaults to blank)").option("--title <title>", "title of the new document").action(async (docId, flags) => {
|
|
175
|
-
const { newDoc } = await import("../templates-
|
|
185
|
+
const { newDoc } = await import("../templates-B5Tz0AKb.js");
|
|
176
186
|
await newDoc(docId, flags);
|
|
177
187
|
});
|
|
178
188
|
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("--lang <tag>", "language of the text, e.g. zh-Hant-TW (detected for CJK when omitted)").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(PAGE_SIZE_NAMES)).addOption(new Option("--orientation <orientation>", "page orientation").choices(ORIENTATIONS)).option("--no-cover", "skip the title page").option("--contents", "add a self-filling contents page").action(async (file, flags) => {
|
|
179
|
-
const { importDoc } = await import("../import-
|
|
189
|
+
const { importDoc } = await import("../import-DgsdJT5e.js");
|
|
180
190
|
await importDoc(file, flags);
|
|
181
191
|
});
|
|
182
192
|
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) => {
|
|
183
193
|
const { syncSkills } = await Promise.resolve().then(() => sync_exports);
|
|
184
194
|
await syncSkills(resolveBuiltinSkillsDir(), flags);
|
|
185
195
|
});
|
|
196
|
+
program.command("deploy").description("Deploy and manage this workspace on a cloud provider (e.g. `open-doc deploy gcp`)").command("gcp").description("Deploy to Google Cloud Run + Cloud Storage, sync files, or stop/delete the service").addArgument(new Argument("[action]", "up (deploy), check (preflight diagnostics), status, pull, push, stop, start, or down").choices([...GCP_DEPLOY_ACTIONS]).default("up")).option("--project <id>", "Google Cloud project ID").option("--region <region>", "Cloud Run and Cloud Storage region (defaults to asia-east1)").option("--service <name>", "Cloud Run service name").option("--bucket <name>", "Cloud Storage bucket name for persistent docs/assets/themes").addOption(new Option("--mode <mode>", "deployment mode: editable (GCS + MCP) or static").choices(["editable", "static"])).option("--memory <size>", "Cloud Run memory limit (defaults to 1Gi)").option("--token <token>", "Bearer token for the remote /mcp endpoint").option("--dry-run", "print the cloud commands without executing them").option("--json", "print output as JSON (for check and status)").option("--delete", "with pull/push: delete destination files missing from source").option("--pull", "with stop: pull latest files from Cloud Storage before locking service").option("--skip-pull", "with down: skip backing up files from Cloud Storage before deleting").option("--purge-storage", "with down: also delete the Cloud Storage bucket").option("-y, --yes", "skip confirmation prompts").action(async (action, flags) => {
|
|
197
|
+
const mod = await import("../deploy-gcp-BUiSuqz7.js");
|
|
198
|
+
switch (action) {
|
|
199
|
+
case "up":
|
|
200
|
+
await mod.runGcpUp(flags);
|
|
201
|
+
break;
|
|
202
|
+
case "check":
|
|
203
|
+
await mod.runGcpCheck(flags);
|
|
204
|
+
break;
|
|
205
|
+
case "status":
|
|
206
|
+
await mod.runGcpStatus(flags);
|
|
207
|
+
break;
|
|
208
|
+
case "pull":
|
|
209
|
+
await mod.runGcpPull(flags);
|
|
210
|
+
break;
|
|
211
|
+
case "push":
|
|
212
|
+
await mod.runGcpPush(flags);
|
|
213
|
+
break;
|
|
214
|
+
case "stop":
|
|
215
|
+
await mod.runGcpStop(flags);
|
|
216
|
+
break;
|
|
217
|
+
case "start":
|
|
218
|
+
await mod.runGcpStart(flags);
|
|
219
|
+
break;
|
|
220
|
+
case "down": await mod.runGcpDown(flags);
|
|
221
|
+
}
|
|
222
|
+
});
|
|
186
223
|
await program.parseAsync(argv, { from: "user" });
|
|
187
224
|
}
|
|
188
225
|
//#endregion
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
//#region src/config.d.ts
|
|
2
|
+
type OpenDocBuildConfig = {
|
|
3
|
+
/** Ship the document browser (`/`) in the static build. Defaults to true. */
|
|
4
|
+
showDocBrowser?: boolean;
|
|
5
|
+
/** Offer the "Export HTML" button in the static build. Defaults to true. */
|
|
6
|
+
allowHtmlExport?: boolean;
|
|
7
|
+
};
|
|
8
|
+
type OpenDocGcpDeployConfig = {
|
|
9
|
+
/** Google Cloud project ID. Falls back to `--project` or `gcloud config`. */
|
|
10
|
+
project?: string;
|
|
11
|
+
/** Cloud Run and Cloud Storage region. Defaults to `asia-east1`. */
|
|
12
|
+
region?: string;
|
|
13
|
+
/** Cloud Run service name. Defaults to package name or directory name. */
|
|
14
|
+
service?: string;
|
|
15
|
+
/** Cloud Storage bucket name for persistent docs/assets/themes. */
|
|
16
|
+
bucket?: string;
|
|
17
|
+
/**
|
|
18
|
+
* `editable` runs `open-doc dev --mcp` backed by GCS FUSE so edits and
|
|
19
|
+
* Antigravity MCP calls persist. `static` builds a read-only bundle.
|
|
20
|
+
*/
|
|
21
|
+
mode?: 'editable' | 'static';
|
|
22
|
+
/** Cloud Run container memory limit. Defaults to `1Gi`. */
|
|
23
|
+
memory?: string;
|
|
24
|
+
};
|
|
25
|
+
type OpenDocDeployConfig = {
|
|
26
|
+
gcp?: OpenDocGcpDeployConfig;
|
|
27
|
+
};
|
|
28
|
+
type OpenDocConfig = {
|
|
29
|
+
base?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Where the viewer's back affordance goes. Unset it points at this app's own
|
|
32
|
+
* document browser; set it to escape the app entirely — a viewer mounted
|
|
33
|
+
* under a larger site needs to return to that site, not to its own index.
|
|
34
|
+
*/
|
|
35
|
+
home?: string;
|
|
36
|
+
docsDir?: string;
|
|
37
|
+
themesDir?: string;
|
|
38
|
+
assetsDir?: string;
|
|
39
|
+
port?: number;
|
|
40
|
+
allowedHosts?: string[] | true;
|
|
41
|
+
build?: OpenDocBuildConfig;
|
|
42
|
+
deploy?: OpenDocDeployConfig;
|
|
43
|
+
};
|
|
44
|
+
//#endregion
|
|
45
|
+
export { OpenDocGcpDeployConfig as i, OpenDocConfig as n, OpenDocDeployConfig as r, OpenDocBuildConfig as t };
|