@open-press/cli 0.8.0 → 1.0.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/README.md +25 -14
- package/dist/cli.js +44 -195
- package/package.json +4 -5
- package/template/core/AGENTS.md +18 -14
- package/template/core/CHANGELOG.md +12 -9
- package/template/core/README.md +6 -3
- package/template/core/engine/cli.mjs +8 -8
- package/template/core/engine/commands/_shared.mjs +37 -15
- package/template/core/engine/commands/image.mjs +29 -0
- package/template/core/engine/commands/skills-sync.mjs +71 -0
- package/template/core/engine/commands/typecheck.mjs +63 -1
- package/template/core/engine/commands/upgrade.mjs +3 -3
- package/template/core/engine/document-export.mjs +1 -1
- package/template/core/engine/output/chrome-pdf.mjs +92 -0
- package/template/core/engine/output/static-server.mjs +48 -9
- package/template/core/engine/react/comment-marker.mjs +13 -13
- package/template/core/engine/react/document-entry.mjs +35 -28
- package/template/core/engine/react/document-export.mjs +309 -170
- package/template/core/engine/react/mdx-compile.mjs +30 -0
- package/template/core/engine/react/measurement-css.mjs +21 -0
- package/template/core/engine/react/object-entities.mjs +85 -0
- package/template/core/engine/react/pagination/allocator.mjs +48 -3
- package/template/core/engine/react/pagination.mjs +1 -1
- package/template/core/engine/react/pipeline/allocate.mjs +31 -65
- package/template/core/engine/react/pipeline/frame-measurement.mjs +4 -0
- package/template/core/engine/react/press-tree-inspection.mjs +172 -0
- package/template/core/engine/react/sources/mdx-resolver.mjs +1 -1
- package/template/core/engine/react/style-discovery.mjs +22 -4
- package/template/core/engine/runtime/config.d.mts +8 -0
- package/template/core/engine/runtime/config.mjs +57 -60
- package/template/core/engine/runtime/file-utils.mjs +9 -1
- package/template/core/engine/runtime/page-geometry.mjs +131 -0
- package/template/core/engine/runtime/source-text-tools.mjs +1 -1
- package/template/core/engine/runtime/source-workspace.mjs +12 -3
- package/template/core/engine/runtime/validation.mjs +19 -10
- package/template/core/openpress.config.mjs +3 -7
- package/template/core/package.json +3 -5
- package/template/core/src/openpress/app/OpenPressApp.tsx +173 -17
- package/template/core/src/openpress/app/OpenPressRuntime.tsx +10 -2
- package/template/core/src/openpress/app/WorkspaceGalleryPage.tsx +219 -0
- package/template/core/src/openpress/core/Frame.tsx +20 -7
- package/template/core/src/openpress/core/FrameContext.tsx +2 -0
- package/template/core/src/openpress/core/Press.tsx +25 -4
- package/template/core/src/openpress/core/Workspace.tsx +36 -0
- package/template/core/src/openpress/core/index.tsx +10 -3
- package/template/core/src/openpress/core/primitives.tsx +48 -1
- package/template/core/src/openpress/core/types.ts +86 -41
- package/template/core/src/openpress/core/useSource.ts +1 -1
- package/template/core/src/openpress/document-model/documentTypes.ts +9 -0
- package/template/core/src/openpress/document-model/index.ts +1 -0
- package/template/core/src/openpress/document-model/objectEntityModel.ts +4 -0
- package/template/core/src/openpress/document-model/workspaceManifestModel.ts +57 -0
- package/template/core/src/openpress/mdx/index.ts +15 -7
- package/template/core/src/openpress/reader/PageThumbnailsPanel.tsx +168 -0
- package/template/core/src/openpress/reader/index.ts +1 -0
- package/template/core/src/openpress/workbench/Workbench.tsx +120 -21
- package/template/core/src/openpress/workbench/actions/ExportImageControl.tsx +96 -0
- package/template/core/src/openpress/workbench/actions/SearchControl.tsx +3 -3
- package/template/core/src/openpress/workbench/actions/index.ts +1 -0
- package/template/core/src/openpress/workbench/inspector/useInspectorComments.ts +7 -1
- package/template/core/src/openpress/workbench/panels/PendingCommentsPanel.tsx +5 -1
- package/template/core/src/openpress/workbench/project/ProjectEntryPanel.tsx +4 -2
- package/template/core/src/openpress/workbench/workbenchFormatters.ts +2 -2
- package/template/core/src/styles/openpress/reader-runtime.css +9 -0
- package/template/core/src/styles/openpress/workbench-panels.css +113 -0
- package/template/core/src/styles/openpress/workspace-gallery.css +300 -0
- package/template/core/src/styles/openpress.css +1 -0
- package/template/core/tsconfig.json +1 -1
- package/template/core/engine/commands/init.mjs +0 -24
- package/template/core/engine/init.mjs +0 -90
- package/template/packs/academic-paper/document/chapters/01-introduction/content/01-introduction.mdx +0 -35
- package/template/packs/academic-paper/document/chapters/02-methods/content/01-methods.mdx +0 -50
- package/template/packs/academic-paper/document/chapters/03-results-and-discussion/content/01-results.mdx +0 -47
- package/template/packs/academic-paper/document/chapters/04-acknowledgment/content/01-acknowledgment.mdx +0 -26
- package/template/packs/academic-paper/document/chapters/05-references/content/01-references.mdx +0 -32
- package/template/packs/academic-paper/document/components/ChapterOpenerVisual/index.tsx +0 -76
- package/template/packs/academic-paper/document/components/Page.tsx +0 -60
- package/template/packs/academic-paper/document/components/TokenSwatchGrid/index.tsx +0 -46
- package/template/packs/academic-paper/document/components/TokenSwatchGrid/style.css +0 -63
- package/template/packs/academic-paper/document/components/TypeSpecimen/index.tsx +0 -38
- package/template/packs/academic-paper/document/components/TypeSpecimen/style.css +0 -111
- package/template/packs/academic-paper/document/design.md +0 -279
- package/template/packs/academic-paper/document/index.tsx +0 -123
- package/template/packs/academic-paper/document/media/README.md +0 -13
- package/template/packs/academic-paper/document/media/figure-placeholder.svg +0 -9
- package/template/packs/academic-paper/document/openpress.config.mjs +0 -26
- package/template/packs/academic-paper/document/theme/README.md +0 -11
- package/template/packs/academic-paper/document/theme/base/page-contract.css +0 -522
- package/template/packs/academic-paper/document/theme/base/print.css +0 -93
- package/template/packs/academic-paper/document/theme/base/typography.css +0 -333
- package/template/packs/academic-paper/document/theme/fonts.css +0 -3
- package/template/packs/academic-paper/document/theme/page-surfaces/back-cover.css +0 -43
- package/template/packs/academic-paper/document/theme/page-surfaces/chapter-opener.css +0 -205
- package/template/packs/academic-paper/document/theme/page-surfaces/cover.css +0 -294
- package/template/packs/academic-paper/document/theme/page-surfaces/toc.css +0 -149
- package/template/packs/academic-paper/document/theme/patterns/_chart-frame.css +0 -49
- package/template/packs/academic-paper/document/theme/patterns/figure-grid.css +0 -68
- package/template/packs/academic-paper/document/theme/patterns/table-utilities.css +0 -66
- package/template/packs/academic-paper/document/theme/shell/reader-controls.css +0 -761
- package/template/packs/academic-paper/document/theme/tokens.css +0 -80
- package/template/packs/academic-paper/openpress.config.mjs +0 -5
- package/template/packs/claude-document/document/chapters/01-document-shape/content/01-document-shape.mdx +0 -51
- package/template/packs/claude-document/document/chapters/02-review-loop/content/01-review-loop.mdx +0 -31
- package/template/packs/claude-document/document/components/ChapterOpenerVisual.tsx +0 -96
- package/template/packs/claude-document/document/components/Page.tsx +0 -37
- package/template/packs/claude-document/document/design.md +0 -142
- package/template/packs/claude-document/document/index.tsx +0 -94
- package/template/packs/claude-document/document/media/README.md +0 -13
- package/template/packs/claude-document/document/openpress.config.mjs +0 -26
- package/template/packs/claude-document/document/theme/README.md +0 -15
- package/template/packs/claude-document/document/theme/base/page-contract.css +0 -525
- package/template/packs/claude-document/document/theme/base/print.css +0 -93
- package/template/packs/claude-document/document/theme/base/typography.css +0 -612
- package/template/packs/claude-document/document/theme/fonts.css +0 -4
- package/template/packs/claude-document/document/theme/page-surfaces/back-cover.css +0 -72
- package/template/packs/claude-document/document/theme/page-surfaces/chapter-opener.css +0 -236
- package/template/packs/claude-document/document/theme/page-surfaces/cover.css +0 -309
- package/template/packs/claude-document/document/theme/page-surfaces/toc.css +0 -225
- package/template/packs/claude-document/document/theme/patterns/_chart-frame.css +0 -53
- package/template/packs/claude-document/document/theme/patterns/figure-grid.css +0 -68
- package/template/packs/claude-document/document/theme/patterns/table-utilities.css +0 -66
- package/template/packs/claude-document/document/theme/shell/reader-controls.css +0 -789
- package/template/packs/claude-document/document/theme/tokens.css +0 -89
- package/template/packs/claude-document/openpress.config.mjs +0 -5
- package/template/packs/editorial-monograph/document/chapters/01-product-and-use-cases/content/01-product-and-use-cases.mdx +0 -31
- package/template/packs/editorial-monograph/document/chapters/02-workflow/content/01-workflow.mdx +0 -89
- package/template/packs/editorial-monograph/document/chapters/03-agent-skills-contributors/content/01-agent-skills-contributors.mdx +0 -51
- package/template/packs/editorial-monograph/document/chapters/04-validation-deploy/content/01-validation-deploy.mdx +0 -39
- package/template/packs/editorial-monograph/document/components/ChapterOpenerVisual/index.tsx +0 -76
- package/template/packs/editorial-monograph/document/components/Page.tsx +0 -37
- package/template/packs/editorial-monograph/document/components/TokenSwatchGrid/index.tsx +0 -46
- package/template/packs/editorial-monograph/document/components/TokenSwatchGrid/style.css +0 -63
- package/template/packs/editorial-monograph/document/components/TypeSpecimen/index.tsx +0 -38
- package/template/packs/editorial-monograph/document/components/TypeSpecimen/style.css +0 -111
- package/template/packs/editorial-monograph/document/design.md +0 -279
- package/template/packs/editorial-monograph/document/index.tsx +0 -97
- package/template/packs/editorial-monograph/document/media/README.md +0 -13
- package/template/packs/editorial-monograph/document/openpress.config.mjs +0 -26
- package/template/packs/editorial-monograph/document/theme/README.md +0 -11
- package/template/packs/editorial-monograph/document/theme/base/page-contract.css +0 -505
- package/template/packs/editorial-monograph/document/theme/base/print.css +0 -93
- package/template/packs/editorial-monograph/document/theme/base/typography.css +0 -336
- package/template/packs/editorial-monograph/document/theme/fonts.css +0 -3
- package/template/packs/editorial-monograph/document/theme/page-surfaces/back-cover.css +0 -43
- package/template/packs/editorial-monograph/document/theme/page-surfaces/chapter-opener.css +0 -205
- package/template/packs/editorial-monograph/document/theme/page-surfaces/cover.css +0 -147
- package/template/packs/editorial-monograph/document/theme/page-surfaces/toc.css +0 -149
- package/template/packs/editorial-monograph/document/theme/patterns/_chart-frame.css +0 -49
- package/template/packs/editorial-monograph/document/theme/patterns/figure-grid.css +0 -68
- package/template/packs/editorial-monograph/document/theme/patterns/table-utilities.css +0 -66
- package/template/packs/editorial-monograph/document/theme/shell/reader-controls.css +0 -761
- package/template/packs/editorial-monograph/document/theme/tokens.css +0 -80
- package/template/packs/editorial-monograph/openpress.config.mjs +0 -5
package/README.md
CHANGED
|
@@ -9,13 +9,15 @@ Node.js 20 or newer with `npm` / `npx`.
|
|
|
9
9
|
## Quick start
|
|
10
10
|
|
|
11
11
|
```bash
|
|
12
|
-
npx @open-press/cli init my-doc
|
|
12
|
+
npx @open-press/cli init my-doc
|
|
13
13
|
cd my-doc
|
|
14
14
|
npm run dev
|
|
15
15
|
```
|
|
16
16
|
|
|
17
17
|
Then open the local URL printed by Vite (typically `http://127.0.0.1:5173/?dev=1`).
|
|
18
18
|
|
|
19
|
+
The CLI creates the OpenPress runtime workspace only. Starters and examples live in skills, installed separately with `npx skills add <owner/repo>`. The starter-bearing skills in the framework repo are just skills; agents can read and use them directly.
|
|
20
|
+
|
|
19
21
|
## Usage
|
|
20
22
|
|
|
21
23
|
```
|
|
@@ -24,40 +26,49 @@ npx @open-press/cli init <target> [flags]
|
|
|
24
26
|
|
|
25
27
|
| Flag | Description |
|
|
26
28
|
| -------------------- | --------------------------------------------------------------------------- |
|
|
27
|
-
| `--
|
|
28
|
-
| `--title <s>` | Document title (written to `openpress.config.mjs`) |
|
|
29
|
+
| `--title <s>` | Document title (written to workspace config) |
|
|
29
30
|
| `--subtitle <s>` | Document subtitle |
|
|
30
31
|
| `--organization <s>` | Organization name |
|
|
31
32
|
| `--author <s>` | Author name |
|
|
32
|
-
| `--no-git` | Skip `git init`
|
|
33
|
-
| `--no-install` | Skip `npm install`
|
|
34
|
-
| `--force` | Allow scaffolding into a non-empty target |
|
|
33
|
+
| `--no-git` | Skip `git init` + initial commit (use when scaffolding inside an existing repo) |
|
|
34
|
+
| `--no-install` | Skip `npm install` (offline, or you'll run pnpm/bun yourself) |
|
|
35
35
|
| `--help` | Print help |
|
|
36
36
|
|
|
37
|
+
> The target must be empty. A `.git/` directory or other harmless dotfiles (`.gitignore`, `.gitkeep`, `.DS_Store`) are ignored — common when scaffolding into a fresh repo.
|
|
38
|
+
|
|
39
|
+
To use an opinionated starter, install a skill and let the agent read that skill's files:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npx -y skills@latest add quan0715/openpress-social-card-skill
|
|
43
|
+
```
|
|
44
|
+
|
|
37
45
|
## What it creates
|
|
38
46
|
|
|
39
47
|
A self-contained workspace with:
|
|
40
48
|
|
|
41
49
|
- `engine/`, `src/`, `vite.config.ts` — the open-press framework (snapshot of `@open-press/core`)
|
|
42
|
-
- `document/` — your content (populated from the chosen style pack)
|
|
43
50
|
- `.claude/skills/` and `.agents/skills/` — agent skill files for Claude Code, Codex, Cursor, Copilot, etc.
|
|
44
51
|
- `openpress.config.mjs` — workspace metadata (title, subtitle, organization, author)
|
|
45
52
|
- `AGENTS.md` — agent contract
|
|
46
53
|
|
|
54
|
+
The `press/` or transitional `document/` source tree is added by a skill, user-authored code, or a project-specific workflow after init.
|
|
55
|
+
|
|
47
56
|
## After init
|
|
48
57
|
|
|
49
58
|
Workspace commands (run via `npm run` or `node engine/cli.mjs`):
|
|
50
59
|
|
|
51
60
|
```
|
|
52
|
-
npm run dev
|
|
53
|
-
npm run
|
|
54
|
-
npm run
|
|
55
|
-
npm run
|
|
56
|
-
npm run openpress:
|
|
57
|
-
npm run openpress:pdf
|
|
58
|
-
npm run openpress:deploy:dry-run
|
|
61
|
+
npm run dev # start workbench
|
|
62
|
+
npm run build # validate + render dist-react/
|
|
63
|
+
npm run preview # preview production build
|
|
64
|
+
npm run typecheck # tsc --noEmit
|
|
65
|
+
npm run openpress:image # render one PNG per page
|
|
66
|
+
npm run openpress:pdf # render PDF
|
|
67
|
+
npm run openpress:deploy:dry-run # preview deploy without publishing
|
|
59
68
|
```
|
|
60
69
|
|
|
70
|
+
Full reference: <https://open-press.dev/docs/cli>
|
|
71
|
+
|
|
61
72
|
## License
|
|
62
73
|
|
|
63
74
|
MIT — see [LICENSE](https://github.com/quan0715/open-press/blob/main/LICENSE).
|
package/dist/cli.js
CHANGED
|
@@ -6,61 +6,21 @@ import process2 from "process";
|
|
|
6
6
|
// src/init.ts
|
|
7
7
|
import { spawn } from "child_process";
|
|
8
8
|
import { existsSync } from "fs";
|
|
9
|
-
import { cp, mkdir
|
|
10
|
-
import
|
|
9
|
+
import { cp, mkdir } from "fs/promises";
|
|
10
|
+
import path from "path";
|
|
11
11
|
import process from "process";
|
|
12
12
|
import { fileURLToPath } from "url";
|
|
13
13
|
|
|
14
|
-
// src/
|
|
15
|
-
import {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
import path from "path";
|
|
19
|
-
import { Readable } from "stream";
|
|
20
|
-
import { pipeline } from "stream/promises";
|
|
21
|
-
import { x as extract } from "tar";
|
|
22
|
-
async function degit({ owner, repo, ref = "main", dest, subdir }) {
|
|
23
|
-
const url = `https://codeload.github.com/${owner}/${repo}/tar.gz/refs/heads/${ref}`;
|
|
24
|
-
const tmpDir = await mkdir(path.join(tmpdir(), `open-press-degit-${Date.now()}`), { recursive: true });
|
|
25
|
-
const tarballPath = path.join(tmpDir, "repo.tar.gz");
|
|
26
|
-
try {
|
|
27
|
-
await fetchTo(url, tarballPath);
|
|
28
|
-
await mkdir(dest, { recursive: true });
|
|
29
|
-
const subdirSegments = subdir ? subdir.split("/").filter(Boolean).length : 0;
|
|
30
|
-
const totalStrip = 1 + subdirSegments;
|
|
31
|
-
const filterPrefix = subdir ? subdir.replace(/\/$/, "") + "/" : null;
|
|
32
|
-
await extract({
|
|
33
|
-
file: tarballPath,
|
|
34
|
-
cwd: dest,
|
|
35
|
-
strip: totalStrip,
|
|
36
|
-
filter: (filePath) => {
|
|
37
|
-
const segments = filePath.split("/");
|
|
38
|
-
const inside = segments.slice(1).join("/");
|
|
39
|
-
if (filterPrefix) {
|
|
40
|
-
return inside.startsWith(filterPrefix);
|
|
41
|
-
}
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
} finally {
|
|
46
|
-
await rm(tmpDir, { recursive: true, force: true }).catch(() => {
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
async function fetchTo(url, destFile) {
|
|
51
|
-
const res = await fetch(url, { redirect: "follow" });
|
|
52
|
-
if (!res.ok || !res.body) {
|
|
53
|
-
throw new Error(`Failed to fetch ${url}: ${res.status} ${res.statusText}`);
|
|
54
|
-
}
|
|
55
|
-
await pipeline(Readable.fromWeb(res.body), createWriteStream(destFile));
|
|
56
|
-
}
|
|
57
|
-
async function pathIsEmpty(target) {
|
|
14
|
+
// src/path-is-empty.ts
|
|
15
|
+
import { readdir, stat } from "fs/promises";
|
|
16
|
+
var HARMLESS_TARGET_ENTRIES = /* @__PURE__ */ new Set([".git", ".gitignore", ".gitkeep", ".DS_Store"]);
|
|
17
|
+
async function pathIsEmpty(target, options = {}) {
|
|
58
18
|
try {
|
|
59
19
|
const s = await stat(target);
|
|
60
20
|
if (!s.isDirectory()) return false;
|
|
61
|
-
const { readdir } = await import("fs/promises");
|
|
62
21
|
const entries = await readdir(target);
|
|
63
|
-
return entries.length === 0;
|
|
22
|
+
if (!options.ignoreHarmless) return entries.length === 0;
|
|
23
|
+
return entries.every((entry) => HARMLESS_TARGET_ENTRIES.has(entry));
|
|
64
24
|
} catch {
|
|
65
25
|
return true;
|
|
66
26
|
}
|
|
@@ -68,20 +28,17 @@ async function pathIsEmpty(target) {
|
|
|
68
28
|
|
|
69
29
|
// src/metadata.ts
|
|
70
30
|
import { readFile, writeFile } from "fs/promises";
|
|
71
|
-
async function
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
source = source.replace(/(export\s+default\s*\{)/, `$1
|
|
81
|
-
${key}: "${escaped}",`);
|
|
82
|
-
}
|
|
31
|
+
async function patchPressTitle(entryPath, title) {
|
|
32
|
+
const source = await readFile(entryPath, "utf8");
|
|
33
|
+
const escaped = escapeStringForJs(title);
|
|
34
|
+
const existing = /(<Press\b[^>]*\btitle\s*=\s*)("[^"]*"|'[^']*'|\{`[^`]*`\})/;
|
|
35
|
+
let next;
|
|
36
|
+
if (existing.test(source)) {
|
|
37
|
+
next = source.replace(existing, `$1"${escaped}"`);
|
|
38
|
+
} else {
|
|
39
|
+
next = source.replace(/<Press\b/, `<Press title="${escaped}"`);
|
|
83
40
|
}
|
|
84
|
-
await writeFile(
|
|
41
|
+
await writeFile(entryPath, next);
|
|
85
42
|
}
|
|
86
43
|
function escapeStringForJs(value) {
|
|
87
44
|
return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
|
|
@@ -115,69 +72,27 @@ async function patchPackageJsonName(packagePath, newName) {
|
|
|
115
72
|
}
|
|
116
73
|
|
|
117
74
|
// src/init.ts
|
|
118
|
-
var BUNDLED_PACKS = ["editorial-monograph", "claude-document", "academic-paper"];
|
|
119
75
|
var FRAMEWORK_SKILLS_SOURCE = "quan0715/open-press";
|
|
120
|
-
var __dirname =
|
|
121
|
-
var TEMPLATE_ROOT =
|
|
122
|
-
var TEMPLATE_CORE =
|
|
123
|
-
var TEMPLATE_PACKS = path2.join(TEMPLATE_ROOT, "packs");
|
|
76
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
77
|
+
var TEMPLATE_ROOT = path.resolve(__dirname, "..", "template");
|
|
78
|
+
var TEMPLATE_CORE = path.join(TEMPLATE_ROOT, "core");
|
|
124
79
|
async function init(options) {
|
|
125
|
-
const packSpec = options.pack ? parsePackSpec(options.pack) : null;
|
|
126
80
|
ensureTemplateBundled();
|
|
127
|
-
const target =
|
|
128
|
-
await ensureTarget(target
|
|
81
|
+
const target = path.resolve(process.cwd(), options.target);
|
|
82
|
+
await ensureTarget(target);
|
|
129
83
|
log(`Creating open-press workspace at ${target}`);
|
|
130
84
|
log("Copying framework (engine + runtime + config)\u2026");
|
|
131
85
|
await cp(TEMPLATE_CORE, target, { recursive: true });
|
|
132
|
-
const
|
|
133
|
-
await rm2(docDest, { recursive: true, force: true });
|
|
134
|
-
await mkdir2(docDest, { recursive: true });
|
|
135
|
-
if (packSpec?.kind === "bundled") {
|
|
136
|
-
log(`Applying bundled style pack: ${packSpec.name}`);
|
|
137
|
-
const packStarter = path2.join(TEMPLATE_PACKS, packSpec.name, "document");
|
|
138
|
-
if (!existsSync(packStarter)) {
|
|
139
|
-
throw new Error(`Bundled style pack starter not found: ${packStarter}`);
|
|
140
|
-
}
|
|
141
|
-
await cp(packStarter, docDest, { recursive: true });
|
|
142
|
-
} else if (packSpec?.kind === "github") {
|
|
143
|
-
log(`Fetching style pack from github:${packSpec.owner}/${packSpec.repo}${packSpec.ref ? `#${packSpec.ref}` : ""}\u2026`);
|
|
144
|
-
try {
|
|
145
|
-
await degit({
|
|
146
|
-
owner: packSpec.owner,
|
|
147
|
-
repo: packSpec.repo,
|
|
148
|
-
ref: packSpec.ref,
|
|
149
|
-
dest: docDest,
|
|
150
|
-
subdir: "starter/document"
|
|
151
|
-
});
|
|
152
|
-
} catch (err) {
|
|
153
|
-
throw new Error(
|
|
154
|
-
`Failed to fetch pack from github:${packSpec.owner}/${packSpec.repo}: ${err instanceof Error ? err.message : String(err)}`
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
if (await pathIsEmpty(docDest)) {
|
|
158
|
-
throw new Error(
|
|
159
|
-
`github:${packSpec.owner}/${packSpec.repo} doesn't contain starter/document/ at the repo root.
|
|
160
|
-
Third-party pack repos should follow this layout:
|
|
161
|
-
<repo>/
|
|
162
|
-
\u251C\u2500\u2500 starter/
|
|
163
|
-
\u2502 \u2514\u2500\u2500 document/ \u2190 cli copies this into your workspace's document/
|
|
164
|
-
\u2514\u2500\u2500 skills/<pack>/SKILL.md \u2190 npx skills add picks this up`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
const pkgPath = path2.join(target, "package.json");
|
|
86
|
+
const pkgPath = path.join(target, "package.json");
|
|
169
87
|
if (existsSync(pkgPath)) {
|
|
170
|
-
await patchPackageJsonName(pkgPath,
|
|
88
|
+
await patchPackageJsonName(pkgPath, path.basename(target));
|
|
171
89
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
organization: options.organization,
|
|
179
|
-
author: options.author
|
|
180
|
-
});
|
|
90
|
+
if (options.title) {
|
|
91
|
+
const pressEntry = path.join(target, "press", "index.tsx");
|
|
92
|
+
if (existsSync(pressEntry)) {
|
|
93
|
+
log("Writing title into <Press> in press/index.tsx");
|
|
94
|
+
await patchPressTitle(pressEntry, options.title);
|
|
95
|
+
}
|
|
181
96
|
}
|
|
182
97
|
log(`Installing framework skills via \`npx skills add ${FRAMEWORK_SKILLS_SOURCE}\`\u2026`);
|
|
183
98
|
try {
|
|
@@ -186,16 +101,6 @@ Third-party pack repos should follow this layout:
|
|
|
186
101
|
log(`(framework skills install failed; retry: npx skills add ${FRAMEWORK_SKILLS_SOURCE})`);
|
|
187
102
|
log(` reason: ${err instanceof Error ? err.message : String(err)}`);
|
|
188
103
|
}
|
|
189
|
-
if (packSpec?.kind === "github") {
|
|
190
|
-
const packSource = `${packSpec.owner}/${packSpec.repo}`;
|
|
191
|
-
log(`Installing pack skills via \`npx skills add ${packSource}\`\u2026`);
|
|
192
|
-
try {
|
|
193
|
-
await runInTarget(target, "npx", ["-y", "skills@latest", "add", packSource]);
|
|
194
|
-
} catch (err) {
|
|
195
|
-
log(`(pack skills install failed; retry: npx skills add ${packSource})`);
|
|
196
|
-
log(` reason: ${err instanceof Error ? err.message : String(err)}`);
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
104
|
if (options.install) {
|
|
200
105
|
log("Installing dependencies (npm install)\u2026");
|
|
201
106
|
await runInTarget(target, "npm", ["install"]);
|
|
@@ -216,46 +121,24 @@ Third-party pack repos should follow this layout:
|
|
|
216
121
|
}
|
|
217
122
|
printNextSteps(target, options);
|
|
218
123
|
}
|
|
219
|
-
function parsePackSpec(spec) {
|
|
220
|
-
if (spec.startsWith("github:")) {
|
|
221
|
-
const rest = spec.slice("github:".length);
|
|
222
|
-
const [pathPart, ref] = rest.split("#");
|
|
223
|
-
const segments = pathPart.split("/").filter(Boolean);
|
|
224
|
-
if (segments.length !== 2) {
|
|
225
|
-
throw new Error(
|
|
226
|
-
`Invalid --pack spec: "${spec}". Use github:owner/repo or github:owner/repo#ref.`
|
|
227
|
-
);
|
|
228
|
-
}
|
|
229
|
-
const [owner, repo] = segments;
|
|
230
|
-
return { kind: "github", owner, repo, ref: ref?.trim() || void 0 };
|
|
231
|
-
}
|
|
232
|
-
if (!BUNDLED_PACKS.includes(spec)) {
|
|
233
|
-
throw new Error(
|
|
234
|
-
`Unknown style pack: "${spec}". Bundled packs: ${BUNDLED_PACKS.join(", ")}. For third-party packs use github:owner/repo (e.g. github:quan0715/openpress-pack-nycu-thesis).`
|
|
235
|
-
);
|
|
236
|
-
}
|
|
237
|
-
return { kind: "bundled", name: spec };
|
|
238
|
-
}
|
|
239
124
|
function ensureTemplateBundled() {
|
|
240
|
-
if (!existsSync(TEMPLATE_CORE)
|
|
125
|
+
if (!existsSync(TEMPLATE_CORE)) {
|
|
241
126
|
throw new Error(
|
|
242
127
|
`Template not bundled at ${TEMPLATE_ROOT}. If running from source, run \`pnpm sync:template\` in packages/cli first.`
|
|
243
128
|
);
|
|
244
129
|
}
|
|
245
130
|
}
|
|
246
|
-
async function ensureTarget(target
|
|
131
|
+
async function ensureTarget(target) {
|
|
247
132
|
if (existsSync(target)) {
|
|
248
|
-
|
|
249
|
-
const empty = await pathIsEmpty(target);
|
|
133
|
+
const empty = await pathIsEmpty(target, { ignoreHarmless: true });
|
|
250
134
|
if (!empty) {
|
|
251
|
-
throw new Error(
|
|
135
|
+
throw new Error(
|
|
136
|
+
`Target ${target} is not empty. Remove existing files first, or scaffold into a different directory.`
|
|
137
|
+
);
|
|
252
138
|
}
|
|
253
139
|
return;
|
|
254
140
|
}
|
|
255
|
-
await
|
|
256
|
-
}
|
|
257
|
-
function hasMetadata(options) {
|
|
258
|
-
return Boolean(options.title || options.subtitle || options.organization || options.author);
|
|
141
|
+
await mkdir(target, { recursive: true });
|
|
259
142
|
}
|
|
260
143
|
async function runInTarget(cwd, command, args, opts = {}) {
|
|
261
144
|
return new Promise((resolve, reject) => {
|
|
@@ -276,7 +159,7 @@ function log(message) {
|
|
|
276
159
|
`);
|
|
277
160
|
}
|
|
278
161
|
function printNextSteps(target, options) {
|
|
279
|
-
const rel =
|
|
162
|
+
const rel = path.relative(process.cwd(), target) || ".";
|
|
280
163
|
const lines = [
|
|
281
164
|
"",
|
|
282
165
|
"\u2713 Done. Your open-press workspace is ready.",
|
|
@@ -297,7 +180,7 @@ function printNextSteps(target, options) {
|
|
|
297
180
|
"Agent skills installed under .agents/skills/ (universal \u2014 read by Claude Code,",
|
|
298
181
|
`Cursor, Codex, Gemini CLI, etc.). Update later with: npx skills upgrade`,
|
|
299
182
|
"",
|
|
300
|
-
"
|
|
183
|
+
"Use an OpenPress-ready skill to add or adapt the press/document source tree.",
|
|
301
184
|
""
|
|
302
185
|
);
|
|
303
186
|
process.stdout.write(lines.join("\n"));
|
|
@@ -310,28 +193,14 @@ Usage:
|
|
|
310
193
|
npx @open-press/cli init <target> [flags]
|
|
311
194
|
|
|
312
195
|
Flags:
|
|
313
|
-
--
|
|
314
|
-
\u2022 a bundled name \u2014 editorial-monograph | claude-document | academic-paper
|
|
315
|
-
\u2022 github:owner/repo (third-party pack)
|
|
316
|
-
\u2022 github:owner/repo#branch-or-tag
|
|
317
|
-
--title <s> Document title (written to openpress.config.mjs)
|
|
318
|
-
--subtitle <s> Document subtitle
|
|
319
|
-
--organization <s> Organization name
|
|
320
|
-
--author <s> Author name
|
|
196
|
+
--title <s> Document title (written into <Press title="..."> in press/index.tsx)
|
|
321
197
|
--no-git Skip git init
|
|
322
198
|
--no-install Skip npm install
|
|
323
|
-
--force Allow non-empty target
|
|
324
199
|
--help Show this help
|
|
325
200
|
|
|
326
201
|
Examples:
|
|
327
|
-
|
|
328
|
-
npx @open-press/cli init my-
|
|
329
|
-
npx @open-press/cli init my-brief --pack claude-document --title "Q2 Brief" --author Quan
|
|
330
|
-
npx @open-press/cli init my-paper --pack academic-paper --title "Paper Title" --author "First Author"
|
|
331
|
-
|
|
332
|
-
# Third-party (any GitHub repo with starter/document/ at the root)
|
|
333
|
-
npx @open-press/cli init my-thesis --pack github:quan0715/openpress-pack-nycu-thesis
|
|
334
|
-
npx @open-press/cli init my-paper --pack github:foo/their-pack#v1.2
|
|
202
|
+
npx @open-press/cli init my-doc
|
|
203
|
+
npx @open-press/cli init my-brief --title "Q2 Brief"
|
|
335
204
|
`;
|
|
336
205
|
async function main(argv) {
|
|
337
206
|
if (argv.length === 0 || argv.includes("--help") || argv.includes("-h")) {
|
|
@@ -368,33 +237,16 @@ function parseInitArgs(args) {
|
|
|
368
237
|
}
|
|
369
238
|
const options = {
|
|
370
239
|
target: "",
|
|
371
|
-
pack: void 0,
|
|
372
240
|
title: void 0,
|
|
373
|
-
subtitle: void 0,
|
|
374
|
-
organization: void 0,
|
|
375
|
-
author: void 0,
|
|
376
241
|
git: true,
|
|
377
|
-
install: true
|
|
378
|
-
force: false
|
|
242
|
+
install: true
|
|
379
243
|
};
|
|
380
244
|
for (let i = 0; i < args.length; i++) {
|
|
381
245
|
const arg = args[i];
|
|
382
246
|
switch (arg) {
|
|
383
|
-
case "--pack":
|
|
384
|
-
options.pack = args[++i];
|
|
385
|
-
break;
|
|
386
247
|
case "--title":
|
|
387
248
|
options.title = args[++i];
|
|
388
249
|
break;
|
|
389
|
-
case "--subtitle":
|
|
390
|
-
options.subtitle = args[++i];
|
|
391
|
-
break;
|
|
392
|
-
case "--organization":
|
|
393
|
-
options.organization = args[++i];
|
|
394
|
-
break;
|
|
395
|
-
case "--author":
|
|
396
|
-
options.author = args[++i];
|
|
397
|
-
break;
|
|
398
250
|
case "--no-git":
|
|
399
251
|
options.git = false;
|
|
400
252
|
break;
|
|
@@ -407,9 +259,6 @@ function parseInitArgs(args) {
|
|
|
407
259
|
case "--install":
|
|
408
260
|
options.install = true;
|
|
409
261
|
break;
|
|
410
|
-
case "--force":
|
|
411
|
-
options.force = true;
|
|
412
|
-
break;
|
|
413
262
|
default:
|
|
414
263
|
if (arg.startsWith("--")) {
|
|
415
264
|
process2.stderr.write(`Unknown flag: ${arg}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-press/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Scaffolder for open-press — AI-first fixed-layout document workspaces.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -40,9 +40,7 @@
|
|
|
40
40
|
"engines": {
|
|
41
41
|
"node": ">=20"
|
|
42
42
|
},
|
|
43
|
-
"dependencies": {
|
|
44
|
-
"tar": "^7.5.0"
|
|
45
|
-
},
|
|
43
|
+
"dependencies": {},
|
|
46
44
|
"devDependencies": {
|
|
47
45
|
"@types/node": "^25.8.0",
|
|
48
46
|
"tsup": "^8.5.0",
|
|
@@ -52,6 +50,7 @@
|
|
|
52
50
|
"sync:template": "node scripts/sync-template.mjs",
|
|
53
51
|
"build": "pnpm sync:template && tsup",
|
|
54
52
|
"dev": "tsup --watch",
|
|
55
|
-
"typecheck": "tsc --noEmit"
|
|
53
|
+
"typecheck": "tsc --noEmit",
|
|
54
|
+
"test": "pnpm build && node --test tests/*.test.mjs"
|
|
56
55
|
}
|
|
57
56
|
}
|
package/template/core/AGENTS.md
CHANGED
|
@@ -16,15 +16,19 @@ will rewrite it.
|
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
18
|
npm run dev # workbench at http://127.0.0.1:5173/?dev=1
|
|
19
|
-
npm run
|
|
20
|
-
npm run openpress:
|
|
19
|
+
npm run build # validate + render dist-react/
|
|
20
|
+
npm run openpress:image # write dist-react/images/page-*.png
|
|
21
21
|
npm run openpress:pdf # write document.pdf
|
|
22
|
-
npm run openpress:export # write public/openpress/document.json
|
|
23
22
|
npm run openpress:deploy # deploy via the configured adapter
|
|
24
23
|
npx open-press doctor # current vs latest version + pending migrations
|
|
25
24
|
npx open-press upgrade # apply the upgrade flow (see below)
|
|
26
25
|
```
|
|
27
26
|
|
|
27
|
+
The intermediate engine steps live behind `node engine/cli.mjs` if you
|
|
28
|
+
need them directly (rarely): `validate` (source-level checks only,
|
|
29
|
+
fast), `export` (write `public/openpress/document.json` without
|
|
30
|
+
bundling), `inspect` (post-render geometry + comment markers).
|
|
31
|
+
|
|
28
32
|
## When the user asks to upgrade
|
|
29
33
|
|
|
30
34
|
Triggers: "升級 / 套件更新 / upgrade open-press / apply latest design /
|
|
@@ -44,8 +48,7 @@ update to vX.Y.Z" etc.
|
|
|
44
48
|
Apply to `document/` with user confirmation.
|
|
45
49
|
5. Verify:
|
|
46
50
|
```bash
|
|
47
|
-
npm run
|
|
48
|
-
npm run openpress:render
|
|
51
|
+
npm run build
|
|
49
52
|
```
|
|
50
53
|
Fix anything broken using the migration notes.
|
|
51
54
|
6. Report to the user: starting version → ending version, what was
|
|
@@ -73,32 +76,33 @@ regenerate `document.json`. So edits to:
|
|
|
73
76
|
the change:
|
|
74
77
|
|
|
75
78
|
```bash
|
|
76
|
-
npm run
|
|
79
|
+
npm run build # validate + render (includes the export step)
|
|
77
80
|
# then refresh the browser
|
|
81
|
+
# — or, for the inner export only, without the full Vite bundle step:
|
|
82
|
+
node engine/cli.mjs export .
|
|
78
83
|
```
|
|
79
84
|
|
|
80
85
|
Quick rules of thumb:
|
|
81
86
|
|
|
82
87
|
- Pure CSS edits under `document/theme/` that don't move blocks → HMR
|
|
83
88
|
is enough (CSS is hot-replaced).
|
|
84
|
-
- Anything that affects content, pagination, or metadata → re-
|
|
85
|
-
|
|
86
|
-
works to refresh the JSON.
|
|
89
|
+
- Anything that affects content, pagination, or metadata → re-build (or
|
|
90
|
+
call `node engine/cli.mjs export .` for just the JSON refresh).
|
|
87
91
|
|
|
88
92
|
**Agent SOP**: after applying any non-CSS edit to `document/`, run
|
|
89
|
-
`npm run
|
|
90
|
-
|
|
93
|
+
`npm run build` before telling the user "done". If they ask "why
|
|
94
|
+
didn't my change show up?", check whether `document.json` was
|
|
91
95
|
regenerated since the edit.
|
|
92
96
|
|
|
93
97
|
## When the user reports a render / paginate issue
|
|
94
98
|
|
|
95
99
|
Press Tree paginates at build time. Common things to check:
|
|
96
100
|
|
|
97
|
-
1. `npm run
|
|
101
|
+
1. `npm run build` then inspect
|
|
98
102
|
`public/openpress/document.json` for `source.warnings` (chain
|
|
99
103
|
overflow, missing chains, etc.).
|
|
100
|
-
2. `
|
|
101
|
-
(missing entries, broken anchors).
|
|
104
|
+
2. `node engine/cli.mjs validate .` for structural issues
|
|
105
|
+
(missing entries, broken anchors) — faster than a full build.
|
|
102
106
|
3. `npm run dev` and use the workbench inspector to find which MDX
|
|
103
107
|
block / Frame element is misbehaving — comments and inline
|
|
104
108
|
annotations work directly from there.
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @open-press/core
|
|
2
2
|
|
|
3
|
+
## 1.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 8c528ad: 1.0 contract release. Breaking changes:
|
|
8
|
+
- `<Workspace>` is now required at the root of `press/index.tsx`; `<Press>` lives as a child, and multi-Press workspaces are first-class (each `<Press>` exports to `/openpress/<slug>/document.json`).
|
|
9
|
+
- Document metadata (`title` / `subtitle` / `organization` / `page` / `sources` / `captionNumbering`) moves onto `<Press>` JSX props. `export const config` and `export const sources` are removed.
|
|
10
|
+
- `openpress.config.mjs` is removed. Operational settings (deploy / pdf) live in the workspace `package.json` under the `"openpress"` field; paths are convention (`press/`, `press/<slug>/chapters/`, `press/theme/`, `public/openpress/`, `dist-react/`).
|
|
11
|
+
- Workspace folder renamed from `document/` → `press/`. The dogfood and starter skills are migrated.
|
|
12
|
+
- Reader gains a workspace gallery for multi-Press projects, per-page PNG export, page thumbnails for canvas-style Press, and a back-to-workspace button.
|
|
13
|
+
- New built-in page presets `a4`, `social-square`, `slide-16-9` and improved init metadata propagation.
|
|
14
|
+
|
|
3
15
|
## 0.8.0
|
|
4
16
|
|
|
5
17
|
### Minor Changes
|
|
@@ -50,7 +62,6 @@
|
|
|
50
62
|
### Patch Changes
|
|
51
63
|
|
|
52
64
|
- Measurement pipeline + pagination fixes:
|
|
53
|
-
|
|
54
65
|
- **Measurement**: wait on `document.fonts.ready`, image `load`/`error` + `decode()`,
|
|
55
66
|
and two `requestAnimationFrame` ticks before sampling block heights so figures
|
|
56
67
|
no longer under-measure on cold loads.
|
|
@@ -72,7 +83,6 @@
|
|
|
72
83
|
- 718d2d1: **Press Tree render architecture** — full refresh of the React export pipeline (clean break, no v0.5 compatibility).
|
|
73
84
|
|
|
74
85
|
The render kernel no longer knows about `cover`, `toc`, `chapter`, or `back-cover` as built-in concepts. Workspaces describe their document as a React tree using three primitives:
|
|
75
|
-
|
|
76
86
|
- `Press` — root composition boundary.
|
|
77
87
|
- `Frame` — a single fixed-layout surface (replaces `BasePage` and friends).
|
|
78
88
|
- `MdxArea` — a measurable slot consuming a content chain, with `overflow="extend|truncate|error"` control.
|
|
@@ -107,7 +117,6 @@
|
|
|
107
117
|
MDX source resolution now derives manuscript TOC entries from actual `##` / `###` headings, not folder slugs. Heading numbering is written during export as `data-chapter="01"` / `data-section="1.1"` attributes so themes can render numbering with CSS without reader-side mutation.
|
|
108
118
|
|
|
109
119
|
**Removed (no compatibility layer):**
|
|
110
|
-
|
|
111
120
|
- `BasePage`, `BaseCoverPage`, `BaseTocPage`, `BaseContentPage`, `BaseBackCoverPage`.
|
|
112
121
|
- Legacy named exports (`cover`, `toc`, `backCover`) from `document/index.tsx`.
|
|
113
122
|
- The `migrate-to-react` CLI command.
|
|
@@ -119,15 +128,12 @@
|
|
|
119
128
|
All `<Frame>` instances require a stable `frameKey`; source roots and file-list entries must stay inside `document/`.
|
|
120
129
|
|
|
121
130
|
**Workspace data attributes:**
|
|
122
|
-
|
|
123
131
|
- `data-frame-role` (new, opaque role like `"manuscript.content"`).
|
|
124
132
|
- `data-page-kind` (derived from role's last segment — reader CSS keeps using this).
|
|
125
133
|
- `data-section-id` replaces `data-chapter-slug` for section-scoped CSS.
|
|
126
134
|
|
|
127
135
|
**Migration:** Workspaces written for v0.5.x must rewrite `document/index.tsx` to default-export a Press component. Pre-1.0 minor bump is acceptable per repo policy; no production deployments exist to break.
|
|
128
136
|
|
|
129
|
-
See `docs/superpowers/specs/2026-05-23-press-tree-render-architecture-design.md` for full design rationale.
|
|
130
|
-
|
|
131
137
|
## 0.6.0
|
|
132
138
|
|
|
133
139
|
### Minor Changes
|
|
@@ -168,7 +174,6 @@
|
|
|
168
174
|
- 0169cba: Agent-driven upgrade flow.
|
|
169
175
|
|
|
170
176
|
**New commands:**
|
|
171
|
-
|
|
172
177
|
- `npx open-press doctor` — diagnose workspace against latest framework state. Reports `@open-press/core` version vs npm latest, installed skill count, and any pending `docs/migrations/<version>.md` notes between current and latest. `--json` for machine-readable output, `--no-cache` to bypass the 24h cache. Always exits 0 (informational only).
|
|
173
178
|
|
|
174
179
|
- `npx open-press upgrade` — orchestrate the upgrade. Runs `npm update @open-press/core` (when the workspace declares the dep) and `npx skills upgrade`, then surfaces the list of migration notes for the agent to read. **Does not auto-edit `document/` content** — the agent reads the surfaced `docs/migrations/<version>.md` notes and proposes edits to the user with confirmation. Use `--dry-run` to preview, `--no-deps` / `--no-skills` to target one layer.
|
|
@@ -178,7 +183,6 @@
|
|
|
178
183
|
`open-press dev` now runs `doctor` before starting Vite. When the workspace is behind, a single line prints: `○ open-press: @open-press/core 0.4.0 → 0.5.0 · 1 migration note(s) — run npx open-press doctor for details.` Cached for 24h, network failure is silent, never blocks dev.
|
|
179
184
|
|
|
180
185
|
**Migration docs:**
|
|
181
|
-
|
|
182
186
|
- New `docs/migrations/_template.md` — each release with breaking changes ships a `docs/migrations/<version>.md` file with sections the agent reads.
|
|
183
187
|
- New `docs/migrations/0.4.0.md` — backfilled. Documents the SKILL fold (no document or CLI changes).
|
|
184
188
|
|
|
@@ -195,7 +199,6 @@
|
|
|
195
199
|
### Minor Changes
|
|
196
200
|
|
|
197
201
|
- 3cb4939: Consolidate internal skills (13 → 11).
|
|
198
|
-
|
|
199
202
|
- `openpress-update` folded into `openpress` as an "Updating An Existing Workspace" section. The release-upgrade flow, pre-flight checks, breaking-change reference, and do-not list are now part of the system-operation skill where they naturally belong.
|
|
200
203
|
- `openpress-document-hierarchy` folded into `openpress-writing` as a "Hierarchy" section. Hierarchy decisions (H2/H3/H4 model, TOC depth, appendix placement, H4 granularity) and prose decisions happen in the same workflow; one skill, one routing decision.
|
|
201
204
|
- `references/data-structures-outline.md` moved from the hierarchy skill into `openpress-writing/references/`.
|
package/template/core/README.md
CHANGED
|
@@ -5,10 +5,10 @@ Framework runtime, CLI engine, and Press Tree primitives for [open-press](https:
|
|
|
5
5
|
Most users do **not** install this package directly. Instead, scaffold a workspace with the CLI:
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npx @open-press/cli init my-doc
|
|
8
|
+
npx @open-press/cli init my-doc
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
The scaffolded workspace contains a snapshot of this package.
|
|
11
|
+
The scaffolded workspace contains a snapshot of this package. Starter files are supplied by skills, not by `@open-press/core`.
|
|
12
12
|
|
|
13
13
|
## Direct use
|
|
14
14
|
|
|
@@ -31,7 +31,10 @@ import { mdxSource } from "@open-press/core/mdx";
|
|
|
31
31
|
import { Sections, Toc } from "@open-press/core/manuscript";
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
`document/index.tsx` default-exports a `<Press>` tree. `Frame` marks fixed-layout pages, `MdxArea` receives measured MDX blocks, and `mdxSource()` declares which MDX files participate in the render pipeline.
|
|
34
|
+
`press/index.tsx` or transitional `document/index.tsx` default-exports a `<Workspace>/<Press>` tree. `Frame` marks fixed-layout pages, `MdxArea` receives measured MDX blocks, and `mdxSource()` declares which MDX files participate in the render pipeline.
|
|
35
|
+
|
|
36
|
+
For the maintenance contract around Press Tree, page geometry presets, and the
|
|
37
|
+
allocation pipeline, see [`docs/press-tree.md`](https://github.com/quan0715/open-press/blob/main/docs/press-tree.md).
|
|
35
38
|
|
|
36
39
|
The CLI bin (`open-press`) supports dev / build / preview / validate / pdf / deploy / export commands. It requires a workspace with `openpress.config.mjs` and the surrounding framework files (which the scaffolder installs).
|
|
37
40
|
|