@open-press/cli 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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/cli.js +365 -0
- package/package.json +57 -0
- package/template/core/.turbo/turbo-test.log +341 -0
- package/template/core/CHANGELOG.md +11 -0
- package/template/core/README.md +36 -0
- package/template/core/engine/chrome-pdf.d.mts +34 -0
- package/template/core/engine/chrome-pdf.mjs +344 -0
- package/template/core/engine/cli.mjs +93 -0
- package/template/core/engine/commands/_shared.mjs +170 -0
- package/template/core/engine/commands/deploy.mjs +31 -0
- package/template/core/engine/commands/dev.mjs +26 -0
- package/template/core/engine/commands/export.mjs +8 -0
- package/template/core/engine/commands/init.mjs +24 -0
- package/template/core/engine/commands/inspect.mjs +35 -0
- package/template/core/engine/commands/migrate-to-react.mjs +27 -0
- package/template/core/engine/commands/pdf.mjs +26 -0
- package/template/core/engine/commands/preview.mjs +26 -0
- package/template/core/engine/commands/render.mjs +17 -0
- package/template/core/engine/commands/replace.mjs +41 -0
- package/template/core/engine/commands/search.mjs +33 -0
- package/template/core/engine/commands/typecheck.mjs +5 -0
- package/template/core/engine/commands/validate.mjs +17 -0
- package/template/core/engine/config.d.mts +40 -0
- package/template/core/engine/config.mjs +160 -0
- package/template/core/engine/deploy-sync.mjs +15 -0
- package/template/core/engine/document-export.mjs +15 -0
- package/template/core/engine/file-utils.mjs +106 -0
- package/template/core/engine/fonts.mjs +62 -0
- package/template/core/engine/init.mjs +90 -0
- package/template/core/engine/inspection.mjs +348 -0
- package/template/core/engine/issue-report.mjs +44 -0
- package/template/core/engine/katex-assets.mjs +45 -0
- package/template/core/engine/page-block.mjs +30 -0
- package/template/core/engine/page-renderer.mjs +217 -0
- package/template/core/engine/pdf-media.mjs +45 -0
- package/template/core/engine/public-assets.mjs +19 -0
- package/template/core/engine/react/chapter-css.mjs +53 -0
- package/template/core/engine/react/comment-endpoint.d.mts +11 -0
- package/template/core/engine/react/comment-endpoint.mjs +128 -0
- package/template/core/engine/react/comment-marker.mjs +306 -0
- package/template/core/engine/react/document-entry.mjs +253 -0
- package/template/core/engine/react/document-export.mjs +392 -0
- package/template/core/engine/react/mdx-compile.mjs +295 -0
- package/template/core/engine/react/measurement-css.mjs +44 -0
- package/template/core/engine/react/migrate-to-react.mjs +355 -0
- package/template/core/engine/react/pagination-constants.mjs +3 -0
- package/template/core/engine/react/pagination.mjs +121 -0
- package/template/core/engine/react/project-asset-endpoint.d.mts +10 -0
- package/template/core/engine/react/project-asset-endpoint.mjs +379 -0
- package/template/core/engine/react/workspace-discovery.mjs +156 -0
- package/template/core/engine/source-text-tools.mjs +280 -0
- package/template/core/engine/source-workspace.mjs +76 -0
- package/template/core/engine/static-server.mjs +493 -0
- package/template/core/engine/validation.mjs +172 -0
- package/template/core/index.html +13 -0
- package/template/core/openpress.config.mjs +12 -0
- package/template/core/package.json +86 -0
- package/template/core/src/main.tsx +16 -0
- package/template/core/src/openpress/App.tsx +127 -0
- package/template/core/src/openpress/composerMentions.ts +188 -0
- package/template/core/src/openpress/core/basePages.tsx +87 -0
- package/template/core/src/openpress/core/index.tsx +20 -0
- package/template/core/src/openpress/core/types.ts +71 -0
- package/template/core/src/openpress/frameScheduler.ts +32 -0
- package/template/core/src/openpress/indexes.ts +329 -0
- package/template/core/src/openpress/inspector.ts +282 -0
- package/template/core/src/openpress/pageRoute.ts +21 -0
- package/template/core/src/openpress/pagination.ts +845 -0
- package/template/core/src/openpress/projectIdentity.ts +15 -0
- package/template/core/src/openpress/projectSources.ts +24 -0
- package/template/core/src/openpress/projectWorkspace.tsx +919 -0
- package/template/core/src/openpress/publicPage.tsx +469 -0
- package/template/core/src/openpress/reactDocumentMetadata.ts +41 -0
- package/template/core/src/openpress/readerPageRegistry.ts +41 -0
- package/template/core/src/openpress/readerRuntime.ts +230 -0
- package/template/core/src/openpress/readerScroll.ts +92 -0
- package/template/core/src/openpress/readerState.ts +15 -0
- package/template/core/src/openpress/renderer.tsx +91 -0
- package/template/core/src/openpress/runtimeMode.ts +22 -0
- package/template/core/src/openpress/types.ts +112 -0
- package/template/core/src/openpress/workbench.tsx +1299 -0
- package/template/core/src/openpress/workbenchPanels.tsx +122 -0
- package/template/core/src/openpress/workbenchTypes.ts +4 -0
- package/template/core/src/styles/openpress/app-shell.css +251 -0
- package/template/core/src/styles/openpress/media-workspace.css +230 -0
- package/template/core/src/styles/openpress/print-route.css +186 -0
- package/template/core/src/styles/openpress/project-workspace.css +1318 -0
- package/template/core/src/styles/openpress/public-viewer.css +983 -0
- package/template/core/src/styles/openpress/reader-runtime.css +792 -0
- package/template/core/src/styles/openpress/responsive.css +384 -0
- package/template/core/src/styles/openpress/workbench-panels.css +558 -0
- package/template/core/src/styles/openpress/workbench.css +720 -0
- package/template/core/src/styles/openpress.css +14 -0
- package/template/core/src/vite-env.d.ts +9 -0
- package/template/core/tsconfig.json +37 -0
- package/template/core/vite.config.ts +512 -0
- package/template/skills/chinese-ai-writing-polish/SKILL.md +195 -0
- package/template/skills/claude-document/SKILL.md +66 -0
- package/template/skills/claude-document/starter/document/chapters/01-document-shape/chapter.tsx +30 -0
- package/template/skills/claude-document/starter/document/chapters/01-document-shape/content/01-document-shape.mdx +51 -0
- package/template/skills/claude-document/starter/document/chapters/02-review-loop/chapter.tsx +30 -0
- package/template/skills/claude-document/starter/document/chapters/02-review-loop/content/01-review-loop.mdx +31 -0
- package/template/skills/claude-document/starter/document/components/ChapterOpenerVisual.tsx +96 -0
- package/template/skills/claude-document/starter/document/components/Page.tsx +27 -0
- package/template/skills/claude-document/starter/document/design.md +142 -0
- package/template/skills/claude-document/starter/document/index.tsx +89 -0
- package/template/skills/claude-document/starter/document/media/README.md +13 -0
- package/template/skills/claude-document/starter/document/openpress.config.mjs +26 -0
- package/template/skills/claude-document/starter/document/theme/README.md +15 -0
- package/template/skills/claude-document/starter/document/theme/base/page-contract.css +525 -0
- package/template/skills/claude-document/starter/document/theme/base/print.css +93 -0
- package/template/skills/claude-document/starter/document/theme/base/typography.css +612 -0
- package/template/skills/claude-document/starter/document/theme/fonts.css +4 -0
- package/template/skills/claude-document/starter/document/theme/page-surfaces/back-cover.css +72 -0
- package/template/skills/claude-document/starter/document/theme/page-surfaces/chapter-opener.css +236 -0
- package/template/skills/claude-document/starter/document/theme/page-surfaces/cover.css +309 -0
- package/template/skills/claude-document/starter/document/theme/page-surfaces/toc.css +213 -0
- package/template/skills/claude-document/starter/document/theme/patterns/_chart-frame.css +53 -0
- package/template/skills/claude-document/starter/document/theme/patterns/figure-grid.css +68 -0
- package/template/skills/claude-document/starter/document/theme/patterns/table-utilities.css +66 -0
- package/template/skills/claude-document/starter/document/theme/shell/reader-controls.css +789 -0
- package/template/skills/claude-document/starter/document/theme/tokens.css +89 -0
- package/template/skills/claude-document/starter/openpress.config.mjs +5 -0
- package/template/skills/editorial-monograph/SKILL.md +73 -0
- package/template/skills/editorial-monograph/starter/document/chapters/01-product-and-use-cases/content/01-product-and-use-cases.mdx +31 -0
- package/template/skills/editorial-monograph/starter/document/chapters/02-workflow/content/01-workflow.mdx +89 -0
- package/template/skills/editorial-monograph/starter/document/chapters/03-agent-skills-contributors/content/01-agent-skills-contributors.mdx +52 -0
- package/template/skills/editorial-monograph/starter/document/chapters/04-validation-deploy/content/01-validation-deploy.mdx +39 -0
- package/template/skills/editorial-monograph/starter/document/components/ChapterOpenerVisual/index.tsx +76 -0
- package/template/skills/editorial-monograph/starter/document/components/Page.tsx +27 -0
- package/template/skills/editorial-monograph/starter/document/components/TokenSwatchGrid/index.tsx +46 -0
- package/template/skills/editorial-monograph/starter/document/components/TokenSwatchGrid/style.css +63 -0
- package/template/skills/editorial-monograph/starter/document/components/TypeSpecimen/index.tsx +38 -0
- package/template/skills/editorial-monograph/starter/document/components/TypeSpecimen/style.css +111 -0
- package/template/skills/editorial-monograph/starter/document/design.md +279 -0
- package/template/skills/editorial-monograph/starter/document/index.tsx +73 -0
- package/template/skills/editorial-monograph/starter/document/media/README.md +13 -0
- package/template/skills/editorial-monograph/starter/document/openpress.config.mjs +26 -0
- package/template/skills/editorial-monograph/starter/document/theme/README.md +11 -0
- package/template/skills/editorial-monograph/starter/document/theme/base/page-contract.css +505 -0
- package/template/skills/editorial-monograph/starter/document/theme/base/print.css +93 -0
- package/template/skills/editorial-monograph/starter/document/theme/base/typography.css +336 -0
- package/template/skills/editorial-monograph/starter/document/theme/fonts.css +3 -0
- package/template/skills/editorial-monograph/starter/document/theme/page-surfaces/back-cover.css +43 -0
- package/template/skills/editorial-monograph/starter/document/theme/page-surfaces/chapter-opener.css +205 -0
- package/template/skills/editorial-monograph/starter/document/theme/page-surfaces/cover.css +147 -0
- package/template/skills/editorial-monograph/starter/document/theme/page-surfaces/toc.css +139 -0
- package/template/skills/editorial-monograph/starter/document/theme/patterns/_chart-frame.css +49 -0
- package/template/skills/editorial-monograph/starter/document/theme/patterns/figure-grid.css +68 -0
- package/template/skills/editorial-monograph/starter/document/theme/patterns/table-utilities.css +66 -0
- package/template/skills/editorial-monograph/starter/document/theme/shell/reader-controls.css +761 -0
- package/template/skills/editorial-monograph/starter/document/theme/tokens.css +80 -0
- package/template/skills/editorial-monograph/starter/openpress.config.mjs +5 -0
- package/template/skills/openpress/SKILL.md +114 -0
- package/template/skills/openpress/references/cli-commands.md +31 -0
- package/template/skills/openpress/references/local-review.md +43 -0
- package/template/skills/openpress-deploy/SKILL.md +69 -0
- package/template/skills/openpress-deploy/references/cloudflare-pages.md +51 -0
- package/template/skills/openpress-design/SKILL.md +51 -0
- package/template/skills/openpress-design/references/pdf-safe-css.md +29 -0
- package/template/skills/openpress-design/references/responsive-fixed-layout.md +48 -0
- package/template/skills/openpress-design/references/theme-and-components.md +77 -0
- package/template/skills/openpress-diagram-drawing/SKILL.md +44 -0
- package/template/skills/openpress-diagram-drawing/references/diagram-patterns.md +93 -0
- package/template/skills/openpress-document-hierarchy/SKILL.md +81 -0
- package/template/skills/openpress-document-hierarchy/agents/openai.yaml +4 -0
- package/template/skills/openpress-document-hierarchy/references/data-structures-outline.md +115 -0
- package/template/skills/openpress-init/SKILL.md +84 -0
- package/template/skills/openpress-style-pack-contributor/SKILL.md +62 -0
- package/template/skills/openpress-style-pack-contributor/references/starter-contract.md +49 -0
- package/template/skills/openpress-update/SKILL.md +88 -0
- package/template/skills/openpress-writing/SKILL.md +68 -0
- package/template/skills/openpress-writing/references/source-and-writing-rules.md +120 -0
- package/template/skills/teaching-notes-writing/SKILL.md +54 -0
- package/template/skills/teaching-notes-writing/references/programming.md +65 -0
- package/template/skills/teaching-notes-writing/references/teaching-patterns.md +60 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
/* 深色 chrome(navbar / sidebar / app background) */
|
|
3
|
+
--openpress-color-app-bg: #161616;
|
|
4
|
+
--openpress-color-border-subtle: #393939;
|
|
5
|
+
--openpress-color-border-strong: #6f6f6f;
|
|
6
|
+
--openpress-color-text-on-dark: #f4f4f4;
|
|
7
|
+
--openpress-color-text-secondary: #c6c6c6;
|
|
8
|
+
--openpress-color-text-placeholder: #8d8d8d;
|
|
9
|
+
--openpress-color-focus: #0f62fe;
|
|
10
|
+
|
|
11
|
+
/* 文件本身(白底文件、墨色內文) */
|
|
12
|
+
--openpress-color-document: #ffffff;
|
|
13
|
+
--openpress-color-ink: #161616;
|
|
14
|
+
--openpress-color-muted: #6f6f6f;
|
|
15
|
+
--openpress-color-line: #e0e0e0;
|
|
16
|
+
--openpress-color-soft-line: #f4f4f4;
|
|
17
|
+
|
|
18
|
+
/* 表格狀態符號 */
|
|
19
|
+
--openpress-color-green: #24a148;
|
|
20
|
+
|
|
21
|
+
/* 圖表 palette(柔和暖色系)
|
|
22
|
+
* 用於 data-foundation、milestone-roadmap、cost-donut、revenue-line-chart 等元件。
|
|
23
|
+
* 排序由淺到深,可以對應 phase / tier 的進階感:
|
|
24
|
+
* gold (起始 / current) → coral (中期) → coral-deep (後期) → dark (anchor / 成熟)
|
|
25
|
+
*/
|
|
26
|
+
--openpress-chart-gold: #FFB000;
|
|
27
|
+
--openpress-chart-coral: #FF6A4D;
|
|
28
|
+
--openpress-chart-coral-deep: #C9522B;
|
|
29
|
+
--openpress-chart-dark: #1F2328;
|
|
30
|
+
--openpress-chart-cream: #FFF3DB;
|
|
31
|
+
--openpress-chart-warm-gray: #B0A89A;
|
|
32
|
+
|
|
33
|
+
/* 對應的背景 tint(較飽和、用於 phase / tier 卡片) */
|
|
34
|
+
--openpress-chart-gold-bg: rgba(255, 176, 0, 0.20);
|
|
35
|
+
--openpress-chart-coral-bg: rgba(255, 106, 77, 0.16);
|
|
36
|
+
--openpress-chart-coral-deep-bg: rgba(201, 82, 43, 0.14);
|
|
37
|
+
--openpress-chart-dark-bg: rgba(31, 35, 40, 0.09);
|
|
38
|
+
|
|
39
|
+
/* 對應的中等飽和邊框色(配合 background tint) */
|
|
40
|
+
--openpress-chart-gold-border: rgba(255, 176, 0, 0.55);
|
|
41
|
+
--openpress-chart-coral-border: rgba(255, 106, 77, 0.5);
|
|
42
|
+
--openpress-chart-coral-deep-border: rgba(201, 82, 43, 0.42);
|
|
43
|
+
--openpress-chart-dark-border: rgba(31, 35, 40, 0.28);
|
|
44
|
+
|
|
45
|
+
/* Status — 文件內行內語意強調色(warn / success / info),
|
|
46
|
+
* 用於 <span class="status-warn|status-success|status-info">。
|
|
47
|
+
* 避免按色相命名(accent-gold 之類)以強制走語意。 */
|
|
48
|
+
--openpress-status-warn: #C9522B;
|
|
49
|
+
--openpress-status-success: #5C8C4F;
|
|
50
|
+
--openpress-status-info: #4A6B8A;
|
|
51
|
+
|
|
52
|
+
/* 字型 */
|
|
53
|
+
--openpress-font-body: "IBM Plex Sans", "PingFang TC", "Noto Sans TC", "Hiragino Sans", "Microsoft JhengHei", sans-serif;
|
|
54
|
+
--openpress-font-serif: "Noto Serif TC", "Songti TC", "Source Han Serif TC", "PMingLiU", serif;
|
|
55
|
+
--openpress-font-mono: "SFMono-Regular", "Menlo", "Consolas", monospace;
|
|
56
|
+
|
|
57
|
+
/* 字級(固定 pt 用於小元素;標題改用 container queries 算) */
|
|
58
|
+
--openpress-text-sm: 9.5pt;
|
|
59
|
+
--openpress-text-md: 10.5pt;
|
|
60
|
+
|
|
61
|
+
/* 行距 */
|
|
62
|
+
--openpress-leading-body: 1.72;
|
|
63
|
+
--openpress-leading-table: 1.45;
|
|
64
|
+
|
|
65
|
+
/* 間距系統(mm 為主、適合 print 與 A4 視覺節奏) */
|
|
66
|
+
--openpress-space-1: 2mm;
|
|
67
|
+
--openpress-space-2: 4mm;
|
|
68
|
+
--openpress-space-3: 6mm;
|
|
69
|
+
--openpress-space-4: 9mm;
|
|
70
|
+
--openpress-space-5: 13mm;
|
|
71
|
+
|
|
72
|
+
/* Page geometry — A4 預設。
|
|
73
|
+
* 換成 B5 / Letter / 16:9 投影片時改這三條,其他 CSS 與 page-contract `@page`
|
|
74
|
+
* 都會跟著走。注意:@page size 改用 length pair 時,PDF 與瀏覽器 print 都會吃。 */
|
|
75
|
+
--openpress-page-width: 210mm;
|
|
76
|
+
--openpress-page-height: 297mm;
|
|
77
|
+
--openpress-page-aspect-ratio: 210 / 297;
|
|
78
|
+
--openpress-page-height-ratio: calc(297 / 210);
|
|
79
|
+
--openpress-page-margin: 18mm;
|
|
80
|
+
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openpress
|
|
3
|
+
description: Use when operating a open-press workspace or framework checkout through CLI commands, discovering project status, validating/exporting/rendering/PDF output, inspecting structure/issues, searching or safely replacing source text, managing pending @openpress-comment markers, or deciding which open-press skill owns a task.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# open-press Core
|
|
7
|
+
|
|
8
|
+
open-press owns the tool surface and delivery boundaries. **Use this skill first** when the task involves the CLI, workspace status, generated output, or deciding which specialist skill should take over.
|
|
9
|
+
|
|
10
|
+
This skill is also the **single source of truth** for the source vs generated boundary. Other skills reference this section instead of re-listing paths.
|
|
11
|
+
|
|
12
|
+
## Responsibilities
|
|
13
|
+
|
|
14
|
+
- Choose safe open-press CLI commands.
|
|
15
|
+
- Define the canonical source vs framework vs generated path boundary (see below).
|
|
16
|
+
- Inspect workspace state before broad edits.
|
|
17
|
+
- Open and manage the local workbench review loop.
|
|
18
|
+
- Manage `@openpress-comment` markers (list, apply, resolve, clear).
|
|
19
|
+
- Route domain work to the owning skill.
|
|
20
|
+
- Require verification before declaring output ready.
|
|
21
|
+
|
|
22
|
+
## Skill Routing
|
|
23
|
+
|
|
24
|
+
open-press skills fall into three categories:
|
|
25
|
+
|
|
26
|
+
1. **System operation skills**: how to operate open-press itself. `openpress` is the main entry point; lifecycle helpers cover init, update, and deploy.
|
|
27
|
+
2. **Writing skills**: content strategy, suggested skeletons, language, tone, genre rules. They do not own CLI commands or validation depth.
|
|
28
|
+
3. **Style pack skills**: reusable visual starters under `skills/<pack>/starter/`. They do not own workspace operation.
|
|
29
|
+
|
|
30
|
+
| Skill | Owns |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| `openpress` | CLI, inspect/search/replace, source/generated boundary, validation/export/render/PDF command choice, `@openpress-comment` operations, skill routing |
|
|
33
|
+
| `openpress-init` | First-time intake conversation, style-pack recommendation, metadata gathering, running `init`, handing off to writing/design |
|
|
34
|
+
| `openpress-update` | Release upgrade flow: pulling new framework, CHANGELOG-driven migrations, post-upgrade verification |
|
|
35
|
+
| `openpress-writing` | Reader-facing content, narrative, captions, factual boundaries, portable writing skill loading |
|
|
36
|
+
| `openpress-document-hierarchy` | H1/H2/H3/H4 model, TOC depth, reader outline, appendix placement |
|
|
37
|
+
| `openpress-design` | Workspace visual system: `document/theme/`, `document/components/`, PDF-safe layout |
|
|
38
|
+
| `openpress-diagram-drawing` | Diagram semantics: nodes, arrows, labels, states, figure text |
|
|
39
|
+
| `openpress-deploy` | Deploy config, preflight, dry run, public publish confirmation |
|
|
40
|
+
| `openpress-style-pack-contributor` | Bundled packs under `skills/<pack>/starter/` (the upstream design, not workspace consumption) |
|
|
41
|
+
| Portable writing skills (`chinese-ai-writing-polish`, `teaching-notes-writing`, …) | Language, tone, genre, learner-facing rules. Loaded via `openpress-writing` |
|
|
42
|
+
|
|
43
|
+
## Source Boundary (canonical)
|
|
44
|
+
|
|
45
|
+
Edit source, not generated output. **This list is the single authoritative version**; other skills link here.
|
|
46
|
+
|
|
47
|
+
| Layer | Paths | Edit? |
|
|
48
|
+
| --- | --- | --- |
|
|
49
|
+
| Workspace source | `openpress.config.mjs`, `document/index.tsx`, `document/chapters/`, `document/design.md`, `document/theme/`, `document/components/`, `document/media/` | yes — domain skills |
|
|
50
|
+
| Skill / pack source | `skills/<pack>/SKILL.md`, `skills/<pack>/starter/**`, other skill files under `skills/` | yes — `openpress-style-pack-contributor` for packs; skill maintainers for own skill |
|
|
51
|
+
| Framework | `engine/`, `src/`, `tests/`, `docs/superpowers/`, `vite.config.ts`, `tsconfig.json`, `index.html` | yes — framework agents only |
|
|
52
|
+
| Generated | `public/openpress/`, `dist-react/`, `.deploy/`, `.openpress/` | **never hand-edit** |
|
|
53
|
+
|
|
54
|
+
If a workspace lacks `document/index.tsx`, run `node engine/cli.mjs migrate-to-react` before broad structural rewrites.
|
|
55
|
+
|
|
56
|
+
If `memory/AGENTS.md` exists, read it before framework-level `AGENTS.md`; it usually marks a downstream document workspace where `document/` is git-ignored project content, not source you commit upstream.
|
|
57
|
+
|
|
58
|
+
## Workflow
|
|
59
|
+
|
|
60
|
+
1. Orient: read `AGENTS.md`, `memory/AGENTS.md` if present, and the relevant specialist skill.
|
|
61
|
+
2. Inspect before broad edits with `inspect --json`, `search --json`, or `rg`.
|
|
62
|
+
3. Route domain work to the owning skill instead of duplicating its rules.
|
|
63
|
+
4. Edit only source paths in the owning area (see boundary table).
|
|
64
|
+
5. Verify with the narrowest command that proves the claim.
|
|
65
|
+
|
|
66
|
+
## Starting A New Workspace
|
|
67
|
+
|
|
68
|
+
Route to `openpress-init` for the intake conversation. The CLI itself is:
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
node engine/cli.mjs init <target> --skill <pack-name>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Style packs are auto-discovered from `skills/<pack>/SKILL.md` where `starter/` exists.
|
|
75
|
+
|
|
76
|
+
## Updating An Existing Workspace
|
|
77
|
+
|
|
78
|
+
Route to `openpress-update` for release-driven upgrades.
|
|
79
|
+
|
|
80
|
+
## @openpress-comment Operations
|
|
81
|
+
|
|
82
|
+
Pending `@openpress-comment` markers are source markers, not UI-only notes. Apply them as small source edits close to the marker, then remove the marker only after the comment is resolved or explicitly cleared.
|
|
83
|
+
|
|
84
|
+
Scope:
|
|
85
|
+
|
|
86
|
+
- List, apply, resolve, clear markers.
|
|
87
|
+
- Edit only the source file containing the marker (paths follow the Source Boundary table above).
|
|
88
|
+
- Route domain-heavy rewrites to the owning skill (writing / hierarchy / design / diagram).
|
|
89
|
+
- Do not rewrite unrelated sections while resolving one comment.
|
|
90
|
+
|
|
91
|
+
Operations:
|
|
92
|
+
|
|
93
|
+
| Need | Action |
|
|
94
|
+
| --- | --- |
|
|
95
|
+
| See pending comments | `rg "@openpress-comment" document -n` |
|
|
96
|
+
| Apply one comment | Edit nearby source, then delete that marker line |
|
|
97
|
+
| Clear one without applying | Delete that marker line only after the user asks |
|
|
98
|
+
| Clear all comments | Use the comments tab or delete all marker lines only after explicit confirmation |
|
|
99
|
+
| Comment is ambiguous | Ask for clarification and leave the marker in place |
|
|
100
|
+
|
|
101
|
+
After applying, run `npm run openpress:validate`; also run `npm run openpress:render` when layout, visual output, or React/MDX structure changed.
|
|
102
|
+
|
|
103
|
+
Common mistakes: do not clear a marker just because it was read; do not batch unrelated rewrites under one comment.
|
|
104
|
+
|
|
105
|
+
## When To Read References
|
|
106
|
+
|
|
107
|
+
- Read `references/cli-commands.md` when choosing commands, using search/replace, or explaining verification depth.
|
|
108
|
+
- Read `references/local-review.md` when opening the workbench, using Document/Design System/Project views, or coordinating visual review before export/deploy.
|
|
109
|
+
|
|
110
|
+
## Safety Rules
|
|
111
|
+
|
|
112
|
+
- Preview broad replacements before applying them.
|
|
113
|
+
- Do not publish without explicit user confirmation naming the target (handled by `openpress-deploy`).
|
|
114
|
+
- Do not claim render, PDF, or deploy readiness without fresh command output.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# open-press CLI Commands
|
|
2
|
+
|
|
3
|
+
Prefer package scripts in the framework checkout. Use direct `node engine/cli.mjs ...` when a downstream workspace lacks scripts or when a command has no script wrapper.
|
|
4
|
+
|
|
5
|
+
| Need | Command |
|
|
6
|
+
| --- | --- |
|
|
7
|
+
| Top-level usage | `node engine/cli.mjs --help` |
|
|
8
|
+
| Migrate legacy Markdown workspace to React/MDX | `node engine/cli.mjs migrate-to-react . --dry-run` |
|
|
9
|
+
| Validate structure and delivery gates | `npm run openpress:validate` |
|
|
10
|
+
| Export source to open-press JSON | `npm run openpress:export` |
|
|
11
|
+
| Build React reader | `npm run openpress:render` |
|
|
12
|
+
| Open local workbench | `npm run dev` |
|
|
13
|
+
| Preview production build | `npm run openpress:preview` |
|
|
14
|
+
| Generate PDF | `npm run openpress:pdf` |
|
|
15
|
+
| Inspect structure/issues as JSON | `node engine/cli.mjs inspect . --json` |
|
|
16
|
+
| Search public source text | `node engine/cli.mjs search . "<query>" --json` |
|
|
17
|
+
| Search all workspace source classes | `node engine/cli.mjs search . "<query>" --json --scope all` |
|
|
18
|
+
| List pending inspector comments | `rg "@openpress-comment" document -n` |
|
|
19
|
+
| Preview replacement without writing | `node engine/cli.mjs replace . "<from>" "<to>" --json` |
|
|
20
|
+
| Apply replacement after preview | `node engine/cli.mjs replace . "<from>" "<to>" --apply` |
|
|
21
|
+
| Dry-run deploy workflow | `npm run openpress:deploy:dry-run` |
|
|
22
|
+
| Publish after confirmation | use `openpress-deploy` |
|
|
23
|
+
|
|
24
|
+
Command notes:
|
|
25
|
+
|
|
26
|
+
- `search` and `replace` default to `--scope content`.
|
|
27
|
+
- Add `--scope all` to also include `document/design.md`, component, media, and theme source.
|
|
28
|
+
- Add `--case-sensitive` only when casing matters.
|
|
29
|
+
- `replace` previews by default and writes only with `--apply`.
|
|
30
|
+
- `replace` does not touch code blocks unless `--include-code` is provided.
|
|
31
|
+
- Per-command `--help` is not implemented yet; use top-level usage and command error messages.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Local Review
|
|
2
|
+
|
|
3
|
+
open-press local review is the human feedback loop before PDF or public deploy.
|
|
4
|
+
|
|
5
|
+
## Workflow
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm run openpress:export
|
|
9
|
+
npm run dev
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use the URL printed by Vite. It is usually:
|
|
13
|
+
|
|
14
|
+
```txt
|
|
15
|
+
http://127.0.0.1:5173/?dev=1
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
If `5173` is occupied, use the fallback port reported by the dev server.
|
|
19
|
+
|
|
20
|
+
## Workbench Views
|
|
21
|
+
|
|
22
|
+
- **Document**: reader-facing document.
|
|
23
|
+
- **Design System**: visual rules and specimens.
|
|
24
|
+
- **Project**: source inventory, components, media, and status.
|
|
25
|
+
|
|
26
|
+
After source edits:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm run openpress:export
|
|
30
|
+
npm run openpress:validate
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
For renderer-sensitive visual, bookmark, or layout changes, also run:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
npm run openpress:render
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Safety Rules
|
|
40
|
+
|
|
41
|
+
- A local preview is not deploy approval.
|
|
42
|
+
- Do not hand-edit generated output to fix preview issues.
|
|
43
|
+
- If preview is blank or stale, inspect export status, dev server output, and browser console before changing source content.
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openpress-deploy
|
|
3
|
+
description: Use when preparing, configuring, checking, staging, or publishing a open-press document to public hosting, especially Cloudflare Pages, deploy setup, deploy buttons, deploy status, public release checks, or safe deployment workflow.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# open-press Deploy
|
|
7
|
+
|
|
8
|
+
open-press deploy owns the public-release gate. Use it only when the user asks to configure, inspect, dry-run, or publish a open-press document.
|
|
9
|
+
|
|
10
|
+
## Responsibilities
|
|
11
|
+
|
|
12
|
+
- Inspect deploy config in `openpress.config.mjs`.
|
|
13
|
+
- Check target adapter, staging source, project name, and confirmation settings.
|
|
14
|
+
- Run deploy preflight and dry runs.
|
|
15
|
+
- Keep secrets out of source files.
|
|
16
|
+
- Require explicit confirmation before publishing.
|
|
17
|
+
- Report public URL and PDF URL after successful deploy.
|
|
18
|
+
|
|
19
|
+
## Boundaries
|
|
20
|
+
|
|
21
|
+
- `openpress` owns generic CLI usage, non-deploy validation, local review, and the source/generated boundary.
|
|
22
|
+
- `openpress-writing` and `openpress-design` own document content and visual readiness.
|
|
23
|
+
- This skill owns public target confirmation and deploy execution.
|
|
24
|
+
|
|
25
|
+
## Public Deploy Rule
|
|
26
|
+
|
|
27
|
+
Never publish without a clear confirmation that names the target project.
|
|
28
|
+
|
|
29
|
+
Good confirmation shape:
|
|
30
|
+
|
|
31
|
+
```txt
|
|
32
|
+
This will publish the current open-press build to Cloudflare Pages project `<projectName>` from `<deploy.source>`.
|
|
33
|
+
Do you want me to deploy now?
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Preflight
|
|
37
|
+
|
|
38
|
+
Before real deploy, run the commands that prove the output is ready:
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
npm run openpress:export
|
|
42
|
+
npm run openpress:validate
|
|
43
|
+
npm run openpress:render
|
|
44
|
+
npm run openpress:pdf
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Also scan public-facing source for unfinished markers:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
rg "\\[TODO:|\\[FIX:|\\[DRAFT:" document/chapters document/design.md
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Deploy Commands
|
|
54
|
+
|
|
55
|
+
Dry run:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run openpress:deploy:dry-run
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Publish after explicit confirmation:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
npm run openpress:deploy -- --confirm
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## When To Read References
|
|
68
|
+
|
|
69
|
+
- Read `references/cloudflare-pages.md` when creating or repairing Cloudflare Pages config, project setup, Wrangler auth expectations, or UI deploy-button behavior.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
# Cloudflare Pages Deploy
|
|
2
|
+
|
|
3
|
+
## Config Shape
|
|
4
|
+
|
|
5
|
+
Write confirmed deploy settings into `openpress.config.mjs`:
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
deploy: {
|
|
9
|
+
adapter: "cloudflare-pages",
|
|
10
|
+
source: ".deploy/<name>",
|
|
11
|
+
projectName: "<cloudflare-pages-project>",
|
|
12
|
+
commitDirty: false,
|
|
13
|
+
requiresConfirmation: true,
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Prefer an explicit `deploy.projectName`. If it is missing, ask the user to confirm the project name before writing config or creating a Cloudflare Pages project.
|
|
18
|
+
|
|
19
|
+
## Setup Workflow
|
|
20
|
+
|
|
21
|
+
1. Discover the workspace and load open-press config.
|
|
22
|
+
2. Confirm the document is intended for public hosting.
|
|
23
|
+
3. Inspect deploy config and derive the target:
|
|
24
|
+
- use explicit `deploy.projectName`;
|
|
25
|
+
- otherwise use a user-confirmed slug;
|
|
26
|
+
- do not invent and write a public target silently.
|
|
27
|
+
4. Ask whether to create a new Cloudflare Pages project or use an existing one.
|
|
28
|
+
5. Verify Wrangler auth outside source control.
|
|
29
|
+
6. Run dry run before real deploy.
|
|
30
|
+
|
|
31
|
+
If creating a new project, ask before running:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npx wrangler pages project create <projectName> --production-branch main
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Secrets
|
|
38
|
+
|
|
39
|
+
Do not write API tokens or secrets into open-press config, Markdown, `design.md`, or skill files.
|
|
40
|
+
|
|
41
|
+
## UI Deploy Button Contract
|
|
42
|
+
|
|
43
|
+
A UI deploy button is a review surface over the CLI workflow. It should:
|
|
44
|
+
|
|
45
|
+
- show target, source, and status before publishing;
|
|
46
|
+
- block when `deploy.projectName` is missing;
|
|
47
|
+
- require confirmation before posting to the deploy endpoint;
|
|
48
|
+
- call the same CLI-backed deploy path;
|
|
49
|
+
- show success URL, PDF URL, failure output, and dirty status.
|
|
50
|
+
|
|
51
|
+
It must not create a second hidden deployment behavior.
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openpress-design
|
|
3
|
+
description: Use when designing or revising open-press visual systems, page rhythm, print/PDF-safe CSS, figure/table/chart presentation, covers, style packs, or document component recipes.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# open-press Design
|
|
7
|
+
|
|
8
|
+
open-press design owns the **workspace visual system** — the CSS and components that live in a user's `document/` after a pack has been initialized. It decides how the document looks while keeping fixed-layout, mobile, and PDF output stable.
|
|
9
|
+
|
|
10
|
+
## Responsibilities
|
|
11
|
+
|
|
12
|
+
- Choose typography, color, spacing, page rhythm, covers, figures, tables, and chart treatment.
|
|
13
|
+
- Edit `document/theme/`, `document/design.md`, and `document/components/` in a workspace.
|
|
14
|
+
- Decide when dense prose should become a reusable visual component.
|
|
15
|
+
- Keep `document/design.md` public-readable so users and agents can review the same rules.
|
|
16
|
+
- Preserve React reader output as the public reading surface; PDF is an export artifact.
|
|
17
|
+
|
|
18
|
+
## Boundaries (by path, not by topic)
|
|
19
|
+
|
|
20
|
+
| Path | Owner |
|
|
21
|
+
| --- | --- |
|
|
22
|
+
| `document/theme/`, `document/components/`, `document/design.md` (workspace) | **this skill** |
|
|
23
|
+
| `skills/<pack>/starter/document/theme/`, `…/components/`, `…/design.md` (upstream pack) | `openpress-style-pack-contributor` |
|
|
24
|
+
| `engine/`, `src/` (framework rendering) | framework agents only |
|
|
25
|
+
|
|
26
|
+
Other domain skills:
|
|
27
|
+
|
|
28
|
+
- `openpress-writing` owns claims, prose, audience, and captions as language.
|
|
29
|
+
- `openpress-diagram-drawing` owns diagram semantics; this skill owns visual skin.
|
|
30
|
+
- `openpress-deploy` owns public release.
|
|
31
|
+
|
|
32
|
+
Source paths follow `openpress` > Source Boundary.
|
|
33
|
+
|
|
34
|
+
## Hard Rules
|
|
35
|
+
|
|
36
|
+
- Avoid uncontrolled overflow into headers, footers, or fixed pages.
|
|
37
|
+
- Do not depend on local-only fonts when public, iPad, or PDF-stable output matters.
|
|
38
|
+
- Keep page-surface CSS, generic patterns, and component CSS in their owning layers.
|
|
39
|
+
|
|
40
|
+
## Workflow
|
|
41
|
+
|
|
42
|
+
1. Read `document/design.md` before changing theme or components.
|
|
43
|
+
2. Edit source CSS/components only (see `openpress` > Source Boundary).
|
|
44
|
+
3. Use `openpress` to choose validation depth.
|
|
45
|
+
4. For renderer-sensitive changes, ask `openpress` which render/inspect/local-review verification is needed before declaring the design ready.
|
|
46
|
+
|
|
47
|
+
## When To Read References
|
|
48
|
+
|
|
49
|
+
- Read `references/theme-and-components.md` before moving CSS layers, extracting components, changing `document/design.md`, or localizing page-surface defaults.
|
|
50
|
+
- Read `references/pdf-safe-css.md` before changing fixed page geometry, print behavior, or overflow-sensitive CSS.
|
|
51
|
+
- Read `references/responsive-fixed-layout.md` before changing mobile, tablet, zoom, spread, or responsive behavior.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# PDF-Safe CSS Notes
|
|
2
|
+
|
|
3
|
+
Use this reference when editing open-press CSS that affects fixed pages, PDF output, or renderer stability.
|
|
4
|
+
|
|
5
|
+
## Prefer
|
|
6
|
+
|
|
7
|
+
- fixed page geometry;
|
|
8
|
+
- container-relative type scales;
|
|
9
|
+
- explicit image dimensions or max dimensions;
|
|
10
|
+
- `break-inside: avoid` only for blocks that must stay together;
|
|
11
|
+
- table and figure captions outside the media object;
|
|
12
|
+
- CSS variables for theme values.
|
|
13
|
+
|
|
14
|
+
## Avoid
|
|
15
|
+
|
|
16
|
+
- viewport-width type for fixed-format content;
|
|
17
|
+
- uncontrolled `position: absolute` near footer/header;
|
|
18
|
+
- large nested cards;
|
|
19
|
+
- transform-based layout where measurement matters;
|
|
20
|
+
- SVG text for document copy unless the visual must be one fixed asset;
|
|
21
|
+
- mobile RWD changes that alter canonical PDF layout.
|
|
22
|
+
|
|
23
|
+
## PDF Export
|
|
24
|
+
|
|
25
|
+
PDF output is an export artifact. Do not embed the browser's built-in PDF viewer as the primary open-press reading surface; it introduces a second toolbar, second page model, and inconsistent navigation. The deployed reader should remain open-press-owned DOM.
|
|
26
|
+
|
|
27
|
+
## Design Skill Boundary
|
|
28
|
+
|
|
29
|
+
PDF-safe does not mean visually conservative. It means the chosen design must survive measurement, pagination, and rendering.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Responsive Fixed-Layout Notes
|
|
2
|
+
|
|
3
|
+
Use this reference when editing open-press styles that affect mobile, tablet, zoom, spread mode, or responsive behavior.
|
|
4
|
+
|
|
5
|
+
## Core Principle
|
|
6
|
+
|
|
7
|
+
open-press pages have canonical page geometry. Responsive behavior should scale the page and surrounding workspace, not re-author the document for every viewport.
|
|
8
|
+
|
|
9
|
+
A deployed open-press reader should stay DOM-rendered and open-press-owned. Do not embed the browser PDF viewer to solve responsive problems; that adds a second reader UI and breaks the intended workspace model.
|
|
10
|
+
|
|
11
|
+
## Page Rules
|
|
12
|
+
|
|
13
|
+
- Keep one canonical width/height ratio for each page.
|
|
14
|
+
- Use CSS variables for page dimensions and derive scale from the available stage size.
|
|
15
|
+
- On narrow viewports, show one page at a time and scale the page down.
|
|
16
|
+
- On wide viewports, spread mode may show two pages if both fit without clipping.
|
|
17
|
+
- Preserve page order, anchors, bookmarks, figure indexes, and page numbers across breakpoints.
|
|
18
|
+
- do not reflow document copy into a different editorial structure on mobile.
|
|
19
|
+
|
|
20
|
+
## SVG Rules
|
|
21
|
+
|
|
22
|
+
- Inline SVG charts must keep a stable `viewBox` and use CSS `aspect-ratio` that matches that viewBox.
|
|
23
|
+
- SVG figures should use `display: block`, `max-width: 100%`, `height: auto`, and `overflow: visible`.
|
|
24
|
+
- Scale the SVG as one fixed graphic within the canonical page; do not reflow labels, legends, or axes per breakpoint.
|
|
25
|
+
- External SVG assets used through `<img>` should be constrained like other images: fixed frame, `object-fit: contain`, and explicit max dimensions.
|
|
26
|
+
|
|
27
|
+
## Workspace Rules
|
|
28
|
+
|
|
29
|
+
- The React open-press workbench shell may be responsive: side panels can collapse, navigation can become denser, and controls may hide secondary metadata.
|
|
30
|
+
- The document page itself should not change its typography hierarchy, captions, table structure, or figure composition just because the viewport changed.
|
|
31
|
+
- If text becomes too small on mobile, prefer pinch/zoom or horizontal-safe page scaling over rewriting the document layout.
|
|
32
|
+
- Keep a single scroll owner per viewport mode. Avoid nested vertical scrollbars between body, stage, and page.
|
|
33
|
+
|
|
34
|
+
## Avoid
|
|
35
|
+
|
|
36
|
+
- viewport-width font sizing inside fixed pages;
|
|
37
|
+
- mobile-specific page content order;
|
|
38
|
+
- breakpoints that alter canonical page pagination;
|
|
39
|
+
- iframe-based PDF readers as the central stage;
|
|
40
|
+
- CSS transforms that leave hit targets, bookmarks, or scroll sync using stale geometry.
|
|
41
|
+
|
|
42
|
+
## Acceptance Checklist
|
|
43
|
+
|
|
44
|
+
- Desktop, tablet, and mobile all show the same page count.
|
|
45
|
+
- Bookmark clicks land on the same logical page across breakpoints.
|
|
46
|
+
- Figures and tables retain captions and do not overflow.
|
|
47
|
+
- The page is scaled or positioned by the workspace, not redesigned by the viewport.
|
|
48
|
+
- There is no embedded browser PDF toolbar inside the open-press reader.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
# Theme And Component Boundaries
|
|
2
|
+
|
|
3
|
+
## Theme Layers
|
|
4
|
+
|
|
5
|
+
Use theme layers by responsibility:
|
|
6
|
+
|
|
7
|
+
| Layer | Owns |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `document/theme/tokens.css` | variables only: colors, fonts, type scale, spacing, chart colors, shared numeric tokens |
|
|
10
|
+
| `document/theme/fonts.css` and `fonts/` | font-face sources copied to `/openpress/fonts.css` and `/openpress/fonts/` |
|
|
11
|
+
| `document/theme/base/` | global page contract, typography, figures, tables, captions, TOC, print safeguards |
|
|
12
|
+
| `document/theme/page-surfaces/` | whole-page layouts such as cover, TOC, optional chapter openers, back cover, divider pages |
|
|
13
|
+
| `document/theme/patterns/` | reusable document-wide class patterns |
|
|
14
|
+
| `document/theme/shell/` | exported reader controls around the document |
|
|
15
|
+
| `document/components/<name>/style.css` | instance-scoped component CSS |
|
|
16
|
+
|
|
17
|
+
Do not put page-surface or component-specific CSS in `base/typography.css`.
|
|
18
|
+
|
|
19
|
+
## Component Extraction
|
|
20
|
+
|
|
21
|
+
Prefer React components when a visual block has structured sub-elements, repeats with different props, or would otherwise become a large inline HTML island.
|
|
22
|
+
|
|
23
|
+
Component shape:
|
|
24
|
+
|
|
25
|
+
```txt
|
|
26
|
+
document/components/ComponentName.tsx
|
|
27
|
+
document/components/ComponentName/
|
|
28
|
+
index.tsx # default-exported React component
|
|
29
|
+
style.css # optional component-scoped CSS
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Use PascalCase component names so MDX can call them directly:
|
|
33
|
+
|
|
34
|
+
```mdx
|
|
35
|
+
<ProcessDiagram title="Deploy flow" steps={["Validate", "Render", "Deploy"]} />
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Props live in TypeScript types or interfaces next to the component. Do not add sidecar renderer, schema, data, or custom element bridge files.
|
|
39
|
+
|
|
40
|
+
Keep image grids inline when pagination owns their page-break behavior. Do not extract foundational page surfaces such as cover/back-cover/chapter-opener unless the design system does it as a coordinated React page-surface change.
|
|
41
|
+
|
|
42
|
+
## Page Surface Chrome
|
|
43
|
+
|
|
44
|
+
The renderer owns page chrome policy. Theme CSS should style the contract, not invent per-document footer hacks:
|
|
45
|
+
|
|
46
|
+
| Page kind | Theme surface | Footer |
|
|
47
|
+
| --- | --- | --- |
|
|
48
|
+
| `cover` | `page-surfaces/cover.css` | off |
|
|
49
|
+
| `toc` | `page-surfaces/toc.css` | off |
|
|
50
|
+
| `chapter-opener` | `page-surfaces/chapter-opener.css` when the pack supports book-like dividers | off |
|
|
51
|
+
| `content` | `base/typography.css` and patterns/components | on |
|
|
52
|
+
| `back-cover` | `page-surfaces/back-cover.css` | off |
|
|
53
|
+
|
|
54
|
+
Use `.reader-page.no-footer .page-frame` for layout rows when a surface has no footer. Do not leave empty footer text or hide meaningful generated page numbers with one-off selectors.
|
|
55
|
+
|
|
56
|
+
## Design Document Source
|
|
57
|
+
|
|
58
|
+
`document/design.md` is a single public-readable design brief. It should describe the same theme the document actually uses:
|
|
59
|
+
|
|
60
|
+
- typography hierarchy and scale;
|
|
61
|
+
- cover, TOC, optional chapter-opener, chapter, and back-cover direction;
|
|
62
|
+
- paragraphs, lists, quotes, callouts;
|
|
63
|
+
- image, image-grid, chart, table, caption, and dense-content stress cases.
|
|
64
|
+
|
|
65
|
+
Caption wording and numbering belong to `openpress-writing` and the renderer. Design may style `figcaption`, `caption`, and `[data-openpress-caption]`, but should not require authors to maintain figure/table numbers or duplicate caption text inside visuals.
|
|
66
|
+
|
|
67
|
+
Do not create a second hidden design brief unless the user explicitly asks for a sandbox.
|
|
68
|
+
|
|
69
|
+
## Localization Defaults
|
|
70
|
+
|
|
71
|
+
open-press engine does not embed a complete language system. Audit these per document:
|
|
72
|
+
|
|
73
|
+
- frontmatter `title:` on cover, TOC, and back cover;
|
|
74
|
+
- `theme/tokens.css` font stacks;
|
|
75
|
+
- `theme/base/typography.css` chapter and section numbering rules.
|
|
76
|
+
|
|
77
|
+
Workbench UI strings in `src/openpress/` are application UI and belong to framework work, not document styling.
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openpress-diagram-drawing
|
|
3
|
+
description: Use when drawing or revising open-press document diagrams, especially concept diagrams, comparison figures, process states, data-structure nodes, pointers, arrows, before/after states, linked lists, stacks, queues, trees, or memory relationship figures.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# open-press Diagram Drawing
|
|
7
|
+
|
|
8
|
+
This skill owns diagram semantics, not visual skin. It decides what the diagram should show and what text belongs inside the figure.
|
|
9
|
+
|
|
10
|
+
## Core Rule
|
|
11
|
+
|
|
12
|
+
Draw the relationship, not the explanation.
|
|
13
|
+
|
|
14
|
+
Figure bodies may contain only spatially meaningful information: object labels, pointer names, field names, axes, legends, short state labels, node values, `NULL`, and operation-order labels.
|
|
15
|
+
|
|
16
|
+
Move reasons, warnings, edge cases, teaching commentary, and interpretation into surrounding prose or captions.
|
|
17
|
+
|
|
18
|
+
## Responsibilities
|
|
19
|
+
|
|
20
|
+
- Choose whether a concept needs a diagram, table, code block, or prose.
|
|
21
|
+
- Define nodes, links, arrows, states, labels, and before/after relationships.
|
|
22
|
+
- Keep figure text lean and connected to position or direction.
|
|
23
|
+
- Prevent diagrams from containing answers, production notes, or caption-like sentences.
|
|
24
|
+
|
|
25
|
+
## Boundaries
|
|
26
|
+
|
|
27
|
+
- `openpress` owns validation/render command choice and the source/generated boundary.
|
|
28
|
+
- `openpress-design` owns visual skin, typography, CSS, and component implementation.
|
|
29
|
+
- `openpress-writing` owns the surrounding explanation and caption wording.
|
|
30
|
+
- `teaching-notes-writing` (loaded via `openpress-writing`) owns learner-facing practice flow.
|
|
31
|
+
|
|
32
|
+
## Workflow
|
|
33
|
+
|
|
34
|
+
1. Identify the diagram job: comparison, process state, relationship snapshot, before/after, operation sequence, traversal trace, or data representation.
|
|
35
|
+
2. Choose the surface:
|
|
36
|
+
- diagram for links, ownership, direction, state changes;
|
|
37
|
+
- table for dense comparisons or many trace rows;
|
|
38
|
+
- code block for exact syntax.
|
|
39
|
+
3. Draw from semantics first; let style follow.
|
|
40
|
+
4. Check whether the diagram can be understood without explanatory sentences inside the visual.
|
|
41
|
+
|
|
42
|
+
## When To Read References
|
|
43
|
+
|
|
44
|
+
- Read `references/diagram-patterns.md` for linked-list, circular-list, doubly-list, stack, queue, polynomial, sparse-structure, and tree drawing patterns.
|